@lssm/example.integration-hub 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217073102
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/connection/connection.contracts.d.ts +27 -27
- package/dist/connection/connection.contracts.js +41 -1
- package/dist/connection/connection.enum.d.ts +2 -2
- package/dist/connection/connection.enum.js +17 -1
- package/dist/connection/connection.presentation.js +50 -1
- package/dist/connection/connection.schema.d.ts +16 -16
- package/dist/connection/connection.schema.js +77 -1
- package/dist/connection/index.js +5 -1
- package/dist/docs/index.js +1 -1
- package/dist/docs/integration-hub.docblock.js +61 -5
- package/dist/events.d.ts +43 -43
- package/dist/events.js +246 -1
- package/dist/example.js +50 -1
- package/dist/index.js +15 -1
- package/dist/integration/index.js +5 -1
- package/dist/integration/integration.contracts.d.ts +24 -24
- package/dist/integration/integration.contracts.js +37 -1
- package/dist/integration/integration.enum.d.ts +2 -2
- package/dist/integration/integration.enum.js +17 -1
- package/dist/integration/integration.presentation.js +63 -1
- package/dist/integration/integration.schema.d.ts +16 -16
- package/dist/integration/integration.schema.js +77 -1
- package/dist/integration-hub.feature.js +237 -1
- package/dist/libs/contracts/dist/capabilities/openbanking.js +88 -1
- package/dist/libs/contracts/dist/client/index.js +5 -1
- package/dist/libs/contracts/dist/client/react/feature-render.js +2 -1
- package/dist/libs/contracts/dist/client/react/form-render.js +4 -1
- package/dist/libs/contracts/dist/client/react/index.js +4 -1
- package/dist/libs/contracts/dist/contract-registry/index.js +1 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +60 -1
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
- package/dist/libs/contracts/dist/docs/index.js +29 -1
- package/dist/libs/contracts/dist/docs/presentations.js +71 -1
- package/dist/libs/contracts/dist/docs/registry.js +44 -1
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
- package/dist/libs/contracts/dist/events.js +10 -1
- package/dist/libs/contracts/dist/experiments/evaluator.js +1 -1
- package/dist/libs/contracts/dist/index.js +71 -1
- package/dist/libs/contracts/dist/install.js +2 -1
- package/dist/libs/contracts/dist/integrations/contracts.js +377 -1
- package/dist/libs/contracts/dist/integrations/index.js +18 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +242 -1
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +13 -1
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +52 -1
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +75 -1
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +87 -1
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +66 -1
- package/dist/libs/contracts/dist/integrations/providers/index.js +11 -1
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/powens.js +116 -1
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +73 -1
- package/dist/libs/contracts/dist/integrations/providers/registry.js +10 -1
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +83 -1
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +61 -1
- package/dist/libs/contracts/dist/jsonschema.js +1 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +306 -1
- package/dist/libs/contracts/dist/knowledge/index.js +7 -1
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +6 -1
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +37 -1
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
- package/dist/libs/contracts/dist/llm/exporters.js +19 -1
- package/dist/libs/contracts/dist/llm/index.js +2 -1
- package/dist/libs/contracts/dist/llm/prompts.js +1 -1
- package/dist/libs/contracts/dist/onboarding-base.js +196 -1
- package/dist/libs/contracts/dist/openapi.js +1 -1
- package/dist/libs/contracts/dist/ownership.js +21 -1
- package/dist/libs/contracts/dist/presentations.js +1 -1
- package/dist/libs/contracts/dist/presentations.v2.js +11 -1
- package/dist/libs/contracts/dist/prompt.js +1 -1
- package/dist/libs/contracts/dist/promptRegistry.js +1 -1
- package/dist/libs/contracts/dist/regenerator/index.js +1 -1
- package/dist/libs/contracts/dist/regenerator/service.js +6 -1
- package/dist/libs/contracts/dist/registry.js +2 -1
- package/dist/libs/contracts/dist/resources.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +49 -1
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +34 -1
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +6 -1
- package/dist/libs/contracts/dist/server/graphql-pothos.js +6 -1
- package/dist/libs/contracts/dist/server/index.js +8 -1
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +4 -1
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +1 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +1 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +1 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +1 -1
- package/dist/libs/contracts/dist/server/rest-express.js +1 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -1
- package/dist/libs/contracts/dist/spec.js +34 -1
- package/dist/libs/contracts/dist/telemetry/index.js +1 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +1 -1
- package/dist/libs/contracts/dist/tests/index.js +1 -1
- package/dist/libs/contracts/dist/tests/runner.js +2 -1
- package/dist/libs/contracts/dist/workflow/index.js +1 -1
- package/dist/libs/contracts/dist/workflow/runner.js +1 -1
- package/dist/libs/schema/dist/EnumType.js +56 -1
- package/dist/libs/schema/dist/FieldType.js +49 -1
- package/dist/libs/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/libs/schema/dist/SchemaModel.js +39 -1
- package/dist/libs/schema/dist/entity/defineEntity.js +1 -1
- package/dist/libs/schema/dist/entity/index.js +2 -1
- package/dist/libs/schema/dist/entity/types.js +1 -1
- package/dist/libs/schema/dist/index.js +6 -1
- package/dist/sync/index.js +5 -1
- package/dist/sync/sync.contracts.d.ts +125 -125
- package/dist/sync/sync.contracts.js +130 -1
- package/dist/sync/sync.enum.d.ts +4 -4
- package/dist/sync/sync.enum.js +35 -1
- package/dist/sync/sync.presentation.js +142 -1
- package/dist/sync/sync.schema.d.ts +85 -85
- package/dist/sync/sync.schema.js +305 -1
- package/dist/sync-engine/index.js +146 -1
- package/package.json +12 -12
package/dist/sync/sync.schema.js
CHANGED
|
@@ -1 +1,305 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { ScalarTypeEnum } from "../libs/schema/dist/ScalarTypeEnum.js";
|
|
2
|
+
import { defineSchemaModel } from "../libs/schema/dist/SchemaModel.js";
|
|
3
|
+
import "../libs/schema/dist/index.js";
|
|
4
|
+
import { MappingTypeEnum, SyncDirectionEnum, SyncStatusEnum } from "./sync.enum.js";
|
|
5
|
+
|
|
6
|
+
//#region src/sync/sync.schema.ts
|
|
7
|
+
/**
|
|
8
|
+
* A field mapping configuration.
|
|
9
|
+
*/
|
|
10
|
+
const FieldMappingModel = defineSchemaModel({
|
|
11
|
+
name: "FieldMappingModel",
|
|
12
|
+
fields: {
|
|
13
|
+
id: {
|
|
14
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
15
|
+
isOptional: false
|
|
16
|
+
},
|
|
17
|
+
sourceField: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
},
|
|
21
|
+
targetField: {
|
|
22
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
+
isOptional: false
|
|
24
|
+
},
|
|
25
|
+
mappingType: {
|
|
26
|
+
type: MappingTypeEnum,
|
|
27
|
+
isOptional: false
|
|
28
|
+
},
|
|
29
|
+
transformExpression: {
|
|
30
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
31
|
+
isOptional: true
|
|
32
|
+
},
|
|
33
|
+
isRequired: {
|
|
34
|
+
type: ScalarTypeEnum.Boolean(),
|
|
35
|
+
isOptional: false
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* A sync configuration.
|
|
41
|
+
*/
|
|
42
|
+
const SyncConfigModel = defineSchemaModel({
|
|
43
|
+
name: "SyncConfigModel",
|
|
44
|
+
fields: {
|
|
45
|
+
id: {
|
|
46
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
47
|
+
isOptional: false
|
|
48
|
+
},
|
|
49
|
+
integrationId: {
|
|
50
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
51
|
+
isOptional: false
|
|
52
|
+
},
|
|
53
|
+
connectionId: {
|
|
54
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
55
|
+
isOptional: false
|
|
56
|
+
},
|
|
57
|
+
name: {
|
|
58
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
59
|
+
isOptional: false
|
|
60
|
+
},
|
|
61
|
+
direction: {
|
|
62
|
+
type: SyncDirectionEnum,
|
|
63
|
+
isOptional: false
|
|
64
|
+
},
|
|
65
|
+
sourceObject: {
|
|
66
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
67
|
+
isOptional: false
|
|
68
|
+
},
|
|
69
|
+
targetObject: {
|
|
70
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
71
|
+
isOptional: false
|
|
72
|
+
},
|
|
73
|
+
scheduleEnabled: {
|
|
74
|
+
type: ScalarTypeEnum.Boolean(),
|
|
75
|
+
isOptional: false
|
|
76
|
+
},
|
|
77
|
+
scheduleCron: {
|
|
78
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
79
|
+
isOptional: true
|
|
80
|
+
},
|
|
81
|
+
isActive: {
|
|
82
|
+
type: ScalarTypeEnum.Boolean(),
|
|
83
|
+
isOptional: false
|
|
84
|
+
},
|
|
85
|
+
lastSyncAt: {
|
|
86
|
+
type: ScalarTypeEnum.DateTime(),
|
|
87
|
+
isOptional: true
|
|
88
|
+
},
|
|
89
|
+
fieldMappings: {
|
|
90
|
+
type: FieldMappingModel,
|
|
91
|
+
isArray: true,
|
|
92
|
+
isOptional: true
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* A sync run.
|
|
98
|
+
*/
|
|
99
|
+
const SyncRunModel = defineSchemaModel({
|
|
100
|
+
name: "SyncRunModel",
|
|
101
|
+
fields: {
|
|
102
|
+
id: {
|
|
103
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
104
|
+
isOptional: false
|
|
105
|
+
},
|
|
106
|
+
syncConfigId: {
|
|
107
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
108
|
+
isOptional: false
|
|
109
|
+
},
|
|
110
|
+
status: {
|
|
111
|
+
type: SyncStatusEnum,
|
|
112
|
+
isOptional: false
|
|
113
|
+
},
|
|
114
|
+
direction: {
|
|
115
|
+
type: SyncDirectionEnum,
|
|
116
|
+
isOptional: false
|
|
117
|
+
},
|
|
118
|
+
trigger: {
|
|
119
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
120
|
+
isOptional: false
|
|
121
|
+
},
|
|
122
|
+
recordsProcessed: {
|
|
123
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
124
|
+
isOptional: false
|
|
125
|
+
},
|
|
126
|
+
recordsCreated: {
|
|
127
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
128
|
+
isOptional: false
|
|
129
|
+
},
|
|
130
|
+
recordsUpdated: {
|
|
131
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
132
|
+
isOptional: false
|
|
133
|
+
},
|
|
134
|
+
recordsFailed: {
|
|
135
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
136
|
+
isOptional: false
|
|
137
|
+
},
|
|
138
|
+
errorMessage: {
|
|
139
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
140
|
+
isOptional: true
|
|
141
|
+
},
|
|
142
|
+
startedAt: {
|
|
143
|
+
type: ScalarTypeEnum.DateTime(),
|
|
144
|
+
isOptional: true
|
|
145
|
+
},
|
|
146
|
+
completedAt: {
|
|
147
|
+
type: ScalarTypeEnum.DateTime(),
|
|
148
|
+
isOptional: true
|
|
149
|
+
},
|
|
150
|
+
createdAt: {
|
|
151
|
+
type: ScalarTypeEnum.DateTime(),
|
|
152
|
+
isOptional: false
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
/**
|
|
157
|
+
* Input for creating a sync config.
|
|
158
|
+
*/
|
|
159
|
+
const CreateSyncConfigInputModel = defineSchemaModel({
|
|
160
|
+
name: "CreateSyncConfigInput",
|
|
161
|
+
fields: {
|
|
162
|
+
integrationId: {
|
|
163
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
164
|
+
isOptional: false
|
|
165
|
+
},
|
|
166
|
+
connectionId: {
|
|
167
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
168
|
+
isOptional: false
|
|
169
|
+
},
|
|
170
|
+
name: {
|
|
171
|
+
type: ScalarTypeEnum.NonEmptyString(),
|
|
172
|
+
isOptional: false
|
|
173
|
+
},
|
|
174
|
+
direction: {
|
|
175
|
+
type: SyncDirectionEnum,
|
|
176
|
+
isOptional: false
|
|
177
|
+
},
|
|
178
|
+
sourceObject: {
|
|
179
|
+
type: ScalarTypeEnum.NonEmptyString(),
|
|
180
|
+
isOptional: false
|
|
181
|
+
},
|
|
182
|
+
targetObject: {
|
|
183
|
+
type: ScalarTypeEnum.NonEmptyString(),
|
|
184
|
+
isOptional: false
|
|
185
|
+
},
|
|
186
|
+
scheduleEnabled: {
|
|
187
|
+
type: ScalarTypeEnum.Boolean(),
|
|
188
|
+
isOptional: true
|
|
189
|
+
},
|
|
190
|
+
scheduleCron: {
|
|
191
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
192
|
+
isOptional: true
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
/**
|
|
197
|
+
* Input for adding a field mapping.
|
|
198
|
+
*/
|
|
199
|
+
const AddFieldMappingInputModel = defineSchemaModel({
|
|
200
|
+
name: "AddFieldMappingInput",
|
|
201
|
+
fields: {
|
|
202
|
+
syncConfigId: {
|
|
203
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
204
|
+
isOptional: false
|
|
205
|
+
},
|
|
206
|
+
sourceField: {
|
|
207
|
+
type: ScalarTypeEnum.NonEmptyString(),
|
|
208
|
+
isOptional: false
|
|
209
|
+
},
|
|
210
|
+
targetField: {
|
|
211
|
+
type: ScalarTypeEnum.NonEmptyString(),
|
|
212
|
+
isOptional: false
|
|
213
|
+
},
|
|
214
|
+
mappingType: {
|
|
215
|
+
type: MappingTypeEnum,
|
|
216
|
+
isOptional: false
|
|
217
|
+
},
|
|
218
|
+
transformExpression: {
|
|
219
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
220
|
+
isOptional: true
|
|
221
|
+
},
|
|
222
|
+
lookupConfig: {
|
|
223
|
+
type: ScalarTypeEnum.JSON(),
|
|
224
|
+
isOptional: true
|
|
225
|
+
},
|
|
226
|
+
constantValue: {
|
|
227
|
+
type: ScalarTypeEnum.JSON(),
|
|
228
|
+
isOptional: true
|
|
229
|
+
},
|
|
230
|
+
isRequired: {
|
|
231
|
+
type: ScalarTypeEnum.Boolean(),
|
|
232
|
+
isOptional: true
|
|
233
|
+
},
|
|
234
|
+
defaultValue: {
|
|
235
|
+
type: ScalarTypeEnum.JSON(),
|
|
236
|
+
isOptional: true
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
/**
|
|
241
|
+
* Input for triggering a sync.
|
|
242
|
+
*/
|
|
243
|
+
const TriggerSyncInputModel = defineSchemaModel({
|
|
244
|
+
name: "TriggerSyncInput",
|
|
245
|
+
fields: {
|
|
246
|
+
syncConfigId: {
|
|
247
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
248
|
+
isOptional: false
|
|
249
|
+
},
|
|
250
|
+
direction: {
|
|
251
|
+
type: SyncDirectionEnum,
|
|
252
|
+
isOptional: true
|
|
253
|
+
},
|
|
254
|
+
fullSync: {
|
|
255
|
+
type: ScalarTypeEnum.Boolean(),
|
|
256
|
+
isOptional: true
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
/**
|
|
261
|
+
* Input for listing sync runs.
|
|
262
|
+
*/
|
|
263
|
+
const ListSyncRunsInputModel = defineSchemaModel({
|
|
264
|
+
name: "ListSyncRunsInput",
|
|
265
|
+
fields: {
|
|
266
|
+
syncConfigId: {
|
|
267
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
268
|
+
isOptional: false
|
|
269
|
+
},
|
|
270
|
+
status: {
|
|
271
|
+
type: SyncStatusEnum,
|
|
272
|
+
isOptional: true
|
|
273
|
+
},
|
|
274
|
+
limit: {
|
|
275
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
276
|
+
isOptional: true,
|
|
277
|
+
defaultValue: 20
|
|
278
|
+
},
|
|
279
|
+
offset: {
|
|
280
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
281
|
+
isOptional: true,
|
|
282
|
+
defaultValue: 0
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
/**
|
|
287
|
+
* Output for listing sync runs.
|
|
288
|
+
*/
|
|
289
|
+
const ListSyncRunsOutputModel = defineSchemaModel({
|
|
290
|
+
name: "ListSyncRunsOutput",
|
|
291
|
+
fields: {
|
|
292
|
+
runs: {
|
|
293
|
+
type: SyncRunModel,
|
|
294
|
+
isArray: true,
|
|
295
|
+
isOptional: false
|
|
296
|
+
},
|
|
297
|
+
total: {
|
|
298
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
299
|
+
isOptional: false
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
//#endregion
|
|
305
|
+
export { AddFieldMappingInputModel, CreateSyncConfigInputModel, FieldMappingModel, ListSyncRunsInputModel, ListSyncRunsOutputModel, SyncConfigModel, SyncRunModel, TriggerSyncInputModel };
|
|
@@ -1 +1,146 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/sync-engine/index.ts
|
|
2
|
+
var BasicFieldTransformer = class {
|
|
3
|
+
transform(value, expression) {
|
|
4
|
+
try {
|
|
5
|
+
if (expression.startsWith("uppercase")) return typeof value === "string" ? value.toUpperCase() : value;
|
|
6
|
+
if (expression.startsWith("lowercase")) return typeof value === "string" ? value.toLowerCase() : value;
|
|
7
|
+
if (expression.startsWith("trim")) return typeof value === "string" ? value.trim() : value;
|
|
8
|
+
if (expression.startsWith("default:")) {
|
|
9
|
+
const defaultVal = expression.replace("default:", "");
|
|
10
|
+
return value ?? JSON.parse(defaultVal);
|
|
11
|
+
}
|
|
12
|
+
if (expression.startsWith("concat:")) {
|
|
13
|
+
const separator = expression.replace("concat:", "") || " ";
|
|
14
|
+
if (Array.isArray(value)) return value.join(separator);
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
if (expression.startsWith("split:")) {
|
|
18
|
+
const separator = expression.replace("split:", "") || ",";
|
|
19
|
+
if (typeof value === "string") return value.split(separator);
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
if (expression.startsWith("number")) return Number(value);
|
|
23
|
+
if (expression.startsWith("boolean")) return Boolean(value);
|
|
24
|
+
if (expression.startsWith("string")) return String(value);
|
|
25
|
+
return value;
|
|
26
|
+
} catch {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var BasicSyncEngine = class {
|
|
32
|
+
transformer;
|
|
33
|
+
constructor(transformer) {
|
|
34
|
+
this.transformer = transformer ?? new BasicFieldTransformer();
|
|
35
|
+
}
|
|
36
|
+
async sync(context) {
|
|
37
|
+
return {
|
|
38
|
+
success: true,
|
|
39
|
+
recordsProcessed: 0,
|
|
40
|
+
recordsCreated: 0,
|
|
41
|
+
recordsUpdated: 0,
|
|
42
|
+
recordsDeleted: 0,
|
|
43
|
+
recordsFailed: 0,
|
|
44
|
+
recordsSkipped: 0,
|
|
45
|
+
errors: []
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
transformRecord(sourceRecord, mappings, _context) {
|
|
49
|
+
const targetData = {};
|
|
50
|
+
for (const mapping of mappings) {
|
|
51
|
+
let value;
|
|
52
|
+
switch (mapping.mappingType) {
|
|
53
|
+
case "DIRECT":
|
|
54
|
+
value = this.getNestedValue(sourceRecord.data, mapping.sourceField);
|
|
55
|
+
break;
|
|
56
|
+
case "TRANSFORM":
|
|
57
|
+
const sourceValue = this.getNestedValue(sourceRecord.data, mapping.sourceField);
|
|
58
|
+
value = mapping.transformExpression ? this.transformer.transform(sourceValue, mapping.transformExpression) : sourceValue;
|
|
59
|
+
break;
|
|
60
|
+
case "CONSTANT":
|
|
61
|
+
value = mapping.constantValue;
|
|
62
|
+
break;
|
|
63
|
+
case "LOOKUP":
|
|
64
|
+
value = this.getNestedValue(sourceRecord.data, mapping.sourceField);
|
|
65
|
+
break;
|
|
66
|
+
case "COMPUTED":
|
|
67
|
+
value = mapping.transformExpression ? this.evaluateComputed(sourceRecord.data, mapping.transformExpression) : null;
|
|
68
|
+
break;
|
|
69
|
+
default: value = this.getNestedValue(sourceRecord.data, mapping.sourceField);
|
|
70
|
+
}
|
|
71
|
+
if (value === void 0 || value === null) value = mapping.defaultValue;
|
|
72
|
+
this.setNestedValue(targetData, mapping.targetField, value);
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
id: sourceRecord.id,
|
|
76
|
+
data: targetData
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
validateRecord(record, mappings) {
|
|
80
|
+
const errors = [];
|
|
81
|
+
for (const mapping of mappings) if (mapping.isRequired) {
|
|
82
|
+
const value = this.getNestedValue(record.data, mapping.targetField);
|
|
83
|
+
if (value === void 0 || value === null) errors.push({
|
|
84
|
+
recordId: record.id,
|
|
85
|
+
field: mapping.targetField,
|
|
86
|
+
message: `Required field ${mapping.targetField} is missing`,
|
|
87
|
+
code: "REQUIRED_FIELD_MISSING"
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
valid: errors.length === 0,
|
|
92
|
+
errors
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
getNestedValue(obj, path) {
|
|
96
|
+
const parts = path.split(".");
|
|
97
|
+
let current = obj;
|
|
98
|
+
for (const part of parts) {
|
|
99
|
+
if (current === null || current === void 0) return;
|
|
100
|
+
current = current[part];
|
|
101
|
+
}
|
|
102
|
+
return current;
|
|
103
|
+
}
|
|
104
|
+
setNestedValue(obj, path, value) {
|
|
105
|
+
const parts = path.split(".");
|
|
106
|
+
let current = obj;
|
|
107
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
108
|
+
const part = parts[i];
|
|
109
|
+
if (part === void 0) continue;
|
|
110
|
+
if (!(part in current)) current[part] = {};
|
|
111
|
+
current = current[part];
|
|
112
|
+
}
|
|
113
|
+
const lastPart = parts[parts.length - 1];
|
|
114
|
+
if (lastPart !== void 0) current[lastPart] = value;
|
|
115
|
+
}
|
|
116
|
+
evaluateComputed(data, expression) {
|
|
117
|
+
try {
|
|
118
|
+
return expression.replace(/\$\{([^}]+)\}/g, (_, path) => {
|
|
119
|
+
const value = this.getNestedValue(data, path);
|
|
120
|
+
return String(value ?? "");
|
|
121
|
+
});
|
|
122
|
+
} catch {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
function createSyncEngine(transformer) {
|
|
128
|
+
return new BasicSyncEngine(transformer);
|
|
129
|
+
}
|
|
130
|
+
function computeChecksum(data) {
|
|
131
|
+
const str = JSON.stringify(data, Object.keys(data).sort());
|
|
132
|
+
let hash = 0;
|
|
133
|
+
for (let i = 0; i < str.length; i++) {
|
|
134
|
+
const char = str.charCodeAt(i);
|
|
135
|
+
hash = (hash << 5) - hash + char;
|
|
136
|
+
hash = hash & hash;
|
|
137
|
+
}
|
|
138
|
+
return hash.toString(16);
|
|
139
|
+
}
|
|
140
|
+
function hasChanges(sourceChecksum, targetChecksum) {
|
|
141
|
+
if (!sourceChecksum || !targetChecksum) return true;
|
|
142
|
+
return sourceChecksum !== targetChecksum;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
export { BasicFieldTransformer, BasicSyncEngine, computeChecksum, createSyncEngine, hasChanges };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/example.integration-hub",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251217073102",
|
|
4
4
|
"description": "Integration Hub example with sync engine and field mappings for ContractSpec",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -18,20 +18,20 @@
|
|
|
18
18
|
"lint:check": "eslint src"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@lssm/lib.schema": "0.0.0-canary-
|
|
22
|
-
"@lssm/lib.contracts": "0.0.0-canary-
|
|
23
|
-
"@lssm/lib.bus": "0.0.0-canary-
|
|
24
|
-
"@lssm/lib.identity-rbac": "0.0.0-canary-
|
|
25
|
-
"@lssm/lib.files": "0.0.0-canary-
|
|
26
|
-
"@lssm/lib.feature-flags": "0.0.0-canary-
|
|
27
|
-
"@lssm/lib.jobs": "0.0.0-canary-
|
|
28
|
-
"@lssm/module.audit-trail": "0.0.0-canary-
|
|
29
|
-
"@lssm/module.notifications": "0.0.0-canary-
|
|
21
|
+
"@lssm/lib.schema": "0.0.0-canary-20251217073102",
|
|
22
|
+
"@lssm/lib.contracts": "0.0.0-canary-20251217073102",
|
|
23
|
+
"@lssm/lib.bus": "0.0.0-canary-20251217073102",
|
|
24
|
+
"@lssm/lib.identity-rbac": "0.0.0-canary-20251217073102",
|
|
25
|
+
"@lssm/lib.files": "0.0.0-canary-20251217073102",
|
|
26
|
+
"@lssm/lib.feature-flags": "0.0.0-canary-20251217073102",
|
|
27
|
+
"@lssm/lib.jobs": "0.0.0-canary-20251217073102",
|
|
28
|
+
"@lssm/module.audit-trail": "0.0.0-canary-20251217073102",
|
|
29
|
+
"@lssm/module.notifications": "0.0.0-canary-20251217073102",
|
|
30
30
|
"zod": "^4.1.13"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@lssm/tool.typescript": "0.0.0-canary-
|
|
34
|
-
"@lssm/tool.tsdown": "0.0.0-canary-
|
|
33
|
+
"@lssm/tool.typescript": "0.0.0-canary-20251217073102",
|
|
34
|
+
"@lssm/tool.tsdown": "0.0.0-canary-20251217073102",
|
|
35
35
|
"typescript": "^5.9.3"
|
|
36
36
|
},
|
|
37
37
|
"exports": {
|