@firfi/huly-mcp 0.46.1 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -2
  2. package/dist/index.cjs +928 -430
  3. package/package.json +6 -6
package/dist/index.cjs CHANGED
@@ -32040,7 +32040,7 @@ var require_utils3 = __commonJS({
32040
32040
  escapeLikeForRegexp: () => escapeLikeForRegexp,
32041
32041
  fillConfiguration: () => fillConfiguration,
32042
32042
  fillDefaults: () => fillDefaults,
32043
- generateId: () => generateId49,
32043
+ generateId: () => generateId50,
32044
32044
  generateUuid: () => generateUuid,
32045
32045
  getBranding: () => getBranding,
32046
32046
  getCurrentAccount: () => getCurrentAccount,
@@ -32101,10 +32101,10 @@ var require_utils3 = __commonJS({
32101
32101
  return toHex(val, 6);
32102
32102
  }
32103
32103
  __name(count5, "count");
32104
- function generateId49(join7 = "") {
32104
+ function generateId50(join7 = "") {
32105
32105
  return timestamp() + join7 + random4 + join7 + count5();
32106
32106
  }
32107
- __name(generateId49, "generateId");
32107
+ __name(generateId50, "generateId");
32108
32108
  function generateUuid() {
32109
32109
  return crypto.randomUUID();
32110
32110
  }
@@ -35584,7 +35584,7 @@ var require_client3 = __commonJS({
35584
35584
  getClient: () => getClient
35585
35585
  });
35586
35586
  module2.exports = __toCommonJS2(client_exports);
35587
- var import_core105 = require_lib5();
35587
+ var import_core106 = require_lib5();
35588
35588
  var import_platform4 = __toESM3(require_lib());
35589
35589
  var import_utils14 = require_utils4();
35590
35590
  function getClient(accountsUrl, token, retryTimeoutMs) {
@@ -35620,7 +35620,7 @@ var require_client3 = __commonJS({
35620
35620
  rpc;
35621
35621
  async getProviders() {
35622
35622
  return await withRetryUntilMaxAttempts(async () => {
35623
- const response = await fetch((0, import_core105.concatLink)(this.url, "/providers"));
35623
+ const response = await fetch((0, import_core106.concatLink)(this.url, "/providers"));
35624
35624
  return await response.json();
35625
35625
  })();
35626
35626
  }
@@ -36275,7 +36275,7 @@ var require_client3 = __commonJS({
36275
36275
  await this.rpc(request5);
36276
36276
  }
36277
36277
  async setCookie() {
36278
- const url4 = (0, import_core105.concatLink)(this.url, "/cookie");
36278
+ const url4 = (0, import_core106.concatLink)(this.url, "/cookie");
36279
36279
  const response = await fetch(url4, { ...this.request, method: "PUT" });
36280
36280
  if (!response.ok) {
36281
36281
  const result = await response.json();
@@ -36285,7 +36285,7 @@ var require_client3 = __commonJS({
36285
36285
  }
36286
36286
  }
36287
36287
  async deleteCookie() {
36288
- const url4 = (0, import_core105.concatLink)(this.url, "/cookie");
36288
+ const url4 = (0, import_core106.concatLink)(this.url, "/cookie");
36289
36289
  const response = await fetch(url4, { ...this.request, method: "DELETE" });
36290
36290
  if (!response.ok) {
36291
36291
  const result = await response.json();
@@ -36537,9 +36537,9 @@ var require_lib7 = __commonJS({
36537
36537
  }
36538
36538
  });
36539
36539
 
36540
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/config.js
36540
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/config.js
36541
36541
  var require_config = __commonJS({
36542
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/config.js"(exports2, module2) {
36542
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/config.js"(exports2, module2) {
36543
36543
  "use strict";
36544
36544
  var __defProp3 = Object.defineProperty;
36545
36545
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -36564,9 +36564,9 @@ var require_config = __commonJS({
36564
36564
  loadServerConfig: () => loadServerConfig2
36565
36565
  });
36566
36566
  module2.exports = __toCommonJS2(config_exports3);
36567
- var import_core105 = require_lib5();
36567
+ var import_core106 = require_lib5();
36568
36568
  async function loadServerConfig2(url4) {
36569
- const configUrl = (0, import_core105.concatLink)(url4, "/config.json");
36569
+ const configUrl = (0, import_core106.concatLink)(url4, "/config.json");
36570
36570
  const res = await fetch(configUrl, { keepalive: true });
36571
36571
  if (res.ok) {
36572
36572
  return await res.json();
@@ -36652,7 +36652,7 @@ var require_client4 = __commonJS({
36652
36652
  getClient: () => getClient
36653
36653
  });
36654
36654
  module2.exports = __toCommonJS2(client_exports);
36655
- var import_core105 = require_lib5();
36655
+ var import_core106 = require_lib5();
36656
36656
  var import_utils14 = require_utils5();
36657
36657
  function getClient(workspaceId, token, collaboratorUrl) {
36658
36658
  const url4 = collaboratorUrl.replaceAll("wss://", "https://").replace("ws://", "http://");
@@ -36671,7 +36671,7 @@ var require_client4 = __commonJS({
36671
36671
  async rpc(document2, method, payload) {
36672
36672
  const workspace2 = this.workspace;
36673
36673
  const documentId = (0, import_utils14.encodeDocumentId)(workspace2, document2);
36674
- const url4 = (0, import_core105.concatLink)(this.collaboratorUrl, `/rpc/${encodeURIComponent(documentId)}`);
36674
+ const url4 = (0, import_core106.concatLink)(this.collaboratorUrl, `/rpc/${encodeURIComponent(documentId)}`);
36675
36675
  const res = await fetch(url4, {
36676
36676
  method: "POST",
36677
36677
  headers: {
@@ -54238,9 +54238,9 @@ var require_image = __commonJS({
54238
54238
  ImageNode: () => ImageNode
54239
54239
  });
54240
54240
  module2.exports = __toCommonJS2(image_exports);
54241
- var import_core105 = require_dist17();
54241
+ var import_core106 = require_dist17();
54242
54242
  var import_utils14 = require_utils6();
54243
- var ImageNode = import_core105.Node.create({
54243
+ var ImageNode = import_core106.Node.create({
54244
54244
  name: "image",
54245
54245
  addOptions() {
54246
54246
  return {
@@ -54299,7 +54299,7 @@ var require_image = __commonJS({
54299
54299
  "data-type": this.name,
54300
54300
  "data-align": node.attrs.align
54301
54301
  };
54302
- const imgAttributes = (0, import_core105.mergeAttributes)(
54302
+ const imgAttributes = (0, import_core106.mergeAttributes)(
54303
54303
  {
54304
54304
  "data-type": this.name
54305
54305
  },
@@ -54343,9 +54343,9 @@ var require_reference = __commonJS({
54343
54343
  ReferenceNode: () => ReferenceNode
54344
54344
  });
54345
54345
  module2.exports = __toCommonJS2(reference_exports);
54346
- var import_core105 = require_dist17();
54346
+ var import_core106 = require_dist17();
54347
54347
  var import_utils14 = require_utils6();
54348
- var ReferenceNode = import_core105.Node.create({
54348
+ var ReferenceNode = import_core106.Node.create({
54349
54349
  name: "reference",
54350
54350
  group: "inline",
54351
54351
  inline: true,
@@ -54380,7 +54380,7 @@ var require_reference = __commonJS({
54380
54380
  renderHTML({ node, HTMLAttributes }) {
54381
54381
  return [
54382
54382
  "span",
54383
- (0, import_core105.mergeAttributes)(
54383
+ (0, import_core106.mergeAttributes)(
54384
54384
  {
54385
54385
  "data-type": this.name,
54386
54386
  "data-id": node.attrs.id,
@@ -54439,8 +54439,8 @@ var require_emoji = __commonJS({
54439
54439
  EmojiNode: () => EmojiNode
54440
54440
  });
54441
54441
  module2.exports = __toCommonJS2(emoji_exports);
54442
- var import_core105 = require_dist17();
54443
- var EmojiNode = import_core105.Node.create({
54442
+ var import_core106 = require_dist17();
54443
+ var EmojiNode = import_core106.Node.create({
54444
54444
  name: "emoji",
54445
54445
  group: "inline",
54446
54446
  inline: true,
@@ -54480,7 +54480,7 @@ var require_emoji = __commonJS({
54480
54480
  addNodeView() {
54481
54481
  return ({ node, HTMLAttributes }) => {
54482
54482
  const container = document.createElement("span");
54483
- const containerAttributes = (0, import_core105.mergeAttributes)(
54483
+ const containerAttributes = (0, import_core106.mergeAttributes)(
54484
54484
  {
54485
54485
  "data-type": this.name,
54486
54486
  class: "emoji"
@@ -54513,7 +54513,7 @@ var require_emoji = __commonJS({
54513
54513
  if (node.attrs.kind === "image") {
54514
54514
  return [
54515
54515
  "span",
54516
- (0, import_core105.mergeAttributes)(
54516
+ (0, import_core106.mergeAttributes)(
54517
54517
  {
54518
54518
  "data-type": this.name,
54519
54519
  class: "emoji"
@@ -54522,7 +54522,7 @@ var require_emoji = __commonJS({
54522
54522
  ),
54523
54523
  [
54524
54524
  "img",
54525
- (0, import_core105.mergeAttributes)({
54525
+ (0, import_core106.mergeAttributes)({
54526
54526
  "data-type": this.name,
54527
54527
  src: node.attrs.image,
54528
54528
  alt: node.attrs.emoji
@@ -54532,7 +54532,7 @@ var require_emoji = __commonJS({
54532
54532
  }
54533
54533
  return [
54534
54534
  "span",
54535
- (0, import_core105.mergeAttributes)(
54535
+ (0, import_core106.mergeAttributes)(
54536
54536
  {
54537
54537
  "data-type": this.name,
54538
54538
  class: "emoji"
@@ -54840,8 +54840,8 @@ var require_file = __commonJS({
54840
54840
  FileNode: () => FileNode
54841
54841
  });
54842
54842
  module2.exports = __toCommonJS2(file_exports);
54843
- var import_core105 = require_dist17();
54844
- var FileNode = import_core105.Node.create({
54843
+ var import_core106 = require_dist17();
54844
+ var FileNode = import_core106.Node.create({
54845
54845
  name: "file",
54846
54846
  addOptions() {
54847
54847
  return {
@@ -55151,7 +55151,7 @@ var require_codeblock = __commonJS({
55151
55151
  tildeInputRegex: () => tildeInputRegex
55152
55152
  });
55153
55153
  module2.exports = __toCommonJS2(codeblock_exports);
55154
- var import_core105 = require_dist17();
55154
+ var import_core106 = require_dist17();
55155
55155
  var import_extension_code_block = __toESM3(require_dist20());
55156
55156
  var codeBlockOptions = {
55157
55157
  defaultLanguage: "plaintext",
@@ -55197,11 +55197,11 @@ var require_codeblock = __commonJS({
55197
55197
  },
55198
55198
  addInputRules() {
55199
55199
  return [
55200
- (0, import_core105.textblockTypeInputRule)({
55200
+ (0, import_core106.textblockTypeInputRule)({
55201
55201
  find: backtickInputRegex,
55202
55202
  type: this.type
55203
55203
  }),
55204
- (0, import_core105.textblockTypeInputRule)({
55204
+ (0, import_core106.textblockTypeInputRule)({
55205
55205
  find: tildeInputRegex,
55206
55206
  type: this.type
55207
55207
  })
@@ -55237,8 +55237,8 @@ var require_comment = __commonJS({
55237
55237
  CommentNode: () => CommentNode
55238
55238
  });
55239
55239
  module2.exports = __toCommonJS2(comment_exports);
55240
- var import_core105 = require_dist17();
55241
- var CommentNode = import_core105.Node.create({
55240
+ var import_core106 = require_dist17();
55241
+ var CommentNode = import_core106.Node.create({
55242
55242
  name: "comment",
55243
55243
  group: "inline",
55244
55244
  inline: true,
@@ -55284,8 +55284,8 @@ var require_markdown = __commonJS({
55284
55284
  MarkdownNode: () => MarkdownNode
55285
55285
  });
55286
55286
  module2.exports = __toCommonJS2(markdown_exports);
55287
- var import_core105 = require_dist17();
55288
- var MarkdownNode = import_core105.Node.create({
55287
+ var import_core106 = require_dist17();
55288
+ var MarkdownNode = import_core106.Node.create({
55289
55289
  name: "markdown",
55290
55290
  group: "block",
55291
55291
  content: "text*",
@@ -55303,7 +55303,7 @@ var require_markdown = __commonJS({
55303
55303
  renderHTML({ node, HTMLAttributes }) {
55304
55304
  return [
55305
55305
  "pre",
55306
- (0, import_core105.mergeAttributes)({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
55306
+ (0, import_core106.mergeAttributes)({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
55307
55307
  ["code", {}, 0]
55308
55308
  ];
55309
55309
  }
@@ -55337,8 +55337,8 @@ var require_embed = __commonJS({
55337
55337
  EmbedNode: () => EmbedNode
55338
55338
  });
55339
55339
  module2.exports = __toCommonJS2(embed_exports);
55340
- var import_core105 = require_dist17();
55341
- var EmbedNode = import_core105.Node.create({
55340
+ var import_core106 = require_dist17();
55341
+ var EmbedNode = import_core106.Node.create({
55342
55342
  name: "embed",
55343
55343
  addOptions() {
55344
55344
  return {};
@@ -55363,7 +55363,7 @@ var require_embed = __commonJS({
55363
55363
  ];
55364
55364
  },
55365
55365
  renderHTML({ HTMLAttributes }) {
55366
- return ["figure", { "data-type": this.name }, ["iframe", (0, import_core105.mergeAttributes)(HTMLAttributes)]];
55366
+ return ["figure", { "data-type": this.name }, ["iframe", (0, import_core106.mergeAttributes)(HTMLAttributes)]];
55367
55367
  }
55368
55368
  });
55369
55369
  }
@@ -55437,7 +55437,7 @@ var require_noteBase = __commonJS({
55437
55437
  name: () => name
55438
55438
  });
55439
55439
  module2.exports = __toCommonJS2(noteBase_exports);
55440
- var import_core105 = require_dist17();
55440
+ var import_core106 = require_dist17();
55441
55441
  var import_nodes = require_nodes();
55442
55442
  var name = "note";
55443
55443
  var NoteKind = /* @__PURE__ */ ((NoteKind2) => {
@@ -55452,7 +55452,7 @@ var require_noteBase = __commonJS({
55452
55452
  NoteKind2["PrimaryLight"] = "primary-light";
55453
55453
  return NoteKind2;
55454
55454
  })(NoteKind || {});
55455
- var NoteBaseExtension = import_core105.Mark.create({
55455
+ var NoteBaseExtension = import_core106.Mark.create({
55456
55456
  name,
55457
55457
  parseHTML() {
55458
55458
  return [
@@ -55509,9 +55509,9 @@ var require_qmsInlineCommentMark = __commonJS({
55509
55509
  QMSInlineCommentMark: () => QMSInlineCommentMark
55510
55510
  });
55511
55511
  module2.exports = __toCommonJS2(qmsInlineCommentMark_exports);
55512
- var import_core105 = require_dist17();
55512
+ var import_core106 = require_dist17();
55513
55513
  var NAME2 = "node-uuid";
55514
- var QMSInlineCommentMark = import_core105.Mark.create({
55514
+ var QMSInlineCommentMark = import_core106.Mark.create({
55515
55515
  name: NAME2,
55516
55516
  inline: true,
55517
55517
  parseHTML() {
@@ -55556,9 +55556,9 @@ var require_kit = __commonJS({
55556
55556
  mergeKitOptions: () => mergeKitOptions
55557
55557
  });
55558
55558
  module2.exports = __toCommonJS2(kit_exports);
55559
- var import_core105 = require_dist17();
55559
+ var import_core106 = require_dist17();
55560
55560
  function extensionKit(name, fn2) {
55561
- return import_core105.Extension.create({
55561
+ return import_core106.Extension.create({
55562
55562
  name,
55563
55563
  addExtensions() {
55564
55564
  const e = /* @__PURE__ */ __name((extension, options5) => {
@@ -62587,9 +62587,9 @@ var require_colors = __commonJS({
62587
62587
  TextColor: () => TextColor
62588
62588
  });
62589
62589
  module2.exports = __toCommonJS2(colors_exports);
62590
- var import_core105 = require_dist17();
62590
+ var import_core106 = require_dist17();
62591
62591
  var import_extension_text_style = require_dist21();
62592
- var BackgroundColor = import_core105.Extension.create({
62592
+ var BackgroundColor = import_core106.Extension.create({
62593
62593
  name: "backgroundColor",
62594
62594
  addOptions() {
62595
62595
  return {
@@ -62630,7 +62630,7 @@ var require_colors = __commonJS({
62630
62630
  };
62631
62631
  }
62632
62632
  });
62633
- var TextColor = import_core105.Extension.create({
62633
+ var TextColor = import_core106.Extension.create({
62634
62634
  name: "textColor",
62635
62635
  addOptions() {
62636
62636
  return {
@@ -62702,10 +62702,10 @@ var require_inlineComment = __commonJS({
62702
62702
  InlineCommentPasteFixPlugin: () => InlineCommentPasteFixPlugin
62703
62703
  });
62704
62704
  module2.exports = __toCommonJS2(inlineComment_exports);
62705
- var import_core105 = require_dist17();
62705
+ var import_core106 = require_dist17();
62706
62706
  var import_model = require_dist11();
62707
62707
  var import_state = require_dist6();
62708
- var InlineCommentMark = import_core105.Mark.create({
62708
+ var InlineCommentMark = import_core106.Mark.create({
62709
62709
  name: "inline-comment",
62710
62710
  excludes: "",
62711
62711
  inclusive: false,
@@ -78202,9 +78202,9 @@ var require_lib18 = __commonJS({
78202
78202
  }
78203
78203
  });
78204
78204
 
78205
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/markup/client.js
78205
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/markup/client.js
78206
78206
  var require_client5 = __commonJS({
78207
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/markup/client.js"(exports2, module2) {
78207
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/markup/client.js"(exports2, module2) {
78208
78208
  "use strict";
78209
78209
  var __defProp3 = Object.defineProperty;
78210
78210
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -78229,7 +78229,7 @@ var require_client5 = __commonJS({
78229
78229
  createMarkupOperations: () => createMarkupOperations
78230
78230
  });
78231
78231
  module2.exports = __toCommonJS2(client_exports);
78232
- var import_core105 = require_lib5();
78232
+ var import_core106 = require_lib5();
78233
78233
  var import_collaborator_client = require_lib8();
78234
78234
  var import_text3 = require_lib10();
78235
78235
  var import_text_markdown = require_lib18();
@@ -78243,8 +78243,8 @@ var require_client5 = __commonJS({
78243
78243
  this.workspace = workspace2;
78244
78244
  this.token = token;
78245
78245
  this.config = config3;
78246
- this.refUrl = (0, import_core105.concatLink)(this.url, `/browse?workspace=${workspace2}`);
78247
- this.imageUrl = (0, import_core105.concatLink)(this.url, `/files?workspace=${workspace2}&file=`);
78246
+ this.refUrl = (0, import_core106.concatLink)(this.url, `/browse?workspace=${workspace2}`);
78247
+ this.imageUrl = (0, import_core106.concatLink)(this.url, `/files?workspace=${workspace2}&file=`);
78248
78248
  this.collaborator = (0, import_collaborator_client.getClient)(workspace2, token, config3.COLLABORATOR_URL);
78249
78249
  }
78250
78250
  static {
@@ -78254,7 +78254,7 @@ var require_client5 = __commonJS({
78254
78254
  imageUrl;
78255
78255
  refUrl;
78256
78256
  async fetchMarkup(objectClass, objectId, objectAttr, doc, format8) {
78257
- const collabId = (0, import_core105.makeCollabId)(objectClass, objectId, objectAttr);
78257
+ const collabId = (0, import_core106.makeCollabId)(objectClass, objectId, objectAttr);
78258
78258
  const markup = await this.collaborator.getMarkup(collabId, doc);
78259
78259
  const json5 = (0, import_text3.markupToJSON)(markup);
78260
78260
  switch (format8) {
@@ -78283,16 +78283,16 @@ var require_client5 = __commonJS({
78283
78283
  default:
78284
78284
  throw new Error("Unknown content format");
78285
78285
  }
78286
- const collabId = (0, import_core105.makeCollabId)(objectClass, objectId, objectAttr);
78286
+ const collabId = (0, import_core106.makeCollabId)(objectClass, objectId, objectAttr);
78287
78287
  return await this.collaborator.createMarkup(collabId, markup);
78288
78288
  }
78289
78289
  };
78290
78290
  }
78291
78291
  });
78292
78292
 
78293
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/markup/types.js
78293
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/markup/types.js
78294
78294
  var require_types6 = __commonJS({
78295
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/markup/types.js"(exports2, module2) {
78295
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/markup/types.js"(exports2, module2) {
78296
78296
  "use strict";
78297
78297
  var __defProp3 = Object.defineProperty;
78298
78298
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -78339,9 +78339,9 @@ var require_types6 = __commonJS({
78339
78339
  }
78340
78340
  });
78341
78341
 
78342
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/markup/index.js
78342
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/markup/index.js
78343
78343
  var require_markup = __commonJS({
78344
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/markup/index.js"(exports2, module2) {
78344
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/markup/index.js"(exports2, module2) {
78345
78345
  "use strict";
78346
78346
  var __defProp3 = Object.defineProperty;
78347
78347
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -78364,9 +78364,9 @@ var require_markup = __commonJS({
78364
78364
  }
78365
78365
  });
78366
78366
 
78367
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/utils.js
78367
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/utils.js
78368
78368
  var require_utils10 = __commonJS({
78369
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/utils.js"(exports2, module2) {
78369
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/utils.js"(exports2, module2) {
78370
78370
  "use strict";
78371
78371
  var __defProp3 = Object.defineProperty;
78372
78372
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -82767,8 +82767,8 @@ var require_connection2 = __commonJS({
82767
82767
  });
82768
82768
  module2.exports = __toCommonJS2(connection_exports);
82769
82769
  var import_analytics = require_lib3();
82770
- var import_client91 = __toESM3(require_lib7());
82771
- var import_core105 = __toESM3(require_lib5());
82770
+ var import_client92 = __toESM3(require_lib7());
82771
+ var import_core106 = __toESM3(require_lib5());
82772
82772
  var import_platform4 = __toESM3(require_lib());
82773
82773
  var import_rpc = require_lib19();
82774
82774
  var import_snappyjs = require_snappyjs();
@@ -82812,7 +82812,7 @@ var require_connection2 = __commonJS({
82812
82812
  const sKey = "session.id." + this.url;
82813
82813
  let sessionId = sessionStorage.getItem(sKey) ?? void 0;
82814
82814
  if (sessionId === void 0) {
82815
- sessionId = (0, import_core105.generateId)();
82815
+ sessionId = (0, import_core106.generateId)();
82816
82816
  console.log("Generate new SessionId", sessionId);
82817
82817
  this.sessionId = sessionId;
82818
82818
  } else {
@@ -82823,7 +82823,7 @@ var require_connection2 = __commonJS({
82823
82823
  sessionStorage.setItem(sKey, sessionId);
82824
82824
  });
82825
82825
  } else {
82826
- this.sessionId = (0, import_core105.generateId)();
82826
+ this.sessionId = (0, import_core106.generateId)();
82827
82827
  }
82828
82828
  this.rpcHandler = opt?.useGlobalRPCHandler === true ? globalRPCHandler : new import_rpc.RPCHandler();
82829
82829
  this.pushHandler(handler);
@@ -82878,7 +82878,7 @@ var require_connection2 = __commonJS({
82878
82878
  }
82879
82879
  if (!this.closed) {
82880
82880
  void this.sendRequest({
82881
- method: import_client91.pingConst,
82881
+ method: import_client92.pingConst,
82882
82882
  params: [],
82883
82883
  once: true,
82884
82884
  handleResult: /* @__PURE__ */ __name(async (result) => {
@@ -82911,7 +82911,7 @@ var require_connection2 = __commonJS({
82911
82911
  }
82912
82912
  }
82913
82913
  isConnected() {
82914
- return this.websocket != null && this.websocket.readyState === import_client91.ClientSocketReadyState.OPEN && this.helloReceived;
82914
+ return this.websocket != null && this.websocket.readyState === import_client92.ClientSocketReadyState.OPEN && this.helloReceived;
82915
82915
  }
82916
82916
  delay = 0;
82917
82917
  onConnectHandlers = [];
@@ -83003,7 +83003,7 @@ var require_connection2 = __commonJS({
83003
83003
  if (resp.id === -1) {
83004
83004
  this.delay = 0;
83005
83005
  if (resp.result?.state === "upgrading") {
83006
- void this.onConnect?.(import_core105.ClientConnectEvent.Maintenance, void 0, resp.result.stats);
83006
+ void this.onConnect?.(import_core106.ClientConnectEvent.Maintenance, void 0, resp.result.stats);
83007
83007
  this.upgrading = true;
83008
83008
  this.delay = 3;
83009
83009
  return;
@@ -83038,7 +83038,7 @@ var require_connection2 = __commonJS({
83038
83038
  v.reconnect?.();
83039
83039
  }
83040
83040
  void this.onConnect?.(
83041
- helloResp.reconnect === true ? import_core105.ClientConnectEvent.Reconnected : import_core105.ClientConnectEvent.Connected,
83041
+ helloResp.reconnect === true ? import_core106.ClientConnectEvent.Reconnected : import_core106.ClientConnectEvent.Connected,
83042
83042
  helloResp.lastTx,
83043
83043
  this.sessionId
83044
83044
  )?.catch((err) => {
@@ -83051,8 +83051,8 @@ var require_connection2 = __commonJS({
83051
83051
  }
83052
83052
  return;
83053
83053
  }
83054
- if (resp.result === import_client91.pingConst) {
83055
- void this.sendRequest({ method: import_client91.pingConst, params: [] }).catch((err) => {
83054
+ if (resp.result === import_client92.pingConst) {
83055
+ void this.sendRequest({ method: import_client92.pingConst, params: [] }).catch((err) => {
83056
83056
  this.ctx.error("failed to send ping", { err });
83057
83057
  });
83058
83058
  return;
@@ -83088,7 +83088,7 @@ var require_connection2 = __commonJS({
83088
83088
  }
83089
83089
  result = result.concat(c.data);
83090
83090
  }
83091
- resp.result = (0, import_core105.toFindResult)(result, total, lookupMap);
83091
+ resp.result = (0, import_core106.toFindResult)(result, total, lookupMap);
83092
83092
  resp.chunk = void 0;
83093
83093
  } else {
83094
83094
  return;
@@ -83132,7 +83132,7 @@ var require_connection2 = __commonJS({
83132
83132
  } else {
83133
83133
  const txArr = Array.isArray(resp.result) ? resp.result : [resp.result];
83134
83134
  for (const tx of txArr) {
83135
- if (tx?._class === import_core105.default.class.TxModelUpgrade) {
83135
+ if (tx?._class === import_core106.default.class.TxModelUpgrade) {
83136
83136
  console.log("Processing upgrade", this.workspace, this.user);
83137
83137
  this.opt?.onUpgrade?.();
83138
83138
  return;
@@ -83144,15 +83144,15 @@ var require_connection2 = __commonJS({
83144
83144
  }
83145
83145
  }
83146
83146
  checkArrayBufferPing(data) {
83147
- if (data.byteLength === import_client91.pingConst.length || data.byteLength === import_client91.pongConst.length) {
83147
+ if (data.byteLength === import_client92.pingConst.length || data.byteLength === import_client92.pongConst.length) {
83148
83148
  const text4 = new TextDecoder().decode(data);
83149
- if (text4 === import_client91.pingConst) {
83150
- void this.sendRequest({ method: import_client91.pingConst, params: [] }).catch((err) => {
83149
+ if (text4 === import_client92.pingConst) {
83150
+ void this.sendRequest({ method: import_client92.pingConst, params: [] }).catch((err) => {
83151
83151
  this.ctx.error("failed to send ping", { err });
83152
83152
  });
83153
83153
  return true;
83154
83154
  }
83155
- if (text4 === import_client91.pongConst) {
83155
+ if (text4 === import_client92.pongConst) {
83156
83156
  this.pingResponse = Date.now();
83157
83157
  return true;
83158
83158
  }
@@ -83162,7 +83162,7 @@ var require_connection2 = __commonJS({
83162
83162
  openConnection(ctx, socketId) {
83163
83163
  this.binaryMode = false;
83164
83164
  this.helloReceived = false;
83165
- const clientSocketFactory = this.opt?.socketFactory ?? (0, import_platform4.getMetadata)(import_client91.default.metadata.ClientSocketFactory) ?? ((url4) => {
83165
+ const clientSocketFactory = this.opt?.socketFactory ?? (0, import_platform4.getMetadata)(import_client92.default.metadata.ClientSocketFactory) ?? ((url4) => {
83166
83166
  const s = new WebSocket(url4);
83167
83167
  return s;
83168
83168
  });
@@ -83197,12 +83197,12 @@ var require_connection2 = __commonJS({
83197
83197
  if (this.websocket !== wsocket) {
83198
83198
  return;
83199
83199
  }
83200
- if (event.data === import_client91.pongConst) {
83200
+ if (event.data === import_client92.pongConst) {
83201
83201
  this.pingResponse = Date.now();
83202
83202
  return;
83203
83203
  }
83204
- if (event.data === import_client91.pingConst) {
83205
- void this.sendRequest({ method: import_client91.pingConst, params: [] }).catch((err) => {
83204
+ if (event.data === import_client92.pingConst) {
83205
+ void this.sendRequest({ method: import_client92.pingConst, params: [] }).catch((err) => {
83206
83206
  this.ctx.error("failed to send ping", { err });
83207
83207
  });
83208
83208
  return;
@@ -83267,8 +83267,8 @@ var require_connection2 = __commonJS({
83267
83267
  if (this.websocket !== wsocket) {
83268
83268
  return;
83269
83269
  }
83270
- const useBinary = this.opt?.useBinaryProtocol ?? (0, import_platform4.getMetadata)(import_client91.default.metadata.UseBinaryProtocol) ?? true;
83271
- this.compressionMode = this.opt?.useProtocolCompression ?? (0, import_platform4.getMetadata)(import_client91.default.metadata.UseProtocolCompression) ?? false;
83270
+ const useBinary = this.opt?.useBinaryProtocol ?? (0, import_platform4.getMetadata)(import_client92.default.metadata.UseBinaryProtocol) ?? true;
83271
+ this.compressionMode = this.opt?.useProtocolCompression ?? (0, import_platform4.getMetadata)(import_client92.default.metadata.UseProtocolCompression) ?? false;
83272
83272
  const helloRequest = {
83273
83273
  method: "hello",
83274
83274
  params: [],
@@ -83314,13 +83314,13 @@ var require_connection2 = __commonJS({
83314
83314
  if (w instanceof Promise) {
83315
83315
  await w;
83316
83316
  }
83317
- if (data.method !== import_client91.pingConst) {
83317
+ if (data.method !== import_client92.pingConst) {
83318
83318
  this.requests.set(id2, promise4);
83319
83319
  }
83320
83320
  promise4.sendData = () => {
83321
- if (this.websocket?.readyState === import_client91.ClientSocketReadyState.OPEN) {
83321
+ if (this.websocket?.readyState === import_client92.ClientSocketReadyState.OPEN) {
83322
83322
  promise4.startTime = Date.now();
83323
- if (data.method !== import_client91.pingConst) {
83323
+ if (data.method !== import_client92.pingConst) {
83324
83324
  const dta = this.rpcHandler.serialize(
83325
83325
  {
83326
83326
  method: data.method,
@@ -83333,7 +83333,7 @@ var require_connection2 = __commonJS({
83333
83333
  );
83334
83334
  this.websocket?.send(dta);
83335
83335
  } else {
83336
- this.websocket?.send(import_client91.pingConst);
83336
+ this.websocket?.send(import_client92.pingConst);
83337
83337
  }
83338
83338
  }
83339
83339
  };
@@ -83347,7 +83347,7 @@ var require_connection2 = __commonJS({
83347
83347
  };
83348
83348
  }
83349
83349
  promise4.sendData();
83350
- if (data.method !== import_client91.pingConst) {
83350
+ if (data.method !== import_client92.pingConst) {
83351
83351
  return await promise4.promise;
83352
83352
  }
83353
83353
  },
@@ -83362,7 +83362,7 @@ var require_connection2 = __commonJS({
83362
83362
  }
83363
83363
  getAccount() {
83364
83364
  if (this.account !== void 0) {
83365
- return Promise.resolve((0, import_core105.clone)(this.account));
83365
+ return Promise.resolve((0, import_core106.clone)(this.account));
83366
83366
  }
83367
83367
  return this.sendRequest({ method: "getAccount", params: [] });
83368
83368
  }
@@ -83420,10 +83420,10 @@ var require_connection2 = __commonJS({
83420
83420
  method: "tx",
83421
83421
  params: [tx],
83422
83422
  retry: /* @__PURE__ */ __name(async () => {
83423
- if (tx._class === import_core105.default.class.TxApplyIf) {
83424
- return (await this.findAll(import_core105.default.class.Tx, { _id: tx.txes[0]._id }, { limit: 1 })).length === 0;
83423
+ if (tx._class === import_core106.default.class.TxApplyIf) {
83424
+ return (await this.findAll(import_core106.default.class.Tx, { _id: tx.txes[0]._id }, { limit: 1 })).length === 0;
83425
83425
  }
83426
- return (await this.findAll(import_core105.default.class.Tx, { _id: tx._id }, { limit: 1 })).length === 0;
83426
+ return (await this.findAll(import_core106.default.class.Tx, { _id: tx._id }, { limit: 1 })).length === 0;
83427
83427
  }, "retry")
83428
83428
  });
83429
83429
  }
@@ -83463,7 +83463,7 @@ var require_connection2 = __commonJS({
83463
83463
  };
83464
83464
  function connect(url4, handler, workspace2, user, opt) {
83465
83465
  return new Connection(
83466
- opt?.ctx?.newChild?.("connection", {}) ?? new import_core105.MeasureMetricsContext("connection", {}),
83466
+ opt?.ctx?.newChild?.("connection", {}) ?? new import_core106.MeasureMetricsContext("connection", {}),
83467
83467
  url4,
83468
83468
  handler,
83469
83469
  workspace2,
@@ -83513,14 +83513,14 @@ var require_lib20 = __commonJS({
83513
83513
  default: () => index_default
83514
83514
  });
83515
83515
  module2.exports = __toCommonJS2(index_exports2);
83516
- var import_client91 = __toESM3(require_lib7());
83517
- var import_core105 = __toESM3(require_lib5());
83516
+ var import_client92 = __toESM3(require_lib7());
83517
+ var import_core106 = __toESM3(require_lib5());
83518
83518
  var import_platform4 = __toESM3(require_lib());
83519
83519
  var import_connection = require_connection2();
83520
83520
  var dbRequest;
83521
83521
  var dbPromise = Promise.resolve(void 0);
83522
83522
  if (typeof localStorage !== "undefined") {
83523
- const st = (0, import_core105.platformNow)();
83523
+ const st = (0, import_core106.platformNow)();
83524
83524
  dbPromise = new Promise((resolve4) => {
83525
83525
  dbRequest = indexedDB.open("model.db.persistence", 2);
83526
83526
  dbRequest.onupgradeneeded = function() {
@@ -83531,7 +83531,7 @@ var require_lib20 = __commonJS({
83531
83531
  };
83532
83532
  dbRequest.onsuccess = function() {
83533
83533
  const db = dbRequest.result;
83534
- console.log("init DB complete", (0, import_core105.platformNow)() - st);
83534
+ console.log("init DB complete", (0, import_core106.platformNow)() - st);
83535
83535
  resolve4(db);
83536
83536
  };
83537
83537
  });
@@ -83557,19 +83557,19 @@ var require_lib20 = __commonJS({
83557
83557
  return {
83558
83558
  function: {
83559
83559
  GetClient: /* @__PURE__ */ __name(async (token, endpoint, opt) => {
83560
- const filterModel = (0, import_platform4.getMetadata)(import_client91.default.metadata.FilterModel) ?? "none";
83561
- const extraFilter = (0, import_platform4.getMetadata)(import_client91.default.metadata.ExtraFilter) ?? [];
83560
+ const filterModel = (0, import_platform4.getMetadata)(import_client92.default.metadata.FilterModel) ?? "none";
83561
+ const extraFilter = (0, import_platform4.getMetadata)(import_client92.default.metadata.ExtraFilter) ?? [];
83562
83562
  const handler = /* @__PURE__ */ __name(async (handler2) => {
83563
- const url4 = (0, import_core105.concatLink)(endpoint, `/${token}`);
83563
+ const url4 = (0, import_core106.concatLink)(endpoint, `/${token}`);
83564
83564
  const upgradeHandler = /* @__PURE__ */ __name((...txes) => {
83565
83565
  for (const tx of txes) {
83566
- if (tx?._class === import_core105.default.class.TxModelUpgrade) {
83566
+ if (tx?._class === import_core106.default.class.TxModelUpgrade) {
83567
83567
  opt?.onUpgrade?.();
83568
83568
  return;
83569
83569
  }
83570
- if (tx?._class === import_core105.default.class.TxWorkspaceEvent) {
83570
+ if (tx?._class === import_core106.default.class.TxWorkspaceEvent) {
83571
83571
  const event = tx;
83572
- if (event.event === import_core105.WorkspaceEvent.MaintenanceNotification) {
83572
+ if (event.event === import_core106.WorkspaceEvent.MaintenanceNotification) {
83573
83573
  void (0, import_platform4.setPlatformStatus)(
83574
83574
  new import_platform4.Status(import_platform4.Severity.WARNING, import_platform4.default.status.MaintenanceWarning, {
83575
83575
  time: event.params.timeMinutes,
@@ -83586,7 +83586,7 @@ var require_lib20 = __commonJS({
83586
83586
  throw new Error("Workspace or account not found in token");
83587
83587
  }
83588
83588
  const newOpt = { ...opt };
83589
- const connectTimeout = opt?.connectionTimeout ?? (0, import_platform4.getMetadata)(import_client91.default.metadata.ConnectionTimeout);
83589
+ const connectTimeout = opt?.connectionTimeout ?? (0, import_platform4.getMetadata)(import_client92.default.metadata.ConnectionTimeout);
83590
83590
  let connectPromise;
83591
83591
  if ((connectTimeout ?? 0) > 0) {
83592
83592
  connectPromise = new Promise((resolve4, reject) => {
@@ -83607,7 +83607,7 @@ var require_lib20 = __commonJS({
83607
83607
  reject(error2);
83608
83608
  return;
83609
83609
  }
83610
- if (event !== import_core105.ClientConnectEvent.Maintenance) {
83610
+ if (event !== import_core106.ClientConnectEvent.Maintenance) {
83611
83611
  clearTimeout(connectTO);
83612
83612
  resolve4();
83613
83613
  }
@@ -83629,7 +83629,7 @@ var require_lib20 = __commonJS({
83629
83629
  }
83630
83630
  return txes;
83631
83631
  }, "modelFilter");
83632
- const client = (0, import_core105.createClient)(handler, modelFilter, createModelPersistence(getWSFromToken(token)), opt?.ctx);
83632
+ const client = (0, import_core106.createClient)(handler, modelFilter, createModelPersistence(getWSFromToken(token)), opt?.ctx);
83633
83633
  return await client;
83634
83634
  }, "GetClient")
83635
83635
  }
@@ -83637,17 +83637,17 @@ var require_lib20 = __commonJS({
83637
83637
  }, "default");
83638
83638
  function returnUITxes(txes, extraFilter) {
83639
83639
  const configs = /* @__PURE__ */ new Map();
83640
- (0, import_core105.fillConfiguration)(txes, configs);
83641
- const allowedPlugins = [...(0, import_platform4.getPlugins)(), ...(0, import_platform4.getMetadata)(import_client91.default.metadata.ExtraPlugins) ?? []];
83640
+ (0, import_core106.fillConfiguration)(txes, configs);
83641
+ const allowedPlugins = [...(0, import_platform4.getPlugins)(), ...(0, import_platform4.getMetadata)(import_client92.default.metadata.ExtraPlugins) ?? []];
83642
83642
  const excludedPlugins = Array.from(configs.values()).filter(
83643
83643
  (it) => !it.enabled || !allowedPlugins.includes(it.pluginId) || extraFilter.includes(it.pluginId)
83644
83644
  );
83645
- return (0, import_core105.pluginFilterTx)(excludedPlugins, configs, txes);
83645
+ return (0, import_core106.pluginFilterTx)(excludedPlugins, configs, txes);
83646
83646
  }
83647
83647
  __name(returnUITxes, "returnUITxes");
83648
83648
  function returnClientTxes(txes) {
83649
83649
  const configs = /* @__PURE__ */ new Map();
83650
- (0, import_core105.fillConfiguration)(txes, configs);
83650
+ (0, import_core106.fillConfiguration)(txes, configs);
83651
83651
  const excludedPlugins = Array.from(configs.values()).filter((it) => !it.enabled || it.pluginId.startsWith("server-"));
83652
83652
  const toExclude = /* @__PURE__ */ new Set([
83653
83653
  "workbench:class:Application",
@@ -83673,8 +83673,8 @@ var require_lib20 = __commonJS({
83673
83673
  "setting:class:WorkspaceSettingCategory",
83674
83674
  "notification:class:NotificationProvider"
83675
83675
  ]);
83676
- const result = (0, import_core105.pluginFilterTx)(excludedPlugins, configs, txes).filter((tx) => {
83677
- if (tx?._class === import_core105.default.class.TxCreateDoc || tx?._class === import_core105.default.class.TxUpdateDoc || tx?._class === import_core105.default.class.TxRemoveDoc) {
83676
+ const result = (0, import_core106.pluginFilterTx)(excludedPlugins, configs, txes).filter((tx) => {
83677
+ if (tx?._class === import_core106.default.class.TxCreateDoc || tx?._class === import_core106.default.class.TxUpdateDoc || tx?._class === import_core106.default.class.TxRemoveDoc) {
83678
83678
  const cud = tx;
83679
83679
  if (toExclude.has(cud.objectClass)) {
83680
83680
  return false;
@@ -83686,7 +83686,7 @@ var require_lib20 = __commonJS({
83686
83686
  }
83687
83687
  __name(returnClientTxes, "returnClientTxes");
83688
83688
  function createModelPersistence(workspace2) {
83689
- const overrideStore = (0, import_platform4.getMetadata)(import_client91.default.metadata.OverridePersistenceStore);
83689
+ const overrideStore = (0, import_platform4.getMetadata)(import_client92.default.metadata.OverridePersistenceStore);
83690
83690
  if (overrideStore !== void 0) {
83691
83691
  return overrideStore;
83692
83692
  }
@@ -83745,9 +83745,9 @@ var require_lib20 = __commonJS({
83745
83745
  }
83746
83746
  });
83747
83747
 
83748
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/client.js
83748
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/client.js
83749
83749
  var require_client6 = __commonJS({
83750
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/client.js"(exports2, module2) {
83750
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/client.js"(exports2, module2) {
83751
83751
  "use strict";
83752
83752
  var __create3 = Object.create;
83753
83753
  var __defProp3 = Object.defineProperty;
@@ -83783,8 +83783,8 @@ var require_client6 = __commonJS({
83783
83783
  });
83784
83784
  module2.exports = __toCommonJS2(client_exports);
83785
83785
  var import_account_client = require_lib6();
83786
- var import_client91 = __toESM3(require_lib7());
83787
- var import_core105 = require_lib5();
83786
+ var import_client92 = __toESM3(require_lib7());
83787
+ var import_core106 = require_lib5();
83788
83788
  var import_platform4 = require_lib();
83789
83789
  var import_config11 = require_config();
83790
83790
  var import_markup22 = require_markup();
@@ -83801,7 +83801,7 @@ var require_client6 = __commonJS({
83801
83801
  const account = {
83802
83802
  uuid: wsLoginInfo.account,
83803
83803
  role: wsLoginInfo.role,
83804
- primarySocialId: (0, import_core105.pickPrimarySocialId)(socialIds)._id,
83804
+ primarySocialId: (0, import_core106.pickPrimarySocialId)(socialIds)._id,
83805
83805
  socialIds: socialIds.map((si) => si._id),
83806
83806
  fullSocialIds: socialIds
83807
83807
  };
@@ -83809,9 +83809,9 @@ var require_client6 = __commonJS({
83809
83809
  }
83810
83810
  __name(connect, "connect");
83811
83811
  async function createClient(url4, endpoint, token, workspaceUuid, account, config3, options5) {
83812
- (0, import_platform4.addLocation)(import_client91.clientId, () => Promise.resolve().then(() => __toESM(require_lib20())));
83812
+ (0, import_platform4.addLocation)(import_client92.clientId, () => Promise.resolve().then(() => __toESM(require_lib20())));
83813
83813
  const { socketFactory, connectionTimeout } = options5;
83814
- const clientFactory = await (0, import_platform4.getResource)(import_client91.default.function.GetClient);
83814
+ const clientFactory = await (0, import_platform4.getResource)(import_client92.default.function.GetClient);
83815
83815
  const connection = await clientFactory(token, endpoint, {
83816
83816
  socketFactory,
83817
83817
  connectionTimeout
@@ -83827,7 +83827,7 @@ var require_client6 = __commonJS({
83827
83827
  this.config = config3;
83828
83828
  this.connection = connection;
83829
83829
  this.account = account;
83830
- this.client = new import_core105.TxOperations(connection, account.primarySocialId);
83830
+ this.client = new import_core106.TxOperations(connection, account.primarySocialId);
83831
83831
  this.markup = (0, import_markup22.createMarkupOperations)(url4, workspace2, token, config3);
83832
83832
  }
83833
83833
  static {
@@ -83867,7 +83867,7 @@ var require_client6 = __commonJS({
83867
83867
  }
83868
83868
  // DocOperations
83869
83869
  async createDoc(_class, space, attributes, id2) {
83870
- id2 ??= (0, import_core105.generateId)();
83870
+ id2 ??= (0, import_core106.generateId)();
83871
83871
  const data = await this.processMarkup(_class, id2, attributes);
83872
83872
  return await this.client.createDoc(_class, space, data, id2);
83873
83873
  }
@@ -83880,7 +83880,7 @@ var require_client6 = __commonJS({
83880
83880
  }
83881
83881
  // CollectionOperations
83882
83882
  async addCollection(_class, space, attachedTo, attachedToClass, collection, attributes, id2) {
83883
- id2 ??= (0, import_core105.generateId)();
83883
+ id2 ??= (0, import_core106.generateId)();
83884
83884
  const data = await this.processMarkup(_class, id2, attributes);
83885
83885
  return await this.client.addCollection(_class, space, attachedTo, attachedToClass, collection, data, id2);
83886
83886
  }
@@ -83924,9 +83924,9 @@ var require_client6 = __commonJS({
83924
83924
  }
83925
83925
  });
83926
83926
 
83927
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/socket/browser.js
83927
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/socket/browser.js
83928
83928
  var require_browser = __commonJS({
83929
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/socket/browser.js"(exports2, module2) {
83929
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/socket/browser.js"(exports2, module2) {
83930
83930
  "use strict";
83931
83931
  var __defProp3 = Object.defineProperty;
83932
83932
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -83958,9 +83958,9 @@ var require_browser = __commonJS({
83958
83958
  }
83959
83959
  });
83960
83960
 
83961
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/socket/node.js
83961
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/socket/node.js
83962
83962
  var require_node4 = __commonJS({
83963
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/socket/node.js"(exports2, module2) {
83963
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/socket/node.js"(exports2, module2) {
83964
83964
  "use strict";
83965
83965
  var __defProp3 = Object.defineProperty;
83966
83966
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84056,9 +84056,9 @@ var require_node4 = __commonJS({
84056
84056
  }
84057
84057
  });
84058
84058
 
84059
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/socket/index.js
84059
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/socket/index.js
84060
84060
  var require_socket = __commonJS({
84061
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/socket/index.js"(exports2, module2) {
84061
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/socket/index.js"(exports2, module2) {
84062
84062
  "use strict";
84063
84063
  var __defProp3 = Object.defineProperty;
84064
84064
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84081,9 +84081,9 @@ var require_socket = __commonJS({
84081
84081
  }
84082
84082
  });
84083
84083
 
84084
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/types.js
84084
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/types.js
84085
84085
  var require_types7 = __commonJS({
84086
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/types.js"(exports2, module2) {
84086
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/types.js"(exports2, module2) {
84087
84087
  "use strict";
84088
84088
  var __defProp3 = Object.defineProperty;
84089
84089
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84103,9 +84103,9 @@ var require_types7 = __commonJS({
84103
84103
  }
84104
84104
  });
84105
84105
 
84106
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/rest/utils.js
84106
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/rest/utils.js
84107
84107
  var require_utils11 = __commonJS({
84108
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/rest/utils.js"(exports2, module2) {
84108
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/rest/utils.js"(exports2, module2) {
84109
84109
  "use strict";
84110
84110
  var __defProp3 = Object.defineProperty;
84111
84111
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84178,9 +84178,9 @@ var require_utils11 = __commonJS({
84178
84178
  }
84179
84179
  });
84180
84180
 
84181
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/rest/rest.js
84181
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/rest/rest.js
84182
84182
  var require_rest = __commonJS({
84183
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/rest/rest.js"(exports2, module2) {
84183
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/rest/rest.js"(exports2, module2) {
84184
84184
  "use strict";
84185
84185
  var __defProp3 = Object.defineProperty;
84186
84186
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84207,7 +84207,7 @@ var require_rest = __commonJS({
84207
84207
  createRestClient: () => createRestClient2
84208
84208
  });
84209
84209
  module2.exports = __toCommonJS2(rest_exports);
84210
- var import_core105 = require_lib5();
84210
+ var import_core106 = require_lib5();
84211
84211
  var import_platform4 = require_lib();
84212
84212
  var import_utils14 = require_utils10();
84213
84213
  var import_utils22 = require_utils11();
@@ -84262,7 +84262,7 @@ var require_rest = __commonJS({
84262
84262
  if (options5 !== void 0 && Object.keys(options5).length > 0) {
84263
84263
  params3.append("options", JSON.stringify(options5));
84264
84264
  }
84265
- const requestUrl2 = (0, import_core105.concatLink)(this.endpoint, `/api/v1/find-all/${this.workspace}?${params3.toString()}`);
84265
+ const requestUrl2 = (0, import_core106.concatLink)(this.endpoint, `/api/v1/find-all/${this.workspace}?${params3.toString()}`);
84266
84266
  const result = await (0, import_utils22.withRetry)(async () => {
84267
84267
  const response = await fetch(requestUrl2, this.requestInit());
84268
84268
  if (!response.ok) {
@@ -84275,7 +84275,7 @@ var require_rest = __commonJS({
84275
84275
  if (result.error !== void 0) {
84276
84276
  throw new import_platform4.PlatformError(result.error);
84277
84277
  }
84278
- if (result.lookupMap !== void 0) {
84278
+ if (result.lookupMap != null) {
84279
84279
  for (const d of result) {
84280
84280
  if (d.$lookup !== void 0) {
84281
84281
  for (const [k, v] of Object.entries(d.$lookup)) {
@@ -84289,8 +84289,8 @@ var require_rest = __commonJS({
84289
84289
  }
84290
84290
  }
84291
84291
  }
84292
- delete result.lookupMap;
84293
84292
  }
84293
+ delete result.lookupMap;
84294
84294
  for (const doc of result) {
84295
84295
  if (doc._class == null) {
84296
84296
  doc._class = _class;
@@ -84336,7 +84336,7 @@ var require_rest = __commonJS({
84336
84336
  }
84337
84337
  }
84338
84338
  async getAccount() {
84339
- const requestUrl2 = (0, import_core105.concatLink)(this.endpoint, `/api/v1/account/${this.workspace}`);
84339
+ const requestUrl2 = (0, import_core106.concatLink)(this.endpoint, `/api/v1/account/${this.workspace}`);
84340
84340
  await this.checkRate();
84341
84341
  const result = await (0, import_utils22.withRetry)(async () => {
84342
84342
  const response = await fetch(requestUrl2, this.requestInit());
@@ -84353,7 +84353,7 @@ var require_rest = __commonJS({
84353
84353
  return result;
84354
84354
  }
84355
84355
  async getModel(full = false) {
84356
- const requestUrl2 = new URL((0, import_core105.concatLink)(this.endpoint, `/api/v1/load-model/${this.workspace}`));
84356
+ const requestUrl2 = new URL((0, import_core106.concatLink)(this.endpoint, `/api/v1/load-model/${this.workspace}`));
84357
84357
  if (full) {
84358
84358
  requestUrl2.searchParams.append("full", "true");
84359
84359
  }
@@ -84366,10 +84366,10 @@ var require_rest = __commonJS({
84366
84366
  }
84367
84367
  this.updateRateLimit(response);
84368
84368
  const modelResponse = await (0, import_utils22.extractJson)(response);
84369
- const hierarchy = new import_core105.Hierarchy();
84370
- const model = new import_core105.ModelDb(hierarchy);
84371
- const ctx = new import_core105.MeasureMetricsContext("loadModel", {});
84372
- (0, import_core105.buildModel)(ctx, modelResponse, void 0, hierarchy, model);
84369
+ const hierarchy = new import_core106.Hierarchy();
84370
+ const model = new import_core106.ModelDb(hierarchy);
84371
+ const ctx = new import_core106.MeasureMetricsContext("loadModel", {});
84372
+ (0, import_core106.buildModel)(ctx, modelResponse, void 0, hierarchy, model);
84373
84373
  return { hierarchy, model };
84374
84374
  }, isRLE);
84375
84375
  if (result.error !== void 0) {
@@ -84381,7 +84381,7 @@ var require_rest = __commonJS({
84381
84381
  return (await this.findAll(_class, query, { ...options5, limit: 1 })).shift();
84382
84382
  }
84383
84383
  async tx(tx) {
84384
- const requestUrl2 = (0, import_core105.concatLink)(this.endpoint, `/api/v1/tx/${this.workspace}`);
84384
+ const requestUrl2 = (0, import_core106.concatLink)(this.endpoint, `/api/v1/tx/${this.workspace}`);
84385
84385
  await this.checkRate();
84386
84386
  const result = await (0, import_utils22.withRetry)(async () => {
84387
84387
  const response = await fetch(requestUrl2, {
@@ -84415,7 +84415,7 @@ var require_rest = __commonJS({
84415
84415
  if (options5.limit != null) {
84416
84416
  params3.append("limit", `${options5.limit}`);
84417
84417
  }
84418
- const requestUrl2 = (0, import_core105.concatLink)(this.endpoint, `/api/v1/search-fulltext/${this.workspace}?${params3.toString()}`);
84418
+ const requestUrl2 = (0, import_core106.concatLink)(this.endpoint, `/api/v1/search-fulltext/${this.workspace}?${params3.toString()}`);
84419
84419
  const response = await fetch(requestUrl2, {
84420
84420
  method: "GET",
84421
84421
  headers: this.jsonHeaders(),
@@ -84434,7 +84434,7 @@ var require_rest = __commonJS({
84434
84434
  return result;
84435
84435
  }
84436
84436
  async domainRequest(domain3, params3, options5) {
84437
- const requestUrl2 = (0, import_core105.concatLink)(this.endpoint, `/api/v1/request/${domain3}/${this.workspace}`);
84437
+ const requestUrl2 = (0, import_core106.concatLink)(this.endpoint, `/api/v1/request/${domain3}/${this.workspace}`);
84438
84438
  await this.checkRate();
84439
84439
  return await (0, import_utils22.withRetry)(async () => {
84440
84440
  const response = await fetch(requestUrl2, {
@@ -84453,7 +84453,7 @@ var require_rest = __commonJS({
84453
84453
  }, isRLE);
84454
84454
  }
84455
84455
  async ensurePerson(socialType, socialValue, firstName, lastName) {
84456
- const requestUrl2 = (0, import_core105.concatLink)(this.endpoint, `/api/v1/ensure-person/${this.workspace}`);
84456
+ const requestUrl2 = (0, import_core106.concatLink)(this.endpoint, `/api/v1/ensure-person/${this.workspace}`);
84457
84457
  await this.checkRate();
84458
84458
  const result = await (0, import_utils22.withRetry)(async () => {
84459
84459
  const response = await fetch(requestUrl2, {
@@ -84483,9 +84483,9 @@ var require_rest = __commonJS({
84483
84483
  }
84484
84484
  });
84485
84485
 
84486
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/rest/tx.js
84486
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/rest/tx.js
84487
84487
  var require_tx2 = __commonJS({
84488
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/rest/tx.js"(exports2, module2) {
84488
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/rest/tx.js"(exports2, module2) {
84489
84489
  "use strict";
84490
84490
  var __defProp3 = Object.defineProperty;
84491
84491
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84510,13 +84510,13 @@ var require_tx2 = __commonJS({
84510
84510
  createRestTxOperations: () => createRestTxOperations2
84511
84511
  });
84512
84512
  module2.exports = __toCommonJS2(tx_exports);
84513
- var import_core105 = require_lib5();
84513
+ var import_core106 = require_lib5();
84514
84514
  var import_rest = require_rest();
84515
84515
  async function createRestTxOperations2(endpoint, workspaceId, token, fullModel = false) {
84516
84516
  const restClient = new import_rest.RestClientImpl(endpoint, workspaceId, token);
84517
84517
  const account = await restClient.getAccount();
84518
84518
  const { hierarchy, model } = await restClient.getModel(fullModel);
84519
- return new import_core105.TxOperations(new RestTxClient(restClient, hierarchy, model, account), account.socialIds[0]);
84519
+ return new import_core106.TxOperations(new RestTxClient(restClient, hierarchy, model, account), account.socialIds[0]);
84520
84520
  }
84521
84521
  __name(createRestTxOperations2, "createRestTxOperations");
84522
84522
  var RestTxClient = class {
@@ -84537,7 +84537,7 @@ var require_tx2 = __commonJS({
84537
84537
  const result = data.map((v) => {
84538
84538
  return this.hierarchy.updateLookupMixin(_class, v, options5);
84539
84539
  });
84540
- return (0, import_core105.toFindResult)(result, data.total);
84540
+ return (0, import_core106.toFindResult)(result, data.total);
84541
84541
  }
84542
84542
  async domainRequest(domain3, params3, options5) {
84543
84543
  return await this.client.domainRequest(domain3, params3, options5);
@@ -84564,9 +84564,9 @@ var require_tx2 = __commonJS({
84564
84564
  }
84565
84565
  });
84566
84566
 
84567
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/rest/types.js
84567
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/rest/types.js
84568
84568
  var require_types8 = __commonJS({
84569
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/rest/types.js"(exports2, module2) {
84569
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/rest/types.js"(exports2, module2) {
84570
84570
  "use strict";
84571
84571
  var __defProp3 = Object.defineProperty;
84572
84572
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84586,9 +84586,9 @@ var require_types8 = __commonJS({
84586
84586
  }
84587
84587
  });
84588
84588
 
84589
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/rest/index.js
84589
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/rest/index.js
84590
84590
  var require_rest2 = __commonJS({
84591
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/rest/index.js"(exports2, module2) {
84591
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/rest/index.js"(exports2, module2) {
84592
84592
  "use strict";
84593
84593
  var __defProp3 = Object.defineProperty;
84594
84594
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84621,9 +84621,9 @@ var require_rest2 = __commonJS({
84621
84621
  }
84622
84622
  });
84623
84623
 
84624
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/storage/error.js
84624
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/storage/error.js
84625
84625
  var require_error3 = __commonJS({
84626
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/storage/error.js"(exports2, module2) {
84626
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/storage/error.js"(exports2, module2) {
84627
84627
  "use strict";
84628
84628
  var __defProp3 = Object.defineProperty;
84629
84629
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84680,9 +84680,9 @@ var require_error3 = __commonJS({
84680
84680
  }
84681
84681
  });
84682
84682
 
84683
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/storage/client.js
84683
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/storage/client.js
84684
84684
  var require_client7 = __commonJS({
84685
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/storage/client.js"(exports2, module2) {
84685
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/storage/client.js"(exports2, module2) {
84686
84686
  "use strict";
84687
84687
  var __create3 = Object.create;
84688
84688
  var __defProp3 = Object.defineProperty;
@@ -84719,7 +84719,7 @@ var require_client7 = __commonJS({
84719
84719
  createStorageClient: () => createStorageClient2
84720
84720
  });
84721
84721
  module2.exports = __toCommonJS2(client_exports);
84722
- var import_core105 = __toESM3(require_lib5());
84722
+ var import_core106 = __toESM3(require_lib5());
84723
84723
  var import_stream3 = require("stream");
84724
84724
  var import_config11 = require_config();
84725
84725
  var import_error3 = require_error3();
@@ -84756,13 +84756,13 @@ var require_client7 = __commonJS({
84756
84756
  const size15 = parseInt(headers.get("Content-Length") ?? "0", 10);
84757
84757
  return {
84758
84758
  provider: "",
84759
- _class: import_core105.default.class.Blob,
84759
+ _class: import_core106.default.class.Blob,
84760
84760
  _id: objectName,
84761
84761
  contentType: headers.get("Content-Type") ?? "",
84762
84762
  size: isNaN(size15) ? 0 : size15 ?? 0,
84763
84763
  etag: headers.get("ETag") ?? "",
84764
- space: import_core105.default.space.Configuration,
84765
- modifiedBy: import_core105.default.account.System,
84764
+ space: import_core106.default.space.Configuration,
84765
+ modifiedBy: import_core106.default.account.System,
84766
84766
  modifiedOn: isNaN(lastModified) ? 0 : lastModified,
84767
84767
  version: null
84768
84768
  };
@@ -84797,11 +84797,11 @@ var require_client7 = __commonJS({
84797
84797
  if (Object.hasOwn(result[0], "id")) {
84798
84798
  const fileResult = result[0];
84799
84799
  return {
84800
- _class: import_core105.default.class.Blob,
84800
+ _class: import_core106.default.class.Blob,
84801
84801
  _id: fileResult.id,
84802
- space: import_core105.default.space.Configuration,
84802
+ space: import_core106.default.space.Configuration,
84803
84803
  modifiedOn: fileResult.metadata.lastModified,
84804
- modifiedBy: import_core105.default.account.System,
84804
+ modifiedBy: import_core106.default.account.System,
84805
84805
  provider: "",
84806
84806
  contentType: fileResult.metadata.contentType,
84807
84807
  etag: fileResult.metadata.etag,
@@ -84875,20 +84875,20 @@ var require_client7 = __commonJS({
84875
84875
  async function connectStorage(url4, options5, config3) {
84876
84876
  config3 ??= await (0, import_config11.loadServerConfig)(url4);
84877
84877
  const token = await (0, import_utils14.getWorkspaceToken)(url4, options5, config3);
84878
- const filesUrl = (config3.FILES_URL.startsWith("/") ? (0, import_core105.concatLink)(url4, config3.FILES_URL) : config3.FILES_URL).replace(
84878
+ const filesUrl = (config3.FILES_URL.startsWith("/") ? (0, import_core106.concatLink)(url4, config3.FILES_URL) : config3.FILES_URL).replace(
84879
84879
  ":workspace",
84880
84880
  token.workspaceId
84881
84881
  );
84882
- const uploadUrl = (config3.UPLOAD_URL.startsWith("/") ? (0, import_core105.concatLink)(url4, config3.UPLOAD_URL) : config3.UPLOAD_URL).replace(":workspace", token.workspaceId);
84882
+ const uploadUrl = (config3.UPLOAD_URL.startsWith("/") ? (0, import_core106.concatLink)(url4, config3.UPLOAD_URL) : config3.UPLOAD_URL).replace(":workspace", token.workspaceId);
84883
84883
  return new StorageClientImpl(filesUrl, uploadUrl, token.token, token.workspaceId);
84884
84884
  }
84885
84885
  __name(connectStorage, "connectStorage");
84886
84886
  }
84887
84887
  });
84888
84888
 
84889
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/storage/types.js
84889
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/storage/types.js
84890
84890
  var require_types9 = __commonJS({
84891
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/storage/types.js"(exports2, module2) {
84891
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/storage/types.js"(exports2, module2) {
84892
84892
  "use strict";
84893
84893
  var __defProp3 = Object.defineProperty;
84894
84894
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84908,9 +84908,9 @@ var require_types9 = __commonJS({
84908
84908
  }
84909
84909
  });
84910
84910
 
84911
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/storage/index.js
84911
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/storage/index.js
84912
84912
  var require_storage2 = __commonJS({
84913
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/storage/index.js"(exports2, module2) {
84913
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/storage/index.js"(exports2, module2) {
84914
84914
  "use strict";
84915
84915
  var __defProp3 = Object.defineProperty;
84916
84916
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -84932,19 +84932,19 @@ var require_storage2 = __commonJS({
84932
84932
  var __toCommonJS2 = (mod) => __copyProps3(__defProp3({}, "__esModule", { value: true }), mod);
84933
84933
  var storage_exports = {};
84934
84934
  __export2(storage_exports, {
84935
- connectStorage: () => import_client91.connectStorage,
84936
- createStorageClient: () => import_client91.createStorageClient
84935
+ connectStorage: () => import_client92.connectStorage,
84936
+ createStorageClient: () => import_client92.createStorageClient
84937
84937
  });
84938
84938
  module2.exports = __toCommonJS2(storage_exports);
84939
- var import_client91 = require_client7();
84939
+ var import_client92 = require_client7();
84940
84940
  __reExport2(storage_exports, require_error3(), module2.exports);
84941
84941
  __reExport2(storage_exports, require_types9(), module2.exports);
84942
84942
  }
84943
84943
  });
84944
84944
 
84945
- // node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/index.js
84945
+ // node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/index.js
84946
84946
  var require_lib21 = __commonJS({
84947
- "node_modules/.pnpm/@hcengineering+api-client@0.7.19_prosemirror-inputrules@1.5.1_prosemirror-model@1.25.4__4d95a6217c5963527006fc0d7786576e/node_modules/@hcengineering/api-client/lib/index.js"(exports2, module2) {
84947
+ "node_modules/.pnpm/@hcengineering+api-client@0.7.19_patch_hash=6448e9bb0f5199b362ab285ce912e132868029db2e5_c7744e2d90aa7997b8329694542782d6/node_modules/@hcengineering/api-client/lib/index.js"(exports2, module2) {
84948
84948
  "use strict";
84949
84949
  var __defProp3 = Object.defineProperty;
84950
84950
  var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
@@ -86126,7 +86126,7 @@ var require_utils12 = __commonJS({
86126
86126
  var utils_exports = {};
86127
86127
  __export2(utils_exports, {
86128
86128
  genRanks: () => genRanks,
86129
- makeRank: () => makeRank7
86129
+ makeRank: () => makeRank8
86130
86130
  });
86131
86131
  module2.exports = __toCommonJS2(utils_exports);
86132
86132
  var import_lexoRankBucket = __toESM3(require_lexoRankBucket());
@@ -86145,7 +86145,7 @@ var require_utils12 = __commonJS({
86145
86145
  return res;
86146
86146
  }
86147
86147
  __name(genRanks, "genRanks");
86148
- function makeRank7(prev, next4) {
86148
+ function makeRank8(prev, next4) {
86149
86149
  try {
86150
86150
  if (prev != null && prev.trim() === "") {
86151
86151
  prev = void 0;
@@ -86170,7 +86170,7 @@ var require_utils12 = __commonJS({
86170
86170
  throw new Error(`Failed to make rank: ${prev} ${next4} ${err.message}`);
86171
86171
  }
86172
86172
  }
86173
- __name(makeRank7, "makeRank");
86173
+ __name(makeRank8, "makeRank");
86174
86174
  }
86175
86175
  });
86176
86176
 
@@ -86624,7 +86624,7 @@ var require_utils13 = __commonJS({
86624
86624
  getWeekday: () => getWeekday
86625
86625
  });
86626
86626
  module2.exports = __toCommonJS2(utils_exports);
86627
- var import_core105 = require_lib5();
86627
+ var import_core106 = require_lib5();
86628
86628
  var import__ = __toESM3(require_lib26());
86629
86629
  function getInstance(event, date8) {
86630
86630
  const diff8 = event.dueDate - event.date;
@@ -86636,7 +86636,7 @@ var require_utils13 = __commonJS({
86636
86636
  originalStartTime: date8,
86637
86637
  _class: import__.default.class.ReccuringInstance,
86638
86638
  eventId: generateEventId4(),
86639
- _id: (0, import_core105.generateId)(),
86639
+ _id: (0, import_core106.generateId)(),
86640
86640
  virtual: true
86641
86641
  };
86642
86642
  }
@@ -86949,7 +86949,7 @@ var require_utils13 = __commonJS({
86949
86949
  }
86950
86950
  __name(getAllEvents, "getAllEvents");
86951
86951
  function generateEventId4() {
86952
- const id2 = (0, import_core105.generateId)();
86952
+ const id2 = (0, import_core106.generateId)();
86953
86953
  return encodeToBase32Hex(id2);
86954
86954
  }
86955
86955
  __name(generateEventId4, "generateEventId");
@@ -87390,18 +87390,18 @@ var require_cache4 = __commonJS({
87390
87390
  default: () => ContactCache
87391
87391
  });
87392
87392
  module2.exports = __toCommonJS2(cache_exports);
87393
- var import_core105 = __toESM3(require_lib5());
87393
+ var import_core106 = __toESM3(require_lib5());
87394
87394
  var import__ = __toESM3(require_lib28());
87395
87395
  function isCreateTx(tx) {
87396
- return tx._class === import_core105.default.class.TxCreateDoc;
87396
+ return tx._class === import_core106.default.class.TxCreateDoc;
87397
87397
  }
87398
87398
  __name(isCreateTx, "isCreateTx");
87399
87399
  function isUpdateTx(tx) {
87400
- return tx._class === import_core105.default.class.TxUpdateDoc;
87400
+ return tx._class === import_core106.default.class.TxUpdateDoc;
87401
87401
  }
87402
87402
  __name(isUpdateTx, "isUpdateTx");
87403
87403
  function isMixinTx(tx) {
87404
- return tx._class === import_core105.default.class.TxMixin;
87404
+ return tx._class === import_core106.default.class.TxMixin;
87405
87405
  }
87406
87406
  __name(isMixinTx, "isMixinTx");
87407
87407
  function isPersonTx(tx) {
@@ -87508,7 +87508,7 @@ var require_cache4 = __commonJS({
87508
87508
  const ref = tx.objectId;
87509
87509
  const person = this._personByRef.get(ref);
87510
87510
  if (person === void 0) return;
87511
- const createdPerson = import_core105.TxProcessor.createDoc2Doc(tx);
87511
+ const createdPerson = import_core106.TxProcessor.createDoc2Doc(tx);
87512
87512
  this._personByRef.set(ref, createdPerson);
87513
87513
  const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? []);
87514
87514
  for (const personId of personIds) {
@@ -87526,7 +87526,7 @@ var require_cache4 = __commonJS({
87526
87526
  const newPersonRef = tx.attachedTo;
87527
87527
  this._personRefByPersonId.set(personId, newPersonRef);
87528
87528
  this.addPersonIdToPersonRef(newPersonRef, personId);
87529
- const createdSocialId = import_core105.TxProcessor.createDoc2Doc(tx);
87529
+ const createdSocialId = import_core106.TxProcessor.createDoc2Doc(tx);
87530
87530
  this._socialIdByPersonId.set(personId, createdSocialId);
87531
87531
  this.broadcastChange({
87532
87532
  personRef: newPersonRef,
@@ -87537,7 +87537,7 @@ var require_cache4 = __commonJS({
87537
87537
  const ref = tx.objectId;
87538
87538
  const person = this._personByRef.get(ref);
87539
87539
  if (person == null) return;
87540
- const updatedPerson = isUpdateTx(tx) ? import_core105.TxProcessor.updateDoc2Doc(person, tx) : import_core105.TxProcessor.updateMixin4Doc(person, tx);
87540
+ const updatedPerson = isUpdateTx(tx) ? import_core106.TxProcessor.updateDoc2Doc(person, tx) : import_core106.TxProcessor.updateMixin4Doc(person, tx);
87541
87541
  this._personByRef.set(ref, updatedPerson);
87542
87542
  const personIds = Array.from(this._personIdsByPersonRef.get(ref) ?? []);
87543
87543
  for (const personId of personIds) {
@@ -87652,7 +87652,7 @@ var require_utils14 = __commonJS({
87652
87652
  setCurrentEmployeeSpace: () => setCurrentEmployeeSpace
87653
87653
  });
87654
87654
  module2.exports = __toCommonJS2(utils_exports);
87655
- var import_core105 = require_lib5();
87655
+ var import_core106 = require_lib5();
87656
87656
  var import_platform4 = require_lib();
87657
87657
  var import__ = __toESM3(require_lib28());
87658
87658
  var import_types6 = require_types11();
@@ -87856,7 +87856,7 @@ var require_utils14 = __commonJS({
87856
87856
  if (socialIds.length === 0) {
87857
87857
  return;
87858
87858
  }
87859
- return (0, import_core105.pickPrimarySocialId)(socialIds)._id;
87859
+ return (0, import_core106.pickPrimarySocialId)(socialIds)._id;
87860
87860
  }
87861
87861
  __name(getPrimarySocialId, "getPrimarySocialId");
87862
87862
  async function getAllSocialStringsByPersonId(client, personId) {
@@ -87895,12 +87895,12 @@ var require_utils14 = __commonJS({
87895
87895
  __name(getSocialStringsByEmployee, "getSocialStringsByEmployee");
87896
87896
  async function getAllAccounts(client) {
87897
87897
  const employees = await client.findAll(import__.default.mixin.Employee, { active: true });
87898
- return employees.map((it) => it.personUuid).filter(import_core105.notEmpty);
87898
+ return employees.map((it) => it.personUuid).filter(import_core106.notEmpty);
87899
87899
  }
87900
87900
  __name(getAllAccounts, "getAllAccounts");
87901
87901
  async function getAllUserAccounts(client) {
87902
87902
  const employees = await client.findAll(import__.default.mixin.Employee, { active: true });
87903
- return employees.map((it) => it.personUuid).filter(import_core105.notEmpty);
87903
+ return employees.map((it) => it.personUuid).filter(import_core106.notEmpty);
87904
87904
  }
87905
87905
  __name(getAllUserAccounts, "getAllUserAccounts");
87906
87906
  async function ensureEmployee(ctx, me, client, socialIds, getGlobalPerson) {
@@ -87909,7 +87909,7 @@ var require_utils14 = __commonJS({
87909
87909
  }
87910
87910
  __name(ensureEmployee, "ensureEmployee");
87911
87911
  async function ensureEmployeeForPerson(ctx, me, person, client, socialIds, globalPerson) {
87912
- const txFactory = new import_core105.TxFactory(me.primarySocialId);
87912
+ const txFactory = new import_core106.TxFactory(me.primarySocialId);
87913
87913
  const personByUuid = await client.findOne(import__.default.class.Person, { personUuid: person.uuid });
87914
87914
  let personRef = personByUuid?._id;
87915
87915
  if (personRef === void 0) {
@@ -87930,7 +87930,7 @@ var require_utils14 = __commonJS({
87930
87930
  city: globalPerson.city,
87931
87931
  avatarType: import__.AvatarType.COLOR
87932
87932
  };
87933
- personRef = (0, import_core105.generateId)();
87933
+ personRef = (0, import_core106.generateId)();
87934
87934
  const createPersonTx = txFactory.createTxCreateDoc(import__.default.class.Person, import__.default.space.Contacts, data, personRef);
87935
87935
  await client.tx(createPersonTx);
87936
87936
  });
@@ -87940,7 +87940,7 @@ var require_utils14 = __commonJS({
87940
87940
  });
87941
87941
  await client.tx(updatePersonTx);
87942
87942
  }
87943
- const existingIdentifiers = (0, import_core105.toIdMap)(
87943
+ const existingIdentifiers = (0, import_core106.toIdMap)(
87944
87944
  await client.findAll(import__.default.class.SocialIdentity, { _id: { $in: person.socialIds } })
87945
87945
  );
87946
87946
  for (const socialId of socialIds) {
@@ -87965,7 +87965,7 @@ var require_utils14 = __commonJS({
87965
87965
  collection: "socialIds",
87966
87966
  type: socialId.type,
87967
87967
  value: socialId.value,
87968
- key: (0, import_core105.buildSocialIdString)(socialId),
87968
+ key: (0, import_core106.buildSocialIdString)(socialId),
87969
87969
  // TODO: fill it in trigger or on DB level as stored calculated column or smth?
87970
87970
  verifiedOn: socialId.verifiedOn,
87971
87971
  isDeleted: socialId.isDeleted
@@ -88006,9 +88006,9 @@ var require_utils14 = __commonJS({
88006
88006
  }
88007
88007
  }
88008
88008
  }
88009
- const employeeRole = person.role === import_core105.AccountRole.Guest || person.role === import_core105.AccountRole.ReadOnlyGuest ? "GUEST" : "USER";
88009
+ const employeeRole = person.role === import_core106.AccountRole.Guest || person.role === import_core106.AccountRole.ReadOnlyGuest ? "GUEST" : "USER";
88010
88010
  const employee = await client.findOne(import__.default.mixin.Employee, { _id: personRef });
88011
- if (employee === void 0 || !import_core105.Hierarchy.hasMixin(employee, import__.default.mixin.Employee) || !employee.active || employee.role !== employeeRole) {
88011
+ if (employee === void 0 || !import_core106.Hierarchy.hasMixin(employee, import__.default.mixin.Employee) || !employee.active || employee.role !== employeeRole) {
88012
88012
  await ctx.with("create-employee", {}, async () => {
88013
88013
  if (personRef === void 0) {
88014
88014
  console.error("Person not found");
@@ -88048,7 +88048,7 @@ var require_utils14 = __commonJS({
88048
88048
  }
88049
88049
  __name(loadCachesForPersonId, "loadCachesForPersonId");
88050
88050
  async function loadCachesForPersonIds(client, personIds) {
88051
- const sidObjsMap = (0, import_core105.toIdMap)(
88051
+ const sidObjsMap = (0, import_core106.toIdMap)(
88052
88052
  await client.findAll(
88053
88053
  import__.default.class.SocialIdentity,
88054
88054
  {
@@ -88083,7 +88083,7 @@ var require_utils14 = __commonJS({
88083
88083
  }
88084
88084
  __name(loadCachesForPersonRef, "loadCachesForPersonRef");
88085
88085
  async function loadCachesForPersonRefs(client, personRefs2) {
88086
- const persons = (0, import_core105.toIdMap)(
88086
+ const persons = (0, import_core106.toIdMap)(
88087
88087
  await client.findAll(
88088
88088
  import__.default.class.Person,
88089
88089
  {
@@ -88126,7 +88126,7 @@ var require_utils14 = __commonJS({
88126
88126
  personIds.map((pid) => {
88127
88127
  const ref = contactCache.personRefByPersonId.get(pid);
88128
88128
  return ref != null ? [pid, ref] : void 0;
88129
- }).filter(import_core105.notEmpty)
88129
+ }).filter(import_core106.notEmpty)
88130
88130
  );
88131
88131
  }
88132
88132
  __name(getPersonRefsByPersonIdsFromCache, "getPersonRefsByPersonIdsFromCache");
@@ -88173,7 +88173,7 @@ var require_utils14 = __commonJS({
88173
88173
  personIds.map((pid) => {
88174
88174
  const person = contactCache.personByPersonId.get(pid);
88175
88175
  return person != null ? [pid, person] : void 0;
88176
- }).filter(import_core105.notEmpty)
88176
+ }).filter(import_core106.notEmpty)
88177
88177
  );
88178
88178
  }
88179
88179
  __name(getPersonsByPersonIdsFromCache, "getPersonsByPersonIdsFromCache");
@@ -88220,7 +88220,7 @@ var require_utils14 = __commonJS({
88220
88220
  personRefs2.map((personRef) => {
88221
88221
  const person = contactCache.personByRef.get(personRef);
88222
88222
  return person != null ? [personRef, person] : void 0;
88223
- }).filter(import_core105.notEmpty)
88223
+ }).filter(import_core106.notEmpty)
88224
88224
  );
88225
88225
  }
88226
88226
  __name(getPersonsByPersonRefsFromCache, "getPersonsByPersonRefsFromCache");
@@ -88977,7 +88977,7 @@ var require_utils15 = __commonJS({
88977
88977
  isOffice: () => isOffice
88978
88978
  });
88979
88979
  module2.exports = __toCommonJS2(utils_exports);
88980
- var import_core105 = require_lib5();
88980
+ var import_core106 = require_lib5();
88981
88981
  var import_plugin = __toESM3(require_plugin2());
88982
88982
  var import_types6 = require_types12();
88983
88983
  var GRID_WIDTH = 15;
@@ -88988,7 +88988,7 @@ var require_utils15 = __commonJS({
88988
88988
  function createDefaultRooms(employees) {
88989
88989
  const res = [];
88990
88990
  for (let index = 0; index < 12; index++) {
88991
- const _id = (0, import_core105.generateId)();
88991
+ const _id = (0, import_core106.generateId)();
88992
88992
  const office = {
88993
88993
  _id,
88994
88994
  name: "",
@@ -89007,7 +89007,7 @@ var require_utils15 = __commonJS({
89007
89007
  };
89008
89008
  res.push(office);
89009
89009
  }
89010
- const allHands = (0, import_core105.generateId)();
89010
+ const allHands = (0, import_core106.generateId)();
89011
89011
  res.push({
89012
89012
  _id: allHands,
89013
89013
  name: "All hands",
@@ -89023,7 +89023,7 @@ var require_utils15 = __commonJS({
89023
89023
  startWithRecording: true,
89024
89024
  description: null
89025
89025
  });
89026
- const meetingRoom1 = (0, import_core105.generateId)();
89026
+ const meetingRoom1 = (0, import_core106.generateId)();
89027
89027
  res.push({
89028
89028
  _id: meetingRoom1,
89029
89029
  name: "Meeting Room 1",
@@ -89039,7 +89039,7 @@ var require_utils15 = __commonJS({
89039
89039
  startWithRecording: true,
89040
89040
  description: null
89041
89041
  });
89042
- const meetingRoom2 = (0, import_core105.generateId)();
89042
+ const meetingRoom2 = (0, import_core106.generateId)();
89043
89043
  res.push({
89044
89044
  _id: meetingRoom2,
89045
89045
  name: "Meeting Room 2",
@@ -89055,7 +89055,7 @@ var require_utils15 = __commonJS({
89055
89055
  startWithRecording: true,
89056
89056
  description: null
89057
89057
  });
89058
- const voiceRoom1 = (0, import_core105.generateId)();
89058
+ const voiceRoom1 = (0, import_core106.generateId)();
89059
89059
  res.push({
89060
89060
  _id: voiceRoom1,
89061
89061
  name: "Voice Room 1",
@@ -89071,7 +89071,7 @@ var require_utils15 = __commonJS({
89071
89071
  startWithRecording: false,
89072
89072
  description: null
89073
89073
  });
89074
- const voiceRoom2 = (0, import_core105.generateId)();
89074
+ const voiceRoom2 = (0, import_core106.generateId)();
89075
89075
  res.push({
89076
89076
  _id: voiceRoom2,
89077
89077
  name: "Voice Room 2",
@@ -154348,6 +154348,7 @@ var MIN_HTTP_PORT = 0;
154348
154348
  var MAX_HTTP_PORT = 65535;
154349
154349
  var HTTP_UNAUTHORIZED_ERROR_CODE = -32e3;
154350
154350
  var HTTP_UNAUTHORIZED = 401;
154351
+ var DEFAULT_HTTP_PORT_NUMBER = 3e3;
154351
154352
  var HttpPort = Schema_exports.Number.pipe(Schema_exports.int(), Schema_exports.between(MIN_HTTP_PORT, MAX_HTTP_PORT)).annotations({
154352
154353
  identifier: "HttpPort",
154353
154354
  description: "TCP port used by the MCP HTTP server."
@@ -154356,7 +154357,7 @@ var HttpHost = Schema_exports.NonEmptyTrimmedString.annotations({
154356
154357
  identifier: "HttpHost",
154357
154358
  description: "Host interface used by the MCP HTTP server."
154358
154359
  });
154359
- var DEFAULT_HTTP_PORT = HttpPort.make(3e3);
154360
+ var DEFAULT_HTTP_PORT = HttpPort.make(DEFAULT_HTTP_PORT_NUMBER);
154360
154361
  var DEFAULT_HTTP_HOST = HttpHost.make("127.0.0.1");
154361
154362
  var UnauthorizedJsonRpcResponse = Schema_exports.Struct({
154362
154363
  jsonrpc: Schema_exports.Literal("2.0"),
@@ -155241,8 +155242,10 @@ var ToolWarningCodeSchema = Schema_exports.Literal(
155241
155242
  "approval_request_count_metadata_degraded",
155242
155243
  "hosted_huly_shutdown",
155243
155244
  "issue_label_metadata_degraded",
155245
+ "issue_milestone_metadata_degraded",
155244
155246
  "notification_metadata_degraded",
155245
- "card_version_metadata_degraded"
155247
+ "card_version_metadata_degraded",
155248
+ "issue_creator_metadata_degraded"
155246
155249
  ).annotations({
155247
155250
  identifier: "ToolWarningCode",
155248
155251
  title: "ToolWarningCode",
@@ -155257,8 +155260,10 @@ var ApprovalRequestPersonMetadataDegradedWarningCode = ToolWarningCodeSchema.lit
155257
155260
  var ApprovalRequestCountMetadataDegradedWarningCode = ToolWarningCodeSchema.literals[6];
155258
155261
  var HostedHulyShutdownWarningCode = ToolWarningCodeSchema.literals[7];
155259
155262
  var IssueLabelMetadataDegradedWarningCode = ToolWarningCodeSchema.literals[8];
155260
- var NotificationMetadataDegradedWarningCode = ToolWarningCodeSchema.literals[9];
155261
- var CardVersionMetadataDegradedWarningCode = ToolWarningCodeSchema.literals[10];
155263
+ var IssueMilestoneMetadataDegradedWarningCode = ToolWarningCodeSchema.literals[9];
155264
+ var NotificationMetadataDegradedWarningCode = ToolWarningCodeSchema.literals[10];
155265
+ var CardVersionMetadataDegradedWarningCode = ToolWarningCodeSchema.literals[11];
155266
+ var IssueCreatorMetadataDegradedWarningCode = ToolWarningCodeSchema.literals[12];
155262
155267
  var ToolWarningSchema = Schema_exports.Struct({
155263
155268
  code: ToolWarningCodeSchema,
155264
155269
  message: Schema_exports.Trim.pipe(Schema_exports.nonEmptyString()).annotations({
@@ -158591,10 +158596,14 @@ var LabelSchema = Schema_exports.Struct({
158591
158596
  description: "Human-readable issue label summary projected from a Huly label attachment."
158592
158597
  });
158593
158598
  var PersonRefSchema = Schema_exports.Struct({
158594
- id: PersonId,
158595
- name: Schema_exports.optional(PersonName),
158596
- email: Schema_exports.optional(Email)
158597
- }).annotations({ title: "PersonRef", description: "Reference to a person (assignee, reporter)" });
158599
+ id: PersonId.annotations({ description: "Stable Huly Person ID, never a SocialIdentity ID." }),
158600
+ name: Schema_exports.optionalWith(PersonName, { exact: true }),
158601
+ email: Schema_exports.optionalWith(Email, { exact: true })
158602
+ }).annotations({ title: "PersonRef", description: "Stable person reference with optional readable identity metadata." });
158603
+ var IssueMilestoneRefSchema = Schema_exports.Struct({ id: MilestoneId, label: MilestoneLabel }).annotations({
158604
+ title: "IssueMilestoneRef",
158605
+ description: "Stable ID and human-readable label for the issue's assigned milestone."
158606
+ });
158598
158607
  var IssueIdOutputSchema = IssueId.annotations({
158599
158608
  description: "Raw Huly issue _id. For raw objectId/objectClass tools, pair this with objectClass 'tracker:class:Issue'. Prefer friendly issue locators when a tool provides them."
158600
158609
  });
@@ -158606,11 +158615,13 @@ var IssueSummarySchema = Schema_exports.Struct({
158606
158615
  status: StatusName,
158607
158616
  priority: Schema_exports.optional(IssuePrioritySchema),
158608
158617
  assignee: Schema_exports.optional(PersonName),
158618
+ creator: Schema_exports.optionalWith(PersonRefSchema, { exact: true }),
158609
158619
  parentIssue: Schema_exports.optional(IssueIdentifier),
158610
158620
  subIssues: Schema_exports.optional(Count),
158611
158621
  labels: Schema_exports.Array(LabelSchema).annotations({
158612
158622
  description: "Attached labels sorted by title. Empty when no usable label attachments exist; duplicate titles are collapsed case-insensitively, preferring a reference with a valid color."
158613
158623
  }),
158624
+ milestone: Schema_exports.optionalWith(IssueMilestoneRefSchema, { exact: true }),
158614
158625
  modifiedOn: Schema_exports.optional(Timestamp)
158615
158626
  }).annotations({ title: "IssueSummary", description: "Issue summary for list operations" });
158616
158627
  var IssueSchema = Schema_exports.Struct({
@@ -158623,9 +158634,11 @@ var IssueSchema = Schema_exports.Struct({
158623
158634
  priority: Schema_exports.optional(IssuePrioritySchema),
158624
158635
  assignee: Schema_exports.optional(PersonName),
158625
158636
  assigneeRef: Schema_exports.optional(PersonRefSchema),
158637
+ creator: Schema_exports.optionalWith(PersonRefSchema, { exact: true }),
158626
158638
  labels: Schema_exports.Array(LabelSchema).annotations({
158627
158639
  description: "Attached labels sorted by title. Empty when no usable label attachments exist; duplicate titles are collapsed case-insensitively, preferring a reference with a valid color."
158628
158640
  }),
158641
+ milestone: Schema_exports.optionalWith(IssueMilestoneRefSchema, { exact: true }),
158629
158642
  project: ProjectIdentifier,
158630
158643
  parentIssue: Schema_exports.optional(IssueIdentifier),
158631
158644
  subIssues: Schema_exports.optional(Count),
@@ -158647,6 +158660,11 @@ var ListIssuesParamsBase = Schema_exports.Struct({
158647
158660
  })
158648
158661
  ),
158649
158662
  assignee: Schema_exports.optional(PersonRefInput.annotations({ description: "Filter by assignee email or display name" })),
158663
+ creator: Schema_exports.optional(
158664
+ PersonRefInput.annotations({
158665
+ description: "Filter by creator using a raw Person ID, exact email address, or exact display name. Ambiguous exact display names are rejected; unknown people return an empty list."
158666
+ })
158667
+ ),
158650
158668
  parentIssue: Schema_exports.optional(
158651
158669
  IssueIdentifier.annotations({ description: "Filter to children of this parent issue (e.g., 'HULY-42')" })
158652
158670
  ),
@@ -158669,6 +158687,14 @@ var ListIssuesParamsBase = Schema_exports.Struct({
158669
158687
  description: "Filter by an attached human-readable label title. Matching is exact after trimming and case-insensitive; duplicate attachments do not duplicate issues."
158670
158688
  })
158671
158689
  ),
158690
+ milestone: Schema_exports.optional(MilestoneIdentifier).annotations({
158691
+ description: "Milestone ID or exact project-scoped label after trimming and case-insensitive matching. Mutually exclusive with hasMilestone."
158692
+ }),
158693
+ hasMilestone: Schema_exports.optional(
158694
+ Schema_exports.Boolean.annotations({
158695
+ description: "Filter by milestone presence. true = only scheduled issues, false = only issues without a milestone."
158696
+ })
158697
+ ),
158672
158698
  hasAssignee: Schema_exports.optional(
158673
158699
  Schema_exports.Boolean.annotations({
158674
158700
  description: "Filter by assignee presence. true = only assigned issues, false = only unassigned issues."
@@ -158707,6 +158733,9 @@ var ListIssuesParamsSchema = ListIssuesParamsBase.pipe(
158707
158733
  if (params3.component !== void 0 && params3.hasComponent !== void 0) {
158708
158734
  return "Cannot provide both 'component' and 'hasComponent'. Use one or the other.";
158709
158735
  }
158736
+ if (params3.milestone !== void 0 && params3.hasMilestone !== void 0) {
158737
+ return "Cannot provide both 'milestone' and 'hasMilestone'. Use one or the other.";
158738
+ }
158710
158739
  if (params3.parentIssue !== void 0 && params3.isTopLevel === true) {
158711
158740
  return "Cannot provide both 'parentIssue' and 'isTopLevel: true'. parentIssue requests children; isTopLevel requests parentless issues.";
158712
158741
  }
@@ -165014,17 +165043,72 @@ var GetLeadParamsSchema = Schema_exports.Struct({
165014
165043
  }),
165015
165044
  identifier: LeadIdentifier.annotations({ description: "Lead identifier (e.g., 'LEAD-1')" })
165016
165045
  }).annotations({ title: "GetLeadParams", description: "Parameters for getting a single lead" });
165046
+ var LeadPersonCustomerLocatorSchema = Schema_exports.Struct({
165047
+ kind: Schema_exports.Literal("person"),
165048
+ identifier: PersonRefInput.annotations({
165049
+ description: "Existing person _id, exact email address, or exact display name."
165050
+ })
165051
+ });
165052
+ var LeadOrganizationCustomerLocatorSchema = Schema_exports.Struct({
165053
+ kind: Schema_exports.Literal("organization"),
165054
+ identifier: NonEmptyString2.annotations({
165055
+ description: "Existing organization _id or exact unique organization name."
165056
+ })
165057
+ });
165058
+ var LeadCustomerLocatorSchema = Schema_exports.Union(
165059
+ LeadPersonCustomerLocatorSchema,
165060
+ LeadOrganizationCustomerLocatorSchema
165061
+ ).annotations({
165062
+ title: "LeadCustomerLocator",
165063
+ description: "Explicit locator for an existing Huly customer contact. Use person for a person _id, exact email, or exact display name; use organization for an organization _id or exact unique name. This tool never creates contacts inline."
165064
+ });
165065
+ var CreateLeadParamsSchema = Schema_exports.Struct({
165066
+ funnel: FunnelReference.annotations({
165067
+ description: "Active funnel ID returned by list_funnels, or exact funnel name."
165068
+ }),
165069
+ customer: LeadCustomerLocatorSchema.annotations({
165070
+ description: "Existing person or organization to attach as the customer. The contact is promoted to a Huly Customer idempotently when needed."
165071
+ }),
165072
+ title: NonEmptyString2.annotations({ description: "Non-empty lead title." }),
165073
+ description: Schema_exports.optional(
165074
+ Schema_exports.String.annotations({
165075
+ description: "Optional Markdown description. Current-workspace Huly links are preserved as native references."
165076
+ })
165077
+ ),
165078
+ assignee: Schema_exports.optional(
165079
+ PersonRefInput.annotations({
165080
+ description: "Optional employee assignee by person/employee ID, exact email, or exact display name."
165081
+ })
165082
+ ),
165083
+ status: Schema_exports.optional(
165084
+ StatusName.annotations({ description: "Optional exact status name within the selected task type workflow." })
165085
+ ),
165086
+ taskType: Schema_exports.optional(
165087
+ TaskTypeRefSchema.annotations({
165088
+ description: "Optional native Lead task type _id or exact display name within the funnel. Omit when the funnel has one deterministic Lead type."
165089
+ })
165090
+ )
165091
+ }).annotations({
165092
+ title: "CreateLeadParams",
165093
+ description: "Create one native Huly lead for an existing person or organization in an active funnel."
165094
+ });
165017
165095
  var listFunnelsParamsJsonSchema = JSONSchema_exports.make(ListFunnelsParamsSchema);
165018
165096
  var listLeadsParamsJsonSchema = JSONSchema_exports.make(ListLeadsParamsSchema);
165019
165097
  var getLeadParamsJsonSchema = JSONSchema_exports.make(GetLeadParamsSchema);
165098
+ var createLeadParamsJsonSchema = JSONSchema_exports.make(CreateLeadParamsSchema);
165020
165099
  var parseListFunnelsParams = Schema_exports.decodeUnknown(ListFunnelsParamsSchema);
165021
165100
  var parseListLeadsParams = Schema_exports.decodeUnknown(ListLeadsParamsSchema);
165022
165101
  var parseGetLeadParams = Schema_exports.decodeUnknown(GetLeadParamsSchema);
165102
+ var parseCreateLeadParams = Schema_exports.decodeUnknown(CreateLeadParamsSchema, { onExcessProperty: "error" });
165023
165103
  var parseLeadDetail = Schema_exports.decodeUnknown(LeadDetailSchema);
165024
165104
  var parseLeadSummary = Schema_exports.decodeUnknown(LeadSummarySchema);
165025
165105
  var ListFunnelsResultSchema = Schema_exports.Struct({ funnels: Schema_exports.Array(FunnelSummarySchema), total: ListTotal });
165026
165106
  var ListLeadsResultSchema = Schema_exports.Array(LeadSummarySchema);
165027
165107
  var GetLeadResultSchema = LeadDetailSchema;
165108
+ var CreateLeadResultSchema = Schema_exports.Struct({
165109
+ leadId: DocId.annotations({ description: "Raw Huly Lead document _id." }),
165110
+ identifier: LeadIdentifier.annotations({ description: "Human lead identifier in LEAD-<number> form." })
165111
+ }).annotations({ title: "CreateLeadResult", description: "Identifiers for the newly created native Huly lead." });
165028
165112
 
165029
165113
  // src/domain/schemas/recruiting-common.ts
165030
165114
  var RawRecruitingLocatorInput = Schema_exports.String.annotations({
@@ -166602,7 +166686,7 @@ var HulyAuthError = class extends Schema_exports.TaggedError()("HulyAuthError",
166602
166686
  };
166603
166687
 
166604
166688
  // src/version.ts
166605
- var VERSION = true ? "0.46.1" : "0.0.0-dev";
166689
+ var VERSION = true ? "0.47.0" : "0.0.0-dev";
166606
166690
 
166607
166691
  // src/huly/errors-approval-requests.ts
166608
166692
  var ApprovalRequestNotFoundError = class extends Schema_exports.TaggedError()(
@@ -168213,6 +168297,20 @@ var MilestoneNotFoundError = class extends Schema_exports.TaggedError()("Milesto
168213
168297
  return `Milestone '${this.identifier}' not found in project '${this.project}'`;
168214
168298
  }
168215
168299
  };
168300
+ var MilestoneAmbiguousCandidateSchema = Schema_exports.Struct({ id: MilestoneId, label: MilestoneLabel });
168301
+ var MilestoneIdentifierAmbiguousError = class extends Schema_exports.TaggedError()(
168302
+ "MilestoneIdentifierAmbiguousError",
168303
+ {
168304
+ identifier: MilestoneIdentifier,
168305
+ project: ProjectIdentifier,
168306
+ candidates: Schema_exports.Array(MilestoneAmbiguousCandidateSchema)
168307
+ }
168308
+ ) {
168309
+ get message() {
168310
+ const candidates = this.candidates.map(({ id: id2, label }) => `${label} (${id2})`).join(", ");
168311
+ return `Milestone '${this.identifier}' is ambiguous in project '${this.project}'; use an exact milestone ID. Matches: ${candidates}`;
168312
+ }
168313
+ };
168216
168314
  var ComponentNotFoundError = class extends Schema_exports.TaggedError()("ComponentNotFoundError", {
168217
168315
  identifier: Schema_exports.String,
168218
168316
  project: Schema_exports.String
@@ -168334,6 +168432,7 @@ var HulyDomainError = Schema_exports.Union(
168334
168432
  DocumentEditModeError,
168335
168433
  DocumentReferenceError,
168336
168434
  CommentNotFoundError,
168435
+ MilestoneIdentifierAmbiguousError,
168337
168436
  MilestoneNotFoundError,
168338
168437
  HulyMessagingDomainError,
168339
168438
  CalendarNotAccessibleError,
@@ -168573,6 +168672,7 @@ var INVALID_PARAMS_TAGS = /* @__PURE__ */ new Set([
168573
168672
  "DocumentReferenceError",
168574
168673
  "CommentNotFoundError",
168575
168674
  "CardCommentNotFoundError",
168675
+ "MilestoneIdentifierAmbiguousError",
168576
168676
  "MilestoneNotFoundError",
168577
168677
  "ChannelNotFoundError",
168578
168678
  "ChannelArchivedError",
@@ -169187,7 +169287,7 @@ function toInternalMarkup(value3, format8, opts, sdk) {
169187
169287
  );
169188
169288
  default:
169189
169289
  absurd(format8);
169190
- throw new Error(`Invalid format: ${format8}`);
169290
+ throw new Error("Invalid markup format");
169191
169291
  }
169192
169292
  }
169193
169293
  function fromInternalMarkup(markup, format8, opts, sdk) {
@@ -169200,7 +169300,7 @@ function fromInternalMarkup(markup, format8, opts, sdk) {
169200
169300
  return markupNodeToMarkdownString(sdk.markupToJSON(markup), opts, sdk.markupToMarkdown);
169201
169301
  default:
169202
169302
  absurd(format8);
169203
- throw new Error(`Invalid format: ${format8}`);
169303
+ throw new Error("Invalid markup format");
169204
169304
  }
169205
169305
  }
169206
169306
  var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyClient")() {
@@ -169767,6 +169867,10 @@ var findPersonByExactName = (client, name) => Effect_exports.gen(function* () {
169767
169867
  return persons[0];
169768
169868
  });
169769
169869
  var findPersonByExactEmailOrName = (client, identifier2) => isEmailIdentifier(identifier2) ? findPersonByExactEmail(client, identifier2) : findPersonByExactName(client, identifier2);
169870
+ var findPersonByIdOrExactEmailOrName = (client, identifier2) => Effect_exports.gen(function* () {
169871
+ const byId = yield* findPersonById(client, identifier2);
169872
+ return byId ?? (yield* findPersonByExactEmailOrName(client, identifier2));
169873
+ });
169770
169874
  var resolveEmployeeAccountUuid = (client, identifier2) => Effect_exports.gen(function* () {
169771
169875
  const person = yield* isEmailIdentifier(identifier2) ? findPersonByExactEmail(client, identifier2) : findPersonByExactName(client, PersonName.make(identifier2));
169772
169876
  if (person === void 0) {
@@ -169815,6 +169919,7 @@ var findPersonByEmailOrName = (client, emailOrName) => Effect_exports.gen(functi
169815
169919
  var import_core13 = __toESM(require_lib5(), 1);
169816
169920
 
169817
169921
  // src/utils/assertions.ts
169922
+ var PAIR_LENGTH = 2;
169818
169923
  var AssertionError = class extends Error {
169819
169924
  _tag = "AssertionError";
169820
169925
  constructor(message) {
@@ -169834,7 +169939,7 @@ var assertAt = (arr, index, message) => {
169834
169939
  };
169835
169940
  var isNonEmpty7 = (arr) => arr.length > 0;
169836
169941
  var isSingle2 = (arr) => arr.length === 1;
169837
- var isPair = (arr) => arr.length === 2;
169942
+ var isPair = (arr) => arr.length === PAIR_LENGTH;
169838
169943
 
169839
169944
  // src/huly/operations/spaces-shared.ts
169840
169945
  var spaceClass = toClassRef(core.class.Space);
@@ -170682,10 +170787,11 @@ var editDocument = (params3) => Effect_exports.gen(function* () {
170682
170787
  }
170683
170788
  return { id: DocumentId.make(doc._id), updated: true, url: url4 };
170684
170789
  });
170790
+ var NOT_FOUND_INDEX = -1;
170685
170791
  var countOccurrences = (text4, search) => {
170686
170792
  let count5 = 0;
170687
170793
  let pos = text4.indexOf(search);
170688
- while (pos !== -1) {
170794
+ while (pos !== NOT_FOUND_INDEX) {
170689
170795
  count5++;
170690
170796
  pos = text4.indexOf(search, pos + search.length);
170691
170797
  }
@@ -171368,6 +171474,18 @@ var IPV6_HEXTET_COUNT = 8;
171368
171474
  var IPV6_HEXTET_BITS = 16;
171369
171475
  var IPV6_GLOBAL_UNICAST_MIN = 8192;
171370
171476
  var IPV6_GLOBAL_UNICAST_MAX = 16383;
171477
+ var IPV4_ADDRESS_FAMILY = 4;
171478
+ var IPV6_ADDRESS_FAMILY = 6;
171479
+ var IPV4_THIRD_OCTET_INDEX = 2;
171480
+ var IPV4_FOURTH_OCTET_INDEX = 3;
171481
+ var REGEX_SECOND_CAPTURE_INDEX = 2;
171482
+ var IPV6_THIRD_HEXTET_INDEX = 2;
171483
+ var IPV6_FOURTH_HEXTET_INDEX = 3;
171484
+ var IPV6_FIFTH_HEXTET_INDEX = 4;
171485
+ var IPV6_SIXTH_HEXTET_INDEX = 5;
171486
+ var IPV6_SEVENTH_HEXTET_INDEX = 6;
171487
+ var IPV6_EIGHTH_HEXTET_INDEX = 7;
171488
+ var IPV6_MAX_COMPRESSION_PARTS = 2;
171371
171489
  var BYTE_BASE = 256;
171372
171490
  var HTTP_STATUS_OK_MIN = 200;
171373
171491
  var HTTP_STATUS_REDIRECT_MIN = 300;
@@ -171396,8 +171514,8 @@ var parseIpv4Address = (hostname3) => {
171396
171514
  const octets = parts2.map(Number);
171397
171515
  const a = assertAt(octets, 0);
171398
171516
  const b = assertAt(octets, 1);
171399
- const c = assertAt(octets, 2);
171400
- const d = assertAt(octets, 3);
171517
+ const c = assertAt(octets, IPV4_THIRD_OCTET_INDEX);
171518
+ const d = assertAt(octets, IPV4_FOURTH_OCTET_INDEX);
171401
171519
  if (octets.some((octet) => !Number.isInteger(octet) || octet < 0 || octet > IPV4_MAX_OCTET)) {
171402
171520
  return null;
171403
171521
  }
@@ -171427,7 +171545,7 @@ var ipv4FromMappedIpv6Hextets = (hostname3) => {
171427
171545
  return null;
171428
171546
  }
171429
171547
  const highText = assertAt(match19, 1);
171430
- const lowText = assertAt(match19, 2);
171548
+ const lowText = assertAt(match19, REGEX_SECOND_CAPTURE_INDEX);
171431
171549
  const high = Number.parseInt(highText, 16);
171432
171550
  const low = Number.parseInt(lowText, 16);
171433
171551
  return [Math.floor(high / BYTE_BASE), high % BYTE_BASE, Math.floor(low / BYTE_BASE), low % BYTE_BASE];
@@ -171453,24 +171571,24 @@ var isIpv6Hextets = (hextets) => hextets.length === IPV6_HEXTET_COUNT;
171453
171571
  var toIpv6Hextets = (hextets) => [
171454
171572
  assertAt(hextets, 0),
171455
171573
  assertAt(hextets, 1),
171456
- assertAt(hextets, 2),
171457
- assertAt(hextets, 3),
171458
- assertAt(hextets, 4),
171459
- assertAt(hextets, 5),
171460
- assertAt(hextets, 6),
171461
- assertAt(hextets, 7)
171574
+ assertAt(hextets, IPV6_THIRD_HEXTET_INDEX),
171575
+ assertAt(hextets, IPV6_FOURTH_HEXTET_INDEX),
171576
+ assertAt(hextets, IPV6_FIFTH_HEXTET_INDEX),
171577
+ assertAt(hextets, IPV6_SIXTH_HEXTET_INDEX),
171578
+ assertAt(hextets, IPV6_SEVENTH_HEXTET_INDEX),
171579
+ assertAt(hextets, IPV6_EIGHTH_HEXTET_INDEX)
171462
171580
  ];
171463
171581
  var parseIpv6Hextets = (hostname3) => {
171464
171582
  if (hostname3.includes(".")) {
171465
171583
  return null;
171466
171584
  }
171467
171585
  const compressedParts = hostname3.split("::");
171468
- if (compressedParts.length > 2) {
171586
+ if (compressedParts.length > IPV6_MAX_COMPRESSION_PARTS) {
171469
171587
  return null;
171470
171588
  }
171471
171589
  const leftText = assertAt(compressedParts, 0);
171472
171590
  const left3 = parseIpv6Side(leftText);
171473
- const right3 = compressedParts.length === 2 ? parseIpv6Side(assertAt(compressedParts, 1)) : [];
171591
+ const right3 = compressedParts.length === IPV6_MAX_COMPRESSION_PARTS ? parseIpv6Side(assertAt(compressedParts, 1)) : [];
171474
171592
  if (left3 === null || right3 === null) {
171475
171593
  return null;
171476
171594
  }
@@ -171526,7 +171644,7 @@ var isBlockedIpv6Address = (hostname3) => {
171526
171644
  if (hextets.every((hextet) => hextet === 0)) {
171527
171645
  return true;
171528
171646
  }
171529
- if (hextets.slice(0, 7).every((hextet) => hextet === 0) && hextets[7] === 1) {
171647
+ if (hextets.slice(0, IPV6_EIGHTH_HEXTET_INDEX).every((hextet) => hextet === 0) && assertAt(hextets, IPV6_EIGHTH_HEXTET_INDEX) === 1) {
171530
171648
  return true;
171531
171649
  }
171532
171650
  if (blockedIpv6SpecialUsePrefixes.some((prefix) => isIpv6InPrefix(hextets, prefix))) {
@@ -171535,7 +171653,7 @@ var isBlockedIpv6Address = (hostname3) => {
171535
171653
  const firstHextet = hextets[0];
171536
171654
  return firstHextet < IPV6_GLOBAL_UNICAST_MIN || firstHextet > IPV6_GLOBAL_UNICAST_MAX;
171537
171655
  };
171538
- var isSupportedAddressFamily = (family) => family === 4 || family === 6;
171656
+ var isSupportedAddressFamily = (family) => family === IPV4_ADDRESS_FAMILY || family === IPV6_ADDRESS_FAMILY;
171539
171657
  var toResolvedAddress = (address) => isSupportedAddressFamily(address.family) ? { address: address.address, family: address.family } : null;
171540
171658
  var resolveHostname = async (hostname3) => {
171541
171659
  const addresses = await (0, import_promises3.lookup)(hostname3, { all: true, order: "verbatim" });
@@ -171546,7 +171664,7 @@ var resolveHostname = async (hostname3) => {
171546
171664
  };
171547
171665
  var isBlockedResolvedAddress = (address) => {
171548
171666
  const normalizedAddress = normalizeUrlHostname(address.address);
171549
- if (address.family === 4) {
171667
+ if (address.family === IPV4_ADDRESS_FAMILY) {
171550
171668
  const ipv4Address = parseIpv4Address(normalizedAddress);
171551
171669
  return ipv4Address === null || isBlockedIpv4Address(ipv4Address);
171552
171670
  }
@@ -176407,8 +176525,8 @@ var nonEmptyTrimmed = (value3) => {
176407
176525
  const normalized = value3.trim();
176408
176526
  return normalized === "" ? Option_exports.none() : Option_exports.some(normalized);
176409
176527
  };
176410
- var classNameOption = (value3) => Option_exports.map(nonEmptyTrimmed(value3), ObjectClassName.make);
176411
- var enumIdOption = (value3) => Option_exports.map(nonEmptyTrimmed(value3), HulyEnumId.make);
176528
+ var classNameOption = (value3) => Option_exports.map(nonEmptyTrimmed(value3), (value4) => ObjectClassName.make(value4));
176529
+ var enumIdOption = (value3) => Option_exports.map(nonEmptyTrimmed(value3), (value4) => HulyEnumId.make(value4));
176412
176530
  var decodeSdkClassifierKind = (kind) => Either_exports.getOrElse(Schema_exports.decodeUnknownEither(HulySdkClassifierKindSchema)(kind), () => "unknown");
176413
176531
  var encodeClassifierKindFilter = (kind) => kind === "unknown" ? Option_exports.none() : Option_exports.some(Schema_exports.encodeSync(HulySdkClassifierKindSchema)(kind));
176414
176532
  var stringOptionValues = (value3) => Option_exports.isSome(value3) ? [value3.value] : [];
@@ -176460,7 +176578,7 @@ var toClassSummary = (cls, attributesCount) => {
176460
176578
  };
176461
176579
  var decodeAttributeType = (value3) => {
176462
176580
  const record4 = decodeSdkRecord(value3);
176463
- const rawClass = String(record4._class ?? "");
176581
+ const rawClass = typeof record4._class === "string" ? record4._class : "";
176464
176582
  const rawKind = hulyAttributeTypeKindFromClass(rawClass);
176465
176583
  const base = { ...typeClassIdField(classNameOption(rawClass)) };
176466
176584
  const unknownType = { kind: "unknown", ...base, raw: record4 };
@@ -176740,9 +176858,10 @@ var toEntry = (card) => Schema_exports.decodeUnknown(CardHistoryProjectionSchema
176740
176858
  })
176741
176859
  )
176742
176860
  );
176861
+ var SORT_BEFORE = -1;
176743
176862
  var compareOptionalNumber = (left3, right3) => {
176744
176863
  if (left3 === void 0) return right3 === void 0 ? 0 : 1;
176745
- if (right3 === void 0) return -1;
176864
+ if (right3 === void 0) return SORT_BEFORE;
176746
176865
  return left3 - right3;
176747
176866
  };
176748
176867
  var compareVersions = (left3, right3) => {
@@ -177347,10 +177466,12 @@ var listExternalChannelMessages = (params3) => Effect_exports.sync(() => ({
177347
177466
 
177348
177467
  // src/huly/operations/threads.ts
177349
177468
  var import_core40 = __toESM(require_lib5(), 1);
177469
+ var DEFAULT_REPLY_LIMIT = 50;
177470
+ var MAX_REPLY_LIMIT = 200;
177350
177471
  var listThreadReplies = (params3) => Effect_exports.gen(function* () {
177351
177472
  const { channel, client, message } = yield* findChannelMessage(params3);
177352
177473
  const markupUrlConfig = client.markupUrlConfig;
177353
- const limit = Math.min(params3.limit ?? 50, 200);
177474
+ const limit = Math.min(params3.limit ?? DEFAULT_REPLY_LIMIT, MAX_REPLY_LIMIT);
177354
177475
  const replies = yield* client.findAll(
177355
177476
  chunter.class.ThreadMessage,
177356
177477
  { attachedTo: toRef(message._id), space: channel._id },
@@ -178599,10 +178720,12 @@ var import_core43 = __toESM(require_lib5(), 1);
178599
178720
 
178600
178721
  // src/huly/lead-plugin.ts
178601
178722
  var leadRef = (identifier2) => identifier2;
178723
+ var leadDocRef = (identifier2) => identifier2;
178602
178724
  var leadMixinRef = (identifier2) => identifier2;
178603
178725
  var leadClassIds = {
178604
178726
  class: { Lead: leadRef("lead:class:Lead"), Funnel: leadRef("lead:class:Funnel") },
178605
- mixin: { Customer: leadMixinRef("lead:mixin:Customer") }
178727
+ mixin: { Customer: leadMixinRef("lead:mixin:Customer") },
178728
+ taskType: { Lead: leadDocRef("lead:taskType:Lead") }
178606
178729
  };
178607
178730
 
178608
178731
  // src/huly/operations/organizations.ts
@@ -178791,10 +178914,10 @@ var listOrganizationMembers = (params3) => Effect_exports.gen(function* () {
178791
178914
  const entries2 = persons.map((p) => {
178792
178915
  const email3 = emails.get(p._id);
178793
178916
  const entry = { personId: PersonId.make(p._id), name: PersonName.make(p.name) };
178794
- return Option_exports.match(Option_exports.map(Option_exports.fromNullable(email3), Email.make), {
178795
- onNone: () => entry,
178796
- onSome: (memberEmail) => ({ ...entry, email: memberEmail })
178797
- });
178917
+ return Option_exports.match(
178918
+ Option_exports.map(Option_exports.fromNullable(email3), (value3) => Email.make(value3)),
178919
+ { onNone: () => entry, onSome: (memberEmail) => ({ ...entry, email: memberEmail }) }
178920
+ );
178798
178921
  });
178799
178922
  return { organizationId: OrganizationId.make(org._id), members: entries2 };
178800
178923
  });
@@ -179490,6 +179613,8 @@ var customFieldTools = [
179490
179613
 
179491
179614
  // src/huly/operations/components.ts
179492
179615
  var import_core46 = __toESM(require_lib5(), 1);
179616
+ var DEFAULT_COMPONENT_LIMIT = 50;
179617
+ var MAX_COMPONENT_LIMIT = 200;
179493
179618
  var findComponentByIdOrLabel = (client, projectId, componentIdOrLabel) => Effect_exports.gen(function* () {
179494
179619
  const component = (yield* client.findOne(tracker.class.Component, {
179495
179620
  space: projectId,
@@ -179507,7 +179632,7 @@ var findProjectAndComponent = (params3) => Effect_exports.gen(function* () {
179507
179632
  });
179508
179633
  var listComponents = (params3) => Effect_exports.gen(function* () {
179509
179634
  const { client, project: project3 } = yield* findProject(params3.project);
179510
- const limit = Math.min(params3.limit ?? 50, 200);
179635
+ const limit = Math.min(params3.limit ?? DEFAULT_COMPONENT_LIMIT, MAX_COMPONENT_LIMIT);
179511
179636
  const components = yield* client.findAll(
179512
179637
  tracker.class.Component,
179513
179638
  { space: project3._id },
@@ -180785,6 +180910,7 @@ var removeFileVersion = (client, driveSpace, file4, version3) => {
180785
180910
  };
180786
180911
 
180787
180912
  // src/huly/operations/drive.ts
180913
+ var LAST_SEGMENT_INDEX = -1;
180788
180914
  var listDrives = (params3) => Effect_exports.gen(function* () {
180789
180915
  const client = yield* HulyClient;
180790
180916
  const query = params3.includeArchived ?? DEFAULT_INCLUDE_ARCHIVED ? {} : { archived: false };
@@ -180863,7 +180989,7 @@ var uploadDriveFile = (params3) => Effect_exports.gen(function* () {
180863
180989
  new DrivePathConflictError({ drive: params3.drive, path: normalized.path, existingKind: "folder" })
180864
180990
  );
180865
180991
  }
180866
- const title = normalized.segments.at(-1);
180992
+ const title = normalized.segments.at(LAST_SEGMENT_INDEX);
180867
180993
  if (title === void 0) {
180868
180994
  return yield* Effect_exports.fail(
180869
180995
  new DrivePathConflictError({ drive: params3.drive, path: normalized.path, existingKind: "folder" })
@@ -181227,6 +181353,7 @@ var driveTools = [
181227
181353
 
181228
181354
  // src/huly/operations/generic-associations.ts
181229
181355
  var import_core52 = __toESM(require_lib5(), 1);
181356
+ var EXACT_RELATION_MATCH_LIMIT = 2;
181230
181357
  var ASSOCIATION_DISCOVERY_LIMIT = 200;
181231
181358
  var ASSOCIATION_DISCOVERY_LIMIT_WARNING = ListRelationsWarning.make(
181232
181359
  `Association discovery reached the local ${ASSOCIATION_DISCOVERY_LIMIT}-association cap for at least one endpoint orientation. Huly did not indicate whether more matching associations exist, so list_relations may omit older matching associations; pass a specific association from list_associations to avoid this discovery cap.`
@@ -181896,7 +182023,7 @@ var associationEndpointQueries = (source, target, direction) => {
181896
182023
  const queries = direction === "target-to-source" ? [makeQuery(true)] : direction === "either" ? [makeQuery(false), makeQuery(true)] : [makeQuery(false)];
181897
182024
  const byKey = /* @__PURE__ */ new Map();
181898
182025
  for (const query of queries) {
181899
- byKey.set(`${String(query.classA)}\0${String(query.classB)}`, query);
182026
+ byKey.set(JSON.stringify([query.classA, query.classB]), query);
181900
182027
  }
181901
182028
  return [...byKey.values()];
181902
182029
  };
@@ -182167,7 +182294,7 @@ var deleteRelation = (params3) => Effect_exports.gen(function* () {
182167
182294
  const association = yield* resolveAssociation(client, params3.association, MUTATION_ASSOCIATION_FILTERS);
182168
182295
  yield* ensureRelationMutationSupported(association, "delete_relation");
182169
182296
  const endpoints = yield* resolveRelationWriteEndpoints(client, association, params3);
182170
- const matches = yield* findExactRelations(client, association, endpoints, 2);
182297
+ const matches = yield* findExactRelations(client, association, endpoints, EXACT_RELATION_MATCH_LIMIT);
182171
182298
  if (matches.length === 0) {
182172
182299
  return { associationId: AssociationId.make(association._id), deleted: false, reason: "not_found" };
182173
182300
  }
@@ -184229,6 +184356,52 @@ var updateDescendantParents = (client, spaceId, parentIssue, parentNewParents) =
184229
184356
  var import_core60 = __toESM(require_lib5(), 1);
184230
184357
  var import_tracker4 = __toESM(require_lib24(), 1);
184231
184358
 
184359
+ // src/huly/operations/issue-creators-read.ts
184360
+ var parsePersonRef = Schema_exports.decodeUnknownOption(PersonRefSchema);
184361
+ var uniqueCreatorIds = (issues) => [
184362
+ ...new Set(issues.flatMap((issue2) => issue2.createdBy === void 0 ? [] : [issue2.createdBy]))
184363
+ ];
184364
+ var creatorRef = (person, emailByPerson) => parsePersonRef({
184365
+ id: person._id,
184366
+ ...person.name.trim() === "" ? {} : { name: person.name },
184367
+ ...emailByPerson.has(person._id) ? { email: emailByPerson.get(person._id) } : {}
184368
+ });
184369
+ var creatorForIssue = (index, issue2) => issue2.createdBy === void 0 ? void 0 : index.get(issue2.createdBy);
184370
+ var loadIssueCreatorIndex = (client, issues) => Effect_exports.gen(function* () {
184371
+ const creatorIds = uniqueCreatorIds(issues);
184372
+ if (creatorIds.length === 0) return /* @__PURE__ */ new Map();
184373
+ const identities = yield* client.findAll(
184374
+ contact.class.SocialIdentity,
184375
+ hulyQuery({ _id: { $in: creatorIds.map(toSocialIdentityRef) } })
184376
+ );
184377
+ const personIds = [...new Set(identities.map((identity5) => identity5.attachedTo))];
184378
+ const persons = personIds.length === 0 ? [] : yield* client.findAll(
184379
+ contact.class.Person,
184380
+ hulyQuery({ _id: { $in: personIds.map(toRef) } })
184381
+ );
184382
+ const emailByPerson = yield* batchGetEmailsForPersons(
184383
+ client,
184384
+ persons.map((person) => person._id)
184385
+ );
184386
+ const personById = new Map(persons.map((person) => [person._id, person]));
184387
+ const index = /* @__PURE__ */ new Map();
184388
+ for (const identity5 of identities) {
184389
+ const person = personById.get(identity5.attachedTo);
184390
+ if (person === void 0) continue;
184391
+ const parsed = creatorRef(person, emailByPerson);
184392
+ if (Option_exports.isSome(parsed)) index.set(identity5._id, parsed.value);
184393
+ }
184394
+ const unresolvedCount = creatorIds.filter((creatorId) => !index.has(creatorId)).length;
184395
+ if (unresolvedCount > 0) {
184396
+ const diagnostics = yield* Diagnostics;
184397
+ yield* diagnostics.warnAgent({
184398
+ code: IssueCreatorMetadataDegradedWarningCode,
184399
+ message: `${unresolvedCount} unresolved issue creator reference(s) were omitted from issue results.`
184400
+ });
184401
+ }
184402
+ return index;
184403
+ });
184404
+
184232
184405
  // src/huly/operations/issue-labels-read.ts
184233
184406
  var IssueLabelAttachmentBoundarySchema = Schema_exports.Struct({
184234
184407
  _id: TagReferenceId,
@@ -184341,6 +184514,88 @@ var loadIssueLabelIndex = (client, space, issueIds) => Effect_exports.gen(functi
184341
184514
  return index;
184342
184515
  });
184343
184516
 
184517
+ // src/huly/operations/issue-milestones-read.ts
184518
+ var parseMilestoneRef = Schema_exports.decodeUnknownOption(IssueMilestoneRefSchema);
184519
+ var uniqueMilestoneRefs = (issues) => [
184520
+ ...new Set(
184521
+ issues.flatMap((issue2) => issue2.milestone === null || issue2.milestone === void 0 ? [] : [issue2.milestone])
184522
+ )
184523
+ ];
184524
+ var milestoneForIssue = (index, issue2) => issue2.milestone === null || issue2.milestone === void 0 ? void 0 : index.get(MilestoneId.make(issue2.milestone));
184525
+ var loadIssueMilestoneIndex = (client, project3, issues) => Effect_exports.gen(function* () {
184526
+ const refs = uniqueMilestoneRefs(issues);
184527
+ if (refs.length === 0) return /* @__PURE__ */ new Map();
184528
+ const milestones = yield* client.findAll(
184529
+ tracker.class.Milestone,
184530
+ hulyQuery({ space: project3._id, _id: { $in: refs } })
184531
+ );
184532
+ const index = /* @__PURE__ */ new Map();
184533
+ for (const milestone of milestones) {
184534
+ const parsed = parseMilestoneRef({ id: milestone._id, label: milestone.label });
184535
+ if (Option_exports.isSome(parsed)) index.set(parsed.value.id, parsed.value);
184536
+ }
184537
+ const unresolvedCount = refs.filter((ref) => !index.has(MilestoneId.make(ref))).length;
184538
+ if (unresolvedCount > 0) {
184539
+ const diagnostics = yield* Diagnostics;
184540
+ yield* diagnostics.warnAgent({
184541
+ code: IssueMilestoneMetadataDegradedWarningCode,
184542
+ message: `${unresolvedCount} unresolved milestone reference(s) were omitted from issue results.`
184543
+ });
184544
+ }
184545
+ return index;
184546
+ });
184547
+
184548
+ // src/huly/operations/milestone-resolution.ts
184549
+ var NormalizedMilestoneLabel = NonEmptyString2.pipe(Schema_exports.brand("NormalizedMilestoneLabel"));
184550
+ var normalizeMilestoneLabel = (label) => NormalizedMilestoneLabel.make(label.trim().toLowerCase());
184551
+ var findMilestoneById = (client, project3, identifier2) => client.findOne(
184552
+ tracker.class.Milestone,
184553
+ hulyQuery({ space: project3._id, _id: toRef(identifier2) })
184554
+ );
184555
+ var parseMilestoneRef2 = (milestone) => Schema_exports.decodeUnknown(IssueMilestoneRefSchema)({ id: milestone._id, label: milestone.label }).pipe(
184556
+ Effect_exports.mapError(
184557
+ (cause3) => new HulyConnectionError({
184558
+ message: "Huly returned malformed milestone metadata while resolving an issue filter.",
184559
+ cause: cause3
184560
+ })
184561
+ )
184562
+ );
184563
+ var resolveIssueFilterMilestone = (client, project3, identifier2, projectIdentifier) => Effect_exports.gen(function* () {
184564
+ const idMatch = yield* findMilestoneById(client, project3, identifier2);
184565
+ if (idMatch !== void 0) {
184566
+ yield* parseMilestoneRef2(idMatch);
184567
+ return idMatch;
184568
+ }
184569
+ const milestones = yield* client.findAll(
184570
+ tracker.class.Milestone,
184571
+ hulyQuery({ space: project3._id })
184572
+ );
184573
+ const normalizedIdentifier = normalizeMilestoneLabel(identifier2);
184574
+ const parsedMilestones = yield* Effect_exports.forEach(
184575
+ milestones,
184576
+ (milestone) => Effect_exports.map(parseMilestoneRef2(milestone), (ref) => ({ milestone, ref }))
184577
+ );
184578
+ const labelMatches = parsedMilestones.filter(
184579
+ ({ ref }) => normalizeMilestoneLabel(ref.label) === normalizedIdentifier
184580
+ );
184581
+ const onlyLabelMatch = labelMatches.length === 1 ? labelMatches[0] : void 0;
184582
+ if (onlyLabelMatch !== void 0) return onlyLabelMatch.milestone;
184583
+ if (labelMatches.length > 1) {
184584
+ const candidates = labelMatches.map(({ ref }) => ref).sort((left3, right3) => left3.id.localeCompare(right3.id));
184585
+ return yield* new MilestoneIdentifierAmbiguousError({ identifier: identifier2, project: projectIdentifier, candidates });
184586
+ }
184587
+ return yield* new MilestoneNotFoundError({ identifier: identifier2, project: projectIdentifier });
184588
+ });
184589
+ var resolveMilestoneExact = (client, project3, identifier2, projectIdentifier) => Effect_exports.gen(function* () {
184590
+ const idMatch = yield* findMilestoneById(client, project3, identifier2);
184591
+ if (idMatch !== void 0) return idMatch;
184592
+ const labelMatch = yield* client.findOne(
184593
+ tracker.class.Milestone,
184594
+ hulyQuery({ space: project3._id, label: identifier2 })
184595
+ );
184596
+ return labelMatch !== void 0 ? labelMatch : yield* new MilestoneNotFoundError({ identifier: identifier2, project: projectIdentifier });
184597
+ });
184598
+
184344
184599
  // src/huly/operations/issues-read.ts
184345
184600
  var resolveStatusName = (statuses, statusId) => {
184346
184601
  const statusDoc = statuses.find((s) => s._id === statusId);
@@ -184376,6 +184631,16 @@ var listIssues = (params3) => Effect_exports.gen(function* () {
184376
184631
  return [];
184377
184632
  }
184378
184633
  }
184634
+ if (params3.creator !== void 0) {
184635
+ const creator = yield* findPersonByIdOrExactEmailOrName(client, params3.creator);
184636
+ if (creator === void 0) return [];
184637
+ const identities = yield* client.findAll(
184638
+ contact.class.SocialIdentity,
184639
+ hulyQuery({ attachedTo: creator._id })
184640
+ );
184641
+ if (identities.length === 0) return [];
184642
+ query.createdBy = { $in: identities.map((identity5) => identity5._id) };
184643
+ }
184379
184644
  if (params3.titleSearch !== void 0 && params3.titleSearch.trim() !== "") {
184380
184645
  query.title = { $like: `%${escapeLikeWildcards(params3.titleSearch)}%` };
184381
184646
  }
@@ -184412,6 +184677,13 @@ var listIssues = (params3) => Effect_exports.gen(function* () {
184412
184677
  } else if (params3.hasComponent === false) {
184413
184678
  query.component = null;
184414
184679
  }
184680
+ if (params3.milestone !== void 0) {
184681
+ query.milestone = (yield* resolveIssueFilterMilestone(client, project3, params3.milestone, params3.project))._id;
184682
+ } else if (params3.hasMilestone === true) {
184683
+ query.milestone = { $ne: null };
184684
+ } else if (params3.hasMilestone === false) {
184685
+ query.milestone = null;
184686
+ }
184415
184687
  if (params3.isTopLevel === true) {
184416
184688
  query.attachedTo = topLevelIssueParent().attachedTo;
184417
184689
  }
@@ -184434,10 +184706,14 @@ var listIssues = (params3) => Effect_exports.gen(function* () {
184434
184706
  project3._id,
184435
184707
  issues.map((issue2) => issue2._id)
184436
184708
  ) : labelFilterContext.index;
184709
+ const milestoneIndex = yield* loadIssueMilestoneIndex(client, project3, issues);
184710
+ const creatorIndex = yield* loadIssueCreatorIndex(client, issues);
184437
184711
  const rawSummaries = issues.map((issue2) => {
184438
184712
  const statusName = resolveStatusName(statuses, issue2.status);
184439
184713
  const assigneeName = issue2.$lookup?.assignee?.name;
184440
184714
  const directParent = issue2.parents.length > 0 ? issue2.parents[issue2.parents.length - 1] : void 0;
184715
+ const milestone = milestoneForIssue(milestoneIndex, issue2);
184716
+ const creator = creatorForIssue(creatorIndex, issue2);
184441
184717
  return {
184442
184718
  issueId: IssueId.make(issue2._id),
184443
184719
  identifier: issue2.identifier,
@@ -184445,9 +184721,11 @@ var listIssues = (params3) => Effect_exports.gen(function* () {
184445
184721
  status: statusName,
184446
184722
  priority: priorityToString(issue2.priority),
184447
184723
  assignee: assigneeName,
184724
+ ...creator === void 0 ? {} : { creator },
184448
184725
  parentIssue: directParent?.identifier,
184449
184726
  subIssues: issue2.subIssues > 0 ? issue2.subIssues : void 0,
184450
184727
  labels: labelsForIssue(labelIndex, issue2._id),
184728
+ ...milestone === void 0 ? {} : { milestone },
184451
184729
  modifiedOn: issue2.modifiedOn
184452
184730
  };
184453
184731
  });
@@ -184476,6 +184754,10 @@ var getIssue = (params3) => Effect_exports.gen(function* () {
184476
184754
  const description = issue2.description ? yield* client.fetchMarkup(issue2._class, issue2._id, "description", issue2.description, "markdown") : void 0;
184477
184755
  const directParent = issue2.parents.length > 0 ? issue2.parents[issue2.parents.length - 1] : void 0;
184478
184756
  const labelIndex = yield* loadIssueLabelIndex(client, project3._id, [issue2._id]);
184757
+ const milestoneIndex = yield* loadIssueMilestoneIndex(client, project3, [issue2]);
184758
+ const creatorIndex = yield* loadIssueCreatorIndex(client, [issue2]);
184759
+ const milestone = milestoneForIssue(milestoneIndex, issue2);
184760
+ const creator = creatorForIssue(creatorIndex, issue2);
184479
184761
  return yield* parseIssue({
184480
184762
  issueId: IssueId.make(issue2._id),
184481
184763
  identifier: issue2.identifier,
@@ -184485,7 +184767,9 @@ var getIssue = (params3) => Effect_exports.gen(function* () {
184485
184767
  priority: priorityToString(issue2.priority),
184486
184768
  assignee: person?.name,
184487
184769
  assigneeRef: person ? { id: person._id, name: person.name } : void 0,
184770
+ ...creator === void 0 ? {} : { creator },
184488
184771
  labels: labelsForIssue(labelIndex, issue2._id),
184772
+ ...milestone === void 0 ? {} : { milestone },
184489
184773
  project: params3.project,
184490
184774
  parentIssue: directParent?.identifier,
184491
184775
  subIssues: issue2.subIssues > 0 ? issue2.subIssues : void 0,
@@ -184769,6 +185053,7 @@ var deleteIssue = (params3) => Effect_exports.gen(function* () {
184769
185053
  });
184770
185054
 
184771
185055
  // src/huly/operations/issue-templates.ts
185056
+ var NOT_FOUND_INDEX2 = -1;
184772
185057
  var findTemplateByIdOrTitle = (client, projectId, templateIdOrTitle) => Effect_exports.gen(function* () {
184773
185058
  const template = (yield* client.findOne(tracker.class.IssueTemplate, {
184774
185059
  space: projectId,
@@ -185033,7 +185318,7 @@ var addTemplateChild = (params3) => Effect_exports.gen(function* () {
185033
185318
  var removeTemplateChild = (params3) => Effect_exports.gen(function* () {
185034
185319
  const { client, project: project3, template } = yield* findProjectAndTemplate(params3);
185035
185320
  const childIndex = template.children.findIndex((c) => String(c.id) === String(params3.childId));
185036
- if (childIndex === -1) {
185321
+ if (childIndex === NOT_FOUND_INDEX2) {
185037
185322
  return yield* new TemplateChildNotFoundError({
185038
185323
  childId: params3.childId,
185039
185324
  template: params3.template,
@@ -185273,7 +185558,7 @@ var issueTools = [
185273
185558
  name: "list_issues",
185274
185559
  description: `Query Huly issues with optional filters. Returns issues sorted by modification date (newest first). Supports filtering by project, exact workflow status name (status), Huly SDK task.statusCategory key (statusCategory: ${enumValuesDescription(
185275
185560
  StatusCategoryValues
185276
- )}), assignee, component, a human-readable attached label title (label, exact and case-insensitive), parentIssue (to list children of a specific issue), and isTopLevel (to return only native top-level issues). The label filter is applied before the result limit. Supports searching by title substring (titleSearch) and description content (descriptionSearch). Each result includes deterministic label summaries with title and available color; missing labels are an empty array, duplicate titles collapse case-insensitively while preferring a valid color, and unusable partial attachments are omitted with a tool warning.`,
185561
+ )}), assignee, creator (raw Person ID, exact email, or exact display name), component, a human-readable attached label title (label, exact and case-insensitive), milestone (project-scoped ID or exact case-insensitive label), milestone presence (hasMilestone), parentIssue (to list children of a specific issue), and isTopLevel (to return only native top-level issues). Creator, label, and milestone filters are applied before the result limit; ambiguous creator display names fail actionably and unknown creators return an empty list. Each result includes creator as a stable Person reference { id, name?, email? } when resolvable and the assigned milestone as { id, label } when resolvable. Supports searching by title substring (titleSearch) and description content (descriptionSearch). Each result includes deterministic label summaries with title and available color; missing labels are an empty array, duplicate titles collapse case-insensitively while preferring a valid color, and unusable partial attachments are omitted with a tool warning.`,
185277
185562
  category: CATEGORY23,
185278
185563
  inputSchema: listIssuesParamsJsonSchema,
185279
185564
  resultSchema: ListIssuesResultSchema
@@ -185284,7 +185569,7 @@ var issueTools = [
185284
185569
  defineTool(
185285
185570
  {
185286
185571
  name: "get_issue",
185287
- description: "Retrieve full details for a Huly issue including markdown description and deterministic attached-label summaries with title and available color. Missing labels are an empty array, duplicate titles collapse case-insensitively while preferring a valid color, and unusable partial attachments are omitted with a tool warning. Use this to view issue content, comments, classification, or full metadata.",
185572
+ description: "Retrieve full details for a Huly issue including markdown description, its creator as a stable Person reference { id, name?, email? } when resolvable, its assigned milestone as { id, label } when resolvable, and deterministic attached-label summaries with title and available color. Missing labels are an empty array, duplicate titles collapse case-insensitively while preferring a valid color, and unusable partial creator or label metadata is omitted with one bounded tool warning. Use this to view issue content, comments, classification, or full metadata.",
185288
185573
  category: CATEGORY23,
185289
185574
  inputSchema: getIssueParamsJsonSchema,
185290
185575
  resultSchema: GetIssueResultSchema
@@ -185553,8 +185838,211 @@ var labelTools = [
185553
185838
  )
185554
185839
  ];
185555
185840
 
185556
- // src/huly/operations/leads.ts
185841
+ // src/huly/operations/leads-create.ts
185557
185842
  var import_core64 = __toESM(require_lib5(), 1);
185843
+ var import_rank6 = __toESM(require_lib23(), 1);
185844
+ var LeadSequenceNumber = Schema_exports.Number.pipe(Schema_exports.int(), Schema_exports.positive(), Schema_exports.brand("LeadSequenceNumber"));
185845
+ var SequenceIncrementResultSchema = Schema_exports.Struct({ object: Schema_exports.Struct({ sequence: LeadSequenceNumber }) });
185846
+ var strictFunnelLookup = (client, identifier2) => Effect_exports.gen(function* () {
185847
+ const byId = yield* client.findOne(
185848
+ leadClassIds.class.Funnel,
185849
+ hulyQuery({ _id: toRef(identifier2) })
185850
+ );
185851
+ if (byId !== void 0) return byId;
185852
+ const byExactName = yield* client.findAll(
185853
+ leadClassIds.class.Funnel,
185854
+ hulyQuery({ name: identifier2 })
185855
+ );
185856
+ if (byExactName.length === 0) {
185857
+ return yield* new FunnelNotFoundError({ identifier: identifier2 });
185858
+ }
185859
+ if (byExactName.length > 1) {
185860
+ return yield* new HulyError({
185861
+ message: `Funnel name '${identifier2}' matched ${Count.make(byExactName.length)} funnels; use the stable funnel ID from list_funnels`
185862
+ });
185863
+ }
185864
+ const funnel = byExactName[0];
185865
+ return funnel === void 0 ? yield* new FunnelNotFoundError({ identifier: identifier2 }) : funnel;
185866
+ });
185867
+ var resolveCustomer = (client, locator) => locator.kind === "organization" ? resolveOrganizationByIdentifier(client, locator.identifier) : Effect_exports.gen(function* () {
185868
+ const person = yield* findPersonByIdOrExactEmailOrName(client, locator.identifier);
185869
+ return person === void 0 ? yield* new PersonNotFoundError({ identifier: locator.identifier }) : person;
185870
+ });
185871
+ var taskTypeMatches2 = (candidate, identifier2) => String(candidate._id) === identifier2 || normalizeForComparison(candidate.name) === normalizeForComparison(identifier2);
185872
+ var compatibleTaskTypes = (projectType, taskTypes) => {
185873
+ const configuredIds = new Set(projectType.tasks.map(String));
185874
+ return taskTypes.filter(
185875
+ (candidate) => configuredIds.has(String(candidate._id)) && candidate.ofClass === leadClassIds.class.Lead
185876
+ );
185877
+ };
185878
+ var describeTaskTypes = (taskTypes) => taskTypes.length === 0 ? "No Lead-compatible task types are configured." : `Available Lead types: ${taskTypes.map((candidate) => `${candidate.name} (${candidate._id})`).join(", ")}.`;
185879
+ var failTaskTypeSelection = (selector, reason, compatible, funnel) => Effect_exports.fail(
185880
+ new HulyError({ message: `${selector} ${reason} in funnel '${funnel.name}'. ${describeTaskTypes(compatible)}` })
185881
+ );
185882
+ var chooseRequestedTaskType = (requested, compatible, funnel) => {
185883
+ const matches = compatible.filter((candidate) => taskTypeMatches2(candidate, requested));
185884
+ return matches.length === 1 && matches[0] !== void 0 ? Effect_exports.succeed(matches[0]) : failTaskTypeSelection(
185885
+ `Task type '${requested}'`,
185886
+ matches.length > 1 ? "matched more than one compatible type" : "was not found as a compatible type",
185887
+ compatible,
185888
+ funnel
185889
+ );
185890
+ };
185891
+ var chooseDefaultTaskType = (compatible, funnel) => {
185892
+ const defaultNative = compatible.find((candidate) => candidate._id === leadClassIds.taskType.Lead);
185893
+ const chosen = defaultNative ?? (compatible.length === 1 ? compatible[0] : void 0);
185894
+ return chosen === void 0 ? failTaskTypeSelection(
185895
+ "No deterministic native Lead task type",
185896
+ compatible.length > 1 ? "matched more than one compatible type" : "was not found as a compatible type",
185897
+ compatible,
185898
+ funnel
185899
+ ) : Effect_exports.succeed(chosen);
185900
+ };
185901
+ var chooseTaskType = (projectType, taskTypes, requested, funnel) => {
185902
+ const compatible = compatibleTaskTypes(projectType, taskTypes);
185903
+ return requested === void 0 ? chooseDefaultTaskType(compatible, funnel) : chooseRequestedTaskType(requested, compatible, funnel);
185904
+ };
185905
+ var chooseStatus = (taskType, statusDocs, requested, funnel) => {
185906
+ if (requested === void 0) {
185907
+ const defaultStatus = taskType.statuses[0];
185908
+ return defaultStatus === void 0 ? Effect_exports.fail(
185909
+ new HulyError({
185910
+ message: `Task type '${taskType.name}' in funnel '${funnel.name}' has no deterministic default status`
185911
+ })
185912
+ ) : Effect_exports.succeed(defaultStatus);
185913
+ }
185914
+ const allowedIds = new Set(taskType.statuses.map(String));
185915
+ const matches = statusDocs.filter(
185916
+ (candidate) => allowedIds.has(String(candidate._id)) && normalizeForComparison(candidate.name) === normalizeForComparison(requested)
185917
+ );
185918
+ return matches.length === 1 && matches[0] !== void 0 ? Effect_exports.succeed(matches[0]._id) : Effect_exports.fail(
185919
+ new HulyError({
185920
+ message: matches.length > 1 ? `Status '${requested}' matched more than one status in task type '${taskType.name}'` : `Status '${requested}' is not valid for task type '${taskType.name}' in funnel '${funnel.name}'`
185921
+ })
185922
+ );
185923
+ };
185924
+ var resolveWorkflow = (client, funnel, params3) => Effect_exports.gen(function* () {
185925
+ if (funnel.type === void 0) {
185926
+ return yield* new HulyConnectionError({ message: `Funnel '${funnel._id}' is missing its ProjectType reference` });
185927
+ }
185928
+ const projectType = yield* client.findOne(
185929
+ task.class.ProjectType,
185930
+ hulyQuery({ _id: funnel.type })
185931
+ );
185932
+ if (projectType === void 0) {
185933
+ return yield* new HulyConnectionError({
185934
+ message: `Funnel '${funnel._id}' references missing ProjectType '${funnel.type}'`
185935
+ });
185936
+ }
185937
+ const taskTypes = yield* client.findAll(
185938
+ task.class.TaskType,
185939
+ hulyQuery({ _id: { $in: [...projectType.tasks] } })
185940
+ );
185941
+ const selectedTaskType = yield* chooseTaskType(projectType, taskTypes, params3.taskType, funnel);
185942
+ const statusDocs = yield* findStatusDocs(client, selectedTaskType.statuses);
185943
+ const status2 = yield* chooseStatus(selectedTaskType, statusDocs, params3.status, funnel);
185944
+ return { taskType: selectedTaskType, status: status2 };
185945
+ });
185946
+ var resolveAssignee2 = (client, identifier2) => identifier2 === void 0 ? Effect_exports.succeed(null) : Effect_exports.gen(function* () {
185947
+ const person = yield* findPersonByIdOrExactEmailOrName(client, identifier2);
185948
+ if (person === void 0) {
185949
+ return yield* new PersonNotFoundError({ identifier: identifier2 });
185950
+ }
185951
+ const employee = yield* client.findOne(
185952
+ contact.mixin.Employee,
185953
+ hulyQuery({ _id: toRef(person._id) })
185954
+ );
185955
+ if (employee === void 0) {
185956
+ return yield* new PersonNotAnEmployeeError({ identifier: identifier2 });
185957
+ }
185958
+ return toRef(employee._id);
185959
+ });
185960
+ var applyCustomerMixin = (client, customer) => Object.hasOwn(customer, String(leadClassIds.mixin.Customer)) ? Effect_exports.void : client.createMixin(
185961
+ toRef(customer._id),
185962
+ toClassRef(customer._class),
185963
+ customer.space,
185964
+ toMixinRef(leadClassIds.mixin.Customer),
185965
+ { customerDescription: null }
185966
+ ).pipe(Effect_exports.asVoid);
185967
+ var resolveLeadSequence = (client) => Effect_exports.gen(function* () {
185968
+ const sequence = yield* client.findOne(
185969
+ core.class.Sequence,
185970
+ hulyQuery({ attachedTo: leadClassIds.class.Lead })
185971
+ );
185972
+ if (sequence === void 0) {
185973
+ return yield* new HulyConnectionError({ message: "Huly Lead sequence is missing" });
185974
+ }
185975
+ return sequence;
185976
+ });
185977
+ var incrementLeadSequence = (client, sequence) => Effect_exports.gen(function* () {
185978
+ const update6 = { $inc: { sequence: 1 } };
185979
+ const result = yield* client.updateDoc(core.class.Sequence, sequence.space, sequence._id, update6, true);
185980
+ return yield* Schema_exports.decodeUnknown(SequenceIncrementResultSchema)(result).pipe(
185981
+ Effect_exports.map((decoded) => decoded.object.sequence),
185982
+ Effect_exports.mapError(
185983
+ (cause3) => new HulyConnectionError({ message: "Huly Lead sequence increment did not return a positive integer", cause: cause3 })
185984
+ )
185985
+ );
185986
+ });
185987
+ var markupRefAsBlobRef = (value3) => {
185988
+ return value3;
185989
+ };
185990
+ var createLead = (params3) => Effect_exports.gen(function* () {
185991
+ const client = yield* HulyClient;
185992
+ const funnel = yield* strictFunnelLookup(client, params3.funnel);
185993
+ if (funnel.archived) {
185994
+ return yield* new HulyError({
185995
+ message: `Funnel '${FunnelIdentifier.make(funnel._id)}' is archived and cannot accept new leads`
185996
+ });
185997
+ }
185998
+ const customer = yield* resolveCustomer(client, params3.customer);
185999
+ const workflow = yield* resolveWorkflow(client, funnel, params3);
186000
+ const assignee = yield* resolveAssignee2(client, params3.assignee);
186001
+ const sequence = yield* resolveLeadSequence(client);
186002
+ const renderedDescriptionCandidate = Option_exports.fromNullable(params3.description).pipe(
186003
+ Option_exports.filter((description2) => description2.trim() !== ""),
186004
+ Option_exports.map(
186005
+ (description2) => renderMarkdownWithNativeReferencesForWrite(description2, client.markupUrlConfig, "description")
186006
+ )
186007
+ );
186008
+ const renderedDescription = yield* Option_exports.match(renderedDescriptionCandidate, {
186009
+ onNone: () => Effect_exports.succeed(Option_exports.none()),
186010
+ onSome: (rendered) => rendered._tag === "malformed" ? Effect_exports.fail(new HulyError({ message: rendered.reason })) : Effect_exports.succeed(Option_exports.some(rendered.rendered))
186011
+ });
186012
+ yield* applyCustomerMixin(client, customer);
186013
+ const leadId = (0, import_core64.generateId)();
186014
+ const number9 = yield* incrementLeadSequence(client, sequence);
186015
+ const description = yield* Option_exports.match(renderedDescription, {
186016
+ onNone: () => Effect_exports.succeed(null),
186017
+ onSome: (rendered) => client.uploadMarkup(leadClassIds.class.Lead, leadId, "description", rendered.markup, rendered.format).pipe(Effect_exports.map(markupRefAsBlobRef))
186018
+ });
186019
+ const identifier2 = Schema_exports.decodeUnknownSync(LeadIdentifier)(`LEAD-${number9}`);
186020
+ const data = {
186021
+ title: params3.title,
186022
+ description,
186023
+ identifier: identifier2,
186024
+ number: number9,
186025
+ status: workflow.status,
186026
+ kind: workflow.taskType._id,
186027
+ rank: (0, import_rank6.makeRank)(void 0, void 0),
186028
+ assignee,
186029
+ startDate: null,
186030
+ dueDate: null
186031
+ };
186032
+ yield* client.addCollection(
186033
+ toClassRef(leadClassIds.class.Lead),
186034
+ toRef(funnel._id),
186035
+ toRef(customer._id),
186036
+ leadClassIds.mixin.Customer,
186037
+ "leads",
186038
+ data,
186039
+ leadId
186040
+ );
186041
+ return { leadId: DocId.make(leadId), identifier: identifier2 };
186042
+ });
186043
+
186044
+ // src/huly/operations/leads.ts
186045
+ var import_core65 = __toESM(require_lib5(), 1);
185558
186046
  var funnelAsSpace = (funnel) => toRef(funnel._id);
185559
186047
  var statusInfosWithFallbacks = (statusRefs, statusDocs) => resolveByStatusRef(
185560
186048
  statusRefs,
@@ -185645,7 +186133,7 @@ var listFunnels = (params3) => Effect_exports.gen(function* () {
185645
186133
  const limit = clampLimit(params3.limit);
185646
186134
  const funnels = yield* client.findAll(leadClassIds.class.Funnel, query, {
185647
186135
  limit,
185648
- sort: { name: import_core64.SortingOrder.Ascending }
186136
+ sort: { name: import_core65.SortingOrder.Ascending }
185649
186137
  });
185650
186138
  const summaries = funnels.map((funnel) => ({
185651
186139
  identifier: FunnelIdentifier.make(funnel._id),
@@ -185672,7 +186160,7 @@ var listLeads = (params3) => Effect_exports.gen(function* () {
185672
186160
  const limit = clampLimit(params3.limit);
185673
186161
  const leads = yield* client.findAll(leadClassIds.class.Lead, query, {
185674
186162
  limit,
185675
- sort: { modifiedOn: import_core64.SortingOrder.Descending },
186163
+ sort: { modifiedOn: import_core65.SortingOrder.Descending },
185676
186164
  // Upstream lead views resolve attachedTo through the Customer mixin.
185677
186165
  // Reference:
185678
186166
  // https://github.com/hcengineering/platform/blob/b9657d53d130a2ed8034c1b71ab0cf8b7a0b4994/models/lead/src/index.ts#L357-L360
@@ -185782,11 +186270,22 @@ var leadTools = [
185782
186270
  },
185783
186271
  parseGetLeadParams,
185784
186272
  getLead
186273
+ ),
186274
+ defineTool(
186275
+ {
186276
+ name: "create_lead",
186277
+ description: "Create one native Huly lead in an active funnel for an existing person or organization. Resolve the funnel by ID or exact name; identify the customer explicitly as person or organization; optionally choose an employee assignee, Lead-compatible task type, exact workflow status, and Markdown description. Automatically applies the Customer mixin when needed, preserves native Huly references, and returns both leadId and LEAD-<number>. This tool never creates a person or organization inline.",
186278
+ category: CATEGORY25,
186279
+ inputSchema: createLeadParamsJsonSchema,
186280
+ resultSchema: CreateLeadResultSchema
186281
+ },
186282
+ parseCreateLeadParams,
186283
+ createLead
185785
186284
  )
185786
186285
  ];
185787
186286
 
185788
186287
  // src/huly/operations/message-templates.ts
185789
- var import_core65 = __toESM(require_lib5(), 1);
186288
+ var import_core66 = __toESM(require_lib5(), 1);
185790
186289
  var import_templates2 = __toESM(require_lib29(), 1);
185791
186290
 
185792
186291
  // src/huly/operations/message-templates-support.ts
@@ -186021,7 +186520,7 @@ var listMessageTemplateCategories = (params3) => Effect_exports.gen(function* ()
186021
186520
  const categories = yield* client.findAll(
186022
186521
  templates.class.TemplateCategory,
186023
186522
  hulyQuery({}),
186024
- { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core65.SortingOrder.Descending } }
186523
+ { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core66.SortingOrder.Descending } }
186025
186524
  );
186026
186525
  yield* warnMetadataFallbacks(
186027
186526
  diagnostics,
@@ -186041,7 +186540,7 @@ var listMessageTemplates = (params3) => Effect_exports.gen(function* () {
186041
186540
  const query = { ...categoryFilter, ...titleFilter };
186042
186541
  const found = yield* client.findAll(templates.class.MessageTemplate, hulyQuery(query), {
186043
186542
  limit: clampLimit(params3.limit),
186044
- sort: { modifiedOn: import_core65.SortingOrder.Descending }
186543
+ sort: { modifiedOn: import_core66.SortingOrder.Descending }
186045
186544
  });
186046
186545
  const categories = yield* categoryMapFor(
186047
186546
  client,
@@ -186092,7 +186591,7 @@ var listMessageTemplateFields = (params3) => Effect_exports.gen(function* () {
186092
186591
  const query = { ...categoryFilter, ...labelFilter };
186093
186592
  const fields = yield* client.findAll(templates.class.TemplateField, hulyQuery(query), {
186094
186593
  limit: clampLimit(params3.limit),
186095
- sort: { modifiedOn: import_core65.SortingOrder.Descending }
186594
+ sort: { modifiedOn: import_core66.SortingOrder.Descending }
186096
186595
  });
186097
186596
  const categories = yield* fieldCategoryMapFor(
186098
186597
  client,
@@ -186169,7 +186668,7 @@ var messageTemplateTools = [
186169
186668
  ];
186170
186669
 
186171
186670
  // src/huly/operations/milestones.ts
186172
- var import_core66 = __toESM(require_lib5(), 1);
186671
+ var import_core67 = __toESM(require_lib5(), 1);
186173
186672
  var import_tracker6 = __toESM(require_lib24(), 1);
186174
186673
  var milestoneStatusToStringMap = {
186175
186674
  [import_tracker6.MilestoneStatus.Planned]: "planned",
@@ -186185,21 +186684,9 @@ var stringToMilestoneStatusMap = {
186185
186684
  canceled: import_tracker6.MilestoneStatus.Canceled
186186
186685
  };
186187
186686
  var stringToMilestoneStatus = (status2) => stringToMilestoneStatusMap[status2];
186188
- var findMilestone = (client, project3, milestoneIdentifier, projectIdentifier) => Effect_exports.gen(function* () {
186189
- const milestone = yield* findByNameOrId(
186190
- client,
186191
- tracker.class.Milestone,
186192
- { space: project3._id, _id: toRef(milestoneIdentifier) },
186193
- { space: project3._id, label: milestoneIdentifier }
186194
- );
186195
- if (milestone === void 0) {
186196
- return yield* new MilestoneNotFoundError({ identifier: milestoneIdentifier, project: projectIdentifier });
186197
- }
186198
- return milestone;
186199
- });
186200
186687
  var findProjectAndMilestone = (params3) => Effect_exports.gen(function* () {
186201
186688
  const { client, project: project3 } = yield* findProject(params3.project);
186202
- const milestone = yield* findMilestone(client, project3, params3.milestone, params3.project);
186689
+ const milestone = yield* resolveMilestoneExact(client, project3, params3.milestone, params3.project);
186203
186690
  return { client, project: project3, milestone };
186204
186691
  });
186205
186692
  var listMilestones = (params3) => Effect_exports.gen(function* () {
@@ -186208,7 +186695,7 @@ var listMilestones = (params3) => Effect_exports.gen(function* () {
186208
186695
  const milestones = yield* client.findAll(
186209
186696
  tracker.class.Milestone,
186210
186697
  { space: project3._id },
186211
- { limit, sort: { modifiedOn: import_core66.SortingOrder.Descending } }
186698
+ { limit, sort: { modifiedOn: import_core67.SortingOrder.Descending } }
186212
186699
  );
186213
186700
  const summaries = milestones.map((m) => ({
186214
186701
  id: MilestoneId.make(m._id),
@@ -186237,7 +186724,7 @@ var getMilestone = (params3) => Effect_exports.gen(function* () {
186237
186724
  var createMilestone = (params3) => Effect_exports.gen(function* () {
186238
186725
  const { client, project: project3 } = yield* findProject(params3.project);
186239
186726
  const markupUrlConfig = client.markupUrlConfig;
186240
- const milestoneId = (0, import_core66.generateId)();
186727
+ const milestoneId = (0, import_core67.generateId)();
186241
186728
  const milestoneData = {
186242
186729
  label: params3.label,
186243
186730
  description: optionalMarkdownToMarkup(params3.description, markupUrlConfig, ""),
@@ -186284,7 +186771,7 @@ var updateMilestone = (params3) => Effect_exports.gen(function* () {
186284
186771
  });
186285
186772
  var setIssueMilestone = (params3) => Effect_exports.gen(function* () {
186286
186773
  const { client, issue: issue2, project: project3 } = yield* findProjectAndIssue(params3);
186287
- const milestoneRef = params3.milestone !== null ? (yield* findMilestone(client, project3, params3.milestone, params3.project))._id : null;
186774
+ const milestoneRef = params3.milestone !== null ? (yield* resolveMilestoneExact(client, project3, params3.milestone, params3.project))._id : null;
186288
186775
  yield* client.updateDoc(tracker.class.Issue, project3._id, issue2._id, { milestone: milestoneRef });
186289
186776
  return { identifier: IssueIdentifier.make(issue2.identifier), milestoneSet: true };
186290
186777
  });
@@ -186366,10 +186853,10 @@ var milestoneTools = [
186366
186853
  ];
186367
186854
 
186368
186855
  // src/huly/operations/notification-preferences.ts
186369
- var import_core68 = __toESM(require_lib5(), 1);
186856
+ var import_core69 = __toESM(require_lib5(), 1);
186370
186857
 
186371
186858
  // src/huly/operations/notification-metadata.ts
186372
- var import_core67 = __toESM(require_lib5(), 1);
186859
+ var import_core68 = __toESM(require_lib5(), 1);
186373
186860
 
186374
186861
  // src/huly/operations/notification-metadata-execution.ts
186375
186862
  var modelMetadataFailure = (result, rows) => {
@@ -186559,7 +187046,7 @@ function loadMetadata(client, config3) {
186559
187046
  var loadNotificationProviders = (client, limit) => loadMetadata(client, {
186560
187047
  ...providerMetadataDefinition,
186561
187048
  query: {},
186562
- options: { limit, sort: { order: import_core67.SortingOrder.Ascending } }
187049
+ options: { limit, sort: { order: import_core68.SortingOrder.Ascending } }
186563
187050
  }).pipe(
186564
187051
  Effect_exports.flatMap(
186565
187052
  (result) => Effect_exports.gen(function* () {
@@ -186816,7 +187303,7 @@ var subscribeToObjectNotifications = (params3) => Effect_exports.gen(function* (
186816
187303
  target.objectClass,
186817
187304
  "collaborators",
186818
187305
  { collaborator: accountUuid },
186819
- (0, import_core68.generateId)()
187306
+ (0, import_core69.generateId)()
186820
187307
  );
186821
187308
  return {
186822
187309
  objectId: DocId.make(target.objectId),
@@ -186865,7 +187352,7 @@ var unsubscribeFromObjectNotifications = (params3) => Effect_exports.gen(functio
186865
187352
  });
186866
187353
 
186867
187354
  // src/huly/operations/notifications.ts
186868
- var import_core69 = __toESM(require_lib5(), 1);
187355
+ var import_core70 = __toESM(require_lib5(), 1);
186869
187356
 
186870
187357
  // src/huly/operations/notifications-state.ts
186871
187358
  var BULK_NOTIFICATION_LIMIT = 200;
@@ -186963,7 +187450,7 @@ var listNotifications = (params3) => Effect_exports.gen(function* () {
186963
187450
  const notifications = yield* client.findAll(
186964
187451
  notification.class.InboxNotification,
186965
187452
  hulyQuery(query),
186966
- { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core69.SortingOrder.Descending } }
187453
+ { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core70.SortingOrder.Descending } }
186967
187454
  );
186968
187455
  return notifications.map((n) => ({
186969
187456
  id: NotificationId.make(n._id),
@@ -187013,7 +187500,7 @@ var listNotificationContexts = (params3) => Effect_exports.gen(function* () {
187013
187500
  const contexts = yield* client.findAll(
187014
187501
  notification.class.DocNotifyContext,
187015
187502
  hulyQuery(query),
187016
- { limit: clampLimit(params3.limit), sort: { lastUpdateTimestamp: import_core69.SortingOrder.Descending } }
187503
+ { limit: clampLimit(params3.limit), sort: { lastUpdateTimestamp: import_core70.SortingOrder.Descending } }
187017
187504
  );
187018
187505
  return contexts.map(toDocNotifyContextSummary);
187019
187506
  });
@@ -187316,12 +187803,12 @@ var notificationTools = [
187316
187803
  ];
187317
187804
 
187318
187805
  // src/huly/operations/planner.ts
187319
- var import_core71 = __toESM(require_lib5(), 1);
187806
+ var import_core72 = __toESM(require_lib5(), 1);
187320
187807
  var import_time6 = __toESM(require_lib27(), 1);
187321
187808
 
187322
187809
  // src/huly/operations/planner-scheduling.ts
187323
187810
  var import_calendar14 = __toESM(require_lib26(), 1);
187324
- var import_core70 = __toESM(require_lib5(), 1);
187811
+ var import_core71 = __toESM(require_lib5(), 1);
187325
187812
 
187326
187813
  // src/huly/operations/primary-social-identity.ts
187327
187814
  var PrimarySocialIdentityProjectionSchema = Schema_exports.Struct({ _id: PersonId, attachedTo: PersonId });
@@ -187406,7 +187893,7 @@ var parseWorkSlotData = (value3) => Schema_exports.decodeUnknown(PlannerWorkSlot
187406
187893
  var createPlannerWorkSlot = (params3) => Effect_exports.gen(function* () {
187407
187894
  const client = yield* HulyClient;
187408
187895
  const context9 = yield* resolvePlannerSchedulingContext(client);
187409
- const slotId = (0, import_core70.generateId)();
187896
+ const slotId = (0, import_core71.generateId)();
187410
187897
  const parsedSlotData = yield* parseWorkSlotData({
187411
187898
  eventId: (0, import_calendar14.generateEventId)(),
187412
187899
  date: params3.date,
@@ -187511,7 +187998,7 @@ var listTodos = (params3) => Effect_exports.gen(function* () {
187511
187998
  time3.class.ToDo,
187512
187999
  hulyQuery(query),
187513
188000
  withLookup(
187514
- { limit: clampLimit(params3.limit), sort: { rank: import_core71.SortingOrder.Ascending } },
188001
+ { limit: clampLimit(params3.limit), sort: { rank: import_core72.SortingOrder.Ascending } },
187515
188002
  todoLookup
187516
188003
  )
187517
188004
  );
@@ -187531,12 +188018,12 @@ var createTodo = (params3) => Effect_exports.gen(function* () {
187531
188018
  const attachment2 = yield* resolveTodoAttachment(client, params3.attachedTo);
187532
188019
  const rank = yield* latestOpenTodoRank(client, owner);
187533
188020
  if (attachment2.type === "issue" && attachment2.issue !== void 0) {
187534
- const todoId2 = (0, import_core71.generateId)();
188021
+ const todoId2 = (0, import_core72.generateId)();
187535
188022
  const description2 = yield* uploadTodoDescription(client, time3.class.ProjectToDo, todoId2, params3.description);
187536
188023
  yield* createIssueTodo(client, params3, owner, attachment2.issue, todoId2, description2, rank);
187537
188024
  return { todoId: TodoId.make(todoId2) };
187538
188025
  }
187539
- const todoId = (0, import_core71.generateId)();
188026
+ const todoId = (0, import_core72.generateId)();
187540
188027
  const description = yield* uploadTodoDescription(client, time3.class.ToDo, todoId, params3.description);
187541
188028
  yield* createPersonalTodo(client, params3, owner, todoId, description, rank);
187542
188029
  return { todoId: TodoId.make(todoId) };
@@ -187769,7 +188256,7 @@ var plannerTools = [
187769
188256
  ];
187770
188257
 
187771
188258
  // src/huly/operations/preferences.ts
187772
- var import_core72 = __toESM(require_lib5(), 1);
188259
+ var import_core73 = __toESM(require_lib5(), 1);
187773
188260
 
187774
188261
  // src/huly/operations/spaces-projections.ts
187775
188262
  var toPermissionSummary = (permission) => ({
@@ -187885,7 +188372,7 @@ var listSpacePreferences = (params3) => Effect_exports.gen(function* () {
187885
188372
  const preferences = yield* client.findAll(
187886
188373
  preference.class.SpacePreference,
187887
188374
  hulyQuery(listQuery2(targetSpace2)),
187888
- { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core72.SortingOrder.Descending }, total: true }
188375
+ { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core73.SortingOrder.Descending }, total: true }
187889
188376
  );
187890
188377
  const spacesById = yield* spaceMapById(
187891
188378
  client,
@@ -187938,7 +188425,7 @@ var preferenceTools = [
187938
188425
  ];
187939
188426
 
187940
188427
  // src/huly/operations/processes.ts
187941
- var import_core73 = __toESM(require_lib5(), 1);
188428
+ var import_core74 = __toESM(require_lib5(), 1);
187942
188429
 
187943
188430
  // src/huly/process-plugin.ts
187944
188431
  var import_platform2 = __toESM(require_lib(), 1);
@@ -188044,7 +188531,7 @@ var resolveProcess = (client, identifier2) => Effect_exports.gen(function* () {
188044
188531
  const allProcesses = yield* client.findAll(
188045
188532
  processPlugin.class.Process,
188046
188533
  {},
188047
- { sort: { name: import_core73.SortingOrder.Ascending } }
188534
+ { sort: { name: import_core74.SortingOrder.Ascending } }
188048
188535
  );
188049
188536
  const matches = [...allProcesses].filter(
188050
188537
  (process4) => normalizeForComparison(process4.name) === normalizeForComparison(identifier2)
@@ -188129,7 +188616,7 @@ var listProcesses = (params3) => Effect_exports.gen(function* () {
188129
188616
  const query = masterTag === void 0 ? {} : { masterTag };
188130
188617
  const processes = yield* client.findAll(processPlugin.class.Process, query, {
188131
188618
  limit: clampLimit(params3.limit),
188132
- sort: { name: import_core73.SortingOrder.Ascending }
188619
+ sort: { name: import_core74.SortingOrder.Ascending }
188133
188620
  });
188134
188621
  const data = yield* loadProcessDefinitionData(client, [...processes]);
188135
188622
  const result = { processes: data.map(processSummary), total: listTotal(data.length) };
@@ -188143,12 +188630,12 @@ var getProcess = (params3) => Effect_exports.gen(function* () {
188143
188630
  client.findAll(
188144
188631
  processPlugin.class.State,
188145
188632
  { process: process4._id },
188146
- { sort: { rank: import_core73.SortingOrder.Ascending } }
188633
+ { sort: { rank: import_core74.SortingOrder.Ascending } }
188147
188634
  ),
188148
188635
  client.findAll(
188149
188636
  processPlugin.class.Transition,
188150
188637
  { process: process4._id },
188151
- { sort: { rank: import_core73.SortingOrder.Ascending } }
188638
+ { sort: { rank: import_core74.SortingOrder.Ascending } }
188152
188639
  )
188153
188640
  ]);
188154
188641
  const result = processDetail({
@@ -188172,7 +188659,7 @@ var listExecutions = (params3) => Effect_exports.gen(function* () {
188172
188659
  };
188173
188660
  const executions = yield* client.findAll(processPlugin.class.Execution, query, {
188174
188661
  limit: clampLimit(params3.limit),
188175
- sort: { modifiedOn: import_core73.SortingOrder.Descending }
188662
+ sort: { modifiedOn: import_core74.SortingOrder.Descending }
188176
188663
  });
188177
188664
  const processIds = executions.map((execution) => execution.process);
188178
188665
  const processLookup = processIds.length === 0 ? Effect_exports.succeed(/* @__PURE__ */ new Map()) : client.findAll(processPlugin.class.Process, {
@@ -188206,7 +188693,7 @@ var startProcess = (params3) => Effect_exports.gen(function* () {
188206
188693
  const transitions = yield* client.findAll(
188207
188694
  processPlugin.class.Transition,
188208
188695
  { process: process4._id },
188209
- { sort: { rank: import_core73.SortingOrder.Ascending } }
188696
+ { sort: { rank: import_core74.SortingOrder.Ascending } }
188210
188697
  );
188211
188698
  const transition = initialTransition(transitions);
188212
188699
  if (transition === void 0) {
@@ -188236,7 +188723,7 @@ var startProcess = (params3) => Effect_exports.gen(function* () {
188236
188723
  );
188237
188724
  }
188238
188725
  }
188239
- const executionId = (0, import_core73.generateId)();
188726
+ const executionId = (0, import_core74.generateId)();
188240
188727
  const executionData = {
188241
188728
  process: process4._id,
188242
188729
  card: card._id,
@@ -188343,7 +188830,7 @@ var processTools = [
188343
188830
  ];
188344
188831
 
188345
188832
  // src/huly/operations/project-target-preferences.ts
188346
- var import_core74 = __toESM(require_lib5(), 1);
188833
+ var import_core75 = __toESM(require_lib5(), 1);
188347
188834
  var projectMapById = (client, ids3) => Effect_exports.gen(function* () {
188348
188835
  const uniqueIds = [...new Set(ids3)];
188349
188836
  if (uniqueIds.length === 0) return /* @__PURE__ */ new Map();
@@ -188379,7 +188866,7 @@ var listProjectTargetPreferences = (params3) => Effect_exports.gen(function* ()
188379
188866
  const preferences = yield* client.findAll(
188380
188867
  tracker.class.ProjectTargetPreference,
188381
188868
  hulyQuery(project3 === void 0 ? {} : { attachedTo: project3._id }),
188382
- { limit: clampLimit(params3.limit), sort: { usedOn: import_core74.SortingOrder.Descending }, total: true }
188869
+ { limit: clampLimit(params3.limit), sort: { usedOn: import_core75.SortingOrder.Descending }, total: true }
188383
188870
  );
188384
188871
  const projects = yield* projectMapById(
188385
188872
  client,
@@ -188398,7 +188885,7 @@ var upsertProjectTargetPreference = (params3) => Effect_exports.gen(function* ()
188398
188885
  hulyQuery({ attachedTo: project3._id })
188399
188886
  );
188400
188887
  if (existing === void 0) {
188401
- const preferenceId = (0, import_core74.generateId)();
188888
+ const preferenceId = (0, import_core75.generateId)();
188402
188889
  const data = {
188403
188890
  attachedTo: project3._id,
188404
188891
  usedOn,
@@ -188443,7 +188930,7 @@ var projectTargetPreferenceTools = [
188443
188930
  ];
188444
188931
 
188445
188932
  // src/huly/operations/projects.ts
188446
- var import_core75 = __toESM(require_lib5(), 1);
188933
+ var import_core76 = __toESM(require_lib5(), 1);
188447
188934
  var import_tracker7 = __toESM(require_lib24(), 1);
188448
188935
  var listProjects = (params3) => Effect_exports.gen(function* () {
188449
188936
  const client = yield* HulyClient;
@@ -188454,7 +188941,7 @@ var listProjects = (params3) => Effect_exports.gen(function* () {
188454
188941
  const limit = clampLimit(params3.limit);
188455
188942
  const projects = yield* client.findAll(tracker.class.Project, query, {
188456
188943
  limit,
188457
- sort: { name: import_core75.SortingOrder.Ascending }
188944
+ sort: { name: import_core76.SortingOrder.Ascending }
188458
188945
  });
188459
188946
  const total = projects.total;
188460
188947
  const validated = yield* Schema_exports.decodeUnknown(Schema_exports.Array(ProjectSummarySchema))(
@@ -188508,7 +188995,7 @@ var createProject = (params3) => Effect_exports.gen(function* () {
188508
188995
  if (existing !== void 0) {
188509
188996
  return { identifier: ProjectIdentifier.make(existing.identifier), name: existing.name, created: false };
188510
188997
  }
188511
- const projectId = (0, import_core75.generateId)();
188998
+ const projectId = (0, import_core76.generateId)();
188512
188999
  const projectData = {
188513
189000
  name: params3.name,
188514
189001
  description: params3.description ?? "",
@@ -188619,8 +189106,8 @@ var projectTools = [
188619
189106
  ];
188620
189107
 
188621
189108
  // src/huly/operations/recruiting-applicants.ts
188622
- var import_core77 = __toESM(require_lib5(), 1);
188623
- var import_rank6 = __toESM(require_lib23(), 1);
189109
+ var import_core78 = __toESM(require_lib5(), 1);
189110
+ var import_rank7 = __toESM(require_lib23(), 1);
188624
189111
 
188625
189112
  // src/huly/recruit-plugin.ts
188626
189113
  var recruitClassRef = (identifier2) => identifier2;
@@ -188708,7 +189195,7 @@ var candidateSearchFilter = (query) => {
188708
189195
  };
188709
189196
 
188710
189197
  // src/huly/operations/recruiting-shared.ts
188711
- var import_core76 = __toESM(require_lib5(), 1);
189198
+ var import_core77 = __toESM(require_lib5(), 1);
188712
189199
  var prefixedNumber = (identifier2, prefix) => {
188713
189200
  const match19 = new RegExp(`^${prefix}-(\\d+)$`, "i").exec(identifier2);
188714
189201
  return match19 === null ? void 0 : Number(match19[1]);
@@ -188888,7 +189375,7 @@ var incrementSequence = (client, attachedTo, label) => Effect_exports.gen(functi
188888
189375
  }
188889
189376
  return number9;
188890
189377
  });
188891
- var markupRefAsBlobRef = (ref) => {
189378
+ var markupRefAsBlobRef2 = (ref) => {
188892
189379
  return ref;
188893
189380
  };
188894
189381
  var markupBlobRefAsMarkupRef2 = (ref) => {
@@ -188899,12 +189386,12 @@ var vacancyNameSearchFilter = (query) => {
188899
189386
  const search = query?.trim() ?? "";
188900
189387
  return search === "" ? {} : { name: { $like: `%${escapeLikeWildcards(search)}%` } };
188901
189388
  };
188902
- var sortByModifiedDescending = { sort: { modifiedOn: import_core76.SortingOrder.Descending } };
189389
+ var sortByModifiedDescending = { sort: { modifiedOn: import_core77.SortingOrder.Descending } };
188903
189390
 
188904
189391
  // src/huly/operations/recruiting-applicants.ts
188905
189392
  var resolveOptionalVacancy = (client, identifier2) => identifier2 === void 0 ? Effect_exports.succeed(void 0) : resolveVacancy(client, identifier2);
188906
189393
  var resolveOptionalCandidate = (client, identifier2) => identifier2 === void 0 ? Effect_exports.succeed(void 0) : resolveCandidatePerson(client, identifier2);
188907
- var resolveAssignee2 = (client, assignee) => Effect_exports.gen(function* () {
189394
+ var resolveAssignee3 = (client, assignee) => Effect_exports.gen(function* () {
188908
189395
  const byId = yield* client.findOne(
188909
189396
  contact.mixin.Employee,
188910
189397
  hulyQuery({ _id: toRef(assignee) })
@@ -188959,7 +189446,7 @@ var listRecruitingApplicants = (params3) => Effect_exports.gen(function* () {
188959
189446
  };
188960
189447
  const applicants = yield* client.findAll(recruitIds.class.Applicant, hulyQuery(query), {
188961
189448
  ...requiresInMemoryStatusFilter ? {} : { limit },
188962
- sort: { modifiedOn: import_core77.SortingOrder.Descending }
189449
+ sort: { modifiedOn: import_core78.SortingOrder.Descending }
188963
189450
  });
188964
189451
  const refs = yield* Effect_exports.forEach(
188965
189452
  applicants,
@@ -188989,21 +189476,21 @@ var createRecruitingApplicant = (params3) => Effect_exports.gen(function* () {
188989
189476
  const statuses = yield* getVacancyStatuses(client, vacancy);
188990
189477
  const status2 = params3.status === void 0 ? yield* resolveDefaultRecruitingStatus(statuses, toVacancyRef(vacancy).identifier) : yield* resolveRecruitingStatusByName(statuses, params3.status, toVacancyRef(vacancy).identifier);
188991
189478
  const statusName = yield* statusNameForApplicant(statuses, status2);
188992
- const assignee = params3.assignee === void 0 ? null : yield* resolveAssignee2(client, params3.assignee);
189479
+ const assignee = params3.assignee === void 0 ? null : yield* resolveAssignee3(client, params3.assignee);
188993
189480
  const number9 = yield* incrementSequence(client, recruitIds.class.Applicant, "applicant");
188994
189481
  const identifier2 = applicantIdentifierFromNumber(number9);
188995
- const applicantId = (0, import_core77.generateId)();
189482
+ const applicantId = (0, import_core78.generateId)();
188996
189483
  const { candidate } = yield* ensureCandidateMixin(client, person, {});
188997
189484
  const lastApplicant = yield* client.findOne(
188998
189485
  recruitIds.class.Applicant,
188999
189486
  hulyQuery({ space: vacancy._id }),
189000
- { sort: { rank: import_core77.SortingOrder.Descending } }
189487
+ { sort: { rank: import_core78.SortingOrder.Descending } }
189001
189488
  );
189002
189489
  const data = {
189003
189490
  status: status2,
189004
189491
  number: number9,
189005
189492
  identifier: identifier2,
189006
- rank: (0, import_rank6.makeRank)(lastApplicant?.rank, void 0),
189493
+ rank: (0, import_rank7.makeRank)(lastApplicant?.rank, void 0),
189007
189494
  assignee,
189008
189495
  startDate: params3.startDate ?? null,
189009
189496
  dueDate: params3.dueDate ?? null,
@@ -189044,7 +189531,7 @@ var buildApplicantUpdate = (client, applicant, params3) => Effect_exports.gen(fu
189044
189531
  toVacancyRef(vacancy).identifier
189045
189532
  )
189046
189533
  };
189047
- const assignee = params3.assignee === void 0 ? {} : { assignee: params3.assignee === null ? null : yield* resolveAssignee2(client, params3.assignee) };
189534
+ const assignee = params3.assignee === void 0 ? {} : { assignee: params3.assignee === null ? null : yield* resolveAssignee3(client, params3.assignee) };
189048
189535
  return {
189049
189536
  ...status2,
189050
189537
  ...assignee,
@@ -189081,7 +189568,7 @@ var deleteRecruitingApplicant = (params3) => Effect_exports.gen(function* () {
189081
189568
  });
189082
189569
 
189083
189570
  // src/huly/operations/recruiting-candidates.ts
189084
- var import_core78 = __toESM(require_lib5(), 1);
189571
+ var import_core79 = __toESM(require_lib5(), 1);
189085
189572
  var candidateMatchesQuery = (candidate, query) => {
189086
189573
  const normalized = normalizeForComparison(query?.trim() ?? "");
189087
189574
  if (normalized === "") return true;
@@ -189132,7 +189619,7 @@ var listRecruitingCandidates = (params3) => Effect_exports.gen(function* () {
189132
189619
  const candidates = yield* client.findAll(
189133
189620
  recruitIds.mixin.Candidate,
189134
189621
  hulyQuery(candidateSearchFilter(params3.query)),
189135
- { limit: listLimit(params3.limit), sort: { modifiedOn: import_core78.SortingOrder.Descending } }
189622
+ { limit: listLimit(params3.limit), sort: { modifiedOn: import_core79.SortingOrder.Descending } }
189136
189623
  );
189137
189624
  const filtered = candidates.filter((candidate) => candidateMatchesQuery(candidate, params3.query));
189138
189625
  const emailMap = yield* Effect_exports.map(
@@ -189173,7 +189660,7 @@ var listRecruitingSkills = (params3) => Effect_exports.gen(function* () {
189173
189660
  ...categoryFilter,
189174
189661
  ...titleFilter
189175
189662
  }),
189176
- { limit: listLimit(params3.limit), sort: { title: import_core78.SortingOrder.Ascending } }
189663
+ { limit: listLimit(params3.limit), sort: { title: import_core79.SortingOrder.Ascending } }
189177
189664
  );
189178
189665
  return { skills: skillTags.map(toSkillSummary), total: Count.make(skillTags.length) };
189179
189666
  });
@@ -189220,7 +189707,7 @@ var removeRecruitingCandidateSkill = (params3) => Effect_exports.gen(function* (
189220
189707
  });
189221
189708
 
189222
189709
  // src/huly/operations/recruiting-vacancies.ts
189223
- var import_core79 = __toESM(require_lib5(), 1);
189710
+ var import_core80 = __toESM(require_lib5(), 1);
189224
189711
  var companySummary = (client, company) => company === void 0 ? Effect_exports.succeed(void 0) : Effect_exports.map(
189225
189712
  client.findOne(contact.class.Organization, { _id: company }),
189226
189713
  (org) => org === void 0 ? void 0 : { id: DocId.make(org._id), name: org.name }
@@ -189234,7 +189721,7 @@ var uploadFullDescription = (client, vacancyId, fullDescription) => fullDescript
189234
189721
  rendered.markup,
189235
189722
  rendered.format
189236
189723
  );
189237
- return markupRefAsBlobRef(ref);
189724
+ return markupRefAsBlobRef2(ref);
189238
189725
  });
189239
189726
  var fetchFullDescription = (client, vacancy) => vacancy.fullDescription === null ? Effect_exports.succeed(void 0) : client.fetchMarkup(
189240
189727
  recruitIds.class.Vacancy,
@@ -189273,7 +189760,7 @@ var listRecruitingVacancyTypes = (params3) => Effect_exports.gen(function* () {
189273
189760
  const types = yield* client.findAll(
189274
189761
  task.class.ProjectType,
189275
189762
  hulyQuery({ descriptor: toRef(recruitIds.descriptors.VacancyType) }),
189276
- { limit: listLimit(params3.limit), sort: { name: import_core79.SortingOrder.Ascending } }
189763
+ { limit: listLimit(params3.limit), sort: { name: import_core80.SortingOrder.Ascending } }
189277
189764
  );
189278
189765
  const summaries = types.map(toVacancyTypeSummary);
189279
189766
  return { types: summaries, total: Count.make(summaries.length) };
@@ -189308,7 +189795,7 @@ var createRecruitingVacancy = (params3) => Effect_exports.gen(function* () {
189308
189795
  const client = yield* HulyClient;
189309
189796
  const type = yield* resolveVacancyType(client, params3.type);
189310
189797
  const company = params3.company === void 0 ? void 0 : (yield* resolveOrganizationByIdentifier(client, params3.company))._id;
189311
- const vacancyId = (0, import_core79.generateId)();
189798
+ const vacancyId = (0, import_core80.generateId)();
189312
189799
  const number9 = yield* incrementSequence(client, recruitIds.class.Vacancy, "vacancy");
189313
189800
  const fullDescription = yield* uploadFullDescription(client, vacancyId, params3.fullDescription);
189314
189801
  const accountUuid = client.getAccountUuid();
@@ -189380,7 +189867,7 @@ var archiveRecruitingVacancy = (params3) => setVacancyArchiveState(params3.vacan
189380
189867
  var unarchiveRecruitingVacancy = (params3) => setVacancyArchiveState(params3.vacancy, false);
189381
189868
 
189382
189869
  // src/huly/operations/recruiting-matches.ts
189383
- var import_core80 = __toESM(require_lib5(), 1);
189870
+ var import_core81 = __toESM(require_lib5(), 1);
189384
189871
  var matchesText2 = (match19, query) => {
189385
189872
  const normalized = normalizeForComparison(query ?? "");
189386
189873
  if (normalized === "") return true;
@@ -189423,7 +189910,7 @@ var listRecruitingApplicantMatches = (params3) => Effect_exports.gen(function* (
189423
189910
  ...params3.complete === void 0 ? {} : { complete: params3.complete }
189424
189911
  };
189425
189912
  const matches = yield* client.findAll(recruitIds.class.ApplicantMatch, hulyQuery(query), {
189426
- sort: { modifiedOn: import_core80.SortingOrder.Descending }
189913
+ sort: { modifiedOn: import_core81.SortingOrder.Descending }
189427
189914
  });
189428
189915
  const limited = matches.filter((match19) => matchesText2(match19, params3.query)).slice(0, listLimit(params3.limit));
189429
189916
  const refs = yield* Effect_exports.forEach(limited, (match19) => toMatchRef(client, match19));
@@ -189442,11 +189929,11 @@ var getRecruitingApplicantMatch = (params3) => Effect_exports.gen(function* () {
189442
189929
  });
189443
189930
 
189444
189931
  // src/huly/operations/recruiting-opinions.ts
189445
- var import_core82 = __toESM(require_lib5(), 1);
189932
+ var import_core83 = __toESM(require_lib5(), 1);
189446
189933
 
189447
189934
  // src/huly/operations/recruiting-reviews.ts
189448
189935
  var import_calendar15 = __toESM(require_lib26(), 1);
189449
- var import_core81 = __toESM(require_lib5(), 1);
189936
+ var import_core82 = __toESM(require_lib5(), 1);
189450
189937
  var REVIEW_DEFAULT_DURATION_MINUTES = 30;
189451
189938
  var MILLISECONDS_PER_SECOND = 1e3;
189452
189939
  var SECONDS_PER_MINUTE2 = 60;
@@ -189564,7 +190051,7 @@ var listRecruitingReviews = (params3) => Effect_exports.gen(function* () {
189564
190051
  ...params3.to === void 0 ? {} : { dueDate: { $lte: params3.to } }
189565
190052
  };
189566
190053
  const reviews = yield* client.findAll(recruitIds.class.Review, hulyQuery(query), {
189567
- sort: { date: import_core81.SortingOrder.Descending }
190054
+ sort: { date: import_core82.SortingOrder.Descending }
189568
190055
  });
189569
190056
  const limited = reviews.filter((review) => matchesReviewText(review, params3.query)).slice(0, listLimit(params3.limit));
189570
190057
  const refs = yield* Effect_exports.forEach(limited, (review) => reviewRefFromDoc(client, review));
@@ -189582,7 +190069,7 @@ var createRecruitingReview = (params3) => Effect_exports.gen(function* () {
189582
190069
  const application = yield* optionalApplication(client, params3.application, person);
189583
190070
  const company = params3.company === void 0 ? void 0 : (yield* resolveOrganizationByIdentifier(client, params3.company))._id;
189584
190071
  const number9 = yield* incrementSequence(client, recruitIds.class.Review, "review");
189585
- const reviewId = (0, import_core81.generateId)();
190072
+ const reviewId = (0, import_core82.generateId)();
189586
190073
  const data = {
189587
190074
  number: number9,
189588
190075
  date: params3.date,
@@ -189728,7 +190215,7 @@ var listRecruitingOpinions = (params3) => Effect_exports.gen(function* () {
189728
190215
  const opinions = yield* client.findAll(
189729
190216
  recruitIds.class.Opinion,
189730
190217
  hulyQuery({ attachedTo: review._id }),
189731
- { limit: listLimit(params3.limit), sort: { modifiedOn: import_core82.SortingOrder.Descending } }
190218
+ { limit: listLimit(params3.limit), sort: { modifiedOn: import_core83.SortingOrder.Descending } }
189732
190219
  );
189733
190220
  const refs = yield* Effect_exports.forEach(opinions, (opinion) => opinionRefFromDoc(client, opinion, review));
189734
190221
  return { opinions: refs, total: Count.make(refs.length) };
@@ -189744,7 +190231,7 @@ var createRecruitingOpinion = (params3) => Effect_exports.gen(function* () {
189744
190231
  const client = yield* HulyClient;
189745
190232
  const review = yield* findReview(client, params3.review);
189746
190233
  const number9 = yield* incrementSequence(client, recruitIds.class.Opinion, "opinion");
189747
- const opinionId = (0, import_core82.generateId)();
190234
+ const opinionId = (0, import_core83.generateId)();
189748
190235
  const data = {
189749
190236
  number: number9,
189750
190237
  value: params3.value,
@@ -189955,7 +190442,7 @@ var recruitingExtendedTools = [
189955
190442
  ];
189956
190443
 
189957
190444
  // src/huly/operations/recruiting-media.ts
189958
- var import_core83 = __toESM(require_lib5(), 1);
190445
+ var import_core84 = __toESM(require_lib5(), 1);
189959
190446
 
189960
190447
  // src/huly/operations/recruiting-targets.ts
189961
190448
  var candidateObjectClass = toClassRef(String(recruitIds.mixin.Candidate));
@@ -190192,7 +190679,7 @@ var listRecruitingActivity = (params3) => Effect_exports.gen(function* () {
190192
190679
  const messages = yield* target.client.findAll(
190193
190680
  activity.class.ActivityMessage,
190194
190681
  hulyQuery({ attachedTo: target.objectId, attachedToClass: target.objectClass }),
190195
- { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core83.SortingOrder.Descending }, total: true }
190682
+ { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core84.SortingOrder.Descending }, total: true }
190196
190683
  );
190197
190684
  return {
190198
190685
  target: target.target,
@@ -190202,7 +190689,7 @@ var listRecruitingActivity = (params3) => Effect_exports.gen(function* () {
190202
190689
  });
190203
190690
 
190204
190691
  // src/huly/operations/recruiting-related-issues.ts
190205
- var import_core84 = __toESM(require_lib5(), 1);
190692
+ var import_core85 = __toESM(require_lib5(), 1);
190206
190693
  var issueSummary = (issue2) => ({
190207
190694
  id: DocId.make(issue2._id),
190208
190695
  class: ObjectClassName.make(issue2._class),
@@ -190242,7 +190729,7 @@ var listRecruitingRelatedIssues = (params3) => Effect_exports.gen(function* () {
190242
190729
  const issues = yield* target.client.findAll(
190243
190730
  tracker.class.Issue,
190244
190731
  hulyQuery({ relations: targetRelatedDocument(target) }),
190245
- { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core84.SortingOrder.Descending }, total: true }
190732
+ { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core85.SortingOrder.Descending }, total: true }
190246
190733
  );
190247
190734
  return {
190248
190735
  target: target.target,
@@ -190652,7 +191139,7 @@ var recruitingTools = [
190652
191139
  ];
190653
191140
 
190654
191141
  // src/huly/operations/related-issue-targets.ts
190655
- var import_core85 = __toESM(require_lib5(), 1);
191142
+ var import_core86 = __toESM(require_lib5(), 1);
190656
191143
  var projectMapById2 = (client, ids3) => Effect_exports.gen(function* () {
190657
191144
  const uniqueIds = [...new Set(ids3)];
190658
191145
  if (uniqueIds.length === 0) return /* @__PURE__ */ new Map();
@@ -190732,7 +191219,7 @@ var listRelatedIssueTargets = (params3) => Effect_exports.gen(function* () {
190732
191219
  const targets = yield* client.findAll(
190733
191220
  tracker.class.RelatedIssueTarget,
190734
191221
  hulyQuery(query),
190735
- { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core85.SortingOrder.Descending }, total: true }
191222
+ { limit: clampLimit(params3.limit), sort: { modifiedOn: import_core86.SortingOrder.Descending }, total: true }
190736
191223
  );
190737
191224
  const targetProjectIds = targets.flatMap(
190738
191225
  (target) => target.target === void 0 || target.target === null ? [] : [target.target]
@@ -190749,7 +191236,7 @@ var setRelatedIssueTarget = (params3) => Effect_exports.gen(function* () {
190749
191236
  const space = yield* findSpace(client, { space: params3.space, includeArchived: true });
190750
191237
  const existing2 = yield* findSpaceRule(client, toRef(space._id));
190751
191238
  if (existing2 === void 0) {
190752
- const targetId = (0, import_core85.generateId)();
191239
+ const targetId = (0, import_core86.generateId)();
190753
191240
  const data = {
190754
191241
  target: targetProject,
190755
191242
  rule: { kind: "spaceRule", space: toRef(space._id) }
@@ -190833,10 +191320,10 @@ var relatedIssueTargetTools = [
190833
191320
  ];
190834
191321
 
190835
191322
  // src/huly/operations/sdk-discovery-configurations.ts
190836
- var import_core87 = __toESM(require_lib5(), 1);
191323
+ var import_core88 = __toESM(require_lib5(), 1);
190837
191324
 
190838
191325
  // src/huly/operations/spaces-read.ts
190839
- var import_core86 = __toESM(require_lib5(), 1);
191326
+ var import_core87 = __toESM(require_lib5(), 1);
190840
191327
  var findSpaceType = (client, identifier2) => Effect_exports.gen(function* () {
190841
191328
  const byId = yield* client.findOne(
190842
191329
  core.class.SpaceType,
@@ -190846,7 +191333,7 @@ var findSpaceType = (client, identifier2) => Effect_exports.gen(function* () {
190846
191333
  const byName = yield* client.findAll(
190847
191334
  core.class.SpaceType,
190848
191335
  hulyQuery({ name: identifier2 }),
190849
- { limit: 10, sort: { name: import_core86.SortingOrder.Ascending } }
191336
+ { limit: 10, sort: { name: import_core87.SortingOrder.Ascending } }
190850
191337
  );
190851
191338
  if (byName.length === 0) {
190852
191339
  return yield* new SpaceTypeNotFoundError({ identifier: NonEmptyString2.make(identifier2) });
@@ -190880,7 +191367,7 @@ var listSpaces = (params3) => Effect_exports.gen(function* () {
190880
191367
  const limit = clampLimit(params3.limit);
190881
191368
  const spaces = yield* client.findAll(spaceClass, hulyQuery(query), {
190882
191369
  limit,
190883
- sort: { name: import_core86.SortingOrder.Ascending },
191370
+ sort: { name: import_core87.SortingOrder.Ascending },
190884
191371
  total: true
190885
191372
  });
190886
191373
  return { spaces: spaces.map(toSpaceSummary), total: listTotal(spaces.total) };
@@ -190917,7 +191404,7 @@ var listSpaceTypes = (params3) => Effect_exports.gen(function* () {
190917
191404
  const limit = clampLimit(params3.limit);
190918
191405
  const spaceTypes = yield* client.findAll(core.class.SpaceType, hulyQuery(query), {
190919
191406
  limit,
190920
- sort: { name: import_core86.SortingOrder.Ascending },
191407
+ sort: { name: import_core87.SortingOrder.Ascending },
190921
191408
  total: true
190922
191409
  });
190923
191410
  const descriptorIds = sortStrings([...new Set(spaceTypes.map(descriptorId))]);
@@ -190941,7 +191428,7 @@ var getSpaceType = (params3) => Effect_exports.gen(function* () {
190941
191428
  );
190942
191429
  const roles = yield* client.findAll(core.class.Role, hulyQuery({ attachedTo: spaceType._id }), {
190943
191430
  limit: clampLimit(void 0),
190944
- sort: { name: import_core86.SortingOrder.Ascending }
191431
+ sort: { name: import_core87.SortingOrder.Ascending }
190945
191432
  });
190946
191433
  const permissionIds = sortStrings([
190947
191434
  .../* @__PURE__ */ new Set([...descriptor3?.availablePermissions ?? [], ...roles.flatMap((role) => role.permissions)])
@@ -190972,7 +191459,7 @@ var listSpacePermissions = (params3) => Effect_exports.gen(function* () {
190972
191459
  query.objectClass = toClassRef(params3.objectClass);
190973
191460
  }
190974
191461
  const permissions = yield* client.findAll(core.class.Permission, hulyQuery(query), {
190975
- sort: { label: import_core86.SortingOrder.Ascending }
191462
+ sort: { label: import_core87.SortingOrder.Ascending }
190976
191463
  });
190977
191464
  const filtered = permissions.filter((permission) => permissionSearchMatches(permission, params3.search));
190978
191465
  const limited = filtered.slice(0, clampLimit(params3.limit));
@@ -191021,7 +191508,7 @@ var listHulyPluginConfigurations = () => Effect_exports.gen(function* () {
191021
191508
  const configs = yield* client.findAll(
191022
191509
  core.class.PluginConfiguration,
191023
191510
  hulyQuery({}),
191024
- { sort: { pluginId: import_core87.SortingOrder.Ascending } }
191511
+ { sort: { pluginId: import_core88.SortingOrder.Ascending } }
191025
191512
  );
191026
191513
  const pluginConfigurations = configs.map(toPluginConfigurationSummary);
191027
191514
  return { pluginConfigurations, total: Count.make(pluginConfigurations.length) };
@@ -191031,7 +191518,7 @@ var listHulyDomainIndexConfigurations = () => Effect_exports.gen(function* () {
191031
191518
  const configs = yield* client.findAll(
191032
191519
  core.class.DomainIndexConfiguration,
191033
191520
  hulyQuery({}),
191034
- { sort: { domain: import_core87.SortingOrder.Ascending } }
191521
+ { sort: { domain: import_core88.SortingOrder.Ascending } }
191035
191522
  );
191036
191523
  const domainIndexConfigurations = configs.map(toDomainIndexConfigurationSummary);
191037
191524
  return { domainIndexConfigurations, total: Count.make(domainIndexConfigurations.length) };
@@ -191039,12 +191526,12 @@ var listHulyDomainIndexConfigurations = () => Effect_exports.gen(function* () {
191039
191526
  var listHulySequences = () => Effect_exports.gen(function* () {
191040
191527
  const client = yield* HulyClient;
191041
191528
  const sequences = yield* client.findAll(core.class.Sequence, hulyQuery({}), {
191042
- sort: { _id: import_core87.SortingOrder.Ascending }
191529
+ sort: { _id: import_core88.SortingOrder.Ascending }
191043
191530
  });
191044
191531
  const customSequences = yield* client.findAll(
191045
191532
  core.class.CustomSequence,
191046
191533
  hulyQuery({}),
191047
- { sort: { _id: import_core87.SortingOrder.Ascending } }
191534
+ { sort: { _id: import_core88.SortingOrder.Ascending } }
191048
191535
  );
191049
191536
  const merged = new Map([
191050
191537
  ...sequences.map((sequence) => [sequenceKey(sequence), sequence]),
@@ -191078,7 +191565,7 @@ var describeHulySpaceTypeCapabilities = (params3) => Effect_exports.gen(function
191078
191565
  });
191079
191566
 
191080
191567
  // src/huly/operations/sdk-discovery.ts
191081
- var import_core88 = __toESM(require_lib5(), 1);
191568
+ var import_core89 = __toESM(require_lib5(), 1);
191082
191569
  var MAX_ANCESTOR_DEPTH = 32;
191083
191570
  var classRef3 = core.class.Class;
191084
191571
  var includesQuery = (text4, query) => Option_exports.isNone(query) || text4.includes(query.value.toLowerCase());
@@ -191115,7 +191602,7 @@ var fetchClasses = (client, params3) => {
191115
191602
  ...Option_exports.isSome(kind) ? { kind: kind.value } : {},
191116
191603
  ...params3.domain === void 0 ? {} : { domain: params3.domain }
191117
191604
  };
191118
- return client.findAll(classRef3, hulyQuery(query), { sort: { _id: import_core88.SortingOrder.Ascending } });
191605
+ return client.findAll(classRef3, hulyQuery(query), { sort: { _id: import_core89.SortingOrder.Ascending } });
191119
191606
  };
191120
191607
  var fetchAttributes = (client, params3) => {
191121
191608
  const query = {
@@ -191123,7 +191610,7 @@ var fetchAttributes = (client, params3) => {
191123
191610
  ...params3.customOnly ?? DEFAULT_CUSTOM_FIELDS_ONLY ? { isCustom: true } : {}
191124
191611
  };
191125
191612
  return client.findAll(core.class.Attribute, hulyQuery(query), {
191126
- sort: { name: import_core88.SortingOrder.Ascending }
191613
+ sort: { name: import_core89.SortingOrder.Ascending }
191127
191614
  });
191128
191615
  };
191129
191616
  var resolveClass = (client, classId) => Effect_exports.gen(function* () {
@@ -191174,7 +191661,7 @@ var resolveAncestors = (client, cls) => Effect_exports.gen(function* () {
191174
191661
  var attributesForClasses = (client, classIds) => classIds.length === 0 ? Effect_exports.succeed([]) : client.findAll(
191175
191662
  core.class.Attribute,
191176
191663
  hulyQuery({ attributeOf: { $in: classIds.map(toRef) } }),
191177
- { sort: { name: import_core88.SortingOrder.Ascending } }
191664
+ { sort: { name: import_core89.SortingOrder.Ascending } }
191178
191665
  );
191179
191666
  var listHulyClasses = (params3) => Effect_exports.gen(function* () {
191180
191667
  const client = yield* HulyClient;
@@ -191238,7 +191725,7 @@ var listHulyEnums = (params3) => Effect_exports.gen(function* () {
191238
191725
  ...params3.enum === void 0 ? {} : { _id: toRef(params3.enum) }
191239
191726
  };
191240
191727
  const rawEnums = yield* client.findAll(core.class.Enum, hulyQuery(query), {
191241
- sort: { name: import_core88.SortingOrder.Ascending }
191728
+ sort: { name: import_core89.SortingOrder.Ascending }
191242
191729
  });
191243
191730
  const enums = rawEnums.map(toEnumSummary).filter((summary5) => includesQuery(enumSearchText(summary5), queryText)).slice(0, limit);
191244
191731
  return { enums, total: HulyDiscoveryCount.make(enums.length) };
@@ -191678,7 +192165,7 @@ var storageTools = [
191678
192165
  ];
191679
192166
 
191680
192167
  // src/huly/operations/tag-categories.ts
191681
- var import_core89 = __toESM(require_lib5(), 1);
192168
+ var import_core90 = __toESM(require_lib5(), 1);
191682
192169
  var defaultTargetClassRef = toRef(DEFAULT_TAG_CATEGORY_TARGET_CLASS);
191683
192170
  var findCategoryByIdOrLabel = (client, idOrLabel) => Effect_exports.gen(function* () {
191684
192171
  const cat = (yield* client.findOne(tags.class.TagCategory, { _id: toRef(idOrLabel) })) ?? (yield* client.findOne(tags.class.TagCategory, { label: idOrLabel }));
@@ -191707,7 +192194,7 @@ var listTagCategories = (params3) => Effect_exports.gen(function* () {
191707
192194
  }
191708
192195
  const categories = yield* client.findAll(tags.class.TagCategory, query, {
191709
192196
  limit,
191710
- sort: { modifiedOn: import_core89.SortingOrder.Descending }
192197
+ sort: { modifiedOn: import_core90.SortingOrder.Descending }
191711
192198
  });
191712
192199
  return categories.map(toSummary);
191713
192200
  });
@@ -191721,7 +192208,7 @@ var createTagCategory = (params3) => Effect_exports.gen(function* () {
191721
192208
  if (existing !== void 0) {
191722
192209
  return { id: TagCategoryId.make(existing._id), label: existing.label, created: false };
191723
192210
  }
191724
- const catId = (0, import_core89.generateId)();
192211
+ const catId = (0, import_core90.generateId)();
191725
192212
  const catData = {
191726
192213
  // Asset is a branded string type (Metadata<URL>) with no runtime constructor.
191727
192214
  // Empty string is the "no icon" sentinel; Huly UI renders a default icon.
@@ -191891,7 +192378,7 @@ var tagTools = [
191891
192378
  ];
191892
192379
 
191893
192380
  // src/huly/operations/task-management.ts
191894
- var import_core90 = __toESM(require_lib5(), 1);
192381
+ var import_core91 = __toESM(require_lib5(), 1);
191895
192382
  var import_platform3 = __toESM(require_lib(), 1);
191896
192383
  var STATUS_CATEGORY_BY_SDK_KEY = {
191897
192384
  UnStarted: { value: "UnStarted", ref: StatusCategoryBySdkKey.UnStarted, name: "UnStarted" },
@@ -192009,7 +192496,7 @@ var projectTypeDetail = (data) => ({
192009
192496
  }))
192010
192497
  });
192011
192498
  var listAllProjectTypes = (client) => client.findAll(task.class.ProjectType, hulyQuery({}), {
192012
- sort: { name: import_core90.SortingOrder.Ascending }
192499
+ sort: { name: import_core91.SortingOrder.Ascending }
192013
192500
  }).pipe(Effect_exports.map((result) => [...result]));
192014
192501
  var resolveProjectType = (client, projectTypeRef) => Effect_exports.gen(function* () {
192015
192502
  const projectTypes = yield* listAllProjectTypes(client);
@@ -192121,7 +192608,7 @@ var createTaskType = (params3) => Effect_exports.gen(function* () {
192121
192608
  new HulyError({ message: `Project type '${projectType.name}' has no task type to copy.` })
192122
192609
  );
192123
192610
  }
192124
- const taskTypeId = (0, import_core90.generateId)();
192611
+ const taskTypeId = (0, import_core91.generateId)();
192125
192612
  const targetClassId = `${taskTypeId}:type:mixin`;
192126
192613
  const targetClassRef = toRef(targetClassId);
192127
192614
  const templateStatusIds = uniqueStatusRefs(template.statuses);
@@ -192130,7 +192617,7 @@ var createTaskType = (params3) => Effect_exports.gen(function* () {
192130
192617
  core.space.Model,
192131
192618
  {
192132
192619
  extends: template.ofClass,
192133
- kind: import_core90.ClassifierKind.MIXIN,
192620
+ kind: import_core91.ClassifierKind.MIXIN,
192134
192621
  label: (0, import_platform3.getEmbeddedLabel)(params3.name),
192135
192622
  ...template.icon === void 0 ? {} : { icon: template.icon }
192136
192623
  },
@@ -192197,7 +192684,7 @@ var createIssueStatus = (params3) => Effect_exports.gen(function* () {
192197
192684
  const statusClass = yield* resolveStatusClass(targetTaskTypes);
192198
192685
  const statusesByName = yield* getRecoverableStatusesByName(client, params3.name);
192199
192686
  const existingStatus = existingStatusByName([...workflowData.statuses, ...statusesByName], params3.name);
192200
- const statusId = existingStatus?._id ?? (0, import_core90.generateId)();
192687
+ const statusId = existingStatus?._id ?? (0, import_core91.generateId)();
192201
192688
  if (existingStatus !== void 0) {
192202
192689
  yield* requireStatusCategoryMatch(existingStatus, params3.category);
192203
192690
  }
@@ -192316,7 +192803,7 @@ var taskManagementTools = [
192316
192803
  ];
192317
192804
 
192318
192805
  // src/huly/operations/test-management-core.ts
192319
- var import_core91 = __toESM(require_lib5(), 1);
192806
+ var import_core92 = __toESM(require_lib5(), 1);
192320
192807
 
192321
192808
  // src/huly/test-management-classes.ts
192322
192809
  var testManagement = {
@@ -192464,7 +192951,7 @@ var findTestResult = (client, project3, idOrName) => findByNameOrIdOrFail(
192464
192951
  { name: idOrName, space: project3._id },
192465
192952
  () => new TestResultNotFoundError({ identifier: idOrName })
192466
192953
  );
192467
- var resolveAssignee3 = (emailOrName) => Effect_exports.gen(function* () {
192954
+ var resolveAssignee4 = (emailOrName) => Effect_exports.gen(function* () {
192468
192955
  const client = yield* HulyClient;
192469
192956
  const person = yield* findPersonByEmailOrName(client, emailOrName);
192470
192957
  if (person === void 0) {
@@ -192496,7 +192983,7 @@ var updateTestCase = (params3) => Effect_exports.gen(function* () {
192496
192983
  if (params3.assignee === null) {
192497
192984
  return { assignee: null };
192498
192985
  }
192499
- const person = yield* resolveAssignee3(params3.assignee);
192986
+ const person = yield* resolveAssignee4(params3.assignee);
192500
192987
  return { assignee: toRef(person._id) };
192501
192988
  })
192502
192989
  };
@@ -192556,7 +193043,7 @@ var listTestProjects = (params3) => Effect_exports.gen(function* () {
192556
193043
  const projects = yield* client.findAll(
192557
193044
  testManagement.class.TestProject,
192558
193045
  {},
192559
- { limit, sort: { name: import_core91.SortingOrder.Ascending } }
193046
+ { limit, sort: { name: import_core92.SortingOrder.Ascending } }
192560
193047
  );
192561
193048
  return { projects: projects.map(toProjectSummary), total: listTotal(projects.total) };
192562
193049
  });
@@ -192571,7 +193058,7 @@ var listTestSuites = (params3) => Effect_exports.gen(function* () {
192571
193058
  }
192572
193059
  const suites = yield* client.findAll(testManagement.class.TestSuite, query, {
192573
193060
  limit,
192574
- sort: { modifiedOn: import_core91.SortingOrder.Descending }
193061
+ sort: { modifiedOn: import_core92.SortingOrder.Descending }
192575
193062
  });
192576
193063
  return { suites: suites.map(toSuiteSummary), total: listTotal(suites.total) };
192577
193064
  });
@@ -192598,7 +193085,7 @@ var createTestSuite = (params3) => Effect_exports.gen(function* () {
192598
193085
  if (existing !== void 0) {
192599
193086
  return { id: TestSuiteId.make(existing._id), name: existing.name, created: false };
192600
193087
  }
192601
- const suiteId = (0, import_core91.generateId)();
193088
+ const suiteId = (0, import_core92.generateId)();
192602
193089
  const suiteData = {
192603
193090
  name: params3.name,
192604
193091
  description: params3.description ?? "",
@@ -192630,12 +193117,12 @@ var listTestCases = (params3) => Effect_exports.gen(function* () {
192630
193117
  query.attachedTo = suite._id;
192631
193118
  }
192632
193119
  if (params3.assignee !== void 0) {
192633
- const person = yield* resolveAssignee3(params3.assignee);
193120
+ const person = yield* resolveAssignee4(params3.assignee);
192634
193121
  query.assignee = toRef(person._id);
192635
193122
  }
192636
193123
  const cases = yield* client.findAll(testManagement.class.TestCase, query, {
192637
193124
  limit,
192638
- sort: { modifiedOn: import_core91.SortingOrder.Descending }
193125
+ sort: { modifiedOn: import_core92.SortingOrder.Descending }
192639
193126
  });
192640
193127
  return { testCases: cases.map(toCaseSummary), total: listTotal(cases.total) };
192641
193128
  });
@@ -192654,8 +193141,8 @@ var createTestCase = (params3) => Effect_exports.gen(function* () {
192654
193141
  const client = yield* HulyClient;
192655
193142
  const project3 = yield* findTestProject(client, params3.project);
192656
193143
  const suite = yield* findTestSuite(client, project3, params3.suite);
192657
- const caseId = (0, import_core91.generateId)();
192658
- const assigneeRef = params3.assignee !== void 0 ? toRef((yield* resolveAssignee3(params3.assignee))._id) : null;
193144
+ const caseId = (0, import_core92.generateId)();
193145
+ const assigneeRef = params3.assignee !== void 0 ? toRef((yield* resolveAssignee4(params3.assignee))._id) : null;
192659
193146
  const typeEnum = resolveCaseType(params3.type ?? DEFAULT_TEST_CASE_TYPE);
192660
193147
  const priorityEnum = resolveCasePriority(params3.priority ?? DEFAULT_TEST_CASE_PRIORITY);
192661
193148
  const statusEnum = resolveCaseStatus(params3.status ?? DEFAULT_TEST_CASE_STATUS);
@@ -192815,7 +193302,7 @@ var testManagementCoreTools = [
192815
193302
  ];
192816
193303
 
192817
193304
  // src/huly/operations/test-management-plans.ts
192818
- var import_core92 = __toESM(require_lib5(), 1);
193305
+ var import_core93 = __toESM(require_lib5(), 1);
192819
193306
  var toPlanSummary = (p) => ({ id: TestPlanId.make(p._id), name: p.name });
192820
193307
  var toItemSummary = (item) => ({
192821
193308
  id: TestPlanItemId.make(item._id),
@@ -192830,7 +193317,7 @@ var listTestPlans = (params3) => Effect_exports.gen(function* () {
192830
193317
  const plans = yield* client.findAll(
192831
193318
  testManagement.class.TestPlan,
192832
193319
  { space: project3._id },
192833
- { limit, sort: { modifiedOn: import_core92.SortingOrder.Descending } }
193320
+ { limit, sort: { modifiedOn: import_core93.SortingOrder.Descending } }
192834
193321
  );
192835
193322
  return { plans: plans.map(toPlanSummary), total: listTotal(plans.total) };
192836
193323
  });
@@ -192857,7 +193344,7 @@ var createTestPlan = (params3) => Effect_exports.gen(function* () {
192857
193344
  if (existing !== void 0) {
192858
193345
  return { id: TestPlanId.make(existing._id), name: existing.name, created: false };
192859
193346
  }
192860
- const planId = (0, import_core92.generateId)();
193347
+ const planId = (0, import_core93.generateId)();
192861
193348
  const descRef = params3.description !== void 0 && params3.description.trim() !== "" ? yield* uploadDescription(client, testManagement.class.TestPlan, planId, params3.description) : null;
192862
193349
  yield* client.createDoc(
192863
193350
  testManagement.class.TestPlan,
@@ -192903,7 +193390,7 @@ var addTestPlanItem = (params3) => Effect_exports.gen(function* () {
192903
193390
  ...tc.attachedTo ? { testSuite: tc.attachedTo } : {}
192904
193391
  };
192905
193392
  if (params3.assignee !== void 0) {
192906
- itemAttrs.assignee = toRef((yield* resolveAssignee3(params3.assignee))._id);
193393
+ itemAttrs.assignee = toRef((yield* resolveAssignee4(params3.assignee))._id);
192907
193394
  }
192908
193395
  const itemId = yield* client.addCollection(
192909
193396
  testManagement.class.TestPlanItem,
@@ -192931,7 +193418,7 @@ var removeTestPlanItem = (params3) => Effect_exports.gen(function* () {
192931
193418
  });
192932
193419
 
192933
193420
  // src/huly/operations/test-management-runs.ts
192934
- var import_core93 = __toESM(require_lib5(), 1);
193421
+ var import_core94 = __toESM(require_lib5(), 1);
192935
193422
  var BATCH_CONCURRENCY = 10;
192936
193423
  var resolveStatusOrUntested = (status2) => {
192937
193424
  const resolved = stringToTestRunStatus(status2);
@@ -192957,7 +193444,7 @@ var listTestRuns = (params3) => Effect_exports.gen(function* () {
192957
193444
  const runs = yield* client.findAll(
192958
193445
  testManagement.class.TestRun,
192959
193446
  { space: project3._id },
192960
- { limit, sort: { modifiedOn: import_core93.SortingOrder.Descending } }
193447
+ { limit, sort: { modifiedOn: import_core94.SortingOrder.Descending } }
192961
193448
  );
192962
193449
  return { runs: runs.map(toRunSummary), total: listTotal(runs.total) };
192963
193450
  });
@@ -192978,7 +193465,7 @@ var getTestRun = (params3) => Effect_exports.gen(function* () {
192978
193465
  var createTestRun = (params3) => Effect_exports.gen(function* () {
192979
193466
  const client = yield* HulyClient;
192980
193467
  const project3 = yield* findTestProject(client, params3.project);
192981
- const runId = (0, import_core93.generateId)();
193468
+ const runId = (0, import_core94.generateId)();
192982
193469
  const descRef = params3.description !== void 0 && params3.description.trim() !== "" ? yield* uploadDescription(client, testManagement.class.TestRun, runId, params3.description) : null;
192983
193470
  yield* client.createDoc(
192984
193471
  testManagement.class.TestRun,
@@ -193028,7 +193515,7 @@ var listTestResults = (params3) => Effect_exports.gen(function* () {
193028
193515
  const results = yield* client.findAll(
193029
193516
  testManagement.class.TestResult,
193030
193517
  { attachedTo: run8._id },
193031
- { limit, sort: { modifiedOn: import_core93.SortingOrder.Descending } }
193518
+ { limit, sort: { modifiedOn: import_core94.SortingOrder.Descending } }
193032
193519
  );
193033
193520
  return { results: results.map(toResultSummary), total: listTotal(results.total) };
193034
193521
  });
@@ -193065,7 +193552,7 @@ var createTestResult = (params3) => Effect_exports.gen(function* () {
193065
193552
  description: null
193066
193553
  };
193067
193554
  if (params3.assignee !== void 0) {
193068
- resultAttrs.assignee = toRef((yield* resolveAssignee3(params3.assignee))._id);
193555
+ resultAttrs.assignee = toRef((yield* resolveAssignee4(params3.assignee))._id);
193069
193556
  }
193070
193557
  const resultId = yield* client.addCollection(
193071
193558
  testManagement.class.TestResult,
@@ -193096,7 +193583,7 @@ var updateTestResult = (params3) => Effect_exports.gen(function* () {
193096
193583
  return coveredUpdateEntry("assignee", { $unset: { assignee: "" } });
193097
193584
  }
193098
193585
  return coveredUpdateEntry("assignee", {
193099
- assignee: toRef((yield* resolveAssignee3(params3.assignee))._id)
193586
+ assignee: toRef((yield* resolveAssignee4(params3.assignee))._id)
193100
193587
  });
193101
193588
  }),
193102
193589
  description: Effect_exports.gen(function* () {
@@ -193134,7 +193621,7 @@ var runTestPlan = (params3) => Effect_exports.gen(function* () {
193134
193621
  }),
193135
193622
  { concurrency: BATCH_CONCURRENCY }
193136
193623
  );
193137
- const runId = (0, import_core93.generateId)();
193624
+ const runId = (0, import_core94.generateId)();
193138
193625
  const runName = params3.runName ?? `${plan.name} - Run`;
193139
193626
  yield* client.createDoc(
193140
193627
  testManagement.class.TestRun,
@@ -193384,7 +193871,7 @@ var testManagementPlansTools = [
193384
193871
  ];
193385
193872
 
193386
193873
  // src/huly/operations/time.ts
193387
- var import_core94 = __toESM(require_lib5(), 1);
193874
+ var import_core95 = __toESM(require_lib5(), 1);
193388
193875
  var import_tracker8 = __toESM(require_lib24(), 1);
193389
193876
  var refAsPersonId = (ref) => ref;
193390
193877
  var toTimeReportDate = (date8) => date8 === null ? null : Timestamp.make(date8);
@@ -193393,7 +193880,7 @@ var logTime = (params3) => Effect_exports.gen(function* () {
193393
193880
  project: params3.project,
193394
193881
  identifier: params3.identifier
193395
193882
  });
193396
- const reportId = (0, import_core94.generateId)();
193883
+ const reportId = (0, import_core95.generateId)();
193397
193884
  const socialIdentity = yield* client.findOne(
193398
193885
  contact.class.SocialIdentity,
193399
193886
  hulyQuery({ _id: toSocialIdentityRef(client.getPrimarySocialId()) })
@@ -193431,7 +193918,7 @@ var getTimeReport = (params3) => Effect_exports.gen(function* () {
193431
193918
  const reports = yield* client.findAll(
193432
193919
  tracker.class.TimeSpendReport,
193433
193920
  { attachedTo: issue2._id },
193434
- { sort: { date: import_core94.SortingOrder.Descending } }
193921
+ { sort: { date: import_core95.SortingOrder.Descending } }
193435
193922
  );
193436
193923
  const employeeIds = [...new Set(reports.map((r) => r.employee).filter(isExistent))];
193437
193924
  const persons = employeeIds.length > 0 ? yield* client.findAll(contact.class.Person, { _id: { $in: employeeIds } }) : [];
@@ -193482,7 +193969,7 @@ var listTimeSpendReports = (params3) => Effect_exports.gen(function* () {
193482
193969
  tracker.class.TimeSpendReport,
193483
193970
  query,
193484
193971
  withLookup(
193485
- { limit, sort: { date: import_core94.SortingOrder.Descending } },
193972
+ { limit, sort: { date: import_core95.SortingOrder.Descending } },
193486
193973
  { attachedTo: tracker.class.Issue, employee: contact.class.Person }
193487
193974
  )
193488
193975
  );
@@ -193513,7 +194000,7 @@ var getDetailedTimeReport = (params3) => Effect_exports.gen(function* () {
193513
194000
  tracker.class.TimeSpendReport,
193514
194001
  query,
193515
194002
  withLookup(
193516
- { sort: { date: import_core94.SortingOrder.Descending } },
194003
+ { sort: { date: import_core95.SortingOrder.Descending } },
193517
194004
  { attachedTo: tracker.class.Issue, employee: contact.class.Person }
193518
194005
  )
193519
194006
  );
@@ -193581,7 +194068,7 @@ var listWorkSlots = (params3) => Effect_exports.gen(function* () {
193581
194068
  const limit = clampLimit(params3.limit);
193582
194069
  const slots = yield* client.findAll(time3.class.WorkSlot, query, {
193583
194070
  limit,
193584
- sort: { date: import_core94.SortingOrder.Descending }
194071
+ sort: { date: import_core95.SortingOrder.Descending }
193585
194072
  });
193586
194073
  return slots.map((s) => ({
193587
194074
  id: WorkSlotId.make(s._id),
@@ -193692,7 +194179,7 @@ var timeTools = [
193692
194179
  ];
193693
194180
 
193694
194181
  // src/huly/operations/user-statuses.ts
193695
- var import_core95 = __toESM(require_lib5(), 1);
194182
+ var import_core96 = __toESM(require_lib5(), 1);
193696
194183
  var userStatusSummary = (status2) => ({
193697
194184
  id: UserStatusId.make(status2._id),
193698
194185
  user: UserStatusAccountUuid.make(status2.user),
@@ -193706,7 +194193,7 @@ var listUserStatuses = (params3) => Effect_exports.gen(function* () {
193706
194193
  const query = { ...onlineQuery, ...userQuery };
193707
194194
  const statuses = yield* client.findAll(core.class.UserStatus, hulyQuery(query), {
193708
194195
  limit: clampLimit(params3.limit),
193709
- sort: { modifiedOn: import_core95.SortingOrder.Descending }
194196
+ sort: { modifiedOn: import_core96.SortingOrder.Descending }
193710
194197
  });
193711
194198
  return ListUserStatusesResultSchema.make({
193712
194199
  statuses: statuses.map(userStatusSummary),
@@ -193731,7 +194218,7 @@ var userStatusTools = [
193731
194218
  ];
193732
194219
 
193733
194220
  // src/huly/operations/views.ts
193734
- var import_core96 = __toESM(require_lib5(), 1);
194221
+ var import_core97 = __toESM(require_lib5(), 1);
193735
194222
  var viewletIdField2 = (viewletId) => viewletId === void 0 || viewletId === null ? {} : { viewletId: ViewletId.make(viewletId) };
193736
194223
  var stringField2 = (key, value3) => value3 === void 0 || value3.trim() === "" ? {} : { [key]: value3 };
193737
194224
  var visibilityFor2 = (filteredView, account) => filteredView.users.includes(account) ? "own" : "shared";
@@ -193833,7 +194320,7 @@ var listFilteredViews = (params3) => Effect_exports.gen(function* () {
193833
194320
  ...nameSearch === "" ? {} : { name: { $like: `%${escapeLikeWildcards(nameSearch)}%` } }
193834
194321
  };
193835
194322
  const filteredViews = yield* client.findAll(view.class.FilteredView, hulyQuery(query), {
193836
- sort: { modifiedOn: import_core96.SortingOrder.Descending },
194323
+ sort: { modifiedOn: import_core97.SortingOrder.Descending },
193837
194324
  total: true
193838
194325
  });
193839
194326
  const visible = filterByVisibility2(filteredViews, params3.visibility, account);
@@ -193920,7 +194407,7 @@ var viewTools = [
193920
194407
  ];
193921
194408
 
193922
194409
  // src/huly/operations/virtual-office.ts
193923
- var import_core97 = __toESM(require_lib5(), 1);
194410
+ var import_core98 = __toESM(require_lib5(), 1);
193924
194411
  var import_love = __toESM(require_lib30(), 1);
193925
194412
  var ROOM_ACCESS_TO_STRING = {
193926
194413
  [import_love.RoomAccess.Open]: "open",
@@ -194019,7 +194506,7 @@ var listOfficeFloors = (params3) => Effect_exports.gen(function* () {
194019
194506
  const client = yield* HulyClient;
194020
194507
  const floors = yield* client.findAll(love.class.Floor, hulyQuery({}), {
194021
194508
  limit: clampLimit(params3.limit),
194022
- sort: { name: import_core97.SortingOrder.Ascending }
194509
+ sort: { name: import_core98.SortingOrder.Ascending }
194023
194510
  });
194024
194511
  return floors.map(summarizeFloor);
194025
194512
  });
@@ -194038,7 +194525,7 @@ var listOfficeRooms = (params3) => Effect_exports.gen(function* () {
194038
194525
  if (params3.floorId !== void 0) query.floor = toRef(params3.floorId);
194039
194526
  const rooms = yield* client.findAll(love.class.Room, hulyQuery(query), {
194040
194527
  limit: clampLimit(params3.limit),
194041
- sort: { name: import_core97.SortingOrder.Ascending }
194528
+ sort: { name: import_core98.SortingOrder.Ascending }
194042
194529
  });
194043
194530
  return rooms.map(summarizeRoom);
194044
194531
  });
@@ -194054,7 +194541,7 @@ var listOffices = (params3) => Effect_exports.gen(function* () {
194054
194541
  if (params3.floorId !== void 0) query.floor = toRef(params3.floorId);
194055
194542
  const offices = yield* client.findAll(love.class.Office, hulyQuery(query), {
194056
194543
  limit: clampLimit(params3.limit),
194057
- sort: { name: import_core97.SortingOrder.Ascending }
194544
+ sort: { name: import_core98.SortingOrder.Ascending }
194058
194545
  });
194059
194546
  const persons = yield* lookupPersons(
194060
194547
  client,
@@ -194091,7 +194578,7 @@ var listActiveRoomParticipants = (params3) => Effect_exports.gen(function* () {
194091
194578
  const query = {};
194092
194579
  if (params3.roomId !== void 0) query.room = toRef(params3.roomId);
194093
194580
  const participants = yield* client.findAll(love.class.ParticipantInfo, hulyQuery(query), {
194094
- sort: { name: import_core97.SortingOrder.Ascending }
194581
+ sort: { name: import_core98.SortingOrder.Ascending }
194095
194582
  });
194096
194583
  const rooms = yield* lookupRooms(
194097
194584
  client,
@@ -194121,7 +194608,7 @@ var listMeetingMinutes = (params3) => Effect_exports.gen(function* () {
194121
194608
  }
194122
194609
  const minutes2 = yield* client.findAll(love.class.MeetingMinutes, hulyQuery(query), {
194123
194610
  limit: clampLimit(params3.limit),
194124
- sort: { createdOn: import_core97.SortingOrder.Descending }
194611
+ sort: { createdOn: import_core98.SortingOrder.Descending }
194125
194612
  });
194126
194613
  return minutes2.map(summarizeMinutes);
194127
194614
  });
@@ -194153,7 +194640,7 @@ var listDevicePreferences = (_params) => Effect_exports.gen(function* () {
194153
194640
  var listOfficeDefaults = (_params) => Effect_exports.gen(function* () {
194154
194641
  const client = yield* HulyClient;
194155
194642
  const rooms = yield* client.findAll(love.class.Room, hulyQuery({}), {
194156
- sort: { name: import_core97.SortingOrder.Ascending }
194643
+ sort: { name: import_core98.SortingOrder.Ascending }
194157
194644
  });
194158
194645
  return rooms.map((room) => ({
194159
194646
  roomId: RoomId.make(room._id),
@@ -194302,15 +194789,15 @@ var virtualOfficeTools = [
194302
194789
  ];
194303
194790
 
194304
194791
  // src/huly/operations/workspace.ts
194305
- var import_core98 = __toESM(require_lib5(), 1);
194792
+ var import_core99 = __toESM(require_lib5(), 1);
194306
194793
  var accountRoleMap = {
194307
- READONLYGUEST: import_core98.AccountRole.ReadOnlyGuest,
194308
- DocGuest: import_core98.AccountRole.DocGuest,
194309
- GUEST: import_core98.AccountRole.Guest,
194310
- USER: import_core98.AccountRole.User,
194311
- MAINTAINER: import_core98.AccountRole.Maintainer,
194312
- OWNER: import_core98.AccountRole.Owner,
194313
- ADMIN: import_core98.AccountRole.Admin
194794
+ READONLYGUEST: import_core99.AccountRole.ReadOnlyGuest,
194795
+ DocGuest: import_core99.AccountRole.DocGuest,
194796
+ GUEST: import_core99.AccountRole.Guest,
194797
+ USER: import_core99.AccountRole.User,
194798
+ MAINTAINER: import_core99.AccountRole.Maintainer,
194799
+ OWNER: import_core99.AccountRole.Owner,
194800
+ ADMIN: import_core99.AccountRole.Admin
194314
194801
  };
194315
194802
  var exactAccountRoleMapping = (value3) => value3;
194316
194803
  exactAccountRoleMapping(true);
@@ -195292,7 +195779,7 @@ var CATEGORY_DESCRIPTIONS = new Map([
195292
195779
  "cards",
195293
195780
  "Generic cards, card spaces, card relations, master tags, comments, and read-only version history."
195294
195781
  ),
195295
- categoryDescriptionEntry("leads", "CRM funnels and leads discovery."),
195782
+ categoryDescriptionEntry("leads", "CRM funnel discovery and native lead creation and retrieval."),
195296
195783
  categoryDescriptionEntry(
195297
195784
  "recruiting",
195298
195785
  "Recruiting vacancies, applicants, reviews, opinions, candidate skills, and recruiting media."
@@ -195359,12 +195846,16 @@ var tokenHitCount = (tokens, text4) => {
195359
195846
  const lower = text4.toLowerCase();
195360
195847
  return tokens.filter((token) => lower.includes(token)).length;
195361
195848
  };
195849
+ var EXACT_NAME_SCORE = 1e4;
195850
+ var NAME_TOKEN_WEIGHT = 1e3;
195851
+ var CATEGORY_TOKEN_WEIGHT = 100;
195852
+ var DESCRIPTION_TOKEN_WEIGHT = 10;
195362
195853
  var toolScore = (tool, tokens, normalizedQuery) => {
195363
195854
  const params3 = toolParamSummary(tool);
195364
195855
  const paramText = [...params3.requiredParams, ...params3.optionalParams].join(" ");
195365
195856
  const categoryText = `${tool.category} ${categoryDescription(tool.category)}`;
195366
- const exactScore = tool.name.toLowerCase() === normalizedQuery ? 1e4 : 0;
195367
- return exactScore + tokenHitCount(tokens, tool.name) * 1e3 + tokenHitCount(tokens, categoryText) * 100 + tokenHitCount(tokens, tool.description) * 10 + tokenHitCount(tokens, paramText);
195857
+ const exactScore = tool.name.toLowerCase() === normalizedQuery ? EXACT_NAME_SCORE : 0;
195858
+ return exactScore + tokenHitCount(tokens, tool.name) * NAME_TOKEN_WEIGHT + tokenHitCount(tokens, categoryText) * CATEGORY_TOKEN_WEIGHT + tokenHitCount(tokens, tool.description) * DESCRIPTION_TOKEN_WEIGHT + tokenHitCount(tokens, paramText);
195368
195859
  };
195369
195860
  var searchToolDefinitions = (registry2, query, limit = SEARCH_DEFAULT_LIMIT_VALUE) => {
195370
195861
  const normalizedQuery = query.trim().toLowerCase();
@@ -200038,6 +200529,11 @@ var PostHog = class extends PostHogBackendClient {
200038
200529
  }
200039
200530
  };
200040
200531
 
200532
+ // src/utils/stderr.ts
200533
+ var writeStderrLine = (message) => {
200534
+ process.stderr.write(message.replace(/\n?$/, "\n"));
200535
+ };
200536
+
200041
200537
  // src/telemetry/posthog.ts
200042
200538
  var POSTHOG_API_KEY = "phc_TGfFqCGdnF0p68wuFzd5WSw1IsBvOJW0YgoMJDyZPjm";
200043
200539
  var SHUTDOWN_TIMEOUT_MS = 2e3;
@@ -200045,7 +200541,7 @@ var defaultDependencies = {
200045
200541
  createClient: () => new PostHog(POSTHOG_API_KEY, { host: "https://us.i.posthog.com", flushAt: 10, flushInterval: 6e4 }),
200046
200542
  createSessionId: () => crypto.randomUUID(),
200047
200543
  writeDebug: (message) => {
200048
- console.error(message);
200544
+ writeStderrLine(message);
200049
200545
  }
200050
200546
  };
200051
200547
  var createPostHogTelemetry = (debug, dependencies = defaultDependencies, context9 = mcpTelemetryContext) => {
@@ -200160,7 +200656,7 @@ var McpServerError = class extends Schema_exports.TaggedError()("McpServerError"
200160
200656
  }) {
200161
200657
  };
200162
200658
  var defaultWriteError = (message) => {
200163
- console.error(message);
200659
+ writeStderrLine(message);
200164
200660
  };
200165
200661
  var parseToolExposureConfigEffect = (env2) => {
200166
200662
  const parsed = parseToolExposureConfig(env2);
@@ -200259,7 +200755,16 @@ var McpServerService = class _McpServerService extends Context_exports.Tag("@hul
200259
200755
  });
200260
200756
  yield* Effect_exports.raceFirst(
200261
200757
  Effect_exports.async((resume2) => {
200758
+ const removeListeners = () => {
200759
+ process.off("SIGINT", cleanup);
200760
+ process.off("SIGTERM", cleanup);
200761
+ if (config3.autoExit) {
200762
+ process.stdin.off("end", cleanup);
200763
+ process.stdin.off("close", cleanup);
200764
+ }
200765
+ };
200262
200766
  const cleanup = () => {
200767
+ removeListeners();
200263
200768
  resume2(Effect_exports.void);
200264
200769
  };
200265
200770
  process.on("SIGINT", cleanup);
@@ -200268,14 +200773,7 @@ var McpServerService = class _McpServerService extends Context_exports.Tag("@hul
200268
200773
  process.stdin.on("end", cleanup);
200269
200774
  process.stdin.on("close", cleanup);
200270
200775
  }
200271
- return Effect_exports.sync(() => {
200272
- process.off("SIGINT", cleanup);
200273
- process.off("SIGTERM", cleanup);
200274
- if (config3.autoExit) {
200275
- process.stdin.off("end", cleanup);
200276
- process.stdin.off("close", cleanup);
200277
- }
200278
- });
200776
+ return Effect_exports.sync(removeListeners);
200279
200777
  }),
200280
200778
  Deferred_exports.await(control.shutdown)
200281
200779
  );