@contractspec/lib.contracts 1.49.0 → 1.51.0

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 (73) 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 +1 -1
  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/data-views/runtime.d.ts +1 -1
  19. package/dist/events.d.ts +79 -13
  20. package/dist/events.js +33 -3
  21. package/dist/examples/schema.d.ts +10 -10
  22. package/dist/experiments/spec.d.ts +7 -4
  23. package/dist/features/install.d.ts +4 -4
  24. package/dist/features/types.d.ts +28 -32
  25. package/dist/index.d.ts +21 -12
  26. package/dist/index.js +12 -3
  27. package/dist/install.d.ts +1 -1
  28. package/dist/integrations/openbanking/contracts/accounts.d.ts +67 -67
  29. package/dist/integrations/openbanking/contracts/balances.d.ts +35 -35
  30. package/dist/integrations/openbanking/contracts/transactions.d.ts +49 -49
  31. package/dist/integrations/openbanking/models.d.ts +55 -55
  32. package/dist/integrations/operations.d.ts +103 -103
  33. package/dist/integrations/spec.d.ts +1 -1
  34. package/dist/knowledge/operations.d.ts +67 -67
  35. package/dist/llm/exporters.d.ts +2 -2
  36. package/dist/markdown.d.ts +1 -1
  37. package/dist/onboarding-base.d.ts +29 -29
  38. package/dist/operations/operation.d.ts +6 -0
  39. package/dist/ownership.d.ts +133 -8
  40. package/dist/ownership.js +25 -0
  41. package/dist/policy/context.d.ts +237 -0
  42. package/dist/policy/context.js +227 -0
  43. package/dist/policy/guards.d.ts +145 -0
  44. package/dist/policy/guards.js +254 -0
  45. package/dist/policy/index.d.ts +12 -1
  46. package/dist/policy/index.js +11 -1
  47. package/dist/policy/spec.d.ts +7 -4
  48. package/dist/policy/validation.d.ts +67 -0
  49. package/dist/policy/validation.js +307 -0
  50. package/dist/presentations/presentations.d.ts +6 -0
  51. package/dist/tests/spec.d.ts +17 -12
  52. package/dist/themes.d.ts +7 -4
  53. package/dist/translations/index.d.ts +6 -0
  54. package/dist/translations/index.js +5 -0
  55. package/dist/translations/registry.d.ts +144 -0
  56. package/dist/translations/registry.js +223 -0
  57. package/dist/translations/spec.d.ts +126 -0
  58. package/dist/translations/spec.js +31 -0
  59. package/dist/translations/validation.d.ts +85 -0
  60. package/dist/translations/validation.js +328 -0
  61. package/dist/types.d.ts +140 -14
  62. package/dist/versioning/index.d.ts +2 -1
  63. package/dist/versioning/index.js +2 -1
  64. package/dist/versioning/refs.d.ts +179 -0
  65. package/dist/versioning/refs.js +161 -0
  66. package/dist/workflow/context.d.ts +191 -0
  67. package/dist/workflow/context.js +227 -0
  68. package/dist/workflow/index.d.ts +4 -2
  69. package/dist/workflow/index.js +4 -2
  70. package/dist/workflow/spec.d.ts +1 -1
  71. package/dist/workflow/validation.d.ts +64 -2
  72. package/dist/workflow/validation.js +194 -1
  73. package/package.json +19 -6
@@ -0,0 +1,141 @@
1
+ //#region src/capabilities/validation.ts
2
+ /**
3
+ * Validates bidirectional consistency between capabilities and their surfaces.
4
+ *
5
+ * Checks:
6
+ * 1. Forward validation: Every surface ref in capability `provides` exists
7
+ * 2. Reverse validation: Every spec with `capability` field is in that capability's `provides`
8
+ *
9
+ * @param deps - Registries to validate against
10
+ * @returns Validation result with errors and warnings
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const result = validateCapabilityConsistency({
15
+ * capabilities: capabilityRegistry,
16
+ * operations: operationRegistry,
17
+ * events: eventRegistry,
18
+ * });
19
+ *
20
+ * if (!result.valid) {
21
+ * console.error('Capability validation failed:', result.errors);
22
+ * }
23
+ * ```
24
+ */
25
+ function validateCapabilityConsistency(deps) {
26
+ const errors = [];
27
+ const warnings = [];
28
+ for (const capability of deps.capabilities.list()) {
29
+ const capKey = `${capability.meta.key}.v${capability.meta.version}`;
30
+ for (const surface of capability.provides ?? []) if (!checkSurfaceExists(deps, surface.surface, surface.key)) errors.push({
31
+ type: "missing_surface_spec",
32
+ message: `Capability "${capKey}" provides ${surface.surface} "${surface.key}" but spec not found`,
33
+ capabilityKey: capKey,
34
+ surface: surface.surface,
35
+ specKey: surface.key
36
+ });
37
+ }
38
+ if (deps.operations) {
39
+ for (const op of deps.operations.list()) if (op.capability) {
40
+ const capSpec = deps.capabilities.get(op.capability.key, op.capability.version);
41
+ if (!capSpec) errors.push({
42
+ type: "capability_not_found",
43
+ message: `Operation "${op.meta.key}" references capability "${op.capability.key}.v${op.capability.version}" but capability not found`,
44
+ specKey: op.meta.key,
45
+ capabilityKey: `${op.capability.key}.v${op.capability.version}`,
46
+ surface: "operation"
47
+ });
48
+ else if (!capSpec.provides?.some((p) => p.surface === "operation" && p.key === op.meta.key)) errors.push({
49
+ type: "surface_not_in_provides",
50
+ message: `Operation "${op.meta.key}" claims capability "${op.capability.key}.v${op.capability.version}" but not in capability's provides`,
51
+ specKey: op.meta.key,
52
+ capabilityKey: `${op.capability.key}.v${op.capability.version}`,
53
+ surface: "operation"
54
+ });
55
+ }
56
+ }
57
+ if (deps.events) {
58
+ for (const event of deps.events.list()) if (event.capability) {
59
+ const capSpec = deps.capabilities.get(event.capability.key, event.capability.version);
60
+ if (!capSpec) errors.push({
61
+ type: "capability_not_found",
62
+ message: `Event "${event.meta.key}" references capability "${event.capability.key}.v${event.capability.version}" but capability not found`,
63
+ specKey: event.meta.key,
64
+ capabilityKey: `${event.capability.key}.v${event.capability.version}`,
65
+ surface: "event"
66
+ });
67
+ else if (!capSpec.provides?.some((p) => p.surface === "event" && p.key === event.meta.key)) errors.push({
68
+ type: "surface_not_in_provides",
69
+ message: `Event "${event.meta.key}" claims capability "${event.capability.key}.v${event.capability.version}" but not in capability's provides`,
70
+ specKey: event.meta.key,
71
+ capabilityKey: `${event.capability.key}.v${event.capability.version}`,
72
+ surface: "event"
73
+ });
74
+ }
75
+ }
76
+ if (deps.presentations) {
77
+ for (const pres of deps.presentations.list()) if (pres.capability) {
78
+ const capSpec = deps.capabilities.get(pres.capability.key, pres.capability.version);
79
+ if (!capSpec) errors.push({
80
+ type: "capability_not_found",
81
+ message: `Presentation "${pres.meta.key}" references capability "${pres.capability.key}.v${pres.capability.version}" but capability not found`,
82
+ specKey: pres.meta.key,
83
+ capabilityKey: `${pres.capability.key}.v${pres.capability.version}`,
84
+ surface: "presentation"
85
+ });
86
+ else if (!capSpec.provides?.some((p) => p.surface === "presentation" && p.key === pres.meta.key)) errors.push({
87
+ type: "surface_not_in_provides",
88
+ message: `Presentation "${pres.meta.key}" claims capability "${pres.capability.key}.v${pres.capability.version}" but not in capability's provides`,
89
+ specKey: pres.meta.key,
90
+ capabilityKey: `${pres.capability.key}.v${pres.capability.version}`,
91
+ surface: "presentation"
92
+ });
93
+ }
94
+ }
95
+ return {
96
+ valid: errors.length === 0,
97
+ errors,
98
+ warnings
99
+ };
100
+ }
101
+ /**
102
+ * Check if a spec exists for a given surface type and key.
103
+ */
104
+ function checkSurfaceExists(deps, surface, key) {
105
+ switch (surface) {
106
+ case "operation": return deps.operations?.has(key) ?? true;
107
+ case "event": return deps.events?.has(key) ?? true;
108
+ case "presentation": return deps.presentations?.has(key) ?? true;
109
+ case "workflow":
110
+ case "resource": return true;
111
+ default: return true;
112
+ }
113
+ }
114
+ /**
115
+ * Finds specs that have no capability assignment (orphan specs).
116
+ * This is informational - orphan specs are allowed but may indicate
117
+ * incomplete capability modeling.
118
+ *
119
+ * @param deps - Registries to check
120
+ * @returns List of spec keys without capability assignment
121
+ */
122
+ function findOrphanSpecs(deps) {
123
+ const result = {
124
+ operations: [],
125
+ events: [],
126
+ presentations: []
127
+ };
128
+ if (deps.operations) {
129
+ for (const op of deps.operations.list()) if (!op.capability) result.operations.push(op.meta.key);
130
+ }
131
+ if (deps.events) {
132
+ for (const event of deps.events.list()) if (!event.capability) result.events.push(event.meta.key);
133
+ }
134
+ if (deps.presentations) {
135
+ for (const pres of deps.presentations.list()) if (!pres.capability) result.presentations.push(pres.meta.key);
136
+ }
137
+ return result;
138
+ }
139
+
140
+ //#endregion
141
+ export { findOrphanSpecs, validateCapabilityConsistency };
@@ -1,8 +1,8 @@
1
1
  import { PresentationSpec, PresentationTarget } from "../../presentations/presentations.js";
2
- import { FeatureModuleSpec } from "../../features/types.js";
3
- import { FeatureRegistry } from "../../features/registry.js";
4
2
  import { ComponentMap, TransformEngine } from "../../presentations/transform-engine.js";
5
3
  import "../../presentations/index.js";
4
+ import { FeatureModuleSpec } from "../../features/types.js";
5
+ import { FeatureRegistry } from "../../features/registry.js";
6
6
  import "../../features/index.js";
7
7
  import React from "react";
8
8
  import { BlockConfig } from "@blocknote/core";
@@ -1,5 +1,5 @@
1
- import { OperationSpecRegistry } from "../operations/registry.js";
2
1
  import "../operations/index.js";
2
+ import { OperationSpecRegistry } from "../operations/registry.js";
3
3
  import { DataViewSpec } from "./spec.js";
4
4
  import { DataViewRegistry } from "./registry.js";
5
5
  import "./index.js";
package/dist/events.d.ts CHANGED
@@ -1,45 +1,111 @@
1
+ import { CapabilityRef } from "./capabilities/capabilities.js";
1
2
  import { DocId } from "./docs/registry.js";
2
3
  import { OwnerShipMeta } from "./ownership.js";
3
4
  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
- integration: "integration";
9
6
  knowledge: "knowledge";
10
7
  template: "template";
8
+ workflow: "workflow";
9
+ integration: "integration";
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";
@@ -104,14 +104,14 @@ declare const ExampleMetaSchema: z$1.ZodObject<{
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
- integration: "integration";
110
107
  knowledge: "knowledge";
111
108
  template: "template";
109
+ workflow: "workflow";
110
+ integration: "integration";
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";
@@ -152,14 +152,14 @@ declare const ExampleSpecSchema: z$1.ZodObject<{
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
- integration: "integration";
158
155
  knowledge: "knowledge";
159
156
  template: "template";
157
+ workflow: "workflow";
158
+ integration: "integration";
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";
@@ -224,7 +224,7 @@ declare function safeParseExampleSpec(data: unknown): z$1.ZodSafeParseResult<{
224
224
  stability: "idea" | "in_creation" | "experimental" | "beta" | "stable" | "deprecated";
225
225
  owners: string[];
226
226
  tags: string[];
227
- kind: "library" | "workflow" | "integration" | "knowledge" | "template" | "blueprint" | "ui" | "script";
227
+ kind: "knowledge" | "template" | "workflow" | "integration" | "blueprint" | "ui" | "script" | "library";
228
228
  visibility: "experimental" | "public" | "internal";
229
229
  title?: string | undefined;
230
230
  domain?: string | undefined;
@@ -1,14 +1,17 @@
1
+ import { OptionalVersionedSpecRef } from "../versioning/refs.js";
1
2
  import { OwnerShipMeta } from "../ownership.js";
2
3
  import { PolicyRef } from "../policy/spec.js";
3
4
  import { TelemetryEventDef } from "../telemetry/spec.js";
4
5
  import { SpecContractRegistry } from "../registry.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,11 +1,11 @@
1
- import { PresentationSpec } from "../presentations/presentations.js";
2
1
  import { CapabilityRegistry } from "../capabilities/capabilities.js";
3
- import "../capabilities/index.js";
2
+ import { PresentationSpec } from "../presentations/presentations.js";
4
3
  import { OperationSpecRegistry } from "../operations/registry.js";
5
- import { FeatureModuleSpec } from "./types.js";
6
- import { FeatureRegistry } from "./registry.js";
7
4
  import { PresentationRegistry } from "../presentations/registry.js";
8
5
  import "../presentations/index.js";
6
+ import "../capabilities/index.js";
7
+ import { FeatureModuleSpec } from "./types.js";
8
+ import { FeatureRegistry } from "./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 { SpecKeyRef, VersionedSpecRef } from "../versioning/refs.js";
2
+ import { CapabilityRef, CapabilityRequirement } from "../capabilities/capabilities.js";
1
3
  import { PresentationTarget } from "../presentations/presentations.js";
2
4
  import { OwnerShipMeta } from "../ownership.js";
3
- import { CapabilityRef, CapabilityRequirement } from "../capabilities/capabilities.js";
4
- import "../capabilities/index.js";
5
- import { ExperimentRef } from "../experiments/spec.js";
6
5
  import { ImplementationRef } from "../operations/operation.js";
7
6
  import "../operations/index.js";
7
+ import "../capabilities/index.js";
8
+ import { ExperimentRef } from "../experiments/spec.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 };