@contractspec/example.integration-hub 3.8.9 → 3.8.10
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.enum.js +1 -29
- package/dist/connection/connection.operation.js +1 -124
- package/dist/connection/connection.presentation.js +1 -125
- package/dist/connection/connection.schema.js +1 -71
- package/dist/connection/index.js +1 -127
- package/dist/docs/index.js +5 -49
- package/dist/docs/integration-hub.docblock.js +5 -49
- package/dist/events.js +1 -211
- package/dist/example.js +1 -42
- package/dist/handlers/index.js +5 -292
- package/dist/handlers/integration.handlers.js +5 -292
- package/dist/index.js +8 -2355
- package/dist/integration/index.js +1 -92
- package/dist/integration/integration.enum.js +1 -12
- package/dist/integration/integration.operations.js +1 -89
- package/dist/integration/integration.presentation.js +1 -120
- package/dist/integration/integration.schema.js +1 -42
- package/dist/integration-hub.capability.js +1 -43
- package/dist/integration-hub.feature.js +1 -330
- package/dist/mcp-example.js +1 -154
- package/dist/node/connection/connection.enum.js +1 -29
- package/dist/node/connection/connection.operation.js +1 -124
- package/dist/node/connection/connection.presentation.js +1 -125
- package/dist/node/connection/connection.schema.js +1 -71
- package/dist/node/connection/index.js +1 -127
- package/dist/node/docs/index.js +5 -49
- package/dist/node/docs/integration-hub.docblock.js +5 -49
- package/dist/node/events.js +1 -211
- package/dist/node/example.js +1 -42
- package/dist/node/handlers/index.js +5 -292
- package/dist/node/handlers/integration.handlers.js +5 -292
- package/dist/node/index.js +8 -2355
- package/dist/node/integration/index.js +1 -92
- package/dist/node/integration/integration.enum.js +1 -12
- package/dist/node/integration/integration.operations.js +1 -89
- package/dist/node/integration/integration.presentation.js +1 -120
- package/dist/node/integration/integration.schema.js +1 -42
- package/dist/node/integration-hub.capability.js +1 -43
- package/dist/node/integration-hub.feature.js +1 -330
- package/dist/node/mcp-example.js +1 -154
- package/dist/node/run-mcp.js +1 -159
- package/dist/node/seeders/index.js +6 -60
- package/dist/node/sync/index.js +1 -332
- package/dist/node/sync/sync.enum.js +1 -26
- package/dist/node/sync/sync.operations.js +1 -321
- package/dist/node/sync/sync.presentation.js +1 -301
- package/dist/node/sync/sync.schema.js +1 -154
- package/dist/node/sync-engine/index.js +1 -186
- package/dist/node/tests/operations.test-spec.js +1 -85
- package/dist/node/ui/IntegrationDashboard.js +1 -886
- package/dist/node/ui/IntegrationDashboard.visualizations.js +1 -250
- package/dist/node/ui/IntegrationHubChat.js +1 -34
- package/dist/node/ui/hooks/index.js +1 -57
- package/dist/node/ui/hooks/useIntegrationData.js +1 -54
- package/dist/node/ui/index.js +4 -1173
- package/dist/node/ui/renderers/index.js +4 -484
- package/dist/node/ui/renderers/integration.markdown.js +4 -484
- package/dist/node/ui/tables/ConnectionsTable.js +1 -211
- package/dist/node/ui/tables/IntegrationTables.js +1 -361
- package/dist/node/ui/tables/SyncConfigsTable.js +1 -230
- package/dist/node/ui/tables/integration-table.shared.js +1 -84
- package/dist/node/visualizations/catalog.js +1 -137
- package/dist/node/visualizations/index.js +1 -211
- package/dist/node/visualizations/selectors.js +1 -204
- package/dist/run-mcp.js +1 -159
- package/dist/seeders/index.js +6 -60
- package/dist/sync/index.js +1 -332
- package/dist/sync/sync.enum.js +1 -26
- package/dist/sync/sync.operations.js +1 -321
- package/dist/sync/sync.presentation.js +1 -301
- package/dist/sync/sync.schema.js +1 -154
- package/dist/sync-engine/index.js +1 -186
- package/dist/tests/operations.test-spec.js +1 -85
- package/dist/ui/IntegrationDashboard.js +1 -886
- package/dist/ui/IntegrationDashboard.visualizations.js +1 -250
- package/dist/ui/IntegrationHubChat.js +1 -34
- package/dist/ui/hooks/index.js +1 -57
- package/dist/ui/hooks/useIntegrationData.js +1 -54
- package/dist/ui/index.js +4 -1173
- package/dist/ui/renderers/index.js +4 -484
- package/dist/ui/renderers/integration.markdown.js +4 -484
- package/dist/ui/tables/ConnectionsTable.js +1 -211
- package/dist/ui/tables/IntegrationTables.js +1 -361
- package/dist/ui/tables/SyncConfigsTable.js +1 -230
- package/dist/ui/tables/integration-table.shared.js +1 -84
- package/dist/visualizations/catalog.js +1 -137
- package/dist/visualizations/index.js +1 -211
- package/dist/visualizations/selectors.js +1 -204
- package/package.json +11 -11
|
@@ -1,60 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
8
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
9
|
-
"int_1",
|
|
10
|
-
projectId,
|
|
11
|
-
"org_demo",
|
|
12
|
-
"Salesforce",
|
|
13
|
-
"Salesforce CRM integration",
|
|
14
|
-
"CRM",
|
|
15
|
-
"ACTIVE"
|
|
16
|
-
]);
|
|
17
|
-
await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
18
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
19
|
-
"int_2",
|
|
20
|
-
projectId,
|
|
21
|
-
"org_demo",
|
|
22
|
-
"Meeting Recorder",
|
|
23
|
-
"Meeting recorder transcripts and metadata",
|
|
24
|
-
"DATA",
|
|
25
|
-
"ACTIVE"
|
|
26
|
-
]);
|
|
27
|
-
await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
28
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
29
|
-
"int_3",
|
|
30
|
-
projectId,
|
|
31
|
-
"org_demo",
|
|
32
|
-
"Gradium Voice",
|
|
33
|
-
"Gradium low-latency text-to-speech integration",
|
|
34
|
-
"COMMUNICATION",
|
|
35
|
-
"ACTIVE"
|
|
36
|
-
]);
|
|
37
|
-
await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
38
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
39
|
-
"int_4",
|
|
40
|
-
projectId,
|
|
41
|
-
"org_demo",
|
|
42
|
-
"Fal Chatterbox Voice",
|
|
43
|
-
"Fal Chatterbox text-to-speech integration",
|
|
44
|
-
"COMMUNICATION",
|
|
45
|
-
"ACTIVE"
|
|
46
|
-
]);
|
|
47
|
-
await db.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
48
|
-
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
49
|
-
"int_5",
|
|
50
|
-
projectId,
|
|
51
|
-
"org_demo",
|
|
52
|
-
"PostHog Analytics",
|
|
53
|
-
"Product analytics and event capture",
|
|
54
|
-
"ANALYTICS",
|
|
55
|
-
"ACTIVE"
|
|
56
|
-
]);
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
seedIntegrationHub
|
|
60
|
-
};
|
|
1
|
+
async function o(i){let{projectId:t,db:e}=i;if((await e.query('SELECT COUNT(*) as count FROM integration WHERE "projectId" = $1',[t])).rows[0]?.count>0)return;await e.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
2
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7)`,["int_1",t,"org_demo","Salesforce","Salesforce CRM integration","CRM","ACTIVE"]),await e.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
3
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7)`,["int_2",t,"org_demo","Meeting Recorder","Meeting recorder transcripts and metadata","DATA","ACTIVE"]),await e.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
4
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7)`,["int_3",t,"org_demo","Gradium Voice","Gradium low-latency text-to-speech integration","COMMUNICATION","ACTIVE"]),await e.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
5
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7)`,["int_4",t,"org_demo","Fal Chatterbox Voice","Fal Chatterbox text-to-speech integration","COMMUNICATION","ACTIVE"]),await e.execute(`INSERT INTO integration (id, "projectId", "organizationId", name, description, type, status)
|
|
6
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7)`,["int_5",t,"org_demo","PostHog Analytics","Product analytics and event capture","ANALYTICS","ACTIVE"])}export{o as seedIntegrationHub};
|
package/dist/node/sync/index.js
CHANGED
|
@@ -1,332 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
-
var SyncDirectionEnum = defineEnum("SyncDirection", [
|
|
4
|
-
"INBOUND",
|
|
5
|
-
"OUTBOUND",
|
|
6
|
-
"BIDIRECTIONAL"
|
|
7
|
-
]);
|
|
8
|
-
var SyncStatusEnum = defineEnum("SyncStatus", [
|
|
9
|
-
"PENDING",
|
|
10
|
-
"RUNNING",
|
|
11
|
-
"COMPLETED",
|
|
12
|
-
"FAILED",
|
|
13
|
-
"CANCELLED"
|
|
14
|
-
]);
|
|
15
|
-
var MappingTypeEnum = defineEnum("MappingType", [
|
|
16
|
-
"DIRECT",
|
|
17
|
-
"TRANSFORM",
|
|
18
|
-
"LOOKUP",
|
|
19
|
-
"CONSTANT",
|
|
20
|
-
"COMPUTED"
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
// src/sync/sync.schema.ts
|
|
24
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
25
|
-
var FieldMappingModel = defineSchemaModel({
|
|
26
|
-
name: "FieldMappingModel",
|
|
27
|
-
fields: {
|
|
28
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
29
|
-
sourceField: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
30
|
-
targetField: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
31
|
-
mappingType: { type: MappingTypeEnum, isOptional: false },
|
|
32
|
-
transformExpression: {
|
|
33
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
34
|
-
isOptional: true
|
|
35
|
-
},
|
|
36
|
-
isRequired: { type: ScalarTypeEnum.Boolean(), isOptional: false }
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
var SyncConfigModel = defineSchemaModel({
|
|
40
|
-
name: "SyncConfigModel",
|
|
41
|
-
fields: {
|
|
42
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
-
integrationId: {
|
|
44
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
45
|
-
isOptional: false
|
|
46
|
-
},
|
|
47
|
-
connectionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
48
|
-
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
49
|
-
direction: { type: SyncDirectionEnum, isOptional: false },
|
|
50
|
-
sourceObject: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
51
|
-
targetObject: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
52
|
-
scheduleEnabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
53
|
-
scheduleCron: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
54
|
-
isActive: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
55
|
-
lastSyncAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
56
|
-
fieldMappings: { type: FieldMappingModel, isArray: true, isOptional: true }
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
var SyncRunModel = defineSchemaModel({
|
|
60
|
-
name: "SyncRunModel",
|
|
61
|
-
fields: {
|
|
62
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
63
|
-
syncConfigId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
64
|
-
status: { type: SyncStatusEnum, isOptional: false },
|
|
65
|
-
direction: { type: SyncDirectionEnum, isOptional: false },
|
|
66
|
-
trigger: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
67
|
-
recordsProcessed: {
|
|
68
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
69
|
-
isOptional: false
|
|
70
|
-
},
|
|
71
|
-
recordsCreated: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
72
|
-
recordsUpdated: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
73
|
-
recordsFailed: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
74
|
-
errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
75
|
-
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
76
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
77
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
var CreateSyncConfigInputModel = defineSchemaModel({
|
|
81
|
-
name: "CreateSyncConfigInput",
|
|
82
|
-
fields: {
|
|
83
|
-
integrationId: {
|
|
84
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
85
|
-
isOptional: false
|
|
86
|
-
},
|
|
87
|
-
connectionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
88
|
-
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
89
|
-
direction: { type: SyncDirectionEnum, isOptional: false },
|
|
90
|
-
sourceObject: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
91
|
-
targetObject: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
92
|
-
scheduleEnabled: { type: ScalarTypeEnum.Boolean(), isOptional: true },
|
|
93
|
-
scheduleCron: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
var AddFieldMappingInputModel = defineSchemaModel({
|
|
97
|
-
name: "AddFieldMappingInput",
|
|
98
|
-
fields: {
|
|
99
|
-
syncConfigId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
100
|
-
sourceField: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
101
|
-
targetField: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
102
|
-
mappingType: { type: MappingTypeEnum, isOptional: false },
|
|
103
|
-
transformExpression: {
|
|
104
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
105
|
-
isOptional: true
|
|
106
|
-
},
|
|
107
|
-
lookupConfig: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
108
|
-
constantValue: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
109
|
-
isRequired: { type: ScalarTypeEnum.Boolean(), isOptional: true },
|
|
110
|
-
defaultValue: { type: ScalarTypeEnum.JSON(), isOptional: true }
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
var TriggerSyncInputModel = defineSchemaModel({
|
|
114
|
-
name: "TriggerSyncInput",
|
|
115
|
-
fields: {
|
|
116
|
-
syncConfigId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
117
|
-
direction: { type: SyncDirectionEnum, isOptional: true },
|
|
118
|
-
fullSync: { type: ScalarTypeEnum.Boolean(), isOptional: true }
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
var ListSyncRunsInputModel = defineSchemaModel({
|
|
122
|
-
name: "ListSyncRunsInput",
|
|
123
|
-
fields: {
|
|
124
|
-
syncConfigId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
125
|
-
status: { type: SyncStatusEnum, isOptional: true },
|
|
126
|
-
limit: {
|
|
127
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
128
|
-
isOptional: true,
|
|
129
|
-
defaultValue: 20
|
|
130
|
-
},
|
|
131
|
-
offset: {
|
|
132
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
133
|
-
isOptional: true,
|
|
134
|
-
defaultValue: 0
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
var ListSyncRunsOutputModel = defineSchemaModel({
|
|
139
|
-
name: "ListSyncRunsOutput",
|
|
140
|
-
fields: {
|
|
141
|
-
runs: { type: SyncRunModel, isArray: true, isOptional: false },
|
|
142
|
-
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
// src/sync/sync.operations.ts
|
|
147
|
-
import {
|
|
148
|
-
defineCommand,
|
|
149
|
-
defineQuery
|
|
150
|
-
} from "@contractspec/lib.contracts-spec/operations";
|
|
151
|
-
var OWNERS = ["@example.integration-hub"];
|
|
152
|
-
var CreateSyncConfigContract = defineCommand({
|
|
153
|
-
meta: {
|
|
154
|
-
key: "integration.syncConfig.create",
|
|
155
|
-
version: "1.0.0",
|
|
156
|
-
stability: "stable",
|
|
157
|
-
owners: [...OWNERS],
|
|
158
|
-
tags: ["integration", "sync", "config", "create"],
|
|
159
|
-
description: "Create a sync configuration.",
|
|
160
|
-
goal: "Define how data should be synchronized.",
|
|
161
|
-
context: "Sync setup."
|
|
162
|
-
},
|
|
163
|
-
io: { input: CreateSyncConfigInputModel, output: SyncConfigModel },
|
|
164
|
-
policy: { auth: "user" },
|
|
165
|
-
sideEffects: {
|
|
166
|
-
emits: [
|
|
167
|
-
{
|
|
168
|
-
key: "integration.syncConfig.created",
|
|
169
|
-
version: "1.0.0",
|
|
170
|
-
when: "Sync config created",
|
|
171
|
-
payload: SyncConfigModel
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
audit: ["integration.syncConfig.created"]
|
|
175
|
-
},
|
|
176
|
-
acceptance: {
|
|
177
|
-
scenarios: [
|
|
178
|
-
{
|
|
179
|
-
key: "create-sync-happy-path",
|
|
180
|
-
given: ["User is authenticated"],
|
|
181
|
-
when: ["User creates sync config"],
|
|
182
|
-
then: ["Sync config is created", "SyncConfigCreated event is emitted"]
|
|
183
|
-
}
|
|
184
|
-
],
|
|
185
|
-
examples: [
|
|
186
|
-
{
|
|
187
|
-
key: "create-contact-sync",
|
|
188
|
-
input: {
|
|
189
|
-
name: "Contacts Sync",
|
|
190
|
-
sourceConnectionId: "conn-1",
|
|
191
|
-
targetConnectionId: "conn-2"
|
|
192
|
-
},
|
|
193
|
-
output: { id: "sync-123", status: "active" }
|
|
194
|
-
}
|
|
195
|
-
]
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
var AddFieldMappingContract = defineCommand({
|
|
199
|
-
meta: {
|
|
200
|
-
key: "integration.fieldMapping.add",
|
|
201
|
-
version: "1.0.0",
|
|
202
|
-
stability: "stable",
|
|
203
|
-
owners: [...OWNERS],
|
|
204
|
-
tags: ["integration", "mapping", "field"],
|
|
205
|
-
description: "Add a field mapping to a sync config.",
|
|
206
|
-
goal: "Map fields between systems.",
|
|
207
|
-
context: "Mapping configuration."
|
|
208
|
-
},
|
|
209
|
-
io: { input: AddFieldMappingInputModel, output: FieldMappingModel },
|
|
210
|
-
policy: { auth: "user" },
|
|
211
|
-
sideEffects: {
|
|
212
|
-
emits: [
|
|
213
|
-
{
|
|
214
|
-
key: "integration.fieldMapping.added",
|
|
215
|
-
version: "1.0.0",
|
|
216
|
-
when: "Mapping added",
|
|
217
|
-
payload: FieldMappingModel
|
|
218
|
-
}
|
|
219
|
-
]
|
|
220
|
-
},
|
|
221
|
-
acceptance: {
|
|
222
|
-
scenarios: [
|
|
223
|
-
{
|
|
224
|
-
key: "add-mapping-happy-path",
|
|
225
|
-
given: ["Sync config exists"],
|
|
226
|
-
when: ["User adds field mapping"],
|
|
227
|
-
then: ["Mapping is added", "FieldMappingAdded event is emitted"]
|
|
228
|
-
}
|
|
229
|
-
],
|
|
230
|
-
examples: [
|
|
231
|
-
{
|
|
232
|
-
key: "map-email",
|
|
233
|
-
input: {
|
|
234
|
-
syncConfigId: "sync-123",
|
|
235
|
-
sourceField: "email",
|
|
236
|
-
targetField: "user_email"
|
|
237
|
-
},
|
|
238
|
-
output: { id: "map-456", type: "string" }
|
|
239
|
-
}
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
var TriggerSyncContract = defineCommand({
|
|
244
|
-
meta: {
|
|
245
|
-
key: "integration.sync.trigger",
|
|
246
|
-
version: "1.0.0",
|
|
247
|
-
stability: "stable",
|
|
248
|
-
owners: [...OWNERS],
|
|
249
|
-
tags: ["integration", "sync", "trigger"],
|
|
250
|
-
description: "Trigger a manual sync.",
|
|
251
|
-
goal: "Start data synchronization.",
|
|
252
|
-
context: "Manual sync or webhook trigger."
|
|
253
|
-
},
|
|
254
|
-
io: { input: TriggerSyncInputModel, output: SyncRunModel },
|
|
255
|
-
policy: { auth: "user" },
|
|
256
|
-
sideEffects: {
|
|
257
|
-
emits: [
|
|
258
|
-
{
|
|
259
|
-
key: "integration.sync.started",
|
|
260
|
-
version: "1.0.0",
|
|
261
|
-
when: "Sync starts",
|
|
262
|
-
payload: SyncRunModel
|
|
263
|
-
}
|
|
264
|
-
],
|
|
265
|
-
audit: ["integration.sync.triggered"]
|
|
266
|
-
},
|
|
267
|
-
acceptance: {
|
|
268
|
-
scenarios: [
|
|
269
|
-
{
|
|
270
|
-
key: "trigger-sync-happy-path",
|
|
271
|
-
given: ["Sync config exists"],
|
|
272
|
-
when: ["User triggers sync"],
|
|
273
|
-
then: ["Sync run starts", "SyncStarted event is emitted"]
|
|
274
|
-
}
|
|
275
|
-
],
|
|
276
|
-
examples: [
|
|
277
|
-
{
|
|
278
|
-
key: "manual-trigger",
|
|
279
|
-
input: { syncConfigId: "sync-123" },
|
|
280
|
-
output: { id: "run-789", status: "pending" }
|
|
281
|
-
}
|
|
282
|
-
]
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
var ListSyncRunsContract = defineQuery({
|
|
286
|
-
meta: {
|
|
287
|
-
key: "integration.syncRun.list",
|
|
288
|
-
version: "1.0.0",
|
|
289
|
-
stability: "stable",
|
|
290
|
-
owners: [...OWNERS],
|
|
291
|
-
tags: ["integration", "sync", "run", "list"],
|
|
292
|
-
description: "List sync run history.",
|
|
293
|
-
goal: "View sync history and status.",
|
|
294
|
-
context: "Sync monitoring."
|
|
295
|
-
},
|
|
296
|
-
io: { input: ListSyncRunsInputModel, output: ListSyncRunsOutputModel },
|
|
297
|
-
policy: { auth: "user" },
|
|
298
|
-
acceptance: {
|
|
299
|
-
scenarios: [
|
|
300
|
-
{
|
|
301
|
-
key: "list-runs-happy-path",
|
|
302
|
-
given: ["User has access to syncs"],
|
|
303
|
-
when: ["User lists sync runs"],
|
|
304
|
-
then: ["List of runs is returned"]
|
|
305
|
-
}
|
|
306
|
-
],
|
|
307
|
-
examples: [
|
|
308
|
-
{
|
|
309
|
-
key: "list-recent",
|
|
310
|
-
input: { limit: 10 },
|
|
311
|
-
output: { items: [], total: 50 }
|
|
312
|
-
}
|
|
313
|
-
]
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
export {
|
|
317
|
-
TriggerSyncInputModel,
|
|
318
|
-
TriggerSyncContract,
|
|
319
|
-
SyncStatusEnum,
|
|
320
|
-
SyncRunModel,
|
|
321
|
-
SyncDirectionEnum,
|
|
322
|
-
SyncConfigModel,
|
|
323
|
-
MappingTypeEnum,
|
|
324
|
-
ListSyncRunsOutputModel,
|
|
325
|
-
ListSyncRunsInputModel,
|
|
326
|
-
ListSyncRunsContract,
|
|
327
|
-
FieldMappingModel,
|
|
328
|
-
CreateSyncConfigInputModel,
|
|
329
|
-
CreateSyncConfigContract,
|
|
330
|
-
AddFieldMappingInputModel,
|
|
331
|
-
AddFieldMappingContract
|
|
332
|
-
};
|
|
1
|
+
import{defineEnum as O}from"@contractspec/lib.schema";var N=O("SyncDirection",["INBOUND","OUTBOUND","BIDIRECTIONAL"]),x=O("SyncStatus",["PENDING","RUNNING","COMPLETED","FAILED","CANCELLED"]),L=O("MappingType",["DIRECT","TRANSFORM","LOOKUP","CONSTANT","COMPUTED"]);import{defineSchemaModel as C,ScalarTypeEnum as t}from"@contractspec/lib.schema";var D=C({name:"FieldMappingModel",fields:{id:{type:t.String_unsecure(),isOptional:!1},sourceField:{type:t.String_unsecure(),isOptional:!1},targetField:{type:t.String_unsecure(),isOptional:!1},mappingType:{type:L,isOptional:!1},transformExpression:{type:t.String_unsecure(),isOptional:!0},isRequired:{type:t.Boolean(),isOptional:!1}}}),A=C({name:"SyncConfigModel",fields:{id:{type:t.String_unsecure(),isOptional:!1},integrationId:{type:t.String_unsecure(),isOptional:!1},connectionId:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},direction:{type:N,isOptional:!1},sourceObject:{type:t.String_unsecure(),isOptional:!1},targetObject:{type:t.String_unsecure(),isOptional:!1},scheduleEnabled:{type:t.Boolean(),isOptional:!1},scheduleCron:{type:t.String_unsecure(),isOptional:!0},isActive:{type:t.Boolean(),isOptional:!1},lastSyncAt:{type:t.DateTime(),isOptional:!0},fieldMappings:{type:D,isArray:!0,isOptional:!0}}}),I=C({name:"SyncRunModel",fields:{id:{type:t.String_unsecure(),isOptional:!1},syncConfigId:{type:t.String_unsecure(),isOptional:!1},status:{type:x,isOptional:!1},direction:{type:N,isOptional:!1},trigger:{type:t.String_unsecure(),isOptional:!1},recordsProcessed:{type:t.Int_unsecure(),isOptional:!1},recordsCreated:{type:t.Int_unsecure(),isOptional:!1},recordsUpdated:{type:t.Int_unsecure(),isOptional:!1},recordsFailed:{type:t.Int_unsecure(),isOptional:!1},errorMessage:{type:t.String_unsecure(),isOptional:!0},startedAt:{type:t.DateTime(),isOptional:!0},completedAt:{type:t.DateTime(),isOptional:!0},createdAt:{type:t.DateTime(),isOptional:!1}}}),P=C({name:"CreateSyncConfigInput",fields:{integrationId:{type:t.String_unsecure(),isOptional:!1},connectionId:{type:t.String_unsecure(),isOptional:!1},name:{type:t.NonEmptyString(),isOptional:!1},direction:{type:N,isOptional:!1},sourceObject:{type:t.NonEmptyString(),isOptional:!1},targetObject:{type:t.NonEmptyString(),isOptional:!1},scheduleEnabled:{type:t.Boolean(),isOptional:!0},scheduleCron:{type:t.String_unsecure(),isOptional:!0}}}),B=C({name:"AddFieldMappingInput",fields:{syncConfigId:{type:t.String_unsecure(),isOptional:!1},sourceField:{type:t.NonEmptyString(),isOptional:!1},targetField:{type:t.NonEmptyString(),isOptional:!1},mappingType:{type:L,isOptional:!1},transformExpression:{type:t.String_unsecure(),isOptional:!0},lookupConfig:{type:t.JSON(),isOptional:!0},constantValue:{type:t.JSON(),isOptional:!0},isRequired:{type:t.Boolean(),isOptional:!0},defaultValue:{type:t.JSON(),isOptional:!0}}}),g=C({name:"TriggerSyncInput",fields:{syncConfigId:{type:t.String_unsecure(),isOptional:!1},direction:{type:N,isOptional:!0},fullSync:{type:t.Boolean(),isOptional:!0}}}),G=C({name:"ListSyncRunsInput",fields:{syncConfigId:{type:t.String_unsecure(),isOptional:!1},status:{type:x,isOptional:!0},limit:{type:t.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:t.Int_unsecure(),isOptional:!0,defaultValue:0}}}),F=C({name:"ListSyncRunsOutput",fields:{runs:{type:I,isArray:!0,isOptional:!1},total:{type:t.Int_unsecure(),isOptional:!1}}});import{defineCommand as K,defineQuery as j}from"@contractspec/lib.contracts-spec/operations";var U=["@example.integration-hub"],k=K({meta:{key:"integration.syncConfig.create",version:"1.0.0",stability:"stable",owners:[...U],tags:["integration","sync","config","create"],description:"Create a sync configuration.",goal:"Define how data should be synchronized.",context:"Sync setup."},io:{input:P,output:A},policy:{auth:"user"},sideEffects:{emits:[{key:"integration.syncConfig.created",version:"1.0.0",when:"Sync config created",payload:A}],audit:["integration.syncConfig.created"]},acceptance:{scenarios:[{key:"create-sync-happy-path",given:["User is authenticated"],when:["User creates sync config"],then:["Sync config is created","SyncConfigCreated event is emitted"]}],examples:[{key:"create-contact-sync",input:{name:"Contacts Sync",sourceConnectionId:"conn-1",targetConnectionId:"conn-2"},output:{id:"sync-123",status:"active"}}]}}),q=K({meta:{key:"integration.fieldMapping.add",version:"1.0.0",stability:"stable",owners:[...U],tags:["integration","mapping","field"],description:"Add a field mapping to a sync config.",goal:"Map fields between systems.",context:"Mapping configuration."},io:{input:B,output:D},policy:{auth:"user"},sideEffects:{emits:[{key:"integration.fieldMapping.added",version:"1.0.0",when:"Mapping added",payload:D}]},acceptance:{scenarios:[{key:"add-mapping-happy-path",given:["Sync config exists"],when:["User adds field mapping"],then:["Mapping is added","FieldMappingAdded event is emitted"]}],examples:[{key:"map-email",input:{syncConfigId:"sync-123",sourceField:"email",targetField:"user_email"},output:{id:"map-456",type:"string"}}]}}),v=K({meta:{key:"integration.sync.trigger",version:"1.0.0",stability:"stable",owners:[...U],tags:["integration","sync","trigger"],description:"Trigger a manual sync.",goal:"Start data synchronization.",context:"Manual sync or webhook trigger."},io:{input:g,output:I},policy:{auth:"user"},sideEffects:{emits:[{key:"integration.sync.started",version:"1.0.0",when:"Sync starts",payload:I}],audit:["integration.sync.triggered"]},acceptance:{scenarios:[{key:"trigger-sync-happy-path",given:["Sync config exists"],when:["User triggers sync"],then:["Sync run starts","SyncStarted event is emitted"]}],examples:[{key:"manual-trigger",input:{syncConfigId:"sync-123"},output:{id:"run-789",status:"pending"}}]}}),w=j({meta:{key:"integration.syncRun.list",version:"1.0.0",stability:"stable",owners:[...U],tags:["integration","sync","run","list"],description:"List sync run history.",goal:"View sync history and status.",context:"Sync monitoring."},io:{input:G,output:F},policy:{auth:"user"},acceptance:{scenarios:[{key:"list-runs-happy-path",given:["User has access to syncs"],when:["User lists sync runs"],then:["List of runs is returned"]}],examples:[{key:"list-recent",input:{limit:10},output:{items:[],total:50}}]}});export{g as TriggerSyncInputModel,v as TriggerSyncContract,x as SyncStatusEnum,I as SyncRunModel,N as SyncDirectionEnum,A as SyncConfigModel,L as MappingTypeEnum,F as ListSyncRunsOutputModel,G as ListSyncRunsInputModel,w as ListSyncRunsContract,D as FieldMappingModel,P as CreateSyncConfigInputModel,k as CreateSyncConfigContract,B as AddFieldMappingInputModel,q as AddFieldMappingContract};
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
-
var SyncDirectionEnum = defineEnum("SyncDirection", [
|
|
4
|
-
"INBOUND",
|
|
5
|
-
"OUTBOUND",
|
|
6
|
-
"BIDIRECTIONAL"
|
|
7
|
-
]);
|
|
8
|
-
var SyncStatusEnum = defineEnum("SyncStatus", [
|
|
9
|
-
"PENDING",
|
|
10
|
-
"RUNNING",
|
|
11
|
-
"COMPLETED",
|
|
12
|
-
"FAILED",
|
|
13
|
-
"CANCELLED"
|
|
14
|
-
]);
|
|
15
|
-
var MappingTypeEnum = defineEnum("MappingType", [
|
|
16
|
-
"DIRECT",
|
|
17
|
-
"TRANSFORM",
|
|
18
|
-
"LOOKUP",
|
|
19
|
-
"CONSTANT",
|
|
20
|
-
"COMPUTED"
|
|
21
|
-
]);
|
|
22
|
-
export {
|
|
23
|
-
SyncStatusEnum,
|
|
24
|
-
SyncDirectionEnum,
|
|
25
|
-
MappingTypeEnum
|
|
26
|
-
};
|
|
1
|
+
import{defineEnum as n}from"@contractspec/lib.schema";var E=n("SyncDirection",["INBOUND","OUTBOUND","BIDIRECTIONAL"]),N=n("SyncStatus",["PENDING","RUNNING","COMPLETED","FAILED","CANCELLED"]),D=n("MappingType",["DIRECT","TRANSFORM","LOOKUP","CONSTANT","COMPUTED"]);export{N as SyncStatusEnum,E as SyncDirectionEnum,D as MappingTypeEnum};
|