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