oleander-cli 0.24.0 → 0.25.1

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 +53 -24
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -45423,29 +45423,24 @@ var import_node_crypto2 = require("crypto");
45423
45423
  var import_node_fs3 = require("fs");
45424
45424
  var import_node_path4 = require("path");
45425
45425
  var import_node_zlib = require("zlib");
45426
- var DUCKDB_VERSION = "v1.5.3";
45426
+ var DUCKDB_VERSION = "v2.0.0";
45427
45427
  var OLEANDER_EXTENSION_RELEASE = "v0.3.1";
45428
45428
  var OLEANDER_EXTENSION_REPOSITORY = `https://oleander-cli-releases.s3.amazonaws.com/duckdb/${OLEANDER_EXTENSION_RELEASE}`;
45429
45429
  var CLI_JOB_NAMESPACE = "oleander.cli";
45430
45430
  var DUCKDB_BINARIES = {
45431
45431
  "darwin-arm64": {
45432
- asset: "duckdb_cli-osx-arm64.gz",
45433
- sha256: "fe3dcc3822c72147ca7b5fa56eeedd3b7d30e09cb268f056cf3355289773d8f0",
45432
+ asset: "duckdb-cli-osx-arm64.tar.gz",
45433
+ sha256: "188a36fe8883ef52e69165a0cbb6031ef679c8e6c448a1ce22951964149b7f96",
45434
45434
  extensionPlatform: "osx_arm64"
45435
45435
  },
45436
- "darwin-x64": {
45437
- asset: "duckdb_cli-osx-amd64.gz",
45438
- sha256: "e14bbce5356e5398d67155c4147cb7e85288c0308636d6e034215dcd74302ec3",
45439
- extensionPlatform: "osx_amd64"
45440
- },
45441
45436
  "linux-x64": {
45442
- asset: "duckdb_cli-linux-amd64.gz",
45443
- sha256: "f05f3b448a9a1bc6e7ac27ff14dfe67bf5761b153c2002723365a456618ef35b",
45437
+ asset: "duckdb-cli-linux-amd64.tar.gz",
45438
+ sha256: "c6507206baf7793c6013dbd82368469a45f20dc0e17a6f92f204602f652ed2bc",
45444
45439
  extensionPlatform: "linux_amd64"
45445
45440
  },
45446
45441
  "linux-arm64": {
45447
- asset: "duckdb_cli-linux-arm64.gz",
45448
- sha256: "65b3135fb25d9a46cb4752c0638dd688819e64cb1c96bc71ffb8cca04083509f",
45442
+ asset: "duckdb-cli-linux-arm64.tar.gz",
45443
+ sha256: "859e1875d2a9515fbb4bf8871061437a14af82320da68c753f094c4b776348fe",
45449
45444
  extensionPlatform: "linux_arm64"
45450
45445
  }
45451
45446
  };
@@ -45480,13 +45475,37 @@ async function ensureDuckdb(target) {
45480
45475
  `DuckDB ${DUCKDB_VERSION} download did not match its checksum`
45481
45476
  );
45482
45477
  }
45478
+ const executable = tarEntry((0, import_node_zlib.gunzipSync)(archive), "duckdb");
45479
+ if (!executable) {
45480
+ throw new Error(`DuckDB ${DUCKDB_VERSION} download held no duckdb binary`);
45481
+ }
45483
45482
  (0, import_node_fs3.mkdirSync)(runtimeDir(), { recursive: true });
45484
45483
  const partial = `${binary}.partial`;
45485
- (0, import_node_fs3.writeFileSync)(partial, (0, import_node_zlib.gunzipSync)(archive), { mode: 493 });
45484
+ (0, import_node_fs3.writeFileSync)(partial, executable, { mode: 493 });
45486
45485
  (0, import_node_fs3.chmodSync)(partial, 493);
45487
45486
  (0, import_node_fs3.renameSync)(partial, binary);
45488
45487
  return binary;
45489
45488
  }
45489
+ function tarEntry(archive, path2) {
45490
+ let offset = 0;
45491
+ while (offset + 512 <= archive.length) {
45492
+ const header = archive.subarray(offset, offset + 512);
45493
+ if (header.every((byte) => byte === 0)) return null;
45494
+ const field = (start2, length) => {
45495
+ const value = header.subarray(start2, start2 + length);
45496
+ const nul = value.indexOf(0);
45497
+ return value.toString("utf8", 0, nul === -1 ? length : nul);
45498
+ };
45499
+ const size = parseInt(field(124, 12).trim() || "0", 8);
45500
+ const type = field(156, 1);
45501
+ const start = offset + 512;
45502
+ if ((type === "0" || type === "") && field(0, 100).replace(/^\.\//, "") === path2) {
45503
+ return archive.subarray(start, start + size);
45504
+ }
45505
+ offset = start + Math.ceil(size / 512) * 512;
45506
+ }
45507
+ return null;
45508
+ }
45490
45509
  function installedExtensionRelease(path2) {
45491
45510
  if (!(0, import_node_fs3.existsSync)(path2)) return null;
45492
45511
  const fd = (0, import_node_fs3.openSync)(path2, "r");
@@ -45536,7 +45555,7 @@ function getHorizonCatalogBaseUrl(catalogUri) {
45536
45555
  url.pathname = normalizedPath.endsWith(HORIZON_CATALOG_PATH) ? normalizedPath : HORIZON_CATALOG_PATH;
45537
45556
  return url.toString().replace(/\/$/, "");
45538
45557
  }
45539
- function catalogAttachSql(catalog, credJson) {
45558
+ function catalogAttachSql(catalog, credJson, endpointOption = "URI") {
45540
45559
  const secretName = `${catalog.name}_secret`;
45541
45560
  if (catalog.type === "lakekeeper") {
45542
45561
  return `
@@ -45547,7 +45566,7 @@ function catalogAttachSql(catalog, credJson) {
45547
45566
  ATTACH '${catalog.properties.warehouse}' AS ${catalog.name} (
45548
45567
  TYPE iceberg,
45549
45568
  SECRET ${secretName},
45550
- ENDPOINT '${getIcebergEndpoint()}'
45569
+ ${endpointOption} '${getIcebergEndpoint()}'
45551
45570
  );
45552
45571
  `;
45553
45572
  }
@@ -45580,7 +45599,7 @@ function catalogAttachSql(catalog, credJson) {
45580
45599
  ATTACH '${catalog.properties.database}' AS ${catalog.name} (
45581
45600
  TYPE iceberg,
45582
45601
  SECRET ${secretName},
45583
- ENDPOINT '${getHorizonCatalogBaseUrl(catalog.properties.catalogUri)}',
45602
+ ${endpointOption} '${getHorizonCatalogBaseUrl(catalog.properties.catalogUri)}',
45584
45603
  ACCESS_DELEGATION_MODE 'vended_credentials'
45585
45604
  );
45586
45605
  `;
@@ -45594,7 +45613,7 @@ function catalogAttachSql(catalog, credJson) {
45594
45613
  ATTACH '' AS ${catalog.name} (
45595
45614
  TYPE iceberg,
45596
45615
  SECRET ${secretName},
45597
- ENDPOINT '${credJson.endpoint}',
45616
+ ${endpointOption} '${credJson.endpoint}',
45598
45617
  ACCESS_DELEGATION_MODE 'vended_credentials',
45599
45618
  DEFAULT_REGION '${credJson.region}',
45600
45619
  READ_ONLY
@@ -45646,12 +45665,16 @@ async function duckdbTerminal(options) {
45646
45665
  }
45647
45666
  } else if (lineage) {
45648
45667
  notices.push(
45649
- `Lineage needs DuckDB ${DUCKDB_VERSION} on macOS or glibc Linux; starting your own duckdb without it.`
45668
+ `Lineage needs DuckDB ${DUCKDB_VERSION} on Apple silicon macOS or glibc Linux; starting your own duckdb without it.`
45650
45669
  );
45651
45670
  lineage = false;
45652
45671
  }
45653
- let initSql = duckdb === "duckdb" ? "" : `SET extension_directory = ${sqlString(extensionDirectory())};
45672
+ const ownDuckdb = duckdb === "duckdb";
45673
+ let initSql = ".mode trash\n";
45674
+ if (!ownDuckdb) {
45675
+ initSql += `SET extension_directories = [${sqlString(extensionDirectory())}];
45654
45676
  `;
45677
+ }
45655
45678
  initSql += `
45656
45679
  INSTALL httpfs; LOAD httpfs;
45657
45680
  INSTALL iceberg; LOAD iceberg;
@@ -45679,7 +45702,11 @@ async function duckdbTerminal(options) {
45679
45702
  continue;
45680
45703
  }
45681
45704
  const credJson = await credResp.json();
45682
- const attachSql = catalogAttachSql(catalog, credJson);
45705
+ const attachSql = catalogAttachSql(
45706
+ catalog,
45707
+ credJson,
45708
+ ownDuckdb ? "ENDPOINT" : "URI"
45709
+ );
45683
45710
  if (attachSql === null) {
45684
45711
  skipped.push(
45685
45712
  `Skipped catalog ${catalog.name}: unknown catalog type ${catalog.type}`
@@ -45697,9 +45724,10 @@ async function duckdbTerminal(options) {
45697
45724
  if (lineage && target) {
45698
45725
  initSql += lineageInitSql(target, attached);
45699
45726
  }
45727
+ initSql += ".mode duckbox\n";
45700
45728
  const tempDir = (0, import_fs5.mkdtempSync)((0, import_path5.join)((0, import_node_os4.tmpdir)(), "oleander-duckdb-init-"));
45701
45729
  const initPath = (0, import_path5.join)(tempDir, "init.sql");
45702
- (0, import_node_fs4.writeFileSync)(initPath, initSql.trimStart(), { encoding: "utf-8" });
45730
+ (0, import_node_fs4.writeFileSync)(initPath, initSql, { encoding: "utf-8" });
45703
45731
  spinner.succeed(
45704
45732
  lineage ? `Starting DuckDB ${DUCKDB_VERSION} for oleander lake, reporting lineage.` : "Starting duckdb terminal for oleander lake."
45705
45733
  );
@@ -45742,7 +45770,7 @@ var import_fs7 = require("fs");
45742
45770
  // package.json
45743
45771
  var package_default = {
45744
45772
  name: "oleander-cli",
45745
- version: "0.24.0",
45773
+ version: "0.25.1",
45746
45774
  description: "oleander CLI",
45747
45775
  keywords: [
45748
45776
  "cli",
@@ -47053,8 +47081,9 @@ program2.command("duckdb").description("Starts a local DuckDB shell").option("--
47053
47081
  `
47054
47082
  Runs DuckDB ${DUCKDB_VERSION}, downloaded to ~/.oleander on first use, with every catalog attached. Each
47055
47083
  statement that reads or writes a table reports its lineage to oleander (the oleander DuckDB extension,
47056
- which DuckDB loads as an unsigned extension). Where no build is published (Windows, musl Linux) your
47057
- own duckdb starts, without lineage. For one-shot SQL on DuckDB, use oleander query --engine duckdb.
47084
+ which DuckDB loads as an unsigned extension). Where no build is published (Intel Macs, Windows, musl
47085
+ Linux) your own duckdb starts, without lineage. For one-shot SQL on DuckDB, use oleander query --engine
47086
+ duckdb.
47058
47087
  `
47059
47088
  ).action(duckdbTerminal);
47060
47089
  registerSparkCommands(program2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oleander-cli",
3
- "version": "0.24.0",
3
+ "version": "0.25.1",
4
4
  "description": "oleander CLI",
5
5
  "keywords": [
6
6
  "cli",