@fedify/fedify 2.4.0-pr.934.40 → 2.4.0-pr.936.41
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 +0 -3
- package/dist/{builder-BBPwtB2v.mjs → builder-DonuxRl_.mjs} +2 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{context-Cjnr0ig1.d.ts → context-Zii1f5xS.d.ts} +1 -1
- package/dist/{context-C05Rgxmu.d.cts → context-lxX6I7as.d.cts} +1 -1
- package/dist/{deno-D3c0o_N0.mjs → deno-BHzKn9Ig.mjs} +1 -1
- package/dist/{docloader-BCecHIxU.mjs → docloader-e1khNUKy.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +5 -3
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- package/dist/federation/mod.cjs +9 -288
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -279
- package/dist/federation/mq.test.mjs +1 -20
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +2 -39
- package/dist/federation/tasks/tasks.test.mjs +3 -3
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-Dm0JAUa_.mjs → http-CPVMUgsW.mjs} +3 -3
- package/dist/{http-Ctb_KhZ8.js → http-CsmQ-BQ4.js} +1 -1
- package/dist/{http-jr0TkgZe.cjs → http-hlIjmewS.cjs} +1 -1
- package/dist/{key-C_gNKtxm.mjs → key-DfPsX8hv.mjs} +2 -2
- package/dist/{kv-cache-BxUZRBC2.js → kv-cache-5bnX3-Jq.js} +1 -1
- package/dist/{kv-cache-D-hbjJAD.cjs → kv-cache-DQ29C4XL.cjs} +1 -1
- package/dist/{kv-cache-B7H7lZ84.mjs → kv-cache-KyGqJqSp.mjs} +1 -1
- package/dist/{ld-DAPAVL_7.mjs → ld-Cj9F_5AP.mjs} +3 -3
- package/dist/{metrics-DN13mCAw.d.cts → metrics-CoUJLQhZ.d.cts} +1 -19
- package/dist/{metrics-BMaatuZi.mjs → metrics-DMk-nTxI.mjs} +1 -1
- package/dist/{metrics-v_e0n5GQ.d.ts → metrics-Dc4jR-IC.d.ts} +1 -19
- package/dist/{middleware-DfPBAh9L.mjs → middleware-CEctxBN6.mjs} +1 -1
- package/dist/{middleware-O2LHXFEk.mjs → middleware-CvwTUgnP.mjs} +15 -14
- package/dist/{middleware-BW7WQltk.cjs → middleware-FrSMAYEx.cjs} +325 -40
- package/dist/{middleware-CfZR_riY.js → middleware-Y-kpsp6S.js} +278 -6
- package/dist/{mod-BrpVsSfY.d.cts → mod-BtEaIEcD.d.cts} +1 -1
- package/dist/{mod-BsCE5Ihq.d.ts → mod-DLc2Ot6f.d.ts} +1 -1
- package/dist/{mod-CNef4in0.d.ts → mod-UMmveiO0.d.ts} +1 -1
- package/dist/{mod-DdONo-ep.d.cts → mod-gOlPDuT8.d.cts} +1 -1
- package/dist/mod.cjs +6 -6
- package/dist/mod.d.cts +4 -4
- package/dist/mod.d.ts +4 -4
- package/dist/mod.js +5 -5
- package/dist/{mq-Bo7Etgh6.mjs → mq-llHKivST.mjs} +0 -6
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-Dcx-czqn.mjs → owner-Br9YYzn_.mjs} +2 -2
- package/dist/{proof-BkAxvrjt.mjs → proof-B4ngoaNQ.mjs} +3 -3
- package/dist/{proof-D-H_PnJW.js → proof-B6E0XUXJ.js} +1 -1
- package/dist/{proof-NY0D8Oux.cjs → proof-NN4xCQGL.cjs} +1 -1
- package/dist/{send-D_j7E-oC.mjs → send-CxHKUNzv.mjs} +3 -3
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +1 -1
- package/dist/{temporal-yE5EcfNX.mjs → temporal-fsXO5IvD.mjs} +1 -1
- package/dist/testing/mod.d.mts +1 -14
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
|
@@ -2,10 +2,10 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import { t as __exportAll } from "./chunk-D5IdezsZ.js";
|
|
4
4
|
import { r as getDefaultActivityTransformers } from "./transformers-DXze6FUB.js";
|
|
5
|
-
import { A as formatAcceptSignature, D as recordOutboxEnqueue, E as recordOutboxActivity, F as version, O as recordWebFingerHandle, P as name, S as recordCollectionTotalItems, T as recordInboxActivity, a as verifyRequestDetailed, b as recordCollectionPageItems, d as validateCryptoKey, f as getDurationMs, g as isAbortError, h as instrumentDocumentLoader, i as verifyRequest, k as registerQueueDepthGauge, m as getRemoteHost, n as parseRfc9421SignatureInput, o as exportJwk, p as getFederationMetrics, t as doubleKnock, u as importJwk, v as recordCircuitBreakerStateChange, w as recordFanoutRecipients, x as recordCollectionRequest, y as recordCollectionDispatchDuration } from "./http-
|
|
6
|
-
import { _ as hasSignatureLike, b as signJsonLd, c as getKeyOwner, f as compactJsonLd, g as hasSignature, h as getNormalizationContextLoader, i as verifyObject, l as InvalidContextReferenceError, m as detachSignature, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, r as signObject, s as doesActorOwnKey, u as assertSafeJsonLd, v as isClearlyMalformedContextReference, w as wrapContextLoaderForJsonLd, x as verifyCompactJsonLd, y as isInvalidUrlTypeError } from "./proof-
|
|
5
|
+
import { A as formatAcceptSignature, D as recordOutboxEnqueue, E as recordOutboxActivity, F as version, O as recordWebFingerHandle, P as name, S as recordCollectionTotalItems, T as recordInboxActivity, a as verifyRequestDetailed, b as recordCollectionPageItems, d as validateCryptoKey, f as getDurationMs, g as isAbortError, h as instrumentDocumentLoader, i as verifyRequest, k as registerQueueDepthGauge, m as getRemoteHost, n as parseRfc9421SignatureInput, o as exportJwk, p as getFederationMetrics, t as doubleKnock, u as importJwk, v as recordCircuitBreakerStateChange, w as recordFanoutRecipients, x as recordCollectionRequest, y as recordCollectionDispatchDuration } from "./http-CsmQ-BQ4.js";
|
|
6
|
+
import { _ as hasSignatureLike, b as signJsonLd, c as getKeyOwner, f as compactJsonLd, g as hasSignature, h as getNormalizationContextLoader, i as verifyObject, l as InvalidContextReferenceError, m as detachSignature, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, r as signObject, s as doesActorOwnKey, u as assertSafeJsonLd, v as isClearlyMalformedContextReference, w as wrapContextLoaderForJsonLd, x as verifyCompactJsonLd, y as isInvalidUrlTypeError } from "./proof-B6E0XUXJ.js";
|
|
7
7
|
import { n as getNodeInfo, t as nodeInfoToJson } from "./types-DC1pNgJA.js";
|
|
8
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
8
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-5bnX3-Jq.js";
|
|
9
9
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
10
10
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
11
11
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, Tombstone, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
@@ -3900,6 +3900,278 @@ const classReviver = (filter, init, set) => (seen, revive, node) => {
|
|
|
3900
3900
|
})();
|
|
3901
3901
|
};
|
|
3902
3902
|
//#endregion
|
|
3903
|
+
//#region src/federation/mq.ts
|
|
3904
|
+
/**
|
|
3905
|
+
* A message queue that processes messages in the same process.
|
|
3906
|
+
* Do not use this in production as it does neither persist messages nor
|
|
3907
|
+
* distribute them across multiple processes.
|
|
3908
|
+
*
|
|
3909
|
+
* @since 0.5.0
|
|
3910
|
+
*/
|
|
3911
|
+
var InProcessMessageQueue = class {
|
|
3912
|
+
#messages;
|
|
3913
|
+
#monitors;
|
|
3914
|
+
#pollIntervalMs;
|
|
3915
|
+
#delayedMessages;
|
|
3916
|
+
/**
|
|
3917
|
+
* Tracks which ordering keys are currently being processed to ensure
|
|
3918
|
+
* sequential processing for messages with the same key.
|
|
3919
|
+
*/
|
|
3920
|
+
#processingKeys;
|
|
3921
|
+
/**
|
|
3922
|
+
* In-process message queue does not provide native retry mechanisms.
|
|
3923
|
+
* @since 1.7.0
|
|
3924
|
+
*/
|
|
3925
|
+
nativeRetrial = false;
|
|
3926
|
+
/**
|
|
3927
|
+
* In-process message queue does not deduplicate messages natively.
|
|
3928
|
+
* @since 2.4.0
|
|
3929
|
+
*/
|
|
3930
|
+
nativeDeduplication = false;
|
|
3931
|
+
/**
|
|
3932
|
+
* Constructs a new {@link InProcessMessageQueue} with the given options.
|
|
3933
|
+
* @param options Additional options for the in-process message queue.
|
|
3934
|
+
*/
|
|
3935
|
+
constructor(options = {}) {
|
|
3936
|
+
this.#messages = [];
|
|
3937
|
+
this.#monitors = {};
|
|
3938
|
+
this.#pollIntervalMs = Temporal.Duration.from(options.pollInterval ?? { seconds: 5 }).total("millisecond");
|
|
3939
|
+
this.#delayedMessages = 0;
|
|
3940
|
+
this.#processingKeys = /* @__PURE__ */ new Set();
|
|
3941
|
+
}
|
|
3942
|
+
enqueue(message, options) {
|
|
3943
|
+
const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
|
3944
|
+
if (delay > 0) {
|
|
3945
|
+
this.#delayedMessages++;
|
|
3946
|
+
setTimeout(() => {
|
|
3947
|
+
this.#delayedMessages--;
|
|
3948
|
+
this.#enqueueReady(message, options);
|
|
3949
|
+
}, delay);
|
|
3950
|
+
return Promise.resolve();
|
|
3951
|
+
}
|
|
3952
|
+
this.#enqueueReady(message, options);
|
|
3953
|
+
return Promise.resolve();
|
|
3954
|
+
}
|
|
3955
|
+
#enqueueReady(message, options) {
|
|
3956
|
+
const orderingKey = options?.orderingKey ?? null;
|
|
3957
|
+
this.#messages.push({
|
|
3958
|
+
message,
|
|
3959
|
+
orderingKey
|
|
3960
|
+
});
|
|
3961
|
+
this.#notifyMonitors();
|
|
3962
|
+
}
|
|
3963
|
+
#notifyMonitors() {
|
|
3964
|
+
for (const monitorId in this.#monitors) this.#monitors[monitorId]();
|
|
3965
|
+
}
|
|
3966
|
+
enqueueMany(messages, options) {
|
|
3967
|
+
if (messages.length === 0) return Promise.resolve();
|
|
3968
|
+
const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
|
3969
|
+
if (delay > 0) {
|
|
3970
|
+
const delayedCount = messages.length;
|
|
3971
|
+
const deferredMessages = [...messages];
|
|
3972
|
+
this.#delayedMessages += delayedCount;
|
|
3973
|
+
setTimeout(() => {
|
|
3974
|
+
this.#delayedMessages -= delayedCount;
|
|
3975
|
+
this.#enqueueManyReady(deferredMessages, options);
|
|
3976
|
+
}, delay);
|
|
3977
|
+
return Promise.resolve();
|
|
3978
|
+
}
|
|
3979
|
+
this.#enqueueManyReady(messages, options);
|
|
3980
|
+
return Promise.resolve();
|
|
3981
|
+
}
|
|
3982
|
+
#enqueueManyReady(messages, options) {
|
|
3983
|
+
const orderingKey = options?.orderingKey ?? null;
|
|
3984
|
+
for (const message of messages) this.#messages.push({
|
|
3985
|
+
message,
|
|
3986
|
+
orderingKey
|
|
3987
|
+
});
|
|
3988
|
+
this.#notifyMonitors();
|
|
3989
|
+
}
|
|
3990
|
+
async listen(handler, options = {}) {
|
|
3991
|
+
const signal = options.signal;
|
|
3992
|
+
while (signal == null || !signal.aborted) {
|
|
3993
|
+
const idx = this.#messages.findIndex((m) => m.orderingKey == null || !this.#processingKeys.has(m.orderingKey));
|
|
3994
|
+
if (idx >= 0) {
|
|
3995
|
+
const { message, orderingKey } = this.#messages.splice(idx, 1)[0];
|
|
3996
|
+
if (orderingKey != null) this.#processingKeys.add(orderingKey);
|
|
3997
|
+
try {
|
|
3998
|
+
await handler(message);
|
|
3999
|
+
} finally {
|
|
4000
|
+
if (orderingKey != null) this.#processingKeys.delete(orderingKey);
|
|
4001
|
+
}
|
|
4002
|
+
} else if (this.#messages.length === 0) await this.#wait(this.#pollIntervalMs, signal);
|
|
4003
|
+
else await this.#wait(10, signal);
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
getDepth() {
|
|
4007
|
+
const ready = this.#messages.length;
|
|
4008
|
+
const delayed = this.#delayedMessages;
|
|
4009
|
+
return Promise.resolve({
|
|
4010
|
+
queued: ready + delayed,
|
|
4011
|
+
ready,
|
|
4012
|
+
delayed
|
|
4013
|
+
});
|
|
4014
|
+
}
|
|
4015
|
+
#wait(ms, signal) {
|
|
4016
|
+
let timer = null;
|
|
4017
|
+
return Promise.any([new Promise((resolve) => {
|
|
4018
|
+
signal?.addEventListener("abort", () => {
|
|
4019
|
+
if (timer != null) clearTimeout(timer);
|
|
4020
|
+
resolve();
|
|
4021
|
+
}, { once: true });
|
|
4022
|
+
const monitorId = crypto.randomUUID();
|
|
4023
|
+
this.#monitors[monitorId] = () => {
|
|
4024
|
+
delete this.#monitors[monitorId];
|
|
4025
|
+
if (timer != null) clearTimeout(timer);
|
|
4026
|
+
resolve();
|
|
4027
|
+
};
|
|
4028
|
+
}), new Promise((resolve) => timer = setTimeout(resolve, ms))]);
|
|
4029
|
+
}
|
|
4030
|
+
};
|
|
4031
|
+
/**
|
|
4032
|
+
* A message queue that processes messages in parallel. It takes another
|
|
4033
|
+
* {@link MessageQueue}, and processes messages in parallel up to a certain
|
|
4034
|
+
* number of workers.
|
|
4035
|
+
*
|
|
4036
|
+
* Actually, it's rather a decorator than a queue itself.
|
|
4037
|
+
*
|
|
4038
|
+
* Note that the workers do not run in truly parallel, in the sense that they
|
|
4039
|
+
* are not running in separate threads or processes. They are running in the
|
|
4040
|
+
* same process, but are scheduled to run in parallel. Hence, this is useful
|
|
4041
|
+
* for I/O-bound tasks, but not for CPU-bound tasks, which is okay for Fedify's
|
|
4042
|
+
* workloads.
|
|
4043
|
+
*
|
|
4044
|
+
* When using `ParallelMessageQueue`, the ordering guarantee is preserved
|
|
4045
|
+
* *only if* the underlying queue implementation delivers messages in a wrapper
|
|
4046
|
+
* format that includes the `__fedify_ordering_key__` property. Currently,
|
|
4047
|
+
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
4048
|
+
* For other queue implementations (e.g., `InProcessMessageQueue`,
|
|
4049
|
+
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
4050
|
+
* `AmqpMessageQueue`), the ordering key cannot be detected by
|
|
4051
|
+
* `ParallelMessageQueue`, so ordering guarantees are handled by those
|
|
4052
|
+
* implementations directly rather than at the `ParallelMessageQueue` level.
|
|
4053
|
+
*
|
|
4054
|
+
* Messages with the same ordering key will never be processed concurrently
|
|
4055
|
+
* by different workers, ensuring sequential processing within each key.
|
|
4056
|
+
* Messages with different ordering keys (or no ordering key) can still be
|
|
4057
|
+
* processed in parallel.
|
|
4058
|
+
*
|
|
4059
|
+
* @since 1.0.0
|
|
4060
|
+
*/
|
|
4061
|
+
var ParallelMessageQueue = class ParallelMessageQueue {
|
|
4062
|
+
queue;
|
|
4063
|
+
workers;
|
|
4064
|
+
/**
|
|
4065
|
+
* Inherits the native retry capability from the wrapped queue.
|
|
4066
|
+
* @since 1.7.0
|
|
4067
|
+
*/
|
|
4068
|
+
nativeRetrial;
|
|
4069
|
+
/**
|
|
4070
|
+
* Inherits the native deduplication capability from the wrapped queue.
|
|
4071
|
+
* @since 2.4.0
|
|
4072
|
+
*/
|
|
4073
|
+
nativeDeduplication;
|
|
4074
|
+
getDepth;
|
|
4075
|
+
/**
|
|
4076
|
+
* Tracks which ordering keys are currently being processed to ensure
|
|
4077
|
+
* sequential processing for messages with the same key.
|
|
4078
|
+
*/
|
|
4079
|
+
#processingKeys = /* @__PURE__ */ new Set();
|
|
4080
|
+
/**
|
|
4081
|
+
* Pending messages waiting for their ordering key to become available.
|
|
4082
|
+
*/
|
|
4083
|
+
#pendingMessages = [];
|
|
4084
|
+
/**
|
|
4085
|
+
* Constructs a new {@link ParallelMessageQueue} with the given queue and
|
|
4086
|
+
* number of workers.
|
|
4087
|
+
* @param queue The message queue to use under the hood. Note that
|
|
4088
|
+
* {@link ParallelMessageQueue} cannot be nested.
|
|
4089
|
+
* @param workers The number of workers to process messages in parallel.
|
|
4090
|
+
* @throws {TypeError} If the given queue is an instance of
|
|
4091
|
+
* {@link ParallelMessageQueue}.
|
|
4092
|
+
*/
|
|
4093
|
+
constructor(queue, workers) {
|
|
4094
|
+
if (queue instanceof ParallelMessageQueue) throw new TypeError("Cannot nest ParallelMessageQueue.");
|
|
4095
|
+
this.queue = queue;
|
|
4096
|
+
this.workers = workers;
|
|
4097
|
+
this.nativeRetrial = queue.nativeRetrial;
|
|
4098
|
+
this.nativeDeduplication = queue.nativeDeduplication;
|
|
4099
|
+
if (queue.getDepth != null) this.getDepth = () => queue.getDepth();
|
|
4100
|
+
}
|
|
4101
|
+
enqueue(message, options) {
|
|
4102
|
+
return this.queue.enqueue(message, options);
|
|
4103
|
+
}
|
|
4104
|
+
async enqueueMany(messages, options) {
|
|
4105
|
+
if (this.queue.enqueueMany == null) {
|
|
4106
|
+
if (messages.length === 1) {
|
|
4107
|
+
await this.queue.enqueue(messages[0], options);
|
|
4108
|
+
return;
|
|
4109
|
+
}
|
|
4110
|
+
if (options?.deduplicationKey != null) throw new TypeError("Cannot enqueue a batch with a deduplicationKey: the wrapped queue does not implement enqueueMany, so ParallelMessageQueue would have to fan out to individual enqueue() calls that cannot share one deduplicationKey atomically. Wrap a queue that implements enqueueMany instead.");
|
|
4111
|
+
const errors = (await Promise.allSettled(messages.map((message) => this.queue.enqueue(message, options)))).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
4112
|
+
if (errors.length > 1) throw new AggregateError(errors, "Failed to enqueue messages.");
|
|
4113
|
+
else if (errors.length === 1) throw errors[0];
|
|
4114
|
+
return;
|
|
4115
|
+
}
|
|
4116
|
+
await this.queue.enqueueMany(messages, options);
|
|
4117
|
+
}
|
|
4118
|
+
/**
|
|
4119
|
+
* Extracts ordering key from a message if present.
|
|
4120
|
+
*
|
|
4121
|
+
* This method only works for queue implementations that deliver messages
|
|
4122
|
+
* in the wrapper format with `__fedify_ordering_key__` property. Currently,
|
|
4123
|
+
* only `DenoKvMessageQueue` and `WorkersMessageQueue` use this format.
|
|
4124
|
+
*
|
|
4125
|
+
* For other queue implementations (`InProcessMessageQueue`,
|
|
4126
|
+
* `RedisMessageQueue`, `PostgresMessageQueue`, `SqliteMessageQueue`,
|
|
4127
|
+
* `AmqpMessageQueue`), messages are delivered as raw payloads without the
|
|
4128
|
+
* wrapper, so the ordering key cannot be detected here. Those
|
|
4129
|
+
* implementations handle ordering guarantees internally.
|
|
4130
|
+
*/
|
|
4131
|
+
#extractOrderingKey(message) {
|
|
4132
|
+
if (message != null && typeof message === "object") {
|
|
4133
|
+
if ("__fedify_ordering_key__" in message) return message.__fedify_ordering_key__;
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
listen(handler, options = {}) {
|
|
4137
|
+
const workers = /* @__PURE__ */ new Map();
|
|
4138
|
+
return this.queue.listen(async (message) => {
|
|
4139
|
+
while (workers.size >= this.workers) {
|
|
4140
|
+
const consumedId = await Promise.any(workers.values());
|
|
4141
|
+
workers.delete(consumedId);
|
|
4142
|
+
}
|
|
4143
|
+
const workerId = crypto.randomUUID();
|
|
4144
|
+
const orderingKey = this.#extractOrderingKey(message);
|
|
4145
|
+
if (orderingKey != null && this.#processingKeys.has(orderingKey)) await new Promise((resolve) => {
|
|
4146
|
+
this.#pendingMessages.push({
|
|
4147
|
+
message,
|
|
4148
|
+
orderingKey,
|
|
4149
|
+
resolve
|
|
4150
|
+
});
|
|
4151
|
+
});
|
|
4152
|
+
if (orderingKey != null) this.#processingKeys.add(orderingKey);
|
|
4153
|
+
const promise = this.#work(workerId, handler, message, orderingKey);
|
|
4154
|
+
workers.set(workerId, promise);
|
|
4155
|
+
}, options);
|
|
4156
|
+
}
|
|
4157
|
+
async #work(workerId, handler, message, orderingKey) {
|
|
4158
|
+
await this.#sleep(0);
|
|
4159
|
+
try {
|
|
4160
|
+
await handler(message);
|
|
4161
|
+
} finally {
|
|
4162
|
+
if (orderingKey != null) {
|
|
4163
|
+
this.#processingKeys.delete(orderingKey);
|
|
4164
|
+
const pendingIdx = this.#pendingMessages.findIndex((p) => p.orderingKey === orderingKey);
|
|
4165
|
+
if (pendingIdx >= 0) this.#pendingMessages.splice(pendingIdx, 1)[0].resolve();
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
return workerId;
|
|
4169
|
+
}
|
|
4170
|
+
#sleep(ms) {
|
|
4171
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
4172
|
+
}
|
|
4173
|
+
};
|
|
4174
|
+
//#endregion
|
|
3903
4175
|
//#region src/federation/tasks/enqueue.ts
|
|
3904
4176
|
/**
|
|
3905
4177
|
* The enqueue pipeline for custom background tasks. `ContextImpl.enqueueTask`
|
|
@@ -3966,8 +4238,8 @@ function planDeduplication(ctx, queue, taskName, options, itemCount) {
|
|
|
3966
4238
|
const key = options.deduplicationKey;
|
|
3967
4239
|
const native = queue.nativeDeduplication === true;
|
|
3968
4240
|
const canCas = ctx.federation.kv.cas != null;
|
|
3969
|
-
const canBatchAtomically = queue.enqueueMany != null && queue.
|
|
3970
|
-
if (itemCount > 1 && !canBatchAtomically && (native || canCas)) throw new TypeError(`Task ${JSON.stringify(taskName)} was enqueued as a batch with a deduplicationKey, but its message queue does not
|
|
4241
|
+
const canBatchAtomically = queue.enqueueMany != null && !(queue instanceof ParallelMessageQueue && queue.queue.enqueueMany == null);
|
|
4242
|
+
if (itemCount > 1 && !canBatchAtomically && (native || canCas)) throw new TypeError(`Task ${JSON.stringify(taskName)} was enqueued as a batch with a deduplicationKey, but its message queue does not implement enqueueMany; a multi-item batch cannot be deduplicated atomically without it. Implement enqueueMany on the queue, or enqueue the tasks individually with enqueueTask().`);
|
|
3971
4243
|
if (native) return {
|
|
3972
4244
|
kind: "native",
|
|
3973
4245
|
key
|
|
@@ -7132,4 +7404,4 @@ function getRequestId(request) {
|
|
|
7132
7404
|
return `req_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
7133
7405
|
}
|
|
7134
7406
|
//#endregion
|
|
7135
|
-
export {
|
|
7407
|
+
export { ParallelMessageQueue as a, respondWithObject as c, digest as d, CircuitBreaker as f, createFederationBuilder as h, InProcessMessageQueue as i, respondWithObjectIfAcceptable as l, parseCircuitBreakerKvState as m, middleware_exports as n, createExponentialBackoffPolicy as o, normalizeCircuitBreakerOptions as p, handleWebFinger as r, SendActivityError as s, createFederation as t, buildCollectionSynchronizationHeader as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-VyDTd4G3.cjs";
|
|
3
3
|
import { n as KvStore, t as KvKey } from "./kv-gJ8LYbxX.cjs";
|
|
4
|
-
import { t as DocumentFetchKind } from "./metrics-
|
|
4
|
+
import { t as DocumentFetchKind } from "./metrics-CoUJLQhZ.cjs";
|
|
5
5
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
|
6
6
|
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { Mt as WebFingerLinksDispatcher, ct as ActorAliasMapper, l as RequestContext, lt as ActorDispatcher, ut as ActorHandleMapper } from "./context-
|
|
2
|
+
import { Mt as WebFingerLinksDispatcher, ct as ActorAliasMapper, l as RequestContext, lt as ActorDispatcher, ut as ActorHandleMapper } from "./context-Zii1f5xS.js";
|
|
3
3
|
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
|
|
4
4
|
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-lf8Hsd91.js";
|
|
3
3
|
import { n as KvStore, t as KvKey } from "./kv-D6hNiMTK.js";
|
|
4
|
-
import { t as DocumentFetchKind } from "./metrics-
|
|
4
|
+
import { t as DocumentFetchKind } from "./metrics-Dc4jR-IC.js";
|
|
5
5
|
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
6
6
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { Mt as WebFingerLinksDispatcher, ct as ActorAliasMapper, l as RequestContext, lt as ActorDispatcher, ut as ActorHandleMapper } from "./context-
|
|
2
|
+
import { Mt as WebFingerLinksDispatcher, ct as ActorAliasMapper, l as RequestContext, lt as ActorDispatcher, ut as ActorHandleMapper } from "./context-lxX6I7as.cjs";
|
|
3
3
|
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
|
|
4
4
|
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
|
|
5
5
|
|
package/dist/mod.cjs
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
require("./chunk-Czpeue4M.cjs");
|
|
4
4
|
const require_transformers = require("./transformers-DGwl-hD1.cjs");
|
|
5
5
|
require("./compat/mod.cjs");
|
|
6
|
-
const require_http = require("./http-
|
|
7
|
-
const require_middleware = require("./middleware-
|
|
8
|
-
const require_proof = require("./proof-
|
|
6
|
+
const require_http = require("./http-hlIjmewS.cjs");
|
|
7
|
+
const require_middleware = require("./middleware-FrSMAYEx.cjs");
|
|
8
|
+
const require_proof = require("./proof-NN4xCQGL.cjs");
|
|
9
9
|
const require_types = require("./types-CPym83zc.cjs");
|
|
10
|
-
const require_kv_cache = require("./kv-cache-
|
|
10
|
+
const require_kv_cache = require("./kv-cache-DQ29C4XL.cjs");
|
|
11
11
|
const require_federation_mod = require("./federation/mod.cjs");
|
|
12
12
|
require("./nodeinfo/mod.cjs");
|
|
13
13
|
require("./runtime/mod.cjs");
|
|
@@ -15,9 +15,9 @@ require("./sig/mod.cjs");
|
|
|
15
15
|
require("./utils/mod.cjs");
|
|
16
16
|
//#endregion
|
|
17
17
|
exports.CircuitBreaker = require_middleware.CircuitBreaker;
|
|
18
|
-
exports.InProcessMessageQueue =
|
|
18
|
+
exports.InProcessMessageQueue = require_middleware.InProcessMessageQueue;
|
|
19
19
|
exports.MemoryKvStore = require_federation_mod.MemoryKvStore;
|
|
20
|
-
exports.ParallelMessageQueue =
|
|
20
|
+
exports.ParallelMessageQueue = require_middleware.ParallelMessageQueue;
|
|
21
21
|
exports.Router = require_federation_mod.Router;
|
|
22
22
|
exports.RouterError = require_federation_mod.RouterError;
|
|
23
23
|
exports.SendActivityError = require_middleware.SendActivityError;
|
package/dist/mod.d.cts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-CAM_bQXx.cjs";
|
|
3
3
|
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-VyDTd4G3.cjs";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-DEvZuyOE.cjs";
|
|
5
|
-
import { $ as CircuitBreakerCreateOptions, A as OutboxListenerSetters, At as UnverifiedActivityHandler, B as TaskEnqueueOptions, C as FederationStartQueueOptions, Ct as ObjectAuthorizePredicate, D as InboxListenerSetters, Dt as OutboxListenerErrorHandler, E as InboxChallengePolicy, Et as OutboxListener, F as createFederation, Ft as PageItems, G as RetryPolicy, H as TaskRegistry, I as Message, It as buildCollectionSynchronizationHeader, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as digest, M as FederationKvPrefixes, Mt as WebFingerLinksDispatcher, N as FederationOrigin, Nt as SendActivityError, O as MediaUploaderSetters, Ot as OutboxPermanentFailureHandler, P as FederationQueueOptions, Pt as SenderKeyPair, Q as CircuitBreakerBeforeSendDecision, R as TaskDefinition, Rt as ActivityTransformer, S as FederationOptions, St as NodeInfoDispatcher, T as IdempotencyStrategy, Tt as OutboxErrorHandler, U as CreateExponentialBackoffPolicyOptions, V as TaskHandler, W as RetryContext, X as CircuitBreaker, Y as respondWithObjectIfAcceptable, Z as CircuitBreakerActivityDrop, _ as Federatable, _t as CustomCollectionCursor, a as GetSignedKeyOptions, at as NormalizedCircuitBreakerOptions, b as FederationBuilder, bt as InboxListener, c as ParseUriResult, ct as ActorAliasMapper, d as SendActivityOptions, dt as ActorKeyPairsDispatcher, et as CircuitBreakerFailurePolicy, f as SendActivityOptionsForCollection, ft as AuthorizePredicate, g as CustomCollectionCallbackSetters, gt as CustomCollectionCounter, h as ConstructorWithTypeId, ht as CollectionDispatcher, i as GetActorOptions, it as CircuitBreakerStateChange, j as Rfc6570Expression, jt as UnverifiedActivityReason, k as ObjectCallbackSetters, kt as SharedInboxKeyDispatcher, l as RequestContext, lt as ActorDispatcher, m as CollectionCallbackSetters, mt as CollectionCursor, n as Context, nt as CircuitBreakerOptions, o as InboxContext, ot as normalizeCircuitBreakerOptions, p as ActorCallbackSetters, pt as CollectionCounter, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreakerState, s as OutboxContext, st as parseCircuitBreakerKvState, t as ActorKeyPair, tt as CircuitBreakerKvState, u as RouteActivityOptions, ut as ActorHandleMapper, v as Federation, vt as CustomCollectionDispatcher, w as IdempotencyKeyCallback, wt as ObjectDispatcher, x as FederationFetchOptions, xt as MediaUploaderCallback, y as FederationBenchmarkOptions, yt as InboxErrorHandler, z as TaskDefinitionOptions } from "./context-
|
|
5
|
+
import { $ as CircuitBreakerCreateOptions, A as OutboxListenerSetters, At as UnverifiedActivityHandler, B as TaskEnqueueOptions, C as FederationStartQueueOptions, Ct as ObjectAuthorizePredicate, D as InboxListenerSetters, Dt as OutboxListenerErrorHandler, E as InboxChallengePolicy, Et as OutboxListener, F as createFederation, Ft as PageItems, G as RetryPolicy, H as TaskRegistry, I as Message, It as buildCollectionSynchronizationHeader, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as digest, M as FederationKvPrefixes, Mt as WebFingerLinksDispatcher, N as FederationOrigin, Nt as SendActivityError, O as MediaUploaderSetters, Ot as OutboxPermanentFailureHandler, P as FederationQueueOptions, Pt as SenderKeyPair, Q as CircuitBreakerBeforeSendDecision, R as TaskDefinition, Rt as ActivityTransformer, S as FederationOptions, St as NodeInfoDispatcher, T as IdempotencyStrategy, Tt as OutboxErrorHandler, U as CreateExponentialBackoffPolicyOptions, V as TaskHandler, W as RetryContext, X as CircuitBreaker, Y as respondWithObjectIfAcceptable, Z as CircuitBreakerActivityDrop, _ as Federatable, _t as CustomCollectionCursor, a as GetSignedKeyOptions, at as NormalizedCircuitBreakerOptions, b as FederationBuilder, bt as InboxListener, c as ParseUriResult, ct as ActorAliasMapper, d as SendActivityOptions, dt as ActorKeyPairsDispatcher, et as CircuitBreakerFailurePolicy, f as SendActivityOptionsForCollection, ft as AuthorizePredicate, g as CustomCollectionCallbackSetters, gt as CustomCollectionCounter, h as ConstructorWithTypeId, ht as CollectionDispatcher, i as GetActorOptions, it as CircuitBreakerStateChange, j as Rfc6570Expression, jt as UnverifiedActivityReason, k as ObjectCallbackSetters, kt as SharedInboxKeyDispatcher, l as RequestContext, lt as ActorDispatcher, m as CollectionCallbackSetters, mt as CollectionCursor, n as Context, nt as CircuitBreakerOptions, o as InboxContext, ot as normalizeCircuitBreakerOptions, p as ActorCallbackSetters, pt as CollectionCounter, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreakerState, s as OutboxContext, st as parseCircuitBreakerKvState, t as ActorKeyPair, tt as CircuitBreakerKvState, u as RouteActivityOptions, ut as ActorHandleMapper, v as Federation, vt as CustomCollectionDispatcher, w as IdempotencyKeyCallback, wt as ObjectDispatcher, x as FederationFetchOptions, xt as MediaUploaderCallback, y as FederationBenchmarkOptions, yt as InboxErrorHandler, z as TaskDefinitionOptions } from "./context-lxX6I7as.cjs";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-gJ8LYbxX.cjs";
|
|
7
|
-
import { a as MessageQueueDepth, c as ParallelMessageQueue, i as MessageQueue, n as InProcessMessageQueue, o as MessageQueueEnqueueOptions, r as InProcessMessageQueueOptions, s as MessageQueueListenOptions } from "./metrics-
|
|
7
|
+
import { a as MessageQueueDepth, c as ParallelMessageQueue, i as MessageQueue, n as InProcessMessageQueue, o as MessageQueueEnqueueOptions, r as InProcessMessageQueueOptions, s as MessageQueueListenOptions } from "./metrics-CoUJLQhZ.cjs";
|
|
8
8
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
|
|
9
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-gOlPDuT8.cjs";
|
|
10
10
|
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-B0hW12_O.cjs";
|
|
11
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
11
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-BtEaIEcD.cjs";
|
|
12
12
|
export * from "@fedify/vocab-runtime";
|
|
13
13
|
|
|
14
14
|
//#region src/mod.d.ts
|
package/dist/mod.d.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-CSddvgWN.js";
|
|
3
3
|
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-lf8Hsd91.js";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CnngXDNJ.js";
|
|
5
|
-
import { $ as CircuitBreakerCreateOptions, A as OutboxListenerSetters, At as UnverifiedActivityHandler, B as TaskEnqueueOptions, C as FederationStartQueueOptions, Ct as ObjectAuthorizePredicate, D as InboxListenerSetters, Dt as OutboxListenerErrorHandler, E as InboxChallengePolicy, Et as OutboxListener, F as createFederation, Ft as PageItems, G as RetryPolicy, H as TaskRegistry, I as Message, It as buildCollectionSynchronizationHeader, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as digest, M as FederationKvPrefixes, Mt as WebFingerLinksDispatcher, N as FederationOrigin, Nt as SendActivityError, O as MediaUploaderSetters, Ot as OutboxPermanentFailureHandler, P as FederationQueueOptions, Pt as SenderKeyPair, Q as CircuitBreakerBeforeSendDecision, R as TaskDefinition, Rt as ActivityTransformer, S as FederationOptions, St as NodeInfoDispatcher, T as IdempotencyStrategy, Tt as OutboxErrorHandler, U as CreateExponentialBackoffPolicyOptions, V as TaskHandler, W as RetryContext, X as CircuitBreaker, Y as respondWithObjectIfAcceptable, Z as CircuitBreakerActivityDrop, _ as Federatable, _t as CustomCollectionCursor, a as GetSignedKeyOptions, at as NormalizedCircuitBreakerOptions, b as FederationBuilder, bt as InboxListener, c as ParseUriResult, ct as ActorAliasMapper, d as SendActivityOptions, dt as ActorKeyPairsDispatcher, et as CircuitBreakerFailurePolicy, f as SendActivityOptionsForCollection, ft as AuthorizePredicate, g as CustomCollectionCallbackSetters, gt as CustomCollectionCounter, h as ConstructorWithTypeId, ht as CollectionDispatcher, i as GetActorOptions, it as CircuitBreakerStateChange, j as Rfc6570Expression, jt as UnverifiedActivityReason, k as ObjectCallbackSetters, kt as SharedInboxKeyDispatcher, l as RequestContext, lt as ActorDispatcher, m as CollectionCallbackSetters, mt as CollectionCursor, n as Context, nt as CircuitBreakerOptions, o as InboxContext, ot as normalizeCircuitBreakerOptions, p as ActorCallbackSetters, pt as CollectionCounter, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreakerState, s as OutboxContext, st as parseCircuitBreakerKvState, t as ActorKeyPair, tt as CircuitBreakerKvState, u as RouteActivityOptions, ut as ActorHandleMapper, v as Federation, vt as CustomCollectionDispatcher, w as IdempotencyKeyCallback, wt as ObjectDispatcher, x as FederationFetchOptions, xt as MediaUploaderCallback, y as FederationBenchmarkOptions, yt as InboxErrorHandler, z as TaskDefinitionOptions } from "./context-
|
|
5
|
+
import { $ as CircuitBreakerCreateOptions, A as OutboxListenerSetters, At as UnverifiedActivityHandler, B as TaskEnqueueOptions, C as FederationStartQueueOptions, Ct as ObjectAuthorizePredicate, D as InboxListenerSetters, Dt as OutboxListenerErrorHandler, E as InboxChallengePolicy, Et as OutboxListener, F as createFederation, Ft as PageItems, G as RetryPolicy, H as TaskRegistry, I as Message, It as buildCollectionSynchronizationHeader, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as digest, M as FederationKvPrefixes, Mt as WebFingerLinksDispatcher, N as FederationOrigin, Nt as SendActivityError, O as MediaUploaderSetters, Ot as OutboxPermanentFailureHandler, P as FederationQueueOptions, Pt as SenderKeyPair, Q as CircuitBreakerBeforeSendDecision, R as TaskDefinition, Rt as ActivityTransformer, S as FederationOptions, St as NodeInfoDispatcher, T as IdempotencyStrategy, Tt as OutboxErrorHandler, U as CreateExponentialBackoffPolicyOptions, V as TaskHandler, W as RetryContext, X as CircuitBreaker, Y as respondWithObjectIfAcceptable, Z as CircuitBreakerActivityDrop, _ as Federatable, _t as CustomCollectionCursor, a as GetSignedKeyOptions, at as NormalizedCircuitBreakerOptions, b as FederationBuilder, bt as InboxListener, c as ParseUriResult, ct as ActorAliasMapper, d as SendActivityOptions, dt as ActorKeyPairsDispatcher, et as CircuitBreakerFailurePolicy, f as SendActivityOptionsForCollection, ft as AuthorizePredicate, g as CustomCollectionCallbackSetters, gt as CustomCollectionCounter, h as ConstructorWithTypeId, ht as CollectionDispatcher, i as GetActorOptions, it as CircuitBreakerStateChange, j as Rfc6570Expression, jt as UnverifiedActivityReason, k as ObjectCallbackSetters, kt as SharedInboxKeyDispatcher, l as RequestContext, lt as ActorDispatcher, m as CollectionCallbackSetters, mt as CollectionCursor, n as Context, nt as CircuitBreakerOptions, o as InboxContext, ot as normalizeCircuitBreakerOptions, p as ActorCallbackSetters, pt as CollectionCounter, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreakerState, s as OutboxContext, st as parseCircuitBreakerKvState, t as ActorKeyPair, tt as CircuitBreakerKvState, u as RouteActivityOptions, ut as ActorHandleMapper, v as Federation, vt as CustomCollectionDispatcher, w as IdempotencyKeyCallback, wt as ObjectDispatcher, x as FederationFetchOptions, xt as MediaUploaderCallback, y as FederationBenchmarkOptions, yt as InboxErrorHandler, z as TaskDefinitionOptions } from "./context-Zii1f5xS.js";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-D6hNiMTK.js";
|
|
7
|
-
import { a as MessageQueueDepth, c as ParallelMessageQueue, i as MessageQueue, n as InProcessMessageQueue, o as MessageQueueEnqueueOptions, r as InProcessMessageQueueOptions, s as MessageQueueListenOptions } from "./metrics-
|
|
7
|
+
import { a as MessageQueueDepth, c as ParallelMessageQueue, i as MessageQueue, n as InProcessMessageQueue, o as MessageQueueEnqueueOptions, r as InProcessMessageQueueOptions, s as MessageQueueListenOptions } from "./metrics-Dc4jR-IC.js";
|
|
8
8
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
|
|
9
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-DLc2Ot6f.js";
|
|
10
10
|
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-COIAjwRS.js";
|
|
11
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
11
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-UMmveiO0.js";
|
|
12
12
|
export * from "@fedify/vocab-runtime";
|
|
13
13
|
|
|
14
14
|
//#region src/mod.d.ts
|
package/dist/mod.js
CHANGED
|
@@ -3,12 +3,12 @@ import { URLPattern } from "urlpattern-polyfill";
|
|
|
3
3
|
import "./chunk-D5IdezsZ.js";
|
|
4
4
|
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-DXze6FUB.js";
|
|
5
5
|
import "./compat/mod.js";
|
|
6
|
-
import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "./http-
|
|
7
|
-
import { a as
|
|
8
|
-
import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "./proof-
|
|
6
|
+
import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "./http-CsmQ-BQ4.js";
|
|
7
|
+
import { a as ParallelMessageQueue, c as respondWithObject, d as digest, f as CircuitBreaker, h as createFederationBuilder, i as InProcessMessageQueue, l as respondWithObjectIfAcceptable, m as parseCircuitBreakerKvState, o as createExponentialBackoffPolicy, p as normalizeCircuitBreakerOptions, r as handleWebFinger, s as SendActivityError, t as createFederation, u as buildCollectionSynchronizationHeader } from "./middleware-Y-kpsp6S.js";
|
|
8
|
+
import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "./proof-B6E0XUXJ.js";
|
|
9
9
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-DC1pNgJA.js";
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
11
|
-
import {
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-5bnX3-Jq.js";
|
|
11
|
+
import { MemoryKvStore, Router, RouterError } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|
|
14
14
|
import "./sig/mod.js";
|
|
@@ -172,11 +172,6 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
|
172
172
|
* @since 2.4.0
|
|
173
173
|
*/
|
|
174
174
|
nativeDeduplication;
|
|
175
|
-
/**
|
|
176
|
-
* Inherits the atomic batch capability from the wrapped queue.
|
|
177
|
-
* @since 2.4.0
|
|
178
|
-
*/
|
|
179
|
-
atomicEnqueueMany;
|
|
180
175
|
getDepth;
|
|
181
176
|
/**
|
|
182
177
|
* Tracks which ordering keys are currently being processed to ensure
|
|
@@ -202,7 +197,6 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
|
202
197
|
this.workers = workers;
|
|
203
198
|
this.nativeRetrial = queue.nativeRetrial;
|
|
204
199
|
this.nativeDeduplication = queue.nativeDeduplication;
|
|
205
|
-
this.atomicEnqueueMany = queue.enqueueMany == null ? false : queue.atomicEnqueueMany;
|
|
206
200
|
if (queue.getDepth != null) this.getDepth = () => queue.getDepth();
|
|
207
201
|
}
|
|
208
202
|
enqueue(message, options) {
|
|
@@ -5,7 +5,7 @@ import { r as createRequestContext } from "../context-BJXxPElm.mjs";
|
|
|
5
5
|
import { t as MemoryKvStore } from "../kv-CXBAok3k.mjs";
|
|
6
6
|
import { t as assertEquals } from "../assert_equals-BV7oLMxm.mjs";
|
|
7
7
|
import "../std__assert-B2NnY9bq.mjs";
|
|
8
|
-
import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-
|
|
8
|
+
import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-CvwTUgnP.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-BHzKn9Ig.mjs";
|
|
5
|
+
import "./key-DfPsX8hv.mjs";
|
|
6
6
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
7
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
6
|
-
import { n as fetchKey, o as validateCryptoKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-BHzKn9Ig.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-DMk-nTxI.mjs";
|
|
6
|
+
import { n as fetchKey, o as validateCryptoKey } from "./key-DfPsX8hv.mjs";
|
|
7
7
|
import { n as preloadedOnlyDocumentLoader } from "./public-audience-Cr5MsnMq.mjs";
|
|
8
8
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-URuqsICz.mjs";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { F as version, P as name, _ as measureSignatureKeyFetch, d as validateCryptoKey, f as getDurationMs, p as getFederationMetrics, s as fetchKey } from "./http-
|
|
3
|
+
import { F as version, P as name, _ as measureSignatureKeyFetch, d as validateCryptoKey, f as getDurationMs, p as getFederationMetrics, s as fetchKey } from "./http-CsmQ-BQ4.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, PUBLIC_COLLECTION, getTypeId, isActor } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
2
|
const require_chunk = require("./chunk-Czpeue4M.cjs");
|
|
3
|
-
const require_http = require("./http-
|
|
3
|
+
const require_http = require("./http-hlIjmewS.cjs");
|
|
4
4
|
const require_temporal_polyfill = require("./temporal-polyfill-BCdTHexd.cjs");
|
|
5
5
|
let _logtape_logtape = require("@logtape/logtape");
|
|
6
6
|
let _fedify_vocab = require("@fedify/vocab");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-
|
|
6
|
-
import { n as doubleKnock } from "./http-
|
|
4
|
+
import { n as version, t as name } from "./deno-BHzKn9Ig.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-DMk-nTxI.mjs";
|
|
6
|
+
import { n as doubleKnock } from "./http-CPVMUgsW.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { FetchError } from "@fedify/vocab-runtime";
|
package/dist/sig/http.test.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import { r as assertExists, t as assertStringIncludes } from "../std__assert-B2N
|
|
|
7
7
|
import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-EgstcQy5.mjs";
|
|
8
8
|
import { t as assertThrows } from "../assert_throws-NiFfqbnH.mjs";
|
|
9
9
|
import { t as assert } from "../assert-CJ1KXcvv.mjs";
|
|
10
|
-
import { t as exportJwk } from "../key-
|
|
11
|
-
import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase, u as verifyRequestDetailed } from "../http-
|
|
10
|
+
import { t as exportJwk } from "../key-DfPsX8hv.mjs";
|
|
11
|
+
import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase, u as verifyRequestDetailed } from "../http-CPVMUgsW.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-Dbyd7bhl.mjs";
|
|
13
13
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
14
|
import { FetchError, exportSpki } from "@fedify/vocab-runtime";
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { t as assertEquals } from "../assert_equals-BV7oLMxm.mjs";
|
|
|
5
5
|
import "../std__assert-B2NnY9bq.mjs";
|
|
6
6
|
import { t as assertRejects } from "../assert_rejects-EgstcQy5.mjs";
|
|
7
7
|
import { t as assertThrows } from "../assert_throws-NiFfqbnH.mjs";
|
|
8
|
-
import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-
|
|
8
|
+
import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-DfPsX8hv.mjs";
|
|
9
9
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-Dbyd7bhl.mjs";
|
|
10
10
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
11
11
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-BV7oLMxm.mjs";
|
|
|
5
5
|
import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-EgstcQy5.mjs";
|
|
6
6
|
import { t as assertThrows } from "../assert_throws-NiFfqbnH.mjs";
|
|
7
7
|
import { t as assert } from "../assert-CJ1KXcvv.mjs";
|
|
8
|
-
import { i as generateCryptoKeyPair } from "../key-
|
|
8
|
+
import { i as generateCryptoKeyPair } from "../key-DfPsX8hv.mjs";
|
|
9
9
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-Dbyd7bhl.mjs";
|
|
10
|
-
import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-
|
|
10
|
+
import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-Cj9F_5AP.mjs";
|
|
11
11
|
import { CryptographicKey } from "@fedify/vocab";
|
|
12
12
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
13
13
|
import { encodeBase64 } from "byte-encodings/base64";
|
package/dist/sig/mod.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_http = require("../http-
|
|
4
|
-
const require_proof = require("../proof-
|
|
3
|
+
const require_http = require("../http-hlIjmewS.cjs");
|
|
4
|
+
const require_proof = require("../proof-NN4xCQGL.cjs");
|
|
5
5
|
exports.attachSignature = require_proof.attachSignature;
|
|
6
6
|
exports.createProof = require_proof.createProof;
|
|
7
7
|
exports.createSignature = require_proof.createSignature;
|
package/dist/sig/mod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "../http-
|
|
4
|
-
import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-
|
|
3
|
+
import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "../http-CsmQ-BQ4.js";
|
|
4
|
+
import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-B6E0XUXJ.js";
|
|
5
5
|
export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/owner.test.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import "../std__assert-B2NnY9bq.mjs";
|
|
|
6
6
|
import { r as assertFalse } from "../assert_rejects-EgstcQy5.mjs";
|
|
7
7
|
import { t as assert } from "../assert-CJ1KXcvv.mjs";
|
|
8
8
|
import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-Dbyd7bhl.mjs";
|
|
9
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-Br9YYzn_.mjs";
|
|
10
10
|
import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
|
|
11
11
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
//#region src/sig/owner.test.ts
|