@lssm/lib.contracts 1.7.2 → 1.7.3
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 +49 -51
- package/dist/app-config/contracts.d.ts.map +1 -1
- package/dist/app-config/contracts.js +1 -1
- package/dist/app-config/contracts.js.map +1 -1
- package/dist/app-config/events.d.ts +26 -28
- package/dist/app-config/events.d.ts.map +1 -1
- package/dist/app-config/events.js +1 -1
- package/dist/app-config/events.js.map +1 -1
- package/dist/app-config/lifecycle-contracts.d.ts +79 -81
- package/dist/app-config/lifecycle-contracts.d.ts.map +1 -1
- package/dist/app-config/lifecycle-contracts.js +1 -1
- package/dist/app-config/lifecycle-contracts.js.map +1 -1
- package/dist/capabilities/openbanking.js.map +1 -1
- package/dist/client/react/form-render.d.ts +0 -1
- package/dist/client/react/form-render.d.ts.map +1 -1
- package/dist/contracts-adapter-input.d.ts +0 -1
- package/dist/contracts-adapter-input.d.ts.map +1 -1
- package/dist/events.d.ts +0 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +1 -1
- package/dist/events.js.map +1 -1
- package/dist/forms.d.ts +0 -1
- package/dist/forms.d.ts.map +1 -1
- package/dist/install.d.ts +0 -1
- package/dist/install.d.ts.map +1 -1
- package/dist/integrations/contracts.d.ts +101 -103
- package/dist/integrations/contracts.d.ts.map +1 -1
- package/dist/integrations/contracts.js +1 -1
- package/dist/integrations/contracts.js.map +1 -1
- package/dist/integrations/openbanking/contracts/accounts.d.ts +65 -67
- package/dist/integrations/openbanking/contracts/accounts.d.ts.map +1 -1
- package/dist/integrations/openbanking/contracts/accounts.js +1 -1
- package/dist/integrations/openbanking/contracts/accounts.js.map +1 -1
- package/dist/integrations/openbanking/contracts/balances.d.ts +33 -35
- package/dist/integrations/openbanking/contracts/balances.d.ts.map +1 -1
- package/dist/integrations/openbanking/contracts/balances.js +1 -1
- package/dist/integrations/openbanking/contracts/balances.js.map +1 -1
- package/dist/integrations/openbanking/contracts/index.js.map +1 -1
- package/dist/integrations/openbanking/contracts/transactions.d.ts +47 -49
- package/dist/integrations/openbanking/contracts/transactions.d.ts.map +1 -1
- package/dist/integrations/openbanking/contracts/transactions.js +1 -1
- package/dist/integrations/openbanking/contracts/transactions.js.map +1 -1
- package/dist/integrations/openbanking/guards.js.map +1 -1
- package/dist/integrations/openbanking/models.d.ts +54 -57
- package/dist/integrations/openbanking/models.d.ts.map +1 -1
- package/dist/integrations/openbanking/models.js +1 -1
- package/dist/integrations/openbanking/models.js.map +1 -1
- package/dist/integrations/openbanking/telemetry.js.map +1 -1
- package/dist/integrations/providers/powens.js.map +1 -1
- package/dist/jsonschema.d.ts +1 -1
- package/dist/jsonschema.d.ts.map +1 -1
- package/dist/knowledge/contracts.d.ts +65 -67
- package/dist/knowledge/contracts.d.ts.map +1 -1
- package/dist/knowledge/contracts.js +1 -1
- package/dist/knowledge/contracts.js.map +1 -1
- package/dist/knowledge/spaces/product-canon.js.map +1 -1
- package/dist/knowledge/spaces/support-faq.js.map +1 -1
- package/dist/knowledge/spec.js.map +1 -1
- package/dist/onboarding-base.d.ts +28 -30
- package/dist/onboarding-base.d.ts.map +1 -1
- package/dist/onboarding-base.js +1 -1
- package/dist/onboarding-base.js.map +1 -1
- package/dist/presentations.d.ts +0 -1
- package/dist/presentations.d.ts.map +1 -1
- package/dist/presentations.v2.d.ts +0 -1
- package/dist/presentations.v2.d.ts.map +1 -1
- package/dist/regenerator/executor.js.map +1 -1
- package/dist/regenerator/service.js.map +1 -1
- package/dist/regenerator/sinks.js.map +1 -1
- package/dist/regenerator/utils.js.map +1 -1
- package/dist/registry.d.ts +0 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/resources.d.ts.map +1 -1
- package/dist/schema/{dist → src}/FieldType.js +1 -1
- package/dist/schema/src/FieldType.js.map +1 -0
- package/dist/schema/src/ScalarTypeEnum.js +2 -0
- package/dist/schema/src/ScalarTypeEnum.js.map +1 -0
- package/dist/schema/{dist → src}/SchemaModel.js +1 -1
- package/dist/schema/src/SchemaModel.js.map +1 -0
- package/dist/schema/src/index.js +1 -0
- package/dist/spec.d.ts +0 -1
- package/dist/spec.d.ts.map +1 -1
- package/dist/workflow/spec.d.ts.map +1 -1
- package/package.json +339 -168
- package/dist/schema/dist/FieldType.js.map +0 -1
- package/dist/schema/dist/ScalarTypeEnum.js +0 -2
- package/dist/schema/dist/ScalarTypeEnum.js.map +0 -1
- package/dist/schema/dist/SchemaModel.js.map +0 -1
- package/dist/schema/dist/index.js +0 -1
- /package/dist/schema/{dist → src}/EnumType.js +0 -0
|
@@ -1,135 +1,133 @@
|
|
|
1
1
|
import { ContractSpec } from "./spec.js";
|
|
2
|
-
import * as _lssm_lib_schema48 from "@lssm/lib.schema";
|
|
3
|
-
import { SchemaModel } from "@lssm/lib.schema";
|
|
4
2
|
|
|
5
3
|
//#region src/onboarding-base.d.ts
|
|
6
4
|
/** Save/update onboarding draft (auto-save during flow) */
|
|
7
5
|
declare const SaveOnboardingDraftInput: SchemaModel<{
|
|
8
6
|
data: {
|
|
9
|
-
type:
|
|
7
|
+
type: void 0<unknown, unknown>;
|
|
10
8
|
isOptional: false;
|
|
11
9
|
};
|
|
12
10
|
}>;
|
|
13
11
|
declare const SaveOnboardingDraftOutput: SchemaModel<{
|
|
14
12
|
id: {
|
|
15
|
-
type:
|
|
13
|
+
type: void 0<string, string>;
|
|
16
14
|
isOptional: false;
|
|
17
15
|
};
|
|
18
16
|
organizationId: {
|
|
19
|
-
type:
|
|
17
|
+
type: void 0<string, string>;
|
|
20
18
|
isOptional: false;
|
|
21
19
|
};
|
|
22
20
|
}>;
|
|
23
21
|
declare const SaveOnboardingDraftBaseSpec: ContractSpec<SchemaModel<{
|
|
24
22
|
data: {
|
|
25
|
-
type:
|
|
23
|
+
type: void 0<unknown, unknown>;
|
|
26
24
|
isOptional: false;
|
|
27
25
|
};
|
|
28
26
|
}>, SchemaModel<{
|
|
29
27
|
id: {
|
|
30
|
-
type:
|
|
28
|
+
type: void 0<string, string>;
|
|
31
29
|
isOptional: false;
|
|
32
30
|
};
|
|
33
31
|
organizationId: {
|
|
34
|
-
type:
|
|
32
|
+
type: void 0<string, string>;
|
|
35
33
|
isOptional: false;
|
|
36
34
|
};
|
|
37
35
|
}>, undefined>;
|
|
38
36
|
/** Get current onboarding draft (on mount/restore) */
|
|
39
37
|
declare const GetOnboardingDraftOutput: SchemaModel<{
|
|
40
38
|
id: {
|
|
41
|
-
type:
|
|
39
|
+
type: void 0<string, string>;
|
|
42
40
|
isOptional: true;
|
|
43
41
|
};
|
|
44
42
|
organizationId: {
|
|
45
|
-
type:
|
|
43
|
+
type: void 0<string, string>;
|
|
46
44
|
isOptional: true;
|
|
47
45
|
};
|
|
48
46
|
data: {
|
|
49
|
-
type:
|
|
47
|
+
type: void 0<unknown, unknown>;
|
|
50
48
|
isOptional: true;
|
|
51
49
|
};
|
|
52
50
|
createdAt: {
|
|
53
|
-
type:
|
|
51
|
+
type: void 0<Date, string>;
|
|
54
52
|
isOptional: true;
|
|
55
53
|
};
|
|
56
54
|
updatedAt: {
|
|
57
|
-
type:
|
|
55
|
+
type: void 0<Date, string>;
|
|
58
56
|
isOptional: true;
|
|
59
57
|
};
|
|
60
58
|
}>;
|
|
61
|
-
declare const GetOnboardingDraftBaseSpec: ContractSpec<
|
|
59
|
+
declare const GetOnboardingDraftBaseSpec: ContractSpec<void 0, SchemaModel<{
|
|
62
60
|
id: {
|
|
63
|
-
type:
|
|
61
|
+
type: void 0<string, string>;
|
|
64
62
|
isOptional: true;
|
|
65
63
|
};
|
|
66
64
|
organizationId: {
|
|
67
|
-
type:
|
|
65
|
+
type: void 0<string, string>;
|
|
68
66
|
isOptional: true;
|
|
69
67
|
};
|
|
70
68
|
data: {
|
|
71
|
-
type:
|
|
69
|
+
type: void 0<unknown, unknown>;
|
|
72
70
|
isOptional: true;
|
|
73
71
|
};
|
|
74
72
|
createdAt: {
|
|
75
|
-
type:
|
|
73
|
+
type: void 0<Date, string>;
|
|
76
74
|
isOptional: true;
|
|
77
75
|
};
|
|
78
76
|
updatedAt: {
|
|
79
|
-
type:
|
|
77
|
+
type: void 0<Date, string>;
|
|
80
78
|
isOptional: true;
|
|
81
79
|
};
|
|
82
80
|
}>, undefined>;
|
|
83
81
|
/** Delete onboarding draft (cleanup after completion or cancel) */
|
|
84
82
|
declare const DeleteOnboardingDraftOutput: SchemaModel<{
|
|
85
83
|
ok: {
|
|
86
|
-
type:
|
|
84
|
+
type: void 0<boolean, boolean>;
|
|
87
85
|
isOptional: false;
|
|
88
86
|
};
|
|
89
87
|
}>;
|
|
90
|
-
declare const DeleteOnboardingDraftBaseSpec: ContractSpec<
|
|
88
|
+
declare const DeleteOnboardingDraftBaseSpec: ContractSpec<void 0, SchemaModel<{
|
|
91
89
|
ok: {
|
|
92
|
-
type:
|
|
90
|
+
type: void 0<boolean, boolean>;
|
|
93
91
|
isOptional: false;
|
|
94
92
|
};
|
|
95
93
|
}>, undefined>;
|
|
96
94
|
/** Complete onboarding (final submit, creates entities) */
|
|
97
95
|
declare const CompleteOnboardingBaseInput: SchemaModel<{
|
|
98
96
|
data: {
|
|
99
|
-
type:
|
|
97
|
+
type: void 0<unknown, unknown>;
|
|
100
98
|
isOptional: false;
|
|
101
99
|
};
|
|
102
100
|
}>;
|
|
103
101
|
declare const CompleteOnboardingBaseOutput: SchemaModel<{
|
|
104
102
|
success: {
|
|
105
|
-
type:
|
|
103
|
+
type: void 0<boolean, boolean>;
|
|
106
104
|
isOptional: false;
|
|
107
105
|
};
|
|
108
106
|
userId: {
|
|
109
|
-
type:
|
|
107
|
+
type: void 0<string, string>;
|
|
110
108
|
isOptional: true;
|
|
111
109
|
};
|
|
112
110
|
organizationId: {
|
|
113
|
-
type:
|
|
111
|
+
type: void 0<string, string>;
|
|
114
112
|
isOptional: true;
|
|
115
113
|
};
|
|
116
114
|
}>;
|
|
117
115
|
declare const CompleteOnboardingBaseSpec: ContractSpec<SchemaModel<{
|
|
118
116
|
data: {
|
|
119
|
-
type:
|
|
117
|
+
type: void 0<unknown, unknown>;
|
|
120
118
|
isOptional: false;
|
|
121
119
|
};
|
|
122
120
|
}>, SchemaModel<{
|
|
123
121
|
success: {
|
|
124
|
-
type:
|
|
122
|
+
type: void 0<boolean, boolean>;
|
|
125
123
|
isOptional: false;
|
|
126
124
|
};
|
|
127
125
|
userId: {
|
|
128
|
-
type:
|
|
126
|
+
type: void 0<string, string>;
|
|
129
127
|
isOptional: true;
|
|
130
128
|
};
|
|
131
129
|
organizationId: {
|
|
132
|
-
type:
|
|
130
|
+
type: void 0<string, string>;
|
|
133
131
|
isOptional: true;
|
|
134
132
|
};
|
|
135
133
|
}>, undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding-base.d.ts","names":[],"sources":["../src/onboarding-base.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"onboarding-base.d.ts","names":[],"sources":["../src/onboarding-base.ts"],"sourcesContent":[],"mappings":";;;;cASa,0BAAwB;EAAxB,IAAA,EAAA;IAQA,IAAA,EAFX,KAAA,CASA,CAAA,OAAA,EAAA,OAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;CAPoC,CAAA;AAAA,cAAzB,yBAAyB,EAAA,WAAA,CAAA;EASzB,EAAA,EAAA;IAwBX,IAAA,EA1BA,KAAA,CA0BA,CAAA,MAAA,EAAA,MAAA,CAAA;IAxBsC,UAAA,EAAA,KAAA;EAAA,CAAA;;;;EAAA,CAAA;AA2BxC,CAAA,CAAA;AAUE,cArCW,2BAqCX,cAAA,CArCsC,WAqCtC,CAAA;;UAbA,KAAA;;;;;IAGmC,IAAA,EA3BG,KAAA,CA2BH,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAYxB,CAAA;EAuBX,cAAA,EAAA;IAvBqC,IAAA,QAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;;cAZ1B,0BAAwB;;IAYE,IAAA,EAFrC,KAAA,CAEqC,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;EAAA,CAAA;EA0B1B,cAAA,EAAA;IAQA,IAAA,QAuBX,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;EAvBwC,CAAA;EAAA,IAAA,EAAA;IAAA,IAAA,QAAA,CAAA,OAAA,EAAA,OAAA,CAAA;IAAA,UAAA,EAAA,IAAA;EA0B7B,CAAA;EAQA,SAAA,EAAA;IAQX,IAAA,QAAA,KAAA,EAAA,MAAA,CAAA;;;EARuC,SAAA,EAAA;IAAA,IAAA,QAAA,KAAA,EAAA,MAAA,CAAA;IAU5B,UAAA,EAAA,IAAA;EAwBX,CAAA;CAxBqC,CAAA;AAAA,cA9E1B,0BA8E0B,EA9EA,YA8EA,CAvDrC,KAAA,CAAA,EAvBqC,WA8EA,CAAA;;UA9EA,KAAA;;;EA8EA,cAAA,EAAA;;;;;;;;;;;;;;;;;;cApD1B,6BAA2B;;UAMtC,KAAA;;;;cAEW,+BAA6B,aAuBxC,KAAA,CAAA,EAvBwC;;UAAA,KAAA;;;;;cA0B7B,6BAA2B;;UAMtC,KAAA;;;;cAEW,8BAA4B;;UAQvC,KAAA;;;;;;;;;;;;cAEW,yCAA0B;;UAwBrC,KAAA;;;;;UAxBqC,KAAA"}
|
package/dist/onboarding-base.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ScalarTypeEnum as e}from"./schema/src/ScalarTypeEnum.js";import{SchemaModel as t}from"./schema/src/SchemaModel.js";import"./schema/src/index.js";import{defineCommand as n,defineQuery as r}from"./spec.js";import{OwnersEnum as i,StabilityEnum as a}from"./ownership.js";const o=new t({name:`SaveOnboardingDraftInput`,description:`Input for saving onboarding draft`,fields:{data:{type:e.JSON(),isOptional:!1}}}),s=new t({name:`SaveOnboardingDraftOutput`,description:`Output for saving onboarding draft`,fields:{id:{type:e.ID(),isOptional:!1},organizationId:{type:e.ID(),isOptional:!1}}}),c=n({meta:{name:`base.onboarding.saveDraft`,version:1,stability:a.Beta,owners:[i.PlatformSigil],tags:[`onboarding`,`draft`],description:`Save or update onboarding draft for active organization`,goal:`Persist onboarding progress incrementally for resumption and safety`,context:`Auto-saves every few seconds during onboarding; enables users to leave and resume`},io:{input:o,output:s},policy:{auth:`user`,escalate:null},transport:{gql:{field:`saveOnboardingDraft`},rest:{method:`POST`}}}),l=new t({name:`GetOnboardingDraftOutput`,description:`Onboarding draft payload`,fields:{id:{type:e.ID(),isOptional:!0},organizationId:{type:e.ID(),isOptional:!0},data:{type:e.JSON(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!0},updatedAt:{type:e.DateTime(),isOptional:!0}}}),u=r({meta:{name:`base.onboarding.getDraft`,version:1,stability:a.Beta,owners:[i.PlatformSigil],tags:[`onboarding`,`draft`],description:`Get onboarding draft for active organization`,goal:`Retrieve saved onboarding progress`,context:`Called on mount to restore in-progress onboarding`},io:{input:null,output:l},policy:{auth:`user`,escalate:null},transport:{gql:{field:`getOnboardingDraft`},rest:{method:`GET`}}}),d=new t({name:`DeleteOnboardingDraftOutput`,description:`Result of delete operation`,fields:{ok:{type:e.Boolean(),isOptional:!1}}}),f=n({meta:{name:`base.onboarding.deleteDraft`,version:1,stability:a.Beta,owners:[i.PlatformSigil],tags:[`onboarding`,`draft`],description:`Delete onboarding draft for active organization`,goal:`Clear draft after completion or if user wants to restart`,context:`Called after successful onboarding or explicit user reset`},io:{input:null,output:d},policy:{auth:`user`,escalate:null},transport:{gql:{field:`deleteOnboardingDraft`},rest:{method:`POST`}}}),p=new t({name:`CompleteOnboardingBaseInput`,description:`Input for completing onboarding`,fields:{data:{type:e.JSON(),isOptional:!1}}}),m=new t({name:`CompleteOnboardingBaseOutput`,description:`Result of onboarding completion`,fields:{success:{type:e.Boolean(),isOptional:!1},userId:{type:e.ID(),isOptional:!0},organizationId:{type:e.ID(),isOptional:!0}}}),h=n({meta:{name:`base.onboarding.complete`,version:1,stability:a.Beta,owners:[i.PlatformSigil],tags:[`onboarding`],description:`Complete onboarding and finalize user/organization setup`,goal:`Transition from draft to active profile`,context:`Validates all required fields, creates/updates entities, marks onboarding complete`},io:{input:p,output:m},policy:{auth:`user`,escalate:null},transport:{gql:{field:`completeOnboarding`},rest:{method:`POST`}}});export{p as CompleteOnboardingBaseInput,m as CompleteOnboardingBaseOutput,h as CompleteOnboardingBaseSpec,f as DeleteOnboardingDraftBaseSpec,d as DeleteOnboardingDraftOutput,u as GetOnboardingDraftBaseSpec,l as GetOnboardingDraftOutput,c as SaveOnboardingDraftBaseSpec,o as SaveOnboardingDraftInput,s as SaveOnboardingDraftOutput};
|
|
2
2
|
//# sourceMappingURL=onboarding-base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding-base.js","names":[
|
|
1
|
+
{"version":3,"file":"onboarding-base.js","names":[],"sources":["../src/onboarding-base.ts"],"sourcesContent":["/**\n * Shared base contracts for onboarding flows across verticals.\n * These operations are reusable for any app that needs multi-step onboarding with draft persistence.\n */\nimport { defineCommand, defineQuery } from './spec';\nimport { ScalarTypeEnum, SchemaModel } from '@lssm/lib.schema';\nimport { OwnersEnum, StabilityEnum } from './ownership';\n\n/** Save/update onboarding draft (auto-save during flow) */\nexport const SaveOnboardingDraftInput = new SchemaModel({\n name: 'SaveOnboardingDraftInput',\n description: 'Input for saving onboarding draft',\n fields: {\n data: { type: ScalarTypeEnum.JSON(), isOptional: false },\n },\n});\n\nexport const SaveOnboardingDraftOutput = new SchemaModel({\n name: 'SaveOnboardingDraftOutput',\n description: 'Output for saving onboarding draft',\n fields: {\n id: { type: ScalarTypeEnum.ID(), isOptional: false },\n organizationId: { type: ScalarTypeEnum.ID(), isOptional: false },\n },\n});\n\nexport const SaveOnboardingDraftBaseSpec = defineCommand({\n meta: {\n name: 'base.onboarding.saveDraft',\n version: 1,\n stability: StabilityEnum.Beta,\n owners: [OwnersEnum.PlatformSigil],\n tags: ['onboarding', 'draft'],\n description: 'Save or update onboarding draft for active organization',\n goal: 'Persist onboarding progress incrementally for resumption and safety',\n context:\n 'Auto-saves every few seconds during onboarding; enables users to leave and resume',\n },\n io: {\n input: SaveOnboardingDraftInput,\n output: SaveOnboardingDraftOutput,\n },\n policy: {\n auth: 'user',\n escalate: null,\n },\n transport: {\n gql: { field: 'saveOnboardingDraft' },\n rest: { method: 'POST' },\n },\n});\n\n/** Get current onboarding draft (on mount/restore) */\nexport const GetOnboardingDraftOutput = new SchemaModel({\n name: 'GetOnboardingDraftOutput',\n description: 'Onboarding draft payload',\n fields: {\n id: { type: ScalarTypeEnum.ID(), isOptional: true },\n organizationId: { type: ScalarTypeEnum.ID(), isOptional: true },\n data: { type: ScalarTypeEnum.JSON(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\nexport const GetOnboardingDraftBaseSpec = defineQuery({\n meta: {\n name: 'base.onboarding.getDraft',\n version: 1,\n stability: StabilityEnum.Beta,\n owners: [OwnersEnum.PlatformSigil],\n tags: ['onboarding', 'draft'],\n description: 'Get onboarding draft for active organization',\n goal: 'Retrieve saved onboarding progress',\n context: 'Called on mount to restore in-progress onboarding',\n },\n io: {\n input: null,\n output: GetOnboardingDraftOutput,\n },\n policy: {\n auth: 'user',\n escalate: null,\n },\n transport: {\n gql: { field: 'getOnboardingDraft' },\n rest: { method: 'GET' },\n },\n});\n\n/** Delete onboarding draft (cleanup after completion or cancel) */\nexport const DeleteOnboardingDraftOutput = new SchemaModel({\n name: 'DeleteOnboardingDraftOutput',\n description: 'Result of delete operation',\n fields: {\n ok: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\nexport const DeleteOnboardingDraftBaseSpec = defineCommand({\n meta: {\n name: 'base.onboarding.deleteDraft',\n version: 1,\n stability: StabilityEnum.Beta,\n owners: [OwnersEnum.PlatformSigil],\n tags: ['onboarding', 'draft'],\n description: 'Delete onboarding draft for active organization',\n goal: 'Clear draft after completion or if user wants to restart',\n context: 'Called after successful onboarding or explicit user reset',\n },\n io: {\n input: null,\n output: DeleteOnboardingDraftOutput,\n },\n policy: {\n auth: 'user',\n escalate: null,\n },\n transport: {\n gql: { field: 'deleteOnboardingDraft' },\n rest: { method: 'POST' },\n },\n});\n\n/** Complete onboarding (final submit, creates entities) */\nexport const CompleteOnboardingBaseInput = new SchemaModel({\n name: 'CompleteOnboardingBaseInput',\n description: 'Input for completing onboarding',\n fields: {\n data: { type: ScalarTypeEnum.JSON(), isOptional: false },\n },\n});\n\nexport const CompleteOnboardingBaseOutput = new SchemaModel({\n name: 'CompleteOnboardingBaseOutput',\n description: 'Result of onboarding completion',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n userId: { type: ScalarTypeEnum.ID(), isOptional: true },\n organizationId: { type: ScalarTypeEnum.ID(), isOptional: true },\n },\n});\n\nexport const CompleteOnboardingBaseSpec = defineCommand({\n meta: {\n name: 'base.onboarding.complete',\n version: 1,\n stability: StabilityEnum.Beta,\n owners: [OwnersEnum.PlatformSigil],\n tags: ['onboarding'],\n description: 'Complete onboarding and finalize user/organization setup',\n goal: 'Transition from draft to active profile',\n context:\n 'Validates all required fields, creates/updates entities, marks onboarding complete',\n },\n io: {\n input: CompleteOnboardingBaseInput,\n output: CompleteOnboardingBaseOutput,\n },\n policy: {\n auth: 'user',\n escalate: null,\n },\n transport: {\n gql: { field: 'completeOnboarding' },\n rest: { method: 'POST' },\n },\n});\n"],"mappings":"kRASA,MAAa,EAA2B,IAAI,EAAY,CACtD,KAAM,2BACN,YAAa,oCACb,OAAQ,CACN,KAAM,CAAE,KAAM,EAAe,MAAM,CAAE,WAAY,GAAO,CACzD,CACF,CAAC,CAEW,EAA4B,IAAI,EAAY,CACvD,KAAM,4BACN,YAAa,qCACb,OAAQ,CACN,GAAI,CAAE,KAAM,EAAe,IAAI,CAAE,WAAY,GAAO,CACpD,eAAgB,C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,CAEW,EAAgC,EAAc,CACzD,KAAM,CACJ,KAAM,8BACN,QAAS,EACT,UAAW,EAAc,KACzB,OAAQ,CAAC,EAAW,cAAc,CAClC,KAAM,CAAC,aAAc,QAAQ,CAC7B,YAAa,kDACb,KAAM,2DACN,QAAS,4DACV,CACD,GAAI,CACF,MAAO,KACP,OAAQ,EACT,CACD,OAAQ,CACN,KAAM,OACN,SAAU,KACX,CACD,UAAW,CACT,IAAK,CAAE,MAAO,wBAAyB,CACvC,KAAM,CAAE,OAAQ,OAAQ,CACzB,CACF,CAAC,CAGW,EAA8B,IAAI,EAAY,CACzD,KAAM,8BACN,YAAa,kCACb,OAAQ,CACN,KAAM,CAAE,KAAM,EAAe,MAAM,CAAE,WAAY,GAAO,CACzD,CACF,CAAC,CAEW,EAA+B,IAAI,EAAY,CAC1D,KAAM,+BACN,YAAa,kCACb,OAAQ,CACN,QAAS,CAAE,KAAM,EAAe,SAAS,CAAE,WAAY,GAAO,CAC9D,OAAQ,CAAE,KAAM,EAAe,IAAI,CAAE,WAAY,GAAM,CACvD,eAAgB,CAAE,KAAM,EAAe,IAAI,CAAE,WAAY,GAAM,CAChE,CACF,CAAC,CAEW,EAA6B,EAAc,CACtD,KAAM,CACJ,KAAM,2BACN,QAAS,EACT,UAAW,EAAc,KACzB,OAAQ,CAAC,EAAW,cAAc,CAClC,KAAM,CAAC,aAAa,CACpB,YAAa,2DACb,KAAM,0CACN,QACE,qFACH,CACD,GAAI,CACF,MAAO,EACP,OAAQ,EACT,CACD,OAAQ,CACN,KAAM,OACN,SAAU,KACX,CACD,UAAW,CACT,IAAK,CAAE,MAAO,qBAAsB,CACpC,KAAM,CAAE,OAAQ,OAAQ,CACzB,CACF,CAAC"}
|
package/dist/presentations.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentations.d.ts","names":[],"sources":["../src/presentations.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"presentations.d.ts","names":[],"sources":["../src/presentations.ts"],"sourcesContent":[],"mappings":";;;;;AAKY,KAAA,gBAAA,GAAgB,eAAA,GAAA,UAAA,GAAA,MAAA;AAG5B;AAUiB,UAVA,gBAAA,CAUkB;EAMlB,IAAA,EAAA,MAAA;EAWA,OAAA,EAAA,MAAA;EASA,SAAA,CAAA,EAjCH,SAiCmB;EAOrB,MAAA,CAAA,EAAA,MAAA,EAAA;EACR,IAAA,CAAA,EAAA,MAAA,EAAA;EACA,WAAA,CAAA,EAAA,MAAA;;;AAGa,UAtCA,kBAAA,CAsCgB;EACzB,KAAA,CAAA,EAAA,MAAA,EAAA;EACG,GAAA,CAAA,EAAA,MAAA,EAAA;;;AASE,UA3CI,wBAAA,CA2CgB;EAGnB,IAAA,EAAA,eAAA;EAOJ,SAAA,EAAA,OAAA;EAI6B;EAAgB,YAAA,EAAA,MAAA;EAevC;EAA6B,KAAA,EAlEpC,cAkEoC;;;;UA7D5B,oBAAA;EAsEoB,IAAA,EAAA,UAAA;;;EAAA;EAAgB,WAAA,CAAA,EAAA,MAAA;;;UA7DpC,gBAAA;;;;SAIR;;KAGG,mBAAA,GACR,2BACA,uBACA;UAEa,gBAAA;QACT;WACG;WACA;;;cAQE,oBAAA;;cAGC;UAOJ;uCAI6B;;iBAevB,yBAAA,IAA6B;;;;;;;;;;;QASR;;;;;;;;;;;QAAA;;;;;;;;;;;QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentations.v2.d.ts","names":[],"sources":["../src/presentations.v2.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"presentations.v2.d.ts","names":[],"sources":["../src/presentations.v2.ts"],"sourcesContent":[],"mappings":";;;;;AAKY,KAAA,kBAAA,GAAkB,OAAA,GAAA,UAAA,GAAA,kBAAA,GAAA,iBAAA;AAMb,UAAA,kBAAA,SAA2B,OAAQ,CAAA,aAAD,CAAA,CAAA;EAUlC;EAYA,IAAA,EAAA,MAAA;EASL;EAQK,OAAA,EAAA,MAAA;EACT;EAEE,WAAA,CAAA,EAAA,MAAA;;;AAIO,UApCA,gCAAA,CAoCa;EASb;EACP,IAAA,EAAA,WAAA;EAEA;EACA,SAAA,EAAA,OAAA;EACK;EAAR,YAAA,EAAA,MAAA;EAAO;EAGG,KAAA,CAAA,EA7CP,cA6CO;;;AAIP,UA7CO,6BAAA,CA6CP;EACH;EAAO,IAAA,EAAA,aAAA;EAOD;EAOmC,OAAA,EAAA,OAAA;EAArB;EAOT,WAAA,CAAA,EA7DF,WA6DE;;AAOR,KAjEE,kBAAA,GACR,gCAgEM,GA/DN,6BA+DM;;;;;AAwBM,UAjFC,wBAAA,CAiF2B;EA4FhC,IAAA,EA5KJ,kBA4KyB;EASjB,MAAA,CAAA,EAAA;IA8BA,KAAA,CAAA,EAAA,MAAA,EAAA;;;UAjNN;WACC;;UAGM,aAAA;;;;;;;;UASA;UACP;iBAEA,gCACA,kBACH,QAAQ;;UAGE,qBAAA;mBAEP,kCACE,0BACF,kBACH;;;;;;cAOM,eAAA;;;2BAOc,qBAAqB;kBAO9B;iCAMN,0BACF,gCACA,gBACL,QAAQ;;;iBAsBG,4BAAA,CAAA,GAA4B;;KA4FhC,qBAAA;;;UAIE;;;;gBAE6C;;;iBAG3C,4BAAA,SAAqC,kBAAe;;;;iBA8BpD,uBAAA,SAAgC,kBAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","names":["deps: ProposalExecutorDeps","actionResults: ActionExecutionResult[]"],"sources":["../../src/regenerator/executor.ts"],"sourcesContent":["import type { SpecChangeProposal, ProposalAction, RegenerationContext } from './types';\n\nexport type ExecutionStatus = 'success' | 'skipped' | 'failed';\n\nexport interface ActionExecutionResult {\n index: number;\n action: ProposalAction;\n status: ExecutionStatus;\n startedAt: Date;\n finishedAt: Date;\n reason?: string;\n error?: Error;\n output?: unknown;\n}\n\nexport interface ProposalExecutionResult {\n proposalId: string;\n contextId: string;\n startedAt: Date;\n finishedAt: Date;\n status: 'success' | 'partial' | 'failed';\n actions: ActionExecutionResult[];\n}\n\nexport type UpdateBlueprintAction = Extract<ProposalAction, { kind: 'update_blueprint' }>;\nexport type UpdateTenantConfigAction = Extract<ProposalAction, { kind: 'update_tenant_config' }>;\nexport type RunTestsAction = Extract<ProposalAction, { kind: 'run_tests' }>;\nexport type RunMigrationsAction = Extract<ProposalAction, { kind: 'run_migrations' }>;\nexport type TriggerRegenerationAction = Extract<ProposalAction, { kind: 'trigger_regeneration' }>;\n\nexport interface BlueprintUpdater {\n applyBlueprintUpdate(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n action: UpdateBlueprintAction\n ): Promise<unknown>;\n}\n\nexport interface TenantConfigUpdater {\n applyTenantConfigUpdate(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n action: UpdateTenantConfigAction\n ): Promise<unknown>;\n}\n\nexport interface TestExecutor {\n runTests(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n action: RunTestsAction\n ): Promise<unknown>;\n}\n\nexport interface MigrationExecutor {\n runMigrations(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n action: RunMigrationsAction\n ): Promise<unknown>;\n}\n\nexport interface RegenerationTrigger {\n triggerRegeneration(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n action: TriggerRegenerationAction\n ): Promise<unknown>;\n}\n\nexport interface ProposalExecutorOptions {\n dryRun?: boolean;\n}\n\nexport interface ProposalExecutorDeps {\n blueprintUpdater?: BlueprintUpdater;\n tenantConfigUpdater?: TenantConfigUpdater;\n testExecutor?: TestExecutor;\n migrationExecutor?: MigrationExecutor;\n regenerationTrigger?: RegenerationTrigger;\n}\n\nexport class ProposalExecutor {\n constructor(private readonly deps: ProposalExecutorDeps = {}) {}\n\n async execute(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n options: ProposalExecutorOptions = {}\n ): Promise<ProposalExecutionResult> {\n const startedAt = new Date();\n const actionResults: ActionExecutionResult[] = [];\n\n for (const [index, action] of proposal.actions.entries()) {\n // eslint-disable-next-line no-await-in-loop\n const result = await this.executeAction({\n index,\n action,\n context,\n proposal,\n options,\n });\n actionResults.push(result);\n }\n\n const finishedAt = new Date();\n const summaryStatus = summarizeStatus(actionResults);\n\n return {\n proposalId: proposal.id,\n contextId: context.id,\n startedAt,\n finishedAt,\n status: summaryStatus,\n actions: actionResults,\n };\n }\n\n private async executeAction({\n index,\n action,\n context,\n proposal,\n options,\n }: {\n index: number;\n action: ProposalAction;\n context: RegenerationContext;\n proposal: SpecChangeProposal;\n options: ProposalExecutorOptions;\n }): Promise<ActionExecutionResult> {\n const startedAt = new Date();\n const dryRun = options.dryRun ?? false;\n\n const complete = (\n status: ExecutionStatus,\n params: {\n reason?: string;\n output?: unknown;\n error?: Error;\n } = {}\n ): ActionExecutionResult => ({\n index,\n action,\n status,\n startedAt,\n finishedAt: new Date(),\n reason: params.reason,\n output: params.output,\n error: params.error,\n });\n\n if (dryRun) {\n return complete('skipped', { reason: 'dry_run' });\n }\n\n try {\n switch (action.kind) {\n case 'update_blueprint': {\n const updater = this.deps.blueprintUpdater;\n if (!updater) {\n return complete('skipped', { reason: 'missing_blueprint_updater' });\n }\n const output = await updater.applyBlueprintUpdate(context, proposal, action);\n return complete('success', { output });\n }\n case 'update_tenant_config': {\n const updater = this.deps.tenantConfigUpdater;\n if (!updater) {\n return complete('skipped', { reason: 'missing_tenant_config_updater' });\n }\n const output = await updater.applyTenantConfigUpdate(context, proposal, action);\n return complete('success', { output });\n }\n case 'run_tests': {\n const executor = this.deps.testExecutor;\n if (!executor) {\n return complete('skipped', { reason: 'missing_test_executor' });\n }\n const output = await executor.runTests(context, proposal, action);\n return complete('success', { output });\n }\n case 'run_migrations': {\n const executor = this.deps.migrationExecutor;\n if (!executor) {\n return complete('skipped', { reason: 'missing_migration_executor' });\n }\n const output = await executor.runMigrations(context, proposal, action);\n return complete('success', { output });\n }\n case 'trigger_regeneration': {\n const trigger = this.deps.regenerationTrigger;\n if (!trigger) {\n return complete('skipped', { reason: 'missing_regeneration_trigger' });\n }\n const output = await trigger.triggerRegeneration(context, proposal, action);\n return complete('success', { output });\n }\n default: {\n return complete('skipped', { reason: 'unknown_action' });\n }\n }\n } catch (error) {\n return complete('failed', {\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n }\n}\n\nfunction summarizeStatus(actionResults: ActionExecutionResult[]): ProposalExecutionResult['status'] {\n if (actionResults.some((result) => result.status === 'failed')) {\n return 'failed';\n }\n if (actionResults.some((result) => result.status === 'success') &&\n actionResults.some((result) => result.status === 'skipped')) {\n return 'partial';\n }\n if (actionResults.every((result) => result.status === 'skipped')) {\n return 'partial';\n }\n return 'success';\n}\n\n\n\n\n"],"mappings":"AAkFA,IAAa,EAAb,KAA8B,CAC5B,YAAY,EAA8C,EAAE,CAAE,CAAjC,KAAA,KAAA,EAE7B,MAAM,QACJ,EACA,EACA,EAAmC,EAAE,CACH,CAClC,IAAM,EAAY,IAAI,KAChBC,EAAyC,EAAE,CAEjD,IAAK,GAAM,CAAC,EAAO,KAAW,EAAS,QAAQ,SAAS,CAAE,CAExD,IAAM,EAAS,MAAM,KAAK,cAAc,CACtC,QACA,SACA,UACA,WACA,UACD,CAAC,CACF,EAAc,KAAK,EAAO,CAG5B,IAAM,EAAa,IAAI,KACjB,EAAgB,EAAgB,EAAc,CAEpD,MAAO,CACL,WAAY,EAAS,GACrB,UAAW,EAAQ,GACnB,YACA,aACA,OAAQ,EACR,QAAS,EACV,CAGH,MAAc,cAAc,CAC1B,QACA,SACA,UACA,WACA,WAOiC,CACjC,IAAM,EAAY,IAAI,KAChB,EAAS,EAAQ,QAAU,GAE3B,GACJ,EACA,EAII,EAAE,IACqB,CAC3B,QACA,SACA,SACA,YACA,WAAY,IAAI,KAChB,OAAQ,EAAO,OACf,OAAQ,EAAO,OACf,MAAO,EAAO,MACf,EAED,GAAI,EACF,OAAO,EAAS,UAAW,CAAE,OAAQ,UAAW,CAAC,CAGnD,GAAI,CACF,OAAQ,EAAO,KAAf,CACE,IA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,UAAU,EAC3D,EAAc,KAAM,GAAW,EAAO,SAAW,UAAU,EAG3D,EAAc,MAAO,GAAW,EAAO,SAAW,UAAU,CACvD,UAEF"}
|
|
1
|
+
{"version":3,"file":"executor.js","names":["deps: ProposalExecutorDeps","actionResults: ActionExecutionResult[]"],"sources":["../../src/regenerator/executor.ts"],"sourcesContent":["import type { SpecChangeProposal, ProposalAction, RegenerationContext } from './types';\n\nexport type ExecutionStatus = 'success' | 'skipped' | 'failed';\n\nexport interface ActionExecutionResult {\n index: number;\n action: ProposalAction;\n status: ExecutionStatus;\n startedAt: Date;\n finishedAt: Date;\n reason?: string;\n error?: Error;\n output?: unknown;\n}\n\nexport interface ProposalExecutionResult {\n proposalId: string;\n contextId: string;\n startedAt: Date;\n finishedAt: Date;\n status: 'success' | 'partial' | 'failed';\n actions: ActionExecutionResult[];\n}\n\nexport type UpdateBlueprintAction = Extract<ProposalAction, { kind: 'update_blueprint' }>;\nexport type UpdateTenantConfigAction = Extract<ProposalAction, { kind: 'update_tenant_config' }>;\nexport type RunTestsAction = Extract<ProposalAction, { kind: 'run_tests' }>;\nexport type RunMigrationsAction = Extract<ProposalAction, { kind: 'run_migrations' }>;\nexport type TriggerRegenerationAction = Extract<ProposalAction, { kind: 'trigger_regeneration' }>;\n\nexport interface BlueprintUpdater {\n applyBlueprintUpdate(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n action: UpdateBlueprintAction\n ): Promise<unknown>;\n}\n\nexport interface TenantConfigUpdater {\n applyTenantConfigUpdate(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n action: UpdateTenantConfigAction\n ): Promise<unknown>;\n}\n\nexport interface TestExecutor {\n runTests(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n action: RunTestsAction\n ): Promise<unknown>;\n}\n\nexport interface MigrationExecutor {\n runMigrations(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n action: RunMigrationsAction\n ): Promise<unknown>;\n}\n\nexport interface RegenerationTrigger {\n triggerRegeneration(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n action: TriggerRegenerationAction\n ): Promise<unknown>;\n}\n\nexport interface ProposalExecutorOptions {\n dryRun?: boolean;\n}\n\nexport interface ProposalExecutorDeps {\n blueprintUpdater?: BlueprintUpdater;\n tenantConfigUpdater?: TenantConfigUpdater;\n testExecutor?: TestExecutor;\n migrationExecutor?: MigrationExecutor;\n regenerationTrigger?: RegenerationTrigger;\n}\n\nexport class ProposalExecutor {\n constructor(private readonly deps: ProposalExecutorDeps = {}) {}\n\n async execute(\n context: RegenerationContext,\n proposal: SpecChangeProposal,\n options: ProposalExecutorOptions = {}\n ): Promise<ProposalExecutionResult> {\n const startedAt = new Date();\n const actionResults: ActionExecutionResult[] = [];\n\n for (const [index, action] of proposal.actions.entries()) {\n // eslint-disable-next-line no-await-in-loop\n const result = await this.executeAction({\n index,\n action,\n context,\n proposal,\n options,\n });\n actionResults.push(result);\n }\n\n const finishedAt = new Date();\n const summaryStatus = summarizeStatus(actionResults);\n\n return {\n proposalId: proposal.id,\n contextId: context.id,\n startedAt,\n finishedAt,\n status: summaryStatus,\n actions: actionResults,\n };\n }\n\n private async executeAction({\n index,\n action,\n context,\n proposal,\n options,\n }: {\n index: number;\n action: ProposalAction;\n context: RegenerationContext;\n proposal: SpecChangeProposal;\n options: ProposalExecutorOptions;\n }): Promise<ActionExecutionResult> {\n const startedAt = new Date();\n const dryRun = options.dryRun ?? false;\n\n const complete = (\n status: ExecutionStatus,\n params: {\n reason?: string;\n output?: unknown;\n error?: Error;\n } = {}\n ): ActionExecutionResult => ({\n index,\n action,\n status,\n startedAt,\n finishedAt: new Date(),\n reason: params.reason,\n output: params.output,\n error: params.error,\n });\n\n if (dryRun) {\n return complete('skipped', { reason: 'dry_run' });\n }\n\n try {\n switch (action.kind) {\n case 'update_blueprint': {\n const updater = this.deps.blueprintUpdater;\n if (!updater) {\n return complete('skipped', { reason: 'missing_blueprint_updater' });\n }\n const output = await updater.applyBlueprintUpdate(context, proposal, action);\n return complete('success', { output });\n }\n case 'update_tenant_config': {\n const updater = this.deps.tenantConfigUpdater;\n if (!updater) {\n return complete('skipped', { reason: 'missing_tenant_config_updater' });\n }\n const output = await updater.applyTenantConfigUpdate(context, proposal, action);\n return complete('success', { output });\n }\n case 'run_tests': {\n const executor = this.deps.testExecutor;\n if (!executor) {\n return complete('skipped', { reason: 'missing_test_executor' });\n }\n const output = await executor.runTests(context, proposal, action);\n return complete('success', { output });\n }\n case 'run_migrations': {\n const executor = this.deps.migrationExecutor;\n if (!executor) {\n return complete('skipped', { reason: 'missing_migration_executor' });\n }\n const output = await executor.runMigrations(context, proposal, action);\n return complete('success', { output });\n }\n case 'trigger_regeneration': {\n const trigger = this.deps.regenerationTrigger;\n if (!trigger) {\n return complete('skipped', { reason: 'missing_regeneration_trigger' });\n }\n const output = await trigger.triggerRegeneration(context, proposal, action);\n return complete('success', { output });\n }\n default: {\n return complete('skipped', { reason: 'unknown_action' });\n }\n }\n } catch (error) {\n return complete('failed', {\n error: error instanceof Error ? error : new Error(String(error)),\n });\n }\n }\n}\n\nfunction summarizeStatus(actionResults: ActionExecutionResult[]): ProposalExecutionResult['status'] {\n if (actionResults.some((result) => result.status === 'failed')) {\n return 'failed';\n }\n if (actionResults.some((result) => result.status === 'success') &&\n actionResults.some((result) => result.status === 'skipped')) {\n return 'partial';\n }\n if (actionResults.every((result) => result.status === 'skipped')) {\n return 'partial';\n }\n return 'success';\n}\n\n\n\n\n\n\n"],"mappings":"AAkFA,IAAa,EAAb,KAA8B,CAC5B,YAAY,EAA8C,EAAE,CAAE,CAAjC,KAAA,KAAA,EAE7B,MAAM,QACJ,EACA,EACA,EAAmC,EAAE,CACH,CAClC,IAAM,EAAY,IAAI,KAChBC,EAAyC,EAAE,CAEjD,IAAK,GAAM,CAAC,EAAO,KAAW,EAAS,QAAQ,SAAS,CAAE,CAExD,IAAM,EAAS,MAAM,KAAK,cAAc,CACtC,QACA,SACA,UACA,WACA,UACD,CAAC,CACF,EAAc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,6BAA8B,CAAC,CAKxE,IAAK,uBAAwB,CAC3B,IAAM,EAAU,KAAK,KAAK,oBAK1B,OAJK,EAIE,EAAS,UAAW,CAAE,OADd,MAAM,EAAQ,oBAAoB,EAAS,EAAU,EAAO,CACtC,CAAC,CAH7B,EAAS,UAAW,CAAE,OAAQ,+BAAgC,CAAC,CAK1E,QACE,OAAO,EAAS,UAAW,CAAE,OAAQ,iBAAkB,CAAC,QAGrD,EAAO,CACd,OAAO,EAAS,SAAU,CACxB,MAAO,aAAiB,MAAQ,EAAY,MAAM,OAAO,EAAM,CAAC,CACjE,CAAC,IAKR,SAAS,EAAgB,EAA2E,CAWlG,OAVI,EAAc,KAAM,GAAW,EAAO,SAAW,SAAS,CACrD,SAEL,EAAc,KAAM,GAAW,EAAO,SAAW,UAAU,EAC3D,EAAc,KAAM,GAAW,EAAO,SAAW,UAAU,EAG3D,EAAc,MAAO,GAAW,EAAO,SAAW,UAAU,CACvD,UAEF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","names":["options: RegeneratorOptions","proposals: SpecChangeProposal[]","envelopes: RegeneratorSignal[]","delay"],"sources":["../../src/regenerator/service.ts"],"sourcesContent":["import { setTimeout as delay } from 'node:timers/promises';\nimport type {\n ProposalSink,\n RegeneratorSignal,\n RegenerationRule,\n RegenerationContext,\n SpecChangeProposal,\n} from './types';\nimport type { SignalAdapters } from './adapters';\nimport { telemetryToEnvelope, errorToEnvelope, behaviorToEnvelope } from './utils';\n\nexport interface RegeneratorOptions {\n contexts: RegenerationContext[];\n adapters: SignalAdapters;\n rules: RegenerationRule[];\n sink: ProposalSink;\n pollIntervalMs?: number;\n batchDurationMs?: number;\n clock?: () => Date;\n}\n\nconst DEFAULT_POLL_INTERVAL = 60_000;\nconst DEFAULT_BATCH_DURATION = 5 * 60_000;\n\nexport class RegeneratorService {\n private readonly contexts: Map<string, RegenerationContext>;\n private readonly lastPoll = new Map<string, Date>();\n private timer?: NodeJS.Timeout;\n private running = false;\n private readonly pollInterval: number;\n private readonly batchDuration: number;\n private readonly clock: () => Date;\n\n constructor(private readonly options: RegeneratorOptions) {\n this.contexts = new Map(\n options.contexts.map((ctx) => [ctx.id, ctx])\n );\n this.pollInterval = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL;\n this.batchDuration = options.batchDurationMs ?? DEFAULT_BATCH_DURATION;\n this.clock = options.clock ?? (() => new Date());\n if (this.options.rules.length === 0) {\n throw new Error('RegeneratorService requires at least one rule');\n }\n }\n\n start() {\n if (this.running) return;\n this.running = true;\n void this.tick();\n this.timer = setInterval(() => {\n void this.tick();\n }, this.pollInterval);\n }\n\n stop() {\n if (!this.running) return;\n this.running = false;\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = undefined;\n }\n }\n\n async runOnce(): Promise<void> {\n await this.tick();\n }\n\n private async tick(): Promise<void> {\n const now = this.clock();\n const sinceDefault = new Date(now.getTime() - this.batchDuration);\n for (const context of this.contexts.values()) {\n const last = this.lastPoll.get(context.id) ?? sinceDefault;\n await this.evaluateContext(context, last, now);\n this.lastPoll.set(context.id, now);\n }\n }\n\n private async evaluateContext(\n context: RegenerationContext,\n since: Date,\n until: Date\n ): Promise<void> {\n const signals = await this.collectSignals(context, since, until);\n if (signals.length === 0) return;\n\n for (const rule of this.options.rules) {\n let proposals: SpecChangeProposal[] = [];\n try {\n proposals = await rule.evaluate(context, signals);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\n `[regenerator] rule ${rule.id} failed`,\n error instanceof Error ? error : new Error(String(error))\n );\n continue;\n }\n await this.flushProposals(context, proposals);\n }\n }\n\n private async collectSignals(\n context: RegenerationContext,\n since: Date,\n until: Date\n ): Promise<RegeneratorSignal[]> {\n const envelopes: RegeneratorSignal[] = [];\n const { adapters } = this.options;\n if (adapters.telemetry) {\n const telemetrySignals = await adapters.telemetry.pollTelemetry(\n context,\n since,\n until\n );\n envelopes.push(\n ...telemetrySignals.map((signal) =>\n telemetryToEnvelope(context.id, signal, this.clock)\n )\n );\n }\n if (adapters.errors) {\n const errorSignals = await adapters.errors.pollErrors(\n context,\n since,\n until\n );\n envelopes.push(\n ...errorSignals.map((signal) =>\n errorToEnvelope(context.id, signal, this.clock)\n )\n );\n }\n if (adapters.behavior) {\n const behaviorSignals = await adapters.behavior.pollBehavior(\n context,\n since,\n until\n );\n envelopes.push(\n ...behaviorSignals.map((signal) =>\n behaviorToEnvelope(context.id, signal, this.clock)\n )\n );\n }\n return envelopes;\n }\n\n private async flushProposals(\n context: RegenerationContext,\n proposals: SpecChangeProposal[]\n ): Promise<void> {\n for (const proposal of proposals) {\n if (proposal.signalIds.length === 0) continue;\n await this.options.sink.submit(context, proposal);\n // allow event loop to breathe when large volumes\n if (proposals.length > 10) {\n await delay(0);\n }\n }\n }\n}\n\n\n\n\n"],"mappings":"gJAwBA,IAAa,EAAb,KAAgC,CAC9B,SACA,SAA4B,IAAI,IAChC,MACA,QAAkB,GAClB,aACA,cACA,MAEA,YAAY,EAA8C,CAOxD,GAP2B,KAAA,QAAA,EAC3B,KAAK,SAAW,IAAI,IAClB,EAAQ,SAAS,IAAK,GAAQ,CAAC,EAAI,GAAI,EAAI,CAAC,CAC7C,CACD,KAAK,aAAe,EAAQ,gBAAkB,IAC9C,KAAK,cAAgB,EAAQ,iBAAmB,IAChD,KAAK,MAAQ,EAAQ,YAAgB,IAAI,MACrC,KAAK,QAAQ,MAAM,SAAW,EAChC,MAAU,MAAM,gDAAgD,CAIpE,OAAQ,CACF,KAAK,UACT,KAAK,QAAU,GACV,KAAK,MAAM,CAChB,KAAK,MAAQ,gBAAkB,CACxB,KAAK,MAAM,EACf,KAAK,aAAa,EAGvB,MAAO,CACA,KAAK,UACV,KAAK,QAAU,GACf,AAEE,KAAK,SADL,cAAc,KAAK,MAAM,CACZ,IAAA,KAIjB,MAAM,SAAyB,CAC7B,MAAM,KAAK,MAAM,CAGnB,MAAc,MAAsB,CAClC,IAAM,EAAM,KAAK,OAAO,CAClB,EAAe,IAAI,KA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AO,EAGT,MAAc,eACZ,EACA,EACe,CACf,IAAK,IAAM,KAAY,EACjB,EAAS,UAAU,SAAW,IAClC,MAAM,KAAK,QAAQ,KAAK,OAAO,EAAS,EAAS,CAE7C,EAAU,OAAS,IACrB,MAAMC,EAAM,EAAE"}
|
|
1
|
+
{"version":3,"file":"service.js","names":["options: RegeneratorOptions","proposals: SpecChangeProposal[]","envelopes: RegeneratorSignal[]","delay"],"sources":["../../src/regenerator/service.ts"],"sourcesContent":["import { setTimeout as delay } from 'node:timers/promises';\nimport type {\n ProposalSink,\n RegeneratorSignal,\n RegenerationRule,\n RegenerationContext,\n SpecChangeProposal,\n} from './types';\nimport type { SignalAdapters } from './adapters';\nimport { telemetryToEnvelope, errorToEnvelope, behaviorToEnvelope } from './utils';\n\nexport interface RegeneratorOptions {\n contexts: RegenerationContext[];\n adapters: SignalAdapters;\n rules: RegenerationRule[];\n sink: ProposalSink;\n pollIntervalMs?: number;\n batchDurationMs?: number;\n clock?: () => Date;\n}\n\nconst DEFAULT_POLL_INTERVAL = 60_000;\nconst DEFAULT_BATCH_DURATION = 5 * 60_000;\n\nexport class RegeneratorService {\n private readonly contexts: Map<string, RegenerationContext>;\n private readonly lastPoll = new Map<string, Date>();\n private timer?: NodeJS.Timeout;\n private running = false;\n private readonly pollInterval: number;\n private readonly batchDuration: number;\n private readonly clock: () => Date;\n\n constructor(private readonly options: RegeneratorOptions) {\n this.contexts = new Map(\n options.contexts.map((ctx) => [ctx.id, ctx])\n );\n this.pollInterval = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL;\n this.batchDuration = options.batchDurationMs ?? DEFAULT_BATCH_DURATION;\n this.clock = options.clock ?? (() => new Date());\n if (this.options.rules.length === 0) {\n throw new Error('RegeneratorService requires at least one rule');\n }\n }\n\n start() {\n if (this.running) return;\n this.running = true;\n void this.tick();\n this.timer = setInterval(() => {\n void this.tick();\n }, this.pollInterval);\n }\n\n stop() {\n if (!this.running) return;\n this.running = false;\n if (this.timer) {\n clearInterval(this.timer);\n this.timer = undefined;\n }\n }\n\n async runOnce(): Promise<void> {\n await this.tick();\n }\n\n private async tick(): Promise<void> {\n const now = this.clock();\n const sinceDefault = new Date(now.getTime() - this.batchDuration);\n for (const context of this.contexts.values()) {\n const last = this.lastPoll.get(context.id) ?? sinceDefault;\n await this.evaluateContext(context, last, now);\n this.lastPoll.set(context.id, now);\n }\n }\n\n private async evaluateContext(\n context: RegenerationContext,\n since: Date,\n until: Date\n ): Promise<void> {\n const signals = await this.collectSignals(context, since, until);\n if (signals.length === 0) return;\n\n for (const rule of this.options.rules) {\n let proposals: SpecChangeProposal[] = [];\n try {\n proposals = await rule.evaluate(context, signals);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\n `[regenerator] rule ${rule.id} failed`,\n error instanceof Error ? error : new Error(String(error))\n );\n continue;\n }\n await this.flushProposals(context, proposals);\n }\n }\n\n private async collectSignals(\n context: RegenerationContext,\n since: Date,\n until: Date\n ): Promise<RegeneratorSignal[]> {\n const envelopes: RegeneratorSignal[] = [];\n const { adapters } = this.options;\n if (adapters.telemetry) {\n const telemetrySignals = await adapters.telemetry.pollTelemetry(\n context,\n since,\n until\n );\n envelopes.push(\n ...telemetrySignals.map((signal) =>\n telemetryToEnvelope(context.id, signal, this.clock)\n )\n );\n }\n if (adapters.errors) {\n const errorSignals = await adapters.errors.pollErrors(\n context,\n since,\n until\n );\n envelopes.push(\n ...errorSignals.map((signal) =>\n errorToEnvelope(context.id, signal, this.clock)\n )\n );\n }\n if (adapters.behavior) {\n const behaviorSignals = await adapters.behavior.pollBehavior(\n context,\n since,\n until\n );\n envelopes.push(\n ...behaviorSignals.map((signal) =>\n behaviorToEnvelope(context.id, signal, this.clock)\n )\n );\n }\n return envelopes;\n }\n\n private async flushProposals(\n context: RegenerationContext,\n proposals: SpecChangeProposal[]\n ): Promise<void> {\n for (const proposal of proposals) {\n if (proposal.signalIds.length === 0) continue;\n await this.options.sink.submit(context, proposal);\n // allow event loop to breathe when large volumes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AK,SAAS,EAAS,EAAQ,OAC1C,EAAO,CAEd,QAAQ,MACN,sBAAsB,EAAK,GAAG,SAC9B,aAAiB,MAAQ,EAAY,MAAM,OAAO,EAAM,CAAC,CAC1D,CACD,SAEF,MAAM,KAAK,eAAe,EAAS,EAAU,EAIjD,MAAc,eACZ,EACA,EACA,EAC8B,CAC9B,IAAMC,EAAiC,EAAE,CACnC,CAAE,YAAa,KAAK,QAC1B,GAAI,EAAS,UAAW,CACtB,IAAM,EAAmB,MAAM,EAAS,UAAU,cAChD,EACA,EACA,EACD,CACD,EAAU,KACR,GAAG,EAAiB,IAAK,GACvB,EAAoB,EAAQ,GAAI,EAAQ,KAAK,MAAM,CACpD,CACF,CAEH,GAAI,EAAS,OAAQ,CACnB,IAAM,EAAe,MAAM,EAAS,OAAO,WACzC,EACA,EACA,EACD,CACD,EAAU,KACR,GAAG,EAAa,IAAK,GACnB,EAAgB,EAAQ,GAAI,EAAQ,KAAK,MAAM,CAChD,CACF,CAEH,GAAI,EAAS,SAAU,CACrB,IAAM,EAAkB,MAAM,EAAS,SAAS,aAC9C,EACA,EACA,EACD,CACD,EAAU,KACR,GAAG,EAAgB,IAAK,GACtB,EAAmB,EAAQ,GAAI,EAAQ,KAAK,MAAM,CACnD,CACF,CAEH,OAAO,EAGT,MAAc,eACZ,EACA,EACe,CACf,IAAK,IAAM,KAAY,EACjB,EAAS,UAAU,SAAW,IAClC,MAAM,KAAK,QAAQ,KAAK,OAAO,EAAS,EAAS,CAE7C,EAAU,OAAS,IACrB,MAAMC,EAAM,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sinks.js","names":["executor: ProposalExecutor","options: ExecutorSinkOptions"],"sources":["../../src/regenerator/sinks.ts"],"sourcesContent":["import type { ProposalSink, RegenerationContext, SpecChangeProposal } from './types';\nimport { ProposalExecutor } from './executor';\nimport type { ProposalExecutionResult } from './executor';\n\nexport interface ExecutorResultPayload {\n context: RegenerationContext;\n proposal: SpecChangeProposal;\n result: ProposalExecutionResult;\n}\n\nexport interface ExecutorSinkLogger {\n info?: (message: string, meta?: Record<string, unknown>) => void;\n error?: (message: string, error: Error, meta?: Record<string, unknown>) => void;\n}\n\nexport interface ExecutorSinkOptions {\n dryRun?: boolean;\n onResult?: (payload: ExecutorResultPayload) => void | Promise<void>;\n logger?: ExecutorSinkLogger;\n}\n\nexport class ExecutorProposalSink implements ProposalSink {\n constructor(\n private readonly executor: ProposalExecutor,\n private readonly options: ExecutorSinkOptions = {}\n ) {}\n\n async submit(\n context: RegenerationContext,\n proposal: SpecChangeProposal\n ): Promise<void> {\n const dryRun = this.options.dryRun ?? false;\n try {\n const result = await this.executor.execute(context, proposal, { dryRun });\n if (this.options.logger?.info) {\n this.options.logger.info('[regenerator] proposal executed', {\n proposalId: proposal.id,\n contextId: context.id,\n status: result.status,\n });\n }\n if (this.options.onResult) {\n await this.options.onResult({ context, proposal, result });\n }\n } catch (error) {\n if (this.options.logger?.error) {\n this.options.logger.error(\n '[regenerator] proposal execution failed',\n error instanceof Error ? error : new Error(String(error)),\n { proposalId: proposal.id, contextId: context.id }\n );\n }\n throw error instanceof Error ? error : new Error(String(error));\n }\n }\n}\n\n\n\n\n"],"mappings":"AAqBA,IAAa,EAAb,KAA0D,CACxD,YACE,EACA,EAAgD,EAAE,CAClD,CAFiB,KAAA,SAAA,EACA,KAAA,QAAA,EAGnB,MAAM,OACJ,EACA,EACe,CACf,IAAM,EAAS,KAAK,QAAQ,QAAU,GACtC,GAAI,CACF,IAAM,EAAS,MAAM,KAAK,SAAS,QAAQ,EAAS,EAAU,CAAE,SAAQ,CAAC,CACrE,KAAK,QAAQ,QAAQ,MACvB,KAAK,QAAQ,OAAO,KAAK,kCAAmC,CAC1D,WAAY,EAAS,GACrB,UAAW,EAAQ,GACnB,OAAQ,EAAO,OAChB,CAAC,CAEA,KAAK,QAAQ,UACf,MAAM,KAAK,QAAQ,SAAS,CAAE,UAAS,WAAU,SAAQ,CAAC,OAErD,EAAO,CAQd,MAPI,KAAK,QAAQ,QAAQ,OACvB,KAAK,QAAQ,OAAO,MAClB,0CACA,aAAiB,MAAQ,EAAY,MAAM,OAAO,EAAM,CAAC,CACzD,CAAE,WAAY,EAAS,GAAI,UAAW,EAAQ,GAAI,CACnD,CAEG,aAAiB,MAAQ,EAAY,MAAM,OAAO,EAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"sinks.js","names":["executor: ProposalExecutor","options: ExecutorSinkOptions"],"sources":["../../src/regenerator/sinks.ts"],"sourcesContent":["import type { ProposalSink, RegenerationContext, SpecChangeProposal } from './types';\nimport { ProposalExecutor } from './executor';\nimport type { ProposalExecutionResult } from './executor';\n\nexport interface ExecutorResultPayload {\n context: RegenerationContext;\n proposal: SpecChangeProposal;\n result: ProposalExecutionResult;\n}\n\nexport interface ExecutorSinkLogger {\n info?: (message: string, meta?: Record<string, unknown>) => void;\n error?: (message: string, error: Error, meta?: Record<string, unknown>) => void;\n}\n\nexport interface ExecutorSinkOptions {\n dryRun?: boolean;\n onResult?: (payload: ExecutorResultPayload) => void | Promise<void>;\n logger?: ExecutorSinkLogger;\n}\n\nexport class ExecutorProposalSink implements ProposalSink {\n constructor(\n private readonly executor: ProposalExecutor,\n private readonly options: ExecutorSinkOptions = {}\n ) {}\n\n async submit(\n context: RegenerationContext,\n proposal: SpecChangeProposal\n ): Promise<void> {\n const dryRun = this.options.dryRun ?? false;\n try {\n const result = await this.executor.execute(context, proposal, { dryRun });\n if (this.options.logger?.info) {\n this.options.logger.info('[regenerator] proposal executed', {\n proposalId: proposal.id,\n contextId: context.id,\n status: result.status,\n });\n }\n if (this.options.onResult) {\n await this.options.onResult({ context, proposal, result });\n }\n } catch (error) {\n if (this.options.logger?.error) {\n this.options.logger.error(\n '[regenerator] proposal execution failed',\n error instanceof Error ? error : new Error(String(error)),\n { proposalId: proposal.id, contextId: context.id }\n );\n }\n throw error instanceof Error ? error : new Error(String(error));\n }\n }\n}\n\n\n\n\n\n\n"],"mappings":"AAqBA,IAAa,EAAb,KAA0D,CACxD,YACE,EACA,EAAgD,EAAE,CAClD,CAFiB,KAAA,SAAA,EACA,KAAA,QAAA,EAGnB,MAAM,OACJ,EACA,EACe,CACf,IAAM,EAAS,KAAK,QAAQ,QAAU,GACtC,GAAI,CACF,IAAM,EAAS,MAAM,KAAK,SAAS,QAAQ,EAAS,EAAU,CAAE,SAAQ,CAAC,CACrE,KAAK,QAAQ,QAAQ,MACvB,KAAK,QAAQ,OAAO,KAAK,kCAAmC,CAC1D,WAAY,EAAS,GACrB,UAAW,EAAQ,GACnB,OAAQ,EAAO,OAChB,CAAC,CAEA,KAAK,QAAQ,UACf,MAAM,KAAK,QAAQ,SAAS,CAAE,UAAS,WAAU,SAAQ,CAAC,OAErD,EAAO,CAQd,MAPI,KAAK,QAAQ,QAAQ,OACvB,KAAK,QAAQ,OAAO,MAClB,0CACA,aAAiB,MAAQ,EAAY,MAAM,OAAO,EAAM,CAAC,CACzD,CAAE,WAAY,EAAS,GAAI,UAAW,EAAQ,GAAI,CACnD,CAEG,aAAiB,MAAQ,EAAY,MAAM,OAAO,EAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../src/regenerator/utils.ts"],"sourcesContent":["import type {\n BehaviorSignal,\n BehaviorSignalEnvelope,\n ErrorSignal,\n ErrorSignalEnvelope,\n TelemetrySignal,\n TelemetrySignalEnvelope,\n} from './types';\n\ntype Clock = () => Date;\n\nexport function telemetryToEnvelope(\n contextId: string,\n signal: TelemetrySignal,\n clock: Clock\n): TelemetrySignalEnvelope {\n return {\n type: 'telemetry',\n contextId,\n signal: normalizeTelemetryDates(signal, clock),\n };\n}\n\nexport function errorToEnvelope(\n contextId: string,\n signal: ErrorSignal,\n clock: Clock\n): ErrorSignalEnvelope {\n return {\n type: 'error',\n contextId,\n signal: normalizeErrorDates(signal, clock),\n };\n}\n\nexport function behaviorToEnvelope(\n contextId: string,\n signal: BehaviorSignal,\n clock: Clock\n): BehaviorSignalEnvelope {\n return {\n type: 'behavior',\n contextId,\n signal: normalizeBehaviorDates(signal, clock),\n };\n}\n\nfunction normalizeTelemetryDates(\n signal: TelemetrySignal,\n clock: Clock\n): TelemetrySignal {\n return {\n ...signal,\n windowStart: toDate(signal.windowStart, clock),\n windowEnd: toDate(signal.windowEnd, clock),\n };\n}\n\nfunction normalizeErrorDates(\n signal: ErrorSignal,\n clock: Clock\n): ErrorSignal {\n return {\n ...signal,\n occurredAt: toDate(signal.occurredAt, clock),\n };\n}\n\nfunction normalizeBehaviorDates(\n signal: BehaviorSignal,\n clock: Clock\n): BehaviorSignal {\n return {\n ...signal,\n windowStart: toDate(signal.windowStart, clock),\n windowEnd: toDate(signal.windowEnd, clock),\n };\n}\n\nfunction toDate(value: Date | string, clock: Clock): Date {\n if (value instanceof Date) return value;\n const parsed = new Date(value);\n if (Number.isNaN(parsed.getTime())) {\n return clock();\n }\n return parsed;\n}\n\n\n\n\n"],"mappings":"AAWA,SAAgB,EACd,EACA,EACA,EACyB,CACzB,MAAO,CACL,KAAM,YACN,YACA,OAAQ,EAAwB,EAAQ,EAAM,CAC/C,CAGH,SAAgB,EACd,EACA,EACA,EACqB,CACrB,MAAO,CACL,KAAM,QACN,YACA,OAAQ,EAAoB,EAAQ,EAAM,CAC3C,CAGH,SAAgB,EACd,EACA,EACA,EACwB,CACxB,MAAO,CACL,KAAM,WACN,YACA,OAAQ,EAAuB,EAAQ,EAAM,CAC9C,CAGH,SAAS,EACP,EACA,EACiB,CACjB,MAAO,CACL,GAAG,EACH,YAAa,EAAO,EAAO,YAAa,EAAM,CAC9C,UAAW,EAAO,EAAO,UAAW,EAAM,CAC3C,CAGH,SAAS,EACP,EACA,EACa,CACb,MAAO,CACL,GAAG,EACH,WAAY,EAAO,EAAO,WAAY,EAAM,CAC7C,CAGH,SAAS,EACP,EACA,EACgB,CAChB,MAAO,CACL,GAAG,EACH,YAAa,EAAO,EAAO,YAAa,EAAM,CAC9C,UAAW,EAAO,EAAO,UAAW,EAAM,CAC3C,CAGH,SAAS,EAAO,EAAsB,EAAoB,CACxD,GAAI,aAAiB,KAAM,OAAO,EAClC,IAAM,EAAS,IAAI,KAAK,EAAM,CAI9B,OAHI,OAAO,MAAM,EAAO,SAAS,CAAC,CACzB,GAAO,CAET"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/regenerator/utils.ts"],"sourcesContent":["import type {\n BehaviorSignal,\n BehaviorSignalEnvelope,\n ErrorSignal,\n ErrorSignalEnvelope,\n TelemetrySignal,\n TelemetrySignalEnvelope,\n} from './types';\n\ntype Clock = () => Date;\n\nexport function telemetryToEnvelope(\n contextId: string,\n signal: TelemetrySignal,\n clock: Clock\n): TelemetrySignalEnvelope {\n return {\n type: 'telemetry',\n contextId,\n signal: normalizeTelemetryDates(signal, clock),\n };\n}\n\nexport function errorToEnvelope(\n contextId: string,\n signal: ErrorSignal,\n clock: Clock\n): ErrorSignalEnvelope {\n return {\n type: 'error',\n contextId,\n signal: normalizeErrorDates(signal, clock),\n };\n}\n\nexport function behaviorToEnvelope(\n contextId: string,\n signal: BehaviorSignal,\n clock: Clock\n): BehaviorSignalEnvelope {\n return {\n type: 'behavior',\n contextId,\n signal: normalizeBehaviorDates(signal, clock),\n };\n}\n\nfunction normalizeTelemetryDates(\n signal: TelemetrySignal,\n clock: Clock\n): TelemetrySignal {\n return {\n ...signal,\n windowStart: toDate(signal.windowStart, clock),\n windowEnd: toDate(signal.windowEnd, clock),\n };\n}\n\nfunction normalizeErrorDates(\n signal: ErrorSignal,\n clock: Clock\n): ErrorSignal {\n return {\n ...signal,\n occurredAt: toDate(signal.occurredAt, clock),\n };\n}\n\nfunction normalizeBehaviorDates(\n signal: BehaviorSignal,\n clock: Clock\n): BehaviorSignal {\n return {\n ...signal,\n windowStart: toDate(signal.windowStart, clock),\n windowEnd: toDate(signal.windowEnd, clock),\n };\n}\n\nfunction toDate(value: Date | string, clock: Clock): Date {\n if (value instanceof Date) return value;\n const parsed = new Date(value);\n if (Number.isNaN(parsed.getTime())) {\n return clock();\n }\n return parsed;\n}\n\n\n\n\n\n\n"],"mappings":"AAWA,SAAgB,EACd,EACA,EACA,EACyB,CACzB,MAAO,CACL,KAAM,YACN,YACA,OAAQ,EAAwB,EAAQ,EAAM,CAC/C,CAGH,SAAgB,EACd,EACA,EACA,EACqB,CACrB,MAAO,CACL,KAAM,QACN,YACA,OAAQ,EAAoB,EAAQ,EAAM,CAC3C,CAGH,SAAgB,EACd,EACA,EACA,EACwB,CACxB,MAAO,CACL,KAAM,WACN,YACA,OAAQ,EAAuB,EAAQ,EAAM,CAC9C,CAGH,SAAS,EACP,EACA,EACiB,CACjB,MAAO,CACL,GAAG,EACH,YAAa,EAAO,EAAO,YAAa,EAAM,CAC9C,UAAW,EAAO,EAAO,UAAW,EAAM,CAC3C,CAGH,SAAS,EACP,EACA,EACa,CACb,MAAO,CACL,GAAG,EACH,WAAY,EAAO,EAAO,WAAY,EAAM,CAC7C,CAGH,SAAS,EACP,EACA,EACgB,CAChB,MAAO,CACL,GAAG,EACH,YAAa,EAAO,EAAO,YAAa,EAAM,CAC9C,UAAW,EAAO,EAAO,UAAW,EAAM,CAC3C,CAGH,SAAS,EAAO,EAAsB,EAAoB,CACxD,GAAI,aAAiB,KAAM,OAAO,EAClC,IAAM,EAAS,IAAI,KAAK,EAAM,CAI9B,OAHI,OAAO,MAAM,EAAO,SAAS,CAAC,CACzB,GAAO,CAET"}
|
package/dist/registry.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ResourceRefDescriptor } from "./resources.js";
|
|
|
2
2
|
import { ContractSpec } from "./spec.js";
|
|
3
3
|
import { HandlerCtx } from "./types.js";
|
|
4
4
|
import { HandlerFor } from "./install.js";
|
|
5
|
-
import { AnySchemaModel } from "@lssm/lib.schema";
|
|
6
5
|
|
|
7
6
|
//#region src/registry.d.ts
|
|
8
7
|
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","names":[],"sources":["../src/registry.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","names":[],"sources":["../src/registry.ts"],"sourcesContent":[],"mappings":";;;;;;;AAqB2B,KANf,YAAA,GAMe,GAAA,MAAA,KAAA,MAAA,EAAA;AAItB,iBARW,KAAA,CAQmB,IAAA,EAAA,MAAe,EAAA,OAAO,EAAA,MAAA,CAAA,EARH,YAQG;AAMzD,KAVK,OAAA,GAAU,YAUU,CATvB,cASuB,EARvB,cAQuB,GARN,qBAQM,CAAA,OAAA,CAAA,CAAA;KANpB,UAAA,GAYS,CAAA,IAAA,EAAA,GAAA,EAAA,GAAA,EAZqB,UAYrB,EAAA,GAZoC,OAYpC,CAAA,OAAA,CAAA;;;;;AAEJ,cARG,YAAA,CAQH;EASI,QAAA,KAAA;EACA,QAAA,QAAA;EAAiB;EACR,QAAA,CAAA,UAbT,cAaS,EAAA,UAZT,cAYS,GAZQ,qBAYR,CAAA,OAAA,CAAA,CAAA,CAAA,IAAA,EAXb,YAWa,CAXA,CAWA,EAXG,CAWH,CAAA,CAAA,EAAA,IAAA;EAAG;EAAhB,IAAA,CAAA,UAFI,cAEJ,EAAA,UADI,cACJ,GADqB,qBACrB,CAAA,OAAA,CAAA,CAAA,CAAA,IAAA,EAAA,YAAA,CAAa,CAAb,EAAgB,CAAhB,CAAA,EAAA,OAAA,EAA6B,UAA7B,CAAwC,YAAxC,CAAqD,CAArD,EAAwD,CAAxD,CAAA,CAAA,CAAA,EAAA,IAAA;EAAqD;EAAG,OAAA,CAAA,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAYvB,OAZuB,GAAA,SAAA;EAAhB;EAAX,UAAA,CAAA,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EA4BO,UA5BP,GAAA,SAAA;EAYI;EAgBG,SAAA,CAAA,CAAA,EAO/B,OAP+B,EAAA;EAO/B;EAKQ,SAAA,CAAA,CAAA,EAAA;IAAkB,IAAA,EAAlB,OAAkB;IAoBhC,OAAA,EApBgC,UAoBhC;EACJ,CAAA,EAAA;EAAO;;;;;;;6EADH,aACJ"}
|
package/dist/resources.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","names":[],"sources":["../src/resources.ts"],"sourcesContent":[],"mappings":";;;;UAGiB,YAAA;;EAAA,WAAA,EAAA,MAAY;EAaZ;EAAiC,KAAA,EAAA,MAAA;EAC1C;EAEC,WAAA,CAAA,EAAA,MAAA;EAMS;EAAN,QAAA,EAAA,MAAA;EAE2C;EAAhD,IAAA,CAAA,EAdE,GAcF,EAAA;;AAGS,UAdC,oBAcqB,CAAA,UAdU,CAAA,CAAE,OAcZ,CAAA,CAAA;EAAa,IAAA,EAb3C,YAa2C;EACtB;EAArB,KAAA,EAZC,CAYD;EACgB;;;AAIxB;EAGuB,OAAA,EAAA,CAAA,IAAA,EAdb,CAAA,CAAE,KAcW,CAdL,CAcK,CAAA,EAAA,GAAA,EAAA;IAAoC,MAAA,CAAA,EAAA,MAAA,GAAA,IAAA;IAArB,KAAA,CAAA,EAAA,MAAA,GAAA,IAAA;IAKvB,MAAA,CAAA,EAAA,MAAA;EASD,CAAA,EAAA,GA1BP,OA0BO,CAAA;IAAmC,GAAA,EAAA,MAAA;IAAM,QAAA,CAAA,EAAA,MAAA;IAoBtC,IAAA,EA9CsC,UA8CtC,GAAA,MAAqB;EAYtB,CAAA,CAAA;;AAGS,iBA1DT,sBA0DS,CAAA,UA1DwB,CAAA,CAAE,OA0D1B,CAAA,CAAA,IAAA,EAzDjB,oBAyDiB,CAzDI,CAyDJ,CAAA,CAAA,EAxDtB,oBAwDsB,CAxDD,CAwDC,CAAA;AAAtB,cApDU,gBAAA,CAoDV;EAAqB,QAAA,SAAA;EAUR,QAAA,CAAA,UA3DK,CAAA,CAAE,
|
|
1
|
+
{"version":3,"file":"resources.d.ts","names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Kind as n}from"graphql";var r=class extends t{zodSchema;jsonSchemaDef;constructor(e){super(e),this.zodSchema=e.zod,this.jsonSchemaDef=e.jsonSchema}getZod(){return this.zodSchema}getPothos(){return this}getJson(){return typeof this.jsonSchemaDef==`function`?this.jsonSchemaDef():this.jsonSchemaDef}getJsonSchemaDef(){return this.jsonSchemaDef}getJsonSchema(){let e=t=>{let n=typeof t==`function`?t():t;if(Array.isArray(n))return n.map(t=>e(t));if(n&&typeof n==`object`){let t={};for(let[r,i]of Object.entries(n))t[r]=e(i);return t}return n};return e(this.getJson())}};export{r};
|
|
1
|
+
import{z as e}from"zod";import{GraphQLScalarType as t,Kind as n}from"graphql";var r=class extends t{zodSchema;jsonSchemaDef;constructor(e){super(e),this.zodSchema=e.zod,this.jsonSchemaDef=e.jsonSchema}getZod(){return this.zodSchema}getPothos(){return this}getJson(){return typeof this.jsonSchemaDef==`function`?this.jsonSchemaDef():this.jsonSchemaDef}getJsonSchemaDef(){return this.jsonSchemaDef}getJsonSchema(){let e=t=>{let n=typeof t==`function`?t():t;if(Array.isArray(n))return n.map(t=>e(t));if(n&&typeof n==`object`){let t={};for(let[r,i]of Object.entries(n))t[r]=e(i);return t}return n};return e(this.getJson())}};export{r as FieldType};
|
|
2
2
|
//# sourceMappingURL=FieldType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldType.js","names":["obj: Record<string, unknown>"],"sources":["../../../../schema/src/FieldType.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n GraphQLScalarType,\n type GraphQLScalarTypeConfig,\n Kind,\n type ValueNode,\n} from 'graphql';\n\nexport interface FieldTypeConfig<TInternal, TExternal = TInternal>\n extends GraphQLScalarTypeConfig<TInternal, TExternal> {\n zod: z.ZodType<TInternal>;\n jsonSchema: unknown | (() => unknown);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyFieldType = FieldType<any, any>;\n\n/**\n * GraphQL scalar wrapper that carries zod and JSON Schema metadata.\n *\n * TInternal is the runtime representation; TExternal is the GraphQL output.\n */\nexport class FieldType<\n TInternal,\n TExternal = TInternal,\n> extends GraphQLScalarType<TInternal, TExternal> {\n private zodSchema: z.ZodType<TInternal>;\n private readonly jsonSchemaDef?: unknown | (() => unknown);\n\n constructor(config: FieldTypeConfig<TInternal, TExternal>) {\n super(config);\n this.zodSchema = config.zod;\n this.jsonSchemaDef = config.jsonSchema;\n }\n\n /** Return the attached zod schema for validation. */\n getZod(): z.ZodType<TInternal> {\n return this.zodSchema;\n }\n\n /** GraphQL scalar instance usable by Pothos or vanilla GraphQL. */\n getPothos(): GraphQLScalarType<TInternal, TExternal> {\n return this;\n }\n\n /** Return the JSON Schema (evaluates factory if provided). */\n getJson(): unknown {\n return typeof this.jsonSchemaDef === 'function'\n ? (this.jsonSchemaDef as () => unknown)()\n : this.jsonSchemaDef;\n }\n\n // Return the raw jsonSchema config (value or factory)\n getJsonSchemaDef(): unknown | (() => unknown) {\n return this.jsonSchemaDef;\n }\n\n // Return a deep-resolved JSON Schema (evaluates factory and nested factories)\n getJsonSchema(): unknown {\n const deepResolve = (v: unknown): unknown => {\n const value = typeof v === 'function' ? (v as () => unknown)() : v;\n if (Array.isArray(value)) return value.map((item) => deepResolve(item));\n if (value && typeof value === 'object') {\n const obj: Record<string, unknown> = {};\n for (const [k, val] of Object.entries(\n value as Record<string, unknown>\n )) {\n obj[k] = deepResolve(val);\n }\n return obj;\n }\n return value;\n };\n return deepResolve(this.getJson());\n }\n}\n\nexport type ZodFieldType<Field extends AnyFieldType> = z.infer<\n ReturnType<Field['getZod']>\n>;\n"],"mappings":"8EAsBA,IAAa,EAAb,cAGU,CAAwC,CAChD,UACA,cAEA,YAAY,EAA+C,CACzD,MAAM,EAAO,CACb,KAAK,UAAY,EAAO,IACxB,KAAK,cAAgB,EAAO,WAI9B,QAA+B,CAC7B,OAAO,KAAK,UAId,WAAqD,CACnD,OAAO,KAIT,SAAmB,CACjB,OAAO,OAAO,KAAK,eAAkB,WAChC,KAAK,eAAiC,CACvC,KAAK,cAIX,kBAA8C,CAC5C,OAAO,KAAK,cAId,eAAyB,CACvB,IAAM,EAAe,GAAwB,CAC3C,IAAM,EAAQ,OAAO,GAAM,WAAc,GAAqB,CAAG,EACjE,GAAI,MAAM,QAAQ,EAAM,CAAE,OAAO,EAAM,IAAK,GAAS,EAAY,EAAK,CAAC,CACvE,GAAI,GAAS,OAAO,GAAU,SAAU,CACtC,IAAMA,EAA+B,EAAE,CACvC,IAAK,GAAM,CAAC,EAAG,KAAQ,OAAO,QAC5B,EACD,CACC,EAAI,GAAK,EAAY,EAAI,CAE3B,OAAO,EAET,OAAO,GAET,OAAO,EAAY,KAAK,SAAS,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{FieldType as e}from"./FieldType.js";import{z as t}from"zod";import{Kind as n}from"graphql";const r=/^[A-Za-z]{2}(?:-[A-Za-z0-9]{2,8})*$/,i=/^(?:UTC|[A-Za-z_]+\/[A-Za-z_]+)$/,a=/^[+]?\d[\d\s().-]{3,}$/,o=/^[A-Z]{3}$/,s=/^[A-Z]{2}$/,c=-180,l={String_unsecure:()=>new e({name:`String_unsecure`,description:`Unvalidated string scalar`,zod:t.string(),parseValue:e=>t.string().parse(e),serialize:e=>String(e),parseLiteral:e=>{if(e.kind!==n.STRING)throw TypeError(`Invalid literal`);return e.value},jsonSchema:{type:`string`}}),Int_unsecure:()=>new e({name:`Int_unsecure`,description:`Unvalidated integer scalar`,zod:t.number().int(),parseValue:e=>{let n=typeof e==`number`?e:Number(e);return t.number().int().parse(n)},serialize:e=>Math.trunc(typeof e==`number`?e:Number(e)),parseLiteral:e=>{if(e.kind!==n.INT)throw TypeError(`Invalid literal`);return Number(e.value)},jsonSchema:{type:`integer`}}),Float_unsecure:()=>new e({name:`Float_unsecure`,description:`Unvalidated float scalar`,zod:t.number(),parseValue:e=>{let n=typeof e==`number`?e:Number(e);return t.number().parse(n)},serialize:e=>Number(e),parseLiteral:e=>{if(e.kind!==n.FLOAT&&e.kind!==n.INT)throw TypeError(`Invalid literal`);return Number(e.value)},jsonSchema:{type:`number`}}),Boolean:()=>new e({name:`Boolean`,description:`Unvalidated boolean scalar`,zod:t.boolean(),parseValue:e=>t.coerce.boolean().parse(e),serialize:e=>!!e,parseLiteral:e=>{if(e.kind!==n.BOOLEAN)throw TypeError(`Invalid literal`);return e.value},jsonSchema:{type:`boolean`}}),ID:()=>new e({name:`ID`,description:`Unvalidated id scalar`,zod:t.string(),parseValue:e=>t.string().parse(e),serialize:e=>String(e),parseLiteral:e=>{if(e.kind!==n.STRING)throw TypeError(`Invalid literal`);return e.value},jsonSchema:{type:`string`}}),JSON:()=>new e({name:`JSON`,zod:t.any(),parseValue:e=>e,serialize:e=>e,jsonSchema:{}}),JSONObject:()=>new e({name:`JSONObject`,zod:t.record(t.string(),t.any()),parseValue:e=>t.record(t.string(),t.any()).parse(e),serialize:e=>e??{},jsonSchema:{type:`object`}}),Date:()=>new e({name:`Date`,zod:t.date(),parseValue:e=>e instanceof Date?e:new Date(String(e)),serialize:e=>e instanceof Date?e.toISOString().split(`T`)[0]:String(e),jsonSchema:{type:`string`,format:`date`}}),DateTime:()=>new e({name:`DateTime`,zod:t.date(),parseValue:e=>e instanceof Date?e:new Date(String(e)),serialize:e=>e instanceof Date?e.toISOString():String(e),jsonSchema:{type:`string`,format:`date-time`}}),Time:()=>new e({name:`Time`,zod:t.string().regex(/^\d{2}:\d{2}(:\d{2})?$/),parseValue:e=>t.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:`^\\d{2}:\\d{2}(:\\d{2})?$`}}),EmailAddress:()=>new e({name:`EmailAddress`,zod:t.string().email(),parseValue:e=>t.string().email().parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,format:`email`}}),URL:()=>new e({name:`URL`,zod:t.string().url(),parseValue:e=>t.string().url().parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,format:`uri`}}),PhoneNumber:()=>new e({name:`PhoneNumber`,zod:t.string().regex(a),parseValue:e=>t.string().regex(a).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:a.source}}),NonEmptyString:()=>new e({name:`NonEmptyString`,zod:t.string().min(1),parseValue:e=>t.string().min(1).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,minLength:1}}),Locale:()=>new e({name:`Locale`,zod:t.string().regex(r),parseValue:e=>t.string().regex(r).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:r.source}}),TimeZone:()=>new e({name:`TimeZone`,zod:t.string().regex(i),parseValue:e=>t.string().regex(i).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:i.source}}),Latitude:()=>new e({name:`Latitude`,zod:t.number().min(-90).max(90),parseValue:e=>t.coerce.number().min(-90).max(90).parse(e),serialize:e=>Number(e),jsonSchema:{type:`number`,minimum:-90,maximum:90}}),Longitude:()=>new e({name:`Longitude`,zod:t.number().min(c).max(180),parseValue:e=>t.coerce.number().min(c).max(180).parse(e),serialize:e=>Number(e),jsonSchema:{type:`number`,minimum:c,maximum:180}}),Currency:()=>new e({name:`Currency`,zod:t.string().regex(o),parseValue:e=>t.string().regex(o).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:o.source}}),CountryCode:()=>new e({name:`CountryCode`,zod:t.string().regex(s),parseValue:e=>t.string().regex(s).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:s.source}})};export{l as ScalarTypeEnum};
|
|
2
|
+
//# sourceMappingURL=ScalarTypeEnum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScalarTypeEnum.js","names":[],"sources":["../../../../schema/src/ScalarTypeEnum.ts"],"sourcesContent":["import { z } from 'zod';\nimport { type GraphQLScalarTypeConfig, Kind, type ValueNode } from 'graphql';\nimport { FieldType } from './FieldType';\n\n// Helpers to build standard scalars\nconst localeRegex = /^[A-Za-z]{2}(?:-[A-Za-z0-9]{2,8})*$/;\nconst timezoneRegex = /^(?:UTC|[A-Za-z_]+\\/[A-Za-z_]+)$/;\nconst phoneRegex = /^[+]?\\d[\\d\\s().-]{3,}$/;\nconst currencyRegex = /^[A-Z]{3}$/;\nconst countryRegex = /^[A-Z]{2}$/;\nconst latMin = -90;\nconst latMax = 90;\nconst lonMin = -180;\nconst lonMax = 180;\n\n/**\n * Factory functions for common scalar FieldTypes with zod/GraphQL/JSON Schema.\n */\nexport const ScalarTypeEnum = {\n // primitives (_unsecure)\n String_unsecure: (): FieldType<string> =>\n new FieldType<string>({\n name: 'String_unsecure',\n description: 'Unvalidated string scalar',\n zod: z.string(),\n parseValue: (v) => z.string().parse(v),\n serialize: (v) => String(v),\n parseLiteral: (ast: ValueNode) => {\n if (ast.kind !== Kind.STRING) throw new TypeError('Invalid literal');\n return ast.value;\n },\n jsonSchema: { type: 'string' },\n }),\n Int_unsecure: (): FieldType<number> =>\n new FieldType<number>({\n name: 'Int_unsecure',\n description: 'Unvalidated integer scalar',\n zod: z.number().int(),\n parseValue: (v) => {\n const num = typeof v === 'number' ? v : Number(v as unknown);\n return z.number().int().parse(num);\n },\n serialize: (v) => Math.trunc(typeof v === 'number' ? v : Number(v)),\n parseLiteral: (ast: ValueNode) => {\n if (ast.kind !== Kind.INT) throw new TypeError('Invalid literal');\n return Number(ast.value);\n },\n jsonSchema: { type: 'integer' },\n }),\n Float_unsecure: (): FieldType<number> =>\n new FieldType<number>({\n name: 'Float_unsecure',\n description: 'Unvalidated float scalar',\n zod: z.number(),\n parseValue: (v) => {\n const num = typeof v === 'number' ? v : Number(v as unknown);\n return z.number().parse(num);\n },\n serialize: (v) => Number(v),\n parseLiteral: (ast: ValueNode) => {\n if (ast.kind !== Kind.FLOAT && ast.kind !== Kind.INT)\n throw new TypeError('Invalid literal');\n return Number(ast.value);\n },\n jsonSchema: { type: 'number' },\n }),\n Boolean: (): FieldType<boolean> =>\n new FieldType<boolean>({\n name: 'Boolean',\n description: 'Unvalidated boolean scalar',\n zod: z.boolean(),\n parseValue: (v) => z.coerce.boolean().parse(v),\n serialize: (v) => Boolean(v),\n parseLiteral: (ast: ValueNode) => {\n if (ast.kind !== Kind.BOOLEAN) throw new TypeError('Invalid literal');\n return ast.value;\n },\n jsonSchema: { type: 'boolean' },\n }),\n ID: (): FieldType<string> =>\n new FieldType<string>({\n name: 'ID',\n description: 'Unvalidated id scalar',\n zod: z.string(),\n parseValue: (v) => z.string().parse(v),\n serialize: (v) => String(v),\n parseLiteral: (ast: ValueNode) => {\n if (ast.kind !== Kind.STRING) throw new TypeError('Invalid literal');\n return ast.value;\n },\n jsonSchema: { type: 'string' },\n }),\n\n // Validated custom scalars\n JSON: (): FieldType<unknown> =>\n new FieldType<unknown>({\n name: 'JSON',\n zod: z.any(),\n parseValue: (v) => v,\n serialize: (v) => v,\n jsonSchema: {},\n }),\n JSONObject: (): FieldType<Record<string, unknown>> =>\n new FieldType<Record<string, unknown>>({\n name: 'JSONObject',\n zod: z.record(z.string(), z.any()),\n parseValue: (v) => z.record(z.string(), z.any()).parse(v),\n serialize: (v) => (v ?? {}) as Record<string, unknown>,\n jsonSchema: { type: 'object' },\n }),\n Date: (): FieldType<Date, string> =>\n new FieldType<Date, string>({\n name: 'Date',\n zod: z.date(),\n parseValue: (v) => (v instanceof Date ? v : new Date(String(v))),\n serialize: (v) =>\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n v instanceof Date ? v.toISOString().split('T')[0]! : String(v),\n jsonSchema: { type: 'string', format: 'date' },\n }),\n DateTime: (): FieldType<Date, string> =>\n new FieldType<Date, string>({\n name: 'DateTime',\n zod: z.date(),\n parseValue: (v) => (v instanceof Date ? v : new Date(String(v))),\n serialize: (v) => {\n return v instanceof Date ? v.toISOString() : String(v);\n },\n jsonSchema: { type: 'string', format: 'date-time' },\n }),\n Time: (): FieldType<string> =>\n new FieldType<string>({\n name: 'Time',\n zod: z.string().regex(/^\\d{2}:\\d{2}(:\\d{2})?$/),\n parseValue: (v) =>\n z\n .string()\n .regex(/^\\d{2}:\\d{2}(:\\d{2})?$/)\n .parse(v),\n serialize: (v) => String(v),\n jsonSchema: { type: 'string', pattern: '^\\\\d{2}:\\\\d{2}(:\\\\d{2})?$' },\n }),\n EmailAddress: (): FieldType<string> =>\n new FieldType<string>({\n name: 'EmailAddress',\n zod: z.string().email(),\n parseValue: (v) => z.string().email().parse(v),\n serialize: (v) => String(v),\n jsonSchema: { type: 'string', format: 'email' },\n }),\n URL: (): FieldType<string> =>\n new FieldType<string>({\n name: 'URL',\n zod: z.string().url(),\n parseValue: (v) => z.string().url().parse(v),\n serialize: (v) => String(v),\n jsonSchema: { type: 'string', format: 'uri' },\n }),\n PhoneNumber: (): FieldType<string> =>\n new FieldType<string>({\n name: 'PhoneNumber',\n zod: z.string().regex(phoneRegex),\n parseValue: (v) => z.string().regex(phoneRegex).parse(v),\n serialize: (v) => String(v),\n jsonSchema: { type: 'string', pattern: phoneRegex.source },\n }),\n NonEmptyString: (): FieldType<string> =>\n new FieldType<string>({\n name: 'NonEmptyString',\n zod: z.string().min(1),\n parseValue: (v) => z.string().min(1).parse(v),\n serialize: (v) => String(v),\n jsonSchema: { type: 'string', minLength: 1 },\n }),\n Locale: (): FieldType<string> =>\n new FieldType<string>({\n name: 'Locale',\n zod: z.string().regex(localeRegex),\n parseValue: (v) => z.string().regex(localeRegex).parse(v),\n serialize: (v) => String(v),\n jsonSchema: { type: 'string', pattern: localeRegex.source },\n }),\n TimeZone: (): FieldType<string> =>\n new FieldType<string>({\n name: 'TimeZone',\n zod: z.string().regex(timezoneRegex),\n parseValue: (v) => z.string().regex(timezoneRegex).parse(v),\n serialize: (v) => String(v),\n jsonSchema: { type: 'string', pattern: timezoneRegex.source },\n }),\n Latitude: (): FieldType<number> =>\n new FieldType<number>({\n name: 'Latitude',\n zod: z.number().min(latMin).max(latMax),\n parseValue: (v) => z.coerce.number().min(latMin).max(latMax).parse(v),\n serialize: (v) => Number(v),\n jsonSchema: { type: 'number', minimum: latMin, maximum: latMax },\n }),\n Longitude: (): FieldType<number> =>\n new FieldType<number>({\n name: 'Longitude',\n zod: z.number().min(lonMin).max(lonMax),\n parseValue: (v) => z.coerce.number().min(lonMin).max(lonMax).parse(v),\n serialize: (v) => Number(v),\n jsonSchema: { type: 'number', minimum: lonMin, maximum: lonMax },\n }),\n Currency: (): FieldType<string> =>\n new FieldType<string>({\n name: 'Currency',\n zod: z.string().regex(currencyRegex),\n parseValue: (v) => z.string().regex(currencyRegex).parse(v),\n serialize: (v) => String(v),\n jsonSchema: { type: 'string', pattern: currencyRegex.source },\n }),\n CountryCode: (): FieldType<string> =>\n new FieldType<string>({\n name: 'CountryCode',\n zod: z.string().regex(countryRegex),\n parseValue: (v) => z.string().regex(countryRegex).parse(v),\n serialize: (v) => String(v),\n jsonSchema: { type: 'string', pattern: countryRegex.source },\n }),\n // GeoJSON: (): FieldType<Record<string, unknown>, Record<string, unknown>> =>\n // new FieldType<Record<string, unknown>, Record<string, unknown>>({\n // name: 'GeoJSON',\n // zod: z.object({ type: z.string(), coordinates: z.any() }).passthrough(),\n // parseValue: (v) =>\n // z\n // .object({ type: z.string(), coordinates: z.any() })\n // .passthrough()\n // .parse(v),\n // serialize: (v) => v,\n // jsonSchema: { type: 'object' },\n // }),\n} as const;\nexport type ScalarTypeEnum = [keyof typeof ScalarTypeEnum];\n"],"mappings":"kGAKA,MAAM,EAAc,sCACd,EAAgB,mCAChB,EAAa,yBACb,EAAgB,aAChB,EAAe,aAGf,EAAS,KAMF,EAAiB,CAE5B,oBACE,IAAI,EAAkB,CACpB,KAAM,kBACN,YAAa,4BACb,IAAK,EAAE,QAAQ,CACf,WAAa,GAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CACtC,UAAY,GAAM,OAAO,EAAE,CAC3B,aAAe,GAAmB,CAChC,GAAI,EAAI,OAAS,EAAK,OAAQ,MAAU,UAAU,kBAAkB,CACpE,OAAO,EAAI,OAEb,WAAY,CAAE,KAAM,SAAU,CAC/B,CAAC,CAC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AAE,CAC3B,WAAY,CAAE,KAAM,SAAU,QAAS,EAAa,OAAQ,CAC7D,CAAC,CAaL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./
|
|
1
|
+
import"./FieldType.js";import"./EnumType.js";import{z as e}from"zod";var t=class{constructor(e){this.config=e}getZod(){let t=Object.entries(this.config.fields).reduce((t,[n,r])=>{let i=r.type.getZod(),a=r.isArray?e.array(i):i;return t[n]=r.isOptional?a.optional():a,t},{});return e.object(t)}getPothosInput(){return this.config.name}};export{t as SchemaModel};
|
|
2
2
|
//# sourceMappingURL=SchemaModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaModel.js","names":["config: SchemaModelConfig<Fields>","base: z.ZodType"],"sources":["../../../../schema/src/SchemaModel.ts"],"sourcesContent":["import { type AnyFieldType } from './FieldType';\nimport { type AnyEnumType } from './EnumType';\nimport { z } from 'zod';\nimport type { Maybe } from 'graphql/jsutils/Maybe';\n\ntype FieldLike = AnyFieldType | AnyEnumType | AnySchemaModel;\n\n/** Field configuration for a SchemaModel property. */\nexport interface SchemaFieldConfig<Type extends FieldLike = FieldLike> {\n type: Type;\n isOptional: boolean;\n /** When present and true, the field is an array */\n isArray?: true;\n}\n\nexport type SchemaModelFieldsAnyConfig<Type extends FieldLike = FieldLike> =\n Record<string, SchemaFieldConfig<Type>>;\n\n/** Model definition: name and fields. */\nexport interface SchemaModelConfig<Fields extends SchemaModelFieldsAnyConfig> {\n name: string;\n description?: Maybe<string>;\n fields: Fields;\n}\n\n/**\n * Named object model built from FieldType/EnumType/SchemaModel fields.\n * Provides zod and GraphQL input helpers, and supports arrays/optional fields.\n */\nexport class SchemaModel<Fields extends SchemaModelFieldsAnyConfig> {\n constructor(public readonly config: SchemaModelConfig<Fields>) {}\n\n /**\n * Build a typed ZodObject from the model fields, preserving each field's\n * Zod schema and optionality at the type level when possible.\n */\n getZod(): TopLevelZodFromModel<Fields> {\n const shape = Object.entries(this.config.fields).reduce(\n (acc, [key, def]) => {\n const base: z.ZodType = (\n def.type as unknown as { getZod: () => z.ZodType }\n ).getZod();\n const withArray = def.isArray ? z.array(base) : base;\n (acc as Record<string, z.ZodType>)[key] = def.isOptional\n ? withArray.optional()\n : withArray;\n return acc;\n },\n {} as Record<string, z.ZodType>\n ) as unknown as ZodShapeFromFields<Fields>;\n\n return z.object(shape) as z.ZodObject<ZodShapeFromFields<Fields>>;\n }\n\n /** Input object name for GraphQL builder adapters. */\n getPothosInput() {\n return this.config.name;\n }\n}\n\nexport type AnySchemaModel = SchemaModel<SchemaModelFieldsAnyConfig>;\n\nexport type ZodSchemaModel<Field extends AnySchemaModel> = z.infer<\n ReturnType<Field['getZod']>\n>;\n\ntype InferZodFromType<T> =\n T extends SchemaModel<any>\n ? z.ZodObject<any>\n : T extends AnyFieldType\n ? ReturnType<T['getZod']>\n : T extends AnyEnumType\n ? ReturnType<T['getZod']>\n : never;\n\ntype MaybeArray<Z extends z.ZodType, A> = A extends true ? z.ZodArray<Z> : Z;\ntype MaybeOptional<Z extends z.ZodType, O> = O extends true\n ? z.ZodOptional<Z>\n : Z;\n\n/**\n * Helper type: derive the Zod shape from the field config.\n * Supports nested SchemaModel and arrays, preserving optionality and list-ness.\n */\ntype FieldIsArray<FC> = FC extends { isArray: true } ? true : false;\n\nexport type ZodShapeFromFields<F extends SchemaModelFieldsAnyConfig> = {\n [K in keyof F]: MaybeOptional<\n MaybeArray<InferZodFromType<F[K]['type']>, FieldIsArray<F[K]>>,\n F[K]['isOptional']\n >;\n};\n\n/**\n * The top-level Zod schema returned by getZod():\n * either ZodObject<...> or ZodArray<ZodObject<...>> when config.isArray.\n */\nexport type TopLevelZodFromModel<F extends SchemaModelFieldsAnyConfig> =\n z.ZodObject<ZodShapeFromFields<F>>;\n"],"mappings":"qEA6BA,IAAa,EAAb,KAAoE,CAClE,YAAY,EAAmD,CAAnC,KAAA,OAAA,EAM5B,QAAuC,CACrC,IAAM,EAAQ,OAAO,QAAQ,KAAK,OAAO,OAAO,CAAC,QAC9C,EAAK,CAAC,EAAK,KAAS,CACnB,IAAMC,EACJ,EAAI,KACJ,QAAQ,CACJ,EAAY,EAAI,QAAU,EAAE,MAAM,EAAK,CAAG,EAIhD,MAHC,GAAkC,GAAO,EAAI,WAC1C,EAAU,UAAU,CACpB,EACG,GAET,EAAE,CACH,CAED,OAAO,EAAE,OAAO,EAAM,CAIxB,gBAAiB,CACf,OAAO,KAAK,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{FieldType as e}from"./FieldType.js";import{ScalarTypeEnum as t}from"./ScalarTypeEnum.js";import"./EnumType.js";import{SchemaModel as n}from"./SchemaModel.js";
|
package/dist/spec.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { EventSpec } from "./events.js";
|
|
|
3
3
|
import { ResourceRefDescriptor } from "./resources.js";
|
|
4
4
|
import { PolicyRef } from "./policy/spec.js";
|
|
5
5
|
import { TestSpecRef } from "./tests/spec.js";
|
|
6
|
-
import { AnySchemaModel } from "@lssm/lib.schema";
|
|
7
6
|
|
|
8
7
|
//#region src/spec.d.ts
|
|
9
8
|
|
package/dist/spec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","names":[],"sources":["../src/spec.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spec.d.ts","names":[],"sources":["../src/spec.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAyBY,KAdA,MAAA,GAcQ,SAAG,GAAA,OAAA;AACV,UAZI,WAAA,CAYyD;EAEzD,GAAA,EAbV,SAaU,CAbA,cAagB,CAAA;EAShB,IAAA,EAAA,MAAA;;AAEA,UApBA,cAAA,CAoBA;EAAiB,IAAA,EAAA,MAAA;EACR,OAAA,EAAA,MAAA;EACX,IAAA,EAAA,MAAA;EASL,OAAA,EA3BC,cA2BD;;AAIE,KA7BA,QAAA,GAAW,WA6BX,GA7ByB,cA6BzB;AAEF,cA9B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AAA,EAAA,WAAA,GAAA,MAAA,GAAA,OAAA;IAAG;IAAnB,UAAA,CAAA,EAAA,OAAA;IAAL;IACoB,SAAA,CAAA,EAAA;MAAG,GAAA,EAAA,MAAA;MAAG,GAAA,EAAA,MAAA,GAAA,KAAA,GAAA,QAAA;IAAnB,CAAA;IAAL;IACoB,KAAA,CAAA,EAAA,MAAA,EAAA;IAAG;IAAG,QAAA,CAAA,EAAA,cAAA,GAAA,IAAA;IAAnB;IAAL,GAAA,CAAA,EAAA,MAAA,EAAA;IAEI;IAAG,QAAA,CAAA,EA5FJ,SA4FI,EAAA;IAAG;IAAnB,aAAA,CAAA,EAAA;MAAY,KAAA,EAAA,MAAA;;eAvFA;;;;;YAMH;;;;;;;cAQE;cACA;;UAGJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmCE,eAAA,GAAkB,aAC5B,gBACA,iBAAiB;cAGN,0BACD,0BACA,iBAAiB,mDACR,0CAEb,KAAK,aAAa,GAAG,GAAG;QACtB,KAAK,aAAa,GAAG,GAAG;UACtB,KAAK,aAAa,GAAG,GAAG;MAEjC,aAAa,GAAG,GAAG;cAWT,wBACD,0BACA,iBAAiB,mDACR,0CAEb,KAAK,aAAa,GAAG,GAAG;QACtB,KAAK,aAAa,GAAG,GAAG;UACtB,KAAK,aAAa,GAAG,GAAG;MAEjC,aAAa,GAAG,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../src/workflow/spec.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAQA;AAKY,UALK,OAAA,CAKG;EAER,GAAA,EAAA,MAAA;EAOA,OAAA,EAAA,MAAA;AAEZ;AAMiB,KAjBL,QAAA,GAiBgB,OAAA,GAAA,YAAA,GAAA,UAAA;AAQX,KAvBL,cAAA,
|
|
1
|
+
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../src/workflow/spec.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAQA;AA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