@jsdev_ninja/core 0.13.23 → 0.13.25

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.
@@ -36,7 +36,7 @@ export declare const CalculatedDataSchema: z.ZodObject<{
36
36
  price_total_in_currency: number;
37
37
  _COMMENT?: string | undefined;
38
38
  }>;
39
- export declare const DeliveryNoteSchema: z.ZodObject<{
39
+ export declare const EzDeliveryNoteSchema: z.ZodObject<{
40
40
  doc_uuid: z.ZodString;
41
41
  pdf_link: z.ZodString;
42
42
  pdf_link_copy: z.ZodString;
@@ -130,8 +130,119 @@ export declare const DeliveryNoteSchema: z.ZodObject<{
130
130
  date?: number | undefined;
131
131
  warning?: string | undefined;
132
132
  }>;
133
+ export declare const DeliveryNoteSchema: z.ZodObject<{
134
+ id: z.ZodString;
135
+ number: z.ZodString;
136
+ date: z.ZodNumber;
137
+ createdAt: z.ZodNumber;
138
+ status: z.ZodEnum<["pending", "paid", "cancelled"]>;
139
+ companyDetails: z.ZodOptional<z.ZodObject<{
140
+ name: z.ZodOptional<z.ZodString>;
141
+ address: z.ZodOptional<z.ZodString>;
142
+ phone: z.ZodOptional<z.ZodString>;
143
+ email: z.ZodOptional<z.ZodString>;
144
+ }, "strip", z.ZodTypeAny, {
145
+ name?: string | undefined;
146
+ email?: string | undefined;
147
+ address?: string | undefined;
148
+ phone?: string | undefined;
149
+ }, {
150
+ name?: string | undefined;
151
+ email?: string | undefined;
152
+ address?: string | undefined;
153
+ phone?: string | undefined;
154
+ }>>;
155
+ clientDetails: z.ZodOptional<z.ZodObject<{
156
+ name: z.ZodOptional<z.ZodString>;
157
+ address: z.ZodOptional<z.ZodString>;
158
+ phone: z.ZodOptional<z.ZodString>;
159
+ email: z.ZodOptional<z.ZodString>;
160
+ }, "strip", z.ZodTypeAny, {
161
+ name?: string | undefined;
162
+ email?: string | undefined;
163
+ address?: string | undefined;
164
+ phone?: string | undefined;
165
+ }, {
166
+ name?: string | undefined;
167
+ email?: string | undefined;
168
+ address?: string | undefined;
169
+ phone?: string | undefined;
170
+ }>>;
171
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
172
+ name: z.ZodOptional<z.ZodString>;
173
+ price: z.ZodOptional<z.ZodNumber>;
174
+ quantity: z.ZodOptional<z.ZodNumber>;
175
+ total: z.ZodOptional<z.ZodNumber>;
176
+ }, "strip", z.ZodTypeAny, {
177
+ name?: string | undefined;
178
+ price?: number | undefined;
179
+ quantity?: number | undefined;
180
+ total?: number | undefined;
181
+ }, {
182
+ name?: string | undefined;
183
+ price?: number | undefined;
184
+ quantity?: number | undefined;
185
+ total?: number | undefined;
186
+ }>, "many">>;
187
+ total: z.ZodOptional<z.ZodNumber>;
188
+ vat: z.ZodOptional<z.ZodNumber>;
189
+ link: z.ZodOptional<z.ZodString>;
190
+ }, "strip", z.ZodTypeAny, {
191
+ number: string;
192
+ status: "pending" | "paid" | "cancelled";
193
+ id: string;
194
+ date: number;
195
+ createdAt: number;
196
+ vat?: number | undefined;
197
+ items?: {
198
+ name?: string | undefined;
199
+ price?: number | undefined;
200
+ quantity?: number | undefined;
201
+ total?: number | undefined;
202
+ }[] | undefined;
203
+ companyDetails?: {
204
+ name?: string | undefined;
205
+ email?: string | undefined;
206
+ address?: string | undefined;
207
+ phone?: string | undefined;
208
+ } | undefined;
209
+ clientDetails?: {
210
+ name?: string | undefined;
211
+ email?: string | undefined;
212
+ address?: string | undefined;
213
+ phone?: string | undefined;
214
+ } | undefined;
215
+ total?: number | undefined;
216
+ link?: string | undefined;
217
+ }, {
218
+ number: string;
219
+ status: "pending" | "paid" | "cancelled";
220
+ id: string;
221
+ date: number;
222
+ createdAt: number;
223
+ vat?: number | undefined;
224
+ items?: {
225
+ name?: string | undefined;
226
+ price?: number | undefined;
227
+ quantity?: number | undefined;
228
+ total?: number | undefined;
229
+ }[] | undefined;
230
+ companyDetails?: {
231
+ name?: string | undefined;
232
+ email?: string | undefined;
233
+ address?: string | undefined;
234
+ phone?: string | undefined;
235
+ } | undefined;
236
+ clientDetails?: {
237
+ name?: string | undefined;
238
+ email?: string | undefined;
239
+ address?: string | undefined;
240
+ phone?: string | undefined;
241
+ } | undefined;
242
+ total?: number | undefined;
243
+ link?: string | undefined;
244
+ }>;
245
+ export type TEzDeliveryNote = z.infer<typeof EzDeliveryNoteSchema>;
133
246
  export type TDeliveryNote = z.infer<typeof DeliveryNoteSchema>;
134
247
  export type TCalculatedData = z.infer<typeof CalculatedDataSchema>;
135
- export declare function isDeliveryNote(data: unknown): data is TDeliveryNote;
136
- export declare function isCalculatedData(data: unknown): data is TCalculatedData;
137
248
  //# sourceMappingURL=DeliveryNote.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeliveryNote.d.ts","sourceRoot":"","sources":["../../../lib/entities/DeliveryNote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY/B,CAAC;AAGH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW7B,CAAC;AAGH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGnE,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,aAAa,CAEnE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,eAAe,CAEvE"}
1
+ {"version":3,"file":"DeliveryNote.d.ts","sourceRoot":"","sources":["../../../lib/entities/DeliveryNote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW/B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmC7B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACnE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -13,8 +13,7 @@ export const CalculatedDataSchema = z.object({
13
13
  price_total: z.string().regex(/^\d+\.\d{2}$/, "Price total must be in format XX.XX"),
14
14
  price_total_in_currency: z.number().positive(),
15
15
  });
16
- // Main DeliveryNote schema
17
- export const DeliveryNoteSchema = z.object({
16
+ export const EzDeliveryNoteSchema = z.object({
18
17
  doc_uuid: z.string().uuid("Document UUID must be a valid UUID"),
19
18
  pdf_link: z.string().url("PDF link must be a valid URL"),
20
19
  pdf_link_copy: z.string().url("PDF copy link must be a valid URL"),
@@ -26,10 +25,37 @@ export const DeliveryNoteSchema = z.object({
26
25
  warning: z.string().optional(),
27
26
  date: z.number().optional(),
28
27
  });
29
- // Validation functions
30
- export function isDeliveryNote(data) {
31
- return DeliveryNoteSchema.safeParse(data).success;
32
- }
33
- export function isCalculatedData(data) {
34
- return CalculatedDataSchema.safeParse(data).success;
35
- }
28
+ export const DeliveryNoteSchema = z.object({
29
+ id: z.string().min(1, "ID is required"),
30
+ number: z.string().min(1, "Number is required"),
31
+ date: z.number().min(1, "Date is required"),
32
+ createdAt: z.number().min(1, "Created at is required"),
33
+ status: z.enum(["pending", "paid", "cancelled"]),
34
+ companyDetails: z
35
+ .object({
36
+ name: z.string().min(1, "Name is required").optional(),
37
+ address: z.string().min(1, "Address is required").optional(),
38
+ phone: z.string().min(1, "Phone is required").optional(),
39
+ email: z.string().email("Email must be valid").optional(),
40
+ })
41
+ .optional(),
42
+ clientDetails: z
43
+ .object({
44
+ name: z.string().min(1, "Name is required").optional(),
45
+ address: z.string().min(1, "Address is required").optional(),
46
+ phone: z.string().min(1, "Phone is required").optional(),
47
+ email: z.string().email("Email must be valid").optional(),
48
+ })
49
+ .optional(),
50
+ items: z
51
+ .array(z.object({
52
+ name: z.string().min(1, "Name is required").optional(),
53
+ price: z.number().min(1, "Price is required").optional(),
54
+ quantity: z.number().min(1, "Quantity is required").optional(),
55
+ total: z.number().min(1, "Total is required").optional(),
56
+ }))
57
+ .optional(),
58
+ total: z.number().min(1, "Total is required").optional(),
59
+ vat: z.number().min(1, "VAT is required").optional(),
60
+ link: z.string().url("Link must be a valid URL").optional(),
61
+ });
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- export declare const InvoiceSchema: z.ZodObject<{
2
+ export declare const EzInvoiceSchema: z.ZodObject<{
3
3
  doc_uuid: z.ZodString;
4
4
  pdf_link: z.ZodString;
5
5
  pdf_link_copy: z.ZodString;
@@ -93,6 +93,118 @@ export declare const InvoiceSchema: z.ZodObject<{
93
93
  date?: number | undefined;
94
94
  warning?: string | undefined;
95
95
  }>;
96
+ export declare const InvoiceSchema: z.ZodObject<{
97
+ id: z.ZodString;
98
+ number: z.ZodString;
99
+ date: z.ZodString;
100
+ createdAt: z.ZodNumber;
101
+ status: z.ZodEnum<["pending", "paid", "cancelled"]>;
102
+ companyDetails: z.ZodOptional<z.ZodObject<{
103
+ name: z.ZodOptional<z.ZodString>;
104
+ address: z.ZodOptional<z.ZodString>;
105
+ phone: z.ZodOptional<z.ZodString>;
106
+ email: z.ZodOptional<z.ZodString>;
107
+ }, "strip", z.ZodTypeAny, {
108
+ name?: string | undefined;
109
+ email?: string | undefined;
110
+ address?: string | undefined;
111
+ phone?: string | undefined;
112
+ }, {
113
+ name?: string | undefined;
114
+ email?: string | undefined;
115
+ address?: string | undefined;
116
+ phone?: string | undefined;
117
+ }>>;
118
+ clientDetails: z.ZodOptional<z.ZodObject<{
119
+ name: z.ZodOptional<z.ZodString>;
120
+ address: z.ZodOptional<z.ZodString>;
121
+ phone: z.ZodOptional<z.ZodString>;
122
+ email: z.ZodOptional<z.ZodString>;
123
+ }, "strip", z.ZodTypeAny, {
124
+ name?: string | undefined;
125
+ email?: string | undefined;
126
+ address?: string | undefined;
127
+ phone?: string | undefined;
128
+ }, {
129
+ name?: string | undefined;
130
+ email?: string | undefined;
131
+ address?: string | undefined;
132
+ phone?: string | undefined;
133
+ }>>;
134
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
135
+ name: z.ZodOptional<z.ZodString>;
136
+ price: z.ZodOptional<z.ZodNumber>;
137
+ quantity: z.ZodOptional<z.ZodNumber>;
138
+ total: z.ZodOptional<z.ZodNumber>;
139
+ }, "strip", z.ZodTypeAny, {
140
+ name?: string | undefined;
141
+ price?: number | undefined;
142
+ quantity?: number | undefined;
143
+ total?: number | undefined;
144
+ }, {
145
+ name?: string | undefined;
146
+ price?: number | undefined;
147
+ quantity?: number | undefined;
148
+ total?: number | undefined;
149
+ }>, "many">>;
150
+ total: z.ZodOptional<z.ZodNumber>;
151
+ vat: z.ZodOptional<z.ZodNumber>;
152
+ link: z.ZodOptional<z.ZodString>;
153
+ }, "strip", z.ZodTypeAny, {
154
+ number: string;
155
+ status: "pending" | "paid" | "cancelled";
156
+ id: string;
157
+ date: string;
158
+ createdAt: number;
159
+ vat?: number | undefined;
160
+ items?: {
161
+ name?: string | undefined;
162
+ price?: number | undefined;
163
+ quantity?: number | undefined;
164
+ total?: number | undefined;
165
+ }[] | undefined;
166
+ companyDetails?: {
167
+ name?: string | undefined;
168
+ email?: string | undefined;
169
+ address?: string | undefined;
170
+ phone?: string | undefined;
171
+ } | undefined;
172
+ clientDetails?: {
173
+ name?: string | undefined;
174
+ email?: string | undefined;
175
+ address?: string | undefined;
176
+ phone?: string | undefined;
177
+ } | undefined;
178
+ total?: number | undefined;
179
+ link?: string | undefined;
180
+ }, {
181
+ number: string;
182
+ status: "pending" | "paid" | "cancelled";
183
+ id: string;
184
+ date: string;
185
+ createdAt: number;
186
+ vat?: number | undefined;
187
+ items?: {
188
+ name?: string | undefined;
189
+ price?: number | undefined;
190
+ quantity?: number | undefined;
191
+ total?: number | undefined;
192
+ }[] | undefined;
193
+ companyDetails?: {
194
+ name?: string | undefined;
195
+ email?: string | undefined;
196
+ address?: string | undefined;
197
+ phone?: string | undefined;
198
+ } | undefined;
199
+ clientDetails?: {
200
+ name?: string | undefined;
201
+ email?: string | undefined;
202
+ address?: string | undefined;
203
+ phone?: string | undefined;
204
+ } | undefined;
205
+ total?: number | undefined;
206
+ link?: string | undefined;
207
+ }>;
96
208
  export type TInvoice = z.infer<typeof InvoiceSchema>;
97
- export declare function isInvoice(data: unknown): data is TInvoice;
209
+ export type TEzInvoice = z.infer<typeof EzInvoiceSchema>;
98
210
  //# sourceMappingURL=Invoice.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Invoice.d.ts","sourceRoot":"","sources":["../../../lib/entities/Invoice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWxB,CAAC;AAGH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAGrD,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,QAAQ,CAEzD"}
1
+ {"version":3,"file":"Invoice.d.ts","sourceRoot":"","sources":["../../../lib/entities/Invoice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW1B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCxB,CAAC;AAGH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { CalculatedDataSchema } from "./DeliveryNote";
3
3
  // Main Invoice schema
4
- export const InvoiceSchema = z.object({
4
+ export const EzInvoiceSchema = z.object({
5
5
  doc_uuid: z.string().uuid("Document UUID must be a valid UUID"),
6
6
  pdf_link: z.string().url("PDF link must be a valid URL"),
7
7
  pdf_link_copy: z.string().url("PDF copy link must be a valid URL"),
@@ -13,7 +13,37 @@ export const InvoiceSchema = z.object({
13
13
  warning: z.string().optional(),
14
14
  date: z.number().optional(),
15
15
  });
16
- // Validation functions
17
- export function isInvoice(data) {
18
- return InvoiceSchema.safeParse(data).success;
19
- }
16
+ export const InvoiceSchema = z.object({
17
+ id: z.string().min(1, "ID is required"),
18
+ number: z.string().min(1, "Number is required"),
19
+ date: z.string().min(1, "Date is required"),
20
+ createdAt: z.number().min(1, "Created at is required"),
21
+ status: z.enum(["pending", "paid", "cancelled"]),
22
+ companyDetails: z
23
+ .object({
24
+ name: z.string().min(1, "Name is required").optional(),
25
+ address: z.string().min(1, "Address is required").optional(),
26
+ phone: z.string().min(1, "Phone is required").optional(),
27
+ email: z.string().email("Email must be valid").optional(),
28
+ })
29
+ .optional(),
30
+ clientDetails: z
31
+ .object({
32
+ name: z.string().min(1, "Name is required").optional(),
33
+ address: z.string().min(1, "Address is required").optional(),
34
+ phone: z.string().min(1, "Phone is required").optional(),
35
+ email: z.string().email("Email must be valid").optional(),
36
+ })
37
+ .optional(),
38
+ items: z
39
+ .array(z.object({
40
+ name: z.string().min(1, "Name is required").optional(),
41
+ price: z.number().min(1, "Price is required").optional(),
42
+ quantity: z.number().min(1, "Quantity is required").optional(),
43
+ total: z.number().min(1, "Total is required").optional(),
44
+ }))
45
+ .optional(),
46
+ total: z.number().min(1, "Total is required").optional(),
47
+ vat: z.number().min(1, "VAT is required").optional(),
48
+ link: z.string().url("Link must be a valid URL").optional(),
49
+ });