@phpsandbox/sdk 0.1.17 → 0.1.19

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.
@@ -19042,6 +19042,27 @@ var PublishStreamSseEventSchema = external_exports.discriminatedUnion("event", [
19042
19042
  });
19043
19043
 
19044
19044
  // src/publications.ts
19045
+ var PublicationDomains = class {
19046
+ constructor(client, publicationId) {
19047
+ this.client = client;
19048
+ this.publicationId = publicationId;
19049
+ }
19050
+ async list() {
19051
+ return (await this.client.get(this.path())).data;
19052
+ }
19053
+ async create(hostname3) {
19054
+ return (await this.client.post(this.path(), { hostname: hostname3 })).data;
19055
+ }
19056
+ async refresh(id) {
19057
+ return (await this.client.post(`${this.path()}/${encodeURIComponent(id)}/refresh`)).data;
19058
+ }
19059
+ async delete(id) {
19060
+ await this.client.delete(`${this.path()}/${encodeURIComponent(id)}`);
19061
+ }
19062
+ path() {
19063
+ return `/publications/${encodeURIComponent(this.publicationId)}/domains`;
19064
+ }
19065
+ };
19045
19066
  var PublicationApi = class {
19046
19067
  constructor(client) {
19047
19068
  this.client = client;
@@ -19055,6 +19076,7 @@ var PublicationRun = class {
19055
19076
  constructor(initial, client) {
19056
19077
  this.initial = initial;
19057
19078
  this.client = client;
19079
+ this.streamAbort = new AbortController();
19058
19080
  this.started = false;
19059
19081
  this.completed = false;
19060
19082
  this.finalError = null;
@@ -19102,6 +19124,18 @@ var PublicationRun = class {
19102
19124
  void this.consumeStream(eventStreamUrl);
19103
19125
  return this;
19104
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
+ }
19105
19139
  subscribe() {
19106
19140
  const queue = new AsyncPublishEventQueue();
19107
19141
  for (const event of this.bufferedEvents) {
@@ -19118,7 +19152,7 @@ var PublicationRun = class {
19118
19152
  }
19119
19153
  async consumeStream(eventStreamUrl) {
19120
19154
  try {
19121
- const stream = await this.client.sse(eventStreamUrl);
19155
+ const stream = await this.client.sse(eventStreamUrl, this.streamAbort.signal);
19122
19156
  for await (const event of readPublishStreamEvents(stream)) {
19123
19157
  this.publish(event);
19124
19158
  if (event.type === "result") {
@@ -19163,6 +19197,7 @@ var PublicationInstance = class _PublicationInstance {
19163
19197
  this.data = data;
19164
19198
  this.client = client;
19165
19199
  this.notebookId = notebookId;
19200
+ this.domains = new PublicationDomains(client, data.id);
19166
19201
  }
19167
19202
  async refresh() {
19168
19203
  const response = await this.client.get(`/publications/${this.data.id}`);
@@ -19937,14 +19972,15 @@ var ClientImplementation = class {
19937
19972
  }
19938
19973
  return response.body;
19939
19974
  }
19940
- async sse(url2) {
19975
+ async sse(url2, signal) {
19941
19976
  const response = await this.fetchResponse(
19942
19977
  authenticatedRequest(url2, {
19943
19978
  method: "GET",
19944
19979
  headers: {
19945
19980
  ...this.headers,
19946
19981
  "Accept": "text/event-stream"
19947
- }
19982
+ },
19983
+ ...signal === void 0 ? {} : { signal }
19948
19984
  })
19949
19985
  );
19950
19986
  if (!response.ok) {