@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.
- 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,178 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import Link from "next/link";
|
|
5
|
+
import { useParams, useRouter } from "next/navigation";
|
|
6
|
+
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
|
|
7
|
+
import { Card, CardHeader, CardTitle, CardContent } from "@open-mercato/ui/primitives/card";
|
|
8
|
+
import { Badge } from "@open-mercato/ui/primitives/badge";
|
|
9
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
10
|
+
import { Progress } from "@open-mercato/ui/primitives/progress";
|
|
11
|
+
import { Spinner } from "@open-mercato/ui/primitives/spinner";
|
|
12
|
+
import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
|
|
13
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
14
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
15
|
+
import { LoadingMessage } from "@open-mercato/ui/backend/detail";
|
|
16
|
+
import { ErrorMessage } from "@open-mercato/ui/backend/detail";
|
|
17
|
+
const STATUS_STYLES = {
|
|
18
|
+
pending: "bg-gray-100 text-gray-800",
|
|
19
|
+
running: "bg-blue-100 text-blue-800",
|
|
20
|
+
completed: "bg-green-100 text-green-800",
|
|
21
|
+
failed: "bg-red-100 text-red-800",
|
|
22
|
+
cancelled: "bg-yellow-100 text-yellow-800",
|
|
23
|
+
paused: "bg-orange-100 text-orange-800"
|
|
24
|
+
};
|
|
25
|
+
const LOG_LEVEL_STYLES = {
|
|
26
|
+
info: "bg-blue-100 text-blue-800",
|
|
27
|
+
warn: "bg-yellow-100 text-yellow-800",
|
|
28
|
+
error: "bg-red-100 text-red-800"
|
|
29
|
+
};
|
|
30
|
+
function SyncRunDetailPage() {
|
|
31
|
+
const params = useParams();
|
|
32
|
+
const router = useRouter();
|
|
33
|
+
const runId = params.id;
|
|
34
|
+
const t = useT();
|
|
35
|
+
const [run, setRun] = React.useState(null);
|
|
36
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
37
|
+
const [error, setError] = React.useState(null);
|
|
38
|
+
const [logs, setLogs] = React.useState([]);
|
|
39
|
+
const [isLoadingLogs, setIsLoadingLogs] = React.useState(false);
|
|
40
|
+
const loadRun = React.useCallback(async () => {
|
|
41
|
+
const call = await apiCall(
|
|
42
|
+
`/api/data_sync/runs/${encodeURIComponent(runId)}`,
|
|
43
|
+
void 0,
|
|
44
|
+
{ fallback: null }
|
|
45
|
+
);
|
|
46
|
+
if (!call.ok || !call.result) {
|
|
47
|
+
setError(t("data_sync.runs.detail.loadError"));
|
|
48
|
+
setIsLoading(false);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
setRun(call.result);
|
|
52
|
+
setIsLoading(false);
|
|
53
|
+
}, [runId, t]);
|
|
54
|
+
const loadLogs = React.useCallback(async () => {
|
|
55
|
+
setIsLoadingLogs(true);
|
|
56
|
+
const params2 = new URLSearchParams({ runId, pageSize: "50" });
|
|
57
|
+
const call = await apiCall(
|
|
58
|
+
`/api/integrations/logs?${params2.toString()}`,
|
|
59
|
+
void 0,
|
|
60
|
+
{ fallback: { items: [] } }
|
|
61
|
+
);
|
|
62
|
+
if (call.ok && call.result) {
|
|
63
|
+
setLogs(call.result.items);
|
|
64
|
+
}
|
|
65
|
+
setIsLoadingLogs(false);
|
|
66
|
+
}, [runId]);
|
|
67
|
+
React.useEffect(() => {
|
|
68
|
+
void loadRun();
|
|
69
|
+
void loadLogs();
|
|
70
|
+
}, [loadRun, loadLogs]);
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
if (!run || run.status !== "running" && run.status !== "pending") return;
|
|
73
|
+
const interval = setInterval(() => {
|
|
74
|
+
void loadRun();
|
|
75
|
+
}, 4e3);
|
|
76
|
+
return () => clearInterval(interval);
|
|
77
|
+
}, [run?.status, loadRun]);
|
|
78
|
+
const handleCancel = React.useCallback(async () => {
|
|
79
|
+
const call = await apiCall(`/api/data_sync/runs/${encodeURIComponent(runId)}/cancel`, {
|
|
80
|
+
method: "POST"
|
|
81
|
+
}, { fallback: null });
|
|
82
|
+
if (call.ok) {
|
|
83
|
+
flash(t("data_sync.runs.detail.cancelSuccess"), "success");
|
|
84
|
+
void loadRun();
|
|
85
|
+
} else {
|
|
86
|
+
flash(t("data_sync.runs.detail.cancelError"), "error");
|
|
87
|
+
}
|
|
88
|
+
}, [runId, t, loadRun]);
|
|
89
|
+
const handleRetry = React.useCallback(async () => {
|
|
90
|
+
const call = await apiCall(`/api/data_sync/runs/${encodeURIComponent(runId)}/retry`, {
|
|
91
|
+
method: "POST",
|
|
92
|
+
headers: { "Content-Type": "application/json" },
|
|
93
|
+
body: JSON.stringify({ fromBeginning: false })
|
|
94
|
+
}, { fallback: null });
|
|
95
|
+
if (call.ok && call.result) {
|
|
96
|
+
flash(t("data_sync.runs.detail.retrySuccess"), "success");
|
|
97
|
+
router.push(`/backend/data-sync/runs/${encodeURIComponent(call.result.id)}`);
|
|
98
|
+
} else {
|
|
99
|
+
flash(t("data_sync.runs.detail.retryError"), "error");
|
|
100
|
+
}
|
|
101
|
+
}, [router, runId, t]);
|
|
102
|
+
if (isLoading) return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(LoadingMessage, { label: t("data_sync.runs.detail.title") }) }) });
|
|
103
|
+
if (error || !run) return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(ErrorMessage, { label: error ?? t("data_sync.runs.detail.loadError") }) }) });
|
|
104
|
+
const totalProcessed = run.createdCount + run.updatedCount + run.skippedCount + run.failedCount;
|
|
105
|
+
const progressPercent = run.progressJob?.progressPercent ?? (run.status === "completed" ? 100 : 0);
|
|
106
|
+
return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsxs(PageBody, { className: "space-y-6", children: [
|
|
107
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Link, { href: "/backend/data-sync", className: "text-sm text-muted-foreground hover:underline", children: t("data_sync.runs.detail.back") }) }),
|
|
108
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
109
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
110
|
+
/* @__PURE__ */ jsxs("h1", { className: "text-2xl font-semibold", children: [
|
|
111
|
+
run.integrationId,
|
|
112
|
+
" \u2014 ",
|
|
113
|
+
run.entityType
|
|
114
|
+
] }),
|
|
115
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 mt-2", children: [
|
|
116
|
+
/* @__PURE__ */ jsx(Badge, { variant: "outline", children: t(`data_sync.dashboard.direction.${run.direction}`) }),
|
|
117
|
+
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: STATUS_STYLES[run.status] ?? "", children: t(`data_sync.dashboard.status.${run.status}`) }),
|
|
118
|
+
run.triggeredBy && /* @__PURE__ */ jsx(Badge, { variant: "outline", children: run.triggeredBy })
|
|
119
|
+
] })
|
|
120
|
+
] }),
|
|
121
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
122
|
+
(run.status === "running" || run.status === "pending") && /* @__PURE__ */ jsx(Button, { type: "button", variant: "destructive", size: "sm", onClick: () => void handleCancel(), children: t("data_sync.runs.detail.cancel") }),
|
|
123
|
+
run.status === "failed" && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => void handleRetry(), children: t("data_sync.runs.detail.retry") })
|
|
124
|
+
] })
|
|
125
|
+
] }),
|
|
126
|
+
(run.status === "running" || run.status === "pending") && /* @__PURE__ */ jsxs(Card, { children: [
|
|
127
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: t("data_sync.runs.detail.progress") }) }),
|
|
128
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-3", children: [
|
|
129
|
+
/* @__PURE__ */ jsx(Progress, { value: progressPercent, className: "h-3" }),
|
|
130
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm text-muted-foreground", children: [
|
|
131
|
+
/* @__PURE__ */ jsx("span", { children: t("data_sync.runs.detail.progress.itemsProcessed", { count: totalProcessed }) }),
|
|
132
|
+
/* @__PURE__ */ jsx("span", { children: t("data_sync.runs.detail.progress.batches", { count: run.batchesCompleted }) })
|
|
133
|
+
] })
|
|
134
|
+
] })
|
|
135
|
+
] }),
|
|
136
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 sm:grid-cols-4 gap-4", children: [
|
|
137
|
+
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "pt-6 text-center", children: [
|
|
138
|
+
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-green-600", children: run.createdCount }),
|
|
139
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("data_sync.runs.detail.counters.created") })
|
|
140
|
+
] }) }),
|
|
141
|
+
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "pt-6 text-center", children: [
|
|
142
|
+
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-blue-600", children: run.updatedCount }),
|
|
143
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("data_sync.runs.detail.counters.updated") })
|
|
144
|
+
] }) }),
|
|
145
|
+
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "pt-6 text-center", children: [
|
|
146
|
+
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-gray-600", children: run.skippedCount }),
|
|
147
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("data_sync.runs.detail.counters.skipped") })
|
|
148
|
+
] }) }),
|
|
149
|
+
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "pt-6 text-center", children: [
|
|
150
|
+
/* @__PURE__ */ jsx("div", { className: "text-2xl font-bold text-red-600", children: run.failedCount }),
|
|
151
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("data_sync.runs.detail.counters.failed") })
|
|
152
|
+
] }) })
|
|
153
|
+
] }),
|
|
154
|
+
run.lastError && /* @__PURE__ */ jsxs(Card, { className: "border-red-200 bg-red-50", children: [
|
|
155
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-red-800", children: t("data_sync.runs.detail.error") }) }),
|
|
156
|
+
/* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("pre", { className: "text-sm text-red-700 whitespace-pre-wrap", children: run.lastError }) })
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
159
|
+
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: t("data_sync.runs.detail.logs") }) }),
|
|
160
|
+
/* @__PURE__ */ jsx(CardContent, { children: isLoadingLogs ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-4", children: /* @__PURE__ */ jsx(Spinner, {}) }) : logs.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: t("data_sync.runs.detail.noLogs") }) : /* @__PURE__ */ jsx("div", { className: "rounded-lg border", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-sm", children: [
|
|
161
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b bg-muted/50", children: [
|
|
162
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 text-left font-medium", children: t("data_sync.runs.detail.logs.time") }),
|
|
163
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 text-left font-medium", children: t("data_sync.runs.detail.logs.level") }),
|
|
164
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-2 text-left font-medium", children: t("data_sync.runs.detail.logs.message") })
|
|
165
|
+
] }) }),
|
|
166
|
+
/* @__PURE__ */ jsx("tbody", { children: logs.map((log) => /* @__PURE__ */ jsxs("tr", { className: "border-b last:border-0", children: [
|
|
167
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-2 text-muted-foreground whitespace-nowrap", children: new Date(log.createdAt).toLocaleString() }),
|
|
168
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-2", children: /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: LOG_LEVEL_STYLES[log.level] ?? "", children: log.level }) }),
|
|
169
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-2", children: log.message })
|
|
170
|
+
] }, log.id)) })
|
|
171
|
+
] }) }) })
|
|
172
|
+
] })
|
|
173
|
+
] }) });
|
|
174
|
+
}
|
|
175
|
+
export {
|
|
176
|
+
SyncRunDetailPage as default
|
|
177
|
+
};
|
|
178
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/modules/data_sync/backend/data-sync/runs/%5Bid%5D/page.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { useParams, useRouter } from 'next/navigation'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { Card, CardHeader, CardTitle, CardContent } from '@open-mercato/ui/primitives/card'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Progress } from '@open-mercato/ui/primitives/progress'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { LoadingMessage } from '@open-mercato/ui/backend/detail'\nimport { ErrorMessage } from '@open-mercato/ui/backend/detail'\n\ntype SyncRunDetail = {\n id: string\n integrationId: string\n entityType: string\n direction: 'import' | 'export'\n status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled' | 'paused'\n createdCount: number\n updatedCount: number\n skippedCount: number\n failedCount: number\n batchesCompleted: number\n lastError: string | null\n progressJobId: string | null\n progressJob: {\n id: string\n status: string\n progressPercent: number\n processedCount: number\n totalCount: number | null\n etaSeconds: number | null\n } | null\n triggeredBy: string | null\n createdAt: string\n updatedAt: string\n}\n\ntype LogEntry = {\n id: string\n level: 'info' | 'warn' | 'error'\n message: string\n createdAt: string\n}\n\nconst STATUS_STYLES: Record<string, string> = {\n pending: 'bg-gray-100 text-gray-800',\n running: 'bg-blue-100 text-blue-800',\n completed: 'bg-green-100 text-green-800',\n failed: 'bg-red-100 text-red-800',\n cancelled: 'bg-yellow-100 text-yellow-800',\n paused: 'bg-orange-100 text-orange-800',\n}\n\nconst LOG_LEVEL_STYLES: Record<string, string> = {\n info: 'bg-blue-100 text-blue-800',\n warn: 'bg-yellow-100 text-yellow-800',\n error: 'bg-red-100 text-red-800',\n}\n\nexport default function SyncRunDetailPage() {\n const params = useParams<{ id: string }>()\n const router = useRouter()\n const runId = params.id\n const t = useT()\n\n const [run, setRun] = React.useState<SyncRunDetail | null>(null)\n const [isLoading, setIsLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [logs, setLogs] = React.useState<LogEntry[]>([])\n const [isLoadingLogs, setIsLoadingLogs] = React.useState(false)\n\n const loadRun = React.useCallback(async () => {\n const call = await apiCall<SyncRunDetail>(\n `/api/data_sync/runs/${encodeURIComponent(runId)}`,\n undefined,\n { fallback: null },\n )\n if (!call.ok || !call.result) {\n setError(t('data_sync.runs.detail.loadError'))\n setIsLoading(false)\n return\n }\n setRun(call.result)\n setIsLoading(false)\n }, [runId, t])\n\n const loadLogs = React.useCallback(async () => {\n setIsLoadingLogs(true)\n const params = new URLSearchParams({ runId, pageSize: '50' })\n const call = await apiCall<{ items: LogEntry[] }>(\n `/api/integrations/logs?${params.toString()}`,\n undefined,\n { fallback: { items: [] } },\n )\n if (call.ok && call.result) {\n setLogs(call.result.items)\n }\n setIsLoadingLogs(false)\n }, [runId])\n\n React.useEffect(() => {\n void loadRun()\n void loadLogs()\n }, [loadRun, loadLogs])\n\n React.useEffect(() => {\n if (!run || (run.status !== 'running' && run.status !== 'pending')) return\n const interval = setInterval(() => { void loadRun() }, 4000)\n return () => clearInterval(interval)\n }, [run?.status, loadRun])\n\n const handleCancel = React.useCallback(async () => {\n const call = await apiCall(`/api/data_sync/runs/${encodeURIComponent(runId)}/cancel`, {\n method: 'POST',\n }, { fallback: null })\n if (call.ok) {\n flash(t('data_sync.runs.detail.cancelSuccess'), 'success')\n void loadRun()\n } else {\n flash(t('data_sync.runs.detail.cancelError'), 'error')\n }\n }, [runId, t, loadRun])\n\n const handleRetry = React.useCallback(async () => {\n const call = await apiCall<{ id: string }>(`/api/data_sync/runs/${encodeURIComponent(runId)}/retry`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ fromBeginning: false }),\n }, { fallback: null })\n if (call.ok && call.result) {\n flash(t('data_sync.runs.detail.retrySuccess'), 'success')\n router.push(`/backend/data-sync/runs/${encodeURIComponent(call.result.id)}`)\n } else {\n flash(t('data_sync.runs.detail.retryError'), 'error')\n }\n }, [router, runId, t])\n\n if (isLoading) return <Page><PageBody><LoadingMessage label={t('data_sync.runs.detail.title')} /></PageBody></Page>\n if (error || !run) return <Page><PageBody><ErrorMessage label={error ?? t('data_sync.runs.detail.loadError')} /></PageBody></Page>\n\n const totalProcessed = run.createdCount + run.updatedCount + run.skippedCount + run.failedCount\n const progressPercent = run.progressJob?.progressPercent ?? (run.status === 'completed' ? 100 : 0)\n\n return (\n <Page>\n <PageBody className=\"space-y-6\">\n <div>\n <Link href=\"/backend/data-sync\" className=\"text-sm text-muted-foreground hover:underline\">\n {t('data_sync.runs.detail.back')}\n </Link>\n </div>\n\n <div className=\"flex items-center justify-between\">\n <div>\n <h1 className=\"text-2xl font-semibold\">{run.integrationId} \u2014 {run.entityType}</h1>\n <div className=\"flex gap-2 mt-2\">\n <Badge variant=\"outline\">{t(`data_sync.dashboard.direction.${run.direction}`)}</Badge>\n <Badge variant=\"secondary\" className={STATUS_STYLES[run.status] ?? ''}>\n {t(`data_sync.dashboard.status.${run.status}`)}\n </Badge>\n {run.triggeredBy && <Badge variant=\"outline\">{run.triggeredBy}</Badge>}\n </div>\n </div>\n <div className=\"flex gap-2\">\n {(run.status === 'running' || run.status === 'pending') && (\n <Button type=\"button\" variant=\"destructive\" size=\"sm\" onClick={() => void handleCancel()}>\n {t('data_sync.runs.detail.cancel')}\n </Button>\n )}\n {run.status === 'failed' && (\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => void handleRetry()}>\n {t('data_sync.runs.detail.retry')}\n </Button>\n )}\n </div>\n </div>\n\n {(run.status === 'running' || run.status === 'pending') && (\n <Card>\n <CardHeader>\n <CardTitle>{t('data_sync.runs.detail.progress')}</CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-3\">\n <Progress value={progressPercent} className=\"h-3\" />\n <div className=\"flex items-center justify-between text-sm text-muted-foreground\">\n <span>{t('data_sync.runs.detail.progress.itemsProcessed', { count: totalProcessed })}</span>\n <span>{t('data_sync.runs.detail.progress.batches', { count: run.batchesCompleted })}</span>\n </div>\n </CardContent>\n </Card>\n )}\n\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n <Card>\n <CardContent className=\"pt-6 text-center\">\n <div className=\"text-2xl font-bold text-green-600\">{run.createdCount}</div>\n <p className=\"text-sm text-muted-foreground\">{t('data_sync.runs.detail.counters.created')}</p>\n </CardContent>\n </Card>\n <Card>\n <CardContent className=\"pt-6 text-center\">\n <div className=\"text-2xl font-bold text-blue-600\">{run.updatedCount}</div>\n <p className=\"text-sm text-muted-foreground\">{t('data_sync.runs.detail.counters.updated')}</p>\n </CardContent>\n </Card>\n <Card>\n <CardContent className=\"pt-6 text-center\">\n <div className=\"text-2xl font-bold text-gray-600\">{run.skippedCount}</div>\n <p className=\"text-sm text-muted-foreground\">{t('data_sync.runs.detail.counters.skipped')}</p>\n </CardContent>\n </Card>\n <Card>\n <CardContent className=\"pt-6 text-center\">\n <div className=\"text-2xl font-bold text-red-600\">{run.failedCount}</div>\n <p className=\"text-sm text-muted-foreground\">{t('data_sync.runs.detail.counters.failed')}</p>\n </CardContent>\n </Card>\n </div>\n\n {run.lastError && (\n <Card className=\"border-red-200 bg-red-50\">\n <CardHeader>\n <CardTitle className=\"text-red-800\">{t('data_sync.runs.detail.error')}</CardTitle>\n </CardHeader>\n <CardContent>\n <pre className=\"text-sm text-red-700 whitespace-pre-wrap\">{run.lastError}</pre>\n </CardContent>\n </Card>\n )}\n\n <Card>\n <CardHeader>\n <CardTitle>{t('data_sync.runs.detail.logs')}</CardTitle>\n </CardHeader>\n <CardContent>\n {isLoadingLogs ? (\n <div className=\"flex justify-center py-4\"><Spinner /></div>\n ) : logs.length === 0 ? (\n <p className=\"text-muted-foreground text-sm\">{t('data_sync.runs.detail.noLogs')}</p>\n ) : (\n <div className=\"rounded-lg border\">\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b bg-muted/50\">\n <th className=\"px-4 py-2 text-left font-medium\">{t('data_sync.runs.detail.logs.time')}</th>\n <th className=\"px-4 py-2 text-left font-medium\">{t('data_sync.runs.detail.logs.level')}</th>\n <th className=\"px-4 py-2 text-left font-medium\">{t('data_sync.runs.detail.logs.message')}</th>\n </tr>\n </thead>\n <tbody>\n {logs.map((log) => (\n <tr key={log.id} className=\"border-b last:border-0\">\n <td className=\"px-4 py-2 text-muted-foreground whitespace-nowrap\">\n {new Date(log.createdAt).toLocaleString()}\n </td>\n <td className=\"px-4 py-2\">\n <Badge variant=\"secondary\" className={LOG_LEVEL_STYLES[log.level] ?? ''}>\n {log.level}\n </Badge>\n </td>\n <td className=\"px-4 py-2\">{log.message}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </CardContent>\n </Card>\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA8IwC,cAiB5B,YAjB4B;AA7IxC,YAAY,WAAW;AACvB,OAAO,UAAU;AACjB,SAAS,WAAW,iBAAiB;AACrC,SAAS,MAAM,gBAAgB;AAC/B,SAAS,MAAM,YAAY,WAAW,mBAAmB;AACzD,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAmC7B,MAAM,gBAAwC;AAAA,EAC5C,SAAS;AAAA,EACT,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,QAAQ;AACV;AAEA,MAAM,mBAA2C;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AACT;AAEe,SAAR,oBAAqC;AAC1C,QAAM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BAAC,SAAI,WAAU,4CAA4C,cAAI,WAAU,GAC3E;AAAA,OACF;AAAA,IAGF,qBAAC,QACC;AAAA,0BAAC,cACC,8BAAC,aAAW,YAAE,4BAA4B,GAAE,GAC9C;AAAA,MACA,oBAAC,eACE,0BACC,oBAAC,SAAI,WAAU,4BAA2B,8BAAC,WAAQ,GAAE,IACnD,KAAK,WAAW,IAClB,oBAAC,OAAE,WAAU,iCAAiC,YAAE,8BAA8B,GAAE,IAEhF,oBAAC,SAAI,WAAU,qBACb,+BAAC,WAAM,WAAU,kBACf;AAAA,4BAAC,WACC,+BAAC,QAAG,WAAU,wBACZ;AAAA,8BAAC,QAAG,WAAU,mCAAmC,YAAE,iCAAiC,GAAE;AAAA,UACtF,oBAAC,QAAG,WAAU,mCAAmC,YAAE,kCAAkC,GAAE;AAAA,UACvF,oBAAC,QAAG,WAAU,mCAAmC,YAAE,oCAAoC,GAAE;AAAA,WAC3F,GACF;AAAA,QACA,oBAAC,WACE,eAAK,IAAI,CAAC,QACT,qBAAC,QAAgB,WAAU,0BACzB;AAAA,8BAAC,QAAG,WAAU,qDACX,cAAI,KAAK,IAAI,SAAS,EAAE,eAAe,GAC1C;AAAA,UACA,oBAAC,QAAG,WAAU,aACZ,8BAAC,SAAM,SAAQ,aAAY,WAAW,iBAAiB,IAAI,KAAK,KAAK,IAClE,cAAI,OACP,GACF;AAAA,UACA,oBAAC,QAAG,WAAU,aAAa,cAAI,SAAQ;AAAA,aAThC,IAAI,EAUb,CACD,GACH;AAAA,SACF,GACF,GAEJ;AAAA,OACF;AAAA,KACF,GACF;AAEJ;",
|
|
6
|
+
"names": ["params"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const metadata = {
|
|
2
|
+
requireAuth: true,
|
|
3
|
+
requireFeatures: ["data_sync.view"],
|
|
4
|
+
pageTitle: "Sync Run Detail",
|
|
5
|
+
pageTitleKey: "data_sync.runs.detail.title",
|
|
6
|
+
navHidden: true,
|
|
7
|
+
breadcrumb: [
|
|
8
|
+
{ label: "Data Sync", labelKey: "data_sync.nav.title", href: "/backend/data-sync" }
|
|
9
|
+
]
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
metadata
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=page.meta.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/modules/data_sync/backend/data-sync/runs/%5Bid%5D/page.meta.ts"],
|
|
4
|
+
"sourcesContent": ["export const metadata = {\n requireAuth: true,\n requireFeatures: ['data_sync.view'],\n pageTitle: 'Sync Run Detail',\n pageTitleKey: 'data_sync.runs.detail.title',\n navHidden: true,\n breadcrumb: [\n { label: 'Data Sync', labelKey: 'data_sync.nav.title', href: '/backend/data-sync' },\n ],\n}\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,iBAAiB,CAAC,gBAAgB;AAAA,EAClC,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,IACV,EAAE,OAAO,aAAa,UAAU,uBAAuB,MAAM,qBAAqB;AAAA,EACpF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
import { Entity, Index, OptionalProps, PrimaryKey, Property } from "@mikro-orm/core";
|
|
12
|
+
OptionalProps;
|
|
13
|
+
let SyncRun = class {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.createdCount = 0;
|
|
16
|
+
this.updatedCount = 0;
|
|
17
|
+
this.skippedCount = 0;
|
|
18
|
+
this.failedCount = 0;
|
|
19
|
+
this.batchesCompleted = 0;
|
|
20
|
+
this.createdAt = /* @__PURE__ */ new Date();
|
|
21
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
__decorateClass([
|
|
25
|
+
PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
|
|
26
|
+
], SyncRun.prototype, "id", 2);
|
|
27
|
+
__decorateClass([
|
|
28
|
+
Property({ name: "integration_id", type: "text" })
|
|
29
|
+
], SyncRun.prototype, "integrationId", 2);
|
|
30
|
+
__decorateClass([
|
|
31
|
+
Property({ name: "entity_type", type: "text" })
|
|
32
|
+
], SyncRun.prototype, "entityType", 2);
|
|
33
|
+
__decorateClass([
|
|
34
|
+
Property({ name: "direction", type: "text" })
|
|
35
|
+
], SyncRun.prototype, "direction", 2);
|
|
36
|
+
__decorateClass([
|
|
37
|
+
Property({ name: "status", type: "text" })
|
|
38
|
+
], SyncRun.prototype, "status", 2);
|
|
39
|
+
__decorateClass([
|
|
40
|
+
Property({ name: "cursor", type: "text", nullable: true })
|
|
41
|
+
], SyncRun.prototype, "cursor", 2);
|
|
42
|
+
__decorateClass([
|
|
43
|
+
Property({ name: "initial_cursor", type: "text", nullable: true })
|
|
44
|
+
], SyncRun.prototype, "initialCursor", 2);
|
|
45
|
+
__decorateClass([
|
|
46
|
+
Property({ name: "created_count", type: "int", default: 0 })
|
|
47
|
+
], SyncRun.prototype, "createdCount", 2);
|
|
48
|
+
__decorateClass([
|
|
49
|
+
Property({ name: "updated_count", type: "int", default: 0 })
|
|
50
|
+
], SyncRun.prototype, "updatedCount", 2);
|
|
51
|
+
__decorateClass([
|
|
52
|
+
Property({ name: "skipped_count", type: "int", default: 0 })
|
|
53
|
+
], SyncRun.prototype, "skippedCount", 2);
|
|
54
|
+
__decorateClass([
|
|
55
|
+
Property({ name: "failed_count", type: "int", default: 0 })
|
|
56
|
+
], SyncRun.prototype, "failedCount", 2);
|
|
57
|
+
__decorateClass([
|
|
58
|
+
Property({ name: "batches_completed", type: "int", default: 0 })
|
|
59
|
+
], SyncRun.prototype, "batchesCompleted", 2);
|
|
60
|
+
__decorateClass([
|
|
61
|
+
Property({ name: "last_error", type: "text", nullable: true })
|
|
62
|
+
], SyncRun.prototype, "lastError", 2);
|
|
63
|
+
__decorateClass([
|
|
64
|
+
Property({ name: "progress_job_id", type: "uuid", nullable: true })
|
|
65
|
+
], SyncRun.prototype, "progressJobId", 2);
|
|
66
|
+
__decorateClass([
|
|
67
|
+
Property({ name: "job_id", type: "text", nullable: true })
|
|
68
|
+
], SyncRun.prototype, "jobId", 2);
|
|
69
|
+
__decorateClass([
|
|
70
|
+
Property({ name: "triggered_by", type: "text", nullable: true })
|
|
71
|
+
], SyncRun.prototype, "triggeredBy", 2);
|
|
72
|
+
__decorateClass([
|
|
73
|
+
Property({ name: "organization_id", type: "uuid" })
|
|
74
|
+
], SyncRun.prototype, "organizationId", 2);
|
|
75
|
+
__decorateClass([
|
|
76
|
+
Property({ name: "tenant_id", type: "uuid" })
|
|
77
|
+
], SyncRun.prototype, "tenantId", 2);
|
|
78
|
+
__decorateClass([
|
|
79
|
+
Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
|
|
80
|
+
], SyncRun.prototype, "createdAt", 2);
|
|
81
|
+
__decorateClass([
|
|
82
|
+
Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
|
|
83
|
+
], SyncRun.prototype, "updatedAt", 2);
|
|
84
|
+
__decorateClass([
|
|
85
|
+
Property({ name: "deleted_at", type: Date, nullable: true })
|
|
86
|
+
], SyncRun.prototype, "deletedAt", 2);
|
|
87
|
+
SyncRun = __decorateClass([
|
|
88
|
+
Entity({ tableName: "sync_runs" }),
|
|
89
|
+
Index({ properties: ["integrationId", "entityType", "status", "organizationId", "tenantId"] })
|
|
90
|
+
], SyncRun);
|
|
91
|
+
OptionalProps;
|
|
92
|
+
let SyncCursor = class {
|
|
93
|
+
constructor() {
|
|
94
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
__decorateClass([
|
|
98
|
+
PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
|
|
99
|
+
], SyncCursor.prototype, "id", 2);
|
|
100
|
+
__decorateClass([
|
|
101
|
+
Property({ name: "integration_id", type: "text" })
|
|
102
|
+
], SyncCursor.prototype, "integrationId", 2);
|
|
103
|
+
__decorateClass([
|
|
104
|
+
Property({ name: "entity_type", type: "text" })
|
|
105
|
+
], SyncCursor.prototype, "entityType", 2);
|
|
106
|
+
__decorateClass([
|
|
107
|
+
Property({ name: "direction", type: "text" })
|
|
108
|
+
], SyncCursor.prototype, "direction", 2);
|
|
109
|
+
__decorateClass([
|
|
110
|
+
Property({ name: "cursor", type: "text", nullable: true })
|
|
111
|
+
], SyncCursor.prototype, "cursor", 2);
|
|
112
|
+
__decorateClass([
|
|
113
|
+
Property({ name: "organization_id", type: "uuid" })
|
|
114
|
+
], SyncCursor.prototype, "organizationId", 2);
|
|
115
|
+
__decorateClass([
|
|
116
|
+
Property({ name: "tenant_id", type: "uuid" })
|
|
117
|
+
], SyncCursor.prototype, "tenantId", 2);
|
|
118
|
+
__decorateClass([
|
|
119
|
+
Property({ name: "updated_at", type: Date, onCreate: () => /* @__PURE__ */ new Date(), onUpdate: () => /* @__PURE__ */ new Date() })
|
|
120
|
+
], SyncCursor.prototype, "updatedAt", 2);
|
|
121
|
+
SyncCursor = __decorateClass([
|
|
122
|
+
Entity({ tableName: "sync_cursors" }),
|
|
123
|
+
Index({ properties: ["integrationId", "entityType", "direction", "organizationId", "tenantId"], options: { unique: true } })
|
|
124
|
+
], SyncCursor);
|
|
125
|
+
OptionalProps;
|
|
126
|
+
let SyncMapping = class {
|
|
127
|
+
constructor() {
|
|
128
|
+
this.createdAt = /* @__PURE__ */ new Date();
|
|
129
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
__decorateClass([
|
|
133
|
+
PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
|
|
134
|
+
], SyncMapping.prototype, "id", 2);
|
|
135
|
+
__decorateClass([
|
|
136
|
+
Property({ name: "integration_id", type: "text" })
|
|
137
|
+
], SyncMapping.prototype, "integrationId", 2);
|
|
138
|
+
__decorateClass([
|
|
139
|
+
Property({ name: "entity_type", type: "text" })
|
|
140
|
+
], SyncMapping.prototype, "entityType", 2);
|
|
141
|
+
__decorateClass([
|
|
142
|
+
Property({ name: "mapping", type: "json" })
|
|
143
|
+
], SyncMapping.prototype, "mapping", 2);
|
|
144
|
+
__decorateClass([
|
|
145
|
+
Property({ name: "organization_id", type: "uuid" })
|
|
146
|
+
], SyncMapping.prototype, "organizationId", 2);
|
|
147
|
+
__decorateClass([
|
|
148
|
+
Property({ name: "tenant_id", type: "uuid" })
|
|
149
|
+
], SyncMapping.prototype, "tenantId", 2);
|
|
150
|
+
__decorateClass([
|
|
151
|
+
Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
|
|
152
|
+
], SyncMapping.prototype, "createdAt", 2);
|
|
153
|
+
__decorateClass([
|
|
154
|
+
Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
|
|
155
|
+
], SyncMapping.prototype, "updatedAt", 2);
|
|
156
|
+
SyncMapping = __decorateClass([
|
|
157
|
+
Entity({ tableName: "sync_mappings" }),
|
|
158
|
+
Index({ properties: ["integrationId", "entityType", "organizationId", "tenantId"], options: { unique: true } })
|
|
159
|
+
], SyncMapping);
|
|
160
|
+
OptionalProps;
|
|
161
|
+
let SyncSchedule = class {
|
|
162
|
+
constructor() {
|
|
163
|
+
this.timezone = "UTC";
|
|
164
|
+
this.fullSync = false;
|
|
165
|
+
this.isEnabled = true;
|
|
166
|
+
this.createdAt = /* @__PURE__ */ new Date();
|
|
167
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
__decorateClass([
|
|
171
|
+
PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
|
|
172
|
+
], SyncSchedule.prototype, "id", 2);
|
|
173
|
+
__decorateClass([
|
|
174
|
+
Property({ name: "integration_id", type: "text" })
|
|
175
|
+
], SyncSchedule.prototype, "integrationId", 2);
|
|
176
|
+
__decorateClass([
|
|
177
|
+
Property({ name: "entity_type", type: "text" })
|
|
178
|
+
], SyncSchedule.prototype, "entityType", 2);
|
|
179
|
+
__decorateClass([
|
|
180
|
+
Property({ name: "direction", type: "text" })
|
|
181
|
+
], SyncSchedule.prototype, "direction", 2);
|
|
182
|
+
__decorateClass([
|
|
183
|
+
Property({ name: "schedule_type", type: "text" })
|
|
184
|
+
], SyncSchedule.prototype, "scheduleType", 2);
|
|
185
|
+
__decorateClass([
|
|
186
|
+
Property({ name: "schedule_value", type: "text" })
|
|
187
|
+
], SyncSchedule.prototype, "scheduleValue", 2);
|
|
188
|
+
__decorateClass([
|
|
189
|
+
Property({ name: "timezone", type: "text", default: "UTC" })
|
|
190
|
+
], SyncSchedule.prototype, "timezone", 2);
|
|
191
|
+
__decorateClass([
|
|
192
|
+
Property({ name: "full_sync", type: "boolean", default: false })
|
|
193
|
+
], SyncSchedule.prototype, "fullSync", 2);
|
|
194
|
+
__decorateClass([
|
|
195
|
+
Property({ name: "is_enabled", type: "boolean", default: true })
|
|
196
|
+
], SyncSchedule.prototype, "isEnabled", 2);
|
|
197
|
+
__decorateClass([
|
|
198
|
+
Property({ name: "scheduled_job_id", type: "uuid", nullable: true })
|
|
199
|
+
], SyncSchedule.prototype, "scheduledJobId", 2);
|
|
200
|
+
__decorateClass([
|
|
201
|
+
Property({ name: "last_run_at", type: Date, nullable: true })
|
|
202
|
+
], SyncSchedule.prototype, "lastRunAt", 2);
|
|
203
|
+
__decorateClass([
|
|
204
|
+
Property({ name: "organization_id", type: "uuid" })
|
|
205
|
+
], SyncSchedule.prototype, "organizationId", 2);
|
|
206
|
+
__decorateClass([
|
|
207
|
+
Property({ name: "tenant_id", type: "uuid" })
|
|
208
|
+
], SyncSchedule.prototype, "tenantId", 2);
|
|
209
|
+
__decorateClass([
|
|
210
|
+
Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
|
|
211
|
+
], SyncSchedule.prototype, "createdAt", 2);
|
|
212
|
+
__decorateClass([
|
|
213
|
+
Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
|
|
214
|
+
], SyncSchedule.prototype, "updatedAt", 2);
|
|
215
|
+
__decorateClass([
|
|
216
|
+
Property({ name: "deleted_at", type: Date, nullable: true })
|
|
217
|
+
], SyncSchedule.prototype, "deletedAt", 2);
|
|
218
|
+
SyncSchedule = __decorateClass([
|
|
219
|
+
Entity({ tableName: "sync_schedules" }),
|
|
220
|
+
Index({ properties: ["integrationId", "entityType", "direction", "organizationId", "tenantId"] })
|
|
221
|
+
], SyncSchedule);
|
|
222
|
+
export {
|
|
223
|
+
SyncCursor,
|
|
224
|
+
SyncMapping,
|
|
225
|
+
SyncRun,
|
|
226
|
+
SyncSchedule
|
|
227
|
+
};
|
|
228
|
+
//# sourceMappingURL=entities.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/data_sync/data/entities.ts"],
|
|
4
|
+
"sourcesContent": ["import { Entity, Index, OptionalProps, PrimaryKey, Property } from '@mikro-orm/core'\n\n@Entity({ tableName: 'sync_runs' })\n@Index({ properties: ['integrationId', 'entityType', 'status', 'organizationId', 'tenantId'] })\nexport class SyncRun {\n [OptionalProps]?: 'status' | 'cursor' | 'initialCursor' | 'createdCount' | 'updatedCount' | 'skippedCount' | 'failedCount' | 'batchesCompleted' | 'lastError' | 'progressJobId' | 'jobId' | 'triggeredBy' | 'createdAt' | 'updatedAt' | 'deletedAt'\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'integration_id', type: 'text' })\n integrationId!: string\n\n @Property({ name: 'entity_type', type: 'text' })\n entityType!: string\n\n @Property({ name: 'direction', type: 'text' })\n direction!: 'import' | 'export'\n\n @Property({ name: 'status', type: 'text' })\n status!: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled' | 'paused'\n\n @Property({ name: 'cursor', type: 'text', nullable: true })\n cursor?: string | null\n\n @Property({ name: 'initial_cursor', type: 'text', nullable: true })\n initialCursor?: string | null\n\n @Property({ name: 'created_count', type: 'int', default: 0 })\n createdCount: number = 0\n\n @Property({ name: 'updated_count', type: 'int', default: 0 })\n updatedCount: number = 0\n\n @Property({ name: 'skipped_count', type: 'int', default: 0 })\n skippedCount: number = 0\n\n @Property({ name: 'failed_count', type: 'int', default: 0 })\n failedCount: number = 0\n\n @Property({ name: 'batches_completed', type: 'int', default: 0 })\n batchesCompleted: number = 0\n\n @Property({ name: 'last_error', type: 'text', nullable: true })\n lastError?: string | null\n\n @Property({ name: 'progress_job_id', type: 'uuid', nullable: true })\n progressJobId?: string | null\n\n @Property({ name: 'job_id', type: 'text', nullable: true })\n jobId?: string | null\n\n @Property({ name: 'triggered_by', type: 'text', nullable: true })\n triggeredBy?: string | null\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ name: 'created_at', type: Date, onCreate: () => new Date() })\n createdAt: Date = new Date()\n\n @Property({ name: 'updated_at', type: Date, onUpdate: () => new Date() })\n updatedAt: Date = new Date()\n\n @Property({ name: 'deleted_at', type: Date, nullable: true })\n deletedAt?: Date | null\n}\n\n@Entity({ tableName: 'sync_cursors' })\n@Index({ properties: ['integrationId', 'entityType', 'direction', 'organizationId', 'tenantId'], options: { unique: true } })\nexport class SyncCursor {\n [OptionalProps]?: 'cursor' | 'updatedAt'\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'integration_id', type: 'text' })\n integrationId!: string\n\n @Property({ name: 'entity_type', type: 'text' })\n entityType!: string\n\n @Property({ name: 'direction', type: 'text' })\n direction!: 'import' | 'export'\n\n @Property({ name: 'cursor', type: 'text', nullable: true })\n cursor?: string | null\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ name: 'updated_at', type: Date, onCreate: () => new Date(), onUpdate: () => new Date() })\n updatedAt: Date = new Date()\n}\n\n@Entity({ tableName: 'sync_mappings' })\n@Index({ properties: ['integrationId', 'entityType', 'organizationId', 'tenantId'], options: { unique: true } })\nexport class SyncMapping {\n [OptionalProps]?: 'createdAt' | 'updatedAt'\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'integration_id', type: 'text' })\n integrationId!: string\n\n @Property({ name: 'entity_type', type: 'text' })\n entityType!: string\n\n @Property({ name: 'mapping', type: 'json' })\n mapping!: Record<string, unknown>\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ name: 'created_at', type: Date, onCreate: () => new Date() })\n createdAt: Date = new Date()\n\n @Property({ name: 'updated_at', type: Date, onUpdate: () => new Date() })\n updatedAt: Date = new Date()\n}\n\n@Entity({ tableName: 'sync_schedules' })\n@Index({ properties: ['integrationId', 'entityType', 'direction', 'organizationId', 'tenantId'] })\nexport class SyncSchedule {\n [OptionalProps]?: 'timezone' | 'fullSync' | 'isEnabled' | 'scheduledJobId' | 'lastRunAt' | 'createdAt' | 'updatedAt' | 'deletedAt'\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'integration_id', type: 'text' })\n integrationId!: string\n\n @Property({ name: 'entity_type', type: 'text' })\n entityType!: string\n\n @Property({ name: 'direction', type: 'text' })\n direction!: 'import' | 'export'\n\n @Property({ name: 'schedule_type', type: 'text' })\n scheduleType!: 'cron' | 'interval'\n\n @Property({ name: 'schedule_value', type: 'text' })\n scheduleValue!: string\n\n @Property({ name: 'timezone', type: 'text', default: 'UTC' })\n timezone: string = 'UTC'\n\n @Property({ name: 'full_sync', type: 'boolean', default: false })\n fullSync: boolean = false\n\n @Property({ name: 'is_enabled', type: 'boolean', default: true })\n isEnabled: boolean = true\n\n @Property({ name: 'scheduled_job_id', type: 'uuid', nullable: true })\n scheduledJobId?: string | null\n\n @Property({ name: 'last_run_at', type: Date, nullable: true })\n lastRunAt?: Date | null\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ name: 'created_at', type: Date, onCreate: () => new Date() })\n createdAt: Date = new Date()\n\n @Property({ name: 'updated_at', type: Date, onUpdate: () => new Date() })\n updatedAt: Date = new Date()\n\n @Property({ name: 'deleted_at', type: Date, nullable: true })\n deletedAt?: Date | null\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;AAAA,SAAS,QAAQ,OAAO,eAAe,YAAY,gBAAgB;AAKhE;AADI,IAAM,UAAN,MAAc;AAAA,EAAd;AAwBL,wBAAuB;AAGvB,wBAAuB;AAGvB,wBAAuB;AAGvB,uBAAsB;AAGtB,4BAA2B;AAqB3B,qBAAkB,oBAAI,KAAK;AAG3B,qBAAkB,oBAAI,KAAK;AAAA;AAI7B;AA7DE;AAAA,EADC,WAAW,EAAE,MAAM,QAAQ,YAAY,oBAAoB,CAAC;AAAA,GAFlD,QAGX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,k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BzD,aA8BX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,eAAe,MAAM,MAAM,UAAU,KAAK,CAAC;AAAA,GAhClD,aAiCX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,mBAAmB,MAAM,OAAO,CAAC;AAAA,GAnCxC,aAoCX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,aAAa,MAAM,OAAO,CAAC;AAAA,GAtClC,aAuCX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,cAAc,MAAM,MAAM,UAAU,MAAM,oBAAI,KAAK,EAAE,CAAC;AAAA,GAzC7D,aA0CX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,cAAc,MAAM,MAAM,UAAU,MAAM,oBAAI,KAAK,EAAE,CAAC;AAAA,GA5C7D,aA6CX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,cAAc,MAAM,MAAM,UAAU,KAAK,CAAC;AAAA,GA/CjD,aAgDX;AAhDW,eAAN;AAAA,EAFN,OAAO,EAAE,WAAW,iBAAiB,CAAC;AAAA,EACtC,MAAM,EAAE,YAAY,CAAC,iBAAiB,cAAc,aAAa,kBAAkB,UAAU,EAAE,CAAC;AAAA,GACpF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const runSyncSchema = z.object({
|
|
3
|
+
integrationId: z.string().min(1),
|
|
4
|
+
entityType: z.string().min(1),
|
|
5
|
+
direction: z.enum(["import", "export"]),
|
|
6
|
+
fullSync: z.boolean().default(false),
|
|
7
|
+
batchSize: z.number().int().min(1).max(1e3).default(100),
|
|
8
|
+
triggeredBy: z.string().optional()
|
|
9
|
+
});
|
|
10
|
+
const retrySyncSchema = z.object({
|
|
11
|
+
fromBeginning: z.boolean().default(false)
|
|
12
|
+
});
|
|
13
|
+
const validateConnectionSchema = z.object({
|
|
14
|
+
integrationId: z.string().min(1),
|
|
15
|
+
entityType: z.string().min(1),
|
|
16
|
+
direction: z.enum(["import", "export"])
|
|
17
|
+
});
|
|
18
|
+
const listSyncRunsQuerySchema = z.object({
|
|
19
|
+
integrationId: z.string().optional(),
|
|
20
|
+
entityType: z.string().optional(),
|
|
21
|
+
direction: z.enum(["import", "export"]).optional(),
|
|
22
|
+
status: z.enum(["pending", "running", "completed", "failed", "cancelled", "paused"]).optional(),
|
|
23
|
+
page: z.coerce.number().int().min(1).default(1),
|
|
24
|
+
pageSize: z.coerce.number().int().min(1).max(100).default(20)
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
listSyncRunsQuerySchema,
|
|
28
|
+
retrySyncSchema,
|
|
29
|
+
runSyncSchema,
|
|
30
|
+
validateConnectionSchema
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/data_sync/data/validators.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\n\nexport const runSyncSchema = z.object({\n integrationId: z.string().min(1),\n entityType: z.string().min(1),\n direction: z.enum(['import', 'export']),\n fullSync: z.boolean().default(false),\n batchSize: z.number().int().min(1).max(1000).default(100),\n triggeredBy: z.string().optional(),\n})\n\nexport type RunSyncInput = z.infer<typeof runSyncSchema>\n\nexport const retrySyncSchema = z.object({\n fromBeginning: z.boolean().default(false),\n})\n\nexport type RetrySyncInput = z.infer<typeof retrySyncSchema>\n\nexport const validateConnectionSchema = z.object({\n integrationId: z.string().min(1),\n entityType: z.string().min(1),\n direction: z.enum(['import', 'export']),\n})\n\nexport const listSyncRunsQuerySchema = z.object({\n integrationId: z.string().optional(),\n entityType: z.string().optional(),\n direction: z.enum(['import', 'export']).optional(),\n status: z.enum(['pending', 'running', 'completed', 'failed', 'cancelled', 'paused']).optional(),\n page: z.coerce.number().int().min(1).default(1),\n pageSize: z.coerce.number().int().min(1).max(100).default(20),\n})\n\nexport type ListSyncRunsQu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,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { asFunction, asValue } from "awilix";
|
|
2
|
+
import { SyncCursor, SyncMapping, SyncRun, SyncSchedule } from "./data/entities.js";
|
|
3
|
+
import { createExternalIdMappingService } from "./lib/id-mapping.js";
|
|
4
|
+
import { createSyncRunService } from "./lib/sync-run-service.js";
|
|
5
|
+
import { createSyncEngine } from "./lib/sync-engine.js";
|
|
6
|
+
function register(container) {
|
|
7
|
+
container.register({
|
|
8
|
+
externalIdMappingService: asFunction(({ em }) => createExternalIdMappingService(em)).scoped().proxy(),
|
|
9
|
+
dataSyncRunService: asFunction(({ em }) => createSyncRunService(em)).scoped().proxy(),
|
|
10
|
+
dataSyncEngine: asFunction(({ em, dataSyncRunService, integrationCredentialsService, integrationLogService, progressService }) => createSyncEngine({
|
|
11
|
+
em,
|
|
12
|
+
syncRunService: dataSyncRunService,
|
|
13
|
+
integrationCredentialsService,
|
|
14
|
+
integrationLogService,
|
|
15
|
+
progressService
|
|
16
|
+
})).scoped().proxy(),
|
|
17
|
+
SyncRun: asValue(SyncRun),
|
|
18
|
+
SyncCursor: asValue(SyncCursor),
|
|
19
|
+
SyncMapping: asValue(SyncMapping),
|
|
20
|
+
SyncSchedule: asValue(SyncSchedule)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
register
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=di.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/modules/data_sync/di.ts"],
|
|
4
|
+
"sourcesContent": ["import { asFunction, asValue } from 'awilix'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport type { AppContainer } from '@open-mercato/shared/lib/di/container'\nimport type { CredentialsService } from '../integrations/lib/credentials-service'\nimport type { IntegrationLogService } from '../integrations/lib/log-service'\nimport type { ProgressService } from '../progress/lib/progressService'\nimport { SyncCursor, SyncMapping, SyncRun, SyncSchedule } from './data/entities'\nimport { createExternalIdMappingService } from './lib/id-mapping'\nimport { createSyncRunService } from './lib/sync-run-service'\nimport { createSyncEngine } from './lib/sync-engine'\n\ntype Cradle = {\n em: EntityManager\n integrationCredentialsService: CredentialsService\n integrationLogService: IntegrationLogService\n progressService: ProgressService\n}\n\nexport function register(container: AppContainer) {\n container.register({\n externalIdMappingService: asFunction(({ em }: Cradle) => createExternalIdMappingService(em)).scoped().proxy(),\n dataSyncRunService: asFunction(({ em }: Cradle) => createSyncRunService(em)).scoped().proxy(),\n dataSyncEngine: asFunction(({ em, dataSyncRunService, integrationCredentialsService, integrationLogService, progressService }: Cradle & {\n dataSyncRunService: ReturnType<typeof createSyncRunService>\n }) => createSyncEngine({\n em,\n syncRunService: dataSyncRunService,\n integrationCredentialsService,\n integrationLogService,\n progressService,\n })).scoped().proxy(),\n\n SyncRun: asValue(SyncRun),\n SyncCursor: asValue(SyncCursor),\n SyncMapping: asValue(SyncMapping),\n SyncSchedule: asValue(SyncSchedule),\n })\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,eAAe;AAMpC,SAAS,YAAY,aAAa,SAAS,oBAAoB;AAC/D,SAAS,sCAAsC;AAC/C,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AAS1B,SAAS,SAAS,WAAyB;AAChD,YAAU,SAAS;AAAA,IACjB,0BAA0B,WAAW,CAAC,EAAE,GAAG,MAAc,+BAA+B,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM;AAAA,IAC5G,oBAAoB,WAAW,CAAC,EAAE,GAAG,MAAc,qBAAqB,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM;AAAA,IAC5F,gBAAgB,WAAW,CAAC,EAAE,IAAI,oBAAoB,+BAA+B,uBAAuB,gBAAgB,MAEtH,iBAAiB;AAAA,MACrB;AAAA,MACA,gBAAgB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM;AAAA,IAEnB,SAAS,QAAQ,OAAO;AAAA,IACxB,YAAY,QAAQ,UAAU;AAAA,IAC9B,aAAa,QAAQ,WAAW;AAAA,IAChC,cAAc,QAAQ,YAAY;AAAA,EACpC,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createModuleEvents } from "@open-mercato/shared/modules/events";
|
|
2
|
+
const events = [
|
|
3
|
+
{ id: "data_sync.run.started", label: "Sync Run Started", category: "lifecycle", entity: "run" },
|
|
4
|
+
{ id: "data_sync.run.completed", label: "Sync Run Completed", category: "lifecycle", entity: "run" },
|
|
5
|
+
{ id: "data_sync.run.failed", label: "Sync Run Failed", category: "lifecycle", entity: "run" },
|
|
6
|
+
{ id: "data_sync.run.cancelled", label: "Sync Run Cancelled", category: "lifecycle", entity: "run" }
|
|
7
|
+
];
|
|
8
|
+
const eventsConfig = createModuleEvents({ moduleId: "data_sync", events });
|
|
9
|
+
const emitDataSyncEvent = eventsConfig.emit;
|
|
10
|
+
var events_default = eventsConfig;
|
|
11
|
+
export {
|
|
12
|
+
events_default as default,
|
|
13
|
+
emitDataSyncEvent,
|
|
14
|
+
eventsConfig
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/modules/data_sync/events.ts"],
|
|
4
|
+
"sourcesContent": ["import { createModuleEvents } from '@open-mercato/shared/modules/events'\n\nconst events = [\n { id: 'data_sync.run.started', label: 'Sync Run Started', category: 'lifecycle', entity: 'run' },\n { id: 'data_sync.run.completed', label: 'Sync Run Completed', category: 'lifecycle', entity: 'run' },\n { id: 'data_sync.run.failed', label: 'Sync Run Failed', category: 'lifecycle', entity: 'run' },\n { id: 'data_sync.run.cancelled', label: 'Sync Run Cancelled', category: 'lifecycle', entity: 'run' },\n] as const\n\nexport const eventsConfig = createModuleEvents({ moduleId: 'data_sync', events })\nexport const emitDataSyncEvent = eventsConfig.emit\nexport default eventsConfig\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,0BAA0B;AAEnC,MAAM,SAAS;AAAA,EACb,EAAE,IAAI,yBAAyB,OAAO,oBAAoB,UAAU,aAAa,QAAQ,MAAM;AAAA,EAC/F,EAAE,IAAI,2BAA2B,OAAO,sBAAsB,UAAU,aAAa,QAAQ,MAAM;AAAA,EACnG,EAAE,IAAI,wBAAwB,OAAO,mBAAmB,UAAU,aAAa,QAAQ,MAAM;AAAA,EAC7F,EAAE,IAAI,2BAA2B,OAAO,sBAAsB,UAAU,aAAa,QAAQ,MAAM;AACrG;AAEO,MAAM,eAAe,mBAAmB,EAAE,UAAU,aAAa,OAAO,CAAC;AACzE,MAAM,oBAAoB,aAAa;AAC9C,IAAO,iBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|