@contractspec/lib.contracts 0.0.0-canary-20260119225944 → 0.0.0-canary-20260128200020

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/app-config/contracts.d.ts +51 -51
  2. package/dist/app-config/events.d.ts +27 -27
  3. package/dist/app-config/lifecycle-contracts.d.ts +55 -55
  4. package/dist/app-config/runtime.d.ts +1 -1
  5. package/dist/app-config/spec.d.ts +2 -2
  6. package/dist/capabilities/capabilities.d.ts +64 -5
  7. package/dist/capabilities/capabilities.js +125 -0
  8. package/dist/capabilities/context.d.ts +88 -0
  9. package/dist/capabilities/context.js +87 -0
  10. package/dist/capabilities/docs/capabilities.docblock.js +191 -2
  11. package/dist/capabilities/guards.d.ts +110 -0
  12. package/dist/capabilities/guards.js +146 -0
  13. package/dist/capabilities/index.d.ts +4 -1
  14. package/dist/capabilities/index.js +4 -1
  15. package/dist/capabilities/validation.d.ts +76 -0
  16. package/dist/capabilities/validation.js +141 -0
  17. package/dist/client/react/feature-render.d.ts +2 -2
  18. package/dist/contract-registry/schemas.d.ts +2 -2
  19. package/dist/data-views/data-views.d.ts +2 -1
  20. package/dist/data-views/index.d.ts +2 -1
  21. package/dist/data-views/registry.d.ts +1 -1
  22. package/dist/data-views/runtime.d.ts +1 -1
  23. package/dist/data-views/spec.d.ts +2 -8
  24. package/dist/data-views/types.d.ts +1 -1
  25. package/dist/docs/capabilities/documentationSystem.capability.d.ts +7 -0
  26. package/dist/docs/capabilities/documentationSystem.capability.js +71 -0
  27. package/dist/docs/capabilities/index.d.ts +2 -0
  28. package/dist/docs/capabilities/index.js +3 -0
  29. package/dist/docs/commands/docsGenerate.command.d.ts +95 -0
  30. package/dist/docs/commands/docsGenerate.command.js +139 -0
  31. package/dist/docs/commands/docsPublish.command.d.ts +64 -0
  32. package/dist/docs/commands/docsPublish.command.js +104 -0
  33. package/dist/docs/commands/index.d.ts +3 -0
  34. package/dist/docs/commands/index.js +4 -0
  35. package/dist/docs/constants.d.ts +15 -0
  36. package/dist/docs/constants.js +18 -0
  37. package/dist/docs/contracts.d.ts +442 -0
  38. package/dist/docs/contracts.js +58 -0
  39. package/dist/docs/ensure-docblocks.d.ts +1 -0
  40. package/dist/docs/ensure-docblocks.js +1 -0
  41. package/dist/docs/events/docsGenerated.event.d.ts +62 -0
  42. package/dist/docs/events/docsGenerated.event.js +53 -0
  43. package/dist/docs/events/docsPublished.event.d.ts +70 -0
  44. package/dist/docs/events/docsPublished.event.js +57 -0
  45. package/dist/docs/events/index.d.ts +3 -0
  46. package/dist/docs/events/index.js +4 -0
  47. package/dist/docs/forms/docsSearch.form.d.ts +22 -0
  48. package/dist/docs/forms/docsSearch.form.js +113 -0
  49. package/dist/docs/forms/index.d.ts +2 -0
  50. package/dist/docs/forms/index.js +3 -0
  51. package/dist/docs/index.d.ts +23 -2
  52. package/dist/docs/index.js +24 -1
  53. package/dist/docs/presentations/docsLayout.presentation.d.ts +7 -0
  54. package/dist/docs/presentations/docsLayout.presentation.js +32 -0
  55. package/dist/docs/presentations/docsReferencePage.presentation.d.ts +7 -0
  56. package/dist/docs/presentations/docsReferencePage.presentation.js +32 -0
  57. package/dist/docs/presentations/index.d.ts +3 -0
  58. package/dist/docs/presentations/index.js +4 -0
  59. package/dist/docs/queries/contractReference.query.d.ts +217 -0
  60. package/dist/docs/queries/contractReference.query.js +122 -0
  61. package/dist/docs/queries/docsIndex.query.d.ts +272 -0
  62. package/dist/docs/queries/docsIndex.query.js +130 -0
  63. package/dist/docs/queries/index.d.ts +3 -0
  64. package/dist/docs/queries/index.js +4 -0
  65. package/dist/docs/tech/cli.docblock.js +10 -0
  66. package/dist/docs/tech/docs-system.docblock.d.ts +1 -0
  67. package/dist/docs/tech/docs-system.docblock.js +128 -0
  68. package/dist/docs/views/contractReference.dataView.d.ts +7 -0
  69. package/dist/docs/views/contractReference.dataView.js +80 -0
  70. package/dist/docs/views/docsIndex.dataView.d.ts +7 -0
  71. package/dist/docs/views/docsIndex.dataView.js +136 -0
  72. package/dist/docs/views/exampleCatalog.dataView.d.ts +7 -0
  73. package/dist/docs/views/exampleCatalog.dataView.js +91 -0
  74. package/dist/docs/views/index.d.ts +4 -0
  75. package/dist/docs/views/index.js +5 -0
  76. package/dist/events.d.ts +80 -14
  77. package/dist/events.js +33 -3
  78. package/dist/examples/schema.d.ts +19 -19
  79. package/dist/examples/types.d.ts +1 -1
  80. package/dist/experiments/spec.d.ts +9 -6
  81. package/dist/features/index.d.ts +2 -2
  82. package/dist/features/install.d.ts +4 -4
  83. package/dist/features/types.d.ts +28 -32
  84. package/dist/forms/forms.d.ts +1 -1
  85. package/dist/index.d.ts +54 -28
  86. package/dist/index.js +28 -3
  87. package/dist/install.d.ts +1 -1
  88. package/dist/integrations/openbanking/contracts/accounts.d.ts +67 -67
  89. package/dist/integrations/openbanking/contracts/balances.d.ts +35 -35
  90. package/dist/integrations/openbanking/contracts/transactions.d.ts +49 -49
  91. package/dist/integrations/openbanking/models.d.ts +55 -55
  92. package/dist/integrations/operations.d.ts +103 -103
  93. package/dist/integrations/spec.d.ts +2 -2
  94. package/dist/jsonschema.d.ts +1 -1
  95. package/dist/knowledge/operations.d.ts +67 -67
  96. package/dist/knowledge/spec.d.ts +1 -1
  97. package/dist/llm/exporters.d.ts +4 -4
  98. package/dist/llm/types.d.ts +1 -1
  99. package/dist/markdown.d.ts +2 -2
  100. package/dist/onboarding-base.d.ts +29 -29
  101. package/dist/operations/operation.d.ts +8 -2
  102. package/dist/operations/registry.d.ts +2 -2
  103. package/dist/ownership.d.ts +133 -8
  104. package/dist/ownership.js +25 -0
  105. package/dist/policy/context.d.ts +237 -0
  106. package/dist/policy/context.js +227 -0
  107. package/dist/policy/guards.d.ts +145 -0
  108. package/dist/policy/guards.js +254 -0
  109. package/dist/policy/index.d.ts +12 -1
  110. package/dist/policy/index.js +11 -1
  111. package/dist/policy/spec.d.ts +7 -4
  112. package/dist/policy/validation.d.ts +67 -0
  113. package/dist/policy/validation.js +307 -0
  114. package/dist/presentations/presentations.d.ts +6 -0
  115. package/dist/presentations/registry.d.ts +1 -1
  116. package/dist/registry.d.ts +1 -1
  117. package/dist/serialization/index.d.ts +3 -0
  118. package/dist/serialization/index.js +3 -0
  119. package/dist/serialization/serializers.d.ts +40 -0
  120. package/dist/serialization/serializers.js +148 -0
  121. package/dist/serialization/types.d.ts +103 -0
  122. package/dist/serialization/types.js +0 -0
  123. package/dist/server/rest-elysia.d.ts +1 -1
  124. package/dist/server/rest-express.d.ts +1 -1
  125. package/dist/server/rest-generic.d.ts +1 -1
  126. package/dist/server/rest-next-app.d.ts +1 -1
  127. package/dist/server/rest-next-mcp.d.ts +1 -1
  128. package/dist/server/rest-next-pages.d.ts +1 -1
  129. package/dist/telemetry/spec.d.ts +1 -1
  130. package/dist/tests/runner.d.ts +1 -1
  131. package/dist/tests/spec.d.ts +17 -12
  132. package/dist/themes.d.ts +8 -5
  133. package/dist/translations/index.d.ts +6 -0
  134. package/dist/translations/index.js +5 -0
  135. package/dist/translations/registry.d.ts +144 -0
  136. package/dist/translations/registry.js +223 -0
  137. package/dist/translations/spec.d.ts +126 -0
  138. package/dist/translations/spec.js +31 -0
  139. package/dist/translations/validation.d.ts +85 -0
  140. package/dist/translations/validation.js +328 -0
  141. package/dist/types.d.ts +140 -14
  142. package/dist/versioning/index.d.ts +2 -1
  143. package/dist/versioning/index.js +2 -1
  144. package/dist/versioning/refs.d.ts +179 -0
  145. package/dist/versioning/refs.js +161 -0
  146. package/dist/workflow/context.d.ts +191 -0
  147. package/dist/workflow/context.js +227 -0
  148. package/dist/workflow/index.d.ts +6 -3
  149. package/dist/workflow/index.js +4 -2
  150. package/dist/workflow/spec.d.ts +4 -11
  151. package/dist/workflow/validation.d.ts +64 -2
  152. package/dist/workflow/validation.js +194 -1
  153. package/dist/workspace-config/contractsrc-schema.js +1 -0
  154. package/dist/workspace-config/contractsrc-types.d.ts +3 -3
  155. package/package.json +47 -8
package/dist/events.d.ts CHANGED
@@ -1,45 +1,111 @@
1
+ import { CapabilityRef } from "./capabilities/capabilities.js";
2
+ import { SpecContractRegistry } from "./registry.js";
1
3
  import { DocId } from "./docs/registry.js";
2
4
  import { OwnerShipMeta } from "./ownership.js";
3
- import { SpecContractRegistry } from "./registry.js";
4
5
  import { AnySchemaModel } from "@contractspec/lib.schema";
5
6
 
6
7
  //#region src/events.d.ts
8
+
9
+ /**
10
+ * Metadata for an event specification.
11
+ * Extends OwnerShipMeta with event-specific documentation.
12
+ */
7
13
  interface EventSpecMeta extends Omit<OwnerShipMeta, 'docId'> {
8
- /** Doc block(s) for this operation. */
14
+ /** Associated DocBlock identifiers for this event. */
9
15
  docId?: DocId[];
10
16
  }
11
17
  /**
12
- * Typed event specification. Declare once, validate payloads at publish time,
13
- * and guard emissions via the contracts runtime.
18
+ * Typed event specification.
19
+ *
20
+ * Declare once, validate payloads at publish time, and guard emissions
21
+ * via the contracts runtime. Events are the backbone of event-driven
22
+ * architectures in ContractSpec.
23
+ *
24
+ * @typeParam T - The SchemaModel type defining the event payload structure
14
25
  */
15
26
  interface EventSpec<T extends AnySchemaModel> {
27
+ /** Event metadata including key, version, and ownership. */
16
28
  meta: EventSpecMeta;
17
- /** JSON-like paths to redact from logs/exports. */
29
+ /**
30
+ * Optional reference to the capability that provides this event.
31
+ * Used for bidirectional linking between capabilities and events.
32
+ */
33
+ capability?: CapabilityRef;
34
+ /**
35
+ * JSON paths to PII fields that should be redacted in logs/exports.
36
+ * @example ['email', 'user.phone', 'billing.address']
37
+ */
18
38
  pii?: string[];
19
39
  /** Event payload schema from @contractspec/lib.schema. */
20
40
  payload: T;
21
41
  }
42
+ /**
43
+ * Type alias for any EventSpec regardless of payload type.
44
+ * Useful for collections and registries.
45
+ */
22
46
  type AnyEventSpec<T extends AnySchemaModel = AnySchemaModel> = EventSpec<T>;
23
- /** Identity function to keep type inference when declaring events. */
47
+ /**
48
+ * Identity function to define an event spec with full type inference.
49
+ *
50
+ * @param e - The event specification
51
+ * @returns The same event specification with preserved types
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * const MyEvent = defineEvent({
56
+ * meta: { key: 'my.event', version: '1.0.0', ... },
57
+ * payload: myPayloadSchema,
58
+ * });
59
+ * ```
60
+ */
24
61
  declare function defineEvent<T extends AnySchemaModel>(e: EventSpec<T>): EventSpec<T>;
62
+ /**
63
+ * Wrapper for a published event with metadata.
64
+ *
65
+ * Used when events are serialized for transport or storage.
66
+ * Contains the validated payload plus envelope metadata.
67
+ *
68
+ * @typeParam T - The payload type
69
+ */
25
70
  interface EventEnvelope<T> {
26
- /** Unique identifier for the published event (UUID recommended). */
71
+ /** Unique identifier for this event instance (UUID recommended). */
27
72
  id: string;
28
- /** ISO timestamp when the event occurred. */
73
+ /** ISO 8601 timestamp when the event occurred. */
29
74
  occurredAt: string;
30
- /** Optional trace identifier for correlating across services. */
75
+ /** Trace identifier for correlating across services. */
31
76
  traceId?: string;
32
- /** Event name as published (should match spec.name). */
77
+ /** Event key (should match spec.meta.key). */
33
78
  key: string;
34
- /** Event version as published (should match spec.version). */
79
+ /** Event version (should match spec.meta.version). */
35
80
  version: string;
36
- /** Validated payload. */
81
+ /** Validated event payload. */
37
82
  payload: T;
38
83
  }
84
+ /**
85
+ * Template literal type for event keys.
86
+ * Format: "key.vversion" (e.g., "user.created.v1.0.0")
87
+ */
39
88
  type EventKey = `${string}.v${string}`;
40
- /** Build a stable string key for an event name/version pair. */
89
+ /**
90
+ * Builds a stable string key for an event name/version pair.
91
+ *
92
+ * @param key - The event key (e.g., "user.created")
93
+ * @param version - The event version (e.g., "1.0.0")
94
+ * @returns A string in format "key.vversion"
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const key = eventKey('user.created', '1.0.0');
99
+ * // "user.created.v1.0.0"
100
+ * ```
101
+ */
41
102
  declare const eventKey: (key: string, version: string) => EventKey;
42
- /** In-memory registry for EventSpec. */
103
+ /**
104
+ * In-memory registry for EventSpec instances.
105
+ *
106
+ * Provides registration, lookup, and listing of event specifications.
107
+ * Used by the contracts runtime to validate event emissions.
108
+ */
43
109
  declare class EventRegistry extends SpecContractRegistry<'event', AnyEventSpec> {
44
110
  constructor(items?: AnyEventSpec[]);
45
111
  }
package/dist/events.js CHANGED
@@ -2,13 +2,43 @@ import { SpecContractRegistry } from "./registry.js";
2
2
  import "@contractspec/lib.schema";
3
3
 
4
4
  //#region src/events.ts
5
- /** Identity function to keep type inference when declaring events. */
5
+ /**
6
+ * Identity function to define an event spec with full type inference.
7
+ *
8
+ * @param e - The event specification
9
+ * @returns The same event specification with preserved types
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const MyEvent = defineEvent({
14
+ * meta: { key: 'my.event', version: '1.0.0', ... },
15
+ * payload: myPayloadSchema,
16
+ * });
17
+ * ```
18
+ */
6
19
  function defineEvent(e) {
7
20
  return e;
8
21
  }
9
- /** Build a stable string key for an event name/version pair. */
22
+ /**
23
+ * Builds a stable string key for an event name/version pair.
24
+ *
25
+ * @param key - The event key (e.g., "user.created")
26
+ * @param version - The event version (e.g., "1.0.0")
27
+ * @returns A string in format "key.vversion"
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const key = eventKey('user.created', '1.0.0');
32
+ * // "user.created.v1.0.0"
33
+ * ```
34
+ */
10
35
  const eventKey = (key, version) => `${key}.v${version}`;
11
- /** In-memory registry for EventSpec. */
36
+ /**
37
+ * In-memory registry for EventSpec instances.
38
+ *
39
+ * Provides registration, lookup, and listing of event specifications.
40
+ * Used by the contracts runtime to validate event emissions.
41
+ */
12
42
  var EventRegistry = class extends SpecContractRegistry {
13
43
  constructor(items) {
14
44
  super("event", items);
@@ -3,14 +3,14 @@ import { z as z$1 } from "zod";
3
3
 
4
4
  //#region src/examples/schema.d.ts
5
5
  declare const ExampleKindSchema: z$1.ZodEnum<{
6
- library: "library";
7
- workflow: "workflow";
8
- knowledge: "knowledge";
9
6
  template: "template";
7
+ workflow: "workflow";
10
8
  integration: "integration";
9
+ knowledge: "knowledge";
11
10
  blueprint: "blueprint";
12
11
  ui: "ui";
13
12
  script: "script";
13
+ library: "library";
14
14
  }>;
15
15
  declare const ExampleVisibilitySchema: z$1.ZodEnum<{
16
16
  experimental: "experimental";
@@ -18,19 +18,19 @@ declare const ExampleVisibilitySchema: z$1.ZodEnum<{
18
18
  internal: "internal";
19
19
  }>;
20
20
  declare const ExampleSandboxModeSchema: z$1.ZodEnum<{
21
+ markdown: "markdown";
21
22
  playground: "playground";
22
23
  specs: "specs";
23
24
  builder: "builder";
24
- markdown: "markdown";
25
25
  evolution: "evolution";
26
26
  }>;
27
27
  declare const StabilitySchema: z$1.ZodEnum<{
28
- deprecated: "deprecated";
29
28
  idea: "idea";
30
29
  in_creation: "in_creation";
31
30
  experimental: "experimental";
32
31
  beta: "beta";
33
32
  stable: "stable";
33
+ deprecated: "deprecated";
34
34
  }>;
35
35
  declare const ExampleDocumentationSchema: z$1.ZodObject<{
36
36
  rootDocId: z$1.ZodOptional<z$1.ZodString>;
@@ -42,10 +42,10 @@ declare const ExampleDocumentationSchema: z$1.ZodObject<{
42
42
  declare const ExampleSandboxSupportSchema: z$1.ZodObject<{
43
43
  enabled: z$1.ZodBoolean;
44
44
  modes: z$1.ZodArray<z$1.ZodEnum<{
45
+ markdown: "markdown";
45
46
  playground: "playground";
46
47
  specs: "specs";
47
48
  builder: "builder";
48
- markdown: "markdown";
49
49
  evolution: "evolution";
50
50
  }>>;
51
51
  }, z$1.core.$strip>;
@@ -61,10 +61,10 @@ declare const ExampleSurfacesSchema: z$1.ZodObject<{
61
61
  sandbox: z$1.ZodObject<{
62
62
  enabled: z$1.ZodBoolean;
63
63
  modes: z$1.ZodArray<z$1.ZodEnum<{
64
+ markdown: "markdown";
64
65
  playground: "playground";
65
66
  specs: "specs";
66
67
  builder: "builder";
67
- markdown: "markdown";
68
68
  evolution: "evolution";
69
69
  }>>;
70
70
  }, z$1.core.$strip>;
@@ -93,25 +93,25 @@ declare const ExampleMetaSchema: z$1.ZodObject<{
93
93
  description: z$1.ZodString;
94
94
  domain: z$1.ZodOptional<z$1.ZodString>;
95
95
  stability: z$1.ZodEnum<{
96
- deprecated: "deprecated";
97
96
  idea: "idea";
98
97
  in_creation: "in_creation";
99
98
  experimental: "experimental";
100
99
  beta: "beta";
101
100
  stable: "stable";
101
+ deprecated: "deprecated";
102
102
  }>;
103
103
  owners: z$1.ZodArray<z$1.ZodString>;
104
104
  tags: z$1.ZodArray<z$1.ZodString>;
105
105
  docId: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
106
106
  kind: z$1.ZodEnum<{
107
- library: "library";
108
- workflow: "workflow";
109
- knowledge: "knowledge";
110
107
  template: "template";
108
+ workflow: "workflow";
111
109
  integration: "integration";
110
+ knowledge: "knowledge";
112
111
  blueprint: "blueprint";
113
112
  ui: "ui";
114
113
  script: "script";
114
+ library: "library";
115
115
  }>;
116
116
  visibility: z$1.ZodEnum<{
117
117
  experimental: "experimental";
@@ -141,25 +141,25 @@ declare const ExampleSpecSchema: z$1.ZodObject<{
141
141
  description: z$1.ZodString;
142
142
  domain: z$1.ZodOptional<z$1.ZodString>;
143
143
  stability: z$1.ZodEnum<{
144
- deprecated: "deprecated";
145
144
  idea: "idea";
146
145
  in_creation: "in_creation";
147
146
  experimental: "experimental";
148
147
  beta: "beta";
149
148
  stable: "stable";
149
+ deprecated: "deprecated";
150
150
  }>;
151
151
  owners: z$1.ZodArray<z$1.ZodString>;
152
152
  tags: z$1.ZodArray<z$1.ZodString>;
153
153
  docId: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
154
154
  kind: z$1.ZodEnum<{
155
- library: "library";
156
- workflow: "workflow";
157
- knowledge: "knowledge";
158
155
  template: "template";
156
+ workflow: "workflow";
159
157
  integration: "integration";
158
+ knowledge: "knowledge";
160
159
  blueprint: "blueprint";
161
160
  ui: "ui";
162
161
  script: "script";
162
+ library: "library";
163
163
  }>;
164
164
  visibility: z$1.ZodEnum<{
165
165
  experimental: "experimental";
@@ -180,10 +180,10 @@ declare const ExampleSpecSchema: z$1.ZodObject<{
180
180
  sandbox: z$1.ZodObject<{
181
181
  enabled: z$1.ZodBoolean;
182
182
  modes: z$1.ZodArray<z$1.ZodEnum<{
183
+ markdown: "markdown";
183
184
  playground: "playground";
184
185
  specs: "specs";
185
186
  builder: "builder";
186
- markdown: "markdown";
187
187
  evolution: "evolution";
188
188
  }>>;
189
189
  }, z$1.core.$strip>;
@@ -221,10 +221,10 @@ declare function safeParseExampleSpec(data: unknown): z$1.ZodSafeParseResult<{
221
221
  version: string;
222
222
  key: string;
223
223
  description: string;
224
- stability: "deprecated" | "idea" | "in_creation" | "experimental" | "beta" | "stable";
224
+ stability: "idea" | "in_creation" | "experimental" | "beta" | "stable" | "deprecated";
225
225
  owners: string[];
226
226
  tags: string[];
227
- kind: "library" | "workflow" | "knowledge" | "template" | "integration" | "blueprint" | "ui" | "script";
227
+ kind: "template" | "workflow" | "integration" | "knowledge" | "blueprint" | "ui" | "script" | "library";
228
228
  visibility: "experimental" | "public" | "internal";
229
229
  title?: string | undefined;
230
230
  domain?: string | undefined;
@@ -235,7 +235,7 @@ declare function safeParseExampleSpec(data: unknown): z$1.ZodSafeParseResult<{
235
235
  templates: boolean;
236
236
  sandbox: {
237
237
  enabled: boolean;
238
- modes: ("playground" | "specs" | "builder" | "markdown" | "evolution")[];
238
+ modes: ("markdown" | "playground" | "specs" | "builder" | "evolution")[];
239
239
  };
240
240
  studio: {
241
241
  enabled: boolean;
@@ -1,7 +1,7 @@
1
- import { OwnerShipMeta } from "../ownership.js";
2
1
  import { FeatureModuleSpec, FeatureRef } from "../features/types.js";
3
2
  import "../features/index.js";
4
3
  import { AppBlueprintSpec, SpecPointer } from "../app-config/spec.js";
4
+ import { OwnerShipMeta } from "../ownership.js";
5
5
 
6
6
  //#region src/examples/types.d.ts
7
7
  /** Kind of example - determines how it's presented in catalogs */
@@ -1,14 +1,17 @@
1
- import { OwnerShipMeta } from "../ownership.js";
1
+ import { OptionalVersionedSpecRef } from "../versioning/refs.js";
2
2
  import { PolicyRef } from "../policy/spec.js";
3
- import { TelemetryEventDef } from "../telemetry/spec.js";
4
3
  import { SpecContractRegistry } from "../registry.js";
4
+ import { TelemetryEventDef } from "../telemetry/spec.js";
5
+ import { OwnerShipMeta } from "../ownership.js";
5
6
 
6
7
  //#region src/experiments/spec.d.ts
8
+ /** Metadata for an experiment spec. */
7
9
  type ExperimentMeta = OwnerShipMeta;
8
- interface ExperimentRef {
9
- key: string;
10
- version?: string;
11
- }
10
+ /**
11
+ * Reference to an experiment spec.
12
+ * Version is optional; when omitted, refers to the latest version.
13
+ */
14
+ type ExperimentRef = OptionalVersionedSpecRef;
12
15
  type ExperimentOverrideType = 'dataView' | 'workflow' | 'theme' | 'policy' | 'presentation';
13
16
  interface ExperimentOverride {
14
17
  type: ExperimentOverrideType;
@@ -1,4 +1,4 @@
1
- import { EventRef, FeatureModuleMeta, FeatureModuleSpec, FeatureRef, OpRef, PresentationRef } from "./types.js";
1
+ import { DataViewRef, EventRef, FeatureModuleMeta, FeatureModuleSpec, FeatureRef, FormRef, OpRef, PresentationRef } from "./types.js";
2
2
  import { FeatureRegistry } from "./registry.js";
3
3
  import { InstallFeatureDeps, installFeature } from "./install.js";
4
4
  import { validateFeatureTargetsV2 } from "./validation.js";
@@ -10,4 +10,4 @@ import { validateFeatureTargetsV2 } from "./validation.js";
10
10
  */
11
11
  declare const defineFeature: (spec: FeatureModuleSpec) => FeatureModuleSpec;
12
12
  //#endregion
13
- export { type EventRef, type FeatureModuleMeta, type FeatureModuleSpec, type FeatureRef, FeatureRegistry, type InstallFeatureDeps, type OpRef, type PresentationRef, defineFeature, installFeature, validateFeatureTargetsV2 };
13
+ export { type DataViewRef, type EventRef, type FeatureModuleMeta, type FeatureModuleSpec, type FeatureRef, FeatureRegistry, type FormRef, type InstallFeatureDeps, type OpRef, type PresentationRef, defineFeature, installFeature, validateFeatureTargetsV2 };
@@ -1,11 +1,11 @@
1
- import { PresentationSpec } from "../presentations/presentations.js";
2
1
  import { CapabilityRegistry } from "../capabilities/capabilities.js";
2
+ import { PresentationSpec } from "../presentations/presentations.js";
3
+ import { PresentationRegistry } from "../presentations/registry.js";
4
+ import "../presentations/index.js";
3
5
  import "../capabilities/index.js";
4
- import { OperationSpecRegistry } from "../operations/registry.js";
5
6
  import { FeatureModuleSpec } from "./types.js";
6
7
  import { FeatureRegistry } from "./registry.js";
7
- import { PresentationRegistry } from "../presentations/registry.js";
8
- import "../presentations/index.js";
8
+ import { OperationSpecRegistry } from "../operations/registry.js";
9
9
 
10
10
  //#region src/features/install.d.ts
11
11
  /** Dependencies for installing a feature. */
@@ -1,46 +1,40 @@
1
- import { PresentationTarget } from "../presentations/presentations.js";
2
- import { OwnerShipMeta } from "../ownership.js";
1
+ import { SpecKeyRef, VersionedSpecRef } from "../versioning/refs.js";
3
2
  import { CapabilityRef, CapabilityRequirement } from "../capabilities/capabilities.js";
3
+ import { ImplementationRef } from "../operations/operation.js";
4
+ import { PresentationTarget } from "../presentations/presentations.js";
4
5
  import "../capabilities/index.js";
5
6
  import { ExperimentRef } from "../experiments/spec.js";
6
- import { ImplementationRef } from "../operations/operation.js";
7
7
  import "../operations/index.js";
8
+ import { OwnerShipMeta } from "../ownership.js";
8
9
 
9
10
  //#region src/features/types.d.ts
10
11
  /** Minimal metadata to identify and categorize a feature module. */
11
12
  type FeatureModuleMeta = OwnerShipMeta;
12
- interface OpRef {
13
- /** Operation key (OperationSpec.meta.key). */
14
- key: string;
15
- /** Operation version (OperationSpec.meta.version). */
16
- version: string;
17
- }
18
- interface EventRef {
19
- /** Event key. */
20
- key: string;
21
- /** Event version. */
22
- version: string;
23
- }
24
- interface PresentationRef {
25
- /** Presentation key. */
26
- key: string;
27
- /** Presentation version. */
28
- version: string;
29
- }
13
+ /**
14
+ * Reference to an operation spec.
15
+ * Uses key (OperationSpec.meta.key) and version (OperationSpec.meta.version).
16
+ */
17
+ type OpRef = VersionedSpecRef;
18
+ /**
19
+ * Reference to an event spec.
20
+ * Uses key (EventSpec.meta.key) and version (EventSpec.meta.version).
21
+ */
22
+ type EventRef = VersionedSpecRef;
23
+ /**
24
+ * Reference to a presentation spec.
25
+ * Uses key (PresentationSpec.meta.key) and version (PresentationSpec.meta.version).
26
+ */
27
+ type PresentationRef = VersionedSpecRef;
30
28
  /**
31
29
  * Reference to a data view spec.
30
+ * Uses key (DataViewSpec.meta.key) and version (DataViewSpec.meta.version).
32
31
  */
33
- interface DataViewRef {
34
- key: string;
35
- version: string;
36
- }
32
+ type DataViewRef = VersionedSpecRef;
37
33
  /**
38
34
  * Reference to a form spec.
35
+ * Uses key (FormSpec.meta.key) and version (FormSpec.meta.version).
39
36
  */
40
- interface FormRef {
41
- key: string;
42
- version: string;
43
- }
37
+ type FormRef = VersionedSpecRef;
44
38
  /** Group operations/events/presentations into an installable feature. */
45
39
  interface FeatureModuleSpec {
46
40
  meta: FeatureModuleMeta;
@@ -81,8 +75,10 @@ interface FeatureModuleSpec {
81
75
  /** Forms associated with this feature. */
82
76
  forms?: FormRef[];
83
77
  }
84
- interface FeatureRef {
85
- key: string;
86
- }
78
+ /**
79
+ * Reference to a feature (unversioned).
80
+ * Features are identified by key only, without version pinning.
81
+ */
82
+ type FeatureRef = SpecKeyRef;
87
83
  //#endregion
88
84
  export { DataViewRef, EventRef, FeatureModuleMeta, FeatureModuleSpec, FeatureRef, FormRef, OpRef, PresentationRef };
@@ -1,5 +1,5 @@
1
- import { OwnerShipMeta } from "../ownership.js";
2
1
  import { GroupKeyFn, RegistryFilter } from "../registry-utils.js";
2
+ import { OwnerShipMeta } from "../ownership.js";
3
3
  import { AnySchemaModel, ZodSchemaModel } from "@contractspec/lib.schema";
4
4
 
5
5
  //#region src/forms/forms.d.ts