@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.
@@ -19105,6 +19105,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19105
19105
  constructor(initial, client) {
19106
19106
  this.initial = initial;
19107
19107
  this.client = client;
19108
+ this.streamAbort = new AbortController();
19108
19109
  this.started = false;
19109
19110
  this.completed = false;
19110
19111
  this.finalError = null;
@@ -19152,6 +19153,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19152
19153
  void this.consumeStream(eventStreamUrl);
19153
19154
  return this;
19154
19155
  }
19156
+ /** Stop observing this run; the server-side publication continues. */
19157
+ dispose() {
19158
+ if (this.completed) return;
19159
+ const error51 = new DOMException("Stopped observing publication; deployment continues.", "AbortError");
19160
+ if (!this.started) {
19161
+ this.started = true;
19162
+ this.resultPromise = Promise.reject(error51);
19163
+ this.resultPromise.catch(() => void 0);
19164
+ }
19165
+ this.streamAbort.abort(error51);
19166
+ this.fail(error51);
19167
+ }
19155
19168
  subscribe() {
19156
19169
  const queue = new AsyncPublishEventQueue();
19157
19170
  for (const event of this.bufferedEvents) {
@@ -19168,7 +19181,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19168
19181
  }
19169
19182
  async consumeStream(eventStreamUrl) {
19170
19183
  try {
19171
- const stream = await this.client.sse(eventStreamUrl);
19184
+ const stream = await this.client.sse(eventStreamUrl, this.streamAbort.signal);
19172
19185
  for await (const event of readPublishStreamEvents(stream)) {
19173
19186
  this.publish(event);
19174
19187
  if (event.type === "result") {
@@ -19988,14 +20001,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19988
20001
  }
19989
20002
  return response.body;
19990
20003
  }
19991
- async sse(url2) {
20004
+ async sse(url2, signal) {
19992
20005
  const response = await this.fetchResponse(
19993
20006
  authenticatedRequest(url2, {
19994
20007
  method: "GET",
19995
20008
  headers: {
19996
20009
  ...this.headers,
19997
20010
  "Accept": "text/event-stream"
19998
- }
20011
+ },
20012
+ ...signal === void 0 ? {} : { signal }
19999
20013
  })
20000
20014
  );
20001
20015
  if (!response.ok) {
@@ -20161,6 +20175,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
20161
20175
  };
20162
20176
  return ready();
20163
20177
  }
20178
+ /** Update sandbox metadata and Git defaults without restarting it. */
20179
+ async update(input) {
20180
+ const response = await this.client.put(`/notebook/${this.data.id}`, input);
20181
+ Object.assign(this.data, response.data);
20182
+ return this.data;
20183
+ }
20164
20184
  async fork(input = {}) {
20165
20185
  const response = await this.client.post(`/notebook/${this.data.id}/fork`, input);
20166
20186
  return new _NotebookInstance(response.data, this.client);