computesdk 2.2.0 → 2.3.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.d.mts CHANGED
@@ -3279,11 +3279,6 @@ declare class Sandbox {
3279
3279
  * Get file metadata (without content)
3280
3280
  */
3281
3281
  getFile(path: string): Promise<FileResponse>;
3282
- /**
3283
- * Encode a file path for use in URLs
3284
- * Strips leading slash and encodes each segment separately to preserve path structure
3285
- */
3286
- private encodeFilePath;
3287
3282
  /**
3288
3283
  * Read file content
3289
3284
  */
@@ -3841,7 +3836,7 @@ declare const PROVIDER_AUTH: {
3841
3836
  readonly cloudflare: readonly [readonly ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]];
3842
3837
  readonly codesandbox: readonly [readonly ["CSB_API_KEY"]];
3843
3838
  readonly blaxel: readonly [readonly ["BL_API_KEY", "BL_WORKSPACE"]];
3844
- readonly namespace: readonly [readonly ["NSC_TOKEN"]];
3839
+ readonly namespace: readonly [readonly ["NSC_TOKEN"], readonly ["NSC_TOKEN_FILE"]];
3845
3840
  readonly hopx: readonly [readonly ["HOPX_API_KEY"]];
3846
3841
  };
3847
3842
  /**
package/dist/index.d.ts CHANGED
@@ -3279,11 +3279,6 @@ declare class Sandbox {
3279
3279
  * Get file metadata (without content)
3280
3280
  */
3281
3281
  getFile(path: string): Promise<FileResponse>;
3282
- /**
3283
- * Encode a file path for use in URLs
3284
- * Strips leading slash and encodes each segment separately to preserve path structure
3285
- */
3286
- private encodeFilePath;
3287
3282
  /**
3288
3283
  * Read file content
3289
3284
  */
@@ -3841,7 +3836,7 @@ declare const PROVIDER_AUTH: {
3841
3836
  readonly cloudflare: readonly [readonly ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]];
3842
3837
  readonly codesandbox: readonly [readonly ["CSB_API_KEY"]];
3843
3838
  readonly blaxel: readonly [readonly ["BL_API_KEY", "BL_WORKSPACE"]];
3844
- readonly namespace: readonly [readonly ["NSC_TOKEN"]];
3839
+ readonly namespace: readonly [readonly ["NSC_TOKEN"], readonly ["NSC_TOKEN_FILE"]];
3845
3840
  readonly hopx: readonly [readonly ["HOPX_API_KEY"]];
3846
3841
  };
3847
3842
  /**
package/dist/index.js CHANGED
@@ -2122,6 +2122,12 @@ function isCommandExitError(error) {
2122
2122
 
2123
2123
  // src/client/index.ts
2124
2124
  var MAX_TUNNEL_TIMEOUT_SECONDS = 300;
2125
+ function encodeFilePath(path) {
2126
+ const isAbsolute = path.startsWith("/");
2127
+ const segments = path.split("/").filter((s) => s !== "");
2128
+ const encoded = segments.map((s) => encodeURIComponent(s)).join("/");
2129
+ return isAbsolute ? "/" + encoded : encoded;
2130
+ }
2125
2131
  var Sandbox = class {
2126
2132
  constructor(config) {
2127
2133
  this._token = null;
@@ -2660,16 +2666,7 @@ API request failed (${response.status}): ${error}`
2660
2666
  * Get file metadata (without content)
2661
2667
  */
2662
2668
  async getFile(path) {
2663
- return this.request(`/files/${this.encodeFilePath(path)}`);
2664
- }
2665
- /**
2666
- * Encode a file path for use in URLs
2667
- * Strips leading slash and encodes each segment separately to preserve path structure
2668
- */
2669
- encodeFilePath(path) {
2670
- const pathWithoutLeadingSlash = path.startsWith("/") ? path.slice(1) : path;
2671
- const segments = pathWithoutLeadingSlash.split("/");
2672
- return segments.map((s) => encodeURIComponent(s)).join("/");
2669
+ return this.request(`/files/${encodeFilePath(path)}`);
2673
2670
  }
2674
2671
  /**
2675
2672
  * Read file content
@@ -2677,7 +2674,7 @@ API request failed (${response.status}): ${error}`
2677
2674
  async readFile(path) {
2678
2675
  const params = new URLSearchParams({ content: "true" });
2679
2676
  const response = await this.request(
2680
- `/files/${this.encodeFilePath(path)}?${params}`
2677
+ `/files/${encodeFilePath(path)}?${params}`
2681
2678
  );
2682
2679
  return response.data.content || "";
2683
2680
  }
@@ -2694,7 +2691,7 @@ API request failed (${response.status}): ${error}`
2694
2691
  * Delete a file or directory
2695
2692
  */
2696
2693
  async deleteFile(path) {
2697
- return this.request(`/files/${this.encodeFilePath(path)}`, {
2694
+ return this.request(`/files/${encodeFilePath(path)}`, {
2698
2695
  method: "DELETE"
2699
2696
  });
2700
2697
  }
@@ -2713,7 +2710,7 @@ API request failed (${response.status}): ${error}`
2713
2710
  headers["Authorization"] = `Bearer ${this._token}`;
2714
2711
  }
2715
2712
  const response = await fetch(
2716
- `${this.config.sandboxUrl}/files/${this.encodeFilePath(path)}`,
2713
+ `${this.config.sandboxUrl}/files/${encodeFilePath(path)}`,
2717
2714
  {
2718
2715
  method: "HEAD",
2719
2716
  headers,
@@ -3647,7 +3644,7 @@ var PROVIDER_AUTH = {
3647
3644
  cloudflare: [["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]],
3648
3645
  codesandbox: [["CSB_API_KEY"]],
3649
3646
  blaxel: [["BL_API_KEY", "BL_WORKSPACE"]],
3650
- namespace: [["NSC_TOKEN"]],
3647
+ namespace: [["NSC_TOKEN"], ["NSC_TOKEN_FILE"]],
3651
3648
  hopx: [["HOPX_API_KEY"]]
3652
3649
  };
3653
3650
  var PROVIDER_NAMES = Object.keys(PROVIDER_AUTH);
@@ -3739,7 +3736,8 @@ var PROVIDER_ENV_MAP = {
3739
3736
  BL_WORKSPACE: "workspace"
3740
3737
  },
3741
3738
  namespace: {
3742
- NSC_TOKEN: "token"
3739
+ NSC_TOKEN: "token",
3740
+ NSC_TOKEN_FILE: "tokenFile"
3743
3741
  },
3744
3742
  hopx: {
3745
3743
  HOPX_API_KEY: "apiKey"