ce-storefront 0.7.1 → 0.7.2
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/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/components/booleanattribute.d.ts +46 -0
- package/esm/models/components/booleanattribute.d.ts.map +1 -0
- package/esm/models/components/booleanattribute.js +39 -0
- package/esm/models/components/booleanattribute.js.map +1 -0
- package/esm/models/components/colorattribute.d.ts +73 -0
- package/esm/models/components/colorattribute.d.ts.map +1 -0
- package/esm/models/components/colorattribute.js +67 -0
- package/esm/models/components/colorattribute.js.map +1 -0
- package/esm/models/components/dateattribute.d.ts +46 -0
- package/esm/models/components/dateattribute.d.ts.map +1 -0
- package/esm/models/components/dateattribute.js +39 -0
- package/esm/models/components/dateattribute.js.map +1 -0
- package/esm/models/components/index.d.ts +7 -0
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +7 -0
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/components/multiselectattribute.d.ts +46 -0
- package/esm/models/components/multiselectattribute.d.ts.map +1 -0
- package/esm/models/components/multiselectattribute.js +39 -0
- package/esm/models/components/multiselectattribute.js.map +1 -0
- package/esm/models/components/numberattribute.d.ts +46 -0
- package/esm/models/components/numberattribute.d.ts.map +1 -0
- package/esm/models/components/numberattribute.js +39 -0
- package/esm/models/components/numberattribute.js.map +1 -0
- package/esm/models/components/productattribute.d.ts +9 -401
- package/esm/models/components/productattribute.d.ts.map +1 -1
- package/esm/models/components/productattribute.js +21 -272
- package/esm/models/components/productattribute.js.map +1 -1
- package/esm/models/components/singleselectattribute.d.ts +46 -0
- package/esm/models/components/singleselectattribute.d.ts.map +1 -0
- package/esm/models/components/singleselectattribute.js +39 -0
- package/esm/models/components/singleselectattribute.js.map +1 -0
- package/esm/models/components/textattribute.d.ts +46 -0
- package/esm/models/components/textattribute.d.ts.map +1 -0
- package/esm/models/components/textattribute.js +39 -0
- package/esm/models/components/textattribute.js.map +1 -0
- package/esm/models/components/variantoption.d.ts +13 -13
- package/esm/models/components/variantoption.d.ts.map +1 -1
- package/esm/models/components/variantoption.js +13 -14
- package/esm/models/components/variantoption.js.map +1 -1
- package/esm/models/operations/listproducts.d.ts.map +1 -1
- package/esm/models/operations/listproducts.js +11 -7
- package/esm/models/operations/listproducts.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/models/components/booleanattribute.ts +91 -0
- package/src/models/components/colorattribute.ts +142 -0
- package/src/models/components/dateattribute.ts +87 -0
- package/src/models/components/index.ts +7 -0
- package/src/models/components/multiselectattribute.ts +91 -0
- package/src/models/components/numberattribute.ts +89 -0
- package/src/models/components/productattribute.ts +56 -685
- package/src/models/components/singleselectattribute.ts +91 -0
- package/src/models/components/textattribute.ts +87 -0
- package/src/models/components/variantoption.ts +27 -20
- package/src/models/operations/listproducts.ts +38 -34
|
@@ -6,686 +6,57 @@ import * as z from "zod";
|
|
|
6
6
|
import { safeParse } from "../../lib/schemas.js";
|
|
7
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Attribute for boolean values
|
|
12
|
-
*/
|
|
13
|
-
export type BooleanAttribute = {
|
|
14
|
-
/**
|
|
15
|
-
* Unique identifier for the attribute
|
|
16
|
-
*/
|
|
17
|
-
id: string;
|
|
18
|
-
/**
|
|
19
|
-
* Name of the attribute
|
|
20
|
-
*/
|
|
21
|
-
name: string;
|
|
22
|
-
/**
|
|
23
|
-
* A lookup safe version of the name that is lowercased and spaces are replaced with underscores. For instance, if name is `Product Type`, key will be `product_type`
|
|
24
|
-
*/
|
|
25
|
-
key: string;
|
|
26
|
-
type?: "number" | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* For boolean attributes
|
|
29
|
-
*/
|
|
30
|
-
value: boolean;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Attribute for numeric values
|
|
35
|
-
*/
|
|
36
|
-
export type NumberAttribute = {
|
|
37
|
-
/**
|
|
38
|
-
* Unique identifier for the attribute
|
|
39
|
-
*/
|
|
40
|
-
id: string;
|
|
41
|
-
/**
|
|
42
|
-
* Name of the attribute
|
|
43
|
-
*/
|
|
44
|
-
name: string;
|
|
45
|
-
/**
|
|
46
|
-
* A lookup safe version of the name that is lowercased and spaces are replaced with underscores. For instance, if name is `Product Type`, key will be `product_type`
|
|
47
|
-
*/
|
|
48
|
-
key: string;
|
|
49
|
-
type?: "number" | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* For numeric attributes
|
|
52
|
-
*/
|
|
53
|
-
value: number;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Attribute for date values
|
|
58
|
-
*/
|
|
59
|
-
export type DateAttribute = {
|
|
60
|
-
/**
|
|
61
|
-
* Unique identifier for the attribute
|
|
62
|
-
*/
|
|
63
|
-
id: string;
|
|
64
|
-
/**
|
|
65
|
-
* Name of the attribute
|
|
66
|
-
*/
|
|
67
|
-
name: string;
|
|
68
|
-
/**
|
|
69
|
-
* A lookup safe version of the name that is lowercased and spaces are replaced with underscores. For instance, if name is `Product Type`, key will be `product_type`
|
|
70
|
-
*/
|
|
71
|
-
key: string;
|
|
72
|
-
type?: "date" | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* For date attributes
|
|
75
|
-
*/
|
|
76
|
-
value: Date;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Attribute for text values
|
|
81
|
-
*/
|
|
82
|
-
export type TextAttribute = {
|
|
83
|
-
/**
|
|
84
|
-
* Unique identifier for the attribute
|
|
85
|
-
*/
|
|
86
|
-
id: string;
|
|
87
|
-
/**
|
|
88
|
-
* Name of the attribute
|
|
89
|
-
*/
|
|
90
|
-
name: string;
|
|
91
|
-
/**
|
|
92
|
-
* A lookup safe version of the name that is lowercased and spaces are replaced with underscores. For instance, if name is `Product Type`, key will be `product_type`
|
|
93
|
-
*/
|
|
94
|
-
key: string;
|
|
95
|
-
type?: "text" | undefined;
|
|
96
|
-
/**
|
|
97
|
-
* For text attributes
|
|
98
|
-
*/
|
|
99
|
-
value: string;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Attribute for multi-select values
|
|
104
|
-
*/
|
|
105
|
-
export type MultiSelectAttribute = {
|
|
106
|
-
/**
|
|
107
|
-
* Unique identifier for the attribute
|
|
108
|
-
*/
|
|
109
|
-
id: string;
|
|
110
|
-
/**
|
|
111
|
-
* Name of the attribute
|
|
112
|
-
*/
|
|
113
|
-
name: string;
|
|
114
|
-
/**
|
|
115
|
-
* A lookup safe version of the name that is lowercased and spaces are replaced with underscores. For instance, if name is `Product Type`, key will be `product_type`
|
|
116
|
-
*/
|
|
117
|
-
key: string;
|
|
118
|
-
type?: "multi-select" | undefined;
|
|
119
|
-
/**
|
|
120
|
-
* For multi-select attributes
|
|
121
|
-
*/
|
|
122
|
-
value: Array<string>;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Attribute for single-select values
|
|
127
|
-
*/
|
|
128
|
-
export type SingleSelectAttribute = {
|
|
129
|
-
/**
|
|
130
|
-
* Unique identifier for the attribute
|
|
131
|
-
*/
|
|
132
|
-
id: string;
|
|
133
|
-
/**
|
|
134
|
-
* Name of the attribute
|
|
135
|
-
*/
|
|
136
|
-
name: string;
|
|
137
|
-
/**
|
|
138
|
-
* A lookup safe version of the name that is lowercased and spaces are replaced with underscores. For instance, if name is `Product Type`, key will be `product_type`
|
|
139
|
-
*/
|
|
140
|
-
key: string;
|
|
141
|
-
type?: "single-select" | undefined;
|
|
142
|
-
/**
|
|
143
|
-
* For single-select attributes
|
|
144
|
-
*/
|
|
145
|
-
value: string;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export type ColorAttributeValue = {
|
|
149
|
-
name: string;
|
|
150
|
-
/**
|
|
151
|
-
* The hex code of the color (e.g., #000000).
|
|
152
|
-
*/
|
|
153
|
-
hexcode: string;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Attribute for colors
|
|
158
|
-
*/
|
|
159
|
-
export type ColorAttribute = {
|
|
160
|
-
/**
|
|
161
|
-
* Unique identifier for the attribute
|
|
162
|
-
*/
|
|
163
|
-
id: string;
|
|
164
|
-
/**
|
|
165
|
-
* Name of the attribute
|
|
166
|
-
*/
|
|
167
|
-
name: string;
|
|
168
|
-
/**
|
|
169
|
-
* A lookup safe version of the name that is lowercased and spaces are replaced with underscores. For instance, if name is `Product Type`, key will be `product_type`
|
|
170
|
-
*/
|
|
171
|
-
key: string;
|
|
172
|
-
type?: "color" | undefined;
|
|
173
|
-
value: Array<ColorAttributeValue>;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
export type ProductAttribute =
|
|
177
|
-
| (ColorAttribute & { type: "color" })
|
|
178
|
-
| (SingleSelectAttribute & { type: "single-select" })
|
|
179
|
-
| (MultiSelectAttribute & { type: "multi-select" })
|
|
180
|
-
| (TextAttribute & { type: "text" })
|
|
181
|
-
| (DateAttribute & { type: "date" })
|
|
182
|
-
| (NumberAttribute & { type: "number" })
|
|
183
|
-
| (BooleanAttribute & { type: "boolean" });
|
|
184
|
-
|
|
185
|
-
/** @internal */
|
|
186
|
-
export const BooleanAttribute$inboundSchema: z.ZodType<
|
|
9
|
+
import {
|
|
187
10
|
BooleanAttribute,
|
|
188
|
-
|
|
189
|
-
unknown
|
|
190
|
-
> = z.object({
|
|
191
|
-
id: z.string(),
|
|
192
|
-
name: z.string(),
|
|
193
|
-
key: z.string(),
|
|
194
|
-
type: z.literal("number").optional(),
|
|
195
|
-
value: z.boolean(),
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
/** @internal */
|
|
199
|
-
export type BooleanAttribute$Outbound = {
|
|
200
|
-
id: string;
|
|
201
|
-
name: string;
|
|
202
|
-
key: string;
|
|
203
|
-
type: "number";
|
|
204
|
-
value: boolean;
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
/** @internal */
|
|
208
|
-
export const BooleanAttribute$outboundSchema: z.ZodType<
|
|
11
|
+
BooleanAttribute$inboundSchema,
|
|
209
12
|
BooleanAttribute$Outbound,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* @internal
|
|
222
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
223
|
-
*/
|
|
224
|
-
export namespace BooleanAttribute$ {
|
|
225
|
-
/** @deprecated use `BooleanAttribute$inboundSchema` instead. */
|
|
226
|
-
export const inboundSchema = BooleanAttribute$inboundSchema;
|
|
227
|
-
/** @deprecated use `BooleanAttribute$outboundSchema` instead. */
|
|
228
|
-
export const outboundSchema = BooleanAttribute$outboundSchema;
|
|
229
|
-
/** @deprecated use `BooleanAttribute$Outbound` instead. */
|
|
230
|
-
export type Outbound = BooleanAttribute$Outbound;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export function booleanAttributeToJSON(
|
|
234
|
-
booleanAttribute: BooleanAttribute,
|
|
235
|
-
): string {
|
|
236
|
-
return JSON.stringify(
|
|
237
|
-
BooleanAttribute$outboundSchema.parse(booleanAttribute),
|
|
238
|
-
);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export function booleanAttributeFromJSON(
|
|
242
|
-
jsonString: string,
|
|
243
|
-
): SafeParseResult<BooleanAttribute, SDKValidationError> {
|
|
244
|
-
return safeParse(
|
|
245
|
-
jsonString,
|
|
246
|
-
(x) => BooleanAttribute$inboundSchema.parse(JSON.parse(x)),
|
|
247
|
-
`Failed to parse 'BooleanAttribute' from JSON`,
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/** @internal */
|
|
252
|
-
export const NumberAttribute$inboundSchema: z.ZodType<
|
|
253
|
-
NumberAttribute,
|
|
254
|
-
z.ZodTypeDef,
|
|
255
|
-
unknown
|
|
256
|
-
> = z.object({
|
|
257
|
-
id: z.string(),
|
|
258
|
-
name: z.string(),
|
|
259
|
-
key: z.string(),
|
|
260
|
-
type: z.literal("number").optional(),
|
|
261
|
-
value: z.number(),
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
/** @internal */
|
|
265
|
-
export type NumberAttribute$Outbound = {
|
|
266
|
-
id: string;
|
|
267
|
-
name: string;
|
|
268
|
-
key: string;
|
|
269
|
-
type: "number";
|
|
270
|
-
value: number;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
/** @internal */
|
|
274
|
-
export const NumberAttribute$outboundSchema: z.ZodType<
|
|
275
|
-
NumberAttribute$Outbound,
|
|
276
|
-
z.ZodTypeDef,
|
|
277
|
-
NumberAttribute
|
|
278
|
-
> = z.object({
|
|
279
|
-
id: z.string(),
|
|
280
|
-
name: z.string(),
|
|
281
|
-
key: z.string(),
|
|
282
|
-
type: z.literal("number").default("number" as const),
|
|
283
|
-
value: z.number(),
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* @internal
|
|
288
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
289
|
-
*/
|
|
290
|
-
export namespace NumberAttribute$ {
|
|
291
|
-
/** @deprecated use `NumberAttribute$inboundSchema` instead. */
|
|
292
|
-
export const inboundSchema = NumberAttribute$inboundSchema;
|
|
293
|
-
/** @deprecated use `NumberAttribute$outboundSchema` instead. */
|
|
294
|
-
export const outboundSchema = NumberAttribute$outboundSchema;
|
|
295
|
-
/** @deprecated use `NumberAttribute$Outbound` instead. */
|
|
296
|
-
export type Outbound = NumberAttribute$Outbound;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
export function numberAttributeToJSON(
|
|
300
|
-
numberAttribute: NumberAttribute,
|
|
301
|
-
): string {
|
|
302
|
-
return JSON.stringify(NumberAttribute$outboundSchema.parse(numberAttribute));
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
export function numberAttributeFromJSON(
|
|
306
|
-
jsonString: string,
|
|
307
|
-
): SafeParseResult<NumberAttribute, SDKValidationError> {
|
|
308
|
-
return safeParse(
|
|
309
|
-
jsonString,
|
|
310
|
-
(x) => NumberAttribute$inboundSchema.parse(JSON.parse(x)),
|
|
311
|
-
`Failed to parse 'NumberAttribute' from JSON`,
|
|
312
|
-
);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/** @internal */
|
|
316
|
-
export const DateAttribute$inboundSchema: z.ZodType<
|
|
13
|
+
BooleanAttribute$outboundSchema,
|
|
14
|
+
} from "./booleanattribute.js";
|
|
15
|
+
import {
|
|
16
|
+
ColorAttribute,
|
|
17
|
+
ColorAttribute$inboundSchema,
|
|
18
|
+
ColorAttribute$Outbound,
|
|
19
|
+
ColorAttribute$outboundSchema,
|
|
20
|
+
} from "./colorattribute.js";
|
|
21
|
+
import {
|
|
317
22
|
DateAttribute,
|
|
318
|
-
|
|
319
|
-
unknown
|
|
320
|
-
> = z.object({
|
|
321
|
-
id: z.string(),
|
|
322
|
-
name: z.string(),
|
|
323
|
-
key: z.string(),
|
|
324
|
-
type: z.literal("date").optional(),
|
|
325
|
-
value: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
/** @internal */
|
|
329
|
-
export type DateAttribute$Outbound = {
|
|
330
|
-
id: string;
|
|
331
|
-
name: string;
|
|
332
|
-
key: string;
|
|
333
|
-
type: "date";
|
|
334
|
-
value: string;
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
/** @internal */
|
|
338
|
-
export const DateAttribute$outboundSchema: z.ZodType<
|
|
23
|
+
DateAttribute$inboundSchema,
|
|
339
24
|
DateAttribute$Outbound,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
id: z.string(),
|
|
344
|
-
name: z.string(),
|
|
345
|
-
key: z.string(),
|
|
346
|
-
type: z.literal("date").default("date" as const),
|
|
347
|
-
value: z.date().transform(v => v.toISOString()),
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* @internal
|
|
352
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
353
|
-
*/
|
|
354
|
-
export namespace DateAttribute$ {
|
|
355
|
-
/** @deprecated use `DateAttribute$inboundSchema` instead. */
|
|
356
|
-
export const inboundSchema = DateAttribute$inboundSchema;
|
|
357
|
-
/** @deprecated use `DateAttribute$outboundSchema` instead. */
|
|
358
|
-
export const outboundSchema = DateAttribute$outboundSchema;
|
|
359
|
-
/** @deprecated use `DateAttribute$Outbound` instead. */
|
|
360
|
-
export type Outbound = DateAttribute$Outbound;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
export function dateAttributeToJSON(dateAttribute: DateAttribute): string {
|
|
364
|
-
return JSON.stringify(DateAttribute$outboundSchema.parse(dateAttribute));
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
export function dateAttributeFromJSON(
|
|
368
|
-
jsonString: string,
|
|
369
|
-
): SafeParseResult<DateAttribute, SDKValidationError> {
|
|
370
|
-
return safeParse(
|
|
371
|
-
jsonString,
|
|
372
|
-
(x) => DateAttribute$inboundSchema.parse(JSON.parse(x)),
|
|
373
|
-
`Failed to parse 'DateAttribute' from JSON`,
|
|
374
|
-
);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/** @internal */
|
|
378
|
-
export const TextAttribute$inboundSchema: z.ZodType<
|
|
379
|
-
TextAttribute,
|
|
380
|
-
z.ZodTypeDef,
|
|
381
|
-
unknown
|
|
382
|
-
> = z.object({
|
|
383
|
-
id: z.string(),
|
|
384
|
-
name: z.string(),
|
|
385
|
-
key: z.string(),
|
|
386
|
-
type: z.literal("text").optional(),
|
|
387
|
-
value: z.string(),
|
|
388
|
-
});
|
|
389
|
-
|
|
390
|
-
/** @internal */
|
|
391
|
-
export type TextAttribute$Outbound = {
|
|
392
|
-
id: string;
|
|
393
|
-
name: string;
|
|
394
|
-
key: string;
|
|
395
|
-
type: "text";
|
|
396
|
-
value: string;
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
/** @internal */
|
|
400
|
-
export const TextAttribute$outboundSchema: z.ZodType<
|
|
401
|
-
TextAttribute$Outbound,
|
|
402
|
-
z.ZodTypeDef,
|
|
403
|
-
TextAttribute
|
|
404
|
-
> = z.object({
|
|
405
|
-
id: z.string(),
|
|
406
|
-
name: z.string(),
|
|
407
|
-
key: z.string(),
|
|
408
|
-
type: z.literal("text").default("text" as const),
|
|
409
|
-
value: z.string(),
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* @internal
|
|
414
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
415
|
-
*/
|
|
416
|
-
export namespace TextAttribute$ {
|
|
417
|
-
/** @deprecated use `TextAttribute$inboundSchema` instead. */
|
|
418
|
-
export const inboundSchema = TextAttribute$inboundSchema;
|
|
419
|
-
/** @deprecated use `TextAttribute$outboundSchema` instead. */
|
|
420
|
-
export const outboundSchema = TextAttribute$outboundSchema;
|
|
421
|
-
/** @deprecated use `TextAttribute$Outbound` instead. */
|
|
422
|
-
export type Outbound = TextAttribute$Outbound;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
export function textAttributeToJSON(textAttribute: TextAttribute): string {
|
|
426
|
-
return JSON.stringify(TextAttribute$outboundSchema.parse(textAttribute));
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
export function textAttributeFromJSON(
|
|
430
|
-
jsonString: string,
|
|
431
|
-
): SafeParseResult<TextAttribute, SDKValidationError> {
|
|
432
|
-
return safeParse(
|
|
433
|
-
jsonString,
|
|
434
|
-
(x) => TextAttribute$inboundSchema.parse(JSON.parse(x)),
|
|
435
|
-
`Failed to parse 'TextAttribute' from JSON`,
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/** @internal */
|
|
440
|
-
export const MultiSelectAttribute$inboundSchema: z.ZodType<
|
|
25
|
+
DateAttribute$outboundSchema,
|
|
26
|
+
} from "./dateattribute.js";
|
|
27
|
+
import {
|
|
441
28
|
MultiSelectAttribute,
|
|
442
|
-
|
|
443
|
-
unknown
|
|
444
|
-
> = z.object({
|
|
445
|
-
id: z.string(),
|
|
446
|
-
name: z.string(),
|
|
447
|
-
key: z.string(),
|
|
448
|
-
type: z.literal("multi-select").optional(),
|
|
449
|
-
value: z.array(z.string()),
|
|
450
|
-
});
|
|
451
|
-
|
|
452
|
-
/** @internal */
|
|
453
|
-
export type MultiSelectAttribute$Outbound = {
|
|
454
|
-
id: string;
|
|
455
|
-
name: string;
|
|
456
|
-
key: string;
|
|
457
|
-
type: "multi-select";
|
|
458
|
-
value: Array<string>;
|
|
459
|
-
};
|
|
460
|
-
|
|
461
|
-
/** @internal */
|
|
462
|
-
export const MultiSelectAttribute$outboundSchema: z.ZodType<
|
|
29
|
+
MultiSelectAttribute$inboundSchema,
|
|
463
30
|
MultiSelectAttribute$Outbound,
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* @internal
|
|
476
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
477
|
-
*/
|
|
478
|
-
export namespace MultiSelectAttribute$ {
|
|
479
|
-
/** @deprecated use `MultiSelectAttribute$inboundSchema` instead. */
|
|
480
|
-
export const inboundSchema = MultiSelectAttribute$inboundSchema;
|
|
481
|
-
/** @deprecated use `MultiSelectAttribute$outboundSchema` instead. */
|
|
482
|
-
export const outboundSchema = MultiSelectAttribute$outboundSchema;
|
|
483
|
-
/** @deprecated use `MultiSelectAttribute$Outbound` instead. */
|
|
484
|
-
export type Outbound = MultiSelectAttribute$Outbound;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
export function multiSelectAttributeToJSON(
|
|
488
|
-
multiSelectAttribute: MultiSelectAttribute,
|
|
489
|
-
): string {
|
|
490
|
-
return JSON.stringify(
|
|
491
|
-
MultiSelectAttribute$outboundSchema.parse(multiSelectAttribute),
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
export function multiSelectAttributeFromJSON(
|
|
496
|
-
jsonString: string,
|
|
497
|
-
): SafeParseResult<MultiSelectAttribute, SDKValidationError> {
|
|
498
|
-
return safeParse(
|
|
499
|
-
jsonString,
|
|
500
|
-
(x) => MultiSelectAttribute$inboundSchema.parse(JSON.parse(x)),
|
|
501
|
-
`Failed to parse 'MultiSelectAttribute' from JSON`,
|
|
502
|
-
);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/** @internal */
|
|
506
|
-
export const SingleSelectAttribute$inboundSchema: z.ZodType<
|
|
31
|
+
MultiSelectAttribute$outboundSchema,
|
|
32
|
+
} from "./multiselectattribute.js";
|
|
33
|
+
import {
|
|
34
|
+
NumberAttribute,
|
|
35
|
+
NumberAttribute$inboundSchema,
|
|
36
|
+
NumberAttribute$Outbound,
|
|
37
|
+
NumberAttribute$outboundSchema,
|
|
38
|
+
} from "./numberattribute.js";
|
|
39
|
+
import {
|
|
507
40
|
SingleSelectAttribute,
|
|
508
|
-
|
|
509
|
-
unknown
|
|
510
|
-
> = z.object({
|
|
511
|
-
id: z.string(),
|
|
512
|
-
name: z.string(),
|
|
513
|
-
key: z.string(),
|
|
514
|
-
type: z.literal("single-select").optional(),
|
|
515
|
-
value: z.string(),
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
/** @internal */
|
|
519
|
-
export type SingleSelectAttribute$Outbound = {
|
|
520
|
-
id: string;
|
|
521
|
-
name: string;
|
|
522
|
-
key: string;
|
|
523
|
-
type: "single-select";
|
|
524
|
-
value: string;
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
/** @internal */
|
|
528
|
-
export const SingleSelectAttribute$outboundSchema: z.ZodType<
|
|
41
|
+
SingleSelectAttribute$inboundSchema,
|
|
529
42
|
SingleSelectAttribute$Outbound,
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* @internal
|
|
542
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
543
|
-
*/
|
|
544
|
-
export namespace SingleSelectAttribute$ {
|
|
545
|
-
/** @deprecated use `SingleSelectAttribute$inboundSchema` instead. */
|
|
546
|
-
export const inboundSchema = SingleSelectAttribute$inboundSchema;
|
|
547
|
-
/** @deprecated use `SingleSelectAttribute$outboundSchema` instead. */
|
|
548
|
-
export const outboundSchema = SingleSelectAttribute$outboundSchema;
|
|
549
|
-
/** @deprecated use `SingleSelectAttribute$Outbound` instead. */
|
|
550
|
-
export type Outbound = SingleSelectAttribute$Outbound;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
export function singleSelectAttributeToJSON(
|
|
554
|
-
singleSelectAttribute: SingleSelectAttribute,
|
|
555
|
-
): string {
|
|
556
|
-
return JSON.stringify(
|
|
557
|
-
SingleSelectAttribute$outboundSchema.parse(singleSelectAttribute),
|
|
558
|
-
);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
export function singleSelectAttributeFromJSON(
|
|
562
|
-
jsonString: string,
|
|
563
|
-
): SafeParseResult<SingleSelectAttribute, SDKValidationError> {
|
|
564
|
-
return safeParse(
|
|
565
|
-
jsonString,
|
|
566
|
-
(x) => SingleSelectAttribute$inboundSchema.parse(JSON.parse(x)),
|
|
567
|
-
`Failed to parse 'SingleSelectAttribute' from JSON`,
|
|
568
|
-
);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/** @internal */
|
|
572
|
-
export const ColorAttributeValue$inboundSchema: z.ZodType<
|
|
573
|
-
ColorAttributeValue,
|
|
574
|
-
z.ZodTypeDef,
|
|
575
|
-
unknown
|
|
576
|
-
> = z.object({
|
|
577
|
-
name: z.string(),
|
|
578
|
-
hexcode: z.string(),
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
/** @internal */
|
|
582
|
-
export type ColorAttributeValue$Outbound = {
|
|
583
|
-
name: string;
|
|
584
|
-
hexcode: string;
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
/** @internal */
|
|
588
|
-
export const ColorAttributeValue$outboundSchema: z.ZodType<
|
|
589
|
-
ColorAttributeValue$Outbound,
|
|
590
|
-
z.ZodTypeDef,
|
|
591
|
-
ColorAttributeValue
|
|
592
|
-
> = z.object({
|
|
593
|
-
name: z.string(),
|
|
594
|
-
hexcode: z.string(),
|
|
595
|
-
});
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* @internal
|
|
599
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
600
|
-
*/
|
|
601
|
-
export namespace ColorAttributeValue$ {
|
|
602
|
-
/** @deprecated use `ColorAttributeValue$inboundSchema` instead. */
|
|
603
|
-
export const inboundSchema = ColorAttributeValue$inboundSchema;
|
|
604
|
-
/** @deprecated use `ColorAttributeValue$outboundSchema` instead. */
|
|
605
|
-
export const outboundSchema = ColorAttributeValue$outboundSchema;
|
|
606
|
-
/** @deprecated use `ColorAttributeValue$Outbound` instead. */
|
|
607
|
-
export type Outbound = ColorAttributeValue$Outbound;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
export function colorAttributeValueToJSON(
|
|
611
|
-
colorAttributeValue: ColorAttributeValue,
|
|
612
|
-
): string {
|
|
613
|
-
return JSON.stringify(
|
|
614
|
-
ColorAttributeValue$outboundSchema.parse(colorAttributeValue),
|
|
615
|
-
);
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
export function colorAttributeValueFromJSON(
|
|
619
|
-
jsonString: string,
|
|
620
|
-
): SafeParseResult<ColorAttributeValue, SDKValidationError> {
|
|
621
|
-
return safeParse(
|
|
622
|
-
jsonString,
|
|
623
|
-
(x) => ColorAttributeValue$inboundSchema.parse(JSON.parse(x)),
|
|
624
|
-
`Failed to parse 'ColorAttributeValue' from JSON`,
|
|
625
|
-
);
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
/** @internal */
|
|
629
|
-
export const ColorAttribute$inboundSchema: z.ZodType<
|
|
630
|
-
ColorAttribute,
|
|
631
|
-
z.ZodTypeDef,
|
|
632
|
-
unknown
|
|
633
|
-
> = z.object({
|
|
634
|
-
id: z.string(),
|
|
635
|
-
name: z.string(),
|
|
636
|
-
key: z.string(),
|
|
637
|
-
type: z.literal("color").optional(),
|
|
638
|
-
value: z.array(z.lazy(() => ColorAttributeValue$inboundSchema)),
|
|
639
|
-
});
|
|
640
|
-
|
|
641
|
-
/** @internal */
|
|
642
|
-
export type ColorAttribute$Outbound = {
|
|
643
|
-
id: string;
|
|
644
|
-
name: string;
|
|
645
|
-
key: string;
|
|
646
|
-
type: "color";
|
|
647
|
-
value: Array<ColorAttributeValue$Outbound>;
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
/** @internal */
|
|
651
|
-
export const ColorAttribute$outboundSchema: z.ZodType<
|
|
652
|
-
ColorAttribute$Outbound,
|
|
653
|
-
z.ZodTypeDef,
|
|
654
|
-
ColorAttribute
|
|
655
|
-
> = z.object({
|
|
656
|
-
id: z.string(),
|
|
657
|
-
name: z.string(),
|
|
658
|
-
key: z.string(),
|
|
659
|
-
type: z.literal("color").default("color" as const),
|
|
660
|
-
value: z.array(z.lazy(() => ColorAttributeValue$outboundSchema)),
|
|
661
|
-
});
|
|
662
|
-
|
|
663
|
-
/**
|
|
664
|
-
* @internal
|
|
665
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
666
|
-
*/
|
|
667
|
-
export namespace ColorAttribute$ {
|
|
668
|
-
/** @deprecated use `ColorAttribute$inboundSchema` instead. */
|
|
669
|
-
export const inboundSchema = ColorAttribute$inboundSchema;
|
|
670
|
-
/** @deprecated use `ColorAttribute$outboundSchema` instead. */
|
|
671
|
-
export const outboundSchema = ColorAttribute$outboundSchema;
|
|
672
|
-
/** @deprecated use `ColorAttribute$Outbound` instead. */
|
|
673
|
-
export type Outbound = ColorAttribute$Outbound;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
export function colorAttributeToJSON(colorAttribute: ColorAttribute): string {
|
|
677
|
-
return JSON.stringify(ColorAttribute$outboundSchema.parse(colorAttribute));
|
|
678
|
-
}
|
|
43
|
+
SingleSelectAttribute$outboundSchema,
|
|
44
|
+
} from "./singleselectattribute.js";
|
|
45
|
+
import {
|
|
46
|
+
TextAttribute,
|
|
47
|
+
TextAttribute$inboundSchema,
|
|
48
|
+
TextAttribute$Outbound,
|
|
49
|
+
TextAttribute$outboundSchema,
|
|
50
|
+
} from "./textattribute.js";
|
|
679
51
|
|
|
680
|
-
export
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
);
|
|
688
|
-
}
|
|
52
|
+
export type ProductAttribute =
|
|
53
|
+
| (ColorAttribute & { type: "color" })
|
|
54
|
+
| (SingleSelectAttribute & { type: "single-select" })
|
|
55
|
+
| (MultiSelectAttribute & { type: "multi-select" })
|
|
56
|
+
| (TextAttribute & { type: "text" })
|
|
57
|
+
| (DateAttribute & { type: "date" })
|
|
58
|
+
| (NumberAttribute & { type: "number" })
|
|
59
|
+
| (BooleanAttribute & { type: "boolean" });
|
|
689
60
|
|
|
690
61
|
/** @internal */
|
|
691
62
|
export const ProductAttribute$inboundSchema: z.ZodType<
|
|
@@ -693,31 +64,31 @@ export const ProductAttribute$inboundSchema: z.ZodType<
|
|
|
693
64
|
z.ZodTypeDef,
|
|
694
65
|
unknown
|
|
695
66
|
> = z.union([
|
|
696
|
-
|
|
67
|
+
ColorAttribute$inboundSchema.and(
|
|
697
68
|
z.object({ type: z.literal("color") }).transform((v) => ({ type: v.type })),
|
|
698
69
|
),
|
|
699
|
-
|
|
70
|
+
SingleSelectAttribute$inboundSchema.and(
|
|
700
71
|
z.object({ type: z.literal("single-select") }).transform((v) => ({
|
|
701
72
|
type: v.type,
|
|
702
73
|
})),
|
|
703
74
|
),
|
|
704
|
-
|
|
75
|
+
MultiSelectAttribute$inboundSchema.and(
|
|
705
76
|
z.object({ type: z.literal("multi-select") }).transform((v) => ({
|
|
706
77
|
type: v.type,
|
|
707
78
|
})),
|
|
708
79
|
),
|
|
709
|
-
|
|
80
|
+
TextAttribute$inboundSchema.and(
|
|
710
81
|
z.object({ type: z.literal("text") }).transform((v) => ({ type: v.type })),
|
|
711
82
|
),
|
|
712
|
-
|
|
83
|
+
DateAttribute$inboundSchema.and(
|
|
713
84
|
z.object({ type: z.literal("date") }).transform((v) => ({ type: v.type })),
|
|
714
85
|
),
|
|
715
|
-
|
|
86
|
+
NumberAttribute$inboundSchema.and(
|
|
716
87
|
z.object({ type: z.literal("number") }).transform((v) => ({
|
|
717
88
|
type: v.type,
|
|
718
89
|
})),
|
|
719
90
|
),
|
|
720
|
-
|
|
91
|
+
BooleanAttribute$inboundSchema.and(
|
|
721
92
|
z.object({ type: z.literal("boolean") }).transform((v) => ({
|
|
722
93
|
type: v.type,
|
|
723
94
|
})),
|
|
@@ -740,31 +111,31 @@ export const ProductAttribute$outboundSchema: z.ZodType<
|
|
|
740
111
|
z.ZodTypeDef,
|
|
741
112
|
ProductAttribute
|
|
742
113
|
> = z.union([
|
|
743
|
-
|
|
114
|
+
ColorAttribute$outboundSchema.and(
|
|
744
115
|
z.object({ type: z.literal("color") }).transform((v) => ({ type: v.type })),
|
|
745
116
|
),
|
|
746
|
-
|
|
117
|
+
SingleSelectAttribute$outboundSchema.and(
|
|
747
118
|
z.object({ type: z.literal("single-select") }).transform((v) => ({
|
|
748
119
|
type: v.type,
|
|
749
120
|
})),
|
|
750
121
|
),
|
|
751
|
-
|
|
122
|
+
MultiSelectAttribute$outboundSchema.and(
|
|
752
123
|
z.object({ type: z.literal("multi-select") }).transform((v) => ({
|
|
753
124
|
type: v.type,
|
|
754
125
|
})),
|
|
755
126
|
),
|
|
756
|
-
|
|
127
|
+
TextAttribute$outboundSchema.and(
|
|
757
128
|
z.object({ type: z.literal("text") }).transform((v) => ({ type: v.type })),
|
|
758
129
|
),
|
|
759
|
-
|
|
130
|
+
DateAttribute$outboundSchema.and(
|
|
760
131
|
z.object({ type: z.literal("date") }).transform((v) => ({ type: v.type })),
|
|
761
132
|
),
|
|
762
|
-
|
|
133
|
+
NumberAttribute$outboundSchema.and(
|
|
763
134
|
z.object({ type: z.literal("number") }).transform((v) => ({
|
|
764
135
|
type: v.type,
|
|
765
136
|
})),
|
|
766
137
|
),
|
|
767
|
-
|
|
138
|
+
BooleanAttribute$outboundSchema.and(
|
|
768
139
|
z.object({ type: z.literal("boolean") }).transform((v) => ({
|
|
769
140
|
type: v.type,
|
|
770
141
|
})),
|