@firfi/huly-mcp 0.9.3 → 0.10.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.
package/dist/index.cjs CHANGED
@@ -31044,7 +31044,7 @@ var require_utils2 = __commonJS({
31044
31044
  escapeLikeForRegexp: () => escapeLikeForRegexp,
31045
31045
  fillConfiguration: () => fillConfiguration,
31046
31046
  fillDefaults: () => fillDefaults,
31047
- generateId: () => generateId23,
31047
+ generateId: () => generateId24,
31048
31048
  generateUuid: () => generateUuid,
31049
31049
  getBranding: () => getBranding,
31050
31050
  getCurrentAccount: () => getCurrentAccount,
@@ -31105,10 +31105,10 @@ var require_utils2 = __commonJS({
31105
31105
  return toHex(val, 6);
31106
31106
  }
31107
31107
  __name(count3, "count");
31108
- function generateId23(join4 = "") {
31108
+ function generateId24(join4 = "") {
31109
31109
  return timestamp() + join4 + random4 + join4 + count3();
31110
31110
  }
31111
- __name(generateId23, "generateId");
31111
+ __name(generateId24, "generateId");
31112
31112
  function generateUuid() {
31113
31113
  return crypto.randomUUID();
31114
31114
  }
@@ -34077,15 +34077,15 @@ var require_storage = __commonJS({
34077
34077
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
34078
34078
  var storage_exports = {};
34079
34079
  __export2(storage_exports, {
34080
- SortingOrder: () => SortingOrder29,
34080
+ SortingOrder: () => SortingOrder30,
34081
34081
  shouldShowArchived: () => shouldShowArchived
34082
34082
  });
34083
34083
  module2.exports = __toCommonJS2(storage_exports);
34084
- var SortingOrder29 = /* @__PURE__ */ ((SortingOrder210) => {
34084
+ var SortingOrder30 = /* @__PURE__ */ ((SortingOrder210) => {
34085
34085
  SortingOrder210[SortingOrder210["Ascending"] = 1] = "Ascending";
34086
34086
  SortingOrder210[SortingOrder210["Descending"] = -1] = "Descending";
34087
34087
  return SortingOrder210;
34088
- })(SortingOrder29 || {});
34088
+ })(SortingOrder30 || {});
34089
34089
  function shouldShowArchived(query, options) {
34090
34090
  if (options?.showArchived !== void 0) {
34091
34091
  return options.showArchived;
@@ -34588,7 +34588,7 @@ var require_client3 = __commonJS({
34588
34588
  getClient: () => getClient
34589
34589
  });
34590
34590
  module2.exports = __toCommonJS2(client_exports);
34591
- var import_core50 = require_lib4();
34591
+ var import_core51 = require_lib4();
34592
34592
  var import_platform3 = __toESM2(require_lib());
34593
34593
  var import_utils14 = require_utils3();
34594
34594
  function getClient(accountsUrl, token, retryTimeoutMs) {
@@ -34624,7 +34624,7 @@ var require_client3 = __commonJS({
34624
34624
  rpc;
34625
34625
  async getProviders() {
34626
34626
  return await withRetryUntilMaxAttempts(async () => {
34627
- const response = await fetch((0, import_core50.concatLink)(this.url, "/providers"));
34627
+ const response = await fetch((0, import_core51.concatLink)(this.url, "/providers"));
34628
34628
  return await response.json();
34629
34629
  })();
34630
34630
  }
@@ -35279,7 +35279,7 @@ var require_client3 = __commonJS({
35279
35279
  await this.rpc(request2);
35280
35280
  }
35281
35281
  async setCookie() {
35282
- const url4 = (0, import_core50.concatLink)(this.url, "/cookie");
35282
+ const url4 = (0, import_core51.concatLink)(this.url, "/cookie");
35283
35283
  const response = await fetch(url4, { ...this.request, method: "PUT" });
35284
35284
  if (!response.ok) {
35285
35285
  const result = await response.json();
@@ -35289,7 +35289,7 @@ var require_client3 = __commonJS({
35289
35289
  }
35290
35290
  }
35291
35291
  async deleteCookie() {
35292
- const url4 = (0, import_core50.concatLink)(this.url, "/cookie");
35292
+ const url4 = (0, import_core51.concatLink)(this.url, "/cookie");
35293
35293
  const response = await fetch(url4, { ...this.request, method: "DELETE" });
35294
35294
  if (!response.ok) {
35295
35295
  const result = await response.json();
@@ -35568,9 +35568,9 @@ var require_config = __commonJS({
35568
35568
  loadServerConfig: () => loadServerConfig2
35569
35569
  });
35570
35570
  module2.exports = __toCommonJS2(config_exports3);
35571
- var import_core50 = require_lib4();
35571
+ var import_core51 = require_lib4();
35572
35572
  async function loadServerConfig2(url4) {
35573
- const configUrl = (0, import_core50.concatLink)(url4, "/config.json");
35573
+ const configUrl = (0, import_core51.concatLink)(url4, "/config.json");
35574
35574
  const res = await fetch(configUrl, { keepalive: true });
35575
35575
  if (res.ok) {
35576
35576
  return await res.json();
@@ -35656,7 +35656,7 @@ var require_client4 = __commonJS({
35656
35656
  getClient: () => getClient
35657
35657
  });
35658
35658
  module2.exports = __toCommonJS2(client_exports);
35659
- var import_core50 = require_lib4();
35659
+ var import_core51 = require_lib4();
35660
35660
  var import_utils14 = require_utils4();
35661
35661
  function getClient(workspaceId, token, collaboratorUrl) {
35662
35662
  const url4 = collaboratorUrl.replaceAll("wss://", "https://").replace("ws://", "http://");
@@ -35675,7 +35675,7 @@ var require_client4 = __commonJS({
35675
35675
  async rpc(document2, method, payload) {
35676
35676
  const workspace = this.workspace;
35677
35677
  const documentId = (0, import_utils14.encodeDocumentId)(workspace, document2);
35678
- const url4 = (0, import_core50.concatLink)(this.collaboratorUrl, `/rpc/${encodeURIComponent(documentId)}`);
35678
+ const url4 = (0, import_core51.concatLink)(this.collaboratorUrl, `/rpc/${encodeURIComponent(documentId)}`);
35679
35679
  const res = await fetch(url4, {
35680
35680
  method: "POST",
35681
35681
  headers: {
@@ -53242,9 +53242,9 @@ var require_image = __commonJS({
53242
53242
  ImageNode: () => ImageNode
53243
53243
  });
53244
53244
  module2.exports = __toCommonJS2(image_exports);
53245
- var import_core50 = require_dist16();
53245
+ var import_core51 = require_dist16();
53246
53246
  var import_utils14 = require_utils5();
53247
- var ImageNode = import_core50.Node.create({
53247
+ var ImageNode = import_core51.Node.create({
53248
53248
  name: "image",
53249
53249
  addOptions() {
53250
53250
  return {
@@ -53303,7 +53303,7 @@ var require_image = __commonJS({
53303
53303
  "data-type": this.name,
53304
53304
  "data-align": node.attrs.align
53305
53305
  };
53306
- const imgAttributes = (0, import_core50.mergeAttributes)(
53306
+ const imgAttributes = (0, import_core51.mergeAttributes)(
53307
53307
  {
53308
53308
  "data-type": this.name
53309
53309
  },
@@ -53347,9 +53347,9 @@ var require_reference = __commonJS({
53347
53347
  ReferenceNode: () => ReferenceNode
53348
53348
  });
53349
53349
  module2.exports = __toCommonJS2(reference_exports);
53350
- var import_core50 = require_dist16();
53350
+ var import_core51 = require_dist16();
53351
53351
  var import_utils14 = require_utils5();
53352
- var ReferenceNode = import_core50.Node.create({
53352
+ var ReferenceNode = import_core51.Node.create({
53353
53353
  name: "reference",
53354
53354
  group: "inline",
53355
53355
  inline: true,
@@ -53384,7 +53384,7 @@ var require_reference = __commonJS({
53384
53384
  renderHTML({ node, HTMLAttributes }) {
53385
53385
  return [
53386
53386
  "span",
53387
- (0, import_core50.mergeAttributes)(
53387
+ (0, import_core51.mergeAttributes)(
53388
53388
  {
53389
53389
  "data-type": this.name,
53390
53390
  "data-id": node.attrs.id,
@@ -53443,8 +53443,8 @@ var require_emoji = __commonJS({
53443
53443
  EmojiNode: () => EmojiNode
53444
53444
  });
53445
53445
  module2.exports = __toCommonJS2(emoji_exports);
53446
- var import_core50 = require_dist16();
53447
- var EmojiNode = import_core50.Node.create({
53446
+ var import_core51 = require_dist16();
53447
+ var EmojiNode = import_core51.Node.create({
53448
53448
  name: "emoji",
53449
53449
  group: "inline",
53450
53450
  inline: true,
@@ -53484,7 +53484,7 @@ var require_emoji = __commonJS({
53484
53484
  addNodeView() {
53485
53485
  return ({ node, HTMLAttributes }) => {
53486
53486
  const container = document.createElement("span");
53487
- const containerAttributes = (0, import_core50.mergeAttributes)(
53487
+ const containerAttributes = (0, import_core51.mergeAttributes)(
53488
53488
  {
53489
53489
  "data-type": this.name,
53490
53490
  class: "emoji"
@@ -53517,7 +53517,7 @@ var require_emoji = __commonJS({
53517
53517
  if (node.attrs.kind === "image") {
53518
53518
  return [
53519
53519
  "span",
53520
- (0, import_core50.mergeAttributes)(
53520
+ (0, import_core51.mergeAttributes)(
53521
53521
  {
53522
53522
  "data-type": this.name,
53523
53523
  class: "emoji"
@@ -53526,7 +53526,7 @@ var require_emoji = __commonJS({
53526
53526
  ),
53527
53527
  [
53528
53528
  "img",
53529
- (0, import_core50.mergeAttributes)({
53529
+ (0, import_core51.mergeAttributes)({
53530
53530
  "data-type": this.name,
53531
53531
  src: node.attrs.image,
53532
53532
  alt: node.attrs.emoji
@@ -53536,7 +53536,7 @@ var require_emoji = __commonJS({
53536
53536
  }
53537
53537
  return [
53538
53538
  "span",
53539
- (0, import_core50.mergeAttributes)(
53539
+ (0, import_core51.mergeAttributes)(
53540
53540
  {
53541
53541
  "data-type": this.name,
53542
53542
  class: "emoji"
@@ -53844,8 +53844,8 @@ var require_file = __commonJS({
53844
53844
  FileNode: () => FileNode
53845
53845
  });
53846
53846
  module2.exports = __toCommonJS2(file_exports);
53847
- var import_core50 = require_dist16();
53848
- var FileNode = import_core50.Node.create({
53847
+ var import_core51 = require_dist16();
53848
+ var FileNode = import_core51.Node.create({
53849
53849
  name: "file",
53850
53850
  addOptions() {
53851
53851
  return {
@@ -54155,7 +54155,7 @@ var require_codeblock = __commonJS({
54155
54155
  tildeInputRegex: () => tildeInputRegex
54156
54156
  });
54157
54157
  module2.exports = __toCommonJS2(codeblock_exports);
54158
- var import_core50 = require_dist16();
54158
+ var import_core51 = require_dist16();
54159
54159
  var import_extension_code_block = __toESM2(require_dist19());
54160
54160
  var codeBlockOptions = {
54161
54161
  defaultLanguage: "plaintext",
@@ -54201,11 +54201,11 @@ var require_codeblock = __commonJS({
54201
54201
  },
54202
54202
  addInputRules() {
54203
54203
  return [
54204
- (0, import_core50.textblockTypeInputRule)({
54204
+ (0, import_core51.textblockTypeInputRule)({
54205
54205
  find: backtickInputRegex,
54206
54206
  type: this.type
54207
54207
  }),
54208
- (0, import_core50.textblockTypeInputRule)({
54208
+ (0, import_core51.textblockTypeInputRule)({
54209
54209
  find: tildeInputRegex,
54210
54210
  type: this.type
54211
54211
  })
@@ -54241,8 +54241,8 @@ var require_comment = __commonJS({
54241
54241
  CommentNode: () => CommentNode
54242
54242
  });
54243
54243
  module2.exports = __toCommonJS2(comment_exports);
54244
- var import_core50 = require_dist16();
54245
- var CommentNode = import_core50.Node.create({
54244
+ var import_core51 = require_dist16();
54245
+ var CommentNode = import_core51.Node.create({
54246
54246
  name: "comment",
54247
54247
  group: "inline",
54248
54248
  inline: true,
@@ -54288,8 +54288,8 @@ var require_markdown = __commonJS({
54288
54288
  MarkdownNode: () => MarkdownNode
54289
54289
  });
54290
54290
  module2.exports = __toCommonJS2(markdown_exports);
54291
- var import_core50 = require_dist16();
54292
- var MarkdownNode = import_core50.Node.create({
54291
+ var import_core51 = require_dist16();
54292
+ var MarkdownNode = import_core51.Node.create({
54293
54293
  name: "markdown",
54294
54294
  group: "block",
54295
54295
  content: "text*",
@@ -54307,7 +54307,7 @@ var require_markdown = __commonJS({
54307
54307
  renderHTML({ node, HTMLAttributes }) {
54308
54308
  return [
54309
54309
  "pre",
54310
- (0, import_core50.mergeAttributes)({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
54310
+ (0, import_core51.mergeAttributes)({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
54311
54311
  ["code", {}, 0]
54312
54312
  ];
54313
54313
  }
@@ -54341,8 +54341,8 @@ var require_embed = __commonJS({
54341
54341
  EmbedNode: () => EmbedNode
54342
54342
  });
54343
54343
  module2.exports = __toCommonJS2(embed_exports);
54344
- var import_core50 = require_dist16();
54345
- var EmbedNode = import_core50.Node.create({
54344
+ var import_core51 = require_dist16();
54345
+ var EmbedNode = import_core51.Node.create({
54346
54346
  name: "embed",
54347
54347
  addOptions() {
54348
54348
  return {};
@@ -54367,7 +54367,7 @@ var require_embed = __commonJS({
54367
54367
  ];
54368
54368
  },
54369
54369
  renderHTML({ HTMLAttributes }) {
54370
- return ["figure", { "data-type": this.name }, ["iframe", (0, import_core50.mergeAttributes)(HTMLAttributes)]];
54370
+ return ["figure", { "data-type": this.name }, ["iframe", (0, import_core51.mergeAttributes)(HTMLAttributes)]];
54371
54371
  }
54372
54372
  });
54373
54373
  }
@@ -54441,7 +54441,7 @@ var require_noteBase = __commonJS({
54441
54441
  name: () => name
54442
54442
  });
54443
54443
  module2.exports = __toCommonJS2(noteBase_exports);
54444
- var import_core50 = require_dist16();
54444
+ var import_core51 = require_dist16();
54445
54445
  var import_nodes = require_nodes();
54446
54446
  var name = "note";
54447
54447
  var NoteKind = /* @__PURE__ */ ((NoteKind2) => {
@@ -54456,7 +54456,7 @@ var require_noteBase = __commonJS({
54456
54456
  NoteKind2["PrimaryLight"] = "primary-light";
54457
54457
  return NoteKind2;
54458
54458
  })(NoteKind || {});
54459
- var NoteBaseExtension = import_core50.Mark.create({
54459
+ var NoteBaseExtension = import_core51.Mark.create({
54460
54460
  name,
54461
54461
  parseHTML() {
54462
54462
  return [
@@ -54513,9 +54513,9 @@ var require_qmsInlineCommentMark = __commonJS({
54513
54513
  QMSInlineCommentMark: () => QMSInlineCommentMark
54514
54514
  });
54515
54515
  module2.exports = __toCommonJS2(qmsInlineCommentMark_exports);
54516
- var import_core50 = require_dist16();
54516
+ var import_core51 = require_dist16();
54517
54517
  var NAME2 = "node-uuid";
54518
- var QMSInlineCommentMark = import_core50.Mark.create({
54518
+ var QMSInlineCommentMark = import_core51.Mark.create({
54519
54519
  name: NAME2,
54520
54520
  inline: true,
54521
54521
  parseHTML() {
@@ -54560,9 +54560,9 @@ var require_kit = __commonJS({
54560
54560
  mergeKitOptions: () => mergeKitOptions
54561
54561
  });
54562
54562
  module2.exports = __toCommonJS2(kit_exports);
54563
- var import_core50 = require_dist16();
54563
+ var import_core51 = require_dist16();
54564
54564
  function extensionKit(name, fn2) {
54565
- return import_core50.Extension.create({
54565
+ return import_core51.Extension.create({
54566
54566
  name,
54567
54567
  addExtensions() {
54568
54568
  const e = /* @__PURE__ */ __name((extension, options) => {
@@ -61591,9 +61591,9 @@ var require_colors = __commonJS({
61591
61591
  TextColor: () => TextColor
61592
61592
  });
61593
61593
  module2.exports = __toCommonJS2(colors_exports);
61594
- var import_core50 = require_dist16();
61594
+ var import_core51 = require_dist16();
61595
61595
  var import_extension_text_style = require_dist20();
61596
- var BackgroundColor = import_core50.Extension.create({
61596
+ var BackgroundColor = import_core51.Extension.create({
61597
61597
  name: "backgroundColor",
61598
61598
  addOptions() {
61599
61599
  return {
@@ -61634,7 +61634,7 @@ var require_colors = __commonJS({
61634
61634
  };
61635
61635
  }
61636
61636
  });
61637
- var TextColor = import_core50.Extension.create({
61637
+ var TextColor = import_core51.Extension.create({
61638
61638
  name: "textColor",
61639
61639
  addOptions() {
61640
61640
  return {
@@ -61706,10 +61706,10 @@ var require_inlineComment = __commonJS({
61706
61706
  InlineCommentPasteFixPlugin: () => InlineCommentPasteFixPlugin
61707
61707
  });
61708
61708
  module2.exports = __toCommonJS2(inlineComment_exports);
61709
- var import_core50 = require_dist16();
61709
+ var import_core51 = require_dist16();
61710
61710
  var import_model = require_dist10();
61711
61711
  var import_state = require_dist5();
61712
- var InlineCommentMark = import_core50.Mark.create({
61712
+ var InlineCommentMark = import_core51.Mark.create({
61713
61713
  name: "inline-comment",
61714
61714
  excludes: "",
61715
61715
  inclusive: false,
@@ -77233,7 +77233,7 @@ var require_client5 = __commonJS({
77233
77233
  createMarkupOperations: () => createMarkupOperations
77234
77234
  });
77235
77235
  module2.exports = __toCommonJS2(client_exports);
77236
- var import_core50 = require_lib4();
77236
+ var import_core51 = require_lib4();
77237
77237
  var import_collaborator_client2 = require_lib7();
77238
77238
  var import_text4 = require_lib9();
77239
77239
  var import_text_markdown3 = require_lib17();
@@ -77247,8 +77247,8 @@ var require_client5 = __commonJS({
77247
77247
  this.workspace = workspace;
77248
77248
  this.token = token;
77249
77249
  this.config = config3;
77250
- this.refUrl = (0, import_core50.concatLink)(this.url, `/browse?workspace=${workspace}`);
77251
- this.imageUrl = (0, import_core50.concatLink)(this.url, `/files?workspace=${workspace}&file=`);
77250
+ this.refUrl = (0, import_core51.concatLink)(this.url, `/browse?workspace=${workspace}`);
77251
+ this.imageUrl = (0, import_core51.concatLink)(this.url, `/files?workspace=${workspace}&file=`);
77252
77252
  this.collaborator = (0, import_collaborator_client2.getClient)(workspace, token, config3.COLLABORATOR_URL);
77253
77253
  }
77254
77254
  static {
@@ -77258,7 +77258,7 @@ var require_client5 = __commonJS({
77258
77258
  imageUrl;
77259
77259
  refUrl;
77260
77260
  async fetchMarkup(objectClass, objectId, objectAttr, doc, format7) {
77261
- const collabId = (0, import_core50.makeCollabId)(objectClass, objectId, objectAttr);
77261
+ const collabId = (0, import_core51.makeCollabId)(objectClass, objectId, objectAttr);
77262
77262
  const markup = await this.collaborator.getMarkup(collabId, doc);
77263
77263
  const json3 = (0, import_text4.markupToJSON)(markup);
77264
77264
  switch (format7) {
@@ -77287,7 +77287,7 @@ var require_client5 = __commonJS({
77287
77287
  default:
77288
77288
  throw new Error("Unknown content format");
77289
77289
  }
77290
- const collabId = (0, import_core50.makeCollabId)(objectClass, objectId, objectAttr);
77290
+ const collabId = (0, import_core51.makeCollabId)(objectClass, objectId, objectAttr);
77291
77291
  return await this.collaborator.createMarkup(collabId, markup);
77292
77292
  }
77293
77293
  };
@@ -81771,8 +81771,8 @@ var require_connection2 = __commonJS({
81771
81771
  });
81772
81772
  module2.exports = __toCommonJS2(connection_exports);
81773
81773
  var import_analytics = require_lib2();
81774
- var import_client29 = __toESM2(require_lib6());
81775
- var import_core50 = __toESM2(require_lib4());
81774
+ var import_client30 = __toESM2(require_lib6());
81775
+ var import_core51 = __toESM2(require_lib4());
81776
81776
  var import_platform3 = __toESM2(require_lib());
81777
81777
  var import_rpc = require_lib18();
81778
81778
  var import_snappyjs = require_snappyjs();
@@ -81816,7 +81816,7 @@ var require_connection2 = __commonJS({
81816
81816
  const sKey = "session.id." + this.url;
81817
81817
  let sessionId = sessionStorage.getItem(sKey) ?? void 0;
81818
81818
  if (sessionId === void 0) {
81819
- sessionId = (0, import_core50.generateId)();
81819
+ sessionId = (0, import_core51.generateId)();
81820
81820
  console.log("Generate new SessionId", sessionId);
81821
81821
  this.sessionId = sessionId;
81822
81822
  } else {
@@ -81827,7 +81827,7 @@ var require_connection2 = __commonJS({
81827
81827
  sessionStorage.setItem(sKey, sessionId);
81828
81828
  });
81829
81829
  } else {
81830
- this.sessionId = (0, import_core50.generateId)();
81830
+ this.sessionId = (0, import_core51.generateId)();
81831
81831
  }
81832
81832
  this.rpcHandler = opt?.useGlobalRPCHandler === true ? globalRPCHandler : new import_rpc.RPCHandler();
81833
81833
  this.pushHandler(handler);
@@ -81882,7 +81882,7 @@ var require_connection2 = __commonJS({
81882
81882
  }
81883
81883
  if (!this.closed) {
81884
81884
  void this.sendRequest({
81885
- method: import_client29.pingConst,
81885
+ method: import_client30.pingConst,
81886
81886
  params: [],
81887
81887
  once: true,
81888
81888
  handleResult: /* @__PURE__ */ __name(async (result) => {
@@ -81915,7 +81915,7 @@ var require_connection2 = __commonJS({
81915
81915
  }
81916
81916
  }
81917
81917
  isConnected() {
81918
- return this.websocket != null && this.websocket.readyState === import_client29.ClientSocketReadyState.OPEN && this.helloReceived;
81918
+ return this.websocket != null && this.websocket.readyState === import_client30.ClientSocketReadyState.OPEN && this.helloReceived;
81919
81919
  }
81920
81920
  delay = 0;
81921
81921
  onConnectHandlers = [];
@@ -82007,7 +82007,7 @@ var require_connection2 = __commonJS({
82007
82007
  if (resp.id === -1) {
82008
82008
  this.delay = 0;
82009
82009
  if (resp.result?.state === "upgrading") {
82010
- void this.onConnect?.(import_core50.ClientConnectEvent.Maintenance, void 0, resp.result.stats);
82010
+ void this.onConnect?.(import_core51.ClientConnectEvent.Maintenance, void 0, resp.result.stats);
82011
82011
  this.upgrading = true;
82012
82012
  this.delay = 3;
82013
82013
  return;
@@ -82042,7 +82042,7 @@ var require_connection2 = __commonJS({
82042
82042
  v.reconnect?.();
82043
82043
  }
82044
82044
  void this.onConnect?.(
82045
- helloResp.reconnect === true ? import_core50.ClientConnectEvent.Reconnected : import_core50.ClientConnectEvent.Connected,
82045
+ helloResp.reconnect === true ? import_core51.ClientConnectEvent.Reconnected : import_core51.ClientConnectEvent.Connected,
82046
82046
  helloResp.lastTx,
82047
82047
  this.sessionId
82048
82048
  )?.catch((err) => {
@@ -82055,8 +82055,8 @@ var require_connection2 = __commonJS({
82055
82055
  }
82056
82056
  return;
82057
82057
  }
82058
- if (resp.result === import_client29.pingConst) {
82059
- void this.sendRequest({ method: import_client29.pingConst, params: [] }).catch((err) => {
82058
+ if (resp.result === import_client30.pingConst) {
82059
+ void this.sendRequest({ method: import_client30.pingConst, params: [] }).catch((err) => {
82060
82060
  this.ctx.error("failed to send ping", { err });
82061
82061
  });
82062
82062
  return;
@@ -82092,7 +82092,7 @@ var require_connection2 = __commonJS({
82092
82092
  }
82093
82093
  result = result.concat(c.data);
82094
82094
  }
82095
- resp.result = (0, import_core50.toFindResult)(result, total, lookupMap);
82095
+ resp.result = (0, import_core51.toFindResult)(result, total, lookupMap);
82096
82096
  resp.chunk = void 0;
82097
82097
  } else {
82098
82098
  return;
@@ -82136,7 +82136,7 @@ var require_connection2 = __commonJS({
82136
82136
  } else {
82137
82137
  const txArr = Array.isArray(resp.result) ? resp.result : [resp.result];
82138
82138
  for (const tx of txArr) {
82139
- if (tx?._class === import_core50.default.class.TxModelUpgrade) {
82139
+ if (tx?._class === import_core51.default.class.TxModelUpgrade) {
82140
82140
  console.log("Processing upgrade", this.workspace, this.user);
82141
82141
  this.opt?.onUpgrade?.();
82142
82142
  return;
@@ -82148,15 +82148,15 @@ var require_connection2 = __commonJS({
82148
82148
  }
82149
82149
  }
82150
82150
  checkArrayBufferPing(data) {
82151
- if (data.byteLength === import_client29.pingConst.length || data.byteLength === import_client29.pongConst.length) {
82151
+ if (data.byteLength === import_client30.pingConst.length || data.byteLength === import_client30.pongConst.length) {
82152
82152
  const text = new TextDecoder().decode(data);
82153
- if (text === import_client29.pingConst) {
82154
- void this.sendRequest({ method: import_client29.pingConst, params: [] }).catch((err) => {
82153
+ if (text === import_client30.pingConst) {
82154
+ void this.sendRequest({ method: import_client30.pingConst, params: [] }).catch((err) => {
82155
82155
  this.ctx.error("failed to send ping", { err });
82156
82156
  });
82157
82157
  return true;
82158
82158
  }
82159
- if (text === import_client29.pongConst) {
82159
+ if (text === import_client30.pongConst) {
82160
82160
  this.pingResponse = Date.now();
82161
82161
  return true;
82162
82162
  }
@@ -82166,7 +82166,7 @@ var require_connection2 = __commonJS({
82166
82166
  openConnection(ctx, socketId) {
82167
82167
  this.binaryMode = false;
82168
82168
  this.helloReceived = false;
82169
- const clientSocketFactory = this.opt?.socketFactory ?? (0, import_platform3.getMetadata)(import_client29.default.metadata.ClientSocketFactory) ?? ((url4) => {
82169
+ const clientSocketFactory = this.opt?.socketFactory ?? (0, import_platform3.getMetadata)(import_client30.default.metadata.ClientSocketFactory) ?? ((url4) => {
82170
82170
  const s = new WebSocket(url4);
82171
82171
  return s;
82172
82172
  });
@@ -82201,12 +82201,12 @@ var require_connection2 = __commonJS({
82201
82201
  if (this.websocket !== wsocket) {
82202
82202
  return;
82203
82203
  }
82204
- if (event.data === import_client29.pongConst) {
82204
+ if (event.data === import_client30.pongConst) {
82205
82205
  this.pingResponse = Date.now();
82206
82206
  return;
82207
82207
  }
82208
- if (event.data === import_client29.pingConst) {
82209
- void this.sendRequest({ method: import_client29.pingConst, params: [] }).catch((err) => {
82208
+ if (event.data === import_client30.pingConst) {
82209
+ void this.sendRequest({ method: import_client30.pingConst, params: [] }).catch((err) => {
82210
82210
  this.ctx.error("failed to send ping", { err });
82211
82211
  });
82212
82212
  return;
@@ -82271,8 +82271,8 @@ var require_connection2 = __commonJS({
82271
82271
  if (this.websocket !== wsocket) {
82272
82272
  return;
82273
82273
  }
82274
- const useBinary = this.opt?.useBinaryProtocol ?? (0, import_platform3.getMetadata)(import_client29.default.metadata.UseBinaryProtocol) ?? true;
82275
- this.compressionMode = this.opt?.useProtocolCompression ?? (0, import_platform3.getMetadata)(import_client29.default.metadata.UseProtocolCompression) ?? false;
82274
+ const useBinary = this.opt?.useBinaryProtocol ?? (0, import_platform3.getMetadata)(import_client30.default.metadata.UseBinaryProtocol) ?? true;
82275
+ this.compressionMode = this.opt?.useProtocolCompression ?? (0, import_platform3.getMetadata)(import_client30.default.metadata.UseProtocolCompression) ?? false;
82276
82276
  const helloRequest = {
82277
82277
  method: "hello",
82278
82278
  params: [],
@@ -82318,13 +82318,13 @@ var require_connection2 = __commonJS({
82318
82318
  if (w instanceof Promise) {
82319
82319
  await w;
82320
82320
  }
82321
- if (data.method !== import_client29.pingConst) {
82321
+ if (data.method !== import_client30.pingConst) {
82322
82322
  this.requests.set(id, promise4);
82323
82323
  }
82324
82324
  promise4.sendData = () => {
82325
- if (this.websocket?.readyState === import_client29.ClientSocketReadyState.OPEN) {
82325
+ if (this.websocket?.readyState === import_client30.ClientSocketReadyState.OPEN) {
82326
82326
  promise4.startTime = Date.now();
82327
- if (data.method !== import_client29.pingConst) {
82327
+ if (data.method !== import_client30.pingConst) {
82328
82328
  const dta = this.rpcHandler.serialize(
82329
82329
  {
82330
82330
  method: data.method,
@@ -82337,7 +82337,7 @@ var require_connection2 = __commonJS({
82337
82337
  );
82338
82338
  this.websocket?.send(dta);
82339
82339
  } else {
82340
- this.websocket?.send(import_client29.pingConst);
82340
+ this.websocket?.send(import_client30.pingConst);
82341
82341
  }
82342
82342
  }
82343
82343
  };
@@ -82351,7 +82351,7 @@ var require_connection2 = __commonJS({
82351
82351
  };
82352
82352
  }
82353
82353
  promise4.sendData();
82354
- if (data.method !== import_client29.pingConst) {
82354
+ if (data.method !== import_client30.pingConst) {
82355
82355
  return await promise4.promise;
82356
82356
  }
82357
82357
  },
@@ -82366,7 +82366,7 @@ var require_connection2 = __commonJS({
82366
82366
  }
82367
82367
  getAccount() {
82368
82368
  if (this.account !== void 0) {
82369
- return Promise.resolve((0, import_core50.clone)(this.account));
82369
+ return Promise.resolve((0, import_core51.clone)(this.account));
82370
82370
  }
82371
82371
  return this.sendRequest({ method: "getAccount", params: [] });
82372
82372
  }
@@ -82424,10 +82424,10 @@ var require_connection2 = __commonJS({
82424
82424
  method: "tx",
82425
82425
  params: [tx],
82426
82426
  retry: /* @__PURE__ */ __name(async () => {
82427
- if (tx._class === import_core50.default.class.TxApplyIf) {
82428
- return (await this.findAll(import_core50.default.class.Tx, { _id: tx.txes[0]._id }, { limit: 1 })).length === 0;
82427
+ if (tx._class === import_core51.default.class.TxApplyIf) {
82428
+ return (await this.findAll(import_core51.default.class.Tx, { _id: tx.txes[0]._id }, { limit: 1 })).length === 0;
82429
82429
  }
82430
- return (await this.findAll(import_core50.default.class.Tx, { _id: tx._id }, { limit: 1 })).length === 0;
82430
+ return (await this.findAll(import_core51.default.class.Tx, { _id: tx._id }, { limit: 1 })).length === 0;
82431
82431
  }, "retry")
82432
82432
  });
82433
82433
  }
@@ -82467,7 +82467,7 @@ var require_connection2 = __commonJS({
82467
82467
  };
82468
82468
  function connect(url4, handler, workspace, user, opt) {
82469
82469
  return new Connection(
82470
- opt?.ctx?.newChild?.("connection", {}) ?? new import_core50.MeasureMetricsContext("connection", {}),
82470
+ opt?.ctx?.newChild?.("connection", {}) ?? new import_core51.MeasureMetricsContext("connection", {}),
82471
82471
  url4,
82472
82472
  handler,
82473
82473
  workspace,
@@ -82517,14 +82517,14 @@ var require_lib19 = __commonJS({
82517
82517
  default: () => index_default
82518
82518
  });
82519
82519
  module2.exports = __toCommonJS2(index_exports2);
82520
- var import_client29 = __toESM2(require_lib6());
82521
- var import_core50 = __toESM2(require_lib4());
82520
+ var import_client30 = __toESM2(require_lib6());
82521
+ var import_core51 = __toESM2(require_lib4());
82522
82522
  var import_platform3 = __toESM2(require_lib());
82523
82523
  var import_connection = require_connection2();
82524
82524
  var dbRequest;
82525
82525
  var dbPromise = Promise.resolve(void 0);
82526
82526
  if (typeof localStorage !== "undefined") {
82527
- const st = (0, import_core50.platformNow)();
82527
+ const st = (0, import_core51.platformNow)();
82528
82528
  dbPromise = new Promise((resolve2) => {
82529
82529
  dbRequest = indexedDB.open("model.db.persistence", 2);
82530
82530
  dbRequest.onupgradeneeded = function() {
@@ -82535,7 +82535,7 @@ var require_lib19 = __commonJS({
82535
82535
  };
82536
82536
  dbRequest.onsuccess = function() {
82537
82537
  const db = dbRequest.result;
82538
- console.log("init DB complete", (0, import_core50.platformNow)() - st);
82538
+ console.log("init DB complete", (0, import_core51.platformNow)() - st);
82539
82539
  resolve2(db);
82540
82540
  };
82541
82541
  });
@@ -82561,19 +82561,19 @@ var require_lib19 = __commonJS({
82561
82561
  return {
82562
82562
  function: {
82563
82563
  GetClient: /* @__PURE__ */ __name(async (token, endpoint, opt) => {
82564
- const filterModel = (0, import_platform3.getMetadata)(import_client29.default.metadata.FilterModel) ?? "none";
82565
- const extraFilter = (0, import_platform3.getMetadata)(import_client29.default.metadata.ExtraFilter) ?? [];
82564
+ const filterModel = (0, import_platform3.getMetadata)(import_client30.default.metadata.FilterModel) ?? "none";
82565
+ const extraFilter = (0, import_platform3.getMetadata)(import_client30.default.metadata.ExtraFilter) ?? [];
82566
82566
  const handler = /* @__PURE__ */ __name(async (handler2) => {
82567
- const url4 = (0, import_core50.concatLink)(endpoint, `/${token}`);
82567
+ const url4 = (0, import_core51.concatLink)(endpoint, `/${token}`);
82568
82568
  const upgradeHandler = /* @__PURE__ */ __name((...txes) => {
82569
82569
  for (const tx of txes) {
82570
- if (tx?._class === import_core50.default.class.TxModelUpgrade) {
82570
+ if (tx?._class === import_core51.default.class.TxModelUpgrade) {
82571
82571
  opt?.onUpgrade?.();
82572
82572
  return;
82573
82573
  }
82574
- if (tx?._class === import_core50.default.class.TxWorkspaceEvent) {
82574
+ if (tx?._class === import_core51.default.class.TxWorkspaceEvent) {
82575
82575
  const event = tx;
82576
- if (event.event === import_core50.WorkspaceEvent.MaintenanceNotification) {
82576
+ if (event.event === import_core51.WorkspaceEvent.MaintenanceNotification) {
82577
82577
  void (0, import_platform3.setPlatformStatus)(
82578
82578
  new import_platform3.Status(import_platform3.Severity.WARNING, import_platform3.default.status.MaintenanceWarning, {
82579
82579
  time: event.params.timeMinutes,
@@ -82590,7 +82590,7 @@ var require_lib19 = __commonJS({
82590
82590
  throw new Error("Workspace or account not found in token");
82591
82591
  }
82592
82592
  const newOpt = { ...opt };
82593
- const connectTimeout = opt?.connectionTimeout ?? (0, import_platform3.getMetadata)(import_client29.default.metadata.ConnectionTimeout);
82593
+ const connectTimeout = opt?.connectionTimeout ?? (0, import_platform3.getMetadata)(import_client30.default.metadata.ConnectionTimeout);
82594
82594
  let connectPromise;
82595
82595
  if ((connectTimeout ?? 0) > 0) {
82596
82596
  connectPromise = new Promise((resolve2, reject) => {
@@ -82611,7 +82611,7 @@ var require_lib19 = __commonJS({
82611
82611
  reject(error2);
82612
82612
  return;
82613
82613
  }
82614
- if (event !== import_core50.ClientConnectEvent.Maintenance) {
82614
+ if (event !== import_core51.ClientConnectEvent.Maintenance) {
82615
82615
  clearTimeout(connectTO);
82616
82616
  resolve2();
82617
82617
  }
@@ -82633,7 +82633,7 @@ var require_lib19 = __commonJS({
82633
82633
  }
82634
82634
  return txes;
82635
82635
  }, "modelFilter");
82636
- const client = (0, import_core50.createClient)(handler, modelFilter, createModelPersistence(getWSFromToken(token)), opt?.ctx);
82636
+ const client = (0, import_core51.createClient)(handler, modelFilter, createModelPersistence(getWSFromToken(token)), opt?.ctx);
82637
82637
  return await client;
82638
82638
  }, "GetClient")
82639
82639
  }
@@ -82641,17 +82641,17 @@ var require_lib19 = __commonJS({
82641
82641
  }, "default");
82642
82642
  function returnUITxes(txes, extraFilter) {
82643
82643
  const configs = /* @__PURE__ */ new Map();
82644
- (0, import_core50.fillConfiguration)(txes, configs);
82645
- const allowedPlugins = [...(0, import_platform3.getPlugins)(), ...(0, import_platform3.getMetadata)(import_client29.default.metadata.ExtraPlugins) ?? []];
82644
+ (0, import_core51.fillConfiguration)(txes, configs);
82645
+ const allowedPlugins = [...(0, import_platform3.getPlugins)(), ...(0, import_platform3.getMetadata)(import_client30.default.metadata.ExtraPlugins) ?? []];
82646
82646
  const excludedPlugins = Array.from(configs.values()).filter(
82647
82647
  (it) => !it.enabled || !allowedPlugins.includes(it.pluginId) || extraFilter.includes(it.pluginId)
82648
82648
  );
82649
- return (0, import_core50.pluginFilterTx)(excludedPlugins, configs, txes);
82649
+ return (0, import_core51.pluginFilterTx)(excludedPlugins, configs, txes);
82650
82650
  }
82651
82651
  __name(returnUITxes, "returnUITxes");
82652
82652
  function returnClientTxes(txes) {
82653
82653
  const configs = /* @__PURE__ */ new Map();
82654
- (0, import_core50.fillConfiguration)(txes, configs);
82654
+ (0, import_core51.fillConfiguration)(txes, configs);
82655
82655
  const excludedPlugins = Array.from(configs.values()).filter((it) => !it.enabled || it.pluginId.startsWith("server-"));
82656
82656
  const toExclude = /* @__PURE__ */ new Set([
82657
82657
  "workbench:class:Application",
@@ -82677,8 +82677,8 @@ var require_lib19 = __commonJS({
82677
82677
  "setting:class:WorkspaceSettingCategory",
82678
82678
  "notification:class:NotificationProvider"
82679
82679
  ]);
82680
- const result = (0, import_core50.pluginFilterTx)(excludedPlugins, configs, txes).filter((tx) => {
82681
- if (tx?._class === import_core50.default.class.TxCreateDoc || tx?._class === import_core50.default.class.TxUpdateDoc || tx?._class === import_core50.default.class.TxRemoveDoc) {
82680
+ const result = (0, import_core51.pluginFilterTx)(excludedPlugins, configs, txes).filter((tx) => {
82681
+ if (tx?._class === import_core51.default.class.TxCreateDoc || tx?._class === import_core51.default.class.TxUpdateDoc || tx?._class === import_core51.default.class.TxRemoveDoc) {
82682
82682
  const cud = tx;
82683
82683
  if (toExclude.has(cud.objectClass)) {
82684
82684
  return false;
@@ -82690,7 +82690,7 @@ var require_lib19 = __commonJS({
82690
82690
  }
82691
82691
  __name(returnClientTxes, "returnClientTxes");
82692
82692
  function createModelPersistence(workspace) {
82693
- const overrideStore = (0, import_platform3.getMetadata)(import_client29.default.metadata.OverridePersistenceStore);
82693
+ const overrideStore = (0, import_platform3.getMetadata)(import_client30.default.metadata.OverridePersistenceStore);
82694
82694
  if (overrideStore !== void 0) {
82695
82695
  return overrideStore;
82696
82696
  }
@@ -82787,11 +82787,11 @@ var require_client6 = __commonJS({
82787
82787
  });
82788
82788
  module2.exports = __toCommonJS2(client_exports);
82789
82789
  var import_account_client2 = require_lib5();
82790
- var import_client29 = __toESM2(require_lib6());
82791
- var import_core50 = require_lib4();
82790
+ var import_client30 = __toESM2(require_lib6());
82791
+ var import_core51 = require_lib4();
82792
82792
  var import_platform3 = require_lib();
82793
82793
  var import_config8 = require_config();
82794
- var import_markup10 = require_markup();
82794
+ var import_markup11 = require_markup();
82795
82795
  var import_utils14 = require_utils9();
82796
82796
  async function connect(url4, options) {
82797
82797
  const config3 = await (0, import_config8.loadServerConfig)(url4);
@@ -82805,7 +82805,7 @@ var require_client6 = __commonJS({
82805
82805
  const account = {
82806
82806
  uuid: wsLoginInfo.account,
82807
82807
  role: wsLoginInfo.role,
82808
- primarySocialId: (0, import_core50.pickPrimarySocialId)(socialIds)._id,
82808
+ primarySocialId: (0, import_core51.pickPrimarySocialId)(socialIds)._id,
82809
82809
  socialIds: socialIds.map((si) => si._id),
82810
82810
  fullSocialIds: socialIds
82811
82811
  };
@@ -82813,9 +82813,9 @@ var require_client6 = __commonJS({
82813
82813
  }
82814
82814
  __name(connect, "connect");
82815
82815
  async function createClient(url4, endpoint, token, workspaceUuid, account, config3, options) {
82816
- (0, import_platform3.addLocation)(import_client29.clientId, () => Promise.resolve().then(() => __toESM(require_lib19())));
82816
+ (0, import_platform3.addLocation)(import_client30.clientId, () => Promise.resolve().then(() => __toESM(require_lib19())));
82817
82817
  const { socketFactory, connectionTimeout } = options;
82818
- const clientFactory = await (0, import_platform3.getResource)(import_client29.default.function.GetClient);
82818
+ const clientFactory = await (0, import_platform3.getResource)(import_client30.default.function.GetClient);
82819
82819
  const connection = await clientFactory(token, endpoint, {
82820
82820
  socketFactory,
82821
82821
  connectionTimeout
@@ -82831,8 +82831,8 @@ var require_client6 = __commonJS({
82831
82831
  this.config = config3;
82832
82832
  this.connection = connection;
82833
82833
  this.account = account;
82834
- this.client = new import_core50.TxOperations(connection, account.primarySocialId);
82835
- this.markup = (0, import_markup10.createMarkupOperations)(url4, workspace, token, config3);
82834
+ this.client = new import_core51.TxOperations(connection, account.primarySocialId);
82835
+ this.markup = (0, import_markup11.createMarkupOperations)(url4, workspace, token, config3);
82836
82836
  }
82837
82837
  static {
82838
82838
  __name(this, "PlatformClientImpl");
@@ -82861,7 +82861,7 @@ var require_client6 = __commonJS({
82861
82861
  async processMarkup(_class, id, data) {
82862
82862
  const result = {};
82863
82863
  for (const [key, value3] of Object.entries(data)) {
82864
- if (value3 instanceof import_markup10.MarkupContent) {
82864
+ if (value3 instanceof import_markup11.MarkupContent) {
82865
82865
  result[key] = this.markup.uploadMarkup(_class, id, key, value3.content, value3.kind);
82866
82866
  } else {
82867
82867
  result[key] = value3;
@@ -82871,7 +82871,7 @@ var require_client6 = __commonJS({
82871
82871
  }
82872
82872
  // DocOperations
82873
82873
  async createDoc(_class, space, attributes, id) {
82874
- id ??= (0, import_core50.generateId)();
82874
+ id ??= (0, import_core51.generateId)();
82875
82875
  const data = await this.processMarkup(_class, id, attributes);
82876
82876
  return await this.client.createDoc(_class, space, data, id);
82877
82877
  }
@@ -82884,7 +82884,7 @@ var require_client6 = __commonJS({
82884
82884
  }
82885
82885
  // CollectionOperations
82886
82886
  async addCollection(_class, space, attachedTo, attachedToClass, collection, attributes, id) {
82887
- id ??= (0, import_core50.generateId)();
82887
+ id ??= (0, import_core51.generateId)();
82888
82888
  const data = await this.processMarkup(_class, id, attributes);
82889
82889
  return await this.client.addCollection(_class, space, attachedTo, attachedToClass, collection, data, id);
82890
82890
  }
@@ -83211,7 +83211,7 @@ var require_rest = __commonJS({
83211
83211
  createRestClient: () => createRestClient2
83212
83212
  });
83213
83213
  module2.exports = __toCommonJS2(rest_exports);
83214
- var import_core50 = require_lib4();
83214
+ var import_core51 = require_lib4();
83215
83215
  var import_platform3 = require_lib();
83216
83216
  var import_utils14 = require_utils9();
83217
83217
  var import_utils22 = require_utils10();
@@ -83266,7 +83266,7 @@ var require_rest = __commonJS({
83266
83266
  if (options !== void 0 && Object.keys(options).length > 0) {
83267
83267
  params.append("options", JSON.stringify(options));
83268
83268
  }
83269
- const requestUrl = (0, import_core50.concatLink)(this.endpoint, `/api/v1/find-all/${this.workspace}?${params.toString()}`);
83269
+ const requestUrl = (0, import_core51.concatLink)(this.endpoint, `/api/v1/find-all/${this.workspace}?${params.toString()}`);
83270
83270
  const result = await (0, import_utils22.withRetry)(async () => {
83271
83271
  const response = await fetch(requestUrl, this.requestInit());
83272
83272
  if (!response.ok) {
@@ -83340,7 +83340,7 @@ var require_rest = __commonJS({
83340
83340
  }
83341
83341
  }
83342
83342
  async getAccount() {
83343
- const requestUrl = (0, import_core50.concatLink)(this.endpoint, `/api/v1/account/${this.workspace}`);
83343
+ const requestUrl = (0, import_core51.concatLink)(this.endpoint, `/api/v1/account/${this.workspace}`);
83344
83344
  await this.checkRate();
83345
83345
  const result = await (0, import_utils22.withRetry)(async () => {
83346
83346
  const response = await fetch(requestUrl, this.requestInit());
@@ -83357,7 +83357,7 @@ var require_rest = __commonJS({
83357
83357
  return result;
83358
83358
  }
83359
83359
  async getModel(full = false) {
83360
- const requestUrl = new URL((0, import_core50.concatLink)(this.endpoint, `/api/v1/load-model/${this.workspace}`));
83360
+ const requestUrl = new URL((0, import_core51.concatLink)(this.endpoint, `/api/v1/load-model/${this.workspace}`));
83361
83361
  if (full) {
83362
83362
  requestUrl.searchParams.append("full", "true");
83363
83363
  }
@@ -83370,10 +83370,10 @@ var require_rest = __commonJS({
83370
83370
  }
83371
83371
  this.updateRateLimit(response);
83372
83372
  const modelResponse = await (0, import_utils22.extractJson)(response);
83373
- const hierarchy = new import_core50.Hierarchy();
83374
- const model = new import_core50.ModelDb(hierarchy);
83375
- const ctx = new import_core50.MeasureMetricsContext("loadModel", {});
83376
- (0, import_core50.buildModel)(ctx, modelResponse, void 0, hierarchy, model);
83373
+ const hierarchy = new import_core51.Hierarchy();
83374
+ const model = new import_core51.ModelDb(hierarchy);
83375
+ const ctx = new import_core51.MeasureMetricsContext("loadModel", {});
83376
+ (0, import_core51.buildModel)(ctx, modelResponse, void 0, hierarchy, model);
83377
83377
  return { hierarchy, model };
83378
83378
  }, isRLE);
83379
83379
  if (result.error !== void 0) {
@@ -83385,7 +83385,7 @@ var require_rest = __commonJS({
83385
83385
  return (await this.findAll(_class, query, { ...options, limit: 1 })).shift();
83386
83386
  }
83387
83387
  async tx(tx) {
83388
- const requestUrl = (0, import_core50.concatLink)(this.endpoint, `/api/v1/tx/${this.workspace}`);
83388
+ const requestUrl = (0, import_core51.concatLink)(this.endpoint, `/api/v1/tx/${this.workspace}`);
83389
83389
  await this.checkRate();
83390
83390
  const result = await (0, import_utils22.withRetry)(async () => {
83391
83391
  const response = await fetch(requestUrl, {
@@ -83419,7 +83419,7 @@ var require_rest = __commonJS({
83419
83419
  if (options.limit != null) {
83420
83420
  params.append("limit", `${options.limit}`);
83421
83421
  }
83422
- const requestUrl = (0, import_core50.concatLink)(this.endpoint, `/api/v1/search-fulltext/${this.workspace}?${params.toString()}`);
83422
+ const requestUrl = (0, import_core51.concatLink)(this.endpoint, `/api/v1/search-fulltext/${this.workspace}?${params.toString()}`);
83423
83423
  const response = await fetch(requestUrl, {
83424
83424
  method: "GET",
83425
83425
  headers: this.jsonHeaders(),
@@ -83438,7 +83438,7 @@ var require_rest = __commonJS({
83438
83438
  return result;
83439
83439
  }
83440
83440
  async domainRequest(domain3, params, options) {
83441
- const requestUrl = (0, import_core50.concatLink)(this.endpoint, `/api/v1/request/${domain3}/${this.workspace}`);
83441
+ const requestUrl = (0, import_core51.concatLink)(this.endpoint, `/api/v1/request/${domain3}/${this.workspace}`);
83442
83442
  await this.checkRate();
83443
83443
  return await (0, import_utils22.withRetry)(async () => {
83444
83444
  const response = await fetch(requestUrl, {
@@ -83457,7 +83457,7 @@ var require_rest = __commonJS({
83457
83457
  }, isRLE);
83458
83458
  }
83459
83459
  async ensurePerson(socialType, socialValue, firstName, lastName) {
83460
- const requestUrl = (0, import_core50.concatLink)(this.endpoint, `/api/v1/ensure-person/${this.workspace}`);
83460
+ const requestUrl = (0, import_core51.concatLink)(this.endpoint, `/api/v1/ensure-person/${this.workspace}`);
83461
83461
  await this.checkRate();
83462
83462
  const result = await (0, import_utils22.withRetry)(async () => {
83463
83463
  const response = await fetch(requestUrl, {
@@ -83514,13 +83514,13 @@ var require_tx2 = __commonJS({
83514
83514
  createRestTxOperations: () => createRestTxOperations2
83515
83515
  });
83516
83516
  module2.exports = __toCommonJS2(tx_exports);
83517
- var import_core50 = require_lib4();
83517
+ var import_core51 = require_lib4();
83518
83518
  var import_rest = require_rest();
83519
83519
  async function createRestTxOperations2(endpoint, workspaceId, token, fullModel = false) {
83520
83520
  const restClient = new import_rest.RestClientImpl(endpoint, workspaceId, token);
83521
83521
  const account = await restClient.getAccount();
83522
83522
  const { hierarchy, model } = await restClient.getModel(fullModel);
83523
- return new import_core50.TxOperations(new RestTxClient(restClient, hierarchy, model, account), account.socialIds[0]);
83523
+ return new import_core51.TxOperations(new RestTxClient(restClient, hierarchy, model, account), account.socialIds[0]);
83524
83524
  }
83525
83525
  __name(createRestTxOperations2, "createRestTxOperations");
83526
83526
  var RestTxClient = class {
@@ -83541,7 +83541,7 @@ var require_tx2 = __commonJS({
83541
83541
  const result = data.map((v) => {
83542
83542
  return this.hierarchy.updateLookupMixin(_class, v, options);
83543
83543
  });
83544
- return (0, import_core50.toFindResult)(result, data.total);
83544
+ return (0, import_core51.toFindResult)(result, data.total);
83545
83545
  }
83546
83546
  async domainRequest(domain3, params, options) {
83547
83547
  return await this.client.domainRequest(domain3, params, options);
@@ -83723,7 +83723,7 @@ var require_client7 = __commonJS({
83723
83723
  createStorageClient: () => createStorageClient2
83724
83724
  });
83725
83725
  module2.exports = __toCommonJS2(client_exports);
83726
- var import_core50 = __toESM2(require_lib4());
83726
+ var import_core51 = __toESM2(require_lib4());
83727
83727
  var import_stream2 = require("stream");
83728
83728
  var import_config8 = require_config();
83729
83729
  var import_error = require_error3();
@@ -83760,13 +83760,13 @@ var require_client7 = __commonJS({
83760
83760
  const size13 = parseInt(headers.get("Content-Length") ?? "0", 10);
83761
83761
  return {
83762
83762
  provider: "",
83763
- _class: import_core50.default.class.Blob,
83763
+ _class: import_core51.default.class.Blob,
83764
83764
  _id: objectName,
83765
83765
  contentType: headers.get("Content-Type") ?? "",
83766
83766
  size: isNaN(size13) ? 0 : size13 ?? 0,
83767
83767
  etag: headers.get("ETag") ?? "",
83768
- space: import_core50.default.space.Configuration,
83769
- modifiedBy: import_core50.default.account.System,
83768
+ space: import_core51.default.space.Configuration,
83769
+ modifiedBy: import_core51.default.account.System,
83770
83770
  modifiedOn: isNaN(lastModified) ? 0 : lastModified,
83771
83771
  version: null
83772
83772
  };
@@ -83801,11 +83801,11 @@ var require_client7 = __commonJS({
83801
83801
  if (Object.hasOwn(result[0], "id")) {
83802
83802
  const fileResult = result[0];
83803
83803
  return {
83804
- _class: import_core50.default.class.Blob,
83804
+ _class: import_core51.default.class.Blob,
83805
83805
  _id: fileResult.id,
83806
- space: import_core50.default.space.Configuration,
83806
+ space: import_core51.default.space.Configuration,
83807
83807
  modifiedOn: fileResult.metadata.lastModified,
83808
- modifiedBy: import_core50.default.account.System,
83808
+ modifiedBy: import_core51.default.account.System,
83809
83809
  provider: "",
83810
83810
  contentType: fileResult.metadata.contentType,
83811
83811
  etag: fileResult.metadata.etag,
@@ -83879,11 +83879,11 @@ var require_client7 = __commonJS({
83879
83879
  async function connectStorage(url4, options, config3) {
83880
83880
  config3 ??= await (0, import_config8.loadServerConfig)(url4);
83881
83881
  const token = await (0, import_utils14.getWorkspaceToken)(url4, options, config3);
83882
- const filesUrl = (config3.FILES_URL.startsWith("/") ? (0, import_core50.concatLink)(url4, config3.FILES_URL) : config3.FILES_URL).replace(
83882
+ const filesUrl = (config3.FILES_URL.startsWith("/") ? (0, import_core51.concatLink)(url4, config3.FILES_URL) : config3.FILES_URL).replace(
83883
83883
  ":workspace",
83884
83884
  token.workspaceId
83885
83885
  );
83886
- const uploadUrl = (config3.UPLOAD_URL.startsWith("/") ? (0, import_core50.concatLink)(url4, config3.UPLOAD_URL) : config3.UPLOAD_URL).replace(":workspace", token.workspaceId);
83886
+ const uploadUrl = (config3.UPLOAD_URL.startsWith("/") ? (0, import_core51.concatLink)(url4, config3.UPLOAD_URL) : config3.UPLOAD_URL).replace(":workspace", token.workspaceId);
83887
83887
  return new StorageClientImpl(filesUrl, uploadUrl, token.token, token.workspaceId);
83888
83888
  }
83889
83889
  __name(connectStorage, "connectStorage");
@@ -83936,11 +83936,11 @@ var require_storage2 = __commonJS({
83936
83936
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
83937
83937
  var storage_exports = {};
83938
83938
  __export2(storage_exports, {
83939
- connectStorage: () => import_client29.connectStorage,
83940
- createStorageClient: () => import_client29.createStorageClient
83939
+ connectStorage: () => import_client30.connectStorage,
83940
+ createStorageClient: () => import_client30.createStorageClient
83941
83941
  });
83942
83942
  module2.exports = __toCommonJS2(storage_exports);
83943
- var import_client29 = require_client7();
83943
+ var import_client30 = require_client7();
83944
83944
  __reExport2(storage_exports, require_error3(), module2.exports);
83945
83945
  __reExport2(storage_exports, require_types8(), module2.exports);
83946
83946
  }
@@ -114648,11 +114648,11 @@ var require_utils15 = __commonJS({
114648
114648
  generateEventId: () => generateEventId3,
114649
114649
  generateRecurringValues: () => generateRecurringValues,
114650
114650
  getAllEvents: () => getAllEvents,
114651
- getPrimaryCalendar: () => getPrimaryCalendar,
114651
+ getPrimaryCalendar: () => getPrimaryCalendar2,
114652
114652
  getWeekday: () => getWeekday
114653
114653
  });
114654
114654
  module2.exports = __toCommonJS2(utils_exports);
114655
- var import_core50 = require_lib4();
114655
+ var import_core51 = require_lib4();
114656
114656
  var import__ = __toESM2(require_lib25());
114657
114657
  function getInstance(event, date7) {
114658
114658
  const diff8 = event.dueDate - event.date;
@@ -114664,7 +114664,7 @@ var require_utils15 = __commonJS({
114664
114664
  originalStartTime: date7,
114665
114665
  _class: import__.default.class.ReccuringInstance,
114666
114666
  eventId: generateEventId3(),
114667
- _id: (0, import_core50.generateId)(),
114667
+ _id: (0, import_core51.generateId)(),
114668
114668
  virtual: true
114669
114669
  };
114670
114670
  }
@@ -114977,7 +114977,7 @@ var require_utils15 = __commonJS({
114977
114977
  }
114978
114978
  __name(getAllEvents, "getAllEvents");
114979
114979
  function generateEventId3() {
114980
- const id = (0, import_core50.generateId)();
114980
+ const id = (0, import_core51.generateId)();
114981
114981
  return encodeToBase32Hex(id);
114982
114982
  }
114983
114983
  __name(generateEventId3, "generateEventId");
@@ -115004,7 +115004,7 @@ var require_utils15 = __commonJS({
115004
115004
  return result;
115005
115005
  }
115006
115006
  __name(encodeToBase32Hex, "encodeToBase32Hex");
115007
- function getPrimaryCalendar(calendars, preference, acc) {
115007
+ function getPrimaryCalendar2(calendars, preference, acc) {
115008
115008
  if (preference?.attachedTo !== void 0) {
115009
115009
  const pref = calendars.find((p) => p._id === preference.attachedTo && p);
115010
115010
  if (pref !== void 0) return pref._id;
@@ -115016,7 +115016,7 @@ var require_utils15 = __commonJS({
115016
115016
  }
115017
115017
  return `${acc}_calendar`;
115018
115018
  }
115019
- __name(getPrimaryCalendar, "getPrimaryCalendar");
115019
+ __name(getPrimaryCalendar2, "getPrimaryCalendar");
115020
115020
  }
115021
115021
  });
115022
115022
 
@@ -115044,7 +115044,7 @@ var require_lib25 = __commonJS({
115044
115044
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
115045
115045
  var index_exports2 = {};
115046
115046
  __export2(index_exports2, {
115047
- AccessLevel: () => AccessLevel4,
115047
+ AccessLevel: () => AccessLevel5,
115048
115048
  caldavIntegrationKind: () => caldavIntegrationKind,
115049
115049
  calendarId: () => calendarId,
115050
115050
  calendarIntegrationKind: () => calendarIntegrationKind,
@@ -115053,13 +115053,13 @@ var require_lib25 = __commonJS({
115053
115053
  module2.exports = __toCommonJS2(index_exports2);
115054
115054
  var import_platform3 = require_lib();
115055
115055
  __reExport2(index_exports2, require_utils15(), module2.exports);
115056
- var AccessLevel4 = /* @__PURE__ */ ((AccessLevel22) => {
115056
+ var AccessLevel5 = /* @__PURE__ */ ((AccessLevel22) => {
115057
115057
  AccessLevel22["FreeBusyReader"] = "freeBusyReader";
115058
115058
  AccessLevel22["Reader"] = "reader";
115059
115059
  AccessLevel22["Writer"] = "writer";
115060
115060
  AccessLevel22["Owner"] = "owner";
115061
115061
  return AccessLevel22;
115062
- })(AccessLevel4 || {});
115062
+ })(AccessLevel5 || {});
115063
115063
  var calendarIntegrationKind = "google-calendar";
115064
115064
  var caldavIntegrationKind = "caldav";
115065
115065
  var calendarId = "calendar";
@@ -115391,7 +115391,7 @@ var require_utils16 = __commonJS({
115391
115391
  });
115392
115392
  module2.exports = __toCommonJS2(utils_exports);
115393
115393
  var import_fast_equals = require_cjs();
115394
- var import_core50 = __toESM2(require_lib4());
115394
+ var import_core51 = __toESM2(require_lib4());
115395
115395
  var import__ = __toESM2(require_lib27());
115396
115396
  async function getDirectChannel(client, me, employeeAccount) {
115397
115397
  const accIds = [me, employeeAccount].sort();
@@ -115401,7 +115401,7 @@ var require_utils16 = __commonJS({
115401
115401
  return dm._id;
115402
115402
  }
115403
115403
  }
115404
- return await client.createDoc(import__.default.class.DirectMessage, import_core50.default.space.Space, {
115404
+ return await client.createDoc(import__.default.class.DirectMessage, import_core51.default.space.Space, {
115405
115405
  name: "",
115406
115406
  description: "",
115407
115407
  private: true,
@@ -115705,18 +115705,18 @@ var require_cache4 = __commonJS({
115705
115705
  default: () => ContactCache
115706
115706
  });
115707
115707
  module2.exports = __toCommonJS2(cache_exports);
115708
- var import_core50 = __toESM2(require_lib4());
115708
+ var import_core51 = __toESM2(require_lib4());
115709
115709
  var import__ = __toESM2(require_lib28());
115710
115710
  function isCreateTx(tx) {
115711
- return tx._class === import_core50.default.class.TxCreateDoc;
115711
+ return tx._class === import_core51.default.class.TxCreateDoc;
115712
115712
  }
115713
115713
  __name(isCreateTx, "isCreateTx");
115714
115714
  function isUpdateTx(tx) {
115715
- return tx._class === import_core50.default.class.TxUpdateDoc;
115715
+ return tx._class === import_core51.default.class.TxUpdateDoc;
115716
115716
  }
115717
115717
  __name(isUpdateTx, "isUpdateTx");
115718
115718
  function isMixinTx(tx) {
115719
- return tx._class === import_core50.default.class.TxMixin;
115719
+ return tx._class === import_core51.default.class.TxMixin;
115720
115720
  }
115721
115721
  __name(isMixinTx, "isMixinTx");
115722
115722
  function isPersonTx(tx) {
@@ -115823,7 +115823,7 @@ var require_cache4 = __commonJS({
115823
115823
  const ref = tx.objectId;
115824
115824
  const person = this._personByRef.get(ref);
115825
115825
  if (person === void 0) return;
115826
- const createdPerson = import_core50.TxProcessor.createDoc2Doc(tx);
115826
+ const createdPerson = import_core51.TxProcessor.createDoc2Doc(tx);
115827
115827
  this._personByRef.set(ref, createdPerson);
115828
115828
  const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? []);
115829
115829
  for (const personId of personIds) {
@@ -115841,7 +115841,7 @@ var require_cache4 = __commonJS({
115841
115841
  const newPersonRef = tx.attachedTo;
115842
115842
  this._personRefByPersonId.set(personId, newPersonRef);
115843
115843
  this.addPersonIdToPersonRef(newPersonRef, personId);
115844
- const createdSocialId = import_core50.TxProcessor.createDoc2Doc(tx);
115844
+ const createdSocialId = import_core51.TxProcessor.createDoc2Doc(tx);
115845
115845
  this._socialIdByPersonId.set(personId, createdSocialId);
115846
115846
  this.broadcastChange({
115847
115847
  personRef: newPersonRef,
@@ -115852,7 +115852,7 @@ var require_cache4 = __commonJS({
115852
115852
  const ref = tx.objectId;
115853
115853
  const person = this._personByRef.get(ref);
115854
115854
  if (person == null) return;
115855
- const updatedPerson = isUpdateTx(tx) ? import_core50.TxProcessor.updateDoc2Doc(person, tx) : import_core50.TxProcessor.updateMixin4Doc(person, tx);
115855
+ const updatedPerson = isUpdateTx(tx) ? import_core51.TxProcessor.updateDoc2Doc(person, tx) : import_core51.TxProcessor.updateMixin4Doc(person, tx);
115856
115856
  this._personByRef.set(ref, updatedPerson);
115857
115857
  const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? []);
115858
115858
  for (const personId of personIds) {
@@ -115967,7 +115967,7 @@ var require_utils17 = __commonJS({
115967
115967
  setCurrentEmployeeSpace: () => setCurrentEmployeeSpace
115968
115968
  });
115969
115969
  module2.exports = __toCommonJS2(utils_exports);
115970
- var import_core50 = require_lib4();
115970
+ var import_core51 = require_lib4();
115971
115971
  var import_platform3 = require_lib();
115972
115972
  var import__ = __toESM2(require_lib28());
115973
115973
  var import_types12 = require_types10();
@@ -116171,7 +116171,7 @@ var require_utils17 = __commonJS({
116171
116171
  if (socialIds.length === 0) {
116172
116172
  return;
116173
116173
  }
116174
- return (0, import_core50.pickPrimarySocialId)(socialIds)._id;
116174
+ return (0, import_core51.pickPrimarySocialId)(socialIds)._id;
116175
116175
  }
116176
116176
  __name(getPrimarySocialId, "getPrimarySocialId");
116177
116177
  async function getAllSocialStringsByPersonId(client, personId) {
@@ -116210,12 +116210,12 @@ var require_utils17 = __commonJS({
116210
116210
  __name(getSocialStringsByEmployee, "getSocialStringsByEmployee");
116211
116211
  async function getAllAccounts(client) {
116212
116212
  const employees = await client.findAll(import__.default.mixin.Employee, { active: true });
116213
- return employees.map((it) => it.personUuid).filter(import_core50.notEmpty);
116213
+ return employees.map((it) => it.personUuid).filter(import_core51.notEmpty);
116214
116214
  }
116215
116215
  __name(getAllAccounts, "getAllAccounts");
116216
116216
  async function getAllUserAccounts(client) {
116217
116217
  const employees = await client.findAll(import__.default.mixin.Employee, { active: true });
116218
- return employees.map((it) => it.personUuid).filter(import_core50.notEmpty);
116218
+ return employees.map((it) => it.personUuid).filter(import_core51.notEmpty);
116219
116219
  }
116220
116220
  __name(getAllUserAccounts, "getAllUserAccounts");
116221
116221
  async function ensureEmployee(ctx, me, client, socialIds, getGlobalPerson) {
@@ -116224,7 +116224,7 @@ var require_utils17 = __commonJS({
116224
116224
  }
116225
116225
  __name(ensureEmployee, "ensureEmployee");
116226
116226
  async function ensureEmployeeForPerson(ctx, me, person, client, socialIds, globalPerson) {
116227
- const txFactory = new import_core50.TxFactory(me.primarySocialId);
116227
+ const txFactory = new import_core51.TxFactory(me.primarySocialId);
116228
116228
  const personByUuid = await client.findOne(import__.default.class.Person, { personUuid: person.uuid });
116229
116229
  let personRef = personByUuid?._id;
116230
116230
  if (personRef === void 0) {
@@ -116245,7 +116245,7 @@ var require_utils17 = __commonJS({
116245
116245
  city: globalPerson.city,
116246
116246
  avatarType: import__.AvatarType.COLOR
116247
116247
  };
116248
- personRef = (0, import_core50.generateId)();
116248
+ personRef = (0, import_core51.generateId)();
116249
116249
  const createPersonTx = txFactory.createTxCreateDoc(import__.default.class.Person, import__.default.space.Contacts, data, personRef);
116250
116250
  await client.tx(createPersonTx);
116251
116251
  });
@@ -116255,7 +116255,7 @@ var require_utils17 = __commonJS({
116255
116255
  });
116256
116256
  await client.tx(updatePersonTx);
116257
116257
  }
116258
- const existingIdentifiers = (0, import_core50.toIdMap)(
116258
+ const existingIdentifiers = (0, import_core51.toIdMap)(
116259
116259
  await client.findAll(import__.default.class.SocialIdentity, { _id: { $in: person.socialIds } })
116260
116260
  );
116261
116261
  for (const socialId of socialIds) {
@@ -116280,7 +116280,7 @@ var require_utils17 = __commonJS({
116280
116280
  collection: "socialIds",
116281
116281
  type: socialId.type,
116282
116282
  value: socialId.value,
116283
- key: (0, import_core50.buildSocialIdString)(socialId),
116283
+ key: (0, import_core51.buildSocialIdString)(socialId),
116284
116284
  // TODO: fill it in trigger or on DB level as stored calculated column or smth?
116285
116285
  verifiedOn: socialId.verifiedOn,
116286
116286
  isDeleted: socialId.isDeleted
@@ -116321,9 +116321,9 @@ var require_utils17 = __commonJS({
116321
116321
  }
116322
116322
  }
116323
116323
  }
116324
- const employeeRole = person.role === import_core50.AccountRole.Guest || person.role === import_core50.AccountRole.ReadOnlyGuest ? "GUEST" : "USER";
116324
+ const employeeRole = person.role === import_core51.AccountRole.Guest || person.role === import_core51.AccountRole.ReadOnlyGuest ? "GUEST" : "USER";
116325
116325
  const employee = await client.findOne(import__.default.mixin.Employee, { _id: personRef });
116326
- if (employee === void 0 || !import_core50.Hierarchy.hasMixin(employee, import__.default.mixin.Employee) || !employee.active || employee.role !== employeeRole) {
116326
+ if (employee === void 0 || !import_core51.Hierarchy.hasMixin(employee, import__.default.mixin.Employee) || !employee.active || employee.role !== employeeRole) {
116327
116327
  await ctx.with("create-employee", {}, async () => {
116328
116328
  if (personRef === void 0) {
116329
116329
  console.error("Person not found");
@@ -116363,7 +116363,7 @@ var require_utils17 = __commonJS({
116363
116363
  }
116364
116364
  __name(loadCachesForPersonId, "loadCachesForPersonId");
116365
116365
  async function loadCachesForPersonIds(client, personIds) {
116366
- const sidObjsMap = (0, import_core50.toIdMap)(
116366
+ const sidObjsMap = (0, import_core51.toIdMap)(
116367
116367
  await client.findAll(
116368
116368
  import__.default.class.SocialIdentity,
116369
116369
  {
@@ -116398,7 +116398,7 @@ var require_utils17 = __commonJS({
116398
116398
  }
116399
116399
  __name(loadCachesForPersonRef, "loadCachesForPersonRef");
116400
116400
  async function loadCachesForPersonRefs(client, personRefs) {
116401
- const persons = (0, import_core50.toIdMap)(
116401
+ const persons = (0, import_core51.toIdMap)(
116402
116402
  await client.findAll(
116403
116403
  import__.default.class.Person,
116404
116404
  {
@@ -116441,7 +116441,7 @@ var require_utils17 = __commonJS({
116441
116441
  personIds.map((pid) => {
116442
116442
  const ref = contactCache.personRefByPersonId.get(pid);
116443
116443
  return ref != null ? [pid, ref] : void 0;
116444
- }).filter(import_core50.notEmpty)
116444
+ }).filter(import_core51.notEmpty)
116445
116445
  );
116446
116446
  }
116447
116447
  __name(getPersonRefsByPersonIdsFromCache, "getPersonRefsByPersonIdsFromCache");
@@ -116488,7 +116488,7 @@ var require_utils17 = __commonJS({
116488
116488
  personIds.map((pid) => {
116489
116489
  const person = contactCache.personByPersonId.get(pid);
116490
116490
  return person != null ? [pid, person] : void 0;
116491
- }).filter(import_core50.notEmpty)
116491
+ }).filter(import_core51.notEmpty)
116492
116492
  );
116493
116493
  }
116494
116494
  __name(getPersonsByPersonIdsFromCache, "getPersonsByPersonIdsFromCache");
@@ -116535,7 +116535,7 @@ var require_utils17 = __commonJS({
116535
116535
  personRefs.map((personRef) => {
116536
116536
  const person = contactCache.personByRef.get(personRef);
116537
116537
  return person != null ? [personRef, person] : void 0;
116538
- }).filter(import_core50.notEmpty)
116538
+ }).filter(import_core51.notEmpty)
116539
116539
  );
116540
116540
  }
116541
116541
  __name(getPersonsByPersonRefsFromCache, "getPersonsByPersonRefsFromCache");
@@ -117140,9 +117140,9 @@ var require_utils18 = __commonJS({
117140
117140
  getFirstRank: () => getFirstRank
117141
117141
  });
117142
117142
  module2.exports = __toCommonJS2(utils_exports);
117143
- var import_core50 = require_lib4();
117143
+ var import_core51 = require_lib4();
117144
117144
  var import_plugin = __toESM2(require_plugin2());
117145
- async function getFirstRank(client, space, parent, sort3 = import_core50.SortingOrder.Descending, extra = {}) {
117145
+ async function getFirstRank(client, space, parent, sort3 = import_core51.SortingOrder.Descending, extra = {}) {
117146
117146
  const doc = await client.findOne(
117147
117147
  import_plugin.default.class.Document,
117148
117148
  { space, parent, ...extra },
@@ -118765,7 +118765,7 @@ var require_utils20 = __commonJS({
118765
118765
  updateProjectType: () => updateProjectType
118766
118766
  });
118767
118767
  module2.exports = __toCommonJS2(utils_exports);
118768
- var import_core50 = __toESM2(require_lib4());
118768
+ var import_core51 = __toESM2(require_lib4());
118769
118769
  var import_platform3 = require_lib();
118770
118770
  var import__ = __toESM2(require_lib34());
118771
118771
  var import_rank4 = require_lib33();
@@ -118801,7 +118801,7 @@ var require_utils20 = __commonJS({
118801
118801
  if (exists5 !== void 0) {
118802
118802
  return exists5._id;
118803
118803
  }
118804
- const res = await client.createDoc(_class, import_core50.default.space.Model, data);
118804
+ const res = await client.createDoc(_class, import_core51.default.space.Model, data);
118805
118805
  return res;
118806
118806
  }
118807
118807
  __name(createState, "createState");
@@ -118831,7 +118831,7 @@ var require_utils20 = __commonJS({
118831
118831
  function findStatusAttr(h, _class) {
118832
118832
  const attrs = h.getAllAttributes(_class);
118833
118833
  for (const it of attrs.values()) {
118834
- if (it.type._class === import_core50.default.class.RefTo && h.isDerived(it.type.to, import_core50.default.class.Status)) {
118834
+ if (it.type._class === import_core51.default.class.RefTo && h.isDerived(it.type.to, import_core51.default.class.Status)) {
118835
118835
  return it;
118836
118836
  }
118837
118837
  }
@@ -118863,7 +118863,7 @@ var require_utils20 = __commonJS({
118863
118863
  const targetProjectClassId = `${_id}:type:mixin`;
118864
118864
  const tmpl = await client.createDoc(
118865
118865
  import__.default.class.ProjectType,
118866
- import_core50.default.space.Model,
118866
+ import_core51.default.space.Model,
118867
118867
  {
118868
118868
  description: data.description,
118869
118869
  shortDescription: data.shortDescription,
@@ -118878,17 +118878,17 @@ var require_utils20 = __commonJS({
118878
118878
  _id
118879
118879
  );
118880
118880
  await client.createDoc(
118881
- import_core50.default.class.Mixin,
118882
- import_core50.default.space.Model,
118881
+ import_core51.default.class.Mixin,
118882
+ import_core51.default.space.Model,
118883
118883
  {
118884
118884
  extends: categoryObj.baseClass,
118885
- kind: import_core50.ClassifierKind.MIXIN,
118885
+ kind: import_core51.ClassifierKind.MIXIN,
118886
118886
  label: (0, import_platform3.getEmbeddedLabel)(data.name),
118887
118887
  icon: baseClassClass.icon
118888
118888
  },
118889
118889
  targetProjectClassId
118890
118890
  );
118891
- await client.createMixin(targetProjectClassId, import_core50.default.class.Mixin, import_core50.default.space.Model, import__.default.mixin.ProjectTypeClass, {
118891
+ await client.createMixin(targetProjectClassId, import_core51.default.class.Mixin, import_core51.default.space.Model, import__.default.mixin.ProjectTypeClass, {
118892
118892
  projectType: _id
118893
118893
  });
118894
118894
  return tmpl;
@@ -118947,22 +118947,22 @@ var require_utils20 = __commonJS({
118947
118947
  const targetClassId = `${taskId}:type:mixin`;
118948
118948
  tdata.targetClass = targetClassId;
118949
118949
  await client.createDoc(
118950
- import_core50.default.class.Mixin,
118951
- import_core50.default.space.Model,
118950
+ import_core51.default.class.Mixin,
118951
+ import_core51.default.space.Model,
118952
118952
  {
118953
118953
  extends: data.ofClass,
118954
- kind: import_core50.ClassifierKind.MIXIN,
118954
+ kind: import_core51.ClassifierKind.MIXIN,
118955
118955
  label: ofClassClass.label,
118956
118956
  icon: ofClassClass.icon
118957
118957
  },
118958
118958
  targetClassId
118959
118959
  );
118960
- await client.createMixin(targetClassId, import_core50.default.class.Mixin, import_core50.default.space.Model, import__.default.mixin.TaskTypeClass, {
118960
+ await client.createMixin(targetClassId, import_core51.default.class.Mixin, import_core51.default.space.Model, import__.default.mixin.TaskTypeClass, {
118961
118961
  taskType: taskId,
118962
118962
  projectType: _id
118963
118963
  });
118964
118964
  }
118965
- await client.createDoc(import__.default.class.TaskType, import_core50.default.space.Model, tdata, taskId);
118965
+ await client.createDoc(import__.default.class.TaskType, import_core51.default.space.Model, tdata, taskId);
118966
118966
  tasksData.set(taskId, tdata);
118967
118967
  _tasks.push(taskId);
118968
118968
  }
@@ -150577,6 +150577,7 @@ var TeamspaceId = HulyRef("TeamspaceId");
150577
150577
  var NotificationId = HulyRef("NotificationId");
150578
150578
  var NotificationContextId = HulyRef("NotificationContextId");
150579
150579
  var EventId = HulyRef("EventId");
150580
+ var CalendarId = HulyRef("CalendarId");
150580
150581
  var TodoId = HulyRef("TodoId");
150581
150582
  var SpaceId = HulyRef("SpaceId");
150582
150583
  var CommentId = HulyRef("CommentId");
@@ -150635,6 +150636,7 @@ var ComponentIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ComponentId
150635
150636
  var MilestoneIdentifier = NonEmptyString2.pipe(Schema_exports.brand("MilestoneIdentifier"));
150636
150637
  var TemplateIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TemplateIdentifier"));
150637
150638
  var ChannelIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ChannelIdentifier"));
150639
+ var DirectMessageIdentifier = NonEmptyString2.pipe(Schema_exports.brand("DirectMessageIdentifier"));
150638
150640
  var TeamspaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TeamspaceIdentifier"));
150639
150641
  var CardIdentifier = NonEmptyString2.pipe(Schema_exports.brand("CardIdentifier"));
150640
150642
  var CardSpaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("CardSpaceIdentifier"));
@@ -150700,6 +150702,16 @@ var RecurringEventNotFoundError = class extends Schema_exports.TaggedError()(
150700
150702
  return `Recurring event '${this.eventId}' not found`;
150701
150703
  }
150702
150704
  };
150705
+ var CalendarNotAccessibleError = class extends Schema_exports.TaggedError()(
150706
+ "CalendarNotAccessibleError",
150707
+ {
150708
+ calendarId: Schema_exports.String
150709
+ }
150710
+ ) {
150711
+ get message() {
150712
+ return `Calendar '${this.calendarId}' not found or not accessible`;
150713
+ }
150714
+ };
150703
150715
 
150704
150716
  // src/huly/errors-cards.ts
150705
150717
  var CardSpaceNotFoundError = class extends Schema_exports.TaggedError()(
@@ -151103,6 +151115,7 @@ var LeadNotFoundError = class extends Schema_exports.TaggedError()(
151103
151115
  };
151104
151116
 
151105
151117
  // src/huly/errors-messaging.ts
151118
+ var MIN_AMBIGUOUS_DM_MATCHES = 2;
151106
151119
  var ChannelNotFoundError = class extends Schema_exports.TaggedError()(
151107
151120
  "ChannelNotFoundError",
151108
151121
  {
@@ -151113,6 +151126,27 @@ var ChannelNotFoundError = class extends Schema_exports.TaggedError()(
151113
151126
  return `Channel '${this.identifier}' not found`;
151114
151127
  }
151115
151128
  };
151129
+ var DirectMessageNotFoundError = class extends Schema_exports.TaggedError()(
151130
+ "DirectMessageNotFoundError",
151131
+ {
151132
+ identifier: Schema_exports.String
151133
+ }
151134
+ ) {
151135
+ get message() {
151136
+ return `Direct message '${this.identifier}' not found`;
151137
+ }
151138
+ };
151139
+ var DirectMessageIdentifierAmbiguousError = class extends Schema_exports.TaggedError()(
151140
+ "DirectMessageIdentifierAmbiguousError",
151141
+ {
151142
+ identifier: Schema_exports.String,
151143
+ matches: Schema_exports.Number.pipe(Schema_exports.int(), Schema_exports.greaterThanOrEqualTo(MIN_AMBIGUOUS_DM_MATCHES))
151144
+ }
151145
+ ) {
151146
+ get message() {
151147
+ return `Direct message '${this.identifier}' is ambiguous (${this.matches} matches); use the DM _id`;
151148
+ }
151149
+ };
151116
151150
  var MessageNotFoundError = class extends Schema_exports.TaggedError()(
151117
151151
  "MessageNotFoundError",
151118
151152
  {
@@ -151377,8 +151411,11 @@ var HulyDomainError = Schema_exports.Union(
151377
151411
  CommentNotFoundError,
151378
151412
  MilestoneNotFoundError,
151379
151413
  ChannelNotFoundError,
151414
+ DirectMessageIdentifierAmbiguousError,
151415
+ DirectMessageNotFoundError,
151380
151416
  MessageNotFoundError,
151381
151417
  ThreadReplyNotFoundError,
151418
+ CalendarNotAccessibleError,
151382
151419
  EventNotFoundError,
151383
151420
  RecurringEventNotFoundError,
151384
151421
  ActivityMessageNotFoundError,
@@ -151527,7 +151564,15 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
151527
151564
  Effect_exports.gen(function* () {
151528
151565
  const config3 = yield* HulyConfigService;
151529
151566
  const sdk = yield* HulySdk;
151530
- const { accountUuid, client, imageUrl, markupOps, refUrl, workspaceUrlSlug } = yield* connectRestWithRetry({
151567
+ const {
151568
+ accountUuid,
151569
+ client,
151570
+ imageUrl,
151571
+ markupOps,
151572
+ primarySocialId,
151573
+ refUrl,
151574
+ workspaceUrlSlug
151575
+ } = yield* connectRestWithRetry({
151531
151576
  url: config3.url,
151532
151577
  auth: config3.auth,
151533
151578
  workspace: config3.workspace
@@ -151549,6 +151594,7 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
151549
151594
  });
151550
151595
  const operations = {
151551
151596
  getAccountUuid: () => accountUuid,
151597
+ getPrimarySocialId: () => primarySocialId,
151552
151598
  documentUrlConfig,
151553
151599
  markupUrlConfig,
151554
151600
  findAll: (_class, query, options) => withClient(
@@ -151630,6 +151676,9 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
151630
151676
  // AccountUuid is a double-branded string type with no public constructor
151631
151677
  // eslint-disable-next-line no-restricted-syntax -- see above
151632
151678
  getAccountUuid: () => "test-account-uuid",
151679
+ // PersonId is a branded string type with no public constructor
151680
+ // eslint-disable-next-line no-restricted-syntax -- see above
151681
+ getPrimarySocialId: () => "test-primary-social-id",
151633
151682
  documentUrlConfig: {
151634
151683
  baseUrl: UrlString.make("https://test.huly.local"),
151635
151684
  workspaceUrlSlug: WorkspaceUrlSlug.make("test-workspace")
@@ -151696,6 +151745,7 @@ var connectRest = async (config3, sdk) => {
151696
151745
  return {
151697
151746
  client,
151698
151747
  accountUuid: account.uuid,
151748
+ primarySocialId: account.primarySocialId,
151699
151749
  workspaceUrlSlug: WorkspaceUrlSlug.make(info.workspaceUrl),
151700
151750
  markupOps,
151701
151751
  refUrl,
@@ -171276,7 +171326,7 @@ var PostHog = class extends PostHogBackendClient {
171276
171326
  };
171277
171327
 
171278
171328
  // src/version.ts
171279
- var VERSION = true ? "0.9.3" : "0.0.0-dev";
171329
+ var VERSION = true ? "0.10.1" : "0.0.0-dev";
171280
171330
 
171281
171331
  // src/telemetry/posthog.ts
171282
171332
  var POSTHOG_API_KEY = "phc_TGfFqCGdnF0p68wuFzd5WSw1IsBvOJW0YgoMJDyZPjm";
@@ -171418,8 +171468,11 @@ var INVALID_PARAMS_TAGS = /* @__PURE__ */ new Set([
171418
171468
  "CommentNotFoundError",
171419
171469
  "MilestoneNotFoundError",
171420
171470
  "ChannelNotFoundError",
171471
+ "DirectMessageIdentifierAmbiguousError",
171472
+ "DirectMessageNotFoundError",
171421
171473
  "MessageNotFoundError",
171422
171474
  "ThreadReplyNotFoundError",
171475
+ "CalendarNotAccessibleError",
171423
171476
  "EventNotFoundError",
171424
171477
  "RecurringEventNotFoundError",
171425
171478
  "ActivityMessageNotFoundError",
@@ -172635,7 +172688,7 @@ var listDirectMessages = (params) => Effect_exports.gen(function* () {
172635
172688
  const limit = clampLimit(params.limit);
172636
172689
  const dms = yield* client.findAll(
172637
172690
  chunter.class.DirectMessage,
172638
- {},
172691
+ { members: client.getAccountUuid() },
172639
172692
  {
172640
172693
  limit,
172641
172694
  sort: {
@@ -173564,6 +173617,10 @@ var GetEventParamsSchema = Schema_exports.Struct({
173564
173617
  title: "GetEventParams",
173565
173618
  description: "Parameters for getting a single event"
173566
173619
  });
173620
+ var ListCalendarsParamsSchema = EmptyParamsSchema.annotations({
173621
+ title: "ListCalendarsParams",
173622
+ description: "Parameters for listing writable calendar targets"
173623
+ });
173567
173624
  var CreateEventParamsSchema = Schema_exports.Struct({
173568
173625
  title: NonEmptyString2.annotations({
173569
173626
  description: "Event title"
@@ -173590,6 +173647,9 @@ var CreateEventParamsSchema = Schema_exports.Struct({
173590
173647
  ),
173591
173648
  visibility: Schema_exports.optional(VisibilitySchema.annotations({
173592
173649
  description: "Event visibility (public, freeBusy, private)"
173650
+ })),
173651
+ calendarId: Schema_exports.optional(CalendarId.annotations({
173652
+ description: "Target writable calendar ID. If omitted, uses the authenticated user's primary personal calendar. Use list_calendars to discover valid calendar IDs."
173593
173653
  }))
173594
173654
  }).annotations({
173595
173655
  title: "CreateEventParams",
@@ -173674,6 +173734,9 @@ var CreateRecurringEventParamsSchema = Schema_exports.Struct({
173674
173734
  })),
173675
173735
  visibility: Schema_exports.optional(VisibilitySchema.annotations({
173676
173736
  description: "Event visibility (public, freeBusy, private)"
173737
+ })),
173738
+ calendarId: Schema_exports.optional(CalendarId.annotations({
173739
+ description: "Target writable calendar ID. If omitted, uses the authenticated user's primary personal calendar. Use list_calendars to discover valid calendar IDs."
173677
173740
  }))
173678
173741
  }).annotations({
173679
173742
  title: "CreateRecurringEventParams",
@@ -173703,6 +173766,7 @@ var ListEventInstancesParamsSchema = Schema_exports.Struct({
173703
173766
  });
173704
173767
  var listEventsParamsJsonSchema = JSONSchema_exports.make(ListEventsParamsSchema);
173705
173768
  var getEventParamsJsonSchema = JSONSchema_exports.make(GetEventParamsSchema);
173769
+ var listCalendarsParamsJsonSchema = JSONSchema_exports.make(ListCalendarsParamsSchema);
173706
173770
  var createEventParamsJsonSchema = JSONSchema_exports.make(CreateEventParamsSchema);
173707
173771
  var updateEventParamsJsonSchema = JSONSchema_exports.make(UpdateEventParamsSchema);
173708
173772
  var deleteEventParamsJsonSchema = JSONSchema_exports.make(DeleteEventParamsSchema);
@@ -173711,6 +173775,7 @@ var createRecurringEventParamsJsonSchema = JSONSchema_exports.make(CreateRecurri
173711
173775
  var listEventInstancesParamsJsonSchema = JSONSchema_exports.make(ListEventInstancesParamsSchema);
173712
173776
  var parseListEventsParams = Schema_exports.decodeUnknown(ListEventsParamsSchema);
173713
173777
  var parseGetEventParams = Schema_exports.decodeUnknown(GetEventParamsSchema);
173778
+ var parseListCalendarsParams = Schema_exports.decodeUnknown(ListCalendarsParamsSchema);
173714
173779
  var parseCreateEventParams = Schema_exports.decodeUnknown(CreateEventParamsSchema);
173715
173780
  var parseUpdateEventParams = Schema_exports.decodeUnknown(UpdateEventParamsSchema);
173716
173781
  var parseDeleteEventParams = Schema_exports.decodeUnknown(DeleteEventParamsSchema);
@@ -173719,10 +173784,11 @@ var parseCreateRecurringEventParams = Schema_exports.decodeUnknown(CreateRecurri
173719
173784
  var parseListEventInstancesParams = Schema_exports.decodeUnknown(ListEventInstancesParamsSchema);
173720
173785
 
173721
173786
  // src/huly/operations/calendar.ts
173722
- var import_calendar2 = __toESM(require_lib25(), 1);
173787
+ var import_calendar3 = __toESM(require_lib25(), 1);
173723
173788
  var import_core25 = __toESM(require_lib4(), 1);
173724
173789
 
173725
173790
  // src/huly/operations/calendar-shared.ts
173791
+ var import_calendar = __toESM(require_lib25(), 1);
173726
173792
  var descriptionAsMarkupRef = (desc) => desc;
173727
173793
  var markupRefAsDescription = (ref) => ref ?? "";
173728
173794
  var emptyEventDescription = "";
@@ -173747,10 +173813,46 @@ var findPersonsByEmails = (client, emails) => Effect_exports.gen(function* () {
173747
173813
  );
173748
173814
  return persons;
173749
173815
  });
173750
- var getDefaultCalendar = (client) => client.findOne(
173816
+ var findWritablePersonalCalendars = (client) => client.findAll(
173751
173817
  calendar.class.Calendar,
173752
- {}
173818
+ {
173819
+ user: client.getPrimarySocialId(),
173820
+ hidden: false,
173821
+ access: { $in: [import_calendar.AccessLevel.Owner, import_calendar.AccessLevel.Writer] }
173822
+ }
173753
173823
  );
173824
+ var findWritableCalendars = (client) => client.findAll(
173825
+ calendar.class.Calendar,
173826
+ {
173827
+ hidden: false,
173828
+ access: { $in: [import_calendar.AccessLevel.Owner, import_calendar.AccessLevel.Writer] }
173829
+ }
173830
+ );
173831
+ var getDefaultCalendarRef = (client) => Effect_exports.gen(function* () {
173832
+ const calendars = yield* findWritablePersonalCalendars(client);
173833
+ const preference = yield* client.findOne(
173834
+ calendar.class.PrimaryCalendar,
173835
+ {}
173836
+ );
173837
+ return (0, import_calendar.getPrimaryCalendar)(calendars, preference, client.getAccountUuid());
173838
+ });
173839
+ var resolveCalendarRef = (client, calendarId) => Effect_exports.gen(function* () {
173840
+ if (calendarId === void 0) {
173841
+ return yield* getDefaultCalendarRef(client);
173842
+ }
173843
+ const cal = yield* client.findOne(
173844
+ calendar.class.Calendar,
173845
+ {
173846
+ _id: toRef(calendarId),
173847
+ hidden: false,
173848
+ access: { $in: [import_calendar.AccessLevel.Owner, import_calendar.AccessLevel.Writer] }
173849
+ }
173850
+ );
173851
+ if (cal === void 0) {
173852
+ return yield* new CalendarNotAccessibleError({ calendarId });
173853
+ }
173854
+ return cal._id;
173855
+ });
173754
173856
  var buildParticipants = (client, participantRefs) => Effect_exports.gen(function* () {
173755
173857
  if (participantRefs.length === 0) return [];
173756
173858
  const persons = yield* client.findAll(
@@ -173763,8 +173865,7 @@ var buildParticipants = (client, participantRefs) => Effect_exports.gen(function
173763
173865
  }));
173764
173866
  });
173765
173867
  var resolveEventInputs = (client, params, eventClass, eventId) => Effect_exports.gen(function* () {
173766
- const cal = yield* getDefaultCalendar(client);
173767
- const calendarRef = cal?._id ?? toRef("");
173868
+ const calendarRef = yield* resolveCalendarRef(client, params.calendarId);
173768
173869
  const participantRefs = params.participants && params.participants.length > 0 ? (yield* findPersonsByEmails(client, params.participants)).map((p) => p._id) : [];
173769
173870
  const descriptionRef = params.description && params.description.trim() !== "" ? yield* client.uploadMarkup(
173770
173871
  eventClass,
@@ -173777,7 +173878,7 @@ var resolveEventInputs = (client, params, eventClass, eventId) => Effect_exports
173777
173878
  });
173778
173879
 
173779
173880
  // src/huly/operations/calendar-recurring.ts
173780
- var import_calendar = __toESM(require_lib25(), 1);
173881
+ var import_calendar2 = __toESM(require_lib25(), 1);
173781
173882
  var import_core24 = __toESM(require_lib4(), 1);
173782
173883
  var hulyRuleToRule = (rule) => ({
173783
173884
  freq: rule.freq,
@@ -173827,7 +173928,7 @@ var listRecurringEvents = (params) => Effect_exports.gen(function* () {
173827
173928
  });
173828
173929
  var createRecurringEvent = (params) => Effect_exports.gen(function* () {
173829
173930
  const client = yield* HulyClient;
173830
- const eventId = (0, import_calendar.generateEventId)();
173931
+ const eventId = (0, import_calendar2.generateEventId)();
173831
173932
  const dueDate = params.dueDate ?? params.startDate + ONE_HOUR_MS;
173832
173933
  const { calendarRef, descriptionRef, participantRefs } = yield* resolveEventInputs(
173833
173934
  client,
@@ -173846,7 +173947,7 @@ var createRecurringEvent = (params) => Effect_exports.gen(function* () {
173846
173947
  calendar: calendarRef,
173847
173948
  participants: participantRefs,
173848
173949
  externalParticipants: [],
173849
- access: import_calendar.AccessLevel.Owner,
173950
+ access: import_calendar2.AccessLevel.Owner,
173850
173951
  user: serverPopulatedUser,
173851
173952
  blockTime: false,
173852
173953
  rules: hulyRules,
@@ -173936,6 +174037,17 @@ var listEventInstances = (params) => Effect_exports.gen(function* () {
173936
174037
  });
173937
174038
 
173938
174039
  // src/huly/operations/calendar.ts
174040
+ var toWritableCalendarAccess = (access) => {
174041
+ switch (access) {
174042
+ case import_calendar3.AccessLevel.Writer:
174043
+ return "writer";
174044
+ case import_calendar3.AccessLevel.Owner:
174045
+ return "owner";
174046
+ case import_calendar3.AccessLevel.FreeBusyReader:
174047
+ case import_calendar3.AccessLevel.Reader:
174048
+ return void 0;
174049
+ }
174050
+ };
173939
174051
  var listEvents = (params) => Effect_exports.gen(function* () {
173940
174052
  const client = yield* HulyClient;
173941
174053
  const query = {};
@@ -173965,6 +174077,24 @@ var listEvents = (params) => Effect_exports.gen(function* () {
173965
174077
  }));
173966
174078
  return summaries;
173967
174079
  });
174080
+ var listCalendars = (_params) => Effect_exports.gen(function* () {
174081
+ const client = yield* HulyClient;
174082
+ const calendars = yield* findWritableCalendars(client);
174083
+ const primaryCalendarRef = yield* getDefaultCalendarRef(client);
174084
+ return calendars.flatMap((cal) => {
174085
+ const access = toWritableCalendarAccess(cal.access);
174086
+ if (access === void 0) return [];
174087
+ return [{
174088
+ calendarId: CalendarId.make(cal._id),
174089
+ name: cal.name,
174090
+ hidden: cal.hidden,
174091
+ visibility: visibilityToString(cal.visibility) ?? "private",
174092
+ user: PersonId.make(cal.user),
174093
+ access,
174094
+ isPrimary: cal._id === primaryCalendarRef
174095
+ }];
174096
+ });
174097
+ });
173968
174098
  var getEvent = (params) => Effect_exports.gen(function* () {
173969
174099
  const client = yield* HulyClient;
173970
174100
  const event = yield* client.findOne(
@@ -173993,7 +174123,7 @@ var getEvent = (params) => Effect_exports.gen(function* () {
173993
174123
  visibility: visibilityToString(event.visibility),
173994
174124
  participants,
173995
174125
  externalParticipants: (event.externalParticipants || []).map((p) => Email.make(p)),
173996
- calendarId: event.calendar,
174126
+ calendarId: CalendarId.make(event.calendar),
173997
174127
  modifiedOn: event.modifiedOn,
173998
174128
  createdOn: event.createdOn
173999
174129
  };
@@ -174001,7 +174131,7 @@ var getEvent = (params) => Effect_exports.gen(function* () {
174001
174131
  });
174002
174132
  var createEvent = (params) => Effect_exports.gen(function* () {
174003
174133
  const client = yield* HulyClient;
174004
- const eventId = (0, import_calendar2.generateEventId)();
174134
+ const eventId = (0, import_calendar3.generateEventId)();
174005
174135
  const dueDate = params.dueDate ?? params.date + ONE_HOUR_MS;
174006
174136
  const { calendarRef, descriptionRef, participantRefs } = yield* resolveEventInputs(
174007
174137
  client,
@@ -174019,7 +174149,7 @@ var createEvent = (params) => Effect_exports.gen(function* () {
174019
174149
  calendar: calendarRef,
174020
174150
  participants: participantRefs,
174021
174151
  externalParticipants: [],
174022
- access: import_calendar2.AccessLevel.Owner,
174152
+ access: import_calendar3.AccessLevel.Owner,
174023
174153
  user: serverPopulatedUser,
174024
174154
  blockTime: false
174025
174155
  };
@@ -174141,6 +174271,17 @@ var calendarTools = [
174141
174271
  listEvents
174142
174272
  )
174143
174273
  },
174274
+ {
174275
+ name: "list_calendars",
174276
+ description: "List writable, non-hidden calendars that can be used as create_event or create_recurring_event targets. Use this before creating events when you need to choose a target calendarId explicitly.",
174277
+ category: CATEGORY3,
174278
+ inputSchema: listCalendarsParamsJsonSchema,
174279
+ handler: createToolHandler(
174280
+ "list_calendars",
174281
+ parseListCalendarsParams,
174282
+ listCalendars
174283
+ )
174284
+ },
174144
174285
  {
174145
174286
  name: "get_event",
174146
174287
  description: "Retrieve full details for a calendar event including description. Use this to view event content and metadata.",
@@ -174154,7 +174295,7 @@ var calendarTools = [
174154
174295
  },
174155
174296
  {
174156
174297
  name: "create_event",
174157
- description: "Create a new calendar event. Description supports markdown formatting. Returns the created event ID.",
174298
+ description: "Create a new calendar event. Description supports markdown formatting. Optional calendarId targets a specific calendar; when omitted, the event uses the authenticated user's primary personal calendar. Returns the created event ID.",
174158
174299
  category: CATEGORY3,
174159
174300
  inputSchema: createEventParamsJsonSchema,
174160
174301
  handler: createToolHandler(
@@ -174198,7 +174339,7 @@ var calendarTools = [
174198
174339
  },
174199
174340
  {
174200
174341
  name: "create_recurring_event",
174201
- description: "Create a new recurring calendar event with RFC5545 RRULE rules. Description supports markdown. Returns the created event ID.",
174342
+ description: "Create a new recurring calendar event with RFC5545 RRULE rules. Description supports markdown. Optional calendarId targets a specific calendar; when omitted, the event uses the authenticated user's primary personal calendar. Returns the created event ID.",
174202
174343
  category: CATEGORY3,
174203
174344
  inputSchema: createRecurringEventParamsJsonSchema,
174204
174345
  handler: createToolHandler(
@@ -176466,6 +176607,65 @@ var parseAddThreadReplyParams = Schema_exports.decodeUnknown(AddThreadReplyParam
176466
176607
  var parseUpdateThreadReplyParams = Schema_exports.decodeUnknown(UpdateThreadReplyParamsSchema);
176467
176608
  var parseDeleteThreadReplyParams = Schema_exports.decodeUnknown(DeleteThreadReplyParamsSchema);
176468
176609
 
176610
+ // src/domain/schemas/direct-messages.ts
176611
+ var ListDmMessagesParamsSchema = Schema_exports.Struct({
176612
+ dm: DirectMessageIdentifier.annotations({
176613
+ description: "Direct-message conversation: either the DM `_id` or a participant display name (e.g. `Kerr,Shannon`). A participant name resolves only to a one-to-one DM with the authenticated account."
176614
+ }),
176615
+ limit: Schema_exports.optional(
176616
+ LimitParam.annotations({
176617
+ description: "Maximum number of messages to return (default: 50)"
176618
+ })
176619
+ )
176620
+ }).annotations({
176621
+ title: "ListDmMessagesParams",
176622
+ description: "Parameters for listing messages in a direct-message conversation"
176623
+ });
176624
+ var SendDmMessageParamsSchema = Schema_exports.Struct({
176625
+ dm: DirectMessageIdentifier.annotations({
176626
+ description: "Direct-message conversation: either the DM `_id` or a participant display name (e.g. `Kerr,Shannon`). A participant name resolves only to a one-to-one DM with the authenticated account."
176627
+ }),
176628
+ body: NonEmptyString2.annotations({
176629
+ description: "Message body (markdown supported)"
176630
+ })
176631
+ }).annotations({
176632
+ title: "SendDmMessageParams",
176633
+ description: "Parameters for sending a message to a direct-message conversation"
176634
+ });
176635
+ var UpdateDmMessageParamsSchema = Schema_exports.Struct({
176636
+ dm: DirectMessageIdentifier.annotations({
176637
+ description: "Direct-message conversation: either the DM `_id` or a participant display name. A participant name resolves only to a one-to-one DM with the authenticated account."
176638
+ }),
176639
+ messageId: MessageId.annotations({
176640
+ description: "Message ID to update"
176641
+ }),
176642
+ body: NonEmptyString2.annotations({
176643
+ description: "New message body (markdown supported)"
176644
+ })
176645
+ }).annotations({
176646
+ title: "UpdateDmMessageParams",
176647
+ description: "Parameters for updating a direct-message message"
176648
+ });
176649
+ var DeleteDmMessageParamsSchema = Schema_exports.Struct({
176650
+ dm: DirectMessageIdentifier.annotations({
176651
+ description: "Direct-message conversation: either the DM `_id` or a participant display name. A participant name resolves only to a one-to-one DM with the authenticated account."
176652
+ }),
176653
+ messageId: MessageId.annotations({
176654
+ description: "Message ID to delete"
176655
+ })
176656
+ }).annotations({
176657
+ title: "DeleteDmMessageParams",
176658
+ description: "Parameters for deleting a direct-message message"
176659
+ });
176660
+ var listDmMessagesParamsJsonSchema = JSONSchema_exports.make(ListDmMessagesParamsSchema);
176661
+ var sendDmMessageParamsJsonSchema = JSONSchema_exports.make(SendDmMessageParamsSchema);
176662
+ var updateDmMessageParamsJsonSchema = JSONSchema_exports.make(UpdateDmMessageParamsSchema);
176663
+ var deleteDmMessageParamsJsonSchema = JSONSchema_exports.make(DeleteDmMessageParamsSchema);
176664
+ var parseListDmMessagesParams = Schema_exports.decodeUnknown(ListDmMessagesParamsSchema);
176665
+ var parseSendDmMessageParams = Schema_exports.decodeUnknown(SendDmMessageParamsSchema);
176666
+ var parseUpdateDmMessageParams = Schema_exports.decodeUnknown(UpdateDmMessageParamsSchema);
176667
+ var parseDeleteDmMessageParams = Schema_exports.decodeUnknown(DeleteDmMessageParamsSchema);
176668
+
176469
176669
  // src/domain/schemas/time.ts
176470
176670
  var LogTimeParamsSchema = Schema_exports.Struct({
176471
176671
  project: ProjectIdentifier.annotations({
@@ -177888,8 +178088,147 @@ var cardTools = [
177888
178088
  }
177889
178089
  ];
177890
178090
 
177891
- // src/huly/operations/threads.ts
178091
+ // src/huly/operations/direct-messages.ts
177892
178092
  var import_core27 = __toESM(require_lib4(), 1);
178093
+ var ONE_TO_ONE_DM_MEMBER_COUNT = 2;
178094
+ var findDirectMessage = (identifier2) => Effect_exports.gen(function* () {
178095
+ const client = yield* HulyClient;
178096
+ const byId = yield* client.findOne(
178097
+ chunter.class.DirectMessage,
178098
+ { _id: toRef(identifier2) }
178099
+ );
178100
+ if (byId !== void 0) {
178101
+ if (!byId.members.includes(client.getAccountUuid())) {
178102
+ return yield* new DirectMessageNotFoundError({ identifier: identifier2 });
178103
+ }
178104
+ return { client, dm: byId };
178105
+ }
178106
+ const employees = yield* client.findAll(
178107
+ contact.mixin.Employee,
178108
+ { name: identifier2 }
178109
+ );
178110
+ const accountUuid = client.getAccountUuid();
178111
+ const accountUuids = [
178112
+ ...new Set(
178113
+ employees.map((e) => e.personUuid).filter((u) => u !== void 0 && u !== accountUuid)
178114
+ )
178115
+ ];
178116
+ if (accountUuids.length === 0) {
178117
+ return yield* new DirectMessageNotFoundError({ identifier: identifier2 });
178118
+ }
178119
+ const directMessages = yield* client.findAll(
178120
+ chunter.class.DirectMessage,
178121
+ { members: accountUuid }
178122
+ );
178123
+ const matches = directMessages.filter(
178124
+ (dm) => dm.members.length === ONE_TO_ONE_DM_MEMBER_COUNT && dm.members.includes(accountUuid) && accountUuids.some((candidate) => dm.members.includes(candidate))
178125
+ );
178126
+ if (matches.length === 0) {
178127
+ return yield* new DirectMessageNotFoundError({ identifier: identifier2 });
178128
+ }
178129
+ if (matches.length > 1) {
178130
+ return yield* new DirectMessageIdentifierAmbiguousError({ identifier: identifier2, matches: matches.length });
178131
+ }
178132
+ return { client, dm: matches[0] };
178133
+ });
178134
+ var findDirectMessageMessage = (params) => Effect_exports.gen(function* () {
178135
+ const { client, dm } = yield* findDirectMessage(params.dm);
178136
+ const message = yield* client.findOne(
178137
+ chunter.class.ChatMessage,
178138
+ {
178139
+ _id: toRef(params.messageId),
178140
+ space: dm._id
178141
+ }
178142
+ );
178143
+ if (message === void 0) {
178144
+ return yield* new MessageNotFoundError({
178145
+ messageId: params.messageId,
178146
+ channel: params.dm
178147
+ });
178148
+ }
178149
+ return { client, dm, message };
178150
+ });
178151
+ var listDirectMessageMessages = (params) => Effect_exports.gen(function* () {
178152
+ const { client, dm } = yield* findDirectMessage(params.dm);
178153
+ const markupUrlConfig = client.markupUrlConfig;
178154
+ const limit = clampLimit(params.limit);
178155
+ const messages = yield* client.findAll(
178156
+ chunter.class.ChatMessage,
178157
+ { space: dm._id },
178158
+ {
178159
+ limit,
178160
+ sort: { createdOn: import_core27.SortingOrder.Descending }
178161
+ }
178162
+ );
178163
+ const total = messages.total;
178164
+ const uniqueSocialIds = [
178165
+ ...new Set(messages.map((msg) => msg.modifiedBy))
178166
+ ];
178167
+ const socialIdToName = yield* buildSocialIdToPersonNameMap(client, uniqueSocialIds);
178168
+ const summaries = messages.map((msg) => {
178169
+ const senderName = socialIdToName.get(msg.modifiedBy);
178170
+ return {
178171
+ id: MessageId.make(msg._id),
178172
+ body: markupToMarkdownString(msg.message, markupUrlConfig),
178173
+ sender: senderName !== void 0 ? PersonName.make(senderName) : void 0,
178174
+ senderId: msg.modifiedBy,
178175
+ createdOn: msg.createdOn,
178176
+ modifiedOn: msg.modifiedOn,
178177
+ editedOn: msg.editedOn,
178178
+ replies: msg.replies
178179
+ };
178180
+ });
178181
+ return { messages: summaries, total };
178182
+ });
178183
+ var sendDirectMessage = (params) => Effect_exports.gen(function* () {
178184
+ const { client, dm } = yield* findDirectMessage(params.dm);
178185
+ const markupUrlConfig = client.markupUrlConfig;
178186
+ const messageId = (0, import_core27.generateId)();
178187
+ const markup = markdownToMarkupString(params.body, markupUrlConfig);
178188
+ const messageData = {
178189
+ message: markup,
178190
+ attachments: 0
178191
+ };
178192
+ yield* client.addCollection(
178193
+ chunter.class.ChatMessage,
178194
+ dm._id,
178195
+ dm._id,
178196
+ chunter.class.DirectMessage,
178197
+ "messages",
178198
+ messageData,
178199
+ messageId
178200
+ );
178201
+ return { id: MessageId.make(messageId), dmId: ChannelId.make(dm._id) };
178202
+ });
178203
+ var updateDirectMessage = (params) => Effect_exports.gen(function* () {
178204
+ const { client, dm, message } = yield* findDirectMessageMessage(params);
178205
+ const markupUrlConfig = client.markupUrlConfig;
178206
+ const markup = markdownToMarkupString(params.body, markupUrlConfig);
178207
+ const now2 = yield* Clock_exports.currentTimeMillis;
178208
+ const updateOps = {
178209
+ message: markup,
178210
+ editedOn: now2
178211
+ };
178212
+ yield* client.updateDoc(
178213
+ chunter.class.ChatMessage,
178214
+ dm._id,
178215
+ message._id,
178216
+ updateOps
178217
+ );
178218
+ return { id: MessageId.make(message._id), updated: true };
178219
+ });
178220
+ var deleteDirectMessage = (params) => Effect_exports.gen(function* () {
178221
+ const { client, dm, message } = yield* findDirectMessageMessage(params);
178222
+ yield* client.removeDoc(
178223
+ chunter.class.ChatMessage,
178224
+ dm._id,
178225
+ message._id
178226
+ );
178227
+ return { id: MessageId.make(message._id), deleted: true };
178228
+ });
178229
+
178230
+ // src/huly/operations/threads.ts
178231
+ var import_core28 = __toESM(require_lib4(), 1);
177893
178232
  var findReply = (client, channel, message, replyId) => Effect_exports.gen(function* () {
177894
178233
  const reply = yield* client.findOne(
177895
178234
  chunter.class.ThreadMessage,
@@ -177920,7 +178259,7 @@ var listThreadReplies = (params) => Effect_exports.gen(function* () {
177920
178259
  {
177921
178260
  limit,
177922
178261
  sort: {
177923
- createdOn: import_core27.SortingOrder.Ascending
178262
+ createdOn: import_core28.SortingOrder.Ascending
177924
178263
  }
177925
178264
  }
177926
178265
  );
@@ -177948,7 +178287,7 @@ var listThreadReplies = (params) => Effect_exports.gen(function* () {
177948
178287
  var addThreadReply = (params) => Effect_exports.gen(function* () {
177949
178288
  const { channel, client, message } = yield* findChannelMessage(params);
177950
178289
  const markupUrlConfig = client.markupUrlConfig;
177951
- const replyId = (0, import_core27.generateId)();
178290
+ const replyId = (0, import_core28.generateId)();
177952
178291
  const markup = markdownToMarkupString(params.body, markupUrlConfig);
177953
178292
  const replyData = {
177954
178293
  message: markup,
@@ -178113,6 +178452,50 @@ var channelTools = [
178113
178452
  listDirectMessages
178114
178453
  )
178115
178454
  },
178455
+ {
178456
+ name: "list_dm_messages",
178457
+ description: "List messages in a direct-message conversation, newest first. The `dm` argument accepts either the DM `_id` or a participant display name (e.g. `Kerr,Shannon`); a name resolves only to a one-to-one DM with the authenticated account.",
178458
+ category: CATEGORY5,
178459
+ inputSchema: listDmMessagesParamsJsonSchema,
178460
+ handler: createToolHandler(
178461
+ "list_dm_messages",
178462
+ parseListDmMessagesParams,
178463
+ listDirectMessageMessages
178464
+ )
178465
+ },
178466
+ {
178467
+ name: "send_dm_message",
178468
+ description: "Send a message to a direct-message conversation. The `dm` argument accepts either the DM `_id` or a participant display name; a name resolves only to a one-to-one DM with the authenticated account. Message body supports markdown formatting.",
178469
+ category: CATEGORY5,
178470
+ inputSchema: sendDmMessageParamsJsonSchema,
178471
+ handler: createToolHandler(
178472
+ "send_dm_message",
178473
+ parseSendDmMessageParams,
178474
+ sendDirectMessage
178475
+ )
178476
+ },
178477
+ {
178478
+ name: "update_dm_message",
178479
+ description: "Update a direct-message message. The `dm` argument accepts either the DM `_id` or a participant display name; a name resolves only to a one-to-one DM with the authenticated account. Only the body can be modified.",
178480
+ category: CATEGORY5,
178481
+ inputSchema: updateDmMessageParamsJsonSchema,
178482
+ handler: createToolHandler(
178483
+ "update_dm_message",
178484
+ parseUpdateDmMessageParams,
178485
+ updateDirectMessage
178486
+ )
178487
+ },
178488
+ {
178489
+ name: "delete_dm_message",
178490
+ description: "Permanently delete a direct-message message. The `dm` argument accepts either the DM `_id` or a participant display name; a name resolves only to a one-to-one DM with the authenticated account. This action cannot be undone.",
178491
+ category: CATEGORY5,
178492
+ inputSchema: deleteDmMessageParamsJsonSchema,
178493
+ handler: createToolHandler(
178494
+ "delete_dm_message",
178495
+ parseDeleteDmMessageParams,
178496
+ deleteDirectMessage
178497
+ )
178498
+ },
178116
178499
  {
178117
178500
  name: "list_thread_replies",
178118
178501
  description: "List replies in a message thread. Returns replies sorted by date (oldest first).",
@@ -178160,7 +178543,7 @@ var channelTools = [
178160
178543
  ];
178161
178544
 
178162
178545
  // src/huly/operations/comments.ts
178163
- var import_core28 = __toESM(require_lib4(), 1);
178546
+ var import_core29 = __toESM(require_lib4(), 1);
178164
178547
  var findProjectAndIssue2 = (params) => findProjectAndIssue({ project: params.project, identifier: params.issueIdentifier });
178165
178548
  var findComment = (params) => Effect_exports.gen(function* () {
178166
178549
  const { client, issue: issue2, project: project3 } = yield* findProjectAndIssue2({
@@ -178199,7 +178582,7 @@ var listComments = (params) => Effect_exports.gen(function* () {
178199
178582
  {
178200
178583
  limit,
178201
178584
  sort: {
178202
- createdOn: import_core28.SortingOrder.Ascending
178585
+ createdOn: import_core29.SortingOrder.Ascending
178203
178586
  }
178204
178587
  }
178205
178588
  );
@@ -178228,7 +178611,7 @@ var addComment = (params) => Effect_exports.gen(function* () {
178228
178611
  issueIdentifier: params.issueIdentifier
178229
178612
  });
178230
178613
  const markupUrlConfig = client.markupUrlConfig;
178231
- const commentId = (0, import_core28.generateId)();
178614
+ const commentId = (0, import_core29.generateId)();
178232
178615
  const commentData = {
178233
178616
  message: markdownToMarkupString(params.body, markupUrlConfig)
178234
178617
  };
@@ -178339,7 +178722,7 @@ var commentTools = [
178339
178722
 
178340
178723
  // src/huly/operations/organizations.ts
178341
178724
  var import_contact = __toESM(require_lib28(), 1);
178342
- var import_core30 = __toESM(require_lib4(), 1);
178725
+ var import_core31 = __toESM(require_lib4(), 1);
178343
178726
 
178344
178727
  // src/huly/lead-plugin.ts
178345
178728
  var leadRef = (identifier2) => identifier2;
@@ -178355,7 +178738,7 @@ var leadClassIds = {
178355
178738
  };
178356
178739
 
178357
178740
  // src/huly/operations/contacts-shared.ts
178358
- var import_core29 = __toESM(require_lib4(), 1);
178741
+ var import_core30 = __toESM(require_lib4(), 1);
178359
178742
  var findPersonById = (client, personId) => client.findOne(
178360
178743
  contact.class.Person,
178361
178744
  { _id: toRef(personId) }
@@ -178400,7 +178783,7 @@ var findPersonBySocialIdentityEmail = (client, email3) => Effect_exports.gen(fun
178400
178783
  const identity5 = yield* client.findOne(
178401
178784
  contact.class.SocialIdentity,
178402
178785
  {
178403
- type: import_core29.SocialIdType.EMAIL,
178786
+ type: import_core30.SocialIdType.EMAIL,
178404
178787
  value: email3
178405
178788
  }
178406
178789
  );
@@ -178502,7 +178885,7 @@ var listOrganizations = (params) => Effect_exports.gen(function* () {
178502
178885
  {},
178503
178886
  {
178504
178887
  limit,
178505
- sort: { modifiedOn: import_core30.SortingOrder.Descending }
178888
+ sort: { modifiedOn: import_core31.SortingOrder.Descending }
178506
178889
  }
178507
178890
  );
178508
178891
  return orgs.map((org) => ({
@@ -178515,7 +178898,7 @@ var listOrganizations = (params) => Effect_exports.gen(function* () {
178515
178898
  });
178516
178899
  var createOrganization = (params) => Effect_exports.gen(function* () {
178517
178900
  const client = yield* HulyClient;
178518
- const orgId = (0, import_core30.generateId)();
178901
+ const orgId = (0, import_core31.generateId)();
178519
178902
  const memberPersonIds = params.members !== void 0 && params.members.length > 0 ? yield* resolvePersonIdentifiers(client, params.members) : [];
178520
178903
  const orgData = {
178521
178904
  name: params.name,
@@ -178748,7 +179131,7 @@ var removeOrganizationMember = (params) => Effect_exports.gen(function* () {
178748
179131
 
178749
179132
  // src/huly/operations/persons.ts
178750
179133
  var import_contact2 = __toESM(require_lib28(), 1);
178751
- var import_core31 = __toESM(require_lib4(), 1);
179134
+ var import_core32 = __toESM(require_lib4(), 1);
178752
179135
  var formatName = (firstName, lastName) => `${lastName},${firstName}`;
178753
179136
  var parseName = (name) => {
178754
179137
  const parts2 = name.split(",");
@@ -178809,7 +179192,7 @@ var listPersons = (params) => Effect_exports.gen(function* () {
178809
179192
  query,
178810
179193
  {
178811
179194
  limit,
178812
- sort: { modifiedOn: import_core31.SortingOrder.Descending }
179195
+ sort: { modifiedOn: import_core32.SortingOrder.Descending }
178813
179196
  }
178814
179197
  );
178815
179198
  const personIds = persons.map((p) => p._id);
@@ -178860,7 +179243,7 @@ var getPerson = (params) => Effect_exports.gen(function* () {
178860
179243
  });
178861
179244
  var createPerson = (params) => Effect_exports.gen(function* () {
178862
179245
  const client = yield* HulyClient;
178863
- const personId = (0, import_core31.generateId)();
179246
+ const personId = (0, import_core32.generateId)();
178864
179247
  const personData = {
178865
179248
  name: formatName(params.firstName, params.lastName),
178866
179249
  // Huly API requires city field to be set, even if empty
@@ -178936,7 +179319,7 @@ var listEmployees = (params) => Effect_exports.gen(function* () {
178936
179319
  {},
178937
179320
  {
178938
179321
  limit,
178939
- sort: { modifiedOn: import_core31.SortingOrder.Descending }
179322
+ sort: { modifiedOn: import_core32.SortingOrder.Descending }
178940
179323
  }
178941
179324
  );
178942
179325
  const employeeIds = employees.map((e) => e._id);
@@ -179160,7 +179543,7 @@ var contactTools = [
179160
179543
  ];
179161
179544
 
179162
179545
  // src/huly/operations/custom-fields.ts
179163
- var import_core32 = __toESM(require_lib4(), 1);
179546
+ var import_core33 = __toESM(require_lib4(), 1);
179164
179547
  var DEFAULT_LIMIT2 = 200;
179165
179548
  var classRef = core.class.Class;
179166
179549
  var extractLabel = (label) => {
@@ -179195,7 +179578,7 @@ var decodeCustomFieldAttribute = (attr) => ({
179195
179578
  });
179196
179579
  var decodeClassInfo = (value3) => {
179197
179580
  const record4 = decodeSdkRecord(value3);
179198
- const kind = typeof record4.kind === "number" ? record4.kind : import_core32.ClassifierKind.CLASS;
179581
+ const kind = typeof record4.kind === "number" ? record4.kind : import_core33.ClassifierKind.CLASS;
179199
179582
  return {
179200
179583
  label: extractLabel(record4.label),
179201
179584
  kind
@@ -179210,7 +179593,7 @@ var resolveClassInfo = (client, classId) => Effect_exports.gen(function* () {
179210
179593
  classRef,
179211
179594
  { _id: toRef(classId) }
179212
179595
  );
179213
- return cls !== void 0 ? decodeClassInfo(cls) : { label: classId, kind: import_core32.ClassifierKind.CLASS };
179596
+ return cls !== void 0 ? decodeClassInfo(cls) : { label: classId, kind: import_core33.ClassifierKind.CLASS };
179214
179597
  });
179215
179598
  var batchResolveClassLabels = (client, classIds) => Effect_exports.gen(function* () {
179216
179599
  if (classIds.length === 0) return /* @__PURE__ */ new Map();
@@ -179293,7 +179676,7 @@ var listCustomFields = (params) => Effect_exports.gen(function* () {
179293
179676
  const customAttrs = yield* client.findAll(
179294
179677
  core.class.Attribute,
179295
179678
  query,
179296
- { limit, sort: { modifiedOn: import_core32.SortingOrder.Descending } }
179679
+ { limit, sort: { modifiedOn: import_core33.SortingOrder.Descending } }
179297
179680
  );
179298
179681
  const decodedAttrs = customAttrs.map(decodeCustomFieldAttribute);
179299
179682
  const ownerLabels = yield* batchResolveClassLabels(
@@ -179349,7 +179732,7 @@ var setCustomField = (params) => Effect_exports.gen(function* () {
179349
179732
  const parsedValue = parseValueForType(params.value, decodedAttr.typeDescriptor.typeName);
179350
179733
  const decodedDoc = decodeCustomFieldDocument(doc);
179351
179734
  const ownerInfo = yield* resolveClassInfo(client, decodedAttr.ownerClassId);
179352
- if (ownerInfo.kind === import_core32.ClassifierKind.MIXIN) {
179735
+ if (ownerInfo.kind === import_core33.ClassifierKind.MIXIN) {
179353
179736
  const mixinRef = toRef(decodedAttr.ownerClassId);
179354
179737
  yield* client.updateMixin(
179355
179738
  objectRef,
@@ -179419,7 +179802,7 @@ var customFieldTools = [
179419
179802
  ];
179420
179803
 
179421
179804
  // src/huly/operations/components.ts
179422
- var import_core33 = __toESM(require_lib4(), 1);
179805
+ var import_core34 = __toESM(require_lib4(), 1);
179423
179806
 
179424
179807
  // src/utils/assertions.ts
179425
179808
  var AssertionError = class extends Error {
@@ -179473,7 +179856,7 @@ var listComponents = (params) => Effect_exports.gen(function* () {
179473
179856
  { space: project3._id },
179474
179857
  {
179475
179858
  limit,
179476
- sort: { modifiedOn: import_core33.SortingOrder.Descending }
179859
+ sort: { modifiedOn: import_core34.SortingOrder.Descending }
179477
179860
  }
179478
179861
  );
179479
179862
  const leadIds = [
@@ -179515,7 +179898,7 @@ var getComponent = (params) => Effect_exports.gen(function* () {
179515
179898
  var createComponent = (params) => Effect_exports.gen(function* () {
179516
179899
  const { client, project: project3 } = yield* findProject(params.project);
179517
179900
  const markupUrlConfig = client.markupUrlConfig;
179518
- const componentId = (0, import_core33.generateId)();
179901
+ const componentId = (0, import_core34.generateId)();
179519
179902
  const leadParam = params.lead;
179520
179903
  const leadRef2 = leadParam !== void 0 ? yield* Effect_exports.gen(function* () {
179521
179904
  const person = yield* findPersonByEmailOrName(client, leadParam);
@@ -180171,10 +180554,10 @@ var unlinkDocumentFromIssue = (params) => Effect_exports.gen(function* () {
180171
180554
  });
180172
180555
 
180173
180556
  // src/huly/operations/issue-templates.ts
180174
- var import_core37 = __toESM(require_lib4(), 1);
180557
+ var import_core38 = __toESM(require_lib4(), 1);
180175
180558
 
180176
180559
  // src/huly/operations/issues-move.ts
180177
- var import_core34 = __toESM(require_lib4(), 1);
180560
+ var import_core35 = __toESM(require_lib4(), 1);
180178
180561
  var import_tracker2 = __toESM(require_lib36(), 1);
180179
180562
  var addLabel = (params) => Effect_exports.gen(function* () {
180180
180563
  const { client, issue: issue2, project: project3 } = yield* findProjectAndIssue(params);
@@ -180201,7 +180584,7 @@ var addLabel = (params) => Effect_exports.gen(function* () {
180201
180584
  }
180202
180585
  );
180203
180586
  if (tagElement === void 0) {
180204
- const tagElementId = (0, import_core34.generateId)();
180587
+ const tagElementId = (0, import_core35.generateId)();
180205
180588
  const tagElementData = {
180206
180589
  title: labelTitle,
180207
180590
  description: "",
@@ -180334,7 +180717,7 @@ var updateDescendantParents = (client, spaceId, parentIssue, parentNewParents) =
180334
180717
  });
180335
180718
 
180336
180719
  // src/huly/operations/issues-read.ts
180337
- var import_core35 = __toESM(require_lib4(), 1);
180720
+ var import_core36 = __toESM(require_lib4(), 1);
180338
180721
  var import_tracker3 = __toESM(require_lib36(), 1);
180339
180722
  var resolveStatusName = (statuses, statusId) => {
180340
180723
  const statusDoc = statuses.find((s) => s._id === statusId);
@@ -180425,7 +180808,7 @@ var listIssues = (params) => Effect_exports.gen(function* () {
180425
180808
  {
180426
180809
  limit,
180427
180810
  sort: {
180428
- modifiedOn: import_core35.SortingOrder.Descending
180811
+ modifiedOn: import_core36.SortingOrder.Descending
180429
180812
  }
180430
180813
  },
180431
180814
  { assignee: contact.class.Person }
@@ -180505,7 +180888,7 @@ var getIssue = (params) => Effect_exports.gen(function* () {
180505
180888
  });
180506
180889
 
180507
180890
  // src/huly/operations/issues-write.ts
180508
- var import_core36 = __toESM(require_lib4(), 1);
180891
+ var import_core37 = __toESM(require_lib4(), 1);
180509
180892
  var import_rank3 = __toESM(require_lib33(), 1);
180510
180893
  var import_tracker4 = __toESM(require_lib36(), 1);
180511
180894
  var TxIncResult = Schema_exports.Struct({
@@ -180526,7 +180909,7 @@ var resolveAssignee = (client, assigneeIdentifier) => Effect_exports.gen(functio
180526
180909
  });
180527
180910
  var createIssue = (params) => Effect_exports.gen(function* () {
180528
180911
  const { client, defaultStatusId, project: project3, statuses } = yield* findProjectWithStatuses(params.project);
180529
- const issueId = (0, import_core36.generateId)();
180912
+ const issueId = (0, import_core37.generateId)();
180530
180913
  const incOps = { $inc: { sequence: 1 } };
180531
180914
  const incResult = yield* client.updateDoc(
180532
180915
  tracker.class.Project,
@@ -180541,7 +180924,7 @@ var createIssue = (params) => Effect_exports.gen(function* () {
180541
180924
  const lastIssue = yield* client.findOne(
180542
180925
  tracker.class.Issue,
180543
180926
  { space: project3._id },
180544
- { sort: { rank: import_core36.SortingOrder.Descending } }
180927
+ { sort: { rank: import_core37.SortingOrder.Descending } }
180545
180928
  );
180546
180929
  const rank = (0, import_rank3.makeRank)(lastIssue?.rank, void 0);
180547
180930
  const descriptionMarkupRef = params.description !== void 0 && params.description.trim() !== "" ? yield* client.uploadMarkup(
@@ -180745,7 +181128,7 @@ var buildTemplateChild = (client, markupUrlConfig, projectId, projectIdentifier,
180745
181128
  return component._id;
180746
181129
  }) : null;
180747
181130
  return {
180748
- id: (0, import_core37.generateId)(),
181131
+ id: (0, import_core38.generateId)(),
180749
181132
  title: input.title,
180750
181133
  description: optionalMarkdownToMarkup(input.description, markupUrlConfig, ""),
180751
181134
  priority: stringToPriority(input.priority || "no-priority"),
@@ -180762,7 +181145,7 @@ var listIssueTemplates = (params) => Effect_exports.gen(function* () {
180762
181145
  { space: project3._id },
180763
181146
  {
180764
181147
  limit,
180765
- sort: { modifiedOn: import_core37.SortingOrder.Descending }
181148
+ sort: { modifiedOn: import_core38.SortingOrder.Descending }
180766
181149
  }
180767
181150
  );
180768
181151
  const summaries = templates.map((t) => {
@@ -180808,7 +181191,7 @@ var getIssueTemplate = (params) => Effect_exports.gen(function* () {
180808
181191
  var createIssueTemplate = (params) => Effect_exports.gen(function* () {
180809
181192
  const { client, project: project3 } = yield* findProject(params.project);
180810
181193
  const markupUrlConfig = client.markupUrlConfig;
180811
- const templateId = (0, import_core37.generateId)();
181194
+ const templateId = (0, import_core38.generateId)();
180812
181195
  const assigneeParam = params.assignee;
180813
181196
  const assigneeRef = assigneeParam !== void 0 ? yield* Effect_exports.gen(function* () {
180814
181197
  const person = yield* findPersonByEmailOrName(client, assigneeParam);
@@ -181045,10 +181428,10 @@ var removeTemplateChild = (params) => Effect_exports.gen(function* () {
181045
181428
  });
181046
181429
 
181047
181430
  // src/huly/operations/labels.ts
181048
- var import_core39 = __toESM(require_lib4(), 1);
181431
+ var import_core40 = __toESM(require_lib4(), 1);
181049
181432
 
181050
181433
  // src/huly/operations/tag-categories.ts
181051
- var import_core38 = __toESM(require_lib4(), 1);
181434
+ var import_core39 = __toESM(require_lib4(), 1);
181052
181435
  var issueClassRef = toRef(tracker.class.Issue);
181053
181436
  var findCategoryByIdOrLabel = (client, idOrLabel) => Effect_exports.gen(function* () {
181054
181437
  const cat = (yield* client.findOne(
@@ -181086,7 +181469,7 @@ var listTagCategories = (params) => Effect_exports.gen(function* () {
181086
181469
  query,
181087
181470
  {
181088
181471
  limit,
181089
- sort: { modifiedOn: import_core38.SortingOrder.Descending }
181472
+ sort: { modifiedOn: import_core39.SortingOrder.Descending }
181090
181473
  }
181091
181474
  );
181092
181475
  return categories.map(toSummary);
@@ -181101,7 +181484,7 @@ var createTagCategory = (params) => Effect_exports.gen(function* () {
181101
181484
  if (existing !== void 0) {
181102
181485
  return { id: TagCategoryId.make(existing._id), label: existing.label, created: false };
181103
181486
  }
181104
- const catId = (0, import_core38.generateId)();
181487
+ const catId = (0, import_core39.generateId)();
181105
181488
  const catData = {
181106
181489
  // Asset is a branded string type (Metadata<URL>) with no runtime constructor.
181107
181490
  // Empty string is the "no icon" sentinel; Huly UI renders a default icon.
@@ -181203,7 +181586,7 @@ var listLabels = (params) => Effect_exports.gen(function* () {
181203
181586
  query,
181204
181587
  {
181205
181588
  limit,
181206
- sort: { modifiedOn: import_core39.SortingOrder.Descending }
181589
+ sort: { modifiedOn: import_core40.SortingOrder.Descending }
181207
181590
  }
181208
181591
  );
181209
181592
  return elements.map((e) => ({
@@ -181228,7 +181611,7 @@ var createLabel = (params) => Effect_exports.gen(function* () {
181228
181611
  return { id: TagElementId.make(existing._id), title: existing.title, created: false };
181229
181612
  }
181230
181613
  const categoryRef = yield* resolveCategoryRef(client, params.category);
181231
- const tagId = (0, import_core39.generateId)();
181614
+ const tagId = (0, import_core40.generateId)();
181232
181615
  const color = params.color ?? 0;
181233
181616
  const tagData = {
181234
181617
  title: params.title,
@@ -181658,7 +182041,7 @@ var labelTools = [
181658
182041
  ];
181659
182042
 
181660
182043
  // src/huly/operations/leads.ts
181661
- var import_core40 = __toESM(require_lib4(), 1);
182044
+ var import_core41 = __toESM(require_lib4(), 1);
181662
182045
  var funnelAsSpace = (funnel) => toRef(funnel._id);
181663
182046
  var markupBlobRefAsMarkupRef = (value3) => value3;
181664
182047
  var normalizeLeadIdentifier = (identifier2) => {
@@ -181760,7 +182143,7 @@ var listFunnels = (params) => Effect_exports.gen(function* () {
181760
182143
  query,
181761
182144
  {
181762
182145
  limit,
181763
- sort: { name: import_core40.SortingOrder.Ascending }
182146
+ sort: { name: import_core41.SortingOrder.Ascending }
181764
182147
  }
181765
182148
  );
181766
182149
  const summaries = funnels.map((funnel) => ({
@@ -181798,7 +182181,7 @@ var listLeads = (params) => Effect_exports.gen(function* () {
181798
182181
  query,
181799
182182
  {
181800
182183
  limit,
181801
- sort: { modifiedOn: import_core40.SortingOrder.Descending },
182184
+ sort: { modifiedOn: import_core41.SortingOrder.Descending },
181802
182185
  // Upstream lead views resolve attachedTo through the Customer mixin.
181803
182186
  // Reference:
181804
182187
  // https://github.com/hcengineering/platform/blob/b9657d53d130a2ed8034c1b71ab0cf8b7a0b4994/models/lead/src/index.ts#L357-L360
@@ -181916,7 +182299,7 @@ var leadTools = [
181916
182299
  ];
181917
182300
 
181918
182301
  // src/huly/operations/milestones.ts
181919
- var import_core41 = __toESM(require_lib4(), 1);
182302
+ var import_core42 = __toESM(require_lib4(), 1);
181920
182303
  var import_tracker5 = __toESM(require_lib36(), 1);
181921
182304
  var milestoneStatusToStringMap = {
181922
182305
  [import_tracker5.MilestoneStatus.Planned]: "planned",
@@ -181960,7 +182343,7 @@ var listMilestones = (params) => Effect_exports.gen(function* () {
181960
182343
  { space: project3._id },
181961
182344
  {
181962
182345
  limit,
181963
- sort: { modifiedOn: import_core41.SortingOrder.Descending }
182346
+ sort: { modifiedOn: import_core42.SortingOrder.Descending }
181964
182347
  }
181965
182348
  );
181966
182349
  const summaries = milestones.map((m) => ({
@@ -181990,7 +182373,7 @@ var getMilestone = (params) => Effect_exports.gen(function* () {
181990
182373
  var createMilestone = (params) => Effect_exports.gen(function* () {
181991
182374
  const { client, project: project3 } = yield* findProject(params.project);
181992
182375
  const markupUrlConfig = client.markupUrlConfig;
181993
- const milestoneId = (0, import_core41.generateId)();
182376
+ const milestoneId = (0, import_core42.generateId)();
181994
182377
  const milestoneData = {
181995
182378
  label: params.label,
181996
182379
  description: optionalMarkdownToMarkup(params.description, markupUrlConfig, ""),
@@ -182144,7 +182527,7 @@ var milestoneTools = [
182144
182527
  ];
182145
182528
 
182146
182529
  // src/huly/operations/notifications.ts
182147
- var import_core42 = __toESM(require_lib4(), 1);
182530
+ var import_core43 = __toESM(require_lib4(), 1);
182148
182531
  var toDocNotifyContextSummary = (ctx) => ({
182149
182532
  id: NotificationContextId.make(ctx._id),
182150
182533
  objectId: ctx.objectId,
@@ -182190,7 +182573,7 @@ var listNotifications = (params) => Effect_exports.gen(function* () {
182190
182573
  {
182191
182574
  limit,
182192
182575
  sort: {
182193
- modifiedOn: import_core42.SortingOrder.Descending
182576
+ modifiedOn: import_core43.SortingOrder.Descending
182194
182577
  }
182195
182578
  }
182196
182579
  );
@@ -182332,7 +182715,7 @@ var listNotificationContexts = (params) => Effect_exports.gen(function* () {
182332
182715
  {
182333
182716
  limit,
182334
182717
  sort: {
182335
- lastUpdateTimestamp: import_core42.SortingOrder.Descending
182718
+ lastUpdateTimestamp: import_core43.SortingOrder.Descending
182336
182719
  }
182337
182720
  }
182338
182721
  );
@@ -182549,7 +182932,7 @@ var notificationTools = [
182549
182932
  ];
182550
182933
 
182551
182934
  // src/huly/operations/projects.ts
182552
- var import_core43 = __toESM(require_lib4(), 1);
182935
+ var import_core44 = __toESM(require_lib4(), 1);
182553
182936
  var import_tracker6 = __toESM(require_lib36(), 1);
182554
182937
  var listProjects = (params) => Effect_exports.gen(function* () {
182555
182938
  const client = yield* HulyClient;
@@ -182564,7 +182947,7 @@ var listProjects = (params) => Effect_exports.gen(function* () {
182564
182947
  {
182565
182948
  limit,
182566
182949
  sort: {
182567
- name: import_core43.SortingOrder.Ascending
182950
+ name: import_core44.SortingOrder.Ascending
182568
182951
  }
182569
182952
  }
182570
182953
  );
@@ -182633,7 +183016,7 @@ var createProject = (params) => Effect_exports.gen(function* () {
182633
183016
  created: false
182634
183017
  };
182635
183018
  }
182636
- const projectId = (0, import_core43.generateId)();
183019
+ const projectId = (0, import_core44.generateId)();
182637
183020
  const projectData = {
182638
183021
  name: params.name,
182639
183022
  description: params.description ?? "",
@@ -182891,7 +183274,7 @@ var tagCategoryTools = [
182891
183274
  ];
182892
183275
 
182893
183276
  // src/huly/operations/task-management.ts
182894
- var import_core44 = __toESM(require_lib4(), 1);
183277
+ var import_core45 = __toESM(require_lib4(), 1);
182895
183278
  var import_platform2 = __toESM(require_lib(), 1);
182896
183279
  var CATEGORY_TO_REF = {
182897
183280
  backlog: task.statusCategory.UnStarted,
@@ -182994,7 +183377,7 @@ var projectTypeDetail = (data) => ({
182994
183377
  var listAllProjectTypes = (client) => client.findAll(
182995
183378
  task.class.ProjectType,
182996
183379
  {},
182997
- { sort: { name: import_core44.SortingOrder.Ascending } }
183380
+ { sort: { name: import_core45.SortingOrder.Ascending } }
182998
183381
  ).pipe(Effect_exports.map((result) => [...result]));
182999
183382
  var resolveProjectType = (client, projectTypeRef) => Effect_exports.gen(function* () {
183000
183383
  const projectTypes = yield* listAllProjectTypes(client);
@@ -183095,7 +183478,7 @@ var createTaskType = (params) => Effect_exports.gen(function* () {
183095
183478
  new HulyError({ message: `Project type '${projectType.name}' has no task type to copy.` })
183096
183479
  );
183097
183480
  }
183098
- const taskTypeId = (0, import_core44.generateId)();
183481
+ const taskTypeId = (0, import_core45.generateId)();
183099
183482
  const targetClassId = `${taskTypeId}:type:mixin`;
183100
183483
  const targetClassRef = toRef(targetClassId);
183101
183484
  yield* client.createDoc(
@@ -183103,7 +183486,7 @@ var createTaskType = (params) => Effect_exports.gen(function* () {
183103
183486
  core.space.Model,
183104
183487
  {
183105
183488
  extends: template.ofClass,
183106
- kind: import_core44.ClassifierKind.MIXIN,
183489
+ kind: import_core45.ClassifierKind.MIXIN,
183107
183490
  label: (0, import_platform2.getEmbeddedLabel)(params.name),
183108
183491
  ...template.icon === void 0 ? {} : { icon: template.icon }
183109
183492
  },
@@ -183185,7 +183568,7 @@ var createIssueStatus = (params) => Effect_exports.gen(function* () {
183185
183568
  [...workflowData.statuses, ...statusesByName],
183186
183569
  params.name
183187
183570
  );
183188
- const statusId = existingStatus?._id ?? (0, import_core44.generateId)();
183571
+ const statusId = existingStatus?._id ?? (0, import_core45.generateId)();
183189
183572
  if (existingStatus !== void 0) {
183190
183573
  yield* requireStatusCategoryMatch(existingStatus, params.category);
183191
183574
  }
@@ -183292,7 +183675,7 @@ var taskManagementTools = [
183292
183675
  ];
183293
183676
 
183294
183677
  // src/huly/operations/test-management-core.ts
183295
- var import_core45 = __toESM(require_lib4(), 1);
183678
+ var import_core46 = __toESM(require_lib4(), 1);
183296
183679
 
183297
183680
  // src/huly/test-management-classes.ts
183298
183681
  var testManagement = {
@@ -183446,7 +183829,7 @@ var listTestProjects = (params) => Effect_exports.gen(function* () {
183446
183829
  {},
183447
183830
  {
183448
183831
  limit,
183449
- sort: { name: import_core45.SortingOrder.Ascending }
183832
+ sort: { name: import_core46.SortingOrder.Ascending }
183450
183833
  }
183451
183834
  );
183452
183835
  return {
@@ -183468,7 +183851,7 @@ var listTestSuites = (params) => Effect_exports.gen(function* () {
183468
183851
  query,
183469
183852
  {
183470
183853
  limit,
183471
- sort: { modifiedOn: import_core45.SortingOrder.Descending }
183854
+ sort: { modifiedOn: import_core46.SortingOrder.Descending }
183472
183855
  }
183473
183856
  );
183474
183857
  return {
@@ -183501,7 +183884,7 @@ var createTestSuite = (params) => Effect_exports.gen(function* () {
183501
183884
  if (existing !== void 0) {
183502
183885
  return { id: TestSuiteId.make(existing._id), name: existing.name, created: false };
183503
183886
  }
183504
- const suiteId = (0, import_core45.generateId)();
183887
+ const suiteId = (0, import_core46.generateId)();
183505
183888
  const suiteData = {
183506
183889
  name: params.name,
183507
183890
  description: params.description ?? "",
@@ -183571,7 +183954,7 @@ var listTestCases = (params) => Effect_exports.gen(function* () {
183571
183954
  query,
183572
183955
  {
183573
183956
  limit,
183574
- sort: { modifiedOn: import_core45.SortingOrder.Descending }
183957
+ sort: { modifiedOn: import_core46.SortingOrder.Descending }
183575
183958
  }
183576
183959
  );
183577
183960
  return {
@@ -183599,7 +183982,7 @@ var createTestCase = (params) => Effect_exports.gen(function* () {
183599
183982
  const client = yield* HulyClient;
183600
183983
  const project3 = yield* findTestProject(client, params.project);
183601
183984
  const suite = yield* findTestSuite(client, project3, params.suite);
183602
- const caseId = (0, import_core45.generateId)();
183985
+ const caseId = (0, import_core46.generateId)();
183603
183986
  const assigneeRef = params.assignee !== void 0 ? toRef((yield* resolveAssignee2(params.assignee))._id) : null;
183604
183987
  const typeEnum = params.type !== void 0 ? stringToTestCaseType(params.type) ?? 0 /* Functional */ : 0 /* Functional */;
183605
183988
  const priorityEnum = params.priority !== void 0 ? stringToTestCasePriority(params.priority) ?? 1 /* Medium */ : 1 /* Medium */;
@@ -183829,7 +184212,7 @@ var testManagementCoreTools = [
183829
184212
  ];
183830
184213
 
183831
184214
  // src/huly/operations/test-management-plans.ts
183832
- var import_core46 = __toESM(require_lib4(), 1);
184215
+ var import_core47 = __toESM(require_lib4(), 1);
183833
184216
  var toPlanSummary = (p) => ({
183834
184217
  id: TestPlanId.make(p._id),
183835
184218
  name: p.name
@@ -183847,7 +184230,7 @@ var listTestPlans = (params) => Effect_exports.gen(function* () {
183847
184230
  const plans = yield* client.findAll(
183848
184231
  testManagement.class.TestPlan,
183849
184232
  { space: project3._id },
183850
- { limit, sort: { modifiedOn: import_core46.SortingOrder.Descending } }
184233
+ { limit, sort: { modifiedOn: import_core47.SortingOrder.Descending } }
183851
184234
  );
183852
184235
  return { plans: plans.map(toPlanSummary), total: plans.total };
183853
184236
  });
@@ -183882,7 +184265,7 @@ var createTestPlan = (params) => Effect_exports.gen(function* () {
183882
184265
  if (existing !== void 0) {
183883
184266
  return { id: TestPlanId.make(existing._id), name: existing.name, created: false };
183884
184267
  }
183885
- const planId = (0, import_core46.generateId)();
184268
+ const planId = (0, import_core47.generateId)();
183886
184269
  const descRef = params.description !== void 0 && params.description.trim() !== "" ? yield* client.uploadMarkup(
183887
184270
  testManagement.class.TestPlan,
183888
184271
  planId,
@@ -183964,7 +184347,7 @@ var removeTestPlanItem = (params) => Effect_exports.gen(function* () {
183964
184347
  });
183965
184348
 
183966
184349
  // src/huly/operations/test-management-runs.ts
183967
- var import_core47 = __toESM(require_lib4(), 1);
184350
+ var import_core48 = __toESM(require_lib4(), 1);
183968
184351
  var BATCH_CONCURRENCY = 10;
183969
184352
  var toRunSummary = (r) => ({
183970
184353
  id: TestRunId.make(r._id),
@@ -183985,7 +184368,7 @@ var listTestRuns = (params) => Effect_exports.gen(function* () {
183985
184368
  const runs = yield* client.findAll(
183986
184369
  testManagement.class.TestRun,
183987
184370
  { space: project3._id },
183988
- { limit, sort: { modifiedOn: import_core47.SortingOrder.Descending } }
184371
+ { limit, sort: { modifiedOn: import_core48.SortingOrder.Descending } }
183989
184372
  );
183990
184373
  return { runs: runs.map(toRunSummary), total: runs.total };
183991
184374
  });
@@ -184014,7 +184397,7 @@ var getTestRun = (params) => Effect_exports.gen(function* () {
184014
184397
  var createTestRun = (params) => Effect_exports.gen(function* () {
184015
184398
  const client = yield* HulyClient;
184016
184399
  const project3 = yield* findTestProject(client, params.project);
184017
- const runId = (0, import_core47.generateId)();
184400
+ const runId = (0, import_core48.generateId)();
184018
184401
  const descRef = params.description !== void 0 && params.description.trim() !== "" ? yield* client.uploadMarkup(
184019
184402
  testManagement.class.TestRun,
184020
184403
  runId,
@@ -184071,7 +184454,7 @@ var listTestResults = (params) => Effect_exports.gen(function* () {
184071
184454
  const results = yield* client.findAll(
184072
184455
  testManagement.class.TestResult,
184073
184456
  { attachedTo: run3._id },
184074
- { limit, sort: { modifiedOn: import_core47.SortingOrder.Descending } }
184457
+ { limit, sort: { modifiedOn: import_core48.SortingOrder.Descending } }
184075
184458
  );
184076
184459
  return { results: results.map(toResultSummary), total: results.total };
184077
184460
  });
@@ -184172,7 +184555,7 @@ var runTestPlan = (params) => Effect_exports.gen(function* () {
184172
184555
  }
184173
184556
  return { item, tc };
184174
184557
  }), { concurrency: BATCH_CONCURRENCY });
184175
- const runId = (0, import_core47.generateId)();
184558
+ const runId = (0, import_core48.generateId)();
184176
184559
  const runName = params.runName ?? `${plan.name} - Run`;
184177
184560
  yield* client.createDoc(testManagement.class.TestRun, project3._id, {
184178
184561
  name: runName,
@@ -184345,8 +184728,8 @@ var testManagementPlansTools = [
184345
184728
  ];
184346
184729
 
184347
184730
  // src/huly/operations/time.ts
184348
- var import_calendar6 = __toESM(require_lib25(), 1);
184349
- var import_core48 = __toESM(require_lib4(), 1);
184731
+ var import_calendar7 = __toESM(require_lib25(), 1);
184732
+ var import_core49 = __toESM(require_lib4(), 1);
184350
184733
  var import_tracker7 = __toESM(require_lib36(), 1);
184351
184734
  var serverPopulatedCalendar = toRef("");
184352
184735
  var serverPopulatedPersonId = "";
@@ -184356,7 +184739,7 @@ var logTime = (params) => Effect_exports.gen(function* () {
184356
184739
  project: params.project,
184357
184740
  identifier: params.identifier
184358
184741
  });
184359
- const reportId = (0, import_core48.generateId)();
184742
+ const reportId = (0, import_core49.generateId)();
184360
184743
  const now2 = yield* Clock_exports.currentTimeMillis;
184361
184744
  const reportData = {
184362
184745
  employee: null,
@@ -184396,7 +184779,7 @@ var getTimeReport = (params) => Effect_exports.gen(function* () {
184396
184779
  const reports = yield* client.findAll(
184397
184780
  tracker.class.TimeSpendReport,
184398
184781
  { attachedTo: issue2._id },
184399
- { sort: { date: import_core48.SortingOrder.Descending } }
184782
+ { sort: { date: import_core49.SortingOrder.Descending } }
184400
184783
  );
184401
184784
  const employeeIds = [
184402
184785
  ...new Set(
@@ -184448,7 +184831,7 @@ var listTimeSpendReports = (params) => Effect_exports.gen(function* () {
184448
184831
  tracker.class.TimeSpendReport,
184449
184832
  query,
184450
184833
  withLookup(
184451
- { limit, sort: { date: import_core48.SortingOrder.Descending } },
184834
+ { limit, sort: { date: import_core49.SortingOrder.Descending } },
184452
184835
  {
184453
184836
  attachedTo: tracker.class.Issue,
184454
184837
  employee: contact.class.Person
@@ -184477,7 +184860,7 @@ var getDetailedTimeReport = (params) => Effect_exports.gen(function* () {
184477
184860
  tracker.class.TimeSpendReport,
184478
184861
  query,
184479
184862
  withLookup(
184480
- { sort: { date: import_core48.SortingOrder.Descending } },
184863
+ { sort: { date: import_core49.SortingOrder.Descending } },
184481
184864
  {
184482
184865
  attachedTo: tracker.class.Issue,
184483
184866
  employee: contact.class.Person
@@ -184555,7 +184938,7 @@ var listWorkSlots = (params) => Effect_exports.gen(function* () {
184555
184938
  const slots = yield* client.findAll(
184556
184939
  time3.class.WorkSlot,
184557
184940
  query,
184558
- { limit, sort: { date: import_core48.SortingOrder.Descending } }
184941
+ { limit, sort: { date: import_core49.SortingOrder.Descending } }
184559
184942
  );
184560
184943
  return slots.map((s) => ({
184561
184944
  id: WorkSlotId.make(s._id),
@@ -184567,7 +184950,7 @@ var listWorkSlots = (params) => Effect_exports.gen(function* () {
184567
184950
  });
184568
184951
  var createWorkSlot = (params) => Effect_exports.gen(function* () {
184569
184952
  const client = yield* HulyClient;
184570
- const slotId = (0, import_core48.generateId)();
184953
+ const slotId = (0, import_core49.generateId)();
184571
184954
  const slotData = {
184572
184955
  date: params.date,
184573
184956
  dueDate: params.dueDate,
@@ -184575,7 +184958,7 @@ var createWorkSlot = (params) => Effect_exports.gen(function* () {
184575
184958
  description: "",
184576
184959
  allDay: false,
184577
184960
  participants: [],
184578
- access: import_calendar6.AccessLevel.Owner,
184961
+ access: import_calendar7.AccessLevel.Owner,
184579
184962
  reminders: [],
184580
184963
  visibility: "public",
184581
184964
  eventId: "",
@@ -184719,15 +185102,15 @@ var timeTools = [
184719
185102
  ];
184720
185103
 
184721
185104
  // src/huly/operations/workspace.ts
184722
- var import_core49 = __toESM(require_lib4(), 1);
185105
+ var import_core50 = __toESM(require_lib4(), 1);
184723
185106
  var accountRoleMap = {
184724
- READONLYGUEST: import_core49.AccountRole.ReadOnlyGuest,
184725
- DocGuest: import_core49.AccountRole.DocGuest,
184726
- GUEST: import_core49.AccountRole.Guest,
184727
- USER: import_core49.AccountRole.User,
184728
- MAINTAINER: import_core49.AccountRole.Maintainer,
184729
- OWNER: import_core49.AccountRole.Owner,
184730
- ADMIN: import_core49.AccountRole.Admin
185107
+ READONLYGUEST: import_core50.AccountRole.ReadOnlyGuest,
185108
+ DocGuest: import_core50.AccountRole.DocGuest,
185109
+ GUEST: import_core50.AccountRole.Guest,
185110
+ USER: import_core50.AccountRole.User,
185111
+ MAINTAINER: import_core50.AccountRole.Maintainer,
185112
+ OWNER: import_core50.AccountRole.Owner,
185113
+ ADMIN: import_core50.AccountRole.Admin
184731
185114
  };
184732
185115
  var toHulyAccountRole = (role) => accountRoleMap[role];
184733
185116
  var formatVersion = (info) => `${info.versionMajor}.${info.versionMinor}.${info.versionPatch}`;