@fragno-dev/backoffice-api 0.0.0-stage → 0.0.0
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/LICENSE.md +16 -0
- package/README.md +90 -2
- package/dist/api.d.ts +35 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +10 -0
- package/dist/api.js.map +1 -0
- package/dist/errors.d.ts +45 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +35 -0
- package/dist/errors.js.map +1 -0
- package/dist/openapi.d.ts +46 -0
- package/dist/openapi.d.ts.map +1 -0
- package/dist/openapi.js +205 -0
- package/dist/openapi.js.map +1 -0
- package/dist/v0/account.d.ts +171 -0
- package/dist/v0/account.d.ts.map +1 -0
- package/dist/v0/account.js +78 -0
- package/dist/v0/account.js.map +1 -0
- package/dist/v0/api.d.ts +3437 -0
- package/dist/v0/api.d.ts.map +1 -0
- package/dist/v0/api.js +52 -0
- package/dist/v0/api.js.map +1 -0
- package/dist/v0/app-actions.d.ts +105 -0
- package/dist/v0/app-actions.d.ts.map +1 -0
- package/dist/v0/app-actions.js +100 -0
- package/dist/v0/app-actions.js.map +1 -0
- package/dist/v0/apps.d.ts +417 -0
- package/dist/v0/apps.d.ts.map +1 -0
- package/dist/v0/apps.js +163 -0
- package/dist/v0/apps.js.map +1 -0
- package/dist/v0/automation.d.ts +730 -0
- package/dist/v0/automation.d.ts.map +1 -0
- package/dist/v0/automation.js +355 -0
- package/dist/v0/automation.js.map +1 -0
- package/dist/v0/capabilities.d.ts +97 -0
- package/dist/v0/capabilities.d.ts.map +1 -0
- package/dist/v0/capabilities.js +41 -0
- package/dist/v0/capabilities.js.map +1 -0
- package/dist/v0/client.d.ts +39 -0
- package/dist/v0/client.d.ts.map +1 -0
- package/dist/v0/client.js +61 -0
- package/dist/v0/client.js.map +1 -0
- package/dist/v0/events.d.ts +789 -0
- package/dist/v0/events.d.ts.map +1 -0
- package/dist/v0/events.js +153 -0
- package/dist/v0/events.js.map +1 -0
- package/dist/v0/forms.d.ts +172 -0
- package/dist/v0/forms.d.ts.map +1 -0
- package/dist/v0/forms.js +88 -0
- package/dist/v0/forms.js.map +1 -0
- package/dist/v0/hooks.d.ts +61 -0
- package/dist/v0/hooks.d.ts.map +1 -0
- package/dist/v0/hooks.js +49 -0
- package/dist/v0/hooks.js.map +1 -0
- package/dist/v0/identity.d.ts +73 -0
- package/dist/v0/identity.d.ts.map +1 -0
- package/dist/v0/identity.js +46 -0
- package/dist/v0/identity.js.map +1 -0
- package/dist/v0/integrations.d.ts +847 -0
- package/dist/v0/integrations.d.ts.map +1 -0
- package/dist/v0/integrations.js +255 -0
- package/dist/v0/integrations.js.map +1 -0
- package/dist/v0/javascript.d.ts +160 -0
- package/dist/v0/javascript.d.ts.map +1 -0
- package/dist/v0/javascript.js +123 -0
- package/dist/v0/javascript.js.map +1 -0
- package/dist/v0/marketplace.d.ts +825 -0
- package/dist/v0/marketplace.d.ts.map +1 -0
- package/dist/v0/marketplace.js +284 -0
- package/dist/v0/marketplace.js.map +1 -0
- package/dist/v0/organization.d.ts +182 -0
- package/dist/v0/organization.d.ts.map +1 -0
- package/dist/v0/organization.js +88 -0
- package/dist/v0/organization.js.map +1 -0
- package/dist/v0/otp.d.ts +37 -0
- package/dist/v0/otp.d.ts.map +1 -0
- package/dist/v0/otp.js +29 -0
- package/dist/v0/otp.js.map +1 -0
- package/dist/v0/pi.d.ts +322 -0
- package/dist/v0/pi.d.ts.map +1 -0
- package/dist/v0/pi.js +146 -0
- package/dist/v0/pi.js.map +1 -0
- package/dist/v0/sandbox.d.ts +173 -0
- package/dist/v0/sandbox.d.ts.map +1 -0
- package/dist/v0/sandbox.js +97 -0
- package/dist/v0/sandbox.js.map +1 -0
- package/dist/v0/shared/bytes.d.ts +12 -0
- package/dist/v0/shared/bytes.d.ts.map +1 -0
- package/dist/v0/shared/bytes.js +16 -0
- package/dist/v0/shared/bytes.js.map +1 -0
- package/dist/v0/shared/datetime.d.ts +10 -0
- package/dist/v0/shared/datetime.d.ts.map +1 -0
- package/dist/v0/shared/datetime.js +14 -0
- package/dist/v0/shared/datetime.js.map +1 -0
- package/dist/v0/shared/json.d.ts +9 -0
- package/dist/v0/shared/json.d.ts.map +1 -0
- package/dist/v0/shared/json.js +14 -0
- package/dist/v0/shared/json.js.map +1 -0
- package/dist/v0/shared/pagination.d.ts +11 -0
- package/dist/v0/shared/pagination.d.ts.map +1 -0
- package/dist/v0/shared/pagination.js +11 -0
- package/dist/v0/shared/pagination.js.map +1 -0
- package/dist/v0/shared/permissions.d.ts +279 -0
- package/dist/v0/shared/permissions.d.ts.map +1 -0
- package/dist/v0/shared/permissions.js +285 -0
- package/dist/v0/shared/permissions.js.map +1 -0
- package/dist/v0/shared/pi-agent-name.d.ts +10 -0
- package/dist/v0/shared/pi-agent-name.d.ts.map +1 -0
- package/dist/v0/shared/pi-agent-name.js +11 -0
- package/dist/v0/shared/pi-agent-name.js.map +1 -0
- package/dist/v0/shared/scope.d.ts +305 -0
- package/dist/v0/shared/scope.d.ts.map +1 -0
- package/dist/v0/shared/scope.js +279 -0
- package/dist/v0/shared/scope.js.map +1 -0
- package/dist/v0/state.d.ts +512 -0
- package/dist/v0/state.d.ts.map +1 -0
- package/dist/v0/state.js +267 -0
- package/dist/v0/state.js.map +1 -0
- package/dist/v0/store.d.ts +138 -0
- package/dist/v0/store.d.ts.map +1 -0
- package/dist/v0/store.js +83 -0
- package/dist/v0/store.js.map +1 -0
- package/dist/v0/upload.d.ts +568 -0
- package/dist/v0/upload.d.ts.map +1 -0
- package/dist/v0/upload.js +109 -0
- package/dist/v0/upload.js.map +1 -0
- package/dist/v0/web.d.ts +47 -0
- package/dist/v0/web.d.ts.map +1 -0
- package/dist/v0/web.js +31 -0
- package/dist/v0/web.js.map +1 -0
- package/dist/v0/workflow.d.ts +267 -0
- package/dist/v0/workflow.d.ts.map +1 -0
- package/dist/v0/workflow.js +116 -0
- package/dist/v0/workflow.js.map +1 -0
- package/package.json +64 -3
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/v0/sandbox.d.ts
|
|
3
|
+
declare const commandResultSchema: z.ZodLazy<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
|
+
ok: z.ZodLiteral<true>;
|
|
5
|
+
stdout: z.ZodString;
|
|
6
|
+
stderr: z.ZodString;
|
|
7
|
+
exitCode: z.ZodNumber;
|
|
8
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9
|
+
ok: z.ZodLiteral<false>;
|
|
10
|
+
code: z.ZodString;
|
|
11
|
+
reason: z.ZodEnum<{
|
|
12
|
+
authentication_failed: "authentication_failed";
|
|
13
|
+
command_failed: "command_failed";
|
|
14
|
+
invalid_request: "invalid_request";
|
|
15
|
+
output_limit_exceeded: "output_limit_exceeded";
|
|
16
|
+
timeout: "timeout";
|
|
17
|
+
sandbox_terminated: "sandbox_terminated";
|
|
18
|
+
sandbox_unavailable: "sandbox_unavailable";
|
|
19
|
+
internal_error: "internal_error";
|
|
20
|
+
}>;
|
|
21
|
+
message: z.ZodString;
|
|
22
|
+
stdout: z.ZodOptional<z.ZodString>;
|
|
23
|
+
stderr: z.ZodOptional<z.ZodString>;
|
|
24
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
retryable: z.ZodBoolean;
|
|
26
|
+
}, z.core.$strip>], "ok">>;
|
|
27
|
+
declare const execInputSchema: z.ZodLazy<z.ZodObject<{
|
|
28
|
+
sandboxId: z.ZodString;
|
|
29
|
+
command: z.ZodString;
|
|
30
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
declare const sandboxStatusSchema: z.ZodLazy<z.ZodEnum<{
|
|
33
|
+
error: "error";
|
|
34
|
+
running: "running";
|
|
35
|
+
requested: "requested";
|
|
36
|
+
starting: "starting";
|
|
37
|
+
stopping: "stopping";
|
|
38
|
+
stopped: "stopped";
|
|
39
|
+
}>>;
|
|
40
|
+
declare const sandboxOperations: {
|
|
41
|
+
"sandbox.start": {
|
|
42
|
+
description: string;
|
|
43
|
+
permissions: {
|
|
44
|
+
readonly namespace: "sandbox";
|
|
45
|
+
readonly permission: "modify";
|
|
46
|
+
}[];
|
|
47
|
+
input: z.ZodLazy<z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
keepAlive: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
sleepAfter: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
51
|
+
startupTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
startupCommand: z.ZodOptional<z.ZodString>;
|
|
53
|
+
image: z.ZodOptional<z.ZodLazy<z.ZodEnum<{
|
|
54
|
+
workspace: "workspace";
|
|
55
|
+
debian: "debian";
|
|
56
|
+
}>>>;
|
|
57
|
+
instanceType: z.ZodOptional<z.ZodLazy<z.ZodEnum<{
|
|
58
|
+
lite: "lite";
|
|
59
|
+
"standard-1": "standard-1";
|
|
60
|
+
"standard-2": "standard-2";
|
|
61
|
+
"standard-3": "standard-3";
|
|
62
|
+
"standard-4": "standard-4";
|
|
63
|
+
}>>>;
|
|
64
|
+
}, z.core.$strip>>;
|
|
65
|
+
output: z.ZodLazy<z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
status: z.ZodLazy<z.ZodEnum<{
|
|
68
|
+
error: "error";
|
|
69
|
+
running: "running";
|
|
70
|
+
requested: "requested";
|
|
71
|
+
starting: "starting";
|
|
72
|
+
stopping: "stopping";
|
|
73
|
+
stopped: "stopped";
|
|
74
|
+
}>>;
|
|
75
|
+
image: z.ZodLazy<z.ZodEnum<{
|
|
76
|
+
workspace: "workspace";
|
|
77
|
+
debian: "debian";
|
|
78
|
+
}>>;
|
|
79
|
+
instanceType: z.ZodLazy<z.ZodEnum<{
|
|
80
|
+
lite: "lite";
|
|
81
|
+
"standard-1": "standard-1";
|
|
82
|
+
"standard-2": "standard-2";
|
|
83
|
+
"standard-3": "standard-3";
|
|
84
|
+
"standard-4": "standard-4";
|
|
85
|
+
}>>;
|
|
86
|
+
workspaceSaved: z.ZodBoolean;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
};
|
|
89
|
+
"sandbox.list": {
|
|
90
|
+
description: string;
|
|
91
|
+
permissions: {
|
|
92
|
+
readonly namespace: "sandbox";
|
|
93
|
+
readonly permission: "read";
|
|
94
|
+
}[];
|
|
95
|
+
input: z.ZodVoid;
|
|
96
|
+
output: z.ZodLazy<z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
97
|
+
id: z.ZodString;
|
|
98
|
+
status: z.ZodLazy<z.ZodEnum<{
|
|
99
|
+
error: "error";
|
|
100
|
+
running: "running";
|
|
101
|
+
requested: "requested";
|
|
102
|
+
starting: "starting";
|
|
103
|
+
stopping: "stopping";
|
|
104
|
+
stopped: "stopped";
|
|
105
|
+
}>>;
|
|
106
|
+
image: z.ZodLazy<z.ZodEnum<{
|
|
107
|
+
workspace: "workspace";
|
|
108
|
+
debian: "debian";
|
|
109
|
+
}>>;
|
|
110
|
+
instanceType: z.ZodLazy<z.ZodEnum<{
|
|
111
|
+
lite: "lite";
|
|
112
|
+
"standard-1": "standard-1";
|
|
113
|
+
"standard-2": "standard-2";
|
|
114
|
+
"standard-3": "standard-3";
|
|
115
|
+
"standard-4": "standard-4";
|
|
116
|
+
}>>;
|
|
117
|
+
workspaceSaved: z.ZodBoolean;
|
|
118
|
+
}, z.core.$strip>>>>;
|
|
119
|
+
};
|
|
120
|
+
"sandbox.kill": {
|
|
121
|
+
description: string;
|
|
122
|
+
permissions: {
|
|
123
|
+
readonly namespace: "sandbox";
|
|
124
|
+
readonly permission: "modify";
|
|
125
|
+
}[];
|
|
126
|
+
input: z.ZodLazy<z.ZodObject<{
|
|
127
|
+
sandboxId: z.ZodString;
|
|
128
|
+
}, z.core.$strip>>;
|
|
129
|
+
output: z.ZodLazy<z.ZodObject<{
|
|
130
|
+
sandboxId: z.ZodString;
|
|
131
|
+
killed: z.ZodLiteral<true>;
|
|
132
|
+
}, z.core.$strip>>;
|
|
133
|
+
};
|
|
134
|
+
"sandbox.exec": {
|
|
135
|
+
description: string;
|
|
136
|
+
permissions: {
|
|
137
|
+
readonly namespace: "sandbox";
|
|
138
|
+
readonly permission: "modify";
|
|
139
|
+
}[];
|
|
140
|
+
input: z.ZodLazy<z.ZodObject<{
|
|
141
|
+
sandboxId: z.ZodString;
|
|
142
|
+
command: z.ZodString;
|
|
143
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
}, z.core.$strip>>;
|
|
145
|
+
output: z.ZodLazy<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
146
|
+
ok: z.ZodLiteral<true>;
|
|
147
|
+
stdout: z.ZodString;
|
|
148
|
+
stderr: z.ZodString;
|
|
149
|
+
exitCode: z.ZodNumber;
|
|
150
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
151
|
+
ok: z.ZodLiteral<false>;
|
|
152
|
+
code: z.ZodString;
|
|
153
|
+
reason: z.ZodEnum<{
|
|
154
|
+
authentication_failed: "authentication_failed";
|
|
155
|
+
command_failed: "command_failed";
|
|
156
|
+
invalid_request: "invalid_request";
|
|
157
|
+
output_limit_exceeded: "output_limit_exceeded";
|
|
158
|
+
timeout: "timeout";
|
|
159
|
+
sandbox_terminated: "sandbox_terminated";
|
|
160
|
+
sandbox_unavailable: "sandbox_unavailable";
|
|
161
|
+
internal_error: "internal_error";
|
|
162
|
+
}>;
|
|
163
|
+
message: z.ZodString;
|
|
164
|
+
stdout: z.ZodOptional<z.ZodString>;
|
|
165
|
+
stderr: z.ZodOptional<z.ZodString>;
|
|
166
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
167
|
+
retryable: z.ZodBoolean;
|
|
168
|
+
}, z.core.$strip>], "ok">>;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
//#endregion
|
|
172
|
+
export { commandResultSchema, execInputSchema, sandboxOperations, sandboxStatusSchema };
|
|
173
|
+
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","names":[],"sources":["../../src/v0/sandbox.ts"],"mappings":";;cAKa,qBAAmB,EAAA,QAAA,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;cAyBnB,iBAAe,EAAA,QAAA,EAAA;;;;;cAQf,qBAAmB,EAAA,QAAA,EAAA;;;;;;;;cAmDnB"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { BACKOFFICE_PERMISSION } from "./shared/permissions.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/v0/sandbox.ts
|
|
4
|
+
const commandResultSchema = z.lazy(() => z.discriminatedUnion("ok", [z.object({
|
|
5
|
+
ok: z.literal(true),
|
|
6
|
+
stdout: z.string(),
|
|
7
|
+
stderr: z.string(),
|
|
8
|
+
exitCode: z.number()
|
|
9
|
+
}), z.object({
|
|
10
|
+
ok: z.literal(false),
|
|
11
|
+
code: z.string(),
|
|
12
|
+
reason: z.enum([
|
|
13
|
+
"authentication_failed",
|
|
14
|
+
"command_failed",
|
|
15
|
+
"invalid_request",
|
|
16
|
+
"output_limit_exceeded",
|
|
17
|
+
"timeout",
|
|
18
|
+
"sandbox_terminated",
|
|
19
|
+
"sandbox_unavailable",
|
|
20
|
+
"internal_error"
|
|
21
|
+
]),
|
|
22
|
+
message: z.string(),
|
|
23
|
+
stdout: z.string().optional(),
|
|
24
|
+
stderr: z.string().optional(),
|
|
25
|
+
exitCode: z.number().optional(),
|
|
26
|
+
retryable: z.boolean()
|
|
27
|
+
})]));
|
|
28
|
+
const execInputSchema = z.lazy(() => z.object({
|
|
29
|
+
sandboxId: z.string().trim().min(1),
|
|
30
|
+
command: z.string().trim().min(1),
|
|
31
|
+
timeoutMs: z.number().int().positive().optional()
|
|
32
|
+
}));
|
|
33
|
+
const sandboxStatusSchema = z.lazy(() => z.enum([
|
|
34
|
+
"requested",
|
|
35
|
+
"starting",
|
|
36
|
+
"running",
|
|
37
|
+
"stopping",
|
|
38
|
+
"stopped",
|
|
39
|
+
"error"
|
|
40
|
+
]));
|
|
41
|
+
const sandboxImageSchema = z.lazy(() => z.enum(["workspace", "debian"]).describe("workspace: Debian with Node.js, Python, git, ripgrep, and jq. debian: Cloudflare-managed Debian with Node.js; starts fastest."));
|
|
42
|
+
const sandboxInstanceTypeSchema = z.lazy(() => z.enum([
|
|
43
|
+
"lite",
|
|
44
|
+
"standard-1",
|
|
45
|
+
"standard-2",
|
|
46
|
+
"standard-3",
|
|
47
|
+
"standard-4"
|
|
48
|
+
]));
|
|
49
|
+
const sandboxSummarySchema = z.lazy(() => z.object({
|
|
50
|
+
id: z.string().trim().min(1),
|
|
51
|
+
status: sandboxStatusSchema,
|
|
52
|
+
image: sandboxImageSchema,
|
|
53
|
+
instanceType: sandboxInstanceTypeSchema,
|
|
54
|
+
workspaceSaved: z.boolean().describe("Whether the next start resumes the workspace saved when the sandbox last stopped.")
|
|
55
|
+
}));
|
|
56
|
+
const startInputSchema = z.lazy(() => z.object({
|
|
57
|
+
id: z.string().trim().min(1),
|
|
58
|
+
keepAlive: z.boolean().optional(),
|
|
59
|
+
sleepAfter: z.union([z.string(), z.number()]).optional().describe("Saves the workspace and stops the sandbox after this long, for example 15m. Defaults to 10m unless keepAlive is set."),
|
|
60
|
+
startupTimeoutMs: z.number().int().positive().optional(),
|
|
61
|
+
startupCommand: z.string().trim().min(1).optional(),
|
|
62
|
+
image: sandboxImageSchema.optional().describe("Image for a new workspace; defaults to workspace. A saved workspace resumes on its own image."),
|
|
63
|
+
instanceType: sandboxInstanceTypeSchema.optional()
|
|
64
|
+
}));
|
|
65
|
+
const sandboxOperations = {
|
|
66
|
+
"sandbox.start": {
|
|
67
|
+
description: "Start a Cloudflare sandbox for the current organization.",
|
|
68
|
+
permissions: [BACKOFFICE_PERMISSION.sandbox.modify],
|
|
69
|
+
input: startInputSchema,
|
|
70
|
+
output: sandboxSummarySchema
|
|
71
|
+
},
|
|
72
|
+
"sandbox.list": {
|
|
73
|
+
description: "List Cloudflare sandboxes for the current organization.",
|
|
74
|
+
permissions: [BACKOFFICE_PERMISSION.sandbox.read],
|
|
75
|
+
input: z.void(),
|
|
76
|
+
output: z.lazy(() => z.array(sandboxSummarySchema))
|
|
77
|
+
},
|
|
78
|
+
"sandbox.kill": {
|
|
79
|
+
description: "Save a Cloudflare sandbox's workspace and stop it. Starting the same sandbox ID resumes the workspace.",
|
|
80
|
+
permissions: [BACKOFFICE_PERMISSION.sandbox.modify],
|
|
81
|
+
input: z.lazy(() => z.object({ sandboxId: z.string().trim().min(1) })),
|
|
82
|
+
output: z.lazy(() => z.object({
|
|
83
|
+
sandboxId: z.string().trim().min(1),
|
|
84
|
+
killed: z.literal(true)
|
|
85
|
+
}))
|
|
86
|
+
},
|
|
87
|
+
"sandbox.exec": {
|
|
88
|
+
description: "Execute a command in a Cloudflare sandbox.",
|
|
89
|
+
permissions: [BACKOFFICE_PERMISSION.sandbox.modify],
|
|
90
|
+
input: execInputSchema,
|
|
91
|
+
output: commandResultSchema
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
export { commandResultSchema, execInputSchema, sandboxOperations, sandboxStatusSchema };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=sandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.js","names":[],"sources":["../../src/v0/sandbox.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport type { BackofficeApiOperation } from \"../api\";\nimport { BACKOFFICE_PERMISSION } from \"./shared/permissions\";\n\nexport const commandResultSchema = z.lazy(() =>\n z.discriminatedUnion(\"ok\", [\n z.object({ ok: z.literal(true), stdout: z.string(), stderr: z.string(), exitCode: z.number() }),\n z.object({\n ok: z.literal(false),\n code: z.string(),\n reason: z.enum([\n \"authentication_failed\",\n \"command_failed\",\n \"invalid_request\",\n \"output_limit_exceeded\",\n \"timeout\",\n \"sandbox_terminated\",\n \"sandbox_unavailable\",\n \"internal_error\",\n ]),\n message: z.string(),\n stdout: z.string().optional(),\n stderr: z.string().optional(),\n exitCode: z.number().optional(),\n retryable: z.boolean(),\n }),\n ]),\n);\n\nexport const execInputSchema = z.lazy(() =>\n z.object({\n sandboxId: z.string().trim().min(1),\n command: z.string().trim().min(1),\n timeoutMs: z.number().int().positive().optional(),\n }),\n);\n\nexport const sandboxStatusSchema = z.lazy(() =>\n z.enum([\"requested\", \"starting\", \"running\", \"stopping\", \"stopped\", \"error\"]),\n);\n\nconst sandboxImageSchema = z.lazy(() =>\n z\n .enum([\"workspace\", \"debian\"])\n .describe(\n \"workspace: Debian with Node.js, Python, git, ripgrep, and jq. debian: Cloudflare-managed Debian with Node.js; starts fastest.\",\n ),\n);\n\nconst sandboxInstanceTypeSchema = z.lazy(() =>\n z.enum([\"lite\", \"standard-1\", \"standard-2\", \"standard-3\", \"standard-4\"]),\n);\n\nconst sandboxSummarySchema = z.lazy(() =>\n z.object({\n id: z.string().trim().min(1),\n status: sandboxStatusSchema,\n image: sandboxImageSchema,\n instanceType: sandboxInstanceTypeSchema,\n workspaceSaved: z\n .boolean()\n .describe(\n \"Whether the next start resumes the workspace saved when the sandbox last stopped.\",\n ),\n }),\n);\n\nconst startInputSchema = z.lazy(() =>\n z.object({\n id: z.string().trim().min(1),\n keepAlive: z.boolean().optional(),\n sleepAfter: z\n .union([z.string(), z.number()])\n .optional()\n .describe(\n \"Saves the workspace and stops the sandbox after this long, for example 15m. Defaults to 10m unless keepAlive is set.\",\n ),\n startupTimeoutMs: z.number().int().positive().optional(),\n startupCommand: z.string().trim().min(1).optional(),\n image: sandboxImageSchema\n .optional()\n .describe(\n \"Image for a new workspace; defaults to workspace. A saved workspace resumes on its own image.\",\n ),\n instanceType: sandboxInstanceTypeSchema.optional(),\n }),\n);\n\nexport const sandboxOperations = {\n \"sandbox.start\": {\n description: \"Start a Cloudflare sandbox for the current organization.\",\n permissions: [BACKOFFICE_PERMISSION.sandbox.modify],\n input: startInputSchema,\n output: sandboxSummarySchema,\n },\n \"sandbox.list\": {\n description: \"List Cloudflare sandboxes for the current organization.\",\n permissions: [BACKOFFICE_PERMISSION.sandbox.read],\n input: z.void(),\n output: z.lazy(() => z.array(sandboxSummarySchema)),\n },\n \"sandbox.kill\": {\n description:\n \"Save a Cloudflare sandbox's workspace and stop it. Starting the same sandbox ID resumes the workspace.\",\n permissions: [BACKOFFICE_PERMISSION.sandbox.modify],\n input: z.lazy(() => z.object({ sandboxId: z.string().trim().min(1) })),\n output: z.lazy(() =>\n z.object({ sandboxId: z.string().trim().min(1), killed: z.literal(true) }),\n ),\n },\n \"sandbox.exec\": {\n description: \"Execute a command in a Cloudflare sandbox.\",\n permissions: [BACKOFFICE_PERMISSION.sandbox.modify],\n input: execInputSchema,\n output: commandResultSchema,\n },\n} satisfies Record<string, BackofficeApiOperation>;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/v0/shared/bytes.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Bytes travel inside JSON as standard base64.
|
|
5
|
+
*
|
|
6
|
+
* TODO: Replace base64 byte transport with proper file transfer APIs (streamed uploads and
|
|
7
|
+
* downloads) so large files do not pass through JSON bodies.
|
|
8
|
+
*/
|
|
9
|
+
declare const base64BytesSchema: z.ZodLazy<z.ZodBase64>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { base64BytesSchema };
|
|
12
|
+
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","names":[],"sources":["../../../src/v0/shared/bytes.ts"],"mappings":";;;;;;;;cAQa,mBAAiB,EAAA,QAAA,EAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/v0/shared/bytes.ts
|
|
3
|
+
/**
|
|
4
|
+
* Bytes travel inside JSON as standard base64.
|
|
5
|
+
*
|
|
6
|
+
* TODO: Replace base64 byte transport with proper file transfer APIs (streamed uploads and
|
|
7
|
+
* downloads) so large files do not pass through JSON bodies.
|
|
8
|
+
*/
|
|
9
|
+
const base64BytesSchema = z.lazy(() => z.base64()).meta({
|
|
10
|
+
id: "Base64Bytes",
|
|
11
|
+
description: "Bytes encoded as standard base64."
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { base64BytesSchema };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.js","names":[],"sources":["../../../src/v0/shared/bytes.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Bytes travel inside JSON as standard base64.\n *\n * TODO: Replace base64 byte transport with proper file transfer APIs (streamed uploads and\n * downloads) so large files do not pass through JSON bodies.\n */\nexport const base64BytesSchema = z\n .lazy(() => z.base64())\n .meta({\n id: \"Base64Bytes\",\n description: \"Bytes encoded as standard base64.\",\n });\n"],"mappings":";;;;;;;;AAQA,MAAa,oBAAoB,EAC9B,WAAW,EAAE,OAAO,CAAC,CAAC,CACtB,KAAK;CACJ,IAAI;CACJ,aAAa;AACf,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/v0/shared/datetime.d.ts
|
|
3
|
+
/** Accepts a `Date` from Backoffice internals and always describes and returns an ISO string. */
|
|
4
|
+
declare const isoDateTimeOutputSchema: z.ZodLazy<z.ZodPreprocess<z.ZodISODateTime, unknown>>;
|
|
5
|
+
declare const nullableIsoDateTimeOutputSchema: z.ZodLazy<z.ZodNullable<z.ZodLazy<z.ZodPreprocess<z.ZodISODateTime, unknown>>>>;
|
|
6
|
+
/** For timestamps stored as free-form strings: a `Date` becomes ISO, a string passes through. */
|
|
7
|
+
declare const dateTimeStringOutputSchema: z.ZodLazy<z.ZodPreprocess<z.ZodString, unknown>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { dateTimeStringOutputSchema, isoDateTimeOutputSchema, nullableIsoDateTimeOutputSchema };
|
|
10
|
+
//# sourceMappingURL=datetime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datetime.d.ts","names":[],"sources":["../../../src/v0/shared/datetime.ts"],"mappings":";;;cAGa,yBAAuB,EAAA,QAAA,EAAA,cAAA,EAAA;cASvB,iCAA+B,EAAA,QAAA,EAAA,YAAA,EAAA,QAAA,EAAA,cAAA,EAAA;;cAG/B,4BAA0B,EAAA,QAAA,EAAA,cAAA,EAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/v0/shared/datetime.ts
|
|
3
|
+
/** Accepts a `Date` from Backoffice internals and always describes and returns an ISO string. */
|
|
4
|
+
const isoDateTimeOutputSchema = z.lazy(() => z.preprocess((value) => {
|
|
5
|
+
if (value instanceof Date) return value.toISOString();
|
|
6
|
+
return value;
|
|
7
|
+
}, z.iso.datetime()));
|
|
8
|
+
const nullableIsoDateTimeOutputSchema = z.lazy(() => isoDateTimeOutputSchema.nullable());
|
|
9
|
+
/** For timestamps stored as free-form strings: a `Date` becomes ISO, a string passes through. */
|
|
10
|
+
const dateTimeStringOutputSchema = z.lazy(() => z.preprocess((value) => value instanceof Date ? value.toISOString() : value, z.string()));
|
|
11
|
+
//#endregion
|
|
12
|
+
export { dateTimeStringOutputSchema, isoDateTimeOutputSchema, nullableIsoDateTimeOutputSchema };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=datetime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datetime.js","names":[],"sources":["../../../src/v0/shared/datetime.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** Accepts a `Date` from Backoffice internals and always describes and returns an ISO string. */\nexport const isoDateTimeOutputSchema = z.lazy(() =>\n z.preprocess((value) => {\n if (value instanceof Date) {\n return value.toISOString();\n }\n return value;\n }, z.iso.datetime()),\n);\n\nexport const nullableIsoDateTimeOutputSchema = z.lazy(() => isoDateTimeOutputSchema.nullable());\n\n/** For timestamps stored as free-form strings: a `Date` becomes ISO, a string passes through. */\nexport const dateTimeStringOutputSchema = z.lazy(() =>\n z.preprocess((value) => (value instanceof Date ? value.toISOString() : value), z.string()),\n);\n"],"mappings":";;;AAGA,MAAa,0BAA0B,EAAE,WACvC,EAAE,YAAY,UAAU;CACtB,IAAI,iBAAiB,MACnB,OAAO,MAAM,YAAY;CAE3B,OAAO;AACT,GAAG,EAAE,IAAI,SAAS,CAAC,CACrB;AAEA,MAAa,kCAAkC,EAAE,WAAW,wBAAwB,SAAS,CAAC;;AAG9F,MAAa,6BAA6B,EAAE,WAC1C,EAAE,YAAY,UAAW,iBAAiB,OAAO,MAAM,YAAY,IAAI,OAAQ,EAAE,OAAO,CAAC,CAC3F"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/v0/shared/json.d.ts
|
|
3
|
+
type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
};
|
|
6
|
+
declare const jsonValueSchema: z.ZodType<JsonValue>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { JsonValue, jsonValueSchema };
|
|
9
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","names":[],"sources":["../../../src/v0/shared/json.ts"],"mappings":";;KAEY,+CAKR;GACG,cAAc;;cAER,iBAAiB,EAAE,QAAQ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/v0/shared/json.ts
|
|
3
|
+
const jsonValueSchema = z.lazy(() => z.union([
|
|
4
|
+
z.null(),
|
|
5
|
+
z.boolean(),
|
|
6
|
+
z.number(),
|
|
7
|
+
z.string(),
|
|
8
|
+
z.array(jsonValueSchema),
|
|
9
|
+
z.record(z.string(), jsonValueSchema)
|
|
10
|
+
])).meta({ id: "JsonValue" });
|
|
11
|
+
//#endregion
|
|
12
|
+
export { jsonValueSchema };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","names":[],"sources":["../../../src/v0/shared/json.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport type JsonValue =\n | null\n | boolean\n | number\n | string\n | JsonValue[]\n | { [key: string]: JsonValue };\n\nexport const jsonValueSchema: z.ZodType<JsonValue> = z\n .lazy(() =>\n z.union([\n z.null(),\n z.boolean(),\n z.number(),\n z.string(),\n z.array(jsonValueSchema),\n z.record(z.string(), jsonValueSchema),\n ]),\n )\n .meta({ id: \"JsonValue\" });\n"],"mappings":";;AAUA,MAAa,kBAAwC,EAClD,WACC,EAAE,MAAM;CACN,EAAE,KAAK;CACP,EAAE,QAAQ;CACV,EAAE,OAAO;CACT,EAAE,OAAO;CACT,EAAE,MAAM,eAAe;CACvB,EAAE,OAAO,EAAE,OAAO,GAAG,eAAe;AACtC,CAAC,CACH,CAAC,CACA,KAAK,EAAE,IAAI,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/v0/shared/pagination.d.ts
|
|
3
|
+
/** Directory cursors are bound to one listing and page size; resume with the same page size. */
|
|
4
|
+
declare const directoryPageInputSchema: z.ZodLazy<z.ZodObject<{
|
|
5
|
+
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
cursor: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
}, z.core.$strict>>;
|
|
8
|
+
type DirectoryPageInput = z.output<typeof directoryPageInputSchema>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { DirectoryPageInput, directoryPageInputSchema };
|
|
11
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","names":[],"sources":["../../../src/v0/shared/pagination.ts"],"mappings":";;;cAGa,0BAAwB,EAAA,QAAA,EAAA;;;;KAQzB,qBAAqB,EAAE,cAAc"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/v0/shared/pagination.ts
|
|
3
|
+
/** Directory cursors are bound to one listing and page size; resume with the same page size. */
|
|
4
|
+
const directoryPageInputSchema = z.lazy(() => z.strictObject({
|
|
5
|
+
pageSize: z.number().int().min(1).max(100).default(25),
|
|
6
|
+
cursor: z.string().min(1).nullable().default(null)
|
|
7
|
+
})).meta({ id: "DirectoryPageInput" });
|
|
8
|
+
//#endregion
|
|
9
|
+
export { directoryPageInputSchema };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","names":[],"sources":["../../../src/v0/shared/pagination.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/** Directory cursors are bound to one listing and page size; resume with the same page size. */\nexport const directoryPageInputSchema = z\n .lazy(() =>\n z.strictObject({\n pageSize: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).nullable().default(null),\n }),\n )\n .meta({ id: \"DirectoryPageInput\" });\nexport type DirectoryPageInput = z.output<typeof directoryPageInputSchema>;\n"],"mappings":";;;AAGA,MAAa,2BAA2B,EACrC,WACC,EAAE,aAAa;CACb,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE;CACrD,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,IAAI;AACnD,CAAC,CACH,CAAC,CACA,KAAK,EAAE,IAAI,qBAAqB,CAAC"}
|