@reactionary/core 0.3.9 → 0.3.10
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/decorators/reactionary.decorator.js +1 -1
- package/package.json +1 -1
- package/schemas/capabilities.schema.js +1 -1
- package/schemas/errors/generic.error.js +1 -1
- package/schemas/errors/invalid-input.error.js +1 -1
- package/schemas/errors/invalid-output.error.js +1 -1
- package/schemas/errors/not-found.error.js +1 -1
- package/schemas/models/base.model.js +11 -11
- package/schemas/models/cart.model.js +1 -1
- package/schemas/models/category.model.js +1 -1
- package/schemas/models/checkout.model.js +2 -2
- package/schemas/models/cost.model.js +1 -1
- package/schemas/models/currency.model.js +1 -1
- package/schemas/models/identifiers.model.js +16 -16
- package/schemas/models/identity.model.js +1 -1
- package/schemas/models/inventory.model.js +1 -1
- package/schemas/models/order-search.model.js +1 -1
- package/schemas/models/order.model.js +1 -1
- package/schemas/models/payment.model.js +2 -2
- package/schemas/models/price.model.js +3 -3
- package/schemas/models/product-recommendations.model.js +3 -3
- package/schemas/models/product-search.model.js +2 -2
- package/schemas/models/product.model.js +24 -24
- package/schemas/models/profile.model.js +1 -1
- package/schemas/models/shipping-method.model.js +8 -8
- package/schemas/models/store.model.js +1 -1
- package/schemas/mutations/analytics/index.js +1 -1
- package/schemas/mutations/analytics/product-add-to-cart.mutation.js +1 -1
- package/schemas/mutations/analytics/product-details-view.mutation.js +1 -1
- package/schemas/mutations/analytics/product-summary-click.mutation.js +1 -1
- package/schemas/mutations/analytics/product-summary-view.mutation.js +1 -1
- package/schemas/mutations/analytics/purchase.mutation.js +1 -1
- package/schemas/mutations/base.mutation.js +1 -1
- package/schemas/mutations/cart.mutation.js +1 -1
- package/schemas/mutations/checkout.mutation.js +1 -1
- package/schemas/mutations/identity.mutation.js +1 -1
- package/schemas/mutations/inventory.mutation.js +1 -1
- package/schemas/mutations/price.mutation.js +1 -1
- package/schemas/mutations/product.mutation.js +1 -1
- package/schemas/mutations/profile.mutation.js +3 -3
- package/schemas/mutations/search.mutation.js +1 -1
- package/schemas/queries/analytics.query.js +1 -1
- package/schemas/queries/base.query.js +1 -1
- package/schemas/queries/category.query.js +1 -1
- package/schemas/queries/product-associations.query.js +2 -2
- package/schemas/queries/product-recommendations.query.js +12 -12
- package/schemas/queries/product-search.query.js +3 -3
- package/schemas/queries/product.query.js +1 -1
- package/schemas/queries/store.query.js +1 -1
- package/schemas/session.schema.js +6 -6
- package/src/cache/cache.interface.d.ts +1 -1
- package/src/cache/memory-cache.d.ts +1 -1
- package/src/cache/noop-cache.d.ts +1 -1
- package/src/cache/redis-cache.d.ts +1 -1
- package/src/decorators/reactionary.decorator.d.ts +1 -1
- package/src/schemas/capabilities.schema.d.ts +1 -1
- package/src/schemas/errors/generic.error.d.ts +1 -1
- package/src/schemas/errors/invalid-input.error.d.ts +1 -1
- package/src/schemas/errors/invalid-output.error.d.ts +1 -1
- package/src/schemas/errors/not-found.error.d.ts +1 -1
- package/src/schemas/models/analytics.model.d.ts +1 -1
- package/src/schemas/models/base.model.d.ts +1 -1
- package/src/schemas/models/cart.model.d.ts +1 -1
- package/src/schemas/models/category.model.d.ts +1 -1
- package/src/schemas/models/checkout.model.d.ts +1 -1
- package/src/schemas/models/cost.model.d.ts +1 -1
- package/src/schemas/models/currency.model.d.ts +1 -1
- package/src/schemas/models/identifiers.model.d.ts +1 -1
- package/src/schemas/models/identity.model.d.ts +1 -1
- package/src/schemas/models/inventory.model.d.ts +1 -1
- package/src/schemas/models/order-search.model.d.ts +1 -1
- package/src/schemas/models/order.model.d.ts +1 -1
- package/src/schemas/models/payment.model.d.ts +1 -1
- package/src/schemas/models/price.model.d.ts +1 -1
- package/src/schemas/models/product-recommendations.model.d.ts +1 -1
- package/src/schemas/models/product-search.model.d.ts +1 -1
- package/src/schemas/models/product.model.d.ts +1 -1
- package/src/schemas/models/profile.model.d.ts +1 -1
- package/src/schemas/models/shipping-method.model.d.ts +1 -1
- package/src/schemas/models/store.model.d.ts +1 -1
- package/src/schemas/mutations/analytics/index.d.ts +1 -1
- package/src/schemas/mutations/analytics/product-add-to-cart.mutation.d.ts +1 -1
- package/src/schemas/mutations/analytics/product-details-view.mutation.d.ts +1 -1
- package/src/schemas/mutations/analytics/product-summary-click.mutation.d.ts +1 -1
- package/src/schemas/mutations/analytics/product-summary-view.mutation.d.ts +1 -1
- package/src/schemas/mutations/analytics/purchase.mutation.d.ts +1 -1
- package/src/schemas/mutations/base.mutation.d.ts +1 -1
- package/src/schemas/mutations/cart.mutation.d.ts +1 -1
- package/src/schemas/mutations/checkout.mutation.d.ts +1 -1
- package/src/schemas/mutations/identity.mutation.d.ts +1 -1
- package/src/schemas/mutations/profile.mutation.d.ts +1 -1
- package/src/schemas/queries/base.query.d.ts +1 -1
- package/src/schemas/queries/category.query.d.ts +1 -1
- package/src/schemas/queries/checkout.query.d.ts +1 -1
- package/src/schemas/queries/identity.query.d.ts +1 -1
- package/src/schemas/queries/inventory.query.d.ts +1 -1
- package/src/schemas/queries/order.query.d.ts +1 -1
- package/src/schemas/queries/price.query.d.ts +1 -1
- package/src/schemas/queries/product-associations.query.d.ts +1 -1
- package/src/schemas/queries/product-recommendations.query.d.ts +1 -1
- package/src/schemas/queries/product-search.query.d.ts +1 -1
- package/src/schemas/queries/product.query.d.ts +1 -1
- package/src/schemas/queries/profile.query.d.ts +1 -1
- package/src/schemas/queries/store.query.d.ts +1 -1
- package/src/schemas/session.schema.d.ts +1 -1
- package/src/zod-utils.d.ts +1 -1
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod";
|
|
2
2
|
import { CategoryIdentifierSchema, ProductIdentifierSchema } from "../models/identifiers.model.js";
|
|
3
3
|
import { BaseQuerySchema } from "./base.query.js";
|
|
4
4
|
const ProductRecommendationBaseQuerySchema = BaseQuerySchema.extend({
|
|
5
|
-
numberOfRecommendations: z.number().min(1).max(12).
|
|
6
|
-
labels: z.array(z.string()).optional().
|
|
5
|
+
numberOfRecommendations: z.number().min(1).max(12).meta({ description: "The number of recommendations requested. The provider may return fewer than this number, but should not return more." }),
|
|
6
|
+
labels: z.array(z.string()).optional().meta({ description: "The customer segments, quirks, chirps or other labels to which the recommendations can optimize themselves to be relevant. This can be used by the provider to personalize the recommendations based on the preferences and behaviors of users in these segments." })
|
|
7
7
|
});
|
|
8
8
|
const ProductRecommendationsByCollectionQuerySchema = ProductRecommendationBaseQuerySchema.extend({
|
|
9
|
-
collectionName: z.string().
|
|
10
|
-
sourceProduct: z.array(ProductIdentifierSchema).optional().
|
|
9
|
+
collectionName: z.string().meta({ description: "The name of the collection for which to get product recommendations. This is to access either manually curated lists, or interface marketing rules engines that define zones by name" }),
|
|
10
|
+
sourceProduct: z.array(ProductIdentifierSchema).optional().meta({ description: "The products on screen or in the context you are asking for the recommendations. Could be all the variants from the current cart (resolved into their products), or just the variant of the PDP, or the 4 first products of a category." }),
|
|
11
11
|
sourceCategory: CategoryIdentifierSchema.optional().describe("The category identifier to use as a seed for the recommendations. The provider should return recommendations that are relevant to this category, e.g., products that are frequently bought together, products that are similar in style or category, or products that are popular among users with similar preferences. This is optional, as the collection may already be curated to be relevant to a specific product or category, but it can be used by the provider to further personalize the recommendations based on the preferences and behaviors of users who have interacted with this category.")
|
|
12
12
|
});
|
|
13
13
|
const ProductRecommendationProductBasedBaseQuerySchema = ProductRecommendationBaseQuerySchema.extend({
|
|
14
14
|
sourceProduct: ProductIdentifierSchema.describe("The product identifiers for which to get recommendations. The provider should return recommendations that are relevant to these products, e.g., products that are frequently bought together, products that are similar in style or category, or products that are popular among users with similar preferences.")
|
|
15
15
|
});
|
|
16
16
|
const ProductRecommendationAlgorithmFrequentlyBoughtTogetherQuerySchema = ProductRecommendationProductBasedBaseQuerySchema.extend({
|
|
17
|
-
algorithm: z.literal("frequentlyBoughtTogether").
|
|
17
|
+
algorithm: z.literal("frequentlyBoughtTogether").meta({ description: "The provider should return recommendations based on products that are frequently bought together with the source products. The provider should leverage the Request Context to personalize the recommendations as much as possible, taking into account factors such as the user's browsing history, purchase history, and demographic information." })
|
|
18
18
|
});
|
|
19
19
|
const ProductRecommendationAlgorithmSimilarProductsQuerySchema = ProductRecommendationProductBasedBaseQuerySchema.extend({
|
|
20
|
-
algorithm: z.literal("similar").
|
|
20
|
+
algorithm: z.literal("similar").meta({ description: "The provider should return recommendations based on products that are similar to the source products either visually or data wise" })
|
|
21
21
|
});
|
|
22
22
|
const ProductRecommendationAlgorithmRelatedProductsQuerySchema = ProductRecommendationProductBasedBaseQuerySchema.extend({
|
|
23
|
-
algorithm: z.literal("related").
|
|
23
|
+
algorithm: z.literal("related").meta({ description: "The provider should return recommendations based on products that are related to the source products. " })
|
|
24
24
|
});
|
|
25
25
|
const ProductRecommendationAlgorithmTrendingInCategoryQuerySchema = ProductRecommendationBaseQuerySchema.extend({
|
|
26
|
-
algorithm: z.literal("trendingInCategory").
|
|
26
|
+
algorithm: z.literal("trendingInCategory").meta({ description: "The provider should return recommendations based on products that are trending in the specified category. The provider should leverage the Request Context to personalize the recommendations as much as possible, taking into account factors such as the user's browsing history, purchase history, and demographic information." }),
|
|
27
27
|
sourceCategory: CategoryIdentifierSchema.describe("The category identifier for which to get trending product recommendations. The provider should return recommendations that are relevant to this category, e.g., products that are frequently bought together, products that are similar in style or category, or products that are popular among users with similar preferences.")
|
|
28
28
|
});
|
|
29
29
|
const ProductRecommendationAlgorithmPopuplarProductsQuerySchema = ProductRecommendationBaseQuerySchema.extend({
|
|
30
|
-
algorithm: z.literal("popular").
|
|
30
|
+
algorithm: z.literal("popular").meta({ description: "The provider should return recommendations based on products that are popular among users. The provider should leverage the Request Context to personalize the recommendations as much as possible, taking into account factors such as the user's browsing history, purchase history, and demographic information." })
|
|
31
31
|
});
|
|
32
32
|
const ProductRecommendationAlgorithmTopPicksProductsQuerySchema = ProductRecommendationBaseQuerySchema.extend({
|
|
33
|
-
algorithm: z.literal("topPicks").
|
|
33
|
+
algorithm: z.literal("topPicks").meta({ description: "The provider should return recommendations based on products that are top picks among users. The provider should leverage the Request Context to personalize the recommendations as much as possible, taking into account factors such as the user's browsing history, purchase history, and demographic information." })
|
|
34
34
|
});
|
|
35
35
|
const ProductRecommendationAlgorithmAlsoViewedProductsQuerySchema = ProductRecommendationProductBasedBaseQuerySchema.extend({
|
|
36
|
-
algorithm: z.literal("alsoViewed").
|
|
36
|
+
algorithm: z.literal("alsoViewed").meta({ description: "The provider should return recommendations based on products that are also viewed by users. The provider should leverage the Request Context to personalize the recommendations as much as possible, taking into account factors such as the user's browsing history, purchase history, and demographic information." })
|
|
37
37
|
});
|
|
38
38
|
const ProductRecommendationsQuerySchema = z.discriminatedUnion("algorithm", [
|
|
39
39
|
ProductRecommendationAlgorithmFrequentlyBoughtTogetherQuerySchema,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod";
|
|
2
2
|
import { CategorySchema } from "../models/category.model.js";
|
|
3
3
|
import { ProductSearchIdentifierSchema } from "../models/identifiers.model.js";
|
|
4
4
|
import { BaseQuerySchema } from "./base.query.js";
|
|
@@ -6,8 +6,8 @@ const ProductSearchQueryByTermSchema = BaseQuerySchema.extend({
|
|
|
6
6
|
search: ProductSearchIdentifierSchema
|
|
7
7
|
});
|
|
8
8
|
const ProductSearchQueryCreateNavigationFilterSchema = z.looseObject({
|
|
9
|
-
categoryPath: z.array(CategorySchema).
|
|
10
|
-
}).
|
|
9
|
+
categoryPath: z.array(CategorySchema).meta({ description: "An array representing the breadcrumb path to a category, from root to the specific category." })
|
|
10
|
+
}).meta({ description: "Payload to create a category navigation filter from a breadcrumb path." });
|
|
11
11
|
export {
|
|
12
12
|
ProductSearchQueryByTermSchema,
|
|
13
13
|
ProductSearchQueryCreateNavigationFilterSchema
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod";
|
|
2
2
|
import { BaseQuerySchema } from "./base.query.js";
|
|
3
3
|
import { PaginationOptionsSchema, ProductIdentifierSchema, ProductVariantIdentifierSchema } from "../models/index.js";
|
|
4
4
|
const ProductQueryBySlugSchema = BaseQuerySchema.extend({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod";
|
|
2
2
|
import { WebStoreIdentifierSchema } from "./models/identifiers.model.js";
|
|
3
3
|
import { CurrencySchema } from "./models/currency.model.js";
|
|
4
4
|
import { IdentitySchema } from "./models/identity.model.js";
|
|
@@ -25,11 +25,11 @@ const RequestContextSchema = z.looseObject({
|
|
|
25
25
|
languageContext: LanguageContextSchema.default(() => LanguageContextSchema.parse({})).describe("ReadOnly. The language and locale context for the current request."),
|
|
26
26
|
storeIdentifier: WebStoreIdentifierSchema.default(() => WebStoreIdentifierSchema.parse({})).describe("ReadOnly. The identifier of the current web store making the request."),
|
|
27
27
|
taxJurisdiction: TaxJurisdictionSchema.default(() => TaxJurisdictionSchema.parse({})).describe("ReadOnly. The tax jurisdiction for the current request, typically derived from the store location or carts billing address"),
|
|
28
|
-
correlationId: z.string().default("").
|
|
29
|
-
isBot: z.boolean().default(false).
|
|
30
|
-
clientIp: z.string().default("").
|
|
31
|
-
userAgent: z.string().default("").
|
|
32
|
-
referrer: z.string().default("").
|
|
28
|
+
correlationId: z.string().default("").meta({ description: "A unique identifier for the request, can be used for tracing and logging purposes." }),
|
|
29
|
+
isBot: z.boolean().default(false).meta({ description: "Indicates if the request is made by a bot or crawler." }),
|
|
30
|
+
clientIp: z.string().default("").meta({ description: "The IP address of the client making the request, if available. Mostly for logging purposes" }),
|
|
31
|
+
userAgent: z.string().default("").meta({ description: "The user agent string of the client making the request, if available." }),
|
|
32
|
+
referrer: z.string().default("").meta({ description: "The referrer URL, if available." })
|
|
33
33
|
});
|
|
34
34
|
export {
|
|
35
35
|
IdentityContextSchema,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BaseModel } from '../schemas/models/index.js';
|
|
2
2
|
import type { Result } from '../schemas/result.js';
|
|
3
3
|
import type { Cache, CacheEntryOptions } from './cache.interface.js';
|
|
4
|
-
import type z from 'zod';
|
|
4
|
+
import type * as z from 'zod';
|
|
5
5
|
/**
|
|
6
6
|
* Memory version of the cache. Primarily useful for local development.
|
|
7
7
|
* This is NOT suited for production use.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Redis } from '@upstash/redis';
|
|
2
2
|
import type { Cache, CacheEntryOptions } from './cache.interface.js';
|
|
3
|
-
import type z from 'zod';
|
|
3
|
+
import type * as z from 'zod';
|
|
4
4
|
export declare class RedisCache implements Cache {
|
|
5
5
|
protected redis: Redis;
|
|
6
6
|
protected meter: import("../metrics/metrics.js").ReactionaryCacheMetrics;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InferType } from '../../../zod-utils.js';
|
|
2
|
-
import
|
|
2
|
+
import * as z from 'zod';
|
|
3
3
|
export declare const AnalyticsMutationProductSummaryViewEventSchema: z.ZodObject<{
|
|
4
4
|
event: z.ZodLiteral<"product-summary-view">;
|
|
5
5
|
source: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as z from 'zod';
|
|
2
2
|
import type { InferType } from '../../zod-utils.js';
|
|
3
3
|
export declare const IdentityQuerySelfSchema: z.ZodObject<{}, z.core.$loose>;
|
|
4
4
|
export type IdentityQuerySelf = InferType<typeof IdentityQuerySelfSchema>;
|
package/src/zod-utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type z from "zod";
|
|
1
|
+
import type * as z from "zod";
|
|
2
2
|
export type StripIndexSignature<T> = T extends (infer U)[] ? StripIndexSignature<U>[] : T extends readonly (infer U)[] ? readonly StripIndexSignature<U>[] : T extends Set<infer U> ? Set<StripIndexSignature<U>> : T extends Map<infer K, infer V> ? Map<StripIndexSignature<K>, StripIndexSignature<V>> : T extends Promise<infer U> ? Promise<StripIndexSignature<U>> : T extends object ? {
|
|
3
3
|
[K in keyof T as K extends string ? string extends K ? never : K : K]: StripIndexSignature<T[K]>;
|
|
4
4
|
} : T;
|