@viu/emporix-sdk 2.1.0 → 2.3.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/dist/availability.d.cts +1 -1
  3. package/dist/availability.d.ts +1 -1
  4. package/dist/cart.d.cts +1 -1
  5. package/dist/cart.d.ts +1 -1
  6. package/dist/category.d.cts +1 -1
  7. package/dist/category.d.ts +1 -1
  8. package/dist/checkout.d.cts +1 -1
  9. package/dist/checkout.d.ts +1 -1
  10. package/dist/{chunk-JTJV7WUW.js → chunk-5JHTZBOC.js} +42 -2
  11. package/dist/chunk-5JHTZBOC.js.map +1 -0
  12. package/dist/companies.d.cts +1 -1
  13. package/dist/companies.d.ts +1 -1
  14. package/dist/contacts.d.cts +1 -1
  15. package/dist/contacts.d.ts +1 -1
  16. package/dist/{context-CGuxSb56.d.cts → context-CQFcPZnt.d.cts} +1 -1
  17. package/dist/{context-CGuxSb56.d.ts → context-CQFcPZnt.d.ts} +1 -1
  18. package/dist/customer-groups.d.cts +1 -1
  19. package/dist/customer-groups.d.ts +1 -1
  20. package/dist/customer.d.cts +1 -1
  21. package/dist/customer.d.ts +1 -1
  22. package/dist/index.cjs +1028 -6
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +2014 -3
  25. package/dist/index.d.ts +2014 -3
  26. package/dist/index.js +983 -10
  27. package/dist/index.js.map +1 -1
  28. package/dist/locations.d.cts +1 -1
  29. package/dist/locations.d.ts +1 -1
  30. package/dist/media.d.cts +1 -1
  31. package/dist/media.d.ts +1 -1
  32. package/dist/orders.d.cts +1 -1
  33. package/dist/orders.d.ts +1 -1
  34. package/dist/payment.d.cts +1 -1
  35. package/dist/payment.d.ts +1 -1
  36. package/dist/price.d.cts +1 -1
  37. package/dist/price.d.ts +1 -1
  38. package/dist/product.cjs +40 -0
  39. package/dist/product.cjs.map +1 -1
  40. package/dist/product.d.cts +14 -1
  41. package/dist/product.d.ts +14 -1
  42. package/dist/product.js +1 -1
  43. package/dist/segment.d.cts +1 -1
  44. package/dist/segment.d.ts +1 -1
  45. package/package.json +1 -1
  46. package/dist/chunk-JTJV7WUW.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,80 @@
1
1
  # @viu/emporix-sdk
2
2
 
3
+ ## 2.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#67](https://github.com/viuteam/emporix-sdk/pull/67) [`97cda33`](https://github.com/viuteam/emporix-sdk/commit/97cda33466e633836c046ae00dbdde051352c5f2) Thanks [@amnael1](https://github.com/amnael1)! - Add AI RAG Indexer binding: `client.ragIndexer` exposes `ragMetadata()` and
8
+ `filterMetadata()` to discover the indexed embedding / filterable fields, plus
9
+ `reindex()` to trigger a full asynchronous index rebuild. Server-side only —
10
+ these use the service (clientCredentials) token (`ai.agent_read` /
11
+ `ai.agent_manage`) and must not be called from a browser.
12
+
13
+ - [#72](https://github.com/viuteam/emporix-sdk/pull/72) [`7a3885a`](https://github.com/viuteam/emporix-sdk/commit/7a3885ad58d20c8e5726fa9e976a68588ea90e43) Thanks [@amnael1](https://github.com/amnael1)! - Add Emporix AI Service bindings via `client.ai`: text generation
14
+ (`generateText`), chat completions (`complete`), agent CRUD (`listAgents`,
15
+ `getAgent`, `upsertAgent`, `patchAgent`, `deleteAgent`, `searchAgents`), and
16
+ synchronous / asynchronous agentic chat (`chat`, `chatAsync`). Server-side only
17
+ — these use the service (clientCredentials) token and must not be called from a
18
+ browser; both chat endpoints return arrays. Templates, import/export,
19
+ logs/sessions and tokens are not yet bound.
20
+
21
+ - [#69](https://github.com/viuteam/emporix-sdk/pull/69) [`c79332e`](https://github.com/viuteam/emporix-sdk/commit/c79332e80f478d2d5d71d820279eda74d55eb08c) Thanks [@amnael1](https://github.com/amnael1)! - Add Fee Service bindings: `client.fees` provides CRUD over fee definitions
22
+ (`list`/`get`/`create`/`update`/`delete`) plus item- and product-fee mappings
23
+ (`listItemFees`/`getItemFees`/`createItemFee`/`setItemFees`/`deleteItemFees`/
24
+ `searchItemFees`, `getProductFees`/`setProductFees`/`deleteProductFees`).
25
+ Server-side only — these use the service (clientCredentials) token and must not
26
+ be called from a browser.
27
+
28
+ - [#71](https://github.com/viuteam/emporix-sdk/pull/71) [`993a563`](https://github.com/viuteam/emporix-sdk/commit/993a563a2d6e20dcf218a1367c3f2dd5e77cce0e) Thanks [@amnael1](https://github.com/amnael1)! - Add Schema Service bindings: `client.schemas` provides CRUD over schemas
29
+ (`listSchemas`/`getSchema`/`createSchema`/`updateSchema`/`deleteSchema`) plus
30
+ `validateSchemaFile`, entity types (`listTypes`/`setSchemaTypes`), custom
31
+ entities (`listCustomEntities`/`getCustomEntity`/`createCustomEntity`/
32
+ `updateCustomEntity`/`deleteCustomEntity`), and custom instances
33
+ (`listInstances`/`getInstance`/`createInstance`/`replaceInstance`/
34
+ `patchInstance`/`deleteInstance`/`searchInstances`). Server-side only — these
35
+ use the service (clientCredentials) token and must not be called from a
36
+ browser. References, export/import and bulk instance ops are not yet exposed.
37
+
38
+ - [#68](https://github.com/viuteam/emporix-sdk/pull/68) [`9861d87`](https://github.com/viuteam/emporix-sdk/commit/9861d87a2e672400e2eaf1c90052bef62641c93f) Thanks [@amnael1](https://github.com/amnael1)! - Add Sequential ID Service binding: `client.sequentialIds` provides sequence
39
+ schema admin (`listSchemas`/`getSchema`/`createSchema`/`deleteSchema`/
40
+ `setActiveSchema`/`listSchemasByType`) and id generation (`nextId`,
41
+ `nextIdsBatch`). Server-side only — these use the service (clientCredentials)
42
+ token and must not be called from a browser.
43
+
44
+ - [#65](https://github.com/viuteam/emporix-sdk/pull/65) [`dca34d0`](https://github.com/viuteam/emporix-sdk/commit/dca34d044e54c305ea2a310ba349dc800ced331a) Thanks [@amnael1](https://github.com/amnael1)! - Add Shopping List bindings: `client.shoppingLists` (per-customer named lists —
45
+ list/create/replace/delete plus read-modify-write item helpers, last-write-wins)
46
+ and React hooks (`useShoppingLists`, `useCreateShoppingList`, `useAddToShoppingList`,
47
+ `useRemoveFromShoppingList`, `useSetShoppingListItemQuantity`, `useDeleteShoppingList`).
48
+
49
+ - [#70](https://github.com/viuteam/emporix-sdk/pull/70) [`21063a1`](https://github.com/viuteam/emporix-sdk/commit/21063a161029c9ea22278c08f89b59a36cb7fb01) Thanks [@amnael1](https://github.com/amnael1)! - Add Webhook Service bindings: `client.webhooks` provides the event-subscription
50
+ catalog + batch toggle (`listEventSubscriptions` / `updateEventSubscriptions`),
51
+ delivery-config CRUD (`listConfigs` / `getConfig` / `createConfig` /
52
+ `replaceConfig` / `patchConfig` / `deleteConfig`), `getStatistics`, and
53
+ `getDashboardAccess`. `updateEventSubscriptions` returns the HTTP-207 per-item
54
+ result array so callers can handle partial failures; `patchConfig` takes the
55
+ op-based (`UPSERT`/`REMOVE`) update array. Server-side only — these use the
56
+ service (clientCredentials) token and must not be called from a browser.
57
+
58
+ ## 2.2.0
59
+
60
+ ### Minor Changes
61
+
62
+ - [#61](https://github.com/viuteam/emporix-sdk/pull/61) [`4a869c9`](https://github.com/viuteam/emporix-sdk/commit/4a869c9aa60cce99b79b41b8470af367e1b4e249) Thanks [@amnael1](https://github.com/amnael1)! - Add Configuration Service bindings: `client.tenantConfig` and
63
+ `client.clientConfig` provide full CRUD (`list`/`get`/`create`/`update`/`delete`)
64
+ over tenant-wide and per-client configuration. Server-side only — these use the
65
+ service (clientCredentials) token and must not be called from a browser.
66
+
67
+ - [#63](https://github.com/viuteam/emporix-sdk/pull/63) [`bb2ce4f`](https://github.com/viuteam/emporix-sdk/commit/bb2ce4f891e50e07cee02e03340d2abe1133fdc0) Thanks [@amnael1](https://github.com/amnael1)! - Add `products.searchByCodes(codes, { chunkSize? })` — bulk-fetch products by
68
+ `code` via `POST /products/search` (`q="code:(…)"`), chunked at 100, analogous
69
+ to `searchByIds`. Codes with query-delimiter characters are dropped with a
70
+ warning. Adds the `useProductsByCodes` React hook (30s stale-time).
71
+
72
+ ### Patch Changes
73
+
74
+ - [#62](https://github.com/viuteam/emporix-sdk/pull/62) [`9747445`](https://github.com/viuteam/emporix-sdk/commit/9747445c13a27319462755c5333c9ae0a4741e68) Thanks [@amnael1](https://github.com/amnael1)! - Report the real package version as `sdkVersion` on every log line instead of the
75
+ hardcoded `0.0.0` placeholder. The version is now read from `package.json` and
76
+ inlined at build time (browser-safe, no runtime filesystem access).
77
+
3
78
  ## 2.1.0
4
79
 
5
80
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.cjs';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.cjs';
2
2
 
3
3
  type DistributionChannel = 'ASSORTMENT' | 'HOME_DELIVERY' | 'PICKUP';
4
4
  type Availability$1 = {
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.js';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.js';
2
2
 
3
3
  type DistributionChannel = 'ASSORTMENT' | 'HOME_DELIVERY' | 'PICKUP';
4
4
  type Availability$1 = {
package/dist/cart.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.cjs';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.cjs';
2
2
 
3
3
  /**
4
4
  * Access control identifier that determines who can view or manage the cart.
package/dist/cart.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.js';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.js';
2
2
 
3
3
  /**
4
4
  * Access control identifier that determines who can view or manage the cart.
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-CGuxSb56.cjs';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-CQFcPZnt.cjs';
2
2
  import { Product } from './product.cjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-CGuxSb56.js';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-CQFcPZnt.js';
2
2
  import { Product } from './product.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.cjs';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.cjs';
2
2
 
3
3
  /**
4
4
  * Information about the customer's address.
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.js';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.js';
2
2
 
3
3
  /**
4
4
  * Information about the customer's address.
@@ -82,6 +82,46 @@ var ProductService = class {
82
82
  );
83
83
  return pages.flat();
84
84
  }
85
+ /**
86
+ * Bulk fetch by code. POSTs `/products/search` with `q="code:(c1,c2,…)"`,
87
+ * chunking when the list is larger than `options.chunkSize` (default 100).
88
+ * Duplicate codes are de-duplicated. Codes containing query-delimiter
89
+ * characters (`(`, `)`, `,`, whitespace, `"`) are dropped with a logged
90
+ * warning, because the Emporix `q` syntax uses them as delimiters and does
91
+ * not support escaping them in a plain IN-list. An empty list — or one with
92
+ * no safe codes — short-circuits with no HTTP call. **Order is not
93
+ * guaranteed** across chunks — re-index by `code` if order matters.
94
+ */
95
+ async searchByCodes(codes, options = {}, auth = ANON) {
96
+ const unique = [...new Set(codes)];
97
+ const unsafe = /[(),"\s]/;
98
+ const safe = unique.filter((c) => !unsafe.test(c));
99
+ const dropped = unique.filter((c) => unsafe.test(c));
100
+ if (dropped.length > 0) {
101
+ this.ctx.logger.warn(
102
+ "products.searchByCodes: dropped codes containing query-delimiter characters",
103
+ { dropped }
104
+ );
105
+ }
106
+ if (safe.length === 0) return [];
107
+ const chunkSize = options.chunkSize ?? 100;
108
+ const chunks = [];
109
+ for (let i = 0; i < safe.length; i += chunkSize) {
110
+ chunks.push(safe.slice(i, i + chunkSize));
111
+ }
112
+ const pages = await Promise.all(
113
+ chunks.map(
114
+ (chunk) => this.ctx.http.request({
115
+ method: "POST",
116
+ path: `/product/${this.ctx.tenant}/products/search`,
117
+ query: { pageSize: chunk.length },
118
+ auth,
119
+ body: { q: `code:(${chunk.join(",")})` }
120
+ })
121
+ )
122
+ );
123
+ return pages.flat();
124
+ }
85
125
  /**
86
126
  * Streams the VARIANT children of a PARENT_VARIANT product, page by page,
87
127
  * via the search query `productType:VARIANT parentVariantId:<id>`. Default
@@ -108,5 +148,5 @@ var ProductService = class {
108
148
  };
109
149
 
110
150
  export { ProductService };
111
- //# sourceMappingURL=chunk-JTJV7WUW.js.map
112
- //# sourceMappingURL=chunk-JTJV7WUW.js.map
151
+ //# sourceMappingURL=chunk-5JHTZBOC.js.map
152
+ //# sourceMappingURL=chunk-5JHTZBOC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/product.ts"],"names":[],"mappings":";;;AAUA,IAAM,IAAA,GAAoB,EAAE,IAAA,EAAM,WAAA,EAAY;AASvC,IAAM,iBAAN,MAAqB;AAAA,EAC1B,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA;AAAA,EAG7B,MAAM,GAAA,CACJ,SAAA,EACA,KAAA,EACA,OAAoB,IAAA,EACF;AAClB,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAiB;AAAA,MACpC,MAAA,EAAQ,KAAA;AAAA,MACR,MAAM,CAAA,SAAA,EAAY,IAAA,CAAK,GAAA,CAAI,MAAM,aAAa,SAAS,CAAA,CAAA;AAAA,MACvD;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,SAAA,CAAU,IAAA,EAAc,IAAA,GAAoB,IAAA,EAAwB;AACxE,IAAA,MAAM,IAAA,GAAO,MAAM,IAAA,CAAK,GAAA,CAAI,KAAK,OAAA,CAAmB;AAA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MAAM,MAAiB,EAAC;AACxB,IAAA,WAAA,MAAiB,SAAS,IAAA,CAAK,sBAAA,CAAuB,eAAA,EAAiB,MAAA,EAAQ,IAAI,CAAA,EAAG;AACpF,MAAA,GAAA,CAAI,KAAK,KAAK,CAAA;AAAA,IAChB;AACA,IAAA,OAAO,GAAA;AAAA,EACT;AACF","file":"chunk-5JHTZBOC.js","sourcesContent":["import type { ClientContext, PaginatedItems } from \"../core/context\";\nimport { iterateAll } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type {\n BasicProductWithId,\n BundleProductWithId,\n ParentVariantProductWithId,\n ProductMedia,\n} from \"../generated/product\";\n\nconst ANON: AuthContext = { kind: \"anonymous\" };\n\n/** A product as returned by the Product service (all generated fields). */\nexport type Product = BasicProductWithId | BundleProductWithId | ParentVariantProductWithId;\n\n/** A single product media entry (generated; `ProductMedia` is the list type). */\nexport type Media = ProductMedia[number];\n\n/** Catalog reads. Default auth: anonymous; pass customer for personalized pricing. */\nexport class ProductService {\n constructor(private readonly ctx: ClientContext) {}\n\n /** Fetches one product by id. */\n async get(\n productId: string,\n _opts?: Record<string, never>,\n auth: AuthContext = ANON,\n ): Promise<Product> {\n return this.ctx.http.request<Product>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products/${productId}`,\n auth,\n });\n }\n\n /** Fetches one product by its code. */\n async getByCode(code: string, auth: AuthContext = ANON): Promise<Product> {\n const rows = await this.ctx.http.request<Product[]>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products`,\n query: { q: `code:${code}` },\n auth,\n });\n const first = rows[0];\n if (!first) throw new Error(`No product with code \"${code}\"`);\n return first;\n }\n\n /** One page of products. */\n async list(\n params: { pageNumber?: number; pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<PaginatedItems<Product>> {\n const pageNumber = params.pageNumber ?? 1;\n const pageSize = params.pageSize ?? 50;\n const items = await this.ctx.http.request<Product[]>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products`,\n query: { pageNumber, pageSize },\n auth,\n });\n return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };\n }\n\n /** Async-iterates every product across pages. */\n listAll(params: { pageSize?: number } = {}, auth: AuthContext = ANON): AsyncIterable<Product> {\n const pageSize = params.pageSize ?? 50;\n return iterateAll<Product>((pageNumber) => this.list({ pageNumber, pageSize }, auth));\n }\n\n /** Searches products by free-text query. */\n async search(\n query: string,\n params: { pageNumber?: number; pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<PaginatedItems<Product>> {\n const pageNumber = params.pageNumber ?? 1;\n const pageSize = params.pageSize ?? 50;\n const items = await this.ctx.http.request<Product[]>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products`,\n query: { q: query, pageNumber, pageSize },\n auth,\n });\n return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };\n }\n\n /**\n * Bulk fetch by id. POSTs `/products/search` with `q=\"id:(id1,id2,…)\"`,\n * chunking when the list is larger than `options.chunkSize` (default\n * 100). An empty list short-circuits with no HTTP call. **Order is not\n * guaranteed** across chunks — re-index by `id` if order matters.\n */\n async searchByIds(\n ids: string[],\n options: { chunkSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<Product[]> {\n if (ids.length === 0) return [];\n const chunkSize = options.chunkSize ?? 100;\n const chunks: string[][] = [];\n for (let i = 0; i < ids.length; i += chunkSize) {\n chunks.push(ids.slice(i, i + chunkSize));\n }\n const pages = await Promise.all(\n chunks.map((chunk) =>\n this.ctx.http.request<Product[]>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/search`,\n query: { pageSize: chunk.length },\n auth,\n body: { q: `id:(${chunk.join(\",\")})` },\n }),\n ),\n );\n return pages.flat();\n }\n\n /**\n * Bulk fetch by code. POSTs `/products/search` with `q=\"code:(c1,c2,…)\"`,\n * chunking when the list is larger than `options.chunkSize` (default 100).\n * Duplicate codes are de-duplicated. Codes containing query-delimiter\n * characters (`(`, `)`, `,`, whitespace, `\"`) are dropped with a logged\n * warning, because the Emporix `q` syntax uses them as delimiters and does\n * not support escaping them in a plain IN-list. An empty list — or one with\n * no safe codes — short-circuits with no HTTP call. **Order is not\n * guaranteed** across chunks — re-index by `code` if order matters.\n */\n async searchByCodes(\n codes: string[],\n options: { chunkSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<Product[]> {\n const unique = [...new Set(codes)];\n const unsafe = /[(),\"\\s]/;\n const safe = unique.filter((c) => !unsafe.test(c));\n const dropped = unique.filter((c) => unsafe.test(c));\n if (dropped.length > 0) {\n this.ctx.logger.warn(\n \"products.searchByCodes: dropped codes containing query-delimiter characters\",\n { dropped },\n );\n }\n if (safe.length === 0) return [];\n const chunkSize = options.chunkSize ?? 100;\n const chunks: string[][] = [];\n for (let i = 0; i < safe.length; i += chunkSize) {\n chunks.push(safe.slice(i, i + chunkSize));\n }\n const pages = await Promise.all(\n chunks.map((chunk) =>\n this.ctx.http.request<Product[]>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/search`,\n query: { pageSize: chunk.length },\n auth,\n body: { q: `code:(${chunk.join(\",\")})` },\n }),\n ),\n );\n return pages.flat();\n }\n\n /**\n * Streams the VARIANT children of a PARENT_VARIANT product, page by page,\n * via the search query `productType:VARIANT parentVariantId:<id>`. Default\n * pageSize 200. The query syntax (space-separated fields = implicit AND) is\n * encapsulated here so consumers don't build it themselves.\n */\n listVariantChildrenAll(\n parentVariantId: string,\n params: { pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): AsyncIterable<Product> {\n const pageSize = params.pageSize ?? 200;\n const q = `productType:VARIANT parentVariantId:${parentVariantId}`;\n return iterateAll<Product>((pageNumber) => this.search(q, { pageNumber, pageSize }, auth));\n }\n\n /**\n * Resolves ALL VARIANT children of a PARENT_VARIANT product into a flat\n * array (loads every page). Default pageSize 200. Returns `[]` when there are\n * no children — never throws.\n */\n async listVariantChildren(\n parentVariantId: string,\n params: { pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<Product[]> {\n const out: Product[] = [];\n for await (const child of this.listVariantChildrenAll(parentVariantId, params, auth)) {\n out.push(child);\n }\n return out;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.cjs';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.cjs';
2
2
  import { L as LegalEntity, f as LegalEntityCreate, h as LegalEntityUpdate } from './types.gen-D1QuqPLs.cjs';
3
3
  export { A as AccountLimit, e as CustomerGroupRef, g as LegalEntityType, i as LegalInfo } from './types.gen-D1QuqPLs.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.js';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.js';
2
2
  import { L as LegalEntity, f as LegalEntityCreate, h as LegalEntityUpdate } from './types.gen-D1QuqPLs.js';
3
3
  export { A as AccountLimit, e as CustomerGroupRef, g as LegalEntityType, i as LegalInfo } from './types.gen-D1QuqPLs.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.cjs';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.cjs';
2
2
  import { C as ContactAssignment, a as ContactAssignmentCreate, c as ContactAssignmentUpdate } from './types.gen-D1QuqPLs.cjs';
3
3
  export { b as ContactAssignmentType } from './types.gen-D1QuqPLs.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.js';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.js';
2
2
  import { C as ContactAssignment, a as ContactAssignmentCreate, c as ContactAssignmentUpdate } from './types.gen-D1QuqPLs.js';
3
3
  export { b as ContactAssignmentType } from './types.gen-D1QuqPLs.js';
4
4
 
@@ -3,7 +3,7 @@ type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "silent";
3
3
  /** Numeric ordering used for fast comparison. */
4
4
  declare const LEVEL: Record<LogLevel, number>;
5
5
  /** Services that bind their own logger and are independently level-controllable. */
6
- type ServiceName = "customer" | "product" | "category" | "cart" | "checkout" | "payment" | "price" | "media" | "segment" | "site" | "session-context" | "customer-management" | "iam" | "orders" | "sales-orders" | "availability" | "http" | "auth";
6
+ type ServiceName = "customer" | "product" | "category" | "cart" | "checkout" | "payment" | "price" | "media" | "segment" | "site" | "session-context" | "customer-management" | "iam" | "orders" | "sales-orders" | "availability" | "configuration" | "shopping-list" | "ai-rag-indexer" | "sequential-id" | "fee" | "webhook" | "schema" | "ai" | "http" | "auth";
7
7
  /** Arbitrary structured fields attached to a log line. */
8
8
  interface LogFields {
9
9
  [key: string]: unknown;
@@ -3,7 +3,7 @@ type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "silent";
3
3
  /** Numeric ordering used for fast comparison. */
4
4
  declare const LEVEL: Record<LogLevel, number>;
5
5
  /** Services that bind their own logger and are independently level-controllable. */
6
- type ServiceName = "customer" | "product" | "category" | "cart" | "checkout" | "payment" | "price" | "media" | "segment" | "site" | "session-context" | "customer-management" | "iam" | "orders" | "sales-orders" | "availability" | "http" | "auth";
6
+ type ServiceName = "customer" | "product" | "category" | "cart" | "checkout" | "payment" | "price" | "media" | "segment" | "site" | "session-context" | "customer-management" | "iam" | "orders" | "sales-orders" | "availability" | "configuration" | "shopping-list" | "ai-rag-indexer" | "sequential-id" | "fee" | "webhook" | "schema" | "ai" | "http" | "auth";
7
7
  /** Arbitrary structured fields attached to a log line. */
8
8
  interface LogFields {
9
9
  [key: string]: unknown;
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.cjs';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.cjs';
2
2
 
3
3
  /**
4
4
  * Hand-written mirror of the minimal IAM Service group shape needed for
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-CGuxSb56.js';
1
+ import { C as ClientContext, b as AuthContext } from './context-CQFcPZnt.js';
2
2
 
3
3
  /**
4
4
  * Hand-written mirror of the minimal IAM Service group shape needed for
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, A as AnonymousSession, b as AuthContext } from './context-CGuxSb56.cjs';
1
+ import { C as ClientContext, A as AnonymousSession, b as AuthContext } from './context-CQFcPZnt.cjs';
2
2
 
3
3
  type AccountId = {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, A as AnonymousSession, b as AuthContext } from './context-CGuxSb56.js';
1
+ import { C as ClientContext, A as AnonymousSession, b as AuthContext } from './context-CQFcPZnt.js';
2
2
 
3
3
  type AccountId = {
4
4
  /**