@reactionary/core 0.1.9 → 0.1.11
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.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { RedisCache } from "../cache/redis-cache.js";
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import type { Client } from './client.js';
|
|
|
3
3
|
import { type RequestContext } from '../schemas/session.schema.js';
|
|
4
4
|
type CapabilityFactory<T> = (cache: Cache, context: RequestContext) => T;
|
|
5
5
|
type MergeCapabilities<Acc, New> = Omit<Acc, keyof New> & New;
|
|
6
|
-
export declare class ClientBuilder<TClient =
|
|
6
|
+
export declare class ClientBuilder<TClient = Client> {
|
|
7
7
|
private factories;
|
|
8
8
|
private cache;
|
|
9
9
|
private context;
|
package/src/client/client.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { PriceProvider } from "../providers/price.provider.js";
|
|
|
7
7
|
import type { InventoryProvider } from "../providers/inventory.provider.js";
|
|
8
8
|
import type { Cache } from "../cache/cache.interface.js";
|
|
9
9
|
import type { CategoryProvider } from "../providers/category.provider.js";
|
|
10
|
-
import type { CheckoutProvider } from "../providers/index.js";
|
|
10
|
+
import type { CheckoutProvider, OrderProvider, ProfileProvider, StoreProvider } from "../providers/index.js";
|
|
11
11
|
export interface Client {
|
|
12
12
|
product: ProductProvider;
|
|
13
13
|
productSearch: ProductSearchProvider;
|
|
@@ -19,4 +19,7 @@ export interface Client {
|
|
|
19
19
|
price: PriceProvider;
|
|
20
20
|
inventory: InventoryProvider;
|
|
21
21
|
category: CategoryProvider;
|
|
22
|
+
profile: ProfileProvider;
|
|
23
|
+
store: StoreProvider;
|
|
24
|
+
order: OrderProvider;
|
|
22
25
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { InferType } from '../zod-utils.js';
|
|
3
|
+
import type { Client } from '../client/client.js';
|
|
3
4
|
export declare const CapabilitiesSchema: z.ZodObject<{
|
|
4
5
|
product: z.ZodBoolean;
|
|
5
6
|
productSearch: z.ZodBoolean;
|
|
@@ -15,3 +16,6 @@ export declare const CapabilitiesSchema: z.ZodObject<{
|
|
|
15
16
|
profile: z.ZodBoolean;
|
|
16
17
|
}, z.core.$loose>;
|
|
17
18
|
export type Capabilities = InferType<typeof CapabilitiesSchema>;
|
|
19
|
+
export type ClientFromCapabilities<C extends Partial<Capabilities>> = {
|
|
20
|
+
[K in keyof C & keyof Client as C[K] extends true ? K : never]: Client[K];
|
|
21
|
+
};
|