@gravity-rail/cli 0.40.0 → 0.42.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/README.md CHANGED
@@ -680,9 +680,15 @@ pass it as `--expected-generation` to `draft set` or `publish`. Omitting it read
680
680
  the current generation just before the write and only detects changes during
681
681
  that request sequence. The server's refusal details are preserved.
682
682
 
683
- Use `bundles get --bundle <uuid>` or `bundles install --bundle <uuid>` for direct access
684
- to an authorized official solution, including one hidden from `bundles list`.
685
- Private Bundles still require an existing grant or ownership.
683
+ Use `bundles get --bundle <uuid>` or `bundles install --bundle <uuid>` to reach a
684
+ Bundle by UUID without paging `bundles list`. The Bundle must be visible to the
685
+ workspace: it owns the Bundle, or a live grant names it.
686
+
687
+ `bundles grant --to organization --uuid <org-uuid>` shares a published Bundle with
688
+ its publishing organization. `bundles grant --to global` shares it with every
689
+ workspace and requires a superuser account. A `draft set` file may carry
690
+ `"links": [{"label", "url"}]`, up to ten named `https` links published with the
691
+ Bundle; a file without `links` keeps the draft's current links.
686
692
 
687
693
  `bundles get -o json` returns one `{ summary, version }` object; `version` is null
688
694
  before publication. Revocations also return JSON when requested. Full UUIDs in
package/dist/gr.js CHANGED
@@ -3205,7 +3205,7 @@ var init_libphonenumber_js = __esm({
3205
3205
  }
3206
3206
  });
3207
3207
 
3208
- // ../sdk/dist/chunk-ZTUOB4V2.js
3208
+ // ../sdk/dist/chunk-JTOMGNUO.js
3209
3209
  function resourceWorkflowsPath(wid, ...segments) {
3210
3210
  const tail = segments.map((segment) => encodeURIComponent(String(segment))).join("/");
3211
3211
  const base = `w/${encodeURIComponent(wid)}/resource-workflows`;
@@ -4053,7 +4053,7 @@ function bindWorkflowsMethods(target, workflows, workflowNotes, voice, superviso
4053
4053
  target.getWorkflowActivity = workflows.getWorkflowActivity.bind(workflows);
4054
4054
  target.getWorkflowsActivityBatch = workflows.getWorkflowsActivityBatch.bind(workflows);
4055
4055
  target.getWorkflowDiagram = workflows.getWorkflowDiagram.bind(workflows);
4056
- target.getWorkflowThumbnailUrl = workflows.getWorkflowThumbnailUrl.bind(workflows);
4056
+ target.getWorkflowOutline = workflows.getWorkflowOutline.bind(workflows);
4057
4057
  target.createWorkflow = workflows.createWorkflow.bind(workflows);
4058
4058
  target.updateWorkflow = workflows.updateWorkflow.bind(workflows);
4059
4059
  target.getWorkflowDeletionPreview = workflows.getWorkflowDeletionPreview.bind(workflows);
@@ -4524,7 +4524,8 @@ function bindResourceWorkflowsMethods(target, resourceWorkflows) {
4524
4524
  }
4525
4525
  function bindBundlesMethods(target, bundles, resourceWorkflows) {
4526
4526
  bindResourceWorkflowsMethods(target, resourceWorkflows);
4527
- target.getSolutionRelease = bundles.getSolutionRelease.bind(bundles);
4527
+ target.listPublicBundles = bundles.listPublicBundles.bind(bundles);
4528
+ target.getPublicBundle = bundles.getPublicBundle.bind(bundles);
4528
4529
  target.updateBundle = bundles.updateBundle.bind(bundles);
4529
4530
  target.listBundleInstallations = bundles.listBundleInstallations.bind(bundles);
4530
4531
  target.listBundles = bundles.listBundles.bind(bundles);
@@ -4703,8 +4704,8 @@ function getRevisionState(workflow, revision) {
4703
4704
  };
4704
4705
  }
4705
4706
  var AbilitiesApi, ResourceWorkflowsApi, BundlesApi, InstallationsApi, AccessGrantsApi, AgentTasksApi, AgentsApi, AIModelsApi, ApiKeysApi, AppsApi, AssignmentsApi, VoiceApi, AuthApi, BuildersApi, CalendarsApi, CallsApi, CELApi, ChatsApi, ConfluenceApi, CustomToolkitsApi, DataTypesApi, DiscordBotsApi, SlackAppsApi, EventsApi, FeaturesApi, FhirConnectionsApi, InboundFaxStatus, DocumoFaxApi, HealthieApi, FilesApi, InboxesApi, InquiriesApi, AppConnectionsApi, McpServersApi, MemberImportValidationError, MembersApi, MondayIntegrationApi, NotificationRulesApi, OperatorApi, OrgApi, OAuthConnectionsApi, OAuthApi, PhoneNumbersApi, PronunciationsApi, PromptsApi, PersonasApi, QueriesApi, QualificationsApi, ReportsApi, RoutingRulesApi, SalesforceApi, ConnectionSyncApi, HubspotApi, SitesApi, SubscriptionsApi, SupportRequestsApi, CustomersApi, ResellersApi, SupervisorsApi, TasksApi, TemplatesApi, ToolkitsApi, JourneysApi, WorkflowsApi, WorkflowNotesApi, EventRuleObjectType, EventRuleEventType, EventRuleActionType, DriverMode, MEMBER_RELATIONSHIP_KINDS, WorkspaceInvitationsApi, WorkspacesApi, DashboardsApi, DevicesApi, TeamsAppsApi, ExperimentsApi, PatientSyncConnectionsApi, ActivityApi, MotdApi, InterventionRequestsApi, MetricsApi, ProjectsApi, TrackedLinksApi, WORKSPACE_METHOD_NAMES, WORKSPACE_METHOD_NAME_SET, GravityRailClient, WIDGET_SLUGS, CHAT_TYPES, BUILTIN_ASSISTANT_CHAT_TYPES, MEMBER_AGENT_CHAT_TYPES, ActivityGrain, ActivityGroupBy, ActivityOpenItemOrder, ActivityWindowBasis;
4706
- var init_chunk_ZTUOB4V2 = __esm({
4707
- "../sdk/dist/chunk-ZTUOB4V2.js"() {
4707
+ var init_chunk_JTOMGNUO = __esm({
4708
+ "../sdk/dist/chunk-JTOMGNUO.js"() {
4708
4709
  init_chunk_67QXTQVL();
4709
4710
  init_libphonenumber_js();
4710
4711
  AbilitiesApi = class extends BaseApiClient {
@@ -4812,11 +4813,15 @@ var init_chunk_ZTUOB4V2 = __esm({
4812
4813
  }
4813
4814
  };
4814
4815
  BundlesApi = class extends BaseApiClient {
4815
- /** Official solution metadata, independent of the default workspace Library. */
4816
- async getSolutionRelease(slug) {
4817
- return this.fetch(`solutions/${encodeURIComponent(slug)}`);
4816
+ /** Bundles shared with everyone. Needs no session. */
4817
+ async listPublicBundles(params) {
4818
+ return this.fetch(`bundles/public${pageQuery(params)}`);
4818
4819
  }
4819
- /** Read an authorized Bundle by UUID, including official solutions hidden from discovery. */
4820
+ /** The outline of one Bundle shared with everyone. Needs no session; 404 otherwise. */
4821
+ async getPublicBundle(bundleUuid2) {
4822
+ return this.fetch(`bundles/${encodeURIComponent(bundleUuid2)}/public`);
4823
+ }
4824
+ /** Read an authorized Bundle by UUID. */
4820
4825
  async getBundle(wid, bundleUuid2) {
4821
4826
  return this.fetch(bundlesPath(wid, bundleUuid2));
4822
4827
  }
@@ -4901,9 +4906,9 @@ var init_chunk_ZTUOB4V2 = __esm({
4901
4906
  return this.fetch(bundlesPath(wid, bundleUuid2, "grants"));
4902
4907
  }
4903
4908
  /**
4904
- * Share throughout the publisher's organization with organization-admin authority.
4905
- * Workspace-specific and global author grants are refused. Official public
4906
- * solutions use the separate staff approval API.
4909
+ * Share throughout the publisher's organization with organization-admin authority,
4910
+ * or with everyone (`granteeType: "global"`) as a superuser. Workspace-specific
4911
+ * grants are refused.
4907
4912
  */
4908
4913
  async grantBundle(wid, bundleUuid2, data) {
4909
4914
  return this.fetch(bundlesPath(wid, bundleUuid2, "grants"), {
@@ -13038,15 +13043,11 @@ var init_chunk_ZTUOB4V2 = __esm({
13038
13043
  return this.fetch(`w/${wid}/workflows/${id}/diagram${query}`);
13039
13044
  }
13040
13045
  /**
13041
- * Get workflow thumbnail URL.
13042
- * For cross-domain setups, returns a same-origin proxy URL to ensure cookies are sent.
13043
- * For same-origin setups, returns the direct API URL.
13046
+ * The outline a Workflow's diagram is drawn from: its active Tasks, its
13047
+ * start Task, the moves between Tasks and its Ability types.
13044
13048
  */
13045
- getWorkflowThumbnailUrl(wid, id) {
13046
- if (this.isCrossDomain) {
13047
- return `/api/v2/w/${wid}/workflows/${id}/thumbnail`;
13048
- }
13049
- return `${this.baseUrl}/api/v2/w/${wid}/workflows/${id}/thumbnail`;
13049
+ async getWorkflowOutline(wid, id) {
13050
+ return this.fetch(`w/${wid}/workflows/${id}/outline`);
13050
13051
  }
13051
13052
  /** Create a new workflow in a workspace. */
13052
13053
  async createWorkflow(wid, workflow) {
@@ -15673,11 +15674,11 @@ var init_chunk_ZTUOB4V2 = __esm({
15673
15674
  "getWorkflowDeletionPreview",
15674
15675
  "getWorkflowDiagram",
15675
15676
  "getWorkflowNotes",
15677
+ "getWorkflowOutline",
15676
15678
  "getWorkflowRevision",
15677
15679
  "getWorkflowRevisions",
15678
15680
  "getWorkflowTaskAssignmentStats",
15679
15681
  "getWorkflowTemplates",
15680
- "getWorkflowThumbnailUrl",
15681
15682
  "getWorkflows",
15682
15683
  "getWorkflowsActivityBatch",
15683
15684
  "getWorkspace",
@@ -16305,7 +16306,8 @@ var init_chunk_ZTUOB4V2 = __esm({
16305
16306
  updateBundle;
16306
16307
  listBundleInstallations;
16307
16308
  // Bundles API
16308
- getSolutionRelease;
16309
+ listPublicBundles;
16310
+ getPublicBundle;
16309
16311
  listBundles;
16310
16312
  listBundleWorkflowCandidates;
16311
16313
  createBundle;
@@ -16671,7 +16673,7 @@ var init_chunk_ZTUOB4V2 = __esm({
16671
16673
  getWorkflowActivity;
16672
16674
  getWorkflowsActivityBatch;
16673
16675
  getWorkflowDiagram;
16674
- getWorkflowThumbnailUrl;
16676
+ getWorkflowOutline;
16675
16677
  createWorkflow;
16676
16678
  updateWorkflow;
16677
16679
  getWorkflowDeletionPreview;
@@ -17391,7 +17393,7 @@ var init_chunk_6KPGCPGW = __esm({
17391
17393
  var SEARCHABLE_EVENT_RULE_SOURCE_FIELDS, ActivityEventType, EntityKind;
17392
17394
  var init_dist = __esm({
17393
17395
  "../sdk/dist/index.js"() {
17394
- init_chunk_ZTUOB4V2();
17396
+ init_chunk_JTOMGNUO();
17395
17397
  init_chunk_72SWNLVD();
17396
17398
  init_chunk_6KPGCPGW();
17397
17399
  init_chunk_67QXTQVL();
@@ -29404,6 +29406,23 @@ async function readBindings(hctx) {
29404
29406
  }
29405
29407
  return payload;
29406
29408
  }
29409
+ var CREATE_INBOX_ARG = {
29410
+ name: "create-inbox",
29411
+ description: "Comma-separated Inbox slot keys to fill by creating an Inbox (one per installation, named for the Bundle; needs inboxes:write)"
29412
+ };
29413
+ async function readSlotTargets(hctx) {
29414
+ const bindings = await readBindings(hctx);
29415
+ const keys = (optionalString(hctx.args, "create-inbox") ?? "").split(",").map((key) => key.trim()).filter(Boolean);
29416
+ if (keys.length === 0) return bindings;
29417
+ const merged = { ...bindings };
29418
+ for (const key of keys) {
29419
+ if (merged[key]) {
29420
+ throw new CLIError(`--create-inbox "${key}" is also set in --bindings; choose one`);
29421
+ }
29422
+ merged[key] = { kind: "new_inbox" };
29423
+ }
29424
+ return merged;
29425
+ }
29407
29426
  async function guardConflict(run, hint2) {
29408
29427
  try {
29409
29428
  return await run();
@@ -29477,18 +29496,20 @@ var installationCommands = [
29477
29496
  {
29478
29497
  name: "bindings",
29479
29498
  description: "Path to a JSON object mapping slot keys to targets"
29480
- }
29499
+ },
29500
+ CREATE_INBOX_ARG
29481
29501
  ],
29482
29502
  examples: [
29483
29503
  "gr bundles install -w $WID --bundle <bundle-uuid> --allow-write",
29484
- "gr bundles install -w $WID --bundle <bundle-uuid> --bindings bindings.json --allow-write"
29504
+ "gr bundles install -w $WID --bundle <bundle-uuid> --bindings bindings.json --allow-write",
29505
+ "gr bundles install -w $WID --bundle <bundle-uuid> --create-inbox program.inbox --allow-write"
29485
29506
  ],
29486
29507
  handler: async (hctx) => {
29487
29508
  const bundle = requireBundleUuid(hctx);
29488
29509
  const summary = await getBundleSummary(hctx, bundle);
29489
29510
  const version = summary.publishedVersion;
29490
29511
  if (version == null) throw new CLIError("Publish the Bundle before installing it");
29491
- const bindings = await readBindings(hctx);
29512
+ const bindings = await readSlotTargets(hctx);
29492
29513
  const result2 = await guardConflict(
29493
29514
  () => client(hctx).installBundle(hctx.workspace, bundle, {
29494
29515
  version,
@@ -29603,6 +29624,7 @@ var installationCommands = [
29603
29624
  name: "bindings",
29604
29625
  description: "Path to a JSON object mapping new slot keys to targets"
29605
29626
  },
29627
+ CREATE_INBOX_ARG,
29606
29628
  { name: "preview", description: "Show what would change and write nothing", isFlag: true }
29607
29629
  ],
29608
29630
  examples: [
@@ -29619,7 +29641,7 @@ var installationCommands = [
29619
29641
  );
29620
29642
  return;
29621
29643
  }
29622
- const bindings = await readBindings(hctx);
29644
+ const bindings = await readSlotTargets(hctx);
29623
29645
  const result2 = await guardConflict(
29624
29646
  () => client(hctx).upgradeInstallation(hctx.workspace, uuid, {
29625
29647
  toVersion: to,
@@ -29661,17 +29683,17 @@ var installationCommands = [
29661
29683
  INSTALLATION_ARG,
29662
29684
  {
29663
29685
  name: "bindings",
29664
- description: "Path to a JSON object mapping slot keys to targets",
29665
- required: true
29666
- }
29686
+ description: "Path to a JSON object mapping slot keys to targets"
29687
+ },
29688
+ CREATE_INBOX_ARG
29667
29689
  ],
29668
29690
  examples: [
29669
29691
  "gr bundles bind -w $WID --installation <installation-uuid> --bindings bindings.json --allow-write"
29670
29692
  ],
29671
29693
  handler: async (hctx) => {
29672
- const bindings = await readBindings(hctx);
29694
+ const bindings = await readSlotTargets(hctx);
29673
29695
  if (!bindings || Object.keys(bindings).length === 0) {
29674
- throw new CLIError("--bindings must name at least one slot");
29696
+ throw new CLIError("--bindings or --create-inbox must name at least one slot");
29675
29697
  }
29676
29698
  const result2 = await guardConflict(
29677
29699
  () => client(hctx).bindInstallationSlots(hctx.workspace, installationUuid(hctx), {
@@ -29760,6 +29782,18 @@ function parseDraftItems(payload) {
29760
29782
  });
29761
29783
  return items;
29762
29784
  }
29785
+ function parseDraftLinks(payload) {
29786
+ const links = payload.links;
29787
+ if (links === void 0) return void 0;
29788
+ if (!Array.isArray(links)) throw new CLIError('"links" must be an array');
29789
+ links.forEach((link, index) => {
29790
+ const record2 = link;
29791
+ if (typeof record2 !== "object" || record2 === null || typeof record2.label !== "string" || typeof record2.url !== "string") {
29792
+ throw new CLIError(`links[${index}] needs string "label" and "url"`);
29793
+ }
29794
+ });
29795
+ return links;
29796
+ }
29763
29797
  async function currentGeneration(hctx, uuid) {
29764
29798
  const expected2 = optionalNumber(hctx.args, "expected-generation");
29765
29799
  if (expected2 !== void 0) {
@@ -29835,6 +29869,14 @@ Draft generation: ${version.draftGeneration}
29835
29869
  hctx.ctx,
29836
29870
  ITEM_COLUMNS
29837
29871
  );
29872
+ if (version.links?.length) {
29873
+ process.stdout.write(
29874
+ `
29875
+ Links:
29876
+ ${version.links.map((link) => ` ${link.label}: ${link.url}`).join("\n")}
29877
+ `
29878
+ );
29879
+ }
29838
29880
  if (version.releaseNotes) {
29839
29881
  process.stdout.write(`
29840
29882
  Release notes:
@@ -30004,7 +30046,7 @@ var bundlesDomain = {
30004
30046
  },
30005
30047
  {
30006
30048
  path: ["bundles", "draft", "set"],
30007
- description: 'Replace draft items from {"items": [...]}; use --expected-generation from draft get to protect edits.',
30049
+ description: 'Replace draft items from {"items": [...]}; an optional "links": [{"label", "url"}] replaces the draft links. Use --expected-generation from draft get to protect edits.',
30008
30050
  requiresWorkspace: true,
30009
30051
  mutates: true,
30010
30052
  args: [BUNDLE_ARG, GENERATION_ARG],
@@ -30013,11 +30055,13 @@ var bundlesDomain = {
30013
30055
  ],
30014
30056
  handler: async (hctx) => {
30015
30057
  const items = parseDraftItems(hctx.data);
30058
+ const links = parseDraftLinks(hctx.data);
30016
30059
  const uuid = bundleUuid(hctx);
30017
30060
  const expectedGeneration = await currentGeneration(hctx, uuid);
30018
30061
  const result2 = await client2(hctx).replaceBundleDraft(hctx.workspace, uuid, {
30019
30062
  expectedGeneration,
30020
- items
30063
+ items,
30064
+ ...links ? { links } : {}
30021
30065
  });
30022
30066
  writeVersionDetail(hctx, result2);
30023
30067
  }
@@ -30066,28 +30110,30 @@ var bundlesDomain = {
30066
30110
  },
30067
30111
  {
30068
30112
  path: ["bundles", "grant"],
30069
- description: "Share a published Bundle within its organization with full source visibility",
30113
+ description: "Share a published Bundle with its organization, or with everyone as a superuser",
30070
30114
  requiresWorkspace: true,
30071
30115
  mutates: true,
30072
30116
  args: [
30073
30117
  BUNDLE_ARG,
30074
30118
  ...sharingArgs.filter((arg) => arg.name !== "disclosure").map(
30075
- (arg) => arg.name === "to" ? { ...arg, description: "organization (publishing organization only)" } : arg.name === "uuid" ? { ...arg, description: "Publishing organization UUID", required: true } : arg
30119
+ (arg) => arg.name === "to" ? {
30120
+ ...arg,
30121
+ description: "organization (publishing organization only) | global (everyone; superuser only)"
30122
+ } : arg.name === "uuid" ? {
30123
+ ...arg,
30124
+ description: "Publishing organization UUID (omit with --to global)"
30125
+ } : arg
30076
30126
  )
30077
30127
  ],
30078
30128
  examples: [
30079
- "gr bundles grant -w $WID --allow-write --bundle <bundle-uuid> --to organization --uuid <org-uuid>"
30129
+ "gr bundles grant -w $WID --allow-write --bundle <bundle-uuid> --to organization --uuid <org-uuid>",
30130
+ "gr bundles grant -w $WID --allow-write --bundle <bundle-uuid> --to global"
30080
30131
  ],
30081
30132
  handler: async (hctx) => {
30082
- if (requireString(hctx.args, "to") === "global") {
30083
- throw new CLIError(
30084
- "Bundle sharing is organization-only; official solution approval uses the staff catalog command"
30085
- );
30086
- }
30087
30133
  const request = sharingRequest(hctx.args, "full");
30088
- if (request.granteeType !== "organization") {
30134
+ if (request.granteeType === "workspace") {
30089
30135
  throw new CLIError(
30090
- "Share Bundles with their organization, then install per workspace"
30136
+ "Share Bundles with their organization or with everyone, then install per workspace"
30091
30137
  );
30092
30138
  }
30093
30139
  const bundleRequest = {
@@ -46036,7 +46082,7 @@ init_concierge_api();
46036
46082
 
46037
46083
  // package.json
46038
46084
  var package_default = {
46039
- version: "0.40.0"};
46085
+ version: "0.42.0"};
46040
46086
 
46041
46087
  // src/gr.ts
46042
46088
  var VERSION = package_default.version;