@open-mercato/core 0.4.6-develop-6d72ec5960 → 0.4.6-develop-cd1e2a9a0e
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.
- package/AGENTS.md +10 -0
- package/dist/generated/entities/integration_credentials/index.js +19 -0
- package/dist/generated/entities/integration_credentials/index.js.map +7 -0
- package/dist/generated/entities/integration_log/index.js +27 -0
- package/dist/generated/entities/integration_log/index.js.map +7 -0
- package/dist/generated/entities/integration_state/index.js +27 -0
- package/dist/generated/entities/integration_state/index.js.map +7 -0
- package/dist/generated/entities/sync_cursor/index.js +19 -0
- package/dist/generated/entities/sync_cursor/index.js.map +7 -0
- package/dist/generated/entities/sync_external_id_mapping/index.js +27 -0
- package/dist/generated/entities/sync_external_id_mapping/index.js.map +7 -0
- package/dist/generated/entities/sync_mapping/index.js +19 -0
- package/dist/generated/entities/sync_mapping/index.js.map +7 -0
- package/dist/generated/entities/sync_run/index.js +45 -0
- package/dist/generated/entities/sync_run/index.js.map +7 -0
- package/dist/generated/entities/sync_schedule/index.js +35 -0
- package/dist/generated/entities/sync_schedule/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +14 -0
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +16 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/data_sync/acl.js +11 -0
- package/dist/modules/data_sync/acl.js.map +7 -0
- package/dist/modules/data_sync/api/mappings/[id]/route.js +137 -0
- package/dist/modules/data_sync/api/mappings/[id]/route.js.map +7 -0
- package/dist/modules/data_sync/api/mappings/route.js +132 -0
- package/dist/modules/data_sync/api/mappings/route.js.map +7 -0
- package/dist/modules/data_sync/api/run.js +87 -0
- package/dist/modules/data_sync/api/run.js.map +7 -0
- package/dist/modules/data_sync/api/runs/[id]/cancel.js +49 -0
- package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +7 -0
- package/dist/modules/data_sync/api/runs/[id]/retry.js +93 -0
- package/dist/modules/data_sync/api/runs/[id]/retry.js.map +7 -0
- package/dist/modules/data_sync/api/runs/[id]/route.js +69 -0
- package/dist/modules/data_sync/api/runs/[id]/route.js.map +7 -0
- package/dist/modules/data_sync/api/runs.js +66 -0
- package/dist/modules/data_sync/api/runs.js.map +7 -0
- package/dist/modules/data_sync/api/validate.js +66 -0
- package/dist/modules/data_sync/api/validate.js.map +7 -0
- package/dist/modules/data_sync/backend/data-sync/page.js +216 -0
- package/dist/modules/data_sync/backend/data-sync/page.js.map +7 -0
- package/dist/modules/data_sync/backend/data-sync/page.meta.js +25 -0
- package/dist/modules/data_sync/backend/data-sync/page.meta.js.map +7 -0
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js +178 -0
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js.map +7 -0
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.meta.js +14 -0
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.meta.js.map +7 -0
- package/dist/modules/data_sync/data/entities.js +228 -0
- package/dist/modules/data_sync/data/entities.js.map +7 -0
- package/dist/modules/data_sync/data/validators.js +32 -0
- package/dist/modules/data_sync/data/validators.js.map +7 -0
- package/dist/modules/data_sync/di.js +26 -0
- package/dist/modules/data_sync/di.js.map +7 -0
- package/dist/modules/data_sync/events.js +16 -0
- package/dist/modules/data_sync/events.js.map +7 -0
- package/dist/modules/data_sync/index.js +9 -0
- package/dist/modules/data_sync/index.js.map +7 -0
- package/dist/modules/data_sync/lib/adapter-registry.js +16 -0
- package/dist/modules/data_sync/lib/adapter-registry.js.map +7 -0
- package/dist/modules/data_sync/lib/adapter.js +1 -0
- package/dist/modules/data_sync/lib/adapter.js.map +7 -0
- package/dist/modules/data_sync/lib/id-mapping.js +79 -0
- package/dist/modules/data_sync/lib/id-mapping.js.map +7 -0
- package/dist/modules/data_sync/lib/queue.js +17 -0
- package/dist/modules/data_sync/lib/queue.js.map +7 -0
- package/dist/modules/data_sync/lib/sync-engine.js +309 -0
- package/dist/modules/data_sync/lib/sync-engine.js.map +7 -0
- package/dist/modules/data_sync/lib/sync-run-service.js +148 -0
- package/dist/modules/data_sync/lib/sync-run-service.js.map +7 -0
- package/dist/modules/data_sync/migrations/Migration20260304113737.js +17 -0
- package/dist/modules/data_sync/migrations/Migration20260304113737.js.map +7 -0
- package/dist/modules/data_sync/setup.js +13 -0
- package/dist/modules/data_sync/setup.js.map +7 -0
- package/dist/modules/data_sync/workers/sync-export.js +14 -0
- package/dist/modules/data_sync/workers/sync-export.js.map +7 -0
- package/dist/modules/data_sync/workers/sync-import.js +14 -0
- package/dist/modules/data_sync/workers/sync-import.js.map +7 -0
- package/dist/modules/data_sync/workers/sync-scheduled.js +63 -0
- package/dist/modules/data_sync/workers/sync-scheduled.js.map +7 -0
- package/dist/modules/entities/lib/encryptionDefaults.js +4 -0
- package/dist/modules/entities/lib/encryptionDefaults.js.map +2 -2
- package/dist/modules/integrations/acl.js +4 -1
- package/dist/modules/integrations/acl.js.map +2 -2
- package/dist/modules/integrations/api/[id]/credentials/route.js +127 -0
- package/dist/modules/integrations/api/[id]/credentials/route.js.map +7 -0
- package/dist/modules/integrations/api/[id]/health/route.js +46 -0
- package/dist/modules/integrations/api/[id]/health/route.js.map +7 -0
- package/dist/modules/integrations/api/[id]/route.js +65 -0
- package/dist/modules/integrations/api/[id]/route.js.map +7 -0
- package/dist/modules/integrations/api/[id]/state/route.js +109 -0
- package/dist/modules/integrations/api/[id]/state/route.js.map +7 -0
- package/dist/modules/integrations/api/[id]/version/route.js +117 -0
- package/dist/modules/integrations/api/[id]/version/route.js.map +7 -0
- package/dist/modules/integrations/api/guards.js +31 -0
- package/dist/modules/integrations/api/guards.js.map +7 -0
- package/dist/modules/integrations/api/logs/route.js +60 -0
- package/dist/modules/integrations/api/logs/route.js.map +7 -0
- package/dist/modules/integrations/api/openapi.js +25 -0
- package/dist/modules/integrations/api/openapi.js.map +7 -0
- package/dist/modules/integrations/api/route.js +68 -0
- package/dist/modules/integrations/api/route.js.map +7 -0
- package/dist/modules/integrations/backend/integrations/[id]/page.js +313 -0
- package/dist/modules/integrations/backend/integrations/[id]/page.js.map +7 -0
- package/dist/modules/integrations/backend/integrations/[id]/page.meta.js +15 -0
- package/dist/modules/integrations/backend/integrations/[id]/page.meta.js.map +7 -0
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +189 -0
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +7 -0
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.meta.js +15 -0
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.meta.js.map +7 -0
- package/dist/modules/integrations/backend/integrations/page.js +212 -0
- package/dist/modules/integrations/backend/integrations/page.js.map +7 -0
- package/dist/modules/integrations/backend/integrations/page.meta.js +22 -0
- package/dist/modules/integrations/backend/integrations/page.meta.js.map +7 -0
- package/dist/modules/integrations/data/enrichers.js +27 -12
- package/dist/modules/integrations/data/enrichers.js.map +2 -2
- package/dist/modules/integrations/data/entities.js +136 -1
- package/dist/modules/integrations/data/entities.js.map +2 -2
- package/dist/modules/integrations/data/validators.js +36 -0
- package/dist/modules/integrations/data/validators.js.map +7 -0
- package/dist/modules/integrations/di.js +24 -0
- package/dist/modules/integrations/di.js.map +7 -0
- package/dist/modules/integrations/events.js +19 -0
- package/dist/modules/integrations/events.js.map +7 -0
- package/dist/modules/integrations/lib/credentials-service.js +159 -0
- package/dist/modules/integrations/lib/credentials-service.js.map +7 -0
- package/dist/modules/integrations/lib/health-service.js +37 -0
- package/dist/modules/integrations/lib/health-service.js.map +7 -0
- package/dist/modules/integrations/lib/log-service.js +66 -0
- package/dist/modules/integrations/lib/log-service.js.map +7 -0
- package/dist/modules/integrations/lib/registry-service.js +33 -0
- package/dist/modules/integrations/lib/registry-service.js.map +7 -0
- package/dist/modules/integrations/lib/state-service.js +55 -0
- package/dist/modules/integrations/lib/state-service.js.map +7 -0
- package/dist/modules/integrations/lib/types.js +1 -0
- package/dist/modules/integrations/lib/types.js.map +7 -0
- package/dist/modules/integrations/migrations/Migration20260304113737.js +19 -0
- package/dist/modules/integrations/migrations/Migration20260304113737.js.map +7 -0
- package/dist/modules/integrations/setup.js +2 -2
- package/dist/modules/integrations/setup.js.map +2 -2
- package/dist/modules/integrations/widgets/injection-table.js.map +1 -1
- package/dist/modules/integrations/workers/log-pruner.js +18 -0
- package/dist/modules/integrations/workers/log-pruner.js.map +7 -0
- package/generated/entities/integration_credentials/index.ts +8 -0
- package/generated/entities/integration_log/index.ts +12 -0
- package/generated/entities/integration_state/index.ts +12 -0
- package/generated/entities/sync_cursor/index.ts +8 -0
- package/generated/entities/sync_external_id_mapping/index.ts +12 -0
- package/generated/entities/sync_mapping/index.ts +8 -0
- package/generated/entities/sync_run/index.ts +21 -0
- package/generated/entities/sync_schedule/index.ts +16 -0
- package/generated/entities.ids.generated.ts +14 -0
- package/generated/entity-fields-registry.ts +16 -0
- package/package.json +2 -2
- package/src/modules/data_sync/AGENTS.md +157 -0
- package/src/modules/data_sync/acl.ts +7 -0
- package/src/modules/data_sync/api/mappings/[id]/route.ts +158 -0
- package/src/modules/data_sync/api/mappings/route.ts +144 -0
- package/src/modules/data_sync/api/run.ts +97 -0
- package/src/modules/data_sync/api/runs/[id]/cancel.ts +57 -0
- package/src/modules/data_sync/api/runs/[id]/retry.ts +108 -0
- package/src/modules/data_sync/api/runs/[id]/route.ts +81 -0
- package/src/modules/data_sync/api/runs.ts +69 -0
- package/src/modules/data_sync/api/validate.ts +73 -0
- package/src/modules/data_sync/backend/data-sync/page.meta.ts +21 -0
- package/src/modules/data_sync/backend/data-sync/page.tsx +244 -0
- package/src/modules/data_sync/backend/data-sync/runs/[id]/page.meta.ts +10 -0
- package/src/modules/data_sync/backend/data-sync/runs/[id]/page.tsx +278 -0
- package/src/modules/data_sync/data/entities.ts +180 -0
- package/src/modules/data_sync/data/validators.ts +35 -0
- package/src/modules/data_sync/di.ts +38 -0
- package/src/modules/data_sync/events.ts +12 -0
- package/src/modules/data_sync/i18n/de.json +48 -0
- package/src/modules/data_sync/i18n/en.json +48 -0
- package/src/modules/data_sync/i18n/es.json +48 -0
- package/src/modules/data_sync/i18n/pl.json +48 -0
- package/src/modules/data_sync/index.ts +5 -0
- package/src/modules/data_sync/lib/adapter-registry.ts +15 -0
- package/src/modules/data_sync/lib/adapter.ts +90 -0
- package/src/modules/data_sync/lib/id-mapping.ts +95 -0
- package/src/modules/data_sync/lib/queue.ts +19 -0
- package/src/modules/data_sync/lib/sync-engine.ts +375 -0
- package/src/modules/data_sync/lib/sync-run-service.ts +187 -0
- package/src/modules/data_sync/migrations/.snapshot-open-mercato.json +653 -0
- package/src/modules/data_sync/migrations/Migration20260304113737.ts +19 -0
- package/src/modules/data_sync/setup.ts +11 -0
- package/src/modules/data_sync/workers/sync-export.ts +27 -0
- package/src/modules/data_sync/workers/sync-import.ts +27 -0
- package/src/modules/data_sync/workers/sync-scheduled.ts +84 -0
- package/src/modules/entities/lib/encryptionDefaults.ts +4 -0
- package/src/modules/integrations/AGENTS.md +160 -0
- package/src/modules/integrations/acl.ts +3 -0
- package/src/modules/integrations/api/[id]/credentials/route.ts +142 -0
- package/src/modules/integrations/api/[id]/health/route.ts +53 -0
- package/src/modules/integrations/api/[id]/route.ts +76 -0
- package/src/modules/integrations/api/[id]/state/route.ts +121 -0
- package/src/modules/integrations/api/[id]/version/route.ts +132 -0
- package/src/modules/integrations/api/guards.ts +59 -0
- package/src/modules/integrations/api/logs/route.ts +63 -0
- package/src/modules/integrations/api/openapi.ts +22 -0
- package/src/modules/integrations/api/route.ts +73 -0
- package/src/modules/integrations/backend/integrations/[id]/page.meta.ts +11 -0
- package/src/modules/integrations/backend/integrations/[id]/page.tsx +424 -0
- package/src/modules/integrations/backend/integrations/bundle/[id]/page.meta.ts +11 -0
- package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +249 -0
- package/src/modules/integrations/backend/integrations/page.meta.ts +18 -0
- package/src/modules/integrations/backend/integrations/page.tsx +296 -0
- package/src/modules/integrations/data/enrichers.ts +35 -18
- package/src/modules/integrations/data/entities.ts +114 -5
- package/src/modules/integrations/data/validators.ts +41 -0
- package/src/modules/integrations/di.ts +31 -0
- package/src/modules/integrations/events.ts +17 -0
- package/src/modules/integrations/i18n/de.json +70 -0
- package/src/modules/integrations/i18n/en.json +70 -0
- package/src/modules/integrations/i18n/es.json +70 -0
- package/src/modules/integrations/i18n/pl.json +70 -0
- package/src/modules/integrations/lib/credentials-service.ts +204 -0
- package/src/modules/integrations/lib/health-service.ts +59 -0
- package/src/modules/integrations/lib/log-service.ts +84 -0
- package/src/modules/integrations/lib/registry-service.ts +42 -0
- package/src/modules/integrations/lib/state-service.ts +64 -0
- package/src/modules/integrations/lib/types.ts +4 -0
- package/src/modules/integrations/migrations/.snapshot-open-mercato.json +582 -0
- package/src/modules/integrations/migrations/Migration20260304113737.ts +21 -0
- package/src/modules/integrations/setup.ts +2 -2
- package/src/modules/integrations/widgets/injection-table.ts +1 -1
- package/src/modules/integrations/workers/log-pruner.ts +30 -0
|
@@ -0,0 +1,653 @@
|
|
|
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
|
+
"entity_type": {
|
|
29
|
+
"name": "entity_type",
|
|
30
|
+
"type": "text",
|
|
31
|
+
"unsigned": false,
|
|
32
|
+
"autoincrement": false,
|
|
33
|
+
"primary": false,
|
|
34
|
+
"nullable": false,
|
|
35
|
+
"mappedType": "text"
|
|
36
|
+
},
|
|
37
|
+
"direction": {
|
|
38
|
+
"name": "direction",
|
|
39
|
+
"type": "text",
|
|
40
|
+
"unsigned": false,
|
|
41
|
+
"autoincrement": false,
|
|
42
|
+
"primary": false,
|
|
43
|
+
"nullable": false,
|
|
44
|
+
"mappedType": "text"
|
|
45
|
+
},
|
|
46
|
+
"cursor": {
|
|
47
|
+
"name": "cursor",
|
|
48
|
+
"type": "text",
|
|
49
|
+
"unsigned": false,
|
|
50
|
+
"autoincrement": false,
|
|
51
|
+
"primary": false,
|
|
52
|
+
"nullable": true,
|
|
53
|
+
"mappedType": "text"
|
|
54
|
+
},
|
|
55
|
+
"organization_id": {
|
|
56
|
+
"name": "organization_id",
|
|
57
|
+
"type": "uuid",
|
|
58
|
+
"unsigned": false,
|
|
59
|
+
"autoincrement": false,
|
|
60
|
+
"primary": false,
|
|
61
|
+
"nullable": false,
|
|
62
|
+
"mappedType": "uuid"
|
|
63
|
+
},
|
|
64
|
+
"tenant_id": {
|
|
65
|
+
"name": "tenant_id",
|
|
66
|
+
"type": "uuid",
|
|
67
|
+
"unsigned": false,
|
|
68
|
+
"autoincrement": false,
|
|
69
|
+
"primary": false,
|
|
70
|
+
"nullable": false,
|
|
71
|
+
"mappedType": "uuid"
|
|
72
|
+
},
|
|
73
|
+
"updated_at": {
|
|
74
|
+
"name": "updated_at",
|
|
75
|
+
"type": "timestamptz",
|
|
76
|
+
"unsigned": false,
|
|
77
|
+
"autoincrement": false,
|
|
78
|
+
"primary": false,
|
|
79
|
+
"nullable": false,
|
|
80
|
+
"length": 6,
|
|
81
|
+
"mappedType": "datetime"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"name": "sync_cursors",
|
|
85
|
+
"schema": "public",
|
|
86
|
+
"indexes": [
|
|
87
|
+
{
|
|
88
|
+
"keyName": "sync_cursors_integration_id_entity_type_direction__b4d87_index",
|
|
89
|
+
"columnNames": [
|
|
90
|
+
"integration_id",
|
|
91
|
+
"entity_type",
|
|
92
|
+
"direction",
|
|
93
|
+
"organization_id",
|
|
94
|
+
"tenant_id"
|
|
95
|
+
],
|
|
96
|
+
"composite": true,
|
|
97
|
+
"constraint": false,
|
|
98
|
+
"primary": false,
|
|
99
|
+
"unique": false,
|
|
100
|
+
"options": {
|
|
101
|
+
"unique": true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"keyName": "sync_cursors_pkey",
|
|
106
|
+
"columnNames": [
|
|
107
|
+
"id"
|
|
108
|
+
],
|
|
109
|
+
"composite": false,
|
|
110
|
+
"constraint": true,
|
|
111
|
+
"primary": true,
|
|
112
|
+
"unique": true
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"checks": [],
|
|
116
|
+
"foreignKeys": {},
|
|
117
|
+
"nativeEnums": {}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"columns": {
|
|
121
|
+
"id": {
|
|
122
|
+
"name": "id",
|
|
123
|
+
"type": "uuid",
|
|
124
|
+
"unsigned": false,
|
|
125
|
+
"autoincrement": false,
|
|
126
|
+
"primary": false,
|
|
127
|
+
"nullable": false,
|
|
128
|
+
"default": "gen_random_uuid()",
|
|
129
|
+
"mappedType": "uuid"
|
|
130
|
+
},
|
|
131
|
+
"integration_id": {
|
|
132
|
+
"name": "integration_id",
|
|
133
|
+
"type": "text",
|
|
134
|
+
"unsigned": false,
|
|
135
|
+
"autoincrement": false,
|
|
136
|
+
"primary": false,
|
|
137
|
+
"nullable": false,
|
|
138
|
+
"mappedType": "text"
|
|
139
|
+
},
|
|
140
|
+
"entity_type": {
|
|
141
|
+
"name": "entity_type",
|
|
142
|
+
"type": "text",
|
|
143
|
+
"unsigned": false,
|
|
144
|
+
"autoincrement": false,
|
|
145
|
+
"primary": false,
|
|
146
|
+
"nullable": false,
|
|
147
|
+
"mappedType": "text"
|
|
148
|
+
},
|
|
149
|
+
"mapping": {
|
|
150
|
+
"name": "mapping",
|
|
151
|
+
"type": "jsonb",
|
|
152
|
+
"unsigned": false,
|
|
153
|
+
"autoincrement": false,
|
|
154
|
+
"primary": false,
|
|
155
|
+
"nullable": false,
|
|
156
|
+
"mappedType": "json"
|
|
157
|
+
},
|
|
158
|
+
"organization_id": {
|
|
159
|
+
"name": "organization_id",
|
|
160
|
+
"type": "uuid",
|
|
161
|
+
"unsigned": false,
|
|
162
|
+
"autoincrement": false,
|
|
163
|
+
"primary": false,
|
|
164
|
+
"nullable": false,
|
|
165
|
+
"mappedType": "uuid"
|
|
166
|
+
},
|
|
167
|
+
"tenant_id": {
|
|
168
|
+
"name": "tenant_id",
|
|
169
|
+
"type": "uuid",
|
|
170
|
+
"unsigned": false,
|
|
171
|
+
"autoincrement": false,
|
|
172
|
+
"primary": false,
|
|
173
|
+
"nullable": false,
|
|
174
|
+
"mappedType": "uuid"
|
|
175
|
+
},
|
|
176
|
+
"created_at": {
|
|
177
|
+
"name": "created_at",
|
|
178
|
+
"type": "timestamptz",
|
|
179
|
+
"unsigned": false,
|
|
180
|
+
"autoincrement": false,
|
|
181
|
+
"primary": false,
|
|
182
|
+
"nullable": false,
|
|
183
|
+
"length": 6,
|
|
184
|
+
"mappedType": "datetime"
|
|
185
|
+
},
|
|
186
|
+
"updated_at": {
|
|
187
|
+
"name": "updated_at",
|
|
188
|
+
"type": "timestamptz",
|
|
189
|
+
"unsigned": false,
|
|
190
|
+
"autoincrement": false,
|
|
191
|
+
"primary": false,
|
|
192
|
+
"nullable": false,
|
|
193
|
+
"length": 6,
|
|
194
|
+
"mappedType": "datetime"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"name": "sync_mappings",
|
|
198
|
+
"schema": "public",
|
|
199
|
+
"indexes": [
|
|
200
|
+
{
|
|
201
|
+
"keyName": "sync_mappings_integration_id_entity_type_organizat_edee9_index",
|
|
202
|
+
"columnNames": [
|
|
203
|
+
"integration_id",
|
|
204
|
+
"entity_type",
|
|
205
|
+
"organization_id",
|
|
206
|
+
"tenant_id"
|
|
207
|
+
],
|
|
208
|
+
"composite": true,
|
|
209
|
+
"constraint": false,
|
|
210
|
+
"primary": false,
|
|
211
|
+
"unique": false,
|
|
212
|
+
"options": {
|
|
213
|
+
"unique": true
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"keyName": "sync_mappings_pkey",
|
|
218
|
+
"columnNames": [
|
|
219
|
+
"id"
|
|
220
|
+
],
|
|
221
|
+
"composite": false,
|
|
222
|
+
"constraint": true,
|
|
223
|
+
"primary": true,
|
|
224
|
+
"unique": true
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"checks": [],
|
|
228
|
+
"foreignKeys": {},
|
|
229
|
+
"nativeEnums": {}
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"columns": {
|
|
233
|
+
"id": {
|
|
234
|
+
"name": "id",
|
|
235
|
+
"type": "uuid",
|
|
236
|
+
"unsigned": false,
|
|
237
|
+
"autoincrement": false,
|
|
238
|
+
"primary": false,
|
|
239
|
+
"nullable": false,
|
|
240
|
+
"default": "gen_random_uuid()",
|
|
241
|
+
"mappedType": "uuid"
|
|
242
|
+
},
|
|
243
|
+
"integration_id": {
|
|
244
|
+
"name": "integration_id",
|
|
245
|
+
"type": "text",
|
|
246
|
+
"unsigned": false,
|
|
247
|
+
"autoincrement": false,
|
|
248
|
+
"primary": false,
|
|
249
|
+
"nullable": false,
|
|
250
|
+
"mappedType": "text"
|
|
251
|
+
},
|
|
252
|
+
"entity_type": {
|
|
253
|
+
"name": "entity_type",
|
|
254
|
+
"type": "text",
|
|
255
|
+
"unsigned": false,
|
|
256
|
+
"autoincrement": false,
|
|
257
|
+
"primary": false,
|
|
258
|
+
"nullable": false,
|
|
259
|
+
"mappedType": "text"
|
|
260
|
+
},
|
|
261
|
+
"direction": {
|
|
262
|
+
"name": "direction",
|
|
263
|
+
"type": "text",
|
|
264
|
+
"unsigned": false,
|
|
265
|
+
"autoincrement": false,
|
|
266
|
+
"primary": false,
|
|
267
|
+
"nullable": false,
|
|
268
|
+
"mappedType": "text"
|
|
269
|
+
},
|
|
270
|
+
"status": {
|
|
271
|
+
"name": "status",
|
|
272
|
+
"type": "text",
|
|
273
|
+
"unsigned": false,
|
|
274
|
+
"autoincrement": false,
|
|
275
|
+
"primary": false,
|
|
276
|
+
"nullable": false,
|
|
277
|
+
"mappedType": "text"
|
|
278
|
+
},
|
|
279
|
+
"cursor": {
|
|
280
|
+
"name": "cursor",
|
|
281
|
+
"type": "text",
|
|
282
|
+
"unsigned": false,
|
|
283
|
+
"autoincrement": false,
|
|
284
|
+
"primary": false,
|
|
285
|
+
"nullable": true,
|
|
286
|
+
"mappedType": "text"
|
|
287
|
+
},
|
|
288
|
+
"initial_cursor": {
|
|
289
|
+
"name": "initial_cursor",
|
|
290
|
+
"type": "text",
|
|
291
|
+
"unsigned": false,
|
|
292
|
+
"autoincrement": false,
|
|
293
|
+
"primary": false,
|
|
294
|
+
"nullable": true,
|
|
295
|
+
"mappedType": "text"
|
|
296
|
+
},
|
|
297
|
+
"created_count": {
|
|
298
|
+
"name": "created_count",
|
|
299
|
+
"type": "int",
|
|
300
|
+
"unsigned": false,
|
|
301
|
+
"autoincrement": false,
|
|
302
|
+
"primary": false,
|
|
303
|
+
"nullable": false,
|
|
304
|
+
"default": "0",
|
|
305
|
+
"mappedType": "integer"
|
|
306
|
+
},
|
|
307
|
+
"updated_count": {
|
|
308
|
+
"name": "updated_count",
|
|
309
|
+
"type": "int",
|
|
310
|
+
"unsigned": false,
|
|
311
|
+
"autoincrement": false,
|
|
312
|
+
"primary": false,
|
|
313
|
+
"nullable": false,
|
|
314
|
+
"default": "0",
|
|
315
|
+
"mappedType": "integer"
|
|
316
|
+
},
|
|
317
|
+
"skipped_count": {
|
|
318
|
+
"name": "skipped_count",
|
|
319
|
+
"type": "int",
|
|
320
|
+
"unsigned": false,
|
|
321
|
+
"autoincrement": false,
|
|
322
|
+
"primary": false,
|
|
323
|
+
"nullable": false,
|
|
324
|
+
"default": "0",
|
|
325
|
+
"mappedType": "integer"
|
|
326
|
+
},
|
|
327
|
+
"failed_count": {
|
|
328
|
+
"name": "failed_count",
|
|
329
|
+
"type": "int",
|
|
330
|
+
"unsigned": false,
|
|
331
|
+
"autoincrement": false,
|
|
332
|
+
"primary": false,
|
|
333
|
+
"nullable": false,
|
|
334
|
+
"default": "0",
|
|
335
|
+
"mappedType": "integer"
|
|
336
|
+
},
|
|
337
|
+
"batches_completed": {
|
|
338
|
+
"name": "batches_completed",
|
|
339
|
+
"type": "int",
|
|
340
|
+
"unsigned": false,
|
|
341
|
+
"autoincrement": false,
|
|
342
|
+
"primary": false,
|
|
343
|
+
"nullable": false,
|
|
344
|
+
"default": "0",
|
|
345
|
+
"mappedType": "integer"
|
|
346
|
+
},
|
|
347
|
+
"last_error": {
|
|
348
|
+
"name": "last_error",
|
|
349
|
+
"type": "text",
|
|
350
|
+
"unsigned": false,
|
|
351
|
+
"autoincrement": false,
|
|
352
|
+
"primary": false,
|
|
353
|
+
"nullable": true,
|
|
354
|
+
"mappedType": "text"
|
|
355
|
+
},
|
|
356
|
+
"progress_job_id": {
|
|
357
|
+
"name": "progress_job_id",
|
|
358
|
+
"type": "uuid",
|
|
359
|
+
"unsigned": false,
|
|
360
|
+
"autoincrement": false,
|
|
361
|
+
"primary": false,
|
|
362
|
+
"nullable": true,
|
|
363
|
+
"mappedType": "uuid"
|
|
364
|
+
},
|
|
365
|
+
"job_id": {
|
|
366
|
+
"name": "job_id",
|
|
367
|
+
"type": "text",
|
|
368
|
+
"unsigned": false,
|
|
369
|
+
"autoincrement": false,
|
|
370
|
+
"primary": false,
|
|
371
|
+
"nullable": true,
|
|
372
|
+
"mappedType": "text"
|
|
373
|
+
},
|
|
374
|
+
"triggered_by": {
|
|
375
|
+
"name": "triggered_by",
|
|
376
|
+
"type": "text",
|
|
377
|
+
"unsigned": false,
|
|
378
|
+
"autoincrement": false,
|
|
379
|
+
"primary": false,
|
|
380
|
+
"nullable": true,
|
|
381
|
+
"mappedType": "text"
|
|
382
|
+
},
|
|
383
|
+
"organization_id": {
|
|
384
|
+
"name": "organization_id",
|
|
385
|
+
"type": "uuid",
|
|
386
|
+
"unsigned": false,
|
|
387
|
+
"autoincrement": false,
|
|
388
|
+
"primary": false,
|
|
389
|
+
"nullable": false,
|
|
390
|
+
"mappedType": "uuid"
|
|
391
|
+
},
|
|
392
|
+
"tenant_id": {
|
|
393
|
+
"name": "tenant_id",
|
|
394
|
+
"type": "uuid",
|
|
395
|
+
"unsigned": false,
|
|
396
|
+
"autoincrement": false,
|
|
397
|
+
"primary": false,
|
|
398
|
+
"nullable": false,
|
|
399
|
+
"mappedType": "uuid"
|
|
400
|
+
},
|
|
401
|
+
"created_at": {
|
|
402
|
+
"name": "created_at",
|
|
403
|
+
"type": "timestamptz",
|
|
404
|
+
"unsigned": false,
|
|
405
|
+
"autoincrement": false,
|
|
406
|
+
"primary": false,
|
|
407
|
+
"nullable": false,
|
|
408
|
+
"length": 6,
|
|
409
|
+
"mappedType": "datetime"
|
|
410
|
+
},
|
|
411
|
+
"updated_at": {
|
|
412
|
+
"name": "updated_at",
|
|
413
|
+
"type": "timestamptz",
|
|
414
|
+
"unsigned": false,
|
|
415
|
+
"autoincrement": false,
|
|
416
|
+
"primary": false,
|
|
417
|
+
"nullable": false,
|
|
418
|
+
"length": 6,
|
|
419
|
+
"mappedType": "datetime"
|
|
420
|
+
},
|
|
421
|
+
"deleted_at": {
|
|
422
|
+
"name": "deleted_at",
|
|
423
|
+
"type": "timestamptz",
|
|
424
|
+
"unsigned": false,
|
|
425
|
+
"autoincrement": false,
|
|
426
|
+
"primary": false,
|
|
427
|
+
"nullable": true,
|
|
428
|
+
"length": 6,
|
|
429
|
+
"mappedType": "datetime"
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
"name": "sync_runs",
|
|
433
|
+
"schema": "public",
|
|
434
|
+
"indexes": [
|
|
435
|
+
{
|
|
436
|
+
"keyName": "sync_runs_integration_id_entity_type_status_organi_8b13b_index",
|
|
437
|
+
"columnNames": [
|
|
438
|
+
"integration_id",
|
|
439
|
+
"entity_type",
|
|
440
|
+
"status",
|
|
441
|
+
"organization_id",
|
|
442
|
+
"tenant_id"
|
|
443
|
+
],
|
|
444
|
+
"composite": true,
|
|
445
|
+
"constraint": false,
|
|
446
|
+
"primary": false,
|
|
447
|
+
"unique": false
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"keyName": "sync_runs_pkey",
|
|
451
|
+
"columnNames": [
|
|
452
|
+
"id"
|
|
453
|
+
],
|
|
454
|
+
"composite": false,
|
|
455
|
+
"constraint": true,
|
|
456
|
+
"primary": true,
|
|
457
|
+
"unique": true
|
|
458
|
+
}
|
|
459
|
+
],
|
|
460
|
+
"checks": [],
|
|
461
|
+
"foreignKeys": {},
|
|
462
|
+
"nativeEnums": {}
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"columns": {
|
|
466
|
+
"id": {
|
|
467
|
+
"name": "id",
|
|
468
|
+
"type": "uuid",
|
|
469
|
+
"unsigned": false,
|
|
470
|
+
"autoincrement": false,
|
|
471
|
+
"primary": false,
|
|
472
|
+
"nullable": false,
|
|
473
|
+
"default": "gen_random_uuid()",
|
|
474
|
+
"mappedType": "uuid"
|
|
475
|
+
},
|
|
476
|
+
"integration_id": {
|
|
477
|
+
"name": "integration_id",
|
|
478
|
+
"type": "text",
|
|
479
|
+
"unsigned": false,
|
|
480
|
+
"autoincrement": false,
|
|
481
|
+
"primary": false,
|
|
482
|
+
"nullable": false,
|
|
483
|
+
"mappedType": "text"
|
|
484
|
+
},
|
|
485
|
+
"entity_type": {
|
|
486
|
+
"name": "entity_type",
|
|
487
|
+
"type": "text",
|
|
488
|
+
"unsigned": false,
|
|
489
|
+
"autoincrement": false,
|
|
490
|
+
"primary": false,
|
|
491
|
+
"nullable": false,
|
|
492
|
+
"mappedType": "text"
|
|
493
|
+
},
|
|
494
|
+
"direction": {
|
|
495
|
+
"name": "direction",
|
|
496
|
+
"type": "text",
|
|
497
|
+
"unsigned": false,
|
|
498
|
+
"autoincrement": false,
|
|
499
|
+
"primary": false,
|
|
500
|
+
"nullable": false,
|
|
501
|
+
"mappedType": "text"
|
|
502
|
+
},
|
|
503
|
+
"schedule_type": {
|
|
504
|
+
"name": "schedule_type",
|
|
505
|
+
"type": "text",
|
|
506
|
+
"unsigned": false,
|
|
507
|
+
"autoincrement": false,
|
|
508
|
+
"primary": false,
|
|
509
|
+
"nullable": false,
|
|
510
|
+
"mappedType": "text"
|
|
511
|
+
},
|
|
512
|
+
"schedule_value": {
|
|
513
|
+
"name": "schedule_value",
|
|
514
|
+
"type": "text",
|
|
515
|
+
"unsigned": false,
|
|
516
|
+
"autoincrement": false,
|
|
517
|
+
"primary": false,
|
|
518
|
+
"nullable": false,
|
|
519
|
+
"mappedType": "text"
|
|
520
|
+
},
|
|
521
|
+
"timezone": {
|
|
522
|
+
"name": "timezone",
|
|
523
|
+
"type": "text",
|
|
524
|
+
"unsigned": false,
|
|
525
|
+
"autoincrement": false,
|
|
526
|
+
"primary": false,
|
|
527
|
+
"nullable": false,
|
|
528
|
+
"default": "'UTC'",
|
|
529
|
+
"mappedType": "text"
|
|
530
|
+
},
|
|
531
|
+
"full_sync": {
|
|
532
|
+
"name": "full_sync",
|
|
533
|
+
"type": "boolean",
|
|
534
|
+
"unsigned": false,
|
|
535
|
+
"autoincrement": false,
|
|
536
|
+
"primary": false,
|
|
537
|
+
"nullable": false,
|
|
538
|
+
"default": "false",
|
|
539
|
+
"mappedType": "boolean"
|
|
540
|
+
},
|
|
541
|
+
"is_enabled": {
|
|
542
|
+
"name": "is_enabled",
|
|
543
|
+
"type": "boolean",
|
|
544
|
+
"unsigned": false,
|
|
545
|
+
"autoincrement": false,
|
|
546
|
+
"primary": false,
|
|
547
|
+
"nullable": false,
|
|
548
|
+
"default": "true",
|
|
549
|
+
"mappedType": "boolean"
|
|
550
|
+
},
|
|
551
|
+
"scheduled_job_id": {
|
|
552
|
+
"name": "scheduled_job_id",
|
|
553
|
+
"type": "uuid",
|
|
554
|
+
"unsigned": false,
|
|
555
|
+
"autoincrement": false,
|
|
556
|
+
"primary": false,
|
|
557
|
+
"nullable": true,
|
|
558
|
+
"mappedType": "uuid"
|
|
559
|
+
},
|
|
560
|
+
"last_run_at": {
|
|
561
|
+
"name": "last_run_at",
|
|
562
|
+
"type": "timestamptz",
|
|
563
|
+
"unsigned": false,
|
|
564
|
+
"autoincrement": false,
|
|
565
|
+
"primary": false,
|
|
566
|
+
"nullable": true,
|
|
567
|
+
"length": 6,
|
|
568
|
+
"mappedType": "datetime"
|
|
569
|
+
},
|
|
570
|
+
"organization_id": {
|
|
571
|
+
"name": "organization_id",
|
|
572
|
+
"type": "uuid",
|
|
573
|
+
"unsigned": false,
|
|
574
|
+
"autoincrement": false,
|
|
575
|
+
"primary": false,
|
|
576
|
+
"nullable": false,
|
|
577
|
+
"mappedType": "uuid"
|
|
578
|
+
},
|
|
579
|
+
"tenant_id": {
|
|
580
|
+
"name": "tenant_id",
|
|
581
|
+
"type": "uuid",
|
|
582
|
+
"unsigned": false,
|
|
583
|
+
"autoincrement": false,
|
|
584
|
+
"primary": false,
|
|
585
|
+
"nullable": false,
|
|
586
|
+
"mappedType": "uuid"
|
|
587
|
+
},
|
|
588
|
+
"created_at": {
|
|
589
|
+
"name": "created_at",
|
|
590
|
+
"type": "timestamptz",
|
|
591
|
+
"unsigned": false,
|
|
592
|
+
"autoincrement": false,
|
|
593
|
+
"primary": false,
|
|
594
|
+
"nullable": false,
|
|
595
|
+
"length": 6,
|
|
596
|
+
"mappedType": "datetime"
|
|
597
|
+
},
|
|
598
|
+
"updated_at": {
|
|
599
|
+
"name": "updated_at",
|
|
600
|
+
"type": "timestamptz",
|
|
601
|
+
"unsigned": false,
|
|
602
|
+
"autoincrement": false,
|
|
603
|
+
"primary": false,
|
|
604
|
+
"nullable": false,
|
|
605
|
+
"length": 6,
|
|
606
|
+
"mappedType": "datetime"
|
|
607
|
+
},
|
|
608
|
+
"deleted_at": {
|
|
609
|
+
"name": "deleted_at",
|
|
610
|
+
"type": "timestamptz",
|
|
611
|
+
"unsigned": false,
|
|
612
|
+
"autoincrement": false,
|
|
613
|
+
"primary": false,
|
|
614
|
+
"nullable": true,
|
|
615
|
+
"length": 6,
|
|
616
|
+
"mappedType": "datetime"
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
"name": "sync_schedules",
|
|
620
|
+
"schema": "public",
|
|
621
|
+
"indexes": [
|
|
622
|
+
{
|
|
623
|
+
"keyName": "sync_schedules_integration_id_entity_type_directio_addb9_index",
|
|
624
|
+
"columnNames": [
|
|
625
|
+
"integration_id",
|
|
626
|
+
"entity_type",
|
|
627
|
+
"direction",
|
|
628
|
+
"organization_id",
|
|
629
|
+
"tenant_id"
|
|
630
|
+
],
|
|
631
|
+
"composite": true,
|
|
632
|
+
"constraint": false,
|
|
633
|
+
"primary": false,
|
|
634
|
+
"unique": false
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
"keyName": "sync_schedules_pkey",
|
|
638
|
+
"columnNames": [
|
|
639
|
+
"id"
|
|
640
|
+
],
|
|
641
|
+
"composite": false,
|
|
642
|
+
"constraint": true,
|
|
643
|
+
"primary": true,
|
|
644
|
+
"unique": true
|
|
645
|
+
}
|
|
646
|
+
],
|
|
647
|
+
"checks": [],
|
|
648
|
+
"foreignKeys": {},
|
|
649
|
+
"nativeEnums": {}
|
|
650
|
+
}
|
|
651
|
+
],
|
|
652
|
+
"nativeEnums": {}
|
|
653
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
|
|
3
|
+
export class Migration20260304113737 extends Migration {
|
|
4
|
+
|
|
5
|
+
override async up(): Promise<void> {
|
|
6
|
+
this.addSql(`create table "sync_cursors" ("id" uuid not null default gen_random_uuid(), "integration_id" text not null, "entity_type" text not null, "direction" text not null, "cursor" text null, "organization_id" uuid not null, "tenant_id" uuid not null, "updated_at" timestamptz not null, constraint "sync_cursors_pkey" primary key ("id"));`);
|
|
7
|
+
this.addSql(`create unique index "sync_cursors_integration_id_entity_type_direction__b4d87_index" on "sync_cursors" ("integration_id", "entity_type", "direction", "organization_id", "tenant_id");`);
|
|
8
|
+
|
|
9
|
+
this.addSql(`create table "sync_mappings" ("id" uuid not null default gen_random_uuid(), "integration_id" text not null, "entity_type" text not null, "mapping" jsonb not null, "organization_id" uuid not null, "tenant_id" uuid not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, constraint "sync_mappings_pkey" primary key ("id"));`);
|
|
10
|
+
this.addSql(`create unique index "sync_mappings_integration_id_entity_type_organizat_edee9_index" on "sync_mappings" ("integration_id", "entity_type", "organization_id", "tenant_id");`);
|
|
11
|
+
|
|
12
|
+
this.addSql(`create table "sync_runs" ("id" uuid not null default gen_random_uuid(), "integration_id" text not null, "entity_type" text not null, "direction" text not null, "status" text not null, "cursor" text null, "initial_cursor" text null, "created_count" int not null default 0, "updated_count" int not null default 0, "skipped_count" int not null default 0, "failed_count" int not null default 0, "batches_completed" int not null default 0, "last_error" text null, "progress_job_id" uuid null, "job_id" text null, "triggered_by" text null, "organization_id" uuid not null, "tenant_id" uuid not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, "deleted_at" timestamptz null, constraint "sync_runs_pkey" primary key ("id"));`);
|
|
13
|
+
this.addSql(`create index "sync_runs_integration_id_entity_type_status_organi_8b13b_index" on "sync_runs" ("integration_id", "entity_type", "status", "organization_id", "tenant_id");`);
|
|
14
|
+
|
|
15
|
+
this.addSql(`create table "sync_schedules" ("id" uuid not null default gen_random_uuid(), "integration_id" text not null, "entity_type" text not null, "direction" text not null, "schedule_type" text not null, "schedule_value" text not null, "timezone" text not null default 'UTC', "full_sync" boolean not null default false, "is_enabled" boolean not null default true, "scheduled_job_id" uuid null, "last_run_at" timestamptz null, "organization_id" uuid not null, "tenant_id" uuid not null, "created_at" timestamptz not null, "updated_at" timestamptz not null, "deleted_at" timestamptz null, constraint "sync_schedules_pkey" primary key ("id"));`);
|
|
16
|
+
this.addSql(`create index "sync_schedules_integration_id_entity_type_directio_addb9_index" on "sync_schedules" ("integration_id", "entity_type", "direction", "organization_id", "tenant_id");`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ModuleSetupConfig } from '@open-mercato/shared/modules/setup'
|
|
2
|
+
|
|
3
|
+
export const setup: ModuleSetupConfig = {
|
|
4
|
+
defaultRoleFeatures: {
|
|
5
|
+
superadmin: ['data_sync.view', 'data_sync.run', 'data_sync.configure'],
|
|
6
|
+
admin: ['data_sync.view', 'data_sync.run', 'data_sync.configure'],
|
|
7
|
+
employee: ['data_sync.view'],
|
|
8
|
+
},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default setup
|