@reactionary/core 0.0.33 → 0.0.35

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 (45) hide show
  1. package/cache/cache-evaluation.interface.js +0 -0
  2. package/cache/cache.interface.js +0 -0
  3. package/cache/noop-cache.js +27 -0
  4. package/cache/redis-cache.js +60 -0
  5. package/client/client-builder.js +44 -0
  6. package/client/client.js +29 -0
  7. package/decorators/trpc.decorators.js +66 -0
  8. package/index.js +40 -764
  9. package/package.json +3 -3
  10. package/providers/analytics.provider.js +6 -0
  11. package/providers/base.provider.js +30 -0
  12. package/providers/cart.provider.js +6 -0
  13. package/providers/identity.provider.js +6 -0
  14. package/providers/inventory.provider.js +6 -0
  15. package/providers/price.provider.js +6 -0
  16. package/providers/product.provider.js +6 -0
  17. package/providers/search.provider.js +6 -0
  18. package/schemas/capabilities.schema.js +13 -0
  19. package/schemas/models/analytics.model.js +5 -0
  20. package/schemas/models/base.model.js +17 -0
  21. package/schemas/models/cart.model.js +16 -0
  22. package/schemas/models/currency.model.js +187 -0
  23. package/schemas/models/identifiers.model.js +39 -0
  24. package/schemas/models/identity.model.js +14 -0
  25. package/schemas/models/inventory.model.js +8 -0
  26. package/schemas/models/price.model.js +16 -0
  27. package/schemas/models/product.model.js +26 -0
  28. package/schemas/models/search.model.js +32 -0
  29. package/schemas/mutations/analytics.mutation.js +20 -0
  30. package/schemas/mutations/base.mutation.js +5 -0
  31. package/schemas/mutations/cart.mutation.js +22 -0
  32. package/schemas/mutations/identity.mutation.js +11 -0
  33. package/schemas/mutations/inventory.mutation.js +5 -0
  34. package/schemas/mutations/price.mutation.js +5 -0
  35. package/schemas/mutations/product.mutation.js +5 -0
  36. package/schemas/mutations/search.mutation.js +5 -0
  37. package/schemas/queries/analytics.query.js +5 -0
  38. package/schemas/queries/base.query.js +5 -0
  39. package/schemas/queries/cart.query.js +11 -0
  40. package/schemas/queries/identity.query.js +5 -0
  41. package/schemas/queries/inventory.query.js +8 -0
  42. package/schemas/queries/price.query.js +8 -0
  43. package/schemas/queries/product.query.js +12 -0
  44. package/schemas/queries/search.query.js +8 -0
  45. package/schemas/session.schema.js +9 -0
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@reactionary/core",
3
- "version": "0.0.33",
4
- "main": "./index.js",
5
- "types": "./src/index.d.ts",
3
+ "version": "0.0.35",
4
+ "main": "index.js",
5
+ "types": "src/index.d.ts",
6
6
  "dependencies": {
7
7
  "zod": "4.0.0-beta.20250430T185432",
8
8
  "@upstash/redis": "^1.34.9",
@@ -0,0 +1,6 @@
1
+ import { BaseProvider } from "./base.provider";
2
+ class AnalyticsProvider extends BaseProvider {
3
+ }
4
+ export {
5
+ AnalyticsProvider
6
+ };
@@ -0,0 +1,30 @@
1
+ class BaseProvider {
2
+ constructor(schema, cache) {
3
+ this.schema = schema;
4
+ this.cache = cache;
5
+ }
6
+ /**
7
+ * Validates that the final domain model constructed by the provider
8
+ * fulfills the schema as defined. This will throw an exception.
9
+ */
10
+ assert(value) {
11
+ return this.schema.parse(value);
12
+ }
13
+ /**
14
+ * Creates a new model entity based on the schema defaults.
15
+ */
16
+ newModel() {
17
+ return this.schema.parse({});
18
+ }
19
+ /**
20
+ * Handler for parsing a response from a remote provider and converting it
21
+ * into the typed domain model.
22
+ */
23
+ parseSingle(_body) {
24
+ const model = this.newModel();
25
+ return this.assert(model);
26
+ }
27
+ }
28
+ export {
29
+ BaseProvider
30
+ };
@@ -0,0 +1,6 @@
1
+ import { BaseProvider } from "./base.provider";
2
+ class CartProvider extends BaseProvider {
3
+ }
4
+ export {
5
+ CartProvider
6
+ };
@@ -0,0 +1,6 @@
1
+ import { BaseProvider } from "./base.provider";
2
+ class IdentityProvider extends BaseProvider {
3
+ }
4
+ export {
5
+ IdentityProvider
6
+ };
@@ -0,0 +1,6 @@
1
+ import { BaseProvider } from "./base.provider";
2
+ class InventoryProvider extends BaseProvider {
3
+ }
4
+ export {
5
+ InventoryProvider
6
+ };
@@ -0,0 +1,6 @@
1
+ import { BaseProvider } from "./base.provider";
2
+ class PriceProvider extends BaseProvider {
3
+ }
4
+ export {
5
+ PriceProvider
6
+ };
@@ -0,0 +1,6 @@
1
+ import { BaseProvider } from "./base.provider";
2
+ class ProductProvider extends BaseProvider {
3
+ }
4
+ export {
5
+ ProductProvider
6
+ };
@@ -0,0 +1,6 @@
1
+ import { BaseProvider } from "./base.provider";
2
+ class SearchProvider extends BaseProvider {
3
+ }
4
+ export {
5
+ SearchProvider
6
+ };
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ const CapabilitiesSchema = z.looseInterface({
3
+ product: z.boolean(),
4
+ search: z.boolean(),
5
+ analytics: z.boolean(),
6
+ identity: z.boolean(),
7
+ cart: z.boolean(),
8
+ inventory: z.boolean(),
9
+ price: z.boolean()
10
+ });
11
+ export {
12
+ CapabilitiesSchema
13
+ };
@@ -0,0 +1,5 @@
1
+ import { BaseModelSchema } from "./base.model";
2
+ const AnalyticsEventSchema = BaseModelSchema.extend({});
3
+ export {
4
+ AnalyticsEventSchema
5
+ };
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ const CacheInformationSchema = z.looseInterface({
3
+ hit: z.boolean().default(false),
4
+ key: z.string().default("")
5
+ });
6
+ const MetaSchema = z.looseInterface({
7
+ cache: CacheInformationSchema.default(() => CacheInformationSchema.parse({})),
8
+ placeholder: z.boolean().default(false).describe("Whether or not the entity exists in a remote system, or is a default placeholder.")
9
+ });
10
+ const BaseModelSchema = z.looseInterface({
11
+ meta: MetaSchema.default(() => MetaSchema.parse({}))
12
+ });
13
+ export {
14
+ BaseModelSchema,
15
+ CacheInformationSchema,
16
+ MetaSchema
17
+ };
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { CartIdentifierSchema, CartItemIdentifierSchema, ProductIdentifierSchema } from "../models/identifiers.model";
3
+ import { BaseModelSchema } from "./base.model";
4
+ const CartItemSchema = z.looseInterface({
5
+ identifier: CartItemIdentifierSchema.default(() => CartItemIdentifierSchema.parse({})),
6
+ product: ProductIdentifierSchema.default(() => ProductIdentifierSchema.parse({})),
7
+ quantity: z.number().default(0)
8
+ });
9
+ const CartSchema = BaseModelSchema.extend({
10
+ identifier: CartIdentifierSchema.default(() => CartIdentifierSchema.parse({})),
11
+ items: z.array(CartItemSchema).default(() => [])
12
+ });
13
+ export {
14
+ CartItemSchema,
15
+ CartSchema
16
+ };
@@ -0,0 +1,187 @@
1
+ import { z } from "zod";
2
+ const CurrencySchema = z.enum([
3
+ "AED",
4
+ "AFN",
5
+ "ALL",
6
+ "AMD",
7
+ "ANG",
8
+ "AOA",
9
+ "ARS",
10
+ "AUD",
11
+ "AWG",
12
+ "AZN",
13
+ "BAM",
14
+ "BBD",
15
+ "BDT",
16
+ "BGN",
17
+ "BHD",
18
+ "BIF",
19
+ "BMD",
20
+ "BND",
21
+ "BOB",
22
+ "BOV",
23
+ "BRL",
24
+ "BSD",
25
+ "BTN",
26
+ "BWP",
27
+ "BYN",
28
+ "BZD",
29
+ "CAD",
30
+ "CDF",
31
+ "CHE",
32
+ "CHF",
33
+ "CHW",
34
+ "CLF",
35
+ "CLP",
36
+ "CNY",
37
+ "COP",
38
+ "COU",
39
+ "CRC",
40
+ "CUC",
41
+ "CUP",
42
+ "CVE",
43
+ "CZK",
44
+ "DJF",
45
+ "DKK",
46
+ "DOP",
47
+ "DZD",
48
+ "EGP",
49
+ "ERN",
50
+ "ETB",
51
+ "EUR",
52
+ "FJD",
53
+ "FKP",
54
+ "GBP",
55
+ "GEL",
56
+ "GHS",
57
+ "GIP",
58
+ "GMD",
59
+ "GNF",
60
+ "GTQ",
61
+ "GYD",
62
+ "HKD",
63
+ "HNL",
64
+ "HRK",
65
+ "HTG",
66
+ "HUF",
67
+ "IDR",
68
+ "ILS",
69
+ "INR",
70
+ "IQD",
71
+ "IRR",
72
+ "ISK",
73
+ "JMD",
74
+ "JOD",
75
+ "JPY",
76
+ "KES",
77
+ "KGS",
78
+ "KHR",
79
+ "KMF",
80
+ "KPW",
81
+ "KRW",
82
+ "KWD",
83
+ "KYD",
84
+ "KZT",
85
+ "LAK",
86
+ "LBP",
87
+ "LKR",
88
+ "LRD",
89
+ "LSL",
90
+ "LYD",
91
+ "MAD",
92
+ "MDL",
93
+ "MGA",
94
+ "MKD",
95
+ "MMK",
96
+ "MNT",
97
+ "MOP",
98
+ "MRU",
99
+ "MUR",
100
+ "MVR",
101
+ "MWK",
102
+ "MXN",
103
+ "MXV",
104
+ "MYR",
105
+ "MZN",
106
+ "NAD",
107
+ "NGN",
108
+ "NIO",
109
+ "NOK",
110
+ "NPR",
111
+ "NZD",
112
+ "OMR",
113
+ "PAB",
114
+ "PEN",
115
+ "PGK",
116
+ "PHP",
117
+ "PKR",
118
+ "PLN",
119
+ "PYG",
120
+ "QAR",
121
+ "RON",
122
+ "RSD",
123
+ "RUB",
124
+ "RWF",
125
+ "SAR",
126
+ "SBD",
127
+ "SCR",
128
+ "SDG",
129
+ "SEK",
130
+ "SGD",
131
+ "SHP",
132
+ "SLE",
133
+ "SLL",
134
+ "SOS",
135
+ "SRD",
136
+ "SSP",
137
+ "STN",
138
+ "SYP",
139
+ "SZL",
140
+ "THB",
141
+ "TJS",
142
+ "TMT",
143
+ "TND",
144
+ "TOP",
145
+ "TRY",
146
+ "TTD",
147
+ "TVD",
148
+ "TWD",
149
+ "TZS",
150
+ "UAH",
151
+ "UGX",
152
+ "USD",
153
+ "USN",
154
+ "UYI",
155
+ "UYU",
156
+ "UYW",
157
+ "UZS",
158
+ "VED",
159
+ "VES",
160
+ "VND",
161
+ "VUV",
162
+ "WST",
163
+ "XAF",
164
+ "XAG",
165
+ "XAU",
166
+ "XBA",
167
+ "XBB",
168
+ "XBC",
169
+ "XBD",
170
+ "XCD",
171
+ "XDR",
172
+ "XOF",
173
+ "XPD",
174
+ "XPF",
175
+ "XPT",
176
+ "XSU",
177
+ "XTS",
178
+ "XUA",
179
+ "XXX",
180
+ "YER",
181
+ "ZAR",
182
+ "ZMW",
183
+ "ZWL"
184
+ ]);
185
+ export {
186
+ CurrencySchema
187
+ };
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ const FacetIdentifierSchema = z.looseInterface({
3
+ key: z.string().default("").nonoptional()
4
+ });
5
+ const FacetValueIdentifierSchema = z.looseInterface({
6
+ facet: FacetIdentifierSchema.default(() => FacetIdentifierSchema.parse({})),
7
+ key: z.string().default("")
8
+ });
9
+ const SKUIdentifierSchema = z.looseInterface({
10
+ key: z.string().default("").nonoptional()
11
+ });
12
+ const ProductIdentifierSchema = z.looseInterface({
13
+ key: z.string().default("")
14
+ });
15
+ const SearchIdentifierSchema = z.looseInterface({
16
+ term: z.string().default(""),
17
+ page: z.number().default(0),
18
+ pageSize: z.number().default(20),
19
+ facets: z.array(FacetValueIdentifierSchema.required()).default(() => [])
20
+ });
21
+ const CartIdentifierSchema = z.looseInterface({
22
+ key: z.string().default("")
23
+ });
24
+ const CartItemIdentifierSchema = z.looseInterface({
25
+ key: z.string().default("")
26
+ });
27
+ const PriceIdentifierSchema = z.looseInterface({
28
+ sku: SKUIdentifierSchema.default(() => SKUIdentifierSchema.parse({}))
29
+ });
30
+ export {
31
+ CartIdentifierSchema,
32
+ CartItemIdentifierSchema,
33
+ FacetIdentifierSchema,
34
+ FacetValueIdentifierSchema,
35
+ PriceIdentifierSchema,
36
+ ProductIdentifierSchema,
37
+ SKUIdentifierSchema,
38
+ SearchIdentifierSchema
39
+ };
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ import { BaseModelSchema } from "./base.model";
3
+ const IdentityTypeSchema = z.enum(["Anonymous", "Guest", "Registered"]);
4
+ const IdentitySchema = BaseModelSchema.extend({
5
+ id: z.string().default(""),
6
+ type: IdentityTypeSchema.default("Anonymous"),
7
+ token: z.string().optional(),
8
+ issued: z.coerce.date().default(/* @__PURE__ */ new Date()),
9
+ expiry: z.coerce.date().default(/* @__PURE__ */ new Date())
10
+ });
11
+ export {
12
+ IdentitySchema,
13
+ IdentityTypeSchema
14
+ };
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ import { BaseModelSchema } from "./base.model";
3
+ const InventorySchema = BaseModelSchema.extend({
4
+ quantity: z.number().default(0)
5
+ });
6
+ export {
7
+ InventorySchema
8
+ };
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ import { BaseModelSchema } from "./base.model";
3
+ import { PriceIdentifierSchema } from "./identifiers.model";
4
+ import { CurrencySchema } from "./currency.model";
5
+ const MonetaryAmountSchema = z.looseInterface({
6
+ cents: z.number().default(0).describe("The monetary amount in cent-precision."),
7
+ currency: CurrencySchema.default("XXX").describe("The currency associated with the amount, as a ISO 4217 standardized code.")
8
+ });
9
+ const PriceSchema = BaseModelSchema.extend({
10
+ identifier: PriceIdentifierSchema.default(() => PriceIdentifierSchema.parse({})),
11
+ value: MonetaryAmountSchema.default(() => MonetaryAmountSchema.parse({}))
12
+ });
13
+ export {
14
+ MonetaryAmountSchema,
15
+ PriceSchema
16
+ };
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ import { ProductIdentifierSchema } from "./identifiers.model";
3
+ import { BaseModelSchema } from "./base.model";
4
+ const SKUSchema = z.looseInterface({
5
+ identifier: ProductIdentifierSchema.default(() => ProductIdentifierSchema.parse({}))
6
+ });
7
+ const ProductAttributeSchema = z.looseInterface({
8
+ id: z.string(),
9
+ name: z.string(),
10
+ value: z.string()
11
+ });
12
+ const ProductSchema = BaseModelSchema.extend({
13
+ identifier: ProductIdentifierSchema.default(() => ProductIdentifierSchema.parse({})),
14
+ name: z.string().default(""),
15
+ slug: z.string().default(""),
16
+ description: z.string().default(""),
17
+ image: z.string().url().default("https://placehold.co/400"),
18
+ images: z.string().url().array().default(() => []),
19
+ attributes: z.array(ProductAttributeSchema).default(() => []),
20
+ skus: z.array(SKUSchema).default(() => [])
21
+ });
22
+ export {
23
+ ProductAttributeSchema,
24
+ ProductSchema,
25
+ SKUSchema
26
+ };
@@ -0,0 +1,32 @@
1
+ import { z } from "zod";
2
+ import { ProductIdentifierSchema, FacetValueIdentifierSchema, FacetIdentifierSchema, SearchIdentifierSchema } from "./identifiers.model";
3
+ import { BaseModelSchema } from "./base.model";
4
+ const SearchResultProductSchema = z.looseInterface({
5
+ identifier: ProductIdentifierSchema.default(ProductIdentifierSchema.parse({})),
6
+ name: z.string().default(""),
7
+ image: z.string().url().default("https://placehold.co/400"),
8
+ slug: z.string().default("")
9
+ });
10
+ const SearchResultFacetValueSchema = z.looseInterface({
11
+ identifier: FacetValueIdentifierSchema.default(() => FacetValueIdentifierSchema.parse({})),
12
+ name: z.string().default(""),
13
+ count: z.number().default(0),
14
+ active: z.boolean().default(false)
15
+ });
16
+ const SearchResultFacetSchema = z.looseInterface({
17
+ identifier: FacetIdentifierSchema.default(() => FacetIdentifierSchema.parse({})),
18
+ name: z.string().default(""),
19
+ values: z.array(SearchResultFacetValueSchema).default(() => [])
20
+ });
21
+ const SearchResultSchema = BaseModelSchema.extend({
22
+ identifier: SearchIdentifierSchema.default(() => SearchIdentifierSchema.parse({})),
23
+ products: z.array(SearchResultProductSchema).default(() => []),
24
+ pages: z.number().default(0),
25
+ facets: z.array(SearchResultFacetSchema).default(() => [])
26
+ });
27
+ export {
28
+ SearchResultFacetSchema,
29
+ SearchResultFacetValueSchema,
30
+ SearchResultProductSchema,
31
+ SearchResultSchema
32
+ };
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { BaseMutationSchema } from "./base.mutation";
3
+ import { ProductIdentifierSchema, SearchIdentifierSchema } from "../models/identifiers.model";
4
+ const AnalyticsMutationSearchEventSchema = BaseMutationSchema.extend({
5
+ mutation: z.literal("search"),
6
+ search: SearchIdentifierSchema.required(),
7
+ products: z.array(ProductIdentifierSchema)
8
+ });
9
+ const AnalyticsMutationSearchProductClickEventSchema = BaseMutationSchema.extend({
10
+ mutation: z.literal("product-search-click"),
11
+ search: SearchIdentifierSchema.required(),
12
+ product: ProductIdentifierSchema.required(),
13
+ position: z.number().min(0)
14
+ });
15
+ const AnalyticsMutationSchema = z.union([AnalyticsMutationSearchEventSchema, AnalyticsMutationSearchProductClickEventSchema]);
16
+ export {
17
+ AnalyticsMutationSchema,
18
+ AnalyticsMutationSearchEventSchema,
19
+ AnalyticsMutationSearchProductClickEventSchema
20
+ };
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ const BaseMutationSchema = z.looseInterface({});
3
+ export {
4
+ BaseMutationSchema
5
+ };
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ import { BaseMutationSchema } from "./base.mutation";
3
+ import { CartIdentifierSchema, CartItemIdentifierSchema, ProductIdentifierSchema } from "../models/identifiers.model";
4
+ const CartMutationItemAddSchema = BaseMutationSchema.extend({
5
+ cart: CartIdentifierSchema.required(),
6
+ product: ProductIdentifierSchema.required(),
7
+ quantity: z.number()
8
+ });
9
+ const CartMutationItemRemoveSchema = BaseMutationSchema.extend({
10
+ cart: CartIdentifierSchema.required(),
11
+ item: CartItemIdentifierSchema.required()
12
+ });
13
+ const CartMutationItemQuantityChangeSchema = BaseMutationSchema.extend({
14
+ cart: CartIdentifierSchema.required(),
15
+ item: CartItemIdentifierSchema.required(),
16
+ quantity: z.number()
17
+ });
18
+ export {
19
+ CartMutationItemAddSchema,
20
+ CartMutationItemQuantityChangeSchema,
21
+ CartMutationItemRemoveSchema
22
+ };
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ import { BaseMutationSchema } from "./base.mutation";
3
+ const IdentityMutationLoginSchema = BaseMutationSchema.extend({
4
+ username: z.string(),
5
+ password: z.string()
6
+ });
7
+ const IdentityMutationLogoutSchema = BaseMutationSchema.extend({});
8
+ export {
9
+ IdentityMutationLoginSchema,
10
+ IdentityMutationLogoutSchema
11
+ };
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ const InventoryMutationSchema = z.union([]);
3
+ export {
4
+ InventoryMutationSchema
5
+ };
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ const PriceMutationSchema = z.union([]);
3
+ export {
4
+ PriceMutationSchema
5
+ };
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ const ProductMutationSchema = z.union([]);
3
+ export {
4
+ ProductMutationSchema
5
+ };
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ const SearchMutationSchema = z.union([]);
3
+ export {
4
+ SearchMutationSchema
5
+ };
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ const AnalyticsQuerySchema = z.union([]);
3
+ export {
4
+ AnalyticsQuerySchema
5
+ };
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ const BaseQuerySchema = z.looseInterface({});
3
+ export {
4
+ BaseQuerySchema
5
+ };
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ import { BaseQuerySchema } from "./base.query";
3
+ import { CartIdentifierSchema } from "../models/identifiers.model";
4
+ const CartQueryByIdSchema = BaseQuerySchema.extend({
5
+ cart: CartIdentifierSchema.required()
6
+ });
7
+ const CartQuerySchema = z.union([CartQueryByIdSchema]);
8
+ export {
9
+ CartQueryByIdSchema,
10
+ CartQuerySchema
11
+ };
@@ -0,0 +1,5 @@
1
+ import { BaseQuerySchema } from "./base.query";
2
+ const IdentityQuerySelfSchema = BaseQuerySchema.extend({});
3
+ export {
4
+ IdentityQuerySelfSchema
5
+ };
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ import { BaseQuerySchema } from "./base.query";
3
+ const InventoryQuerySchema = BaseQuerySchema.extend({
4
+ sku: z.string()
5
+ });
6
+ export {
7
+ InventoryQuerySchema
8
+ };
@@ -0,0 +1,8 @@
1
+ import { BaseQuerySchema } from "./base.query";
2
+ import { SKUIdentifierSchema } from "../models/identifiers.model";
3
+ const PriceQueryBySkuSchema = BaseQuerySchema.extend({
4
+ sku: SKUIdentifierSchema.required()
5
+ });
6
+ export {
7
+ PriceQueryBySkuSchema
8
+ };
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ import { BaseQuerySchema } from "./base.query";
3
+ const ProductQueryBySlugSchema = BaseQuerySchema.extend({
4
+ slug: z.string()
5
+ });
6
+ const ProductQueryByIdSchema = BaseQuerySchema.extend({
7
+ id: z.string()
8
+ });
9
+ export {
10
+ ProductQueryByIdSchema,
11
+ ProductQueryBySlugSchema
12
+ };
@@ -0,0 +1,8 @@
1
+ import { BaseQuerySchema } from "./base.query";
2
+ import { SearchIdentifierSchema } from "../models/identifiers.model";
3
+ const SearchQueryByTermSchema = BaseQuerySchema.extend({
4
+ search: SearchIdentifierSchema.required()
5
+ });
6
+ export {
7
+ SearchQueryByTermSchema
8
+ };
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ import { IdentitySchema } from "./models/identity.model";
3
+ const SessionSchema = z.looseObject({
4
+ id: z.string(),
5
+ identity: IdentitySchema.default(() => IdentitySchema.parse({}))
6
+ });
7
+ export {
8
+ SessionSchema
9
+ };