@reactionary/provider-fake 0.2.19 → 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 +2 -2
- package/providers/analytics.provider.js +2 -0
- package/providers/cart.provider.js +2 -1
- package/providers/category.provider.js +2 -1
- package/providers/checkout.provider.js +8 -4
- package/providers/identity.provider.js +2 -1
- package/providers/inventory.provider.js +2 -1
- package/providers/order-search.provider.js +2 -1
- package/providers/order.provider.js +2 -1
- package/providers/price.provider.js +2 -1
- package/providers/product-search.provider.js +2 -1
- package/providers/product.provider.js +7 -2
- package/providers/profile.provider.js +2 -1
- package/providers/store.provider.js +2 -1
- package/src/providers/analytics.provider.d.ts +2 -1
- package/src/providers/category.provider.d.ts +3 -51
- package/src/providers/checkout.provider.d.ts +1 -3
- package/src/providers/profile.provider.d.ts +1 -3
- package/src/schema/capabilities.schema.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/provider-fake",
|
|
3
|
-
"version": "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.
|
|
7
|
+
"@reactionary/core": "0.3.1",
|
|
8
8
|
"zod": "4.1.9",
|
|
9
9
|
"@faker-js/faker": "^9.8.0"
|
|
10
10
|
},
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import {
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import { success, error, CategoryPaginatedResultSchema, CategoryProvider, CategoryQueryByIdSchema, CategoryQueryBySlugSchema, CategoryQueryForBreadcrumbSchema, CategoryQueryForChildCategoriesSchema, CategoryQueryForTopCategoriesSchema, CategorySchema, Reactionary } from "@reactionary/core";
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import {
|
|
@@ -21,9 +22,12 @@ import {
|
|
|
21
22
|
CheckoutMutationRemovePaymentInstructionSchema,
|
|
22
23
|
CheckoutMutationSetShippingInstructionSchema,
|
|
23
24
|
CheckoutMutationFinalizeCheckoutSchema,
|
|
24
|
-
success
|
|
25
|
+
success,
|
|
26
|
+
PaymentMethodSchema,
|
|
27
|
+
ShippingMethodSchema
|
|
25
28
|
} from "@reactionary/core";
|
|
26
29
|
import { base, en, Faker } from "@faker-js/faker";
|
|
30
|
+
import z from "zod";
|
|
27
31
|
class FakeCheckoutProvider extends CheckoutProvider {
|
|
28
32
|
constructor(config, cache, context) {
|
|
29
33
|
super(cache, context);
|
|
@@ -181,13 +185,13 @@ __decorateClass([
|
|
|
181
185
|
__decorateClass([
|
|
182
186
|
Reactionary({
|
|
183
187
|
inputSchema: CheckoutQueryForAvailableShippingMethodsSchema,
|
|
184
|
-
outputSchema:
|
|
188
|
+
outputSchema: z.array(ShippingMethodSchema)
|
|
185
189
|
})
|
|
186
190
|
], FakeCheckoutProvider.prototype, "getAvailableShippingMethods", 1);
|
|
187
191
|
__decorateClass([
|
|
188
192
|
Reactionary({
|
|
189
193
|
inputSchema: CheckoutQueryForAvailablePaymentMethodsSchema,
|
|
190
|
-
outputSchema:
|
|
194
|
+
outputSchema: z.array(PaymentMethodSchema)
|
|
191
195
|
})
|
|
192
196
|
], FakeCheckoutProvider.prototype, "getAvailablePaymentMethods", 1);
|
|
193
197
|
__decorateClass([
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import {
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import { base, en, Faker } from "@faker-js/faker";
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import {
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import {
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import {
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import {
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import {
|
|
@@ -73,7 +74,11 @@ class FakeProductProvider extends ProductProvider {
|
|
|
73
74
|
__decorateClass([
|
|
74
75
|
Reactionary({
|
|
75
76
|
inputSchema: ProductQueryByIdSchema,
|
|
76
|
-
outputSchema: ProductSchema
|
|
77
|
+
outputSchema: ProductSchema,
|
|
78
|
+
cache: true,
|
|
79
|
+
cacheTimeToLiveInSeconds: 300,
|
|
80
|
+
currencyDependentCaching: false,
|
|
81
|
+
localeDependentCaching: true
|
|
77
82
|
})
|
|
78
83
|
], FakeProductProvider.prototype, "getById", 1);
|
|
79
84
|
__decorateClass([
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import {
|
|
@@ -5,7 +5,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
8
|
+
if (kind && result)
|
|
9
|
+
__defProp(target, key, result);
|
|
9
10
|
return result;
|
|
10
11
|
};
|
|
11
12
|
import { Reactionary, StoreProvider, StoreQueryByProximitySchema, StoreSchema, success } from "@reactionary/core";
|
|
@@ -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
|
-
|
|
10
|
-
|
|
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>;
|