oleander-cli 0.25.2 → 0.25.4

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.
Files changed (2) hide show
  1. package/dist/index.cjs +38 -22
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -35457,6 +35457,7 @@ function registerSparkClustersCommand(cluster) {
35457
35457
  // src/commands/spark/init.ts
35458
35458
  var import_node_fs = require("fs");
35459
35459
  var import_node_child_process = require("child_process");
35460
+ var import_node_crypto2 = require("crypto");
35460
35461
  var import_node_path2 = require("path");
35461
35462
  var import_node_os3 = require("os");
35462
35463
 
@@ -37783,8 +37784,13 @@ var inquirer = {
37783
37784
  var lib_default = inquirer;
37784
37785
 
37785
37786
  // src/commands/spark/init.ts
37786
- var TEMPLATE_ARCHIVE_URL = "https://api.github.com/repos/OleanderHQ/pyspark-template/tarball";
37787
37787
  var TEMPLATE_REPOSITORY_URL = "https://github.com/OleanderHQ/pyspark-template";
37788
+ var TEMPLATE_COMMIT = "f33827b795dd8bdc3dd955be16743c277e1111f8";
37789
+ var TEMPLATE_ARCHIVE_SHA256 = "a38ab874203915f455513ffc434e745772aa4a90b15b6178ea9cdfd061415f68";
37790
+ var TEMPLATE_ARCHIVE_URLS = [
37791
+ `${TEMPLATE_REPOSITORY_URL}/archive/${TEMPLATE_COMMIT}.tar.gz`,
37792
+ `https://codeload.github.com/OleanderHQ/pyspark-template/tar.gz/${TEMPLATE_COMMIT}`
37793
+ ];
37788
37794
  var TEMPLATE_ENTRYPOINT_NAME = "entrypoint.py";
37789
37795
  var TEMPLATE_CUSTOM_PACKAGE_NAME = "mylib";
37790
37796
  var TEMPLATE_SPARK_JOB_CONFIG_NAME = "spark-job.mk";
@@ -37914,16 +37920,31 @@ function assertValidCustomPackageName(value) {
37914
37920
  }
37915
37921
  }
37916
37922
  async function downloadTemplateArchive(archivePath) {
37923
+ const failures = [];
37924
+ for (const url of TEMPLATE_ARCHIVE_URLS) {
37925
+ try {
37926
+ await downloadFile(url, archivePath);
37927
+ const actualSha256 = (0, import_node_crypto2.createHash)("sha256").update(await import_node_fs.promises.readFile(archivePath)).digest("hex");
37928
+ if (actualSha256 !== TEMPLATE_ARCHIVE_SHA256) {
37929
+ throw new Error(
37930
+ `checksum mismatch (expected sha256 ${TEMPLATE_ARCHIVE_SHA256}, got ${actualSha256})`
37931
+ );
37932
+ }
37933
+ return;
37934
+ } catch (error) {
37935
+ const reason = error instanceof Error ? error.message : String(error);
37936
+ failures.push(`${url}: ${reason.trim()}`);
37937
+ }
37938
+ }
37939
+ throw new Error(
37940
+ `Failed to download template archive:
37941
+ ${failures.join("\n")}`
37942
+ );
37943
+ }
37944
+ async function downloadFile(url, outputPath) {
37917
37945
  const curl = (0, import_node_child_process.spawnSync)(
37918
37946
  "curl",
37919
- [
37920
- "-fsSL",
37921
- "-H",
37922
- "User-Agent: oleander-cli",
37923
- TEMPLATE_ARCHIVE_URL,
37924
- "-o",
37925
- archivePath
37926
- ],
37947
+ ["-fsSL", "-H", "User-Agent: oleander-cli", url, "-o", outputPath],
37927
37948
  {
37928
37949
  encoding: "utf-8"
37929
37950
  }
@@ -37933,25 +37954,20 @@ async function downloadTemplateArchive(archivePath) {
37933
37954
  return;
37934
37955
  }
37935
37956
  if (curlError?.code && curlError.code !== "ENOENT") {
37936
- throw new Error(
37937
- `Failed to download template archive: ${curlError.message}`
37938
- );
37957
+ throw new Error(curlError.message);
37939
37958
  }
37940
37959
  if (!curlError && curl.status !== 0) {
37941
37960
  throw new Error(
37942
- `Failed to download template archive: ${curl.stderr || curl.stdout || `curl exited with status ${curl.status}`}`
37961
+ curl.stderr || curl.stdout || `curl exited with status ${curl.status}`
37943
37962
  );
37944
37963
  }
37945
- const response = await fetch(TEMPLATE_ARCHIVE_URL, {
37964
+ const response = await fetch(url, {
37946
37965
  headers: { "User-Agent": "oleander-cli" }
37947
37966
  });
37948
37967
  if (!response.ok) {
37949
- throw new Error(
37950
- `Failed to download template archive: ${response.status} ${response.statusText}`
37951
- );
37968
+ throw new Error(`${response.status} ${response.statusText}`);
37952
37969
  }
37953
- const archiveBuffer = Buffer.from(await response.arrayBuffer());
37954
- await import_node_fs.promises.writeFile(archivePath, archiveBuffer);
37970
+ await import_node_fs.promises.writeFile(outputPath, Buffer.from(await response.arrayBuffer()));
37955
37971
  }
37956
37972
  function extractTemplateArchive(archivePath, extractedTemplateDir) {
37957
37973
  const tar = (0, import_node_child_process.spawnSync)(
@@ -45408,7 +45424,7 @@ var import_path5 = require("path");
45408
45424
  var import_node_fs4 = require("fs");
45409
45425
 
45410
45426
  // src/utils/duckdb-runtime.ts
45411
- var import_node_crypto2 = require("crypto");
45427
+ var import_node_crypto3 = require("crypto");
45412
45428
  var import_node_fs3 = require("fs");
45413
45429
  var import_node_path4 = require("path");
45414
45430
  var import_node_zlib = require("zlib");
@@ -45458,7 +45474,7 @@ async function ensureDuckdb(target) {
45458
45474
  );
45459
45475
  }
45460
45476
  const archive = Buffer.from(await response.arrayBuffer());
45461
- const digest = (0, import_node_crypto2.createHash)("sha256").update(archive).digest("hex");
45477
+ const digest = (0, import_node_crypto3.createHash)("sha256").update(archive).digest("hex");
45462
45478
  if (digest !== target.sha256) {
45463
45479
  throw new Error(
45464
45480
  `DuckDB ${DUCKDB_VERSION} download did not match its checksum`
@@ -45759,7 +45775,7 @@ var import_fs7 = require("fs");
45759
45775
  // package.json
45760
45776
  var package_default = {
45761
45777
  name: "oleander-cli",
45762
- version: "0.25.2",
45778
+ version: "0.25.4",
45763
45779
  description: "oleander CLI",
45764
45780
  keywords: [
45765
45781
  "cli",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oleander-cli",
3
- "version": "0.25.2",
3
+ "version": "0.25.4",
4
4
  "description": "oleander CLI",
5
5
  "keywords": [
6
6
  "cli",