@phpsandbox/sdk 0.1.19 → 0.2.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.
@@ -0,0 +1,303 @@
1
+ import type { LaravelCloudSetupState, LaravelCloudProviderData, LaravelCloudProviderInput } from './providers/laravel-cloud.js';
2
+ export type * from './providers/laravel-cloud.js';
3
+ import type { PublicationBuildStatus, PublicationJurisdiction, PublicationProtectionMode, PublicationRegion, PublicationReleaseStatus, PublicationSize, PublicationStatus } from '../schemas/publications.js';
4
+ export interface PublicationDestroyOptions {
5
+ deleteResources?: boolean;
6
+ }
7
+ export interface PublicationPlacement {
8
+ regions?: PublicationRegion[];
9
+ jurisdiction?: PublicationJurisdiction;
10
+ }
11
+ export interface PublicationProtectionData {
12
+ mode: PublicationProtectionMode;
13
+ enabled: boolean;
14
+ supported?: boolean;
15
+ token?: string;
16
+ expiresAt?: string;
17
+ url?: string;
18
+ }
19
+ export type PublicationProtectionInput = {
20
+ mode: 'none';
21
+ password?: never;
22
+ } | {
23
+ mode: 'password';
24
+ password: string;
25
+ };
26
+ export interface CloudflareContainersProviderOptions {
27
+ resources?: Partial<Record<PublicationResourceKind, PublicationResourceSelection>>;
28
+ accountId: string;
29
+ size?: PublicationSize;
30
+ sleepAfter?: string;
31
+ placement?: PublicationPlacement;
32
+ instances?: number;
33
+ }
34
+ export interface SshServerProviderOptions {
35
+ serverId: string;
36
+ resources?: Partial<Record<PublicationResourceKind, PublicationResourceSelection>>;
37
+ }
38
+ export type PublicationResourceKind = 'database' | 'cache' | 'storage' | 'worker' | 'scheduler';
39
+ export interface PublicationRequirement {
40
+ kind: PublicationResourceKind;
41
+ required?: boolean;
42
+ recommended?: boolean;
43
+ engine?: string;
44
+ reason?: string;
45
+ }
46
+ export interface PublicationReadiness {
47
+ repository: string | null;
48
+ branch: string | null;
49
+ sourceProvider: string | null;
50
+ requirements: PublicationRequirement[];
51
+ productionVariables: string[];
52
+ missingVariables: string[];
53
+ warnings: string[];
54
+ }
55
+ export type PublicationResourceMode = 'none' | 'create' | 'reuse' | 'external' | 'enable';
56
+ export interface PublicationResourceSelection {
57
+ mode: PublicationResourceMode;
58
+ id?: string;
59
+ type?: string;
60
+ version?: string;
61
+ size?: string;
62
+ config?: Record<string, string | number | boolean | null>;
63
+ }
64
+ export type PublicationPlanProviderInput<TName extends PublicationProviderName = PublicationProviderName> = {
65
+ [Name in TName]: {
66
+ name: Name;
67
+ } & Partial<PublicationProviderInputs[Name]>;
68
+ }[TName];
69
+ export interface PublicationPlanInput<TName extends PublicationProviderName = PublicationProviderName> {
70
+ slug?: string;
71
+ provider: PublicationPlanProviderInput<TName>;
72
+ requirements?: PublicationRequirement[];
73
+ resources?: Partial<Record<PublicationResourceKind, PublicationResourceSelection>>;
74
+ }
75
+ export type PlannedPublishInput = PublishInput & Pick<PublicationPlanInput, 'requirements' | 'resources'>;
76
+ export interface PublicationAccessCapabilities {
77
+ routing: 'platform' | 'provider';
78
+ protection: boolean;
79
+ feedback: boolean;
80
+ }
81
+ export interface PublicationCapabilities {
82
+ source: 'git' | 'workspace';
83
+ sourceProviders?: string[];
84
+ resourceCleanup?: boolean;
85
+ resources: Record<PublicationResourceKind, PublicationResourceMode[]>;
86
+ access: {
87
+ managed: PublicationAccessCapabilities;
88
+ custom: PublicationAccessCapabilities;
89
+ };
90
+ }
91
+ export interface PublicationCatalogConfigField {
92
+ name: string;
93
+ type: string;
94
+ required: boolean;
95
+ label?: string;
96
+ nullable?: boolean;
97
+ description?: string;
98
+ min?: number;
99
+ max?: number;
100
+ enum?: Array<string | number>;
101
+ example?: string | number;
102
+ }
103
+ export interface PublicationCatalogResourceType {
104
+ kind: PublicationResourceKind;
105
+ type: string;
106
+ label: string;
107
+ versions: string[];
108
+ regions: string[];
109
+ sizes: {
110
+ id: string;
111
+ label: string;
112
+ }[];
113
+ configFields: PublicationCatalogConfigField[];
114
+ }
115
+ export interface PublicationResourceCatalog {
116
+ provider: PublicationProviderName;
117
+ scope: string | null;
118
+ capabilities: PublicationCapabilities;
119
+ regions: {
120
+ id: string;
121
+ label: string;
122
+ flag?: string;
123
+ }[];
124
+ resourceTypes: PublicationCatalogResourceType[];
125
+ resources: {
126
+ id: string;
127
+ name: string;
128
+ kind: PublicationResourceKind;
129
+ type: string | null;
130
+ version: string | null;
131
+ region: string | null;
132
+ status: string;
133
+ }[];
134
+ pricingUrl: string | null;
135
+ }
136
+ export interface PublicationPlan<TName extends PublicationProviderName = PublicationProviderName> {
137
+ provider: TName;
138
+ capabilities: PublicationCapabilities;
139
+ readiness: PublicationReadiness;
140
+ source: {
141
+ type: 'git' | 'workspace';
142
+ repository: string | null;
143
+ branch: string | null;
144
+ commitAndPush: boolean;
145
+ providerAccess: 'verified' | 'confirmed' | 'confirmation_required' | 'not_required';
146
+ };
147
+ resources: Array<{
148
+ kind: PublicationResourceKind;
149
+ mode: PublicationResourceMode | 'unconfigured';
150
+ engine: string | null;
151
+ required: boolean;
152
+ recommended: boolean;
153
+ supported: boolean;
154
+ selection: PublicationResourceSelection | boolean | null;
155
+ }>;
156
+ blockers: Array<{
157
+ code: string;
158
+ message: string;
159
+ }>;
160
+ ready: boolean;
161
+ input: PublicationPlanInput<TName>;
162
+ cost: {
163
+ status: 'unknown';
164
+ message: string;
165
+ };
166
+ }
167
+ export interface PublicationDnsInstructions {
168
+ stage: 'ownership' | 'traffic' | 'connected';
169
+ records: PublicationDnsRecord[];
170
+ trafficRecords: PublicationDnsRecord[];
171
+ }
172
+ export interface PublicationProviderInputs {
173
+ 'cloudflare-containers': CloudflareContainersProviderOptions;
174
+ 'ssh-server': SshServerProviderOptions;
175
+ 'laravel-cloud': LaravelCloudProviderInput;
176
+ }
177
+ export interface PublicationProviderData {
178
+ 'cloudflare-containers': CloudflareContainersProviderOptions;
179
+ 'ssh-server': SshServerProviderOptions;
180
+ 'laravel-cloud': LaravelCloudProviderData;
181
+ }
182
+ export type PublicationProviderName = Extract<keyof PublicationProviderInputs, string>;
183
+ export type PublicationProviderInput<TName extends PublicationProviderName = PublicationProviderName> = {
184
+ [Name in TName]: {
185
+ name: Name;
186
+ } & PublicationProviderInputs[Name];
187
+ }[TName];
188
+ export type PublicationProvider<TName extends PublicationProviderName = PublicationProviderName> = {
189
+ [Name in TName]: {
190
+ name: Name;
191
+ } & PublicationProviderData[Name];
192
+ }[TName];
193
+ export interface PublishInput<TName extends PublicationProviderName = PublicationProviderName> {
194
+ slug: string;
195
+ provider: PublicationProviderInput<TName>;
196
+ protection?: PublicationProtectionInput;
197
+ metadata?: Record<string, unknown>;
198
+ }
199
+ export interface PublicationBuildData<TProvider extends PublicationProviderName = PublicationProviderName> {
200
+ id: string;
201
+ status: PublicationBuildStatus;
202
+ strategy: string;
203
+ provider: PublicationProvider<TProvider>;
204
+ errorMessage: string | null;
205
+ startedAt: string | null;
206
+ finishedAt: string | null;
207
+ }
208
+ export interface PublicationReleaseData {
209
+ id: string;
210
+ status: PublicationReleaseStatus;
211
+ manifest: Record<string, unknown>;
212
+ }
213
+ export interface PublicationData<TProvider extends PublicationProviderName = PublicationProviderName> {
214
+ capabilities?: PublicationCapabilities;
215
+ id: string;
216
+ slug: string;
217
+ url: string;
218
+ status: PublicationStatus;
219
+ strategy: string;
220
+ provider: PublicationProvider<TProvider>;
221
+ protection: PublicationProtectionData;
222
+ eventStreamUrl: string | null;
223
+ originUrl: string | null;
224
+ domains?: PublicationDomainData[];
225
+ setupState?: LaravelCloudSetupState | null;
226
+ currentRelease?: PublicationReleaseData | null;
227
+ latestBuild?: PublicationBuildData<TProvider> | null;
228
+ deployedAt: string | null;
229
+ createdAt: string | null;
230
+ updatedAt: string | null;
231
+ }
232
+ export interface UpdatePublicationProtectionInput {
233
+ mode: PublicationProtectionMode;
234
+ password?: string;
235
+ }
236
+ export interface PublicationProtectionSessionData {
237
+ previewSessionId: string;
238
+ token: string;
239
+ expiresAt: string;
240
+ url: string;
241
+ }
242
+ export interface PublicationDnsRecord {
243
+ type: string;
244
+ name: string;
245
+ value: string;
246
+ purpose?: 'ownership' | 'certificate' | 'traffic';
247
+ }
248
+ export interface PublicationDomainData {
249
+ id: string;
250
+ publicationId: string | null;
251
+ hostname: string;
252
+ status: string;
253
+ provider: string;
254
+ providerHostnameId: string | null;
255
+ dns: {
256
+ type: string | null;
257
+ name: string | null;
258
+ value: string | null;
259
+ };
260
+ ssl: {
261
+ status: string | null;
262
+ };
263
+ dnsInstructions: PublicationDnsInstructions;
264
+ validationErrors: unknown[];
265
+ validationRecords: unknown[];
266
+ metadata: Record<string, unknown>;
267
+ verifiedAt: string | null;
268
+ createdAt: string | null;
269
+ updatedAt: string | null;
270
+ }
271
+ export interface PublicationManagedResource {
272
+ id: string;
273
+ parentId: string | null;
274
+ provider: PublicationProviderName;
275
+ scope: string;
276
+ providerId: string;
277
+ kind: 'database' | 'cache' | 'storage';
278
+ name: string;
279
+ type: string | null;
280
+ version: string | null;
281
+ managed: boolean;
282
+ status: 'pending' | 'provisioning' | 'available' | 'unknown' | 'retained' | 'deleting' | 'delete_failed' | 'deleted';
283
+ observation?: {
284
+ status: 'present' | 'missing' | 'unreachable' | 'unauthorized' | 'unsupported';
285
+ message: string;
286
+ checkedAt: string;
287
+ } | null;
288
+ attachments: PublicationResourceAttachment[];
289
+ attachmentCount: number;
290
+ createdAt: string;
291
+ }
292
+ export interface PublicationResourceListOptions {
293
+ provider?: PublicationProviderName;
294
+ kind?: PublicationManagedResource['kind'];
295
+ type?: string;
296
+ scope?: string;
297
+ page?: number;
298
+ }
299
+ export interface PublicationResourceAttachment {
300
+ notebookId: string | null;
301
+ publicationId: string | null;
302
+ detachedAt: string | null;
303
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -7,7 +7,7 @@ export declare class RestRuntimeInvoker {
7
7
  private ticket;
8
8
  private refreshPromise;
9
9
  private readonly notebookId;
10
- constructor(data: NotebookData, fetch: typeof globalThis.fetch, refresh?: () => Promise<string>);
10
+ constructor(data: NotebookData, fetch: typeof globalThis.fetch, refresh?: (() => Promise<string>) | undefined);
11
11
  private configure;
12
12
  ready(): Promise<NotebookInitSuccessResult>;
13
13
  supports(action: string): action is RestRuntimeAction;
@@ -5,33 +5,33 @@ export declare const PublicationProviderNameSchema: z.ZodEnum<{
5
5
  "laravel-cloud": "laravel-cloud";
6
6
  }>;
7
7
  export declare const PublicationStatusSchema: z.ZodEnum<{
8
- stopped: "stopped";
9
- deleted: "deleted";
10
8
  pending: "pending";
11
9
  queued: "queued";
12
10
  building: "building";
13
11
  deploying: "deploying";
14
12
  healthy: "healthy";
15
13
  failed: "failed";
14
+ stopped: "stopped";
16
15
  deleting: "deleting";
16
+ deleted: "deleted";
17
17
  delete_failed: "delete_failed";
18
18
  }>;
19
19
  export declare const PublicationBuildStatusSchema: z.ZodEnum<{
20
- running: "running";
21
20
  pending: "pending";
22
21
  queued: "queued";
23
22
  failed: "failed";
23
+ running: "running";
24
24
  succeeded: "succeeded";
25
25
  cancelled: "cancelled";
26
26
  }>;
27
27
  export declare const PublicationReleaseStatusSchema: z.ZodEnum<{
28
- created: "created";
29
28
  deleted: "deleted";
29
+ created: "created";
30
30
  ready: "ready";
31
31
  }>;
32
32
  export declare const PublicationSizeSchema: z.ZodEnum<{
33
- small: "small";
34
33
  nano: "nano";
34
+ small: "small";
35
35
  medium: "medium";
36
36
  large: "large";
37
37
  lite: "lite";
@@ -86,8 +86,8 @@ export declare const PublicationLogChunkDataSchema: z.ZodObject<{
86
86
  export declare const PublishStreamPhaseSchema: z.ZodObject<{
87
87
  name: z.ZodString;
88
88
  status: z.ZodOptional<z.ZodEnum<{
89
- running: "running";
90
89
  failed: "failed";
90
+ running: "running";
91
91
  completed: "completed";
92
92
  }>>;
93
93
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -107,23 +107,23 @@ export declare const PublishStreamResultSchema: z.ZodObject<{
107
107
  buildId: z.ZodString;
108
108
  releaseId: z.ZodString;
109
109
  status: z.ZodEnum<{
110
- stopped: "stopped";
111
- deleted: "deleted";
112
110
  pending: "pending";
113
111
  queued: "queued";
114
112
  building: "building";
115
113
  deploying: "deploying";
116
114
  healthy: "healthy";
117
115
  failed: "failed";
116
+ stopped: "stopped";
118
117
  deleting: "deleting";
118
+ deleted: "deleted";
119
119
  delete_failed: "delete_failed";
120
120
  }>;
121
121
  }, z.core.$strict>;
122
122
  export declare const PublishStreamPhaseEventSchema: z.ZodObject<{
123
123
  name: z.ZodString;
124
124
  status: z.ZodOptional<z.ZodEnum<{
125
- running: "running";
126
125
  failed: "failed";
126
+ running: "running";
127
127
  completed: "completed";
128
128
  }>>;
129
129
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -145,15 +145,15 @@ export declare const PublishStreamResultEventSchema: z.ZodObject<{
145
145
  buildId: z.ZodString;
146
146
  releaseId: z.ZodString;
147
147
  status: z.ZodEnum<{
148
- stopped: "stopped";
149
- deleted: "deleted";
150
148
  pending: "pending";
151
149
  queued: "queued";
152
150
  building: "building";
153
151
  deploying: "deploying";
154
152
  healthy: "healthy";
155
153
  failed: "failed";
154
+ stopped: "stopped";
156
155
  deleting: "deleting";
156
+ deleted: "deleted";
157
157
  delete_failed: "delete_failed";
158
158
  }>;
159
159
  type: z.ZodLiteral<"result">;
@@ -161,8 +161,8 @@ export declare const PublishStreamResultEventSchema: z.ZodObject<{
161
161
  export declare const PublishStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
162
162
  name: z.ZodString;
163
163
  status: z.ZodOptional<z.ZodEnum<{
164
- running: "running";
165
164
  failed: "failed";
165
+ running: "running";
166
166
  completed: "completed";
167
167
  }>>;
168
168
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -182,15 +182,15 @@ export declare const PublishStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObj
182
182
  buildId: z.ZodString;
183
183
  releaseId: z.ZodString;
184
184
  status: z.ZodEnum<{
185
- stopped: "stopped";
186
- deleted: "deleted";
187
185
  pending: "pending";
188
186
  queued: "queued";
189
187
  building: "building";
190
188
  deploying: "deploying";
191
189
  healthy: "healthy";
192
190
  failed: "failed";
191
+ stopped: "stopped";
193
192
  deleting: "deleting";
193
+ deleted: "deleted";
194
194
  delete_failed: "delete_failed";
195
195
  }>;
196
196
  type: z.ZodLiteral<"result">;
@@ -199,19 +199,19 @@ export declare const PublishStreamErrorSchema: z.ZodObject<{
199
199
  message: z.ZodOptional<z.ZodString>;
200
200
  }, z.core.$loose>;
201
201
  export declare const PublishStreamSseEventNameSchema: z.ZodEnum<{
202
- error: "error";
203
202
  phase: "phase";
204
203
  log: "log";
205
204
  result: "result";
206
205
  done: "done";
206
+ error: "error";
207
207
  }>;
208
208
  export declare const PublishStreamSsePhaseEventSchema: z.ZodObject<{
209
209
  event: z.ZodLiteral<"phase">;
210
210
  data: z.ZodObject<{
211
211
  name: z.ZodString;
212
212
  status: z.ZodOptional<z.ZodEnum<{
213
- running: "running";
214
213
  failed: "failed";
214
+ running: "running";
215
215
  completed: "completed";
216
216
  }>>;
217
217
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -237,15 +237,15 @@ export declare const PublishStreamSseDoneEventSchema: z.ZodObject<{
237
237
  buildId: z.ZodString;
238
238
  releaseId: z.ZodString;
239
239
  status: z.ZodEnum<{
240
- stopped: "stopped";
241
- deleted: "deleted";
242
240
  pending: "pending";
243
241
  queued: "queued";
244
242
  building: "building";
245
243
  deploying: "deploying";
246
244
  healthy: "healthy";
247
245
  failed: "failed";
246
+ stopped: "stopped";
248
247
  deleting: "deleting";
248
+ deleted: "deleted";
249
249
  delete_failed: "delete_failed";
250
250
  }>;
251
251
  }, z.core.$strict>;
@@ -259,15 +259,15 @@ export declare const PublishStreamSseResultEventSchema: z.ZodObject<{
259
259
  buildId: z.ZodString;
260
260
  releaseId: z.ZodString;
261
261
  status: z.ZodEnum<{
262
- stopped: "stopped";
263
- deleted: "deleted";
264
262
  pending: "pending";
265
263
  queued: "queued";
266
264
  building: "building";
267
265
  deploying: "deploying";
268
266
  healthy: "healthy";
269
267
  failed: "failed";
268
+ stopped: "stopped";
270
269
  deleting: "deleting";
270
+ deleted: "deleted";
271
271
  delete_failed: "delete_failed";
272
272
  }>;
273
273
  }, z.core.$strict>;
@@ -283,8 +283,8 @@ export declare const PublishStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUn
283
283
  data: z.ZodObject<{
284
284
  name: z.ZodString;
285
285
  status: z.ZodOptional<z.ZodEnum<{
286
- running: "running";
287
286
  failed: "failed";
287
+ running: "running";
288
288
  completed: "completed";
289
289
  }>>;
290
290
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -308,15 +308,15 @@ export declare const PublishStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUn
308
308
  buildId: z.ZodString;
309
309
  releaseId: z.ZodString;
310
310
  status: z.ZodEnum<{
311
- stopped: "stopped";
312
- deleted: "deleted";
313
311
  pending: "pending";
314
312
  queued: "queued";
315
313
  building: "building";
316
314
  deploying: "deploying";
317
315
  healthy: "healthy";
318
316
  failed: "failed";
317
+ stopped: "stopped";
319
318
  deleting: "deleting";
319
+ deleted: "deleted";
320
320
  delete_failed: "delete_failed";
321
321
  }>;
322
322
  }, z.core.$strict>;
@@ -329,15 +329,15 @@ export declare const PublishStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUn
329
329
  buildId: z.ZodString;
330
330
  releaseId: z.ZodString;
331
331
  status: z.ZodEnum<{
332
- stopped: "stopped";
333
- deleted: "deleted";
334
332
  pending: "pending";
335
333
  queued: "queued";
336
334
  building: "building";
337
335
  deploying: "deploying";
338
336
  healthy: "healthy";
339
337
  failed: "failed";
338
+ stopped: "stopped";
340
339
  deleting: "deleting";
340
+ deleted: "deleted";
341
341
  delete_failed: "delete_failed";
342
342
  }>;
343
343
  }, z.core.$strict>;
@@ -349,8 +349,8 @@ export declare const PublishStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUn
349
349
  }, z.core.$strict>], "event">, z.ZodTransform<{
350
350
  name: string;
351
351
  type: "phase";
352
- status?: "running" | "failed" | "completed";
353
- data?: Record<string, unknown>;
352
+ status?: "failed" | "running" | "completed" | undefined;
353
+ data?: Record<string, unknown> | undefined;
354
354
  } | {
355
355
  stream: "runtime" | "build" | "publish";
356
356
  content: string;
@@ -361,14 +361,14 @@ export declare const PublishStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUn
361
361
  url: string;
362
362
  buildId: string;
363
363
  releaseId: string;
364
- status: "stopped" | "deleted" | "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "deleting" | "delete_failed";
364
+ status: "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "stopped" | "deleting" | "deleted" | "delete_failed";
365
365
  type: "result";
366
366
  }, {
367
367
  event: "phase";
368
368
  data: {
369
369
  name: string;
370
- status?: "running" | "failed" | "completed";
371
- data?: Record<string, unknown>;
370
+ status?: "failed" | "running" | "completed" | undefined;
371
+ data?: Record<string, unknown> | undefined;
372
372
  };
373
373
  } | {
374
374
  event: "log";
@@ -384,7 +384,7 @@ export declare const PublishStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUn
384
384
  url: string;
385
385
  buildId: string;
386
386
  releaseId: string;
387
- status: "stopped" | "deleted" | "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "deleting" | "delete_failed";
387
+ status: "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "stopped" | "deleting" | "deleted" | "delete_failed";
388
388
  };
389
389
  } | {
390
390
  event: "result";
@@ -394,13 +394,13 @@ export declare const PublishStreamSseEventSchema: z.ZodPipe<z.ZodDiscriminatedUn
394
394
  url: string;
395
395
  buildId: string;
396
396
  releaseId: string;
397
- status: "stopped" | "deleted" | "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "deleting" | "delete_failed";
397
+ status: "pending" | "queued" | "building" | "deploying" | "healthy" | "failed" | "stopped" | "deleting" | "deleted" | "delete_failed";
398
398
  };
399
399
  } | {
400
400
  event: "error";
401
401
  data: {
402
402
  [x: string]: unknown;
403
- message?: string;
403
+ message?: string | undefined;
404
404
  };
405
405
  }>>;
406
406
  export type BuiltInPublicationProviderName = z.infer<typeof PublicationProviderNameSchema>;
package/dist/servers.d.ts CHANGED
@@ -35,6 +35,9 @@ export declare class ServerInstance {
35
35
  readonly data: ServerData;
36
36
  private readonly client;
37
37
  constructor(data: ServerData, client: Client);
38
+ installation(): Promise<{
39
+ installCommand: string;
40
+ }>;
38
41
  refresh(): Promise<ServerInstance>;
39
42
  delete(): Promise<void>;
40
43
  waitReady(options?: {
package/dist/servers.js CHANGED
@@ -20,6 +20,9 @@ export class ServerInstance {
20
20
  this.data = data;
21
21
  this.client = client;
22
22
  }
23
+ async installation() {
24
+ return (await this.client.get(`/servers/${encodeURIComponent(this.data.id)}/installation`)).data;
25
+ }
23
26
  refresh() {
24
27
  return this.client.servers.get(this.data.id);
25
28
  }
@@ -31,12 +31,12 @@ export declare class ConnectionTimeoutError extends TransportError<'ConnectionTi
31
31
  constructor(message?: string);
32
32
  }
33
33
  export declare class ConnectionFailedError extends TransportError<'ConnectionFailed'> {
34
- readonly originalError?: unknown;
35
- constructor(message: string, originalError?: unknown);
34
+ readonly originalError?: unknown | undefined;
35
+ constructor(message: string, originalError?: unknown | undefined);
36
36
  }
37
37
  export declare class InvalidMessageError extends TransportError<'InvalidResponse'> {
38
- readonly data?: unknown;
39
- constructor(message: string, data?: unknown);
38
+ readonly data?: unknown | undefined;
39
+ constructor(message: string, data?: unknown | undefined);
40
40
  }
41
41
  export declare class InvalidConfigurationError extends Error {
42
42
  constructor(message: string);
@@ -67,7 +67,7 @@ export class Transport {
67
67
  this.validateConfiguration(options);
68
68
  this.url = typeof url === 'string' ? new URL(url) : null;
69
69
  const urlProvider = typeof url === 'string'
70
- ? this.url.toString()
70
+ ? new URL(url).toString()
71
71
  : async () => new URL(await url()).toString();
72
72
  // Use configurable ping interval
73
73
  this.PING_INTERVAL = options.pingInterval ?? 30000;
@@ -313,7 +313,9 @@ export class Transport {
313
313
  }
314
314
  onDidBootError(listener) {
315
315
  return this.eventEmitter.listen('transport.boot_error', (event) => {
316
- listener(event.error);
316
+ if (event && typeof event === 'object' && 'error' in event && RemoteError.is(event.error, 'NotebookUnavailable')) {
317
+ listener(event.error);
318
+ }
317
319
  });
318
320
  }
319
321
  removeListener(event, listener) {
@@ -323,7 +325,7 @@ export class Transport {
323
325
  return this.eventEmitter.once(event, listener, context);
324
326
  }
325
327
  emit(event, ...data) {
326
- this.eventEmitter.emit(event, ...data);
328
+ this.eventEmitter.emit(event, data.length > 1 ? data : data[0]);
327
329
  }
328
330
  get isConnected() {
329
331
  return this.status === 'OPEN';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phpsandbox/sdk",
3
- "version": "0.1.19",
3
+ "version": "0.2.0",
4
4
  "description": "The TypeScript SDK for PHPSandbox cloud development environments",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",