@viu/emporix-sdk 2.8.0 → 2.9.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 (68) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/{chunk-5JHTZBOC.js → chunk-B4UOYJKW.js} +12 -2
  3. package/dist/chunk-B4UOYJKW.js.map +1 -0
  4. package/dist/{chunk-SCI7D74B.js → chunk-BK25FDTH.js} +17 -5
  5. package/dist/chunk-BK25FDTH.js.map +1 -0
  6. package/dist/{chunk-B56JZNI7.js → chunk-HAEVK6IS.js} +6 -3
  7. package/dist/chunk-HAEVK6IS.js.map +1 -0
  8. package/dist/{chunk-6UNFMCHZ.js → chunk-KVBCTXVH.js} +2 -2
  9. package/dist/chunk-KVBCTXVH.js.map +1 -0
  10. package/dist/{chunk-NM7VDXBR.js → chunk-LGLFJL3S.js} +6 -3
  11. package/dist/chunk-LGLFJL3S.js.map +1 -0
  12. package/dist/chunk-LGOC5XOI.js +40 -0
  13. package/dist/chunk-LGOC5XOI.js.map +1 -0
  14. package/dist/{chunk-RXVVFNYN.js → chunk-MM6JF3Z7.js} +6 -3
  15. package/dist/chunk-MM6JF3Z7.js.map +1 -0
  16. package/dist/companies.cjs +4 -1
  17. package/dist/companies.cjs.map +1 -1
  18. package/dist/companies.d.cts +7 -4
  19. package/dist/companies.d.ts +7 -4
  20. package/dist/companies.js +1 -1
  21. package/dist/contacts.cjs +4 -1
  22. package/dist/contacts.cjs.map +1 -1
  23. package/dist/contacts.d.cts +6 -4
  24. package/dist/contacts.d.ts +6 -4
  25. package/dist/contacts.js +1 -1
  26. package/dist/customer-groups.cjs +17 -0
  27. package/dist/customer-groups.cjs.map +1 -1
  28. package/dist/customer-groups.d.cts +94 -21
  29. package/dist/customer-groups.d.ts +94 -21
  30. package/dist/customer-groups.js +1 -1
  31. package/dist/index.cjs +63 -7
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +13 -5
  34. package/dist/index.d.ts +13 -5
  35. package/dist/index.js +23 -16
  36. package/dist/index.js.map +1 -1
  37. package/dist/locations.cjs +4 -1
  38. package/dist/locations.cjs.map +1 -1
  39. package/dist/locations.d.cts +7 -4
  40. package/dist/locations.d.ts +7 -4
  41. package/dist/locations.js +1 -1
  42. package/dist/orders.cjs.map +1 -1
  43. package/dist/orders.d.cts +1726 -80
  44. package/dist/orders.d.ts +1726 -80
  45. package/dist/orders.js +1 -1
  46. package/dist/price.cjs +15 -3
  47. package/dist/price.cjs.map +1 -1
  48. package/dist/price.d.cts +23 -4
  49. package/dist/price.d.ts +23 -4
  50. package/dist/price.js +1 -1
  51. package/dist/product.cjs +10 -0
  52. package/dist/product.cjs.map +1 -1
  53. package/dist/product.d.cts +10 -0
  54. package/dist/product.d.ts +10 -0
  55. package/dist/product.js +1 -1
  56. package/dist/types.gen-C_wOXYZB.d.cts +455 -0
  57. package/dist/types.gen-C_wOXYZB.d.ts +455 -0
  58. package/package.json +1 -1
  59. package/dist/chunk-5JHTZBOC.js.map +0 -1
  60. package/dist/chunk-6UNFMCHZ.js.map +0 -1
  61. package/dist/chunk-B56JZNI7.js.map +0 -1
  62. package/dist/chunk-NM7VDXBR.js.map +0 -1
  63. package/dist/chunk-RXVVFNYN.js.map +0 -1
  64. package/dist/chunk-SCI7D74B.js.map +0 -1
  65. package/dist/chunk-SKX7KCMH.js +0 -23
  66. package/dist/chunk-SKX7KCMH.js.map +0 -1
  67. package/dist/types.gen-D1QuqPLs.d.cts +0 -166
  68. package/dist/types.gen-D1QuqPLs.d.ts +0 -166
@@ -0,0 +1,455 @@
1
+ type MetadataUpdate = {
2
+ /**
3
+ * Version of the document.
4
+ */
5
+ version?: number;
6
+ /**
7
+ * Links to the mixin schemas. A map where the keys represent mixins set attributes and the values represent url to a schema for a particular set.
8
+ */
9
+ mixins?: {
10
+ [key: string]: unknown;
11
+ };
12
+ };
13
+ type Metadata = MetadataUpdate & {
14
+ /**
15
+ * Date and time when the document was created.
16
+ */
17
+ createdAt?: string;
18
+ /**
19
+ * Date and time when the document was last modified.
20
+ */
21
+ modifiedAt?: string;
22
+ };
23
+ type CustomerGroup = {
24
+ /**
25
+ * The unique identifier of the customer group.
26
+ */
27
+ id: string;
28
+ /**
29
+ * Localized name of a customer group.
30
+ */
31
+ name?: unknown;
32
+ /**
33
+ * The customer group role.
34
+ */
35
+ role?: string;
36
+ };
37
+ type ResourceId = {
38
+ /**
39
+ * Id of a resource.
40
+ */
41
+ id?: string;
42
+ };
43
+ type LegalEntity = {
44
+ /**
45
+ * The legal entity unique identifier.
46
+ */
47
+ id?: string;
48
+ /**
49
+ * The name of the legal entity.
50
+ */
51
+ name?: string;
52
+ /**
53
+ * The type of the legal entity.
54
+ */
55
+ type?: 'COMPANY' | 'SUBSIDIARY';
56
+ /**
57
+ * The id of the parent legal entity.
58
+ */
59
+ parentId?: string;
60
+ accountLimit?: AccountLimit;
61
+ legalInfo?: LegalInfo;
62
+ /**
63
+ * The list of customer groups assigned to the legal entity.
64
+ */
65
+ customerGroups?: Array<CustomerGroup>;
66
+ /**
67
+ * The list of locations assigned to the legal entity.
68
+ */
69
+ entitiesAddresses?: Array<Location>;
70
+ /**
71
+ * The list of customer assignment of the approval group of the legal entity.
72
+ */
73
+ approvalGroup?: Array<ContactAssignmentWithoutExpandedLegalEntity>;
74
+ restrictions?: Restrictions;
75
+ metadata?: Metadata;
76
+ /**
77
+ * Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.
78
+ */
79
+ mixins?: {
80
+ [key: string]: unknown;
81
+ };
82
+ };
83
+ type AccountLimit = {
84
+ /**
85
+ * The account limit currency.
86
+ */
87
+ currency?: string;
88
+ /**
89
+ * The purchasing limit for account in the legal entity.
90
+ */
91
+ value?: number;
92
+ };
93
+ type LegalInfo = {
94
+ /**
95
+ * The legal name of the entity.
96
+ */
97
+ legalName?: string;
98
+ /**
99
+ * The registration date of the legal entity in the ISO 8601 format, e.g. 2020-04-30T04:00:00.000Z.
100
+ */
101
+ registrationDate?: string;
102
+ /**
103
+ * The tax registration number of the legal entity.
104
+ */
105
+ taxRegistrationNumber?: string;
106
+ /**
107
+ * The registration agency of the legal entity.
108
+ */
109
+ registrationAgency?: string;
110
+ /**
111
+ * The country in which the legal entity has been registered. The country needs to be defined and active in the Country Service.
112
+ */
113
+ countryOfRegistration?: string;
114
+ /**
115
+ * The unique identifier of the legal entity registration.
116
+ */
117
+ registrationId?: string;
118
+ };
119
+ /**
120
+ * List of restrictions which determine who can view or manage the Legal Entity.
121
+ */
122
+ type Restrictions = Array<string> | null;
123
+ type LegalEntityCreate = {
124
+ /**
125
+ * Custom legal entity identifier. If not provided, it is automatically generated.
126
+ */
127
+ id?: string;
128
+ /**
129
+ * The name of the legal entity.
130
+ */
131
+ name: string;
132
+ /**
133
+ * The type of the legal entity. Default value if not provided is: `COMPANY`
134
+ */
135
+ type?: 'COMPANY' | 'SUBSIDIARY';
136
+ /**
137
+ * The id of the parent legal entity.
138
+ */
139
+ parentId?: string;
140
+ accountLimit?: AccountLimit;
141
+ legalInfo?: LegalInfo;
142
+ /**
143
+ * The list of customer group IDs assigned to the legal entity.
144
+ */
145
+ customerGroups?: Array<CustomerGroup>;
146
+ /**
147
+ * The list of location IDs assigned to the legal entity.
148
+ */
149
+ entitiesAddresses?: Array<ResourceId>;
150
+ /**
151
+ * The list of customer assignment IDs of an approval group of the legal entity.
152
+ */
153
+ approvalGroup?: Array<ResourceId>;
154
+ restrictions?: Restrictions;
155
+ metadata?: MetadataCreate;
156
+ /**
157
+ * Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.
158
+ */
159
+ mixins?: {
160
+ [key: string]: unknown;
161
+ };
162
+ };
163
+ type LegalEntityUpdate = {
164
+ /**
165
+ * The name of the legal entity.
166
+ */
167
+ name: string;
168
+ /**
169
+ * The type of the legal entity.
170
+ */
171
+ type: 'COMPANY' | 'SUBSIDIARY';
172
+ /**
173
+ * The id of the parent legal entity.
174
+ */
175
+ parentId?: string;
176
+ accountLimit?: AccountLimit;
177
+ legalInfo?: LegalInfo;
178
+ /**
179
+ * The list of customer group IDs assigned to the legal entity.
180
+ */
181
+ customerGroups?: Array<ResourceId>;
182
+ /**
183
+ * The list of location IDs assigned to the legal entity.
184
+ */
185
+ entitiesAddresses?: Array<ResourceId>;
186
+ /**
187
+ * The list of customer assignment IDs of an approval user group of the legal entity.
188
+ */
189
+ approvalGroup?: Array<ResourceId>;
190
+ restrictions?: Restrictions;
191
+ metadata?: MetadataUpdate;
192
+ /**
193
+ * Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.
194
+ */
195
+ mixins?: {
196
+ [key: string]: unknown;
197
+ };
198
+ };
199
+ type Customer = {
200
+ /**
201
+ * The customer unique identifier.
202
+ */
203
+ id?: string;
204
+ /**
205
+ * The name of the customer.
206
+ */
207
+ name?: string;
208
+ /**
209
+ * The surname of the customer.
210
+ */
211
+ surname?: string;
212
+ /**
213
+ * The email of the customer.
214
+ */
215
+ email?: string;
216
+ /**
217
+ * The phone number of the customer.
218
+ */
219
+ phone?: string;
220
+ };
221
+ type ContactAssignment = {
222
+ /**
223
+ * The customer assignment unique identifier.
224
+ */
225
+ id?: string;
226
+ legalEntity?: LegalEntity;
227
+ customer?: Customer;
228
+ /**
229
+ * The type of the customer assignment.
230
+ */
231
+ type?: 'PRIMARY' | 'BILLING' | 'LOGISTICS' | 'CONTACT';
232
+ /**
233
+ * Indicates whether the customer is primary.
234
+ */
235
+ primary?: boolean;
236
+ metadata?: Metadata;
237
+ /**
238
+ * Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.
239
+ */
240
+ mixins?: {
241
+ [key: string]: unknown;
242
+ };
243
+ };
244
+ type ContactAssignmentWithoutExpandedLegalEntity = {
245
+ /**
246
+ * The customer assignment unique identifier.
247
+ */
248
+ id?: string;
249
+ /**
250
+ * Assigned legal entity.
251
+ */
252
+ legalEntity?: {
253
+ /**
254
+ * The legal entity unique identifier.
255
+ */
256
+ id?: string;
257
+ };
258
+ customer?: Customer;
259
+ /**
260
+ * The type of the customer assignment.
261
+ */
262
+ type?: 'PRIMARY' | 'BILLING' | 'LOGISTICS' | 'CONTACT';
263
+ /**
264
+ * Indicates whether the customer is primary.
265
+ */
266
+ primary?: boolean;
267
+ metadata?: Metadata;
268
+ };
269
+ type ContactAssignmentCreate = {
270
+ /**
271
+ * Custom assignment identifier. If not provided, it is automatically generated.
272
+ */
273
+ id?: string;
274
+ /**
275
+ * The legal entity unique identifier.
276
+ */
277
+ legalEntity: {
278
+ /**
279
+ * The unique identifier of the legal entity.
280
+ */
281
+ id: string;
282
+ };
283
+ /**
284
+ * The customer unique identifier.
285
+ */
286
+ customer: {
287
+ /**
288
+ * The unique identifier of the customer.
289
+ */
290
+ id: string;
291
+ };
292
+ /**
293
+ * The type of the customer assignment. If not provided, it is set to `Contact` by default.
294
+ */
295
+ type?: 'PRIMARY' | 'BILLING' | 'LOGISTICS' | 'CONTACT';
296
+ /**
297
+ * Indicates whether the customer is primary.
298
+ */
299
+ primary?: boolean;
300
+ metadata?: MetadataCreate;
301
+ /**
302
+ * Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.
303
+ */
304
+ mixins?: {
305
+ [key: string]: unknown;
306
+ };
307
+ };
308
+ type ContactAssignmentUpdate = {
309
+ /**
310
+ * The legal entity unique identifier.
311
+ */
312
+ legalEntity: {
313
+ /**
314
+ * The unique identifier of the legal entity.
315
+ */
316
+ id: string;
317
+ };
318
+ /**
319
+ * The customer unique identifier.
320
+ */
321
+ customer: {
322
+ /**
323
+ * The unique identifier of the customer.
324
+ */
325
+ id: string;
326
+ };
327
+ /**
328
+ * The type of the customer assignment.
329
+ */
330
+ type: 'PRIMARY' | 'BILLING' | 'LOGISTICS' | 'CONTACT';
331
+ /**
332
+ * Indicates whether the customer is primary.
333
+ */
334
+ primary?: boolean;
335
+ metadata?: MetadataUpdate;
336
+ /**
337
+ * Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.
338
+ */
339
+ mixins?: {
340
+ [key: string]: unknown;
341
+ };
342
+ };
343
+ type Location = {
344
+ /**
345
+ * The location unique identifier.
346
+ */
347
+ id?: string;
348
+ /**
349
+ * The name of the location
350
+ */
351
+ name?: string;
352
+ /**
353
+ * The type of the location.
354
+ */
355
+ type?: 'HEADQUARTER' | 'WAREHOUSE' | 'OFFICE';
356
+ contactDetails?: ContactDetails;
357
+ metadata?: Metadata;
358
+ /**
359
+ * Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.
360
+ */
361
+ mixins?: {
362
+ [key: string]: unknown;
363
+ };
364
+ };
365
+ type LocationCreate = {
366
+ /**
367
+ * Custom location identifier. If not provided, it is automatically generated.
368
+ */
369
+ id?: string;
370
+ /**
371
+ * The name of the location,
372
+ */
373
+ name?: string;
374
+ /**
375
+ * The type of the location.
376
+ */
377
+ type: 'HEADQUARTER' | 'WAREHOUSE' | 'OFFICE';
378
+ contactDetails: ContactDetails;
379
+ metadata?: MetadataCreate;
380
+ /**
381
+ * Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.
382
+ */
383
+ mixins?: {
384
+ [key: string]: unknown;
385
+ };
386
+ };
387
+ type LocationUpdate = {
388
+ /**
389
+ * The name of the location
390
+ */
391
+ name?: string;
392
+ /**
393
+ * The type of the location.
394
+ */
395
+ type: 'HEADQUARTER' | 'WAREHOUSE' | 'OFFICE';
396
+ contactDetails: ContactDetails;
397
+ metadata?: MetadataUpdate;
398
+ /**
399
+ * Mixins request. A map where a key represent mixins set name and a value represent a map with key-value pairs.
400
+ */
401
+ mixins?: {
402
+ [key: string]: unknown;
403
+ };
404
+ };
405
+ type ContactDetails = {
406
+ /**
407
+ * The list of contact emails.
408
+ */
409
+ emails?: Array<string>;
410
+ /**
411
+ * The list of contact phone numbers.
412
+ */
413
+ phones?: Array<string>;
414
+ /**
415
+ * The first address line of the contact.
416
+ */
417
+ addressLine1?: string;
418
+ /**
419
+ * The second address line of the contact.
420
+ */
421
+ addressLine2?: string;
422
+ /**
423
+ * The city of the contact.
424
+ */
425
+ city?: string;
426
+ /**
427
+ * The state of the contact.
428
+ */
429
+ state?: string;
430
+ /**
431
+ * The post code of the contact.
432
+ */
433
+ postcode?: string;
434
+ /**
435
+ * The country code of the contact.
436
+ */
437
+ countryCode?: string;
438
+ /**
439
+ * Allows to tag the location.
440
+ */
441
+ tags?: Array<string>;
442
+ };
443
+ /**
444
+ * Metadata request.
445
+ */
446
+ type MetadataCreate = {
447
+ /**
448
+ * Links to the mixin schemas. A map where the keys represent mixins set attributes and the values represent url to a schema for a particular set.
449
+ */
450
+ mixins?: {
451
+ [key: string]: unknown;
452
+ };
453
+ };
454
+
455
+ export type { AccountLimit as A, ContactAssignment as C, LegalEntity as L, ContactAssignmentCreate as a, ContactAssignmentUpdate as b, ContactDetails as c, CustomerGroup as d, LegalEntityCreate as e, LegalEntityUpdate as f, LegalInfo as g, Location as h, LocationCreate as i, LocationUpdate as j };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viu/emporix-sdk",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "TypeScript SDK for the Emporix Commerce Engine",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -1 +0,0 @@
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,a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,CAAK,MAAA,CAAO,CAAA,EAAG,EAAE,UAAA,EAAY,QAAA,EAAS,EAAG,IAAI,CAAC,CAAA;AAAA,EAC3F;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,mBAAA,CACJ,eAAA,EACA,SAAgC,EAAC,EACjC,OAAoB,IAAA,EACA;AACpB,IAAA,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 +0,0 @@
1
- {"version":3,"sources":["../src/services/orders.ts"],"names":[],"mappings":";AAmCA,SAAS,YAAA,CACP,CAAA,EACA,GAAA,EACA,KAAA,EACM;AACN,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,EAAA,EAAI;AACvC,IAAA,CAAA,CAAE,GAAG,CAAA,GAAI,KAAA;AAAA,EACX;AACF;AASO,IAAM,gBAAN,MAAoB;AAAA,EACzB,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAErB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,UAAA,EAAa,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,OAAA,CAAA;AAAA,EACrC;AAAA,EAEQ,WAAW,SAAA,EAAmE;AACpF,IAAA,OAAO,SAAA,GAAY,EAAE,YAAA,EAAc,SAAA,EAAU,GAAI,MAAA;AAAA,EACnD;AAAA;AAAA,EAGA,MAAM,QAAA,CACJ,IAAA,EACA,IAAA,GAA4B,EAAC,EACG;AAChC,IAAA,MAAM,QAAqD,EAAC;AAC5D,IAAA,YAAA,CAAa,KAAA,EAAO,YAAA,EAAc,IAAA,CAAK,UAAU,CAAA;AACjD,IAAA,YAAA,CAAa,KAAA,EAAO,UAAA,EAAY,IAAA,CAAK,QAAQ,CAAA;AAC7C,IAAA,YAAA,CAAa,KAAA,EAAO,QAAA,EAAU,IAAA,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O,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAe;AAAA,MAClC,MAAA,EAAQ,OAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,OAAO,CAAA,CAAA;AAAA,MAC/B,IAAA;AAAA,MACA,GAAI,MAAA,CAAO,IAAA,CAAK,KAAK,CAAA,CAAE,SAAS,CAAA,GAAI,EAAE,KAAA,EAAM,GAAI,EAAC;AAAA,MACjD,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AACF","file":"chunk-6UNFMCHZ.js","sourcesContent":["import type { ClientContext, PaginatedItems } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type {\n Order,\n OrderStatus,\n SalesOrderPatch,\n} from \"../generated/order-v2\";\n\n/** Optional fields supported by the order-v2 list endpoint. */\nexport interface ListMyOrdersOptions {\n pageNumber?: number;\n pageSize?: number;\n status?: OrderStatus;\n legalEntityId?: string;\n siteCode?: string;\n saasToken?: string;\n}\n\n/** Options for single-order reads (saas-token only). */\nexport interface GetOrderOptions {\n saasToken?: string;\n}\n\n/** Options for status transitions. */\nexport interface OrderTransitionOptions {\n saasToken?: string;\n comment?: string;\n}\n\n/** Options for `salesOrders.update`. */\nexport interface UpdateSalesOrderOptions {\n /** Forwarded as `?recalculate=`. Omit to use the server default (true). */\n recalculate?: boolean;\n}\n\nfunction setIfDefined<V>(\n q: Record<string, string | number | undefined>,\n key: string,\n value: V | undefined,\n): void {\n if (value !== undefined && value !== \"\") {\n q[key] = value as unknown as string | number;\n }\n}\n\n/**\n * Storefront-customer access to Order-v2's customer endpoints.\n *\n * `listMine`/`get` require `order.order_read_own`; transitions require\n * `order.order_manage_own`. All methods accept an optional `saasToken` that\n * is passed as the `saas-token` header (mirrors `checkout.placeOrder`).\n */\nexport class OrdersService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/order-v2/${this.ctx.tenant}/orders`;\n }\n\n private saasHeader(saasToken: string | undefined): Record<string, string> | undefined {\n return saasToken ? { \"saas-token\": saasToken } : undefined;\n }\n\n /** Lists the calling customer's orders. */\n async listMine(\n auth: AuthContext,\n opts: ListMyOrdersOptions = {},\n ): Promise<PaginatedItems<Order>> {\n const query: Record<string, string | number | undefined> = {};\n setIfDefined(query, \"pageNumber\", opts.pageNumber);\n setIfDefined(query, \"pageSize\", opts.pageSize);\n setIfDefined(query, \"status\", opts.status);\n setIfDefined(query, \"legalEntityId\", opts.legalEntityId);\n setIfDefined(query, \"siteCode\", opts.siteCode);\n const headers = this.saasHeader(opts.saasToken);\n return this.ctx.http.request<PaginatedItems<Order>>({\n method: \"GET\",\n path: this.base(),\n query,\n auth,\n ...(headers ? { headers } : {}),\n });\n }\n\n /** Fetches one of the calling customer's orders by id. */\n async get(\n orderId: string,\n auth: AuthContext,\n opts: GetOrderOptions = {},\n ): Promise<Order> {\n const headers = this.saasHeader(opts.saasToken);\n return this.ctx.http.request<Order>({\n method: \"GET\",\n path: `${this.base()}/${orderId}`,\n auth,\n ...(headers ? { headers } : {}),\n });\n }\n\n /** Transitions an order to a new status. Server enforces legal transitions. */\n async transition(\n orderId: string,\n status: OrderStatus,\n auth: AuthContext,\n opts: OrderTransitionOptions = {},\n ): Promise<void> {\n const body: { status: OrderStatus; comment?: string } = { status };\n if (opts.comment !== undefined) body.comment = opts.comment;\n const headers = this.saasHeader(opts.saasToken);\n await this.ctx.http.request<void>({\n method: \"POST\",\n path: `${this.base()}/${orderId}/transitions`,\n auth,\n body,\n ...(headers ? { headers } : {}),\n });\n }\n\n /** Convenience: transitions to `DECLINED` (customer cancel). */\n async cancel(\n orderId: string,\n auth: AuthContext,\n opts: { saasToken?: string } = {},\n ): Promise<void> {\n await this.transition(orderId, \"DECLINED\", auth, opts);\n }\n}\n\n/**\n * Backend / service-account access to the merchant-facing\n * `/salesorders/{id}` resource. Requires `order.order_read` (read) /\n * `order.order_manage` (update) scopes on a service token.\n *\n * The full admin list + filter surface is deferred to a follow-up\n * sub-spec. This service ships only single-resource read + patch — the\n * common backend use case (e.g. mixin updates after fulfilment).\n */\nexport class SalesOrdersService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/order-v2/${this.ctx.tenant}/salesorders`;\n }\n\n /** Fetches a single sales-order by id. */\n async get(orderId: string, auth: AuthContext): Promise<Order> {\n return this.ctx.http.request<Order>({\n method: \"GET\",\n path: `${this.base()}/${orderId}`,\n auth,\n });\n }\n\n /** Patches an existing order (status, mixins, customAttributes, metadata). */\n async update(\n orderId: string,\n patch: SalesOrderPatch,\n auth: AuthContext,\n opts: UpdateSalesOrderOptions = {},\n ): Promise<Order> {\n const query: Record<string, string> = {};\n if (opts.recalculate === false) query.recalculate = \"false\";\n return this.ctx.http.request<Order>({\n method: \"PATCH\",\n path: `${this.base()}/${orderId}`,\n auth,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n body: patch,\n });\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/contacts.ts"],"names":[],"mappings":";AAeO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAErB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,qBAAA,EAAwB,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,oBAAA,CAAA;AAAA,EAChD;AAAA;AAAA,EAGA,MAAM,cAAA,CAAe,aAAA,EAAuB,IAAA,EAAiD;AAC3F,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAA6B;AAAA,MAChD,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB,KAAA,EAAO,EAAE,aAAA,EAAc;AAAA,MACvB;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,MAAA,CAAO,KAAA,EAAgC,IAAA,EAA4C;AACvF,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAwB;AAAA,MAC3C,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,MAAA,CACJ,mBAAA,EACA,KAAA,EACA,IAAA,EAC4B;AAC5B,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAA2B;AAAA,MAC9C,MAAA,EAAQ,OAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,mBAAmB,CAAA,CAAA;AAAA,MAC3C,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,QAAA,CAAS,mBAAA,EAA6B,IAAA,EAAkC;AAC5E,IAAA,MAAM,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAc;AAAA,MAChC,MAAA,EAAQ,QAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,mBAAmB,CAAA,CAAA;AAAA,MAC3C;AAAA,KACD,CAAA;AAAA,EACH;AACF","file":"chunk-B56JZNI7.js","sourcesContent":["import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type {\n ContactAssignment,\n ContactAssignmentCreate,\n ContactAssignmentUpdate,\n} from \"../generated/customer-management\";\n\n/**\n * Manages contact assignments linking customers to legal entities.\n *\n * `listForCompany` requires `customermanagement.contactassignment_read`;\n * `assign`/`update`/`unassign` require `_manage`. The query param\n * `legalEntityId` scopes the list to one company.\n */\nexport class ContactsService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/customer-management/${this.ctx.tenant}/contact-assignments`;\n }\n\n /** Lists contact assignments for one legal entity. */\n async listForCompany(legalEntityId: string, auth: AuthContext): Promise<ContactAssignment[]> {\n return this.ctx.http.request<ContactAssignment[]>({\n method: \"GET\",\n path: this.base(),\n query: { legalEntityId },\n auth,\n });\n }\n\n /** Creates a contact assignment. */\n async assign(input: ContactAssignmentCreate, auth: AuthContext): Promise<{ id: string }> {\n return this.ctx.http.request<{ id: string }>({\n method: \"POST\",\n path: this.base(),\n auth,\n body: input,\n });\n }\n\n /** Patches a contact assignment. */\n async update(\n contactAssignmentId: string,\n patch: ContactAssignmentUpdate,\n auth: AuthContext,\n ): Promise<ContactAssignment> {\n return this.ctx.http.request<ContactAssignment>({\n method: \"PATCH\",\n path: `${this.base()}/${contactAssignmentId}`,\n auth,\n body: patch,\n });\n }\n\n /** Deletes a contact assignment. */\n async unassign(contactAssignmentId: string, auth: AuthContext): Promise<void> {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/${contactAssignmentId}`,\n auth,\n });\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/locations.ts"],"names":[],"mappings":";AAeO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAErB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,qBAAA,EAAwB,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,UAAA,CAAA;AAAA,EAChD;AAAA;AAAA,EAGA,MAAM,cAAA,CAAe,aAAA,EAAuB,IAAA,EAAwC;AAClF,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAoB;AAAA,MACvC,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB,KAAA,EAAO,EAAE,aAAA,EAAc;AAAA,MACvB;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,GAAA,CAAI,UAAA,EAAoB,IAAA,EAAsC;AAClE,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAkB;AAAA,MACrC,MAAA,EAAQ,KAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,UAAU,CAAA,CAAA;AAAA,MAClC;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,MAAA,CAAO,KAAA,EAAuB,IAAA,EAA4C;AAC9E,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAwB;AAAA,MAC3C,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,MAAA,CACJ,UAAA,EACA,KAAA,EACA,IAAA,EACmB;AACnB,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAkB;AAAA,MACrC,MAAA,EAAQ,OAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,UAAU,CAAA,CAAA;AAAA,MAClC,IAAA;AAAA,MACA,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,MAAA,CAAO,UAAA,EAAoB,IAAA,EAAkC;AACjE,IAAA,MAAM,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAc;AAAA,MAChC,MAAA,EAAQ,QAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,UAAU,CAAA,CAAA;AAAA,MAClC;AAAA,KACD,CAAA;AAAA,EACH;AACF","file":"chunk-NM7VDXBR.js","sourcesContent":["import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type {\n Location,\n LocationCreate,\n LocationUpdate,\n} from \"../generated/customer-management\";\n\n/**\n * Manages locations owned by a legal entity. Three types are supported:\n * HEADQUARTER, WAREHOUSE, OFFICE.\n *\n * Reads require `customermanagement.location_read`; mutations require\n * `_manage`.\n */\nexport class LocationsService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/customer-management/${this.ctx.tenant}/locations`;\n }\n\n /** Lists locations owned by one legal entity. */\n async listForCompany(legalEntityId: string, auth: AuthContext): Promise<Location[]> {\n return this.ctx.http.request<Location[]>({\n method: \"GET\",\n path: this.base(),\n query: { legalEntityId },\n auth,\n });\n }\n\n /** Fetches one location by id. */\n async get(locationId: string, auth: AuthContext): Promise<Location> {\n return this.ctx.http.request<Location>({\n method: \"GET\",\n path: `${this.base()}/${locationId}`,\n auth,\n });\n }\n\n /** Creates a location for a legal entity. */\n async create(input: LocationCreate, auth: AuthContext): Promise<{ id: string }> {\n return this.ctx.http.request<{ id: string }>({\n method: \"POST\",\n path: this.base(),\n auth,\n body: input,\n });\n }\n\n /** Patches a location. */\n async update(\n locationId: string,\n patch: LocationUpdate,\n auth: AuthContext,\n ): Promise<Location> {\n return this.ctx.http.request<Location>({\n method: \"PATCH\",\n path: `${this.base()}/${locationId}`,\n auth,\n body: patch,\n });\n }\n\n /** Deletes a location. */\n async delete(locationId: string, auth: AuthContext): Promise<void> {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/${locationId}`,\n auth,\n });\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/companies.ts"],"names":[],"mappings":";AAgBO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAErB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,qBAAA,EAAwB,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,eAAA,CAAA;AAAA,EAChD;AAAA;AAAA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AAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,aAAa,CAAA,CAAA;AAAA,MACrC;AAAA,KACD,CAAA;AAAA,EACH;AACF","file":"chunk-RXVVFNYN.js","sourcesContent":["import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type {\n LegalEntity,\n LegalEntityCreate,\n LegalEntityUpdate,\n} from \"../generated/customer-management\";\n\n/**\n * Storefront-customer access to Legal Entities.\n *\n * `listMine`/`get` require `customermanagement.legalentity_read_own` on the\n * customer token. `create`/`update`/`delete` require the corresponding\n * `_manage` scopes — typically only granted to Admin-group customers; a 403\n * surfaces as `EmporixInsufficientScopeError`.\n */\nexport class CompaniesService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/customer-management/${this.ctx.tenant}/legal-entities`;\n }\n\n /** Lists the legal entities the calling customer is assigned to. */\n async listMine(auth: AuthContext): Promise<LegalEntity[]> {\n return this.ctx.http.request<LegalEntity[]>({\n method: \"GET\",\n path: this.base(),\n auth,\n });\n }\n\n /** Fetches a single legal entity by id. */\n async get(legalEntityId: string, auth: AuthContext): Promise<LegalEntity> {\n return this.ctx.http.request<LegalEntity>({\n method: \"GET\",\n path: `${this.base()}/${legalEntityId}`,\n auth,\n });\n }\n\n /** Creates a legal entity. Requires `customermanagement.legalentity_manage`. */\n async create(input: LegalEntityCreate, auth: AuthContext): Promise<{ id: string }> {\n return this.ctx.http.request<{ id: string }>({\n method: \"POST\",\n path: this.base(),\n auth,\n body: input,\n });\n }\n\n /** Patches a legal entity. */\n async update(\n legalEntityId: string,\n patch: LegalEntityUpdate,\n auth: AuthContext,\n ): Promise<LegalEntity> {\n return this.ctx.http.request<LegalEntity>({\n method: \"PATCH\",\n path: `${this.base()}/${legalEntityId}`,\n auth,\n body: patch,\n });\n }\n\n /** Deletes a legal entity (async cascade on the server). */\n async delete(legalEntityId: string, auth: AuthContext): Promise<void> {\n await this.ctx.http.request<void>({\n method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W;AACzB,QAAA,IAAI;AACF,UAAA,OAAA,CAAQ,GAAG,CAAA,GAAI,MAAM,IAAA,CAAK,cAAA,CAAe,OAAO,IAAI,CAAA;AAAA,QACtD,SAAS,GAAA,EAAK;AACZ,UAAA,IAAI,IAAA,CAAK,sBAAsB,MAAM,GAAA;AACrC,UAAA,OAAA,CAAQ,GAAG,IAAI,EAAC;AAChB,UAAA,IAAA,CAAK,YAAA,GAAe,KAAK,GAAG,CAAA;AAAA,QAC9B;AAAA,MACF;AAAA,IACF,CAAA;AAEA,IAAA,MAAM,WAAA,GAAc,IAAA,CAAK,GAAA,CAAI,WAAA,EAAa,OAAO,MAAM,CAAA;AACvD,IAAA,MAAM,OAAA,CAAQ,GAAA,CAAI,KAAA,CAAM,IAAA,CAAK,EAAE,MAAA,EAAQ,WAAA,EAAY,EAAG,MAAM,MAAA,EAAQ,CAAC,CAAA;AAErE,IAAA,OAAO,QAAQ,IAAA,EAAK;AAAA,EACtB;AACF","file":"chunk-SCI7D74B.js","sourcesContent":["import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport { EmporixAuthError } from \"../core/errors\";\nimport type { Match, MatchByContext, MatchResponse } from \"../generated/price\";\n\n/** Session-context match request body (generated). */\nexport type PriceMatchByContextInput = MatchByContext;\n\n/** Explicit-context match request body (generated). */\nexport type PriceMatchInput = Match;\n\n/** A resolved price (full generated match-response schema). */\nexport type PriceMatch = MatchResponse;\n\n/** Options for {@link PriceService.matchByContextChunked}. */\nexport interface MatchByContextChunkedOptions {\n /** Items per request. Default 50. Must be >= 1. */\n chunkSize?: number;\n /** Maximum number of requests in flight at once. Default 4. Must be >= 1. */\n concurrency?: number;\n /** Invoked once per failed chunk (default mode only — not when throwing). */\n onChunkError?: (err: unknown, chunkIndex: number) => void;\n /** When true, the first failing chunk rejects the whole call. Default false. */\n throwOnAnyChunkError?: boolean;\n}\n\nconst ANON: AuthContext = { kind: \"anonymous\" };\nconst SERVICE: AuthContext = { kind: \"service\" };\n\nfunction requireContextAuth(auth: AuthContext | undefined): AuthContext {\n const a = auth ?? ANON;\n if (a.kind === \"anonymous\" || a.kind === \"customer\" || a.kind === \"raw\") return a;\n throw new EmporixAuthError(\n \"match-prices-by-context requires an anonymous, customer, or raw AuthContext\",\n );\n}\n\n/**\n * Price matching. The Cart service does not resolve prices — call this\n * explicitly before rendering money and again right before placing an order.\n * The SDK is stateless: it never caches or revalidates prices.\n */\nexport class PriceService {\n constructor(private readonly ctx: ClientContext) {}\n\n /**\n * Resolves prices using the session context bound to the bearer token\n * (currency/site/country were set at anonymous-login time). Default auth:\n * anonymous; pass a customer/raw context for personalized pricing.\n */\n async matchByContext(\n input: PriceMatchByContextInput,\n auth?: AuthContext,\n ): Promise<PriceMatch[]> {\n return this.ctx.http.request<PriceMatch[]>({\n method: \"POST\",\n path: `/price/${this.ctx.tenant}/match-prices-by-context`,\n auth: requireContextAuth(auth),\n body: input,\n });\n }\n\n /**\n * Resolves prices from an explicit context. Default auth: service\n * (requires `price.price_read` / `price.price_manage`).\n */\n async match(input: PriceMatchInput, auth: AuthContext = SERVICE): Promise<PriceMatch[]> {\n return this.ctx.http.request<PriceMatch[]>({\n method: \"POST\",\n path: `/price/${this.ctx.tenant}/match-prices`,\n auth,\n body: input,\n });\n }\n\n /**\n * Chunked variant of {@link matchByContext} for large `items` arrays. The\n * Emporix backend handles only a limited number of items per request\n * (production limit ~50), so this splits `input.items` into chunks and runs\n * `matchByContext` with bounded concurrency.\n *\n * By default a failing chunk is skipped (its items are absent from the\n * result) and `opts.onChunkError` is called once for it; pass\n * `throwOnAnyChunkError: true` to reject on the first failure instead.\n *\n * **Result order is not guaranteed** — match entries back to your items by\n * `priceId` / `itemRef.id`.\n */\n async matchByContextChunked(\n input: PriceMatchByContextInput,\n opts: MatchByContextChunkedOptions = {},\n auth?: AuthContext,\n ): Promise<PriceMatch[]> {\n const chunkSize = opts.chunkSize ?? 50;\n const concurrency = opts.concurrency ?? 4;\n if (chunkSize < 1) throw new Error(\"chunkSize must be >= 1\");\n if (concurrency < 1) throw new Error(\"concurrency must be >= 1\");\n\n const items = input.items ?? [];\n if (items.length === 0) return [];\n\n const chunks: PriceMatchByContextInput[] = [];\n for (let i = 0; i < items.length; i += chunkSize) {\n chunks.push({ ...input, items: items.slice(i, i + chunkSize) });\n }\n\n const results: PriceMatch[][] = new Array(chunks.length);\n let cursor = 0;\n\n const worker = async (): Promise<void> => {\n for (;;) {\n const idx = cursor++;\n const chunk = chunks[idx];\n if (chunk === undefined) return; // past the end\n try {\n results[idx] = await this.matchByContext(chunk, auth);\n } catch (err) {\n if (opts.throwOnAnyChunkError) throw err;\n results[idx] = [];\n opts.onChunkError?.(err, idx);\n }\n }\n };\n\n const workerCount = Math.min(concurrency, chunks.length);\n await Promise.all(Array.from({ length: workerCount }, () => worker()));\n\n return results.flat();\n }\n}\n"]}
@@ -1,23 +0,0 @@
1
- // src/services/customer-groups.ts
2
- var CustomerGroupsService = class {
3
- constructor(ctx) {
4
- this.ctx = ctx;
5
- }
6
- ctx;
7
- base() {
8
- return `/iam/${this.ctx.tenant}/groups`;
9
- }
10
- /** Lists customer groups belonging to one legal entity. */
11
- async listForCompany(legalEntityId, auth) {
12
- return this.ctx.http.request({
13
- method: "GET",
14
- path: this.base(),
15
- query: { "b2b.legalEntityId": legalEntityId },
16
- auth
17
- });
18
- }
19
- };
20
-
21
- export { CustomerGroupsService };
22
- //# sourceMappingURL=chunk-SKX7KCMH.js.map
23
- //# sourceMappingURL=chunk-SKX7KCMH.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/customer-groups.ts"],"names":[],"mappings":";AAWO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAErB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,KAAA,EAAQ,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,OAAA,CAAA;AAAA,EAChC;AAAA;AAAA,EAGA,MAAM,cAAA,CAAe,aAAA,EAAuB,IAAA,EAAwC;AAClF,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAoB;AAAA,MACvC,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,KAAK,IAAA,EAAK;AAAA,MAChB,KAAA,EAAO,EAAE,mBAAA,EAAqB,aAAA,EAAc;AAAA,MAC5C;AAAA,KACD,CAAA;AAAA,EACH;AACF","file":"chunk-SKX7KCMH.js","sourcesContent":["import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport type { IamGroup } from \"../generated/iam\";\n\n/**\n * Read-only access to IAM customer groups for a legal entity.\n *\n * Member-management endpoints (`addMember`/`removeMember`) are deferred —\n * the exact IAM path/body shape isn't in the SDK input set yet. They will\n * land in a small follow-up plan once the API reference is confirmed.\n */\nexport class CustomerGroupsService {\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/iam/${this.ctx.tenant}/groups`;\n }\n\n /** Lists customer groups belonging to one legal entity. */\n async listForCompany(legalEntityId: string, auth: AuthContext): Promise<IamGroup[]> {\n return this.ctx.http.request<IamGroup[]>({\n method: \"GET\",\n path: this.base(),\n query: { \"b2b.legalEntityId\": legalEntityId },\n auth,\n });\n }\n}\n"]}