ppio-sandbox 2.1.0-a4 → 2.1.0-a6

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.
@@ -5,7 +5,7 @@ import {
5
5
  TimeoutError,
6
6
  __spreadProps,
7
7
  __spreadValues
8
- } from "./chunk-FLLX4NEM.mjs";
8
+ } from "./chunk-DOWJBACY.mjs";
9
9
 
10
10
  // src/desktop/utils.ts
11
11
  import { randomBytes } from "crypto";
@@ -530,4 +530,4 @@ var VNCServer = class {
530
530
  export {
531
531
  Sandbox2 as Sandbox
532
532
  };
533
- //# sourceMappingURL=chunk-DIBNB4FZ.mjs.map
533
+ //# sourceMappingURL=chunk-AMF7LP7N.mjs.map
@@ -60,7 +60,7 @@ import createClient from "openapi-fetch";
60
60
  import platform2 from "platform";
61
61
 
62
62
  // package.json
63
- var version = "2.1.0-a4";
63
+ var version = "2.1.0-a6";
64
64
 
65
65
  // src/core/utils.ts
66
66
  import platform from "platform";
@@ -420,6 +420,10 @@ function validateDomain(domain) {
420
420
  throw new Error("Domain cannot be empty");
421
421
  }
422
422
  }
423
+ function normalizeApiUrl(apiUrl) {
424
+ if (!apiUrl) return apiUrl;
425
+ return /^[a-z][a-z\d+.-]*:\/\//i.test(apiUrl) ? apiUrl : `https://${apiUrl}`;
426
+ }
423
427
  function getDefaultApiUrl(domain, debug) {
424
428
  var _a3;
425
429
  if (debug) {
@@ -439,7 +443,7 @@ var _ConnectionConfig = class _ConnectionConfig {
439
443
  this.logger = opts == null ? void 0 : opts.logger;
440
444
  this.headers = (opts == null ? void 0 : opts.headers) || {};
441
445
  this.headers["User-Agent"] = `ppio-sandbox-sdk-js/${version}`;
442
- this.apiUrl = (opts == null ? void 0 : opts.apiUrl) || _ConnectionConfig.apiUrl || getDefaultApiUrl(this.domain, this.debug);
446
+ this.apiUrl = normalizeApiUrl(opts == null ? void 0 : opts.apiUrl) || normalizeApiUrl(_ConnectionConfig.apiUrl) || getDefaultApiUrl(this.domain, this.debug);
443
447
  this.sandboxUrl = (opts == null ? void 0 : opts.sandboxUrl) || _ConnectionConfig.sandboxUrl;
444
448
  }
445
449
  static get domain() {
@@ -3777,6 +3781,7 @@ var SandboxApi = class {
3777
3781
  static async getQuota(opts) {
3778
3782
  var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
3779
3783
  const config = new ConnectionConfig(opts);
3784
+ raiseIfLegacy(config, "Sandbox.getQuota", SandboxError);
3780
3785
  const url = new URL(`${config.apiUrl}/sandboxes/quota`);
3781
3786
  const response = await fetch(url, {
3782
3787
  method: "GET",
@@ -5926,6 +5931,7 @@ function clearImageConfigCache() {
5926
5931
  var TemplateApi = class {
5927
5932
  static async getTemplate(templateId, options) {
5928
5933
  const config = new ConnectionConfig(options);
5934
+ raiseIfLegacy(config, "Template.get", BuildError);
5929
5935
  const client = new ApiClient(config);
5930
5936
  const response = await client.api.GET("/templates/{templateID}", {
5931
5937
  params: { path: { templateID: templateId } },
@@ -7687,12 +7693,12 @@ var PPIO = class {
7687
7693
  this.secret = new SecretNamespace(opts);
7688
7694
  this.codeInterpreter = new RuntimeSandboxNamespace(
7689
7695
  opts,
7690
- () => import("./sandbox-4BXYHVGT.mjs")
7696
+ () => import("./sandbox-7RXZEFUF.mjs")
7691
7697
  );
7692
7698
  this.code_interpreter = this.codeInterpreter;
7693
7699
  this.desktop = new RuntimeSandboxNamespace(
7694
7700
  opts,
7695
- () => import("./sandbox-XUU36K7U.mjs")
7701
+ () => import("./sandbox-WP4ABL6S.mjs")
7696
7702
  );
7697
7703
  }
7698
7704
  async create(templateOrOpts, opts) {
@@ -7770,4 +7776,4 @@ export {
7770
7776
  ALL_TRAFFIC,
7771
7777
  core_default
7772
7778
  };
7773
- //# sourceMappingURL=chunk-FLLX4NEM.mjs.map
7779
+ //# sourceMappingURL=chunk-DOWJBACY.mjs.map