medusa-plugin-veeqo 0.2.0 → 0.3.1
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/.medusa/server/medusa-config.js +3 -3
- package/.medusa/server/src/api/admin/veeqo/orders/[orderId]/replacements/sync/route.d.ts +2 -0
- package/.medusa/server/src/api/admin/veeqo/orders/[orderId]/replacements/sync/route.js +45 -0
- package/.medusa/server/src/api/admin/veeqo/orders/[orderId]/sync/route.js +5 -2
- package/.medusa/server/src/api/admin/veeqo/sync/route.d.ts +2 -0
- package/.medusa/server/src/api/admin/veeqo/sync/route.js +39 -0
- package/.medusa/server/src/modules/veeqo/index.d.ts +1 -0
- package/.medusa/server/src/modules/veeqo/index.js +4 -2
- package/.medusa/server/src/modules/veeqo/migrations/Migration20260508120000.d.ts +5 -0
- package/.medusa/server/src/modules/veeqo/migrations/Migration20260508120000.js +34 -0
- package/.medusa/server/src/modules/veeqo/models/veeqo-customer.d.ts +7 -3
- package/.medusa/server/src/modules/veeqo/models/veeqo-order.d.ts +12 -3
- package/.medusa/server/src/modules/veeqo/models/veeqo-order.js +24 -6
- package/.medusa/server/src/modules/veeqo/models/veeqo-shipment.d.ts +7 -3
- package/.medusa/server/src/modules/veeqo/service.d.ts +60 -10
- package/.medusa/server/src/modules/veeqo/service.js +53 -20
- package/.medusa/server/src/modules/veeqo/types.d.ts +3 -4
- package/.medusa/server/src/subscribers/claim-dispatcher.d.ts +6 -0
- package/.medusa/server/src/subscribers/claim-dispatcher.js +19 -0
- package/.medusa/server/src/subscribers/exchange-dispatcher.d.ts +6 -0
- package/.medusa/server/src/subscribers/exchange-dispatcher.js +19 -0
- package/.medusa/server/src/subscribers/{veeqo-dispatcher.d.ts → place-order-dispatcher.d.ts} +1 -1
- package/.medusa/server/src/subscribers/place-order-dispatcher.js +12 -0
- package/.medusa/server/src/workflows/order.d.ts +169 -15
- package/.medusa/server/src/workflows/order.js +468 -76
- package/.medusa/server/src/workflows/shipments.js +5 -1
- package/README.md +39 -0
- package/package.json +13 -13
- package/.medusa/server/src/subscribers/veeqo-dispatcher.js +0 -12
|
@@ -10,8 +10,8 @@ module.exports = (0, utils_1.defineConfig)({
|
|
|
10
10
|
storeCors: process.env.STORE_CORS || 'http://localhost:5173',
|
|
11
11
|
adminCors: process.env.ADMIN_CORS || 'http://localhost:5173,http://localhost:9000',
|
|
12
12
|
authCors: process.env.AUTH_CORS || 'http://localhost:5173,http://localhost:9000',
|
|
13
|
-
jwtSecret: process.env.JWT_SECRET
|
|
14
|
-
cookieSecret: process.env.COOKIE_SECRET
|
|
13
|
+
jwtSecret: process.env.JWT_SECRET,
|
|
14
|
+
cookieSecret: process.env.COOKIE_SECRET
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
modules: [
|
|
@@ -26,4 +26,4 @@ module.exports = (0, utils_1.defineConfig)({
|
|
|
26
26
|
}
|
|
27
27
|
]
|
|
28
28
|
});
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVkdXNhLWNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL21lZHVzYS1jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxxREFBaUU7QUFFakUsSUFBQSxlQUFPLEVBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxRQUFRLElBQUksYUFBYSxFQUFFLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FBQyxDQUFBO0FBRTdELE1BQU0sQ0FBQyxPQUFPLEdBQUcsSUFBQSxvQkFBWSxFQUFDO0lBQzdCLGFBQWEsRUFBRTtRQUNkLFFBQVEsRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLFNBQVM7UUFDL0IsV0FBVyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBWTtRQUN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1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = void 0;
|
|
4
|
+
const order_1 = require("../../../../../../../workflows/order");
|
|
5
|
+
const veeqo_order_1 = require("../../../../../../../modules/veeqo/models/veeqo-order");
|
|
6
|
+
// Bulk retry for unhealthy replacement VeeqoOrders on a given Medusa order.
|
|
7
|
+
// "Unhealthy" = veeqo_order_id IS NULL OR last_sync_error IS NOT NULL.
|
|
8
|
+
// ORDER_PLACED rows are excluded — those go through /admin/veeqo/orders/[orderId]/sync.
|
|
9
|
+
const POST = async (req, res) => {
|
|
10
|
+
const { orderId } = req.params;
|
|
11
|
+
const veeqoService = req.scope.resolve('veeqo');
|
|
12
|
+
const allRows = (await veeqoService.listVeeqoOrders({
|
|
13
|
+
order_id: orderId
|
|
14
|
+
}));
|
|
15
|
+
const unhealthy = allRows.filter(row => row.source_type !== veeqo_order_1.SourceType.ORDER_PLACED &&
|
|
16
|
+
(row.veeqo_order_id == null || row.last_sync_error != null));
|
|
17
|
+
const results = [];
|
|
18
|
+
for (const row of unhealthy) {
|
|
19
|
+
try {
|
|
20
|
+
await (0, order_1.syncReplacementToVeeqoWorkflow)(req.scope).run({
|
|
21
|
+
input: {
|
|
22
|
+
orderId,
|
|
23
|
+
sourceType: row.source_type,
|
|
24
|
+
sourceId: row.source_id
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
results.push({
|
|
28
|
+
source_type: row.source_type,
|
|
29
|
+
source_id: row.source_id,
|
|
30
|
+
ok: true
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
results.push({
|
|
35
|
+
source_type: row.source_type,
|
|
36
|
+
source_id: row.source_id,
|
|
37
|
+
ok: false,
|
|
38
|
+
error: err instanceof Error ? err.message : String(err)
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
res.json({ retried: results.length, results });
|
|
43
|
+
};
|
|
44
|
+
ex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ports.POST = void 0;
|
|
4
4
|
const order_1 = require("../../../../../../workflows/order");
|
|
5
|
-
//
|
|
5
|
+
// One-way sync of the ORDER_PLACED VeeqoOrder for this Medusa order from Medusa to Veeqo.
|
|
6
|
+
// For replacements (claim/exchange), use:
|
|
7
|
+
// POST /admin/veeqo/orders/[orderId]/replacements/sync (bulk)
|
|
8
|
+
// POST /admin/veeqo/sync (per-source)
|
|
6
9
|
const POST = async (req, res) => {
|
|
7
10
|
const { orderId } = req.params;
|
|
8
11
|
const { result } = await (0, order_1.syncOrderToVeeqoWorkflow)(req.scope).run({
|
|
@@ -16,4 +19,4 @@ const POST = async (req, res) => {
|
|
|
16
19
|
}
|
|
17
20
|
};
|
|
18
21
|
exports.POST = POST;
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL2FkbWluL3ZlZXFvL29yZGVycy9bb3JkZXJJZF0vc3luYy9yb3V0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSw2REFBNEU7QUFFNUUsMEZBQTBGO0FBQzFGLDBDQUEwQztBQUMxQyxnRUFBZ0U7QUFDaEUsd0NBQXdDO0FBQ2pDLE1BQU0sSUFBSSxHQUFHLEtBQUssRUFBRSxHQUErQixFQUFFLEdBQW1CLEVBQUUsRUFBRTtJQUNsRixNQUFNLEVBQUUsT0FBTyxFQUFFLEdBQUcsR0FBRyxDQUFDLE1BQU0sQ0FBQTtJQUM5QixNQUFNLEVBQUUsTUFBTSxFQUFFLEdBQUcsTUFBTSxJQUFBLGdDQUF3QixFQUFDLEdBQUcsQ0FBQyxLQUFLLENBQUMsQ0FBQyxHQUFHLENBQUM7UUFDaEUsS0FBSyxFQUFFLE9BQU87S0FDZCxDQUFDLENBQUE7SUFDRixJQUFJLE1BQU0sRUFBRSxDQUFDO1FBQ1osR0FBRyxDQUFDLElBQUksQ0FBQyxFQUFFLFdBQVcsRUFBRSxNQUFNLEVBQUUsQ0FBQyxDQUFBO0lBQ2xDLENBQUM7U0FBTSxDQUFDO1FBQ1AsR0FBRyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUMsRUFBRSxLQUFLLEVBQUUsc0JBQXNCLEVBQUUsQ0FBQyxDQUFBO0lBQ3hELENBQUM7QUFDRixDQUFDLENBQUE7QUFWWSxRQUFBLElBQUksUUFVaEIifQ==
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = void 0;
|
|
4
|
+
const order_1 = require("../../../../workflows/order");
|
|
5
|
+
const veeqo_order_1 = require("../../../../modules/veeqo/models/veeqo-order");
|
|
6
|
+
// Per-source manual retry. Useful when a specific claim/exchange sync failed and
|
|
7
|
+
// the operator wants to retry it after fixing the underlying issue.
|
|
8
|
+
//
|
|
9
|
+
// For source_type=ORDER_PLACED, source_id IS the order id (no separate order_id needed).
|
|
10
|
+
// For source_type=CLAIM or EXCHANGE, both order_id (the parent order) and source_id
|
|
11
|
+
// (the claim/exchange id) are required.
|
|
12
|
+
const POST = async (req, res) => {
|
|
13
|
+
const body = (req.body ?? {});
|
|
14
|
+
if (!body.source_type || !body.source_id) {
|
|
15
|
+
return res.status(400).json({ message: 'source_type and source_id are required' });
|
|
16
|
+
}
|
|
17
|
+
if (body.source_type === veeqo_order_1.SourceType.ORDER_PLACED) {
|
|
18
|
+
await (0, order_1.syncOrderToVeeqoWorkflow)(req.scope).run({ input: body.source_id });
|
|
19
|
+
return res.json({ ok: true });
|
|
20
|
+
}
|
|
21
|
+
if (body.source_type !== veeqo_order_1.SourceType.CLAIM && body.source_type !== veeqo_order_1.SourceType.EXCHANGE) {
|
|
22
|
+
return res.status(400).json({ message: `Unknown source_type: ${body.source_type}` });
|
|
23
|
+
}
|
|
24
|
+
if (!body.order_id) {
|
|
25
|
+
return res
|
|
26
|
+
.status(400)
|
|
27
|
+
.json({ message: 'order_id is required when source_type is claim or exchange' });
|
|
28
|
+
}
|
|
29
|
+
await (0, order_1.syncReplacementToVeeqoWorkflow)(req.scope).run({
|
|
30
|
+
input: {
|
|
31
|
+
orderId: body.order_id,
|
|
32
|
+
sourceType: body.source_type,
|
|
33
|
+
sourceId: body.source_id
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
res.json({ ok: true });
|
|
37
|
+
};
|
|
38
|
+
exports.POST = POST;
|
|
39
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL2FkbWluL3ZlZXFvL3N5bmMvcm91dGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsdURBR29DO0FBQ3BDLDhFQUF5RTtBQVF6RSxpRkFBaUY7QUFDakYsb0VBQW9FO0FBQ3BFLEVBQUU7QUFDRix5RkFBeUY7QUFDekYsb0ZBQW9GO0FBQ3BGLHdDQUF3QztBQUNqQyxNQUFNLElBQUksR0FBRyxLQUFLLEVBQUUsR0FBK0IsRUFBRSxHQUFtQixFQUFFLEVBQUU7SUFDbEYsTUFBTSxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsSUFBSSxJQUFJLEVBQUUsQ0FBUyxDQUFBO0lBRXJDLElBQUksQ0FBQyxJQUFJLENBQUMsV0FBVyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxDQUFDO1FBQzFDLE9BQU8sR0FBRyxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUMsRUFBRSxPQUFPLE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FXO1lBQzVCLFFBQVEsRUFBRSxJQUFJLENBQUMsU0FBUztTQUN4QjtLQUNELENBQUMsQ0FBQTtJQUVGLEdBQUcsQ0FBQyxJQUFJLENBQUMsRUFBRSxFQUFFLEVBQUUsSUFBSSxFQUFFLENBQUMsQ0FBQTtBQUN2QixDQUFDLENBQUE7QUEvQlksUUFBQSxJQUFJLFFBK0JoQiJ9
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.VEEQO_MODULE = void 0;
|
|
17
|
+
exports.SourceType = exports.VEEQO_MODULE = void 0;
|
|
18
18
|
const utils_1 = require("@medusajs/framework/utils");
|
|
19
19
|
const service_1 = require("./service");
|
|
20
20
|
exports.VEEQO_MODULE = 'veeqo';
|
|
@@ -22,4 +22,6 @@ exports.default = (0, utils_1.Module)(exports.VEEQO_MODULE, {
|
|
|
22
22
|
service: service_1.VeeqoService
|
|
23
23
|
});
|
|
24
24
|
__exportStar(require("./service"), exports);
|
|
25
|
-
|
|
25
|
+
var veeqo_order_1 = require("./models/veeqo-order");
|
|
26
|
+
Object.defineProperty(exports, "SourceType", { enumerable: true, get: function () { return veeqo_order_1.SourceType; } });
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy92ZWVxby9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHFEQUFrRDtBQUNsRCx1Q0FBd0M7QUFFM0IsUUFBQSxZQUFZLEdBQUcsT0FBTyxDQUFBO0FBRW5DLGtCQUFlLElBQUEsY0FBTSxFQUFDLG9CQUFZLEVBQUU7SUFDbkMsT0FBTyxFQUFFLHNCQUFZO0NBQ3JCLENBQUMsQ0FBQTtBQUVGLDRDQUF5QjtBQUN6QixvREFBaUQ7QUFBeEMseUdBQUEsVUFBVSxPQUFBIn0=
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20260508120000 = void 0;
|
|
4
|
+
const migrations_1 = require("@medusajs/framework/mikro-orm/migrations");
|
|
5
|
+
class Migration20260508120000 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
// 1. Drop the existing unique constraint/index on order_id
|
|
8
|
+
this.addSql(`alter table if exists "veeqo_order" drop constraint if exists "veeqo_order_order_id_unique";`);
|
|
9
|
+
this.addSql(`drop index if exists "IDX_veeqo_order_order_id_unique";`);
|
|
10
|
+
// 2. Add source_type with default for backfill
|
|
11
|
+
this.addSql(`alter table "veeqo_order" add column "source_type" text check ("source_type" in ('order_placed', 'claim', 'exchange')) not null default 'order_placed';`);
|
|
12
|
+
// 3. Add source_id nullable initially
|
|
13
|
+
this.addSql(`alter table "veeqo_order" add column "source_id" text;`);
|
|
14
|
+
// 4. Backfill source_id from order_id (every existing row was an original placement)
|
|
15
|
+
this.addSql(`update "veeqo_order" set "source_id" = "order_id";`);
|
|
16
|
+
// 5. Lock down source_id
|
|
17
|
+
this.addSql(`alter table "veeqo_order" alter column "source_id" set not null;`);
|
|
18
|
+
// 6. New uniqueness invariant: one VeeqoOrder per (source_type, source_id)
|
|
19
|
+
this.addSql(`create unique index "IDX_veeqo_order_source_uniq" on "veeqo_order" ("source_type", "source_id") where deleted_at is null;`);
|
|
20
|
+
// 7. Make veeqo_order_id nullable for the placeholder-row pattern.
|
|
21
|
+
// Postgres allows multiple NULLs in a unique index, so existing uniqueness invariant
|
|
22
|
+
// on populated values is preserved.
|
|
23
|
+
this.addSql(`alter table "veeqo_order" alter column "veeqo_order_id" drop not null;`);
|
|
24
|
+
// 8/9. Failure-tracking columns
|
|
25
|
+
this.addSql(`alter table "veeqo_order" add column "last_sync_error" text null;`);
|
|
26
|
+
this.addSql(`alter table "veeqo_order" add column "last_sync_attempted_at" timestamptz null;`);
|
|
27
|
+
}
|
|
28
|
+
async down() {
|
|
29
|
+
throw new Error('No down migration: replacement support changed VeeqoOrder from 1:1 to 1:N. ' +
|
|
30
|
+
'Roll back by restoring a database backup from before this migration.');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Migration20260508120000 = Migration20260508120000;
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNjA1MDgxMjAwMDAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy92ZWVxby9taWdyYXRpb25zL01pZ3JhdGlvbjIwMjYwNTA4MTIwMDAwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHlFQUFvRTtBQUVwRSxNQUFhLHVCQUF3QixTQUFRLHNCQUFTO0lBQzVDLEtBQUssQ0FBQyxFQUFFO1FBQ2hCLDJEQUEyRDtRQUMzRCxJQUFJLENBQUMsTUFBTSxDQUNWLDhGQUE4RixDQUM5RixDQUFBO1FBQ0QsSUFBSSxDQUFDLE1BQU0sQ0FBQyx5REFBeUQsQ0FBQyxDQUFBO1FBRXRFLCtDQUErQztRQUMvQyxJQUFJLENBQUMsTUFBTSxDQUNWLHlKQUF5SixDQUN6SixDQUFBO1FBRUQsc0NBQXNDO1FBQ3RDLElBQUksQ0FBQyxNQUFNLENBQUMsd0RBQXdELENBQUMsQ0FBQTtRQUVyRSxxRkFBcUY7UUFDckYsSUFBSSxDQUFDLE1BQU0sQ0FBQyxvREFBb0QsQ0FBQyxDQUFBO1FBRWpFLHlCQUF5QjtRQUN6QixJQUFJLENBQUMsTUFBTSxDQUFDLGtFQUFrRSxDQUFDLENBQUE7UUFFL0UsMkVBQTJFO1FBQzNFLElBQUksQ0FBQyxNQUFNLENBQ1YsMkhBQTJILENBQzNILENBQUE7UUFFRCxtRUFBbUU7UUFDbkUsd0ZBQXdGO1FBQ3hGLHVDQUF1QztRQUN2QyxJQUFJLENBQUMsTUFBTSxDQUNWLHdFQUF3RSxDQUN4RSxDQUFBO1FBRUQsZ0NBQWdDO1FBQ2hDLElBQUksQ0FBQyxNQUFNLENBQUMsbUVBQW1FLENBQUMsQ0FBQTtRQUNoRixJQUFJLENBQUMsTUFBTSxDQUNWLGlGQUFpRixDQUNqRixDQUFBO0lBQ0YsQ0FBQztJQUVRLEtBQUssQ0FBQyxJQUFJO1FBQ2xCLE1BQU0sSUFBSSxLQUFLLENBQ2QsNkVBQTZFO1lBQzVFLHNFQUFzRSxDQUN2RSxDQUFBO0lBQ0YsQ0FBQztDQUNEO0FBL0NELDBEQStDQyJ9
|
|
@@ -7,9 +7,13 @@ export declare const VeeqoCustomer: import("@medusajs/framework/utils").DmlEntit
|
|
|
7
7
|
status: import("@medusajs/framework/utils").EnumProperty<typeof import("./veeqo-order").Status>;
|
|
8
8
|
last_synced_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
9
9
|
order_id: import("@medusajs/framework/utils").TextProperty;
|
|
10
|
-
|
|
10
|
+
source_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./veeqo-order").SourceType>;
|
|
11
|
+
source_id: import("@medusajs/framework/utils").TextProperty;
|
|
12
|
+
veeqo_order_id: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
|
|
11
13
|
veeqo_status: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
12
|
-
|
|
14
|
+
last_sync_error: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
15
|
+
last_sync_attempted_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
16
|
+
veeqo_customer: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_customer">, undefined>;
|
|
13
17
|
veeqo_shipments: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
14
18
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
15
19
|
fulfillment_id: import("@medusajs/framework/utils").TextProperty;
|
|
@@ -20,7 +24,7 @@ export declare const VeeqoCustomer: import("@medusajs/framework/utils").DmlEntit
|
|
|
20
24
|
shipped_by: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
21
25
|
shipped_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
22
26
|
veeqo_tracking_events: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
23
|
-
veeqo_order: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder
|
|
27
|
+
veeqo_order: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_order">, undefined>;
|
|
24
28
|
}>, "veeqo_shipment">>;
|
|
25
29
|
}>, "veeqo_order">>;
|
|
26
30
|
}>, "veeqo_customer">;
|
|
@@ -2,18 +2,27 @@ export declare enum Status {
|
|
|
2
2
|
OPEN = "open",
|
|
3
3
|
CLOSED = "closed"
|
|
4
4
|
}
|
|
5
|
+
export declare enum SourceType {
|
|
6
|
+
ORDER_PLACED = "order_placed",
|
|
7
|
+
CLAIM = "claim",
|
|
8
|
+
EXCHANGE = "exchange"
|
|
9
|
+
}
|
|
5
10
|
export declare const VeeqoOrder: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
6
11
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
7
12
|
status: import("@medusajs/framework/utils").EnumProperty<typeof Status>;
|
|
8
13
|
last_synced_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
9
14
|
order_id: import("@medusajs/framework/utils").TextProperty;
|
|
10
|
-
|
|
15
|
+
source_type: import("@medusajs/framework/utils").EnumProperty<typeof SourceType>;
|
|
16
|
+
source_id: import("@medusajs/framework/utils").TextProperty;
|
|
17
|
+
veeqo_order_id: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
|
|
11
18
|
veeqo_status: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
19
|
+
last_sync_error: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
20
|
+
last_sync_attempted_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
12
21
|
veeqo_customer: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
13
22
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
14
23
|
customer_id: import("@medusajs/framework/utils").TextProperty;
|
|
15
24
|
veeqo_customer_id: import("@medusajs/framework/utils").NumberProperty;
|
|
16
|
-
veeqo_orders: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder
|
|
25
|
+
veeqo_orders: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_order">>;
|
|
17
26
|
}>, "veeqo_customer">, undefined>;
|
|
18
27
|
veeqo_shipments: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
19
28
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
@@ -25,6 +34,6 @@ export declare const VeeqoOrder: import("@medusajs/framework/utils").DmlEntity<i
|
|
|
25
34
|
shipped_by: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
26
35
|
shipped_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
27
36
|
veeqo_tracking_events: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
28
|
-
veeqo_order: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder
|
|
37
|
+
veeqo_order: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_order">, undefined>;
|
|
29
38
|
}>, "veeqo_shipment">>;
|
|
30
39
|
}>, "veeqo_order">;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VeeqoOrder = exports.Status = void 0;
|
|
3
|
+
exports.VeeqoOrder = exports.SourceType = exports.Status = void 0;
|
|
4
4
|
const utils_1 = require("@medusajs/framework/utils");
|
|
5
5
|
const veeqo_customer_1 = require("./veeqo-customer");
|
|
6
6
|
const veeqo_shipment_1 = require("./veeqo-shipment");
|
|
@@ -9,18 +9,36 @@ var Status;
|
|
|
9
9
|
Status["OPEN"] = "open";
|
|
10
10
|
Status["CLOSED"] = "closed";
|
|
11
11
|
})(Status || (exports.Status = Status = {}));
|
|
12
|
-
|
|
12
|
+
var SourceType;
|
|
13
|
+
(function (SourceType) {
|
|
14
|
+
SourceType["ORDER_PLACED"] = "order_placed";
|
|
15
|
+
SourceType["CLAIM"] = "claim";
|
|
16
|
+
SourceType["EXCHANGE"] = "exchange";
|
|
17
|
+
})(SourceType || (exports.SourceType = SourceType = {}));
|
|
18
|
+
exports.VeeqoOrder = utils_1.model
|
|
19
|
+
.define('veeqo_order', {
|
|
13
20
|
id: utils_1.model.id().primaryKey(),
|
|
14
21
|
status: utils_1.model.enum(Status).default(Status.OPEN),
|
|
15
22
|
last_synced_at: utils_1.model.dateTime().nullable(),
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
// No longer unique — a Medusa order can have multiple VeeqoOrders.
|
|
24
|
+
order_id: utils_1.model.text(),
|
|
25
|
+
source_type: utils_1.model.enum(SourceType).default(SourceType.ORDER_PLACED),
|
|
26
|
+
// For ORDER_PLACED, equals order_id. For CLAIM, the order_claim id. For EXCHANGE, the order_exchange id.
|
|
27
|
+
source_id: utils_1.model.text(),
|
|
28
|
+
// Nullable to support the placeholder-row pattern during in-flight create attempts.
|
|
29
|
+
// Postgres allows multiple NULLs in a unique index, so existing uniqueness invariant is preserved.
|
|
30
|
+
veeqo_order_id: utils_1.model.number().unique().nullable(),
|
|
18
31
|
veeqo_status: utils_1.model.text().nullable(),
|
|
32
|
+
// Last error message from a failed sync attempt; NULL when healthy.
|
|
33
|
+
last_sync_error: utils_1.model.text().nullable(),
|
|
34
|
+
// Timestamp of the last create attempt (success or failure).
|
|
35
|
+
last_sync_attempted_at: utils_1.model.dateTime().nullable(),
|
|
19
36
|
veeqo_customer: utils_1.model.belongsTo(() => veeqo_customer_1.VeeqoCustomer, {
|
|
20
37
|
mappedBy: 'veeqo_orders'
|
|
21
38
|
}),
|
|
22
39
|
veeqo_shipments: utils_1.model.hasMany(() => veeqo_shipment_1.VeeqoShipment, {
|
|
23
40
|
mappedBy: 'veeqo_order'
|
|
24
41
|
})
|
|
25
|
-
})
|
|
26
|
-
|
|
42
|
+
})
|
|
43
|
+
.indexes([{ on: ['source_type', 'source_id'], unique: true }]);
|
|
44
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVlcW8tb3JkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy92ZWVxby9tb2RlbHMvdmVlcW8tb3JkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEscURBQWlEO0FBQ2pELHFEQUFnRDtBQUNoRCxxREFBZ0Q7QUFFaEQsSUFBWSxNQUdYO0FBSEQsV0FBWSxNQUFNO0lBQ2pCLHVCQUFhLENBQUE7SUFDYiwyQkFBaUIsQ0FBQTtBQUNsQixDQUFDLEVBSFcsTUFBTSxzQkFBTixNQUFNLFFBR2pCO0FBRUQsSUFBWSxVQUlYO0FBSkQsV0FBWSxVQUFVO0lBQ3JCLDJDQUE2QixDQUFBO0lBQzdCLDZCQUFlLENBQUE7SUFDZixtQ0FBcUIsQ0FBQTtBQUN0QixDQUFDLEVBSlcsVUFBVSwwQkFBVixVQUFVLFFBSXJCO0FBRVksUUFBQSxVQUFVLEdBQUcsYUFBSztLQUM3QixNQUFNLENBQUMsYUFBYSxFQUFFO0lBQ3RCLEVBQUUsRUFBRSxhQUFLLENBQUMsRUFBRSxFQUFFLENBQUMsVUFBVSxFQUFFO0lBQzNCLE1BQU0sRUFBRSxhQUFLLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLE9BQU8sQ0FBQyxNQUF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FLE1BQU0sRUFBRSxJQUFJLEVBQUUsQ0FBQyxDQUFDLENBQUEifQ==
|
|
@@ -13,14 +13,18 @@ export declare const VeeqoShipment: import("@medusajs/framework/utils").DmlEntit
|
|
|
13
13
|
status: import("@medusajs/framework/utils").EnumProperty<typeof import("./veeqo-order").Status>;
|
|
14
14
|
last_synced_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
15
15
|
order_id: import("@medusajs/framework/utils").TextProperty;
|
|
16
|
-
|
|
16
|
+
source_type: import("@medusajs/framework/utils").EnumProperty<typeof import("./veeqo-order").SourceType>;
|
|
17
|
+
source_id: import("@medusajs/framework/utils").TextProperty;
|
|
18
|
+
veeqo_order_id: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
|
|
17
19
|
veeqo_status: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
20
|
+
last_sync_error: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
21
|
+
last_sync_attempted_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
18
22
|
veeqo_customer: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
19
23
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
20
24
|
customer_id: import("@medusajs/framework/utils").TextProperty;
|
|
21
25
|
veeqo_customer_id: import("@medusajs/framework/utils").NumberProperty;
|
|
22
|
-
veeqo_orders: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder
|
|
26
|
+
veeqo_orders: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_order">>;
|
|
23
27
|
}>, "veeqo_customer">, undefined>;
|
|
24
|
-
veeqo_shipments: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder
|
|
28
|
+
veeqo_shipments: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_shipment">>;
|
|
25
29
|
}>, "veeqo_order">, undefined>;
|
|
26
30
|
}>, "veeqo_shipment">;
|
|
@@ -3,7 +3,7 @@ import { ProductForVeeqoProductInput, VeeqoChannelDTO, VeeqoChannelInput, VeeqoC
|
|
|
3
3
|
import { VeeqoChannel } from './models/veeqo-channel';
|
|
4
4
|
import { VeeqoCustomer } from './models/veeqo-customer';
|
|
5
5
|
import { VeeqoDeliveryMethod } from './models/veeqo-delivery-method';
|
|
6
|
-
import { VeeqoOrder } from './models/veeqo-order';
|
|
6
|
+
import { VeeqoOrder, SourceType } from './models/veeqo-order';
|
|
7
7
|
import { VeeqoProduct } from './models/veeqo-product';
|
|
8
8
|
import { VeeqoSellable } from './models/veeqo-sellable';
|
|
9
9
|
import { VeeqoShipment } from './models/veeqo-shipment';
|
|
@@ -31,9 +31,13 @@ declare const VeeqoService_base: import("@medusajs/framework/utils").MedusaServi
|
|
|
31
31
|
status: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/veeqo-order").Status>;
|
|
32
32
|
last_synced_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
33
33
|
order_id: import("@medusajs/framework/utils").TextProperty;
|
|
34
|
-
|
|
34
|
+
source_type: import("@medusajs/framework/utils").EnumProperty<typeof SourceType>;
|
|
35
|
+
source_id: import("@medusajs/framework/utils").TextProperty;
|
|
36
|
+
veeqo_order_id: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
|
|
35
37
|
veeqo_status: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
36
|
-
|
|
38
|
+
last_sync_error: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
39
|
+
last_sync_attempted_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
40
|
+
veeqo_customer: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_customer">, undefined>;
|
|
37
41
|
veeqo_shipments: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
38
42
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
39
43
|
fulfillment_id: import("@medusajs/framework/utils").TextProperty;
|
|
@@ -44,7 +48,7 @@ declare const VeeqoService_base: import("@medusajs/framework/utils").MedusaServi
|
|
|
44
48
|
shipped_by: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
45
49
|
shipped_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
46
50
|
veeqo_tracking_events: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
47
|
-
veeqo_order: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder
|
|
51
|
+
veeqo_order: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_order">, undefined>;
|
|
48
52
|
}>, "veeqo_shipment">>;
|
|
49
53
|
}>, "veeqo_order">>;
|
|
50
54
|
}>, "veeqo_customer">;
|
|
@@ -58,9 +62,18 @@ declare const VeeqoService_base: import("@medusajs/framework/utils").MedusaServi
|
|
|
58
62
|
status: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/veeqo-order").Status>;
|
|
59
63
|
last_synced_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
60
64
|
order_id: import("@medusajs/framework/utils").TextProperty;
|
|
61
|
-
|
|
65
|
+
source_type: import("@medusajs/framework/utils").EnumProperty<typeof SourceType>;
|
|
66
|
+
source_id: import("@medusajs/framework/utils").TextProperty;
|
|
67
|
+
veeqo_order_id: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
|
|
62
68
|
veeqo_status: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
63
|
-
|
|
69
|
+
last_sync_error: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
70
|
+
last_sync_attempted_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
71
|
+
veeqo_customer: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
72
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
73
|
+
customer_id: import("@medusajs/framework/utils").TextProperty;
|
|
74
|
+
veeqo_customer_id: import("@medusajs/framework/utils").NumberProperty;
|
|
75
|
+
veeqo_orders: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_order">>;
|
|
76
|
+
}>, "veeqo_customer">, undefined>;
|
|
64
77
|
veeqo_shipments: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
65
78
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
66
79
|
fulfillment_id: import("@medusajs/framework/utils").TextProperty;
|
|
@@ -71,7 +84,7 @@ declare const VeeqoService_base: import("@medusajs/framework/utils").MedusaServi
|
|
|
71
84
|
shipped_by: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
72
85
|
shipped_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
73
86
|
veeqo_tracking_events: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
74
|
-
veeqo_order: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder
|
|
87
|
+
veeqo_order: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_order">, undefined>;
|
|
75
88
|
}>, "veeqo_shipment">>;
|
|
76
89
|
}>, "veeqo_order">;
|
|
77
90
|
readonly VeeqoProduct: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
@@ -94,7 +107,25 @@ declare const VeeqoService_base: import("@medusajs/framework/utils").MedusaServi
|
|
|
94
107
|
shipped_by: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
95
108
|
shipped_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
96
109
|
veeqo_tracking_events: import("@medusajs/framework/utils").NullableModifier<Record<string, unknown>, import("@medusajs/framework/utils").JSONProperty>;
|
|
97
|
-
veeqo_order: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<
|
|
110
|
+
veeqo_order: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
111
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
112
|
+
status: import("@medusajs/framework/utils").EnumProperty<typeof import("./models/veeqo-order").Status>;
|
|
113
|
+
last_synced_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
114
|
+
order_id: import("@medusajs/framework/utils").TextProperty;
|
|
115
|
+
source_type: import("@medusajs/framework/utils").EnumProperty<typeof SourceType>;
|
|
116
|
+
source_id: import("@medusajs/framework/utils").TextProperty;
|
|
117
|
+
veeqo_order_id: import("@medusajs/framework/utils").NullableModifier<number, import("@medusajs/framework/utils").NumberProperty>;
|
|
118
|
+
veeqo_status: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
119
|
+
last_sync_error: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
|
|
120
|
+
last_sync_attempted_at: import("@medusajs/framework/utils").NullableModifier<Date, import("@medusajs/framework/utils").DateTimeProperty>;
|
|
121
|
+
veeqo_customer: import("@medusajs/framework/utils").BelongsTo<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
122
|
+
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
123
|
+
customer_id: import("@medusajs/framework/utils").TextProperty;
|
|
124
|
+
veeqo_customer_id: import("@medusajs/framework/utils").NumberProperty;
|
|
125
|
+
veeqo_orders: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_order">>;
|
|
126
|
+
}>, "veeqo_customer">, undefined>;
|
|
127
|
+
veeqo_shipments: import("@medusajs/framework/utils").HasMany<() => import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder</*elided*/ any>, "veeqo_shipment">>;
|
|
128
|
+
}>, "veeqo_order">, undefined>;
|
|
98
129
|
}>, "veeqo_shipment">;
|
|
99
130
|
readonly VeeqoWarehouse: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
|
|
100
131
|
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
|
|
@@ -125,6 +156,18 @@ export declare class VeeqoService extends VeeqoService_base {
|
|
|
125
156
|
* Fetches a delivery method from Veeqo by Veeqo Delivery Method ID. Returns the Veeqo delivery method or null if not found.
|
|
126
157
|
*/
|
|
127
158
|
fetchDeliveryMethod(veeqoDeliveryMethodId: number): Promise<VeeqoDeliveryMethodDTO>;
|
|
159
|
+
/**
|
|
160
|
+
* Searches Veeqo for an order whose `number` field exactly matches the given value.
|
|
161
|
+
*
|
|
162
|
+
* Veeqo's list-orders endpoint only supports a free-text `query` parameter, so we
|
|
163
|
+
* search and then filter client-side for an exact `number` match. Used by
|
|
164
|
+
* createVeeqoOrderStep to recover from the API-succeeded-DB-failed window —
|
|
165
|
+
* if a Veeqo order already exists for the number we're about to create, we
|
|
166
|
+
* adopt it instead of creating a duplicate.
|
|
167
|
+
*
|
|
168
|
+
* Returns the matching order or null if not found.
|
|
169
|
+
*/
|
|
170
|
+
findOrderByNumber(number: string): Promise<VeeqoOrderDTO | null>;
|
|
128
171
|
/**
|
|
129
172
|
* Fetches an order from Veeqo by Veeqo Order ID. Returns the Veeqo order or null if not found.
|
|
130
173
|
*/
|
|
@@ -158,9 +201,16 @@ export declare class VeeqoService extends VeeqoService_base {
|
|
|
158
201
|
*/
|
|
159
202
|
addDeliveryMethod(shippingOptionId: string, deliveryMethodInput: VeeqoDeliveryMethodInput): Promise<VeeqoDeliveryMethodDTO>;
|
|
160
203
|
/**
|
|
161
|
-
*
|
|
204
|
+
* Creates an order in Veeqo via the Veeqo API and returns the response.
|
|
205
|
+
*
|
|
206
|
+
* Persistence of the local VeeqoOrder DB row is the caller's responsibility (see
|
|
207
|
+
* createVeeqoOrderStep in workflows/order.ts, which uses the placeholder-row pattern).
|
|
208
|
+
* This separation lets the workflow handle the (source_type, source_id) discriminator,
|
|
209
|
+
* idempotency, and failure tracking, while this method stays focused on the API call.
|
|
162
210
|
*/
|
|
163
|
-
addOrder(
|
|
211
|
+
addOrder(input: {
|
|
212
|
+
veeqo_input: VeeqoOrderInput;
|
|
213
|
+
}): Promise<VeeqoOrderDTO>;
|
|
164
214
|
/**
|
|
165
215
|
* Adds a product to Veeqo and links it to the corresponding product in Medusa. First argument is the Medusa product ID, second argument is the input data to create the product in Veeqo. Returns the created Veeqo product.
|
|
166
216
|
*/
|