ppio-sandbox 1.1.3-b1 → 1.1.3

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.
@@ -48,7 +48,7 @@ import createClient from "openapi-fetch";
48
48
  import platform from "platform";
49
49
 
50
50
  // package.json
51
- var version = "1.1.3-b1";
51
+ var version = "1.1.3";
52
52
 
53
53
  // src/core/api/metadata.ts
54
54
  function getRuntime() {
@@ -628,6 +628,9 @@ var Filesystem2 = class {
628
628
  return new Uint8Array(res.data);
629
629
  }
630
630
  if (res.response.headers.get("content-length") === "0") {
631
+ if (format === "blob") {
632
+ return new Blob([]);
633
+ }
631
634
  return "";
632
635
  }
633
636
  return res.data;
@@ -1710,6 +1713,20 @@ var Commands = class {
1710
1713
 
1711
1714
  // src/core/sandbox/sandboxApi.ts
1712
1715
  import { compareVersions as compareVersions2 } from "compare-versions";
1716
+ async function createRawApiError(response) {
1717
+ var _a2;
1718
+ let message = response.statusText;
1719
+ try {
1720
+ const body = await response.json();
1721
+ message = (_a2 = body.message) != null ? _a2 : JSON.stringify(body);
1722
+ } catch (e) {
1723
+ try {
1724
+ message = await response.text();
1725
+ } catch (e2) {
1726
+ }
1727
+ }
1728
+ return new Error(`${response.status}: ${message}`);
1729
+ }
1713
1730
  var SandboxApi = class {
1714
1731
  constructor() {
1715
1732
  }
@@ -2130,6 +2147,39 @@ var SandboxApi = class {
2130
2147
  updatedAt: new Date(res.data.updatedAt)
2131
2148
  };
2132
2149
  }
2150
+ static async getEvents(opts) {
2151
+ var _a2, _b, _c;
2152
+ const config = new ConnectionConfig(opts);
2153
+ const url = new URL(`${config.apiUrl}/sandboxes/events`);
2154
+ if ((opts == null ? void 0 : opts.startTime) !== void 0)
2155
+ url.searchParams.set("startTime", String(opts.startTime));
2156
+ if ((opts == null ? void 0 : opts.endTime) !== void 0)
2157
+ url.searchParams.set("endTime", String(opts.endTime));
2158
+ if (opts == null ? void 0 : opts.sandboxID) url.searchParams.set("sandboxID", opts.sandboxID);
2159
+ if (opts == null ? void 0 : opts.templateID) url.searchParams.set("templateID", opts.templateID);
2160
+ if (opts == null ? void 0 : opts.events) url.searchParams.set("events", opts.events);
2161
+ if (opts == null ? void 0 : opts.state) url.searchParams.set("state", opts.state);
2162
+ if ((opts == null ? void 0 : opts.orderAsc) !== void 0)
2163
+ url.searchParams.set("orderAsc", String(opts.orderAsc));
2164
+ if ((opts == null ? void 0 : opts.offset) !== void 0)
2165
+ url.searchParams.set("offset", String(opts.offset));
2166
+ if ((opts == null ? void 0 : opts.limit) !== void 0)
2167
+ url.searchParams.set("limit", String(opts.limit));
2168
+ const response = await fetch(url, {
2169
+ method: "GET",
2170
+ headers: __spreadValues(__spreadValues(__spreadValues({}, config.headers), config.apiKey ? { "X-API-KEY": config.apiKey } : {}), config.accessToken ? { Authorization: `Bearer ${config.accessToken}` } : {}),
2171
+ signal: config.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
2172
+ });
2173
+ if (!response.ok) {
2174
+ throw await createRawApiError(response);
2175
+ }
2176
+ const data = await response.json();
2177
+ return {
2178
+ items: (_a2 = data.items) != null ? _a2 : [],
2179
+ total: (_b = data.total) != null ? _b : 0,
2180
+ hasMore: (_c = data.hasMore) != null ? _c : false
2181
+ };
2182
+ }
2133
2183
  };
2134
2184
  var SandboxPaginator = class {
2135
2185
  constructor(opts) {
@@ -2671,4 +2721,4 @@ export {
2671
2721
  Sandbox,
2672
2722
  core_default
2673
2723
  };
2674
- //# sourceMappingURL=chunk-IGBGP3BT.mjs.map
2724
+ //# sourceMappingURL=chunk-EISDT44U.mjs.map