@meerkapp/wms-contracts 0.3.0-beta.14 → 0.3.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,8 +5,42 @@ var PaginationQuerySchema = z.object({
5
5
  limit: z.coerce.number().int().min(1).max(100).default(20)
6
6
  });
7
7
 
8
+ // src/generated/schemas/enums/CurrencyCode.schema.ts
9
+ import * as z2 from "zod";
10
+ var CurrencyCodeSchema = z2.enum(["AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRU", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLE", "SOS", "SRD", "SSP", "STN", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VES", "VND", "VUV", "WST", "XAF", "XCD", "XOF", "XPF", "YER", "ZAR", "ZMW", "ZWL"]);
11
+
12
+ // src/common/currency/index.ts
13
+ var MINOR_UNIT_OVERRIDES = {
14
+ BHD: 3,
15
+ BIF: 0,
16
+ CLP: 0,
17
+ DJF: 0,
18
+ GNF: 0,
19
+ IQD: 3,
20
+ ISK: 0,
21
+ JOD: 3,
22
+ JPY: 0,
23
+ KMF: 0,
24
+ KRW: 0,
25
+ KWD: 3,
26
+ LYD: 3,
27
+ OMR: 3,
28
+ PYG: 0,
29
+ RWF: 0,
30
+ TND: 3,
31
+ UGX: 0,
32
+ VND: 0,
33
+ VUV: 0,
34
+ XAF: 0,
35
+ XOF: 0,
36
+ XPF: 0
37
+ };
38
+ function getCurrencyMinorUnits(currency) {
39
+ return MINOR_UNIT_OVERRIDES[currency] ?? 2;
40
+ }
41
+
8
42
  // src/modules/auth/index.ts
9
- import { z as z2 } from "zod";
43
+ import { z as z3 } from "zod";
10
44
  var ALL_PERMISSIONS = [
11
45
  "organization:create",
12
46
  "organization:update",
@@ -47,255 +81,255 @@ var ALL_PERMISSIONS = [
47
81
  "price_list:create",
48
82
  "price_list:update"
49
83
  ];
50
- var LoginSchema = z2.object({
51
- email: z2.string().email(),
52
- password: z2.string().min(1)
84
+ var LoginSchema = z3.object({
85
+ email: z3.string().email(),
86
+ password: z3.string().min(1)
53
87
  });
54
- var SetupInitSchema = z2.object({
55
- email: z2.string().email(),
56
- password: z2.string().min(8),
57
- firstName: z2.string().min(1),
58
- lastName: z2.string().min(1)
88
+ var SetupInitSchema = z3.object({
89
+ email: z3.string().email(),
90
+ password: z3.string().min(8),
91
+ firstName: z3.string().min(1),
92
+ lastName: z3.string().min(1)
59
93
  });
60
94
 
61
95
  // src/modules/organization/index.ts
62
- import { z as z4 } from "zod";
96
+ import { z as z5 } from "zod";
63
97
 
64
98
  // src/generated/schemas/variants/pure/Organization.pure.ts
65
- import * as z3 from "zod";
66
- var OrganizationModelSchema = z3.object({
67
- id: z3.number().int(),
68
- name: z3.string(),
69
- website: z3.string().nullable(),
70
- updatedAt: z3.date(),
71
- warehouses: z3.array(z3.unknown()),
72
- priceListAssignments: z3.array(z3.unknown())
99
+ import * as z4 from "zod";
100
+ var OrganizationModelSchema = z4.object({
101
+ id: z4.number().int(),
102
+ name: z4.string(),
103
+ website: z4.string().nullable(),
104
+ updatedAt: z4.date(),
105
+ warehouses: z4.array(z4.unknown()),
106
+ priceListAssignments: z4.array(z4.unknown())
73
107
  }).strict();
74
108
 
75
109
  // src/modules/organization/index.ts
76
- var CreateOrganizationSchema = z4.object({
77
- name: z4.string().min(1),
78
- website: z4.string().url().optional().nullable()
110
+ var CreateOrganizationSchema = z5.object({
111
+ name: z5.string().min(1),
112
+ website: z5.string().url().optional().nullable()
79
113
  });
80
114
  var UpdateOrganizationSchema = CreateOrganizationSchema.partial();
81
- var OrganizationSchema = OrganizationModelSchema.omit({ warehouses: true }).extend({ updatedAt: z4.string() });
115
+ var OrganizationSchema = OrganizationModelSchema.omit({ warehouses: true }).extend({ updatedAt: z5.string() });
82
116
 
83
117
  // src/modules/warehouse/index.ts
84
- import { z as z6 } from "zod";
118
+ import { z as z7 } from "zod";
85
119
 
86
120
  // src/generated/schemas/variants/pure/Warehouse.pure.ts
87
- import * as z5 from "zod";
88
- var WarehouseModelSchema = z5.object({
89
- id: z5.number().int(),
90
- address: z5.string(),
91
- note: z5.string().nullable(),
92
- code: z5.string(),
93
- organizationId: z5.number().int(),
94
- localityId: z5.number().int(),
95
- updatedAt: z5.date(),
96
- organization: z5.unknown(),
97
- locality: z5.unknown(),
98
- employees: z5.array(z5.unknown()),
99
- shipments: z5.array(z5.unknown()),
100
- priceListAssignments: z5.array(z5.unknown()),
101
- stats: z5.array(z5.unknown())
121
+ import * as z6 from "zod";
122
+ var WarehouseModelSchema = z6.object({
123
+ id: z6.number().int(),
124
+ address: z6.string(),
125
+ note: z6.string().nullable(),
126
+ code: z6.string(),
127
+ organizationId: z6.number().int(),
128
+ localityId: z6.number().int(),
129
+ updatedAt: z6.date(),
130
+ organization: z6.unknown(),
131
+ locality: z6.unknown(),
132
+ employees: z6.array(z6.unknown()),
133
+ shipments: z6.array(z6.unknown()),
134
+ priceListAssignments: z6.array(z6.unknown()),
135
+ stats: z6.array(z6.unknown())
102
136
  }).strict();
103
137
 
104
138
  // src/modules/warehouse/index.ts
105
- var CreateWarehouseSchema = z6.object({
106
- address: z6.string().min(1),
107
- note: z6.string().optional().nullable(),
108
- code: z6.string().min(1),
109
- organizationId: z6.number().int().positive(),
110
- localityId: z6.number().int().positive()
139
+ var CreateWarehouseSchema = z7.object({
140
+ address: z7.string().min(1),
141
+ note: z7.string().optional().nullable(),
142
+ code: z7.string().min(1),
143
+ organizationId: z7.number().int().positive(),
144
+ localityId: z7.number().int().positive()
111
145
  });
112
146
  var UpdateWarehouseSchema = CreateWarehouseSchema.partial();
113
- var WarehouseSchema = WarehouseModelSchema.omit({ organization: true, locality: true }).extend({ updatedAt: z6.string() });
147
+ var WarehouseSchema = WarehouseModelSchema.omit({ organization: true, locality: true }).extend({ updatedAt: z7.string() });
114
148
 
115
149
  // src/modules/locality/index.ts
116
- import { z as z8 } from "zod";
150
+ import { z as z9 } from "zod";
117
151
 
118
152
  // src/generated/schemas/variants/pure/Locality.pure.ts
119
- import * as z7 from "zod";
120
- var LocalityModelSchema = z7.object({
121
- id: z7.number().int(),
122
- name: z7.string(),
123
- countryId: z7.number().int(),
124
- updatedAt: z7.date(),
125
- country: z7.unknown(),
126
- warehouses: z7.array(z7.unknown()),
127
- priceListAssignments: z7.array(z7.unknown())
153
+ import * as z8 from "zod";
154
+ var LocalityModelSchema = z8.object({
155
+ id: z8.number().int(),
156
+ name: z8.string(),
157
+ countryId: z8.number().int(),
158
+ updatedAt: z8.date(),
159
+ country: z8.unknown(),
160
+ warehouses: z8.array(z8.unknown()),
161
+ priceListAssignments: z8.array(z8.unknown())
128
162
  }).strict();
129
163
 
130
164
  // src/modules/locality/index.ts
131
- var CreateLocalitySchema = z8.object({
132
- name: z8.string().min(1),
133
- countryId: z8.number().int().positive()
165
+ var CreateLocalitySchema = z9.object({
166
+ name: z9.string().min(1),
167
+ countryId: z9.number().int().positive()
134
168
  });
135
- var LocalitySchema = LocalityModelSchema.omit({ warehouses: true, country: true }).extend({ updatedAt: z8.string() });
169
+ var LocalitySchema = LocalityModelSchema.omit({ warehouses: true, country: true }).extend({ updatedAt: z9.string() });
136
170
 
137
171
  // src/modules/country/index.ts
138
- import { z as z10 } from "zod";
172
+ import { z as z11 } from "zod";
139
173
 
140
174
  // src/generated/schemas/variants/pure/Country.pure.ts
141
- import * as z9 from "zod";
142
- var CountryModelSchema = z9.object({
143
- id: z9.number().int(),
144
- code: z9.string(),
145
- updatedAt: z9.date(),
146
- localities: z9.array(z9.unknown()),
147
- products: z9.array(z9.unknown()),
148
- priceListAssignments: z9.array(z9.unknown())
175
+ import * as z10 from "zod";
176
+ var CountryModelSchema = z10.object({
177
+ id: z10.number().int(),
178
+ code: z10.string(),
179
+ updatedAt: z10.date(),
180
+ localities: z10.array(z10.unknown()),
181
+ products: z10.array(z10.unknown()),
182
+ priceListAssignments: z10.array(z10.unknown())
149
183
  }).strict();
150
184
 
151
185
  // src/modules/country/index.ts
152
- var CountrySchema = CountryModelSchema.omit({ localities: true }).extend({ updatedAt: z10.string() });
186
+ var CountrySchema = CountryModelSchema.omit({ localities: true }).extend({ updatedAt: z11.string() });
153
187
 
154
188
  // src/modules/employee/index.ts
155
- import { z as z13 } from "zod";
189
+ import { z as z14 } from "zod";
156
190
 
157
191
  // src/generated/schemas/variants/pure/Employee.pure.ts
158
- import * as z11 from "zod";
159
- var EmployeeModelSchema = z11.object({
160
- id: z11.string(),
161
- email: z11.string(),
162
- password: z11.string(),
163
- firstName: z11.string(),
164
- lastName: z11.string(),
165
- phone: z11.string().nullable(),
166
- avatarUrl: z11.string().nullable(),
167
- warehouseId: z11.number().int().nullable(),
168
- isActive: z11.boolean(),
169
- lastSeen: z11.date().nullable(),
170
- updatedAt: z11.date(),
171
- warehouse: z11.unknown().nullable(),
172
- roleAssignments: z11.array(z11.unknown())
192
+ import * as z12 from "zod";
193
+ var EmployeeModelSchema = z12.object({
194
+ id: z12.string(),
195
+ email: z12.string(),
196
+ password: z12.string(),
197
+ firstName: z12.string(),
198
+ lastName: z12.string(),
199
+ phone: z12.string().nullable(),
200
+ avatarUrl: z12.string().nullable(),
201
+ warehouseId: z12.number().int().nullable(),
202
+ isActive: z12.boolean(),
203
+ lastSeen: z12.date().nullable(),
204
+ updatedAt: z12.date(),
205
+ warehouse: z12.unknown().nullable(),
206
+ roleAssignments: z12.array(z12.unknown())
173
207
  }).strict();
174
208
 
175
209
  // src/generated/schemas/variants/pure/EmployeeRole.pure.ts
176
- import * as z12 from "zod";
177
- var EmployeeRoleModelSchema = z12.object({
178
- id: z12.number().int(),
179
- name: z12.string(),
180
- color: z12.string(),
181
- updatedAt: z12.date(),
182
- assignments: z12.array(z12.unknown()),
183
- permissions: z12.array(z12.unknown())
210
+ import * as z13 from "zod";
211
+ var EmployeeRoleModelSchema = z13.object({
212
+ id: z13.number().int(),
213
+ name: z13.string(),
214
+ color: z13.string(),
215
+ updatedAt: z13.date(),
216
+ assignments: z13.array(z13.unknown()),
217
+ permissions: z13.array(z13.unknown())
184
218
  }).strict();
185
219
 
186
220
  // src/modules/employee/index.ts
187
- var EmployeeRoleSchema = EmployeeRoleModelSchema.omit({ assignments: true, permissions: true }).extend({ id: z13.number(), updatedAt: z13.string() });
221
+ var EmployeeRoleSchema = EmployeeRoleModelSchema.omit({ assignments: true, permissions: true }).extend({ id: z14.number(), updatedAt: z14.string() });
188
222
  var EmployeeSchema = EmployeeModelSchema.omit({ password: true, warehouse: true, roleAssignments: true }).extend({
189
- avatarUrl: z13.string().nullable(),
190
- phone: z13.string().nullable(),
191
- lastSeen: z13.string().nullable(),
192
- updatedAt: z13.string(),
193
- roleAssignments: z13.array(
194
- z13.object({
223
+ avatarUrl: z14.string().nullable(),
224
+ phone: z14.string().nullable(),
225
+ lastSeen: z14.string().nullable(),
226
+ updatedAt: z14.string(),
227
+ roleAssignments: z14.array(
228
+ z14.object({
195
229
  employeeRole: EmployeeRoleSchema
196
230
  })
197
231
  )
198
232
  });
199
- var CreateEmployeeSchema = z13.object({
200
- email: z13.string().email(),
201
- password: z13.string().min(8),
202
- firstName: z13.string().min(1),
203
- lastName: z13.string().min(1),
204
- phone: z13.string().min(7).max(20).optional(),
205
- warehouseId: z13.number().int().optional(),
206
- roleIds: z13.array(z13.number().int()).optional()
207
- });
208
- var UpdateEmployeeSchema = z13.object({
209
- firstName: z13.string().min(1).optional(),
210
- lastName: z13.string().min(1).optional(),
211
- phone: z13.string().min(7).max(20).nullable().optional(),
212
- warehouseId: z13.number().int().nullable().optional(),
213
- roleIds: z13.array(z13.number().int()).optional(),
214
- email: z13.string().email().optional(),
215
- newPassword: z13.string().min(8).optional(),
216
- isActive: z13.boolean().optional()
217
- });
218
- var UpdateOwnProfileSchema = z13.object({
219
- firstName: z13.string().min(1).optional(),
220
- lastName: z13.string().min(1).optional(),
221
- phone: z13.string().min(7).max(20).nullable().optional(),
222
- email: z13.string().email().optional()
223
- });
224
- var UpdateOwnPasswordSchema = z13.object({
225
- currentPassword: z13.string().min(1),
226
- newPassword: z13.string().min(8)
233
+ var CreateEmployeeSchema = z14.object({
234
+ email: z14.string().email(),
235
+ password: z14.string().min(8),
236
+ firstName: z14.string().min(1),
237
+ lastName: z14.string().min(1),
238
+ phone: z14.string().min(7).max(20).optional(),
239
+ warehouseId: z14.number().int().optional(),
240
+ roleIds: z14.array(z14.number().int()).optional()
241
+ });
242
+ var UpdateEmployeeSchema = z14.object({
243
+ firstName: z14.string().min(1).optional(),
244
+ lastName: z14.string().min(1).optional(),
245
+ phone: z14.string().min(7).max(20).nullable().optional(),
246
+ warehouseId: z14.number().int().nullable().optional(),
247
+ roleIds: z14.array(z14.number().int()).optional(),
248
+ email: z14.string().email().optional(),
249
+ newPassword: z14.string().min(8).optional(),
250
+ isActive: z14.boolean().optional()
251
+ });
252
+ var UpdateOwnProfileSchema = z14.object({
253
+ firstName: z14.string().min(1).optional(),
254
+ lastName: z14.string().min(1).optional(),
255
+ phone: z14.string().min(7).max(20).nullable().optional(),
256
+ email: z14.string().email().optional()
257
+ });
258
+ var UpdateOwnPasswordSchema = z14.object({
259
+ currentPassword: z14.string().min(1),
260
+ newPassword: z14.string().min(8)
227
261
  });
228
262
 
229
263
  // src/modules/role/index.ts
230
- import { z as z14 } from "zod";
231
- var RolePermissionItemSchema = z14.object({
232
- employeePermission: z14.object({
233
- id: z14.number(),
234
- name: z14.string()
264
+ import { z as z15 } from "zod";
265
+ var RolePermissionItemSchema = z15.object({
266
+ employeePermission: z15.object({
267
+ id: z15.number(),
268
+ name: z15.string()
235
269
  })
236
270
  });
237
271
  var RoleSchema = EmployeeRoleModelSchema.omit({ assignments: true, permissions: true }).extend({
238
- id: z14.number(),
239
- updatedAt: z14.string(),
240
- permissions: z14.array(RolePermissionItemSchema)
272
+ id: z15.number(),
273
+ updatedAt: z15.string(),
274
+ permissions: z15.array(RolePermissionItemSchema)
241
275
  });
242
- var CreateRoleSchema = z14.object({
243
- name: z14.string().min(1),
244
- color: z14.string(),
245
- permissionIds: z14.array(z14.number().int()).optional()
276
+ var CreateRoleSchema = z15.object({
277
+ name: z15.string().min(1),
278
+ color: z15.string(),
279
+ permissionIds: z15.array(z15.number().int()).optional()
246
280
  });
247
- var UpdateRoleSchema = z14.object({
248
- name: z14.string().min(1).optional(),
249
- color: z14.string().optional(),
250
- permissionIds: z14.array(z14.number().int()).optional()
281
+ var UpdateRoleSchema = z15.object({
282
+ name: z15.string().min(1).optional(),
283
+ color: z15.string().optional(),
284
+ permissionIds: z15.array(z15.number().int()).optional()
251
285
  });
252
286
 
253
287
  // src/modules/product-type/index.ts
254
- import { z as z15 } from "zod";
255
- var NumberCharacteristicSchema = z15.object({
256
- key: z15.string().min(1),
257
- label: z15.string().min(1),
258
- type: z15.literal("number"),
259
- required: z15.boolean().default(false),
260
- validation: z15.object({
261
- min: z15.number().optional(),
262
- max: z15.number().optional()
288
+ import { z as z16 } from "zod";
289
+ var NumberCharacteristicSchema = z16.object({
290
+ key: z16.string().min(1),
291
+ label: z16.string().min(1),
292
+ type: z16.literal("number"),
293
+ required: z16.boolean().default(false),
294
+ validation: z16.object({
295
+ min: z16.number().optional(),
296
+ max: z16.number().optional()
263
297
  }).optional(),
264
- ui: z15.object({
265
- suffix: z15.string().optional()
298
+ ui: z16.object({
299
+ suffix: z16.string().optional()
266
300
  }).optional()
267
301
  });
268
- var SelectOptionSchema = z15.object({
269
- label: z15.string().min(1),
270
- value: z15.string().min(1)
271
- });
272
- var SelectCharacteristicSchema = z15.object({
273
- key: z15.string().min(1),
274
- label: z15.string().min(1),
275
- type: z15.literal("select"),
276
- required: z15.boolean().default(false),
277
- options: z15.array(SelectOptionSchema).min(1)
278
- });
279
- var ToggleCharacteristicSchema = z15.object({
280
- key: z15.string().min(1),
281
- label: z15.string().min(1),
282
- type: z15.literal("toggle"),
283
- required: z15.boolean().default(false),
284
- true_label: z15.string().min(1),
285
- false_label: z15.string().min(1)
286
- });
287
- var CheckboxCharacteristicSchema = z15.object({
288
- key: z15.string().min(1),
289
- label: z15.string().min(1),
290
- type: z15.literal("checkbox")
291
- });
292
- var CharacteristicSchema = z15.discriminatedUnion("type", [
302
+ var SelectOptionSchema = z16.object({
303
+ label: z16.string().min(1),
304
+ value: z16.string().min(1)
305
+ });
306
+ var SelectCharacteristicSchema = z16.object({
307
+ key: z16.string().min(1),
308
+ label: z16.string().min(1),
309
+ type: z16.literal("select"),
310
+ required: z16.boolean().default(false),
311
+ options: z16.array(SelectOptionSchema).min(1)
312
+ });
313
+ var ToggleCharacteristicSchema = z16.object({
314
+ key: z16.string().min(1),
315
+ label: z16.string().min(1),
316
+ type: z16.literal("toggle"),
317
+ required: z16.boolean().default(false),
318
+ true_label: z16.string().min(1),
319
+ false_label: z16.string().min(1)
320
+ });
321
+ var CheckboxCharacteristicSchema = z16.object({
322
+ key: z16.string().min(1),
323
+ label: z16.string().min(1),
324
+ type: z16.literal("checkbox")
325
+ });
326
+ var CharacteristicSchema = z16.discriminatedUnion("type", [
293
327
  NumberCharacteristicSchema,
294
328
  SelectCharacteristicSchema,
295
329
  ToggleCharacteristicSchema,
296
330
  CheckboxCharacteristicSchema
297
331
  ]);
298
- var CharacteristicsSchemeSchema = z15.array(CharacteristicSchema);
332
+ var CharacteristicsSchemeSchema = z16.array(CharacteristicSchema);
299
333
  var SKU_TEMPLATE_REGEX = /^(\{(brand|counter)(?::\d+)?\}|\{[a-z_]+(?::\d+)?\}|[^{}]+)+$/;
300
334
  var RESERVED_SKU_KEYS = /* @__PURE__ */ new Set(["brand", "counter"]);
301
335
  var SKU_COMPATIBLE_TYPES = /* @__PURE__ */ new Set(["number", "select", "toggle"]);
@@ -307,11 +341,11 @@ function validateSkuTemplate(data) {
307
341
  const templateKeys = [...data.skuTemplate.matchAll(/\{([a-z_]+)(?::\d+)?\}/g)].map(([, key]) => key).filter((key) => !RESERVED_SKU_KEYS.has(key));
308
342
  return templateKeys.every((key) => skuCompatibleKeys.has(key));
309
343
  }
310
- var ProductTypeBaseSchema = z15.object({
311
- name: z15.string().min(1),
312
- defaultWriteoffStrategy: z15.enum(["FIFO", "LIFO", "FEFO", "MANUAL"]).default("FIFO"),
313
- skuMode: z15.enum(["GLOBAL", "CUSTOM"]).default("GLOBAL"),
314
- skuTemplate: z15.string().regex(SKU_TEMPLATE_REGEX, "Invalid SKU template format").optional().nullable(),
344
+ var ProductTypeBaseSchema = z16.object({
345
+ name: z16.string().min(1),
346
+ defaultWriteoffStrategy: z16.enum(["FIFO", "LIFO", "FEFO", "MANUAL"]).default("FIFO"),
347
+ skuMode: z16.enum(["GLOBAL", "CUSTOM"]).default("GLOBAL"),
348
+ skuTemplate: z16.string().regex(SKU_TEMPLATE_REGEX, "Invalid SKU template format").optional().nullable(),
315
349
  characteristicsScheme: CharacteristicsSchemeSchema.optional().nullable()
316
350
  });
317
351
  var CreateProductTypeSchema = ProductTypeBaseSchema.refine(
@@ -328,121 +362,117 @@ var UpdateProductTypeSchema = ProductTypeBaseSchema.partial().refine(
328
362
  message: "All keys in skuTemplate must be required characteristics of type number, select or toggle",
329
363
  path: ["skuTemplate"]
330
364
  });
331
- var ProductTypeSchema = z15.object({
332
- id: z15.number(),
333
- name: z15.string(),
334
- defaultWriteoffStrategy: z15.enum(["FIFO", "LIFO", "FEFO", "MANUAL"]),
335
- skuMode: z15.enum(["GLOBAL", "CUSTOM"]),
336
- skuTemplate: z15.string().nullable(),
337
- skuCounter: z15.number(),
338
- characteristicsScheme: CharacteristicsSchemeSchema.nullable(),
339
- updatedAt: z15.string()
340
- });
341
-
342
- // src/modules/folder/index.ts
343
- import { z as z16 } from "zod";
344
- var CreateFolderSchema = z16.object({
345
- name: z16.string().min(1),
346
- parentId: z16.number().int().positive().optional().nullable()
347
- });
348
- var UpdateFolderSchema = CreateFolderSchema.partial();
349
- var FolderSchema = z16.object({
365
+ var ProductTypeSchema = z16.object({
350
366
  id: z16.number(),
351
367
  name: z16.string(),
352
- parentId: z16.number().nullable(),
353
- pinnedAt: z16.string().nullable(),
354
- pinOrder: z16.number().nullable(),
368
+ defaultWriteoffStrategy: z16.enum(["FIFO", "LIFO", "FEFO", "MANUAL"]),
369
+ skuMode: z16.enum(["GLOBAL", "CUSTOM"]),
370
+ skuTemplate: z16.string().nullable(),
371
+ skuCounter: z16.number(),
372
+ characteristicsScheme: CharacteristicsSchemeSchema.nullable(),
355
373
  updatedAt: z16.string()
356
374
  });
357
375
 
358
- // src/modules/product-collection/index.ts
376
+ // src/modules/folder/index.ts
359
377
  import { z as z17 } from "zod";
360
- var CreateProductCollectionSchema = z17.object({
378
+ var CreateFolderSchema = z17.object({
361
379
  name: z17.string().min(1),
362
- folderId: z17.number().int().positive().optional().nullable(),
363
- defaultProductTypeId: z17.number().int().positive().optional().nullable()
380
+ parentId: z17.number().int().positive().optional().nullable()
364
381
  });
365
- var UpdateProductCollectionSchema = CreateProductCollectionSchema.partial();
366
- var ProductCollectionSchema = z17.object({
382
+ var UpdateFolderSchema = CreateFolderSchema.partial();
383
+ var FolderSchema = z17.object({
367
384
  id: z17.number(),
368
385
  name: z17.string(),
369
- folderId: z17.number().nullable(),
370
- defaultProductTypeId: z17.number().nullable(),
386
+ parentId: z17.number().nullable(),
371
387
  pinnedAt: z17.string().nullable(),
372
388
  pinOrder: z17.number().nullable(),
373
389
  updatedAt: z17.string()
374
390
  });
375
391
 
392
+ // src/modules/product-collection/index.ts
393
+ import { z as z18 } from "zod";
394
+ var CreateProductCollectionSchema = z18.object({
395
+ name: z18.string().min(1),
396
+ folderId: z18.number().int().positive().optional().nullable(),
397
+ defaultProductTypeId: z18.number().int().positive().optional().nullable()
398
+ });
399
+ var UpdateProductCollectionSchema = CreateProductCollectionSchema.partial();
400
+ var ProductCollectionSchema = z18.object({
401
+ id: z18.number(),
402
+ name: z18.string(),
403
+ folderId: z18.number().nullable(),
404
+ defaultProductTypeId: z18.number().nullable(),
405
+ pinnedAt: z18.string().nullable(),
406
+ pinOrder: z18.number().nullable(),
407
+ updatedAt: z18.string()
408
+ });
409
+
376
410
  // src/modules/product-measure/index.ts
377
- import { z as z19 } from "zod";
411
+ import { z as z20 } from "zod";
378
412
 
379
413
  // src/generated/schemas/variants/pure/ProductMeasure.pure.ts
380
- import * as z18 from "zod";
381
- var ProductMeasureModelSchema = z18.object({
382
- id: z18.number().int(),
383
- name: z18.string().nullable(),
384
- code: z18.string().nullable(),
385
- updatedAt: z18.date(),
386
- products: z18.array(z18.unknown())
414
+ import * as z19 from "zod";
415
+ var ProductMeasureModelSchema = z19.object({
416
+ id: z19.number().int(),
417
+ name: z19.string().nullable(),
418
+ code: z19.string().nullable(),
419
+ updatedAt: z19.date(),
420
+ products: z19.array(z19.unknown())
387
421
  }).strict();
388
422
 
389
423
  // src/modules/product-measure/index.ts
390
- var ProductMeasureSchema = ProductMeasureModelSchema.omit({ products: true }).extend({ updatedAt: z19.string() });
424
+ var ProductMeasureSchema = ProductMeasureModelSchema.omit({ products: true }).extend({ updatedAt: z20.string() });
391
425
 
392
426
  // src/modules/product-brand/index.ts
393
- import { z as z21 } from "zod";
427
+ import { z as z22 } from "zod";
394
428
 
395
429
  // src/generated/schemas/variants/pure/ProductBrand.pure.ts
396
- import * as z20 from "zod";
397
- var ProductBrandModelSchema = z20.object({
398
- id: z20.number().int(),
399
- name: z20.string(),
400
- updatedAt: z20.date(),
401
- products: z20.array(z20.unknown())
430
+ import * as z21 from "zod";
431
+ var ProductBrandModelSchema = z21.object({
432
+ id: z21.number().int(),
433
+ name: z21.string(),
434
+ updatedAt: z21.date(),
435
+ products: z21.array(z21.unknown())
402
436
  }).strict();
403
437
 
404
438
  // src/modules/product-brand/index.ts
405
- var ProductBrandSchema = ProductBrandModelSchema.omit({ products: true }).extend({ updatedAt: z21.string() });
439
+ var ProductBrandSchema = ProductBrandModelSchema.omit({ products: true }).extend({ updatedAt: z22.string() });
406
440
 
407
441
  // src/modules/product-item/index.ts
408
442
  import { z as z26 } from "zod";
409
443
 
410
444
  // src/generated/schemas/variants/pure/ProductItem.pure.ts
411
- import * as z23 from "zod";
445
+ import * as z24 from "zod";
412
446
 
413
447
  // src/generated/schemas/enums/WriteoffStrategy.schema.ts
414
- import * as z22 from "zod";
415
- var WriteoffStrategySchema = z22.enum(["FIFO", "LIFO", "FEFO", "MANUAL"]);
448
+ import * as z23 from "zod";
449
+ var WriteoffStrategySchema = z23.enum(["FIFO", "LIFO", "FEFO", "MANUAL"]);
416
450
 
417
451
  // src/generated/schemas/variants/pure/ProductItem.pure.ts
418
- var ProductItemModelSchema = z23.object({
419
- id: z23.number().int(),
420
- sku: z23.string(),
421
- name: z23.string(),
422
- productCollectionId: z23.number().int().nullable(),
423
- productTypeId: z23.number().int(),
424
- productBrandId: z23.number().int().nullable(),
425
- productMeasureId: z23.number().int().nullable(),
426
- countryId: z23.number().int().nullable(),
427
- characteristics: z23.unknown(),
452
+ var ProductItemModelSchema = z24.object({
453
+ id: z24.number().int(),
454
+ sku: z24.string(),
455
+ name: z24.string(),
456
+ productCollectionId: z24.number().int().nullable(),
457
+ productTypeId: z24.number().int(),
458
+ productBrandId: z24.number().int().nullable(),
459
+ productMeasureId: z24.number().int().nullable(),
460
+ countryId: z24.number().int().nullable(),
461
+ characteristics: z24.unknown(),
428
462
  writeoffStrategy: WriteoffStrategySchema.nullable(),
429
- isPublic: z23.boolean(),
430
- updatedAt: z23.date(),
431
- productCollection: z23.unknown().nullable(),
432
- productType: z23.unknown(),
433
- productBrand: z23.unknown().nullable(),
434
- productMeasure: z23.unknown().nullable(),
435
- country: z23.unknown().nullable(),
436
- barcodes: z23.array(z23.unknown()),
437
- packages: z23.array(z23.unknown()),
438
- shipments: z23.array(z23.unknown()),
439
- stats: z23.array(z23.unknown())
463
+ isPublic: z24.boolean(),
464
+ updatedAt: z24.date(),
465
+ productCollection: z24.unknown().nullable(),
466
+ productType: z24.unknown(),
467
+ productBrand: z24.unknown().nullable(),
468
+ productMeasure: z24.unknown().nullable(),
469
+ country: z24.unknown().nullable(),
470
+ barcodes: z24.array(z24.unknown()),
471
+ packages: z24.array(z24.unknown()),
472
+ shipments: z24.array(z24.unknown()),
473
+ stats: z24.array(z24.unknown())
440
474
  }).strict();
441
475
 
442
- // src/generated/schemas/enums/CurrencyCode.schema.ts
443
- import * as z24 from "zod";
444
- var CurrencyCodeSchema = z24.enum(["AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRU", "MUR", "MVR", "MWK", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLE", "SOS", "SRD", "SSP", "STN", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "UYU", "UZS", "VES", "VND", "VUV", "WST", "XAF", "XCD", "XOF", "XPF", "YER", "ZAR", "ZMW", "ZWL"]);
445
-
446
476
  // src/modules/sync/index.ts
447
477
  import { z as z25 } from "zod";
448
478
  var SYNC_TABLE_NAMES = [
@@ -603,31 +633,109 @@ var ProductShipmentSchema = ProductShipmentModelSchema.omit({ warehouse: true, p
603
633
  });
604
634
 
605
635
  // src/modules/price-list/index.ts
606
- import { z as z35 } from "zod";
636
+ import { z as z36 } from "zod";
607
637
 
608
- // src/generated/schemas/variants/pure/PriceList.pure.ts
638
+ // src/generated/schemas/enums/PriceListTargetType.schema.ts
609
639
  import * as z34 from "zod";
610
- var PriceListModelSchema = z34.object({
611
- id: z34.number().int(),
612
- name: z34.string(),
640
+ var PriceListTargetTypeSchema = z34.enum(["WAREHOUSE", "ORGANIZATION", "LOCALITY", "COUNTRY"]);
641
+
642
+ // src/generated/schemas/variants/pure/PriceList.pure.ts
643
+ import * as z35 from "zod";
644
+ var PriceListModelSchema = z35.object({
645
+ id: z35.number().int(),
646
+ name: z35.string(),
613
647
  currency: CurrencyCodeSchema,
614
- isDefault: z34.boolean(),
615
- createdAt: z34.date(),
616
- updatedAt: z34.date(),
617
- prices: z34.array(z34.unknown()),
618
- assignments: z34.array(z34.unknown())
648
+ isDefault: z35.boolean(),
649
+ createdAt: z35.date(),
650
+ updatedAt: z35.date(),
651
+ prices: z35.array(z35.unknown()),
652
+ assignments: z35.array(z35.unknown())
619
653
  }).strict();
620
654
 
621
655
  // src/modules/price-list/index.ts
622
- var CreatePriceListSchema = z35.object({
623
- name: z35.string().min(1),
656
+ var CreatePriceListSchema = z36.object({
657
+ name: z36.string().min(1),
624
658
  currency: CurrencyCodeSchema
625
659
  });
626
660
  var UpdatePriceListSchema = CreatePriceListSchema.partial();
627
661
  var PriceListSchema = PriceListModelSchema.omit({
628
662
  prices: true,
629
663
  assignments: true
630
- }).extend({ updatedAt: z35.string() });
664
+ }).extend({
665
+ createdAt: z36.string(),
666
+ updatedAt: z36.string()
667
+ });
668
+ var PriceListSummarySchema = PriceListSchema.extend({
669
+ assignmentCount: z36.number().int().nonnegative(),
670
+ priceCount: z36.number().int().nonnegative()
671
+ });
672
+ var PriceListAssignmentSchema = z36.object({
673
+ id: z36.number().int().positive(),
674
+ priceListId: z36.number().int().positive(),
675
+ targetType: PriceListTargetTypeSchema,
676
+ warehouseId: z36.number().int().positive().nullable(),
677
+ organizationId: z36.number().int().positive().nullable(),
678
+ localityId: z36.number().int().positive().nullable(),
679
+ countryId: z36.number().int().positive().nullable()
680
+ });
681
+ var IdArraySchema = z36.array(z36.number().int().positive());
682
+ var SetPriceListAssignmentsSchema = z36.object({
683
+ warehouseIds: IdArraySchema,
684
+ organizationIds: IdArraySchema,
685
+ localityIds: IdArraySchema,
686
+ countryIds: IdArraySchema
687
+ }).superRefine((value, context) => {
688
+ for (const [field, ids] of Object.entries(value)) {
689
+ if (new Set(ids).size !== ids.length) {
690
+ context.addIssue({
691
+ code: z36.ZodIssueCode.custom,
692
+ path: [field],
693
+ message: "Target ids must be unique"
694
+ });
695
+ }
696
+ }
697
+ });
698
+ var ProductPriceSchema = z36.object({
699
+ id: z36.number().int().positive(),
700
+ priceListId: z36.number().int().positive(),
701
+ productPackageId: z36.number().int().positive(),
702
+ priceAmount: z36.string().regex(/^\d+$/),
703
+ createdAt: z36.string(),
704
+ updatedAt: z36.string()
705
+ });
706
+ var ProductPriceInputSchema = z36.object({
707
+ productPackageId: z36.number().int().positive(),
708
+ priceAmount: z36.string().regex(/^\d+$/)
709
+ });
710
+ var UpdatePriceListPricesSchema = z36.object({
711
+ upserted: z36.array(ProductPriceInputSchema),
712
+ removedProductPackageIds: IdArraySchema
713
+ }).superRefine((value, context) => {
714
+ const upsertedIds = value.upserted.map((price) => price.productPackageId);
715
+ if (new Set(upsertedIds).size !== upsertedIds.length) {
716
+ context.addIssue({
717
+ code: z36.ZodIssueCode.custom,
718
+ path: ["upserted"],
719
+ message: "Product package ids must be unique"
720
+ });
721
+ }
722
+ const removedIds = value.removedProductPackageIds;
723
+ if (new Set(removedIds).size !== removedIds.length) {
724
+ context.addIssue({
725
+ code: z36.ZodIssueCode.custom,
726
+ path: ["removedProductPackageIds"],
727
+ message: "Product package ids must be unique"
728
+ });
729
+ }
730
+ const removedIdSet = new Set(removedIds);
731
+ if (upsertedIds.some((id) => removedIdSet.has(id))) {
732
+ context.addIssue({
733
+ code: z36.ZodIssueCode.custom,
734
+ path: ["removedProductPackageIds"],
735
+ message: "A product package cannot be updated and removed in the same request"
736
+ });
737
+ }
738
+ });
631
739
  export {
632
740
  ALL_PERMISSIONS,
633
741
  CharacteristicSchema,
@@ -642,6 +750,7 @@ export {
642
750
  CreateProductTypeSchema,
643
751
  CreateRoleSchema,
644
752
  CreateWarehouseSchema,
753
+ CurrencyCodeSchema,
645
754
  EmployeeRoleSchema,
646
755
  EmployeeSchema,
647
756
  FolderSchema,
@@ -649,7 +758,9 @@ export {
649
758
  LoginSchema,
650
759
  OrganizationSchema,
651
760
  PaginationQuerySchema,
761
+ PriceListAssignmentSchema,
652
762
  PriceListSchema,
763
+ PriceListSummarySchema,
653
764
  ProductBarcodeSchema,
654
765
  ProductBrandSchema,
655
766
  ProductCollectionSchema,
@@ -663,11 +774,14 @@ export {
663
774
  ProductItemWithRelationsSchema,
664
775
  ProductMeasureSchema,
665
776
  ProductPackageSchema,
777
+ ProductPriceInputSchema,
778
+ ProductPriceSchema,
666
779
  ProductShipmentSchema,
667
780
  ProductTypeSchema,
668
781
  RolePermissionItemSchema,
669
782
  RoleSchema,
670
783
  SYNC_TABLE_NAMES,
784
+ SetPriceListAssignmentsSchema,
671
785
  SetupInitSchema,
672
786
  SyncCursorSchema,
673
787
  SyncEntityIdSchema,
@@ -677,6 +791,7 @@ export {
677
791
  UpdateOrganizationSchema,
678
792
  UpdateOwnPasswordSchema,
679
793
  UpdateOwnProfileSchema,
794
+ UpdatePriceListPricesSchema,
680
795
  UpdatePriceListSchema,
681
796
  UpdateProductCollectionSchema,
682
797
  UpdateProductTypeSchema,
@@ -685,6 +800,7 @@ export {
685
800
  WarehouseSchema,
686
801
  createSyncChangePayloadSchema,
687
802
  createSyncFetchResponseSchema,
688
- createSyncSocketPayloadSchema
803
+ createSyncSocketPayloadSchema,
804
+ getCurrencyMinorUnits
689
805
  };
690
806
  //# sourceMappingURL=index.js.map