@contractspec/example.integration-hub 1.46.1 → 1.47.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 (73) hide show
  1. package/dist/connection/connection.operation.d.ts +2 -2
  2. package/dist/connection/connection.operation.d.ts.map +1 -1
  3. package/dist/connection/connection.presentation.d.ts +3 -3
  4. package/dist/connection/connection.presentation.d.ts.map +1 -1
  5. package/dist/connection/connection.presentation.js +5 -5
  6. package/dist/connection/connection.presentation.js.map +1 -1
  7. package/dist/events.d.ts +10 -10
  8. package/dist/example.d.ts +2 -2
  9. package/dist/example.d.ts.map +1 -1
  10. package/dist/example.js +4 -2
  11. package/dist/example.js.map +1 -1
  12. package/dist/handlers/index.d.ts +2 -0
  13. package/dist/handlers/index.js +3 -0
  14. package/dist/handlers/integration.handlers.d.ts +130 -0
  15. package/dist/handlers/integration.handlers.d.ts.map +1 -0
  16. package/dist/handlers/integration.handlers.js +282 -0
  17. package/dist/handlers/integration.handlers.js.map +1 -0
  18. package/dist/index.d.ts +6 -1
  19. package/dist/index.js +6 -1
  20. package/dist/integration/integration.enum.d.ts +2 -2
  21. package/dist/integration/integration.enum.d.ts.map +1 -1
  22. package/dist/integration/integration.operations.d.ts +25 -25
  23. package/dist/integration/integration.operations.d.ts.map +1 -1
  24. package/dist/integration/integration.presentation.d.ts +4 -4
  25. package/dist/integration/integration.presentation.d.ts.map +1 -1
  26. package/dist/integration/integration.presentation.js +7 -7
  27. package/dist/integration/integration.presentation.js.map +1 -1
  28. package/dist/integration/integration.schema.d.ts +16 -16
  29. package/dist/integration/integration.schema.d.ts.map +1 -1
  30. package/dist/integration-hub.capability.d.ts +9 -0
  31. package/dist/integration-hub.capability.d.ts.map +1 -0
  32. package/dist/integration-hub.capability.js +38 -0
  33. package/dist/integration-hub.capability.js.map +1 -0
  34. package/dist/integration-hub.feature.d.ts +2 -3
  35. package/dist/integration-hub.feature.d.ts.map +1 -1
  36. package/dist/integration-hub.feature.js +7 -2
  37. package/dist/integration-hub.feature.js.map +1 -1
  38. package/dist/seeders/index.d.ts +10 -0
  39. package/dist/seeders/index.d.ts.map +1 -0
  40. package/dist/seeders/index.js +19 -0
  41. package/dist/seeders/index.js.map +1 -0
  42. package/dist/sync/sync.enum.d.ts +4 -4
  43. package/dist/sync/sync.operations.d.ts +126 -126
  44. package/dist/sync/sync.presentation.d.ts +7 -7
  45. package/dist/sync/sync.presentation.d.ts.map +1 -1
  46. package/dist/sync/sync.presentation.js +13 -13
  47. package/dist/sync/sync.presentation.js.map +1 -1
  48. package/dist/sync/sync.schema.d.ts +85 -85
  49. package/dist/sync/sync.schema.d.ts.map +1 -1
  50. package/dist/sync-engine/index.js.map +1 -1
  51. package/dist/tests/operations.test-spec.d.ts +9 -0
  52. package/dist/tests/operations.test-spec.d.ts.map +1 -0
  53. package/dist/tests/operations.test-spec.js +94 -0
  54. package/dist/tests/operations.test-spec.js.map +1 -0
  55. package/dist/ui/IntegrationDashboard.d.ts +7 -0
  56. package/dist/ui/IntegrationDashboard.d.ts.map +1 -0
  57. package/dist/ui/IntegrationDashboard.js +266 -0
  58. package/dist/ui/IntegrationDashboard.js.map +1 -0
  59. package/dist/ui/hooks/index.d.ts +2 -0
  60. package/dist/ui/hooks/index.js +5 -0
  61. package/dist/ui/hooks/useIntegrationData.d.ts +23 -0
  62. package/dist/ui/hooks/useIntegrationData.d.ts.map +1 -0
  63. package/dist/ui/hooks/useIntegrationData.js +59 -0
  64. package/dist/ui/hooks/useIntegrationData.js.map +1 -0
  65. package/dist/ui/index.d.ts +6 -0
  66. package/dist/ui/index.js +6 -0
  67. package/dist/ui/renderers/index.d.ts +2 -0
  68. package/dist/ui/renderers/index.js +3 -0
  69. package/dist/ui/renderers/integration.markdown.d.ts +28 -0
  70. package/dist/ui/renderers/integration.markdown.d.ts.map +1 -0
  71. package/dist/ui/renderers/integration.markdown.js +256 -0
  72. package/dist/ui/renderers/integration.markdown.js.map +1 -0
  73. package/package.json +24 -8
@@ -1,11 +1,11 @@
1
- import * as _contractspec_lib_contracts8 from "@contractspec/lib.contracts";
1
+ import * as _contractspec_lib_contracts15 from "@contractspec/lib.contracts";
2
2
  import * as _contractspec_lib_schema56 from "@contractspec/lib.schema";
3
3
 
4
4
  //#region src/connection/connection.operation.d.ts
5
5
  /**
6
6
  * Create a connection to an external system.
7
7
  */
8
- declare const CreateConnectionContract: _contractspec_lib_contracts8.OperationSpec<_contractspec_lib_schema56.SchemaModel<{
8
+ declare const CreateConnectionContract: _contractspec_lib_contracts15.OperationSpec<_contractspec_lib_schema56.SchemaModel<{
9
9
  integrationId: {
10
10
  type: _contractspec_lib_schema56.FieldType<string, string>;
11
11
  isOptional: false;
@@ -1 +1 @@
1
- {"version":3,"file":"connection.operation.d.ts","names":[],"sources":["../../src/connection/connection.operation.ts"],"sourcesContent":[],"mappings":";;;;;;;cAWa,uDAAwB,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"}
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"}
@@ -1,8 +1,8 @@
1
- import { PresentationSpec } from "@contractspec/lib.contracts";
1
+ import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
2
 
3
3
  //#region src/connection/connection.presentation.d.ts
4
- declare const ConnectionListPresentation: PresentationSpec;
5
- declare const ConnectionSetupPresentation: PresentationSpec;
4
+ declare const ConnectionListPresentation: _contractspec_lib_contracts0.PresentationSpec;
5
+ declare const ConnectionSetupPresentation: _contractspec_lib_contracts0.PresentationSpec;
6
6
  //#endregion
7
7
  export { ConnectionListPresentation, ConnectionSetupPresentation };
8
8
  //# sourceMappingURL=connection.presentation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connection.presentation.d.ts","names":[],"sources":["../../src/connection/connection.presentation.ts"],"sourcesContent":[],"mappings":";;;cAIa,4BAA4B;cAyB5B,6BAA6B"}
1
+ {"version":3,"file":"connection.presentation.d.ts","names":[],"sources":["../../src/connection/connection.presentation.ts"],"sourcesContent":[],"mappings":";;;cAGa,4BAuBX,4BAAA,CAvBqC;cAyB1B,6BAuBX,4BAAA,CAvBsC"}
@@ -1,8 +1,8 @@
1
1
  import { ConnectionModel } from "./connection.schema.js";
2
- import { StabilityEnum } from "@contractspec/lib.contracts";
2
+ import { StabilityEnum, definePresentation } from "@contractspec/lib.contracts";
3
3
 
4
4
  //#region src/connection/connection.presentation.ts
5
- const ConnectionListPresentation = {
5
+ const ConnectionListPresentation = definePresentation({
6
6
  meta: {
7
7
  key: "integration.connection.list",
8
8
  version: "1.0.0",
@@ -27,8 +27,8 @@ const ConnectionListPresentation = {
27
27
  },
28
28
  targets: ["react", "markdown"],
29
29
  policy: { flags: ["integration.enabled"] }
30
- };
31
- const ConnectionSetupPresentation = {
30
+ });
31
+ const ConnectionSetupPresentation = definePresentation({
32
32
  meta: {
33
33
  key: "integration.connection.setup",
34
34
  version: "1.0.0",
@@ -53,7 +53,7 @@ const ConnectionSetupPresentation = {
53
53
  },
54
54
  targets: ["react"],
55
55
  policy: { flags: ["integration.enabled"] }
56
- };
56
+ });
57
57
 
58
58
  //#endregion
59
59
  export { ConnectionListPresentation, ConnectionSetupPresentation };
@@ -1 +1 @@
1
- {"version":3,"file":"connection.presentation.js","names":["ConnectionListPresentation: PresentationSpec","ConnectionSetupPresentation: PresentationSpec"],"sources":["../../src/connection/connection.presentation.ts"],"sourcesContent":["import type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\nimport { ConnectionModel } from './connection.schema';\n\nexport const ConnectionListPresentation: PresentationSpec = {\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: PresentationSpec = {\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":";;;;AAIA,MAAaA,6BAA+C;CAC1D,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;AAED,MAAaC,8BAAgD;CAC3D,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"}
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"}
package/dist/events.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
1
+ import * as _contractspec_lib_contracts1 from "@contractspec/lib.contracts";
2
2
  import * as _contractspec_lib_schema0 from "@contractspec/lib.schema";
3
3
 
4
4
  //#region src/events.d.ts
5
- declare const IntegrationCreatedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
5
+ declare const IntegrationCreatedEvent: _contractspec_lib_contracts1.EventSpec<_contractspec_lib_schema0.SchemaModel<{
6
6
  integrationId: {
7
7
  type: _contractspec_lib_schema0.FieldType<string, string>;
8
8
  isOptional: false;
@@ -16,7 +16,7 @@ declare const IntegrationCreatedEvent: _contractspec_lib_contracts0.EventSpec<_c
16
16
  isOptional: false;
17
17
  };
18
18
  }>>;
19
- declare const ConnectionCreatedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
19
+ declare const ConnectionCreatedEvent: _contractspec_lib_contracts1.EventSpec<_contractspec_lib_schema0.SchemaModel<{
20
20
  connectionId: {
21
21
  type: _contractspec_lib_schema0.FieldType<string, string>;
22
22
  isOptional: false;
@@ -34,7 +34,7 @@ declare const ConnectionCreatedEvent: _contractspec_lib_contracts0.EventSpec<_co
34
34
  isOptional: false;
35
35
  };
36
36
  }>>;
37
- declare const ConnectionStatusChangedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
37
+ declare const ConnectionStatusChangedEvent: _contractspec_lib_contracts1.EventSpec<_contractspec_lib_schema0.SchemaModel<{
38
38
  connectionId: {
39
39
  type: _contractspec_lib_schema0.FieldType<string, string>;
40
40
  isOptional: false;
@@ -52,7 +52,7 @@ declare const ConnectionStatusChangedEvent: _contractspec_lib_contracts0.EventSp
52
52
  isOptional: false;
53
53
  };
54
54
  }>>;
55
- declare const SyncConfigCreatedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
55
+ declare const SyncConfigCreatedEvent: _contractspec_lib_contracts1.EventSpec<_contractspec_lib_schema0.SchemaModel<{
56
56
  syncConfigId: {
57
57
  type: _contractspec_lib_schema0.FieldType<string, string>;
58
58
  isOptional: false;
@@ -66,7 +66,7 @@ declare const SyncConfigCreatedEvent: _contractspec_lib_contracts0.EventSpec<_co
66
66
  isOptional: false;
67
67
  };
68
68
  }>>;
69
- declare const SyncStartedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
69
+ declare const SyncStartedEvent: _contractspec_lib_contracts1.EventSpec<_contractspec_lib_schema0.SchemaModel<{
70
70
  syncRunId: {
71
71
  type: _contractspec_lib_schema0.FieldType<string, string>;
72
72
  isOptional: false;
@@ -80,7 +80,7 @@ declare const SyncStartedEvent: _contractspec_lib_contracts0.EventSpec<_contract
80
80
  isOptional: false;
81
81
  };
82
82
  }>>;
83
- declare const SyncCompletedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
83
+ declare const SyncCompletedEvent: _contractspec_lib_contracts1.EventSpec<_contractspec_lib_schema0.SchemaModel<{
84
84
  syncRunId: {
85
85
  type: _contractspec_lib_schema0.FieldType<string, string>;
86
86
  isOptional: false;
@@ -98,7 +98,7 @@ declare const SyncCompletedEvent: _contractspec_lib_contracts0.EventSpec<_contra
98
98
  isOptional: false;
99
99
  };
100
100
  }>>;
101
- declare const SyncFailedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
101
+ declare const SyncFailedEvent: _contractspec_lib_contracts1.EventSpec<_contractspec_lib_schema0.SchemaModel<{
102
102
  syncRunId: {
103
103
  type: _contractspec_lib_schema0.FieldType<string, string>;
104
104
  isOptional: false;
@@ -116,7 +116,7 @@ declare const SyncFailedEvent: _contractspec_lib_contracts0.EventSpec<_contracts
116
116
  isOptional: false;
117
117
  };
118
118
  }>>;
119
- declare const RecordSyncedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
119
+ declare const RecordSyncedEvent: _contractspec_lib_contracts1.EventSpec<_contractspec_lib_schema0.SchemaModel<{
120
120
  syncRunId: {
121
121
  type: _contractspec_lib_schema0.FieldType<string, string>;
122
122
  isOptional: false;
@@ -134,7 +134,7 @@ declare const RecordSyncedEvent: _contractspec_lib_contracts0.EventSpec<_contrac
134
134
  isOptional: false;
135
135
  };
136
136
  }>>;
137
- declare const FieldMappingAddedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
137
+ declare const FieldMappingAddedEvent: _contractspec_lib_contracts1.EventSpec<_contractspec_lib_schema0.SchemaModel<{
138
138
  syncConfigId: {
139
139
  type: _contractspec_lib_schema0.FieldType<string, string>;
140
140
  isOptional: false;
package/dist/example.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { ExampleSpec } from "@contractspec/lib.contracts";
1
+ import * as _contractspec_lib_contracts10 from "@contractspec/lib.contracts";
2
2
 
3
3
  //#region src/example.d.ts
4
- declare const example: ExampleSpec;
4
+ declare const example: _contractspec_lib_contracts10.ExampleSpec;
5
5
  //#endregion
6
6
  export { example as default };
7
7
  //# sourceMappingURL=example.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,SAAS"}
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,SAoCJ,6BAAA,CApCW"}
package/dist/example.js CHANGED
@@ -1,5 +1,7 @@
1
+ import { defineExample } from "@contractspec/lib.contracts";
2
+
1
3
  //#region src/example.ts
2
- const example = {
4
+ const example = defineExample({
3
5
  meta: {
4
6
  key: "integration-hub",
5
7
  version: "1.0.0",
@@ -48,7 +50,7 @@ const example = {
48
50
  },
49
51
  mcp: { enabled: true }
50
52
  }
51
- };
53
+ });
52
54
  var example_default = example;
53
55
 
54
56
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"example.js","names":["example: ExampleSpec"],"sources":["../src/example.ts"],"sourcesContent":["import type { ExampleSpec } from '@contractspec/lib.contracts';\n\nconst example: ExampleSpec = {\n meta: {\n key: 'integration-hub',\n version: '1.0.0',\n title: 'Integration Hub',\n description:\n 'Provider-agnostic integration center with connectors, connections, field mappings, and sync logs.',\n kind: 'template',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['integrations', 'sync', 'etl', 'connectors'],\n },\n docs: {\n rootDocId: 'docs.examples.integration-hub',\n goalDocId: 'docs.examples.integration-hub.goal',\n usageDocId: 'docs.examples.integration-hub.usage',\n constraintsDocId: 'docs.examples.integration-hub.constraints',\n },\n entrypoints: {\n packageName: '@contractspec/example.integration-hub',\n feature: './feature',\n contracts: './contracts',\n presentations: './presentations',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: {\n enabled: true,\n modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],\n },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n};\n\nexport default example;\n"],"mappings":";AAEA,MAAMA,UAAuB;CAC3B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAgB;GAAQ;GAAO;GAAa;EACpD;CACD,MAAM;EACJ,WAAW;EACX,WAAW;EACX,YAAY;EACZ,kBAAkB;EACnB;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,eAAe;EACf,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GACP,SAAS;GACT,OAAO;IAAC;IAAc;IAAS;IAAW;IAAY;IAAY;GACnE;EACD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF;AAED,sBAAe"}
1
+ {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'integration-hub',\n version: '1.0.0',\n title: 'Integration Hub',\n description:\n 'Provider-agnostic integration center with connectors, connections, field mappings, and sync logs.',\n kind: 'template',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['integrations', 'sync', 'etl', 'connectors'],\n },\n docs: {\n rootDocId: 'docs.examples.integration-hub',\n goalDocId: 'docs.examples.integration-hub.goal',\n usageDocId: 'docs.examples.integration-hub.usage',\n constraintsDocId: 'docs.examples.integration-hub.constraints',\n },\n entrypoints: {\n packageName: '@contractspec/example.integration-hub',\n feature: './feature',\n contracts: './contracts',\n presentations: './presentations',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: {\n enabled: true,\n modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],\n },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAgB;GAAQ;GAAO;GAAa;EACpD;CACD,MAAM;EACJ,WAAW;EACX,WAAW;EACX,YAAY;EACZ,kBAAkB;EACnB;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,eAAe;EACf,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GACP,SAAS;GACT,OAAO;IAAC;IAAc;IAAS;IAAW;IAAY;IAAY;GACnE;EACD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC;AAEF,sBAAe"}
@@ -0,0 +1,2 @@
1
+ import { ConfigureSyncInput, ConnectServiceInput, Connection, CreateIntegrationInput, FieldMapping, Integration, IntegrationHandlers, ListConnectionsInput, ListConnectionsOutput, ListIntegrationsInput, ListIntegrationsOutput, ListSyncConfigsInput, ListSyncConfigsOutput, MapFieldsInput, SyncConfig, createIntegrationHandlers } from "./integration.handlers.js";
2
+ export { ConfigureSyncInput, ConnectServiceInput, Connection, CreateIntegrationInput, FieldMapping, Integration, IntegrationHandlers, ListConnectionsInput, ListConnectionsOutput, ListIntegrationsInput, ListIntegrationsOutput, ListSyncConfigsInput, ListSyncConfigsOutput, MapFieldsInput, SyncConfig, createIntegrationHandlers };
@@ -0,0 +1,3 @@
1
+ import { createIntegrationHandlers } from "./integration.handlers.js";
2
+
3
+ export { createIntegrationHandlers };
@@ -0,0 +1,130 @@
1
+ import { DatabasePort } from "@contractspec/lib.runtime-sandbox";
2
+
3
+ //#region src/handlers/integration.handlers.d.ts
4
+
5
+ interface Integration {
6
+ id: string;
7
+ projectId: string;
8
+ organizationId: string;
9
+ name: string;
10
+ description?: string;
11
+ type: 'CRM' | 'MARKETING' | 'PAYMENT' | 'COMMUNICATION' | 'DATA' | 'CUSTOM';
12
+ status: 'ACTIVE' | 'INACTIVE';
13
+ iconUrl?: string;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
17
+ interface Connection {
18
+ id: string;
19
+ integrationId: string;
20
+ name: string;
21
+ status: 'CONNECTED' | 'DISCONNECTED' | 'ERROR' | 'PENDING';
22
+ credentials?: Record<string, unknown>;
23
+ config?: Record<string, unknown>;
24
+ lastSyncAt?: Date;
25
+ errorMessage?: string;
26
+ createdAt: Date;
27
+ updatedAt: Date;
28
+ }
29
+ interface SyncConfig {
30
+ id: string;
31
+ connectionId: string;
32
+ name: string;
33
+ sourceEntity: string;
34
+ targetEntity: string;
35
+ frequency: 'REALTIME' | 'HOURLY' | 'DAILY' | 'WEEKLY' | 'MANUAL';
36
+ status: 'ACTIVE' | 'PAUSED' | 'ERROR';
37
+ lastRunAt?: Date;
38
+ lastRunStatus?: 'SUCCESS' | 'FAILED' | 'PARTIAL';
39
+ recordsSynced: number;
40
+ createdAt: Date;
41
+ updatedAt: Date;
42
+ }
43
+ interface FieldMapping {
44
+ id: string;
45
+ syncConfigId: string;
46
+ sourceField: string;
47
+ targetField: string;
48
+ transformType?: 'DIRECT' | 'FORMAT' | 'LOOKUP' | 'CUSTOM';
49
+ transformConfig?: Record<string, unknown>;
50
+ createdAt: Date;
51
+ }
52
+ interface CreateIntegrationInput {
53
+ name: string;
54
+ description?: string;
55
+ type: Integration['type'];
56
+ iconUrl?: string;
57
+ }
58
+ interface ConnectServiceInput {
59
+ integrationId: string;
60
+ name: string;
61
+ credentials?: Record<string, unknown>;
62
+ config?: Record<string, unknown>;
63
+ }
64
+ interface ConfigureSyncInput {
65
+ connectionId: string;
66
+ name: string;
67
+ sourceEntity: string;
68
+ targetEntity: string;
69
+ frequency?: SyncConfig['frequency'];
70
+ }
71
+ interface MapFieldsInput {
72
+ syncConfigId: string;
73
+ mappings: {
74
+ sourceField: string;
75
+ targetField: string;
76
+ transformType?: FieldMapping['transformType'];
77
+ transformConfig?: Record<string, unknown>;
78
+ }[];
79
+ }
80
+ interface ListIntegrationsInput {
81
+ projectId: string;
82
+ type?: Integration['type'] | 'all';
83
+ status?: 'ACTIVE' | 'INACTIVE' | 'all';
84
+ search?: string;
85
+ limit?: number;
86
+ offset?: number;
87
+ }
88
+ interface ListIntegrationsOutput {
89
+ integrations: Integration[];
90
+ total: number;
91
+ }
92
+ interface ListConnectionsInput {
93
+ integrationId?: string;
94
+ status?: Connection['status'] | 'all';
95
+ limit?: number;
96
+ offset?: number;
97
+ }
98
+ interface ListConnectionsOutput {
99
+ connections: Connection[];
100
+ total: number;
101
+ }
102
+ interface ListSyncConfigsInput {
103
+ connectionId?: string;
104
+ status?: SyncConfig['status'] | 'all';
105
+ limit?: number;
106
+ offset?: number;
107
+ }
108
+ interface ListSyncConfigsOutput {
109
+ configs: SyncConfig[];
110
+ total: number;
111
+ }
112
+ declare function createIntegrationHandlers(db: DatabasePort): {
113
+ listIntegrations: (input: ListIntegrationsInput) => Promise<ListIntegrationsOutput>;
114
+ createIntegration: (input: CreateIntegrationInput, context: {
115
+ projectId: string;
116
+ organizationId: string;
117
+ }) => Promise<Integration>;
118
+ listConnections: (input: ListConnectionsInput) => Promise<ListConnectionsOutput>;
119
+ connectService: (input: ConnectServiceInput) => Promise<Connection>;
120
+ disconnectService: (connectionId: string) => Promise<Connection>;
121
+ listSyncConfigs: (input: ListSyncConfigsInput) => Promise<ListSyncConfigsOutput>;
122
+ configureSync: (input: ConfigureSyncInput) => Promise<SyncConfig>;
123
+ mapFields: (input: MapFieldsInput) => Promise<FieldMapping[]>;
124
+ getFieldMappings: (syncConfigId: string) => Promise<FieldMapping[]>;
125
+ runSync: (syncConfigId: string) => Promise<SyncConfig>;
126
+ };
127
+ type IntegrationHandlers = ReturnType<typeof createIntegrationHandlers>;
128
+ //#endregion
129
+ export { ConfigureSyncInput, ConnectServiceInput, Connection, CreateIntegrationInput, FieldMapping, Integration, IntegrationHandlers, ListConnectionsInput, ListConnectionsOutput, ListIntegrationsInput, ListIntegrationsOutput, ListSyncConfigsInput, ListSyncConfigsOutput, MapFieldsInput, SyncConfig, createIntegrationHandlers };
130
+ //# sourceMappingURL=integration.handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration.handlers.d.ts","names":[],"sources":["../../src/handlers/integration.handlers.ts"],"sourcesContent":[],"mappings":";;;;AA+BW,UAnBM,WAAA,CAmBN;EACI,EAAA,EAAA,MAAA;EAEF,SAAA,EAAA,MAAA;EACA,cAAA,EAAA,MAAA;EAAI,IAAA,EAAA,MAAA;EAGA,WAAA,CAAA,EAAU,MAAA;EAQb,IAAA,EAAA,KAAA,GAAA,WAAA,GAAA,SAAA,GAAA,eAAA,GAAA,MAAA,GAAA,QAAA;EAGD,MAAA,EAAA,QAAA,GAAA,UAAA;EACA,OAAA,CAAA,EAAA,MAAA;EAAI,SAAA,EA7BJ,IA6BI;EAGA,SAAA,EA/BJ,IA+BgB;AAU7B;AAOiB,UA7CA,UAAA,CA6CmB;EAOnB,EAAA,EAAA,MAAA;EAQA,aAAA,EAAA,MAAc;EAUd,IAAA,EAAA,MAAA;EASA,MAAA,EAAA,WAAA,GAAA,cAAsB,GACvB,OAAA,GAAW,SAAA;EAIV,WAAA,CAAA,EA/ED,MA+EC,CAAA,MAAoB,EAAA,OAE1B,CAAA;EAKM,MAAA,CAAA,EArFN,MAqFM,CAAA,MAAA,EAAqB,OAAA,CAAA;EAKrB,UAAA,CAAA,EAzFF,IAyFE;EAOA,YAAA,CAAA,EAAA,MAAA;EA2HD,SAAA,EAzNH,IAyNG;EAA8B,SAAA,EAxNjC,IAwNiC;;AAMjC,UA3NI,UAAA,CA2NJ;EAAR,EAAA,EAAA,MAAA;EA8CM,YAAA,EAAA,MAAA;EAEE,IAAA,EAAA,MAAA;EAAR,YAAA,EAAA,MAAA;EAgCM,YAAA,EAAA,MAAA;EACE,SAAA,EAAA,UAAA,GAAA,QAAA,GAAA,OAAA,GAAA,QAAA,GAAA,QAAA;EAAR,MAAA,EAAA,QAAA,GAAA,QAAA,GAAA,OAAA;EAyCM,SAAA,CAAA,EA7UG,IA6UH;EACE,aAAA,CAAA,EAAA,SAAA,GAAA,QAAA,GAAA,SAAA;EAAR,aAAA,EAAA,MAAA;EAyC6D,SAAA,EApXrD,IAoXqD;EAAR,SAAA,EAnX7C,IAmX6C;;AAsB7C,UAtYI,YAAA,CAsYJ;EAAR,EAAA,EAAA,MAAA;EAwCiC,YAAA,EAAA,MAAA;EAA6B,WAAA,EAAA,MAAA;EAAR,WAAA,EAAA,MAAA;EA+BzB,aAAA,CAAA,EAAA,QAAA,GAAA,QAAA,GAAA,QAAA,GAAA,QAAA;EAAyB,eAAA,CAAA,EAvcvC,MAucuC,CAAA,MAAA,EAAA,OAAA,CAAA;EAAR,SAAA,EAtctC,IAscsC;;AA8C9C,UAjfY,sBAAA,CAifZ;EAcmD,IAAA,EAAA,MAAA;EAAR,WAAA,CAAA,EAAA,MAAA;EAAO,IAAA,EA5f/C,WA4f+C,CAAA,MAAA,CAAA;EAgD3C,OAAA,CAAA,EAAA,MAAA;;UAxiBK,mBAAA;;;gBAGD;WACL;;UAGM,kBAAA;;;;;cAKH;;UAGG,cAAA;;;;;oBAKG;sBACE;;;UAIL,qBAAA;;SAER;;;;;;UAOQ,sBAAA;gBACD;;;UAIC,oBAAA;;WAEN;;;;UAKM,qBAAA;eACF;;;UAIE,oBAAA;;WAEN;;;;UAKM,qBAAA;WACN;;;iBA0HK,yBAAA,KAA8B;4BAKnC,0BACN,QAAQ;6BA8CF;;;QAEN,QAAQ;2BAgCF,yBACN,QAAQ;0BAyCF,wBACN,QAAQ;+CAyC6C,QAAQ;2BAqBvD,yBACN,QAAQ;yBAwCyB,uBAAqB,QAAQ;qBA+BjC,mBAAiB,QAAQ;8CA8CtD,QAAQ;qCAcmC,QAAQ;;KAgD5C,mBAAA,GAAsB,kBAAkB"}
@@ -0,0 +1,282 @@
1
+ import { web } from "@contractspec/lib.runtime-sandbox";
2
+
3
+ //#region src/handlers/integration.handlers.ts
4
+ const { generateId } = web;
5
+ function rowToIntegration(row) {
6
+ return {
7
+ id: row.id,
8
+ projectId: row.projectId,
9
+ organizationId: row.organizationId,
10
+ name: row.name,
11
+ description: row.description ?? void 0,
12
+ type: row.type,
13
+ status: row.status,
14
+ iconUrl: row.iconUrl ?? void 0,
15
+ createdAt: new Date(row.createdAt),
16
+ updatedAt: new Date(row.updatedAt)
17
+ };
18
+ }
19
+ function rowToConnection(row) {
20
+ return {
21
+ id: row.id,
22
+ integrationId: row.integrationId,
23
+ name: row.name,
24
+ status: row.status,
25
+ credentials: row.credentials ? JSON.parse(row.credentials) : void 0,
26
+ config: row.config ? JSON.parse(row.config) : void 0,
27
+ lastSyncAt: row.lastSyncAt ? new Date(row.lastSyncAt) : void 0,
28
+ errorMessage: row.errorMessage ?? void 0,
29
+ createdAt: new Date(row.createdAt),
30
+ updatedAt: new Date(row.updatedAt)
31
+ };
32
+ }
33
+ function rowToSyncConfig(row) {
34
+ return {
35
+ id: row.id,
36
+ connectionId: row.connectionId,
37
+ name: row.name,
38
+ sourceEntity: row.sourceEntity,
39
+ targetEntity: row.targetEntity,
40
+ frequency: row.frequency,
41
+ status: row.status,
42
+ lastRunAt: row.lastRunAt ? new Date(row.lastRunAt) : void 0,
43
+ lastRunStatus: row.lastRunStatus ?? void 0,
44
+ recordsSynced: row.recordsSynced,
45
+ createdAt: new Date(row.createdAt),
46
+ updatedAt: new Date(row.updatedAt)
47
+ };
48
+ }
49
+ function rowToFieldMapping(row) {
50
+ return {
51
+ id: row.id,
52
+ syncConfigId: row.syncConfigId,
53
+ sourceField: row.sourceField,
54
+ targetField: row.targetField,
55
+ transformType: row.transformType ?? void 0,
56
+ transformConfig: row.transformConfig ? JSON.parse(row.transformConfig) : void 0,
57
+ createdAt: new Date(row.createdAt)
58
+ };
59
+ }
60
+ function createIntegrationHandlers(db) {
61
+ /**
62
+ * List integrations
63
+ */
64
+ async function listIntegrations(input) {
65
+ const { projectId, type, status, search, limit = 20, offset = 0 } = input;
66
+ let whereClause = "WHERE projectId = ?";
67
+ const params = [projectId];
68
+ if (type && type !== "all") {
69
+ whereClause += " AND type = ?";
70
+ params.push(type);
71
+ }
72
+ if (status && status !== "all") {
73
+ whereClause += " AND status = ?";
74
+ params.push(status);
75
+ }
76
+ if (search) {
77
+ whereClause += " AND name LIKE ?";
78
+ params.push(`%${search}%`);
79
+ }
80
+ const total = (await db.query(`SELECT COUNT(*) as count FROM integration ${whereClause}`, params)).rows[0]?.count ?? 0;
81
+ return {
82
+ integrations: (await db.query(`SELECT * FROM integration ${whereClause} ORDER BY name LIMIT ? OFFSET ?`, [
83
+ ...params,
84
+ limit,
85
+ offset
86
+ ])).rows.map(rowToIntegration),
87
+ total
88
+ };
89
+ }
90
+ /**
91
+ * Create an integration
92
+ */
93
+ async function createIntegration(input, context) {
94
+ const id = generateId("integ");
95
+ const now = (/* @__PURE__ */ new Date()).toISOString();
96
+ await db.execute(`INSERT INTO integration (id, projectId, organizationId, name, description, type, status, iconUrl, createdAt, updatedAt)
97
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
98
+ id,
99
+ context.projectId,
100
+ context.organizationId,
101
+ input.name,
102
+ input.description ?? null,
103
+ input.type,
104
+ "INACTIVE",
105
+ input.iconUrl ?? null,
106
+ now,
107
+ now
108
+ ]);
109
+ const rows = (await db.query(`SELECT * FROM integration WHERE id = ?`, [id])).rows;
110
+ return rowToIntegration(rows[0]);
111
+ }
112
+ /**
113
+ * List connections
114
+ */
115
+ async function listConnections(input) {
116
+ const { integrationId, status, limit = 20, offset = 0 } = input;
117
+ let whereClause = "WHERE 1=1";
118
+ const params = [];
119
+ if (integrationId) {
120
+ whereClause += " AND integrationId = ?";
121
+ params.push(integrationId);
122
+ }
123
+ if (status && status !== "all") {
124
+ whereClause += " AND status = ?";
125
+ params.push(status);
126
+ }
127
+ const total = (await db.query(`SELECT COUNT(*) as count FROM integration_connection ${whereClause}`, params)).rows[0]?.count ?? 0;
128
+ return {
129
+ connections: (await db.query(`SELECT * FROM integration_connection ${whereClause} ORDER BY updatedAt DESC LIMIT ? OFFSET ?`, [
130
+ ...params,
131
+ limit,
132
+ offset
133
+ ])).rows.map(rowToConnection),
134
+ total
135
+ };
136
+ }
137
+ /**
138
+ * Connect a service
139
+ */
140
+ async function connectService(input) {
141
+ const id = generateId("conn");
142
+ const now = (/* @__PURE__ */ new Date()).toISOString();
143
+ await db.execute(`INSERT INTO integration_connection (id, integrationId, name, status, credentials, config, createdAt, updatedAt)
144
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [
145
+ id,
146
+ input.integrationId,
147
+ input.name,
148
+ "PENDING",
149
+ input.credentials ? JSON.stringify(input.credentials) : null,
150
+ input.config ? JSON.stringify(input.config) : null,
151
+ now,
152
+ now
153
+ ]);
154
+ await db.execute(`UPDATE integration_connection SET status = 'CONNECTED', updatedAt = ? WHERE id = ?`, [now, id]);
155
+ await db.execute(`UPDATE integration SET status = 'ACTIVE', updatedAt = ? WHERE id = ?`, [now, input.integrationId]);
156
+ const rows = (await db.query(`SELECT * FROM integration_connection WHERE id = ?`, [id])).rows;
157
+ return rowToConnection(rows[0]);
158
+ }
159
+ /**
160
+ * Disconnect a service
161
+ */
162
+ async function disconnectService(connectionId) {
163
+ const now = (/* @__PURE__ */ new Date()).toISOString();
164
+ await db.execute(`UPDATE integration_connection SET status = 'DISCONNECTED', updatedAt = ? WHERE id = ?`, [now, connectionId]);
165
+ const rows = (await db.query(`SELECT * FROM integration_connection WHERE id = ?`, [connectionId])).rows;
166
+ return rowToConnection(rows[0]);
167
+ }
168
+ /**
169
+ * List sync configs
170
+ */
171
+ async function listSyncConfigs(input) {
172
+ const { connectionId, status, limit = 20, offset = 0 } = input;
173
+ let whereClause = "WHERE 1=1";
174
+ const params = [];
175
+ if (connectionId) {
176
+ whereClause += " AND connectionId = ?";
177
+ params.push(connectionId);
178
+ }
179
+ if (status && status !== "all") {
180
+ whereClause += " AND status = ?";
181
+ params.push(status);
182
+ }
183
+ const total = (await db.query(`SELECT COUNT(*) as count FROM integration_sync_config ${whereClause}`, params)).rows[0]?.count ?? 0;
184
+ return {
185
+ configs: (await db.query(`SELECT * FROM integration_sync_config ${whereClause} ORDER BY updatedAt DESC LIMIT ? OFFSET ?`, [
186
+ ...params,
187
+ limit,
188
+ offset
189
+ ])).rows.map(rowToSyncConfig),
190
+ total
191
+ };
192
+ }
193
+ /**
194
+ * Configure a sync
195
+ */
196
+ async function configureSync(input) {
197
+ const id = generateId("sync");
198
+ const now = (/* @__PURE__ */ new Date()).toISOString();
199
+ await db.execute(`INSERT INTO integration_sync_config (id, connectionId, name, sourceEntity, targetEntity, frequency, status, recordsSynced, createdAt, updatedAt)
200
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
201
+ id,
202
+ input.connectionId,
203
+ input.name,
204
+ input.sourceEntity,
205
+ input.targetEntity,
206
+ input.frequency ?? "DAILY",
207
+ "ACTIVE",
208
+ 0,
209
+ now,
210
+ now
211
+ ]);
212
+ const rows = (await db.query(`SELECT * FROM integration_sync_config WHERE id = ?`, [id])).rows;
213
+ return rowToSyncConfig(rows[0]);
214
+ }
215
+ /**
216
+ * Map fields for a sync
217
+ */
218
+ async function mapFields(input) {
219
+ const now = (/* @__PURE__ */ new Date()).toISOString();
220
+ const mappings = [];
221
+ await db.execute(`DELETE FROM integration_field_mapping WHERE syncConfigId = ?`, [input.syncConfigId]);
222
+ for (const mapping of input.mappings) {
223
+ const id = generateId("fmap");
224
+ await db.execute(`INSERT INTO integration_field_mapping (id, syncConfigId, sourceField, targetField, transformType, transformConfig, createdAt)
225
+ VALUES (?, ?, ?, ?, ?, ?, ?)`, [
226
+ id,
227
+ input.syncConfigId,
228
+ mapping.sourceField,
229
+ mapping.targetField,
230
+ mapping.transformType ?? null,
231
+ mapping.transformConfig ? JSON.stringify(mapping.transformConfig) : null,
232
+ now
233
+ ]);
234
+ const rows = (await db.query(`SELECT * FROM integration_field_mapping WHERE id = ?`, [id])).rows;
235
+ mappings.push(rowToFieldMapping(rows[0]));
236
+ }
237
+ return mappings;
238
+ }
239
+ /**
240
+ * Get field mappings for a sync config
241
+ */
242
+ async function getFieldMappings(syncConfigId) {
243
+ return (await db.query(`SELECT * FROM integration_field_mapping WHERE syncConfigId = ?`, [syncConfigId])).rows.map(rowToFieldMapping);
244
+ }
245
+ /**
246
+ * Run a sync (simulated)
247
+ */
248
+ async function runSync(syncConfigId) {
249
+ const now = (/* @__PURE__ */ new Date()).toISOString();
250
+ const recordsSynced = Math.floor(Math.random() * 1e3) + 50;
251
+ await db.execute(`UPDATE integration_sync_config SET lastRunAt = ?, lastRunStatus = 'SUCCESS', recordsSynced = recordsSynced + ?, updatedAt = ? WHERE id = ?`, [
252
+ now,
253
+ recordsSynced,
254
+ now,
255
+ syncConfigId
256
+ ]);
257
+ const config = (await db.query(`SELECT * FROM integration_sync_config WHERE id = ?`, [syncConfigId])).rows;
258
+ if (config[0]) await db.execute(`UPDATE integration_connection SET lastSyncAt = ?, updatedAt = ? WHERE id = ?`, [
259
+ now,
260
+ now,
261
+ config[0].connectionId
262
+ ]);
263
+ const rows = (await db.query(`SELECT * FROM integration_sync_config WHERE id = ?`, [syncConfigId])).rows;
264
+ return rowToSyncConfig(rows[0]);
265
+ }
266
+ return {
267
+ listIntegrations,
268
+ createIntegration,
269
+ listConnections,
270
+ connectService,
271
+ disconnectService,
272
+ listSyncConfigs,
273
+ configureSync,
274
+ mapFields,
275
+ getFieldMappings,
276
+ runSync
277
+ };
278
+ }
279
+
280
+ //#endregion
281
+ export { createIntegrationHandlers };
282
+ //# sourceMappingURL=integration.handlers.js.map