@reactionary/provider-fake 0.0.42 → 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.
@@ -1,23 +1,61 @@
1
- import { ProductSchema, SearchResultSchema, CategorySchema, CartSchema } from "@reactionary/core";
1
+ import {
2
+ ProductSchema,
3
+ SearchResultSchema,
4
+ CategorySchema,
5
+ CartSchema,
6
+ InventorySchema,
7
+ StoreSchema,
8
+ PriceSchema
9
+ } from "@reactionary/core";
2
10
  import { FakeProductProvider } from "../providers/product.provider";
3
11
  import { FakeSearchProvider } from "../providers/search.provider";
4
12
  import { FakeCategoryProvider } from "../providers/category.provider";
5
- import { FakeCartProvider } from "../providers";
13
+ import {
14
+ FakeCartProvider,
15
+ FakeInventoryProvider,
16
+ FakePriceProvider,
17
+ FakeStoreProvider
18
+ } from "../providers";
6
19
  function withFakeCapabilities(configuration, capabilities) {
7
20
  return (cache) => {
8
21
  const client = {};
9
22
  if (capabilities.product) {
10
- client.product = new FakeProductProvider(configuration, ProductSchema, cache);
23
+ client.product = new FakeProductProvider(
24
+ configuration,
25
+ ProductSchema,
26
+ cache
27
+ );
11
28
  }
12
29
  if (capabilities.search) {
13
- client.search = new FakeSearchProvider(configuration, SearchResultSchema, cache);
30
+ client.search = new FakeSearchProvider(
31
+ configuration,
32
+ SearchResultSchema,
33
+ cache
34
+ );
14
35
  }
15
36
  if (capabilities.category) {
16
- client.category = new FakeCategoryProvider(configuration, CategorySchema, cache);
37
+ client.category = new FakeCategoryProvider(
38
+ configuration,
39
+ CategorySchema,
40
+ cache
41
+ );
17
42
  }
18
43
  if (capabilities.cart) {
19
44
  client.cart = new FakeCartProvider(configuration, CartSchema, cache);
20
45
  }
46
+ if (capabilities.inventory) {
47
+ client.inventory = new FakeInventoryProvider(
48
+ configuration,
49
+ InventorySchema,
50
+ cache
51
+ );
52
+ }
53
+ if (capabilities.store) {
54
+ client.store = new FakeStoreProvider(configuration, StoreSchema, cache);
55
+ }
56
+ if (capabilities.price) {
57
+ client.price = new FakePriceProvider(configuration, PriceSchema, cache);
58
+ }
21
59
  return client;
22
60
  };
23
61
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@reactionary/provider-fake",
3
- "version": "0.0.42",
3
+ "version": "0.0.48",
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "dependencies": {
7
- "@reactionary/core": "0.0.42",
8
- "@reactionary/otel": "0.0.42",
7
+ "@reactionary/core": "0.0.48",
8
+ "@reactionary/otel": "0.0.48",
9
9
  "zod": "4.1.9",
10
10
  "@faker-js/faker": "^9.8.0"
11
11
  }
@@ -12,7 +12,7 @@ class FakeCartProvider extends CartProvider {
12
12
  });
13
13
  this.config = config;
14
14
  }
15
- async getById(payload, _session) {
15
+ async getById(payload, _reqCtx) {
16
16
  const cartId = payload.cart.key;
17
17
  if (payload.cart.key === "") {
18
18
  const result = this.newModel();
@@ -43,9 +43,9 @@ class FakeCartProvider extends CartProvider {
43
43
  }
44
44
  return cart;
45
45
  }
46
- async add(payload, session) {
46
+ async add(payload, reqCtx) {
47
47
  const cartId = payload.cart.key || `cart-${this.generator.string.uuid()}`;
48
- const cart = await this.getById({ cart: { key: cartId } }, session);
48
+ const cart = await this.getById({ cart: { key: cartId } }, reqCtx);
49
49
  const existingItemIndex = cart.items.findIndex(
50
50
  (item) => item.sku.key === payload.sku.key
51
51
  );
@@ -60,20 +60,20 @@ class FakeCartProvider extends CartProvider {
60
60
  price: {
61
61
  unitPrice: {
62
62
  value: price,
63
- currency: session.languageContext.currencyCode
63
+ currency: reqCtx.languageContext.currencyCode
64
64
  },
65
65
  totalPrice: {
66
66
  value: 0,
67
67
  // Will be calculated below
68
- currency: session.languageContext.currencyCode
68
+ currency: reqCtx.languageContext.currencyCode
69
69
  },
70
70
  totalDiscount: {
71
71
  value: 0,
72
- currency: session.languageContext.currencyCode
72
+ currency: reqCtx.languageContext.currencyCode
73
73
  },
74
74
  unitDiscount: {
75
75
  value: 0,
76
- currency: session.languageContext.currencyCode
76
+ currency: reqCtx.languageContext.currencyCode
77
77
  }
78
78
  },
79
79
  product: {
@@ -84,18 +84,18 @@ class FakeCartProvider extends CartProvider {
84
84
  this.recalculateCart(cart);
85
85
  return this.assert(cart);
86
86
  }
87
- async remove(payload, session) {
87
+ async remove(payload, reqCtx) {
88
88
  const cartId = payload.cart.key || `cart-${this.generator.string.uuid()}`;
89
- const cart = await this.getById({ cart: { key: cartId } }, session);
89
+ const cart = await this.getById({ cart: { key: cartId } }, reqCtx);
90
90
  cart.items = cart.items.filter(
91
91
  (item) => item.identifier.key !== payload.item.key
92
92
  );
93
93
  this.recalculateCart(cart);
94
94
  return this.assert(cart);
95
95
  }
96
- async changeQuantity(payload, session) {
96
+ async changeQuantity(payload, reqCtx) {
97
97
  const cartId = payload.cart.key || `cart-${this.generator.string.uuid()}`;
98
- const cart = await this.getById({ cart: { key: cartId } }, session);
98
+ const cart = await this.getById({ cart: { key: cartId } }, reqCtx);
99
99
  const item = cart.items.find(
100
100
  (item2) => item2.identifier.key === payload.item.key
101
101
  );
@@ -108,28 +108,28 @@ class FakeCartProvider extends CartProvider {
108
108
  this.recalculateCart(cart);
109
109
  return this.assert(cart);
110
110
  }
111
- getActiveCartId(session) {
111
+ getActiveCartId(reqCtx) {
112
112
  throw new Error("Method not implemented.");
113
113
  }
114
- deleteCart(payload, session) {
114
+ deleteCart(payload, reqCtx) {
115
115
  throw new Error("Method not implemented.");
116
116
  }
117
- setShippingInfo(payload, session) {
117
+ setShippingInfo(payload, reqCtx) {
118
118
  throw new Error("Method not implemented.");
119
119
  }
120
- setBillingAddress(payload, session) {
120
+ setBillingAddress(payload, reqCtx) {
121
121
  throw new Error("Method not implemented.");
122
122
  }
123
- applyCouponCode(payload, session) {
123
+ applyCouponCode(payload, reqCtx) {
124
124
  throw new Error("Method not implemented.");
125
125
  }
126
- removeCouponCode(payload, session) {
126
+ removeCouponCode(payload, reqCtx) {
127
127
  throw new Error("Method not implemented.");
128
128
  }
129
- checkout(payload, session) {
129
+ checkout(payload, reqCtx) {
130
130
  throw new Error("Method not implemented.");
131
131
  }
132
- changeCurrency(payload, session) {
132
+ changeCurrency(payload, reqCtx) {
133
133
  throw new Error("Method not implemented.");
134
134
  }
135
135
  recalculateCart(cart) {
@@ -48,7 +48,7 @@ class FakeCategoryProvider extends CategoryProvider {
48
48
  this.allCategories.set(category.identifier.key, category);
49
49
  return category;
50
50
  }
51
- async getById(payload, session) {
51
+ async getById(payload, reqCtx) {
52
52
  const category = this.allCategories.get(payload.id.key);
53
53
  if (!category) {
54
54
  const dummyCategory = this.newModel();
@@ -58,7 +58,7 @@ class FakeCategoryProvider extends CategoryProvider {
58
58
  }
59
59
  return category;
60
60
  }
61
- getBySlug(payload, session) {
61
+ getBySlug(payload, reqCtx) {
62
62
  for (const p of this.allCategories.values()) {
63
63
  if (p.slug === payload.slug) {
64
64
  return Promise.resolve(p);
@@ -66,7 +66,7 @@ class FakeCategoryProvider extends CategoryProvider {
66
66
  }
67
67
  return Promise.resolve(null);
68
68
  }
69
- getBreadcrumbPathToCategory(payload, session) {
69
+ getBreadcrumbPathToCategory(payload, reqCtx) {
70
70
  const path = new Array();
71
71
  let category = this.allCategories.get(payload.id.key);
72
72
  path.push(category);
@@ -78,7 +78,7 @@ class FakeCategoryProvider extends CategoryProvider {
78
78
  }
79
79
  return Promise.resolve(path);
80
80
  }
81
- async findChildCategories(payload, session) {
81
+ async findChildCategories(payload, reqCtx) {
82
82
  const children = this.childCategories.get(payload.parentId.key);
83
83
  const page = children?.slice((payload.paginationOptions.pageNumber - 1) * payload.paginationOptions.pageSize, payload.paginationOptions.pageNumber * payload.paginationOptions.pageSize);
84
84
  const res = {
@@ -97,7 +97,7 @@ class FakeCategoryProvider extends CategoryProvider {
97
97
  };
98
98
  return Promise.resolve(res);
99
99
  }
100
- findTopCategories(payload, session) {
100
+ findTopCategories(payload, reqCtx) {
101
101
  const children = this.topCategories;
102
102
  const page = children?.slice((payload.paginationOptions.pageNumber - 1) * payload.paginationOptions.pageSize, payload.paginationOptions.pageNumber * payload.paginationOptions.pageSize);
103
103
  const res = {
@@ -8,7 +8,7 @@ class FakeIdentityProvider extends IdentityProvider {
8
8
  this.currentIdentity = null;
9
9
  this.config = config;
10
10
  }
11
- async getSelf(_payload, _session) {
11
+ async getSelf(_payload, _reqCtx) {
12
12
  if (!this.currentIdentity) {
13
13
  const model = this.newModel();
14
14
  Object.assign(model, {
@@ -29,7 +29,7 @@ class FakeIdentityProvider extends IdentityProvider {
29
29
  }
30
30
  return this.currentIdentity;
31
31
  }
32
- async login(payload, _session) {
32
+ async login(payload, _reqCtx) {
33
33
  const generator = new Faker({
34
34
  seed: 42,
35
35
  locale: [en, base]
@@ -53,7 +53,7 @@ class FakeIdentityProvider extends IdentityProvider {
53
53
  this.currentIdentity = this.assert(model);
54
54
  return this.currentIdentity;
55
55
  }
56
- async logout(_payload, _session) {
56
+ async logout(_payload, _reqCtx) {
57
57
  const model = this.newModel();
58
58
  Object.assign(model, {
59
59
  id: "anonymous",
@@ -72,6 +72,9 @@ class FakeIdentityProvider extends IdentityProvider {
72
72
  this.currentIdentity = this.assert(model);
73
73
  return this.currentIdentity;
74
74
  }
75
+ register(payload, reqCtx) {
76
+ throw new Error("Method not implemented.");
77
+ }
75
78
  }
76
79
  export {
77
80
  FakeIdentityProvider
@@ -6,3 +6,4 @@ export * from "./inventory.provider";
6
6
  export * from "./price.provider";
7
7
  export * from "./product.provider";
8
8
  export * from "./search.provider";
9
+ export * from "./store.provider";
@@ -7,7 +7,7 @@ class FakeInventoryProvider extends InventoryProvider {
7
7
  super(schema, cache);
8
8
  this.config = config;
9
9
  }
10
- async getBySKU(payload, _session) {
10
+ async getBySKU(payload, _reqCtx) {
11
11
  let hash = 0;
12
12
  const skuString = payload.sku.key;
13
13
  for (let i = 0; i < skuString.length; i++) {
@@ -20,10 +20,8 @@ class FakeInventoryProvider extends InventoryProvider {
20
20
  });
21
21
  const model = this.newModel();
22
22
  model.identifier = {
23
- sku: { key: skuString },
24
- channelId: {
25
- key: "online"
26
- }
23
+ sku: payload.sku,
24
+ fulfillmentCenter: payload.fulfilmentCenter
27
25
  };
28
26
  model.sku = skuString;
29
27
  model.quantity = generator.number.int({ min: 0, max: 100 });
@@ -35,7 +33,7 @@ class FakeInventoryProvider extends InventoryProvider {
35
33
  model.meta = {
36
34
  cache: {
37
35
  hit: false,
38
- key: this.generateCacheKeySingle(model.identifier, _session)
36
+ key: this.generateCacheKeySingle(model.identifier, _reqCtx)
39
37
  },
40
38
  placeholder: false
41
39
  };
@@ -7,14 +7,14 @@ class FakePriceProvider extends PriceProvider {
7
7
  super(schema, cache);
8
8
  this.config = config;
9
9
  }
10
- async getBySKUs(payload, session) {
11
- const promises = payload.map((p) => this.getBySKU(p, session));
10
+ async getBySKUs(payload, reqCtx) {
11
+ const promises = payload.map((p) => this.getBySKU(p, reqCtx));
12
12
  const result = await Promise.all(promises);
13
13
  return result;
14
14
  }
15
- async getBySKU(payload, _session) {
15
+ async getBySKU(payload, _reqCtx) {
16
16
  if (payload.sku.key === "unknown-sku") {
17
- return this.createEmptyPriceResult(payload.sku.key, _session.languageContext.currencyCode);
17
+ return this.createEmptyPriceResult(payload.sku.key, _reqCtx.languageContext.currencyCode);
18
18
  }
19
19
  let hash = 0;
20
20
  const skuString = payload.sku.key;
@@ -33,7 +33,7 @@ class FakePriceProvider extends PriceProvider {
33
33
  },
34
34
  unitPrice: {
35
35
  value: generator.number.int({ min: 300, max: 1e5 }) / 100,
36
- currency: _session.languageContext.currencyCode
36
+ currency: _reqCtx.languageContext.currencyCode
37
37
  },
38
38
  meta: {
39
39
  cache: {
@@ -52,14 +52,14 @@ class FakePriceProvider extends PriceProvider {
52
52
  minimumQuantity: generator.number.int({ min: 2, max: 5 }),
53
53
  price: {
54
54
  value: tier1Price,
55
- currency: _session.languageContext.currencyCode
55
+ currency: _reqCtx.languageContext.currencyCode
56
56
  }
57
57
  },
58
58
  {
59
59
  minimumQuantity: generator.number.int({ min: 6, max: 10 }),
60
60
  price: {
61
61
  value: tier2Price,
62
- currency: _session.languageContext.currencyCode
62
+ currency: _reqCtx.languageContext.currencyCode
63
63
  }
64
64
  }
65
65
  ];
@@ -1,5 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result)
9
+ __defProp(target, key, result);
10
+ return result;
11
+ };
1
12
  import {
2
- ProductProvider
13
+ ProductProvider,
14
+ Reactionary
3
15
  } from "@reactionary/core";
4
16
  import { base, en, Faker } from "@faker-js/faker";
5
17
  class FakeProductProvider extends ProductProvider {
@@ -7,11 +19,11 @@ class FakeProductProvider extends ProductProvider {
7
19
  super(schema, cache);
8
20
  this.config = config;
9
21
  }
10
- async getById(payload, _session) {
22
+ async getById(payload, _reqCtx) {
11
23
  return this.parseSingle(payload);
12
24
  }
13
25
  // FIXME: Should we have a get-by-sku here? Since thats whats coming back on cart items...
14
- async getBySlug(payload, _session) {
26
+ async getBySlug(payload, _reqCtx) {
15
27
  return this.parseSingle(payload);
16
28
  }
17
29
  parseSingle(body) {
@@ -46,6 +58,9 @@ class FakeProductProvider extends ProductProvider {
46
58
  return this.assert(model);
47
59
  }
48
60
  }
61
+ __decorateClass([
62
+ Reactionary({})
63
+ ], FakeProductProvider.prototype, "getById", 1);
49
64
  export {
50
65
  FakeProductProvider
51
66
  };
@@ -20,7 +20,7 @@ class FakeSearchProvider extends SearchProvider {
20
20
  super(schema, cache);
21
21
  this.config = config;
22
22
  }
23
- async queryByTerm(payload, _session) {
23
+ async queryByTerm(payload, _reqCtx) {
24
24
  await jitter(this.config.jitter.mean, this.config.jitter.deviation);
25
25
  const query = payload.search;
26
26
  const querySpecificity = 20 - query.term.length - query.page - query.facets.length;
@@ -0,0 +1,26 @@
1
+ import { StoreProvider } from "@reactionary/core";
2
+ import { base, en, Faker } from "@faker-js/faker";
3
+ class FakeStoreProvider extends StoreProvider {
4
+ constructor(config, schema, cache) {
5
+ super(schema, cache);
6
+ this.config = config;
7
+ }
8
+ async queryByProximity(payload, reqCtx) {
9
+ const generator = new Faker({
10
+ seed: 42,
11
+ locale: [en, base]
12
+ });
13
+ const results = [];
14
+ for (let i = 0; i < payload.limit; i++) {
15
+ const model = this.newModel();
16
+ model.name = generator.company.name();
17
+ model.identifier.key = "" + i;
18
+ model.fulfillmentCenter.key = "" + i;
19
+ results.push(model);
20
+ }
21
+ return results;
22
+ }
23
+ }
24
+ export {
25
+ FakeStoreProvider
26
+ };
@@ -4,7 +4,10 @@ const FakeCapabilitiesSchema = CapabilitiesSchema.pick({
4
4
  search: true,
5
5
  identity: true,
6
6
  category: true,
7
- cart: true
7
+ cart: true,
8
+ inventory: true,
9
+ store: true,
10
+ price: true
8
11
  }).partial();
9
12
  export {
10
13
  FakeCapabilitiesSchema
@@ -1,6 +1,6 @@
1
- import { Cache as ReactinaryCache, ProductProvider, SearchProvider, IdentityProvider, CategoryProvider, CartProvider } from "@reactionary/core";
2
- import { FakeConfiguration } from "../schema/configuration.schema";
3
- import { FakeCapabilities } from "../schema/capabilities.schema";
1
+ import type { Cache as ReactinaryCache, ProductProvider, SearchProvider, IdentityProvider, CategoryProvider, CartProvider, InventoryProvider, StoreProvider, PriceProvider } from '@reactionary/core';
2
+ import type { FakeConfiguration } from '../schema/configuration.schema';
3
+ import type { FakeCapabilities } from '../schema/capabilities.schema';
4
4
  type FakeClient<T extends FakeCapabilities> = (T['cart'] extends true ? {
5
5
  cart: CartProvider;
6
6
  } : object) & (T['product'] extends true ? {
@@ -11,6 +11,12 @@ type FakeClient<T extends FakeCapabilities> = (T['cart'] extends true ? {
11
11
  identity: IdentityProvider;
12
12
  } : object) & (T['category'] extends true ? {
13
13
  category: CategoryProvider;
14
+ } : object) & (T['inventory'] extends true ? {
15
+ inventory: InventoryProvider;
16
+ } : object) & (T['store'] extends true ? {
17
+ store: StoreProvider;
18
+ } : object) & (T['price'] extends true ? {
19
+ price: PriceProvider;
14
20
  } : object);
15
21
  export declare function withFakeCapabilities<T extends FakeCapabilities>(configuration: FakeConfiguration, capabilities: T): (cache: ReactinaryCache) => FakeClient<T>;
16
22
  export {};
@@ -1,6 +1,7 @@
1
- import { AnalyticsProvider, BaseModel, Cache } from '@reactionary/core';
2
- import z from 'zod';
3
- import { FakeConfiguration } from '../schema/configuration.schema';
1
+ import type { BaseModel, Cache } from '@reactionary/core';
2
+ import { AnalyticsProvider } from '@reactionary/core';
3
+ import type z from 'zod';
4
+ import type { FakeConfiguration } from '../schema/configuration.schema';
4
5
  export declare class FakeAnalyticsProvider<T extends BaseModel = BaseModel> extends AnalyticsProvider<T> {
5
6
  protected config: FakeConfiguration;
6
7
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: Cache);
@@ -1,22 +1,23 @@
1
- import { Cart, CartProvider, CartQueryById, CartMutationItemAdd, CartMutationItemRemove, CartMutationItemQuantityChange, Session, Cache, CartIdentifier, CartMutationApplyCoupon, CartMutationChangeCurrency, CartMutationCheckout, CartMutationDeleteCart, CartMutationRemoveCoupon, CartMutationSetBillingAddress, CartMutationSetShippingInfo, OrderIdentifier } from '@reactionary/core';
2
- import z from 'zod';
3
- import { FakeConfiguration } from '../schema/configuration.schema';
1
+ import type { Cart, CartQueryById, CartMutationItemAdd, CartMutationItemRemove, CartMutationItemQuantityChange, RequestContext, Cache, CartIdentifier, CartMutationApplyCoupon, CartMutationChangeCurrency, CartMutationCheckout, CartMutationDeleteCart, CartMutationRemoveCoupon, CartMutationSetBillingAddress, CartMutationSetShippingInfo, OrderIdentifier } from '@reactionary/core';
2
+ import { CartProvider } from '@reactionary/core';
3
+ import type z from 'zod';
4
+ import type { FakeConfiguration } from '../schema/configuration.schema';
4
5
  export declare class FakeCartProvider<T extends Cart = Cart> extends CartProvider<T> {
5
6
  protected config: FakeConfiguration;
6
7
  private carts;
7
8
  private generator;
8
9
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: Cache);
9
- getById(payload: CartQueryById, _session: Session): Promise<T>;
10
- add(payload: CartMutationItemAdd, session: Session): Promise<T>;
11
- remove(payload: CartMutationItemRemove, session: Session): Promise<T>;
12
- changeQuantity(payload: CartMutationItemQuantityChange, session: Session): Promise<T>;
13
- getActiveCartId(session: Session): Promise<CartIdentifier>;
14
- deleteCart(payload: CartMutationDeleteCart, session: Session): Promise<T>;
15
- setShippingInfo(payload: CartMutationSetShippingInfo, session: Session): Promise<T>;
16
- setBillingAddress(payload: CartMutationSetBillingAddress, session: Session): Promise<T>;
17
- applyCouponCode(payload: CartMutationApplyCoupon, session: Session): Promise<T>;
18
- removeCouponCode(payload: CartMutationRemoveCoupon, session: Session): Promise<T>;
19
- checkout(payload: CartMutationCheckout, session: Session): Promise<OrderIdentifier>;
20
- changeCurrency(payload: CartMutationChangeCurrency, session: Session): Promise<T>;
10
+ getById(payload: CartQueryById, _reqCtx: RequestContext): Promise<T>;
11
+ add(payload: CartMutationItemAdd, reqCtx: RequestContext): Promise<T>;
12
+ remove(payload: CartMutationItemRemove, reqCtx: RequestContext): Promise<T>;
13
+ changeQuantity(payload: CartMutationItemQuantityChange, reqCtx: RequestContext): Promise<T>;
14
+ getActiveCartId(reqCtx: RequestContext): Promise<CartIdentifier>;
15
+ deleteCart(payload: CartMutationDeleteCart, reqCtx: RequestContext): Promise<T>;
16
+ setShippingInfo(payload: CartMutationSetShippingInfo, reqCtx: RequestContext): Promise<T>;
17
+ setBillingAddress(payload: CartMutationSetBillingAddress, reqCtx: RequestContext): Promise<T>;
18
+ applyCouponCode(payload: CartMutationApplyCoupon, reqCtx: RequestContext): Promise<T>;
19
+ removeCouponCode(payload: CartMutationRemoveCoupon, reqCtx: RequestContext): Promise<T>;
20
+ checkout(payload: CartMutationCheckout, reqCtx: RequestContext): Promise<OrderIdentifier>;
21
+ changeCurrency(payload: CartMutationChangeCurrency, reqCtx: RequestContext): Promise<T>;
21
22
  protected recalculateCart(cart: T): void;
22
23
  }
@@ -1,7 +1,8 @@
1
- import { Category, CategoryProvider, CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, Session } from "@reactionary/core";
2
- import { FakeConfiguration } from "../schema/configuration.schema";
3
- import { Cache as ReactionaryCache } from "@reactionary/core";
4
- import z from "zod";
1
+ import type { Category, CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext } from "@reactionary/core";
2
+ import { CategoryProvider } from "@reactionary/core";
3
+ import type { FakeConfiguration } from "../schema/configuration.schema";
4
+ import type { Cache as ReactionaryCache } from "@reactionary/core";
5
+ import type z from "zod";
5
6
  import { Faker } from '@faker-js/faker';
6
7
  export declare class FakeCategoryProvider<T extends Category = Category> extends CategoryProvider<T> {
7
8
  protected config: FakeConfiguration;
@@ -11,9 +12,9 @@ export declare class FakeCategoryProvider<T extends Category = Category> extends
11
12
  protected categoryGenerator: Faker;
12
13
  protected generateFakeCategory(parent: Category | undefined, index: number): T;
13
14
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: ReactionaryCache);
14
- getById(payload: CategoryQueryById, session: Session): Promise<T>;
15
- getBySlug(payload: CategoryQueryBySlug, session: Session): Promise<T | null>;
16
- getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb, session: Session): Promise<T[]>;
17
- findChildCategories(payload: CategoryQueryForChildCategories, session: Session): Promise<ReturnType<typeof this.parsePaginatedResult>>;
18
- findTopCategories(payload: CategoryQueryForTopCategories, session: Session): Promise<ReturnType<typeof this.parsePaginatedResult>>;
15
+ getById(payload: CategoryQueryById, reqCtx: RequestContext): Promise<T>;
16
+ getBySlug(payload: CategoryQueryBySlug, reqCtx: RequestContext): Promise<T | null>;
17
+ getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb, reqCtx: RequestContext): Promise<T[]>;
18
+ findChildCategories(payload: CategoryQueryForChildCategories, reqCtx: RequestContext): Promise<ReturnType<typeof this.parsePaginatedResult>>;
19
+ findTopCategories(payload: CategoryQueryForTopCategories, reqCtx: RequestContext): Promise<ReturnType<typeof this.parsePaginatedResult>>;
19
20
  }
@@ -1,11 +1,12 @@
1
- import { Identity, IdentityProvider, IdentityQuerySelf, IdentityMutationLogin, IdentityMutationLogout, Session, Cache } from '@reactionary/core';
2
- import z from 'zod';
3
- import { FakeConfiguration } from '../schema/configuration.schema';
1
+ import { type Identity, type IdentityQuerySelf, type IdentityMutationLogin, type IdentityMutationLogout, type RequestContext, type Cache, IdentityProvider, type IdentityMutationRegister } from '@reactionary/core';
2
+ import type z from 'zod';
3
+ import type { FakeConfiguration } from '../schema/configuration.schema';
4
4
  export declare class FakeIdentityProvider<T extends Identity = Identity> extends IdentityProvider<T> {
5
5
  protected config: FakeConfiguration;
6
6
  private currentIdentity;
7
7
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: Cache);
8
- getSelf(_payload: IdentityQuerySelf, _session: Session): Promise<T>;
9
- login(payload: IdentityMutationLogin, _session: Session): Promise<T>;
10
- logout(_payload: IdentityMutationLogout, _session: Session): Promise<T>;
8
+ getSelf(_payload: IdentityQuerySelf, _reqCtx: RequestContext): Promise<T>;
9
+ login(payload: IdentityMutationLogin, _reqCtx: RequestContext): Promise<T>;
10
+ logout(_payload: IdentityMutationLogout, _reqCtx: RequestContext): Promise<T>;
11
+ register(payload: IdentityMutationRegister, reqCtx: RequestContext): Promise<T>;
11
12
  }
@@ -6,3 +6,4 @@ export * from './inventory.provider';
6
6
  export * from './price.provider';
7
7
  export * from './product.provider';
8
8
  export * from './search.provider';
9
+ export * from './store.provider';
@@ -1,8 +1,9 @@
1
- import { Inventory, InventoryProvider, InventoryQuery, Session, Cache } from '@reactionary/core';
2
- import z from 'zod';
3
- import { FakeConfiguration } from '../schema/configuration.schema';
1
+ import type { Inventory, RequestContext, Cache, InventoryQueryBySKU } from '@reactionary/core';
2
+ import { InventoryProvider } from '@reactionary/core';
3
+ import type z from 'zod';
4
+ import type { FakeConfiguration } from '../schema/configuration.schema';
4
5
  export declare class FakeInventoryProvider<T extends Inventory = Inventory> extends InventoryProvider<T> {
5
6
  protected config: FakeConfiguration;
6
7
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: Cache);
7
- getBySKU(payload: InventoryQuery, _session: Session): Promise<T>;
8
+ getBySKU(payload: InventoryQueryBySKU, _reqCtx: RequestContext): Promise<T>;
8
9
  }
@@ -1,9 +1,9 @@
1
- import { Price, PriceProvider, PriceQueryBySku, Session, Cache } from '@reactionary/core';
2
- import z from 'zod';
3
- import { FakeConfiguration } from '../schema/configuration.schema';
1
+ import { type Price, type PriceQueryBySku, type RequestContext, type Cache, PriceProvider } from '@reactionary/core';
2
+ import type z from 'zod';
3
+ import type { FakeConfiguration } from '../schema/configuration.schema';
4
4
  export declare class FakePriceProvider<T extends Price = Price> extends PriceProvider<T> {
5
5
  protected config: FakeConfiguration;
6
6
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: Cache);
7
- getBySKUs(payload: PriceQueryBySku[], session: Session): Promise<T[]>;
8
- getBySKU(payload: PriceQueryBySku, _session: Session): Promise<T>;
7
+ getBySKUs(payload: PriceQueryBySku[], reqCtx: RequestContext): Promise<T[]>;
8
+ getBySKU(payload: PriceQueryBySku, _reqCtx: RequestContext): Promise<T>;
9
9
  }
@@ -1,10 +1,10 @@
1
- import { Product, ProductProvider, ProductQueryById, ProductQueryBySlug, Session, Cache as ReactinaryCache } from '@reactionary/core';
2
- import z from 'zod';
3
- import { FakeConfiguration } from '../schema/configuration.schema';
1
+ import { type Product, type ProductQueryById, type ProductQueryBySlug, type RequestContext, type Cache as ReactinaryCache, ProductProvider } from '@reactionary/core';
2
+ import type z from 'zod';
3
+ import type { FakeConfiguration } from '../schema/configuration.schema';
4
4
  export declare class FakeProductProvider<T extends Product = Product> extends ProductProvider<T> {
5
5
  protected config: FakeConfiguration;
6
6
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: ReactinaryCache);
7
- getById(payload: ProductQueryById, _session: Session): Promise<T>;
8
- getBySlug(payload: ProductQueryBySlug, _session: Session): Promise<T>;
7
+ getById(payload: ProductQueryById, _reqCtx: RequestContext): Promise<T>;
8
+ getBySlug(payload: ProductQueryBySlug, _reqCtx: RequestContext): Promise<T>;
9
9
  protected parseSingle(body: ProductQueryById | ProductQueryBySlug): T;
10
10
  }
@@ -1,10 +1,11 @@
1
- import { SearchProvider, SearchResult, Cache as ReactionaryCache } from '@reactionary/core';
2
- import type { SearchQueryByTerm, Session } from '@reactionary/core';
3
- import z from 'zod';
4
- import { FakeConfiguration } from '../schema/configuration.schema';
1
+ import { SearchProvider } from '@reactionary/core';
2
+ import type { SearchResult, Cache as ReactionaryCache } from '@reactionary/core';
3
+ import type { RequestContext, SearchQueryByTerm } from '@reactionary/core';
4
+ import type z from 'zod';
5
+ import type { FakeConfiguration } from '../schema/configuration.schema';
5
6
  export declare class FakeSearchProvider<T extends SearchResult = SearchResult> extends SearchProvider<T> {
6
7
  protected config: FakeConfiguration;
7
8
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: ReactionaryCache);
8
- queryByTerm(payload: SearchQueryByTerm, _session: Session): Promise<SearchResult>;
9
+ queryByTerm(payload: SearchQueryByTerm, _reqCtx: RequestContext): Promise<SearchResult>;
9
10
  protected childFunction(): number;
10
11
  }
@@ -0,0 +1,9 @@
1
+ import type { Cache, RequestContext, StoreQueryByProximity, Store } from '@reactionary/core';
2
+ import { StoreProvider } from '@reactionary/core';
3
+ import type z from 'zod';
4
+ import type { FakeConfiguration } from '../schema/configuration.schema';
5
+ export declare class FakeStoreProvider<T extends Store = Store> extends StoreProvider<T> {
6
+ protected config: FakeConfiguration;
7
+ constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: Cache);
8
+ queryByProximity(payload: StoreQueryByProximity, reqCtx: RequestContext): Promise<T[]>;
9
+ }
@@ -1,9 +1,12 @@
1
- import { z } from 'zod';
1
+ import type { z } from 'zod';
2
2
  export declare const FakeCapabilitiesSchema: z.ZodObject<{
3
- identity: z.ZodOptional<z.ZodBoolean>;
3
+ price: z.ZodOptional<z.ZodBoolean>;
4
4
  product: z.ZodOptional<z.ZodBoolean>;
5
- search: z.ZodOptional<z.ZodBoolean>;
6
5
  cart: z.ZodOptional<z.ZodBoolean>;
6
+ identity: z.ZodOptional<z.ZodBoolean>;
7
+ search: z.ZodOptional<z.ZodBoolean>;
8
+ inventory: z.ZodOptional<z.ZodBoolean>;
7
9
  category: z.ZodOptional<z.ZodBoolean>;
10
+ store: z.ZodOptional<z.ZodBoolean>;
8
11
  }, z.core.$loose>;
9
12
  export type FakeCapabilities = z.infer<typeof FakeCapabilitiesSchema>;