@viu/emporix-sdk 2.31.1 → 2.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +12 -0
- package/dist/availability.cjs +44 -10
- package/dist/availability.cjs.map +1 -1
- package/dist/availability.d.cts +2 -1
- package/dist/availability.d.ts +2 -1
- package/dist/availability.js +2 -1
- package/dist/cart.d.cts +1 -1
- package/dist/cart.d.ts +1 -1
- package/dist/category.cjs +82 -28
- package/dist/category.cjs.map +1 -1
- package/dist/category.d.cts +10 -1
- package/dist/category.d.ts +10 -1
- package/dist/category.js +3 -2
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/{chunk-W2KBVWJ2.js → chunk-3G5KROEC.js} +8 -2
- package/dist/chunk-3G5KROEC.js.map +1 -0
- package/dist/{chunk-7W22KLUL.js → chunk-JQWUGGRV.js} +32 -17
- package/dist/chunk-JQWUGGRV.js.map +1 -0
- package/dist/chunk-LKHKFF7B.js +30 -0
- package/dist/chunk-LKHKFF7B.js.map +1 -0
- package/dist/{chunk-D7HBM2DQ.js → chunk-MSQ3GEIW.js} +59 -31
- package/dist/chunk-MSQ3GEIW.js.map +1 -0
- package/dist/{chunk-P7G4LOOV.js → chunk-P3RANRGB.js} +47 -25
- package/dist/chunk-P3RANRGB.js.map +1 -0
- package/dist/{chunk-OTG2S2L4.js → chunk-TI56QENX.js} +14 -14
- package/dist/chunk-TI56QENX.js.map +1 -0
- package/dist/{chunk-GWJ2U2CP.js → chunk-W6SLZNRX.js} +2 -2
- package/dist/chunk-W6SLZNRX.js.map +1 -0
- package/dist/{chunk-V3275BA7.js → chunk-XQAOHHXL.js} +20 -12
- package/dist/chunk-XQAOHHXL.js.map +1 -0
- package/dist/companies.d.cts +1 -1
- package/dist/companies.d.ts +1 -1
- package/dist/contacts.d.cts +1 -1
- package/dist/contacts.d.ts +1 -1
- package/dist/{context-CpLIDl0P.d.cts → context-DK8jg6y5.d.cts} +48 -2
- package/dist/{context-CpLIDl0P.d.ts → context-DK8jg6y5.d.ts} +48 -2
- package/dist/{customer-groups-DJVbdrEP.d.cts → customer-groups-D0OCm8kJ.d.cts} +1 -1
- package/dist/{customer-groups-DhpCTCTg.d.ts → customer-groups-WSt4aT62.d.ts} +1 -1
- package/dist/customer-groups.d.cts +2 -2
- package/dist/customer-groups.d.ts +2 -2
- package/dist/customer.d.cts +1 -1
- package/dist/customer.d.ts +1 -1
- package/dist/index.cjs +343 -146
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -7
- package/dist/index.d.ts +62 -7
- package/dist/index.js +169 -72
- package/dist/index.js.map +1 -1
- package/dist/locations.d.cts +1 -1
- package/dist/locations.d.ts +1 -1
- package/dist/media.cjs +38 -12
- package/dist/media.cjs.map +1 -1
- package/dist/media.d.cts +7 -2
- package/dist/media.d.ts +7 -2
- package/dist/media.js +2 -1
- package/dist/orders.cjs +71 -23
- package/dist/orders.cjs.map +1 -1
- package/dist/orders.d.cts +7 -1
- package/dist/orders.d.ts +7 -1
- package/dist/orders.js +2 -1
- package/dist/payment.d.cts +1 -1
- package/dist/payment.d.ts +1 -1
- package/dist/price.d.cts +1 -1
- package/dist/price.d.ts +1 -1
- package/dist/product.cjs +55 -14
- package/dist/product.cjs.map +1 -1
- package/dist/product.d.cts +4 -1
- package/dist/product.d.ts +4 -1
- package/dist/product.js +3 -2
- package/dist/segment.cjs +6 -0
- package/dist/segment.cjs.map +1 -1
- package/dist/segment.d.cts +1 -1
- package/dist/segment.d.ts +1 -1
- package/dist/segment.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-7W22KLUL.js.map +0 -1
- package/dist/chunk-D7HBM2DQ.js.map +0 -1
- package/dist/chunk-GWJ2U2CP.js.map +0 -1
- package/dist/chunk-OTG2S2L4.js.map +0 -1
- package/dist/chunk-P7G4LOOV.js.map +0 -1
- package/dist/chunk-V3275BA7.js.map +0 -1
- package/dist/chunk-W2KBVWJ2.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -737,7 +737,25 @@ var HttpClient = class {
|
|
|
737
737
|
...o.body !== void 0 && !isFormData ? { "Content-Type": "application/json" } : {}
|
|
738
738
|
};
|
|
739
739
|
}
|
|
740
|
+
/**
|
|
741
|
+
* Issues a request and returns the parsed body. Retries 5xx/429 on idempotent
|
|
742
|
+
* methods and re-auths once on a 401 — see {@link send}.
|
|
743
|
+
*/
|
|
740
744
|
async request(o) {
|
|
745
|
+
return (await this.send(o)).data;
|
|
746
|
+
}
|
|
747
|
+
/**
|
|
748
|
+
* Like {@link request}, but also hands back the response headers.
|
|
749
|
+
*
|
|
750
|
+
* Emporix puts pagination metadata there — `X-Total-Count` and, on the schema
|
|
751
|
+
* service's custom instances, `X-Next-Cursor` / `X-Prev-Cursor`. Facades
|
|
752
|
+
* should reach for `core/paged.ts`'s `requestPage` rather than calling this
|
|
753
|
+
* directly; it exists for metadata that does not fit the paginated shape.
|
|
754
|
+
*/
|
|
755
|
+
async requestWithMeta(o) {
|
|
756
|
+
return this.send(o);
|
|
757
|
+
}
|
|
758
|
+
async send(o) {
|
|
741
759
|
const requestId = `req-${++requestSeq}`;
|
|
742
760
|
const log = this.opts.logger.child({ requestId });
|
|
743
761
|
const url = new URL(this.opts.host + o.path);
|
|
@@ -804,7 +822,7 @@ var HttpClient = class {
|
|
|
804
822
|
const parsed = text ? safeJson(text) : void 0;
|
|
805
823
|
if (res.ok) {
|
|
806
824
|
log.debug("http ok", { status: res.status });
|
|
807
|
-
return parsed;
|
|
825
|
+
return { data: parsed, headers: res.headers };
|
|
808
826
|
}
|
|
809
827
|
if (res.status === 401) {
|
|
810
828
|
if (sdkManaged && !reauthed) {
|
|
@@ -965,7 +983,7 @@ var HttpClient = class {
|
|
|
965
983
|
};
|
|
966
984
|
|
|
967
985
|
// package.json
|
|
968
|
-
var version = "2.
|
|
986
|
+
var version = "2.33.1";
|
|
969
987
|
|
|
970
988
|
// src/version.ts
|
|
971
989
|
var SDK_VERSION = version;
|
|
@@ -1316,6 +1334,33 @@ async function* iterateAll(fetchPage, start = 1) {
|
|
|
1316
1334
|
}
|
|
1317
1335
|
}
|
|
1318
1336
|
|
|
1337
|
+
// src/core/paged.ts
|
|
1338
|
+
function intHeader(headers, name) {
|
|
1339
|
+
const raw = headers.get(name);
|
|
1340
|
+
if (raw === null || raw.trim() === "") return void 0;
|
|
1341
|
+
const n = Number(raw);
|
|
1342
|
+
return Number.isInteger(n) && n >= 0 ? n : void 0;
|
|
1343
|
+
}
|
|
1344
|
+
async function requestPage(http, o, page) {
|
|
1345
|
+
const { data, headers } = await http.requestWithMeta(
|
|
1346
|
+
page.totalCount === true ? { ...o, headers: { ...o.headers ?? {}, "X-Total-Count": "true" } } : o
|
|
1347
|
+
);
|
|
1348
|
+
const items = data ?? [];
|
|
1349
|
+
const totalCount = intHeader(headers, "X-Total-Count");
|
|
1350
|
+
const nextCursor = headers.get("X-Next-Cursor") ?? void 0;
|
|
1351
|
+
const prevCursor = headers.get("X-Prev-Cursor") ?? void 0;
|
|
1352
|
+
const hasNextPage = nextCursor !== void 0 ? true : totalCount !== void 0 ? page.pageNumber * page.pageSize < totalCount : items.length === page.pageSize;
|
|
1353
|
+
return {
|
|
1354
|
+
items,
|
|
1355
|
+
pageNumber: page.pageNumber,
|
|
1356
|
+
pageSize: page.pageSize,
|
|
1357
|
+
hasNextPage,
|
|
1358
|
+
...totalCount === void 0 ? {} : { totalCount },
|
|
1359
|
+
...nextCursor === void 0 ? {} : { nextCursor },
|
|
1360
|
+
...prevCursor === void 0 ? {} : { prevCursor }
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1319
1364
|
// src/core/query.ts
|
|
1320
1365
|
function resolveQuery(q, cap) {
|
|
1321
1366
|
if (typeof q === "string") return q;
|
|
@@ -1360,13 +1405,20 @@ var ProductService = class {
|
|
|
1360
1405
|
async list(params = {}, auth2 = ANON) {
|
|
1361
1406
|
const pageNumber = params.pageNumber ?? 1;
|
|
1362
1407
|
const pageSize = params.pageSize ?? 50;
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1408
|
+
return requestPage(
|
|
1409
|
+
this.ctx.http,
|
|
1410
|
+
{
|
|
1411
|
+
method: "GET",
|
|
1412
|
+
path: `/product/${this.ctx.tenant}/products`,
|
|
1413
|
+
query: { pageNumber, pageSize },
|
|
1414
|
+
auth: auth2
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
pageNumber,
|
|
1418
|
+
pageSize,
|
|
1419
|
+
...params.totalCount === void 0 ? {} : { totalCount: params.totalCount }
|
|
1420
|
+
}
|
|
1421
|
+
);
|
|
1370
1422
|
}
|
|
1371
1423
|
/** Async-iterates every product across pages. */
|
|
1372
1424
|
listAll(params = {}, auth2 = ANON) {
|
|
@@ -1382,13 +1434,20 @@ var ProductService = class {
|
|
|
1382
1434
|
const q = resolveQuery(query, { compoundLogicalQuery: true });
|
|
1383
1435
|
const pageNumber = params.pageNumber ?? 1;
|
|
1384
1436
|
const pageSize = params.pageSize ?? 50;
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1437
|
+
return requestPage(
|
|
1438
|
+
this.ctx.http,
|
|
1439
|
+
{
|
|
1440
|
+
method: "GET",
|
|
1441
|
+
path: `/product/${this.ctx.tenant}/products`,
|
|
1442
|
+
query: { q, pageNumber, pageSize },
|
|
1443
|
+
auth: auth2
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
pageNumber,
|
|
1447
|
+
pageSize,
|
|
1448
|
+
...params.totalCount === void 0 ? {} : { totalCount: params.totalCount }
|
|
1449
|
+
}
|
|
1450
|
+
);
|
|
1392
1451
|
}
|
|
1393
1452
|
/**
|
|
1394
1453
|
* Free-text product search by name. The product `q` is a `field:value` DSL,
|
|
@@ -1724,13 +1783,20 @@ var CategoryService = class {
|
|
|
1724
1783
|
async list(params = {}, auth2 = ANON2) {
|
|
1725
1784
|
const pageNumber = params.pageNumber ?? 1;
|
|
1726
1785
|
const pageSize = params.pageSize ?? 50;
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1786
|
+
return requestPage(
|
|
1787
|
+
this.ctx.http,
|
|
1788
|
+
{
|
|
1789
|
+
method: "GET",
|
|
1790
|
+
path: `/category/${this.ctx.tenant}/categories`,
|
|
1791
|
+
query: { pageNumber, pageSize },
|
|
1792
|
+
auth: auth2
|
|
1793
|
+
},
|
|
1794
|
+
{
|
|
1795
|
+
pageNumber,
|
|
1796
|
+
pageSize,
|
|
1797
|
+
...params.totalCount === void 0 ? {} : { totalCount: params.totalCount }
|
|
1798
|
+
}
|
|
1799
|
+
);
|
|
1734
1800
|
}
|
|
1735
1801
|
/**
|
|
1736
1802
|
* Searches categories by a `q` filter — a raw Emporix DSL string or a built
|
|
@@ -1741,13 +1807,20 @@ var CategoryService = class {
|
|
|
1741
1807
|
const q = resolveQuery(query, { compoundLogicalQuery: false });
|
|
1742
1808
|
const pageNumber = params.pageNumber ?? 1;
|
|
1743
1809
|
const pageSize = params.pageSize ?? 50;
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1810
|
+
return requestPage(
|
|
1811
|
+
this.ctx.http,
|
|
1812
|
+
{
|
|
1813
|
+
method: "GET",
|
|
1814
|
+
path: `/category/${this.ctx.tenant}/categories`,
|
|
1815
|
+
query: { q, pageNumber, pageSize },
|
|
1816
|
+
auth: auth2
|
|
1817
|
+
},
|
|
1818
|
+
{
|
|
1819
|
+
pageNumber,
|
|
1820
|
+
pageSize,
|
|
1821
|
+
...params.totalCount === void 0 ? {} : { totalCount: params.totalCount }
|
|
1822
|
+
}
|
|
1823
|
+
);
|
|
1751
1824
|
}
|
|
1752
1825
|
/** Async-iterates every category across pages. */
|
|
1753
1826
|
listAll(params = {}, auth2 = ANON2) {
|
|
@@ -1817,6 +1890,12 @@ var CategoryService = class {
|
|
|
1817
1890
|
* references, and resolves them to full products via `/products/search`.
|
|
1818
1891
|
* `hasNextPage` reflects the assignments page (the source of truth for
|
|
1819
1892
|
* pagination).
|
|
1893
|
+
*
|
|
1894
|
+
* No `totalCount` opt-in here, deliberately. `X-Total-Count` on the
|
|
1895
|
+
* assignments request would count **assignments** — including the `CATEGORY`
|
|
1896
|
+
* references filtered out below — not the products this returns. A number
|
|
1897
|
+
* that is wrong in the way that is hardest to notice. Same reason
|
|
1898
|
+
* `segments.listMyProducts` stays on the guess.
|
|
1820
1899
|
*/
|
|
1821
1900
|
async productsIn(categoryId, params = {}, auth2 = ANON2) {
|
|
1822
1901
|
const pageNumber = params.pageNumber ?? 1;
|
|
@@ -1958,22 +2037,29 @@ var CategoryService = class {
|
|
|
1958
2037
|
const q = resolveQuery(query, { compoundLogicalQuery: false });
|
|
1959
2038
|
const pageNumber = params.pageNumber ?? 1;
|
|
1960
2039
|
const pageSize = params.pageSize ?? 50;
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
2040
|
+
return requestPage(
|
|
2041
|
+
this.ctx.http,
|
|
2042
|
+
{
|
|
2043
|
+
method: "POST",
|
|
2044
|
+
path: `/category/${this.ctx.tenant}/categories/search`,
|
|
2045
|
+
query: {
|
|
2046
|
+
pageNumber,
|
|
2047
|
+
pageSize,
|
|
2048
|
+
...params.sort === void 0 ? {} : { sort: params.sort },
|
|
2049
|
+
...params.showRoots === void 0 ? {} : { showRoots: String(params.showRoots) },
|
|
2050
|
+
...params.showUnpublished === void 0 ? {} : { showUnpublished: String(params.showUnpublished) }
|
|
2051
|
+
},
|
|
2052
|
+
body: { q },
|
|
2053
|
+
idempotent: true,
|
|
2054
|
+
// pure read over POST — safe to replay on 5xx/429
|
|
2055
|
+
auth: auth2
|
|
2056
|
+
},
|
|
2057
|
+
{
|
|
1965
2058
|
pageNumber,
|
|
1966
2059
|
pageSize,
|
|
1967
|
-
...params.
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
},
|
|
1971
|
-
body: { q },
|
|
1972
|
-
idempotent: true,
|
|
1973
|
-
// pure read over POST — safe to replay on 5xx/429
|
|
1974
|
-
auth: auth2
|
|
1975
|
-
});
|
|
1976
|
-
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
2060
|
+
...params.totalCount === void 0 ? {} : { totalCount: params.totalCount }
|
|
2061
|
+
}
|
|
2062
|
+
);
|
|
1977
2063
|
}
|
|
1978
2064
|
/**
|
|
1979
2065
|
* Searches category trees via `POST /category-trees/search` — returns the
|
|
@@ -3036,18 +3122,17 @@ var MediaService = class {
|
|
|
3036
3122
|
async list(query = {}, auth2 = SERVICE5) {
|
|
3037
3123
|
const pageNumber = query.pageNumber ?? 1;
|
|
3038
3124
|
const pageSize = query.pageSize ?? 60;
|
|
3039
|
-
const
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
pageSize,
|
|
3049
|
-
|
|
3050
|
-
};
|
|
3125
|
+
const { totalCount, ...rest } = query;
|
|
3126
|
+
return requestPage(
|
|
3127
|
+
this.ctx.http,
|
|
3128
|
+
{
|
|
3129
|
+
method: "GET",
|
|
3130
|
+
path: this.base(),
|
|
3131
|
+
auth: auth2,
|
|
3132
|
+
query: { ...rest, pageNumber, pageSize }
|
|
3133
|
+
},
|
|
3134
|
+
{ pageNumber, pageSize, ...totalCount === void 0 ? {} : { totalCount } }
|
|
3135
|
+
);
|
|
3051
3136
|
}
|
|
3052
3137
|
/** Fetch an asset by id. */
|
|
3053
3138
|
async get(assetId, auth2 = SERVICE5) {
|
|
@@ -3339,6 +3424,11 @@ var SegmentService = class {
|
|
|
3339
3424
|
* the whole batch (`Promise.all`); use the id-list method + your own
|
|
3340
3425
|
* tolerance strategy if partial success matters.
|
|
3341
3426
|
*/
|
|
3427
|
+
// No `totalCount` opt-in, deliberately. This pages over the segment's
|
|
3428
|
+
// ASSIGNMENTS and hydrates the hits in a second call, so `X-Total-Count` would
|
|
3429
|
+
// count assignments — including the CATEGORY entries filtered out below — not
|
|
3430
|
+
// the products returned. A number that is wrong in the way that is hardest to
|
|
3431
|
+
// notice. Same reason `categories.productsIn` stays on the guess.
|
|
3342
3432
|
async listMyProducts(query, auth2) {
|
|
3343
3433
|
const pageNumber = query?.pageNumber ?? 1;
|
|
3344
3434
|
const pageSize = query?.pageSize ?? 20;
|
|
@@ -3358,6 +3448,7 @@ var SegmentService = class {
|
|
|
3358
3448
|
* real categories via one bulk `categories.searchByIds` call. Same
|
|
3359
3449
|
* `hasNextPage` semantic as `listMyProducts`.
|
|
3360
3450
|
*/
|
|
3451
|
+
// No `totalCount` opt-in — see the note on {@link listMyProducts}.
|
|
3361
3452
|
async listMyCategories(query, auth2) {
|
|
3362
3453
|
const pageNumber = query?.pageNumber ?? 1;
|
|
3363
3454
|
const pageSize = query?.pageSize ?? 20;
|
|
@@ -4240,14 +4331,21 @@ var OrdersService = class {
|
|
|
4240
4331
|
setIfDefined2(query, "q", resolveQuery(opts.q, { compoundLogicalQuery: false }));
|
|
4241
4332
|
}
|
|
4242
4333
|
const headers = this.saasHeader(opts.saasToken);
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4334
|
+
return requestPage(
|
|
4335
|
+
this.ctx.http,
|
|
4336
|
+
{
|
|
4337
|
+
method: "GET",
|
|
4338
|
+
path: this.base(),
|
|
4339
|
+
query,
|
|
4340
|
+
auth: auth2,
|
|
4341
|
+
...headers ? { headers } : {}
|
|
4342
|
+
},
|
|
4343
|
+
{
|
|
4344
|
+
pageNumber,
|
|
4345
|
+
pageSize,
|
|
4346
|
+
...opts.totalCount === void 0 ? {} : { totalCount: opts.totalCount }
|
|
4347
|
+
}
|
|
4348
|
+
);
|
|
4251
4349
|
}
|
|
4252
4350
|
/** Fetches one of the calling customer's orders by id. */
|
|
4253
4351
|
async get(orderId, auth2, opts = {}) {
|
|
@@ -4290,14 +4388,21 @@ var OrdersService = class {
|
|
|
4290
4388
|
setIfDefined2(query, "q", resolveQuery(opts.q, { compoundLogicalQuery: false }));
|
|
4291
4389
|
}
|
|
4292
4390
|
const headers = this.saasHeader(opts.saasToken);
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4391
|
+
return requestPage(
|
|
4392
|
+
this.ctx.http,
|
|
4393
|
+
{
|
|
4394
|
+
method: "GET",
|
|
4395
|
+
path: `/order-v2/${this.ctx.tenant}/legal-entity-orders/${legalEntityId}`,
|
|
4396
|
+
query,
|
|
4397
|
+
auth: auth2,
|
|
4398
|
+
...headers ? { headers } : {}
|
|
4399
|
+
},
|
|
4400
|
+
{
|
|
4401
|
+
pageNumber,
|
|
4402
|
+
pageSize,
|
|
4403
|
+
...opts.totalCount === void 0 ? {} : { totalCount: opts.totalCount }
|
|
4404
|
+
}
|
|
4405
|
+
);
|
|
4301
4406
|
}
|
|
4302
4407
|
/**
|
|
4303
4408
|
* Fetches one order within a legal entity
|
|
@@ -4352,13 +4457,20 @@ var SalesOrdersService = class {
|
|
|
4352
4457
|
if (opts.q !== void 0) {
|
|
4353
4458
|
setIfDefined2(query, "q", resolveQuery(opts.q, { compoundLogicalQuery: false }));
|
|
4354
4459
|
}
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4460
|
+
return requestPage(
|
|
4461
|
+
this.ctx.http,
|
|
4462
|
+
{
|
|
4463
|
+
method: "GET",
|
|
4464
|
+
path: this.base(),
|
|
4465
|
+
query,
|
|
4466
|
+
auth: auth2
|
|
4467
|
+
},
|
|
4468
|
+
{
|
|
4469
|
+
pageNumber,
|
|
4470
|
+
pageSize,
|
|
4471
|
+
...opts.totalCount === void 0 ? {} : { totalCount: opts.totalCount }
|
|
4472
|
+
}
|
|
4473
|
+
);
|
|
4362
4474
|
}
|
|
4363
4475
|
/** Searches tenant sales-orders (`POST /salesorders/search`, body carries the `q` filter). */
|
|
4364
4476
|
async search(query, auth2, opts = {}) {
|
|
@@ -4530,18 +4642,25 @@ var AvailabilityService = class {
|
|
|
4530
4642
|
async listForSite(siteCode, params = {}, auth2 = ANON7) {
|
|
4531
4643
|
const pageNumber = params.pageNumber ?? 1;
|
|
4532
4644
|
const pageSize = params.pageSize ?? 50;
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4645
|
+
return requestPage(
|
|
4646
|
+
this.ctx.http,
|
|
4647
|
+
{
|
|
4648
|
+
method: "GET",
|
|
4649
|
+
path: `/availability/${this.ctx.tenant}/availability/site/${encodeURIComponent(siteCode)}`,
|
|
4650
|
+
query: {
|
|
4651
|
+
pageNumber,
|
|
4652
|
+
pageSize,
|
|
4653
|
+
...params.q === void 0 ? {} : { q: params.q },
|
|
4654
|
+
...params.sort === void 0 ? {} : { sort: params.sort }
|
|
4655
|
+
},
|
|
4656
|
+
auth: auth2
|
|
4657
|
+
},
|
|
4658
|
+
{
|
|
4537
4659
|
pageNumber,
|
|
4538
4660
|
pageSize,
|
|
4539
|
-
...params.
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
auth: auth2
|
|
4543
|
-
});
|
|
4544
|
-
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
4661
|
+
...params.totalCount === void 0 ? {} : { totalCount: params.totalCount }
|
|
4662
|
+
}
|
|
4663
|
+
);
|
|
4545
4664
|
}
|
|
4546
4665
|
// --- Admin writes. Default auth: service. ---
|
|
4547
4666
|
/**
|
|
@@ -5038,13 +5157,17 @@ var FeeService = class {
|
|
|
5038
5157
|
async list(query = {}, auth2 = SERVICE13) {
|
|
5039
5158
|
const pageNumber = query.pageNumber ?? 1;
|
|
5040
5159
|
const pageSize = query.pageSize ?? 60;
|
|
5041
|
-
const
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5160
|
+
const { totalCount, ...rest } = query;
|
|
5161
|
+
return requestPage(
|
|
5162
|
+
this.ctx.http,
|
|
5163
|
+
{
|
|
5164
|
+
method: "GET",
|
|
5165
|
+
path: this.feesBase(),
|
|
5166
|
+
auth: auth2,
|
|
5167
|
+
query: { ...rest, pageNumber, pageSize }
|
|
5168
|
+
},
|
|
5169
|
+
{ pageNumber, pageSize, ...totalCount === void 0 ? {} : { totalCount } }
|
|
5170
|
+
);
|
|
5048
5171
|
}
|
|
5049
5172
|
/** Retrieve one fee definition by id. */
|
|
5050
5173
|
async get(id, auth2 = SERVICE13) {
|
|
@@ -5385,13 +5508,20 @@ var SchemaService = class {
|
|
|
5385
5508
|
const q = { pageNumber, pageSize };
|
|
5386
5509
|
if (query.q) q.q = query.q;
|
|
5387
5510
|
if (query.type) q.type = query.type;
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5511
|
+
return requestPage(
|
|
5512
|
+
this.ctx.http,
|
|
5513
|
+
{
|
|
5514
|
+
method: "GET",
|
|
5515
|
+
path: this.schemasBase(),
|
|
5516
|
+
auth: auth2,
|
|
5517
|
+
query: q
|
|
5518
|
+
},
|
|
5519
|
+
{
|
|
5520
|
+
pageNumber,
|
|
5521
|
+
pageSize,
|
|
5522
|
+
...query.totalCount === void 0 ? {} : { totalCount: query.totalCount }
|
|
5523
|
+
}
|
|
5524
|
+
);
|
|
5395
5525
|
}
|
|
5396
5526
|
/** Retrieve one schema by id. */
|
|
5397
5527
|
async getSchema(id, auth2 = SERVICE15) {
|
|
@@ -5517,13 +5647,41 @@ var SchemaService = class {
|
|
|
5517
5647
|
async listInstances(type, query = {}, auth2 = SERVICE15) {
|
|
5518
5648
|
const pageNumber = query.pageNumber ?? 1;
|
|
5519
5649
|
const pageSize = query.pageSize ?? 60;
|
|
5520
|
-
const
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5650
|
+
const { totalCount, ...rest } = query;
|
|
5651
|
+
return requestPage(
|
|
5652
|
+
this.ctx.http,
|
|
5653
|
+
{
|
|
5654
|
+
method: "GET",
|
|
5655
|
+
path: this.instancesBase(type),
|
|
5656
|
+
auth: auth2,
|
|
5657
|
+
query: { ...rest, pageNumber, pageSize }
|
|
5658
|
+
},
|
|
5659
|
+
{ pageNumber, pageSize, ...totalCount === void 0 ? {} : { totalCount } }
|
|
5660
|
+
);
|
|
5661
|
+
}
|
|
5662
|
+
/**
|
|
5663
|
+
* Async-iterates every instance of a type.
|
|
5664
|
+
*
|
|
5665
|
+
* Not built on `iterateAll`: that helper drives pagination by page number, and
|
|
5666
|
+
* the server ignores `pageNumber` the moment a cursor is in play. This follows
|
|
5667
|
+
* `nextCursor` while the server offers one and falls back to `pageNumber + 1`
|
|
5668
|
+
* when it does not — so it is correct whether or not the tenant's deployment
|
|
5669
|
+
* emits cursor headers on a request that carries no cursor.
|
|
5670
|
+
*/
|
|
5671
|
+
async *listAllInstances(type, query = {}, auth2 = SERVICE15) {
|
|
5672
|
+
let cursor;
|
|
5673
|
+
let pageNumber = 1;
|
|
5674
|
+
for (; ; ) {
|
|
5675
|
+
const page = await this.listInstances(
|
|
5676
|
+
type,
|
|
5677
|
+
{ ...query, pageNumber, ...cursor === void 0 ? {} : { next: cursor } },
|
|
5678
|
+
auth2
|
|
5679
|
+
);
|
|
5680
|
+
for (const item of page.items) yield item;
|
|
5681
|
+
if (!page.hasNextPage) return;
|
|
5682
|
+
cursor = page.nextCursor;
|
|
5683
|
+
if (cursor === void 0) pageNumber += 1;
|
|
5684
|
+
}
|
|
5527
5685
|
}
|
|
5528
5686
|
/** Retrieve one instance by id. */
|
|
5529
5687
|
async getInstance(type, id, auth2 = SERVICE15) {
|
|
@@ -5657,15 +5815,26 @@ var SchemaService = class {
|
|
|
5657
5815
|
/**
|
|
5658
5816
|
* Structured search over a custom entity's instances
|
|
5659
5817
|
* (`POST /instances/search`), wrapped in {@link PaginatedItems}.
|
|
5818
|
+
*
|
|
5819
|
+
* The `query` parameter is third and `auth` fourth. This used to forward no
|
|
5820
|
+
* query parameters at all and report a hard-coded `hasNextPage: false`, so a
|
|
5821
|
+
* search could only ever return the server's default first page.
|
|
5660
5822
|
*/
|
|
5661
|
-
async searchInstances(type, body, auth2 = SERVICE15) {
|
|
5662
|
-
const
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5823
|
+
async searchInstances(type, body, query = {}, auth2 = SERVICE15) {
|
|
5824
|
+
const pageNumber = query.pageNumber ?? 1;
|
|
5825
|
+
const pageSize = query.pageSize ?? 60;
|
|
5826
|
+
const { totalCount, ...rest } = query;
|
|
5827
|
+
return requestPage(
|
|
5828
|
+
this.ctx.http,
|
|
5829
|
+
{
|
|
5830
|
+
method: "POST",
|
|
5831
|
+
path: `${this.instancesBase(type)}/search`,
|
|
5832
|
+
auth: auth2,
|
|
5833
|
+
body,
|
|
5834
|
+
query: { ...rest, pageNumber, pageSize }
|
|
5835
|
+
},
|
|
5836
|
+
{ pageNumber, pageSize, ...totalCount === void 0 ? {} : { totalCount } }
|
|
5837
|
+
);
|
|
5669
5838
|
}
|
|
5670
5839
|
// --- (E) References ------------------------------------------------------
|
|
5671
5840
|
/**
|
|
@@ -5686,13 +5855,20 @@ var SchemaService = class {
|
|
|
5686
5855
|
if (query.q) q.q = query.q;
|
|
5687
5856
|
if (query.fields) q.fields = query.fields;
|
|
5688
5857
|
if (query.type) q.type = query.type;
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5858
|
+
return requestPage(
|
|
5859
|
+
this.ctx.http,
|
|
5860
|
+
{
|
|
5861
|
+
method: "GET",
|
|
5862
|
+
path: this.referencesBase(),
|
|
5863
|
+
auth: auth2,
|
|
5864
|
+
query: q
|
|
5865
|
+
},
|
|
5866
|
+
{
|
|
5867
|
+
pageNumber,
|
|
5868
|
+
pageSize,
|
|
5869
|
+
...query.totalCount === void 0 ? {} : { totalCount: query.totalCount }
|
|
5870
|
+
}
|
|
5871
|
+
);
|
|
5696
5872
|
},
|
|
5697
5873
|
/** Retrieve one reference by id. */
|
|
5698
5874
|
get: async (id, auth2 = SERVICE15) => this.ctx.http.request({
|
|
@@ -7257,13 +7433,20 @@ var QuoteService = class {
|
|
|
7257
7433
|
const q = { pageNumber, pageSize };
|
|
7258
7434
|
if (query.q) q.q = query.q;
|
|
7259
7435
|
if (query.sort) q.sort = query.sort;
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7436
|
+
return requestPage(
|
|
7437
|
+
this.ctx.http,
|
|
7438
|
+
{
|
|
7439
|
+
method: "GET",
|
|
7440
|
+
path: this.quotesBase(),
|
|
7441
|
+
auth: auth2,
|
|
7442
|
+
query: q
|
|
7443
|
+
},
|
|
7444
|
+
{
|
|
7445
|
+
pageNumber,
|
|
7446
|
+
pageSize,
|
|
7447
|
+
...query.totalCount === void 0 ? {} : { totalCount: query.totalCount }
|
|
7448
|
+
}
|
|
7449
|
+
);
|
|
7267
7450
|
}
|
|
7268
7451
|
/** Create a quote (`POST /quotes`, 201). */
|
|
7269
7452
|
async create(draft, auth2) {
|
|
@@ -7333,13 +7516,20 @@ var QuoteReasonsResource = class {
|
|
|
7333
7516
|
async list(query, auth2) {
|
|
7334
7517
|
const pageNumber = query.pageNumber ?? 1;
|
|
7335
7518
|
const pageSize = query.pageSize ?? 60;
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7519
|
+
return requestPage(
|
|
7520
|
+
this.ctx.http,
|
|
7521
|
+
{
|
|
7522
|
+
method: "GET",
|
|
7523
|
+
path: this.base(),
|
|
7524
|
+
auth: auth2,
|
|
7525
|
+
query: { pageNumber, pageSize }
|
|
7526
|
+
},
|
|
7527
|
+
{
|
|
7528
|
+
pageNumber,
|
|
7529
|
+
pageSize,
|
|
7530
|
+
...query.totalCount === void 0 ? {} : { totalCount: query.totalCount }
|
|
7531
|
+
}
|
|
7532
|
+
);
|
|
7343
7533
|
}
|
|
7344
7534
|
/** Retrieve one reason by id. */
|
|
7345
7535
|
async get(reasonId, auth2) {
|
|
@@ -7567,13 +7757,20 @@ var IndexingService = class {
|
|
|
7567
7757
|
const pageSize = opts.pageSize ?? 50;
|
|
7568
7758
|
const query = { pageNumber, pageSize };
|
|
7569
7759
|
if (opts.q !== void 0) query.q = opts.q;
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7760
|
+
return requestPage(
|
|
7761
|
+
this.ctx.http,
|
|
7762
|
+
{
|
|
7763
|
+
method: "GET",
|
|
7764
|
+
path: `${this.base()}/reindex-jobs`,
|
|
7765
|
+
query,
|
|
7766
|
+
auth: auth2
|
|
7767
|
+
},
|
|
7768
|
+
{
|
|
7769
|
+
pageNumber,
|
|
7770
|
+
pageSize,
|
|
7771
|
+
...opts.totalCount === void 0 ? {} : { totalCount: opts.totalCount }
|
|
7772
|
+
}
|
|
7773
|
+
);
|
|
7577
7774
|
}
|
|
7578
7775
|
/** Fetch one reindex job by id. */
|
|
7579
7776
|
async getReindexJob(reindexJobId, auth2 = SERVICE29) {
|