@altertable/cli 1.13.2 → 1.14.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/cli.js +94 -40
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -8537,7 +8537,7 @@ function getOutputSink() {
|
|
|
8537
8537
|
}
|
|
8538
8538
|
|
|
8539
8539
|
// src/lib/transport-defaults.ts
|
|
8540
|
-
var DEFAULT_CONNECT_TIMEOUT_MS =
|
|
8540
|
+
var DEFAULT_CONNECT_TIMEOUT_MS = 30000;
|
|
8541
8541
|
var DEFAULT_READ_TIMEOUT_MS = 60000;
|
|
8542
8542
|
var STREAM_READ_TIMEOUT_MS = 0;
|
|
8543
8543
|
|
|
@@ -9179,7 +9179,7 @@ function redactResponseBodyForDebug(body) {
|
|
|
9179
9179
|
}
|
|
9180
9180
|
|
|
9181
9181
|
// src/version.ts
|
|
9182
|
-
var VERSION = "1.
|
|
9182
|
+
var VERSION = "1.14.0";
|
|
9183
9183
|
var USER_AGENT = `altertable-cli/${VERSION}`;
|
|
9184
9184
|
|
|
9185
9185
|
// src/lib/http.ts
|
|
@@ -9280,18 +9280,29 @@ function unwrapErrorDetail(error) {
|
|
|
9280
9280
|
}
|
|
9281
9281
|
return messages.join(": ");
|
|
9282
9282
|
}
|
|
9283
|
-
function
|
|
9284
|
-
return
|
|
9283
|
+
function formatDuration(durationMs) {
|
|
9284
|
+
return durationMs % 1000 === 0 ? `${durationMs / 1000}s` : `${durationMs}ms`;
|
|
9285
|
+
}
|
|
9286
|
+
function timeoutError(options, budget, cause) {
|
|
9287
|
+
return new TimeoutError(`CLI timed out after ${formatDuration(budget.durationMs)} ${budget.waitingFor}: ${options.method} ${options.url}`, {
|
|
9288
|
+
cause,
|
|
9289
|
+
details: [
|
|
9290
|
+
`This limit is enforced by the CLI (${budget.flags}), not reported by the server; the request may still be running server-side.`,
|
|
9291
|
+
"A slow network or a long-running request can both trigger it.",
|
|
9292
|
+
`Raise it with ${budget.flags.replace(" + ", " or ")} <seconds>.`
|
|
9293
|
+
].join(`
|
|
9294
|
+
`)
|
|
9295
|
+
});
|
|
9285
9296
|
}
|
|
9286
9297
|
function connectionError(options, cause) {
|
|
9287
9298
|
const detail = unwrapErrorDetail(cause);
|
|
9288
9299
|
const suffix = detail ? ` (${detail})` : "";
|
|
9289
9300
|
return new NetworkError(`Request failed (network error): ${options.method} ${options.url}${suffix}`, { cause });
|
|
9290
9301
|
}
|
|
9291
|
-
function transportError(options, signal, cause) {
|
|
9292
|
-
return signal.aborted ? timeoutError(options, cause) : connectionError(options, cause);
|
|
9302
|
+
function transportError(options, signal, budget, cause) {
|
|
9303
|
+
return signal.aborted ? timeoutError(options, budget(), cause) : connectionError(options, cause);
|
|
9293
9304
|
}
|
|
9294
|
-
function wrapResponseStream(stream, clearTimeoutAfterRead, signal, options) {
|
|
9305
|
+
function wrapResponseStream(stream, clearTimeoutAfterRead, signal, budget, options) {
|
|
9295
9306
|
const reader = stream.getReader();
|
|
9296
9307
|
return new ReadableStream({
|
|
9297
9308
|
async pull(controller) {
|
|
@@ -9307,7 +9318,7 @@ function wrapResponseStream(stream, clearTimeoutAfterRead, signal, options) {
|
|
|
9307
9318
|
} catch (error) {
|
|
9308
9319
|
clearTimeoutAfterRead();
|
|
9309
9320
|
reader.releaseLock();
|
|
9310
|
-
controller.error(transportError(options, signal, error));
|
|
9321
|
+
controller.error(transportError(options, signal, budget, error));
|
|
9311
9322
|
}
|
|
9312
9323
|
},
|
|
9313
9324
|
async cancel(reason) {
|
|
@@ -9491,6 +9502,11 @@ async function executeLiveRequest(options) {
|
|
|
9491
9502
|
const headers = buildRequestHeaders(options);
|
|
9492
9503
|
const timeoutMs = resolveFetchTimeoutMs(options);
|
|
9493
9504
|
const signal = AbortSignal.timeout(timeoutMs);
|
|
9505
|
+
const budget = () => ({
|
|
9506
|
+
flags: resolveReadTimeoutMs(options) > 0 ? "--connect-timeout + --read-timeout" : "--connect-timeout",
|
|
9507
|
+
durationMs: timeoutMs,
|
|
9508
|
+
waitingFor: "waiting for the server"
|
|
9509
|
+
});
|
|
9494
9510
|
logHttpRequest(options);
|
|
9495
9511
|
logDebug(`Request: ${options.method} ${options.url}`);
|
|
9496
9512
|
logHttpDebug([
|
|
@@ -9501,13 +9517,13 @@ async function executeLiveRequest(options) {
|
|
|
9501
9517
|
try {
|
|
9502
9518
|
response = await fetch(options.url, buildFetchInit(options, headers, signal));
|
|
9503
9519
|
} catch (error) {
|
|
9504
|
-
throw transportError(options, signal, error);
|
|
9520
|
+
throw transportError(options, signal, budget, error);
|
|
9505
9521
|
}
|
|
9506
9522
|
let responseBody;
|
|
9507
9523
|
try {
|
|
9508
9524
|
responseBody = await response.text();
|
|
9509
9525
|
} catch (error) {
|
|
9510
|
-
throw transportError(options, signal, error);
|
|
9526
|
+
throw transportError(options, signal, budget, error);
|
|
9511
9527
|
}
|
|
9512
9528
|
logHttpDebug([
|
|
9513
9529
|
`< HTTP/${response.status}`,
|
|
@@ -9531,11 +9547,23 @@ async function executeLiveStream(options) {
|
|
|
9531
9547
|
clearTimeout(timeout);
|
|
9532
9548
|
timeout = undefined;
|
|
9533
9549
|
};
|
|
9534
|
-
|
|
9550
|
+
let activeBudget = {
|
|
9551
|
+
flags: "--connect-timeout",
|
|
9552
|
+
durationMs: connectTimeoutMs,
|
|
9553
|
+
waitingFor: "waiting for the server to respond"
|
|
9554
|
+
};
|
|
9555
|
+
const budget = () => activeBudget;
|
|
9556
|
+
const startTimeout = (next) => {
|
|
9535
9557
|
clearActiveTimeout();
|
|
9536
|
-
|
|
9558
|
+
activeBudget = next;
|
|
9559
|
+
timeout = setTimeout(() => abortController.abort(), next.durationMs);
|
|
9560
|
+
};
|
|
9561
|
+
const readBudget = {
|
|
9562
|
+
flags: "--read-timeout",
|
|
9563
|
+
durationMs: readTimeoutMs,
|
|
9564
|
+
waitingFor: "reading the response"
|
|
9537
9565
|
};
|
|
9538
|
-
startTimeout(
|
|
9566
|
+
startTimeout(activeBudget);
|
|
9539
9567
|
logHttpRequest(options);
|
|
9540
9568
|
logDebug(`Request: ${options.method} ${options.url}`);
|
|
9541
9569
|
let response;
|
|
@@ -9544,25 +9572,25 @@ async function executeLiveStream(options) {
|
|
|
9544
9572
|
clearActiveTimeout();
|
|
9545
9573
|
} catch (error) {
|
|
9546
9574
|
clearActiveTimeout();
|
|
9547
|
-
throw transportError(options, abortController.signal, error);
|
|
9575
|
+
throw transportError(options, abortController.signal, budget, error);
|
|
9548
9576
|
}
|
|
9549
9577
|
if (response.status >= 200 && response.status < 300) {
|
|
9550
9578
|
if (!response.body) {
|
|
9551
9579
|
throw new NetworkError("Response body is missing.");
|
|
9552
9580
|
}
|
|
9553
9581
|
if (readTimeoutMs > 0) {
|
|
9554
|
-
startTimeout(
|
|
9582
|
+
startTimeout(readBudget);
|
|
9555
9583
|
}
|
|
9556
|
-
return wrapResponseStream(response.body, clearActiveTimeout, abortController.signal, options);
|
|
9584
|
+
return wrapResponseStream(response.body, clearActiveTimeout, abortController.signal, budget, options);
|
|
9557
9585
|
}
|
|
9558
9586
|
if (readTimeoutMs > 0) {
|
|
9559
|
-
startTimeout(
|
|
9587
|
+
startTimeout(readBudget);
|
|
9560
9588
|
}
|
|
9561
9589
|
let responseBody;
|
|
9562
9590
|
try {
|
|
9563
9591
|
responseBody = await response.text();
|
|
9564
9592
|
} catch (error) {
|
|
9565
|
-
throw transportError(options, abortController.signal, error);
|
|
9593
|
+
throw transportError(options, abortController.signal, budget, error);
|
|
9566
9594
|
} finally {
|
|
9567
9595
|
clearActiveTimeout();
|
|
9568
9596
|
}
|
|
@@ -15186,9 +15214,9 @@ Commit app source, \`package.json\`, and \`bun.lock\`. On a fresh clone, run \`b
|
|
|
15186
15214
|
"": {
|
|
15187
15215
|
"name": "data-app-starter",
|
|
15188
15216
|
"dependencies": {
|
|
15189
|
-
"@altertable/data-app": "0.
|
|
15190
|
-
"@altertable/data-app-bun": "0.
|
|
15191
|
-
"@altertable/data-app-react": "0.
|
|
15217
|
+
"@altertable/data-app": "0.74.0",
|
|
15218
|
+
"@altertable/data-app-bun": "0.74.0",
|
|
15219
|
+
"@altertable/data-app-react": "0.74.0",
|
|
15192
15220
|
"react": "19.3.0",
|
|
15193
15221
|
"react-dom": "19.3.0",
|
|
15194
15222
|
},
|
|
@@ -15204,11 +15232,11 @@ Commit app source, \`package.json\`, and \`bun.lock\`. On a fresh clone, run \`b
|
|
|
15204
15232
|
},
|
|
15205
15233
|
},
|
|
15206
15234
|
"packages": {
|
|
15207
|
-
"@altertable/data-app": ["@altertable/data-app@0.
|
|
15235
|
+
"@altertable/data-app": ["@altertable/data-app@0.74.0", "", { "dependencies": { "@internationalized/date": "3.12.4" } }, "sha512-19Y72gkpid1tKXtesofrwe4oyBUp5FknQ0smgOa1Ilx+8Y/2Xu9F4lHlhAuJU3r0zlEj2Rb/AYZcWXTfUXKZhQ=="],
|
|
15208
15236
|
|
|
15209
|
-
"@altertable/data-app-bun": ["@altertable/data-app-bun@0.
|
|
15237
|
+
"@altertable/data-app-bun": ["@altertable/data-app-bun@0.74.0", "", { "dependencies": { "@altertable/data-app": "0.74.0", "@altertable/lakehouse": "0.4.1", "get-tsconfig": "4.14.3" }, "bin": { "data-app-preview": "bin/preview.js" } }, "sha512-zxGaxeG4hzCNcPv20a0ZgrUpFONL5fllzThSlzbYnFM2Tkva3WFP0/N70KF02SddzaboskN5ouqrdUAErq/4Dw=="],
|
|
15210
15238
|
|
|
15211
|
-
"@altertable/data-app-react": ["@altertable/data-app-react@0.
|
|
15239
|
+
"@altertable/data-app-react": ["@altertable/data-app-react@0.74.0", "", { "dependencies": { "@altertable/data-app": "0.74.0", "@floating-ui/react": "0.27.20", "@internationalized/date": "3.12.4", "@tanstack/react-query": "5.104.3", "fflate": "0.8.3", "fuzzysort": "4.0.2", "html-to-image": "1.11.13", "lucide-react": "1.59.0", "react-aria-components": "1.22.1", "recharts": "3.10.1" }, "peerDependencies": { "react": ">=19.2.0", "react-dom": ">=19.2.0" } }, "sha512-E85+w7D1NpiJaIqLaVkHUzMU/TQxdM32NuMEvBAiPO/mclmpjSnvroU5ml/ZkMwX00b1MiKowSgKyyu6q2ckSw=="],
|
|
15212
15240
|
|
|
15213
15241
|
"@altertable/lakehouse": ["@altertable/lakehouse@0.4.1", "", {}, "sha512-m7d15cWt+WUGW7lVw2KYGD+Se8MzO25G7SWSuFd+OasBxWmOJNa2IrgvOHGVEbnZ+kexTUy9NjAGQ69sG4V91w=="],
|
|
15214
15242
|
|
|
@@ -15518,9 +15546,9 @@ exact = true
|
|
|
15518
15546
|
"build": "bun build src/index.html --outdir=dist --production"
|
|
15519
15547
|
},
|
|
15520
15548
|
"dependencies": {
|
|
15521
|
-
"@altertable/data-app": "0.
|
|
15522
|
-
"@altertable/data-app-bun": "0.
|
|
15523
|
-
"@altertable/data-app-react": "0.
|
|
15549
|
+
"@altertable/data-app": "0.74.0",
|
|
15550
|
+
"@altertable/data-app-bun": "0.74.0",
|
|
15551
|
+
"@altertable/data-app-react": "0.74.0",
|
|
15524
15552
|
"react": "19.3.0",
|
|
15525
15553
|
"react-dom": "19.3.0"
|
|
15526
15554
|
},
|
|
@@ -15681,23 +15709,23 @@ serveLocalApp({ page, operations, title: app.title });
|
|
|
15681
15709
|
"": {
|
|
15682
15710
|
"name": "data-app-file-preview",
|
|
15683
15711
|
"dependencies": {
|
|
15684
|
-
"@altertable/data-app": "0.
|
|
15685
|
-
"@altertable/data-app-bun": "0.
|
|
15686
|
-
"@altertable/data-app-manifest": "0.
|
|
15687
|
-
"@altertable/data-app-react": "0.
|
|
15712
|
+
"@altertable/data-app": "0.74.0",
|
|
15713
|
+
"@altertable/data-app-bun": "0.74.0",
|
|
15714
|
+
"@altertable/data-app-manifest": "0.74.0",
|
|
15715
|
+
"@altertable/data-app-react": "0.74.0",
|
|
15688
15716
|
"react": "19.3.0",
|
|
15689
15717
|
"react-dom": "19.3.0",
|
|
15690
15718
|
},
|
|
15691
15719
|
},
|
|
15692
15720
|
},
|
|
15693
15721
|
"packages": {
|
|
15694
|
-
"@altertable/data-app": ["@altertable/data-app@0.
|
|
15722
|
+
"@altertable/data-app": ["@altertable/data-app@0.74.0", "", { "dependencies": { "@internationalized/date": "3.12.4" } }, "sha512-19Y72gkpid1tKXtesofrwe4oyBUp5FknQ0smgOa1Ilx+8Y/2Xu9F4lHlhAuJU3r0zlEj2Rb/AYZcWXTfUXKZhQ=="],
|
|
15695
15723
|
|
|
15696
|
-
"@altertable/data-app-bun": ["@altertable/data-app-bun@0.
|
|
15724
|
+
"@altertable/data-app-bun": ["@altertable/data-app-bun@0.74.0", "", { "dependencies": { "@altertable/data-app": "0.74.0", "@altertable/lakehouse": "0.4.1", "get-tsconfig": "4.14.3" }, "bin": { "data-app-preview": "bin/preview.js" } }, "sha512-zxGaxeG4hzCNcPv20a0ZgrUpFONL5fllzThSlzbYnFM2Tkva3WFP0/N70KF02SddzaboskN5ouqrdUAErq/4Dw=="],
|
|
15697
15725
|
|
|
15698
|
-
"@altertable/data-app-manifest": ["@altertable/data-app-manifest@0.
|
|
15726
|
+
"@altertable/data-app-manifest": ["@altertable/data-app-manifest@0.74.0", "", { "dependencies": { "typescript": "5.9.3" } }, "sha512-PQEsKR1VpRkbXVn6LlmwlDBmPode0wlCJ9ivYlk4KKc9vgZcdHpjPuy+G+gaTKiIrYPJpxsLS0hcYxMENNoP2g=="],
|
|
15699
15727
|
|
|
15700
|
-
"@altertable/data-app-react": ["@altertable/data-app-react@0.
|
|
15728
|
+
"@altertable/data-app-react": ["@altertable/data-app-react@0.74.0", "", { "dependencies": { "@altertable/data-app": "0.74.0", "@floating-ui/react": "0.27.20", "@internationalized/date": "3.12.4", "@tanstack/react-query": "5.104.3", "fflate": "0.8.3", "fuzzysort": "4.0.2", "html-to-image": "1.11.13", "lucide-react": "1.59.0", "react-aria-components": "1.22.1", "recharts": "3.10.1" }, "peerDependencies": { "react": ">=19.2.0", "react-dom": ">=19.2.0" } }, "sha512-E85+w7D1NpiJaIqLaVkHUzMU/TQxdM32NuMEvBAiPO/mclmpjSnvroU5ml/ZkMwX00b1MiKowSgKyyu6q2ckSw=="],
|
|
15701
15729
|
|
|
15702
15730
|
"@altertable/lakehouse": ["@altertable/lakehouse@0.4.1", "", {}, "sha512-m7d15cWt+WUGW7lVw2KYGD+Se8MzO25G7SWSuFd+OasBxWmOJNa2IrgvOHGVEbnZ+kexTUy9NjAGQ69sG4V91w=="],
|
|
15703
15731
|
|
|
@@ -15853,12 +15881,12 @@ console.log(JSON.stringify(extractDataAppManifest(source)));
|
|
|
15853
15881
|
"dev": "data-app-preview"
|
|
15854
15882
|
},
|
|
15855
15883
|
"dependencies": {
|
|
15856
|
-
"@altertable/data-app": "0.
|
|
15857
|
-
"@altertable/data-app-bun": "0.
|
|
15858
|
-
"@altertable/data-app-react": "0.
|
|
15884
|
+
"@altertable/data-app": "0.74.0",
|
|
15885
|
+
"@altertable/data-app-bun": "0.74.0",
|
|
15886
|
+
"@altertable/data-app-react": "0.74.0",
|
|
15859
15887
|
"react": "19.3.0",
|
|
15860
15888
|
"react-dom": "19.3.0",
|
|
15861
|
-
"@altertable/data-app-manifest": "0.
|
|
15889
|
+
"@altertable/data-app-manifest": "0.74.0"
|
|
15862
15890
|
}
|
|
15863
15891
|
}
|
|
15864
15892
|
` } };
|
|
@@ -16741,6 +16769,14 @@ async function executeLakehouseQuery(input, execution, streaming) {
|
|
|
16741
16769
|
async function executeLakehouseQueryBytes(input, execution) {
|
|
16742
16770
|
return sendHttpStream(buildLakehouseQueryRequest(input, true), execution);
|
|
16743
16771
|
}
|
|
16772
|
+
function buildLakehouseQueryListRequest() {
|
|
16773
|
+
return {
|
|
16774
|
+
plane: "lakehouse",
|
|
16775
|
+
method: "GET",
|
|
16776
|
+
endpoint: "/queries",
|
|
16777
|
+
retry: true
|
|
16778
|
+
};
|
|
16779
|
+
}
|
|
16744
16780
|
function buildLakehouseQueryShowRequest(queryId) {
|
|
16745
16781
|
return {
|
|
16746
16782
|
plane: "lakehouse",
|
|
@@ -22916,6 +22952,22 @@ function parseQueryStatement(statementArg) {
|
|
|
22916
22952
|
return statement;
|
|
22917
22953
|
}
|
|
22918
22954
|
|
|
22955
|
+
// src/commands/query/list.ts
|
|
22956
|
+
var queryListCommand = defineCommand({
|
|
22957
|
+
metadata: {
|
|
22958
|
+
name: "list",
|
|
22959
|
+
description: "List running queries in the current environment."
|
|
22960
|
+
},
|
|
22961
|
+
async run({ execution, sink }) {
|
|
22962
|
+
const response = await sendHttp(buildLakehouseQueryListRequest(), execution);
|
|
22963
|
+
if (!sink.json && extractManagementRows(parseApiJson(response)).length === 0) {
|
|
22964
|
+
await writeCommandOutput({ kind: "human", text: "No running queries." }, sink);
|
|
22965
|
+
return;
|
|
22966
|
+
}
|
|
22967
|
+
await writeCommandOutput({ kind: "tabular", body: response }, sink);
|
|
22968
|
+
}
|
|
22969
|
+
});
|
|
22970
|
+
|
|
22919
22971
|
// src/commands/query/show.ts
|
|
22920
22972
|
var queryShowCommand = defineCommand({
|
|
22921
22973
|
metadata: {
|
|
@@ -22946,11 +22998,13 @@ var queryCommand = defineCommand({
|
|
|
22946
22998
|
'altertable query "SELECT event, timestamp FROM analytics.main.events ORDER BY timestamp DESC LIMIT 10" --json',
|
|
22947
22999
|
'altertable query "SELECT 1" --format csv --output results.csv',
|
|
22948
23000
|
"altertable query @report.sql --format csv --output results.csv",
|
|
23001
|
+
"altertable query list",
|
|
22949
23002
|
"altertable query show <query-id>"
|
|
22950
23003
|
]
|
|
22951
23004
|
},
|
|
22952
23005
|
args: queryRunArgs,
|
|
22953
23006
|
subcommands: {
|
|
23007
|
+
list: queryListCommand,
|
|
22954
23008
|
show: queryShowCommand,
|
|
22955
23009
|
cancel: queryCancelCommand
|
|
22956
23010
|
},
|
|
@@ -25284,7 +25338,7 @@ var ROOT_ARGS = defineArguments({
|
|
|
25284
25338
|
},
|
|
25285
25339
|
"connect-timeout": {
|
|
25286
25340
|
type: "string",
|
|
25287
|
-
description: "HTTP connect timeout in seconds (default
|
|
25341
|
+
description: "HTTP connect timeout in seconds (default 30)",
|
|
25288
25342
|
flagScope: "global"
|
|
25289
25343
|
},
|
|
25290
25344
|
"read-timeout": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altertable/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Altertable CLI — query and manage your data platform",
|
|
5
5
|
"homepage": "https://github.com/altertable-ai/altertable-cli#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"engines": {
|
|
68
68
|
"bun": ">=1.1.0"
|
|
69
69
|
},
|
|
70
|
-
"packageManager": "bun@1.4.
|
|
70
|
+
"packageManager": "bun@1.4.4"
|
|
71
71
|
}
|