@enclave-run/sdk 0.0.0 → 0.1.0

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/index.mjs CHANGED
@@ -60,7 +60,7 @@ import createClient from "openapi-fetch";
60
60
  import platform2 from "platform";
61
61
 
62
62
  // package.json
63
- var version = "0.0.0";
63
+ var version = "0.1.0";
64
64
 
65
65
  // src/utils.ts
66
66
  import platform from "platform";
@@ -102,12 +102,6 @@ async function sha256(data) {
102
102
  function timeoutToSeconds(timeout) {
103
103
  return Math.ceil(timeout / 1e3);
104
104
  }
105
- async function dynamicImport(module) {
106
- if (runtime === "browser") {
107
- throw new Error("Browser runtime is not supported for dynamic import");
108
- }
109
- return await import(module);
110
- }
111
105
  function ansiRegex({ onlyFirst = false } = {}) {
112
106
  const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
113
107
  const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
@@ -172,6 +166,13 @@ var OutcomeUnknownError = class extends SandboxError {
172
166
  this.cause = cause;
173
167
  }
174
168
  };
169
+ var SandboxCreateFailedError = class extends SandboxError {
170
+ constructor(message, recovery) {
171
+ super(message);
172
+ this.name = "SandboxCreateFailedError";
173
+ this.recovery = recovery;
174
+ }
175
+ };
175
176
  var SandboxCreateRejectedError = class extends SandboxError {
176
177
  constructor(message, recovery, reason, spilloverAllowed = false, capacityTier = "shared") {
177
178
  super(message);
@@ -3529,8 +3530,9 @@ var SandboxApi = class {
3529
3530
  return operation.sandbox;
3530
3531
  }
3531
3532
  if (operation.state === "failed") {
3532
- throw new SandboxError(
3533
- (_b = (_a3 = operation.error) == null ? void 0 : _a3.message) != null ? _b : "Sandbox create failed after admission"
3533
+ throw new SandboxCreateFailedError(
3534
+ (_b = (_a3 = operation.error) == null ? void 0 : _a3.message) != null ? _b : "Sandbox create failed after admission",
3535
+ recovery
3534
3536
  );
3535
3537
  }
3536
3538
  await new Promise((resolve) => setTimeout(resolve, 25));
@@ -4561,6 +4563,18 @@ var STACK_TRACE_DEPTH = 3;
4561
4563
  var RESOLVE_SYMLINKS = false;
4562
4564
 
4563
4565
  // src/template/utils.ts
4566
+ async function loadGlob() {
4567
+ if (runtime === "browser") {
4568
+ throw new Error("Browser runtime is not supported for local file copies");
4569
+ }
4570
+ return await import("glob");
4571
+ }
4572
+ async function loadTar() {
4573
+ if (runtime === "browser") {
4574
+ throw new Error("Browser runtime is not supported for local file copies");
4575
+ }
4576
+ return await import("tar");
4577
+ }
4564
4578
  function validateRelativePath(src, stackTrace) {
4565
4579
  if (path.isAbsolute(src)) {
4566
4580
  const error = new TemplateError(
@@ -4591,7 +4605,7 @@ function normalizePath(path2) {
4591
4605
  return path2.replace(/\\/g, "/");
4592
4606
  }
4593
4607
  async function getAllFilesInPath(src, contextPath, ignorePatterns, includeDirectories = true) {
4594
- const { glob } = await dynamicImport("glob");
4608
+ const { glob } = await loadGlob();
4595
4609
  const files = /* @__PURE__ */ new Map();
4596
4610
  const globFiles = await glob(src, {
4597
4611
  ignore: ignorePatterns,
@@ -4708,7 +4722,7 @@ function padOctal(mode) {
4708
4722
  return mode.toString(8).padStart(4, "0");
4709
4723
  }
4710
4724
  async function getTarArchiveInputs(fileName, fileContextPath, ignorePatterns) {
4711
- const { create } = await dynamicImport("tar");
4725
+ const { create } = await loadTar();
4712
4726
  const allFiles = await getAllFilesInPath(
4713
4727
  fileName,
4714
4728
  fileContextPath,
@@ -6444,6 +6458,7 @@ export {
6444
6458
  ReadyCmd,
6445
6459
  RegionCapacityError,
6446
6460
  Sandbox,
6461
+ SandboxCreateFailedError,
6447
6462
  SandboxCreateRejectedError,
6448
6463
  SandboxError,
6449
6464
  SandboxRegionScope,