@drawcall/design 0.5.0 → 0.5.1
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 +3 -3
- package/dist/index.js +2 -2
- package/dist/protocol.d.ts +130 -0
- package/dist/protocol.js +94 -0
- package/dist/v1/contract.d.ts +209 -0
- package/dist/v1/contract.js +19 -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,7 @@
|
|
|
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 { acknowledgesInspection, inspectionCommandSchema, inspectionFrameMessageSchema, inspectionMessageTypes, projectSyncMaps, projectSyncUrl, type InspectionAppliedMessage, type InspectionCommand, type InspectionFrameMessage, } from "./protocol.js";
|
|
7
|
-
export type { BinaryFile, CreateFrame, CreateProjectFromBrief, CreateGltsFrame, CreateImageFrame, CreateMarketFrame, GenerateImageFrame, DesignFile, FileList, FileMutation, Frame, GltsFrame, ImageFrame, ImageGenerationOperation, ImageGenerationProvenance, ImageGenerationResult, MarketFrame, Project, ProjectDerivationStatus, Screenshot, TextFile, User, } from "./v1/schemas.js";
|
|
6
|
+
export { acknowledgesInspection, cameraCaptureCommandSchema, cameraCaptureResultSchema, cameraMessageTypes, gltsExportCancelCommandSchema, gltsExportCancelledResultSchema, gltsExportCommandSchema, gltsExportFrameMessageSchema, gltsExportMessageTypes, gltsExportParentMessageSchema, gltsExportResultSchema, gltsRuntimeExportFormatSchema, inspectionCommandSchema, inspectionFrameMessageSchema, inspectionMessageTypes, projectSyncMaps, projectSyncUrl, 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, } from "./protocol.js";
|
|
7
|
+
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,6 @@
|
|
|
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 { acknowledgesInspection, inspectionCommandSchema, inspectionFrameMessageSchema, inspectionMessageTypes, projectSyncMaps, projectSyncUrl, } from "./protocol.js";
|
|
6
|
+
export { acknowledgesInspection, cameraCaptureCommandSchema, cameraCaptureResultSchema, cameraMessageTypes, gltsExportCancelCommandSchema, gltsExportCancelledResultSchema, gltsExportCommandSchema, gltsExportFrameMessageSchema, gltsExportMessageTypes, gltsExportParentMessageSchema, gltsExportResultSchema, gltsRuntimeExportFormatSchema, inspectionCommandSchema, inspectionFrameMessageSchema, inspectionMessageTypes, projectSyncMaps, projectSyncUrl, } from "./protocol.js";
|
package/dist/protocol.d.ts
CHANGED
|
@@ -11,6 +11,124 @@ export declare const inspectionMessageTypes: {
|
|
|
11
11
|
readonly ready: "drawcall:inspection:ready";
|
|
12
12
|
readonly set: "drawcall:inspection:set";
|
|
13
13
|
};
|
|
14
|
+
export declare const gltsExportMessageTypes: {
|
|
15
|
+
readonly cancel: "drawcall:export:cancel";
|
|
16
|
+
readonly cancelled: "drawcall:export:cancelled";
|
|
17
|
+
readonly request: "drawcall:export:request";
|
|
18
|
+
readonly result: "drawcall:export:result";
|
|
19
|
+
};
|
|
20
|
+
export declare const gltsRuntimeExportFormatSchema: z.ZodEnum<{
|
|
21
|
+
gltf: "gltf";
|
|
22
|
+
stl: "stl";
|
|
23
|
+
}>;
|
|
24
|
+
export declare const gltsExportCommandSchema: z.ZodObject<{
|
|
25
|
+
type: z.ZodLiteral<"drawcall:export:request">;
|
|
26
|
+
requestId: z.ZodString;
|
|
27
|
+
format: z.ZodEnum<{
|
|
28
|
+
gltf: "gltf";
|
|
29
|
+
stl: "stl";
|
|
30
|
+
}>;
|
|
31
|
+
identity: z.ZodObject<{
|
|
32
|
+
projectId: z.ZodString;
|
|
33
|
+
frameId: z.ZodString;
|
|
34
|
+
frameName: z.ZodString;
|
|
35
|
+
frameType: z.ZodLiteral<"glts">;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
export declare const gltsExportCancelCommandSchema: z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"drawcall:export:cancel">;
|
|
40
|
+
requestId: z.ZodString;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
export declare const gltsExportParentMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
43
|
+
type: z.ZodLiteral<"drawcall:export:request">;
|
|
44
|
+
requestId: z.ZodString;
|
|
45
|
+
format: z.ZodEnum<{
|
|
46
|
+
gltf: "gltf";
|
|
47
|
+
stl: "stl";
|
|
48
|
+
}>;
|
|
49
|
+
identity: z.ZodObject<{
|
|
50
|
+
projectId: z.ZodString;
|
|
51
|
+
frameId: z.ZodString;
|
|
52
|
+
frameName: z.ZodString;
|
|
53
|
+
frameType: z.ZodLiteral<"glts">;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
56
|
+
type: z.ZodLiteral<"drawcall:export:cancel">;
|
|
57
|
+
requestId: z.ZodString;
|
|
58
|
+
}, z.core.$strict>]>;
|
|
59
|
+
export declare const gltsExportResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
60
|
+
type: z.ZodLiteral<"drawcall:export:result">;
|
|
61
|
+
requestId: z.ZodString;
|
|
62
|
+
ok: z.ZodLiteral<true>;
|
|
63
|
+
format: z.ZodEnum<{
|
|
64
|
+
gltf: "gltf";
|
|
65
|
+
stl: "stl";
|
|
66
|
+
}>;
|
|
67
|
+
bytes: z.ZodCustom<ArrayBuffer, ArrayBuffer>;
|
|
68
|
+
mediaType: z.ZodString;
|
|
69
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
70
|
+
type: z.ZodLiteral<"drawcall:export:result">;
|
|
71
|
+
requestId: z.ZodString;
|
|
72
|
+
ok: z.ZodLiteral<false>;
|
|
73
|
+
error: z.ZodString;
|
|
74
|
+
}, z.core.$strict>], "ok">;
|
|
75
|
+
export declare const gltsExportCancelledResultSchema: z.ZodObject<{
|
|
76
|
+
type: z.ZodLiteral<"drawcall:export:cancelled">;
|
|
77
|
+
requestId: z.ZodString;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
export declare const gltsExportFrameMessageSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
80
|
+
type: z.ZodLiteral<"drawcall:export:result">;
|
|
81
|
+
requestId: z.ZodString;
|
|
82
|
+
ok: z.ZodLiteral<true>;
|
|
83
|
+
format: z.ZodEnum<{
|
|
84
|
+
gltf: "gltf";
|
|
85
|
+
stl: "stl";
|
|
86
|
+
}>;
|
|
87
|
+
bytes: z.ZodCustom<ArrayBuffer, ArrayBuffer>;
|
|
88
|
+
mediaType: z.ZodString;
|
|
89
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
90
|
+
type: z.ZodLiteral<"drawcall:export:result">;
|
|
91
|
+
requestId: z.ZodString;
|
|
92
|
+
ok: z.ZodLiteral<false>;
|
|
93
|
+
error: z.ZodString;
|
|
94
|
+
}, z.core.$strict>], "ok">, z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"drawcall:export:cancelled">;
|
|
96
|
+
requestId: z.ZodString;
|
|
97
|
+
}, z.core.$strict>]>;
|
|
98
|
+
export declare const cameraMessageTypes: {
|
|
99
|
+
readonly capture: "drawcall:camera:capture";
|
|
100
|
+
readonly captured: "drawcall:camera:captured";
|
|
101
|
+
readonly unavailable: "drawcall:camera:unavailable";
|
|
102
|
+
};
|
|
103
|
+
export declare const cameraCaptureCommandSchema: z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"drawcall:camera:capture">;
|
|
105
|
+
requestId: z.ZodString;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
export declare const cameraCaptureResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
108
|
+
type: z.ZodLiteral<"drawcall:camera:captured">;
|
|
109
|
+
requestId: z.ZodString;
|
|
110
|
+
camera: z.ZodObject<{
|
|
111
|
+
position: z.ZodObject<{
|
|
112
|
+
x: z.ZodNumber;
|
|
113
|
+
y: z.ZodNumber;
|
|
114
|
+
z: z.ZodNumber;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
quaternion: z.ZodObject<{
|
|
117
|
+
x: z.ZodNumber;
|
|
118
|
+
y: z.ZodNumber;
|
|
119
|
+
z: z.ZodNumber;
|
|
120
|
+
w: z.ZodNumber;
|
|
121
|
+
}, z.core.$strict>;
|
|
122
|
+
}, z.core.$strict>;
|
|
123
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
124
|
+
type: z.ZodLiteral<"drawcall:camera:unavailable">;
|
|
125
|
+
requestId: z.ZodString;
|
|
126
|
+
reason: z.ZodEnum<{
|
|
127
|
+
"immersive-active": "immersive-active";
|
|
128
|
+
"not-inspecting": "not-inspecting";
|
|
129
|
+
"runtime-unavailable": "runtime-unavailable";
|
|
130
|
+
}>;
|
|
131
|
+
}, z.core.$strict>], "type">;
|
|
14
132
|
export declare const inspectionCommandSchema: z.ZodObject<{
|
|
15
133
|
type: z.ZodLiteral<"drawcall:inspection:set">;
|
|
16
134
|
requestId: z.ZodString;
|
|
@@ -28,9 +146,21 @@ export declare const inspectionFrameMessageSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
28
146
|
type: z.ZodLiteral<"drawcall:inspection:exit">;
|
|
29
147
|
}, z.core.$strict>], "type">;
|
|
30
148
|
export type InspectionCommand = z.infer<typeof inspectionCommandSchema>;
|
|
149
|
+
export type CameraCaptureCommand = z.infer<typeof cameraCaptureCommandSchema>;
|
|
150
|
+
export type CameraCaptureResult = z.infer<typeof cameraCaptureResultSchema>;
|
|
151
|
+
export type CameraCaptureFailure = Extract<CameraCaptureResult, {
|
|
152
|
+
type: typeof cameraMessageTypes.unavailable;
|
|
153
|
+
}>;
|
|
31
154
|
export type InspectionFrameMessage = z.infer<typeof inspectionFrameMessageSchema>;
|
|
32
155
|
export type InspectionAppliedMessage = Extract<InspectionFrameMessage, {
|
|
33
156
|
type: typeof inspectionMessageTypes.applied;
|
|
34
157
|
}>;
|
|
158
|
+
export type GltsRuntimeExportFormat = z.infer<typeof gltsRuntimeExportFormatSchema>;
|
|
159
|
+
export type GltsExportCommand = z.infer<typeof gltsExportCommandSchema>;
|
|
160
|
+
export type GltsExportCancelCommand = z.infer<typeof gltsExportCancelCommandSchema>;
|
|
161
|
+
export type GltsExportParentMessage = z.infer<typeof gltsExportParentMessageSchema>;
|
|
162
|
+
export type GltsExportResult = z.infer<typeof gltsExportResultSchema>;
|
|
163
|
+
export type GltsExportCancelledResult = z.infer<typeof gltsExportCancelledResultSchema>;
|
|
164
|
+
export type GltsExportFrameMessage = z.infer<typeof gltsExportFrameMessageSchema>;
|
|
35
165
|
export declare function acknowledgesInspection(command: InspectionCommand | null, message: InspectionAppliedMessage): boolean;
|
|
36
166
|
export declare function projectSyncUrl(baseUrl: string, project: string): string;
|
package/dist/protocol.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { cameraPoseSchema } from "./v1/schemas.js";
|
|
2
3
|
export const projectSyncMaps = {
|
|
3
4
|
frameContentRevisions: "frame-content-revisions",
|
|
4
5
|
filesystemRevision: "filesystem-revision",
|
|
@@ -11,6 +12,99 @@ export const inspectionMessageTypes = {
|
|
|
11
12
|
ready: "drawcall:inspection:ready",
|
|
12
13
|
set: "drawcall:inspection:set",
|
|
13
14
|
};
|
|
15
|
+
export const gltsExportMessageTypes = {
|
|
16
|
+
cancel: "drawcall:export:cancel",
|
|
17
|
+
cancelled: "drawcall:export:cancelled",
|
|
18
|
+
request: "drawcall:export:request",
|
|
19
|
+
result: "drawcall:export:result",
|
|
20
|
+
};
|
|
21
|
+
export const gltsRuntimeExportFormatSchema = z.enum(["gltf", "stl"]);
|
|
22
|
+
export const gltsExportCommandSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
type: z.literal(gltsExportMessageTypes.request),
|
|
25
|
+
requestId: z.string().min(1),
|
|
26
|
+
format: gltsRuntimeExportFormatSchema,
|
|
27
|
+
identity: z
|
|
28
|
+
.object({
|
|
29
|
+
projectId: z.string().regex(/^[a-z0-9]{14}$/),
|
|
30
|
+
frameId: z.string().regex(/^[a-z0-9]{14}$/),
|
|
31
|
+
frameName: z.string().min(1).max(80),
|
|
32
|
+
frameType: z.literal("glts"),
|
|
33
|
+
})
|
|
34
|
+
.strict(),
|
|
35
|
+
})
|
|
36
|
+
.strict();
|
|
37
|
+
export const gltsExportCancelCommandSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
type: z.literal(gltsExportMessageTypes.cancel),
|
|
40
|
+
requestId: z.string().min(1),
|
|
41
|
+
})
|
|
42
|
+
.strict();
|
|
43
|
+
export const gltsExportParentMessageSchema = z.union([
|
|
44
|
+
gltsExportCommandSchema,
|
|
45
|
+
gltsExportCancelCommandSchema,
|
|
46
|
+
]);
|
|
47
|
+
const gltsExportResultBaseSchema = z.object({
|
|
48
|
+
type: z.literal(gltsExportMessageTypes.result),
|
|
49
|
+
requestId: z.string().min(1),
|
|
50
|
+
});
|
|
51
|
+
export const gltsExportResultSchema = z.discriminatedUnion("ok", [
|
|
52
|
+
gltsExportResultBaseSchema
|
|
53
|
+
.extend({
|
|
54
|
+
ok: z.literal(true),
|
|
55
|
+
format: gltsRuntimeExportFormatSchema,
|
|
56
|
+
bytes: z.instanceof(ArrayBuffer),
|
|
57
|
+
mediaType: z.string().min(1),
|
|
58
|
+
})
|
|
59
|
+
.strict(),
|
|
60
|
+
gltsExportResultBaseSchema
|
|
61
|
+
.extend({
|
|
62
|
+
ok: z.literal(false),
|
|
63
|
+
error: z.string().min(1),
|
|
64
|
+
})
|
|
65
|
+
.strict(),
|
|
66
|
+
]);
|
|
67
|
+
export const gltsExportCancelledResultSchema = z
|
|
68
|
+
.object({
|
|
69
|
+
type: z.literal(gltsExportMessageTypes.cancelled),
|
|
70
|
+
requestId: z.string().min(1),
|
|
71
|
+
})
|
|
72
|
+
.strict();
|
|
73
|
+
export const gltsExportFrameMessageSchema = z.union([
|
|
74
|
+
gltsExportResultSchema,
|
|
75
|
+
gltsExportCancelledResultSchema,
|
|
76
|
+
]);
|
|
77
|
+
export const cameraMessageTypes = {
|
|
78
|
+
capture: "drawcall:camera:capture",
|
|
79
|
+
captured: "drawcall:camera:captured",
|
|
80
|
+
unavailable: "drawcall:camera:unavailable",
|
|
81
|
+
};
|
|
82
|
+
export const cameraCaptureCommandSchema = z
|
|
83
|
+
.object({
|
|
84
|
+
type: z.literal(cameraMessageTypes.capture),
|
|
85
|
+
requestId: z.string().min(1),
|
|
86
|
+
})
|
|
87
|
+
.strict();
|
|
88
|
+
export const cameraCaptureResultSchema = z.discriminatedUnion("type", [
|
|
89
|
+
z
|
|
90
|
+
.object({
|
|
91
|
+
type: z.literal(cameraMessageTypes.captured),
|
|
92
|
+
requestId: z.string().min(1),
|
|
93
|
+
camera: cameraPoseSchema,
|
|
94
|
+
})
|
|
95
|
+
.strict(),
|
|
96
|
+
z
|
|
97
|
+
.object({
|
|
98
|
+
type: z.literal(cameraMessageTypes.unavailable),
|
|
99
|
+
requestId: z.string().min(1),
|
|
100
|
+
reason: z.enum([
|
|
101
|
+
"immersive-active",
|
|
102
|
+
"not-inspecting",
|
|
103
|
+
"runtime-unavailable",
|
|
104
|
+
]),
|
|
105
|
+
})
|
|
106
|
+
.strict(),
|
|
107
|
+
]);
|
|
14
108
|
export const inspectionCommandSchema = z
|
|
15
109
|
.object({
|
|
16
110
|
type: z.literal(inspectionMessageTypes.set),
|
package/dist/v1/contract.d.ts
CHANGED
|
@@ -115,6 +115,20 @@ export declare const contract: {
|
|
|
115
115
|
createdAt: z.ZodString;
|
|
116
116
|
updatedAt: z.ZodString;
|
|
117
117
|
type: z.ZodLiteral<"glts">;
|
|
118
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
position: z.ZodObject<{
|
|
120
|
+
x: z.ZodNumber;
|
|
121
|
+
y: z.ZodNumber;
|
|
122
|
+
z: z.ZodNumber;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
quaternion: z.ZodObject<{
|
|
125
|
+
x: z.ZodNumber;
|
|
126
|
+
y: z.ZodNumber;
|
|
127
|
+
z: z.ZodNumber;
|
|
128
|
+
w: z.ZodNumber;
|
|
129
|
+
}, z.core.$strict>;
|
|
130
|
+
}, z.core.$strict>>;
|
|
131
|
+
contentRevision: z.ZodNumber;
|
|
118
132
|
}, z.core.$strip>, z.ZodObject<{
|
|
119
133
|
id: z.ZodString;
|
|
120
134
|
projectId: z.ZodString;
|
|
@@ -211,6 +225,20 @@ export declare const contract: {
|
|
|
211
225
|
createdAt: z.ZodString;
|
|
212
226
|
updatedAt: z.ZodString;
|
|
213
227
|
type: z.ZodLiteral<"glts">;
|
|
228
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
position: z.ZodObject<{
|
|
230
|
+
x: z.ZodNumber;
|
|
231
|
+
y: z.ZodNumber;
|
|
232
|
+
z: z.ZodNumber;
|
|
233
|
+
}, z.core.$strict>;
|
|
234
|
+
quaternion: z.ZodObject<{
|
|
235
|
+
x: z.ZodNumber;
|
|
236
|
+
y: z.ZodNumber;
|
|
237
|
+
z: z.ZodNumber;
|
|
238
|
+
w: z.ZodNumber;
|
|
239
|
+
}, z.core.$strict>;
|
|
240
|
+
}, z.core.$strict>>;
|
|
241
|
+
contentRevision: z.ZodNumber;
|
|
214
242
|
}, z.core.$strip>, z.ZodObject<{
|
|
215
243
|
id: z.ZodString;
|
|
216
244
|
projectId: z.ZodString;
|
|
@@ -301,6 +329,20 @@ export declare const contract: {
|
|
|
301
329
|
createdAt: z.ZodString;
|
|
302
330
|
updatedAt: z.ZodString;
|
|
303
331
|
type: z.ZodLiteral<"glts">;
|
|
332
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
333
|
+
position: z.ZodObject<{
|
|
334
|
+
x: z.ZodNumber;
|
|
335
|
+
y: z.ZodNumber;
|
|
336
|
+
z: z.ZodNumber;
|
|
337
|
+
}, z.core.$strict>;
|
|
338
|
+
quaternion: z.ZodObject<{
|
|
339
|
+
x: z.ZodNumber;
|
|
340
|
+
y: z.ZodNumber;
|
|
341
|
+
z: z.ZodNumber;
|
|
342
|
+
w: z.ZodNumber;
|
|
343
|
+
}, z.core.$strict>;
|
|
344
|
+
}, z.core.$strict>>;
|
|
345
|
+
contentRevision: z.ZodNumber;
|
|
304
346
|
}, z.core.$strip>, z.ZodObject<{
|
|
305
347
|
id: z.ZodString;
|
|
306
348
|
projectId: z.ZodString;
|
|
@@ -379,6 +421,126 @@ export declare const contract: {
|
|
|
379
421
|
createdAt: z.ZodString;
|
|
380
422
|
updatedAt: z.ZodString;
|
|
381
423
|
type: z.ZodLiteral<"glts">;
|
|
424
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
425
|
+
position: z.ZodObject<{
|
|
426
|
+
x: z.ZodNumber;
|
|
427
|
+
y: z.ZodNumber;
|
|
428
|
+
z: z.ZodNumber;
|
|
429
|
+
}, z.core.$strict>;
|
|
430
|
+
quaternion: z.ZodObject<{
|
|
431
|
+
x: z.ZodNumber;
|
|
432
|
+
y: z.ZodNumber;
|
|
433
|
+
z: z.ZodNumber;
|
|
434
|
+
w: z.ZodNumber;
|
|
435
|
+
}, z.core.$strict>;
|
|
436
|
+
}, z.core.$strict>>;
|
|
437
|
+
contentRevision: z.ZodNumber;
|
|
438
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
439
|
+
id: z.ZodString;
|
|
440
|
+
projectId: z.ZodString;
|
|
441
|
+
name: z.ZodString;
|
|
442
|
+
x: z.ZodNumber;
|
|
443
|
+
y: z.ZodNumber;
|
|
444
|
+
width: z.ZodNumber;
|
|
445
|
+
height: z.ZodNumber;
|
|
446
|
+
viewUrl: z.ZodString;
|
|
447
|
+
createdAt: z.ZodString;
|
|
448
|
+
updatedAt: z.ZodString;
|
|
449
|
+
type: z.ZodLiteral<"image">;
|
|
450
|
+
file: z.ZodString;
|
|
451
|
+
provenance: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
452
|
+
kind: z.ZodLiteral<"generated">;
|
|
453
|
+
operation: z.ZodEnum<{
|
|
454
|
+
generate: "generate";
|
|
455
|
+
edit: "edit";
|
|
456
|
+
}>;
|
|
457
|
+
prompt: z.ZodString;
|
|
458
|
+
references: z.ZodArray<z.ZodObject<{
|
|
459
|
+
frameId: z.ZodString;
|
|
460
|
+
frameUpdatedAt: z.ZodString;
|
|
461
|
+
}, z.core.$strip>>;
|
|
462
|
+
result: z.ZodEnum<{
|
|
463
|
+
replace: "replace";
|
|
464
|
+
new: "new";
|
|
465
|
+
}>;
|
|
466
|
+
provider: z.ZodLiteral<"fal-ai">;
|
|
467
|
+
model: z.ZodLiteral<"openai/gpt-image-2">;
|
|
468
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
469
|
+
kind: z.ZodLiteral<"generated">;
|
|
470
|
+
operation: z.ZodEnum<{
|
|
471
|
+
generate: "generate";
|
|
472
|
+
edit: "edit";
|
|
473
|
+
}>;
|
|
474
|
+
prompt: z.ZodString;
|
|
475
|
+
references: z.ZodArray<z.ZodObject<{
|
|
476
|
+
frameId: z.ZodString;
|
|
477
|
+
frameUpdatedAt: z.ZodString;
|
|
478
|
+
}, z.core.$strip>>;
|
|
479
|
+
result: z.ZodEnum<{
|
|
480
|
+
replace: "replace";
|
|
481
|
+
new: "new";
|
|
482
|
+
}>;
|
|
483
|
+
provider: z.ZodLiteral<"cloudflare-workers-ai">;
|
|
484
|
+
model: z.ZodLiteral<"@cf/black-forest-labs/flux-2-klein-4b">;
|
|
485
|
+
}, z.core.$strip>], "provider">>;
|
|
486
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
487
|
+
id: z.ZodString;
|
|
488
|
+
projectId: z.ZodString;
|
|
489
|
+
name: z.ZodString;
|
|
490
|
+
x: z.ZodNumber;
|
|
491
|
+
y: z.ZodNumber;
|
|
492
|
+
width: z.ZodNumber;
|
|
493
|
+
height: z.ZodNumber;
|
|
494
|
+
viewUrl: z.ZodString;
|
|
495
|
+
createdAt: z.ZodString;
|
|
496
|
+
updatedAt: z.ZodString;
|
|
497
|
+
type: z.ZodLiteral<"market">;
|
|
498
|
+
asset: z.ZodString;
|
|
499
|
+
}, z.core.$strip>], "type">, Record<never, never>, Record<never, never>>;
|
|
500
|
+
setCamera: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
501
|
+
project: z.ZodString;
|
|
502
|
+
frame: z.ZodString;
|
|
503
|
+
camera: z.ZodObject<{
|
|
504
|
+
position: z.ZodObject<{
|
|
505
|
+
x: z.ZodNumber;
|
|
506
|
+
y: z.ZodNumber;
|
|
507
|
+
z: z.ZodNumber;
|
|
508
|
+
}, z.core.$strict>;
|
|
509
|
+
quaternion: z.ZodObject<{
|
|
510
|
+
x: z.ZodNumber;
|
|
511
|
+
y: z.ZodNumber;
|
|
512
|
+
z: z.ZodNumber;
|
|
513
|
+
w: z.ZodNumber;
|
|
514
|
+
}, z.core.$strict>;
|
|
515
|
+
}, z.core.$strict>;
|
|
516
|
+
expectedContentRevision: z.ZodNumber;
|
|
517
|
+
expectedUpdatedAt: z.ZodString;
|
|
518
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
519
|
+
id: z.ZodString;
|
|
520
|
+
projectId: z.ZodString;
|
|
521
|
+
name: z.ZodString;
|
|
522
|
+
x: z.ZodNumber;
|
|
523
|
+
y: z.ZodNumber;
|
|
524
|
+
width: z.ZodNumber;
|
|
525
|
+
height: z.ZodNumber;
|
|
526
|
+
viewUrl: z.ZodString;
|
|
527
|
+
createdAt: z.ZodString;
|
|
528
|
+
updatedAt: z.ZodString;
|
|
529
|
+
type: z.ZodLiteral<"glts">;
|
|
530
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
531
|
+
position: z.ZodObject<{
|
|
532
|
+
x: z.ZodNumber;
|
|
533
|
+
y: z.ZodNumber;
|
|
534
|
+
z: z.ZodNumber;
|
|
535
|
+
}, z.core.$strict>;
|
|
536
|
+
quaternion: z.ZodObject<{
|
|
537
|
+
x: z.ZodNumber;
|
|
538
|
+
y: z.ZodNumber;
|
|
539
|
+
z: z.ZodNumber;
|
|
540
|
+
w: z.ZodNumber;
|
|
541
|
+
}, z.core.$strict>;
|
|
542
|
+
}, z.core.$strict>>;
|
|
543
|
+
contentRevision: z.ZodNumber;
|
|
382
544
|
}, z.core.$strip>, z.ZodObject<{
|
|
383
545
|
id: z.ZodString;
|
|
384
546
|
projectId: z.ZodString;
|
|
@@ -456,6 +618,53 @@ export declare const contract: {
|
|
|
456
618
|
height: z.ZodNumber;
|
|
457
619
|
mediaType: z.ZodLiteral<"image/png">;
|
|
458
620
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
621
|
+
prepareExport: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
622
|
+
project: z.ZodString;
|
|
623
|
+
frame: z.ZodString;
|
|
624
|
+
}, z.core.$strip>, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
625
|
+
frameId: z.ZodString;
|
|
626
|
+
frameName: z.ZodString;
|
|
627
|
+
projectId: z.ZodString;
|
|
628
|
+
type: z.ZodLiteral<"glts">;
|
|
629
|
+
runtime: z.ZodObject<{
|
|
630
|
+
gltf: z.ZodObject<{
|
|
631
|
+
filename: z.ZodString;
|
|
632
|
+
}, z.core.$strip>;
|
|
633
|
+
stl: z.ZodObject<{
|
|
634
|
+
filename: z.ZodString;
|
|
635
|
+
}, z.core.$strip>;
|
|
636
|
+
}, z.core.$strip>;
|
|
637
|
+
sourceArchive: z.ZodNullable<z.ZodObject<{
|
|
638
|
+
filename: z.ZodString;
|
|
639
|
+
url: z.ZodString;
|
|
640
|
+
mediaType: z.ZodLiteral<"application/zip">;
|
|
641
|
+
}, z.core.$strict>>;
|
|
642
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
643
|
+
frameId: z.ZodString;
|
|
644
|
+
frameName: z.ZodString;
|
|
645
|
+
projectId: z.ZodString;
|
|
646
|
+
type: z.ZodLiteral<"image">;
|
|
647
|
+
download: z.ZodObject<{
|
|
648
|
+
filename: z.ZodString;
|
|
649
|
+
url: z.ZodString;
|
|
650
|
+
mediaType: z.ZodEnum<{
|
|
651
|
+
"image/png": "image/png";
|
|
652
|
+
"image/jpeg": "image/jpeg";
|
|
653
|
+
"image/webp": "image/webp";
|
|
654
|
+
}>;
|
|
655
|
+
}, z.core.$strict>;
|
|
656
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
657
|
+
frameId: z.ZodString;
|
|
658
|
+
frameName: z.ZodString;
|
|
659
|
+
projectId: z.ZodString;
|
|
660
|
+
type: z.ZodLiteral<"market">;
|
|
661
|
+
asset: z.ZodString;
|
|
662
|
+
download: z.ZodObject<{
|
|
663
|
+
filename: z.ZodString;
|
|
664
|
+
url: z.ZodString;
|
|
665
|
+
mediaType: z.ZodLiteral<"application/zip">;
|
|
666
|
+
}, z.core.$strict>;
|
|
667
|
+
}, z.core.$strip>], "type">, Record<never, never>, Record<never, never>>;
|
|
459
668
|
};
|
|
460
669
|
filesystem: {
|
|
461
670
|
list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
package/dist/v1/contract.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { createFrameSchema, createProjectFromBriefSchema, designIdSchema, fileListSchema, fileMutationSchema, fileSchema, fileTextSchema, frameNameSchema, frameSchema, generateImageFrameSchema, projectDirectoryPathSchema, projectNameSchema, projectPathSchema, projectSchema, screenshotSchema, userSchema, } from "./schemas.js";
|
|
3
|
+
import { cameraPoseSchema, createFrameSchema, createProjectFromBriefSchema, designIdSchema, fileListSchema, fileMutationSchema, fileSchema, fileTextSchema, frameExportSchema, frameNameSchema, frameSchema, generateImageFrameSchema, projectDirectoryPathSchema, projectNameSchema, projectPathSchema, projectSchema, screenshotSchema, userSchema, } from "./schemas.js";
|
|
4
4
|
const projectInputSchema = z.object({ project: designIdSchema });
|
|
5
5
|
const frameInputSchema = projectInputSchema.extend({ frame: designIdSchema });
|
|
6
6
|
const fileInputSchema = projectInputSchema.extend({ path: projectPathSchema });
|
|
@@ -57,6 +57,17 @@ export const contract = {
|
|
|
57
57
|
.route({ method: "PATCH", path: "/projects/{project}/frames/{frame}" })
|
|
58
58
|
.input(frameInputSchema.extend({ name: frameNameSchema }))
|
|
59
59
|
.output(frameSchema),
|
|
60
|
+
setCamera: oc
|
|
61
|
+
.route({
|
|
62
|
+
method: "PUT",
|
|
63
|
+
path: "/projects/{project}/frames/{frame}/camera",
|
|
64
|
+
})
|
|
65
|
+
.input(frameInputSchema.extend({
|
|
66
|
+
camera: cameraPoseSchema,
|
|
67
|
+
expectedContentRevision: z.number().int().nonnegative(),
|
|
68
|
+
expectedUpdatedAt: z.string().datetime(),
|
|
69
|
+
}))
|
|
70
|
+
.output(frameSchema),
|
|
60
71
|
delete: oc
|
|
61
72
|
.route({ method: "DELETE", path: "/projects/{project}/frames/{frame}" })
|
|
62
73
|
.input(frameInputSchema)
|
|
@@ -68,6 +79,13 @@ export const contract = {
|
|
|
68
79
|
})
|
|
69
80
|
.input(frameInputSchema)
|
|
70
81
|
.output(screenshotSchema),
|
|
82
|
+
prepareExport: oc
|
|
83
|
+
.route({
|
|
84
|
+
method: "POST",
|
|
85
|
+
path: "/projects/{project}/frames/{frame}/exports",
|
|
86
|
+
})
|
|
87
|
+
.input(frameInputSchema)
|
|
88
|
+
.output(frameExportSchema),
|
|
71
89
|
},
|
|
72
90
|
filesystem: {
|
|
73
91
|
list: oc
|
package/dist/v1/schemas.d.ts
CHANGED
|
@@ -16,6 +16,19 @@ export declare const projectDerivationStatusSchema: z.ZodEnum<{
|
|
|
16
16
|
export declare const frameNameSchema: z.ZodString;
|
|
17
17
|
export declare const frameSizeSchema: z.ZodNumber;
|
|
18
18
|
export declare const framePositionSchema: z.ZodNumber;
|
|
19
|
+
export declare const cameraPoseSchema: z.ZodObject<{
|
|
20
|
+
position: z.ZodObject<{
|
|
21
|
+
x: z.ZodNumber;
|
|
22
|
+
y: z.ZodNumber;
|
|
23
|
+
z: z.ZodNumber;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
quaternion: z.ZodObject<{
|
|
26
|
+
x: z.ZodNumber;
|
|
27
|
+
y: z.ZodNumber;
|
|
28
|
+
z: z.ZodNumber;
|
|
29
|
+
w: z.ZodNumber;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
}, z.core.$strict>;
|
|
19
32
|
export declare const httpUrlSchema: z.ZodString;
|
|
20
33
|
export declare const imageUrlSchema: z.ZodString;
|
|
21
34
|
/** An absolute path in the hosted project filesystem. */
|
|
@@ -63,6 +76,20 @@ export declare const gltsFrameSchema: z.ZodObject<{
|
|
|
63
76
|
createdAt: z.ZodString;
|
|
64
77
|
updatedAt: z.ZodString;
|
|
65
78
|
type: z.ZodLiteral<"glts">;
|
|
79
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
position: z.ZodObject<{
|
|
81
|
+
x: z.ZodNumber;
|
|
82
|
+
y: z.ZodNumber;
|
|
83
|
+
z: z.ZodNumber;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
quaternion: z.ZodObject<{
|
|
86
|
+
x: z.ZodNumber;
|
|
87
|
+
y: z.ZodNumber;
|
|
88
|
+
z: z.ZodNumber;
|
|
89
|
+
w: z.ZodNumber;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
}, z.core.$strict>>;
|
|
92
|
+
contentRevision: z.ZodNumber;
|
|
66
93
|
}, z.core.$strip>;
|
|
67
94
|
export declare const imageGenerationOperationSchema: z.ZodEnum<{
|
|
68
95
|
generate: "generate";
|
|
@@ -190,6 +217,20 @@ export declare const frameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
190
217
|
createdAt: z.ZodString;
|
|
191
218
|
updatedAt: z.ZodString;
|
|
192
219
|
type: z.ZodLiteral<"glts">;
|
|
220
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
221
|
+
position: z.ZodObject<{
|
|
222
|
+
x: z.ZodNumber;
|
|
223
|
+
y: z.ZodNumber;
|
|
224
|
+
z: z.ZodNumber;
|
|
225
|
+
}, z.core.$strict>;
|
|
226
|
+
quaternion: z.ZodObject<{
|
|
227
|
+
x: z.ZodNumber;
|
|
228
|
+
y: z.ZodNumber;
|
|
229
|
+
z: z.ZodNumber;
|
|
230
|
+
w: z.ZodNumber;
|
|
231
|
+
}, z.core.$strict>;
|
|
232
|
+
}, z.core.$strict>>;
|
|
233
|
+
contentRevision: z.ZodNumber;
|
|
193
234
|
}, z.core.$strip>, z.ZodObject<{
|
|
194
235
|
id: z.ZodString;
|
|
195
236
|
projectId: z.ZodString;
|
|
@@ -352,10 +393,101 @@ export declare const screenshotSchema: z.ZodObject<{
|
|
|
352
393
|
height: z.ZodNumber;
|
|
353
394
|
mediaType: z.ZodLiteral<"image/png">;
|
|
354
395
|
}, z.core.$strip>;
|
|
396
|
+
export declare const gltsFrameExportSchema: z.ZodObject<{
|
|
397
|
+
frameId: z.ZodString;
|
|
398
|
+
frameName: z.ZodString;
|
|
399
|
+
projectId: z.ZodString;
|
|
400
|
+
type: z.ZodLiteral<"glts">;
|
|
401
|
+
runtime: z.ZodObject<{
|
|
402
|
+
gltf: z.ZodObject<{
|
|
403
|
+
filename: z.ZodString;
|
|
404
|
+
}, z.core.$strip>;
|
|
405
|
+
stl: z.ZodObject<{
|
|
406
|
+
filename: z.ZodString;
|
|
407
|
+
}, z.core.$strip>;
|
|
408
|
+
}, z.core.$strip>;
|
|
409
|
+
sourceArchive: z.ZodNullable<z.ZodObject<{
|
|
410
|
+
filename: z.ZodString;
|
|
411
|
+
url: z.ZodString;
|
|
412
|
+
mediaType: z.ZodLiteral<"application/zip">;
|
|
413
|
+
}, z.core.$strict>>;
|
|
414
|
+
}, z.core.$strip>;
|
|
415
|
+
export declare const imageFrameExportSchema: z.ZodObject<{
|
|
416
|
+
frameId: z.ZodString;
|
|
417
|
+
frameName: z.ZodString;
|
|
418
|
+
projectId: z.ZodString;
|
|
419
|
+
type: z.ZodLiteral<"image">;
|
|
420
|
+
download: z.ZodObject<{
|
|
421
|
+
filename: z.ZodString;
|
|
422
|
+
url: z.ZodString;
|
|
423
|
+
mediaType: z.ZodEnum<{
|
|
424
|
+
"image/png": "image/png";
|
|
425
|
+
"image/jpeg": "image/jpeg";
|
|
426
|
+
"image/webp": "image/webp";
|
|
427
|
+
}>;
|
|
428
|
+
}, z.core.$strict>;
|
|
429
|
+
}, z.core.$strip>;
|
|
430
|
+
export declare const marketFrameExportSchema: z.ZodObject<{
|
|
431
|
+
frameId: z.ZodString;
|
|
432
|
+
frameName: z.ZodString;
|
|
433
|
+
projectId: z.ZodString;
|
|
434
|
+
type: z.ZodLiteral<"market">;
|
|
435
|
+
asset: z.ZodString;
|
|
436
|
+
download: z.ZodObject<{
|
|
437
|
+
filename: z.ZodString;
|
|
438
|
+
url: z.ZodString;
|
|
439
|
+
mediaType: z.ZodLiteral<"application/zip">;
|
|
440
|
+
}, z.core.$strict>;
|
|
441
|
+
}, z.core.$strip>;
|
|
442
|
+
export declare const frameExportSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
443
|
+
frameId: z.ZodString;
|
|
444
|
+
frameName: z.ZodString;
|
|
445
|
+
projectId: z.ZodString;
|
|
446
|
+
type: z.ZodLiteral<"glts">;
|
|
447
|
+
runtime: z.ZodObject<{
|
|
448
|
+
gltf: z.ZodObject<{
|
|
449
|
+
filename: z.ZodString;
|
|
450
|
+
}, z.core.$strip>;
|
|
451
|
+
stl: z.ZodObject<{
|
|
452
|
+
filename: z.ZodString;
|
|
453
|
+
}, z.core.$strip>;
|
|
454
|
+
}, z.core.$strip>;
|
|
455
|
+
sourceArchive: z.ZodNullable<z.ZodObject<{
|
|
456
|
+
filename: z.ZodString;
|
|
457
|
+
url: z.ZodString;
|
|
458
|
+
mediaType: z.ZodLiteral<"application/zip">;
|
|
459
|
+
}, z.core.$strict>>;
|
|
460
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
461
|
+
frameId: z.ZodString;
|
|
462
|
+
frameName: z.ZodString;
|
|
463
|
+
projectId: z.ZodString;
|
|
464
|
+
type: z.ZodLiteral<"image">;
|
|
465
|
+
download: z.ZodObject<{
|
|
466
|
+
filename: z.ZodString;
|
|
467
|
+
url: z.ZodString;
|
|
468
|
+
mediaType: z.ZodEnum<{
|
|
469
|
+
"image/png": "image/png";
|
|
470
|
+
"image/jpeg": "image/jpeg";
|
|
471
|
+
"image/webp": "image/webp";
|
|
472
|
+
}>;
|
|
473
|
+
}, z.core.$strict>;
|
|
474
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
475
|
+
frameId: z.ZodString;
|
|
476
|
+
frameName: z.ZodString;
|
|
477
|
+
projectId: z.ZodString;
|
|
478
|
+
type: z.ZodLiteral<"market">;
|
|
479
|
+
asset: z.ZodString;
|
|
480
|
+
download: z.ZodObject<{
|
|
481
|
+
filename: z.ZodString;
|
|
482
|
+
url: z.ZodString;
|
|
483
|
+
mediaType: z.ZodLiteral<"application/zip">;
|
|
484
|
+
}, z.core.$strict>;
|
|
485
|
+
}, z.core.$strip>], "type">;
|
|
355
486
|
export type User = z.infer<typeof userSchema>;
|
|
356
487
|
export type Project = z.infer<typeof projectSchema>;
|
|
357
488
|
export type CreateProjectFromBrief = z.infer<typeof createProjectFromBriefSchema>;
|
|
358
489
|
export type ProjectDerivationStatus = z.infer<typeof projectDerivationStatusSchema>;
|
|
490
|
+
export type CameraPose = z.infer<typeof cameraPoseSchema>;
|
|
359
491
|
export type GltsFrame = z.infer<typeof gltsFrameSchema>;
|
|
360
492
|
export type ImageFrame = z.infer<typeof imageFrameSchema>;
|
|
361
493
|
export type ImageGenerationOperation = z.infer<typeof imageGenerationOperationSchema>;
|
|
@@ -374,3 +506,7 @@ export type BinaryFile = z.infer<typeof binaryFileSchema>;
|
|
|
374
506
|
export type DesignFile = z.infer<typeof fileSchema>;
|
|
375
507
|
export type FileMutation = z.infer<typeof fileMutationSchema>;
|
|
376
508
|
export type Screenshot = z.infer<typeof screenshotSchema>;
|
|
509
|
+
export type GltsFrameExport = z.infer<typeof gltsFrameExportSchema>;
|
|
510
|
+
export type ImageFrameExport = z.infer<typeof imageFrameExportSchema>;
|
|
511
|
+
export type MarketFrameExport = z.infer<typeof marketFrameExportSchema>;
|
|
512
|
+
export type FrameExport = z.infer<typeof frameExportSchema>;
|
package/dist/v1/schemas.js
CHANGED
|
@@ -31,6 +31,28 @@ export const frameNameSchema = z
|
|
|
31
31
|
.refine((name) => !name.includes("/"), "Frame names cannot contain /");
|
|
32
32
|
export const frameSizeSchema = z.number().int().min(1).max(MAX_FRAME_DIMENSION);
|
|
33
33
|
export const framePositionSchema = z.number().finite();
|
|
34
|
+
const cameraPositionSchema = z
|
|
35
|
+
.object({
|
|
36
|
+
x: framePositionSchema,
|
|
37
|
+
y: framePositionSchema,
|
|
38
|
+
z: framePositionSchema,
|
|
39
|
+
})
|
|
40
|
+
.strict();
|
|
41
|
+
const cameraQuaternionSchema = z
|
|
42
|
+
.object({
|
|
43
|
+
x: framePositionSchema,
|
|
44
|
+
y: framePositionSchema,
|
|
45
|
+
z: framePositionSchema,
|
|
46
|
+
w: framePositionSchema,
|
|
47
|
+
})
|
|
48
|
+
.strict()
|
|
49
|
+
.refine(isNormalizedQuaternion, "Camera quaternion must be normalized");
|
|
50
|
+
export const cameraPoseSchema = z
|
|
51
|
+
.object({
|
|
52
|
+
position: cameraPositionSchema,
|
|
53
|
+
quaternion: cameraQuaternionSchema,
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
34
56
|
export const httpUrlSchema = z
|
|
35
57
|
.string()
|
|
36
58
|
.url()
|
|
@@ -92,6 +114,8 @@ const frameBaseSchema = z.object({
|
|
|
92
114
|
});
|
|
93
115
|
export const gltsFrameSchema = frameBaseSchema.extend({
|
|
94
116
|
type: z.literal("glts"),
|
|
117
|
+
camera: cameraPoseSchema.optional(),
|
|
118
|
+
contentRevision: z.number().int().nonnegative(),
|
|
95
119
|
});
|
|
96
120
|
export const imageGenerationOperationSchema = z.enum(["generate", "edit"]);
|
|
97
121
|
export const imageGenerationResultSchema = z.enum(["new", "replace"]);
|
|
@@ -274,6 +298,56 @@ export const screenshotSchema = z.object({
|
|
|
274
298
|
height: frameSizeSchema,
|
|
275
299
|
mediaType: z.literal("image/png"),
|
|
276
300
|
});
|
|
301
|
+
const frameExportFilenameSchema = z.object({
|
|
302
|
+
filename: z
|
|
303
|
+
.string()
|
|
304
|
+
.regex(/^[a-z0-9][a-z0-9._-]{0,159}$/, "Export filenames must be safe ASCII"),
|
|
305
|
+
});
|
|
306
|
+
const frameDownloadSchema = z
|
|
307
|
+
.object({
|
|
308
|
+
url: httpUrlSchema,
|
|
309
|
+
mediaType: z.string().min(1),
|
|
310
|
+
...frameExportFilenameSchema.shape,
|
|
311
|
+
})
|
|
312
|
+
.strict();
|
|
313
|
+
const marketDownloadSchema = frameDownloadSchema.extend({
|
|
314
|
+
url: z
|
|
315
|
+
.string()
|
|
316
|
+
.url()
|
|
317
|
+
.refine(isCredentialFreeHttpsUrl, "Market downloads must use credential-free HTTPS"),
|
|
318
|
+
mediaType: z.literal("application/zip"),
|
|
319
|
+
});
|
|
320
|
+
const frameExportBaseSchema = z.object({
|
|
321
|
+
frameId: designIdSchema,
|
|
322
|
+
frameName: frameNameSchema,
|
|
323
|
+
projectId: designIdSchema,
|
|
324
|
+
});
|
|
325
|
+
export const gltsFrameExportSchema = frameExportBaseSchema.extend({
|
|
326
|
+
type: z.literal("glts"),
|
|
327
|
+
runtime: z.object({
|
|
328
|
+
gltf: frameExportFilenameSchema,
|
|
329
|
+
stl: frameExportFilenameSchema,
|
|
330
|
+
}),
|
|
331
|
+
sourceArchive: frameDownloadSchema
|
|
332
|
+
.extend({ mediaType: z.literal("application/zip") })
|
|
333
|
+
.nullable(),
|
|
334
|
+
});
|
|
335
|
+
export const imageFrameExportSchema = frameExportBaseSchema.extend({
|
|
336
|
+
type: z.literal("image"),
|
|
337
|
+
download: frameDownloadSchema.extend({
|
|
338
|
+
mediaType: z.enum(["image/png", "image/jpeg", "image/webp"]),
|
|
339
|
+
}),
|
|
340
|
+
});
|
|
341
|
+
export const marketFrameExportSchema = frameExportBaseSchema.extend({
|
|
342
|
+
type: z.literal("market"),
|
|
343
|
+
asset: marketAssetSchema,
|
|
344
|
+
download: marketDownloadSchema,
|
|
345
|
+
});
|
|
346
|
+
export const frameExportSchema = z.discriminatedUnion("type", [
|
|
347
|
+
gltsFrameExportSchema,
|
|
348
|
+
imageFrameExportSchema,
|
|
349
|
+
marketFrameExportSchema,
|
|
350
|
+
]);
|
|
277
351
|
function isProjectPath(path) {
|
|
278
352
|
if (!path.startsWith("/") || path === "/" || path.endsWith("/"))
|
|
279
353
|
return false;
|
|
@@ -297,3 +371,16 @@ function isHttpUrl(value) {
|
|
|
297
371
|
const protocol = new URL(value).protocol;
|
|
298
372
|
return protocol === "http:" || protocol === "https:";
|
|
299
373
|
}
|
|
374
|
+
function isCredentialFreeHttpsUrl(value) {
|
|
375
|
+
if (!URL.canParse(value))
|
|
376
|
+
return false;
|
|
377
|
+
const url = new URL(value);
|
|
378
|
+
return url.protocol === "https:" && !url.username && !url.password;
|
|
379
|
+
}
|
|
380
|
+
function isNormalizedQuaternion(value) {
|
|
381
|
+
const squaredLength = value.x * value.x +
|
|
382
|
+
value.y * value.y +
|
|
383
|
+
value.z * value.z +
|
|
384
|
+
value.w * value.w;
|
|
385
|
+
return Math.abs(squaredLength - 1) <= 1e-6;
|
|
386
|
+
}
|