@open-mercato/sync-shopify 0.0.0-stage → 0.11.1-develop.8910.1.d07a49d70a
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/.turbo/turbo-build.log +2 -0
- package/build.mjs +7 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +7 -0
- package/dist/modules/sync_shopify/__integration__/TC-SS-001.meta.js +7 -0
- package/dist/modules/sync_shopify/__integration__/TC-SS-001.meta.js.map +7 -0
- package/dist/modules/sync_shopify/__integration__/TC-SS-001.spec.js +374 -0
- package/dist/modules/sync_shopify/__integration__/TC-SS-001.spec.js.map +7 -0
- package/dist/modules/sync_shopify/acl.js +20 -0
- package/dist/modules/sync_shopify/acl.js.map +7 -0
- package/dist/modules/sync_shopify/cli.js +77 -0
- package/dist/modules/sync_shopify/cli.js.map +7 -0
- package/dist/modules/sync_shopify/di.js +16 -0
- package/dist/modules/sync_shopify/di.js.map +7 -0
- package/dist/modules/sync_shopify/index.js +12 -0
- package/dist/modules/sync_shopify/index.js.map +7 -0
- package/dist/modules/sync_shopify/integration.js +79 -0
- package/dist/modules/sync_shopify/integration.js.map +7 -0
- package/dist/modules/sync_shopify/lib/adapter.js +150 -0
- package/dist/modules/sync_shopify/lib/adapter.js.map +7 -0
- package/dist/modules/sync_shopify/lib/client.js +659 -0
- package/dist/modules/sync_shopify/lib/client.js.map +7 -0
- package/dist/modules/sync_shopify/lib/fake-api.js +384 -0
- package/dist/modules/sync_shopify/lib/fake-api.js.map +7 -0
- package/dist/modules/sync_shopify/lib/health.js +30 -0
- package/dist/modules/sync_shopify/lib/health.js.map +7 -0
- package/dist/modules/sync_shopify/lib/importer.js +462 -0
- package/dist/modules/sync_shopify/lib/importer.js.map +7 -0
- package/dist/modules/sync_shopify/lib/map.js +336 -0
- package/dist/modules/sync_shopify/lib/map.js.map +7 -0
- package/dist/modules/sync_shopify/lib/preset.js +50 -0
- package/dist/modules/sync_shopify/lib/preset.js.map +7 -0
- package/dist/modules/sync_shopify/lib/types.js +13 -0
- package/dist/modules/sync_shopify/lib/types.js.map +7 -0
- package/dist/modules/sync_shopify/setup.js +43 -0
- package/dist/modules/sync_shopify/setup.js.map +7 -0
- package/jest.config.cjs +34 -0
- package/package.json +65 -3
- package/src/index.ts +1 -0
- package/src/modules/sync_shopify/__integration__/TC-SS-001.meta.ts +3 -0
- package/src/modules/sync_shopify/__integration__/TC-SS-001.spec.ts +445 -0
- package/src/modules/sync_shopify/__tests__/adapter.test.ts +113 -0
- package/src/modules/sync_shopify/__tests__/client.test.ts +354 -0
- package/src/modules/sync_shopify/__tests__/financial-fixtures.test.ts +43 -0
- package/src/modules/sync_shopify/__tests__/importer-payments.test.ts +135 -0
- package/src/modules/sync_shopify/__tests__/map.test.ts +389 -0
- package/src/modules/sync_shopify/__tests__/preset.test.ts +18 -0
- package/src/modules/sync_shopify/__tests__/setup.test.ts +50 -0
- package/src/modules/sync_shopify/acl.ts +16 -0
- package/src/modules/sync_shopify/cli.ts +79 -0
- package/src/modules/sync_shopify/di.ts +14 -0
- package/src/modules/sync_shopify/i18n/de.json +18 -0
- package/src/modules/sync_shopify/i18n/en.json +18 -0
- package/src/modules/sync_shopify/i18n/es.json +18 -0
- package/src/modules/sync_shopify/i18n/ko.json +18 -0
- package/src/modules/sync_shopify/i18n/pl.json +18 -0
- package/src/modules/sync_shopify/index.ts +8 -0
- package/src/modules/sync_shopify/integration.ts +75 -0
- package/src/modules/sync_shopify/lib/adapter.ts +179 -0
- package/src/modules/sync_shopify/lib/client.ts +770 -0
- package/src/modules/sync_shopify/lib/fake-api.ts +426 -0
- package/src/modules/sync_shopify/lib/health.ts +29 -0
- package/src/modules/sync_shopify/lib/importer.ts +527 -0
- package/src/modules/sync_shopify/lib/map.ts +410 -0
- package/src/modules/sync_shopify/lib/preset.ts +75 -0
- package/src/modules/sync_shopify/lib/types.ts +108 -0
- package/src/modules/sync_shopify/setup.ts +46 -0
- package/tsconfig.json +9 -0
- package/README.md +0 -3
package/build.mjs
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/sync_shopify/__integration__/TC-SS-001.meta.ts"],
|
|
4
|
+
"sourcesContent": ["export const integrationMeta = {\n requiredEnvVars: ['OM_SYNC_SHOPIFY_FAKE_API'],\n}\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,kBAAkB;AAAA,EAC7B,iBAAiB,CAAC,0BAA0B;AAC9C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { config as loadEnv } from "dotenv";
|
|
3
|
+
import { Client } from "pg";
|
|
4
|
+
import { expect, test } from "@playwright/test";
|
|
5
|
+
import { apiRequest, getAuthToken } from "@open-mercato/core/helpers/integration/api";
|
|
6
|
+
import { deleteEntityIfExists, readJsonSafe } from "@open-mercato/core/helpers/integration/crmFixtures";
|
|
7
|
+
import { drainIntegrationQueue } from "@open-mercato/core/helpers/integration/queue";
|
|
8
|
+
import {
|
|
9
|
+
FAKE_SHOPIFY_CLIENT_ID,
|
|
10
|
+
FAKE_SHOPIFY_CLIENT_SECRET,
|
|
11
|
+
FAKE_SHOPIFY_SHOP_DOMAIN
|
|
12
|
+
} from "../lib/fake-api.js";
|
|
13
|
+
const BASE_URL = process.env.BASE_URL?.trim() || "http://localhost:3000";
|
|
14
|
+
const TEST_APP_ROOT = process.env.OM_TEST_APP_ROOT?.trim();
|
|
15
|
+
const APP_ROOT = TEST_APP_ROOT ? path.resolve(TEST_APP_ROOT) : path.resolve(process.cwd(), "apps/mercato");
|
|
16
|
+
const APP_QUEUE_BASE_DIR = path.resolve(APP_ROOT, ".mercato/queue");
|
|
17
|
+
const INTEGRATION_ID = "sync_shopify";
|
|
18
|
+
const EVENTS_QUEUE = "events";
|
|
19
|
+
const DATA_SYNC_IMPORT_QUEUE = "data-sync-import";
|
|
20
|
+
if (!TEST_APP_ROOT) {
|
|
21
|
+
loadEnv({ path: path.resolve(APP_ROOT, ".env") });
|
|
22
|
+
process.env.QUEUE_BASE_DIR = APP_QUEUE_BASE_DIR;
|
|
23
|
+
}
|
|
24
|
+
async function readJson(response) {
|
|
25
|
+
return await readJsonSafe(response) ?? {};
|
|
26
|
+
}
|
|
27
|
+
function decodeTokenScope(token) {
|
|
28
|
+
const [, payload] = token.split(".");
|
|
29
|
+
if (!payload) throw new Error("Auth token is missing a JWT payload");
|
|
30
|
+
const claims = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
31
|
+
const tenantId = typeof claims.tenantId === "string" ? claims.tenantId : "";
|
|
32
|
+
const orgId = typeof claims.orgId === "string" ? claims.orgId : "";
|
|
33
|
+
if (!tenantId || !orgId) throw new Error("Auth token is missing tenantId/orgId claims");
|
|
34
|
+
return { tenantId, orgId };
|
|
35
|
+
}
|
|
36
|
+
function scopedHeaders(token) {
|
|
37
|
+
const scope = decodeTokenScope(token);
|
|
38
|
+
return {
|
|
39
|
+
Authorization: `Bearer ${token}`,
|
|
40
|
+
Cookie: `om_selected_tenant=${scope.tenantId}; om_selected_org=${scope.orgId}`
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async function waitForCompletedRun(request, token, runId) {
|
|
44
|
+
const deadline = Date.now() + 18e4;
|
|
45
|
+
let lastRunBody = {};
|
|
46
|
+
while (Date.now() < deadline) {
|
|
47
|
+
const runResponse = await apiRequest(request, "GET", `/api/data_sync/runs/${encodeURIComponent(runId)}`, { token });
|
|
48
|
+
expect(runResponse.status()).toBe(200);
|
|
49
|
+
lastRunBody = await readJson(runResponse);
|
|
50
|
+
const status = String(lastRunBody.status ?? "");
|
|
51
|
+
if (status === "completed") {
|
|
52
|
+
await drainIntegrationQueue(EVENTS_QUEUE, { appRoot: APP_ROOT }).catch(() => 0);
|
|
53
|
+
return lastRunBody;
|
|
54
|
+
}
|
|
55
|
+
if (status === "failed" || status === "cancelled") {
|
|
56
|
+
throw new Error(`Sync run ${runId} finished with ${status}: ${JSON.stringify(lastRunBody)}`);
|
|
57
|
+
}
|
|
58
|
+
if (process.env.AUTO_SPAWN_WORKERS !== "true") {
|
|
59
|
+
await drainIntegrationQueue(DATA_SYNC_IMPORT_QUEUE, { appRoot: APP_ROOT });
|
|
60
|
+
}
|
|
61
|
+
await new Promise((resolve) => setTimeout(resolve, 750));
|
|
62
|
+
}
|
|
63
|
+
throw new Error(`Timed out waiting for sync run ${runId}. Last response: ${JSON.stringify(lastRunBody)}`);
|
|
64
|
+
}
|
|
65
|
+
async function startImport(request, token, entityType) {
|
|
66
|
+
const response = await request.fetch(`${BASE_URL}/api/data_sync/run`, {
|
|
67
|
+
method: "POST",
|
|
68
|
+
headers: {
|
|
69
|
+
...scopedHeaders(token),
|
|
70
|
+
"Content-Type": "application/json"
|
|
71
|
+
},
|
|
72
|
+
data: {
|
|
73
|
+
integrationId: INTEGRATION_ID,
|
|
74
|
+
entityType,
|
|
75
|
+
direction: "import",
|
|
76
|
+
fullSync: true,
|
|
77
|
+
batchSize: 25
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const body = await readJson(response);
|
|
81
|
+
expect(response.status(), JSON.stringify(body)).toBe(201);
|
|
82
|
+
const runId = String(body.id ?? body.runId ?? "");
|
|
83
|
+
expect(runId).toMatch(/^[0-9a-f-]{36}$/i);
|
|
84
|
+
return runId;
|
|
85
|
+
}
|
|
86
|
+
let sharedDbClient = null;
|
|
87
|
+
async function getDbClient() {
|
|
88
|
+
if (sharedDbClient) return sharedDbClient;
|
|
89
|
+
const connectionString = process.env.DATABASE_URL;
|
|
90
|
+
if (!connectionString) throw new Error("DATABASE_URL is required for TC-SS-001 mapping lookups");
|
|
91
|
+
const client = new Client({ connectionString });
|
|
92
|
+
await client.connect();
|
|
93
|
+
sharedDbClient = client;
|
|
94
|
+
return client;
|
|
95
|
+
}
|
|
96
|
+
async function closeDbClient() {
|
|
97
|
+
const client = sharedDbClient;
|
|
98
|
+
sharedDbClient = null;
|
|
99
|
+
if (client) await client.end();
|
|
100
|
+
}
|
|
101
|
+
async function findMappedLocalId(entityType, externalId, scope) {
|
|
102
|
+
const client = await getDbClient();
|
|
103
|
+
const result = await client.query(
|
|
104
|
+
`
|
|
105
|
+
select internal_entity_id
|
|
106
|
+
from sync_external_id_mappings
|
|
107
|
+
where integration_id = $1
|
|
108
|
+
and internal_entity_type = $2
|
|
109
|
+
and external_id = $3
|
|
110
|
+
and organization_id = $4
|
|
111
|
+
and tenant_id = $5
|
|
112
|
+
and deleted_at is null
|
|
113
|
+
order by updated_at desc
|
|
114
|
+
limit 1
|
|
115
|
+
`,
|
|
116
|
+
[INTEGRATION_ID, entityType, externalId, scope.orgId, scope.tenantId]
|
|
117
|
+
);
|
|
118
|
+
return result.rows[0]?.internal_entity_id ?? null;
|
|
119
|
+
}
|
|
120
|
+
async function softDeleteScopedMappings(scope) {
|
|
121
|
+
const client = await getDbClient();
|
|
122
|
+
await client.query(
|
|
123
|
+
`
|
|
124
|
+
update sync_external_id_mappings
|
|
125
|
+
set deleted_at = now(), updated_at = now()
|
|
126
|
+
where integration_id = $1
|
|
127
|
+
and organization_id = $2
|
|
128
|
+
and tenant_id = $3
|
|
129
|
+
and deleted_at is null
|
|
130
|
+
`,
|
|
131
|
+
[INTEGRATION_ID, scope.orgId, scope.tenantId]
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
async function fetchListItem(request, token, collectionPath, id) {
|
|
135
|
+
const response = await apiRequest(
|
|
136
|
+
request,
|
|
137
|
+
"GET",
|
|
138
|
+
`${collectionPath}?id=${encodeURIComponent(id)}&pageSize=1`,
|
|
139
|
+
{ token }
|
|
140
|
+
);
|
|
141
|
+
expect(response.status(), `GET ${collectionPath}?id= should be 200`).toBe(200);
|
|
142
|
+
const body = await readJson(response);
|
|
143
|
+
const items = Array.isArray(body.items) ? body.items : [];
|
|
144
|
+
return items[0] ?? null;
|
|
145
|
+
}
|
|
146
|
+
test.describe("TC-SS-001: Shopify import via fake Admin API", () => {
|
|
147
|
+
test("credentials, health, import, idempotency, and tenant scoping", async ({ request }) => {
|
|
148
|
+
test.setTimeout(3e5);
|
|
149
|
+
const token = await getAuthToken(request, "admin");
|
|
150
|
+
const previousCredentialsResponse = await apiRequest(
|
|
151
|
+
request,
|
|
152
|
+
"GET",
|
|
153
|
+
`/api/integrations/${INTEGRATION_ID}/credentials`,
|
|
154
|
+
{ token }
|
|
155
|
+
);
|
|
156
|
+
expect(previousCredentialsResponse.status()).toBe(200);
|
|
157
|
+
const previousCredentialsBody = await readJson(previousCredentialsResponse);
|
|
158
|
+
const previousCredentials = previousCredentialsBody.credentials && typeof previousCredentialsBody.credentials === "object" ? previousCredentialsBody.credentials : {};
|
|
159
|
+
const detailBefore = await apiRequest(request, "GET", `/api/integrations/${INTEGRATION_ID}`, { token });
|
|
160
|
+
expect(detailBefore.status()).toBe(200);
|
|
161
|
+
const detailBeforeBody = await readJson(detailBefore);
|
|
162
|
+
const baselineState = detailBeforeBody.state && typeof detailBeforeBody.state === "object" ? detailBeforeBody.state : {};
|
|
163
|
+
const scope = decodeTokenScope(token);
|
|
164
|
+
const createdProductIds = [];
|
|
165
|
+
const createdPersonIds = [];
|
|
166
|
+
const createdOrderIds = [];
|
|
167
|
+
const runIds = [];
|
|
168
|
+
try {
|
|
169
|
+
const staleProductId = await findMappedLocalId("catalog_product", "gid://shopify/Product/9001", scope);
|
|
170
|
+
const stalePersonId = await findMappedLocalId("customer_person", "gid://shopify/Customer/9001", scope);
|
|
171
|
+
const staleOrderIds = [
|
|
172
|
+
await findMappedLocalId("sales_order", "gid://shopify/Order/9001", scope),
|
|
173
|
+
await findMappedLocalId("sales_order", "gid://shopify/Order/9002", scope),
|
|
174
|
+
await findMappedLocalId("sales_order", "gid://shopify/Order/9003", scope),
|
|
175
|
+
await findMappedLocalId("sales_order", "gid://shopify/Order/9004", scope),
|
|
176
|
+
await findMappedLocalId("sales_order", "gid://shopify/Order/9005", scope),
|
|
177
|
+
await findMappedLocalId("sales_order", "gid://shopify/Order/9006", scope),
|
|
178
|
+
await findMappedLocalId("sales_order", "gid://shopify/Order/9007", scope),
|
|
179
|
+
await findMappedLocalId("sales_order", "gid://shopify/Order/9008", scope)
|
|
180
|
+
];
|
|
181
|
+
for (const orderId2 of staleOrderIds) {
|
|
182
|
+
if (orderId2) await deleteEntityIfExists(request, token, "/api/sales/orders", orderId2);
|
|
183
|
+
}
|
|
184
|
+
if (stalePersonId) await deleteEntityIfExists(request, token, "/api/customers/people", stalePersonId);
|
|
185
|
+
if (staleProductId) await deleteEntityIfExists(request, token, "/api/catalog/products", staleProductId);
|
|
186
|
+
await softDeleteScopedMappings(scope);
|
|
187
|
+
const saveCredentials = await apiRequest(request, "PUT", `/api/integrations/${INTEGRATION_ID}/credentials`, {
|
|
188
|
+
token,
|
|
189
|
+
data: {
|
|
190
|
+
credentials: {
|
|
191
|
+
shopDomain: FAKE_SHOPIFY_SHOP_DOMAIN,
|
|
192
|
+
clientId: FAKE_SHOPIFY_CLIENT_ID,
|
|
193
|
+
clientSecret: FAKE_SHOPIFY_CLIENT_SECRET,
|
|
194
|
+
apiVersion: "2026-07"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
expect(saveCredentials.status()).toBe(200);
|
|
199
|
+
const enable = await apiRequest(request, "PUT", `/api/integrations/${INTEGRATION_ID}/state`, {
|
|
200
|
+
token,
|
|
201
|
+
data: { isEnabled: true, reauthRequired: false }
|
|
202
|
+
});
|
|
203
|
+
expect(enable.status()).toBe(200);
|
|
204
|
+
const health = await apiRequest(request, "POST", `/api/integrations/${INTEGRATION_ID}/health`, { token });
|
|
205
|
+
expect(health.status()).toBe(200);
|
|
206
|
+
const healthBody = await readJson(health);
|
|
207
|
+
expect(healthBody.status === "healthy" || healthBody.lastHealthStatus === "healthy" || String(healthBody.message ?? "").includes("QA Shopify")).toBe(true);
|
|
208
|
+
const uiPage = await request.get(`${BASE_URL}/backend/integrations/${INTEGRATION_ID}`, {
|
|
209
|
+
headers: scopedHeaders(token)
|
|
210
|
+
});
|
|
211
|
+
expect(uiPage.status()).toBeLessThan(500);
|
|
212
|
+
for (const entityType of ["products", "customers", "orders"]) {
|
|
213
|
+
const runId = await startImport(request, token, entityType);
|
|
214
|
+
runIds.push(runId);
|
|
215
|
+
const summary = await waitForCompletedRun(request, token, runId);
|
|
216
|
+
expect(Number(summary.failedCount ?? 0)).toBe(0);
|
|
217
|
+
expect(Number(summary.createdCount ?? 0) + Number(summary.updatedCount ?? 0) + Number(summary.skippedCount ?? 0)).toBeGreaterThan(0);
|
|
218
|
+
}
|
|
219
|
+
const productId = await findMappedLocalId("catalog_product", "gid://shopify/Product/9001", scope);
|
|
220
|
+
expect(productId).toMatch(/^[0-9a-f-]{36}$/i);
|
|
221
|
+
createdProductIds.push(productId);
|
|
222
|
+
const productDetailBody = await fetchListItem(request, token, "/api/catalog/products", productId);
|
|
223
|
+
expect(productDetailBody).not.toBeNull();
|
|
224
|
+
expect(String(productDetailBody?.title ?? "")).toContain("QA Shopify Import Product");
|
|
225
|
+
const variantListResponse = await apiRequest(
|
|
226
|
+
request,
|
|
227
|
+
"GET",
|
|
228
|
+
`/api/catalog/variants?productId=${encodeURIComponent(productId)}&pageSize=100`,
|
|
229
|
+
{ token }
|
|
230
|
+
);
|
|
231
|
+
expect(variantListResponse.status()).toBe(200);
|
|
232
|
+
const variantListBody = await readJson(variantListResponse);
|
|
233
|
+
const variantItems = Array.isArray(variantListBody.items) ? variantListBody.items : [];
|
|
234
|
+
expect(variantItems.length).toBeGreaterThanOrEqual(100);
|
|
235
|
+
const personId = await findMappedLocalId("customer_person", "gid://shopify/Customer/9001", scope);
|
|
236
|
+
expect(personId).toMatch(/^[0-9a-f-]{36}$/i);
|
|
237
|
+
createdPersonIds.push(personId);
|
|
238
|
+
const personDetail = await apiRequest(
|
|
239
|
+
request,
|
|
240
|
+
"GET",
|
|
241
|
+
`/api/customers/people/${encodeURIComponent(personId)}`,
|
|
242
|
+
{ token }
|
|
243
|
+
);
|
|
244
|
+
expect(personDetail.status()).toBe(200);
|
|
245
|
+
const personBody = await readJson(personDetail);
|
|
246
|
+
const personEmail = String(
|
|
247
|
+
personBody.primaryEmail ?? personBody.person?.primaryEmail ?? ""
|
|
248
|
+
);
|
|
249
|
+
expect(personEmail).toBe("ada.qa.sync-shopify@example.com");
|
|
250
|
+
const orderId = await findMappedLocalId("sales_order", "gid://shopify/Order/9001", scope);
|
|
251
|
+
expect(orderId).toMatch(/^[0-9a-f-]{36}$/i);
|
|
252
|
+
createdOrderIds.push(orderId);
|
|
253
|
+
const order = await fetchListItem(request, token, "/api/sales/orders", orderId);
|
|
254
|
+
expect(order).not.toBeNull();
|
|
255
|
+
const lineCount = Number(
|
|
256
|
+
order?.lineItemCount ?? (Array.isArray(order?.lines) ? order.lines.length : 0)
|
|
257
|
+
);
|
|
258
|
+
expect(lineCount).toBeGreaterThanOrEqual(50);
|
|
259
|
+
expect(Number(order?.grandTotalGrossAmount ?? 0)).toBeGreaterThan(0);
|
|
260
|
+
const discountedOrderId = await findMappedLocalId("sales_order", "gid://shopify/Order/9002", scope);
|
|
261
|
+
expect(discountedOrderId).toMatch(/^[0-9a-f-]{36}$/i);
|
|
262
|
+
createdOrderIds.push(discountedOrderId);
|
|
263
|
+
const discountedOrder = await fetchListItem(request, token, "/api/sales/orders", discountedOrderId);
|
|
264
|
+
expect(discountedOrder).not.toBeNull();
|
|
265
|
+
expect(Number(discountedOrder?.grandTotalGrossAmount ?? 0)).toBeCloseTo(88, 1);
|
|
266
|
+
expect(Number(discountedOrder?.discountTotalAmount ?? 0)).toBeGreaterThan(0);
|
|
267
|
+
expect(Number(discountedOrder?.shippingGrossAmount ?? discountedOrder?.shippingNetAmount ?? 0)).toBeCloseTo(8, 1);
|
|
268
|
+
expect(Number(discountedOrder?.outstandingAmount ?? discountedOrder?.grandTotalGrossAmount ?? 0)).toBeCloseTo(0, 1);
|
|
269
|
+
const taxInclusiveOrderId = await findMappedLocalId("sales_order", "gid://shopify/Order/9003", scope);
|
|
270
|
+
expect(taxInclusiveOrderId).toMatch(/^[0-9a-f-]{36}$/i);
|
|
271
|
+
createdOrderIds.push(taxInclusiveOrderId);
|
|
272
|
+
const taxInclusiveOrder = await fetchListItem(request, token, "/api/sales/orders", taxInclusiveOrderId);
|
|
273
|
+
expect(taxInclusiveOrder).not.toBeNull();
|
|
274
|
+
expect(Number(taxInclusiveOrder?.grandTotalGrossAmount ?? 0)).toBeCloseTo(123, 1);
|
|
275
|
+
expect(Number(taxInclusiveOrder?.taxTotalAmount ?? 0)).toBeCloseTo(23, 1);
|
|
276
|
+
expect(Number(taxInclusiveOrder?.grandTotalNetAmount ?? taxInclusiveOrder?.subtotalNetAmount ?? 0)).toBeCloseTo(100, 1);
|
|
277
|
+
const taxedShippingOrderId = await findMappedLocalId("sales_order", "gid://shopify/Order/9004", scope);
|
|
278
|
+
expect(taxedShippingOrderId).toMatch(/^[0-9a-f-]{36}$/i);
|
|
279
|
+
createdOrderIds.push(taxedShippingOrderId);
|
|
280
|
+
const taxedShippingOrder = await fetchListItem(request, token, "/api/sales/orders", taxedShippingOrderId);
|
|
281
|
+
expect(taxedShippingOrder).not.toBeNull();
|
|
282
|
+
expect(Number(taxedShippingOrder?.grandTotalGrossAmount ?? 0)).toBeCloseTo(118.8, 1);
|
|
283
|
+
expect(Number(taxedShippingOrder?.taxTotalAmount ?? 0)).toBeCloseTo(8.8, 1);
|
|
284
|
+
for (const fixture of [
|
|
285
|
+
{ id: "9005", net: 90, tax: 20.7, gross: 110.7, outstanding: 0 },
|
|
286
|
+
{ id: "9006", net: 100, tax: 23, gross: 123, outstanding: 83 },
|
|
287
|
+
{ id: "9007", net: 50, tax: 11.5, gross: 61.5, outstanding: 0 },
|
|
288
|
+
{ id: "9008", net: 0, tax: 0, gross: 0, outstanding: 0 }
|
|
289
|
+
]) {
|
|
290
|
+
const financialOrderId = await findMappedLocalId("sales_order", `gid://shopify/Order/${fixture.id}`, scope);
|
|
291
|
+
expect(financialOrderId).toMatch(/^[0-9a-f-]{36}$/i);
|
|
292
|
+
createdOrderIds.push(financialOrderId);
|
|
293
|
+
const financialOrder = await fetchListItem(request, token, "/api/sales/orders", financialOrderId);
|
|
294
|
+
expect(financialOrder).not.toBeNull();
|
|
295
|
+
expect(Number(financialOrder?.grandTotalNetAmount ?? financialOrder?.subtotalNetAmount)).toBeCloseTo(fixture.net, 2);
|
|
296
|
+
expect(Number(financialOrder?.taxTotalAmount)).toBeCloseTo(fixture.tax, 2);
|
|
297
|
+
expect(Number(financialOrder?.grandTotalGrossAmount)).toBeCloseTo(fixture.gross, 2);
|
|
298
|
+
expect(Number(financialOrder?.outstandingAmount)).toBeCloseTo(fixture.outstanding, 2);
|
|
299
|
+
}
|
|
300
|
+
await deleteEntityIfExists(request, token, "/api/sales/orders", discountedOrderId);
|
|
301
|
+
await deleteEntityIfExists(request, token, "/api/customers/people", personId);
|
|
302
|
+
const recreateCustomersRunId = await startImport(request, token, "customers");
|
|
303
|
+
runIds.push(recreateCustomersRunId);
|
|
304
|
+
const recreateCustomersSummary = await waitForCompletedRun(request, token, recreateCustomersRunId);
|
|
305
|
+
expect(Number(recreateCustomersSummary.failedCount ?? 0)).toBe(0);
|
|
306
|
+
expect(Number(recreateCustomersSummary.createdCount ?? 0)).toBeGreaterThanOrEqual(1);
|
|
307
|
+
const recreatedPersonId = await findMappedLocalId("customer_person", "gid://shopify/Customer/9001", scope);
|
|
308
|
+
expect(recreatedPersonId).toMatch(/^[0-9a-f-]{36}$/i);
|
|
309
|
+
expect(recreatedPersonId).not.toBe(personId);
|
|
310
|
+
createdPersonIds.push(recreatedPersonId);
|
|
311
|
+
const recreateOrdersRunId = await startImport(request, token, "orders");
|
|
312
|
+
runIds.push(recreateOrdersRunId);
|
|
313
|
+
const recreateOrdersSummary = await waitForCompletedRun(request, token, recreateOrdersRunId);
|
|
314
|
+
expect(Number(recreateOrdersSummary.failedCount ?? 0)).toBe(0);
|
|
315
|
+
expect(Number(recreateOrdersSummary.createdCount ?? 0)).toBeGreaterThanOrEqual(1);
|
|
316
|
+
const recreatedDiscountedId = await findMappedLocalId("sales_order", "gid://shopify/Order/9002", scope);
|
|
317
|
+
expect(recreatedDiscountedId).toMatch(/^[0-9a-f-]{36}$/i);
|
|
318
|
+
expect(recreatedDiscountedId).not.toBe(discountedOrderId);
|
|
319
|
+
createdOrderIds.push(recreatedDiscountedId);
|
|
320
|
+
const secondOrdersRunId = await startImport(request, token, "orders");
|
|
321
|
+
runIds.push(secondOrdersRunId);
|
|
322
|
+
const secondSummary = await waitForCompletedRun(request, token, secondOrdersRunId);
|
|
323
|
+
expect(Number(secondSummary.createdCount ?? 0)).toBe(0);
|
|
324
|
+
expect(
|
|
325
|
+
Number(secondSummary.skippedCount ?? 0) + Number(secondSummary.updatedCount ?? 0)
|
|
326
|
+
).toBeGreaterThanOrEqual(4);
|
|
327
|
+
expect(Number(secondSummary.failedCount ?? 0)).toBe(0);
|
|
328
|
+
const linkedOrder = await fetchListItem(request, token, "/api/sales/orders", orderId);
|
|
329
|
+
expect(String(linkedOrder?.customerEntityId ?? "")).toBe(recreatedPersonId);
|
|
330
|
+
const employeeToken = await getAuthToken(request, "employee");
|
|
331
|
+
const employeeProducts = await apiRequest(
|
|
332
|
+
request,
|
|
333
|
+
"GET",
|
|
334
|
+
`/api/catalog/products?id=${encodeURIComponent(productId)}&pageSize=1`,
|
|
335
|
+
{ token: employeeToken }
|
|
336
|
+
);
|
|
337
|
+
expect([200, 403, 404]).toContain(employeeProducts.status());
|
|
338
|
+
if (employeeProducts.status() === 200) {
|
|
339
|
+
const employeeBody = await readJson(employeeProducts);
|
|
340
|
+
const employeeItems = Array.isArray(employeeBody.items) ? employeeBody.items : [];
|
|
341
|
+
const employeeItem = employeeItems[0] ?? {};
|
|
342
|
+
const employeeOrg = String(employeeItem.organizationId ?? "");
|
|
343
|
+
expect(employeeOrg === "" || employeeOrg === scope.orgId).toBe(true);
|
|
344
|
+
}
|
|
345
|
+
} finally {
|
|
346
|
+
for (const runId of runIds) {
|
|
347
|
+
await apiRequest(request, "POST", `/api/data_sync/runs/${encodeURIComponent(runId)}/cancel`, { token }).catch(() => void 0);
|
|
348
|
+
}
|
|
349
|
+
for (const orderId of createdOrderIds) {
|
|
350
|
+
await deleteEntityIfExists(request, token, "/api/sales/orders", orderId);
|
|
351
|
+
}
|
|
352
|
+
for (const personId of createdPersonIds) {
|
|
353
|
+
await deleteEntityIfExists(request, token, "/api/customers/people", personId);
|
|
354
|
+
}
|
|
355
|
+
for (const productId of createdProductIds) {
|
|
356
|
+
await deleteEntityIfExists(request, token, "/api/catalog/products", productId);
|
|
357
|
+
}
|
|
358
|
+
await softDeleteScopedMappings(scope).catch(() => void 0);
|
|
359
|
+
await apiRequest(request, "PUT", `/api/integrations/${INTEGRATION_ID}/credentials`, {
|
|
360
|
+
token,
|
|
361
|
+
data: { credentials: previousCredentials }
|
|
362
|
+
}).catch(() => void 0);
|
|
363
|
+
await apiRequest(request, "PUT", `/api/integrations/${INTEGRATION_ID}/state`, {
|
|
364
|
+
token,
|
|
365
|
+
data: {
|
|
366
|
+
isEnabled: typeof baselineState.isEnabled === "boolean" ? baselineState.isEnabled : true,
|
|
367
|
+
reauthRequired: typeof baselineState.reauthRequired === "boolean" ? baselineState.reauthRequired : false
|
|
368
|
+
}
|
|
369
|
+
}).catch(() => void 0);
|
|
370
|
+
await closeDbClient();
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
//# sourceMappingURL=TC-SS-001.spec.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/sync_shopify/__integration__/TC-SS-001.spec.ts"],
|
|
4
|
+
"sourcesContent": ["import path from 'node:path'\nimport { config as loadEnv } from 'dotenv'\nimport { Client } from 'pg'\nimport { expect, test, type APIRequestContext, type APIResponse } from '@playwright/test'\nimport { apiRequest, getAuthToken } from '@open-mercato/core/helpers/integration/api'\nimport { deleteEntityIfExists, readJsonSafe } from '@open-mercato/core/helpers/integration/crmFixtures'\nimport { drainIntegrationQueue } from '@open-mercato/core/helpers/integration/queue'\nimport {\n FAKE_SHOPIFY_CLIENT_ID,\n FAKE_SHOPIFY_CLIENT_SECRET,\n FAKE_SHOPIFY_SHOP_DOMAIN,\n} from '../lib/fake-api'\n\ntype JsonRecord = Record<string, unknown>\n\nconst BASE_URL = process.env.BASE_URL?.trim() || 'http://localhost:3000'\nconst TEST_APP_ROOT = process.env.OM_TEST_APP_ROOT?.trim()\nconst APP_ROOT = TEST_APP_ROOT\n ? path.resolve(TEST_APP_ROOT)\n : path.resolve(process.cwd(), 'apps/mercato')\nconst APP_QUEUE_BASE_DIR = path.resolve(APP_ROOT, '.mercato/queue')\nconst INTEGRATION_ID = 'sync_shopify'\nconst EVENTS_QUEUE = 'events'\nconst DATA_SYNC_IMPORT_QUEUE = 'data-sync-import'\n\nif (!TEST_APP_ROOT) {\n loadEnv({ path: path.resolve(APP_ROOT, '.env') })\n process.env.QUEUE_BASE_DIR = APP_QUEUE_BASE_DIR\n}\n\nasync function readJson(response: APIResponse): Promise<JsonRecord> {\n return ((await readJsonSafe<JsonRecord>(response)) ?? {}) as JsonRecord\n}\n\nfunction decodeTokenScope(token: string): { tenantId: string; orgId: string } {\n const [, payload] = token.split('.')\n if (!payload) throw new Error('Auth token is missing a JWT payload')\n const claims = JSON.parse(Buffer.from(payload, 'base64url').toString('utf8')) as JsonRecord\n const tenantId = typeof claims.tenantId === 'string' ? claims.tenantId : ''\n const orgId = typeof claims.orgId === 'string' ? claims.orgId : ''\n if (!tenantId || !orgId) throw new Error('Auth token is missing tenantId/orgId claims')\n return { tenantId, orgId }\n}\n\nfunction scopedHeaders(token: string): Record<string, string> {\n const scope = decodeTokenScope(token)\n return {\n Authorization: `Bearer ${token}`,\n Cookie: `om_selected_tenant=${scope.tenantId}; om_selected_org=${scope.orgId}`,\n }\n}\n\nasync function waitForCompletedRun(\n request: APIRequestContext,\n token: string,\n runId: string,\n): Promise<JsonRecord> {\n const deadline = Date.now() + 180_000\n let lastRunBody: JsonRecord = {}\n while (Date.now() < deadline) {\n const runResponse = await apiRequest(request, 'GET', `/api/data_sync/runs/${encodeURIComponent(runId)}`, { token })\n expect(runResponse.status()).toBe(200)\n lastRunBody = await readJson(runResponse)\n const status = String(lastRunBody.status ?? '')\n if (status === 'completed') {\n await drainIntegrationQueue(EVENTS_QUEUE, { appRoot: APP_ROOT }).catch(() => 0)\n return lastRunBody\n }\n if (status === 'failed' || status === 'cancelled') {\n throw new Error(`Sync run ${runId} finished with ${status}: ${JSON.stringify(lastRunBody)}`)\n }\n if (process.env.AUTO_SPAWN_WORKERS !== 'true') {\n await drainIntegrationQueue(DATA_SYNC_IMPORT_QUEUE, { appRoot: APP_ROOT })\n }\n await new Promise((resolve) => setTimeout(resolve, 750))\n }\n throw new Error(`Timed out waiting for sync run ${runId}. Last response: ${JSON.stringify(lastRunBody)}`)\n}\n\nasync function startImport(\n request: APIRequestContext,\n token: string,\n entityType: string,\n): Promise<string> {\n const response = await request.fetch(`${BASE_URL}/api/data_sync/run`, {\n method: 'POST',\n headers: {\n ...scopedHeaders(token),\n 'Content-Type': 'application/json',\n },\n data: {\n integrationId: INTEGRATION_ID,\n entityType,\n direction: 'import',\n fullSync: true,\n batchSize: 25,\n },\n })\n const body = await readJson(response)\n expect(response.status(), JSON.stringify(body)).toBe(201)\n const runId = String(body.id ?? body.runId ?? '')\n expect(runId).toMatch(/^[0-9a-f-]{36}$/i)\n return runId\n}\n\nlet sharedDbClient: Client | null = null\n\nasync function getDbClient(): Promise<Client> {\n if (sharedDbClient) return sharedDbClient\n const connectionString = process.env.DATABASE_URL\n if (!connectionString) throw new Error('DATABASE_URL is required for TC-SS-001 mapping lookups')\n const client = new Client({ connectionString })\n await client.connect()\n sharedDbClient = client\n return client\n}\n\nasync function closeDbClient(): Promise<void> {\n const client = sharedDbClient\n sharedDbClient = null\n if (client) await client.end()\n}\n\nasync function findMappedLocalId(\n entityType: string,\n externalId: string,\n scope: { tenantId: string; orgId: string },\n): Promise<string | null> {\n const client = await getDbClient()\n const result = await client.query<{ internal_entity_id: string }>(\n `\n select internal_entity_id\n from sync_external_id_mappings\n where integration_id = $1\n and internal_entity_type = $2\n and external_id = $3\n and organization_id = $4\n and tenant_id = $5\n and deleted_at is null\n order by updated_at desc\n limit 1\n `,\n [INTEGRATION_ID, entityType, externalId, scope.orgId, scope.tenantId],\n )\n return result.rows[0]?.internal_entity_id ?? null\n}\n\nasync function softDeleteScopedMappings(scope: { tenantId: string; orgId: string }): Promise<void> {\n const client = await getDbClient()\n await client.query(\n `\n update sync_external_id_mappings\n set deleted_at = now(), updated_at = now()\n where integration_id = $1\n and organization_id = $2\n and tenant_id = $3\n and deleted_at is null\n `,\n [INTEGRATION_ID, scope.orgId, scope.tenantId],\n )\n}\n\nasync function fetchListItem(\n request: APIRequestContext,\n token: string,\n collectionPath: string,\n id: string,\n): Promise<JsonRecord | null> {\n const response = await apiRequest(\n request,\n 'GET',\n `${collectionPath}?id=${encodeURIComponent(id)}&pageSize=1`,\n { token },\n )\n expect(response.status(), `GET ${collectionPath}?id= should be 200`).toBe(200)\n const body = await readJson(response)\n const items = Array.isArray(body.items) ? body.items as JsonRecord[] : []\n return items[0] ?? null\n}\n\ntest.describe('TC-SS-001: Shopify import via fake Admin API', () => {\n test('credentials, health, import, idempotency, and tenant scoping', async ({ request }) => {\n test.setTimeout(300_000)\n const token = await getAuthToken(request, 'admin')\n const previousCredentialsResponse = await apiRequest(\n request,\n 'GET',\n `/api/integrations/${INTEGRATION_ID}/credentials`,\n { token },\n )\n expect(previousCredentialsResponse.status()).toBe(200)\n const previousCredentialsBody = await readJson(previousCredentialsResponse)\n const previousCredentials =\n previousCredentialsBody.credentials && typeof previousCredentialsBody.credentials === 'object'\n ? previousCredentialsBody.credentials as JsonRecord\n : {}\n\n const detailBefore = await apiRequest(request, 'GET', `/api/integrations/${INTEGRATION_ID}`, { token })\n expect(detailBefore.status()).toBe(200)\n const detailBeforeBody = await readJson(detailBefore)\n const baselineState = detailBeforeBody.state && typeof detailBeforeBody.state === 'object'\n ? detailBeforeBody.state as JsonRecord\n : {}\n\n const scope = decodeTokenScope(token)\n const createdProductIds: string[] = []\n const createdPersonIds: string[] = []\n const createdOrderIds: string[] = []\n const runIds: string[] = []\n\n try {\n // Prior runs may leave mappings that point at soft-deleted rows; clear them\n // so this import creates fresh entities instead of updating ghosts.\n const staleProductId = await findMappedLocalId('catalog_product', 'gid://shopify/Product/9001', scope)\n const stalePersonId = await findMappedLocalId('customer_person', 'gid://shopify/Customer/9001', scope)\n const staleOrderIds = [\n await findMappedLocalId('sales_order', 'gid://shopify/Order/9001', scope),\n await findMappedLocalId('sales_order', 'gid://shopify/Order/9002', scope),\n await findMappedLocalId('sales_order', 'gid://shopify/Order/9003', scope),\n await findMappedLocalId('sales_order', 'gid://shopify/Order/9004', scope),\n await findMappedLocalId('sales_order', 'gid://shopify/Order/9005', scope),\n await findMappedLocalId('sales_order', 'gid://shopify/Order/9006', scope),\n await findMappedLocalId('sales_order', 'gid://shopify/Order/9007', scope),\n await findMappedLocalId('sales_order', 'gid://shopify/Order/9008', scope),\n ]\n for (const orderId of staleOrderIds) {\n if (orderId) await deleteEntityIfExists(request, token, '/api/sales/orders', orderId)\n }\n if (stalePersonId) await deleteEntityIfExists(request, token, '/api/customers/people', stalePersonId)\n if (staleProductId) await deleteEntityIfExists(request, token, '/api/catalog/products', staleProductId)\n await softDeleteScopedMappings(scope)\n\n const saveCredentials = await apiRequest(request, 'PUT', `/api/integrations/${INTEGRATION_ID}/credentials`, {\n token,\n data: {\n credentials: {\n shopDomain: FAKE_SHOPIFY_SHOP_DOMAIN,\n clientId: FAKE_SHOPIFY_CLIENT_ID,\n clientSecret: FAKE_SHOPIFY_CLIENT_SECRET,\n apiVersion: '2026-07',\n },\n },\n })\n expect(saveCredentials.status()).toBe(200)\n\n const enable = await apiRequest(request, 'PUT', `/api/integrations/${INTEGRATION_ID}/state`, {\n token,\n data: { isEnabled: true, reauthRequired: false },\n })\n expect(enable.status()).toBe(200)\n\n const health = await apiRequest(request, 'POST', `/api/integrations/${INTEGRATION_ID}/health`, { token })\n expect(health.status()).toBe(200)\n const healthBody = await readJson(health)\n expect(healthBody.status === 'healthy' || healthBody.lastHealthStatus === 'healthy' || String(healthBody.message ?? '').includes('QA Shopify')).toBe(true)\n\n const uiPage = await request.get(`${BASE_URL}/backend/integrations/${INTEGRATION_ID}`, {\n headers: scopedHeaders(token),\n })\n expect(uiPage.status()).toBeLessThan(500)\n\n for (const entityType of ['products', 'customers', 'orders'] as const) {\n const runId = await startImport(request, token, entityType)\n runIds.push(runId)\n const summary = await waitForCompletedRun(request, token, runId)\n expect(Number(summary.failedCount ?? 0)).toBe(0)\n expect(Number(summary.createdCount ?? 0) + Number(summary.updatedCount ?? 0) + Number(summary.skippedCount ?? 0)).toBeGreaterThan(0)\n }\n\n const productId = await findMappedLocalId('catalog_product', 'gid://shopify/Product/9001', scope)\n expect(productId).toMatch(/^[0-9a-f-]{36}$/i)\n createdProductIds.push(productId!)\n\n const productDetailBody = await fetchListItem(request, token, '/api/catalog/products', productId!)\n expect(productDetailBody).not.toBeNull()\n expect(String(productDetailBody?.title ?? '')).toContain('QA Shopify Import Product')\n\n const variantListResponse = await apiRequest(\n request,\n 'GET',\n `/api/catalog/variants?productId=${encodeURIComponent(productId!)}&pageSize=100`,\n { token },\n )\n expect(variantListResponse.status()).toBe(200)\n const variantListBody = await readJson(variantListResponse)\n const variantItems = Array.isArray(variantListBody.items) ? variantListBody.items as JsonRecord[] : []\n expect(variantItems.length).toBeGreaterThanOrEqual(100)\n\n const personId = await findMappedLocalId('customer_person', 'gid://shopify/Customer/9001', scope)\n expect(personId).toMatch(/^[0-9a-f-]{36}$/i)\n createdPersonIds.push(personId!)\n const personDetail = await apiRequest(\n request,\n 'GET',\n `/api/customers/people/${encodeURIComponent(personId!)}`,\n { token },\n )\n expect(personDetail.status()).toBe(200)\n const personBody = await readJson(personDetail)\n const personEmail = String(\n personBody.primaryEmail\n ?? (personBody.person as JsonRecord | undefined)?.primaryEmail\n ?? '',\n )\n expect(personEmail).toBe('ada.qa.sync-shopify@example.com')\n\n const orderId = await findMappedLocalId('sales_order', 'gid://shopify/Order/9001', scope)\n expect(orderId).toMatch(/^[0-9a-f-]{36}$/i)\n createdOrderIds.push(orderId!)\n\n const order = await fetchListItem(request, token, '/api/sales/orders', orderId!)\n expect(order).not.toBeNull()\n const lineCount = Number(\n order?.lineItemCount\n ?? (Array.isArray(order?.lines) ? (order.lines as unknown[]).length : 0),\n )\n expect(lineCount).toBeGreaterThanOrEqual(50)\n expect(Number(order?.grandTotalGrossAmount ?? 0)).toBeGreaterThan(0)\n\n const discountedOrderId = await findMappedLocalId('sales_order', 'gid://shopify/Order/9002', scope)\n expect(discountedOrderId).toMatch(/^[0-9a-f-]{36}$/i)\n createdOrderIds.push(discountedOrderId!)\n const discountedOrder = await fetchListItem(request, token, '/api/sales/orders', discountedOrderId!)\n expect(discountedOrder).not.toBeNull()\n expect(Number(discountedOrder?.grandTotalGrossAmount ?? 0)).toBeCloseTo(88, 1)\n expect(Number(discountedOrder?.discountTotalAmount ?? 0)).toBeGreaterThan(0)\n expect(Number(discountedOrder?.shippingGrossAmount ?? discountedOrder?.shippingNetAmount ?? 0)).toBeCloseTo(8, 1)\n // PAID Shopify orders should not show the full total as outstanding (#7399).\n expect(Number(discountedOrder?.outstandingAmount ?? discountedOrder?.grandTotalGrossAmount ?? 0)).toBeCloseTo(0, 1)\n\n const taxInclusiveOrderId = await findMappedLocalId('sales_order', 'gid://shopify/Order/9003', scope)\n expect(taxInclusiveOrderId).toMatch(/^[0-9a-f-]{36}$/i)\n createdOrderIds.push(taxInclusiveOrderId!)\n const taxInclusiveOrder = await fetchListItem(request, token, '/api/sales/orders', taxInclusiveOrderId!)\n expect(taxInclusiveOrder).not.toBeNull()\n expect(Number(taxInclusiveOrder?.grandTotalGrossAmount ?? 0)).toBeCloseTo(123, 1)\n expect(Number(taxInclusiveOrder?.taxTotalAmount ?? 0)).toBeCloseTo(23, 1)\n expect(Number(taxInclusiveOrder?.grandTotalNetAmount ?? taxInclusiveOrder?.subtotalNetAmount ?? 0)).toBeCloseTo(100, 1)\n\n const taxedShippingOrderId = await findMappedLocalId('sales_order', 'gid://shopify/Order/9004', scope)\n expect(taxedShippingOrderId).toMatch(/^[0-9a-f-]{36}$/i)\n createdOrderIds.push(taxedShippingOrderId!)\n const taxedShippingOrder = await fetchListItem(request, token, '/api/sales/orders', taxedShippingOrderId!)\n expect(taxedShippingOrder).not.toBeNull()\n expect(Number(taxedShippingOrder?.grandTotalGrossAmount ?? 0)).toBeCloseTo(118.8, 1)\n expect(Number(taxedShippingOrder?.taxTotalAmount ?? 0)).toBeCloseTo(8.8, 1)\n\n for (const fixture of [\n { id: '9005', net: 90, tax: 20.7, gross: 110.7, outstanding: 0 },\n { id: '9006', net: 100, tax: 23, gross: 123, outstanding: 83 },\n { id: '9007', net: 50, tax: 11.5, gross: 61.5, outstanding: 0 },\n { id: '9008', net: 0, tax: 0, gross: 0, outstanding: 0 },\n ]) {\n const financialOrderId = await findMappedLocalId('sales_order', `gid://shopify/Order/${fixture.id}`, scope)\n expect(financialOrderId).toMatch(/^[0-9a-f-]{36}$/i)\n createdOrderIds.push(financialOrderId!)\n const financialOrder = await fetchListItem(request, token, '/api/sales/orders', financialOrderId!)\n expect(financialOrder).not.toBeNull()\n expect(Number(financialOrder?.grandTotalNetAmount ?? financialOrder?.subtotalNetAmount)).toBeCloseTo(fixture.net, 2)\n expect(Number(financialOrder?.taxTotalAmount)).toBeCloseTo(fixture.tax, 2)\n expect(Number(financialOrder?.grandTotalGrossAmount)).toBeCloseTo(fixture.gross, 2)\n expect(Number(financialOrder?.outstandingAmount)).toBeCloseTo(fixture.outstanding, 2)\n }\n\n // Delete person + one order, then re-import \u2014 must recreate instead of fail/skip (#7397).\n await deleteEntityIfExists(request, token, '/api/sales/orders', discountedOrderId!)\n await deleteEntityIfExists(request, token, '/api/customers/people', personId!)\n const recreateCustomersRunId = await startImport(request, token, 'customers')\n runIds.push(recreateCustomersRunId)\n const recreateCustomersSummary = await waitForCompletedRun(request, token, recreateCustomersRunId)\n expect(Number(recreateCustomersSummary.failedCount ?? 0)).toBe(0)\n expect(Number(recreateCustomersSummary.createdCount ?? 0)).toBeGreaterThanOrEqual(1)\n const recreatedPersonId = await findMappedLocalId('customer_person', 'gid://shopify/Customer/9001', scope)\n expect(recreatedPersonId).toMatch(/^[0-9a-f-]{36}$/i)\n expect(recreatedPersonId).not.toBe(personId)\n createdPersonIds.push(recreatedPersonId!)\n\n const recreateOrdersRunId = await startImport(request, token, 'orders')\n runIds.push(recreateOrdersRunId)\n const recreateOrdersSummary = await waitForCompletedRun(request, token, recreateOrdersRunId)\n expect(Number(recreateOrdersSummary.failedCount ?? 0)).toBe(0)\n expect(Number(recreateOrdersSummary.createdCount ?? 0)).toBeGreaterThanOrEqual(1)\n const recreatedDiscountedId = await findMappedLocalId('sales_order', 'gid://shopify/Order/9002', scope)\n expect(recreatedDiscountedId).toMatch(/^[0-9a-f-]{36}$/i)\n expect(recreatedDiscountedId).not.toBe(discountedOrderId)\n createdOrderIds.push(recreatedDiscountedId!)\n\n // Re-run should backfill customer on surviving orders that were imported without one (#7398),\n // and skip intact mappings.\n const secondOrdersRunId = await startImport(request, token, 'orders')\n runIds.push(secondOrdersRunId)\n const secondSummary = await waitForCompletedRun(request, token, secondOrdersRunId)\n expect(Number(secondSummary.createdCount ?? 0)).toBe(0)\n expect(\n Number(secondSummary.skippedCount ?? 0) + Number(secondSummary.updatedCount ?? 0),\n ).toBeGreaterThanOrEqual(4)\n expect(Number(secondSummary.failedCount ?? 0)).toBe(0)\n\n const linkedOrder = await fetchListItem(request, token, '/api/sales/orders', orderId!)\n expect(String(linkedOrder?.customerEntityId ?? '')).toBe(recreatedPersonId!)\n\n const employeeToken = await getAuthToken(request, 'employee')\n const employeeProducts = await apiRequest(\n request,\n 'GET',\n `/api/catalog/products?id=${encodeURIComponent(productId!)}&pageSize=1`,\n { token: employeeToken },\n )\n expect([200, 403, 404]).toContain(employeeProducts.status())\n if (employeeProducts.status() === 200) {\n const employeeBody = await readJson(employeeProducts)\n const employeeItems = Array.isArray(employeeBody.items) ? employeeBody.items as JsonRecord[] : []\n const employeeItem = employeeItems[0] ?? {}\n const employeeOrg = String(employeeItem.organizationId ?? '')\n expect(employeeOrg === '' || employeeOrg === scope.orgId).toBe(true)\n }\n } finally {\n for (const runId of runIds) {\n await apiRequest(request, 'POST', `/api/data_sync/runs/${encodeURIComponent(runId)}/cancel`, { token }).catch(() => undefined)\n }\n for (const orderId of createdOrderIds) {\n await deleteEntityIfExists(request, token, '/api/sales/orders', orderId)\n }\n for (const personId of createdPersonIds) {\n await deleteEntityIfExists(request, token, '/api/customers/people', personId)\n }\n for (const productId of createdProductIds) {\n await deleteEntityIfExists(request, token, '/api/catalog/products', productId)\n }\n await softDeleteScopedMappings(scope).catch(() => undefined)\n await apiRequest(request, 'PUT', `/api/integrations/${INTEGRATION_ID}/credentials`, {\n token,\n data: { credentials: previousCredentials },\n }).catch(() => undefined)\n await apiRequest(request, 'PUT', `/api/integrations/${INTEGRATION_ID}/state`, {\n token,\n data: {\n isEnabled: typeof baselineState.isEnabled === 'boolean' ? baselineState.isEnabled : true,\n reauthRequired: typeof baselineState.reauthRequired === 'boolean' ? baselineState.reauthRequired : false,\n },\n }).catch(() => undefined)\n await closeDbClient()\n }\n })\n})\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AACjB,SAAS,UAAU,eAAe;AAClC,SAAS,cAAc;AACvB,SAAS,QAAQ,YAAsD;AACvE,SAAS,YAAY,oBAAoB;AACzC,SAAS,sBAAsB,oBAAoB;AACnD,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,MAAM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
|
+
module: "sync_shopify",
|
|
6
|
+
dependsOn: ["data_sync.view"]
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
id: "sync_shopify.configure",
|
|
10
|
+
title: "Configure Shopify sync",
|
|
11
|
+
module: "sync_shopify",
|
|
12
|
+
dependsOn: ["sync_shopify.view", "data_sync.configure"]
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
var acl_default = features;
|
|
16
|
+
export {
|
|
17
|
+
acl_default as default,
|
|
18
|
+
features
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=acl.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/modules/sync_shopify/acl.ts"],
|
|
4
|
+
"sourcesContent": ["export const features = [\n {\n id: 'sync_shopify.view',\n title: 'View Shopify sync',\n module: 'sync_shopify',\n dependsOn: ['data_sync.view'],\n },\n {\n id: 'sync_shopify.configure',\n title: 'Configure Shopify sync',\n module: 'sync_shopify',\n dependsOn: ['sync_shopify.view', 'data_sync.configure'],\n },\n]\n\nexport default features\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,WAAW;AAAA,EACtB;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW,CAAC,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW,CAAC,qBAAqB,qBAAqB;AAAA,EACxD;AACF;AAEA,IAAO,cAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
|
|
2
|
+
import { applyShopifyEnvPreset, readShopifyEnvPreset } from "./lib/preset.js";
|
|
3
|
+
function parseArgs(args) {
|
|
4
|
+
const result = {};
|
|
5
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
6
|
+
const arg = args[i];
|
|
7
|
+
if (!arg.startsWith("--")) continue;
|
|
8
|
+
const key = arg.slice(2);
|
|
9
|
+
const next = args[i + 1];
|
|
10
|
+
if (next && !next.startsWith("--")) {
|
|
11
|
+
result[key] = next;
|
|
12
|
+
i += 1;
|
|
13
|
+
} else {
|
|
14
|
+
result[key] = true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
function printHelp() {
|
|
20
|
+
console.log("Usage: yarn mercato sync_shopify configure-from-env --tenant <tenantId> --org <organizationId> [--force]");
|
|
21
|
+
console.log("");
|
|
22
|
+
console.log("Required env vars:");
|
|
23
|
+
console.log(" OM_INTEGRATION_SHOPIFY_SHOP_DOMAIN");
|
|
24
|
+
console.log(" OM_INTEGRATION_SHOPIFY_CLIENT_ID");
|
|
25
|
+
console.log(" OM_INTEGRATION_SHOPIFY_CLIENT_SECRET");
|
|
26
|
+
console.log("");
|
|
27
|
+
console.log("Optional env vars:");
|
|
28
|
+
console.log(" OM_INTEGRATION_SHOPIFY_API_VERSION");
|
|
29
|
+
console.log(" OM_INTEGRATION_SHOPIFY_FORCE");
|
|
30
|
+
}
|
|
31
|
+
const configureFromEnvCommand = {
|
|
32
|
+
command: "configure-from-env",
|
|
33
|
+
async run(rest) {
|
|
34
|
+
const args = parseArgs(rest);
|
|
35
|
+
const tenantId = String(args.tenantId ?? args.tenant ?? "");
|
|
36
|
+
const organizationId = String(args.organizationId ?? args.orgId ?? args.org ?? "");
|
|
37
|
+
if (!tenantId || !organizationId) {
|
|
38
|
+
printHelp();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!readShopifyEnvPreset()) {
|
|
42
|
+
console.error("[sync_shopify] No Shopify env preset was found.");
|
|
43
|
+
printHelp();
|
|
44
|
+
process.exitCode = 1;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const container = await createRequestContainer();
|
|
48
|
+
try {
|
|
49
|
+
const result = await applyShopifyEnvPreset({
|
|
50
|
+
credentialsService: container.resolve("integrationCredentialsService"),
|
|
51
|
+
integrationStateService: container.resolve("integrationStateService"),
|
|
52
|
+
integrationLogService: container.resolve("integrationLogService"),
|
|
53
|
+
scope: { tenantId, organizationId },
|
|
54
|
+
force: args.force === true
|
|
55
|
+
});
|
|
56
|
+
if (result.status === "skipped") {
|
|
57
|
+
console.log(`[sync_shopify] Skipped: ${result.reason}`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
console.log("[sync_shopify] Shopify credentials were configured from env.");
|
|
61
|
+
} catch (error) {
|
|
62
|
+
const message = error instanceof Error ? error.message : "Unknown Shopify preset error";
|
|
63
|
+
console.error(`[sync_shopify] ${message}`);
|
|
64
|
+
process.exitCode = 1;
|
|
65
|
+
} finally {
|
|
66
|
+
const disposable = container;
|
|
67
|
+
if (typeof disposable.dispose === "function") await disposable.dispose();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var cli_default = [configureFromEnvCommand, { command: "help", async run() {
|
|
72
|
+
printHelp();
|
|
73
|
+
} }];
|
|
74
|
+
export {
|
|
75
|
+
cli_default as default
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/modules/sync_shopify/cli.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ModuleCli } from '@open-mercato/shared/modules/registry'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport type { CredentialsService } from '@open-mercato/core/modules/integrations/lib/credentials-service'\nimport type { IntegrationLogService } from '@open-mercato/core/modules/integrations/lib/log-service'\nimport type { IntegrationStateService } from '@open-mercato/core/modules/integrations/lib/state-service'\nimport { applyShopifyEnvPreset, readShopifyEnvPreset } from './lib/preset'\n\nfunction parseArgs(args: string[]): Record<string, string | boolean> {\n const result: Record<string, string | boolean> = {}\n for (let i = 0; i < args.length; i += 1) {\n const arg = args[i]\n if (!arg.startsWith('--')) continue\n const key = arg.slice(2)\n const next = args[i + 1]\n if (next && !next.startsWith('--')) {\n result[key] = next\n i += 1\n } else {\n result[key] = true\n }\n }\n return result\n}\n\nfunction printHelp(): void {\n console.log('Usage: yarn mercato sync_shopify configure-from-env --tenant <tenantId> --org <organizationId> [--force]')\n console.log('')\n console.log('Required env vars:')\n console.log(' OM_INTEGRATION_SHOPIFY_SHOP_DOMAIN')\n console.log(' OM_INTEGRATION_SHOPIFY_CLIENT_ID')\n console.log(' OM_INTEGRATION_SHOPIFY_CLIENT_SECRET')\n console.log('')\n console.log('Optional env vars:')\n console.log(' OM_INTEGRATION_SHOPIFY_API_VERSION')\n console.log(' OM_INTEGRATION_SHOPIFY_FORCE')\n}\n\nconst configureFromEnvCommand: ModuleCli = {\n command: 'configure-from-env',\n async run(rest) {\n const args = parseArgs(rest)\n const tenantId = String(args.tenantId ?? args.tenant ?? '')\n const organizationId = String(args.organizationId ?? args.orgId ?? args.org ?? '')\n if (!tenantId || !organizationId) {\n printHelp()\n return\n }\n if (!readShopifyEnvPreset()) {\n console.error('[sync_shopify] No Shopify env preset was found.')\n printHelp()\n process.exitCode = 1\n return\n }\n const container = await createRequestContainer()\n try {\n const result = await applyShopifyEnvPreset({\n credentialsService: container.resolve('integrationCredentialsService') as CredentialsService,\n integrationStateService: container.resolve('integrationStateService') as IntegrationStateService,\n integrationLogService: container.resolve('integrationLogService') as IntegrationLogService,\n scope: { tenantId, organizationId },\n force: args.force === true,\n })\n if (result.status === 'skipped') {\n console.log(`[sync_shopify] Skipped: ${result.reason}`)\n return\n }\n console.log('[sync_shopify] Shopify credentials were configured from env.')\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown Shopify preset error'\n console.error(`[sync_shopify] ${message}`)\n process.exitCode = 1\n } finally {\n const disposable = container as unknown as { dispose?: () => Promise<void> }\n if (typeof disposable.dispose === 'function') await disposable.dispose()\n }\n },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ACF;AACA,UAAM,YAAY,MAAM,uBAAuB;AAC/C,QAAI;AACF,YAAM,SAAS,MAAM,sBAAsB;AAAA,QACzC,oBAAoB,UAAU,QAAQ,+BAA+B;AAAA,QACrE,yBAAyB,UAAU,QAAQ,yBAAyB;AAAA,QACpE,uBAAuB,UAAU,QAAQ,uBAAuB;AAAA,QAChE,OAAO,EAAE,UAAU,eAAe;AAAA,QAClC,OAAO,KAAK,UAAU;AAAA,MACxB,CAAC;AACD,UAAI,OAAO,WAAW,WAAW;AAC/B,gBAAQ,IAAI,2BAA2B,OAAO,MAAM,EAAE;AACtD;AAAA,MACF;AACA,cAAQ,IAAI,8DAA8D;AAAA,IAC5E,SAAS,OAAO;AACd,YAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,cAAQ,MAAM,kBAAkB,OAAO,EAAE;AACzC,cAAQ,WAAW;AAAA,IACrB,UAAE;AACA,YAAM,aAAa;AACnB,UAAI,OAAO,WAAW,YAAY,WAAY,OAAM,WAAW,QAAQ;AAAA,IACzE;AAAA,EACF;AACF;AAEA,IAAO,cAAQ,CAAC,yBAAyB,EAAE,SAAS,QAAQ,MAAM,MAAM;AAAE,YAAU;AAAE,EAAE,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { asValue } from "awilix";
|
|
2
|
+
import { registerDataSyncAdapter } from "@open-mercato/core/modules/data_sync/lib/adapter-registry";
|
|
3
|
+
import { shopifyDataSyncAdapter } from "./lib/adapter.js";
|
|
4
|
+
import { ensureFakeShopifyApiInstalled } from "./lib/fake-api.js";
|
|
5
|
+
import { shopifyHealthCheck } from "./lib/health.js";
|
|
6
|
+
function register(container) {
|
|
7
|
+
ensureFakeShopifyApiInstalled();
|
|
8
|
+
registerDataSyncAdapter(shopifyDataSyncAdapter);
|
|
9
|
+
container.register({
|
|
10
|
+
shopifyHealthCheck: asValue(shopifyHealthCheck)
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
register
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=di.js.map
|