@viu/emporix-sdk 2.22.0 → 2.25.0
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/CHANGELOG.md +144 -0
- package/README.md +16 -6
- package/dist/availability.cjs +118 -0
- package/dist/availability.cjs.map +1 -1
- package/dist/availability.d.cts +178 -2
- package/dist/availability.d.ts +178 -2
- package/dist/availability.js +1 -1
- package/dist/cart.cjs +156 -11
- package/dist/cart.cjs.map +1 -1
- package/dist/cart.d.cts +177 -4
- package/dist/cart.d.ts +177 -4
- package/dist/cart.js +1 -1
- package/dist/category.cjs +192 -2
- package/dist/category.cjs.map +1 -1
- package/dist/category.d.cts +399 -2
- package/dist/category.d.ts +399 -2
- package/dist/category.js +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/{chunk-HD5RBCM6.js → chunk-27NLS646.js} +10 -2
- package/dist/chunk-27NLS646.js.map +1 -0
- package/dist/{chunk-MMX5FGMI.js → chunk-6PJFOX3A.js} +109 -2
- package/dist/chunk-6PJFOX3A.js.map +1 -0
- package/dist/chunk-HWVFF6B2.js +378 -0
- package/dist/chunk-HWVFF6B2.js.map +1 -0
- package/dist/chunk-LQFRJSVT.js +224 -0
- package/dist/chunk-LQFRJSVT.js.map +1 -0
- package/dist/chunk-P7G4LOOV.js +264 -0
- package/dist/chunk-P7G4LOOV.js.map +1 -0
- package/dist/{chunk-44F52KRE.js → chunk-QQMLN76U.js} +27 -2
- package/dist/chunk-QQMLN76U.js.map +1 -0
- package/dist/chunk-UNW6SFSB.js +363 -0
- package/dist/chunk-UNW6SFSB.js.map +1 -0
- package/dist/chunk-V3275BA7.js +181 -0
- package/dist/chunk-V3275BA7.js.map +1 -0
- package/dist/chunk-W2KBVWJ2.js +323 -0
- package/dist/chunk-W2KBVWJ2.js.map +1 -0
- package/dist/{chunk-5DWCYDQD.js → chunk-YVZ6GOLE.js} +158 -13
- package/dist/chunk-YVZ6GOLE.js.map +1 -0
- package/dist/chunk-ZOFGDNSX.js +305 -0
- package/dist/chunk-ZOFGDNSX.js.map +1 -0
- package/dist/companies.cjs +25 -0
- package/dist/companies.cjs.map +1 -1
- package/dist/companies.d.cts +15 -1
- package/dist/companies.d.ts +15 -1
- package/dist/companies.js +1 -1
- package/dist/contacts.cjs +8 -0
- package/dist/contacts.cjs.map +1 -1
- package/dist/contacts.d.cts +3 -1
- package/dist/contacts.d.ts +3 -1
- package/dist/contacts.js +1 -1
- package/dist/{context-CfXJcYKP.d.cts → context-DC5gSgKK.d.cts} +18 -0
- package/dist/{context-CfXJcYKP.d.ts → context-DC5gSgKK.d.ts} +18 -0
- package/dist/customer-groups-BqYsPCA6.d.cts +706 -0
- package/dist/customer-groups-CLm6Gu9U.d.ts +706 -0
- package/dist/customer-groups.cjs +200 -17
- package/dist/customer-groups.cjs.map +1 -1
- package/dist/customer-groups.d.cts +2 -110
- package/dist/customer-groups.d.ts +2 -110
- package/dist/customer-groups.js +1 -1
- package/dist/customer.d.cts +1 -1
- package/dist/customer.d.ts +1 -1
- package/dist/index.cjs +2231 -395
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +435 -13
- package/dist/index.d.ts +435 -13
- package/dist/index.js +679 -344
- package/dist/index.js.map +1 -1
- package/dist/locations.d.cts +1 -1
- package/dist/locations.d.ts +1 -1
- package/dist/media.d.cts +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/orders.cjs +160 -2
- package/dist/orders.cjs.map +1 -1
- package/dist/orders.d.cts +222 -2
- package/dist/orders.d.ts +222 -2
- package/dist/orders.js +1 -1
- package/dist/payment.cjs +107 -0
- package/dist/payment.cjs.map +1 -1
- package/dist/payment.d.cts +300 -2
- package/dist/payment.d.ts +300 -2
- package/dist/payment.js +1 -1
- package/dist/price.cjs +197 -0
- package/dist/price.cjs.map +1 -1
- package/dist/price.d.cts +578 -2
- package/dist/price.d.ts +578 -2
- package/dist/price.js +1 -1
- package/dist/product.cjs +190 -0
- package/dist/product.cjs.map +1 -1
- package/dist/product.d.cts +504 -2
- package/dist/product.d.ts +504 -2
- package/dist/product.js +1 -1
- package/dist/segment.cjs +179 -0
- package/dist/segment.cjs.map +1 -1
- package/dist/segment.d.cts +182 -2
- package/dist/segment.d.ts +182 -2
- package/dist/segment.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-36T4YPQJ.js +0 -106
- package/dist/chunk-36T4YPQJ.js.map +0 -1
- package/dist/chunk-3BTPX7IJ.js +0 -41
- package/dist/chunk-3BTPX7IJ.js.map +0 -1
- package/dist/chunk-44F52KRE.js.map +0 -1
- package/dist/chunk-5DWCYDQD.js.map +0 -1
- package/dist/chunk-A3LYJUD4.js +0 -108
- package/dist/chunk-A3LYJUD4.js.map +0 -1
- package/dist/chunk-DXOLWAOY.js +0 -188
- package/dist/chunk-DXOLWAOY.js.map +0 -1
- package/dist/chunk-FZMP5NQZ.js +0 -173
- package/dist/chunk-FZMP5NQZ.js.map +0 -1
- package/dist/chunk-HD5RBCM6.js.map +0 -1
- package/dist/chunk-IVCCGJN5.js +0 -63
- package/dist/chunk-IVCCGJN5.js.map +0 -1
- package/dist/chunk-MMX5FGMI.js.map +0 -1
- package/dist/chunk-NE7MIZPR.js +0 -144
- package/dist/chunk-NE7MIZPR.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -113,7 +113,8 @@ function validateConfig(input) {
|
|
|
113
113
|
expirationBufferSeconds: input.cache?.expirationBufferSeconds ?? 60,
|
|
114
114
|
maxLifetimeSeconds: input.cache?.maxLifetimeSeconds ?? 3600
|
|
115
115
|
},
|
|
116
|
-
logger: input.logger
|
|
116
|
+
logger: input.logger,
|
|
117
|
+
fetch: input.fetch
|
|
117
118
|
};
|
|
118
119
|
}
|
|
119
120
|
|
|
@@ -645,9 +646,12 @@ var HttpClient = class {
|
|
|
645
646
|
constructor(opts) {
|
|
646
647
|
this.opts = opts;
|
|
647
648
|
this.sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
649
|
+
this.doFetch = opts.fetch ?? ((...args) => globalThis.fetch(...args));
|
|
648
650
|
}
|
|
649
651
|
opts;
|
|
650
652
|
sleep;
|
|
653
|
+
/** Resolved request fetch. The arrow keeps `globalThis.fetch` correctly bound. */
|
|
654
|
+
doFetch;
|
|
651
655
|
buildHeaders(o, token, isFormData) {
|
|
652
656
|
return {
|
|
653
657
|
...this.opts.requestContext?.language ? { "Accept-Language": this.opts.requestContext.language } : {},
|
|
@@ -703,7 +707,7 @@ var HttpClient = class {
|
|
|
703
707
|
let res;
|
|
704
708
|
let text;
|
|
705
709
|
try {
|
|
706
|
-
res = await Promise.race([
|
|
710
|
+
res = await Promise.race([this.doFetch(url, init), overallBudget]);
|
|
707
711
|
clearTimeout(connectTimer);
|
|
708
712
|
connectTimer = void 0;
|
|
709
713
|
const body = res.text();
|
|
@@ -807,7 +811,7 @@ var HttpClient = class {
|
|
|
807
811
|
init.body = isFormData ? o.body : JSON.stringify(o.body);
|
|
808
812
|
}
|
|
809
813
|
try {
|
|
810
|
-
return await
|
|
814
|
+
return await this.doFetch(url, init);
|
|
811
815
|
} catch (err) {
|
|
812
816
|
if (err.name === "AbortError") {
|
|
813
817
|
throw new EmporixTimeoutError(
|
|
@@ -886,7 +890,7 @@ var HttpClient = class {
|
|
|
886
890
|
};
|
|
887
891
|
|
|
888
892
|
// package.json
|
|
889
|
-
var version = "2.
|
|
893
|
+
var version = "2.25.0";
|
|
890
894
|
|
|
891
895
|
// src/version.ts
|
|
892
896
|
var SDK_VERSION = version;
|
|
@@ -925,7 +929,10 @@ function createCore(config) {
|
|
|
925
929
|
retry: cfg.retry,
|
|
926
930
|
timeouts: cfg.timeouts,
|
|
927
931
|
customerRefresh,
|
|
928
|
-
requestContext
|
|
932
|
+
requestContext,
|
|
933
|
+
// exactOptionalPropertyTypes: `{ fetch: undefined }` is a type error
|
|
934
|
+
// against `fetch?: typeof globalThis.fetch`, so spread conditionally.
|
|
935
|
+
...cfg.fetch !== void 0 ? { fetch: cfg.fetch } : {}
|
|
929
936
|
})
|
|
930
937
|
});
|
|
931
938
|
return {
|
|
@@ -1247,6 +1254,7 @@ function resolveQuery(q, cap) {
|
|
|
1247
1254
|
|
|
1248
1255
|
// src/services/product.ts
|
|
1249
1256
|
var ANON = { kind: "anonymous" };
|
|
1257
|
+
var SERVICE = { kind: "service" };
|
|
1250
1258
|
var ProductService = class {
|
|
1251
1259
|
constructor(ctx) {
|
|
1252
1260
|
this.ctx = ctx;
|
|
@@ -1410,11 +1418,200 @@ var ProductService = class {
|
|
|
1410
1418
|
}
|
|
1411
1419
|
return out;
|
|
1412
1420
|
}
|
|
1421
|
+
// --- Admin writes. Default auth: service. ---
|
|
1422
|
+
/**
|
|
1423
|
+
* Creates a product (`POST /products`). Default auth: service. Accepts any of
|
|
1424
|
+
* the five product shapes (basic, bundle, parent-variant, variant,
|
|
1425
|
+
* dynamic-variant).
|
|
1426
|
+
*/
|
|
1427
|
+
async create(input, options = {}, auth2 = SERVICE) {
|
|
1428
|
+
const query = {
|
|
1429
|
+
...options.skipVariantGeneration === void 0 ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) },
|
|
1430
|
+
...options.doIndex === void 0 ? {} : { doIndex: String(options.doIndex) },
|
|
1431
|
+
...options.skipRelatedItemsValidation === void 0 ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }
|
|
1432
|
+
};
|
|
1433
|
+
return this.ctx.http.request({
|
|
1434
|
+
method: "POST",
|
|
1435
|
+
path: `/product/${this.ctx.tenant}/products`,
|
|
1436
|
+
...Object.keys(query).length > 0 ? { query } : {},
|
|
1437
|
+
body: input,
|
|
1438
|
+
auth: auth2
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Partially updates a product (`PATCH /products/{productId}`). Default auth:
|
|
1443
|
+
* service. Use {@link replace} for a full replace (PUT).
|
|
1444
|
+
*/
|
|
1445
|
+
async update(productId, input, options = {}, auth2 = SERVICE) {
|
|
1446
|
+
const query = {
|
|
1447
|
+
...options.skipVariantGeneration === void 0 ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) },
|
|
1448
|
+
...options.doIndex === void 0 ? {} : { doIndex: String(options.doIndex) },
|
|
1449
|
+
...options.skipRelatedItemsValidation === void 0 ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }
|
|
1450
|
+
};
|
|
1451
|
+
await this.ctx.http.request({
|
|
1452
|
+
method: "PATCH",
|
|
1453
|
+
path: `/product/${this.ctx.tenant}/products/${productId}`,
|
|
1454
|
+
...Object.keys(query).length > 0 ? { query } : {},
|
|
1455
|
+
body: input,
|
|
1456
|
+
auth: auth2
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Full-replaces a product (`PUT /products/{productId}`). Returns the created
|
|
1461
|
+
* resource on 201 (upsert) and nothing on 204. `options.partial` sends
|
|
1462
|
+
* `?partial=true` for a merge-style replace. Default auth: service.
|
|
1463
|
+
*/
|
|
1464
|
+
async replace(productId, input, options = {}, auth2 = SERVICE) {
|
|
1465
|
+
const query = {
|
|
1466
|
+
...options.partial === void 0 ? {} : { partial: String(options.partial) },
|
|
1467
|
+
...options.skipVariantGeneration === void 0 ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) },
|
|
1468
|
+
...options.doIndex === void 0 ? {} : { doIndex: String(options.doIndex) },
|
|
1469
|
+
...options.skipRelatedItemsValidation === void 0 ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }
|
|
1470
|
+
};
|
|
1471
|
+
return this.ctx.http.request({
|
|
1472
|
+
method: "PUT",
|
|
1473
|
+
path: `/product/${this.ctx.tenant}/products/${productId}`,
|
|
1474
|
+
...Object.keys(query).length > 0 ? { query } : {},
|
|
1475
|
+
body: input,
|
|
1476
|
+
auth: auth2
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Deletes a product (`DELETE /products/{productId}`). `options.force` deletes
|
|
1481
|
+
* even when the product is referenced. Default auth: service.
|
|
1482
|
+
*/
|
|
1483
|
+
async delete(productId, options = {}, auth2 = SERVICE) {
|
|
1484
|
+
const query = {
|
|
1485
|
+
...options.force === void 0 ? {} : { force: String(options.force) },
|
|
1486
|
+
...options.doIndex === void 0 ? {} : { doIndex: String(options.doIndex) }
|
|
1487
|
+
};
|
|
1488
|
+
await this.ctx.http.request({
|
|
1489
|
+
method: "DELETE",
|
|
1490
|
+
path: `/product/${this.ctx.tenant}/products/${productId}`,
|
|
1491
|
+
...Object.keys(query).length > 0 ? { query } : {},
|
|
1492
|
+
auth: auth2
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Bulk-creates products (`POST /products/bulk`). Responds 207 Multi-Status:
|
|
1497
|
+
* partial failures do **not** throw — inspect each entry. Default auth: service.
|
|
1498
|
+
*/
|
|
1499
|
+
async bulkCreate(input, options = {}, auth2 = SERVICE) {
|
|
1500
|
+
const query = {
|
|
1501
|
+
...options.skipVariantGeneration === void 0 ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) },
|
|
1502
|
+
...options.doIndex === void 0 ? {} : { doIndex: String(options.doIndex) },
|
|
1503
|
+
...options.skipRelatedItemsValidation === void 0 ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }
|
|
1504
|
+
};
|
|
1505
|
+
return this.ctx.http.request({
|
|
1506
|
+
method: "POST",
|
|
1507
|
+
path: `/product/${this.ctx.tenant}/products/bulk`,
|
|
1508
|
+
...Object.keys(query).length > 0 ? { query } : {},
|
|
1509
|
+
body: input,
|
|
1510
|
+
auth: auth2
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Bulk-updates products (`PUT /products/bulk`). Responds 207 Multi-Status:
|
|
1515
|
+
* partial failures do **not** throw — inspect each entry. Default auth: service.
|
|
1516
|
+
*/
|
|
1517
|
+
async bulkUpdate(input, options = {}, auth2 = SERVICE) {
|
|
1518
|
+
const query = {
|
|
1519
|
+
...options.skipVariantGeneration === void 0 ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) },
|
|
1520
|
+
...options.doIndex === void 0 ? {} : { doIndex: String(options.doIndex) },
|
|
1521
|
+
...options.skipRelatedItemsValidation === void 0 ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }
|
|
1522
|
+
};
|
|
1523
|
+
return this.ctx.http.request({
|
|
1524
|
+
method: "PUT",
|
|
1525
|
+
path: `/product/${this.ctx.tenant}/products/bulk`,
|
|
1526
|
+
...Object.keys(query).length > 0 ? { query } : {},
|
|
1527
|
+
body: input,
|
|
1528
|
+
auth: auth2
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Triggers a dynamic-variant recalculation for the given product ids
|
|
1533
|
+
* (`POST /products/recalculate`, 202). The result carries the created or
|
|
1534
|
+
* already-referenced `jobs` plus `skippedProductIds` — products whose root
|
|
1535
|
+
* already has a PENDING/PROCESSING job. Default auth: service.
|
|
1536
|
+
*/
|
|
1537
|
+
async recalculate(input, auth2 = SERVICE) {
|
|
1538
|
+
return this.ctx.http.request({
|
|
1539
|
+
method: "POST",
|
|
1540
|
+
path: `/product/${this.ctx.tenant}/products/recalculate`,
|
|
1541
|
+
body: input,
|
|
1542
|
+
auth: auth2
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
/** Lists dynamic-variant recalculation jobs, optionally filtered by status. Default auth: anonymous. */
|
|
1546
|
+
async listRecalculationJobs(params = {}, auth2 = ANON) {
|
|
1547
|
+
return this.ctx.http.request({
|
|
1548
|
+
method: "GET",
|
|
1549
|
+
path: `/product/${this.ctx.tenant}/products/recalculate/jobs`,
|
|
1550
|
+
...params.status === void 0 ? {} : { query: { status: params.status } },
|
|
1551
|
+
auth: auth2
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
/** Fetches one dynamic-variant recalculation job by id. Default auth: anonymous. */
|
|
1555
|
+
async getRecalculationJob(jobId, auth2 = ANON) {
|
|
1556
|
+
return this.ctx.http.request({
|
|
1557
|
+
method: "GET",
|
|
1558
|
+
path: `/product/${this.ctx.tenant}/products/recalculate/jobs/${jobId}`,
|
|
1559
|
+
auth: auth2
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Product templates (`/product-templates`). Reads default to anonymous,
|
|
1564
|
+
* writes to service auth.
|
|
1565
|
+
*/
|
|
1566
|
+
templates = {
|
|
1567
|
+
/** One page of product templates. Default auth: anonymous. */
|
|
1568
|
+
list: async (params = {}, auth2 = ANON) => this.ctx.http.request({
|
|
1569
|
+
method: "GET",
|
|
1570
|
+
path: `/product/${this.ctx.tenant}/product-templates`,
|
|
1571
|
+
query: {
|
|
1572
|
+
...params.pageNumber === void 0 ? {} : { pageNumber: params.pageNumber },
|
|
1573
|
+
...params.pageSize === void 0 ? {} : { pageSize: params.pageSize },
|
|
1574
|
+
...params.sort === void 0 ? {} : { sort: params.sort },
|
|
1575
|
+
...params.q === void 0 ? {} : { q: params.q }
|
|
1576
|
+
},
|
|
1577
|
+
auth: auth2
|
|
1578
|
+
}),
|
|
1579
|
+
/** Fetches one product template by id. Default auth: anonymous. */
|
|
1580
|
+
get: async (templateId, auth2 = ANON) => this.ctx.http.request({
|
|
1581
|
+
method: "GET",
|
|
1582
|
+
path: `/product/${this.ctx.tenant}/product-templates/${templateId}`,
|
|
1583
|
+
auth: auth2
|
|
1584
|
+
}),
|
|
1585
|
+
/** Creates a product template. Default auth: service. */
|
|
1586
|
+
create: async (input, auth2 = SERVICE) => this.ctx.http.request({
|
|
1587
|
+
method: "POST",
|
|
1588
|
+
path: `/product/${this.ctx.tenant}/product-templates`,
|
|
1589
|
+
body: input,
|
|
1590
|
+
auth: auth2
|
|
1591
|
+
}),
|
|
1592
|
+
/** Full-replaces a product template (`PUT`). Default auth: service. */
|
|
1593
|
+
update: async (templateId, input, auth2 = SERVICE) => {
|
|
1594
|
+
await this.ctx.http.request({
|
|
1595
|
+
method: "PUT",
|
|
1596
|
+
path: `/product/${this.ctx.tenant}/product-templates/${templateId}`,
|
|
1597
|
+
body: input,
|
|
1598
|
+
auth: auth2
|
|
1599
|
+
});
|
|
1600
|
+
},
|
|
1601
|
+
/** Deletes a product template. Default auth: service. */
|
|
1602
|
+
delete: async (templateId, auth2 = SERVICE) => {
|
|
1603
|
+
await this.ctx.http.request({
|
|
1604
|
+
method: "DELETE",
|
|
1605
|
+
path: `/product/${this.ctx.tenant}/product-templates/${templateId}`,
|
|
1606
|
+
auth: auth2
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1413
1610
|
};
|
|
1414
1611
|
|
|
1415
1612
|
// src/services/category.ts
|
|
1416
1613
|
var ANON2 = { kind: "anonymous" };
|
|
1417
|
-
var
|
|
1614
|
+
var SERVICE2 = { kind: "service" };
|
|
1418
1615
|
var CategoryService = class {
|
|
1419
1616
|
constructor(ctx) {
|
|
1420
1617
|
this.ctx = ctx;
|
|
@@ -1479,7 +1676,7 @@ var CategoryService = class {
|
|
|
1479
1676
|
* Rebuild a category tree from its root (`POST /category-trees/{rootCategoryId}/rebuild`).
|
|
1480
1677
|
* Admin write — defaults to the service token. Returns the rebuilt tree.
|
|
1481
1678
|
*/
|
|
1482
|
-
async rebuildTree(rootCategoryId, auth2 =
|
|
1679
|
+
async rebuildTree(rootCategoryId, auth2 = SERVICE2) {
|
|
1483
1680
|
return this.ctx.http.request({
|
|
1484
1681
|
method: "POST",
|
|
1485
1682
|
path: `/category/${this.ctx.tenant}/category-trees/${encodeURIComponent(rootCategoryId)}/rebuild`,
|
|
@@ -1592,6 +1789,196 @@ var CategoryService = class {
|
|
|
1592
1789
|
auth: auth2
|
|
1593
1790
|
});
|
|
1594
1791
|
}
|
|
1792
|
+
// --- Admin write CRUD. Default auth: service. ---
|
|
1793
|
+
/**
|
|
1794
|
+
* Creates a category (`POST /categories`). Default auth: service.
|
|
1795
|
+
* `options.publish` sets the `publish` query flag (needs the
|
|
1796
|
+
* `category.category_publish` scope).
|
|
1797
|
+
*/
|
|
1798
|
+
async create(input, options = {}, auth2 = SERVICE2) {
|
|
1799
|
+
return this.ctx.http.request({
|
|
1800
|
+
method: "POST",
|
|
1801
|
+
path: `/category/${this.ctx.tenant}/categories`,
|
|
1802
|
+
...options.publish === void 0 ? {} : { query: { publish: String(options.publish) } },
|
|
1803
|
+
body: input,
|
|
1804
|
+
auth: auth2
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
/**
|
|
1808
|
+
* Full-replaces a category (`PUT /categories/{categoryId}`). This is an
|
|
1809
|
+
* upsert: with a caller-supplied id it may create (201, returns the id) or
|
|
1810
|
+
* update an existing one (204, returns nothing). Default auth: service.
|
|
1811
|
+
*/
|
|
1812
|
+
async update(categoryId, input, options = {}, auth2 = SERVICE2) {
|
|
1813
|
+
return this.ctx.http.request({
|
|
1814
|
+
method: "PUT",
|
|
1815
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}`,
|
|
1816
|
+
...options.publish === void 0 ? {} : { query: { publish: String(options.publish) } },
|
|
1817
|
+
body: input,
|
|
1818
|
+
auth: auth2
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* Partially updates a category (`PATCH /categories/{categoryId}`). Default
|
|
1823
|
+
* auth: service. `options.publish` sets the `publish` query flag.
|
|
1824
|
+
*/
|
|
1825
|
+
async patch(categoryId, input, options = {}, auth2 = SERVICE2) {
|
|
1826
|
+
await this.ctx.http.request({
|
|
1827
|
+
method: "PATCH",
|
|
1828
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}`,
|
|
1829
|
+
...options.publish === void 0 ? {} : { query: { publish: String(options.publish) } },
|
|
1830
|
+
body: input,
|
|
1831
|
+
auth: auth2
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
/** Deletes a category (`DELETE /categories/{categoryId}`). Default auth: service. */
|
|
1835
|
+
async delete(categoryId, auth2 = SERVICE2) {
|
|
1836
|
+
await this.ctx.http.request({
|
|
1837
|
+
method: "DELETE",
|
|
1838
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}`,
|
|
1839
|
+
auth: auth2
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
/**
|
|
1843
|
+
* Searches categories via `POST /categories/search`. Same query capability
|
|
1844
|
+
* as {@link search} (`compoundLogicalQuery: false` — Category rejects `or()`
|
|
1845
|
+
* filters); the POST body avoids URL-length limits for large `q` filters.
|
|
1846
|
+
* `params.showRoots` / `params.showUnpublished` are POST-only flags. Default
|
|
1847
|
+
* auth: anonymous.
|
|
1848
|
+
*/
|
|
1849
|
+
async searchByQuery(query, params = {}, auth2 = ANON2) {
|
|
1850
|
+
const q = resolveQuery(query, { compoundLogicalQuery: false });
|
|
1851
|
+
const pageNumber = params.pageNumber ?? 1;
|
|
1852
|
+
const pageSize = params.pageSize ?? 50;
|
|
1853
|
+
const items = await this.ctx.http.request({
|
|
1854
|
+
method: "POST",
|
|
1855
|
+
path: `/category/${this.ctx.tenant}/categories/search`,
|
|
1856
|
+
query: {
|
|
1857
|
+
pageNumber,
|
|
1858
|
+
pageSize,
|
|
1859
|
+
...params.sort === void 0 ? {} : { sort: params.sort },
|
|
1860
|
+
...params.showRoots === void 0 ? {} : { showRoots: String(params.showRoots) },
|
|
1861
|
+
...params.showUnpublished === void 0 ? {} : { showUnpublished: String(params.showUnpublished) }
|
|
1862
|
+
},
|
|
1863
|
+
body: { q },
|
|
1864
|
+
idempotent: true,
|
|
1865
|
+
// pure read over POST — safe to replay on 5xx/429
|
|
1866
|
+
auth: auth2
|
|
1867
|
+
});
|
|
1868
|
+
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
1869
|
+
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Searches category trees via `POST /category-trees/search` — returns the
|
|
1872
|
+
* trees that include at least one of the given `categoryIds`. Default auth:
|
|
1873
|
+
* anonymous.
|
|
1874
|
+
*/
|
|
1875
|
+
async searchTrees(input, options = {}, auth2 = ANON2) {
|
|
1876
|
+
return this.ctx.http.request({
|
|
1877
|
+
method: "POST",
|
|
1878
|
+
path: `/category/${this.ctx.tenant}/category-trees/search`,
|
|
1879
|
+
...options.showUnpublished === void 0 ? {} : { query: { showUnpublished: String(options.showUnpublished) } },
|
|
1880
|
+
body: input,
|
|
1881
|
+
idempotent: true,
|
|
1882
|
+
// pure read over POST — safe to replay on 5xx/429
|
|
1883
|
+
auth: auth2
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Category ↔ resource assignments. Writes default to service auth. The
|
|
1888
|
+
* assignment `ref.type` is `'PRODUCT'` (per the API); category hierarchy is
|
|
1889
|
+
* managed via `parentId` on the category, not via assignments.
|
|
1890
|
+
*/
|
|
1891
|
+
assignments = {
|
|
1892
|
+
/** One page of a category's assignments. Default auth: anonymous. */
|
|
1893
|
+
list: async (categoryId, params = {}, auth2 = ANON2) => this.ctx.http.request({
|
|
1894
|
+
method: "GET",
|
|
1895
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments`,
|
|
1896
|
+
query: {
|
|
1897
|
+
...params.pageNumber === void 0 ? {} : { pageNumber: params.pageNumber },
|
|
1898
|
+
...params.pageSize === void 0 ? {} : { pageSize: params.pageSize },
|
|
1899
|
+
...params.sort === void 0 ? {} : { sort: params.sort },
|
|
1900
|
+
...params.expandSupercategoriesIds === void 0 ? {} : { expandSupercategoriesIds: String(params.expandSupercategoriesIds) },
|
|
1901
|
+
...params.showUnpublished === void 0 ? {} : { showUnpublished: String(params.showUnpublished) }
|
|
1902
|
+
},
|
|
1903
|
+
auth: auth2
|
|
1904
|
+
}),
|
|
1905
|
+
/** Assigns a single resource to a category (`POST …/assignments`). Default auth: service. */
|
|
1906
|
+
create: async (categoryId, input, auth2 = SERVICE2) => this.ctx.http.request({
|
|
1907
|
+
method: "POST",
|
|
1908
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments`,
|
|
1909
|
+
body: input,
|
|
1910
|
+
auth: auth2
|
|
1911
|
+
}),
|
|
1912
|
+
/** Bulk-assigns resources to a category (`POST …/assignments/bulk`). Default auth: service. */
|
|
1913
|
+
bulkCreate: async (categoryId, input, auth2 = SERVICE2) => this.ctx.http.request({
|
|
1914
|
+
method: "POST",
|
|
1915
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments/bulk`,
|
|
1916
|
+
body: input,
|
|
1917
|
+
auth: auth2
|
|
1918
|
+
}),
|
|
1919
|
+
/** Removes one assignment by id (`DELETE …/assignments/{assignmentId}`). Default auth: service. */
|
|
1920
|
+
remove: async (categoryId, assignmentId, auth2 = SERVICE2) => {
|
|
1921
|
+
await this.ctx.http.request({
|
|
1922
|
+
method: "DELETE",
|
|
1923
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments/${assignmentId}`,
|
|
1924
|
+
auth: auth2
|
|
1925
|
+
});
|
|
1926
|
+
},
|
|
1927
|
+
/** Removes all of a category's assignments (`DELETE …/assignments`). Default auth: service. */
|
|
1928
|
+
removeAll: async (categoryId, options = {}, auth2 = SERVICE2) => {
|
|
1929
|
+
await this.ctx.http.request({
|
|
1930
|
+
method: "DELETE",
|
|
1931
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments`,
|
|
1932
|
+
...options.assignmentType === void 0 ? {} : { query: { assignmentType: options.assignmentType } },
|
|
1933
|
+
auth: auth2
|
|
1934
|
+
});
|
|
1935
|
+
},
|
|
1936
|
+
/** Upserts an assignment by reference id — no body (`PUT …/assignments/references/{referenceId}`). Default auth: service. */
|
|
1937
|
+
upsertByReference: async (categoryId, referenceId, auth2 = SERVICE2) => this.ctx.http.request({
|
|
1938
|
+
method: "PUT",
|
|
1939
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments/references/${referenceId}`,
|
|
1940
|
+
auth: auth2
|
|
1941
|
+
}),
|
|
1942
|
+
/** Removes an assignment by reference id (`DELETE …/assignments/references/{referenceId}`). Default auth: service. */
|
|
1943
|
+
removeByReference: async (categoryId, referenceId, auth2 = SERVICE2) => {
|
|
1944
|
+
await this.ctx.http.request({
|
|
1945
|
+
method: "DELETE",
|
|
1946
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments/references/${referenceId}`,
|
|
1947
|
+
auth: auth2
|
|
1948
|
+
});
|
|
1949
|
+
},
|
|
1950
|
+
/** Bulk-upserts assignment references (`PUT …/assignments/references/bulk`). Default auth: service. */
|
|
1951
|
+
bulkUpsertByReference: async (categoryId, input, auth2 = SERVICE2) => this.ctx.http.request({
|
|
1952
|
+
method: "PUT",
|
|
1953
|
+
path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments/references/bulk`,
|
|
1954
|
+
body: input,
|
|
1955
|
+
auth: auth2
|
|
1956
|
+
}),
|
|
1957
|
+
/**
|
|
1958
|
+
* Lists every category assigned to the given reference id — tenant-wide
|
|
1959
|
+
* (`GET /assignments/references/{referenceId}`). Default auth: anonymous.
|
|
1960
|
+
*/
|
|
1961
|
+
listCategoriesByReference: async (referenceId, params = {}, auth2 = ANON2) => this.ctx.http.request({
|
|
1962
|
+
method: "GET",
|
|
1963
|
+
path: `/category/${this.ctx.tenant}/assignments/references/${referenceId}`,
|
|
1964
|
+
query: {
|
|
1965
|
+
...params.pageNumber === void 0 ? {} : { pageNumber: params.pageNumber },
|
|
1966
|
+
...params.pageSize === void 0 ? {} : { pageSize: params.pageSize },
|
|
1967
|
+
...params.sort === void 0 ? {} : { sort: params.sort },
|
|
1968
|
+
...params.showUnpublished === void 0 ? {} : { showUnpublished: String(params.showUnpublished) },
|
|
1969
|
+
...params.expandSupercategoriesIds === void 0 ? {} : { expandSupercategoriesIds: String(params.expandSupercategoriesIds) }
|
|
1970
|
+
},
|
|
1971
|
+
auth: auth2
|
|
1972
|
+
}),
|
|
1973
|
+
/** Removes all assignments to a given reference id — tenant-wide (`DELETE /assignments/references/{referenceId}`). Default auth: service. */
|
|
1974
|
+
removeAllByReference: async (referenceId, auth2 = SERVICE2) => {
|
|
1975
|
+
await this.ctx.http.request({
|
|
1976
|
+
method: "DELETE",
|
|
1977
|
+
path: `/category/${this.ctx.tenant}/assignments/references/${referenceId}`,
|
|
1978
|
+
auth: auth2
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1595
1982
|
};
|
|
1596
1983
|
|
|
1597
1984
|
// src/services/cart.ts
|
|
@@ -1807,23 +2194,62 @@ var CartService = class {
|
|
|
1807
2194
|
body: items
|
|
1808
2195
|
});
|
|
1809
2196
|
}
|
|
1810
|
-
/**
|
|
2197
|
+
/**
|
|
2198
|
+
* Sets the cart's shipping address, preserving the billing address.
|
|
2199
|
+
*
|
|
2200
|
+
* The API has no per-type address endpoint: addresses live in the cart's
|
|
2201
|
+
* `addresses` array, written via `PUT /carts/{cartId}`. That array is a **full
|
|
2202
|
+
* replace** — sending only one type leaves the other as an empty stub — so
|
|
2203
|
+
* this method reads the cart, merges, writes, and re-fetches. Use
|
|
2204
|
+
* {@link setAddresses} to set both in a single request.
|
|
2205
|
+
*/
|
|
1811
2206
|
async setShippingAddress(cartId, address, auth2) {
|
|
1812
|
-
return this.
|
|
2207
|
+
return this.mergeAddress(cartId, address, "SHIPPING", requireCartAuth(auth2));
|
|
2208
|
+
}
|
|
2209
|
+
/**
|
|
2210
|
+
* Sets the cart's billing address, preserving the shipping address. See
|
|
2211
|
+
* {@link setShippingAddress} for why this reads before writing.
|
|
2212
|
+
*/
|
|
2213
|
+
async setBillingAddress(cartId, address, auth2) {
|
|
2214
|
+
return this.mergeAddress(cartId, address, "BILLING", requireCartAuth(auth2));
|
|
2215
|
+
}
|
|
2216
|
+
/**
|
|
2217
|
+
* Sets both cart addresses in one request (`PUT /carts/{cartId}`), skipping
|
|
2218
|
+
* the read that {@link setShippingAddress} needs.
|
|
2219
|
+
*
|
|
2220
|
+
* **This replaces the cart's address set**: a type you omit is cleared, and
|
|
2221
|
+
* `{}` clears both. Use it when you already hold both addresses (a checkout
|
|
2222
|
+
* form submitting them together); use the per-type setters to change one and
|
|
2223
|
+
* keep the other.
|
|
2224
|
+
*/
|
|
2225
|
+
async setAddresses(cartId, addresses, auth2) {
|
|
2226
|
+
const cartAuth = requireCartAuth(auth2);
|
|
2227
|
+
const next = [];
|
|
2228
|
+
if (addresses.shipping) next.push({ ...addresses.shipping, type: "SHIPPING" });
|
|
2229
|
+
if (addresses.billing) next.push({ ...addresses.billing, type: "BILLING" });
|
|
2230
|
+
await this.ctx.http.request({
|
|
1813
2231
|
method: "PUT",
|
|
1814
|
-
path: `${this.base()}/${cartId}
|
|
1815
|
-
auth:
|
|
1816
|
-
body:
|
|
2232
|
+
path: `${this.base()}/${cartId}`,
|
|
2233
|
+
auth: cartAuth,
|
|
2234
|
+
body: { addresses: next }
|
|
1817
2235
|
});
|
|
2236
|
+
return this.get(cartId, cartAuth);
|
|
1818
2237
|
}
|
|
1819
|
-
/**
|
|
1820
|
-
|
|
1821
|
-
|
|
2238
|
+
/**
|
|
2239
|
+
* Reads the cart, replaces the entry of `type` with `address` (keeping every
|
|
2240
|
+
* other type verbatim — resending it unchanged is what stops the server from
|
|
2241
|
+
* wiping it), writes, and returns the re-fetched cart.
|
|
2242
|
+
*/
|
|
2243
|
+
async mergeAddress(cartId, address, type, cartAuth) {
|
|
2244
|
+
const current = await this.get(cartId, cartAuth);
|
|
2245
|
+
const others = (current.addresses ?? []).filter((a) => a.type !== type);
|
|
2246
|
+
await this.ctx.http.request({
|
|
1822
2247
|
method: "PUT",
|
|
1823
|
-
path: `${this.base()}/${cartId}
|
|
1824
|
-
auth:
|
|
1825
|
-
body: address
|
|
2248
|
+
path: `${this.base()}/${cartId}`,
|
|
2249
|
+
auth: cartAuth,
|
|
2250
|
+
body: { addresses: [...others, { ...address, type }] }
|
|
1826
2251
|
});
|
|
2252
|
+
return this.get(cartId, cartAuth);
|
|
1827
2253
|
}
|
|
1828
2254
|
/**
|
|
1829
2255
|
* Merges one or more anonymous carts into the specified customer cart.
|
|
@@ -1841,18 +2267,124 @@ var CartService = class {
|
|
|
1841
2267
|
body: { carts: anonymousCartIds }
|
|
1842
2268
|
});
|
|
1843
2269
|
}
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
2270
|
+
/**
|
|
2271
|
+
* Searches carts tenant-wide (`POST /carts/search`, body `{ q }`). This is a
|
|
2272
|
+
* backend/admin operation — a customer token cannot scan other customers'
|
|
2273
|
+
* carts, so `auth` is forwarded unguarded (pass a service token for admin
|
|
2274
|
+
* use). The server enforces scope (403 on insufficient).
|
|
2275
|
+
*/
|
|
2276
|
+
async search(query, auth2, params = {}) {
|
|
2277
|
+
return this.ctx.http.request({
|
|
2278
|
+
method: "POST",
|
|
2279
|
+
path: `${this.base()}/search`,
|
|
2280
|
+
query: {
|
|
2281
|
+
...params.pageNumber === void 0 ? {} : { pageNumber: params.pageNumber },
|
|
2282
|
+
...params.pageSize === void 0 ? {} : { pageSize: params.pageSize },
|
|
2283
|
+
...params.sort === void 0 ? {} : { sort: params.sort },
|
|
2284
|
+
...params.fields === void 0 ? {} : { fields: params.fields }
|
|
2285
|
+
},
|
|
2286
|
+
body: query,
|
|
2287
|
+
idempotent: true,
|
|
2288
|
+
// pure read over POST — safe to replay on 5xx/429
|
|
2289
|
+
auth: auth2
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Deletes a cart (`DELETE /carts/{cartId}`). Backend/admin or owner
|
|
2294
|
+
* operation — `auth` is forwarded unguarded (service or customer). Returns
|
|
2295
|
+
* nothing; the cart no longer exists.
|
|
2296
|
+
*/
|
|
2297
|
+
async delete(cartId, auth2) {
|
|
2298
|
+
await this.ctx.http.request({
|
|
2299
|
+
method: "DELETE",
|
|
2300
|
+
path: `${this.base()}/${cartId}`,
|
|
2301
|
+
auth: auth2
|
|
2302
|
+
});
|
|
2303
|
+
}
|
|
2304
|
+
/**
|
|
2305
|
+
* Full-updates a cart (`PUT /carts/{cartId}`, body `UpdateCart`). Backend or
|
|
2306
|
+
* owner operation — `auth` is forwarded unguarded. The endpoint returns 204,
|
|
2307
|
+
* so the cart is re-fetched with the same `auth` (via a direct GET, not
|
|
2308
|
+
* `get()`, so a service token is not rejected by the cart-auth guard) and
|
|
2309
|
+
* returned.
|
|
2310
|
+
*/
|
|
2311
|
+
async update(cartId, input, auth2) {
|
|
2312
|
+
await this.ctx.http.request({
|
|
2313
|
+
method: "PUT",
|
|
2314
|
+
path: `${this.base()}/${cartId}`,
|
|
2315
|
+
auth: auth2,
|
|
2316
|
+
body: input
|
|
2317
|
+
});
|
|
2318
|
+
return this.ctx.http.request({
|
|
2319
|
+
method: "GET",
|
|
2320
|
+
path: `${this.base()}/${cartId}`,
|
|
2321
|
+
auth: auth2
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
2324
|
+
/** Fetches a single cart item's details (`GET /carts/{cartId}/items/{itemId}`). */
|
|
2325
|
+
async getItem(cartId, itemId, auth2) {
|
|
2326
|
+
return this.ctx.http.request({
|
|
2327
|
+
method: "GET",
|
|
2328
|
+
path: `${this.base()}/${cartId}/items/${itemId}`,
|
|
2329
|
+
auth: requireCartAuth(auth2)
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
/** Lists the discounts applied to a cart (`GET /carts/{cartId}/discounts`). */
|
|
2333
|
+
async listDiscounts(cartId, auth2) {
|
|
2334
|
+
return this.ctx.http.request({
|
|
2335
|
+
method: "GET",
|
|
2336
|
+
path: `${this.base()}/${cartId}/discounts`,
|
|
2337
|
+
auth: requireCartAuth(auth2)
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* Removes all discounts from a cart (`DELETE /carts/{cartId}/discounts` with
|
|
2342
|
+
* no `codes` filter), then re-fetches and returns the updated cart. Use
|
|
2343
|
+
* `removeCoupon(code)` to remove a specific coupon by code.
|
|
2344
|
+
*/
|
|
2345
|
+
async removeAllDiscounts(cartId, auth2) {
|
|
2346
|
+
const cartAuth = requireCartAuth(auth2);
|
|
2347
|
+
await this.ctx.http.request({
|
|
2348
|
+
method: "DELETE",
|
|
2349
|
+
path: `${this.base()}/${cartId}/discounts`,
|
|
2350
|
+
auth: cartAuth
|
|
2351
|
+
});
|
|
2352
|
+
return this.get(cartId, cartAuth);
|
|
2353
|
+
}
|
|
2354
|
+
/**
|
|
2355
|
+
* Removes a single discount by its index (`DELETE
|
|
2356
|
+
* /carts/{cartId}/discounts/{discountIndex}`), then re-fetches and returns
|
|
2357
|
+
* the updated cart.
|
|
2358
|
+
*/
|
|
2359
|
+
async removeDiscountByIndex(cartId, discountIndex, auth2) {
|
|
2360
|
+
const cartAuth = requireCartAuth(auth2);
|
|
2361
|
+
await this.ctx.http.request({
|
|
2362
|
+
method: "DELETE",
|
|
2363
|
+
path: `${this.base()}/${cartId}/discounts/${discountIndex}`,
|
|
2364
|
+
auth: cartAuth
|
|
2365
|
+
});
|
|
2366
|
+
return this.get(cartId, cartAuth);
|
|
2367
|
+
}
|
|
2368
|
+
/** Retrieves the cart's lead-time and non-delivery-time restrictions (`GET /carts/{cartId}/dtRestrictions`). */
|
|
2369
|
+
async getDeliveryRestrictions(cartId, auth2) {
|
|
2370
|
+
return this.ctx.http.request({
|
|
2371
|
+
method: "GET",
|
|
2372
|
+
path: `${this.base()}/${cartId}/dtRestrictions`,
|
|
2373
|
+
auth: requireCartAuth(auth2)
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2377
|
+
|
|
2378
|
+
// src/services/checkout.ts
|
|
2379
|
+
function isGuest(customer) {
|
|
2380
|
+
return customer?.guest === true;
|
|
2381
|
+
}
|
|
2382
|
+
function resolveAuth(auth2, guest) {
|
|
2383
|
+
if (auth2 && (auth2.kind === "customer" || auth2.kind === "raw")) return auth2;
|
|
2384
|
+
if (guest && auth2 && auth2.kind === "anonymous") return auth2;
|
|
2385
|
+
throw new EmporixAuthError(
|
|
2386
|
+
"checkout requires a customer/raw AuthContext (or anonymous for a guest checkout)"
|
|
2387
|
+
);
|
|
1856
2388
|
}
|
|
1857
2389
|
var CheckoutService = class {
|
|
1858
2390
|
constructor(ctx) {
|
|
@@ -1898,6 +2430,7 @@ var CheckoutService = class {
|
|
|
1898
2430
|
|
|
1899
2431
|
// src/services/payment.ts
|
|
1900
2432
|
var ANON3 = auth.anonymous();
|
|
2433
|
+
var SERVICE3 = auth.service();
|
|
1901
2434
|
var PaymentGatewayService = class {
|
|
1902
2435
|
constructor(ctx) {
|
|
1903
2436
|
this.ctx = ctx;
|
|
@@ -1942,6 +2475,112 @@ var PaymentGatewayService = class {
|
|
|
1942
2475
|
body: input
|
|
1943
2476
|
});
|
|
1944
2477
|
}
|
|
2478
|
+
/**
|
|
2479
|
+
* Payment-mode **configuration** (`/paymentmodes/config`) — the admin view.
|
|
2480
|
+
* For the storefront view use {@link listPaymentModes} / {@link getMode}.
|
|
2481
|
+
* Defaults to service auth.
|
|
2482
|
+
*/
|
|
2483
|
+
modes = {
|
|
2484
|
+
/** Lists all configured payment modes. The endpoint takes no query parameters. */
|
|
2485
|
+
list: async (authCtx = SERVICE3) => this.ctx.http.request({
|
|
2486
|
+
method: "GET",
|
|
2487
|
+
path: `/payment-gateway/${this.ctx.tenant}/paymentmodes/config`,
|
|
2488
|
+
auth: authCtx
|
|
2489
|
+
}),
|
|
2490
|
+
/** Retrieves one payment-mode configuration by id. */
|
|
2491
|
+
get: async (id, authCtx = SERVICE3) => this.ctx.http.request({
|
|
2492
|
+
method: "GET",
|
|
2493
|
+
path: `/payment-gateway/${this.ctx.tenant}/paymentmodes/config/${id}`,
|
|
2494
|
+
auth: authCtx
|
|
2495
|
+
}),
|
|
2496
|
+
/** Creates a payment-mode configuration. Responds 200 with the created mode. */
|
|
2497
|
+
create: async (input, authCtx = SERVICE3) => this.ctx.http.request({
|
|
2498
|
+
method: "POST",
|
|
2499
|
+
path: `/payment-gateway/${this.ctx.tenant}/paymentmodes/config`,
|
|
2500
|
+
body: input,
|
|
2501
|
+
auth: authCtx
|
|
2502
|
+
}),
|
|
2503
|
+
/** Updates a payment-mode configuration (PUT). Responds 200 with the updated mode. */
|
|
2504
|
+
update: async (id, input, authCtx = SERVICE3) => this.ctx.http.request({
|
|
2505
|
+
method: "PUT",
|
|
2506
|
+
path: `/payment-gateway/${this.ctx.tenant}/paymentmodes/config/${id}`,
|
|
2507
|
+
body: input,
|
|
2508
|
+
auth: authCtx
|
|
2509
|
+
}),
|
|
2510
|
+
/** Deletes a payment-mode configuration. */
|
|
2511
|
+
delete: async (id, authCtx = SERVICE3) => {
|
|
2512
|
+
await this.ctx.http.request({
|
|
2513
|
+
method: "DELETE",
|
|
2514
|
+
path: `/payment-gateway/${this.ctx.tenant}/paymentmodes/config/${id}`,
|
|
2515
|
+
auth: authCtx
|
|
2516
|
+
});
|
|
2517
|
+
}
|
|
2518
|
+
};
|
|
2519
|
+
/**
|
|
2520
|
+
* Backend transaction lifecycle and reads. `authorize` creates the transaction
|
|
2521
|
+
* that `capture`/`refund`/`cancel` then act on. Business failures are reported
|
|
2522
|
+
* in the response body (`successful: false`), not as HTTP errors — always check
|
|
2523
|
+
* `successful`. Defaults to service auth.
|
|
2524
|
+
*/
|
|
2525
|
+
transactions = {
|
|
2526
|
+
/** One page of payment transactions. */
|
|
2527
|
+
list: async (params = {}, authCtx = SERVICE3) => {
|
|
2528
|
+
const query = {
|
|
2529
|
+
...params.pageNumber === void 0 ? {} : { pageNumber: params.pageNumber },
|
|
2530
|
+
...params.pageSize === void 0 ? {} : { pageSize: params.pageSize },
|
|
2531
|
+
...params.sort === void 0 ? {} : { sort: params.sort }
|
|
2532
|
+
};
|
|
2533
|
+
return this.ctx.http.request({
|
|
2534
|
+
method: "GET",
|
|
2535
|
+
path: `/payment-gateway/${this.ctx.tenant}/transactions`,
|
|
2536
|
+
...Object.keys(query).length > 0 ? { query } : {},
|
|
2537
|
+
auth: authCtx
|
|
2538
|
+
});
|
|
2539
|
+
},
|
|
2540
|
+
/** Retrieves one payment transaction by id. */
|
|
2541
|
+
get: async (transactionId, authCtx = SERVICE3) => this.ctx.http.request({
|
|
2542
|
+
method: "GET",
|
|
2543
|
+
path: `/payment-gateway/${this.ctx.tenant}/transactions/${transactionId}`,
|
|
2544
|
+
auth: authCtx
|
|
2545
|
+
}),
|
|
2546
|
+
/**
|
|
2547
|
+
* Authorizes a payment as a backend caller (`POST /payment/authorize`). The
|
|
2548
|
+
* storefront equivalent is {@link PaymentGatewayService.authorize}, which
|
|
2549
|
+
* targets `/payment/frontend/authorize` with a customer token.
|
|
2550
|
+
*/
|
|
2551
|
+
authorize: async (input, authCtx = SERVICE3) => this.ctx.http.request({
|
|
2552
|
+
method: "POST",
|
|
2553
|
+
path: `/payment-gateway/${this.ctx.tenant}/payment/authorize`,
|
|
2554
|
+
body: input,
|
|
2555
|
+
auth: authCtx
|
|
2556
|
+
}),
|
|
2557
|
+
/**
|
|
2558
|
+
* Captures an authorized payment. Omit `input` to capture the full
|
|
2559
|
+
* authorized amount. Returns the provider's `captureId` on success.
|
|
2560
|
+
*/
|
|
2561
|
+
capture: async (transactionId, input, authCtx = SERVICE3) => this.ctx.http.request({
|
|
2562
|
+
method: "POST",
|
|
2563
|
+
path: `/payment-gateway/${this.ctx.tenant}/payment/${transactionId}/capture`,
|
|
2564
|
+
...input === void 0 ? {} : { body: input },
|
|
2565
|
+
auth: authCtx
|
|
2566
|
+
}),
|
|
2567
|
+
/**
|
|
2568
|
+
* Refunds a captured payment. Omit `input` to refund the full captured
|
|
2569
|
+
* amount; pass `captureId` when several captures exist for the payment.
|
|
2570
|
+
*/
|
|
2571
|
+
refund: async (transactionId, input, authCtx = SERVICE3) => this.ctx.http.request({
|
|
2572
|
+
method: "POST",
|
|
2573
|
+
path: `/payment-gateway/${this.ctx.tenant}/payment/${transactionId}/refund`,
|
|
2574
|
+
...input === void 0 ? {} : { body: input },
|
|
2575
|
+
auth: authCtx
|
|
2576
|
+
}),
|
|
2577
|
+
/** Cancels an authorized payment. Takes no body. */
|
|
2578
|
+
cancel: async (transactionId, authCtx = SERVICE3) => this.ctx.http.request({
|
|
2579
|
+
method: "POST",
|
|
2580
|
+
path: `/payment-gateway/${this.ctx.tenant}/payment/${transactionId}/cancel`,
|
|
2581
|
+
auth: authCtx
|
|
2582
|
+
})
|
|
2583
|
+
};
|
|
1945
2584
|
};
|
|
1946
2585
|
|
|
1947
2586
|
// src/services/price.ts
|
|
@@ -1956,7 +2595,7 @@ function normalizeMatch(raw) {
|
|
|
1956
2595
|
return { ...base, itemId, itemRef };
|
|
1957
2596
|
}
|
|
1958
2597
|
var ANON4 = { kind: "anonymous" };
|
|
1959
|
-
var
|
|
2598
|
+
var SERVICE4 = { kind: "service" };
|
|
1960
2599
|
function requireContextAuth(auth2) {
|
|
1961
2600
|
const a = auth2 ?? ANON4;
|
|
1962
2601
|
if (a.kind === "anonymous" || a.kind === "customer" || a.kind === "raw") return a;
|
|
@@ -1990,7 +2629,7 @@ var PriceService = class {
|
|
|
1990
2629
|
* Resolves prices from an explicit context. Default auth: service
|
|
1991
2630
|
* (requires `price.price_read` / `price.price_manage`).
|
|
1992
2631
|
*/
|
|
1993
|
-
async match(input, auth2 =
|
|
2632
|
+
async match(input, auth2 = SERVICE4) {
|
|
1994
2633
|
const rows = await this.ctx.http.request({
|
|
1995
2634
|
method: "POST",
|
|
1996
2635
|
path: `/price/${this.ctx.tenant}/match-prices`,
|
|
@@ -2045,10 +2684,207 @@ var PriceService = class {
|
|
|
2045
2684
|
await Promise.all(Array.from({ length: workerCount }, () => worker()));
|
|
2046
2685
|
return results.flat();
|
|
2047
2686
|
}
|
|
2687
|
+
// --- Admin CRUD (flat prices). Default auth: service. ---
|
|
2688
|
+
/** Creates a flat price. Default auth: service. */
|
|
2689
|
+
async create(input, authCtx = SERVICE4) {
|
|
2690
|
+
return this.ctx.http.request({
|
|
2691
|
+
method: "POST",
|
|
2692
|
+
path: `/price/${this.ctx.tenant}/prices`,
|
|
2693
|
+
auth: authCtx,
|
|
2694
|
+
body: input
|
|
2695
|
+
});
|
|
2696
|
+
}
|
|
2697
|
+
/** Lists flat prices. Default auth: service. */
|
|
2698
|
+
async list(query, authCtx = SERVICE4) {
|
|
2699
|
+
return this.ctx.http.request({
|
|
2700
|
+
method: "GET",
|
|
2701
|
+
path: `/price/${this.ctx.tenant}/prices`,
|
|
2702
|
+
auth: authCtx,
|
|
2703
|
+
...query ? { query } : {}
|
|
2704
|
+
});
|
|
2705
|
+
}
|
|
2706
|
+
/** Retrieves one flat price by id. Default auth: service. */
|
|
2707
|
+
async get(priceId, authCtx = SERVICE4) {
|
|
2708
|
+
return this.ctx.http.request({
|
|
2709
|
+
method: "GET",
|
|
2710
|
+
path: `/price/${this.ctx.tenant}/prices/${priceId}`,
|
|
2711
|
+
auth: authCtx
|
|
2712
|
+
});
|
|
2713
|
+
}
|
|
2714
|
+
/** Upserts a flat price by id (PUT). Default auth: service. */
|
|
2715
|
+
async upsert(priceId, input, authCtx = SERVICE4) {
|
|
2716
|
+
return this.ctx.http.request({
|
|
2717
|
+
method: "PUT",
|
|
2718
|
+
path: `/price/${this.ctx.tenant}/prices/${priceId}`,
|
|
2719
|
+
auth: authCtx,
|
|
2720
|
+
body: input
|
|
2721
|
+
});
|
|
2722
|
+
}
|
|
2723
|
+
/** Deletes a flat price by id. Default auth: service. */
|
|
2724
|
+
async delete(priceId, authCtx = SERVICE4) {
|
|
2725
|
+
await this.ctx.http.request({
|
|
2726
|
+
method: "DELETE",
|
|
2727
|
+
path: `/price/${this.ctx.tenant}/prices/${priceId}`,
|
|
2728
|
+
auth: authCtx
|
|
2729
|
+
});
|
|
2730
|
+
}
|
|
2731
|
+
/** Searches flat prices (POST body query). Default auth: service. */
|
|
2732
|
+
async search(query, authCtx = SERVICE4) {
|
|
2733
|
+
return this.ctx.http.request({
|
|
2734
|
+
method: "POST",
|
|
2735
|
+
path: `/price/${this.ctx.tenant}/prices/search`,
|
|
2736
|
+
auth: authCtx,
|
|
2737
|
+
body: query
|
|
2738
|
+
});
|
|
2739
|
+
}
|
|
2740
|
+
/** Creates multiple flat prices in one request. Default auth: service. */
|
|
2741
|
+
async bulkCreate(inputs, authCtx = SERVICE4) {
|
|
2742
|
+
return this.ctx.http.request({
|
|
2743
|
+
method: "POST",
|
|
2744
|
+
path: `/price/${this.ctx.tenant}/prices/bulk`,
|
|
2745
|
+
auth: authCtx,
|
|
2746
|
+
body: inputs
|
|
2747
|
+
});
|
|
2748
|
+
}
|
|
2749
|
+
/** Upserts multiple flat prices in one request (PUT). Default auth: service. */
|
|
2750
|
+
async bulkUpsert(inputs, authCtx = SERVICE4) {
|
|
2751
|
+
return this.ctx.http.request({
|
|
2752
|
+
method: "PUT",
|
|
2753
|
+
path: `/price/${this.ctx.tenant}/prices/bulk`,
|
|
2754
|
+
auth: authCtx,
|
|
2755
|
+
body: inputs
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2758
|
+
/** Price-model admin CRUD (`/priceModels`). Default auth: service. */
|
|
2759
|
+
models = {
|
|
2760
|
+
list: async (query, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2761
|
+
method: "GET",
|
|
2762
|
+
path: `/price/${this.ctx.tenant}/priceModels`,
|
|
2763
|
+
auth: authCtx,
|
|
2764
|
+
...query ? { query } : {}
|
|
2765
|
+
}),
|
|
2766
|
+
create: async (input, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2767
|
+
method: "POST",
|
|
2768
|
+
path: `/price/${this.ctx.tenant}/priceModels`,
|
|
2769
|
+
auth: authCtx,
|
|
2770
|
+
body: input
|
|
2771
|
+
}),
|
|
2772
|
+
get: async (modelId, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2773
|
+
method: "GET",
|
|
2774
|
+
path: `/price/${this.ctx.tenant}/priceModels/${modelId}`,
|
|
2775
|
+
auth: authCtx
|
|
2776
|
+
}),
|
|
2777
|
+
upsert: async (modelId, input, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2778
|
+
method: "PUT",
|
|
2779
|
+
path: `/price/${this.ctx.tenant}/priceModels/${modelId}`,
|
|
2780
|
+
auth: authCtx,
|
|
2781
|
+
body: input
|
|
2782
|
+
}),
|
|
2783
|
+
delete: async (modelId, authCtx = SERVICE4) => {
|
|
2784
|
+
await this.ctx.http.request({
|
|
2785
|
+
method: "DELETE",
|
|
2786
|
+
path: `/price/${this.ctx.tenant}/priceModels/${modelId}`,
|
|
2787
|
+
auth: authCtx
|
|
2788
|
+
});
|
|
2789
|
+
}
|
|
2790
|
+
};
|
|
2791
|
+
/** Price-list admin CRUD (`/price-lists`) + nested price management. Default auth: service. */
|
|
2792
|
+
lists = {
|
|
2793
|
+
list: async (query, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2794
|
+
method: "GET",
|
|
2795
|
+
path: `/price/${this.ctx.tenant}/price-lists`,
|
|
2796
|
+
auth: authCtx,
|
|
2797
|
+
...query ? { query } : {}
|
|
2798
|
+
}),
|
|
2799
|
+
create: async (input, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2800
|
+
method: "POST",
|
|
2801
|
+
path: `/price/${this.ctx.tenant}/price-lists`,
|
|
2802
|
+
auth: authCtx,
|
|
2803
|
+
body: input
|
|
2804
|
+
}),
|
|
2805
|
+
search: async (query, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2806
|
+
method: "POST",
|
|
2807
|
+
path: `/price/${this.ctx.tenant}/price-lists/search`,
|
|
2808
|
+
auth: authCtx,
|
|
2809
|
+
body: query
|
|
2810
|
+
}),
|
|
2811
|
+
get: async (listId, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2812
|
+
method: "GET",
|
|
2813
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}`,
|
|
2814
|
+
auth: authCtx
|
|
2815
|
+
}),
|
|
2816
|
+
upsert: async (listId, input, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2817
|
+
method: "PUT",
|
|
2818
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}`,
|
|
2819
|
+
auth: authCtx,
|
|
2820
|
+
body: input
|
|
2821
|
+
}),
|
|
2822
|
+
delete: async (listId, authCtx = SERVICE4) => {
|
|
2823
|
+
await this.ctx.http.request({
|
|
2824
|
+
method: "DELETE",
|
|
2825
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}`,
|
|
2826
|
+
auth: authCtx
|
|
2827
|
+
});
|
|
2828
|
+
},
|
|
2829
|
+
listPrices: async (listId, query, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2830
|
+
method: "GET",
|
|
2831
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}/prices`,
|
|
2832
|
+
auth: authCtx,
|
|
2833
|
+
...query ? { query } : {}
|
|
2834
|
+
}),
|
|
2835
|
+
addPrice: async (listId, input, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2836
|
+
method: "POST",
|
|
2837
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}/prices`,
|
|
2838
|
+
auth: authCtx,
|
|
2839
|
+
body: input
|
|
2840
|
+
}),
|
|
2841
|
+
getPrice: async (listId, priceId, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2842
|
+
method: "GET",
|
|
2843
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}/prices/${priceId}`,
|
|
2844
|
+
auth: authCtx
|
|
2845
|
+
}),
|
|
2846
|
+
upsertPrice: async (listId, priceId, input, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2847
|
+
method: "PUT",
|
|
2848
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}/prices/${priceId}`,
|
|
2849
|
+
auth: authCtx,
|
|
2850
|
+
body: input
|
|
2851
|
+
}),
|
|
2852
|
+
deletePrice: async (listId, priceId, authCtx = SERVICE4) => {
|
|
2853
|
+
await this.ctx.http.request({
|
|
2854
|
+
method: "DELETE",
|
|
2855
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}/prices/${priceId}`,
|
|
2856
|
+
auth: authCtx
|
|
2857
|
+
});
|
|
2858
|
+
},
|
|
2859
|
+
searchPrices: async (listId, query, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2860
|
+
method: "POST",
|
|
2861
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}/prices/search`,
|
|
2862
|
+
auth: authCtx,
|
|
2863
|
+
body: query
|
|
2864
|
+
}),
|
|
2865
|
+
bulkCreatePrices: async (listId, inputs, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2866
|
+
method: "POST",
|
|
2867
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}/prices/bulk`,
|
|
2868
|
+
auth: authCtx,
|
|
2869
|
+
body: inputs
|
|
2870
|
+
}),
|
|
2871
|
+
bulkUpsertPrices: async (listId, inputs, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2872
|
+
method: "PUT",
|
|
2873
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}/prices/bulk`,
|
|
2874
|
+
auth: authCtx,
|
|
2875
|
+
body: inputs
|
|
2876
|
+
}),
|
|
2877
|
+
bulkDeletePrices: async (listId, body, authCtx = SERVICE4) => this.ctx.http.request({
|
|
2878
|
+
method: "DELETE",
|
|
2879
|
+
path: `/price/${this.ctx.tenant}/price-lists/${listId}/prices/bulk`,
|
|
2880
|
+
auth: authCtx,
|
|
2881
|
+
body
|
|
2882
|
+
})
|
|
2883
|
+
};
|
|
2048
2884
|
};
|
|
2049
2885
|
|
|
2050
2886
|
// src/services/media.ts
|
|
2051
|
-
var
|
|
2887
|
+
var SERVICE5 = { kind: "service" };
|
|
2052
2888
|
function isProductRef(r, productId) {
|
|
2053
2889
|
return r.type === "PRODUCT" && r.id === productId;
|
|
2054
2890
|
}
|
|
@@ -2062,7 +2898,7 @@ var MediaService = class {
|
|
|
2062
2898
|
return `/media/${this.ctx.tenant}/assets`;
|
|
2063
2899
|
}
|
|
2064
2900
|
/** Create an asset. BLOB uploads via multipart; LINK via JSON. */
|
|
2065
|
-
async create(input, auth2 =
|
|
2901
|
+
async create(input, auth2 = SERVICE5) {
|
|
2066
2902
|
if (input.kind === "blob") {
|
|
2067
2903
|
const fd = new FormData();
|
|
2068
2904
|
fd.set("file", input.file);
|
|
@@ -2089,7 +2925,7 @@ var MediaService = class {
|
|
|
2089
2925
|
* defaults match Emporix's server defaults (`pageNumber: 1`,
|
|
2090
2926
|
* `pageSize: 60`) so an empty `query` produces stable expectations.
|
|
2091
2927
|
*/
|
|
2092
|
-
async list(query = {}, auth2 =
|
|
2928
|
+
async list(query = {}, auth2 = SERVICE5) {
|
|
2093
2929
|
const pageNumber = query.pageNumber ?? 1;
|
|
2094
2930
|
const pageSize = query.pageSize ?? 60;
|
|
2095
2931
|
const items = await this.ctx.http.request({
|
|
@@ -2106,7 +2942,7 @@ var MediaService = class {
|
|
|
2106
2942
|
};
|
|
2107
2943
|
}
|
|
2108
2944
|
/** Fetch an asset by id. */
|
|
2109
|
-
async get(assetId, auth2 =
|
|
2945
|
+
async get(assetId, auth2 = SERVICE5) {
|
|
2110
2946
|
return this.ctx.http.request({
|
|
2111
2947
|
method: "GET",
|
|
2112
2948
|
path: `${this.base()}/${assetId}`,
|
|
@@ -2127,7 +2963,7 @@ var MediaService = class {
|
|
|
2127
2963
|
* existing asset's values. Optimistic-locking is via `body.metadata.version`;
|
|
2128
2964
|
* the server returns 409 Conflict on a stale version.
|
|
2129
2965
|
*/
|
|
2130
|
-
async update(assetId, input, auth2 =
|
|
2966
|
+
async update(assetId, input, auth2 = SERVICE5) {
|
|
2131
2967
|
if (input.kind === "blob") {
|
|
2132
2968
|
const fd = new FormData();
|
|
2133
2969
|
fd.set("file", input.file);
|
|
@@ -2147,7 +2983,7 @@ var MediaService = class {
|
|
|
2147
2983
|
});
|
|
2148
2984
|
}
|
|
2149
2985
|
/** Remove an asset. */
|
|
2150
|
-
async remove(assetId, auth2 =
|
|
2986
|
+
async remove(assetId, auth2 = SERVICE5) {
|
|
2151
2987
|
await this.ctx.http.request({
|
|
2152
2988
|
method: "DELETE",
|
|
2153
2989
|
path: `${this.base()}/${assetId}`,
|
|
@@ -2173,7 +3009,7 @@ var MediaService = class {
|
|
|
2173
3009
|
* direct storage URL for `PUBLIC` `BLOB` assets (typically delivered via
|
|
2174
3010
|
* an `<img>` tag rather than `download()`).
|
|
2175
3011
|
*/
|
|
2176
|
-
async download(assetId, auth2 =
|
|
3012
|
+
async download(assetId, auth2 = SERVICE5) {
|
|
2177
3013
|
const path = `${this.base()}/${assetId}/download`;
|
|
2178
3014
|
const res = await this.ctx.http.requestRaw(
|
|
2179
3015
|
{ method: "GET", path, auth: auth2 },
|
|
@@ -2221,7 +3057,7 @@ var MediaService = class {
|
|
|
2221
3057
|
throw errorFromResponse(res.status, `GET ${path} \u2192 ${res.status}`, parsed);
|
|
2222
3058
|
}
|
|
2223
3059
|
/** Multipart upload sugar: builds `AssetCreateBlob` from input. */
|
|
2224
|
-
async uploadFile(input, auth2 =
|
|
3060
|
+
async uploadFile(input, auth2 = SERVICE5) {
|
|
2225
3061
|
const body = {
|
|
2226
3062
|
type: "BLOB",
|
|
2227
3063
|
access: input.access ?? "PUBLIC",
|
|
@@ -2242,7 +3078,7 @@ var MediaService = class {
|
|
|
2242
3078
|
* Pass `version` from `asset.metadata.version` if you want optimistic
|
|
2243
3079
|
* locking (recommended when concurrent writers are possible).
|
|
2244
3080
|
*/
|
|
2245
|
-
async replaceFile(assetId, input, auth2 =
|
|
3081
|
+
async replaceFile(assetId, input, auth2 = SERVICE5) {
|
|
2246
3082
|
const body = {
|
|
2247
3083
|
type: "BLOB",
|
|
2248
3084
|
access: input.access,
|
|
@@ -2257,7 +3093,7 @@ var MediaService = class {
|
|
|
2257
3093
|
return this.update(assetId, { kind: "blob", file: input.file, body }, auth2);
|
|
2258
3094
|
}
|
|
2259
3095
|
/** External-URL sugar: builds `AssetCreateLink`. */
|
|
2260
|
-
async link(input, auth2 =
|
|
3096
|
+
async link(input, auth2 = SERVICE5) {
|
|
2261
3097
|
const body = {
|
|
2262
3098
|
type: "LINK",
|
|
2263
3099
|
access: input.access ?? "PUBLIC",
|
|
@@ -2267,7 +3103,7 @@ var MediaService = class {
|
|
|
2267
3103
|
return this.create({ kind: "link", body }, auth2);
|
|
2268
3104
|
}
|
|
2269
3105
|
/** Idempotently add a PRODUCT refId to an asset. */
|
|
2270
|
-
async attachToProduct(assetId, productId, auth2 =
|
|
3106
|
+
async attachToProduct(assetId, productId, auth2 = SERVICE5) {
|
|
2271
3107
|
const a = await this.get(assetId, auth2);
|
|
2272
3108
|
const refIds = a.refIds ?? [];
|
|
2273
3109
|
if (refIds.some((r) => isProductRef(r, productId))) return a;
|
|
@@ -2276,7 +3112,7 @@ var MediaService = class {
|
|
|
2276
3112
|
return this.update(assetId, { kind: "json", body: patch }, auth2);
|
|
2277
3113
|
}
|
|
2278
3114
|
/** Remove a PRODUCT refId from an asset (no-op if absent). */
|
|
2279
|
-
async detachFromProduct(assetId, productId, auth2 =
|
|
3115
|
+
async detachFromProduct(assetId, productId, auth2 = SERVICE5) {
|
|
2280
3116
|
const a = await this.get(assetId, auth2);
|
|
2281
3117
|
const refIds = a.refIds ?? [];
|
|
2282
3118
|
const next = refIds.filter((r) => !isProductRef(r, productId));
|
|
@@ -2285,7 +3121,7 @@ var MediaService = class {
|
|
|
2285
3121
|
return this.update(assetId, { kind: "json", body: patch }, auth2);
|
|
2286
3122
|
}
|
|
2287
3123
|
/** Convenience: list assets attached to a product (server-side filter). */
|
|
2288
|
-
async listForProduct(productId, auth2 =
|
|
3124
|
+
async listForProduct(productId, auth2 = SERVICE5) {
|
|
2289
3125
|
return this.list({ "refIds.id": productId }, auth2);
|
|
2290
3126
|
}
|
|
2291
3127
|
};
|
|
@@ -2296,6 +3132,7 @@ function setIfDefined(q, key, value) {
|
|
|
2296
3132
|
q[key] = value;
|
|
2297
3133
|
}
|
|
2298
3134
|
}
|
|
3135
|
+
var SERVICE6 = { kind: "service" };
|
|
2299
3136
|
var SegmentService = class {
|
|
2300
3137
|
constructor(ctx, deps) {
|
|
2301
3138
|
this.ctx = ctx;
|
|
@@ -2427,10 +3264,189 @@ var SegmentService = class {
|
|
|
2427
3264
|
const items = await this.deps.categories.searchByIds(ids, void 0, auth2);
|
|
2428
3265
|
return { items, pageNumber, pageSize, hasNextPage: sourceItems.length === pageSize };
|
|
2429
3266
|
}
|
|
3267
|
+
// --- Admin CRUD (segment_manage). Default auth: service. ---
|
|
3268
|
+
/** Creates a segment. Default auth: service. */
|
|
3269
|
+
async create(input, authCtx = SERVICE6) {
|
|
3270
|
+
return this.ctx.http.request({ method: "POST", path: this.base(), auth: authCtx, body: input });
|
|
3271
|
+
}
|
|
3272
|
+
/** Searches segments (POST body). Default auth: service. */
|
|
3273
|
+
async search(query, authCtx = SERVICE6) {
|
|
3274
|
+
return this.ctx.http.request({
|
|
3275
|
+
method: "POST",
|
|
3276
|
+
path: `${this.base()}/search`,
|
|
3277
|
+
auth: authCtx,
|
|
3278
|
+
body: query
|
|
3279
|
+
});
|
|
3280
|
+
}
|
|
3281
|
+
/** Full-replaces a segment (PUT). Default auth: service. */
|
|
3282
|
+
async update(segmentId, input, authCtx = SERVICE6) {
|
|
3283
|
+
return this.ctx.http.request({
|
|
3284
|
+
method: "PUT",
|
|
3285
|
+
path: `${this.base()}/${segmentId}`,
|
|
3286
|
+
auth: authCtx,
|
|
3287
|
+
body: input
|
|
3288
|
+
});
|
|
3289
|
+
}
|
|
3290
|
+
/** Partially updates a segment (PATCH). Default auth: service. */
|
|
3291
|
+
async patch(segmentId, input, authCtx = SERVICE6) {
|
|
3292
|
+
return this.ctx.http.request({
|
|
3293
|
+
method: "PATCH",
|
|
3294
|
+
path: `${this.base()}/${segmentId}`,
|
|
3295
|
+
auth: authCtx,
|
|
3296
|
+
body: input
|
|
3297
|
+
});
|
|
3298
|
+
}
|
|
3299
|
+
/** Deletes a segment. Default auth: service. */
|
|
3300
|
+
async delete(segmentId, authCtx = SERVICE6) {
|
|
3301
|
+
await this.ctx.http.request({
|
|
3302
|
+
method: "DELETE",
|
|
3303
|
+
path: `${this.base()}/${segmentId}`,
|
|
3304
|
+
auth: authCtx
|
|
3305
|
+
});
|
|
3306
|
+
}
|
|
3307
|
+
/** Checks which segments the given items/customers match. Default auth: service. */
|
|
3308
|
+
async match(input, authCtx = SERVICE6) {
|
|
3309
|
+
return this.ctx.http.request({
|
|
3310
|
+
method: "POST",
|
|
3311
|
+
path: `${this.base()}/match`,
|
|
3312
|
+
auth: authCtx,
|
|
3313
|
+
body: input
|
|
3314
|
+
});
|
|
3315
|
+
}
|
|
3316
|
+
/** Creates multiple segments. Default auth: service. */
|
|
3317
|
+
async bulkCreate(inputs, authCtx = SERVICE6) {
|
|
3318
|
+
return this.ctx.http.request({
|
|
3319
|
+
method: "POST",
|
|
3320
|
+
path: `${this.base()}/bulk`,
|
|
3321
|
+
auth: authCtx,
|
|
3322
|
+
body: inputs
|
|
3323
|
+
});
|
|
3324
|
+
}
|
|
3325
|
+
/** Upserts multiple segments (PUT). Default auth: service. */
|
|
3326
|
+
async bulkUpdate(inputs, authCtx = SERVICE6) {
|
|
3327
|
+
return this.ctx.http.request({
|
|
3328
|
+
method: "PUT",
|
|
3329
|
+
path: `${this.base()}/bulk`,
|
|
3330
|
+
auth: authCtx,
|
|
3331
|
+
body: inputs
|
|
3332
|
+
});
|
|
3333
|
+
}
|
|
3334
|
+
/** Deletes multiple segments (DELETE with a body of ids). Default auth: service. */
|
|
3335
|
+
async bulkDelete(body, authCtx = SERVICE6) {
|
|
3336
|
+
return this.ctx.http.request({
|
|
3337
|
+
method: "DELETE",
|
|
3338
|
+
path: `${this.base()}/bulk`,
|
|
3339
|
+
auth: authCtx,
|
|
3340
|
+
body
|
|
3341
|
+
});
|
|
3342
|
+
}
|
|
3343
|
+
/** Customer→segment assignments (`segment_manage`). Default auth: service. */
|
|
3344
|
+
customers = {
|
|
3345
|
+
list: async (segmentId, query, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3346
|
+
method: "GET",
|
|
3347
|
+
path: `${this.base()}/${segmentId}/customers`,
|
|
3348
|
+
auth: authCtx,
|
|
3349
|
+
...query ? { query } : {}
|
|
3350
|
+
}),
|
|
3351
|
+
search: async (segmentId, query, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3352
|
+
method: "POST",
|
|
3353
|
+
path: `${this.base()}/${segmentId}/customers/search`,
|
|
3354
|
+
auth: authCtx,
|
|
3355
|
+
body: query
|
|
3356
|
+
}),
|
|
3357
|
+
get: async (segmentId, customerId, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3358
|
+
method: "GET",
|
|
3359
|
+
path: `${this.base()}/${segmentId}/customers/${customerId}`,
|
|
3360
|
+
auth: authCtx
|
|
3361
|
+
}),
|
|
3362
|
+
assign: async (segmentId, customerId, input, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3363
|
+
method: "PUT",
|
|
3364
|
+
path: `${this.base()}/${segmentId}/customers/${customerId}`,
|
|
3365
|
+
auth: authCtx,
|
|
3366
|
+
body: input
|
|
3367
|
+
}),
|
|
3368
|
+
remove: async (segmentId, customerId, authCtx = SERVICE6) => {
|
|
3369
|
+
await this.ctx.http.request({
|
|
3370
|
+
method: "DELETE",
|
|
3371
|
+
path: `${this.base()}/${segmentId}/customers/${customerId}`,
|
|
3372
|
+
auth: authCtx
|
|
3373
|
+
});
|
|
3374
|
+
},
|
|
3375
|
+
getForEntity: async (segmentId, customerId, legalEntityId, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3376
|
+
method: "GET",
|
|
3377
|
+
path: `${this.base()}/${segmentId}/customers/${customerId}/${legalEntityId}`,
|
|
3378
|
+
auth: authCtx
|
|
3379
|
+
}),
|
|
3380
|
+
assignForEntity: async (segmentId, customerId, legalEntityId, input, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3381
|
+
method: "PUT",
|
|
3382
|
+
path: `${this.base()}/${segmentId}/customers/${customerId}/${legalEntityId}`,
|
|
3383
|
+
auth: authCtx,
|
|
3384
|
+
body: input
|
|
3385
|
+
}),
|
|
3386
|
+
removeForEntity: async (segmentId, customerId, legalEntityId, authCtx = SERVICE6) => {
|
|
3387
|
+
await this.ctx.http.request({
|
|
3388
|
+
method: "DELETE",
|
|
3389
|
+
path: `${this.base()}/${segmentId}/customers/${customerId}/${legalEntityId}`,
|
|
3390
|
+
auth: authCtx
|
|
3391
|
+
});
|
|
3392
|
+
},
|
|
3393
|
+
bulkAssign: async (segmentId, inputs, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3394
|
+
method: "PUT",
|
|
3395
|
+
path: `${this.base()}/${segmentId}/customers/bulk`,
|
|
3396
|
+
auth: authCtx,
|
|
3397
|
+
body: inputs
|
|
3398
|
+
}),
|
|
3399
|
+
bulkRemove: async (segmentId, body, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3400
|
+
method: "DELETE",
|
|
3401
|
+
path: `${this.base()}/${segmentId}/customers/bulk`,
|
|
3402
|
+
auth: authCtx,
|
|
3403
|
+
body
|
|
3404
|
+
})
|
|
3405
|
+
};
|
|
3406
|
+
/** Item→segment assignments (`type` = PRODUCT | CATEGORY). Default auth: service. */
|
|
3407
|
+
items = {
|
|
3408
|
+
search: async (segmentId, query, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3409
|
+
method: "POST",
|
|
3410
|
+
path: `${this.base()}/${segmentId}/items/search`,
|
|
3411
|
+
auth: authCtx,
|
|
3412
|
+
body: query
|
|
3413
|
+
}),
|
|
3414
|
+
get: async (segmentId, type, itemId, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3415
|
+
method: "GET",
|
|
3416
|
+
path: `${this.base()}/${segmentId}/items/${type}/${itemId}`,
|
|
3417
|
+
auth: authCtx
|
|
3418
|
+
}),
|
|
3419
|
+
assign: async (segmentId, type, itemId, input, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3420
|
+
method: "PUT",
|
|
3421
|
+
path: `${this.base()}/${segmentId}/items/${type}/${itemId}`,
|
|
3422
|
+
auth: authCtx,
|
|
3423
|
+
body: input
|
|
3424
|
+
}),
|
|
3425
|
+
remove: async (segmentId, type, itemId, authCtx = SERVICE6) => {
|
|
3426
|
+
await this.ctx.http.request({
|
|
3427
|
+
method: "DELETE",
|
|
3428
|
+
path: `${this.base()}/${segmentId}/items/${type}/${itemId}`,
|
|
3429
|
+
auth: authCtx
|
|
3430
|
+
});
|
|
3431
|
+
},
|
|
3432
|
+
bulkAssign: async (segmentId, type, inputs, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3433
|
+
method: "PUT",
|
|
3434
|
+
path: `${this.base()}/${segmentId}/items/${type}/bulk`,
|
|
3435
|
+
auth: authCtx,
|
|
3436
|
+
body: inputs
|
|
3437
|
+
}),
|
|
3438
|
+
bulkRemove: async (segmentId, type, body, authCtx = SERVICE6) => this.ctx.http.request({
|
|
3439
|
+
method: "DELETE",
|
|
3440
|
+
path: `${this.base()}/${segmentId}/items/${type}/bulk`,
|
|
3441
|
+
auth: authCtx,
|
|
3442
|
+
body
|
|
3443
|
+
})
|
|
3444
|
+
};
|
|
2430
3445
|
};
|
|
2431
3446
|
|
|
2432
3447
|
// src/services/site.ts
|
|
2433
3448
|
var ANON5 = auth.anonymous();
|
|
3449
|
+
var SERVICE7 = auth.service();
|
|
2434
3450
|
var SiteService = class {
|
|
2435
3451
|
constructor(ctx) {
|
|
2436
3452
|
this.ctx = ctx;
|
|
@@ -2467,6 +3483,114 @@ var SiteService = class {
|
|
|
2467
3483
|
}
|
|
2468
3484
|
return def;
|
|
2469
3485
|
}
|
|
3486
|
+
/** Lists just the tenant's site codes (`GET /siteslist`). Default auth: anonymous. */
|
|
3487
|
+
async listCodes(authCtx = ANON5) {
|
|
3488
|
+
return this.ctx.http.request({
|
|
3489
|
+
method: "GET",
|
|
3490
|
+
path: `/site/${this.ctx.tenant}/siteslist`,
|
|
3491
|
+
auth: authCtx
|
|
3492
|
+
});
|
|
3493
|
+
}
|
|
3494
|
+
// --- Admin writes. Default auth: service. ---
|
|
3495
|
+
/** Creates a site (`POST /sites`). Default auth: service. */
|
|
3496
|
+
async create(input, authCtx = SERVICE7) {
|
|
3497
|
+
return this.ctx.http.request({
|
|
3498
|
+
method: "POST",
|
|
3499
|
+
path: `/site/${this.ctx.tenant}/sites`,
|
|
3500
|
+
body: input,
|
|
3501
|
+
auth: authCtx
|
|
3502
|
+
});
|
|
3503
|
+
}
|
|
3504
|
+
/**
|
|
3505
|
+
* Partially updates a site (`PATCH /sites/{siteCode}`). The endpoint responds
|
|
3506
|
+
* 200 without a defined body, so nothing is returned — re-read with
|
|
3507
|
+
* {@link get} when the updated site is needed. Default auth: service.
|
|
3508
|
+
*/
|
|
3509
|
+
async update(siteCode, input, authCtx = SERVICE7) {
|
|
3510
|
+
await this.ctx.http.request({
|
|
3511
|
+
method: "PATCH",
|
|
3512
|
+
path: `/site/${this.ctx.tenant}/sites/${siteCode}`,
|
|
3513
|
+
body: input,
|
|
3514
|
+
auth: authCtx
|
|
3515
|
+
});
|
|
3516
|
+
}
|
|
3517
|
+
/**
|
|
3518
|
+
* Full-replaces a site (`PUT /sites/{siteCode}`). Like {@link update} it
|
|
3519
|
+
* returns nothing (200 with no defined body). `options.expand` is forwarded as
|
|
3520
|
+
* a query parameter. Default auth: service.
|
|
3521
|
+
*/
|
|
3522
|
+
async replace(siteCode, input, options = {}, authCtx = SERVICE7) {
|
|
3523
|
+
await this.ctx.http.request({
|
|
3524
|
+
method: "PUT",
|
|
3525
|
+
path: `/site/${this.ctx.tenant}/sites/${siteCode}`,
|
|
3526
|
+
...options.expand === void 0 ? {} : { query: { expand: options.expand } },
|
|
3527
|
+
body: input,
|
|
3528
|
+
auth: authCtx
|
|
3529
|
+
});
|
|
3530
|
+
}
|
|
3531
|
+
/** Deletes a site (`DELETE /sites/{siteCode}`). Default auth: service. */
|
|
3532
|
+
async delete(siteCode, authCtx = SERVICE7) {
|
|
3533
|
+
await this.ctx.http.request({
|
|
3534
|
+
method: "DELETE",
|
|
3535
|
+
path: `/site/${this.ctx.tenant}/sites/${siteCode}`,
|
|
3536
|
+
auth: authCtx
|
|
3537
|
+
});
|
|
3538
|
+
}
|
|
3539
|
+
/**
|
|
3540
|
+
* Site mixins (`/sites/{siteCode}/mixins`). Mixin content is an open map —
|
|
3541
|
+
* the spec defines no structure. Reads default to anonymous, writes to
|
|
3542
|
+
* service auth.
|
|
3543
|
+
*/
|
|
3544
|
+
mixins = {
|
|
3545
|
+
/** All mixin groups of a site, as a map of group name to content. */
|
|
3546
|
+
list: async (siteCode, authCtx = ANON5) => this.ctx.http.request({
|
|
3547
|
+
method: "GET",
|
|
3548
|
+
path: `/site/${this.ctx.tenant}/sites/${siteCode}/mixins`,
|
|
3549
|
+
auth: authCtx
|
|
3550
|
+
}),
|
|
3551
|
+
/** One mixin group's content by name. */
|
|
3552
|
+
get: async (siteCode, mixinName, authCtx = ANON5) => this.ctx.http.request({
|
|
3553
|
+
method: "GET",
|
|
3554
|
+
path: `/site/${this.ctx.tenant}/sites/${siteCode}/mixins/${mixinName}`,
|
|
3555
|
+
auth: authCtx
|
|
3556
|
+
}),
|
|
3557
|
+
/** Adds a mixin to a site. Default auth: service. */
|
|
3558
|
+
create: async (siteCode, input, authCtx = SERVICE7) => this.ctx.http.request({
|
|
3559
|
+
method: "POST",
|
|
3560
|
+
path: `/site/${this.ctx.tenant}/sites/${siteCode}/mixins`,
|
|
3561
|
+
body: input,
|
|
3562
|
+
auth: authCtx
|
|
3563
|
+
}),
|
|
3564
|
+
/**
|
|
3565
|
+
* Partially updates a mixin (PATCH). Responds 200 without a defined body,
|
|
3566
|
+
* so nothing is returned. Default auth: service.
|
|
3567
|
+
*/
|
|
3568
|
+
update: async (siteCode, mixinName, input, authCtx = SERVICE7) => {
|
|
3569
|
+
await this.ctx.http.request({
|
|
3570
|
+
method: "PATCH",
|
|
3571
|
+
path: `/site/${this.ctx.tenant}/sites/${siteCode}/mixins/${mixinName}`,
|
|
3572
|
+
body: input,
|
|
3573
|
+
auth: authCtx
|
|
3574
|
+
});
|
|
3575
|
+
},
|
|
3576
|
+
/** Full-replaces a mixin (PUT). Returns nothing, like {@link update}. Default auth: service. */
|
|
3577
|
+
replace: async (siteCode, mixinName, input, authCtx = SERVICE7) => {
|
|
3578
|
+
await this.ctx.http.request({
|
|
3579
|
+
method: "PUT",
|
|
3580
|
+
path: `/site/${this.ctx.tenant}/sites/${siteCode}/mixins/${mixinName}`,
|
|
3581
|
+
body: input,
|
|
3582
|
+
auth: authCtx
|
|
3583
|
+
});
|
|
3584
|
+
},
|
|
3585
|
+
/** Removes a mixin from a site. Default auth: service. */
|
|
3586
|
+
delete: async (siteCode, mixinName, authCtx = SERVICE7) => {
|
|
3587
|
+
await this.ctx.http.request({
|
|
3588
|
+
method: "DELETE",
|
|
3589
|
+
path: `/site/${this.ctx.tenant}/sites/${siteCode}/mixins/${mixinName}`,
|
|
3590
|
+
auth: authCtx
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3593
|
+
};
|
|
2470
3594
|
};
|
|
2471
3595
|
|
|
2472
3596
|
// src/services/session-context.ts
|
|
@@ -2599,11 +3723,36 @@ var CompaniesService = class {
|
|
|
2599
3723
|
body: patch
|
|
2600
3724
|
});
|
|
2601
3725
|
}
|
|
2602
|
-
/** Deletes a legal entity (async cascade on the server). */
|
|
2603
|
-
async delete(legalEntityId, auth2) {
|
|
2604
|
-
await this.ctx.http.request({
|
|
2605
|
-
method: "DELETE",
|
|
2606
|
-
path: `${this.base()}/${legalEntityId}`,
|
|
3726
|
+
/** Deletes a legal entity (async cascade on the server). */
|
|
3727
|
+
async delete(legalEntityId, auth2) {
|
|
3728
|
+
await this.ctx.http.request({
|
|
3729
|
+
method: "DELETE",
|
|
3730
|
+
path: `${this.base()}/${legalEntityId}`,
|
|
3731
|
+
auth: auth2
|
|
3732
|
+
});
|
|
3733
|
+
}
|
|
3734
|
+
/**
|
|
3735
|
+
* Searches legal entities via `POST /legal-entities/search` with an Emporix
|
|
3736
|
+
* `q`-syntax filter body. Requires the same read scope as {@link listMine}.
|
|
3737
|
+
*/
|
|
3738
|
+
async search(query, auth2) {
|
|
3739
|
+
return this.ctx.http.request({
|
|
3740
|
+
method: "POST",
|
|
3741
|
+
path: `${this.base()}/search`,
|
|
3742
|
+
auth: auth2,
|
|
3743
|
+
body: query,
|
|
3744
|
+
idempotent: true
|
|
3745
|
+
// pure read over POST — safe to replay on 5xx/429
|
|
3746
|
+
});
|
|
3747
|
+
}
|
|
3748
|
+
/**
|
|
3749
|
+
* Retrieves a legal entity's chain of parent entities
|
|
3750
|
+
* (`GET /legal-entities/{id}/parent-hierarchy`).
|
|
3751
|
+
*/
|
|
3752
|
+
async parentHierarchy(legalEntityId, auth2) {
|
|
3753
|
+
return this.ctx.http.request({
|
|
3754
|
+
method: "GET",
|
|
3755
|
+
path: `${this.base()}/${legalEntityId}/parent-hierarchy`,
|
|
2607
3756
|
auth: auth2
|
|
2608
3757
|
});
|
|
2609
3758
|
}
|
|
@@ -2659,6 +3808,14 @@ var ContactsService = class {
|
|
|
2659
3808
|
auth: auth2
|
|
2660
3809
|
});
|
|
2661
3810
|
}
|
|
3811
|
+
/** Fetches a single contact assignment by id. */
|
|
3812
|
+
async get(contactAssignmentId, auth2) {
|
|
3813
|
+
return this.ctx.http.request({
|
|
3814
|
+
method: "GET",
|
|
3815
|
+
path: `${this.base()}/${contactAssignmentId}`,
|
|
3816
|
+
auth: auth2
|
|
3817
|
+
});
|
|
3818
|
+
}
|
|
2662
3819
|
};
|
|
2663
3820
|
|
|
2664
3821
|
// src/services/locations.ts
|
|
@@ -2721,39 +3878,222 @@ var LocationsService = class {
|
|
|
2721
3878
|
}
|
|
2722
3879
|
};
|
|
2723
3880
|
|
|
2724
|
-
// src/services/
|
|
2725
|
-
var
|
|
3881
|
+
// src/services/iam.ts
|
|
3882
|
+
var IamService = class {
|
|
2726
3883
|
constructor(ctx) {
|
|
2727
3884
|
this.ctx = ctx;
|
|
2728
3885
|
}
|
|
2729
3886
|
ctx;
|
|
2730
3887
|
static channel = "iam";
|
|
2731
3888
|
base() {
|
|
2732
|
-
return `/iam/${this.ctx.tenant}
|
|
3889
|
+
return `/iam/${this.ctx.tenant}`;
|
|
2733
3890
|
}
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
return this.ctx.http.request({
|
|
3891
|
+
users = {
|
|
3892
|
+
list: async (auth2, query) => this.ctx.http.request({
|
|
2737
3893
|
method: "GET",
|
|
2738
|
-
path: this.base()
|
|
2739
|
-
|
|
3894
|
+
path: `${this.base()}/users`,
|
|
3895
|
+
auth: auth2,
|
|
3896
|
+
...query ? { query } : {}
|
|
3897
|
+
}),
|
|
3898
|
+
create: async (input, auth2) => this.ctx.http.request({
|
|
3899
|
+
method: "POST",
|
|
3900
|
+
path: `${this.base()}/users`,
|
|
3901
|
+
auth: auth2,
|
|
3902
|
+
body: input
|
|
3903
|
+
}),
|
|
3904
|
+
get: async (userId, auth2) => this.ctx.http.request({
|
|
3905
|
+
method: "GET",
|
|
3906
|
+
path: `${this.base()}/users/${userId}`,
|
|
2740
3907
|
auth: auth2
|
|
2741
|
-
})
|
|
3908
|
+
}),
|
|
3909
|
+
getMe: async (auth2) => this.ctx.http.request({
|
|
3910
|
+
method: "GET",
|
|
3911
|
+
path: `${this.base()}/users/me`,
|
|
3912
|
+
auth: auth2
|
|
3913
|
+
}),
|
|
3914
|
+
update: async (userId, input, auth2) => {
|
|
3915
|
+
await this.ctx.http.request({
|
|
3916
|
+
method: "PUT",
|
|
3917
|
+
path: `${this.base()}/users/${userId}`,
|
|
3918
|
+
auth: auth2,
|
|
3919
|
+
body: input
|
|
3920
|
+
});
|
|
3921
|
+
},
|
|
3922
|
+
delete: async (userId, auth2) => {
|
|
3923
|
+
await this.ctx.http.request({
|
|
3924
|
+
method: "DELETE",
|
|
3925
|
+
path: `${this.base()}/users/${userId}`,
|
|
3926
|
+
auth: auth2
|
|
3927
|
+
});
|
|
3928
|
+
},
|
|
3929
|
+
getGroups: async (userId, auth2) => this.ctx.http.request({
|
|
3930
|
+
method: "GET",
|
|
3931
|
+
path: `${this.base()}/users/${userId}/groups`,
|
|
3932
|
+
auth: auth2
|
|
3933
|
+
}),
|
|
3934
|
+
getScopes: async (userId, auth2) => this.ctx.http.request({
|
|
3935
|
+
method: "GET",
|
|
3936
|
+
path: `${this.base()}/users/${userId}/scopes`,
|
|
3937
|
+
auth: auth2
|
|
3938
|
+
}),
|
|
3939
|
+
getMyScopes: async (auth2) => this.ctx.http.request({
|
|
3940
|
+
method: "GET",
|
|
3941
|
+
path: `${this.base()}/users/me/scopes`,
|
|
3942
|
+
auth: auth2
|
|
3943
|
+
}),
|
|
3944
|
+
getAccessControls: async (userId, auth2) => this.ctx.http.request({
|
|
3945
|
+
method: "GET",
|
|
3946
|
+
path: `${this.base()}/users/${userId}/access-controls`,
|
|
3947
|
+
auth: auth2
|
|
3948
|
+
}),
|
|
3949
|
+
getMyAccessControls: async (auth2) => this.ctx.http.request({
|
|
3950
|
+
method: "GET",
|
|
3951
|
+
path: `${this.base()}/users/me/access-controls`,
|
|
3952
|
+
auth: auth2
|
|
3953
|
+
})
|
|
3954
|
+
};
|
|
3955
|
+
groups = {
|
|
3956
|
+
list: async (auth2, query) => this.ctx.http.request({
|
|
3957
|
+
method: "GET",
|
|
3958
|
+
path: `${this.base()}/groups`,
|
|
3959
|
+
auth: auth2,
|
|
3960
|
+
...query ? { query } : {}
|
|
3961
|
+
}),
|
|
3962
|
+
create: async (input, auth2) => this.ctx.http.request({
|
|
3963
|
+
method: "POST",
|
|
3964
|
+
path: `${this.base()}/groups`,
|
|
3965
|
+
auth: auth2,
|
|
3966
|
+
body: input
|
|
3967
|
+
}),
|
|
3968
|
+
get: async (groupId, auth2) => this.ctx.http.request({
|
|
3969
|
+
method: "GET",
|
|
3970
|
+
path: `${this.base()}/groups/${groupId}`,
|
|
3971
|
+
auth: auth2
|
|
3972
|
+
}),
|
|
3973
|
+
update: async (groupId, input, auth2) => {
|
|
3974
|
+
await this.ctx.http.request({
|
|
3975
|
+
method: "PUT",
|
|
3976
|
+
path: `${this.base()}/groups/${groupId}`,
|
|
3977
|
+
auth: auth2,
|
|
3978
|
+
body: input
|
|
3979
|
+
});
|
|
3980
|
+
},
|
|
3981
|
+
delete: async (groupId, auth2) => {
|
|
3982
|
+
await this.ctx.http.request({
|
|
3983
|
+
method: "DELETE",
|
|
3984
|
+
path: `${this.base()}/groups/${groupId}`,
|
|
3985
|
+
auth: auth2
|
|
3986
|
+
});
|
|
3987
|
+
},
|
|
3988
|
+
listUsers: async (groupId, auth2) => this.ctx.http.request({
|
|
3989
|
+
method: "GET",
|
|
3990
|
+
path: `${this.base()}/groups/${groupId}/users`,
|
|
3991
|
+
auth: auth2
|
|
3992
|
+
}),
|
|
3993
|
+
addUser: async (groupId, input, auth2) => this.ctx.http.request({
|
|
3994
|
+
method: "POST",
|
|
3995
|
+
path: `${this.base()}/groups/${groupId}/users`,
|
|
3996
|
+
auth: auth2,
|
|
3997
|
+
body: input
|
|
3998
|
+
}),
|
|
3999
|
+
updateUser: async (groupId, userType, userId, input, auth2) => this.ctx.http.request({
|
|
4000
|
+
method: "PUT",
|
|
4001
|
+
path: `${this.base()}/groups/${groupId}/users/${userType}/${userId}`,
|
|
4002
|
+
auth: auth2,
|
|
4003
|
+
body: input
|
|
4004
|
+
}),
|
|
4005
|
+
removeAllUsers: async (groupId, auth2) => {
|
|
4006
|
+
await this.ctx.http.request({
|
|
4007
|
+
method: "DELETE",
|
|
4008
|
+
path: `${this.base()}/groups/${groupId}/users`,
|
|
4009
|
+
auth: auth2
|
|
4010
|
+
});
|
|
4011
|
+
},
|
|
4012
|
+
listAccessControls: async (groupId, auth2) => this.ctx.http.request({
|
|
4013
|
+
method: "GET",
|
|
4014
|
+
path: `${this.base()}/groups/${groupId}/access-controls`,
|
|
4015
|
+
auth: auth2
|
|
4016
|
+
})
|
|
4017
|
+
};
|
|
4018
|
+
accessControls = {
|
|
4019
|
+
list: async (auth2) => this.ctx.http.request({
|
|
4020
|
+
method: "GET",
|
|
4021
|
+
path: `${this.base()}/access-controls`,
|
|
4022
|
+
auth: auth2
|
|
4023
|
+
}),
|
|
4024
|
+
get: async (id, auth2) => this.ctx.http.request({
|
|
4025
|
+
method: "GET",
|
|
4026
|
+
path: `${this.base()}/access-controls/${id}`,
|
|
4027
|
+
auth: auth2
|
|
4028
|
+
}),
|
|
4029
|
+
upsert: async (id, input, auth2) => this.ctx.http.request({
|
|
4030
|
+
method: "PUT",
|
|
4031
|
+
path: `${this.base()}/access-controls/${id}`,
|
|
4032
|
+
auth: auth2,
|
|
4033
|
+
body: input
|
|
4034
|
+
}),
|
|
4035
|
+
delete: async (id, auth2) => {
|
|
4036
|
+
await this.ctx.http.request({
|
|
4037
|
+
method: "DELETE",
|
|
4038
|
+
path: `${this.base()}/access-controls/${id}`,
|
|
4039
|
+
auth: auth2
|
|
4040
|
+
});
|
|
4041
|
+
}
|
|
4042
|
+
};
|
|
4043
|
+
scopes = {
|
|
4044
|
+
list: async (auth2) => this.ctx.http.request({
|
|
4045
|
+
method: "GET",
|
|
4046
|
+
path: `${this.base()}/scopes`,
|
|
4047
|
+
auth: auth2
|
|
4048
|
+
}),
|
|
4049
|
+
get: async (scopeId, auth2) => this.ctx.http.request({
|
|
4050
|
+
method: "GET",
|
|
4051
|
+
path: `${this.base()}/scopes/${scopeId}`,
|
|
4052
|
+
auth: auth2
|
|
4053
|
+
}),
|
|
4054
|
+
upsertCustom: async (scopeId, input, auth2) => this.ctx.http.request({
|
|
4055
|
+
method: "PUT",
|
|
4056
|
+
path: `${this.base()}/scopes/${scopeId}`,
|
|
4057
|
+
auth: auth2,
|
|
4058
|
+
body: input
|
|
4059
|
+
}),
|
|
4060
|
+
deleteCustom: async (scopeId, auth2) => {
|
|
4061
|
+
await this.ctx.http.request({
|
|
4062
|
+
method: "DELETE",
|
|
4063
|
+
path: `${this.base()}/scopes/${scopeId}`,
|
|
4064
|
+
auth: auth2
|
|
4065
|
+
});
|
|
4066
|
+
}
|
|
4067
|
+
};
|
|
4068
|
+
};
|
|
4069
|
+
|
|
4070
|
+
// src/services/customer-groups.ts
|
|
4071
|
+
var CustomerGroupsService = class {
|
|
4072
|
+
constructor(ctx) {
|
|
4073
|
+
this.ctx = ctx;
|
|
4074
|
+
this.iam = new IamService(ctx);
|
|
4075
|
+
}
|
|
4076
|
+
ctx;
|
|
4077
|
+
static channel = "iam";
|
|
4078
|
+
iam;
|
|
4079
|
+
/** Lists customer groups belonging to one legal entity. */
|
|
4080
|
+
async listForCompany(legalEntityId, auth2) {
|
|
4081
|
+
return this.iam.groups.list(auth2, { "b2b.legalEntityId": legalEntityId });
|
|
2742
4082
|
}
|
|
2743
4083
|
/** Adds a user (customer or employee) to a group. */
|
|
2744
4084
|
async addMember(groupId, member, auth2) {
|
|
2745
|
-
return this.
|
|
2746
|
-
method: "POST",
|
|
2747
|
-
path: `${this.base()}/${groupId}/users`,
|
|
2748
|
-
auth: auth2,
|
|
2749
|
-
body: member
|
|
2750
|
-
});
|
|
4085
|
+
return await this.iam.groups.addUser(groupId, member, auth2);
|
|
2751
4086
|
}
|
|
2752
|
-
/**
|
|
4087
|
+
/**
|
|
4088
|
+
* Removes a user from a group. Uses `DELETE …/groups/{groupId}/users/{userId}`
|
|
4089
|
+
* directly — this endpoint is deprecated upstream and intentionally not
|
|
4090
|
+
* exposed on {@link IamService}, so it is not delegated. No non-deprecated
|
|
4091
|
+
* single-user removal exists.
|
|
4092
|
+
*/
|
|
2753
4093
|
async removeMember(groupId, userId, auth2) {
|
|
2754
4094
|
await this.ctx.http.request({
|
|
2755
4095
|
method: "DELETE",
|
|
2756
|
-
path:
|
|
4096
|
+
path: `/iam/${this.ctx.tenant}/groups/${groupId}/users/${userId}`,
|
|
2757
4097
|
auth: auth2
|
|
2758
4098
|
});
|
|
2759
4099
|
}
|
|
@@ -2828,6 +4168,42 @@ var OrdersService = class {
|
|
|
2828
4168
|
async cancel(orderId, auth2, opts = {}) {
|
|
2829
4169
|
await this.transition(orderId, "DECLINED", auth2, opts);
|
|
2830
4170
|
}
|
|
4171
|
+
/**
|
|
4172
|
+
* Lists a legal entity's orders (`GET /legal-entity-orders/{legalEntityId}`),
|
|
4173
|
+
* wrapped into `PaginatedItems`. B2B storefront view — requires a customer
|
|
4174
|
+
* token with access to the legal entity.
|
|
4175
|
+
*/
|
|
4176
|
+
async listForLegalEntity(legalEntityId, auth2, opts = {}) {
|
|
4177
|
+
const pageNumber = opts.pageNumber ?? 1;
|
|
4178
|
+
const pageSize = opts.pageSize ?? 50;
|
|
4179
|
+
const query = { pageNumber, pageSize };
|
|
4180
|
+
setIfDefined2(query, "sort", opts.sort);
|
|
4181
|
+
if (opts.q !== void 0) {
|
|
4182
|
+
setIfDefined2(query, "q", resolveQuery(opts.q, { compoundLogicalQuery: false }));
|
|
4183
|
+
}
|
|
4184
|
+
const headers = this.saasHeader(opts.saasToken);
|
|
4185
|
+
const items = await this.ctx.http.request({
|
|
4186
|
+
method: "GET",
|
|
4187
|
+
path: `/order-v2/${this.ctx.tenant}/legal-entity-orders/${legalEntityId}`,
|
|
4188
|
+
query,
|
|
4189
|
+
auth: auth2,
|
|
4190
|
+
...headers ? { headers } : {}
|
|
4191
|
+
});
|
|
4192
|
+
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
4193
|
+
}
|
|
4194
|
+
/**
|
|
4195
|
+
* Fetches one order within a legal entity
|
|
4196
|
+
* (`GET /legal-entity-orders/{legalEntityId}/{orderId}`).
|
|
4197
|
+
*/
|
|
4198
|
+
async getForLegalEntity(legalEntityId, orderId, auth2, opts = {}) {
|
|
4199
|
+
const headers = this.saasHeader(opts.saasToken);
|
|
4200
|
+
return this.ctx.http.request({
|
|
4201
|
+
method: "GET",
|
|
4202
|
+
path: `/order-v2/${this.ctx.tenant}/legal-entity-orders/${legalEntityId}/${orderId}`,
|
|
4203
|
+
auth: auth2,
|
|
4204
|
+
...headers ? { headers } : {}
|
|
4205
|
+
});
|
|
4206
|
+
}
|
|
2831
4207
|
};
|
|
2832
4208
|
var SalesOrdersService = class {
|
|
2833
4209
|
constructor(ctx) {
|
|
@@ -2838,30 +4214,153 @@ var SalesOrdersService = class {
|
|
|
2838
4214
|
base() {
|
|
2839
4215
|
return `/order-v2/${this.ctx.tenant}/salesorders`;
|
|
2840
4216
|
}
|
|
2841
|
-
/** Fetches a single sales-order by id. */
|
|
2842
|
-
async get(orderId, auth2) {
|
|
4217
|
+
/** Fetches a single sales-order by id. */
|
|
4218
|
+
async get(orderId, auth2) {
|
|
4219
|
+
return this.ctx.http.request({
|
|
4220
|
+
method: "GET",
|
|
4221
|
+
path: `${this.base()}/${orderId}`,
|
|
4222
|
+
auth: auth2
|
|
4223
|
+
});
|
|
4224
|
+
}
|
|
4225
|
+
/** Patches an existing order (status, mixins, customAttributes, metadata). */
|
|
4226
|
+
async update(orderId, patch, auth2, opts = {}) {
|
|
4227
|
+
const query = {};
|
|
4228
|
+
if (opts.recalculate === false) query.recalculate = "false";
|
|
4229
|
+
return this.ctx.http.request({
|
|
4230
|
+
method: "PATCH",
|
|
4231
|
+
path: `${this.base()}/${orderId}`,
|
|
4232
|
+
auth: auth2,
|
|
4233
|
+
...Object.keys(query).length > 0 ? { query } : {},
|
|
4234
|
+
body: patch
|
|
4235
|
+
});
|
|
4236
|
+
}
|
|
4237
|
+
/** Lists tenant sales-orders (`GET /salesorders`), wrapped into `PaginatedItems`. */
|
|
4238
|
+
async list(auth2, opts = {}) {
|
|
4239
|
+
const pageNumber = opts.pageNumber ?? 1;
|
|
4240
|
+
const pageSize = opts.pageSize ?? 50;
|
|
4241
|
+
const query = { pageNumber, pageSize };
|
|
4242
|
+
setIfDefined2(query, "sort", opts.sort);
|
|
4243
|
+
setIfDefined2(query, "fields", opts.fields);
|
|
4244
|
+
if (opts.q !== void 0) {
|
|
4245
|
+
setIfDefined2(query, "q", resolveQuery(opts.q, { compoundLogicalQuery: false }));
|
|
4246
|
+
}
|
|
4247
|
+
const items = await this.ctx.http.request({
|
|
4248
|
+
method: "GET",
|
|
4249
|
+
path: this.base(),
|
|
4250
|
+
query,
|
|
4251
|
+
auth: auth2
|
|
4252
|
+
});
|
|
4253
|
+
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
4254
|
+
}
|
|
4255
|
+
/** Searches tenant sales-orders (`POST /salesorders/search`, body carries the `q` filter). */
|
|
4256
|
+
async search(query, auth2, opts = {}) {
|
|
4257
|
+
const q = {};
|
|
4258
|
+
setIfDefined2(q, "pageNumber", opts.pageNumber);
|
|
4259
|
+
setIfDefined2(q, "pageSize", opts.pageSize);
|
|
4260
|
+
setIfDefined2(q, "sort", opts.sort);
|
|
4261
|
+
setIfDefined2(q, "fields", opts.fields);
|
|
4262
|
+
return this.ctx.http.request({
|
|
4263
|
+
method: "POST",
|
|
4264
|
+
path: `${this.base()}/search`,
|
|
4265
|
+
...Object.keys(q).length > 0 ? { query: q } : {},
|
|
4266
|
+
body: query,
|
|
4267
|
+
idempotent: true,
|
|
4268
|
+
// pure read over POST — safe to replay on 5xx/429
|
|
4269
|
+
auth: auth2
|
|
4270
|
+
});
|
|
4271
|
+
}
|
|
4272
|
+
/** Creates a sales-order as an employee (`POST /salesorders`). Returns the created resource location. */
|
|
4273
|
+
async create(input, auth2) {
|
|
4274
|
+
return this.ctx.http.request({
|
|
4275
|
+
method: "POST",
|
|
4276
|
+
path: this.base(),
|
|
4277
|
+
auth: auth2,
|
|
4278
|
+
body: input
|
|
4279
|
+
});
|
|
4280
|
+
}
|
|
4281
|
+
/**
|
|
4282
|
+
* Full-replaces a sales-order (`PUT /salesorders/{orderId}`, body `OrderUpdateDto`).
|
|
4283
|
+
* The endpoint returns 204, so the order is re-fetched (direct GET) and returned.
|
|
4284
|
+
* Note: `update` on this class is the PATCH (partial); `replace` is the PUT (full).
|
|
4285
|
+
*/
|
|
4286
|
+
async replace(orderId, input, auth2) {
|
|
4287
|
+
await this.ctx.http.request({
|
|
4288
|
+
method: "PUT",
|
|
4289
|
+
path: `${this.base()}/${orderId}`,
|
|
4290
|
+
auth: auth2,
|
|
4291
|
+
body: input
|
|
4292
|
+
});
|
|
4293
|
+
return this.ctx.http.request({
|
|
4294
|
+
method: "GET",
|
|
4295
|
+
path: `${this.base()}/${orderId}`,
|
|
4296
|
+
auth: auth2
|
|
4297
|
+
});
|
|
4298
|
+
}
|
|
4299
|
+
/** Deletes a sales-order (`DELETE /salesorders/{orderId}`). */
|
|
4300
|
+
async delete(orderId, auth2) {
|
|
4301
|
+
await this.ctx.http.request({
|
|
4302
|
+
method: "DELETE",
|
|
4303
|
+
path: `${this.base()}/${orderId}`,
|
|
4304
|
+
auth: auth2
|
|
4305
|
+
});
|
|
4306
|
+
}
|
|
4307
|
+
/** Lists the available transitions for a sales-order (`GET /salesorders/{orderId}/transitions`). */
|
|
4308
|
+
async listTransitions(orderId, auth2) {
|
|
4309
|
+
return this.ctx.http.request({
|
|
4310
|
+
method: "GET",
|
|
4311
|
+
path: `${this.base()}/${orderId}/transitions`,
|
|
4312
|
+
auth: auth2
|
|
4313
|
+
});
|
|
4314
|
+
}
|
|
4315
|
+
/** Transitions a sales-order to a new status (`POST /salesorders/{orderId}/transitions`). */
|
|
4316
|
+
async transition(orderId, input, auth2) {
|
|
4317
|
+
await this.ctx.http.request({
|
|
4318
|
+
method: "POST",
|
|
4319
|
+
path: `${this.base()}/${orderId}/transitions`,
|
|
4320
|
+
auth: auth2,
|
|
4321
|
+
body: input
|
|
4322
|
+
});
|
|
4323
|
+
}
|
|
4324
|
+
/** Lists the historical transitions of a sales-order (`GET /salesorders/{orderId}/historical-transitions`). */
|
|
4325
|
+
async listHistoricalTransitions(orderId, auth2) {
|
|
2843
4326
|
return this.ctx.http.request({
|
|
2844
4327
|
method: "GET",
|
|
2845
|
-
path: `${this.base()}/${orderId}`,
|
|
4328
|
+
path: `${this.base()}/${orderId}/historical-transitions`,
|
|
2846
4329
|
auth: auth2
|
|
2847
4330
|
});
|
|
2848
4331
|
}
|
|
2849
|
-
/**
|
|
2850
|
-
async
|
|
2851
|
-
const query = {};
|
|
2852
|
-
if (opts.recalculate === false) query.recalculate = "false";
|
|
4332
|
+
/** Calculates order-entry totals for a sales-order (`POST /salesorders/{orderId}/calculations`). */
|
|
4333
|
+
async calculate(orderId, input, auth2) {
|
|
2853
4334
|
return this.ctx.http.request({
|
|
2854
|
-
method: "
|
|
2855
|
-
path: `${this.base()}/${orderId}`,
|
|
4335
|
+
method: "POST",
|
|
4336
|
+
path: `${this.base()}/${orderId}/calculations`,
|
|
2856
4337
|
auth: auth2,
|
|
2857
|
-
|
|
2858
|
-
|
|
4338
|
+
body: input
|
|
4339
|
+
});
|
|
4340
|
+
}
|
|
4341
|
+
/** Updates a sales-order's entries (`POST /salesorders/{orderId}/entries`). Returns the updated order. */
|
|
4342
|
+
async updateEntries(orderId, input, auth2) {
|
|
4343
|
+
return this.ctx.http.request({
|
|
4344
|
+
method: "POST",
|
|
4345
|
+
path: `${this.base()}/${orderId}/entries`,
|
|
4346
|
+
auth: auth2,
|
|
4347
|
+
body: input
|
|
4348
|
+
});
|
|
4349
|
+
}
|
|
4350
|
+
/** Splits a sales-order (`POST /salesorders/{orderId}/split`). */
|
|
4351
|
+
async split(orderId, input, auth2) {
|
|
4352
|
+
return this.ctx.http.request({
|
|
4353
|
+
method: "POST",
|
|
4354
|
+
path: `${this.base()}/${orderId}/split`,
|
|
4355
|
+
auth: auth2,
|
|
4356
|
+
body: input
|
|
2859
4357
|
});
|
|
2860
4358
|
}
|
|
2861
4359
|
};
|
|
2862
4360
|
|
|
2863
4361
|
// src/services/availability.ts
|
|
2864
4362
|
var ANON7 = { kind: "anonymous" };
|
|
4363
|
+
var SERVICE8 = { kind: "service" };
|
|
2865
4364
|
var AvailabilityService = class {
|
|
2866
4365
|
constructor(ctx) {
|
|
2867
4366
|
this.ctx = ctx;
|
|
@@ -2916,10 +4415,127 @@ var AvailabilityService = class {
|
|
|
2916
4415
|
}
|
|
2917
4416
|
);
|
|
2918
4417
|
}
|
|
4418
|
+
/**
|
|
4419
|
+
* Lists every availability record for a site (`GET /availability/site/{site}`),
|
|
4420
|
+
* wrapped into `PaginatedItems`. Default auth: anonymous.
|
|
4421
|
+
*/
|
|
4422
|
+
async listForSite(siteCode, params = {}, auth2 = ANON7) {
|
|
4423
|
+
const pageNumber = params.pageNumber ?? 1;
|
|
4424
|
+
const pageSize = params.pageSize ?? 50;
|
|
4425
|
+
const items = await this.ctx.http.request({
|
|
4426
|
+
method: "GET",
|
|
4427
|
+
path: `/availability/${this.ctx.tenant}/availability/site/${encodeURIComponent(siteCode)}`,
|
|
4428
|
+
query: {
|
|
4429
|
+
pageNumber,
|
|
4430
|
+
pageSize,
|
|
4431
|
+
...params.q === void 0 ? {} : { q: params.q },
|
|
4432
|
+
...params.sort === void 0 ? {} : { sort: params.sort }
|
|
4433
|
+
},
|
|
4434
|
+
auth: auth2
|
|
4435
|
+
});
|
|
4436
|
+
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
4437
|
+
}
|
|
4438
|
+
// --- Admin writes. Default auth: service. ---
|
|
4439
|
+
/**
|
|
4440
|
+
* Creates an availability record for a product on a site
|
|
4441
|
+
* (`POST /availability/{productId}/{site}`). Responds 409 when the record
|
|
4442
|
+
* already exists — use {@link update} to upsert. Default auth: service.
|
|
4443
|
+
*/
|
|
4444
|
+
async create(productId, siteCode, input, auth2 = SERVICE8) {
|
|
4445
|
+
return this.ctx.http.request({
|
|
4446
|
+
method: "POST",
|
|
4447
|
+
path: `/availability/${this.ctx.tenant}/availability/${encodeURIComponent(
|
|
4448
|
+
productId
|
|
4449
|
+
)}/${encodeURIComponent(siteCode)}`,
|
|
4450
|
+
body: input,
|
|
4451
|
+
auth: auth2
|
|
4452
|
+
});
|
|
4453
|
+
}
|
|
4454
|
+
/**
|
|
4455
|
+
* Upserts a product's availability on a site
|
|
4456
|
+
* (`PUT /availability/{productId}/{site}`). Returns the created record's id
|
|
4457
|
+
* on 201 and nothing on 204. This endpoint has no PATCH counterpart.
|
|
4458
|
+
* Default auth: service.
|
|
4459
|
+
*/
|
|
4460
|
+
async update(productId, siteCode, input, auth2 = SERVICE8) {
|
|
4461
|
+
return this.ctx.http.request({
|
|
4462
|
+
method: "PUT",
|
|
4463
|
+
path: `/availability/${this.ctx.tenant}/availability/${encodeURIComponent(
|
|
4464
|
+
productId
|
|
4465
|
+
)}/${encodeURIComponent(siteCode)}`,
|
|
4466
|
+
body: input,
|
|
4467
|
+
auth: auth2
|
|
4468
|
+
});
|
|
4469
|
+
}
|
|
4470
|
+
/**
|
|
4471
|
+
* Deletes a product's availability on a site
|
|
4472
|
+
* (`DELETE /availability/{productId}/{site}`). Default auth: service.
|
|
4473
|
+
*/
|
|
4474
|
+
async delete(productId, siteCode, auth2 = SERVICE8) {
|
|
4475
|
+
await this.ctx.http.request({
|
|
4476
|
+
method: "DELETE",
|
|
4477
|
+
path: `/availability/${this.ctx.tenant}/availability/${encodeURIComponent(
|
|
4478
|
+
productId
|
|
4479
|
+
)}/${encodeURIComponent(siteCode)}`,
|
|
4480
|
+
auth: auth2
|
|
4481
|
+
});
|
|
4482
|
+
}
|
|
4483
|
+
/**
|
|
4484
|
+
* Bulk-creates availability records (`POST /availability/bulk`). Responds 207
|
|
4485
|
+
* Multi-Status: partial failures do **not** throw — inspect each entry.
|
|
4486
|
+
*
|
|
4487
|
+
* `options.vendorId` limits the operation to a vendor's products. It is sent
|
|
4488
|
+
* as the `vendor-id` header. **Note:** the OpenAPI schema spells this header
|
|
4489
|
+
* `venodr-id`, which is an evident upstream typo (the body field is
|
|
4490
|
+
* `vendorId`); the SDK sends the corrected name. Unverified against the live
|
|
4491
|
+
* API — if the service really expects the misspelling, the filter silently
|
|
4492
|
+
* has no effect.
|
|
4493
|
+
*
|
|
4494
|
+
* Default auth: service.
|
|
4495
|
+
*/
|
|
4496
|
+
async bulkCreate(input, options = {}, auth2 = SERVICE8) {
|
|
4497
|
+
return this.ctx.http.request({
|
|
4498
|
+
method: "POST",
|
|
4499
|
+
path: `/availability/${this.ctx.tenant}/availability/bulk`,
|
|
4500
|
+
...options.vendorId === void 0 ? {} : { headers: { "vendor-id": options.vendorId } },
|
|
4501
|
+
body: input,
|
|
4502
|
+
auth: auth2
|
|
4503
|
+
});
|
|
4504
|
+
}
|
|
4505
|
+
/**
|
|
4506
|
+
* Bulk-updates availability records (`PUT /availability/bulk`). Responds 207
|
|
4507
|
+
* Multi-Status: partial failures do **not** throw — inspect each entry. See
|
|
4508
|
+
* {@link bulkCreate} for the `vendorId` header caveat. Default auth: service.
|
|
4509
|
+
*/
|
|
4510
|
+
async bulkUpdate(input, options = {}, auth2 = SERVICE8) {
|
|
4511
|
+
return this.ctx.http.request({
|
|
4512
|
+
method: "PUT",
|
|
4513
|
+
path: `/availability/${this.ctx.tenant}/availability/bulk`,
|
|
4514
|
+
...options.vendorId === void 0 ? {} : { headers: { "vendor-id": options.vendorId } },
|
|
4515
|
+
body: input,
|
|
4516
|
+
auth: auth2
|
|
4517
|
+
});
|
|
4518
|
+
}
|
|
4519
|
+
/**
|
|
4520
|
+
* Bulk-deletes availability records (`DELETE /availability/bulk`). Unusually
|
|
4521
|
+
* for a DELETE, this endpoint takes a body listing the records to remove.
|
|
4522
|
+
* Responds 207 Multi-Status: partial failures do **not** throw — inspect each
|
|
4523
|
+
* entry. See {@link bulkCreate} for the `vendorId` header caveat. Default
|
|
4524
|
+
* auth: service.
|
|
4525
|
+
*/
|
|
4526
|
+
async bulkDelete(input, options = {}, auth2 = SERVICE8) {
|
|
4527
|
+
return this.ctx.http.request({
|
|
4528
|
+
method: "DELETE",
|
|
4529
|
+
path: `/availability/${this.ctx.tenant}/availability/bulk`,
|
|
4530
|
+
...options.vendorId === void 0 ? {} : { headers: { "vendor-id": options.vendorId } },
|
|
4531
|
+
body: input,
|
|
4532
|
+
auth: auth2
|
|
4533
|
+
});
|
|
4534
|
+
}
|
|
2919
4535
|
};
|
|
2920
4536
|
|
|
2921
4537
|
// src/services/tenant-config.ts
|
|
2922
|
-
var
|
|
4538
|
+
var SERVICE9 = { kind: "service" };
|
|
2923
4539
|
var TenantConfigService = class {
|
|
2924
4540
|
constructor(ctx) {
|
|
2925
4541
|
this.ctx = ctx;
|
|
@@ -2930,7 +4546,7 @@ var TenantConfigService = class {
|
|
|
2930
4546
|
return `/configuration/${this.ctx.tenant}/configurations`;
|
|
2931
4547
|
}
|
|
2932
4548
|
/** List tenant configurations, optionally filtered by `keys`. */
|
|
2933
|
-
async list(opts = {}, auth2 =
|
|
4549
|
+
async list(opts = {}, auth2 = SERVICE9) {
|
|
2934
4550
|
const query = opts.keys && opts.keys.length > 0 ? { keys: opts.keys.join(",") } : void 0;
|
|
2935
4551
|
return this.ctx.http.request({
|
|
2936
4552
|
method: "GET",
|
|
@@ -2940,7 +4556,7 @@ var TenantConfigService = class {
|
|
|
2940
4556
|
});
|
|
2941
4557
|
}
|
|
2942
4558
|
/** Retrieve one tenant configuration by key. */
|
|
2943
|
-
async get(key, auth2 =
|
|
4559
|
+
async get(key, auth2 = SERVICE9) {
|
|
2944
4560
|
return this.ctx.http.request({
|
|
2945
4561
|
method: "GET",
|
|
2946
4562
|
path: `${this.base()}/${encodeURIComponent(key)}`,
|
|
@@ -2948,7 +4564,7 @@ var TenantConfigService = class {
|
|
|
2948
4564
|
});
|
|
2949
4565
|
}
|
|
2950
4566
|
/** Create one or more tenant configurations (array in, array out). */
|
|
2951
|
-
async create(drafts, auth2 =
|
|
4567
|
+
async create(drafts, auth2 = SERVICE9) {
|
|
2952
4568
|
return this.ctx.http.request({
|
|
2953
4569
|
method: "POST",
|
|
2954
4570
|
path: this.base(),
|
|
@@ -2957,7 +4573,7 @@ var TenantConfigService = class {
|
|
|
2957
4573
|
});
|
|
2958
4574
|
}
|
|
2959
4575
|
/** Update one tenant configuration by key. */
|
|
2960
|
-
async update(key, draft, auth2 =
|
|
4576
|
+
async update(key, draft, auth2 = SERVICE9) {
|
|
2961
4577
|
return this.ctx.http.request({
|
|
2962
4578
|
method: "PUT",
|
|
2963
4579
|
path: `${this.base()}/${encodeURIComponent(key)}`,
|
|
@@ -2966,17 +4582,29 @@ var TenantConfigService = class {
|
|
|
2966
4582
|
});
|
|
2967
4583
|
}
|
|
2968
4584
|
/** Delete one tenant configuration by key. */
|
|
2969
|
-
async delete(key, auth2 =
|
|
4585
|
+
async delete(key, auth2 = SERVICE9) {
|
|
2970
4586
|
await this.ctx.http.request({
|
|
2971
4587
|
method: "DELETE",
|
|
2972
4588
|
path: `${this.base()}/${encodeURIComponent(key)}`,
|
|
2973
4589
|
auth: auth2
|
|
2974
4590
|
});
|
|
2975
4591
|
}
|
|
4592
|
+
/**
|
|
4593
|
+
* List the platform-wide global configurations
|
|
4594
|
+
* (`GET /global-configurations`) — a separate resource from the tenant's own
|
|
4595
|
+
* `/configurations`.
|
|
4596
|
+
*/
|
|
4597
|
+
async listGlobal(auth2 = SERVICE9) {
|
|
4598
|
+
return this.ctx.http.request({
|
|
4599
|
+
method: "GET",
|
|
4600
|
+
path: `/configuration/${this.ctx.tenant}/global-configurations`,
|
|
4601
|
+
auth: auth2
|
|
4602
|
+
});
|
|
4603
|
+
}
|
|
2976
4604
|
};
|
|
2977
4605
|
|
|
2978
4606
|
// src/services/client-config.ts
|
|
2979
|
-
var
|
|
4607
|
+
var SERVICE10 = { kind: "service" };
|
|
2980
4608
|
var ClientConfigService = class {
|
|
2981
4609
|
constructor(ctx) {
|
|
2982
4610
|
this.ctx = ctx;
|
|
@@ -2987,7 +4615,7 @@ var ClientConfigService = class {
|
|
|
2987
4615
|
return `/configuration/${this.ctx.tenant}/clients/${encodeURIComponent(client)}/configurations`;
|
|
2988
4616
|
}
|
|
2989
4617
|
/** List a client's configurations, optionally filtered by `keys`. */
|
|
2990
|
-
async list(client, opts = {}, auth2 =
|
|
4618
|
+
async list(client, opts = {}, auth2 = SERVICE10) {
|
|
2991
4619
|
const query = opts.keys && opts.keys.length > 0 ? { keys: opts.keys.join(",") } : void 0;
|
|
2992
4620
|
return this.ctx.http.request({
|
|
2993
4621
|
method: "GET",
|
|
@@ -2997,7 +4625,7 @@ var ClientConfigService = class {
|
|
|
2997
4625
|
});
|
|
2998
4626
|
}
|
|
2999
4627
|
/** Retrieve one client configuration by key. */
|
|
3000
|
-
async get(client, key, auth2 =
|
|
4628
|
+
async get(client, key, auth2 = SERVICE10) {
|
|
3001
4629
|
return this.ctx.http.request({
|
|
3002
4630
|
method: "GET",
|
|
3003
4631
|
path: `${this.base(client)}/${encodeURIComponent(key)}`,
|
|
@@ -3005,7 +4633,7 @@ var ClientConfigService = class {
|
|
|
3005
4633
|
});
|
|
3006
4634
|
}
|
|
3007
4635
|
/** Create one or more client configurations. Injects `client` into each item. */
|
|
3008
|
-
async create(client, drafts, auth2 =
|
|
4636
|
+
async create(client, drafts, auth2 = SERVICE10) {
|
|
3009
4637
|
const body = drafts.map((d) => ({ ...d, client }));
|
|
3010
4638
|
return this.ctx.http.request({
|
|
3011
4639
|
method: "POST",
|
|
@@ -3015,7 +4643,7 @@ var ClientConfigService = class {
|
|
|
3015
4643
|
});
|
|
3016
4644
|
}
|
|
3017
4645
|
/** Update one client configuration by key. Injects `client` into the body. */
|
|
3018
|
-
async update(client, key, draft, auth2 =
|
|
4646
|
+
async update(client, key, draft, auth2 = SERVICE10) {
|
|
3019
4647
|
return this.ctx.http.request({
|
|
3020
4648
|
method: "PUT",
|
|
3021
4649
|
path: `${this.base(client)}/${encodeURIComponent(key)}`,
|
|
@@ -3024,13 +4652,25 @@ var ClientConfigService = class {
|
|
|
3024
4652
|
});
|
|
3025
4653
|
}
|
|
3026
4654
|
/** Delete one client configuration by key. */
|
|
3027
|
-
async delete(client, key, auth2 =
|
|
4655
|
+
async delete(client, key, auth2 = SERVICE10) {
|
|
3028
4656
|
await this.ctx.http.request({
|
|
3029
4657
|
method: "DELETE",
|
|
3030
4658
|
path: `${this.base(client)}/${encodeURIComponent(key)}`,
|
|
3031
4659
|
auth: auth2
|
|
3032
4660
|
});
|
|
3033
4661
|
}
|
|
4662
|
+
/**
|
|
4663
|
+
* List the client ids that have configurations (`GET /clients`). Note this
|
|
4664
|
+
* targets `/configuration/{tenant}/clients` directly — the private `base`
|
|
4665
|
+
* helper appends `/configurations` for a specific client.
|
|
4666
|
+
*/
|
|
4667
|
+
async listClients(auth2 = SERVICE10) {
|
|
4668
|
+
return this.ctx.http.request({
|
|
4669
|
+
method: "GET",
|
|
4670
|
+
path: `/configuration/${this.ctx.tenant}/clients`,
|
|
4671
|
+
auth: auth2
|
|
4672
|
+
});
|
|
4673
|
+
}
|
|
3034
4674
|
};
|
|
3035
4675
|
|
|
3036
4676
|
// src/services/shopping-list.ts
|
|
@@ -3131,7 +4771,7 @@ var ShoppingListService = class {
|
|
|
3131
4771
|
};
|
|
3132
4772
|
|
|
3133
4773
|
// src/services/ai-rag-indexer.ts
|
|
3134
|
-
var
|
|
4774
|
+
var SERVICE11 = { kind: "service" };
|
|
3135
4775
|
var RagIndexerService = class {
|
|
3136
4776
|
constructor(ctx) {
|
|
3137
4777
|
this.ctx = ctx;
|
|
@@ -3142,7 +4782,7 @@ var RagIndexerService = class {
|
|
|
3142
4782
|
return `/ai-rag-indexer/${this.ctx.tenant}/${encodeURIComponent(type)}`;
|
|
3143
4783
|
}
|
|
3144
4784
|
/** The indexable embedding field names for `type` (default `"PRODUCT"`). */
|
|
3145
|
-
async ragMetadata(type = "PRODUCT", auth2 =
|
|
4785
|
+
async ragMetadata(type = "PRODUCT", auth2 = SERVICE11) {
|
|
3146
4786
|
return this.ctx.http.request({
|
|
3147
4787
|
method: "GET",
|
|
3148
4788
|
path: `${this.base(type)}/rag-metadata`,
|
|
@@ -3150,7 +4790,7 @@ var RagIndexerService = class {
|
|
|
3150
4790
|
});
|
|
3151
4791
|
}
|
|
3152
4792
|
/** The filterable metadata fields for `type` (default `"PRODUCT"`). */
|
|
3153
|
-
async filterMetadata(type = "PRODUCT", auth2 =
|
|
4793
|
+
async filterMetadata(type = "PRODUCT", auth2 = SERVICE11) {
|
|
3154
4794
|
return this.ctx.http.request({
|
|
3155
4795
|
method: "GET",
|
|
3156
4796
|
path: `${this.base(type)}/filter-metadata`,
|
|
@@ -3164,7 +4804,7 @@ var RagIndexerService = class {
|
|
|
3164
4804
|
* @deprecated since 2026-06-18, removal 2026-12-01 — use the indexing service:
|
|
3165
4805
|
* `client.indexing.createReindexJob({ entityType: "PRODUCT", rag: true })`.
|
|
3166
4806
|
*/
|
|
3167
|
-
async reindex(type = "PRODUCT", auth2 =
|
|
4807
|
+
async reindex(type = "PRODUCT", auth2 = SERVICE11) {
|
|
3168
4808
|
await this.ctx.http.request({
|
|
3169
4809
|
method: "POST",
|
|
3170
4810
|
path: `${this.base(type)}/reindex`,
|
|
@@ -3174,7 +4814,7 @@ var RagIndexerService = class {
|
|
|
3174
4814
|
};
|
|
3175
4815
|
|
|
3176
4816
|
// src/services/sequential-id.ts
|
|
3177
|
-
var
|
|
4817
|
+
var SERVICE12 = { kind: "service" };
|
|
3178
4818
|
var SequentialIdService = class {
|
|
3179
4819
|
constructor(ctx) {
|
|
3180
4820
|
this.ctx = ctx;
|
|
@@ -3185,7 +4825,7 @@ var SequentialIdService = class {
|
|
|
3185
4825
|
return `/sequential-id/${this.ctx.tenant}/schemas`;
|
|
3186
4826
|
}
|
|
3187
4827
|
/** List all sequence schemas for the tenant. */
|
|
3188
|
-
async listSchemas(auth2 =
|
|
4828
|
+
async listSchemas(auth2 = SERVICE12) {
|
|
3189
4829
|
return this.ctx.http.request({
|
|
3190
4830
|
method: "GET",
|
|
3191
4831
|
path: this.base(),
|
|
@@ -3193,7 +4833,7 @@ var SequentialIdService = class {
|
|
|
3193
4833
|
});
|
|
3194
4834
|
}
|
|
3195
4835
|
/** Retrieve one sequence schema by id. */
|
|
3196
|
-
async getSchema(schemaId, auth2 =
|
|
4836
|
+
async getSchema(schemaId, auth2 = SERVICE12) {
|
|
3197
4837
|
return this.ctx.http.request({
|
|
3198
4838
|
method: "GET",
|
|
3199
4839
|
path: `${this.base()}/${encodeURIComponent(schemaId)}`,
|
|
@@ -3201,7 +4841,7 @@ var SequentialIdService = class {
|
|
|
3201
4841
|
});
|
|
3202
4842
|
}
|
|
3203
4843
|
/** Create a sequence schema. Schemas are immutable — there is no update. */
|
|
3204
|
-
async createSchema(schema, auth2 =
|
|
4844
|
+
async createSchema(schema, auth2 = SERVICE12) {
|
|
3205
4845
|
return this.ctx.http.request({
|
|
3206
4846
|
method: "POST",
|
|
3207
4847
|
path: this.base(),
|
|
@@ -3210,7 +4850,7 @@ var SequentialIdService = class {
|
|
|
3210
4850
|
});
|
|
3211
4851
|
}
|
|
3212
4852
|
/** Delete a sequence schema by id. */
|
|
3213
|
-
async deleteSchema(schemaId, auth2 =
|
|
4853
|
+
async deleteSchema(schemaId, auth2 = SERVICE12) {
|
|
3214
4854
|
await this.ctx.http.request({
|
|
3215
4855
|
method: "DELETE",
|
|
3216
4856
|
path: `${this.base()}/${encodeURIComponent(schemaId)}`,
|
|
@@ -3218,7 +4858,7 @@ var SequentialIdService = class {
|
|
|
3218
4858
|
});
|
|
3219
4859
|
}
|
|
3220
4860
|
/** Mark a schema active for its type (only one schema may be active per type). */
|
|
3221
|
-
async setActiveSchema(schemaId, auth2 =
|
|
4861
|
+
async setActiveSchema(schemaId, auth2 = SERVICE12) {
|
|
3222
4862
|
await this.ctx.http.request({
|
|
3223
4863
|
method: "POST",
|
|
3224
4864
|
path: `${this.base()}/${encodeURIComponent(schemaId)}/setActive`,
|
|
@@ -3226,7 +4866,7 @@ var SequentialIdService = class {
|
|
|
3226
4866
|
});
|
|
3227
4867
|
}
|
|
3228
4868
|
/** Get the active schema for a given schema type. */
|
|
3229
|
-
async listSchemasByType(schemaType, auth2 =
|
|
4869
|
+
async listSchemasByType(schemaType, auth2 = SERVICE12) {
|
|
3230
4870
|
return this.ctx.http.request({
|
|
3231
4871
|
method: "GET",
|
|
3232
4872
|
path: `${this.base()}/types/${encodeURIComponent(schemaType)}`,
|
|
@@ -3238,7 +4878,7 @@ var SequentialIdService = class {
|
|
|
3238
4878
|
* `sequenceKey` (independent sub-pool counter) and `placeholders`.
|
|
3239
4879
|
* `opts.siteCode` derives time/country placeholders from the site's settings.
|
|
3240
4880
|
*/
|
|
3241
|
-
async nextId(schemaType, body = {}, opts = {}, auth2 =
|
|
4881
|
+
async nextId(schemaType, body = {}, opts = {}, auth2 = SERVICE12) {
|
|
3242
4882
|
const query = opts.siteCode ? { siteCode: opts.siteCode } : void 0;
|
|
3243
4883
|
return this.ctx.http.request({
|
|
3244
4884
|
method: "POST",
|
|
@@ -3253,7 +4893,7 @@ var SequentialIdService = class {
|
|
|
3253
4893
|
* endpoint path omits the `{tenant}` segment — the service derives the
|
|
3254
4894
|
* tenant from the token.
|
|
3255
4895
|
*/
|
|
3256
|
-
async nextIdsBatch(req, auth2 =
|
|
4896
|
+
async nextIdsBatch(req, auth2 = SERVICE12) {
|
|
3257
4897
|
return this.ctx.http.request({
|
|
3258
4898
|
method: "POST",
|
|
3259
4899
|
path: `/sequential-id/sequenceSchemaBatch/nextIds`,
|
|
@@ -3264,7 +4904,7 @@ var SequentialIdService = class {
|
|
|
3264
4904
|
};
|
|
3265
4905
|
|
|
3266
4906
|
// src/services/fee.ts
|
|
3267
|
-
var
|
|
4907
|
+
var SERVICE13 = { kind: "service" };
|
|
3268
4908
|
var FeeService = class {
|
|
3269
4909
|
constructor(ctx) {
|
|
3270
4910
|
this.ctx = ctx;
|
|
@@ -3287,7 +4927,7 @@ var FeeService = class {
|
|
|
3287
4927
|
* returned page is full). Defaults match Emporix server defaults
|
|
3288
4928
|
* (`pageNumber: 1`, `pageSize: 60`).
|
|
3289
4929
|
*/
|
|
3290
|
-
async list(query = {}, auth2 =
|
|
4930
|
+
async list(query = {}, auth2 = SERVICE13) {
|
|
3291
4931
|
const pageNumber = query.pageNumber ?? 1;
|
|
3292
4932
|
const pageSize = query.pageSize ?? 60;
|
|
3293
4933
|
const items = await this.ctx.http.request({
|
|
@@ -3299,7 +4939,7 @@ var FeeService = class {
|
|
|
3299
4939
|
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
3300
4940
|
}
|
|
3301
4941
|
/** Retrieve one fee definition by id. */
|
|
3302
|
-
async get(id, auth2 =
|
|
4942
|
+
async get(id, auth2 = SERVICE13) {
|
|
3303
4943
|
return this.ctx.http.request({
|
|
3304
4944
|
method: "GET",
|
|
3305
4945
|
path: `${this.feesBase()}/${encodeURIComponent(id)}`,
|
|
@@ -3307,7 +4947,7 @@ var FeeService = class {
|
|
|
3307
4947
|
});
|
|
3308
4948
|
}
|
|
3309
4949
|
/** Create a fee definition. */
|
|
3310
|
-
async create(draft, auth2 =
|
|
4950
|
+
async create(draft, auth2 = SERVICE13) {
|
|
3311
4951
|
return this.ctx.http.request({
|
|
3312
4952
|
method: "POST",
|
|
3313
4953
|
path: this.feesBase(),
|
|
@@ -3316,7 +4956,7 @@ var FeeService = class {
|
|
|
3316
4956
|
});
|
|
3317
4957
|
}
|
|
3318
4958
|
/** Update a fee definition by id. */
|
|
3319
|
-
async update(id, draft, auth2 =
|
|
4959
|
+
async update(id, draft, auth2 = SERVICE13) {
|
|
3320
4960
|
return this.ctx.http.request({
|
|
3321
4961
|
method: "PUT",
|
|
3322
4962
|
path: `${this.feesBase()}/${encodeURIComponent(id)}`,
|
|
@@ -3325,7 +4965,7 @@ var FeeService = class {
|
|
|
3325
4965
|
});
|
|
3326
4966
|
}
|
|
3327
4967
|
/** Delete a fee definition by id. */
|
|
3328
|
-
async delete(id, auth2 =
|
|
4968
|
+
async delete(id, auth2 = SERVICE13) {
|
|
3329
4969
|
await this.ctx.http.request({
|
|
3330
4970
|
method: "DELETE",
|
|
3331
4971
|
path: `${this.feesBase()}/${encodeURIComponent(id)}`,
|
|
@@ -3334,7 +4974,7 @@ var FeeService = class {
|
|
|
3334
4974
|
}
|
|
3335
4975
|
// --- Item-fee mappings ---
|
|
3336
4976
|
/** List all item-fee mappings. */
|
|
3337
|
-
async listItemFees(auth2 =
|
|
4977
|
+
async listItemFees(auth2 = SERVICE13) {
|
|
3338
4978
|
return this.ctx.http.request({
|
|
3339
4979
|
method: "GET",
|
|
3340
4980
|
path: this.itemFeesBase(),
|
|
@@ -3342,7 +4982,7 @@ var FeeService = class {
|
|
|
3342
4982
|
});
|
|
3343
4983
|
}
|
|
3344
4984
|
/** Fee mappings for one item YRN. */
|
|
3345
|
-
async getItemFees(itemYrn, auth2 =
|
|
4985
|
+
async getItemFees(itemYrn, auth2 = SERVICE13) {
|
|
3346
4986
|
return this.ctx.http.request({
|
|
3347
4987
|
method: "GET",
|
|
3348
4988
|
path: `${this.itemFeesBase()}/${encodeURIComponent(itemYrn)}/fees`,
|
|
@@ -3350,7 +4990,7 @@ var FeeService = class {
|
|
|
3350
4990
|
});
|
|
3351
4991
|
}
|
|
3352
4992
|
/** Create an item-fee mapping. */
|
|
3353
|
-
async createItemFee(draft, auth2 =
|
|
4993
|
+
async createItemFee(draft, auth2 = SERVICE13) {
|
|
3354
4994
|
return this.ctx.http.request({
|
|
3355
4995
|
method: "POST",
|
|
3356
4996
|
path: this.itemFeesBase(),
|
|
@@ -3362,7 +5002,7 @@ var FeeService = class {
|
|
|
3362
5002
|
* Set the fee list for an item YRN. Destructive replace by default; pass
|
|
3363
5003
|
* `{ partial: true }` to merge (`?partial=true`).
|
|
3364
5004
|
*/
|
|
3365
|
-
async setItemFees(itemYrn, feeIds, opts = {}, auth2 =
|
|
5005
|
+
async setItemFees(itemYrn, feeIds, opts = {}, auth2 = SERVICE13) {
|
|
3366
5006
|
return this.ctx.http.request({
|
|
3367
5007
|
method: "PUT",
|
|
3368
5008
|
path: `${this.itemFeesBase()}/${encodeURIComponent(itemYrn)}/fees`,
|
|
@@ -3375,7 +5015,7 @@ var FeeService = class {
|
|
|
3375
5015
|
* Delete item-fee mappings for a YRN. Without `feeId`, removes all mappings
|
|
3376
5016
|
* for the YRN; with `feeId`, removes that single fee from the mapping.
|
|
3377
5017
|
*/
|
|
3378
|
-
async deleteItemFees(itemYrn, feeId, auth2 =
|
|
5018
|
+
async deleteItemFees(itemYrn, feeId, auth2 = SERVICE13) {
|
|
3379
5019
|
const base = `${this.itemFeesBase()}/${encodeURIComponent(itemYrn)}/fees`;
|
|
3380
5020
|
await this.ctx.http.request({
|
|
3381
5021
|
method: "DELETE",
|
|
@@ -3384,7 +5024,7 @@ var FeeService = class {
|
|
|
3384
5024
|
});
|
|
3385
5025
|
}
|
|
3386
5026
|
/** Search item-fee mappings by item YRNs + site. */
|
|
3387
|
-
async searchItemFees(search, auth2 =
|
|
5027
|
+
async searchItemFees(search, auth2 = SERVICE13) {
|
|
3388
5028
|
return this.ctx.http.request({
|
|
3389
5029
|
method: "POST",
|
|
3390
5030
|
path: `${this.itemFeesBase()}/search`,
|
|
@@ -3394,7 +5034,7 @@ var FeeService = class {
|
|
|
3394
5034
|
}
|
|
3395
5035
|
// --- Product-fee mappings ---
|
|
3396
5036
|
/** Fee mappings for a product id. */
|
|
3397
|
-
async getProductFees(productId, auth2 =
|
|
5037
|
+
async getProductFees(productId, auth2 = SERVICE13) {
|
|
3398
5038
|
return this.ctx.http.request({
|
|
3399
5039
|
method: "GET",
|
|
3400
5040
|
path: `${this.productFeesBase()}/${encodeURIComponent(productId)}/fees`,
|
|
@@ -3405,7 +5045,7 @@ var FeeService = class {
|
|
|
3405
5045
|
* Set the fee list for a product id. Destructive replace by default; pass
|
|
3406
5046
|
* `{ partial: true }` to merge (`?partial=true`).
|
|
3407
5047
|
*/
|
|
3408
|
-
async setProductFees(productId, feeIds, opts = {}, auth2 =
|
|
5048
|
+
async setProductFees(productId, feeIds, opts = {}, auth2 = SERVICE13) {
|
|
3409
5049
|
return this.ctx.http.request({
|
|
3410
5050
|
method: "PUT",
|
|
3411
5051
|
path: `${this.productFeesBase()}/${encodeURIComponent(productId)}/fees`,
|
|
@@ -3415,13 +5055,54 @@ var FeeService = class {
|
|
|
3415
5055
|
});
|
|
3416
5056
|
}
|
|
3417
5057
|
/** Delete all fee mappings for a product id. */
|
|
3418
|
-
async deleteProductFees(productId, auth2 =
|
|
5058
|
+
async deleteProductFees(productId, auth2 = SERVICE13) {
|
|
3419
5059
|
await this.ctx.http.request({
|
|
3420
5060
|
method: "DELETE",
|
|
3421
5061
|
path: `${this.productFeesBase()}/${encodeURIComponent(productId)}/fees`,
|
|
3422
5062
|
auth: auth2
|
|
3423
5063
|
});
|
|
3424
5064
|
}
|
|
5065
|
+
/**
|
|
5066
|
+
* Removes **one** fee from a product
|
|
5067
|
+
* (`DELETE /productFees/{productId}/fees/{feeId}`). Use
|
|
5068
|
+
* {@link deleteProductFees} to clear every fee of a product.
|
|
5069
|
+
*/
|
|
5070
|
+
async deleteProductFee(productId, feeId, auth2 = SERVICE13) {
|
|
5071
|
+
await this.ctx.http.request({
|
|
5072
|
+
method: "DELETE",
|
|
5073
|
+
path: `${this.productFeesBase()}/${encodeURIComponent(productId)}/fees/${encodeURIComponent(feeId)}`,
|
|
5074
|
+
auth: auth2
|
|
5075
|
+
});
|
|
5076
|
+
}
|
|
5077
|
+
/**
|
|
5078
|
+
* Finds item fees for one product across several sites
|
|
5079
|
+
* (`POST /itemFees/searchByProductId`).
|
|
5080
|
+
*/
|
|
5081
|
+
async searchItemFeesByProductId(search, auth2 = SERVICE13) {
|
|
5082
|
+
return this.ctx.http.request({
|
|
5083
|
+
method: "POST",
|
|
5084
|
+
path: `${this.itemFeesBase()}/searchByProductId`,
|
|
5085
|
+
auth: auth2,
|
|
5086
|
+
body: search,
|
|
5087
|
+
idempotent: true
|
|
5088
|
+
// pure read over POST — safe to replay on 5xx/429
|
|
5089
|
+
});
|
|
5090
|
+
}
|
|
5091
|
+
/**
|
|
5092
|
+
* Finds item fees for several products on one site
|
|
5093
|
+
* (`POST /itemFees/searchByProductIds`). Note the upstream asymmetry:
|
|
5094
|
+
* `productIds` is a comma-separated **string** and `siteCode` is singular.
|
|
5095
|
+
*/
|
|
5096
|
+
async searchItemFeesByProductIds(search, auth2 = SERVICE13) {
|
|
5097
|
+
return this.ctx.http.request({
|
|
5098
|
+
method: "POST",
|
|
5099
|
+
path: `${this.itemFeesBase()}/searchByProductIds`,
|
|
5100
|
+
auth: auth2,
|
|
5101
|
+
body: search,
|
|
5102
|
+
idempotent: true
|
|
5103
|
+
// pure read over POST — safe to replay on 5xx/429
|
|
5104
|
+
});
|
|
5105
|
+
}
|
|
3425
5106
|
};
|
|
3426
5107
|
|
|
3427
5108
|
// src/services/cloud-functions.ts
|
|
@@ -3448,7 +5129,7 @@ var CloudFunctionsService = class {
|
|
|
3448
5129
|
};
|
|
3449
5130
|
|
|
3450
5131
|
// src/services/webhook.ts
|
|
3451
|
-
var
|
|
5132
|
+
var SERVICE14 = { kind: "service" };
|
|
3452
5133
|
var WebhookService = class {
|
|
3453
5134
|
constructor(ctx) {
|
|
3454
5135
|
this.ctx = ctx;
|
|
@@ -3459,7 +5140,7 @@ var WebhookService = class {
|
|
|
3459
5140
|
return `/webhook/${this.ctx.tenant}`;
|
|
3460
5141
|
}
|
|
3461
5142
|
/** List the event-subscription catalog with each event's on/off state. */
|
|
3462
|
-
async listEventSubscriptions(auth2 =
|
|
5143
|
+
async listEventSubscriptions(auth2 = SERVICE14) {
|
|
3463
5144
|
return this.ctx.http.request({
|
|
3464
5145
|
method: "GET",
|
|
3465
5146
|
path: `${this.base()}/event-subscriptions`,
|
|
@@ -3472,7 +5153,7 @@ var WebhookService = class {
|
|
|
3472
5153
|
* `code`/`status` (e.g. `results.filter(r => (r.code ?? 0) >= 400)`). Does
|
|
3473
5154
|
* NOT throw on a 207 with failed items; only a non-2xx HTTP status throws.
|
|
3474
5155
|
*/
|
|
3475
|
-
async updateEventSubscriptions(items, auth2 =
|
|
5156
|
+
async updateEventSubscriptions(items, auth2 = SERVICE14) {
|
|
3476
5157
|
return this.ctx.http.request({
|
|
3477
5158
|
method: "PATCH",
|
|
3478
5159
|
path: `${this.base()}/event-subscriptions`,
|
|
@@ -3481,7 +5162,7 @@ var WebhookService = class {
|
|
|
3481
5162
|
});
|
|
3482
5163
|
}
|
|
3483
5164
|
/** List delivery configurations. */
|
|
3484
|
-
async listConfigs(auth2 =
|
|
5165
|
+
async listConfigs(auth2 = SERVICE14) {
|
|
3485
5166
|
return this.ctx.http.request({
|
|
3486
5167
|
method: "GET",
|
|
3487
5168
|
path: `${this.base()}/config`,
|
|
@@ -3489,7 +5170,7 @@ var WebhookService = class {
|
|
|
3489
5170
|
});
|
|
3490
5171
|
}
|
|
3491
5172
|
/** Retrieve one delivery configuration by code. */
|
|
3492
|
-
async getConfig(code, auth2 =
|
|
5173
|
+
async getConfig(code, auth2 = SERVICE14) {
|
|
3493
5174
|
return this.ctx.http.request({
|
|
3494
5175
|
method: "GET",
|
|
3495
5176
|
path: `${this.base()}/config/${encodeURIComponent(code)}`,
|
|
@@ -3497,7 +5178,7 @@ var WebhookService = class {
|
|
|
3497
5178
|
});
|
|
3498
5179
|
}
|
|
3499
5180
|
/** Create a delivery configuration. Returns the server-assigned `{ code }`. */
|
|
3500
|
-
async createConfig(draft, auth2 =
|
|
5181
|
+
async createConfig(draft, auth2 = SERVICE14) {
|
|
3501
5182
|
return this.ctx.http.request({
|
|
3502
5183
|
method: "POST",
|
|
3503
5184
|
path: `${this.base()}/config`,
|
|
@@ -3506,7 +5187,7 @@ var WebhookService = class {
|
|
|
3506
5187
|
});
|
|
3507
5188
|
}
|
|
3508
5189
|
/** Replace a delivery configuration by code (204). */
|
|
3509
|
-
async replaceConfig(code, draft, auth2 =
|
|
5190
|
+
async replaceConfig(code, draft, auth2 = SERVICE14) {
|
|
3510
5191
|
await this.ctx.http.request({
|
|
3511
5192
|
method: "PUT",
|
|
3512
5193
|
path: `${this.base()}/config/${encodeURIComponent(code)}`,
|
|
@@ -3518,7 +5199,7 @@ var WebhookService = class {
|
|
|
3518
5199
|
* Partially update a delivery configuration by code (204). The body is an
|
|
3519
5200
|
* **array** of `{ op, path, value }` operations (UPSERT / REMOVE).
|
|
3520
5201
|
*/
|
|
3521
|
-
async patchConfig(code, patches, auth2 =
|
|
5202
|
+
async patchConfig(code, patches, auth2 = SERVICE14) {
|
|
3522
5203
|
await this.ctx.http.request({
|
|
3523
5204
|
method: "PATCH",
|
|
3524
5205
|
path: `${this.base()}/config/${encodeURIComponent(code)}`,
|
|
@@ -3530,7 +5211,7 @@ var WebhookService = class {
|
|
|
3530
5211
|
* Delete a delivery configuration by code. Pass `{ force: true }` to delete
|
|
3531
5212
|
* the currently-active config (the server otherwise rejects it).
|
|
3532
5213
|
*/
|
|
3533
|
-
async deleteConfig(code, opts = {}, auth2 =
|
|
5214
|
+
async deleteConfig(code, opts = {}, auth2 = SERVICE14) {
|
|
3534
5215
|
await this.ctx.http.request({
|
|
3535
5216
|
method: "DELETE",
|
|
3536
5217
|
path: `${this.base()}/config/${encodeURIComponent(code)}`,
|
|
@@ -3539,7 +5220,7 @@ var WebhookService = class {
|
|
|
3539
5220
|
});
|
|
3540
5221
|
}
|
|
3541
5222
|
/** Read delivery statistics over an optional `YYYY-MM` range. */
|
|
3542
|
-
async getStatistics(query = {}, auth2 =
|
|
5223
|
+
async getStatistics(query = {}, auth2 = SERVICE14) {
|
|
3543
5224
|
const q = {};
|
|
3544
5225
|
if (query.fromYearMonth) q.fromYearMonth = query.fromYearMonth;
|
|
3545
5226
|
if (query.toYearMonth) q.toYearMonth = query.toYearMonth;
|
|
@@ -3551,7 +5232,7 @@ var WebhookService = class {
|
|
|
3551
5232
|
});
|
|
3552
5233
|
}
|
|
3553
5234
|
/** Obtain Svix dashboard access (URL / token). */
|
|
3554
|
-
async getDashboardAccess(auth2 =
|
|
5235
|
+
async getDashboardAccess(auth2 = SERVICE14) {
|
|
3555
5236
|
return this.ctx.http.request({
|
|
3556
5237
|
method: "GET",
|
|
3557
5238
|
path: `${this.base()}/dashboard-access`,
|
|
@@ -3561,7 +5242,10 @@ var WebhookService = class {
|
|
|
3561
5242
|
};
|
|
3562
5243
|
|
|
3563
5244
|
// src/services/schema.ts
|
|
3564
|
-
var
|
|
5245
|
+
var SERVICE15 = { kind: "service" };
|
|
5246
|
+
function toJsonBlob(file) {
|
|
5247
|
+
return file instanceof Blob ? file : new Blob([JSON.stringify(file)], { type: "application/json" });
|
|
5248
|
+
}
|
|
3565
5249
|
var SchemaService = class {
|
|
3566
5250
|
constructor(ctx) {
|
|
3567
5251
|
this.ctx = ctx;
|
|
@@ -3577,6 +5261,9 @@ var SchemaService = class {
|
|
|
3577
5261
|
instancesBase(type) {
|
|
3578
5262
|
return `${this.entitiesBase()}/${encodeURIComponent(type)}/instances`;
|
|
3579
5263
|
}
|
|
5264
|
+
referencesBase() {
|
|
5265
|
+
return `/schema/${this.ctx.tenant}/references`;
|
|
5266
|
+
}
|
|
3580
5267
|
// --- (A) Schemas ---------------------------------------------------------
|
|
3581
5268
|
/**
|
|
3582
5269
|
* List schemas, wrapped in the shared {@link PaginatedItems} envelope.
|
|
@@ -3584,7 +5271,7 @@ var SchemaService = class {
|
|
|
3584
5271
|
* Pagination defaults match the rest of the SDK (`pageNumber: 1`,
|
|
3585
5272
|
* `pageSize: 60`).
|
|
3586
5273
|
*/
|
|
3587
|
-
async listSchemas(query = {}, auth2 =
|
|
5274
|
+
async listSchemas(query = {}, auth2 = SERVICE15) {
|
|
3588
5275
|
const pageNumber = query.pageNumber ?? 1;
|
|
3589
5276
|
const pageSize = query.pageSize ?? 60;
|
|
3590
5277
|
const q = { pageNumber, pageSize };
|
|
@@ -3599,7 +5286,7 @@ var SchemaService = class {
|
|
|
3599
5286
|
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
3600
5287
|
}
|
|
3601
5288
|
/** Retrieve one schema by id. */
|
|
3602
|
-
async getSchema(id, auth2 =
|
|
5289
|
+
async getSchema(id, auth2 = SERVICE15) {
|
|
3603
5290
|
return this.ctx.http.request({
|
|
3604
5291
|
method: "GET",
|
|
3605
5292
|
path: `${this.schemasBase()}/${encodeURIComponent(id)}`,
|
|
@@ -3607,7 +5294,7 @@ var SchemaService = class {
|
|
|
3607
5294
|
});
|
|
3608
5295
|
}
|
|
3609
5296
|
/** Create a schema. */
|
|
3610
|
-
async createSchema(draft, auth2 =
|
|
5297
|
+
async createSchema(draft, auth2 = SERVICE15) {
|
|
3611
5298
|
return this.ctx.http.request({
|
|
3612
5299
|
method: "POST",
|
|
3613
5300
|
path: this.schemasBase(),
|
|
@@ -3620,7 +5307,7 @@ var SchemaService = class {
|
|
|
3620
5307
|
* stale version yields 409 Conflict (propagated as the standard conflict
|
|
3621
5308
|
* error).
|
|
3622
5309
|
*/
|
|
3623
|
-
async updateSchema(id, draft, auth2 =
|
|
5310
|
+
async updateSchema(id, draft, auth2 = SERVICE15) {
|
|
3624
5311
|
return this.ctx.http.request({
|
|
3625
5312
|
method: "PUT",
|
|
3626
5313
|
path: `${this.schemasBase()}/${encodeURIComponent(id)}`,
|
|
@@ -3629,7 +5316,7 @@ var SchemaService = class {
|
|
|
3629
5316
|
});
|
|
3630
5317
|
}
|
|
3631
5318
|
/** Delete a schema by id. */
|
|
3632
|
-
async deleteSchema(id, auth2 =
|
|
5319
|
+
async deleteSchema(id, auth2 = SERVICE15) {
|
|
3633
5320
|
await this.ctx.http.request({
|
|
3634
5321
|
method: "DELETE",
|
|
3635
5322
|
path: `${this.schemasBase()}/${encodeURIComponent(id)}`,
|
|
@@ -3640,7 +5327,7 @@ var SchemaService = class {
|
|
|
3640
5327
|
* Validate a schema document without persisting it (`POST /schemas/file`).
|
|
3641
5328
|
* Returns the server's validation result verbatim.
|
|
3642
5329
|
*/
|
|
3643
|
-
async validateSchemaFile(body, auth2 =
|
|
5330
|
+
async validateSchemaFile(body, auth2 = SERVICE15) {
|
|
3644
5331
|
return this.ctx.http.request({
|
|
3645
5332
|
method: "POST",
|
|
3646
5333
|
path: `${this.schemasBase()}/file`,
|
|
@@ -3650,7 +5337,7 @@ var SchemaService = class {
|
|
|
3650
5337
|
}
|
|
3651
5338
|
// --- (B) Types -----------------------------------------------------------
|
|
3652
5339
|
/** List entity types that currently have at least one schema. */
|
|
3653
|
-
async listTypes(auth2 =
|
|
5340
|
+
async listTypes(auth2 = SERVICE15) {
|
|
3654
5341
|
return this.ctx.http.request({
|
|
3655
5342
|
method: "GET",
|
|
3656
5343
|
path: `/schema/${this.ctx.tenant}/types`,
|
|
@@ -3658,7 +5345,7 @@ var SchemaService = class {
|
|
|
3658
5345
|
});
|
|
3659
5346
|
}
|
|
3660
5347
|
/** Set the entity types a schema applies to (`PUT /schemas/{id}/types`). */
|
|
3661
|
-
async setSchemaTypes(id, types, auth2 =
|
|
5348
|
+
async setSchemaTypes(id, types, auth2 = SERVICE15) {
|
|
3662
5349
|
return this.ctx.http.request({
|
|
3663
5350
|
method: "PUT",
|
|
3664
5351
|
path: `${this.schemasBase()}/${encodeURIComponent(id)}/types`,
|
|
@@ -3668,7 +5355,7 @@ var SchemaService = class {
|
|
|
3668
5355
|
}
|
|
3669
5356
|
// --- (C) Custom entities -------------------------------------------------
|
|
3670
5357
|
/** List custom-entity definitions. `expandSchemas` inlines each schema body. */
|
|
3671
|
-
async listCustomEntities(opts = {}, auth2 =
|
|
5358
|
+
async listCustomEntities(opts = {}, auth2 = SERVICE15) {
|
|
3672
5359
|
return this.ctx.http.request({
|
|
3673
5360
|
method: "GET",
|
|
3674
5361
|
path: this.entitiesBase(),
|
|
@@ -3677,7 +5364,7 @@ var SchemaService = class {
|
|
|
3677
5364
|
});
|
|
3678
5365
|
}
|
|
3679
5366
|
/** Retrieve one custom-entity definition by id. */
|
|
3680
|
-
async getCustomEntity(id, auth2 =
|
|
5367
|
+
async getCustomEntity(id, auth2 = SERVICE15) {
|
|
3681
5368
|
return this.ctx.http.request({
|
|
3682
5369
|
method: "GET",
|
|
3683
5370
|
path: `${this.entitiesBase()}/${encodeURIComponent(id)}`,
|
|
@@ -3685,7 +5372,7 @@ var SchemaService = class {
|
|
|
3685
5372
|
});
|
|
3686
5373
|
}
|
|
3687
5374
|
/** Create a custom-entity definition. */
|
|
3688
|
-
async createCustomEntity(draft, auth2 =
|
|
5375
|
+
async createCustomEntity(draft, auth2 = SERVICE15) {
|
|
3689
5376
|
return this.ctx.http.request({
|
|
3690
5377
|
method: "POST",
|
|
3691
5378
|
path: this.entitiesBase(),
|
|
@@ -3694,7 +5381,7 @@ var SchemaService = class {
|
|
|
3694
5381
|
});
|
|
3695
5382
|
}
|
|
3696
5383
|
/** Update a custom-entity definition. */
|
|
3697
|
-
async updateCustomEntity(id, draft, auth2 =
|
|
5384
|
+
async updateCustomEntity(id, draft, auth2 = SERVICE15) {
|
|
3698
5385
|
return this.ctx.http.request({
|
|
3699
5386
|
method: "PUT",
|
|
3700
5387
|
path: `${this.entitiesBase()}/${encodeURIComponent(id)}`,
|
|
@@ -3707,7 +5394,7 @@ var SchemaService = class {
|
|
|
3707
5394
|
* instances or schemas still reference it (propagated as the standard
|
|
3708
5395
|
* conflict error).
|
|
3709
5396
|
*/
|
|
3710
|
-
async deleteCustomEntity(id, auth2 =
|
|
5397
|
+
async deleteCustomEntity(id, auth2 = SERVICE15) {
|
|
3711
5398
|
await this.ctx.http.request({
|
|
3712
5399
|
method: "DELETE",
|
|
3713
5400
|
path: `${this.entitiesBase()}/${encodeURIComponent(id)}`,
|
|
@@ -3719,7 +5406,7 @@ var SchemaService = class {
|
|
|
3719
5406
|
* List a custom entity's instances, wrapped in {@link PaginatedItems}.
|
|
3720
5407
|
* `type` is the custom-entity type and is always the first argument.
|
|
3721
5408
|
*/
|
|
3722
|
-
async listInstances(type, query = {}, auth2 =
|
|
5409
|
+
async listInstances(type, query = {}, auth2 = SERVICE15) {
|
|
3723
5410
|
const pageNumber = query.pageNumber ?? 1;
|
|
3724
5411
|
const pageSize = query.pageSize ?? 60;
|
|
3725
5412
|
const items = await this.ctx.http.request({
|
|
@@ -3731,7 +5418,7 @@ var SchemaService = class {
|
|
|
3731
5418
|
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
3732
5419
|
}
|
|
3733
5420
|
/** Retrieve one instance by id. */
|
|
3734
|
-
async getInstance(type, id, auth2 =
|
|
5421
|
+
async getInstance(type, id, auth2 = SERVICE15) {
|
|
3735
5422
|
return this.ctx.http.request({
|
|
3736
5423
|
method: "GET",
|
|
3737
5424
|
path: `${this.instancesBase(type)}/${encodeURIComponent(id)}`,
|
|
@@ -3739,7 +5426,7 @@ var SchemaService = class {
|
|
|
3739
5426
|
});
|
|
3740
5427
|
}
|
|
3741
5428
|
/** Create an instance of a custom entity. */
|
|
3742
|
-
async createInstance(type, draft, auth2 =
|
|
5429
|
+
async createInstance(type, draft, auth2 = SERVICE15) {
|
|
3743
5430
|
return this.ctx.http.request({
|
|
3744
5431
|
method: "POST",
|
|
3745
5432
|
path: this.instancesBase(type),
|
|
@@ -3748,7 +5435,7 @@ var SchemaService = class {
|
|
|
3748
5435
|
});
|
|
3749
5436
|
}
|
|
3750
5437
|
/** Replace an instance (full `PUT`). */
|
|
3751
|
-
async replaceInstance(type, id, draft, auth2 =
|
|
5438
|
+
async replaceInstance(type, id, draft, auth2 = SERVICE15) {
|
|
3752
5439
|
return this.ctx.http.request({
|
|
3753
5440
|
method: "PUT",
|
|
3754
5441
|
path: `${this.instancesBase(type)}/${encodeURIComponent(id)}`,
|
|
@@ -3757,7 +5444,7 @@ var SchemaService = class {
|
|
|
3757
5444
|
});
|
|
3758
5445
|
}
|
|
3759
5446
|
/** Partially update an instance (`PATCH`). */
|
|
3760
|
-
async patchInstance(type, id, patch, auth2 =
|
|
5447
|
+
async patchInstance(type, id, patch, auth2 = SERVICE15) {
|
|
3761
5448
|
return this.ctx.http.request({
|
|
3762
5449
|
method: "PATCH",
|
|
3763
5450
|
path: `${this.instancesBase(type)}/${encodeURIComponent(id)}`,
|
|
@@ -3771,7 +5458,7 @@ var SchemaService = class {
|
|
|
3771
5458
|
* a per-item result array — a 207 is success, individual failures live in
|
|
3772
5459
|
* each item's `code`/`status`.
|
|
3773
5460
|
*/
|
|
3774
|
-
async bulkPatchInstances(type, items, auth2 =
|
|
5461
|
+
async bulkPatchInstances(type, items, auth2 = SERVICE15) {
|
|
3775
5462
|
return this.ctx.http.request({
|
|
3776
5463
|
method: "PATCH",
|
|
3777
5464
|
path: `${this.instancesBase(type)}/bulk`,
|
|
@@ -3779,8 +5466,80 @@ var SchemaService = class {
|
|
|
3779
5466
|
body: items
|
|
3780
5467
|
});
|
|
3781
5468
|
}
|
|
5469
|
+
/**
|
|
5470
|
+
* Create multiple instances in one request
|
|
5471
|
+
* (`POST /custom-entities/{type}/instances/bulk`). Returns a 207 envelope:
|
|
5472
|
+
* a per-item result array — a 207 is success, individual failures live in
|
|
5473
|
+
* each item's `code`/`status`.
|
|
5474
|
+
*/
|
|
5475
|
+
async bulkCreateInstances(type, items, auth2 = SERVICE15) {
|
|
5476
|
+
return this.ctx.http.request({
|
|
5477
|
+
method: "POST",
|
|
5478
|
+
path: `${this.instancesBase(type)}/bulk`,
|
|
5479
|
+
auth: auth2,
|
|
5480
|
+
body: items
|
|
5481
|
+
});
|
|
5482
|
+
}
|
|
5483
|
+
/**
|
|
5484
|
+
* Upsert multiple instances in one request
|
|
5485
|
+
* (`PUT /custom-entities/{type}/instances/bulk`). Each item carries its `id`.
|
|
5486
|
+
* Returns the same 207 per-item envelope as {@link bulkCreateInstances}.
|
|
5487
|
+
*/
|
|
5488
|
+
async bulkUpsertInstances(type, items, auth2 = SERVICE15) {
|
|
5489
|
+
return this.ctx.http.request({
|
|
5490
|
+
method: "PUT",
|
|
5491
|
+
path: `${this.instancesBase(type)}/bulk`,
|
|
5492
|
+
auth: auth2,
|
|
5493
|
+
body: items
|
|
5494
|
+
});
|
|
5495
|
+
}
|
|
5496
|
+
/**
|
|
5497
|
+
* Delete multiple instances by id
|
|
5498
|
+
* (`DELETE /custom-entities/{type}/instances/bulk`). Returns the same 207
|
|
5499
|
+
* per-item envelope as {@link bulkCreateInstances}.
|
|
5500
|
+
*
|
|
5501
|
+
* **Note:** the OpenAPI schema declares no request body for this operation,
|
|
5502
|
+
* but its description mandates one — "The IDs of items should be defined in
|
|
5503
|
+
* the request body as an array of strings" (example
|
|
5504
|
+
* `["firstId", "secondId"]`). The SDK follows the description and sends the
|
|
5505
|
+
* id array. Unverified against the live API.
|
|
5506
|
+
*/
|
|
5507
|
+
async bulkDeleteInstances(type, ids, auth2 = SERVICE15) {
|
|
5508
|
+
return this.ctx.http.request({
|
|
5509
|
+
method: "DELETE",
|
|
5510
|
+
path: `${this.instancesBase(type)}/bulk`,
|
|
5511
|
+
auth: auth2,
|
|
5512
|
+
body: ids
|
|
5513
|
+
});
|
|
5514
|
+
}
|
|
5515
|
+
/**
|
|
5516
|
+
* Export custom entities and their schemas
|
|
5517
|
+
* (`POST /custom-entities/export`). Pass the entity types to include; the
|
|
5518
|
+
* result carries a base64 `data` payload plus `exportedAt`.
|
|
5519
|
+
*/
|
|
5520
|
+
async exportCustomEntities(types, auth2 = SERVICE15) {
|
|
5521
|
+
return this.ctx.http.request({
|
|
5522
|
+
method: "POST",
|
|
5523
|
+
path: `${this.entitiesBase()}/export`,
|
|
5524
|
+
auth: auth2,
|
|
5525
|
+
body: types
|
|
5526
|
+
});
|
|
5527
|
+
}
|
|
5528
|
+
/**
|
|
5529
|
+
* Import custom entities and their schemas
|
|
5530
|
+
* (`POST /custom-entities/import`) from the base64 `data` produced by
|
|
5531
|
+
* {@link exportCustomEntities}.
|
|
5532
|
+
*/
|
|
5533
|
+
async importCustomEntities(input, auth2 = SERVICE15) {
|
|
5534
|
+
await this.ctx.http.request({
|
|
5535
|
+
method: "POST",
|
|
5536
|
+
path: `${this.entitiesBase()}/import`,
|
|
5537
|
+
auth: auth2,
|
|
5538
|
+
body: input
|
|
5539
|
+
});
|
|
5540
|
+
}
|
|
3782
5541
|
/** Delete an instance by id. */
|
|
3783
|
-
async deleteInstance(type, id, auth2 =
|
|
5542
|
+
async deleteInstance(type, id, auth2 = SERVICE15) {
|
|
3784
5543
|
await this.ctx.http.request({
|
|
3785
5544
|
method: "DELETE",
|
|
3786
5545
|
path: `${this.instancesBase(type)}/${encodeURIComponent(id)}`,
|
|
@@ -3791,7 +5550,7 @@ var SchemaService = class {
|
|
|
3791
5550
|
* Structured search over a custom entity's instances
|
|
3792
5551
|
* (`POST /instances/search`), wrapped in {@link PaginatedItems}.
|
|
3793
5552
|
*/
|
|
3794
|
-
async searchInstances(type, body, auth2 =
|
|
5553
|
+
async searchInstances(type, body, auth2 = SERVICE15) {
|
|
3795
5554
|
const items = await this.ctx.http.request({
|
|
3796
5555
|
method: "POST",
|
|
3797
5556
|
path: `${this.instancesBase(type)}/search`,
|
|
@@ -3800,10 +5559,84 @@ var SchemaService = class {
|
|
|
3800
5559
|
});
|
|
3801
5560
|
return { items, pageNumber: 1, pageSize: items.length, hasNextPage: false };
|
|
3802
5561
|
}
|
|
5562
|
+
// --- (E) References ------------------------------------------------------
|
|
5563
|
+
/**
|
|
5564
|
+
* Reference entities (`/references`) — a schema plus an uploaded JSON file.
|
|
5565
|
+
* Create/update are `multipart/form-data` (parts `file` and `body`), like
|
|
5566
|
+
* the media service's blob upload. Default auth: service.
|
|
5567
|
+
*/
|
|
5568
|
+
references = {
|
|
5569
|
+
/**
|
|
5570
|
+
* List references, wrapped in {@link PaginatedItems}. Pagination defaults
|
|
5571
|
+
* match the rest of this service (`pageNumber: 1`, `pageSize: 60`).
|
|
5572
|
+
*/
|
|
5573
|
+
list: async (query = {}, auth2 = SERVICE15) => {
|
|
5574
|
+
const pageNumber = query.pageNumber ?? 1;
|
|
5575
|
+
const pageSize = query.pageSize ?? 60;
|
|
5576
|
+
const q = { pageNumber, pageSize };
|
|
5577
|
+
if (query.sort) q.sort = query.sort;
|
|
5578
|
+
if (query.q) q.q = query.q;
|
|
5579
|
+
if (query.fields) q.fields = query.fields;
|
|
5580
|
+
if (query.type) q.type = query.type;
|
|
5581
|
+
const items = await this.ctx.http.request({
|
|
5582
|
+
method: "GET",
|
|
5583
|
+
path: this.referencesBase(),
|
|
5584
|
+
auth: auth2,
|
|
5585
|
+
query: q
|
|
5586
|
+
});
|
|
5587
|
+
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
5588
|
+
},
|
|
5589
|
+
/** Retrieve one reference by id. */
|
|
5590
|
+
get: async (id, auth2 = SERVICE15) => this.ctx.http.request({
|
|
5591
|
+
method: "GET",
|
|
5592
|
+
path: `${this.referencesBase()}/${encodeURIComponent(id)}`,
|
|
5593
|
+
auth: auth2
|
|
5594
|
+
}),
|
|
5595
|
+
/**
|
|
5596
|
+
* Create a reference. `file` is the reference's JSON content — pass a
|
|
5597
|
+
* `Blob` to upload as-is, or a plain object to have it serialized into a
|
|
5598
|
+
* JSON blob. `body` carries the metadata.
|
|
5599
|
+
*/
|
|
5600
|
+
create: async (input, auth2 = SERVICE15) => {
|
|
5601
|
+
const fd = new FormData();
|
|
5602
|
+
fd.set("file", toJsonBlob(input.file));
|
|
5603
|
+
fd.set("body", JSON.stringify(input.body));
|
|
5604
|
+
return this.ctx.http.request({
|
|
5605
|
+
method: "POST",
|
|
5606
|
+
path: this.referencesBase(),
|
|
5607
|
+
auth: auth2,
|
|
5608
|
+
body: fd
|
|
5609
|
+
});
|
|
5610
|
+
},
|
|
5611
|
+
/**
|
|
5612
|
+
* Update a reference (multipart, like {@link create}). `options.version`
|
|
5613
|
+
* enables optimistic locking — the server answers 409 on a stale version.
|
|
5614
|
+
*/
|
|
5615
|
+
update: async (id, input, options = {}, auth2 = SERVICE15) => {
|
|
5616
|
+
const fd = new FormData();
|
|
5617
|
+
fd.set("file", toJsonBlob(input.file));
|
|
5618
|
+
fd.set("body", JSON.stringify(input.body));
|
|
5619
|
+
await this.ctx.http.request({
|
|
5620
|
+
method: "PUT",
|
|
5621
|
+
path: `${this.referencesBase()}/${encodeURIComponent(id)}`,
|
|
5622
|
+
...options.version === void 0 ? {} : { query: { version: options.version } },
|
|
5623
|
+
auth: auth2,
|
|
5624
|
+
body: fd
|
|
5625
|
+
});
|
|
5626
|
+
},
|
|
5627
|
+
/** Delete a reference by id. */
|
|
5628
|
+
delete: async (id, auth2 = SERVICE15) => {
|
|
5629
|
+
await this.ctx.http.request({
|
|
5630
|
+
method: "DELETE",
|
|
5631
|
+
path: `${this.referencesBase()}/${encodeURIComponent(id)}`,
|
|
5632
|
+
auth: auth2
|
|
5633
|
+
});
|
|
5634
|
+
}
|
|
5635
|
+
};
|
|
3803
5636
|
};
|
|
3804
5637
|
|
|
3805
5638
|
// src/services/ai-resources.ts
|
|
3806
|
-
var
|
|
5639
|
+
var SERVICE16 = { kind: "service" };
|
|
3807
5640
|
var AgenticCrudResource = class {
|
|
3808
5641
|
constructor(ctx, path) {
|
|
3809
5642
|
this.ctx = ctx;
|
|
@@ -3815,15 +5648,15 @@ var AgenticCrudResource = class {
|
|
|
3815
5648
|
return `${this.path}/${encodeURIComponent(id)}`;
|
|
3816
5649
|
}
|
|
3817
5650
|
/** List the collection (`GET {path}`). Optional `q`/paging/sort/fields/expand. */
|
|
3818
|
-
list(query = {}, auth2 =
|
|
5651
|
+
list(query = {}, auth2 = SERVICE16) {
|
|
3819
5652
|
return this.ctx.http.request({ method: "GET", path: this.path, auth: auth2, query: { ...query } });
|
|
3820
5653
|
}
|
|
3821
5654
|
/** Structured search (`POST {path}/search`). Body is `{ q? }`. */
|
|
3822
|
-
search(query, auth2 =
|
|
5655
|
+
search(query, auth2 = SERVICE16) {
|
|
3823
5656
|
return this.ctx.http.request({ method: "POST", path: `${this.path}/search`, auth: auth2, body: query });
|
|
3824
5657
|
}
|
|
3825
5658
|
/** Retrieve one entry by id (`GET {path}/{id}`). */
|
|
3826
|
-
get(id, opts = {}, auth2 =
|
|
5659
|
+
get(id, opts = {}, auth2 = SERVICE16) {
|
|
3827
5660
|
return this.ctx.http.request({ method: "GET", path: this.item(id), auth: auth2, query: { ...opts } });
|
|
3828
5661
|
}
|
|
3829
5662
|
/**
|
|
@@ -3831,7 +5664,7 @@ var AgenticCrudResource = class {
|
|
|
3831
5664
|
* (HTTP 201) and `undefined` on update (HTTP 204). `{ force: true }`
|
|
3832
5665
|
* cascade-disables dependents.
|
|
3833
5666
|
*/
|
|
3834
|
-
upsert(id, body, opts = {}, auth2 =
|
|
5667
|
+
upsert(id, body, opts = {}, auth2 = SERVICE16) {
|
|
3835
5668
|
return this.ctx.http.request({
|
|
3836
5669
|
method: "PUT",
|
|
3837
5670
|
path: this.item(id),
|
|
@@ -3844,11 +5677,11 @@ var AgenticCrudResource = class {
|
|
|
3844
5677
|
* Partial update with an op array (`PATCH {path}/{id}`, 204). `ops` use the
|
|
3845
5678
|
* upstream UPPERCASE enum (`ADD | REMOVE | REPLACE`), sent verbatim.
|
|
3846
5679
|
*/
|
|
3847
|
-
async patch(id, ops, auth2 =
|
|
5680
|
+
async patch(id, ops, auth2 = SERVICE16) {
|
|
3848
5681
|
await this.ctx.http.request({ method: "PATCH", path: this.item(id), auth: auth2, body: ops });
|
|
3849
5682
|
}
|
|
3850
5683
|
/** Delete by id (`DELETE {path}/{id}`). `{ force: true }` removes even if referenced. */
|
|
3851
|
-
async delete(id, opts = {}, auth2 =
|
|
5684
|
+
async delete(id, opts = {}, auth2 = SERVICE16) {
|
|
3852
5685
|
await this.ctx.http.request({
|
|
3853
5686
|
method: "DELETE",
|
|
3854
5687
|
path: this.item(id),
|
|
@@ -3865,19 +5698,19 @@ var JobsResource = class {
|
|
|
3865
5698
|
ctx;
|
|
3866
5699
|
base;
|
|
3867
5700
|
/** List jobs (`GET /jobs`). */
|
|
3868
|
-
list(query = {}, auth2 =
|
|
5701
|
+
list(query = {}, auth2 = SERVICE16) {
|
|
3869
5702
|
return this.ctx.http.request({ method: "GET", path: `${this.base}/jobs`, auth: auth2, query: { ...query } });
|
|
3870
5703
|
}
|
|
3871
5704
|
/** Structured job search (`POST /jobs/search`). */
|
|
3872
|
-
search(query, auth2 =
|
|
5705
|
+
search(query, auth2 = SERVICE16) {
|
|
3873
5706
|
return this.ctx.http.request({ method: "POST", path: `${this.base}/jobs/search`, auth: auth2, body: query });
|
|
3874
5707
|
}
|
|
3875
5708
|
/** Retrieve one job (`GET /jobs/{jobId}`). */
|
|
3876
|
-
get(jobId, auth2 =
|
|
5709
|
+
get(jobId, auth2 = SERVICE16) {
|
|
3877
5710
|
return this.ctx.http.request({ method: "GET", path: `${this.base}/jobs/${encodeURIComponent(jobId)}`, auth: auth2 });
|
|
3878
5711
|
}
|
|
3879
5712
|
/** Delete one job (`DELETE /jobs/{jobId}`). */
|
|
3880
|
-
async delete(jobId, auth2 =
|
|
5713
|
+
async delete(jobId, auth2 = SERVICE16) {
|
|
3881
5714
|
await this.ctx.http.request({ method: "DELETE", path: `${this.base}/jobs/${encodeURIComponent(jobId)}`, auth: auth2 });
|
|
3882
5715
|
}
|
|
3883
5716
|
};
|
|
@@ -3889,11 +5722,11 @@ var TemplatesResource = class {
|
|
|
3889
5722
|
ctx;
|
|
3890
5723
|
path;
|
|
3891
5724
|
/** List available templates (`GET /agentic/templates`). */
|
|
3892
|
-
list(query = {}, auth2 =
|
|
5725
|
+
list(query = {}, auth2 = SERVICE16) {
|
|
3893
5726
|
return this.ctx.http.request({ method: "GET", path: this.path, auth: auth2, query: { ...query } });
|
|
3894
5727
|
}
|
|
3895
5728
|
/** Structured template search (`POST /agentic/templates/search`). */
|
|
3896
|
-
search(query, auth2 =
|
|
5729
|
+
search(query, auth2 = SERVICE16) {
|
|
3897
5730
|
return this.ctx.http.request({ method: "POST", path: `${this.path}/search`, auth: auth2, body: query });
|
|
3898
5731
|
}
|
|
3899
5732
|
/**
|
|
@@ -3901,7 +5734,7 @@ var TemplatesResource = class {
|
|
|
3901
5734
|
* (`POST /agentic/templates/{templateId}/agents`, HTTP 201). Returns the
|
|
3902
5735
|
* created agent's id.
|
|
3903
5736
|
*/
|
|
3904
|
-
clone(templateId, body, auth2 =
|
|
5737
|
+
clone(templateId, body, auth2 = SERVICE16) {
|
|
3905
5738
|
return this.ctx.http.request({
|
|
3906
5739
|
method: "POST",
|
|
3907
5740
|
path: `${this.path}/${encodeURIComponent(templateId)}/agents`,
|
|
@@ -3918,27 +5751,27 @@ var LogsResource = class {
|
|
|
3918
5751
|
ctx;
|
|
3919
5752
|
path;
|
|
3920
5753
|
/** List request logs (`GET /agentic/logs/requests`). */
|
|
3921
|
-
listRequests(query = {}, auth2 =
|
|
5754
|
+
listRequests(query = {}, auth2 = SERVICE16) {
|
|
3922
5755
|
return this.ctx.http.request({ method: "GET", path: `${this.path}/requests`, auth: auth2, query: { ...query } });
|
|
3923
5756
|
}
|
|
3924
5757
|
/** Retrieve one request log (`GET /agentic/logs/requests/{requestId}`). */
|
|
3925
|
-
getRequest(requestId, auth2 =
|
|
5758
|
+
getRequest(requestId, auth2 = SERVICE16) {
|
|
3926
5759
|
return this.ctx.http.request({ method: "GET", path: `${this.path}/requests/${encodeURIComponent(requestId)}`, auth: auth2 });
|
|
3927
5760
|
}
|
|
3928
5761
|
/** Structured request-log search (`POST /agentic/logs/requests/search`). */
|
|
3929
|
-
searchRequests(query, auth2 =
|
|
5762
|
+
searchRequests(query, auth2 = SERVICE16) {
|
|
3930
5763
|
return this.ctx.http.request({ method: "POST", path: `${this.path}/requests/search`, auth: auth2, body: query });
|
|
3931
5764
|
}
|
|
3932
5765
|
/** List session logs (`GET /agentic/logs/sessions`). */
|
|
3933
|
-
listSessions(query = {}, auth2 =
|
|
5766
|
+
listSessions(query = {}, auth2 = SERVICE16) {
|
|
3934
5767
|
return this.ctx.http.request({ method: "GET", path: `${this.path}/sessions`, auth: auth2, query: { ...query } });
|
|
3935
5768
|
}
|
|
3936
5769
|
/** Retrieve one session log (`GET /agentic/logs/sessions/{sessionId}`). */
|
|
3937
|
-
getSession(sessionId, auth2 =
|
|
5770
|
+
getSession(sessionId, auth2 = SERVICE16) {
|
|
3938
5771
|
return this.ctx.http.request({ method: "GET", path: `${this.path}/sessions/${encodeURIComponent(sessionId)}`, auth: auth2 });
|
|
3939
5772
|
}
|
|
3940
5773
|
/** Structured session-log search (`POST /agentic/logs/sessions/search`). */
|
|
3941
|
-
searchSessions(query, auth2 =
|
|
5774
|
+
searchSessions(query, auth2 = SERVICE16) {
|
|
3942
5775
|
return this.ctx.http.request({ method: "POST", path: `${this.path}/sessions/search`, auth: auth2, body: query });
|
|
3943
5776
|
}
|
|
3944
5777
|
};
|
|
@@ -3950,17 +5783,17 @@ var AnalyticsResource = class {
|
|
|
3950
5783
|
ctx;
|
|
3951
5784
|
path;
|
|
3952
5785
|
/** Aggregated metrics (`GET /agentic/analytics`); scope with `agentId`. */
|
|
3953
|
-
get(opts = {}, auth2 =
|
|
5786
|
+
get(opts = {}, auth2 = SERVICE16) {
|
|
3954
5787
|
return this.ctx.http.request({ method: "GET", path: this.path, auth: auth2, query: { ...opts } });
|
|
3955
5788
|
}
|
|
3956
5789
|
/** Per-agent execution counts (`GET /agentic/analytics/executions`). `agentIds` required. */
|
|
3957
|
-
executions(query, auth2 =
|
|
5790
|
+
executions(query, auth2 = SERVICE16) {
|
|
3958
5791
|
return this.ctx.http.request({ method: "GET", path: `${this.path}/executions`, auth: auth2, query: { ...query } });
|
|
3959
5792
|
}
|
|
3960
5793
|
};
|
|
3961
5794
|
|
|
3962
5795
|
// src/services/ai.ts
|
|
3963
|
-
var
|
|
5796
|
+
var SERVICE17 = { kind: "service" };
|
|
3964
5797
|
var AiService = class {
|
|
3965
5798
|
constructor(ctx) {
|
|
3966
5799
|
this.ctx = ctx;
|
|
@@ -4012,7 +5845,7 @@ var AiService = class {
|
|
|
4012
5845
|
return this._analytics ??= new AnalyticsResource(this.ctx, `${this.base()}/agentic/analytics`);
|
|
4013
5846
|
}
|
|
4014
5847
|
/** Generate text from a single prompt (`POST /texts`). Honors `maxTokens`. */
|
|
4015
|
-
async generateText(input, auth2 =
|
|
5848
|
+
async generateText(input, auth2 = SERVICE17) {
|
|
4016
5849
|
return this.ctx.http.request({
|
|
4017
5850
|
method: "POST",
|
|
4018
5851
|
path: `${this.base()}/texts`,
|
|
@@ -4021,7 +5854,7 @@ var AiService = class {
|
|
|
4021
5854
|
});
|
|
4022
5855
|
}
|
|
4023
5856
|
/** Run a chat completion over a message list (`POST /completions`). No `maxTokens`. */
|
|
4024
|
-
async complete(input, auth2 =
|
|
5857
|
+
async complete(input, auth2 = SERVICE17) {
|
|
4025
5858
|
return this.ctx.http.request({
|
|
4026
5859
|
method: "POST",
|
|
4027
5860
|
path: `${this.base()}/completions`,
|
|
@@ -4030,7 +5863,7 @@ var AiService = class {
|
|
|
4030
5863
|
});
|
|
4031
5864
|
}
|
|
4032
5865
|
/** List all agentic agents. */
|
|
4033
|
-
async listAgents(auth2 =
|
|
5866
|
+
async listAgents(auth2 = SERVICE17) {
|
|
4034
5867
|
return this.ctx.http.request({
|
|
4035
5868
|
method: "GET",
|
|
4036
5869
|
path: `${this.base()}/agentic/agents`,
|
|
@@ -4038,7 +5871,7 @@ var AiService = class {
|
|
|
4038
5871
|
});
|
|
4039
5872
|
}
|
|
4040
5873
|
/** Retrieve one agent by id. */
|
|
4041
|
-
async getAgent(id, auth2 =
|
|
5874
|
+
async getAgent(id, auth2 = SERVICE17) {
|
|
4042
5875
|
return this.ctx.http.request({
|
|
4043
5876
|
method: "GET",
|
|
4044
5877
|
path: `${this.base()}/agentic/agents/${encodeURIComponent(id)}`,
|
|
@@ -4046,7 +5879,7 @@ var AiService = class {
|
|
|
4046
5879
|
});
|
|
4047
5880
|
}
|
|
4048
5881
|
/** Create-or-replace an agent by id (`PUT`). Takes the agent write shape. */
|
|
4049
|
-
async upsertAgent(id, agent, auth2 =
|
|
5882
|
+
async upsertAgent(id, agent, auth2 = SERVICE17) {
|
|
4050
5883
|
return this.ctx.http.request({
|
|
4051
5884
|
method: "PUT",
|
|
4052
5885
|
path: `${this.base()}/agentic/agents/${encodeURIComponent(id)}`,
|
|
@@ -4059,7 +5892,7 @@ var AiService = class {
|
|
|
4059
5892
|
* UPPERCASE enum (`ADD | REMOVE | REPLACE`) and are sent verbatim — this is
|
|
4060
5893
|
* NOT RFC-6902 JSON-Patch.
|
|
4061
5894
|
*/
|
|
4062
|
-
async patchAgent(id, ops, auth2 =
|
|
5895
|
+
async patchAgent(id, ops, auth2 = SERVICE17) {
|
|
4063
5896
|
return this.ctx.http.request({
|
|
4064
5897
|
method: "PATCH",
|
|
4065
5898
|
path: `${this.base()}/agentic/agents/${encodeURIComponent(id)}`,
|
|
@@ -4071,7 +5904,7 @@ var AiService = class {
|
|
|
4071
5904
|
* Delete an agent by id. Pass `{ force: true }` to delete an agent that is
|
|
4072
5905
|
* still referenced elsewhere (`?force=true`).
|
|
4073
5906
|
*/
|
|
4074
|
-
async deleteAgent(id, auth2 =
|
|
5907
|
+
async deleteAgent(id, auth2 = SERVICE17, opts = {}) {
|
|
4075
5908
|
await this.ctx.http.request({
|
|
4076
5909
|
method: "DELETE",
|
|
4077
5910
|
path: `${this.base()}/agentic/agents/${encodeURIComponent(id)}`,
|
|
@@ -4080,7 +5913,7 @@ var AiService = class {
|
|
|
4080
5913
|
});
|
|
4081
5914
|
}
|
|
4082
5915
|
/** Server-side agent search (`POST /agentic/agents/search`). */
|
|
4083
|
-
async searchAgents(query, auth2 =
|
|
5916
|
+
async searchAgents(query, auth2 = SERVICE17) {
|
|
4084
5917
|
return this.ctx.http.request({
|
|
4085
5918
|
method: "POST",
|
|
4086
5919
|
path: `${this.base()}/agentic/agents/search`,
|
|
@@ -4092,7 +5925,7 @@ var AiService = class {
|
|
|
4092
5925
|
* Synchronous agent chat (`POST /agentic/chat`). Returns the response
|
|
4093
5926
|
* ARRAY verbatim (the upstream contract is an array, not a single object).
|
|
4094
5927
|
*/
|
|
4095
|
-
async chat(input, auth2 =
|
|
5928
|
+
async chat(input, auth2 = SERVICE17) {
|
|
4096
5929
|
return this.ctx.http.request({
|
|
4097
5930
|
method: "POST",
|
|
4098
5931
|
path: `${this.base()}/agentic/chat`,
|
|
@@ -4104,7 +5937,7 @@ var AiService = class {
|
|
|
4104
5937
|
* Fire-and-forget agent chat (`POST /agentic/chat-async`, HTTP 201).
|
|
4105
5938
|
* Returns the job-id ARRAY verbatim.
|
|
4106
5939
|
*/
|
|
4107
|
-
async chatAsync(input, auth2 =
|
|
5940
|
+
async chatAsync(input, auth2 = SERVICE17) {
|
|
4108
5941
|
return this.ctx.http.request({
|
|
4109
5942
|
method: "POST",
|
|
4110
5943
|
path: `${this.base()}/agentic/chat-async`,
|
|
@@ -4118,7 +5951,7 @@ var AiService = class {
|
|
|
4118
5951
|
* stream body as an opaque string, so chunks are raw strings, not parsed
|
|
4119
5952
|
* objects. Consume with `for await`.
|
|
4120
5953
|
*/
|
|
4121
|
-
async *chatStream(input, opts = {}, auth2 =
|
|
5954
|
+
async *chatStream(input, opts = {}, auth2 = SERVICE17) {
|
|
4122
5955
|
const events = this.ctx.http.requestStream({
|
|
4123
5956
|
method: "POST",
|
|
4124
5957
|
path: `${this.base()}/agentic/chat-stream`,
|
|
@@ -4129,7 +5962,7 @@ var AiService = class {
|
|
|
4129
5962
|
for await (const ev of events) yield ev.data;
|
|
4130
5963
|
}
|
|
4131
5964
|
/** List stored agentic conversations (`GET /agentic/conversations`). */
|
|
4132
|
-
async listConversations(auth2 =
|
|
5965
|
+
async listConversations(auth2 = SERVICE17) {
|
|
4133
5966
|
return this.ctx.http.request({
|
|
4134
5967
|
method: "GET",
|
|
4135
5968
|
path: `${this.base()}/agentic/conversations`,
|
|
@@ -4137,7 +5970,7 @@ var AiService = class {
|
|
|
4137
5970
|
});
|
|
4138
5971
|
}
|
|
4139
5972
|
/** Server-side conversation search (`POST /agentic/conversations/search`). */
|
|
4140
|
-
async searchConversations(query, auth2 =
|
|
5973
|
+
async searchConversations(query, auth2 = SERVICE17) {
|
|
4141
5974
|
return this.ctx.http.request({
|
|
4142
5975
|
method: "POST",
|
|
4143
5976
|
path: `${this.base()}/agentic/conversations/search`,
|
|
@@ -4147,7 +5980,7 @@ var AiService = class {
|
|
|
4147
5980
|
}
|
|
4148
5981
|
// --- Standalone agentic reads / bulk operations ------------------------
|
|
4149
5982
|
/** List models available to the tenant, grouped by provider (`GET /agentic/models`). */
|
|
4150
|
-
async listModels(auth2 =
|
|
5983
|
+
async listModels(auth2 = SERVICE17) {
|
|
4151
5984
|
return this.ctx.http.request({
|
|
4152
5985
|
method: "GET",
|
|
4153
5986
|
path: `${this.base()}/agentic/models`,
|
|
@@ -4155,7 +5988,7 @@ var AiService = class {
|
|
|
4155
5988
|
});
|
|
4156
5989
|
}
|
|
4157
5990
|
/** List commerce events available to agent triggers (`GET /agentic/commerce-events`). */
|
|
4158
|
-
async listCommerceEvents(auth2 =
|
|
5991
|
+
async listCommerceEvents(auth2 = SERVICE17) {
|
|
4159
5992
|
return this.ctx.http.request({
|
|
4160
5993
|
method: "GET",
|
|
4161
5994
|
path: `${this.base()}/agentic/commerce-events`,
|
|
@@ -4168,7 +6001,7 @@ var AiService = class {
|
|
|
4168
6001
|
* `sessionId` must be threaded into subsequent chat calls to bind the file.
|
|
4169
6002
|
* Pass `opts.sessionId` to attach to an existing session.
|
|
4170
6003
|
*/
|
|
4171
|
-
async uploadAttachment(agentId, attachment, opts = {}, auth2 =
|
|
6004
|
+
async uploadAttachment(agentId, attachment, opts = {}, auth2 = SERVICE17) {
|
|
4172
6005
|
const form = new FormData();
|
|
4173
6006
|
form.append("attachment", attachment);
|
|
4174
6007
|
return this.ctx.http.request({
|
|
@@ -4180,7 +6013,7 @@ var AiService = class {
|
|
|
4180
6013
|
});
|
|
4181
6014
|
}
|
|
4182
6015
|
/** Export agents + components as a base64/checksum blob (`POST /agentic/agents/export`). */
|
|
4183
|
-
async exportAgents(body, auth2 =
|
|
6016
|
+
async exportAgents(body, auth2 = SERVICE17) {
|
|
4184
6017
|
return this.ctx.http.request({
|
|
4185
6018
|
method: "POST",
|
|
4186
6019
|
path: `${this.base()}/agentic/agents/export`,
|
|
@@ -4189,7 +6022,7 @@ var AiService = class {
|
|
|
4189
6022
|
});
|
|
4190
6023
|
}
|
|
4191
6024
|
/** Import previously-exported agents (`POST /agentic/agents/import`). */
|
|
4192
|
-
async importAgents(body, auth2 =
|
|
6025
|
+
async importAgents(body, auth2 = SERVICE17) {
|
|
4193
6026
|
return this.ctx.http.request({
|
|
4194
6027
|
method: "POST",
|
|
4195
6028
|
path: `${this.base()}/agentic/agents/import`,
|
|
@@ -4200,7 +6033,7 @@ var AiService = class {
|
|
|
4200
6033
|
};
|
|
4201
6034
|
|
|
4202
6035
|
// src/services/tax.ts
|
|
4203
|
-
var
|
|
6036
|
+
var SERVICE18 = { kind: "service" };
|
|
4204
6037
|
var TaxService = class {
|
|
4205
6038
|
constructor(ctx) {
|
|
4206
6039
|
this.ctx = ctx;
|
|
@@ -4211,7 +6044,7 @@ var TaxService = class {
|
|
|
4211
6044
|
return `/tax/${this.ctx.tenant}`;
|
|
4212
6045
|
}
|
|
4213
6046
|
/** List all per-location tax configurations. */
|
|
4214
|
-
async listTaxConfigs(auth2 =
|
|
6047
|
+
async listTaxConfigs(auth2 = SERVICE18) {
|
|
4215
6048
|
return this.ctx.http.request({
|
|
4216
6049
|
method: "GET",
|
|
4217
6050
|
path: `${this.base()}/taxes`,
|
|
@@ -4219,7 +6052,7 @@ var TaxService = class {
|
|
|
4219
6052
|
});
|
|
4220
6053
|
}
|
|
4221
6054
|
/** Retrieve one tax configuration by its location (country) code. */
|
|
4222
|
-
async getTaxConfig(locationCode, auth2 =
|
|
6055
|
+
async getTaxConfig(locationCode, auth2 = SERVICE18) {
|
|
4223
6056
|
return this.ctx.http.request({
|
|
4224
6057
|
method: "GET",
|
|
4225
6058
|
path: `${this.base()}/taxes/${encodeURIComponent(locationCode)}`,
|
|
@@ -4227,7 +6060,7 @@ var TaxService = class {
|
|
|
4227
6060
|
});
|
|
4228
6061
|
}
|
|
4229
6062
|
/** Create a tax configuration (`POST`). Returns the created `{ locationCode }`. */
|
|
4230
|
-
async createTaxConfig(input, auth2 =
|
|
6063
|
+
async createTaxConfig(input, auth2 = SERVICE18) {
|
|
4231
6064
|
return this.ctx.http.request({
|
|
4232
6065
|
method: "POST",
|
|
4233
6066
|
path: `${this.base()}/taxes`,
|
|
@@ -4239,7 +6072,7 @@ var TaxService = class {
|
|
|
4239
6072
|
* Update a tax configuration by location code (`PUT`). `metadata.version` is
|
|
4240
6073
|
* required (optimistic locking — a stale version yields 409).
|
|
4241
6074
|
*/
|
|
4242
|
-
async updateTaxConfig(locationCode, input, auth2 =
|
|
6075
|
+
async updateTaxConfig(locationCode, input, auth2 = SERVICE18) {
|
|
4243
6076
|
return this.ctx.http.request({
|
|
4244
6077
|
method: "PUT",
|
|
4245
6078
|
path: `${this.base()}/taxes/${encodeURIComponent(locationCode)}`,
|
|
@@ -4248,7 +6081,7 @@ var TaxService = class {
|
|
|
4248
6081
|
});
|
|
4249
6082
|
}
|
|
4250
6083
|
/** Delete a tax configuration by location code. */
|
|
4251
|
-
async deleteTaxConfig(locationCode, auth2 =
|
|
6084
|
+
async deleteTaxConfig(locationCode, auth2 = SERVICE18) {
|
|
4252
6085
|
await this.ctx.http.request({
|
|
4253
6086
|
method: "DELETE",
|
|
4254
6087
|
path: `${this.base()}/taxes/${encodeURIComponent(locationCode)}`,
|
|
@@ -4259,7 +6092,7 @@ var TaxService = class {
|
|
|
4259
6092
|
* Calculate net/gross values for a price (`PUT /taxes/calculation-commands`).
|
|
4260
6093
|
* Single command in, single result out.
|
|
4261
6094
|
*/
|
|
4262
|
-
async calculateTax(request, auth2 =
|
|
6095
|
+
async calculateTax(request, auth2 = SERVICE18) {
|
|
4263
6096
|
return this.ctx.http.request({
|
|
4264
6097
|
method: "PUT",
|
|
4265
6098
|
path: `${this.base()}/taxes/calculation-commands`,
|
|
@@ -4270,7 +6103,7 @@ var TaxService = class {
|
|
|
4270
6103
|
};
|
|
4271
6104
|
|
|
4272
6105
|
// src/services/coupon.ts
|
|
4273
|
-
var
|
|
6106
|
+
var SERVICE19 = { kind: "service" };
|
|
4274
6107
|
var CouponService = class {
|
|
4275
6108
|
constructor(ctx) {
|
|
4276
6109
|
this.ctx = ctx;
|
|
@@ -4281,7 +6114,7 @@ var CouponService = class {
|
|
|
4281
6114
|
return `/coupon/${this.ctx.tenant}`;
|
|
4282
6115
|
}
|
|
4283
6116
|
/** List coupons by criteria. Returns a plain array. */
|
|
4284
|
-
async listCoupons(query = {}, auth2 =
|
|
6117
|
+
async listCoupons(query = {}, auth2 = SERVICE19) {
|
|
4285
6118
|
return this.ctx.http.request({
|
|
4286
6119
|
method: "GET",
|
|
4287
6120
|
path: `${this.base()}/coupons`,
|
|
@@ -4290,7 +6123,7 @@ var CouponService = class {
|
|
|
4290
6123
|
});
|
|
4291
6124
|
}
|
|
4292
6125
|
/** Retrieve one coupon by code. */
|
|
4293
|
-
async getCoupon(code, auth2 =
|
|
6126
|
+
async getCoupon(code, auth2 = SERVICE19) {
|
|
4294
6127
|
return this.ctx.http.request({
|
|
4295
6128
|
method: "GET",
|
|
4296
6129
|
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
@@ -4298,7 +6131,7 @@ var CouponService = class {
|
|
|
4298
6131
|
});
|
|
4299
6132
|
}
|
|
4300
6133
|
/** Create a coupon (`POST`, HTTP 201). Returns the created resource's `{ id?, yrn? }`. */
|
|
4301
|
-
async createCoupon(input, auth2 =
|
|
6134
|
+
async createCoupon(input, auth2 = SERVICE19) {
|
|
4302
6135
|
return this.ctx.http.request({
|
|
4303
6136
|
method: "POST",
|
|
4304
6137
|
path: `${this.base()}/coupons`,
|
|
@@ -4307,7 +6140,7 @@ var CouponService = class {
|
|
|
4307
6140
|
});
|
|
4308
6141
|
}
|
|
4309
6142
|
/** Replace a coupon by code (`PUT`). Resolves once the update is accepted. */
|
|
4310
|
-
async updateCoupon(code, input, auth2 =
|
|
6143
|
+
async updateCoupon(code, input, auth2 = SERVICE19) {
|
|
4311
6144
|
await this.ctx.http.request({
|
|
4312
6145
|
method: "PUT",
|
|
4313
6146
|
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
@@ -4316,7 +6149,7 @@ var CouponService = class {
|
|
|
4316
6149
|
});
|
|
4317
6150
|
}
|
|
4318
6151
|
/** Partially update a coupon by code (`PATCH` merge body). */
|
|
4319
|
-
async patchCoupon(code, patch, auth2 =
|
|
6152
|
+
async patchCoupon(code, patch, auth2 = SERVICE19) {
|
|
4320
6153
|
await this.ctx.http.request({
|
|
4321
6154
|
method: "PATCH",
|
|
4322
6155
|
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
@@ -4325,7 +6158,7 @@ var CouponService = class {
|
|
|
4325
6158
|
});
|
|
4326
6159
|
}
|
|
4327
6160
|
/** Delete a coupon by code. */
|
|
4328
|
-
async deleteCoupon(code, auth2 =
|
|
6161
|
+
async deleteCoupon(code, auth2 = SERVICE19) {
|
|
4329
6162
|
await this.ctx.http.request({
|
|
4330
6163
|
method: "DELETE",
|
|
4331
6164
|
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
@@ -4336,7 +6169,7 @@ var CouponService = class {
|
|
|
4336
6169
|
* Check whether a coupon can be redeemed (`POST /validation`). Resolves when
|
|
4337
6170
|
* redeemable; throws an `EmporixError` otherwise (no response body).
|
|
4338
6171
|
*/
|
|
4339
|
-
async validateCoupon(code, redemption, auth2 =
|
|
6172
|
+
async validateCoupon(code, redemption, auth2 = SERVICE19) {
|
|
4340
6173
|
await this.ctx.http.request({
|
|
4341
6174
|
method: "POST",
|
|
4342
6175
|
path: `${this.base()}/coupons/${encodeURIComponent(code)}/validation`,
|
|
@@ -4345,7 +6178,7 @@ var CouponService = class {
|
|
|
4345
6178
|
});
|
|
4346
6179
|
}
|
|
4347
6180
|
/** List a coupon's redemptions by criteria. */
|
|
4348
|
-
async listRedemptions(code, query = {}, auth2 =
|
|
6181
|
+
async listRedemptions(code, query = {}, auth2 = SERVICE19) {
|
|
4349
6182
|
return this.ctx.http.request({
|
|
4350
6183
|
method: "GET",
|
|
4351
6184
|
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions`,
|
|
@@ -4354,7 +6187,7 @@ var CouponService = class {
|
|
|
4354
6187
|
});
|
|
4355
6188
|
}
|
|
4356
6189
|
/** Redeem a coupon by creating a redemption (`POST`, HTTP 201). Returns the resource location. */
|
|
4357
|
-
async redeemCoupon(code, redemption, auth2 =
|
|
6190
|
+
async redeemCoupon(code, redemption, auth2 = SERVICE19) {
|
|
4358
6191
|
return this.ctx.http.request({
|
|
4359
6192
|
method: "POST",
|
|
4360
6193
|
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions`,
|
|
@@ -4363,7 +6196,7 @@ var CouponService = class {
|
|
|
4363
6196
|
});
|
|
4364
6197
|
}
|
|
4365
6198
|
/** Retrieve one redemption by id. */
|
|
4366
|
-
async getRedemption(code, id, auth2 =
|
|
6199
|
+
async getRedemption(code, id, auth2 = SERVICE19) {
|
|
4367
6200
|
return this.ctx.http.request({
|
|
4368
6201
|
method: "GET",
|
|
4369
6202
|
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions/${encodeURIComponent(id)}`,
|
|
@@ -4371,7 +6204,7 @@ var CouponService = class {
|
|
|
4371
6204
|
});
|
|
4372
6205
|
}
|
|
4373
6206
|
/** Delete a redemption by id. */
|
|
4374
|
-
async deleteRedemption(code, id, auth2 =
|
|
6207
|
+
async deleteRedemption(code, id, auth2 = SERVICE19) {
|
|
4375
6208
|
await this.ctx.http.request({
|
|
4376
6209
|
method: "DELETE",
|
|
4377
6210
|
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions/${encodeURIComponent(id)}`,
|
|
@@ -4379,7 +6212,7 @@ var CouponService = class {
|
|
|
4379
6212
|
});
|
|
4380
6213
|
}
|
|
4381
6214
|
/** Retrieve a customer's referral coupon (resolves to an empty body when none exists). */
|
|
4382
|
-
async getReferralCoupon(customerNumber, auth2 =
|
|
6215
|
+
async getReferralCoupon(customerNumber, auth2 = SERVICE19) {
|
|
4383
6216
|
return this.ctx.http.request({
|
|
4384
6217
|
method: "GET",
|
|
4385
6218
|
path: `${this.base()}/referral-coupons/${encodeURIComponent(customerNumber)}`,
|
|
@@ -4387,7 +6220,7 @@ var CouponService = class {
|
|
|
4387
6220
|
});
|
|
4388
6221
|
}
|
|
4389
6222
|
/** Create a referral coupon code for a customer (no request body). */
|
|
4390
|
-
async createReferralCoupon(customerNumber, auth2 =
|
|
6223
|
+
async createReferralCoupon(customerNumber, auth2 = SERVICE19) {
|
|
4391
6224
|
return this.ctx.http.request({
|
|
4392
6225
|
method: "POST",
|
|
4393
6226
|
path: `${this.base()}/referral-coupons/${encodeURIComponent(customerNumber)}`,
|
|
@@ -4397,7 +6230,7 @@ var CouponService = class {
|
|
|
4397
6230
|
};
|
|
4398
6231
|
|
|
4399
6232
|
// src/services/reward-points.ts
|
|
4400
|
-
var
|
|
6233
|
+
var SERVICE20 = { kind: "service" };
|
|
4401
6234
|
var RewardPointsService = class {
|
|
4402
6235
|
constructor(ctx) {
|
|
4403
6236
|
this.ctx = ctx;
|
|
@@ -4414,7 +6247,7 @@ var RewardPointsService = class {
|
|
|
4414
6247
|
}
|
|
4415
6248
|
// --- Admin: customer points management (service token) ---
|
|
4416
6249
|
/** Batch summary across all customers. */
|
|
4417
|
-
async listAllSummaries(query = {}, auth2 =
|
|
6250
|
+
async listAllSummaries(query = {}, auth2 = SERVICE20) {
|
|
4418
6251
|
return this.ctx.http.request({
|
|
4419
6252
|
method: "GET",
|
|
4420
6253
|
path: `${this.base()}/summaryBatch`,
|
|
@@ -4423,7 +6256,7 @@ var RewardPointsService = class {
|
|
|
4423
6256
|
});
|
|
4424
6257
|
}
|
|
4425
6258
|
/** Retrieve one customer's reward-points balance. */
|
|
4426
|
-
async getCustomerPoints(customerId, auth2 =
|
|
6259
|
+
async getCustomerPoints(customerId, auth2 = SERVICE20) {
|
|
4427
6260
|
return this.ctx.http.request({
|
|
4428
6261
|
method: "GET",
|
|
4429
6262
|
path: `${this.base()}/customer/${encodeURIComponent(customerId)}`,
|
|
@@ -4431,7 +6264,7 @@ var RewardPointsService = class {
|
|
|
4431
6264
|
});
|
|
4432
6265
|
}
|
|
4433
6266
|
/** Create a reward-points entry for a customer. */
|
|
4434
|
-
async createCustomerPoints(customerId, input, auth2 =
|
|
6267
|
+
async createCustomerPoints(customerId, input, auth2 = SERVICE20) {
|
|
4435
6268
|
await this.ctx.http.request({
|
|
4436
6269
|
method: "POST",
|
|
4437
6270
|
path: `${this.base()}/customer/${encodeURIComponent(customerId)}`,
|
|
@@ -4440,7 +6273,7 @@ var RewardPointsService = class {
|
|
|
4440
6273
|
});
|
|
4441
6274
|
}
|
|
4442
6275
|
/** Delete a customer's reward points. */
|
|
4443
|
-
async deleteCustomerPoints(customerId, auth2 =
|
|
6276
|
+
async deleteCustomerPoints(customerId, auth2 = SERVICE20) {
|
|
4444
6277
|
await this.ctx.http.request({
|
|
4445
6278
|
method: "DELETE",
|
|
4446
6279
|
path: `${this.base()}/customer/${encodeURIComponent(customerId)}`,
|
|
@@ -4448,7 +6281,7 @@ var RewardPointsService = class {
|
|
|
4448
6281
|
});
|
|
4449
6282
|
}
|
|
4450
6283
|
/** Retrieve a reward-points summary for one customer. */
|
|
4451
|
-
async getCustomerSummary(customerId, auth2 =
|
|
6284
|
+
async getCustomerSummary(customerId, auth2 = SERVICE20) {
|
|
4452
6285
|
return this.ctx.http.request({
|
|
4453
6286
|
method: "GET",
|
|
4454
6287
|
path: `${this.base()}/customer/${encodeURIComponent(customerId)}/summary`,
|
|
@@ -4456,7 +6289,7 @@ var RewardPointsService = class {
|
|
|
4456
6289
|
});
|
|
4457
6290
|
}
|
|
4458
6291
|
/** Add reward points for a customer. */
|
|
4459
|
-
async addPoints(customerId, input, auth2 =
|
|
6292
|
+
async addPoints(customerId, input, auth2 = SERVICE20) {
|
|
4460
6293
|
await this.ctx.http.request({
|
|
4461
6294
|
method: "POST",
|
|
4462
6295
|
path: `${this.base()}/customer/${encodeURIComponent(customerId)}/addPoints`,
|
|
@@ -4465,7 +6298,7 @@ var RewardPointsService = class {
|
|
|
4465
6298
|
});
|
|
4466
6299
|
}
|
|
4467
6300
|
/** Redeem a customer's reward points (on behalf). */
|
|
4468
|
-
async redeemPoints(customerId, input, auth2 =
|
|
6301
|
+
async redeemPoints(customerId, input, auth2 = SERVICE20) {
|
|
4469
6302
|
await this.ctx.http.request({
|
|
4470
6303
|
method: "POST",
|
|
4471
6304
|
path: `${this.base()}/customer/${encodeURIComponent(customerId)}/redeemPoints`,
|
|
@@ -4516,7 +6349,7 @@ var RewardPointsService = class {
|
|
|
4516
6349
|
}
|
|
4517
6350
|
// --- Redeem options (tenant-scoped; read open to customer, management service-only) ---
|
|
4518
6351
|
/** List redeem options. Defaults to the service token; pass a customer `auth` for storefront reads. */
|
|
4519
|
-
async listRedeemOptions(auth2 =
|
|
6352
|
+
async listRedeemOptions(auth2 = SERVICE20) {
|
|
4520
6353
|
return this.ctx.http.request({
|
|
4521
6354
|
method: "GET",
|
|
4522
6355
|
path: `${this.tenantBase()}/redeemOptions`,
|
|
@@ -4524,7 +6357,7 @@ var RewardPointsService = class {
|
|
|
4524
6357
|
});
|
|
4525
6358
|
}
|
|
4526
6359
|
/** Create a redeem option. Returns the updated options list. */
|
|
4527
|
-
async createRedeemOption(input, auth2 =
|
|
6360
|
+
async createRedeemOption(input, auth2 = SERVICE20) {
|
|
4528
6361
|
return this.ctx.http.request({
|
|
4529
6362
|
method: "POST",
|
|
4530
6363
|
path: `${this.tenantBase()}/redeemOptions`,
|
|
@@ -4533,7 +6366,7 @@ var RewardPointsService = class {
|
|
|
4533
6366
|
});
|
|
4534
6367
|
}
|
|
4535
6368
|
/** Update a redeem option by id. Resolves once accepted (no response body). */
|
|
4536
|
-
async updateRedeemOption(redeemOptionId, input, auth2 =
|
|
6369
|
+
async updateRedeemOption(redeemOptionId, input, auth2 = SERVICE20) {
|
|
4537
6370
|
await this.ctx.http.request({
|
|
4538
6371
|
method: "PUT",
|
|
4539
6372
|
path: `${this.tenantBase()}/redeemOptions/${encodeURIComponent(redeemOptionId)}`,
|
|
@@ -4542,7 +6375,7 @@ var RewardPointsService = class {
|
|
|
4542
6375
|
});
|
|
4543
6376
|
}
|
|
4544
6377
|
/** Delete a redeem option by id. */
|
|
4545
|
-
async deleteRedeemOption(redeemOptionId, auth2 =
|
|
6378
|
+
async deleteRedeemOption(redeemOptionId, auth2 = SERVICE20) {
|
|
4546
6379
|
await this.ctx.http.request({
|
|
4547
6380
|
method: "DELETE",
|
|
4548
6381
|
path: `${this.tenantBase()}/redeemOptions/${encodeURIComponent(redeemOptionId)}`,
|
|
@@ -4552,7 +6385,7 @@ var RewardPointsService = class {
|
|
|
4552
6385
|
};
|
|
4553
6386
|
|
|
4554
6387
|
// src/services/brand.ts
|
|
4555
|
-
var
|
|
6388
|
+
var SERVICE21 = { kind: "service" };
|
|
4556
6389
|
var BrandService = class {
|
|
4557
6390
|
constructor(ctx) {
|
|
4558
6391
|
this.ctx = ctx;
|
|
@@ -4563,7 +6396,7 @@ var BrandService = class {
|
|
|
4563
6396
|
return `/brand/brands`;
|
|
4564
6397
|
}
|
|
4565
6398
|
/** List all brands. */
|
|
4566
|
-
async listBrands(query = {}, auth2 =
|
|
6399
|
+
async listBrands(query = {}, auth2 = SERVICE21) {
|
|
4567
6400
|
return this.ctx.http.request({
|
|
4568
6401
|
method: "GET",
|
|
4569
6402
|
path: this.base(),
|
|
@@ -4572,7 +6405,7 @@ var BrandService = class {
|
|
|
4572
6405
|
});
|
|
4573
6406
|
}
|
|
4574
6407
|
/** Retrieve one brand by id. */
|
|
4575
|
-
async getBrand(brandId, auth2 =
|
|
6408
|
+
async getBrand(brandId, auth2 = SERVICE21) {
|
|
4576
6409
|
return this.ctx.http.request({
|
|
4577
6410
|
method: "GET",
|
|
4578
6411
|
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
@@ -4580,7 +6413,7 @@ var BrandService = class {
|
|
|
4580
6413
|
});
|
|
4581
6414
|
}
|
|
4582
6415
|
/** Create a brand. */
|
|
4583
|
-
async createBrand(input, auth2 =
|
|
6416
|
+
async createBrand(input, auth2 = SERVICE21) {
|
|
4584
6417
|
return this.ctx.http.request({
|
|
4585
6418
|
method: "POST",
|
|
4586
6419
|
path: this.base(),
|
|
@@ -4589,7 +6422,7 @@ var BrandService = class {
|
|
|
4589
6422
|
});
|
|
4590
6423
|
}
|
|
4591
6424
|
/** Replace a brand by id. */
|
|
4592
|
-
async updateBrand(brandId, input, auth2 =
|
|
6425
|
+
async updateBrand(brandId, input, auth2 = SERVICE21) {
|
|
4593
6426
|
return this.ctx.http.request({
|
|
4594
6427
|
method: "PUT",
|
|
4595
6428
|
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
@@ -4598,7 +6431,7 @@ var BrandService = class {
|
|
|
4598
6431
|
});
|
|
4599
6432
|
}
|
|
4600
6433
|
/** Partially update a brand by id. */
|
|
4601
|
-
async patchBrand(brandId, patch, auth2 =
|
|
6434
|
+
async patchBrand(brandId, patch, auth2 = SERVICE21) {
|
|
4602
6435
|
return this.ctx.http.request({
|
|
4603
6436
|
method: "PATCH",
|
|
4604
6437
|
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
@@ -4607,7 +6440,7 @@ var BrandService = class {
|
|
|
4607
6440
|
});
|
|
4608
6441
|
}
|
|
4609
6442
|
/** Delete a brand by id. */
|
|
4610
|
-
async deleteBrand(brandId, auth2 =
|
|
6443
|
+
async deleteBrand(brandId, auth2 = SERVICE21) {
|
|
4611
6444
|
await this.ctx.http.request({
|
|
4612
6445
|
method: "DELETE",
|
|
4613
6446
|
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
@@ -4617,7 +6450,7 @@ var BrandService = class {
|
|
|
4617
6450
|
};
|
|
4618
6451
|
|
|
4619
6452
|
// src/services/label.ts
|
|
4620
|
-
var
|
|
6453
|
+
var SERVICE22 = { kind: "service" };
|
|
4621
6454
|
var LabelService = class {
|
|
4622
6455
|
constructor(ctx) {
|
|
4623
6456
|
this.ctx = ctx;
|
|
@@ -4628,7 +6461,7 @@ var LabelService = class {
|
|
|
4628
6461
|
return `/label/labels`;
|
|
4629
6462
|
}
|
|
4630
6463
|
/** List all labels. */
|
|
4631
|
-
async listLabels(query = {}, auth2 =
|
|
6464
|
+
async listLabels(query = {}, auth2 = SERVICE22) {
|
|
4632
6465
|
return this.ctx.http.request({
|
|
4633
6466
|
method: "GET",
|
|
4634
6467
|
path: this.base(),
|
|
@@ -4637,7 +6470,7 @@ var LabelService = class {
|
|
|
4637
6470
|
});
|
|
4638
6471
|
}
|
|
4639
6472
|
/** Retrieve one label by id. */
|
|
4640
|
-
async getLabel(labelId, auth2 =
|
|
6473
|
+
async getLabel(labelId, auth2 = SERVICE22) {
|
|
4641
6474
|
return this.ctx.http.request({
|
|
4642
6475
|
method: "GET",
|
|
4643
6476
|
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
@@ -4645,7 +6478,7 @@ var LabelService = class {
|
|
|
4645
6478
|
});
|
|
4646
6479
|
}
|
|
4647
6480
|
/** Create a label. */
|
|
4648
|
-
async createLabel(input, auth2 =
|
|
6481
|
+
async createLabel(input, auth2 = SERVICE22) {
|
|
4649
6482
|
return this.ctx.http.request({
|
|
4650
6483
|
method: "POST",
|
|
4651
6484
|
path: this.base(),
|
|
@@ -4654,7 +6487,7 @@ var LabelService = class {
|
|
|
4654
6487
|
});
|
|
4655
6488
|
}
|
|
4656
6489
|
/** Replace a label by id. */
|
|
4657
|
-
async updateLabel(labelId, input, auth2 =
|
|
6490
|
+
async updateLabel(labelId, input, auth2 = SERVICE22) {
|
|
4658
6491
|
return this.ctx.http.request({
|
|
4659
6492
|
method: "PUT",
|
|
4660
6493
|
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
@@ -4663,7 +6496,7 @@ var LabelService = class {
|
|
|
4663
6496
|
});
|
|
4664
6497
|
}
|
|
4665
6498
|
/** Partially update a label by id. */
|
|
4666
|
-
async patchLabel(labelId, patch, auth2 =
|
|
6499
|
+
async patchLabel(labelId, patch, auth2 = SERVICE22) {
|
|
4667
6500
|
return this.ctx.http.request({
|
|
4668
6501
|
method: "PATCH",
|
|
4669
6502
|
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
@@ -4672,7 +6505,7 @@ var LabelService = class {
|
|
|
4672
6505
|
});
|
|
4673
6506
|
}
|
|
4674
6507
|
/** Delete a label by id. */
|
|
4675
|
-
async deleteLabel(labelId, auth2 =
|
|
6508
|
+
async deleteLabel(labelId, auth2 = SERVICE22) {
|
|
4676
6509
|
await this.ctx.http.request({
|
|
4677
6510
|
method: "DELETE",
|
|
4678
6511
|
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
@@ -4682,7 +6515,7 @@ var LabelService = class {
|
|
|
4682
6515
|
};
|
|
4683
6516
|
|
|
4684
6517
|
// src/services/country.ts
|
|
4685
|
-
var
|
|
6518
|
+
var SERVICE23 = { kind: "service" };
|
|
4686
6519
|
var CountryService = class {
|
|
4687
6520
|
constructor(ctx) {
|
|
4688
6521
|
this.ctx = ctx;
|
|
@@ -4693,7 +6526,7 @@ var CountryService = class {
|
|
|
4693
6526
|
return `/country/${this.ctx.tenant}`;
|
|
4694
6527
|
}
|
|
4695
6528
|
/** List all countries. */
|
|
4696
|
-
async listCountries(query = {}, auth2 =
|
|
6529
|
+
async listCountries(query = {}, auth2 = SERVICE23) {
|
|
4697
6530
|
return this.ctx.http.request({
|
|
4698
6531
|
method: "GET",
|
|
4699
6532
|
path: `${this.base()}/countries`,
|
|
@@ -4702,7 +6535,7 @@ var CountryService = class {
|
|
|
4702
6535
|
});
|
|
4703
6536
|
}
|
|
4704
6537
|
/** Retrieve one country by code. */
|
|
4705
|
-
async getCountry(countryCode, auth2 =
|
|
6538
|
+
async getCountry(countryCode, auth2 = SERVICE23) {
|
|
4706
6539
|
return this.ctx.http.request({
|
|
4707
6540
|
method: "GET",
|
|
4708
6541
|
path: `${this.base()}/countries/${encodeURIComponent(countryCode)}`,
|
|
@@ -4710,7 +6543,7 @@ var CountryService = class {
|
|
|
4710
6543
|
});
|
|
4711
6544
|
}
|
|
4712
6545
|
/** Partially update a country by code. Resolves once accepted (no response body). */
|
|
4713
|
-
async patchCountry(countryCode, patch, auth2 =
|
|
6546
|
+
async patchCountry(countryCode, patch, auth2 = SERVICE23) {
|
|
4714
6547
|
await this.ctx.http.request({
|
|
4715
6548
|
method: "PATCH",
|
|
4716
6549
|
path: `${this.base()}/countries/${encodeURIComponent(countryCode)}`,
|
|
@@ -4719,7 +6552,7 @@ var CountryService = class {
|
|
|
4719
6552
|
});
|
|
4720
6553
|
}
|
|
4721
6554
|
/** List all regions. */
|
|
4722
|
-
async listRegions(query = {}, auth2 =
|
|
6555
|
+
async listRegions(query = {}, auth2 = SERVICE23) {
|
|
4723
6556
|
return this.ctx.http.request({
|
|
4724
6557
|
method: "GET",
|
|
4725
6558
|
path: `${this.base()}/regions`,
|
|
@@ -4728,7 +6561,7 @@ var CountryService = class {
|
|
|
4728
6561
|
});
|
|
4729
6562
|
}
|
|
4730
6563
|
/** Retrieve one region by code. */
|
|
4731
|
-
async getRegion(regionCode, auth2 =
|
|
6564
|
+
async getRegion(regionCode, auth2 = SERVICE23) {
|
|
4732
6565
|
return this.ctx.http.request({
|
|
4733
6566
|
method: "GET",
|
|
4734
6567
|
path: `${this.base()}/regions/${encodeURIComponent(regionCode)}`,
|
|
@@ -4738,7 +6571,7 @@ var CountryService = class {
|
|
|
4738
6571
|
};
|
|
4739
6572
|
|
|
4740
6573
|
// src/services/currency.ts
|
|
4741
|
-
var
|
|
6574
|
+
var SERVICE24 = { kind: "service" };
|
|
4742
6575
|
var CurrencyService = class {
|
|
4743
6576
|
constructor(ctx) {
|
|
4744
6577
|
this.ctx = ctx;
|
|
@@ -4750,7 +6583,7 @@ var CurrencyService = class {
|
|
|
4750
6583
|
}
|
|
4751
6584
|
// --- Currencies ---
|
|
4752
6585
|
/** List all currencies. */
|
|
4753
|
-
async listCurrencies(query = {}, auth2 =
|
|
6586
|
+
async listCurrencies(query = {}, auth2 = SERVICE24) {
|
|
4754
6587
|
return this.ctx.http.request({
|
|
4755
6588
|
method: "GET",
|
|
4756
6589
|
path: `${this.base()}/currencies`,
|
|
@@ -4759,7 +6592,7 @@ var CurrencyService = class {
|
|
|
4759
6592
|
});
|
|
4760
6593
|
}
|
|
4761
6594
|
/** Retrieve one currency by code. */
|
|
4762
|
-
async getCurrency(code, auth2 =
|
|
6595
|
+
async getCurrency(code, auth2 = SERVICE24) {
|
|
4763
6596
|
return this.ctx.http.request({
|
|
4764
6597
|
method: "GET",
|
|
4765
6598
|
path: `${this.base()}/currencies/${encodeURIComponent(code)}`,
|
|
@@ -4767,7 +6600,7 @@ var CurrencyService = class {
|
|
|
4767
6600
|
});
|
|
4768
6601
|
}
|
|
4769
6602
|
/** Create a currency. */
|
|
4770
|
-
async createCurrency(input, auth2 =
|
|
6603
|
+
async createCurrency(input, auth2 = SERVICE24) {
|
|
4771
6604
|
return this.ctx.http.request({
|
|
4772
6605
|
method: "POST",
|
|
4773
6606
|
path: `${this.base()}/currencies`,
|
|
@@ -4776,7 +6609,7 @@ var CurrencyService = class {
|
|
|
4776
6609
|
});
|
|
4777
6610
|
}
|
|
4778
6611
|
/** Update a currency by code. */
|
|
4779
|
-
async updateCurrency(code, input, auth2 =
|
|
6612
|
+
async updateCurrency(code, input, auth2 = SERVICE24) {
|
|
4780
6613
|
return this.ctx.http.request({
|
|
4781
6614
|
method: "PUT",
|
|
4782
6615
|
path: `${this.base()}/currencies/${encodeURIComponent(code)}`,
|
|
@@ -4785,7 +6618,7 @@ var CurrencyService = class {
|
|
|
4785
6618
|
});
|
|
4786
6619
|
}
|
|
4787
6620
|
/** Delete a currency by code. */
|
|
4788
|
-
async deleteCurrency(code, auth2 =
|
|
6621
|
+
async deleteCurrency(code, auth2 = SERVICE24) {
|
|
4789
6622
|
await this.ctx.http.request({
|
|
4790
6623
|
method: "DELETE",
|
|
4791
6624
|
path: `${this.base()}/currencies/${encodeURIComponent(code)}`,
|
|
@@ -4794,7 +6627,7 @@ var CurrencyService = class {
|
|
|
4794
6627
|
}
|
|
4795
6628
|
// --- Exchange rates ---
|
|
4796
6629
|
/** List all exchange rates. */
|
|
4797
|
-
async listExchangeRates(query = {}, auth2 =
|
|
6630
|
+
async listExchangeRates(query = {}, auth2 = SERVICE24) {
|
|
4798
6631
|
return this.ctx.http.request({
|
|
4799
6632
|
method: "GET",
|
|
4800
6633
|
path: `${this.base()}/exchanges`,
|
|
@@ -4803,7 +6636,7 @@ var CurrencyService = class {
|
|
|
4803
6636
|
});
|
|
4804
6637
|
}
|
|
4805
6638
|
/** Retrieve one exchange rate by code. */
|
|
4806
|
-
async getExchangeRate(code, auth2 =
|
|
6639
|
+
async getExchangeRate(code, auth2 = SERVICE24) {
|
|
4807
6640
|
return this.ctx.http.request({
|
|
4808
6641
|
method: "GET",
|
|
4809
6642
|
path: `${this.base()}/exchanges/${encodeURIComponent(code)}`,
|
|
@@ -4811,7 +6644,7 @@ var CurrencyService = class {
|
|
|
4811
6644
|
});
|
|
4812
6645
|
}
|
|
4813
6646
|
/** Create an exchange rate. */
|
|
4814
|
-
async createExchangeRate(input, auth2 =
|
|
6647
|
+
async createExchangeRate(input, auth2 = SERVICE24) {
|
|
4815
6648
|
return this.ctx.http.request({
|
|
4816
6649
|
method: "POST",
|
|
4817
6650
|
path: `${this.base()}/exchanges`,
|
|
@@ -4820,7 +6653,7 @@ var CurrencyService = class {
|
|
|
4820
6653
|
});
|
|
4821
6654
|
}
|
|
4822
6655
|
/** Update an exchange rate by code. */
|
|
4823
|
-
async updateExchangeRate(code, input, auth2 =
|
|
6656
|
+
async updateExchangeRate(code, input, auth2 = SERVICE24) {
|
|
4824
6657
|
return this.ctx.http.request({
|
|
4825
6658
|
method: "PUT",
|
|
4826
6659
|
path: `${this.base()}/exchanges/${encodeURIComponent(code)}`,
|
|
@@ -4829,7 +6662,7 @@ var CurrencyService = class {
|
|
|
4829
6662
|
});
|
|
4830
6663
|
}
|
|
4831
6664
|
/** Delete an exchange rate by code. */
|
|
4832
|
-
async deleteExchangeRate(code, auth2 =
|
|
6665
|
+
async deleteExchangeRate(code, auth2 = SERVICE24) {
|
|
4833
6666
|
await this.ctx.http.request({
|
|
4834
6667
|
method: "DELETE",
|
|
4835
6668
|
path: `${this.base()}/exchanges/${encodeURIComponent(code)}`,
|
|
@@ -4839,7 +6672,7 @@ var CurrencyService = class {
|
|
|
4839
6672
|
};
|
|
4840
6673
|
|
|
4841
6674
|
// src/services/shipping.ts
|
|
4842
|
-
var
|
|
6675
|
+
var SERVICE25 = { kind: "service" };
|
|
4843
6676
|
var ShippingService = class {
|
|
4844
6677
|
constructor(ctx) {
|
|
4845
6678
|
this.ctx = ctx;
|
|
@@ -4854,7 +6687,7 @@ var ShippingService = class {
|
|
|
4854
6687
|
}
|
|
4855
6688
|
// --- Sites ---
|
|
4856
6689
|
/** Find shipping-related sites by postal code (`POST /findSite`). */
|
|
4857
|
-
async findSites(input, auth2 =
|
|
6690
|
+
async findSites(input, auth2 = SERVICE25) {
|
|
4858
6691
|
return this.ctx.http.request({
|
|
4859
6692
|
method: "POST",
|
|
4860
6693
|
path: `${this.base()}/findSite`,
|
|
@@ -4864,7 +6697,7 @@ var ShippingService = class {
|
|
|
4864
6697
|
}
|
|
4865
6698
|
// --- Zones ---
|
|
4866
6699
|
/** List shipping zones for a site. */
|
|
4867
|
-
async listZones(site, query = {}, auth2 =
|
|
6700
|
+
async listZones(site, query = {}, auth2 = SERVICE25) {
|
|
4868
6701
|
return this.ctx.http.request({
|
|
4869
6702
|
method: "GET",
|
|
4870
6703
|
path: `${this.siteBase(site)}/zones`,
|
|
@@ -4873,7 +6706,7 @@ var ShippingService = class {
|
|
|
4873
6706
|
});
|
|
4874
6707
|
}
|
|
4875
6708
|
/** Retrieve one shipping zone. */
|
|
4876
|
-
async getZone(site, zoneId, auth2 =
|
|
6709
|
+
async getZone(site, zoneId, auth2 = SERVICE25) {
|
|
4877
6710
|
return this.ctx.http.request({
|
|
4878
6711
|
method: "GET",
|
|
4879
6712
|
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
@@ -4881,7 +6714,7 @@ var ShippingService = class {
|
|
|
4881
6714
|
});
|
|
4882
6715
|
}
|
|
4883
6716
|
/** Create a shipping zone. */
|
|
4884
|
-
async createZone(site, zone, auth2 =
|
|
6717
|
+
async createZone(site, zone, auth2 = SERVICE25) {
|
|
4885
6718
|
return this.ctx.http.request({
|
|
4886
6719
|
method: "POST",
|
|
4887
6720
|
path: `${this.siteBase(site)}/zones`,
|
|
@@ -4890,7 +6723,7 @@ var ShippingService = class {
|
|
|
4890
6723
|
});
|
|
4891
6724
|
}
|
|
4892
6725
|
/** Replace a shipping zone. */
|
|
4893
|
-
async updateZone(site, zoneId, zone, auth2 =
|
|
6726
|
+
async updateZone(site, zoneId, zone, auth2 = SERVICE25) {
|
|
4894
6727
|
await this.ctx.http.request({
|
|
4895
6728
|
method: "PUT",
|
|
4896
6729
|
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
@@ -4899,7 +6732,7 @@ var ShippingService = class {
|
|
|
4899
6732
|
});
|
|
4900
6733
|
}
|
|
4901
6734
|
/** Partially update a shipping zone. */
|
|
4902
|
-
async patchZone(site, zoneId, patch, auth2 =
|
|
6735
|
+
async patchZone(site, zoneId, patch, auth2 = SERVICE25) {
|
|
4903
6736
|
await this.ctx.http.request({
|
|
4904
6737
|
method: "PATCH",
|
|
4905
6738
|
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
@@ -4908,7 +6741,7 @@ var ShippingService = class {
|
|
|
4908
6741
|
});
|
|
4909
6742
|
}
|
|
4910
6743
|
/** Delete a shipping zone. */
|
|
4911
|
-
async deleteZone(site, zoneId, auth2 =
|
|
6744
|
+
async deleteZone(site, zoneId, auth2 = SERVICE25) {
|
|
4912
6745
|
await this.ctx.http.request({
|
|
4913
6746
|
method: "DELETE",
|
|
4914
6747
|
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
@@ -4917,7 +6750,7 @@ var ShippingService = class {
|
|
|
4917
6750
|
}
|
|
4918
6751
|
// --- Methods (per zone) ---
|
|
4919
6752
|
/** List shipping methods of a zone. */
|
|
4920
|
-
async listMethods(site, zoneId, query = {}, auth2 =
|
|
6753
|
+
async listMethods(site, zoneId, query = {}, auth2 = SERVICE25) {
|
|
4921
6754
|
return this.ctx.http.request({
|
|
4922
6755
|
method: "GET",
|
|
4923
6756
|
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods`,
|
|
@@ -4926,7 +6759,7 @@ var ShippingService = class {
|
|
|
4926
6759
|
});
|
|
4927
6760
|
}
|
|
4928
6761
|
/** Retrieve one shipping method. */
|
|
4929
|
-
async getMethod(site, zoneId, methodId, auth2 =
|
|
6762
|
+
async getMethod(site, zoneId, methodId, auth2 = SERVICE25) {
|
|
4930
6763
|
return this.ctx.http.request({
|
|
4931
6764
|
method: "GET",
|
|
4932
6765
|
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
@@ -4934,7 +6767,7 @@ var ShippingService = class {
|
|
|
4934
6767
|
});
|
|
4935
6768
|
}
|
|
4936
6769
|
/** Create a shipping method in a zone. */
|
|
4937
|
-
async createMethod(site, zoneId, method, auth2 =
|
|
6770
|
+
async createMethod(site, zoneId, method, auth2 = SERVICE25) {
|
|
4938
6771
|
return this.ctx.http.request({
|
|
4939
6772
|
method: "POST",
|
|
4940
6773
|
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods`,
|
|
@@ -4943,7 +6776,7 @@ var ShippingService = class {
|
|
|
4943
6776
|
});
|
|
4944
6777
|
}
|
|
4945
6778
|
/** Replace a shipping method. */
|
|
4946
|
-
async updateMethod(site, zoneId, methodId, method, auth2 =
|
|
6779
|
+
async updateMethod(site, zoneId, methodId, method, auth2 = SERVICE25) {
|
|
4947
6780
|
await this.ctx.http.request({
|
|
4948
6781
|
method: "PUT",
|
|
4949
6782
|
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
@@ -4952,7 +6785,7 @@ var ShippingService = class {
|
|
|
4952
6785
|
});
|
|
4953
6786
|
}
|
|
4954
6787
|
/** Partially update a shipping method. */
|
|
4955
|
-
async patchMethod(site, zoneId, methodId, patch, auth2 =
|
|
6788
|
+
async patchMethod(site, zoneId, methodId, patch, auth2 = SERVICE25) {
|
|
4956
6789
|
await this.ctx.http.request({
|
|
4957
6790
|
method: "PATCH",
|
|
4958
6791
|
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
@@ -4961,7 +6794,7 @@ var ShippingService = class {
|
|
|
4961
6794
|
});
|
|
4962
6795
|
}
|
|
4963
6796
|
/** Delete a shipping method. */
|
|
4964
|
-
async deleteMethod(site, zoneId, methodId, auth2 =
|
|
6797
|
+
async deleteMethod(site, zoneId, methodId, auth2 = SERVICE25) {
|
|
4965
6798
|
await this.ctx.http.request({
|
|
4966
6799
|
method: "DELETE",
|
|
4967
6800
|
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
@@ -4970,7 +6803,7 @@ var ShippingService = class {
|
|
|
4970
6803
|
}
|
|
4971
6804
|
// --- Cost / quote ---
|
|
4972
6805
|
/** Calculate the final shipping cost (`POST /quote`). */
|
|
4973
|
-
async quote(site, input, auth2 =
|
|
6806
|
+
async quote(site, input, auth2 = SERVICE25) {
|
|
4974
6807
|
return this.ctx.http.request({
|
|
4975
6808
|
method: "POST",
|
|
4976
6809
|
path: `${this.siteBase(site)}/quote`,
|
|
@@ -4979,7 +6812,7 @@ var ShippingService = class {
|
|
|
4979
6812
|
});
|
|
4980
6813
|
}
|
|
4981
6814
|
/** Calculate the minimum shipping cost (`POST /quote/minimum`). */
|
|
4982
|
-
async quoteMinimum(site, input, auth2 =
|
|
6815
|
+
async quoteMinimum(site, input, auth2 = SERVICE25) {
|
|
4983
6816
|
return this.ctx.http.request({
|
|
4984
6817
|
method: "POST",
|
|
4985
6818
|
path: `${this.siteBase(site)}/quote/minimum`,
|
|
@@ -4988,7 +6821,7 @@ var ShippingService = class {
|
|
|
4988
6821
|
});
|
|
4989
6822
|
}
|
|
4990
6823
|
/** Calculate the shipping cost for a given slot (`POST /quote/slot`). */
|
|
4991
|
-
async quoteSlot(site, input, auth2 =
|
|
6824
|
+
async quoteSlot(site, input, auth2 = SERVICE25) {
|
|
4992
6825
|
return this.ctx.http.request({
|
|
4993
6826
|
method: "POST",
|
|
4994
6827
|
path: `${this.siteBase(site)}/quote/slot`,
|
|
@@ -4998,7 +6831,7 @@ var ShippingService = class {
|
|
|
4998
6831
|
}
|
|
4999
6832
|
// --- Groups ---
|
|
5000
6833
|
/** List shipping groups for a site. */
|
|
5001
|
-
async listGroups(site, query = {}, auth2 =
|
|
6834
|
+
async listGroups(site, query = {}, auth2 = SERVICE25) {
|
|
5002
6835
|
return this.ctx.http.request({
|
|
5003
6836
|
method: "GET",
|
|
5004
6837
|
path: `${this.siteBase(site)}/groups`,
|
|
@@ -5007,7 +6840,7 @@ var ShippingService = class {
|
|
|
5007
6840
|
});
|
|
5008
6841
|
}
|
|
5009
6842
|
/** Retrieve one shipping group. */
|
|
5010
|
-
async getGroup(site, groupId, auth2 =
|
|
6843
|
+
async getGroup(site, groupId, auth2 = SERVICE25) {
|
|
5011
6844
|
return this.ctx.http.request({
|
|
5012
6845
|
method: "GET",
|
|
5013
6846
|
path: `${this.siteBase(site)}/groups/${encodeURIComponent(groupId)}`,
|
|
@@ -5015,7 +6848,7 @@ var ShippingService = class {
|
|
|
5015
6848
|
});
|
|
5016
6849
|
}
|
|
5017
6850
|
/** Create a shipping group. */
|
|
5018
|
-
async createGroup(site, group, auth2 =
|
|
6851
|
+
async createGroup(site, group, auth2 = SERVICE25) {
|
|
5019
6852
|
return this.ctx.http.request({
|
|
5020
6853
|
method: "POST",
|
|
5021
6854
|
path: `${this.siteBase(site)}/groups`,
|
|
@@ -5024,7 +6857,7 @@ var ShippingService = class {
|
|
|
5024
6857
|
});
|
|
5025
6858
|
}
|
|
5026
6859
|
/** Replace a shipping group. */
|
|
5027
|
-
async updateGroup(site, groupId, group, auth2 =
|
|
6860
|
+
async updateGroup(site, groupId, group, auth2 = SERVICE25) {
|
|
5028
6861
|
await this.ctx.http.request({
|
|
5029
6862
|
method: "PUT",
|
|
5030
6863
|
path: `${this.siteBase(site)}/groups/${encodeURIComponent(groupId)}`,
|
|
@@ -5033,7 +6866,7 @@ var ShippingService = class {
|
|
|
5033
6866
|
});
|
|
5034
6867
|
}
|
|
5035
6868
|
/** Delete a shipping group. */
|
|
5036
|
-
async deleteGroup(site, groupId, auth2 =
|
|
6869
|
+
async deleteGroup(site, groupId, auth2 = SERVICE25) {
|
|
5037
6870
|
await this.ctx.http.request({
|
|
5038
6871
|
method: "DELETE",
|
|
5039
6872
|
path: `${this.siteBase(site)}/groups/${encodeURIComponent(groupId)}`,
|
|
@@ -5042,7 +6875,7 @@ var ShippingService = class {
|
|
|
5042
6875
|
}
|
|
5043
6876
|
// --- Customer-group relations ---
|
|
5044
6877
|
/** List customer-group relations for a site. */
|
|
5045
|
-
async listCgRelations(site, query = {}, auth2 =
|
|
6878
|
+
async listCgRelations(site, query = {}, auth2 = SERVICE25) {
|
|
5046
6879
|
return this.ctx.http.request({
|
|
5047
6880
|
method: "GET",
|
|
5048
6881
|
path: `${this.siteBase(site)}/cgrelations`,
|
|
@@ -5051,7 +6884,7 @@ var ShippingService = class {
|
|
|
5051
6884
|
});
|
|
5052
6885
|
}
|
|
5053
6886
|
/** Retrieve a customer's customer-group relations. */
|
|
5054
|
-
async getCgRelations(site, customerId, auth2 =
|
|
6887
|
+
async getCgRelations(site, customerId, auth2 = SERVICE25) {
|
|
5055
6888
|
return this.ctx.http.request({
|
|
5056
6889
|
method: "GET",
|
|
5057
6890
|
path: `${this.siteBase(site)}/cgrelations/${encodeURIComponent(customerId)}`,
|
|
@@ -5059,7 +6892,7 @@ var ShippingService = class {
|
|
|
5059
6892
|
});
|
|
5060
6893
|
}
|
|
5061
6894
|
/** Create a customer-group relation. */
|
|
5062
|
-
async createCgRelation(site, relation, auth2 =
|
|
6895
|
+
async createCgRelation(site, relation, auth2 = SERVICE25) {
|
|
5063
6896
|
return this.ctx.http.request({
|
|
5064
6897
|
method: "POST",
|
|
5065
6898
|
path: `${this.siteBase(site)}/cgrelations`,
|
|
@@ -5068,7 +6901,7 @@ var ShippingService = class {
|
|
|
5068
6901
|
});
|
|
5069
6902
|
}
|
|
5070
6903
|
/** Update a customer's customer-group relations. */
|
|
5071
|
-
async updateCgRelations(site, customerId, relation, auth2 =
|
|
6904
|
+
async updateCgRelations(site, customerId, relation, auth2 = SERVICE25) {
|
|
5072
6905
|
await this.ctx.http.request({
|
|
5073
6906
|
method: "PUT",
|
|
5074
6907
|
path: `${this.siteBase(site)}/cgrelations/${encodeURIComponent(customerId)}`,
|
|
@@ -5077,7 +6910,7 @@ var ShippingService = class {
|
|
|
5077
6910
|
});
|
|
5078
6911
|
}
|
|
5079
6912
|
/** Delete a customer's customer-group relation. */
|
|
5080
|
-
async deleteCgRelation(site, customerId, auth2 =
|
|
6913
|
+
async deleteCgRelation(site, customerId, auth2 = SERVICE25) {
|
|
5081
6914
|
await this.ctx.http.request({
|
|
5082
6915
|
method: "DELETE",
|
|
5083
6916
|
path: `${this.siteBase(site)}/cgrelations/${encodeURIComponent(customerId)}`,
|
|
@@ -5086,7 +6919,7 @@ var ShippingService = class {
|
|
|
5086
6919
|
}
|
|
5087
6920
|
// --- Phase 2: delivery windows ---
|
|
5088
6921
|
/** Retrieve delivery windows for a delivery area + cart. */
|
|
5089
|
-
async getAreaDeliveryWindows(deliveryAreaId, cartId, auth2 =
|
|
6922
|
+
async getAreaDeliveryWindows(deliveryAreaId, cartId, auth2 = SERVICE25) {
|
|
5090
6923
|
return this.ctx.http.request({
|
|
5091
6924
|
method: "GET",
|
|
5092
6925
|
path: `${this.base()}/areaDeliveryTimes/${encodeURIComponent(deliveryAreaId)}/${encodeURIComponent(cartId)}`,
|
|
@@ -5094,7 +6927,7 @@ var ShippingService = class {
|
|
|
5094
6927
|
});
|
|
5095
6928
|
}
|
|
5096
6929
|
/** Retrieve delivery windows for a cart. */
|
|
5097
|
-
async getCartDeliveryWindows(cartId, auth2 =
|
|
6930
|
+
async getCartDeliveryWindows(cartId, auth2 = SERVICE25) {
|
|
5098
6931
|
return this.ctx.http.request({
|
|
5099
6932
|
method: "GET",
|
|
5100
6933
|
path: `${this.base()}/actualDeliveryWindows/${encodeURIComponent(cartId)}`,
|
|
@@ -5102,7 +6935,7 @@ var ShippingService = class {
|
|
|
5102
6935
|
});
|
|
5103
6936
|
}
|
|
5104
6937
|
/** Increment the delivery-window counter. */
|
|
5105
|
-
async incrementDeliveryWindowCounter(input, auth2 =
|
|
6938
|
+
async incrementDeliveryWindowCounter(input, auth2 = SERVICE25) {
|
|
5106
6939
|
await this.ctx.http.request({
|
|
5107
6940
|
method: "POST",
|
|
5108
6941
|
path: `${this.base()}/actualDeliveryWindows/incrementCounter`,
|
|
@@ -5111,7 +6944,7 @@ var ShippingService = class {
|
|
|
5111
6944
|
});
|
|
5112
6945
|
}
|
|
5113
6946
|
/** Validate a delivery window. Resolves when valid; throws otherwise. */
|
|
5114
|
-
async validateDeliveryWindow(input, auth2 =
|
|
6947
|
+
async validateDeliveryWindow(input, auth2 = SERVICE25) {
|
|
5115
6948
|
await this.ctx.http.request({
|
|
5116
6949
|
method: "POST",
|
|
5117
6950
|
path: `${this.base()}/deliveryWindowValidation`,
|
|
@@ -5121,7 +6954,7 @@ var ShippingService = class {
|
|
|
5121
6954
|
}
|
|
5122
6955
|
// --- Phase 2: delivery times ---
|
|
5123
6956
|
/** List all delivery times. */
|
|
5124
|
-
async listDeliveryTimes(query = {}, auth2 =
|
|
6957
|
+
async listDeliveryTimes(query = {}, auth2 = SERVICE25) {
|
|
5125
6958
|
return this.ctx.http.request({
|
|
5126
6959
|
method: "GET",
|
|
5127
6960
|
path: `${this.base()}/delivery-times`,
|
|
@@ -5130,7 +6963,7 @@ var ShippingService = class {
|
|
|
5130
6963
|
});
|
|
5131
6964
|
}
|
|
5132
6965
|
/** Retrieve one delivery time. */
|
|
5133
|
-
async getDeliveryTime(deliveryTimeId, auth2 =
|
|
6966
|
+
async getDeliveryTime(deliveryTimeId, auth2 = SERVICE25) {
|
|
5134
6967
|
return this.ctx.http.request({
|
|
5135
6968
|
method: "GET",
|
|
5136
6969
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
@@ -5138,7 +6971,7 @@ var ShippingService = class {
|
|
|
5138
6971
|
});
|
|
5139
6972
|
}
|
|
5140
6973
|
/** Create a delivery time. */
|
|
5141
|
-
async createDeliveryTime(input, auth2 =
|
|
6974
|
+
async createDeliveryTime(input, auth2 = SERVICE25) {
|
|
5142
6975
|
return this.ctx.http.request({
|
|
5143
6976
|
method: "POST",
|
|
5144
6977
|
path: `${this.base()}/delivery-times`,
|
|
@@ -5147,7 +6980,7 @@ var ShippingService = class {
|
|
|
5147
6980
|
});
|
|
5148
6981
|
}
|
|
5149
6982
|
/** Create multiple delivery times (`POST /delivery-times/bulk`). */
|
|
5150
|
-
async createDeliveryTimesBulk(inputs, auth2 =
|
|
6983
|
+
async createDeliveryTimesBulk(inputs, auth2 = SERVICE25) {
|
|
5151
6984
|
return this.ctx.http.request({
|
|
5152
6985
|
method: "POST",
|
|
5153
6986
|
path: `${this.base()}/delivery-times/bulk`,
|
|
@@ -5156,7 +6989,7 @@ var ShippingService = class {
|
|
|
5156
6989
|
});
|
|
5157
6990
|
}
|
|
5158
6991
|
/** Replace a delivery time. */
|
|
5159
|
-
async updateDeliveryTime(deliveryTimeId, input, auth2 =
|
|
6992
|
+
async updateDeliveryTime(deliveryTimeId, input, auth2 = SERVICE25) {
|
|
5160
6993
|
await this.ctx.http.request({
|
|
5161
6994
|
method: "PUT",
|
|
5162
6995
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
@@ -5165,7 +6998,7 @@ var ShippingService = class {
|
|
|
5165
6998
|
});
|
|
5166
6999
|
}
|
|
5167
7000
|
/** Partially update a delivery time (JSON-Patch op array). */
|
|
5168
|
-
async patchDeliveryTime(deliveryTimeId, ops, auth2 =
|
|
7001
|
+
async patchDeliveryTime(deliveryTimeId, ops, auth2 = SERVICE25) {
|
|
5169
7002
|
await this.ctx.http.request({
|
|
5170
7003
|
method: "PATCH",
|
|
5171
7004
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
@@ -5174,7 +7007,7 @@ var ShippingService = class {
|
|
|
5174
7007
|
});
|
|
5175
7008
|
}
|
|
5176
7009
|
/** Delete a delivery time. */
|
|
5177
|
-
async deleteDeliveryTime(deliveryTimeId, auth2 =
|
|
7010
|
+
async deleteDeliveryTime(deliveryTimeId, auth2 = SERVICE25) {
|
|
5178
7011
|
await this.ctx.http.request({
|
|
5179
7012
|
method: "DELETE",
|
|
5180
7013
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
@@ -5183,7 +7016,7 @@ var ShippingService = class {
|
|
|
5183
7016
|
}
|
|
5184
7017
|
// --- Phase 2: delivery time slots ---
|
|
5185
7018
|
/** List slots of a delivery time. */
|
|
5186
|
-
async listSlots(deliveryTimeId, auth2 =
|
|
7019
|
+
async listSlots(deliveryTimeId, auth2 = SERVICE25) {
|
|
5187
7020
|
return this.ctx.http.request({
|
|
5188
7021
|
method: "GET",
|
|
5189
7022
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots`,
|
|
@@ -5191,7 +7024,7 @@ var ShippingService = class {
|
|
|
5191
7024
|
});
|
|
5192
7025
|
}
|
|
5193
7026
|
/** Retrieve one slot. */
|
|
5194
|
-
async getSlot(deliveryTimeId, slotId, auth2 =
|
|
7027
|
+
async getSlot(deliveryTimeId, slotId, auth2 = SERVICE25) {
|
|
5195
7028
|
return this.ctx.http.request({
|
|
5196
7029
|
method: "GET",
|
|
5197
7030
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
@@ -5199,7 +7032,7 @@ var ShippingService = class {
|
|
|
5199
7032
|
});
|
|
5200
7033
|
}
|
|
5201
7034
|
/** Create a slot in a delivery time. */
|
|
5202
|
-
async createSlot(deliveryTimeId, input, auth2 =
|
|
7035
|
+
async createSlot(deliveryTimeId, input, auth2 = SERVICE25) {
|
|
5203
7036
|
return this.ctx.http.request({
|
|
5204
7037
|
method: "POST",
|
|
5205
7038
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots`,
|
|
@@ -5208,7 +7041,7 @@ var ShippingService = class {
|
|
|
5208
7041
|
});
|
|
5209
7042
|
}
|
|
5210
7043
|
/** Replace a slot. */
|
|
5211
|
-
async updateSlot(deliveryTimeId, slotId, input, auth2 =
|
|
7044
|
+
async updateSlot(deliveryTimeId, slotId, input, auth2 = SERVICE25) {
|
|
5212
7045
|
await this.ctx.http.request({
|
|
5213
7046
|
method: "PUT",
|
|
5214
7047
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
@@ -5217,7 +7050,7 @@ var ShippingService = class {
|
|
|
5217
7050
|
});
|
|
5218
7051
|
}
|
|
5219
7052
|
/** Partially update a slot (JSON-Patch op array). */
|
|
5220
|
-
async patchSlot(deliveryTimeId, slotId, ops, auth2 =
|
|
7053
|
+
async patchSlot(deliveryTimeId, slotId, ops, auth2 = SERVICE25) {
|
|
5221
7054
|
await this.ctx.http.request({
|
|
5222
7055
|
method: "PATCH",
|
|
5223
7056
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
@@ -5226,7 +7059,7 @@ var ShippingService = class {
|
|
|
5226
7059
|
});
|
|
5227
7060
|
}
|
|
5228
7061
|
/** Delete a slot. */
|
|
5229
|
-
async deleteSlot(deliveryTimeId, slotId, auth2 =
|
|
7062
|
+
async deleteSlot(deliveryTimeId, slotId, auth2 = SERVICE25) {
|
|
5230
7063
|
await this.ctx.http.request({
|
|
5231
7064
|
method: "DELETE",
|
|
5232
7065
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
@@ -5234,7 +7067,7 @@ var ShippingService = class {
|
|
|
5234
7067
|
});
|
|
5235
7068
|
}
|
|
5236
7069
|
/** Delete all slots of a delivery time. */
|
|
5237
|
-
async deleteAllSlots(deliveryTimeId, auth2 =
|
|
7070
|
+
async deleteAllSlots(deliveryTimeId, auth2 = SERVICE25) {
|
|
5238
7071
|
await this.ctx.http.request({
|
|
5239
7072
|
method: "DELETE",
|
|
5240
7073
|
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots`,
|
|
@@ -5243,7 +7076,7 @@ var ShippingService = class {
|
|
|
5243
7076
|
}
|
|
5244
7077
|
// --- Phase 2: delivery cycles ---
|
|
5245
7078
|
/** Generate a delivery cycle (`POST /delivery-cycles/generate`). Returns the cycle id. */
|
|
5246
|
-
async generateDeliveryCycle(input, auth2 =
|
|
7079
|
+
async generateDeliveryCycle(input, auth2 = SERVICE25) {
|
|
5247
7080
|
return this.ctx.http.request({
|
|
5248
7081
|
method: "POST",
|
|
5249
7082
|
path: `${this.base()}/delivery-cycles/generate`,
|
|
@@ -5254,7 +7087,7 @@ var ShippingService = class {
|
|
|
5254
7087
|
};
|
|
5255
7088
|
|
|
5256
7089
|
// src/services/invoice.ts
|
|
5257
|
-
var
|
|
7090
|
+
var SERVICE26 = { kind: "service" };
|
|
5258
7091
|
var InvoiceService = class {
|
|
5259
7092
|
constructor(ctx) {
|
|
5260
7093
|
this.ctx = ctx;
|
|
@@ -5265,7 +7098,7 @@ var InvoiceService = class {
|
|
|
5265
7098
|
return `/invoice/${this.ctx.tenant}/jobs/invoices`;
|
|
5266
7099
|
}
|
|
5267
7100
|
/** Create an invoice-generation job (`POST …/jobs/invoices`, 201). */
|
|
5268
|
-
async createJob(draft, auth2 =
|
|
7101
|
+
async createJob(draft, auth2 = SERVICE26) {
|
|
5269
7102
|
return this.ctx.http.request({
|
|
5270
7103
|
method: "POST",
|
|
5271
7104
|
path: this.base(),
|
|
@@ -5274,7 +7107,7 @@ var InvoiceService = class {
|
|
|
5274
7107
|
});
|
|
5275
7108
|
}
|
|
5276
7109
|
/** Retrieve a job and its per-order results (`GET …/jobs/invoices/{jobId}`). */
|
|
5277
|
-
async getJob(jobId, auth2 =
|
|
7110
|
+
async getJob(jobId, auth2 = SERVICE26) {
|
|
5278
7111
|
return this.ctx.http.request({
|
|
5279
7112
|
method: "GET",
|
|
5280
7113
|
path: `${this.base()}/${encodeURIComponent(jobId)}`,
|
|
@@ -5429,7 +7262,7 @@ var QuoteReasonsResource = class {
|
|
|
5429
7262
|
};
|
|
5430
7263
|
|
|
5431
7264
|
// src/services/returns.ts
|
|
5432
|
-
var
|
|
7265
|
+
var SERVICE27 = { kind: "service" };
|
|
5433
7266
|
var ReturnsService = class {
|
|
5434
7267
|
constructor(ctx) {
|
|
5435
7268
|
this.ctx = ctx;
|
|
@@ -5440,7 +7273,7 @@ var ReturnsService = class {
|
|
|
5440
7273
|
return `/return/${this.ctx.tenant}/returns`;
|
|
5441
7274
|
}
|
|
5442
7275
|
/** List returns (paged; supports `pageSize`/`pageNumber`/`sort`/`q`). */
|
|
5443
|
-
async listReturns(query = {}, auth2 =
|
|
7276
|
+
async listReturns(query = {}, auth2 = SERVICE27) {
|
|
5444
7277
|
return this.ctx.http.request({
|
|
5445
7278
|
method: "GET",
|
|
5446
7279
|
path: this.base(),
|
|
@@ -5449,7 +7282,7 @@ var ReturnsService = class {
|
|
|
5449
7282
|
});
|
|
5450
7283
|
}
|
|
5451
7284
|
/** Retrieve one return by id. */
|
|
5452
|
-
async getReturn(returnId, auth2 =
|
|
7285
|
+
async getReturn(returnId, auth2 = SERVICE27) {
|
|
5453
7286
|
return this.ctx.http.request({
|
|
5454
7287
|
method: "GET",
|
|
5455
7288
|
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
@@ -5457,7 +7290,7 @@ var ReturnsService = class {
|
|
|
5457
7290
|
});
|
|
5458
7291
|
}
|
|
5459
7292
|
/** Create a return. Returns the created `{ id }`. */
|
|
5460
|
-
async createReturn(input, auth2 =
|
|
7293
|
+
async createReturn(input, auth2 = SERVICE27) {
|
|
5461
7294
|
return this.ctx.http.request({
|
|
5462
7295
|
method: "POST",
|
|
5463
7296
|
path: this.base(),
|
|
@@ -5466,7 +7299,7 @@ var ReturnsService = class {
|
|
|
5466
7299
|
});
|
|
5467
7300
|
}
|
|
5468
7301
|
/** Replace a return by id (`PUT`). */
|
|
5469
|
-
async updateReturn(returnId, input, auth2 =
|
|
7302
|
+
async updateReturn(returnId, input, auth2 = SERVICE27) {
|
|
5470
7303
|
await this.ctx.http.request({
|
|
5471
7304
|
method: "PUT",
|
|
5472
7305
|
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
@@ -5475,7 +7308,7 @@ var ReturnsService = class {
|
|
|
5475
7308
|
});
|
|
5476
7309
|
}
|
|
5477
7310
|
/** Partially update a return by id (`PATCH`, JSON-Patch op-array). */
|
|
5478
|
-
async patchReturn(returnId, ops, auth2 =
|
|
7311
|
+
async patchReturn(returnId, ops, auth2 = SERVICE27) {
|
|
5479
7312
|
await this.ctx.http.request({
|
|
5480
7313
|
method: "PATCH",
|
|
5481
7314
|
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
@@ -5484,7 +7317,7 @@ var ReturnsService = class {
|
|
|
5484
7317
|
});
|
|
5485
7318
|
}
|
|
5486
7319
|
/** Delete a return by id. */
|
|
5487
|
-
async deleteReturn(returnId, auth2 =
|
|
7320
|
+
async deleteReturn(returnId, auth2 = SERVICE27) {
|
|
5488
7321
|
await this.ctx.http.request({
|
|
5489
7322
|
method: "DELETE",
|
|
5490
7323
|
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
@@ -5494,7 +7327,7 @@ var ReturnsService = class {
|
|
|
5494
7327
|
};
|
|
5495
7328
|
|
|
5496
7329
|
// src/services/sepa-export.ts
|
|
5497
|
-
var
|
|
7330
|
+
var SERVICE28 = { kind: "service" };
|
|
5498
7331
|
var SepaExportService = class {
|
|
5499
7332
|
constructor(ctx) {
|
|
5500
7333
|
this.ctx = ctx;
|
|
@@ -5505,7 +7338,7 @@ var SepaExportService = class {
|
|
|
5505
7338
|
return `/sepa-export/${this.ctx.tenant}`;
|
|
5506
7339
|
}
|
|
5507
7340
|
/** Retrieve a SEPA export file by id. Returns the raw file content (text). */
|
|
5508
|
-
async getFile(fileId, auth2 =
|
|
7341
|
+
async getFile(fileId, auth2 = SERVICE28) {
|
|
5509
7342
|
const path = `${this.base()}/files/${encodeURIComponent(fileId)}`;
|
|
5510
7343
|
const res = await this.ctx.http.requestRaw({ method: "GET", path, auth: auth2 });
|
|
5511
7344
|
if (!res.ok) {
|
|
@@ -5515,7 +7348,7 @@ var SepaExportService = class {
|
|
|
5515
7348
|
return res.text();
|
|
5516
7349
|
}
|
|
5517
7350
|
/** List export jobs. */
|
|
5518
|
-
async listJobs(query = {}, auth2 =
|
|
7351
|
+
async listJobs(query = {}, auth2 = SERVICE28) {
|
|
5519
7352
|
return this.ctx.http.request({
|
|
5520
7353
|
method: "GET",
|
|
5521
7354
|
path: `${this.base()}/jobs`,
|
|
@@ -5524,7 +7357,7 @@ var SepaExportService = class {
|
|
|
5524
7357
|
});
|
|
5525
7358
|
}
|
|
5526
7359
|
/** Create an export job. */
|
|
5527
|
-
async createJob(input, auth2 =
|
|
7360
|
+
async createJob(input, auth2 = SERVICE28) {
|
|
5528
7361
|
return this.ctx.http.request({
|
|
5529
7362
|
method: "POST",
|
|
5530
7363
|
path: `${this.base()}/jobs`,
|
|
@@ -5535,7 +7368,7 @@ var SepaExportService = class {
|
|
|
5535
7368
|
};
|
|
5536
7369
|
|
|
5537
7370
|
// src/services/indexing.ts
|
|
5538
|
-
var
|
|
7371
|
+
var SERVICE29 = { kind: "service" };
|
|
5539
7372
|
var IndexingService = class {
|
|
5540
7373
|
constructor(ctx) {
|
|
5541
7374
|
this.ctx = ctx;
|
|
@@ -5546,11 +7379,11 @@ var IndexingService = class {
|
|
|
5546
7379
|
return `/indexing/${this.ctx.tenant}`;
|
|
5547
7380
|
}
|
|
5548
7381
|
/** List indexing configurations. */
|
|
5549
|
-
async listConfigurations(auth2 =
|
|
7382
|
+
async listConfigurations(auth2 = SERVICE29) {
|
|
5550
7383
|
return this.ctx.http.request({ method: "GET", path: `${this.base()}/configurations`, auth: auth2 });
|
|
5551
7384
|
}
|
|
5552
7385
|
/** Get a configuration by provider name. */
|
|
5553
|
-
async getConfiguration(provider, auth2 =
|
|
7386
|
+
async getConfiguration(provider, auth2 = SERVICE29) {
|
|
5554
7387
|
return this.ctx.http.request({
|
|
5555
7388
|
method: "GET",
|
|
5556
7389
|
path: `${this.base()}/configurations/${encodeURIComponent(provider)}`,
|
|
@@ -5558,7 +7391,7 @@ var IndexingService = class {
|
|
|
5558
7391
|
});
|
|
5559
7392
|
}
|
|
5560
7393
|
/** Create a configuration. */
|
|
5561
|
-
async createConfiguration(input, auth2 =
|
|
7394
|
+
async createConfiguration(input, auth2 = SERVICE29) {
|
|
5562
7395
|
return this.ctx.http.request({
|
|
5563
7396
|
method: "POST",
|
|
5564
7397
|
path: `${this.base()}/configurations`,
|
|
@@ -5567,7 +7400,7 @@ var IndexingService = class {
|
|
|
5567
7400
|
});
|
|
5568
7401
|
}
|
|
5569
7402
|
/** Update a configuration by provider name. */
|
|
5570
|
-
async updateConfiguration(provider, input, auth2 =
|
|
7403
|
+
async updateConfiguration(provider, input, auth2 = SERVICE29) {
|
|
5571
7404
|
await this.ctx.http.request({
|
|
5572
7405
|
method: "PUT",
|
|
5573
7406
|
path: `${this.base()}/configurations/${encodeURIComponent(provider)}`,
|
|
@@ -5576,7 +7409,7 @@ var IndexingService = class {
|
|
|
5576
7409
|
});
|
|
5577
7410
|
}
|
|
5578
7411
|
/** Delete a configuration by provider name. */
|
|
5579
|
-
async deleteConfiguration(provider, auth2 =
|
|
7412
|
+
async deleteConfiguration(provider, auth2 = SERVICE29) {
|
|
5580
7413
|
await this.ctx.http.request({
|
|
5581
7414
|
method: "DELETE",
|
|
5582
7415
|
path: `${this.base()}/configurations/${encodeURIComponent(provider)}`,
|
|
@@ -5584,11 +7417,11 @@ var IndexingService = class {
|
|
|
5584
7417
|
});
|
|
5585
7418
|
}
|
|
5586
7419
|
/** List public indexing configurations. */
|
|
5587
|
-
async listPublicConfigurations(auth2 =
|
|
7420
|
+
async listPublicConfigurations(auth2 = SERVICE29) {
|
|
5588
7421
|
return this.ctx.http.request({ method: "GET", path: `${this.base()}/public/configurations`, auth: auth2 });
|
|
5589
7422
|
}
|
|
5590
7423
|
/** Get a public configuration by provider name. */
|
|
5591
|
-
async getPublicConfiguration(provider, auth2 =
|
|
7424
|
+
async getPublicConfiguration(provider, auth2 = SERVICE29) {
|
|
5592
7425
|
return this.ctx.http.request({
|
|
5593
7426
|
method: "GET",
|
|
5594
7427
|
path: `${this.base()}/public/configurations/${encodeURIComponent(provider)}`,
|
|
@@ -5601,7 +7434,7 @@ var IndexingService = class {
|
|
|
5601
7434
|
* (PRODUCT only). Resolves to the created job (`201`) or, when a job for that
|
|
5602
7435
|
* `entityType` is already `IN_PROGRESS`, that running job (`200`).
|
|
5603
7436
|
*/
|
|
5604
|
-
async createReindexJob(input, auth2 =
|
|
7437
|
+
async createReindexJob(input, auth2 = SERVICE29) {
|
|
5605
7438
|
return this.ctx.http.request({
|
|
5606
7439
|
method: "POST",
|
|
5607
7440
|
path: `${this.base()}/reindex-jobs`,
|
|
@@ -5610,7 +7443,7 @@ var IndexingService = class {
|
|
|
5610
7443
|
});
|
|
5611
7444
|
}
|
|
5612
7445
|
/** List reindex jobs (paginated). */
|
|
5613
|
-
async listReindexJobs(opts = {}, auth2 =
|
|
7446
|
+
async listReindexJobs(opts = {}, auth2 = SERVICE29) {
|
|
5614
7447
|
const pageNumber = opts.pageNumber ?? 1;
|
|
5615
7448
|
const pageSize = opts.pageSize ?? 50;
|
|
5616
7449
|
const query = { pageNumber, pageSize };
|
|
@@ -5624,7 +7457,7 @@ var IndexingService = class {
|
|
|
5624
7457
|
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
5625
7458
|
}
|
|
5626
7459
|
/** Fetch one reindex job by id. */
|
|
5627
|
-
async getReindexJob(reindexJobId, auth2 =
|
|
7460
|
+
async getReindexJob(reindexJobId, auth2 = SERVICE29) {
|
|
5628
7461
|
return this.ctx.http.request({
|
|
5629
7462
|
method: "GET",
|
|
5630
7463
|
path: `${this.base()}/reindex-jobs/${encodeURIComponent(reindexJobId)}`,
|
|
@@ -5636,13 +7469,13 @@ var IndexingService = class {
|
|
|
5636
7469
|
* @deprecated since 2026-06-18, removal 2026-12-01 — use {@link createReindexJob}
|
|
5637
7470
|
* (`createReindexJob({ entityType: "PRODUCT" })`), which returns a trackable job.
|
|
5638
7471
|
*/
|
|
5639
|
-
async reindex(input, auth2 =
|
|
7472
|
+
async reindex(input, auth2 = SERVICE29) {
|
|
5640
7473
|
await this.ctx.http.request({ method: "POST", path: `${this.base()}/reindex`, auth: auth2, body: input });
|
|
5641
7474
|
}
|
|
5642
7475
|
};
|
|
5643
7476
|
|
|
5644
7477
|
// src/services/unit-handling.ts
|
|
5645
|
-
var
|
|
7478
|
+
var SERVICE30 = { kind: "service" };
|
|
5646
7479
|
var UnitHandlingService = class {
|
|
5647
7480
|
constructor(ctx) {
|
|
5648
7481
|
this.ctx = ctx;
|
|
@@ -5653,7 +7486,7 @@ var UnitHandlingService = class {
|
|
|
5653
7486
|
return `/unit-handling/${this.ctx.tenant}`;
|
|
5654
7487
|
}
|
|
5655
7488
|
/** Find units (filter/sort/page). */
|
|
5656
|
-
async listUnits(query = {}, auth2 =
|
|
7489
|
+
async listUnits(query = {}, auth2 = SERVICE30) {
|
|
5657
7490
|
return this.ctx.http.request({
|
|
5658
7491
|
method: "GET",
|
|
5659
7492
|
path: `${this.base()}/units`,
|
|
@@ -5662,7 +7495,7 @@ var UnitHandlingService = class {
|
|
|
5662
7495
|
});
|
|
5663
7496
|
}
|
|
5664
7497
|
/** Retrieve a unit by code. */
|
|
5665
|
-
async getUnit(unitCode, auth2 =
|
|
7498
|
+
async getUnit(unitCode, auth2 = SERVICE30) {
|
|
5666
7499
|
return this.ctx.http.request({
|
|
5667
7500
|
method: "GET",
|
|
5668
7501
|
path: `${this.base()}/units/${encodeURIComponent(unitCode)}`,
|
|
@@ -5670,11 +7503,11 @@ var UnitHandlingService = class {
|
|
|
5670
7503
|
});
|
|
5671
7504
|
}
|
|
5672
7505
|
/** Add a new unit. */
|
|
5673
|
-
async createUnit(input, auth2 =
|
|
7506
|
+
async createUnit(input, auth2 = SERVICE30) {
|
|
5674
7507
|
return this.ctx.http.request({ method: "POST", path: `${this.base()}/units`, auth: auth2, body: input });
|
|
5675
7508
|
}
|
|
5676
7509
|
/** Update a unit by code. */
|
|
5677
|
-
async updateUnit(unitCode, input, auth2 =
|
|
7510
|
+
async updateUnit(unitCode, input, auth2 = SERVICE30) {
|
|
5678
7511
|
await this.ctx.http.request({
|
|
5679
7512
|
method: "PUT",
|
|
5680
7513
|
path: `${this.base()}/units/${encodeURIComponent(unitCode)}`,
|
|
@@ -5683,7 +7516,7 @@ var UnitHandlingService = class {
|
|
|
5683
7516
|
});
|
|
5684
7517
|
}
|
|
5685
7518
|
/** Delete a unit by code. */
|
|
5686
|
-
async deleteUnit(unitCode, auth2 =
|
|
7519
|
+
async deleteUnit(unitCode, auth2 = SERVICE30) {
|
|
5687
7520
|
await this.ctx.http.request({
|
|
5688
7521
|
method: "DELETE",
|
|
5689
7522
|
path: `${this.base()}/units/${encodeURIComponent(unitCode)}`,
|
|
@@ -5691,7 +7524,7 @@ var UnitHandlingService = class {
|
|
|
5691
7524
|
});
|
|
5692
7525
|
}
|
|
5693
7526
|
/** Delete multiple units by code (bulk). The codes are sent as the request body. */
|
|
5694
|
-
async deleteUnits(codes, auth2 =
|
|
7527
|
+
async deleteUnits(codes, auth2 = SERVICE30) {
|
|
5695
7528
|
await this.ctx.http.request({
|
|
5696
7529
|
method: "DELETE",
|
|
5697
7530
|
path: `${this.base()}/units`,
|
|
@@ -5700,7 +7533,7 @@ var UnitHandlingService = class {
|
|
|
5700
7533
|
});
|
|
5701
7534
|
}
|
|
5702
7535
|
/** Fetch a conversion factor (`PUT /units/conversion-factor-commands`). */
|
|
5703
|
-
async getConversionFactor(input, auth2 =
|
|
7536
|
+
async getConversionFactor(input, auth2 = SERVICE30) {
|
|
5704
7537
|
return this.ctx.http.request({
|
|
5705
7538
|
method: "PUT",
|
|
5706
7539
|
path: `${this.base()}/units/conversion-factor-commands`,
|
|
@@ -5709,7 +7542,7 @@ var UnitHandlingService = class {
|
|
|
5709
7542
|
});
|
|
5710
7543
|
}
|
|
5711
7544
|
/** Convert a value between units (`PUT /units/convert-unit-commands`). */
|
|
5712
|
-
async convertUnit(input, auth2 =
|
|
7545
|
+
async convertUnit(input, auth2 = SERVICE30) {
|
|
5713
7546
|
return this.ctx.http.request({
|
|
5714
7547
|
method: "PUT",
|
|
5715
7548
|
path: `${this.base()}/units/convert-unit-commands`,
|
|
@@ -5718,13 +7551,13 @@ var UnitHandlingService = class {
|
|
|
5718
7551
|
});
|
|
5719
7552
|
}
|
|
5720
7553
|
/** List all unit types. */
|
|
5721
|
-
async listUnitTypes(auth2 =
|
|
7554
|
+
async listUnitTypes(auth2 = SERVICE30) {
|
|
5722
7555
|
return this.ctx.http.request({ method: "GET", path: `${this.base()}/types`, auth: auth2 });
|
|
5723
7556
|
}
|
|
5724
7557
|
};
|
|
5725
7558
|
|
|
5726
7559
|
// src/services/catalog.ts
|
|
5727
|
-
var
|
|
7560
|
+
var SERVICE31 = { kind: "service" };
|
|
5728
7561
|
var CatalogService = class {
|
|
5729
7562
|
constructor(ctx) {
|
|
5730
7563
|
this.ctx = ctx;
|
|
@@ -5735,7 +7568,7 @@ var CatalogService = class {
|
|
|
5735
7568
|
return `/catalog/${this.ctx.tenant}/catalogs`;
|
|
5736
7569
|
}
|
|
5737
7570
|
/** List catalogs (filtered/sorted). */
|
|
5738
|
-
async listCatalogs(query = {}, auth2 =
|
|
7571
|
+
async listCatalogs(query = {}, auth2 = SERVICE31) {
|
|
5739
7572
|
return this.ctx.http.request({
|
|
5740
7573
|
method: "GET",
|
|
5741
7574
|
path: this.base(),
|
|
@@ -5744,7 +7577,7 @@ var CatalogService = class {
|
|
|
5744
7577
|
});
|
|
5745
7578
|
}
|
|
5746
7579
|
/** Retrieve a catalog by id. */
|
|
5747
|
-
async getCatalog(catalogId, auth2 =
|
|
7580
|
+
async getCatalog(catalogId, auth2 = SERVICE31) {
|
|
5748
7581
|
return this.ctx.http.request({
|
|
5749
7582
|
method: "GET",
|
|
5750
7583
|
path: `${this.base()}/${encodeURIComponent(catalogId)}`,
|
|
@@ -5752,7 +7585,7 @@ var CatalogService = class {
|
|
|
5752
7585
|
});
|
|
5753
7586
|
}
|
|
5754
7587
|
/** Retrieve all catalogs that contain a category. */
|
|
5755
|
-
async getCatalogsForCategory(categoryId, auth2 =
|
|
7588
|
+
async getCatalogsForCategory(categoryId, auth2 = SERVICE31) {
|
|
5756
7589
|
return this.ctx.http.request({
|
|
5757
7590
|
method: "GET",
|
|
5758
7591
|
path: `${this.base()}/categories/${encodeURIComponent(categoryId)}`,
|
|
@@ -5760,11 +7593,11 @@ var CatalogService = class {
|
|
|
5760
7593
|
});
|
|
5761
7594
|
}
|
|
5762
7595
|
/** Create a catalog. */
|
|
5763
|
-
async createCatalog(input, auth2 =
|
|
7596
|
+
async createCatalog(input, auth2 = SERVICE31) {
|
|
5764
7597
|
return this.ctx.http.request({ method: "POST", path: this.base(), auth: auth2, body: input });
|
|
5765
7598
|
}
|
|
5766
7599
|
/** Upsert a catalog by id (`PUT`). */
|
|
5767
|
-
async updateCatalog(catalogId, input, auth2 =
|
|
7600
|
+
async updateCatalog(catalogId, input, auth2 = SERVICE31) {
|
|
5768
7601
|
return this.ctx.http.request({
|
|
5769
7602
|
method: "PUT",
|
|
5770
7603
|
path: `${this.base()}/${encodeURIComponent(catalogId)}`,
|
|
@@ -5773,7 +7606,7 @@ var CatalogService = class {
|
|
|
5773
7606
|
});
|
|
5774
7607
|
}
|
|
5775
7608
|
/** Partially update a catalog by id (`PATCH`). */
|
|
5776
|
-
async patchCatalog(catalogId, patch, auth2 =
|
|
7609
|
+
async patchCatalog(catalogId, patch, auth2 = SERVICE31) {
|
|
5777
7610
|
await this.ctx.http.request({
|
|
5778
7611
|
method: "PATCH",
|
|
5779
7612
|
path: `${this.base()}/${encodeURIComponent(catalogId)}`,
|
|
@@ -5782,7 +7615,7 @@ var CatalogService = class {
|
|
|
5782
7615
|
});
|
|
5783
7616
|
}
|
|
5784
7617
|
/** Remove a catalog by id. */
|
|
5785
|
-
async deleteCatalog(catalogId, auth2 =
|
|
7618
|
+
async deleteCatalog(catalogId, auth2 = SERVICE31) {
|
|
5786
7619
|
await this.ctx.http.request({
|
|
5787
7620
|
method: "DELETE",
|
|
5788
7621
|
path: `${this.base()}/${encodeURIComponent(catalogId)}`,
|
|
@@ -5792,7 +7625,7 @@ var CatalogService = class {
|
|
|
5792
7625
|
};
|
|
5793
7626
|
|
|
5794
7627
|
// src/services/vendor.ts
|
|
5795
|
-
var
|
|
7628
|
+
var SERVICE32 = { kind: "service" };
|
|
5796
7629
|
var VendorService = class {
|
|
5797
7630
|
constructor(ctx) {
|
|
5798
7631
|
this.ctx = ctx;
|
|
@@ -5804,7 +7637,7 @@ var VendorService = class {
|
|
|
5804
7637
|
}
|
|
5805
7638
|
// --- Vendors ---
|
|
5806
7639
|
/** List all vendors. */
|
|
5807
|
-
async listVendors(query = {}, auth2 =
|
|
7640
|
+
async listVendors(query = {}, auth2 = SERVICE32) {
|
|
5808
7641
|
return this.ctx.http.request({
|
|
5809
7642
|
method: "GET",
|
|
5810
7643
|
path: `${this.base()}/vendors`,
|
|
@@ -5813,7 +7646,7 @@ var VendorService = class {
|
|
|
5813
7646
|
});
|
|
5814
7647
|
}
|
|
5815
7648
|
/** Retrieve a vendor by id. */
|
|
5816
|
-
async getVendor(vendorId, auth2 =
|
|
7649
|
+
async getVendor(vendorId, auth2 = SERVICE32) {
|
|
5817
7650
|
return this.ctx.http.request({
|
|
5818
7651
|
method: "GET",
|
|
5819
7652
|
path: `${this.base()}/vendors/${encodeURIComponent(vendorId)}`,
|
|
@@ -5821,7 +7654,7 @@ var VendorService = class {
|
|
|
5821
7654
|
});
|
|
5822
7655
|
}
|
|
5823
7656
|
/** Search vendors (`POST /vendors/search`). A built filter in `q` is resolved to a string. */
|
|
5824
|
-
async searchVendors(query, auth2 =
|
|
7657
|
+
async searchVendors(query, auth2 = SERVICE32) {
|
|
5825
7658
|
const body = query.q !== void 0 ? { ...query, q: resolveQuery(query.q, { compoundLogicalQuery: false }) } : query;
|
|
5826
7659
|
return this.ctx.http.request({
|
|
5827
7660
|
method: "POST",
|
|
@@ -5831,11 +7664,11 @@ var VendorService = class {
|
|
|
5831
7664
|
});
|
|
5832
7665
|
}
|
|
5833
7666
|
/** Create a vendor. */
|
|
5834
|
-
async createVendor(input, auth2 =
|
|
7667
|
+
async createVendor(input, auth2 = SERVICE32) {
|
|
5835
7668
|
return this.ctx.http.request({ method: "POST", path: `${this.base()}/vendors`, auth: auth2, body: input });
|
|
5836
7669
|
}
|
|
5837
7670
|
/** Upsert a vendor by id (`PUT`). */
|
|
5838
|
-
async updateVendor(vendorId, input, auth2 =
|
|
7671
|
+
async updateVendor(vendorId, input, auth2 = SERVICE32) {
|
|
5839
7672
|
await this.ctx.http.request({
|
|
5840
7673
|
method: "PUT",
|
|
5841
7674
|
path: `${this.base()}/vendors/${encodeURIComponent(vendorId)}`,
|
|
@@ -5844,7 +7677,7 @@ var VendorService = class {
|
|
|
5844
7677
|
});
|
|
5845
7678
|
}
|
|
5846
7679
|
/** Delete a vendor by id. */
|
|
5847
|
-
async deleteVendor(vendorId, auth2 =
|
|
7680
|
+
async deleteVendor(vendorId, auth2 = SERVICE32) {
|
|
5848
7681
|
await this.ctx.http.request({
|
|
5849
7682
|
method: "DELETE",
|
|
5850
7683
|
path: `${this.base()}/vendors/${encodeURIComponent(vendorId)}`,
|
|
@@ -5853,7 +7686,7 @@ var VendorService = class {
|
|
|
5853
7686
|
}
|
|
5854
7687
|
// --- Vendor locations ---
|
|
5855
7688
|
/** List all vendor locations. */
|
|
5856
|
-
async listVendorLocations(query = {}, auth2 =
|
|
7689
|
+
async listVendorLocations(query = {}, auth2 = SERVICE32) {
|
|
5857
7690
|
return this.ctx.http.request({
|
|
5858
7691
|
method: "GET",
|
|
5859
7692
|
path: `${this.base()}/locations`,
|
|
@@ -5862,7 +7695,7 @@ var VendorService = class {
|
|
|
5862
7695
|
});
|
|
5863
7696
|
}
|
|
5864
7697
|
/** Retrieve a vendor location by id. */
|
|
5865
|
-
async getVendorLocation(locationId, auth2 =
|
|
7698
|
+
async getVendorLocation(locationId, auth2 = SERVICE32) {
|
|
5866
7699
|
return this.ctx.http.request({
|
|
5867
7700
|
method: "GET",
|
|
5868
7701
|
path: `${this.base()}/locations/${encodeURIComponent(locationId)}`,
|
|
@@ -5870,11 +7703,11 @@ var VendorService = class {
|
|
|
5870
7703
|
});
|
|
5871
7704
|
}
|
|
5872
7705
|
/** Create a vendor location. */
|
|
5873
|
-
async createVendorLocation(input, auth2 =
|
|
7706
|
+
async createVendorLocation(input, auth2 = SERVICE32) {
|
|
5874
7707
|
return this.ctx.http.request({ method: "POST", path: `${this.base()}/locations`, auth: auth2, body: input });
|
|
5875
7708
|
}
|
|
5876
7709
|
/** Upsert a vendor location by id (`PUT`). */
|
|
5877
|
-
async updateVendorLocation(locationId, input, auth2 =
|
|
7710
|
+
async updateVendorLocation(locationId, input, auth2 = SERVICE32) {
|
|
5878
7711
|
await this.ctx.http.request({
|
|
5879
7712
|
method: "PUT",
|
|
5880
7713
|
path: `${this.base()}/locations/${encodeURIComponent(locationId)}`,
|
|
@@ -5883,7 +7716,7 @@ var VendorService = class {
|
|
|
5883
7716
|
});
|
|
5884
7717
|
}
|
|
5885
7718
|
/** Delete a vendor location by id. */
|
|
5886
|
-
async deleteVendorLocation(locationId, auth2 =
|
|
7719
|
+
async deleteVendorLocation(locationId, auth2 = SERVICE32) {
|
|
5887
7720
|
await this.ctx.http.request({
|
|
5888
7721
|
method: "DELETE",
|
|
5889
7722
|
path: `${this.base()}/locations/${encodeURIComponent(locationId)}`,
|
|
@@ -5893,7 +7726,7 @@ var VendorService = class {
|
|
|
5893
7726
|
};
|
|
5894
7727
|
|
|
5895
7728
|
// src/services/pick-pack.ts
|
|
5896
|
-
var
|
|
7729
|
+
var SERVICE33 = { kind: "service" };
|
|
5897
7730
|
var PickPackService = class {
|
|
5898
7731
|
constructor(ctx) {
|
|
5899
7732
|
this.ctx = ctx;
|
|
@@ -5907,7 +7740,7 @@ var PickPackService = class {
|
|
|
5907
7740
|
return `${this.base()}/orders/${encodeURIComponent(orderId)}`;
|
|
5908
7741
|
}
|
|
5909
7742
|
/** List packlist orders. */
|
|
5910
|
-
async listOrders(query = {}, auth2 =
|
|
7743
|
+
async listOrders(query = {}, auth2 = SERVICE33) {
|
|
5911
7744
|
return this.ctx.http.request({
|
|
5912
7745
|
method: "GET",
|
|
5913
7746
|
path: `${this.base()}/orders`,
|
|
@@ -5916,19 +7749,19 @@ var PickPackService = class {
|
|
|
5916
7749
|
});
|
|
5917
7750
|
}
|
|
5918
7751
|
/** Retrieve a packlist order by id. */
|
|
5919
|
-
async getOrder(orderId, auth2 =
|
|
7752
|
+
async getOrder(orderId, auth2 = SERVICE33) {
|
|
5920
7753
|
return this.ctx.http.request({ method: "GET", path: this.orderPath(orderId), auth: auth2 });
|
|
5921
7754
|
}
|
|
5922
7755
|
/** Update an order's status (`PATCH`). Returns an acknowledgement. */
|
|
5923
|
-
async updateOrder(orderId, change, auth2 =
|
|
7756
|
+
async updateOrder(orderId, change, auth2 = SERVICE33) {
|
|
5924
7757
|
return this.ctx.http.request({ method: "PATCH", path: this.orderPath(orderId), auth: auth2, body: change });
|
|
5925
7758
|
}
|
|
5926
7759
|
/** Finish an order. Returns an acknowledgement. */
|
|
5927
|
-
async finishOrder(orderId, auth2 =
|
|
7760
|
+
async finishOrder(orderId, auth2 = SERVICE33) {
|
|
5928
7761
|
return this.ctx.http.request({ method: "POST", path: `${this.orderPath(orderId)}/finish`, auth: auth2 });
|
|
5929
7762
|
}
|
|
5930
7763
|
/** List order cycles (ids). */
|
|
5931
|
-
async listOrderCycles(query = {}, auth2 =
|
|
7764
|
+
async listOrderCycles(query = {}, auth2 = SERVICE33) {
|
|
5932
7765
|
return this.ctx.http.request({
|
|
5933
7766
|
method: "GET",
|
|
5934
7767
|
path: `${this.base()}/orderCycles`,
|
|
@@ -5937,11 +7770,11 @@ var PickPackService = class {
|
|
|
5937
7770
|
});
|
|
5938
7771
|
}
|
|
5939
7772
|
/** Add an assignee to an order. Returns an acknowledgement. */
|
|
5940
|
-
async addAssignee(orderId, assignee, auth2 =
|
|
7773
|
+
async addAssignee(orderId, assignee, auth2 = SERVICE33) {
|
|
5941
7774
|
return this.ctx.http.request({ method: "POST", path: `${this.orderPath(orderId)}/assignees`, auth: auth2, body: assignee });
|
|
5942
7775
|
}
|
|
5943
7776
|
/** Remove an assignee from an order. */
|
|
5944
|
-
async removeAssignee(orderId, assigneeId, auth2 =
|
|
7777
|
+
async removeAssignee(orderId, assigneeId, auth2 = SERVICE33) {
|
|
5945
7778
|
await this.ctx.http.request({
|
|
5946
7779
|
method: "DELETE",
|
|
5947
7780
|
path: `${this.orderPath(orderId)}/assignees/${encodeURIComponent(assigneeId)}`,
|
|
@@ -5949,15 +7782,15 @@ var PickPackService = class {
|
|
|
5949
7782
|
});
|
|
5950
7783
|
}
|
|
5951
7784
|
/** Update packaging products for an order (`PUT`). Returns an acknowledgement. */
|
|
5952
|
-
async updatePackaging(orderId, change, auth2 =
|
|
7785
|
+
async updatePackaging(orderId, change, auth2 = SERVICE33) {
|
|
5953
7786
|
return this.ctx.http.request({ method: "PUT", path: `${this.orderPath(orderId)}/packaging`, auth: auth2, body: change });
|
|
5954
7787
|
}
|
|
5955
7788
|
/** Create a packing event. Returns an acknowledgement. */
|
|
5956
|
-
async createEvent(event, auth2 =
|
|
7789
|
+
async createEvent(event, auth2 = SERVICE33) {
|
|
5957
7790
|
return this.ctx.http.request({ method: "POST", path: `${this.base()}/events`, auth: auth2, body: event });
|
|
5958
7791
|
}
|
|
5959
7792
|
/** List packing events. */
|
|
5960
|
-
async listEvents(query = {}, auth2 =
|
|
7793
|
+
async listEvents(query = {}, auth2 = SERVICE33) {
|
|
5961
7794
|
return this.ctx.http.request({
|
|
5962
7795
|
method: "GET",
|
|
5963
7796
|
path: `${this.base()}/events`,
|
|
@@ -5966,7 +7799,7 @@ var PickPackService = class {
|
|
|
5966
7799
|
});
|
|
5967
7800
|
}
|
|
5968
7801
|
/** Trigger an order recalculation. Returns the created job's id. */
|
|
5969
|
-
async triggerRecalculation(input, auth2 =
|
|
7802
|
+
async triggerRecalculation(input, auth2 = SERVICE33) {
|
|
5970
7803
|
return this.ctx.http.request({
|
|
5971
7804
|
method: "POST",
|
|
5972
7805
|
path: `${this.base()}/jobs/recalculations`,
|
|
@@ -5975,7 +7808,7 @@ var PickPackService = class {
|
|
|
5975
7808
|
});
|
|
5976
7809
|
}
|
|
5977
7810
|
/** Retrieve a recalculation job by id. */
|
|
5978
|
-
async getRecalculationJob(jobId, auth2 =
|
|
7811
|
+
async getRecalculationJob(jobId, auth2 = SERVICE33) {
|
|
5979
7812
|
return this.ctx.http.request({
|
|
5980
7813
|
method: "GET",
|
|
5981
7814
|
path: `${this.base()}/jobs/recalculations/${encodeURIComponent(jobId)}`,
|
|
@@ -5985,7 +7818,7 @@ var PickPackService = class {
|
|
|
5985
7818
|
};
|
|
5986
7819
|
|
|
5987
7820
|
// src/services/customer-admin.ts
|
|
5988
|
-
var
|
|
7821
|
+
var SERVICE34 = { kind: "service" };
|
|
5989
7822
|
var CustomerAdminService = class {
|
|
5990
7823
|
constructor(ctx) {
|
|
5991
7824
|
this.ctx = ctx;
|
|
@@ -6003,7 +7836,7 @@ var CustomerAdminService = class {
|
|
|
6003
7836
|
}
|
|
6004
7837
|
// --- Customers ---
|
|
6005
7838
|
/** List customers. */
|
|
6006
|
-
async listCustomers(query = {}, auth2 =
|
|
7839
|
+
async listCustomers(query = {}, auth2 = SERVICE34) {
|
|
6007
7840
|
return this.ctx.http.request({
|
|
6008
7841
|
method: "GET",
|
|
6009
7842
|
path: this.base(),
|
|
@@ -6012,33 +7845,33 @@ var CustomerAdminService = class {
|
|
|
6012
7845
|
});
|
|
6013
7846
|
}
|
|
6014
7847
|
/** Search customers (`POST /customers/search`). A built filter in `q` is resolved to a string. */
|
|
6015
|
-
async searchCustomers(query, auth2 =
|
|
7848
|
+
async searchCustomers(query, auth2 = SERVICE34) {
|
|
6016
7849
|
const body = query.q !== void 0 ? { ...query, q: resolveQuery(query.q, { compoundLogicalQuery: false }) } : query;
|
|
6017
7850
|
return this.ctx.http.request({ method: "POST", path: `${this.base()}/search`, auth: auth2, body });
|
|
6018
7851
|
}
|
|
6019
7852
|
/** Retrieve a customer profile by number. */
|
|
6020
|
-
async getCustomer(customerNumber, auth2 =
|
|
7853
|
+
async getCustomer(customerNumber, auth2 = SERVICE34) {
|
|
6021
7854
|
return this.ctx.http.request({ method: "GET", path: this.customerPath(customerNumber), auth: auth2 });
|
|
6022
7855
|
}
|
|
6023
7856
|
/** Create a customer. */
|
|
6024
|
-
async createCustomer(input, auth2 =
|
|
7857
|
+
async createCustomer(input, auth2 = SERVICE34) {
|
|
6025
7858
|
return this.ctx.http.request({ method: "POST", path: this.base(), auth: auth2, body: input });
|
|
6026
7859
|
}
|
|
6027
7860
|
/** Upsert a customer profile by number (`PUT`). */
|
|
6028
|
-
async upsertCustomer(customerNumber, input, auth2 =
|
|
7861
|
+
async upsertCustomer(customerNumber, input, auth2 = SERVICE34) {
|
|
6029
7862
|
return this.ctx.http.request({ method: "PUT", path: this.customerPath(customerNumber), auth: auth2, body: input });
|
|
6030
7863
|
}
|
|
6031
7864
|
/** Partially update a customer profile (`PATCH`). */
|
|
6032
|
-
async patchCustomer(customerNumber, patch, auth2 =
|
|
7865
|
+
async patchCustomer(customerNumber, patch, auth2 = SERVICE34) {
|
|
6033
7866
|
await this.ctx.http.request({ method: "PATCH", path: this.customerPath(customerNumber), auth: auth2, body: patch });
|
|
6034
7867
|
}
|
|
6035
7868
|
/** Delete a customer profile. */
|
|
6036
|
-
async deleteCustomer(customerNumber, auth2 =
|
|
7869
|
+
async deleteCustomer(customerNumber, auth2 = SERVICE34) {
|
|
6037
7870
|
await this.ctx.http.request({ method: "DELETE", path: this.customerPath(customerNumber), auth: auth2 });
|
|
6038
7871
|
}
|
|
6039
7872
|
// --- Addresses ---
|
|
6040
7873
|
/** List a customer's addresses. */
|
|
6041
|
-
async listAddresses(customerNumber, auth2 =
|
|
7874
|
+
async listAddresses(customerNumber, auth2 = SERVICE34) {
|
|
6042
7875
|
return this.ctx.http.request({
|
|
6043
7876
|
method: "GET",
|
|
6044
7877
|
path: `${this.customerPath(customerNumber)}/addresses`,
|
|
@@ -6046,11 +7879,11 @@ var CustomerAdminService = class {
|
|
|
6046
7879
|
});
|
|
6047
7880
|
}
|
|
6048
7881
|
/** Retrieve one address. */
|
|
6049
|
-
async getAddress(customerNumber, addressId, auth2 =
|
|
7882
|
+
async getAddress(customerNumber, addressId, auth2 = SERVICE34) {
|
|
6050
7883
|
return this.ctx.http.request({ method: "GET", path: this.addressPath(customerNumber, addressId), auth: auth2 });
|
|
6051
7884
|
}
|
|
6052
7885
|
/** Add an address. */
|
|
6053
|
-
async addAddress(customerNumber, input, auth2 =
|
|
7886
|
+
async addAddress(customerNumber, input, auth2 = SERVICE34) {
|
|
6054
7887
|
return this.ctx.http.request({
|
|
6055
7888
|
method: "POST",
|
|
6056
7889
|
path: `${this.customerPath(customerNumber)}/addresses`,
|
|
@@ -6059,19 +7892,19 @@ var CustomerAdminService = class {
|
|
|
6059
7892
|
});
|
|
6060
7893
|
}
|
|
6061
7894
|
/** Upsert an address by id (`PUT`). */
|
|
6062
|
-
async upsertAddress(customerNumber, addressId, input, auth2 =
|
|
7895
|
+
async upsertAddress(customerNumber, addressId, input, auth2 = SERVICE34) {
|
|
6063
7896
|
return this.ctx.http.request({ method: "PUT", path: this.addressPath(customerNumber, addressId), auth: auth2, body: input });
|
|
6064
7897
|
}
|
|
6065
7898
|
/** Partially update an address by id (`PATCH`). */
|
|
6066
|
-
async patchAddress(customerNumber, addressId, patch, auth2 =
|
|
7899
|
+
async patchAddress(customerNumber, addressId, patch, auth2 = SERVICE34) {
|
|
6067
7900
|
await this.ctx.http.request({ method: "PATCH", path: this.addressPath(customerNumber, addressId), auth: auth2, body: patch });
|
|
6068
7901
|
}
|
|
6069
7902
|
/** Delete an address by id. */
|
|
6070
|
-
async deleteAddress(customerNumber, addressId, auth2 =
|
|
7903
|
+
async deleteAddress(customerNumber, addressId, auth2 = SERVICE34) {
|
|
6071
7904
|
await this.ctx.http.request({ method: "DELETE", path: this.addressPath(customerNumber, addressId), auth: auth2 });
|
|
6072
7905
|
}
|
|
6073
7906
|
/** Add tags to an address (`?tags=` query). */
|
|
6074
|
-
async addAddressTags(customerNumber, addressId, tags, auth2 =
|
|
7907
|
+
async addAddressTags(customerNumber, addressId, tags, auth2 = SERVICE34) {
|
|
6075
7908
|
await this.ctx.http.request({
|
|
6076
7909
|
method: "POST",
|
|
6077
7910
|
path: `${this.addressPath(customerNumber, addressId)}/tags`,
|
|
@@ -6080,7 +7913,7 @@ var CustomerAdminService = class {
|
|
|
6080
7913
|
});
|
|
6081
7914
|
}
|
|
6082
7915
|
/** Remove tags from an address (`?tags=` query). */
|
|
6083
|
-
async removeAddressTags(customerNumber, addressId, tags, auth2 =
|
|
7916
|
+
async removeAddressTags(customerNumber, addressId, tags, auth2 = SERVICE34) {
|
|
6084
7917
|
await this.ctx.http.request({
|
|
6085
7918
|
method: "DELETE",
|
|
6086
7919
|
path: `${this.addressPath(customerNumber, addressId)}/tags`,
|
|
@@ -6091,7 +7924,7 @@ var CustomerAdminService = class {
|
|
|
6091
7924
|
};
|
|
6092
7925
|
|
|
6093
7926
|
// src/services/approval.ts
|
|
6094
|
-
var
|
|
7927
|
+
var SERVICE35 = { kind: "service" };
|
|
6095
7928
|
var ApprovalService = class {
|
|
6096
7929
|
constructor(ctx) {
|
|
6097
7930
|
this.ctx = ctx;
|
|
@@ -6102,7 +7935,7 @@ var ApprovalService = class {
|
|
|
6102
7935
|
return `/approval/${this.ctx.tenant}`;
|
|
6103
7936
|
}
|
|
6104
7937
|
/** List approvals (paged via `pageNumber`/`pageSize`/`sort`/`q`). Returns an array. */
|
|
6105
|
-
async listApprovals(query = {}, auth2 =
|
|
7938
|
+
async listApprovals(query = {}, auth2 = SERVICE35) {
|
|
6106
7939
|
return this.ctx.http.request({
|
|
6107
7940
|
method: "GET",
|
|
6108
7941
|
path: `${this.base()}/approvals`,
|
|
@@ -6111,7 +7944,7 @@ var ApprovalService = class {
|
|
|
6111
7944
|
});
|
|
6112
7945
|
}
|
|
6113
7946
|
/** Retrieve a single approval by id. */
|
|
6114
|
-
async getApproval(approvalId, auth2 =
|
|
7947
|
+
async getApproval(approvalId, auth2 = SERVICE35) {
|
|
6115
7948
|
return this.ctx.http.request({
|
|
6116
7949
|
method: "GET",
|
|
6117
7950
|
path: `${this.base()}/approvals/${encodeURIComponent(approvalId)}`,
|
|
@@ -6119,7 +7952,7 @@ var ApprovalService = class {
|
|
|
6119
7952
|
});
|
|
6120
7953
|
}
|
|
6121
7954
|
/** Create an approval request (cart or quote). Returns the created `{ id }`. */
|
|
6122
|
-
async createApproval(input, auth2 =
|
|
7955
|
+
async createApproval(input, auth2 = SERVICE35) {
|
|
6123
7956
|
return this.ctx.http.request({
|
|
6124
7957
|
method: "POST",
|
|
6125
7958
|
path: `${this.base()}/approvals`,
|
|
@@ -6128,7 +7961,7 @@ var ApprovalService = class {
|
|
|
6128
7961
|
});
|
|
6129
7962
|
}
|
|
6130
7963
|
/** Approve/reject/amend an approval via a JSON-Patch op-array (`PATCH`). */
|
|
6131
|
-
async updateApproval(approvalId, ops, auth2 =
|
|
7964
|
+
async updateApproval(approvalId, ops, auth2 = SERVICE35) {
|
|
6132
7965
|
await this.ctx.http.request({
|
|
6133
7966
|
method: "PATCH",
|
|
6134
7967
|
path: `${this.base()}/approvals/${encodeURIComponent(approvalId)}`,
|
|
@@ -6137,7 +7970,7 @@ var ApprovalService = class {
|
|
|
6137
7970
|
});
|
|
6138
7971
|
}
|
|
6139
7972
|
/** Delete an approval by id. */
|
|
6140
|
-
async deleteApproval(approvalId, auth2 =
|
|
7973
|
+
async deleteApproval(approvalId, auth2 = SERVICE35) {
|
|
6141
7974
|
await this.ctx.http.request({
|
|
6142
7975
|
method: "DELETE",
|
|
6143
7976
|
path: `${this.base()}/approvals/${encodeURIComponent(approvalId)}`,
|
|
@@ -6145,7 +7978,7 @@ var ApprovalService = class {
|
|
|
6145
7978
|
});
|
|
6146
7979
|
}
|
|
6147
7980
|
/** Check whether an operation on a resource is permitted / needs approval. */
|
|
6148
|
-
async checkPermitted(input, auth2 =
|
|
7981
|
+
async checkPermitted(input, auth2 = SERVICE35) {
|
|
6149
7982
|
return this.ctx.http.request({
|
|
6150
7983
|
method: "POST",
|
|
6151
7984
|
path: `${this.base()}/approval/permitted`,
|
|
@@ -6154,7 +7987,7 @@ var ApprovalService = class {
|
|
|
6154
7987
|
});
|
|
6155
7988
|
}
|
|
6156
7989
|
/** Search for users eligible to approve a resource. Returns an array. */
|
|
6157
|
-
async searchApprovers(input, auth2 =
|
|
7990
|
+
async searchApprovers(input, auth2 = SERVICE35) {
|
|
6158
7991
|
return this.ctx.http.request({
|
|
6159
7992
|
method: "POST",
|
|
6160
7993
|
path: `${this.base()}/search/users`,
|
|
@@ -6181,6 +8014,7 @@ var EmporixClient = class {
|
|
|
6181
8014
|
contacts;
|
|
6182
8015
|
locations;
|
|
6183
8016
|
customerGroups;
|
|
8017
|
+
iam;
|
|
6184
8018
|
orders;
|
|
6185
8019
|
salesOrders;
|
|
6186
8020
|
availability;
|
|
@@ -6254,6 +8088,7 @@ var EmporixClient = class {
|
|
|
6254
8088
|
this.contacts = new ContactsService(mk(ContactsService.channel));
|
|
6255
8089
|
this.locations = new LocationsService(mk(LocationsService.channel));
|
|
6256
8090
|
this.customerGroups = new CustomerGroupsService(mk(CustomerGroupsService.channel));
|
|
8091
|
+
this.iam = new IamService(mk(IamService.channel));
|
|
6257
8092
|
this.orders = new OrdersService(mk(OrdersService.channel));
|
|
6258
8093
|
this.salesOrders = new SalesOrdersService(mk(SalesOrdersService.channel));
|
|
6259
8094
|
this.availability = new AvailabilityService(mk(AvailabilityService.channel));
|
|
@@ -6383,6 +8218,7 @@ exports.EmporixTimeoutError = EmporixTimeoutError;
|
|
|
6383
8218
|
exports.EmporixValidationError = EmporixValidationError;
|
|
6384
8219
|
exports.FeeService = FeeService;
|
|
6385
8220
|
exports.HttpClient = HttpClient;
|
|
8221
|
+
exports.IamService = IamService;
|
|
6386
8222
|
exports.IndexingService = IndexingService;
|
|
6387
8223
|
exports.InvoiceService = InvoiceService;
|
|
6388
8224
|
exports.LEVEL = LEVEL;
|