@reactionary/provider-fake 0.3.0 → 0.3.1

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@reactionary/provider-fake",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "dependencies": {
7
- "@reactionary/core": "0.3.0",
7
+ "@reactionary/core": "0.3.1",
8
8
  "zod": "4.1.9",
9
9
  "@faker-js/faker": "^9.8.0"
10
10
  },
@@ -6,6 +6,8 @@ class FakeAnalyticsProvider extends AnalyticsProvider {
6
6
  super(cache, context);
7
7
  this.config = config;
8
8
  }
9
+ async track(event) {
10
+ }
9
11
  }
10
12
  export {
11
13
  FakeAnalyticsProvider
@@ -22,9 +22,12 @@ import {
22
22
  CheckoutMutationRemovePaymentInstructionSchema,
23
23
  CheckoutMutationSetShippingInstructionSchema,
24
24
  CheckoutMutationFinalizeCheckoutSchema,
25
- success
25
+ success,
26
+ PaymentMethodSchema,
27
+ ShippingMethodSchema
26
28
  } from "@reactionary/core";
27
29
  import { base, en, Faker } from "@faker-js/faker";
30
+ import z from "zod";
28
31
  class FakeCheckoutProvider extends CheckoutProvider {
29
32
  constructor(config, cache, context) {
30
33
  super(cache, context);
@@ -182,13 +185,13 @@ __decorateClass([
182
185
  __decorateClass([
183
186
  Reactionary({
184
187
  inputSchema: CheckoutQueryForAvailableShippingMethodsSchema,
185
- outputSchema: CheckoutSchema
188
+ outputSchema: z.array(ShippingMethodSchema)
186
189
  })
187
190
  ], FakeCheckoutProvider.prototype, "getAvailableShippingMethods", 1);
188
191
  __decorateClass([
189
192
  Reactionary({
190
193
  inputSchema: CheckoutQueryForAvailablePaymentMethodsSchema,
191
- outputSchema: CheckoutSchema
194
+ outputSchema: z.array(PaymentMethodSchema)
192
195
  })
193
196
  ], FakeCheckoutProvider.prototype, "getAvailablePaymentMethods", 1);
194
197
  __decorateClass([
@@ -74,7 +74,11 @@ class FakeProductProvider extends ProductProvider {
74
74
  __decorateClass([
75
75
  Reactionary({
76
76
  inputSchema: ProductQueryByIdSchema,
77
- outputSchema: ProductSchema
77
+ outputSchema: ProductSchema,
78
+ cache: true,
79
+ cacheTimeToLiveInSeconds: 300,
80
+ currencyDependentCaching: false,
81
+ localeDependentCaching: true
78
82
  })
79
83
  ], FakeProductProvider.prototype, "getById", 1);
80
84
  __decorateClass([
@@ -1,7 +1,8 @@
1
- import type { Cache, RequestContext } from '@reactionary/core';
1
+ import type { AnalyticsMutation, Cache, RequestContext } from '@reactionary/core';
2
2
  import { AnalyticsProvider } from '@reactionary/core';
3
3
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
4
4
  export declare class FakeAnalyticsProvider extends AnalyticsProvider {
5
5
  protected config: FakeConfiguration;
6
6
  constructor(config: FakeConfiguration, cache: Cache, context: RequestContext);
7
+ track(event: AnalyticsMutation): Promise<void>;
7
8
  }
@@ -5,57 +5,9 @@ import type { Cache as ReactionaryCache } from "@reactionary/core";
5
5
  import { Faker } from '@faker-js/faker';
6
6
  export declare class FakeCategoryProvider extends CategoryProvider {
7
7
  protected config: FakeConfiguration;
8
- protected topCategories: {
9
- identifier: {
10
- key: string;
11
- };
12
- name: string;
13
- slug: string;
14
- text: string;
15
- images: {
16
- sourceUrl: string;
17
- altText: string;
18
- width: number;
19
- height: number;
20
- }[];
21
- parentCategory?: {
22
- key: string;
23
- } | undefined;
24
- }[];
25
- protected childCategories: Map<string, {
26
- identifier: {
27
- key: string;
28
- };
29
- name: string;
30
- slug: string;
31
- text: string;
32
- images: {
33
- sourceUrl: string;
34
- altText: string;
35
- width: number;
36
- height: number;
37
- }[];
38
- parentCategory?: {
39
- key: string;
40
- } | undefined;
41
- }[]>;
42
- protected allCategories: Map<string, {
43
- identifier: {
44
- key: string;
45
- };
46
- name: string;
47
- slug: string;
48
- text: string;
49
- images: {
50
- sourceUrl: string;
51
- altText: string;
52
- width: number;
53
- height: number;
54
- }[];
55
- parentCategory?: {
56
- key: string;
57
- } | undefined;
58
- }>;
8
+ protected topCategories: Category[];
9
+ protected childCategories: Map<string, Category[]>;
10
+ protected allCategories: Map<string, Category>;
59
11
  protected categoryGenerator: Faker;
60
12
  protected generateFakeCategory(parent: Category | undefined, index: number): Category;
61
13
  constructor(config: FakeConfiguration, cache: ReactionaryCache, context: RequestContext);
@@ -16,9 +16,7 @@ export declare class FakeCheckoutProvider extends CheckoutProvider {
16
16
  finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<Result<Checkout>>;
17
17
  protected composeBaseCheckout(identifier?: CheckoutIdentifier): {
18
18
  description: string;
19
- identifier: {
20
- key: string;
21
- };
19
+ identifier: CheckoutIdentifier;
22
20
  items: never[];
23
21
  name: string;
24
22
  originalCartReference: {
@@ -16,9 +16,7 @@ export declare class FakeProfileProvider extends ProfileProvider {
16
16
  createdAt: string;
17
17
  email: string;
18
18
  emailVerified: true;
19
- identifier: {
20
- userId: string;
21
- };
19
+ identifier: IdentityIdentifier;
22
20
  phone: string;
23
21
  phoneVerified: true;
24
22
  updatedAt: string;
@@ -2,9 +2,9 @@ import type { z } from 'zod';
2
2
  export declare const FakeCapabilitiesSchema: z.ZodObject<{
3
3
  price: z.ZodOptional<z.ZodBoolean>;
4
4
  product: z.ZodOptional<z.ZodBoolean>;
5
+ order: z.ZodOptional<z.ZodBoolean>;
5
6
  cart: z.ZodOptional<z.ZodBoolean>;
6
7
  checkout: z.ZodOptional<z.ZodBoolean>;
7
- order: z.ZodOptional<z.ZodBoolean>;
8
8
  identity: z.ZodOptional<z.ZodBoolean>;
9
9
  inventory: z.ZodOptional<z.ZodBoolean>;
10
10
  category: z.ZodOptional<z.ZodBoolean>;