@meerkapp/wms-contracts 0.3.0-beta.13 → 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.cjs CHANGED
@@ -43,6 +43,7 @@ __export(index_exports, {
43
43
  CreateProductTypeSchema: () => CreateProductTypeSchema,
44
44
  CreateRoleSchema: () => CreateRoleSchema,
45
45
  CreateWarehouseSchema: () => CreateWarehouseSchema,
46
+ CurrencyCodeSchema: () => CurrencyCodeSchema,
46
47
  EmployeeRoleSchema: () => EmployeeRoleSchema,
47
48
  EmployeeSchema: () => EmployeeSchema,
48
49
  FolderSchema: () => FolderSchema,
@@ -50,32 +51,50 @@ __export(index_exports, {
50
51
  LoginSchema: () => LoginSchema,
51
52
  OrganizationSchema: () => OrganizationSchema,
52
53
  PaginationQuerySchema: () => PaginationQuerySchema,
54
+ PriceListAssignmentSchema: () => PriceListAssignmentSchema,
53
55
  PriceListSchema: () => PriceListSchema,
56
+ PriceListSummarySchema: () => PriceListSummarySchema,
54
57
  ProductBarcodeSchema: () => ProductBarcodeSchema,
55
58
  ProductBrandSchema: () => ProductBrandSchema,
56
59
  ProductCollectionSchema: () => ProductCollectionSchema,
57
60
  ProductItemSchema: () => ProductItemSchema,
61
+ ProductItemStatsChangePayloadSchema: () => ProductItemStatsChangePayloadSchema,
62
+ ProductItemStatsFetchQuerySchema: () => ProductItemStatsFetchQuerySchema,
63
+ ProductItemStatsFetchResponseSchema: () => ProductItemStatsFetchResponseSchema,
58
64
  ProductItemStatsQuerySchema: () => ProductItemStatsQuerySchema,
59
65
  ProductItemStatsSchema: () => ProductItemStatsSchema,
66
+ ProductItemStatsSocketPayloadSchema: () => ProductItemStatsSocketPayloadSchema,
60
67
  ProductItemWithRelationsSchema: () => ProductItemWithRelationsSchema,
61
68
  ProductMeasureSchema: () => ProductMeasureSchema,
62
69
  ProductPackageSchema: () => ProductPackageSchema,
70
+ ProductPriceInputSchema: () => ProductPriceInputSchema,
71
+ ProductPriceSchema: () => ProductPriceSchema,
63
72
  ProductShipmentSchema: () => ProductShipmentSchema,
64
73
  ProductTypeSchema: () => ProductTypeSchema,
65
74
  RolePermissionItemSchema: () => RolePermissionItemSchema,
66
75
  RoleSchema: () => RoleSchema,
76
+ SYNC_TABLE_NAMES: () => SYNC_TABLE_NAMES,
77
+ SetPriceListAssignmentsSchema: () => SetPriceListAssignmentsSchema,
67
78
  SetupInitSchema: () => SetupInitSchema,
79
+ SyncCursorSchema: () => SyncCursorSchema,
80
+ SyncEntityIdSchema: () => SyncEntityIdSchema,
81
+ SyncTableNameSchema: () => SyncTableNameSchema,
68
82
  UpdateEmployeeSchema: () => UpdateEmployeeSchema,
69
83
  UpdateFolderSchema: () => UpdateFolderSchema,
70
84
  UpdateOrganizationSchema: () => UpdateOrganizationSchema,
71
85
  UpdateOwnPasswordSchema: () => UpdateOwnPasswordSchema,
72
86
  UpdateOwnProfileSchema: () => UpdateOwnProfileSchema,
87
+ UpdatePriceListPricesSchema: () => UpdatePriceListPricesSchema,
73
88
  UpdatePriceListSchema: () => UpdatePriceListSchema,
74
89
  UpdateProductCollectionSchema: () => UpdateProductCollectionSchema,
75
90
  UpdateProductTypeSchema: () => UpdateProductTypeSchema,
76
91
  UpdateRoleSchema: () => UpdateRoleSchema,
77
92
  UpdateWarehouseSchema: () => UpdateWarehouseSchema,
78
- WarehouseSchema: () => WarehouseSchema
93
+ WarehouseSchema: () => WarehouseSchema,
94
+ createSyncChangePayloadSchema: () => createSyncChangePayloadSchema,
95
+ createSyncFetchResponseSchema: () => createSyncFetchResponseSchema,
96
+ createSyncSocketPayloadSchema: () => createSyncSocketPayloadSchema,
97
+ getCurrencyMinorUnits: () => getCurrencyMinorUnits
79
98
  });
80
99
  module.exports = __toCommonJS(index_exports);
81
100
 
@@ -86,6 +105,40 @@ var PaginationQuerySchema = import_zod.z.object({
86
105
  limit: import_zod.z.coerce.number().int().min(1).max(100).default(20)
87
106
  });
88
107
 
108
+ // src/generated/schemas/enums/CurrencyCode.schema.ts
109
+ var z2 = __toESM(require("zod"), 1);
110
+ 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"]);
111
+
112
+ // src/common/currency/index.ts
113
+ var MINOR_UNIT_OVERRIDES = {
114
+ BHD: 3,
115
+ BIF: 0,
116
+ CLP: 0,
117
+ DJF: 0,
118
+ GNF: 0,
119
+ IQD: 3,
120
+ ISK: 0,
121
+ JOD: 3,
122
+ JPY: 0,
123
+ KMF: 0,
124
+ KRW: 0,
125
+ KWD: 3,
126
+ LYD: 3,
127
+ OMR: 3,
128
+ PYG: 0,
129
+ RWF: 0,
130
+ TND: 3,
131
+ UGX: 0,
132
+ VND: 0,
133
+ VUV: 0,
134
+ XAF: 0,
135
+ XOF: 0,
136
+ XPF: 0
137
+ };
138
+ function getCurrencyMinorUnits(currency) {
139
+ return MINOR_UNIT_OVERRIDES[currency] ?? 2;
140
+ }
141
+
89
142
  // src/modules/auth/index.ts
90
143
  var import_zod2 = require("zod");
91
144
  var ALL_PERMISSIONS = [
@@ -143,14 +196,14 @@ var SetupInitSchema = import_zod2.z.object({
143
196
  var import_zod3 = require("zod");
144
197
 
145
198
  // src/generated/schemas/variants/pure/Organization.pure.ts
146
- var z3 = __toESM(require("zod"), 1);
147
- var OrganizationModelSchema = z3.object({
148
- id: z3.number().int(),
149
- name: z3.string(),
150
- website: z3.string().nullable(),
151
- updatedAt: z3.date(),
152
- warehouses: z3.array(z3.unknown()),
153
- priceListAssignments: z3.array(z3.unknown())
199
+ var z4 = __toESM(require("zod"), 1);
200
+ var OrganizationModelSchema = z4.object({
201
+ id: z4.number().int(),
202
+ name: z4.string(),
203
+ website: z4.string().nullable(),
204
+ updatedAt: z4.date(),
205
+ warehouses: z4.array(z4.unknown()),
206
+ priceListAssignments: z4.array(z4.unknown())
154
207
  }).strict();
155
208
 
156
209
  // src/modules/organization/index.ts
@@ -165,20 +218,21 @@ var OrganizationSchema = OrganizationModelSchema.omit({ warehouses: true }).exte
165
218
  var import_zod4 = require("zod");
166
219
 
167
220
  // src/generated/schemas/variants/pure/Warehouse.pure.ts
168
- var z5 = __toESM(require("zod"), 1);
169
- var WarehouseModelSchema = z5.object({
170
- id: z5.number().int(),
171
- address: z5.string(),
172
- note: z5.string().nullable(),
173
- code: z5.string(),
174
- organizationId: z5.number().int(),
175
- localityId: z5.number().int(),
176
- updatedAt: z5.date(),
177
- organization: z5.unknown(),
178
- locality: z5.unknown(),
179
- employees: z5.array(z5.unknown()),
180
- shipments: z5.array(z5.unknown()),
181
- priceListAssignments: z5.array(z5.unknown())
221
+ var z6 = __toESM(require("zod"), 1);
222
+ var WarehouseModelSchema = z6.object({
223
+ id: z6.number().int(),
224
+ address: z6.string(),
225
+ note: z6.string().nullable(),
226
+ code: z6.string(),
227
+ organizationId: z6.number().int(),
228
+ localityId: z6.number().int(),
229
+ updatedAt: z6.date(),
230
+ organization: z6.unknown(),
231
+ locality: z6.unknown(),
232
+ employees: z6.array(z6.unknown()),
233
+ shipments: z6.array(z6.unknown()),
234
+ priceListAssignments: z6.array(z6.unknown()),
235
+ stats: z6.array(z6.unknown())
182
236
  }).strict();
183
237
 
184
238
  // src/modules/warehouse/index.ts
@@ -196,15 +250,15 @@ var WarehouseSchema = WarehouseModelSchema.omit({ organization: true, locality:
196
250
  var import_zod5 = require("zod");
197
251
 
198
252
  // src/generated/schemas/variants/pure/Locality.pure.ts
199
- var z7 = __toESM(require("zod"), 1);
200
- var LocalityModelSchema = z7.object({
201
- id: z7.number().int(),
202
- name: z7.string(),
203
- countryId: z7.number().int(),
204
- updatedAt: z7.date(),
205
- country: z7.unknown(),
206
- warehouses: z7.array(z7.unknown()),
207
- priceListAssignments: z7.array(z7.unknown())
253
+ var z8 = __toESM(require("zod"), 1);
254
+ var LocalityModelSchema = z8.object({
255
+ id: z8.number().int(),
256
+ name: z8.string(),
257
+ countryId: z8.number().int(),
258
+ updatedAt: z8.date(),
259
+ country: z8.unknown(),
260
+ warehouses: z8.array(z8.unknown()),
261
+ priceListAssignments: z8.array(z8.unknown())
208
262
  }).strict();
209
263
 
210
264
  // src/modules/locality/index.ts
@@ -218,14 +272,14 @@ var LocalitySchema = LocalityModelSchema.omit({ warehouses: true, country: true
218
272
  var import_zod6 = require("zod");
219
273
 
220
274
  // src/generated/schemas/variants/pure/Country.pure.ts
221
- var z9 = __toESM(require("zod"), 1);
222
- var CountryModelSchema = z9.object({
223
- id: z9.number().int(),
224
- code: z9.string(),
225
- updatedAt: z9.date(),
226
- localities: z9.array(z9.unknown()),
227
- products: z9.array(z9.unknown()),
228
- priceListAssignments: z9.array(z9.unknown())
275
+ var z10 = __toESM(require("zod"), 1);
276
+ var CountryModelSchema = z10.object({
277
+ id: z10.number().int(),
278
+ code: z10.string(),
279
+ updatedAt: z10.date(),
280
+ localities: z10.array(z10.unknown()),
281
+ products: z10.array(z10.unknown()),
282
+ priceListAssignments: z10.array(z10.unknown())
229
283
  }).strict();
230
284
 
231
285
  // src/modules/country/index.ts
@@ -235,32 +289,32 @@ var CountrySchema = CountryModelSchema.omit({ localities: true }).extend({ updat
235
289
  var import_zod7 = require("zod");
236
290
 
237
291
  // src/generated/schemas/variants/pure/Employee.pure.ts
238
- var z11 = __toESM(require("zod"), 1);
239
- var EmployeeModelSchema = z11.object({
240
- id: z11.string(),
241
- email: z11.string(),
242
- password: z11.string(),
243
- firstName: z11.string(),
244
- lastName: z11.string(),
245
- phone: z11.string().nullable(),
246
- avatarUrl: z11.string().nullable(),
247
- warehouseId: z11.number().int().nullable(),
248
- isActive: z11.boolean(),
249
- lastSeen: z11.date().nullable(),
250
- updatedAt: z11.date(),
251
- warehouse: z11.unknown().nullable(),
252
- roleAssignments: z11.array(z11.unknown())
292
+ var z12 = __toESM(require("zod"), 1);
293
+ var EmployeeModelSchema = z12.object({
294
+ id: z12.string(),
295
+ email: z12.string(),
296
+ password: z12.string(),
297
+ firstName: z12.string(),
298
+ lastName: z12.string(),
299
+ phone: z12.string().nullable(),
300
+ avatarUrl: z12.string().nullable(),
301
+ warehouseId: z12.number().int().nullable(),
302
+ isActive: z12.boolean(),
303
+ lastSeen: z12.date().nullable(),
304
+ updatedAt: z12.date(),
305
+ warehouse: z12.unknown().nullable(),
306
+ roleAssignments: z12.array(z12.unknown())
253
307
  }).strict();
254
308
 
255
309
  // src/generated/schemas/variants/pure/EmployeeRole.pure.ts
256
- var z12 = __toESM(require("zod"), 1);
257
- var EmployeeRoleModelSchema = z12.object({
258
- id: z12.number().int(),
259
- name: z12.string(),
260
- color: z12.string(),
261
- updatedAt: z12.date(),
262
- assignments: z12.array(z12.unknown()),
263
- permissions: z12.array(z12.unknown())
310
+ var z13 = __toESM(require("zod"), 1);
311
+ var EmployeeRoleModelSchema = z13.object({
312
+ id: z13.number().int(),
313
+ name: z13.string(),
314
+ color: z13.string(),
315
+ updatedAt: z13.date(),
316
+ assignments: z13.array(z13.unknown()),
317
+ permissions: z13.array(z13.unknown())
264
318
  }).strict();
265
319
 
266
320
  // src/modules/employee/index.ts
@@ -457,13 +511,13 @@ var ProductCollectionSchema = import_zod11.z.object({
457
511
  var import_zod12 = require("zod");
458
512
 
459
513
  // src/generated/schemas/variants/pure/ProductMeasure.pure.ts
460
- var z18 = __toESM(require("zod"), 1);
461
- var ProductMeasureModelSchema = z18.object({
462
- id: z18.number().int(),
463
- name: z18.string().nullable(),
464
- code: z18.string().nullable(),
465
- updatedAt: z18.date(),
466
- products: z18.array(z18.unknown())
514
+ var z19 = __toESM(require("zod"), 1);
515
+ var ProductMeasureModelSchema = z19.object({
516
+ id: z19.number().int(),
517
+ name: z19.string().nullable(),
518
+ code: z19.string().nullable(),
519
+ updatedAt: z19.date(),
520
+ products: z19.array(z19.unknown())
467
521
  }).strict();
468
522
 
469
523
  // src/modules/product-measure/index.ts
@@ -473,54 +527,104 @@ var ProductMeasureSchema = ProductMeasureModelSchema.omit({ products: true }).ex
473
527
  var import_zod13 = require("zod");
474
528
 
475
529
  // src/generated/schemas/variants/pure/ProductBrand.pure.ts
476
- var z20 = __toESM(require("zod"), 1);
477
- var ProductBrandModelSchema = z20.object({
478
- id: z20.number().int(),
479
- name: z20.string(),
480
- updatedAt: z20.date(),
481
- products: z20.array(z20.unknown())
530
+ var z21 = __toESM(require("zod"), 1);
531
+ var ProductBrandModelSchema = z21.object({
532
+ id: z21.number().int(),
533
+ name: z21.string(),
534
+ updatedAt: z21.date(),
535
+ products: z21.array(z21.unknown())
482
536
  }).strict();
483
537
 
484
538
  // src/modules/product-brand/index.ts
485
539
  var ProductBrandSchema = ProductBrandModelSchema.omit({ products: true }).extend({ updatedAt: import_zod13.z.string() });
486
540
 
487
541
  // src/modules/product-item/index.ts
488
- var import_zod14 = require("zod");
542
+ var import_zod15 = require("zod");
489
543
 
490
544
  // src/generated/schemas/variants/pure/ProductItem.pure.ts
491
- var z23 = __toESM(require("zod"), 1);
545
+ var z24 = __toESM(require("zod"), 1);
492
546
 
493
547
  // src/generated/schemas/enums/WriteoffStrategy.schema.ts
494
- var z22 = __toESM(require("zod"), 1);
495
- var WriteoffStrategySchema = z22.enum(["FIFO", "LIFO", "FEFO", "MANUAL"]);
548
+ var z23 = __toESM(require("zod"), 1);
549
+ var WriteoffStrategySchema = z23.enum(["FIFO", "LIFO", "FEFO", "MANUAL"]);
496
550
 
497
551
  // src/generated/schemas/variants/pure/ProductItem.pure.ts
498
- var ProductItemModelSchema = z23.object({
499
- id: z23.number().int(),
500
- sku: z23.string(),
501
- name: z23.string(),
502
- productCollectionId: z23.number().int().nullable(),
503
- productTypeId: z23.number().int(),
504
- productBrandId: z23.number().int().nullable(),
505
- productMeasureId: z23.number().int().nullable(),
506
- countryId: z23.number().int().nullable(),
507
- characteristics: z23.unknown(),
552
+ var ProductItemModelSchema = z24.object({
553
+ id: z24.number().int(),
554
+ sku: z24.string(),
555
+ name: z24.string(),
556
+ productCollectionId: z24.number().int().nullable(),
557
+ productTypeId: z24.number().int(),
558
+ productBrandId: z24.number().int().nullable(),
559
+ productMeasureId: z24.number().int().nullable(),
560
+ countryId: z24.number().int().nullable(),
561
+ characteristics: z24.unknown(),
508
562
  writeoffStrategy: WriteoffStrategySchema.nullable(),
509
- isPublic: z23.boolean(),
510
- updatedAt: z23.date(),
511
- productCollection: z23.unknown().nullable(),
512
- productType: z23.unknown(),
513
- productBrand: z23.unknown().nullable(),
514
- productMeasure: z23.unknown().nullable(),
515
- country: z23.unknown().nullable(),
516
- barcodes: z23.array(z23.unknown()),
517
- packages: z23.array(z23.unknown()),
518
- shipments: z23.array(z23.unknown())
563
+ isPublic: z24.boolean(),
564
+ updatedAt: z24.date(),
565
+ productCollection: z24.unknown().nullable(),
566
+ productType: z24.unknown(),
567
+ productBrand: z24.unknown().nullable(),
568
+ productMeasure: z24.unknown().nullable(),
569
+ country: z24.unknown().nullable(),
570
+ barcodes: z24.array(z24.unknown()),
571
+ packages: z24.array(z24.unknown()),
572
+ shipments: z24.array(z24.unknown()),
573
+ stats: z24.array(z24.unknown())
519
574
  }).strict();
520
575
 
521
- // src/generated/schemas/enums/CurrencyCode.schema.ts
522
- var z24 = __toESM(require("zod"), 1);
523
- 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"]);
576
+ // src/modules/sync/index.ts
577
+ var import_zod14 = require("zod");
578
+ var SYNC_TABLE_NAMES = [
579
+ "country",
580
+ "locality",
581
+ "organization",
582
+ "warehouse",
583
+ "folder",
584
+ "product_collection",
585
+ "product_type",
586
+ "product_brand",
587
+ "product_measure",
588
+ "product_package",
589
+ "product_shipment",
590
+ "product_item",
591
+ "product_barcode",
592
+ "product_item_stats"
593
+ ];
594
+ var SyncTableNameSchema = import_zod14.z.enum(SYNC_TABLE_NAMES);
595
+ var SyncCursorSchema = import_zod14.z.union([import_zod14.z.string(), import_zod14.z.number(), import_zod14.z.null()]);
596
+ var SyncEntityIdSchema = import_zod14.z.union([import_zod14.z.string(), import_zod14.z.number()]);
597
+ function createSyncFetchResponseSchema(itemSchema) {
598
+ return import_zod14.z.object({
599
+ items: import_zod14.z.array(itemSchema),
600
+ cursor: SyncCursorSchema,
601
+ hasMore: import_zod14.z.boolean()
602
+ });
603
+ }
604
+ function createSyncChangePayloadSchema(itemSchema) {
605
+ const ids = import_zod14.z.array(SyncEntityIdSchema);
606
+ return import_zod14.z.object({
607
+ added: import_zod14.z.array(itemSchema).optional(),
608
+ modified: import_zod14.z.array(itemSchema).optional(),
609
+ removed: ids.optional(),
610
+ upserted: import_zod14.z.array(itemSchema).optional(),
611
+ deletedIds: ids.optional(),
612
+ deleted: ids.optional(),
613
+ cursor: SyncCursorSchema.optional()
614
+ });
615
+ }
616
+ function createSyncSocketPayloadSchema(itemSchema) {
617
+ const ids = import_zod14.z.array(SyncEntityIdSchema);
618
+ return import_zod14.z.object({
619
+ added: import_zod14.z.array(itemSchema),
620
+ modified: import_zod14.z.array(itemSchema),
621
+ removed: ids,
622
+ upserted: import_zod14.z.array(itemSchema),
623
+ deletedIds: ids,
624
+ deleted: ids,
625
+ cursor: SyncCursorSchema
626
+ });
627
+ }
524
628
 
525
629
  // src/modules/product-item/index.ts
526
630
  var ProductItemSchema = ProductItemModelSchema.omit({
@@ -532,118 +636,206 @@ var ProductItemSchema = ProductItemModelSchema.omit({
532
636
  barcodes: true,
533
637
  packages: true,
534
638
  shipments: true
535
- }).extend({ updatedAt: import_zod14.z.string() });
639
+ }).extend({ updatedAt: import_zod15.z.string() });
536
640
  var ProductItemWithRelationsSchema = ProductItemSchema.extend({
537
641
  productBrand: ProductBrandSchema.nullable(),
538
642
  productMeasure: ProductMeasureSchema.nullable()
539
643
  });
540
- var ProductItemStatsQuerySchema = import_zod14.z.object({
541
- productCollectionId: import_zod14.z.coerce.number().int().positive(),
542
- warehouseId: import_zod14.z.coerce.number().int().positive()
543
- });
544
- var ProductItemStatsSchema = import_zod14.z.object({
545
- id: import_zod14.z.number().int(),
546
- productItemId: import_zod14.z.number().int(),
547
- warehouseId: import_zod14.z.number().int(),
548
- quantity: import_zod14.z.string(),
549
- retailPrice: import_zod14.z.string().nullable(),
550
- currency: CurrencyCodeSchema.nullable()
551
- });
644
+ var ProductItemStatsQuerySchema = import_zod15.z.object({
645
+ productCollectionId: import_zod15.z.coerce.number().int().positive(),
646
+ warehouseId: import_zod15.z.coerce.number().int().positive()
647
+ });
648
+ var ProductItemStatsFetchQuerySchema = import_zod15.z.object({
649
+ warehouseId: import_zod15.z.coerce.number().int().positive(),
650
+ productCollectionId: import_zod15.z.coerce.number().int().positive().optional(),
651
+ cursor: import_zod15.z.string().min(1).optional(),
652
+ limit: import_zod15.z.coerce.number().int().positive().optional()
653
+ });
654
+ var ProductItemStatsSchema = import_zod15.z.object({
655
+ id: import_zod15.z.number().int(),
656
+ productItemId: import_zod15.z.number().int(),
657
+ warehouseId: import_zod15.z.number().int(),
658
+ quantity: import_zod15.z.string(),
659
+ retailPrice: import_zod15.z.string().nullable(),
660
+ currency: CurrencyCodeSchema.nullable(),
661
+ updatedAt: import_zod15.z.string()
662
+ });
663
+ var ProductItemStatsFetchResponseSchema = createSyncFetchResponseSchema(ProductItemStatsSchema);
664
+ var ProductItemStatsChangePayloadSchema = createSyncChangePayloadSchema(ProductItemStatsSchema);
665
+ var ProductItemStatsSocketPayloadSchema = createSyncSocketPayloadSchema(ProductItemStatsSchema);
552
666
 
553
667
  // src/modules/product-barcode/index.ts
554
- var import_zod15 = require("zod");
668
+ var import_zod16 = require("zod");
555
669
 
556
670
  // src/generated/schemas/variants/pure/ProductBarcode.pure.ts
557
- var z27 = __toESM(require("zod"), 1);
671
+ var z28 = __toESM(require("zod"), 1);
558
672
 
559
673
  // src/generated/schemas/enums/BarcodeType.schema.ts
560
- var z26 = __toESM(require("zod"), 1);
561
- var BarcodeTypeSchema = z26.enum(["FACTORY", "CUSTOM"]);
674
+ var z27 = __toESM(require("zod"), 1);
675
+ var BarcodeTypeSchema = z27.enum(["FACTORY", "CUSTOM"]);
562
676
 
563
677
  // src/generated/schemas/variants/pure/ProductBarcode.pure.ts
564
- var ProductBarcodeModelSchema = z27.object({
565
- id: z27.number().int(),
566
- code: z27.string(),
678
+ var ProductBarcodeModelSchema = z28.object({
679
+ id: z28.number().int(),
680
+ code: z28.string(),
567
681
  type: BarcodeTypeSchema,
568
- productItemId: z27.number().int(),
569
- updatedAt: z27.date(),
570
- productItem: z27.unknown()
682
+ productItemId: z28.number().int(),
683
+ updatedAt: z28.date(),
684
+ productItem: z28.unknown()
571
685
  }).strict();
572
686
 
573
687
  // src/modules/product-barcode/index.ts
574
- var ProductBarcodeSchema = ProductBarcodeModelSchema.omit({ productItem: true }).extend({ updatedAt: import_zod15.z.string() });
688
+ var ProductBarcodeSchema = ProductBarcodeModelSchema.omit({ productItem: true }).extend({ updatedAt: import_zod16.z.string() });
575
689
 
576
690
  // src/modules/product-package/index.ts
577
- var import_zod16 = require("zod");
691
+ var import_zod17 = require("zod");
578
692
 
579
693
  // src/generated/schemas/variants/pure/ProductPackage.pure.ts
580
- var z29 = __toESM(require("zod"), 1);
581
- var ProductPackageModelSchema = z29.object({
582
- id: z29.number().int(),
583
- name: z29.string().nullable(),
584
- isBase: z29.boolean(),
585
- productItemId: z29.number().int(),
586
- conversionFactor: z29.number(),
587
- updatedAt: z29.date(),
588
- productItem: z29.unknown(),
589
- prices: z29.array(z29.unknown())
694
+ var z30 = __toESM(require("zod"), 1);
695
+ var ProductPackageModelSchema = z30.object({
696
+ id: z30.number().int(),
697
+ name: z30.string().nullable(),
698
+ isBase: z30.boolean(),
699
+ productItemId: z30.number().int(),
700
+ conversionFactor: z30.number(),
701
+ updatedAt: z30.date(),
702
+ productItem: z30.unknown(),
703
+ prices: z30.array(z30.unknown())
590
704
  }).strict();
591
705
 
592
706
  // src/modules/product-package/index.ts
593
- var ProductPackageSchema = ProductPackageModelSchema.omit({ productItem: true }).extend({ updatedAt: import_zod16.z.string() });
707
+ var ProductPackageSchema = ProductPackageModelSchema.omit({ productItem: true }).extend({ updatedAt: import_zod17.z.string() });
594
708
 
595
709
  // src/modules/product-shipment/index.ts
596
- var import_zod17 = require("zod");
710
+ var import_zod18 = require("zod");
597
711
 
598
712
  // src/generated/schemas/variants/pure/ProductShipment.pure.ts
599
- var z31 = __toESM(require("zod"), 1);
600
- var ProductShipmentModelSchema = z31.object({
601
- id: z31.number().int(),
602
- warehouseId: z31.number().int(),
603
- productItemId: z31.number().int(),
604
- arrivalDate: z31.date(),
605
- expiryDate: z31.date().nullable(),
606
- quantity: z31.number(),
607
- priceAmount: z31.bigint(),
713
+ var z32 = __toESM(require("zod"), 1);
714
+ var ProductShipmentModelSchema = z32.object({
715
+ id: z32.number().int(),
716
+ warehouseId: z32.number().int(),
717
+ productItemId: z32.number().int(),
718
+ arrivalDate: z32.date(),
719
+ expiryDate: z32.date().nullable(),
720
+ quantity: z32.number(),
721
+ priceAmount: z32.bigint(),
608
722
  currency: CurrencyCodeSchema,
609
- updatedAt: z31.date(),
610
- warehouse: z31.unknown(),
611
- productItem: z31.unknown()
723
+ updatedAt: z32.date(),
724
+ warehouse: z32.unknown(),
725
+ productItem: z32.unknown()
612
726
  }).strict();
613
727
 
614
728
  // src/modules/product-shipment/index.ts
615
729
  var ProductShipmentSchema = ProductShipmentModelSchema.omit({ warehouse: true, productItem: true }).extend({
616
- arrivalDate: import_zod17.z.string(),
617
- expiryDate: import_zod17.z.string().nullable(),
618
- updatedAt: import_zod17.z.string()
730
+ arrivalDate: import_zod18.z.string(),
731
+ expiryDate: import_zod18.z.string().nullable(),
732
+ updatedAt: import_zod18.z.string()
619
733
  });
620
734
 
621
735
  // src/modules/price-list/index.ts
622
- var import_zod18 = require("zod");
736
+ var import_zod19 = require("zod");
737
+
738
+ // src/generated/schemas/enums/PriceListTargetType.schema.ts
739
+ var z34 = __toESM(require("zod"), 1);
740
+ var PriceListTargetTypeSchema = z34.enum(["WAREHOUSE", "ORGANIZATION", "LOCALITY", "COUNTRY"]);
623
741
 
624
742
  // src/generated/schemas/variants/pure/PriceList.pure.ts
625
- var z33 = __toESM(require("zod"), 1);
626
- var PriceListModelSchema = z33.object({
627
- id: z33.number().int(),
628
- name: z33.string(),
743
+ var z35 = __toESM(require("zod"), 1);
744
+ var PriceListModelSchema = z35.object({
745
+ id: z35.number().int(),
746
+ name: z35.string(),
629
747
  currency: CurrencyCodeSchema,
630
- isDefault: z33.boolean(),
631
- createdAt: z33.date(),
632
- updatedAt: z33.date(),
633
- prices: z33.array(z33.unknown()),
634
- assignments: z33.array(z33.unknown())
748
+ isDefault: z35.boolean(),
749
+ createdAt: z35.date(),
750
+ updatedAt: z35.date(),
751
+ prices: z35.array(z35.unknown()),
752
+ assignments: z35.array(z35.unknown())
635
753
  }).strict();
636
754
 
637
755
  // src/modules/price-list/index.ts
638
- var CreatePriceListSchema = import_zod18.z.object({
639
- name: import_zod18.z.string().min(1),
756
+ var CreatePriceListSchema = import_zod19.z.object({
757
+ name: import_zod19.z.string().min(1),
640
758
  currency: CurrencyCodeSchema
641
759
  });
642
760
  var UpdatePriceListSchema = CreatePriceListSchema.partial();
643
761
  var PriceListSchema = PriceListModelSchema.omit({
644
762
  prices: true,
645
763
  assignments: true
646
- }).extend({ updatedAt: import_zod18.z.string() });
764
+ }).extend({
765
+ createdAt: import_zod19.z.string(),
766
+ updatedAt: import_zod19.z.string()
767
+ });
768
+ var PriceListSummarySchema = PriceListSchema.extend({
769
+ assignmentCount: import_zod19.z.number().int().nonnegative(),
770
+ priceCount: import_zod19.z.number().int().nonnegative()
771
+ });
772
+ var PriceListAssignmentSchema = import_zod19.z.object({
773
+ id: import_zod19.z.number().int().positive(),
774
+ priceListId: import_zod19.z.number().int().positive(),
775
+ targetType: PriceListTargetTypeSchema,
776
+ warehouseId: import_zod19.z.number().int().positive().nullable(),
777
+ organizationId: import_zod19.z.number().int().positive().nullable(),
778
+ localityId: import_zod19.z.number().int().positive().nullable(),
779
+ countryId: import_zod19.z.number().int().positive().nullable()
780
+ });
781
+ var IdArraySchema = import_zod19.z.array(import_zod19.z.number().int().positive());
782
+ var SetPriceListAssignmentsSchema = import_zod19.z.object({
783
+ warehouseIds: IdArraySchema,
784
+ organizationIds: IdArraySchema,
785
+ localityIds: IdArraySchema,
786
+ countryIds: IdArraySchema
787
+ }).superRefine((value, context) => {
788
+ for (const [field, ids] of Object.entries(value)) {
789
+ if (new Set(ids).size !== ids.length) {
790
+ context.addIssue({
791
+ code: import_zod19.z.ZodIssueCode.custom,
792
+ path: [field],
793
+ message: "Target ids must be unique"
794
+ });
795
+ }
796
+ }
797
+ });
798
+ var ProductPriceSchema = import_zod19.z.object({
799
+ id: import_zod19.z.number().int().positive(),
800
+ priceListId: import_zod19.z.number().int().positive(),
801
+ productPackageId: import_zod19.z.number().int().positive(),
802
+ priceAmount: import_zod19.z.string().regex(/^\d+$/),
803
+ createdAt: import_zod19.z.string(),
804
+ updatedAt: import_zod19.z.string()
805
+ });
806
+ var ProductPriceInputSchema = import_zod19.z.object({
807
+ productPackageId: import_zod19.z.number().int().positive(),
808
+ priceAmount: import_zod19.z.string().regex(/^\d+$/)
809
+ });
810
+ var UpdatePriceListPricesSchema = import_zod19.z.object({
811
+ upserted: import_zod19.z.array(ProductPriceInputSchema),
812
+ removedProductPackageIds: IdArraySchema
813
+ }).superRefine((value, context) => {
814
+ const upsertedIds = value.upserted.map((price) => price.productPackageId);
815
+ if (new Set(upsertedIds).size !== upsertedIds.length) {
816
+ context.addIssue({
817
+ code: import_zod19.z.ZodIssueCode.custom,
818
+ path: ["upserted"],
819
+ message: "Product package ids must be unique"
820
+ });
821
+ }
822
+ const removedIds = value.removedProductPackageIds;
823
+ if (new Set(removedIds).size !== removedIds.length) {
824
+ context.addIssue({
825
+ code: import_zod19.z.ZodIssueCode.custom,
826
+ path: ["removedProductPackageIds"],
827
+ message: "Product package ids must be unique"
828
+ });
829
+ }
830
+ const removedIdSet = new Set(removedIds);
831
+ if (upsertedIds.some((id) => removedIdSet.has(id))) {
832
+ context.addIssue({
833
+ code: import_zod19.z.ZodIssueCode.custom,
834
+ path: ["removedProductPackageIds"],
835
+ message: "A product package cannot be updated and removed in the same request"
836
+ });
837
+ }
838
+ });
647
839
  // Annotate the CommonJS export names for ESM import in node:
648
840
  0 && (module.exports = {
649
841
  ALL_PERMISSIONS,
@@ -659,6 +851,7 @@ var PriceListSchema = PriceListModelSchema.omit({
659
851
  CreateProductTypeSchema,
660
852
  CreateRoleSchema,
661
853
  CreateWarehouseSchema,
854
+ CurrencyCodeSchema,
662
855
  EmployeeRoleSchema,
663
856
  EmployeeSchema,
664
857
  FolderSchema,
@@ -666,31 +859,49 @@ var PriceListSchema = PriceListModelSchema.omit({
666
859
  LoginSchema,
667
860
  OrganizationSchema,
668
861
  PaginationQuerySchema,
862
+ PriceListAssignmentSchema,
669
863
  PriceListSchema,
864
+ PriceListSummarySchema,
670
865
  ProductBarcodeSchema,
671
866
  ProductBrandSchema,
672
867
  ProductCollectionSchema,
673
868
  ProductItemSchema,
869
+ ProductItemStatsChangePayloadSchema,
870
+ ProductItemStatsFetchQuerySchema,
871
+ ProductItemStatsFetchResponseSchema,
674
872
  ProductItemStatsQuerySchema,
675
873
  ProductItemStatsSchema,
874
+ ProductItemStatsSocketPayloadSchema,
676
875
  ProductItemWithRelationsSchema,
677
876
  ProductMeasureSchema,
678
877
  ProductPackageSchema,
878
+ ProductPriceInputSchema,
879
+ ProductPriceSchema,
679
880
  ProductShipmentSchema,
680
881
  ProductTypeSchema,
681
882
  RolePermissionItemSchema,
682
883
  RoleSchema,
884
+ SYNC_TABLE_NAMES,
885
+ SetPriceListAssignmentsSchema,
683
886
  SetupInitSchema,
887
+ SyncCursorSchema,
888
+ SyncEntityIdSchema,
889
+ SyncTableNameSchema,
684
890
  UpdateEmployeeSchema,
685
891
  UpdateFolderSchema,
686
892
  UpdateOrganizationSchema,
687
893
  UpdateOwnPasswordSchema,
688
894
  UpdateOwnProfileSchema,
895
+ UpdatePriceListPricesSchema,
689
896
  UpdatePriceListSchema,
690
897
  UpdateProductCollectionSchema,
691
898
  UpdateProductTypeSchema,
692
899
  UpdateRoleSchema,
693
900
  UpdateWarehouseSchema,
694
- WarehouseSchema
901
+ WarehouseSchema,
902
+ createSyncChangePayloadSchema,
903
+ createSyncFetchResponseSchema,
904
+ createSyncSocketPayloadSchema,
905
+ getCurrencyMinorUnits
695
906
  });
696
907
  //# sourceMappingURL=index.cjs.map