Skip to content

[Feature]: The package @objectstack/spec (v0.1.1) is now the "Constitution" for all Metadata/AST interfaces.Β #134

@hotlong

Description

@hotlong

Is your feature request related to a problem? Please describe.

Role: ObjectStack Senior Architect

Mission: Protocol Migration & Type Alignment

We are refactoring the objectql monorepo to strictly adhere to the new upstream protocol definition.
The package @objectstack/spec (v0.1.1) is now the "Constitution" for all Metadata/AST interfaces.

Context

I have installed @objectstack/spec in packages/foundation/core and plan to install it in packages/foundation/types.
Currently, packages/foundation/types contains duplicate manual definitions of what is now in the Spec.

Your Task

Execute the following "Atomic Workflow" to align the codebase:

  1. Analyze the Spec

    • Check the exports of @objectstack/spec.
    • Identify which interfaces in packages/foundation/types/src/*.ts overlap with the Spec (e.g., ObjectConfig, FieldConfig, ActionConfig).
  2. Refactor "The Constitution" (@objectql/types)

    • Modify packages/foundation/types/package.json: Add dependency @objectstack/spec.
    • Update packages/foundation/types/src/index.ts: Re-export common types from the Spec.
    • Refactor individual files (e.g., object.ts):
      • DELETE local interfaces that duplicate the Spec.
      • EXTEND Spec interfaces if we have runtime-specific properties that are not part of the wire protocol.
      • Example pattern:
        import { ObjectSpecification } from '@objectstack/spec';
        // Only add properties that exist in Runtime but NOT in Spec
        export interface ObjectConfig extends ObjectSpecification {
            // runtime_cache_key?: string;
        }
  3. Update the Engine (@objectql/core)

    • Ensure core imports strictly from @objectql/types (which now bridges the Spec) or directly from @objectstack/spec only if needed for value objects/constants.
    • Fix any type errors resulting from the switch (e.g., strict null checks or changed property names).

Constraints

  • Strict Typing: No any. Use unknown with type guards if necessary.
  • Zero Duplication: If a type exists in @objectstack/spec, do not redefine it.
  • Backwards Compatibility: If the Spec explicitly changes a field name, mark the old one as @deprecated in our local type if needed, or update the Core to use the new standard.

Start by listing the files in packages/foundation/types/src that need to be modified based on the standard *.object.yml or *.field.yml patterns.

Describe the solution you'd like

Describe alternatives you've considered

No response

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions