@remotion/studio 4.0.424 → 4.0.426

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 (88) hide show
  1. package/dist/api/create-composition.d.ts +1 -2
  2. package/dist/api/helpers/calc-new-props.d.ts +1 -2
  3. package/dist/components/AssetSelector.js +1 -1
  4. package/dist/components/AssetSelectorItem.d.ts +1 -0
  5. package/dist/components/AssetSelectorItem.js +9 -8
  6. package/dist/components/InitialCompositionLoader.js +13 -1
  7. package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
  8. package/dist/components/NewComposition/CodemodFooter.js +3 -1
  9. package/dist/components/NewComposition/DeleteComposition.js +1 -1
  10. package/dist/components/NewComposition/DuplicateComposition.js +5 -1
  11. package/dist/components/NewComposition/RenameComposition.js +1 -1
  12. package/dist/components/RenderModal/DataEditor.d.ts +2 -1
  13. package/dist/components/RenderModal/DataEditor.js +6 -6
  14. package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
  15. package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +3 -2
  16. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +3 -3
  17. package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -5
  18. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +3 -3
  19. package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -0
  20. package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.d.ts +2 -2
  21. package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +4 -3
  22. package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +2 -2
  23. package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +3 -6
  24. package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +2 -1
  25. package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +2 -2
  26. package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -2
  27. package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -2
  28. package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -2
  29. package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +3 -3
  30. package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +2 -1
  31. package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +2 -2
  32. package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +18 -18
  33. package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +2 -2
  34. package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +6 -10
  35. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +2 -2
  36. package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -12
  37. package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +2 -2
  38. package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +2 -2
  39. package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +4 -3
  40. package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +2 -2
  41. package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +3 -2
  42. package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +2 -2
  43. package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -1
  44. package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -2
  45. package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +49 -21
  46. package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +2 -2
  47. package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +4 -9
  48. package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +2 -2
  49. package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -1
  50. package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +3 -3
  51. package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +2 -2
  52. package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +0 -10
  53. package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -2
  54. package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -2
  55. package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +38 -33
  56. package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +2 -2
  57. package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.d.ts +2 -2
  58. package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +3 -6
  59. package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.d.ts +2 -1
  60. package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.js +2 -2
  61. package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +2 -2
  62. package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.js +11 -15
  63. package/dist/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -2
  64. package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +108 -110
  65. package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -3
  66. package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +72 -87
  67. package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +3 -3
  68. package/dist/components/RenderModal/SchemaEditor/local-state.js +5 -4
  69. package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +176 -0
  70. package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +330 -0
  71. package/dist/components/Tabs/index.js +2 -0
  72. package/dist/components/Tabs/vertical.js +2 -0
  73. package/dist/components/TimeValue.js +0 -2
  74. package/dist/components/Timeline/TimelineDragHandler.js +6 -0
  75. package/dist/components/get-zod-if-possible.d.ts +3 -0
  76. package/dist/components/get-zod-if-possible.js +23 -2
  77. package/dist/esm/{chunk-3g77e2p9.js → chunk-kde77jse.js} +589 -373
  78. package/dist/esm/index.mjs +170 -81
  79. package/dist/esm/internals.mjs +589 -373
  80. package/dist/esm/previewEntry.mjs +598 -375
  81. package/dist/esm/renderEntry.mjs +1 -1
  82. package/dist/helpers/inject-css.js +2 -1
  83. package/dist/index.d.ts +2 -2
  84. package/dist/previewEntry.d.ts +5 -0
  85. package/dist/previewEntry.js +11 -2
  86. package/dist/visual-controls/VisualControls.d.ts +4 -4
  87. package/dist/visual-controls/VisualControls.js +1 -1
  88. package/package.json +11 -11
@@ -1,12 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractEnumJsonPaths = void 0;
4
+ const zod_schema_type_1 = require("./zod-schema-type");
4
5
  const extractEnumJsonPaths = ({ schema, zodRuntime, currentPath, zodTypes, }) => {
5
- const def = schema._def;
6
- const typeName = def.typeName;
6
+ // In v4, .refine()/.describe() don't wrap in effects — the description
7
+ // lives directly on the schema. Check for branded descriptions early
8
+ // so they are detected regardless of the underlying type.
9
+ const description = (0, zod_schema_type_1.getZodSchemaDescription)(schema);
10
+ if (zodTypes &&
11
+ description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
12
+ return [currentPath];
13
+ }
14
+ const typeName = (0, zod_schema_type_1.getZodSchemaType)(schema);
7
15
  switch (typeName) {
8
- case zodRuntime.ZodFirstPartyTypeKind.ZodObject: {
9
- const shape = def.shape();
16
+ case 'object': {
17
+ const shape = (0, zod_schema_type_1.getObjectShape)(schema);
10
18
  const keys = Object.keys(shape);
11
19
  return keys
12
20
  .map((key) => {
@@ -19,16 +27,16 @@ const extractEnumJsonPaths = ({ schema, zodRuntime, currentPath, zodTypes, }) =>
19
27
  })
20
28
  .flat(1);
21
29
  }
22
- case zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
30
+ case 'array': {
23
31
  return (0, exports.extractEnumJsonPaths)({
24
- schema: def.type,
32
+ schema: (0, zod_schema_type_1.getArrayElement)(schema),
25
33
  zodRuntime,
26
34
  currentPath: [...currentPath, '[]'],
27
35
  zodTypes,
28
36
  });
29
37
  }
30
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
31
- return def.options
38
+ case 'union': {
39
+ return (0, zod_schema_type_1.getUnionOptions)(schema)
32
40
  .map((option) => {
33
41
  return (0, exports.extractEnumJsonPaths)({
34
42
  schema: option,
@@ -39,8 +47,8 @@ const extractEnumJsonPaths = ({ schema, zodRuntime, currentPath, zodTypes, }) =>
39
47
  })
40
48
  .flat(1);
41
49
  }
42
- case zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
43
- return def.options
50
+ case 'discriminatedUnion': {
51
+ return (0, zod_schema_type_1.getUnionOptions)(schema)
44
52
  .map((op) => {
45
53
  return (0, exports.extractEnumJsonPaths)({
46
54
  schema: op,
@@ -51,24 +59,19 @@ const extractEnumJsonPaths = ({ schema, zodRuntime, currentPath, zodTypes, }) =>
51
59
  })
52
60
  .flat(1);
53
61
  }
54
- case zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
62
+ case 'literal': {
55
63
  return [currentPath];
56
64
  }
57
- case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
58
- if (zodTypes &&
59
- schema._def.description ===
60
- zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
61
- return [currentPath];
62
- }
65
+ case 'effects': {
63
66
  return (0, exports.extractEnumJsonPaths)({
64
- schema: def.schema,
67
+ schema: (0, zod_schema_type_1.getEffectsInner)(schema),
65
68
  zodRuntime,
66
69
  currentPath,
67
70
  zodTypes,
68
71
  });
69
72
  }
70
- case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
71
- const { left, right } = def;
73
+ case 'intersection': {
74
+ const { left, right } = (0, zod_schema_type_1.getIntersectionSchemas)(schema);
72
75
  const leftValue = (0, exports.extractEnumJsonPaths)({
73
76
  schema: left,
74
77
  zodRuntime,
@@ -83,8 +86,8 @@ const extractEnumJsonPaths = ({ schema, zodRuntime, currentPath, zodTypes, }) =>
83
86
  });
84
87
  return [...leftValue, ...rightValue];
85
88
  }
86
- case zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
87
- return def.items
89
+ case 'tuple': {
90
+ return (0, zod_schema_type_1.getTupleItems)(schema)
88
91
  .map((item, i) => (0, exports.extractEnumJsonPaths)({
89
92
  schema: item,
90
93
  zodRuntime,
@@ -93,104 +96,86 @@ const extractEnumJsonPaths = ({ schema, zodRuntime, currentPath, zodTypes, }) =>
93
96
  }))
94
97
  .flat(1);
95
98
  }
96
- case zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
97
- const values = (0, exports.extractEnumJsonPaths)({
98
- schema: def.valueType,
99
+ case 'record': {
100
+ const recordPath = [...currentPath, '{}'];
101
+ const keyResults = (0, exports.extractEnumJsonPaths)({
102
+ schema: (0, zod_schema_type_1.getRecordKeyType)(schema),
99
103
  zodRuntime,
100
- currentPath: [...currentPath, '{}'],
104
+ currentPath: recordPath,
101
105
  zodTypes,
102
106
  });
103
- return values;
107
+ const valueResults = (0, exports.extractEnumJsonPaths)({
108
+ schema: (0, zod_schema_type_1.getRecordValueType)(schema),
109
+ zodRuntime,
110
+ currentPath: recordPath,
111
+ zodTypes,
112
+ });
113
+ return [...keyResults, ...valueResults];
104
114
  }
105
- case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
115
+ case 'function': {
106
116
  throw new Error('Cannot create a value for type function');
107
117
  }
108
- case zodRuntime.ZodFirstPartyTypeKind.ZodEnum: {
118
+ case 'enum': {
109
119
  return [currentPath];
110
120
  }
111
- case zodRuntime.ZodFirstPartyTypeKind.ZodNativeEnum: {
121
+ case 'nativeEnum': {
112
122
  return [];
113
123
  }
114
- case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
115
- const defType = def;
116
- const value = (0, exports.extractEnumJsonPaths)({
117
- schema: defType.innerType,
118
- zodRuntime,
119
- currentPath,
120
- zodTypes,
121
- });
122
- return value;
123
- }
124
- case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
125
- const defType = def;
126
- const value = (0, exports.extractEnumJsonPaths)({
127
- schema: defType.innerType,
128
- zodRuntime,
129
- currentPath,
130
- zodTypes,
131
- });
132
- return value;
133
- }
134
- case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
135
- const defType = def;
124
+ case 'optional':
125
+ case 'nullable':
126
+ case 'catch': {
136
127
  return (0, exports.extractEnumJsonPaths)({
137
- schema: defType.innerType,
128
+ schema: (0, zod_schema_type_1.getInnerType)(schema),
138
129
  zodRuntime,
139
130
  currentPath,
140
131
  zodTypes,
141
132
  });
142
133
  }
143
- case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
144
- const defType = def;
134
+ case 'default': {
145
135
  return (0, exports.extractEnumJsonPaths)({
146
- schema: defType.innerType,
136
+ schema: (0, zod_schema_type_1.getInnerType)(schema),
147
137
  zodRuntime,
148
138
  currentPath,
149
139
  zodTypes,
150
140
  });
151
141
  }
152
- case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
142
+ case 'promise': {
153
143
  return [];
154
144
  }
155
- case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
156
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
157
- const defType = def;
158
- const value = (0, exports.extractEnumJsonPaths)({
159
- schema: defType.type,
145
+ case 'branded': {
146
+ return (0, exports.extractEnumJsonPaths)({
147
+ schema: (0, zod_schema_type_1.getBrandedInner)(schema),
160
148
  zodRuntime,
161
149
  currentPath,
162
150
  zodTypes,
163
151
  });
164
- return value;
165
152
  }
166
- case zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
167
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
168
- const defType = def;
169
- const value = (0, exports.extractEnumJsonPaths)({
170
- schema: defType.out,
153
+ case 'pipeline':
154
+ case 'pipe': {
155
+ return (0, exports.extractEnumJsonPaths)({
156
+ schema: (0, zod_schema_type_1.getPipelineOutput)(schema),
171
157
  zodRuntime,
172
158
  currentPath,
173
159
  zodTypes,
174
160
  });
175
- return value;
176
- }
177
- case zodRuntime.ZodFirstPartyTypeKind.ZodString:
178
- case zodRuntime.ZodFirstPartyTypeKind.ZodNumber:
179
- case zodRuntime.ZodFirstPartyTypeKind.ZodBigInt:
180
- case zodRuntime.ZodFirstPartyTypeKind.ZodBoolean:
181
- case zodRuntime.ZodFirstPartyTypeKind.ZodNaN:
182
- case zodRuntime.ZodFirstPartyTypeKind.ZodDate:
183
- case zodRuntime.ZodFirstPartyTypeKind.ZodSymbol:
184
- case zodRuntime.ZodFirstPartyTypeKind.ZodUndefined:
185
- case zodRuntime.ZodFirstPartyTypeKind.ZodNull:
186
- case zodRuntime.ZodFirstPartyTypeKind.ZodAny:
187
- case zodRuntime.ZodFirstPartyTypeKind.ZodUnknown:
188
- case zodRuntime.ZodFirstPartyTypeKind.ZodNever:
189
- case zodRuntime.ZodFirstPartyTypeKind.ZodVoid:
190
- case zodRuntime.ZodFirstPartyTypeKind.ZodMap: // Maps are not serializable
191
- case zodRuntime.ZodFirstPartyTypeKind.ZodLazy:
192
- case zodRuntime.ZodFirstPartyTypeKind.ZodSet: {
193
- // Sets are not serializable
161
+ }
162
+ case 'string':
163
+ case 'number':
164
+ case 'bigint':
165
+ case 'boolean':
166
+ case 'nan':
167
+ case 'date':
168
+ case 'symbol':
169
+ case 'undefined':
170
+ case 'null':
171
+ case 'any':
172
+ case 'unknown':
173
+ case 'never':
174
+ case 'void':
175
+ case 'map':
176
+ case 'lazy':
177
+ case 'set':
178
+ case 'custom': {
194
179
  return [];
195
180
  }
196
181
  default:
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import type { z } from 'zod';
3
2
  import type { UpdaterFunction } from './ZodSwitch';
3
+ import type { AnyZodSchema, ZodSafeParseResult } from './zod-schema-type';
4
4
  export type LocalState<T> = {
5
5
  value: T;
6
- zodValidation: z.SafeParseReturnType<unknown, unknown>;
6
+ zodValidation: ZodSafeParseResult;
7
7
  keyStabilityRevision: number;
8
8
  };
9
9
  export type RevisionContextType = {
@@ -12,7 +12,7 @@ export type RevisionContextType = {
12
12
  export declare const RevisionContext: React.Context<RevisionContextType>;
13
13
  export declare const useLocalState: <T>({ unsavedValue, schema, setValue, savedValue, }: {
14
14
  unsavedValue: T;
15
- schema: z.ZodTypeAny;
15
+ schema: AnyZodSchema;
16
16
  setValue: UpdaterFunction<T>;
17
17
  savedValue: T;
18
18
  }) => {
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const remotion_1 = require("remotion");
7
7
  const deep_equal_1 = require("./deep-equal");
8
+ const zod_schema_type_1 = require("./zod-schema-type");
8
9
  exports.RevisionContext = (0, react_1.createContext)({
9
10
  childResetRevision: 0,
10
11
  });
@@ -16,7 +17,7 @@ const useLocalState = ({ unsavedValue, schema, setValue, savedValue, }) => {
16
17
  [parentRevision]: {
17
18
  value: unsavedValue,
18
19
  keyStabilityRevision: 0,
19
- zodValidation: schema.safeParse(unsavedValue),
20
+ zodValidation: (0, zod_schema_type_1.zodSafeParse)(schema, unsavedValue),
20
21
  },
21
22
  };
22
23
  });
@@ -26,7 +27,7 @@ const useLocalState = ({ unsavedValue, schema, setValue, savedValue, }) => {
26
27
  return {
27
28
  value: unsavedValue,
28
29
  keyStabilityRevision: 0,
29
- zodValidation: schema.safeParse(unsavedValue),
30
+ zodValidation: (0, zod_schema_type_1.zodSafeParse)(schema, unsavedValue),
30
31
  };
31
32
  }
32
33
  return localValueOrNull[parentRevision];
@@ -45,7 +46,7 @@ const useLocalState = ({ unsavedValue, schema, setValue, savedValue, }) => {
45
46
  return (localUnsavedValue !== null && localUnsavedValue !== void 0 ? localUnsavedValue : {
46
47
  value: savedValue,
47
48
  keyStabilityRevision: 0,
48
- zodValidation: schema.safeParse(savedValue),
49
+ zodValidation: (0, zod_schema_type_1.zodSafeParse)(schema, savedValue),
49
50
  });
50
51
  }, [localUnsavedValue, savedValue, schema]);
51
52
  const stateRef = (0, react_1.useRef)(currentLocalValue);
@@ -59,7 +60,7 @@ const useLocalState = ({ unsavedValue, schema, setValue, savedValue, }) => {
59
60
  if (isSame) {
60
61
  return;
61
62
  }
62
- const safeParse = schema.safeParse(newValue);
63
+ const safeParse = (0, zod_schema_type_1.zodSafeParse)(schema, newValue);
63
64
  if (safeParse.success || forceApply) {
64
65
  setValue(updater, forceApply, increment);
65
66
  }
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Normalizes zod schema type detection across v3 and v4.
3
+ *
4
+ * v3 schemas have `_def.typeName` (e.g. "ZodString")
5
+ * v4 schemas have `_def.type` (e.g. "string") and `_zod` property
6
+ *
7
+ * This module provides a unified type name using v4-style lowercase strings,
8
+ * and accessor helpers that abstract v3/v4 `_def` property differences.
9
+ */
10
+ /**
11
+ * Structural type for any Zod schema (v3 or v4).
12
+ *
13
+ * v3 schemas have `_def` with `typeName` property.
14
+ * v4 classic schemas have `_def` with `type` property.
15
+ * v4 core schemas have `_zod.def` with `type` property.
16
+ * At runtime, all zod schemas have `_def` (classic layer adds it for v4).
17
+ */
18
+ export interface ZodValidationError {
19
+ format(): {
20
+ _errors: string[];
21
+ };
22
+ issues: readonly {
23
+ code: string;
24
+ message: string;
25
+ path: readonly PropertyKey[];
26
+ }[];
27
+ }
28
+ export type ZodSafeParseResult = {
29
+ success: true;
30
+ data: unknown;
31
+ } | {
32
+ success: false;
33
+ error: ZodValidationError;
34
+ };
35
+ export interface AnyZodSchema {
36
+ readonly _def?: Record<string, any>;
37
+ readonly _zod?: {
38
+ def: Record<string, any>;
39
+ [key: string]: any;
40
+ };
41
+ readonly description?: string;
42
+ }
43
+ /**
44
+ * Call safeParse on any Zod schema (v3 or v4).
45
+ * All Zod schemas have safeParse at runtime, but some v4 internal types
46
+ * (like $ZodObject) don't declare it in their type definition.
47
+ */
48
+ export declare const zodSafeParse: (schema: AnyZodSchema, data: unknown) => ZodSafeParseResult;
49
+ export declare const getZodDef: (schema: AnyZodSchema) => Record<string, any>;
50
+ export type ZodSchemaType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'enum' | 'union' | 'discriminatedUnion' | 'optional' | 'nullable' | 'default' | 'tuple' | 'date' | 'any' | 'unknown' | 'bigint' | 'null' | 'undefined' | 'effects' | 'literal' | 'record' | 'never' | (string & {});
51
+ export declare const isZodV3Schema: (schema: AnyZodSchema) => boolean;
52
+ /**
53
+ * Get the normalized type name for a zod schema (v3 or v4).
54
+ *
55
+ * In v4, discriminatedUnion is a union with a `discriminator` property on `_def`.
56
+ * This function returns 'discriminatedUnion' for that case.
57
+ */
58
+ export declare const getZodSchemaType: (schema: AnyZodSchema) => ZodSchemaType;
59
+ /**
60
+ * Get the description of a schema, handling v3 vs v4 differences.
61
+ *
62
+ * v3: _def.description
63
+ * v4: schema.description
64
+ */
65
+ export declare const getZodSchemaDescription: (schema: AnyZodSchema) => string | undefined;
66
+ /**
67
+ * Get the shape of an object schema.
68
+ * v3: _def.shape() (function)
69
+ * v4: _def.shape (plain object)
70
+ */
71
+ export declare const getObjectShape: (schema: AnyZodSchema) => Record<string, AnyZodSchema>;
72
+ /**
73
+ * Get the element schema of an array.
74
+ * v3: _def.type
75
+ * v4: _def.element
76
+ */
77
+ export declare const getArrayElement: (schema: AnyZodSchema) => AnyZodSchema;
78
+ /**
79
+ * Get the inner type for wrappers like optional, nullable, default, catch.
80
+ * Both v3 and v4 use _def.innerType.
81
+ */
82
+ export declare const getInnerType: (schema: AnyZodSchema) => AnyZodSchema;
83
+ /**
84
+ * Get the inner schema for effects (v3 only - v4 doesn't wrap).
85
+ * v3: _def.schema
86
+ */
87
+ export declare const getEffectsInner: (schema: AnyZodSchema) => AnyZodSchema;
88
+ /**
89
+ * Get the literal value.
90
+ * v3: _def.value (single value)
91
+ * v4: _def.values (array of values) - take the first
92
+ */
93
+ export declare const getLiteralValue: (schema: AnyZodSchema) => unknown;
94
+ /**
95
+ * Get enum values as an array of strings.
96
+ * v3: _def.values (string[])
97
+ * v4: _def.entries (Record<string,string>) - convert to values array
98
+ */
99
+ export declare const getEnumValues: (schema: AnyZodSchema) => string[];
100
+ /**
101
+ * Get the first valid value from an enum schema.
102
+ * Handles both regular enums and nativeEnums.
103
+ *
104
+ * In v4, nativeEnums are represented as regular enums with bidirectional
105
+ * entries (e.g. { Apple: 0, "0": "Apple" }). This function filters out
106
+ * the reverse mappings to return actual enum values.
107
+ */
108
+ export declare const getFirstEnumValue: (schema: AnyZodSchema) => unknown;
109
+ /**
110
+ * Get the union/discriminatedUnion options array.
111
+ * Both v3 and v4 use _def.options.
112
+ */
113
+ export declare const getUnionOptions: (schema: AnyZodSchema) => AnyZodSchema[];
114
+ /**
115
+ * Get the default value from a ZodDefault.
116
+ * v3: _def.defaultValue() (function)
117
+ * v4: _def.defaultValue (plain value)
118
+ */
119
+ export declare const getDefaultValue: (schema: AnyZodSchema) => unknown;
120
+ /**
121
+ * Get the discriminator key from a discriminated union.
122
+ * v3: _def.discriminator
123
+ * v4: _def.discriminator
124
+ */
125
+ export declare const getDiscriminator: (schema: AnyZodSchema) => string;
126
+ /**
127
+ * Get all discriminator option keys from a discriminated union.
128
+ * v3: [..._def.optionsMap.keys()]
129
+ * v4: iterate options and extract literal values from discriminator field
130
+ */
131
+ export declare const getDiscriminatedOptionKeys: (schema: AnyZodSchema) => string[];
132
+ /**
133
+ * Get the option schema matching a discriminator value.
134
+ * v3: _def.optionsMap.get(value)
135
+ * v4: find matching option by inspecting literal values
136
+ */
137
+ export declare const getDiscriminatedOption: (schema: AnyZodSchema, discriminatorValue: string) => AnyZodSchema | undefined;
138
+ /**
139
+ * Get the left and right schemas from an intersection.
140
+ * Both v3 and v4 use _def.left and _def.right.
141
+ */
142
+ export declare const getIntersectionSchemas: (schema: AnyZodSchema) => {
143
+ left: AnyZodSchema;
144
+ right: AnyZodSchema;
145
+ };
146
+ /**
147
+ * Get the items array from a tuple schema.
148
+ * Both v3 and v4 use _def.items.
149
+ */
150
+ export declare const getTupleItems: (schema: AnyZodSchema) => AnyZodSchema[];
151
+ /**
152
+ * Get the value type schema from a record.
153
+ * Both v3 and v4 use _def.valueType.
154
+ */
155
+ export declare const getRecordValueType: (schema: AnyZodSchema) => AnyZodSchema;
156
+ /**
157
+ * Get the key type schema from a record.
158
+ * Both v3 and v4 use _def.keyType.
159
+ */
160
+ export declare const getRecordKeyType: (schema: AnyZodSchema) => AnyZodSchema;
161
+ /**
162
+ * Get the output schema from a pipeline/pipe.
163
+ * Both v3 and v4 use _def.out.
164
+ */
165
+ export declare const getPipelineOutput: (schema: AnyZodSchema) => AnyZodSchema;
166
+ /**
167
+ * Get the input schema from a pipeline/pipe.
168
+ * Both v3 and v4 use _def.in.
169
+ */
170
+ export declare const getPipelineInput: (schema: AnyZodSchema) => AnyZodSchema;
171
+ /**
172
+ * Get the inner schema from a branded type.
173
+ * v3: _def.type
174
+ * v4: branded is the schema itself (branding is type-level only)
175
+ */
176
+ export declare const getBrandedInner: (schema: AnyZodSchema) => AnyZodSchema;