@firfi/huly-mcp 0.10.3 → 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 +2 -0
- package/dist/index.cjs +453 -149
- package/package.json +2 -2
- package/dist/tsconfig.tsbuildinfo +0 -1
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,
|
|
@@ -151493,6 +151528,31 @@ var HulySdk = class _HulySdk extends Context_exports.Tag("@hulymcp/HulySdk")() {
|
|
|
151493
151528
|
});
|
|
151494
151529
|
};
|
|
151495
151530
|
|
|
151531
|
+
// src/huly/url-builders.ts
|
|
151532
|
+
var testWorkbenchUrlConfig = {
|
|
151533
|
+
baseUrl: UrlString.make("https://test.huly.local"),
|
|
151534
|
+
workspaceUrlSlug: WorkspaceUrlSlug.make("test-workspace")
|
|
151535
|
+
};
|
|
151536
|
+
var slugifyTitle = (title) => {
|
|
151537
|
+
const lowered = title.toLowerCase();
|
|
151538
|
+
const stripped = lowered.replace(/[^a-z0-9.\-\s]/g, "");
|
|
151539
|
+
const hyphenated = stripped.replace(/\s+/g, "-");
|
|
151540
|
+
const collapsed = hyphenated.replace(/-+/g, "-");
|
|
151541
|
+
return collapsed.replace(/^-+|-+$/g, "");
|
|
151542
|
+
};
|
|
151543
|
+
var buildDocumentUrl = (baseUrl, workspaceUrlSlug, title, id) => {
|
|
151544
|
+
const trimmedBase = baseUrl.replace(/\/+$/, "");
|
|
151545
|
+
const slug = slugifyTitle(title);
|
|
151546
|
+
const pathSegment = slug === "" ? id : `${slug}-${id}`;
|
|
151547
|
+
return UrlString.make(`${trimmedBase}/workbench/${workspaceUrlSlug}/document/${pathSegment}`);
|
|
151548
|
+
};
|
|
151549
|
+
var buildDocumentUrlFromConfig = (config3, title, id) => buildDocumentUrl(config3.baseUrl, config3.workspaceUrlSlug, title, id);
|
|
151550
|
+
var buildContactUrl = (baseUrl, workspaceUrlSlug, id) => {
|
|
151551
|
+
const trimmedBase = baseUrl.replace(/\/+$/, "");
|
|
151552
|
+
return UrlString.make(`${trimmedBase}/workbench/${workspaceUrlSlug}/contact/${id}`);
|
|
151553
|
+
};
|
|
151554
|
+
var buildContactUrlFromConfig = (config3, id) => buildContactUrl(config3.baseUrl, config3.workspaceUrlSlug, id);
|
|
151555
|
+
|
|
151496
151556
|
// src/huly/client.ts
|
|
151497
151557
|
var AUTH_STATUS_CODES = /* @__PURE__ */ new Set([
|
|
151498
151558
|
"platform:status:Unauthorized",
|
|
@@ -151581,7 +151641,7 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
|
|
|
151581
151641
|
refUrl: UrlString.make(refUrl),
|
|
151582
151642
|
imageUrl: UrlString.make(imageUrl)
|
|
151583
151643
|
};
|
|
151584
|
-
const
|
|
151644
|
+
const workbenchUrlConfig = {
|
|
151585
151645
|
baseUrl: UrlString.make(config3.url),
|
|
151586
151646
|
workspaceUrlSlug
|
|
151587
151647
|
};
|
|
@@ -151595,7 +151655,7 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
|
|
|
151595
151655
|
const operations = {
|
|
151596
151656
|
getAccountUuid: () => accountUuid,
|
|
151597
151657
|
getPrimarySocialId: () => primarySocialId,
|
|
151598
|
-
|
|
151658
|
+
workbenchUrlConfig,
|
|
151599
151659
|
markupUrlConfig,
|
|
151600
151660
|
findAll: (_class, query, options) => withClient(
|
|
151601
151661
|
(client2) => client2.findAll(_class, query, options),
|
|
@@ -151679,11 +151739,8 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
|
|
|
151679
151739
|
// PersonId is a branded string type with no public constructor
|
|
151680
151740
|
// eslint-disable-next-line no-restricted-syntax -- see above
|
|
151681
151741
|
getPrimarySocialId: () => "test-primary-social-id",
|
|
151682
|
-
documentUrlConfig: {
|
|
151683
|
-
baseUrl: UrlString.make("https://test.huly.local"),
|
|
151684
|
-
workspaceUrlSlug: WorkspaceUrlSlug.make("test-workspace")
|
|
151685
|
-
},
|
|
151686
151742
|
markupUrlConfig: testMarkupUrlConfig,
|
|
151743
|
+
workbenchUrlConfig: testWorkbenchUrlConfig,
|
|
151687
151744
|
findAll: noopFindAll,
|
|
151688
151745
|
findOne: noopFindOne,
|
|
151689
151746
|
createDoc: notImplemented("createDoc"),
|
|
@@ -152010,6 +152067,19 @@ var WorkspaceClient = class _WorkspaceClient extends Context_exports.Tag("@hulym
|
|
|
152010
152067
|
cause: e
|
|
152011
152068
|
})
|
|
152012
152069
|
});
|
|
152070
|
+
const toAccountClientAccessLinkOptions = (options) => {
|
|
152071
|
+
if (options === void 0) return void 0;
|
|
152072
|
+
const result = {
|
|
152073
|
+
...options.firstName !== void 0 ? { firstName: options.firstName } : {},
|
|
152074
|
+
...options.lastName !== void 0 ? { lastName: options.lastName } : {},
|
|
152075
|
+
...options.navigateUrl !== void 0 ? { navigateUrl: options.navigateUrl } : {},
|
|
152076
|
+
...options.spaces !== void 0 ? { spaces: [...options.spaces] } : {},
|
|
152077
|
+
...options.notBefore !== void 0 ? { notBefore: options.notBefore } : {},
|
|
152078
|
+
...options.expiration !== void 0 ? { expiration: options.expiration } : {},
|
|
152079
|
+
...options.personalized !== void 0 ? { personalized: options.personalized } : {}
|
|
152080
|
+
};
|
|
152081
|
+
return result;
|
|
152082
|
+
};
|
|
152013
152083
|
const operations = {
|
|
152014
152084
|
getWorkspaceMembers: () => withClient((c) => c.getWorkspaceMembers(), "Failed to get workspace members"),
|
|
152015
152085
|
getPersonInfo: (account) => withClient((c) => c.getPersonInfo(account), "Failed to get person info"),
|
|
@@ -152020,6 +152090,10 @@ var WorkspaceClient = class _WorkspaceClient extends Context_exports.Tag("@hulym
|
|
|
152020
152090
|
deleteWorkspace: () => withClient((c) => c.deleteWorkspace(), "Failed to delete workspace"),
|
|
152021
152091
|
getUserProfile: (personUuid) => withClient((c) => c.getUserProfile(personUuid), "Failed to get user profile"),
|
|
152022
152092
|
setMyProfile: (profile) => withClient((c) => c.setMyProfile(profile), "Failed to set my profile"),
|
|
152093
|
+
createAccessLink: (role, options) => withClient(
|
|
152094
|
+
(c) => c.createAccessLink(role, toAccountClientAccessLinkOptions(options)),
|
|
152095
|
+
"Failed to create access link"
|
|
152096
|
+
),
|
|
152023
152097
|
updateAllowReadOnlyGuests: (readOnlyGuestsAllowed) => withClient(
|
|
152024
152098
|
(c) => c.updateAllowReadOnlyGuests(readOnlyGuestsAllowed),
|
|
152025
152099
|
"Failed to update read-only guest setting"
|
|
@@ -152043,6 +152117,7 @@ var WorkspaceClient = class _WorkspaceClient extends Context_exports.Tag("@hulym
|
|
|
152043
152117
|
deleteWorkspace: notImplemented("deleteWorkspace"),
|
|
152044
152118
|
getUserProfile: () => Effect_exports.succeed(null),
|
|
152045
152119
|
setMyProfile: notImplemented("setMyProfile"),
|
|
152120
|
+
createAccessLink: notImplemented("createAccessLink"),
|
|
152046
152121
|
updateAllowReadOnlyGuests: notImplemented("updateAllowReadOnlyGuests"),
|
|
152047
152122
|
updateAllowGuestSignUp: notImplemented("updateAllowGuestSignUp"),
|
|
152048
152123
|
getRegionInfo: () => Effect_exports.succeed([])
|
|
@@ -171326,7 +171401,7 @@ var PostHog = class extends PostHogBackendClient {
|
|
|
171326
171401
|
};
|
|
171327
171402
|
|
|
171328
171403
|
// src/version.ts
|
|
171329
|
-
var VERSION = true ? "0.
|
|
171404
|
+
var VERSION = true ? "0.12.0" : "0.0.0-dev";
|
|
171330
171405
|
|
|
171331
171406
|
// src/telemetry/posthog.ts
|
|
171332
171407
|
var POSTHOG_API_KEY = "phc_TGfFqCGdnF0p68wuFzd5WSw1IsBvOJW0YgoMJDyZPjm";
|
|
@@ -171454,6 +171529,7 @@ var INVALID_PARAMS_TAGS = /* @__PURE__ */ new Set([
|
|
|
171454
171529
|
"IssueNotFoundError",
|
|
171455
171530
|
"ProjectNotFoundError",
|
|
171456
171531
|
"InvalidStatusError",
|
|
171532
|
+
"PersonIdentifierAmbiguousError",
|
|
171457
171533
|
"PersonNotFoundError",
|
|
171458
171534
|
"OrganizationNotFoundError",
|
|
171459
171535
|
"OrganizationIdentifierAmbiguousError",
|
|
@@ -171470,6 +171546,8 @@ var INVALID_PARAMS_TAGS = /* @__PURE__ */ new Set([
|
|
|
171470
171546
|
"ChannelNotFoundError",
|
|
171471
171547
|
"DirectMessageIdentifierAmbiguousError",
|
|
171472
171548
|
"DirectMessageNotFoundError",
|
|
171549
|
+
"CannotDirectMessageSelfError",
|
|
171550
|
+
"PersonNotAnEmployeeError",
|
|
171473
171551
|
"MessageNotFoundError",
|
|
171474
171552
|
"ThreadReplyNotFoundError",
|
|
171475
171553
|
"CalendarNotAccessibleError",
|
|
@@ -172303,27 +172381,6 @@ var import_core23 = __toESM(require_lib4(), 1);
|
|
|
172303
172381
|
var import_core22 = __toESM(require_lib4(), 1);
|
|
172304
172382
|
var import_rank = __toESM(require_lib33(), 1);
|
|
172305
172383
|
|
|
172306
|
-
// src/huly/url-builders.ts
|
|
172307
|
-
var slugifyTitle = (title) => {
|
|
172308
|
-
const lowered = title.toLowerCase();
|
|
172309
|
-
const stripped = lowered.replace(/[^a-z0-9.\-\s]/g, "");
|
|
172310
|
-
const hyphenated = stripped.replace(/\s+/g, "-");
|
|
172311
|
-
const collapsed = hyphenated.replace(/-+/g, "-");
|
|
172312
|
-
return collapsed.replace(/^-+|-+$/g, "");
|
|
172313
|
-
};
|
|
172314
|
-
var buildDocumentUrl = (baseUrl, workspaceUrlSlug, title, id) => {
|
|
172315
|
-
const trimmedBase = baseUrl.replace(/\/+$/, "");
|
|
172316
|
-
const slug = slugifyTitle(title);
|
|
172317
|
-
const pathSegment = slug === "" ? id : `${slug}-${id}`;
|
|
172318
|
-
return UrlString.make(`${trimmedBase}/workbench/${workspaceUrlSlug}/document/${pathSegment}`);
|
|
172319
|
-
};
|
|
172320
|
-
var buildDocumentUrlFromConfig = (config3, title, id) => buildDocumentUrl(config3.baseUrl, config3.workspaceUrlSlug, title, id);
|
|
172321
|
-
var buildContactUrl = (baseUrl, workspaceUrlSlug, id) => {
|
|
172322
|
-
const trimmedBase = baseUrl.replace(/\/+$/, "");
|
|
172323
|
-
return UrlString.make(`${trimmedBase}/workbench/${workspaceUrlSlug}/contact/${id}`);
|
|
172324
|
-
};
|
|
172325
|
-
var buildContactUrlFromConfig = (config3, id) => buildContactUrl(config3.baseUrl, config3.workspaceUrlSlug, id);
|
|
172326
|
-
|
|
172327
172384
|
// src/huly/operations/documents-edit.ts
|
|
172328
172385
|
var editDocument = (params) => Effect_exports.gen(function* () {
|
|
172329
172386
|
const { client, doc, teamspace } = yield* findTeamspaceAndDocument(params);
|
|
@@ -172388,7 +172445,7 @@ var editDocument = (params) => Effect_exports.gen(function* () {
|
|
|
172388
172445
|
contentUpdatedInPlace = true;
|
|
172389
172446
|
}
|
|
172390
172447
|
const finalTitle = updateOps.title ?? doc.title;
|
|
172391
|
-
const url4 = buildDocumentUrlFromConfig(client.
|
|
172448
|
+
const url4 = buildDocumentUrlFromConfig(client.workbenchUrlConfig, finalTitle, DocumentId.make(doc._id));
|
|
172392
172449
|
if (Object.keys(updateOps).length === 0 && !contentUpdatedInPlace) {
|
|
172393
172450
|
return { id: DocumentId.make(doc._id), updated: false, url: url4 };
|
|
172394
172451
|
}
|
|
@@ -172985,7 +173042,7 @@ var listDocuments = (params) => Effect_exports.gen(function* () {
|
|
|
172985
173042
|
id: DocumentId.make(doc._id),
|
|
172986
173043
|
title: doc.title,
|
|
172987
173044
|
teamspace: teamspace.name,
|
|
172988
|
-
url: buildDocumentUrlFromConfig(client.
|
|
173045
|
+
url: buildDocumentUrlFromConfig(client.workbenchUrlConfig, doc.title, DocumentId.make(doc._id)),
|
|
172989
173046
|
modifiedOn: doc.modifiedOn
|
|
172990
173047
|
}));
|
|
172991
173048
|
return {
|
|
@@ -173010,7 +173067,7 @@ var getDocument = (params) => Effect_exports.gen(function* () {
|
|
|
173010
173067
|
title: doc.title,
|
|
173011
173068
|
content,
|
|
173012
173069
|
teamspace: teamspace.name,
|
|
173013
|
-
url: buildDocumentUrlFromConfig(client.
|
|
173070
|
+
url: buildDocumentUrlFromConfig(client.workbenchUrlConfig, doc.title, DocumentId.make(doc._id)),
|
|
173014
173071
|
modifiedOn: doc.modifiedOn,
|
|
173015
173072
|
createdOn: doc.createdOn
|
|
173016
173073
|
};
|
|
@@ -173063,7 +173120,7 @@ var createDocument = (params) => Effect_exports.gen(function* () {
|
|
|
173063
173120
|
return {
|
|
173064
173121
|
id: DocumentId.make(documentId),
|
|
173065
173122
|
title: params.title,
|
|
173066
|
-
url: buildDocumentUrlFromConfig(client.
|
|
173123
|
+
url: buildDocumentUrlFromConfig(client.workbenchUrlConfig, params.title, DocumentId.make(documentId))
|
|
173067
173124
|
};
|
|
173068
173125
|
});
|
|
173069
173126
|
var deleteDocument = (params) => Effect_exports.gen(function* () {
|
|
@@ -176662,14 +176719,24 @@ var DeleteDmMessageParamsSchema = Schema_exports.Struct({
|
|
|
176662
176719
|
title: "DeleteDmMessageParams",
|
|
176663
176720
|
description: "Parameters for deleting a direct-message message"
|
|
176664
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
|
+
});
|
|
176665
176730
|
var listDmMessagesParamsJsonSchema = JSONSchema_exports.make(ListDmMessagesParamsSchema);
|
|
176666
176731
|
var sendDmMessageParamsJsonSchema = JSONSchema_exports.make(SendDmMessageParamsSchema);
|
|
176667
176732
|
var updateDmMessageParamsJsonSchema = JSONSchema_exports.make(UpdateDmMessageParamsSchema);
|
|
176668
176733
|
var deleteDmMessageParamsJsonSchema = JSONSchema_exports.make(DeleteDmMessageParamsSchema);
|
|
176734
|
+
var createDirectMessageParamsJsonSchema = JSONSchema_exports.make(CreateDirectMessageParamsSchema);
|
|
176669
176735
|
var parseListDmMessagesParams = Schema_exports.decodeUnknown(ListDmMessagesParamsSchema);
|
|
176670
176736
|
var parseSendDmMessageParams = Schema_exports.decodeUnknown(SendDmMessageParamsSchema);
|
|
176671
176737
|
var parseUpdateDmMessageParams = Schema_exports.decodeUnknown(UpdateDmMessageParamsSchema);
|
|
176672
176738
|
var parseDeleteDmMessageParams = Schema_exports.decodeUnknown(DeleteDmMessageParamsSchema);
|
|
176739
|
+
var parseCreateDirectMessageParams = Schema_exports.decodeUnknown(CreateDirectMessageParamsSchema);
|
|
176673
176740
|
|
|
176674
176741
|
// src/domain/schemas/time.ts
|
|
176675
176742
|
var LogTimeParamsSchema = Schema_exports.Struct({
|
|
@@ -177243,6 +177310,87 @@ var UpdateGuestSettingsParamsSchema = Schema_exports.Struct({
|
|
|
177243
177310
|
title: "UpdateGuestSettingsParams",
|
|
177244
177311
|
description: "Parameters for updating guest settings"
|
|
177245
177312
|
});
|
|
177313
|
+
var MAX_UNIX_SECONDS_TIMESTAMP = 9999999999;
|
|
177314
|
+
var UnixSecondsTimestamp = Schema_exports.Number.pipe(
|
|
177315
|
+
Schema_exports.int(),
|
|
177316
|
+
Schema_exports.nonNegative(),
|
|
177317
|
+
Schema_exports.lessThanOrEqualTo(MAX_UNIX_SECONDS_TIMESTAMP)
|
|
177318
|
+
).annotations({
|
|
177319
|
+
identifier: "UnixSecondsTimestamp",
|
|
177320
|
+
title: "UnixSecondsTimestamp",
|
|
177321
|
+
description: "Unix timestamp in seconds (non-negative integer)"
|
|
177322
|
+
});
|
|
177323
|
+
var AccessLinkCommonParamsSchema = Schema_exports.Struct({
|
|
177324
|
+
role: Schema_exports.optional(
|
|
177325
|
+
AccountRoleSchema.annotations({
|
|
177326
|
+
description: "Workspace role granted by the link. Defaults to GUEST."
|
|
177327
|
+
})
|
|
177328
|
+
),
|
|
177329
|
+
firstName: Schema_exports.optional(
|
|
177330
|
+
NonEmptyString2.annotations({
|
|
177331
|
+
description: "Optional first name for personalized links."
|
|
177332
|
+
})
|
|
177333
|
+
),
|
|
177334
|
+
lastName: Schema_exports.optional(
|
|
177335
|
+
NonEmptyString2.annotations({
|
|
177336
|
+
description: "Optional last name for personalized links."
|
|
177337
|
+
})
|
|
177338
|
+
),
|
|
177339
|
+
navigateUrl: Schema_exports.optional(
|
|
177340
|
+
Schema_exports.String.annotations({
|
|
177341
|
+
description: "Optional URL/path Huly should open after the link is used."
|
|
177342
|
+
})
|
|
177343
|
+
),
|
|
177344
|
+
spaces: Schema_exports.optional(
|
|
177345
|
+
Schema_exports.Array(SpaceId).annotations({
|
|
177346
|
+
description: "Optional Huly space IDs this link should grant access to. Use list_teamspaces, list_card_spaces, or other list tools to discover space IDs."
|
|
177347
|
+
})
|
|
177348
|
+
)
|
|
177349
|
+
});
|
|
177350
|
+
var PersonalizedAccessLinkParamsSchema = Schema_exports.Struct({
|
|
177351
|
+
...AccessLinkCommonParamsSchema.fields,
|
|
177352
|
+
notBefore: Schema_exports.optional(
|
|
177353
|
+
UnixSecondsTimestamp.annotations({
|
|
177354
|
+
description: "Unix timestamp in seconds before which the link is invalid."
|
|
177355
|
+
})
|
|
177356
|
+
),
|
|
177357
|
+
expiration: Schema_exports.optional(
|
|
177358
|
+
UnixSecondsTimestamp.annotations({
|
|
177359
|
+
description: "Unix timestamp in seconds after which the link expires."
|
|
177360
|
+
})
|
|
177361
|
+
),
|
|
177362
|
+
personalized: Schema_exports.optional(
|
|
177363
|
+
Schema_exports.Literal(true).annotations({
|
|
177364
|
+
description: "Whether the link is bound to one person. Defaults to Huly's personalized-link behavior."
|
|
177365
|
+
})
|
|
177366
|
+
)
|
|
177367
|
+
});
|
|
177368
|
+
var AnonymousAccessLinkParamsSchema = Schema_exports.Struct({
|
|
177369
|
+
...AccessLinkCommonParamsSchema.fields,
|
|
177370
|
+
notBefore: UnixSecondsTimestamp.annotations({
|
|
177371
|
+
description: "Unix timestamp in seconds before which a non-personalized link is invalid."
|
|
177372
|
+
}),
|
|
177373
|
+
expiration: UnixSecondsTimestamp.annotations({
|
|
177374
|
+
description: "Unix timestamp in seconds after which the link expires."
|
|
177375
|
+
}),
|
|
177376
|
+
personalized: Schema_exports.Literal(false).annotations({
|
|
177377
|
+
description: "Set false for anonymous reusable guest links. Anonymous links require notBefore and expiration."
|
|
177378
|
+
})
|
|
177379
|
+
});
|
|
177380
|
+
var CreateAccessLinkParamsSchema = Schema_exports.Union(
|
|
177381
|
+
PersonalizedAccessLinkParamsSchema,
|
|
177382
|
+
AnonymousAccessLinkParamsSchema
|
|
177383
|
+
).pipe(
|
|
177384
|
+
Schema_exports.filter((params) => {
|
|
177385
|
+
if (params.notBefore !== void 0 && params.expiration !== void 0 && params.expiration <= params.notBefore) {
|
|
177386
|
+
return "expiration must be greater than notBefore.";
|
|
177387
|
+
}
|
|
177388
|
+
return void 0;
|
|
177389
|
+
})
|
|
177390
|
+
).annotations({
|
|
177391
|
+
title: "CreateAccessLinkParams",
|
|
177392
|
+
description: "Parameters for creating a Huly workspace access link"
|
|
177393
|
+
});
|
|
177246
177394
|
var GetRegionsParamsSchema = EmptyParamsSchema;
|
|
177247
177395
|
var listWorkspaceMembersParamsJsonSchema = JSONSchema_exports.make(ListWorkspaceMembersParamsSchema);
|
|
177248
177396
|
var updateMemberRoleParamsJsonSchema = JSONSchema_exports.make(UpdateMemberRoleParamsSchema);
|
|
@@ -177250,6 +177398,7 @@ var listWorkspacesParamsJsonSchema = JSONSchema_exports.make(ListWorkspacesParam
|
|
|
177250
177398
|
var createWorkspaceParamsJsonSchema = JSONSchema_exports.make(CreateWorkspaceParamsSchema);
|
|
177251
177399
|
var updateUserProfileParamsJsonSchema = JSONSchema_exports.make(UpdateUserProfileParamsSchema);
|
|
177252
177400
|
var updateGuestSettingsParamsJsonSchema = JSONSchema_exports.make(UpdateGuestSettingsParamsSchema);
|
|
177401
|
+
var createAccessLinkParamsJsonSchema = JSONSchema_exports.make(CreateAccessLinkParamsSchema);
|
|
177253
177402
|
var getRegionsParamsJsonSchema = JSONSchema_exports.make(GetRegionsParamsSchema);
|
|
177254
177403
|
var parseListWorkspaceMembersParams = Schema_exports.decodeUnknown(ListWorkspaceMembersParamsSchema);
|
|
177255
177404
|
var parseUpdateMemberRoleParams = Schema_exports.decodeUnknown(UpdateMemberRoleParamsSchema);
|
|
@@ -177257,6 +177406,7 @@ var parseListWorkspacesParams = Schema_exports.decodeUnknown(ListWorkspacesParam
|
|
|
177257
177406
|
var parseCreateWorkspaceParams = Schema_exports.decodeUnknown(CreateWorkspaceParamsSchema);
|
|
177258
177407
|
var parseUpdateUserProfileParams = Schema_exports.decodeUnknown(UpdateUserProfileParamsSchema);
|
|
177259
177408
|
var parseUpdateGuestSettingsParams = Schema_exports.decodeUnknown(UpdateGuestSettingsParamsSchema);
|
|
177409
|
+
var parseCreateAccessLinkParams = Schema_exports.decodeUnknown(CreateAccessLinkParamsSchema);
|
|
177260
177410
|
var parseGetRegionsParams = Schema_exports.decodeUnknown(GetRegionsParamsSchema);
|
|
177261
177411
|
var WorkspaceMemberSchema = Schema_exports.Struct({
|
|
177262
177412
|
personId: PersonUuid,
|
|
@@ -177319,6 +177469,12 @@ var UpdateGuestSettingsResultSchema = Schema_exports.Struct({
|
|
|
177319
177469
|
allowReadOnly: Schema_exports.optional(Schema_exports.Boolean),
|
|
177320
177470
|
allowSignUp: Schema_exports.optional(Schema_exports.Boolean)
|
|
177321
177471
|
});
|
|
177472
|
+
var CreateAccessLinkResultSchema = Schema_exports.Struct({
|
|
177473
|
+
link: UrlString,
|
|
177474
|
+
role: AccountRoleSchema,
|
|
177475
|
+
spaces: Schema_exports.optional(Schema_exports.Array(SpaceId)),
|
|
177476
|
+
personalized: Schema_exports.optional(Schema_exports.Boolean)
|
|
177477
|
+
});
|
|
177322
177478
|
var ListWorkspaceMembersResultSchema = Schema_exports.Array(WorkspaceMemberSchema);
|
|
177323
177479
|
var ListWorkspacesResultSchema = Schema_exports.Array(WorkspaceSummarySchema);
|
|
177324
177480
|
var GetRegionsResultSchema = Schema_exports.Array(RegionInfoSchema);
|
|
@@ -178094,8 +178250,165 @@ var cardTools = [
|
|
|
178094
178250
|
];
|
|
178095
178251
|
|
|
178096
178252
|
// src/huly/operations/direct-messages.ts
|
|
178253
|
+
var import_core28 = __toESM(require_lib4(), 1);
|
|
178254
|
+
|
|
178255
|
+
// src/huly/operations/contacts-shared.ts
|
|
178097
178256
|
var import_core27 = __toESM(require_lib4(), 1);
|
|
178098
|
-
var
|
|
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
|
+
};
|
|
178099
178412
|
var findDirectMessage = (identifier2) => Effect_exports.gen(function* () {
|
|
178100
178413
|
const client = yield* HulyClient;
|
|
178101
178414
|
const byId = yield* client.findOne(
|
|
@@ -178125,9 +178438,8 @@ var findDirectMessage = (identifier2) => Effect_exports.gen(function* () {
|
|
|
178125
178438
|
chunter.class.DirectMessage,
|
|
178126
178439
|
{ members: accountUuid }
|
|
178127
178440
|
);
|
|
178128
|
-
const
|
|
178129
|
-
|
|
178130
|
-
);
|
|
178441
|
+
const memberPairs = accountUuids.map((candidate) => sortedMemberPair(accountUuid, candidate));
|
|
178442
|
+
const matches = directMessages.filter((dm) => memberPairs.some((members) => hasExactMembers(dm, members)));
|
|
178131
178443
|
if (matches.length === 0) {
|
|
178132
178444
|
return yield* new DirectMessageNotFoundError({ identifier: identifier2 });
|
|
178133
178445
|
}
|
|
@@ -178162,7 +178474,7 @@ var listDirectMessageMessages = (params) => Effect_exports.gen(function* () {
|
|
|
178162
178474
|
{ space: dm._id },
|
|
178163
178475
|
{
|
|
178164
178476
|
limit,
|
|
178165
|
-
sort: { createdOn:
|
|
178477
|
+
sort: { createdOn: import_core28.SortingOrder.Descending }
|
|
178166
178478
|
}
|
|
178167
178479
|
);
|
|
178168
178480
|
const total = messages.total;
|
|
@@ -178188,7 +178500,7 @@ var listDirectMessageMessages = (params) => Effect_exports.gen(function* () {
|
|
|
178188
178500
|
var sendDirectMessage = (params) => Effect_exports.gen(function* () {
|
|
178189
178501
|
const { client, dm } = yield* findDirectMessage(params.dm);
|
|
178190
178502
|
const markupUrlConfig = client.markupUrlConfig;
|
|
178191
|
-
const messageId = (0,
|
|
178503
|
+
const messageId = (0, import_core28.generateId)();
|
|
178192
178504
|
const markup = markdownToMarkupString(params.body, markupUrlConfig);
|
|
178193
178505
|
const messageData = {
|
|
178194
178506
|
message: markup,
|
|
@@ -178231,9 +178543,56 @@ var deleteDirectMessage = (params) => Effect_exports.gen(function* () {
|
|
|
178231
178543
|
);
|
|
178232
178544
|
return { id: MessageId.make(message._id), deleted: true };
|
|
178233
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
|
+
});
|
|
178234
178593
|
|
|
178235
178594
|
// src/huly/operations/threads.ts
|
|
178236
|
-
var
|
|
178595
|
+
var import_core29 = __toESM(require_lib4(), 1);
|
|
178237
178596
|
var findReply = (client, channel, message, replyId) => Effect_exports.gen(function* () {
|
|
178238
178597
|
const reply = yield* client.findOne(
|
|
178239
178598
|
chunter.class.ThreadMessage,
|
|
@@ -178264,7 +178623,7 @@ var listThreadReplies = (params) => Effect_exports.gen(function* () {
|
|
|
178264
178623
|
{
|
|
178265
178624
|
limit,
|
|
178266
178625
|
sort: {
|
|
178267
|
-
createdOn:
|
|
178626
|
+
createdOn: import_core29.SortingOrder.Ascending
|
|
178268
178627
|
}
|
|
178269
178628
|
}
|
|
178270
178629
|
);
|
|
@@ -178292,7 +178651,7 @@ var listThreadReplies = (params) => Effect_exports.gen(function* () {
|
|
|
178292
178651
|
var addThreadReply = (params) => Effect_exports.gen(function* () {
|
|
178293
178652
|
const { channel, client, message } = yield* findChannelMessage(params);
|
|
178294
178653
|
const markupUrlConfig = client.markupUrlConfig;
|
|
178295
|
-
const replyId = (0,
|
|
178654
|
+
const replyId = (0, import_core29.generateId)();
|
|
178296
178655
|
const markup = markdownToMarkupString(params.body, markupUrlConfig);
|
|
178297
178656
|
const replyData = {
|
|
178298
178657
|
message: markup,
|
|
@@ -178457,6 +178816,17 @@ var channelTools = [
|
|
|
178457
178816
|
listDirectMessages
|
|
178458
178817
|
)
|
|
178459
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
|
+
},
|
|
178460
178830
|
{
|
|
178461
178831
|
name: "list_dm_messages",
|
|
178462
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.",
|
|
@@ -178548,7 +178918,7 @@ var channelTools = [
|
|
|
178548
178918
|
];
|
|
178549
178919
|
|
|
178550
178920
|
// src/huly/operations/comments.ts
|
|
178551
|
-
var
|
|
178921
|
+
var import_core30 = __toESM(require_lib4(), 1);
|
|
178552
178922
|
var findProjectAndIssue2 = (params) => findProjectAndIssue({ project: params.project, identifier: params.issueIdentifier });
|
|
178553
178923
|
var findComment = (params) => Effect_exports.gen(function* () {
|
|
178554
178924
|
const { client, issue: issue2, project: project3 } = yield* findProjectAndIssue2({
|
|
@@ -178587,7 +178957,7 @@ var listComments = (params) => Effect_exports.gen(function* () {
|
|
|
178587
178957
|
{
|
|
178588
178958
|
limit,
|
|
178589
178959
|
sort: {
|
|
178590
|
-
createdOn:
|
|
178960
|
+
createdOn: import_core30.SortingOrder.Ascending
|
|
178591
178961
|
}
|
|
178592
178962
|
}
|
|
178593
178963
|
);
|
|
@@ -178616,7 +178986,7 @@ var addComment = (params) => Effect_exports.gen(function* () {
|
|
|
178616
178986
|
issueIdentifier: params.issueIdentifier
|
|
178617
178987
|
});
|
|
178618
178988
|
const markupUrlConfig = client.markupUrlConfig;
|
|
178619
|
-
const commentId = (0,
|
|
178989
|
+
const commentId = (0, import_core30.generateId)();
|
|
178620
178990
|
const commentData = {
|
|
178621
178991
|
message: markdownToMarkupString(params.body, markupUrlConfig)
|
|
178622
178992
|
};
|
|
@@ -178742,106 +179112,6 @@ var leadClassIds = {
|
|
|
178742
179112
|
}
|
|
178743
179113
|
};
|
|
178744
179114
|
|
|
178745
|
-
// src/huly/operations/contacts-shared.ts
|
|
178746
|
-
var import_core30 = __toESM(require_lib4(), 1);
|
|
178747
|
-
var findPersonById = (client, personId) => client.findOne(
|
|
178748
|
-
contact.class.Person,
|
|
178749
|
-
{ _id: toRef(personId) }
|
|
178750
|
-
);
|
|
178751
|
-
var findPersonByEmail = (client, email3) => Effect_exports.gen(function* () {
|
|
178752
|
-
const channels = yield* client.findAll(
|
|
178753
|
-
contact.class.Channel,
|
|
178754
|
-
{
|
|
178755
|
-
value: email3,
|
|
178756
|
-
provider: contact.channelProvider.Email
|
|
178757
|
-
}
|
|
178758
|
-
);
|
|
178759
|
-
if (channels.length === 0) {
|
|
178760
|
-
return void 0;
|
|
178761
|
-
}
|
|
178762
|
-
const channel = channels[0];
|
|
178763
|
-
return yield* client.findOne(
|
|
178764
|
-
contact.class.Person,
|
|
178765
|
-
{ _id: toRef(channel.attachedTo) }
|
|
178766
|
-
);
|
|
178767
|
-
});
|
|
178768
|
-
var batchGetEmailsForPersons = (client, personIds) => Effect_exports.gen(function* () {
|
|
178769
|
-
if (personIds.length === 0) {
|
|
178770
|
-
return /* @__PURE__ */ new Map();
|
|
178771
|
-
}
|
|
178772
|
-
const channels = yield* client.findAll(
|
|
178773
|
-
contact.class.Channel,
|
|
178774
|
-
{
|
|
178775
|
-
attachedTo: { $in: personIds },
|
|
178776
|
-
provider: contact.channelProvider.Email
|
|
178777
|
-
}
|
|
178778
|
-
);
|
|
178779
|
-
const emailMap = /* @__PURE__ */ new Map();
|
|
178780
|
-
for (const channel of channels) {
|
|
178781
|
-
if (!emailMap.has(channel.attachedTo)) {
|
|
178782
|
-
emailMap.set(channel.attachedTo, channel.value);
|
|
178783
|
-
}
|
|
178784
|
-
}
|
|
178785
|
-
return emailMap;
|
|
178786
|
-
});
|
|
178787
|
-
var findPersonBySocialIdentityEmail = (client, email3) => Effect_exports.gen(function* () {
|
|
178788
|
-
const identity5 = yield* client.findOne(
|
|
178789
|
-
contact.class.SocialIdentity,
|
|
178790
|
-
{
|
|
178791
|
-
type: import_core30.SocialIdType.EMAIL,
|
|
178792
|
-
value: email3
|
|
178793
|
-
}
|
|
178794
|
-
);
|
|
178795
|
-
if (identity5 === void 0) return void 0;
|
|
178796
|
-
return yield* client.findOne(
|
|
178797
|
-
contact.class.Person,
|
|
178798
|
-
{ _id: identity5.attachedTo }
|
|
178799
|
-
);
|
|
178800
|
-
});
|
|
178801
|
-
var findPersonByEmailOrName = (client, emailOrName) => Effect_exports.gen(function* () {
|
|
178802
|
-
const socialIdentityPerson = yield* findPersonBySocialIdentityEmail(client, emailOrName);
|
|
178803
|
-
if (socialIdentityPerson !== void 0) return socialIdentityPerson;
|
|
178804
|
-
const exactChannel = yield* client.findOne(
|
|
178805
|
-
contact.class.Channel,
|
|
178806
|
-
{
|
|
178807
|
-
value: emailOrName,
|
|
178808
|
-
provider: contact.channelProvider.Email
|
|
178809
|
-
}
|
|
178810
|
-
);
|
|
178811
|
-
if (exactChannel !== void 0) {
|
|
178812
|
-
const person = yield* client.findOne(
|
|
178813
|
-
contact.class.Person,
|
|
178814
|
-
{ _id: toRef(exactChannel.attachedTo) }
|
|
178815
|
-
);
|
|
178816
|
-
if (person !== void 0) return person;
|
|
178817
|
-
}
|
|
178818
|
-
const exactPerson = yield* client.findOne(
|
|
178819
|
-
contact.class.Person,
|
|
178820
|
-
{ name: emailOrName }
|
|
178821
|
-
);
|
|
178822
|
-
if (exactPerson !== void 0) return exactPerson;
|
|
178823
|
-
const escaped = escapeLikeWildcards(emailOrName);
|
|
178824
|
-
const likeChannel = yield* client.findOne(
|
|
178825
|
-
contact.class.Channel,
|
|
178826
|
-
{
|
|
178827
|
-
value: { $like: `%${escaped}%` },
|
|
178828
|
-
provider: contact.channelProvider.Email
|
|
178829
|
-
}
|
|
178830
|
-
);
|
|
178831
|
-
if (likeChannel !== void 0) {
|
|
178832
|
-
const person = yield* client.findOne(
|
|
178833
|
-
contact.class.Person,
|
|
178834
|
-
{ _id: toRef(likeChannel.attachedTo) }
|
|
178835
|
-
);
|
|
178836
|
-
if (person !== void 0) return person;
|
|
178837
|
-
}
|
|
178838
|
-
const likePerson = yield* client.findOne(
|
|
178839
|
-
contact.class.Person,
|
|
178840
|
-
{ name: { $like: `%${escaped}%` } }
|
|
178841
|
-
);
|
|
178842
|
-
return likePerson;
|
|
178843
|
-
});
|
|
178844
|
-
|
|
178845
179115
|
// src/huly/operations/organizations.ts
|
|
178846
179116
|
var findOrganizationByIdentifier = (client, identifier2) => Effect_exports.gen(function* () {
|
|
178847
179117
|
const byId = yield* client.findOne(
|
|
@@ -178900,7 +179170,7 @@ var listOrganizations = (params) => Effect_exports.gen(function* () {
|
|
|
178900
179170
|
name: org.name,
|
|
178901
179171
|
city: org.city,
|
|
178902
179172
|
members: org.members,
|
|
178903
|
-
url: buildContactUrlFromConfig(client.
|
|
179173
|
+
url: buildContactUrlFromConfig(client.workbenchUrlConfig, id),
|
|
178904
179174
|
modifiedOn: org.modifiedOn
|
|
178905
179175
|
};
|
|
178906
179176
|
});
|
|
@@ -178956,7 +179226,7 @@ var getOrganization = (params) => Effect_exports.gen(function* () {
|
|
|
178956
179226
|
city: org.city || void 0,
|
|
178957
179227
|
description: descriptionText,
|
|
178958
179228
|
members: org.members,
|
|
178959
|
-
url: buildContactUrlFromConfig(client.
|
|
179229
|
+
url: buildContactUrlFromConfig(client.workbenchUrlConfig, id),
|
|
178960
179230
|
modifiedOn: org.modifiedOn
|
|
178961
179231
|
};
|
|
178962
179232
|
});
|
|
@@ -179216,7 +179486,7 @@ var listPersons = (params) => Effect_exports.gen(function* () {
|
|
|
179216
179486
|
name: PersonName.make(person.name),
|
|
179217
179487
|
city: person.city,
|
|
179218
179488
|
email: emailValue !== void 0 ? Email.make(emailValue) : void 0,
|
|
179219
|
-
url: buildContactUrlFromConfig(client.
|
|
179489
|
+
url: buildContactUrlFromConfig(client.workbenchUrlConfig, id),
|
|
179220
179490
|
modifiedOn: person.modifiedOn
|
|
179221
179491
|
};
|
|
179222
179492
|
});
|
|
@@ -179251,7 +179521,7 @@ var getPerson = (params) => Effect_exports.gen(function* () {
|
|
|
179251
179521
|
value: c.value
|
|
179252
179522
|
})),
|
|
179253
179523
|
organizations: organizations.length > 0 ? organizations : void 0,
|
|
179254
|
-
url: buildContactUrlFromConfig(client.
|
|
179524
|
+
url: buildContactUrlFromConfig(client.workbenchUrlConfig, id),
|
|
179255
179525
|
modifiedOn: person.modifiedOn,
|
|
179256
179526
|
createdOn: person.createdOn
|
|
179257
179527
|
};
|
|
@@ -179348,7 +179618,7 @@ var listEmployees = (params) => Effect_exports.gen(function* () {
|
|
|
179348
179618
|
email: emailValue !== void 0 ? Email.make(emailValue) : void 0,
|
|
179349
179619
|
position: emp.position ?? void 0,
|
|
179350
179620
|
active: emp.active,
|
|
179351
|
-
url: buildContactUrlFromConfig(client.
|
|
179621
|
+
url: buildContactUrlFromConfig(client.workbenchUrlConfig, id),
|
|
179352
179622
|
modifiedOn: emp.modifiedOn
|
|
179353
179623
|
};
|
|
179354
179624
|
});
|
|
@@ -185132,6 +185402,17 @@ var accountRoleMap = {
|
|
|
185132
185402
|
var toHulyAccountRole = (role) => accountRoleMap[role];
|
|
185133
185403
|
var formatVersion = (info) => `${info.versionMajor}.${info.versionMinor}.${info.versionPatch}`;
|
|
185134
185404
|
var nullToUndefined = (value3) => value3 ?? void 0;
|
|
185405
|
+
var toCreateAccessLinkOptions = (params) => {
|
|
185406
|
+
return {
|
|
185407
|
+
...params.firstName !== void 0 ? { firstName: params.firstName } : {},
|
|
185408
|
+
...params.lastName !== void 0 ? { lastName: params.lastName } : {},
|
|
185409
|
+
...params.navigateUrl !== void 0 ? { navigateUrl: params.navigateUrl } : {},
|
|
185410
|
+
...params.spaces !== void 0 ? { spaces: params.spaces } : {},
|
|
185411
|
+
...params.notBefore !== void 0 ? { notBefore: params.notBefore } : {},
|
|
185412
|
+
...params.expiration !== void 0 ? { expiration: params.expiration } : {},
|
|
185413
|
+
...params.personalized !== void 0 ? { personalized: params.personalized } : {}
|
|
185414
|
+
};
|
|
185415
|
+
};
|
|
185135
185416
|
var listWorkspaceMembers = (params) => Effect_exports.gen(function* () {
|
|
185136
185417
|
const ops = yield* WorkspaceClient;
|
|
185137
185418
|
const limit = clampLimit(params.limit);
|
|
@@ -185270,6 +185551,17 @@ var updateGuestSettings = (params) => Effect_exports.gen(function* () {
|
|
|
185270
185551
|
allowSignUp: params.allowSignUp
|
|
185271
185552
|
};
|
|
185272
185553
|
});
|
|
185554
|
+
var createAccessLink = (params) => Effect_exports.gen(function* () {
|
|
185555
|
+
const ops = yield* WorkspaceClient;
|
|
185556
|
+
const role = params.role ?? "GUEST";
|
|
185557
|
+
const link = yield* ops.createAccessLink(toHulyAccountRole(role), toCreateAccessLinkOptions(params));
|
|
185558
|
+
return {
|
|
185559
|
+
link: UrlString.make(link),
|
|
185560
|
+
role,
|
|
185561
|
+
spaces: params.spaces,
|
|
185562
|
+
personalized: params.personalized
|
|
185563
|
+
};
|
|
185564
|
+
});
|
|
185273
185565
|
var getRegions = () => Effect_exports.gen(function* () {
|
|
185274
185566
|
const ops = yield* WorkspaceClient;
|
|
185275
185567
|
const regions = yield* ops.getRegionInfo();
|
|
@@ -185387,6 +185679,18 @@ var workspaceTools = [
|
|
|
185387
185679
|
UpdateGuestSettingsResultSchema
|
|
185388
185680
|
)
|
|
185389
185681
|
},
|
|
185682
|
+
{
|
|
185683
|
+
name: "create_access_link",
|
|
185684
|
+
description: "Create a Huly workspace access link. Defaults to role GUEST. Supports anonymous reusable guest links by setting personalized=false with notBefore and expiration, and can restrict access to specific Huly space IDs via spaces.",
|
|
185685
|
+
category: CATEGORY24,
|
|
185686
|
+
inputSchema: createAccessLinkParamsJsonSchema,
|
|
185687
|
+
handler: createEncodedWorkspaceToolHandler(
|
|
185688
|
+
"create_access_link",
|
|
185689
|
+
parseCreateAccessLinkParams,
|
|
185690
|
+
createAccessLink,
|
|
185691
|
+
CreateAccessLinkResultSchema
|
|
185692
|
+
)
|
|
185693
|
+
},
|
|
185390
185694
|
{
|
|
185391
185695
|
name: "get_regions",
|
|
185392
185696
|
description: "Get available regions for workspace creation. Returns region codes and display names.",
|