@viu/emporix-sdk 2.2.0 → 2.4.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 +121 -0
- package/dist/availability.d.cts +1 -1
- package/dist/availability.d.ts +1 -1
- package/dist/cart.d.cts +1 -1
- package/dist/cart.d.ts +1 -1
- package/dist/category.d.cts +1 -1
- package/dist/category.d.ts +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- 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-Bs5ZSwds.d.cts → context-hksRbb95.d.cts} +1 -1
- package/dist/{context-Bs5ZSwds.d.ts → context-hksRbb95.d.ts} +1 -1
- package/dist/customer-groups.d.cts +1 -1
- package/dist/customer-groups.d.ts +1 -1
- package/dist/customer.d.cts +1 -1
- package/dist/customer.d.ts +1 -1
- package/dist/index.cjs +2180 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4986 -13
- package/dist/index.d.ts +4986 -13
- package/dist/index.js +2163 -3
- package/dist/index.js.map +1 -1
- package/dist/locations.d.cts +1 -1
- package/dist/locations.d.ts +1 -1
- package/dist/media.d.cts +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/orders.d.cts +1 -1
- package/dist/orders.d.ts +1 -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.d.cts +1 -1
- package/dist/product.d.ts +1 -1
- package/dist/segment.d.cts +1 -1
- package/dist/segment.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2385,8 +2385,2130 @@ var ClientConfigService = class {
|
|
|
2385
2385
|
}
|
|
2386
2386
|
};
|
|
2387
2387
|
|
|
2388
|
+
// src/services/shopping-list.ts
|
|
2389
|
+
var RESERVED = /* @__PURE__ */ new Set(["customerId", "metadata"]);
|
|
2390
|
+
var ShoppingListService = class {
|
|
2391
|
+
constructor(ctx) {
|
|
2392
|
+
this.ctx = ctx;
|
|
2393
|
+
}
|
|
2394
|
+
ctx;
|
|
2395
|
+
base() {
|
|
2396
|
+
return `/shoppinglist/${this.ctx.tenant}/shopping-lists`;
|
|
2397
|
+
}
|
|
2398
|
+
/** The caller's lists (or, with employee scope, all), normalized to an array. */
|
|
2399
|
+
async list(auth2, opts = {}) {
|
|
2400
|
+
const envelopes = await this.ctx.http.request({
|
|
2401
|
+
method: "GET",
|
|
2402
|
+
path: this.base(),
|
|
2403
|
+
auth: auth2,
|
|
2404
|
+
...opts.name ? { query: { name: opts.name } } : {}
|
|
2405
|
+
});
|
|
2406
|
+
const out = [];
|
|
2407
|
+
for (const env of envelopes ?? []) {
|
|
2408
|
+
for (const [key, value] of Object.entries(env)) {
|
|
2409
|
+
if (RESERVED.has(key) || value === null || typeof value !== "object") continue;
|
|
2410
|
+
const v = value;
|
|
2411
|
+
out.push({
|
|
2412
|
+
key,
|
|
2413
|
+
name: v.name ?? key,
|
|
2414
|
+
items: v.items ?? [],
|
|
2415
|
+
...v.mixins ? { mixins: v.mixins } : {},
|
|
2416
|
+
...v.metadata ? { metadata: v.metadata } : {}
|
|
2417
|
+
});
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
return out;
|
|
2421
|
+
}
|
|
2422
|
+
/** Create a list; returns the new list id. */
|
|
2423
|
+
async create(draft, auth2) {
|
|
2424
|
+
return this.ctx.http.request({
|
|
2425
|
+
method: "POST",
|
|
2426
|
+
path: this.base(),
|
|
2427
|
+
auth: auth2,
|
|
2428
|
+
body: draft
|
|
2429
|
+
});
|
|
2430
|
+
}
|
|
2431
|
+
/** Replace the named list (low-level PUT). */
|
|
2432
|
+
async replace(customerId, draft, auth2) {
|
|
2433
|
+
await this.ctx.http.request({
|
|
2434
|
+
method: "PUT",
|
|
2435
|
+
path: `${this.base()}/${encodeURIComponent(customerId)}`,
|
|
2436
|
+
auth: auth2,
|
|
2437
|
+
body: draft
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
/** Delete the named list, or all the customer's lists when `name` is omitted. */
|
|
2441
|
+
async delete(customerId, auth2, opts = {}) {
|
|
2442
|
+
await this.ctx.http.request({
|
|
2443
|
+
method: "DELETE",
|
|
2444
|
+
path: `${this.base()}/${encodeURIComponent(customerId)}`,
|
|
2445
|
+
auth: auth2,
|
|
2446
|
+
...opts.name ? { query: { name: opts.name } } : {}
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
async loadList(listName, auth2) {
|
|
2450
|
+
const lists = await this.list(auth2, { name: listName });
|
|
2451
|
+
const found = lists.find((l) => l.name === listName);
|
|
2452
|
+
if (!found) throw new EmporixNotFoundError(`Shopping list "${listName}" not found`, 404);
|
|
2453
|
+
return found;
|
|
2454
|
+
}
|
|
2455
|
+
async put(customerId, list, items, auth2) {
|
|
2456
|
+
await this.replace(
|
|
2457
|
+
customerId,
|
|
2458
|
+
{ name: list.name, items, ...list.mixins ? { mixins: list.mixins } : {} },
|
|
2459
|
+
auth2
|
|
2460
|
+
);
|
|
2461
|
+
}
|
|
2462
|
+
/** Add/replace an item by `productId` (read-modify-write, last-write-wins). */
|
|
2463
|
+
async addItem(customerId, listName, item, auth2) {
|
|
2464
|
+
const list = await this.loadList(listName, auth2);
|
|
2465
|
+
const items = [...list.items.filter((i) => i.productId !== item.productId), item];
|
|
2466
|
+
await this.put(customerId, list, items, auth2);
|
|
2467
|
+
}
|
|
2468
|
+
/** Remove an item by `productId` (no-op if absent). */
|
|
2469
|
+
async removeItem(customerId, listName, productId, auth2) {
|
|
2470
|
+
const list = await this.loadList(listName, auth2);
|
|
2471
|
+
const items = list.items.filter((i) => i.productId !== productId);
|
|
2472
|
+
await this.put(customerId, list, items, auth2);
|
|
2473
|
+
}
|
|
2474
|
+
/** Set an item's quantity; `quantity <= 0` removes it. Adds the item if absent. */
|
|
2475
|
+
async setItemQuantity(customerId, listName, productId, quantity, auth2) {
|
|
2476
|
+
if (quantity <= 0) return this.removeItem(customerId, listName, productId, auth2);
|
|
2477
|
+
const list = await this.loadList(listName, auth2);
|
|
2478
|
+
let items = list.items.map((i) => i.productId === productId ? { ...i, quantity } : i);
|
|
2479
|
+
if (!items.some((i) => i.productId === productId)) items = [...items, { productId, quantity }];
|
|
2480
|
+
await this.put(customerId, list, items, auth2);
|
|
2481
|
+
}
|
|
2482
|
+
};
|
|
2483
|
+
|
|
2484
|
+
// src/services/ai-rag-indexer.ts
|
|
2485
|
+
var SERVICE5 = { kind: "service" };
|
|
2486
|
+
var RagIndexerService = class {
|
|
2487
|
+
constructor(ctx) {
|
|
2488
|
+
this.ctx = ctx;
|
|
2489
|
+
}
|
|
2490
|
+
ctx;
|
|
2491
|
+
base(type) {
|
|
2492
|
+
return `/ai-rag-indexer/${this.ctx.tenant}/${encodeURIComponent(type)}`;
|
|
2493
|
+
}
|
|
2494
|
+
/** The indexable embedding field names for `type` (default `"PRODUCT"`). */
|
|
2495
|
+
async ragMetadata(type = "PRODUCT", auth2 = SERVICE5) {
|
|
2496
|
+
return this.ctx.http.request({
|
|
2497
|
+
method: "GET",
|
|
2498
|
+
path: `${this.base(type)}/rag-metadata`,
|
|
2499
|
+
auth: auth2
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
/** The filterable metadata fields for `type` (default `"PRODUCT"`). */
|
|
2503
|
+
async filterMetadata(type = "PRODUCT", auth2 = SERVICE5) {
|
|
2504
|
+
return this.ctx.http.request({
|
|
2505
|
+
method: "GET",
|
|
2506
|
+
path: `${this.base(type)}/filter-metadata`,
|
|
2507
|
+
auth: auth2
|
|
2508
|
+
});
|
|
2509
|
+
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Schedule a full asynchronous re-index for `type` (default `"PRODUCT"`).
|
|
2512
|
+
* Resolves once the rebuild is *scheduled* (HTTP 204); there is no progress
|
|
2513
|
+
* to await or poll. Costly — avoid calling on a hot path.
|
|
2514
|
+
*/
|
|
2515
|
+
async reindex(type = "PRODUCT", auth2 = SERVICE5) {
|
|
2516
|
+
await this.ctx.http.request({
|
|
2517
|
+
method: "POST",
|
|
2518
|
+
path: `${this.base(type)}/reindex`,
|
|
2519
|
+
auth: auth2
|
|
2520
|
+
});
|
|
2521
|
+
}
|
|
2522
|
+
};
|
|
2523
|
+
|
|
2524
|
+
// src/services/sequential-id.ts
|
|
2525
|
+
var SERVICE6 = { kind: "service" };
|
|
2526
|
+
var SequentialIdService = class {
|
|
2527
|
+
constructor(ctx) {
|
|
2528
|
+
this.ctx = ctx;
|
|
2529
|
+
}
|
|
2530
|
+
ctx;
|
|
2531
|
+
base() {
|
|
2532
|
+
return `/sequential-id/${this.ctx.tenant}/schemas`;
|
|
2533
|
+
}
|
|
2534
|
+
/** List all sequence schemas for the tenant. */
|
|
2535
|
+
async listSchemas(auth2 = SERVICE6) {
|
|
2536
|
+
return this.ctx.http.request({
|
|
2537
|
+
method: "GET",
|
|
2538
|
+
path: this.base(),
|
|
2539
|
+
auth: auth2
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
/** Retrieve one sequence schema by id. */
|
|
2543
|
+
async getSchema(schemaId, auth2 = SERVICE6) {
|
|
2544
|
+
return this.ctx.http.request({
|
|
2545
|
+
method: "GET",
|
|
2546
|
+
path: `${this.base()}/${encodeURIComponent(schemaId)}`,
|
|
2547
|
+
auth: auth2
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
/** Create a sequence schema. Schemas are immutable — there is no update. */
|
|
2551
|
+
async createSchema(schema, auth2 = SERVICE6) {
|
|
2552
|
+
return this.ctx.http.request({
|
|
2553
|
+
method: "POST",
|
|
2554
|
+
path: this.base(),
|
|
2555
|
+
auth: auth2,
|
|
2556
|
+
body: schema
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
/** Delete a sequence schema by id. */
|
|
2560
|
+
async deleteSchema(schemaId, auth2 = SERVICE6) {
|
|
2561
|
+
await this.ctx.http.request({
|
|
2562
|
+
method: "DELETE",
|
|
2563
|
+
path: `${this.base()}/${encodeURIComponent(schemaId)}`,
|
|
2564
|
+
auth: auth2
|
|
2565
|
+
});
|
|
2566
|
+
}
|
|
2567
|
+
/** Mark a schema active for its type (only one schema may be active per type). */
|
|
2568
|
+
async setActiveSchema(schemaId, auth2 = SERVICE6) {
|
|
2569
|
+
await this.ctx.http.request({
|
|
2570
|
+
method: "POST",
|
|
2571
|
+
path: `${this.base()}/${encodeURIComponent(schemaId)}/setActive`,
|
|
2572
|
+
auth: auth2
|
|
2573
|
+
});
|
|
2574
|
+
}
|
|
2575
|
+
/** Get the active schema for a given schema type. */
|
|
2576
|
+
async listSchemasByType(schemaType, auth2 = SERVICE6) {
|
|
2577
|
+
return this.ctx.http.request({
|
|
2578
|
+
method: "GET",
|
|
2579
|
+
path: `${this.base()}/types/${encodeURIComponent(schemaType)}`,
|
|
2580
|
+
auth: auth2
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
/**
|
|
2584
|
+
* Generate the next id for a schema type. `body` carries an optional
|
|
2585
|
+
* `sequenceKey` (independent sub-pool counter) and `placeholders`.
|
|
2586
|
+
* `opts.siteCode` derives time/country placeholders from the site's settings.
|
|
2587
|
+
*/
|
|
2588
|
+
async nextId(schemaType, body = {}, opts = {}, auth2 = SERVICE6) {
|
|
2589
|
+
const query = opts.siteCode ? { siteCode: opts.siteCode } : void 0;
|
|
2590
|
+
return this.ctx.http.request({
|
|
2591
|
+
method: "POST",
|
|
2592
|
+
path: `${this.base()}/types/${encodeURIComponent(schemaType)}/nextId`,
|
|
2593
|
+
auth: auth2,
|
|
2594
|
+
body,
|
|
2595
|
+
...query ? { query } : {}
|
|
2596
|
+
});
|
|
2597
|
+
}
|
|
2598
|
+
/**
|
|
2599
|
+
* Generate next ids for multiple schema types in one call. NOTE: the batch
|
|
2600
|
+
* endpoint path omits the `{tenant}` segment — the service derives the
|
|
2601
|
+
* tenant from the token.
|
|
2602
|
+
*/
|
|
2603
|
+
async nextIdsBatch(req, auth2 = SERVICE6) {
|
|
2604
|
+
return this.ctx.http.request({
|
|
2605
|
+
method: "POST",
|
|
2606
|
+
path: `/sequential-id/sequenceSchemaBatch/nextIds`,
|
|
2607
|
+
auth: auth2,
|
|
2608
|
+
body: req
|
|
2609
|
+
});
|
|
2610
|
+
}
|
|
2611
|
+
};
|
|
2612
|
+
|
|
2613
|
+
// src/services/fee.ts
|
|
2614
|
+
var SERVICE7 = { kind: "service" };
|
|
2615
|
+
var FeeService = class {
|
|
2616
|
+
constructor(ctx) {
|
|
2617
|
+
this.ctx = ctx;
|
|
2618
|
+
}
|
|
2619
|
+
ctx;
|
|
2620
|
+
feesBase() {
|
|
2621
|
+
return `/fee/${this.ctx.tenant}/fees`;
|
|
2622
|
+
}
|
|
2623
|
+
itemFeesBase() {
|
|
2624
|
+
return `/fee/${this.ctx.tenant}/itemFees`;
|
|
2625
|
+
}
|
|
2626
|
+
productFeesBase() {
|
|
2627
|
+
return `/fee/${this.ctx.tenant}/productFees`;
|
|
2628
|
+
}
|
|
2629
|
+
// --- Fee definitions ---
|
|
2630
|
+
/**
|
|
2631
|
+
* List fee definitions, wrapped in the shared {@link PaginatedItems}
|
|
2632
|
+
* envelope (same heuristic as `media.list`: `hasNextPage` is true when the
|
|
2633
|
+
* returned page is full). Defaults match Emporix server defaults
|
|
2634
|
+
* (`pageNumber: 1`, `pageSize: 60`).
|
|
2635
|
+
*/
|
|
2636
|
+
async list(query = {}, auth2 = SERVICE7) {
|
|
2637
|
+
const pageNumber = query.pageNumber ?? 1;
|
|
2638
|
+
const pageSize = query.pageSize ?? 60;
|
|
2639
|
+
const items = await this.ctx.http.request({
|
|
2640
|
+
method: "GET",
|
|
2641
|
+
path: this.feesBase(),
|
|
2642
|
+
auth: auth2,
|
|
2643
|
+
query: { ...query, pageNumber, pageSize }
|
|
2644
|
+
});
|
|
2645
|
+
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
2646
|
+
}
|
|
2647
|
+
/** Retrieve one fee definition by id. */
|
|
2648
|
+
async get(id, auth2 = SERVICE7) {
|
|
2649
|
+
return this.ctx.http.request({
|
|
2650
|
+
method: "GET",
|
|
2651
|
+
path: `${this.feesBase()}/${encodeURIComponent(id)}`,
|
|
2652
|
+
auth: auth2
|
|
2653
|
+
});
|
|
2654
|
+
}
|
|
2655
|
+
/** Create a fee definition. */
|
|
2656
|
+
async create(draft, auth2 = SERVICE7) {
|
|
2657
|
+
return this.ctx.http.request({
|
|
2658
|
+
method: "POST",
|
|
2659
|
+
path: this.feesBase(),
|
|
2660
|
+
auth: auth2,
|
|
2661
|
+
body: draft
|
|
2662
|
+
});
|
|
2663
|
+
}
|
|
2664
|
+
/** Update a fee definition by id. */
|
|
2665
|
+
async update(id, draft, auth2 = SERVICE7) {
|
|
2666
|
+
return this.ctx.http.request({
|
|
2667
|
+
method: "PUT",
|
|
2668
|
+
path: `${this.feesBase()}/${encodeURIComponent(id)}`,
|
|
2669
|
+
auth: auth2,
|
|
2670
|
+
body: draft
|
|
2671
|
+
});
|
|
2672
|
+
}
|
|
2673
|
+
/** Delete a fee definition by id. */
|
|
2674
|
+
async delete(id, auth2 = SERVICE7) {
|
|
2675
|
+
await this.ctx.http.request({
|
|
2676
|
+
method: "DELETE",
|
|
2677
|
+
path: `${this.feesBase()}/${encodeURIComponent(id)}`,
|
|
2678
|
+
auth: auth2
|
|
2679
|
+
});
|
|
2680
|
+
}
|
|
2681
|
+
// --- Item-fee mappings ---
|
|
2682
|
+
/** List all item-fee mappings. */
|
|
2683
|
+
async listItemFees(auth2 = SERVICE7) {
|
|
2684
|
+
return this.ctx.http.request({
|
|
2685
|
+
method: "GET",
|
|
2686
|
+
path: this.itemFeesBase(),
|
|
2687
|
+
auth: auth2
|
|
2688
|
+
});
|
|
2689
|
+
}
|
|
2690
|
+
/** Fee mappings for one item YRN. */
|
|
2691
|
+
async getItemFees(itemYrn, auth2 = SERVICE7) {
|
|
2692
|
+
return this.ctx.http.request({
|
|
2693
|
+
method: "GET",
|
|
2694
|
+
path: `${this.itemFeesBase()}/${encodeURIComponent(itemYrn)}/fees`,
|
|
2695
|
+
auth: auth2
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2698
|
+
/** Create an item-fee mapping. */
|
|
2699
|
+
async createItemFee(draft, auth2 = SERVICE7) {
|
|
2700
|
+
return this.ctx.http.request({
|
|
2701
|
+
method: "POST",
|
|
2702
|
+
path: this.itemFeesBase(),
|
|
2703
|
+
auth: auth2,
|
|
2704
|
+
body: draft
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2707
|
+
/**
|
|
2708
|
+
* Set the fee list for an item YRN. Destructive replace by default; pass
|
|
2709
|
+
* `{ partial: true }` to merge (`?partial=true`).
|
|
2710
|
+
*/
|
|
2711
|
+
async setItemFees(itemYrn, feeIds, opts = {}, auth2 = SERVICE7) {
|
|
2712
|
+
return this.ctx.http.request({
|
|
2713
|
+
method: "PUT",
|
|
2714
|
+
path: `${this.itemFeesBase()}/${encodeURIComponent(itemYrn)}/fees`,
|
|
2715
|
+
auth: auth2,
|
|
2716
|
+
body: { feeIds },
|
|
2717
|
+
...opts.partial ? { query: { partial: "true" } } : {}
|
|
2718
|
+
});
|
|
2719
|
+
}
|
|
2720
|
+
/**
|
|
2721
|
+
* Delete item-fee mappings for a YRN. Without `feeId`, removes all mappings
|
|
2722
|
+
* for the YRN; with `feeId`, removes that single fee from the mapping.
|
|
2723
|
+
*/
|
|
2724
|
+
async deleteItemFees(itemYrn, feeId, auth2 = SERVICE7) {
|
|
2725
|
+
const base = `${this.itemFeesBase()}/${encodeURIComponent(itemYrn)}/fees`;
|
|
2726
|
+
await this.ctx.http.request({
|
|
2727
|
+
method: "DELETE",
|
|
2728
|
+
path: feeId ? `${base}/${encodeURIComponent(feeId)}` : base,
|
|
2729
|
+
auth: auth2
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2732
|
+
/** Search item-fee mappings by item YRNs + site. */
|
|
2733
|
+
async searchItemFees(search, auth2 = SERVICE7) {
|
|
2734
|
+
return this.ctx.http.request({
|
|
2735
|
+
method: "POST",
|
|
2736
|
+
path: `${this.itemFeesBase()}/search`,
|
|
2737
|
+
auth: auth2,
|
|
2738
|
+
body: search
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2741
|
+
// --- Product-fee mappings ---
|
|
2742
|
+
/** Fee mappings for a product id. */
|
|
2743
|
+
async getProductFees(productId, auth2 = SERVICE7) {
|
|
2744
|
+
return this.ctx.http.request({
|
|
2745
|
+
method: "GET",
|
|
2746
|
+
path: `${this.productFeesBase()}/${encodeURIComponent(productId)}/fees`,
|
|
2747
|
+
auth: auth2
|
|
2748
|
+
});
|
|
2749
|
+
}
|
|
2750
|
+
/**
|
|
2751
|
+
* Set the fee list for a product id. Destructive replace by default; pass
|
|
2752
|
+
* `{ partial: true }` to merge (`?partial=true`).
|
|
2753
|
+
*/
|
|
2754
|
+
async setProductFees(productId, feeIds, opts = {}, auth2 = SERVICE7) {
|
|
2755
|
+
return this.ctx.http.request({
|
|
2756
|
+
method: "PUT",
|
|
2757
|
+
path: `${this.productFeesBase()}/${encodeURIComponent(productId)}/fees`,
|
|
2758
|
+
auth: auth2,
|
|
2759
|
+
body: { feeIds },
|
|
2760
|
+
...opts.partial ? { query: { partial: "true" } } : {}
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
/** Delete all fee mappings for a product id. */
|
|
2764
|
+
async deleteProductFees(productId, auth2 = SERVICE7) {
|
|
2765
|
+
await this.ctx.http.request({
|
|
2766
|
+
method: "DELETE",
|
|
2767
|
+
path: `${this.productFeesBase()}/${encodeURIComponent(productId)}/fees`,
|
|
2768
|
+
auth: auth2
|
|
2769
|
+
});
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
|
|
2773
|
+
// src/services/webhook.ts
|
|
2774
|
+
var SERVICE8 = { kind: "service" };
|
|
2775
|
+
var WebhookService = class {
|
|
2776
|
+
constructor(ctx) {
|
|
2777
|
+
this.ctx = ctx;
|
|
2778
|
+
}
|
|
2779
|
+
ctx;
|
|
2780
|
+
base() {
|
|
2781
|
+
return `/webhook/${this.ctx.tenant}`;
|
|
2782
|
+
}
|
|
2783
|
+
/** List the event-subscription catalog with each event's on/off state. */
|
|
2784
|
+
async listEventSubscriptions(auth2 = SERVICE8) {
|
|
2785
|
+
return this.ctx.http.request({
|
|
2786
|
+
method: "GET",
|
|
2787
|
+
path: `${this.base()}/event-subscriptions`,
|
|
2788
|
+
auth: auth2
|
|
2789
|
+
});
|
|
2790
|
+
}
|
|
2791
|
+
/**
|
|
2792
|
+
* Batch subscribe/unsubscribe events. Returns the **207** per-item result
|
|
2793
|
+
* array verbatim — the batch can partially fail, so inspect each element's
|
|
2794
|
+
* `code`/`status` (e.g. `results.filter(r => (r.code ?? 0) >= 400)`). Does
|
|
2795
|
+
* NOT throw on a 207 with failed items; only a non-2xx HTTP status throws.
|
|
2796
|
+
*/
|
|
2797
|
+
async updateEventSubscriptions(items, auth2 = SERVICE8) {
|
|
2798
|
+
return this.ctx.http.request({
|
|
2799
|
+
method: "PATCH",
|
|
2800
|
+
path: `${this.base()}/event-subscriptions`,
|
|
2801
|
+
auth: auth2,
|
|
2802
|
+
body: items
|
|
2803
|
+
});
|
|
2804
|
+
}
|
|
2805
|
+
/** List delivery configurations. */
|
|
2806
|
+
async listConfigs(auth2 = SERVICE8) {
|
|
2807
|
+
return this.ctx.http.request({
|
|
2808
|
+
method: "GET",
|
|
2809
|
+
path: `${this.base()}/config`,
|
|
2810
|
+
auth: auth2
|
|
2811
|
+
});
|
|
2812
|
+
}
|
|
2813
|
+
/** Retrieve one delivery configuration by code. */
|
|
2814
|
+
async getConfig(code, auth2 = SERVICE8) {
|
|
2815
|
+
return this.ctx.http.request({
|
|
2816
|
+
method: "GET",
|
|
2817
|
+
path: `${this.base()}/config/${encodeURIComponent(code)}`,
|
|
2818
|
+
auth: auth2
|
|
2819
|
+
});
|
|
2820
|
+
}
|
|
2821
|
+
/** Create a delivery configuration. Returns the server-assigned `{ code }`. */
|
|
2822
|
+
async createConfig(draft, auth2 = SERVICE8) {
|
|
2823
|
+
return this.ctx.http.request({
|
|
2824
|
+
method: "POST",
|
|
2825
|
+
path: `${this.base()}/config`,
|
|
2826
|
+
auth: auth2,
|
|
2827
|
+
body: draft
|
|
2828
|
+
});
|
|
2829
|
+
}
|
|
2830
|
+
/** Replace a delivery configuration by code (204). */
|
|
2831
|
+
async replaceConfig(code, draft, auth2 = SERVICE8) {
|
|
2832
|
+
await this.ctx.http.request({
|
|
2833
|
+
method: "PUT",
|
|
2834
|
+
path: `${this.base()}/config/${encodeURIComponent(code)}`,
|
|
2835
|
+
auth: auth2,
|
|
2836
|
+
body: draft
|
|
2837
|
+
});
|
|
2838
|
+
}
|
|
2839
|
+
/**
|
|
2840
|
+
* Partially update a delivery configuration by code (204). The body is an
|
|
2841
|
+
* **array** of `{ op, path, value }` operations (UPSERT / REMOVE).
|
|
2842
|
+
*/
|
|
2843
|
+
async patchConfig(code, patches, auth2 = SERVICE8) {
|
|
2844
|
+
await this.ctx.http.request({
|
|
2845
|
+
method: "PATCH",
|
|
2846
|
+
path: `${this.base()}/config/${encodeURIComponent(code)}`,
|
|
2847
|
+
auth: auth2,
|
|
2848
|
+
body: patches
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
/**
|
|
2852
|
+
* Delete a delivery configuration by code. Pass `{ force: true }` to delete
|
|
2853
|
+
* the currently-active config (the server otherwise rejects it).
|
|
2854
|
+
*/
|
|
2855
|
+
async deleteConfig(code, opts = {}, auth2 = SERVICE8) {
|
|
2856
|
+
await this.ctx.http.request({
|
|
2857
|
+
method: "DELETE",
|
|
2858
|
+
path: `${this.base()}/config/${encodeURIComponent(code)}`,
|
|
2859
|
+
auth: auth2,
|
|
2860
|
+
...opts.force === true ? { query: { force: "true" } } : {}
|
|
2861
|
+
});
|
|
2862
|
+
}
|
|
2863
|
+
/** Read delivery statistics over an optional `YYYY-MM` range. */
|
|
2864
|
+
async getStatistics(query = {}, auth2 = SERVICE8) {
|
|
2865
|
+
const q = {};
|
|
2866
|
+
if (query.fromYearMonth) q.fromYearMonth = query.fromYearMonth;
|
|
2867
|
+
if (query.toYearMonth) q.toYearMonth = query.toYearMonth;
|
|
2868
|
+
return this.ctx.http.request({
|
|
2869
|
+
method: "GET",
|
|
2870
|
+
path: `${this.base()}/statistics`,
|
|
2871
|
+
auth: auth2,
|
|
2872
|
+
...Object.keys(q).length > 0 ? { query: q } : {}
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2875
|
+
/** Obtain Svix dashboard access (URL / token). */
|
|
2876
|
+
async getDashboardAccess(auth2 = SERVICE8) {
|
|
2877
|
+
return this.ctx.http.request({
|
|
2878
|
+
method: "GET",
|
|
2879
|
+
path: `${this.base()}/dashboard-access`,
|
|
2880
|
+
auth: auth2
|
|
2881
|
+
});
|
|
2882
|
+
}
|
|
2883
|
+
};
|
|
2884
|
+
|
|
2885
|
+
// src/services/schema.ts
|
|
2886
|
+
var SERVICE9 = { kind: "service" };
|
|
2887
|
+
var SchemaService = class {
|
|
2888
|
+
constructor(ctx) {
|
|
2889
|
+
this.ctx = ctx;
|
|
2890
|
+
}
|
|
2891
|
+
ctx;
|
|
2892
|
+
schemasBase() {
|
|
2893
|
+
return `/schema/${this.ctx.tenant}/schemas`;
|
|
2894
|
+
}
|
|
2895
|
+
entitiesBase() {
|
|
2896
|
+
return `/schema/${this.ctx.tenant}/custom-entities`;
|
|
2897
|
+
}
|
|
2898
|
+
instancesBase(type) {
|
|
2899
|
+
return `${this.entitiesBase()}/${encodeURIComponent(type)}/instances`;
|
|
2900
|
+
}
|
|
2901
|
+
// --- (A) Schemas ---------------------------------------------------------
|
|
2902
|
+
/**
|
|
2903
|
+
* List schemas, wrapped in the shared {@link PaginatedItems} envelope.
|
|
2904
|
+
* `hasNextPage` is the standard SDK heuristic (`items.length === pageSize`).
|
|
2905
|
+
* Pagination defaults match the rest of the SDK (`pageNumber: 1`,
|
|
2906
|
+
* `pageSize: 60`).
|
|
2907
|
+
*/
|
|
2908
|
+
async listSchemas(query = {}, auth2 = SERVICE9) {
|
|
2909
|
+
const pageNumber = query.pageNumber ?? 1;
|
|
2910
|
+
const pageSize = query.pageSize ?? 60;
|
|
2911
|
+
const q = { pageNumber, pageSize };
|
|
2912
|
+
if (query.q) q.q = query.q;
|
|
2913
|
+
if (query.type) q.type = query.type;
|
|
2914
|
+
const items = await this.ctx.http.request({
|
|
2915
|
+
method: "GET",
|
|
2916
|
+
path: this.schemasBase(),
|
|
2917
|
+
auth: auth2,
|
|
2918
|
+
query: q
|
|
2919
|
+
});
|
|
2920
|
+
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
2921
|
+
}
|
|
2922
|
+
/** Retrieve one schema by id. */
|
|
2923
|
+
async getSchema(id, auth2 = SERVICE9) {
|
|
2924
|
+
return this.ctx.http.request({
|
|
2925
|
+
method: "GET",
|
|
2926
|
+
path: `${this.schemasBase()}/${encodeURIComponent(id)}`,
|
|
2927
|
+
auth: auth2
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2930
|
+
/** Create a schema. */
|
|
2931
|
+
async createSchema(draft, auth2 = SERVICE9) {
|
|
2932
|
+
return this.ctx.http.request({
|
|
2933
|
+
method: "POST",
|
|
2934
|
+
path: this.schemasBase(),
|
|
2935
|
+
auth: auth2,
|
|
2936
|
+
body: draft
|
|
2937
|
+
});
|
|
2938
|
+
}
|
|
2939
|
+
/**
|
|
2940
|
+
* Update a schema. The upstream API requires `draft.metadata.version`; a
|
|
2941
|
+
* stale version yields 409 Conflict (propagated as the standard conflict
|
|
2942
|
+
* error).
|
|
2943
|
+
*/
|
|
2944
|
+
async updateSchema(id, draft, auth2 = SERVICE9) {
|
|
2945
|
+
return this.ctx.http.request({
|
|
2946
|
+
method: "PUT",
|
|
2947
|
+
path: `${this.schemasBase()}/${encodeURIComponent(id)}`,
|
|
2948
|
+
auth: auth2,
|
|
2949
|
+
body: draft
|
|
2950
|
+
});
|
|
2951
|
+
}
|
|
2952
|
+
/** Delete a schema by id. */
|
|
2953
|
+
async deleteSchema(id, auth2 = SERVICE9) {
|
|
2954
|
+
await this.ctx.http.request({
|
|
2955
|
+
method: "DELETE",
|
|
2956
|
+
path: `${this.schemasBase()}/${encodeURIComponent(id)}`,
|
|
2957
|
+
auth: auth2
|
|
2958
|
+
});
|
|
2959
|
+
}
|
|
2960
|
+
/**
|
|
2961
|
+
* Validate a schema document without persisting it (`POST /schemas/file`).
|
|
2962
|
+
* Returns the server's validation result verbatim.
|
|
2963
|
+
*/
|
|
2964
|
+
async validateSchemaFile(body, auth2 = SERVICE9) {
|
|
2965
|
+
return this.ctx.http.request({
|
|
2966
|
+
method: "POST",
|
|
2967
|
+
path: `${this.schemasBase()}/file`,
|
|
2968
|
+
auth: auth2,
|
|
2969
|
+
body
|
|
2970
|
+
});
|
|
2971
|
+
}
|
|
2972
|
+
// --- (B) Types -----------------------------------------------------------
|
|
2973
|
+
/** List entity types that currently have at least one schema. */
|
|
2974
|
+
async listTypes(auth2 = SERVICE9) {
|
|
2975
|
+
return this.ctx.http.request({
|
|
2976
|
+
method: "GET",
|
|
2977
|
+
path: `/schema/${this.ctx.tenant}/types`,
|
|
2978
|
+
auth: auth2
|
|
2979
|
+
});
|
|
2980
|
+
}
|
|
2981
|
+
/** Set the entity types a schema applies to (`PUT /schemas/{id}/types`). */
|
|
2982
|
+
async setSchemaTypes(id, types, auth2 = SERVICE9) {
|
|
2983
|
+
return this.ctx.http.request({
|
|
2984
|
+
method: "PUT",
|
|
2985
|
+
path: `${this.schemasBase()}/${encodeURIComponent(id)}/types`,
|
|
2986
|
+
auth: auth2,
|
|
2987
|
+
body: { types }
|
|
2988
|
+
});
|
|
2989
|
+
}
|
|
2990
|
+
// --- (C) Custom entities -------------------------------------------------
|
|
2991
|
+
/** List custom-entity definitions. `expandSchemas` inlines each schema body. */
|
|
2992
|
+
async listCustomEntities(opts = {}, auth2 = SERVICE9) {
|
|
2993
|
+
return this.ctx.http.request({
|
|
2994
|
+
method: "GET",
|
|
2995
|
+
path: this.entitiesBase(),
|
|
2996
|
+
auth: auth2,
|
|
2997
|
+
...opts.expandSchemas ? { query: { expandSchemas: "true" } } : {}
|
|
2998
|
+
});
|
|
2999
|
+
}
|
|
3000
|
+
/** Retrieve one custom-entity definition by id. */
|
|
3001
|
+
async getCustomEntity(id, auth2 = SERVICE9) {
|
|
3002
|
+
return this.ctx.http.request({
|
|
3003
|
+
method: "GET",
|
|
3004
|
+
path: `${this.entitiesBase()}/${encodeURIComponent(id)}`,
|
|
3005
|
+
auth: auth2
|
|
3006
|
+
});
|
|
3007
|
+
}
|
|
3008
|
+
/** Create a custom-entity definition. */
|
|
3009
|
+
async createCustomEntity(draft, auth2 = SERVICE9) {
|
|
3010
|
+
return this.ctx.http.request({
|
|
3011
|
+
method: "POST",
|
|
3012
|
+
path: this.entitiesBase(),
|
|
3013
|
+
auth: auth2,
|
|
3014
|
+
body: draft
|
|
3015
|
+
});
|
|
3016
|
+
}
|
|
3017
|
+
/** Update a custom-entity definition. */
|
|
3018
|
+
async updateCustomEntity(id, draft, auth2 = SERVICE9) {
|
|
3019
|
+
return this.ctx.http.request({
|
|
3020
|
+
method: "PUT",
|
|
3021
|
+
path: `${this.entitiesBase()}/${encodeURIComponent(id)}`,
|
|
3022
|
+
auth: auth2,
|
|
3023
|
+
body: draft
|
|
3024
|
+
});
|
|
3025
|
+
}
|
|
3026
|
+
/**
|
|
3027
|
+
* Delete a custom-entity definition. The server rejects with 409 if
|
|
3028
|
+
* instances or schemas still reference it (propagated as the standard
|
|
3029
|
+
* conflict error).
|
|
3030
|
+
*/
|
|
3031
|
+
async deleteCustomEntity(id, auth2 = SERVICE9) {
|
|
3032
|
+
await this.ctx.http.request({
|
|
3033
|
+
method: "DELETE",
|
|
3034
|
+
path: `${this.entitiesBase()}/${encodeURIComponent(id)}`,
|
|
3035
|
+
auth: auth2
|
|
3036
|
+
});
|
|
3037
|
+
}
|
|
3038
|
+
// --- (D) Custom instances ------------------------------------------------
|
|
3039
|
+
/**
|
|
3040
|
+
* List a custom entity's instances, wrapped in {@link PaginatedItems}.
|
|
3041
|
+
* `type` is the custom-entity type and is always the first argument.
|
|
3042
|
+
*/
|
|
3043
|
+
async listInstances(type, query = {}, auth2 = SERVICE9) {
|
|
3044
|
+
const pageNumber = query.pageNumber ?? 1;
|
|
3045
|
+
const pageSize = query.pageSize ?? 60;
|
|
3046
|
+
const items = await this.ctx.http.request({
|
|
3047
|
+
method: "GET",
|
|
3048
|
+
path: this.instancesBase(type),
|
|
3049
|
+
auth: auth2,
|
|
3050
|
+
query: { ...query, pageNumber, pageSize }
|
|
3051
|
+
});
|
|
3052
|
+
return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };
|
|
3053
|
+
}
|
|
3054
|
+
/** Retrieve one instance by id. */
|
|
3055
|
+
async getInstance(type, id, auth2 = SERVICE9) {
|
|
3056
|
+
return this.ctx.http.request({
|
|
3057
|
+
method: "GET",
|
|
3058
|
+
path: `${this.instancesBase(type)}/${encodeURIComponent(id)}`,
|
|
3059
|
+
auth: auth2
|
|
3060
|
+
});
|
|
3061
|
+
}
|
|
3062
|
+
/** Create an instance of a custom entity. */
|
|
3063
|
+
async createInstance(type, draft, auth2 = SERVICE9) {
|
|
3064
|
+
return this.ctx.http.request({
|
|
3065
|
+
method: "POST",
|
|
3066
|
+
path: this.instancesBase(type),
|
|
3067
|
+
auth: auth2,
|
|
3068
|
+
body: draft
|
|
3069
|
+
});
|
|
3070
|
+
}
|
|
3071
|
+
/** Replace an instance (full `PUT`). */
|
|
3072
|
+
async replaceInstance(type, id, draft, auth2 = SERVICE9) {
|
|
3073
|
+
return this.ctx.http.request({
|
|
3074
|
+
method: "PUT",
|
|
3075
|
+
path: `${this.instancesBase(type)}/${encodeURIComponent(id)}`,
|
|
3076
|
+
auth: auth2,
|
|
3077
|
+
body: draft
|
|
3078
|
+
});
|
|
3079
|
+
}
|
|
3080
|
+
/** Partially update an instance (`PATCH`). */
|
|
3081
|
+
async patchInstance(type, id, patch, auth2 = SERVICE9) {
|
|
3082
|
+
return this.ctx.http.request({
|
|
3083
|
+
method: "PATCH",
|
|
3084
|
+
path: `${this.instancesBase(type)}/${encodeURIComponent(id)}`,
|
|
3085
|
+
auth: auth2,
|
|
3086
|
+
body: patch
|
|
3087
|
+
});
|
|
3088
|
+
}
|
|
3089
|
+
/** Delete an instance by id. */
|
|
3090
|
+
async deleteInstance(type, id, auth2 = SERVICE9) {
|
|
3091
|
+
await this.ctx.http.request({
|
|
3092
|
+
method: "DELETE",
|
|
3093
|
+
path: `${this.instancesBase(type)}/${encodeURIComponent(id)}`,
|
|
3094
|
+
auth: auth2
|
|
3095
|
+
});
|
|
3096
|
+
}
|
|
3097
|
+
/**
|
|
3098
|
+
* Structured search over a custom entity's instances
|
|
3099
|
+
* (`POST /instances/search`), wrapped in {@link PaginatedItems}.
|
|
3100
|
+
*/
|
|
3101
|
+
async searchInstances(type, body, auth2 = SERVICE9) {
|
|
3102
|
+
const items = await this.ctx.http.request({
|
|
3103
|
+
method: "POST",
|
|
3104
|
+
path: `${this.instancesBase(type)}/search`,
|
|
3105
|
+
auth: auth2,
|
|
3106
|
+
body
|
|
3107
|
+
});
|
|
3108
|
+
return { items, pageNumber: 1, pageSize: items.length, hasNextPage: false };
|
|
3109
|
+
}
|
|
3110
|
+
};
|
|
3111
|
+
|
|
3112
|
+
// src/services/ai.ts
|
|
3113
|
+
var SERVICE10 = { kind: "service" };
|
|
3114
|
+
var AiService = class {
|
|
3115
|
+
constructor(ctx) {
|
|
3116
|
+
this.ctx = ctx;
|
|
3117
|
+
}
|
|
3118
|
+
ctx;
|
|
3119
|
+
base() {
|
|
3120
|
+
return `/ai-service/${this.ctx.tenant}`;
|
|
3121
|
+
}
|
|
3122
|
+
/** Generate text from a single prompt (`POST /texts`). Honors `maxTokens`. */
|
|
3123
|
+
async generateText(input, auth2 = SERVICE10) {
|
|
3124
|
+
return this.ctx.http.request({
|
|
3125
|
+
method: "POST",
|
|
3126
|
+
path: `${this.base()}/texts`,
|
|
3127
|
+
auth: auth2,
|
|
3128
|
+
body: input
|
|
3129
|
+
});
|
|
3130
|
+
}
|
|
3131
|
+
/** Run a chat completion over a message list (`POST /completions`). No `maxTokens`. */
|
|
3132
|
+
async complete(input, auth2 = SERVICE10) {
|
|
3133
|
+
return this.ctx.http.request({
|
|
3134
|
+
method: "POST",
|
|
3135
|
+
path: `${this.base()}/completions`,
|
|
3136
|
+
auth: auth2,
|
|
3137
|
+
body: input
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
/** List all agentic agents. */
|
|
3141
|
+
async listAgents(auth2 = SERVICE10) {
|
|
3142
|
+
return this.ctx.http.request({
|
|
3143
|
+
method: "GET",
|
|
3144
|
+
path: `${this.base()}/agentic/agents`,
|
|
3145
|
+
auth: auth2
|
|
3146
|
+
});
|
|
3147
|
+
}
|
|
3148
|
+
/** Retrieve one agent by id. */
|
|
3149
|
+
async getAgent(id, auth2 = SERVICE10) {
|
|
3150
|
+
return this.ctx.http.request({
|
|
3151
|
+
method: "GET",
|
|
3152
|
+
path: `${this.base()}/agentic/agents/${encodeURIComponent(id)}`,
|
|
3153
|
+
auth: auth2
|
|
3154
|
+
});
|
|
3155
|
+
}
|
|
3156
|
+
/** Create-or-replace an agent by id (`PUT`). Takes the agent write shape. */
|
|
3157
|
+
async upsertAgent(id, agent, auth2 = SERVICE10) {
|
|
3158
|
+
return this.ctx.http.request({
|
|
3159
|
+
method: "PUT",
|
|
3160
|
+
path: `${this.base()}/agentic/agents/${encodeURIComponent(id)}`,
|
|
3161
|
+
auth: auth2,
|
|
3162
|
+
body: agent
|
|
3163
|
+
});
|
|
3164
|
+
}
|
|
3165
|
+
/**
|
|
3166
|
+
* Patch an agent with an op array (`PATCH`). `ops` use the upstream
|
|
3167
|
+
* UPPERCASE enum (`ADD | REMOVE | REPLACE`) and are sent verbatim — this is
|
|
3168
|
+
* NOT RFC-6902 JSON-Patch.
|
|
3169
|
+
*/
|
|
3170
|
+
async patchAgent(id, ops, auth2 = SERVICE10) {
|
|
3171
|
+
return this.ctx.http.request({
|
|
3172
|
+
method: "PATCH",
|
|
3173
|
+
path: `${this.base()}/agentic/agents/${encodeURIComponent(id)}`,
|
|
3174
|
+
auth: auth2,
|
|
3175
|
+
body: ops
|
|
3176
|
+
});
|
|
3177
|
+
}
|
|
3178
|
+
/**
|
|
3179
|
+
* Delete an agent by id. Pass `{ force: true }` to delete an agent that is
|
|
3180
|
+
* still referenced elsewhere (`?force=true`).
|
|
3181
|
+
*/
|
|
3182
|
+
async deleteAgent(id, auth2 = SERVICE10, opts = {}) {
|
|
3183
|
+
await this.ctx.http.request({
|
|
3184
|
+
method: "DELETE",
|
|
3185
|
+
path: `${this.base()}/agentic/agents/${encodeURIComponent(id)}`,
|
|
3186
|
+
auth: auth2,
|
|
3187
|
+
...opts.force ? { query: { force: "true" } } : {}
|
|
3188
|
+
});
|
|
3189
|
+
}
|
|
3190
|
+
/** Server-side agent search (`POST /agentic/agents/search`). */
|
|
3191
|
+
async searchAgents(query, auth2 = SERVICE10) {
|
|
3192
|
+
return this.ctx.http.request({
|
|
3193
|
+
method: "POST",
|
|
3194
|
+
path: `${this.base()}/agentic/agents/search`,
|
|
3195
|
+
auth: auth2,
|
|
3196
|
+
body: query
|
|
3197
|
+
});
|
|
3198
|
+
}
|
|
3199
|
+
/**
|
|
3200
|
+
* Synchronous agent chat (`POST /agentic/chat`). Returns the response
|
|
3201
|
+
* ARRAY verbatim (the upstream contract is an array, not a single object).
|
|
3202
|
+
*/
|
|
3203
|
+
async chat(input, auth2 = SERVICE10) {
|
|
3204
|
+
return this.ctx.http.request({
|
|
3205
|
+
method: "POST",
|
|
3206
|
+
path: `${this.base()}/agentic/chat`,
|
|
3207
|
+
auth: auth2,
|
|
3208
|
+
body: input
|
|
3209
|
+
});
|
|
3210
|
+
}
|
|
3211
|
+
/**
|
|
3212
|
+
* Fire-and-forget agent chat (`POST /agentic/chat-async`, HTTP 201).
|
|
3213
|
+
* Returns the job-id ARRAY verbatim.
|
|
3214
|
+
*/
|
|
3215
|
+
async chatAsync(input, auth2 = SERVICE10) {
|
|
3216
|
+
return this.ctx.http.request({
|
|
3217
|
+
method: "POST",
|
|
3218
|
+
path: `${this.base()}/agentic/chat-async`,
|
|
3219
|
+
auth: auth2,
|
|
3220
|
+
body: input
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
};
|
|
3224
|
+
|
|
3225
|
+
// src/services/tax.ts
|
|
3226
|
+
var SERVICE11 = { kind: "service" };
|
|
3227
|
+
var TaxService = class {
|
|
3228
|
+
constructor(ctx) {
|
|
3229
|
+
this.ctx = ctx;
|
|
3230
|
+
}
|
|
3231
|
+
ctx;
|
|
3232
|
+
base() {
|
|
3233
|
+
return `/tax/${this.ctx.tenant}`;
|
|
3234
|
+
}
|
|
3235
|
+
/** List all per-location tax configurations. */
|
|
3236
|
+
async listTaxConfigs(auth2 = SERVICE11) {
|
|
3237
|
+
return this.ctx.http.request({
|
|
3238
|
+
method: "GET",
|
|
3239
|
+
path: `${this.base()}/taxes`,
|
|
3240
|
+
auth: auth2
|
|
3241
|
+
});
|
|
3242
|
+
}
|
|
3243
|
+
/** Retrieve one tax configuration by its location (country) code. */
|
|
3244
|
+
async getTaxConfig(locationCode, auth2 = SERVICE11) {
|
|
3245
|
+
return this.ctx.http.request({
|
|
3246
|
+
method: "GET",
|
|
3247
|
+
path: `${this.base()}/taxes/${encodeURIComponent(locationCode)}`,
|
|
3248
|
+
auth: auth2
|
|
3249
|
+
});
|
|
3250
|
+
}
|
|
3251
|
+
/** Create a tax configuration (`POST`). Returns the created `{ locationCode }`. */
|
|
3252
|
+
async createTaxConfig(input, auth2 = SERVICE11) {
|
|
3253
|
+
return this.ctx.http.request({
|
|
3254
|
+
method: "POST",
|
|
3255
|
+
path: `${this.base()}/taxes`,
|
|
3256
|
+
auth: auth2,
|
|
3257
|
+
body: input
|
|
3258
|
+
});
|
|
3259
|
+
}
|
|
3260
|
+
/**
|
|
3261
|
+
* Update a tax configuration by location code (`PUT`). `metadata.version` is
|
|
3262
|
+
* required (optimistic locking — a stale version yields 409).
|
|
3263
|
+
*/
|
|
3264
|
+
async updateTaxConfig(locationCode, input, auth2 = SERVICE11) {
|
|
3265
|
+
return this.ctx.http.request({
|
|
3266
|
+
method: "PUT",
|
|
3267
|
+
path: `${this.base()}/taxes/${encodeURIComponent(locationCode)}`,
|
|
3268
|
+
auth: auth2,
|
|
3269
|
+
body: input
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
/** Delete a tax configuration by location code. */
|
|
3273
|
+
async deleteTaxConfig(locationCode, auth2 = SERVICE11) {
|
|
3274
|
+
await this.ctx.http.request({
|
|
3275
|
+
method: "DELETE",
|
|
3276
|
+
path: `${this.base()}/taxes/${encodeURIComponent(locationCode)}`,
|
|
3277
|
+
auth: auth2
|
|
3278
|
+
});
|
|
3279
|
+
}
|
|
3280
|
+
/**
|
|
3281
|
+
* Calculate net/gross values for a price (`PUT /taxes/calculation-commands`).
|
|
3282
|
+
* Single command in, single result out.
|
|
3283
|
+
*/
|
|
3284
|
+
async calculateTax(request, auth2 = SERVICE11) {
|
|
3285
|
+
return this.ctx.http.request({
|
|
3286
|
+
method: "PUT",
|
|
3287
|
+
path: `${this.base()}/taxes/calculation-commands`,
|
|
3288
|
+
auth: auth2,
|
|
3289
|
+
body: request
|
|
3290
|
+
});
|
|
3291
|
+
}
|
|
3292
|
+
};
|
|
3293
|
+
|
|
3294
|
+
// src/services/coupon.ts
|
|
3295
|
+
var SERVICE12 = { kind: "service" };
|
|
3296
|
+
var CouponService = class {
|
|
3297
|
+
constructor(ctx) {
|
|
3298
|
+
this.ctx = ctx;
|
|
3299
|
+
}
|
|
3300
|
+
ctx;
|
|
3301
|
+
base() {
|
|
3302
|
+
return `/coupon/${this.ctx.tenant}`;
|
|
3303
|
+
}
|
|
3304
|
+
/** List coupons by criteria. Returns a plain array. */
|
|
3305
|
+
async listCoupons(query = {}, auth2 = SERVICE12) {
|
|
3306
|
+
return this.ctx.http.request({
|
|
3307
|
+
method: "GET",
|
|
3308
|
+
path: `${this.base()}/coupons`,
|
|
3309
|
+
auth: auth2,
|
|
3310
|
+
...Object.keys(query).length ? { query } : {}
|
|
3311
|
+
});
|
|
3312
|
+
}
|
|
3313
|
+
/** Retrieve one coupon by code. */
|
|
3314
|
+
async getCoupon(code, auth2 = SERVICE12) {
|
|
3315
|
+
return this.ctx.http.request({
|
|
3316
|
+
method: "GET",
|
|
3317
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
3318
|
+
auth: auth2
|
|
3319
|
+
});
|
|
3320
|
+
}
|
|
3321
|
+
/** Create a coupon (`POST`, HTTP 201). Returns the created resource's `{ id?, yrn? }`. */
|
|
3322
|
+
async createCoupon(input, auth2 = SERVICE12) {
|
|
3323
|
+
return this.ctx.http.request({
|
|
3324
|
+
method: "POST",
|
|
3325
|
+
path: `${this.base()}/coupons`,
|
|
3326
|
+
auth: auth2,
|
|
3327
|
+
body: input
|
|
3328
|
+
});
|
|
3329
|
+
}
|
|
3330
|
+
/** Replace a coupon by code (`PUT`). Resolves once the update is accepted. */
|
|
3331
|
+
async updateCoupon(code, input, auth2 = SERVICE12) {
|
|
3332
|
+
await this.ctx.http.request({
|
|
3333
|
+
method: "PUT",
|
|
3334
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
3335
|
+
auth: auth2,
|
|
3336
|
+
body: input
|
|
3337
|
+
});
|
|
3338
|
+
}
|
|
3339
|
+
/** Partially update a coupon by code (`PATCH` merge body). */
|
|
3340
|
+
async patchCoupon(code, patch, auth2 = SERVICE12) {
|
|
3341
|
+
await this.ctx.http.request({
|
|
3342
|
+
method: "PATCH",
|
|
3343
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
3344
|
+
auth: auth2,
|
|
3345
|
+
body: patch
|
|
3346
|
+
});
|
|
3347
|
+
}
|
|
3348
|
+
/** Delete a coupon by code. */
|
|
3349
|
+
async deleteCoupon(code, auth2 = SERVICE12) {
|
|
3350
|
+
await this.ctx.http.request({
|
|
3351
|
+
method: "DELETE",
|
|
3352
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}`,
|
|
3353
|
+
auth: auth2
|
|
3354
|
+
});
|
|
3355
|
+
}
|
|
3356
|
+
/**
|
|
3357
|
+
* Check whether a coupon can be redeemed (`POST /validation`). Resolves when
|
|
3358
|
+
* redeemable; throws an `EmporixError` otherwise (no response body).
|
|
3359
|
+
*/
|
|
3360
|
+
async validateCoupon(code, redemption, auth2 = SERVICE12) {
|
|
3361
|
+
await this.ctx.http.request({
|
|
3362
|
+
method: "POST",
|
|
3363
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}/validation`,
|
|
3364
|
+
auth: auth2,
|
|
3365
|
+
body: redemption
|
|
3366
|
+
});
|
|
3367
|
+
}
|
|
3368
|
+
/** List a coupon's redemptions by criteria. */
|
|
3369
|
+
async listRedemptions(code, query = {}, auth2 = SERVICE12) {
|
|
3370
|
+
return this.ctx.http.request({
|
|
3371
|
+
method: "GET",
|
|
3372
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions`,
|
|
3373
|
+
auth: auth2,
|
|
3374
|
+
...Object.keys(query).length ? { query } : {}
|
|
3375
|
+
});
|
|
3376
|
+
}
|
|
3377
|
+
/** Redeem a coupon by creating a redemption (`POST`, HTTP 201). Returns the resource location. */
|
|
3378
|
+
async redeemCoupon(code, redemption, auth2 = SERVICE12) {
|
|
3379
|
+
return this.ctx.http.request({
|
|
3380
|
+
method: "POST",
|
|
3381
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions`,
|
|
3382
|
+
auth: auth2,
|
|
3383
|
+
body: redemption
|
|
3384
|
+
});
|
|
3385
|
+
}
|
|
3386
|
+
/** Retrieve one redemption by id. */
|
|
3387
|
+
async getRedemption(code, id, auth2 = SERVICE12) {
|
|
3388
|
+
return this.ctx.http.request({
|
|
3389
|
+
method: "GET",
|
|
3390
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions/${encodeURIComponent(id)}`,
|
|
3391
|
+
auth: auth2
|
|
3392
|
+
});
|
|
3393
|
+
}
|
|
3394
|
+
/** Delete a redemption by id. */
|
|
3395
|
+
async deleteRedemption(code, id, auth2 = SERVICE12) {
|
|
3396
|
+
await this.ctx.http.request({
|
|
3397
|
+
method: "DELETE",
|
|
3398
|
+
path: `${this.base()}/coupons/${encodeURIComponent(code)}/redemptions/${encodeURIComponent(id)}`,
|
|
3399
|
+
auth: auth2
|
|
3400
|
+
});
|
|
3401
|
+
}
|
|
3402
|
+
/** Retrieve a customer's referral coupon (resolves to an empty body when none exists). */
|
|
3403
|
+
async getReferralCoupon(customerNumber, auth2 = SERVICE12) {
|
|
3404
|
+
return this.ctx.http.request({
|
|
3405
|
+
method: "GET",
|
|
3406
|
+
path: `${this.base()}/referral-coupons/${encodeURIComponent(customerNumber)}`,
|
|
3407
|
+
auth: auth2
|
|
3408
|
+
});
|
|
3409
|
+
}
|
|
3410
|
+
/** Create a referral coupon code for a customer (no request body). */
|
|
3411
|
+
async createReferralCoupon(customerNumber, auth2 = SERVICE12) {
|
|
3412
|
+
return this.ctx.http.request({
|
|
3413
|
+
method: "POST",
|
|
3414
|
+
path: `${this.base()}/referral-coupons/${encodeURIComponent(customerNumber)}`,
|
|
3415
|
+
auth: auth2
|
|
3416
|
+
});
|
|
3417
|
+
}
|
|
3418
|
+
};
|
|
3419
|
+
|
|
3420
|
+
// src/services/reward-points.ts
|
|
3421
|
+
var SERVICE13 = { kind: "service" };
|
|
3422
|
+
var RewardPointsService = class {
|
|
3423
|
+
constructor(ctx) {
|
|
3424
|
+
this.ctx = ctx;
|
|
3425
|
+
}
|
|
3426
|
+
ctx;
|
|
3427
|
+
/** Base without tenant (customer / public / batch endpoints). */
|
|
3428
|
+
base() {
|
|
3429
|
+
return `/reward-points`;
|
|
3430
|
+
}
|
|
3431
|
+
/** Tenant-scoped base (redeem options only). */
|
|
3432
|
+
tenantBase() {
|
|
3433
|
+
return `/reward-points/${this.ctx.tenant}`;
|
|
3434
|
+
}
|
|
3435
|
+
// --- Admin: customer points management (service token) ---
|
|
3436
|
+
/** Batch summary across all customers. */
|
|
3437
|
+
async listAllSummaries(query = {}, auth2 = SERVICE13) {
|
|
3438
|
+
return this.ctx.http.request({
|
|
3439
|
+
method: "GET",
|
|
3440
|
+
path: `${this.base()}/summaryBatch`,
|
|
3441
|
+
auth: auth2,
|
|
3442
|
+
...Object.keys(query).length ? { query } : {}
|
|
3443
|
+
});
|
|
3444
|
+
}
|
|
3445
|
+
/** Retrieve one customer's reward-points balance. */
|
|
3446
|
+
async getCustomerPoints(customerId, auth2 = SERVICE13) {
|
|
3447
|
+
return this.ctx.http.request({
|
|
3448
|
+
method: "GET",
|
|
3449
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}`,
|
|
3450
|
+
auth: auth2
|
|
3451
|
+
});
|
|
3452
|
+
}
|
|
3453
|
+
/** Create a reward-points entry for a customer. */
|
|
3454
|
+
async createCustomerPoints(customerId, input, auth2 = SERVICE13) {
|
|
3455
|
+
await this.ctx.http.request({
|
|
3456
|
+
method: "POST",
|
|
3457
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}`,
|
|
3458
|
+
auth: auth2,
|
|
3459
|
+
body: input
|
|
3460
|
+
});
|
|
3461
|
+
}
|
|
3462
|
+
/** Delete a customer's reward points. */
|
|
3463
|
+
async deleteCustomerPoints(customerId, auth2 = SERVICE13) {
|
|
3464
|
+
await this.ctx.http.request({
|
|
3465
|
+
method: "DELETE",
|
|
3466
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}`,
|
|
3467
|
+
auth: auth2
|
|
3468
|
+
});
|
|
3469
|
+
}
|
|
3470
|
+
/** Retrieve a reward-points summary for one customer. */
|
|
3471
|
+
async getCustomerSummary(customerId, auth2 = SERVICE13) {
|
|
3472
|
+
return this.ctx.http.request({
|
|
3473
|
+
method: "GET",
|
|
3474
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}/summary`,
|
|
3475
|
+
auth: auth2
|
|
3476
|
+
});
|
|
3477
|
+
}
|
|
3478
|
+
/** Add reward points for a customer. */
|
|
3479
|
+
async addPoints(customerId, input, auth2 = SERVICE13) {
|
|
3480
|
+
await this.ctx.http.request({
|
|
3481
|
+
method: "POST",
|
|
3482
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}/addPoints`,
|
|
3483
|
+
auth: auth2,
|
|
3484
|
+
body: input
|
|
3485
|
+
});
|
|
3486
|
+
}
|
|
3487
|
+
/** Redeem a customer's reward points (on behalf). */
|
|
3488
|
+
async redeemPoints(customerId, input, auth2 = SERVICE13) {
|
|
3489
|
+
await this.ctx.http.request({
|
|
3490
|
+
method: "POST",
|
|
3491
|
+
path: `${this.base()}/customer/${encodeURIComponent(customerId)}/redeemPoints`,
|
|
3492
|
+
auth: auth2,
|
|
3493
|
+
body: input
|
|
3494
|
+
});
|
|
3495
|
+
}
|
|
3496
|
+
// --- Storefront: the signed-in customer's own points (customer token required) ---
|
|
3497
|
+
/** The signed-in customer's reward-points balance. Requires a customer `auth`. */
|
|
3498
|
+
async getMyPoints(auth2) {
|
|
3499
|
+
return this.ctx.http.request({
|
|
3500
|
+
method: "GET",
|
|
3501
|
+
path: `${this.base()}/public/customer`,
|
|
3502
|
+
auth: auth2
|
|
3503
|
+
});
|
|
3504
|
+
}
|
|
3505
|
+
/** The signed-in customer's reward-points summary. Requires a customer `auth`. */
|
|
3506
|
+
async getMySummary(auth2) {
|
|
3507
|
+
return this.ctx.http.request({
|
|
3508
|
+
method: "GET",
|
|
3509
|
+
path: `${this.base()}/public/customer/summary`,
|
|
3510
|
+
auth: auth2
|
|
3511
|
+
});
|
|
3512
|
+
}
|
|
3513
|
+
/**
|
|
3514
|
+
* Redeem the signed-in customer's points for a coupon code. Requires a
|
|
3515
|
+
* customer `auth`. Returns the issued coupon `{ code }`.
|
|
3516
|
+
*/
|
|
3517
|
+
async redeemMyPoints(input, auth2) {
|
|
3518
|
+
return this.ctx.http.request({
|
|
3519
|
+
method: "POST",
|
|
3520
|
+
path: `${this.base()}/public/customer/redeem`,
|
|
3521
|
+
auth: auth2,
|
|
3522
|
+
body: input
|
|
3523
|
+
});
|
|
3524
|
+
}
|
|
3525
|
+
// --- Redeem options (tenant-scoped; read open to customer, management service-only) ---
|
|
3526
|
+
/** List redeem options. Defaults to the service token; pass a customer `auth` for storefront reads. */
|
|
3527
|
+
async listRedeemOptions(auth2 = SERVICE13) {
|
|
3528
|
+
return this.ctx.http.request({
|
|
3529
|
+
method: "GET",
|
|
3530
|
+
path: `${this.tenantBase()}/redeemOptions`,
|
|
3531
|
+
auth: auth2
|
|
3532
|
+
});
|
|
3533
|
+
}
|
|
3534
|
+
/** Create a redeem option. Returns the updated options list. */
|
|
3535
|
+
async createRedeemOption(input, auth2 = SERVICE13) {
|
|
3536
|
+
return this.ctx.http.request({
|
|
3537
|
+
method: "POST",
|
|
3538
|
+
path: `${this.tenantBase()}/redeemOptions`,
|
|
3539
|
+
auth: auth2,
|
|
3540
|
+
body: input
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
/** Update a redeem option by id. Resolves once accepted (no response body). */
|
|
3544
|
+
async updateRedeemOption(redeemOptionId, input, auth2 = SERVICE13) {
|
|
3545
|
+
await this.ctx.http.request({
|
|
3546
|
+
method: "PUT",
|
|
3547
|
+
path: `${this.tenantBase()}/redeemOptions/${encodeURIComponent(redeemOptionId)}`,
|
|
3548
|
+
auth: auth2,
|
|
3549
|
+
body: input
|
|
3550
|
+
});
|
|
3551
|
+
}
|
|
3552
|
+
/** Delete a redeem option by id. */
|
|
3553
|
+
async deleteRedeemOption(redeemOptionId, auth2 = SERVICE13) {
|
|
3554
|
+
await this.ctx.http.request({
|
|
3555
|
+
method: "DELETE",
|
|
3556
|
+
path: `${this.tenantBase()}/redeemOptions/${encodeURIComponent(redeemOptionId)}`,
|
|
3557
|
+
auth: auth2
|
|
3558
|
+
});
|
|
3559
|
+
}
|
|
3560
|
+
};
|
|
3561
|
+
|
|
3562
|
+
// src/services/brand.ts
|
|
3563
|
+
var SERVICE14 = { kind: "service" };
|
|
3564
|
+
var BrandService = class {
|
|
3565
|
+
constructor(ctx) {
|
|
3566
|
+
this.ctx = ctx;
|
|
3567
|
+
}
|
|
3568
|
+
ctx;
|
|
3569
|
+
base() {
|
|
3570
|
+
return `/brand/brands`;
|
|
3571
|
+
}
|
|
3572
|
+
/** List all brands. */
|
|
3573
|
+
async listBrands(query = {}, auth2 = SERVICE14) {
|
|
3574
|
+
return this.ctx.http.request({
|
|
3575
|
+
method: "GET",
|
|
3576
|
+
path: this.base(),
|
|
3577
|
+
auth: auth2,
|
|
3578
|
+
...Object.keys(query).length ? { query } : {}
|
|
3579
|
+
});
|
|
3580
|
+
}
|
|
3581
|
+
/** Retrieve one brand by id. */
|
|
3582
|
+
async getBrand(brandId, auth2 = SERVICE14) {
|
|
3583
|
+
return this.ctx.http.request({
|
|
3584
|
+
method: "GET",
|
|
3585
|
+
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
3586
|
+
auth: auth2
|
|
3587
|
+
});
|
|
3588
|
+
}
|
|
3589
|
+
/** Create a brand. */
|
|
3590
|
+
async createBrand(input, auth2 = SERVICE14) {
|
|
3591
|
+
return this.ctx.http.request({
|
|
3592
|
+
method: "POST",
|
|
3593
|
+
path: this.base(),
|
|
3594
|
+
auth: auth2,
|
|
3595
|
+
body: input
|
|
3596
|
+
});
|
|
3597
|
+
}
|
|
3598
|
+
/** Replace a brand by id. */
|
|
3599
|
+
async updateBrand(brandId, input, auth2 = SERVICE14) {
|
|
3600
|
+
return this.ctx.http.request({
|
|
3601
|
+
method: "PUT",
|
|
3602
|
+
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
3603
|
+
auth: auth2,
|
|
3604
|
+
body: input
|
|
3605
|
+
});
|
|
3606
|
+
}
|
|
3607
|
+
/** Partially update a brand by id. */
|
|
3608
|
+
async patchBrand(brandId, patch, auth2 = SERVICE14) {
|
|
3609
|
+
return this.ctx.http.request({
|
|
3610
|
+
method: "PATCH",
|
|
3611
|
+
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
3612
|
+
auth: auth2,
|
|
3613
|
+
body: patch
|
|
3614
|
+
});
|
|
3615
|
+
}
|
|
3616
|
+
/** Delete a brand by id. */
|
|
3617
|
+
async deleteBrand(brandId, auth2 = SERVICE14) {
|
|
3618
|
+
await this.ctx.http.request({
|
|
3619
|
+
method: "DELETE",
|
|
3620
|
+
path: `${this.base()}/${encodeURIComponent(brandId)}`,
|
|
3621
|
+
auth: auth2
|
|
3622
|
+
});
|
|
3623
|
+
}
|
|
3624
|
+
};
|
|
3625
|
+
|
|
3626
|
+
// src/services/label.ts
|
|
3627
|
+
var SERVICE15 = { kind: "service" };
|
|
3628
|
+
var LabelService = class {
|
|
3629
|
+
constructor(ctx) {
|
|
3630
|
+
this.ctx = ctx;
|
|
3631
|
+
}
|
|
3632
|
+
ctx;
|
|
3633
|
+
base() {
|
|
3634
|
+
return `/label/labels`;
|
|
3635
|
+
}
|
|
3636
|
+
/** List all labels. */
|
|
3637
|
+
async listLabels(query = {}, auth2 = SERVICE15) {
|
|
3638
|
+
return this.ctx.http.request({
|
|
3639
|
+
method: "GET",
|
|
3640
|
+
path: this.base(),
|
|
3641
|
+
auth: auth2,
|
|
3642
|
+
...Object.keys(query).length ? { query } : {}
|
|
3643
|
+
});
|
|
3644
|
+
}
|
|
3645
|
+
/** Retrieve one label by id. */
|
|
3646
|
+
async getLabel(labelId, auth2 = SERVICE15) {
|
|
3647
|
+
return this.ctx.http.request({
|
|
3648
|
+
method: "GET",
|
|
3649
|
+
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
3650
|
+
auth: auth2
|
|
3651
|
+
});
|
|
3652
|
+
}
|
|
3653
|
+
/** Create a label. */
|
|
3654
|
+
async createLabel(input, auth2 = SERVICE15) {
|
|
3655
|
+
return this.ctx.http.request({
|
|
3656
|
+
method: "POST",
|
|
3657
|
+
path: this.base(),
|
|
3658
|
+
auth: auth2,
|
|
3659
|
+
body: input
|
|
3660
|
+
});
|
|
3661
|
+
}
|
|
3662
|
+
/** Replace a label by id. */
|
|
3663
|
+
async updateLabel(labelId, input, auth2 = SERVICE15) {
|
|
3664
|
+
return this.ctx.http.request({
|
|
3665
|
+
method: "PUT",
|
|
3666
|
+
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
3667
|
+
auth: auth2,
|
|
3668
|
+
body: input
|
|
3669
|
+
});
|
|
3670
|
+
}
|
|
3671
|
+
/** Partially update a label by id. */
|
|
3672
|
+
async patchLabel(labelId, patch, auth2 = SERVICE15) {
|
|
3673
|
+
return this.ctx.http.request({
|
|
3674
|
+
method: "PATCH",
|
|
3675
|
+
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
3676
|
+
auth: auth2,
|
|
3677
|
+
body: patch
|
|
3678
|
+
});
|
|
3679
|
+
}
|
|
3680
|
+
/** Delete a label by id. */
|
|
3681
|
+
async deleteLabel(labelId, auth2 = SERVICE15) {
|
|
3682
|
+
await this.ctx.http.request({
|
|
3683
|
+
method: "DELETE",
|
|
3684
|
+
path: `${this.base()}/${encodeURIComponent(labelId)}`,
|
|
3685
|
+
auth: auth2
|
|
3686
|
+
});
|
|
3687
|
+
}
|
|
3688
|
+
};
|
|
3689
|
+
|
|
3690
|
+
// src/services/country.ts
|
|
3691
|
+
var SERVICE16 = { kind: "service" };
|
|
3692
|
+
var CountryService = class {
|
|
3693
|
+
constructor(ctx) {
|
|
3694
|
+
this.ctx = ctx;
|
|
3695
|
+
}
|
|
3696
|
+
ctx;
|
|
3697
|
+
base() {
|
|
3698
|
+
return `/country/${this.ctx.tenant}`;
|
|
3699
|
+
}
|
|
3700
|
+
/** List all countries. */
|
|
3701
|
+
async listCountries(query = {}, auth2 = SERVICE16) {
|
|
3702
|
+
return this.ctx.http.request({
|
|
3703
|
+
method: "GET",
|
|
3704
|
+
path: `${this.base()}/countries`,
|
|
3705
|
+
auth: auth2,
|
|
3706
|
+
...Object.keys(query).length ? { query } : {}
|
|
3707
|
+
});
|
|
3708
|
+
}
|
|
3709
|
+
/** Retrieve one country by code. */
|
|
3710
|
+
async getCountry(countryCode, auth2 = SERVICE16) {
|
|
3711
|
+
return this.ctx.http.request({
|
|
3712
|
+
method: "GET",
|
|
3713
|
+
path: `${this.base()}/countries/${encodeURIComponent(countryCode)}`,
|
|
3714
|
+
auth: auth2
|
|
3715
|
+
});
|
|
3716
|
+
}
|
|
3717
|
+
/** Partially update a country by code. Resolves once accepted (no response body). */
|
|
3718
|
+
async patchCountry(countryCode, patch, auth2 = SERVICE16) {
|
|
3719
|
+
await this.ctx.http.request({
|
|
3720
|
+
method: "PATCH",
|
|
3721
|
+
path: `${this.base()}/countries/${encodeURIComponent(countryCode)}`,
|
|
3722
|
+
auth: auth2,
|
|
3723
|
+
body: patch
|
|
3724
|
+
});
|
|
3725
|
+
}
|
|
3726
|
+
/** List all regions. */
|
|
3727
|
+
async listRegions(query = {}, auth2 = SERVICE16) {
|
|
3728
|
+
return this.ctx.http.request({
|
|
3729
|
+
method: "GET",
|
|
3730
|
+
path: `${this.base()}/regions`,
|
|
3731
|
+
auth: auth2,
|
|
3732
|
+
...Object.keys(query).length ? { query } : {}
|
|
3733
|
+
});
|
|
3734
|
+
}
|
|
3735
|
+
/** Retrieve one region by code. */
|
|
3736
|
+
async getRegion(regionCode, auth2 = SERVICE16) {
|
|
3737
|
+
return this.ctx.http.request({
|
|
3738
|
+
method: "GET",
|
|
3739
|
+
path: `${this.base()}/regions/${encodeURIComponent(regionCode)}`,
|
|
3740
|
+
auth: auth2
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
};
|
|
3744
|
+
|
|
3745
|
+
// src/services/currency.ts
|
|
3746
|
+
var SERVICE17 = { kind: "service" };
|
|
3747
|
+
var CurrencyService = class {
|
|
3748
|
+
constructor(ctx) {
|
|
3749
|
+
this.ctx = ctx;
|
|
3750
|
+
}
|
|
3751
|
+
ctx;
|
|
3752
|
+
base() {
|
|
3753
|
+
return `/currency/${this.ctx.tenant}`;
|
|
3754
|
+
}
|
|
3755
|
+
// --- Currencies ---
|
|
3756
|
+
/** List all currencies. */
|
|
3757
|
+
async listCurrencies(query = {}, auth2 = SERVICE17) {
|
|
3758
|
+
return this.ctx.http.request({
|
|
3759
|
+
method: "GET",
|
|
3760
|
+
path: `${this.base()}/currencies`,
|
|
3761
|
+
auth: auth2,
|
|
3762
|
+
...Object.keys(query).length ? { query } : {}
|
|
3763
|
+
});
|
|
3764
|
+
}
|
|
3765
|
+
/** Retrieve one currency by code. */
|
|
3766
|
+
async getCurrency(code, auth2 = SERVICE17) {
|
|
3767
|
+
return this.ctx.http.request({
|
|
3768
|
+
method: "GET",
|
|
3769
|
+
path: `${this.base()}/currencies/${encodeURIComponent(code)}`,
|
|
3770
|
+
auth: auth2
|
|
3771
|
+
});
|
|
3772
|
+
}
|
|
3773
|
+
/** Create a currency. */
|
|
3774
|
+
async createCurrency(input, auth2 = SERVICE17) {
|
|
3775
|
+
return this.ctx.http.request({
|
|
3776
|
+
method: "POST",
|
|
3777
|
+
path: `${this.base()}/currencies`,
|
|
3778
|
+
auth: auth2,
|
|
3779
|
+
body: input
|
|
3780
|
+
});
|
|
3781
|
+
}
|
|
3782
|
+
/** Update a currency by code. */
|
|
3783
|
+
async updateCurrency(code, input, auth2 = SERVICE17) {
|
|
3784
|
+
return this.ctx.http.request({
|
|
3785
|
+
method: "PUT",
|
|
3786
|
+
path: `${this.base()}/currencies/${encodeURIComponent(code)}`,
|
|
3787
|
+
auth: auth2,
|
|
3788
|
+
body: input
|
|
3789
|
+
});
|
|
3790
|
+
}
|
|
3791
|
+
/** Delete a currency by code. */
|
|
3792
|
+
async deleteCurrency(code, auth2 = SERVICE17) {
|
|
3793
|
+
await this.ctx.http.request({
|
|
3794
|
+
method: "DELETE",
|
|
3795
|
+
path: `${this.base()}/currencies/${encodeURIComponent(code)}`,
|
|
3796
|
+
auth: auth2
|
|
3797
|
+
});
|
|
3798
|
+
}
|
|
3799
|
+
// --- Exchange rates ---
|
|
3800
|
+
/** List all exchange rates. */
|
|
3801
|
+
async listExchangeRates(query = {}, auth2 = SERVICE17) {
|
|
3802
|
+
return this.ctx.http.request({
|
|
3803
|
+
method: "GET",
|
|
3804
|
+
path: `${this.base()}/exchanges`,
|
|
3805
|
+
auth: auth2,
|
|
3806
|
+
...Object.keys(query).length ? { query } : {}
|
|
3807
|
+
});
|
|
3808
|
+
}
|
|
3809
|
+
/** Retrieve one exchange rate by code. */
|
|
3810
|
+
async getExchangeRate(code, auth2 = SERVICE17) {
|
|
3811
|
+
return this.ctx.http.request({
|
|
3812
|
+
method: "GET",
|
|
3813
|
+
path: `${this.base()}/exchanges/${encodeURIComponent(code)}`,
|
|
3814
|
+
auth: auth2
|
|
3815
|
+
});
|
|
3816
|
+
}
|
|
3817
|
+
/** Create an exchange rate. */
|
|
3818
|
+
async createExchangeRate(input, auth2 = SERVICE17) {
|
|
3819
|
+
return this.ctx.http.request({
|
|
3820
|
+
method: "POST",
|
|
3821
|
+
path: `${this.base()}/exchanges`,
|
|
3822
|
+
auth: auth2,
|
|
3823
|
+
body: input
|
|
3824
|
+
});
|
|
3825
|
+
}
|
|
3826
|
+
/** Update an exchange rate by code. */
|
|
3827
|
+
async updateExchangeRate(code, input, auth2 = SERVICE17) {
|
|
3828
|
+
return this.ctx.http.request({
|
|
3829
|
+
method: "PUT",
|
|
3830
|
+
path: `${this.base()}/exchanges/${encodeURIComponent(code)}`,
|
|
3831
|
+
auth: auth2,
|
|
3832
|
+
body: input
|
|
3833
|
+
});
|
|
3834
|
+
}
|
|
3835
|
+
/** Delete an exchange rate by code. */
|
|
3836
|
+
async deleteExchangeRate(code, auth2 = SERVICE17) {
|
|
3837
|
+
await this.ctx.http.request({
|
|
3838
|
+
method: "DELETE",
|
|
3839
|
+
path: `${this.base()}/exchanges/${encodeURIComponent(code)}`,
|
|
3840
|
+
auth: auth2
|
|
3841
|
+
});
|
|
3842
|
+
}
|
|
3843
|
+
};
|
|
3844
|
+
|
|
3845
|
+
// src/services/shipping.ts
|
|
3846
|
+
var SERVICE18 = { kind: "service" };
|
|
3847
|
+
var ShippingService = class {
|
|
3848
|
+
constructor(ctx) {
|
|
3849
|
+
this.ctx = ctx;
|
|
3850
|
+
}
|
|
3851
|
+
ctx;
|
|
3852
|
+
base() {
|
|
3853
|
+
return `/shipping/${this.ctx.tenant}`;
|
|
3854
|
+
}
|
|
3855
|
+
siteBase(site) {
|
|
3856
|
+
return `${this.base()}/${encodeURIComponent(site)}`;
|
|
3857
|
+
}
|
|
3858
|
+
// --- Sites ---
|
|
3859
|
+
/** Find shipping-related sites by postal code (`POST /findSite`). */
|
|
3860
|
+
async findSites(input, auth2 = SERVICE18) {
|
|
3861
|
+
return this.ctx.http.request({
|
|
3862
|
+
method: "POST",
|
|
3863
|
+
path: `${this.base()}/findSite`,
|
|
3864
|
+
auth: auth2,
|
|
3865
|
+
body: input
|
|
3866
|
+
});
|
|
3867
|
+
}
|
|
3868
|
+
// --- Zones ---
|
|
3869
|
+
/** List shipping zones for a site. */
|
|
3870
|
+
async listZones(site, query = {}, auth2 = SERVICE18) {
|
|
3871
|
+
return this.ctx.http.request({
|
|
3872
|
+
method: "GET",
|
|
3873
|
+
path: `${this.siteBase(site)}/zones`,
|
|
3874
|
+
auth: auth2,
|
|
3875
|
+
...Object.keys(query).length ? { query } : {}
|
|
3876
|
+
});
|
|
3877
|
+
}
|
|
3878
|
+
/** Retrieve one shipping zone. */
|
|
3879
|
+
async getZone(site, zoneId, auth2 = SERVICE18) {
|
|
3880
|
+
return this.ctx.http.request({
|
|
3881
|
+
method: "GET",
|
|
3882
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
3883
|
+
auth: auth2
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
3886
|
+
/** Create a shipping zone. */
|
|
3887
|
+
async createZone(site, zone, auth2 = SERVICE18) {
|
|
3888
|
+
return this.ctx.http.request({
|
|
3889
|
+
method: "POST",
|
|
3890
|
+
path: `${this.siteBase(site)}/zones`,
|
|
3891
|
+
auth: auth2,
|
|
3892
|
+
body: zone
|
|
3893
|
+
});
|
|
3894
|
+
}
|
|
3895
|
+
/** Replace a shipping zone. */
|
|
3896
|
+
async updateZone(site, zoneId, zone, auth2 = SERVICE18) {
|
|
3897
|
+
await this.ctx.http.request({
|
|
3898
|
+
method: "PUT",
|
|
3899
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
3900
|
+
auth: auth2,
|
|
3901
|
+
body: zone
|
|
3902
|
+
});
|
|
3903
|
+
}
|
|
3904
|
+
/** Partially update a shipping zone. */
|
|
3905
|
+
async patchZone(site, zoneId, patch, auth2 = SERVICE18) {
|
|
3906
|
+
await this.ctx.http.request({
|
|
3907
|
+
method: "PATCH",
|
|
3908
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
3909
|
+
auth: auth2,
|
|
3910
|
+
body: patch
|
|
3911
|
+
});
|
|
3912
|
+
}
|
|
3913
|
+
/** Delete a shipping zone. */
|
|
3914
|
+
async deleteZone(site, zoneId, auth2 = SERVICE18) {
|
|
3915
|
+
await this.ctx.http.request({
|
|
3916
|
+
method: "DELETE",
|
|
3917
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}`,
|
|
3918
|
+
auth: auth2
|
|
3919
|
+
});
|
|
3920
|
+
}
|
|
3921
|
+
// --- Methods (per zone) ---
|
|
3922
|
+
/** List shipping methods of a zone. */
|
|
3923
|
+
async listMethods(site, zoneId, query = {}, auth2 = SERVICE18) {
|
|
3924
|
+
return this.ctx.http.request({
|
|
3925
|
+
method: "GET",
|
|
3926
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods`,
|
|
3927
|
+
auth: auth2,
|
|
3928
|
+
...Object.keys(query).length ? { query } : {}
|
|
3929
|
+
});
|
|
3930
|
+
}
|
|
3931
|
+
/** Retrieve one shipping method. */
|
|
3932
|
+
async getMethod(site, zoneId, methodId, auth2 = SERVICE18) {
|
|
3933
|
+
return this.ctx.http.request({
|
|
3934
|
+
method: "GET",
|
|
3935
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
3936
|
+
auth: auth2
|
|
3937
|
+
});
|
|
3938
|
+
}
|
|
3939
|
+
/** Create a shipping method in a zone. */
|
|
3940
|
+
async createMethod(site, zoneId, method, auth2 = SERVICE18) {
|
|
3941
|
+
return this.ctx.http.request({
|
|
3942
|
+
method: "POST",
|
|
3943
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods`,
|
|
3944
|
+
auth: auth2,
|
|
3945
|
+
body: method
|
|
3946
|
+
});
|
|
3947
|
+
}
|
|
3948
|
+
/** Replace a shipping method. */
|
|
3949
|
+
async updateMethod(site, zoneId, methodId, method, auth2 = SERVICE18) {
|
|
3950
|
+
await this.ctx.http.request({
|
|
3951
|
+
method: "PUT",
|
|
3952
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
3953
|
+
auth: auth2,
|
|
3954
|
+
body: method
|
|
3955
|
+
});
|
|
3956
|
+
}
|
|
3957
|
+
/** Partially update a shipping method. */
|
|
3958
|
+
async patchMethod(site, zoneId, methodId, patch, auth2 = SERVICE18) {
|
|
3959
|
+
await this.ctx.http.request({
|
|
3960
|
+
method: "PATCH",
|
|
3961
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
3962
|
+
auth: auth2,
|
|
3963
|
+
body: patch
|
|
3964
|
+
});
|
|
3965
|
+
}
|
|
3966
|
+
/** Delete a shipping method. */
|
|
3967
|
+
async deleteMethod(site, zoneId, methodId, auth2 = SERVICE18) {
|
|
3968
|
+
await this.ctx.http.request({
|
|
3969
|
+
method: "DELETE",
|
|
3970
|
+
path: `${this.siteBase(site)}/zones/${encodeURIComponent(zoneId)}/methods/${encodeURIComponent(methodId)}`,
|
|
3971
|
+
auth: auth2
|
|
3972
|
+
});
|
|
3973
|
+
}
|
|
3974
|
+
// --- Cost / quote ---
|
|
3975
|
+
/** Calculate the final shipping cost (`POST /quote`). */
|
|
3976
|
+
async quote(site, input, auth2 = SERVICE18) {
|
|
3977
|
+
return this.ctx.http.request({
|
|
3978
|
+
method: "POST",
|
|
3979
|
+
path: `${this.siteBase(site)}/quote`,
|
|
3980
|
+
auth: auth2,
|
|
3981
|
+
body: input
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
/** Calculate the minimum shipping cost (`POST /quote/minimum`). */
|
|
3985
|
+
async quoteMinimum(site, input, auth2 = SERVICE18) {
|
|
3986
|
+
return this.ctx.http.request({
|
|
3987
|
+
method: "POST",
|
|
3988
|
+
path: `${this.siteBase(site)}/quote/minimum`,
|
|
3989
|
+
auth: auth2,
|
|
3990
|
+
body: input
|
|
3991
|
+
});
|
|
3992
|
+
}
|
|
3993
|
+
/** Calculate the shipping cost for a given slot (`POST /quote/slot`). */
|
|
3994
|
+
async quoteSlot(site, input, auth2 = SERVICE18) {
|
|
3995
|
+
return this.ctx.http.request({
|
|
3996
|
+
method: "POST",
|
|
3997
|
+
path: `${this.siteBase(site)}/quote/slot`,
|
|
3998
|
+
auth: auth2,
|
|
3999
|
+
body: input
|
|
4000
|
+
});
|
|
4001
|
+
}
|
|
4002
|
+
// --- Groups ---
|
|
4003
|
+
/** List shipping groups for a site. */
|
|
4004
|
+
async listGroups(site, query = {}, auth2 = SERVICE18) {
|
|
4005
|
+
return this.ctx.http.request({
|
|
4006
|
+
method: "GET",
|
|
4007
|
+
path: `${this.siteBase(site)}/groups`,
|
|
4008
|
+
auth: auth2,
|
|
4009
|
+
...Object.keys(query).length ? { query } : {}
|
|
4010
|
+
});
|
|
4011
|
+
}
|
|
4012
|
+
/** Retrieve one shipping group. */
|
|
4013
|
+
async getGroup(site, groupId, auth2 = SERVICE18) {
|
|
4014
|
+
return this.ctx.http.request({
|
|
4015
|
+
method: "GET",
|
|
4016
|
+
path: `${this.siteBase(site)}/groups/${encodeURIComponent(groupId)}`,
|
|
4017
|
+
auth: auth2
|
|
4018
|
+
});
|
|
4019
|
+
}
|
|
4020
|
+
/** Create a shipping group. */
|
|
4021
|
+
async createGroup(site, group, auth2 = SERVICE18) {
|
|
4022
|
+
return this.ctx.http.request({
|
|
4023
|
+
method: "POST",
|
|
4024
|
+
path: `${this.siteBase(site)}/groups`,
|
|
4025
|
+
auth: auth2,
|
|
4026
|
+
body: group
|
|
4027
|
+
});
|
|
4028
|
+
}
|
|
4029
|
+
/** Replace a shipping group. */
|
|
4030
|
+
async updateGroup(site, groupId, group, auth2 = SERVICE18) {
|
|
4031
|
+
await this.ctx.http.request({
|
|
4032
|
+
method: "PUT",
|
|
4033
|
+
path: `${this.siteBase(site)}/groups/${encodeURIComponent(groupId)}`,
|
|
4034
|
+
auth: auth2,
|
|
4035
|
+
body: group
|
|
4036
|
+
});
|
|
4037
|
+
}
|
|
4038
|
+
/** Delete a shipping group. */
|
|
4039
|
+
async deleteGroup(site, groupId, auth2 = SERVICE18) {
|
|
4040
|
+
await this.ctx.http.request({
|
|
4041
|
+
method: "DELETE",
|
|
4042
|
+
path: `${this.siteBase(site)}/groups/${encodeURIComponent(groupId)}`,
|
|
4043
|
+
auth: auth2
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
// --- Customer-group relations ---
|
|
4047
|
+
/** List customer-group relations for a site. */
|
|
4048
|
+
async listCgRelations(site, query = {}, auth2 = SERVICE18) {
|
|
4049
|
+
return this.ctx.http.request({
|
|
4050
|
+
method: "GET",
|
|
4051
|
+
path: `${this.siteBase(site)}/cgrelations`,
|
|
4052
|
+
auth: auth2,
|
|
4053
|
+
...Object.keys(query).length ? { query } : {}
|
|
4054
|
+
});
|
|
4055
|
+
}
|
|
4056
|
+
/** Retrieve a customer's customer-group relations. */
|
|
4057
|
+
async getCgRelations(site, customerId, auth2 = SERVICE18) {
|
|
4058
|
+
return this.ctx.http.request({
|
|
4059
|
+
method: "GET",
|
|
4060
|
+
path: `${this.siteBase(site)}/cgrelations/${encodeURIComponent(customerId)}`,
|
|
4061
|
+
auth: auth2
|
|
4062
|
+
});
|
|
4063
|
+
}
|
|
4064
|
+
/** Create a customer-group relation. */
|
|
4065
|
+
async createCgRelation(site, relation, auth2 = SERVICE18) {
|
|
4066
|
+
return this.ctx.http.request({
|
|
4067
|
+
method: "POST",
|
|
4068
|
+
path: `${this.siteBase(site)}/cgrelations`,
|
|
4069
|
+
auth: auth2,
|
|
4070
|
+
body: relation
|
|
4071
|
+
});
|
|
4072
|
+
}
|
|
4073
|
+
/** Update a customer's customer-group relations. */
|
|
4074
|
+
async updateCgRelations(site, customerId, relation, auth2 = SERVICE18) {
|
|
4075
|
+
await this.ctx.http.request({
|
|
4076
|
+
method: "PUT",
|
|
4077
|
+
path: `${this.siteBase(site)}/cgrelations/${encodeURIComponent(customerId)}`,
|
|
4078
|
+
auth: auth2,
|
|
4079
|
+
body: relation
|
|
4080
|
+
});
|
|
4081
|
+
}
|
|
4082
|
+
/** Delete a customer's customer-group relation. */
|
|
4083
|
+
async deleteCgRelation(site, customerId, auth2 = SERVICE18) {
|
|
4084
|
+
await this.ctx.http.request({
|
|
4085
|
+
method: "DELETE",
|
|
4086
|
+
path: `${this.siteBase(site)}/cgrelations/${encodeURIComponent(customerId)}`,
|
|
4087
|
+
auth: auth2
|
|
4088
|
+
});
|
|
4089
|
+
}
|
|
4090
|
+
// --- Phase 2: delivery windows ---
|
|
4091
|
+
/** Retrieve delivery windows for a delivery area + cart. */
|
|
4092
|
+
async getAreaDeliveryWindows(deliveryAreaId, cartId, auth2 = SERVICE18) {
|
|
4093
|
+
return this.ctx.http.request({
|
|
4094
|
+
method: "GET",
|
|
4095
|
+
path: `${this.base()}/areaDeliveryTimes/${encodeURIComponent(deliveryAreaId)}/${encodeURIComponent(cartId)}`,
|
|
4096
|
+
auth: auth2
|
|
4097
|
+
});
|
|
4098
|
+
}
|
|
4099
|
+
/** Retrieve delivery windows for a cart. */
|
|
4100
|
+
async getCartDeliveryWindows(cartId, auth2 = SERVICE18) {
|
|
4101
|
+
return this.ctx.http.request({
|
|
4102
|
+
method: "GET",
|
|
4103
|
+
path: `${this.base()}/actualDeliveryWindows/${encodeURIComponent(cartId)}`,
|
|
4104
|
+
auth: auth2
|
|
4105
|
+
});
|
|
4106
|
+
}
|
|
4107
|
+
/** Increment the delivery-window counter. */
|
|
4108
|
+
async incrementDeliveryWindowCounter(input, auth2 = SERVICE18) {
|
|
4109
|
+
await this.ctx.http.request({
|
|
4110
|
+
method: "POST",
|
|
4111
|
+
path: `${this.base()}/actualDeliveryWindows/incrementCounter`,
|
|
4112
|
+
auth: auth2,
|
|
4113
|
+
body: input
|
|
4114
|
+
});
|
|
4115
|
+
}
|
|
4116
|
+
/** Validate a delivery window. Resolves when valid; throws otherwise. */
|
|
4117
|
+
async validateDeliveryWindow(input, auth2 = SERVICE18) {
|
|
4118
|
+
await this.ctx.http.request({
|
|
4119
|
+
method: "POST",
|
|
4120
|
+
path: `${this.base()}/deliveryWindowValidation`,
|
|
4121
|
+
auth: auth2,
|
|
4122
|
+
body: input
|
|
4123
|
+
});
|
|
4124
|
+
}
|
|
4125
|
+
// --- Phase 2: delivery times ---
|
|
4126
|
+
/** List all delivery times. */
|
|
4127
|
+
async listDeliveryTimes(query = {}, auth2 = SERVICE18) {
|
|
4128
|
+
return this.ctx.http.request({
|
|
4129
|
+
method: "GET",
|
|
4130
|
+
path: `${this.base()}/delivery-times`,
|
|
4131
|
+
auth: auth2,
|
|
4132
|
+
...Object.keys(query).length ? { query } : {}
|
|
4133
|
+
});
|
|
4134
|
+
}
|
|
4135
|
+
/** Retrieve one delivery time. */
|
|
4136
|
+
async getDeliveryTime(deliveryTimeId, auth2 = SERVICE18) {
|
|
4137
|
+
return this.ctx.http.request({
|
|
4138
|
+
method: "GET",
|
|
4139
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
4140
|
+
auth: auth2
|
|
4141
|
+
});
|
|
4142
|
+
}
|
|
4143
|
+
/** Create a delivery time. */
|
|
4144
|
+
async createDeliveryTime(input, auth2 = SERVICE18) {
|
|
4145
|
+
return this.ctx.http.request({
|
|
4146
|
+
method: "POST",
|
|
4147
|
+
path: `${this.base()}/delivery-times`,
|
|
4148
|
+
auth: auth2,
|
|
4149
|
+
body: input
|
|
4150
|
+
});
|
|
4151
|
+
}
|
|
4152
|
+
/** Create multiple delivery times (`POST /delivery-times/bulk`). */
|
|
4153
|
+
async createDeliveryTimesBulk(inputs, auth2 = SERVICE18) {
|
|
4154
|
+
return this.ctx.http.request({
|
|
4155
|
+
method: "POST",
|
|
4156
|
+
path: `${this.base()}/delivery-times/bulk`,
|
|
4157
|
+
auth: auth2,
|
|
4158
|
+
body: inputs
|
|
4159
|
+
});
|
|
4160
|
+
}
|
|
4161
|
+
/** Replace a delivery time. */
|
|
4162
|
+
async updateDeliveryTime(deliveryTimeId, input, auth2 = SERVICE18) {
|
|
4163
|
+
await this.ctx.http.request({
|
|
4164
|
+
method: "PUT",
|
|
4165
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
4166
|
+
auth: auth2,
|
|
4167
|
+
body: input
|
|
4168
|
+
});
|
|
4169
|
+
}
|
|
4170
|
+
/** Partially update a delivery time (JSON-Patch op array). */
|
|
4171
|
+
async patchDeliveryTime(deliveryTimeId, ops, auth2 = SERVICE18) {
|
|
4172
|
+
await this.ctx.http.request({
|
|
4173
|
+
method: "PATCH",
|
|
4174
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
4175
|
+
auth: auth2,
|
|
4176
|
+
body: ops
|
|
4177
|
+
});
|
|
4178
|
+
}
|
|
4179
|
+
/** Delete a delivery time. */
|
|
4180
|
+
async deleteDeliveryTime(deliveryTimeId, auth2 = SERVICE18) {
|
|
4181
|
+
await this.ctx.http.request({
|
|
4182
|
+
method: "DELETE",
|
|
4183
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}`,
|
|
4184
|
+
auth: auth2
|
|
4185
|
+
});
|
|
4186
|
+
}
|
|
4187
|
+
// --- Phase 2: delivery time slots ---
|
|
4188
|
+
/** List slots of a delivery time. */
|
|
4189
|
+
async listSlots(deliveryTimeId, auth2 = SERVICE18) {
|
|
4190
|
+
return this.ctx.http.request({
|
|
4191
|
+
method: "GET",
|
|
4192
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots`,
|
|
4193
|
+
auth: auth2
|
|
4194
|
+
});
|
|
4195
|
+
}
|
|
4196
|
+
/** Retrieve one slot. */
|
|
4197
|
+
async getSlot(deliveryTimeId, slotId, auth2 = SERVICE18) {
|
|
4198
|
+
return this.ctx.http.request({
|
|
4199
|
+
method: "GET",
|
|
4200
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
4201
|
+
auth: auth2
|
|
4202
|
+
});
|
|
4203
|
+
}
|
|
4204
|
+
/** Create a slot in a delivery time. */
|
|
4205
|
+
async createSlot(deliveryTimeId, input, auth2 = SERVICE18) {
|
|
4206
|
+
return this.ctx.http.request({
|
|
4207
|
+
method: "POST",
|
|
4208
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots`,
|
|
4209
|
+
auth: auth2,
|
|
4210
|
+
body: input
|
|
4211
|
+
});
|
|
4212
|
+
}
|
|
4213
|
+
/** Replace a slot. */
|
|
4214
|
+
async updateSlot(deliveryTimeId, slotId, input, auth2 = SERVICE18) {
|
|
4215
|
+
await this.ctx.http.request({
|
|
4216
|
+
method: "PUT",
|
|
4217
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
4218
|
+
auth: auth2,
|
|
4219
|
+
body: input
|
|
4220
|
+
});
|
|
4221
|
+
}
|
|
4222
|
+
/** Partially update a slot (JSON-Patch op array). */
|
|
4223
|
+
async patchSlot(deliveryTimeId, slotId, ops, auth2 = SERVICE18) {
|
|
4224
|
+
await this.ctx.http.request({
|
|
4225
|
+
method: "PATCH",
|
|
4226
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
4227
|
+
auth: auth2,
|
|
4228
|
+
body: ops
|
|
4229
|
+
});
|
|
4230
|
+
}
|
|
4231
|
+
/** Delete a slot. */
|
|
4232
|
+
async deleteSlot(deliveryTimeId, slotId, auth2 = SERVICE18) {
|
|
4233
|
+
await this.ctx.http.request({
|
|
4234
|
+
method: "DELETE",
|
|
4235
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots/${encodeURIComponent(slotId)}`,
|
|
4236
|
+
auth: auth2
|
|
4237
|
+
});
|
|
4238
|
+
}
|
|
4239
|
+
/** Delete all slots of a delivery time. */
|
|
4240
|
+
async deleteAllSlots(deliveryTimeId, auth2 = SERVICE18) {
|
|
4241
|
+
await this.ctx.http.request({
|
|
4242
|
+
method: "DELETE",
|
|
4243
|
+
path: `${this.base()}/delivery-times/${encodeURIComponent(deliveryTimeId)}/slots`,
|
|
4244
|
+
auth: auth2
|
|
4245
|
+
});
|
|
4246
|
+
}
|
|
4247
|
+
// --- Phase 2: delivery cycles ---
|
|
4248
|
+
/** Generate a delivery cycle (`POST /delivery-cycles/generate`). Returns the cycle id. */
|
|
4249
|
+
async generateDeliveryCycle(input, auth2 = SERVICE18) {
|
|
4250
|
+
return this.ctx.http.request({
|
|
4251
|
+
method: "POST",
|
|
4252
|
+
path: `${this.base()}/delivery-cycles/generate`,
|
|
4253
|
+
auth: auth2,
|
|
4254
|
+
body: input
|
|
4255
|
+
});
|
|
4256
|
+
}
|
|
4257
|
+
};
|
|
4258
|
+
|
|
4259
|
+
// src/services/returns.ts
|
|
4260
|
+
var SERVICE19 = { kind: "service" };
|
|
4261
|
+
var ReturnsService = class {
|
|
4262
|
+
constructor(ctx) {
|
|
4263
|
+
this.ctx = ctx;
|
|
4264
|
+
}
|
|
4265
|
+
ctx;
|
|
4266
|
+
base() {
|
|
4267
|
+
return `/return/${this.ctx.tenant}/returns`;
|
|
4268
|
+
}
|
|
4269
|
+
/** List returns (paged; supports `pageSize`/`pageNumber`/`sort`/`q`). */
|
|
4270
|
+
async listReturns(query = {}, auth2 = SERVICE19) {
|
|
4271
|
+
return this.ctx.http.request({
|
|
4272
|
+
method: "GET",
|
|
4273
|
+
path: this.base(),
|
|
4274
|
+
auth: auth2,
|
|
4275
|
+
...Object.keys(query).length ? { query } : {}
|
|
4276
|
+
});
|
|
4277
|
+
}
|
|
4278
|
+
/** Retrieve one return by id. */
|
|
4279
|
+
async getReturn(returnId, auth2 = SERVICE19) {
|
|
4280
|
+
return this.ctx.http.request({
|
|
4281
|
+
method: "GET",
|
|
4282
|
+
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
4283
|
+
auth: auth2
|
|
4284
|
+
});
|
|
4285
|
+
}
|
|
4286
|
+
/** Create a return. Returns the created `{ id }`. */
|
|
4287
|
+
async createReturn(input, auth2 = SERVICE19) {
|
|
4288
|
+
return this.ctx.http.request({
|
|
4289
|
+
method: "POST",
|
|
4290
|
+
path: this.base(),
|
|
4291
|
+
auth: auth2,
|
|
4292
|
+
body: input
|
|
4293
|
+
});
|
|
4294
|
+
}
|
|
4295
|
+
/** Replace a return by id (`PUT`). */
|
|
4296
|
+
async updateReturn(returnId, input, auth2 = SERVICE19) {
|
|
4297
|
+
await this.ctx.http.request({
|
|
4298
|
+
method: "PUT",
|
|
4299
|
+
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
4300
|
+
auth: auth2,
|
|
4301
|
+
body: input
|
|
4302
|
+
});
|
|
4303
|
+
}
|
|
4304
|
+
/** Partially update a return by id (`PATCH`, JSON-Patch op-array). */
|
|
4305
|
+
async patchReturn(returnId, ops, auth2 = SERVICE19) {
|
|
4306
|
+
await this.ctx.http.request({
|
|
4307
|
+
method: "PATCH",
|
|
4308
|
+
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
4309
|
+
auth: auth2,
|
|
4310
|
+
body: ops
|
|
4311
|
+
});
|
|
4312
|
+
}
|
|
4313
|
+
/** Delete a return by id. */
|
|
4314
|
+
async deleteReturn(returnId, auth2 = SERVICE19) {
|
|
4315
|
+
await this.ctx.http.request({
|
|
4316
|
+
method: "DELETE",
|
|
4317
|
+
path: `${this.base()}/${encodeURIComponent(returnId)}`,
|
|
4318
|
+
auth: auth2
|
|
4319
|
+
});
|
|
4320
|
+
}
|
|
4321
|
+
};
|
|
4322
|
+
|
|
4323
|
+
// src/services/sepa-export.ts
|
|
4324
|
+
var SERVICE20 = { kind: "service" };
|
|
4325
|
+
var SepaExportService = class {
|
|
4326
|
+
constructor(ctx) {
|
|
4327
|
+
this.ctx = ctx;
|
|
4328
|
+
}
|
|
4329
|
+
ctx;
|
|
4330
|
+
base() {
|
|
4331
|
+
return `/sepa-export/${this.ctx.tenant}`;
|
|
4332
|
+
}
|
|
4333
|
+
/** Retrieve a SEPA export file by id. Returns the raw file content (text). */
|
|
4334
|
+
async getFile(fileId, auth2 = SERVICE20) {
|
|
4335
|
+
const path = `${this.base()}/files/${encodeURIComponent(fileId)}`;
|
|
4336
|
+
const res = await this.ctx.http.requestRaw({ method: "GET", path, auth: auth2 });
|
|
4337
|
+
if (!res.ok) {
|
|
4338
|
+
const errBody = await res.text().catch(() => void 0);
|
|
4339
|
+
throw errorFromResponse(res.status, `GET ${path} \u2192 ${res.status}`, errBody);
|
|
4340
|
+
}
|
|
4341
|
+
return res.text();
|
|
4342
|
+
}
|
|
4343
|
+
/** List export jobs. */
|
|
4344
|
+
async listJobs(query = {}, auth2 = SERVICE20) {
|
|
4345
|
+
return this.ctx.http.request({
|
|
4346
|
+
method: "GET",
|
|
4347
|
+
path: `${this.base()}/jobs`,
|
|
4348
|
+
auth: auth2,
|
|
4349
|
+
...Object.keys(query).length ? { query } : {}
|
|
4350
|
+
});
|
|
4351
|
+
}
|
|
4352
|
+
/** Create an export job. */
|
|
4353
|
+
async createJob(input, auth2 = SERVICE20) {
|
|
4354
|
+
return this.ctx.http.request({
|
|
4355
|
+
method: "POST",
|
|
4356
|
+
path: `${this.base()}/jobs`,
|
|
4357
|
+
auth: auth2,
|
|
4358
|
+
body: input
|
|
4359
|
+
});
|
|
4360
|
+
}
|
|
4361
|
+
};
|
|
4362
|
+
|
|
4363
|
+
// src/services/indexing.ts
|
|
4364
|
+
var SERVICE21 = { kind: "service" };
|
|
4365
|
+
var IndexingService = class {
|
|
4366
|
+
constructor(ctx) {
|
|
4367
|
+
this.ctx = ctx;
|
|
4368
|
+
}
|
|
4369
|
+
ctx;
|
|
4370
|
+
base() {
|
|
4371
|
+
return `/indexing/${this.ctx.tenant}`;
|
|
4372
|
+
}
|
|
4373
|
+
/** List indexing configurations. */
|
|
4374
|
+
async listConfigurations(auth2 = SERVICE21) {
|
|
4375
|
+
return this.ctx.http.request({ method: "GET", path: `${this.base()}/configurations`, auth: auth2 });
|
|
4376
|
+
}
|
|
4377
|
+
/** Get a configuration by provider name. */
|
|
4378
|
+
async getConfiguration(provider, auth2 = SERVICE21) {
|
|
4379
|
+
return this.ctx.http.request({
|
|
4380
|
+
method: "GET",
|
|
4381
|
+
path: `${this.base()}/configurations/${encodeURIComponent(provider)}`,
|
|
4382
|
+
auth: auth2
|
|
4383
|
+
});
|
|
4384
|
+
}
|
|
4385
|
+
/** Create a configuration. */
|
|
4386
|
+
async createConfiguration(input, auth2 = SERVICE21) {
|
|
4387
|
+
return this.ctx.http.request({
|
|
4388
|
+
method: "POST",
|
|
4389
|
+
path: `${this.base()}/configurations`,
|
|
4390
|
+
auth: auth2,
|
|
4391
|
+
body: input
|
|
4392
|
+
});
|
|
4393
|
+
}
|
|
4394
|
+
/** Update a configuration by provider name. */
|
|
4395
|
+
async updateConfiguration(provider, input, auth2 = SERVICE21) {
|
|
4396
|
+
await this.ctx.http.request({
|
|
4397
|
+
method: "PUT",
|
|
4398
|
+
path: `${this.base()}/configurations/${encodeURIComponent(provider)}`,
|
|
4399
|
+
auth: auth2,
|
|
4400
|
+
body: input
|
|
4401
|
+
});
|
|
4402
|
+
}
|
|
4403
|
+
/** Delete a configuration by provider name. */
|
|
4404
|
+
async deleteConfiguration(provider, auth2 = SERVICE21) {
|
|
4405
|
+
await this.ctx.http.request({
|
|
4406
|
+
method: "DELETE",
|
|
4407
|
+
path: `${this.base()}/configurations/${encodeURIComponent(provider)}`,
|
|
4408
|
+
auth: auth2
|
|
4409
|
+
});
|
|
4410
|
+
}
|
|
4411
|
+
/** List public indexing configurations. */
|
|
4412
|
+
async listPublicConfigurations(auth2 = SERVICE21) {
|
|
4413
|
+
return this.ctx.http.request({ method: "GET", path: `${this.base()}/public/configurations`, auth: auth2 });
|
|
4414
|
+
}
|
|
4415
|
+
/** Get a public configuration by provider name. */
|
|
4416
|
+
async getPublicConfiguration(provider, auth2 = SERVICE21) {
|
|
4417
|
+
return this.ctx.http.request({
|
|
4418
|
+
method: "GET",
|
|
4419
|
+
path: `${this.base()}/public/configurations/${encodeURIComponent(provider)}`,
|
|
4420
|
+
auth: auth2
|
|
4421
|
+
});
|
|
4422
|
+
}
|
|
4423
|
+
/** Trigger a reindex. */
|
|
4424
|
+
async reindex(input, auth2 = SERVICE21) {
|
|
4425
|
+
await this.ctx.http.request({ method: "POST", path: `${this.base()}/reindex`, auth: auth2, body: input });
|
|
4426
|
+
}
|
|
4427
|
+
};
|
|
4428
|
+
|
|
4429
|
+
// src/services/unit-handling.ts
|
|
4430
|
+
var SERVICE22 = { kind: "service" };
|
|
4431
|
+
var UnitHandlingService = class {
|
|
4432
|
+
constructor(ctx) {
|
|
4433
|
+
this.ctx = ctx;
|
|
4434
|
+
}
|
|
4435
|
+
ctx;
|
|
4436
|
+
base() {
|
|
4437
|
+
return `/unit-handling/${this.ctx.tenant}`;
|
|
4438
|
+
}
|
|
4439
|
+
/** Find units (filter/sort/page). */
|
|
4440
|
+
async listUnits(query = {}, auth2 = SERVICE22) {
|
|
4441
|
+
return this.ctx.http.request({
|
|
4442
|
+
method: "GET",
|
|
4443
|
+
path: `${this.base()}/units`,
|
|
4444
|
+
auth: auth2,
|
|
4445
|
+
...Object.keys(query).length ? { query } : {}
|
|
4446
|
+
});
|
|
4447
|
+
}
|
|
4448
|
+
/** Retrieve a unit by code. */
|
|
4449
|
+
async getUnit(unitCode, auth2 = SERVICE22) {
|
|
4450
|
+
return this.ctx.http.request({
|
|
4451
|
+
method: "GET",
|
|
4452
|
+
path: `${this.base()}/units/${encodeURIComponent(unitCode)}`,
|
|
4453
|
+
auth: auth2
|
|
4454
|
+
});
|
|
4455
|
+
}
|
|
4456
|
+
/** Add a new unit. */
|
|
4457
|
+
async createUnit(input, auth2 = SERVICE22) {
|
|
4458
|
+
return this.ctx.http.request({ method: "POST", path: `${this.base()}/units`, auth: auth2, body: input });
|
|
4459
|
+
}
|
|
4460
|
+
/** Update a unit by code. */
|
|
4461
|
+
async updateUnit(unitCode, input, auth2 = SERVICE22) {
|
|
4462
|
+
await this.ctx.http.request({
|
|
4463
|
+
method: "PUT",
|
|
4464
|
+
path: `${this.base()}/units/${encodeURIComponent(unitCode)}`,
|
|
4465
|
+
auth: auth2,
|
|
4466
|
+
body: input
|
|
4467
|
+
});
|
|
4468
|
+
}
|
|
4469
|
+
/** Delete a unit by code. */
|
|
4470
|
+
async deleteUnit(unitCode, auth2 = SERVICE22) {
|
|
4471
|
+
await this.ctx.http.request({
|
|
4472
|
+
method: "DELETE",
|
|
4473
|
+
path: `${this.base()}/units/${encodeURIComponent(unitCode)}`,
|
|
4474
|
+
auth: auth2
|
|
4475
|
+
});
|
|
4476
|
+
}
|
|
4477
|
+
/** Delete multiple units by code (bulk). The codes are sent as the request body. */
|
|
4478
|
+
async deleteUnits(codes, auth2 = SERVICE22) {
|
|
4479
|
+
await this.ctx.http.request({
|
|
4480
|
+
method: "DELETE",
|
|
4481
|
+
path: `${this.base()}/units`,
|
|
4482
|
+
auth: auth2,
|
|
4483
|
+
body: codes
|
|
4484
|
+
});
|
|
4485
|
+
}
|
|
4486
|
+
/** Fetch a conversion factor (`PUT /units/conversion-factor-commands`). */
|
|
4487
|
+
async getConversionFactor(input, auth2 = SERVICE22) {
|
|
4488
|
+
return this.ctx.http.request({
|
|
4489
|
+
method: "PUT",
|
|
4490
|
+
path: `${this.base()}/units/conversion-factor-commands`,
|
|
4491
|
+
auth: auth2,
|
|
4492
|
+
body: input
|
|
4493
|
+
});
|
|
4494
|
+
}
|
|
4495
|
+
/** Convert a value between units (`PUT /units/convert-unit-commands`). */
|
|
4496
|
+
async convertUnit(input, auth2 = SERVICE22) {
|
|
4497
|
+
return this.ctx.http.request({
|
|
4498
|
+
method: "PUT",
|
|
4499
|
+
path: `${this.base()}/units/convert-unit-commands`,
|
|
4500
|
+
auth: auth2,
|
|
4501
|
+
body: input
|
|
4502
|
+
});
|
|
4503
|
+
}
|
|
4504
|
+
/** List all unit types. */
|
|
4505
|
+
async listUnitTypes(auth2 = SERVICE22) {
|
|
4506
|
+
return this.ctx.http.request({ method: "GET", path: `${this.base()}/types`, auth: auth2 });
|
|
4507
|
+
}
|
|
4508
|
+
};
|
|
4509
|
+
|
|
2388
4510
|
// package.json
|
|
2389
|
-
var version = "2.
|
|
4511
|
+
var version = "2.4.0";
|
|
2390
4512
|
|
|
2391
4513
|
// src/version.ts
|
|
2392
4514
|
var SDK_VERSION = version;
|
|
@@ -2413,6 +4535,25 @@ var EmporixClient = class {
|
|
|
2413
4535
|
availability;
|
|
2414
4536
|
tenantConfig;
|
|
2415
4537
|
clientConfig;
|
|
4538
|
+
shoppingLists;
|
|
4539
|
+
ragIndexer;
|
|
4540
|
+
sequentialIds;
|
|
4541
|
+
fees;
|
|
4542
|
+
webhooks;
|
|
4543
|
+
schemas;
|
|
4544
|
+
ai;
|
|
4545
|
+
taxes;
|
|
4546
|
+
coupons;
|
|
4547
|
+
rewardPoints;
|
|
4548
|
+
brands;
|
|
4549
|
+
labels;
|
|
4550
|
+
countries;
|
|
4551
|
+
currencies;
|
|
4552
|
+
shipping;
|
|
4553
|
+
returns;
|
|
4554
|
+
sepaExport;
|
|
4555
|
+
indexing;
|
|
4556
|
+
units;
|
|
2416
4557
|
/** The validated tenant this client is bound to. */
|
|
2417
4558
|
tenant;
|
|
2418
4559
|
/**
|
|
@@ -2485,6 +4626,25 @@ var EmporixClient = class {
|
|
|
2485
4626
|
this.availability = new AvailabilityService(mk("availability"));
|
|
2486
4627
|
this.tenantConfig = new TenantConfigService(mk("configuration"));
|
|
2487
4628
|
this.clientConfig = new ClientConfigService(mk("configuration"));
|
|
4629
|
+
this.shoppingLists = new ShoppingListService(mk("shopping-list"));
|
|
4630
|
+
this.ragIndexer = new RagIndexerService(mk("ai-rag-indexer"));
|
|
4631
|
+
this.sequentialIds = new SequentialIdService(mk("sequential-id"));
|
|
4632
|
+
this.fees = new FeeService(mk("fee"));
|
|
4633
|
+
this.webhooks = new WebhookService(mk("webhook"));
|
|
4634
|
+
this.schemas = new SchemaService(mk("schema"));
|
|
4635
|
+
this.ai = new AiService(mk("ai"));
|
|
4636
|
+
this.taxes = new TaxService(mk("tax"));
|
|
4637
|
+
this.coupons = new CouponService(mk("coupon"));
|
|
4638
|
+
this.rewardPoints = new RewardPointsService(mk("reward-points"));
|
|
4639
|
+
this.brands = new BrandService(mk("brand"));
|
|
4640
|
+
this.labels = new LabelService(mk("label"));
|
|
4641
|
+
this.countries = new CountryService(mk("country"));
|
|
4642
|
+
this.currencies = new CurrencyService(mk("currency"));
|
|
4643
|
+
this.shipping = new ShippingService(mk("shipping"));
|
|
4644
|
+
this.returns = new ReturnsService(mk("returns"));
|
|
4645
|
+
this.sepaExport = new SepaExportService(mk("sepa-export"));
|
|
4646
|
+
this.indexing = new IndexingService(mk("indexing"));
|
|
4647
|
+
this.units = new UnitHandlingService(mk("unit-handling"));
|
|
2488
4648
|
}
|
|
2489
4649
|
/** Sets the runtime log level globally or for one service. */
|
|
2490
4650
|
setLogLevel(level, opts = {}) {
|
|
@@ -2496,13 +4656,18 @@ var EmporixClient = class {
|
|
|
2496
4656
|
}
|
|
2497
4657
|
};
|
|
2498
4658
|
|
|
4659
|
+
exports.AiService = AiService;
|
|
2499
4660
|
exports.AvailabilityService = AvailabilityService;
|
|
4661
|
+
exports.BrandService = BrandService;
|
|
2500
4662
|
exports.CartService = CartService;
|
|
2501
4663
|
exports.CategoryService = CategoryService;
|
|
2502
4664
|
exports.CheckoutService = CheckoutService;
|
|
2503
4665
|
exports.ClientConfigService = ClientConfigService;
|
|
2504
4666
|
exports.CompaniesService = CompaniesService;
|
|
2505
4667
|
exports.ContactsService = ContactsService;
|
|
4668
|
+
exports.CountryService = CountryService;
|
|
4669
|
+
exports.CouponService = CouponService;
|
|
4670
|
+
exports.CurrencyService = CurrencyService;
|
|
2506
4671
|
exports.CustomerGroupsService = CustomerGroupsService;
|
|
2507
4672
|
exports.CustomerService = CustomerService;
|
|
2508
4673
|
exports.DEFAULT_HOST = DEFAULT_HOST;
|
|
@@ -2515,8 +4680,11 @@ exports.EmporixInsufficientScopeError = EmporixInsufficientScopeError;
|
|
|
2515
4680
|
exports.EmporixNotFoundError = EmporixNotFoundError;
|
|
2516
4681
|
exports.EmporixServerError = EmporixServerError;
|
|
2517
4682
|
exports.EmporixValidationError = EmporixValidationError;
|
|
4683
|
+
exports.FeeService = FeeService;
|
|
2518
4684
|
exports.HttpClient = HttpClient;
|
|
4685
|
+
exports.IndexingService = IndexingService;
|
|
2519
4686
|
exports.LEVEL = LEVEL;
|
|
4687
|
+
exports.LabelService = LabelService;
|
|
2520
4688
|
exports.LevelResolver = LevelResolver;
|
|
2521
4689
|
exports.LocationsService = LocationsService;
|
|
2522
4690
|
exports.MediaService = MediaService;
|
|
@@ -2524,11 +4692,22 @@ exports.OrdersService = OrdersService;
|
|
|
2524
4692
|
exports.PaymentGatewayService = PaymentGatewayService;
|
|
2525
4693
|
exports.PriceService = PriceService;
|
|
2526
4694
|
exports.ProductService = ProductService;
|
|
4695
|
+
exports.RagIndexerService = RagIndexerService;
|
|
4696
|
+
exports.ReturnsService = ReturnsService;
|
|
4697
|
+
exports.RewardPointsService = RewardPointsService;
|
|
2527
4698
|
exports.SalesOrdersService = SalesOrdersService;
|
|
4699
|
+
exports.SchemaService = SchemaService;
|
|
2528
4700
|
exports.SegmentService = SegmentService;
|
|
4701
|
+
exports.SepaExportService = SepaExportService;
|
|
4702
|
+
exports.SequentialIdService = SequentialIdService;
|
|
2529
4703
|
exports.SessionContextService = SessionContextService;
|
|
4704
|
+
exports.ShippingService = ShippingService;
|
|
4705
|
+
exports.ShoppingListService = ShoppingListService;
|
|
2530
4706
|
exports.SiteService = SiteService;
|
|
4707
|
+
exports.TaxService = TaxService;
|
|
2531
4708
|
exports.TenantConfigService = TenantConfigService;
|
|
4709
|
+
exports.UnitHandlingService = UnitHandlingService;
|
|
4710
|
+
exports.WebhookService = WebhookService;
|
|
2532
4711
|
exports.auth = auth;
|
|
2533
4712
|
exports.createConsoleLogger = createConsoleLogger;
|
|
2534
4713
|
exports.createNoopLogger = createNoopLogger;
|