@phpsandbox/sdk 0.0.68 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -13
- package/dist/auth.d.ts +0 -1
- package/dist/auth.js +0 -3
- package/dist/beacon/index.d.ts +2 -0
- package/dist/beacon/index.js +5 -0
- package/dist/browser/phpsandbox-sdk.esm.js +306 -1010
- package/dist/browser/phpsandbox-sdk.esm.min.js +24 -24
- package/dist/browser/phpsandbox-sdk.iife.js +306 -1010
- package/dist/browser/phpsandbox-sdk.iife.min.js +24 -24
- package/dist/filesystem.d.ts +2 -1
- package/dist/filesystem.js +35 -2
- package/dist/index.d.ts +14 -19
- package/dist/index.js +16 -24
- package/dist/publications.d.ts +222 -0
- package/dist/{deployments.js → publications.js} +64 -69
- package/dist/repl.d.ts +0 -2
- package/dist/repl.js +0 -3
- package/dist/schemas/{deployments.d.ts → publications.d.ts} +68 -68
- package/dist/schemas/publications.js +133 -0
- package/dist/shell.d.ts +43 -22
- package/dist/shell.js +103 -75
- package/dist/terminal.d.ts +1 -3
- package/dist/terminal.js +2 -5
- package/docs/api-summary.md +13 -10
- package/docs/cdn-usage.md +4 -4
- package/docs/getting-started.md +6 -6
- package/examples/README.md +8 -9
- package/examples/basic.ts +1 -1
- package/examples/git-merge-smoke.ts +2 -2
- package/examples/laravel-load-test.ts +13 -18
- package/examples/notebook-readonly-smoke.ts +8 -8
- package/examples/publication-provider-label.ts +11 -0
- package/examples/{deploy-cloudflare-container.ts → publish-cloudflare-container.ts} +11 -11
- package/examples/{deploy-laravel-cloud.ts → publish-laravel-cloud.ts} +11 -11
- package/examples/{deploy-ssh-agent.ts → publish-ssh-agent.ts} +15 -16
- package/package.json +7 -2
- package/dist/deployments.d.ts +0 -251
- package/dist/laravel.d.ts +0 -22
- package/dist/laravel.js +0 -11
- package/dist/schemas/deployments.js +0 -133
- package/examples/deployment-provider-label.ts +0 -11
|
@@ -29,44 +29,9 @@ var PHPSandbox = (() => {
|
|
|
29
29
|
var index_exports = {};
|
|
30
30
|
__export(index_exports, {
|
|
31
31
|
ApiError: () => ApiError,
|
|
32
|
-
Beacon: () => Beacon,
|
|
33
|
-
BeaconConnectionError: () => BeaconConnectionError,
|
|
34
|
-
BeaconError: () => BeaconError,
|
|
35
|
-
BeaconTimeoutError: () => BeaconTimeoutError,
|
|
36
32
|
Client: () => Client2,
|
|
37
33
|
CommandError: () => CommandError,
|
|
38
34
|
ComposerCredentials: () => ComposerCredentials,
|
|
39
|
-
DeployStreamErrorSchema: () => DeployStreamErrorSchema,
|
|
40
|
-
DeployStreamEventSchema: () => DeployStreamEventSchema,
|
|
41
|
-
DeployStreamLogEventSchema: () => DeployStreamLogEventSchema,
|
|
42
|
-
DeployStreamLogSchema: () => DeployStreamLogSchema,
|
|
43
|
-
DeployStreamLogStreamSchema: () => DeployStreamLogStreamSchema,
|
|
44
|
-
DeployStreamPhaseEventSchema: () => DeployStreamPhaseEventSchema,
|
|
45
|
-
DeployStreamPhaseSchema: () => DeployStreamPhaseSchema,
|
|
46
|
-
DeployStreamResultEventSchema: () => DeployStreamResultEventSchema,
|
|
47
|
-
DeployStreamResultSchema: () => DeployStreamResultSchema,
|
|
48
|
-
DeployStreamSseDoneEventSchema: () => DeployStreamSseDoneEventSchema,
|
|
49
|
-
DeployStreamSseErrorEventSchema: () => DeployStreamSseErrorEventSchema,
|
|
50
|
-
DeployStreamSseEventNameSchema: () => DeployStreamSseEventNameSchema,
|
|
51
|
-
DeployStreamSseEventSchema: () => DeployStreamSseEventSchema,
|
|
52
|
-
DeployStreamSseLogEventSchema: () => DeployStreamSseLogEventSchema,
|
|
53
|
-
DeployStreamSsePhaseEventSchema: () => DeployStreamSsePhaseEventSchema,
|
|
54
|
-
DeployStreamSseResultEventSchema: () => DeployStreamSseResultEventSchema,
|
|
55
|
-
DeploymentApi: () => DeploymentApi,
|
|
56
|
-
DeploymentBuildStatusSchema: () => DeploymentBuildStatusSchema,
|
|
57
|
-
DeploymentDomainDnsRecordTypeSchema: () => DeploymentDomainDnsRecordTypeSchema,
|
|
58
|
-
DeploymentEventDataSchema: () => DeploymentEventDataSchema,
|
|
59
|
-
DeploymentInstance: () => DeploymentInstance,
|
|
60
|
-
DeploymentJurisdictionSchema: () => DeploymentJurisdictionSchema,
|
|
61
|
-
DeploymentLogChunkDataSchema: () => DeploymentLogChunkDataSchema,
|
|
62
|
-
DeploymentLogStreamSchema: () => DeploymentLogStreamSchema,
|
|
63
|
-
DeploymentProtectionModeSchema: () => DeploymentProtectionModeSchema,
|
|
64
|
-
DeploymentRegionSchema: () => DeploymentRegionSchema,
|
|
65
|
-
DeploymentReleaseStatusSchema: () => DeploymentReleaseStatusSchema,
|
|
66
|
-
DeploymentRun: () => DeploymentRun,
|
|
67
|
-
DeploymentSizeSchema: () => DeploymentSizeSchema,
|
|
68
|
-
DeploymentStatusSchema: () => DeploymentStatusSchema,
|
|
69
|
-
DeploymentTargetProviderSchema: () => DeploymentTargetProviderSchema,
|
|
70
35
|
ErrorEvent: () => ErrorEvent,
|
|
71
36
|
FileChangeFilter: () => FileChangeFilter,
|
|
72
37
|
FileChangeType: () => FileChangeType,
|
|
@@ -75,31 +40,60 @@ var PHPSandbox = (() => {
|
|
|
75
40
|
FilesystemError: () => FilesystemError,
|
|
76
41
|
FilesystemErrorType: () => FilesystemErrorType,
|
|
77
42
|
LspConnection: () => LspConnection,
|
|
78
|
-
Navigator: () => Navigator,
|
|
79
43
|
NotebookApi: () => NotebookApi,
|
|
80
44
|
NotebookComposerCredentialApi: () => NotebookComposerCredentialApi,
|
|
81
|
-
NotebookDeploymentApi: () => NotebookDeploymentApi,
|
|
82
45
|
NotebookInitError: () => NotebookInitError,
|
|
83
46
|
NotebookInstance: () => NotebookInstance2,
|
|
84
47
|
NotebookMail: () => NotebookMail,
|
|
85
48
|
NotebookMailApi: () => NotebookMailApi,
|
|
86
49
|
NotebookPreview: () => NotebookPreview,
|
|
87
50
|
NotebookPreviewApi: () => NotebookPreviewApi,
|
|
51
|
+
NotebookPublicationApi: () => NotebookPublicationApi,
|
|
88
52
|
NotebookSecretApi: () => NotebookSecretApi,
|
|
89
53
|
NotebookSecrets: () => NotebookSecrets,
|
|
90
54
|
NotebookState: () => NotebookState,
|
|
91
55
|
NotebookUnavailableError: () => NotebookUnavailableError,
|
|
92
56
|
PHPSandbox: () => PHPSandbox,
|
|
93
57
|
PHPSandboxError: () => PHPSandboxError,
|
|
58
|
+
ProcessResult: () => ProcessResult,
|
|
94
59
|
PromiseTimeoutError: () => PromiseTimeoutError,
|
|
60
|
+
PublicationApi: () => PublicationApi,
|
|
61
|
+
PublicationBuildStatusSchema: () => PublicationBuildStatusSchema,
|
|
62
|
+
PublicationDomainDnsRecordTypeSchema: () => PublicationDomainDnsRecordTypeSchema,
|
|
63
|
+
PublicationEventDataSchema: () => PublicationEventDataSchema,
|
|
64
|
+
PublicationInstance: () => PublicationInstance,
|
|
65
|
+
PublicationJurisdictionSchema: () => PublicationJurisdictionSchema,
|
|
66
|
+
PublicationLogChunkDataSchema: () => PublicationLogChunkDataSchema,
|
|
67
|
+
PublicationLogStreamSchema: () => PublicationLogStreamSchema,
|
|
68
|
+
PublicationProtectionModeSchema: () => PublicationProtectionModeSchema,
|
|
69
|
+
PublicationProviderNameSchema: () => PublicationProviderNameSchema,
|
|
70
|
+
PublicationRegionSchema: () => PublicationRegionSchema,
|
|
71
|
+
PublicationReleaseStatusSchema: () => PublicationReleaseStatusSchema,
|
|
72
|
+
PublicationRun: () => PublicationRun,
|
|
73
|
+
PublicationSizeSchema: () => PublicationSizeSchema,
|
|
74
|
+
PublicationStatusSchema: () => PublicationStatusSchema,
|
|
75
|
+
PublishStreamErrorSchema: () => PublishStreamErrorSchema,
|
|
76
|
+
PublishStreamEventSchema: () => PublishStreamEventSchema,
|
|
77
|
+
PublishStreamLogEventSchema: () => PublishStreamLogEventSchema,
|
|
78
|
+
PublishStreamLogSchema: () => PublishStreamLogSchema,
|
|
79
|
+
PublishStreamLogStreamSchema: () => PublishStreamLogStreamSchema,
|
|
80
|
+
PublishStreamPhaseEventSchema: () => PublishStreamPhaseEventSchema,
|
|
81
|
+
PublishStreamPhaseSchema: () => PublishStreamPhaseSchema,
|
|
82
|
+
PublishStreamResultEventSchema: () => PublishStreamResultEventSchema,
|
|
83
|
+
PublishStreamResultSchema: () => PublishStreamResultSchema,
|
|
84
|
+
PublishStreamSseDoneEventSchema: () => PublishStreamSseDoneEventSchema,
|
|
85
|
+
PublishStreamSseErrorEventSchema: () => PublishStreamSseErrorEventSchema,
|
|
86
|
+
PublishStreamSseEventNameSchema: () => PublishStreamSseEventNameSchema,
|
|
87
|
+
PublishStreamSseEventSchema: () => PublishStreamSseEventSchema,
|
|
88
|
+
PublishStreamSseLogEventSchema: () => PublishStreamSseLogEventSchema,
|
|
89
|
+
PublishStreamSsePhaseEventSchema: () => PublishStreamSsePhaseEventSchema,
|
|
90
|
+
PublishStreamSseResultEventSchema: () => PublishStreamSseResultEventSchema,
|
|
95
91
|
RateLimitError: () => RateLimitError,
|
|
96
92
|
SendTimeoutError: () => SendTimeoutError,
|
|
97
93
|
ServerApi: () => ServerApi,
|
|
98
94
|
ServerInstance: () => ServerInstance,
|
|
99
|
-
|
|
95
|
+
ShellProcess: () => ShellProcess,
|
|
100
96
|
UnsupportedRuntimeTransportError: () => UnsupportedRuntimeTransportError,
|
|
101
|
-
createBeacon: () => createBeacon,
|
|
102
|
-
isBeaconSupported: () => isBeaconSupported,
|
|
103
97
|
notebookBuiltinServices: () => notebookBuiltinServices,
|
|
104
98
|
notebookKnownServices: () => notebookKnownServices,
|
|
105
99
|
once: () => once,
|
|
@@ -206,8 +200,25 @@ var PHPSandbox = (() => {
|
|
|
206
200
|
info(path) {
|
|
207
201
|
return this.okra.invoke("fs.info", { path });
|
|
208
202
|
}
|
|
209
|
-
write(path, contents) {
|
|
210
|
-
|
|
203
|
+
async write(path, contents, options = { overwrite: true, create: true, unlock: false, atomic: false }) {
|
|
204
|
+
if (typeof contents === "string") {
|
|
205
|
+
return this.okra.invoke("fs.write", { path, contents });
|
|
206
|
+
}
|
|
207
|
+
const bytes = contents instanceof Uint8Array ? contents : await collectBytes(contents);
|
|
208
|
+
await this.writeFile(path, bytes, options);
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
read(path) {
|
|
212
|
+
return new ReadableStream({
|
|
213
|
+
start: async (controller) => {
|
|
214
|
+
try {
|
|
215
|
+
controller.enqueue(await this.readFile(path));
|
|
216
|
+
controller.close();
|
|
217
|
+
} catch (error51) {
|
|
218
|
+
controller.error(error51);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
});
|
|
211
222
|
}
|
|
212
223
|
find(query, options = {
|
|
213
224
|
useIgnoreFiles: false,
|
|
@@ -383,6 +394,21 @@ var PHPSandbox = (() => {
|
|
|
383
394
|
throw e;
|
|
384
395
|
}
|
|
385
396
|
};
|
|
397
|
+
async function collectBytes(stream) {
|
|
398
|
+
const chunks = [];
|
|
399
|
+
let length = 0;
|
|
400
|
+
for await (const chunk of stream) {
|
|
401
|
+
chunks.push(chunk);
|
|
402
|
+
length += chunk.byteLength;
|
|
403
|
+
}
|
|
404
|
+
const output = new Uint8Array(length);
|
|
405
|
+
let offset = 0;
|
|
406
|
+
for (const chunk of chunks) {
|
|
407
|
+
output.set(chunk, offset);
|
|
408
|
+
offset += chunk.byteLength;
|
|
409
|
+
}
|
|
410
|
+
return output;
|
|
411
|
+
}
|
|
386
412
|
|
|
387
413
|
// src/errors/index.ts
|
|
388
414
|
var PromiseTimeoutError = class extends Error {
|
|
@@ -435,9 +461,6 @@ var PHPSandbox = (() => {
|
|
|
435
461
|
list() {
|
|
436
462
|
return this.okra.invoke("terminal.list");
|
|
437
463
|
}
|
|
438
|
-
start() {
|
|
439
|
-
return this.okra.invoke("terminal.start");
|
|
440
|
-
}
|
|
441
464
|
create(input) {
|
|
442
465
|
return this.okra.invoke("terminal.create", input);
|
|
443
466
|
}
|
|
@@ -570,7 +593,7 @@ var PHPSandbox = (() => {
|
|
|
570
593
|
disposeInput();
|
|
571
594
|
}
|
|
572
595
|
});
|
|
573
|
-
const
|
|
596
|
+
const completion = new Promise((resolve) => {
|
|
574
597
|
disposables.add(
|
|
575
598
|
this.listen(`terminal.close.${id}`, (data) => {
|
|
576
599
|
if (controller) {
|
|
@@ -599,7 +622,7 @@ var PHPSandbox = (() => {
|
|
|
599
622
|
}
|
|
600
623
|
return {
|
|
601
624
|
process: {
|
|
602
|
-
|
|
625
|
+
wait: () => completion,
|
|
603
626
|
input,
|
|
604
627
|
output,
|
|
605
628
|
kill,
|
|
@@ -675,9 +698,6 @@ var PHPSandbox = (() => {
|
|
|
675
698
|
constructor(okra) {
|
|
676
699
|
this.okra = okra;
|
|
677
700
|
}
|
|
678
|
-
logout() {
|
|
679
|
-
this.okra.dispose();
|
|
680
|
-
}
|
|
681
701
|
login(runtimeUrl) {
|
|
682
702
|
const runtimeTicket = new URL(runtimeUrl).searchParams.get("ticket");
|
|
683
703
|
if (runtimeTicket === null || runtimeTicket === "") {
|
|
@@ -802,19 +822,6 @@ var PHPSandbox = (() => {
|
|
|
802
822
|
}
|
|
803
823
|
};
|
|
804
824
|
|
|
805
|
-
// src/laravel.ts
|
|
806
|
-
var Laravel = class {
|
|
807
|
-
constructor(okra) {
|
|
808
|
-
this.okra = okra;
|
|
809
|
-
}
|
|
810
|
-
maintenanceInfo() {
|
|
811
|
-
return this.okra.invoke("laravel.maintenance.info", {});
|
|
812
|
-
}
|
|
813
|
-
toggleMaintenance(down) {
|
|
814
|
-
return this.okra.invoke("laravel.maintenance.toggle", down);
|
|
815
|
-
}
|
|
816
|
-
};
|
|
817
|
-
|
|
818
825
|
// src/repl.ts
|
|
819
826
|
var Repl = class {
|
|
820
827
|
constructor(okra) {
|
|
@@ -829,9 +836,6 @@ var PHPSandbox = (() => {
|
|
|
829
836
|
stop() {
|
|
830
837
|
return this.okra.invoke("repl.stop");
|
|
831
838
|
}
|
|
832
|
-
start() {
|
|
833
|
-
return this.okra.invoke("repl.start");
|
|
834
|
-
}
|
|
835
839
|
resize(cols, rows) {
|
|
836
840
|
return this.okra.invoke("repl.resize", { cols, rows });
|
|
837
841
|
}
|
|
@@ -844,113 +848,142 @@ var PHPSandbox = (() => {
|
|
|
844
848
|
};
|
|
845
849
|
|
|
846
850
|
// src/shell.ts
|
|
847
|
-
function
|
|
851
|
+
function resolveRunInput(command, argsOrOpts = [], opts) {
|
|
848
852
|
const args = Array.isArray(argsOrOpts) ? argsOrOpts : [];
|
|
849
853
|
const resolvedOpts = Array.isArray(argsOrOpts) ? opts : argsOrOpts;
|
|
850
854
|
return {
|
|
851
855
|
command: Array.isArray(command) ? command : args.length > 0 ? [command, ...args] : command,
|
|
852
|
-
opts: resolvedOpts
|
|
856
|
+
opts: { tty: false, ...resolvedOpts }
|
|
853
857
|
};
|
|
854
858
|
}
|
|
855
859
|
var CommandError = class extends Error {
|
|
856
|
-
constructor(
|
|
857
|
-
super(output);
|
|
858
|
-
this.
|
|
859
|
-
this.exitCode = exitCode;
|
|
860
|
+
constructor(result) {
|
|
861
|
+
super(result.output);
|
|
862
|
+
this.result = result;
|
|
860
863
|
}
|
|
861
864
|
};
|
|
862
|
-
var
|
|
863
|
-
constructor(output, exitCode) {
|
|
865
|
+
var ProcessResult = class {
|
|
866
|
+
constructor(output, stdout, stderr, exitCode) {
|
|
864
867
|
this.output = output;
|
|
868
|
+
this.stdout = stdout;
|
|
869
|
+
this.stderr = stderr;
|
|
865
870
|
this.exitCode = exitCode;
|
|
866
871
|
}
|
|
867
872
|
throw() {
|
|
868
873
|
if (this.exitCode !== 0) {
|
|
869
|
-
throw new CommandError(this
|
|
874
|
+
throw new CommandError(this);
|
|
870
875
|
}
|
|
871
876
|
return this;
|
|
872
877
|
}
|
|
873
878
|
};
|
|
874
|
-
var
|
|
875
|
-
constructor(
|
|
876
|
-
this.
|
|
879
|
+
var OutputStream = class {
|
|
880
|
+
constructor() {
|
|
881
|
+
this.controller = null;
|
|
882
|
+
this.closed = false;
|
|
883
|
+
this.stream = new ReadableStream({
|
|
884
|
+
start: (controller) => {
|
|
885
|
+
this.controller = controller;
|
|
886
|
+
},
|
|
887
|
+
cancel: () => {
|
|
888
|
+
this.closed = true;
|
|
889
|
+
this.controller = null;
|
|
890
|
+
}
|
|
891
|
+
});
|
|
877
892
|
}
|
|
878
|
-
|
|
879
|
-
|
|
893
|
+
enqueue(value) {
|
|
894
|
+
if (!this.closed) {
|
|
895
|
+
this.controller?.enqueue(value);
|
|
896
|
+
}
|
|
880
897
|
}
|
|
881
|
-
|
|
882
|
-
|
|
898
|
+
close() {
|
|
899
|
+
if (this.closed) {
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
this.closed = true;
|
|
903
|
+
this.controller?.close();
|
|
904
|
+
this.controller = null;
|
|
883
905
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
opts: Object.keys(payloadOpts).length > 0 ? payloadOpts : void 0
|
|
892
|
-
},
|
|
893
|
-
{ abortSignal }
|
|
894
|
-
);
|
|
895
|
-
return new Result(result.output, result.exitCode);
|
|
906
|
+
fail(error51) {
|
|
907
|
+
if (this.closed) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
this.closed = true;
|
|
911
|
+
this.controller?.error(error51);
|
|
912
|
+
this.controller = null;
|
|
896
913
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
dispose();
|
|
915
|
-
if (controller) {
|
|
916
|
-
try {
|
|
917
|
-
controller.close();
|
|
918
|
-
} catch {
|
|
914
|
+
};
|
|
915
|
+
var ShellProcess = class {
|
|
916
|
+
constructor(id, okra, command, opts) {
|
|
917
|
+
this.id = id;
|
|
918
|
+
this.okra = okra;
|
|
919
|
+
const output = new OutputStream();
|
|
920
|
+
const stdout = new OutputStream();
|
|
921
|
+
const stderr = new OutputStream();
|
|
922
|
+
this.output = output.stream;
|
|
923
|
+
this.stdout = stdout.stream;
|
|
924
|
+
this.stderr = stderr.stream;
|
|
925
|
+
this.stdin = new WritableStream({
|
|
926
|
+
write: async (chunk) => {
|
|
927
|
+
const input = typeof chunk === "string" ? chunk : new TextDecoder().decode(chunk);
|
|
928
|
+
const written = await this.okra.invoke("shell.input", { id: this.id, input });
|
|
929
|
+
if (!written) {
|
|
930
|
+
throw new Error(`Process ${this.id} is not accepting input`);
|
|
919
931
|
}
|
|
920
932
|
}
|
|
933
|
+
});
|
|
934
|
+
const encoder = new TextEncoder();
|
|
935
|
+
let subscription = this.okra.listen(`shell.output.${this.id}`, (event) => {
|
|
936
|
+
const data = encoder.encode(event.output);
|
|
937
|
+
const source = event.source ?? "output";
|
|
938
|
+
output.enqueue({ source, data });
|
|
939
|
+
if (source === "stderr") {
|
|
940
|
+
stderr.enqueue(data);
|
|
941
|
+
} else {
|
|
942
|
+
stdout.enqueue(data);
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
const finish = () => {
|
|
946
|
+
subscription?.dispose();
|
|
947
|
+
subscription = null;
|
|
948
|
+
output.close();
|
|
949
|
+
stdout.close();
|
|
950
|
+
stderr.close();
|
|
921
951
|
};
|
|
922
952
|
const fail = (error51) => {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
if (controller) {
|
|
929
|
-
controller.error(error51);
|
|
930
|
-
}
|
|
953
|
+
subscription?.dispose();
|
|
954
|
+
subscription = null;
|
|
955
|
+
output.fail(error51);
|
|
956
|
+
stdout.fail(error51);
|
|
957
|
+
stderr.fail(error51);
|
|
931
958
|
};
|
|
932
|
-
const
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
},
|
|
941
|
-
cancel: () => {
|
|
942
|
-
closed = true;
|
|
943
|
-
dispose();
|
|
944
|
-
}
|
|
945
|
-
});
|
|
946
|
-
const result = this.exec(input.command, { ...input.opts, id }).then((response) => {
|
|
947
|
-
close();
|
|
948
|
-
return response;
|
|
959
|
+
const { abortSignal, ...payloadOpts } = opts;
|
|
960
|
+
this.completion = this.okra.invoke(
|
|
961
|
+
"shell.exec",
|
|
962
|
+
{ command, opts: { ...payloadOpts, id: this.id } },
|
|
963
|
+
{ abortSignal }
|
|
964
|
+
).then((result) => {
|
|
965
|
+
finish();
|
|
966
|
+
return new ProcessResult(result.output, result.stdout, result.stderr, result.exitCode);
|
|
949
967
|
}).catch((error51) => {
|
|
950
968
|
fail(error51);
|
|
951
969
|
throw error51;
|
|
952
970
|
});
|
|
953
|
-
|
|
971
|
+
}
|
|
972
|
+
wait() {
|
|
973
|
+
return this.completion;
|
|
974
|
+
}
|
|
975
|
+
async kill() {
|
|
976
|
+
await this.okra.invoke("shell.kill", { id: this.id });
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
var Shell = class {
|
|
980
|
+
constructor(okra) {
|
|
981
|
+
this.okra = okra;
|
|
982
|
+
}
|
|
983
|
+
run(command, argsOrOpts = [], opts) {
|
|
984
|
+
const input = resolveRunInput(command, argsOrOpts, opts);
|
|
985
|
+
const id = input.opts?.id ?? nanoid();
|
|
986
|
+
return new ShellProcess(id, this.okra, input.command, { ...input.opts, id });
|
|
954
987
|
}
|
|
955
988
|
};
|
|
956
989
|
|
|
@@ -4021,732 +4054,6 @@ var PHPSandbox = (() => {
|
|
|
4021
4054
|
}
|
|
4022
4055
|
};
|
|
4023
4056
|
|
|
4024
|
-
// src/beacon/navigator.ts
|
|
4025
|
-
var Navigator = class {
|
|
4026
|
-
constructor(onEvent, onceEvent, beacon) {
|
|
4027
|
-
this.onEvent = onEvent;
|
|
4028
|
-
this.onceEvent = onceEvent;
|
|
4029
|
-
this.beacon = beacon;
|
|
4030
|
-
this.urlHistory = [];
|
|
4031
|
-
this.currentIndex = 0;
|
|
4032
|
-
this._canGoBack = false;
|
|
4033
|
-
this._canGoForward = false;
|
|
4034
|
-
this.beacon = beacon;
|
|
4035
|
-
this.setupUrlChangeListener();
|
|
4036
|
-
this.urlHistory.push(beacon.iframe.src);
|
|
4037
|
-
this.updateNavigationState();
|
|
4038
|
-
}
|
|
4039
|
-
/**
|
|
4040
|
-
* Navigate to a URL using internal history management
|
|
4041
|
-
*/
|
|
4042
|
-
visit(url2) {
|
|
4043
|
-
if (!this.beacon) {
|
|
4044
|
-
throw new Error("Beacon reference not set");
|
|
4045
|
-
}
|
|
4046
|
-
this.beacon.navigate(url2);
|
|
4047
|
-
if (this.currentIndex < this.urlHistory.length - 1) {
|
|
4048
|
-
this.urlHistory = this.urlHistory.slice(0, this.currentIndex + 1);
|
|
4049
|
-
}
|
|
4050
|
-
this.urlHistory.push(url2);
|
|
4051
|
-
this.currentIndex = this.urlHistory.length - 1;
|
|
4052
|
-
this.updateNavigationState();
|
|
4053
|
-
this.emitHistoryChange(url2, "push");
|
|
4054
|
-
}
|
|
4055
|
-
/**
|
|
4056
|
-
* Set up listener for URL change events from the beacon
|
|
4057
|
-
*/
|
|
4058
|
-
setupUrlChangeListener() {
|
|
4059
|
-
this.beacon.on("urlChange", (payload) => {
|
|
4060
|
-
this.addToHistory(payload.newUrl);
|
|
4061
|
-
});
|
|
4062
|
-
}
|
|
4063
|
-
/**
|
|
4064
|
-
* Add URL to internal history
|
|
4065
|
-
*/
|
|
4066
|
-
addToHistory(url2) {
|
|
4067
|
-
if (this.currentIndex < this.urlHistory.length - 1) {
|
|
4068
|
-
this.urlHistory = this.urlHistory.slice(0, this.currentIndex + 1);
|
|
4069
|
-
}
|
|
4070
|
-
this.urlHistory.push(url2);
|
|
4071
|
-
this.currentIndex = this.urlHistory.length - 1;
|
|
4072
|
-
this.updateNavigationState();
|
|
4073
|
-
}
|
|
4074
|
-
/**
|
|
4075
|
-
* Update internal navigation state and emit changes
|
|
4076
|
-
*/
|
|
4077
|
-
updateNavigationState() {
|
|
4078
|
-
const previousCanGoBack = this._canGoBack;
|
|
4079
|
-
const previousCanGoForward = this._canGoForward;
|
|
4080
|
-
this._canGoBack = this.currentIndex > 0;
|
|
4081
|
-
this._canGoForward = this.currentIndex < this.urlHistory.length - 1;
|
|
4082
|
-
if (previousCanGoBack !== this._canGoBack || previousCanGoForward !== this._canGoForward) {
|
|
4083
|
-
this.emitNavigationStateChange();
|
|
4084
|
-
}
|
|
4085
|
-
}
|
|
4086
|
-
/**
|
|
4087
|
-
* Emit navigation state change event
|
|
4088
|
-
*/
|
|
4089
|
-
emitNavigationStateChange() {
|
|
4090
|
-
if (this.beacon && this.beacon.emit) {
|
|
4091
|
-
this.beacon.emit("navigationStateChange", {
|
|
4092
|
-
canGoBack: this._canGoBack,
|
|
4093
|
-
canGoForward: this._canGoForward,
|
|
4094
|
-
currentIndex: this.currentIndex,
|
|
4095
|
-
historyLength: this.urlHistory.length,
|
|
4096
|
-
timestamp: Date.now()
|
|
4097
|
-
});
|
|
4098
|
-
}
|
|
4099
|
-
}
|
|
4100
|
-
get canGoBack() {
|
|
4101
|
-
return this._canGoBack;
|
|
4102
|
-
}
|
|
4103
|
-
get canGoForward() {
|
|
4104
|
-
return this._canGoForward;
|
|
4105
|
-
}
|
|
4106
|
-
async goBack() {
|
|
4107
|
-
if (!this.canGoBack) {
|
|
4108
|
-
return { success: false, error: "Cannot go back - no previous history" };
|
|
4109
|
-
}
|
|
4110
|
-
this.currentIndex--;
|
|
4111
|
-
this.updateNavigationState();
|
|
4112
|
-
const url2 = this.urlHistory[this.currentIndex];
|
|
4113
|
-
if (!this.beacon) {
|
|
4114
|
-
return { success: false, error: "Beacon reference not set" };
|
|
4115
|
-
}
|
|
4116
|
-
this.beacon.navigate(url2);
|
|
4117
|
-
this.emitHistoryChange(url2, "back");
|
|
4118
|
-
return { success: true, url: url2 };
|
|
4119
|
-
}
|
|
4120
|
-
/**
|
|
4121
|
-
* Navigate forward in internal history
|
|
4122
|
-
*/
|
|
4123
|
-
async goForward() {
|
|
4124
|
-
if (!this.canGoForward) {
|
|
4125
|
-
return { success: false, error: "Cannot go forward - no forward history" };
|
|
4126
|
-
}
|
|
4127
|
-
this.currentIndex++;
|
|
4128
|
-
this.updateNavigationState();
|
|
4129
|
-
const url2 = this.urlHistory[this.currentIndex];
|
|
4130
|
-
if (!this.beacon) {
|
|
4131
|
-
return { success: false, error: "Beacon reference not set" };
|
|
4132
|
-
}
|
|
4133
|
-
this.beacon.navigate(url2);
|
|
4134
|
-
this.emitHistoryChange(url2, "forward");
|
|
4135
|
-
return { success: true, url: url2 };
|
|
4136
|
-
}
|
|
4137
|
-
/**
|
|
4138
|
-
* Reload the current page
|
|
4139
|
-
*/
|
|
4140
|
-
async reload() {
|
|
4141
|
-
if (this.currentIndex >= 0 && this.currentIndex < this.urlHistory.length) {
|
|
4142
|
-
const currentUrl = this.urlHistory[this.currentIndex];
|
|
4143
|
-
if (!this.beacon) {
|
|
4144
|
-
throw new Error("Beacon reference not set");
|
|
4145
|
-
}
|
|
4146
|
-
this.beacon.navigate(currentUrl);
|
|
4147
|
-
this.emitHistoryChange(currentUrl, "reload");
|
|
4148
|
-
}
|
|
4149
|
-
}
|
|
4150
|
-
/**
|
|
4151
|
-
* Get current URL from internal history
|
|
4152
|
-
*/
|
|
4153
|
-
getCurrentUrl() {
|
|
4154
|
-
if (this.currentIndex >= 0 && this.currentIndex < this.urlHistory.length) {
|
|
4155
|
-
return new URL(this.urlHistory[this.currentIndex]);
|
|
4156
|
-
}
|
|
4157
|
-
return new URL("about:blank");
|
|
4158
|
-
}
|
|
4159
|
-
/**
|
|
4160
|
-
* Get the complete history array
|
|
4161
|
-
*/
|
|
4162
|
-
getHistory() {
|
|
4163
|
-
return [...this.urlHistory];
|
|
4164
|
-
}
|
|
4165
|
-
/**
|
|
4166
|
-
* Get current history index
|
|
4167
|
-
*/
|
|
4168
|
-
getCurrentIndex() {
|
|
4169
|
-
return this.currentIndex;
|
|
4170
|
-
}
|
|
4171
|
-
/**
|
|
4172
|
-
* Check if can go back synchronously
|
|
4173
|
-
*/
|
|
4174
|
-
canGoBackSync() {
|
|
4175
|
-
return this.currentIndex > 0;
|
|
4176
|
-
}
|
|
4177
|
-
/**
|
|
4178
|
-
* Check if can go forward synchronously
|
|
4179
|
-
*/
|
|
4180
|
-
canGoForwardSync() {
|
|
4181
|
-
return this.currentIndex < this.urlHistory.length - 1;
|
|
4182
|
-
}
|
|
4183
|
-
/**
|
|
4184
|
-
* Emit history change event
|
|
4185
|
-
*/
|
|
4186
|
-
emitHistoryChange(url2, direction) {
|
|
4187
|
-
if (this.beacon && this.beacon.emit) {
|
|
4188
|
-
this.beacon.emit("historyChange", {
|
|
4189
|
-
url: url2,
|
|
4190
|
-
state: null,
|
|
4191
|
-
direction,
|
|
4192
|
-
timestamp: Date.now()
|
|
4193
|
-
});
|
|
4194
|
-
}
|
|
4195
|
-
}
|
|
4196
|
-
/**
|
|
4197
|
-
* Push a new state to internal history (legacy method for compatibility)
|
|
4198
|
-
*/
|
|
4199
|
-
async pushState(url2) {
|
|
4200
|
-
this.visit(url2);
|
|
4201
|
-
}
|
|
4202
|
-
/**
|
|
4203
|
-
* Replace current state in internal history (legacy method for compatibility)
|
|
4204
|
-
*/
|
|
4205
|
-
async replaceState(url2) {
|
|
4206
|
-
if (this.currentIndex >= 0 && this.currentIndex < this.urlHistory.length) {
|
|
4207
|
-
this.urlHistory[this.currentIndex] = url2;
|
|
4208
|
-
if (!this.beacon) {
|
|
4209
|
-
throw new Error("Beacon reference not set");
|
|
4210
|
-
}
|
|
4211
|
-
this.beacon.navigate(url2);
|
|
4212
|
-
this.emitHistoryChange(url2, "replace");
|
|
4213
|
-
} else {
|
|
4214
|
-
this.visit(url2);
|
|
4215
|
-
}
|
|
4216
|
-
}
|
|
4217
|
-
/**
|
|
4218
|
-
* Get the current history length
|
|
4219
|
-
*/
|
|
4220
|
-
async getHistoryLength() {
|
|
4221
|
-
return this.urlHistory.length;
|
|
4222
|
-
}
|
|
4223
|
-
/**
|
|
4224
|
-
* Get the current history state (always null since we don't store state)
|
|
4225
|
-
*/
|
|
4226
|
-
async getHistoryState() {
|
|
4227
|
-
return null;
|
|
4228
|
-
}
|
|
4229
|
-
/**
|
|
4230
|
-
* Get comprehensive history information
|
|
4231
|
-
*/
|
|
4232
|
-
async getHistoryInfo() {
|
|
4233
|
-
return {
|
|
4234
|
-
length: this.urlHistory.length,
|
|
4235
|
-
state: null,
|
|
4236
|
-
url: this.urlHistory[this.currentIndex] || "",
|
|
4237
|
-
canGoBack: this.canGoBack,
|
|
4238
|
-
canGoForward: this.canGoForward
|
|
4239
|
-
};
|
|
4240
|
-
}
|
|
4241
|
-
/**
|
|
4242
|
-
* Listen for navigator events
|
|
4243
|
-
*/
|
|
4244
|
-
on(event, handler) {
|
|
4245
|
-
return this.onEvent(event, handler);
|
|
4246
|
-
}
|
|
4247
|
-
/**
|
|
4248
|
-
* Listen for navigator events (once)
|
|
4249
|
-
*/
|
|
4250
|
-
once(event, handler) {
|
|
4251
|
-
this.onceEvent(event, handler);
|
|
4252
|
-
}
|
|
4253
|
-
};
|
|
4254
|
-
|
|
4255
|
-
// src/beacon/index.ts
|
|
4256
|
-
function ensureBrowserEnvironment() {
|
|
4257
|
-
if (typeof window === "undefined") {
|
|
4258
|
-
throw new Error("Beacon SDK can only be used in a browser environment");
|
|
4259
|
-
}
|
|
4260
|
-
}
|
|
4261
|
-
var BeaconError = class extends Error {
|
|
4262
|
-
constructor(message, code) {
|
|
4263
|
-
super(message);
|
|
4264
|
-
this.code = code;
|
|
4265
|
-
this.name = "BeaconError";
|
|
4266
|
-
}
|
|
4267
|
-
};
|
|
4268
|
-
var BeaconTimeoutError = class extends BeaconError {
|
|
4269
|
-
constructor(operation, timeoutMs) {
|
|
4270
|
-
super(`Beacon operation '${operation}' timed out after ${timeoutMs}ms`);
|
|
4271
|
-
this.code = "TIMEOUT";
|
|
4272
|
-
}
|
|
4273
|
-
};
|
|
4274
|
-
var BeaconConnectionError = class extends BeaconError {
|
|
4275
|
-
constructor(message) {
|
|
4276
|
-
super(`Beacon connection error: ${message}`);
|
|
4277
|
-
this.code = "CONNECTION_ERROR";
|
|
4278
|
-
}
|
|
4279
|
-
};
|
|
4280
|
-
var Beacon = class {
|
|
4281
|
-
constructor(iframe, options = {}) {
|
|
4282
|
-
this.messageHandlers = /* @__PURE__ */ new Map();
|
|
4283
|
-
this.isBeaconReady = false;
|
|
4284
|
-
this.readyPromise = null;
|
|
4285
|
-
this.isStarted = false;
|
|
4286
|
-
this.disposables = [];
|
|
4287
|
-
// MessagePort communication
|
|
4288
|
-
this.messageChannel = null;
|
|
4289
|
-
this.port = null;
|
|
4290
|
-
this.channelEstablished = false;
|
|
4291
|
-
ensureBrowserEnvironment();
|
|
4292
|
-
this.iframe = iframe;
|
|
4293
|
-
const defaultRetryOptions = {
|
|
4294
|
-
retries: 3,
|
|
4295
|
-
minTimeout: 1e3,
|
|
4296
|
-
maxTimeout: 5e3,
|
|
4297
|
-
factor: 2,
|
|
4298
|
-
randomize: true
|
|
4299
|
-
};
|
|
4300
|
-
this.options = {
|
|
4301
|
-
timeout: 1e4,
|
|
4302
|
-
targetOrigin: "*",
|
|
4303
|
-
debug: false,
|
|
4304
|
-
retry: {
|
|
4305
|
-
...defaultRetryOptions,
|
|
4306
|
-
...options.retry
|
|
4307
|
-
},
|
|
4308
|
-
...options
|
|
4309
|
-
};
|
|
4310
|
-
this.eventEmitter = EventManager.make();
|
|
4311
|
-
this.setupMessageChannel();
|
|
4312
|
-
this.navigator = new Navigator(
|
|
4313
|
-
this.eventEmitter.listen.bind(this.eventEmitter),
|
|
4314
|
-
this.eventEmitter.once.bind(this.eventEmitter),
|
|
4315
|
-
this
|
|
4316
|
-
);
|
|
4317
|
-
}
|
|
4318
|
-
/**
|
|
4319
|
-
* Setup communication channel using MessagePort
|
|
4320
|
-
*/
|
|
4321
|
-
setupMessageChannel() {
|
|
4322
|
-
const readyHandler = (event) => {
|
|
4323
|
-
try {
|
|
4324
|
-
if (event.source !== this.iframe.contentWindow) {
|
|
4325
|
-
return;
|
|
4326
|
-
}
|
|
4327
|
-
const message = event.data;
|
|
4328
|
-
if (!message || typeof message !== "object" || !message.type) {
|
|
4329
|
-
return;
|
|
4330
|
-
}
|
|
4331
|
-
if (message.type === "beacon:ready-for-channel") {
|
|
4332
|
-
this.establishChannel().catch((error51) => {
|
|
4333
|
-
if (this.options.debug) {
|
|
4334
|
-
console.error("[Beacon SDK] Channel establishment failed:", error51);
|
|
4335
|
-
}
|
|
4336
|
-
});
|
|
4337
|
-
}
|
|
4338
|
-
if (message.type === "beacon:channel-established") {
|
|
4339
|
-
this.channelEstablished = true;
|
|
4340
|
-
this.isBeaconReady = true;
|
|
4341
|
-
this.emit("ready", message.payload);
|
|
4342
|
-
if (this.options.debug) {
|
|
4343
|
-
console.log("[Beacon SDK] Channel established and beacon ready");
|
|
4344
|
-
}
|
|
4345
|
-
}
|
|
4346
|
-
} catch (error51) {
|
|
4347
|
-
if (this.options.debug) {
|
|
4348
|
-
console.error("[Beacon SDK] Message parsing error:", error51);
|
|
4349
|
-
}
|
|
4350
|
-
}
|
|
4351
|
-
};
|
|
4352
|
-
window.addEventListener("message", readyHandler);
|
|
4353
|
-
this.disposables.push({
|
|
4354
|
-
dispose: () => window.removeEventListener("message", readyHandler)
|
|
4355
|
-
});
|
|
4356
|
-
}
|
|
4357
|
-
/**
|
|
4358
|
-
* Establish MessagePort communication channel
|
|
4359
|
-
*/
|
|
4360
|
-
async establishChannel() {
|
|
4361
|
-
if (!this.iframe.contentWindow) {
|
|
4362
|
-
throw new BeaconConnectionError("Iframe contentWindow not available");
|
|
4363
|
-
}
|
|
4364
|
-
this.messageChannel = new MessageChannel();
|
|
4365
|
-
this.port = this.messageChannel.port1;
|
|
4366
|
-
this.port.onmessage = (event) => {
|
|
4367
|
-
this.handleBeaconMessage(event.data);
|
|
4368
|
-
};
|
|
4369
|
-
this.port.onmessageerror = (event) => {
|
|
4370
|
-
if (this.options.debug) {
|
|
4371
|
-
console.error("[Beacon SDK] Port message error:", event);
|
|
4372
|
-
}
|
|
4373
|
-
};
|
|
4374
|
-
this.port.start();
|
|
4375
|
-
const establishMessage = {
|
|
4376
|
-
type: "beacon:establish-channel",
|
|
4377
|
-
timestamp: Date.now(),
|
|
4378
|
-
id: this.generateId()
|
|
4379
|
-
};
|
|
4380
|
-
this.iframe.contentWindow.postMessage(
|
|
4381
|
-
establishMessage,
|
|
4382
|
-
"*",
|
|
4383
|
-
// Safe for channel establishment
|
|
4384
|
-
[this.messageChannel.port2]
|
|
4385
|
-
// Transfer the port
|
|
4386
|
-
);
|
|
4387
|
-
if (this.options.debug) {
|
|
4388
|
-
console.log("[Beacon SDK] Channel establishment message sent");
|
|
4389
|
-
}
|
|
4390
|
-
return new Promise((resolve, reject) => {
|
|
4391
|
-
const timeoutId = setTimeout(() => {
|
|
4392
|
-
reject(new BeaconConnectionError("Channel establishment timeout"));
|
|
4393
|
-
}, this.options.timeout);
|
|
4394
|
-
const checkReady = () => {
|
|
4395
|
-
if (this.channelEstablished && this.isBeaconReady) {
|
|
4396
|
-
clearTimeout(timeoutId);
|
|
4397
|
-
resolve();
|
|
4398
|
-
} else {
|
|
4399
|
-
setTimeout(checkReady, 100);
|
|
4400
|
-
}
|
|
4401
|
-
};
|
|
4402
|
-
checkReady();
|
|
4403
|
-
});
|
|
4404
|
-
}
|
|
4405
|
-
/**
|
|
4406
|
-
* Handle incoming beacon messages
|
|
4407
|
-
*/
|
|
4408
|
-
handleBeaconMessage(message) {
|
|
4409
|
-
if (this.options.debug) {
|
|
4410
|
-
console.log("[Beacon SDK] Received message:", message.type, message.payload);
|
|
4411
|
-
}
|
|
4412
|
-
const eventType = message.type.replace("beacon:", "");
|
|
4413
|
-
this.emit(eventType, message.payload);
|
|
4414
|
-
const handlers = this.messageHandlers.get(message.type);
|
|
4415
|
-
if (handlers) {
|
|
4416
|
-
handlers.forEach((handler) => {
|
|
4417
|
-
try {
|
|
4418
|
-
handler(message.payload);
|
|
4419
|
-
} catch (error51) {
|
|
4420
|
-
if (this.options.debug) {
|
|
4421
|
-
console.error("[Beacon SDK] Message handler error:", error51);
|
|
4422
|
-
}
|
|
4423
|
-
}
|
|
4424
|
-
});
|
|
4425
|
-
}
|
|
4426
|
-
}
|
|
4427
|
-
/**
|
|
4428
|
-
* Wait for beacon to be ready - simplified approach
|
|
4429
|
-
*/
|
|
4430
|
-
waitForBeaconReady() {
|
|
4431
|
-
return retry(
|
|
4432
|
-
async () => {
|
|
4433
|
-
return new Promise((resolve, reject) => {
|
|
4434
|
-
if (this.isBeaconReady && this.channelEstablished) {
|
|
4435
|
-
resolve();
|
|
4436
|
-
return;
|
|
4437
|
-
}
|
|
4438
|
-
const timeoutMs = this.options.timeout;
|
|
4439
|
-
const timeoutId = setTimeout(() => {
|
|
4440
|
-
reject(new BeaconTimeoutError("beacon ready", timeoutMs));
|
|
4441
|
-
}, timeoutMs);
|
|
4442
|
-
const unsubscribe = this.on("ready", () => {
|
|
4443
|
-
clearTimeout(timeoutId);
|
|
4444
|
-
unsubscribe.dispose();
|
|
4445
|
-
resolve();
|
|
4446
|
-
});
|
|
4447
|
-
});
|
|
4448
|
-
},
|
|
4449
|
-
{
|
|
4450
|
-
retries: this.options.retry?.retries ?? 3,
|
|
4451
|
-
minTimeout: this.options.retry?.minTimeout ?? 1e3,
|
|
4452
|
-
maxTimeout: this.options.retry?.maxTimeout ?? 5e3,
|
|
4453
|
-
factor: this.options.retry?.factor ?? 2,
|
|
4454
|
-
randomize: this.options.retry?.randomize ?? true,
|
|
4455
|
-
onRetry: (error51, attempt) => {
|
|
4456
|
-
if (this.options.debug) {
|
|
4457
|
-
const errorMessage = error51 instanceof Error ? error51.message : String(error51);
|
|
4458
|
-
console.warn(`[Beacon SDK] Beacon ready retry attempt ${attempt}:`, errorMessage);
|
|
4459
|
-
}
|
|
4460
|
-
this.isBeaconReady = false;
|
|
4461
|
-
this.channelEstablished = false;
|
|
4462
|
-
}
|
|
4463
|
-
}
|
|
4464
|
-
);
|
|
4465
|
-
}
|
|
4466
|
-
/**
|
|
4467
|
-
* Send a message to the beacon via MessagePort
|
|
4468
|
-
*/
|
|
4469
|
-
sendMessage(type, payload = {}) {
|
|
4470
|
-
if (!this.port) {
|
|
4471
|
-
throw new BeaconConnectionError("MessagePort not available - channel not established");
|
|
4472
|
-
}
|
|
4473
|
-
const message = {
|
|
4474
|
-
type: `beacon:${type}`,
|
|
4475
|
-
payload,
|
|
4476
|
-
timestamp: Date.now(),
|
|
4477
|
-
source: "parent",
|
|
4478
|
-
id: this.generateId()
|
|
4479
|
-
};
|
|
4480
|
-
try {
|
|
4481
|
-
this.port.postMessage(message);
|
|
4482
|
-
if (this.options.debug) {
|
|
4483
|
-
console.log("[Beacon SDK] Sent message via port:", message.type, message.payload);
|
|
4484
|
-
}
|
|
4485
|
-
} catch (error51) {
|
|
4486
|
-
throw new BeaconConnectionError(
|
|
4487
|
-
`Failed to send message via port: ${error51 instanceof Error ? error51.message : String(error51)}`
|
|
4488
|
-
);
|
|
4489
|
-
}
|
|
4490
|
-
}
|
|
4491
|
-
/**
|
|
4492
|
-
* Send a message and wait for a specific response with retry logic
|
|
4493
|
-
*/
|
|
4494
|
-
async sendAndWaitFor(sendType, responseType, payload = {}, timeoutMs) {
|
|
4495
|
-
await this.ready();
|
|
4496
|
-
return retry(
|
|
4497
|
-
async (bail) => {
|
|
4498
|
-
return new Promise((resolve, reject) => {
|
|
4499
|
-
const actualTimeout = timeoutMs || this.options.timeout;
|
|
4500
|
-
const timeoutId = setTimeout(() => {
|
|
4501
|
-
unsubscribe.dispose();
|
|
4502
|
-
const error51 = new BeaconTimeoutError(sendType, actualTimeout);
|
|
4503
|
-
reject(error51);
|
|
4504
|
-
}, actualTimeout);
|
|
4505
|
-
const unsubscribe = this.eventEmitter.listen(responseType, (data) => {
|
|
4506
|
-
clearTimeout(timeoutId);
|
|
4507
|
-
unsubscribe.dispose();
|
|
4508
|
-
resolve(data);
|
|
4509
|
-
});
|
|
4510
|
-
try {
|
|
4511
|
-
this.sendMessage(sendType, payload);
|
|
4512
|
-
} catch (error51) {
|
|
4513
|
-
clearTimeout(timeoutId);
|
|
4514
|
-
unsubscribe.dispose();
|
|
4515
|
-
if (error51 instanceof BeaconConnectionError) {
|
|
4516
|
-
reject(error51);
|
|
4517
|
-
} else {
|
|
4518
|
-
bail(error51);
|
|
4519
|
-
}
|
|
4520
|
-
}
|
|
4521
|
-
});
|
|
4522
|
-
},
|
|
4523
|
-
{
|
|
4524
|
-
retries: this.options.retry?.retries ?? 3,
|
|
4525
|
-
minTimeout: this.options.retry?.minTimeout ?? 1e3,
|
|
4526
|
-
maxTimeout: this.options.retry?.maxTimeout ?? 5e3,
|
|
4527
|
-
factor: this.options.retry?.factor ?? 2,
|
|
4528
|
-
randomize: this.options.retry?.randomize ?? true,
|
|
4529
|
-
onRetry: (error51, attempt) => {
|
|
4530
|
-
if (this.options.debug) {
|
|
4531
|
-
const errorMessage = error51 instanceof Error ? error51.message : String(error51);
|
|
4532
|
-
console.warn(`[Beacon SDK] Retry attempt ${attempt} for ${sendType}:`, errorMessage);
|
|
4533
|
-
}
|
|
4534
|
-
}
|
|
4535
|
-
}
|
|
4536
|
-
);
|
|
4537
|
-
}
|
|
4538
|
-
/**
|
|
4539
|
-
* Generate a unique ID for messages
|
|
4540
|
-
*/
|
|
4541
|
-
generateId() {
|
|
4542
|
-
return `sdk_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
4543
|
-
}
|
|
4544
|
-
/**
|
|
4545
|
-
* Event emitter methods (both private and public for navigator access)
|
|
4546
|
-
*/
|
|
4547
|
-
emit(event, payload) {
|
|
4548
|
-
this.eventEmitter.emit(event, payload);
|
|
4549
|
-
}
|
|
4550
|
-
/**
|
|
4551
|
-
* Start the beacon initialization process
|
|
4552
|
-
*/
|
|
4553
|
-
start() {
|
|
4554
|
-
if (this.isStarted) {
|
|
4555
|
-
return this.readyPromise || Promise.resolve();
|
|
4556
|
-
}
|
|
4557
|
-
this.isStarted = true;
|
|
4558
|
-
this.readyPromise = this.waitForBeaconReady();
|
|
4559
|
-
return this.readyPromise;
|
|
4560
|
-
}
|
|
4561
|
-
/**
|
|
4562
|
-
* Wait for the beacon to be ready
|
|
4563
|
-
*/
|
|
4564
|
-
async ready() {
|
|
4565
|
-
if (!this.isStarted) {
|
|
4566
|
-
throw new BeaconError("Beacon has not been started. Call start() first.");
|
|
4567
|
-
}
|
|
4568
|
-
if (!this.readyPromise) {
|
|
4569
|
-
throw new BeaconError("Beacon ready promise is not available");
|
|
4570
|
-
}
|
|
4571
|
-
return timeout(this.readyPromise, this.options.timeout);
|
|
4572
|
-
}
|
|
4573
|
-
/**
|
|
4574
|
-
* Check if beacon is ready
|
|
4575
|
-
*/
|
|
4576
|
-
get isReady() {
|
|
4577
|
-
return this.isBeaconReady;
|
|
4578
|
-
}
|
|
4579
|
-
/**
|
|
4580
|
-
* Listen for beacon events
|
|
4581
|
-
*/
|
|
4582
|
-
on(event, handler) {
|
|
4583
|
-
return this.eventEmitter.listen(event, handler);
|
|
4584
|
-
}
|
|
4585
|
-
/**
|
|
4586
|
-
* Listen for beacon events (one-time)
|
|
4587
|
-
*/
|
|
4588
|
-
once(event, handler) {
|
|
4589
|
-
return this.eventEmitter.once(event, handler);
|
|
4590
|
-
}
|
|
4591
|
-
/**
|
|
4592
|
-
* Ping the beacon to check if it's responsive
|
|
4593
|
-
*/
|
|
4594
|
-
async ping() {
|
|
4595
|
-
try {
|
|
4596
|
-
await this.sendAndWaitFor("ping", "pong", { timestamp: Date.now() });
|
|
4597
|
-
return true;
|
|
4598
|
-
} catch (error51) {
|
|
4599
|
-
if (this.options.debug) {
|
|
4600
|
-
console.warn("[Beacon SDK] Ping failed:", error51);
|
|
4601
|
-
}
|
|
4602
|
-
return false;
|
|
4603
|
-
}
|
|
4604
|
-
}
|
|
4605
|
-
/**
|
|
4606
|
-
* Get debug information from the beacon
|
|
4607
|
-
*/
|
|
4608
|
-
async getDebugInfo() {
|
|
4609
|
-
return this.sendAndWaitFor("getDebugInfo", "debugInfo");
|
|
4610
|
-
}
|
|
4611
|
-
/**
|
|
4612
|
-
* Get console events from the beacon
|
|
4613
|
-
*/
|
|
4614
|
-
async getConsoleEvents() {
|
|
4615
|
-
return this.sendAndWaitFor("getConsoleEvents", "consoleEvents");
|
|
4616
|
-
}
|
|
4617
|
-
/**
|
|
4618
|
-
* Get error events from the beacon
|
|
4619
|
-
*/
|
|
4620
|
-
async getErrorEvents() {
|
|
4621
|
-
return this.sendAndWaitFor("getErrorEvents", "errorEvents");
|
|
4622
|
-
}
|
|
4623
|
-
/**
|
|
4624
|
-
* Clear console events in the beacon
|
|
4625
|
-
*/
|
|
4626
|
-
async clearConsole() {
|
|
4627
|
-
await this.ready();
|
|
4628
|
-
this.sendMessage("clearConsole");
|
|
4629
|
-
}
|
|
4630
|
-
/**
|
|
4631
|
-
* Clear error events in the beacon
|
|
4632
|
-
*/
|
|
4633
|
-
async clearErrors() {
|
|
4634
|
-
await this.ready();
|
|
4635
|
-
this.sendMessage("clearErrors");
|
|
4636
|
-
}
|
|
4637
|
-
/**
|
|
4638
|
-
* Execute code in the beacon context
|
|
4639
|
-
*/
|
|
4640
|
-
async executeCode(code) {
|
|
4641
|
-
return this.sendAndWaitFor("executeCode", "codeExecutionResult", { code });
|
|
4642
|
-
}
|
|
4643
|
-
/**
|
|
4644
|
-
* Inspect an element in the beacon context
|
|
4645
|
-
*/
|
|
4646
|
-
async inspectElement(selector) {
|
|
4647
|
-
return this.sendAndWaitFor("inspectElement", "elementInspectionResult", { selector });
|
|
4648
|
-
}
|
|
4649
|
-
/**
|
|
4650
|
-
* Fetch a URL in the beacon context
|
|
4651
|
-
*/
|
|
4652
|
-
async fetch(request) {
|
|
4653
|
-
return this.sendAndWaitFor("fetch", "fetchResult", request);
|
|
4654
|
-
}
|
|
4655
|
-
/**
|
|
4656
|
-
* Capture the current beacon document, optionally clipped to a viewport or document rectangle.
|
|
4657
|
-
*/
|
|
4658
|
-
async captureScreenshot(request = {}) {
|
|
4659
|
-
const mediaTimeoutMs = request.mediaTimeoutMs ?? request.timeout ?? 3e4;
|
|
4660
|
-
const timeoutMs = request.transportTimeoutMs ?? mediaTimeoutMs + 5e3;
|
|
4661
|
-
return this.sendAndWaitFor("captureScreenshot", "screenshotResult", request, timeoutMs);
|
|
4662
|
-
}
|
|
4663
|
-
/**
|
|
4664
|
-
* Debug a page (navigate and capture debug information). It loads
|
|
4665
|
-
* the page fresh in the IFRAME so that we can capture the latest state.
|
|
4666
|
-
*/
|
|
4667
|
-
async debug(request, waitSeconds) {
|
|
4668
|
-
const targetUrl = new URL(request.path, this.iframe.src || window.location.origin).href;
|
|
4669
|
-
if (this.iframe.src !== targetUrl) {
|
|
4670
|
-
this.navigator.visit(targetUrl);
|
|
4671
|
-
await this.ready();
|
|
4672
|
-
}
|
|
4673
|
-
waitSeconds && await this.wait(waitSeconds);
|
|
4674
|
-
const timeoutMs = (request.options?.timeout || 3e4) + 5e3;
|
|
4675
|
-
return this.sendAndWaitFor("debug", "debugResult", request, timeoutMs);
|
|
4676
|
-
}
|
|
4677
|
-
async wait(forSeconds) {
|
|
4678
|
-
return new Promise((resolve) => setTimeout(resolve, forSeconds * 1e3));
|
|
4679
|
-
}
|
|
4680
|
-
/**
|
|
4681
|
-
* Navigate the iframe to a new URL
|
|
4682
|
-
*/
|
|
4683
|
-
navigate(url2) {
|
|
4684
|
-
if (!this.iframe) {
|
|
4685
|
-
throw new BeaconConnectionError("Iframe not available");
|
|
4686
|
-
}
|
|
4687
|
-
try {
|
|
4688
|
-
const targetUrl = new URL(url2, this.iframe.src || window.location.origin);
|
|
4689
|
-
this.iframe.src = targetUrl.href;
|
|
4690
|
-
this.isBeaconReady = false;
|
|
4691
|
-
this.channelEstablished = false;
|
|
4692
|
-
if (this.port) {
|
|
4693
|
-
this.port.close();
|
|
4694
|
-
this.port = null;
|
|
4695
|
-
}
|
|
4696
|
-
if (this.messageChannel) {
|
|
4697
|
-
this.messageChannel = null;
|
|
4698
|
-
}
|
|
4699
|
-
if (this.isStarted) {
|
|
4700
|
-
this.readyPromise = this.waitForBeaconReady();
|
|
4701
|
-
}
|
|
4702
|
-
} catch (error51) {
|
|
4703
|
-
throw new BeaconConnectionError(`Invalid URL: ${url2}`);
|
|
4704
|
-
}
|
|
4705
|
-
}
|
|
4706
|
-
/**
|
|
4707
|
-
* Get current iframe URL
|
|
4708
|
-
*/
|
|
4709
|
-
get url() {
|
|
4710
|
-
return this.iframe.src;
|
|
4711
|
-
}
|
|
4712
|
-
/**
|
|
4713
|
-
* Get the iframe element
|
|
4714
|
-
*/
|
|
4715
|
-
get element() {
|
|
4716
|
-
return this.iframe;
|
|
4717
|
-
}
|
|
4718
|
-
/**
|
|
4719
|
-
* Dispose of all resources
|
|
4720
|
-
*/
|
|
4721
|
-
dispose() {
|
|
4722
|
-
if (this.port) {
|
|
4723
|
-
this.port.close();
|
|
4724
|
-
this.port = null;
|
|
4725
|
-
}
|
|
4726
|
-
if (this.messageChannel) {
|
|
4727
|
-
this.messageChannel = null;
|
|
4728
|
-
}
|
|
4729
|
-
this.disposables.forEach((disposable) => disposable.dispose());
|
|
4730
|
-
this.disposables = [];
|
|
4731
|
-
this.messageHandlers.clear();
|
|
4732
|
-
this.isBeaconReady = false;
|
|
4733
|
-
this.channelEstablished = false;
|
|
4734
|
-
this.isStarted = false;
|
|
4735
|
-
this.readyPromise = null;
|
|
4736
|
-
}
|
|
4737
|
-
};
|
|
4738
|
-
function createBeacon(iframe, options) {
|
|
4739
|
-
return new Beacon(iframe, options);
|
|
4740
|
-
}
|
|
4741
|
-
function isBeaconSupported() {
|
|
4742
|
-
try {
|
|
4743
|
-
ensureBrowserEnvironment();
|
|
4744
|
-
return true;
|
|
4745
|
-
} catch {
|
|
4746
|
-
return false;
|
|
4747
|
-
}
|
|
4748
|
-
}
|
|
4749
|
-
|
|
4750
4057
|
// node_modules/zod/v4/classic/external.js
|
|
4751
4058
|
var external_exports = {};
|
|
4752
4059
|
__export(external_exports, {
|
|
@@ -19261,13 +18568,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19261
18568
|
// node_modules/zod/v4/classic/external.js
|
|
19262
18569
|
config(en_default());
|
|
19263
18570
|
|
|
19264
|
-
// src/schemas/
|
|
19265
|
-
var
|
|
19266
|
-
"
|
|
19267
|
-
"
|
|
19268
|
-
"
|
|
18571
|
+
// src/schemas/publications.ts
|
|
18572
|
+
var PublicationProviderNameSchema = external_exports.enum([
|
|
18573
|
+
"cloudflare-containers",
|
|
18574
|
+
"ssh-server",
|
|
18575
|
+
"laravel-cloud"
|
|
19269
18576
|
]);
|
|
19270
|
-
var
|
|
18577
|
+
var PublicationStatusSchema = external_exports.enum([
|
|
19271
18578
|
"pending",
|
|
19272
18579
|
"queued",
|
|
19273
18580
|
"building",
|
|
@@ -19279,7 +18586,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19279
18586
|
"deleted",
|
|
19280
18587
|
"delete_failed"
|
|
19281
18588
|
]);
|
|
19282
|
-
var
|
|
18589
|
+
var PublicationBuildStatusSchema = external_exports.enum([
|
|
19283
18590
|
"pending",
|
|
19284
18591
|
"queued",
|
|
19285
18592
|
"running",
|
|
@@ -19287,8 +18594,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19287
18594
|
"failed",
|
|
19288
18595
|
"cancelled"
|
|
19289
18596
|
]);
|
|
19290
|
-
var
|
|
19291
|
-
var
|
|
18597
|
+
var PublicationReleaseStatusSchema = external_exports.enum(["created", "ready", "deleted"]);
|
|
18598
|
+
var PublicationSizeSchema = external_exports.enum([
|
|
19292
18599
|
"nano",
|
|
19293
18600
|
"small",
|
|
19294
18601
|
"medium",
|
|
@@ -19298,7 +18605,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19298
18605
|
"standard-1",
|
|
19299
18606
|
"standard-2"
|
|
19300
18607
|
]);
|
|
19301
|
-
var
|
|
18608
|
+
var PublicationRegionSchema = external_exports.enum([
|
|
19302
18609
|
"ENAM",
|
|
19303
18610
|
"WNAM",
|
|
19304
18611
|
"EEUR",
|
|
@@ -19309,103 +18616,103 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19309
18616
|
"OC",
|
|
19310
18617
|
"AFR"
|
|
19311
18618
|
]);
|
|
19312
|
-
var
|
|
19313
|
-
var
|
|
19314
|
-
var
|
|
19315
|
-
var
|
|
19316
|
-
var
|
|
19317
|
-
var
|
|
18619
|
+
var PublicationJurisdictionSchema = external_exports.enum(["eu", "fedramp"]);
|
|
18620
|
+
var PublicationDomainDnsRecordTypeSchema = external_exports.enum(["CNAME", "ALIAS", "ANAME"]);
|
|
18621
|
+
var PublicationProtectionModeSchema = external_exports.enum(["none", "password"]);
|
|
18622
|
+
var PublicationLogStreamSchema = external_exports.enum(["build", "runtime"]);
|
|
18623
|
+
var PublishStreamLogStreamSchema = external_exports.enum(["build", "publish", "runtime"]);
|
|
18624
|
+
var PublicationEventDataSchema = external_exports.object({
|
|
19318
18625
|
id: external_exports.union([external_exports.number(), external_exports.string()]).optional(),
|
|
19319
18626
|
sequence: external_exports.number(),
|
|
19320
18627
|
type: external_exports.string(),
|
|
19321
18628
|
payload: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
19322
18629
|
createdAt: external_exports.string().nullable()
|
|
19323
18630
|
}).passthrough();
|
|
19324
|
-
var
|
|
18631
|
+
var PublicationLogChunkDataSchema = external_exports.object({
|
|
19325
18632
|
sequence: external_exports.number(),
|
|
19326
|
-
stream:
|
|
18633
|
+
stream: PublicationLogStreamSchema,
|
|
19327
18634
|
content: external_exports.string(),
|
|
19328
18635
|
createdAt: external_exports.string().nullable()
|
|
19329
18636
|
}).passthrough();
|
|
19330
|
-
var
|
|
18637
|
+
var PublishStreamPhaseSchema = external_exports.object({
|
|
19331
18638
|
name: external_exports.string(),
|
|
19332
18639
|
status: external_exports.enum(["running", "completed", "failed"]).optional(),
|
|
19333
18640
|
data: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
19334
18641
|
}).strict();
|
|
19335
|
-
var
|
|
19336
|
-
stream:
|
|
18642
|
+
var PublishStreamLogSchema = external_exports.object({
|
|
18643
|
+
stream: PublishStreamLogStreamSchema,
|
|
19337
18644
|
content: external_exports.string()
|
|
19338
18645
|
}).strict();
|
|
19339
|
-
var
|
|
18646
|
+
var PublishStreamResultSchema = external_exports.object({
|
|
19340
18647
|
success: external_exports.boolean(),
|
|
19341
|
-
|
|
18648
|
+
publicationId: external_exports.string(),
|
|
19342
18649
|
buildId: external_exports.string(),
|
|
19343
18650
|
releaseId: external_exports.string(),
|
|
19344
|
-
status:
|
|
18651
|
+
status: PublicationStatusSchema
|
|
19345
18652
|
}).strict();
|
|
19346
|
-
var
|
|
18653
|
+
var PublishStreamPhaseEventSchema = PublishStreamPhaseSchema.extend({
|
|
19347
18654
|
type: external_exports.literal("phase")
|
|
19348
18655
|
}).strict();
|
|
19349
|
-
var
|
|
18656
|
+
var PublishStreamLogEventSchema = PublishStreamLogSchema.extend({
|
|
19350
18657
|
type: external_exports.literal("log")
|
|
19351
18658
|
}).strict();
|
|
19352
|
-
var
|
|
18659
|
+
var PublishStreamResultEventSchema = PublishStreamResultSchema.extend({
|
|
19353
18660
|
type: external_exports.literal("result")
|
|
19354
18661
|
}).strict();
|
|
19355
|
-
var
|
|
19356
|
-
|
|
19357
|
-
|
|
19358
|
-
|
|
18662
|
+
var PublishStreamEventSchema = external_exports.discriminatedUnion("type", [
|
|
18663
|
+
PublishStreamPhaseEventSchema,
|
|
18664
|
+
PublishStreamLogEventSchema,
|
|
18665
|
+
PublishStreamResultEventSchema
|
|
19359
18666
|
]);
|
|
19360
|
-
var
|
|
18667
|
+
var PublishStreamErrorSchema = external_exports.object({
|
|
19361
18668
|
message: external_exports.string().optional()
|
|
19362
18669
|
}).passthrough();
|
|
19363
|
-
var
|
|
19364
|
-
var
|
|
18670
|
+
var PublishStreamSseEventNameSchema = external_exports.enum(["phase", "log", "done", "result", "error"]);
|
|
18671
|
+
var PublishStreamSsePhaseEventSchema = external_exports.object({
|
|
19365
18672
|
event: external_exports.literal("phase"),
|
|
19366
|
-
data:
|
|
18673
|
+
data: PublishStreamPhaseSchema
|
|
19367
18674
|
}).strict();
|
|
19368
|
-
var
|
|
18675
|
+
var PublishStreamSseLogEventSchema = external_exports.object({
|
|
19369
18676
|
event: external_exports.literal("log"),
|
|
19370
|
-
data:
|
|
18677
|
+
data: PublishStreamLogSchema
|
|
19371
18678
|
}).strict();
|
|
19372
|
-
var
|
|
18679
|
+
var PublishStreamSseDoneEventSchema = external_exports.object({
|
|
19373
18680
|
event: external_exports.literal("done"),
|
|
19374
|
-
data:
|
|
18681
|
+
data: PublishStreamResultSchema
|
|
19375
18682
|
}).strict();
|
|
19376
|
-
var
|
|
18683
|
+
var PublishStreamSseResultEventSchema = external_exports.object({
|
|
19377
18684
|
event: external_exports.literal("result"),
|
|
19378
|
-
data:
|
|
18685
|
+
data: PublishStreamResultSchema
|
|
19379
18686
|
}).strict();
|
|
19380
|
-
var
|
|
18687
|
+
var PublishStreamSseErrorEventSchema = external_exports.object({
|
|
19381
18688
|
event: external_exports.literal("error"),
|
|
19382
|
-
data:
|
|
18689
|
+
data: PublishStreamErrorSchema
|
|
19383
18690
|
}).strict();
|
|
19384
|
-
var
|
|
19385
|
-
|
|
19386
|
-
|
|
19387
|
-
|
|
19388
|
-
|
|
19389
|
-
|
|
18691
|
+
var PublishStreamSseEventSchema = external_exports.discriminatedUnion("event", [
|
|
18692
|
+
PublishStreamSsePhaseEventSchema,
|
|
18693
|
+
PublishStreamSseLogEventSchema,
|
|
18694
|
+
PublishStreamSseDoneEventSchema,
|
|
18695
|
+
PublishStreamSseResultEventSchema,
|
|
18696
|
+
PublishStreamSseErrorEventSchema
|
|
19390
18697
|
]).transform((event) => {
|
|
19391
18698
|
if (event.event === "error") {
|
|
19392
|
-
throw new Error(event.data.message ?? "
|
|
18699
|
+
throw new Error(event.data.message ?? "Publish failed");
|
|
19393
18700
|
}
|
|
19394
18701
|
const type = event.event === "done" ? "result" : event.event;
|
|
19395
|
-
return
|
|
18702
|
+
return PublishStreamEventSchema.parse({ type, ...event.data });
|
|
19396
18703
|
});
|
|
19397
18704
|
|
|
19398
|
-
// src/
|
|
19399
|
-
var
|
|
18705
|
+
// src/publications.ts
|
|
18706
|
+
var NotebookPublicationApi = class {
|
|
19400
18707
|
constructor(client) {
|
|
19401
18708
|
this.client = client;
|
|
19402
18709
|
}
|
|
19403
18710
|
async current(notebookId) {
|
|
19404
18711
|
try {
|
|
19405
18712
|
const response = await this.client.get(
|
|
19406
|
-
`/notebook/${notebookId}/
|
|
18713
|
+
`/notebook/${notebookId}/publication`
|
|
19407
18714
|
);
|
|
19408
|
-
return new
|
|
18715
|
+
return new PublicationInstance(response.data, this.client, notebookId);
|
|
19409
18716
|
} catch (error51) {
|
|
19410
18717
|
if (error51 instanceof ApiError && error51.status === 404) {
|
|
19411
18718
|
return null;
|
|
@@ -19415,89 +18722,82 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19415
18722
|
}
|
|
19416
18723
|
async publish(notebookId, input) {
|
|
19417
18724
|
const response = await this.client.post(
|
|
19418
|
-
`/notebook/${notebookId}/
|
|
18725
|
+
`/notebook/${notebookId}/publication`,
|
|
19419
18726
|
input
|
|
19420
18727
|
);
|
|
19421
|
-
const run = new
|
|
18728
|
+
const run = new PublicationRun(new PublicationInstance(response.data, this.client, notebookId), this.client);
|
|
19422
18729
|
run.start();
|
|
19423
18730
|
return run;
|
|
19424
18731
|
}
|
|
19425
|
-
async slugAvailability(id, slug) {
|
|
19426
|
-
const query = new URLSearchParams({ slug }).toString();
|
|
19427
|
-
const response = await this.client.get(
|
|
19428
|
-
`/notebook/${id}/deployment/slug-availability?${query}`
|
|
19429
|
-
);
|
|
19430
|
-
return response.data;
|
|
19431
|
-
}
|
|
19432
18732
|
};
|
|
19433
|
-
var
|
|
18733
|
+
var PublicationApi = class {
|
|
19434
18734
|
constructor(client) {
|
|
19435
18735
|
this.client = client;
|
|
19436
18736
|
}
|
|
19437
18737
|
async get(id) {
|
|
19438
|
-
const response = await this.client.get(`/
|
|
19439
|
-
return new
|
|
18738
|
+
const response = await this.client.get(`/publications/${id}`);
|
|
18739
|
+
return new PublicationInstance(response.data, this.client);
|
|
19440
18740
|
}
|
|
19441
|
-
async
|
|
19442
|
-
await this.client.delete(`/
|
|
18741
|
+
async destroy(id) {
|
|
18742
|
+
await this.client.delete(`/publications/${id}`);
|
|
19443
18743
|
}
|
|
19444
18744
|
async setProtection(id, input) {
|
|
19445
|
-
const response = await this.client.put(`/
|
|
19446
|
-
return new
|
|
18745
|
+
const response = await this.client.put(`/publications/${id}/protection`, input);
|
|
18746
|
+
return new PublicationInstance(response.data, this.client);
|
|
19447
18747
|
}
|
|
19448
18748
|
async protection(id) {
|
|
19449
|
-
const response = await this.client.get(`/
|
|
18749
|
+
const response = await this.client.get(`/publications/${id}/protection`);
|
|
19450
18750
|
return response.data;
|
|
19451
18751
|
}
|
|
19452
18752
|
async createProtectionSession(id) {
|
|
19453
|
-
const response = await this.client.post(`/
|
|
18753
|
+
const response = await this.client.post(`/publications/${id}/protection/session`);
|
|
19454
18754
|
return response.data;
|
|
19455
18755
|
}
|
|
19456
18756
|
async disableProtection(id) {
|
|
19457
|
-
const response = await this.client.delete(`/
|
|
19458
|
-
return new
|
|
18757
|
+
const response = await this.client.delete(`/publications/${id}/protection`);
|
|
18758
|
+
return new PublicationInstance(response.data, this.client);
|
|
19459
18759
|
}
|
|
19460
18760
|
async setFeedback(id, input) {
|
|
19461
|
-
const response = await this.client.put(`/
|
|
19462
|
-
return new
|
|
18761
|
+
const response = await this.client.put(`/publications/${id}/feedback`, input);
|
|
18762
|
+
return new PublicationInstance(response.data, this.client);
|
|
19463
18763
|
}
|
|
19464
18764
|
async listDomains(id) {
|
|
19465
18765
|
const response = await this.client.get(
|
|
19466
|
-
`/
|
|
18766
|
+
`/publications/${id}/domains`
|
|
19467
18767
|
);
|
|
19468
|
-
return
|
|
18768
|
+
return unwrapPublicationDomainCollection(response.data);
|
|
19469
18769
|
}
|
|
19470
18770
|
async createDomain(id, input) {
|
|
19471
|
-
const response = await this.client.post(`/
|
|
18771
|
+
const response = await this.client.post(`/publications/${id}/domains`, input);
|
|
19472
18772
|
return response.data;
|
|
19473
18773
|
}
|
|
19474
18774
|
async refreshDomain(id, domainId) {
|
|
19475
|
-
const response = await this.client.post(`/
|
|
18775
|
+
const response = await this.client.post(`/publications/${id}/domains/${domainId}/refresh`);
|
|
19476
18776
|
return response.data;
|
|
19477
18777
|
}
|
|
19478
18778
|
async deleteDomain(id, domainId) {
|
|
19479
|
-
await this.client.delete(`/
|
|
18779
|
+
await this.client.delete(`/publications/${id}/domains/${domainId}`);
|
|
19480
18780
|
}
|
|
19481
18781
|
async events(id) {
|
|
19482
18782
|
return parseNdjsonStream(
|
|
19483
|
-
await this.client.stream(`/
|
|
19484
|
-
|
|
18783
|
+
await this.client.stream(`/publications/${id}/events/stream`),
|
|
18784
|
+
PublicationEventDataSchema
|
|
19485
18785
|
);
|
|
19486
18786
|
}
|
|
19487
18787
|
async buildLogs(id, buildId) {
|
|
19488
18788
|
return parseNdjsonStream(
|
|
19489
|
-
await this.client.stream(`/
|
|
19490
|
-
|
|
18789
|
+
await this.client.stream(`/publications/${id}/builds/${buildId}/logs/stream`),
|
|
18790
|
+
PublicationLogChunkDataSchema
|
|
19491
18791
|
);
|
|
19492
18792
|
}
|
|
19493
18793
|
async logs(id) {
|
|
19494
18794
|
return parseNdjsonStream(
|
|
19495
|
-
await this.client.stream(`/
|
|
19496
|
-
|
|
18795
|
+
await this.client.stream(`/publications/${id}/logs/stream`),
|
|
18796
|
+
PublicationLogChunkDataSchema
|
|
19497
18797
|
);
|
|
19498
18798
|
}
|
|
19499
18799
|
};
|
|
19500
|
-
var
|
|
18800
|
+
var PublicationRun = class {
|
|
19501
18801
|
constructor(initial, client) {
|
|
19502
18802
|
this.initial = initial;
|
|
19503
18803
|
this.client = client;
|
|
@@ -19527,7 +18827,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19527
18827
|
this.start();
|
|
19528
18828
|
return this.resultPromise;
|
|
19529
18829
|
}
|
|
19530
|
-
async
|
|
18830
|
+
async publication() {
|
|
19531
18831
|
await this.result();
|
|
19532
18832
|
return this.initial.refresh();
|
|
19533
18833
|
}
|
|
@@ -19537,7 +18837,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19537
18837
|
}
|
|
19538
18838
|
const eventStreamUrl = this.initial.data.eventStreamUrl;
|
|
19539
18839
|
if (!eventStreamUrl) {
|
|
19540
|
-
throw new Error(`
|
|
18840
|
+
throw new Error(`Publication ${this.initial.data.id} has no eventStreamUrl for SSE streaming`);
|
|
19541
18841
|
}
|
|
19542
18842
|
this.started = true;
|
|
19543
18843
|
this.resultPromise = new Promise((resolve, reject) => {
|
|
@@ -19549,7 +18849,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19549
18849
|
return this;
|
|
19550
18850
|
}
|
|
19551
18851
|
subscribe() {
|
|
19552
|
-
const queue = new
|
|
18852
|
+
const queue = new AsyncPublishEventQueue();
|
|
19553
18853
|
for (const event of this.bufferedEvents) {
|
|
19554
18854
|
queue.push(event);
|
|
19555
18855
|
}
|
|
@@ -19565,7 +18865,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19565
18865
|
async consumeStream(eventStreamUrl) {
|
|
19566
18866
|
try {
|
|
19567
18867
|
const stream = await this.client.sse(eventStreamUrl);
|
|
19568
|
-
for await (const event of
|
|
18868
|
+
for await (const event of readPublishStreamEvents(stream)) {
|
|
19569
18869
|
this.publish(event);
|
|
19570
18870
|
if (event.type === "result") {
|
|
19571
18871
|
const { type: _, ...result } = event;
|
|
@@ -19574,7 +18874,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19574
18874
|
}
|
|
19575
18875
|
}
|
|
19576
18876
|
if (!this.finalResult) {
|
|
19577
|
-
throw new Error("
|
|
18877
|
+
throw new Error("Publish stream ended without result");
|
|
19578
18878
|
}
|
|
19579
18879
|
this.closeSubscribers();
|
|
19580
18880
|
} catch (err) {
|
|
@@ -19604,33 +18904,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19604
18904
|
this.subscribers.clear();
|
|
19605
18905
|
}
|
|
19606
18906
|
};
|
|
19607
|
-
var
|
|
18907
|
+
var PublicationInstance = class _PublicationInstance {
|
|
19608
18908
|
constructor(data, client, notebookId) {
|
|
19609
18909
|
this.data = data;
|
|
19610
18910
|
this.client = client;
|
|
19611
18911
|
this.notebookId = notebookId;
|
|
19612
18912
|
}
|
|
19613
18913
|
async refresh() {
|
|
19614
|
-
const response = await this.client.get(`/
|
|
19615
|
-
return new
|
|
18914
|
+
const response = await this.client.get(`/publications/${this.data.id}`);
|
|
18915
|
+
return new _PublicationInstance(response.data, this.client, this.notebookId);
|
|
19616
18916
|
}
|
|
19617
18917
|
publish() {
|
|
19618
18918
|
if (!this.notebookId) {
|
|
19619
|
-
return Promise.reject(new Error("
|
|
18919
|
+
return Promise.reject(new Error("Publishing requires a notebook-scoped publication instance."));
|
|
19620
18920
|
}
|
|
19621
|
-
return this.client.notebook.
|
|
18921
|
+
return this.client.notebook.publication.publish(this.notebookId);
|
|
19622
18922
|
}
|
|
19623
|
-
|
|
19624
|
-
return this.client.
|
|
18923
|
+
destroy() {
|
|
18924
|
+
return this.client.publications.destroy(this.data.id);
|
|
19625
18925
|
}
|
|
19626
18926
|
async wait(options = {}) {
|
|
19627
18927
|
const intervalMs = options.intervalMs ?? 1e3;
|
|
19628
18928
|
const timeoutMs = options.timeoutMs ?? 3e5;
|
|
19629
18929
|
const startedAt = Date.now();
|
|
19630
18930
|
let current = this;
|
|
19631
|
-
while (!
|
|
18931
|
+
while (!publicationStatusIsTerminal(current.data.status)) {
|
|
19632
18932
|
if (Date.now() - startedAt > timeoutMs) {
|
|
19633
|
-
throw new Error(`Timed out waiting for
|
|
18933
|
+
throw new Error(`Timed out waiting for publication ${this.data.id}`);
|
|
19634
18934
|
}
|
|
19635
18935
|
await delay(intervalMs);
|
|
19636
18936
|
current = await current.refresh();
|
|
@@ -19638,58 +18938,58 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19638
18938
|
return current;
|
|
19639
18939
|
}
|
|
19640
18940
|
events() {
|
|
19641
|
-
return this.client.
|
|
18941
|
+
return this.client.publications.events(this.data.id);
|
|
19642
18942
|
}
|
|
19643
18943
|
buildLogs(buildId = this.data.latestBuild?.id ?? "") {
|
|
19644
18944
|
if (buildId === "") {
|
|
19645
|
-
return Promise.reject(new Error("
|
|
18945
|
+
return Promise.reject(new Error("Publication has no latest build id"));
|
|
19646
18946
|
}
|
|
19647
|
-
return this.client.
|
|
18947
|
+
return this.client.publications.buildLogs(this.data.id, buildId);
|
|
19648
18948
|
}
|
|
19649
18949
|
logs() {
|
|
19650
|
-
return this.client.
|
|
18950
|
+
return this.client.publications.logs(this.data.id);
|
|
19651
18951
|
}
|
|
19652
18952
|
setProtection(input) {
|
|
19653
|
-
return this.client.
|
|
18953
|
+
return this.client.publications.setProtection(this.data.id, input);
|
|
19654
18954
|
}
|
|
19655
18955
|
protection() {
|
|
19656
|
-
return this.client.
|
|
18956
|
+
return this.client.publications.protection(this.data.id);
|
|
19657
18957
|
}
|
|
19658
18958
|
createProtectionSession() {
|
|
19659
|
-
return this.client.
|
|
18959
|
+
return this.client.publications.createProtectionSession(this.data.id);
|
|
19660
18960
|
}
|
|
19661
18961
|
disableProtection() {
|
|
19662
|
-
return this.client.
|
|
18962
|
+
return this.client.publications.disableProtection(this.data.id);
|
|
19663
18963
|
}
|
|
19664
18964
|
setFeedback(input) {
|
|
19665
|
-
return this.client.
|
|
18965
|
+
return this.client.publications.setFeedback(this.data.id, input);
|
|
19666
18966
|
}
|
|
19667
18967
|
domains() {
|
|
19668
|
-
return this.client.
|
|
18968
|
+
return this.client.publications.listDomains(this.data.id);
|
|
19669
18969
|
}
|
|
19670
18970
|
addDomain(input) {
|
|
19671
|
-
return this.client.
|
|
18971
|
+
return this.client.publications.createDomain(this.data.id, input);
|
|
19672
18972
|
}
|
|
19673
18973
|
refreshDomain(domainId) {
|
|
19674
|
-
return this.client.
|
|
18974
|
+
return this.client.publications.refreshDomain(this.data.id, domainId);
|
|
19675
18975
|
}
|
|
19676
18976
|
deleteDomain(domainId) {
|
|
19677
|
-
return this.client.
|
|
18977
|
+
return this.client.publications.deleteDomain(this.data.id, domainId);
|
|
19678
18978
|
}
|
|
19679
18979
|
};
|
|
19680
|
-
function
|
|
18980
|
+
function publicationStatusIsTerminal(status) {
|
|
19681
18981
|
return ["healthy", "failed", "stopped", "deleted", "delete_failed"].includes(status);
|
|
19682
18982
|
}
|
|
19683
18983
|
function delay(ms) {
|
|
19684
18984
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
19685
18985
|
}
|
|
19686
|
-
function
|
|
18986
|
+
function unwrapPublicationDomainCollection(input) {
|
|
19687
18987
|
if (Array.isArray(input)) {
|
|
19688
18988
|
return input;
|
|
19689
18989
|
}
|
|
19690
18990
|
return Array.isArray(input.data) ? input.data : [];
|
|
19691
18991
|
}
|
|
19692
|
-
var
|
|
18992
|
+
var AsyncPublishEventQueue = class {
|
|
19693
18993
|
constructor() {
|
|
19694
18994
|
this.values = [];
|
|
19695
18995
|
this.pending = [];
|
|
@@ -19751,7 +19051,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19751
19051
|
});
|
|
19752
19052
|
}
|
|
19753
19053
|
};
|
|
19754
|
-
async function*
|
|
19054
|
+
async function* readPublishStreamEvents(stream) {
|
|
19755
19055
|
const reader = parseSSEStream(stream).getReader();
|
|
19756
19056
|
try {
|
|
19757
19057
|
while (true) {
|
|
@@ -19759,7 +19059,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19759
19059
|
if (done) {
|
|
19760
19060
|
return;
|
|
19761
19061
|
}
|
|
19762
|
-
const event =
|
|
19062
|
+
const event = parsePublishStreamEvent(value);
|
|
19763
19063
|
if (event) {
|
|
19764
19064
|
yield event;
|
|
19765
19065
|
}
|
|
@@ -19768,11 +19068,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19768
19068
|
reader.releaseLock();
|
|
19769
19069
|
}
|
|
19770
19070
|
}
|
|
19771
|
-
function
|
|
19772
|
-
if (!
|
|
19071
|
+
function parsePublishStreamEvent(event) {
|
|
19072
|
+
if (!PublishStreamSseEventNameSchema.safeParse(event.event).success) {
|
|
19773
19073
|
return null;
|
|
19774
19074
|
}
|
|
19775
|
-
return
|
|
19075
|
+
return PublishStreamSseEventSchema.parse(event);
|
|
19776
19076
|
}
|
|
19777
19077
|
function parseSSEStream(input) {
|
|
19778
19078
|
const decoder = new TextDecoder();
|
|
@@ -20181,7 +19481,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20181
19481
|
this.composerCredentials = new NotebookComposerCredentialApi(client);
|
|
20182
19482
|
this.preview = new NotebookPreviewApi(client);
|
|
20183
19483
|
this.mail = new NotebookMailApi(client);
|
|
20184
|
-
this.
|
|
19484
|
+
this.publication = new NotebookPublicationApi(client);
|
|
20185
19485
|
}
|
|
20186
19486
|
async create(template, input = {}, init = true) {
|
|
20187
19487
|
const response = await this.client.post("/notebook", { template, ...input });
|
|
@@ -20199,7 +19499,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20199
19499
|
const response = await this.client.put(`/notebook/${id}`, input);
|
|
20200
19500
|
return new NotebookInstance2(response.data, this.client);
|
|
20201
19501
|
}
|
|
20202
|
-
async
|
|
19502
|
+
async destroy(id) {
|
|
20203
19503
|
await this.client.delete(`/notebook/${id}`);
|
|
20204
19504
|
}
|
|
20205
19505
|
async fork(id, input = {}) {
|
|
@@ -20210,10 +19510,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20210
19510
|
const response = await this.client.post(`/notebook/${id}/git/credentials`);
|
|
20211
19511
|
return response.data;
|
|
20212
19512
|
}
|
|
20213
|
-
async open(id) {
|
|
20214
|
-
const response = await this.client.get(`/notebook/${id}`);
|
|
20215
|
-
return new NotebookInstance2(response.data, this.client);
|
|
20216
|
-
}
|
|
20217
19513
|
openFromData(data) {
|
|
20218
19514
|
return this.init(new NotebookInstance2(data, this.client));
|
|
20219
19515
|
}
|
|
@@ -20234,7 +19530,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20234
19530
|
constructor(token, url2 = "https://api.phpsandbox.io/v1", options = {}) {
|
|
20235
19531
|
this.runtimeTransportValue = "realtime";
|
|
20236
19532
|
this.fetch = globalThis.fetch;
|
|
20237
|
-
this.
|
|
19533
|
+
this.publications = new PublicationApi(this);
|
|
20238
19534
|
this.notebook = new NotebookApi(this);
|
|
20239
19535
|
this.servers = new ServerApi(this);
|
|
20240
19536
|
this.options = Object.assign({ startClosed: true }, options);
|
|
@@ -20468,7 +19764,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20468
19764
|
this.log = new Log(this);
|
|
20469
19765
|
this.repl = new Repl(this);
|
|
20470
19766
|
this.container = new Container(this);
|
|
20471
|
-
this.laravel = new Laravel(this);
|
|
20472
19767
|
this.shell = new Shell(this);
|
|
20473
19768
|
this.git = new Git(this, client);
|
|
20474
19769
|
this.services = new Services(this);
|
|
@@ -20500,17 +19795,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20500
19795
|
fork(input = {}) {
|
|
20501
19796
|
return this.client.notebook.fork(this.data.id, input);
|
|
20502
19797
|
}
|
|
20503
|
-
|
|
20504
|
-
return this.client.notebook.
|
|
19798
|
+
publication() {
|
|
19799
|
+
return this.client.notebook.publication.current(this.data.id);
|
|
20505
19800
|
}
|
|
20506
19801
|
publish(input) {
|
|
20507
|
-
return this.client.notebook.
|
|
19802
|
+
return this.client.notebook.publication.publish(this.data.id, input);
|
|
19803
|
+
}
|
|
19804
|
+
run(command, argsOrOpts = [], opts) {
|
|
19805
|
+
if (Array.isArray(argsOrOpts)) {
|
|
19806
|
+
return this.shell.run(command, argsOrOpts, opts);
|
|
19807
|
+
}
|
|
19808
|
+
return this.shell.run(command, argsOrOpts);
|
|
20508
19809
|
}
|
|
20509
19810
|
gitCredentials() {
|
|
20510
19811
|
return this.client.notebook.gitCredentials(this.data.id);
|
|
20511
19812
|
}
|
|
20512
|
-
|
|
20513
|
-
return this.client.notebook.
|
|
19813
|
+
destroy() {
|
|
19814
|
+
return this.client.notebook.destroy(this.data.id).then(() => {
|
|
20514
19815
|
this.socket?.terminate(new NotebookUnavailableError("Notebook has been deleted.", { id: this.data.id }));
|
|
20515
19816
|
});
|
|
20516
19817
|
}
|
|
@@ -20657,11 +19958,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20657
19958
|
__privateMethod(this, _NotebookInstance_instances, init_fn).call(this);
|
|
20658
19959
|
return this.ready().then(() => this);
|
|
20659
19960
|
}
|
|
20660
|
-
async beacon(iframe, options) {
|
|
20661
|
-
const result = await this.ready();
|
|
20662
|
-
iframe.src = result.data.previewUrl;
|
|
20663
|
-
return createBeacon(iframe, options);
|
|
20664
|
-
}
|
|
20665
19961
|
realtimeSocket() {
|
|
20666
19962
|
if (this.socket === null) {
|
|
20667
19963
|
throw new UnsupportedRuntimeTransportError("This operation requires the realtime transport.");
|