@viu/emporix-sdk 2.19.0 → 2.20.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 +22 -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.cjs +12 -0
  7. package/dist/category.cjs.map +1 -1
  8. package/dist/category.d.cts +12 -2
  9. package/dist/category.d.ts +12 -2
  10. package/dist/category.js +1 -1
  11. package/dist/checkout.d.cts +1 -1
  12. package/dist/checkout.d.ts +1 -1
  13. package/dist/{chunk-6XND7SYV.js → chunk-ZNLHLFQM.js} +14 -2
  14. package/dist/chunk-ZNLHLFQM.js.map +1 -0
  15. package/dist/companies.d.cts +1 -1
  16. package/dist/companies.d.ts +1 -1
  17. package/dist/contacts.d.cts +1 -1
  18. package/dist/contacts.d.ts +1 -1
  19. package/dist/{context-DhoFgoKf.d.cts → context-Dawv2AtS.d.cts} +16 -0
  20. package/dist/{context-DhoFgoKf.d.ts → context-Dawv2AtS.d.ts} +16 -0
  21. package/dist/customer-groups.d.cts +1 -1
  22. package/dist/customer-groups.d.ts +1 -1
  23. package/dist/customer.d.cts +1 -1
  24. package/dist/customer.d.ts +1 -1
  25. package/dist/index.cjs +461 -299
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +238 -17
  28. package/dist/index.d.ts +238 -17
  29. package/dist/index.js +153 -3
  30. package/dist/index.js.map +1 -1
  31. package/dist/locations.d.cts +1 -1
  32. package/dist/locations.d.ts +1 -1
  33. package/dist/media.d.cts +17 -2
  34. package/dist/media.d.ts +17 -2
  35. package/dist/orders.d.cts +10 -27
  36. package/dist/orders.d.ts +10 -27
  37. package/dist/payment.d.cts +1 -1
  38. package/dist/payment.d.ts +1 -1
  39. package/dist/price.d.cts +5 -18
  40. package/dist/price.d.ts +5 -18
  41. package/dist/product.d.cts +7 -1
  42. package/dist/product.d.ts +7 -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-6XND7SYV.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-DhoFgoKf.cjs';
1
+ import { C as ClientContext, b as AuthContext } from './context-Dawv2AtS.cjs';
2
2
  import { h as Location, i as LocationCreate, j as LocationUpdate } from './types.gen-C_wOXYZB.cjs';
3
3
  export { c as ContactDetails } from './types.gen-C_wOXYZB.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-DhoFgoKf.js';
1
+ import { C as ClientContext, b as AuthContext } from './context-Dawv2AtS.js';
2
2
  import { h as Location, i as LocationCreate, j as LocationUpdate } from './types.gen-C_wOXYZB.js';
3
3
  export { c as ContactDetails } from './types.gen-C_wOXYZB.js';
4
4
 
package/dist/media.d.cts CHANGED
@@ -1,11 +1,19 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-DhoFgoKf.cjs';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-Dawv2AtS.cjs';
2
2
 
3
+ type MetadataCreate = {
4
+ /**
5
+ * A key-value map, where key is a mixin name and value is a link to the mixin schema. Must be provided together with the corresponding mixin values in the `mixins` object.
6
+ */
7
+ mixins?: {
8
+ [key: string]: string;
9
+ };
10
+ };
3
11
  type MetadataUpdate = {
4
12
  /**
5
13
  * Version of the document.
6
14
  */
7
15
  version: number;
8
- };
16
+ } & MetadataCreate;
9
17
  type MetadataGet = MetadataUpdate & {
10
18
  /**
11
19
  * Date and time when the document was created.
@@ -39,6 +47,13 @@ type Asset$1 = {
39
47
  * List of references.
40
48
  */
41
49
  refIds?: Array<RefId>;
50
+ /**
51
+ * Custom asset attributes.
52
+ */
53
+ mixins?: {
54
+ [key: string]: unknown;
55
+ };
56
+ metadata?: MetadataCreate;
42
57
  };
43
58
  type AssetDetailsCreate = {
44
59
  /**
package/dist/media.d.ts CHANGED
@@ -1,11 +1,19 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-DhoFgoKf.js';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-Dawv2AtS.js';
2
2
 
3
+ type MetadataCreate = {
4
+ /**
5
+ * A key-value map, where key is a mixin name and value is a link to the mixin schema. Must be provided together with the corresponding mixin values in the `mixins` object.
6
+ */
7
+ mixins?: {
8
+ [key: string]: string;
9
+ };
10
+ };
3
11
  type MetadataUpdate = {
4
12
  /**
5
13
  * Version of the document.
6
14
  */
7
15
  version: number;
8
- };
16
+ } & MetadataCreate;
9
17
  type MetadataGet = MetadataUpdate & {
10
18
  /**
11
19
  * Date and time when the document was created.
@@ -39,6 +47,13 @@ type Asset$1 = {
39
47
  * List of references.
40
48
  */
41
49
  refIds?: Array<RefId>;
50
+ /**
51
+ * Custom asset attributes.
52
+ */
53
+ mixins?: {
54
+ [key: string]: unknown;
55
+ };
56
+ metadata?: MetadataCreate;
42
57
  };
43
58
  type AssetDetailsCreate = {
44
59
  /**
package/dist/orders.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-DhoFgoKf.cjs';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-Dawv2AtS.cjs';
2
2
  import { a as QueryFor } from './query-mLQs2WFr.cjs';
3
3
 
4
4
  /**
@@ -74,12 +74,9 @@ type OrderEntry = {
74
74
  */
75
75
  id?: string;
76
76
  itemYrn?: Yrn;
77
- /**
78
- * @deprecated
79
- */
80
77
  fees?: AggregateFee & {
81
78
  [key: string]: unknown;
82
- };
79
+ } & unknown;
83
80
  /**
84
81
  * The amount of items.
85
82
  */
@@ -97,12 +94,12 @@ type OrderEntry = {
97
94
  */
98
95
  effectiveQuantity?: number;
99
96
  /**
100
- * The original amount. This field is deprecated**. Please use `calculatedUnitPrice` instead. The `calculatedUnitPrice` field provides the same value with updated functionality.
97
+ * The original amount. **This field is deprecated**. Please use `calculatedUnitPrice` instead. The `calculatedUnitPrice` field provides the same value with updated functionality.
101
98
  * @deprecated
102
99
  */
103
100
  originalAmount?: number;
104
101
  /**
105
- * The original price. This field is deprecated**. Please use `calculatedUnitPrice` instead. The `calculatedUnitPrice` field provides the same value with updated functionality.
102
+ * The original price. **This field is deprecated**. Please use `calculatedUnitPrice` instead. The `calculatedUnitPrice` field provides the same value with updated functionality.
106
103
  * @deprecated
107
104
  */
108
105
  originalPrice?: number;
@@ -135,12 +132,9 @@ type OrderEntry = {
135
132
  */
136
133
  authorizedAmount?: number;
137
134
  product?: Product;
138
- /**
139
- * @deprecated
140
- */
141
135
  tax?: Tax & {
142
136
  [key: string]: unknown;
143
- };
137
+ } & unknown;
144
138
  price?: Price;
145
139
  metadata?: MixinsMetadata;
146
140
  mixins?: {
@@ -778,12 +772,9 @@ type Vendor = {
778
772
  */
779
773
  type OrderCommonDto = {
780
774
  restriction?: Restriction;
781
- /**
782
- * @deprecated
783
- */
784
775
  feeYrnAggregate?: AggregateFee & {
785
776
  [key: string]: unknown;
786
- };
777
+ } & unknown;
787
778
  status?: OrderStatus;
788
779
  /**
789
780
  * The identifier of a cart that was used to create this order.
@@ -823,18 +814,12 @@ type OrderCommonDto = {
823
814
  * Payment list.
824
815
  */
825
816
  payments?: Array<Payment>;
826
- /**
827
- * @deprecated
828
- */
829
817
  shipping?: Shipping & {
830
818
  [key: string]: unknown;
831
- };
832
- /**
833
- * @deprecated
834
- */
819
+ } & unknown;
835
820
  tax?: Tax & {
836
821
  [key: string]: unknown;
837
- };
822
+ } & unknown;
838
823
  /**
839
824
  * Order sub total price. **This field is deprecated**. Please use `calculatedPrice.price` or `calculatedPrice.discountedPrice` instead. These fields provide the same value with updated functionality.
840
825
  * @deprecated
@@ -856,16 +841,14 @@ type OrderCommonDto = {
856
841
  /**
857
842
  * Order cycle date.
858
843
  *
859
- * ***NOTE***
860
- * This attribute is DEPRECATED, please use the `deliveryWindow.deliveryCycle` attribute
844
+ * **This field is deprecated**. Please use the `deliveryWindow.deliveryCycle` attribute instead.
861
845
  * @deprecated
862
846
  */
863
847
  orderCycle?: string;
864
848
  /**
865
849
  * Delivery window's unique identifier.
866
850
  *
867
- * ***NOTE***
868
- * This attribute is DEPRECATED, please use the `deliveryWindow.id` attribute
851
+ * **This field is deprecated**. Please use the `deliveryWindow.id` attribute instead.
869
852
  * @deprecated
870
853
  */
871
854
  deliveryWindowId?: string;
package/dist/orders.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-DhoFgoKf.js';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-Dawv2AtS.js';
2
2
  import { a as QueryFor } from './query-mLQs2WFr.js';
3
3
 
4
4
  /**
@@ -74,12 +74,9 @@ type OrderEntry = {
74
74
  */
75
75
  id?: string;
76
76
  itemYrn?: Yrn;
77
- /**
78
- * @deprecated
79
- */
80
77
  fees?: AggregateFee & {
81
78
  [key: string]: unknown;
82
- };
79
+ } & unknown;
83
80
  /**
84
81
  * The amount of items.
85
82
  */
@@ -97,12 +94,12 @@ type OrderEntry = {
97
94
  */
98
95
  effectiveQuantity?: number;
99
96
  /**
100
- * The original amount. This field is deprecated**. Please use `calculatedUnitPrice` instead. The `calculatedUnitPrice` field provides the same value with updated functionality.
97
+ * The original amount. **This field is deprecated**. Please use `calculatedUnitPrice` instead. The `calculatedUnitPrice` field provides the same value with updated functionality.
101
98
  * @deprecated
102
99
  */
103
100
  originalAmount?: number;
104
101
  /**
105
- * The original price. This field is deprecated**. Please use `calculatedUnitPrice` instead. The `calculatedUnitPrice` field provides the same value with updated functionality.
102
+ * The original price. **This field is deprecated**. Please use `calculatedUnitPrice` instead. The `calculatedUnitPrice` field provides the same value with updated functionality.
106
103
  * @deprecated
107
104
  */
108
105
  originalPrice?: number;
@@ -135,12 +132,9 @@ type OrderEntry = {
135
132
  */
136
133
  authorizedAmount?: number;
137
134
  product?: Product;
138
- /**
139
- * @deprecated
140
- */
141
135
  tax?: Tax & {
142
136
  [key: string]: unknown;
143
- };
137
+ } & unknown;
144
138
  price?: Price;
145
139
  metadata?: MixinsMetadata;
146
140
  mixins?: {
@@ -778,12 +772,9 @@ type Vendor = {
778
772
  */
779
773
  type OrderCommonDto = {
780
774
  restriction?: Restriction;
781
- /**
782
- * @deprecated
783
- */
784
775
  feeYrnAggregate?: AggregateFee & {
785
776
  [key: string]: unknown;
786
- };
777
+ } & unknown;
787
778
  status?: OrderStatus;
788
779
  /**
789
780
  * The identifier of a cart that was used to create this order.
@@ -823,18 +814,12 @@ type OrderCommonDto = {
823
814
  * Payment list.
824
815
  */
825
816
  payments?: Array<Payment>;
826
- /**
827
- * @deprecated
828
- */
829
817
  shipping?: Shipping & {
830
818
  [key: string]: unknown;
831
- };
832
- /**
833
- * @deprecated
834
- */
819
+ } & unknown;
835
820
  tax?: Tax & {
836
821
  [key: string]: unknown;
837
- };
822
+ } & unknown;
838
823
  /**
839
824
  * Order sub total price. **This field is deprecated**. Please use `calculatedPrice.price` or `calculatedPrice.discountedPrice` instead. These fields provide the same value with updated functionality.
840
825
  * @deprecated
@@ -856,16 +841,14 @@ type OrderCommonDto = {
856
841
  /**
857
842
  * Order cycle date.
858
843
  *
859
- * ***NOTE***
860
- * This attribute is DEPRECATED, please use the `deliveryWindow.deliveryCycle` attribute
844
+ * **This field is deprecated**. Please use the `deliveryWindow.deliveryCycle` attribute instead.
861
845
  * @deprecated
862
846
  */
863
847
  orderCycle?: string;
864
848
  /**
865
849
  * Delivery window's unique identifier.
866
850
  *
867
- * ***NOTE***
868
- * This attribute is DEPRECATED, please use the `deliveryWindow.id` attribute
851
+ * **This field is deprecated**. Please use the `deliveryWindow.id` attribute instead.
869
852
  * @deprecated
870
853
  */
871
854
  deliveryWindowId?: string;
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-DhoFgoKf.cjs';
1
+ import { C as ClientContext, b as AuthContext } from './context-Dawv2AtS.cjs';
2
2
 
3
3
  type PaymentModeFrontendResponse = {
4
4
  /**
package/dist/payment.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-DhoFgoKf.js';
1
+ import { C as ClientContext, b as AuthContext } from './context-Dawv2AtS.js';
2
2
 
3
3
  type PaymentModeFrontendResponse = {
4
4
  /**
package/dist/price.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-DhoFgoKf.cjs';
1
+ import { C as ClientContext, b as AuthContext } from './context-Dawv2AtS.cjs';
2
2
 
3
3
  type Metadata = {
4
4
  /**
@@ -18,19 +18,6 @@ type Metadata = {
18
18
  * Measurement unit for which the price is defined.
19
19
  */
20
20
  type MeasurementUnit = {
21
- /**
22
- * Quantity of the measurement unit.
23
- */
24
- quantity: number;
25
- /**
26
- * Code of the measurement unit.
27
- */
28
- unitCode: 'kg' | 'g' | 'mg' | 'l' | 'ml' | 'lb' | 'qt' | 'qtr' | 'gal' | 'pt' | 'oz' | 'MTR' | 'XRO' | 'MLT' | 'LTR' | 'H87' | 'KGM' | 'GRM' | 'HLT' | 'DL' | 'DAG' | 'RO';
29
- };
30
- /**
31
- * Measurement unit for which the price is defined.
32
- */
33
- type MeasurementUnitV2 = {
34
21
  /**
35
22
  * Quantity of the measurement unit.
36
23
  */
@@ -43,7 +30,7 @@ type MeasurementUnitV2 = {
43
30
  /**
44
31
  * Measurement unit for which the price is defined.
45
32
  */
46
- type MatchMeasurementUnitV2 = {
33
+ type MatchMeasurementUnit = {
47
34
  /**
48
35
  * Quantity of the measurement unit.
49
36
  */
@@ -90,7 +77,7 @@ type MatchByContext = {
90
77
  */
91
78
  id?: string;
92
79
  };
93
- quantity?: MatchMeasurementUnitV2;
80
+ quantity?: MatchMeasurementUnit;
94
81
  }>;
95
82
  };
96
83
  type Match = {
@@ -210,7 +197,7 @@ type PriceModelRetrieval = {
210
197
  *
211
198
  */
212
199
  includesMarkup?: boolean;
213
- measurementUnit?: MeasurementUnitV2;
200
+ measurementUnit?: MeasurementUnit;
214
201
  tierDefinition?: {
215
202
  /**
216
203
  * If the price is created based on a price model (the `priceModelId` is provided, the field should stay null. Otherwise the provided value will override a value from price model.
@@ -325,7 +312,7 @@ type MatchResponse = {
325
312
  * It's worth to mention that the cent part is not limited just to two digits. For example, if the price is for one piece of screw, it could look like this: 0.0000317
326
313
  */
327
314
  totalValue?: number;
328
- quantity?: MeasurementUnitV2;
315
+ quantity?: MeasurementUnit;
329
316
  salePrice?: SalePrice;
330
317
  /**
331
318
  * Flag indicating whether prices assigned to the price model are expressed as net or gross.
package/dist/price.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext } from './context-DhoFgoKf.js';
1
+ import { C as ClientContext, b as AuthContext } from './context-Dawv2AtS.js';
2
2
 
3
3
  type Metadata = {
4
4
  /**
@@ -18,19 +18,6 @@ type Metadata = {
18
18
  * Measurement unit for which the price is defined.
19
19
  */
20
20
  type MeasurementUnit = {
21
- /**
22
- * Quantity of the measurement unit.
23
- */
24
- quantity: number;
25
- /**
26
- * Code of the measurement unit.
27
- */
28
- unitCode: 'kg' | 'g' | 'mg' | 'l' | 'ml' | 'lb' | 'qt' | 'qtr' | 'gal' | 'pt' | 'oz' | 'MTR' | 'XRO' | 'MLT' | 'LTR' | 'H87' | 'KGM' | 'GRM' | 'HLT' | 'DL' | 'DAG' | 'RO';
29
- };
30
- /**
31
- * Measurement unit for which the price is defined.
32
- */
33
- type MeasurementUnitV2 = {
34
21
  /**
35
22
  * Quantity of the measurement unit.
36
23
  */
@@ -43,7 +30,7 @@ type MeasurementUnitV2 = {
43
30
  /**
44
31
  * Measurement unit for which the price is defined.
45
32
  */
46
- type MatchMeasurementUnitV2 = {
33
+ type MatchMeasurementUnit = {
47
34
  /**
48
35
  * Quantity of the measurement unit.
49
36
  */
@@ -90,7 +77,7 @@ type MatchByContext = {
90
77
  */
91
78
  id?: string;
92
79
  };
93
- quantity?: MatchMeasurementUnitV2;
80
+ quantity?: MatchMeasurementUnit;
94
81
  }>;
95
82
  };
96
83
  type Match = {
@@ -210,7 +197,7 @@ type PriceModelRetrieval = {
210
197
  *
211
198
  */
212
199
  includesMarkup?: boolean;
213
- measurementUnit?: MeasurementUnitV2;
200
+ measurementUnit?: MeasurementUnit;
214
201
  tierDefinition?: {
215
202
  /**
216
203
  * If the price is created based on a price model (the `priceModelId` is provided, the field should stay null. Otherwise the provided value will override a value from price model.
@@ -325,7 +312,7 @@ type MatchResponse = {
325
312
  * It's worth to mention that the cent part is not limited just to two digits. For example, if the price is for one piece of screw, it could look like this: 0.0000317
326
313
  */
327
314
  totalValue?: number;
328
- quantity?: MeasurementUnitV2;
315
+ quantity?: MeasurementUnit;
329
316
  salePrice?: SalePrice;
330
317
  /**
331
318
  * Flag indicating whether prices assigned to the price model are expressed as net or gross.
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-DhoFgoKf.cjs';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-Dawv2AtS.cjs';
2
2
  import { a as QueryFor } from './query-mLQs2WFr.cjs';
3
3
 
4
4
  /**
@@ -165,6 +165,12 @@ type ProductMedia = Array<{
165
165
  customAttributes?: {
166
166
  [key: string]: unknown;
167
167
  };
168
+ /**
169
+ * Custom media attributes.
170
+ */
171
+ mixins?: {
172
+ [key: string]: unknown;
173
+ };
168
174
  }>;
169
175
  type ProductCore = {
170
176
  name?: LocalizedValue;
package/dist/product.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-DhoFgoKf.js';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-Dawv2AtS.js';
2
2
  import { a as QueryFor } from './query-mLQs2WFr.js';
3
3
 
4
4
  /**
@@ -165,6 +165,12 @@ type ProductMedia = Array<{
165
165
  customAttributes?: {
166
166
  [key: string]: unknown;
167
167
  };
168
+ /**
169
+ * Custom media attributes.
170
+ */
171
+ mixins?: {
172
+ [key: string]: unknown;
173
+ };
168
174
  }>;
169
175
  type ProductCore = {
170
176
  name?: LocalizedValue;
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-DhoFgoKf.cjs';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-Dawv2AtS.cjs';
2
2
  import { ProductService } from './product.cjs';
3
3
  import { CategoryService } from './category.cjs';
4
4
  import './query-mLQs2WFr.cjs';
package/dist/segment.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-DhoFgoKf.js';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems } from './context-Dawv2AtS.js';
2
2
  import { ProductService } from './product.js';
3
3
  import { CategoryService } from './category.js';
4
4
  import './query-mLQs2WFr.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viu/emporix-sdk",
3
- "version": "2.19.0",
3
+ "version": "2.20.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/category.ts"],"names":[],"mappings":";;;;AAOA,IAAM,IAAA,GAAoB,EAAE,IAAA,EAAM,WAAA,EAAY;AASvC,IAAM,kBAAN,MAAsB;AAAA,EAE3B,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAD7B,OAAgB,OAAA,GAAU,UAAA;AAAA;AAAA,EAI1B,MAAM,GAAA,CAAI,UAAA,EAAoB,IAAA,GAAoB,IAAA,EAAyB;AACzE,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAkB;AAAA,MACrC,MAAA,EAAQ,KAAA;AAAA,M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AC,KAAA,KACV,IAAA,CAAK,GAAA,CAAI,KAAK,OAAA,CAAoB;AAAA,UAChC,MAAA,EAAQ,MAAA;AAAA,UACR,IAAA,EAAM,CAAA,UAAA,EAAa,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,kBAAA,CAAA;AAAA,UAClC,KAAA,EAAO,EAAE,QAAA,EAAU,KAAA,CAAM,MAAA,EAAO;AAAA,UAChC,IAAA;AAAA,UACA,IAAA,EAAM,EAAE,CAAA,EAAG,CAAA,IAAA,EAAO,MAAM,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA,CAAA;AAAI,SACtC;AAAA;AACH,KACF;AACA,IAAA,OAAO,MAAM,IAAA,EAAK;AAAA,EACpB;AACF","file":"chunk-6XND7SYV.js","sourcesContent":["import type { ClientContext, PaginatedItems } from \"../core/context\";\nimport { iterateAll } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport { resolveQuery, type QueryFor } from \"../core/query\";\nimport type { Product } from \"./product\";\nimport type { Category as GeneratedCategory, CategoryTree } from \"../generated/category\";\n\nconst ANON: AuthContext = { kind: \"anonymous\" };\n\n/** A category as returned by the Category service (all generated fields). */\nexport type Category = GeneratedCategory;\n\n/** The category tree as returned by the Category service. */\nexport type CategoryNode = CategoryTree;\n\n/** Category reads. Default auth: anonymous. */\nexport class CategoryService {\n static readonly channel = \"category\" as const;\n constructor(private readonly ctx: ClientContext) {}\n\n /** Fetches one category by id. */\n async get(categoryId: string, auth: AuthContext = ANON): Promise<Category> {\n return this.ctx.http.request<Category>({\n method: \"GET\",\n path: `/category/${this.ctx.tenant}/categories/${categoryId}`,\n auth,\n });\n }\n\n /** One page of categories. */\n async list(\n params: { pageNumber?: number; pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<PaginatedItems<Category>> {\n const pageNumber = params.pageNumber ?? 1;\n const pageSize = params.pageSize ?? 50;\n const items = await this.ctx.http.request<Category[]>({\n method: \"GET\",\n path: `/category/${this.ctx.tenant}/categories`,\n query: { pageNumber, pageSize },\n auth,\n });\n return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };\n }\n\n /**\n * Searches categories by a `q` filter — a raw Emporix DSL string or a built\n * filter (e.g. `@viu/emporix-mixins`' `mixinQuery(...)`). Category does not\n * support `compoundLogicalQuery`, so `or()` filters are rejected.\n */\n async search(\n query: QueryFor<\"CATEGORY\">,\n params: { pageNumber?: number; pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<PaginatedItems<Category>> {\n const q = resolveQuery(query, { compoundLogicalQuery: false });\n const pageNumber = params.pageNumber ?? 1;\n const pageSize = params.pageSize ?? 50;\n const items = await this.ctx.http.request<Category[]>({\n method: \"GET\",\n path: `/category/${this.ctx.tenant}/categories`,\n query: { q, pageNumber, pageSize },\n auth,\n });\n return { items, pageNumber, pageSize, hasNextPage: items.length === pageSize };\n }\n\n /** Async-iterates every category across pages. */\n listAll(params: { pageSize?: number } = {}, auth: AuthContext = ANON): AsyncIterable<Category> {\n const pageSize = params.pageSize ?? 50;\n return iterateAll<Category>((pageNumber) => this.list({ pageNumber, pageSize }, auth));\n }\n\n /**\n * The catalogue's **root categories** — the published category trees\n * (`GET /category-trees`). Use these for top-level storefront navigation;\n * drill into a node's children with {@link subcategories}.\n */\n async tree(auth: AuthContext = ANON): Promise<Category[]> {\n return this.ctx.http.request<Category[]>({\n method: \"GET\",\n path: `/category/${this.ctx.tenant}/category-trees`,\n auth,\n });\n }\n\n /**\n * Direct child categories of a category (for hierarchy drill-down). Mirrors\n * {@link productsIn}: reads the category's **assignments** and keeps the\n * `CATEGORY` references, resolving them to full categories. Returns an empty\n * array when the category has no child categories.\n */\n async subcategories(\n categoryId: string,\n params: { pageNumber?: number; pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<Category[]> {\n const pageNumber = params.pageNumber ?? 1;\n const pageSize = params.pageSize ?? 50;\n const assignments = await this.ctx.http.request<Array<{ ref?: { id?: string; type?: string } }>>({\n method: \"GET\",\n path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments`,\n query: { pageNumber, pageSize },\n auth,\n });\n const categoryIds = assignments\n .map((a) => (a.ref?.type?.toUpperCase() === \"CATEGORY\" ? a.ref.id : undefined))\n .filter((id): id is string => Boolean(id));\n if (categoryIds.length === 0) return [];\n return this.searchByIds(categoryIds, {}, auth);\n }\n\n /**\n * One page of products in a category. The category service exposes products\n * as **assignments** (`/categories/{id}/assignments`) — references, not full\n * products — so this fetches a page of assignments, keeps the `PRODUCT`\n * references, and resolves them to full products via `/products/search`.\n * `hasNextPage` reflects the assignments page (the source of truth for\n * pagination).\n */\n async productsIn(\n categoryId: 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 assignments = await this.ctx.http.request<Array<{ ref?: { id?: string; type?: string } }>>({\n method: \"GET\",\n path: `/category/${this.ctx.tenant}/categories/${categoryId}/assignments`,\n query: { pageNumber, pageSize },\n auth,\n });\n const hasNextPage = assignments.length === pageSize;\n const productIds = assignments\n .map((a) => (a.ref?.type?.toUpperCase() === \"PRODUCT\" ? a.ref.id : undefined))\n .filter((id): id is string => Boolean(id));\n if (productIds.length === 0) {\n return { items: [], pageNumber, pageSize, hasNextPage };\n }\n const items = await this.ctx.http.request<Product[]>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/search`,\n query: { pageSize: productIds.length },\n auth,\n body: { q: `id:(${productIds.join(\",\")})` },\n idempotent: true, // pure read over POST — safe to replay on 5xx/429\n });\n return { items, pageNumber, pageSize, hasNextPage };\n }\n\n /**\n * Bulk fetch by id. POSTs `/categories/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<Category[]> {\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<Category[]>({\n method: \"POST\",\n path: `/category/${this.ctx.tenant}/categories/search`,\n query: { pageSize: chunk.length },\n auth,\n body: { q: `id:(${chunk.join(\",\")})` },\n }),\n ),\n );\n return pages.flat();\n }\n}\n"]}