@reactionary/provider-fake 0.0.48 → 0.0.52

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.
@@ -7,15 +7,15 @@ import {
7
7
  StoreSchema,
8
8
  PriceSchema
9
9
  } from "@reactionary/core";
10
- import { FakeProductProvider } from "../providers/product.provider";
11
- import { FakeSearchProvider } from "../providers/search.provider";
12
- import { FakeCategoryProvider } from "../providers/category.provider";
10
+ import { FakeProductProvider } from "../providers/product.provider.js";
11
+ import { FakeSearchProvider } from "../providers/search.provider.js";
12
+ import { FakeCategoryProvider } from "../providers/category.provider.js";
13
13
  import {
14
14
  FakeCartProvider,
15
15
  FakeInventoryProvider,
16
16
  FakePriceProvider,
17
17
  FakeStoreProvider
18
- } from "../providers";
18
+ } from "../providers/index.js";
19
19
  function withFakeCapabilities(configuration, capabilities) {
20
20
  return (cache) => {
21
21
  const client = {};
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./core/initialize";
2
- export * from "./providers/";
3
- export * from "./schema/capabilities.schema";
4
- export * from "./schema/configuration.schema";
1
+ export * from "./core/initialize.js";
2
+ export * from "./providers/index.js";
3
+ export * from "./schema/capabilities.schema.js";
4
+ export * from "./schema/configuration.schema.js";
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@reactionary/provider-fake",
3
- "version": "0.0.48",
3
+ "version": "0.0.52",
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "dependencies": {
7
- "@reactionary/core": "0.0.48",
8
- "@reactionary/otel": "0.0.48",
7
+ "@reactionary/core": "0.0.52",
9
8
  "zod": "4.1.9",
10
9
  "@faker-js/faker": "^9.8.0"
11
- }
10
+ },
11
+ "type": "module"
12
12
  }
@@ -1,4 +1,15 @@
1
- import { CategoryProvider } from "@reactionary/core";
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
+ };
12
+ import { CategoryProvider, Reactionary } from "@reactionary/core";
2
13
  import { Faker, en, base } from "@faker-js/faker";
3
14
  class FakeCategoryProvider extends CategoryProvider {
4
15
  constructor(config, schema, cache) {
@@ -117,6 +128,15 @@ class FakeCategoryProvider extends CategoryProvider {
117
128
  return Promise.resolve(res);
118
129
  }
119
130
  }
131
+ __decorateClass([
132
+ Reactionary({})
133
+ ], FakeCategoryProvider.prototype, "getById", 1);
134
+ __decorateClass([
135
+ Reactionary({})
136
+ ], FakeCategoryProvider.prototype, "getBySlug", 1);
137
+ __decorateClass([
138
+ Reactionary({})
139
+ ], FakeCategoryProvider.prototype, "getBreadcrumbPathToCategory", 1);
120
140
  export {
121
141
  FakeCategoryProvider
122
142
  };
@@ -1,9 +1,9 @@
1
- export * from "./analytics.provider";
2
- export * from "./cart.provider";
3
- export * from "./category.provider";
4
- export * from "./identity.provider";
5
- export * from "./inventory.provider";
6
- export * from "./price.provider";
7
- export * from "./product.provider";
8
- export * from "./search.provider";
9
- export * from "./store.provider";
1
+ export * from "./analytics.provider.js";
2
+ export * from "./cart.provider.js";
3
+ export * from "./category.provider.js";
4
+ export * from "./identity.provider.js";
5
+ export * from "./inventory.provider.js";
6
+ export * from "./price.provider.js";
7
+ export * from "./product.provider.js";
8
+ export * from "./search.provider.js";
9
+ export * from "./store.provider.js";
@@ -22,10 +22,12 @@ class FakeProductProvider extends ProductProvider {
22
22
  async getById(payload, _reqCtx) {
23
23
  return this.parseSingle(payload);
24
24
  }
25
- // FIXME: Should we have a get-by-sku here? Since thats whats coming back on cart items...
26
25
  async getBySlug(payload, _reqCtx) {
27
26
  return this.parseSingle(payload);
28
27
  }
28
+ async getBySKU(payload, reqCtx) {
29
+ return this.parseSingle(payload);
30
+ }
29
31
  parseSingle(body) {
30
32
  const generator = new Faker({
31
33
  seed: 42,
@@ -61,6 +63,12 @@ class FakeProductProvider extends ProductProvider {
61
63
  __decorateClass([
62
64
  Reactionary({})
63
65
  ], FakeProductProvider.prototype, "getById", 1);
66
+ __decorateClass([
67
+ Reactionary({})
68
+ ], FakeProductProvider.prototype, "getBySlug", 1);
69
+ __decorateClass([
70
+ Reactionary({})
71
+ ], FakeProductProvider.prototype, "getBySKU", 1);
64
72
  export {
65
73
  FakeProductProvider
66
74
  };
@@ -1,20 +1,8 @@
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
- };
12
1
  import {
13
2
  SearchProvider
14
3
  } from "@reactionary/core";
15
4
  import { Faker, en, base } from "@faker-js/faker";
16
- import { jitter } from "../utilities/jitter";
17
- import { traced } from "@reactionary/otel";
5
+ import { jitter } from "../utilities/jitter.js";
18
6
  class FakeSearchProvider extends SearchProvider {
19
7
  constructor(config, schema, cache) {
20
8
  super(schema, cache);
@@ -106,12 +94,6 @@ class FakeSearchProvider extends SearchProvider {
106
94
  return foo;
107
95
  }
108
96
  }
109
- __decorateClass([
110
- traced()
111
- ], FakeSearchProvider.prototype, "queryByTerm", 1);
112
- __decorateClass([
113
- traced()
114
- ], FakeSearchProvider.prototype, "childFunction", 1);
115
97
  export {
116
98
  FakeSearchProvider
117
99
  };
@@ -1,6 +1,6 @@
1
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';
2
+ import type { FakeConfiguration } from '../schema/configuration.schema.js';
3
+ import type { FakeCapabilities } from '../schema/capabilities.schema.js';
4
4
  type FakeClient<T extends FakeCapabilities> = (T['cart'] extends true ? {
5
5
  cart: CartProvider;
6
6
  } : object) & (T['product'] extends true ? {
package/src/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './core/initialize';
2
- export * from './providers/';
3
- export * from './schema/capabilities.schema';
4
- export * from './schema/configuration.schema';
1
+ export * from './core/initialize.js';
2
+ export * from './providers/index.js';
3
+ export * from './schema/capabilities.schema.js';
4
+ export * from './schema/configuration.schema.js';
@@ -1,7 +1,7 @@
1
1
  import type { BaseModel, Cache } from '@reactionary/core';
2
2
  import { AnalyticsProvider } from '@reactionary/core';
3
3
  import type z from 'zod';
4
- import type { FakeConfiguration } from '../schema/configuration.schema';
4
+ import type { FakeConfiguration } from '../schema/configuration.schema.js';
5
5
  export declare class FakeAnalyticsProvider<T extends BaseModel = BaseModel> extends AnalyticsProvider<T> {
6
6
  protected config: FakeConfiguration;
7
7
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: Cache);
@@ -1,7 +1,7 @@
1
1
  import type { Cart, CartQueryById, CartMutationItemAdd, CartMutationItemRemove, CartMutationItemQuantityChange, RequestContext, Cache, CartIdentifier, CartMutationApplyCoupon, CartMutationChangeCurrency, CartMutationCheckout, CartMutationDeleteCart, CartMutationRemoveCoupon, CartMutationSetBillingAddress, CartMutationSetShippingInfo, OrderIdentifier } from '@reactionary/core';
2
2
  import { CartProvider } from '@reactionary/core';
3
3
  import type z from 'zod';
4
- import type { FakeConfiguration } from '../schema/configuration.schema';
4
+ import type { FakeConfiguration } from '../schema/configuration.schema.js';
5
5
  export declare class FakeCartProvider<T extends Cart = Cart> extends CartProvider<T> {
6
6
  protected config: FakeConfiguration;
7
7
  private carts;
@@ -1,6 +1,6 @@
1
1
  import type { Category, CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories, RequestContext } from "@reactionary/core";
2
2
  import { CategoryProvider } from "@reactionary/core";
3
- import type { FakeConfiguration } from "../schema/configuration.schema";
3
+ import type { FakeConfiguration } from "../schema/configuration.schema.js";
4
4
  import type { Cache as ReactionaryCache } from "@reactionary/core";
5
5
  import type z from "zod";
6
6
  import { Faker } from '@faker-js/faker';
@@ -1,6 +1,6 @@
1
1
  import { type Identity, type IdentityQuerySelf, type IdentityMutationLogin, type IdentityMutationLogout, type RequestContext, type Cache, IdentityProvider, type IdentityMutationRegister } from '@reactionary/core';
2
2
  import type z from 'zod';
3
- import type { FakeConfiguration } from '../schema/configuration.schema';
3
+ import type { FakeConfiguration } from '../schema/configuration.schema.js';
4
4
  export declare class FakeIdentityProvider<T extends Identity = Identity> extends IdentityProvider<T> {
5
5
  protected config: FakeConfiguration;
6
6
  private currentIdentity;
@@ -1,9 +1,9 @@
1
- export * from './analytics.provider';
2
- export * from './cart.provider';
3
- export * from './category.provider';
4
- export * from './identity.provider';
5
- export * from './inventory.provider';
6
- export * from './price.provider';
7
- export * from './product.provider';
8
- export * from './search.provider';
9
- export * from './store.provider';
1
+ export * from './analytics.provider.js';
2
+ export * from './cart.provider.js';
3
+ export * from './category.provider.js';
4
+ export * from './identity.provider.js';
5
+ export * from './inventory.provider.js';
6
+ export * from './price.provider.js';
7
+ export * from './product.provider.js';
8
+ export * from './search.provider.js';
9
+ export * from './store.provider.js';
@@ -1,7 +1,7 @@
1
1
  import type { Inventory, RequestContext, Cache, InventoryQueryBySKU } from '@reactionary/core';
2
2
  import { InventoryProvider } from '@reactionary/core';
3
3
  import type z from 'zod';
4
- import type { FakeConfiguration } from '../schema/configuration.schema';
4
+ import type { FakeConfiguration } from '../schema/configuration.schema.js';
5
5
  export declare class FakeInventoryProvider<T extends Inventory = Inventory> extends InventoryProvider<T> {
6
6
  protected config: FakeConfiguration;
7
7
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: Cache);
@@ -1,6 +1,6 @@
1
1
  import { type Price, type PriceQueryBySku, type RequestContext, type Cache, PriceProvider } from '@reactionary/core';
2
2
  import type z from 'zod';
3
- import type { FakeConfiguration } from '../schema/configuration.schema';
3
+ import type { FakeConfiguration } from '../schema/configuration.schema.js';
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);
@@ -1,10 +1,11 @@
1
- import { type Product, type ProductQueryById, type ProductQueryBySlug, type RequestContext, type Cache as ReactinaryCache, ProductProvider } from '@reactionary/core';
1
+ import { type Product, type ProductQueryById, type ProductQueryBySlug, type RequestContext, type Cache as ReactinaryCache, ProductProvider, type ProductQueryBySKU } from '@reactionary/core';
2
2
  import type z from 'zod';
3
- import type { FakeConfiguration } from '../schema/configuration.schema';
3
+ import type { FakeConfiguration } from '../schema/configuration.schema.js';
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
7
  getById(payload: ProductQueryById, _reqCtx: RequestContext): Promise<T>;
8
8
  getBySlug(payload: ProductQueryBySlug, _reqCtx: RequestContext): Promise<T>;
9
- protected parseSingle(body: ProductQueryById | ProductQueryBySlug): T;
9
+ getBySKU(payload: ProductQueryBySKU, reqCtx: RequestContext): Promise<T>;
10
+ protected parseSingle(body: ProductQueryById | ProductQueryBySlug | ProductQueryBySKU): T;
10
11
  }
@@ -2,7 +2,7 @@ import { SearchProvider } from '@reactionary/core';
2
2
  import type { SearchResult, Cache as ReactionaryCache } from '@reactionary/core';
3
3
  import type { RequestContext, SearchQueryByTerm } from '@reactionary/core';
4
4
  import type z from 'zod';
5
- import type { FakeConfiguration } from '../schema/configuration.schema';
5
+ import type { FakeConfiguration } from '../schema/configuration.schema.js';
6
6
  export declare class FakeSearchProvider<T extends SearchResult = SearchResult> extends SearchProvider<T> {
7
7
  protected config: FakeConfiguration;
8
8
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: ReactionaryCache);
@@ -1,7 +1,7 @@
1
1
  import type { Cache, RequestContext, StoreQueryByProximity, Store } from '@reactionary/core';
2
2
  import { StoreProvider } from '@reactionary/core';
3
3
  import type z from 'zod';
4
- import type { FakeConfiguration } from '../schema/configuration.schema';
4
+ import type { FakeConfiguration } from '../schema/configuration.schema.js';
5
5
  export declare class FakeStoreProvider<T extends Store = Store> extends StoreProvider<T> {
6
6
  protected config: FakeConfiguration;
7
7
  constructor(config: FakeConfiguration, schema: z.ZodType<T>, cache: Cache);
@@ -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
- cart: z.ZodOptional<z.ZodBoolean>;
6
5
  identity: z.ZodOptional<z.ZodBoolean>;
7
6
  search: z.ZodOptional<z.ZodBoolean>;
7
+ cart: z.ZodOptional<z.ZodBoolean>;
8
8
  inventory: z.ZodOptional<z.ZodBoolean>;
9
9
  category: z.ZodOptional<z.ZodBoolean>;
10
10
  store: z.ZodOptional<z.ZodBoolean>;