@nextorders/food-schema 0.2.6 → 0.3.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/index.mjs CHANGED
@@ -326,7 +326,7 @@ const ScheduleSchema = z.array(DayScheduleSchema).refine((schedules) => {
326
326
  const NextOpeningSchema = z.object({
327
327
  day: WeekDaySchema,
328
328
  time: TimeSchema,
329
- relativeDays: z.number().int()
329
+ relativeDays: z.number().int().nonnegative()
330
330
  });
331
331
  const OpeningStatusSchema = z.object({
332
332
  isClosed: z.boolean(),
@@ -335,7 +335,7 @@ const OpeningStatusSchema = z.object({
335
335
  currentDay: WeekDaySchema,
336
336
  todayHours: TimePeriodSchema.array().nullable(),
337
337
  todayEndAt: TimeSchema.nullable(),
338
- todayEndInMinutes: z.number().nullable(),
338
+ todayEndInMinutes: z.number().nonnegative().nullable(),
339
339
  nextOpening: NextOpeningSchema.nullable()
340
340
  });
341
341
 
@@ -352,7 +352,7 @@ const DeliveryByCourierSchema = z.object({
352
352
  isAvailable: z.boolean(),
353
353
  paymentMethods: PaymentMethodSchema.array(),
354
354
  conditions: LocaleValueSchema.array().optional(),
355
- minAmountForDelivery: z.number().optional(),
355
+ minAmountForDelivery: z.number().nonnegative().optional(),
356
356
  schedule: ScheduleSchema.optional()
357
357
  });
358
358
  const SelfPickupSchema = z.object({
@@ -396,7 +396,7 @@ const ImageSchema = z.object({
396
396
  format: ImageFormatSchema
397
397
  });
398
398
 
399
- const VideoTypeSchema = z.enum(["video/mp4"]);
399
+ const VideoTypeSchema = z.enum(["video/mp4", "video/webm"]);
400
400
  const VideoSchema = z.object({
401
401
  id: z.string(),
402
402
  url: z.string(),
@@ -404,10 +404,10 @@ const VideoSchema = z.object({
404
404
  });
405
405
 
406
406
  const NutritionFactsSchema = z.object({
407
- calories: z.number(),
408
- carbohydrate: z.number(),
409
- protein: z.number(),
410
- fat: z.number()
407
+ calories: z.number().nonnegative(),
408
+ carbohydrate: z.number().nonnegative(),
409
+ protein: z.number().nonnegative(),
410
+ fat: z.number().nonnegative()
411
411
  });
412
412
  const ProductBadgeSchema = z.object({
413
413
  id: z.string(),
@@ -419,9 +419,9 @@ const ProductVariantSchema = z.object({
419
419
  images: ImageSchema.array(),
420
420
  video: VideoSchema.optional(),
421
421
  weightUnit: WeightUnitSchema,
422
- weightValue: z.number(),
423
- price: z.number(),
424
- originalPrice: z.number().optional(),
422
+ weightValue: z.number().nonnegative(),
423
+ price: z.number().nonnegative(),
424
+ originalPrice: z.number().nonnegative().optional(),
425
425
  sku: z.string().nullable(),
426
426
  nutritionFacts: NutritionFactsSchema.nullable()
427
427
  });
@@ -459,7 +459,7 @@ const MenuCategorySchema = z.object({
459
459
  id: z.string(),
460
460
  slug: z.string(),
461
461
  title: LocaleValueSchema.array(),
462
- icon: z.string().optional().nullable(),
462
+ icon: z.string().optional(),
463
463
  products: ProductSchema.array()
464
464
  });
465
465
  const MenuSchema = z.object({
@@ -481,17 +481,18 @@ const HeadScriptSchema = z.object({
481
481
  type: z.string().optional(),
482
482
  textContent: z.string().optional()
483
483
  });
484
+ const HeadStyleSchema = z.string();
484
485
  const OptionsSchema = z.object({
485
486
  selectorTitle: LocaleValueSchema.array(),
486
487
  selectorDescription: LocaleValueSchema.array().optional(),
487
- logoUrl: z.string().optional().nullable(),
488
+ logoUrl: z.string().optional(),
488
489
  availableLocales: LocaleSchema.array(),
489
490
  defaultLocale: LocaleSchema,
490
491
  countryCode: CountryCodeSchema,
491
492
  currencyCode: CurrencyCodeSchema,
492
493
  headLinks: HeadLinkSchema.array().optional(),
493
494
  headScripts: HeadScriptSchema.array().optional(),
494
- headStyles: z.string().array().optional()
495
+ headStyles: HeadStyleSchema.array().optional()
495
496
  });
496
497
 
497
498
  const DeliveryMethodSchema = z.enum([
@@ -508,8 +509,8 @@ const OrderItemSchema = z.object({
508
509
  categorySlug: z.string(),
509
510
  variantId: z.string(),
510
511
  quantity: z.number().positive(),
511
- unitPrice: z.number(),
512
- totalPrice: z.number()
512
+ unitPrice: z.number().nonnegative(),
513
+ totalPrice: z.number().nonnegative()
513
514
  // quantity × unitPrice
514
515
  });
515
516
  const OrderItemChangeSchema = z.object({
@@ -547,8 +548,8 @@ const OrderSchema = z.object({
547
548
  /** Payment */
548
549
  paymentMethodId: PaymentMethodSchema.shape.id,
549
550
  /** Amount of cash that client has to pay if choose cash */
550
- changeFrom: z.number().optional(),
551
- totalPrice: z.number(),
551
+ changeFrom: z.number().nonnegative().optional(),
552
+ totalPrice: z.number().nonnegative(),
552
553
  /** Client */
553
554
  name: z.string(),
554
555
  phone: z.string(),
@@ -580,7 +581,7 @@ const GatewayRequestSchema = z.object({
580
581
  });
581
582
  const BaseResponseSchema = z.object({
582
583
  ok: z.boolean(),
583
- error: z.string().nullable().optional()
584
+ error: z.string().optional()
584
585
  });
585
586
  const GatewayGetOptionsRequestSchema = GatewayRequestSchema.extend({
586
587
  type: z.literal("getOptions")
@@ -599,7 +600,7 @@ const GatewayGetChannelsResponseSchema = BaseResponseSchema.extend({
599
600
  const GatewayGetOrderRequestSchema = GatewayRequestSchema.extend({
600
601
  type: z.literal("getOrder"),
601
602
  body: z.object({
602
- id: z.string().optional().nullable()
603
+ id: z.string().optional()
603
604
  })
604
605
  });
605
606
  const GatewayGetOrderResponseSchema = BaseResponseSchema.extend({
@@ -710,4 +711,4 @@ const GatewayResponseSchema = z.discriminatedUnion("type", [
710
711
  GatewayGetTimeSlotsResponseSchema
711
712
  ]);
712
713
 
713
- export { BaseResponseSchema, ChannelSchema, CompositionIngredientSchema, CompositionProductSchema, CountryCodeSchema, CurrencyCodeSchema, DeliveryMethodSchema, GatewayActionTypeSchema, GatewayAddOrderItemRequestSchema, GatewayAddOrderItemResponseSchema, GatewayCompleteOrderRequestSchema, GatewayCompleteOrderResponseSchema, GatewayCreateOrderRequestSchema, GatewayCreateOrderResponseSchema, GatewayDecrementOrderItemQuantityRequestSchema, GatewayDecrementOrderItemQuantityResponseSchema, GatewayGetChannelsRequestSchema, GatewayGetChannelsResponseSchema, GatewayGetDeliveryByCourierStatusRequestSchema, GatewayGetDeliveryByCourierStatusResponseSchema, GatewayGetMenuRequestSchema, GatewayGetMenuResponseSchema, GatewayGetOptionsRequestSchema, GatewayGetOptionsResponseSchema, GatewayGetOrderRequestSchema, GatewayGetOrderResponseSchema, GatewayGetSelfPickupStatusRequestSchema, GatewayGetSelfPickupStatusResponseSchema, GatewayGetTimeSlotsRequestSchema, GatewayGetTimeSlotsResponseSchema, GatewayIncrementOrderItemQuantityRequestSchema, GatewayIncrementOrderItemQuantityResponseSchema, GatewayRequestSchema, GatewayResponseSchema, GatewayUpdateOrderRequestSchema, GatewayUpdateOrderResponseSchema, ImageFormatSchema, ImageSchema, ImageSizeSchema, LocaleSchema, LocaleValueSchema, MenuCategorySchema, MenuSchema, NutritionFactsSchema, OpeningStatusSchema, OptionsSchema, OrderDeliveryAddressSchema, OrderItemChangeSchema, OrderItemSchema, OrderSchema, OrderStatusSchema, OrderWarehouseAddressSchema, PaymentMethodSchema, PaymentMethodTypeSchema, ProductBadgeSchema, ProductCompositionSchema, ProductSchema, ProductVariantSchema, RecommendedProductSchema, ScheduleSchema, TimePeriodSchema, TimeSchema, TimeTypeSchema, TimeZoneSchema, VideoSchema, VideoTypeSchema, WarehouseAddressSchema, WarehouseSchema, WeekDaySchema, WeightUnitSchema };
714
+ export { BaseResponseSchema, ChannelSchema, CompositionIngredientSchema, CompositionProductSchema, CountryCodeSchema, CurrencyCodeSchema, DayScheduleSchema, DeliveryByCourierSchema, DeliveryMethodSchema, GatewayActionTypeSchema, GatewayAddOrderItemRequestSchema, GatewayAddOrderItemResponseSchema, GatewayCompleteOrderRequestSchema, GatewayCompleteOrderResponseSchema, GatewayCreateOrderRequestSchema, GatewayCreateOrderResponseSchema, GatewayDecrementOrderItemQuantityRequestSchema, GatewayDecrementOrderItemQuantityResponseSchema, GatewayGetChannelsRequestSchema, GatewayGetChannelsResponseSchema, GatewayGetDeliveryByCourierStatusRequestSchema, GatewayGetDeliveryByCourierStatusResponseSchema, GatewayGetMenuRequestSchema, GatewayGetMenuResponseSchema, GatewayGetOptionsRequestSchema, GatewayGetOptionsResponseSchema, GatewayGetOrderRequestSchema, GatewayGetOrderResponseSchema, GatewayGetSelfPickupStatusRequestSchema, GatewayGetSelfPickupStatusResponseSchema, GatewayGetTimeSlotsRequestSchema, GatewayGetTimeSlotsResponseSchema, GatewayIncrementOrderItemQuantityRequestSchema, GatewayIncrementOrderItemQuantityResponseSchema, GatewayRequestSchema, GatewayResponseSchema, GatewayUpdateOrderRequestSchema, GatewayUpdateOrderResponseSchema, HeadLinkSchema, HeadScriptSchema, HeadStyleSchema, ImageFormatSchema, ImageSchema, ImageSizeSchema, LinkSchema, LinksSchema, LocaleSchema, LocaleValueSchema, MenuCategorySchema, MenuSchema, NextOpeningSchema, NutritionFactsSchema, OpeningStatusSchema, OptionsSchema, OrderDeliveryAddressSchema, OrderItemChangeSchema, OrderItemSchema, OrderSchema, OrderStatusSchema, OrderWarehouseAddressSchema, PaymentMethodSchema, PaymentMethodTypeSchema, ProductBadgeSchema, ProductCompositionSchema, ProductSchema, ProductVariantSchema, RecommendedProductSchema, ScheduleSchema, SelfPickupSchema, TimePeriodSchema, TimeSchema, TimeTypeSchema, TimeZoneSchema, VideoSchema, VideoTypeSchema, WarehouseAddressSchema, WarehouseSchema, WeekDaySchema, WeightUnitSchema };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nextorders/food-schema",
3
3
  "type": "module",
4
- "version": "0.2.6",
4
+ "version": "0.3.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },