@gravity-rail/cli 6.1.0 → 8.0.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/lib.js CHANGED
@@ -47,7 +47,7 @@ import {
47
47
  selectFromList,
48
48
  stderr,
49
49
  unwrapItems
50
- } from "./chunk-HTPFRSPP.js";
50
+ } from "./chunk-YKDH3GYW.js";
51
51
 
52
52
  // src/lib/args.ts
53
53
  var PAGINATION_ARGS = [
@@ -12815,6 +12815,8 @@ ENVELOPE (POST /queries/{validate,preview,run} body: {"query": <envelope>, "mode
12815
12815
  "sort": [{"field": "...", "dir": "asc"|"desc"}], // max 3
12816
12816
  "limit": 1..500, // default 50
12817
12817
  "cursor": "...", // page token from a prior run
12818
+ "timezone": "UTC", // optional; record date reads, day bounds
12819
+ // and bucket truncation
12818
12820
  "aggregate": {...}, // GROUP BY mode; excludes select/sort/computed
12819
12821
  "includeArchived": false,
12820
12822
  "computed": [{"alias": "minutes", <aggregate fields>}]
@@ -13075,6 +13077,11 @@ Relations (relationMatch): ${relations.join(", ")}`);
13075
13077
  name: "mode",
13076
13078
  description: "rows (default), count, or aggregate",
13077
13079
  required: false
13080
+ },
13081
+ {
13082
+ name: "source-fax-id",
13083
+ description: "Limit a Record query to Records produced from this received fax",
13084
+ required: false
13078
13085
  }
13079
13086
  ],
13080
13087
  examples: [
@@ -13083,10 +13090,16 @@ Relations (relationMatch): ${relations.join(", ")}`);
13083
13090
  ],
13084
13091
  handler: async ({ ctx, workspace, args, data }) => {
13085
13092
  const query = coerceQuery(data, args);
13093
+ const rawFaxId = args["source-fax-id"];
13094
+ const sourceFaxId = rawFaxId === void 0 ? void 0 : Number(rawFaxId);
13095
+ if (sourceFaxId !== void 0 && (typeof rawFaxId !== "string" || !/^[0-9]+$/.test(rawFaxId) || !Number.isInteger(sourceFaxId) || sourceFaxId < 1 || sourceFaxId > 2147483647)) {
13096
+ throw new CLIError("--source-fax-id must be a positive 32-bit integer");
13097
+ }
13086
13098
  const result = await requireAuth(ctx).apiClient.runQuery(
13087
13099
  workspace,
13088
13100
  query,
13089
- runMode(args)
13101
+ runMode(args),
13102
+ { sourceFaxId }
13090
13103
  );
13091
13104
  outputSingle(result, ctx);
13092
13105
  }
@@ -13096,6 +13109,7 @@ Relations (relationMatch): ${relations.join(", ")}`);
13096
13109
 
13097
13110
  // src/domains/sites.ts
13098
13111
  import { readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
13112
+ import { AccessLevel } from "@gravity-rail/sdk";
13099
13113
  var COLUMNS13 = [
13100
13114
  COL.id(),
13101
13115
  COL.name(),
@@ -13583,6 +13597,80 @@ var sitesDomain = {
13583
13597
  outputSingle(result, ctx, SOURCE_COLUMNS);
13584
13598
  }
13585
13599
  },
13600
+ {
13601
+ path: ["sites", "sharing", "get"],
13602
+ description: "Show a site's access (private, workspace or public), its audience of Member Roles, and individual grants",
13603
+ verb: "read",
13604
+ revealsSecret: false,
13605
+ requiresWorkspace: true,
13606
+ args: [{ name: "site-id", description: "Site ID", required: true }],
13607
+ examples: [`gr sites sharing get -w $WS --site-id 1`],
13608
+ handler: async ({ ctx, workspace, args }) => {
13609
+ const result = await requireAuth(ctx).apiClient.getSiteSharing(
13610
+ workspace,
13611
+ requireNumber(args, "site-id")
13612
+ );
13613
+ outputSingle(result, ctx);
13614
+ }
13615
+ },
13616
+ {
13617
+ path: ["sites", "sharing", "set"],
13618
+ description: "Set a site's access and audience, keeping its individual grants. --access private|workspace|public. --audience is a comma-separated list of Member Role UUIDs whose Members may use the site and replaces the whole audience; '' clears it, and omitted it is kept. Making a site private needs --audience unless it already is. With workspace, every role is in the audience and --audience is ignored.",
13619
+ verb: "update",
13620
+ revealsSecret: false,
13621
+ requiresWorkspace: true,
13622
+ args: [
13623
+ { name: "site-id", description: "Site ID", required: true },
13624
+ { name: "access", description: "private | workspace | public", required: true },
13625
+ {
13626
+ name: "audience",
13627
+ description: "Comma-separated Member Role UUIDs (replaces the whole audience; omitted keeps it)"
13628
+ }
13629
+ ],
13630
+ examples: [
13631
+ `gr sites sharing set -w $WS --site-id 1 --access private --audience $ADMIN_ROLE_UUID --allow-write`
13632
+ ],
13633
+ handler: async ({ ctx, workspace, args }) => {
13634
+ const ACCESS_LEVELS = {
13635
+ private: AccessLevel.PRIVATE,
13636
+ workspace: AccessLevel.WORKSPACE,
13637
+ public: AccessLevel.PUBLIC
13638
+ };
13639
+ const accessArg = String(args.access ?? "");
13640
+ const access = Object.hasOwn(ACCESS_LEVELS, accessArg) ? ACCESS_LEVELS[accessArg] : void 0;
13641
+ if (!access) {
13642
+ throw new CLIError("--access must be one of: private, workspace, public");
13643
+ }
13644
+ const current = await requireAuth(ctx).apiClient.getSiteSharing(
13645
+ workspace,
13646
+ requireNumber(args, "site-id")
13647
+ );
13648
+ if (access === AccessLevel.PRIVATE && args.audience === void 0 && current.access !== AccessLevel.PRIVATE) {
13649
+ throw new CLIError(
13650
+ "--access private needs --audience: the Member Role UUIDs that keep access, or '' for none"
13651
+ );
13652
+ }
13653
+ const audience = access === AccessLevel.WORKSPACE ? [] : args.audience === void 0 ? current.audience ?? [] : String(args.audience).split(",").map((entry) => entry.trim()).filter(Boolean);
13654
+ const result = await requireAuth(ctx).apiClient.updateSiteSharing(
13655
+ workspace,
13656
+ requireNumber(args, "site-id"),
13657
+ {
13658
+ access,
13659
+ grants: (current.grants ?? []).map((grant) => ({
13660
+ granteeMemberId: grant.granteeMemberId,
13661
+ accessMode: grant.accessMode
13662
+ })),
13663
+ audience
13664
+ }
13665
+ );
13666
+ if (result.access !== access) {
13667
+ throw new CLIError(
13668
+ `The site's access is ${result.access}, not ${access}; check --audience`
13669
+ );
13670
+ }
13671
+ outputSingle(result, ctx);
13672
+ }
13673
+ },
13586
13674
  {
13587
13675
  path: ["sites", "theme-settings", "get"],
13588
13676
  description: "Show the active theme's settings schema, values, and features",
@@ -24539,7 +24627,7 @@ async function resolveDirectoryTrust(opts) {
24539
24627
  return "trusted";
24540
24628
  }
24541
24629
  async function requireDirectoryTrust(opts) {
24542
- const { CLIError: CLIError2 } = await import("./errors-CBQHNNRI.js");
24630
+ const { CLIError: CLIError2 } = await import("./errors-W4SQWN2A.js");
24543
24631
  const dir = path3.resolve(opts.trustDir ?? opts.cwd ?? process.cwd());
24544
24632
  const status = await resolveDirectoryTrust(opts);
24545
24633
  if (status === "trusted") return;
@@ -27962,7 +28050,7 @@ var topLevelCommands = [
27962
28050
  revealsSecret: false,
27963
28051
  args: [{ name: "phone", description: "E.164 phone number (optional; prompts if omitted)" }],
27964
28052
  handler: async (hctx) => {
27965
- const { accountVerifyPhoneCommand } = await import("./account-verify-phone-FUOCVZ55.js");
28053
+ const { accountVerifyPhoneCommand } = await import("./account-verify-phone-R33UATCR.js");
27966
28054
  await accountVerifyPhoneCommand(hctx);
27967
28055
  }
27968
28056
  },