@erdoai/cli 0.174.0 → 0.175.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.
Files changed (2) hide show
  1. package/dist/index.js +16 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7898,6 +7898,22 @@ datasetsCmd.command("create <name>").description(
7898
7898
  fail(e);
7899
7899
  }
7900
7900
  });
7901
+ var datasetViewCmd = datasetsCmd.command("view").description("Dataset views: read-only datasets whose rows are a SQL query over another dataset");
7902
+ datasetViewCmd.command("create <source>").description(
7903
+ "Create a view of <source>: a dataset whose rows are --sql over the source (named `data`), run on every read. Readers see only what the query selects, and the source's default filters always apply underneath. Bind a view, not its source, to a page whose visitors should see only part of the data."
7904
+ ).requiredOption("--name <name>", "the view's name").requiredOption("--sql <sql>", "a single SELECT over the source, which it names data (@file reads it from a file)").option("--description <text>", "what the view shows and who it is for").action(async (source, opts) => {
7905
+ try {
7906
+ const sql = readMaybeFile(opts.sql) ?? "";
7907
+ const result = await new ErdoClient().createDataset({
7908
+ name: opts.name,
7909
+ view: { source_dataset: source, sql },
7910
+ ...opts.description ? { description: opts.description } : {}
7911
+ });
7912
+ console.log(`${result.slug} view of ${source}`);
7913
+ } catch (e) {
7914
+ fail(e);
7915
+ }
7916
+ });
7901
7917
  datasetsCmd.command("ensure <purpose>").description(
7902
7918
  "Create or reuse the one dataset for a purpose and verify its declared producer contract. Refuses legacy splits and incompatible populated datasets instead of choosing silently."
7903
7919
  ).requiredOption("--schema <file>", "JSON file containing { columns: [...] } or a columns array").option("--name <name>", "dataset name when creation is required").option("--description <text>", "dataset description when creation is required").option("--purpose-description <text>", "what writes and reads this purpose").option("--preferred-dataset <slug>", "existing bound dataset slug or id to adopt").option("--reviewed-optional-addition <name>", "producer-reviewed optional column to add atomically; repeat for multiple columns", (value, previous = []) => [...previous, value], []).option("--email-column <name>", "for a leads purpose: which declared column holds the email (default email)").option("--phone-column <name>", "for a leads purpose: which declared column holds the phone (default phone)").action(async (purpose, opts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.174.0",
3
+ "version": "0.175.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {