@firfi/huly-mcp 0.52.3 → 0.52.4
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 +1 -1
- package/dist/index.cjs +960 -718
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -16362,7 +16362,7 @@ var init_Channel = __esm({
|
|
|
16362
16362
|
const pull = yield* onError2(f(upstream, scope3, closableScope), onCause);
|
|
16363
16363
|
return onError2(pull, onCause);
|
|
16364
16364
|
}));
|
|
16365
|
-
toTransform = (
|
|
16365
|
+
toTransform = (channel2) => channel2.transform;
|
|
16366
16366
|
DefaultChunkSize = 4096;
|
|
16367
16367
|
asyncQueue = (scope3, f, options) => make21({
|
|
16368
16368
|
capacity: options?.bufferSize,
|
|
@@ -16833,9 +16833,9 @@ var init_Channel = __esm({
|
|
|
16833
16833
|
yield* raceFirst2(semaphore.take(1), andThen4(join2(pullFiber), never2));
|
|
16834
16834
|
}
|
|
16835
16835
|
}
|
|
16836
|
-
const
|
|
16836
|
+
const channel2 = pullFiber === void 0 ? yield* pull : yield* join2(pullFiber);
|
|
16837
16837
|
const childScope = forkUnsafe2(forkedScope);
|
|
16838
|
-
const childPull = yield* toTransform(
|
|
16838
|
+
const childPull = yield* toTransform(channel2)(upstream, childScope);
|
|
16839
16839
|
while (fibers.size >= concurrencyN) {
|
|
16840
16840
|
const fiber4 = headUnsafe(fibers);
|
|
16841
16841
|
fibers.delete(fiber4);
|
|
@@ -16889,7 +16889,7 @@ var init_Channel = __esm({
|
|
|
16889
16889
|
}
|
|
16890
16890
|
}
|
|
16891
16891
|
}
|
|
16892
|
-
const runSide = (side,
|
|
16892
|
+
const runSide = (side, channel2, scope3) => toTransform(channel2)(upstream, scope3).pipe(flatMap6((pull) => pull.pipe(flatMap6((value3) => offer(queue, value3)), forever4)), onError2((cause) => andThen4(close(scope3, doneExitFromCause(cause)), onExit5(side, cause))), forkIn2(forkedScope));
|
|
16893
16893
|
yield* runSide("left", left, forkUnsafe2(forkedScope));
|
|
16894
16894
|
yield* runSide("right", right, forkUnsafe2(forkedScope));
|
|
16895
16895
|
return take4(queue);
|
|
@@ -16979,11 +16979,11 @@ var init_Channel = __esm({
|
|
|
16979
16979
|
const upstreamPull = catchCause3(upstream2, (cause) => isDoneCause(cause) ? failCause4(cause) : die5(Done2(cause)));
|
|
16980
16980
|
return map11(toTransform(that)(upstreamPull, scope3), (pull) => catchDefect2(pull, (defect) => isDone2(defect) ? failCause4(defect.value) : die5(defect)));
|
|
16981
16981
|
})));
|
|
16982
|
-
unwrap2 = (
|
|
16982
|
+
unwrap2 = (channel2) => fromTransform((upstream, scope3) => {
|
|
16983
16983
|
let pull;
|
|
16984
16984
|
return succeed7(suspend3(() => {
|
|
16985
16985
|
if (pull) return pull;
|
|
16986
|
-
return
|
|
16986
|
+
return channel2.pipe(provide(scope3), flatMap6((channel3) => toTransform(channel3)(upstream, scope3)), flatMap6((pull_) => pull = pull_));
|
|
16987
16987
|
}));
|
|
16988
16988
|
});
|
|
16989
16989
|
scoped3 = (self) => fromTransformBracket((upstream, scope3, forkedScope) => map11(provide(toTransform(self)(upstream, scope3), forkedScope), provide(forkedScope)));
|
|
@@ -25830,9 +25830,9 @@ var init_stream = __esm({
|
|
|
25830
25830
|
return pipeArguments(this, arguments);
|
|
25831
25831
|
}
|
|
25832
25832
|
};
|
|
25833
|
-
fromChannel = (
|
|
25833
|
+
fromChannel = (channel2) => {
|
|
25834
25834
|
const self = Object.create(StreamProto);
|
|
25835
|
-
self.channel =
|
|
25835
|
+
self.channel = channel2;
|
|
25836
25836
|
return self;
|
|
25837
25837
|
};
|
|
25838
25838
|
}
|
|
@@ -25865,7 +25865,7 @@ var init_Sink = __esm({
|
|
|
25865
25865
|
}
|
|
25866
25866
|
};
|
|
25867
25867
|
isSink = (u) => hasProperty(u, TypeId31);
|
|
25868
|
-
fromChannel2 = (
|
|
25868
|
+
fromChannel2 = (channel2) => fromTransform2((upstream, scope3) => toTransform(channel2)(upstream, scope3).pipe(flatMap6(forever4({
|
|
25869
25869
|
disableYield: true
|
|
25870
25870
|
})), catchDone(succeed7)));
|
|
25871
25871
|
fromTransform2 = (transform4) => {
|
|
@@ -27638,8 +27638,8 @@ var init_Stream = __esm({
|
|
|
27638
27638
|
acquire: broadcast(self, options),
|
|
27639
27639
|
idleTimeToLive: options.idleTimeToLive
|
|
27640
27640
|
}), (ref) => unwrap4(get10(ref))));
|
|
27641
|
-
pipeThroughChannel = /* @__PURE__ */ dual(2, (self,
|
|
27642
|
-
pipeThroughChannelOrFail = /* @__PURE__ */ dual(2, (self,
|
|
27641
|
+
pipeThroughChannel = /* @__PURE__ */ dual(2, (self, channel2) => fromChannel3(pipeTo(self.channel, channel2)));
|
|
27642
|
+
pipeThroughChannelOrFail = /* @__PURE__ */ dual(2, (self, channel2) => fromChannel3(pipeToOrFail(self.channel, channel2)));
|
|
27643
27643
|
pipeThrough = /* @__PURE__ */ dual(2, (self, sink) => self.channel.pipe(pipeToOrFail(toChannel(sink)), concatWith(([_, leftover]) => leftover ? succeed10(leftover) : empty8), fromChannel3));
|
|
27644
27644
|
collect2 = (self) => fromEffect2(runCollect(self));
|
|
27645
27645
|
accumulate = (self) => mapAccumArray(self, empty2, (acc, as4) => {
|
|
@@ -36750,13 +36750,13 @@ var init_Multipart = __esm({
|
|
|
36750
36750
|
contentType;
|
|
36751
36751
|
content;
|
|
36752
36752
|
contentEffect;
|
|
36753
|
-
constructor(info,
|
|
36753
|
+
constructor(info, channel2) {
|
|
36754
36754
|
super();
|
|
36755
36755
|
this.key = info.name;
|
|
36756
36756
|
this.name = info.filename ?? info.name;
|
|
36757
36757
|
this.contentType = info.contentType;
|
|
36758
|
-
this.content = fromChannel3(
|
|
36759
|
-
this.contentEffect =
|
|
36758
|
+
this.content = fromChannel3(channel2);
|
|
36759
|
+
this.contentEffect = channel2.pipe(mkUint8Array, mapError4((cause) => MultipartError.fromReason("InternalError", cause)));
|
|
36760
36760
|
}
|
|
36761
36761
|
toJSON() {
|
|
36762
36762
|
return {
|
|
@@ -73237,8 +73237,8 @@ var require_tracing = __commonJS({
|
|
|
73237
73237
|
var commandChannel = hasTracingChannel ? dc.tracingChannel("ioredis:command") : void 0;
|
|
73238
73238
|
var batchChannel = hasTracingChannel ? dc.tracingChannel("ioredis:batch") : void 0;
|
|
73239
73239
|
var connectChannel = hasTracingChannel ? dc.tracingChannel("ioredis:connect") : void 0;
|
|
73240
|
-
function shouldTrace(
|
|
73241
|
-
return !!
|
|
73240
|
+
function shouldTrace(channel2) {
|
|
73241
|
+
return !!channel2 && channel2.hasSubscribers !== false;
|
|
73242
73242
|
}
|
|
73243
73243
|
var noop = () => {
|
|
73244
73244
|
};
|
|
@@ -73639,14 +73639,14 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
73639
73639
|
}
|
|
73640
73640
|
debug("%s %d channels", type, channels.length);
|
|
73641
73641
|
if (type === "ssubscribe") {
|
|
73642
|
-
for (const
|
|
73642
|
+
for (const channel2 of channels) {
|
|
73643
73643
|
pending += 1;
|
|
73644
|
-
this.subscriber[type](
|
|
73644
|
+
this.subscriber[type](channel2).then(() => {
|
|
73645
73645
|
if (!--pending) {
|
|
73646
73646
|
this.lastActiveSubscriber = this.subscriber;
|
|
73647
73647
|
}
|
|
73648
73648
|
}).catch(() => {
|
|
73649
|
-
debug("failed to ssubscribe to channel: %s",
|
|
73649
|
+
debug("failed to ssubscribe to channel: %s", channel2);
|
|
73650
73650
|
});
|
|
73651
73651
|
}
|
|
73652
73652
|
} else {
|
|
@@ -75701,8 +75701,8 @@ var require_FailoverDetector = __commonJS({
|
|
|
75701
75701
|
debug("Failed to subscribe to failover messages on sentinel %s:%s (%s)", sentinel.address.host || "127.0.0.1", sentinel.address.port || 26739, err.message);
|
|
75702
75702
|
});
|
|
75703
75703
|
promises2.push(promise4);
|
|
75704
|
-
sentinel.client.on("message", (
|
|
75705
|
-
if (!this.isDisconnected &&
|
|
75704
|
+
sentinel.client.on("message", (channel2) => {
|
|
75705
|
+
if (!this.isDisconnected && channel2 === CHANNEL_NAME) {
|
|
75706
75706
|
this.disconnect();
|
|
75707
75707
|
}
|
|
75708
75708
|
});
|
|
@@ -76451,11 +76451,11 @@ var require_SubscriptionSet = __commonJS({
|
|
|
76451
76451
|
ssubscribe: {}
|
|
76452
76452
|
};
|
|
76453
76453
|
}
|
|
76454
|
-
add(set10,
|
|
76455
|
-
this.set[mapSet(set10)][
|
|
76454
|
+
add(set10, channel2) {
|
|
76455
|
+
this.set[mapSet(set10)][channel2] = true;
|
|
76456
76456
|
}
|
|
76457
|
-
del(set10,
|
|
76458
|
-
delete this.set[mapSet(set10)][
|
|
76457
|
+
del(set10, channel2) {
|
|
76458
|
+
delete this.set[mapSet(set10)][channel2];
|
|
76459
76459
|
}
|
|
76460
76460
|
channels(set10) {
|
|
76461
76461
|
return Object.keys(this.set[mapSet(set10)]);
|
|
@@ -76586,8 +76586,8 @@ var require_DataHandler = __commonJS({
|
|
|
76586
76586
|
case "ssubscribe":
|
|
76587
76587
|
case "subscribe":
|
|
76588
76588
|
case "psubscribe": {
|
|
76589
|
-
const
|
|
76590
|
-
this.redis.condition.subscriber.add(replyType,
|
|
76589
|
+
const channel2 = reply[1].toString();
|
|
76590
|
+
this.redis.condition.subscriber.add(replyType, channel2);
|
|
76591
76591
|
const item = this.shiftCommand(reply);
|
|
76592
76592
|
if (!item) {
|
|
76593
76593
|
return;
|
|
@@ -76600,9 +76600,9 @@ var require_DataHandler = __commonJS({
|
|
|
76600
76600
|
case "sunsubscribe":
|
|
76601
76601
|
case "unsubscribe":
|
|
76602
76602
|
case "punsubscribe": {
|
|
76603
|
-
const
|
|
76604
|
-
if (
|
|
76605
|
-
this.redis.condition.subscriber.del(replyType,
|
|
76603
|
+
const channel2 = reply[1] ? reply[1].toString() : null;
|
|
76604
|
+
if (channel2) {
|
|
76605
|
+
this.redis.condition.subscriber.del(replyType, channel2);
|
|
76606
76606
|
}
|
|
76607
76607
|
const count2 = reply[2];
|
|
76608
76608
|
if (Number(count2) === 0) {
|
|
@@ -76926,8 +76926,8 @@ var require_event_handler = __commonJS({
|
|
|
76926
76926
|
const ssubscribeChannels = condition.subscriber.channels("ssubscribe");
|
|
76927
76927
|
if (ssubscribeChannels.length) {
|
|
76928
76928
|
debug("ssubscribe %s", ssubscribeChannels.length);
|
|
76929
|
-
for (const
|
|
76930
|
-
self.ssubscribe(
|
|
76929
|
+
for (const channel2 of ssubscribeChannels) {
|
|
76930
|
+
self.ssubscribe(channel2);
|
|
76931
76931
|
}
|
|
76932
76932
|
}
|
|
76933
76933
|
}
|
|
@@ -78015,7 +78015,7 @@ var init_huly_runtime_context = __esm({
|
|
|
78015
78015
|
const hulyConnectionTimeout = isConfiguredHeaderValue(values3.get("x-huly-connection-timeout"));
|
|
78016
78016
|
const requiredComplete = REQUIRED_HULY_CONFIG_HEADERS.every((name) => isConfiguredHeaderValue(values3.get(name)));
|
|
78017
78017
|
return {
|
|
78018
|
-
present: values3.size > 0
|
|
78018
|
+
present: values3.size > 0,
|
|
78019
78019
|
requiredComplete,
|
|
78020
78020
|
hulyUrl,
|
|
78021
78021
|
hulyWorkspace,
|
|
@@ -78147,7 +78147,7 @@ var init_config = __esm({
|
|
|
78147
78147
|
);
|
|
78148
78148
|
parseUrlHeaderConfig = (headers) => Effect_exports.gen(function* () {
|
|
78149
78149
|
const hulyHeaders = Object.entries(headers).filter(([name]) => name.toLowerCase().startsWith("x-huly-"));
|
|
78150
|
-
if (hulyHeaders.
|
|
78150
|
+
if (!hulyHeaders.some(([name]) => isHulyConfigHeader2(name.toLowerCase()))) return { _tag: "NoUrlHeaders" };
|
|
78151
78151
|
const normalized5 = yield* Effect_exports.forEach(
|
|
78152
78152
|
hulyHeaders,
|
|
78153
78153
|
([rawName, value3]) => {
|
|
@@ -78180,7 +78180,7 @@ var init_config = __esm({
|
|
|
78180
78180
|
if (REQUIRED_HULY_CONFIG_HEADERS.includes(headerName)) {
|
|
78181
78181
|
return Effect_exports.fail(
|
|
78182
78182
|
configValidationError(
|
|
78183
|
-
`Missing required Huly config header "${headerName}". When any x-huly-* header is present, ${REQUIRED_HULY_CONFIG_HEADERS.join(", ")} must all be provided.`,
|
|
78183
|
+
`Missing required Huly config header "${headerName}". When any supported x-huly-* header is present, ${REQUIRED_HULY_CONFIG_HEADERS.join(", ")} must all be provided.`,
|
|
78184
78184
|
headerName
|
|
78185
78185
|
)
|
|
78186
78186
|
);
|
|
@@ -101820,6 +101820,619 @@ var init_http = __esm({
|
|
|
101820
101820
|
}
|
|
101821
101821
|
});
|
|
101822
101822
|
|
|
101823
|
+
// src/domain/schemas/json-schema.ts
|
|
101824
|
+
var DRAFT_07_DEFINITIONS_REF, MCP_DEFINITIONS_REF, restoreMcpDefinitionRef, JsonSchemaObjectSchema, JsonArraySchema, parseJsonObject, restoreMcpDefinitionRefsInJson, restoreMcpDefinitionRefs, FLATTENABLE_ALLOF_KEYS, flattenScalarAllOf, annotatedAstDescription, checkedAstDescription, directAstDescription, astDescription, astAuthoredJsonSchema, restoreUnionDescriptions, restorePropertyDescription, restoreObjectDescriptions, restoreArrayDescriptions, restoreAstPropertyDescriptions, toDraft07JsonSchema, toDraft07EmptyObjectJsonSchema, JsonSchemaRecordSchema, parseJsonSchemaRecord, withJsonSchemaPropertyDescriptions, withJsonSchemaUnionPropertyDescriptions, withExactlyOneRequired;
|
|
101825
|
+
var init_json_schema2 = __esm({
|
|
101826
|
+
"src/domain/schemas/json-schema.ts"() {
|
|
101827
|
+
"use strict";
|
|
101828
|
+
init_dist();
|
|
101829
|
+
DRAFT_07_DEFINITIONS_REF = "#/definitions";
|
|
101830
|
+
MCP_DEFINITIONS_REF = "#/$defs";
|
|
101831
|
+
restoreMcpDefinitionRef = (ref) => ref === DRAFT_07_DEFINITIONS_REF || ref.startsWith(`${DRAFT_07_DEFINITIONS_REF}/`) ? `${MCP_DEFINITIONS_REF}${ref.slice(DRAFT_07_DEFINITIONS_REF.length)}` : ref;
|
|
101832
|
+
JsonSchemaObjectSchema = Schema_exports.Record(Schema_exports.String, Schema_exports.Json);
|
|
101833
|
+
JsonArraySchema = Schema_exports.Array(Schema_exports.Json);
|
|
101834
|
+
parseJsonObject = (value3) => {
|
|
101835
|
+
try {
|
|
101836
|
+
return Schema_exports.decodeUnknownSync(JsonSchemaObjectSchema)(value3);
|
|
101837
|
+
} catch {
|
|
101838
|
+
return void 0;
|
|
101839
|
+
}
|
|
101840
|
+
};
|
|
101841
|
+
restoreMcpDefinitionRefsInJson = (value3) => {
|
|
101842
|
+
if (Array.isArray(value3)) {
|
|
101843
|
+
return Schema_exports.decodeUnknownSync(JsonArraySchema)(value3).map(restoreMcpDefinitionRefsInJson);
|
|
101844
|
+
}
|
|
101845
|
+
if (typeof value3 !== "object" || value3 === null) return value3;
|
|
101846
|
+
return Object.fromEntries(
|
|
101847
|
+
Object.entries(value3).map(([key, nested3]) => [
|
|
101848
|
+
key,
|
|
101849
|
+
key === "$ref" && typeof nested3 === "string" ? restoreMcpDefinitionRef(nested3) : restoreMcpDefinitionRefsInJson(nested3)
|
|
101850
|
+
])
|
|
101851
|
+
);
|
|
101852
|
+
};
|
|
101853
|
+
restoreMcpDefinitionRefs = (schema2) => {
|
|
101854
|
+
const parsed = Schema_exports.decodeUnknownSync(JsonSchemaObjectSchema)(schema2);
|
|
101855
|
+
return Object.fromEntries(
|
|
101856
|
+
Object.entries(parsed).map(([key, value3]) => [
|
|
101857
|
+
key,
|
|
101858
|
+
key === "$ref" && typeof value3 === "string" ? restoreMcpDefinitionRef(value3) : restoreMcpDefinitionRefsInJson(value3)
|
|
101859
|
+
])
|
|
101860
|
+
);
|
|
101861
|
+
};
|
|
101862
|
+
FLATTENABLE_ALLOF_KEYS = /* @__PURE__ */ new Set([
|
|
101863
|
+
"description",
|
|
101864
|
+
"exclusiveMaximum",
|
|
101865
|
+
"exclusiveMinimum",
|
|
101866
|
+
"format",
|
|
101867
|
+
"maxItems",
|
|
101868
|
+
"maxLength",
|
|
101869
|
+
"maximum",
|
|
101870
|
+
"minItems",
|
|
101871
|
+
"minLength",
|
|
101872
|
+
"minimum",
|
|
101873
|
+
"multipleOf",
|
|
101874
|
+
"pattern",
|
|
101875
|
+
"title",
|
|
101876
|
+
"uniqueItems"
|
|
101877
|
+
]);
|
|
101878
|
+
flattenScalarAllOf = (value3) => {
|
|
101879
|
+
if (Array.isArray(value3)) return Schema_exports.decodeUnknownSync(JsonArraySchema)(value3).map(flattenScalarAllOf);
|
|
101880
|
+
if (typeof value3 !== "object" || value3 === null) return value3;
|
|
101881
|
+
const record3 = Schema_exports.decodeUnknownSync(JsonSchemaObjectSchema)(value3);
|
|
101882
|
+
const recursivelyNormalized = Object.fromEntries(
|
|
101883
|
+
Object.entries(record3).map(([key, nested3]) => [key, flattenScalarAllOf(nested3)])
|
|
101884
|
+
);
|
|
101885
|
+
const allOf = recursivelyNormalized.allOf;
|
|
101886
|
+
if (!Array.isArray(allOf)) return recursivelyNormalized;
|
|
101887
|
+
const members = Schema_exports.decodeUnknownSync(JsonArraySchema)(allOf).map(parseJsonObject);
|
|
101888
|
+
if (members.some(
|
|
101889
|
+
(member) => member === void 0 || Object.keys(member).some((key) => !FLATTENABLE_ALLOF_KEYS.has(key))
|
|
101890
|
+
)) {
|
|
101891
|
+
return recursivelyNormalized;
|
|
101892
|
+
}
|
|
101893
|
+
const memberKeys = members.flatMap((member) => member === void 0 ? [] : Object.keys(member));
|
|
101894
|
+
if (new Set(memberKeys).size !== memberKeys.length) return recursivelyNormalized;
|
|
101895
|
+
const merged = Object.assign({}, ...members);
|
|
101896
|
+
if (Object.keys(merged).some((key) => key in recursivelyNormalized && recursivelyNormalized[key] !== merged[key])) {
|
|
101897
|
+
return recursivelyNormalized;
|
|
101898
|
+
}
|
|
101899
|
+
const withoutAllOf = Object.fromEntries(Object.entries(recursivelyNormalized).filter(([key]) => key !== "allOf"));
|
|
101900
|
+
return { ...withoutAllOf, ...merged };
|
|
101901
|
+
};
|
|
101902
|
+
annotatedAstDescription = (ast) => {
|
|
101903
|
+
const contextDescription = ast.context === void 0 ? void 0 : ast.context.annotations?.description;
|
|
101904
|
+
const direct = contextDescription === void 0 ? ast.annotations?.description : contextDescription;
|
|
101905
|
+
return typeof direct === "string" ? direct : void 0;
|
|
101906
|
+
};
|
|
101907
|
+
checkedAstDescription = (ast) => {
|
|
101908
|
+
const checks = ast.checks === void 0 ? [] : ast.checks;
|
|
101909
|
+
const matchingCheck = checks.find((check3) => typeof check3.annotations?.description === "string");
|
|
101910
|
+
const checkDescription = matchingCheck === void 0 ? void 0 : matchingCheck.annotations?.description;
|
|
101911
|
+
return typeof checkDescription === "string" ? checkDescription : void 0;
|
|
101912
|
+
};
|
|
101913
|
+
directAstDescription = (ast) => annotatedAstDescription(ast) ?? checkedAstDescription(ast);
|
|
101914
|
+
astDescription = (ast) => {
|
|
101915
|
+
const direct = directAstDescription(ast);
|
|
101916
|
+
if (direct !== void 0) return direct;
|
|
101917
|
+
if (SchemaAST_exports.isUnion(ast)) {
|
|
101918
|
+
const members = ast.types.filter((member) => !SchemaAST_exports.isUndefined(member));
|
|
101919
|
+
const descriptions4 = members.map(astDescription).filter((description) => description !== void 0);
|
|
101920
|
+
if (members.length === 1) return descriptions4[0];
|
|
101921
|
+
if (descriptions4.length === members.length && new Set(descriptions4).size === 1) return descriptions4[0];
|
|
101922
|
+
}
|
|
101923
|
+
return void 0;
|
|
101924
|
+
};
|
|
101925
|
+
astAuthoredJsonSchema = (ast) => {
|
|
101926
|
+
const annotation = ast.context?.annotations?.jsonSchema ?? ast.annotations?.jsonSchema;
|
|
101927
|
+
return parseJsonObject(annotation);
|
|
101928
|
+
};
|
|
101929
|
+
restoreUnionDescriptions = (ast, record3) => {
|
|
101930
|
+
if (!Array.isArray(record3.anyOf)) return record3;
|
|
101931
|
+
const members = ast.types.filter((member) => !SchemaAST_exports.isUndefined(member));
|
|
101932
|
+
const anyOf = Schema_exports.decodeUnknownSync(JsonArraySchema)(record3.anyOf);
|
|
101933
|
+
return {
|
|
101934
|
+
...record3,
|
|
101935
|
+
anyOf: anyOf.map((member, index2) => {
|
|
101936
|
+
const astMember = members[index2];
|
|
101937
|
+
return astMember === void 0 ? member : restoreAstPropertyDescriptions(astMember, member);
|
|
101938
|
+
})
|
|
101939
|
+
};
|
|
101940
|
+
};
|
|
101941
|
+
restorePropertyDescription = (propertyAst, property) => {
|
|
101942
|
+
const restored = restoreAstPropertyDescriptions(propertyAst, property);
|
|
101943
|
+
const record3 = parseJsonObject(restored);
|
|
101944
|
+
const description = astDescription(propertyAst);
|
|
101945
|
+
if (description === void 0 || record3 === void 0) return restored;
|
|
101946
|
+
return record3.$ref === void 0 ? { ...record3, description: record3.description ?? description } : { allOf: [{ $ref: record3.$ref }], description };
|
|
101947
|
+
};
|
|
101948
|
+
restoreObjectDescriptions = (ast, record3) => {
|
|
101949
|
+
const properties = record3.properties === void 0 ? void 0 : parseJsonObject(record3.properties);
|
|
101950
|
+
if (properties === void 0) return record3;
|
|
101951
|
+
const signatures = new Map(ast.propertySignatures.map((signature) => [signature.name, signature.type]));
|
|
101952
|
+
return {
|
|
101953
|
+
...record3,
|
|
101954
|
+
properties: Object.fromEntries(
|
|
101955
|
+
Object.entries(properties).map(([key, property]) => {
|
|
101956
|
+
const propertyAst = signatures.get(key);
|
|
101957
|
+
return [key, propertyAst === void 0 ? property : restorePropertyDescription(propertyAst, property)];
|
|
101958
|
+
})
|
|
101959
|
+
)
|
|
101960
|
+
};
|
|
101961
|
+
};
|
|
101962
|
+
restoreArrayDescriptions = (ast, record3) => {
|
|
101963
|
+
if (record3.items === void 0) return record3;
|
|
101964
|
+
const elementAst = ast.rest[0] ?? ast.elements[0];
|
|
101965
|
+
return elementAst === void 0 ? record3 : { ...record3, items: restoreAstPropertyDescriptions(elementAst, record3.items) };
|
|
101966
|
+
};
|
|
101967
|
+
restoreAstPropertyDescriptions = (ast, jsonSchema2) => {
|
|
101968
|
+
const record3 = parseJsonObject(jsonSchema2);
|
|
101969
|
+
if (record3 === void 0) return jsonSchema2;
|
|
101970
|
+
const authored = astAuthoredJsonSchema(ast);
|
|
101971
|
+
const restoredRecord = authored === void 0 ? record3 : { ...record3, ...authored };
|
|
101972
|
+
if (SchemaAST_exports.isUnion(ast)) return restoreUnionDescriptions(ast, restoredRecord);
|
|
101973
|
+
if (SchemaAST_exports.isObjects(ast)) return restoreObjectDescriptions(ast, restoredRecord);
|
|
101974
|
+
if (SchemaAST_exports.isArrays(ast)) return restoreArrayDescriptions(ast, restoredRecord);
|
|
101975
|
+
return restoredRecord;
|
|
101976
|
+
};
|
|
101977
|
+
toDraft07JsonSchema = (schema2) => {
|
|
101978
|
+
const draft07 = JsonSchema_exports.toDocumentDraft07(Schema_exports.toJsonSchemaDocument(schema2));
|
|
101979
|
+
const definitions = Object.fromEntries(
|
|
101980
|
+
Object.entries(draft07.definitions).map(([name, definition]) => [name, restoreMcpDefinitionRefs(definition)])
|
|
101981
|
+
);
|
|
101982
|
+
const document2 = flattenScalarAllOf({
|
|
101983
|
+
$schema: JsonSchema_exports.META_SCHEMA_URI_DRAFT_07,
|
|
101984
|
+
...restoreMcpDefinitionRefs(draft07.schema),
|
|
101985
|
+
...Object.keys(definitions).length === 0 ? {} : { $defs: definitions }
|
|
101986
|
+
});
|
|
101987
|
+
return Schema_exports.decodeUnknownSync(JsonSchemaObjectSchema)(restoreAstPropertyDescriptions(schema2.ast, document2));
|
|
101988
|
+
};
|
|
101989
|
+
toDraft07EmptyObjectJsonSchema = (schema2) => {
|
|
101990
|
+
const converted = toDraft07JsonSchema(schema2);
|
|
101991
|
+
const definitions = parseJsonSchemaRecord(converted.$defs);
|
|
101992
|
+
return {
|
|
101993
|
+
$schema: converted.$schema,
|
|
101994
|
+
...definitions === void 0 ? {} : { $defs: definitions },
|
|
101995
|
+
type: "object",
|
|
101996
|
+
properties: {},
|
|
101997
|
+
additionalProperties: false
|
|
101998
|
+
};
|
|
101999
|
+
};
|
|
102000
|
+
JsonSchemaRecordSchema = Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown);
|
|
102001
|
+
parseJsonSchemaRecord = (value3) => {
|
|
102002
|
+
try {
|
|
102003
|
+
return Schema_exports.decodeUnknownSync(JsonSchemaRecordSchema)(value3);
|
|
102004
|
+
} catch {
|
|
102005
|
+
return void 0;
|
|
102006
|
+
}
|
|
102007
|
+
};
|
|
102008
|
+
withJsonSchemaPropertyDescriptions = (schema2, descriptions4) => {
|
|
102009
|
+
const properties = parseJsonSchemaRecord(parseJsonSchemaRecord(schema2)?.properties);
|
|
102010
|
+
if (properties === void 0) return schema2;
|
|
102011
|
+
return {
|
|
102012
|
+
...schema2,
|
|
102013
|
+
properties: Object.fromEntries(
|
|
102014
|
+
Object.entries(properties).map(([key, value3]) => {
|
|
102015
|
+
const description = descriptions4[key];
|
|
102016
|
+
const property = parseJsonSchemaRecord(value3);
|
|
102017
|
+
return [key, description === void 0 || property === void 0 ? value3 : { ...property, description }];
|
|
102018
|
+
})
|
|
102019
|
+
)
|
|
102020
|
+
};
|
|
102021
|
+
};
|
|
102022
|
+
withJsonSchemaUnionPropertyDescriptions = (schema2, descriptions4) => {
|
|
102023
|
+
const parsed = parseJsonSchemaRecord(schema2);
|
|
102024
|
+
if (parsed === void 0 || !Array.isArray(parsed.anyOf)) return schema2;
|
|
102025
|
+
return {
|
|
102026
|
+
...parsed,
|
|
102027
|
+
anyOf: parsed.anyOf.map((member) => {
|
|
102028
|
+
const record3 = parseJsonSchemaRecord(member);
|
|
102029
|
+
return record3 === void 0 ? member : withJsonSchemaPropertyDescriptions(record3, descriptions4);
|
|
102030
|
+
})
|
|
102031
|
+
};
|
|
102032
|
+
};
|
|
102033
|
+
withExactlyOneRequired = (schema2, fields) => ({
|
|
102034
|
+
...schema2,
|
|
102035
|
+
oneOf: fields.map((field) => ({ required: [field] }))
|
|
102036
|
+
});
|
|
102037
|
+
}
|
|
102038
|
+
});
|
|
102039
|
+
|
|
102040
|
+
// src/domain/schemas/shared-base.ts
|
|
102041
|
+
var nonEmptyTrimmedString, NonEmptyString2;
|
|
102042
|
+
var init_shared_base = __esm({
|
|
102043
|
+
"src/domain/schemas/shared-base.ts"() {
|
|
102044
|
+
"use strict";
|
|
102045
|
+
init_dist();
|
|
102046
|
+
nonEmptyTrimmedString = (annotations2) => Schema_exports.String.check(Schema_exports.isNonEmpty()).pipe(
|
|
102047
|
+
Schema_exports.annotate(annotations2 ?? {}),
|
|
102048
|
+
Schema_exports.decodeTo(Schema_exports.Trimmed.check(Schema_exports.isNonEmpty()), SchemaTransformation_exports.trim())
|
|
102049
|
+
);
|
|
102050
|
+
NonEmptyString2 = nonEmptyTrimmedString({ identifier: "NonEmptyString" });
|
|
102051
|
+
}
|
|
102052
|
+
});
|
|
102053
|
+
|
|
102054
|
+
// src/domain/schemas/shared-refs.ts
|
|
102055
|
+
var DocId, HulyRef, PersonId, OrganizationId, IssueId, AssociationId, RelationId, ComponentId, MilestoneId, IssueTemplateId, IssueTemplateChildId, ProjectTypeId, TaskTypeId, IssueStatusId, WorkflowStatusId, StatusCategoryId, ChannelId, MessageId, ThreadReplyId, ActivityMessageId, ReactionId, SavedMessageId, MentionId, ActivityReferenceId, ActivityFilterId, AttachmentId, SavedAttachmentId, DrawingId, BlobId, CardId, CardSpaceId, DocumentId, MasterTagId, TeamspaceId, NotificationId, NotificationContextId, EventId, CalendarId, ScheduleId, FloorId, RoomId, MeetingMinutesId, DevicePreferenceId, TodoId, SpaceId, SpaceTypeId, RoleId, PermissionId, CommentId, TimeSpendReportId, ParticipantInfoId, TagElementId, TagReferenceId, TagCategoryId, WorkSlotId, CustomFieldId, HulyAttributeId, HulyEnumId, TestProjectId, TestSuiteId, TestCaseId, TestPlanId, TestPlanItemId, TestRunId, TestResultId, InventoryCategoryId, InventoryProductId, InventoryVariantId, NotificationTypeSettingId, CollaboratorId;
|
|
102056
|
+
var init_shared_refs = __esm({
|
|
102057
|
+
"src/domain/schemas/shared-refs.ts"() {
|
|
102058
|
+
"use strict";
|
|
102059
|
+
init_dist();
|
|
102060
|
+
init_shared_base();
|
|
102061
|
+
DocId = NonEmptyString2.pipe(Schema_exports.brand("DocId"));
|
|
102062
|
+
HulyRef = (tag2) => DocId.pipe(Schema_exports.brand(tag2));
|
|
102063
|
+
PersonId = HulyRef("PersonId");
|
|
102064
|
+
OrganizationId = HulyRef("OrganizationId");
|
|
102065
|
+
IssueId = HulyRef("IssueId");
|
|
102066
|
+
AssociationId = HulyRef("AssociationId");
|
|
102067
|
+
RelationId = HulyRef("RelationId");
|
|
102068
|
+
ComponentId = HulyRef("ComponentId");
|
|
102069
|
+
MilestoneId = HulyRef("MilestoneId");
|
|
102070
|
+
IssueTemplateId = HulyRef("IssueTemplateId");
|
|
102071
|
+
IssueTemplateChildId = HulyRef("IssueTemplateChildId");
|
|
102072
|
+
ProjectTypeId = HulyRef("ProjectTypeId");
|
|
102073
|
+
TaskTypeId = HulyRef("TaskTypeId");
|
|
102074
|
+
IssueStatusId = HulyRef("IssueStatusId");
|
|
102075
|
+
WorkflowStatusId = HulyRef("WorkflowStatusId");
|
|
102076
|
+
StatusCategoryId = HulyRef("StatusCategoryId");
|
|
102077
|
+
ChannelId = HulyRef("ChannelId");
|
|
102078
|
+
MessageId = HulyRef("MessageId");
|
|
102079
|
+
ThreadReplyId = HulyRef("ThreadReplyId");
|
|
102080
|
+
ActivityMessageId = HulyRef("ActivityMessageId");
|
|
102081
|
+
ReactionId = HulyRef("ReactionId");
|
|
102082
|
+
SavedMessageId = HulyRef("SavedMessageId");
|
|
102083
|
+
MentionId = HulyRef("MentionId");
|
|
102084
|
+
ActivityReferenceId = HulyRef("ActivityReferenceId");
|
|
102085
|
+
ActivityFilterId = HulyRef("ActivityFilterId");
|
|
102086
|
+
AttachmentId = HulyRef("AttachmentId");
|
|
102087
|
+
SavedAttachmentId = HulyRef("SavedAttachmentId");
|
|
102088
|
+
DrawingId = HulyRef("DrawingId");
|
|
102089
|
+
BlobId = HulyRef("BlobId");
|
|
102090
|
+
CardId = HulyRef("CardId");
|
|
102091
|
+
CardSpaceId = HulyRef("CardSpaceId");
|
|
102092
|
+
DocumentId = HulyRef("DocumentId");
|
|
102093
|
+
MasterTagId = HulyRef("MasterTagId");
|
|
102094
|
+
TeamspaceId = HulyRef("TeamspaceId");
|
|
102095
|
+
NotificationId = HulyRef("NotificationId");
|
|
102096
|
+
NotificationContextId = HulyRef("NotificationContextId");
|
|
102097
|
+
EventId = HulyRef("EventId");
|
|
102098
|
+
CalendarId = HulyRef("CalendarId");
|
|
102099
|
+
ScheduleId = HulyRef("ScheduleId");
|
|
102100
|
+
FloorId = HulyRef("FloorId");
|
|
102101
|
+
RoomId = HulyRef("RoomId");
|
|
102102
|
+
MeetingMinutesId = HulyRef("MeetingMinutesId");
|
|
102103
|
+
DevicePreferenceId = HulyRef("DevicePreferenceId");
|
|
102104
|
+
TodoId = HulyRef("TodoId");
|
|
102105
|
+
SpaceId = HulyRef("SpaceId");
|
|
102106
|
+
SpaceTypeId = HulyRef("SpaceTypeId");
|
|
102107
|
+
RoleId = HulyRef("RoleId");
|
|
102108
|
+
PermissionId = HulyRef("PermissionId");
|
|
102109
|
+
CommentId = HulyRef("CommentId");
|
|
102110
|
+
TimeSpendReportId = HulyRef("TimeSpendReportId");
|
|
102111
|
+
ParticipantInfoId = HulyRef("ParticipantInfoId");
|
|
102112
|
+
TagElementId = HulyRef("TagElementId");
|
|
102113
|
+
TagReferenceId = HulyRef("TagReferenceId");
|
|
102114
|
+
TagCategoryId = HulyRef("TagCategoryId");
|
|
102115
|
+
WorkSlotId = HulyRef("WorkSlotId");
|
|
102116
|
+
CustomFieldId = HulyRef("CustomFieldId");
|
|
102117
|
+
HulyAttributeId = HulyRef("HulyAttributeId");
|
|
102118
|
+
HulyEnumId = HulyRef("HulyEnumId");
|
|
102119
|
+
TestProjectId = HulyRef("TestProjectId");
|
|
102120
|
+
TestSuiteId = HulyRef("TestSuiteId");
|
|
102121
|
+
TestCaseId = HulyRef("TestCaseId");
|
|
102122
|
+
TestPlanId = HulyRef("TestPlanId");
|
|
102123
|
+
TestPlanItemId = HulyRef("TestPlanItemId");
|
|
102124
|
+
TestRunId = HulyRef("TestRunId");
|
|
102125
|
+
TestResultId = HulyRef("TestResultId");
|
|
102126
|
+
InventoryCategoryId = HulyRef("InventoryCategoryId");
|
|
102127
|
+
InventoryProductId = HulyRef("InventoryProductId");
|
|
102128
|
+
InventoryVariantId = HulyRef("InventoryVariantId");
|
|
102129
|
+
NotificationTypeSettingId = HulyRef("NotificationTypeSettingId");
|
|
102130
|
+
CollaboratorId = HulyRef("CollaboratorId");
|
|
102131
|
+
}
|
|
102132
|
+
});
|
|
102133
|
+
|
|
102134
|
+
// src/domain/schemas/shared.ts
|
|
102135
|
+
var MAX_LIMIT, DEFAULT_LIMIT, DEFAULT_COLOR_INDEX, MAX_COLOR_INDEX, DEFAULT_INCLUDE_ARCHIVED, DEFAULT_PRIVATE, NonNegativeInteger, PositiveInteger, Integer, Count, UNKNOWN_TOTAL, ListTotal, HulyTransactionScope, HulyConditionalWriteResult, Sha256Hex, Timestamp, LimitParam, EmptyParamsSchema, emptyParamsJsonSchema, enumValuesDescription, hasAtLeastOneDefined, hasAllDefined, atLeastOneUpdateFieldMessage, mutuallyExclusiveFieldsMessage, hasMutuallyExclusiveFields, withAtLeastOneRequired, withMutuallyExclusiveFields, assertUpdateFields, ProjectIdentifier, IssueIdentifier, SpaceIdentifier, SpaceClassFilter, SpaceTypeIdentifier, Email, StatusName, PersonName, PersonLocator, PersonRefInput, ComponentLabel, MilestoneLabel, ChannelName, RoomName, MimeType, ObjectClassName, EmojiCode, ContactProvider, NotificationProviderId, NotificationTypeId, WorkspaceName, UrlString, WorkspaceUrlSlug, WorkspaceVersion, WorkspaceMode, WorkspaceUuid, PersonUuid, AccountId, AccountUuid, SessionId, RegionId, NonNegativeNumber, PositiveNumber, VirtualOfficeCoordinate, VirtualOfficeDimension, BlurRadius, TimeZoneId, DurationMinutes, PositiveDurationMinutes, HOURS_PER_DAY, MINUTES_PER_HOUR, MINUTES_PER_DAY, MinuteOfDay, ColorCode, ComponentIdentifier, MilestoneIdentifier, TemplateIdentifier, ChannelIdentifier, DirectMessageIdentifier, TeamspaceIdentifier, CardIdentifier, CardSpaceIdentifier, DocumentIdentifier, MasterTagIdentifier, TagIdentifier, TagCategoryIdentifier, WorkflowStatusIdentifier, StatusCategoryIdentifier, HulyAttributeIdentifier, InventoryCategoryIdentifier, InventoryProductIdentifier, InventoryVariantIdentifier, MemberReference, TestProjectIdentifier, TestSuiteIdentifier, TestCaseIdentifier, TestPlanIdentifier, TestRunIdentifier, TestResultIdentifier;
|
|
102136
|
+
var init_shared = __esm({
|
|
102137
|
+
"src/domain/schemas/shared.ts"() {
|
|
102138
|
+
"use strict";
|
|
102139
|
+
init_dist();
|
|
102140
|
+
init_json_schema2();
|
|
102141
|
+
init_shared_base();
|
|
102142
|
+
init_shared_base();
|
|
102143
|
+
init_shared_refs();
|
|
102144
|
+
MAX_LIMIT = 200;
|
|
102145
|
+
DEFAULT_LIMIT = 50;
|
|
102146
|
+
DEFAULT_COLOR_INDEX = 0;
|
|
102147
|
+
MAX_COLOR_INDEX = 23;
|
|
102148
|
+
DEFAULT_INCLUDE_ARCHIVED = false;
|
|
102149
|
+
DEFAULT_PRIVATE = false;
|
|
102150
|
+
NonNegativeInteger = Schema_exports.Natural.annotate({
|
|
102151
|
+
identifier: "NonNegativeInteger",
|
|
102152
|
+
title: "NonNegativeInteger",
|
|
102153
|
+
description: "Integer greater than or equal to zero."
|
|
102154
|
+
});
|
|
102155
|
+
PositiveInteger = Schema_exports.Int.pipe(
|
|
102156
|
+
Schema_exports.check(Schema_exports.isGreaterThan(0)),
|
|
102157
|
+
Schema_exports.brand("PositiveInteger")
|
|
102158
|
+
).annotate({ identifier: "PositiveInteger", title: "PositiveInteger", description: "Integer greater than zero." });
|
|
102159
|
+
Integer = Schema_exports.Int.pipe(Schema_exports.brand("Integer")).annotate({
|
|
102160
|
+
identifier: "Integer",
|
|
102161
|
+
title: "Integer",
|
|
102162
|
+
description: "Whole number."
|
|
102163
|
+
});
|
|
102164
|
+
Count = NonNegativeInteger.pipe(Schema_exports.brand("Count")).annotate({
|
|
102165
|
+
identifier: "Count",
|
|
102166
|
+
title: "Count",
|
|
102167
|
+
description: "Non-negative integer count."
|
|
102168
|
+
});
|
|
102169
|
+
UNKNOWN_TOTAL = -1;
|
|
102170
|
+
ListTotal = Schema_exports.Union([Count, Schema_exports.Literal(UNKNOWN_TOTAL)]).annotate({
|
|
102171
|
+
identifier: "ListTotal",
|
|
102172
|
+
title: "ListTotal",
|
|
102173
|
+
description: "Count of matching list results, or -1 when the Huly backend reports an unknown total."
|
|
102174
|
+
});
|
|
102175
|
+
HulyTransactionScope = NonEmptyString2.pipe(Schema_exports.brand("HulyTransactionScope"));
|
|
102176
|
+
HulyConditionalWriteResult = Schema_exports.Literals(["applied", "condition-not-met"]);
|
|
102177
|
+
Sha256Hex = Schema_exports.String.pipe(
|
|
102178
|
+
Schema_exports.check(Schema_exports.isPattern(/^[0-9a-f]{64}$/u)),
|
|
102179
|
+
Schema_exports.brand("Sha256Hex")
|
|
102180
|
+
).annotate({
|
|
102181
|
+
identifier: "Sha256Hex",
|
|
102182
|
+
title: "Sha256Hex",
|
|
102183
|
+
description: "Lowercase 64-character hexadecimal SHA-256 digest."
|
|
102184
|
+
});
|
|
102185
|
+
Timestamp = NonNegativeInteger.pipe(Schema_exports.brand("Timestamp")).annotate({
|
|
102186
|
+
identifier: "Timestamp",
|
|
102187
|
+
title: "Timestamp",
|
|
102188
|
+
description: "Unix timestamp in milliseconds (non-negative integer)"
|
|
102189
|
+
});
|
|
102190
|
+
LimitParam = Schema_exports.Int.check(Schema_exports.isGreaterThan(0), Schema_exports.isLessThanOrEqualTo(MAX_LIMIT));
|
|
102191
|
+
EmptyParamsSchema = Schema_exports.Struct({});
|
|
102192
|
+
emptyParamsJsonSchema = toDraft07EmptyObjectJsonSchema(EmptyParamsSchema);
|
|
102193
|
+
enumValuesDescription = (values3) => values3.join(", ");
|
|
102194
|
+
hasAtLeastOneDefined = (params2, fields) => fields.some((field) => params2[field] !== void 0);
|
|
102195
|
+
hasAllDefined = (...values3) => values3.every((value3) => value3 !== void 0);
|
|
102196
|
+
atLeastOneUpdateFieldMessage = (fields) => `At least one update field must be provided: ${fields.join(", ")}.`;
|
|
102197
|
+
mutuallyExclusiveFieldsMessage = (fields) => `Provide only one of ${fields.join(" or ")}.`;
|
|
102198
|
+
hasMutuallyExclusiveFields = (params2, fields) => fields.every((field) => params2[field] !== void 0);
|
|
102199
|
+
withAtLeastOneRequired = (schema2, fields) => ({
|
|
102200
|
+
...schema2,
|
|
102201
|
+
anyOf: fields.map((field) => ({ required: [field] }))
|
|
102202
|
+
});
|
|
102203
|
+
withMutuallyExclusiveFields = (schema2, fields) => ({
|
|
102204
|
+
...schema2,
|
|
102205
|
+
not: { required: [...fields] }
|
|
102206
|
+
});
|
|
102207
|
+
assertUpdateFields = () => (_nonUpdateFields, fields) => fields;
|
|
102208
|
+
ProjectIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ProjectIdentifier"));
|
|
102209
|
+
IssueIdentifier = NonEmptyString2.pipe(Schema_exports.brand("IssueIdentifier"));
|
|
102210
|
+
SpaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("SpaceIdentifier"));
|
|
102211
|
+
SpaceClassFilter = NonEmptyString2.pipe(Schema_exports.brand("SpaceClassFilter"));
|
|
102212
|
+
SpaceTypeIdentifier = NonEmptyString2.pipe(Schema_exports.brand("SpaceTypeIdentifier"));
|
|
102213
|
+
Email = Schema_exports.NonEmptyString.pipe(
|
|
102214
|
+
Schema_exports.check(Schema_exports.isPattern(/^[^@]+@[^@]+$/, { message: "must contain exactly one @" })),
|
|
102215
|
+
Schema_exports.brand("Email")
|
|
102216
|
+
);
|
|
102217
|
+
StatusName = NonEmptyString2.annotate({
|
|
102218
|
+
description: "Exact workflow status display name. Status names are workspace data, not a fixed enum; use the relevant workflow-status listing tool to discover valid values."
|
|
102219
|
+
}).pipe(Schema_exports.brand("StatusName"));
|
|
102220
|
+
PersonName = NonEmptyString2.pipe(Schema_exports.brand("PersonName"));
|
|
102221
|
+
PersonLocator = NonEmptyString2.pipe(Schema_exports.brand("PersonLocator")).annotate({
|
|
102222
|
+
description: "Person or employee ID, exact email address, or exact Huly display name."
|
|
102223
|
+
});
|
|
102224
|
+
PersonRefInput = Schema_exports.Union([Email, PersonName]);
|
|
102225
|
+
ComponentLabel = NonEmptyString2.pipe(Schema_exports.brand("ComponentLabel"));
|
|
102226
|
+
MilestoneLabel = NonEmptyString2.pipe(Schema_exports.brand("MilestoneLabel"));
|
|
102227
|
+
ChannelName = NonEmptyString2.pipe(Schema_exports.brand("ChannelName"));
|
|
102228
|
+
RoomName = NonEmptyString2.pipe(Schema_exports.brand("RoomName")).annotate({
|
|
102229
|
+
identifier: "RoomName",
|
|
102230
|
+
title: "RoomName",
|
|
102231
|
+
description: "Non-empty virtual-office room name."
|
|
102232
|
+
});
|
|
102233
|
+
MimeType = NonEmptyString2.pipe(Schema_exports.brand("MimeType"));
|
|
102234
|
+
ObjectClassName = NonEmptyString2.pipe(Schema_exports.brand("ObjectClassName"));
|
|
102235
|
+
EmojiCode = NonEmptyString2.pipe(Schema_exports.brand("EmojiCode"));
|
|
102236
|
+
ContactProvider = NonEmptyString2.pipe(Schema_exports.brand("ContactProvider"));
|
|
102237
|
+
NotificationProviderId = NonEmptyString2.pipe(Schema_exports.brand("NotificationProviderId"));
|
|
102238
|
+
NotificationTypeId = NonEmptyString2.pipe(Schema_exports.brand("NotificationTypeId"));
|
|
102239
|
+
WorkspaceName = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceName"));
|
|
102240
|
+
UrlString = NonEmptyString2.pipe(Schema_exports.brand("UrlString"));
|
|
102241
|
+
WorkspaceUrlSlug = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceUrlSlug"));
|
|
102242
|
+
WorkspaceVersion = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceVersion"));
|
|
102243
|
+
WorkspaceMode = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceMode"));
|
|
102244
|
+
WorkspaceUuid = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceUuid"));
|
|
102245
|
+
PersonUuid = NonEmptyString2.pipe(Schema_exports.brand("PersonUuid"));
|
|
102246
|
+
AccountId = NonEmptyString2.pipe(Schema_exports.brand("AccountId"));
|
|
102247
|
+
AccountUuid = Schema_exports.String.check(Schema_exports.isUUID()).pipe(Schema_exports.brand("AccountUuid"));
|
|
102248
|
+
SessionId = NonEmptyString2.pipe(Schema_exports.brand("SessionId"));
|
|
102249
|
+
RegionId = Schema_exports.String.pipe(Schema_exports.brand("RegionId"));
|
|
102250
|
+
NonNegativeNumber = Schema_exports.Number.check(Schema_exports.isGreaterThanOrEqualTo(0)).pipe(
|
|
102251
|
+
Schema_exports.brand("NonNegativeNumber")
|
|
102252
|
+
);
|
|
102253
|
+
PositiveNumber = NonNegativeNumber.check(Schema_exports.isGreaterThan(0)).pipe(Schema_exports.brand("PositiveNumber"));
|
|
102254
|
+
VirtualOfficeCoordinate = Schema_exports.Number.pipe(Schema_exports.brand("VirtualOfficeCoordinate")).annotate({
|
|
102255
|
+
identifier: "VirtualOfficeCoordinate",
|
|
102256
|
+
title: "VirtualOfficeCoordinate",
|
|
102257
|
+
description: "Coordinate in Huly virtual-office layout space."
|
|
102258
|
+
});
|
|
102259
|
+
VirtualOfficeDimension = NonNegativeNumber.pipe(Schema_exports.brand("VirtualOfficeDimension")).annotate({
|
|
102260
|
+
identifier: "VirtualOfficeDimension",
|
|
102261
|
+
title: "VirtualOfficeDimension",
|
|
102262
|
+
description: "Non-negative dimension in Huly virtual-office layout space."
|
|
102263
|
+
});
|
|
102264
|
+
BlurRadius = NonNegativeNumber.pipe(Schema_exports.brand("BlurRadius")).annotate({
|
|
102265
|
+
identifier: "BlurRadius",
|
|
102266
|
+
title: "BlurRadius",
|
|
102267
|
+
description: "Non-negative virtual-office video blur radius."
|
|
102268
|
+
});
|
|
102269
|
+
TimeZoneId = NonEmptyString2.pipe(Schema_exports.brand("TimeZoneId")).annotate({
|
|
102270
|
+
identifier: "TimeZoneId",
|
|
102271
|
+
title: "TimeZoneId",
|
|
102272
|
+
description: "IANA time zone identifier."
|
|
102273
|
+
});
|
|
102274
|
+
DurationMinutes = NonNegativeInteger.pipe(Schema_exports.brand("DurationMinutes")).annotate({
|
|
102275
|
+
identifier: "DurationMinutes",
|
|
102276
|
+
title: "DurationMinutes",
|
|
102277
|
+
description: "Duration expressed in whole minutes."
|
|
102278
|
+
});
|
|
102279
|
+
PositiveDurationMinutes = PositiveInteger.pipe(Schema_exports.brand("PositiveDurationMinutes")).annotate({
|
|
102280
|
+
identifier: "PositiveDurationMinutes",
|
|
102281
|
+
title: "PositiveDurationMinutes",
|
|
102282
|
+
description: "Positive duration expressed in whole minutes."
|
|
102283
|
+
});
|
|
102284
|
+
HOURS_PER_DAY = 24;
|
|
102285
|
+
MINUTES_PER_HOUR = 60;
|
|
102286
|
+
MINUTES_PER_DAY = HOURS_PER_DAY * MINUTES_PER_HOUR;
|
|
102287
|
+
MinuteOfDay = NonNegativeInteger.pipe(
|
|
102288
|
+
Schema_exports.check(Schema_exports.isLessThanOrEqualTo(MINUTES_PER_DAY)),
|
|
102289
|
+
Schema_exports.brand("MinuteOfDay")
|
|
102290
|
+
).annotate({
|
|
102291
|
+
identifier: "MinuteOfDay",
|
|
102292
|
+
title: "MinuteOfDay",
|
|
102293
|
+
description: "Minute offset within a day, from 0 through 1440."
|
|
102294
|
+
});
|
|
102295
|
+
ColorCode = Schema_exports.Int.pipe(
|
|
102296
|
+
Schema_exports.check(Schema_exports.isGreaterThanOrEqualTo(0), Schema_exports.isLessThanOrEqualTo(MAX_COLOR_INDEX)),
|
|
102297
|
+
Schema_exports.brand("ColorCode")
|
|
102298
|
+
).annotate({ title: "ColorCode", description: `Huly platform color palette index, from 0 through ${MAX_COLOR_INDEX}.` });
|
|
102299
|
+
ComponentIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ComponentIdentifier"));
|
|
102300
|
+
MilestoneIdentifier = NonEmptyString2.pipe(Schema_exports.brand("MilestoneIdentifier"));
|
|
102301
|
+
TemplateIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TemplateIdentifier"));
|
|
102302
|
+
ChannelIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ChannelIdentifier"));
|
|
102303
|
+
DirectMessageIdentifier = NonEmptyString2.pipe(Schema_exports.brand("DirectMessageIdentifier"));
|
|
102304
|
+
TeamspaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TeamspaceIdentifier"));
|
|
102305
|
+
CardIdentifier = NonEmptyString2.pipe(Schema_exports.brand("CardIdentifier"));
|
|
102306
|
+
CardSpaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("CardSpaceIdentifier"));
|
|
102307
|
+
DocumentIdentifier = NonEmptyString2.pipe(Schema_exports.brand("DocumentIdentifier"));
|
|
102308
|
+
MasterTagIdentifier = NonEmptyString2.pipe(Schema_exports.brand("MasterTagIdentifier"));
|
|
102309
|
+
TagIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TagIdentifier"));
|
|
102310
|
+
TagCategoryIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TagCategoryIdentifier"));
|
|
102311
|
+
WorkflowStatusIdentifier = NonEmptyString2.pipe(Schema_exports.brand("WorkflowStatusIdentifier"));
|
|
102312
|
+
StatusCategoryIdentifier = NonEmptyString2.pipe(Schema_exports.brand("StatusCategoryIdentifier"));
|
|
102313
|
+
HulyAttributeIdentifier = NonEmptyString2.pipe(Schema_exports.brand("HulyAttributeIdentifier"));
|
|
102314
|
+
InventoryCategoryIdentifier = NonEmptyString2.pipe(Schema_exports.brand("InventoryCategoryIdentifier"));
|
|
102315
|
+
InventoryProductIdentifier = NonEmptyString2.pipe(Schema_exports.brand("InventoryProductIdentifier"));
|
|
102316
|
+
InventoryVariantIdentifier = NonEmptyString2.pipe(Schema_exports.brand("InventoryVariantIdentifier"));
|
|
102317
|
+
MemberReference = NonEmptyString2.pipe(Schema_exports.brand("MemberReference"));
|
|
102318
|
+
TestProjectIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestProjectIdentifier"));
|
|
102319
|
+
TestSuiteIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestSuiteIdentifier"));
|
|
102320
|
+
TestCaseIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestCaseIdentifier"));
|
|
102321
|
+
TestPlanIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestPlanIdentifier"));
|
|
102322
|
+
TestRunIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestRunIdentifier"));
|
|
102323
|
+
TestResultIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestResultIdentifier"));
|
|
102324
|
+
}
|
|
102325
|
+
});
|
|
102326
|
+
|
|
102327
|
+
// src/mcp/http-admission-observations.ts
|
|
102328
|
+
var import_node_diagnostics_channel, HTTP_ADMISSION_SCOPE, HTTP_ADMISSION_CHANNEL, LifecycleObservationSchema, ClientAcquisitionObservationSchema, HttpLeaseObservationSchema, ShutdownObservationSchema, HttpAdmissionObservationSchema, admissionObservationsEnabled, observeHttpAdmission;
|
|
102329
|
+
var init_http_admission_observations = __esm({
|
|
102330
|
+
"src/mcp/http-admission-observations.ts"() {
|
|
102331
|
+
"use strict";
|
|
102332
|
+
init_dist();
|
|
102333
|
+
import_node_diagnostics_channel = require("node:diagnostics_channel");
|
|
102334
|
+
init_shared();
|
|
102335
|
+
HTTP_ADMISSION_SCOPE = "http-transport-admission";
|
|
102336
|
+
HTTP_ADMISSION_CHANNEL = `huly.${HTTP_ADMISSION_SCOPE}`;
|
|
102337
|
+
LifecycleObservationSchema = Schema_exports.TaggedUnion({
|
|
102338
|
+
createRequestAdmission: {},
|
|
102339
|
+
RequestAdmission_enter: { admitted: Schema_exports.Boolean },
|
|
102340
|
+
RequestLease_release: { active: Count },
|
|
102341
|
+
RequestAdmission_quiesce: { drained: Schema_exports.Boolean },
|
|
102342
|
+
createRequestClientLifecycle: {},
|
|
102343
|
+
RequestClientLifecycle_resolve: { closed: Schema_exports.Boolean },
|
|
102344
|
+
RequestClientLifecycle_acquireSettles: { rejected: Schema_exports.Boolean },
|
|
102345
|
+
RequestClientLifecycle_close: { firstClose: Schema_exports.Boolean },
|
|
102346
|
+
RequestClientLifecycle_leaseCloseSettles: { failed: Schema_exports.Boolean },
|
|
102347
|
+
attachRequestClientLifecycle: {},
|
|
102348
|
+
Server_onclose: {},
|
|
102349
|
+
Server_closeStarts: {},
|
|
102350
|
+
Server_close: { underlyingFails: Schema_exports.Boolean, leaseCloseFails: Schema_exports.Boolean },
|
|
102351
|
+
createClientResolver: {},
|
|
102352
|
+
ClientResolver_resolve: { startedAcquisition: Schema_exports.Boolean },
|
|
102353
|
+
ClientResolver_close: { firstClose: Schema_exports.Boolean },
|
|
102354
|
+
McpServerCloseTracker_closeSettles: { failed: Schema_exports.Boolean },
|
|
102355
|
+
createMountedMcpHttpHandler: {
|
|
102356
|
+
loopback: Schema_exports.Boolean,
|
|
102357
|
+
token: Schema_exports.Literals(["NoToken", "BlankToken", "SecretToken"])
|
|
102358
|
+
},
|
|
102359
|
+
createMountedMcpHttpHandler_fetch: {
|
|
102360
|
+
hostOk: Schema_exports.Boolean,
|
|
102361
|
+
originOk: Schema_exports.Boolean,
|
|
102362
|
+
bearer: Schema_exports.Literals(["NoBearer", "MalformedAuthorization", "MatchingBearer", "WrongBearer"]),
|
|
102363
|
+
dispatched: Schema_exports.Boolean
|
|
102364
|
+
},
|
|
102365
|
+
createMountedMcpHttpHandler_fetchSettles: {},
|
|
102366
|
+
createMountedMcpHttpHandler_fetchRejectedDuringShutdown: {},
|
|
102367
|
+
createMountedMcpHttpHandler_close: {},
|
|
102368
|
+
startHttpTransport: { bindOk: Schema_exports.Boolean }
|
|
102369
|
+
});
|
|
102370
|
+
ClientAcquisitionObservationSchema = Schema_exports.Union([
|
|
102371
|
+
Schema_exports.Struct({
|
|
102372
|
+
_tag: Schema_exports.Literal("buildScopedClientBundle"),
|
|
102373
|
+
outcome: Schema_exports.Literals(["Succeeded", "FailedFatal"]),
|
|
102374
|
+
evicted: Schema_exports.Literal(false)
|
|
102375
|
+
}),
|
|
102376
|
+
Schema_exports.Struct({
|
|
102377
|
+
_tag: Schema_exports.Literal("buildScopedClientBundle"),
|
|
102378
|
+
outcome: Schema_exports.Literal("FailedRecoverable"),
|
|
102379
|
+
evicted: Schema_exports.Boolean
|
|
102380
|
+
})
|
|
102381
|
+
]);
|
|
102382
|
+
HttpLeaseObservationSchema = Schema_exports.Union([
|
|
102383
|
+
Schema_exports.Struct({
|
|
102384
|
+
_tag: Schema_exports.Literal("createHttpClientLeaseResolver"),
|
|
102385
|
+
headers: Schema_exports.Literal("InvalidHulyHeaders"),
|
|
102386
|
+
succeeded: Schema_exports.Literal(false)
|
|
102387
|
+
}),
|
|
102388
|
+
Schema_exports.Struct({
|
|
102389
|
+
_tag: Schema_exports.Literal("createHttpClientLeaseResolver"),
|
|
102390
|
+
headers: Schema_exports.Literal("NoHulyHeaders"),
|
|
102391
|
+
succeeded: Schema_exports.Boolean
|
|
102392
|
+
}),
|
|
102393
|
+
Schema_exports.Struct({
|
|
102394
|
+
_tag: Schema_exports.Literal("createHttpClientLeaseResolver"),
|
|
102395
|
+
headers: Schema_exports.Literal("ValidHulyHeaders"),
|
|
102396
|
+
buildOk: Schema_exports.Literal(true),
|
|
102397
|
+
succeeded: Schema_exports.Literal(true)
|
|
102398
|
+
}),
|
|
102399
|
+
Schema_exports.Struct({
|
|
102400
|
+
_tag: Schema_exports.Literal("createHttpClientLeaseResolver"),
|
|
102401
|
+
headers: Schema_exports.Literal("ValidHulyHeaders"),
|
|
102402
|
+
buildOk: Schema_exports.Literal(false),
|
|
102403
|
+
succeeded: Schema_exports.Literal(false)
|
|
102404
|
+
})
|
|
102405
|
+
]);
|
|
102406
|
+
ShutdownObservationSchema = Schema_exports.Union([
|
|
102407
|
+
Schema_exports.Struct({
|
|
102408
|
+
_tag: Schema_exports.Literal("createMountedMcpHttpHandler_closeSettles"),
|
|
102409
|
+
timedOut: Schema_exports.Literal(true),
|
|
102410
|
+
failed: Schema_exports.Literal(false)
|
|
102411
|
+
}),
|
|
102412
|
+
Schema_exports.Struct({
|
|
102413
|
+
_tag: Schema_exports.Literal("createMountedMcpHttpHandler_closeSettles"),
|
|
102414
|
+
timedOut: Schema_exports.Literal(false),
|
|
102415
|
+
failed: Schema_exports.Boolean
|
|
102416
|
+
})
|
|
102417
|
+
]);
|
|
102418
|
+
HttpAdmissionObservationSchema = Schema_exports.Union([
|
|
102419
|
+
LifecycleObservationSchema,
|
|
102420
|
+
ClientAcquisitionObservationSchema,
|
|
102421
|
+
HttpLeaseObservationSchema,
|
|
102422
|
+
ShutdownObservationSchema
|
|
102423
|
+
]);
|
|
102424
|
+
admissionObservationsEnabled = () => (0, import_node_diagnostics_channel.hasSubscribers)(HTTP_ADMISSION_CHANNEL);
|
|
102425
|
+
observeHttpAdmission = (action, fields) => {
|
|
102426
|
+
if (!admissionObservationsEnabled()) return;
|
|
102427
|
+
const resolved2 = Object.fromEntries(
|
|
102428
|
+
Object.entries(fields).map(([name, value3]) => [name, typeof value3 === "function" ? value3() : value3])
|
|
102429
|
+
);
|
|
102430
|
+
const observation = Schema_exports.decodeUnknownSync(HttpAdmissionObservationSchema)({ _tag: action, ...resolved2 });
|
|
102431
|
+
(0, import_node_diagnostics_channel.channel)(HTTP_ADMISSION_CHANNEL).publish(observation);
|
|
102432
|
+
};
|
|
102433
|
+
}
|
|
102434
|
+
});
|
|
102435
|
+
|
|
101823
102436
|
// src/mcp/http-defaults.ts
|
|
101824
102437
|
var DEFAULT_HTTP_PORT_NUMBER, DEFAULT_HTTP_HOST_VALUE;
|
|
101825
102438
|
var init_http_defaults = __esm({
|
|
@@ -101831,7 +102444,7 @@ var init_http_defaults = __esm({
|
|
|
101831
102444
|
});
|
|
101832
102445
|
|
|
101833
102446
|
// src/mcp/http-transport.ts
|
|
101834
|
-
var import_node_crypto, import_node_http, MIN_HTTP_PORT, MAX_HTTP_PORT, HTTP_UNAUTHORIZED_ERROR_CODE, HTTP_UNAUTHORIZED, DEFAULT_HTTP_SHUTDOWN_GRACE_PERIOD, HttpPort, HttpHost, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, UnauthorizedJsonRpcResponse, UNAUTHORIZED_JSON_RPC_RESPONSE, writeStderr, HttpTransportError, httpServeError, defaultHttpServerFactory, HttpServerFactoryService, activeAuthToken, extractBearerToken, tokenMatches, isAuthorizedMcpRequest, unauthorizedResponse, createMcpServerCloseTracker, createMountedMcpHttpHandler, createMcpHttpApp, formatHttpAddress, startHttpTransport;
|
|
102447
|
+
var import_node_crypto, import_node_http, MIN_HTTP_PORT, HTTP_SERVICE_UNAVAILABLE, MAX_HTTP_PORT, HTTP_UNAUTHORIZED_ERROR_CODE, HTTP_UNAUTHORIZED, DEFAULT_HTTP_SHUTDOWN_GRACE_PERIOD, HttpPort, HttpHost, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, UnauthorizedJsonRpcResponse, UNAUTHORIZED_JSON_RPC_RESPONSE, writeStderr, HttpTransportError, httpServeError, defaultHttpServerFactory, HttpServerFactoryService, activeAuthToken, extractBearerToken, tokenMatches, isAuthorizedMcpRequest, unauthorizedResponse, createMcpServerCloseTracker, createMountedMcpHttpHandler, createMcpHttpApp, formatHttpAddress, startHttpTransport;
|
|
101835
102448
|
var init_http_transport = __esm({
|
|
101836
102449
|
"src/mcp/http-transport.ts"() {
|
|
101837
102450
|
"use strict";
|
|
@@ -101841,8 +102454,10 @@ var init_http_transport = __esm({
|
|
|
101841
102454
|
init_dist3();
|
|
101842
102455
|
init_dist();
|
|
101843
102456
|
init_http();
|
|
102457
|
+
init_http_admission_observations();
|
|
101844
102458
|
init_http_defaults();
|
|
101845
102459
|
MIN_HTTP_PORT = 0;
|
|
102460
|
+
HTTP_SERVICE_UNAVAILABLE = 503;
|
|
101846
102461
|
MAX_HTTP_PORT = 65535;
|
|
101847
102462
|
HTTP_UNAUTHORIZED_ERROR_CODE = -32e3;
|
|
101848
102463
|
HTTP_UNAUTHORIZED = 401;
|
|
@@ -101932,10 +102547,14 @@ var init_http_transport = __esm({
|
|
|
101932
102547
|
closePromise = closing;
|
|
101933
102548
|
pending.add(closing);
|
|
101934
102549
|
void closing.then(
|
|
101935
|
-
() =>
|
|
102550
|
+
() => {
|
|
102551
|
+
pending.delete(closing);
|
|
102552
|
+
observeHttpAdmission("McpServerCloseTracker_closeSettles", { failed: false });
|
|
102553
|
+
},
|
|
101936
102554
|
(error3) => {
|
|
101937
102555
|
pending.delete(closing);
|
|
101938
102556
|
failures.push(error3);
|
|
102557
|
+
observeHttpAdmission("McpServerCloseTracker_closeSettles", { failed: true });
|
|
101939
102558
|
}
|
|
101940
102559
|
);
|
|
101941
102560
|
return closing;
|
|
@@ -101955,34 +102574,85 @@ var init_http_transport = __esm({
|
|
|
101955
102574
|
};
|
|
101956
102575
|
const closeTracker = createMcpServerCloseTracker(createServer2);
|
|
101957
102576
|
const activeRequests = /* @__PURE__ */ new Set();
|
|
102577
|
+
let shutdownState = { phase: "Serving" };
|
|
101958
102578
|
const mcpHandler = createMcpHandler(closeTracker.factory, { legacy: "stateless", onerror: reportError });
|
|
101959
102579
|
const protectLocalhost = host === "127.0.0.1" || host === "localhost" || host === "::1";
|
|
102580
|
+
observeHttpAdmission("createMountedMcpHttpHandler", {
|
|
102581
|
+
loopback: protectLocalhost,
|
|
102582
|
+
token: () => {
|
|
102583
|
+
if (authToken === void 0) return "NoToken";
|
|
102584
|
+
return activeAuthToken(Redacted_exports.value(authToken)) === void 0 ? "BlankToken" : "SecretToken";
|
|
102585
|
+
}
|
|
102586
|
+
});
|
|
102587
|
+
const reportCloseSettlement = (failed) => {
|
|
102588
|
+
if (shutdownState.phase !== "Draining") return;
|
|
102589
|
+
observeHttpAdmission("createMountedMcpHttpHandler_closeSettles", { timedOut: false, failed });
|
|
102590
|
+
shutdownState = { phase: "Closed", close: shutdownState.close };
|
|
102591
|
+
};
|
|
102592
|
+
const closeHandler = () => {
|
|
102593
|
+
if (shutdownState.phase === "TimedOut") return Promise.resolve();
|
|
102594
|
+
if (shutdownState.phase !== "Serving") return shutdownState.close;
|
|
102595
|
+
const closing = Promise.resolve().then(async () => {
|
|
102596
|
+
observeHttpAdmission("createMountedMcpHttpHandler_close", {});
|
|
102597
|
+
await mcpHandler.close();
|
|
102598
|
+
while (activeRequests.size > 0) await Promise.allSettled([...activeRequests]);
|
|
102599
|
+
await closeTracker.drain();
|
|
102600
|
+
reportCloseSettlement(false);
|
|
102601
|
+
});
|
|
102602
|
+
shutdownState = { phase: "Draining", close: closing };
|
|
102603
|
+
return closing;
|
|
102604
|
+
};
|
|
101960
102605
|
return {
|
|
101961
102606
|
fetch: async (request4) => {
|
|
102607
|
+
const observed = {
|
|
102608
|
+
hostOk: () => hostHeaderValidationResponse(request4, localhostAllowedHostnames()) === void 0,
|
|
102609
|
+
originOk: () => originValidationResponse(request4, localhostAllowedOrigins()) === void 0,
|
|
102610
|
+
bearer: () => {
|
|
102611
|
+
const authorization = request4.headers.get("authorization");
|
|
102612
|
+
const received = extractBearerToken(authorization);
|
|
102613
|
+
if (received === void 0) return authorization === null ? "NoBearer" : "MalformedAuthorization";
|
|
102614
|
+
const expected = activeAuthToken(authToken === void 0 ? void 0 : Redacted_exports.value(authToken));
|
|
102615
|
+
return expected !== void 0 && tokenMatches(received, expected) ? "MatchingBearer" : "WrongBearer";
|
|
102616
|
+
}
|
|
102617
|
+
};
|
|
101962
102618
|
const rejected = protectLocalhost ? hostHeaderValidationResponse(request4, localhostAllowedHostnames()) ?? originValidationResponse(request4, localhostAllowedOrigins()) : void 0;
|
|
101963
|
-
if (rejected !== void 0)
|
|
102619
|
+
if (rejected !== void 0) {
|
|
102620
|
+
observeHttpAdmission("createMountedMcpHttpHandler_fetch", { ...observed, dispatched: false });
|
|
102621
|
+
return rejected;
|
|
102622
|
+
}
|
|
101964
102623
|
if (!isAuthorizedMcpRequest(request4, authToken === void 0 ? void 0 : Redacted_exports.value(authToken))) {
|
|
102624
|
+
observeHttpAdmission("createMountedMcpHttpHandler_fetch", { ...observed, dispatched: false });
|
|
101965
102625
|
return unauthorizedResponse();
|
|
101966
102626
|
}
|
|
102627
|
+
if (shutdownState.phase !== "Serving") {
|
|
102628
|
+
observeHttpAdmission("createMountedMcpHttpHandler_fetchRejectedDuringShutdown", {});
|
|
102629
|
+
return new Response(null, { status: HTTP_SERVICE_UNAVAILABLE });
|
|
102630
|
+
}
|
|
102631
|
+
observeHttpAdmission("createMountedMcpHttpHandler_fetch", { ...observed, dispatched: true });
|
|
101967
102632
|
const response = mcpHandler.fetch(request4);
|
|
101968
102633
|
activeRequests.add(response);
|
|
101969
102634
|
try {
|
|
101970
102635
|
return await response;
|
|
101971
102636
|
} finally {
|
|
101972
102637
|
activeRequests.delete(response);
|
|
102638
|
+
observeHttpAdmission("createMountedMcpHttpHandler_fetchSettles", {});
|
|
101973
102639
|
}
|
|
101974
102640
|
},
|
|
101975
102641
|
close: Effect_exports.tryPromise({
|
|
101976
|
-
try:
|
|
101977
|
-
|
|
101978
|
-
|
|
101979
|
-
|
|
101980
|
-
}
|
|
101981
|
-
catch: (cause) => new HttpTransportError({ message: "MCP HTTP handler shutdown failed", cause })
|
|
102642
|
+
try: closeHandler,
|
|
102643
|
+
catch: (cause) => {
|
|
102644
|
+
reportCloseSettlement(true);
|
|
102645
|
+
return new HttpTransportError({ message: "MCP HTTP handler shutdown failed", cause });
|
|
102646
|
+
}
|
|
101982
102647
|
}).pipe(
|
|
101983
102648
|
Effect_exports.timeoutOrElse({
|
|
101984
102649
|
duration: shutdownGracePeriod,
|
|
101985
|
-
orElse: () => Effect_exports.sync(() =>
|
|
102650
|
+
orElse: () => Effect_exports.sync(() => {
|
|
102651
|
+
if (shutdownState.phase !== "Draining") return;
|
|
102652
|
+
shutdownState = { phase: "TimedOut", close: shutdownState.close };
|
|
102653
|
+
observeHttpAdmission("createMountedMcpHttpHandler_closeSettles", { timedOut: true, failed: false });
|
|
102654
|
+
writeError("MCP HTTP handler shutdown timed out\n");
|
|
102655
|
+
})
|
|
101986
102656
|
})
|
|
101987
102657
|
)
|
|
101988
102658
|
};
|
|
@@ -102003,10 +102673,17 @@ var init_http_transport = __esm({
|
|
|
102003
102673
|
config2.host,
|
|
102004
102674
|
config2.shutdownGracePeriod
|
|
102005
102675
|
);
|
|
102006
|
-
|
|
102007
|
-
|
|
102676
|
+
const closeMounted = mounted.close.pipe(
|
|
102677
|
+
Effect_exports.catch(() => Effect_exports.sync(() => writeError("MCP HTTP handler shutdown failed\n")))
|
|
102678
|
+
);
|
|
102679
|
+
const server = yield* factory.make(config2.port, config2.host).pipe(
|
|
102680
|
+
Effect_exports.tapError(() => Effect_exports.sync(() => observeHttpAdmission("startHttpTransport", { bindOk: false }))),
|
|
102681
|
+
Effect_exports.onError(() => closeMounted)
|
|
102682
|
+
);
|
|
102683
|
+
yield* Effect_exports.sync(() => observeHttpAdmission("startHttpTransport", { bindOk: true }));
|
|
102008
102684
|
const app = yield* createMcpHttpApp(mounted);
|
|
102009
|
-
yield* server.serve(app);
|
|
102685
|
+
yield* server.serve(app).pipe(Effect_exports.onError(() => closeMounted));
|
|
102686
|
+
yield* Effect_exports.addFinalizer(() => closeMounted);
|
|
102010
102687
|
yield* config2.onReady?.() ?? Effect_exports.void;
|
|
102011
102688
|
yield* Effect_exports.sync(() => {
|
|
102012
102689
|
writeError(`MCP HTTP server listening on ${formatHttpAddress(server.address)}
|
|
@@ -102140,8 +102817,8 @@ function serveStdio(factory, options = {}) {
|
|
|
102140
102817
|
reportError(/* @__PURE__ */ new Error(`Rejected 2025-era request on a modern-only stdio connection (${rejection2.cell}): ${rejection2.message}`));
|
|
102141
102818
|
return writeErrorResponse(request4.id, rejection2.code, rejection2.message, rejection2.data);
|
|
102142
102819
|
};
|
|
102143
|
-
const onInstanceClosed = (
|
|
102144
|
-
if (closing ||
|
|
102820
|
+
const onInstanceClosed = (channel2) => {
|
|
102821
|
+
if (closing || channel2 === discarding) return;
|
|
102145
102822
|
closeAll();
|
|
102146
102823
|
};
|
|
102147
102824
|
const connectInstance = async (era, revision) => {
|
|
@@ -102152,11 +102829,11 @@ function serveStdio(factory, options = {}) {
|
|
|
102152
102829
|
installModernOnlyHandlers(server, SUPPORTED_MODERN_PROTOCOL_VERSIONS);
|
|
102153
102830
|
listenRouter.setServerCapabilities(server.getCapabilities(), serverIdentityOf(server));
|
|
102154
102831
|
}
|
|
102155
|
-
const
|
|
102156
|
-
await product2.connect(
|
|
102832
|
+
const channel2 = new StdioConnectionChannel(wire, () => onInstanceClosed(channel2), era === "modern" ? modernOutboundIntercept : void 0);
|
|
102833
|
+
await product2.connect(channel2);
|
|
102157
102834
|
return {
|
|
102158
102835
|
product: product2,
|
|
102159
|
-
channel
|
|
102836
|
+
channel: channel2
|
|
102160
102837
|
};
|
|
102161
102838
|
};
|
|
102162
102839
|
const disposeLateInstance = (instance) => instance.product.close().catch((error3) => reportError(toError3(error3)));
|
|
@@ -102509,510 +103186,6 @@ var init_stdio = __esm({
|
|
|
102509
103186
|
}
|
|
102510
103187
|
});
|
|
102511
103188
|
|
|
102512
|
-
// src/domain/schemas/json-schema.ts
|
|
102513
|
-
var DRAFT_07_DEFINITIONS_REF, MCP_DEFINITIONS_REF, restoreMcpDefinitionRef, JsonSchemaObjectSchema, JsonArraySchema, parseJsonObject, restoreMcpDefinitionRefsInJson, restoreMcpDefinitionRefs, FLATTENABLE_ALLOF_KEYS, flattenScalarAllOf, annotatedAstDescription, checkedAstDescription, directAstDescription, astDescription, astAuthoredJsonSchema, restoreUnionDescriptions, restorePropertyDescription, restoreObjectDescriptions, restoreArrayDescriptions, restoreAstPropertyDescriptions, toDraft07JsonSchema, toDraft07EmptyObjectJsonSchema, JsonSchemaRecordSchema, parseJsonSchemaRecord, withJsonSchemaPropertyDescriptions, withJsonSchemaUnionPropertyDescriptions, withExactlyOneRequired;
|
|
102514
|
-
var init_json_schema2 = __esm({
|
|
102515
|
-
"src/domain/schemas/json-schema.ts"() {
|
|
102516
|
-
"use strict";
|
|
102517
|
-
init_dist();
|
|
102518
|
-
DRAFT_07_DEFINITIONS_REF = "#/definitions";
|
|
102519
|
-
MCP_DEFINITIONS_REF = "#/$defs";
|
|
102520
|
-
restoreMcpDefinitionRef = (ref) => ref === DRAFT_07_DEFINITIONS_REF || ref.startsWith(`${DRAFT_07_DEFINITIONS_REF}/`) ? `${MCP_DEFINITIONS_REF}${ref.slice(DRAFT_07_DEFINITIONS_REF.length)}` : ref;
|
|
102521
|
-
JsonSchemaObjectSchema = Schema_exports.Record(Schema_exports.String, Schema_exports.Json);
|
|
102522
|
-
JsonArraySchema = Schema_exports.Array(Schema_exports.Json);
|
|
102523
|
-
parseJsonObject = (value3) => {
|
|
102524
|
-
try {
|
|
102525
|
-
return Schema_exports.decodeUnknownSync(JsonSchemaObjectSchema)(value3);
|
|
102526
|
-
} catch {
|
|
102527
|
-
return void 0;
|
|
102528
|
-
}
|
|
102529
|
-
};
|
|
102530
|
-
restoreMcpDefinitionRefsInJson = (value3) => {
|
|
102531
|
-
if (Array.isArray(value3)) {
|
|
102532
|
-
return Schema_exports.decodeUnknownSync(JsonArraySchema)(value3).map(restoreMcpDefinitionRefsInJson);
|
|
102533
|
-
}
|
|
102534
|
-
if (typeof value3 !== "object" || value3 === null) return value3;
|
|
102535
|
-
return Object.fromEntries(
|
|
102536
|
-
Object.entries(value3).map(([key, nested3]) => [
|
|
102537
|
-
key,
|
|
102538
|
-
key === "$ref" && typeof nested3 === "string" ? restoreMcpDefinitionRef(nested3) : restoreMcpDefinitionRefsInJson(nested3)
|
|
102539
|
-
])
|
|
102540
|
-
);
|
|
102541
|
-
};
|
|
102542
|
-
restoreMcpDefinitionRefs = (schema2) => {
|
|
102543
|
-
const parsed = Schema_exports.decodeUnknownSync(JsonSchemaObjectSchema)(schema2);
|
|
102544
|
-
return Object.fromEntries(
|
|
102545
|
-
Object.entries(parsed).map(([key, value3]) => [
|
|
102546
|
-
key,
|
|
102547
|
-
key === "$ref" && typeof value3 === "string" ? restoreMcpDefinitionRef(value3) : restoreMcpDefinitionRefsInJson(value3)
|
|
102548
|
-
])
|
|
102549
|
-
);
|
|
102550
|
-
};
|
|
102551
|
-
FLATTENABLE_ALLOF_KEYS = /* @__PURE__ */ new Set([
|
|
102552
|
-
"description",
|
|
102553
|
-
"exclusiveMaximum",
|
|
102554
|
-
"exclusiveMinimum",
|
|
102555
|
-
"format",
|
|
102556
|
-
"maxItems",
|
|
102557
|
-
"maxLength",
|
|
102558
|
-
"maximum",
|
|
102559
|
-
"minItems",
|
|
102560
|
-
"minLength",
|
|
102561
|
-
"minimum",
|
|
102562
|
-
"multipleOf",
|
|
102563
|
-
"pattern",
|
|
102564
|
-
"title",
|
|
102565
|
-
"uniqueItems"
|
|
102566
|
-
]);
|
|
102567
|
-
flattenScalarAllOf = (value3) => {
|
|
102568
|
-
if (Array.isArray(value3)) return Schema_exports.decodeUnknownSync(JsonArraySchema)(value3).map(flattenScalarAllOf);
|
|
102569
|
-
if (typeof value3 !== "object" || value3 === null) return value3;
|
|
102570
|
-
const record3 = Schema_exports.decodeUnknownSync(JsonSchemaObjectSchema)(value3);
|
|
102571
|
-
const recursivelyNormalized = Object.fromEntries(
|
|
102572
|
-
Object.entries(record3).map(([key, nested3]) => [key, flattenScalarAllOf(nested3)])
|
|
102573
|
-
);
|
|
102574
|
-
const allOf = recursivelyNormalized.allOf;
|
|
102575
|
-
if (!Array.isArray(allOf)) return recursivelyNormalized;
|
|
102576
|
-
const members = Schema_exports.decodeUnknownSync(JsonArraySchema)(allOf).map(parseJsonObject);
|
|
102577
|
-
if (members.some(
|
|
102578
|
-
(member) => member === void 0 || Object.keys(member).some((key) => !FLATTENABLE_ALLOF_KEYS.has(key))
|
|
102579
|
-
)) {
|
|
102580
|
-
return recursivelyNormalized;
|
|
102581
|
-
}
|
|
102582
|
-
const memberKeys = members.flatMap((member) => member === void 0 ? [] : Object.keys(member));
|
|
102583
|
-
if (new Set(memberKeys).size !== memberKeys.length) return recursivelyNormalized;
|
|
102584
|
-
const merged = Object.assign({}, ...members);
|
|
102585
|
-
if (Object.keys(merged).some((key) => key in recursivelyNormalized && recursivelyNormalized[key] !== merged[key])) {
|
|
102586
|
-
return recursivelyNormalized;
|
|
102587
|
-
}
|
|
102588
|
-
const withoutAllOf = Object.fromEntries(Object.entries(recursivelyNormalized).filter(([key]) => key !== "allOf"));
|
|
102589
|
-
return { ...withoutAllOf, ...merged };
|
|
102590
|
-
};
|
|
102591
|
-
annotatedAstDescription = (ast) => {
|
|
102592
|
-
const contextDescription = ast.context === void 0 ? void 0 : ast.context.annotations?.description;
|
|
102593
|
-
const direct = contextDescription === void 0 ? ast.annotations?.description : contextDescription;
|
|
102594
|
-
return typeof direct === "string" ? direct : void 0;
|
|
102595
|
-
};
|
|
102596
|
-
checkedAstDescription = (ast) => {
|
|
102597
|
-
const checks = ast.checks === void 0 ? [] : ast.checks;
|
|
102598
|
-
const matchingCheck = checks.find((check3) => typeof check3.annotations?.description === "string");
|
|
102599
|
-
const checkDescription = matchingCheck === void 0 ? void 0 : matchingCheck.annotations?.description;
|
|
102600
|
-
return typeof checkDescription === "string" ? checkDescription : void 0;
|
|
102601
|
-
};
|
|
102602
|
-
directAstDescription = (ast) => annotatedAstDescription(ast) ?? checkedAstDescription(ast);
|
|
102603
|
-
astDescription = (ast) => {
|
|
102604
|
-
const direct = directAstDescription(ast);
|
|
102605
|
-
if (direct !== void 0) return direct;
|
|
102606
|
-
if (SchemaAST_exports.isUnion(ast)) {
|
|
102607
|
-
const members = ast.types.filter((member) => !SchemaAST_exports.isUndefined(member));
|
|
102608
|
-
const descriptions4 = members.map(astDescription).filter((description) => description !== void 0);
|
|
102609
|
-
if (members.length === 1) return descriptions4[0];
|
|
102610
|
-
if (descriptions4.length === members.length && new Set(descriptions4).size === 1) return descriptions4[0];
|
|
102611
|
-
}
|
|
102612
|
-
return void 0;
|
|
102613
|
-
};
|
|
102614
|
-
astAuthoredJsonSchema = (ast) => {
|
|
102615
|
-
const annotation = ast.context?.annotations?.jsonSchema ?? ast.annotations?.jsonSchema;
|
|
102616
|
-
return parseJsonObject(annotation);
|
|
102617
|
-
};
|
|
102618
|
-
restoreUnionDescriptions = (ast, record3) => {
|
|
102619
|
-
if (!Array.isArray(record3.anyOf)) return record3;
|
|
102620
|
-
const members = ast.types.filter((member) => !SchemaAST_exports.isUndefined(member));
|
|
102621
|
-
const anyOf = Schema_exports.decodeUnknownSync(JsonArraySchema)(record3.anyOf);
|
|
102622
|
-
return {
|
|
102623
|
-
...record3,
|
|
102624
|
-
anyOf: anyOf.map((member, index2) => {
|
|
102625
|
-
const astMember = members[index2];
|
|
102626
|
-
return astMember === void 0 ? member : restoreAstPropertyDescriptions(astMember, member);
|
|
102627
|
-
})
|
|
102628
|
-
};
|
|
102629
|
-
};
|
|
102630
|
-
restorePropertyDescription = (propertyAst, property) => {
|
|
102631
|
-
const restored = restoreAstPropertyDescriptions(propertyAst, property);
|
|
102632
|
-
const record3 = parseJsonObject(restored);
|
|
102633
|
-
const description = astDescription(propertyAst);
|
|
102634
|
-
if (description === void 0 || record3 === void 0) return restored;
|
|
102635
|
-
return record3.$ref === void 0 ? { ...record3, description: record3.description ?? description } : { allOf: [{ $ref: record3.$ref }], description };
|
|
102636
|
-
};
|
|
102637
|
-
restoreObjectDescriptions = (ast, record3) => {
|
|
102638
|
-
const properties = record3.properties === void 0 ? void 0 : parseJsonObject(record3.properties);
|
|
102639
|
-
if (properties === void 0) return record3;
|
|
102640
|
-
const signatures = new Map(ast.propertySignatures.map((signature) => [signature.name, signature.type]));
|
|
102641
|
-
return {
|
|
102642
|
-
...record3,
|
|
102643
|
-
properties: Object.fromEntries(
|
|
102644
|
-
Object.entries(properties).map(([key, property]) => {
|
|
102645
|
-
const propertyAst = signatures.get(key);
|
|
102646
|
-
return [key, propertyAst === void 0 ? property : restorePropertyDescription(propertyAst, property)];
|
|
102647
|
-
})
|
|
102648
|
-
)
|
|
102649
|
-
};
|
|
102650
|
-
};
|
|
102651
|
-
restoreArrayDescriptions = (ast, record3) => {
|
|
102652
|
-
if (record3.items === void 0) return record3;
|
|
102653
|
-
const elementAst = ast.rest[0] ?? ast.elements[0];
|
|
102654
|
-
return elementAst === void 0 ? record3 : { ...record3, items: restoreAstPropertyDescriptions(elementAst, record3.items) };
|
|
102655
|
-
};
|
|
102656
|
-
restoreAstPropertyDescriptions = (ast, jsonSchema2) => {
|
|
102657
|
-
const record3 = parseJsonObject(jsonSchema2);
|
|
102658
|
-
if (record3 === void 0) return jsonSchema2;
|
|
102659
|
-
const authored = astAuthoredJsonSchema(ast);
|
|
102660
|
-
const restoredRecord = authored === void 0 ? record3 : { ...record3, ...authored };
|
|
102661
|
-
if (SchemaAST_exports.isUnion(ast)) return restoreUnionDescriptions(ast, restoredRecord);
|
|
102662
|
-
if (SchemaAST_exports.isObjects(ast)) return restoreObjectDescriptions(ast, restoredRecord);
|
|
102663
|
-
if (SchemaAST_exports.isArrays(ast)) return restoreArrayDescriptions(ast, restoredRecord);
|
|
102664
|
-
return restoredRecord;
|
|
102665
|
-
};
|
|
102666
|
-
toDraft07JsonSchema = (schema2) => {
|
|
102667
|
-
const draft07 = JsonSchema_exports.toDocumentDraft07(Schema_exports.toJsonSchemaDocument(schema2));
|
|
102668
|
-
const definitions = Object.fromEntries(
|
|
102669
|
-
Object.entries(draft07.definitions).map(([name, definition]) => [name, restoreMcpDefinitionRefs(definition)])
|
|
102670
|
-
);
|
|
102671
|
-
const document2 = flattenScalarAllOf({
|
|
102672
|
-
$schema: JsonSchema_exports.META_SCHEMA_URI_DRAFT_07,
|
|
102673
|
-
...restoreMcpDefinitionRefs(draft07.schema),
|
|
102674
|
-
...Object.keys(definitions).length === 0 ? {} : { $defs: definitions }
|
|
102675
|
-
});
|
|
102676
|
-
return Schema_exports.decodeUnknownSync(JsonSchemaObjectSchema)(restoreAstPropertyDescriptions(schema2.ast, document2));
|
|
102677
|
-
};
|
|
102678
|
-
toDraft07EmptyObjectJsonSchema = (schema2) => {
|
|
102679
|
-
const converted = toDraft07JsonSchema(schema2);
|
|
102680
|
-
const definitions = parseJsonSchemaRecord(converted.$defs);
|
|
102681
|
-
return {
|
|
102682
|
-
$schema: converted.$schema,
|
|
102683
|
-
...definitions === void 0 ? {} : { $defs: definitions },
|
|
102684
|
-
type: "object",
|
|
102685
|
-
properties: {},
|
|
102686
|
-
additionalProperties: false
|
|
102687
|
-
};
|
|
102688
|
-
};
|
|
102689
|
-
JsonSchemaRecordSchema = Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown);
|
|
102690
|
-
parseJsonSchemaRecord = (value3) => {
|
|
102691
|
-
try {
|
|
102692
|
-
return Schema_exports.decodeUnknownSync(JsonSchemaRecordSchema)(value3);
|
|
102693
|
-
} catch {
|
|
102694
|
-
return void 0;
|
|
102695
|
-
}
|
|
102696
|
-
};
|
|
102697
|
-
withJsonSchemaPropertyDescriptions = (schema2, descriptions4) => {
|
|
102698
|
-
const properties = parseJsonSchemaRecord(parseJsonSchemaRecord(schema2)?.properties);
|
|
102699
|
-
if (properties === void 0) return schema2;
|
|
102700
|
-
return {
|
|
102701
|
-
...schema2,
|
|
102702
|
-
properties: Object.fromEntries(
|
|
102703
|
-
Object.entries(properties).map(([key, value3]) => {
|
|
102704
|
-
const description = descriptions4[key];
|
|
102705
|
-
const property = parseJsonSchemaRecord(value3);
|
|
102706
|
-
return [key, description === void 0 || property === void 0 ? value3 : { ...property, description }];
|
|
102707
|
-
})
|
|
102708
|
-
)
|
|
102709
|
-
};
|
|
102710
|
-
};
|
|
102711
|
-
withJsonSchemaUnionPropertyDescriptions = (schema2, descriptions4) => {
|
|
102712
|
-
const parsed = parseJsonSchemaRecord(schema2);
|
|
102713
|
-
if (parsed === void 0 || !Array.isArray(parsed.anyOf)) return schema2;
|
|
102714
|
-
return {
|
|
102715
|
-
...parsed,
|
|
102716
|
-
anyOf: parsed.anyOf.map((member) => {
|
|
102717
|
-
const record3 = parseJsonSchemaRecord(member);
|
|
102718
|
-
return record3 === void 0 ? member : withJsonSchemaPropertyDescriptions(record3, descriptions4);
|
|
102719
|
-
})
|
|
102720
|
-
};
|
|
102721
|
-
};
|
|
102722
|
-
withExactlyOneRequired = (schema2, fields) => ({
|
|
102723
|
-
...schema2,
|
|
102724
|
-
oneOf: fields.map((field) => ({ required: [field] }))
|
|
102725
|
-
});
|
|
102726
|
-
}
|
|
102727
|
-
});
|
|
102728
|
-
|
|
102729
|
-
// src/domain/schemas/shared-base.ts
|
|
102730
|
-
var nonEmptyTrimmedString, NonEmptyString2;
|
|
102731
|
-
var init_shared_base = __esm({
|
|
102732
|
-
"src/domain/schemas/shared-base.ts"() {
|
|
102733
|
-
"use strict";
|
|
102734
|
-
init_dist();
|
|
102735
|
-
nonEmptyTrimmedString = (annotations2) => Schema_exports.String.check(Schema_exports.isNonEmpty()).pipe(
|
|
102736
|
-
Schema_exports.annotate(annotations2 ?? {}),
|
|
102737
|
-
Schema_exports.decodeTo(Schema_exports.Trimmed.check(Schema_exports.isNonEmpty()), SchemaTransformation_exports.trim())
|
|
102738
|
-
);
|
|
102739
|
-
NonEmptyString2 = nonEmptyTrimmedString({ identifier: "NonEmptyString" });
|
|
102740
|
-
}
|
|
102741
|
-
});
|
|
102742
|
-
|
|
102743
|
-
// src/domain/schemas/shared-refs.ts
|
|
102744
|
-
var DocId, HulyRef, PersonId, OrganizationId, IssueId, AssociationId, RelationId, ComponentId, MilestoneId, IssueTemplateId, IssueTemplateChildId, ProjectTypeId, TaskTypeId, IssueStatusId, WorkflowStatusId, StatusCategoryId, ChannelId, MessageId, ThreadReplyId, ActivityMessageId, ReactionId, SavedMessageId, MentionId, ActivityReferenceId, ActivityFilterId, AttachmentId, SavedAttachmentId, DrawingId, BlobId, CardId, CardSpaceId, DocumentId, MasterTagId, TeamspaceId, NotificationId, NotificationContextId, EventId, CalendarId, ScheduleId, FloorId, RoomId, MeetingMinutesId, DevicePreferenceId, TodoId, SpaceId, SpaceTypeId, RoleId, PermissionId, CommentId, TimeSpendReportId, ParticipantInfoId, TagElementId, TagReferenceId, TagCategoryId, WorkSlotId, CustomFieldId, HulyAttributeId, HulyEnumId, TestProjectId, TestSuiteId, TestCaseId, TestPlanId, TestPlanItemId, TestRunId, TestResultId, InventoryCategoryId, InventoryProductId, InventoryVariantId, NotificationTypeSettingId, CollaboratorId;
|
|
102745
|
-
var init_shared_refs = __esm({
|
|
102746
|
-
"src/domain/schemas/shared-refs.ts"() {
|
|
102747
|
-
"use strict";
|
|
102748
|
-
init_dist();
|
|
102749
|
-
init_shared_base();
|
|
102750
|
-
DocId = NonEmptyString2.pipe(Schema_exports.brand("DocId"));
|
|
102751
|
-
HulyRef = (tag2) => DocId.pipe(Schema_exports.brand(tag2));
|
|
102752
|
-
PersonId = HulyRef("PersonId");
|
|
102753
|
-
OrganizationId = HulyRef("OrganizationId");
|
|
102754
|
-
IssueId = HulyRef("IssueId");
|
|
102755
|
-
AssociationId = HulyRef("AssociationId");
|
|
102756
|
-
RelationId = HulyRef("RelationId");
|
|
102757
|
-
ComponentId = HulyRef("ComponentId");
|
|
102758
|
-
MilestoneId = HulyRef("MilestoneId");
|
|
102759
|
-
IssueTemplateId = HulyRef("IssueTemplateId");
|
|
102760
|
-
IssueTemplateChildId = HulyRef("IssueTemplateChildId");
|
|
102761
|
-
ProjectTypeId = HulyRef("ProjectTypeId");
|
|
102762
|
-
TaskTypeId = HulyRef("TaskTypeId");
|
|
102763
|
-
IssueStatusId = HulyRef("IssueStatusId");
|
|
102764
|
-
WorkflowStatusId = HulyRef("WorkflowStatusId");
|
|
102765
|
-
StatusCategoryId = HulyRef("StatusCategoryId");
|
|
102766
|
-
ChannelId = HulyRef("ChannelId");
|
|
102767
|
-
MessageId = HulyRef("MessageId");
|
|
102768
|
-
ThreadReplyId = HulyRef("ThreadReplyId");
|
|
102769
|
-
ActivityMessageId = HulyRef("ActivityMessageId");
|
|
102770
|
-
ReactionId = HulyRef("ReactionId");
|
|
102771
|
-
SavedMessageId = HulyRef("SavedMessageId");
|
|
102772
|
-
MentionId = HulyRef("MentionId");
|
|
102773
|
-
ActivityReferenceId = HulyRef("ActivityReferenceId");
|
|
102774
|
-
ActivityFilterId = HulyRef("ActivityFilterId");
|
|
102775
|
-
AttachmentId = HulyRef("AttachmentId");
|
|
102776
|
-
SavedAttachmentId = HulyRef("SavedAttachmentId");
|
|
102777
|
-
DrawingId = HulyRef("DrawingId");
|
|
102778
|
-
BlobId = HulyRef("BlobId");
|
|
102779
|
-
CardId = HulyRef("CardId");
|
|
102780
|
-
CardSpaceId = HulyRef("CardSpaceId");
|
|
102781
|
-
DocumentId = HulyRef("DocumentId");
|
|
102782
|
-
MasterTagId = HulyRef("MasterTagId");
|
|
102783
|
-
TeamspaceId = HulyRef("TeamspaceId");
|
|
102784
|
-
NotificationId = HulyRef("NotificationId");
|
|
102785
|
-
NotificationContextId = HulyRef("NotificationContextId");
|
|
102786
|
-
EventId = HulyRef("EventId");
|
|
102787
|
-
CalendarId = HulyRef("CalendarId");
|
|
102788
|
-
ScheduleId = HulyRef("ScheduleId");
|
|
102789
|
-
FloorId = HulyRef("FloorId");
|
|
102790
|
-
RoomId = HulyRef("RoomId");
|
|
102791
|
-
MeetingMinutesId = HulyRef("MeetingMinutesId");
|
|
102792
|
-
DevicePreferenceId = HulyRef("DevicePreferenceId");
|
|
102793
|
-
TodoId = HulyRef("TodoId");
|
|
102794
|
-
SpaceId = HulyRef("SpaceId");
|
|
102795
|
-
SpaceTypeId = HulyRef("SpaceTypeId");
|
|
102796
|
-
RoleId = HulyRef("RoleId");
|
|
102797
|
-
PermissionId = HulyRef("PermissionId");
|
|
102798
|
-
CommentId = HulyRef("CommentId");
|
|
102799
|
-
TimeSpendReportId = HulyRef("TimeSpendReportId");
|
|
102800
|
-
ParticipantInfoId = HulyRef("ParticipantInfoId");
|
|
102801
|
-
TagElementId = HulyRef("TagElementId");
|
|
102802
|
-
TagReferenceId = HulyRef("TagReferenceId");
|
|
102803
|
-
TagCategoryId = HulyRef("TagCategoryId");
|
|
102804
|
-
WorkSlotId = HulyRef("WorkSlotId");
|
|
102805
|
-
CustomFieldId = HulyRef("CustomFieldId");
|
|
102806
|
-
HulyAttributeId = HulyRef("HulyAttributeId");
|
|
102807
|
-
HulyEnumId = HulyRef("HulyEnumId");
|
|
102808
|
-
TestProjectId = HulyRef("TestProjectId");
|
|
102809
|
-
TestSuiteId = HulyRef("TestSuiteId");
|
|
102810
|
-
TestCaseId = HulyRef("TestCaseId");
|
|
102811
|
-
TestPlanId = HulyRef("TestPlanId");
|
|
102812
|
-
TestPlanItemId = HulyRef("TestPlanItemId");
|
|
102813
|
-
TestRunId = HulyRef("TestRunId");
|
|
102814
|
-
TestResultId = HulyRef("TestResultId");
|
|
102815
|
-
InventoryCategoryId = HulyRef("InventoryCategoryId");
|
|
102816
|
-
InventoryProductId = HulyRef("InventoryProductId");
|
|
102817
|
-
InventoryVariantId = HulyRef("InventoryVariantId");
|
|
102818
|
-
NotificationTypeSettingId = HulyRef("NotificationTypeSettingId");
|
|
102819
|
-
CollaboratorId = HulyRef("CollaboratorId");
|
|
102820
|
-
}
|
|
102821
|
-
});
|
|
102822
|
-
|
|
102823
|
-
// src/domain/schemas/shared.ts
|
|
102824
|
-
var MAX_LIMIT, DEFAULT_LIMIT, DEFAULT_COLOR_INDEX, MAX_COLOR_INDEX, DEFAULT_INCLUDE_ARCHIVED, DEFAULT_PRIVATE, NonNegativeInteger, PositiveInteger, Integer, Count, UNKNOWN_TOTAL, ListTotal, HulyTransactionScope, HulyConditionalWriteResult, Sha256Hex, Timestamp, LimitParam, EmptyParamsSchema, emptyParamsJsonSchema, enumValuesDescription, hasAtLeastOneDefined, hasAllDefined, atLeastOneUpdateFieldMessage, mutuallyExclusiveFieldsMessage, hasMutuallyExclusiveFields, withAtLeastOneRequired, withMutuallyExclusiveFields, assertUpdateFields, ProjectIdentifier, IssueIdentifier, SpaceIdentifier, SpaceClassFilter, SpaceTypeIdentifier, Email, StatusName, PersonName, PersonLocator, PersonRefInput, ComponentLabel, MilestoneLabel, ChannelName, RoomName, MimeType, ObjectClassName, EmojiCode, ContactProvider, NotificationProviderId, NotificationTypeId, WorkspaceName, UrlString, WorkspaceUrlSlug, WorkspaceVersion, WorkspaceMode, WorkspaceUuid, PersonUuid, AccountId, AccountUuid, SessionId, RegionId, NonNegativeNumber, PositiveNumber, VirtualOfficeCoordinate, VirtualOfficeDimension, BlurRadius, TimeZoneId, DurationMinutes, PositiveDurationMinutes, HOURS_PER_DAY, MINUTES_PER_HOUR, MINUTES_PER_DAY, MinuteOfDay, ColorCode, ComponentIdentifier, MilestoneIdentifier, TemplateIdentifier, ChannelIdentifier, DirectMessageIdentifier, TeamspaceIdentifier, CardIdentifier, CardSpaceIdentifier, DocumentIdentifier, MasterTagIdentifier, TagIdentifier, TagCategoryIdentifier, WorkflowStatusIdentifier, StatusCategoryIdentifier, HulyAttributeIdentifier, InventoryCategoryIdentifier, InventoryProductIdentifier, InventoryVariantIdentifier, MemberReference, TestProjectIdentifier, TestSuiteIdentifier, TestCaseIdentifier, TestPlanIdentifier, TestRunIdentifier, TestResultIdentifier;
|
|
102825
|
-
var init_shared = __esm({
|
|
102826
|
-
"src/domain/schemas/shared.ts"() {
|
|
102827
|
-
"use strict";
|
|
102828
|
-
init_dist();
|
|
102829
|
-
init_json_schema2();
|
|
102830
|
-
init_shared_base();
|
|
102831
|
-
init_shared_base();
|
|
102832
|
-
init_shared_refs();
|
|
102833
|
-
MAX_LIMIT = 200;
|
|
102834
|
-
DEFAULT_LIMIT = 50;
|
|
102835
|
-
DEFAULT_COLOR_INDEX = 0;
|
|
102836
|
-
MAX_COLOR_INDEX = 23;
|
|
102837
|
-
DEFAULT_INCLUDE_ARCHIVED = false;
|
|
102838
|
-
DEFAULT_PRIVATE = false;
|
|
102839
|
-
NonNegativeInteger = Schema_exports.Natural.annotate({
|
|
102840
|
-
identifier: "NonNegativeInteger",
|
|
102841
|
-
title: "NonNegativeInteger",
|
|
102842
|
-
description: "Integer greater than or equal to zero."
|
|
102843
|
-
});
|
|
102844
|
-
PositiveInteger = Schema_exports.Int.pipe(
|
|
102845
|
-
Schema_exports.check(Schema_exports.isGreaterThan(0)),
|
|
102846
|
-
Schema_exports.brand("PositiveInteger")
|
|
102847
|
-
).annotate({ identifier: "PositiveInteger", title: "PositiveInteger", description: "Integer greater than zero." });
|
|
102848
|
-
Integer = Schema_exports.Int.pipe(Schema_exports.brand("Integer")).annotate({
|
|
102849
|
-
identifier: "Integer",
|
|
102850
|
-
title: "Integer",
|
|
102851
|
-
description: "Whole number."
|
|
102852
|
-
});
|
|
102853
|
-
Count = NonNegativeInteger.pipe(Schema_exports.brand("Count")).annotate({
|
|
102854
|
-
identifier: "Count",
|
|
102855
|
-
title: "Count",
|
|
102856
|
-
description: "Non-negative integer count."
|
|
102857
|
-
});
|
|
102858
|
-
UNKNOWN_TOTAL = -1;
|
|
102859
|
-
ListTotal = Schema_exports.Union([Count, Schema_exports.Literal(UNKNOWN_TOTAL)]).annotate({
|
|
102860
|
-
identifier: "ListTotal",
|
|
102861
|
-
title: "ListTotal",
|
|
102862
|
-
description: "Count of matching list results, or -1 when the Huly backend reports an unknown total."
|
|
102863
|
-
});
|
|
102864
|
-
HulyTransactionScope = NonEmptyString2.pipe(Schema_exports.brand("HulyTransactionScope"));
|
|
102865
|
-
HulyConditionalWriteResult = Schema_exports.Literals(["applied", "condition-not-met"]);
|
|
102866
|
-
Sha256Hex = Schema_exports.String.pipe(
|
|
102867
|
-
Schema_exports.check(Schema_exports.isPattern(/^[0-9a-f]{64}$/u)),
|
|
102868
|
-
Schema_exports.brand("Sha256Hex")
|
|
102869
|
-
).annotate({
|
|
102870
|
-
identifier: "Sha256Hex",
|
|
102871
|
-
title: "Sha256Hex",
|
|
102872
|
-
description: "Lowercase 64-character hexadecimal SHA-256 digest."
|
|
102873
|
-
});
|
|
102874
|
-
Timestamp = NonNegativeInteger.pipe(Schema_exports.brand("Timestamp")).annotate({
|
|
102875
|
-
identifier: "Timestamp",
|
|
102876
|
-
title: "Timestamp",
|
|
102877
|
-
description: "Unix timestamp in milliseconds (non-negative integer)"
|
|
102878
|
-
});
|
|
102879
|
-
LimitParam = Schema_exports.Int.check(Schema_exports.isGreaterThan(0), Schema_exports.isLessThanOrEqualTo(MAX_LIMIT));
|
|
102880
|
-
EmptyParamsSchema = Schema_exports.Struct({});
|
|
102881
|
-
emptyParamsJsonSchema = toDraft07EmptyObjectJsonSchema(EmptyParamsSchema);
|
|
102882
|
-
enumValuesDescription = (values3) => values3.join(", ");
|
|
102883
|
-
hasAtLeastOneDefined = (params2, fields) => fields.some((field) => params2[field] !== void 0);
|
|
102884
|
-
hasAllDefined = (...values3) => values3.every((value3) => value3 !== void 0);
|
|
102885
|
-
atLeastOneUpdateFieldMessage = (fields) => `At least one update field must be provided: ${fields.join(", ")}.`;
|
|
102886
|
-
mutuallyExclusiveFieldsMessage = (fields) => `Provide only one of ${fields.join(" or ")}.`;
|
|
102887
|
-
hasMutuallyExclusiveFields = (params2, fields) => fields.every((field) => params2[field] !== void 0);
|
|
102888
|
-
withAtLeastOneRequired = (schema2, fields) => ({
|
|
102889
|
-
...schema2,
|
|
102890
|
-
anyOf: fields.map((field) => ({ required: [field] }))
|
|
102891
|
-
});
|
|
102892
|
-
withMutuallyExclusiveFields = (schema2, fields) => ({
|
|
102893
|
-
...schema2,
|
|
102894
|
-
not: { required: [...fields] }
|
|
102895
|
-
});
|
|
102896
|
-
assertUpdateFields = () => (_nonUpdateFields, fields) => fields;
|
|
102897
|
-
ProjectIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ProjectIdentifier"));
|
|
102898
|
-
IssueIdentifier = NonEmptyString2.pipe(Schema_exports.brand("IssueIdentifier"));
|
|
102899
|
-
SpaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("SpaceIdentifier"));
|
|
102900
|
-
SpaceClassFilter = NonEmptyString2.pipe(Schema_exports.brand("SpaceClassFilter"));
|
|
102901
|
-
SpaceTypeIdentifier = NonEmptyString2.pipe(Schema_exports.brand("SpaceTypeIdentifier"));
|
|
102902
|
-
Email = Schema_exports.NonEmptyString.pipe(
|
|
102903
|
-
Schema_exports.check(Schema_exports.isPattern(/^[^@]+@[^@]+$/, { message: "must contain exactly one @" })),
|
|
102904
|
-
Schema_exports.brand("Email")
|
|
102905
|
-
);
|
|
102906
|
-
StatusName = NonEmptyString2.annotate({
|
|
102907
|
-
description: "Exact workflow status display name. Status names are workspace data, not a fixed enum; use the relevant workflow-status listing tool to discover valid values."
|
|
102908
|
-
}).pipe(Schema_exports.brand("StatusName"));
|
|
102909
|
-
PersonName = NonEmptyString2.pipe(Schema_exports.brand("PersonName"));
|
|
102910
|
-
PersonLocator = NonEmptyString2.pipe(Schema_exports.brand("PersonLocator")).annotate({
|
|
102911
|
-
description: "Person or employee ID, exact email address, or exact Huly display name."
|
|
102912
|
-
});
|
|
102913
|
-
PersonRefInput = Schema_exports.Union([Email, PersonName]);
|
|
102914
|
-
ComponentLabel = NonEmptyString2.pipe(Schema_exports.brand("ComponentLabel"));
|
|
102915
|
-
MilestoneLabel = NonEmptyString2.pipe(Schema_exports.brand("MilestoneLabel"));
|
|
102916
|
-
ChannelName = NonEmptyString2.pipe(Schema_exports.brand("ChannelName"));
|
|
102917
|
-
RoomName = NonEmptyString2.pipe(Schema_exports.brand("RoomName")).annotate({
|
|
102918
|
-
identifier: "RoomName",
|
|
102919
|
-
title: "RoomName",
|
|
102920
|
-
description: "Non-empty virtual-office room name."
|
|
102921
|
-
});
|
|
102922
|
-
MimeType = NonEmptyString2.pipe(Schema_exports.brand("MimeType"));
|
|
102923
|
-
ObjectClassName = NonEmptyString2.pipe(Schema_exports.brand("ObjectClassName"));
|
|
102924
|
-
EmojiCode = NonEmptyString2.pipe(Schema_exports.brand("EmojiCode"));
|
|
102925
|
-
ContactProvider = NonEmptyString2.pipe(Schema_exports.brand("ContactProvider"));
|
|
102926
|
-
NotificationProviderId = NonEmptyString2.pipe(Schema_exports.brand("NotificationProviderId"));
|
|
102927
|
-
NotificationTypeId = NonEmptyString2.pipe(Schema_exports.brand("NotificationTypeId"));
|
|
102928
|
-
WorkspaceName = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceName"));
|
|
102929
|
-
UrlString = NonEmptyString2.pipe(Schema_exports.brand("UrlString"));
|
|
102930
|
-
WorkspaceUrlSlug = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceUrlSlug"));
|
|
102931
|
-
WorkspaceVersion = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceVersion"));
|
|
102932
|
-
WorkspaceMode = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceMode"));
|
|
102933
|
-
WorkspaceUuid = NonEmptyString2.pipe(Schema_exports.brand("WorkspaceUuid"));
|
|
102934
|
-
PersonUuid = NonEmptyString2.pipe(Schema_exports.brand("PersonUuid"));
|
|
102935
|
-
AccountId = NonEmptyString2.pipe(Schema_exports.brand("AccountId"));
|
|
102936
|
-
AccountUuid = Schema_exports.String.check(Schema_exports.isUUID()).pipe(Schema_exports.brand("AccountUuid"));
|
|
102937
|
-
SessionId = NonEmptyString2.pipe(Schema_exports.brand("SessionId"));
|
|
102938
|
-
RegionId = Schema_exports.String.pipe(Schema_exports.brand("RegionId"));
|
|
102939
|
-
NonNegativeNumber = Schema_exports.Number.check(Schema_exports.isGreaterThanOrEqualTo(0)).pipe(
|
|
102940
|
-
Schema_exports.brand("NonNegativeNumber")
|
|
102941
|
-
);
|
|
102942
|
-
PositiveNumber = NonNegativeNumber.check(Schema_exports.isGreaterThan(0)).pipe(Schema_exports.brand("PositiveNumber"));
|
|
102943
|
-
VirtualOfficeCoordinate = Schema_exports.Number.pipe(Schema_exports.brand("VirtualOfficeCoordinate")).annotate({
|
|
102944
|
-
identifier: "VirtualOfficeCoordinate",
|
|
102945
|
-
title: "VirtualOfficeCoordinate",
|
|
102946
|
-
description: "Coordinate in Huly virtual-office layout space."
|
|
102947
|
-
});
|
|
102948
|
-
VirtualOfficeDimension = NonNegativeNumber.pipe(Schema_exports.brand("VirtualOfficeDimension")).annotate({
|
|
102949
|
-
identifier: "VirtualOfficeDimension",
|
|
102950
|
-
title: "VirtualOfficeDimension",
|
|
102951
|
-
description: "Non-negative dimension in Huly virtual-office layout space."
|
|
102952
|
-
});
|
|
102953
|
-
BlurRadius = NonNegativeNumber.pipe(Schema_exports.brand("BlurRadius")).annotate({
|
|
102954
|
-
identifier: "BlurRadius",
|
|
102955
|
-
title: "BlurRadius",
|
|
102956
|
-
description: "Non-negative virtual-office video blur radius."
|
|
102957
|
-
});
|
|
102958
|
-
TimeZoneId = NonEmptyString2.pipe(Schema_exports.brand("TimeZoneId")).annotate({
|
|
102959
|
-
identifier: "TimeZoneId",
|
|
102960
|
-
title: "TimeZoneId",
|
|
102961
|
-
description: "IANA time zone identifier."
|
|
102962
|
-
});
|
|
102963
|
-
DurationMinutes = NonNegativeInteger.pipe(Schema_exports.brand("DurationMinutes")).annotate({
|
|
102964
|
-
identifier: "DurationMinutes",
|
|
102965
|
-
title: "DurationMinutes",
|
|
102966
|
-
description: "Duration expressed in whole minutes."
|
|
102967
|
-
});
|
|
102968
|
-
PositiveDurationMinutes = PositiveInteger.pipe(Schema_exports.brand("PositiveDurationMinutes")).annotate({
|
|
102969
|
-
identifier: "PositiveDurationMinutes",
|
|
102970
|
-
title: "PositiveDurationMinutes",
|
|
102971
|
-
description: "Positive duration expressed in whole minutes."
|
|
102972
|
-
});
|
|
102973
|
-
HOURS_PER_DAY = 24;
|
|
102974
|
-
MINUTES_PER_HOUR = 60;
|
|
102975
|
-
MINUTES_PER_DAY = HOURS_PER_DAY * MINUTES_PER_HOUR;
|
|
102976
|
-
MinuteOfDay = NonNegativeInteger.pipe(
|
|
102977
|
-
Schema_exports.check(Schema_exports.isLessThanOrEqualTo(MINUTES_PER_DAY)),
|
|
102978
|
-
Schema_exports.brand("MinuteOfDay")
|
|
102979
|
-
).annotate({
|
|
102980
|
-
identifier: "MinuteOfDay",
|
|
102981
|
-
title: "MinuteOfDay",
|
|
102982
|
-
description: "Minute offset within a day, from 0 through 1440."
|
|
102983
|
-
});
|
|
102984
|
-
ColorCode = Schema_exports.Int.pipe(
|
|
102985
|
-
Schema_exports.check(Schema_exports.isGreaterThanOrEqualTo(0), Schema_exports.isLessThanOrEqualTo(MAX_COLOR_INDEX)),
|
|
102986
|
-
Schema_exports.brand("ColorCode")
|
|
102987
|
-
).annotate({ title: "ColorCode", description: `Huly platform color palette index, from 0 through ${MAX_COLOR_INDEX}.` });
|
|
102988
|
-
ComponentIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ComponentIdentifier"));
|
|
102989
|
-
MilestoneIdentifier = NonEmptyString2.pipe(Schema_exports.brand("MilestoneIdentifier"));
|
|
102990
|
-
TemplateIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TemplateIdentifier"));
|
|
102991
|
-
ChannelIdentifier = NonEmptyString2.pipe(Schema_exports.brand("ChannelIdentifier"));
|
|
102992
|
-
DirectMessageIdentifier = NonEmptyString2.pipe(Schema_exports.brand("DirectMessageIdentifier"));
|
|
102993
|
-
TeamspaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TeamspaceIdentifier"));
|
|
102994
|
-
CardIdentifier = NonEmptyString2.pipe(Schema_exports.brand("CardIdentifier"));
|
|
102995
|
-
CardSpaceIdentifier = NonEmptyString2.pipe(Schema_exports.brand("CardSpaceIdentifier"));
|
|
102996
|
-
DocumentIdentifier = NonEmptyString2.pipe(Schema_exports.brand("DocumentIdentifier"));
|
|
102997
|
-
MasterTagIdentifier = NonEmptyString2.pipe(Schema_exports.brand("MasterTagIdentifier"));
|
|
102998
|
-
TagIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TagIdentifier"));
|
|
102999
|
-
TagCategoryIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TagCategoryIdentifier"));
|
|
103000
|
-
WorkflowStatusIdentifier = NonEmptyString2.pipe(Schema_exports.brand("WorkflowStatusIdentifier"));
|
|
103001
|
-
StatusCategoryIdentifier = NonEmptyString2.pipe(Schema_exports.brand("StatusCategoryIdentifier"));
|
|
103002
|
-
HulyAttributeIdentifier = NonEmptyString2.pipe(Schema_exports.brand("HulyAttributeIdentifier"));
|
|
103003
|
-
InventoryCategoryIdentifier = NonEmptyString2.pipe(Schema_exports.brand("InventoryCategoryIdentifier"));
|
|
103004
|
-
InventoryProductIdentifier = NonEmptyString2.pipe(Schema_exports.brand("InventoryProductIdentifier"));
|
|
103005
|
-
InventoryVariantIdentifier = NonEmptyString2.pipe(Schema_exports.brand("InventoryVariantIdentifier"));
|
|
103006
|
-
MemberReference = NonEmptyString2.pipe(Schema_exports.brand("MemberReference"));
|
|
103007
|
-
TestProjectIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestProjectIdentifier"));
|
|
103008
|
-
TestSuiteIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestSuiteIdentifier"));
|
|
103009
|
-
TestCaseIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestCaseIdentifier"));
|
|
103010
|
-
TestPlanIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestPlanIdentifier"));
|
|
103011
|
-
TestRunIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestRunIdentifier"));
|
|
103012
|
-
TestResultIdentifier = NonEmptyString2.pipe(Schema_exports.brand("TestResultIdentifier"));
|
|
103013
|
-
}
|
|
103014
|
-
});
|
|
103015
|
-
|
|
103016
103189
|
// src/domain/schemas/workbench.ts
|
|
103017
103190
|
var WorkbenchApplicationId, WorkbenchApplicationAlias, WorkbenchApplicationAliasSearch, WorkbenchLabelId, WorkbenchNavigationItemId, WorkbenchNavigationPosition, WorkbenchApplicationType, WorkbenchApplicationOrder, WorkbenchAccountRoleSchema, WorkbenchApplicationPositionSchema, aliasFiltersAreExclusive, ListWorkbenchApplicationsParamsSchema, WorkbenchSpaceNavigationSchema, WorkbenchSpecialNavigationSchema, WorkbenchGroupNavigationSchema, WorkbenchNavigationSummarySchema, WorkbenchApplicationSummarySchema, ListWorkbenchApplicationsResultSchema, listWorkbenchApplicationsParamsJsonSchema, parseListWorkbenchApplicationsParams;
|
|
103018
103191
|
var init_workbench = __esm({
|
|
@@ -132455,7 +132628,7 @@ var VERSION;
|
|
|
132455
132628
|
var init_version = __esm({
|
|
132456
132629
|
"src/version.ts"() {
|
|
132457
132630
|
"use strict";
|
|
132458
|
-
VERSION = true ? "0.52.
|
|
132631
|
+
VERSION = true ? "0.52.4" : "0.0.0-dev";
|
|
132459
132632
|
}
|
|
132460
132633
|
});
|
|
132461
132634
|
|
|
@@ -136398,7 +136571,7 @@ var init_tool_responses = __esm({
|
|
|
136398
136571
|
});
|
|
136399
136572
|
|
|
136400
136573
|
// src/mcp/error-mapping.ts
|
|
136401
|
-
var INVALID_PARAMS_TAGS, INTERNAL_ERROR_PREFIX, CONNECTION_ERROR_GUIDANCE, encodeMeetingCompositionMutationError, meetingCompositionMutationMessage, hulyConnectionMessage, hulyUnavailableMessage, mapDomainErrorToMcp, isClientResolutionError, clientResolutionFailure, redactResolutionDetail, mapClientResolutionErrorToMcp, mapClientResolutionCauseToMcp, clientResolutionErrorMessage, clientResolutionCauseMessage, mapParseErrorToMcp, mapParseCauseToMcp, mapDomainCauseToMcp;
|
|
136574
|
+
var INVALID_PARAMS_TAGS, INTERNAL_ERROR_PREFIX, CONNECTION_ERROR_GUIDANCE, encodeMeetingCompositionMutationError, meetingCompositionMutationMessage, hulyConnectionMessage, hulyUnavailableMessage, mapDomainErrorToMcp, isClientResolutionError, clientResolutionFailure, redactResolutionDetail, mapClientResolutionErrorToMcp, mapClientResolutionCauseToMcp, clientResolutionErrorMessage, clientResolutionCauseMessage, mapParseErrorToMcp, unclassifiedCauseTag, mapParseCauseToMcp, mapDomainCauseToMcp;
|
|
136402
136575
|
var init_error_mapping = __esm({
|
|
136403
136576
|
"src/mcp/error-mapping.ts"() {
|
|
136404
136577
|
"use strict";
|
|
@@ -136710,11 +136883,16 @@ Recovery record: ${JSON.stringify(encodeMeetingCompositionMutationError(error3))
|
|
|
136710
136883
|
mapParseErrorToMcp = (error3, toolName) => {
|
|
136711
136884
|
const prefix = toolName ? `Invalid parameters for ${toolName}: ` : "Invalid parameters: ";
|
|
136712
136885
|
const message = formatParseError(error3);
|
|
136713
|
-
return createErrorResponse(`${prefix}${message}`, McpErrorCode.InvalidParams);
|
|
136886
|
+
return createErrorResponse(`${prefix}${message}`, McpErrorCode.InvalidParams, "ParseError");
|
|
136714
136887
|
};
|
|
136888
|
+
unclassifiedCauseTag = (classification) => classification._tag === "Fatal" && classification.reason === "Interrupt" ? "Interrupted" : "UnexpectedError";
|
|
136715
136889
|
mapParseCauseToMcp = (cause, toolName) => {
|
|
136716
136890
|
const classification = classifyCause(cause);
|
|
136717
|
-
return classification._tag === "Failure" ? mapParseErrorToMcp(classification.firstFailure, toolName) : createErrorResponse(
|
|
136891
|
+
return classification._tag === "Failure" ? mapParseErrorToMcp(classification.firstFailure, toolName) : createErrorResponse(
|
|
136892
|
+
"An unexpected error occurred",
|
|
136893
|
+
McpErrorCode.InternalError,
|
|
136894
|
+
unclassifiedCauseTag(classification)
|
|
136895
|
+
);
|
|
136718
136896
|
};
|
|
136719
136897
|
mapDomainCauseToMcp = (cause, warnings = []) => {
|
|
136720
136898
|
for (const reason of cause.reasons) {
|
|
@@ -136727,7 +136905,7 @@ Recovery record: ${JSON.stringify(encodeMeetingCompositionMutationError(error3))
|
|
|
136727
136905
|
return createErrorResponse(
|
|
136728
136906
|
"An unexpected error occurred",
|
|
136729
136907
|
McpErrorCode.InternalError,
|
|
136730
|
-
classification
|
|
136908
|
+
unclassifiedCauseTag(classification),
|
|
136731
136909
|
warnings
|
|
136732
136910
|
);
|
|
136733
136911
|
};
|
|
@@ -188316,7 +188494,7 @@ var init_contacts_shared = __esm({
|
|
|
188316
188494
|
value: { $like: `%${escapeLikeWildcards(emailSearch)}%` }
|
|
188317
188495
|
})
|
|
188318
188496
|
),
|
|
188319
|
-
(channels) => [...new Set(channels.map((
|
|
188497
|
+
(channels) => [...new Set(channels.map((channel2) => toRef(channel2.attachedTo)))]
|
|
188320
188498
|
);
|
|
188321
188499
|
findPersonIdsByExactEmailSources = (client, email3) => Effect_exports.map(
|
|
188322
188500
|
Effect_exports.all([
|
|
@@ -188332,7 +188510,7 @@ var init_contacts_shared = __esm({
|
|
|
188332
188510
|
([socialIdentities, channels]) => [
|
|
188333
188511
|
.../* @__PURE__ */ new Set([
|
|
188334
188512
|
...socialIdentities.map((identity2) => toRef(identity2.attachedTo)),
|
|
188335
|
-
...channels.map((
|
|
188513
|
+
...channels.map((channel2) => toRef(channel2.attachedTo))
|
|
188336
188514
|
])
|
|
188337
188515
|
]
|
|
188338
188516
|
);
|
|
@@ -189382,13 +189560,13 @@ var init_thread_replies_shared = __esm({
|
|
|
189382
189560
|
init_huly_plugins();
|
|
189383
189561
|
init_query_helpers();
|
|
189384
189562
|
init_sdk_boundary();
|
|
189385
|
-
findThreadReply = (client,
|
|
189563
|
+
findThreadReply = (client, channel2, message, replyId) => Effect_exports.gen(function* () {
|
|
189386
189564
|
const reply = yield* client.findOne(
|
|
189387
189565
|
chunter.class.ThreadMessage,
|
|
189388
189566
|
hulyQuery({
|
|
189389
189567
|
_id: toRef(replyId),
|
|
189390
189568
|
attachedTo: toRef(message._id),
|
|
189391
|
-
space:
|
|
189569
|
+
space: channel2._id
|
|
189392
189570
|
})
|
|
189393
189571
|
);
|
|
189394
189572
|
if (reply === void 0) {
|
|
@@ -189560,16 +189738,16 @@ var init_channels_shared = __esm({
|
|
|
189560
189738
|
init_huly_plugins();
|
|
189561
189739
|
findChannel = (identifier2) => Effect_exports.gen(function* () {
|
|
189562
189740
|
const client = yield* HulyClient;
|
|
189563
|
-
const
|
|
189741
|
+
const channel2 = yield* findByNameOrId(
|
|
189564
189742
|
client,
|
|
189565
189743
|
chunter.class.Channel,
|
|
189566
189744
|
{ name: identifier2 },
|
|
189567
189745
|
{ _id: toRef(identifier2) }
|
|
189568
189746
|
);
|
|
189569
|
-
if (
|
|
189747
|
+
if (channel2 === void 0) {
|
|
189570
189748
|
return yield* new ChannelNotFoundError({ identifier: identifier2 });
|
|
189571
189749
|
}
|
|
189572
|
-
return { client, channel };
|
|
189750
|
+
return { client, channel: channel2 };
|
|
189573
189751
|
});
|
|
189574
189752
|
}
|
|
189575
189753
|
});
|
|
@@ -189837,43 +190015,43 @@ var init_channel_members = __esm({
|
|
|
189837
190015
|
members,
|
|
189838
190016
|
(member) => Schema_exports.is(AccountUuid)(member) ? Effect_exports.succeed(toAccountUuid(member)) : resolveEmployeeAccountUuid(client, member)
|
|
189839
190017
|
).pipe(Effect_exports.map((values3) => sortStrings([...new Set(values3)])));
|
|
189840
|
-
updateChannelDoc = (client,
|
|
189841
|
-
requireActiveChannel = (
|
|
189842
|
-
ensureRemovalKeepsValidChannel = (
|
|
190018
|
+
updateChannelDoc = (client, channel2, operations) => client.updateDoc(chunter.class.Channel, toRef(channel2._id), channel2._id, operations).pipe(Effect_exports.asVoid);
|
|
190019
|
+
requireActiveChannel = (channel2) => channel2.archived ? Effect_exports.fail(new ChannelArchivedError({ channel: channel2._id })) : Effect_exports.void;
|
|
190020
|
+
ensureRemovalKeepsValidChannel = (channel2, nextMembers) => Effect_exports.gen(function* () {
|
|
189843
190021
|
if (nextMembers.length === 0) {
|
|
189844
|
-
return yield* new ChannelLastMemberRemovalError({ channel:
|
|
190022
|
+
return yield* new ChannelLastMemberRemovalError({ channel: channel2._id });
|
|
189845
190023
|
}
|
|
189846
|
-
const owners =
|
|
190024
|
+
const owners = channel2.owners ?? [];
|
|
189847
190025
|
if (owners.length > 0 && !nextMembers.some((member) => owners.includes(member))) {
|
|
189848
|
-
return yield* new ChannelLastOwnerRemovalError({ channel:
|
|
190026
|
+
return yield* new ChannelLastOwnerRemovalError({ channel: channel2._id });
|
|
189849
190027
|
}
|
|
189850
190028
|
});
|
|
189851
|
-
memberMutationResult = (
|
|
189852
|
-
channelId: ChannelId.make(
|
|
190029
|
+
memberMutationResult = (channel2, members, changed) => ({
|
|
190030
|
+
channelId: ChannelId.make(channel2._id),
|
|
189853
190031
|
members: members.map((member) => AccountUuid.make(member)),
|
|
189854
190032
|
changed
|
|
189855
190033
|
});
|
|
189856
190034
|
mutateChannelMembers = (params2, mutateMembers, validate3) => Effect_exports.gen(function* () {
|
|
189857
|
-
const { channel, client } = yield* findChannel(params2.channel);
|
|
189858
|
-
yield* requireActiveChannel(
|
|
189859
|
-
const nextMembers = mutateMembers(
|
|
190035
|
+
const { channel: channel2, client } = yield* findChannel(params2.channel);
|
|
190036
|
+
yield* requireActiveChannel(channel2);
|
|
190037
|
+
const nextMembers = mutateMembers(channel2.members, params2.members).map(toAccountUuid);
|
|
189860
190038
|
if (validate3 !== void 0) {
|
|
189861
|
-
yield* validate3(
|
|
190039
|
+
yield* validate3(channel2, nextMembers);
|
|
189862
190040
|
}
|
|
189863
|
-
const changed = !arraysEqual(sortStrings(
|
|
190041
|
+
const changed = !arraysEqual(sortStrings(channel2.members), nextMembers);
|
|
189864
190042
|
if (changed) {
|
|
189865
|
-
yield* updateChannelDoc(client,
|
|
190043
|
+
yield* updateChannelDoc(client, channel2, { members: nextMembers });
|
|
189866
190044
|
}
|
|
189867
|
-
return memberMutationResult(
|
|
190045
|
+
return memberMutationResult(channel2, nextMembers, changed);
|
|
189868
190046
|
});
|
|
189869
190047
|
listChannelMembers = (params2) => Effect_exports.gen(function* () {
|
|
189870
|
-
const { channel, client } = yield* findChannel(params2.channel);
|
|
189871
|
-
const accountUuidToName = yield* buildAccountUuidToNameMap(client,
|
|
189872
|
-
const members =
|
|
190048
|
+
const { channel: channel2, client } = yield* findChannel(params2.channel);
|
|
190049
|
+
const accountUuidToName = yield* buildAccountUuidToNameMap(client, channel2.members);
|
|
190050
|
+
const members = channel2.members.map((member) => ({
|
|
189873
190051
|
accountUuid: AccountUuid.make(member),
|
|
189874
190052
|
name: accountUuidToName.get(member)
|
|
189875
190053
|
}));
|
|
189876
|
-
return { channelId: ChannelId.make(
|
|
190054
|
+
return { channelId: ChannelId.make(channel2._id), members };
|
|
189877
190055
|
});
|
|
189878
190056
|
addChannelMembers = (params2) => Effect_exports.gen(function* () {
|
|
189879
190057
|
const client = yield* HulyClient;
|
|
@@ -189908,12 +190086,12 @@ var init_channel_members = __esm({
|
|
|
189908
190086
|
);
|
|
189909
190087
|
});
|
|
189910
190088
|
setChannelArchived = (params2, archived) => Effect_exports.gen(function* () {
|
|
189911
|
-
const { channel, client } = yield* findChannel(params2.channel);
|
|
189912
|
-
const changed =
|
|
190089
|
+
const { channel: channel2, client } = yield* findChannel(params2.channel);
|
|
190090
|
+
const changed = channel2.archived !== archived;
|
|
189913
190091
|
if (changed) {
|
|
189914
|
-
yield* updateChannelDoc(client,
|
|
190092
|
+
yield* updateChannelDoc(client, channel2, { archived });
|
|
189915
190093
|
}
|
|
189916
|
-
return { channelId: ChannelId.make(
|
|
190094
|
+
return { channelId: ChannelId.make(channel2._id), archived, changed };
|
|
189917
190095
|
});
|
|
189918
190096
|
archiveChannel = (params2) => setChannelArchived(params2, true);
|
|
189919
190097
|
unarchiveChannel = (params2) => setChannelArchived(params2, false);
|
|
@@ -189931,15 +190109,15 @@ var init_channel_messages_shared = __esm({
|
|
|
189931
190109
|
init_sdk_boundary();
|
|
189932
190110
|
init_huly_plugins();
|
|
189933
190111
|
findChannelMessage = (params2) => Effect_exports.gen(function* () {
|
|
189934
|
-
const { channel, client } = yield* findChannel(params2.channel);
|
|
190112
|
+
const { channel: channel2, client } = yield* findChannel(params2.channel);
|
|
189935
190113
|
const message = yield* client.findOne(chunter.class.ChatMessage, {
|
|
189936
190114
|
_id: toRef(params2.messageId),
|
|
189937
|
-
space:
|
|
190115
|
+
space: channel2._id
|
|
189938
190116
|
});
|
|
189939
190117
|
if (message === void 0) {
|
|
189940
190118
|
return yield* new MessageNotFoundError({ messageId: params2.messageId, channel: params2.channel });
|
|
189941
190119
|
}
|
|
189942
|
-
return { client, channel, message };
|
|
190120
|
+
return { client, channel: channel2, message };
|
|
189943
190121
|
});
|
|
189944
190122
|
}
|
|
189945
190123
|
});
|
|
@@ -189955,17 +190133,17 @@ var init_channels_messages = __esm({
|
|
|
189955
190133
|
init_markup();
|
|
189956
190134
|
init_huly_plugins();
|
|
189957
190135
|
updateChannelMessage = (params2) => Effect_exports.gen(function* () {
|
|
189958
|
-
const { channel, client, message } = yield* findChannelMessage(params2);
|
|
190136
|
+
const { channel: channel2, client, message } = yield* findChannelMessage(params2);
|
|
189959
190137
|
const markupUrlConfig = client.markupUrlConfig;
|
|
189960
190138
|
const markup = markdownToMarkupString(params2.body, markupUrlConfig);
|
|
189961
190139
|
const now2 = yield* Clock_exports.currentTimeMillis;
|
|
189962
190140
|
const updateOps = { message: markup, editedOn: now2 };
|
|
189963
|
-
yield* client.updateDoc(chunter.class.ChatMessage,
|
|
190141
|
+
yield* client.updateDoc(chunter.class.ChatMessage, channel2._id, message._id, updateOps);
|
|
189964
190142
|
return { id: MessageId.make(message._id), updated: true };
|
|
189965
190143
|
});
|
|
189966
190144
|
deleteChannelMessage = (params2) => Effect_exports.gen(function* () {
|
|
189967
|
-
const { channel, client, message } = yield* findChannelMessage(params2);
|
|
189968
|
-
yield* client.removeDoc(chunter.class.ChatMessage,
|
|
190145
|
+
const { channel: channel2, client, message } = yield* findChannelMessage(params2);
|
|
190146
|
+
yield* client.removeDoc(chunter.class.ChatMessage, channel2._id, message._id);
|
|
189969
190147
|
return { id: MessageId.make(message._id), deleted: true };
|
|
189970
190148
|
});
|
|
189971
190149
|
}
|
|
@@ -190064,12 +190242,12 @@ var init_chat_contexts = __esm({
|
|
|
190064
190242
|
init_sdk_boundary();
|
|
190065
190243
|
resolveConversation = (params2) => Effect_exports.gen(function* () {
|
|
190066
190244
|
if (params2.channel !== void 0) {
|
|
190067
|
-
const { channel } = yield* findChannel(params2.channel);
|
|
190245
|
+
const { channel: channel2 } = yield* findChannel(params2.channel);
|
|
190068
190246
|
return {
|
|
190069
190247
|
kind: "channel",
|
|
190070
|
-
objectId: toRef(
|
|
190248
|
+
objectId: toRef(channel2._id),
|
|
190071
190249
|
objectClass: toClassRef(chunter.class.Channel),
|
|
190072
|
-
objectSpace: toRef(
|
|
190250
|
+
objectSpace: toRef(channel2._id)
|
|
190073
190251
|
};
|
|
190074
190252
|
}
|
|
190075
190253
|
const { dm } = yield* findDirectMessage(params2.dm);
|
|
@@ -190300,22 +190478,22 @@ var init_channels2 = __esm({
|
|
|
190300
190478
|
return summaries;
|
|
190301
190479
|
});
|
|
190302
190480
|
getChannel = (params2) => Effect_exports.gen(function* () {
|
|
190303
|
-
const { channel, client } = yield* findChannel(params2.channel);
|
|
190304
|
-
const memberNames =
|
|
190305
|
-
const accountUuidToName = yield* buildAccountUuidToNameMap2(client,
|
|
190306
|
-
return
|
|
190481
|
+
const { channel: channel2, client } = yield* findChannel(params2.channel);
|
|
190482
|
+
const memberNames = channel2.members.length > 0 ? yield* Effect_exports.gen(function* () {
|
|
190483
|
+
const accountUuidToName = yield* buildAccountUuidToNameMap2(client, channel2.members);
|
|
190484
|
+
return channel2.members.map((m) => accountUuidToName.get(m)).filter((n) => n !== void 0);
|
|
190307
190485
|
}) : void 0;
|
|
190308
190486
|
const result4 = {
|
|
190309
|
-
id: ChannelId.make(
|
|
190310
|
-
name: ChannelName.make(
|
|
190311
|
-
topic:
|
|
190312
|
-
description:
|
|
190313
|
-
private:
|
|
190314
|
-
archived:
|
|
190487
|
+
id: ChannelId.make(channel2._id),
|
|
190488
|
+
name: ChannelName.make(channel2.name),
|
|
190489
|
+
topic: channel2.topic || void 0,
|
|
190490
|
+
description: channel2.description || void 0,
|
|
190491
|
+
private: channel2.private,
|
|
190492
|
+
archived: channel2.archived,
|
|
190315
190493
|
members: memberNames,
|
|
190316
|
-
messages: optionalCount(
|
|
190317
|
-
modifiedOn:
|
|
190318
|
-
createdOn:
|
|
190494
|
+
messages: optionalCount(channel2.messages),
|
|
190495
|
+
modifiedOn: channel2.modifiedOn,
|
|
190496
|
+
createdOn: channel2.createdOn
|
|
190319
190497
|
};
|
|
190320
190498
|
return result4;
|
|
190321
190499
|
});
|
|
@@ -190336,27 +190514,27 @@ var init_channels2 = __esm({
|
|
|
190336
190514
|
});
|
|
190337
190515
|
updateChannel = (params2) => Effect_exports.gen(function* () {
|
|
190338
190516
|
yield* requireUpdateFields("update_channel", params2, UPDATE_CHANNEL_FIELDS);
|
|
190339
|
-
const { channel, client } = yield* findChannel(params2.channel);
|
|
190517
|
+
const { channel: channel2, client } = yield* findChannel(params2.channel);
|
|
190340
190518
|
const updateEntries = {
|
|
190341
190519
|
name: params2.name === void 0 ? {} : { name: params2.name },
|
|
190342
190520
|
topic: params2.topic === void 0 ? {} : params2.topic === null ? { $unset: { topic: "" } } : { topic: params2.topic }
|
|
190343
190521
|
};
|
|
190344
190522
|
const updateOps = mergeUpdateEntries(Object.values(updateEntries));
|
|
190345
|
-
yield* client.updateDoc(chunter.class.Channel, toRef(
|
|
190346
|
-
return { id: ChannelId.make(
|
|
190523
|
+
yield* client.updateDoc(chunter.class.Channel, toRef(channel2._id), channel2._id, updateOps);
|
|
190524
|
+
return { id: ChannelId.make(channel2._id), updated: true };
|
|
190347
190525
|
});
|
|
190348
190526
|
deleteChannel = (params2) => Effect_exports.gen(function* () {
|
|
190349
|
-
const { channel, client } = yield* findChannel(params2.channel);
|
|
190350
|
-
yield* client.removeDoc(chunter.class.Channel, toRef(
|
|
190351
|
-
return { id: ChannelId.make(
|
|
190527
|
+
const { channel: channel2, client } = yield* findChannel(params2.channel);
|
|
190528
|
+
yield* client.removeDoc(chunter.class.Channel, toRef(channel2._id), channel2._id);
|
|
190529
|
+
return { id: ChannelId.make(channel2._id), deleted: true };
|
|
190352
190530
|
});
|
|
190353
190531
|
listChannelMessages = (params2) => Effect_exports.gen(function* () {
|
|
190354
|
-
const { channel, client } = yield* findChannel(params2.channel);
|
|
190532
|
+
const { channel: channel2, client } = yield* findChannel(params2.channel);
|
|
190355
190533
|
const markupUrlConfig = client.markupUrlConfig;
|
|
190356
190534
|
const limit = clampLimit(params2.limit);
|
|
190357
190535
|
const messages = yield* client.findAll(
|
|
190358
190536
|
chunter.class.ChatMessage,
|
|
190359
|
-
{ space:
|
|
190537
|
+
{ space: channel2._id },
|
|
190360
190538
|
{ limit, sort: { createdOn: import_core45.SortingOrder.Descending } }
|
|
190361
190539
|
);
|
|
190362
190540
|
const total = messages.total;
|
|
@@ -190384,21 +190562,21 @@ var init_channels2 = __esm({
|
|
|
190384
190562
|
return { messages: summaries, total: listTotal(total) };
|
|
190385
190563
|
});
|
|
190386
190564
|
sendChannelMessage = (params2) => Effect_exports.gen(function* () {
|
|
190387
|
-
const { channel, client } = yield* findChannel(params2.channel);
|
|
190565
|
+
const { channel: channel2, client } = yield* findChannel(params2.channel);
|
|
190388
190566
|
const markupUrlConfig = client.markupUrlConfig;
|
|
190389
190567
|
const messageId = (0, import_core45.generateId)();
|
|
190390
190568
|
const markup = markdownToMarkupString(params2.body, markupUrlConfig);
|
|
190391
190569
|
const messageData = { message: markup, attachments: 0 };
|
|
190392
190570
|
yield* client.addCollection(
|
|
190393
190571
|
chunter.class.ChatMessage,
|
|
190394
|
-
|
|
190395
|
-
|
|
190572
|
+
channel2._id,
|
|
190573
|
+
channel2._id,
|
|
190396
190574
|
chunter.class.Channel,
|
|
190397
190575
|
"messages",
|
|
190398
190576
|
messageData,
|
|
190399
190577
|
messageId
|
|
190400
190578
|
);
|
|
190401
|
-
return { id: MessageId.make(messageId), channelId: ChannelId.make(
|
|
190579
|
+
return { id: MessageId.make(messageId), channelId: ChannelId.make(channel2._id) };
|
|
190402
190580
|
});
|
|
190403
190581
|
listDirectMessages = (params2) => Effect_exports.gen(function* () {
|
|
190404
190582
|
const client = yield* HulyClient;
|
|
@@ -192924,8 +193102,8 @@ var init_activity2 = __esm({
|
|
|
192924
193102
|
return activityTarget(client, doc._id, documentPlugin.class.Document);
|
|
192925
193103
|
}
|
|
192926
193104
|
if (params2.channel !== void 0) {
|
|
192927
|
-
const { channel, client } = yield* findChannel(params2.channel);
|
|
192928
|
-
return activityTarget(client,
|
|
193105
|
+
const { channel: channel2, client } = yield* findChannel(params2.channel);
|
|
193106
|
+
return activityTarget(client, channel2._id, chunter.class.Channel);
|
|
192929
193107
|
}
|
|
192930
193108
|
return yield* Effect_exports.die(
|
|
192931
193109
|
"Invalid list_activity parameters: choose objectId+objectClass, project+issueIdentifier, teamspace+document, or channel."
|
|
@@ -202666,8 +202844,8 @@ var init_external_channel_messages2 = __esm({
|
|
|
202666
202844
|
yield* warnUnsupportedRuntime(reason);
|
|
202667
202845
|
return telegramUnsupportedResult(params2, limit, "model-unavailable", reason);
|
|
202668
202846
|
}
|
|
202669
|
-
const
|
|
202670
|
-
if (
|
|
202847
|
+
const channel2 = yield* resolveTelegramChannel(client, params2.channel);
|
|
202848
|
+
if (channel2 === void 0) {
|
|
202671
202849
|
return telegramUnsupportedResult(
|
|
202672
202850
|
params2,
|
|
202673
202851
|
limit,
|
|
@@ -202679,11 +202857,11 @@ var init_external_channel_messages2 = __esm({
|
|
|
202679
202857
|
}
|
|
202680
202858
|
const rawMessages = yield* client.findAll(
|
|
202681
202859
|
telegram.class.Message,
|
|
202682
|
-
hulyQuery({ attachedTo: toRef(
|
|
202860
|
+
hulyQuery({ attachedTo: toRef(channel2._id) }),
|
|
202683
202861
|
{ limit, sort: { sendOn: import_core69.SortingOrder.Descending } }
|
|
202684
202862
|
);
|
|
202685
202863
|
const messages = yield* Effect_exports.forEach(rawMessages, parseTelegramMessage);
|
|
202686
|
-
const resultChannel = { id:
|
|
202864
|
+
const resultChannel = { id: channel2._id, value: channel2.value };
|
|
202687
202865
|
return {
|
|
202688
202866
|
supported: true,
|
|
202689
202867
|
provider: "telegram",
|
|
@@ -202725,12 +202903,12 @@ var init_threads = __esm({
|
|
|
202725
202903
|
DEFAULT_REPLY_LIMIT = 50;
|
|
202726
202904
|
MAX_REPLY_LIMIT = 200;
|
|
202727
202905
|
listThreadReplies = (params2) => Effect_exports.gen(function* () {
|
|
202728
|
-
const { channel, client, message } = yield* findChannelMessage(params2);
|
|
202906
|
+
const { channel: channel2, client, message } = yield* findChannelMessage(params2);
|
|
202729
202907
|
const markupUrlConfig = client.markupUrlConfig;
|
|
202730
202908
|
const limit = Math.min(params2.limit ?? DEFAULT_REPLY_LIMIT, MAX_REPLY_LIMIT);
|
|
202731
202909
|
const replies = yield* client.findAll(
|
|
202732
202910
|
chunter.class.ThreadMessage,
|
|
202733
|
-
{ attachedTo: toRef(message._id), space:
|
|
202911
|
+
{ attachedTo: toRef(message._id), space: channel2._id },
|
|
202734
202912
|
{ limit, sort: { createdOn: import_core70.SortingOrder.Ascending } }
|
|
202735
202913
|
);
|
|
202736
202914
|
const total = replies.total;
|
|
@@ -202757,19 +202935,19 @@ var init_threads = __esm({
|
|
|
202757
202935
|
return { replies: threadMessages, total: listTotal(total) };
|
|
202758
202936
|
});
|
|
202759
202937
|
addThreadReply = (params2) => Effect_exports.gen(function* () {
|
|
202760
|
-
const { channel, client, message } = yield* findChannelMessage(params2);
|
|
202938
|
+
const { channel: channel2, client, message } = yield* findChannelMessage(params2);
|
|
202761
202939
|
const markupUrlConfig = client.markupUrlConfig;
|
|
202762
202940
|
const replyId = (0, import_core70.generateId)();
|
|
202763
202941
|
const markup = markdownToMarkupString(params2.body, markupUrlConfig);
|
|
202764
202942
|
const replyData = {
|
|
202765
202943
|
message: markup,
|
|
202766
202944
|
attachments: 0,
|
|
202767
|
-
objectId: toRef(
|
|
202945
|
+
objectId: toRef(channel2._id),
|
|
202768
202946
|
objectClass: toRef(chunter.class.Channel)
|
|
202769
202947
|
};
|
|
202770
202948
|
yield* client.addCollection(
|
|
202771
202949
|
chunter.class.ThreadMessage,
|
|
202772
|
-
|
|
202950
|
+
channel2._id,
|
|
202773
202951
|
toRef(message._id),
|
|
202774
202952
|
toRef(chunter.class.ChatMessage),
|
|
202775
202953
|
"replies",
|
|
@@ -202779,22 +202957,22 @@ var init_threads = __esm({
|
|
|
202779
202957
|
return {
|
|
202780
202958
|
id: ThreadReplyId.make(replyId),
|
|
202781
202959
|
messageId: MessageId.make(message._id),
|
|
202782
|
-
channelId: ChannelId.make(
|
|
202960
|
+
channelId: ChannelId.make(channel2._id)
|
|
202783
202961
|
};
|
|
202784
202962
|
});
|
|
202785
202963
|
updateThreadReply = (params2) => Effect_exports.gen(function* () {
|
|
202786
|
-
const { channel, client, message } = yield* findChannelMessage(params2);
|
|
202787
|
-
const reply = yield* findThreadReply(client,
|
|
202964
|
+
const { channel: channel2, client, message } = yield* findChannelMessage(params2);
|
|
202965
|
+
const reply = yield* findThreadReply(client, channel2, message, params2.replyId);
|
|
202788
202966
|
const markupUrlConfig = client.markupUrlConfig;
|
|
202789
202967
|
const markup = markdownToMarkupString(params2.body, markupUrlConfig);
|
|
202790
202968
|
const now2 = yield* Clock_exports.currentTimeMillis;
|
|
202791
202969
|
const updateOps = { message: markup, editedOn: now2 };
|
|
202792
|
-
yield* client.updateDoc(chunter.class.ThreadMessage,
|
|
202970
|
+
yield* client.updateDoc(chunter.class.ThreadMessage, channel2._id, reply._id, updateOps);
|
|
202793
202971
|
return { id: ThreadReplyId.make(reply._id), updated: true };
|
|
202794
202972
|
});
|
|
202795
202973
|
deleteThreadReply = (params2) => Effect_exports.gen(function* () {
|
|
202796
|
-
const { channel, client, message } = yield* findChannelMessage(params2);
|
|
202797
|
-
const reply = yield* findThreadReply(client,
|
|
202974
|
+
const { channel: channel2, client, message } = yield* findChannelMessage(params2);
|
|
202975
|
+
const reply = yield* findThreadReply(client, channel2, message, params2.replyId);
|
|
202798
202976
|
yield* removeThreadReply(client, reply);
|
|
202799
202977
|
return { id: ThreadReplyId.make(reply._id), deleted: true };
|
|
202800
202978
|
});
|
|
@@ -203153,7 +203331,7 @@ var init_chat_message_attachments2 = __esm({
|
|
|
203153
203331
|
className: ObjectClassName.make(objectClass)
|
|
203154
203332
|
});
|
|
203155
203333
|
resolveChannelMessageTarget = (target) => Effect_exports.gen(function* () {
|
|
203156
|
-
const { channel, client, message } = yield* findChannelMessage(target);
|
|
203334
|
+
const { channel: channel2, client, message } = yield* findChannelMessage(target);
|
|
203157
203335
|
const messageId = MessageId.make(message._id);
|
|
203158
203336
|
const coordinates2 = targetCoordinates(
|
|
203159
203337
|
message.space,
|
|
@@ -203168,10 +203346,10 @@ var init_chat_message_attachments2 = __esm({
|
|
|
203168
203346
|
collection: coordinates2.collection,
|
|
203169
203347
|
target: {
|
|
203170
203348
|
kind: "channel_message",
|
|
203171
|
-
channelId: ChannelId.make(
|
|
203172
|
-
channelName: ChannelName.make(
|
|
203349
|
+
channelId: ChannelId.make(channel2._id),
|
|
203350
|
+
channelName: ChannelName.make(channel2.name),
|
|
203173
203351
|
messageId,
|
|
203174
|
-
display: channelMessageDisplay(messageId,
|
|
203352
|
+
display: channelMessageDisplay(messageId, channel2.name),
|
|
203175
203353
|
space: coordinates2.spaceId,
|
|
203176
203354
|
objectId: coordinates2.docId,
|
|
203177
203355
|
objectClass: coordinates2.className,
|
|
@@ -203207,8 +203385,8 @@ var init_chat_message_attachments2 = __esm({
|
|
|
203207
203385
|
};
|
|
203208
203386
|
});
|
|
203209
203387
|
resolveThreadReplyTarget = (target) => Effect_exports.gen(function* () {
|
|
203210
|
-
const { channel, client, message } = yield* findChannelMessage(target);
|
|
203211
|
-
const reply = yield* findThreadReply(client,
|
|
203388
|
+
const { channel: channel2, client, message } = yield* findChannelMessage(target);
|
|
203389
|
+
const reply = yield* findThreadReply(client, channel2, message, target.replyId);
|
|
203212
203390
|
const messageId = MessageId.make(message._id);
|
|
203213
203391
|
const replyId = ThreadReplyId.make(reply._id);
|
|
203214
203392
|
const coordinates2 = targetCoordinates(
|
|
@@ -203224,11 +203402,11 @@ var init_chat_message_attachments2 = __esm({
|
|
|
203224
203402
|
collection: coordinates2.collection,
|
|
203225
203403
|
target: {
|
|
203226
203404
|
kind: "thread_reply",
|
|
203227
|
-
channelId: ChannelId.make(
|
|
203228
|
-
channelName: ChannelName.make(
|
|
203405
|
+
channelId: ChannelId.make(channel2._id),
|
|
203406
|
+
channelName: ChannelName.make(channel2.name),
|
|
203229
203407
|
messageId,
|
|
203230
203408
|
replyId,
|
|
203231
|
-
display: threadReplyDisplay(replyId, messageId,
|
|
203409
|
+
display: threadReplyDisplay(replyId, messageId, channel2.name),
|
|
203232
203410
|
space: coordinates2.spaceId,
|
|
203233
203411
|
objectId: coordinates2.docId,
|
|
203234
203412
|
objectClass: coordinates2.className,
|
|
@@ -204054,25 +204232,25 @@ var init_contact_channel_mappers = __esm({
|
|
|
204054
204232
|
init_shared();
|
|
204055
204233
|
init_errors4();
|
|
204056
204234
|
init_contact_channel_providers();
|
|
204057
|
-
channelSummary = (
|
|
204058
|
-
const provider = fromContactChannelProviderRef(
|
|
204235
|
+
channelSummary = (channel2) => Effect_exports.gen(function* () {
|
|
204236
|
+
const provider = fromContactChannelProviderRef(channel2.provider);
|
|
204059
204237
|
if (provider instanceof InvalidContactProviderError) {
|
|
204060
204238
|
return yield* provider;
|
|
204061
204239
|
}
|
|
204062
204240
|
return {
|
|
204063
|
-
channelId: ChannelId.make(
|
|
204241
|
+
channelId: ChannelId.make(channel2._id),
|
|
204064
204242
|
provider,
|
|
204065
|
-
value:
|
|
204066
|
-
items:
|
|
204067
|
-
lastMessage:
|
|
204243
|
+
value: channel2.value,
|
|
204244
|
+
items: channel2.items !== void 0 ? Count.make(channel2.items) : void 0,
|
|
204245
|
+
lastMessage: channel2.lastMessage !== void 0 ? Timestamp.make(channel2.lastMessage) : void 0
|
|
204068
204246
|
};
|
|
204069
204247
|
});
|
|
204070
|
-
channelSummaryWithValue = (
|
|
204071
|
-
channelId: ChannelId.make(
|
|
204248
|
+
channelSummaryWithValue = (channel2, provider, value3) => ({
|
|
204249
|
+
channelId: ChannelId.make(channel2._id),
|
|
204072
204250
|
provider,
|
|
204073
204251
|
value: value3,
|
|
204074
|
-
items:
|
|
204075
|
-
lastMessage:
|
|
204252
|
+
items: channel2.items !== void 0 ? Count.make(channel2.items) : void 0,
|
|
204253
|
+
lastMessage: channel2.lastMessage !== void 0 ? Timestamp.make(channel2.lastMessage) : void 0
|
|
204076
204254
|
});
|
|
204077
204255
|
}
|
|
204078
204256
|
});
|
|
@@ -204212,7 +204390,7 @@ var init_contact_channels2 = __esm({
|
|
|
204212
204390
|
if (locator._tag === "channelId") {
|
|
204213
204391
|
return yield* Effect_exports.flatMap(
|
|
204214
204392
|
findChannelByIdForOwner(client, owner, locator.channelId),
|
|
204215
|
-
(
|
|
204393
|
+
(channel2) => Option_exports.match(channel2, {
|
|
204216
204394
|
onNone: () => Effect_exports.fail(
|
|
204217
204395
|
new ContactChannelNotFoundError({
|
|
204218
204396
|
ownerIdentifier: owner.identifier,
|
|
@@ -204255,7 +204433,7 @@ var init_contact_channels2 = __esm({
|
|
|
204255
204433
|
});
|
|
204256
204434
|
ensureNoTargetConflict = (client, owner, currentChannelId, provider, value3) => Effect_exports.gen(function* () {
|
|
204257
204435
|
const matches = yield* findExactChannels(client, owner, provider, value3);
|
|
204258
|
-
const conflicting = matches.some((
|
|
204436
|
+
const conflicting = matches.some((channel2) => channel2._id !== currentChannelId);
|
|
204259
204437
|
if (conflicting) {
|
|
204260
204438
|
return yield* new ContactChannelConflictError({ ownerIdentifier: owner.identifier, provider, value: value3 });
|
|
204261
204439
|
}
|
|
@@ -204286,31 +204464,31 @@ var init_contact_channels2 = __esm({
|
|
|
204286
204464
|
updateOwnerChannel = (client, owner, params2) => Effect_exports.gen(function* () {
|
|
204287
204465
|
yield* requireChannelUpdateFields(params2);
|
|
204288
204466
|
const locator = yield* validateChannelLocator2(owner.identifier, params2);
|
|
204289
|
-
const
|
|
204290
|
-
const currentProvider = fromContactChannelProviderRef(
|
|
204467
|
+
const channel2 = yield* resolveChannelByLocator(client, owner, locator);
|
|
204468
|
+
const currentProvider = fromContactChannelProviderRef(channel2.provider);
|
|
204291
204469
|
if (currentProvider instanceof InvalidContactProviderError) {
|
|
204292
204470
|
return yield* currentProvider;
|
|
204293
204471
|
}
|
|
204294
204472
|
const nextProvider = params2.newProvider ?? currentProvider;
|
|
204295
|
-
const nextValue = params2.newValue ??
|
|
204473
|
+
const nextValue = params2.newValue ?? channel2.value;
|
|
204296
204474
|
yield* validateProviderValue(nextProvider, nextValue);
|
|
204297
204475
|
const nextProviderRef = toContactChannelProviderRef(nextProvider);
|
|
204298
|
-
if (
|
|
204299
|
-
return { updated: false, channel: yield* channelSummary(
|
|
204476
|
+
if (channel2.provider === nextProviderRef && channel2.value === nextValue) {
|
|
204477
|
+
return { updated: false, channel: yield* channelSummary(channel2) };
|
|
204300
204478
|
}
|
|
204301
|
-
yield* ensureNoTargetConflict(client, owner,
|
|
204479
|
+
yield* ensureNoTargetConflict(client, owner, channel2._id, nextProvider, nextValue);
|
|
204302
204480
|
const operations = { provider: nextProviderRef, value: nextValue };
|
|
204303
|
-
yield* client.updateDoc(contact.class.Channel, contact.space.Contacts,
|
|
204304
|
-
return { updated: true, channel: channelSummaryWithValue(
|
|
204481
|
+
yield* client.updateDoc(contact.class.Channel, contact.space.Contacts, channel2._id, operations);
|
|
204482
|
+
return { updated: true, channel: channelSummaryWithValue(channel2, nextProvider, nextValue) };
|
|
204305
204483
|
});
|
|
204306
204484
|
removeOwnerChannel = (client, owner, params2) => Effect_exports.gen(function* () {
|
|
204307
204485
|
const locator = yield* validateChannelLocator2(owner.identifier, params2);
|
|
204308
|
-
const
|
|
204309
|
-
if (Option_exports.isNone(
|
|
204486
|
+
const channel2 = yield* findRemovableChannel(client, owner, locator);
|
|
204487
|
+
if (Option_exports.isNone(channel2)) {
|
|
204310
204488
|
return locator._tag === "channelId" ? { removed: false, channelId: locator.channelId } : { removed: false };
|
|
204311
204489
|
}
|
|
204312
|
-
yield* client.removeDoc(contact.class.Channel, contact.space.Contacts,
|
|
204313
|
-
return { removed: true, channelId: ChannelId.make(
|
|
204490
|
+
yield* client.removeDoc(contact.class.Channel, contact.space.Contacts, channel2.value._id);
|
|
204491
|
+
return { removed: true, channelId: ChannelId.make(channel2.value._id) };
|
|
204314
204492
|
});
|
|
204315
204493
|
listPersonChannels = (params2) => Effect_exports.gen(function* () {
|
|
204316
204494
|
const client = yield* HulyClient;
|
|
@@ -206967,10 +207145,10 @@ var init_person_administration_projection = __esm({
|
|
|
206967
207145
|
...identity2.verifiedOn === void 0 ? {} : { verifiedOn: identity2.verifiedOn },
|
|
206968
207146
|
isDeleted: identity2.isDeleted === true
|
|
206969
207147
|
});
|
|
206970
|
-
channelProjection = (
|
|
206971
|
-
channelId:
|
|
206972
|
-
...
|
|
206973
|
-
...
|
|
207148
|
+
channelProjection = (channel2) => ({
|
|
207149
|
+
channelId: channel2._id,
|
|
207150
|
+
...channel2.items === void 0 ? {} : { items: channel2.items },
|
|
207151
|
+
...channel2.lastMessage === void 0 ? {} : { lastMessage: channel2.lastMessage }
|
|
206974
207152
|
});
|
|
206975
207153
|
workspaceMemberProjection = (employee, member) => ({
|
|
206976
207154
|
member: member !== void 0,
|
|
@@ -230166,8 +230344,8 @@ var init_time2 = __esm({
|
|
|
230166
230344
|
if (person === void 0) {
|
|
230167
230345
|
const channels = yield* client.findAll(contact.class.Channel, { value: params2.employeeId });
|
|
230168
230346
|
if (isNonEmpty3(channels)) {
|
|
230169
|
-
const
|
|
230170
|
-
query.user = refAsPersonId(
|
|
230347
|
+
const channel2 = channels[0];
|
|
230348
|
+
query.user = refAsPersonId(channel2.attachedTo);
|
|
230171
230349
|
}
|
|
230172
230350
|
} else {
|
|
230173
230351
|
query.user = refAsPersonId(person._id);
|
|
@@ -232844,29 +233022,40 @@ var createRequestAdmission;
|
|
|
232844
233022
|
var init_request_admission = __esm({
|
|
232845
233023
|
"src/mcp/request-admission.ts"() {
|
|
232846
233024
|
"use strict";
|
|
233025
|
+
init_http_admission_observations();
|
|
232847
233026
|
createRequestAdmission = () => {
|
|
232848
233027
|
const state = { accepting: true, active: 0 };
|
|
232849
233028
|
const drainWaiters = /* @__PURE__ */ new Set();
|
|
233029
|
+
observeHttpAdmission("createRequestAdmission", {});
|
|
232850
233030
|
const releaseDrains = () => {
|
|
232851
233031
|
if (state.active !== 0) return;
|
|
232852
233032
|
for (const resolve6 of drainWaiters) resolve6();
|
|
232853
233033
|
drainWaiters.clear();
|
|
232854
233034
|
};
|
|
232855
233035
|
const enter = () => {
|
|
232856
|
-
if (!state.accepting)
|
|
233036
|
+
if (!state.accepting) {
|
|
233037
|
+
observeHttpAdmission("RequestAdmission_enter", { admitted: false });
|
|
233038
|
+
return null;
|
|
233039
|
+
}
|
|
232857
233040
|
state.active++;
|
|
233041
|
+
observeHttpAdmission("RequestAdmission_enter", { admitted: true });
|
|
232858
233042
|
const leaseState = { released: false };
|
|
232859
233043
|
return {
|
|
232860
233044
|
release: () => {
|
|
232861
|
-
if (leaseState.released)
|
|
233045
|
+
if (leaseState.released) {
|
|
233046
|
+
observeHttpAdmission("RequestLease_release", { active: state.active });
|
|
233047
|
+
return;
|
|
233048
|
+
}
|
|
232862
233049
|
leaseState.released = true;
|
|
232863
233050
|
state.active--;
|
|
232864
233051
|
releaseDrains();
|
|
233052
|
+
observeHttpAdmission("RequestLease_release", { active: state.active });
|
|
232865
233053
|
}
|
|
232866
233054
|
};
|
|
232867
233055
|
};
|
|
232868
233056
|
const quiesce = () => {
|
|
232869
233057
|
state.accepting = false;
|
|
233058
|
+
observeHttpAdmission("RequestAdmission_quiesce", { drained: state.active === 0 });
|
|
232870
233059
|
if (state.active === 0) return Promise.resolve();
|
|
232871
233060
|
return new Promise((resolve6) => drainWaiters.add(resolve6));
|
|
232872
233061
|
};
|
|
@@ -234139,13 +234328,26 @@ var createRequestClientLifecycle, attachRequestClientLifecycle;
|
|
|
234139
234328
|
var init_request_client_lifecycle = __esm({
|
|
234140
234329
|
"src/mcp/request-client-lifecycle.ts"() {
|
|
234141
234330
|
"use strict";
|
|
234331
|
+
init_http_admission_observations();
|
|
234142
234332
|
createRequestClientLifecycle = (acquire) => {
|
|
234143
234333
|
let leasePromise;
|
|
234144
234334
|
let closed = false;
|
|
234145
234335
|
let closePromise;
|
|
234336
|
+
observeHttpAdmission("createRequestClientLifecycle", {});
|
|
234146
234337
|
const resolve6 = async () => {
|
|
234147
|
-
if (closed)
|
|
234338
|
+
if (closed) {
|
|
234339
|
+
observeHttpAdmission("RequestClientLifecycle_resolve", { closed: true });
|
|
234340
|
+
throw new Error("Request-scoped Huly clients are already closed");
|
|
234341
|
+
}
|
|
234342
|
+
observeHttpAdmission("RequestClientLifecycle_resolve", { closed: false });
|
|
234343
|
+
const startsAcquisition = leasePromise === void 0;
|
|
234148
234344
|
leasePromise ??= acquire();
|
|
234345
|
+
if (startsAcquisition && admissionObservationsEnabled()) {
|
|
234346
|
+
void leasePromise.then(
|
|
234347
|
+
() => observeHttpAdmission("RequestClientLifecycle_acquireSettles", { rejected: false }),
|
|
234348
|
+
() => observeHttpAdmission("RequestClientLifecycle_acquireSettles", { rejected: true })
|
|
234349
|
+
);
|
|
234350
|
+
}
|
|
234149
234351
|
const lease = await leasePromise;
|
|
234150
234352
|
if (closed) {
|
|
234151
234353
|
await closePromise;
|
|
@@ -234154,12 +234356,22 @@ var init_request_client_lifecycle = __esm({
|
|
|
234154
234356
|
return lease.bundle;
|
|
234155
234357
|
};
|
|
234156
234358
|
const close3 = () => {
|
|
234157
|
-
if (closePromise !== void 0)
|
|
234359
|
+
if (closePromise !== void 0) {
|
|
234360
|
+
observeHttpAdmission("RequestClientLifecycle_close", { firstClose: false });
|
|
234361
|
+
return closePromise;
|
|
234362
|
+
}
|
|
234158
234363
|
closed = true;
|
|
234364
|
+
observeHttpAdmission("RequestClientLifecycle_close", { firstClose: true });
|
|
234159
234365
|
const pending = leasePromise;
|
|
234160
234366
|
closePromise = pending === void 0 ? Promise.resolve() : pending.then(
|
|
234161
234367
|
async (lease) => {
|
|
234162
|
-
|
|
234368
|
+
try {
|
|
234369
|
+
await lease.close();
|
|
234370
|
+
} catch (error3) {
|
|
234371
|
+
observeHttpAdmission("RequestClientLifecycle_leaseCloseSettles", { failed: true });
|
|
234372
|
+
throw error3;
|
|
234373
|
+
}
|
|
234374
|
+
observeHttpAdmission("RequestClientLifecycle_leaseCloseSettles", { failed: false });
|
|
234163
234375
|
},
|
|
234164
234376
|
() => {
|
|
234165
234377
|
}
|
|
@@ -234168,7 +234380,7 @@ var init_request_client_lifecycle = __esm({
|
|
|
234168
234380
|
};
|
|
234169
234381
|
return { resolve: resolve6, close: close3 };
|
|
234170
234382
|
};
|
|
234171
|
-
attachRequestClientLifecycle = (server, lifecycle, onCleanupError) => {
|
|
234383
|
+
attachRequestClientLifecycle = (server, lifecycle, onCleanupError, quiesceRequests = () => Promise.resolve()) => {
|
|
234172
234384
|
const previousOnClose = server.onclose;
|
|
234173
234385
|
const originalClose = server.close.bind(server);
|
|
234174
234386
|
let serverClosePromise;
|
|
@@ -234179,14 +234391,20 @@ var init_request_client_lifecycle = __esm({
|
|
|
234179
234391
|
cleanupErrorReported = true;
|
|
234180
234392
|
onCleanupError(error3 instanceof Error ? error3 : new Error(String(error3)));
|
|
234181
234393
|
};
|
|
234394
|
+
observeHttpAdmission("attachRequestClientLifecycle", {});
|
|
234182
234395
|
server.onclose = () => {
|
|
234183
|
-
if (!wrapperCloseInProgress)
|
|
234396
|
+
if (!wrapperCloseInProgress) {
|
|
234397
|
+
void server.close().catch(reportCleanupError);
|
|
234398
|
+
observeHttpAdmission("Server_onclose", {});
|
|
234399
|
+
}
|
|
234184
234400
|
previousOnClose?.();
|
|
234185
234401
|
};
|
|
234186
234402
|
server.close = () => {
|
|
234403
|
+
observeHttpAdmission("Server_closeStarts", {});
|
|
234187
234404
|
if (serverClosePromise !== void 0) return serverClosePromise;
|
|
234188
234405
|
wrapperCloseInProgress = true;
|
|
234189
234406
|
serverClosePromise = (async () => {
|
|
234407
|
+
const draining = quiesceRequests();
|
|
234190
234408
|
const closeOriginal = async () => {
|
|
234191
234409
|
try {
|
|
234192
234410
|
await originalClose();
|
|
@@ -234195,8 +234413,13 @@ var init_request_client_lifecycle = __esm({
|
|
|
234195
234413
|
}
|
|
234196
234414
|
};
|
|
234197
234415
|
const [serverResult] = await Promise.allSettled([closeOriginal()]);
|
|
234416
|
+
await draining;
|
|
234198
234417
|
const [lifecycleResult] = await Promise.allSettled([lifecycle.close()]);
|
|
234199
234418
|
if (lifecycleResult.status === "rejected") reportCleanupError(lifecycleResult.reason);
|
|
234419
|
+
observeHttpAdmission("Server_close", {
|
|
234420
|
+
underlyingFails: serverResult.status === "rejected",
|
|
234421
|
+
leaseCloseFails: lifecycleResult.status === "rejected"
|
|
234422
|
+
});
|
|
234200
234423
|
if (serverResult.status === "rejected" && lifecycleResult.status === "rejected") {
|
|
234201
234424
|
throw new AggregateError(
|
|
234202
234425
|
[serverResult.reason, lifecycleResult.reason],
|
|
@@ -238836,7 +239059,7 @@ var init_server = __esm({
|
|
|
238836
239059
|
}
|
|
238837
239060
|
return config2.resolveClientLeaseForHttpRequest(requestInfo);
|
|
238838
239061
|
});
|
|
238839
|
-
const [server] = createMcpServer(
|
|
239062
|
+
const [server, admissionLifecycle] = createMcpServer(
|
|
238840
239063
|
lifecycle.resolve,
|
|
238841
239064
|
telemetry,
|
|
238842
239065
|
registries,
|
|
@@ -238849,9 +239072,12 @@ var init_server = __esm({
|
|
|
238849
239072
|
}),
|
|
238850
239073
|
hostedHulyMigrationInstructionsForOrigin(requestRuntimeConfig.huly.url.origin)
|
|
238851
239074
|
);
|
|
238852
|
-
attachRequestClientLifecycle(
|
|
238853
|
-
|
|
238854
|
-
|
|
239075
|
+
attachRequestClientLifecycle(
|
|
239076
|
+
server,
|
|
239077
|
+
lifecycle,
|
|
239078
|
+
() => writeError("Request-scoped Huly client cleanup failed\n"),
|
|
239079
|
+
admissionLifecycle.quiesce
|
|
239080
|
+
);
|
|
238855
239081
|
return server;
|
|
238856
239082
|
};
|
|
238857
239083
|
yield* Effect_exports.raceFirst(
|
|
@@ -238940,11 +239166,12 @@ var init_stdio_output = __esm({
|
|
|
238940
239166
|
});
|
|
238941
239167
|
|
|
238942
239168
|
// src/runtime/huly-clients.ts
|
|
238943
|
-
var buildCombinedClientLayer, makeScopeClose, buildScopedClientBundle, isRecoverableClientUnavailableCause, startClientAcquisition, acquiredClients,
|
|
239169
|
+
var buildCombinedClientLayer, makeScopeClose, buildScopedClientBundle, isRecoverableClientUnavailableCause, startClientAcquisition, acquiredClients, createClientResolver;
|
|
238944
239170
|
var init_huly_clients = __esm({
|
|
238945
239171
|
"src/runtime/huly-clients.ts"() {
|
|
238946
239172
|
"use strict";
|
|
238947
239173
|
init_dist();
|
|
239174
|
+
init_http_admission_observations();
|
|
238948
239175
|
init_config();
|
|
238949
239176
|
init_client();
|
|
238950
239177
|
init_errors_base();
|
|
@@ -239000,41 +239227,39 @@ var init_huly_clients = __esm({
|
|
|
239000
239227
|
acquiredClients = (acquisition) => acquisition.result.then(
|
|
239001
239228
|
(exit3) => Exit_exports.isSuccess(exit3) ? Exit_exports.succeed(exit3.value.bundle) : Exit_exports.failCause(exit3.cause)
|
|
239002
239229
|
);
|
|
239003
|
-
primedAcquisition = (scoped6) => ({
|
|
239004
|
-
result: Promise.resolve(Exit_exports.succeed(scoped6)),
|
|
239005
|
-
close: scoped6.close
|
|
239006
|
-
});
|
|
239007
239230
|
createClientResolver = (combinedClientLayer) => {
|
|
239008
239231
|
const state = { active: void 0, closePromise: void 0, closed: false };
|
|
239009
239232
|
const acquisitions = /* @__PURE__ */ new Set();
|
|
239233
|
+
observeHttpAdmission("createClientResolver", {});
|
|
239010
239234
|
const resolve6 = () => {
|
|
239011
|
-
if (state.closed)
|
|
239235
|
+
if (state.closed) {
|
|
239236
|
+
observeHttpAdmission("ClientResolver_resolve", { startedAcquisition: false });
|
|
239237
|
+
return Promise.resolve(Exit_exports.die(new Error("Process-scoped Huly clients are closed")));
|
|
239238
|
+
}
|
|
239239
|
+
observeHttpAdmission("ClientResolver_resolve", { startedAcquisition: state.active === void 0 });
|
|
239012
239240
|
if (state.active === void 0) {
|
|
239013
239241
|
const acquisition = startClientAcquisition(combinedClientLayer);
|
|
239014
239242
|
const active = { acquisition, clients: acquiredClients(acquisition) };
|
|
239015
239243
|
acquisitions.add(acquisition);
|
|
239016
239244
|
state.active = active;
|
|
239017
239245
|
void acquisition.result.then((exit3) => {
|
|
239018
|
-
|
|
239246
|
+
const recoverable = Exit_exports.isFailure(exit3) && isRecoverableClientUnavailableCause(exit3.cause);
|
|
239247
|
+
const evicted = recoverable && state.active === active;
|
|
239248
|
+
if (evicted) {
|
|
239019
239249
|
state.active = void 0;
|
|
239020
239250
|
acquisitions.delete(acquisition);
|
|
239021
239251
|
}
|
|
239252
|
+
if (Exit_exports.hasInterrupts(exit3)) return;
|
|
239253
|
+
observeHttpAdmission(
|
|
239254
|
+
"buildScopedClientBundle",
|
|
239255
|
+
Exit_exports.isSuccess(exit3) ? { outcome: "Succeeded", evicted: false } : recoverable ? { outcome: "FailedRecoverable", evicted } : { outcome: "FailedFatal", evicted: false }
|
|
239256
|
+
);
|
|
239022
239257
|
});
|
|
239023
239258
|
}
|
|
239024
239259
|
return state.active.clients;
|
|
239025
239260
|
};
|
|
239026
|
-
const prime = async (scoped6) => {
|
|
239027
|
-
if (state.closed) throw new Error("Cannot prime closed process-scoped Huly clients");
|
|
239028
|
-
const previous = state.active?.acquisition;
|
|
239029
|
-
const acquisition = primedAcquisition(scoped6);
|
|
239030
|
-
acquisitions.add(acquisition);
|
|
239031
|
-
state.active = { acquisition, clients: acquiredClients(acquisition) };
|
|
239032
|
-
if (previous !== void 0) {
|
|
239033
|
-
acquisitions.delete(previous);
|
|
239034
|
-
await previous.close();
|
|
239035
|
-
}
|
|
239036
|
-
};
|
|
239037
239261
|
const close3 = () => {
|
|
239262
|
+
observeHttpAdmission("ClientResolver_close", { firstClose: state.closePromise === void 0 });
|
|
239038
239263
|
state.closed = true;
|
|
239039
239264
|
if (state.closePromise === void 0) {
|
|
239040
239265
|
const owned = [...acquisitions];
|
|
@@ -239045,7 +239270,7 @@ var init_huly_clients = __esm({
|
|
|
239045
239270
|
}
|
|
239046
239271
|
return state.closePromise;
|
|
239047
239272
|
};
|
|
239048
|
-
return { resolve: resolve6,
|
|
239273
|
+
return { resolve: resolve6, close: close3 };
|
|
239049
239274
|
};
|
|
239050
239275
|
}
|
|
239051
239276
|
});
|
|
@@ -239056,19 +239281,27 @@ var init_http_client_leases = __esm({
|
|
|
239056
239281
|
"src/runtime/http-client-leases.ts"() {
|
|
239057
239282
|
"use strict";
|
|
239058
239283
|
init_dist();
|
|
239284
|
+
init_http_admission_observations();
|
|
239059
239285
|
init_config();
|
|
239060
239286
|
init_huly_clients();
|
|
239061
239287
|
webHeadersRecord = (headers) => Object.fromEntries(headers.entries());
|
|
239062
239288
|
createHttpClientLeaseResolver = (combinedClientLayer, resolveEnvClients) => async (request4) => {
|
|
239063
239289
|
const providerExit = await Effect_exports.runPromiseExit(hulyConfigProviderFromHeaders(webHeadersRecord(request4.headers)));
|
|
239064
239290
|
if (Exit_exports.isFailure(providerExit)) {
|
|
239291
|
+
observeHttpAdmission("createHttpClientLeaseResolver", { headers: "InvalidHulyHeaders", succeeded: false });
|
|
239065
239292
|
return { bundle: Exit_exports.failCause(providerExit.cause), close: () => {
|
|
239066
239293
|
} };
|
|
239067
239294
|
}
|
|
239068
239295
|
const configProvider = providerExit.value;
|
|
239069
239296
|
if (configProvider === void 0) {
|
|
239070
|
-
return resolveEnvClients().then((bundle) =>
|
|
239071
|
-
|
|
239297
|
+
return resolveEnvClients().then((bundle) => {
|
|
239298
|
+
observeHttpAdmission("createHttpClientLeaseResolver", {
|
|
239299
|
+
headers: "NoHulyHeaders",
|
|
239300
|
+
succeeded: Exit_exports.isSuccess(bundle)
|
|
239301
|
+
});
|
|
239302
|
+
return { bundle, close: () => {
|
|
239303
|
+
} };
|
|
239304
|
+
});
|
|
239072
239305
|
}
|
|
239073
239306
|
const clientExit = await Effect_exports.runPromiseExit(
|
|
239074
239307
|
buildScopedClientBundle(combinedClientLayer).pipe(
|
|
@@ -239076,6 +239309,10 @@ var init_http_client_leases = __esm({
|
|
|
239076
239309
|
Effect_exports.map(({ bundle, close: close3 }) => ({ bundle: Exit_exports.succeed(bundle), close: close3 }))
|
|
239077
239310
|
)
|
|
239078
239311
|
);
|
|
239312
|
+
observeHttpAdmission(
|
|
239313
|
+
"createHttpClientLeaseResolver",
|
|
239314
|
+
Exit_exports.isSuccess(clientExit) ? { headers: "ValidHulyHeaders", buildOk: true, succeeded: true } : { headers: "ValidHulyHeaders", buildOk: false, succeeded: false }
|
|
239315
|
+
);
|
|
239079
239316
|
return Exit_exports.isSuccess(clientExit) ? clientExit.value : { bundle: Exit_exports.failCause(clientExit.cause), close: () => {
|
|
239080
239317
|
} };
|
|
239081
239318
|
};
|
|
@@ -239092,7 +239329,7 @@ __export(index_exports, {
|
|
|
239092
239329
|
getMcpAuthToken: () => getMcpAuthToken,
|
|
239093
239330
|
main: () => main
|
|
239094
239331
|
});
|
|
239095
|
-
var getTransportType, httpPortConfig, getHttpPort, getHttpHost, getMcpAuthToken, DEFAULT_PROCESS_CLOSE_GRACE_PERIOD, closeProcessClients, isGlamaRegistryInspection, parseBooleanEnvFlag, getLazyEnvs, restoreConsoleRedirect, webHeadersRecord2, buildAppLayer, runConfiguredServer, main, isMainModule;
|
|
239332
|
+
var getTransportType, httpPortConfig, getHttpPort, getHttpHost, McpAuthToken, getMcpAuthToken, DEFAULT_PROCESS_CLOSE_GRACE_PERIOD, closeProcessClients, isGlamaRegistryInspection, parseBooleanEnvFlag, getLazyEnvs, restoreConsoleRedirect, webHeadersRecord2, buildAppLayer, runConfiguredServer, main, isMainModule;
|
|
239096
239333
|
var init_index = __esm({
|
|
239097
239334
|
"src/index.ts"() {
|
|
239098
239335
|
"use strict";
|
|
@@ -239125,7 +239362,12 @@ var init_index = __esm({
|
|
|
239125
239362
|
getHttpHost = Config_exports.schema(HttpHost, "MCP_HTTP_HOST").pipe(
|
|
239126
239363
|
Config_exports.withDefault(DEFAULT_HTTP_HOST)
|
|
239127
239364
|
);
|
|
239128
|
-
|
|
239365
|
+
McpAuthToken = Schema_exports.RedactedFromValue(
|
|
239366
|
+
Schema_exports.String.check(
|
|
239367
|
+
Schema_exports.makeFilter((token) => token.trim().length > 0, { message: "must not be empty or whitespace-only" })
|
|
239368
|
+
)
|
|
239369
|
+
);
|
|
239370
|
+
getMcpAuthToken = Config_exports.schema(McpAuthToken, "MCP_AUTH_TOKEN").pipe(Config_exports.option);
|
|
239129
239371
|
DEFAULT_PROCESS_CLOSE_GRACE_PERIOD = "5 seconds";
|
|
239130
239372
|
closeProcessClients = (closeClients, gracePeriod = DEFAULT_PROCESS_CLOSE_GRACE_PERIOD, writeError = writeStderrLine) => Effect_exports.tryPromise(closeClients).pipe(
|
|
239131
239373
|
Effect_exports.interruptible,
|
|
@@ -239432,7 +239674,7 @@ if (unsupportedRuntime) {
|
|
|
239432
239674
|
detectedNodeVersion: process.versions.node,
|
|
239433
239675
|
executable: process.execPath,
|
|
239434
239676
|
requiredNodeVersion: nodeEngineRequirement,
|
|
239435
|
-
serverVersion: "0.52.
|
|
239677
|
+
serverVersion: "0.52.4"
|
|
239436
239678
|
});
|
|
239437
239679
|
startUnsupportedNodeMcp(config2);
|
|
239438
239680
|
} else {
|