@diafunc/cli 0.21.0 → 0.23.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/bin/diafunc.js +3 -3
- package/dist/{chunk-ZCJKBLEW.js → chunk-CBQ5OGX3.js} +2 -2
- package/dist/{chunk-IV75CA5V.js → chunk-DXZN6YJJ.js} +136 -34
- package/dist/chunk-DXZN6YJJ.js.map +1 -0
- package/dist/{chunk-M34533JL.js → chunk-KND3I4AN.js} +2 -2
- package/dist/{chunk-M34533JL.js.map → chunk-KND3I4AN.js.map} +1 -1
- package/dist/src/index.js +2 -2
- package/dist/update-check-PBX3DE56.js +8 -0
- package/package.json +1 -1
- package/dist/chunk-IV75CA5V.js.map +0 -1
- package/dist/update-check-EW6JPLJT.js +0 -8
- /package/dist/{chunk-ZCJKBLEW.js.map → chunk-CBQ5OGX3.js.map} +0 -0
- /package/dist/{update-check-EW6JPLJT.js.map → update-check-PBX3DE56.js.map} +0 -0
package/dist/bin/diafunc.js
CHANGED
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
PromptCancelled,
|
|
5
5
|
createProgram,
|
|
6
6
|
handleError
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-DXZN6YJJ.js";
|
|
8
8
|
import {
|
|
9
9
|
getUpdateNotice
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-CBQ5OGX3.js";
|
|
11
11
|
import {
|
|
12
12
|
package_default
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-KND3I4AN.js";
|
|
14
14
|
|
|
15
15
|
// bin/diafunc.ts
|
|
16
16
|
import chalk2 from "chalk";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KND3I4AN.js";
|
|
4
4
|
|
|
5
5
|
// src/util/update-check.ts
|
|
6
6
|
import * as fs from "fs";
|
|
@@ -72,4 +72,4 @@ async function getUpdateNotice() {
|
|
|
72
72
|
export {
|
|
73
73
|
getUpdateNotice
|
|
74
74
|
};
|
|
75
|
-
//# sourceMappingURL=chunk-
|
|
75
|
+
//# sourceMappingURL=chunk-CBQ5OGX3.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KND3I4AN.js";
|
|
4
4
|
|
|
5
5
|
// src/index.ts
|
|
6
6
|
import chalk37 from "chalk";
|
|
@@ -1642,11 +1642,11 @@ function createAnalysisService(client) {
|
|
|
1642
1642
|
body: request
|
|
1643
1643
|
});
|
|
1644
1644
|
},
|
|
1645
|
-
async
|
|
1645
|
+
async patchInputExclusions(analysisId, request) {
|
|
1646
1646
|
return client.request({
|
|
1647
1647
|
method: "PATCH",
|
|
1648
1648
|
service: SERVICE2,
|
|
1649
|
-
path: `/${encodeURIComponent(analysisId)}/
|
|
1649
|
+
path: `/${encodeURIComponent(analysisId)}/input-exclusions`,
|
|
1650
1650
|
body: request
|
|
1651
1651
|
});
|
|
1652
1652
|
},
|
|
@@ -1691,6 +1691,15 @@ function createAnalysisService(client) {
|
|
|
1691
1691
|
path: `/${encodeURIComponent(analysisId)}/sources`
|
|
1692
1692
|
});
|
|
1693
1693
|
},
|
|
1694
|
+
/** Sets whether a source is read as uploaded, rather than through the reshape its shape suggests. */
|
|
1695
|
+
async updateSource(analysisId, sourceId, changes) {
|
|
1696
|
+
return client.request({
|
|
1697
|
+
method: "PATCH",
|
|
1698
|
+
service: SERVICE2,
|
|
1699
|
+
path: `/${encodeURIComponent(analysisId)}/sources/${encodeURIComponent(sourceId)}`,
|
|
1700
|
+
body: changes
|
|
1701
|
+
});
|
|
1702
|
+
},
|
|
1694
1703
|
async removeSource(analysisId, sourceId) {
|
|
1695
1704
|
return client.request({
|
|
1696
1705
|
method: "DELETE",
|
|
@@ -1698,6 +1707,17 @@ function createAnalysisService(client) {
|
|
|
1698
1707
|
path: `/${encodeURIComponent(analysisId)}/sources/${encodeURIComponent(sourceId)}`
|
|
1699
1708
|
});
|
|
1700
1709
|
},
|
|
1710
|
+
/**
|
|
1711
|
+
* The tables of the analysis's files that do not look like one row per observation, read from their
|
|
1712
|
+
* first rows only. Empty when the data is as it should be.
|
|
1713
|
+
*/
|
|
1714
|
+
async sourceShapes(analysisId) {
|
|
1715
|
+
return client.request({
|
|
1716
|
+
method: "GET",
|
|
1717
|
+
service: SERVICE2,
|
|
1718
|
+
path: `/${encodeURIComponent(analysisId)}/sources/shapes`
|
|
1719
|
+
});
|
|
1720
|
+
},
|
|
1701
1721
|
/** What building from the sources would yield: for `recipe`, or for the platform's proposal when it is null. */
|
|
1702
1722
|
async planSources(analysisId, recipe) {
|
|
1703
1723
|
return client.request({
|
|
@@ -6295,7 +6315,7 @@ var HELP = [
|
|
|
6295
6315
|
];
|
|
6296
6316
|
async function runChatRepl(options) {
|
|
6297
6317
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
6298
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
6318
|
+
const { getUpdateNotice } = await import("./update-check-PBX3DE56.js");
|
|
6299
6319
|
let sessionId = options.session;
|
|
6300
6320
|
let lastReportedSession;
|
|
6301
6321
|
console.log(chalk19.bold("Diafunc chat") + chalk19.dim(" \xB7 /help for commands, /quit to exit"));
|
|
@@ -7602,9 +7622,9 @@ async function promptRunFields(prompter, options) {
|
|
|
7602
7622
|
}
|
|
7603
7623
|
if (hours === void 0) {
|
|
7604
7624
|
hours = await prompter.input({
|
|
7605
|
-
message: "Time
|
|
7625
|
+
message: "Time limit (hours)",
|
|
7606
7626
|
default: depthDefault?.hours,
|
|
7607
|
-
validate: positiveNumber("Time
|
|
7627
|
+
validate: positiveNumber("Time limit")
|
|
7608
7628
|
});
|
|
7609
7629
|
}
|
|
7610
7630
|
if (budget === void 0) {
|
|
@@ -7752,7 +7772,7 @@ function analysisDetails(analysis, endpoint) {
|
|
|
7752
7772
|
dataImport: analysis.dataImport?.message ?? null,
|
|
7753
7773
|
targets: analysis.targets,
|
|
7754
7774
|
targetKinds: analysis.targetKinds && Object.keys(analysis.targetKinds).length > 0 ? analysis.targetKinds : "detected from the data",
|
|
7755
|
-
|
|
7775
|
+
inputExclusions: analysis.inputExclusions,
|
|
7756
7776
|
confirmedInputs: analysis.confirmedInputs,
|
|
7757
7777
|
questions: analysis.questions,
|
|
7758
7778
|
segment: analysis.segment,
|
|
@@ -7783,11 +7803,11 @@ function analysisDetails(analysis, endpoint) {
|
|
|
7783
7803
|
{ key: "dataImport", header: "Data import" },
|
|
7784
7804
|
{ key: "targets", header: "Targets" },
|
|
7785
7805
|
{ key: "targetKinds", header: "Target kinds" },
|
|
7786
|
-
{ key: "
|
|
7806
|
+
{ key: "inputExclusions", header: "Excluded columns" },
|
|
7787
7807
|
{ key: "confirmedInputs", header: "Known before the outcome" },
|
|
7788
7808
|
{ key: "questions", header: "Questions" },
|
|
7789
7809
|
{ key: "segment", header: "Segment" },
|
|
7790
|
-
{ key: "hours", header: "Time
|
|
7810
|
+
{ key: "hours", header: "Time limit" },
|
|
7791
7811
|
{ key: "budget", header: "Credit budget" },
|
|
7792
7812
|
{ key: "constraints", header: "Constraints" },
|
|
7793
7813
|
{ key: "notifyByEmail", header: "Email when done" },
|
|
@@ -7844,13 +7864,16 @@ function outputsText(analysis) {
|
|
|
7844
7864
|
if (more > 0) lines.push(`and ${formatNumber(more)} more`);
|
|
7845
7865
|
return lines.join("\n");
|
|
7846
7866
|
}
|
|
7867
|
+
function errorPercent(error) {
|
|
7868
|
+
return `${formatNumber(Math.round(error * 1e3) / 10)}%`;
|
|
7869
|
+
}
|
|
7847
7870
|
function constraintsText(analysis) {
|
|
7848
7871
|
const parts = [];
|
|
7849
7872
|
if (analysis.minComplexity != null) parts.push(`complexity at least ${formatNumber(analysis.minComplexity)}`);
|
|
7850
7873
|
if (analysis.maxComplexity != null) parts.push(`complexity at most ${formatNumber(analysis.maxComplexity)}`);
|
|
7851
7874
|
if (analysis.targetComplexity != null) parts.push(`aim for complexity ${formatNumber(analysis.targetComplexity)}`);
|
|
7852
7875
|
if (analysis.targetQuality != null) parts.push(`stop at quality ${qualityPercent(analysis.targetQuality)}`);
|
|
7853
|
-
if (analysis.targetError != null) parts.push(`stop at error ${
|
|
7876
|
+
if (analysis.targetError != null) parts.push(`stop at error ${errorPercent(analysis.targetError)}`);
|
|
7854
7877
|
if (analysis.minMilliseconds != null) parts.push(`search at least ${formatDurationPrecise(analysis.minMilliseconds)}`);
|
|
7855
7878
|
return parts.length > 0 ? parts.join(", ") : "none";
|
|
7856
7879
|
}
|
|
@@ -8043,7 +8066,8 @@ var CAUTIONS = /* @__PURE__ */ new Set([
|
|
|
8043
8066
|
"MANY_TO_MANY",
|
|
8044
8067
|
"NO_KEY",
|
|
8045
8068
|
"TOO_LARGE",
|
|
8046
|
-
"HINT_REJECTED"
|
|
8069
|
+
"HINT_REJECTED",
|
|
8070
|
+
"RESHAPE_REFUSED"
|
|
8047
8071
|
]);
|
|
8048
8072
|
function recipeWithChoices(proposal, choices) {
|
|
8049
8073
|
if (proposal.parts.length < 2) return null;
|
|
@@ -8070,6 +8094,50 @@ function recipeWithRowsOf(proposal, rowsOf) {
|
|
|
8070
8094
|
hint: alternative ? `The rows can come from ${rows} or from ${alternative.parts.map((part) => part.label).join(", ")}.` : `These files have one reading: the rows come from ${rows}.`
|
|
8071
8095
|
});
|
|
8072
8096
|
}
|
|
8097
|
+
function sourcesAsUploaded(uploaded, asUploaded) {
|
|
8098
|
+
const chosen = [];
|
|
8099
|
+
for (const name of asUploaded) {
|
|
8100
|
+
const wanted = path7.basename(name).trim().toLowerCase();
|
|
8101
|
+
const matches = uploaded.filter((source) => {
|
|
8102
|
+
const fileName = source.fileName.trim().toLowerCase();
|
|
8103
|
+
return fileName === wanted || labelOf(fileName) === labelOf(wanted);
|
|
8104
|
+
});
|
|
8105
|
+
if (matches.length === 0) {
|
|
8106
|
+
throw new CliError(`--as-uploaded names ${name}, which is not among the files.`, {
|
|
8107
|
+
exitCode: EXIT_USAGE,
|
|
8108
|
+
hint: `The files are: ${uploaded.map((source) => source.fileName).join(", ")}.`
|
|
8109
|
+
});
|
|
8110
|
+
}
|
|
8111
|
+
for (const match of matches) {
|
|
8112
|
+
if (!chosen.includes(match)) chosen.push(match);
|
|
8113
|
+
}
|
|
8114
|
+
}
|
|
8115
|
+
return chosen;
|
|
8116
|
+
}
|
|
8117
|
+
function readsReshaped(recipe) {
|
|
8118
|
+
const parts = [...recipe.parts, ...(recipe.lookups ?? []).flatMap((lookup) => lookup.parts)];
|
|
8119
|
+
return parts.some((part) => (part.reshapes ?? []).length > 0);
|
|
8120
|
+
}
|
|
8121
|
+
async function reshapeSingle(api, analysisId, human) {
|
|
8122
|
+
let plan;
|
|
8123
|
+
try {
|
|
8124
|
+
if ((await api.analysis.sourceShapes(analysisId)).length === 0) return null;
|
|
8125
|
+
plan = await withStatus("Reading how the file should be read", () => api.analysis.planSources(analysisId, null));
|
|
8126
|
+
} catch (error) {
|
|
8127
|
+
if (error instanceof ApiError && error.status >= 400 && error.status < 500 && error.status !== 401 && error.status !== 403) {
|
|
8128
|
+
return null;
|
|
8129
|
+
}
|
|
8130
|
+
throw error;
|
|
8131
|
+
}
|
|
8132
|
+
if (!readsReshaped(plan.recipe)) return null;
|
|
8133
|
+
if (human) {
|
|
8134
|
+
for (const finding of plan.findings) {
|
|
8135
|
+
if (finding.kind === "RESHAPED") detail(finding.message);
|
|
8136
|
+
}
|
|
8137
|
+
hint("The reshape is a function in the analysis's project and can be changed in the Lab. To read the file exactly as it is, add --as-uploaded.");
|
|
8138
|
+
}
|
|
8139
|
+
return withStatus("Building the data from the reshaped file", () => api.analysis.buildSources(analysisId, plan.recipe));
|
|
8140
|
+
}
|
|
8073
8141
|
function planLines(plan) {
|
|
8074
8142
|
const lines = [{
|
|
8075
8143
|
text: `One table of ${plan.rows.toLocaleString("en-US")} rows and ${plan.columns.toLocaleString("en-US")} columns.`,
|
|
@@ -8094,8 +8162,12 @@ async function uploadSeveral(api, analysisId, files, choices, human) {
|
|
|
8094
8162
|
for (const earlier of await api.analysis.listSources(analysisId)) {
|
|
8095
8163
|
await api.analysis.removeSource(analysisId, earlier.sourceId);
|
|
8096
8164
|
}
|
|
8165
|
+
const uploaded = [];
|
|
8097
8166
|
for (const file of files) {
|
|
8098
|
-
await withStatus(`Uploading ${path7.basename(file)}`, () => api.analysis.addSource(analysisId, multipart(file)));
|
|
8167
|
+
uploaded.push(await withStatus(`Uploading ${path7.basename(file)}`, () => api.analysis.addSource(analysisId, multipart(file))));
|
|
8168
|
+
}
|
|
8169
|
+
for (const source of sourcesAsUploaded(uploaded, choices.asUploaded ?? [])) {
|
|
8170
|
+
await api.analysis.updateSource(analysisId, source.sourceId, { asUploaded: true });
|
|
8099
8171
|
}
|
|
8100
8172
|
let other = null;
|
|
8101
8173
|
const plan = await withStatus("Reading the files together", async () => {
|
|
@@ -8114,6 +8186,9 @@ async function uploadSeveral(api, analysisId, files, choices, human) {
|
|
|
8114
8186
|
if (line.caution) warn(line.text);
|
|
8115
8187
|
else detail(line.text);
|
|
8116
8188
|
}
|
|
8189
|
+
if (readsReshaped(plan.recipe)) {
|
|
8190
|
+
hint("A reshape is a function in the analysis's project and can be changed in the Lab. To read a file exactly as it is, add --as-uploaded <file>.");
|
|
8191
|
+
}
|
|
8117
8192
|
if (other) {
|
|
8118
8193
|
hint(`These files can be read two ways. For one row per row of ${other}, add --rows-of ${other}.`);
|
|
8119
8194
|
}
|
|
@@ -8182,6 +8257,18 @@ function namedDepth(options) {
|
|
|
8182
8257
|
if (options.budget?.trim()) depth.budget = options.budget.trim();
|
|
8183
8258
|
return depth;
|
|
8184
8259
|
}
|
|
8260
|
+
var REPORT_TERMS_HELP = `
|
|
8261
|
+
Terms:
|
|
8262
|
+
Quality How well the model predicts on held-out rows, marked down for the size of its
|
|
8263
|
+
formula. 0% is no better than always predicting the average, 100% is exact.
|
|
8264
|
+
While a search runs, the same measure on the training rows.
|
|
8265
|
+
Error How far the predictions lie from the held-out values, as a share of the miss of
|
|
8266
|
+
always predicting the average. 0% is exact.
|
|
8267
|
+
Complexity How long the formula is. A bound limits the formulas the search may return.
|
|
8268
|
+
Generation One round of the search: candidates are varied, measured and selected.
|
|
8269
|
+
|
|
8270
|
+
Every term: https://diafunc.com/documentation/glossary
|
|
8271
|
+
`;
|
|
8185
8272
|
function budgetHoursOf(hours) {
|
|
8186
8273
|
if (hours === null || hours === void 0) return null;
|
|
8187
8274
|
const parsed = Number(hours);
|
|
@@ -8276,10 +8363,7 @@ async function runAnalysis(files, options, cmd) {
|
|
|
8276
8363
|
}
|
|
8277
8364
|
detail(`depth: ${depthLabel(stored)}${created.depthPreselection ? " (the account's starting depth)" : ""}`);
|
|
8278
8365
|
}
|
|
8279
|
-
await sendData(importContext(api, created.analysisId, cmd, "stream"), () => files.length > 1 ? uploadSeveral(api, created.analysisId, files, stackChoices(options), outputFormat === "human") :
|
|
8280
|
-
`Uploading ${path8.basename(file)}`,
|
|
8281
|
-
() => api.analysis.uploadDataMultipart(created.analysisId, multipartFromFile(file))
|
|
8282
|
-
));
|
|
8366
|
+
await sendData(importContext(api, created.analysisId, cmd, "stream"), () => files.length > 1 ? uploadSeveral(api, created.analysisId, files, stackChoices(options, files), outputFormat === "human") : uploadOne(api, created.analysisId, file, asUploadedOf(options.asUploaded, files), outputFormat === "human"));
|
|
8283
8367
|
const columns = await readColumns(api, created.analysisId);
|
|
8284
8368
|
const named = namedColumns(
|
|
8285
8369
|
created.analysisId,
|
|
@@ -8729,14 +8813,35 @@ async function patchColumns(analysisId, given, send, successLabel, cmd) {
|
|
|
8729
8813
|
const columns = resolveColumnArguments(occurrences(given) ?? [], await columnNames(api, analysisId), analysisId);
|
|
8730
8814
|
await patchAndPrint(analysisId, "", () => send(api, columns), successLabel, cmd);
|
|
8731
8815
|
}
|
|
8732
|
-
function
|
|
8816
|
+
function collectAsUploaded(value, previous) {
|
|
8817
|
+
return [...Array.isArray(previous) ? previous : [], value];
|
|
8818
|
+
}
|
|
8819
|
+
var AS_UPLOADED_HELP = "Read a file exactly as it is, without the reshape its shape suggests (a column per year read as a row per year, a header over several rows, several numbers in one cell). Without a file name: every file; repeat the flag for several";
|
|
8820
|
+
function asUploadedOf(asUploaded, files) {
|
|
8821
|
+
if (asUploaded === true) return files;
|
|
8822
|
+
return asUploaded ?? [];
|
|
8823
|
+
}
|
|
8824
|
+
function stackChoices(options, files) {
|
|
8733
8825
|
return {
|
|
8826
|
+
asUploaded: asUploadedOf(options.asUploaded, files),
|
|
8734
8827
|
fileColumn: options.fileColumn !== false,
|
|
8735
8828
|
keepDuplicates: options.keepDuplicates === true,
|
|
8736
8829
|
rowsOf: options.rowsOf,
|
|
8737
8830
|
planOnly: options.planOnly === true
|
|
8738
8831
|
};
|
|
8739
8832
|
}
|
|
8833
|
+
async function uploadOne(api, analysisId, file, asUploaded, human) {
|
|
8834
|
+
const uploaded = await withStatus(
|
|
8835
|
+
`Uploading ${path8.basename(file)}`,
|
|
8836
|
+
() => api.analysis.uploadDataMultipart(analysisId, multipartFromFile(file))
|
|
8837
|
+
);
|
|
8838
|
+
if (isDryRun() || uploaded.dataImport) return uploaded;
|
|
8839
|
+
if (asUploaded.length > 0) {
|
|
8840
|
+
sourcesAsUploaded([{ fileName: path8.basename(file) }], asUploaded);
|
|
8841
|
+
return uploaded;
|
|
8842
|
+
}
|
|
8843
|
+
return await reshapeSingle(api, analysisId, human) ?? uploaded;
|
|
8844
|
+
}
|
|
8740
8845
|
async function uploadData(analysisId, files, options, cmd) {
|
|
8741
8846
|
const api = createApiClient();
|
|
8742
8847
|
const outputFormat = getOutputFormat15(cmd);
|
|
@@ -8748,7 +8853,7 @@ async function uploadData(analysisId, files, options, cmd) {
|
|
|
8748
8853
|
}
|
|
8749
8854
|
const built = await sendData(
|
|
8750
8855
|
ctx,
|
|
8751
|
-
() => uploadSeveral(api, analysisId, files, stackChoices(options), outputFormat === "human")
|
|
8856
|
+
() => uploadSeveral(api, analysisId, files, stackChoices(options, files), outputFormat === "human")
|
|
8752
8857
|
);
|
|
8753
8858
|
if (outputFormat !== "human") {
|
|
8754
8859
|
format({
|
|
@@ -8775,10 +8880,7 @@ async function uploadData(analysisId, files, options, cmd) {
|
|
|
8775
8880
|
throw new CliError(`File not found: ${file}`, { exitCode: EXIT_USAGE });
|
|
8776
8881
|
}
|
|
8777
8882
|
}
|
|
8778
|
-
const uploaded = await sendData(ctx, () => dataUrl ? withStatus(`Uploading from ${dataUrl}`, () => api.analysis.uploadDataUrl(analysisId, { dataUrl })) :
|
|
8779
|
-
`Uploading ${path8.basename(file)}`,
|
|
8780
|
-
() => api.analysis.uploadDataMultipart(analysisId, multipartFromFile(file))
|
|
8781
|
-
));
|
|
8883
|
+
const uploaded = await sendData(ctx, () => dataUrl ? withStatus(`Uploading from ${dataUrl}`, () => api.analysis.uploadDataUrl(analysisId, { dataUrl })) : uploadOne(api, analysisId, file, asUploadedOf(options.asUploaded, files), outputFormat === "human"));
|
|
8782
8884
|
if (isDryRun()) {
|
|
8783
8885
|
hint("Dry run: nothing was uploaded.");
|
|
8784
8886
|
return;
|
|
@@ -8987,7 +9089,7 @@ var COLUMN_LIST_HELP = "one argument each or comma-separated; a name that contai
|
|
|
8987
9089
|
var TARGETS_HELP = `Target column names: repeat the flag or separate them with commas; a name that contains a comma is one flag of its own, or goes in double quotes inside a list`;
|
|
8988
9090
|
function registerAnalyzeCommand(program) {
|
|
8989
9091
|
const analyze = program.command("analyze").description("Run and manage automatic analyses");
|
|
8990
|
-
analyze.command("run", { isDefault: true }).description("Create an analysis from a data file, configure it and run it (the default: `analyze <file>`)").argument("[files...]", "Data file to analyze (CSV, Excel and more than 45 file formats; see `table import-formats`). Several files are combined into one table: files with the same columns are stacked, a file that shares a key adds its columns").option("--name <name>", "Analysis name (asked for, or derived from the filename)").option("--description <text>", "Analysis description").option("--visibility <vis>", "PRIVATE or PUBLIC (default: PRIVATE)").option("--hours <hours>", `Time
|
|
9092
|
+
analyze.command("run", { isDefault: true }).description("Create an analysis from a data file, configure it and run it (the default: `analyze <file>`)").argument("[files...]", "Data file to analyze (CSV, Excel and more than 45 file formats; see `table import-formats`). Several files are combined into one table: files with the same columns are stacked, a file that shares a key adds its columns").option("--name <name>", "Analysis name (asked for, or derived from the filename)").option("--description <text>", "Analysis description").option("--visibility <vis>", "PRIVATE or PUBLIC (default: PRIVATE)").option("--hours <hours>", `Time limit (hours). ${STARTING_DEPTH_RULE}`).option("--budget <credits>", `Credit budget. ${STARTING_DEPTH_RULE}`).option("--targets <columns>", `${TARGETS_HELP} (required when not interactive)`, collectColumns).option("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).option("--segment <name>", "Column to segment the analysis by").option("--introduction <markdown>", "Markdown introduction shown at the top of the notebook").option("--preset <id>", "Apply a saved preset as defaults (explicit flags override it)").option("--no-file-column", "With several files: do not add the column that records the file each row came from").option("--keep-duplicates", "With several files: keep rows that occur in more than one file").option("--rows-of <file>", "With several files that can be read two ways: the file in which one row is one observation").option("--as-uploaded [file]", AS_UPLOADED_HELP, collectAsUploaded).action(async (files, options, cmd) => {
|
|
8991
9093
|
try {
|
|
8992
9094
|
if (files.length === 0) {
|
|
8993
9095
|
analyze.help();
|
|
@@ -9005,14 +9107,14 @@ function registerAnalyzeCommand(program) {
|
|
|
9005
9107
|
handleError(error);
|
|
9006
9108
|
}
|
|
9007
9109
|
});
|
|
9008
|
-
analyze.command("get").description("Show details of an analysis").argument("[id]", "Analysis ID (defaults to the most recent)").option("--full", "Print the introduction in full instead of abbreviating it").action(async (id, options, cmd) => {
|
|
9110
|
+
analyze.command("get").description("Show details of an analysis").argument("[id]", "Analysis ID (defaults to the most recent)").option("--full", "Print the introduction in full instead of abbreviating it").addHelpText("after", REPORT_TERMS_HELP).action(async (id, options, cmd) => {
|
|
9009
9111
|
try {
|
|
9010
9112
|
await getAnalysisDetails(id, options, cmd);
|
|
9011
9113
|
} catch (error) {
|
|
9012
9114
|
handleError(error);
|
|
9013
9115
|
}
|
|
9014
9116
|
});
|
|
9015
|
-
analyze.command("watch").description("Follow the latest run of an analysis live").argument("[id]", "Analysis ID (defaults to the most recent)").action(async (id, _options, cmd) => {
|
|
9117
|
+
analyze.command("watch").description("Follow the latest run of an analysis live").argument("[id]", "Analysis ID (defaults to the most recent)").addHelpText("after", REPORT_TERMS_HELP).action(async (id, _options, cmd) => {
|
|
9016
9118
|
try {
|
|
9017
9119
|
await watchAnalysis(id, cmd);
|
|
9018
9120
|
} catch (error) {
|
|
@@ -9033,7 +9135,7 @@ function registerAnalyzeCommand(program) {
|
|
|
9033
9135
|
reportCommandError(error);
|
|
9034
9136
|
}
|
|
9035
9137
|
});
|
|
9036
|
-
analyze.command("create").description("Create an analysis without uploading data or running it").option("--name <name>", "Analysis name").option("--description <text>", "Analysis description").option("--visibility <vis>", "PRIVATE or PUBLIC", "PRIVATE").option("--hours <hours>", `Time
|
|
9138
|
+
analyze.command("create").description("Create an analysis without uploading data or running it").option("--name <name>", "Analysis name").option("--description <text>", "Analysis description").option("--visibility <vis>", "PRIVATE or PUBLIC", "PRIVATE").option("--hours <hours>", `Time limit (hours). ${STARTING_DEPTH_RULE}`).option("--budget <credits>", `Credit budget. ${STARTING_DEPTH_RULE}`).option("--targets <columns>", TARGETS_HELP, collectColumns).option("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).option("--segment <name>", "Column to segment the analysis by").option("--introduction <markdown>", "Markdown introduction shown at the top of the notebook").action(async (options, cmd) => {
|
|
9037
9139
|
try {
|
|
9038
9140
|
await createAnalysis(options, cmd);
|
|
9039
9141
|
} catch (error) {
|
|
@@ -9101,7 +9203,7 @@ function registerAnalyzeCommand(program) {
|
|
|
9101
9203
|
handleError(error);
|
|
9102
9204
|
}
|
|
9103
9205
|
});
|
|
9104
|
-
analyze.command("hours").description("Set the time
|
|
9206
|
+
analyze.command("hours").description("Set the time limit (hours) for the next run").argument("<id>", "Analysis ID").argument("<hours>", "Time limit (hours), e.g. 4").action(async (id, hours, _options, cmd) => {
|
|
9105
9207
|
try {
|
|
9106
9208
|
await patchAndPrint(
|
|
9107
9209
|
id,
|
|
@@ -9140,12 +9242,12 @@ function registerAnalyzeCommand(program) {
|
|
|
9140
9242
|
handleError(error);
|
|
9141
9243
|
}
|
|
9142
9244
|
});
|
|
9143
|
-
analyze.command("
|
|
9245
|
+
analyze.command("input-exclusions").description("Set the columns every fit leaves out as an input (a single empty string leaves nothing out)").argument("<id>", "Analysis ID").argument("<column...>", `Column names, ${COLUMN_LIST_HELP}`).action(async (id, given, _options, cmd) => {
|
|
9144
9246
|
try {
|
|
9145
9247
|
await patchColumns(
|
|
9146
9248
|
id,
|
|
9147
9249
|
given,
|
|
9148
|
-
(api, columns) => api.analysis.
|
|
9250
|
+
(api, columns) => api.analysis.patchInputExclusions(id, { columns }),
|
|
9149
9251
|
"Columns left out of the fit",
|
|
9150
9252
|
cmd
|
|
9151
9253
|
);
|
|
@@ -9195,7 +9297,7 @@ function registerAnalyzeCommand(program) {
|
|
|
9195
9297
|
handleError(error);
|
|
9196
9298
|
}
|
|
9197
9299
|
});
|
|
9198
|
-
analyze.command("upload").description("Replace the analysis data with a new file (any supported format; see `table import-formats`). An import that takes long is followed until it has finished").argument("<id>", "Analysis ID").argument("[files...]", "Data file to upload (CSV, Excel and more than 45 file formats; see `table import-formats`). Several files are combined into one table: files with the same columns are stacked, a file that shares a key adds its columns").option("--url <url>", "HTTPS URL to fetch the data file from, instead of a file path").option("--no-file-column", "With several files: do not add the column that records the file each row came from").option("--keep-duplicates", "With several files: keep rows that occur in more than one file").option("--rows-of <file>", "With several files that can be read two ways: the file in which one row is one observation").option("--plan-only", "With several files: store them and print how they fit together, without building the table").action(async (id, files, options, cmd) => {
|
|
9300
|
+
analyze.command("upload").description("Replace the analysis data with a new file (any supported format; see `table import-formats`). An import that takes long is followed until it has finished").argument("<id>", "Analysis ID").argument("[files...]", "Data file to upload (CSV, Excel and more than 45 file formats; see `table import-formats`). Several files are combined into one table: files with the same columns are stacked, a file that shares a key adds its columns").option("--url <url>", "HTTPS URL to fetch the data file from, instead of a file path").option("--no-file-column", "With several files: do not add the column that records the file each row came from").option("--keep-duplicates", "With several files: keep rows that occur in more than one file").option("--rows-of <file>", "With several files that can be read two ways: the file in which one row is one observation").option("--as-uploaded [file]", AS_UPLOADED_HELP, collectAsUploaded).option("--plan-only", "With several files: store them and print how they fit together, without building the table").action(async (id, files, options, cmd) => {
|
|
9199
9301
|
try {
|
|
9200
9302
|
await uploadData(id, files, options, cmd);
|
|
9201
9303
|
} catch (error) {
|
|
@@ -9245,7 +9347,7 @@ function registerAnalyzeCommand(program) {
|
|
|
9245
9347
|
handleError(error);
|
|
9246
9348
|
}
|
|
9247
9349
|
});
|
|
9248
|
-
presets.command("save").description("Create a new preset (omit --id) or update an existing one (with --id)").requiredOption("--name <name>", "Preset name").requiredOption("--targets <columns>", TARGETS_HELP, collectColumns).requiredOption("--hours <hours>", "Time
|
|
9350
|
+
presets.command("save").description("Create a new preset (omit --id) or update an existing one (with --id)").requiredOption("--name <name>", "Preset name").requiredOption("--targets <columns>", TARGETS_HELP, collectColumns).requiredOption("--hours <hours>", "Time limit (hours)").requiredOption("--budget <credits>", "Credit budget").option("--question <text>", "A question for the analysis to answer; repeat the flag for several", collectQuestion).option("--segment <name>", "Column to segment the analysis by").option("--id <id>", "Existing preset ID (update mode)").action(async (options, cmd) => {
|
|
9249
9351
|
try {
|
|
9250
9352
|
await savePreset(options, cmd);
|
|
9251
9353
|
} catch (error) {
|
|
@@ -10706,7 +10808,7 @@ function registerShellCommand(program) {
|
|
|
10706
10808
|
});
|
|
10707
10809
|
const api = createApiClient();
|
|
10708
10810
|
const { input: promptInput } = await import("@inquirer/prompts");
|
|
10709
|
-
const { getUpdateNotice } = await import("./update-check-
|
|
10811
|
+
const { getUpdateNotice } = await import("./update-check-PBX3DE56.js");
|
|
10710
10812
|
const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
|
|
10711
10813
|
console.log(chalk32.bold("Diafunc shell") + chalk32.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
|
|
10712
10814
|
console.log(chalk32.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
|
|
@@ -11000,7 +11102,7 @@ var INDEX = { kind: "number", min: 0, integer: true };
|
|
|
11000
11102
|
var BY_COMMAND = {
|
|
11001
11103
|
"analyze segment": { "<name>": { kind: "analysisColumns", multiple: false, allowEmpty: true } },
|
|
11002
11104
|
"analyze targets": { "<column>": { kind: "analysisColumns", multiple: true, allowEmpty: false } },
|
|
11003
|
-
"analyze
|
|
11105
|
+
"analyze input-exclusions": { "<column>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
|
|
11004
11106
|
"analyze confirmed-inputs": { "<column>": { kind: "analysisColumns", multiple: true, allowEmpty: true } },
|
|
11005
11107
|
"analyze questions": { "<question>": TEXT_OR_EMPTY },
|
|
11006
11108
|
"analyze description": { "<text>": TEXT_OR_EMPTY },
|
|
@@ -11756,4 +11858,4 @@ export {
|
|
|
11756
11858
|
PromptCancelled,
|
|
11757
11859
|
createProgram
|
|
11758
11860
|
};
|
|
11759
|
-
//# sourceMappingURL=chunk-
|
|
11861
|
+
//# sourceMappingURL=chunk-DXZN6YJJ.js.map
|