@drawcall/design 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/project-state.d.ts +369 -0
- package/dist/project-state.js +112 -0
- package/dist/protocol.d.ts +163 -5
- package/dist/protocol.js +123 -5
- package/dist/v1/contract.d.ts +304 -0
- package/dist/v1/contract.js +27 -1
- package/dist/v1/schemas.d.ts +136 -0
- package/dist/v1/schemas.js +87 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export * as v1 from "./v1/index.js";
|
|
2
2
|
export { designSkill } from "./skill.generated.js";
|
|
3
3
|
export { frameCreationCapabilities, type FrameCreationCapability, type FrameCreationCapabilityId, type FrameCreationInput, } from "./v1/capabilities.js";
|
|
4
|
-
export { IMAGE_GENERATION_MODEL, IMAGE_GENERATION_PROVIDER, } from "./v1/schemas.js";
|
|
4
|
+
export { cameraPoseSchema, IMAGE_GENERATION_MODEL, IMAGE_GENERATION_PROVIDER, } from "./v1/schemas.js";
|
|
5
5
|
export { parseFrameSize } from "./target.js";
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
6
|
+
export { projectFrameLayoutSchema, projectFrameRecordSchema, projectGltsFrameRecordSchema, projectImageFrameRecordSchema, projectMarketFileSchema, projectMarketFrameRecordSchema, projectPresenceClientMessageSchema, projectPresenceServerMessageSchema, projectStateSchema, type ProjectFrameLayout, type ProjectFrameRecord, type ProjectGltsFrameRecord, type ProjectImageFrameRecord, type ProjectMarketFile, type ProjectMarketFrameRecord, type ProjectPresenceClientMessage, type ProjectPresenceServerMessage, type ProjectState, } from "./project-state.js";
|
|
7
|
+
export { acknowledgesInspection, cameraCaptureCommandSchema, cameraCaptureResultSchema, cameraMessageTypes, gltsExportCancelCommandSchema, gltsExportCancelledResultSchema, gltsExportCommandSchema, gltsExportFrameMessageSchema, gltsExportMessageTypes, gltsExportParentMessageSchema, gltsExportResultSchema, gltsRuntimeExportFormatSchema, inspectionCommandSchema, inspectionFrameMessageSchema, inspectionMessageTypes, projectSyncUrl, sourceFileChangeSchema, sourceFileMessageTypes, sourceFileReloadResultSchema, sourceFilesChangedMessageSchema, type GltsExportCancelCommand, type GltsExportCancelledResult, type GltsExportCommand, type GltsExportFrameMessage, type GltsExportParentMessage, type GltsExportResult, type GltsRuntimeExportFormat, type CameraCaptureCommand, type CameraCaptureFailure, type CameraCaptureResult, type InspectionAppliedMessage, type InspectionCommand, type InspectionFrameMessage, type SourceFileChange, type SourceFileReloadResult, type SourceFilesChangedMessage, } from "./protocol.js";
|
|
8
|
+
export type { BinaryFile, CameraPose, CreateFrame, CreateProjectFromBrief, CreateGltsFrame, CreateImageFrame, CreateMarketFrame, GenerateImageFrame, DesignFile, FileList, FileMutation, FrameExport, Frame, GltsFrame, GltsFrameExport, ImageFrame, ImageFrameExport, ImageGenerationOperation, ImageGenerationProvenance, ImageGenerationResult, MarketFrame, MarketFrameExport, Project, ProjectDerivationStatus, Screenshot, TextFile, User, } from "./v1/schemas.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * as v1 from "./v1/index.js";
|
|
2
2
|
export { designSkill } from "./skill.generated.js";
|
|
3
3
|
export { frameCreationCapabilities, } from "./v1/capabilities.js";
|
|
4
|
-
export { IMAGE_GENERATION_MODEL, IMAGE_GENERATION_PROVIDER, } from "./v1/schemas.js";
|
|
4
|
+
export { cameraPoseSchema, IMAGE_GENERATION_MODEL, IMAGE_GENERATION_PROVIDER, } from "./v1/schemas.js";
|
|
5
5
|
export { parseFrameSize } from "./target.js";
|
|
6
|
-
export {
|
|
6
|
+
export { projectFrameLayoutSchema, projectFrameRecordSchema, projectGltsFrameRecordSchema, projectImageFrameRecordSchema, projectMarketFileSchema, projectMarketFrameRecordSchema, projectPresenceClientMessageSchema, projectPresenceServerMessageSchema, projectStateSchema, } from "./project-state.js";
|
|
7
|
+
export { acknowledgesInspection, cameraCaptureCommandSchema, cameraCaptureResultSchema, cameraMessageTypes, gltsExportCancelCommandSchema, gltsExportCancelledResultSchema, gltsExportCommandSchema, gltsExportFrameMessageSchema, gltsExportMessageTypes, gltsExportParentMessageSchema, gltsExportResultSchema, gltsRuntimeExportFormatSchema, inspectionCommandSchema, inspectionFrameMessageSchema, inspectionMessageTypes, projectSyncUrl, sourceFileChangeSchema, sourceFileMessageTypes, sourceFileReloadResultSchema, sourceFilesChangedMessageSchema, } from "./protocol.js";
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const projectFrameLayoutSchema: z.ZodObject<{
|
|
3
|
+
x: z.ZodNumber;
|
|
4
|
+
y: z.ZodNumber;
|
|
5
|
+
width: z.ZodNumber;
|
|
6
|
+
height: z.ZodNumber;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export declare const projectGltsFrameRecordSchema: z.ZodObject<{
|
|
9
|
+
x: z.ZodNumber;
|
|
10
|
+
y: z.ZodNumber;
|
|
11
|
+
width: z.ZodNumber;
|
|
12
|
+
height: z.ZodNumber;
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
projectId: z.ZodString;
|
|
15
|
+
name: z.ZodString;
|
|
16
|
+
viewUrl: z.ZodString;
|
|
17
|
+
contentRevision: z.ZodNumber;
|
|
18
|
+
createdAt: z.ZodString;
|
|
19
|
+
updatedAt: z.ZodString;
|
|
20
|
+
type: z.ZodLiteral<"glts">;
|
|
21
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
position: z.ZodObject<{
|
|
23
|
+
x: z.ZodNumber;
|
|
24
|
+
y: z.ZodNumber;
|
|
25
|
+
z: z.ZodNumber;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
quaternion: z.ZodObject<{
|
|
28
|
+
x: z.ZodNumber;
|
|
29
|
+
y: z.ZodNumber;
|
|
30
|
+
z: z.ZodNumber;
|
|
31
|
+
w: z.ZodNumber;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
export declare const projectImageFrameRecordSchema: z.ZodObject<{
|
|
36
|
+
x: z.ZodNumber;
|
|
37
|
+
y: z.ZodNumber;
|
|
38
|
+
width: z.ZodNumber;
|
|
39
|
+
height: z.ZodNumber;
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
projectId: z.ZodString;
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
viewUrl: z.ZodString;
|
|
44
|
+
contentRevision: z.ZodNumber;
|
|
45
|
+
createdAt: z.ZodString;
|
|
46
|
+
updatedAt: z.ZodString;
|
|
47
|
+
type: z.ZodLiteral<"image">;
|
|
48
|
+
image: z.ZodObject<{
|
|
49
|
+
path: z.ZodString;
|
|
50
|
+
mediaType: z.ZodEnum<{
|
|
51
|
+
"image/png": "image/png";
|
|
52
|
+
"image/jpeg": "image/jpeg";
|
|
53
|
+
"image/webp": "image/webp";
|
|
54
|
+
}>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
provenance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
57
|
+
kind: z.ZodLiteral<"generated">;
|
|
58
|
+
operation: z.ZodEnum<{
|
|
59
|
+
generate: "generate";
|
|
60
|
+
edit: "edit";
|
|
61
|
+
}>;
|
|
62
|
+
prompt: z.ZodString;
|
|
63
|
+
references: z.ZodArray<z.ZodObject<{
|
|
64
|
+
frameId: z.ZodString;
|
|
65
|
+
frameUpdatedAt: z.ZodString;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
result: z.ZodEnum<{
|
|
68
|
+
replace: "replace";
|
|
69
|
+
new: "new";
|
|
70
|
+
}>;
|
|
71
|
+
provider: z.ZodLiteral<"fal-ai">;
|
|
72
|
+
model: z.ZodLiteral<"openai/gpt-image-2">;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
kind: z.ZodLiteral<"generated">;
|
|
75
|
+
operation: z.ZodEnum<{
|
|
76
|
+
generate: "generate";
|
|
77
|
+
edit: "edit";
|
|
78
|
+
}>;
|
|
79
|
+
prompt: z.ZodString;
|
|
80
|
+
references: z.ZodArray<z.ZodObject<{
|
|
81
|
+
frameId: z.ZodString;
|
|
82
|
+
frameUpdatedAt: z.ZodString;
|
|
83
|
+
}, z.core.$strip>>;
|
|
84
|
+
result: z.ZodEnum<{
|
|
85
|
+
replace: "replace";
|
|
86
|
+
new: "new";
|
|
87
|
+
}>;
|
|
88
|
+
provider: z.ZodLiteral<"cloudflare-workers-ai">;
|
|
89
|
+
model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
|
|
90
|
+
}, z.core.$strip>], "provider">>;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
export declare const projectMarketFileSchema: z.ZodObject<{
|
|
93
|
+
path: z.ZodString;
|
|
94
|
+
url: z.ZodString;
|
|
95
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strict>;
|
|
97
|
+
export declare const projectMarketFrameRecordSchema: z.ZodObject<{
|
|
98
|
+
x: z.ZodNumber;
|
|
99
|
+
y: z.ZodNumber;
|
|
100
|
+
width: z.ZodNumber;
|
|
101
|
+
height: z.ZodNumber;
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
projectId: z.ZodString;
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
viewUrl: z.ZodString;
|
|
106
|
+
contentRevision: z.ZodNumber;
|
|
107
|
+
createdAt: z.ZodString;
|
|
108
|
+
updatedAt: z.ZodString;
|
|
109
|
+
type: z.ZodLiteral<"market">;
|
|
110
|
+
market: z.ZodObject<{
|
|
111
|
+
name: z.ZodString;
|
|
112
|
+
version: z.ZodString;
|
|
113
|
+
previewUrl: z.ZodString;
|
|
114
|
+
files: z.ZodArray<z.ZodObject<{
|
|
115
|
+
path: z.ZodString;
|
|
116
|
+
url: z.ZodString;
|
|
117
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.core.$strict>>;
|
|
119
|
+
}, z.core.$strict>;
|
|
120
|
+
}, z.core.$strict>;
|
|
121
|
+
export declare const projectFrameRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
122
|
+
x: z.ZodNumber;
|
|
123
|
+
y: z.ZodNumber;
|
|
124
|
+
width: z.ZodNumber;
|
|
125
|
+
height: z.ZodNumber;
|
|
126
|
+
id: z.ZodString;
|
|
127
|
+
projectId: z.ZodString;
|
|
128
|
+
name: z.ZodString;
|
|
129
|
+
viewUrl: z.ZodString;
|
|
130
|
+
contentRevision: z.ZodNumber;
|
|
131
|
+
createdAt: z.ZodString;
|
|
132
|
+
updatedAt: z.ZodString;
|
|
133
|
+
type: z.ZodLiteral<"glts">;
|
|
134
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
135
|
+
position: z.ZodObject<{
|
|
136
|
+
x: z.ZodNumber;
|
|
137
|
+
y: z.ZodNumber;
|
|
138
|
+
z: z.ZodNumber;
|
|
139
|
+
}, z.core.$strict>;
|
|
140
|
+
quaternion: z.ZodObject<{
|
|
141
|
+
x: z.ZodNumber;
|
|
142
|
+
y: z.ZodNumber;
|
|
143
|
+
z: z.ZodNumber;
|
|
144
|
+
w: z.ZodNumber;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
}, z.core.$strict>>;
|
|
147
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
148
|
+
x: z.ZodNumber;
|
|
149
|
+
y: z.ZodNumber;
|
|
150
|
+
width: z.ZodNumber;
|
|
151
|
+
height: z.ZodNumber;
|
|
152
|
+
id: z.ZodString;
|
|
153
|
+
projectId: z.ZodString;
|
|
154
|
+
name: z.ZodString;
|
|
155
|
+
viewUrl: z.ZodString;
|
|
156
|
+
contentRevision: z.ZodNumber;
|
|
157
|
+
createdAt: z.ZodString;
|
|
158
|
+
updatedAt: z.ZodString;
|
|
159
|
+
type: z.ZodLiteral<"image">;
|
|
160
|
+
image: z.ZodObject<{
|
|
161
|
+
path: z.ZodString;
|
|
162
|
+
mediaType: z.ZodEnum<{
|
|
163
|
+
"image/png": "image/png";
|
|
164
|
+
"image/jpeg": "image/jpeg";
|
|
165
|
+
"image/webp": "image/webp";
|
|
166
|
+
}>;
|
|
167
|
+
}, z.core.$strict>;
|
|
168
|
+
provenance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
169
|
+
kind: z.ZodLiteral<"generated">;
|
|
170
|
+
operation: z.ZodEnum<{
|
|
171
|
+
generate: "generate";
|
|
172
|
+
edit: "edit";
|
|
173
|
+
}>;
|
|
174
|
+
prompt: z.ZodString;
|
|
175
|
+
references: z.ZodArray<z.ZodObject<{
|
|
176
|
+
frameId: z.ZodString;
|
|
177
|
+
frameUpdatedAt: z.ZodString;
|
|
178
|
+
}, z.core.$strip>>;
|
|
179
|
+
result: z.ZodEnum<{
|
|
180
|
+
replace: "replace";
|
|
181
|
+
new: "new";
|
|
182
|
+
}>;
|
|
183
|
+
provider: z.ZodLiteral<"fal-ai">;
|
|
184
|
+
model: z.ZodLiteral<"openai/gpt-image-2">;
|
|
185
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
186
|
+
kind: z.ZodLiteral<"generated">;
|
|
187
|
+
operation: z.ZodEnum<{
|
|
188
|
+
generate: "generate";
|
|
189
|
+
edit: "edit";
|
|
190
|
+
}>;
|
|
191
|
+
prompt: z.ZodString;
|
|
192
|
+
references: z.ZodArray<z.ZodObject<{
|
|
193
|
+
frameId: z.ZodString;
|
|
194
|
+
frameUpdatedAt: z.ZodString;
|
|
195
|
+
}, z.core.$strip>>;
|
|
196
|
+
result: z.ZodEnum<{
|
|
197
|
+
replace: "replace";
|
|
198
|
+
new: "new";
|
|
199
|
+
}>;
|
|
200
|
+
provider: z.ZodLiteral<"cloudflare-workers-ai">;
|
|
201
|
+
model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
|
|
202
|
+
}, z.core.$strip>], "provider">>;
|
|
203
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
204
|
+
x: z.ZodNumber;
|
|
205
|
+
y: z.ZodNumber;
|
|
206
|
+
width: z.ZodNumber;
|
|
207
|
+
height: z.ZodNumber;
|
|
208
|
+
id: z.ZodString;
|
|
209
|
+
projectId: z.ZodString;
|
|
210
|
+
name: z.ZodString;
|
|
211
|
+
viewUrl: z.ZodString;
|
|
212
|
+
contentRevision: z.ZodNumber;
|
|
213
|
+
createdAt: z.ZodString;
|
|
214
|
+
updatedAt: z.ZodString;
|
|
215
|
+
type: z.ZodLiteral<"market">;
|
|
216
|
+
market: z.ZodObject<{
|
|
217
|
+
name: z.ZodString;
|
|
218
|
+
version: z.ZodString;
|
|
219
|
+
previewUrl: z.ZodString;
|
|
220
|
+
files: z.ZodArray<z.ZodObject<{
|
|
221
|
+
path: z.ZodString;
|
|
222
|
+
url: z.ZodString;
|
|
223
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
224
|
+
}, z.core.$strict>>;
|
|
225
|
+
}, z.core.$strict>;
|
|
226
|
+
}, z.core.$strict>], "type">;
|
|
227
|
+
export declare const projectStateSchema: z.ZodObject<{
|
|
228
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
229
|
+
projectId: z.ZodString;
|
|
230
|
+
revision: z.ZodNumber;
|
|
231
|
+
frames: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
232
|
+
x: z.ZodNumber;
|
|
233
|
+
y: z.ZodNumber;
|
|
234
|
+
width: z.ZodNumber;
|
|
235
|
+
height: z.ZodNumber;
|
|
236
|
+
id: z.ZodString;
|
|
237
|
+
projectId: z.ZodString;
|
|
238
|
+
name: z.ZodString;
|
|
239
|
+
viewUrl: z.ZodString;
|
|
240
|
+
contentRevision: z.ZodNumber;
|
|
241
|
+
createdAt: z.ZodString;
|
|
242
|
+
updatedAt: z.ZodString;
|
|
243
|
+
type: z.ZodLiteral<"glts">;
|
|
244
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
245
|
+
position: z.ZodObject<{
|
|
246
|
+
x: z.ZodNumber;
|
|
247
|
+
y: z.ZodNumber;
|
|
248
|
+
z: z.ZodNumber;
|
|
249
|
+
}, z.core.$strict>;
|
|
250
|
+
quaternion: z.ZodObject<{
|
|
251
|
+
x: z.ZodNumber;
|
|
252
|
+
y: z.ZodNumber;
|
|
253
|
+
z: z.ZodNumber;
|
|
254
|
+
w: z.ZodNumber;
|
|
255
|
+
}, z.core.$strict>;
|
|
256
|
+
}, z.core.$strict>>;
|
|
257
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
258
|
+
x: z.ZodNumber;
|
|
259
|
+
y: z.ZodNumber;
|
|
260
|
+
width: z.ZodNumber;
|
|
261
|
+
height: z.ZodNumber;
|
|
262
|
+
id: z.ZodString;
|
|
263
|
+
projectId: z.ZodString;
|
|
264
|
+
name: z.ZodString;
|
|
265
|
+
viewUrl: z.ZodString;
|
|
266
|
+
contentRevision: z.ZodNumber;
|
|
267
|
+
createdAt: z.ZodString;
|
|
268
|
+
updatedAt: z.ZodString;
|
|
269
|
+
type: z.ZodLiteral<"image">;
|
|
270
|
+
image: z.ZodObject<{
|
|
271
|
+
path: z.ZodString;
|
|
272
|
+
mediaType: z.ZodEnum<{
|
|
273
|
+
"image/png": "image/png";
|
|
274
|
+
"image/jpeg": "image/jpeg";
|
|
275
|
+
"image/webp": "image/webp";
|
|
276
|
+
}>;
|
|
277
|
+
}, z.core.$strict>;
|
|
278
|
+
provenance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
279
|
+
kind: z.ZodLiteral<"generated">;
|
|
280
|
+
operation: z.ZodEnum<{
|
|
281
|
+
generate: "generate";
|
|
282
|
+
edit: "edit";
|
|
283
|
+
}>;
|
|
284
|
+
prompt: z.ZodString;
|
|
285
|
+
references: z.ZodArray<z.ZodObject<{
|
|
286
|
+
frameId: z.ZodString;
|
|
287
|
+
frameUpdatedAt: z.ZodString;
|
|
288
|
+
}, z.core.$strip>>;
|
|
289
|
+
result: z.ZodEnum<{
|
|
290
|
+
replace: "replace";
|
|
291
|
+
new: "new";
|
|
292
|
+
}>;
|
|
293
|
+
provider: z.ZodLiteral<"fal-ai">;
|
|
294
|
+
model: z.ZodLiteral<"openai/gpt-image-2">;
|
|
295
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
296
|
+
kind: z.ZodLiteral<"generated">;
|
|
297
|
+
operation: z.ZodEnum<{
|
|
298
|
+
generate: "generate";
|
|
299
|
+
edit: "edit";
|
|
300
|
+
}>;
|
|
301
|
+
prompt: z.ZodString;
|
|
302
|
+
references: z.ZodArray<z.ZodObject<{
|
|
303
|
+
frameId: z.ZodString;
|
|
304
|
+
frameUpdatedAt: z.ZodString;
|
|
305
|
+
}, z.core.$strip>>;
|
|
306
|
+
result: z.ZodEnum<{
|
|
307
|
+
replace: "replace";
|
|
308
|
+
new: "new";
|
|
309
|
+
}>;
|
|
310
|
+
provider: z.ZodLiteral<"cloudflare-workers-ai">;
|
|
311
|
+
model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
|
|
312
|
+
}, z.core.$strip>], "provider">>;
|
|
313
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
314
|
+
x: z.ZodNumber;
|
|
315
|
+
y: z.ZodNumber;
|
|
316
|
+
width: z.ZodNumber;
|
|
317
|
+
height: z.ZodNumber;
|
|
318
|
+
id: z.ZodString;
|
|
319
|
+
projectId: z.ZodString;
|
|
320
|
+
name: z.ZodString;
|
|
321
|
+
viewUrl: z.ZodString;
|
|
322
|
+
contentRevision: z.ZodNumber;
|
|
323
|
+
createdAt: z.ZodString;
|
|
324
|
+
updatedAt: z.ZodString;
|
|
325
|
+
type: z.ZodLiteral<"market">;
|
|
326
|
+
market: z.ZodObject<{
|
|
327
|
+
name: z.ZodString;
|
|
328
|
+
version: z.ZodString;
|
|
329
|
+
previewUrl: z.ZodString;
|
|
330
|
+
files: z.ZodArray<z.ZodObject<{
|
|
331
|
+
path: z.ZodString;
|
|
332
|
+
url: z.ZodString;
|
|
333
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
334
|
+
}, z.core.$strict>>;
|
|
335
|
+
}, z.core.$strict>;
|
|
336
|
+
}, z.core.$strict>], "type">>;
|
|
337
|
+
fileRevisions: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
338
|
+
}, z.core.$strict>;
|
|
339
|
+
export declare const projectPresenceClientMessageSchema: z.ZodObject<{
|
|
340
|
+
type: z.ZodLiteral<"presence:update">;
|
|
341
|
+
cursor: z.ZodNullable<z.ZodObject<{
|
|
342
|
+
x: z.ZodNumber;
|
|
343
|
+
y: z.ZodNumber;
|
|
344
|
+
}, z.core.$strict>>;
|
|
345
|
+
}, z.core.$strict>;
|
|
346
|
+
export declare const projectPresenceServerMessageSchema: z.ZodObject<{
|
|
347
|
+
type: z.ZodLiteral<"presence">;
|
|
348
|
+
collaborators: z.ZodArray<z.ZodObject<{
|
|
349
|
+
connectionId: z.ZodString;
|
|
350
|
+
user: z.ZodObject<{
|
|
351
|
+
id: z.ZodString;
|
|
352
|
+
name: z.ZodString;
|
|
353
|
+
color: z.ZodString;
|
|
354
|
+
}, z.core.$strict>;
|
|
355
|
+
cursor: z.ZodOptional<z.ZodObject<{
|
|
356
|
+
x: z.ZodNumber;
|
|
357
|
+
y: z.ZodNumber;
|
|
358
|
+
}, z.core.$strict>>;
|
|
359
|
+
}, z.core.$strict>>;
|
|
360
|
+
}, z.core.$strict>;
|
|
361
|
+
export type ProjectPresenceClientMessage = z.infer<typeof projectPresenceClientMessageSchema>;
|
|
362
|
+
export type ProjectPresenceServerMessage = z.infer<typeof projectPresenceServerMessageSchema>;
|
|
363
|
+
export type ProjectFrameLayout = z.infer<typeof projectFrameLayoutSchema>;
|
|
364
|
+
export type ProjectGltsFrameRecord = z.infer<typeof projectGltsFrameRecordSchema>;
|
|
365
|
+
export type ProjectImageFrameRecord = z.infer<typeof projectImageFrameRecordSchema>;
|
|
366
|
+
export type ProjectMarketFile = z.infer<typeof projectMarketFileSchema>;
|
|
367
|
+
export type ProjectMarketFrameRecord = z.infer<typeof projectMarketFrameRecordSchema>;
|
|
368
|
+
export type ProjectFrameRecord = z.infer<typeof projectFrameRecordSchema>;
|
|
369
|
+
export type ProjectState = z.infer<typeof projectStateSchema>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { cameraPoseSchema, designIdSchema, frameNameSchema, framePositionSchema, frameSizeSchema, httpUrlSchema, imageGenerationProvenanceSchema, marketAssetNameSchema, marketAssetVersionSchema, projectPathSchema, } from "./v1/schemas.js";
|
|
3
|
+
export const projectFrameLayoutSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
x: framePositionSchema,
|
|
6
|
+
y: framePositionSchema,
|
|
7
|
+
width: frameSizeSchema,
|
|
8
|
+
height: frameSizeSchema,
|
|
9
|
+
})
|
|
10
|
+
.strict();
|
|
11
|
+
const relativeAssetPathSchema = z
|
|
12
|
+
.string()
|
|
13
|
+
.max(1_024)
|
|
14
|
+
.refine((path) => !path.startsWith("/") &&
|
|
15
|
+
!path.endsWith("/") &&
|
|
16
|
+
!path.includes("\\") &&
|
|
17
|
+
!path.includes("\0") &&
|
|
18
|
+
path
|
|
19
|
+
.split("/")
|
|
20
|
+
.every((segment) => segment.length > 0 && segment !== "." && segment !== ".."), "Asset paths must be relative and cannot contain empty, . or .. segments");
|
|
21
|
+
const projectFrameRecordBaseSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
id: designIdSchema,
|
|
24
|
+
projectId: designIdSchema,
|
|
25
|
+
name: frameNameSchema,
|
|
26
|
+
viewUrl: httpUrlSchema,
|
|
27
|
+
contentRevision: z.number().int().nonnegative(),
|
|
28
|
+
createdAt: z.string().datetime(),
|
|
29
|
+
updatedAt: z.string().datetime(),
|
|
30
|
+
...projectFrameLayoutSchema.shape,
|
|
31
|
+
})
|
|
32
|
+
.strict();
|
|
33
|
+
export const projectGltsFrameRecordSchema = projectFrameRecordBaseSchema
|
|
34
|
+
.extend({
|
|
35
|
+
type: z.literal("glts"),
|
|
36
|
+
camera: cameraPoseSchema.optional(),
|
|
37
|
+
})
|
|
38
|
+
.strict();
|
|
39
|
+
export const projectImageFrameRecordSchema = projectFrameRecordBaseSchema
|
|
40
|
+
.extend({
|
|
41
|
+
type: z.literal("image"),
|
|
42
|
+
image: z
|
|
43
|
+
.object({
|
|
44
|
+
path: relativeAssetPathSchema,
|
|
45
|
+
mediaType: z.enum(["image/jpeg", "image/png", "image/webp"]),
|
|
46
|
+
})
|
|
47
|
+
.strict(),
|
|
48
|
+
provenance: imageGenerationProvenanceSchema.optional(),
|
|
49
|
+
})
|
|
50
|
+
.strict();
|
|
51
|
+
export const projectMarketFileSchema = z
|
|
52
|
+
.object({
|
|
53
|
+
path: relativeAssetPathSchema,
|
|
54
|
+
url: httpUrlSchema,
|
|
55
|
+
mediaType: z.string().min(1).optional(),
|
|
56
|
+
})
|
|
57
|
+
.strict();
|
|
58
|
+
export const projectMarketFrameRecordSchema = projectFrameRecordBaseSchema
|
|
59
|
+
.extend({
|
|
60
|
+
type: z.literal("market"),
|
|
61
|
+
market: z
|
|
62
|
+
.object({
|
|
63
|
+
name: marketAssetNameSchema,
|
|
64
|
+
version: marketAssetVersionSchema,
|
|
65
|
+
previewUrl: httpUrlSchema,
|
|
66
|
+
files: z.array(projectMarketFileSchema),
|
|
67
|
+
})
|
|
68
|
+
.strict(),
|
|
69
|
+
})
|
|
70
|
+
.strict();
|
|
71
|
+
export const projectFrameRecordSchema = z.discriminatedUnion("type", [
|
|
72
|
+
projectGltsFrameRecordSchema,
|
|
73
|
+
projectImageFrameRecordSchema,
|
|
74
|
+
projectMarketFrameRecordSchema,
|
|
75
|
+
]);
|
|
76
|
+
export const projectStateSchema = z
|
|
77
|
+
.object({
|
|
78
|
+
schemaVersion: z.literal(1),
|
|
79
|
+
projectId: designIdSchema,
|
|
80
|
+
revision: z.number().int().nonnegative(),
|
|
81
|
+
frames: z.array(projectFrameRecordSchema),
|
|
82
|
+
fileRevisions: z.record(projectPathSchema, z.number().int().nonnegative()),
|
|
83
|
+
})
|
|
84
|
+
.strict();
|
|
85
|
+
const cursorSchema = z
|
|
86
|
+
.object({ x: z.number().finite(), y: z.number().finite() })
|
|
87
|
+
.strict();
|
|
88
|
+
export const projectPresenceClientMessageSchema = z
|
|
89
|
+
.object({
|
|
90
|
+
type: z.literal("presence:update"),
|
|
91
|
+
cursor: cursorSchema.nullable(),
|
|
92
|
+
})
|
|
93
|
+
.strict();
|
|
94
|
+
const projectCollaboratorSchema = z
|
|
95
|
+
.object({
|
|
96
|
+
connectionId: z.string().min(1),
|
|
97
|
+
user: z
|
|
98
|
+
.object({
|
|
99
|
+
id: z.string().min(1),
|
|
100
|
+
name: z.string(),
|
|
101
|
+
color: z.string().min(1),
|
|
102
|
+
})
|
|
103
|
+
.strict(),
|
|
104
|
+
cursor: cursorSchema.optional(),
|
|
105
|
+
})
|
|
106
|
+
.strict();
|
|
107
|
+
export const projectPresenceServerMessageSchema = z
|
|
108
|
+
.object({
|
|
109
|
+
type: z.literal("presence"),
|
|
110
|
+
collaborators: z.array(projectCollaboratorSchema),
|
|
111
|
+
})
|
|
112
|
+
.strict();
|