@commercelayer/demo-store-types 5.3.0 → 7.0.0
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/README.md +1 -1
- package/dist/json/catalogs.d.ts +1 -1
- package/dist/json/countries.d.ts +2 -2
- package/dist/json/languages.d.ts +1 -1
- package/dist/json/pages.d.ts +3 -7
- package/dist/json/products.d.ts +3 -177
- package/dist/json/products.js +1 -1
- package/dist/json/taxonomies.d.ts +1 -1
- package/dist/json/taxons.d.ts +2 -2
- package/dist/utils/locale.d.ts +2 -6
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -102,7 +102,7 @@ node runTestData.js
|
|
|
102
102
|
|
|
103
103
|
## Example
|
|
104
104
|
|
|
105
|
-
Here below you can find a working example with Node.js
|
|
105
|
+
Here below you can find a working example with Node.js 22 or later that converts a list of products coming from an external service, to the Demo Store `products.json`.
|
|
106
106
|
|
|
107
107
|
Setup a new project from scratch:
|
|
108
108
|
|
package/dist/json/catalogs.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ type RawDataCatalogSchema = z.ZodObject<{
|
|
|
23
23
|
*/
|
|
24
24
|
taxonomies: z.ZodArray<z.ZodString>;
|
|
25
25
|
}>;
|
|
26
|
-
export declare const rawDataCatalogs_schema: z.ZodArray<RawDataCatalogSchema
|
|
26
|
+
export declare const rawDataCatalogs_schema: z.ZodArray<RawDataCatalogSchema>;
|
|
27
27
|
/**
|
|
28
28
|
* Product catalog
|
|
29
29
|
*
|
package/dist/json/countries.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ type RawDataCountrySchema = z.ZodObject<{
|
|
|
24
24
|
* @example "id:vlGRmhpEeg"
|
|
25
25
|
* @example "code:europe"
|
|
26
26
|
*/
|
|
27
|
-
market: z.ZodOptional<z.
|
|
27
|
+
market: z.ZodOptional<z.ZodCustom<`id:${string}` | `code:${string}`>>;
|
|
28
28
|
/**
|
|
29
29
|
* Reference to the `catalogs` id
|
|
30
30
|
*
|
|
@@ -49,7 +49,7 @@ type RawDataCountrySchema = z.ZodObject<{
|
|
|
49
49
|
*/
|
|
50
50
|
region: z.ZodString;
|
|
51
51
|
}>;
|
|
52
|
-
export declare const rawDataCountries_schema: z.ZodArray<RawDataCountrySchema
|
|
52
|
+
export declare const rawDataCountries_schema: z.ZodArray<RawDataCountrySchema>;
|
|
53
53
|
/**
|
|
54
54
|
* Country
|
|
55
55
|
*/
|
package/dist/json/languages.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ type RawDataLanguageSchema = z.ZodObject<{
|
|
|
21
21
|
*/
|
|
22
22
|
catalog: z.ZodString;
|
|
23
23
|
}>;
|
|
24
|
-
export declare const rawDataLanguages_schema: z.ZodArray<RawDataLanguageSchema
|
|
24
|
+
export declare const rawDataLanguages_schema: z.ZodArray<RawDataLanguageSchema>;
|
|
25
25
|
/**
|
|
26
26
|
* Language
|
|
27
27
|
*/
|
package/dist/json/pages.d.ts
CHANGED
|
@@ -21,21 +21,17 @@ type RawDataPageSchema = z.ZodObject<{
|
|
|
21
21
|
*/
|
|
22
22
|
description: z.ZodOptional<z.ZodString>;
|
|
23
23
|
/** List of page components */
|
|
24
|
-
components: z.ZodArray<z.ZodDiscriminatedUnion<
|
|
24
|
+
components: z.ZodArray<z.ZodDiscriminatedUnion<[
|
|
25
25
|
CarouselSchema,
|
|
26
26
|
GridSchema,
|
|
27
27
|
HeroSchema,
|
|
28
28
|
ProductGridSchema,
|
|
29
29
|
MarkdownSchema
|
|
30
|
-
]>>;
|
|
30
|
+
], 'type'>>;
|
|
31
31
|
}>;
|
|
32
32
|
export declare const rawDataPage_schema: RawDataPageSchema;
|
|
33
33
|
type RawDataLocalizedPageSchema = LocalizedFieldSchema<RawDataPageSchema>;
|
|
34
|
-
type PagesSchema<T extends z.
|
|
35
|
-
[urlSlug: string]: z.infer<T>;
|
|
36
|
-
}, {
|
|
37
|
-
[urlSlug: string]: z.infer<T>;
|
|
38
|
-
}>;
|
|
34
|
+
type PagesSchema<T extends z.ZodType> = z.ZodObject<{}, z.core.$catchall<T>>;
|
|
39
35
|
type RawDataPagesSchema = PagesSchema<RawDataLocalizedPageSchema>;
|
|
40
36
|
export declare const rawDataPages_schema: RawDataPagesSchema;
|
|
41
37
|
/**
|
package/dist/json/products.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ type RawDataProductSchema = z.ZodObject<{
|
|
|
49
49
|
* It should always start with a forward slash (`/`).
|
|
50
50
|
* @example "/white-apron-with-black-logo/APRONXXXFFFFFF000000XXXX"
|
|
51
51
|
*/
|
|
52
|
-
slug: z.
|
|
52
|
+
slug: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
53
53
|
/**
|
|
54
54
|
* The localized product name
|
|
55
55
|
*
|
|
@@ -137,7 +137,7 @@ export declare const rawDataProducts_schema: z.ZodArray<z.ZodObject<{
|
|
|
137
137
|
* It should always start with a forward slash (`/`).
|
|
138
138
|
* @example "/white-apron-with-black-logo/APRONXXXFFFFFF000000XXXX"
|
|
139
139
|
*/
|
|
140
|
-
slug: z.
|
|
140
|
+
slug: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
141
141
|
/**
|
|
142
142
|
* The localized product name
|
|
143
143
|
*
|
|
@@ -185,181 +185,7 @@ export declare const rawDataProducts_schema: z.ZodArray<z.ZodObject<{
|
|
|
185
185
|
* ]
|
|
186
186
|
*/
|
|
187
187
|
details: z.ZodOptional<z.ZodArray<DetailSchema>>;
|
|
188
|
-
},
|
|
189
|
-
/**
|
|
190
|
-
* The **product code** identifies the base product
|
|
191
|
-
*
|
|
192
|
-
* A master product or base product is a non-sellable product that represents a group of similar or related products.
|
|
193
|
-
*
|
|
194
|
-
* For example, a clothing retailer may have a master product for each type of clothing item, such as "men's t-shirts" or "women's dresses".
|
|
195
|
-
* Each of these master products would contain multiple variations, such as different sizes, colors, and styles.
|
|
196
|
-
*/
|
|
197
|
-
productCode: z.ZodString;
|
|
198
|
-
/**
|
|
199
|
-
* The **variant code** identifies a variation product
|
|
200
|
-
*
|
|
201
|
-
* A variation product is a product that is part of a group of similar or related products,
|
|
202
|
-
* and it is identified by specific attributes or characteristics that distinguish it from the other products in the group (color, material, size, etc.).
|
|
203
|
-
*
|
|
204
|
-
* The `variantCode`, in Demo Store, is used for grouping similar products in the listing page.
|
|
205
|
-
* Usually a different `variantCode` corresponds to a different product image.
|
|
206
|
-
*/
|
|
207
|
-
variantCode: z.ZodString;
|
|
208
|
-
/**
|
|
209
|
-
* The **sku** is a **unique identifier**, meaning *Stock Keeping Unit*.
|
|
210
|
-
*
|
|
211
|
-
* This is the stock unit in a warehouse used to track availability and stock variations of an item to be sold.
|
|
212
|
-
* SKUs can be a variant of any item (e.g., Medium or Large size of a jogger pant).
|
|
213
|
-
*
|
|
214
|
-
* An SKU usually consists of letters and numbers (either EAN code, UPC, or any other code format) like "LSLEEVMM000000FFFFFFMXXX".
|
|
215
|
-
* SKU refers to an item's details, including variants data (e.g., a T-shirt, Red color, Nike brand, 0.5g, XL size).
|
|
216
|
-
* An SKU identifies each product item's characteristics such as manufacturer name, brand name, style, color, weight, and size.
|
|
217
|
-
*/
|
|
218
|
-
sku: z.ZodString;
|
|
219
|
-
/**
|
|
220
|
-
* The product URL slug
|
|
221
|
-
*
|
|
222
|
-
* The slug is the part of a URL that identifies a particular page on a website in an easy-to-read form.
|
|
223
|
-
*
|
|
224
|
-
* It should always start with a forward slash (`/`).
|
|
225
|
-
* @example "/white-apron-with-black-logo/APRONXXXFFFFFF000000XXXX"
|
|
226
|
-
*/
|
|
227
|
-
slug: z.ZodEffects<z.ZodString>;
|
|
228
|
-
/**
|
|
229
|
-
* The localized product name
|
|
230
|
-
*
|
|
231
|
-
* @example
|
|
232
|
-
* {
|
|
233
|
-
* "it": "Maglietta Grigia",
|
|
234
|
-
* "en-US": "Gray T-Shirt"
|
|
235
|
-
* }
|
|
236
|
-
*/
|
|
237
|
-
name: LocalizedFieldSchema<z.ZodString>;
|
|
238
|
-
/**
|
|
239
|
-
* The localized product description
|
|
240
|
-
*
|
|
241
|
-
* @example
|
|
242
|
-
* {
|
|
243
|
-
* "it": "Descrizione"
|
|
244
|
-
* "en-US": "Description",
|
|
245
|
-
* }
|
|
246
|
-
*/
|
|
247
|
-
description: LocalizedFieldSchema<z.ZodString>;
|
|
248
|
-
/**
|
|
249
|
-
* A carousel of image URLs that represent the product
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* [
|
|
253
|
-
* "https://res.cloudinary.com/commercelayer/image/upload/f_auto,b_white/demo-store/skus/TSHIRTMSB0B0B2000000LXXX_FLAT.png"
|
|
254
|
-
* ]
|
|
255
|
-
*/
|
|
256
|
-
images: z.ZodArray<z.ZodString>;
|
|
257
|
-
/**
|
|
258
|
-
* Additional product details
|
|
259
|
-
*
|
|
260
|
-
* This attribute is presented as accordion just below the "Add to cart" button.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* [
|
|
264
|
-
* {
|
|
265
|
-
* "title": {
|
|
266
|
-
* "en": "Details"
|
|
267
|
-
* },
|
|
268
|
-
* "content": {
|
|
269
|
-
* "en": "Content here."
|
|
270
|
-
* }
|
|
271
|
-
* }
|
|
272
|
-
* ]
|
|
273
|
-
*/
|
|
274
|
-
details: z.ZodOptional<z.ZodArray<DetailSchema>>;
|
|
275
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
276
|
-
/**
|
|
277
|
-
* The **product code** identifies the base product
|
|
278
|
-
*
|
|
279
|
-
* A master product or base product is a non-sellable product that represents a group of similar or related products.
|
|
280
|
-
*
|
|
281
|
-
* For example, a clothing retailer may have a master product for each type of clothing item, such as "men's t-shirts" or "women's dresses".
|
|
282
|
-
* Each of these master products would contain multiple variations, such as different sizes, colors, and styles.
|
|
283
|
-
*/
|
|
284
|
-
productCode: z.ZodString;
|
|
285
|
-
/**
|
|
286
|
-
* The **variant code** identifies a variation product
|
|
287
|
-
*
|
|
288
|
-
* A variation product is a product that is part of a group of similar or related products,
|
|
289
|
-
* and it is identified by specific attributes or characteristics that distinguish it from the other products in the group (color, material, size, etc.).
|
|
290
|
-
*
|
|
291
|
-
* The `variantCode`, in Demo Store, is used for grouping similar products in the listing page.
|
|
292
|
-
* Usually a different `variantCode` corresponds to a different product image.
|
|
293
|
-
*/
|
|
294
|
-
variantCode: z.ZodString;
|
|
295
|
-
/**
|
|
296
|
-
* The **sku** is a **unique identifier**, meaning *Stock Keeping Unit*.
|
|
297
|
-
*
|
|
298
|
-
* This is the stock unit in a warehouse used to track availability and stock variations of an item to be sold.
|
|
299
|
-
* SKUs can be a variant of any item (e.g., Medium or Large size of a jogger pant).
|
|
300
|
-
*
|
|
301
|
-
* An SKU usually consists of letters and numbers (either EAN code, UPC, or any other code format) like "LSLEEVMM000000FFFFFFMXXX".
|
|
302
|
-
* SKU refers to an item's details, including variants data (e.g., a T-shirt, Red color, Nike brand, 0.5g, XL size).
|
|
303
|
-
* An SKU identifies each product item's characteristics such as manufacturer name, brand name, style, color, weight, and size.
|
|
304
|
-
*/
|
|
305
|
-
sku: z.ZodString;
|
|
306
|
-
/**
|
|
307
|
-
* The product URL slug
|
|
308
|
-
*
|
|
309
|
-
* The slug is the part of a URL that identifies a particular page on a website in an easy-to-read form.
|
|
310
|
-
*
|
|
311
|
-
* It should always start with a forward slash (`/`).
|
|
312
|
-
* @example "/white-apron-with-black-logo/APRONXXXFFFFFF000000XXXX"
|
|
313
|
-
*/
|
|
314
|
-
slug: z.ZodEffects<z.ZodString>;
|
|
315
|
-
/**
|
|
316
|
-
* The localized product name
|
|
317
|
-
*
|
|
318
|
-
* @example
|
|
319
|
-
* {
|
|
320
|
-
* "it": "Maglietta Grigia",
|
|
321
|
-
* "en-US": "Gray T-Shirt"
|
|
322
|
-
* }
|
|
323
|
-
*/
|
|
324
|
-
name: LocalizedFieldSchema<z.ZodString>;
|
|
325
|
-
/**
|
|
326
|
-
* The localized product description
|
|
327
|
-
*
|
|
328
|
-
* @example
|
|
329
|
-
* {
|
|
330
|
-
* "it": "Descrizione"
|
|
331
|
-
* "en-US": "Description",
|
|
332
|
-
* }
|
|
333
|
-
*/
|
|
334
|
-
description: LocalizedFieldSchema<z.ZodString>;
|
|
335
|
-
/**
|
|
336
|
-
* A carousel of image URLs that represent the product
|
|
337
|
-
*
|
|
338
|
-
* @example
|
|
339
|
-
* [
|
|
340
|
-
* "https://res.cloudinary.com/commercelayer/image/upload/f_auto,b_white/demo-store/skus/TSHIRTMSB0B0B2000000LXXX_FLAT.png"
|
|
341
|
-
* ]
|
|
342
|
-
*/
|
|
343
|
-
images: z.ZodArray<z.ZodString>;
|
|
344
|
-
/**
|
|
345
|
-
* Additional product details
|
|
346
|
-
*
|
|
347
|
-
* This attribute is presented as accordion just below the "Add to cart" button.
|
|
348
|
-
*
|
|
349
|
-
* @example
|
|
350
|
-
* [
|
|
351
|
-
* {
|
|
352
|
-
* "title": {
|
|
353
|
-
* "en": "Details"
|
|
354
|
-
* },
|
|
355
|
-
* "content": {
|
|
356
|
-
* "en": "Content here."
|
|
357
|
-
* }
|
|
358
|
-
* }
|
|
359
|
-
* ]
|
|
360
|
-
*/
|
|
361
|
-
details: z.ZodOptional<z.ZodArray<DetailSchema>>;
|
|
362
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
188
|
+
}, z.core.$loose>>;
|
|
363
189
|
/**
|
|
364
190
|
* Product
|
|
365
191
|
*
|
package/dist/json/products.js
CHANGED
|
@@ -23,4 +23,4 @@ const rawDataProduct_schema = zod_1.z.object({
|
|
|
23
23
|
images: zod_1.z.string().array(),
|
|
24
24
|
details: detail_schema.array().optional()
|
|
25
25
|
});
|
|
26
|
-
exports.rawDataProducts_schema = rawDataProduct_schema.
|
|
26
|
+
exports.rawDataProducts_schema = rawDataProduct_schema.loose().array();
|
|
@@ -29,7 +29,7 @@ type RawDataTaxonomySchema = z.ZodObject<{
|
|
|
29
29
|
*/
|
|
30
30
|
taxons: z.ZodArray<z.ZodString>;
|
|
31
31
|
}>;
|
|
32
|
-
export declare const rawDataTaxonomies_schema: z.ZodArray<RawDataTaxonomySchema
|
|
32
|
+
export declare const rawDataTaxonomies_schema: z.ZodArray<RawDataTaxonomySchema>;
|
|
33
33
|
/**
|
|
34
34
|
* Taxonomy
|
|
35
35
|
*
|
package/dist/json/taxons.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ type RawDataTaxonSchema = z.ZodObject<{
|
|
|
41
41
|
* It should always start with a forward slash (`/`).
|
|
42
42
|
* @example "/clothing/shirts"
|
|
43
43
|
*/
|
|
44
|
-
slug: z.
|
|
44
|
+
slug: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
45
45
|
/**
|
|
46
46
|
* The list of `products` SKUs
|
|
47
47
|
*
|
|
@@ -58,7 +58,7 @@ type RawDataTaxonSchema = z.ZodObject<{
|
|
|
58
58
|
*/
|
|
59
59
|
taxons: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
60
60
|
}>;
|
|
61
|
-
export declare const rawDataTaxons_schema: z.ZodArray<RawDataTaxonSchema
|
|
61
|
+
export declare const rawDataTaxons_schema: z.ZodArray<RawDataTaxonSchema>;
|
|
62
62
|
/**
|
|
63
63
|
* Taxon
|
|
64
64
|
*
|
package/dist/utils/locale.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export type LocalizedFieldSchema<T extends z.
|
|
3
|
-
[localeCode: string]: z.infer<T>;
|
|
4
|
-
}, {
|
|
5
|
-
[localeCode: string]: z.infer<T>;
|
|
6
|
-
}>;
|
|
2
|
+
export type LocalizedFieldSchema<T extends z.ZodType> = z.ZodObject<{}, z.core.$catchall<T>>;
|
|
7
3
|
export type LocalizedField<T> = {
|
|
8
4
|
[localeCode: string]: T;
|
|
9
5
|
};
|
|
@@ -12,4 +8,4 @@ export type LocalizedField<T> = {
|
|
|
12
8
|
* @param type Type of the field value (any [zod](https://zod.dev/) type)
|
|
13
9
|
* @returns
|
|
14
10
|
*/
|
|
15
|
-
export declare const localizedFieldSchema: <T extends z.
|
|
11
|
+
export declare const localizedFieldSchema: <T extends z.ZodType>(type: T) => LocalizedFieldSchema<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/demo-store-types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Demo Store types",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,13 +12,14 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@types/lodash": "^4.17.
|
|
16
|
-
"lodash": "^4.
|
|
15
|
+
"@types/lodash": "^4.17.27",
|
|
16
|
+
"lodash": "^4.18.1",
|
|
17
17
|
"uvu": "^0.5.6",
|
|
18
|
-
"zod": "^
|
|
18
|
+
"zod": "^4.6.7"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"
|
|
21
|
+
"@types/node": "^22",
|
|
22
|
+
"typescript": "^7.0.2"
|
|
22
23
|
},
|
|
23
24
|
"scripts": {
|
|
24
25
|
"ts:check": "tsc --noEmit",
|
|
@@ -30,5 +31,5 @@
|
|
|
30
31
|
"access": "public",
|
|
31
32
|
"provenance": true
|
|
32
33
|
},
|
|
33
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "ec005b69d390c9e5ddb1a698c61c30eff5e638e2"
|
|
34
35
|
}
|