@firfi/huly-mcp 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -285,6 +285,7 @@ MCP_TRANSPORT=http MCP_HTTP_PORT=8080 MCP_HTTP_HOST=0.0.0.0 npx -y @firfi/huly-m
285
285
  | `update_channel_message` | Update a channel message. Only the body can be modified. |
286
286
  | `delete_channel_message` | Permanently delete a channel message. This action cannot be undone. |
287
287
  | `list_direct_messages` | List direct message conversations in Huly. Returns conversations sorted by date (newest first). |
288
+ | `create_direct_message` | Open a one-to-one direct-message conversation with a workspace member. The `person` argument accepts an email or exact display name (e.g. `Smith,Bill`). Idempotent: if a DM with that participant already exists, returns it (`created: false`); otherwise creates a new DM (`created: true`). The returned `id` can be passed as `dm` to send_dm_message, list_dm_messages, etc. |
288
289
  | `list_dm_messages` | List messages in a direct-message conversation, newest first. The `dm` argument accepts either the DM `_id` or a participant display name (e.g. `Kerr,Shannon`); a name resolves only to a one-to-one DM with the authenticated account. |
289
290
  | `send_dm_message` | Send a message to a direct-message conversation. The `dm` argument accepts either the DM `_id` or a participant display name; a name resolves only to a one-to-one DM with the authenticated account. Message body supports markdown formatting. |
290
291
  | `update_dm_message` | Update a direct-message message. The `dm` argument accepts either the DM `_id` or a participant display name; a name resolves only to a one-to-one DM with the authenticated account. Only the body can be modified. |
package/dist/index.cjs CHANGED
@@ -150748,6 +150748,7 @@ var MasterTagNotFoundError = class extends Schema_exports.TaggedError()(
150748
150748
  };
150749
150749
 
150750
150750
  // src/huly/errors-contacts.ts
150751
+ var MIN_AMBIGUOUS_PERSON_MATCHES = 2;
150751
150752
  var PersonNotFoundError = class extends Schema_exports.TaggedError()(
150752
150753
  "PersonNotFoundError",
150753
150754
  {
@@ -150758,6 +150759,17 @@ var PersonNotFoundError = class extends Schema_exports.TaggedError()(
150758
150759
  return `Person '${this.identifier}' not found`;
150759
150760
  }
150760
150761
  };
150762
+ var PersonIdentifierAmbiguousError = class extends Schema_exports.TaggedError()(
150763
+ "PersonIdentifierAmbiguousError",
150764
+ {
150765
+ identifier: Schema_exports.String,
150766
+ matches: Schema_exports.Number.pipe(Schema_exports.int(), Schema_exports.greaterThanOrEqualTo(MIN_AMBIGUOUS_PERSON_MATCHES))
150767
+ }
150768
+ ) {
150769
+ get message() {
150770
+ return `Person identifier '${this.identifier}' matched ${this.matches} people; use an exact email address instead`;
150771
+ }
150772
+ };
150761
150773
  var OrganizationNotFoundError = class extends Schema_exports.TaggedError()(
150762
150774
  "OrganizationNotFoundError",
150763
150775
  {
@@ -151147,6 +151159,26 @@ var DirectMessageIdentifierAmbiguousError = class extends Schema_exports.TaggedE
151147
151159
  return `Direct message '${this.identifier}' is ambiguous (${this.matches} matches); use the DM _id`;
151148
151160
  }
151149
151161
  };
151162
+ var CannotDirectMessageSelfError = class extends Schema_exports.TaggedError()(
151163
+ "CannotDirectMessageSelfError",
151164
+ {
151165
+ identifier: Schema_exports.String
151166
+ }
151167
+ ) {
151168
+ get message() {
151169
+ return `Cannot start a direct-message conversation with yourself ('${this.identifier}')`;
151170
+ }
151171
+ };
151172
+ var PersonNotAnEmployeeError = class extends Schema_exports.TaggedError()(
151173
+ "PersonNotAnEmployeeError",
151174
+ {
151175
+ identifier: Schema_exports.String
151176
+ }
151177
+ ) {
151178
+ get message() {
151179
+ return `Person '${this.identifier}' is not a workspace member (no Huly account) and cannot receive direct messages`;
151180
+ }
151181
+ };
151150
151182
  var MessageNotFoundError = class extends Schema_exports.TaggedError()(
151151
151183
  "MessageNotFoundError",
151152
151184
  {
@@ -151395,6 +151427,7 @@ var HulyDomainError = Schema_exports.Union(
151395
151427
  IssueNotFoundError,
151396
151428
  ProjectNotFoundError,
151397
151429
  InvalidStatusError,
151430
+ PersonIdentifierAmbiguousError,
151398
151431
  PersonNotFoundError,
151399
151432
  OrganizationNotFoundError,
151400
151433
  OrganizationIdentifierAmbiguousError,
@@ -151411,9 +151444,11 @@ var HulyDomainError = Schema_exports.Union(
151411
151444
  CommentNotFoundError,
151412
151445
  MilestoneNotFoundError,
151413
151446
  ChannelNotFoundError,
151447
+ CannotDirectMessageSelfError,
151414
151448
  DirectMessageIdentifierAmbiguousError,
151415
151449
  DirectMessageNotFoundError,
151416
151450
  MessageNotFoundError,
151451
+ PersonNotAnEmployeeError,
151417
151452
  ThreadReplyNotFoundError,
151418
151453
  CalendarNotAccessibleError,
151419
151454
  EventNotFoundError,
@@ -171366,7 +171401,7 @@ var PostHog = class extends PostHogBackendClient {
171366
171401
  };
171367
171402
 
171368
171403
  // src/version.ts
171369
- var VERSION = true ? "0.11.0" : "0.0.0-dev";
171404
+ var VERSION = true ? "0.12.0" : "0.0.0-dev";
171370
171405
 
171371
171406
  // src/telemetry/posthog.ts
171372
171407
  var POSTHOG_API_KEY = "phc_TGfFqCGdnF0p68wuFzd5WSw1IsBvOJW0YgoMJDyZPjm";
@@ -171494,6 +171529,7 @@ var INVALID_PARAMS_TAGS = /* @__PURE__ */ new Set([
171494
171529
  "IssueNotFoundError",
171495
171530
  "ProjectNotFoundError",
171496
171531
  "InvalidStatusError",
171532
+ "PersonIdentifierAmbiguousError",
171497
171533
  "PersonNotFoundError",
171498
171534
  "OrganizationNotFoundError",
171499
171535
  "OrganizationIdentifierAmbiguousError",
@@ -171510,6 +171546,8 @@ var INVALID_PARAMS_TAGS = /* @__PURE__ */ new Set([
171510
171546
  "ChannelNotFoundError",
171511
171547
  "DirectMessageIdentifierAmbiguousError",
171512
171548
  "DirectMessageNotFoundError",
171549
+ "CannotDirectMessageSelfError",
171550
+ "PersonNotAnEmployeeError",
171513
171551
  "MessageNotFoundError",
171514
171552
  "ThreadReplyNotFoundError",
171515
171553
  "CalendarNotAccessibleError",
@@ -176681,14 +176719,24 @@ var DeleteDmMessageParamsSchema = Schema_exports.Struct({
176681
176719
  title: "DeleteDmMessageParams",
176682
176720
  description: "Parameters for deleting a direct-message message"
176683
176721
  });
176722
+ var CreateDirectMessageParamsSchema = Schema_exports.Struct({
176723
+ person: PersonRefInput.annotations({
176724
+ description: "Participant to open a one-to-one DM with: email address or exact display name (e.g. `Smith,Bill`). Resolved via the Employee mixin to a Huly account."
176725
+ })
176726
+ }).annotations({
176727
+ title: "CreateDirectMessageParams",
176728
+ description: "Parameters for opening a one-to-one direct-message conversation with another workspace member. If a one-to-one DM with that participant already exists, it is returned unchanged."
176729
+ });
176684
176730
  var listDmMessagesParamsJsonSchema = JSONSchema_exports.make(ListDmMessagesParamsSchema);
176685
176731
  var sendDmMessageParamsJsonSchema = JSONSchema_exports.make(SendDmMessageParamsSchema);
176686
176732
  var updateDmMessageParamsJsonSchema = JSONSchema_exports.make(UpdateDmMessageParamsSchema);
176687
176733
  var deleteDmMessageParamsJsonSchema = JSONSchema_exports.make(DeleteDmMessageParamsSchema);
176734
+ var createDirectMessageParamsJsonSchema = JSONSchema_exports.make(CreateDirectMessageParamsSchema);
176688
176735
  var parseListDmMessagesParams = Schema_exports.decodeUnknown(ListDmMessagesParamsSchema);
176689
176736
  var parseSendDmMessageParams = Schema_exports.decodeUnknown(SendDmMessageParamsSchema);
176690
176737
  var parseUpdateDmMessageParams = Schema_exports.decodeUnknown(UpdateDmMessageParamsSchema);
176691
176738
  var parseDeleteDmMessageParams = Schema_exports.decodeUnknown(DeleteDmMessageParamsSchema);
176739
+ var parseCreateDirectMessageParams = Schema_exports.decodeUnknown(CreateDirectMessageParamsSchema);
176692
176740
 
176693
176741
  // src/domain/schemas/time.ts
176694
176742
  var LogTimeParamsSchema = Schema_exports.Struct({
@@ -178202,8 +178250,165 @@ var cardTools = [
178202
178250
  ];
178203
178251
 
178204
178252
  // src/huly/operations/direct-messages.ts
178253
+ var import_core28 = __toESM(require_lib4(), 1);
178254
+
178255
+ // src/huly/operations/contacts-shared.ts
178205
178256
  var import_core27 = __toESM(require_lib4(), 1);
178206
- var ONE_TO_ONE_DM_MEMBER_COUNT = 2;
178257
+ var isEmailIdentifier = Schema_exports.is(Email);
178258
+ var findPersonById = (client, personId) => client.findOne(
178259
+ contact.class.Person,
178260
+ { _id: toRef(personId) }
178261
+ );
178262
+ var findPersonByEmail = (client, email3) => Effect_exports.gen(function* () {
178263
+ const channels = yield* client.findAll(
178264
+ contact.class.Channel,
178265
+ {
178266
+ value: email3,
178267
+ provider: contact.channelProvider.Email
178268
+ }
178269
+ );
178270
+ if (channels.length === 0) {
178271
+ return void 0;
178272
+ }
178273
+ const channel = channels[0];
178274
+ return yield* client.findOne(
178275
+ contact.class.Person,
178276
+ { _id: toRef(channel.attachedTo) }
178277
+ );
178278
+ });
178279
+ var batchGetEmailsForPersons = (client, personIds) => Effect_exports.gen(function* () {
178280
+ if (personIds.length === 0) {
178281
+ return /* @__PURE__ */ new Map();
178282
+ }
178283
+ const channels = yield* client.findAll(
178284
+ contact.class.Channel,
178285
+ {
178286
+ attachedTo: { $in: personIds },
178287
+ provider: contact.channelProvider.Email
178288
+ }
178289
+ );
178290
+ const emailMap = /* @__PURE__ */ new Map();
178291
+ for (const channel of channels) {
178292
+ if (!emailMap.has(channel.attachedTo)) {
178293
+ emailMap.set(channel.attachedTo, channel.value);
178294
+ }
178295
+ }
178296
+ return emailMap;
178297
+ });
178298
+ var findPersonBySocialIdentityEmail = (client, email3) => Effect_exports.gen(function* () {
178299
+ const identity5 = yield* client.findOne(
178300
+ contact.class.SocialIdentity,
178301
+ {
178302
+ type: import_core27.SocialIdType.EMAIL,
178303
+ value: email3
178304
+ }
178305
+ );
178306
+ if (identity5 === void 0) return void 0;
178307
+ return yield* client.findOne(
178308
+ contact.class.Person,
178309
+ { _id: identity5.attachedTo }
178310
+ );
178311
+ });
178312
+ var findPersonByExactEmail = (client, email3) => Effect_exports.gen(function* () {
178313
+ const socialIdentities = yield* client.findAll(
178314
+ contact.class.SocialIdentity,
178315
+ {
178316
+ type: import_core27.SocialIdType.EMAIL,
178317
+ value: email3
178318
+ }
178319
+ );
178320
+ const channels = yield* client.findAll(
178321
+ contact.class.Channel,
178322
+ {
178323
+ value: email3,
178324
+ provider: contact.channelProvider.Email
178325
+ }
178326
+ );
178327
+ const personIds = [
178328
+ .../* @__PURE__ */ new Set([
178329
+ ...socialIdentities.map((identity5) => identity5.attachedTo),
178330
+ ...channels.map((channel) => channel.attachedTo)
178331
+ ])
178332
+ ];
178333
+ if (personIds.length === 0) {
178334
+ return void 0;
178335
+ }
178336
+ const persons = yield* client.findAll(
178337
+ contact.class.Person,
178338
+ { _id: { $in: personIds.map(toRef) } }
178339
+ );
178340
+ if (persons.length === 0) {
178341
+ return void 0;
178342
+ }
178343
+ if (persons.length > 1) {
178344
+ return yield* new PersonIdentifierAmbiguousError({ identifier: email3, matches: persons.length });
178345
+ }
178346
+ return persons[0];
178347
+ });
178348
+ var findPersonByExactName = (client, name) => Effect_exports.gen(function* () {
178349
+ const persons = yield* client.findAll(
178350
+ contact.class.Person,
178351
+ { name }
178352
+ );
178353
+ if (persons.length === 0) {
178354
+ return void 0;
178355
+ }
178356
+ if (persons.length > 1) {
178357
+ return yield* new PersonIdentifierAmbiguousError({ identifier: name, matches: persons.length });
178358
+ }
178359
+ return persons[0];
178360
+ });
178361
+ var findPersonByExactEmailOrName = (client, identifier2) => isEmailIdentifier(identifier2) ? findPersonByExactEmail(client, identifier2) : findPersonByExactName(client, identifier2);
178362
+ var findPersonByEmailOrName = (client, emailOrName) => Effect_exports.gen(function* () {
178363
+ const socialIdentityPerson = yield* findPersonBySocialIdentityEmail(client, emailOrName);
178364
+ if (socialIdentityPerson !== void 0) return socialIdentityPerson;
178365
+ const exactChannel = yield* client.findOne(
178366
+ contact.class.Channel,
178367
+ {
178368
+ value: emailOrName,
178369
+ provider: contact.channelProvider.Email
178370
+ }
178371
+ );
178372
+ if (exactChannel !== void 0) {
178373
+ const person = yield* client.findOne(
178374
+ contact.class.Person,
178375
+ { _id: toRef(exactChannel.attachedTo) }
178376
+ );
178377
+ if (person !== void 0) return person;
178378
+ }
178379
+ const exactPerson = yield* client.findOne(
178380
+ contact.class.Person,
178381
+ { name: emailOrName }
178382
+ );
178383
+ if (exactPerson !== void 0) return exactPerson;
178384
+ const escaped = escapeLikeWildcards(emailOrName);
178385
+ const likeChannel = yield* client.findOne(
178386
+ contact.class.Channel,
178387
+ {
178388
+ value: { $like: `%${escaped}%` },
178389
+ provider: contact.channelProvider.Email
178390
+ }
178391
+ );
178392
+ if (likeChannel !== void 0) {
178393
+ const person = yield* client.findOne(
178394
+ contact.class.Person,
178395
+ { _id: toRef(likeChannel.attachedTo) }
178396
+ );
178397
+ if (person !== void 0) return person;
178398
+ }
178399
+ const likePerson = yield* client.findOne(
178400
+ contact.class.Person,
178401
+ { name: { $like: `%${escaped}%` } }
178402
+ );
178403
+ return likePerson;
178404
+ });
178405
+
178406
+ // src/huly/operations/direct-messages.ts
178407
+ var sortedMemberPair = (first2, second) => [first2, second].sort();
178408
+ var hasExactMembers = (dm, sortedMembers) => {
178409
+ const dmMembers = [...dm.members].sort();
178410
+ return dmMembers.length === sortedMembers.length && sortedMembers.every((member, index) => dmMembers[index] === member);
178411
+ };
178207
178412
  var findDirectMessage = (identifier2) => Effect_exports.gen(function* () {
178208
178413
  const client = yield* HulyClient;
178209
178414
  const byId = yield* client.findOne(
@@ -178233,9 +178438,8 @@ var findDirectMessage = (identifier2) => Effect_exports.gen(function* () {
178233
178438
  chunter.class.DirectMessage,
178234
178439
  { members: accountUuid }
178235
178440
  );
178236
- const matches = directMessages.filter(
178237
- (dm) => dm.members.length === ONE_TO_ONE_DM_MEMBER_COUNT && dm.members.includes(accountUuid) && accountUuids.some((candidate) => dm.members.includes(candidate))
178238
- );
178441
+ const memberPairs = accountUuids.map((candidate) => sortedMemberPair(accountUuid, candidate));
178442
+ const matches = directMessages.filter((dm) => memberPairs.some((members) => hasExactMembers(dm, members)));
178239
178443
  if (matches.length === 0) {
178240
178444
  return yield* new DirectMessageNotFoundError({ identifier: identifier2 });
178241
178445
  }
@@ -178270,7 +178474,7 @@ var listDirectMessageMessages = (params) => Effect_exports.gen(function* () {
178270
178474
  { space: dm._id },
178271
178475
  {
178272
178476
  limit,
178273
- sort: { createdOn: import_core27.SortingOrder.Descending }
178477
+ sort: { createdOn: import_core28.SortingOrder.Descending }
178274
178478
  }
178275
178479
  );
178276
178480
  const total = messages.total;
@@ -178296,7 +178500,7 @@ var listDirectMessageMessages = (params) => Effect_exports.gen(function* () {
178296
178500
  var sendDirectMessage = (params) => Effect_exports.gen(function* () {
178297
178501
  const { client, dm } = yield* findDirectMessage(params.dm);
178298
178502
  const markupUrlConfig = client.markupUrlConfig;
178299
- const messageId = (0, import_core27.generateId)();
178503
+ const messageId = (0, import_core28.generateId)();
178300
178504
  const markup = markdownToMarkupString(params.body, markupUrlConfig);
178301
178505
  const messageData = {
178302
178506
  message: markup,
@@ -178339,9 +178543,56 @@ var deleteDirectMessage = (params) => Effect_exports.gen(function* () {
178339
178543
  );
178340
178544
  return { id: MessageId.make(message._id), deleted: true };
178341
178545
  });
178546
+ var resolveEmployeeAccount = (identifier2) => Effect_exports.gen(function* () {
178547
+ const client = yield* HulyClient;
178548
+ const person = yield* findPersonByExactEmailOrName(client, identifier2);
178549
+ if (person === void 0) {
178550
+ return yield* new PersonNotFoundError({ identifier: identifier2 });
178551
+ }
178552
+ const employee = yield* client.findOne(
178553
+ contact.mixin.Employee,
178554
+ { _id: toRef(person._id) }
178555
+ );
178556
+ if (employee?.personUuid === void 0) {
178557
+ return yield* new PersonNotAnEmployeeError({ identifier: identifier2 });
178558
+ }
178559
+ return employee.personUuid;
178560
+ });
178561
+ var createDirectMessage = (params) => Effect_exports.gen(function* () {
178562
+ const client = yield* HulyClient;
178563
+ const me = client.getAccountUuid();
178564
+ const other = yield* resolveEmployeeAccount(params.person);
178565
+ if (other === me) {
178566
+ return yield* new CannotDirectMessageSelfError({ identifier: params.person });
178567
+ }
178568
+ const existingDms = yield* client.findAll(
178569
+ chunter.class.DirectMessage,
178570
+ { members: me }
178571
+ );
178572
+ const members = sortedMemberPair(me, other);
178573
+ const existing = existingDms.find((dm) => hasExactMembers(dm, members));
178574
+ if (existing !== void 0) {
178575
+ return { id: ChannelId.make(existing._id), created: false };
178576
+ }
178577
+ const dmId = (0, import_core28.generateId)();
178578
+ const dmData = {
178579
+ name: "",
178580
+ description: "",
178581
+ private: true,
178582
+ archived: false,
178583
+ members
178584
+ };
178585
+ yield* client.createDoc(
178586
+ chunter.class.DirectMessage,
178587
+ toRef(core.space.Space),
178588
+ dmData,
178589
+ dmId
178590
+ );
178591
+ return { id: ChannelId.make(dmId), created: true };
178592
+ });
178342
178593
 
178343
178594
  // src/huly/operations/threads.ts
178344
- var import_core28 = __toESM(require_lib4(), 1);
178595
+ var import_core29 = __toESM(require_lib4(), 1);
178345
178596
  var findReply = (client, channel, message, replyId) => Effect_exports.gen(function* () {
178346
178597
  const reply = yield* client.findOne(
178347
178598
  chunter.class.ThreadMessage,
@@ -178372,7 +178623,7 @@ var listThreadReplies = (params) => Effect_exports.gen(function* () {
178372
178623
  {
178373
178624
  limit,
178374
178625
  sort: {
178375
- createdOn: import_core28.SortingOrder.Ascending
178626
+ createdOn: import_core29.SortingOrder.Ascending
178376
178627
  }
178377
178628
  }
178378
178629
  );
@@ -178400,7 +178651,7 @@ var listThreadReplies = (params) => Effect_exports.gen(function* () {
178400
178651
  var addThreadReply = (params) => Effect_exports.gen(function* () {
178401
178652
  const { channel, client, message } = yield* findChannelMessage(params);
178402
178653
  const markupUrlConfig = client.markupUrlConfig;
178403
- const replyId = (0, import_core28.generateId)();
178654
+ const replyId = (0, import_core29.generateId)();
178404
178655
  const markup = markdownToMarkupString(params.body, markupUrlConfig);
178405
178656
  const replyData = {
178406
178657
  message: markup,
@@ -178565,6 +178816,17 @@ var channelTools = [
178565
178816
  listDirectMessages
178566
178817
  )
178567
178818
  },
178819
+ {
178820
+ name: "create_direct_message",
178821
+ description: "Open a one-to-one direct-message conversation with a workspace member. The `person` argument accepts an email or exact display name (e.g. `Smith,Bill`). Idempotent: if a DM with that participant already exists, returns it (`created: false`); otherwise creates a new DM (`created: true`). The returned `id` can be passed as `dm` to send_dm_message, list_dm_messages, etc.",
178822
+ category: CATEGORY5,
178823
+ inputSchema: createDirectMessageParamsJsonSchema,
178824
+ handler: createToolHandler(
178825
+ "create_direct_message",
178826
+ parseCreateDirectMessageParams,
178827
+ createDirectMessage
178828
+ )
178829
+ },
178568
178830
  {
178569
178831
  name: "list_dm_messages",
178570
178832
  description: "List messages in a direct-message conversation, newest first. The `dm` argument accepts either the DM `_id` or a participant display name (e.g. `Kerr,Shannon`); a name resolves only to a one-to-one DM with the authenticated account.",
@@ -178656,7 +178918,7 @@ var channelTools = [
178656
178918
  ];
178657
178919
 
178658
178920
  // src/huly/operations/comments.ts
178659
- var import_core29 = __toESM(require_lib4(), 1);
178921
+ var import_core30 = __toESM(require_lib4(), 1);
178660
178922
  var findProjectAndIssue2 = (params) => findProjectAndIssue({ project: params.project, identifier: params.issueIdentifier });
178661
178923
  var findComment = (params) => Effect_exports.gen(function* () {
178662
178924
  const { client, issue: issue2, project: project3 } = yield* findProjectAndIssue2({
@@ -178695,7 +178957,7 @@ var listComments = (params) => Effect_exports.gen(function* () {
178695
178957
  {
178696
178958
  limit,
178697
178959
  sort: {
178698
- createdOn: import_core29.SortingOrder.Ascending
178960
+ createdOn: import_core30.SortingOrder.Ascending
178699
178961
  }
178700
178962
  }
178701
178963
  );
@@ -178724,7 +178986,7 @@ var addComment = (params) => Effect_exports.gen(function* () {
178724
178986
  issueIdentifier: params.issueIdentifier
178725
178987
  });
178726
178988
  const markupUrlConfig = client.markupUrlConfig;
178727
- const commentId = (0, import_core29.generateId)();
178989
+ const commentId = (0, import_core30.generateId)();
178728
178990
  const commentData = {
178729
178991
  message: markdownToMarkupString(params.body, markupUrlConfig)
178730
178992
  };
@@ -178850,106 +179112,6 @@ var leadClassIds = {
178850
179112
  }
178851
179113
  };
178852
179114
 
178853
- // src/huly/operations/contacts-shared.ts
178854
- var import_core30 = __toESM(require_lib4(), 1);
178855
- var findPersonById = (client, personId) => client.findOne(
178856
- contact.class.Person,
178857
- { _id: toRef(personId) }
178858
- );
178859
- var findPersonByEmail = (client, email3) => Effect_exports.gen(function* () {
178860
- const channels = yield* client.findAll(
178861
- contact.class.Channel,
178862
- {
178863
- value: email3,
178864
- provider: contact.channelProvider.Email
178865
- }
178866
- );
178867
- if (channels.length === 0) {
178868
- return void 0;
178869
- }
178870
- const channel = channels[0];
178871
- return yield* client.findOne(
178872
- contact.class.Person,
178873
- { _id: toRef(channel.attachedTo) }
178874
- );
178875
- });
178876
- var batchGetEmailsForPersons = (client, personIds) => Effect_exports.gen(function* () {
178877
- if (personIds.length === 0) {
178878
- return /* @__PURE__ */ new Map();
178879
- }
178880
- const channels = yield* client.findAll(
178881
- contact.class.Channel,
178882
- {
178883
- attachedTo: { $in: personIds },
178884
- provider: contact.channelProvider.Email
178885
- }
178886
- );
178887
- const emailMap = /* @__PURE__ */ new Map();
178888
- for (const channel of channels) {
178889
- if (!emailMap.has(channel.attachedTo)) {
178890
- emailMap.set(channel.attachedTo, channel.value);
178891
- }
178892
- }
178893
- return emailMap;
178894
- });
178895
- var findPersonBySocialIdentityEmail = (client, email3) => Effect_exports.gen(function* () {
178896
- const identity5 = yield* client.findOne(
178897
- contact.class.SocialIdentity,
178898
- {
178899
- type: import_core30.SocialIdType.EMAIL,
178900
- value: email3
178901
- }
178902
- );
178903
- if (identity5 === void 0) return void 0;
178904
- return yield* client.findOne(
178905
- contact.class.Person,
178906
- { _id: identity5.attachedTo }
178907
- );
178908
- });
178909
- var findPersonByEmailOrName = (client, emailOrName) => Effect_exports.gen(function* () {
178910
- const socialIdentityPerson = yield* findPersonBySocialIdentityEmail(client, emailOrName);
178911
- if (socialIdentityPerson !== void 0) return socialIdentityPerson;
178912
- const exactChannel = yield* client.findOne(
178913
- contact.class.Channel,
178914
- {
178915
- value: emailOrName,
178916
- provider: contact.channelProvider.Email
178917
- }
178918
- );
178919
- if (exactChannel !== void 0) {
178920
- const person = yield* client.findOne(
178921
- contact.class.Person,
178922
- { _id: toRef(exactChannel.attachedTo) }
178923
- );
178924
- if (person !== void 0) return person;
178925
- }
178926
- const exactPerson = yield* client.findOne(
178927
- contact.class.Person,
178928
- { name: emailOrName }
178929
- );
178930
- if (exactPerson !== void 0) return exactPerson;
178931
- const escaped = escapeLikeWildcards(emailOrName);
178932
- const likeChannel = yield* client.findOne(
178933
- contact.class.Channel,
178934
- {
178935
- value: { $like: `%${escaped}%` },
178936
- provider: contact.channelProvider.Email
178937
- }
178938
- );
178939
- if (likeChannel !== void 0) {
178940
- const person = yield* client.findOne(
178941
- contact.class.Person,
178942
- { _id: toRef(likeChannel.attachedTo) }
178943
- );
178944
- if (person !== void 0) return person;
178945
- }
178946
- const likePerson = yield* client.findOne(
178947
- contact.class.Person,
178948
- { name: { $like: `%${escaped}%` } }
178949
- );
178950
- return likePerson;
178951
- });
178952
-
178953
179115
  // src/huly/operations/organizations.ts
178954
179116
  var findOrganizationByIdentifier = (client, identifier2) => Effect_exports.gen(function* () {
178955
179117
  const byId = yield* client.findOne(
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@firfi/huly-mcp",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "MCP server for Huly integration",
5
5
  "mcpName": "io.github.dearlordylord/huly-mcp",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",
8
8
  "files": [
9
- "dist"
9
+ "dist/index.cjs"
10
10
  ],
11
11
  "publishConfig": {
12
12
  "access": "public"