@contractspec/example.integration-hub 1.57.0 → 1.58.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/browser/connection/connection.enum.js +12 -0
- package/dist/browser/connection/connection.operation.js +101 -0
- package/dist/browser/connection/connection.presentation.js +99 -0
- package/dist/browser/connection/connection.schema.js +48 -0
- package/dist/browser/connection/index.js +104 -0
- package/dist/browser/docs/index.js +104 -0
- package/dist/browser/docs/integration-hub.docblock.js +104 -0
- package/dist/browser/events.js +211 -0
- package/dist/browser/example.js +42 -0
- package/dist/browser/handlers/index.js +246 -0
- package/dist/browser/handlers/integration.handlers.js +246 -0
- package/dist/browser/index.js +1595 -0
- package/dist/browser/integration/index.js +92 -0
- package/dist/browser/integration/integration.enum.js +12 -0
- package/dist/browser/integration/integration.operations.js +89 -0
- package/dist/browser/integration/integration.presentation.js +117 -0
- package/dist/browser/integration/integration.schema.js +42 -0
- package/dist/browser/integration-hub.capability.js +40 -0
- package/dist/browser/integration-hub.feature.js +114 -0
- package/dist/browser/seeders/index.js +60 -0
- package/dist/browser/sync/index.js +332 -0
- package/dist/browser/sync/sync.enum.js +26 -0
- package/dist/browser/sync/sync.operations.js +321 -0
- package/dist/browser/sync/sync.presentation.js +298 -0
- package/dist/browser/sync/sync.schema.js +154 -0
- package/dist/browser/sync-engine/index.js +186 -0
- package/dist/browser/tests/operations.test-spec.js +85 -0
- package/dist/browser/ui/IntegrationDashboard.js +369 -0
- package/dist/browser/ui/hooks/index.js +57 -0
- package/dist/browser/ui/hooks/useIntegrationData.js +54 -0
- package/dist/browser/ui/index.js +644 -0
- package/dist/browser/ui/renderers/index.js +273 -0
- package/dist/browser/ui/renderers/integration.markdown.js +273 -0
- package/dist/connection/connection.enum.d.ts +1 -6
- package/dist/connection/connection.enum.d.ts.map +1 -1
- package/dist/connection/connection.enum.js +11 -15
- package/dist/connection/connection.operation.d.ts +78 -84
- package/dist/connection/connection.operation.d.ts.map +1 -1
- package/dist/connection/connection.operation.js +99 -60
- package/dist/connection/connection.presentation.d.ts +2 -7
- package/dist/connection/connection.presentation.d.ts.map +1 -1
- package/dist/connection/connection.presentation.js +96 -56
- package/dist/connection/connection.schema.d.ts +54 -59
- package/dist/connection/connection.schema.d.ts.map +1 -1
- package/dist/connection/connection.schema.js +46 -73
- package/dist/connection/index.d.ts +7 -4
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/connection/index.js +104 -4
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +105 -1
- package/dist/docs/integration-hub.docblock.d.ts +2 -1
- package/dist/docs/integration-hub.docblock.d.ts.map +1 -0
- package/dist/docs/integration-hub.docblock.js +45 -56
- package/dist/events.d.ts +137 -143
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +210 -287
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +41 -55
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +247 -3
- package/dist/handlers/integration.handlers.d.ts +114 -113
- package/dist/handlers/integration.handlers.d.ts.map +1 -1
- package/dist/handlers/integration.handlers.js +232 -267
- package/dist/index.d.ts +12 -19
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1596 -20
- package/dist/integration/index.d.ts +7 -4
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/index.js +92 -4
- package/dist/integration/integration.enum.d.ts +1 -6
- package/dist/integration/integration.enum.d.ts.map +1 -1
- package/dist/integration/integration.enum.js +11 -15
- package/dist/integration/integration.operations.d.ts +74 -80
- package/dist/integration/integration.operations.d.ts.map +1 -1
- package/dist/integration/integration.operations.js +87 -54
- package/dist/integration/integration.presentation.d.ts +3 -8
- package/dist/integration/integration.presentation.d.ts.map +1 -1
- package/dist/integration/integration.presentation.js +114 -73
- package/dist/integration/integration.schema.d.ts +54 -59
- package/dist/integration/integration.schema.d.ts.map +1 -1
- package/dist/integration/integration.schema.js +40 -73
- package/dist/integration-hub.capability.d.ts +3 -8
- package/dist/integration-hub.capability.d.ts.map +1 -1
- package/dist/integration-hub.capability.js +41 -38
- package/dist/integration-hub.feature.d.ts +1 -6
- package/dist/integration-hub.feature.d.ts.map +1 -1
- package/dist/integration-hub.feature.js +113 -242
- package/dist/node/connection/connection.enum.js +12 -0
- package/dist/node/connection/connection.operation.js +101 -0
- package/dist/node/connection/connection.presentation.js +99 -0
- package/dist/node/connection/connection.schema.js +48 -0
- package/dist/node/connection/index.js +104 -0
- package/dist/node/docs/index.js +104 -0
- package/dist/node/docs/integration-hub.docblock.js +104 -0
- package/dist/node/events.js +211 -0
- package/dist/node/example.js +42 -0
- package/dist/node/handlers/index.js +246 -0
- package/dist/node/handlers/integration.handlers.js +246 -0
- package/dist/node/index.js +1595 -0
- package/dist/node/integration/index.js +92 -0
- package/dist/node/integration/integration.enum.js +12 -0
- package/dist/node/integration/integration.operations.js +89 -0
- package/dist/node/integration/integration.presentation.js +117 -0
- package/dist/node/integration/integration.schema.js +42 -0
- package/dist/node/integration-hub.capability.js +40 -0
- package/dist/node/integration-hub.feature.js +114 -0
- package/dist/node/seeders/index.js +60 -0
- package/dist/node/sync/index.js +332 -0
- package/dist/node/sync/sync.enum.js +26 -0
- package/dist/node/sync/sync.operations.js +321 -0
- package/dist/node/sync/sync.presentation.js +298 -0
- package/dist/node/sync/sync.schema.js +154 -0
- package/dist/node/sync-engine/index.js +186 -0
- package/dist/node/tests/operations.test-spec.js +85 -0
- package/dist/node/ui/IntegrationDashboard.js +369 -0
- package/dist/node/ui/hooks/index.js +57 -0
- package/dist/node/ui/hooks/useIntegrationData.js +54 -0
- package/dist/node/ui/index.js +644 -0
- package/dist/node/ui/renderers/index.js +273 -0
- package/dist/node/ui/renderers/integration.markdown.js +273 -0
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +54 -52
- package/dist/sync/index.d.ts +7 -4
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +332 -4
- package/dist/sync/sync.enum.d.ts +3 -8
- package/dist/sync/sync.enum.d.ts.map +1 -1
- package/dist/sync/sync.enum.js +23 -31
- package/dist/sync/sync.operations.d.ts +413 -419
- package/dist/sync/sync.operations.d.ts.map +1 -1
- package/dist/sync/sync.operations.js +316 -197
- package/dist/sync/sync.presentation.d.ts +6 -11
- package/dist/sync/sync.presentation.d.ts.map +1 -1
- package/dist/sync/sync.presentation.js +291 -160
- package/dist/sync/sync.schema.d.ts +317 -322
- package/dist/sync/sync.schema.d.ts.map +1 -1
- package/dist/sync/sync.schema.js +146 -295
- package/dist/sync-engine/index.d.ts +88 -91
- package/dist/sync-engine/index.d.ts.map +1 -1
- package/dist/sync-engine/index.js +181 -142
- package/dist/tests/operations.test-spec.d.ts +3 -8
- package/dist/tests/operations.test-spec.d.ts.map +1 -1
- package/dist/tests/operations.test-spec.js +82 -90
- package/dist/ui/IntegrationDashboard.d.ts +1 -6
- package/dist/ui/IntegrationDashboard.d.ts.map +1 -1
- package/dist/ui/IntegrationDashboard.js +365 -261
- package/dist/ui/hooks/index.d.ts +2 -2
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +57 -4
- package/dist/ui/hooks/useIntegrationData.d.ts +16 -20
- package/dist/ui/hooks/useIntegrationData.d.ts.map +1 -1
- package/dist/ui/hooks/useIntegrationData.js +51 -55
- package/dist/ui/index.d.ts +7 -6
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +644 -5
- package/dist/ui/renderers/index.d.ts +2 -2
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +274 -3
- package/dist/ui/renderers/integration.markdown.d.ts +13 -14
- package/dist/ui/renderers/integration.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/integration.markdown.js +268 -264
- package/package.json +360 -71
- package/dist/connection/connection.enum.js.map +0 -1
- package/dist/connection/connection.operation.js.map +0 -1
- package/dist/connection/connection.presentation.js.map +0 -1
- package/dist/connection/connection.schema.js.map +0 -1
- package/dist/docs/integration-hub.docblock.js.map +0 -1
- package/dist/events.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/integration.handlers.js.map +0 -1
- package/dist/integration/integration.enum.js.map +0 -1
- package/dist/integration/integration.operations.js.map +0 -1
- package/dist/integration/integration.presentation.js.map +0 -1
- package/dist/integration/integration.schema.js.map +0 -1
- package/dist/integration-hub.capability.js.map +0 -1
- package/dist/integration-hub.feature.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/sync/sync.enum.js.map +0 -1
- package/dist/sync/sync.operations.js.map +0 -1
- package/dist/sync/sync.presentation.js.map +0 -1
- package/dist/sync/sync.schema.js.map +0 -1
- package/dist/sync-engine/index.js.map +0 -1
- package/dist/tests/operations.test-spec.js.map +0 -1
- package/dist/ui/IntegrationDashboard.js.map +0 -1
- package/dist/ui/hooks/useIntegrationData.js.map +0 -1
- package/dist/ui/renderers/integration.markdown.js.map +0 -1
package/dist/sync/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
1
|
+
/**
|
|
2
|
+
* Sync domain - Sync configuration and execution.
|
|
3
|
+
*/
|
|
4
|
+
export { SyncDirectionEnum, SyncStatusEnum, MappingTypeEnum, } from './sync.enum';
|
|
5
|
+
export { FieldMappingModel, SyncConfigModel, SyncRunModel, CreateSyncConfigInputModel, AddFieldMappingInputModel, TriggerSyncInputModel, ListSyncRunsInputModel, ListSyncRunsOutputModel, } from './sync.schema';
|
|
6
|
+
export { CreateSyncConfigContract, AddFieldMappingContract, TriggerSyncContract, ListSyncRunsContract, } from './sync.operations';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
|
package/dist/sync/index.js
CHANGED
|
@@ -1,5 +1,333 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
// @bun
|
|
2
|
+
// src/sync/sync.enum.ts
|
|
3
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
4
|
+
var SyncDirectionEnum = defineEnum("SyncDirection", [
|
|
5
|
+
"INBOUND",
|
|
6
|
+
"OUTBOUND",
|
|
7
|
+
"BIDIRECTIONAL"
|
|
8
|
+
]);
|
|
9
|
+
var SyncStatusEnum = defineEnum("SyncStatus", [
|
|
10
|
+
"PENDING",
|
|
11
|
+
"RUNNING",
|
|
12
|
+
"COMPLETED",
|
|
13
|
+
"FAILED",
|
|
14
|
+
"CANCELLED"
|
|
15
|
+
]);
|
|
16
|
+
var MappingTypeEnum = defineEnum("MappingType", [
|
|
17
|
+
"DIRECT",
|
|
18
|
+
"TRANSFORM",
|
|
19
|
+
"LOOKUP",
|
|
20
|
+
"CONSTANT",
|
|
21
|
+
"COMPUTED"
|
|
22
|
+
]);
|
|
4
23
|
|
|
5
|
-
|
|
24
|
+
// src/sync/sync.schema.ts
|
|
25
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
26
|
+
var FieldMappingModel = defineSchemaModel({
|
|
27
|
+
name: "FieldMappingModel",
|
|
28
|
+
fields: {
|
|
29
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
30
|
+
sourceField: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
31
|
+
targetField: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
32
|
+
mappingType: { type: MappingTypeEnum, isOptional: false },
|
|
33
|
+
transformExpression: {
|
|
34
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
35
|
+
isOptional: true
|
|
36
|
+
},
|
|
37
|
+
isRequired: { type: ScalarTypeEnum.Boolean(), isOptional: false }
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
var SyncConfigModel = defineSchemaModel({
|
|
41
|
+
name: "SyncConfigModel",
|
|
42
|
+
fields: {
|
|
43
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
44
|
+
integrationId: {
|
|
45
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
46
|
+
isOptional: false
|
|
47
|
+
},
|
|
48
|
+
connectionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
49
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
50
|
+
direction: { type: SyncDirectionEnum, isOptional: false },
|
|
51
|
+
sourceObject: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
52
|
+
targetObject: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
53
|
+
scheduleEnabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
54
|
+
scheduleCron: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
55
|
+
isActive: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
56
|
+
lastSyncAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
57
|
+
fieldMappings: { type: FieldMappingModel, isArray: true, isOptional: true }
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var SyncRunModel = defineSchemaModel({
|
|
61
|
+
name: "SyncRunModel",
|
|
62
|
+
fields: {
|
|
63
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
64
|
+
syncConfigId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
65
|
+
status: { type: SyncStatusEnum, isOptional: false },
|
|
66
|
+
direction: { type: SyncDirectionEnum, isOptional: false },
|
|
67
|
+
trigger: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
68
|
+
recordsProcessed: {
|
|
69
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
70
|
+
isOptional: false
|
|
71
|
+
},
|
|
72
|
+
recordsCreated: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
73
|
+
recordsUpdated: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
74
|
+
recordsFailed: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
75
|
+
errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
76
|
+
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
77
|
+
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
78
|
+
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
var CreateSyncConfigInputModel = defineSchemaModel({
|
|
82
|
+
name: "CreateSyncConfigInput",
|
|
83
|
+
fields: {
|
|
84
|
+
integrationId: {
|
|
85
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
86
|
+
isOptional: false
|
|
87
|
+
},
|
|
88
|
+
connectionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
89
|
+
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
90
|
+
direction: { type: SyncDirectionEnum, isOptional: false },
|
|
91
|
+
sourceObject: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
92
|
+
targetObject: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
93
|
+
scheduleEnabled: { type: ScalarTypeEnum.Boolean(), isOptional: true },
|
|
94
|
+
scheduleCron: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
var AddFieldMappingInputModel = defineSchemaModel({
|
|
98
|
+
name: "AddFieldMappingInput",
|
|
99
|
+
fields: {
|
|
100
|
+
syncConfigId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
101
|
+
sourceField: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
102
|
+
targetField: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
103
|
+
mappingType: { type: MappingTypeEnum, isOptional: false },
|
|
104
|
+
transformExpression: {
|
|
105
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
106
|
+
isOptional: true
|
|
107
|
+
},
|
|
108
|
+
lookupConfig: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
109
|
+
constantValue: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
110
|
+
isRequired: { type: ScalarTypeEnum.Boolean(), isOptional: true },
|
|
111
|
+
defaultValue: { type: ScalarTypeEnum.JSON(), isOptional: true }
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
var TriggerSyncInputModel = defineSchemaModel({
|
|
115
|
+
name: "TriggerSyncInput",
|
|
116
|
+
fields: {
|
|
117
|
+
syncConfigId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
118
|
+
direction: { type: SyncDirectionEnum, isOptional: true },
|
|
119
|
+
fullSync: { type: ScalarTypeEnum.Boolean(), isOptional: true }
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
var ListSyncRunsInputModel = defineSchemaModel({
|
|
123
|
+
name: "ListSyncRunsInput",
|
|
124
|
+
fields: {
|
|
125
|
+
syncConfigId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
126
|
+
status: { type: SyncStatusEnum, isOptional: true },
|
|
127
|
+
limit: {
|
|
128
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
129
|
+
isOptional: true,
|
|
130
|
+
defaultValue: 20
|
|
131
|
+
},
|
|
132
|
+
offset: {
|
|
133
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
134
|
+
isOptional: true,
|
|
135
|
+
defaultValue: 0
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
var ListSyncRunsOutputModel = defineSchemaModel({
|
|
140
|
+
name: "ListSyncRunsOutput",
|
|
141
|
+
fields: {
|
|
142
|
+
runs: { type: SyncRunModel, isArray: true, isOptional: false },
|
|
143
|
+
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// src/sync/sync.operations.ts
|
|
148
|
+
import {
|
|
149
|
+
defineCommand,
|
|
150
|
+
defineQuery
|
|
151
|
+
} from "@contractspec/lib.contracts/operations";
|
|
152
|
+
var OWNERS = ["@example.integration-hub"];
|
|
153
|
+
var CreateSyncConfigContract = defineCommand({
|
|
154
|
+
meta: {
|
|
155
|
+
key: "integration.syncConfig.create",
|
|
156
|
+
version: "1.0.0",
|
|
157
|
+
stability: "stable",
|
|
158
|
+
owners: [...OWNERS],
|
|
159
|
+
tags: ["integration", "sync", "config", "create"],
|
|
160
|
+
description: "Create a sync configuration.",
|
|
161
|
+
goal: "Define how data should be synchronized.",
|
|
162
|
+
context: "Sync setup."
|
|
163
|
+
},
|
|
164
|
+
io: { input: CreateSyncConfigInputModel, output: SyncConfigModel },
|
|
165
|
+
policy: { auth: "user" },
|
|
166
|
+
sideEffects: {
|
|
167
|
+
emits: [
|
|
168
|
+
{
|
|
169
|
+
key: "integration.syncConfig.created",
|
|
170
|
+
version: "1.0.0",
|
|
171
|
+
when: "Sync config created",
|
|
172
|
+
payload: SyncConfigModel
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
audit: ["integration.syncConfig.created"]
|
|
176
|
+
},
|
|
177
|
+
acceptance: {
|
|
178
|
+
scenarios: [
|
|
179
|
+
{
|
|
180
|
+
key: "create-sync-happy-path",
|
|
181
|
+
given: ["User is authenticated"],
|
|
182
|
+
when: ["User creates sync config"],
|
|
183
|
+
then: ["Sync config is created", "SyncConfigCreated event is emitted"]
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
examples: [
|
|
187
|
+
{
|
|
188
|
+
key: "create-contact-sync",
|
|
189
|
+
input: {
|
|
190
|
+
name: "Contacts Sync",
|
|
191
|
+
sourceConnectionId: "conn-1",
|
|
192
|
+
targetConnectionId: "conn-2"
|
|
193
|
+
},
|
|
194
|
+
output: { id: "sync-123", status: "active" }
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
var AddFieldMappingContract = defineCommand({
|
|
200
|
+
meta: {
|
|
201
|
+
key: "integration.fieldMapping.add",
|
|
202
|
+
version: "1.0.0",
|
|
203
|
+
stability: "stable",
|
|
204
|
+
owners: [...OWNERS],
|
|
205
|
+
tags: ["integration", "mapping", "field"],
|
|
206
|
+
description: "Add a field mapping to a sync config.",
|
|
207
|
+
goal: "Map fields between systems.",
|
|
208
|
+
context: "Mapping configuration."
|
|
209
|
+
},
|
|
210
|
+
io: { input: AddFieldMappingInputModel, output: FieldMappingModel },
|
|
211
|
+
policy: { auth: "user" },
|
|
212
|
+
sideEffects: {
|
|
213
|
+
emits: [
|
|
214
|
+
{
|
|
215
|
+
key: "integration.fieldMapping.added",
|
|
216
|
+
version: "1.0.0",
|
|
217
|
+
when: "Mapping added",
|
|
218
|
+
payload: FieldMappingModel
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
acceptance: {
|
|
223
|
+
scenarios: [
|
|
224
|
+
{
|
|
225
|
+
key: "add-mapping-happy-path",
|
|
226
|
+
given: ["Sync config exists"],
|
|
227
|
+
when: ["User adds field mapping"],
|
|
228
|
+
then: ["Mapping is added", "FieldMappingAdded event is emitted"]
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
examples: [
|
|
232
|
+
{
|
|
233
|
+
key: "map-email",
|
|
234
|
+
input: {
|
|
235
|
+
syncConfigId: "sync-123",
|
|
236
|
+
sourceField: "email",
|
|
237
|
+
targetField: "user_email"
|
|
238
|
+
},
|
|
239
|
+
output: { id: "map-456", type: "string" }
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
var TriggerSyncContract = defineCommand({
|
|
245
|
+
meta: {
|
|
246
|
+
key: "integration.sync.trigger",
|
|
247
|
+
version: "1.0.0",
|
|
248
|
+
stability: "stable",
|
|
249
|
+
owners: [...OWNERS],
|
|
250
|
+
tags: ["integration", "sync", "trigger"],
|
|
251
|
+
description: "Trigger a manual sync.",
|
|
252
|
+
goal: "Start data synchronization.",
|
|
253
|
+
context: "Manual sync or webhook trigger."
|
|
254
|
+
},
|
|
255
|
+
io: { input: TriggerSyncInputModel, output: SyncRunModel },
|
|
256
|
+
policy: { auth: "user" },
|
|
257
|
+
sideEffects: {
|
|
258
|
+
emits: [
|
|
259
|
+
{
|
|
260
|
+
key: "integration.sync.started",
|
|
261
|
+
version: "1.0.0",
|
|
262
|
+
when: "Sync starts",
|
|
263
|
+
payload: SyncRunModel
|
|
264
|
+
}
|
|
265
|
+
],
|
|
266
|
+
audit: ["integration.sync.triggered"]
|
|
267
|
+
},
|
|
268
|
+
acceptance: {
|
|
269
|
+
scenarios: [
|
|
270
|
+
{
|
|
271
|
+
key: "trigger-sync-happy-path",
|
|
272
|
+
given: ["Sync config exists"],
|
|
273
|
+
when: ["User triggers sync"],
|
|
274
|
+
then: ["Sync run starts", "SyncStarted event is emitted"]
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
examples: [
|
|
278
|
+
{
|
|
279
|
+
key: "manual-trigger",
|
|
280
|
+
input: { syncConfigId: "sync-123" },
|
|
281
|
+
output: { id: "run-789", status: "pending" }
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
var ListSyncRunsContract = defineQuery({
|
|
287
|
+
meta: {
|
|
288
|
+
key: "integration.syncRun.list",
|
|
289
|
+
version: "1.0.0",
|
|
290
|
+
stability: "stable",
|
|
291
|
+
owners: [...OWNERS],
|
|
292
|
+
tags: ["integration", "sync", "run", "list"],
|
|
293
|
+
description: "List sync run history.",
|
|
294
|
+
goal: "View sync history and status.",
|
|
295
|
+
context: "Sync monitoring."
|
|
296
|
+
},
|
|
297
|
+
io: { input: ListSyncRunsInputModel, output: ListSyncRunsOutputModel },
|
|
298
|
+
policy: { auth: "user" },
|
|
299
|
+
acceptance: {
|
|
300
|
+
scenarios: [
|
|
301
|
+
{
|
|
302
|
+
key: "list-runs-happy-path",
|
|
303
|
+
given: ["User has access to syncs"],
|
|
304
|
+
when: ["User lists sync runs"],
|
|
305
|
+
then: ["List of runs is returned"]
|
|
306
|
+
}
|
|
307
|
+
],
|
|
308
|
+
examples: [
|
|
309
|
+
{
|
|
310
|
+
key: "list-recent",
|
|
311
|
+
input: { limit: 10 },
|
|
312
|
+
output: { items: [], total: 50 }
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
export {
|
|
318
|
+
TriggerSyncInputModel,
|
|
319
|
+
TriggerSyncContract,
|
|
320
|
+
SyncStatusEnum,
|
|
321
|
+
SyncRunModel,
|
|
322
|
+
SyncDirectionEnum,
|
|
323
|
+
SyncConfigModel,
|
|
324
|
+
MappingTypeEnum,
|
|
325
|
+
ListSyncRunsOutputModel,
|
|
326
|
+
ListSyncRunsInputModel,
|
|
327
|
+
ListSyncRunsContract,
|
|
328
|
+
FieldMappingModel,
|
|
329
|
+
CreateSyncConfigInputModel,
|
|
330
|
+
CreateSyncConfigContract,
|
|
331
|
+
AddFieldMappingInputModel,
|
|
332
|
+
AddFieldMappingContract
|
|
333
|
+
};
|
package/dist/sync/sync.enum.d.ts
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import * as _contractspec_lib_schema0 from "@contractspec/lib.schema";
|
|
2
|
-
|
|
3
|
-
//#region src/sync/sync.enum.d.ts
|
|
4
1
|
/**
|
|
5
2
|
* Sync direction enum.
|
|
6
3
|
*/
|
|
7
|
-
declare const SyncDirectionEnum:
|
|
4
|
+
export declare const SyncDirectionEnum: import("@contractspec/lib.schema").EnumType<[string, string, string]>;
|
|
8
5
|
/**
|
|
9
6
|
* Sync status enum.
|
|
10
7
|
*/
|
|
11
|
-
declare const SyncStatusEnum:
|
|
8
|
+
export declare const SyncStatusEnum: import("@contractspec/lib.schema").EnumType<[string, string, string, string, string]>;
|
|
12
9
|
/**
|
|
13
10
|
* Mapping type enum.
|
|
14
11
|
*/
|
|
15
|
-
declare const MappingTypeEnum:
|
|
16
|
-
//#endregion
|
|
17
|
-
export { MappingTypeEnum, SyncDirectionEnum, SyncStatusEnum };
|
|
12
|
+
export declare const MappingTypeEnum: import("@contractspec/lib.schema").EnumType<[string, string, string, string, string]>;
|
|
18
13
|
//# sourceMappingURL=sync.enum.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.enum.d.ts","
|
|
1
|
+
{"version":3,"file":"sync.enum.d.ts","sourceRoot":"","sources":["../../src/sync/sync.enum.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,iBAAiB,uEAI5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,uFAMzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,uFAM1B,CAAC"}
|
package/dist/sync/sync.enum.js
CHANGED
|
@@ -1,35 +1,27 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/sync/sync.enum.ts
|
|
1
3
|
import { defineEnum } from "@contractspec/lib.schema";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
const SyncDirectionEnum = defineEnum("SyncDirection", [
|
|
8
|
-
"INBOUND",
|
|
9
|
-
"OUTBOUND",
|
|
10
|
-
"BIDIRECTIONAL"
|
|
4
|
+
var SyncDirectionEnum = defineEnum("SyncDirection", [
|
|
5
|
+
"INBOUND",
|
|
6
|
+
"OUTBOUND",
|
|
7
|
+
"BIDIRECTIONAL"
|
|
11
8
|
]);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"COMPLETED",
|
|
19
|
-
"FAILED",
|
|
20
|
-
"CANCELLED"
|
|
9
|
+
var SyncStatusEnum = defineEnum("SyncStatus", [
|
|
10
|
+
"PENDING",
|
|
11
|
+
"RUNNING",
|
|
12
|
+
"COMPLETED",
|
|
13
|
+
"FAILED",
|
|
14
|
+
"CANCELLED"
|
|
21
15
|
]);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"LOOKUP",
|
|
29
|
-
"CONSTANT",
|
|
30
|
-
"COMPUTED"
|
|
16
|
+
var MappingTypeEnum = defineEnum("MappingType", [
|
|
17
|
+
"DIRECT",
|
|
18
|
+
"TRANSFORM",
|
|
19
|
+
"LOOKUP",
|
|
20
|
+
"CONSTANT",
|
|
21
|
+
"COMPUTED"
|
|
31
22
|
]);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
export {
|
|
24
|
+
SyncStatusEnum,
|
|
25
|
+
SyncDirectionEnum,
|
|
26
|
+
MappingTypeEnum
|
|
27
|
+
};
|