@open-mercato/core 0.4.6-develop-a88276bc52 → 0.4.6-develop-806a2ed6b9

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 (226) hide show
  1. package/AGENTS.md +10 -0
  2. package/dist/generated/entities/integration_credentials/index.js +19 -0
  3. package/dist/generated/entities/integration_credentials/index.js.map +7 -0
  4. package/dist/generated/entities/integration_log/index.js +27 -0
  5. package/dist/generated/entities/integration_log/index.js.map +7 -0
  6. package/dist/generated/entities/integration_state/index.js +27 -0
  7. package/dist/generated/entities/integration_state/index.js.map +7 -0
  8. package/dist/generated/entities/sync_cursor/index.js +19 -0
  9. package/dist/generated/entities/sync_cursor/index.js.map +7 -0
  10. package/dist/generated/entities/sync_external_id_mapping/index.js +27 -0
  11. package/dist/generated/entities/sync_external_id_mapping/index.js.map +7 -0
  12. package/dist/generated/entities/sync_mapping/index.js +19 -0
  13. package/dist/generated/entities/sync_mapping/index.js.map +7 -0
  14. package/dist/generated/entities/sync_run/index.js +45 -0
  15. package/dist/generated/entities/sync_run/index.js.map +7 -0
  16. package/dist/generated/entities/sync_schedule/index.js +35 -0
  17. package/dist/generated/entities/sync_schedule/index.js.map +7 -0
  18. package/dist/generated/entities.ids.generated.js +14 -0
  19. package/dist/generated/entities.ids.generated.js.map +2 -2
  20. package/dist/generated/entity-fields-registry.js +16 -0
  21. package/dist/generated/entity-fields-registry.js.map +2 -2
  22. package/dist/modules/data_sync/acl.js +11 -0
  23. package/dist/modules/data_sync/acl.js.map +7 -0
  24. package/dist/modules/data_sync/api/mappings/[id]/route.js +137 -0
  25. package/dist/modules/data_sync/api/mappings/[id]/route.js.map +7 -0
  26. package/dist/modules/data_sync/api/mappings/route.js +132 -0
  27. package/dist/modules/data_sync/api/mappings/route.js.map +7 -0
  28. package/dist/modules/data_sync/api/run.js +87 -0
  29. package/dist/modules/data_sync/api/run.js.map +7 -0
  30. package/dist/modules/data_sync/api/runs/[id]/cancel.js +49 -0
  31. package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +7 -0
  32. package/dist/modules/data_sync/api/runs/[id]/retry.js +93 -0
  33. package/dist/modules/data_sync/api/runs/[id]/retry.js.map +7 -0
  34. package/dist/modules/data_sync/api/runs/[id]/route.js +69 -0
  35. package/dist/modules/data_sync/api/runs/[id]/route.js.map +7 -0
  36. package/dist/modules/data_sync/api/runs.js +66 -0
  37. package/dist/modules/data_sync/api/runs.js.map +7 -0
  38. package/dist/modules/data_sync/api/validate.js +66 -0
  39. package/dist/modules/data_sync/api/validate.js.map +7 -0
  40. package/dist/modules/data_sync/backend/data-sync/page.js +216 -0
  41. package/dist/modules/data_sync/backend/data-sync/page.js.map +7 -0
  42. package/dist/modules/data_sync/backend/data-sync/page.meta.js +25 -0
  43. package/dist/modules/data_sync/backend/data-sync/page.meta.js.map +7 -0
  44. package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js +178 -0
  45. package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js.map +7 -0
  46. package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.meta.js +14 -0
  47. package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.meta.js.map +7 -0
  48. package/dist/modules/data_sync/data/entities.js +228 -0
  49. package/dist/modules/data_sync/data/entities.js.map +7 -0
  50. package/dist/modules/data_sync/data/validators.js +32 -0
  51. package/dist/modules/data_sync/data/validators.js.map +7 -0
  52. package/dist/modules/data_sync/di.js +26 -0
  53. package/dist/modules/data_sync/di.js.map +7 -0
  54. package/dist/modules/data_sync/events.js +16 -0
  55. package/dist/modules/data_sync/events.js.map +7 -0
  56. package/dist/modules/data_sync/index.js +9 -0
  57. package/dist/modules/data_sync/index.js.map +7 -0
  58. package/dist/modules/data_sync/lib/adapter-registry.js +16 -0
  59. package/dist/modules/data_sync/lib/adapter-registry.js.map +7 -0
  60. package/dist/modules/data_sync/lib/adapter.js +1 -0
  61. package/dist/modules/data_sync/lib/adapter.js.map +7 -0
  62. package/dist/modules/data_sync/lib/id-mapping.js +79 -0
  63. package/dist/modules/data_sync/lib/id-mapping.js.map +7 -0
  64. package/dist/modules/data_sync/lib/queue.js +17 -0
  65. package/dist/modules/data_sync/lib/queue.js.map +7 -0
  66. package/dist/modules/data_sync/lib/sync-engine.js +309 -0
  67. package/dist/modules/data_sync/lib/sync-engine.js.map +7 -0
  68. package/dist/modules/data_sync/lib/sync-run-service.js +148 -0
  69. package/dist/modules/data_sync/lib/sync-run-service.js.map +7 -0
  70. package/dist/modules/data_sync/migrations/Migration20260304113737.js +17 -0
  71. package/dist/modules/data_sync/migrations/Migration20260304113737.js.map +7 -0
  72. package/dist/modules/data_sync/setup.js +13 -0
  73. package/dist/modules/data_sync/setup.js.map +7 -0
  74. package/dist/modules/data_sync/workers/sync-export.js +14 -0
  75. package/dist/modules/data_sync/workers/sync-export.js.map +7 -0
  76. package/dist/modules/data_sync/workers/sync-import.js +14 -0
  77. package/dist/modules/data_sync/workers/sync-import.js.map +7 -0
  78. package/dist/modules/data_sync/workers/sync-scheduled.js +63 -0
  79. package/dist/modules/data_sync/workers/sync-scheduled.js.map +7 -0
  80. package/dist/modules/entities/lib/encryptionDefaults.js +4 -0
  81. package/dist/modules/entities/lib/encryptionDefaults.js.map +2 -2
  82. package/dist/modules/integrations/acl.js +4 -1
  83. package/dist/modules/integrations/acl.js.map +2 -2
  84. package/dist/modules/integrations/api/[id]/credentials/route.js +127 -0
  85. package/dist/modules/integrations/api/[id]/credentials/route.js.map +7 -0
  86. package/dist/modules/integrations/api/[id]/health/route.js +46 -0
  87. package/dist/modules/integrations/api/[id]/health/route.js.map +7 -0
  88. package/dist/modules/integrations/api/[id]/route.js +65 -0
  89. package/dist/modules/integrations/api/[id]/route.js.map +7 -0
  90. package/dist/modules/integrations/api/[id]/state/route.js +109 -0
  91. package/dist/modules/integrations/api/[id]/state/route.js.map +7 -0
  92. package/dist/modules/integrations/api/[id]/version/route.js +117 -0
  93. package/dist/modules/integrations/api/[id]/version/route.js.map +7 -0
  94. package/dist/modules/integrations/api/guards.js +31 -0
  95. package/dist/modules/integrations/api/guards.js.map +7 -0
  96. package/dist/modules/integrations/api/logs/route.js +60 -0
  97. package/dist/modules/integrations/api/logs/route.js.map +7 -0
  98. package/dist/modules/integrations/api/openapi.js +25 -0
  99. package/dist/modules/integrations/api/openapi.js.map +7 -0
  100. package/dist/modules/integrations/api/route.js +68 -0
  101. package/dist/modules/integrations/api/route.js.map +7 -0
  102. package/dist/modules/integrations/backend/integrations/[id]/page.js +313 -0
  103. package/dist/modules/integrations/backend/integrations/[id]/page.js.map +7 -0
  104. package/dist/modules/integrations/backend/integrations/[id]/page.meta.js +15 -0
  105. package/dist/modules/integrations/backend/integrations/[id]/page.meta.js.map +7 -0
  106. package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +189 -0
  107. package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +7 -0
  108. package/dist/modules/integrations/backend/integrations/bundle/[id]/page.meta.js +15 -0
  109. package/dist/modules/integrations/backend/integrations/bundle/[id]/page.meta.js.map +7 -0
  110. package/dist/modules/integrations/backend/integrations/page.js +212 -0
  111. package/dist/modules/integrations/backend/integrations/page.js.map +7 -0
  112. package/dist/modules/integrations/backend/integrations/page.meta.js +22 -0
  113. package/dist/modules/integrations/backend/integrations/page.meta.js.map +7 -0
  114. package/dist/modules/integrations/data/enrichers.js +27 -12
  115. package/dist/modules/integrations/data/enrichers.js.map +2 -2
  116. package/dist/modules/integrations/data/entities.js +136 -1
  117. package/dist/modules/integrations/data/entities.js.map +2 -2
  118. package/dist/modules/integrations/data/validators.js +36 -0
  119. package/dist/modules/integrations/data/validators.js.map +7 -0
  120. package/dist/modules/integrations/di.js +24 -0
  121. package/dist/modules/integrations/di.js.map +7 -0
  122. package/dist/modules/integrations/events.js +19 -0
  123. package/dist/modules/integrations/events.js.map +7 -0
  124. package/dist/modules/integrations/lib/credentials-service.js +159 -0
  125. package/dist/modules/integrations/lib/credentials-service.js.map +7 -0
  126. package/dist/modules/integrations/lib/health-service.js +37 -0
  127. package/dist/modules/integrations/lib/health-service.js.map +7 -0
  128. package/dist/modules/integrations/lib/log-service.js +66 -0
  129. package/dist/modules/integrations/lib/log-service.js.map +7 -0
  130. package/dist/modules/integrations/lib/registry-service.js +33 -0
  131. package/dist/modules/integrations/lib/registry-service.js.map +7 -0
  132. package/dist/modules/integrations/lib/state-service.js +55 -0
  133. package/dist/modules/integrations/lib/state-service.js.map +7 -0
  134. package/dist/modules/integrations/lib/types.js +1 -0
  135. package/dist/modules/integrations/lib/types.js.map +7 -0
  136. package/dist/modules/integrations/migrations/Migration20260304113737.js +19 -0
  137. package/dist/modules/integrations/migrations/Migration20260304113737.js.map +7 -0
  138. package/dist/modules/integrations/setup.js +2 -2
  139. package/dist/modules/integrations/setup.js.map +2 -2
  140. package/dist/modules/integrations/widgets/injection-table.js.map +1 -1
  141. package/dist/modules/integrations/workers/log-pruner.js +18 -0
  142. package/dist/modules/integrations/workers/log-pruner.js.map +7 -0
  143. package/generated/entities/integration_credentials/index.ts +8 -0
  144. package/generated/entities/integration_log/index.ts +12 -0
  145. package/generated/entities/integration_state/index.ts +12 -0
  146. package/generated/entities/sync_cursor/index.ts +8 -0
  147. package/generated/entities/sync_external_id_mapping/index.ts +12 -0
  148. package/generated/entities/sync_mapping/index.ts +8 -0
  149. package/generated/entities/sync_run/index.ts +21 -0
  150. package/generated/entities/sync_schedule/index.ts +16 -0
  151. package/generated/entities.ids.generated.ts +14 -0
  152. package/generated/entity-fields-registry.ts +16 -0
  153. package/package.json +2 -2
  154. package/src/modules/data_sync/AGENTS.md +157 -0
  155. package/src/modules/data_sync/acl.ts +7 -0
  156. package/src/modules/data_sync/api/mappings/[id]/route.ts +158 -0
  157. package/src/modules/data_sync/api/mappings/route.ts +144 -0
  158. package/src/modules/data_sync/api/run.ts +97 -0
  159. package/src/modules/data_sync/api/runs/[id]/cancel.ts +57 -0
  160. package/src/modules/data_sync/api/runs/[id]/retry.ts +108 -0
  161. package/src/modules/data_sync/api/runs/[id]/route.ts +81 -0
  162. package/src/modules/data_sync/api/runs.ts +69 -0
  163. package/src/modules/data_sync/api/validate.ts +73 -0
  164. package/src/modules/data_sync/backend/data-sync/page.meta.ts +21 -0
  165. package/src/modules/data_sync/backend/data-sync/page.tsx +244 -0
  166. package/src/modules/data_sync/backend/data-sync/runs/[id]/page.meta.ts +10 -0
  167. package/src/modules/data_sync/backend/data-sync/runs/[id]/page.tsx +278 -0
  168. package/src/modules/data_sync/data/entities.ts +180 -0
  169. package/src/modules/data_sync/data/validators.ts +35 -0
  170. package/src/modules/data_sync/di.ts +38 -0
  171. package/src/modules/data_sync/events.ts +12 -0
  172. package/src/modules/data_sync/i18n/de.json +48 -0
  173. package/src/modules/data_sync/i18n/en.json +48 -0
  174. package/src/modules/data_sync/i18n/es.json +48 -0
  175. package/src/modules/data_sync/i18n/pl.json +48 -0
  176. package/src/modules/data_sync/index.ts +5 -0
  177. package/src/modules/data_sync/lib/adapter-registry.ts +15 -0
  178. package/src/modules/data_sync/lib/adapter.ts +90 -0
  179. package/src/modules/data_sync/lib/id-mapping.ts +95 -0
  180. package/src/modules/data_sync/lib/queue.ts +19 -0
  181. package/src/modules/data_sync/lib/sync-engine.ts +375 -0
  182. package/src/modules/data_sync/lib/sync-run-service.ts +187 -0
  183. package/src/modules/data_sync/migrations/.snapshot-open-mercato.json +653 -0
  184. package/src/modules/data_sync/migrations/Migration20260304113737.ts +19 -0
  185. package/src/modules/data_sync/setup.ts +11 -0
  186. package/src/modules/data_sync/workers/sync-export.ts +27 -0
  187. package/src/modules/data_sync/workers/sync-import.ts +27 -0
  188. package/src/modules/data_sync/workers/sync-scheduled.ts +84 -0
  189. package/src/modules/entities/lib/encryptionDefaults.ts +4 -0
  190. package/src/modules/integrations/AGENTS.md +160 -0
  191. package/src/modules/integrations/acl.ts +3 -0
  192. package/src/modules/integrations/api/[id]/credentials/route.ts +142 -0
  193. package/src/modules/integrations/api/[id]/health/route.ts +53 -0
  194. package/src/modules/integrations/api/[id]/route.ts +76 -0
  195. package/src/modules/integrations/api/[id]/state/route.ts +121 -0
  196. package/src/modules/integrations/api/[id]/version/route.ts +132 -0
  197. package/src/modules/integrations/api/guards.ts +59 -0
  198. package/src/modules/integrations/api/logs/route.ts +63 -0
  199. package/src/modules/integrations/api/openapi.ts +22 -0
  200. package/src/modules/integrations/api/route.ts +73 -0
  201. package/src/modules/integrations/backend/integrations/[id]/page.meta.ts +11 -0
  202. package/src/modules/integrations/backend/integrations/[id]/page.tsx +424 -0
  203. package/src/modules/integrations/backend/integrations/bundle/[id]/page.meta.ts +11 -0
  204. package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +249 -0
  205. package/src/modules/integrations/backend/integrations/page.meta.ts +18 -0
  206. package/src/modules/integrations/backend/integrations/page.tsx +296 -0
  207. package/src/modules/integrations/data/enrichers.ts +35 -18
  208. package/src/modules/integrations/data/entities.ts +114 -5
  209. package/src/modules/integrations/data/validators.ts +41 -0
  210. package/src/modules/integrations/di.ts +31 -0
  211. package/src/modules/integrations/events.ts +17 -0
  212. package/src/modules/integrations/i18n/de.json +70 -0
  213. package/src/modules/integrations/i18n/en.json +70 -0
  214. package/src/modules/integrations/i18n/es.json +70 -0
  215. package/src/modules/integrations/i18n/pl.json +70 -0
  216. package/src/modules/integrations/lib/credentials-service.ts +204 -0
  217. package/src/modules/integrations/lib/health-service.ts +59 -0
  218. package/src/modules/integrations/lib/log-service.ts +84 -0
  219. package/src/modules/integrations/lib/registry-service.ts +42 -0
  220. package/src/modules/integrations/lib/state-service.ts +64 -0
  221. package/src/modules/integrations/lib/types.ts +4 -0
  222. package/src/modules/integrations/migrations/.snapshot-open-mercato.json +582 -0
  223. package/src/modules/integrations/migrations/Migration20260304113737.ts +21 -0
  224. package/src/modules/integrations/setup.ts +2 -2
  225. package/src/modules/integrations/widgets/injection-table.ts +1 -1
  226. package/src/modules/integrations/workers/log-pruner.ts +30 -0
@@ -0,0 +1,42 @@
1
+ import {
2
+ getAllBundles,
3
+ getAllIntegrations,
4
+ getBundle,
5
+ getIntegration,
6
+ type ApiVersionDefinition,
7
+ type IntegrationBundle,
8
+ type IntegrationDefinition,
9
+ } from '@open-mercato/shared/modules/integrations/types'
10
+
11
+ export type IntegrationDetail = {
12
+ integration: IntegrationDefinition
13
+ bundle?: IntegrationBundle
14
+ selectedApiVersion?: string
15
+ }
16
+
17
+ export function listIntegrationRegistry(): {
18
+ integrations: IntegrationDefinition[]
19
+ bundles: IntegrationBundle[]
20
+ } {
21
+ return {
22
+ integrations: getAllIntegrations(),
23
+ bundles: getAllBundles(),
24
+ }
25
+ }
26
+
27
+ export function getIntegrationDetail(integrationId: string): IntegrationDetail | null {
28
+ const integration = getIntegration(integrationId)
29
+ if (!integration) return null
30
+ const bundle = integration.bundleId ? getBundle(integration.bundleId) : undefined
31
+ return {
32
+ integration,
33
+ bundle,
34
+ }
35
+ }
36
+
37
+ export function resolveDefaultApiVersion(versions: ApiVersionDefinition[] | undefined): string | undefined {
38
+ if (!versions?.length) return undefined
39
+ const explicitDefault = versions.find((version) => version.default)
40
+ if (explicitDefault) return explicitDefault.id
41
+ return versions[0]?.id
42
+ }
@@ -0,0 +1,64 @@
1
+ import type { EntityManager } from '@mikro-orm/postgresql'
2
+ import { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'
3
+ import { IntegrationState } from '../data/entities'
4
+ import type { IntegrationScope } from './types'
5
+
6
+ export function createIntegrationStateService(em: EntityManager) {
7
+ return {
8
+ async get(integrationId: string, scope: IntegrationScope): Promise<IntegrationState | null> {
9
+ return findOneWithDecryption(
10
+ em,
11
+ IntegrationState,
12
+ {
13
+ integrationId,
14
+ organizationId: scope.organizationId,
15
+ tenantId: scope.tenantId,
16
+ deletedAt: null,
17
+ },
18
+ undefined,
19
+ scope,
20
+ )
21
+ },
22
+
23
+ async upsert(
24
+ integrationId: string,
25
+ input: Partial<Pick<IntegrationState, 'isEnabled' | 'apiVersion' | 'reauthRequired' | 'lastHealthStatus' | 'lastHealthCheckedAt'>>,
26
+ scope: IntegrationScope,
27
+ ): Promise<IntegrationState> {
28
+ const current = await this.get(integrationId, scope)
29
+ if (current) {
30
+ if (input.isEnabled !== undefined) current.isEnabled = input.isEnabled
31
+ if (input.apiVersion !== undefined) current.apiVersion = input.apiVersion
32
+ if (input.reauthRequired !== undefined) current.reauthRequired = input.reauthRequired
33
+ if (input.lastHealthStatus !== undefined) current.lastHealthStatus = input.lastHealthStatus
34
+ if (input.lastHealthCheckedAt !== undefined) current.lastHealthCheckedAt = input.lastHealthCheckedAt
35
+ await em.flush()
36
+ return current
37
+ }
38
+
39
+ const created = em.create(IntegrationState, {
40
+ integrationId,
41
+ isEnabled: input.isEnabled ?? true,
42
+ apiVersion: input.apiVersion,
43
+ reauthRequired: input.reauthRequired ?? false,
44
+ lastHealthStatus: input.lastHealthStatus,
45
+ lastHealthCheckedAt: input.lastHealthCheckedAt,
46
+ organizationId: scope.organizationId,
47
+ tenantId: scope.tenantId,
48
+ })
49
+ await em.persistAndFlush(created)
50
+ return created
51
+ },
52
+
53
+ async resolveApiVersion(integrationId: string, scope: IntegrationScope): Promise<string | undefined> {
54
+ const state = await this.get(integrationId, scope)
55
+ return state?.apiVersion ?? undefined
56
+ },
57
+
58
+ async setReauthRequired(integrationId: string, required: boolean, scope: IntegrationScope): Promise<IntegrationState> {
59
+ return this.upsert(integrationId, { reauthRequired: required }, scope)
60
+ },
61
+ }
62
+ }
63
+
64
+ export type IntegrationStateService = ReturnType<typeof createIntegrationStateService>
@@ -0,0 +1,4 @@
1
+ export type IntegrationScope = {
2
+ organizationId: string
3
+ tenantId: string
4
+ }
@@ -0,0 +1,582 @@
1
+ {
2
+ "namespaces": [
3
+ "public"
4
+ ],
5
+ "name": "public",
6
+ "tables": [
7
+ {
8
+ "columns": {
9
+ "id": {
10
+ "name": "id",
11
+ "type": "uuid",
12
+ "unsigned": false,
13
+ "autoincrement": false,
14
+ "primary": false,
15
+ "nullable": false,
16
+ "default": "gen_random_uuid()",
17
+ "mappedType": "uuid"
18
+ },
19
+ "integration_id": {
20
+ "name": "integration_id",
21
+ "type": "text",
22
+ "unsigned": false,
23
+ "autoincrement": false,
24
+ "primary": false,
25
+ "nullable": false,
26
+ "mappedType": "text"
27
+ },
28
+ "credentials": {
29
+ "name": "credentials",
30
+ "type": "jsonb",
31
+ "unsigned": false,
32
+ "autoincrement": false,
33
+ "primary": false,
34
+ "nullable": false,
35
+ "mappedType": "json"
36
+ },
37
+ "organization_id": {
38
+ "name": "organization_id",
39
+ "type": "uuid",
40
+ "unsigned": false,
41
+ "autoincrement": false,
42
+ "primary": false,
43
+ "nullable": false,
44
+ "mappedType": "uuid"
45
+ },
46
+ "tenant_id": {
47
+ "name": "tenant_id",
48
+ "type": "uuid",
49
+ "unsigned": false,
50
+ "autoincrement": false,
51
+ "primary": false,
52
+ "nullable": false,
53
+ "mappedType": "uuid"
54
+ },
55
+ "created_at": {
56
+ "name": "created_at",
57
+ "type": "timestamptz",
58
+ "unsigned": false,
59
+ "autoincrement": false,
60
+ "primary": false,
61
+ "nullable": false,
62
+ "length": 6,
63
+ "mappedType": "datetime"
64
+ },
65
+ "updated_at": {
66
+ "name": "updated_at",
67
+ "type": "timestamptz",
68
+ "unsigned": false,
69
+ "autoincrement": false,
70
+ "primary": false,
71
+ "nullable": false,
72
+ "length": 6,
73
+ "mappedType": "datetime"
74
+ },
75
+ "deleted_at": {
76
+ "name": "deleted_at",
77
+ "type": "timestamptz",
78
+ "unsigned": false,
79
+ "autoincrement": false,
80
+ "primary": false,
81
+ "nullable": true,
82
+ "length": 6,
83
+ "mappedType": "datetime"
84
+ }
85
+ },
86
+ "name": "integration_credentials",
87
+ "schema": "public",
88
+ "indexes": [
89
+ {
90
+ "keyName": "integration_credentials_integration_id_organizatio_291ea_index",
91
+ "columnNames": [
92
+ "integration_id",
93
+ "organization_id",
94
+ "tenant_id"
95
+ ],
96
+ "composite": true,
97
+ "constraint": false,
98
+ "primary": false,
99
+ "unique": false
100
+ },
101
+ {
102
+ "keyName": "integration_credentials_pkey",
103
+ "columnNames": [
104
+ "id"
105
+ ],
106
+ "composite": false,
107
+ "constraint": true,
108
+ "primary": true,
109
+ "unique": true
110
+ }
111
+ ],
112
+ "checks": [],
113
+ "foreignKeys": {},
114
+ "nativeEnums": {}
115
+ },
116
+ {
117
+ "columns": {
118
+ "id": {
119
+ "name": "id",
120
+ "type": "uuid",
121
+ "unsigned": false,
122
+ "autoincrement": false,
123
+ "primary": false,
124
+ "nullable": false,
125
+ "default": "gen_random_uuid()",
126
+ "mappedType": "uuid"
127
+ },
128
+ "integration_id": {
129
+ "name": "integration_id",
130
+ "type": "text",
131
+ "unsigned": false,
132
+ "autoincrement": false,
133
+ "primary": false,
134
+ "nullable": false,
135
+ "mappedType": "text"
136
+ },
137
+ "run_id": {
138
+ "name": "run_id",
139
+ "type": "uuid",
140
+ "unsigned": false,
141
+ "autoincrement": false,
142
+ "primary": false,
143
+ "nullable": true,
144
+ "mappedType": "uuid"
145
+ },
146
+ "scope_entity_type": {
147
+ "name": "scope_entity_type",
148
+ "type": "text",
149
+ "unsigned": false,
150
+ "autoincrement": false,
151
+ "primary": false,
152
+ "nullable": true,
153
+ "mappedType": "text"
154
+ },
155
+ "scope_entity_id": {
156
+ "name": "scope_entity_id",
157
+ "type": "uuid",
158
+ "unsigned": false,
159
+ "autoincrement": false,
160
+ "primary": false,
161
+ "nullable": true,
162
+ "mappedType": "uuid"
163
+ },
164
+ "level": {
165
+ "name": "level",
166
+ "type": "text",
167
+ "unsigned": false,
168
+ "autoincrement": false,
169
+ "primary": false,
170
+ "nullable": false,
171
+ "mappedType": "text"
172
+ },
173
+ "message": {
174
+ "name": "message",
175
+ "type": "text",
176
+ "unsigned": false,
177
+ "autoincrement": false,
178
+ "primary": false,
179
+ "nullable": false,
180
+ "mappedType": "text"
181
+ },
182
+ "code": {
183
+ "name": "code",
184
+ "type": "text",
185
+ "unsigned": false,
186
+ "autoincrement": false,
187
+ "primary": false,
188
+ "nullable": true,
189
+ "mappedType": "text"
190
+ },
191
+ "payload": {
192
+ "name": "payload",
193
+ "type": "jsonb",
194
+ "unsigned": false,
195
+ "autoincrement": false,
196
+ "primary": false,
197
+ "nullable": true,
198
+ "mappedType": "json"
199
+ },
200
+ "organization_id": {
201
+ "name": "organization_id",
202
+ "type": "uuid",
203
+ "unsigned": false,
204
+ "autoincrement": false,
205
+ "primary": false,
206
+ "nullable": false,
207
+ "mappedType": "uuid"
208
+ },
209
+ "tenant_id": {
210
+ "name": "tenant_id",
211
+ "type": "uuid",
212
+ "unsigned": false,
213
+ "autoincrement": false,
214
+ "primary": false,
215
+ "nullable": false,
216
+ "mappedType": "uuid"
217
+ },
218
+ "created_at": {
219
+ "name": "created_at",
220
+ "type": "timestamptz",
221
+ "unsigned": false,
222
+ "autoincrement": false,
223
+ "primary": false,
224
+ "nullable": false,
225
+ "length": 6,
226
+ "mappedType": "datetime"
227
+ }
228
+ },
229
+ "name": "integration_logs",
230
+ "schema": "public",
231
+ "indexes": [
232
+ {
233
+ "keyName": "integration_logs_level_organization_id_tenant_id_c_107e7_index",
234
+ "columnNames": [
235
+ "level",
236
+ "organization_id",
237
+ "tenant_id",
238
+ "created_at"
239
+ ],
240
+ "composite": true,
241
+ "constraint": false,
242
+ "primary": false,
243
+ "unique": false
244
+ },
245
+ {
246
+ "keyName": "integration_logs_integration_id_organization_id_te_38189_index",
247
+ "columnNames": [
248
+ "integration_id",
249
+ "organization_id",
250
+ "tenant_id",
251
+ "created_at"
252
+ ],
253
+ "composite": true,
254
+ "constraint": false,
255
+ "primary": false,
256
+ "unique": false
257
+ },
258
+ {
259
+ "keyName": "integration_logs_pkey",
260
+ "columnNames": [
261
+ "id"
262
+ ],
263
+ "composite": false,
264
+ "constraint": true,
265
+ "primary": true,
266
+ "unique": true
267
+ }
268
+ ],
269
+ "checks": [],
270
+ "foreignKeys": {},
271
+ "nativeEnums": {}
272
+ },
273
+ {
274
+ "columns": {
275
+ "id": {
276
+ "name": "id",
277
+ "type": "uuid",
278
+ "unsigned": false,
279
+ "autoincrement": false,
280
+ "primary": false,
281
+ "nullable": false,
282
+ "default": "gen_random_uuid()",
283
+ "mappedType": "uuid"
284
+ },
285
+ "integration_id": {
286
+ "name": "integration_id",
287
+ "type": "text",
288
+ "unsigned": false,
289
+ "autoincrement": false,
290
+ "primary": false,
291
+ "nullable": false,
292
+ "mappedType": "text"
293
+ },
294
+ "is_enabled": {
295
+ "name": "is_enabled",
296
+ "type": "boolean",
297
+ "unsigned": false,
298
+ "autoincrement": false,
299
+ "primary": false,
300
+ "nullable": false,
301
+ "default": "true",
302
+ "mappedType": "boolean"
303
+ },
304
+ "api_version": {
305
+ "name": "api_version",
306
+ "type": "text",
307
+ "unsigned": false,
308
+ "autoincrement": false,
309
+ "primary": false,
310
+ "nullable": true,
311
+ "mappedType": "text"
312
+ },
313
+ "reauth_required": {
314
+ "name": "reauth_required",
315
+ "type": "boolean",
316
+ "unsigned": false,
317
+ "autoincrement": false,
318
+ "primary": false,
319
+ "nullable": false,
320
+ "default": "false",
321
+ "mappedType": "boolean"
322
+ },
323
+ "last_health_status": {
324
+ "name": "last_health_status",
325
+ "type": "text",
326
+ "unsigned": false,
327
+ "autoincrement": false,
328
+ "primary": false,
329
+ "nullable": true,
330
+ "mappedType": "text"
331
+ },
332
+ "last_health_checked_at": {
333
+ "name": "last_health_checked_at",
334
+ "type": "timestamptz",
335
+ "unsigned": false,
336
+ "autoincrement": false,
337
+ "primary": false,
338
+ "nullable": true,
339
+ "length": 6,
340
+ "mappedType": "datetime"
341
+ },
342
+ "organization_id": {
343
+ "name": "organization_id",
344
+ "type": "uuid",
345
+ "unsigned": false,
346
+ "autoincrement": false,
347
+ "primary": false,
348
+ "nullable": false,
349
+ "mappedType": "uuid"
350
+ },
351
+ "tenant_id": {
352
+ "name": "tenant_id",
353
+ "type": "uuid",
354
+ "unsigned": false,
355
+ "autoincrement": false,
356
+ "primary": false,
357
+ "nullable": false,
358
+ "mappedType": "uuid"
359
+ },
360
+ "created_at": {
361
+ "name": "created_at",
362
+ "type": "timestamptz",
363
+ "unsigned": false,
364
+ "autoincrement": false,
365
+ "primary": false,
366
+ "nullable": false,
367
+ "length": 6,
368
+ "mappedType": "datetime"
369
+ },
370
+ "updated_at": {
371
+ "name": "updated_at",
372
+ "type": "timestamptz",
373
+ "unsigned": false,
374
+ "autoincrement": false,
375
+ "primary": false,
376
+ "nullable": false,
377
+ "length": 6,
378
+ "mappedType": "datetime"
379
+ },
380
+ "deleted_at": {
381
+ "name": "deleted_at",
382
+ "type": "timestamptz",
383
+ "unsigned": false,
384
+ "autoincrement": false,
385
+ "primary": false,
386
+ "nullable": true,
387
+ "length": 6,
388
+ "mappedType": "datetime"
389
+ }
390
+ },
391
+ "name": "integration_states",
392
+ "schema": "public",
393
+ "indexes": [
394
+ {
395
+ "keyName": "integration_states_integration_id_organization_id__32acc_index",
396
+ "columnNames": [
397
+ "integration_id",
398
+ "organization_id",
399
+ "tenant_id"
400
+ ],
401
+ "composite": true,
402
+ "constraint": false,
403
+ "primary": false,
404
+ "unique": false
405
+ },
406
+ {
407
+ "keyName": "integration_states_pkey",
408
+ "columnNames": [
409
+ "id"
410
+ ],
411
+ "composite": false,
412
+ "constraint": true,
413
+ "primary": true,
414
+ "unique": true
415
+ }
416
+ ],
417
+ "checks": [],
418
+ "foreignKeys": {},
419
+ "nativeEnums": {}
420
+ },
421
+ {
422
+ "columns": {
423
+ "id": {
424
+ "name": "id",
425
+ "type": "uuid",
426
+ "unsigned": false,
427
+ "autoincrement": false,
428
+ "primary": false,
429
+ "nullable": false,
430
+ "default": "gen_random_uuid()",
431
+ "mappedType": "uuid"
432
+ },
433
+ "integration_id": {
434
+ "name": "integration_id",
435
+ "type": "text",
436
+ "unsigned": false,
437
+ "autoincrement": false,
438
+ "primary": false,
439
+ "nullable": false,
440
+ "mappedType": "text"
441
+ },
442
+ "internal_entity_type": {
443
+ "name": "internal_entity_type",
444
+ "type": "text",
445
+ "unsigned": false,
446
+ "autoincrement": false,
447
+ "primary": false,
448
+ "nullable": false,
449
+ "mappedType": "text"
450
+ },
451
+ "internal_entity_id": {
452
+ "name": "internal_entity_id",
453
+ "type": "uuid",
454
+ "unsigned": false,
455
+ "autoincrement": false,
456
+ "primary": false,
457
+ "nullable": false,
458
+ "mappedType": "uuid"
459
+ },
460
+ "external_id": {
461
+ "name": "external_id",
462
+ "type": "text",
463
+ "unsigned": false,
464
+ "autoincrement": false,
465
+ "primary": false,
466
+ "nullable": false,
467
+ "mappedType": "text"
468
+ },
469
+ "sync_status": {
470
+ "name": "sync_status",
471
+ "type": "text",
472
+ "unsigned": false,
473
+ "autoincrement": false,
474
+ "primary": false,
475
+ "nullable": false,
476
+ "default": "'not_synced'",
477
+ "mappedType": "text"
478
+ },
479
+ "last_synced_at": {
480
+ "name": "last_synced_at",
481
+ "type": "timestamptz",
482
+ "unsigned": false,
483
+ "autoincrement": false,
484
+ "primary": false,
485
+ "nullable": true,
486
+ "length": 6,
487
+ "mappedType": "datetime"
488
+ },
489
+ "organization_id": {
490
+ "name": "organization_id",
491
+ "type": "uuid",
492
+ "unsigned": false,
493
+ "autoincrement": false,
494
+ "primary": false,
495
+ "nullable": false,
496
+ "mappedType": "uuid"
497
+ },
498
+ "tenant_id": {
499
+ "name": "tenant_id",
500
+ "type": "uuid",
501
+ "unsigned": false,
502
+ "autoincrement": false,
503
+ "primary": false,
504
+ "nullable": false,
505
+ "mappedType": "uuid"
506
+ },
507
+ "created_at": {
508
+ "name": "created_at",
509
+ "type": "timestamptz",
510
+ "unsigned": false,
511
+ "autoincrement": false,
512
+ "primary": false,
513
+ "nullable": false,
514
+ "length": 6,
515
+ "mappedType": "datetime"
516
+ },
517
+ "updated_at": {
518
+ "name": "updated_at",
519
+ "type": "timestamptz",
520
+ "unsigned": false,
521
+ "autoincrement": false,
522
+ "primary": false,
523
+ "nullable": false,
524
+ "length": 6,
525
+ "mappedType": "datetime"
526
+ },
527
+ "deleted_at": {
528
+ "name": "deleted_at",
529
+ "type": "timestamptz",
530
+ "unsigned": false,
531
+ "autoincrement": false,
532
+ "primary": false,
533
+ "nullable": true,
534
+ "length": 6,
535
+ "mappedType": "datetime"
536
+ }
537
+ },
538
+ "name": "sync_external_id_mappings",
539
+ "schema": "public",
540
+ "indexes": [
541
+ {
542
+ "keyName": "sync_external_id_mappings_integration_id_external__c088c_index",
543
+ "columnNames": [
544
+ "integration_id",
545
+ "external_id",
546
+ "organization_id"
547
+ ],
548
+ "composite": true,
549
+ "constraint": false,
550
+ "primary": false,
551
+ "unique": false
552
+ },
553
+ {
554
+ "keyName": "sync_external_id_mappings_internal_entity_type_int_f9194_index",
555
+ "columnNames": [
556
+ "internal_entity_type",
557
+ "internal_entity_id",
558
+ "organization_id"
559
+ ],
560
+ "composite": true,
561
+ "constraint": false,
562
+ "primary": false,
563
+ "unique": false
564
+ },
565
+ {
566
+ "keyName": "sync_external_id_mappings_pkey",
567
+ "columnNames": [
568
+ "id"
569
+ ],
570
+ "composite": false,
571
+ "constraint": true,
572
+ "primary": true,
573
+ "unique": true
574
+ }
575
+ ],
576
+ "checks": [],
577
+ "foreignKeys": {},
578
+ "nativeEnums": {}
579
+ }
580
+ ],
581
+ "nativeEnums": {}
582
+ }