@coveo/thermidor-schema 1.0.0-beta.6 → 1.0.0-beta.7

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.
@@ -0,0 +1,3 @@
1
+ export declare const THERMIDOR_CATALOG_ID = "https://schema.thermidor.coveo.com/a2-ui/catalog.json";
2
+ export { ActionItemSchema, CartSchema, CartActionsSchema, CartStateSchema, UpdateCartSchema, UpdateCartPayloadSchema, CartUpdateOperationSchema, PurchaseSchema, PurchasePayloadSchema, PurchaseProductSchema, TransactionSchema, QuerySuggestionsSchema, QuerySuggestionsActionsSchema, QuerySuggestionsStateSchema, QueryCompletionSchema, FetchSuggestionsSchema, FetchSuggestionsPayloadSchema, RestoreStateSchema, RestoreStatePayloadSchema, FacetRestoreSchema, NumericRangeRestoreSchema, OverrideCorrectionSchema, OverrideCorrectionPayloadSchema, ShowMoreSchema, ShowMorePayloadSchema, SelectProductsSchema, SelectProductsPayloadSchema, ProductClickSchema, ProductClickPayloadSchema, BundleDisplaySchema, BundleDisplayStateSchema, BundleSlotSchema, BundleTierSchema, CategoryFacetSchema, CategoryFacetActionsSchema, CategoryFacetValueSchema, CategoryFacetSearchSchema, CategoryFacetSearchPayloadSchema, CategoryFacetSelectPathPayloadSchema, CategoryFacetStateSchema, CategoryFacetValuesSchema, CommerceSearchSchema, CommerceSearchActionsSchema, CommerceSearchStateSchema, SubmitQuerySchema, SubmitQueryPayloadSchema, ComparisonAttributeSchema, ComparisonProductSchema, ComparisonTableSchema, ComparisonTableStateSchema, ComponentContractsSchema, DateFacetSchema, DateFacetActionsSchema, DateFacetApplyCustomRangePayloadSchema, DateFacetCustomRangeSchema, DateFacetStateSchema, DateFacetToggleSelectPayloadSchema, DateFacetToggleSingleSelectPayloadSchema, DateFacetValueSchema, FacetManagerSchema, FacetManagerActionsSchema, FacetManagerStateSchema, FacetValueStateSchema, SelectableFacetValueStateSchema, LayoutStackSchema, LayoutStackStateSchema, NextActionsBarSchema, NextActionsStateSchema, NumericFacetSchema, NumericFacetActionsSchema, NumericFacetCustomRangeSchema, NumericFacetDomainSchema, NumericFacetApplyCustomRangePayloadSchema, NumericFacetStateSchema, NumericFacetToggleSelectPayloadSchema, NumericFacetToggleSingleSelectPayloadSchema, NumericFacetValueSchema, PageSizeSchema, PageSizeActionsSchema, PageSizeStateSchema, PaginationSchema, PaginationActionsSchema, PaginationStateSchema, ProductCarouselSchema, ProductCarouselStateSchema, ProductListSchema, ProductListActionsSchema, ProductListStateSchema, ProductSummarySchema, ProductSummaryActionsSchema, ProductSummaryStateSchema, QuerySummarySchema, QuerySummaryStateSchema, ProductSchema, RegularFacetSchema, RegularFacetActionsSchema, RegularFacetSearchSchema, RegularFacetSearchResultSchema, RegularFacetStateSchema, RegularFacetToggleExcludePayloadSchema, RegularFacetToggleSelectPayloadSchema, RegularFacetToggleSingleExcludePayloadSchema, RegularFacetToggleSingleSelectPayloadSchema, RegularFacetValueSchema, SelectActionPayloadSchema, SelectPagePayloadSchema, SelectSortPayloadSchema, SetPageSizePayloadSchema, SortSchema, SortActionsSchema, SortCriterionSchema, SortStateSchema, BundleDisplayPropsSchema, CategoryFacetPropsSchema, CommerceSearchPropsSchema, ComparisonTablePropsSchema, DateFacetPropsSchema, FacetManagerPropsSchema, LayoutStackPropsSchema, NextActionsBarPropsSchema, NumericFacetPropsSchema, PageSizePropsSchema, PaginationPropsSchema, ProductCarouselPropsSchema, ProductListPropsSchema, ProductSummaryPropsSchema, QuerySummaryPropsSchema, RegularFacetPropsSchema, SortPropsSchema, DataBindingSchema, FunctionCallSchema, DynamicNumberSchema, DynamicStringSchema, DynamicBooleanSchema, DynamicStringListSchema, DynamicValueSchema, DynamicActionSchema, BundleDisplayActionSchema, CategoryFacetActionSchema, CommerceSearchActionSchema, ComparisonTableActionSchema, DateFacetActionSchema, FacetManagerActionSchema, LayoutStackActionSchema, NextActionsBarActionSchema, NumericFacetActionSchema, PageSizeActionSchema, PaginationActionSchema, ProductCarouselActionSchema, ProductListActionSchema, ProductSummaryActionSchema, QuerySummaryActionSchema, RegularFacetActionSchema, SortActionSchema, } from '../generated/zod3/schemas.js';
3
+ export type { ActionItem, Cart, CartActions, CartState, UpdateCart, UpdateCartPayload, CartUpdateOperation, Purchase, PurchasePayload, PurchaseProduct, Transaction, QuerySuggestions, QuerySuggestionsActions, QuerySuggestionsState, QueryCompletion, FetchSuggestions, FetchSuggestionsPayload, RestoreState, RestoreStatePayload, FacetRestore, NumericRangeRestore, OverrideCorrection, OverrideCorrectionPayload, ShowMore, ShowMorePayload, SelectProducts, SelectProductsPayload, ProductClick, ProductClickPayload, BundleDisplay, BundleDisplayState, BundleSlot, BundleTier, CategoryFacet, CategoryFacetActions, CategoryFacetValue, CategoryFacetSearch, CategoryFacetSearchPayload, CategoryFacetSelectPathPayload, CategoryFacetState, CategoryFacetValues, CommerceSearch, CommerceSearchActions, CommerceSearchState, SubmitQuery, SubmitQueryPayload, ComparisonAttribute, ComparisonProduct, ComparisonTable, ComparisonTableState, ComponentContracts, DateFacet, DateFacetActions, DateFacetApplyCustomRangePayload, DateFacetCustomRange, DateFacetState, DateFacetToggleSelectPayload, DateFacetToggleSingleSelectPayload, DateFacetValue, FacetManager, FacetManagerActions, FacetManagerState, FacetValueState, SelectableFacetValueState, LayoutStack, LayoutStackState, NextActionsBar, NextActionsState, NumericFacet, NumericFacetActions, NumericFacetCustomRange, NumericFacetDomain, NumericFacetApplyCustomRangePayload, NumericFacetState, NumericFacetToggleSelectPayload, NumericFacetToggleSingleSelectPayload, NumericFacetValue, PageSize, PageSizeActions, PageSizeState, Pagination, PaginationActions, PaginationState, Product, ProductCarousel, ProductCarouselState, ProductList, ProductListActions, ProductListState, ProductSummary, ProductSummaryActions, ProductSummaryState, QuerySummary, QuerySummaryState, RegularFacet, RegularFacetActions, RegularFacetSearch, RegularFacetSearchResult, RegularFacetState, RegularFacetToggleExcludePayload, RegularFacetToggleSelectPayload, RegularFacetToggleSingleExcludePayload, RegularFacetToggleSingleSelectPayload, RegularFacetValue, SelectActionPayload, SelectPagePayload, SelectSortPayload, SetPageSizePayload, Sort, SortActions, SortCriterion, SortState, DataBinding, FunctionCall, DynamicNumber, DynamicString, DynamicBoolean, DynamicStringList, DynamicValue, DynamicAction, BundleDisplayAction, CategoryFacetAction, CommerceSearchAction, ComparisonTableAction, DateFacetAction, FacetManagerAction, LayoutStackAction, NextActionsBarAction, NumericFacetAction, PageSizeAction, PaginationAction, ProductCarouselAction, ProductListAction, ProductSummaryAction, QuerySummaryAction, RegularFacetAction, SortAction, BundleDisplayProps, CategoryFacetProps, CommerceSearchProps, ComparisonTableProps, DateFacetProps, FacetManagerProps, LayoutStackProps, NextActionsBarProps, NumericFacetProps, PageSizeProps, PaginationProps, ProductCarouselProps, ProductListProps, ProductSummaryProps, QuerySummaryProps, RegularFacetProps, SortProps, } from '../generated/zod3/schemas.js';
@@ -0,0 +1,5 @@
1
+ // This file is generated from src/index.ts; it mirrors the curated public surface
2
+ // of the default entry point against the Zod 3 schema build.
3
+ // Do not edit it directly; run `mise run generate` from the repository root.
4
+ export const THERMIDOR_CATALOG_ID = 'https://schema.thermidor.coveo.com/a2-ui/catalog.json';
5
+ export { ActionItemSchema, CartSchema, CartActionsSchema, CartStateSchema, UpdateCartSchema, UpdateCartPayloadSchema, CartUpdateOperationSchema, PurchaseSchema, PurchasePayloadSchema, PurchaseProductSchema, TransactionSchema, QuerySuggestionsSchema, QuerySuggestionsActionsSchema, QuerySuggestionsStateSchema, QueryCompletionSchema, FetchSuggestionsSchema, FetchSuggestionsPayloadSchema, RestoreStateSchema, RestoreStatePayloadSchema, FacetRestoreSchema, NumericRangeRestoreSchema, OverrideCorrectionSchema, OverrideCorrectionPayloadSchema, ShowMoreSchema, ShowMorePayloadSchema, SelectProductsSchema, SelectProductsPayloadSchema, ProductClickSchema, ProductClickPayloadSchema, BundleDisplaySchema, BundleDisplayStateSchema, BundleSlotSchema, BundleTierSchema, CategoryFacetSchema, CategoryFacetActionsSchema, CategoryFacetValueSchema, CategoryFacetSearchSchema, CategoryFacetSearchPayloadSchema, CategoryFacetSelectPathPayloadSchema, CategoryFacetStateSchema, CategoryFacetValuesSchema, CommerceSearchSchema, CommerceSearchActionsSchema, CommerceSearchStateSchema, SubmitQuerySchema, SubmitQueryPayloadSchema, ComparisonAttributeSchema, ComparisonProductSchema, ComparisonTableSchema, ComparisonTableStateSchema, ComponentContractsSchema, DateFacetSchema, DateFacetActionsSchema, DateFacetApplyCustomRangePayloadSchema, DateFacetCustomRangeSchema, DateFacetStateSchema, DateFacetToggleSelectPayloadSchema, DateFacetToggleSingleSelectPayloadSchema, DateFacetValueSchema, FacetManagerSchema, FacetManagerActionsSchema, FacetManagerStateSchema, FacetValueStateSchema, SelectableFacetValueStateSchema, LayoutStackSchema, LayoutStackStateSchema, NextActionsBarSchema, NextActionsStateSchema, NumericFacetSchema, NumericFacetActionsSchema, NumericFacetCustomRangeSchema, NumericFacetDomainSchema, NumericFacetApplyCustomRangePayloadSchema, NumericFacetStateSchema, NumericFacetToggleSelectPayloadSchema, NumericFacetToggleSingleSelectPayloadSchema, NumericFacetValueSchema, PageSizeSchema, PageSizeActionsSchema, PageSizeStateSchema, PaginationSchema, PaginationActionsSchema, PaginationStateSchema, ProductCarouselSchema, ProductCarouselStateSchema, ProductListSchema, ProductListActionsSchema, ProductListStateSchema, ProductSummarySchema, ProductSummaryActionsSchema, ProductSummaryStateSchema, QuerySummarySchema, QuerySummaryStateSchema, ProductSchema, RegularFacetSchema, RegularFacetActionsSchema, RegularFacetSearchSchema, RegularFacetSearchResultSchema, RegularFacetStateSchema, RegularFacetToggleExcludePayloadSchema, RegularFacetToggleSelectPayloadSchema, RegularFacetToggleSingleExcludePayloadSchema, RegularFacetToggleSingleSelectPayloadSchema, RegularFacetValueSchema, SelectActionPayloadSchema, SelectPagePayloadSchema, SelectSortPayloadSchema, SetPageSizePayloadSchema, SortSchema, SortActionsSchema, SortCriterionSchema, SortStateSchema, BundleDisplayPropsSchema, CategoryFacetPropsSchema, CommerceSearchPropsSchema, ComparisonTablePropsSchema, DateFacetPropsSchema, FacetManagerPropsSchema, LayoutStackPropsSchema, NextActionsBarPropsSchema, NumericFacetPropsSchema, PageSizePropsSchema, PaginationPropsSchema, ProductCarouselPropsSchema, ProductListPropsSchema, ProductSummaryPropsSchema, QuerySummaryPropsSchema, RegularFacetPropsSchema, SortPropsSchema, DataBindingSchema, FunctionCallSchema, DynamicNumberSchema, DynamicStringSchema, DynamicBooleanSchema, DynamicStringListSchema, DynamicValueSchema, DynamicActionSchema, BundleDisplayActionSchema, CategoryFacetActionSchema, CommerceSearchActionSchema, ComparisonTableActionSchema, DateFacetActionSchema, FacetManagerActionSchema, LayoutStackActionSchema, NextActionsBarActionSchema, NumericFacetActionSchema, PageSizeActionSchema, PaginationActionSchema, ProductCarouselActionSchema, ProductListActionSchema, ProductSummaryActionSchema, QuerySummaryActionSchema, RegularFacetActionSchema, SortActionSchema, } from '../generated/zod3/schemas.js';
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Zod 3 compatibility layer for the `./zod3` schema build.
3
+ *
4
+ * ## Why this exists
5
+ *
6
+ * The canonical generated schemas (`src/generated/schemas.ts`) are emitted in the
7
+ * Zod 4 dialect and import `zod/v4`. Some consumers are pinned to Zod 3 by a
8
+ * dependency they do not control — most notably the frozen A2-UI renderer, whose
9
+ * binder (`@a2ui/web_core`) resolves `{ path }` data bindings by reading **Zod 3**
10
+ * runtime internals. Handing such a consumer a Zod 4 schema means every field is
11
+ * misclassified and bindings leak to the renderer unresolved.
12
+ *
13
+ * Rather than ask those consumers to rebuild our schemas at runtime, the package
14
+ * ships a second, pre-built entry point (`@coveo/thermidor-schema/zod3`) whose
15
+ * schemas are real Zod 3 objects. That build reuses the SAME generated source and
16
+ * only swaps its Zod import for this module.
17
+ *
18
+ * ## How it works
19
+ *
20
+ * `import * as z from 'zod/v3'` already exposes every builder the generated source
21
+ * uses (`string`, `number`, `object`, `array`, `union`, `discriminatedUnion`,
22
+ * `literal`, `enum`, `record`, `unknown`, `null`, `never`, the `infer` type, and the
23
+ * `.min/.max/.int/.regex/.optional` refinements) with identical call signatures.
24
+ *
25
+ * Exactly three constructors in the generated output have no Zod 3 counterpart under
26
+ * the same name. They are defined here in terms of their Zod 3 equivalents:
27
+ *
28
+ * | Zod 4 (generated) | Zod 3 equivalent |
29
+ * | --------------------- | -------------------------------- |
30
+ * | `z.strictObject(s)` | `z.object(s).strict()` |
31
+ * | `z.looseObject(s)` | `z.object(s).passthrough()` |
32
+ * | `z.url()` | `z.string().url()` |
33
+ *
34
+ * `z.union` needs one further accommodation: Zod 4 accepts a single-member union,
35
+ * Zod 3 requires at least two. A one-member union is semantically the member
36
+ * itself, so the override below unwraps it — preserving the inferred type exactly
37
+ * (see the overloads).
38
+ *
39
+ * `z.record(key, value)` is emitted in its two-argument form, which Zod 3 accepts
40
+ * unchanged, so it needs no shim.
41
+ *
42
+ * Because this module is a superset of `zod/v3`, the generated source compiles and
43
+ * runs against it verbatim — the dialect difference is confined to these functions,
44
+ * and adding a component to the canonical JSON Schema requires no change here.
45
+ * (Explicit exports below take precedence over the `export *`, which is how
46
+ * `union` overrides the Zod 3 original.)
47
+ *
48
+ * ## Stability
49
+ *
50
+ * This is a build-time dialect adapter, not a runtime schema rewriter: the schemas
51
+ * it produces ARE Zod 3 schemas, constructed by Zod 3 itself. There is no
52
+ * reflection over Zod internals and nothing to keep in sync with a Zod release.
53
+ */
54
+ export * from 'zod/v3';
55
+ import * as z3 from 'zod/v3';
56
+ /**
57
+ * Zod 4's `z.strictObject(shape)` — an object schema that rejects unknown keys.
58
+ * Zod 3 spells the same thing `z.object(shape).strict()`.
59
+ */
60
+ export declare function strictObject<T extends z3.ZodRawShape>(shape: T): z3.ZodObject<T, "strict", z3.ZodTypeAny, z3.objectUtil.addQuestionMarks<z3.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z3.baseObjectInputType<T> extends infer T_2 ? { [k in keyof T_2]: T_2[k]; } : never>;
61
+ /**
62
+ * Zod 4's `z.looseObject(shape)` — an object schema that preserves unknown keys.
63
+ * Zod 3 spells the same thing `z.object(shape).passthrough()`.
64
+ */
65
+ export declare function looseObject<T extends z3.ZodRawShape>(shape: T): z3.ZodObject<T, "passthrough", z3.ZodTypeAny, z3.objectOutputType<T, z3.ZodTypeAny, "passthrough">, z3.objectInputType<T, z3.ZodTypeAny, "passthrough">>;
66
+ /**
67
+ * Zod 4's top-level `z.url()` string format. In Zod 3 the URL check is a
68
+ * refinement on the string schema: `z.string().url()`.
69
+ */
70
+ export declare function url(): z3.ZodString;
71
+ /**
72
+ * `z.union`, widened to accept the single-member unions Zod 4 permits (the
73
+ * generated action unions use one member for a component that declares exactly one
74
+ * action). Zod 3's `union` requires a two-element tuple, so a one-member union is
75
+ * unwrapped to the member itself — semantically identical, and the overload keeps
76
+ * `z.infer` precise instead of degrading to `any`.
77
+ */
78
+ export declare function union<T extends z3.ZodTypeAny>(options: readonly [T]): T;
79
+ export declare function union<T extends readonly [z3.ZodTypeAny, z3.ZodTypeAny, ...z3.ZodTypeAny[]]>(options: T): z3.ZodUnion<T>;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Zod 3 compatibility layer for the `./zod3` schema build.
3
+ *
4
+ * ## Why this exists
5
+ *
6
+ * The canonical generated schemas (`src/generated/schemas.ts`) are emitted in the
7
+ * Zod 4 dialect and import `zod/v4`. Some consumers are pinned to Zod 3 by a
8
+ * dependency they do not control — most notably the frozen A2-UI renderer, whose
9
+ * binder (`@a2ui/web_core`) resolves `{ path }` data bindings by reading **Zod 3**
10
+ * runtime internals. Handing such a consumer a Zod 4 schema means every field is
11
+ * misclassified and bindings leak to the renderer unresolved.
12
+ *
13
+ * Rather than ask those consumers to rebuild our schemas at runtime, the package
14
+ * ships a second, pre-built entry point (`@coveo/thermidor-schema/zod3`) whose
15
+ * schemas are real Zod 3 objects. That build reuses the SAME generated source and
16
+ * only swaps its Zod import for this module.
17
+ *
18
+ * ## How it works
19
+ *
20
+ * `import * as z from 'zod/v3'` already exposes every builder the generated source
21
+ * uses (`string`, `number`, `object`, `array`, `union`, `discriminatedUnion`,
22
+ * `literal`, `enum`, `record`, `unknown`, `null`, `never`, the `infer` type, and the
23
+ * `.min/.max/.int/.regex/.optional` refinements) with identical call signatures.
24
+ *
25
+ * Exactly three constructors in the generated output have no Zod 3 counterpart under
26
+ * the same name. They are defined here in terms of their Zod 3 equivalents:
27
+ *
28
+ * | Zod 4 (generated) | Zod 3 equivalent |
29
+ * | --------------------- | -------------------------------- |
30
+ * | `z.strictObject(s)` | `z.object(s).strict()` |
31
+ * | `z.looseObject(s)` | `z.object(s).passthrough()` |
32
+ * | `z.url()` | `z.string().url()` |
33
+ *
34
+ * `z.union` needs one further accommodation: Zod 4 accepts a single-member union,
35
+ * Zod 3 requires at least two. A one-member union is semantically the member
36
+ * itself, so the override below unwraps it — preserving the inferred type exactly
37
+ * (see the overloads).
38
+ *
39
+ * `z.record(key, value)` is emitted in its two-argument form, which Zod 3 accepts
40
+ * unchanged, so it needs no shim.
41
+ *
42
+ * Because this module is a superset of `zod/v3`, the generated source compiles and
43
+ * runs against it verbatim — the dialect difference is confined to these functions,
44
+ * and adding a component to the canonical JSON Schema requires no change here.
45
+ * (Explicit exports below take precedence over the `export *`, which is how
46
+ * `union` overrides the Zod 3 original.)
47
+ *
48
+ * ## Stability
49
+ *
50
+ * This is a build-time dialect adapter, not a runtime schema rewriter: the schemas
51
+ * it produces ARE Zod 3 schemas, constructed by Zod 3 itself. There is no
52
+ * reflection over Zod internals and nothing to keep in sync with a Zod release.
53
+ */
54
+ export * from 'zod/v3';
55
+ import * as z3 from 'zod/v3';
56
+ /**
57
+ * Zod 4's `z.strictObject(shape)` — an object schema that rejects unknown keys.
58
+ * Zod 3 spells the same thing `z.object(shape).strict()`.
59
+ */
60
+ export function strictObject(shape) {
61
+ return z3.object(shape).strict();
62
+ }
63
+ /**
64
+ * Zod 4's `z.looseObject(shape)` — an object schema that preserves unknown keys.
65
+ * Zod 3 spells the same thing `z.object(shape).passthrough()`.
66
+ */
67
+ export function looseObject(shape) {
68
+ return z3.object(shape).passthrough();
69
+ }
70
+ /**
71
+ * Zod 4's top-level `z.url()` string format. In Zod 3 the URL check is a
72
+ * refinement on the string schema: `z.string().url()`.
73
+ */
74
+ export function url() {
75
+ return z3.string().url();
76
+ }
77
+ export function union(options) {
78
+ if (options.length === 1) {
79
+ return options[0];
80
+ }
81
+ return z3.union(options);
82
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveo/thermidor-schema",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.7",
4
4
  "description": "Zod and TypeScript projections of the Thermidor JSON Schema contract.",
5
5
  "homepage": "https://github.com/coveo-platform/thermidor-schema#readme",
6
6
  "bugs": {
@@ -26,6 +26,10 @@
26
26
  "types": "./dist/index.d.ts",
27
27
  "import": "./dist/index.js"
28
28
  },
29
+ "./zod3": {
30
+ "types": "./dist/zod3/index.d.ts",
31
+ "import": "./dist/zod3/index.js"
32
+ },
29
33
  "./schema/*": "./schema/*"
30
34
  },
31
35
  "publishConfig": {
@@ -38,7 +42,7 @@
38
42
  "zod": "4.4.3"
39
43
  },
40
44
  "peerDependencies": {
41
- "zod": "^4.4.3"
45
+ "zod": "^3.25 || ^4.4.3"
42
46
  },
43
47
  "engines": {
44
48
  "node": ">=22.14.0"