deepline 0.1.144 → 0.1.146
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/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +36 -4
- package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +5 -2
- package/dist/bundling-sources/sdk/src/client.ts +5 -0
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/shared_libs/temporal/constants.ts +4 -3
- package/dist/cli/index.js +492 -43
- package/dist/cli/index.mjs +492 -43
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -619,10 +619,10 @@ var SDK_RELEASE = {
|
|
|
619
619
|
// 0.1.108 ships explicit dataset column/tool recompute policy and removes
|
|
620
620
|
// the SDK enrich generator's one-second stale policy.
|
|
621
621
|
// 0.1.110 ships authored V2 prebuilts and required top-level play descriptions.
|
|
622
|
-
version: "0.1.
|
|
622
|
+
version: "0.1.146",
|
|
623
623
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
624
624
|
supportPolicy: {
|
|
625
|
-
latest: "0.1.
|
|
625
|
+
latest: "0.1.146",
|
|
626
626
|
minimumSupported: "0.1.53",
|
|
627
627
|
deprecatedBelow: "0.1.53",
|
|
628
628
|
commandMinimumSupported: [
|
|
@@ -3499,6 +3499,9 @@ var DeeplineClient = class {
|
|
|
3499
3499
|
if (input2.runId?.trim()) {
|
|
3500
3500
|
params.set("runId", input2.runId.trim());
|
|
3501
3501
|
}
|
|
3502
|
+
if (input2.rowMode === "all") {
|
|
3503
|
+
params.set("rowMode", "all");
|
|
3504
|
+
}
|
|
3502
3505
|
return await this.http.get(
|
|
3503
3506
|
`/api/v2/plays/${encodeURIComponent(input2.playName)}/sheet?${params.toString()}`
|
|
3504
3507
|
);
|
|
@@ -11946,7 +11949,8 @@ async function fetchBackingDatasetRows(input2) {
|
|
|
11946
11949
|
tableNamespace,
|
|
11947
11950
|
runId: input2.status.runId,
|
|
11948
11951
|
limit: RUN_EXPORT_PAGE_SIZE,
|
|
11949
|
-
offset
|
|
11952
|
+
offset,
|
|
11953
|
+
rowMode: "all"
|
|
11950
11954
|
});
|
|
11951
11955
|
sheetRows.push(...page.rows);
|
|
11952
11956
|
const summaryTotal = page.summary?.stats?.total;
|
|
@@ -16286,8 +16290,10 @@ function helperSource() {
|
|
|
16286
16290
|
|
|
16287
16291
|
// src/cli/commands/enrich.ts
|
|
16288
16292
|
var ENRICH_EXPORT_PAGE_SIZE = 5e3;
|
|
16293
|
+
var ENRICH_AUTO_BATCH_ROWS = 250;
|
|
16289
16294
|
var EXIT_SERVER2 = 5;
|
|
16290
16295
|
var ENRICH_DEBUG_T0 = Date.now();
|
|
16296
|
+
var GENERATED_ENRICH_ROWS_TABLE_NAMESPACE = "deepline_enrich_rows";
|
|
16291
16297
|
var PLAN_SHAPING_OPTION_NAMES = [
|
|
16292
16298
|
"with",
|
|
16293
16299
|
"withWaterfall",
|
|
@@ -16951,7 +16957,12 @@ async function runGeneratedEnrichPlay(runArgs, options = {}) {
|
|
|
16951
16957
|
async function writeOutputCsv(outputPath, status, options) {
|
|
16952
16958
|
let rowsInfo = extractCanonicalRowsInfo(status);
|
|
16953
16959
|
if (!rowsInfo) {
|
|
16954
|
-
|
|
16960
|
+
rowsInfo = fallbackRowsInfoForGeneratedEnrichExport(status, options);
|
|
16961
|
+
}
|
|
16962
|
+
if (!rowsInfo) {
|
|
16963
|
+
throw new Error(
|
|
16964
|
+
"The generated play did not return row-shaped output, and no durable enrich rows were available to export."
|
|
16965
|
+
);
|
|
16955
16966
|
}
|
|
16956
16967
|
if (options?.client) {
|
|
16957
16968
|
rowsInfo = await fetchBackingRowsForCsvExport({
|
|
@@ -17014,6 +17025,98 @@ function extractPlayName2(status) {
|
|
|
17014
17025
|
}
|
|
17015
17026
|
return null;
|
|
17016
17027
|
}
|
|
17028
|
+
function selectedSourceCsvRange(sourceCsvPath, rows) {
|
|
17029
|
+
const sourceRows = readCsvRows(sourceCsvPath).length;
|
|
17030
|
+
if (sourceRows === 0) {
|
|
17031
|
+
return { start: 0, end: -1, count: 0, sourceRows };
|
|
17032
|
+
}
|
|
17033
|
+
const start = Math.max(0, rows?.rowStart ?? 0);
|
|
17034
|
+
if (start >= sourceRows) {
|
|
17035
|
+
return { start, end: start - 1, count: 0, sourceRows };
|
|
17036
|
+
}
|
|
17037
|
+
const maxEnd = sourceRows - 1;
|
|
17038
|
+
const end = rows?.rowEnd === null || rows?.rowEnd === void 0 ? maxEnd : Math.min(maxEnd, rows.rowEnd);
|
|
17039
|
+
return {
|
|
17040
|
+
start,
|
|
17041
|
+
end,
|
|
17042
|
+
count: Math.max(0, end - start + 1),
|
|
17043
|
+
sourceRows
|
|
17044
|
+
};
|
|
17045
|
+
}
|
|
17046
|
+
function selectedSourceCsvRowCount(options) {
|
|
17047
|
+
if (!options?.sourceCsvPath) {
|
|
17048
|
+
return null;
|
|
17049
|
+
}
|
|
17050
|
+
return selectedSourceCsvRange(options.sourceCsvPath, options.rows).count;
|
|
17051
|
+
}
|
|
17052
|
+
function collectStringFields(value, key, output2, depth = 0) {
|
|
17053
|
+
if (depth > 12 || !value || typeof value !== "object") {
|
|
17054
|
+
return;
|
|
17055
|
+
}
|
|
17056
|
+
if (Array.isArray(value)) {
|
|
17057
|
+
for (const item of value.slice(0, 50)) {
|
|
17058
|
+
collectStringFields(item, key, output2, depth + 1);
|
|
17059
|
+
}
|
|
17060
|
+
return;
|
|
17061
|
+
}
|
|
17062
|
+
const record = value;
|
|
17063
|
+
const direct = record[key];
|
|
17064
|
+
if (typeof direct === "string" && direct.trim()) {
|
|
17065
|
+
output2.add(direct.trim());
|
|
17066
|
+
}
|
|
17067
|
+
for (const child of Object.values(record)) {
|
|
17068
|
+
collectStringFields(child, key, output2, depth + 1);
|
|
17069
|
+
}
|
|
17070
|
+
}
|
|
17071
|
+
function fallbackRowsInfoForGeneratedEnrichExport(status, options) {
|
|
17072
|
+
if (!extractRunId(status) || !extractPlayName2(status)) {
|
|
17073
|
+
return null;
|
|
17074
|
+
}
|
|
17075
|
+
const totalRows = selectedSourceCsvRowCount(options);
|
|
17076
|
+
if (totalRows === null) {
|
|
17077
|
+
return null;
|
|
17078
|
+
}
|
|
17079
|
+
const tableNamespaces = /* @__PURE__ */ new Set();
|
|
17080
|
+
collectStringFields(status, "tableNamespace", tableNamespaces);
|
|
17081
|
+
collectStringFields(status, "artifactTableNamespace", tableNamespaces);
|
|
17082
|
+
const tableNamespace = tableNamespaces.values().next().value ?? GENERATED_ENRICH_ROWS_TABLE_NAMESPACE;
|
|
17083
|
+
return {
|
|
17084
|
+
rows: [],
|
|
17085
|
+
totalRows,
|
|
17086
|
+
columns: [],
|
|
17087
|
+
columnsExplicit: false,
|
|
17088
|
+
complete: false,
|
|
17089
|
+
source: tableNamespace,
|
|
17090
|
+
tableNamespace
|
|
17091
|
+
};
|
|
17092
|
+
}
|
|
17093
|
+
function firstCollectedStringField(value, key) {
|
|
17094
|
+
const fields = /* @__PURE__ */ new Set();
|
|
17095
|
+
collectStringFields(value, key, fields);
|
|
17096
|
+
return fields.values().next().value ?? null;
|
|
17097
|
+
}
|
|
17098
|
+
function emitPlainBatchRunFailure(input2) {
|
|
17099
|
+
process.stderr.write(
|
|
17100
|
+
`Batch ${input2.chunkIndex + 1}/${input2.chunkCount} failed for rows ${input2.rows.rowStart}:${input2.rows.rowEnd}.
|
|
17101
|
+
`
|
|
17102
|
+
);
|
|
17103
|
+
const runId = extractRunId(input2.status);
|
|
17104
|
+
const error = firstCollectedStringField(input2.status, "error") ?? firstCollectedStringField(input2.status, "message");
|
|
17105
|
+
if (runId) {
|
|
17106
|
+
process.stderr.write(`Run id: ${runId}
|
|
17107
|
+
`);
|
|
17108
|
+
}
|
|
17109
|
+
if (error) {
|
|
17110
|
+
process.stderr.write(`Error: ${error}
|
|
17111
|
+
`);
|
|
17112
|
+
}
|
|
17113
|
+
if (runId) {
|
|
17114
|
+
process.stderr.write(
|
|
17115
|
+
`Inspect run output: deepline runs get ${runId} --full --json
|
|
17116
|
+
`
|
|
17117
|
+
);
|
|
17118
|
+
}
|
|
17119
|
+
}
|
|
17017
17120
|
function exportableSheetRow2(row) {
|
|
17018
17121
|
if (!row || typeof row !== "object" || Array.isArray(row)) {
|
|
17019
17122
|
return null;
|
|
@@ -17381,7 +17484,8 @@ async function fetchBackingRowsForCsvExport(input2) {
|
|
|
17381
17484
|
tableNamespace,
|
|
17382
17485
|
runId,
|
|
17383
17486
|
limit: ENRICH_EXPORT_PAGE_SIZE,
|
|
17384
|
-
offset
|
|
17487
|
+
offset,
|
|
17488
|
+
rowMode: "all"
|
|
17385
17489
|
});
|
|
17386
17490
|
sheetRows.push(...page.rows);
|
|
17387
17491
|
const summaryTotal = page.summary?.stats?.total;
|
|
@@ -17749,41 +17853,177 @@ function registerEnrichCommand(program) {
|
|
|
17749
17853
|
const tempPlay = (0, import_node_path11.join)(tempDir, "deepline-enrich.play.ts");
|
|
17750
17854
|
try {
|
|
17751
17855
|
await (0, import_promises3.writeFile)(tempPlay, playSource, "utf8");
|
|
17752
|
-
const
|
|
17753
|
-
|
|
17754
|
-
|
|
17755
|
-
|
|
17856
|
+
const runOne = async (input2) => {
|
|
17857
|
+
const runtimeInput = {
|
|
17858
|
+
file: (0, import_node_path11.resolve)(input2.sourceCsvPath),
|
|
17859
|
+
...input2.rows.rowStart !== null ? { rowStart: input2.rows.rowStart } : {},
|
|
17860
|
+
...input2.rows.rowEnd !== null ? { rowEnd: input2.rows.rowEnd } : {}
|
|
17861
|
+
};
|
|
17862
|
+
const runArgs = [
|
|
17863
|
+
"--file",
|
|
17864
|
+
tempPlay,
|
|
17865
|
+
"--input",
|
|
17866
|
+
JSON.stringify(runtimeInput),
|
|
17867
|
+
"--watch"
|
|
17868
|
+
];
|
|
17869
|
+
if (options.profile) {
|
|
17870
|
+
runArgs.push("--profile", options.profile);
|
|
17871
|
+
}
|
|
17872
|
+
if (options.noOpen || input2.suppressOpen) {
|
|
17873
|
+
runArgs.push("--no-open");
|
|
17874
|
+
}
|
|
17875
|
+
if (input2.json) {
|
|
17876
|
+
runArgs.push("--json");
|
|
17877
|
+
} else {
|
|
17878
|
+
runArgs.push("--logs");
|
|
17879
|
+
}
|
|
17880
|
+
const timeoutSeconds = options.timeout ? Number.parseInt(options.timeout, 10) : null;
|
|
17881
|
+
if (timeoutSeconds !== null && Number.isFinite(timeoutSeconds) && timeoutSeconds > 0) {
|
|
17882
|
+
runArgs.push("--tail-timeout-ms", String(timeoutSeconds * 1e3));
|
|
17883
|
+
}
|
|
17884
|
+
const captured2 = await runGeneratedEnrichPlay(runArgs, {
|
|
17885
|
+
passthroughStdout: input2.passthroughStdout
|
|
17886
|
+
});
|
|
17887
|
+
const status2 = input2.json ? parseJsonOutput(captured2.stdout) : await resolveWatchedGeneratedPlayStatus({
|
|
17888
|
+
client: client2,
|
|
17889
|
+
stdout: captured2.stdout,
|
|
17890
|
+
exitCode: captured2.result
|
|
17891
|
+
});
|
|
17892
|
+
const exportResult2 = captured2.result === 0 && outputPath ? await writeOutputCsv(outputPath, status2, {
|
|
17893
|
+
client: client2,
|
|
17894
|
+
config,
|
|
17895
|
+
sourceCsvPath: input2.sourceCsvPath,
|
|
17896
|
+
rows: input2.rows,
|
|
17897
|
+
inPlace: Boolean(options.inPlace)
|
|
17898
|
+
}) : null;
|
|
17899
|
+
return { captured: captured2, status: status2, exportResult: exportResult2 };
|
|
17756
17900
|
};
|
|
17757
|
-
const
|
|
17758
|
-
|
|
17759
|
-
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
|
|
17764
|
-
|
|
17765
|
-
|
|
17766
|
-
|
|
17767
|
-
|
|
17768
|
-
|
|
17769
|
-
|
|
17770
|
-
|
|
17771
|
-
|
|
17772
|
-
|
|
17773
|
-
|
|
17774
|
-
|
|
17775
|
-
|
|
17776
|
-
|
|
17777
|
-
|
|
17901
|
+
const selectedRange = selectedSourceCsvRange(sourceCsvPath, rows);
|
|
17902
|
+
if (outputPath && selectedRange.count > ENRICH_AUTO_BATCH_ROWS) {
|
|
17903
|
+
const chunkCount = Math.ceil(
|
|
17904
|
+
selectedRange.count / ENRICH_AUTO_BATCH_ROWS
|
|
17905
|
+
);
|
|
17906
|
+
if (!options.json) {
|
|
17907
|
+
process.stderr.write(
|
|
17908
|
+
`Large enrich input selected ${selectedRange.count.toLocaleString()} rows. Running ${chunkCount.toLocaleString()} sequential batch runs of up to ${ENRICH_AUTO_BATCH_ROWS.toLocaleString()} rows and merging ${(0, import_node_path11.resolve)(outputPath)}.
|
|
17909
|
+
`
|
|
17910
|
+
);
|
|
17911
|
+
}
|
|
17912
|
+
let workingSourceCsvPath = sourceCsvPath;
|
|
17913
|
+
let lastStatus = null;
|
|
17914
|
+
let finalExportResult = null;
|
|
17915
|
+
let totalEnrichedRows = 0;
|
|
17916
|
+
const batchFailureRows = [];
|
|
17917
|
+
for (let chunkStart = selectedRange.start, chunkIndex = 0; chunkStart <= selectedRange.end; chunkStart += ENRICH_AUTO_BATCH_ROWS, chunkIndex += 1) {
|
|
17918
|
+
const chunkRows = {
|
|
17919
|
+
rowStart: chunkStart,
|
|
17920
|
+
rowEnd: Math.min(
|
|
17921
|
+
selectedRange.end,
|
|
17922
|
+
chunkStart + ENRICH_AUTO_BATCH_ROWS - 1
|
|
17923
|
+
)
|
|
17924
|
+
};
|
|
17925
|
+
if (!options.json) {
|
|
17926
|
+
process.stderr.write(
|
|
17927
|
+
`Batch ${chunkIndex + 1}/${chunkCount}: rows ${chunkRows.rowStart}:${chunkRows.rowEnd}
|
|
17928
|
+
`
|
|
17929
|
+
);
|
|
17930
|
+
}
|
|
17931
|
+
const chunk = await runOne({
|
|
17932
|
+
sourceCsvPath: workingSourceCsvPath,
|
|
17933
|
+
rows: chunkRows,
|
|
17934
|
+
json: true,
|
|
17935
|
+
passthroughStdout: false,
|
|
17936
|
+
suppressOpen: true
|
|
17937
|
+
});
|
|
17938
|
+
lastStatus = chunk.status;
|
|
17939
|
+
if (chunk.captured.result !== 0) {
|
|
17940
|
+
if (options.json) {
|
|
17941
|
+
printJson({
|
|
17942
|
+
ok: false,
|
|
17943
|
+
batch: {
|
|
17944
|
+
chunk: chunkIndex + 1,
|
|
17945
|
+
chunks: chunkCount,
|
|
17946
|
+
rows: chunkRows
|
|
17947
|
+
},
|
|
17948
|
+
result: chunk.status
|
|
17949
|
+
});
|
|
17950
|
+
} else {
|
|
17951
|
+
emitPlainBatchRunFailure({
|
|
17952
|
+
chunkIndex,
|
|
17953
|
+
chunkCount,
|
|
17954
|
+
rows: chunkRows,
|
|
17955
|
+
status: chunk.status
|
|
17956
|
+
});
|
|
17957
|
+
}
|
|
17958
|
+
process.exitCode = chunk.captured.result;
|
|
17959
|
+
return;
|
|
17960
|
+
}
|
|
17961
|
+
if (chunk.exportResult) {
|
|
17962
|
+
finalExportResult = chunk.exportResult;
|
|
17963
|
+
totalEnrichedRows += chunk.exportResult.enrichedRows;
|
|
17964
|
+
batchFailureRows.push(...chunk.exportResult.enrichedDataRows);
|
|
17965
|
+
workingSourceCsvPath = outputPath;
|
|
17966
|
+
}
|
|
17967
|
+
}
|
|
17968
|
+
const outputRows = readCsvRows(outputPath);
|
|
17969
|
+
const failureReport2 = await maybeEmitEnrichFailureReport({
|
|
17970
|
+
config,
|
|
17971
|
+
rows: batchFailureRows,
|
|
17972
|
+
rowRange: {
|
|
17973
|
+
rowStart: selectedRange.start,
|
|
17974
|
+
rowEnd: selectedRange.end
|
|
17975
|
+
},
|
|
17976
|
+
client: client2,
|
|
17977
|
+
outputPath
|
|
17978
|
+
});
|
|
17979
|
+
if (options.json) {
|
|
17980
|
+
const run = rewriteEnrichJsonStatus({
|
|
17981
|
+
status: lastStatus,
|
|
17982
|
+
config,
|
|
17983
|
+
forceAliases,
|
|
17984
|
+
output: finalExportResult ? {
|
|
17985
|
+
...finalExportResult,
|
|
17986
|
+
sourceCsvRows: selectedRange.sourceRows,
|
|
17987
|
+
selectedRows: selectedRange.count,
|
|
17988
|
+
enrichedRows: totalEnrichedRows,
|
|
17989
|
+
rows: outputRows.length,
|
|
17990
|
+
enrichedDataRows: outputRows
|
|
17991
|
+
} : null,
|
|
17992
|
+
failureReport: failureReport2
|
|
17993
|
+
});
|
|
17994
|
+
printJson({
|
|
17995
|
+
ok: !failureReport2,
|
|
17996
|
+
run,
|
|
17997
|
+
batch: {
|
|
17998
|
+
chunks: chunkCount,
|
|
17999
|
+
chunkRows: ENRICH_AUTO_BATCH_ROWS,
|
|
18000
|
+
selectedRows: selectedRange.count
|
|
18001
|
+
},
|
|
18002
|
+
output: finalExportResult ? {
|
|
18003
|
+
sourceCsvRows: selectedRange.sourceRows,
|
|
18004
|
+
selectedRows: selectedRange.count,
|
|
18005
|
+
enrichedRows: totalEnrichedRows,
|
|
18006
|
+
path: finalExportResult.path
|
|
18007
|
+
} : null,
|
|
18008
|
+
...failureReport2 ? {
|
|
18009
|
+
failure_report: {
|
|
18010
|
+
path: failureReport2.path,
|
|
18011
|
+
jobs: failureReport2.jobs.length
|
|
18012
|
+
}
|
|
18013
|
+
} : {}
|
|
18014
|
+
});
|
|
18015
|
+
}
|
|
18016
|
+
if (failureReport2) {
|
|
18017
|
+
process.exitCode = EXIT_SERVER2;
|
|
18018
|
+
}
|
|
18019
|
+
return;
|
|
17778
18020
|
}
|
|
17779
|
-
const captured = await
|
|
18021
|
+
const { captured, status, exportResult } = await runOne({
|
|
18022
|
+
sourceCsvPath,
|
|
18023
|
+
rows,
|
|
18024
|
+
json: Boolean(options.json),
|
|
17780
18025
|
passthroughStdout: !options.json
|
|
17781
18026
|
});
|
|
17782
|
-
const status = options.json ? parseJsonOutput(captured.stdout) : await resolveWatchedGeneratedPlayStatus({
|
|
17783
|
-
client: client2,
|
|
17784
|
-
stdout: captured.stdout,
|
|
17785
|
-
exitCode: captured.result
|
|
17786
|
-
});
|
|
17787
18027
|
if (captured.result !== 0) {
|
|
17788
18028
|
if (options.json) {
|
|
17789
18029
|
printJson({
|
|
@@ -17793,13 +18033,6 @@ function registerEnrichCommand(program) {
|
|
|
17793
18033
|
process.exitCode = captured.result;
|
|
17794
18034
|
return;
|
|
17795
18035
|
}
|
|
17796
|
-
const exportResult = outputPath ? await writeOutputCsv(outputPath, status, {
|
|
17797
|
-
client: client2,
|
|
17798
|
-
config,
|
|
17799
|
-
sourceCsvPath,
|
|
17800
|
-
rows,
|
|
17801
|
-
inPlace: Boolean(options.inPlace)
|
|
17802
|
-
}) : null;
|
|
17803
18036
|
const rowsForFailureReport = exportResult?.enrichedDataRows ?? extractCanonicalRowsInfo(status)?.rows ?? [];
|
|
17804
18037
|
if (options.json) {
|
|
17805
18038
|
const failureReport2 = await maybeEmitEnrichFailureReport({
|
|
@@ -18713,6 +18946,221 @@ Examples:
|
|
|
18713
18946
|
}
|
|
18714
18947
|
}
|
|
18715
18948
|
|
|
18949
|
+
// src/cli/commands/monitors.ts
|
|
18950
|
+
var FORBIDDEN_AS_API_ERROR = { forbiddenAsApiError: true };
|
|
18951
|
+
function buildHttpClient() {
|
|
18952
|
+
return new HttpClient(resolveConfig());
|
|
18953
|
+
}
|
|
18954
|
+
function parseJsonObjectArg(raw, flag) {
|
|
18955
|
+
let parsed;
|
|
18956
|
+
try {
|
|
18957
|
+
parsed = JSON.parse(raw);
|
|
18958
|
+
} catch (error) {
|
|
18959
|
+
throw new Error(
|
|
18960
|
+
`${flag} must be a JSON object. ${error instanceof Error ? error.message : String(error)}`
|
|
18961
|
+
);
|
|
18962
|
+
}
|
|
18963
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
18964
|
+
throw new Error(`${flag} must be a JSON object.`);
|
|
18965
|
+
}
|
|
18966
|
+
return parsed;
|
|
18967
|
+
}
|
|
18968
|
+
function encodeKey(key) {
|
|
18969
|
+
return encodeURIComponent(key);
|
|
18970
|
+
}
|
|
18971
|
+
async function handleMonitorsTools(options) {
|
|
18972
|
+
const http = buildHttpClient();
|
|
18973
|
+
const params = new URLSearchParams();
|
|
18974
|
+
if (options.provider) params.set("provider", options.provider);
|
|
18975
|
+
if (options.tool) params.set("tool", options.tool);
|
|
18976
|
+
if (options.search) params.set("search", options.search);
|
|
18977
|
+
if (options.limit) params.set("limit", options.limit);
|
|
18978
|
+
const query = params.toString();
|
|
18979
|
+
const payload = await http.request(
|
|
18980
|
+
`/api/v2/monitors/tools${query ? `?${query}` : ""}`,
|
|
18981
|
+
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
18982
|
+
);
|
|
18983
|
+
printCommandEnvelope(payload, { json: options.json });
|
|
18984
|
+
}
|
|
18985
|
+
async function handleMonitorsCheck(definition, options) {
|
|
18986
|
+
const http = buildHttpClient();
|
|
18987
|
+
const body = parseJsonObjectArg(definition, "--definition");
|
|
18988
|
+
const payload = await http.request(
|
|
18989
|
+
"/api/v2/monitors/check",
|
|
18990
|
+
{ method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
|
|
18991
|
+
);
|
|
18992
|
+
printCommandEnvelope(payload, { json: options.json });
|
|
18993
|
+
}
|
|
18994
|
+
async function handleMonitorsDeploy(definition, options) {
|
|
18995
|
+
const http = buildHttpClient();
|
|
18996
|
+
const body = parseJsonObjectArg(definition, "--definition");
|
|
18997
|
+
const payload = await http.request(
|
|
18998
|
+
"/api/v2/monitors/deploy",
|
|
18999
|
+
{ method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
|
|
19000
|
+
);
|
|
19001
|
+
printCommandEnvelope(payload, { json: options.json });
|
|
19002
|
+
}
|
|
19003
|
+
async function handleDeployedList(options) {
|
|
19004
|
+
const http = buildHttpClient();
|
|
19005
|
+
const params = new URLSearchParams();
|
|
19006
|
+
if (options.status) params.set("status", options.status);
|
|
19007
|
+
if (options.limit) params.set("limit", options.limit);
|
|
19008
|
+
const query = params.toString();
|
|
19009
|
+
const payload = await http.request(
|
|
19010
|
+
`/api/v2/monitors/deployed${query ? `?${query}` : ""}`,
|
|
19011
|
+
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
19012
|
+
);
|
|
19013
|
+
printCommandEnvelope(payload, { json: options.json });
|
|
19014
|
+
}
|
|
19015
|
+
async function handleDeployedGet(key, options) {
|
|
19016
|
+
const http = buildHttpClient();
|
|
19017
|
+
const payload = await http.request(
|
|
19018
|
+
`/api/v2/monitors/deployed/${encodeKey(key)}`,
|
|
19019
|
+
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
19020
|
+
);
|
|
19021
|
+
printCommandEnvelope(payload, { json: options.json });
|
|
19022
|
+
}
|
|
19023
|
+
async function handleDeployedDelete(key, options) {
|
|
19024
|
+
const http = buildHttpClient();
|
|
19025
|
+
const params = new URLSearchParams();
|
|
19026
|
+
if (options.localOnly) params.set("local_only", "true");
|
|
19027
|
+
const query = params.toString();
|
|
19028
|
+
const payload = await http.request(
|
|
19029
|
+
`/api/v2/monitors/deployed/${encodeKey(key)}${query ? `?${query}` : ""}`,
|
|
19030
|
+
{ method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
|
|
19031
|
+
);
|
|
19032
|
+
printCommandEnvelope(payload, { json: options.json });
|
|
19033
|
+
}
|
|
19034
|
+
async function handleDeployedUpdate(key, patch, options) {
|
|
19035
|
+
const http = buildHttpClient();
|
|
19036
|
+
const body = parseJsonObjectArg(patch, "<patch>");
|
|
19037
|
+
const payload = await http.request(
|
|
19038
|
+
`/api/v2/monitors/deployed/${encodeKey(key)}`,
|
|
19039
|
+
{ method: "PATCH", body, ...FORBIDDEN_AS_API_ERROR }
|
|
19040
|
+
);
|
|
19041
|
+
printCommandEnvelope(payload, { json: options.json });
|
|
19042
|
+
}
|
|
19043
|
+
async function handleReactivate(key, options) {
|
|
19044
|
+
const http = buildHttpClient();
|
|
19045
|
+
const payload = await http.request(
|
|
19046
|
+
`/api/v2/monitors/deployed/${encodeKey(key)}/reactivate`,
|
|
19047
|
+
{ method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
|
|
19048
|
+
);
|
|
19049
|
+
printCommandEnvelope(payload, { json: options.json });
|
|
19050
|
+
}
|
|
19051
|
+
function registerMonitorsCommands(program) {
|
|
19052
|
+
const monitors = program.command("monitors").description("Discover, deploy, and manage Deepline monitors.").addHelpText(
|
|
19053
|
+
"after",
|
|
19054
|
+
`
|
|
19055
|
+
Notes:
|
|
19056
|
+
Monitors are provider-backed signal feeds that deliver events into your
|
|
19057
|
+
workspace. Access is granted by a Deepline admin via Admin -> Rollouts; until
|
|
19058
|
+
then these commands return a clear monitor_access_required error.
|
|
19059
|
+
|
|
19060
|
+
Examples:
|
|
19061
|
+
deepline monitors tools --json
|
|
19062
|
+
deepline monitors check '{"key":"my-monitor","tool":"...","payload":{}}'
|
|
19063
|
+
deepline monitors deploy '{"key":"my-monitor","tool":"...","payload":{}}'
|
|
19064
|
+
deepline monitors deployed --json
|
|
19065
|
+
deepline monitors deployed get my-monitor --json
|
|
19066
|
+
deepline monitors reactivate my-monitor --json
|
|
19067
|
+
`
|
|
19068
|
+
);
|
|
19069
|
+
monitors.command("tools").description("List or describe the monitor tools available to your org.").addHelpText(
|
|
19070
|
+
"after",
|
|
19071
|
+
`
|
|
19072
|
+
Notes:
|
|
19073
|
+
Read-only. Filter the catalog with --provider, --tool, --search, or --limit.
|
|
19074
|
+
Pass --tool to describe a single monitor tool.
|
|
19075
|
+
|
|
19076
|
+
Examples:
|
|
19077
|
+
deepline monitors tools
|
|
19078
|
+
deepline monitors tools --provider theirstack --json
|
|
19079
|
+
deepline monitors tools --tool theirstack_jobs --json
|
|
19080
|
+
`
|
|
19081
|
+
).option("--provider <provider>", "Filter by provider").option("--tool <tool>", "Describe a single monitor tool by id").option("--search <query>", "Search monitor tools by text").option("--limit <n>", "Limit the number of monitor tools returned").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleMonitorsTools);
|
|
19082
|
+
monitors.command("check <definition>").description("Validate a monitor definition without deploying it.").addHelpText(
|
|
19083
|
+
"after",
|
|
19084
|
+
`
|
|
19085
|
+
Notes:
|
|
19086
|
+
Read-only validation. <definition> is a JSON object with key, tool, payload,
|
|
19087
|
+
and optional controls. Does not deploy or spend credits.
|
|
19088
|
+
|
|
19089
|
+
Examples:
|
|
19090
|
+
deepline monitors check '{"key":"my-monitor","tool":"theirstack_jobs","payload":{}}'
|
|
19091
|
+
`
|
|
19092
|
+
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleMonitorsCheck);
|
|
19093
|
+
monitors.command("deploy <definition>").description("Deploy a monitor from a definition.").addHelpText(
|
|
19094
|
+
"after",
|
|
19095
|
+
`
|
|
19096
|
+
Notes:
|
|
19097
|
+
Mutates workspace state and may spend Deepline credits. <definition> is a JSON
|
|
19098
|
+
object with key, tool, payload, and optional controls.
|
|
19099
|
+
|
|
19100
|
+
Examples:
|
|
19101
|
+
deepline monitors deploy '{"key":"my-monitor","tool":"theirstack_jobs","payload":{}}'
|
|
19102
|
+
`
|
|
19103
|
+
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleMonitorsDeploy);
|
|
19104
|
+
monitors.command("reactivate <key>").description("Reactivate a previously disabled deployed monitor.").addHelpText(
|
|
19105
|
+
"after",
|
|
19106
|
+
`
|
|
19107
|
+
Notes:
|
|
19108
|
+
Mutates workspace state and may spend Deepline credits.
|
|
19109
|
+
|
|
19110
|
+
Examples:
|
|
19111
|
+
deepline monitors reactivate my-monitor --json
|
|
19112
|
+
`
|
|
19113
|
+
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleReactivate);
|
|
19114
|
+
const deployed = monitors.command("deployed").description("List and manage your deployed monitors.").addHelpText(
|
|
19115
|
+
"after",
|
|
19116
|
+
`
|
|
19117
|
+
Notes:
|
|
19118
|
+
With no subcommand, lists deployed monitors. Use get/update/delete to manage a
|
|
19119
|
+
single monitor by its public key.
|
|
19120
|
+
|
|
19121
|
+
Examples:
|
|
19122
|
+
deepline monitors deployed --json
|
|
19123
|
+
deepline monitors deployed --status all --json
|
|
19124
|
+
deepline monitors deployed get my-monitor --json
|
|
19125
|
+
`
|
|
19126
|
+
).option("--status <status>", 'Filter by monitor status (or "all")').option("--limit <n>", "Limit the number of deployed monitors returned").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleDeployedList);
|
|
19127
|
+
deployed.command("get <key>").description("Show a single deployed monitor by its public key.").addHelpText(
|
|
19128
|
+
"after",
|
|
19129
|
+
`
|
|
19130
|
+
Notes:
|
|
19131
|
+
Read-only.
|
|
19132
|
+
|
|
19133
|
+
Examples:
|
|
19134
|
+
deepline monitors deployed get my-monitor --json
|
|
19135
|
+
`
|
|
19136
|
+
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleDeployedGet);
|
|
19137
|
+
deployed.command("update <key> <patch>").description("Update a deployed monitor by its public key.").addHelpText(
|
|
19138
|
+
"after",
|
|
19139
|
+
`
|
|
19140
|
+
Notes:
|
|
19141
|
+
Mutates workspace state. <patch> is a JSON object of fields to update.
|
|
19142
|
+
|
|
19143
|
+
Examples:
|
|
19144
|
+
deepline monitors deployed update my-monitor '{"controls":{"enabled":false}}' --json
|
|
19145
|
+
`
|
|
19146
|
+
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleDeployedUpdate);
|
|
19147
|
+
deployed.command("delete <key>").description("Delete a deployed monitor by its public key.").addHelpText(
|
|
19148
|
+
"after",
|
|
19149
|
+
`
|
|
19150
|
+
Notes:
|
|
19151
|
+
Mutates workspace state. By default deprovisions the upstream provider
|
|
19152
|
+
resource; pass --local-only to remove only the Deepline-managed record.
|
|
19153
|
+
|
|
19154
|
+
Examples:
|
|
19155
|
+
deepline monitors deployed delete my-monitor --json
|
|
19156
|
+
deepline monitors deployed delete my-monitor --local-only --json
|
|
19157
|
+
`
|
|
19158
|
+
).option(
|
|
19159
|
+
"--local-only",
|
|
19160
|
+
"Remove only the Deepline-managed record, leaving the upstream resource"
|
|
19161
|
+
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(handleDeployedDelete);
|
|
19162
|
+
}
|
|
19163
|
+
|
|
18716
19164
|
// src/cli/commands/org.ts
|
|
18717
19165
|
async function fetchOrganizations(http, apiKey) {
|
|
18718
19166
|
return http.post("/api/v2/auth/cli/organizations", { api_key: apiKey });
|
|
@@ -23758,6 +24206,7 @@ Exit codes:
|
|
|
23758
24206
|
registerWorkflowCommands(program);
|
|
23759
24207
|
registerSecretsCommands(program);
|
|
23760
24208
|
registerBillingCommands(program);
|
|
24209
|
+
registerMonitorsCommands(program);
|
|
23761
24210
|
registerOrgCommands(program);
|
|
23762
24211
|
registerEnrichCommand(program);
|
|
23763
24212
|
registerCsvCommands(program);
|