@reactionary/core 0.0.62 → 0.0.64
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/client/client-builder.js +20 -1
- package/client/client.js +0 -28
- package/initialization.js +1 -1
- package/package.json +1 -1
- package/providers/base.provider.js +12 -11
- package/providers/price.provider.js +3 -3
- package/schemas/models/identity.model.js +3 -13
- package/schemas/session.schema.js +0 -2
- package/src/client/client-builder.d.ts +6 -3
- package/src/client/client.d.ts +0 -5
- package/src/providers/base.provider.d.ts +6 -5
- package/src/providers/cart.provider.d.ts +12 -13
- package/src/providers/category.provider.d.ts +5 -6
- package/src/providers/checkout.provider.d.ts +9 -10
- package/src/providers/identity.provider.d.ts +4 -5
- package/src/providers/inventory.provider.d.ts +1 -2
- package/src/providers/order.provider.d.ts +1 -2
- package/src/providers/price.provider.d.ts +3 -5
- package/src/providers/product-search.provider.d.ts +4 -8
- package/src/providers/product.provider.d.ts +3 -4
- package/src/providers/profile.provider.d.ts +2 -3
- package/src/providers/store.provider.d.ts +1 -2
- package/src/schemas/models/identity.model.d.ts +0 -20
- package/src/schemas/session.schema.d.ts +0 -44
package/client/client-builder.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { NoOpCache } from "../cache/noop-cache.js";
|
|
2
|
+
import {
|
|
3
|
+
RequestContextSchema
|
|
4
|
+
} from "../schemas/session.schema.js";
|
|
2
5
|
class ClientBuilder {
|
|
3
6
|
constructor() {
|
|
4
7
|
this.factories = [];
|
|
@@ -7,20 +10,36 @@ class ClientBuilder {
|
|
|
7
10
|
const newBuilder = new ClientBuilder();
|
|
8
11
|
newBuilder.factories = [...this.factories, factory];
|
|
9
12
|
newBuilder.cache = this.cache;
|
|
13
|
+
newBuilder.context = this.context;
|
|
10
14
|
return newBuilder;
|
|
11
15
|
}
|
|
12
16
|
withCache(cache) {
|
|
13
17
|
const newBuilder = new ClientBuilder();
|
|
14
18
|
newBuilder.factories = [...this.factories];
|
|
15
19
|
newBuilder.cache = cache;
|
|
20
|
+
newBuilder.context = this.context;
|
|
21
|
+
return newBuilder;
|
|
22
|
+
}
|
|
23
|
+
withContext(context) {
|
|
24
|
+
const newBuilder = new ClientBuilder();
|
|
25
|
+
newBuilder.factories = [...this.factories];
|
|
26
|
+
newBuilder.cache = this.cache;
|
|
27
|
+
newBuilder.context = context;
|
|
16
28
|
return newBuilder;
|
|
17
29
|
}
|
|
18
30
|
build() {
|
|
19
31
|
let client = {};
|
|
20
32
|
const sharedCache = this.cache || new NoOpCache();
|
|
33
|
+
const context = this.context || RequestContextSchema.parse({
|
|
34
|
+
languageContext: {
|
|
35
|
+
locale: "en-US",
|
|
36
|
+
currencyCode: "USD",
|
|
37
|
+
countryCode: "US"
|
|
38
|
+
}
|
|
39
|
+
});
|
|
21
40
|
const mergedAnalytics = [];
|
|
22
41
|
for (const factory of this.factories) {
|
|
23
|
-
const provider = factory(sharedCache);
|
|
42
|
+
const provider = factory(sharedCache, context);
|
|
24
43
|
client = {
|
|
25
44
|
...client,
|
|
26
45
|
...provider
|
package/client/client.js
CHANGED
|
@@ -1,29 +1 @@
|
|
|
1
1
|
import { RedisCache } from "../cache/redis-cache.js";
|
|
2
|
-
function buildClient(providerFactories, options = {}) {
|
|
3
|
-
let client = {};
|
|
4
|
-
const sharedCache = options.cache || new RedisCache();
|
|
5
|
-
const mergedAnalytics = [];
|
|
6
|
-
for (const factory of providerFactories) {
|
|
7
|
-
const provider = factory(sharedCache);
|
|
8
|
-
client = {
|
|
9
|
-
...client,
|
|
10
|
-
...provider
|
|
11
|
-
};
|
|
12
|
-
if (provider.analytics) {
|
|
13
|
-
mergedAnalytics.push(...provider.analytics);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
client.analytics = mergedAnalytics;
|
|
17
|
-
const completeClient = {
|
|
18
|
-
...client,
|
|
19
|
-
cache: sharedCache
|
|
20
|
-
};
|
|
21
|
-
return completeClient;
|
|
22
|
-
}
|
|
23
|
-
function createCache() {
|
|
24
|
-
return new RedisCache();
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
buildClient,
|
|
28
|
-
createCache
|
|
29
|
-
};
|
package/initialization.js
CHANGED
package/package.json
CHANGED
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
} from "../schemas/models/base.model.js";
|
|
4
4
|
import { hasher } from "node-object-hash";
|
|
5
5
|
class BaseProvider {
|
|
6
|
-
constructor(schema, cache) {
|
|
6
|
+
constructor(schema, cache, context) {
|
|
7
7
|
this.schema = schema;
|
|
8
8
|
this.cache = cache;
|
|
9
|
+
this.context = context;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* Validates that the final domain model constructed by the provider
|
|
@@ -24,11 +25,11 @@ class BaseProvider {
|
|
|
24
25
|
* Handler for parsing a response from a remote provider and converting it
|
|
25
26
|
* into the typed domain model.
|
|
26
27
|
*/
|
|
27
|
-
parseSingle(_body
|
|
28
|
+
parseSingle(_body) {
|
|
28
29
|
const model = this.newModel();
|
|
29
30
|
return this.assert(model);
|
|
30
31
|
}
|
|
31
|
-
parsePaginatedResult(_body
|
|
32
|
+
parsePaginatedResult(_body) {
|
|
32
33
|
return createPaginatedResponseSchema(this.schema).parse({});
|
|
33
34
|
}
|
|
34
35
|
generateDependencyIdsForModel(model) {
|
|
@@ -45,19 +46,19 @@ class BaseProvider {
|
|
|
45
46
|
const queryHash = h.hash(query);
|
|
46
47
|
return `${scope}:${queryHash}`;
|
|
47
48
|
}
|
|
48
|
-
generateCacheKeyPaginatedResult(resultSetName, res
|
|
49
|
+
generateCacheKeyPaginatedResult(resultSetName, res) {
|
|
49
50
|
const type = this.getResourceName();
|
|
50
|
-
const langPart =
|
|
51
|
-
const currencyPart =
|
|
52
|
-
const storePart =
|
|
51
|
+
const langPart = this.context.languageContext.locale;
|
|
52
|
+
const currencyPart = this.context.languageContext.currencyCode || "default";
|
|
53
|
+
const storePart = this.context.storeIdentifier?.key || "default";
|
|
53
54
|
return `${type}-${resultSetName}-paginated|pageNumber:${res.pageNumber}|pageSize:${res.pageSize}|store:${storePart}|lang:${langPart}|currency:${currencyPart}`;
|
|
54
55
|
}
|
|
55
|
-
generateCacheKeySingle(identifier
|
|
56
|
+
generateCacheKeySingle(identifier) {
|
|
56
57
|
const type = this.getResourceName();
|
|
57
58
|
const idPart = Object.entries(identifier).map(([k, v]) => `${k}:${v}`).join("#");
|
|
58
|
-
const langPart =
|
|
59
|
-
const currencyPart =
|
|
60
|
-
const storePart =
|
|
59
|
+
const langPart = this.context.languageContext.locale;
|
|
60
|
+
const currencyPart = this.context.languageContext.currencyCode || "default";
|
|
61
|
+
const storePart = this.context.storeIdentifier?.key || "default";
|
|
61
62
|
return `${type}-${idPart}|store:${storePart}|lang:${langPart}|currency:${currencyPart}`;
|
|
62
63
|
}
|
|
63
64
|
}
|
|
@@ -8,17 +8,17 @@ class PriceProvider extends BaseProvider {
|
|
|
8
8
|
* @param currency
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
|
11
|
-
createEmptyPriceResult(sku
|
|
11
|
+
createEmptyPriceResult(sku) {
|
|
12
12
|
const base = this.newModel();
|
|
13
13
|
base.identifier = {
|
|
14
14
|
variant: { sku }
|
|
15
15
|
};
|
|
16
16
|
base.unitPrice = {
|
|
17
17
|
value: -1,
|
|
18
|
-
currency
|
|
18
|
+
currency: this.context.languageContext.currencyCode
|
|
19
19
|
};
|
|
20
20
|
base.meta = {
|
|
21
|
-
cache: { hit: false, key: `price-${sku}-${
|
|
21
|
+
cache: { hit: false, key: `price-${sku}-${this.context.languageContext.currencyCode}` },
|
|
22
22
|
placeholder: true
|
|
23
23
|
};
|
|
24
24
|
return this.assert(base);
|
|
@@ -2,25 +2,15 @@ import { z } from "zod";
|
|
|
2
2
|
import { BaseModelSchema } from "./base.model.js";
|
|
3
3
|
import { IdentityIdentifierSchema } from "./identifiers.model.js";
|
|
4
4
|
const AnonymousIdentitySchema = BaseModelSchema.extend({
|
|
5
|
-
type: z.literal("Anonymous").default("Anonymous")
|
|
6
|
-
token: z.string().optional(),
|
|
7
|
-
refresh_token: z.string().optional(),
|
|
8
|
-
expiry: z.coerce.date().default(/* @__PURE__ */ new Date())
|
|
5
|
+
type: z.literal("Anonymous").default("Anonymous")
|
|
9
6
|
});
|
|
10
7
|
const GuestIdentitySchema = BaseModelSchema.extend({
|
|
11
8
|
id: IdentityIdentifierSchema.default(() => IdentityIdentifierSchema.parse({})),
|
|
12
|
-
type: z.literal("Guest").default("Guest")
|
|
13
|
-
token: z.string().optional(),
|
|
14
|
-
refresh_token: z.string().optional(),
|
|
15
|
-
expiry: z.coerce.date().default(/* @__PURE__ */ new Date())
|
|
9
|
+
type: z.literal("Guest").default("Guest")
|
|
16
10
|
});
|
|
17
11
|
const RegisteredIdentitySchema = BaseModelSchema.extend({
|
|
18
12
|
id: IdentityIdentifierSchema.default(() => IdentityIdentifierSchema.parse({})),
|
|
19
|
-
type: z.literal("Registered").default("Registered")
|
|
20
|
-
logonId: z.string().default(""),
|
|
21
|
-
token: z.string().optional(),
|
|
22
|
-
refresh_token: z.string().optional(),
|
|
23
|
-
expiry: z.coerce.date().default(/* @__PURE__ */ new Date())
|
|
13
|
+
type: z.literal("Registered").default("Registered")
|
|
24
14
|
});
|
|
25
15
|
const IdentitySchema = z.discriminatedUnion("type", [AnonymousIdentitySchema, GuestIdentitySchema, RegisteredIdentitySchema]);
|
|
26
16
|
export {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { IdentitySchema } from "./models/identity.model.js";
|
|
3
2
|
import { WebStoreIdentifierSchema } from "./models/identifiers.model.js";
|
|
4
3
|
import { CurrencySchema } from "./models/currency.model.js";
|
|
5
4
|
const LanguageContextSchema = z.looseObject({
|
|
@@ -14,7 +13,6 @@ const TaxJurisdictionSchema = z.object({
|
|
|
14
13
|
cityCode: z.string().default("")
|
|
15
14
|
});
|
|
16
15
|
const RequestContextSchema = z.looseObject({
|
|
17
|
-
identity: IdentitySchema.default(() => IdentitySchema.parse({})).describe("Read/Write. The identity of the current user. Caller is responsible for persisting any changes to the identity"),
|
|
18
16
|
session: SessionSchema.default(() => SessionSchema.parse({})).describe("Read/Write session storage. Caller is responsible for persisting any changes. Providers will prefix own values"),
|
|
19
17
|
languageContext: LanguageContextSchema.default(() => LanguageContextSchema.parse({})).describe("ReadOnly. The language and locale context for the current request."),
|
|
20
18
|
storeIdentifier: WebStoreIdentifierSchema.default(() => WebStoreIdentifierSchema.parse({})).describe("ReadOnly. The identifier of the current web store making the request."),
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import type { Cache } from
|
|
2
|
-
import type { Client } from
|
|
3
|
-
|
|
1
|
+
import type { Cache } from '../cache/cache.interface.js';
|
|
2
|
+
import type { Client } from './client.js';
|
|
3
|
+
import { type RequestContext } from '../schemas/session.schema.js';
|
|
4
|
+
type CapabilityFactory<T> = (cache: Cache, context: RequestContext) => T;
|
|
4
5
|
type MergeCapabilities<Acc, New> = Omit<Acc, keyof New> & New;
|
|
5
6
|
export declare class ClientBuilder<TClient = object> {
|
|
6
7
|
private factories;
|
|
7
8
|
private cache;
|
|
9
|
+
private context;
|
|
8
10
|
withCapability<TNew extends Partial<Client>>(factory: CapabilityFactory<TNew>): ClientBuilder<MergeCapabilities<TClient, TNew>>;
|
|
9
11
|
withCache(cache: Cache): ClientBuilder<TClient>;
|
|
12
|
+
withContext(context: RequestContext): ClientBuilder<TClient>;
|
|
10
13
|
build(): TClient & {
|
|
11
14
|
cache: Cache;
|
|
12
15
|
};
|
package/src/client/client.d.ts
CHANGED
|
@@ -20,8 +20,3 @@ export interface Client {
|
|
|
20
20
|
inventory: InventoryProvider;
|
|
21
21
|
category: CategoryProvider;
|
|
22
22
|
}
|
|
23
|
-
export interface BuildClientOptions {
|
|
24
|
-
cache?: Cache;
|
|
25
|
-
}
|
|
26
|
-
export declare function buildClient<T extends Partial<Client>>(providerFactories: Array<(cache: Cache) => T>, options?: BuildClientOptions): Required<T>;
|
|
27
|
-
export declare function createCache(): Cache;
|
|
@@ -11,7 +11,8 @@ import type { IdentifierType } from '../schemas/models/identifiers.model.js';
|
|
|
11
11
|
export declare abstract class BaseProvider<T extends BaseModel = BaseModel> {
|
|
12
12
|
readonly schema: z.ZodType<T>;
|
|
13
13
|
protected cache: Cache;
|
|
14
|
-
|
|
14
|
+
protected context: RequestContext;
|
|
15
|
+
constructor(schema: z.ZodType<T>, cache: Cache, context: RequestContext);
|
|
15
16
|
/**
|
|
16
17
|
* Validates that the final domain model constructed by the provider
|
|
17
18
|
* fulfills the schema as defined. This will throw an exception.
|
|
@@ -25,12 +26,12 @@ export declare abstract class BaseProvider<T extends BaseModel = BaseModel> {
|
|
|
25
26
|
* Handler for parsing a response from a remote provider and converting it
|
|
26
27
|
* into the typed domain model.
|
|
27
28
|
*/
|
|
28
|
-
protected parseSingle(_body: unknown
|
|
29
|
-
protected parsePaginatedResult(_body: unknown
|
|
29
|
+
protected parseSingle(_body: unknown): T;
|
|
30
|
+
protected parsePaginatedResult(_body: unknown): z.infer<ReturnType<typeof createPaginatedResponseSchema<typeof this.schema>>>;
|
|
30
31
|
generateDependencyIdsForModel(model: unknown): Array<string>;
|
|
31
32
|
protected generateCacheKeyForQuery(scope: string, query: object): string;
|
|
32
|
-
protected generateCacheKeyPaginatedResult(resultSetName: string, res: ReturnType<typeof this.parsePaginatedResult
|
|
33
|
-
protected generateCacheKeySingle(identifier: IdentifierType
|
|
33
|
+
protected generateCacheKeyPaginatedResult(resultSetName: string, res: ReturnType<typeof this.parsePaginatedResult>): string;
|
|
34
|
+
protected generateCacheKeySingle(identifier: IdentifierType): string;
|
|
34
35
|
/**
|
|
35
36
|
* Returns the abstract resource name provided by the remote system.
|
|
36
37
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseProvider } from "./base.provider.js";
|
|
2
2
|
import type { Cart } from "../schemas/models/cart.model.js";
|
|
3
3
|
import type { CartQueryById } from "../schemas/queries/cart.query.js";
|
|
4
|
-
import type { RequestContext } from "../schemas/session.schema.js";
|
|
5
4
|
import type { CartMutationApplyCoupon, CartMutationChangeCurrency, CartMutationCheckout, CartMutationDeleteCart, CartMutationItemAdd, CartMutationItemQuantityChange, CartMutationItemRemove, CartMutationRemoveCoupon, CartMutationSetBillingAddress, CartMutationSetShippingInfo } from "../schemas/mutations/cart.mutation.js";
|
|
6
5
|
import type { CartIdentifier, OrderIdentifier } from "../schemas/models/identifiers.model.js";
|
|
7
6
|
export declare abstract class CartProvider<T extends Cart = Cart> extends BaseProvider<T> {
|
|
@@ -12,14 +11,14 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
12
11
|
* @param payload
|
|
13
12
|
* @param session
|
|
14
13
|
*/
|
|
15
|
-
abstract getById(payload: CartQueryById
|
|
14
|
+
abstract getById(payload: CartQueryById): Promise<T>;
|
|
16
15
|
/**
|
|
17
16
|
* Get the active cart id for the user.
|
|
18
17
|
*
|
|
19
18
|
* Usecase: Most common usecase during site load, or after login. You want to get the active cart for the user, so you can display it in the minicart.
|
|
20
19
|
* @param session
|
|
21
20
|
*/
|
|
22
|
-
abstract getActiveCartId(
|
|
21
|
+
abstract getActiveCartId(): Promise<CartIdentifier>;
|
|
23
22
|
/**
|
|
24
23
|
* Add item to cart. If no cart exists, create a new one. Returns the updated and recalculated cart.
|
|
25
24
|
* Does not automatically consolidate items, so if you want to have second add of same item to increase quantity,
|
|
@@ -29,7 +28,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
29
28
|
* @param payload
|
|
30
29
|
* @param session
|
|
31
30
|
*/
|
|
32
|
-
abstract add(payload: CartMutationItemAdd
|
|
31
|
+
abstract add(payload: CartMutationItemAdd): Promise<T>;
|
|
33
32
|
/**
|
|
34
33
|
* Remove item from cart. If the cart is empty after removal, delete the cart. Returns the updated and recalculated cart.
|
|
35
34
|
*
|
|
@@ -37,7 +36,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
37
36
|
* @param payload
|
|
38
37
|
* @param session
|
|
39
38
|
*/
|
|
40
|
-
abstract remove(payload: CartMutationItemRemove
|
|
39
|
+
abstract remove(payload: CartMutationItemRemove): Promise<T>;
|
|
41
40
|
/**
|
|
42
41
|
* Change quantity of item in cart. If the cart is empty after change, delete the cart. Returns the updated and recalculated cart.
|
|
43
42
|
* Changing quantity to 0 is not allowed. Use the remove call instead. This is done to avoid accidental removal of item.
|
|
@@ -47,7 +46,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
47
46
|
* @param payload
|
|
48
47
|
* @param session
|
|
49
48
|
*/
|
|
50
|
-
abstract changeQuantity(payload: CartMutationItemQuantityChange
|
|
49
|
+
abstract changeQuantity(payload: CartMutationItemQuantityChange): Promise<T>;
|
|
51
50
|
/**
|
|
52
51
|
* Deletes the entire cart.
|
|
53
52
|
*
|
|
@@ -55,7 +54,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
55
54
|
* @param payload
|
|
56
55
|
* @param session
|
|
57
56
|
*/
|
|
58
|
-
abstract deleteCart(payload: CartMutationDeleteCart
|
|
57
|
+
abstract deleteCart(payload: CartMutationDeleteCart): Promise<T>;
|
|
59
58
|
/**
|
|
60
59
|
* Sets shipping method and address on the cart. Returns the updated and recalculated cart.
|
|
61
60
|
*
|
|
@@ -63,7 +62,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
63
62
|
* @param payload
|
|
64
63
|
* @param session
|
|
65
64
|
*/
|
|
66
|
-
abstract setShippingInfo(payload: CartMutationSetShippingInfo
|
|
65
|
+
abstract setShippingInfo(payload: CartMutationSetShippingInfo): Promise<T>;
|
|
67
66
|
/**
|
|
68
67
|
* Sets billing address on the cart. Returns the updated and recalculated cart.
|
|
69
68
|
*
|
|
@@ -72,7 +71,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
72
71
|
* @param payload
|
|
73
72
|
* @param session
|
|
74
73
|
*/
|
|
75
|
-
abstract setBillingAddress(payload: CartMutationSetBillingAddress
|
|
74
|
+
abstract setBillingAddress(payload: CartMutationSetBillingAddress): Promise<T>;
|
|
76
75
|
/**
|
|
77
76
|
* Applies a coupon code to the cart. Returns the updated and recalculated cart.
|
|
78
77
|
*
|
|
@@ -80,7 +79,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
80
79
|
* @param payload
|
|
81
80
|
* @param session
|
|
82
81
|
*/
|
|
83
|
-
abstract applyCouponCode(payload: CartMutationApplyCoupon
|
|
82
|
+
abstract applyCouponCode(payload: CartMutationApplyCoupon): Promise<T>;
|
|
84
83
|
/**
|
|
85
84
|
* Removes a coupon code from the cart. Returns the updated and recalculated cart.
|
|
86
85
|
*
|
|
@@ -88,7 +87,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
88
87
|
* @param payload
|
|
89
88
|
* @param session
|
|
90
89
|
*/
|
|
91
|
-
abstract removeCouponCode(payload: CartMutationRemoveCoupon
|
|
90
|
+
abstract removeCouponCode(payload: CartMutationRemoveCoupon): Promise<T>;
|
|
92
91
|
/**
|
|
93
92
|
* Checks out the cart. Returns the order identifier of the newly created order.
|
|
94
93
|
*
|
|
@@ -97,7 +96,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
97
96
|
* @param payload
|
|
98
97
|
* @param session
|
|
99
98
|
*/
|
|
100
|
-
abstract checkout(payload: CartMutationCheckout
|
|
99
|
+
abstract checkout(payload: CartMutationCheckout): Promise<OrderIdentifier>;
|
|
101
100
|
/**
|
|
102
101
|
* Changes the currency of the cart.
|
|
103
102
|
*
|
|
@@ -105,7 +104,7 @@ export declare abstract class CartProvider<T extends Cart = Cart> extends BasePr
|
|
|
105
104
|
* @param newCurrency
|
|
106
105
|
* @param session
|
|
107
106
|
*/
|
|
108
|
-
abstract changeCurrency(payload: CartMutationChangeCurrency
|
|
107
|
+
abstract changeCurrency(payload: CartMutationChangeCurrency): Promise<T>;
|
|
109
108
|
protected createEmptyCart(): T;
|
|
110
109
|
protected getResourceName(): string;
|
|
111
110
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Category } from "../schemas/models/category.model.js";
|
|
2
2
|
import type { CategoryQueryById, CategoryQueryBySlug, CategoryQueryForBreadcrumb, CategoryQueryForChildCategories, CategoryQueryForTopCategories } from "../schemas/queries/category.query.js";
|
|
3
|
-
import type { RequestContext } from "../schemas/session.schema.js";
|
|
4
3
|
import { BaseProvider } from "./base.provider.js";
|
|
5
4
|
/**
|
|
6
5
|
* CategoryProvider
|
|
@@ -26,7 +25,7 @@ export declare abstract class CategoryProvider<T extends Category = Category> ex
|
|
|
26
25
|
* @param id
|
|
27
26
|
* @param session
|
|
28
27
|
*/
|
|
29
|
-
abstract getById(payload: CategoryQueryById
|
|
28
|
+
abstract getById(payload: CategoryQueryById): Promise<T>;
|
|
30
29
|
/**
|
|
31
30
|
* Gets a single category by its seo slug
|
|
32
31
|
*
|
|
@@ -34,7 +33,7 @@ export declare abstract class CategoryProvider<T extends Category = Category> ex
|
|
|
34
33
|
* @param slug the slug
|
|
35
34
|
* @param session
|
|
36
35
|
*/
|
|
37
|
-
abstract getBySlug(payload: CategoryQueryBySlug
|
|
36
|
+
abstract getBySlug(payload: CategoryQueryBySlug): Promise<T | null>;
|
|
38
37
|
/**
|
|
39
38
|
* Gets the breadcrumb path to the category, i.e. all parents up to the root.
|
|
40
39
|
* The returned order is from root to leaf.
|
|
@@ -43,7 +42,7 @@ export declare abstract class CategoryProvider<T extends Category = Category> ex
|
|
|
43
42
|
* @param id
|
|
44
43
|
* @param session
|
|
45
44
|
*/
|
|
46
|
-
abstract getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb
|
|
45
|
+
abstract getBreadcrumbPathToCategory(payload: CategoryQueryForBreadcrumb): Promise<T[]>;
|
|
47
46
|
/**
|
|
48
47
|
* Finds all child categories of a given category.
|
|
49
48
|
*
|
|
@@ -54,7 +53,7 @@ export declare abstract class CategoryProvider<T extends Category = Category> ex
|
|
|
54
53
|
* @param id The ID of the parent category.
|
|
55
54
|
* @param session The session information.
|
|
56
55
|
*/
|
|
57
|
-
abstract findChildCategories(payload: CategoryQueryForChildCategories
|
|
56
|
+
abstract findChildCategories(payload: CategoryQueryForChildCategories): Promise<ReturnType<typeof this.parsePaginatedResult>>;
|
|
58
57
|
/**
|
|
59
58
|
* Returns all top categories, i.e. categories without a parent.
|
|
60
59
|
*
|
|
@@ -62,6 +61,6 @@ export declare abstract class CategoryProvider<T extends Category = Category> ex
|
|
|
62
61
|
* @param paginationOptions
|
|
63
62
|
* @param session
|
|
64
63
|
*/
|
|
65
|
-
abstract findTopCategories(payload: CategoryQueryForTopCategories
|
|
64
|
+
abstract findTopCategories(payload: CategoryQueryForTopCategories): Promise<ReturnType<typeof this.parsePaginatedResult>>;
|
|
66
65
|
protected getResourceName(): string;
|
|
67
66
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Checkout, PaymentMethod, ShippingMethod } from "../schemas/models/index.js";
|
|
2
|
-
import type { RequestContext } from "../schemas/session.schema.js";
|
|
3
2
|
import { BaseProvider } from "./base.provider.js";
|
|
4
3
|
import type { CheckoutMutationFinalizeCheckout, CheckoutMutationInitiateCheckout, CheckoutMutationSetShippingAddress, CheckoutMutationAddPaymentInstruction, CheckoutMutationRemovePaymentInstruction, CheckoutMutationSetShippingInstruction } from "../schemas/mutations/checkout.mutation.js";
|
|
5
4
|
import type { CheckoutQueryById, CheckoutQueryForAvailablePaymentMethods, CheckoutQueryForAvailableShippingMethods } from "../schemas/queries/index.js";
|
|
@@ -14,7 +13,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
14
13
|
* @param billingAddress the billing/shipping address to start with. This affects available shipping methods, and may be required by some payment providers.
|
|
15
14
|
* @param reqCtx
|
|
16
15
|
*/
|
|
17
|
-
abstract initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout
|
|
16
|
+
abstract initiateCheckoutForCart(payload: CheckoutMutationInitiateCheckout): Promise<T>;
|
|
18
17
|
/**
|
|
19
18
|
* Fetches an existing checkout by its identifier.
|
|
20
19
|
*
|
|
@@ -22,7 +21,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
22
21
|
* @param payload
|
|
23
22
|
* @param reqCtx
|
|
24
23
|
*/
|
|
25
|
-
abstract getById(payload: CheckoutQueryById
|
|
24
|
+
abstract getById(payload: CheckoutQueryById): Promise<T | null>;
|
|
26
25
|
/**
|
|
27
26
|
* Updates the shipping address for the checkout and recalculates the shipping methods and totals.
|
|
28
27
|
*
|
|
@@ -31,7 +30,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
31
30
|
* NOTE: Unsure this is really needed.
|
|
32
31
|
* @param shippingAddress The updated shipping address. Note: This may also be the billing address, if your store does not differentiate.
|
|
33
32
|
*/
|
|
34
|
-
abstract setShippingAddress(payload: CheckoutMutationSetShippingAddress
|
|
33
|
+
abstract setShippingAddress(payload: CheckoutMutationSetShippingAddress): Promise<T>;
|
|
35
34
|
/**
|
|
36
35
|
* Returns all available shipping methods for the given checkout. This will typically depend on the shipping address, and possibly also the items in the checkout.
|
|
37
36
|
*
|
|
@@ -40,7 +39,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
40
39
|
* @param checkoutId The checkout you want to get shipping methods for.
|
|
41
40
|
* @param reqCtx
|
|
42
41
|
*/
|
|
43
|
-
abstract getAvailableShippingMethods(payload: CheckoutQueryForAvailableShippingMethods
|
|
42
|
+
abstract getAvailableShippingMethods(payload: CheckoutQueryForAvailableShippingMethods): Promise<ShippingMethod[]>;
|
|
44
43
|
/**
|
|
45
44
|
* Returns all available payment methods for the given checkout. This will typically depend mostly on the billing address and jurisdiction.
|
|
46
45
|
*
|
|
@@ -49,20 +48,20 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
49
48
|
* @param checkoutId The checkout you want to get payment methods for.
|
|
50
49
|
* @param reqCtx
|
|
51
50
|
*/
|
|
52
|
-
abstract getAvailablePaymentMethods(payload: CheckoutQueryForAvailablePaymentMethods
|
|
51
|
+
abstract getAvailablePaymentMethods(payload: CheckoutQueryForAvailablePaymentMethods): Promise<PaymentMethod[]>;
|
|
53
52
|
/**
|
|
54
53
|
* Adds a payment instruction to the checkout. This will typically create a payment intent in the payment provider, and return whatever is needed to continue the payment process, e.g. a client secret for Stripe, or a redirect URL for PayPal.
|
|
55
54
|
*
|
|
56
55
|
* Usecase: User has chosen a payment method, and you need to start the payment process.
|
|
57
56
|
*/
|
|
58
|
-
abstract addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction
|
|
57
|
+
abstract addPaymentInstruction(payload: CheckoutMutationAddPaymentInstruction): Promise<T>;
|
|
59
58
|
/**
|
|
60
59
|
* Removes a payment instruction from the checkout. This will typically void the payment intent in the payment provider, and remove the payment instruction from the checkout.
|
|
61
60
|
*
|
|
62
61
|
* Usecase: User has decided to change payment method, or has cancelled the payment process.
|
|
63
62
|
* @param paymentInstructionId
|
|
64
63
|
*/
|
|
65
|
-
abstract removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction
|
|
64
|
+
abstract removePaymentInstruction(payload: CheckoutMutationRemovePaymentInstruction): Promise<T>;
|
|
66
65
|
/**
|
|
67
66
|
* Sets the shipping method and optional pickup point for the checkout. The pickup point can be a physical store, a locker, or similar.
|
|
68
67
|
* If it is unset, it means home delivery to the shipping address.
|
|
@@ -73,7 +72,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
73
72
|
* @param shippingMethodId
|
|
74
73
|
* @param pickupPoint
|
|
75
74
|
*/
|
|
76
|
-
abstract setShippingInstruction(payload: CheckoutMutationSetShippingInstruction
|
|
75
|
+
abstract setShippingInstruction(payload: CheckoutMutationSetShippingInstruction): Promise<T>;
|
|
77
76
|
/**
|
|
78
77
|
* Finalizes the checkout process. This typically involves creating an order from the checkout and processing payment.
|
|
79
78
|
*
|
|
@@ -82,7 +81,7 @@ export declare abstract class CheckoutProvider<T extends Checkout = Checkout> ex
|
|
|
82
81
|
* @param payload
|
|
83
82
|
* @param reqCtx
|
|
84
83
|
*/
|
|
85
|
-
abstract finalizeCheckout(payload: CheckoutMutationFinalizeCheckout
|
|
84
|
+
abstract finalizeCheckout(payload: CheckoutMutationFinalizeCheckout): Promise<T>;
|
|
86
85
|
}
|
|
87
86
|
/**
|
|
88
87
|
*
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Identity } from "../schemas/models/identity.model.js";
|
|
2
2
|
import type { IdentityMutationLogin, IdentityMutationLogout, IdentityMutationRegister } from "../schemas/mutations/identity.mutation.js";
|
|
3
3
|
import type { IdentityQuerySelf } from "../schemas/queries/identity.query.js";
|
|
4
|
-
import type { RequestContext } from "../schemas/session.schema.js";
|
|
5
4
|
import { BaseProvider } from "./base.provider.js";
|
|
6
5
|
export declare abstract class IdentityProvider<T extends Identity = Identity> extends BaseProvider<T> {
|
|
7
|
-
abstract getSelf(payload: IdentityQuerySelf
|
|
8
|
-
abstract login(payload: IdentityMutationLogin
|
|
9
|
-
abstract logout(payload: IdentityMutationLogout
|
|
10
|
-
abstract register(payload: IdentityMutationRegister
|
|
6
|
+
abstract getSelf(payload: IdentityQuerySelf): Promise<T>;
|
|
7
|
+
abstract login(payload: IdentityMutationLogin): Promise<T>;
|
|
8
|
+
abstract logout(payload: IdentityMutationLogout): Promise<T>;
|
|
9
|
+
abstract register(payload: IdentityMutationRegister): Promise<T>;
|
|
11
10
|
protected getResourceName(): string;
|
|
12
11
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Inventory } from '../schemas/models/inventory.model.js';
|
|
2
2
|
import type { InventoryQueryBySKU } from '../schemas/queries/inventory.query.js';
|
|
3
|
-
import type { RequestContext } from '../schemas/session.schema.js';
|
|
4
3
|
import { BaseProvider } from './base.provider.js';
|
|
5
4
|
export declare abstract class InventoryProvider<T extends Inventory = Inventory> extends BaseProvider<T> {
|
|
6
|
-
abstract getBySKU(payload: InventoryQueryBySKU
|
|
5
|
+
abstract getBySKU(payload: InventoryQueryBySKU): Promise<T>;
|
|
7
6
|
protected getResourceName(): string;
|
|
8
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BaseProvider } from "./base.provider.js";
|
|
2
|
-
import type { RequestContext } from "../schemas/session.schema.js";
|
|
3
2
|
import type { Order } from "../schemas/models/index.js";
|
|
4
3
|
import type { OrderQueryById } from "../schemas/queries/index.js";
|
|
5
4
|
export declare abstract class OrderProvider<T extends Order = Order> extends BaseProvider<T> {
|
|
@@ -10,7 +9,7 @@ export declare abstract class OrderProvider<T extends Order = Order> extends Bas
|
|
|
10
9
|
* @param payload
|
|
11
10
|
* @param session
|
|
12
11
|
*/
|
|
13
|
-
abstract getById(payload: OrderQueryById
|
|
12
|
+
abstract getById(payload: OrderQueryById): Promise<T>;
|
|
14
13
|
protected createEmptyOrder(): T;
|
|
15
14
|
protected getResourceName(): string;
|
|
16
15
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { Currency } from '../schemas/models/currency.model.js';
|
|
2
1
|
import type { Price } from '../schemas/models/price.model.js';
|
|
3
2
|
import type { PriceQueryBySku } from '../schemas/queries/price.query.js';
|
|
4
|
-
import type { RequestContext } from '../schemas/session.schema.js';
|
|
5
3
|
import { BaseProvider } from './base.provider.js';
|
|
6
4
|
export declare abstract class PriceProvider<T extends Price = Price> extends BaseProvider<T> {
|
|
7
5
|
/**
|
|
@@ -14,7 +12,7 @@ export declare abstract class PriceProvider<T extends Price = Price> extends Bas
|
|
|
14
12
|
* @param payload The SKU to query
|
|
15
13
|
* @param session The session information
|
|
16
14
|
*/
|
|
17
|
-
abstract getBySKU(payload: PriceQueryBySku
|
|
15
|
+
abstract getBySKU(payload: PriceQueryBySku): Promise<T>;
|
|
18
16
|
/**
|
|
19
17
|
* Fetch prices for multiple SKUs in one go.
|
|
20
18
|
*
|
|
@@ -22,7 +20,7 @@ export declare abstract class PriceProvider<T extends Price = Price> extends Bas
|
|
|
22
20
|
* @param payload The SKUs to query
|
|
23
21
|
* @param session The session information
|
|
24
22
|
*/
|
|
25
|
-
abstract getBySKUs(payload: PriceQueryBySku[]
|
|
23
|
+
abstract getBySKUs(payload: PriceQueryBySku[]): Promise<T[]>;
|
|
26
24
|
/**
|
|
27
25
|
* Utility function to create an empty price result, with a value of -1.
|
|
28
26
|
* This is used when no price is found for a given SKU + currency combination.
|
|
@@ -31,6 +29,6 @@ export declare abstract class PriceProvider<T extends Price = Price> extends Bas
|
|
|
31
29
|
* @param currency
|
|
32
30
|
* @returns
|
|
33
31
|
*/
|
|
34
|
-
protected createEmptyPriceResult(sku: string
|
|
32
|
+
protected createEmptyPriceResult(sku: string): T;
|
|
35
33
|
protected getResourceName(): string;
|
|
36
34
|
}
|
|
@@ -1,35 +1,31 @@
|
|
|
1
1
|
import type { FacetIdentifier, FacetValueIdentifier } from '../index.js';
|
|
2
2
|
import type { ProductSearchResult, ProductSearchResultFacet, ProductSearchResultFacetValue, ProductSearchResultItem, ProductSearchResultItemVariant } from '../schemas/models/product-search.model.js';
|
|
3
3
|
import type { ProductSearchQueryByTerm } from '../schemas/queries/product-search.query.js';
|
|
4
|
-
import type { RequestContext } from '../schemas/session.schema.js';
|
|
5
4
|
import { BaseProvider } from './base.provider.js';
|
|
6
5
|
export declare abstract class ProductSearchProvider<T extends ProductSearchResultItem = ProductSearchResultItem> extends BaseProvider<T> {
|
|
7
|
-
abstract queryByTerm(payload: ProductSearchQueryByTerm, reqCtx: RequestContext): Promise<ProductSearchResult>;
|
|
8
6
|
protected getResourceName(): string;
|
|
7
|
+
abstract queryByTerm(payload: ProductSearchQueryByTerm): Promise<ProductSearchResult>;
|
|
9
8
|
/**
|
|
10
9
|
* Parses a facet value from the search response.
|
|
11
10
|
* @param facetValueIdentifier The identifier for the facet value.
|
|
12
11
|
* @param label The label for the facet value.
|
|
13
12
|
* @param count The count for the facet value.
|
|
14
|
-
* @param reqCtx The request context.
|
|
15
13
|
*/
|
|
16
|
-
protected abstract parseFacetValue(facetValueIdentifier: FacetValueIdentifier, label: string, count: number
|
|
14
|
+
protected abstract parseFacetValue(facetValueIdentifier: FacetValueIdentifier, label: string, count: number): ProductSearchResultFacetValue;
|
|
17
15
|
/**
|
|
18
16
|
* Parses a facet from the search response.
|
|
19
17
|
* @param facetIdentifier The identifier for the facet.
|
|
20
18
|
* @param facetValue The value for the facet.
|
|
21
|
-
* @param reqCtx The request context.
|
|
22
19
|
*
|
|
23
20
|
* Usecase: Override this to customize the parsing of facets.
|
|
24
21
|
*/
|
|
25
|
-
protected abstract parseFacet(facetIdentifier: FacetIdentifier, facetValue: unknown
|
|
22
|
+
protected abstract parseFacet(facetIdentifier: FacetIdentifier, facetValue: unknown): ProductSearchResultFacet;
|
|
26
23
|
/**
|
|
27
24
|
* Parses a product variant from the search response.
|
|
28
25
|
* @param variant The variant data from the search response.
|
|
29
26
|
* @param product The product data from the search response.
|
|
30
|
-
* @param reqCtx The request context.
|
|
31
27
|
*
|
|
32
28
|
* Usecase: Override this to customize the parsing of product variants.
|
|
33
29
|
*/
|
|
34
|
-
protected abstract parseVariant(variant: unknown, product: unknown
|
|
30
|
+
protected abstract parseVariant(variant: unknown, product: unknown): ProductSearchResultItemVariant;
|
|
35
31
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Product } from '../schemas/models/product.model.js';
|
|
2
2
|
import { BaseProvider } from './base.provider.js';
|
|
3
|
-
import type { RequestContext } from '../schemas/session.schema.js';
|
|
4
3
|
import type { ProductQueryById, ProductQueryBySKU, ProductQueryBySlug } from '../schemas/queries/product.query.js';
|
|
5
4
|
export declare abstract class ProductProvider<T extends Product = Product> extends BaseProvider<T> {
|
|
6
5
|
/**
|
|
@@ -13,7 +12,7 @@ export declare abstract class ProductProvider<T extends Product = Product> exten
|
|
|
13
12
|
* Marketing will TYPICALLY recommend products, and in some cases maybe HeroVariants of a product.
|
|
14
13
|
* In that case, you would need to resolve the product to its hero variant first, and then get the SKU from there.
|
|
15
14
|
*/
|
|
16
|
-
abstract getById(payload: ProductQueryById
|
|
15
|
+
abstract getById(payload: ProductQueryById): Promise<T>;
|
|
17
16
|
/**
|
|
18
17
|
* Get a product by its slug.
|
|
19
18
|
* @param payload The query payload containing the product slug.
|
|
@@ -21,7 +20,7 @@ export declare abstract class ProductProvider<T extends Product = Product> exten
|
|
|
21
20
|
*
|
|
22
21
|
* Usecase: You are rendering a product detail page, and you need to fetch the product by its slug.
|
|
23
22
|
*/
|
|
24
|
-
abstract getBySlug(payload: ProductQueryBySlug
|
|
23
|
+
abstract getBySlug(payload: ProductQueryBySlug): Promise<T | null>;
|
|
25
24
|
/**
|
|
26
25
|
* Get a product by its SKU
|
|
27
26
|
* @param payload
|
|
@@ -31,7 +30,7 @@ export declare abstract class ProductProvider<T extends Product = Product> exten
|
|
|
31
30
|
* and you need to fetch the product details for that SKU. You will get the a Product back, with the variant matching the SKU set as heroSku.
|
|
32
31
|
* It might also be used on a quick-order page, or product recommendations from external system.
|
|
33
32
|
*/
|
|
34
|
-
abstract getBySKU(payload: ProductQueryBySKU
|
|
33
|
+
abstract getBySKU(payload: ProductQueryBySKU): Promise<T>;
|
|
35
34
|
/**
|
|
36
35
|
* Returns a set of Products for each variant. Is a paged response, to ensure we do not build in overfetching from the start.
|
|
37
36
|
*
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Profile } from '../schemas/models/index.js';
|
|
2
2
|
import type { ProfileMutationUpdate } from '../schemas/mutations/index.js';
|
|
3
3
|
import type { ProfileQuerySelf } from '../schemas/queries/index.js';
|
|
4
|
-
import type { RequestContext } from '../schemas/session.schema.js';
|
|
5
4
|
import { BaseProvider } from './base.provider.js';
|
|
6
5
|
export declare abstract class ProfileProvider<T extends Profile = Profile> extends BaseProvider<T> {
|
|
7
|
-
abstract getSelf(payload: ProfileQuerySelf
|
|
8
|
-
abstract update(payload: ProfileMutationUpdate
|
|
6
|
+
abstract getSelf(payload: ProfileQuerySelf): Promise<T>;
|
|
7
|
+
abstract update(payload: ProfileMutationUpdate): Promise<T>;
|
|
9
8
|
protected getResourceName(): string;
|
|
10
9
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Store } from '../schemas/models/store.model.js';
|
|
2
2
|
import type { StoreQueryByProximity } from '../schemas/queries/index.js';
|
|
3
|
-
import type { RequestContext } from '../schemas/session.schema.js';
|
|
4
3
|
import { BaseProvider } from './base.provider.js';
|
|
5
4
|
export declare abstract class StoreProvider<T extends Store = Store> extends BaseProvider<T> {
|
|
6
|
-
abstract queryByProximity(payload: StoreQueryByProximity
|
|
5
|
+
abstract queryByProximity(payload: StoreQueryByProximity): Promise<Array<T>>;
|
|
7
6
|
protected getResourceName(): string;
|
|
8
7
|
}
|
|
@@ -8,9 +8,6 @@ export declare const AnonymousIdentitySchema: z.ZodObject<{
|
|
|
8
8
|
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
9
9
|
}, z.core.$loose>>;
|
|
10
10
|
type: z.ZodDefault<z.ZodLiteral<"Anonymous">>;
|
|
11
|
-
token: z.ZodOptional<z.ZodString>;
|
|
12
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
13
|
-
expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
14
11
|
}, z.core.$loose>;
|
|
15
12
|
export declare const GuestIdentitySchema: z.ZodObject<{
|
|
16
13
|
meta: z.ZodDefault<z.ZodObject<{
|
|
@@ -24,9 +21,6 @@ export declare const GuestIdentitySchema: z.ZodObject<{
|
|
|
24
21
|
userId: z.ZodNonOptional<z.ZodDefault<z.ZodString>>;
|
|
25
22
|
}, z.core.$loose>>;
|
|
26
23
|
type: z.ZodDefault<z.ZodLiteral<"Guest">>;
|
|
27
|
-
token: z.ZodOptional<z.ZodString>;
|
|
28
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
29
|
-
expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
30
24
|
}, z.core.$loose>;
|
|
31
25
|
export declare const RegisteredIdentitySchema: z.ZodObject<{
|
|
32
26
|
meta: z.ZodDefault<z.ZodObject<{
|
|
@@ -40,10 +34,6 @@ export declare const RegisteredIdentitySchema: z.ZodObject<{
|
|
|
40
34
|
userId: z.ZodNonOptional<z.ZodDefault<z.ZodString>>;
|
|
41
35
|
}, z.core.$loose>>;
|
|
42
36
|
type: z.ZodDefault<z.ZodLiteral<"Registered">>;
|
|
43
|
-
logonId: z.ZodDefault<z.ZodString>;
|
|
44
|
-
token: z.ZodOptional<z.ZodString>;
|
|
45
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
46
|
-
expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
47
37
|
}, z.core.$loose>;
|
|
48
38
|
export declare const IdentitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
39
|
meta: z.ZodDefault<z.ZodObject<{
|
|
@@ -54,9 +44,6 @@ export declare const IdentitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
54
44
|
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
55
45
|
}, z.core.$loose>>;
|
|
56
46
|
type: z.ZodDefault<z.ZodLiteral<"Anonymous">>;
|
|
57
|
-
token: z.ZodOptional<z.ZodString>;
|
|
58
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
59
|
-
expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
60
47
|
}, z.core.$loose>, z.ZodObject<{
|
|
61
48
|
meta: z.ZodDefault<z.ZodObject<{
|
|
62
49
|
cache: z.ZodDefault<z.ZodObject<{
|
|
@@ -69,9 +56,6 @@ export declare const IdentitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
69
56
|
userId: z.ZodNonOptional<z.ZodDefault<z.ZodString>>;
|
|
70
57
|
}, z.core.$loose>>;
|
|
71
58
|
type: z.ZodDefault<z.ZodLiteral<"Guest">>;
|
|
72
|
-
token: z.ZodOptional<z.ZodString>;
|
|
73
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
74
|
-
expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
75
59
|
}, z.core.$loose>, z.ZodObject<{
|
|
76
60
|
meta: z.ZodDefault<z.ZodObject<{
|
|
77
61
|
cache: z.ZodDefault<z.ZodObject<{
|
|
@@ -84,10 +68,6 @@ export declare const IdentitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
84
68
|
userId: z.ZodNonOptional<z.ZodDefault<z.ZodString>>;
|
|
85
69
|
}, z.core.$loose>>;
|
|
86
70
|
type: z.ZodDefault<z.ZodLiteral<"Registered">>;
|
|
87
|
-
logonId: z.ZodDefault<z.ZodString>;
|
|
88
|
-
token: z.ZodOptional<z.ZodString>;
|
|
89
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
90
|
-
expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
91
71
|
}, z.core.$loose>], "type">;
|
|
92
72
|
export type AnonymousIdentity = z.infer<typeof AnonymousIdentitySchema>;
|
|
93
73
|
export type GuestIdentity = z.infer<typeof GuestIdentitySchema>;
|
|
@@ -196,50 +196,6 @@ export declare const TaxJurisdictionSchema: z.ZodObject<{
|
|
|
196
196
|
cityCode: z.ZodDefault<z.ZodString>;
|
|
197
197
|
}, z.core.$strip>;
|
|
198
198
|
export declare const RequestContextSchema: z.ZodObject<{
|
|
199
|
-
identity: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
200
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
201
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
202
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
203
|
-
key: z.ZodDefault<z.ZodString>;
|
|
204
|
-
}, z.core.$loose>>;
|
|
205
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
206
|
-
}, z.core.$loose>>;
|
|
207
|
-
type: z.ZodDefault<z.ZodLiteral<"Anonymous">>;
|
|
208
|
-
token: z.ZodOptional<z.ZodString>;
|
|
209
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
210
|
-
expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
211
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
212
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
213
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
214
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
215
|
-
key: z.ZodDefault<z.ZodString>;
|
|
216
|
-
}, z.core.$loose>>;
|
|
217
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
218
|
-
}, z.core.$loose>>;
|
|
219
|
-
id: z.ZodDefault<z.ZodObject<{
|
|
220
|
-
userId: z.ZodNonOptional<z.ZodDefault<z.ZodString>>;
|
|
221
|
-
}, z.core.$loose>>;
|
|
222
|
-
type: z.ZodDefault<z.ZodLiteral<"Guest">>;
|
|
223
|
-
token: z.ZodOptional<z.ZodString>;
|
|
224
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
225
|
-
expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
226
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
227
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
228
|
-
cache: z.ZodDefault<z.ZodObject<{
|
|
229
|
-
hit: z.ZodDefault<z.ZodBoolean>;
|
|
230
|
-
key: z.ZodDefault<z.ZodString>;
|
|
231
|
-
}, z.core.$loose>>;
|
|
232
|
-
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
233
|
-
}, z.core.$loose>>;
|
|
234
|
-
id: z.ZodDefault<z.ZodObject<{
|
|
235
|
-
userId: z.ZodNonOptional<z.ZodDefault<z.ZodString>>;
|
|
236
|
-
}, z.core.$loose>>;
|
|
237
|
-
type: z.ZodDefault<z.ZodLiteral<"Registered">>;
|
|
238
|
-
logonId: z.ZodDefault<z.ZodString>;
|
|
239
|
-
token: z.ZodOptional<z.ZodString>;
|
|
240
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
241
|
-
expiry: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
242
|
-
}, z.core.$loose>], "type">>;
|
|
243
199
|
session: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
244
200
|
languageContext: z.ZodDefault<z.ZodObject<{
|
|
245
201
|
locale: z.ZodDefault<z.ZodString>;
|