@layr-labs/ecloud-sdk 0.0.1-dev.1 → 0.0.1-dev.2

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/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- version=0.0.1-dev.1
2
- commit=be757436b79faff7959b8375dbb051cc47cb0895
1
+ version=0.0.1-dev.2
2
+ commit=8ca3b7787d03d9489c9526633de1d19f1ea48513
package/dist/index.cjs CHANGED
@@ -910,13 +910,15 @@ async function setupLayeredBuildDirectory(environmentConfig, layeredDockerfileCo
910
910
  // src/client/common/registry/digest.ts
911
911
  var child_process3 = __toESM(require("child_process"), 1);
912
912
  var import_util3 = require("util");
913
- var exec5 = (0, import_util3.promisify)(child_process3.exec);
913
+ var execFileAsync = (0, import_util3.promisify)(child_process3.execFile);
914
914
  async function getImageDigestAndName(imageRef) {
915
915
  try {
916
- const { stdout } = await exec5(`docker manifest inspect ${imageRef}`, {
917
- maxBuffer: 10 * 1024 * 1024
916
+ const { stdout } = await execFileAsync(
917
+ "docker",
918
+ ["manifest", "inspect", imageRef],
919
+ { maxBuffer: 10 * 1024 * 1024 }
918
920
  // 10MB buffer
919
- });
921
+ );
920
922
  const manifest = JSON.parse(stdout);
921
923
  if (manifest.manifests && manifest.manifests.length > 0) {
922
924
  return extractDigestFromMultiPlatform(manifest, imageRef);
@@ -951,7 +953,7 @@ function extractDigestFromMultiPlatform(manifest, imageRef) {
951
953
  }
952
954
  async function extractDigestFromSinglePlatform(manifest, imageRef) {
953
955
  try {
954
- const { stdout } = await exec5(`docker inspect ${imageRef}`, {
956
+ const { stdout } = await execFile("docker", ["inspect", imageRef], {
955
957
  maxBuffer: 10 * 1024 * 1024
956
958
  });
957
959
  const inspectData = JSON.parse(stdout);
@@ -2509,14 +2511,19 @@ var MAX_ADDRESS_COUNT = 5;
2509
2511
  var CanViewAppLogsPermission = "0x2fd3f2fe";
2510
2512
  var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
2511
2513
  var CanUpdateAppProfilePermission = "0x036fef61";
2514
+ function getDefaultClientId() {
2515
+ const version = true ? "0.0.1-dev.2" : "0.0.0";
2516
+ return `ecloud-sdk/v${version}`;
2517
+ }
2512
2518
  var UserApiClient = class {
2513
- constructor(config, privateKey, rpcUrl) {
2519
+ constructor(config, privateKey, rpcUrl, clientId) {
2514
2520
  this.config = config;
2515
2521
  if (privateKey) {
2516
2522
  const privateKeyHex = addHexPrefix(privateKey);
2517
2523
  this.account = (0, import_accounts.privateKeyToAccount)(privateKeyHex);
2518
2524
  }
2519
2525
  this.rpcUrl = rpcUrl;
2526
+ this.clientId = clientId || getDefaultClientId();
2520
2527
  }
2521
2528
  async getInfos(appIDs, addressCount = 1) {
2522
2529
  const count = Math.min(addressCount, MAX_ADDRESS_COUNT);
@@ -2596,7 +2603,7 @@ var UserApiClient = class {
2596
2603
  formData.append("image", fileBuffer, fileName);
2597
2604
  }
2598
2605
  const headers = {
2599
- "x-client-id": "ecloud-cli/v0.0.1",
2606
+ "x-client-id": this.clientId,
2600
2607
  ...formData.getHeaders()
2601
2608
  };
2602
2609
  if (this.account) {
@@ -2645,7 +2652,7 @@ Please check:
2645
2652
  }
2646
2653
  async makeAuthenticatedRequest(url, permission) {
2647
2654
  const headers = {
2648
- "x-client-id": "ecloud-cli/v0.0.1"
2655
+ "x-client-id": this.clientId
2649
2656
  };
2650
2657
  if (permission && this.account) {
2651
2658
  const expiry = BigInt(Math.floor(Date.now() / 1e3) + 5 * 60);
@@ -5849,7 +5856,7 @@ var os2 = __toESM(require("os"), 1);
5849
5856
  var import_child_process2 = require("child_process");
5850
5857
  var import_util4 = require("util");
5851
5858
  var execAsync2 = (0, import_util4.promisify)(import_child_process2.exec);
5852
- var execFileAsync = (0, import_util4.promisify)(import_child_process2.execFile);
5859
+ var execFileAsync2 = (0, import_util4.promisify)(import_child_process2.execFile);
5853
5860
  async function fetchTemplate(repoURL, ref, targetDir, config, logger) {
5854
5861
  if (!repoURL) {
5855
5862
  throw new Error("repoURL is required");
@@ -5861,10 +5868,14 @@ Cloning repo: ${repoURL} \u2192 ${targetDir}
5861
5868
  await execAsync2(`git clone --no-checkout --progress ${repoURL} ${targetDir}`, {
5862
5869
  maxBuffer: 10 * 1024 * 1024
5863
5870
  });
5864
- await execFileAsync("git", ["-C", targetDir, "checkout", "--quiet", ref], {
5871
+ await execFileAsync2("git", ["-C", targetDir, "checkout", "--quiet", ref], {
5865
5872
  maxBuffer: 10 * 1024 * 1024
5866
5873
  });
5867
- await execAsync2(`git -C ${targetDir} submodule update --init --recursive --progress`);
5874
+ await execFileAsync2(
5875
+ "git",
5876
+ ["-C", targetDir, "submodule", "update", "--init", "--recursive", "--progress"],
5877
+ { maxBuffer: 10 * 1024 * 1024 }
5878
+ );
5868
5879
  logger.info(`Clone repo complete: ${repoURL}
5869
5880
  `);
5870
5881
  } catch (error) {
@@ -5905,14 +5916,14 @@ Cloning template: ${repoURL} \u2192 extracting ${subPath}
5905
5916
  }
5906
5917
  async function cloneSparse(repoURL, ref, subPath, tempDir) {
5907
5918
  try {
5908
- await execFileAsync("git", ["init", tempDir]);
5909
- await execFileAsync("git", ["-C", tempDir, "remote", "add", "origin", repoURL]);
5910
- await execFileAsync("git", ["-C", tempDir, "config", "core.sparseCheckout", "true"]);
5919
+ await execFileAsync2("git", ["init", tempDir]);
5920
+ await execFileAsync2("git", ["-C", tempDir, "remote", "add", "origin", repoURL]);
5921
+ await execFileAsync2("git", ["-C", tempDir, "config", "core.sparseCheckout", "true"]);
5911
5922
  const sparseCheckoutPath = path5.join(tempDir, ".git/info/sparse-checkout");
5912
5923
  fs5.writeFileSync(sparseCheckoutPath, `${subPath}
5913
5924
  `);
5914
- await execFileAsync("git", ["-C", tempDir, "fetch", "origin", ref]);
5915
- await execFileAsync("git", ["-C", tempDir, "checkout", ref]);
5925
+ await execFileAsync2("git", ["-C", tempDir, "fetch", "origin", ref]);
5926
+ await execFileAsync2("git", ["-C", tempDir, "checkout", ref]);
5916
5927
  } catch (error) {
5917
5928
  throw new Error(`Failed to clone sparse repository: ${error.message}`);
5918
5929
  }