@reactionary/core 0.0.39 → 0.0.41
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 +13 -0
- package/index.js +1 -0
- package/package.json +2 -2
- package/schemas/capabilities.schema.js +1 -1
- package/schemas/models/base.model.js +5 -5
- package/schemas/models/cart.model.js +1 -1
- package/schemas/models/identifiers.model.js +12 -12
- package/schemas/models/price.model.js +1 -1
- package/schemas/models/product.model.js +2 -2
- package/schemas/models/search.model.js +3 -3
- package/schemas/mutations/base.mutation.js +1 -1
- package/schemas/mutations/cart.mutation.js +6 -6
- package/schemas/mutations/inventory.mutation.js +0 -5
- package/schemas/mutations/price.mutation.js +0 -5
- package/schemas/mutations/product.mutation.js +0 -5
- package/schemas/mutations/search.mutation.js +0 -5
- package/schemas/queries/analytics.query.js +0 -5
- package/schemas/queries/base.query.js +1 -1
- package/schemas/queries/cart.query.js +1 -4
- package/schemas/queries/inventory.query.js +1 -3
- package/src/decorators/reactionary.decorator.d.ts +1 -0
- package/src/index.d.ts +1 -0
- package/src/schemas/capabilities.schema.d.ts +2 -6
- package/src/schemas/models/analytics.model.d.ts +6 -22
- package/src/schemas/models/base.model.d.ts +21 -61
- package/src/schemas/models/cart.model.d.ts +73 -224
- package/src/schemas/models/category.model.d.ts +29 -95
- package/src/schemas/models/identifiers.model.d.ts +37 -109
- package/src/schemas/models/identity.model.d.ts +8 -25
- package/src/schemas/models/inventory.model.d.ts +12 -41
- package/src/schemas/models/price.model.d.ts +20 -65
- package/src/schemas/models/product.model.d.ts +20 -65
- package/src/schemas/models/search.model.d.ts +47 -144
- package/src/schemas/mutations/analytics.mutation.d.ts +47 -143
- package/src/schemas/mutations/base.mutation.d.ts +1 -5
- package/src/schemas/mutations/cart.mutation.d.ts +24 -72
- package/src/schemas/mutations/identity.mutation.d.ts +3 -19
- package/src/schemas/mutations/inventory.mutation.d.ts +1 -3
- package/src/schemas/mutations/price.mutation.d.ts +1 -3
- package/src/schemas/mutations/product.mutation.d.ts +1 -3
- package/src/schemas/mutations/search.mutation.d.ts +1 -3
- package/src/schemas/queries/analytics.query.d.ts +1 -3
- package/src/schemas/queries/base.query.d.ts +1 -5
- package/src/schemas/queries/cart.query.d.ts +4 -33
- package/src/schemas/queries/category.query.d.ts +20 -80
- package/src/schemas/queries/identity.query.d.ts +1 -9
- package/src/schemas/queries/inventory.query.d.ts +4 -34
- package/src/schemas/queries/price.query.d.ts +4 -16
- package/src/schemas/queries/product.query.d.ts +4 -20
- package/src/schemas/queries/search.query.d.ts +10 -30
- package/src/schemas/session.schema.d.ts +13 -40
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function Reactionary(options) {
|
|
2
|
+
return function(target, propertyKey, descriptor) {
|
|
3
|
+
const original = descriptor.value;
|
|
4
|
+
descriptor.value = function(...args) {
|
|
5
|
+
console.log("calling through reactionary decoration!");
|
|
6
|
+
return original.apply(this, args);
|
|
7
|
+
};
|
|
8
|
+
return descriptor;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
Reactionary
|
|
13
|
+
};
|
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./cache/redis-cache";
|
|
|
4
4
|
export * from "./cache/noop-cache";
|
|
5
5
|
export * from "./client/client";
|
|
6
6
|
export * from "./client/client-builder";
|
|
7
|
+
export * from "./decorators/reactionary.decorator";
|
|
7
8
|
export * from "./providers/analytics.provider";
|
|
8
9
|
export * from "./providers/base.provider";
|
|
9
10
|
export * from "./providers/cart.provider";
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
const CacheInformationSchema = z.
|
|
2
|
+
const CacheInformationSchema = z.looseObject({
|
|
3
3
|
hit: z.boolean().default(false),
|
|
4
4
|
key: z.string().default("")
|
|
5
5
|
});
|
|
6
|
-
const MetaSchema = z.
|
|
6
|
+
const MetaSchema = z.looseObject({
|
|
7
7
|
cache: CacheInformationSchema.default(() => CacheInformationSchema.parse({})),
|
|
8
8
|
placeholder: z.boolean().default(false).describe("Whether or not the entity exists in a remote system, or is a default placeholder.")
|
|
9
9
|
});
|
|
10
|
-
const BaseModelSchema = z.
|
|
10
|
+
const BaseModelSchema = z.looseObject({
|
|
11
11
|
meta: MetaSchema.default(() => MetaSchema.parse({}))
|
|
12
12
|
});
|
|
13
|
-
const PaginationOptionsSchema = z.
|
|
13
|
+
const PaginationOptionsSchema = z.looseObject({
|
|
14
14
|
pageNumber: z.number().default(1).describe("Current page number, starting from 1"),
|
|
15
15
|
pageSize: z.number().default(20).describe("Number of items per page")
|
|
16
16
|
});
|
|
@@ -24,7 +24,7 @@ function createPaginatedResponseSchema(itemSchema) {
|
|
|
24
24
|
items: z.array(itemSchema)
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
const ImageSchema = z.
|
|
27
|
+
const ImageSchema = z.looseObject({
|
|
28
28
|
sourceUrl: z.string().default("").describe("The original source URL of the image. Pass this through your image resizing and transcoding service to get the desired size, and generate thumbnails as needed"),
|
|
29
29
|
altText: z.string().default("").describe("Alternative text for the image, for accessibility purposes. Must always be set, and non-empty"),
|
|
30
30
|
width: z.number().optional().describe("Width of the original image, in pixels, if known"),
|
|
@@ -16,7 +16,7 @@ const ItemCostBreakdownSchema = z.looseObject({
|
|
|
16
16
|
totalPrice: MonetaryAmountSchema.default(() => MonetaryAmountSchema.parse({})).describe("The total price for all units of the item."),
|
|
17
17
|
totalDiscount: MonetaryAmountSchema.default(() => MonetaryAmountSchema.parse({})).describe("The total discount applied to all units of the item.")
|
|
18
18
|
});
|
|
19
|
-
const CartItemSchema = z.
|
|
19
|
+
const CartItemSchema = z.looseObject({
|
|
20
20
|
identifier: CartItemIdentifierSchema.default(() => CartItemIdentifierSchema.parse({})),
|
|
21
21
|
product: ProductIdentifierSchema.default(() => ProductIdentifierSchema.parse({})),
|
|
22
22
|
quantity: z.number().default(0),
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
const FacetIdentifierSchema = z.
|
|
2
|
+
const FacetIdentifierSchema = z.looseObject({
|
|
3
3
|
key: z.string().default("").nonoptional()
|
|
4
4
|
});
|
|
5
|
-
const FacetValueIdentifierSchema = z.
|
|
5
|
+
const FacetValueIdentifierSchema = z.looseObject({
|
|
6
6
|
facet: FacetIdentifierSchema.default(() => FacetIdentifierSchema.parse({})),
|
|
7
7
|
key: z.string().default("")
|
|
8
8
|
});
|
|
9
|
-
const SKUIdentifierSchema = z.
|
|
9
|
+
const SKUIdentifierSchema = z.looseObject({
|
|
10
10
|
key: z.string().default("").nonoptional()
|
|
11
11
|
});
|
|
12
|
-
const ProductIdentifierSchema = z.
|
|
12
|
+
const ProductIdentifierSchema = z.looseObject({
|
|
13
13
|
key: z.string().default("")
|
|
14
14
|
});
|
|
15
|
-
const SearchIdentifierSchema = z.
|
|
15
|
+
const SearchIdentifierSchema = z.looseObject({
|
|
16
16
|
term: z.string().default(""),
|
|
17
17
|
page: z.number().default(0),
|
|
18
18
|
pageSize: z.number().default(20),
|
|
19
19
|
facets: z.array(FacetValueIdentifierSchema.required()).default(() => [])
|
|
20
20
|
});
|
|
21
|
-
const CartIdentifierSchema = z.
|
|
21
|
+
const CartIdentifierSchema = z.looseObject({
|
|
22
22
|
key: z.string().default("")
|
|
23
23
|
});
|
|
24
|
-
const CartItemIdentifierSchema = z.
|
|
24
|
+
const CartItemIdentifierSchema = z.looseObject({
|
|
25
25
|
key: z.string().default("")
|
|
26
26
|
});
|
|
27
|
-
const PriceIdentifierSchema = z.
|
|
27
|
+
const PriceIdentifierSchema = z.looseObject({
|
|
28
28
|
sku: SKUIdentifierSchema.default(() => SKUIdentifierSchema.parse({}))
|
|
29
29
|
});
|
|
30
|
-
const CategoryIdentifierSchema = z.
|
|
30
|
+
const CategoryIdentifierSchema = z.looseObject({
|
|
31
31
|
key: z.string().default("").nonoptional()
|
|
32
32
|
});
|
|
33
|
-
const WebStoreIdentifierSchema = z.
|
|
33
|
+
const WebStoreIdentifierSchema = z.looseObject({
|
|
34
34
|
key: z.string().default("").nonoptional()
|
|
35
35
|
});
|
|
36
|
-
const InventoryChannelIdentifierSchema = z.
|
|
36
|
+
const InventoryChannelIdentifierSchema = z.looseObject({
|
|
37
37
|
key: z.string().default("online").nonoptional()
|
|
38
38
|
});
|
|
39
|
-
const InventoryIdentifierSchema = z.
|
|
39
|
+
const InventoryIdentifierSchema = z.looseObject({
|
|
40
40
|
sku: SKUIdentifierSchema.default(() => SKUIdentifierSchema.parse({})),
|
|
41
41
|
channelId: InventoryChannelIdentifierSchema.default(() => InventoryChannelIdentifierSchema.parse({}))
|
|
42
42
|
});
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { BaseModelSchema } from "./base.model";
|
|
3
3
|
import { PriceIdentifierSchema } from "./identifiers.model";
|
|
4
4
|
import { CurrencySchema } from "./currency.model";
|
|
5
|
-
const MonetaryAmountSchema = z.
|
|
5
|
+
const MonetaryAmountSchema = z.looseObject({
|
|
6
6
|
value: z.number().default(0).describe("The monetary amount in decimal-precision."),
|
|
7
7
|
currency: CurrencySchema.default("XXX").describe("The currency associated with the amount, as a ISO 4217 standardized code.")
|
|
8
8
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ProductIdentifierSchema } from "./identifiers.model";
|
|
3
3
|
import { BaseModelSchema } from "./base.model";
|
|
4
|
-
const SKUSchema = z.
|
|
4
|
+
const SKUSchema = z.looseObject({
|
|
5
5
|
identifier: ProductIdentifierSchema.default(() => ProductIdentifierSchema.parse({}))
|
|
6
6
|
});
|
|
7
|
-
const ProductAttributeSchema = z.
|
|
7
|
+
const ProductAttributeSchema = z.looseObject({
|
|
8
8
|
id: z.string(),
|
|
9
9
|
name: z.string(),
|
|
10
10
|
value: z.string()
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ProductIdentifierSchema, FacetValueIdentifierSchema, FacetIdentifierSchema, SearchIdentifierSchema } from "./identifiers.model";
|
|
3
3
|
import { BaseModelSchema } from "./base.model";
|
|
4
|
-
const SearchResultProductSchema = z.
|
|
4
|
+
const SearchResultProductSchema = z.looseObject({
|
|
5
5
|
identifier: ProductIdentifierSchema.default(ProductIdentifierSchema.parse({})),
|
|
6
6
|
name: z.string().default(""),
|
|
7
7
|
image: z.string().url().default("https://placehold.co/400"),
|
|
8
8
|
slug: z.string().default("")
|
|
9
9
|
});
|
|
10
|
-
const SearchResultFacetValueSchema = z.
|
|
10
|
+
const SearchResultFacetValueSchema = z.looseObject({
|
|
11
11
|
identifier: FacetValueIdentifierSchema.default(() => FacetValueIdentifierSchema.parse({})),
|
|
12
12
|
name: z.string().default(""),
|
|
13
13
|
count: z.number().default(0),
|
|
14
14
|
active: z.boolean().default(false)
|
|
15
15
|
});
|
|
16
|
-
const SearchResultFacetSchema = z.
|
|
16
|
+
const SearchResultFacetSchema = z.looseObject({
|
|
17
17
|
identifier: FacetIdentifierSchema.default(() => FacetIdentifierSchema.parse({})),
|
|
18
18
|
name: z.string().default(""),
|
|
19
19
|
values: z.array(SearchResultFacetValueSchema).default(() => [])
|
|
@@ -2,17 +2,17 @@ import { z } from "zod";
|
|
|
2
2
|
import { BaseMutationSchema } from "./base.mutation";
|
|
3
3
|
import { CartIdentifierSchema, CartItemIdentifierSchema, ProductIdentifierSchema } from "../models/identifiers.model";
|
|
4
4
|
const CartMutationItemAddSchema = BaseMutationSchema.extend({
|
|
5
|
-
cart: CartIdentifierSchema.
|
|
6
|
-
product: ProductIdentifierSchema.
|
|
5
|
+
cart: CartIdentifierSchema.nonoptional(),
|
|
6
|
+
product: ProductIdentifierSchema.nonoptional(),
|
|
7
7
|
quantity: z.number()
|
|
8
8
|
});
|
|
9
9
|
const CartMutationItemRemoveSchema = BaseMutationSchema.extend({
|
|
10
|
-
cart: CartIdentifierSchema.
|
|
11
|
-
item: CartItemIdentifierSchema.
|
|
10
|
+
cart: CartIdentifierSchema.nonoptional(),
|
|
11
|
+
item: CartItemIdentifierSchema.nonoptional()
|
|
12
12
|
});
|
|
13
13
|
const CartMutationItemQuantityChangeSchema = BaseMutationSchema.extend({
|
|
14
|
-
cart: CartIdentifierSchema.
|
|
15
|
-
item: CartItemIdentifierSchema.
|
|
14
|
+
cart: CartIdentifierSchema.nonoptional(),
|
|
15
|
+
item: CartItemIdentifierSchema.nonoptional(),
|
|
16
16
|
quantity: z.number()
|
|
17
17
|
});
|
|
18
18
|
export {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import { BaseQuerySchema } from "./base.query";
|
|
3
2
|
import { CartIdentifierSchema } from "../models/identifiers.model";
|
|
4
3
|
const CartQueryByIdSchema = BaseQuerySchema.extend({
|
|
5
4
|
cart: CartIdentifierSchema.required()
|
|
6
5
|
});
|
|
7
|
-
const CartQuerySchema = z.union([CartQueryByIdSchema]);
|
|
8
6
|
export {
|
|
9
|
-
CartQueryByIdSchema
|
|
10
|
-
CartQuerySchema
|
|
7
|
+
CartQueryByIdSchema
|
|
11
8
|
};
|
|
@@ -5,9 +5,7 @@ const InventoryQueryBySKUSchema = BaseQuerySchema.extend({
|
|
|
5
5
|
query: z.literal("sku"),
|
|
6
6
|
sku: ProductIdentifierSchema.default(() => ProductIdentifierSchema.parse({}))
|
|
7
7
|
});
|
|
8
|
-
const InventoryQuerySchema = z.union([InventoryQueryBySKUSchema]);
|
|
9
8
|
;
|
|
10
9
|
export {
|
|
11
|
-
InventoryQueryBySKUSchema
|
|
12
|
-
InventoryQuerySchema
|
|
10
|
+
InventoryQueryBySKUSchema
|
|
13
11
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Reactionary(options: unknown): MethodDecorator;
|
package/src/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './cache/redis-cache';
|
|
|
4
4
|
export * from './cache/noop-cache';
|
|
5
5
|
export * from './client/client';
|
|
6
6
|
export * from './client/client-builder';
|
|
7
|
+
export * from './decorators/reactionary.decorator';
|
|
7
8
|
export * from './providers/analytics.provider';
|
|
8
9
|
export * from './providers/base.provider';
|
|
9
10
|
export * from './providers/cart.provider';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const CapabilitiesSchema: z.
|
|
2
|
+
export declare const CapabilitiesSchema: z.ZodObject<{
|
|
3
3
|
product: z.ZodBoolean;
|
|
4
4
|
search: z.ZodBoolean;
|
|
5
5
|
analytics: z.ZodBoolean;
|
|
@@ -8,9 +8,5 @@ export declare const CapabilitiesSchema: z.ZodInterface<{
|
|
|
8
8
|
inventory: z.ZodBoolean;
|
|
9
9
|
price: z.ZodBoolean;
|
|
10
10
|
category: z.ZodBoolean;
|
|
11
|
-
},
|
|
12
|
-
optional: never;
|
|
13
|
-
defaulted: never;
|
|
14
|
-
extra: Record<string, unknown>;
|
|
15
|
-
}>;
|
|
11
|
+
}, z.core.$loose>;
|
|
16
12
|
export type Capabilities = z.infer<typeof CapabilitiesSchema>;
|
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const AnalyticsEventSchema: z.
|
|
3
|
-
meta: z.ZodDefault<z.
|
|
4
|
-
cache: z.ZodDefault<z.
|
|
2
|
+
export declare const AnalyticsEventSchema: z.ZodObject<{
|
|
3
|
+
meta: z.ZodDefault<z.ZodObject<{
|
|
4
|
+
cache: z.ZodDefault<z.ZodObject<{
|
|
5
5
|
hit: z.ZodDefault<z.ZodBoolean>;
|
|
6
6
|
key: z.ZodDefault<z.ZodString>;
|
|
7
|
-
},
|
|
8
|
-
optional: never;
|
|
9
|
-
defaulted: never;
|
|
10
|
-
extra: Record<string, unknown>;
|
|
11
|
-
}>>;
|
|
7
|
+
}, z.core.$loose>>;
|
|
12
8
|
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
defaulted: never;
|
|
16
|
-
extra: Record<string, unknown>;
|
|
17
|
-
}>>;
|
|
18
|
-
}, {
|
|
19
|
-
optional: never;
|
|
20
|
-
defaulted: never;
|
|
21
|
-
extra: Record<string, unknown>;
|
|
22
|
-
}>, z.ZodInterface<{}, {
|
|
23
|
-
optional: never;
|
|
24
|
-
defaulted: never;
|
|
25
|
-
extra: {};
|
|
26
|
-
}>>;
|
|
9
|
+
}, z.core.$loose>>;
|
|
10
|
+
}, z.core.$loose>;
|
|
27
11
|
export type AnalyticsEvent = z.infer<typeof AnalyticsEventSchema>;
|
|
@@ -1,99 +1,59 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const CacheInformationSchema: z.
|
|
2
|
+
export declare const CacheInformationSchema: z.ZodObject<{
|
|
3
3
|
hit: z.ZodDefault<z.ZodBoolean>;
|
|
4
4
|
key: z.ZodDefault<z.ZodString>;
|
|
5
|
-
},
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
extra: Record<string, unknown>;
|
|
9
|
-
}>;
|
|
10
|
-
export declare const MetaSchema: z.ZodInterface<{
|
|
11
|
-
cache: z.ZodDefault<z.ZodInterface<{
|
|
5
|
+
}, z.core.$loose>;
|
|
6
|
+
export declare const MetaSchema: z.ZodObject<{
|
|
7
|
+
cache: z.ZodDefault<z.ZodObject<{
|
|
12
8
|
hit: z.ZodDefault<z.ZodBoolean>;
|
|
13
9
|
key: z.ZodDefault<z.ZodString>;
|
|
14
|
-
},
|
|
15
|
-
optional: never;
|
|
16
|
-
defaulted: never;
|
|
17
|
-
extra: Record<string, unknown>;
|
|
18
|
-
}>>;
|
|
10
|
+
}, z.core.$loose>>;
|
|
19
11
|
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}>;
|
|
25
|
-
export declare const BaseModelSchema: z.ZodInterface<{
|
|
26
|
-
meta: z.ZodDefault<z.ZodInterface<{
|
|
27
|
-
cache: z.ZodDefault<z.ZodInterface<{
|
|
12
|
+
}, z.core.$loose>;
|
|
13
|
+
export declare const BaseModelSchema: z.ZodObject<{
|
|
14
|
+
meta: z.ZodDefault<z.ZodObject<{
|
|
15
|
+
cache: z.ZodDefault<z.ZodObject<{
|
|
28
16
|
hit: z.ZodDefault<z.ZodBoolean>;
|
|
29
17
|
key: z.ZodDefault<z.ZodString>;
|
|
30
|
-
},
|
|
31
|
-
optional: never;
|
|
32
|
-
defaulted: never;
|
|
33
|
-
extra: Record<string, unknown>;
|
|
34
|
-
}>>;
|
|
18
|
+
}, z.core.$loose>>;
|
|
35
19
|
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
defaulted: never;
|
|
39
|
-
extra: Record<string, unknown>;
|
|
40
|
-
}>>;
|
|
41
|
-
}, {
|
|
42
|
-
optional: never;
|
|
43
|
-
defaulted: never;
|
|
44
|
-
extra: Record<string, unknown>;
|
|
45
|
-
}>;
|
|
20
|
+
}, z.core.$loose>>;
|
|
21
|
+
}, z.core.$loose>;
|
|
46
22
|
export type CacheInformation = z.infer<typeof CacheInformationSchema>;
|
|
47
23
|
export type Meta = z.infer<typeof MetaSchema>;
|
|
48
24
|
export type BaseModel = z.infer<typeof BaseModelSchema>;
|
|
49
|
-
export declare const PaginationOptionsSchema: z.
|
|
25
|
+
export declare const PaginationOptionsSchema: z.ZodObject<{
|
|
50
26
|
pageNumber: z.ZodDefault<z.ZodNumber>;
|
|
51
27
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
52
|
-
},
|
|
53
|
-
optional: never;
|
|
54
|
-
defaulted: never;
|
|
55
|
-
extra: Record<string, unknown>;
|
|
56
|
-
}>;
|
|
28
|
+
}, z.core.$loose>;
|
|
57
29
|
export type PaginationOptions = z.infer<typeof PaginationOptionsSchema>;
|
|
58
30
|
/**
|
|
59
31
|
* This seemed like the right way to do it, but we need to be able to pass in the item schema even later than this
|
|
60
32
|
*
|
|
61
33
|
**/
|
|
62
34
|
export declare function createPaginatedResponseSchema<ItemType extends z.ZodTypeAny>(itemSchema: ItemType): z.ZodObject<{
|
|
63
|
-
meta: z.ZodDefault<z.
|
|
64
|
-
cache: z.ZodDefault<z.
|
|
35
|
+
meta: z.ZodDefault<z.ZodObject<{
|
|
36
|
+
cache: z.ZodDefault<z.ZodObject<{
|
|
65
37
|
hit: z.ZodDefault<z.ZodBoolean>;
|
|
66
38
|
key: z.ZodDefault<z.ZodString>;
|
|
67
|
-
},
|
|
68
|
-
optional: never;
|
|
69
|
-
defaulted: never;
|
|
70
|
-
extra: Record<string, unknown>;
|
|
71
|
-
}>>;
|
|
39
|
+
}, z.core.$loose>>;
|
|
72
40
|
placeholder: z.ZodDefault<z.ZodBoolean>;
|
|
73
|
-
},
|
|
74
|
-
optional: never;
|
|
75
|
-
defaulted: never;
|
|
76
|
-
extra: Record<string, unknown>;
|
|
77
|
-
}>>;
|
|
41
|
+
}, z.core.$loose>>;
|
|
78
42
|
pageNumber: z.ZodNumber;
|
|
79
43
|
pageSize: z.ZodNumber;
|
|
80
44
|
totalCount: z.ZodNumber;
|
|
81
45
|
totalPages: z.ZodNumber;
|
|
82
46
|
items: z.ZodArray<ItemType>;
|
|
83
|
-
},
|
|
47
|
+
}, z.core.$strip>;
|
|
84
48
|
/**
|
|
85
49
|
* I posit, we should not have final urls in this, but rather assume the frontend has some kind of image transcoding/resizing service it will use to pass the image through, so
|
|
86
50
|
* what we really need is the original source url, and then some metadata about the image.
|
|
87
51
|
* Ie, rather than having distinct thumbnail and image fields, we just have a list of images, and the frontend will generate its own thumbnails as needed?
|
|
88
52
|
*/
|
|
89
|
-
export declare const ImageSchema: z.
|
|
53
|
+
export declare const ImageSchema: z.ZodObject<{
|
|
90
54
|
sourceUrl: z.ZodDefault<z.ZodString>;
|
|
91
55
|
altText: z.ZodDefault<z.ZodString>;
|
|
92
56
|
width: z.ZodOptional<z.ZodNumber>;
|
|
93
57
|
height: z.ZodOptional<z.ZodNumber>;
|
|
94
|
-
},
|
|
95
|
-
optional: never;
|
|
96
|
-
defaulted: never;
|
|
97
|
-
extra: Record<string, unknown>;
|
|
98
|
-
}>;
|
|
58
|
+
}, z.core.$loose>;
|
|
99
59
|
export type Image = z.infer<typeof ImageSchema>;
|