@phpsandbox/sdk 0.3.3 → 0.3.5
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 +19 -0
- package/dist/beacon/index.js +4 -2
- package/dist/beacon/navigator.js +0 -1
- package/dist/beacon/types.d.ts +1 -1
- package/dist/browser/phpsandbox-sdk.esm.js +345 -287
- package/dist/browser/phpsandbox-sdk.esm.min.js +9 -9
- package/dist/browser/phpsandbox-sdk.iife.js +345 -287
- package/dist/browser/phpsandbox-sdk.iife.min.js +9 -9
- package/dist/composer.js +8 -4
- package/dist/errors/index.d.ts +2 -2
- package/dist/errors/index.js +1 -3
- package/dist/feedback.js +2 -1
- package/dist/filesystem.js +32 -15
- package/dist/identity.d.ts +13 -0
- package/dist/identity.js +6 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +17 -8
- package/dist/integrations/sandbox.js +1 -1
- package/dist/lsp.d.ts +2 -2
- package/dist/lsp.js +2 -2
- package/dist/publication/instance.js +1 -0
- package/dist/publication/notebook.js +7 -5
- package/dist/publication/resources.js +2 -1
- package/dist/publication/stream.js +36 -19
- package/dist/runtime/rest.js +2 -1
- package/dist/runtime.js +1 -1
- package/dist/schemas/publications.js +53 -59
- package/dist/servers.d.ts +31 -1
- package/dist/servers.js +34 -3
- package/dist/shell.js +5 -2
- package/dist/socket/index.js +25 -13
- package/dist/telemetry.js +8 -3
- package/dist/terminal.js +3 -4
- package/dist/utils/promise.js +1 -1
- package/dist/utils/websocket.js +2 -2
- package/package.json +44 -33
- package/dist/auth.d.ts +0 -11
- package/dist/auth.js +0 -12
|
@@ -12,137 +12,6 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
12
12
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
13
13
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
14
14
|
|
|
15
|
-
// src/errors/index.ts
|
|
16
|
-
var remoteErrorCodes = [
|
|
17
|
-
"ActionNotFound",
|
|
18
|
-
"AuthenticationRequired",
|
|
19
|
-
"BadGateway",
|
|
20
|
-
"BadRequest",
|
|
21
|
-
"Conflict",
|
|
22
|
-
"FileAlreadyExists",
|
|
23
|
-
"FileIsDirectory",
|
|
24
|
-
"FileNotDirectory",
|
|
25
|
-
"FileNotFound",
|
|
26
|
-
"FilesystemUnavailable",
|
|
27
|
-
"InternalError",
|
|
28
|
-
"InvalidArgument",
|
|
29
|
-
"InvalidConfiguration",
|
|
30
|
-
"InvalidRequest",
|
|
31
|
-
"InvalidResponse",
|
|
32
|
-
"InvalidServiceCommand",
|
|
33
|
-
"MethodNotAllowed",
|
|
34
|
-
"NotebookInitializationFailed",
|
|
35
|
-
"NotebookUnavailable",
|
|
36
|
-
"NotFound",
|
|
37
|
-
"PayloadTooLarge",
|
|
38
|
-
"PermissionDenied",
|
|
39
|
-
"RateLimited",
|
|
40
|
-
"RequestFailed",
|
|
41
|
-
"RuntimeOperationFailed",
|
|
42
|
-
"ServiceNotFound",
|
|
43
|
-
"ServiceUnavailable",
|
|
44
|
-
"UnprocessableEntity",
|
|
45
|
-
"ValidationFailed",
|
|
46
|
-
"WorkspaceUnavailable"
|
|
47
|
-
];
|
|
48
|
-
var PHPSandboxError = class extends Error {
|
|
49
|
-
constructor(message, cause) {
|
|
50
|
-
super(message);
|
|
51
|
-
this.name = new.target.name;
|
|
52
|
-
this.cause = cause;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
var RemoteError = class _RemoteError extends PHPSandboxError {
|
|
56
|
-
constructor(message, options) {
|
|
57
|
-
super(message, options.cause);
|
|
58
|
-
this.source = options.source;
|
|
59
|
-
this.status = options.status;
|
|
60
|
-
this.code = options.code;
|
|
61
|
-
this.details = options.details;
|
|
62
|
-
}
|
|
63
|
-
static is(error51, code) {
|
|
64
|
-
return error51 instanceof _RemoteError && (code === void 0 || error51.code === code);
|
|
65
|
-
}
|
|
66
|
-
static isValidation(error51) {
|
|
67
|
-
return _RemoteError.is(error51, "ValidationFailed") && validationDetails(error51.details) !== void 0;
|
|
68
|
-
}
|
|
69
|
-
is(code) {
|
|
70
|
-
return this.code === code;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
var TransportError = class _TransportError extends PHPSandboxError {
|
|
74
|
-
constructor(message, code, cause, response) {
|
|
75
|
-
super(message, cause);
|
|
76
|
-
this.code = code;
|
|
77
|
-
this.response = response;
|
|
78
|
-
}
|
|
79
|
-
static is(error51, code) {
|
|
80
|
-
return error51 instanceof _TransportError && (code === void 0 || error51.code === code);
|
|
81
|
-
}
|
|
82
|
-
is(code) {
|
|
83
|
-
return this.code === code;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
function remoteError(source, payload, cause) {
|
|
87
|
-
const error51 = record(payload);
|
|
88
|
-
const status = positiveInteger(error51?.status);
|
|
89
|
-
const code = nonEmptyString(error51?.code);
|
|
90
|
-
const message = nonEmptyString(error51?.message);
|
|
91
|
-
if (status === void 0 || !isRemoteErrorCode(code) || message === void 0) {
|
|
92
|
-
throw new TransportError("PHPSandbox returned an invalid error response.", "InvalidResponse", cause ?? payload);
|
|
93
|
-
}
|
|
94
|
-
return new RemoteError(message, {
|
|
95
|
-
source,
|
|
96
|
-
status,
|
|
97
|
-
code,
|
|
98
|
-
details: error51?.details,
|
|
99
|
-
cause
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
function isRemoteErrorCode(value) {
|
|
103
|
-
return typeof value === "string" && remoteErrorCodes.includes(value);
|
|
104
|
-
}
|
|
105
|
-
function positiveInteger(value) {
|
|
106
|
-
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
107
|
-
}
|
|
108
|
-
function nonEmptyString(value) {
|
|
109
|
-
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
110
|
-
}
|
|
111
|
-
function record(value) {
|
|
112
|
-
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
113
|
-
}
|
|
114
|
-
function stringArrayRecord(value) {
|
|
115
|
-
const candidate = record(value);
|
|
116
|
-
if (candidate === void 0) {
|
|
117
|
-
return void 0;
|
|
118
|
-
}
|
|
119
|
-
const entries = Object.entries(candidate);
|
|
120
|
-
if (!entries.every(([, messages]) => Array.isArray(messages) && messages.every((message) => typeof message === "string"))) {
|
|
121
|
-
return void 0;
|
|
122
|
-
}
|
|
123
|
-
return Object.fromEntries(entries);
|
|
124
|
-
}
|
|
125
|
-
function validationDetails(value) {
|
|
126
|
-
const details = record(value);
|
|
127
|
-
const errors = stringArrayRecord(details?.errors);
|
|
128
|
-
return errors === void 0 ? void 0 : { errors };
|
|
129
|
-
}
|
|
130
|
-
var PromiseTimeoutError = class extends Error {
|
|
131
|
-
constructor(message, time3) {
|
|
132
|
-
super(message);
|
|
133
|
-
this.time = time3;
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
var SendTimeoutError = class _SendTimeoutError extends TransportError {
|
|
137
|
-
constructor(message, time3, cause) {
|
|
138
|
-
super(message, "SendTimeout", cause);
|
|
139
|
-
this.time = time3;
|
|
140
|
-
}
|
|
141
|
-
static fromPromiseTimeoutError(error51) {
|
|
142
|
-
return new _SendTimeoutError(error51.message, error51.time, error51);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
15
|
// node_modules/zod/v4/classic/external.js
|
|
147
16
|
var external_exports = {};
|
|
148
17
|
__export(external_exports, {
|
|
@@ -337,7 +206,7 @@ __export(external_exports, {
|
|
|
337
206
|
promise: () => promise,
|
|
338
207
|
property: () => _property,
|
|
339
208
|
readonly: () => readonly,
|
|
340
|
-
record: () =>
|
|
209
|
+
record: () => record,
|
|
341
210
|
refine: () => refine,
|
|
342
211
|
regex: () => _regex,
|
|
343
212
|
regexes: () => regexes_exports,
|
|
@@ -12675,7 +12544,7 @@ __export(schemas_exports2, {
|
|
|
12675
12544
|
preprocess: () => preprocess,
|
|
12676
12545
|
promise: () => promise,
|
|
12677
12546
|
readonly: () => readonly,
|
|
12678
|
-
record: () =>
|
|
12547
|
+
record: () => record,
|
|
12679
12548
|
refine: () => refine,
|
|
12680
12549
|
set: () => set,
|
|
12681
12550
|
strictObject: () => strictObject,
|
|
@@ -13644,7 +13513,7 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
|
13644
13513
|
inst.keyType = def.keyType;
|
|
13645
13514
|
inst.valueType = def.valueType;
|
|
13646
13515
|
});
|
|
13647
|
-
function
|
|
13516
|
+
function record(keyType, valueType, params) {
|
|
13648
13517
|
if (!valueType || !valueType._zod) {
|
|
13649
13518
|
return new ZodRecord({
|
|
13650
13519
|
type: "record",
|
|
@@ -14111,7 +13980,7 @@ var stringbool = (...args) => _stringbool({
|
|
|
14111
13980
|
}, ...args);
|
|
14112
13981
|
function json(params) {
|
|
14113
13982
|
const jsonSchema = lazy(() => {
|
|
14114
|
-
return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema),
|
|
13983
|
+
return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
|
|
14115
13984
|
});
|
|
14116
13985
|
return jsonSchema;
|
|
14117
13986
|
}
|
|
@@ -14657,12 +14526,146 @@ function date4(params) {
|
|
|
14657
14526
|
// node_modules/zod/v4/classic/external.js
|
|
14658
14527
|
config(en_default());
|
|
14659
14528
|
|
|
14529
|
+
// src/identity.ts
|
|
14530
|
+
var identitySchema = external_exports.object({
|
|
14531
|
+
user: external_exports.object({ id: external_exports.string(), name: external_exports.string() }).nullable(),
|
|
14532
|
+
organization: external_exports.object({ id: external_exports.string(), name: external_exports.string() }),
|
|
14533
|
+
permissions: external_exports.array(external_exports.string())
|
|
14534
|
+
});
|
|
14535
|
+
|
|
14536
|
+
// src/errors/index.ts
|
|
14537
|
+
var remoteErrorCodes = [
|
|
14538
|
+
"ActionNotFound",
|
|
14539
|
+
"AuthenticationRequired",
|
|
14540
|
+
"BadGateway",
|
|
14541
|
+
"BadRequest",
|
|
14542
|
+
"Conflict",
|
|
14543
|
+
"FileAlreadyExists",
|
|
14544
|
+
"FileIsDirectory",
|
|
14545
|
+
"FileNotDirectory",
|
|
14546
|
+
"FileNotFound",
|
|
14547
|
+
"FilesystemUnavailable",
|
|
14548
|
+
"InternalError",
|
|
14549
|
+
"InvalidArgument",
|
|
14550
|
+
"InvalidConfiguration",
|
|
14551
|
+
"InvalidRequest",
|
|
14552
|
+
"InvalidResponse",
|
|
14553
|
+
"InvalidServiceCommand",
|
|
14554
|
+
"MethodNotAllowed",
|
|
14555
|
+
"NotebookInitializationFailed",
|
|
14556
|
+
"NotebookUnavailable",
|
|
14557
|
+
"NotFound",
|
|
14558
|
+
"PayloadTooLarge",
|
|
14559
|
+
"PermissionDenied",
|
|
14560
|
+
"RateLimited",
|
|
14561
|
+
"RequestFailed",
|
|
14562
|
+
"RuntimeOperationFailed",
|
|
14563
|
+
"ServiceNotFound",
|
|
14564
|
+
"ServiceUnavailable",
|
|
14565
|
+
"UnprocessableEntity",
|
|
14566
|
+
"ValidationFailed",
|
|
14567
|
+
"WorkspaceUnavailable"
|
|
14568
|
+
];
|
|
14569
|
+
var PHPSandboxError = class extends Error {
|
|
14570
|
+
constructor(message, cause) {
|
|
14571
|
+
super(message);
|
|
14572
|
+
this.name = new.target.name;
|
|
14573
|
+
this.cause = cause;
|
|
14574
|
+
}
|
|
14575
|
+
};
|
|
14576
|
+
var RemoteError = class _RemoteError extends PHPSandboxError {
|
|
14577
|
+
constructor(message, options) {
|
|
14578
|
+
super(message, options.cause);
|
|
14579
|
+
this.source = options.source;
|
|
14580
|
+
this.status = options.status;
|
|
14581
|
+
this.code = options.code;
|
|
14582
|
+
this.details = options.details;
|
|
14583
|
+
}
|
|
14584
|
+
static is(error51, code) {
|
|
14585
|
+
return error51 instanceof _RemoteError && (code === void 0 || error51.code === code);
|
|
14586
|
+
}
|
|
14587
|
+
static isValidation(error51) {
|
|
14588
|
+
return _RemoteError.is(error51, "ValidationFailed") && validationDetails(error51.details) !== void 0;
|
|
14589
|
+
}
|
|
14590
|
+
is(code) {
|
|
14591
|
+
return this.code === code;
|
|
14592
|
+
}
|
|
14593
|
+
};
|
|
14594
|
+
var TransportError = class _TransportError extends PHPSandboxError {
|
|
14595
|
+
constructor(message, code, cause, response) {
|
|
14596
|
+
super(message, cause);
|
|
14597
|
+
this.code = code;
|
|
14598
|
+
this.response = response;
|
|
14599
|
+
}
|
|
14600
|
+
static is(error51, code) {
|
|
14601
|
+
return error51 instanceof _TransportError && (code === void 0 || error51.code === code);
|
|
14602
|
+
}
|
|
14603
|
+
is(code) {
|
|
14604
|
+
return this.code === code;
|
|
14605
|
+
}
|
|
14606
|
+
};
|
|
14607
|
+
function remoteError(source, payload, cause) {
|
|
14608
|
+
const error51 = record2(payload);
|
|
14609
|
+
const status = positiveInteger(error51?.status);
|
|
14610
|
+
const code = nonEmptyString(error51?.code);
|
|
14611
|
+
const message = nonEmptyString(error51?.message);
|
|
14612
|
+
if (status === void 0 || !isRemoteErrorCode(code) || message === void 0) {
|
|
14613
|
+
throw new TransportError("PHPSandbox returned an invalid error response.", "InvalidResponse", cause ?? payload);
|
|
14614
|
+
}
|
|
14615
|
+
return new RemoteError(message, {
|
|
14616
|
+
source,
|
|
14617
|
+
status,
|
|
14618
|
+
code,
|
|
14619
|
+
details: error51?.details,
|
|
14620
|
+
cause
|
|
14621
|
+
});
|
|
14622
|
+
}
|
|
14623
|
+
function isRemoteErrorCode(value) {
|
|
14624
|
+
return typeof value === "string" && remoteErrorCodes.includes(value);
|
|
14625
|
+
}
|
|
14626
|
+
function positiveInteger(value) {
|
|
14627
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
|
|
14628
|
+
}
|
|
14629
|
+
function nonEmptyString(value) {
|
|
14630
|
+
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
14631
|
+
}
|
|
14632
|
+
function record2(value) {
|
|
14633
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
14634
|
+
}
|
|
14635
|
+
function stringArrayRecord(value) {
|
|
14636
|
+
const candidate = record2(value);
|
|
14637
|
+
if (candidate === void 0) {
|
|
14638
|
+
return void 0;
|
|
14639
|
+
}
|
|
14640
|
+
const entries = Object.entries(candidate);
|
|
14641
|
+
if (!entries.every(([, messages]) => Array.isArray(messages) && messages.every((message) => typeof message === "string"))) {
|
|
14642
|
+
return void 0;
|
|
14643
|
+
}
|
|
14644
|
+
return Object.fromEntries(entries);
|
|
14645
|
+
}
|
|
14646
|
+
function validationDetails(value) {
|
|
14647
|
+
const details = record2(value);
|
|
14648
|
+
const errors = stringArrayRecord(details?.errors);
|
|
14649
|
+
return errors === void 0 ? void 0 : { errors };
|
|
14650
|
+
}
|
|
14651
|
+
var PromiseTimeoutError = class extends Error {
|
|
14652
|
+
constructor(message, time3) {
|
|
14653
|
+
super(message);
|
|
14654
|
+
this.time = time3;
|
|
14655
|
+
}
|
|
14656
|
+
};
|
|
14657
|
+
var SendTimeoutError = class _SendTimeoutError extends TransportError {
|
|
14658
|
+
constructor(message, time3, cause) {
|
|
14659
|
+
super(message, "SendTimeout", cause);
|
|
14660
|
+
this.time = time3;
|
|
14661
|
+
}
|
|
14662
|
+
static fromPromiseTimeoutError(error51) {
|
|
14663
|
+
return new _SendTimeoutError(error51.message, error51.time, error51);
|
|
14664
|
+
}
|
|
14665
|
+
};
|
|
14666
|
+
|
|
14660
14667
|
// src/schemas/publications.ts
|
|
14661
|
-
var PublicationProviderNameSchema = external_exports.enum([
|
|
14662
|
-
"cloudflare-containers",
|
|
14663
|
-
"ssh-server",
|
|
14664
|
-
"laravel-cloud"
|
|
14665
|
-
]);
|
|
14668
|
+
var PublicationProviderNameSchema = external_exports.enum(["cloudflare-containers", "ssh-server", "laravel-cloud"]);
|
|
14666
14669
|
var PublicationStatusSchema = external_exports.enum([
|
|
14667
14670
|
"pending",
|
|
14668
14671
|
"queued",
|
|
@@ -14675,36 +14678,10 @@ var PublicationStatusSchema = external_exports.enum([
|
|
|
14675
14678
|
"deleted",
|
|
14676
14679
|
"delete_failed"
|
|
14677
14680
|
]);
|
|
14678
|
-
var PublicationBuildStatusSchema = external_exports.enum([
|
|
14679
|
-
"pending",
|
|
14680
|
-
"queued",
|
|
14681
|
-
"running",
|
|
14682
|
-
"succeeded",
|
|
14683
|
-
"failed",
|
|
14684
|
-
"cancelled"
|
|
14685
|
-
]);
|
|
14681
|
+
var PublicationBuildStatusSchema = external_exports.enum(["pending", "queued", "running", "succeeded", "failed", "cancelled"]);
|
|
14686
14682
|
var PublicationReleaseStatusSchema = external_exports.enum(["created", "ready", "deleted"]);
|
|
14687
|
-
var PublicationSizeSchema = external_exports.enum([
|
|
14688
|
-
|
|
14689
|
-
"small",
|
|
14690
|
-
"medium",
|
|
14691
|
-
"large",
|
|
14692
|
-
"lite",
|
|
14693
|
-
"basic",
|
|
14694
|
-
"standard-1",
|
|
14695
|
-
"standard-2"
|
|
14696
|
-
]);
|
|
14697
|
-
var PublicationRegionSchema = external_exports.enum([
|
|
14698
|
-
"ENAM",
|
|
14699
|
-
"WNAM",
|
|
14700
|
-
"EEUR",
|
|
14701
|
-
"WEUR",
|
|
14702
|
-
"APAC",
|
|
14703
|
-
"SAM",
|
|
14704
|
-
"ME",
|
|
14705
|
-
"OC",
|
|
14706
|
-
"AFR"
|
|
14707
|
-
]);
|
|
14683
|
+
var PublicationSizeSchema = external_exports.enum(["nano", "small", "medium", "large", "lite", "basic", "standard-1", "standard-2"]);
|
|
14684
|
+
var PublicationRegionSchema = external_exports.enum(["ENAM", "WNAM", "EEUR", "WEUR", "APAC", "SAM", "ME", "OC", "AFR"]);
|
|
14708
14685
|
var PublicationJurisdictionSchema = external_exports.enum(["eu", "fedramp"]);
|
|
14709
14686
|
var PublicationProtectionModeSchema = external_exports.enum(["none", "password"]);
|
|
14710
14687
|
var PublicationLogStreamSchema = external_exports.enum(["build", "runtime"]);
|
|
@@ -14814,7 +14791,9 @@ async function* readPublicationStream(input, options = {}) {
|
|
|
14814
14791
|
const lines = data;
|
|
14815
14792
|
eventName = "message";
|
|
14816
14793
|
data = [];
|
|
14817
|
-
if (!lines.length || !PublishStreamSseEventNameSchema.safeParse(name).success)
|
|
14794
|
+
if (!lines.length || !PublishStreamSseEventNameSchema.safeParse(name).success) {
|
|
14795
|
+
return null;
|
|
14796
|
+
}
|
|
14818
14797
|
const raw = lines.join("\n");
|
|
14819
14798
|
let payload;
|
|
14820
14799
|
try {
|
|
@@ -14823,18 +14802,30 @@ async function* readPublicationStream(input, options = {}) {
|
|
|
14823
14802
|
payload = raw;
|
|
14824
14803
|
}
|
|
14825
14804
|
const event = PublishStreamSseEventSchema.parse({ event: name, data: payload });
|
|
14826
|
-
if (event.type === "result")
|
|
14805
|
+
if (event.type === "result") {
|
|
14806
|
+
receivedResult = true;
|
|
14807
|
+
}
|
|
14827
14808
|
return event;
|
|
14828
14809
|
}
|
|
14829
14810
|
function line(value) {
|
|
14830
|
-
if (value === "")
|
|
14831
|
-
|
|
14811
|
+
if (value === "") {
|
|
14812
|
+
return dispatch();
|
|
14813
|
+
}
|
|
14814
|
+
if (value.startsWith(":")) {
|
|
14815
|
+
return null;
|
|
14816
|
+
}
|
|
14832
14817
|
const colon = value.indexOf(":");
|
|
14833
14818
|
const field = colon < 0 ? value : value.slice(0, colon);
|
|
14834
14819
|
let content = colon < 0 ? "" : value.slice(colon + 1);
|
|
14835
|
-
if (content.startsWith(" "))
|
|
14836
|
-
|
|
14837
|
-
|
|
14820
|
+
if (content.startsWith(" ")) {
|
|
14821
|
+
content = content.slice(1);
|
|
14822
|
+
}
|
|
14823
|
+
if (field === "event") {
|
|
14824
|
+
eventName = content;
|
|
14825
|
+
}
|
|
14826
|
+
if (field === "data") {
|
|
14827
|
+
data.push(content);
|
|
14828
|
+
}
|
|
14838
14829
|
return null;
|
|
14839
14830
|
}
|
|
14840
14831
|
try {
|
|
@@ -14843,19 +14834,27 @@ async function* readPublicationStream(input, options = {}) {
|
|
|
14843
14834
|
buffer += done ? decoder.decode() : decoder.decode(value, { stream: true });
|
|
14844
14835
|
let match;
|
|
14845
14836
|
while (match = /\r\n|\r|\n/.exec(buffer)) {
|
|
14846
|
-
if (!done && match[0] === "\r" && match.index === buffer.length - 1)
|
|
14837
|
+
if (!done && match[0] === "\r" && match.index === buffer.length - 1) {
|
|
14838
|
+
break;
|
|
14839
|
+
}
|
|
14847
14840
|
const event = line(buffer.slice(0, match.index));
|
|
14848
14841
|
buffer = buffer.slice(match.index + match[0].length);
|
|
14849
|
-
if (event)
|
|
14842
|
+
if (event) {
|
|
14843
|
+
yield event;
|
|
14844
|
+
}
|
|
14850
14845
|
}
|
|
14851
14846
|
if (done) {
|
|
14852
14847
|
ended = true;
|
|
14853
14848
|
if (buffer) {
|
|
14854
14849
|
const event2 = line(buffer);
|
|
14855
|
-
if (event2)
|
|
14850
|
+
if (event2) {
|
|
14851
|
+
yield event2;
|
|
14852
|
+
}
|
|
14856
14853
|
}
|
|
14857
14854
|
const event = dispatch();
|
|
14858
|
-
if (event)
|
|
14855
|
+
if (event) {
|
|
14856
|
+
yield event;
|
|
14857
|
+
}
|
|
14859
14858
|
if (options.requireResult !== false && !receivedResult) {
|
|
14860
14859
|
throw new PHPSandboxError("Publish stream ended without result");
|
|
14861
14860
|
}
|
|
@@ -14863,7 +14862,9 @@ async function* readPublicationStream(input, options = {}) {
|
|
|
14863
14862
|
}
|
|
14864
14863
|
}
|
|
14865
14864
|
} finally {
|
|
14866
|
-
if (!ended)
|
|
14865
|
+
if (!ended) {
|
|
14866
|
+
await reader.cancel().catch(() => void 0);
|
|
14867
|
+
}
|
|
14867
14868
|
reader.releaseLock();
|
|
14868
14869
|
}
|
|
14869
14870
|
}
|
|
@@ -14874,7 +14875,9 @@ function createPublicationStreamResponse(stream, options = {}) {
|
|
|
14874
14875
|
let cancellation;
|
|
14875
14876
|
let abort;
|
|
14876
14877
|
async function dispose() {
|
|
14877
|
-
if (disposed)
|
|
14878
|
+
if (disposed) {
|
|
14879
|
+
return;
|
|
14880
|
+
}
|
|
14878
14881
|
disposed = true;
|
|
14879
14882
|
options.signal?.removeEventListener("abort", abort);
|
|
14880
14883
|
reader.releaseLock();
|
|
@@ -14890,43 +14893,56 @@ function createPublicationStreamResponse(stream, options = {}) {
|
|
|
14890
14893
|
}
|
|
14891
14894
|
})());
|
|
14892
14895
|
}
|
|
14893
|
-
return new Response(
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
controller
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
|
|
14910
|
-
|
|
14911
|
-
|
|
14912
|
-
|
|
14913
|
-
|
|
14914
|
-
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14896
|
+
return new Response(
|
|
14897
|
+
new ReadableStream(
|
|
14898
|
+
{
|
|
14899
|
+
start(controller) {
|
|
14900
|
+
abort = () => {
|
|
14901
|
+
controller.error(options.signal.reason);
|
|
14902
|
+
void cancel(options.signal.reason).catch(() => void 0);
|
|
14903
|
+
};
|
|
14904
|
+
if (options.signal?.aborted) {
|
|
14905
|
+
abort();
|
|
14906
|
+
} else {
|
|
14907
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
14908
|
+
}
|
|
14909
|
+
},
|
|
14910
|
+
async pull(controller) {
|
|
14911
|
+
try {
|
|
14912
|
+
const { done, value } = await reader.read();
|
|
14913
|
+
if (finished) {
|
|
14914
|
+
return;
|
|
14915
|
+
}
|
|
14916
|
+
if (done) {
|
|
14917
|
+
finished = true;
|
|
14918
|
+
await dispose();
|
|
14919
|
+
controller.close();
|
|
14920
|
+
} else {
|
|
14921
|
+
controller.enqueue(value);
|
|
14922
|
+
}
|
|
14923
|
+
} catch (error51) {
|
|
14924
|
+
if (finished && cancellation) {
|
|
14925
|
+
return;
|
|
14926
|
+
}
|
|
14927
|
+
try {
|
|
14928
|
+
await cancel(error51);
|
|
14929
|
+
} finally {
|
|
14930
|
+
controller.error(error51);
|
|
14931
|
+
}
|
|
14932
|
+
}
|
|
14933
|
+
},
|
|
14934
|
+
cancel
|
|
14935
|
+
},
|
|
14936
|
+
{ highWaterMark: 0 }
|
|
14937
|
+
),
|
|
14938
|
+
{
|
|
14939
|
+
headers: {
|
|
14940
|
+
"Content-Type": "text/event-stream",
|
|
14941
|
+
"Cache-Control": "no-cache, no-transform",
|
|
14942
|
+
"X-Accel-Buffering": "no"
|
|
14920
14943
|
}
|
|
14921
|
-
},
|
|
14922
|
-
cancel
|
|
14923
|
-
}, { highWaterMark: 0 }), {
|
|
14924
|
-
headers: {
|
|
14925
|
-
"Content-Type": "text/event-stream",
|
|
14926
|
-
"Cache-Control": "no-cache, no-transform",
|
|
14927
|
-
"X-Accel-Buffering": "no"
|
|
14928
14944
|
}
|
|
14929
|
-
|
|
14945
|
+
);
|
|
14930
14946
|
}
|
|
14931
14947
|
|
|
14932
14948
|
// src/publication/run.ts
|
|
@@ -15247,7 +15263,9 @@ var PublicationInstance = class _PublicationInstance {
|
|
|
15247
15263
|
}
|
|
15248
15264
|
async logSnapshot(stream, limit = 50) {
|
|
15249
15265
|
const query = new URLSearchParams({ stream, limit: String(limit) });
|
|
15250
|
-
return (await this.client.get(
|
|
15266
|
+
return (await this.client.get(
|
|
15267
|
+
`/publications/${encodeURIComponent(this.data.id)}/logs?${query}`
|
|
15268
|
+
)).data;
|
|
15251
15269
|
}
|
|
15252
15270
|
async logs() {
|
|
15253
15271
|
return parseNdjsonStream(
|
|
@@ -15356,11 +15374,15 @@ var NotebookPublication = class {
|
|
|
15356
15374
|
/** Publish the exact app selection in a server-owned review. */
|
|
15357
15375
|
async publish(input) {
|
|
15358
15376
|
const application = (await this.client.post(`${this.path}/publication`, input)).data;
|
|
15359
|
-
if (!("confirmationRequired" in application))
|
|
15377
|
+
if (!("confirmationRequired" in application)) {
|
|
15378
|
+
this.startApplicationRuns(application);
|
|
15379
|
+
}
|
|
15360
15380
|
return application;
|
|
15361
15381
|
}
|
|
15362
15382
|
async application(applicationId) {
|
|
15363
|
-
return (await this.client.get(
|
|
15383
|
+
return (await this.client.get(
|
|
15384
|
+
`${this.path}/publication/application/${encodeURIComponent(applicationId)}`
|
|
15385
|
+
)).data;
|
|
15364
15386
|
}
|
|
15365
15387
|
/** Retry failed apps and pending route attachments while preserving running releases. */
|
|
15366
15388
|
async retryApplication(applicationId) {
|
|
@@ -15377,12 +15399,13 @@ var NotebookPublication = class {
|
|
|
15377
15399
|
}
|
|
15378
15400
|
startApplicationRuns(application) {
|
|
15379
15401
|
for (const app of application.apps) {
|
|
15380
|
-
if (!(application.selectedAppIds ?? []).includes(app.appId))
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
|
|
15402
|
+
if (!(application.selectedAppIds ?? []).includes(app.appId)) {
|
|
15403
|
+
continue;
|
|
15404
|
+
}
|
|
15405
|
+
if (!["pending", "queued", "building", "deploying"].includes(app.publication.status)) {
|
|
15406
|
+
continue;
|
|
15407
|
+
}
|
|
15408
|
+
new PublicationRun(new PublicationInstance(app.publication, this.client, this.notebookId), this.client).start();
|
|
15386
15409
|
}
|
|
15387
15410
|
}
|
|
15388
15411
|
async catalog(provider, serverId) {
|
|
@@ -15997,7 +16020,7 @@ var Terminals = class {
|
|
|
15997
16020
|
return this.okra.invoke("terminal.close", { id });
|
|
15998
16021
|
});
|
|
15999
16022
|
const resize = (dimensions) => {
|
|
16000
|
-
this.okra.invoke("terminal.resize", { id, width: dimensions.cols, height: dimensions.rows });
|
|
16023
|
+
return this.okra.invoke("terminal.resize", { id, width: dimensions.cols, height: dimensions.rows });
|
|
16001
16024
|
};
|
|
16002
16025
|
if (abortSignal && !abortSignal.aborted) {
|
|
16003
16026
|
abortHandler = () => {
|
|
@@ -16018,20 +16041,6 @@ var Terminals = class {
|
|
|
16018
16041
|
}
|
|
16019
16042
|
};
|
|
16020
16043
|
|
|
16021
|
-
// src/auth.ts
|
|
16022
|
-
var Auth = class {
|
|
16023
|
-
constructor(okra) {
|
|
16024
|
-
this.okra = okra;
|
|
16025
|
-
}
|
|
16026
|
-
login(runtimeUrl) {
|
|
16027
|
-
const runtimeTicket = new URL(runtimeUrl).searchParams.get("ticket");
|
|
16028
|
-
if (runtimeTicket === null || runtimeTicket === "") {
|
|
16029
|
-
throw new TypeError("The notebook connection does not contain a runtime ticket.");
|
|
16030
|
-
}
|
|
16031
|
-
return this.okra.invoke("auth.login", { runtimeTicket });
|
|
16032
|
-
}
|
|
16033
|
-
};
|
|
16034
|
-
|
|
16035
16044
|
// src/lsp.ts
|
|
16036
16045
|
var Lsp = class {
|
|
16037
16046
|
constructor(okra) {
|
|
@@ -16086,10 +16095,10 @@ var LspConnection = class _LspConnection {
|
|
|
16086
16095
|
return this.lsp.onClose(this.id, cb);
|
|
16087
16096
|
}
|
|
16088
16097
|
dispose() {
|
|
16089
|
-
this.lsp.close(this.id);
|
|
16098
|
+
return this.lsp.close(this.id);
|
|
16090
16099
|
}
|
|
16091
16100
|
start() {
|
|
16092
|
-
this.lsp.start(this.id);
|
|
16101
|
+
return this.lsp.start(this.id);
|
|
16093
16102
|
}
|
|
16094
16103
|
onClientDisconnect(cb) {
|
|
16095
16104
|
return this.lsp.onClientDisconnect(cb);
|
|
@@ -16192,11 +16201,7 @@ var ShellProcess = class {
|
|
|
16192
16201
|
stderr.fail(error51);
|
|
16193
16202
|
};
|
|
16194
16203
|
const { abortSignal, ...payloadOpts } = opts;
|
|
16195
|
-
this.completion = this.okra.invoke(
|
|
16196
|
-
"shell.exec",
|
|
16197
|
-
{ command, opts: { ...payloadOpts, id: this.id } },
|
|
16198
|
-
{ abortSignal }
|
|
16199
|
-
).then((result) => {
|
|
16204
|
+
this.completion = this.okra.invoke("shell.exec", { command, opts: { ...payloadOpts, id: this.id } }, { abortSignal }).then((result) => {
|
|
16200
16205
|
finish();
|
|
16201
16206
|
return result;
|
|
16202
16207
|
}).catch((error51) => {
|
|
@@ -16229,15 +16234,14 @@ var ComposerCredentials = class {
|
|
|
16229
16234
|
this.notebookId = notebookId;
|
|
16230
16235
|
}
|
|
16231
16236
|
async set(input) {
|
|
16232
|
-
const response = await this.client.put(
|
|
16233
|
-
`/notebook/${this.notebookId}/composer/credentials`,
|
|
16234
|
-
input
|
|
16235
|
-
);
|
|
16237
|
+
const response = await this.client.put(`/notebook/${this.notebookId}/composer/credentials`, input);
|
|
16236
16238
|
return response.data;
|
|
16237
16239
|
}
|
|
16238
16240
|
async remove(type, url2) {
|
|
16239
16241
|
const params = new URLSearchParams({ type });
|
|
16240
|
-
if (url2)
|
|
16242
|
+
if (url2) {
|
|
16243
|
+
params.set("url", url2);
|
|
16244
|
+
}
|
|
16241
16245
|
await this.client.delete(`/notebook/${this.notebookId}/composer/credentials?${params.toString()}`);
|
|
16242
16246
|
}
|
|
16243
16247
|
};
|
|
@@ -16422,11 +16426,18 @@ var Logs = class {
|
|
|
16422
16426
|
this.telemetry = telemetry;
|
|
16423
16427
|
}
|
|
16424
16428
|
follow(options = {}) {
|
|
16425
|
-
return watchRuntimeTelemetry(
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16429
|
-
|
|
16429
|
+
return watchRuntimeTelemetry(
|
|
16430
|
+
this.okra,
|
|
16431
|
+
this.telemetry,
|
|
16432
|
+
"logs",
|
|
16433
|
+
"notebook.log",
|
|
16434
|
+
(message) => ({
|
|
16435
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16436
|
+
source: "runtime",
|
|
16437
|
+
message
|
|
16438
|
+
}),
|
|
16439
|
+
options
|
|
16440
|
+
);
|
|
16430
16441
|
}
|
|
16431
16442
|
};
|
|
16432
16443
|
|
|
@@ -18886,7 +18897,7 @@ ${JSON.stringify(metadata, null, 2)}` : "";
|
|
|
18886
18897
|
id() {
|
|
18887
18898
|
return this.clientId;
|
|
18888
18899
|
}
|
|
18889
|
-
|
|
18900
|
+
registerWatchers() {
|
|
18890
18901
|
const onMessage = (ev) => {
|
|
18891
18902
|
this.incomingMessageChain = this.incomingMessageChain.catch(() => void 0).then(() => this.processIncomingMessage(ev)).catch((error51) => {
|
|
18892
18903
|
this.log("error", "Failed to process queued WebSocket frame", {
|
|
@@ -19052,7 +19063,9 @@ ${JSON.stringify(metadata, null, 2)}` : "";
|
|
|
19052
19063
|
this.eventEmitter.emit(event, this.clientId);
|
|
19053
19064
|
return;
|
|
19054
19065
|
}
|
|
19055
|
-
|
|
19066
|
+
if (event) {
|
|
19067
|
+
this.eventEmitter.emit(as || event, data);
|
|
19068
|
+
}
|
|
19056
19069
|
}
|
|
19057
19070
|
listen(event, listener, _context) {
|
|
19058
19071
|
return this.eventEmitter.listen(event, listener);
|
|
@@ -19148,12 +19161,14 @@ ${JSON.stringify(metadata, null, 2)}` : "";
|
|
|
19148
19161
|
});
|
|
19149
19162
|
closeHandler = (_ev) => {
|
|
19150
19163
|
if (_ev.code === 1008 && (_ev.reason || "").includes("rate limit")) {
|
|
19151
|
-
reject(
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19164
|
+
reject(
|
|
19165
|
+
new RemoteError(_ev.reason || "Rate limit exceeded", {
|
|
19166
|
+
source: "runtime",
|
|
19167
|
+
status: 429,
|
|
19168
|
+
code: "RateLimited",
|
|
19169
|
+
cause: _ev
|
|
19170
|
+
})
|
|
19171
|
+
);
|
|
19157
19172
|
return;
|
|
19158
19173
|
}
|
|
19159
19174
|
const detail = describeWebSocketEvent(_ev);
|
|
@@ -19661,6 +19676,15 @@ var ServerApi = class {
|
|
|
19661
19676
|
constructor(client) {
|
|
19662
19677
|
this.client = client;
|
|
19663
19678
|
}
|
|
19679
|
+
async inspectInvitation(id, token) {
|
|
19680
|
+
return (await this.client.post(`/platform/server-invitations/${encodeURIComponent(id)}/inspect`, { token })).data;
|
|
19681
|
+
}
|
|
19682
|
+
async acceptInvitation(id, token) {
|
|
19683
|
+
return (await this.client.post(`/platform/server-invitations/${encodeURIComponent(id)}/accept`, { token })).data;
|
|
19684
|
+
}
|
|
19685
|
+
async declineInvitation(id, token) {
|
|
19686
|
+
return (await this.client.post(`/platform/server-invitations/${encodeURIComponent(id)}/decline`, { token })).data;
|
|
19687
|
+
}
|
|
19664
19688
|
async list(options = {}) {
|
|
19665
19689
|
const query = options.page === void 0 ? "" : `?${new URLSearchParams({ page: String(options.page) }).toString()}`;
|
|
19666
19690
|
return this.client.get(`/servers${query}`);
|
|
@@ -19686,11 +19710,39 @@ var ServerInstance = class {
|
|
|
19686
19710
|
const query = options.page === void 0 ? "" : `?${new URLSearchParams({ page: String(options.page) }).toString()}`;
|
|
19687
19711
|
return this.client.get(`/servers/${encodeURIComponent(this.data.id)}/members${query}`);
|
|
19688
19712
|
}
|
|
19689
|
-
async share(
|
|
19690
|
-
|
|
19713
|
+
async share(target) {
|
|
19714
|
+
if (target.email !== void 0) {
|
|
19715
|
+
return (await this.client.post(`/platform/servers/${encodeURIComponent(this.data.id)}/invitations`, {
|
|
19716
|
+
email: target.email,
|
|
19717
|
+
requestId: target.requestId ?? crypto.randomUUID()
|
|
19718
|
+
})).data;
|
|
19719
|
+
}
|
|
19720
|
+
const body = { organizationId: target.organizationId, requestId: target.requestId };
|
|
19721
|
+
return (await this.client.post(`/servers/${encodeURIComponent(this.data.id)}/members`, body)).data;
|
|
19691
19722
|
}
|
|
19692
19723
|
async revokeAccess(memberId) {
|
|
19693
|
-
await this.client.delete(
|
|
19724
|
+
await this.client.delete(
|
|
19725
|
+
`/servers/${encodeURIComponent(this.data.id)}/members/${encodeURIComponent(String(memberId))}`
|
|
19726
|
+
);
|
|
19727
|
+
}
|
|
19728
|
+
async invitations(options = {}) {
|
|
19729
|
+
const query = options.page === void 0 ? "" : `?${new URLSearchParams({ page: String(options.page) }).toString()}`;
|
|
19730
|
+
return this.client.get(`/platform/servers/${encodeURIComponent(this.data.id)}/invitations${query}`);
|
|
19731
|
+
}
|
|
19732
|
+
async cancelInvitation(id) {
|
|
19733
|
+
const response = await this.client.delete(
|
|
19734
|
+
`/platform/servers/${encodeURIComponent(this.data.id)}/invitations/${encodeURIComponent(id)}`
|
|
19735
|
+
);
|
|
19736
|
+
if (response.data === void 0) {
|
|
19737
|
+
throw new PHPSandboxError("Missing invitation cancellation response.");
|
|
19738
|
+
}
|
|
19739
|
+
return response.data;
|
|
19740
|
+
}
|
|
19741
|
+
async resendInvitation(id) {
|
|
19742
|
+
return (await this.client.post(
|
|
19743
|
+
`/platform/servers/${encodeURIComponent(this.data.id)}/invitations/${encodeURIComponent(id)}/resend`,
|
|
19744
|
+
{}
|
|
19745
|
+
)).data;
|
|
19694
19746
|
}
|
|
19695
19747
|
refresh() {
|
|
19696
19748
|
return this.client.servers.get(this.data.id);
|
|
@@ -19914,9 +19966,7 @@ function runtimeActionRequestBody(action, data, url2, headers) {
|
|
|
19914
19966
|
throw new TypeError("Runtime file contents must be binary data.");
|
|
19915
19967
|
}
|
|
19916
19968
|
headers["Content-Type"] = "application/octet-stream";
|
|
19917
|
-
return Uint8Array.from(
|
|
19918
|
-
new Uint8Array(payload.contents.buffer, payload.contents.byteOffset, payload.contents.byteLength)
|
|
19919
|
-
).buffer;
|
|
19969
|
+
return Uint8Array.from(new Uint8Array(payload.contents.buffer, payload.contents.byteOffset, payload.contents.byteLength)).buffer;
|
|
19920
19970
|
}
|
|
19921
19971
|
headers["Content-Type"] = "application/json";
|
|
19922
19972
|
return JSON.stringify(data);
|
|
@@ -19978,11 +20028,11 @@ var Feedback = class {
|
|
|
19978
20028
|
async list(options = {}) {
|
|
19979
20029
|
const query = new URLSearchParams();
|
|
19980
20030
|
for (const [name, value] of Object.entries(options)) {
|
|
19981
|
-
if (value !== void 0)
|
|
20031
|
+
if (value !== void 0) {
|
|
20032
|
+
query.set(name, String(value));
|
|
20033
|
+
}
|
|
19982
20034
|
}
|
|
19983
|
-
return this.client.get(
|
|
19984
|
-
`${this.path()}${query.size === 0 ? "" : `?${query.toString()}`}`
|
|
19985
|
-
);
|
|
20035
|
+
return this.client.get(`${this.path()}${query.size === 0 ? "" : `?${query.toString()}`}`);
|
|
19986
20036
|
}
|
|
19987
20037
|
async get(id) {
|
|
19988
20038
|
const response = await this.client.get(this.path(`/${encodeURIComponent(id)}`));
|
|
@@ -20030,10 +20080,7 @@ var Integration = class _Integration {
|
|
|
20030
20080
|
return this.data.label;
|
|
20031
20081
|
}
|
|
20032
20082
|
async update(input) {
|
|
20033
|
-
const response = await this.client.patch(
|
|
20034
|
-
`/integrations/${encodeURIComponent(this.id)}`,
|
|
20035
|
-
input
|
|
20036
|
-
);
|
|
20083
|
+
const response = await this.client.patch(`/integrations/${encodeURIComponent(this.id)}`, input);
|
|
20037
20084
|
return new _Integration(response.data, this.client);
|
|
20038
20085
|
}
|
|
20039
20086
|
async unlink() {
|
|
@@ -20235,7 +20282,7 @@ var ClientImplementation = class {
|
|
|
20235
20282
|
})
|
|
20236
20283
|
);
|
|
20237
20284
|
if (!response.ok) {
|
|
20238
|
-
throw await responseError(response);
|
|
20285
|
+
throw await responseError(response, path.startsWith("/platform/") ? "platform" : "core");
|
|
20239
20286
|
}
|
|
20240
20287
|
if (response.status === 204) {
|
|
20241
20288
|
return { data: void 0 };
|
|
@@ -20268,10 +20315,10 @@ var ClientImplementation = class {
|
|
|
20268
20315
|
}
|
|
20269
20316
|
}
|
|
20270
20317
|
};
|
|
20271
|
-
async function responseError(response) {
|
|
20318
|
+
async function responseError(response, source = "core") {
|
|
20272
20319
|
const body = await response.text();
|
|
20273
20320
|
try {
|
|
20274
|
-
return remoteError(
|
|
20321
|
+
return remoteError(source, errorPayload(body === "" ? void 0 : JSON.parse(body)), response);
|
|
20275
20322
|
} catch {
|
|
20276
20323
|
return new TransportError(
|
|
20277
20324
|
`PHPSandbox API returned an invalid error response (HTTP ${response.status}).`,
|
|
@@ -20296,6 +20343,14 @@ var PHPSandbox = class _PHPSandbox {
|
|
|
20296
20343
|
this.servers = client.servers;
|
|
20297
20344
|
this.integrations = client.integrations;
|
|
20298
20345
|
}
|
|
20346
|
+
async whoami() {
|
|
20347
|
+
const { data } = await this.client.get("/auth/whoami");
|
|
20348
|
+
const result = identitySchema.safeParse(data);
|
|
20349
|
+
if (!result.success) {
|
|
20350
|
+
throw new PHPSandboxError("Invalid identity response.");
|
|
20351
|
+
}
|
|
20352
|
+
return result.data;
|
|
20353
|
+
}
|
|
20299
20354
|
get runtimeTransport() {
|
|
20300
20355
|
return this.client.runtimeTransport;
|
|
20301
20356
|
}
|
|
@@ -20343,7 +20398,6 @@ var _NotebookInstance = class _NotebookInstance {
|
|
|
20343
20398
|
}
|
|
20344
20399
|
this.files = new Filesystem(this, this.socket === null ? null : (handler) => this.onDidConnect(handler));
|
|
20345
20400
|
this.terminals = new Terminals(this);
|
|
20346
|
-
this.auth = new Auth(this);
|
|
20347
20401
|
this.lsp = new Lsp(this);
|
|
20348
20402
|
this.composer = new Composer(this, client);
|
|
20349
20403
|
this.runtime = new Runtime(this);
|
|
@@ -20544,7 +20598,7 @@ var _NotebookInstance = class _NotebookInstance {
|
|
|
20544
20598
|
socket.reconnect();
|
|
20545
20599
|
this.initialized = false;
|
|
20546
20600
|
await whenConnected;
|
|
20547
|
-
__privateMethod(this, _NotebookInstance_instances, init_fn).call(this);
|
|
20601
|
+
__privateSet(this, _initPromise, __privateMethod(this, _NotebookInstance_instances, init_fn).call(this));
|
|
20548
20602
|
return this.ready().then(() => this);
|
|
20549
20603
|
}
|
|
20550
20604
|
realtimeSocket() {
|
|
@@ -20593,7 +20647,9 @@ var NotebookSecrets = class {
|
|
|
20593
20647
|
}
|
|
20594
20648
|
async list(options) {
|
|
20595
20649
|
const params = new URLSearchParams();
|
|
20596
|
-
if (options?.environment)
|
|
20650
|
+
if (options?.environment) {
|
|
20651
|
+
params.set("environment", options.environment);
|
|
20652
|
+
}
|
|
20597
20653
|
const query = params.toString();
|
|
20598
20654
|
const response = await this.client.get(
|
|
20599
20655
|
`/notebook/${this.notebookId}/secrets${query ? `?${query}` : ""}`
|
|
@@ -20613,7 +20669,9 @@ var NotebookSecrets = class {
|
|
|
20613
20669
|
}
|
|
20614
20670
|
async delete(name, options) {
|
|
20615
20671
|
const params = new URLSearchParams();
|
|
20616
|
-
if (options?.environment)
|
|
20672
|
+
if (options?.environment) {
|
|
20673
|
+
params.set("environment", options.environment);
|
|
20674
|
+
}
|
|
20617
20675
|
const query = params.toString();
|
|
20618
20676
|
await this.client.delete(`/notebook/${this.notebookId}/secrets/${encodeURIComponent(name)}${query ? `?${query}` : ""}`);
|
|
20619
20677
|
}
|