@lssm/example.integration-hub 0.0.0-canary-20251217083314 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connection/connection.contracts.js +1 -41
- package/dist/connection/connection.enum.js +1 -17
- package/dist/connection/connection.presentation.js +1 -50
- package/dist/connection/connection.schema.js +1 -77
- package/dist/connection/index.js +1 -5
- package/dist/docs/index.js +1 -1
- package/dist/docs/integration-hub.docblock.js +5 -61
- package/dist/events.js +1 -246
- package/dist/example.js +1 -50
- package/dist/index.js +1 -15
- package/dist/integration/index.js +1 -5
- package/dist/integration/integration.contracts.js +1 -37
- package/dist/integration/integration.enum.js +1 -17
- package/dist/integration/integration.presentation.js +1 -63
- package/dist/integration/integration.schema.js +1 -77
- package/dist/integration-hub.feature.js +1 -237
- package/dist/sync/index.js +1 -5
- package/dist/sync/sync.contracts.js +1 -130
- package/dist/sync/sync.enum.js +1 -35
- package/dist/sync/sync.presentation.js +1 -142
- package/dist/sync/sync.schema.js +1 -305
- package/dist/sync-engine/index.js +1 -146
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +34 -35
- package/dist/connection/connection.contracts.d.ts +0 -106
- package/dist/connection/connection.enum.d.ts +0 -9
- package/dist/connection/connection.presentation.d.ts +0 -7
- package/dist/connection/connection.schema.d.ts +0 -67
- package/dist/connection/index.d.ts +0 -4
- package/dist/docs/index.d.ts +0 -1
- package/dist/docs/integration-hub.docblock.d.ts +0 -1
- package/dist/events.d.ts +0 -152
- package/dist/example.d.ts +0 -39
- package/dist/index.d.ts +0 -11
- package/dist/integration/index.d.ts +0 -4
- package/dist/integration/integration.contracts.d.ts +0 -98
- package/dist/integration/integration.enum.d.ts +0 -9
- package/dist/integration/integration.presentation.d.ts +0 -8
- package/dist/integration/integration.schema.d.ts +0 -67
- package/dist/integration-hub.feature.d.ts +0 -7
- package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -88
- package/dist/libs/contracts/dist/client/index.js +0 -5
- package/dist/libs/contracts/dist/client/react/feature-render.js +0 -2
- package/dist/libs/contracts/dist/client/react/form-render.js +0 -4
- package/dist/libs/contracts/dist/client/react/index.js +0 -4
- package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -60
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/index.js +0 -29
- package/dist/libs/contracts/dist/docs/presentations.js +0 -71
- package/dist/libs/contracts/dist/docs/registry.js +0 -44
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
- package/dist/libs/contracts/dist/events.js +0 -10
- package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
- package/dist/libs/contracts/dist/index.js +0 -71
- package/dist/libs/contracts/dist/install.js +0 -2
- package/dist/libs/contracts/dist/integrations/contracts.js +0 -377
- package/dist/libs/contracts/dist/integrations/index.js +0 -18
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -242
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -13
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -52
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -75
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -87
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -66
- package/dist/libs/contracts/dist/integrations/providers/index.js +0 -11
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -68
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -68
- package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -116
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -73
- package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -10
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -83
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -61
- package/dist/libs/contracts/dist/jsonschema.js +0 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +0 -306
- package/dist/libs/contracts/dist/knowledge/index.js +0 -7
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -6
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -34
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -37
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
- package/dist/libs/contracts/dist/llm/exporters.js +0 -19
- package/dist/libs/contracts/dist/llm/index.js +0 -2
- package/dist/libs/contracts/dist/llm/prompts.js +0 -1
- package/dist/libs/contracts/dist/onboarding-base.js +0 -196
- package/dist/libs/contracts/dist/openapi.js +0 -1
- package/dist/libs/contracts/dist/ownership.js +0 -21
- package/dist/libs/contracts/dist/presentations.js +0 -1
- package/dist/libs/contracts/dist/presentations.v2.js +0 -11
- package/dist/libs/contracts/dist/prompt.js +0 -1
- package/dist/libs/contracts/dist/promptRegistry.js +0 -1
- package/dist/libs/contracts/dist/regenerator/index.js +0 -1
- package/dist/libs/contracts/dist/regenerator/service.js +0 -6
- package/dist/libs/contracts/dist/registry.js +0 -2
- package/dist/libs/contracts/dist/resources.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +0 -2
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +0 -49
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +0 -34
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +0 -2
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +0 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +0 -6
- package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -6
- package/dist/libs/contracts/dist/server/index.js +0 -8
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -4
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -2
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -2
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
- package/dist/libs/contracts/dist/server/rest-express.js +0 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
- package/dist/libs/contracts/dist/spec.js +0 -34
- package/dist/libs/contracts/dist/telemetry/index.js +0 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
- package/dist/libs/contracts/dist/tests/index.js +0 -1
- package/dist/libs/contracts/dist/tests/runner.js +0 -2
- package/dist/libs/contracts/dist/workflow/index.js +0 -1
- package/dist/libs/contracts/dist/workflow/runner.js +0 -1
- package/dist/libs/schema/dist/EnumType.js +0 -56
- package/dist/libs/schema/dist/FieldType.js +0 -49
- package/dist/libs/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/libs/schema/dist/SchemaModel.js +0 -39
- package/dist/libs/schema/dist/entity/defineEntity.js +0 -1
- package/dist/libs/schema/dist/entity/index.js +0 -2
- package/dist/libs/schema/dist/entity/types.js +0 -1
- package/dist/libs/schema/dist/index.js +0 -6
- package/dist/sync/index.d.ts +0 -4
- package/dist/sync/sync.contracts.d.ts +0 -508
- package/dist/sync/sync.enum.d.ts +0 -17
- package/dist/sync/sync.presentation.d.ts +0 -11
- package/dist/sync/sync.schema.d.ts +0 -355
- package/dist/sync-engine/index.d.ts +0 -108
|
@@ -1,142 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/sync/sync.presentation.ts
|
|
4
|
-
const SyncConfigListPresentation = {
|
|
5
|
-
meta: {
|
|
6
|
-
name: "integration.syncConfig.list",
|
|
7
|
-
version: 1,
|
|
8
|
-
description: "List of sync configurations",
|
|
9
|
-
domain: "integration",
|
|
10
|
-
owners: ["@integration-team"],
|
|
11
|
-
tags: [
|
|
12
|
-
"integration",
|
|
13
|
-
"sync",
|
|
14
|
-
"config",
|
|
15
|
-
"list"
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
source: {
|
|
19
|
-
type: "component",
|
|
20
|
-
framework: "react",
|
|
21
|
-
componentKey: "SyncConfigList",
|
|
22
|
-
props: SyncConfigModel
|
|
23
|
-
},
|
|
24
|
-
targets: ["react", "markdown"],
|
|
25
|
-
policy: { flags: ["integration.sync.enabled"] }
|
|
26
|
-
};
|
|
27
|
-
const SyncConfigEditorPresentation = {
|
|
28
|
-
meta: {
|
|
29
|
-
name: "integration.syncConfig.editor",
|
|
30
|
-
version: 1,
|
|
31
|
-
description: "Editor for sync configuration settings",
|
|
32
|
-
domain: "integration",
|
|
33
|
-
owners: ["@integration-team"],
|
|
34
|
-
tags: [
|
|
35
|
-
"integration",
|
|
36
|
-
"sync",
|
|
37
|
-
"config",
|
|
38
|
-
"editor"
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
source: {
|
|
42
|
-
type: "component",
|
|
43
|
-
framework: "react",
|
|
44
|
-
componentKey: "SyncConfigEditor",
|
|
45
|
-
props: SyncConfigModel
|
|
46
|
-
},
|
|
47
|
-
targets: ["react"],
|
|
48
|
-
policy: { flags: ["integration.sync.enabled"] }
|
|
49
|
-
};
|
|
50
|
-
const FieldMappingEditorPresentation = {
|
|
51
|
-
meta: {
|
|
52
|
-
name: "integration.fieldMapping.editor",
|
|
53
|
-
version: 1,
|
|
54
|
-
description: "Visual field mapping editor",
|
|
55
|
-
domain: "integration",
|
|
56
|
-
owners: ["@integration-team"],
|
|
57
|
-
tags: [
|
|
58
|
-
"integration",
|
|
59
|
-
"field-mapping",
|
|
60
|
-
"editor"
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
source: {
|
|
64
|
-
type: "component",
|
|
65
|
-
framework: "react",
|
|
66
|
-
componentKey: "FieldMappingEditor",
|
|
67
|
-
props: FieldMappingModel
|
|
68
|
-
},
|
|
69
|
-
targets: ["react"],
|
|
70
|
-
policy: { flags: ["integration.sync.enabled"] }
|
|
71
|
-
};
|
|
72
|
-
const SyncRunListPresentation = {
|
|
73
|
-
meta: {
|
|
74
|
-
name: "integration.syncRun.list",
|
|
75
|
-
version: 1,
|
|
76
|
-
description: "History of sync runs",
|
|
77
|
-
domain: "integration",
|
|
78
|
-
owners: ["@integration-team"],
|
|
79
|
-
tags: [
|
|
80
|
-
"integration",
|
|
81
|
-
"sync",
|
|
82
|
-
"runs",
|
|
83
|
-
"history"
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
source: {
|
|
87
|
-
type: "component",
|
|
88
|
-
framework: "react",
|
|
89
|
-
componentKey: "SyncRunList",
|
|
90
|
-
props: SyncRunModel
|
|
91
|
-
},
|
|
92
|
-
targets: ["react", "markdown"],
|
|
93
|
-
policy: { flags: ["integration.sync.enabled"] }
|
|
94
|
-
};
|
|
95
|
-
const SyncRunDetailPresentation = {
|
|
96
|
-
meta: {
|
|
97
|
-
name: "integration.syncRun.detail",
|
|
98
|
-
version: 1,
|
|
99
|
-
description: "Detailed view of a sync run with logs",
|
|
100
|
-
domain: "integration",
|
|
101
|
-
owners: ["@integration-team"],
|
|
102
|
-
tags: [
|
|
103
|
-
"integration",
|
|
104
|
-
"sync",
|
|
105
|
-
"run",
|
|
106
|
-
"detail"
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
source: {
|
|
110
|
-
type: "component",
|
|
111
|
-
framework: "react",
|
|
112
|
-
componentKey: "SyncRunDetail",
|
|
113
|
-
props: SyncRunModel
|
|
114
|
-
},
|
|
115
|
-
targets: ["react", "markdown"],
|
|
116
|
-
policy: { flags: ["integration.sync.enabled"] }
|
|
117
|
-
};
|
|
118
|
-
const SyncActivityPresentation = {
|
|
119
|
-
meta: {
|
|
120
|
-
name: "integration.sync.activity",
|
|
121
|
-
version: 1,
|
|
122
|
-
description: "Real-time sync activity monitor",
|
|
123
|
-
domain: "integration",
|
|
124
|
-
owners: ["@integration-team"],
|
|
125
|
-
tags: [
|
|
126
|
-
"integration",
|
|
127
|
-
"sync",
|
|
128
|
-
"activity",
|
|
129
|
-
"realtime"
|
|
130
|
-
]
|
|
131
|
-
},
|
|
132
|
-
source: {
|
|
133
|
-
type: "component",
|
|
134
|
-
framework: "react",
|
|
135
|
-
componentKey: "SyncActivity"
|
|
136
|
-
},
|
|
137
|
-
targets: ["react", "markdown"],
|
|
138
|
-
policy: { flags: ["integration.sync.enabled"] }
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
//#endregion
|
|
142
|
-
export { FieldMappingEditorPresentation, SyncActivityPresentation, SyncConfigEditorPresentation, SyncConfigListPresentation, SyncRunDetailPresentation, SyncRunListPresentation };
|
|
1
|
+
import{FieldMappingModel as e,SyncConfigModel as t,SyncRunModel as n}from"./sync.schema.js";const r={meta:{name:`integration.syncConfig.list`,version:1,description:`List of sync configurations`,domain:`integration`,owners:[`@integration-team`],tags:[`integration`,`sync`,`config`,`list`]},source:{type:`component`,framework:`react`,componentKey:`SyncConfigList`,props:t},targets:[`react`,`markdown`],policy:{flags:[`integration.sync.enabled`]}},i={meta:{name:`integration.syncConfig.editor`,version:1,description:`Editor for sync configuration settings`,domain:`integration`,owners:[`@integration-team`],tags:[`integration`,`sync`,`config`,`editor`]},source:{type:`component`,framework:`react`,componentKey:`SyncConfigEditor`,props:t},targets:[`react`],policy:{flags:[`integration.sync.enabled`]}},a={meta:{name:`integration.fieldMapping.editor`,version:1,description:`Visual field mapping editor`,domain:`integration`,owners:[`@integration-team`],tags:[`integration`,`field-mapping`,`editor`]},source:{type:`component`,framework:`react`,componentKey:`FieldMappingEditor`,props:e},targets:[`react`],policy:{flags:[`integration.sync.enabled`]}},o={meta:{name:`integration.syncRun.list`,version:1,description:`History of sync runs`,domain:`integration`,owners:[`@integration-team`],tags:[`integration`,`sync`,`runs`,`history`]},source:{type:`component`,framework:`react`,componentKey:`SyncRunList`,props:n},targets:[`react`,`markdown`],policy:{flags:[`integration.sync.enabled`]}},s={meta:{name:`integration.syncRun.detail`,version:1,description:`Detailed view of a sync run with logs`,domain:`integration`,owners:[`@integration-team`],tags:[`integration`,`sync`,`run`,`detail`]},source:{type:`component`,framework:`react`,componentKey:`SyncRunDetail`,props:n},targets:[`react`,`markdown`],policy:{flags:[`integration.sync.enabled`]}},c={meta:{name:`integration.sync.activity`,version:1,description:`Real-time sync activity monitor`,domain:`integration`,owners:[`@integration-team`],tags:[`integration`,`sync`,`activity`,`realtime`]},source:{type:`component`,framework:`react`,componentKey:`SyncActivity`},targets:[`react`,`markdown`],policy:{flags:[`integration.sync.enabled`]}};export{a as FieldMappingEditorPresentation,c as SyncActivityPresentation,i as SyncConfigEditorPresentation,r as SyncConfigListPresentation,s as SyncRunDetailPresentation,o as SyncRunListPresentation};
|
package/dist/sync/sync.schema.js
CHANGED
|
@@ -1,305 +1 @@
|
|
|
1
|
-
import {
|
|
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
|
+
import{MappingTypeEnum as e,SyncDirectionEnum as t,SyncStatusEnum as n}from"./sync.enum.js";import{ScalarTypeEnum as r,defineSchemaModel as i}from"@lssm/lib.schema";const a=i({name:`FieldMappingModel`,fields:{id:{type:r.String_unsecure(),isOptional:!1},sourceField:{type:r.String_unsecure(),isOptional:!1},targetField:{type:r.String_unsecure(),isOptional:!1},mappingType:{type:e,isOptional:!1},transformExpression:{type:r.String_unsecure(),isOptional:!0},isRequired:{type:r.Boolean(),isOptional:!1}}}),o=i({name:`SyncConfigModel`,fields:{id:{type:r.String_unsecure(),isOptional:!1},integrationId:{type:r.String_unsecure(),isOptional:!1},connectionId:{type:r.String_unsecure(),isOptional:!1},name:{type:r.String_unsecure(),isOptional:!1},direction:{type:t,isOptional:!1},sourceObject:{type:r.String_unsecure(),isOptional:!1},targetObject:{type:r.String_unsecure(),isOptional:!1},scheduleEnabled:{type:r.Boolean(),isOptional:!1},scheduleCron:{type:r.String_unsecure(),isOptional:!0},isActive:{type:r.Boolean(),isOptional:!1},lastSyncAt:{type:r.DateTime(),isOptional:!0},fieldMappings:{type:a,isArray:!0,isOptional:!0}}}),s=i({name:`SyncRunModel`,fields:{id:{type:r.String_unsecure(),isOptional:!1},syncConfigId:{type:r.String_unsecure(),isOptional:!1},status:{type:n,isOptional:!1},direction:{type:t,isOptional:!1},trigger:{type:r.String_unsecure(),isOptional:!1},recordsProcessed:{type:r.Int_unsecure(),isOptional:!1},recordsCreated:{type:r.Int_unsecure(),isOptional:!1},recordsUpdated:{type:r.Int_unsecure(),isOptional:!1},recordsFailed:{type:r.Int_unsecure(),isOptional:!1},errorMessage:{type:r.String_unsecure(),isOptional:!0},startedAt:{type:r.DateTime(),isOptional:!0},completedAt:{type:r.DateTime(),isOptional:!0},createdAt:{type:r.DateTime(),isOptional:!1}}}),c=i({name:`CreateSyncConfigInput`,fields:{integrationId:{type:r.String_unsecure(),isOptional:!1},connectionId:{type:r.String_unsecure(),isOptional:!1},name:{type:r.NonEmptyString(),isOptional:!1},direction:{type:t,isOptional:!1},sourceObject:{type:r.NonEmptyString(),isOptional:!1},targetObject:{type:r.NonEmptyString(),isOptional:!1},scheduleEnabled:{type:r.Boolean(),isOptional:!0},scheduleCron:{type:r.String_unsecure(),isOptional:!0}}}),l=i({name:`AddFieldMappingInput`,fields:{syncConfigId:{type:r.String_unsecure(),isOptional:!1},sourceField:{type:r.NonEmptyString(),isOptional:!1},targetField:{type:r.NonEmptyString(),isOptional:!1},mappingType:{type:e,isOptional:!1},transformExpression:{type:r.String_unsecure(),isOptional:!0},lookupConfig:{type:r.JSON(),isOptional:!0},constantValue:{type:r.JSON(),isOptional:!0},isRequired:{type:r.Boolean(),isOptional:!0},defaultValue:{type:r.JSON(),isOptional:!0}}}),u=i({name:`TriggerSyncInput`,fields:{syncConfigId:{type:r.String_unsecure(),isOptional:!1},direction:{type:t,isOptional:!0},fullSync:{type:r.Boolean(),isOptional:!0}}}),d=i({name:`ListSyncRunsInput`,fields:{syncConfigId:{type:r.String_unsecure(),isOptional:!1},status:{type:n,isOptional:!0},limit:{type:r.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:r.Int_unsecure(),isOptional:!0,defaultValue:0}}}),f=i({name:`ListSyncRunsOutput`,fields:{runs:{type:s,isArray:!0,isOptional:!1},total:{type:r.Int_unsecure(),isOptional:!1}}});export{l as AddFieldMappingInputModel,c as CreateSyncConfigInputModel,a as FieldMappingModel,d as ListSyncRunsInputModel,f as ListSyncRunsOutputModel,o as SyncConfigModel,s as SyncRunModel,u as TriggerSyncInputModel};
|
|
@@ -1,146 +1 @@
|
|
|
1
|
-
|
|
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 };
|
|
1
|
+
var e=class{transform(e,t){try{if(t.startsWith(`uppercase`))return typeof e==`string`?e.toUpperCase():e;if(t.startsWith(`lowercase`))return typeof e==`string`?e.toLowerCase():e;if(t.startsWith(`trim`))return typeof e==`string`?e.trim():e;if(t.startsWith(`default:`)){let n=t.replace(`default:`,``);return e??JSON.parse(n)}if(t.startsWith(`concat:`)){let n=t.replace(`concat:`,``)||` `;return Array.isArray(e)?e.join(n):e}if(t.startsWith(`split:`)){let n=t.replace(`split:`,``)||`,`;return typeof e==`string`?e.split(n):e}return t.startsWith(`number`)?Number(e):t.startsWith(`boolean`)?!!e:t.startsWith(`string`)?String(e):e}catch{return e}}},t=class{transformer;constructor(t){this.transformer=t??new e}async sync(e){return{success:!0,recordsProcessed:0,recordsCreated:0,recordsUpdated:0,recordsDeleted:0,recordsFailed:0,recordsSkipped:0,errors:[]}}transformRecord(e,t,n){let r={};for(let n of t){let t;switch(n.mappingType){case`DIRECT`:t=this.getNestedValue(e.data,n.sourceField);break;case`TRANSFORM`:let r=this.getNestedValue(e.data,n.sourceField);t=n.transformExpression?this.transformer.transform(r,n.transformExpression):r;break;case`CONSTANT`:t=n.constantValue;break;case`LOOKUP`:t=this.getNestedValue(e.data,n.sourceField);break;case`COMPUTED`:t=n.transformExpression?this.evaluateComputed(e.data,n.transformExpression):null;break;default:t=this.getNestedValue(e.data,n.sourceField)}t??=n.defaultValue,this.setNestedValue(r,n.targetField,t)}return{id:e.id,data:r}}validateRecord(e,t){let n=[];for(let r of t)r.isRequired&&(this.getNestedValue(e.data,r.targetField)??n.push({recordId:e.id,field:r.targetField,message:`Required field ${r.targetField} is missing`,code:`REQUIRED_FIELD_MISSING`}));return{valid:n.length===0,errors:n}}getNestedValue(e,t){let n=t.split(`.`),r=e;for(let e of n){if(r==null)return;r=r[e]}return r}setNestedValue(e,t,n){let r=t.split(`.`),i=e;for(let e=0;e<r.length-1;e++){let t=r[e];t!==void 0&&(t in i||(i[t]={}),i=i[t])}let a=r[r.length-1];a!==void 0&&(i[a]=n)}evaluateComputed(e,t){try{return t.replace(/\$\{([^}]+)\}/g,(t,n)=>{let r=this.getNestedValue(e,n);return String(r??``)})}catch{return null}}};function n(e){return new t(e)}function r(e){let t=JSON.stringify(e,Object.keys(e).sort()),n=0;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);n=(n<<5)-n+r,n&=n}return n.toString(16)}function i(e,t){return!e||!t?!0:e!==t}export{e as BasicFieldTransformer,t as BasicSyncEngine,r as computeChecksum,n as createSyncEngine,i as hasChanges};
|