@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.
Files changed (190) hide show
  1. package/dist/browser/connection/connection.enum.js +12 -0
  2. package/dist/browser/connection/connection.operation.js +101 -0
  3. package/dist/browser/connection/connection.presentation.js +99 -0
  4. package/dist/browser/connection/connection.schema.js +48 -0
  5. package/dist/browser/connection/index.js +104 -0
  6. package/dist/browser/docs/index.js +104 -0
  7. package/dist/browser/docs/integration-hub.docblock.js +104 -0
  8. package/dist/browser/events.js +211 -0
  9. package/dist/browser/example.js +42 -0
  10. package/dist/browser/handlers/index.js +246 -0
  11. package/dist/browser/handlers/integration.handlers.js +246 -0
  12. package/dist/browser/index.js +1595 -0
  13. package/dist/browser/integration/index.js +92 -0
  14. package/dist/browser/integration/integration.enum.js +12 -0
  15. package/dist/browser/integration/integration.operations.js +89 -0
  16. package/dist/browser/integration/integration.presentation.js +117 -0
  17. package/dist/browser/integration/integration.schema.js +42 -0
  18. package/dist/browser/integration-hub.capability.js +40 -0
  19. package/dist/browser/integration-hub.feature.js +114 -0
  20. package/dist/browser/seeders/index.js +60 -0
  21. package/dist/browser/sync/index.js +332 -0
  22. package/dist/browser/sync/sync.enum.js +26 -0
  23. package/dist/browser/sync/sync.operations.js +321 -0
  24. package/dist/browser/sync/sync.presentation.js +298 -0
  25. package/dist/browser/sync/sync.schema.js +154 -0
  26. package/dist/browser/sync-engine/index.js +186 -0
  27. package/dist/browser/tests/operations.test-spec.js +85 -0
  28. package/dist/browser/ui/IntegrationDashboard.js +369 -0
  29. package/dist/browser/ui/hooks/index.js +57 -0
  30. package/dist/browser/ui/hooks/useIntegrationData.js +54 -0
  31. package/dist/browser/ui/index.js +644 -0
  32. package/dist/browser/ui/renderers/index.js +273 -0
  33. package/dist/browser/ui/renderers/integration.markdown.js +273 -0
  34. package/dist/connection/connection.enum.d.ts +1 -6
  35. package/dist/connection/connection.enum.d.ts.map +1 -1
  36. package/dist/connection/connection.enum.js +11 -15
  37. package/dist/connection/connection.operation.d.ts +78 -84
  38. package/dist/connection/connection.operation.d.ts.map +1 -1
  39. package/dist/connection/connection.operation.js +99 -60
  40. package/dist/connection/connection.presentation.d.ts +2 -7
  41. package/dist/connection/connection.presentation.d.ts.map +1 -1
  42. package/dist/connection/connection.presentation.js +96 -56
  43. package/dist/connection/connection.schema.d.ts +54 -59
  44. package/dist/connection/connection.schema.d.ts.map +1 -1
  45. package/dist/connection/connection.schema.js +46 -73
  46. package/dist/connection/index.d.ts +7 -4
  47. package/dist/connection/index.d.ts.map +1 -0
  48. package/dist/connection/index.js +104 -4
  49. package/dist/docs/index.d.ts +2 -1
  50. package/dist/docs/index.d.ts.map +1 -0
  51. package/dist/docs/index.js +105 -1
  52. package/dist/docs/integration-hub.docblock.d.ts +2 -1
  53. package/dist/docs/integration-hub.docblock.d.ts.map +1 -0
  54. package/dist/docs/integration-hub.docblock.js +45 -56
  55. package/dist/events.d.ts +137 -143
  56. package/dist/events.d.ts.map +1 -1
  57. package/dist/events.js +210 -287
  58. package/dist/example.d.ts +2 -6
  59. package/dist/example.d.ts.map +1 -1
  60. package/dist/example.js +41 -55
  61. package/dist/handlers/index.d.ts +2 -2
  62. package/dist/handlers/index.d.ts.map +1 -0
  63. package/dist/handlers/index.js +247 -3
  64. package/dist/handlers/integration.handlers.d.ts +114 -113
  65. package/dist/handlers/integration.handlers.d.ts.map +1 -1
  66. package/dist/handlers/integration.handlers.js +232 -267
  67. package/dist/index.d.ts +12 -19
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +1596 -20
  70. package/dist/integration/index.d.ts +7 -4
  71. package/dist/integration/index.d.ts.map +1 -0
  72. package/dist/integration/index.js +92 -4
  73. package/dist/integration/integration.enum.d.ts +1 -6
  74. package/dist/integration/integration.enum.d.ts.map +1 -1
  75. package/dist/integration/integration.enum.js +11 -15
  76. package/dist/integration/integration.operations.d.ts +74 -80
  77. package/dist/integration/integration.operations.d.ts.map +1 -1
  78. package/dist/integration/integration.operations.js +87 -54
  79. package/dist/integration/integration.presentation.d.ts +3 -8
  80. package/dist/integration/integration.presentation.d.ts.map +1 -1
  81. package/dist/integration/integration.presentation.js +114 -73
  82. package/dist/integration/integration.schema.d.ts +54 -59
  83. package/dist/integration/integration.schema.d.ts.map +1 -1
  84. package/dist/integration/integration.schema.js +40 -73
  85. package/dist/integration-hub.capability.d.ts +3 -8
  86. package/dist/integration-hub.capability.d.ts.map +1 -1
  87. package/dist/integration-hub.capability.js +41 -38
  88. package/dist/integration-hub.feature.d.ts +1 -6
  89. package/dist/integration-hub.feature.d.ts.map +1 -1
  90. package/dist/integration-hub.feature.js +113 -242
  91. package/dist/node/connection/connection.enum.js +12 -0
  92. package/dist/node/connection/connection.operation.js +101 -0
  93. package/dist/node/connection/connection.presentation.js +99 -0
  94. package/dist/node/connection/connection.schema.js +48 -0
  95. package/dist/node/connection/index.js +104 -0
  96. package/dist/node/docs/index.js +104 -0
  97. package/dist/node/docs/integration-hub.docblock.js +104 -0
  98. package/dist/node/events.js +211 -0
  99. package/dist/node/example.js +42 -0
  100. package/dist/node/handlers/index.js +246 -0
  101. package/dist/node/handlers/integration.handlers.js +246 -0
  102. package/dist/node/index.js +1595 -0
  103. package/dist/node/integration/index.js +92 -0
  104. package/dist/node/integration/integration.enum.js +12 -0
  105. package/dist/node/integration/integration.operations.js +89 -0
  106. package/dist/node/integration/integration.presentation.js +117 -0
  107. package/dist/node/integration/integration.schema.js +42 -0
  108. package/dist/node/integration-hub.capability.js +40 -0
  109. package/dist/node/integration-hub.feature.js +114 -0
  110. package/dist/node/seeders/index.js +60 -0
  111. package/dist/node/sync/index.js +332 -0
  112. package/dist/node/sync/sync.enum.js +26 -0
  113. package/dist/node/sync/sync.operations.js +321 -0
  114. package/dist/node/sync/sync.presentation.js +298 -0
  115. package/dist/node/sync/sync.schema.js +154 -0
  116. package/dist/node/sync-engine/index.js +186 -0
  117. package/dist/node/tests/operations.test-spec.js +85 -0
  118. package/dist/node/ui/IntegrationDashboard.js +369 -0
  119. package/dist/node/ui/hooks/index.js +57 -0
  120. package/dist/node/ui/hooks/useIntegrationData.js +54 -0
  121. package/dist/node/ui/index.js +644 -0
  122. package/dist/node/ui/renderers/index.js +273 -0
  123. package/dist/node/ui/renderers/integration.markdown.js +273 -0
  124. package/dist/seeders/index.d.ts +4 -8
  125. package/dist/seeders/index.d.ts.map +1 -1
  126. package/dist/seeders/index.js +54 -52
  127. package/dist/sync/index.d.ts +7 -4
  128. package/dist/sync/index.d.ts.map +1 -0
  129. package/dist/sync/index.js +332 -4
  130. package/dist/sync/sync.enum.d.ts +3 -8
  131. package/dist/sync/sync.enum.d.ts.map +1 -1
  132. package/dist/sync/sync.enum.js +23 -31
  133. package/dist/sync/sync.operations.d.ts +413 -419
  134. package/dist/sync/sync.operations.d.ts.map +1 -1
  135. package/dist/sync/sync.operations.js +316 -197
  136. package/dist/sync/sync.presentation.d.ts +6 -11
  137. package/dist/sync/sync.presentation.d.ts.map +1 -1
  138. package/dist/sync/sync.presentation.js +291 -160
  139. package/dist/sync/sync.schema.d.ts +317 -322
  140. package/dist/sync/sync.schema.d.ts.map +1 -1
  141. package/dist/sync/sync.schema.js +146 -295
  142. package/dist/sync-engine/index.d.ts +88 -91
  143. package/dist/sync-engine/index.d.ts.map +1 -1
  144. package/dist/sync-engine/index.js +181 -142
  145. package/dist/tests/operations.test-spec.d.ts +3 -8
  146. package/dist/tests/operations.test-spec.d.ts.map +1 -1
  147. package/dist/tests/operations.test-spec.js +82 -90
  148. package/dist/ui/IntegrationDashboard.d.ts +1 -6
  149. package/dist/ui/IntegrationDashboard.d.ts.map +1 -1
  150. package/dist/ui/IntegrationDashboard.js +365 -261
  151. package/dist/ui/hooks/index.d.ts +2 -2
  152. package/dist/ui/hooks/index.d.ts.map +1 -0
  153. package/dist/ui/hooks/index.js +57 -4
  154. package/dist/ui/hooks/useIntegrationData.d.ts +16 -20
  155. package/dist/ui/hooks/useIntegrationData.d.ts.map +1 -1
  156. package/dist/ui/hooks/useIntegrationData.js +51 -55
  157. package/dist/ui/index.d.ts +7 -6
  158. package/dist/ui/index.d.ts.map +1 -0
  159. package/dist/ui/index.js +644 -5
  160. package/dist/ui/renderers/index.d.ts +2 -2
  161. package/dist/ui/renderers/index.d.ts.map +1 -0
  162. package/dist/ui/renderers/index.js +274 -3
  163. package/dist/ui/renderers/integration.markdown.d.ts +13 -14
  164. package/dist/ui/renderers/integration.markdown.d.ts.map +1 -1
  165. package/dist/ui/renderers/integration.markdown.js +268 -264
  166. package/package.json +360 -71
  167. package/dist/connection/connection.enum.js.map +0 -1
  168. package/dist/connection/connection.operation.js.map +0 -1
  169. package/dist/connection/connection.presentation.js.map +0 -1
  170. package/dist/connection/connection.schema.js.map +0 -1
  171. package/dist/docs/integration-hub.docblock.js.map +0 -1
  172. package/dist/events.js.map +0 -1
  173. package/dist/example.js.map +0 -1
  174. package/dist/handlers/integration.handlers.js.map +0 -1
  175. package/dist/integration/integration.enum.js.map +0 -1
  176. package/dist/integration/integration.operations.js.map +0 -1
  177. package/dist/integration/integration.presentation.js.map +0 -1
  178. package/dist/integration/integration.schema.js.map +0 -1
  179. package/dist/integration-hub.capability.js.map +0 -1
  180. package/dist/integration-hub.feature.js.map +0 -1
  181. package/dist/seeders/index.js.map +0 -1
  182. package/dist/sync/sync.enum.js.map +0 -1
  183. package/dist/sync/sync.operations.js.map +0 -1
  184. package/dist/sync/sync.presentation.js.map +0 -1
  185. package/dist/sync/sync.schema.js.map +0 -1
  186. package/dist/sync-engine/index.js.map +0 -1
  187. package/dist/tests/operations.test-spec.js.map +0 -1
  188. package/dist/ui/IntegrationDashboard.js.map +0 -1
  189. package/dist/ui/hooks/useIntegrationData.js.map +0 -1
  190. package/dist/ui/renderers/integration.markdown.js.map +0 -1
@@ -1,244 +1,115 @@
1
+ // @bun
2
+ // src/integration-hub.feature.ts
1
3
  import { defineFeature } from "@contractspec/lib.contracts";
2
-
3
- //#region src/integration-hub.feature.ts
4
- /**
5
- * Integration Hub Feature Module Specification
6
- */
7
- const IntegrationHubFeature = defineFeature({
8
- meta: {
9
- key: "integration-hub",
10
- version: "1.0.0",
11
- title: "Integration Hub",
12
- description: "Connect and sync data with external systems through configurable integrations",
13
- domain: "integration",
14
- owners: ["@integration-team"],
15
- tags: [
16
- "integration",
17
- "sync",
18
- "etl",
19
- "connectors"
20
- ],
21
- stability: "experimental"
22
- },
23
- operations: [
24
- {
25
- key: "integration.create",
26
- version: "1.0.0"
27
- },
28
- {
29
- key: "integration.connection.create",
30
- version: "1.0.0"
31
- },
32
- {
33
- key: "integration.syncConfig.create",
34
- version: "1.0.0"
35
- },
36
- {
37
- key: "integration.fieldMapping.add",
38
- version: "1.0.0"
39
- },
40
- {
41
- key: "integration.sync.trigger",
42
- version: "1.0.0"
43
- },
44
- {
45
- key: "integration.syncRun.list",
46
- version: "1.0.0"
47
- }
48
- ],
49
- events: [
50
- {
51
- key: "integration.created",
52
- version: "1.0.0"
53
- },
54
- {
55
- key: "integration.connection.created",
56
- version: "1.0.0"
57
- },
58
- {
59
- key: "integration.connection.statusChanged",
60
- version: "1.0.0"
61
- },
62
- {
63
- key: "integration.syncConfig.created",
64
- version: "1.0.0"
65
- },
66
- {
67
- key: "integration.sync.started",
68
- version: "1.0.0"
69
- },
70
- {
71
- key: "integration.sync.completed",
72
- version: "1.0.0"
73
- },
74
- {
75
- key: "integration.sync.failed",
76
- version: "1.0.0"
77
- },
78
- {
79
- key: "integration.record.synced",
80
- version: "1.0.0"
81
- },
82
- {
83
- key: "integration.fieldMapping.added",
84
- version: "1.0.0"
85
- }
86
- ],
87
- presentations: [
88
- {
89
- key: "integration.list",
90
- version: "1.0.0"
91
- },
92
- {
93
- key: "integration.detail",
94
- version: "1.0.0"
95
- },
96
- {
97
- key: "integration.connection.list",
98
- version: "1.0.0"
99
- },
100
- {
101
- key: "integration.connection.setup",
102
- version: "1.0.0"
103
- },
104
- {
105
- key: "integration.syncConfig.list",
106
- version: "1.0.0"
107
- },
108
- {
109
- key: "integration.syncConfig.editor",
110
- version: "1.0.0"
111
- },
112
- {
113
- key: "integration.fieldMapping.editor",
114
- version: "1.0.0"
115
- },
116
- {
117
- key: "integration.syncRun.viewList",
118
- version: "1.0.0"
119
- },
120
- {
121
- key: "integration.syncRun.detail",
122
- version: "1.0.0"
123
- },
124
- {
125
- key: "integration.health",
126
- version: "1.0.0"
127
- },
128
- {
129
- key: "integration.sync.activity",
130
- version: "1.0.0"
131
- }
132
- ],
133
- opToPresentation: [
134
- {
135
- op: {
136
- key: "integration.syncConfig.create",
137
- version: "1.0.0"
138
- },
139
- pres: {
140
- key: "integration.syncConfig.editor",
141
- version: "1.0.0"
142
- }
143
- },
144
- {
145
- op: {
146
- key: "integration.fieldMapping.add",
147
- version: "1.0.0"
148
- },
149
- pres: {
150
- key: "integration.fieldMapping.editor",
151
- version: "1.0.0"
152
- }
153
- },
154
- {
155
- op: {
156
- key: "integration.syncRun.list",
157
- version: "1.0.0"
158
- },
159
- pres: {
160
- key: "integration.syncRun.viewList",
161
- version: "1.0.0"
162
- }
163
- }
164
- ],
165
- presentationsTargets: [
166
- {
167
- key: "integration.list",
168
- version: "1.0.0",
169
- targets: ["react", "markdown"]
170
- },
171
- {
172
- key: "integration.detail",
173
- version: "1.0.0",
174
- targets: ["react", "markdown"]
175
- },
176
- {
177
- key: "integration.syncConfig.list",
178
- version: "1.0.0",
179
- targets: ["react", "markdown"]
180
- },
181
- {
182
- key: "integration.syncConfig.editor",
183
- version: "1.0.0",
184
- targets: ["react"]
185
- },
186
- {
187
- key: "integration.fieldMapping.editor",
188
- version: "1.0.0",
189
- targets: ["react"]
190
- },
191
- {
192
- key: "integration.syncRun.viewList",
193
- version: "1.0.0",
194
- targets: ["react", "markdown"]
195
- },
196
- {
197
- key: "integration.syncRun.detail",
198
- version: "1.0.0",
199
- targets: ["react", "markdown"]
200
- }
201
- ],
202
- capabilities: {
203
- requires: [
204
- {
205
- key: "identity",
206
- version: "1.0.0"
207
- },
208
- {
209
- key: "audit-trail",
210
- version: "1.0.0"
211
- },
212
- {
213
- key: "feature-flags",
214
- version: "1.0.0"
215
- },
216
- {
217
- key: "jobs",
218
- version: "1.0.0"
219
- },
220
- {
221
- key: "files",
222
- version: "1.0.0"
223
- }
224
- ],
225
- provides: [
226
- {
227
- key: "integration",
228
- version: "1.0.0"
229
- },
230
- {
231
- key: "sync",
232
- version: "1.0.0"
233
- },
234
- {
235
- key: "etl",
236
- version: "1.0.0"
237
- }
238
- ]
239
- }
4
+ var IntegrationHubFeature = defineFeature({
5
+ meta: {
6
+ key: "integration-hub",
7
+ version: "1.0.0",
8
+ title: "Integration Hub",
9
+ description: "Connect and sync data with external systems through configurable integrations",
10
+ domain: "integration",
11
+ owners: ["@integration-team"],
12
+ tags: ["integration", "sync", "etl", "connectors"],
13
+ stability: "experimental"
14
+ },
15
+ operations: [
16
+ { key: "integration.create", version: "1.0.0" },
17
+ { key: "integration.connection.create", version: "1.0.0" },
18
+ { key: "integration.syncConfig.create", version: "1.0.0" },
19
+ { key: "integration.fieldMapping.add", version: "1.0.0" },
20
+ { key: "integration.sync.trigger", version: "1.0.0" },
21
+ { key: "integration.syncRun.list", version: "1.0.0" }
22
+ ],
23
+ events: [
24
+ { key: "integration.created", version: "1.0.0" },
25
+ { key: "integration.connection.created", version: "1.0.0" },
26
+ { key: "integration.connection.statusChanged", version: "1.0.0" },
27
+ { key: "integration.syncConfig.created", version: "1.0.0" },
28
+ { key: "integration.sync.started", version: "1.0.0" },
29
+ { key: "integration.sync.completed", version: "1.0.0" },
30
+ { key: "integration.sync.failed", version: "1.0.0" },
31
+ { key: "integration.record.synced", version: "1.0.0" },
32
+ { key: "integration.fieldMapping.added", version: "1.0.0" }
33
+ ],
34
+ presentations: [
35
+ { key: "integration.list", version: "1.0.0" },
36
+ { key: "integration.detail", version: "1.0.0" },
37
+ { key: "integration.connection.list", version: "1.0.0" },
38
+ { key: "integration.connection.setup", version: "1.0.0" },
39
+ { key: "integration.syncConfig.list", version: "1.0.0" },
40
+ { key: "integration.syncConfig.editor", version: "1.0.0" },
41
+ { key: "integration.fieldMapping.editor", version: "1.0.0" },
42
+ { key: "integration.syncRun.viewList", version: "1.0.0" },
43
+ { key: "integration.syncRun.detail", version: "1.0.0" },
44
+ { key: "integration.health", version: "1.0.0" },
45
+ { key: "integration.sync.activity", version: "1.0.0" }
46
+ ],
47
+ opToPresentation: [
48
+ {
49
+ op: { key: "integration.syncConfig.create", version: "1.0.0" },
50
+ pres: { key: "integration.syncConfig.editor", version: "1.0.0" }
51
+ },
52
+ {
53
+ op: { key: "integration.fieldMapping.add", version: "1.0.0" },
54
+ pres: { key: "integration.fieldMapping.editor", version: "1.0.0" }
55
+ },
56
+ {
57
+ op: { key: "integration.syncRun.list", version: "1.0.0" },
58
+ pres: { key: "integration.syncRun.viewList", version: "1.0.0" }
59
+ }
60
+ ],
61
+ presentationsTargets: [
62
+ {
63
+ key: "integration.list",
64
+ version: "1.0.0",
65
+ targets: ["react", "markdown"]
66
+ },
67
+ {
68
+ key: "integration.detail",
69
+ version: "1.0.0",
70
+ targets: ["react", "markdown"]
71
+ },
72
+ {
73
+ key: "integration.syncConfig.list",
74
+ version: "1.0.0",
75
+ targets: ["react", "markdown"]
76
+ },
77
+ {
78
+ key: "integration.syncConfig.editor",
79
+ version: "1.0.0",
80
+ targets: ["react"]
81
+ },
82
+ {
83
+ key: "integration.fieldMapping.editor",
84
+ version: "1.0.0",
85
+ targets: ["react"]
86
+ },
87
+ {
88
+ key: "integration.syncRun.viewList",
89
+ version: "1.0.0",
90
+ targets: ["react", "markdown"]
91
+ },
92
+ {
93
+ key: "integration.syncRun.detail",
94
+ version: "1.0.0",
95
+ targets: ["react", "markdown"]
96
+ }
97
+ ],
98
+ capabilities: {
99
+ requires: [
100
+ { key: "identity", version: "1.0.0" },
101
+ { key: "audit-trail", version: "1.0.0" },
102
+ { key: "feature-flags", version: "1.0.0" },
103
+ { key: "jobs", version: "1.0.0" },
104
+ { key: "files", version: "1.0.0" }
105
+ ],
106
+ provides: [
107
+ { key: "integration", version: "1.0.0" },
108
+ { key: "sync", version: "1.0.0" },
109
+ { key: "etl", version: "1.0.0" }
110
+ ]
111
+ }
240
112
  });
241
-
242
- //#endregion
243
- export { IntegrationHubFeature };
244
- //# sourceMappingURL=integration-hub.feature.js.map
113
+ export {
114
+ IntegrationHubFeature
115
+ };
@@ -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
+ };