@voyantjs/transactions 0.6.8 → 0.6.9
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 +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/pii.d.ts +16 -9
- package/dist/pii.d.ts.map +1 -1
- package/dist/pii.js +76 -70
- package/dist/routes-offers.d.ts +462 -28
- package/dist/routes-offers.d.ts.map +1 -1
- package/dist/routes-offers.js +199 -84
- package/dist/routes-orders.d.ts +461 -27
- package/dist/routes-orders.d.ts.map +1 -1
- package/dist/routes-orders.js +199 -84
- package/dist/routes-shared.d.ts +20 -13
- package/dist/routes-shared.d.ts.map +1 -1
- package/dist/routes-shared.js +7 -6
- package/dist/schema/participant-identity.d.ts +43 -6
- package/dist/schema/participant-identity.d.ts.map +1 -1
- package/dist/schema/participant-identity.js +12 -5
- package/dist/schema-audit.d.ts +4 -4
- package/dist/schema-audit.js +3 -3
- package/dist/schema-contacts.d.ts +529 -0
- package/dist/schema-contacts.d.ts.map +1 -0
- package/dist/schema-contacts.js +57 -0
- package/dist/schema-offers.d.ts +177 -3
- package/dist/schema-offers.d.ts.map +1 -1
- package/dist/schema-offers.js +13 -3
- package/dist/schema-orders.d.ts +177 -3
- package/dist/schema-orders.d.ts.map +1 -1
- package/dist/schema-orders.js +13 -3
- package/dist/schema-relations.d.ts +24 -0
- package/dist/schema-relations.d.ts.map +1 -1
- package/dist/schema-relations.js +40 -2
- package/dist/schema-shared.d.ts +3 -1
- package/dist/schema-shared.d.ts.map +1 -1
- package/dist/schema-shared.js +8 -2
- package/dist/schema-staff.d.ts +529 -0
- package/dist/schema-staff.d.ts.map +1 -0
- package/dist/schema-staff.js +57 -0
- package/dist/schema.d.ts +2 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +2 -0
- package/dist/service-offers.d.ts +275 -29
- package/dist/service-offers.d.ts.map +1 -1
- package/dist/service-offers.js +306 -43
- package/dist/service-orders.d.ts +227 -25
- package/dist/service-orders.d.ts.map +1 -1
- package/dist/service-orders.js +127 -22
- package/dist/service-shared.d.ts +144 -22
- package/dist/service-shared.d.ts.map +1 -1
- package/dist/service-shared.js +30 -2
- package/dist/service.d.ts +62 -22
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +42 -2
- package/dist/storefront-offers.d.ts +39 -5
- package/dist/storefront-offers.d.ts.map +1 -1
- package/dist/storefront-offers.js +3 -3
- package/dist/validation.d.ts +674 -36
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +186 -29
- package/package.json +5 -5
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,iCAAiC;;;EAAyC,CAAA;AAEvF,eAAO,MAAM,6BAA6B
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,iCAAiC;;;EAAyC,CAAA;AAEvF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsBrC,CAAA;AAEL,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAIR,CAAA;AAExB,eAAO,MAAM,iBAAiB;;;;;;;;EAQ5B,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;;;EAO5B,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;EAAqD,CAAA;AAElG,eAAO,MAAM,iCAAiC;;;;;;EAM5C,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;EAWpC,CAAA;AAE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;iBAKnC,CAAA"}
|
package/dist/validation.js
CHANGED
|
@@ -6,7 +6,8 @@ const paginationSchema = z.object({
|
|
|
6
6
|
const moneySchema = z.number().int().nullable().optional();
|
|
7
7
|
const metadataRecordSchema = z.record(z.string(), z.unknown());
|
|
8
8
|
export const storefrontOfferDiscountTypeSchema = z.enum(["percentage", "fixed_amount"]);
|
|
9
|
-
export const storefrontOfferMetadataSchema = z
|
|
9
|
+
export const storefrontOfferMetadataSchema = z
|
|
10
|
+
.object({
|
|
10
11
|
enabled: z.boolean().default(true),
|
|
11
12
|
locale: z.string().trim().min(2).optional().nullable(),
|
|
12
13
|
slug: z.string().trim().min(1).optional().nullable(),
|
|
@@ -18,11 +19,16 @@ export const storefrontOfferMetadataSchema = z.object({
|
|
|
18
19
|
applicableDepartureIds: z.array(z.string()).default([]),
|
|
19
20
|
validFrom: z.string().optional().nullable(),
|
|
20
21
|
validTo: z.string().optional().nullable(),
|
|
22
|
+
minTravelers: z.number().int().min(1).optional().nullable(),
|
|
21
23
|
minPassengers: z.number().int().min(1).optional().nullable(),
|
|
22
24
|
imageMobileUrl: z.string().trim().min(1).optional().nullable(),
|
|
23
25
|
imageDesktopUrl: z.string().trim().min(1).optional().nullable(),
|
|
24
26
|
stackable: z.boolean().default(false),
|
|
25
|
-
})
|
|
27
|
+
})
|
|
28
|
+
.transform(({ minPassengers, minTravelers, ...rest }) => ({
|
|
29
|
+
...rest,
|
|
30
|
+
minTravelers: minTravelers ?? minPassengers ?? null,
|
|
31
|
+
}));
|
|
26
32
|
export const offerMetadataSchema = z
|
|
27
33
|
.object({
|
|
28
34
|
storefrontPromotionalOffer: storefrontOfferMetadataSchema.optional(),
|
|
@@ -45,14 +51,7 @@ export const orderStatusSchema = z.enum([
|
|
|
45
51
|
"cancelled",
|
|
46
52
|
"expired",
|
|
47
53
|
]);
|
|
48
|
-
export const transactionParticipantTypeSchema = z.enum([
|
|
49
|
-
"traveler",
|
|
50
|
-
"booker",
|
|
51
|
-
"contact",
|
|
52
|
-
"occupant",
|
|
53
|
-
"staff",
|
|
54
|
-
"other",
|
|
55
|
-
]);
|
|
54
|
+
export const transactionParticipantTypeSchema = z.enum(["traveler", "occupant", "staff", "other"]);
|
|
56
55
|
export const transactionTravelerCategorySchema = z.enum([
|
|
57
56
|
"adult",
|
|
58
57
|
"child",
|
|
@@ -87,6 +86,8 @@ export const transactionItemParticipantRoleSchema = z.enum([
|
|
|
87
86
|
"service_assignee",
|
|
88
87
|
"other",
|
|
89
88
|
]);
|
|
89
|
+
export const transactionContactAssignmentRoleSchema = z.enum(["primary_contact", "other"]);
|
|
90
|
+
export const transactionStaffAssignmentRoleSchema = z.enum(["service_assignee", "other"]);
|
|
90
91
|
export const orderTermTypeSchema = z.enum([
|
|
91
92
|
"terms_and_conditions",
|
|
92
93
|
"cancellation",
|
|
@@ -112,6 +113,16 @@ const offerCoreSchema = z.object({
|
|
|
112
113
|
quoteId: z.string().nullable().optional(),
|
|
113
114
|
marketId: z.string().nullable().optional(),
|
|
114
115
|
sourceChannelId: z.string().nullable().optional(),
|
|
116
|
+
contactFirstName: z.string().max(255).nullable().optional(),
|
|
117
|
+
contactLastName: z.string().max(255).nullable().optional(),
|
|
118
|
+
contactEmail: z.string().email().nullable().optional(),
|
|
119
|
+
contactPhone: z.string().max(50).nullable().optional(),
|
|
120
|
+
contactPreferredLanguage: z.string().max(35).nullable().optional(),
|
|
121
|
+
contactCountry: z.string().max(100).nullable().optional(),
|
|
122
|
+
contactRegion: z.string().max(255).nullable().optional(),
|
|
123
|
+
contactCity: z.string().max(255).nullable().optional(),
|
|
124
|
+
contactAddressLine1: z.string().max(255).nullable().optional(),
|
|
125
|
+
contactPostalCode: z.string().max(50).nullable().optional(),
|
|
115
126
|
currency: z.string().length(3),
|
|
116
127
|
baseCurrency: z.string().length(3).nullable().optional(),
|
|
117
128
|
fxRateSetId: z.string().nullable().optional(),
|
|
@@ -167,10 +178,34 @@ const itemCoreSchema = z.object({
|
|
|
167
178
|
metadata: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
168
179
|
});
|
|
169
180
|
const itemParticipantCoreSchema = z.object({
|
|
170
|
-
|
|
181
|
+
travelerId: z.string().optional(),
|
|
171
182
|
role: transactionItemParticipantRoleSchema.default("traveler"),
|
|
172
183
|
isPrimary: z.boolean().default(false),
|
|
173
184
|
});
|
|
185
|
+
const staffAssignmentCoreSchema = z.object({
|
|
186
|
+
personId: z.string().nullable().optional(),
|
|
187
|
+
role: transactionStaffAssignmentRoleSchema.default("service_assignee"),
|
|
188
|
+
firstName: z.string().min(1).max(255),
|
|
189
|
+
lastName: z.string().min(1).max(255),
|
|
190
|
+
email: z.string().email().nullable().optional(),
|
|
191
|
+
phone: z.string().max(50).nullable().optional(),
|
|
192
|
+
preferredLanguage: z.string().max(35).nullable().optional(),
|
|
193
|
+
isPrimary: z.boolean().default(false),
|
|
194
|
+
notes: z.string().nullable().optional(),
|
|
195
|
+
metadata: metadataRecordSchema.nullable().optional(),
|
|
196
|
+
});
|
|
197
|
+
const contactAssignmentCoreSchema = z.object({
|
|
198
|
+
personId: z.string().nullable().optional(),
|
|
199
|
+
role: transactionContactAssignmentRoleSchema.default("primary_contact"),
|
|
200
|
+
firstName: z.string().min(1).max(255),
|
|
201
|
+
lastName: z.string().min(1).max(255),
|
|
202
|
+
email: z.string().email().nullable().optional(),
|
|
203
|
+
phone: z.string().max(50).nullable().optional(),
|
|
204
|
+
preferredLanguage: z.string().max(35).nullable().optional(),
|
|
205
|
+
isPrimary: z.boolean().default(false),
|
|
206
|
+
notes: z.string().nullable().optional(),
|
|
207
|
+
metadata: metadataRecordSchema.nullable().optional(),
|
|
208
|
+
});
|
|
174
209
|
const orderCoreSchema = z.object({
|
|
175
210
|
orderNumber: z.string().min(1).max(50),
|
|
176
211
|
offerId: z.string().nullable().optional(),
|
|
@@ -182,6 +217,16 @@ const orderCoreSchema = z.object({
|
|
|
182
217
|
quoteId: z.string().nullable().optional(),
|
|
183
218
|
marketId: z.string().nullable().optional(),
|
|
184
219
|
sourceChannelId: z.string().nullable().optional(),
|
|
220
|
+
contactFirstName: z.string().max(255).nullable().optional(),
|
|
221
|
+
contactLastName: z.string().max(255).nullable().optional(),
|
|
222
|
+
contactEmail: z.string().email().nullable().optional(),
|
|
223
|
+
contactPhone: z.string().max(50).nullable().optional(),
|
|
224
|
+
contactPreferredLanguage: z.string().max(35).nullable().optional(),
|
|
225
|
+
contactCountry: z.string().max(100).nullable().optional(),
|
|
226
|
+
contactRegion: z.string().max(255).nullable().optional(),
|
|
227
|
+
contactCity: z.string().max(255).nullable().optional(),
|
|
228
|
+
contactAddressLine1: z.string().max(255).nullable().optional(),
|
|
229
|
+
contactPostalCode: z.string().max(50).nullable().optional(),
|
|
185
230
|
currency: z.string().length(3),
|
|
186
231
|
baseCurrency: z.string().length(3).nullable().optional(),
|
|
187
232
|
fxRateSetId: z.string().nullable().optional(),
|
|
@@ -229,14 +274,57 @@ export const offerListQuerySchema = paginationSchema.extend({
|
|
|
229
274
|
marketId: z.string().optional(),
|
|
230
275
|
search: z.string().optional(),
|
|
231
276
|
});
|
|
232
|
-
export const
|
|
277
|
+
export const insertOfferTravelerSchema = participantCoreSchema
|
|
278
|
+
.extend({
|
|
233
279
|
offerId: z.string(),
|
|
280
|
+
})
|
|
281
|
+
.refine((value) => value.participantType !== "staff", {
|
|
282
|
+
message: "Use explicit staff assignments instead of traveler rows for staff participants",
|
|
283
|
+
path: ["participantType"],
|
|
234
284
|
});
|
|
235
|
-
export const
|
|
236
|
-
|
|
285
|
+
export const updateOfferTravelerSchema = participantCoreSchema
|
|
286
|
+
.partial()
|
|
287
|
+
.refine((value) => (value.participantType ?? "") !== "staff", {
|
|
288
|
+
message: "Use explicit staff assignments instead of traveler rows for staff participants",
|
|
289
|
+
path: ["participantType"],
|
|
290
|
+
});
|
|
291
|
+
export const offerTravelerListQuerySchema = paginationSchema.extend({
|
|
237
292
|
offerId: z.string().optional(),
|
|
238
293
|
personId: z.string().optional(),
|
|
239
294
|
});
|
|
295
|
+
export const insertOfferParticipantSchema = insertOfferTravelerSchema;
|
|
296
|
+
export const updateOfferParticipantSchema = updateOfferTravelerSchema;
|
|
297
|
+
export const offerParticipantListQuerySchema = offerTravelerListQuerySchema;
|
|
298
|
+
export const insertOfferContactAssignmentSchema = contactAssignmentCoreSchema.extend({
|
|
299
|
+
offerId: z.string(),
|
|
300
|
+
offerItemId: z.string().nullable().optional(),
|
|
301
|
+
});
|
|
302
|
+
export const updateOfferContactAssignmentSchema = contactAssignmentCoreSchema
|
|
303
|
+
.extend({
|
|
304
|
+
offerItemId: z.string().nullable().optional(),
|
|
305
|
+
})
|
|
306
|
+
.partial();
|
|
307
|
+
export const offerContactAssignmentListQuerySchema = paginationSchema.extend({
|
|
308
|
+
offerId: z.string().optional(),
|
|
309
|
+
offerItemId: z.string().optional(),
|
|
310
|
+
personId: z.string().optional(),
|
|
311
|
+
role: transactionContactAssignmentRoleSchema.optional(),
|
|
312
|
+
});
|
|
313
|
+
export const insertOfferStaffAssignmentSchema = staffAssignmentCoreSchema.extend({
|
|
314
|
+
offerId: z.string(),
|
|
315
|
+
offerItemId: z.string().nullable().optional(),
|
|
316
|
+
});
|
|
317
|
+
export const updateOfferStaffAssignmentSchema = staffAssignmentCoreSchema
|
|
318
|
+
.extend({
|
|
319
|
+
offerItemId: z.string().nullable().optional(),
|
|
320
|
+
})
|
|
321
|
+
.partial();
|
|
322
|
+
export const offerStaffAssignmentListQuerySchema = paginationSchema.extend({
|
|
323
|
+
offerId: z.string().optional(),
|
|
324
|
+
offerItemId: z.string().optional(),
|
|
325
|
+
personId: z.string().optional(),
|
|
326
|
+
role: transactionStaffAssignmentRoleSchema.optional(),
|
|
327
|
+
});
|
|
240
328
|
export const insertOfferItemSchema = itemCoreSchema.extend({
|
|
241
329
|
offerId: z.string(),
|
|
242
330
|
});
|
|
@@ -249,14 +337,27 @@ export const offerItemListQuerySchema = paginationSchema.extend({
|
|
|
249
337
|
slotId: z.string().optional(),
|
|
250
338
|
status: transactionItemStatusSchema.optional(),
|
|
251
339
|
});
|
|
252
|
-
export const
|
|
340
|
+
export const insertOfferItemTravelerSchema = itemParticipantCoreSchema
|
|
341
|
+
.extend({
|
|
253
342
|
offerItemId: z.string(),
|
|
254
|
-
})
|
|
255
|
-
|
|
256
|
-
|
|
343
|
+
})
|
|
344
|
+
.refine((value) => Boolean(value.travelerId), {
|
|
345
|
+
message: "travelerId is required",
|
|
346
|
+
path: ["travelerId"],
|
|
347
|
+
})
|
|
348
|
+
.transform(({ travelerId, ...rest }) => ({ ...rest, travelerId: travelerId }));
|
|
349
|
+
export const updateOfferItemTravelerSchema = itemParticipantCoreSchema
|
|
350
|
+
.partial()
|
|
351
|
+
.transform(({ travelerId, ...rest }) => ({ ...rest, travelerId }));
|
|
352
|
+
export const offerItemTravelerListQuerySchema = paginationSchema
|
|
353
|
+
.extend({
|
|
257
354
|
offerItemId: z.string().optional(),
|
|
258
|
-
|
|
259
|
-
})
|
|
355
|
+
travelerId: z.string().optional(),
|
|
356
|
+
})
|
|
357
|
+
.transform(({ travelerId, ...rest }) => ({ ...rest, travelerId }));
|
|
358
|
+
export const insertOfferItemParticipantSchema = insertOfferItemTravelerSchema;
|
|
359
|
+
export const updateOfferItemParticipantSchema = updateOfferItemTravelerSchema;
|
|
360
|
+
export const offerItemParticipantListQuerySchema = offerItemTravelerListQuerySchema;
|
|
260
361
|
export const insertOrderSchema = orderCoreSchema;
|
|
261
362
|
export const updateOrderSchema = orderCoreSchema.partial();
|
|
262
363
|
export const orderListQuerySchema = paginationSchema.extend({
|
|
@@ -269,13 +370,56 @@ export const orderListQuerySchema = paginationSchema.extend({
|
|
|
269
370
|
marketId: z.string().optional(),
|
|
270
371
|
search: z.string().optional(),
|
|
271
372
|
});
|
|
272
|
-
export const
|
|
373
|
+
export const insertOrderTravelerSchema = participantCoreSchema
|
|
374
|
+
.extend({
|
|
375
|
+
orderId: z.string(),
|
|
376
|
+
})
|
|
377
|
+
.refine((value) => value.participantType !== "staff", {
|
|
378
|
+
message: "Use explicit staff assignments instead of traveler rows for staff participants",
|
|
379
|
+
path: ["participantType"],
|
|
380
|
+
});
|
|
381
|
+
export const updateOrderTravelerSchema = participantCoreSchema
|
|
382
|
+
.partial()
|
|
383
|
+
.refine((value) => (value.participantType ?? "") !== "staff", {
|
|
384
|
+
message: "Use explicit staff assignments instead of traveler rows for staff participants",
|
|
385
|
+
path: ["participantType"],
|
|
386
|
+
});
|
|
387
|
+
export const orderTravelerListQuerySchema = paginationSchema.extend({
|
|
388
|
+
orderId: z.string().optional(),
|
|
389
|
+
personId: z.string().optional(),
|
|
390
|
+
});
|
|
391
|
+
export const insertOrderParticipantSchema = insertOrderTravelerSchema;
|
|
392
|
+
export const updateOrderParticipantSchema = updateOrderTravelerSchema;
|
|
393
|
+
export const orderParticipantListQuerySchema = orderTravelerListQuerySchema;
|
|
394
|
+
export const insertOrderContactAssignmentSchema = contactAssignmentCoreSchema.extend({
|
|
395
|
+
orderId: z.string(),
|
|
396
|
+
orderItemId: z.string().nullable().optional(),
|
|
397
|
+
});
|
|
398
|
+
export const updateOrderContactAssignmentSchema = contactAssignmentCoreSchema
|
|
399
|
+
.extend({
|
|
400
|
+
orderItemId: z.string().nullable().optional(),
|
|
401
|
+
})
|
|
402
|
+
.partial();
|
|
403
|
+
export const orderContactAssignmentListQuerySchema = paginationSchema.extend({
|
|
404
|
+
orderId: z.string().optional(),
|
|
405
|
+
orderItemId: z.string().optional(),
|
|
406
|
+
personId: z.string().optional(),
|
|
407
|
+
role: transactionContactAssignmentRoleSchema.optional(),
|
|
408
|
+
});
|
|
409
|
+
export const insertOrderStaffAssignmentSchema = staffAssignmentCoreSchema.extend({
|
|
273
410
|
orderId: z.string(),
|
|
411
|
+
orderItemId: z.string().nullable().optional(),
|
|
274
412
|
});
|
|
275
|
-
export const
|
|
276
|
-
|
|
413
|
+
export const updateOrderStaffAssignmentSchema = staffAssignmentCoreSchema
|
|
414
|
+
.extend({
|
|
415
|
+
orderItemId: z.string().nullable().optional(),
|
|
416
|
+
})
|
|
417
|
+
.partial();
|
|
418
|
+
export const orderStaffAssignmentListQuerySchema = paginationSchema.extend({
|
|
277
419
|
orderId: z.string().optional(),
|
|
420
|
+
orderItemId: z.string().optional(),
|
|
278
421
|
personId: z.string().optional(),
|
|
422
|
+
role: transactionStaffAssignmentRoleSchema.optional(),
|
|
279
423
|
});
|
|
280
424
|
export const insertOrderItemSchema = orderItemCoreSchema.extend({
|
|
281
425
|
orderId: z.string(),
|
|
@@ -290,14 +434,27 @@ export const orderItemListQuerySchema = paginationSchema.extend({
|
|
|
290
434
|
slotId: z.string().optional(),
|
|
291
435
|
status: transactionItemStatusSchema.optional(),
|
|
292
436
|
});
|
|
293
|
-
export const
|
|
437
|
+
export const insertOrderItemTravelerSchema = itemParticipantCoreSchema
|
|
438
|
+
.extend({
|
|
294
439
|
orderItemId: z.string(),
|
|
295
|
-
})
|
|
296
|
-
|
|
297
|
-
|
|
440
|
+
})
|
|
441
|
+
.refine((value) => Boolean(value.travelerId), {
|
|
442
|
+
message: "travelerId is required",
|
|
443
|
+
path: ["travelerId"],
|
|
444
|
+
})
|
|
445
|
+
.transform(({ travelerId, ...rest }) => ({ ...rest, travelerId: travelerId }));
|
|
446
|
+
export const updateOrderItemTravelerSchema = itemParticipantCoreSchema
|
|
447
|
+
.partial()
|
|
448
|
+
.transform(({ travelerId, ...rest }) => ({ ...rest, travelerId }));
|
|
449
|
+
export const orderItemTravelerListQuerySchema = paginationSchema
|
|
450
|
+
.extend({
|
|
298
451
|
orderItemId: z.string().optional(),
|
|
299
|
-
|
|
300
|
-
})
|
|
452
|
+
travelerId: z.string().optional(),
|
|
453
|
+
})
|
|
454
|
+
.transform(({ travelerId, ...rest }) => ({ ...rest, travelerId }));
|
|
455
|
+
export const insertOrderItemParticipantSchema = insertOrderItemTravelerSchema;
|
|
456
|
+
export const updateOrderItemParticipantSchema = updateOrderItemTravelerSchema;
|
|
457
|
+
export const orderItemParticipantListQuerySchema = orderItemTravelerListQuerySchema;
|
|
301
458
|
export const insertOrderTermSchema = orderTermRequiredParentSchema;
|
|
302
459
|
export const updateOrderTermSchema = orderTermCoreSchema.partial();
|
|
303
460
|
export const orderTermListQuerySchema = paginationSchema.extend({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/transactions",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"drizzle-orm": "^0.45.2",
|
|
30
30
|
"hono": "^4.12.10",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@voyantjs/core": "0.6.
|
|
33
|
-
"@voyantjs/db": "0.6.
|
|
34
|
-
"@voyantjs/hono": "0.6.
|
|
35
|
-
"@voyantjs/utils": "0.6.
|
|
32
|
+
"@voyantjs/core": "0.6.9",
|
|
33
|
+
"@voyantjs/db": "0.6.9",
|
|
34
|
+
"@voyantjs/hono": "0.6.9",
|
|
35
|
+
"@voyantjs/utils": "0.6.9"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"typescript": "^6.0.2",
|