@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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/connection/connection.enum.ts
|
|
2
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var ConnectionStatusEnum = defineEnum("ConnectionStatus", [
|
|
4
|
+
"PENDING",
|
|
5
|
+
"CONNECTED",
|
|
6
|
+
"DISCONNECTED",
|
|
7
|
+
"ERROR",
|
|
8
|
+
"EXPIRED"
|
|
9
|
+
]);
|
|
10
|
+
export {
|
|
11
|
+
ConnectionStatusEnum
|
|
12
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// src/connection/connection.enum.ts
|
|
2
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var ConnectionStatusEnum = defineEnum("ConnectionStatus", [
|
|
4
|
+
"PENDING",
|
|
5
|
+
"CONNECTED",
|
|
6
|
+
"DISCONNECTED",
|
|
7
|
+
"ERROR",
|
|
8
|
+
"EXPIRED"
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
// src/connection/connection.schema.ts
|
|
12
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
13
|
+
var ConnectionModel = defineSchemaModel({
|
|
14
|
+
name: "ConnectionModel",
|
|
15
|
+
fields: {
|
|
16
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
17
|
+
integrationId: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
},
|
|
21
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
+
status: { type: ConnectionStatusEnum, isOptional: false },
|
|
23
|
+
authType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
externalAccountName: {
|
|
25
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
26
|
+
isOptional: true
|
|
27
|
+
},
|
|
28
|
+
connectedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
29
|
+
lastHealthCheck: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
30
|
+
healthStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var CreateConnectionInputModel = defineSchemaModel({
|
|
34
|
+
name: "CreateConnectionInput",
|
|
35
|
+
fields: {
|
|
36
|
+
integrationId: {
|
|
37
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
38
|
+
isOptional: false
|
|
39
|
+
},
|
|
40
|
+
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
41
|
+
authType: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
42
|
+
credentials: { type: ScalarTypeEnum.JSON(), isOptional: true }
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// src/connection/connection.operation.ts
|
|
47
|
+
import { defineCommand } from "@contractspec/lib.contracts/operations";
|
|
48
|
+
var OWNERS = ["@example.integration-hub"];
|
|
49
|
+
var CreateConnectionContract = defineCommand({
|
|
50
|
+
meta: {
|
|
51
|
+
key: "integration.connection.create",
|
|
52
|
+
version: "1.0.0",
|
|
53
|
+
stability: "stable",
|
|
54
|
+
owners: [...OWNERS],
|
|
55
|
+
tags: ["integration", "connection", "create"],
|
|
56
|
+
description: "Create a connection to an external system.",
|
|
57
|
+
goal: "Authenticate with external systems.",
|
|
58
|
+
context: "Connection setup."
|
|
59
|
+
},
|
|
60
|
+
io: { input: CreateConnectionInputModel, output: ConnectionModel },
|
|
61
|
+
policy: { auth: "user" },
|
|
62
|
+
sideEffects: {
|
|
63
|
+
emits: [
|
|
64
|
+
{
|
|
65
|
+
key: "integration.connection.created",
|
|
66
|
+
version: "1.0.0",
|
|
67
|
+
when: "Connection created",
|
|
68
|
+
payload: ConnectionModel
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
audit: ["integration.connection.created"]
|
|
72
|
+
},
|
|
73
|
+
acceptance: {
|
|
74
|
+
scenarios: [
|
|
75
|
+
{
|
|
76
|
+
key: "create-connection-happy-path",
|
|
77
|
+
given: ["User is authenticated"],
|
|
78
|
+
when: ["User creates connection with valid credentials"],
|
|
79
|
+
then: ["Connection is created", "ConnectionCreated event is emitted"]
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
examples: [
|
|
83
|
+
{
|
|
84
|
+
key: "connect-crm",
|
|
85
|
+
input: {
|
|
86
|
+
name: "Salesforce Prod",
|
|
87
|
+
integrationId: "salesforce",
|
|
88
|
+
credentials: { clientId: "xxx" }
|
|
89
|
+
},
|
|
90
|
+
output: {
|
|
91
|
+
id: "conn-123",
|
|
92
|
+
status: "connected",
|
|
93
|
+
connectedAt: "2025-01-01T12:00:00Z"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
export {
|
|
100
|
+
CreateConnectionContract
|
|
101
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// src/connection/connection.enum.ts
|
|
2
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var ConnectionStatusEnum = defineEnum("ConnectionStatus", [
|
|
4
|
+
"PENDING",
|
|
5
|
+
"CONNECTED",
|
|
6
|
+
"DISCONNECTED",
|
|
7
|
+
"ERROR",
|
|
8
|
+
"EXPIRED"
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
// src/connection/connection.schema.ts
|
|
12
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
13
|
+
var ConnectionModel = defineSchemaModel({
|
|
14
|
+
name: "ConnectionModel",
|
|
15
|
+
fields: {
|
|
16
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
17
|
+
integrationId: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
},
|
|
21
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
+
status: { type: ConnectionStatusEnum, isOptional: false },
|
|
23
|
+
authType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
externalAccountName: {
|
|
25
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
26
|
+
isOptional: true
|
|
27
|
+
},
|
|
28
|
+
connectedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
29
|
+
lastHealthCheck: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
30
|
+
healthStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var CreateConnectionInputModel = defineSchemaModel({
|
|
34
|
+
name: "CreateConnectionInput",
|
|
35
|
+
fields: {
|
|
36
|
+
integrationId: {
|
|
37
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
38
|
+
isOptional: false
|
|
39
|
+
},
|
|
40
|
+
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
41
|
+
authType: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
42
|
+
credentials: { type: ScalarTypeEnum.JSON(), isOptional: true }
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// src/connection/connection.presentation.ts
|
|
47
|
+
import { definePresentation, StabilityEnum } from "@contractspec/lib.contracts";
|
|
48
|
+
var ConnectionListPresentation = definePresentation({
|
|
49
|
+
meta: {
|
|
50
|
+
key: "integration.connection.list",
|
|
51
|
+
version: "1.0.0",
|
|
52
|
+
title: "Connection List",
|
|
53
|
+
description: "List of integration connections",
|
|
54
|
+
domain: "integration",
|
|
55
|
+
owners: ["@integration-team"],
|
|
56
|
+
tags: ["integration", "connection", "list"],
|
|
57
|
+
stability: StabilityEnum.Experimental,
|
|
58
|
+
goal: "Provide an overview of all established integration connections.",
|
|
59
|
+
context: "The primary management view for integration hubs."
|
|
60
|
+
},
|
|
61
|
+
source: {
|
|
62
|
+
type: "component",
|
|
63
|
+
framework: "react",
|
|
64
|
+
componentKey: "ConnectionList",
|
|
65
|
+
props: ConnectionModel
|
|
66
|
+
},
|
|
67
|
+
targets: ["react", "markdown"],
|
|
68
|
+
policy: {
|
|
69
|
+
flags: ["integration.enabled"]
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
var ConnectionSetupPresentation = definePresentation({
|
|
73
|
+
meta: {
|
|
74
|
+
key: "integration.connection.setup",
|
|
75
|
+
version: "1.0.0",
|
|
76
|
+
title: "Connection Setup",
|
|
77
|
+
description: "Setup wizard for creating integration connections",
|
|
78
|
+
domain: "integration",
|
|
79
|
+
owners: ["@integration-team"],
|
|
80
|
+
tags: ["integration", "connection", "setup"],
|
|
81
|
+
stability: StabilityEnum.Experimental,
|
|
82
|
+
goal: "Guide users through the multi-step process of connecting to a new integration.",
|
|
83
|
+
context: "The onboarding flow for new integrations."
|
|
84
|
+
},
|
|
85
|
+
source: {
|
|
86
|
+
type: "component",
|
|
87
|
+
framework: "react",
|
|
88
|
+
componentKey: "ConnectionSetup",
|
|
89
|
+
props: ConnectionModel
|
|
90
|
+
},
|
|
91
|
+
targets: ["react"],
|
|
92
|
+
policy: {
|
|
93
|
+
flags: ["integration.enabled"]
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
export {
|
|
97
|
+
ConnectionSetupPresentation,
|
|
98
|
+
ConnectionListPresentation
|
|
99
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/connection/connection.enum.ts
|
|
2
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var ConnectionStatusEnum = defineEnum("ConnectionStatus", [
|
|
4
|
+
"PENDING",
|
|
5
|
+
"CONNECTED",
|
|
6
|
+
"DISCONNECTED",
|
|
7
|
+
"ERROR",
|
|
8
|
+
"EXPIRED"
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
// src/connection/connection.schema.ts
|
|
12
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
13
|
+
var ConnectionModel = defineSchemaModel({
|
|
14
|
+
name: "ConnectionModel",
|
|
15
|
+
fields: {
|
|
16
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
17
|
+
integrationId: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
},
|
|
21
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
+
status: { type: ConnectionStatusEnum, isOptional: false },
|
|
23
|
+
authType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
externalAccountName: {
|
|
25
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
26
|
+
isOptional: true
|
|
27
|
+
},
|
|
28
|
+
connectedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
29
|
+
lastHealthCheck: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
30
|
+
healthStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var CreateConnectionInputModel = defineSchemaModel({
|
|
34
|
+
name: "CreateConnectionInput",
|
|
35
|
+
fields: {
|
|
36
|
+
integrationId: {
|
|
37
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
38
|
+
isOptional: false
|
|
39
|
+
},
|
|
40
|
+
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
41
|
+
authType: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
42
|
+
credentials: { type: ScalarTypeEnum.JSON(), isOptional: true }
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export {
|
|
46
|
+
CreateConnectionInputModel,
|
|
47
|
+
ConnectionModel
|
|
48
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// src/connection/connection.enum.ts
|
|
2
|
+
import { defineEnum } from "@contractspec/lib.schema";
|
|
3
|
+
var ConnectionStatusEnum = defineEnum("ConnectionStatus", [
|
|
4
|
+
"PENDING",
|
|
5
|
+
"CONNECTED",
|
|
6
|
+
"DISCONNECTED",
|
|
7
|
+
"ERROR",
|
|
8
|
+
"EXPIRED"
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
// src/connection/connection.schema.ts
|
|
12
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
13
|
+
var ConnectionModel = defineSchemaModel({
|
|
14
|
+
name: "ConnectionModel",
|
|
15
|
+
fields: {
|
|
16
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
17
|
+
integrationId: {
|
|
18
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
19
|
+
isOptional: false
|
|
20
|
+
},
|
|
21
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
22
|
+
status: { type: ConnectionStatusEnum, isOptional: false },
|
|
23
|
+
authType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
24
|
+
externalAccountName: {
|
|
25
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
26
|
+
isOptional: true
|
|
27
|
+
},
|
|
28
|
+
connectedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
29
|
+
lastHealthCheck: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
30
|
+
healthStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var CreateConnectionInputModel = defineSchemaModel({
|
|
34
|
+
name: "CreateConnectionInput",
|
|
35
|
+
fields: {
|
|
36
|
+
integrationId: {
|
|
37
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
38
|
+
isOptional: false
|
|
39
|
+
},
|
|
40
|
+
name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
41
|
+
authType: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
42
|
+
credentials: { type: ScalarTypeEnum.JSON(), isOptional: true }
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// src/connection/connection.operation.ts
|
|
47
|
+
import { defineCommand } from "@contractspec/lib.contracts/operations";
|
|
48
|
+
var OWNERS = ["@example.integration-hub"];
|
|
49
|
+
var CreateConnectionContract = defineCommand({
|
|
50
|
+
meta: {
|
|
51
|
+
key: "integration.connection.create",
|
|
52
|
+
version: "1.0.0",
|
|
53
|
+
stability: "stable",
|
|
54
|
+
owners: [...OWNERS],
|
|
55
|
+
tags: ["integration", "connection", "create"],
|
|
56
|
+
description: "Create a connection to an external system.",
|
|
57
|
+
goal: "Authenticate with external systems.",
|
|
58
|
+
context: "Connection setup."
|
|
59
|
+
},
|
|
60
|
+
io: { input: CreateConnectionInputModel, output: ConnectionModel },
|
|
61
|
+
policy: { auth: "user" },
|
|
62
|
+
sideEffects: {
|
|
63
|
+
emits: [
|
|
64
|
+
{
|
|
65
|
+
key: "integration.connection.created",
|
|
66
|
+
version: "1.0.0",
|
|
67
|
+
when: "Connection created",
|
|
68
|
+
payload: ConnectionModel
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
audit: ["integration.connection.created"]
|
|
72
|
+
},
|
|
73
|
+
acceptance: {
|
|
74
|
+
scenarios: [
|
|
75
|
+
{
|
|
76
|
+
key: "create-connection-happy-path",
|
|
77
|
+
given: ["User is authenticated"],
|
|
78
|
+
when: ["User creates connection with valid credentials"],
|
|
79
|
+
then: ["Connection is created", "ConnectionCreated event is emitted"]
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
examples: [
|
|
83
|
+
{
|
|
84
|
+
key: "connect-crm",
|
|
85
|
+
input: {
|
|
86
|
+
name: "Salesforce Prod",
|
|
87
|
+
integrationId: "salesforce",
|
|
88
|
+
credentials: { clientId: "xxx" }
|
|
89
|
+
},
|
|
90
|
+
output: {
|
|
91
|
+
id: "conn-123",
|
|
92
|
+
status: "connected",
|
|
93
|
+
connectedAt: "2025-01-01T12:00:00Z"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
export {
|
|
100
|
+
CreateConnectionInputModel,
|
|
101
|
+
CreateConnectionContract,
|
|
102
|
+
ConnectionStatusEnum,
|
|
103
|
+
ConnectionModel
|
|
104
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// src/docs/integration-hub.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var integrationHubDocBlocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.integration-hub",
|
|
6
|
+
title: "Integration Hub",
|
|
7
|
+
summary: "Generic integration center with connectors, connections, sync configs, field mappings, and sync logs.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/integration-hub",
|
|
11
|
+
tags: ["integrations", "sync", "etl", "connectors"],
|
|
12
|
+
body: `## Entities
|
|
13
|
+
|
|
14
|
+
- Integration, Connection, SyncConfig, FieldMapping, SyncLog.
|
|
15
|
+
- Sync engine config lives in \`src/sync-engine\` to map remote <-> local entities.
|
|
16
|
+
|
|
17
|
+
## Contracts
|
|
18
|
+
|
|
19
|
+
- \`integration.create\`, \`integration.connect\`, \`integration.configureSync\`, \`integration.mapFields\`, \`integration.runSync\`.
|
|
20
|
+
- Uses Jobs module for scheduled syncs and retries; Files module for payload archives.
|
|
21
|
+
|
|
22
|
+
## Events
|
|
23
|
+
|
|
24
|
+
- sync.started/completed/failed, connection.connected/disconnected, mapping.updated.
|
|
25
|
+
- Forward to Notifications and Audit for observability.
|
|
26
|
+
|
|
27
|
+
## UI / Presentations
|
|
28
|
+
|
|
29
|
+
- Dashboard, integration list, connection detail, sync config editor.
|
|
30
|
+
- Templates registered as \`integration-hub\` in Template Registry.
|
|
31
|
+
|
|
32
|
+
## Notes
|
|
33
|
+
|
|
34
|
+
- Providers remain agnostic; keep mappings declarative for safe regeneration.
|
|
35
|
+
- Seed data includes voice integrations for \`ai-voice.gradium\` and \`ai-voice.fal\`.
|
|
36
|
+
- Feature flags can gate specific providers; metering can track sync volume.
|
|
37
|
+
`
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "docs.examples.integration-hub.goal",
|
|
41
|
+
title: "Integration Hub — Goal",
|
|
42
|
+
summary: "Why this integration hub exists and what success looks like.",
|
|
43
|
+
kind: "goal",
|
|
44
|
+
visibility: "public",
|
|
45
|
+
route: "/docs/examples/integration-hub/goal",
|
|
46
|
+
tags: ["integrations", "goal"],
|
|
47
|
+
body: `## Why it matters
|
|
48
|
+
- Gives a regenerable, provider-agnostic integration hub with explicit mappings.
|
|
49
|
+
- Prevents drift between sync configs, mappings, and event/log outputs.
|
|
50
|
+
|
|
51
|
+
## Business/Product goal
|
|
52
|
+
- Model connectors, connections, sync jobs, and mappings with governance and retries.
|
|
53
|
+
- Support staged provider rollouts via Feature Flags and observability via Audit/Notifications.
|
|
54
|
+
|
|
55
|
+
## Success criteria
|
|
56
|
+
- Connections and mappings regenerate safely after spec edits.
|
|
57
|
+
- Sync events and logs provide auditability; payloads are stored and PII-scoped.`
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "docs.examples.integration-hub.usage",
|
|
61
|
+
title: "Integration Hub — Usage",
|
|
62
|
+
summary: "How to configure connectors, mappings, and scheduled syncs.",
|
|
63
|
+
kind: "usage",
|
|
64
|
+
visibility: "public",
|
|
65
|
+
route: "/docs/examples/integration-hub/usage",
|
|
66
|
+
tags: ["integrations", "usage"],
|
|
67
|
+
body: `## Setup
|
|
68
|
+
1) Seed integrations/connections (if available) or create connector definitions.
|
|
69
|
+
2) Configure sync jobs with Jobs module; store payload archives via Files.
|
|
70
|
+
|
|
71
|
+
## Extend & regenerate
|
|
72
|
+
1) Add mapping fields or provider configs in the spec; include validation and PII paths.
|
|
73
|
+
2) Regenerate to align UI/API/events/logs; verify Notifications/Audit hooks.
|
|
74
|
+
3) Gate risky providers behind Feature Flags; meter sync volume if needed.
|
|
75
|
+
|
|
76
|
+
## Guardrails
|
|
77
|
+
- Keep mappings declarative; avoid hardcoded transforms.
|
|
78
|
+
- Emit events for sync lifecycle; persist logs for audit.
|
|
79
|
+
- Redact sensitive payload paths in presentations.`
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "docs.examples.integration-hub.constraints",
|
|
83
|
+
title: "Integration Hub — Constraints & Safety",
|
|
84
|
+
summary: "Internal guidance for sync lifecycle, mappings, and regeneration safety.",
|
|
85
|
+
kind: "reference",
|
|
86
|
+
visibility: "internal",
|
|
87
|
+
route: "/docs/examples/integration-hub/constraints",
|
|
88
|
+
tags: ["integrations", "constraints", "internal"],
|
|
89
|
+
body: `## Constraints
|
|
90
|
+
- Mappings and sync states must remain declarative in spec; no hidden code transforms.
|
|
91
|
+
- Events to emit at minimum: sync.started, sync.completed, sync.failed; connection.connected/disconnected.
|
|
92
|
+
- Regeneration should not alter retry/backoff semantics without explicit spec change.
|
|
93
|
+
|
|
94
|
+
## PII & Payloads
|
|
95
|
+
- Treat payload archives as potentially sensitive; mark policy.pii paths.
|
|
96
|
+
- For MCP/web, avoid exposing raw credentials/tokens; store via provider adapters only.
|
|
97
|
+
|
|
98
|
+
## Verification
|
|
99
|
+
- Include fixtures for mapping changes and sync retries.
|
|
100
|
+
- Validate that scheduled jobs (cron) are spec-driven; Jobs module wiring intact.
|
|
101
|
+
- Ensure Audit/Notifications receive sync lifecycle events.`
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
registerDocBlocks(integrationHubDocBlocks);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// src/docs/integration-hub.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var integrationHubDocBlocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.integration-hub",
|
|
6
|
+
title: "Integration Hub",
|
|
7
|
+
summary: "Generic integration center with connectors, connections, sync configs, field mappings, and sync logs.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/examples/integration-hub",
|
|
11
|
+
tags: ["integrations", "sync", "etl", "connectors"],
|
|
12
|
+
body: `## Entities
|
|
13
|
+
|
|
14
|
+
- Integration, Connection, SyncConfig, FieldMapping, SyncLog.
|
|
15
|
+
- Sync engine config lives in \`src/sync-engine\` to map remote <-> local entities.
|
|
16
|
+
|
|
17
|
+
## Contracts
|
|
18
|
+
|
|
19
|
+
- \`integration.create\`, \`integration.connect\`, \`integration.configureSync\`, \`integration.mapFields\`, \`integration.runSync\`.
|
|
20
|
+
- Uses Jobs module for scheduled syncs and retries; Files module for payload archives.
|
|
21
|
+
|
|
22
|
+
## Events
|
|
23
|
+
|
|
24
|
+
- sync.started/completed/failed, connection.connected/disconnected, mapping.updated.
|
|
25
|
+
- Forward to Notifications and Audit for observability.
|
|
26
|
+
|
|
27
|
+
## UI / Presentations
|
|
28
|
+
|
|
29
|
+
- Dashboard, integration list, connection detail, sync config editor.
|
|
30
|
+
- Templates registered as \`integration-hub\` in Template Registry.
|
|
31
|
+
|
|
32
|
+
## Notes
|
|
33
|
+
|
|
34
|
+
- Providers remain agnostic; keep mappings declarative for safe regeneration.
|
|
35
|
+
- Seed data includes voice integrations for \`ai-voice.gradium\` and \`ai-voice.fal\`.
|
|
36
|
+
- Feature flags can gate specific providers; metering can track sync volume.
|
|
37
|
+
`
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "docs.examples.integration-hub.goal",
|
|
41
|
+
title: "Integration Hub — Goal",
|
|
42
|
+
summary: "Why this integration hub exists and what success looks like.",
|
|
43
|
+
kind: "goal",
|
|
44
|
+
visibility: "public",
|
|
45
|
+
route: "/docs/examples/integration-hub/goal",
|
|
46
|
+
tags: ["integrations", "goal"],
|
|
47
|
+
body: `## Why it matters
|
|
48
|
+
- Gives a regenerable, provider-agnostic integration hub with explicit mappings.
|
|
49
|
+
- Prevents drift between sync configs, mappings, and event/log outputs.
|
|
50
|
+
|
|
51
|
+
## Business/Product goal
|
|
52
|
+
- Model connectors, connections, sync jobs, and mappings with governance and retries.
|
|
53
|
+
- Support staged provider rollouts via Feature Flags and observability via Audit/Notifications.
|
|
54
|
+
|
|
55
|
+
## Success criteria
|
|
56
|
+
- Connections and mappings regenerate safely after spec edits.
|
|
57
|
+
- Sync events and logs provide auditability; payloads are stored and PII-scoped.`
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "docs.examples.integration-hub.usage",
|
|
61
|
+
title: "Integration Hub — Usage",
|
|
62
|
+
summary: "How to configure connectors, mappings, and scheduled syncs.",
|
|
63
|
+
kind: "usage",
|
|
64
|
+
visibility: "public",
|
|
65
|
+
route: "/docs/examples/integration-hub/usage",
|
|
66
|
+
tags: ["integrations", "usage"],
|
|
67
|
+
body: `## Setup
|
|
68
|
+
1) Seed integrations/connections (if available) or create connector definitions.
|
|
69
|
+
2) Configure sync jobs with Jobs module; store payload archives via Files.
|
|
70
|
+
|
|
71
|
+
## Extend & regenerate
|
|
72
|
+
1) Add mapping fields or provider configs in the spec; include validation and PII paths.
|
|
73
|
+
2) Regenerate to align UI/API/events/logs; verify Notifications/Audit hooks.
|
|
74
|
+
3) Gate risky providers behind Feature Flags; meter sync volume if needed.
|
|
75
|
+
|
|
76
|
+
## Guardrails
|
|
77
|
+
- Keep mappings declarative; avoid hardcoded transforms.
|
|
78
|
+
- Emit events for sync lifecycle; persist logs for audit.
|
|
79
|
+
- Redact sensitive payload paths in presentations.`
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "docs.examples.integration-hub.constraints",
|
|
83
|
+
title: "Integration Hub — Constraints & Safety",
|
|
84
|
+
summary: "Internal guidance for sync lifecycle, mappings, and regeneration safety.",
|
|
85
|
+
kind: "reference",
|
|
86
|
+
visibility: "internal",
|
|
87
|
+
route: "/docs/examples/integration-hub/constraints",
|
|
88
|
+
tags: ["integrations", "constraints", "internal"],
|
|
89
|
+
body: `## Constraints
|
|
90
|
+
- Mappings and sync states must remain declarative in spec; no hidden code transforms.
|
|
91
|
+
- Events to emit at minimum: sync.started, sync.completed, sync.failed; connection.connected/disconnected.
|
|
92
|
+
- Regeneration should not alter retry/backoff semantics without explicit spec change.
|
|
93
|
+
|
|
94
|
+
## PII & Payloads
|
|
95
|
+
- Treat payload archives as potentially sensitive; mark policy.pii paths.
|
|
96
|
+
- For MCP/web, avoid exposing raw credentials/tokens; store via provider adapters only.
|
|
97
|
+
|
|
98
|
+
## Verification
|
|
99
|
+
- Include fixtures for mapping changes and sync retries.
|
|
100
|
+
- Validate that scheduled jobs (cron) are spec-driven; Jobs module wiring intact.
|
|
101
|
+
- Ensure Audit/Notifications receive sync lifecycle events.`
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
registerDocBlocks(integrationHubDocBlocks);
|