@purpleschool/gptbot 0.12.85 → 0.12.86
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.
|
@@ -3,17 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RunCanvasCommand = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const models_1 = require("../../../models");
|
|
6
|
-
const save_canvas_command_1 = require("./save-canvas.command");
|
|
7
6
|
var RunCanvasCommand;
|
|
8
7
|
(function (RunCanvasCommand) {
|
|
9
8
|
RunCanvasCommand.RequestParamSchema = models_1.CanvasSchema.pick({
|
|
10
9
|
uuid: true,
|
|
11
10
|
});
|
|
12
|
-
RunCanvasCommand.RequestSchema = zod_1.z.object({
|
|
13
|
-
updatedAt: zod_1.z.preprocess((value) => (typeof value === 'string' ? new Date(value) : value), zod_1.z.date()),
|
|
14
|
-
nodes: zod_1.z.array(save_canvas_command_1.SaveCanvasCommand.CanvasNodePayloadSchema),
|
|
15
|
-
edges: zod_1.z.array(save_canvas_command_1.SaveCanvasCommand.CanvasEdgePayloadSchema),
|
|
16
|
-
});
|
|
17
11
|
RunCanvasCommand.ResponseSchema = zod_1.z.object({
|
|
18
12
|
data: models_1.CanvasSchema.extend({
|
|
19
13
|
nodes: zod_1.z.array(models_1.CanvasNodeSchema),
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CanvasNodeSchema = exports.CanvasNodeBaseSchema = exports.validateCanvasNodeOutputByType = exports.validateCanvasNodeParamsByType = exports.CanvasNodeErrorSchema = exports.CanvasNodeOutputSchemaByType = exports.CanvasNodeParamsSchemaByType = exports.AudioBlockOutputSchema = exports.VarBlockOutputSchema = exports.NoteOutputSchema = exports.FileBlockOutputSchema = exports.VideoBlockOutputSchema = exports.ImageBlockOutputSchema = exports.TextBlockOutputSchema = exports.HtmlGenOutputSchema = exports.VarGenOutputSchema = exports.MotionControlOutputSchema = exports.ColorPaletteOutputSchema = exports.AudioGenSTTOutputSchema = exports.AudioGenTTSOutputSchema = exports.VideoGenOutputSchema = exports.ImageGenOutputSchema = exports.TextGenOutputSchema = exports.
|
|
3
|
+
exports.CanvasNodeSchema = exports.CanvasNodeBaseSchema = exports.validateCanvasNodeOutputByType = exports.validateCanvasNodeParamsByType = exports.CanvasNodeErrorSchema = exports.CanvasNodeOutputSchemaByType = exports.CanvasNodeParamsSchemaByType = exports.AudioBlockOutputSchema = exports.VarBlockOutputSchema = exports.NoteOutputSchema = exports.FileBlockOutputSchema = exports.VideoBlockOutputSchema = exports.ImageBlockOutputSchema = exports.TextBlockOutputSchema = exports.HtmlGenOutputSchema = exports.VarGenOutputSchema = exports.MotionControlOutputSchema = exports.ColorPaletteOutputSchema = exports.AudioGenSTTOutputSchema = exports.AudioGenTTSOutputSchema = exports.VideoGenOutputSchema = exports.ImageGenOutputSchema = exports.TextGenOutputSchema = exports.NoParamsSchema = exports.HtmlGenParamsSchema = exports.VarGenParamsSchema = exports.MotionControlParamsSchema = exports.ColorPaletteParamsSchema = exports.AudioGenParamsSchema = exports.VideoGenParamsSchema = exports.ImageGenParamsSchema = exports.TextGenParamsSchema = exports.CanvasNodePositionSchema = exports.CanvasFileRefSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const strictObject = (shape) => zod_1.z.object(shape).strict();
|
|
7
|
+
exports.CanvasFileRefSchema = strictObject({
|
|
8
|
+
fileId: zod_1.z.string().uuid(),
|
|
9
|
+
url: zod_1.z.string().url(),
|
|
10
|
+
text: zod_1.z.string().nullable(),
|
|
11
|
+
});
|
|
7
12
|
exports.CanvasNodePositionSchema = zod_1.z.object({
|
|
8
13
|
topLeft: zod_1.z.object({
|
|
9
14
|
x: zod_1.z.number(),
|
|
@@ -53,7 +58,7 @@ exports.AudioGenParamsSchema = zod_1.z.discriminatedUnion('mode', [
|
|
|
53
58
|
}),
|
|
54
59
|
]);
|
|
55
60
|
exports.ColorPaletteParamsSchema = strictObject({
|
|
56
|
-
prompt: zod_1.z.string(),
|
|
61
|
+
prompt: zod_1.z.string().optional(),
|
|
57
62
|
colors: zod_1.z.array(zod_1.z.string().regex(/^#[0-9A-Fa-f]{6}$/)).optional(),
|
|
58
63
|
});
|
|
59
64
|
exports.MotionControlParamsSchema = strictObject({
|
|
@@ -65,7 +70,8 @@ exports.MotionControlParamsSchema = strictObject({
|
|
|
65
70
|
});
|
|
66
71
|
exports.VarGenParamsSchema = strictObject({
|
|
67
72
|
prompt: zod_1.z.string(),
|
|
68
|
-
|
|
73
|
+
modelId: zod_1.z.string(),
|
|
74
|
+
modelName: zod_1.z.string(),
|
|
69
75
|
vars: zod_1.z.array(strictObject({
|
|
70
76
|
key: zod_1.z.string(),
|
|
71
77
|
description: zod_1.z.string(),
|
|
@@ -76,35 +82,8 @@ exports.HtmlGenParamsSchema = strictObject({
|
|
|
76
82
|
modelId: zod_1.z.string(),
|
|
77
83
|
modelName: zod_1.z.string(),
|
|
78
84
|
});
|
|
79
|
-
exports.
|
|
80
|
-
content: zod_1.z.string(),
|
|
81
|
-
});
|
|
82
|
-
exports.ImageBlockParamsSchema = strictObject({
|
|
83
|
-
url: zod_1.z.string(),
|
|
84
|
-
});
|
|
85
|
-
exports.VideoBlockParamsSchema = strictObject({
|
|
86
|
-
url: zod_1.z.string(),
|
|
87
|
-
});
|
|
88
|
-
exports.FileBlockParamsSchema = strictObject({
|
|
89
|
-
filename: zod_1.z.string(),
|
|
90
|
-
content: zod_1.z.string(),
|
|
91
|
-
});
|
|
92
|
-
exports.NoteParamsSchema = strictObject({
|
|
93
|
-
content: zod_1.z.string(),
|
|
94
|
-
});
|
|
95
|
-
exports.VarBlockParamsSchema = strictObject({
|
|
96
|
-
name: zod_1.z.string(),
|
|
97
|
-
value: zod_1.z.string(),
|
|
98
|
-
});
|
|
99
|
-
exports.AudioBlockParamsSchema = strictObject({
|
|
100
|
-
fileName: zod_1.z.string(),
|
|
101
|
-
content: zod_1.z.string(),
|
|
102
|
-
});
|
|
85
|
+
exports.NoParamsSchema = zod_1.z.null();
|
|
103
86
|
// OUTPUT SHEMA
|
|
104
|
-
exports.CanvasFileRefSchema = strictObject({
|
|
105
|
-
fileId: zod_1.z.string().uuid(),
|
|
106
|
-
url: zod_1.z.string().url(),
|
|
107
|
-
});
|
|
108
87
|
exports.TextGenOutputSchema = strictObject({
|
|
109
88
|
result: zod_1.z.string(),
|
|
110
89
|
});
|
|
@@ -133,7 +112,9 @@ exports.HtmlGenOutputSchema = strictObject({
|
|
|
133
112
|
sessionId: zod_1.z.string(),
|
|
134
113
|
html: zod_1.z.string(),
|
|
135
114
|
});
|
|
136
|
-
exports.TextBlockOutputSchema =
|
|
115
|
+
exports.TextBlockOutputSchema = strictObject({
|
|
116
|
+
text: zod_1.z.string(),
|
|
117
|
+
});
|
|
137
118
|
exports.ImageBlockOutputSchema = strictObject({
|
|
138
119
|
image: exports.CanvasFileRefSchema,
|
|
139
120
|
});
|
|
@@ -141,14 +122,17 @@ exports.VideoBlockOutputSchema = strictObject({
|
|
|
141
122
|
video: exports.CanvasFileRefSchema,
|
|
142
123
|
});
|
|
143
124
|
exports.FileBlockOutputSchema = strictObject({
|
|
144
|
-
|
|
125
|
+
file: exports.CanvasFileRefSchema,
|
|
126
|
+
});
|
|
127
|
+
exports.NoteOutputSchema = strictObject({
|
|
145
128
|
content: zod_1.z.string(),
|
|
146
|
-
file: exports.CanvasFileRefSchema.optional(),
|
|
147
129
|
});
|
|
148
|
-
exports.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
130
|
+
exports.VarBlockOutputSchema = strictObject({
|
|
131
|
+
name: zod_1.z.string(),
|
|
132
|
+
value: zod_1.z.string(),
|
|
133
|
+
});
|
|
134
|
+
exports.AudioBlockOutputSchema = strictObject({
|
|
135
|
+
audio: exports.CanvasFileRefSchema.nullable().optional(),
|
|
152
136
|
});
|
|
153
137
|
exports.CanvasNodeParamsSchemaByType = {
|
|
154
138
|
[constants_1.CANVAS_NODE_TYPE.textGen]: exports.TextGenParamsSchema,
|
|
@@ -158,17 +142,17 @@ exports.CanvasNodeParamsSchemaByType = {
|
|
|
158
142
|
[constants_1.CANVAS_NODE_TYPE.videoEdit]: exports.VideoGenParamsSchema,
|
|
159
143
|
[constants_1.CANVAS_NODE_TYPE.ttsGen]: exports.AudioGenParamsSchema,
|
|
160
144
|
[constants_1.CANVAS_NODE_TYPE.sttGen]: exports.AudioGenParamsSchema,
|
|
161
|
-
[constants_1.CANVAS_NODE_TYPE.textBlock]: exports.
|
|
162
|
-
[constants_1.CANVAS_NODE_TYPE.imageBlock]: exports.
|
|
163
|
-
[constants_1.CANVAS_NODE_TYPE.videoBlock]: exports.
|
|
164
|
-
[constants_1.CANVAS_NODE_TYPE.fileBlock]: exports.
|
|
165
|
-
[constants_1.CANVAS_NODE_TYPE.note]: exports.
|
|
145
|
+
[constants_1.CANVAS_NODE_TYPE.textBlock]: exports.NoParamsSchema,
|
|
146
|
+
[constants_1.CANVAS_NODE_TYPE.imageBlock]: exports.NoParamsSchema,
|
|
147
|
+
[constants_1.CANVAS_NODE_TYPE.videoBlock]: exports.NoParamsSchema,
|
|
148
|
+
[constants_1.CANVAS_NODE_TYPE.fileBlock]: exports.NoParamsSchema,
|
|
149
|
+
[constants_1.CANVAS_NODE_TYPE.note]: exports.NoParamsSchema,
|
|
166
150
|
[constants_1.CANVAS_NODE_TYPE.colorPalette]: exports.ColorPaletteParamsSchema,
|
|
167
151
|
[constants_1.CANVAS_NODE_TYPE.motionControl]: exports.MotionControlParamsSchema,
|
|
168
152
|
[constants_1.CANVAS_NODE_TYPE.varGen]: exports.VarGenParamsSchema,
|
|
169
|
-
[constants_1.CANVAS_NODE_TYPE.varBlock]: exports.
|
|
153
|
+
[constants_1.CANVAS_NODE_TYPE.varBlock]: exports.NoParamsSchema,
|
|
170
154
|
[constants_1.CANVAS_NODE_TYPE.htmlGen]: exports.HtmlGenParamsSchema,
|
|
171
|
-
[constants_1.CANVAS_NODE_TYPE.audioBlock]: exports.
|
|
155
|
+
[constants_1.CANVAS_NODE_TYPE.audioBlock]: exports.NoParamsSchema,
|
|
172
156
|
};
|
|
173
157
|
exports.CanvasNodeOutputSchemaByType = {
|
|
174
158
|
[constants_1.CANVAS_NODE_TYPE.textGen]: exports.TextGenOutputSchema,
|
|
@@ -275,27 +259,27 @@ exports.CanvasNodeSchema = zod_1.z.discriminatedUnion('nodeDefinitionId', [
|
|
|
275
259
|
}),
|
|
276
260
|
exports.CanvasNodeBaseSchema.extend({
|
|
277
261
|
nodeDefinitionId: zod_1.z.literal(constants_1.CANVAS_NODE_TYPE.textBlock),
|
|
278
|
-
params: exports.
|
|
262
|
+
params: exports.NoParamsSchema,
|
|
279
263
|
output: exports.TextBlockOutputSchema.nullable(),
|
|
280
264
|
}),
|
|
281
265
|
exports.CanvasNodeBaseSchema.extend({
|
|
282
266
|
nodeDefinitionId: zod_1.z.literal(constants_1.CANVAS_NODE_TYPE.imageBlock),
|
|
283
|
-
params: exports.
|
|
267
|
+
params: exports.NoParamsSchema,
|
|
284
268
|
output: exports.ImageBlockOutputSchema.nullable(),
|
|
285
269
|
}),
|
|
286
270
|
exports.CanvasNodeBaseSchema.extend({
|
|
287
271
|
nodeDefinitionId: zod_1.z.literal(constants_1.CANVAS_NODE_TYPE.videoBlock),
|
|
288
|
-
params: exports.
|
|
272
|
+
params: exports.NoParamsSchema,
|
|
289
273
|
output: exports.VideoBlockOutputSchema.nullable(),
|
|
290
274
|
}),
|
|
291
275
|
exports.CanvasNodeBaseSchema.extend({
|
|
292
276
|
nodeDefinitionId: zod_1.z.literal(constants_1.CANVAS_NODE_TYPE.fileBlock),
|
|
293
|
-
params: exports.
|
|
277
|
+
params: exports.NoParamsSchema,
|
|
294
278
|
output: exports.FileBlockOutputSchema.nullable(),
|
|
295
279
|
}),
|
|
296
280
|
exports.CanvasNodeBaseSchema.extend({
|
|
297
281
|
nodeDefinitionId: zod_1.z.literal(constants_1.CANVAS_NODE_TYPE.note),
|
|
298
|
-
params: exports.
|
|
282
|
+
params: exports.NoParamsSchema,
|
|
299
283
|
output: exports.NoteOutputSchema.nullable(),
|
|
300
284
|
}),
|
|
301
285
|
exports.CanvasNodeBaseSchema.extend({
|
|
@@ -315,7 +299,7 @@ exports.CanvasNodeSchema = zod_1.z.discriminatedUnion('nodeDefinitionId', [
|
|
|
315
299
|
}),
|
|
316
300
|
exports.CanvasNodeBaseSchema.extend({
|
|
317
301
|
nodeDefinitionId: zod_1.z.literal(constants_1.CANVAS_NODE_TYPE.varBlock),
|
|
318
|
-
params: exports.
|
|
302
|
+
params: exports.NoParamsSchema,
|
|
319
303
|
output: exports.VarBlockOutputSchema.nullable(),
|
|
320
304
|
}),
|
|
321
305
|
exports.CanvasNodeBaseSchema.extend({
|
|
@@ -325,7 +309,7 @@ exports.CanvasNodeSchema = zod_1.z.discriminatedUnion('nodeDefinitionId', [
|
|
|
325
309
|
}),
|
|
326
310
|
exports.CanvasNodeBaseSchema.extend({
|
|
327
311
|
nodeDefinitionId: zod_1.z.literal(constants_1.CANVAS_NODE_TYPE.audioBlock),
|
|
328
|
-
params: exports.
|
|
312
|
+
params: exports.NoParamsSchema,
|
|
329
313
|
output: exports.AudioBlockOutputSchema.nullable(),
|
|
330
314
|
}),
|
|
331
315
|
]);
|
|
@@ -9,17 +9,6 @@ export namespace RunCanvasCommand {
|
|
|
9
9
|
|
|
10
10
|
export type RequestParam = z.infer<typeof RequestParamSchema>;
|
|
11
11
|
|
|
12
|
-
export const RequestSchema = z.object({
|
|
13
|
-
updatedAt: z.preprocess(
|
|
14
|
-
(value) => (typeof value === 'string' ? new Date(value) : value),
|
|
15
|
-
z.date(),
|
|
16
|
-
),
|
|
17
|
-
nodes: z.array(SaveCanvasCommand.CanvasNodePayloadSchema),
|
|
18
|
-
edges: z.array(SaveCanvasCommand.CanvasEdgePayloadSchema),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
22
|
-
|
|
23
12
|
export const ResponseSchema = z.object({
|
|
24
13
|
data: CanvasSchema.extend({
|
|
25
14
|
nodes: z.array(CanvasNodeSchema),
|
|
@@ -4,6 +4,13 @@ import { CANVAS_NODE_TYPE, NODE_RUN_STATUS } from '../constants';
|
|
|
4
4
|
const strictObject = <T extends z.ZodRawShape>(shape: T): z.ZodObject<T, 'strict'> =>
|
|
5
5
|
z.object(shape).strict();
|
|
6
6
|
|
|
7
|
+
export const CanvasFileRefSchema = strictObject({
|
|
8
|
+
fileId: z.string().uuid(),
|
|
9
|
+
url: z.string().url(),
|
|
10
|
+
text: z.string().nullable(),
|
|
11
|
+
});
|
|
12
|
+
export type CanvasFileRef = z.infer<typeof CanvasFileRefSchema>;
|
|
13
|
+
|
|
7
14
|
export const CanvasNodePositionSchema = z.object({
|
|
8
15
|
topLeft: z.object({
|
|
9
16
|
x: z.number(),
|
|
@@ -63,7 +70,7 @@ export const AudioGenParamsSchema = z.discriminatedUnion('mode', [
|
|
|
63
70
|
export type AudioGenParams = z.infer<typeof AudioGenParamsSchema>;
|
|
64
71
|
|
|
65
72
|
export const ColorPaletteParamsSchema = strictObject({
|
|
66
|
-
prompt: z.string(),
|
|
73
|
+
prompt: z.string().optional(),
|
|
67
74
|
colors: z.array(z.string().regex(/^#[0-9A-Fa-f]{6}$/)).optional(),
|
|
68
75
|
});
|
|
69
76
|
export type ColorPaletteParams = z.infer<typeof ColorPaletteParamsSchema>;
|
|
@@ -79,7 +86,8 @@ export type MotionControlParams = z.infer<typeof MotionControlParamsSchema>;
|
|
|
79
86
|
|
|
80
87
|
export const VarGenParamsSchema = strictObject({
|
|
81
88
|
prompt: z.string(),
|
|
82
|
-
|
|
89
|
+
modelId: z.string(),
|
|
90
|
+
modelName: z.string(),
|
|
83
91
|
vars: z.array(
|
|
84
92
|
strictObject({
|
|
85
93
|
key: z.string(),
|
|
@@ -96,51 +104,10 @@ export const HtmlGenParamsSchema = strictObject({
|
|
|
96
104
|
});
|
|
97
105
|
export type HtmlGenParams = z.infer<typeof HtmlGenParamsSchema>;
|
|
98
106
|
|
|
99
|
-
export const
|
|
100
|
-
|
|
101
|
-
});
|
|
102
|
-
export type TextBlockParams = z.infer<typeof TextBlockParamsSchema>;
|
|
103
|
-
|
|
104
|
-
export const ImageBlockParamsSchema = strictObject({
|
|
105
|
-
url: z.string(),
|
|
106
|
-
});
|
|
107
|
-
export type ImageBlockParams = z.infer<typeof ImageBlockParamsSchema>;
|
|
108
|
-
|
|
109
|
-
export const VideoBlockParamsSchema = strictObject({
|
|
110
|
-
url: z.string(),
|
|
111
|
-
});
|
|
112
|
-
export type VideoBlockParams = z.infer<typeof VideoBlockParamsSchema>;
|
|
113
|
-
|
|
114
|
-
export const FileBlockParamsSchema = strictObject({
|
|
115
|
-
filename: z.string(),
|
|
116
|
-
content: z.string(),
|
|
117
|
-
});
|
|
118
|
-
export type FileBlockParams = z.infer<typeof FileBlockParamsSchema>;
|
|
119
|
-
|
|
120
|
-
export const NoteParamsSchema = strictObject({
|
|
121
|
-
content: z.string(),
|
|
122
|
-
});
|
|
123
|
-
export type NoteParams = z.infer<typeof NoteParamsSchema>;
|
|
124
|
-
|
|
125
|
-
export const VarBlockParamsSchema = strictObject({
|
|
126
|
-
name: z.string(),
|
|
127
|
-
value: z.string(),
|
|
128
|
-
});
|
|
129
|
-
export type VarBlockParams = z.infer<typeof VarBlockParamsSchema>;
|
|
130
|
-
|
|
131
|
-
export const AudioBlockParamsSchema = strictObject({
|
|
132
|
-
fileName: z.string(),
|
|
133
|
-
content: z.string(),
|
|
134
|
-
});
|
|
135
|
-
export type AudioBlockParams = z.infer<typeof AudioBlockParamsSchema>;
|
|
107
|
+
export const NoParamsSchema = z.null();
|
|
108
|
+
export type NoParams = z.infer<typeof NoParamsSchema>;
|
|
136
109
|
|
|
137
110
|
// OUTPUT SHEMA
|
|
138
|
-
export const CanvasFileRefSchema = strictObject({
|
|
139
|
-
fileId: z.string().uuid(),
|
|
140
|
-
url: z.string().url(),
|
|
141
|
-
});
|
|
142
|
-
export type CanvasFileRef = z.infer<typeof CanvasFileRefSchema>;
|
|
143
|
-
|
|
144
111
|
export const TextGenOutputSchema = strictObject({
|
|
145
112
|
result: z.string(),
|
|
146
113
|
});
|
|
@@ -187,7 +154,9 @@ export const HtmlGenOutputSchema = strictObject({
|
|
|
187
154
|
});
|
|
188
155
|
export type HtmlGenOutput = z.infer<typeof HtmlGenOutputSchema>;
|
|
189
156
|
|
|
190
|
-
export const TextBlockOutputSchema =
|
|
157
|
+
export const TextBlockOutputSchema = strictObject({
|
|
158
|
+
text: z.string(),
|
|
159
|
+
});
|
|
191
160
|
export type TextBlockOutput = z.infer<typeof TextBlockOutputSchema>;
|
|
192
161
|
|
|
193
162
|
export const ImageBlockOutputSchema = strictObject({
|
|
@@ -201,20 +170,23 @@ export const VideoBlockOutputSchema = strictObject({
|
|
|
201
170
|
export type VideoBlockOutput = z.infer<typeof VideoBlockOutputSchema>;
|
|
202
171
|
|
|
203
172
|
export const FileBlockOutputSchema = strictObject({
|
|
204
|
-
|
|
205
|
-
content: z.string(),
|
|
206
|
-
file: CanvasFileRefSchema.optional(),
|
|
173
|
+
file: CanvasFileRefSchema,
|
|
207
174
|
});
|
|
208
175
|
export type FileBlockOutput = z.infer<typeof FileBlockOutputSchema>;
|
|
209
176
|
|
|
210
|
-
export const NoteOutputSchema =
|
|
177
|
+
export const NoteOutputSchema = strictObject({
|
|
178
|
+
content: z.string(),
|
|
179
|
+
});
|
|
211
180
|
export type NoteOutput = z.infer<typeof NoteOutputSchema>;
|
|
212
181
|
|
|
213
|
-
export const VarBlockOutputSchema =
|
|
182
|
+
export const VarBlockOutputSchema = strictObject({
|
|
183
|
+
name: z.string(),
|
|
184
|
+
value: z.string(),
|
|
185
|
+
});
|
|
214
186
|
export type VarBlockOutput = z.infer<typeof VarBlockOutputSchema>;
|
|
215
187
|
|
|
216
|
-
export const AudioBlockOutputSchema =
|
|
217
|
-
audio: CanvasFileRefSchema.optional(),
|
|
188
|
+
export const AudioBlockOutputSchema = strictObject({
|
|
189
|
+
audio: CanvasFileRefSchema.nullable().optional(),
|
|
218
190
|
});
|
|
219
191
|
export type AudioBlockOutput = z.infer<typeof AudioBlockOutputSchema>;
|
|
220
192
|
|
|
@@ -226,17 +198,17 @@ export const CanvasNodeParamsSchemaByType = {
|
|
|
226
198
|
[CANVAS_NODE_TYPE.videoEdit]: VideoGenParamsSchema,
|
|
227
199
|
[CANVAS_NODE_TYPE.ttsGen]: AudioGenParamsSchema,
|
|
228
200
|
[CANVAS_NODE_TYPE.sttGen]: AudioGenParamsSchema,
|
|
229
|
-
[CANVAS_NODE_TYPE.textBlock]:
|
|
230
|
-
[CANVAS_NODE_TYPE.imageBlock]:
|
|
231
|
-
[CANVAS_NODE_TYPE.videoBlock]:
|
|
232
|
-
[CANVAS_NODE_TYPE.fileBlock]:
|
|
233
|
-
[CANVAS_NODE_TYPE.note]:
|
|
201
|
+
[CANVAS_NODE_TYPE.textBlock]: NoParamsSchema,
|
|
202
|
+
[CANVAS_NODE_TYPE.imageBlock]: NoParamsSchema,
|
|
203
|
+
[CANVAS_NODE_TYPE.videoBlock]: NoParamsSchema,
|
|
204
|
+
[CANVAS_NODE_TYPE.fileBlock]: NoParamsSchema,
|
|
205
|
+
[CANVAS_NODE_TYPE.note]: NoParamsSchema,
|
|
234
206
|
[CANVAS_NODE_TYPE.colorPalette]: ColorPaletteParamsSchema,
|
|
235
207
|
[CANVAS_NODE_TYPE.motionControl]: MotionControlParamsSchema,
|
|
236
208
|
[CANVAS_NODE_TYPE.varGen]: VarGenParamsSchema,
|
|
237
|
-
[CANVAS_NODE_TYPE.varBlock]:
|
|
209
|
+
[CANVAS_NODE_TYPE.varBlock]: NoParamsSchema,
|
|
238
210
|
[CANVAS_NODE_TYPE.htmlGen]: HtmlGenParamsSchema,
|
|
239
|
-
[CANVAS_NODE_TYPE.audioBlock]:
|
|
211
|
+
[CANVAS_NODE_TYPE.audioBlock]: NoParamsSchema,
|
|
240
212
|
} as const;
|
|
241
213
|
|
|
242
214
|
export const CanvasNodeOutputSchemaByType = {
|
|
@@ -276,17 +248,17 @@ export type CanvasNodeParamsByType = {
|
|
|
276
248
|
[CANVAS_NODE_TYPE.videoEdit]: VideoGenParams;
|
|
277
249
|
[CANVAS_NODE_TYPE.ttsGen]: AudioGenParams;
|
|
278
250
|
[CANVAS_NODE_TYPE.sttGen]: AudioGenParams;
|
|
279
|
-
[CANVAS_NODE_TYPE.textBlock]:
|
|
280
|
-
[CANVAS_NODE_TYPE.imageBlock]:
|
|
281
|
-
[CANVAS_NODE_TYPE.videoBlock]:
|
|
282
|
-
[CANVAS_NODE_TYPE.fileBlock]:
|
|
283
|
-
[CANVAS_NODE_TYPE.note]:
|
|
251
|
+
[CANVAS_NODE_TYPE.textBlock]: NoParams;
|
|
252
|
+
[CANVAS_NODE_TYPE.imageBlock]: NoParams;
|
|
253
|
+
[CANVAS_NODE_TYPE.videoBlock]: NoParams;
|
|
254
|
+
[CANVAS_NODE_TYPE.fileBlock]: NoParams;
|
|
255
|
+
[CANVAS_NODE_TYPE.note]: NoParams;
|
|
284
256
|
[CANVAS_NODE_TYPE.colorPalette]: ColorPaletteParams;
|
|
285
257
|
[CANVAS_NODE_TYPE.motionControl]: MotionControlParams;
|
|
286
258
|
[CANVAS_NODE_TYPE.varGen]: VarGenParams;
|
|
287
|
-
[CANVAS_NODE_TYPE.varBlock]:
|
|
259
|
+
[CANVAS_NODE_TYPE.varBlock]: NoParams;
|
|
288
260
|
[CANVAS_NODE_TYPE.htmlGen]: HtmlGenParams;
|
|
289
|
-
[CANVAS_NODE_TYPE.audioBlock]:
|
|
261
|
+
[CANVAS_NODE_TYPE.audioBlock]: NoParams;
|
|
290
262
|
};
|
|
291
263
|
export type CanvasNodeParams = CanvasNodeParamsByType[keyof CanvasNodeParamsByType];
|
|
292
264
|
|
|
@@ -410,27 +382,27 @@ export const CanvasNodeSchema = z.discriminatedUnion('nodeDefinitionId', [
|
|
|
410
382
|
}),
|
|
411
383
|
CanvasNodeBaseSchema.extend({
|
|
412
384
|
nodeDefinitionId: z.literal(CANVAS_NODE_TYPE.textBlock),
|
|
413
|
-
params:
|
|
385
|
+
params: NoParamsSchema,
|
|
414
386
|
output: TextBlockOutputSchema.nullable(),
|
|
415
387
|
}),
|
|
416
388
|
CanvasNodeBaseSchema.extend({
|
|
417
389
|
nodeDefinitionId: z.literal(CANVAS_NODE_TYPE.imageBlock),
|
|
418
|
-
params:
|
|
390
|
+
params: NoParamsSchema,
|
|
419
391
|
output: ImageBlockOutputSchema.nullable(),
|
|
420
392
|
}),
|
|
421
393
|
CanvasNodeBaseSchema.extend({
|
|
422
394
|
nodeDefinitionId: z.literal(CANVAS_NODE_TYPE.videoBlock),
|
|
423
|
-
params:
|
|
395
|
+
params: NoParamsSchema,
|
|
424
396
|
output: VideoBlockOutputSchema.nullable(),
|
|
425
397
|
}),
|
|
426
398
|
CanvasNodeBaseSchema.extend({
|
|
427
399
|
nodeDefinitionId: z.literal(CANVAS_NODE_TYPE.fileBlock),
|
|
428
|
-
params:
|
|
400
|
+
params: NoParamsSchema,
|
|
429
401
|
output: FileBlockOutputSchema.nullable(),
|
|
430
402
|
}),
|
|
431
403
|
CanvasNodeBaseSchema.extend({
|
|
432
404
|
nodeDefinitionId: z.literal(CANVAS_NODE_TYPE.note),
|
|
433
|
-
params:
|
|
405
|
+
params: NoParamsSchema,
|
|
434
406
|
output: NoteOutputSchema.nullable(),
|
|
435
407
|
}),
|
|
436
408
|
CanvasNodeBaseSchema.extend({
|
|
@@ -450,7 +422,7 @@ export const CanvasNodeSchema = z.discriminatedUnion('nodeDefinitionId', [
|
|
|
450
422
|
}),
|
|
451
423
|
CanvasNodeBaseSchema.extend({
|
|
452
424
|
nodeDefinitionId: z.literal(CANVAS_NODE_TYPE.varBlock),
|
|
453
|
-
params:
|
|
425
|
+
params: NoParamsSchema,
|
|
454
426
|
output: VarBlockOutputSchema.nullable(),
|
|
455
427
|
}),
|
|
456
428
|
CanvasNodeBaseSchema.extend({
|
|
@@ -460,7 +432,7 @@ export const CanvasNodeSchema = z.discriminatedUnion('nodeDefinitionId', [
|
|
|
460
432
|
}),
|
|
461
433
|
CanvasNodeBaseSchema.extend({
|
|
462
434
|
nodeDefinitionId: z.literal(CANVAS_NODE_TYPE.audioBlock),
|
|
463
|
-
params:
|
|
435
|
+
params: NoParamsSchema,
|
|
464
436
|
output: AudioBlockOutputSchema.nullable(),
|
|
465
437
|
}),
|
|
466
438
|
]);
|