@reactionary/core 0.0.41 → 0.0.48

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 (85) hide show
  1. package/cache/memory-cache.js +39 -0
  2. package/cache/noop-cache.js +3 -13
  3. package/cache/redis-cache.js +16 -32
  4. package/decorators/reactionary.decorator.js +57 -4
  5. package/index.js +5 -27
  6. package/initialization.js +43 -0
  7. package/package.json +4 -2
  8. package/providers/base.provider.js +29 -12
  9. package/providers/cart-payment.provider.js +9 -0
  10. package/providers/cart.provider.js +6 -0
  11. package/providers/index.js +12 -0
  12. package/providers/price.provider.js +1 -1
  13. package/providers/product.provider.js +10 -0
  14. package/providers/profile.provider.js +9 -0
  15. package/providers/store.provider.js +9 -0
  16. package/schemas/capabilities.schema.js +3 -1
  17. package/schemas/models/cart.model.js +9 -2
  18. package/schemas/models/identifiers.model.js +40 -4
  19. package/schemas/models/identity.model.js +20 -6
  20. package/schemas/models/index.js +15 -0
  21. package/schemas/models/payment.model.js +37 -0
  22. package/schemas/models/profile.model.js +30 -0
  23. package/schemas/models/shipping-method.model.js +15 -0
  24. package/schemas/models/store.model.js +11 -0
  25. package/schemas/mutations/cart-payment.mutation.js +15 -0
  26. package/schemas/mutations/cart.mutation.js +52 -3
  27. package/schemas/mutations/identity.mutation.js +6 -1
  28. package/schemas/mutations/index.js +10 -0
  29. package/schemas/mutations/profile.mutation.js +9 -0
  30. package/schemas/queries/cart-payment.query.js +11 -0
  31. package/schemas/queries/index.js +3 -0
  32. package/schemas/queries/inventory.query.js +3 -5
  33. package/schemas/queries/profile.query.js +5 -0
  34. package/schemas/queries/store.query.js +11 -0
  35. package/schemas/session.schema.js +22 -8
  36. package/src/cache/cache.interface.d.ts +13 -20
  37. package/src/cache/memory-cache.d.ts +18 -0
  38. package/src/cache/noop-cache.d.ts +5 -11
  39. package/src/cache/redis-cache.d.ts +5 -11
  40. package/src/client/client-builder.d.ts +2 -2
  41. package/src/client/client.d.ts +11 -9
  42. package/src/decorators/reactionary.decorator.d.ts +34 -1
  43. package/src/index.d.ts +5 -27
  44. package/src/initialization.d.ts +2 -0
  45. package/src/providers/analytics.provider.d.ts +1 -1
  46. package/src/providers/base.provider.d.ts +12 -9
  47. package/src/providers/cart-payment.provider.d.ts +42 -0
  48. package/src/providers/cart.provider.d.ts +107 -8
  49. package/src/providers/category.provider.d.ts +9 -9
  50. package/src/providers/identity.provider.d.ts +8 -7
  51. package/src/providers/index.d.ts +12 -0
  52. package/src/providers/inventory.provider.d.ts +4 -4
  53. package/src/providers/price.provider.d.ts +7 -7
  54. package/src/providers/product.provider.d.ts +10 -5
  55. package/src/providers/profile.provider.d.ts +10 -0
  56. package/src/providers/search.provider.d.ts +4 -4
  57. package/src/providers/store.provider.d.ts +8 -0
  58. package/src/schemas/capabilities.schema.d.ts +2 -0
  59. package/src/schemas/models/analytics.model.d.ts +1 -1
  60. package/src/schemas/models/cart.model.d.ts +251 -2
  61. package/src/schemas/models/identifiers.model.d.ts +38 -4
  62. package/src/schemas/models/identity.model.d.ts +77 -14
  63. package/src/schemas/models/index.d.ts +15 -0
  64. package/src/schemas/models/inventory.model.d.ts +1 -1
  65. package/src/schemas/models/payment.model.d.ts +692 -0
  66. package/src/schemas/models/profile.model.d.ts +101 -0
  67. package/src/schemas/models/shipping-method.model.d.ts +201 -0
  68. package/src/schemas/models/store.model.d.ts +18 -0
  69. package/src/schemas/mutations/cart-payment.mutation.d.ts +213 -0
  70. package/src/schemas/mutations/cart.mutation.d.ts +477 -2
  71. package/src/schemas/mutations/identity.mutation.d.ts +5 -0
  72. package/src/schemas/mutations/index.d.ts +10 -0
  73. package/src/schemas/mutations/profile.mutation.d.ts +6 -0
  74. package/src/schemas/queries/cart-payment.query.d.ts +16 -0
  75. package/src/schemas/queries/cart.query.d.ts +1 -1
  76. package/src/schemas/queries/identity.query.d.ts +1 -1
  77. package/src/schemas/queries/index.d.ts +3 -0
  78. package/src/schemas/queries/inventory.query.d.ts +6 -15
  79. package/src/schemas/queries/price.query.d.ts +1 -1
  80. package/src/schemas/queries/profile.query.d.ts +3 -0
  81. package/src/schemas/queries/search.query.d.ts +1 -1
  82. package/src/schemas/queries/store.query.d.ts +8 -0
  83. package/src/schemas/session.schema.d.ts +57 -13
  84. package/cache/cache-evaluation.interface.js +0 -0
  85. package/src/cache/cache-evaluation.interface.d.ts +0 -17
@@ -1,4 +1,7 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * The language and locale context for the current request.
4
+ */
2
5
  export declare const LanguageContextSchema: z.ZodObject<{
3
6
  locale: z.ZodDefault<z.ZodString>;
4
7
  currencyCode: z.ZodDefault<z.ZodEnum<{
@@ -184,11 +187,16 @@ export declare const LanguageContextSchema: z.ZodObject<{
184
187
  ZMW: "ZMW";
185
188
  ZWL: "ZWL";
186
189
  }>>;
187
- countryCode: z.ZodDefault<z.ZodString>;
188
190
  }, z.core.$loose>;
189
- export declare const SessionSchema: z.ZodObject<{
190
- id: z.ZodString;
191
- identity: z.ZodDefault<z.ZodObject<{
191
+ export declare const SessionSchema: z.ZodRecord<z.ZodString, z.ZodAny>;
192
+ export declare const TaxJurisdictionSchema: z.ZodObject<{
193
+ countryCode: z.ZodDefault<z.ZodString>;
194
+ stateCode: z.ZodDefault<z.ZodString>;
195
+ countyCode: z.ZodDefault<z.ZodString>;
196
+ cityCode: z.ZodDefault<z.ZodString>;
197
+ }, z.core.$strip>;
198
+ export declare const RequestContextSchema: z.ZodObject<{
199
+ identity: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
192
200
  meta: z.ZodDefault<z.ZodObject<{
193
201
  cache: z.ZodDefault<z.ZodObject<{
194
202
  hit: z.ZodDefault<z.ZodBoolean>;
@@ -196,16 +204,40 @@ export declare const SessionSchema: z.ZodObject<{
196
204
  }, z.core.$loose>>;
197
205
  placeholder: z.ZodDefault<z.ZodBoolean>;
198
206
  }, z.core.$loose>>;
199
- id: z.ZodDefault<z.ZodString>;
200
- type: z.ZodDefault<z.ZodEnum<{
201
- Anonymous: "Anonymous";
202
- Guest: "Guest";
203
- Registered: "Registered";
204
- }>>;
207
+ type: z.ZodLiteral<"Anonymous">;
208
+ }, z.core.$loose>, z.ZodObject<{
209
+ meta: z.ZodDefault<z.ZodObject<{
210
+ cache: z.ZodDefault<z.ZodObject<{
211
+ hit: z.ZodDefault<z.ZodBoolean>;
212
+ key: z.ZodDefault<z.ZodString>;
213
+ }, z.core.$loose>>;
214
+ placeholder: z.ZodDefault<z.ZodBoolean>;
215
+ }, z.core.$loose>>;
216
+ id: z.ZodDefault<z.ZodObject<{
217
+ userId: z.ZodNonOptional<z.ZodDefault<z.ZodString>>;
218
+ }, z.core.$loose>>;
219
+ type: z.ZodLiteral<"Guest">;
205
220
  token: z.ZodOptional<z.ZodString>;
206
- issued: z.ZodDefault<z.ZodCoercedDate<unknown>>;
221
+ refresh_token: z.ZodOptional<z.ZodString>;
207
222
  expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
208
- }, z.core.$loose>>;
223
+ }, z.core.$loose>, z.ZodObject<{
224
+ meta: z.ZodDefault<z.ZodObject<{
225
+ cache: z.ZodDefault<z.ZodObject<{
226
+ hit: z.ZodDefault<z.ZodBoolean>;
227
+ key: z.ZodDefault<z.ZodString>;
228
+ }, z.core.$loose>>;
229
+ placeholder: z.ZodDefault<z.ZodBoolean>;
230
+ }, z.core.$loose>>;
231
+ id: z.ZodDefault<z.ZodObject<{
232
+ userId: z.ZodNonOptional<z.ZodDefault<z.ZodString>>;
233
+ }, z.core.$loose>>;
234
+ type: z.ZodLiteral<"Registered">;
235
+ logonId: z.ZodDefault<z.ZodString>;
236
+ token: z.ZodOptional<z.ZodString>;
237
+ refresh_token: z.ZodOptional<z.ZodString>;
238
+ expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
239
+ }, z.core.$loose>], "type">>;
240
+ session: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
209
241
  languageContext: z.ZodDefault<z.ZodObject<{
210
242
  locale: z.ZodDefault<z.ZodString>;
211
243
  currencyCode: z.ZodDefault<z.ZodEnum<{
@@ -391,11 +423,23 @@ export declare const SessionSchema: z.ZodObject<{
391
423
  ZMW: "ZMW";
392
424
  ZWL: "ZWL";
393
425
  }>>;
394
- countryCode: z.ZodDefault<z.ZodString>;
395
426
  }, z.core.$loose>>;
396
427
  storeIdentifier: z.ZodDefault<z.ZodObject<{
397
428
  key: z.ZodNonOptional<z.ZodDefault<z.ZodString>>;
398
429
  }, z.core.$loose>>;
430
+ taxJurisdiction: z.ZodDefault<z.ZodObject<{
431
+ countryCode: z.ZodDefault<z.ZodString>;
432
+ stateCode: z.ZodDefault<z.ZodString>;
433
+ countyCode: z.ZodDefault<z.ZodString>;
434
+ cityCode: z.ZodDefault<z.ZodString>;
435
+ }, z.core.$strip>>;
436
+ correlationId: z.ZodDefault<z.ZodString>;
437
+ isBot: z.ZodDefault<z.ZodBoolean>;
438
+ clientIp: z.ZodDefault<z.ZodString>;
439
+ userAgent: z.ZodDefault<z.ZodString>;
440
+ referrer: z.ZodDefault<z.ZodString>;
399
441
  }, z.core.$loose>;
400
442
  export type Session = z.infer<typeof SessionSchema>;
401
443
  export type LanguageContext = z.infer<typeof LanguageContextSchema>;
444
+ export type RequestContext = z.infer<typeof RequestContextSchema>;
445
+ export type TaxJurisdiction = z.infer<typeof TaxJurisdictionSchema>;
File without changes
@@ -1,17 +0,0 @@
1
- /**
2
- * Cache evaluation result that determines how and if a query should be cached
3
- */
4
- export interface CacheEvaluation {
5
- /**
6
- * The cache key to use for storing/retrieving the value
7
- */
8
- key: string;
9
- /**
10
- * How long to cache the value in seconds
11
- */
12
- cacheDurationInSeconds: number;
13
- /**
14
- * Whether this query result can be cached
15
- */
16
- canCache: boolean;
17
- }