@phpsandbox/sdk 0.0.66 → 0.0.67
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 +5 -4
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +2 -2
- package/dist/browser/phpsandbox-sdk.esm.js +24 -21
- package/dist/browser/phpsandbox-sdk.esm.min.js +2 -2
- package/dist/browser/phpsandbox-sdk.iife.js +24 -21
- package/dist/browser/phpsandbox-sdk.iife.min.js +2 -2
- package/dist/deployments.d.ts +2 -0
- package/dist/deployments.js +6 -5
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -6
- package/dist/runtime/rest.js +10 -10
- package/docs/api-summary.md +3 -3
- package/examples/README.md +5 -5
- package/examples/laravel-load-test.ts +12 -12
- package/examples/notebook-readonly-smoke.ts +20 -20
- package/package.json +1 -1
|
@@ -678,8 +678,8 @@ var PHPSandbox = (() => {
|
|
|
678
678
|
logout() {
|
|
679
679
|
this.okra.dispose();
|
|
680
680
|
}
|
|
681
|
-
login(
|
|
682
|
-
const runtimeTicket = new URL(
|
|
681
|
+
login(runtimeUrl) {
|
|
682
|
+
const runtimeTicket = new URL(runtimeUrl).searchParams.get("ticket");
|
|
683
683
|
if (runtimeTicket === null || runtimeTicket === "") {
|
|
684
684
|
throw new TypeError("The notebook connection does not contain a runtime ticket.");
|
|
685
685
|
}
|
|
@@ -19535,8 +19535,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19535
19535
|
if (this.started) {
|
|
19536
19536
|
return this;
|
|
19537
19537
|
}
|
|
19538
|
-
|
|
19539
|
-
|
|
19538
|
+
const eventStreamUrl = this.initial.data.eventStreamUrl ?? this.initial.data.okraUrl;
|
|
19539
|
+
if (!eventStreamUrl) {
|
|
19540
|
+
throw new Error(`Deployment ${this.initial.data.id} has no eventStreamUrl for SSE streaming`);
|
|
19540
19541
|
}
|
|
19541
19542
|
this.started = true;
|
|
19542
19543
|
this.resultPromise = new Promise((resolve, reject) => {
|
|
@@ -19544,7 +19545,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19544
19545
|
this.rejectResult = reject;
|
|
19545
19546
|
});
|
|
19546
19547
|
this.resultPromise.catch(() => void 0);
|
|
19547
|
-
void this.consumeStream(
|
|
19548
|
+
void this.consumeStream(eventStreamUrl);
|
|
19548
19549
|
return this;
|
|
19549
19550
|
}
|
|
19550
19551
|
subscribe() {
|
|
@@ -19561,9 +19562,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19561
19562
|
}
|
|
19562
19563
|
return queue;
|
|
19563
19564
|
}
|
|
19564
|
-
async consumeStream(
|
|
19565
|
+
async consumeStream(eventStreamUrl) {
|
|
19565
19566
|
try {
|
|
19566
|
-
const stream = await this.client.sse(
|
|
19567
|
+
const stream = await this.client.sse(eventStreamUrl);
|
|
19567
19568
|
for await (const event of readDeployStreamEvents(stream)) {
|
|
19568
19569
|
this.publish(event);
|
|
19569
19570
|
if (event.type === "result") {
|
|
@@ -19962,20 +19963,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19962
19963
|
this.refresh = refresh;
|
|
19963
19964
|
this.refreshPromise = null;
|
|
19964
19965
|
this.notebookId = data.id;
|
|
19965
|
-
this.configure(data.okraUrl);
|
|
19966
|
+
this.configure(data.runtimeUrl ?? data.okraUrl);
|
|
19966
19967
|
}
|
|
19967
|
-
configure(
|
|
19968
|
-
const
|
|
19969
|
-
const ticket =
|
|
19968
|
+
configure(runtimeUrl) {
|
|
19969
|
+
const actionUrl = new URL(runtimeUrl);
|
|
19970
|
+
const ticket = actionUrl.searchParams.get("ticket") ?? "";
|
|
19970
19971
|
if (ticket === "") {
|
|
19971
19972
|
throw new UnsupportedRuntimeTransportError("The notebook connection does not contain a runtime ticket.");
|
|
19972
19973
|
}
|
|
19973
19974
|
this.ticket = ticket;
|
|
19974
|
-
|
|
19975
|
-
|
|
19976
|
-
|
|
19977
|
-
|
|
19978
|
-
this.actionUrl =
|
|
19975
|
+
actionUrl.protocol = actionUrl.protocol === "wss:" ? "https:" : "http:";
|
|
19976
|
+
actionUrl.pathname = `/api/v1/notebooks/${encodeURIComponent(this.notebookId)}`;
|
|
19977
|
+
actionUrl.searchParams.delete("ticket");
|
|
19978
|
+
actionUrl.hash = "";
|
|
19979
|
+
this.actionUrl = actionUrl;
|
|
19979
19980
|
}
|
|
19980
19981
|
ready() {
|
|
19981
19982
|
return this.invokeRaw("runtime.ready", {}, {});
|
|
@@ -20033,7 +20034,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20033
20034
|
}
|
|
20034
20035
|
async refreshAuthorization() {
|
|
20035
20036
|
if (this.refreshPromise === null) {
|
|
20036
|
-
this.refreshPromise = this.refresh().then((
|
|
20037
|
+
this.refreshPromise = this.refresh().then((runtimeUrl) => this.configure(runtimeUrl));
|
|
20037
20038
|
}
|
|
20038
20039
|
try {
|
|
20039
20040
|
await this.refreshPromise;
|
|
@@ -20429,23 +20430,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20429
20430
|
this.initialized = false;
|
|
20430
20431
|
__privateAdd(this, _initPromise, null);
|
|
20431
20432
|
this.disposables = [];
|
|
20433
|
+
const runtimeUrl = data.runtimeUrl ?? data.okraUrl;
|
|
20434
|
+
const runtimeUrlProvider = client.options.runtimeUrlProvider ?? client.options.okraUrlProvider;
|
|
20432
20435
|
this.emitter = EventManager.createInstance();
|
|
20433
20436
|
if (client.runtimeTransport === "rest") {
|
|
20434
20437
|
this.socket = null;
|
|
20435
20438
|
this.restInvoker = new RestRuntimeInvoker(
|
|
20436
20439
|
data,
|
|
20437
20440
|
client.options.fetch ?? globalThis.fetch,
|
|
20438
|
-
|
|
20441
|
+
runtimeUrlProvider === void 0 ? void 0 : () => runtimeUrlProvider(data.id)
|
|
20439
20442
|
);
|
|
20440
20443
|
} else {
|
|
20441
20444
|
this.restInvoker = null;
|
|
20442
20445
|
let initialConnection = true;
|
|
20443
|
-
const connectionUrl =
|
|
20446
|
+
const connectionUrl = runtimeUrlProvider === void 0 ? runtimeUrl : async () => {
|
|
20444
20447
|
if (initialConnection) {
|
|
20445
20448
|
initialConnection = false;
|
|
20446
|
-
return
|
|
20449
|
+
return runtimeUrl;
|
|
20447
20450
|
}
|
|
20448
|
-
return
|
|
20451
|
+
return runtimeUrlProvider(data.id);
|
|
20449
20452
|
};
|
|
20450
20453
|
this.socket = new Transport(connectionUrl, this.emitter, {
|
|
20451
20454
|
debug: client.options.debug,
|