@phpsandbox/sdk 0.1.18 → 0.1.20
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/dist/browser/phpsandbox-sdk.esm.js +23 -3
- package/dist/browser/phpsandbox-sdk.esm.min.js +2 -2
- package/dist/browser/phpsandbox-sdk.iife.js +23 -3
- package/dist/browser/phpsandbox-sdk.iife.min.js +2 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +8 -1
- package/dist/publications.d.ts +3 -0
- package/dist/publications.js +15 -1
- package/package.json +1 -1
|
@@ -19076,6 +19076,7 @@ var PublicationRun = class {
|
|
|
19076
19076
|
constructor(initial, client) {
|
|
19077
19077
|
this.initial = initial;
|
|
19078
19078
|
this.client = client;
|
|
19079
|
+
this.streamAbort = new AbortController();
|
|
19079
19080
|
this.started = false;
|
|
19080
19081
|
this.completed = false;
|
|
19081
19082
|
this.finalError = null;
|
|
@@ -19123,6 +19124,18 @@ var PublicationRun = class {
|
|
|
19123
19124
|
void this.consumeStream(eventStreamUrl);
|
|
19124
19125
|
return this;
|
|
19125
19126
|
}
|
|
19127
|
+
/** Stop observing this run; the server-side publication continues. */
|
|
19128
|
+
dispose() {
|
|
19129
|
+
if (this.completed) return;
|
|
19130
|
+
const error51 = new DOMException("Stopped observing publication; deployment continues.", "AbortError");
|
|
19131
|
+
if (!this.started) {
|
|
19132
|
+
this.started = true;
|
|
19133
|
+
this.resultPromise = Promise.reject(error51);
|
|
19134
|
+
this.resultPromise.catch(() => void 0);
|
|
19135
|
+
}
|
|
19136
|
+
this.streamAbort.abort(error51);
|
|
19137
|
+
this.fail(error51);
|
|
19138
|
+
}
|
|
19126
19139
|
subscribe() {
|
|
19127
19140
|
const queue = new AsyncPublishEventQueue();
|
|
19128
19141
|
for (const event of this.bufferedEvents) {
|
|
@@ -19139,7 +19152,7 @@ var PublicationRun = class {
|
|
|
19139
19152
|
}
|
|
19140
19153
|
async consumeStream(eventStreamUrl) {
|
|
19141
19154
|
try {
|
|
19142
|
-
const stream = await this.client.sse(eventStreamUrl);
|
|
19155
|
+
const stream = await this.client.sse(eventStreamUrl, this.streamAbort.signal);
|
|
19143
19156
|
for await (const event of readPublishStreamEvents(stream)) {
|
|
19144
19157
|
this.publish(event);
|
|
19145
19158
|
if (event.type === "result") {
|
|
@@ -19959,14 +19972,15 @@ var ClientImplementation = class {
|
|
|
19959
19972
|
}
|
|
19960
19973
|
return response.body;
|
|
19961
19974
|
}
|
|
19962
|
-
async sse(url2) {
|
|
19975
|
+
async sse(url2, signal) {
|
|
19963
19976
|
const response = await this.fetchResponse(
|
|
19964
19977
|
authenticatedRequest(url2, {
|
|
19965
19978
|
method: "GET",
|
|
19966
19979
|
headers: {
|
|
19967
19980
|
...this.headers,
|
|
19968
19981
|
"Accept": "text/event-stream"
|
|
19969
|
-
}
|
|
19982
|
+
},
|
|
19983
|
+
...signal === void 0 ? {} : { signal }
|
|
19970
19984
|
})
|
|
19971
19985
|
);
|
|
19972
19986
|
if (!response.ok) {
|
|
@@ -20132,6 +20146,12 @@ var _NotebookInstance = class _NotebookInstance {
|
|
|
20132
20146
|
};
|
|
20133
20147
|
return ready();
|
|
20134
20148
|
}
|
|
20149
|
+
/** Update sandbox metadata and Git defaults without restarting it. */
|
|
20150
|
+
async update(input) {
|
|
20151
|
+
const response = await this.client.put(`/notebook/${this.data.id}`, input);
|
|
20152
|
+
Object.assign(this.data, response.data);
|
|
20153
|
+
return this.data;
|
|
20154
|
+
}
|
|
20135
20155
|
async fork(input = {}) {
|
|
20136
20156
|
const response = await this.client.post(`/notebook/${this.data.id}/fork`, input);
|
|
20137
20157
|
return new _NotebookInstance(response.data, this.client);
|