@gravity-rail/cli 0.57.0 → 0.57.1

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.
@@ -3,7 +3,7 @@ import {
3
3
  getEnvironmentConfig,
4
4
  printTable,
5
5
  resolveNonInteractiveAuth
6
- } from "./chunk-CB4K2FBU.js";
6
+ } from "./chunk-462YYQU5.js";
7
7
  import {
8
8
  AuthRequiredError,
9
9
  CLIError
@@ -817,4 +817,4 @@ export {
817
817
  confirmAccountPhoneVerify,
818
818
  getConciergeChatMessages
819
819
  };
820
- //# sourceMappingURL=chunk-TY6HKHOV.js.map
820
+ //# sourceMappingURL=chunk-HNR2SIJP.js.map
@@ -200,4 +200,5 @@ interface ConciergeAppContextPayload {
200
200
  /** Build ConciergeAppContext for AG-UI requests from the CLI. */
201
201
  declare function buildCliConciergeAppContext(): ConciergeAppContextPayload;
202
202
 
203
- export { CredentialsManager as C, DEFAULT_PROFILE as D, type EnvironmentConfig as E, type ProfileSummary as P, REDIRECT_URI as R, WorktreeConfigError as W, type CLICredentials as a, type ConciergeAppContextPayload as b, buildCliConciergeAppContext as c, CALLBACK_PATH as d, CALLBACK_PORT as e, type CheckoutClassification as f, ENVIRONMENTS as g, type EnvironmentConfigOptions as h, classifyCheckout as i, getEnvironmentConfig as j, parsePublishedTarget as p };
203
+ export { DEFAULT_PROFILE as D, REDIRECT_URI as R, WorktreeConfigError as W, CredentialsManager as a, CALLBACK_PATH as c, CALLBACK_PORT as d, ENVIRONMENTS as f, classifyCheckout as h, getEnvironmentConfig as i, buildCliConciergeAppContext as j, parsePublishedTarget as p };
204
+ export type { CLICredentials as C, EnvironmentConfig as E, ProfileSummary as P, ConciergeAppContextPayload as b, CheckoutClassification as e, EnvironmentConfigOptions as g };
@@ -1,5 +1,6 @@
1
- import { a as CLICredentials, E as EnvironmentConfig, C as CredentialsManager, b as ConciergeAppContextPayload } from './cli-client-context-cd5f2JKX.js';
2
- export { d as CALLBACK_PATH, e as CALLBACK_PORT, f as CheckoutClassification, D as DEFAULT_PROFILE, g as ENVIRONMENTS, h as EnvironmentConfigOptions, P as ProfileSummary, R as REDIRECT_URI, W as WorktreeConfigError, i as classifyCheckout, j as getEnvironmentConfig, p as parsePublishedTarget } from './cli-client-context-cd5f2JKX.js';
1
+ import { C as CLICredentials, E as EnvironmentConfig, a as CredentialsManager } from './cli-client-context-NJgZhyfd.js';
2
+ import { ConciergeAppContextPayload } from './lib.js';
3
+ export { c as CALLBACK_PATH, d as CALLBACK_PORT, e as CheckoutClassification, D as DEFAULT_PROFILE, f as ENVIRONMENTS, g as EnvironmentConfigOptions, P as ProfileSummary, R as REDIRECT_URI, W as WorktreeConfigError, h as classifyCheckout, i as getEnvironmentConfig, p as parsePublishedTarget } from './cli-client-context-NJgZhyfd.js';
3
4
 
4
5
  /**
5
6
  * CLI OAuth2 authentication utilities
@@ -336,4 +337,5 @@ declare function getTextDelta(event: AGUIEvent): string | null;
336
337
  */
337
338
  declare function getErrorMessage(event: AGUIEvent): string | null;
338
339
 
339
- export { type ChatMessage as AGUIChatMessage, AGUIClient, type AGUIClientOptions, type AGUIEvent, type AGUIEventType, type AuthResult, CLICredentials, CredentialsManager, EnvironmentConfig, FIRST_PARTY_CLIENT_METADATA_FIELD, type NonInteractiveAuthOptions, type OAuthFlowOptions, type SelectFromListOptions, type SelectResult, clearScreen, fetchFirstPartyClientId, formatTimestamp, generatePKCE, getErrorMessage, getTextDelta, isErrorEvent, isTextContentEvent, openBrowser, parseSseStream, performOAuthFlow, printMessage, printTable, refreshAccessToken, resolveNonInteractiveAuth, resolveOAuthClient, selectFromList, startCallbackServer, wrapText };
340
+ export { AGUIClient, CLICredentials, CredentialsManager, EnvironmentConfig, FIRST_PARTY_CLIENT_METADATA_FIELD, clearScreen, fetchFirstPartyClientId, formatTimestamp, generatePKCE, getErrorMessage, getTextDelta, isErrorEvent, isTextContentEvent, openBrowser, parseSseStream, performOAuthFlow, printMessage, printTable, refreshAccessToken, resolveNonInteractiveAuth, resolveOAuthClient, selectFromList, startCallbackServer, wrapText };
341
+ export type { ChatMessage as AGUIChatMessage, AGUIClientOptions, AGUIEvent, AGUIEventType, AuthResult, NonInteractiveAuthOptions, OAuthFlowOptions, SelectFromListOptions, SelectResult };
package/dist/cli-utils.js CHANGED
@@ -30,7 +30,7 @@ import {
30
30
  selectFromList,
31
31
  startCallbackServer,
32
32
  wrapText
33
- } from "./chunk-CB4K2FBU.js";
33
+ } from "./chunk-462YYQU5.js";
34
34
  export {
35
35
  AGUIClient,
36
36
  CALLBACK_PATH,
package/dist/gr.js CHANGED
@@ -3164,7 +3164,7 @@ var init_libphonenumber_js = __esm({
3164
3164
  }
3165
3165
  });
3166
3166
 
3167
- // ../sdk/dist/chunk-7ABBH5CC.js
3167
+ // ../sdk/dist/chunk-YDC4OVZE.js
3168
3168
  function resourceWorkflowsPath(wid, ...segments) {
3169
3169
  const tail = segments.map((segment) => encodeURIComponent(String(segment))).join("/");
3170
3170
  const base = `w/${encodeURIComponent(wid)}/resource-workflows`;
@@ -4309,6 +4309,7 @@ function bindIntegrationsMethods(target, mondayIntegration, discordBots, slackAp
4309
4309
  target.deleteSlackApp = slackApps.deleteSlackApp.bind(slackApps);
4310
4310
  target.getSlackThreads = slackApps.getSlackThreads.bind(slackApps);
4311
4311
  target.getSlackInstallations = slackApps.getSlackInstallations.bind(slackApps);
4312
+ target.removeSlackAccount = slackApps.removeSlackAccount.bind(slackApps);
4312
4313
  target.removeSlackInstallation = slackApps.removeSlackInstallation.bind(slackApps);
4313
4314
  target.getSlackChannelChoices = slackApps.getSlackChannelChoices.bind(slackApps);
4314
4315
  target.getSlackEntryPoints = slackApps.getSlackEntryPoints.bind(slackApps);
@@ -4759,8 +4760,8 @@ function getRevisionState(workflow, revision) {
4759
4760
  };
4760
4761
  }
4761
4762
  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, ClaimMdApi, ActivityApi, MotdApi, InterventionRequestsApi, MetricsApi, DataReportsApi, 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;
4762
- var init_chunk_7ABBH5CC = __esm({
4763
- "../sdk/dist/chunk-7ABBH5CC.js"() {
4763
+ var init_chunk_YDC4OVZE = __esm({
4764
+ "../sdk/dist/chunk-YDC4OVZE.js"() {
4764
4765
  init_chunk_GCN4OMYU();
4765
4766
  init_libphonenumber_js();
4766
4767
  AbilitiesApi = class extends BaseApiClient {
@@ -7513,6 +7514,11 @@ var init_chunk_7ABBH5CC = __esm({
7513
7514
  }
7514
7515
  };
7515
7516
  SlackAppsApi = class extends BaseApiClient {
7517
+ async removeSlackAccount(wid, appId, credentialId) {
7518
+ return this.fetch(`w/${wid}/app-connections/slack/apps/${appId}/accounts/${credentialId}`, {
7519
+ method: "DELETE"
7520
+ });
7521
+ }
7516
7522
  async removeSlackInstallation(wid, appId, installationId) {
7517
7523
  return this.fetch(
7518
7524
  `w/${wid}/app-connections/slack/apps/${appId}/installations/${installationId}`,
@@ -7531,6 +7537,8 @@ var init_chunk_7ABBH5CC = __esm({
7531
7537
  const params = new URLSearchParams();
7532
7538
  if (options.appId) params.set("appId", String(options.appId));
7533
7539
  if (options.workflowId) params.set("workflowId", String(options.workflowId));
7540
+ if (options.offset !== void 0) params.set("offset", String(options.offset));
7541
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
7534
7542
  return this.fetch(`w/${wid}/app-connections/slack/entry-points?${params}`);
7535
7543
  }
7536
7544
  async connectSlackEntryPoint(wid, data) {
@@ -7549,6 +7557,9 @@ var init_chunk_7ABBH5CC = __esm({
7549
7557
  if (options.sortBy) params.append("sortBy", options.sortBy);
7550
7558
  if (options.sortOrder) params.append("sortOrder", options.sortOrder);
7551
7559
  if (options.search) params.append("search", options.search);
7560
+ if (options.agentId !== void 0) params.set("agentId", String(options.agentId));
7561
+ if (options.workflowId !== void 0) params.set("workflowId", String(options.workflowId));
7562
+ if (options.managed !== void 0) params.set("managed", String(options.managed));
7552
7563
  return this.fetch(
7553
7564
  `w/${wid}/app-connections/slack/apps${params.toString() ? `?${params.toString()}` : ""}`
7554
7565
  );
@@ -7616,6 +7627,8 @@ var init_chunk_7ABBH5CC = __esm({
7616
7627
  const params = new URLSearchParams();
7617
7628
  if (options.page) params.append("page", options.page.toString());
7618
7629
  if (options.pageSize) params.append("pageSize", options.pageSize.toString());
7630
+ if (options.teamId) params.set("teamId", options.teamId);
7631
+ if (options.search) params.set("search", options.search);
7619
7632
  return this.fetch(
7620
7633
  `w/${wid}/app-connections/slack/apps/${appId}/accounts${params.toString() ? `?${params.toString()}` : ""}`
7621
7634
  );
@@ -16519,6 +16532,7 @@ var init_chunk_7ABBH5CC = __esm({
16519
16532
  "getSlackAppAccounts",
16520
16533
  "getSlackApps",
16521
16534
  "getSlackInstallations",
16535
+ "removeSlackAccount",
16522
16536
  "removeSlackInstallation",
16523
16537
  "getSlackThreads",
16524
16538
  "getStepMemberCounts",
@@ -17897,6 +17911,7 @@ var init_chunk_7ABBH5CC = __esm({
17897
17911
  deleteSlackApp;
17898
17912
  getSlackThreads;
17899
17913
  getSlackInstallations;
17914
+ removeSlackAccount;
17900
17915
  removeSlackInstallation;
17901
17916
  getSlackChannelChoices;
17902
17917
  getSlackEntryPoints;
@@ -18381,7 +18396,7 @@ var init_chunk_6KPGCPGW = __esm({
18381
18396
  var SEARCHABLE_EVENT_RULE_SOURCE_FIELDS, ActivityEventType, EntityKind;
18382
18397
  var init_dist = __esm({
18383
18398
  "../sdk/dist/index.js"() {
18384
- init_chunk_7ABBH5CC();
18399
+ init_chunk_YDC4OVZE();
18385
18400
  init_chunk_D5VNVTUQ();
18386
18401
  init_chunk_6KPGCPGW();
18387
18402
  init_chunk_GCN4OMYU();
@@ -21197,7 +21212,7 @@ var init_config = __esm({
21197
21212
 
21198
21213
  // ../../node_modules/graceful-fs/polyfills.js
21199
21214
  var require_polyfills = __commonJS({
21200
- "../../node_modules/graceful-fs/polyfills.js"(exports$1, module) {
21215
+ "../../node_modules/graceful-fs/polyfills.js"(exports, module) {
21201
21216
  var constants = __require("constants");
21202
21217
  var origCwd = process.cwd;
21203
21218
  var cwd = null;
@@ -21485,7 +21500,7 @@ var require_polyfills = __commonJS({
21485
21500
 
21486
21501
  // ../../node_modules/graceful-fs/legacy-streams.js
21487
21502
  var require_legacy_streams = __commonJS({
21488
- "../../node_modules/graceful-fs/legacy-streams.js"(exports$1, module) {
21503
+ "../../node_modules/graceful-fs/legacy-streams.js"(exports, module) {
21489
21504
  var Stream = __require("stream").Stream;
21490
21505
  module.exports = legacy;
21491
21506
  function legacy(fs3) {
@@ -21581,7 +21596,7 @@ var require_legacy_streams = __commonJS({
21581
21596
 
21582
21597
  // ../../node_modules/graceful-fs/clone.js
21583
21598
  var require_clone = __commonJS({
21584
- "../../node_modules/graceful-fs/clone.js"(exports$1, module) {
21599
+ "../../node_modules/graceful-fs/clone.js"(exports, module) {
21585
21600
  module.exports = clone;
21586
21601
  var getPrototypeOf = Object.getPrototypeOf || function(obj) {
21587
21602
  return obj.__proto__;
@@ -21603,7 +21618,7 @@ var require_clone = __commonJS({
21603
21618
 
21604
21619
  // ../../node_modules/graceful-fs/graceful-fs.js
21605
21620
  var require_graceful_fs = __commonJS({
21606
- "../../node_modules/graceful-fs/graceful-fs.js"(exports$1, module) {
21621
+ "../../node_modules/graceful-fs/graceful-fs.js"(exports, module) {
21607
21622
  var fs3 = __require("fs");
21608
21623
  var polyfills = require_polyfills();
21609
21624
  var legacy = require_legacy_streams();
@@ -21973,7 +21988,7 @@ var require_graceful_fs = __commonJS({
21973
21988
 
21974
21989
  // ../../node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js
21975
21990
  var require_retry_operation = __commonJS({
21976
- "../../node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js"(exports$1, module) {
21991
+ "../../node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js"(exports, module) {
21977
21992
  function RetryOperation(timeouts, options) {
21978
21993
  if (typeof options === "boolean") {
21979
21994
  options = { forever: options };
@@ -22104,17 +22119,17 @@ var require_retry_operation = __commonJS({
22104
22119
 
22105
22120
  // ../../node_modules/proper-lockfile/node_modules/retry/lib/retry.js
22106
22121
  var require_retry = __commonJS({
22107
- "../../node_modules/proper-lockfile/node_modules/retry/lib/retry.js"(exports$1) {
22122
+ "../../node_modules/proper-lockfile/node_modules/retry/lib/retry.js"(exports) {
22108
22123
  var RetryOperation = require_retry_operation();
22109
- exports$1.operation = function(options) {
22110
- var timeouts = exports$1.timeouts(options);
22124
+ exports.operation = function(options) {
22125
+ var timeouts = exports.timeouts(options);
22111
22126
  return new RetryOperation(timeouts, {
22112
22127
  forever: options && options.forever,
22113
22128
  unref: options && options.unref,
22114
22129
  maxRetryTime: options && options.maxRetryTime
22115
22130
  });
22116
22131
  };
22117
- exports$1.timeouts = function(options) {
22132
+ exports.timeouts = function(options) {
22118
22133
  if (options instanceof Array) {
22119
22134
  return [].concat(options);
22120
22135
  }
@@ -22143,13 +22158,13 @@ var require_retry = __commonJS({
22143
22158
  });
22144
22159
  return timeouts;
22145
22160
  };
22146
- exports$1.createTimeout = function(attempt, opts) {
22161
+ exports.createTimeout = function(attempt, opts) {
22147
22162
  var random = opts.randomize ? Math.random() + 1 : 1;
22148
22163
  var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
22149
22164
  timeout = Math.min(timeout, opts.maxTimeout);
22150
22165
  return timeout;
22151
22166
  };
22152
- exports$1.wrap = function(obj, options, methods) {
22167
+ exports.wrap = function(obj, options, methods) {
22153
22168
  if (options instanceof Array) {
22154
22169
  methods = options;
22155
22170
  options = null;
@@ -22166,7 +22181,7 @@ var require_retry = __commonJS({
22166
22181
  var method = methods[i];
22167
22182
  var original = obj[method];
22168
22183
  obj[method] = function retryWrapper(original2) {
22169
- var op = exports$1.operation(options);
22184
+ var op = exports.operation(options);
22170
22185
  var args = Array.prototype.slice.call(arguments, 1);
22171
22186
  var callback = args.pop();
22172
22187
  args.push(function(err) {
@@ -22190,14 +22205,14 @@ var require_retry = __commonJS({
22190
22205
 
22191
22206
  // ../../node_modules/proper-lockfile/node_modules/retry/index.js
22192
22207
  var require_retry2 = __commonJS({
22193
- "../../node_modules/proper-lockfile/node_modules/retry/index.js"(exports$1, module) {
22208
+ "../../node_modules/proper-lockfile/node_modules/retry/index.js"(exports, module) {
22194
22209
  module.exports = require_retry();
22195
22210
  }
22196
22211
  });
22197
22212
 
22198
22213
  // ../../node_modules/signal-exit/signals.js
22199
22214
  var require_signals = __commonJS({
22200
- "../../node_modules/signal-exit/signals.js"(exports$1, module) {
22215
+ "../../node_modules/signal-exit/signals.js"(exports, module) {
22201
22216
  module.exports = [
22202
22217
  "SIGABRT",
22203
22218
  "SIGALRM",
@@ -22234,7 +22249,7 @@ var require_signals = __commonJS({
22234
22249
 
22235
22250
  // ../../node_modules/signal-exit/index.js
22236
22251
  var require_signal_exit = __commonJS({
22237
- "../../node_modules/signal-exit/index.js"(exports$1, module) {
22252
+ "../../node_modules/signal-exit/index.js"(exports, module) {
22238
22253
  var process2 = global.process;
22239
22254
  var processOk = function(process3) {
22240
22255
  return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
@@ -22393,7 +22408,7 @@ var require_signal_exit = __commonJS({
22393
22408
 
22394
22409
  // ../../node_modules/proper-lockfile/lib/mtime-precision.js
22395
22410
  var require_mtime_precision = __commonJS({
22396
- "../../node_modules/proper-lockfile/lib/mtime-precision.js"(exports$1, module) {
22411
+ "../../node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
22397
22412
  var cacheSymbol = /* @__PURE__ */ Symbol();
22398
22413
  function probe(file, fs3, callback) {
22399
22414
  const cachedPrecision = fs3[cacheSymbol];
@@ -22434,7 +22449,7 @@ var require_mtime_precision = __commonJS({
22434
22449
 
22435
22450
  // ../../node_modules/proper-lockfile/lib/lockfile.js
22436
22451
  var require_lockfile = __commonJS({
22437
- "../../node_modules/proper-lockfile/lib/lockfile.js"(exports$1, module) {
22452
+ "../../node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
22438
22453
  var path4 = __require("path");
22439
22454
  var fs3 = require_graceful_fs();
22440
22455
  var retry = require_retry2();
@@ -22670,7 +22685,7 @@ var require_lockfile = __commonJS({
22670
22685
 
22671
22686
  // ../../node_modules/proper-lockfile/lib/adapter.js
22672
22687
  var require_adapter = __commonJS({
22673
- "../../node_modules/proper-lockfile/lib/adapter.js"(exports$1, module) {
22688
+ "../../node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
22674
22689
  var fs3 = require_graceful_fs();
22675
22690
  function createSyncFs(fs4) {
22676
22691
  const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
@@ -22734,7 +22749,7 @@ var require_adapter = __commonJS({
22734
22749
 
22735
22750
  // ../../node_modules/proper-lockfile/index.js
22736
22751
  var require_proper_lockfile = __commonJS({
22737
- "../../node_modules/proper-lockfile/index.js"(exports$1, module) {
22752
+ "../../node_modules/proper-lockfile/index.js"(exports, module) {
22738
22753
  var lockfile2 = require_lockfile();
22739
22754
  var { toPromise, toSync, toSyncOptions } = require_adapter();
22740
22755
  async function lock(file, options) {
@@ -22773,7 +22788,7 @@ var init_package = __esm({
22773
22788
  "package.json"() {
22774
22789
  package_default = {
22775
22790
  name: "@gravity-rail/cli",
22776
- version: "0.57.0",
22791
+ version: "0.57.1",
22777
22792
  description: "Gravity Rail CLI \u2014 manage workspaces from the command line",
22778
22793
  type: "module",
22779
22794
  bin: {
@@ -22831,7 +22846,7 @@ var init_package = __esm({
22831
22846
  "@types/proper-lockfile": "^4.1.4",
22832
22847
  jest: "^30.5.2",
22833
22848
  "ts-jest": "29.4.9",
22834
- tsup: "^8.5.1",
22849
+ tsup: "^9.0.0",
22835
22850
  typescript: "^6.0.3",
22836
22851
  undici: "6.28.1"
22837
22852
  }
@@ -36851,6 +36866,7 @@ function bareLabel(ref) {
36851
36866
  return `${ref.kind}:${shortUuid(ref.uuid)}`;
36852
36867
  }
36853
36868
  var MAX_REFS_PER_BATCH = 500;
36869
+ var MAX_WORKSPACES_PER_BATCH = 25;
36854
36870
  function batchResolution(ref, entry) {
36855
36871
  if (entry.status === "resolved") {
36856
36872
  return { label: entry.label || bareLabel(ref), status: "resolved" };
@@ -36945,28 +36961,40 @@ var ActivityRefResolver = class {
36945
36961
  /**
36946
36962
  * One org call per chunk, each carrying whole workspace groups.
36947
36963
  *
36948
- * The server's cap is over the whole request rather than per workspace, and
36949
- * it accepts each workspace at most once per request — so a group larger
36950
- * than the cap is split across requests, and smaller groups ride together
36951
- * until the next one would not fit.
36964
+ * The server caps a grouped request at both 500 refs and 25 workspaces, and
36965
+ * accepts each workspace at most once per request. So a group larger than
36966
+ * the ref cap is split across requests, smaller groups ride together until
36967
+ * the next one would not fit either bound, and no request names a workspace
36968
+ * twice.
36952
36969
  */
36953
36970
  async primeOrg(orgUuid, groups) {
36954
36971
  const chunks = [];
36955
- let current = [];
36956
- let size = 0;
36972
+ let current = /* @__PURE__ */ new Map();
36973
+ let refsInChunk = 0;
36974
+ const flush = () => {
36975
+ if (current.size === 0) return;
36976
+ chunks.push(
36977
+ [...current].map(
36978
+ ([workspaceUuid, refs]) => [workspaceUuid, refs]
36979
+ )
36980
+ );
36981
+ current = /* @__PURE__ */ new Map();
36982
+ refsInChunk = 0;
36983
+ };
36957
36984
  for (const [workspaceUuid, refs] of groups) {
36958
- for (let start = 0; start < refs.length; start += MAX_REFS_PER_BATCH) {
36959
- const slice = refs.slice(start, start + MAX_REFS_PER_BATCH);
36960
- if (size + slice.length > MAX_REFS_PER_BATCH && current.length > 0) {
36961
- chunks.push(current);
36962
- current = [];
36963
- size = 0;
36985
+ for (let start = 0; start < refs.length; ) {
36986
+ if (!current.has(workspaceUuid) && current.size === MAX_WORKSPACES_PER_BATCH) {
36987
+ flush();
36964
36988
  }
36965
- current.push([workspaceUuid, slice]);
36966
- size += slice.length;
36989
+ const room = MAX_REFS_PER_BATCH - refsInChunk;
36990
+ const slice = refs.slice(start, start + room);
36991
+ current.set(workspaceUuid, slice);
36992
+ refsInChunk += slice.length;
36993
+ start += slice.length;
36994
+ if (refsInChunk === MAX_REFS_PER_BATCH) flush();
36967
36995
  }
36968
36996
  }
36969
- if (current.length > 0) chunks.push(current);
36997
+ flush();
36970
36998
  for (const chunk of chunks) {
36971
36999
  const key = `org:${orgUuid}|${chunk.map(
36972
37000
  ([workspaceUuid, refs]) => `${workspaceUuid}:${refs.map((ref) => `${ref.kind}|${ref.uuid}`).sort().join(",")}`