@drawcall/design 0.1.2 → 0.1.3
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/protocol.d.ts +28 -4
- package/dist/protocol.js +29 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export * as v1 from "./v1/index.js";
|
|
|
2
2
|
export { designSkill } from "./skill.generated.js";
|
|
3
3
|
export { deleteSourceFiles, editSourceCode, editSourceFile, SourceEditError, SourceFileNotFoundError, } from "./source.js";
|
|
4
4
|
export { parseFrameSize, parseFrameTarget, parseScreenshotTarget, parseSourceFiles, type FrameTarget, type ScreenshotTarget, } from "./target.js";
|
|
5
|
-
export {
|
|
5
|
+
export { acknowledgesInspection, inspectionCommandSchema, inspectionFrameMessageSchema, inspectionMessageTypes, projectSyncUrl, type InspectionAppliedMessage, type InspectionCommand, type InspectionFrameMessage, } from "./protocol.js";
|
|
6
6
|
export type { CodeFrame, CreateCodeFrame, CreateFrame, CreateImageFrame, Frame, ImageFrame, Project, Screenshot, SourceFile, SourceFiles, SourceList, SourceMutation, User, } from "./v1/schemas.js";
|
package/dist/index.js
CHANGED
|
@@ -2,4 +2,4 @@ export * as v1 from "./v1/index.js";
|
|
|
2
2
|
export { designSkill } from "./skill.generated.js";
|
|
3
3
|
export { deleteSourceFiles, editSourceCode, editSourceFile, SourceEditError, SourceFileNotFoundError, } from "./source.js";
|
|
4
4
|
export { parseFrameSize, parseFrameTarget, parseScreenshotTarget, parseSourceFiles, } from "./target.js";
|
|
5
|
-
export {
|
|
5
|
+
export { acknowledgesInspection, inspectionCommandSchema, inspectionFrameMessageSchema, inspectionMessageTypes, projectSyncUrl, } from "./protocol.js";
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
2
|
+
export declare const inspectionMessageTypes: {
|
|
3
|
+
readonly applied: "drawcall:inspection:applied";
|
|
4
|
+
readonly exit: "drawcall:inspection:exit";
|
|
5
|
+
readonly loading: "drawcall:inspection:loading";
|
|
6
|
+
readonly ready: "drawcall:inspection:ready";
|
|
7
|
+
readonly set: "drawcall:inspection:set";
|
|
8
|
+
};
|
|
9
|
+
export declare const inspectionCommandSchema: z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"drawcall:inspection:set">;
|
|
11
|
+
requestId: z.ZodString;
|
|
4
12
|
enabled: z.ZodBoolean;
|
|
5
|
-
}, z.core.$
|
|
6
|
-
export
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export declare const inspectionFrameMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"drawcall:inspection:loading">;
|
|
16
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
17
|
+
type: z.ZodLiteral<"drawcall:inspection:ready">;
|
|
18
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<"drawcall:inspection:applied">;
|
|
20
|
+
requestId: z.ZodString;
|
|
21
|
+
enabled: z.ZodBoolean;
|
|
22
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"drawcall:inspection:exit">;
|
|
24
|
+
}, z.core.$strict>], "type">;
|
|
25
|
+
export type InspectionCommand = z.infer<typeof inspectionCommandSchema>;
|
|
26
|
+
export type InspectionFrameMessage = z.infer<typeof inspectionFrameMessageSchema>;
|
|
27
|
+
export type InspectionAppliedMessage = Extract<InspectionFrameMessage, {
|
|
28
|
+
type: typeof inspectionMessageTypes.applied;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function acknowledgesInspection(command: InspectionCommand | null, message: InspectionAppliedMessage): boolean;
|
|
7
31
|
export declare function projectSyncUrl(baseUrl: string, project: string): string;
|
package/dist/protocol.js
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export const
|
|
3
|
-
|
|
2
|
+
export const inspectionMessageTypes = {
|
|
3
|
+
applied: "drawcall:inspection:applied",
|
|
4
|
+
exit: "drawcall:inspection:exit",
|
|
5
|
+
loading: "drawcall:inspection:loading",
|
|
6
|
+
ready: "drawcall:inspection:ready",
|
|
7
|
+
set: "drawcall:inspection:set",
|
|
8
|
+
};
|
|
9
|
+
export const inspectionCommandSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
type: z.literal(inspectionMessageTypes.set),
|
|
12
|
+
requestId: z.string().min(1),
|
|
4
13
|
enabled: z.boolean(),
|
|
5
|
-
})
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
16
|
+
export const inspectionFrameMessageSchema = z.discriminatedUnion("type", [
|
|
17
|
+
z.object({ type: z.literal(inspectionMessageTypes.loading) }).strict(),
|
|
18
|
+
z.object({ type: z.literal(inspectionMessageTypes.ready) }).strict(),
|
|
19
|
+
z
|
|
20
|
+
.object({
|
|
21
|
+
type: z.literal(inspectionMessageTypes.applied),
|
|
22
|
+
requestId: z.string().min(1),
|
|
23
|
+
enabled: z.boolean(),
|
|
24
|
+
})
|
|
25
|
+
.strict(),
|
|
26
|
+
z.object({ type: z.literal(inspectionMessageTypes.exit) }).strict(),
|
|
27
|
+
]);
|
|
28
|
+
export function acknowledgesInspection(command, message) {
|
|
29
|
+
return (command?.requestId === message.requestId &&
|
|
30
|
+
command.enabled === message.enabled);
|
|
31
|
+
}
|
|
6
32
|
export function projectSyncUrl(baseUrl, project) {
|
|
7
33
|
const url = new URL(`/api/v1/projects/${encodeURIComponent(project)}/sync`, baseUrl);
|
|
8
34
|
if (url.protocol === "https:")
|