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