@reactionary/provider-fake 0.0.73 → 0.0.74

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.0.73",
3
+ "version": "0.0.74",
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "dependencies": {
7
- "@reactionary/core": "0.0.73",
7
+ "@reactionary/core": "0.0.74",
8
8
  "zod": "4.1.9",
9
9
  "@faker-js/faker": "^9.8.0"
10
10
  },
@@ -114,21 +114,12 @@ class FakeCartProvider extends CartProvider {
114
114
  deleteCart(payload) {
115
115
  throw new Error("Method not implemented.");
116
116
  }
117
- setShippingInfo(payload) {
118
- throw new Error("Method not implemented.");
119
- }
120
- setBillingAddress(payload) {
121
- throw new Error("Method not implemented.");
122
- }
123
117
  applyCouponCode(payload) {
124
118
  throw new Error("Method not implemented.");
125
119
  }
126
120
  removeCouponCode(payload) {
127
121
  throw new Error("Method not implemented.");
128
122
  }
129
- checkout(payload) {
130
- throw new Error("Method not implemented.");
131
- }
132
123
  changeCurrency(payload) {
133
124
  throw new Error("Method not implemented.");
134
125
  }
@@ -1,8 +1,8 @@
1
+ import { base, en, Faker } from "@faker-js/faker";
1
2
  import {
2
3
  InventoryIdentifierSchema,
3
4
  InventoryProvider
4
5
  } from "@reactionary/core";
5
- import { base, en, Faker } from "@faker-js/faker";
6
6
  class FakeInventoryProvider extends InventoryProvider {
7
7
  constructor(config, schema, cache, context) {
8
8
  super(schema, cache, context);
@@ -24,7 +24,6 @@ class FakeInventoryProvider extends InventoryProvider {
24
24
  variant: payload.variant,
25
25
  fulfillmentCenter: payload.fulfilmentCenter
26
26
  });
27
- model.sku = skuString;
28
27
  model.quantity = generator.number.int({ min: 0, max: 100 });
29
28
  if (model.quantity > 0) {
30
29
  model.status = "inStock";
@@ -20,20 +20,20 @@ class FakeProductProvider extends ProductProvider {
20
20
  this.config = config;
21
21
  }
22
22
  async getById(payload) {
23
- return this.parseSingle(payload);
23
+ return this.parseSingle(payload.identifier.key);
24
24
  }
25
25
  async getBySlug(payload) {
26
- return this.parseSingle(payload);
26
+ return this.parseSingle(payload.slug);
27
27
  }
28
28
  async getBySKU(payload) {
29
- return this.parseSingle(payload);
29
+ return this.parseSingle(payload.variant.sku);
30
30
  }
31
31
  parseSingle(body) {
32
32
  const generator = new Faker({
33
33
  seed: 42,
34
34
  locale: [en, base]
35
35
  });
36
- const key = body.slug || body.id;
36
+ const key = body;
37
37
  const model = this.newModel();
38
38
  Object.assign(model, {
39
39
  identifier: {
@@ -1,4 +1,4 @@
1
- import type { Cart, CartQueryById, CartMutationItemAdd, CartMutationItemRemove, CartMutationItemQuantityChange, RequestContext, Cache, CartIdentifier, CartMutationApplyCoupon, CartMutationChangeCurrency, CartMutationCheckout, CartMutationDeleteCart, CartMutationRemoveCoupon, CartMutationSetBillingAddress, CartMutationSetShippingInfo, OrderIdentifier } from '@reactionary/core';
1
+ import type { Cart, CartQueryById, CartMutationItemAdd, CartMutationItemRemove, CartMutationItemQuantityChange, RequestContext, Cache, CartIdentifier, CartMutationApplyCoupon, CartMutationChangeCurrency, CartMutationDeleteCart, CartMutationRemoveCoupon } from '@reactionary/core';
2
2
  import { CartProvider } from '@reactionary/core';
3
3
  import type z from 'zod';
4
4
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
@@ -13,11 +13,8 @@ export declare class FakeCartProvider<T extends Cart = Cart> extends CartProvide
13
13
  changeQuantity(payload: CartMutationItemQuantityChange): Promise<T>;
14
14
  getActiveCartId(): Promise<CartIdentifier>;
15
15
  deleteCart(payload: CartMutationDeleteCart): Promise<T>;
16
- setShippingInfo(payload: CartMutationSetShippingInfo): Promise<T>;
17
- setBillingAddress(payload: CartMutationSetBillingAddress): Promise<T>;
18
16
  applyCouponCode(payload: CartMutationApplyCoupon): Promise<T>;
19
17
  removeCouponCode(payload: CartMutationRemoveCoupon): Promise<T>;
20
- checkout(payload: CartMutationCheckout): Promise<OrderIdentifier>;
21
18
  changeCurrency(payload: CartMutationChangeCurrency): Promise<T>;
22
19
  protected recalculateCart(cart: T): void;
23
20
  }
@@ -1,4 +1,4 @@
1
- import type { Inventory, RequestContext, Cache, InventoryQueryBySKU } from '@reactionary/core';
1
+ import type { Cache, Inventory, InventoryQueryBySKU, RequestContext } from '@reactionary/core';
2
2
  import { InventoryProvider } from '@reactionary/core';
3
3
  import type z from 'zod';
4
4
  import type { FakeConfiguration } from '../schema/configuration.schema.js';
@@ -7,5 +7,5 @@ export declare class FakeProductProvider<T extends Product = Product> extends Pr
7
7
  getById(payload: ProductQueryById): Promise<T>;
8
8
  getBySlug(payload: ProductQueryBySlug): Promise<T>;
9
9
  getBySKU(payload: ProductQueryBySKU): Promise<T>;
10
- protected parseSingle(body: ProductQueryById | ProductQueryBySlug | ProductQueryBySKU): T;
10
+ protected parseSingle(body: string): T;
11
11
  }