@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.
- package/dist/api/create-composition.d.ts +1 -2
- package/dist/api/helpers/calc-new-props.d.ts +1 -2
- package/dist/components/AssetSelector.js +1 -1
- package/dist/components/AssetSelectorItem.d.ts +1 -0
- package/dist/components/AssetSelectorItem.js +9 -8
- package/dist/components/InitialCompositionLoader.js +13 -1
- package/dist/components/NewComposition/CodemodFooter.d.ts +1 -0
- package/dist/components/NewComposition/CodemodFooter.js +3 -1
- package/dist/components/NewComposition/DeleteComposition.js +1 -1
- package/dist/components/NewComposition/DuplicateComposition.js +5 -1
- package/dist/components/NewComposition/RenameComposition.js +1 -1
- package/dist/components/RenderModal/DataEditor.d.ts +2 -1
- package/dist/components/RenderModal/DataEditor.js +6 -6
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.d.ts +2 -2
- package/dist/components/RenderModal/RenderModalJSONPropsEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaEditor.js +4 -5
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/SchemaErrorMessages.js +1 -0
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/SchemaSeparationLine.js +4 -3
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodArrayEditor.js +3 -6
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodArrayItemEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodBooleanEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodColorEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDateEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodDefaultEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodDiscriminatedUnionEditor.js +18 -18
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodEffectEditor.js +6 -10
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodEnumEditor.js +4 -12
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodErrorMessages.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodFieldValidation.js +4 -3
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodMatrixEditor.js +3 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNullableEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodNumberEditor.js +49 -21
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodObjectEditor.js +4 -9
- package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodOptionalEditor.js +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodOrNullishEditor.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodStaticFileEditor.js +0 -10
- package/dist/components/RenderModal/SchemaEditor/ZodStringEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodSwitch.js +38 -33
- package/dist/components/RenderModal/SchemaEditor/ZodTextareaEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodTupleEditor.js +3 -6
- package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.d.ts +2 -1
- package/dist/components/RenderModal/SchemaEditor/ZodTupleItemEditor.js +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/ZodUnionEditor.js +11 -15
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.d.ts +2 -2
- package/dist/components/RenderModal/SchemaEditor/create-zod-values.js +108 -110
- package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/extract-enum-json-paths.js +72 -87
- package/dist/components/RenderModal/SchemaEditor/local-state.d.ts +3 -3
- package/dist/components/RenderModal/SchemaEditor/local-state.js +5 -4
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.d.ts +176 -0
- package/dist/components/RenderModal/SchemaEditor/zod-schema-type.js +330 -0
- package/dist/components/Tabs/index.js +2 -0
- package/dist/components/Tabs/vertical.js +2 -0
- package/dist/components/TimeValue.js +0 -2
- package/dist/components/Timeline/TimelineDragHandler.js +6 -0
- package/dist/components/get-zod-if-possible.d.ts +3 -0
- package/dist/components/get-zod-if-possible.js +23 -2
- package/dist/esm/{chunk-3g77e2p9.js → chunk-kde77jse.js} +589 -373
- package/dist/esm/index.mjs +170 -81
- package/dist/esm/internals.mjs +589 -373
- package/dist/esm/previewEntry.mjs +598 -375
- package/dist/esm/renderEntry.mjs +1 -1
- package/dist/helpers/inject-css.js +2 -1
- package/dist/index.d.ts +2 -2
- package/dist/previewEntry.d.ts +5 -0
- package/dist/previewEntry.js +11 -2
- package/dist/visual-controls/VisualControls.d.ts +4 -4
- package/dist/visual-controls/VisualControls.js +1 -1
- package/package.json +11 -11
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ZodSwitch = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
6
|
+
const zod_schema_type_1 = require("./zod-schema-type");
|
|
6
7
|
const ZodArrayEditor_1 = require("./ZodArrayEditor");
|
|
7
8
|
const ZodBooleanEditor_1 = require("./ZodBooleanEditor");
|
|
8
9
|
const ZodColorEditor_1 = require("./ZodColorEditor");
|
|
@@ -23,87 +24,91 @@ const ZodTextareaEditor_1 = require("./ZodTextareaEditor");
|
|
|
23
24
|
const ZodTupleEditor_1 = require("./ZodTupleEditor");
|
|
24
25
|
const ZodUnionEditor_1 = require("./ZodUnionEditor");
|
|
25
26
|
const ZodSwitch = ({ schema, jsonPath, value, setValue, defaultValue, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const typeName = def.typeName;
|
|
29
|
-
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
30
|
-
if (!z) {
|
|
31
|
-
throw new Error('expected zod');
|
|
32
|
-
}
|
|
27
|
+
const typeName = (0, zod_schema_type_1.getZodSchemaType)(schema);
|
|
28
|
+
const description = (0, zod_schema_type_1.getZodSchemaDescription)(schema);
|
|
33
29
|
const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
|
|
34
|
-
if (typeName ===
|
|
30
|
+
if (typeName === 'object') {
|
|
35
31
|
return (jsx_runtime_1.jsx(ZodObjectEditor_1.ZodObjectEditor, { setValue: setValue, unsavedValue: value, savedValue: defaultValue, jsonPath: jsonPath, schema: schema, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad, discriminatedUnionReplacement: null }));
|
|
36
32
|
}
|
|
37
|
-
if (typeName ===
|
|
33
|
+
if (typeName === 'string') {
|
|
34
|
+
// In v4, .refine() doesn't wrap in ZodEffects, so check brand here too
|
|
35
|
+
if (zodTypes &&
|
|
36
|
+
description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
|
|
37
|
+
return (jsx_runtime_1.jsx(ZodColorEditor_1.ZodColorEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
38
|
+
}
|
|
38
39
|
if (value.startsWith(window.remotion_staticBase)) {
|
|
39
40
|
return (jsx_runtime_1.jsx(ZodStaticFileEditor_1.ZodStaticFileEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
40
41
|
}
|
|
41
42
|
if (zodTypes &&
|
|
42
|
-
|
|
43
|
-
zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
|
|
43
|
+
description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
|
|
44
44
|
return (jsx_runtime_1.jsx(ZodTextareaEditor_1.ZodTextareaEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
45
45
|
}
|
|
46
46
|
return (jsx_runtime_1.jsx(ZodStringEditor_1.ZodStringEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
47
47
|
}
|
|
48
|
-
if (typeName ===
|
|
48
|
+
if (typeName === 'date') {
|
|
49
49
|
return (jsx_runtime_1.jsx(ZodDateEditor_1.ZodDateEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
50
50
|
}
|
|
51
|
-
if (typeName ===
|
|
51
|
+
if (typeName === 'number') {
|
|
52
52
|
return (jsx_runtime_1.jsx(ZodNumberEditor_1.ZodNumberEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
53
53
|
}
|
|
54
|
-
if (typeName ===
|
|
54
|
+
if (typeName === 'boolean') {
|
|
55
55
|
return (jsx_runtime_1.jsx(ZodBooleanEditor_1.ZodBooleanEditor, { value: value, setValue: setValue, jsonPath: jsonPath, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad, schema: schema }));
|
|
56
56
|
}
|
|
57
|
-
if (typeName ===
|
|
57
|
+
if (typeName === 'undefined') {
|
|
58
58
|
return (jsx_runtime_1.jsx(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'undefined', saving: saving, mayPad: mayPad }));
|
|
59
59
|
}
|
|
60
|
-
if (typeName ===
|
|
60
|
+
if (typeName === 'null') {
|
|
61
61
|
return (jsx_runtime_1.jsx(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'null', saving: saving, mayPad: mayPad }));
|
|
62
62
|
}
|
|
63
|
-
if (typeName ===
|
|
63
|
+
if (typeName === 'any') {
|
|
64
64
|
return (jsx_runtime_1.jsx(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'any (not editable)', saving: saving, mayPad: mayPad }));
|
|
65
65
|
}
|
|
66
|
-
if (typeName ===
|
|
66
|
+
if (typeName === 'bigint') {
|
|
67
67
|
return (jsx_runtime_1.jsx(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'BigInt (not editable)', saving: saving, mayPad: mayPad }));
|
|
68
68
|
}
|
|
69
|
-
if (typeName ===
|
|
69
|
+
if (typeName === 'unknown') {
|
|
70
70
|
return (jsx_runtime_1.jsx(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, showSaveButton: showSaveButton, label: 'unknown (not editable)', saving: saving, mayPad: mayPad }));
|
|
71
71
|
}
|
|
72
|
-
if (typeName ===
|
|
72
|
+
if (typeName === 'array') {
|
|
73
|
+
// In v4, .refine() doesn't wrap in ZodEffects, so check brand here too
|
|
74
|
+
if (zodTypes &&
|
|
75
|
+
description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
76
|
+
return (jsx_runtime_1.jsx(ZodMatrixEditor_1.ZodMatrixEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
77
|
+
}
|
|
73
78
|
return (jsx_runtime_1.jsx(ZodArrayEditor_1.ZodArrayEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
74
79
|
}
|
|
75
|
-
if (typeName ===
|
|
80
|
+
if (typeName === 'enum') {
|
|
76
81
|
return (jsx_runtime_1.jsx(ZodEnumEditor_1.ZodEnumEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving }));
|
|
77
82
|
}
|
|
78
|
-
|
|
83
|
+
// In v3, effects wrap schemas (e.g. .refine(), .transform()).
|
|
84
|
+
// In v4, refine/transform are embedded as checks, so this only applies to v3.
|
|
85
|
+
if (typeName === 'effects') {
|
|
79
86
|
if (zodTypes &&
|
|
80
|
-
|
|
81
|
-
zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
|
|
87
|
+
description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
|
|
82
88
|
return (jsx_runtime_1.jsx(ZodColorEditor_1.ZodColorEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, onSave: onSave, defaultValue: defaultValue, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
83
89
|
}
|
|
84
90
|
if (zodTypes &&
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return (jsx_runtime_1.jsx(ZodMatrixEditor_1.ZodMatrixEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema._def.schema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
91
|
+
description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
92
|
+
return (jsx_runtime_1.jsx(ZodMatrixEditor_1.ZodMatrixEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: (0, zod_schema_type_1.getEffectsInner)(schema), defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
88
93
|
}
|
|
89
94
|
return (jsx_runtime_1.jsx(ZodEffectEditor_1.ZodEffectEditor, { value: value, setValue: setValue, jsonPath: jsonPath, schema: schema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, mayPad: mayPad }));
|
|
90
95
|
}
|
|
91
|
-
if (typeName ===
|
|
96
|
+
if (typeName === 'union') {
|
|
92
97
|
return (jsx_runtime_1.jsx(ZodUnionEditor_1.ZodUnionEditor, { schema: schema, showSaveButton: showSaveButton, jsonPath: jsonPath, value: value, defaultValue: defaultValue, setValue: setValue, onSave: onSave, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
93
98
|
}
|
|
94
|
-
if (typeName ===
|
|
99
|
+
if (typeName === 'optional') {
|
|
95
100
|
return (jsx_runtime_1.jsx(ZodOptionalEditor_1.ZodOptionalEditor, { jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
96
101
|
}
|
|
97
|
-
if (typeName ===
|
|
102
|
+
if (typeName === 'nullable') {
|
|
98
103
|
return (jsx_runtime_1.jsx(ZodNullableEditor_1.ZodNullableEditor, { jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
99
104
|
}
|
|
100
|
-
if (typeName ===
|
|
105
|
+
if (typeName === 'default') {
|
|
101
106
|
return (jsx_runtime_1.jsx(ZodDefaultEditor_1.ZodDefaultEditor, { jsonPath: jsonPath, showSaveButton: showSaveButton, defaultValue: defaultValue, value: value, setValue: setValue, onSave: onSave, onRemove: onRemove, schema: schema, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
102
107
|
}
|
|
103
|
-
if (typeName ===
|
|
108
|
+
if (typeName === 'discriminatedUnion') {
|
|
104
109
|
return (jsx_runtime_1.jsx(ZodDiscriminatedUnionEditor_1.ZodDiscriminatedUnionEditor, { defaultValue: defaultValue, mayPad: mayPad, schema: schema, setValue: setValue, value: value, jsonPath: jsonPath, onRemove: onRemove, onSave: onSave, saving: saving, saveDisabledByParent: saveDisabledByParent, showSaveButton: showSaveButton }));
|
|
105
110
|
}
|
|
106
|
-
if (typeName ===
|
|
111
|
+
if (typeName === 'tuple') {
|
|
107
112
|
return (jsx_runtime_1.jsx(ZodTupleEditor_1.ZodTupleEditor, { setValue: setValue, value: value, jsonPath: jsonPath, schema: schema, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: onRemove, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }));
|
|
108
113
|
}
|
|
109
114
|
return (jsx_runtime_1.jsx(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, showSaveButton: showSaveButton, label: `${typeName} (not editable)`, saving: saving, mayPad: mayPad }));
|
|
@@ -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 } from './zod-schema-type';
|
|
4
4
|
import type { JSONPath } from './zod-types';
|
|
5
5
|
export declare const ZodTextareaEditor: React.FC<{
|
|
6
|
-
readonly schema:
|
|
6
|
+
readonly schema: AnyZodSchema;
|
|
7
7
|
readonly jsonPath: JSONPath;
|
|
8
8
|
readonly value: string;
|
|
9
9
|
readonly defaultValue: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
3
3
|
import type { JSONPath } from './zod-types';
|
|
4
4
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
5
5
|
export declare const ZodTupleEditor: React.FC<{
|
|
6
|
-
readonly schema:
|
|
6
|
+
readonly schema: AnyZodSchema;
|
|
7
7
|
readonly jsonPath: JSONPath;
|
|
8
8
|
readonly value: unknown[];
|
|
9
9
|
readonly defaultValue: unknown[];
|
|
@@ -44,6 +44,7 @@ const local_state_1 = require("./local-state");
|
|
|
44
44
|
const SchemaLabel_1 = require("./SchemaLabel");
|
|
45
45
|
const SchemaSeparationLine_1 = require("./SchemaSeparationLine");
|
|
46
46
|
const SchemaVerticalGuide_1 = require("./SchemaVerticalGuide");
|
|
47
|
+
const zod_schema_type_1 = require("./zod-schema-type");
|
|
47
48
|
const ZodFieldValidation_1 = require("./ZodFieldValidation");
|
|
48
49
|
const ZodTupleItemEditor_1 = require("./ZodTupleItemEditor");
|
|
49
50
|
const ZodTupleEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSave, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
@@ -54,7 +55,7 @@ const ZodTupleEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSav
|
|
|
54
55
|
savedValue: defaultValue,
|
|
55
56
|
});
|
|
56
57
|
const [expanded, setExpanded] = (0, react_1.useState)(true);
|
|
57
|
-
const
|
|
58
|
+
const tupleItems = (0, zod_schema_type_1.getTupleItems)(schema);
|
|
58
59
|
const suffix = (0, react_1.useMemo)(() => {
|
|
59
60
|
return expanded ? ' [' : ' [...] ';
|
|
60
61
|
}, [expanded]);
|
|
@@ -63,10 +64,6 @@ const ZodTupleEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSav
|
|
|
63
64
|
throw new Error('expected zod');
|
|
64
65
|
}
|
|
65
66
|
const zodTypes = (0, get_zod_if_possible_1.useZodTypesIfPossible)();
|
|
66
|
-
const typeName = def.typeName;
|
|
67
|
-
if (typeName !== z.ZodFirstPartyTypeKind.ZodTuple) {
|
|
68
|
-
throw new Error('expected object');
|
|
69
|
-
}
|
|
70
67
|
const isDefaultValue = (0, react_1.useMemo)(() => {
|
|
71
68
|
return (0, deep_equal_1.deepEqual)(localValue.value, defaultValue);
|
|
72
69
|
}, [defaultValue, localValue]);
|
|
@@ -81,7 +78,7 @@ const ZodTupleEditor = ({ schema, jsonPath, setValue, defaultValue, value, onSav
|
|
|
81
78
|
return (
|
|
82
79
|
// eslint-disable-next-line react/no-array-index-key
|
|
83
80
|
jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [
|
|
84
|
-
jsx_runtime_1.jsx(ZodTupleItemEditor_1.ZodTupleItemEditor, { onChange: onChange, value: child,
|
|
81
|
+
jsx_runtime_1.jsx(ZodTupleItemEditor_1.ZodTupleItemEditor, { onChange: onChange, value: child, tupleItems: tupleItems, index: i, jsonPath: jsonPath, defaultValue: (_a = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue[i]) !== null && _a !== void 0 ? _a : (0, create_zod_values_1.createZodValues)(tupleItems[i], z, zodTypes), onSave: onSave, showSaveButton: showSaveButton, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }), jsx_runtime_1.jsx(SchemaSeparationLine_1.SchemaArrayItemSeparationLine, { schema: schema, index: i, onChange: onChange, isLast: i === localValue.value.length - 1, showAddButton: false })
|
|
85
82
|
] }, `${i}${localValue.keyStabilityRevision}`));
|
|
86
83
|
}), value.length === 0 ? (jsx_runtime_1.jsx(SchemaSeparationLine_1.SchemaArrayItemSeparationLine, { schema: schema, index: 0, onChange: onChange, isLast: true, showAddButton: false })) : null] }) })) : null, jsx_runtime_1.jsx(ZodFieldValidation_1.ZodFieldValidation, { path: jsonPath, localValue: localValue })
|
|
87
84
|
] }));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
2
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
2
3
|
import type { JSONPath } from './zod-types';
|
|
3
4
|
export declare const ZodTupleItemEditor: React.FC<{
|
|
4
5
|
jsonPath: JSONPath;
|
|
5
6
|
onChange: UpdaterFunction<unknown[]>;
|
|
6
|
-
|
|
7
|
+
tupleItems: AnyZodSchema[];
|
|
7
8
|
index: number;
|
|
8
9
|
value: unknown;
|
|
9
10
|
defaultValue: unknown;
|
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
7
7
|
const ZodSwitch_1 = require("./ZodSwitch");
|
|
8
|
-
const ZodTupleItemEditor = ({
|
|
8
|
+
const ZodTupleItemEditor = ({ tupleItems, onChange, jsonPath, index, value, defaultValue, onSave: onSaveObject, showSaveButton, saving, saveDisabledByParent, mayPad, }) => {
|
|
9
9
|
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
10
10
|
if (!z) {
|
|
11
11
|
throw new Error('expected zod');
|
|
@@ -25,6 +25,6 @@ const ZodTupleItemEditor = ({ def, onChange, jsonPath, index, value, defaultValu
|
|
|
25
25
|
...oldV.slice(index + 1),
|
|
26
26
|
], false, false);
|
|
27
27
|
}, [index, onSaveObject]);
|
|
28
|
-
return (jsx_runtime_1.jsx("div", { children: jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { jsonPath: newJsonPath, schema:
|
|
28
|
+
return (jsx_runtime_1.jsx("div", { children: jsx_runtime_1.jsx(ZodSwitch_1.ZodSwitch, { jsonPath: newJsonPath, schema: tupleItems[index], value: value, setValue: setValue, defaultValue: defaultValue, onSave: onSave, showSaveButton: showSaveButton, onRemove: null, saving: saving, saveDisabledByParent: saveDisabledByParent, mayPad: mayPad }) }));
|
|
29
29
|
};
|
|
30
30
|
exports.ZodTupleItemEditor = ZodTupleItemEditor;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
1
|
import type { UpdaterFunction } from './ZodSwitch';
|
|
2
|
+
import type { AnyZodSchema } from './zod-schema-type';
|
|
3
3
|
import type { JSONPath } from './zod-types';
|
|
4
4
|
export declare const ZodUnionEditor: React.FC<{
|
|
5
5
|
showSaveButton: boolean;
|
|
6
6
|
jsonPath: JSONPath;
|
|
7
7
|
value: unknown;
|
|
8
8
|
defaultValue: unknown;
|
|
9
|
-
schema:
|
|
9
|
+
schema: AnyZodSchema;
|
|
10
10
|
setValue: UpdaterFunction<unknown>;
|
|
11
11
|
onSave: UpdaterFunction<unknown>;
|
|
12
12
|
onRemove: null | (() => void);
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ZodUnionEditor = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const get_zod_if_possible_1 = require("../../get-zod-if-possible");
|
|
6
5
|
const ZodNonEditableValue_1 = require("./ZodNonEditableValue");
|
|
7
6
|
const ZodOrNullishEditor_1 = require("./ZodOrNullishEditor");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const zod_schema_type_1 = require("./zod-schema-type");
|
|
8
|
+
const findNull = (value) => {
|
|
9
|
+
const nullIndex = value.findIndex((v) => {
|
|
10
|
+
const type = (0, zod_schema_type_1.getZodSchemaType)(v);
|
|
11
|
+
return type === 'null' || type === 'undefined';
|
|
12
|
+
});
|
|
11
13
|
if (nullIndex === -1) {
|
|
12
14
|
return null;
|
|
13
15
|
}
|
|
14
|
-
const nullishValue = value[nullIndex]
|
|
15
|
-
? null
|
|
16
|
-
: undefined;
|
|
16
|
+
const nullishValue = (0, zod_schema_type_1.getZodSchemaType)(value[nullIndex]) === 'null' ? null : undefined;
|
|
17
17
|
const otherSchema = value[nullIndex === 0 ? 1 : 0];
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const otherType = (0, zod_schema_type_1.getZodSchemaType)(otherSchema);
|
|
19
|
+
const otherSchemaIsAlsoNullish = otherType === 'null' || otherType === 'undefined';
|
|
20
20
|
return {
|
|
21
21
|
nullIndex,
|
|
22
22
|
nullishValue,
|
|
@@ -25,18 +25,14 @@ const findNull = (value, zodType) => {
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
const ZodUnionEditor = ({ jsonPath, schema, setValue, onSave, defaultValue, value, showSaveButton, onRemove, saving, saveDisabledByParent, mayPad, }) => {
|
|
28
|
-
const
|
|
29
|
-
const z = (0, get_zod_if_possible_1.useZodIfPossible)();
|
|
30
|
-
if (!z) {
|
|
31
|
-
throw new Error('expected zod');
|
|
32
|
-
}
|
|
28
|
+
const options = (0, zod_schema_type_1.getUnionOptions)(schema);
|
|
33
29
|
if (options.length > 2) {
|
|
34
30
|
return (jsx_runtime_1.jsx(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Union with more than 2 options not editable', showSaveButton: showSaveButton, saving: saving, mayPad: mayPad }));
|
|
35
31
|
}
|
|
36
32
|
if (options.length < 2) {
|
|
37
33
|
return (jsx_runtime_1.jsx(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Union with less than 2 options not editable', showSaveButton: showSaveButton, saving: saving, mayPad: mayPad }));
|
|
38
34
|
}
|
|
39
|
-
const nullResult = findNull(options
|
|
35
|
+
const nullResult = findNull(options);
|
|
40
36
|
if (!nullResult) {
|
|
41
37
|
return (jsx_runtime_1.jsx(ZodNonEditableValue_1.ZonNonEditableValue, { jsonPath: jsonPath, label: 'Union only editable with 1 value being null', showSaveButton: showSaveButton, saving: saving, mayPad: mayPad }));
|
|
42
38
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare const createZodValues: (schema:
|
|
1
|
+
import { type AnyZodSchema } from './zod-schema-type';
|
|
2
|
+
export declare const createZodValues: (schema: AnyZodSchema, zodRuntime: unknown, zodTypes: typeof import("@remotion/zod-types") | null) => unknown;
|
|
@@ -1,50 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createZodValues = void 0;
|
|
4
|
+
const zod_schema_type_1 = require("./zod-schema-type");
|
|
4
5
|
const createZodValues = (schema, zodRuntime, zodTypes) => {
|
|
6
|
+
var _a;
|
|
5
7
|
if (!schema) {
|
|
6
8
|
throw new Error('Invalid zod schema');
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
// In v4, .refine()/.describe() don't wrap in effects — the description
|
|
11
|
+
// lives directly on the schema. Check for branded descriptions early
|
|
12
|
+
// so they are detected regardless of the underlying type.
|
|
13
|
+
const description = (0, zod_schema_type_1.getZodSchemaDescription)(schema);
|
|
14
|
+
if (zodTypes) {
|
|
15
|
+
if (description === zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
|
|
16
|
+
return '#ffffff';
|
|
17
|
+
}
|
|
18
|
+
if (description === zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
if (description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
22
|
+
return [
|
|
23
|
+
[1, 0, 0],
|
|
24
|
+
[0, 1, 0],
|
|
25
|
+
[0, 0, 1],
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const typeName = (0, zod_schema_type_1.getZodSchemaType)(schema);
|
|
10
30
|
switch (typeName) {
|
|
11
|
-
case
|
|
31
|
+
case 'string':
|
|
12
32
|
return '';
|
|
13
|
-
case
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
33
|
+
case 'number': {
|
|
34
|
+
const { checks } = (0, zod_schema_type_1.getZodDef)(schema);
|
|
35
|
+
if (checks) {
|
|
36
|
+
if ((0, zod_schema_type_1.isZodV3Schema)(schema)) {
|
|
37
|
+
for (const check of checks) {
|
|
38
|
+
if (check.kind === 'min')
|
|
39
|
+
return check.value;
|
|
40
|
+
if (check.kind === 'max' && check.value < 0)
|
|
41
|
+
return check.value;
|
|
42
|
+
}
|
|
17
43
|
}
|
|
18
|
-
|
|
19
|
-
|
|
44
|
+
else {
|
|
45
|
+
for (const check of checks) {
|
|
46
|
+
const cd = (_a = check._zod) === null || _a === void 0 ? void 0 : _a.def;
|
|
47
|
+
if ((cd === null || cd === void 0 ? void 0 : cd.check) === 'greater_than')
|
|
48
|
+
return cd.value;
|
|
49
|
+
if ((cd === null || cd === void 0 ? void 0 : cd.check) === 'less_than' && cd.value < 0)
|
|
50
|
+
return cd.value;
|
|
51
|
+
}
|
|
20
52
|
}
|
|
21
53
|
}
|
|
22
54
|
return 0;
|
|
23
55
|
}
|
|
24
|
-
case
|
|
56
|
+
case 'bigint':
|
|
25
57
|
return BigInt(0);
|
|
26
|
-
case
|
|
58
|
+
case 'boolean':
|
|
27
59
|
return false;
|
|
28
|
-
case
|
|
60
|
+
case 'nan':
|
|
29
61
|
return NaN;
|
|
30
|
-
case
|
|
62
|
+
case 'date':
|
|
31
63
|
return new Date();
|
|
32
|
-
case
|
|
64
|
+
case 'symbol':
|
|
33
65
|
return Symbol('remotion');
|
|
34
|
-
case
|
|
66
|
+
case 'undefined':
|
|
67
|
+
case 'void':
|
|
35
68
|
return undefined;
|
|
36
|
-
case
|
|
69
|
+
case 'null':
|
|
37
70
|
return null;
|
|
38
|
-
case
|
|
71
|
+
case 'any':
|
|
72
|
+
case 'custom':
|
|
39
73
|
throw new Error('Cannot create a value for type z.any()');
|
|
40
|
-
case
|
|
74
|
+
case 'unknown':
|
|
41
75
|
throw new Error('Cannot create a value for type z.unknown()');
|
|
42
|
-
case
|
|
76
|
+
case 'never':
|
|
43
77
|
throw new Error('Cannot create a value for type z.never()');
|
|
44
|
-
case
|
|
45
|
-
|
|
46
|
-
case zodRuntime.ZodFirstPartyTypeKind.ZodObject: {
|
|
47
|
-
const shape = def.shape();
|
|
78
|
+
case 'object': {
|
|
79
|
+
const shape = (0, zod_schema_type_1.getObjectShape)(schema);
|
|
48
80
|
const keys = Object.keys(shape);
|
|
49
81
|
const returnValue = keys.reduce((existing, key) => {
|
|
50
82
|
existing[key] = (0, exports.createZodValues)(shape[key], zodRuntime, zodTypes);
|
|
@@ -52,48 +84,27 @@ const createZodValues = (schema, zodRuntime, zodTypes) => {
|
|
|
52
84
|
}, {});
|
|
53
85
|
return returnValue;
|
|
54
86
|
}
|
|
55
|
-
case
|
|
56
|
-
return [
|
|
57
|
-
(0, exports.createZodValues)(def.type, zodRuntime, zodTypes),
|
|
58
|
-
];
|
|
87
|
+
case 'array': {
|
|
88
|
+
return [(0, exports.createZodValues)((0, zod_schema_type_1.getArrayElement)(schema), zodRuntime, zodTypes)];
|
|
59
89
|
}
|
|
60
|
-
case
|
|
61
|
-
const
|
|
62
|
-
return
|
|
63
|
-
? (0, exports.createZodValues)(
|
|
90
|
+
case 'union': {
|
|
91
|
+
const firstOption = (0, zod_schema_type_1.getUnionOptions)(schema)[0];
|
|
92
|
+
return firstOption
|
|
93
|
+
? (0, exports.createZodValues)(firstOption, zodRuntime, zodTypes)
|
|
64
94
|
: undefined;
|
|
65
95
|
}
|
|
66
|
-
case
|
|
67
|
-
const
|
|
68
|
-
return (0, exports.createZodValues)(
|
|
96
|
+
case 'discriminatedUnion': {
|
|
97
|
+
const firstOption = (0, zod_schema_type_1.getUnionOptions)(schema)[0];
|
|
98
|
+
return (0, exports.createZodValues)(firstOption, zodRuntime, zodTypes);
|
|
69
99
|
}
|
|
70
|
-
case
|
|
71
|
-
return
|
|
100
|
+
case 'literal': {
|
|
101
|
+
return (0, zod_schema_type_1.getLiteralValue)(schema);
|
|
72
102
|
}
|
|
73
|
-
case
|
|
74
|
-
|
|
75
|
-
schema._def.description ===
|
|
76
|
-
zodTypes.ZodZypesInternals.REMOTION_COLOR_BRAND) {
|
|
77
|
-
return '#ffffff';
|
|
78
|
-
}
|
|
79
|
-
if (zodTypes &&
|
|
80
|
-
schema._def.description ===
|
|
81
|
-
zodTypes.ZodZypesInternals.REMOTION_TEXTAREA_BRAND) {
|
|
82
|
-
return '';
|
|
83
|
-
}
|
|
84
|
-
if (zodTypes &&
|
|
85
|
-
schema._def.description ===
|
|
86
|
-
zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
|
|
87
|
-
return [
|
|
88
|
-
[1, 0, 0],
|
|
89
|
-
[0, 1, 0],
|
|
90
|
-
[0, 0, 1],
|
|
91
|
-
];
|
|
92
|
-
}
|
|
93
|
-
return (0, exports.createZodValues)(def.schema, zodRuntime, zodTypes);
|
|
103
|
+
case 'effects': {
|
|
104
|
+
return (0, exports.createZodValues)((0, zod_schema_type_1.getEffectsInner)(schema), zodRuntime, zodTypes);
|
|
94
105
|
}
|
|
95
|
-
case
|
|
96
|
-
const { left, right } =
|
|
106
|
+
case 'intersection': {
|
|
107
|
+
const { left, right } = (0, zod_schema_type_1.getIntersectionSchemas)(schema);
|
|
97
108
|
const leftValue = (0, exports.createZodValues)(left, zodRuntime, zodTypes);
|
|
98
109
|
if (typeof leftValue !== 'object') {
|
|
99
110
|
throw new Error('Cannot create value for type z.intersection: Left side is not an object');
|
|
@@ -104,75 +115,62 @@ const createZodValues = (schema, zodRuntime, zodTypes) => {
|
|
|
104
115
|
}
|
|
105
116
|
return { ...leftValue, ...rightValue };
|
|
106
117
|
}
|
|
107
|
-
case
|
|
108
|
-
|
|
109
|
-
return items;
|
|
118
|
+
case 'tuple': {
|
|
119
|
+
return (0, zod_schema_type_1.getTupleItems)(schema).map((item) => (0, exports.createZodValues)(item, zodRuntime, zodTypes));
|
|
110
120
|
}
|
|
111
|
-
case
|
|
112
|
-
const values = (0, exports.createZodValues)(
|
|
121
|
+
case 'record': {
|
|
122
|
+
const values = (0, exports.createZodValues)((0, zod_schema_type_1.getRecordValueType)(schema), zodRuntime, zodTypes);
|
|
113
123
|
return { key: values };
|
|
114
124
|
}
|
|
115
|
-
case
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
const key = (0, exports.createZodValues)(defType.keyType, zodRuntime, zodTypes);
|
|
125
|
+
case 'map': {
|
|
126
|
+
const values = (0, exports.createZodValues)((0, zod_schema_type_1.getRecordValueType)(schema), zodRuntime, zodTypes);
|
|
127
|
+
const key = (0, exports.createZodValues)((0, zod_schema_type_1.getRecordKeyType)(schema), zodRuntime, zodTypes);
|
|
119
128
|
return new Map([[key, values]]);
|
|
120
129
|
}
|
|
121
|
-
case
|
|
122
|
-
const
|
|
123
|
-
const type = defType.getter();
|
|
130
|
+
case 'lazy': {
|
|
131
|
+
const type = (0, zod_schema_type_1.getZodDef)(schema).getter();
|
|
124
132
|
return (0, exports.createZodValues)(type, zodRuntime, zodTypes);
|
|
125
133
|
}
|
|
126
|
-
case
|
|
127
|
-
const
|
|
128
|
-
const values = (0, exports.createZodValues)(defType.valueType, zodRuntime, zodTypes);
|
|
134
|
+
case 'set': {
|
|
135
|
+
const values = (0, exports.createZodValues)((0, zod_schema_type_1.getZodDef)(schema).valueType, zodRuntime, zodTypes);
|
|
129
136
|
return new Set([values]);
|
|
130
137
|
}
|
|
131
|
-
case
|
|
138
|
+
case 'function': {
|
|
132
139
|
throw new Error('Cannot create a value for type function');
|
|
133
140
|
}
|
|
134
|
-
case
|
|
135
|
-
|
|
136
|
-
return values[0];
|
|
141
|
+
case 'enum': {
|
|
142
|
+
return (0, zod_schema_type_1.getFirstEnumValue)(schema);
|
|
137
143
|
}
|
|
138
|
-
case
|
|
144
|
+
case 'nativeEnum': {
|
|
139
145
|
return 0;
|
|
140
146
|
}
|
|
141
|
-
case
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return
|
|
147
|
+
case 'optional':
|
|
148
|
+
case 'nullable':
|
|
149
|
+
case 'catch': {
|
|
150
|
+
return (0, exports.createZodValues)((0, zod_schema_type_1.getInnerType)(schema), zodRuntime, zodTypes);
|
|
145
151
|
}
|
|
146
|
-
case
|
|
147
|
-
|
|
148
|
-
const value = (0, exports.createZodValues)(defType.innerType, zodRuntime, zodTypes);
|
|
149
|
-
return value;
|
|
152
|
+
case 'default': {
|
|
153
|
+
return (0, zod_schema_type_1.getDefaultValue)(schema);
|
|
150
154
|
}
|
|
151
|
-
case
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const defType = def;
|
|
157
|
-
const value = (0, exports.createZodValues)(defType.innerType, zodRuntime, zodTypes);
|
|
158
|
-
return value;
|
|
159
|
-
}
|
|
160
|
-
case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
|
|
161
|
-
const defType = def;
|
|
162
|
-
const value = (0, exports.createZodValues)(defType.type, zodRuntime, zodTypes);
|
|
155
|
+
case 'promise': {
|
|
156
|
+
const def = (0, zod_schema_type_1.getZodDef)(schema);
|
|
157
|
+
// v3: _def.type, v4: _def.innerType
|
|
158
|
+
const inner = (0, zod_schema_type_1.isZodV3Schema)(schema) ? def.type : def.innerType;
|
|
159
|
+
const value = (0, exports.createZodValues)(inner, zodRuntime, zodTypes);
|
|
163
160
|
return Promise.resolve(value);
|
|
164
161
|
}
|
|
165
|
-
case
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
//
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
162
|
+
case 'branded': {
|
|
163
|
+
return (0, exports.createZodValues)((0, zod_schema_type_1.getBrandedInner)(schema), zodRuntime, zodTypes);
|
|
164
|
+
}
|
|
165
|
+
case 'pipeline':
|
|
166
|
+
case 'pipe': {
|
|
167
|
+
const out = (0, zod_schema_type_1.getPipelineOutput)(schema);
|
|
168
|
+
// In v4, .transform() creates pipe { in, out: transform }.
|
|
169
|
+
// Since we don't apply transforms, use the input side.
|
|
170
|
+
if ((0, zod_schema_type_1.getZodSchemaType)(out) === 'transform') {
|
|
171
|
+
return (0, exports.createZodValues)((0, zod_schema_type_1.getPipelineInput)(schema), zodRuntime, zodTypes);
|
|
172
|
+
}
|
|
173
|
+
return (0, exports.createZodValues)(out, zodRuntime, zodTypes);
|
|
176
174
|
}
|
|
177
175
|
default:
|
|
178
176
|
throw new Error('Not implemented: ' + typeName);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AnyZodSchema } from './zod-schema-type';
|
|
2
2
|
export declare const extractEnumJsonPaths: ({ schema, zodRuntime, currentPath, zodTypes, }: {
|
|
3
|
-
schema:
|
|
4
|
-
zodRuntime:
|
|
3
|
+
schema: AnyZodSchema;
|
|
4
|
+
zodRuntime: unknown;
|
|
5
5
|
zodTypes: typeof import("@remotion/zod-types") | null;
|
|
6
6
|
currentPath: (string | number)[];
|
|
7
7
|
}) => (string | number)[][];
|