WORK-105
ID:WORK-105Status:done

Add dual-signature support to createComponentRenderable and update RuneDescriptor

Phase 1 of ADR-005. Update createComponentRenderable to accept either the current Type first argument or a new inline { rune: string, schemaOrgType?: string } form. Update RuneDescriptor and Rune class to carry typeName?: string and schemaOrgType?: string instead of type?: Type.

Both signatures must work simultaneously so Phase 2 migration can happen incrementally.

Priority:highComplexity:moderateMilestone:v1.0.0Source:ADR-005
changeset-release/main View source

Criteria completion

No incremental history — criteria tracking started on Apr 19.

Branches 3
History 6
  1. f2b3512
    Content editedby Claude
    Add {ID}-{slug}.md filename convention + migrate filenames subcommand
  2. 59ded4a
    Content editedby Claude
    Implement SPEC-037 plan package hardening: all 7 work items
  3. f262d7b
    Content editedby Claude
    Backfill source attributes on all 123 work items
  4. f0a845a
    Content editedby Claude
    chore(plan): check off acceptance criteria for 14 completed v1.0.0 work
  5. c87b1c2
    Content editedby Claude
    Implement ADR-005: replace useSchema/Type system with inline rune identi
  6. 721addb
    Created (done)by Claude
    Break ADR-005 into work items (WORK-105 through WORK-109)

Acceptance Criteria

  • createComponentRenderable in packages/runes/src/lib/component.ts accepts both Type and { rune: string, schemaOrgType?: string, ...TransformResult } signatures
  • When called with the new signature, output is identical to the old signature (same typeof, data-rune, RDFa attributes)
  • RuneDescriptor in packages/runes/src/rune.ts has typeName?: string and schemaOrgType?: string fields alongside the existing type?: Type
  • Rune class exposes typeName and schemaOrgType as readonly fields, derived from either the new string fields or the legacy Type instance
  • All existing tests pass with no changes to rune schemas
  • TypeScript compiles cleanly — no type errors in any package

Approach

  1. In packages/runes/src/lib/component.ts, add a type guard to detect whether the first argument is a Type instance or an inline object with rune field
  2. Extract the name and schemaOrgType from whichever form is provided, then continue with the existing logic
  3. In packages/runes/src/rune.ts, add optional typeName and schemaOrgType string fields to RuneDescriptor
  4. In the Rune class, compute typeName from descriptor.typeName ?? descriptor.type?.name and similarly for schemaOrgType
  5. Update the Type and TypeFactory exports in packages/types/src/schema/index.ts to add deprecation JSDoc comments

Key Files

  • packages/runes/src/lib/component.tscreateComponentRenderable function (line 24)
  • packages/runes/src/rune.tsRuneDescriptor interface (line 4) and Rune class (line 37)
  • packages/types/src/schema/index.tsType, TypeFactory, useSchema definitions

References

  • ADR-005 (Phase 1)