@contractspec/lib.contracts 1.48.0 → 1.49.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.
- package/dist/app-config/contracts.d.ts +50 -50
- package/dist/app-config/events.d.ts +27 -27
- package/dist/app-config/lifecycle-contracts.d.ts +54 -54
- package/dist/contract-registry/schemas.d.ts +2 -2
- package/dist/data-views/data-views.d.ts +2 -1
- package/dist/data-views/index.d.ts +2 -1
- package/dist/data-views/spec.d.ts +2 -8
- package/dist/docs/tech/telemetry-ingest.docblock.js +10 -0
- package/dist/examples/schema.d.ts +8 -8
- package/dist/features/index.d.ts +2 -2
- package/dist/index.d.ts +7 -4
- package/dist/index.js +2 -1
- package/dist/integrations/openbanking/contracts/accounts.d.ts +66 -66
- package/dist/integrations/openbanking/contracts/balances.d.ts +34 -34
- package/dist/integrations/openbanking/contracts/transactions.d.ts +48 -48
- package/dist/integrations/openbanking/models.d.ts +55 -55
- package/dist/integrations/operations.d.ts +102 -102
- package/dist/knowledge/operations.d.ts +66 -66
- package/dist/onboarding-base.d.ts +29 -29
- package/dist/serialization/index.d.ts +3 -0
- package/dist/serialization/index.js +3 -0
- package/dist/serialization/serializers.d.ts +40 -0
- package/dist/serialization/serializers.js +148 -0
- package/dist/serialization/types.d.ts +103 -0
- package/dist/serialization/types.js +0 -0
- package/dist/workflow/index.d.ts +2 -1
- package/dist/workflow/spec.d.ts +2 -9
- package/package.json +8 -5
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
//#region src/serialization/serializers.ts
|
|
2
|
+
/**
|
|
3
|
+
* Type guard to check if a value is a ResourceRefDescriptor.
|
|
4
|
+
*/
|
|
5
|
+
function isResourceRefDescriptor(value) {
|
|
6
|
+
return typeof value === "object" && value !== null && "kind" in value && value.kind === "resource_ref";
|
|
7
|
+
}
|
|
8
|
+
function getTypeName(type) {
|
|
9
|
+
if (!type) return "unknown";
|
|
10
|
+
if (typeof type === "string") return type;
|
|
11
|
+
if (typeof type === "object") {
|
|
12
|
+
if ("config" in type && type.config?.name) return type.config.name;
|
|
13
|
+
if ("name" in type && typeof type.name === "string") return type.name;
|
|
14
|
+
}
|
|
15
|
+
return "unknown";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Serialize a SchemaModel to a plain JSON object.
|
|
19
|
+
*/
|
|
20
|
+
function serializeSchemaModel(model) {
|
|
21
|
+
if (!model) return null;
|
|
22
|
+
if (isResourceRefDescriptor(model)) return {
|
|
23
|
+
name: `ResourceRef<${model.graphQLType}>`,
|
|
24
|
+
description: `Reference to ${model.graphQLType} resource (${model.uriTemplate})`,
|
|
25
|
+
fields: {}
|
|
26
|
+
};
|
|
27
|
+
if ("config" in model && model.config) {
|
|
28
|
+
const config = model.config;
|
|
29
|
+
return {
|
|
30
|
+
name: config.name,
|
|
31
|
+
description: config.description,
|
|
32
|
+
fields: Object.fromEntries(Object.entries(config.fields).map(([key, field]) => [key, {
|
|
33
|
+
typeName: getTypeName(field.type),
|
|
34
|
+
isOptional: field.isOptional,
|
|
35
|
+
isArray: field.isArray
|
|
36
|
+
}]))
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
name: "unknown",
|
|
41
|
+
fields: {}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Serialize an OperationSpec to a plain JSON object.
|
|
46
|
+
*/
|
|
47
|
+
function serializeOperationSpec(spec) {
|
|
48
|
+
if (!spec) return null;
|
|
49
|
+
return {
|
|
50
|
+
meta: {
|
|
51
|
+
key: spec.meta.key,
|
|
52
|
+
version: spec.meta.version,
|
|
53
|
+
stability: spec.meta.stability,
|
|
54
|
+
owners: spec.meta.owners,
|
|
55
|
+
tags: spec.meta.tags,
|
|
56
|
+
description: spec.meta.description,
|
|
57
|
+
goal: spec.meta.goal,
|
|
58
|
+
context: spec.meta.context
|
|
59
|
+
},
|
|
60
|
+
io: {
|
|
61
|
+
input: serializeSchemaModel(spec.io.input),
|
|
62
|
+
output: serializeSchemaModel(spec.io.output)
|
|
63
|
+
},
|
|
64
|
+
policy: spec.policy ? { auth: spec.policy.auth } : void 0
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Serialize an EventSpec to a plain JSON object.
|
|
69
|
+
*/
|
|
70
|
+
function serializeEventSpec(spec) {
|
|
71
|
+
if (!spec) return null;
|
|
72
|
+
return {
|
|
73
|
+
meta: {
|
|
74
|
+
key: spec.meta.key,
|
|
75
|
+
version: spec.meta.version,
|
|
76
|
+
stability: spec.meta.stability,
|
|
77
|
+
owners: spec.meta.owners,
|
|
78
|
+
tags: spec.meta.tags,
|
|
79
|
+
description: spec.meta.description
|
|
80
|
+
},
|
|
81
|
+
payload: serializeSchemaModel(spec.payload)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Serialize a PresentationSpec to a plain JSON object.
|
|
86
|
+
*/
|
|
87
|
+
function serializePresentationSpec(spec) {
|
|
88
|
+
if (!spec) return null;
|
|
89
|
+
return {
|
|
90
|
+
meta: {
|
|
91
|
+
key: spec.meta.key,
|
|
92
|
+
version: spec.meta.version,
|
|
93
|
+
stability: spec.meta.stability,
|
|
94
|
+
owners: spec.meta.owners,
|
|
95
|
+
tags: spec.meta.tags,
|
|
96
|
+
description: spec.meta.description,
|
|
97
|
+
goal: spec.meta.goal,
|
|
98
|
+
context: spec.meta.context
|
|
99
|
+
},
|
|
100
|
+
source: {
|
|
101
|
+
type: spec.source.type,
|
|
102
|
+
framework: spec.source.type === "component" ? spec.source.framework : void 0,
|
|
103
|
+
componentKey: spec.source.type === "component" ? spec.source.componentKey : void 0
|
|
104
|
+
},
|
|
105
|
+
targets: spec.targets
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Serialize a DataViewSpec to a plain JSON object.
|
|
110
|
+
*/
|
|
111
|
+
function serializeDataViewSpec(spec) {
|
|
112
|
+
if (!spec) return null;
|
|
113
|
+
return {
|
|
114
|
+
meta: {
|
|
115
|
+
key: spec.meta.key,
|
|
116
|
+
version: spec.meta.version,
|
|
117
|
+
stability: spec.meta.stability,
|
|
118
|
+
owners: spec.meta.owners,
|
|
119
|
+
tags: spec.meta.tags,
|
|
120
|
+
description: spec.meta.description,
|
|
121
|
+
title: spec.meta.title
|
|
122
|
+
},
|
|
123
|
+
source: spec.source,
|
|
124
|
+
view: spec.view
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Serialize a FormSpec to a plain JSON object.
|
|
129
|
+
*/
|
|
130
|
+
function serializeFormSpec(spec) {
|
|
131
|
+
if (!spec) return null;
|
|
132
|
+
return {
|
|
133
|
+
meta: {
|
|
134
|
+
key: spec.meta.key,
|
|
135
|
+
version: spec.meta.version,
|
|
136
|
+
stability: spec.meta.stability,
|
|
137
|
+
owners: spec.meta.owners,
|
|
138
|
+
tags: spec.meta.tags,
|
|
139
|
+
description: spec.meta.description,
|
|
140
|
+
title: spec.meta.title
|
|
141
|
+
},
|
|
142
|
+
fields: spec.fields,
|
|
143
|
+
actions: spec.actions
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
//#endregion
|
|
148
|
+
export { serializeDataViewSpec, serializeEventSpec, serializeFormSpec, serializeOperationSpec, serializePresentationSpec, serializeSchemaModel };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//#region src/serialization/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Serialized types for Server -> Client Component transfer.
|
|
4
|
+
*
|
|
5
|
+
* These are plain JSON-serializable versions of spec types that can be
|
|
6
|
+
* safely passed from Server Components to Client Components in Next.js.
|
|
7
|
+
*/
|
|
8
|
+
/** Serialized schema model that can be passed to client components */
|
|
9
|
+
interface SerializedSchemaModel {
|
|
10
|
+
name: string;
|
|
11
|
+
description?: string | null;
|
|
12
|
+
fields: Record<string, SerializedFieldConfig>;
|
|
13
|
+
}
|
|
14
|
+
interface SerializedFieldConfig {
|
|
15
|
+
typeName: string;
|
|
16
|
+
isOptional: boolean;
|
|
17
|
+
isArray?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** Serialized operation spec for client components */
|
|
20
|
+
interface SerializedOperationSpec {
|
|
21
|
+
meta: {
|
|
22
|
+
key: string;
|
|
23
|
+
version: string;
|
|
24
|
+
stability?: string;
|
|
25
|
+
owners?: string[];
|
|
26
|
+
tags?: string[];
|
|
27
|
+
description?: string;
|
|
28
|
+
goal?: string;
|
|
29
|
+
context?: string;
|
|
30
|
+
};
|
|
31
|
+
io: {
|
|
32
|
+
input: SerializedSchemaModel | null;
|
|
33
|
+
output: SerializedSchemaModel | null;
|
|
34
|
+
};
|
|
35
|
+
policy?: {
|
|
36
|
+
auth?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Serialized event spec for client components */
|
|
40
|
+
interface SerializedEventSpec {
|
|
41
|
+
meta: {
|
|
42
|
+
key: string;
|
|
43
|
+
version: string;
|
|
44
|
+
stability?: string;
|
|
45
|
+
owners?: string[];
|
|
46
|
+
tags?: string[];
|
|
47
|
+
description?: string;
|
|
48
|
+
};
|
|
49
|
+
payload: SerializedSchemaModel | null;
|
|
50
|
+
}
|
|
51
|
+
/** Serialized presentation spec for client components */
|
|
52
|
+
interface SerializedPresentationSpec {
|
|
53
|
+
meta: {
|
|
54
|
+
key: string;
|
|
55
|
+
version: string;
|
|
56
|
+
stability?: string;
|
|
57
|
+
owners?: string[];
|
|
58
|
+
tags?: string[];
|
|
59
|
+
description?: string;
|
|
60
|
+
goal?: string;
|
|
61
|
+
context?: string;
|
|
62
|
+
};
|
|
63
|
+
source: {
|
|
64
|
+
type: string;
|
|
65
|
+
framework?: string;
|
|
66
|
+
componentKey?: string;
|
|
67
|
+
};
|
|
68
|
+
targets?: string[];
|
|
69
|
+
}
|
|
70
|
+
/** Serialized data view spec for client components */
|
|
71
|
+
interface SerializedDataViewSpec {
|
|
72
|
+
meta: {
|
|
73
|
+
key: string;
|
|
74
|
+
version: string;
|
|
75
|
+
stability?: string;
|
|
76
|
+
owners?: string[];
|
|
77
|
+
tags?: string[];
|
|
78
|
+
description?: string;
|
|
79
|
+
title?: string;
|
|
80
|
+
};
|
|
81
|
+
/** Serialized source configuration */
|
|
82
|
+
source?: unknown;
|
|
83
|
+
/** Serialized view configuration */
|
|
84
|
+
view?: unknown;
|
|
85
|
+
}
|
|
86
|
+
/** Serialized form spec for client components */
|
|
87
|
+
interface SerializedFormSpec {
|
|
88
|
+
meta: {
|
|
89
|
+
key: string;
|
|
90
|
+
version?: string;
|
|
91
|
+
stability?: string;
|
|
92
|
+
owners?: string[];
|
|
93
|
+
tags?: string[];
|
|
94
|
+
description?: string;
|
|
95
|
+
title?: string;
|
|
96
|
+
};
|
|
97
|
+
/** Serialized form fields (passed through for display) */
|
|
98
|
+
fields?: unknown;
|
|
99
|
+
/** Serialized form actions (passed through for display) */
|
|
100
|
+
actions?: unknown;
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { SerializedDataViewSpec, SerializedEventSpec, SerializedFieldConfig, SerializedFormSpec, SerializedOperationSpec, SerializedPresentationSpec, SerializedSchemaModel };
|
|
File without changes
|
package/dist/workflow/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormRef } from "../features/types.js";
|
|
2
|
+
import { CompensationStep, CompensationStrategy, GuardCondition, GuardConditionKind, RetryPolicy, SLA, Step, StepAction, StepType, Transition, WorkflowDefinition, WorkflowMeta, WorkflowRegistry, WorkflowSpec, WorkflowStatus } from "./spec.js";
|
|
2
3
|
import { ValidateWorkflowSpecOptions, WorkflowValidationError, WorkflowValidationIssue, WorkflowValidationLevel, assertWorkflowSpecValid, validateWorkflowSpec } from "./validation.js";
|
|
3
4
|
import { StateStore, StepExecution, WorkflowState, WorkflowStateFilters } from "./state.js";
|
|
4
5
|
import { GuardContext, GuardEvaluator, OperationExecutor, OperationExecutorContext, WorkflowPreFlightError, WorkflowPreFlightIssue, WorkflowPreFlightIssueSeverity, WorkflowPreFlightIssueType, WorkflowPreFlightResult, WorkflowRunner, WorkflowRunnerConfig } from "./runner.js";
|
package/dist/workflow/spec.d.ts
CHANGED
|
@@ -2,18 +2,11 @@ import { OwnerShipMeta } from "../ownership.js";
|
|
|
2
2
|
import { CapabilityRef } from "../capabilities/capabilities.js";
|
|
3
3
|
import "../capabilities/index.js";
|
|
4
4
|
import { ExperimentRef } from "../experiments/spec.js";
|
|
5
|
-
import { OpRef } from "../features/types.js";
|
|
5
|
+
import { FormRef, OpRef } from "../features/types.js";
|
|
6
6
|
import "../features/index.js";
|
|
7
7
|
import { SpecContractRegistry } from "../registry.js";
|
|
8
8
|
|
|
9
9
|
//#region src/workflow/spec.d.ts
|
|
10
|
-
/**
|
|
11
|
-
* Reference to a form spec declared in {@link FormRegistry}.
|
|
12
|
-
*/
|
|
13
|
-
interface FormRef {
|
|
14
|
-
key: string;
|
|
15
|
-
version: string;
|
|
16
|
-
}
|
|
17
10
|
type StepType = 'human' | 'automation' | 'decision';
|
|
18
11
|
type WorkflowStatus = 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
|
|
19
12
|
type GuardConditionKind = 'policy' | 'expression';
|
|
@@ -90,4 +83,4 @@ declare class WorkflowRegistry extends SpecContractRegistry<'workflow', Workflow
|
|
|
90
83
|
constructor(items?: WorkflowSpec[]);
|
|
91
84
|
}
|
|
92
85
|
//#endregion
|
|
93
|
-
export { CompensationStep, CompensationStrategy, FormRef, GuardCondition, GuardConditionKind, RetryPolicy, SLA, Step, StepAction, StepType, Transition, WorkflowDefinition, WorkflowMeta, WorkflowRegistry, WorkflowSpec, WorkflowStatus };
|
|
86
|
+
export { CompensationStep, CompensationStrategy, type FormRef, GuardCondition, GuardConditionKind, RetryPolicy, SLA, Step, StepAction, StepType, Transition, WorkflowDefinition, WorkflowMeta, WorkflowRegistry, WorkflowSpec, WorkflowStatus };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/lib.contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.49.0",
|
|
4
4
|
"description": "Core contract specification definitions and runtime",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"contractspec",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"test": "bun test"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@contractspec/tool.tsdown": "1.
|
|
29
|
-
"@contractspec/tool.typescript": "1.
|
|
28
|
+
"@contractspec/tool.tsdown": "1.49.0",
|
|
29
|
+
"@contractspec/tool.typescript": "1.49.0",
|
|
30
30
|
"@types/express": "^5.0.3",
|
|
31
31
|
"@types/turndown": "^5.0.6",
|
|
32
32
|
"tsdown": "^0.19.0",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@aws-sdk/client-secrets-manager": "^3.966.0",
|
|
37
37
|
"@aws-sdk/client-sqs": "^3.966.0",
|
|
38
|
-
"@contractspec/lib.logger": "1.
|
|
39
|
-
"@contractspec/lib.schema": "1.
|
|
38
|
+
"@contractspec/lib.logger": "1.49.0",
|
|
39
|
+
"@contractspec/lib.schema": "1.49.0",
|
|
40
40
|
"@elevenlabs/elevenlabs-js": "^2.30.0",
|
|
41
41
|
"@google-cloud/secret-manager": "^6.1.1",
|
|
42
42
|
"@google-cloud/storage": "^7.18.0",
|
|
@@ -306,6 +306,9 @@
|
|
|
306
306
|
"./registry-utils": "./dist/registry-utils.js",
|
|
307
307
|
"./resources": "./dist/resources.js",
|
|
308
308
|
"./schema-to-markdown": "./dist/schema-to-markdown.js",
|
|
309
|
+
"./serialization": "./dist/serialization/index.js",
|
|
310
|
+
"./serialization/serializers": "./dist/serialization/serializers.js",
|
|
311
|
+
"./serialization/types": "./dist/serialization/types.js",
|
|
309
312
|
"./server": "./dist/server/index.js",
|
|
310
313
|
"./server/contracts-adapter-hydration": "./dist/server/contracts-adapter-hydration.js",
|
|
311
314
|
"./server/contracts-adapter-input": "./dist/server/contracts-adapter-input.js",
|