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