@phpsandbox/sdk 0.0.57 → 0.0.58

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.
@@ -0,0 +1,417 @@
1
+ import { z } from 'zod';
2
+ export declare const DeploymentTargetProviderSchema: z.ZodEnum<{
3
+ okraCloudflareContainer: "okraCloudflareContainer";
4
+ okraSshAgent: "okraSshAgent";
5
+ okraLaravelCloud: "okraLaravelCloud";
6
+ }>;
7
+ export declare const DeploymentStatusSchema: z.ZodEnum<{
8
+ stopped: "stopped";
9
+ deleted: "deleted";
10
+ pending: "pending";
11
+ queued: "queued";
12
+ building: "building";
13
+ deploying: "deploying";
14
+ healthy: "healthy";
15
+ failed: "failed";
16
+ deleting: "deleting";
17
+ delete_failed: "delete_failed";
18
+ }>;
19
+ export declare const DeploymentBuildStatusSchema: z.ZodEnum<{
20
+ running: "running";
21
+ pending: "pending";
22
+ queued: "queued";
23
+ failed: "failed";
24
+ succeeded: "succeeded";
25
+ cancelled: "cancelled";
26
+ }>;
27
+ export declare const DeploymentReleaseStatusSchema: z.ZodEnum<{
28
+ created: "created";
29
+ deleted: "deleted";
30
+ ready: "ready";
31
+ }>;
32
+ export declare const DeploymentSizeSchema: z.ZodEnum<{
33
+ small: "small";
34
+ basic: "basic";
35
+ nano: "nano";
36
+ medium: "medium";
37
+ large: "large";
38
+ lite: "lite";
39
+ "standard-1": "standard-1";
40
+ "standard-2": "standard-2";
41
+ }>;
42
+ export declare const DeploymentRegionSchema: z.ZodEnum<{
43
+ ENAM: "ENAM";
44
+ WNAM: "WNAM";
45
+ EEUR: "EEUR";
46
+ WEUR: "WEUR";
47
+ APAC: "APAC";
48
+ SAM: "SAM";
49
+ ME: "ME";
50
+ OC: "OC";
51
+ AFR: "AFR";
52
+ }>;
53
+ export declare const DeploymentJurisdictionSchema: z.ZodEnum<{
54
+ eu: "eu";
55
+ fedramp: "fedramp";
56
+ }>;
57
+ export declare const DeploymentDomainDnsRecordTypeSchema: z.ZodEnum<{
58
+ CNAME: "CNAME";
59
+ ALIAS: "ALIAS";
60
+ ANAME: "ANAME";
61
+ }>;
62
+ export declare const DeploymentProtectionModeSchema: z.ZodEnum<{
63
+ none: "none";
64
+ password: "password";
65
+ }>;
66
+ export declare const DeploymentLogStreamSchema: z.ZodEnum<{
67
+ build: "build";
68
+ runtime: "runtime";
69
+ }>;
70
+ export declare const DeployStreamLogStreamSchema: z.ZodEnum<{
71
+ build: "build";
72
+ runtime: "runtime";
73
+ deploy: "deploy";
74
+ }>;
75
+ export declare const DeploymentEventDataSchema: z.ZodObject<{
76
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
77
+ sequence: z.ZodNumber;
78
+ type: z.ZodString;
79
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
80
+ createdAt: z.ZodNullable<z.ZodString>;
81
+ }, z.core.$loose>;
82
+ export declare const DeploymentLogChunkDataSchema: z.ZodObject<{
83
+ sequence: z.ZodNumber;
84
+ stream: z.ZodEnum<{
85
+ build: "build";
86
+ runtime: "runtime";
87
+ }>;
88
+ content: z.ZodString;
89
+ createdAt: z.ZodNullable<z.ZodString>;
90
+ }, z.core.$loose>;
91
+ export declare const DeployStreamPhaseSchema: z.ZodObject<{
92
+ name: z.ZodString;
93
+ status: z.ZodOptional<z.ZodEnum<{
94
+ running: "running";
95
+ failed: "failed";
96
+ completed: "completed";
97
+ }>>;
98
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
99
+ }, z.core.$strict>;
100
+ export declare const DeployStreamLogSchema: z.ZodObject<{
101
+ stream: z.ZodEnum<{
102
+ build: "build";
103
+ runtime: "runtime";
104
+ deploy: "deploy";
105
+ }>;
106
+ content: z.ZodString;
107
+ }, z.core.$strict>;
108
+ export declare const DeployStreamResultSchema: z.ZodObject<{
109
+ success: z.ZodBoolean;
110
+ deploymentId: z.ZodString;
111
+ buildId: z.ZodString;
112
+ releaseId: z.ZodString;
113
+ status: z.ZodEnum<{
114
+ stopped: "stopped";
115
+ deleted: "deleted";
116
+ pending: "pending";
117
+ queued: "queued";
118
+ building: "building";
119
+ deploying: "deploying";
120
+ healthy: "healthy";
121
+ failed: "failed";
122
+ deleting: "deleting";
123
+ delete_failed: "delete_failed";
124
+ }>;
125
+ }, z.core.$strict>;
126
+ export declare const DeployStreamPhaseEventSchema: z.ZodObject<{
127
+ name: z.ZodString;
128
+ status: z.ZodOptional<z.ZodEnum<{
129
+ running: "running";
130
+ failed: "failed";
131
+ completed: "completed";
132
+ }>>;
133
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
134
+ type: z.ZodLiteral<"phase">;
135
+ }, z.core.$strict>;
136
+ export declare const DeployStreamLogEventSchema: z.ZodObject<{
137
+ stream: z.ZodEnum<{
138
+ build: "build";
139
+ runtime: "runtime";
140
+ deploy: "deploy";
141
+ }>;
142
+ content: z.ZodString;
143
+ type: z.ZodLiteral<"log">;
144
+ }, z.core.$strict>;
145
+ export declare const DeployStreamResultEventSchema: z.ZodObject<{
146
+ success: z.ZodBoolean;
147
+ deploymentId: z.ZodString;
148
+ buildId: z.ZodString;
149
+ releaseId: z.ZodString;
150
+ status: z.ZodEnum<{
151
+ stopped: "stopped";
152
+ deleted: "deleted";
153
+ pending: "pending";
154
+ queued: "queued";
155
+ building: "building";
156
+ deploying: "deploying";
157
+ healthy: "healthy";
158
+ failed: "failed";
159
+ deleting: "deleting";
160
+ delete_failed: "delete_failed";
161
+ }>;
162
+ type: z.ZodLiteral<"result">;
163
+ }, z.core.$strict>;
164
+ export declare const DeployStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
165
+ name: z.ZodString;
166
+ status: z.ZodOptional<z.ZodEnum<{
167
+ running: "running";
168
+ failed: "failed";
169
+ completed: "completed";
170
+ }>>;
171
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
172
+ type: z.ZodLiteral<"phase">;
173
+ }, z.core.$strict>, z.ZodObject<{
174
+ stream: z.ZodEnum<{
175
+ build: "build";
176
+ runtime: "runtime";
177
+ deploy: "deploy";
178
+ }>;
179
+ content: z.ZodString;
180
+ type: z.ZodLiteral<"log">;
181
+ }, z.core.$strict>, z.ZodObject<{
182
+ success: z.ZodBoolean;
183
+ deploymentId: z.ZodString;
184
+ buildId: z.ZodString;
185
+ releaseId: z.ZodString;
186
+ status: z.ZodEnum<{
187
+ stopped: "stopped";
188
+ deleted: "deleted";
189
+ pending: "pending";
190
+ queued: "queued";
191
+ building: "building";
192
+ deploying: "deploying";
193
+ healthy: "healthy";
194
+ failed: "failed";
195
+ deleting: "deleting";
196
+ delete_failed: "delete_failed";
197
+ }>;
198
+ type: z.ZodLiteral<"result">;
199
+ }, z.core.$strict>], "type">;
200
+ export declare const DeployStreamErrorSchema: z.ZodObject<{
201
+ message: z.ZodOptional<z.ZodString>;
202
+ }, z.core.$loose>;
203
+ export declare const DeployStreamSseEventNameSchema: z.ZodEnum<{
204
+ error: "error";
205
+ log: "log";
206
+ phase: "phase";
207
+ result: "result";
208
+ done: "done";
209
+ }>;
210
+ export declare const DeployStreamSsePhaseEventSchema: z.ZodObject<{
211
+ event: z.ZodLiteral<"phase">;
212
+ data: z.ZodObject<{
213
+ name: z.ZodString;
214
+ status: z.ZodOptional<z.ZodEnum<{
215
+ running: "running";
216
+ failed: "failed";
217
+ completed: "completed";
218
+ }>>;
219
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
220
+ }, z.core.$strict>;
221
+ }, z.core.$strict>;
222
+ export declare const DeployStreamSseLogEventSchema: z.ZodObject<{
223
+ event: z.ZodLiteral<"log">;
224
+ data: z.ZodObject<{
225
+ stream: z.ZodEnum<{
226
+ build: "build";
227
+ runtime: "runtime";
228
+ deploy: "deploy";
229
+ }>;
230
+ content: z.ZodString;
231
+ }, z.core.$strict>;
232
+ }, z.core.$strict>;
233
+ export declare const DeployStreamSseDoneEventSchema: z.ZodObject<{
234
+ event: z.ZodLiteral<"done">;
235
+ data: z.ZodObject<{
236
+ success: z.ZodBoolean;
237
+ deploymentId: z.ZodString;
238
+ buildId: z.ZodString;
239
+ releaseId: z.ZodString;
240
+ status: z.ZodEnum<{
241
+ stopped: "stopped";
242
+ deleted: "deleted";
243
+ pending: "pending";
244
+ queued: "queued";
245
+ building: "building";
246
+ deploying: "deploying";
247
+ healthy: "healthy";
248
+ failed: "failed";
249
+ deleting: "deleting";
250
+ delete_failed: "delete_failed";
251
+ }>;
252
+ }, z.core.$strict>;
253
+ }, z.core.$strict>;
254
+ export declare const DeployStreamSseResultEventSchema: z.ZodObject<{
255
+ event: z.ZodLiteral<"result">;
256
+ data: z.ZodObject<{
257
+ success: z.ZodBoolean;
258
+ deploymentId: z.ZodString;
259
+ buildId: z.ZodString;
260
+ releaseId: z.ZodString;
261
+ status: z.ZodEnum<{
262
+ stopped: "stopped";
263
+ deleted: "deleted";
264
+ pending: "pending";
265
+ queued: "queued";
266
+ building: "building";
267
+ deploying: "deploying";
268
+ healthy: "healthy";
269
+ failed: "failed";
270
+ deleting: "deleting";
271
+ delete_failed: "delete_failed";
272
+ }>;
273
+ }, z.core.$strict>;
274
+ }, z.core.$strict>;
275
+ export declare const DeployStreamSseErrorEventSchema: z.ZodObject<{
276
+ event: z.ZodLiteral<"error">;
277
+ data: z.ZodObject<{
278
+ message: z.ZodOptional<z.ZodString>;
279
+ }, z.core.$loose>;
280
+ }, z.core.$strict>;
281
+ export declare const DeployStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject<{
282
+ event: z.ZodLiteral<"phase">;
283
+ data: z.ZodObject<{
284
+ name: z.ZodString;
285
+ status: z.ZodOptional<z.ZodEnum<{
286
+ running: "running";
287
+ failed: "failed";
288
+ completed: "completed";
289
+ }>>;
290
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
291
+ }, z.core.$strict>;
292
+ }, z.core.$strict>, z.ZodObject<{
293
+ event: z.ZodLiteral<"log">;
294
+ data: z.ZodObject<{
295
+ stream: z.ZodEnum<{
296
+ build: "build";
297
+ runtime: "runtime";
298
+ deploy: "deploy";
299
+ }>;
300
+ content: z.ZodString;
301
+ }, z.core.$strict>;
302
+ }, z.core.$strict>, z.ZodObject<{
303
+ event: z.ZodLiteral<"done">;
304
+ data: z.ZodObject<{
305
+ success: z.ZodBoolean;
306
+ deploymentId: z.ZodString;
307
+ buildId: z.ZodString;
308
+ releaseId: z.ZodString;
309
+ status: z.ZodEnum<{
310
+ stopped: "stopped";
311
+ deleted: "deleted";
312
+ pending: "pending";
313
+ queued: "queued";
314
+ building: "building";
315
+ deploying: "deploying";
316
+ healthy: "healthy";
317
+ failed: "failed";
318
+ deleting: "deleting";
319
+ delete_failed: "delete_failed";
320
+ }>;
321
+ }, z.core.$strict>;
322
+ }, z.core.$strict>, z.ZodObject<{
323
+ event: z.ZodLiteral<"result">;
324
+ data: z.ZodObject<{
325
+ success: z.ZodBoolean;
326
+ deploymentId: z.ZodString;
327
+ buildId: z.ZodString;
328
+ releaseId: z.ZodString;
329
+ status: z.ZodEnum<{
330
+ stopped: "stopped";
331
+ deleted: "deleted";
332
+ pending: "pending";
333
+ queued: "queued";
334
+ building: "building";
335
+ deploying: "deploying";
336
+ healthy: "healthy";
337
+ failed: "failed";
338
+ deleting: "deleting";
339
+ delete_failed: "delete_failed";
340
+ }>;
341
+ }, z.core.$strict>;
342
+ }, z.core.$strict>, z.ZodObject<{
343
+ event: z.ZodLiteral<"error">;
344
+ data: z.ZodObject<{
345
+ message: z.ZodOptional<z.ZodString>;
346
+ }, z.core.$loose>;
347
+ }, z.core.$strict>], "event">, z.ZodTransform<{
348
+ name: string;
349
+ type: "phase";
350
+ status?: "running" | "failed" | "completed";
351
+ data?: Record<string, unknown>;
352
+ } | {
353
+ stream: "build" | "runtime" | "deploy";
354
+ content: string;
355
+ type: "log";
356
+ } | {
357
+ success: boolean;
358
+ deploymentId: string;
359
+ buildId: string;
360
+ releaseId: string;
361
+ status: "stopped" | "deleted" | "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "deleting" | "delete_failed";
362
+ type: "result";
363
+ }, {
364
+ event: "phase";
365
+ data: {
366
+ name: string;
367
+ status?: "running" | "failed" | "completed";
368
+ data?: Record<string, unknown>;
369
+ };
370
+ } | {
371
+ event: "log";
372
+ data: {
373
+ stream: "build" | "runtime" | "deploy";
374
+ content: string;
375
+ };
376
+ } | {
377
+ event: "done";
378
+ data: {
379
+ success: boolean;
380
+ deploymentId: string;
381
+ buildId: string;
382
+ releaseId: string;
383
+ status: "stopped" | "deleted" | "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "deleting" | "delete_failed";
384
+ };
385
+ } | {
386
+ event: "result";
387
+ data: {
388
+ success: boolean;
389
+ deploymentId: string;
390
+ buildId: string;
391
+ releaseId: string;
392
+ status: "stopped" | "deleted" | "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "deleting" | "delete_failed";
393
+ };
394
+ } | {
395
+ event: "error";
396
+ data: {
397
+ [x: string]: unknown;
398
+ message?: string;
399
+ };
400
+ }>>;
401
+ export type DeploymentTargetProvider = z.infer<typeof DeploymentTargetProviderSchema>;
402
+ export type DeploymentStatus = z.infer<typeof DeploymentStatusSchema>;
403
+ export type DeploymentBuildStatus = z.infer<typeof DeploymentBuildStatusSchema>;
404
+ export type DeploymentReleaseStatus = z.infer<typeof DeploymentReleaseStatusSchema>;
405
+ export type DeploymentSize = z.infer<typeof DeploymentSizeSchema>;
406
+ export type DeploymentRegion = z.infer<typeof DeploymentRegionSchema>;
407
+ export type DeploymentJurisdiction = z.infer<typeof DeploymentJurisdictionSchema>;
408
+ export type DeploymentDomainDnsRecordType = z.infer<typeof DeploymentDomainDnsRecordTypeSchema>;
409
+ export type DeploymentProtectionMode = z.infer<typeof DeploymentProtectionModeSchema>;
410
+ export type DeploymentLogStream = z.infer<typeof DeploymentLogStreamSchema>;
411
+ export type DeploymentEventData = z.infer<typeof DeploymentEventDataSchema>;
412
+ export type DeploymentLogChunkData = z.infer<typeof DeploymentLogChunkDataSchema>;
413
+ export type DeployStreamPhase = z.infer<typeof DeployStreamPhaseSchema>;
414
+ export type DeployStreamLog = z.infer<typeof DeployStreamLogSchema>;
415
+ export type DeployStreamResult = z.infer<typeof DeployStreamResultSchema>;
416
+ export type DeployStreamEvent = z.infer<typeof DeployStreamEventSchema>;
417
+ export type DeployStreamSseEvent = z.infer<typeof DeployStreamSseEventSchema>;
@@ -0,0 +1,133 @@
1
+ import { z } from 'zod';
2
+ export const DeploymentTargetProviderSchema = z.enum([
3
+ 'okraCloudflareContainer',
4
+ 'okraSshAgent',
5
+ 'okraLaravelCloud',
6
+ ]);
7
+ export const DeploymentStatusSchema = 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 DeploymentBuildStatusSchema = z.enum([
20
+ 'pending',
21
+ 'queued',
22
+ 'running',
23
+ 'succeeded',
24
+ 'failed',
25
+ 'cancelled',
26
+ ]);
27
+ export const DeploymentReleaseStatusSchema = z.enum(['created', 'ready', 'deleted']);
28
+ export const DeploymentSizeSchema = z.enum([
29
+ 'nano',
30
+ 'small',
31
+ 'medium',
32
+ 'large',
33
+ 'lite',
34
+ 'basic',
35
+ 'standard-1',
36
+ 'standard-2',
37
+ ]);
38
+ export const DeploymentRegionSchema = z.enum([
39
+ 'ENAM',
40
+ 'WNAM',
41
+ 'EEUR',
42
+ 'WEUR',
43
+ 'APAC',
44
+ 'SAM',
45
+ 'ME',
46
+ 'OC',
47
+ 'AFR',
48
+ ]);
49
+ export const DeploymentJurisdictionSchema = z.enum(['eu', 'fedramp']);
50
+ export const DeploymentDomainDnsRecordTypeSchema = z.enum(['CNAME', 'ALIAS', 'ANAME']);
51
+ export const DeploymentProtectionModeSchema = z.enum(['none', 'password']);
52
+ export const DeploymentLogStreamSchema = z.enum(['build', 'runtime']);
53
+ export const DeployStreamLogStreamSchema = z.enum(['build', 'deploy', 'runtime']);
54
+ export const DeploymentEventDataSchema = 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 DeploymentLogChunkDataSchema = z.object({
62
+ sequence: z.number(),
63
+ stream: DeploymentLogStreamSchema,
64
+ content: z.string(),
65
+ createdAt: z.string().nullable(),
66
+ }).passthrough();
67
+ export const DeployStreamPhaseSchema = 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 DeployStreamLogSchema = z.object({
73
+ stream: DeployStreamLogStreamSchema,
74
+ content: z.string(),
75
+ }).strict();
76
+ export const DeployStreamResultSchema = z.object({
77
+ success: z.boolean(),
78
+ deploymentId: z.string(),
79
+ buildId: z.string(),
80
+ releaseId: z.string(),
81
+ status: DeploymentStatusSchema,
82
+ }).strict();
83
+ export const DeployStreamPhaseEventSchema = DeployStreamPhaseSchema.extend({
84
+ type: z.literal('phase'),
85
+ }).strict();
86
+ export const DeployStreamLogEventSchema = DeployStreamLogSchema.extend({
87
+ type: z.literal('log'),
88
+ }).strict();
89
+ export const DeployStreamResultEventSchema = DeployStreamResultSchema.extend({
90
+ type: z.literal('result'),
91
+ }).strict();
92
+ export const DeployStreamEventSchema = z.discriminatedUnion('type', [
93
+ DeployStreamPhaseEventSchema,
94
+ DeployStreamLogEventSchema,
95
+ DeployStreamResultEventSchema,
96
+ ]);
97
+ export const DeployStreamErrorSchema = z.object({
98
+ message: z.string().optional(),
99
+ }).passthrough();
100
+ export const DeployStreamSseEventNameSchema = z.enum(['phase', 'log', 'done', 'result', 'error']);
101
+ export const DeployStreamSsePhaseEventSchema = z.object({
102
+ event: z.literal('phase'),
103
+ data: DeployStreamPhaseSchema,
104
+ }).strict();
105
+ export const DeployStreamSseLogEventSchema = z.object({
106
+ event: z.literal('log'),
107
+ data: DeployStreamLogSchema,
108
+ }).strict();
109
+ export const DeployStreamSseDoneEventSchema = z.object({
110
+ event: z.literal('done'),
111
+ data: DeployStreamResultSchema,
112
+ }).strict();
113
+ export const DeployStreamSseResultEventSchema = z.object({
114
+ event: z.literal('result'),
115
+ data: DeployStreamResultSchema,
116
+ }).strict();
117
+ export const DeployStreamSseErrorEventSchema = z.object({
118
+ event: z.literal('error'),
119
+ data: DeployStreamErrorSchema,
120
+ }).strict();
121
+ export const DeployStreamSseEventSchema = z.discriminatedUnion('event', [
122
+ DeployStreamSsePhaseEventSchema,
123
+ DeployStreamSseLogEventSchema,
124
+ DeployStreamSseDoneEventSchema,
125
+ DeployStreamSseResultEventSchema,
126
+ DeployStreamSseErrorEventSchema,
127
+ ]).transform((event) => {
128
+ if (event.event === 'error') {
129
+ throw new Error(event.data.message ?? 'Deploy failed');
130
+ }
131
+ const type = event.event === 'done' ? 'result' : event.event;
132
+ return DeployStreamEventSchema.parse({ type, ...event.data });
133
+ });
@@ -0,0 +1,42 @@
1
+ import type { Client, PaginatedApiResponse } from './index.js';
2
+ export interface ServerData {
3
+ id: string;
4
+ name: string;
5
+ host: string;
6
+ provider: string;
7
+ status: string;
8
+ token?: string;
9
+ sshPublicKey?: string;
10
+ installCommand?: string;
11
+ connectedAt: string | null;
12
+ createdAt: string | null;
13
+ updatedAt: string | null;
14
+ }
15
+ export interface ServerSshOptions {
16
+ user?: string;
17
+ port?: number;
18
+ }
19
+ export interface CreateServerInput {
20
+ name: string;
21
+ host: string;
22
+ ssh?: ServerSshOptions;
23
+ }
24
+ export declare class ServerApi {
25
+ private readonly client;
26
+ constructor(client: Client);
27
+ list(): Promise<PaginatedApiResponse<ServerData>>;
28
+ create(input: CreateServerInput): Promise<ServerInstance>;
29
+ get(id: string): Promise<ServerInstance>;
30
+ delete(id: string): Promise<void>;
31
+ }
32
+ export declare class ServerInstance {
33
+ readonly data: ServerData;
34
+ private readonly client;
35
+ constructor(data: ServerData, client: Client);
36
+ refresh(): Promise<ServerInstance>;
37
+ delete(): Promise<void>;
38
+ waitReady(options?: {
39
+ timeout?: number;
40
+ interval?: number;
41
+ }): Promise<ServerInstance>;
42
+ }
@@ -0,0 +1,48 @@
1
+ export class ServerApi {
2
+ constructor(client) {
3
+ this.client = client;
4
+ }
5
+ async list() {
6
+ const response = await this.client.get('/servers');
7
+ return response.data;
8
+ }
9
+ async create(input) {
10
+ const response = await this.client.post('/servers', input);
11
+ return new ServerInstance(response.data, this.client);
12
+ }
13
+ async get(id) {
14
+ const response = await this.client.get(`/servers/${id}`);
15
+ return new ServerInstance(response.data, this.client);
16
+ }
17
+ async delete(id) {
18
+ await this.client.delete(`/servers/${id}`);
19
+ }
20
+ }
21
+ export class ServerInstance {
22
+ constructor(data, client) {
23
+ this.data = data;
24
+ this.client = client;
25
+ }
26
+ refresh() {
27
+ return this.client.servers.get(this.data.id);
28
+ }
29
+ delete() {
30
+ return this.client.servers.delete(this.data.id);
31
+ }
32
+ async waitReady(options) {
33
+ const timeout = options?.timeout ?? 300000; // 5 minutes default
34
+ const interval = options?.interval ?? 3000; // poll every 3s
35
+ const deadline = Date.now() + timeout;
36
+ while (Date.now() < deadline) {
37
+ const server = await this.refresh();
38
+ if (server.data.status === 'connected') {
39
+ return server;
40
+ }
41
+ if (server.data.status === 'failed') {
42
+ throw new Error(`Server provisioning failed: ${server.data.id}`);
43
+ }
44
+ await new Promise(resolve => setTimeout(resolve, interval));
45
+ }
46
+ throw new Error(`Server did not become ready within ${timeout}ms`);
47
+ }
48
+ }
@@ -75,7 +75,7 @@ const client = new PHPSandbox(token, 'https://api.phpsandbox.io/v1', {
75
75
  ### Git (`notebook.git`)
76
76
 
77
77
  - `checkpoint(author, message, branch = 'main')`
78
- - `sync(url, author, ref?, token?, direction?, force?)`
78
+ - `sync({ provider, repository, author, branch?, credential, direction?, visibility?, setDefault? })`
79
79
  - `diff({ url?, token?, ref?, base?, target? })`
80
80
  - `merge({ url?, token?, ref?, target?, expectedBaseRef?, author?, message? })`
81
81
  - `conflicts()`
@@ -6,6 +6,34 @@
6
6
  PHPSANDBOX_TOKEN=your-token npx tsx examples/basic.ts
7
7
  ```
8
8
 
9
+ ### Running Deployment Examples
10
+
11
+ Cloudflare Containers target:
12
+
13
+ ```bash
14
+ PHPSANDBOX_TOKEN=your-token PHPSANDBOX_NOTEBOOK_ID=notebook-id \
15
+ npx tsx examples/deploy-cloudflare-container.ts
16
+ ```
17
+
18
+ SSH agent target:
19
+
20
+ ```bash
21
+ PHPSANDBOX_TOKEN=your-token PHPSANDBOX_NOTEBOOK_ID=notebook-id \
22
+ npx tsx examples/deploy-ssh-agent.ts
23
+ ```
24
+
25
+ Laravel Cloud target:
26
+
27
+ ```bash
28
+ PHPSANDBOX_TOKEN=your-token PHPSANDBOX_NOTEBOOK_ID=notebook-id \
29
+ PHPSANDBOX_LARAVEL_CLOUD_REPOSITORY=owner/repo \
30
+ PHPSANDBOX_GITHUB_TOKEN=github-token \
31
+ PHPSANDBOX_LARAVEL_CLOUD_API_KEY=lc-api-key \
32
+ npx tsx examples/deploy-laravel-cloud.ts
33
+ ```
34
+
35
+ Deployment examples accept `PHPSANDBOX_API_URL` and `PHPSANDBOX_DEPLOY_SLUG`. On the first run they create the notebook's deployment; later runs publish the existing deployment without changing slug or provider. The SSH example creates a server registration when `PHPSANDBOX_DEPLOY_SERVER_ID` is not set; on local `.test` APIs it also starts local Rook from `PHPSANDBOX_ROOK_DIR` or the sibling `rook` repo. The Laravel Cloud example syncs the notebook to `PHPSANDBOX_LARAVEL_CLOUD_REPOSITORY`, upserts `PHPSANDBOX_GITHUB_TOKEN` into `GITHUB_TOKEN`, and upserts `PHPSANDBOX_LARAVEL_CLOUD_API_KEY` into `LARAVEL_CLOUD_API_KEY` on first publish.
36
+
9
37
  ### Running The Laravel Load Test
10
38
 
11
39
  When stdout is a TTY, the load test renders a live dashboard with current stage, active scenarios, and rolling results. When output is redirected or piped, it falls back to plain logs.