@gravity-rail/cli 0.36.0 → 0.36.2

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/gr.js CHANGED
@@ -3230,7 +3230,7 @@ var init_libphonenumber_js = __esm({
3230
3230
  }
3231
3231
  });
3232
3232
 
3233
- // ../sdk/dist/chunk-R3C63RZJ.js
3233
+ // ../sdk/dist/chunk-KPHA7BN5.js
3234
3234
  function sanitizePhoneForBackend(phoneNumber) {
3235
3235
  try {
3236
3236
  let parsed = parsePhoneNumber4(phoneNumber);
@@ -3745,6 +3745,8 @@ function bindMembersMethods(target, members) {
3745
3745
  target.getMemberRelationships = members.getMemberRelationships.bind(members);
3746
3746
  target.createMemberRelationship = members.createMemberRelationship.bind(members);
3747
3747
  target.archiveMemberRelationship = members.archiveMemberRelationship.bind(members);
3748
+ target.listContactPermissions = members.listContactPermissions.bind(members);
3749
+ target.createContactPermission = members.createContactPermission.bind(members);
3748
3750
  }
3749
3751
  function bindWorkspacesMethods(target, workspaces, signupRequests) {
3750
3752
  target.getWorkspaces = workspaces.getWorkspaces.bind(workspaces);
@@ -4613,8 +4615,8 @@ function getRevisionState(workflow, revision) {
4613
4615
  };
4614
4616
  }
4615
4617
  var AbilitiesApi, 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, SalesforceApi, ConnectionSyncApi, HubspotApi, SitesApi, SubscriptionsApi, SupportRequestsApi, CustomersApi, ResellersApi, SupervisorsApi, TasksApi, TemplatesApi, ToolkitsApi, JourneysApi, WorkflowsApi, WorkflowNotesApi, EventRuleObjectType, EventRuleEventType, EventRuleActionType, DriverMode, 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;
4616
- var init_chunk_R3C63RZJ = __esm({
4617
- "../sdk/dist/chunk-R3C63RZJ.js"() {
4618
+ var init_chunk_KPHA7BN5 = __esm({
4619
+ "../sdk/dist/chunk-KPHA7BN5.js"() {
4618
4620
  init_chunk_P2E6LU7I();
4619
4621
  init_libphonenumber_js();
4620
4622
  AbilitiesApi = class extends BaseApiClient {
@@ -8991,6 +8993,18 @@ var init_chunk_R3C63RZJ = __esm({
8991
8993
  { method: "DELETE" }
8992
8994
  );
8993
8995
  }
8996
+ async listContactPermissions(wid, params) {
8997
+ return this.fetch(`w/${wid}/contact-permissions/history`, {
8998
+ method: "POST",
8999
+ body: JSON.stringify(params)
9000
+ });
9001
+ }
9002
+ async createContactPermission(wid, body) {
9003
+ return this.fetch(`w/${wid}/contact-permissions`, {
9004
+ method: "POST",
9005
+ body: JSON.stringify(body)
9006
+ });
9007
+ }
8994
9008
  };
8995
9009
  MondayIntegrationApi = class extends BaseApiClient {
8996
9010
  /**
@@ -12621,6 +12635,8 @@ var init_chunk_R3C63RZJ = __esm({
12621
12635
  EventRuleEventType2["DATA_RECORD_CHANGED"] = "data_record:changed";
12622
12636
  EventRuleEventType2["CHAT_CREATED"] = "chat:created";
12623
12637
  EventRuleEventType2["CHAT_SUMMARY"] = "chat:summary";
12638
+ EventRuleEventType2["MESSAGE_CREATED"] = "message:created";
12639
+ EventRuleEventType2["LINK_CLICKED"] = "link:clicked";
12624
12640
  EventRuleEventType2["CHAT_CALLBACK"] = "chat:callback";
12625
12641
  EventRuleEventType2["MEMBER_UPDATED"] = "member:updated";
12626
12642
  EventRuleEventType2["ROUTINE_TRIGGERED"] = "routine:triggered";
@@ -14186,6 +14202,7 @@ var init_chunk_R3C63RZJ = __esm({
14186
14202
  "createChatLabel",
14187
14203
  "createClientWorkspace",
14188
14204
  "createConnection",
14205
+ "createContactPermission",
14189
14206
  "createCustomTool",
14190
14207
  "createCustomToolkit",
14191
14208
  "createDashboard",
@@ -14751,6 +14768,7 @@ var init_chunk_R3C63RZJ = __esm({
14751
14768
  "listConfluencePages",
14752
14769
  "listConfluenceSpaces",
14753
14770
  "listConnectionMemberFieldKeys",
14771
+ "listContactPermissions",
14754
14772
  "rollbackSiteSource",
14755
14773
  "rotateDocumoFaxCredentials",
14756
14774
  "runQuery",
@@ -15158,6 +15176,8 @@ var init_chunk_R3C63RZJ = __esm({
15158
15176
  getMemberRelationships;
15159
15177
  createMemberRelationship;
15160
15178
  archiveMemberRelationship;
15179
+ listContactPermissions;
15180
+ createContactPermission;
15161
15181
  // Agent Tasks API (operator-facing async sub-agent inspection/cancel)
15162
15182
  getAgentTasks;
15163
15183
  getAgentTask;
@@ -16296,9 +16316,9 @@ var init_chunk_R3C63RZJ = __esm({
16296
16316
  }
16297
16317
  });
16298
16318
 
16299
- // ../sdk/dist/chunk-HRUMZ46V.js
16300
- var init_chunk_HRUMZ46V = __esm({
16301
- "../sdk/dist/chunk-HRUMZ46V.js"() {
16319
+ // ../sdk/dist/chunk-DUEN4F6K.js
16320
+ var init_chunk_DUEN4F6K = __esm({
16321
+ "../sdk/dist/chunk-DUEN4F6K.js"() {
16302
16322
  }
16303
16323
  });
16304
16324
 
@@ -16306,8 +16326,8 @@ var init_chunk_HRUMZ46V = __esm({
16306
16326
  var SEARCHABLE_EVENT_RULE_SOURCE_FIELDS, ActivityEventType, EntityKind;
16307
16327
  var init_dist = __esm({
16308
16328
  "../sdk/dist/index.js"() {
16309
- init_chunk_R3C63RZJ();
16310
- init_chunk_HRUMZ46V();
16329
+ init_chunk_KPHA7BN5();
16330
+ init_chunk_DUEN4F6K();
16311
16331
  init_chunk_P2E6LU7I();
16312
16332
  SEARCHABLE_EVENT_RULE_SOURCE_FIELDS = [
16313
16333
  "taskId",
@@ -16365,7 +16385,9 @@ var init_dist = __esm({
16365
16385
  phone_numberarchived: "phone_number.archived",
16366
16386
  domainlinked: "domain.linked",
16367
16387
  domainverified: "domain.verified",
16368
- configupdated: "config.updated"
16388
+ configupdated: "config.updated",
16389
+ data_recordcreated: "data_record.created",
16390
+ data_recordupdated: "data_record.updated"
16369
16391
  };
16370
16392
  EntityKind = {
16371
16393
  account: "account",
@@ -16397,7 +16419,8 @@ var init_dist = __esm({
16397
16419
  purchase: "purchase",
16398
16420
  subscription: "subscription",
16399
16421
  data_type: "data_type",
16400
- workspace_config: "workspace_config"
16422
+ workspace_config: "workspace_config",
16423
+ data_record: "data_record"
16401
16424
  };
16402
16425
  }
16403
16426
  });
@@ -19730,11 +19753,35 @@ async function refreshAccessToken(envConfig, creds, credentialsManager, env, pro
19730
19753
  return null;
19731
19754
  }
19732
19755
  }
19733
- var FIRST_PARTY_CLIENT_METADATA_FIELD;
19756
+ async function resolveNonInteractiveAuth(options) {
19757
+ const { env, envConfig, credentialsManager, profile } = options;
19758
+ const apiKey = process.env.GRAVITY_RAIL_API_KEY;
19759
+ if (apiKey) {
19760
+ return { accessToken: apiKey };
19761
+ }
19762
+ const profileName = credentialsManager.resolveProfileName(profile, env);
19763
+ const credentials = credentialsManager.load(env, profileName);
19764
+ if (!credentials?.accessToken) return null;
19765
+ const notExpired = !credentials.expiresAt || new Date(credentials.expiresAt) > new Date(Date.now() + ACCESS_TOKEN_EXPIRY_BUFFER_MS);
19766
+ if (notExpired) {
19767
+ return { accessToken: credentials.accessToken, credentials };
19768
+ }
19769
+ const refreshed = await refreshAccessToken(
19770
+ envConfig,
19771
+ credentials,
19772
+ credentialsManager,
19773
+ env,
19774
+ profileName
19775
+ );
19776
+ if (!refreshed?.accessToken) return null;
19777
+ return { accessToken: refreshed.accessToken, credentials: refreshed };
19778
+ }
19779
+ var ACCESS_TOKEN_EXPIRY_BUFFER_MS, FIRST_PARTY_CLIENT_METADATA_FIELD;
19734
19780
  var init_auth = __esm({
19735
19781
  "src/cli-utils/auth.ts"() {
19736
19782
  init_config();
19737
19783
  init_credentials_manager();
19784
+ ACCESS_TOKEN_EXPIRY_BUFFER_MS = 5 * 60 * 1e3;
19738
19785
  FIRST_PARTY_CLIENT_METADATA_FIELD = "gravityrail_first_party_cli_client_id";
19739
19786
  }
19740
19787
  });
@@ -20683,27 +20730,18 @@ function tryBrokerContext(ctx) {
20683
20730
  const apiClient = makeApiClient(void 0, brokerUrl, createSandboxFetchFromEnv());
20684
20731
  return { ...ctx, accessToken: "", apiClient };
20685
20732
  }
20686
- async function tryTokenRefresh(ctx, creds) {
20687
- if (!creds.refreshToken) return null;
20688
- const refreshed = await refreshAccessToken(
20689
- ctx.envConfig,
20690
- creds,
20691
- ctx.credentialsManager,
20692
- ctx.env,
20693
- ctx.profile
20694
- );
20695
- if (!refreshed?.accessToken) return null;
20733
+ function contextWithToken(ctx, auth) {
20696
20734
  const apiClient = makeApiClient(
20697
- refreshed.accessToken,
20735
+ auth.accessToken,
20698
20736
  ctx.envConfig.apiUrl,
20699
20737
  void 0,
20700
- interactiveOrgAuth(ctx)
20738
+ auth.credentials ? interactiveOrgAuth(ctx) : void 0
20701
20739
  );
20702
20740
  return {
20703
20741
  ...ctx,
20704
- accessToken: refreshed.accessToken,
20742
+ accessToken: auth.accessToken,
20705
20743
  apiClient,
20706
- profileWorkspace: refreshed.workspaceUuid ?? creds.workspaceUuid
20744
+ profileWorkspace: auth.credentials?.workspaceUuid
20707
20745
  };
20708
20746
  }
20709
20747
  function requireAuth(ctx) {
@@ -20736,32 +20774,13 @@ async function createPublicAuthenticatedContext(opts) {
20736
20774
  const ctx = createPublicContext(opts);
20737
20775
  const brokerCtx = tryBrokerContext(ctx);
20738
20776
  if (brokerCtx) return brokerCtx;
20739
- const apiKey = process.env.GRAVITY_RAIL_API_KEY;
20740
- if (apiKey) {
20741
- const apiClient = makeApiClient(apiKey, ctx.envConfig.apiUrl);
20742
- return { ...ctx, accessToken: apiKey, apiClient };
20743
- }
20744
- const creds = ctx.credentialsManager.load(ctx.env, ctx.profile);
20745
- if (creds?.accessToken) {
20746
- const buffer = 5 * 60 * 1e3;
20747
- const notExpired = !creds.expiresAt || new Date(creds.expiresAt) > new Date(Date.now() + buffer);
20748
- if (notExpired) {
20749
- const apiClient = makeApiClient(
20750
- creds.accessToken,
20751
- ctx.envConfig.apiUrl,
20752
- void 0,
20753
- interactiveOrgAuth(ctx)
20754
- );
20755
- return {
20756
- ...ctx,
20757
- accessToken: creds.accessToken,
20758
- apiClient,
20759
- profileWorkspace: creds.workspaceUuid
20760
- };
20761
- }
20762
- const refreshed = await tryTokenRefresh(ctx, creds);
20763
- if (refreshed) return refreshed;
20764
- }
20777
+ const auth = await resolveNonInteractiveAuth({
20778
+ env: ctx.env,
20779
+ envConfig: ctx.envConfig,
20780
+ credentialsManager: ctx.credentialsManager,
20781
+ profile: ctx.profile
20782
+ });
20783
+ if (auth) return contextWithToken(ctx, auth);
20765
20784
  throw new AuthRequiredError();
20766
20785
  }
20767
20786
  var init_context = __esm({
@@ -23819,7 +23838,14 @@ var workflowsDomain = {
23819
23838
  supportsCascade: true,
23820
23839
  archiveMethod: "archiveWorkflow",
23821
23840
  unarchiveMethod: "unarchiveWorkflow",
23822
- columns: COLUMNS5
23841
+ columns: COLUMNS5,
23842
+ // `GET /workflows` is a `PaginatedResponse` (pageSize default 100, max
23843
+ // 500 — lib/routes/workspace/workflows/list.py). Without this opt-in the
23844
+ // command exposes no `--page` / `--all`, so a caller reading the list
23845
+ // sees page 1 only and cannot tell: the truncation notice, when it is
23846
+ // printed at all, goes to stderr. A workspace with more than 100
23847
+ // workflows then yields a silently short inventory.
23848
+ paginationSupport: "full"
23823
23849
  }),
23824
23850
  // Clone
23825
23851
  {
@@ -24791,13 +24817,42 @@ function renderImportPlan(projection) {
24791
24817
  return lines.join("\n") + "\n";
24792
24818
  }
24793
24819
 
24820
+ // src/lib/workspace-sync/progress.ts
24821
+ init_output();
24822
+ async function withTransferProgress(stage, workspaceUuid, operation, options = {}) {
24823
+ const started = performance.now();
24824
+ const elapsed = () => Math.floor((performance.now() - started) / 1e3);
24825
+ const label = `${workspaceUuid}: ${stage}`;
24826
+ stderr2(`${label} started`);
24827
+ const timer = setInterval(() => {
24828
+ stderr2(`${label} waiting (${elapsed()}s elapsed)`);
24829
+ }, 3e4);
24830
+ timer.unref();
24831
+ try {
24832
+ const result2 = await operation();
24833
+ stderr2(`${label} completed (${elapsed()}s elapsed)`);
24834
+ return result2;
24835
+ } catch (error) {
24836
+ if (options.reportFailure !== false) {
24837
+ stderr2(`${label} failed (${elapsed()}s elapsed)`);
24838
+ }
24839
+ throw error;
24840
+ } finally {
24841
+ clearInterval(timer);
24842
+ }
24843
+ }
24844
+
24794
24845
  // src/domains/workspaces.ts
24795
24846
  function archiveBlob(zip) {
24796
24847
  return new Blob([new Uint8Array(zip)]);
24797
24848
  }
24798
24849
  var REAPPLY_EXPORT_EXCLUDE = "channels";
24799
24850
  async function exportTemplateArchive(client, templateUuid) {
24800
- return client.exportWorkspaceZip(templateUuid, void 0, void 0, REAPPLY_EXPORT_EXCLUDE);
24851
+ return withTransferProgress(
24852
+ "template archive",
24853
+ templateUuid,
24854
+ () => client.exportWorkspaceZip(templateUuid, void 0, void 0, REAPPLY_EXPORT_EXCLUDE)
24855
+ );
24801
24856
  }
24802
24857
  async function readBindingsFile(filePath, targets) {
24803
24858
  if (!filePath) return {};
@@ -24879,10 +24934,14 @@ async function reapplyOneTarget(ctx, client, options) {
24879
24934
  const { targetUuid, bindings, planOnly, autoConfirm } = options;
24880
24935
  let projection;
24881
24936
  try {
24882
- const preview = await client.previewWorkspaceImportZip(
24937
+ const preview = await withTransferProgress(
24938
+ "target preview",
24883
24939
  targetUuid,
24884
- archiveBlob(options.archive),
24885
- { intent: "template_reapply", bindings }
24940
+ () => client.previewWorkspaceImportZip(targetUuid, archiveBlob(options.archive), {
24941
+ intent: "template_reapply",
24942
+ bindings
24943
+ }),
24944
+ { reportFailure: false }
24886
24945
  );
24887
24946
  projection = projectImportPlan(preview);
24888
24947
  } catch (err) {
@@ -24924,11 +24983,16 @@ ${renderImportPlan(projection)}`);
24924
24983
  return { target: targetUuid, status: "skipped", code: "not_confirmed", plan: projection };
24925
24984
  }
24926
24985
  try {
24927
- const applied = await client.importWorkspaceZip(targetUuid, archiveBlob(options.archive), {
24928
- intent: "template_reapply",
24929
- expectedPlanFingerprint: projection.planFingerprint,
24930
- bindings
24931
- });
24986
+ const applied = await withTransferProgress(
24987
+ "target apply",
24988
+ targetUuid,
24989
+ () => client.importWorkspaceZip(targetUuid, archiveBlob(options.archive), {
24990
+ intent: "template_reapply",
24991
+ expectedPlanFingerprint: projection.planFingerprint,
24992
+ bindings
24993
+ }),
24994
+ { reportFailure: false }
24995
+ );
24932
24996
  if (applied.status === "noop") {
24933
24997
  return {
24934
24998
  target: targetUuid,
@@ -25421,10 +25485,12 @@ Provisioning started. Watch it come up with:
25421
25485
  const templateUuid = requireArg(hctx, "template");
25422
25486
  const client = ctx.apiClient;
25423
25487
  const archive = await exportTemplateArchive(client, templateUuid);
25424
- const preview = await client.previewWorkspaceImportZip(
25488
+ const preview = await withTransferProgress(
25489
+ "target preview",
25425
25490
  hctx.workspace,
25426
- archiveBlob(archive),
25427
- { intent: "template_reapply" }
25491
+ () => client.previewWorkspaceImportZip(hctx.workspace, archiveBlob(archive), {
25492
+ intent: "template_reapply"
25493
+ })
25428
25494
  );
25429
25495
  const projection = projectImportPlan(preview);
25430
25496
  emitReport(ctx, renderImportPlan(projection), projection);
@@ -31050,7 +31116,8 @@ var NO_UUID_LOOKUP = /* @__PURE__ */ new Set([
31050
31116
  "purchase",
31051
31117
  "import",
31052
31118
  "invoice",
31053
- "workspace_config"
31119
+ "workspace_config",
31120
+ "data_record"
31054
31121
  ]);
31055
31122
  var HYDRATORS = {
31056
31123
  workspace: async ({ client }, ref) => (await client.getWorkspace(ref.uuid)).name,
@@ -43376,7 +43443,7 @@ init_concierge_api();
43376
43443
 
43377
43444
  // package.json
43378
43445
  var package_default = {
43379
- version: "0.36.0"};
43446
+ version: "0.36.2"};
43380
43447
 
43381
43448
  // src/gr.ts
43382
43449
  var VERSION = package_default.version;