@marmot-systems/common 2.0.78 → 2.0.79

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.d.ts CHANGED
@@ -29,233 +29,6 @@ type Locale = "en-US" | "es-HN";
29
29
  declare const countryToCurrency: Record<IsoCountryCode, IsoCurrencyCode>;
30
30
  declare const currencyToLocale: Record<IsoCurrencyCode, Locale>;
31
31
 
32
- /**
33
- * Validates zod currency with precision.
34
- *
35
- *
36
- * @param minAmount
37
- * @param maxAmount
38
- * @returns
39
- */
40
- declare function handleZodCurrency(minAmount: number, maxAmount: number): z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
41
- /**
42
- * Trims any leading or trailing spaces
43
- * Transforms empty strings into undefined.
44
- *
45
- * @param s
46
- * @returns
47
- */
48
- declare const transformEmptyStringToUndefined: (s: string) => string | undefined;
49
- /**
50
- * - Collapses any run of whitespace in a string (spaces, tabs, newlines, nbspb, and other weird unicode spaces etc.)
51
- * into a single ASCII space.
52
- * - Trims leading and trailing whitespace.
53
- * " Jared \n Gomez \t Driver\t " -> "Jared Gomez Driver"
54
- *
55
- * @param s
56
- * @returns
57
- */
58
- declare const normalizeSpaces: (s: string) => string;
59
- /**
60
- * Removes all whitespace from a string
61
- * @param s
62
- * @returns
63
- */
64
- declare const removeAllWhitespace: (s: string) => string;
65
- /**
66
- * Removes all dashes and + signs from a string
67
- * +1-305-555-0123 -> "13055550123"
68
- * 305-555-0123 -> "3055550123"
69
- *
70
- * @param s
71
- * @returns
72
- */
73
- declare const removeDashesAndPlusSign: (s: string) => string;
74
- /**
75
- * Rounds a number to a certain precision.
76
- * Contract:
77
- * 1. Number must be finite and non negative.
78
- * 2. Precision must be finite nonnegative and an integer.
79
- * 3. Precision must be <= Max precision
80
- * 4. Returns a number >= 0
81
- * Default is round half up.
82
- *
83
- * @param num
84
- * @param precision
85
- * @param opts
86
- * @returns
87
- */
88
- declare function roundWithPrecision(num: number, precision: number, opts?: ToFixedOptions): number;
89
- declare function getCurrencyFromCountry(country: IsoCountryCode): IsoCurrencyCode;
90
- declare function formatMoneyCurrency(value: number, currency: IsoCurrencyCode): string;
91
-
92
- declare const CREATED_LOCATION: readonly ["web", "mobile"];
93
- type CreatedLocation = (typeof CREATED_LOCATION)[number];
94
- type IntBool = 0 | 1;
95
- declare const uuidSchema: z.ZodUUID;
96
- type UUID = z.infer<typeof uuidSchema>;
97
- type status = "active" | "inactive";
98
-
99
- declare const LoginFormSchema: z.ZodObject<{
100
- user_email: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>;
101
- password: z.ZodString;
102
- }, z.core.$strict>;
103
-
104
- declare const RegisterFormSchema: z.ZodObject<{
105
- companyData: z.ZodObject<{
106
- company_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
107
- company_address: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
108
- company_phone_number: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>;
109
- iso_country_code: z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodEnum<{
110
- US: "US";
111
- HN: "HN";
112
- }>>;
113
- }, z.core.$strict>;
114
- adminUserData: z.ZodObject<{
115
- user_first_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
116
- user_last_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
117
- user_email: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>;
118
- password: z.ZodString;
119
- }, z.core.$strict>;
120
- }, z.core.$strict>;
121
- declare const CompanyFormSchema: z.ZodObject<{
122
- company_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
123
- company_address: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
124
- company_phone_number: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>;
125
- iso_country_code: z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodEnum<{
126
- US: "US";
127
- HN: "HN";
128
- }>>;
129
- company_email: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>;
130
- rtn: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
131
- web_language: z.ZodEnum<{
132
- es: "es";
133
- en: "en";
134
- }>;
135
- }, z.core.$strict>;
136
-
137
- type UsersSnapshot = {
138
- user_id: number;
139
- user_first_name: string;
140
- user_last_name: string;
141
- user_email: string;
142
- user_role: UserRole;
143
- company_id: number;
144
- };
145
-
146
- declare const CustomerFormSchema: z.ZodObject<{
147
- customer_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
148
- customer_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
149
- customer_phone_number: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
150
- customer_email_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>>>;
151
- }, z.core.$strict>;
152
-
153
- type CustomerSnapshot = {
154
- customer_id: UUID;
155
- customer_name: string;
156
- customer_address: string | null;
157
- customer_phone_number: string | null;
158
- customer_email_address: string | null;
159
- customer_status: status;
160
- is_admin_reviewed: IntBool;
161
- company_id: number;
162
- };
163
- type MappedCustomers = {
164
- customer_id: string;
165
- customer_name: string;
166
- customer_address?: string;
167
- customer_phone_number?: string;
168
- customer_email_address?: string;
169
- };
170
-
171
- type MappedVendors = {
172
- vendor_id: string;
173
- vendor_name: string;
174
- vendor_address: string;
175
- vendor_phone_number: string;
176
- vendor_email_address: string;
177
- tax_rate: number;
178
- };
179
-
180
- declare const ProductFormSchema: z.ZodObject<{
181
- product_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
182
- product_description: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
183
- product_sku: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
184
- product_upc: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
185
- country_tax_rule_id: z.ZodOptional<z.ZodNumber>;
186
- product_gtin_14: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
187
- product_type: z.ZodEnum<{
188
- unit: "unit";
189
- weight: "weight";
190
- case: "case";
191
- }>;
192
- weight_unit: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodEnum<{
193
- kg: "kg";
194
- lb: "lb";
195
- g: "g";
196
- oz: "oz";
197
- }>>>;
198
- price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
199
- cost: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
200
- }, z.core.$strict>;
201
-
202
- type ProductType = "unit" | "weight" | "case";
203
- type WeightUnit = "kg" | "lb" | "g" | "oz";
204
- type ProductSnapshot = {
205
- product_id: UUID;
206
- product_name: string;
207
- product_description: string | null;
208
- product_sku: string | null;
209
- product_type: ProductType;
210
- price: string;
211
- weight_unit: WeightUnit | null;
212
- is_admin_reviewed: IntBool;
213
- company_id: number;
214
- product_upc: string | null;
215
- product_gtin_14: string | null;
216
- product_status: status;
217
- country_tax_rule_id: number | null;
218
- };
219
-
220
- type WarehouseSnapshot = {
221
- warehouse_id: UUID;
222
- warehouse_name: string;
223
- warehouse_address: string;
224
- created_location: CreatedLocation;
225
- is_deleted: IntBool | null;
226
- deleted_at: string | null;
227
- created_at: string | null;
228
- updated_at: string | null;
229
- company_id: number;
230
- created_by_user_id: number;
231
- };
232
-
233
- type LocationType = "warehouse" | "employee";
234
- type InventoryLocationSnapshot = {
235
- location_id: UUID;
236
- location_type: LocationType;
237
- reference_id: UUID;
238
- name: string;
239
- created_location: CreatedLocation;
240
- is_deleted: IntBool | null;
241
- deleted_at: string | null;
242
- created_at: string | null;
243
- updated_at: string | null;
244
- company_id: number;
245
- };
246
-
247
- type InventoryBalanceSnapshot = {
248
- inventory_balance_id: UUID;
249
- location_id: string | number;
250
- product_id: UUID;
251
- quantity: string;
252
- created_location: CreatedLocation;
253
- is_deleted: IntBool;
254
- deleted_at: string;
255
- created_at: string;
256
- updated_at: string;
257
- };
258
-
259
32
  declare const YmdDateSchema: z.ZodString;
260
33
  declare const SalesInvoiceSchema: z.ZodObject<{
261
34
  invoice_date: z.ZodString;
@@ -477,7 +250,238 @@ declare const AnyInvoiceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
477
250
  }>;
478
251
  }, z.core.$strip>>;
479
252
  }, z.core.$strip>], "invoice_type">;
253
+ declare function makeInvoiceSchemas(t: SchemaT): {
254
+ YmdDateSchema: z.ZodString;
255
+ SalesInvoiceSchema: z.ZodObject<{
256
+ invoice_date: z.ZodString;
257
+ due_date: z.ZodString;
258
+ tax_rate: z.ZodDefault<z.ZodNumber>;
259
+ tax_amount: z.ZodDefault<z.ZodNumber>;
260
+ warehouse_id: z.ZodOptional<z.ZodUUID>;
261
+ invoice_status: z.ZodDefault<z.ZodEnum<{
262
+ finalized: "finalized";
263
+ voided: "voided";
264
+ }>>;
265
+ invoice_type: z.ZodLiteral<"sales">;
266
+ party_id: z.ZodUUID;
267
+ invoice_items: z.ZodArray<z.ZodObject<{
268
+ invoice_id: z.ZodOptional<z.ZodUUID>;
269
+ product_id: z.ZodUUID;
270
+ product_name: z.ZodOptional<z.ZodString>;
271
+ product_description: z.ZodOptional<z.ZodString>;
272
+ product_type: z.ZodOptional<z.ZodEnum<{
273
+ unit: "unit";
274
+ weight: "weight";
275
+ case: "case";
276
+ }>>;
277
+ product_upc: z.ZodOptional<z.ZodString>;
278
+ weight_unit: z.ZodOptional<z.ZodEnum<{
279
+ kg: "kg";
280
+ lb: "lb";
281
+ g: "g";
282
+ oz: "oz";
283
+ }>>;
284
+ quantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
285
+ country_tax_rule_id: z.ZodOptional<z.ZodNumber>;
286
+ tax_percentage: z.ZodOptional<z.ZodNumber>;
287
+ price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
288
+ credit_type: z.ZodUndefined;
289
+ }, z.core.$strip>>;
290
+ }, z.core.$strip>;
291
+ CreditInvoiceSchema: z.ZodObject<{
292
+ invoice_date: z.ZodString;
293
+ due_date: z.ZodString;
294
+ tax_rate: z.ZodDefault<z.ZodNumber>;
295
+ tax_amount: z.ZodDefault<z.ZodNumber>;
296
+ warehouse_id: z.ZodOptional<z.ZodUUID>;
297
+ invoice_status: z.ZodDefault<z.ZodEnum<{
298
+ finalized: "finalized";
299
+ voided: "voided";
300
+ }>>;
301
+ invoice_type: z.ZodLiteral<"credit">;
302
+ party_id: z.ZodUUID;
303
+ invoice_items: z.ZodArray<z.ZodObject<{
304
+ invoice_id: z.ZodOptional<z.ZodUUID>;
305
+ product_id: z.ZodUUID;
306
+ product_name: z.ZodOptional<z.ZodString>;
307
+ product_description: z.ZodOptional<z.ZodString>;
308
+ product_type: z.ZodOptional<z.ZodEnum<{
309
+ unit: "unit";
310
+ weight: "weight";
311
+ case: "case";
312
+ }>>;
313
+ product_upc: z.ZodOptional<z.ZodString>;
314
+ weight_unit: z.ZodOptional<z.ZodEnum<{
315
+ kg: "kg";
316
+ lb: "lb";
317
+ g: "g";
318
+ oz: "oz";
319
+ }>>;
320
+ quantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
321
+ country_tax_rule_id: z.ZodOptional<z.ZodNumber>;
322
+ tax_percentage: z.ZodOptional<z.ZodNumber>;
323
+ price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
324
+ credit_type: z.ZodEnum<{
325
+ dump: "dump";
326
+ return: "return";
327
+ }>;
328
+ }, z.core.$strip>>;
329
+ }, z.core.$strip>;
330
+ PurchaseInvoiceSchema: z.ZodObject<{
331
+ invoice_date: z.ZodString;
332
+ due_date: z.ZodString;
333
+ tax_rate: z.ZodDefault<z.ZodNumber>;
334
+ tax_amount: z.ZodDefault<z.ZodNumber>;
335
+ warehouse_id: z.ZodOptional<z.ZodUUID>;
336
+ invoice_status: z.ZodDefault<z.ZodEnum<{
337
+ finalized: "finalized";
338
+ voided: "voided";
339
+ }>>;
340
+ invoice_type: z.ZodLiteral<"purchase">;
341
+ party_id: z.ZodUUID;
342
+ invoice_items: z.ZodArray<z.ZodObject<{
343
+ invoice_id: z.ZodOptional<z.ZodUUID>;
344
+ product_id: z.ZodUUID;
345
+ product_name: z.ZodOptional<z.ZodString>;
346
+ product_description: z.ZodOptional<z.ZodString>;
347
+ product_type: z.ZodOptional<z.ZodEnum<{
348
+ unit: "unit";
349
+ weight: "weight";
350
+ case: "case";
351
+ }>>;
352
+ product_upc: z.ZodOptional<z.ZodString>;
353
+ weight_unit: z.ZodOptional<z.ZodEnum<{
354
+ kg: "kg";
355
+ lb: "lb";
356
+ g: "g";
357
+ oz: "oz";
358
+ }>>;
359
+ quantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
360
+ country_tax_rule_id: z.ZodOptional<z.ZodNumber>;
361
+ tax_percentage: z.ZodOptional<z.ZodNumber>;
362
+ price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
363
+ credit_type: z.ZodUndefined;
364
+ }, z.core.$strip>>;
365
+ }, z.core.$strip>;
366
+ AnyInvoiceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
367
+ invoice_date: z.ZodString;
368
+ due_date: z.ZodString;
369
+ tax_rate: z.ZodDefault<z.ZodNumber>;
370
+ tax_amount: z.ZodDefault<z.ZodNumber>;
371
+ warehouse_id: z.ZodOptional<z.ZodUUID>;
372
+ invoice_status: z.ZodDefault<z.ZodEnum<{
373
+ finalized: "finalized";
374
+ voided: "voided";
375
+ }>>;
376
+ invoice_type: z.ZodLiteral<"sales">;
377
+ party_id: z.ZodUUID;
378
+ invoice_items: z.ZodArray<z.ZodObject<{
379
+ invoice_id: z.ZodOptional<z.ZodUUID>;
380
+ product_id: z.ZodUUID;
381
+ product_name: z.ZodOptional<z.ZodString>;
382
+ product_description: z.ZodOptional<z.ZodString>;
383
+ product_type: z.ZodOptional<z.ZodEnum<{
384
+ unit: "unit";
385
+ weight: "weight";
386
+ case: "case";
387
+ }>>;
388
+ product_upc: z.ZodOptional<z.ZodString>;
389
+ weight_unit: z.ZodOptional<z.ZodEnum<{
390
+ kg: "kg";
391
+ lb: "lb";
392
+ g: "g";
393
+ oz: "oz";
394
+ }>>;
395
+ quantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
396
+ country_tax_rule_id: z.ZodOptional<z.ZodNumber>;
397
+ tax_percentage: z.ZodOptional<z.ZodNumber>;
398
+ price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
399
+ credit_type: z.ZodUndefined;
400
+ }, z.core.$strip>>;
401
+ }, z.core.$strip>, z.ZodObject<{
402
+ invoice_date: z.ZodString;
403
+ due_date: z.ZodString;
404
+ tax_rate: z.ZodDefault<z.ZodNumber>;
405
+ tax_amount: z.ZodDefault<z.ZodNumber>;
406
+ warehouse_id: z.ZodOptional<z.ZodUUID>;
407
+ invoice_status: z.ZodDefault<z.ZodEnum<{
408
+ finalized: "finalized";
409
+ voided: "voided";
410
+ }>>;
411
+ invoice_type: z.ZodLiteral<"purchase">;
412
+ party_id: z.ZodUUID;
413
+ invoice_items: z.ZodArray<z.ZodObject<{
414
+ invoice_id: z.ZodOptional<z.ZodUUID>;
415
+ product_id: z.ZodUUID;
416
+ product_name: z.ZodOptional<z.ZodString>;
417
+ product_description: z.ZodOptional<z.ZodString>;
418
+ product_type: z.ZodOptional<z.ZodEnum<{
419
+ unit: "unit";
420
+ weight: "weight";
421
+ case: "case";
422
+ }>>;
423
+ product_upc: z.ZodOptional<z.ZodString>;
424
+ weight_unit: z.ZodOptional<z.ZodEnum<{
425
+ kg: "kg";
426
+ lb: "lb";
427
+ g: "g";
428
+ oz: "oz";
429
+ }>>;
430
+ quantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
431
+ country_tax_rule_id: z.ZodOptional<z.ZodNumber>;
432
+ tax_percentage: z.ZodOptional<z.ZodNumber>;
433
+ price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
434
+ credit_type: z.ZodUndefined;
435
+ }, z.core.$strip>>;
436
+ }, z.core.$strip>, z.ZodObject<{
437
+ invoice_date: z.ZodString;
438
+ due_date: z.ZodString;
439
+ tax_rate: z.ZodDefault<z.ZodNumber>;
440
+ tax_amount: z.ZodDefault<z.ZodNumber>;
441
+ warehouse_id: z.ZodOptional<z.ZodUUID>;
442
+ invoice_status: z.ZodDefault<z.ZodEnum<{
443
+ finalized: "finalized";
444
+ voided: "voided";
445
+ }>>;
446
+ invoice_type: z.ZodLiteral<"credit">;
447
+ party_id: z.ZodUUID;
448
+ invoice_items: z.ZodArray<z.ZodObject<{
449
+ invoice_id: z.ZodOptional<z.ZodUUID>;
450
+ product_id: z.ZodUUID;
451
+ product_name: z.ZodOptional<z.ZodString>;
452
+ product_description: z.ZodOptional<z.ZodString>;
453
+ product_type: z.ZodOptional<z.ZodEnum<{
454
+ unit: "unit";
455
+ weight: "weight";
456
+ case: "case";
457
+ }>>;
458
+ product_upc: z.ZodOptional<z.ZodString>;
459
+ weight_unit: z.ZodOptional<z.ZodEnum<{
460
+ kg: "kg";
461
+ lb: "lb";
462
+ g: "g";
463
+ oz: "oz";
464
+ }>>;
465
+ quantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
466
+ country_tax_rule_id: z.ZodOptional<z.ZodNumber>;
467
+ tax_percentage: z.ZodOptional<z.ZodNumber>;
468
+ price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
469
+ credit_type: z.ZodEnum<{
470
+ dump: "dump";
471
+ return: "return";
472
+ }>;
473
+ }, z.core.$strip>>;
474
+ }, z.core.$strip>], "invoice_type">;
475
+ };
480
476
 
477
+ declare const CREATED_LOCATION: readonly ["web", "mobile"];
478
+ type CreatedLocation = (typeof CREATED_LOCATION)[number];
479
+ type IntBool = 0 | 1;
480
+ declare const uuidSchema: z.ZodUUID;
481
+ type UUID = z.infer<typeof uuidSchema>;
482
+ type status = "active" | "inactive";
483
+
484
+ type SchemaT = (key: string, params?: Record<string, any>) => string;
481
485
  type SalesInvoice = z.infer<typeof SalesInvoiceSchema>;
482
486
  type CreditInvoice = z.infer<typeof CreditInvoiceSchema>;
483
487
  type PurchaseInvoice = z.infer<typeof PurchaseInvoiceSchema>;
@@ -514,6 +518,226 @@ type InvoiceSnapshotMobile = InvoiceSnapshot & {
514
518
  signature: string | null;
515
519
  };
516
520
 
521
+ /**
522
+ * Validates zod currency with precision.
523
+ *
524
+ *
525
+ * @param minAmount
526
+ * @param maxAmount
527
+ * @returns
528
+ */
529
+ declare function handleZodCurrency(minAmount: number, maxAmount: number, t?: SchemaT): z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
530
+ /**
531
+ * Trims any leading or trailing spaces
532
+ * Transforms empty strings into undefined.
533
+ *
534
+ * @param s
535
+ * @returns
536
+ */
537
+ declare const transformEmptyStringToUndefined: (s: string) => string | undefined;
538
+ /**
539
+ * - Collapses any run of whitespace in a string (spaces, tabs, newlines, nbspb, and other weird unicode spaces etc.)
540
+ * into a single ASCII space.
541
+ * - Trims leading and trailing whitespace.
542
+ * " Jared \n Gomez \t Driver\t " -> "Jared Gomez Driver"
543
+ *
544
+ * @param s
545
+ * @returns
546
+ */
547
+ declare const normalizeSpaces: (s: string) => string;
548
+ /**
549
+ * Removes all whitespace from a string
550
+ * @param s
551
+ * @returns
552
+ */
553
+ declare const removeAllWhitespace: (s: string) => string;
554
+ /**
555
+ * Removes all dashes and + signs from a string
556
+ * +1-305-555-0123 -> "13055550123"
557
+ * 305-555-0123 -> "3055550123"
558
+ *
559
+ * @param s
560
+ * @returns
561
+ */
562
+ declare const removeDashesAndPlusSign: (s: string) => string;
563
+ /**
564
+ * Rounds a number to a certain precision.
565
+ * Contract:
566
+ * 1. Number must be finite and non negative.
567
+ * 2. Precision must be finite nonnegative and an integer.
568
+ * 3. Precision must be <= Max precision
569
+ * 4. Returns a number >= 0
570
+ * Default is round half up.
571
+ *
572
+ * @param num
573
+ * @param precision
574
+ * @param opts
575
+ * @returns
576
+ */
577
+ declare function roundWithPrecision(num: number, precision: number, opts?: ToFixedOptions): number;
578
+ declare function getCurrencyFromCountry(country: IsoCountryCode): IsoCurrencyCode;
579
+ declare function formatMoneyCurrency(value: number, currency: IsoCurrencyCode): string;
580
+
581
+ declare const LoginFormSchema: z.ZodObject<{
582
+ user_email: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>;
583
+ password: z.ZodString;
584
+ }, z.core.$strict>;
585
+
586
+ declare const RegisterFormSchema: z.ZodObject<{
587
+ companyData: z.ZodObject<{
588
+ company_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
589
+ company_address: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
590
+ company_phone_number: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>;
591
+ iso_country_code: z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodEnum<{
592
+ US: "US";
593
+ HN: "HN";
594
+ }>>;
595
+ }, z.core.$strict>;
596
+ adminUserData: z.ZodObject<{
597
+ user_first_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
598
+ user_last_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
599
+ user_email: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>;
600
+ password: z.ZodString;
601
+ }, z.core.$strict>;
602
+ }, z.core.$strict>;
603
+ declare const CompanyFormSchema: z.ZodObject<{
604
+ company_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
605
+ company_address: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
606
+ company_phone_number: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>;
607
+ iso_country_code: z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodEnum<{
608
+ US: "US";
609
+ HN: "HN";
610
+ }>>;
611
+ company_email: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>;
612
+ rtn: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
613
+ web_language: z.ZodEnum<{
614
+ es: "es";
615
+ en: "en";
616
+ }>;
617
+ }, z.core.$strict>;
618
+
619
+ type UsersSnapshot = {
620
+ user_id: number;
621
+ user_first_name: string;
622
+ user_last_name: string;
623
+ user_email: string;
624
+ user_role: UserRole;
625
+ company_id: number;
626
+ };
627
+
628
+ declare const CustomerFormSchema: z.ZodObject<{
629
+ customer_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
630
+ customer_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
631
+ customer_phone_number: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
632
+ customer_email_address: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>, z.ZodOptional<z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>>>>;
633
+ }, z.core.$strict>;
634
+
635
+ type CustomerSnapshot = {
636
+ customer_id: UUID;
637
+ customer_name: string;
638
+ customer_address: string | null;
639
+ customer_phone_number: string | null;
640
+ customer_email_address: string | null;
641
+ customer_status: status;
642
+ is_admin_reviewed: IntBool;
643
+ company_id: number;
644
+ };
645
+ type MappedCustomers = {
646
+ customer_id: string;
647
+ customer_name: string;
648
+ customer_address?: string;
649
+ customer_phone_number?: string;
650
+ customer_email_address?: string;
651
+ };
652
+
653
+ type MappedVendors = {
654
+ vendor_id: string;
655
+ vendor_name: string;
656
+ vendor_address: string;
657
+ vendor_phone_number: string;
658
+ vendor_email_address: string;
659
+ tax_rate: number;
660
+ };
661
+
662
+ declare const ProductFormSchema: z.ZodObject<{
663
+ product_name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
664
+ product_description: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
665
+ product_sku: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodTransform<string | undefined, string>>>;
666
+ product_upc: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
667
+ country_tax_rule_id: z.ZodOptional<z.ZodNumber>;
668
+ product_gtin_14: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<string | undefined, string>>>;
669
+ product_type: z.ZodEnum<{
670
+ unit: "unit";
671
+ weight: "weight";
672
+ case: "case";
673
+ }>;
674
+ weight_unit: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodEnum<{
675
+ kg: "kg";
676
+ lb: "lb";
677
+ g: "g";
678
+ oz: "oz";
679
+ }>>>;
680
+ price: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
681
+ cost: z.ZodPipe<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodTransform<number, string>>, z.ZodNumber]>, z.ZodTransform<number, number>>;
682
+ }, z.core.$strict>;
683
+
684
+ type ProductType = "unit" | "weight" | "case";
685
+ type WeightUnit = "kg" | "lb" | "g" | "oz";
686
+ type ProductSnapshot = {
687
+ product_id: UUID;
688
+ product_name: string;
689
+ product_description: string | null;
690
+ product_sku: string | null;
691
+ product_type: ProductType;
692
+ price: string;
693
+ weight_unit: WeightUnit | null;
694
+ is_admin_reviewed: IntBool;
695
+ company_id: number;
696
+ product_upc: string | null;
697
+ product_gtin_14: string | null;
698
+ product_status: status;
699
+ country_tax_rule_id: number | null;
700
+ };
701
+
702
+ type WarehouseSnapshot = {
703
+ warehouse_id: UUID;
704
+ warehouse_name: string;
705
+ warehouse_address: string;
706
+ created_location: CreatedLocation;
707
+ is_deleted: IntBool | null;
708
+ deleted_at: string | null;
709
+ created_at: string | null;
710
+ updated_at: string | null;
711
+ company_id: number;
712
+ created_by_user_id: number;
713
+ };
714
+
715
+ type LocationType = "warehouse" | "employee";
716
+ type InventoryLocationSnapshot = {
717
+ location_id: UUID;
718
+ location_type: LocationType;
719
+ reference_id: UUID;
720
+ name: string;
721
+ created_location: CreatedLocation;
722
+ is_deleted: IntBool | null;
723
+ deleted_at: string | null;
724
+ created_at: string | null;
725
+ updated_at: string | null;
726
+ company_id: number;
727
+ };
728
+
729
+ type InventoryBalanceSnapshot = {
730
+ inventory_balance_id: UUID;
731
+ location_id: string | number;
732
+ product_id: UUID;
733
+ quantity: string;
734
+ created_location: CreatedLocation;
735
+ is_deleted: IntBool;
736
+ deleted_at: string;
737
+ created_at: string;
738
+ updated_at: string;
739
+ };
740
+
517
741
  type InvoiceItemStatus = "finalized" | "voided";
518
742
  type InvoiceItemSnapshot = {
519
743
  invoice_item_id: UUID;
@@ -705,4 +929,4 @@ type MappedPointOfSales = {
705
929
  declare const POS_INVOICE_TYPE: readonly ["sales", "credit"];
706
930
  type PosInvoiceType = (typeof POS_INVOICE_TYPE)[number];
707
931
 
708
- export { type AnyInvoiceOut, AnyInvoiceSchema, type AppLanguage, type AuditEventsSnapshot, COMPANY_LANGUAGES, CREDIT_TYPE, CompanyFormSchema, type CompanyLanguages, type CompanySnapshot, type CountryTaxRuleSnapshot, type CreatedLocation, CreditApplicationSchema, type CreditApplicationSnapshot, type CreditApplicationStatus, type CreditInvoice, CreditInvoiceSchema, type CreditType, type CustomerFilter, CustomerFormSchema, type CustomerSnapshot, type DriverCustomerSnapshot, type DriverSettingSnapshot, type EntityAction, type EntityType, INVOICE_STATUS, INVOICE_TYPE, ISO_COUNTRY_CODES, type InventoryBalanceSnapshot, type InventoryLocationSnapshot, type InventorySystem, type InvoiceFilter, type InvoiceItemResponse, type InvoiceItemSnapshot, type InvoiceItemStatus, type InvoiceSnapshot, type InvoiceSnapshotMobile, type InvoiceStatus, type InvoiceType, type IsoCountryCode, type IsoCurrencyCode, LoginFormSchema, type MappedCustomers, type MappedInvoiceItem, type MappedPointOfSales, type MappedVendors, PAYMENT_METHOD, POS_INVOICE_TYPE, type PaymentFilter, PaymentFormSchema, type PaymentMethod, type PaymentSnapshot, type PaymentStatus, PointOfSalesSchema, type PosInvoiceType, ProductFormSchema, type ProductSnapshot, type ProductType, type PurchaseInvoice, PurchaseInvoiceSchema, RegisterFormSchema, type SalesInvoice, SalesInvoiceSchema, type ServerSyncIds, type ServerSyncLogIds, USER_ROLES, type UUID, type UserRole, type UsersSnapshot, type WarehouseSnapshot, type WeightUnit, YmdDateSchema, addDaysLocalYmd, countryToCurrency, currencyToLocale, exceedsTwoDecimals, formatMoneyCurrency, formatYmdLong, getCurrencyFromCountry, getErrorMessage, handleZodCurrency, localDateFromYmd, mapInvoiceProducts, normalizeSpaces, removeAllWhitespace, removeDashesAndPlusSign, roundWithPrecision, todayLocalYmd, transformEmptyStringToUndefined, ymdFromLocalDate };
932
+ export { type AnyInvoiceOut, AnyInvoiceSchema, type AppLanguage, type AuditEventsSnapshot, COMPANY_LANGUAGES, CREDIT_TYPE, CompanyFormSchema, type CompanyLanguages, type CompanySnapshot, type CountryTaxRuleSnapshot, type CreatedLocation, CreditApplicationSchema, type CreditApplicationSnapshot, type CreditApplicationStatus, type CreditInvoice, CreditInvoiceSchema, type CreditType, type CustomerFilter, CustomerFormSchema, type CustomerSnapshot, type DriverCustomerSnapshot, type DriverSettingSnapshot, type EntityAction, type EntityType, INVOICE_STATUS, INVOICE_TYPE, ISO_COUNTRY_CODES, type InventoryBalanceSnapshot, type InventoryLocationSnapshot, type InventorySystem, type InvoiceFilter, type InvoiceItemResponse, type InvoiceItemSnapshot, type InvoiceItemStatus, type InvoiceSnapshot, type InvoiceSnapshotMobile, type InvoiceStatus, type InvoiceType, type IsoCountryCode, type IsoCurrencyCode, LoginFormSchema, type MappedCustomers, type MappedInvoiceItem, type MappedPointOfSales, type MappedVendors, PAYMENT_METHOD, POS_INVOICE_TYPE, type PaymentFilter, PaymentFormSchema, type PaymentMethod, type PaymentSnapshot, type PaymentStatus, PointOfSalesSchema, type PosInvoiceType, ProductFormSchema, type ProductSnapshot, type ProductType, type PurchaseInvoice, PurchaseInvoiceSchema, RegisterFormSchema, type SalesInvoice, SalesInvoiceSchema, type SchemaT, type ServerSyncIds, type ServerSyncLogIds, USER_ROLES, type UUID, type UserRole, type UsersSnapshot, type WarehouseSnapshot, type WeightUnit, YmdDateSchema, addDaysLocalYmd, countryToCurrency, currencyToLocale, exceedsTwoDecimals, formatMoneyCurrency, formatYmdLong, getCurrencyFromCountry, getErrorMessage, handleZodCurrency, localDateFromYmd, makeInvoiceSchemas, mapInvoiceProducts, normalizeSpaces, removeAllWhitespace, removeDashesAndPlusSign, roundWithPrecision, todayLocalYmd, transformEmptyStringToUndefined, ymdFromLocalDate };