@erdoai/cli 0.120.1 → 0.121.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 +6 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3012,14 +3012,15 @@ ${res.from} to ${res.to} (${res.timezone} days)
3012
3012
  }
3013
3013
  );
3014
3014
  var tokenCmd = program.command("token").description("Manage your API tokens (account-level credentials)");
3015
- tokenCmd.command("create").description("Mint a new API token; the secret is printed ONCE").requiredOption("--name <name>", "a label for the token").option("--expires-days <n>", "days until expiry (default: 30)", (v) => parseInt(v, 10)).addOption(
3015
+ tokenCmd.command("create").description("Mint a new API token; the secret is printed ONCE").requiredOption("--name <name>", "a label for the token").option("--expires-days <n>", "days until expiry (default: 30)", (v) => parseInt(v, 10)).option("--read-only", "mint a read-only token: it can read through the API in any org you belong to, and never write").addOption(
3016
3016
  orgOption("the token's default org (defaults to your active org; must be one you belong to)")
3017
3017
  ).action(async (opts) => {
3018
3018
  try {
3019
3019
  const res = await new ErdoClient().createToken({
3020
3020
  name: opts.name,
3021
3021
  expires_in_days: opts.expiresDays ?? 30,
3022
- organization_id: opts.org
3022
+ organization_id: opts.org,
3023
+ ...opts.readOnly ? { access: "read" } : {}
3023
3024
  });
3024
3025
  process.stderr.write(
3025
3026
  "Store this token now \u2014 it is shown only once and cannot be retrieved again.\n"
@@ -3031,8 +3032,8 @@ id: ${res.id}
3031
3032
  hint: ${res.hint}
3032
3033
  expires: ${res.expires_at}
3033
3034
  default org: ${res.default_org ? `${res.default_org.name} (${res.default_org.id})` : "(none)"}
3034
- This token acts as you in any org you belong to; pass --org on a command to target another.
3035
- `
3035
+ access: ${res.access ?? "full"}
3036
+ ` + (res.access === "read" ? "This token can read as you in any org you belong to and cannot change anything; pass --org on a command to target another.\n" : "This token acts as you in any org you belong to; pass --org on a command to target another.\n")
3036
3037
  );
3037
3038
  } catch (e) {
3038
3039
  fail(e);
@@ -3048,7 +3049,7 @@ tokenCmd.command("list").description("List your API tokens (never shows the secr
3048
3049
  for (const t of tokens) {
3049
3050
  const org2 = t.default_org ? t.default_org.name || t.default_org.id : "-";
3050
3051
  const used = t.last_used_at ?? "never";
3051
- console.log(`${t.id} ${t.name || "-"} ${t.hint} default-org:${org2} expires:${t.expires_at} used:${used}`);
3052
+ console.log(`${t.id} ${t.name || "-"} ${t.hint} access:${t.access ?? "full"} default-org:${org2} expires:${t.expires_at} used:${used}`);
3052
3053
  }
3053
3054
  } catch (e) {
3054
3055
  fail(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.120.1",
3
+ "version": "0.121.0",
4
4
  "description": "Erdo CLI — drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {