@phpsandbox/sdk 0.0.67 → 0.1.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/README.md +10 -13
- package/dist/auth.d.ts +0 -1
- package/dist/auth.js +0 -3
- package/dist/beacon/index.d.ts +2 -0
- package/dist/beacon/index.js +5 -0
- package/dist/browser/phpsandbox-sdk.esm.js +311 -1016
- package/dist/browser/phpsandbox-sdk.esm.min.js +24 -24
- package/dist/browser/phpsandbox-sdk.iife.js +311 -1016
- package/dist/browser/phpsandbox-sdk.iife.min.js +24 -24
- package/dist/filesystem.d.ts +2 -1
- package/dist/filesystem.js +35 -2
- package/dist/index.d.ts +15 -24
- package/dist/index.js +19 -28
- package/dist/publications.d.ts +222 -0
- package/dist/{deployments.js → publications.js} +65 -70
- package/dist/repl.d.ts +0 -2
- package/dist/repl.js +0 -3
- package/dist/runtime/rest.js +1 -1
- package/dist/schemas/{deployments.d.ts → publications.d.ts} +68 -68
- package/dist/schemas/publications.js +133 -0
- package/dist/shell.d.ts +43 -22
- package/dist/shell.js +103 -75
- package/dist/terminal.d.ts +1 -3
- package/dist/terminal.js +2 -5
- package/docs/api-summary.md +13 -10
- package/docs/cdn-usage.md +4 -4
- package/docs/getting-started.md +6 -6
- package/examples/README.md +8 -9
- package/examples/basic.ts +1 -1
- package/examples/git-merge-smoke.ts +2 -2
- package/examples/laravel-load-test.ts +14 -19
- package/examples/notebook-readonly-smoke.ts +11 -11
- package/examples/publication-provider-label.ts +11 -0
- package/examples/{deploy-cloudflare-container.ts → publish-cloudflare-container.ts} +11 -11
- package/examples/{deploy-laravel-cloud.ts → publish-laravel-cloud.ts} +11 -11
- package/examples/{deploy-ssh-agent.ts → publish-ssh-agent.ts} +15 -16
- package/package.json +7 -2
- package/dist/deployments.d.ts +0 -253
- package/dist/laravel.d.ts +0 -22
- package/dist/laravel.js +0 -11
- package/dist/schemas/deployments.js +0 -133
- package/examples/deployment-provider-label.ts +0 -11
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export declare const PublicationProviderNameSchema: z.ZodEnum<{
|
|
3
|
+
"cloudflare-containers": "cloudflare-containers";
|
|
4
|
+
"ssh-server": "ssh-server";
|
|
5
|
+
"laravel-cloud": "laravel-cloud";
|
|
6
6
|
}>;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const PublicationStatusSchema: z.ZodEnum<{
|
|
8
8
|
stopped: "stopped";
|
|
9
9
|
deleted: "deleted";
|
|
10
10
|
pending: "pending";
|
|
@@ -16,7 +16,7 @@ export declare const DeploymentStatusSchema: z.ZodEnum<{
|
|
|
16
16
|
deleting: "deleting";
|
|
17
17
|
delete_failed: "delete_failed";
|
|
18
18
|
}>;
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const PublicationBuildStatusSchema: z.ZodEnum<{
|
|
20
20
|
running: "running";
|
|
21
21
|
pending: "pending";
|
|
22
22
|
queued: "queued";
|
|
@@ -24,22 +24,22 @@ export declare const DeploymentBuildStatusSchema: z.ZodEnum<{
|
|
|
24
24
|
succeeded: "succeeded";
|
|
25
25
|
cancelled: "cancelled";
|
|
26
26
|
}>;
|
|
27
|
-
export declare const
|
|
27
|
+
export declare const PublicationReleaseStatusSchema: z.ZodEnum<{
|
|
28
28
|
created: "created";
|
|
29
29
|
deleted: "deleted";
|
|
30
30
|
ready: "ready";
|
|
31
31
|
}>;
|
|
32
|
-
export declare const
|
|
32
|
+
export declare const PublicationSizeSchema: z.ZodEnum<{
|
|
33
33
|
small: "small";
|
|
34
|
-
basic: "basic";
|
|
35
34
|
nano: "nano";
|
|
36
35
|
medium: "medium";
|
|
37
36
|
large: "large";
|
|
38
37
|
lite: "lite";
|
|
38
|
+
basic: "basic";
|
|
39
39
|
"standard-1": "standard-1";
|
|
40
40
|
"standard-2": "standard-2";
|
|
41
41
|
}>;
|
|
42
|
-
export declare const
|
|
42
|
+
export declare const PublicationRegionSchema: z.ZodEnum<{
|
|
43
43
|
ENAM: "ENAM";
|
|
44
44
|
WNAM: "WNAM";
|
|
45
45
|
EEUR: "EEUR";
|
|
@@ -50,36 +50,36 @@ export declare const DeploymentRegionSchema: z.ZodEnum<{
|
|
|
50
50
|
OC: "OC";
|
|
51
51
|
AFR: "AFR";
|
|
52
52
|
}>;
|
|
53
|
-
export declare const
|
|
53
|
+
export declare const PublicationJurisdictionSchema: z.ZodEnum<{
|
|
54
54
|
eu: "eu";
|
|
55
55
|
fedramp: "fedramp";
|
|
56
56
|
}>;
|
|
57
|
-
export declare const
|
|
57
|
+
export declare const PublicationDomainDnsRecordTypeSchema: z.ZodEnum<{
|
|
58
58
|
CNAME: "CNAME";
|
|
59
59
|
ALIAS: "ALIAS";
|
|
60
60
|
ANAME: "ANAME";
|
|
61
61
|
}>;
|
|
62
|
-
export declare const
|
|
62
|
+
export declare const PublicationProtectionModeSchema: z.ZodEnum<{
|
|
63
63
|
none: "none";
|
|
64
64
|
password: "password";
|
|
65
65
|
}>;
|
|
66
|
-
export declare const
|
|
66
|
+
export declare const PublicationLogStreamSchema: z.ZodEnum<{
|
|
67
67
|
build: "build";
|
|
68
68
|
runtime: "runtime";
|
|
69
69
|
}>;
|
|
70
|
-
export declare const
|
|
70
|
+
export declare const PublishStreamLogStreamSchema: z.ZodEnum<{
|
|
71
71
|
build: "build";
|
|
72
72
|
runtime: "runtime";
|
|
73
|
-
|
|
73
|
+
publish: "publish";
|
|
74
74
|
}>;
|
|
75
|
-
export declare const
|
|
75
|
+
export declare const PublicationEventDataSchema: z.ZodObject<{
|
|
76
76
|
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
77
77
|
sequence: z.ZodNumber;
|
|
78
78
|
type: z.ZodString;
|
|
79
79
|
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
80
80
|
createdAt: z.ZodNullable<z.ZodString>;
|
|
81
81
|
}, z.core.$loose>;
|
|
82
|
-
export declare const
|
|
82
|
+
export declare const PublicationLogChunkDataSchema: z.ZodObject<{
|
|
83
83
|
sequence: z.ZodNumber;
|
|
84
84
|
stream: z.ZodEnum<{
|
|
85
85
|
build: "build";
|
|
@@ -88,7 +88,7 @@ export declare const DeploymentLogChunkDataSchema: z.ZodObject<{
|
|
|
88
88
|
content: z.ZodString;
|
|
89
89
|
createdAt: z.ZodNullable<z.ZodString>;
|
|
90
90
|
}, z.core.$loose>;
|
|
91
|
-
export declare const
|
|
91
|
+
export declare const PublishStreamPhaseSchema: z.ZodObject<{
|
|
92
92
|
name: z.ZodString;
|
|
93
93
|
status: z.ZodOptional<z.ZodEnum<{
|
|
94
94
|
running: "running";
|
|
@@ -97,17 +97,17 @@ export declare const DeployStreamPhaseSchema: z.ZodObject<{
|
|
|
97
97
|
}>>;
|
|
98
98
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
99
99
|
}, z.core.$strict>;
|
|
100
|
-
export declare const
|
|
100
|
+
export declare const PublishStreamLogSchema: z.ZodObject<{
|
|
101
101
|
stream: z.ZodEnum<{
|
|
102
102
|
build: "build";
|
|
103
103
|
runtime: "runtime";
|
|
104
|
-
|
|
104
|
+
publish: "publish";
|
|
105
105
|
}>;
|
|
106
106
|
content: z.ZodString;
|
|
107
107
|
}, z.core.$strict>;
|
|
108
|
-
export declare const
|
|
108
|
+
export declare const PublishStreamResultSchema: z.ZodObject<{
|
|
109
109
|
success: z.ZodBoolean;
|
|
110
|
-
|
|
110
|
+
publicationId: z.ZodString;
|
|
111
111
|
buildId: z.ZodString;
|
|
112
112
|
releaseId: z.ZodString;
|
|
113
113
|
status: z.ZodEnum<{
|
|
@@ -123,7 +123,7 @@ export declare const DeployStreamResultSchema: z.ZodObject<{
|
|
|
123
123
|
delete_failed: "delete_failed";
|
|
124
124
|
}>;
|
|
125
125
|
}, z.core.$strict>;
|
|
126
|
-
export declare const
|
|
126
|
+
export declare const PublishStreamPhaseEventSchema: z.ZodObject<{
|
|
127
127
|
name: z.ZodString;
|
|
128
128
|
status: z.ZodOptional<z.ZodEnum<{
|
|
129
129
|
running: "running";
|
|
@@ -133,18 +133,18 @@ export declare const DeployStreamPhaseEventSchema: z.ZodObject<{
|
|
|
133
133
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
134
134
|
type: z.ZodLiteral<"phase">;
|
|
135
135
|
}, z.core.$strict>;
|
|
136
|
-
export declare const
|
|
136
|
+
export declare const PublishStreamLogEventSchema: z.ZodObject<{
|
|
137
137
|
stream: z.ZodEnum<{
|
|
138
138
|
build: "build";
|
|
139
139
|
runtime: "runtime";
|
|
140
|
-
|
|
140
|
+
publish: "publish";
|
|
141
141
|
}>;
|
|
142
142
|
content: z.ZodString;
|
|
143
143
|
type: z.ZodLiteral<"log">;
|
|
144
144
|
}, z.core.$strict>;
|
|
145
|
-
export declare const
|
|
145
|
+
export declare const PublishStreamResultEventSchema: z.ZodObject<{
|
|
146
146
|
success: z.ZodBoolean;
|
|
147
|
-
|
|
147
|
+
publicationId: z.ZodString;
|
|
148
148
|
buildId: z.ZodString;
|
|
149
149
|
releaseId: z.ZodString;
|
|
150
150
|
status: z.ZodEnum<{
|
|
@@ -161,7 +161,7 @@ export declare const DeployStreamResultEventSchema: z.ZodObject<{
|
|
|
161
161
|
}>;
|
|
162
162
|
type: z.ZodLiteral<"result">;
|
|
163
163
|
}, z.core.$strict>;
|
|
164
|
-
export declare const
|
|
164
|
+
export declare const PublishStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
165
165
|
name: z.ZodString;
|
|
166
166
|
status: z.ZodOptional<z.ZodEnum<{
|
|
167
167
|
running: "running";
|
|
@@ -174,13 +174,13 @@ export declare const DeployStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
174
174
|
stream: z.ZodEnum<{
|
|
175
175
|
build: "build";
|
|
176
176
|
runtime: "runtime";
|
|
177
|
-
|
|
177
|
+
publish: "publish";
|
|
178
178
|
}>;
|
|
179
179
|
content: z.ZodString;
|
|
180
180
|
type: z.ZodLiteral<"log">;
|
|
181
181
|
}, z.core.$strict>, z.ZodObject<{
|
|
182
182
|
success: z.ZodBoolean;
|
|
183
|
-
|
|
183
|
+
publicationId: z.ZodString;
|
|
184
184
|
buildId: z.ZodString;
|
|
185
185
|
releaseId: z.ZodString;
|
|
186
186
|
status: z.ZodEnum<{
|
|
@@ -197,17 +197,17 @@ export declare const DeployStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
197
197
|
}>;
|
|
198
198
|
type: z.ZodLiteral<"result">;
|
|
199
199
|
}, z.core.$strict>], "type">;
|
|
200
|
-
export declare const
|
|
200
|
+
export declare const PublishStreamErrorSchema: z.ZodObject<{
|
|
201
201
|
message: z.ZodOptional<z.ZodString>;
|
|
202
202
|
}, z.core.$loose>;
|
|
203
|
-
export declare const
|
|
203
|
+
export declare const PublishStreamSseEventNameSchema: z.ZodEnum<{
|
|
204
204
|
error: "error";
|
|
205
|
-
log: "log";
|
|
206
205
|
phase: "phase";
|
|
206
|
+
log: "log";
|
|
207
207
|
result: "result";
|
|
208
208
|
done: "done";
|
|
209
209
|
}>;
|
|
210
|
-
export declare const
|
|
210
|
+
export declare const PublishStreamSsePhaseEventSchema: z.ZodObject<{
|
|
211
211
|
event: z.ZodLiteral<"phase">;
|
|
212
212
|
data: z.ZodObject<{
|
|
213
213
|
name: z.ZodString;
|
|
@@ -219,22 +219,22 @@ export declare const DeployStreamSsePhaseEventSchema: z.ZodObject<{
|
|
|
219
219
|
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
220
220
|
}, z.core.$strict>;
|
|
221
221
|
}, z.core.$strict>;
|
|
222
|
-
export declare const
|
|
222
|
+
export declare const PublishStreamSseLogEventSchema: z.ZodObject<{
|
|
223
223
|
event: z.ZodLiteral<"log">;
|
|
224
224
|
data: z.ZodObject<{
|
|
225
225
|
stream: z.ZodEnum<{
|
|
226
226
|
build: "build";
|
|
227
227
|
runtime: "runtime";
|
|
228
|
-
|
|
228
|
+
publish: "publish";
|
|
229
229
|
}>;
|
|
230
230
|
content: z.ZodString;
|
|
231
231
|
}, z.core.$strict>;
|
|
232
232
|
}, z.core.$strict>;
|
|
233
|
-
export declare const
|
|
233
|
+
export declare const PublishStreamSseDoneEventSchema: z.ZodObject<{
|
|
234
234
|
event: z.ZodLiteral<"done">;
|
|
235
235
|
data: z.ZodObject<{
|
|
236
236
|
success: z.ZodBoolean;
|
|
237
|
-
|
|
237
|
+
publicationId: z.ZodString;
|
|
238
238
|
buildId: z.ZodString;
|
|
239
239
|
releaseId: z.ZodString;
|
|
240
240
|
status: z.ZodEnum<{
|
|
@@ -251,11 +251,11 @@ export declare const DeployStreamSseDoneEventSchema: z.ZodObject<{
|
|
|
251
251
|
}>;
|
|
252
252
|
}, z.core.$strict>;
|
|
253
253
|
}, z.core.$strict>;
|
|
254
|
-
export declare const
|
|
254
|
+
export declare const PublishStreamSseResultEventSchema: z.ZodObject<{
|
|
255
255
|
event: z.ZodLiteral<"result">;
|
|
256
256
|
data: z.ZodObject<{
|
|
257
257
|
success: z.ZodBoolean;
|
|
258
|
-
|
|
258
|
+
publicationId: z.ZodString;
|
|
259
259
|
buildId: z.ZodString;
|
|
260
260
|
releaseId: z.ZodString;
|
|
261
261
|
status: z.ZodEnum<{
|
|
@@ -272,13 +272,13 @@ export declare const DeployStreamSseResultEventSchema: z.ZodObject<{
|
|
|
272
272
|
}>;
|
|
273
273
|
}, z.core.$strict>;
|
|
274
274
|
}, z.core.$strict>;
|
|
275
|
-
export declare const
|
|
275
|
+
export declare const PublishStreamSseErrorEventSchema: z.ZodObject<{
|
|
276
276
|
event: z.ZodLiteral<"error">;
|
|
277
277
|
data: z.ZodObject<{
|
|
278
278
|
message: z.ZodOptional<z.ZodString>;
|
|
279
279
|
}, z.core.$loose>;
|
|
280
280
|
}, z.core.$strict>;
|
|
281
|
-
export declare const
|
|
281
|
+
export declare const PublishStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
282
282
|
event: z.ZodLiteral<"phase">;
|
|
283
283
|
data: z.ZodObject<{
|
|
284
284
|
name: z.ZodString;
|
|
@@ -295,7 +295,7 @@ export declare const DeployStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUni
|
|
|
295
295
|
stream: z.ZodEnum<{
|
|
296
296
|
build: "build";
|
|
297
297
|
runtime: "runtime";
|
|
298
|
-
|
|
298
|
+
publish: "publish";
|
|
299
299
|
}>;
|
|
300
300
|
content: z.ZodString;
|
|
301
301
|
}, z.core.$strict>;
|
|
@@ -303,7 +303,7 @@ export declare const DeployStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUni
|
|
|
303
303
|
event: z.ZodLiteral<"done">;
|
|
304
304
|
data: z.ZodObject<{
|
|
305
305
|
success: z.ZodBoolean;
|
|
306
|
-
|
|
306
|
+
publicationId: z.ZodString;
|
|
307
307
|
buildId: z.ZodString;
|
|
308
308
|
releaseId: z.ZodString;
|
|
309
309
|
status: z.ZodEnum<{
|
|
@@ -323,7 +323,7 @@ export declare const DeployStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUni
|
|
|
323
323
|
event: z.ZodLiteral<"result">;
|
|
324
324
|
data: z.ZodObject<{
|
|
325
325
|
success: z.ZodBoolean;
|
|
326
|
-
|
|
326
|
+
publicationId: z.ZodString;
|
|
327
327
|
buildId: z.ZodString;
|
|
328
328
|
releaseId: z.ZodString;
|
|
329
329
|
status: z.ZodEnum<{
|
|
@@ -350,12 +350,12 @@ export declare const DeployStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUni
|
|
|
350
350
|
status?: "running" | "failed" | "completed";
|
|
351
351
|
data?: Record<string, unknown>;
|
|
352
352
|
} | {
|
|
353
|
-
stream: "build" | "runtime" | "
|
|
353
|
+
stream: "build" | "runtime" | "publish";
|
|
354
354
|
content: string;
|
|
355
355
|
type: "log";
|
|
356
356
|
} | {
|
|
357
357
|
success: boolean;
|
|
358
|
-
|
|
358
|
+
publicationId: string;
|
|
359
359
|
buildId: string;
|
|
360
360
|
releaseId: string;
|
|
361
361
|
status: "stopped" | "deleted" | "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "deleting" | "delete_failed";
|
|
@@ -370,14 +370,14 @@ export declare const DeployStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUni
|
|
|
370
370
|
} | {
|
|
371
371
|
event: "log";
|
|
372
372
|
data: {
|
|
373
|
-
stream: "build" | "runtime" | "
|
|
373
|
+
stream: "build" | "runtime" | "publish";
|
|
374
374
|
content: string;
|
|
375
375
|
};
|
|
376
376
|
} | {
|
|
377
377
|
event: "done";
|
|
378
378
|
data: {
|
|
379
379
|
success: boolean;
|
|
380
|
-
|
|
380
|
+
publicationId: string;
|
|
381
381
|
buildId: string;
|
|
382
382
|
releaseId: string;
|
|
383
383
|
status: "stopped" | "deleted" | "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "deleting" | "delete_failed";
|
|
@@ -386,7 +386,7 @@ export declare const DeployStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUni
|
|
|
386
386
|
event: "result";
|
|
387
387
|
data: {
|
|
388
388
|
success: boolean;
|
|
389
|
-
|
|
389
|
+
publicationId: string;
|
|
390
390
|
buildId: string;
|
|
391
391
|
releaseId: string;
|
|
392
392
|
status: "stopped" | "deleted" | "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "deleting" | "delete_failed";
|
|
@@ -398,20 +398,20 @@ export declare const DeployStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUni
|
|
|
398
398
|
message?: string;
|
|
399
399
|
};
|
|
400
400
|
}>>;
|
|
401
|
-
export type
|
|
402
|
-
export type
|
|
403
|
-
export type
|
|
404
|
-
export type
|
|
405
|
-
export type
|
|
406
|
-
export type
|
|
407
|
-
export type
|
|
408
|
-
export type
|
|
409
|
-
export type
|
|
410
|
-
export type
|
|
411
|
-
export type
|
|
412
|
-
export type
|
|
413
|
-
export type
|
|
414
|
-
export type
|
|
415
|
-
export type
|
|
416
|
-
export type
|
|
417
|
-
export type
|
|
401
|
+
export type BuiltInPublicationProviderName = z.infer<typeof PublicationProviderNameSchema>;
|
|
402
|
+
export type PublicationStatus = z.infer<typeof PublicationStatusSchema>;
|
|
403
|
+
export type PublicationBuildStatus = z.infer<typeof PublicationBuildStatusSchema>;
|
|
404
|
+
export type PublicationReleaseStatus = z.infer<typeof PublicationReleaseStatusSchema>;
|
|
405
|
+
export type PublicationSize = z.infer<typeof PublicationSizeSchema>;
|
|
406
|
+
export type PublicationRegion = z.infer<typeof PublicationRegionSchema>;
|
|
407
|
+
export type PublicationJurisdiction = z.infer<typeof PublicationJurisdictionSchema>;
|
|
408
|
+
export type PublicationDomainDnsRecordType = z.infer<typeof PublicationDomainDnsRecordTypeSchema>;
|
|
409
|
+
export type PublicationProtectionMode = z.infer<typeof PublicationProtectionModeSchema>;
|
|
410
|
+
export type PublicationLogStream = z.infer<typeof PublicationLogStreamSchema>;
|
|
411
|
+
export type PublicationEventData = z.infer<typeof PublicationEventDataSchema>;
|
|
412
|
+
export type PublicationLogChunkData = z.infer<typeof PublicationLogChunkDataSchema>;
|
|
413
|
+
export type PublishStreamPhase = z.infer<typeof PublishStreamPhaseSchema>;
|
|
414
|
+
export type PublishStreamLog = z.infer<typeof PublishStreamLogSchema>;
|
|
415
|
+
export type PublishStreamResult = z.infer<typeof PublishStreamResultSchema>;
|
|
416
|
+
export type PublishStreamEvent = z.infer<typeof PublishStreamEventSchema>;
|
|
417
|
+
export type PublishStreamSseEvent = z.infer<typeof PublishStreamSseEventSchema>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const PublicationProviderNameSchema = z.enum([
|
|
3
|
+
'cloudflare-containers',
|
|
4
|
+
'ssh-server',
|
|
5
|
+
'laravel-cloud',
|
|
6
|
+
]);
|
|
7
|
+
export const PublicationStatusSchema = z.enum([
|
|
8
|
+
'pending',
|
|
9
|
+
'queued',
|
|
10
|
+
'building',
|
|
11
|
+
'deploying',
|
|
12
|
+
'healthy',
|
|
13
|
+
'failed',
|
|
14
|
+
'stopped',
|
|
15
|
+
'deleting',
|
|
16
|
+
'deleted',
|
|
17
|
+
'delete_failed',
|
|
18
|
+
]);
|
|
19
|
+
export const PublicationBuildStatusSchema = z.enum([
|
|
20
|
+
'pending',
|
|
21
|
+
'queued',
|
|
22
|
+
'running',
|
|
23
|
+
'succeeded',
|
|
24
|
+
'failed',
|
|
25
|
+
'cancelled',
|
|
26
|
+
]);
|
|
27
|
+
export const PublicationReleaseStatusSchema = z.enum(['created', 'ready', 'deleted']);
|
|
28
|
+
export const PublicationSizeSchema = z.enum([
|
|
29
|
+
'nano',
|
|
30
|
+
'small',
|
|
31
|
+
'medium',
|
|
32
|
+
'large',
|
|
33
|
+
'lite',
|
|
34
|
+
'basic',
|
|
35
|
+
'standard-1',
|
|
36
|
+
'standard-2',
|
|
37
|
+
]);
|
|
38
|
+
export const PublicationRegionSchema = z.enum([
|
|
39
|
+
'ENAM',
|
|
40
|
+
'WNAM',
|
|
41
|
+
'EEUR',
|
|
42
|
+
'WEUR',
|
|
43
|
+
'APAC',
|
|
44
|
+
'SAM',
|
|
45
|
+
'ME',
|
|
46
|
+
'OC',
|
|
47
|
+
'AFR',
|
|
48
|
+
]);
|
|
49
|
+
export const PublicationJurisdictionSchema = z.enum(['eu', 'fedramp']);
|
|
50
|
+
export const PublicationDomainDnsRecordTypeSchema = z.enum(['CNAME', 'ALIAS', 'ANAME']);
|
|
51
|
+
export const PublicationProtectionModeSchema = z.enum(['none', 'password']);
|
|
52
|
+
export const PublicationLogStreamSchema = z.enum(['build', 'runtime']);
|
|
53
|
+
export const PublishStreamLogStreamSchema = z.enum(['build', 'publish', 'runtime']);
|
|
54
|
+
export const PublicationEventDataSchema = z.object({
|
|
55
|
+
id: z.union([z.number(), z.string()]).optional(),
|
|
56
|
+
sequence: z.number(),
|
|
57
|
+
type: z.string(),
|
|
58
|
+
payload: z.record(z.string(), z.unknown()),
|
|
59
|
+
createdAt: z.string().nullable(),
|
|
60
|
+
}).passthrough();
|
|
61
|
+
export const PublicationLogChunkDataSchema = z.object({
|
|
62
|
+
sequence: z.number(),
|
|
63
|
+
stream: PublicationLogStreamSchema,
|
|
64
|
+
content: z.string(),
|
|
65
|
+
createdAt: z.string().nullable(),
|
|
66
|
+
}).passthrough();
|
|
67
|
+
export const PublishStreamPhaseSchema = z.object({
|
|
68
|
+
name: z.string(),
|
|
69
|
+
status: z.enum(['running', 'completed', 'failed']).optional(),
|
|
70
|
+
data: z.record(z.string(), z.unknown()).optional(),
|
|
71
|
+
}).strict();
|
|
72
|
+
export const PublishStreamLogSchema = z.object({
|
|
73
|
+
stream: PublishStreamLogStreamSchema,
|
|
74
|
+
content: z.string(),
|
|
75
|
+
}).strict();
|
|
76
|
+
export const PublishStreamResultSchema = z.object({
|
|
77
|
+
success: z.boolean(),
|
|
78
|
+
publicationId: z.string(),
|
|
79
|
+
buildId: z.string(),
|
|
80
|
+
releaseId: z.string(),
|
|
81
|
+
status: PublicationStatusSchema,
|
|
82
|
+
}).strict();
|
|
83
|
+
export const PublishStreamPhaseEventSchema = PublishStreamPhaseSchema.extend({
|
|
84
|
+
type: z.literal('phase'),
|
|
85
|
+
}).strict();
|
|
86
|
+
export const PublishStreamLogEventSchema = PublishStreamLogSchema.extend({
|
|
87
|
+
type: z.literal('log'),
|
|
88
|
+
}).strict();
|
|
89
|
+
export const PublishStreamResultEventSchema = PublishStreamResultSchema.extend({
|
|
90
|
+
type: z.literal('result'),
|
|
91
|
+
}).strict();
|
|
92
|
+
export const PublishStreamEventSchema = z.discriminatedUnion('type', [
|
|
93
|
+
PublishStreamPhaseEventSchema,
|
|
94
|
+
PublishStreamLogEventSchema,
|
|
95
|
+
PublishStreamResultEventSchema,
|
|
96
|
+
]);
|
|
97
|
+
export const PublishStreamErrorSchema = z.object({
|
|
98
|
+
message: z.string().optional(),
|
|
99
|
+
}).passthrough();
|
|
100
|
+
export const PublishStreamSseEventNameSchema = z.enum(['phase', 'log', 'done', 'result', 'error']);
|
|
101
|
+
export const PublishStreamSsePhaseEventSchema = z.object({
|
|
102
|
+
event: z.literal('phase'),
|
|
103
|
+
data: PublishStreamPhaseSchema,
|
|
104
|
+
}).strict();
|
|
105
|
+
export const PublishStreamSseLogEventSchema = z.object({
|
|
106
|
+
event: z.literal('log'),
|
|
107
|
+
data: PublishStreamLogSchema,
|
|
108
|
+
}).strict();
|
|
109
|
+
export const PublishStreamSseDoneEventSchema = z.object({
|
|
110
|
+
event: z.literal('done'),
|
|
111
|
+
data: PublishStreamResultSchema,
|
|
112
|
+
}).strict();
|
|
113
|
+
export const PublishStreamSseResultEventSchema = z.object({
|
|
114
|
+
event: z.literal('result'),
|
|
115
|
+
data: PublishStreamResultSchema,
|
|
116
|
+
}).strict();
|
|
117
|
+
export const PublishStreamSseErrorEventSchema = z.object({
|
|
118
|
+
event: z.literal('error'),
|
|
119
|
+
data: PublishStreamErrorSchema,
|
|
120
|
+
}).strict();
|
|
121
|
+
export const PublishStreamSseEventSchema = z.discriminatedUnion('event', [
|
|
122
|
+
PublishStreamSsePhaseEventSchema,
|
|
123
|
+
PublishStreamSseLogEventSchema,
|
|
124
|
+
PublishStreamSseDoneEventSchema,
|
|
125
|
+
PublishStreamSseResultEventSchema,
|
|
126
|
+
PublishStreamSseErrorEventSchema,
|
|
127
|
+
]).transform((event) => {
|
|
128
|
+
if (event.event === 'error') {
|
|
129
|
+
throw new Error(event.data.message ?? 'Publish failed');
|
|
130
|
+
}
|
|
131
|
+
const type = event.event === 'done' ? 'result' : event.event;
|
|
132
|
+
return PublishStreamEventSchema.parse({ type, ...event.data });
|
|
133
|
+
});
|
package/dist/shell.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { Action,
|
|
1
|
+
import type { Action, NotebookInstance } from './index.js';
|
|
2
2
|
import type { SpawnOptions } from './terminal.js';
|
|
3
|
+
export type ProcessOutputSource = 'output' | 'stdout' | 'stderr';
|
|
4
|
+
export interface ProcessOutputChunk {
|
|
5
|
+
source: ProcessOutputSource;
|
|
6
|
+
data: Uint8Array;
|
|
7
|
+
}
|
|
3
8
|
export interface ShellEventData {
|
|
4
9
|
'shell.output': {
|
|
5
10
|
output: string;
|
|
11
|
+
source: ProcessOutputSource;
|
|
6
12
|
id: string;
|
|
7
13
|
};
|
|
8
14
|
}
|
|
@@ -16,34 +22,49 @@ export interface ShellExecInput {
|
|
|
16
22
|
opts?: Omit<SpawnOptions, 'abortSignal'>;
|
|
17
23
|
}
|
|
18
24
|
export interface ShellActions {
|
|
19
|
-
'shell.exec': Action<ShellExecInput,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
'shell.exec': Action<ShellExecInput, ProcessResultData>;
|
|
26
|
+
'shell.input': Action<{
|
|
27
|
+
id: string;
|
|
28
|
+
input: string;
|
|
29
|
+
}, boolean>;
|
|
30
|
+
'shell.kill': Action<{
|
|
31
|
+
id: string;
|
|
32
|
+
}, boolean>;
|
|
27
33
|
}
|
|
28
|
-
export
|
|
34
|
+
export interface ProcessResultData {
|
|
29
35
|
output: string;
|
|
36
|
+
stdout: string;
|
|
37
|
+
stderr: string;
|
|
30
38
|
exitCode: number;
|
|
31
|
-
constructor(output: string, exitCode: number);
|
|
32
39
|
}
|
|
33
|
-
declare class
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
export declare class CommandError extends Error {
|
|
41
|
+
readonly result: ProcessResult;
|
|
42
|
+
constructor(result: ProcessResult);
|
|
43
|
+
}
|
|
44
|
+
export declare class ProcessResult implements ProcessResultData {
|
|
45
|
+
readonly output: string;
|
|
46
|
+
readonly stdout: string;
|
|
47
|
+
readonly stderr: string;
|
|
48
|
+
readonly exitCode: number;
|
|
49
|
+
constructor(output: string, stdout: string, stderr: string, exitCode: number);
|
|
37
50
|
throw(): this;
|
|
38
51
|
}
|
|
52
|
+
export declare class ShellProcess {
|
|
53
|
+
readonly id: string;
|
|
54
|
+
private readonly okra;
|
|
55
|
+
readonly output: ReadableStream<ProcessOutputChunk>;
|
|
56
|
+
readonly stdout: ReadableStream<Uint8Array>;
|
|
57
|
+
readonly stderr: ReadableStream<Uint8Array>;
|
|
58
|
+
readonly stdin: WritableStream<Uint8Array | string>;
|
|
59
|
+
private readonly completion;
|
|
60
|
+
constructor(id: string, okra: NotebookInstance, command: string | string[], opts: SpawnOptions);
|
|
61
|
+
wait(): Promise<ProcessResult>;
|
|
62
|
+
kill(): Promise<void>;
|
|
63
|
+
}
|
|
39
64
|
export default class Shell {
|
|
40
|
-
protected okra: NotebookInstance;
|
|
65
|
+
protected readonly okra: NotebookInstance;
|
|
41
66
|
constructor(okra: NotebookInstance);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
exec(command: string | string[], opts?: SpawnOptions): Promise<Result>;
|
|
45
|
-
exec(command: string, args: string[], opts?: SpawnOptions): Promise<Result>;
|
|
46
|
-
execStream(command: string | string[], opts?: SpawnOptions): ShellExecution;
|
|
47
|
-
execStream(command: string, args: string[], opts?: SpawnOptions): ShellExecution;
|
|
67
|
+
run(command: string | string[], opts?: SpawnOptions): ShellProcess;
|
|
68
|
+
run(command: string, args: string[], opts?: SpawnOptions): ShellProcess;
|
|
48
69
|
}
|
|
49
70
|
export {};
|