@voyantjs/suppliers 0.95.0 → 0.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/validation.d.ts +1 -303
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +1 -144
- package/package.json +7 -6
package/dist/validation.d.ts
CHANGED
|
@@ -1,304 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const insertSupplierSchema: z.ZodObject<{
|
|
3
|
-
name: z.ZodString;
|
|
4
|
-
type: z.ZodEnum<{
|
|
5
|
-
other: "other";
|
|
6
|
-
hotel: "hotel";
|
|
7
|
-
restaurant: "restaurant";
|
|
8
|
-
transfer: "transfer";
|
|
9
|
-
guide: "guide";
|
|
10
|
-
experience: "experience";
|
|
11
|
-
airline: "airline";
|
|
12
|
-
}>;
|
|
13
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
14
|
-
pending: "pending";
|
|
15
|
-
active: "active";
|
|
16
|
-
inactive: "inactive";
|
|
17
|
-
}>>;
|
|
18
|
-
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
19
|
-
email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
20
|
-
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
21
|
-
website: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
22
|
-
address: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
23
|
-
city: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
24
|
-
country: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
25
|
-
defaultCurrency: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
26
|
-
primaryFacilityId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
27
|
-
contactName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
28
|
-
contactEmail: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
29
|
-
contactPhone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
30
|
-
paymentTermsDays: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
31
|
-
reservationTimeoutMinutes: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
32
|
-
customerPaymentPolicy: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
33
|
-
deposit: z.ZodObject<{
|
|
34
|
-
kind: z.ZodEnum<{
|
|
35
|
-
none: "none";
|
|
36
|
-
percent: "percent";
|
|
37
|
-
fixed_cents: "fixed_cents";
|
|
38
|
-
}>;
|
|
39
|
-
percent: z.ZodOptional<z.ZodNumber>;
|
|
40
|
-
amountCents: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
}, z.core.$strip>;
|
|
42
|
-
minDaysBeforeDepartureForDeposit: z.ZodNumber;
|
|
43
|
-
balanceDueDaysBeforeDeparture: z.ZodNumber;
|
|
44
|
-
balanceDueMinDaysFromNow: z.ZodNumber;
|
|
45
|
-
}, z.core.$strip>>>;
|
|
46
|
-
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
47
|
-
}, z.core.$strip>;
|
|
48
|
-
export declare const updateSupplierSchema: z.ZodObject<{
|
|
49
|
-
name: z.ZodOptional<z.ZodString>;
|
|
50
|
-
type: z.ZodOptional<z.ZodEnum<{
|
|
51
|
-
other: "other";
|
|
52
|
-
hotel: "hotel";
|
|
53
|
-
restaurant: "restaurant";
|
|
54
|
-
transfer: "transfer";
|
|
55
|
-
guide: "guide";
|
|
56
|
-
experience: "experience";
|
|
57
|
-
airline: "airline";
|
|
58
|
-
}>>;
|
|
59
|
-
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
60
|
-
pending: "pending";
|
|
61
|
-
active: "active";
|
|
62
|
-
inactive: "inactive";
|
|
63
|
-
}>>>;
|
|
64
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
65
|
-
email: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
66
|
-
phone: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
67
|
-
website: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
68
|
-
address: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
69
|
-
city: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
70
|
-
country: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
71
|
-
defaultCurrency: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
72
|
-
primaryFacilityId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
73
|
-
contactName: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
74
|
-
contactEmail: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
75
|
-
contactPhone: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
76
|
-
paymentTermsDays: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
|
|
77
|
-
reservationTimeoutMinutes: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
|
|
78
|
-
customerPaymentPolicy: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
79
|
-
deposit: z.ZodObject<{
|
|
80
|
-
kind: z.ZodEnum<{
|
|
81
|
-
none: "none";
|
|
82
|
-
percent: "percent";
|
|
83
|
-
fixed_cents: "fixed_cents";
|
|
84
|
-
}>;
|
|
85
|
-
percent: z.ZodOptional<z.ZodNumber>;
|
|
86
|
-
amountCents: z.ZodOptional<z.ZodNumber>;
|
|
87
|
-
}, z.core.$strip>;
|
|
88
|
-
minDaysBeforeDepartureForDeposit: z.ZodNumber;
|
|
89
|
-
balanceDueDaysBeforeDeparture: z.ZodNumber;
|
|
90
|
-
balanceDueMinDaysFromNow: z.ZodNumber;
|
|
91
|
-
}, z.core.$strip>>>>;
|
|
92
|
-
tags: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
93
|
-
}, z.core.$strip>;
|
|
94
|
-
export declare const selectSupplierSchema: z.ZodObject<{
|
|
95
|
-
name: z.ZodString;
|
|
96
|
-
type: z.ZodEnum<{
|
|
97
|
-
other: "other";
|
|
98
|
-
hotel: "hotel";
|
|
99
|
-
restaurant: "restaurant";
|
|
100
|
-
transfer: "transfer";
|
|
101
|
-
guide: "guide";
|
|
102
|
-
experience: "experience";
|
|
103
|
-
airline: "airline";
|
|
104
|
-
}>;
|
|
105
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
106
|
-
pending: "pending";
|
|
107
|
-
active: "active";
|
|
108
|
-
inactive: "inactive";
|
|
109
|
-
}>>;
|
|
110
|
-
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
111
|
-
email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
112
|
-
phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
113
|
-
website: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
114
|
-
address: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
115
|
-
city: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
116
|
-
country: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
117
|
-
defaultCurrency: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
118
|
-
primaryFacilityId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
119
|
-
contactName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
120
|
-
contactEmail: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
121
|
-
contactPhone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
122
|
-
paymentTermsDays: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
123
|
-
reservationTimeoutMinutes: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
124
|
-
customerPaymentPolicy: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
125
|
-
deposit: z.ZodObject<{
|
|
126
|
-
kind: z.ZodEnum<{
|
|
127
|
-
none: "none";
|
|
128
|
-
percent: "percent";
|
|
129
|
-
fixed_cents: "fixed_cents";
|
|
130
|
-
}>;
|
|
131
|
-
percent: z.ZodOptional<z.ZodNumber>;
|
|
132
|
-
amountCents: z.ZodOptional<z.ZodNumber>;
|
|
133
|
-
}, z.core.$strip>;
|
|
134
|
-
minDaysBeforeDepartureForDeposit: z.ZodNumber;
|
|
135
|
-
balanceDueDaysBeforeDeparture: z.ZodNumber;
|
|
136
|
-
balanceDueMinDaysFromNow: z.ZodNumber;
|
|
137
|
-
}, z.core.$strip>>>;
|
|
138
|
-
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
139
|
-
id: z.ZodString;
|
|
140
|
-
createdAt: z.ZodCoercedDate<unknown>;
|
|
141
|
-
updatedAt: z.ZodCoercedDate<unknown>;
|
|
142
|
-
}, z.core.$strip>;
|
|
143
|
-
export declare const supplierListSortFieldSchema: z.ZodEnum<{
|
|
144
|
-
name: "name";
|
|
145
|
-
createdAt: "createdAt";
|
|
146
|
-
status: "status";
|
|
147
|
-
type: "type";
|
|
148
|
-
defaultCurrency: "defaultCurrency";
|
|
149
|
-
}>;
|
|
150
|
-
export declare const supplierListSortDirSchema: z.ZodEnum<{
|
|
151
|
-
asc: "asc";
|
|
152
|
-
desc: "desc";
|
|
153
|
-
}>;
|
|
154
|
-
export declare const supplierListQuerySchema: z.ZodObject<{
|
|
155
|
-
type: z.ZodOptional<z.ZodEnum<{
|
|
156
|
-
other: "other";
|
|
157
|
-
hotel: "hotel";
|
|
158
|
-
restaurant: "restaurant";
|
|
159
|
-
transfer: "transfer";
|
|
160
|
-
guide: "guide";
|
|
161
|
-
experience: "experience";
|
|
162
|
-
airline: "airline";
|
|
163
|
-
}>>;
|
|
164
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
165
|
-
pending: "pending";
|
|
166
|
-
active: "active";
|
|
167
|
-
inactive: "inactive";
|
|
168
|
-
}>>;
|
|
169
|
-
primaryFacilityId: z.ZodOptional<z.ZodString>;
|
|
170
|
-
country: z.ZodOptional<z.ZodString>;
|
|
171
|
-
defaultCurrency: z.ZodOptional<z.ZodString>;
|
|
172
|
-
search: z.ZodOptional<z.ZodString>;
|
|
173
|
-
sortBy: z.ZodDefault<z.ZodEnum<{
|
|
174
|
-
name: "name";
|
|
175
|
-
createdAt: "createdAt";
|
|
176
|
-
status: "status";
|
|
177
|
-
type: "type";
|
|
178
|
-
defaultCurrency: "defaultCurrency";
|
|
179
|
-
}>>;
|
|
180
|
-
sortDir: z.ZodDefault<z.ZodEnum<{
|
|
181
|
-
asc: "asc";
|
|
182
|
-
desc: "desc";
|
|
183
|
-
}>>;
|
|
184
|
-
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
185
|
-
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
186
|
-
}, z.core.$strip>;
|
|
187
|
-
export declare const supplierAggregatesQuerySchema: z.ZodObject<{
|
|
188
|
-
from: z.ZodOptional<z.ZodString>;
|
|
189
|
-
to: z.ZodOptional<z.ZodString>;
|
|
190
|
-
}, z.core.$strip>;
|
|
191
|
-
export type InsertSupplier = z.infer<typeof insertSupplierSchema>;
|
|
192
|
-
export type UpdateSupplier = z.infer<typeof updateSupplierSchema>;
|
|
193
|
-
export type SelectSupplier = z.infer<typeof selectSupplierSchema>;
|
|
194
|
-
export declare const insertServiceSchema: z.ZodObject<{
|
|
195
|
-
serviceType: z.ZodEnum<{
|
|
196
|
-
other: "other";
|
|
197
|
-
transfer: "transfer";
|
|
198
|
-
guide: "guide";
|
|
199
|
-
experience: "experience";
|
|
200
|
-
accommodation: "accommodation";
|
|
201
|
-
meal: "meal";
|
|
202
|
-
}>;
|
|
203
|
-
facilityId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
204
|
-
name: z.ZodString;
|
|
205
|
-
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
206
|
-
duration: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
207
|
-
capacity: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
208
|
-
active: z.ZodDefault<z.ZodBoolean>;
|
|
209
|
-
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
210
|
-
}, z.core.$strip>;
|
|
211
|
-
export declare const updateServiceSchema: z.ZodObject<{
|
|
212
|
-
serviceType: z.ZodOptional<z.ZodEnum<{
|
|
213
|
-
other: "other";
|
|
214
|
-
transfer: "transfer";
|
|
215
|
-
guide: "guide";
|
|
216
|
-
experience: "experience";
|
|
217
|
-
accommodation: "accommodation";
|
|
218
|
-
meal: "meal";
|
|
219
|
-
}>>;
|
|
220
|
-
facilityId: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
221
|
-
name: z.ZodOptional<z.ZodString>;
|
|
222
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
223
|
-
duration: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
224
|
-
capacity: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
|
|
225
|
-
active: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
226
|
-
tags: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
227
|
-
}, z.core.$strip>;
|
|
228
|
-
export type InsertService = z.infer<typeof insertServiceSchema>;
|
|
229
|
-
export type UpdateService = z.infer<typeof updateServiceSchema>;
|
|
230
|
-
export declare const insertRateSchema: z.ZodObject<{
|
|
231
|
-
name: z.ZodString;
|
|
232
|
-
currency: z.ZodString;
|
|
233
|
-
amountCents: z.ZodNumber;
|
|
234
|
-
unit: z.ZodEnum<{
|
|
235
|
-
flat: "flat";
|
|
236
|
-
per_person: "per_person";
|
|
237
|
-
per_group: "per_group";
|
|
238
|
-
per_night: "per_night";
|
|
239
|
-
per_vehicle: "per_vehicle";
|
|
240
|
-
}>;
|
|
241
|
-
validFrom: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
242
|
-
validTo: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
243
|
-
minPax: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
244
|
-
maxPax: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
245
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
246
|
-
}, z.core.$strip>;
|
|
247
|
-
export declare const updateRateSchema: z.ZodObject<{
|
|
248
|
-
name: z.ZodOptional<z.ZodString>;
|
|
249
|
-
currency: z.ZodOptional<z.ZodString>;
|
|
250
|
-
amountCents: z.ZodOptional<z.ZodNumber>;
|
|
251
|
-
unit: z.ZodOptional<z.ZodEnum<{
|
|
252
|
-
flat: "flat";
|
|
253
|
-
per_person: "per_person";
|
|
254
|
-
per_group: "per_group";
|
|
255
|
-
per_night: "per_night";
|
|
256
|
-
per_vehicle: "per_vehicle";
|
|
257
|
-
}>>;
|
|
258
|
-
validFrom: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
259
|
-
validTo: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
260
|
-
minPax: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
|
|
261
|
-
maxPax: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
|
|
262
|
-
notes: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
263
|
-
}, z.core.$strip>;
|
|
264
|
-
export type InsertRate = z.infer<typeof insertRateSchema>;
|
|
265
|
-
export type UpdateRate = z.infer<typeof updateRateSchema>;
|
|
266
|
-
export declare const insertSupplierNoteSchema: z.ZodObject<{
|
|
267
|
-
content: z.ZodString;
|
|
268
|
-
}, z.core.$strip>;
|
|
269
|
-
export declare const insertAvailabilitySchema: z.ZodObject<{
|
|
270
|
-
date: z.ZodString;
|
|
271
|
-
available: z.ZodDefault<z.ZodBoolean>;
|
|
272
|
-
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
273
|
-
}, z.core.$strip>;
|
|
274
|
-
export declare const availabilityQuerySchema: z.ZodObject<{
|
|
275
|
-
from: z.ZodOptional<z.ZodString>;
|
|
276
|
-
to: z.ZodOptional<z.ZodString>;
|
|
277
|
-
}, z.core.$strip>;
|
|
278
|
-
export declare const insertContractSchema: z.ZodObject<{
|
|
279
|
-
agreementNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
280
|
-
startDate: z.ZodString;
|
|
281
|
-
endDate: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
282
|
-
renewalDate: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
283
|
-
terms: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
284
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
285
|
-
pending: "pending";
|
|
286
|
-
active: "active";
|
|
287
|
-
expired: "expired";
|
|
288
|
-
terminated: "terminated";
|
|
289
|
-
}>>;
|
|
290
|
-
}, z.core.$strip>;
|
|
291
|
-
export declare const updateContractSchema: z.ZodObject<{
|
|
292
|
-
agreementNumber: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
293
|
-
startDate: z.ZodOptional<z.ZodString>;
|
|
294
|
-
endDate: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
295
|
-
renewalDate: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
296
|
-
terms: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
297
|
-
status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
298
|
-
pending: "pending";
|
|
299
|
-
active: "active";
|
|
300
|
-
expired: "expired";
|
|
301
|
-
terminated: "terminated";
|
|
302
|
-
}>>>;
|
|
303
|
-
}, z.core.$strip>;
|
|
1
|
+
export * from "@voyantjs/suppliers-contracts";
|
|
304
2
|
//# sourceMappingURL=validation.d.ts.map
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
|
package/dist/validation.js
CHANGED
|
@@ -1,144 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
const supplierTypeSchema = z.enum([
|
|
4
|
-
"hotel",
|
|
5
|
-
"transfer",
|
|
6
|
-
"guide",
|
|
7
|
-
"experience",
|
|
8
|
-
"airline",
|
|
9
|
-
"restaurant",
|
|
10
|
-
"other",
|
|
11
|
-
]);
|
|
12
|
-
const supplierStatusSchema = z.enum(["active", "inactive", "pending"]);
|
|
13
|
-
const serviceTypeSchema = z.enum([
|
|
14
|
-
"accommodation",
|
|
15
|
-
"transfer",
|
|
16
|
-
"experience",
|
|
17
|
-
"guide",
|
|
18
|
-
"meal",
|
|
19
|
-
"other",
|
|
20
|
-
]);
|
|
21
|
-
const rateUnitSchema = z.enum(["per_person", "per_group", "per_night", "per_vehicle", "flat"]);
|
|
22
|
-
// ---------- suppliers ----------
|
|
23
|
-
const depositRuleSchema = z.object({
|
|
24
|
-
kind: z.enum(["none", "percent", "fixed_cents"]),
|
|
25
|
-
percent: z.number().min(0).max(100).optional(),
|
|
26
|
-
amountCents: z.number().int().min(0).optional(),
|
|
27
|
-
});
|
|
28
|
-
const customerPaymentPolicySchema = z.object({
|
|
29
|
-
deposit: depositRuleSchema,
|
|
30
|
-
minDaysBeforeDepartureForDeposit: z.number().int().min(0),
|
|
31
|
-
balanceDueDaysBeforeDeparture: z.number().int().min(0),
|
|
32
|
-
balanceDueMinDaysFromNow: z.number().int().min(0),
|
|
33
|
-
});
|
|
34
|
-
const supplierCoreSchema = z.object({
|
|
35
|
-
name: z.string().min(1).max(255),
|
|
36
|
-
type: supplierTypeSchema,
|
|
37
|
-
status: supplierStatusSchema.default("active"),
|
|
38
|
-
description: z.string().optional().nullable(),
|
|
39
|
-
email: z.string().email().optional().nullable(),
|
|
40
|
-
phone: z.string().optional().nullable(),
|
|
41
|
-
website: z.string().url().optional().nullable(),
|
|
42
|
-
address: z.string().optional().nullable(),
|
|
43
|
-
city: z.string().optional().nullable(),
|
|
44
|
-
country: z.string().optional().nullable(),
|
|
45
|
-
defaultCurrency: z.string().max(3).optional().nullable(),
|
|
46
|
-
primaryFacilityId: z.string().optional().nullable(),
|
|
47
|
-
contactName: z.string().optional().nullable(),
|
|
48
|
-
contactEmail: z.string().email().optional().nullable(),
|
|
49
|
-
contactPhone: z.string().optional().nullable(),
|
|
50
|
-
paymentTermsDays: z.number().int().positive().optional().nullable(),
|
|
51
|
-
reservationTimeoutMinutes: z
|
|
52
|
-
.number()
|
|
53
|
-
.int()
|
|
54
|
-
.min(0)
|
|
55
|
-
.max(24 * 60)
|
|
56
|
-
.optional()
|
|
57
|
-
.nullable(),
|
|
58
|
-
customerPaymentPolicy: customerPaymentPolicySchema.optional().nullable(),
|
|
59
|
-
tags: z.array(z.string()).default([]),
|
|
60
|
-
});
|
|
61
|
-
export const insertSupplierSchema = supplierCoreSchema;
|
|
62
|
-
export const updateSupplierSchema = supplierCoreSchema.partial();
|
|
63
|
-
export const selectSupplierSchema = supplierCoreSchema.extend({
|
|
64
|
-
id: typeIdSchema("suppliers"),
|
|
65
|
-
createdAt: z.coerce.date(),
|
|
66
|
-
updatedAt: z.coerce.date(),
|
|
67
|
-
});
|
|
68
|
-
export const supplierListSortFieldSchema = z.enum([
|
|
69
|
-
"name",
|
|
70
|
-
"type",
|
|
71
|
-
"status",
|
|
72
|
-
"defaultCurrency",
|
|
73
|
-
"createdAt",
|
|
74
|
-
]);
|
|
75
|
-
export const supplierListSortDirSchema = z.enum(["asc", "desc"]);
|
|
76
|
-
export const supplierListQuerySchema = z.object({
|
|
77
|
-
type: supplierTypeSchema.optional(),
|
|
78
|
-
status: supplierStatusSchema.optional(),
|
|
79
|
-
primaryFacilityId: z.string().optional(),
|
|
80
|
-
country: z.string().optional(),
|
|
81
|
-
defaultCurrency: z.string().optional(),
|
|
82
|
-
search: z.string().optional(),
|
|
83
|
-
sortBy: supplierListSortFieldSchema.default("createdAt"),
|
|
84
|
-
sortDir: supplierListSortDirSchema.default("desc"),
|
|
85
|
-
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
86
|
-
offset: z.coerce.number().int().min(0).default(0),
|
|
87
|
-
});
|
|
88
|
-
export const supplierAggregatesQuerySchema = z.object({
|
|
89
|
-
from: z.string().datetime().optional(),
|
|
90
|
-
to: z.string().datetime().optional(),
|
|
91
|
-
});
|
|
92
|
-
// ---------- services ----------
|
|
93
|
-
const serviceCoreSchema = z.object({
|
|
94
|
-
serviceType: serviceTypeSchema,
|
|
95
|
-
facilityId: z.string().optional().nullable(),
|
|
96
|
-
name: z.string().min(1).max(255),
|
|
97
|
-
description: z.string().optional().nullable(),
|
|
98
|
-
duration: z.string().optional().nullable(),
|
|
99
|
-
capacity: z.number().int().positive().optional().nullable(),
|
|
100
|
-
active: z.boolean().default(true),
|
|
101
|
-
tags: z.array(z.string()).default([]),
|
|
102
|
-
});
|
|
103
|
-
export const insertServiceSchema = serviceCoreSchema;
|
|
104
|
-
export const updateServiceSchema = serviceCoreSchema.partial();
|
|
105
|
-
// ---------- rates ----------
|
|
106
|
-
const rateCoreSchema = z.object({
|
|
107
|
-
name: z.string().min(1).max(255),
|
|
108
|
-
currency: z.string().min(3).max(3),
|
|
109
|
-
amountCents: z.number().int().min(0),
|
|
110
|
-
unit: rateUnitSchema,
|
|
111
|
-
validFrom: z.string().optional().nullable(),
|
|
112
|
-
validTo: z.string().optional().nullable(),
|
|
113
|
-
minPax: z.number().int().positive().optional().nullable(),
|
|
114
|
-
maxPax: z.number().int().positive().optional().nullable(),
|
|
115
|
-
notes: z.string().optional().nullable(),
|
|
116
|
-
});
|
|
117
|
-
export const insertRateSchema = rateCoreSchema;
|
|
118
|
-
export const updateRateSchema = rateCoreSchema.partial();
|
|
119
|
-
// ---------- notes ----------
|
|
120
|
-
export const insertSupplierNoteSchema = z.object({
|
|
121
|
-
content: z.string().min(1).max(10000),
|
|
122
|
-
});
|
|
123
|
-
// ---------- availability ----------
|
|
124
|
-
export const insertAvailabilitySchema = z.object({
|
|
125
|
-
date: z.string().min(1),
|
|
126
|
-
available: z.boolean().default(true),
|
|
127
|
-
notes: z.string().optional().nullable(),
|
|
128
|
-
});
|
|
129
|
-
export const availabilityQuerySchema = z.object({
|
|
130
|
-
from: z.string().optional(),
|
|
131
|
-
to: z.string().optional(),
|
|
132
|
-
});
|
|
133
|
-
// ---------- contracts ----------
|
|
134
|
-
const supplierContractStatusSchema = z.enum(["active", "expired", "pending", "terminated"]);
|
|
135
|
-
const contractCoreSchema = z.object({
|
|
136
|
-
agreementNumber: z.string().max(255).optional().nullable(),
|
|
137
|
-
startDate: z.string().min(1),
|
|
138
|
-
endDate: z.string().optional().nullable(),
|
|
139
|
-
renewalDate: z.string().optional().nullable(),
|
|
140
|
-
terms: z.string().optional().nullable(),
|
|
141
|
-
status: supplierContractStatusSchema.default("active"),
|
|
142
|
-
});
|
|
143
|
-
export const insertContractSchema = contractCoreSchema;
|
|
144
|
-
export const updateContractSchema = contractCoreSchema.partial();
|
|
1
|
+
export * from "@voyantjs/suppliers-contracts";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/suppliers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
"drizzle-orm": "^0.45.2",
|
|
30
30
|
"hono": "^4.12.10",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@voyantjs/core": "0.
|
|
33
|
-
"@voyantjs/db": "0.
|
|
34
|
-
"@voyantjs/facilities": "0.
|
|
35
|
-
"@voyantjs/hono": "0.
|
|
36
|
-
"@voyantjs/identity": "0.
|
|
32
|
+
"@voyantjs/core": "0.97.0",
|
|
33
|
+
"@voyantjs/db": "0.97.0",
|
|
34
|
+
"@voyantjs/facilities": "0.97.0",
|
|
35
|
+
"@voyantjs/hono": "0.97.0",
|
|
36
|
+
"@voyantjs/identity": "0.97.0",
|
|
37
|
+
"@voyantjs/suppliers-contracts": "0.97.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"typescript": "^6.0.2",
|