@reactionary/core 0.0.80 → 0.0.82

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.
Files changed (86) hide show
  1. package/decorators/reactionary.decorator.js +2 -2
  2. package/initialization.js +0 -17
  3. package/package.json +1 -1
  4. package/providers/base.provider.js +1 -29
  5. package/providers/cart.provider.js +36 -3
  6. package/providers/inventory.provider.js +3 -2
  7. package/providers/order.provider.js +39 -3
  8. package/providers/price.provider.js +19 -12
  9. package/providers/product.provider.js +34 -11
  10. package/schemas/models/identifiers.model.js +35 -37
  11. package/schemas/models/identity.model.js +5 -5
  12. package/schemas/models/inventory.model.js +7 -5
  13. package/schemas/models/order.model.js +16 -16
  14. package/schemas/models/payment.model.js +10 -10
  15. package/schemas/models/price.model.js +7 -7
  16. package/schemas/models/product-search.model.js +15 -15
  17. package/schemas/models/product.model.js +32 -32
  18. package/schemas/models/profile.model.js +16 -16
  19. package/schemas/models/shipping-method.model.js +19 -19
  20. package/schemas/models/store.model.js +7 -4
  21. package/schemas/mutations/analytics.mutation.js +3 -3
  22. package/schemas/mutations/cart.mutation.js +19 -19
  23. package/schemas/mutations/checkout.mutation.js +10 -10
  24. package/schemas/mutations/profile.mutation.js +2 -2
  25. package/schemas/queries/cart.query.js +1 -1
  26. package/schemas/queries/category.query.js +6 -6
  27. package/schemas/queries/checkout.query.js +3 -3
  28. package/schemas/queries/inventory.query.js +3 -3
  29. package/schemas/queries/order.query.js +1 -1
  30. package/schemas/queries/price.query.js +2 -2
  31. package/schemas/queries/product-search.query.js +1 -1
  32. package/schemas/queries/product.query.js +4 -4
  33. package/schemas/queries/store.query.js +4 -4
  34. package/src/providers/analytics.provider.d.ts +1 -2
  35. package/src/providers/base.provider.d.ts +3 -22
  36. package/src/providers/cart.provider.d.ts +10 -10
  37. package/src/providers/category.provider.d.ts +7 -7
  38. package/src/providers/checkout.provider.d.ts +8 -8
  39. package/src/providers/identity.provider.d.ts +5 -5
  40. package/src/providers/inventory.provider.d.ts +3 -3
  41. package/src/providers/order.provider.d.ts +6 -6
  42. package/src/providers/price.provider.d.ts +5 -5
  43. package/src/providers/product-search.provider.d.ts +2 -2
  44. package/src/providers/product.provider.d.ts +5 -12
  45. package/src/providers/profile.provider.d.ts +3 -3
  46. package/src/providers/store.provider.d.ts +2 -2
  47. package/src/schemas/capabilities.schema.d.ts +2 -1
  48. package/src/schemas/models/analytics.model.d.ts +2 -1
  49. package/src/schemas/models/base.model.d.ts +6 -5
  50. package/src/schemas/models/cart.model.d.ts +53 -52
  51. package/src/schemas/models/category.model.d.ts +7 -6
  52. package/src/schemas/models/checkout.model.d.ts +94 -93
  53. package/src/schemas/models/cost.model.d.ts +33 -32
  54. package/src/schemas/models/currency.model.d.ts +2 -1
  55. package/src/schemas/models/identifiers.model.d.ts +80 -79
  56. package/src/schemas/models/identity.model.d.ts +23 -22
  57. package/src/schemas/models/inventory.model.d.ts +21 -12
  58. package/src/schemas/models/order.model.d.ts +140 -137
  59. package/src/schemas/models/payment.model.d.ts +31 -30
  60. package/src/schemas/models/price.model.d.ts +31 -30
  61. package/src/schemas/models/product-search.model.d.ts +118 -117
  62. package/src/schemas/models/product.model.d.ts +137 -136
  63. package/src/schemas/models/profile.model.d.ts +50 -49
  64. package/src/schemas/models/shipping-method.model.d.ts +42 -41
  65. package/src/schemas/models/store.model.d.ts +9 -8
  66. package/src/schemas/mutations/analytics.mutation.d.ts +48 -47
  67. package/src/schemas/mutations/base.mutation.d.ts +2 -1
  68. package/src/schemas/mutations/cart.mutation.d.ts +73 -72
  69. package/src/schemas/mutations/checkout.mutation.d.ts +96 -95
  70. package/src/schemas/mutations/identity.mutation.d.ts +4 -3
  71. package/src/schemas/mutations/profile.mutation.d.ts +4 -3
  72. package/src/schemas/queries/base.query.d.ts +2 -1
  73. package/src/schemas/queries/cart.query.d.ts +7 -7
  74. package/src/schemas/queries/category.query.d.ts +20 -19
  75. package/src/schemas/queries/checkout.query.d.ts +7 -6
  76. package/src/schemas/queries/identity.query.d.ts +2 -1
  77. package/src/schemas/queries/inventory.query.d.ts +8 -7
  78. package/src/schemas/queries/order.query.d.ts +3 -2
  79. package/src/schemas/queries/price.query.d.ts +5 -4
  80. package/src/schemas/queries/product-search.query.d.ts +12 -11
  81. package/src/schemas/queries/product.query.d.ts +14 -13
  82. package/src/schemas/queries/profile.query.d.ts +2 -1
  83. package/src/schemas/queries/store.query.d.ts +6 -5
  84. package/src/schemas/session.schema.d.ts +1 -1
  85. package/src/zod-utils.d.ts +5 -0
  86. package/zod-utils.js +0 -0
@@ -2,53 +2,53 @@ import { z } from "zod";
2
2
  import { CategoryIdentifierSchema, ProductAttributeIdentifierSchema, ProductAttributeValueIdentifierSchema, ProductIdentifierSchema, ProductOptionIdentifierSchema, ProductOptionValueIdentifierSchema, ProductVariantIdentifierSchema } from "./identifiers.model.js";
3
3
  import { BaseModelSchema, ImageSchema } from "./base.model.js";
4
4
  const ProductOptionValueSchema = z.looseObject({
5
- identifier: ProductOptionValueIdentifierSchema.default(() => ProductOptionValueIdentifierSchema.parse({})).describe("The unique identifier for the product option value."),
5
+ identifier: ProductOptionValueIdentifierSchema.describe("The unique identifier for the product option value."),
6
6
  label: z.string().describe("The human-friendly label for the product option value.")
7
7
  });
8
8
  const ProductOptionSchema = z.looseObject({
9
- identifier: ProductOptionIdentifierSchema.default(() => ProductOptionIdentifierSchema.parse({})).describe("The unique identifier for the option."),
9
+ identifier: ProductOptionIdentifierSchema.describe("The unique identifier for the option."),
10
10
  name: z.string().describe("The name of the option, e.g., Size or Color."),
11
- values: z.array(ProductOptionValueSchema).default(() => []).describe("A list of possible values for the option.")
11
+ values: z.array(ProductOptionValueSchema).describe("A list of possible values for the option.")
12
12
  });
13
13
  const ProductVariantOptionSchema = z.looseObject({
14
- identifier: ProductOptionIdentifierSchema.default(() => ProductOptionIdentifierSchema.parse({})).describe("The unique identifier for the option."),
14
+ identifier: ProductOptionIdentifierSchema.describe("The unique identifier for the option."),
15
15
  name: z.string().describe("The name of the option, e.g., Size or Color."),
16
- value: ProductOptionValueSchema.default(() => ProductOptionValueSchema.parse({})).describe("The unique identifier for the option value.")
16
+ value: ProductOptionValueSchema.describe("The unique identifier for the option value.")
17
17
  });
18
18
  const ProductVariantSchema = z.looseObject({
19
- identifier: ProductVariantIdentifierSchema.default(() => ProductVariantIdentifierSchema.parse({})).describe("The unique identifier for the variant. Often its SKU"),
20
- name: z.string().default(""),
21
- images: z.array(ImageSchema).default(() => []).describe("A list of images associated with the product variant"),
22
- ean: z.string().default("").describe("The European Article Number identifier for the product variant"),
23
- gtin: z.string().default("").describe("The Global Trade Item Number identifier for the product variant"),
24
- upc: z.string().default("").describe("The Universal Product Code identifier for the product variant"),
25
- barcode: z.string().default("").describe("The barcode identifier for the product variant"),
26
- options: z.array(ProductVariantOptionSchema).default(() => []).describe("A list of option identifiers that define this variant")
19
+ identifier: ProductVariantIdentifierSchema.describe("The unique identifier for the variant. Often its SKU"),
20
+ name: z.string(),
21
+ images: z.array(ImageSchema).describe("A list of images associated with the product variant"),
22
+ ean: z.string().describe("The European Article Number identifier for the product variant"),
23
+ gtin: z.string().describe("The Global Trade Item Number identifier for the product variant"),
24
+ upc: z.string().describe("The Universal Product Code identifier for the product variant"),
25
+ barcode: z.string().describe("The barcode identifier for the product variant"),
26
+ options: z.array(ProductVariantOptionSchema).describe("A list of option identifiers that define this variant")
27
27
  });
28
28
  const ProductAttributeValueSchema = z.looseObject({
29
- identifier: ProductAttributeValueIdentifierSchema.default(() => ProductAttributeValueIdentifierSchema.parse({})).describe("The unique identifier for the attribute value."),
30
- value: z.string().default("").describe("The value of the attribute. Typically a language independent string"),
31
- label: z.string().default("").describe("The human friendly label for the attribute value. Typically a language dependent string")
29
+ identifier: ProductAttributeValueIdentifierSchema.describe("The unique identifier for the attribute value."),
30
+ value: z.string().describe("The value of the attribute. Typically a language independent string"),
31
+ label: z.string().describe("The human friendly label for the attribute value. Typically a language dependent string")
32
32
  });
33
33
  const ProductAttributeSchema = z.looseObject({
34
- identifier: ProductAttributeIdentifierSchema.default(() => ProductAttributeIdentifierSchema.parse({})).describe("The unique identifier for the attribute, also typically used as the facet key if the attribute is filterable."),
35
- group: z.string().default(""),
36
- name: z.string().default(""),
37
- values: z.array(ProductAttributeValueSchema).default(() => [])
34
+ identifier: ProductAttributeIdentifierSchema.describe("The unique identifier for the attribute, also typically used as the facet key if the attribute is filterable."),
35
+ group: z.string(),
36
+ name: z.string(),
37
+ values: z.array(ProductAttributeValueSchema)
38
38
  });
39
39
  const ProductSchema = BaseModelSchema.extend({
40
- identifier: ProductIdentifierSchema.default(() => ProductIdentifierSchema.parse({})),
41
- name: z.string().default("").describe("The name of the product"),
42
- slug: z.string().default("").describe("The URL-friendly identifier for the product"),
43
- description: z.string().default("").describe("A brief description of the product"),
44
- longDescription: z.string().default("").describe("A detailed description of the product"),
45
- brand: z.string().default("").describe("The brand associated with the product"),
46
- manufacturer: z.string().default("").describe("The manufacturer of the product"),
47
- parentCategories: z.array(CategoryIdentifierSchema).default(() => []).describe("A list of parent categories the product belongs to"),
48
- published: z.boolean().default(false).describe("Indicates whether the product is published and visible to customers"),
49
- sharedAttributes: z.array(ProductAttributeSchema).default(() => []).describe("A list of technical attributes associated with the product"),
50
- options: z.array(ProductOptionSchema).default(() => []).describe("A list of options available for the product, such as size or color. Can be empty if product is single-sku"),
51
- mainVariant: ProductVariantSchema.default(() => ProductVariantSchema.parse({})).describe("The primary SKU for the product")
40
+ identifier: ProductIdentifierSchema,
41
+ name: z.string().describe("The name of the product"),
42
+ slug: z.string().describe("The URL-friendly identifier for the product"),
43
+ description: z.string().describe("A brief description of the product"),
44
+ longDescription: z.string().describe("A detailed description of the product"),
45
+ brand: z.string().describe("The brand associated with the product"),
46
+ manufacturer: z.string().describe("The manufacturer of the product"),
47
+ parentCategories: z.array(CategoryIdentifierSchema).describe("A list of parent categories the product belongs to"),
48
+ published: z.boolean().describe("Indicates whether the product is published and visible to customers"),
49
+ sharedAttributes: z.array(ProductAttributeSchema).describe("A list of technical attributes associated with the product"),
50
+ options: z.array(ProductOptionSchema).describe("A list of options available for the product, such as size or color. Can be empty if product is single-sku"),
51
+ mainVariant: ProductVariantSchema.describe("The primary SKU for the product")
52
52
  }).describe("A product is a wrapper around sellable items. It contains all the shared information for a set of SKUs. All products have at least one SKU, but can potentially have hundreds.");
53
53
  export {
54
54
  ProductAttributeSchema,
@@ -3,26 +3,26 @@ import { AddressIdentifierSchema, IdentityIdentifierSchema } from "./identifiers
3
3
  import { BaseModelSchema } from "./base.model.js";
4
4
  const AddressSchema = BaseModelSchema.extend({
5
5
  identifier: AddressIdentifierSchema.default(() => AddressIdentifierSchema.parse({})),
6
- firstName: z.string().default(""),
7
- lastName: z.string().default(""),
8
- streetAddress: z.string().default(""),
9
- streetNumber: z.string().default(""),
10
- city: z.string().default(""),
11
- region: z.string().default(""),
12
- postalCode: z.string().default(""),
13
- countryCode: z.string().default("US")
6
+ firstName: z.string(),
7
+ lastName: z.string(),
8
+ streetAddress: z.string(),
9
+ streetNumber: z.string(),
10
+ city: z.string(),
11
+ region: z.string(),
12
+ postalCode: z.string(),
13
+ countryCode: z.string()
14
14
  });
15
15
  const ProfileSchema = BaseModelSchema.extend({
16
- identifier: IdentityIdentifierSchema.default(() => IdentityIdentifierSchema.parse({})),
17
- email: z.string().email().default(""),
18
- phone: z.string().default(""),
19
- emailVerified: z.boolean().default(false),
20
- phoneVerified: z.boolean().default(false),
21
- createdAt: z.string().default(() => (/* @__PURE__ */ new Date()).toISOString()),
22
- updatedAt: z.string().default(() => (/* @__PURE__ */ new Date()).toISOString()),
16
+ identifier: IdentityIdentifierSchema,
17
+ email: z.email(),
18
+ phone: z.string(),
19
+ emailVerified: z.boolean(),
20
+ phoneVerified: z.boolean(),
21
+ createdAt: z.string(),
22
+ updatedAt: z.string(),
23
23
  shippingAddress: AddressSchema.optional(),
24
24
  billingAddress: AddressSchema.optional(),
25
- alternateShippingAddresses: z.array(AddressSchema).default(() => [])
25
+ alternateShippingAddresses: z.array(AddressSchema)
26
26
  });
27
27
  export {
28
28
  AddressSchema,
@@ -5,30 +5,30 @@ import { BaseModelSchema, ImageSchema } from "./base.model.js";
5
5
  import { AddressSchema } from "./profile.model.js";
6
6
  const PickupPointSchema = z.looseObject({
7
7
  identifier: z.object({
8
- key: z.string().default("").nonoptional()
9
- }).default(() => ({ key: "" })),
10
- name: z.string().default(""),
11
- description: z.string().default(""),
12
- address: AddressSchema.default(() => AddressSchema.parse({})),
13
- openingHours: z.string().default("").optional().describe('The opening hours of the pickup point, if applicable. This could be a string like "Mon-Fri 9am-5pm".'),
14
- contactPhone: z.string().default("").optional().describe("The contact phone number for the pickup point, if applicable."),
15
- contactEmail: z.string().default("").optional().describe("The contact email for the pickup point, if applicable."),
16
- instructions: z.string().default("").optional().describe("Any special instructions for picking up from this point.")
8
+ key: z.string()
9
+ }),
10
+ name: z.string(),
11
+ description: z.string(),
12
+ address: AddressSchema,
13
+ openingHours: z.string().optional().describe('The opening hours of the pickup point, if applicable. This could be a string like "Mon-Fri 9am-5pm".'),
14
+ contactPhone: z.string().optional().describe("The contact phone number for the pickup point, if applicable."),
15
+ contactEmail: z.string().optional().describe("The contact email for the pickup point, if applicable."),
16
+ instructions: z.string().optional().describe("Any special instructions for picking up from this point.")
17
17
  });
18
18
  const ShippingMethodSchema = z.looseObject({
19
- identifier: ShippingMethodIdentifierSchema.default(() => ShippingMethodIdentifierSchema.parse({})),
20
- name: z.string().default(""),
21
- description: z.string().default(""),
19
+ identifier: ShippingMethodIdentifierSchema,
20
+ name: z.string(),
21
+ description: z.string(),
22
22
  logo: ImageSchema.optional(),
23
- price: MonetaryAmountSchema.default(() => MonetaryAmountSchema.parse({})),
24
- deliveryTime: z.string().default(""),
25
- carrier: z.string().default("").optional()
23
+ price: MonetaryAmountSchema,
24
+ deliveryTime: z.string(),
25
+ carrier: z.string().optional()
26
26
  });
27
27
  const ShippingInstructionSchema = BaseModelSchema.extend({
28
- shippingMethod: ShippingMethodIdentifierSchema.default(() => ShippingMethodIdentifierSchema.parse({})),
29
- pickupPoint: z.string().default("").describe("An optional pickup point for the shipping method. This could be a physical store, a locker, or similar. If not set, it means home delivery to the shipping address."),
30
- instructions: z.string().default("").describe("Optional instructions for the shipping. This could be delivery instructions, or similar."),
31
- consentForUnattendedDelivery: z.boolean().default(false).describe("Indicates if the customer has given consent for unattended delivery, if applicable.")
28
+ shippingMethod: ShippingMethodIdentifierSchema,
29
+ pickupPoint: z.string().describe("An optional pickup point for the shipping method. This could be a physical store, a locker, or similar. If not set, it means home delivery to the shipping address."),
30
+ instructions: z.string().describe("Optional instructions for the shipping. This could be delivery instructions, or similar."),
31
+ consentForUnattendedDelivery: z.boolean().describe("Indicates if the customer has given consent for unattended delivery, if applicable.")
32
32
  });
33
33
  export {
34
34
  PickupPointSchema,
@@ -1,10 +1,13 @@
1
1
  import { z } from "zod";
2
2
  import { BaseModelSchema } from "./base.model.js";
3
- import { FulfillmentCenterIdentifierSchema, StoreIdentifierSchema } from "./identifiers.model.js";
3
+ import {
4
+ FulfillmentCenterIdentifierSchema,
5
+ StoreIdentifierSchema
6
+ } from "./identifiers.model.js";
4
7
  const StoreSchema = BaseModelSchema.extend({
5
- identifier: StoreIdentifierSchema.default(() => StoreIdentifierSchema.parse({})),
6
- name: z.string().default(""),
7
- fulfillmentCenter: FulfillmentCenterIdentifierSchema.default(() => FulfillmentCenterIdentifierSchema.parse({}))
8
+ identifier: StoreIdentifierSchema,
9
+ name: z.string(),
10
+ fulfillmentCenter: FulfillmentCenterIdentifierSchema
8
11
  });
9
12
  export {
10
13
  StoreSchema
@@ -3,13 +3,13 @@ import { BaseMutationSchema } from "./base.mutation.js";
3
3
  import { ProductIdentifierSchema, ProductSearchIdentifierSchema } from "../models/identifiers.model.js";
4
4
  const AnalyticsMutationSearchEventSchema = BaseMutationSchema.extend({
5
5
  mutation: z.literal("search"),
6
- search: ProductSearchIdentifierSchema.required(),
6
+ search: ProductSearchIdentifierSchema,
7
7
  products: z.array(ProductIdentifierSchema)
8
8
  });
9
9
  const AnalyticsMutationSearchProductClickEventSchema = BaseMutationSchema.extend({
10
10
  mutation: z.literal("product-search-click"),
11
- search: ProductSearchIdentifierSchema.required(),
12
- product: ProductIdentifierSchema.required(),
11
+ search: ProductSearchIdentifierSchema,
12
+ product: ProductIdentifierSchema,
13
13
  position: z.number().min(0)
14
14
  });
15
15
  const AnalyticsMutationSchema = z.union([AnalyticsMutationSearchEventSchema, AnalyticsMutationSearchProductClickEventSchema]);
@@ -5,55 +5,55 @@ import { AddressSchema } from "../models/profile.model.js";
5
5
  import { CurrencySchema } from "../models/currency.model.js";
6
6
  import { MonetaryAmountSchema } from "../models/price.model.js";
7
7
  const CartMutationItemAddSchema = BaseMutationSchema.extend({
8
- cart: CartIdentifierSchema.nonoptional(),
9
- variant: ProductVariantIdentifierSchema.nonoptional(),
8
+ cart: CartIdentifierSchema,
9
+ variant: ProductVariantIdentifierSchema,
10
10
  quantity: z.number()
11
11
  });
12
12
  const CartMutationItemRemoveSchema = BaseMutationSchema.extend({
13
- cart: CartIdentifierSchema.nonoptional(),
14
- item: CartItemIdentifierSchema.nonoptional()
13
+ cart: CartIdentifierSchema,
14
+ item: CartItemIdentifierSchema
15
15
  });
16
16
  const CartMutationItemQuantityChangeSchema = BaseMutationSchema.extend({
17
- cart: CartIdentifierSchema.nonoptional(),
18
- item: CartItemIdentifierSchema.nonoptional(),
17
+ cart: CartIdentifierSchema,
18
+ item: CartItemIdentifierSchema,
19
19
  quantity: z.number()
20
20
  });
21
21
  const CartMutationDeleteCartSchema = BaseMutationSchema.extend({
22
- cart: CartIdentifierSchema.required()
22
+ cart: CartIdentifierSchema
23
23
  });
24
24
  const CartMutationSetShippingInfoSchema = BaseMutationSchema.extend({
25
- cart: CartIdentifierSchema.required(),
25
+ cart: CartIdentifierSchema,
26
26
  shippingMethod: ShippingMethodIdentifierSchema.optional(),
27
27
  shippingAddress: AddressSchema.optional()
28
28
  });
29
29
  const CartMutationSetBillingAddressSchema = BaseMutationSchema.extend({
30
- cart: CartIdentifierSchema.required(),
31
- billingAddress: AddressSchema.required(),
30
+ cart: CartIdentifierSchema,
31
+ billingAddress: AddressSchema,
32
32
  notificationEmailAddress: z.string().optional(),
33
33
  notificationPhoneNumber: z.string().optional()
34
34
  });
35
35
  const CartMutationApplyCouponSchema = BaseMutationSchema.extend({
36
- cart: CartIdentifierSchema.required(),
37
- couponCode: z.string().default("").nonoptional()
36
+ cart: CartIdentifierSchema,
37
+ couponCode: z.string()
38
38
  });
39
39
  const CartMutationRemoveCouponSchema = BaseMutationSchema.extend({
40
- cart: CartIdentifierSchema.required(),
41
- couponCode: z.string().default("").nonoptional()
40
+ cart: CartIdentifierSchema,
41
+ couponCode: z.string()
42
42
  });
43
43
  const CartMutationCheckoutSchema = BaseMutationSchema.extend({
44
- cart: CartIdentifierSchema.required()
44
+ cart: CartIdentifierSchema
45
45
  });
46
46
  const CartMutationAddPaymentMethodSchema = BaseMutationSchema.extend({
47
- cart: CartIdentifierSchema.required(),
48
- paymentMethodId: PaymentMethodIdentifierSchema.required(),
47
+ cart: CartIdentifierSchema,
48
+ paymentMethodId: PaymentMethodIdentifierSchema,
49
49
  amount: MonetaryAmountSchema.optional().describe("The amount to authorize for the payment method. If not provided, the full remaining balance of the cart will be authorized.")
50
50
  });
51
51
  const CartMutationRemovePaymentMethodSchema = BaseMutationSchema.extend({
52
- cart: CartIdentifierSchema.required()
52
+ cart: CartIdentifierSchema
53
53
  });
54
54
  const CartMutationChangeCurrencySchema = BaseMutationSchema.extend({
55
55
  cart: CartIdentifierSchema.required(),
56
- newCurrency: CurrencySchema.default(() => CurrencySchema.parse({})).describe("The new currency to set for the cart.")
56
+ newCurrency: CurrencySchema.describe("The new currency to set for the cart.")
57
57
  });
58
58
  export {
59
59
  CartMutationAddPaymentMethodSchema,
@@ -2,29 +2,29 @@ import { z } from "zod";
2
2
  import { CartIdentifierSchema, AddressSchema, PaymentInstructionIdentifierSchema, PaymentInstructionSchema, ShippingInstructionSchema, CartSchema } from "../models/index.js";
3
3
  import { BaseMutationSchema } from "./base.mutation.js";
4
4
  const CheckoutMutationInitiateCheckoutSchema = BaseMutationSchema.extend({
5
- cart: CartSchema.required(),
5
+ cart: CartSchema,
6
6
  billingAddress: AddressSchema.omit({ identifier: true, meta: true }).optional(),
7
7
  notificationEmail: z.string().optional(),
8
8
  notificationPhone: z.string().optional()
9
9
  });
10
10
  const CheckoutMutationSetShippingAddressSchema = BaseMutationSchema.extend({
11
- checkout: CartIdentifierSchema.required(),
12
- shippingAddress: AddressSchema.omit({ identifier: true, meta: true }).required()
11
+ checkout: CartIdentifierSchema,
12
+ shippingAddress: AddressSchema.omit({ identifier: true, meta: true })
13
13
  });
14
14
  const CheckoutMutationFinalizeCheckoutSchema = BaseMutationSchema.extend({
15
- checkout: CartIdentifierSchema.required()
15
+ checkout: CartIdentifierSchema
16
16
  });
17
17
  const CheckoutMutationAddPaymentInstructionSchema = BaseMutationSchema.extend({
18
- paymentInstruction: PaymentInstructionSchema.omit({ meta: true, status: true, identifier: true }).required(),
19
- checkout: CartIdentifierSchema.required()
18
+ paymentInstruction: PaymentInstructionSchema.omit({ meta: true, status: true, identifier: true }),
19
+ checkout: CartIdentifierSchema
20
20
  });
21
21
  const CheckoutMutationRemovePaymentInstructionSchema = BaseMutationSchema.extend({
22
- paymentInstruction: PaymentInstructionIdentifierSchema.required(),
23
- checkout: CartIdentifierSchema.required()
22
+ paymentInstruction: PaymentInstructionIdentifierSchema,
23
+ checkout: CartIdentifierSchema
24
24
  });
25
25
  const CheckoutMutationSetShippingInstructionSchema = BaseMutationSchema.extend({
26
- shippingInstruction: ShippingInstructionSchema.omit({ meta: true }).required(),
27
- checkout: CartIdentifierSchema.required()
26
+ shippingInstruction: ShippingInstructionSchema.omit({ meta: true }),
27
+ checkout: CartIdentifierSchema
28
28
  });
29
29
  export {
30
30
  CheckoutMutationAddPaymentInstructionSchema,
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { BaseMutationSchema } from "./base.mutation.js";
3
3
  const ProfileMutationUpdateSchema = BaseMutationSchema.extend({
4
- email: z.email().default("base@example.com"),
5
- phone: z.string().default("")
4
+ email: z.email(),
5
+ phone: z.string()
6
6
  });
7
7
  export {
8
8
  ProfileMutationUpdateSchema
@@ -1,7 +1,7 @@
1
1
  import { BaseQuerySchema } from "./base.query.js";
2
2
  import { CartIdentifierSchema } from "../models/identifiers.model.js";
3
3
  const CartQueryByIdSchema = BaseQuerySchema.extend({
4
- cart: CartIdentifierSchema.required()
4
+ cart: CartIdentifierSchema
5
5
  });
6
6
  export {
7
7
  CartQueryByIdSchema
@@ -3,20 +3,20 @@ import { CategoryIdentifierSchema } from "../models/identifiers.model.js";
3
3
  import { BaseQuerySchema } from "./base.query.js";
4
4
  import { PaginationOptionsSchema } from "../models/base.model.js";
5
5
  const CategoryQueryByIdSchema = BaseQuerySchema.extend({
6
- id: CategoryIdentifierSchema.default(() => CategoryIdentifierSchema.parse({}))
6
+ id: CategoryIdentifierSchema
7
7
  });
8
8
  const CategoryQueryBySlugSchema = BaseQuerySchema.extend({
9
- slug: z.string().default("")
9
+ slug: z.string()
10
10
  });
11
11
  const CategoryQueryForBreadcrumbSchema = BaseQuerySchema.extend({
12
- id: CategoryIdentifierSchema.default(() => CategoryIdentifierSchema.parse({}))
12
+ id: CategoryIdentifierSchema
13
13
  });
14
14
  const CategoryQueryForChildCategoriesSchema = BaseQuerySchema.extend({
15
- parentId: CategoryIdentifierSchema.default(() => CategoryIdentifierSchema.parse({})),
16
- paginationOptions: PaginationOptionsSchema.default(() => PaginationOptionsSchema.parse({}))
15
+ parentId: CategoryIdentifierSchema,
16
+ paginationOptions: PaginationOptionsSchema
17
17
  });
18
18
  const CategoryQueryForTopCategoriesSchema = BaseQuerySchema.extend({
19
- paginationOptions: PaginationOptionsSchema.default(() => PaginationOptionsSchema.parse({}))
19
+ paginationOptions: PaginationOptionsSchema
20
20
  });
21
21
  export {
22
22
  CategoryQueryByIdSchema,
@@ -1,13 +1,13 @@
1
1
  import { BaseQuerySchema } from "./base.query.js";
2
2
  import { CheckoutIdentifierSchema } from "../models/identifiers.model.js";
3
3
  const CheckoutQueryByIdSchema = BaseQuerySchema.extend({
4
- identifier: CheckoutIdentifierSchema.required()
4
+ identifier: CheckoutIdentifierSchema
5
5
  });
6
6
  const CheckoutQueryForAvailableShippingMethodsSchema = BaseQuerySchema.extend({
7
- checkout: CheckoutIdentifierSchema.required()
7
+ checkout: CheckoutIdentifierSchema
8
8
  });
9
9
  const CheckoutQueryForAvailablePaymentMethodsSchema = BaseQuerySchema.extend({
10
- checkout: CheckoutIdentifierSchema.required()
10
+ checkout: CheckoutIdentifierSchema
11
11
  });
12
12
  export {
13
13
  CheckoutQueryByIdSchema,
@@ -1,8 +1,8 @@
1
1
  import { BaseQuerySchema } from "./base.query.js";
2
- import { FulfillmentCenterIdentifierSchema, ProductIdentifierSchema, ProductVariantIdentifierSchema } from "../models/identifiers.model.js";
2
+ import { FulfillmentCenterIdentifierSchema, ProductVariantIdentifierSchema } from "../models/identifiers.model.js";
3
3
  const InventoryQueryBySKUSchema = BaseQuerySchema.extend({
4
- variant: ProductVariantIdentifierSchema.default(() => ProductVariantIdentifierSchema.parse({})).describe("The unique identifier for the product variant (SKU)."),
5
- fulfilmentCenter: FulfillmentCenterIdentifierSchema.default(() => FulfillmentCenterIdentifierSchema.parse({})).nonoptional()
4
+ variant: ProductVariantIdentifierSchema.describe("The unique identifier for the product variant (SKU)."),
5
+ fulfilmentCenter: FulfillmentCenterIdentifierSchema
6
6
  });
7
7
  export {
8
8
  InventoryQueryBySKUSchema
@@ -1,7 +1,7 @@
1
1
  import { BaseQuerySchema } from "./base.query.js";
2
2
  import { OrderIdentifierSchema } from "../models/identifiers.model.js";
3
3
  const OrderQueryByIdSchema = BaseQuerySchema.extend({
4
- order: OrderIdentifierSchema.required()
4
+ order: OrderIdentifierSchema
5
5
  });
6
6
  export {
7
7
  OrderQueryByIdSchema
@@ -1,10 +1,10 @@
1
1
  import { BaseQuerySchema } from "./base.query.js";
2
2
  import { ProductVariantIdentifierSchema } from "../models/identifiers.model.js";
3
3
  const ListPriceQuerySchema = BaseQuerySchema.extend({
4
- variant: ProductVariantIdentifierSchema.required()
4
+ variant: ProductVariantIdentifierSchema
5
5
  });
6
6
  const CustomerPriceQuerySchema = BaseQuerySchema.extend({
7
- variant: ProductVariantIdentifierSchema.required()
7
+ variant: ProductVariantIdentifierSchema
8
8
  });
9
9
  export {
10
10
  CustomerPriceQuerySchema,
@@ -1,7 +1,7 @@
1
1
  import { BaseQuerySchema } from "./base.query.js";
2
2
  import { ProductSearchIdentifierSchema } from "../models/identifiers.model.js";
3
3
  const ProductSearchQueryByTermSchema = BaseQuerySchema.extend({
4
- search: ProductSearchIdentifierSchema.required()
4
+ search: ProductSearchIdentifierSchema
5
5
  });
6
6
  export {
7
7
  ProductSearchQueryByTermSchema
@@ -5,14 +5,14 @@ const ProductQueryBySlugSchema = BaseQuerySchema.extend({
5
5
  slug: z.string()
6
6
  });
7
7
  const ProductQueryByIdSchema = BaseQuerySchema.extend({
8
- identifier: ProductIdentifierSchema.required()
8
+ identifier: ProductIdentifierSchema
9
9
  });
10
10
  const ProductQueryBySKUSchema = BaseQuerySchema.extend({
11
- variant: ProductVariantIdentifierSchema.default(() => ProductVariantIdentifierSchema.parse({}))
11
+ variant: ProductVariantIdentifierSchema
12
12
  });
13
13
  const ProductQueryVariantsSchema = BaseQuerySchema.extend({
14
- parentId: ProductIdentifierSchema.default(() => ProductIdentifierSchema.parse({})),
15
- paginationOptions: PaginationOptionsSchema.default(() => PaginationOptionsSchema.parse({}))
14
+ parentId: ProductIdentifierSchema,
15
+ paginationOptions: PaginationOptionsSchema
16
16
  });
17
17
  export {
18
18
  ProductQueryByIdSchema,
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
2
  import { BaseQuerySchema } from "./base.query.js";
3
3
  const StoreQueryByProximitySchema = BaseQuerySchema.extend({
4
- longitude: z.number().default(0),
5
- latitude: z.number().default(0),
6
- distance: z.number().default(0),
7
- limit: z.number().default(10)
4
+ longitude: z.number(),
5
+ latitude: z.number(),
6
+ distance: z.number(),
7
+ limit: z.number()
8
8
  });
9
9
  export {
10
10
  StoreQueryByProximitySchema
@@ -1,5 +1,4 @@
1
- import type { AnalyticsEvent } from '../schemas/models/analytics.model.js';
2
1
  import { BaseProvider } from './base.provider.js';
3
- export declare abstract class AnalyticsProvider<T extends AnalyticsEvent = AnalyticsEvent> extends BaseProvider<T> {
2
+ export declare abstract class AnalyticsProvider extends BaseProvider {
4
3
  protected getResourceName(): string;
5
4
  }
@@ -1,6 +1,3 @@
1
- import type { z } from 'zod';
2
- import type { BaseModel } from '../schemas/models/base.model.js';
3
- import { createPaginatedResponseSchema } from '../schemas/models/base.model.js';
4
1
  import type { Cache } from '../cache/cache.interface.js';
5
2
  import { type RequestContext } from '../schemas/session.schema.js';
6
3
  import type { IdentifierType } from '../schemas/models/identifiers.model.js';
@@ -8,29 +5,13 @@ import type { IdentifierType } from '../schemas/models/identifiers.model.js';
8
5
  * Base capability provider, responsible for mutations (changes) and queries (fetches)
9
6
  * for a given business object domain.
10
7
  */
11
- export declare abstract class BaseProvider<T extends BaseModel = BaseModel> {
12
- readonly schema: z.ZodType<T>;
8
+ export declare abstract class BaseProvider {
13
9
  protected cache: Cache;
14
10
  protected context: RequestContext;
15
- constructor(schema: z.ZodType<T>, cache: Cache, context: RequestContext);
16
- /**
17
- * Validates that the final domain model constructed by the provider
18
- * fulfills the schema as defined. This will throw an exception.
19
- */
20
- protected assert(value: T): T;
21
- /**
22
- * Creates a new model entity based on the schema defaults.
23
- */
24
- protected newModel(): T;
25
- /**
26
- * Handler for parsing a response from a remote provider and converting it
27
- * into the typed domain model.
28
- */
29
- protected parseSingle(_body: unknown): T;
30
- protected parsePaginatedResult(_body: unknown): z.infer<ReturnType<typeof createPaginatedResponseSchema<typeof this.schema>>>;
11
+ constructor(cache: Cache, context: RequestContext);
31
12
  generateDependencyIdsForModel(model: unknown): Array<string>;
32
13
  protected generateCacheKeyForQuery(scope: string, query: object): string;
33
- protected generateCacheKeyPaginatedResult(resultSetName: string, res: ReturnType<typeof this.parsePaginatedResult>): string;
14
+ protected generateCacheKeyPaginatedResult(resultSetName: string, res: any): string;
34
15
  protected generateCacheKeySingle(identifier: IdentifierType): string;
35
16
  /**
36
17
  * Returns the abstract resource name provided by the remote system.
@@ -3,7 +3,7 @@ import type { CartIdentifier } from "../schemas/models/identifiers.model.js";
3
3
  import type { CartMutationApplyCoupon, CartMutationChangeCurrency, CartMutationDeleteCart, CartMutationItemAdd, CartMutationItemQuantityChange, CartMutationItemRemove, CartMutationRemoveCoupon } from "../schemas/mutations/cart.mutation.js";
4
4
  import type { CartQueryById } from "../schemas/queries/cart.query.js";
5
5
  import { BaseProvider } from "./base.provider.js";
6
- export declare abstract class CartProvider<T extends Cart = Cart> extends BaseProvider<T> {
6
+ export declare abstract class CartProvider extends BaseProvider {
7
7
  /**
8
8
  * Get cart by ID.
9
9
  *
@@ -11,7 +11,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
11
11
  * @param payload
12
12
  * @param session
13
13
  */
14
- abstract getById(payload: CartQueryById): Promise<T>;
14
+ abstract getById(payload: CartQueryById): Promise<Cart>;
15
15
  /**
16
16
  * Get the active cart id for the user.
17
17
  *
@@ -28,7 +28,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
28
28
  * @param payload
29
29
  * @param session
30
30
  */
31
- abstract add(payload: CartMutationItemAdd): Promise<T>;
31
+ abstract add(payload: CartMutationItemAdd): Promise<Cart>;
32
32
  /**
33
33
  * Remove item from cart. If the cart is empty after removal, delete the cart. Returns the updated and recalculated cart.
34
34
  *
@@ -36,7 +36,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
36
36
  * @param payload
37
37
  * @param session
38
38
  */
39
- abstract remove(payload: CartMutationItemRemove): Promise<T>;
39
+ abstract remove(payload: CartMutationItemRemove): Promise<Cart>;
40
40
  /**
41
41
  * Change quantity of item in cart. If the cart is empty after change, delete the cart. Returns the updated and recalculated cart.
42
42
  * Changing quantity to 0 is not allowed. Use the remove call instead. This is done to avoid accidental removal of item.
@@ -46,7 +46,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
46
46
  * @param payload
47
47
  * @param session
48
48
  */
49
- abstract changeQuantity(payload: CartMutationItemQuantityChange): Promise<T>;
49
+ abstract changeQuantity(payload: CartMutationItemQuantityChange): Promise<Cart>;
50
50
  /**
51
51
  * Deletes the entire cart.
52
52
  *
@@ -54,7 +54,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
54
54
  * @param payload
55
55
  * @param session
56
56
  */
57
- abstract deleteCart(payload: CartMutationDeleteCart): Promise<T>;
57
+ abstract deleteCart(payload: CartMutationDeleteCart): Promise<Cart>;
58
58
  /**
59
59
  * Applies a coupon code to the cart. Returns the updated and recalculated cart.
60
60
  *
@@ -62,7 +62,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
62
62
  * @param payload
63
63
  * @param session
64
64
  */
65
- abstract applyCouponCode(payload: CartMutationApplyCoupon): Promise<T>;
65
+ abstract applyCouponCode(payload: CartMutationApplyCoupon): Promise<Cart>;
66
66
  /**
67
67
  * Removes a coupon code from the cart. Returns the updated and recalculated cart.
68
68
  *
@@ -70,7 +70,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
70
70
  * @param payload
71
71
  * @param session
72
72
  */
73
- abstract removeCouponCode(payload: CartMutationRemoveCoupon): Promise<T>;
73
+ abstract removeCouponCode(payload: CartMutationRemoveCoupon): Promise<Cart>;
74
74
  /**
75
75
  * Changes the currency of the cart.
76
76
  *
@@ -78,7 +78,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
78
78
  * @param newCurrency
79
79
  * @param session
80
80
  */
81
- abstract changeCurrency(payload: CartMutationChangeCurrency): Promise<T>;
82
- protected createEmptyCart(): T;
81
+ abstract changeCurrency(payload: CartMutationChangeCurrency): Promise<Cart>;
82
+ protected createEmptyCart(): Cart;
83
83
  protected getResourceName(): string;
84
84
  }