@contractspec/example.integration-hub 0.0.0-canary-20260113170453

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.
Files changed (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +156 -0
  3. package/dist/connection/connection.enum.d.ts +10 -0
  4. package/dist/connection/connection.enum.d.ts.map +1 -0
  5. package/dist/connection/connection.enum.js +17 -0
  6. package/dist/connection/connection.enum.js.map +1 -0
  7. package/dist/connection/connection.operation.d.ts +107 -0
  8. package/dist/connection/connection.operation.d.ts.map +1 -0
  9. package/dist/connection/connection.operation.js +63 -0
  10. package/dist/connection/connection.operation.js.map +1 -0
  11. package/dist/connection/connection.presentation.d.ts +8 -0
  12. package/dist/connection/connection.presentation.d.ts.map +1 -0
  13. package/dist/connection/connection.presentation.js +60 -0
  14. package/dist/connection/connection.presentation.js.map +1 -0
  15. package/dist/connection/connection.schema.d.ts +68 -0
  16. package/dist/connection/connection.schema.d.ts.map +1 -0
  17. package/dist/connection/connection.schema.js +76 -0
  18. package/dist/connection/connection.schema.js.map +1 -0
  19. package/dist/connection/index.d.ts +4 -0
  20. package/dist/connection/index.js +5 -0
  21. package/dist/docs/index.d.ts +1 -0
  22. package/dist/docs/index.js +1 -0
  23. package/dist/docs/integration-hub.docblock.d.ts +1 -0
  24. package/dist/docs/integration-hub.docblock.js +115 -0
  25. package/dist/docs/integration-hub.docblock.js.map +1 -0
  26. package/dist/events.d.ts +153 -0
  27. package/dist/events.d.ts.map +1 -0
  28. package/dist/events.js +289 -0
  29. package/dist/events.js.map +1 -0
  30. package/dist/example.d.ts +7 -0
  31. package/dist/example.d.ts.map +1 -0
  32. package/dist/example.js +58 -0
  33. package/dist/example.js.map +1 -0
  34. package/dist/handlers/index.d.ts +2 -0
  35. package/dist/handlers/index.js +3 -0
  36. package/dist/handlers/integration.handlers.d.ts +130 -0
  37. package/dist/handlers/integration.handlers.d.ts.map +1 -0
  38. package/dist/handlers/integration.handlers.js +282 -0
  39. package/dist/handlers/integration.handlers.js.map +1 -0
  40. package/dist/index.d.ts +19 -0
  41. package/dist/index.js +20 -0
  42. package/dist/integration/index.d.ts +4 -0
  43. package/dist/integration/index.js +5 -0
  44. package/dist/integration/integration.enum.d.ts +10 -0
  45. package/dist/integration/integration.enum.d.ts.map +1 -0
  46. package/dist/integration/integration.enum.js +17 -0
  47. package/dist/integration/integration.enum.js.map +1 -0
  48. package/dist/integration/integration.operations.d.ts +99 -0
  49. package/dist/integration/integration.operations.d.ts.map +1 -0
  50. package/dist/integration/integration.operations.js +57 -0
  51. package/dist/integration/integration.operations.js.map +1 -0
  52. package/dist/integration/integration.presentation.d.ts +9 -0
  53. package/dist/integration/integration.presentation.d.ts.map +1 -0
  54. package/dist/integration/integration.presentation.js +77 -0
  55. package/dist/integration/integration.presentation.js.map +1 -0
  56. package/dist/integration/integration.schema.d.ts +68 -0
  57. package/dist/integration/integration.schema.d.ts.map +1 -0
  58. package/dist/integration/integration.schema.js +76 -0
  59. package/dist/integration/integration.schema.js.map +1 -0
  60. package/dist/integration-hub.capability.d.ts +9 -0
  61. package/dist/integration-hub.capability.d.ts.map +1 -0
  62. package/dist/integration-hub.capability.js +38 -0
  63. package/dist/integration-hub.capability.js.map +1 -0
  64. package/dist/integration-hub.feature.d.ts +7 -0
  65. package/dist/integration-hub.feature.d.ts.map +1 -0
  66. package/dist/integration-hub.feature.js +244 -0
  67. package/dist/integration-hub.feature.js.map +1 -0
  68. package/dist/seeders/index.d.ts +10 -0
  69. package/dist/seeders/index.d.ts.map +1 -0
  70. package/dist/seeders/index.js +19 -0
  71. package/dist/seeders/index.js.map +1 -0
  72. package/dist/sync/index.d.ts +4 -0
  73. package/dist/sync/index.js +5 -0
  74. package/dist/sync/sync.enum.d.ts +18 -0
  75. package/dist/sync/sync.enum.d.ts.map +1 -0
  76. package/dist/sync/sync.enum.js +35 -0
  77. package/dist/sync/sync.enum.js.map +1 -0
  78. package/dist/sync/sync.operations.d.ts +509 -0
  79. package/dist/sync/sync.operations.d.ts.map +1 -0
  80. package/dist/sync/sync.operations.js +203 -0
  81. package/dist/sync/sync.operations.js.map +1 -0
  82. package/dist/sync/sync.presentation.d.ts +12 -0
  83. package/dist/sync/sync.presentation.d.ts.map +1 -0
  84. package/dist/sync/sync.presentation.js +168 -0
  85. package/dist/sync/sync.presentation.js.map +1 -0
  86. package/dist/sync/sync.schema.d.ts +356 -0
  87. package/dist/sync/sync.schema.d.ts.map +1 -0
  88. package/dist/sync/sync.schema.js +304 -0
  89. package/dist/sync/sync.schema.js.map +1 -0
  90. package/dist/sync-engine/index.d.ts +109 -0
  91. package/dist/sync-engine/index.d.ts.map +1 -0
  92. package/dist/sync-engine/index.js +148 -0
  93. package/dist/sync-engine/index.js.map +1 -0
  94. package/dist/tests/operations.test-spec.d.ts +9 -0
  95. package/dist/tests/operations.test-spec.d.ts.map +1 -0
  96. package/dist/tests/operations.test-spec.js +94 -0
  97. package/dist/tests/operations.test-spec.js.map +1 -0
  98. package/dist/ui/IntegrationDashboard.d.ts +7 -0
  99. package/dist/ui/IntegrationDashboard.d.ts.map +1 -0
  100. package/dist/ui/IntegrationDashboard.js +266 -0
  101. package/dist/ui/IntegrationDashboard.js.map +1 -0
  102. package/dist/ui/hooks/index.d.ts +2 -0
  103. package/dist/ui/hooks/index.js +5 -0
  104. package/dist/ui/hooks/useIntegrationData.d.ts +23 -0
  105. package/dist/ui/hooks/useIntegrationData.d.ts.map +1 -0
  106. package/dist/ui/hooks/useIntegrationData.js +59 -0
  107. package/dist/ui/hooks/useIntegrationData.js.map +1 -0
  108. package/dist/ui/index.d.ts +6 -0
  109. package/dist/ui/index.js +6 -0
  110. package/dist/ui/renderers/index.d.ts +2 -0
  111. package/dist/ui/renderers/index.js +3 -0
  112. package/dist/ui/renderers/integration.markdown.d.ts +28 -0
  113. package/dist/ui/renderers/integration.markdown.d.ts.map +1 -0
  114. package/dist/ui/renderers/integration.markdown.js +256 -0
  115. package/dist/ui/renderers/integration.markdown.js.map +1 -0
  116. package/package.json +111 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Chaman Ventures, SASU
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,156 @@
1
+ # @contractspec/example.integration-hub
2
+
3
+ Website: https://contractspec.io/
4
+
5
+
6
+ A comprehensive integration hub example demonstrating ContractSpec principles for data synchronization.
7
+
8
+ ## Features
9
+
10
+ - **Multi-Provider Support**: Connect to various external systems (Salesforce, HubSpot, etc.)
11
+ - **Bidirectional Sync**: INBOUND, OUTBOUND, or BIDIRECTIONAL data flow
12
+ - **Field Mapping**: Configurable field mappings with transforms
13
+ - **Sync Engine**: Change detection, deduplication, and error handling
14
+ - **Scheduled Sync**: Cron-based scheduled synchronization
15
+ - **Feature Flag Integration**: Control integration availability
16
+ - **Full Audit Trail**: Track all sync operations
17
+
18
+ ## Entities
19
+
20
+ ### Core
21
+ - `Integration` - Integration definition
22
+ - `Connection` - Authenticated connection to external system
23
+ - `SyncConfig` - Sync configuration for object pairs
24
+ - `FieldMapping` - Field-level mapping configuration
25
+
26
+ ### Sync Execution
27
+ - `SyncRun` - A single sync execution
28
+ - `SyncLog` - Log entries for a sync run
29
+ - `SyncRecord` - Tracks synced records for deduplication
30
+
31
+ ## Contracts
32
+
33
+ ### Integration Management
34
+ - `integration.create` - Create a new integration
35
+ - `integration.connection.create` - Create a connection
36
+
37
+ ### Sync Configuration
38
+ - `integration.syncConfig.create` - Create sync config
39
+ - `integration.fieldMapping.add` - Add field mapping
40
+
41
+ ### Sync Execution
42
+ - `integration.sync.trigger` - Trigger manual sync
43
+ - `integration.syncRun.list` - List sync history
44
+
45
+ ## Field Mapping Types
46
+
47
+ - **DIRECT**: Direct field copy
48
+ - **TRANSFORM**: Apply transformation expression
49
+ - **LOOKUP**: Lookup from another object
50
+ - **CONSTANT**: Fixed value
51
+ - **COMPUTED**: Computed from multiple fields
52
+
53
+ ## Sync Engine
54
+
55
+ The sync engine handles:
56
+
57
+ 1. **Change Detection**: Uses checksums to detect changes
58
+ 2. **Transformation**: Applies field mappings
59
+ 3. **Validation**: Validates required fields
60
+ 4. **Deduplication**: Tracks synced records
61
+
62
+ ```typescript
63
+ import { createSyncEngine, BasicFieldTransformer } from '@contractspec/example.integration-hub/sync-engine';
64
+
65
+ const engine = createSyncEngine();
66
+
67
+ const result = engine.transformRecord(
68
+ { id: '123', data: { FirstName: 'John', LastName: 'Doe' } },
69
+ [
70
+ { sourceField: 'FirstName', targetField: 'first_name', mappingType: 'DIRECT' },
71
+ { sourceField: 'LastName', targetField: 'last_name', mappingType: 'TRANSFORM', transformExpression: 'uppercase' },
72
+ ],
73
+ context
74
+ );
75
+ // { id: '123', data: { first_name: 'John', last_name: 'DOE' } }
76
+ ```
77
+
78
+ ## Transform Expressions
79
+
80
+ - `uppercase` - Convert to uppercase
81
+ - `lowercase` - Convert to lowercase
82
+ - `trim` - Trim whitespace
83
+ - `default:value` - Set default value
84
+ - `concat:separator` - Join array
85
+ - `split:separator` - Split string
86
+ - `number` - Convert to number
87
+ - `boolean` - Convert to boolean
88
+ - `string` - Convert to string
89
+
90
+ ## Events
91
+
92
+ - `integration.created` - Integration created
93
+ - `integration.connection.created` - Connection created
94
+ - `integration.connection.statusChanged` - Connection status changed
95
+ - `integration.syncConfig.created` - Sync config created
96
+ - `integration.sync.started` - Sync started
97
+ - `integration.sync.completed` - Sync completed
98
+ - `integration.sync.failed` - Sync failed
99
+ - `integration.record.synced` - Record synced
100
+
101
+ ## Usage
102
+
103
+ ```typescript
104
+ import {
105
+ CreateIntegrationContract,
106
+ CreateSyncConfigContract,
107
+ TriggerSyncContract,
108
+ integrationHubSchemaContribution
109
+ } from '@contractspec/example.integration-hub';
110
+
111
+ // Create integration
112
+ const integration = await executeContract(CreateIntegrationContract, {
113
+ name: 'Salesforce CRM',
114
+ slug: 'salesforce-crm',
115
+ provider: 'salesforce',
116
+ });
117
+
118
+ // Create sync config
119
+ const syncConfig = await executeContract(CreateSyncConfigContract, {
120
+ integrationId: integration.id,
121
+ connectionId: connection.id,
122
+ name: 'Contacts Sync',
123
+ direction: 'BIDIRECTIONAL',
124
+ sourceObject: 'Contact',
125
+ targetObject: 'contacts',
126
+ });
127
+
128
+ // Trigger sync
129
+ const run = await executeContract(TriggerSyncContract, {
130
+ syncConfigId: syncConfig.id,
131
+ });
132
+ ```
133
+
134
+ ## Dependencies
135
+
136
+ - `@contractspec/lib.identity-rbac` - User identity and roles
137
+ - `@contractspec/lib.feature-flags` - Feature flag control
138
+ - `@contractspec/lib.files` - Import/export file handling
139
+ - `@contractspec/lib.jobs` - Background sync jobs
140
+ - `@contractspec/module.audit-trail` - Action auditing
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
@@ -0,0 +1,10 @@
1
+ import * as _contractspec_lib_schema55 from "@contractspec/lib.schema";
2
+
3
+ //#region src/connection/connection.enum.d.ts
4
+ /**
5
+ * Connection status enum.
6
+ */
7
+ declare const ConnectionStatusEnum: _contractspec_lib_schema55.EnumType<[string, string, string, string, string]>;
8
+ //#endregion
9
+ export { ConnectionStatusEnum };
10
+ //# sourceMappingURL=connection.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.enum.d.ts","names":[],"sources":["../../src/connection/connection.enum.ts"],"sourcesContent":[],"mappings":";;;;;;AAKa,cAAA,oBAMX,EAAA,0BAAA,CAN+B,QAAA,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { defineEnum } from "@contractspec/lib.schema";
2
+
3
+ //#region src/connection/connection.enum.ts
4
+ /**
5
+ * Connection status enum.
6
+ */
7
+ const ConnectionStatusEnum = defineEnum("ConnectionStatus", [
8
+ "PENDING",
9
+ "CONNECTED",
10
+ "DISCONNECTED",
11
+ "ERROR",
12
+ "EXPIRED"
13
+ ]);
14
+
15
+ //#endregion
16
+ export { ConnectionStatusEnum };
17
+ //# sourceMappingURL=connection.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.enum.js","names":[],"sources":["../../src/connection/connection.enum.ts"],"sourcesContent":["import { defineEnum } from '@contractspec/lib.schema';\n\n/**\n * Connection status enum.\n */\nexport const ConnectionStatusEnum = defineEnum('ConnectionStatus', [\n 'PENDING',\n 'CONNECTED',\n 'DISCONNECTED',\n 'ERROR',\n 'EXPIRED',\n]);\n"],"mappings":";;;;;;AAKA,MAAa,uBAAuB,WAAW,oBAAoB;CACjE;CACA;CACA;CACA;CACA;CACD,CAAC"}
@@ -0,0 +1,107 @@
1
+ import * as _contractspec_lib_contracts16 from "@contractspec/lib.contracts";
2
+ import * as _contractspec_lib_schema56 from "@contractspec/lib.schema";
3
+
4
+ //#region src/connection/connection.operation.d.ts
5
+ /**
6
+ * Create a connection to an external system.
7
+ */
8
+ declare const CreateConnectionContract: _contractspec_lib_contracts16.OperationSpec<_contractspec_lib_schema56.SchemaModel<{
9
+ integrationId: {
10
+ type: _contractspec_lib_schema56.FieldType<string, string>;
11
+ isOptional: false;
12
+ };
13
+ name: {
14
+ type: _contractspec_lib_schema56.FieldType<string, string>;
15
+ isOptional: false;
16
+ };
17
+ authType: {
18
+ type: _contractspec_lib_schema56.FieldType<string, string>;
19
+ isOptional: false;
20
+ };
21
+ credentials: {
22
+ type: _contractspec_lib_schema56.FieldType<unknown, unknown>;
23
+ isOptional: true;
24
+ };
25
+ }>, _contractspec_lib_schema56.SchemaModel<{
26
+ id: {
27
+ type: _contractspec_lib_schema56.FieldType<string, string>;
28
+ isOptional: false;
29
+ };
30
+ integrationId: {
31
+ type: _contractspec_lib_schema56.FieldType<string, string>;
32
+ isOptional: false;
33
+ };
34
+ name: {
35
+ type: _contractspec_lib_schema56.FieldType<string, string>;
36
+ isOptional: false;
37
+ };
38
+ status: {
39
+ type: _contractspec_lib_schema56.EnumType<[string, string, string, string, string]>;
40
+ isOptional: false;
41
+ };
42
+ authType: {
43
+ type: _contractspec_lib_schema56.FieldType<string, string>;
44
+ isOptional: false;
45
+ };
46
+ externalAccountName: {
47
+ type: _contractspec_lib_schema56.FieldType<string, string>;
48
+ isOptional: true;
49
+ };
50
+ connectedAt: {
51
+ type: _contractspec_lib_schema56.FieldType<Date, string>;
52
+ isOptional: true;
53
+ };
54
+ lastHealthCheck: {
55
+ type: _contractspec_lib_schema56.FieldType<Date, string>;
56
+ isOptional: true;
57
+ };
58
+ healthStatus: {
59
+ type: _contractspec_lib_schema56.FieldType<string, string>;
60
+ isOptional: true;
61
+ };
62
+ }>, {
63
+ key: string;
64
+ version: string;
65
+ when: string;
66
+ payload: _contractspec_lib_schema56.SchemaModel<{
67
+ id: {
68
+ type: _contractspec_lib_schema56.FieldType<string, string>;
69
+ isOptional: false;
70
+ };
71
+ integrationId: {
72
+ type: _contractspec_lib_schema56.FieldType<string, string>;
73
+ isOptional: false;
74
+ };
75
+ name: {
76
+ type: _contractspec_lib_schema56.FieldType<string, string>;
77
+ isOptional: false;
78
+ };
79
+ status: {
80
+ type: _contractspec_lib_schema56.EnumType<[string, string, string, string, string]>;
81
+ isOptional: false;
82
+ };
83
+ authType: {
84
+ type: _contractspec_lib_schema56.FieldType<string, string>;
85
+ isOptional: false;
86
+ };
87
+ externalAccountName: {
88
+ type: _contractspec_lib_schema56.FieldType<string, string>;
89
+ isOptional: true;
90
+ };
91
+ connectedAt: {
92
+ type: _contractspec_lib_schema56.FieldType<Date, string>;
93
+ isOptional: true;
94
+ };
95
+ lastHealthCheck: {
96
+ type: _contractspec_lib_schema56.FieldType<Date, string>;
97
+ isOptional: true;
98
+ };
99
+ healthStatus: {
100
+ type: _contractspec_lib_schema56.FieldType<string, string>;
101
+ isOptional: true;
102
+ };
103
+ }>;
104
+ }[]>;
105
+ //#endregion
106
+ export { CreateConnectionContract };
107
+ //# sourceMappingURL=connection.operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.operation.d.ts","names":[],"sources":["../../src/connection/connection.operation.ts"],"sourcesContent":[],"mappings":";;;;;;;cAWa,wDAAwB,yCAAA;EAAxB,aAAA,EAAA;IAiDX,IAAA,EAAA,0BAAA,CAAA,SAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;8CAjDmC,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;UAAA,0BAAA,CAAA;;;;;;;;;;;;6CAAA,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;IAAA,UAAA,EAAA,KAAA"}
@@ -0,0 +1,63 @@
1
+ import { ConnectionModel, CreateConnectionInputModel } from "./connection.schema.js";
2
+ import { defineCommand } from "@contractspec/lib.contracts/operations";
3
+
4
+ //#region src/connection/connection.operation.ts
5
+ const OWNERS = ["@example.integration-hub"];
6
+ /**
7
+ * Create a connection to an external system.
8
+ */
9
+ const CreateConnectionContract = defineCommand({
10
+ meta: {
11
+ key: "integration.connection.create",
12
+ version: "1.0.0",
13
+ stability: "stable",
14
+ owners: [...OWNERS],
15
+ tags: [
16
+ "integration",
17
+ "connection",
18
+ "create"
19
+ ],
20
+ description: "Create a connection to an external system.",
21
+ goal: "Authenticate with external systems.",
22
+ context: "Connection setup."
23
+ },
24
+ io: {
25
+ input: CreateConnectionInputModel,
26
+ output: ConnectionModel
27
+ },
28
+ policy: { auth: "user" },
29
+ sideEffects: {
30
+ emits: [{
31
+ key: "integration.connection.created",
32
+ version: "1.0.0",
33
+ when: "Connection created",
34
+ payload: ConnectionModel
35
+ }],
36
+ audit: ["integration.connection.created"]
37
+ },
38
+ acceptance: {
39
+ scenarios: [{
40
+ key: "create-connection-happy-path",
41
+ given: ["User is authenticated"],
42
+ when: ["User creates connection with valid credentials"],
43
+ then: ["Connection is created", "ConnectionCreated event is emitted"]
44
+ }],
45
+ examples: [{
46
+ key: "connect-crm",
47
+ input: {
48
+ name: "Salesforce Prod",
49
+ integrationId: "salesforce",
50
+ credentials: { clientId: "xxx" }
51
+ },
52
+ output: {
53
+ id: "conn-123",
54
+ status: "connected",
55
+ connectedAt: "2025-01-01T12:00:00Z"
56
+ }
57
+ }]
58
+ }
59
+ });
60
+
61
+ //#endregion
62
+ export { CreateConnectionContract };
63
+ //# sourceMappingURL=connection.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.operation.js","names":[],"sources":["../../src/connection/connection.operation.ts"],"sourcesContent":["import { defineCommand } from '@contractspec/lib.contracts/operations';\nimport {\n ConnectionModel,\n CreateConnectionInputModel,\n} from './connection.schema';\n\nconst OWNERS = ['@example.integration-hub'] as const;\n\n/**\n * Create a connection to an external system.\n */\nexport const CreateConnectionContract = defineCommand({\n meta: {\n key: 'integration.connection.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['integration', 'connection', 'create'],\n description: 'Create a connection to an external system.',\n goal: 'Authenticate with external systems.',\n context: 'Connection setup.',\n },\n io: { input: CreateConnectionInputModel, output: ConnectionModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'integration.connection.created',\n version: '1.0.0',\n when: 'Connection created',\n payload: ConnectionModel,\n },\n ],\n audit: ['integration.connection.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-connection-happy-path',\n given: ['User is authenticated'],\n when: ['User creates connection with valid credentials'],\n then: ['Connection is created', 'ConnectionCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'connect-crm',\n input: {\n name: 'Salesforce Prod',\n integrationId: 'salesforce',\n credentials: { clientId: 'xxx' },\n },\n output: {\n id: 'conn-123',\n status: 'connected',\n connectedAt: '2025-01-01T12:00:00Z',\n },\n },\n ],\n },\n});\n"],"mappings":";;;;AAMA,MAAM,SAAS,CAAC,2BAA2B;;;;AAK3C,MAAa,2BAA2B,cAAc;CACpD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAc;GAAS;EAC7C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAA4B,QAAQ;EAAiB;CAClE,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,iCAAiC;EAC1C;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,wBAAwB;GAChC,MAAM,CAAC,iDAAiD;GACxD,MAAM,CAAC,yBAAyB,qCAAqC;GACtE,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,MAAM;IACN,eAAe;IACf,aAAa,EAAE,UAAU,OAAO;IACjC;GACD,QAAQ;IACN,IAAI;IACJ,QAAQ;IACR,aAAa;IACd;GACF,CACF;EACF;CACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import * as _contractspec_lib_contracts17 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/connection/connection.presentation.d.ts
4
+ declare const ConnectionListPresentation: _contractspec_lib_contracts17.PresentationSpec;
5
+ declare const ConnectionSetupPresentation: _contractspec_lib_contracts17.PresentationSpec;
6
+ //#endregion
7
+ export { ConnectionListPresentation, ConnectionSetupPresentation };
8
+ //# sourceMappingURL=connection.presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.presentation.d.ts","names":[],"sources":["../../src/connection/connection.presentation.ts"],"sourcesContent":[],"mappings":";;;cAGa,4BAuBX,6BAAA,CAvBqC;cAyB1B,6BAuBX,6BAAA,CAvBsC"}
@@ -0,0 +1,60 @@
1
+ import { ConnectionModel } from "./connection.schema.js";
2
+ import { StabilityEnum, definePresentation } from "@contractspec/lib.contracts";
3
+
4
+ //#region src/connection/connection.presentation.ts
5
+ const ConnectionListPresentation = definePresentation({
6
+ meta: {
7
+ key: "integration.connection.list",
8
+ version: "1.0.0",
9
+ title: "Connection List",
10
+ description: "List of integration connections",
11
+ domain: "integration",
12
+ owners: ["@integration-team"],
13
+ tags: [
14
+ "integration",
15
+ "connection",
16
+ "list"
17
+ ],
18
+ stability: StabilityEnum.Experimental,
19
+ goal: "Provide an overview of all established integration connections.",
20
+ context: "The primary management view for integration hubs."
21
+ },
22
+ source: {
23
+ type: "component",
24
+ framework: "react",
25
+ componentKey: "ConnectionList",
26
+ props: ConnectionModel
27
+ },
28
+ targets: ["react", "markdown"],
29
+ policy: { flags: ["integration.enabled"] }
30
+ });
31
+ const ConnectionSetupPresentation = definePresentation({
32
+ meta: {
33
+ key: "integration.connection.setup",
34
+ version: "1.0.0",
35
+ title: "Connection Setup",
36
+ description: "Setup wizard for creating integration connections",
37
+ domain: "integration",
38
+ owners: ["@integration-team"],
39
+ tags: [
40
+ "integration",
41
+ "connection",
42
+ "setup"
43
+ ],
44
+ stability: StabilityEnum.Experimental,
45
+ goal: "Guide users through the multi-step process of connecting to a new integration.",
46
+ context: "The onboarding flow for new integrations."
47
+ },
48
+ source: {
49
+ type: "component",
50
+ framework: "react",
51
+ componentKey: "ConnectionSetup",
52
+ props: ConnectionModel
53
+ },
54
+ targets: ["react"],
55
+ policy: { flags: ["integration.enabled"] }
56
+ });
57
+
58
+ //#endregion
59
+ export { ConnectionListPresentation, ConnectionSetupPresentation };
60
+ //# sourceMappingURL=connection.presentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.presentation.js","names":[],"sources":["../../src/connection/connection.presentation.ts"],"sourcesContent":["import { definePresentation, StabilityEnum } from '@contractspec/lib.contracts';\nimport { ConnectionModel } from './connection.schema';\n\nexport const ConnectionListPresentation = definePresentation({\n meta: {\n key: 'integration.connection.list',\n version: '1.0.0',\n title: 'Connection List',\n description: 'List of integration connections',\n domain: 'integration',\n owners: ['@integration-team'],\n tags: ['integration', 'connection', 'list'],\n stability: StabilityEnum.Experimental,\n goal: 'Provide an overview of all established integration connections.',\n context: 'The primary management view for integration hubs.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ConnectionList',\n props: ConnectionModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['integration.enabled'],\n },\n});\n\nexport const ConnectionSetupPresentation = definePresentation({\n meta: {\n key: 'integration.connection.setup',\n version: '1.0.0',\n title: 'Connection Setup',\n description: 'Setup wizard for creating integration connections',\n domain: 'integration',\n owners: ['@integration-team'],\n tags: ['integration', 'connection', 'setup'],\n stability: StabilityEnum.Experimental,\n goal: 'Guide users through the multi-step process of connecting to a new integration.',\n context: 'The onboarding flow for new integrations.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ConnectionSetup',\n props: ConnectionModel,\n },\n targets: ['react'],\n policy: {\n flags: ['integration.enabled'],\n },\n});\n"],"mappings":";;;;AAGA,MAAa,6BAA6B,mBAAmB;CAC3D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAc;GAAO;EAC3C,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,sBAAsB,EAC/B;CACF,CAAC;AAEF,MAAa,8BAA8B,mBAAmB;CAC5D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAc;GAAQ;EAC5C,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,sBAAsB,EAC/B;CACF,CAAC"}
@@ -0,0 +1,68 @@
1
+ import * as _contractspec_lib_schema81 from "@contractspec/lib.schema";
2
+
3
+ //#region src/connection/connection.schema.d.ts
4
+ /**
5
+ * A connection to an external system.
6
+ */
7
+ declare const ConnectionModel: _contractspec_lib_schema81.SchemaModel<{
8
+ id: {
9
+ type: _contractspec_lib_schema81.FieldType<string, string>;
10
+ isOptional: false;
11
+ };
12
+ integrationId: {
13
+ type: _contractspec_lib_schema81.FieldType<string, string>;
14
+ isOptional: false;
15
+ };
16
+ name: {
17
+ type: _contractspec_lib_schema81.FieldType<string, string>;
18
+ isOptional: false;
19
+ };
20
+ status: {
21
+ type: _contractspec_lib_schema81.EnumType<[string, string, string, string, string]>;
22
+ isOptional: false;
23
+ };
24
+ authType: {
25
+ type: _contractspec_lib_schema81.FieldType<string, string>;
26
+ isOptional: false;
27
+ };
28
+ externalAccountName: {
29
+ type: _contractspec_lib_schema81.FieldType<string, string>;
30
+ isOptional: true;
31
+ };
32
+ connectedAt: {
33
+ type: _contractspec_lib_schema81.FieldType<Date, string>;
34
+ isOptional: true;
35
+ };
36
+ lastHealthCheck: {
37
+ type: _contractspec_lib_schema81.FieldType<Date, string>;
38
+ isOptional: true;
39
+ };
40
+ healthStatus: {
41
+ type: _contractspec_lib_schema81.FieldType<string, string>;
42
+ isOptional: true;
43
+ };
44
+ }>;
45
+ /**
46
+ * Input for creating a connection.
47
+ */
48
+ declare const CreateConnectionInputModel: _contractspec_lib_schema81.SchemaModel<{
49
+ integrationId: {
50
+ type: _contractspec_lib_schema81.FieldType<string, string>;
51
+ isOptional: false;
52
+ };
53
+ name: {
54
+ type: _contractspec_lib_schema81.FieldType<string, string>;
55
+ isOptional: false;
56
+ };
57
+ authType: {
58
+ type: _contractspec_lib_schema81.FieldType<string, string>;
59
+ isOptional: false;
60
+ };
61
+ credentials: {
62
+ type: _contractspec_lib_schema81.FieldType<unknown, unknown>;
63
+ isOptional: true;
64
+ };
65
+ }>;
66
+ //#endregion
67
+ export { ConnectionModel, CreateConnectionInputModel };
68
+ //# sourceMappingURL=connection.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.schema.d.ts","names":[],"sources":["../../src/connection/connection.schema.ts"],"sourcesContent":[],"mappings":";;;;;;AAMa,cAAA,eAmBX,6BAnB0B,WAmB1B,CAAA;EAAA,EAAA,EAAA;UAAA,0BAAA,CAAA;;;;;;;;;;;EAnB0B,MAAA,EAAA;IAwBf,IAAA,qCAWX,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;EAXqC,CAAA;;;;;;;;;;;;;;;;;;;;;cAA1B,uDAA0B;;UAWrC,0BAAA,CAAA"}
@@ -0,0 +1,76 @@
1
+ import { ConnectionStatusEnum } from "./connection.enum.js";
2
+ import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
3
+
4
+ //#region src/connection/connection.schema.ts
5
+ /**
6
+ * A connection to an external system.
7
+ */
8
+ const ConnectionModel = defineSchemaModel({
9
+ name: "ConnectionModel",
10
+ fields: {
11
+ id: {
12
+ type: ScalarTypeEnum.String_unsecure(),
13
+ isOptional: false
14
+ },
15
+ integrationId: {
16
+ type: ScalarTypeEnum.String_unsecure(),
17
+ isOptional: false
18
+ },
19
+ name: {
20
+ type: ScalarTypeEnum.String_unsecure(),
21
+ isOptional: false
22
+ },
23
+ status: {
24
+ type: ConnectionStatusEnum,
25
+ isOptional: false
26
+ },
27
+ authType: {
28
+ type: ScalarTypeEnum.String_unsecure(),
29
+ isOptional: false
30
+ },
31
+ externalAccountName: {
32
+ type: ScalarTypeEnum.String_unsecure(),
33
+ isOptional: true
34
+ },
35
+ connectedAt: {
36
+ type: ScalarTypeEnum.DateTime(),
37
+ isOptional: true
38
+ },
39
+ lastHealthCheck: {
40
+ type: ScalarTypeEnum.DateTime(),
41
+ isOptional: true
42
+ },
43
+ healthStatus: {
44
+ type: ScalarTypeEnum.String_unsecure(),
45
+ isOptional: true
46
+ }
47
+ }
48
+ });
49
+ /**
50
+ * Input for creating a connection.
51
+ */
52
+ const CreateConnectionInputModel = defineSchemaModel({
53
+ name: "CreateConnectionInput",
54
+ fields: {
55
+ integrationId: {
56
+ type: ScalarTypeEnum.String_unsecure(),
57
+ isOptional: false
58
+ },
59
+ name: {
60
+ type: ScalarTypeEnum.NonEmptyString(),
61
+ isOptional: false
62
+ },
63
+ authType: {
64
+ type: ScalarTypeEnum.NonEmptyString(),
65
+ isOptional: false
66
+ },
67
+ credentials: {
68
+ type: ScalarTypeEnum.JSON(),
69
+ isOptional: true
70
+ }
71
+ }
72
+ });
73
+
74
+ //#endregion
75
+ export { ConnectionModel, CreateConnectionInputModel };
76
+ //# sourceMappingURL=connection.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.schema.js","names":[],"sources":["../../src/connection/connection.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { ConnectionStatusEnum } from './connection.enum';\n\n/**\n * A connection to an external system.\n */\nexport const ConnectionModel = defineSchemaModel({\n name: 'ConnectionModel',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n integrationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ConnectionStatusEnum, isOptional: false },\n authType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n externalAccountName: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n connectedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n lastHealthCheck: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n healthStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Input for creating a connection.\n */\nexport const CreateConnectionInputModel = defineSchemaModel({\n name: 'CreateConnectionInput',\n fields: {\n integrationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n authType: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n credentials: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,kBAAkB,kBAAkB;CAC/C,MAAM;CACN,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,eAAe;GACb,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,QAAQ;GAAE,MAAM;GAAsB,YAAY;GAAO;EACzD,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,qBAAqB;GACnB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,aAAa;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAClE,iBAAiB;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EACtE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EAC3E;CACF,CAAC;;;;AAKF,MAAa,6BAA6B,kBAAkB;CAC1D,MAAM;CACN,QAAQ;EACN,eAAe;GACb,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,MAAM;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAClE,UAAU;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACtE,aAAa;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAM;EAC/D;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ConnectionStatusEnum } from "./connection.enum.js";
2
+ import { CreateConnectionContract } from "./connection.operation.js";
3
+ import { ConnectionModel, CreateConnectionInputModel } from "./connection.schema.js";
4
+ export { ConnectionModel, ConnectionStatusEnum, CreateConnectionContract, CreateConnectionInputModel };
@@ -0,0 +1,5 @@
1
+ import { ConnectionStatusEnum } from "./connection.enum.js";
2
+ import { ConnectionModel, CreateConnectionInputModel } from "./connection.schema.js";
3
+ import { CreateConnectionContract } from "./connection.operation.js";
4
+
5
+ export { ConnectionModel, ConnectionStatusEnum, CreateConnectionContract, CreateConnectionInputModel };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ import "./integration-hub.docblock.js";
@@ -0,0 +1 @@
1
+ export { };