@fedify/fedify 2.4.0-dev.1567 → 2.4.0-dev.1570
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 +4 -0
- package/dist/{assert-OguE97r2.mjs → assert-DvVHoIZ0.mjs} +1 -1
- package/dist/{assert_instance_of-DBC5X09g.mjs → assert_instance_of-CxoC8bVq.mjs} +1 -1
- package/dist/{assert_not_equals-DkVK8oqV.mjs → assert_not_equals-C8vcTTA3.mjs} +1 -1
- package/dist/{assert_rejects-DN60FHPX.mjs → assert_rejects-DAdaaIWM.mjs} +2 -2
- package/dist/{assert_strict_equals-XEgZAlrj.mjs → assert_strict_equals-BzqyKuYL.mjs} +1 -1
- package/dist/{assert_throws-BOkhLGYc.mjs → assert_throws-zN79lgIC.mjs} +1 -1
- package/dist/{builder-DGWCUaNQ.mjs → builder-CJnWbgbj.mjs} +23 -3
- package/dist/codec-nfBU4Up4.mjs +124 -0
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/outgoing-jsonld.test.mjs +3 -3
- package/dist/compat/public-audience.test.mjs +3 -3
- package/dist/compat/transformers.test.mjs +5 -5
- package/dist/{context-DVoTs_wM.mjs → context-BBRTgkrs.mjs} +8 -2
- package/dist/{context-BBVLF7lx.d.cts → context-BLe0NPtZ.d.cts} +530 -259
- package/dist/{context-BU6jSQdo.d.ts → context-GfQA-CqB.d.ts} +529 -259
- package/dist/{deno-Dho0TW0X.mjs → deno-klNxGW7W.mjs} +1 -1
- package/dist/{docloader-DCQSgDOg.mjs → docloader-CuFH35j1.mjs} +3 -3
- package/dist/federation/builder.test.mjs +5 -5
- package/dist/federation/circuit-breaker.test.mjs +5 -5
- package/dist/federation/collection.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +13 -23
- package/dist/federation/idempotency.test.mjs +6 -6
- package/dist/federation/inbox.test.mjs +3 -3
- package/dist/federation/keycache.test.mjs +5 -5
- package/dist/federation/kv.test.mjs +3 -3
- package/dist/federation/metrics.test.mjs +4 -4
- package/dist/federation/middleware.test.mjs +204 -19
- package/dist/federation/mod.cjs +3 -259
- package/dist/federation/mod.d.cts +4 -4
- package/dist/federation/mod.d.ts +4 -4
- package/dist/federation/mod.js +1 -257
- package/dist/federation/mq.test.mjs +103 -261
- package/dist/federation/negotiation.test.mjs +4 -4
- package/dist/federation/retry.test.mjs +3 -3
- package/dist/federation/router.test.mjs +5 -5
- package/dist/federation/send.test.mjs +10 -10
- package/dist/federation/tasks/codec.test.d.mts +2 -0
- package/dist/federation/tasks/codec.test.mjs +302 -0
- package/dist/federation/tasks/enqueue.test.d.mts +2 -0
- package/dist/federation/tasks/enqueue.test.mjs +1057 -0
- package/dist/federation/tasks/tasks.test.d.mts +2 -0
- package/dist/federation/tasks/tasks.test.mjs +1228 -0
- package/dist/federation/temporal.test.mjs +4 -4
- package/dist/federation/webfinger.test.mjs +6 -6
- package/dist/{http-sngIMb9S.js → http-D0jH0kco.js} +16 -80
- package/dist/{http-C7Lot0it.cjs → http-DeuPW1Oh.cjs} +14 -78
- package/dist/{http-Bf8YhWOi.mjs → http-JdRPUYku.mjs} +4 -4
- package/dist/{key-3rYgSl9f.mjs → key-o0_ipvUR.mjs} +10 -76
- package/dist/{kv-cache-CO2IaDJu.cjs → kv-cache-C3rqzQvu.cjs} +1 -1
- package/dist/{kv-cache-P3scUO6t.mjs → kv-cache-CM7w20U5.mjs} +1 -1
- package/dist/{kv-cache-B0siRaoZ.js → kv-cache-DSWq2JHU.js} +1 -1
- package/dist/{ld-CCOPy-Co.mjs → ld-C__CEgQH.mjs} +3 -3
- package/dist/{metrics-CR4UD_gF.mjs → metrics-CLSPm4dZ.mjs} +8 -6
- package/dist/{mq-D-nlpY04.d.ts → metrics-CoUJLQhZ.d.cts} +69 -1
- package/dist/{mq-D8uSFzxe.d.cts → metrics-Dc4jR-IC.d.ts} +69 -1
- package/dist/{middleware-DUelXs9h.cjs → middleware-B502nwxx.cjs} +874 -134
- package/dist/{middleware-CIteB8IS.mjs → middleware-CdMiavoh.mjs} +1 -1
- package/dist/{middleware-DfBPuuvp.mjs → middleware-CjHqy-1i.mjs} +469 -150
- package/dist/{middleware-BoNiH9CQ.js → middleware-zuLSkPIk.js} +863 -135
- package/dist/{mod-C0F6kvgS.d.cts → mod-B8Efb9qp.d.cts} +1 -1
- package/dist/{mod-yvIXFAEi.d.cts → mod-BtEaIEcD.d.cts} +1 -31
- package/dist/{mod-vPYVoa5n.d.ts → mod-Cmr39iWq.d.ts} +1 -1
- package/dist/{mod-DFvNJcNb.d.ts → mod-UMmveiO0.d.ts} +1 -31
- package/dist/mod.cjs +6 -6
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- package/dist/mod.js +5 -5
- package/dist/mq-03vS-C9P.mjs +276 -0
- package/dist/nodeinfo/client.test.mjs +3 -3
- package/dist/nodeinfo/handler.test.mjs +5 -5
- package/dist/nodeinfo/types.test.mjs +4 -4
- package/dist/otel/exporter.test.mjs +3 -3
- package/dist/{outgoing-jsonld-L_DbOaFe.mjs → outgoing-jsonld-BNL8AC14.mjs} +1 -1
- package/dist/{owner-TUz_H-M9.mjs → owner-gz4TUfKG.mjs} +2 -2
- package/dist/{proof-DzKUmE7R.cjs → proof-CiDzRtr0.cjs} +1 -1
- package/dist/{proof-CrI3UpuA.mjs → proof-CuQpZ_AT.mjs} +5 -5
- package/dist/{proof-C5i7MhbD.js → proof-DQWTf6oB.js} +1 -1
- package/dist/{send-BBs_erdP.mjs → send-B60teucv.mjs} +3 -3
- package/dist/sig/accept.test.mjs +1 -1
- package/dist/sig/http.test.mjs +8 -8
- package/dist/sig/key.test.mjs +7 -191
- package/dist/sig/ld.test.mjs +7 -7
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +6 -6
- package/dist/sig/proof.test.mjs +9 -69
- package/dist/{std__assert-BBjXFNOb.mjs → std__assert-Dh6uLf_q.mjs} +4 -4
- package/dist/{temporal-bBIy2G-F.mjs → temporal-CvVMrvJJ.mjs} +1 -1
- package/dist/testing/mod.d.mts +1037 -8
- package/dist/testing/mod.mjs +3 -2
- package/dist/testing-Dy-WhqpN.mjs +77 -0
- package/dist/utils/docloader.test.mjs +6 -6
- 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 +8 -6
- /package/dist/{accept-CPkZzmGN.mjs → accept-CgDcxvjV.mjs} +0 -0
- /package/dist/{activity-listener-tztVvlNb.mjs → activity-listener-BeTGV3wc.mjs} +0 -0
- /package/dist/{assert_equals-C-ZRDbaf.mjs → assert_equals-PBVKNMJd.mjs} +0 -0
- /package/dist/{circuit-breaker-CSWsyoef.mjs → circuit-breaker-hJBB6jwA.mjs} +0 -0
- /package/dist/{client-ByXmQhYD.mjs → client-B_A6mfn3.mjs} +0 -0
- /package/dist/{collection-Cc3DVAhE.mjs → collection-Dp5ky45w.mjs} +0 -0
- /package/dist/{keycache-BeU0LCII.mjs → keycache-CaOR6NYg.mjs} +0 -0
- /package/dist/{keys-DGu1NFwu.mjs → keys-CSYsOMFG.mjs} +0 -0
- /package/dist/{kv-rV3vodCc.mjs → kv-CIvR3Non.mjs} +0 -0
- /package/dist/{negotiation-DDstyBvc.mjs → negotiation-m_L2nyS3.mjs} +0 -0
- /package/dist/{public-audience-Cvbr2Gzt.mjs → public-audience-c9zmYKgA.mjs} +0 -0
- /package/dist/{retry-CXg_MBI-.mjs → retry-DI4O-zYl.mjs} +0 -0
- /package/dist/{types-J53Kw7so.mjs → types-BFowWFTT.mjs} +0 -0
package/README.md
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
[![Matrix][Matrix badge]][Matrix]
|
|
10
10
|
[![@fedify@hackers.pub][@fedify@hackers.pub badge]][@fedify@hackers.pub]
|
|
11
11
|
|
|
12
|
+
> [!NOTE]
|
|
13
|
+
> Looking for a quick demo? Here it is: [Fedify Demo] on Deno Playground.
|
|
14
|
+
|
|
12
15
|
Fedify is a TypeScript library for building federated server apps
|
|
13
16
|
powered by [ActivityPub] and other standards, so-called [fediverse].[^1]
|
|
14
17
|
It aims to eliminate the complexity and boilerplate code when
|
|
@@ -60,6 +63,7 @@ in the fediverse!
|
|
|
60
63
|
[Matrix]: https://matrix.to/#/#fedify:matrix.org
|
|
61
64
|
[@fedify@hackers.pub badge]: https://fedi-badge.minhee.org/@fedify@hackers.pub/followers.svg
|
|
62
65
|
[@fedify@hackers.pub]: https://hackers.pub/@fedify
|
|
66
|
+
[Fedify Demo]: https://dash.deno.com/playground/fedify-demo
|
|
63
67
|
[ActivityPub]: https://www.w3.org/TR/activitypub/
|
|
64
68
|
[fediverse]: https://en.wikipedia.org/wiki/Fediverse
|
|
65
69
|
[Activity Vocabulary]: https://www.w3.org/TR/activitystreams-vocabulary/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { l as AssertionError } from "./assert_equals-
|
|
4
|
+
import { l as AssertionError } from "./assert_equals-PBVKNMJd.mjs";
|
|
5
5
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert.js
|
|
6
6
|
/**
|
|
7
7
|
* Make an assertion, error will be thrown if `expr` does not have truthy value.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { l as AssertionError } from "./assert_equals-
|
|
4
|
+
import { l as AssertionError } from "./assert_equals-PBVKNMJd.mjs";
|
|
5
5
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_instance_of.js
|
|
6
6
|
/**
|
|
7
7
|
* Make an assertion that `obj` is an instance of `type`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { c as equal, l as AssertionError } from "./assert_equals-
|
|
4
|
+
import { c as equal, l as AssertionError } from "./assert_equals-PBVKNMJd.mjs";
|
|
5
5
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_not_equals.js
|
|
6
6
|
/**
|
|
7
7
|
* Make an assertion that `actual` and `expected` are not equal, deeply.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { l as AssertionError, s as format } from "./assert_equals-
|
|
5
|
-
import { n as assertIsError } from "./assert_throws-
|
|
4
|
+
import { l as AssertionError, s as format } from "./assert_equals-PBVKNMJd.mjs";
|
|
5
|
+
import { n as assertIsError } from "./assert_throws-zN79lgIC.mjs";
|
|
6
6
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_false.js
|
|
7
7
|
/**
|
|
8
8
|
* Make an assertion, error will be thrown if `expr` have truthy value.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { a as red, i as buildMessage, l as AssertionError, n as diffStr, r as diff, s as format } from "./assert_equals-
|
|
4
|
+
import { a as red, i as buildMessage, l as AssertionError, n as diffStr, r as diff, s as format } from "./assert_equals-PBVKNMJd.mjs";
|
|
5
5
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_strict_equals.js
|
|
6
6
|
/**
|
|
7
7
|
* Make an assertion that `actual` and `expected` are equal using
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { l as AssertionError, o as stripAnsiCode } from "./assert_equals-
|
|
4
|
+
import { l as AssertionError, o as stripAnsiCode } from "./assert_equals-PBVKNMJd.mjs";
|
|
5
5
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_is_error.js
|
|
6
6
|
/**
|
|
7
7
|
* Make an assertion that `error` is an `Error`.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { t as ActivityListenerSet } from "./activity-listener-
|
|
4
|
+
import { n as version, t as name } from "./deno-klNxGW7W.mjs";
|
|
5
|
+
import { t as ActivityListenerSet } from "./activity-listener-BeTGV3wc.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
8
8
|
import { Tombstone, getTypeId } from "@fedify/vocab";
|
|
@@ -61,6 +61,7 @@ var FederationBuilderImpl = class {
|
|
|
61
61
|
idempotencyStrategy;
|
|
62
62
|
collectionTypeIds;
|
|
63
63
|
collectionCallbacks;
|
|
64
|
+
taskDefinitions;
|
|
64
65
|
/**
|
|
65
66
|
* Symbol registry for unique identification of unnamed symbols.
|
|
66
67
|
*/
|
|
@@ -71,6 +72,7 @@ var FederationBuilderImpl = class {
|
|
|
71
72
|
this.objectTypeIds = {};
|
|
72
73
|
this.collectionCallbacks = {};
|
|
73
74
|
this.collectionTypeIds = {};
|
|
75
|
+
this.taskDefinitions = /* @__PURE__ */ new Map();
|
|
74
76
|
}
|
|
75
77
|
/**
|
|
76
78
|
* Builds the federation object.
|
|
@@ -80,7 +82,7 @@ var FederationBuilderImpl = class {
|
|
|
80
82
|
* specified.
|
|
81
83
|
*/
|
|
82
84
|
async build(options) {
|
|
83
|
-
const { FederationImpl } = await import("./middleware-
|
|
85
|
+
const { FederationImpl } = await import("./middleware-CdMiavoh.mjs");
|
|
84
86
|
const f = new FederationImpl(options);
|
|
85
87
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
86
88
|
f.router = this.router.clone();
|
|
@@ -109,6 +111,7 @@ var FederationBuilderImpl = class {
|
|
|
109
111
|
f.unverifiedActivityHandler = this.unverifiedActivityHandler;
|
|
110
112
|
f.outboxPermanentFailureHandler = this.outboxPermanentFailureHandler;
|
|
111
113
|
f.idempotencyStrategy = this.idempotencyStrategy;
|
|
114
|
+
f.taskDefinitions = new Map(this.taskDefinitions);
|
|
112
115
|
return f;
|
|
113
116
|
}
|
|
114
117
|
_getTracer() {
|
|
@@ -241,6 +244,23 @@ var FederationBuilderImpl = class {
|
|
|
241
244
|
setWebFingerLinksDispatcher(dispatcher) {
|
|
242
245
|
this.webFingerLinksDispatcher = dispatcher;
|
|
243
246
|
}
|
|
247
|
+
defineTask(name, options) {
|
|
248
|
+
if (this.taskDefinitions.has(name)) throw new TypeError(`Task ${JSON.stringify(name)} is already defined.`);
|
|
249
|
+
const handle = {
|
|
250
|
+
name,
|
|
251
|
+
schema: options.schema
|
|
252
|
+
};
|
|
253
|
+
this.taskDefinitions.set(name, {
|
|
254
|
+
name,
|
|
255
|
+
schema: options.schema,
|
|
256
|
+
handle,
|
|
257
|
+
handler: options.handler,
|
|
258
|
+
onError: options.onError,
|
|
259
|
+
retryPolicy: options.retryPolicy,
|
|
260
|
+
queue: options.queue
|
|
261
|
+
});
|
|
262
|
+
return handle;
|
|
263
|
+
}
|
|
244
264
|
/**
|
|
245
265
|
* The RFC 6570 template-literal `path` overloads were removed for
|
|
246
266
|
* type-checking efficiency, so the URI variable types can no longer be
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { Link, Object as Object$1 } from "@fedify/vocab";
|
|
5
|
+
import { parse, stringifyAsync } from "devalue";
|
|
6
|
+
//#region src/federation/tasks/codec.ts
|
|
7
|
+
/**
|
|
8
|
+
* Serializes and deserializes task payloads for the queue, preserving
|
|
9
|
+
* `@fedify/vocab` objects across the wire by reducing them to JSON-LD and
|
|
10
|
+
* rebuilding them on the worker with the bound {@link TaskCodecLoaders}.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
var TaskCodec = class TaskCodec {
|
|
14
|
+
options;
|
|
15
|
+
constructor(options) {
|
|
16
|
+
this.options = options;
|
|
17
|
+
}
|
|
18
|
+
/** Serializes `data`, encoding any vocabulary object as its JSON-LD. */
|
|
19
|
+
serialize = (data) => stringifyAsync(data, { Vocab: this.#stringifyVocab });
|
|
20
|
+
deserialize = async (raw) => await this.#revive(/* @__PURE__ */ new Map())(parse(raw, { Vocab: VocabHolder.from }));
|
|
21
|
+
/** Validates `data` against `schema`, then serializes it. */
|
|
22
|
+
encode = async (schema, data) => this.serialize(await TaskCodec.validate(schema, data));
|
|
23
|
+
/** Deserializes `raw`, then validates the result against `schema`. */
|
|
24
|
+
decode = async (schema, raw) => {
|
|
25
|
+
let data;
|
|
26
|
+
try {
|
|
27
|
+
data = await this.deserialize(raw);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
return {
|
|
30
|
+
ok: false,
|
|
31
|
+
phase: "deserialization",
|
|
32
|
+
error
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
return {
|
|
37
|
+
ok: true,
|
|
38
|
+
value: await TaskCodec.validate(schema, data)
|
|
39
|
+
};
|
|
40
|
+
} catch (error) {
|
|
41
|
+
return {
|
|
42
|
+
ok: false,
|
|
43
|
+
phase: "validation",
|
|
44
|
+
error
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
static validate = async (schema, data) => getValueIfSchema(await schema["~standard"].validate(data));
|
|
49
|
+
#stringifyVocab = (value) => isVocab(value) && this.#toWire(value);
|
|
50
|
+
#toWire = async (value) => ({
|
|
51
|
+
kind: value instanceof Link ? "link" : "object",
|
|
52
|
+
jsonLd: await value.toJsonLd({
|
|
53
|
+
format: "expand",
|
|
54
|
+
...this.options
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
#revive = (seen) => {
|
|
58
|
+
const inner = async (node) => {
|
|
59
|
+
if (node === null || typeof node !== "object") return node;
|
|
60
|
+
if (seen.has(node)) return seen.get(node);
|
|
61
|
+
for (const reviver of this.#classRevivers) {
|
|
62
|
+
const out = reviver(seen, inner, node);
|
|
63
|
+
if (out !== void 0) return await out;
|
|
64
|
+
}
|
|
65
|
+
return node;
|
|
66
|
+
};
|
|
67
|
+
return inner;
|
|
68
|
+
};
|
|
69
|
+
#classRevivers = [
|
|
70
|
+
classReviver(isInstanceOf(VocabHolder), ({ kind, jsonLd }) => kind === "link" ? Link.fromJsonLd(jsonLd, this.options) : Object$1.fromJsonLd(jsonLd, this.options), () => {}),
|
|
71
|
+
classReviver(isInstanceOf(Array), () => [], async (revive, node, arr) => {
|
|
72
|
+
for (const item of await Array.fromAsync(node, revive)) arr.push(item);
|
|
73
|
+
}),
|
|
74
|
+
classReviver(isInstanceOf(Map), () => /* @__PURE__ */ new Map(), async (revive, node, map) => {
|
|
75
|
+
for (const [k, v] of node) map.set(await revive(k), await revive(v));
|
|
76
|
+
}),
|
|
77
|
+
classReviver(isInstanceOf(Set), () => /* @__PURE__ */ new Set(), async (revive, node, set) => {
|
|
78
|
+
for (const v of await Array.fromAsync(node, revive)) set.add(v);
|
|
79
|
+
}),
|
|
80
|
+
classReviver(isPlainObject, () => ({}), async (revive, node, obj) => {
|
|
81
|
+
for (const [k, v] of globalThis.Object.entries(node)) obj[k] = await revive(v);
|
|
82
|
+
})
|
|
83
|
+
];
|
|
84
|
+
};
|
|
85
|
+
const isVocab = (value) => value instanceof Object$1 || value instanceof Link;
|
|
86
|
+
const isPlainObject = (value) => value === null || typeof value !== "object" ? false : isObjectPrototype(globalThis.Object.getPrototypeOf(value));
|
|
87
|
+
const isObjectPrototype = (proto) => proto === null || proto === globalThis.Object.prototype;
|
|
88
|
+
const isInstanceOf = (cls) => (v) => v instanceof cls;
|
|
89
|
+
function getValueIfSchema(result) {
|
|
90
|
+
assertSchema(result);
|
|
91
|
+
return result.value;
|
|
92
|
+
}
|
|
93
|
+
function assertSchema(result) {
|
|
94
|
+
if (result.issues && result.issues.length > 0) throw new TypeError(`Task data failed schema validation: ${JSON.stringify(result.issues)}`);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A vocabulary object parked by the synchronous decode reviver, held until
|
|
98
|
+
* the async revive pass can `fromJsonLd()` it back into an instance.
|
|
99
|
+
*/
|
|
100
|
+
var VocabHolder = class VocabHolder {
|
|
101
|
+
kind;
|
|
102
|
+
jsonLd;
|
|
103
|
+
constructor(kind, jsonLd) {
|
|
104
|
+
this.kind = kind;
|
|
105
|
+
this.jsonLd = jsonLd;
|
|
106
|
+
}
|
|
107
|
+
static from = ({ kind, jsonLd }) => new VocabHolder(kind, jsonLd);
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Ties a container filter to its empty-shell `init` and child-filling `set`
|
|
111
|
+
* through one type parameter—a correlation the heterogeneous reviver list
|
|
112
|
+
* cannot carry, which previously forced `@ts-ignore` at the dispatch site.
|
|
113
|
+
*/
|
|
114
|
+
const classReviver = (filter, init, set) => (seen, revive, node) => {
|
|
115
|
+
if (!filter(node)) return void 0;
|
|
116
|
+
return (async () => {
|
|
117
|
+
const out = await init(node);
|
|
118
|
+
seen.set(node, out);
|
|
119
|
+
await set(revive, node, out);
|
|
120
|
+
return out;
|
|
121
|
+
})();
|
|
122
|
+
};
|
|
123
|
+
//#endregion
|
|
124
|
+
export { TaskCodec as t };
|
package/dist/compat/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import {
|
|
2
|
+
import { It as ActivityTransformer, n as Context } from "../context-BLe0NPtZ.cjs";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
package/dist/compat/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import {
|
|
2
|
+
import { It as ActivityTransformer, n as Context } from "../context-GfQA-CqB.js";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as assertEquals } from "../assert_equals-
|
|
5
|
-
import { t as assertStrictEquals } from "../assert_strict_equals-
|
|
6
|
-
import { n as normalizeAttachmentArrays, r as normalizeOutgoingActivityJsonLd, t as isPreloadedContextAttachmentSafe } from "../outgoing-jsonld-
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-PBVKNMJd.mjs";
|
|
5
|
+
import { t as assertStrictEquals } from "../assert_strict_equals-BzqyKuYL.mjs";
|
|
6
|
+
import { n as normalizeAttachmentArrays, r as normalizeOutgoingActivityJsonLd, t as isPreloadedContextAttachmentSafe } from "../outgoing-jsonld-BNL8AC14.mjs";
|
|
7
7
|
import { Create, Document, Note, PUBLIC_COLLECTION } from "@fedify/vocab";
|
|
8
8
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
9
9
|
//#region src/compat/outgoing-jsonld.test.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as assertEquals } from "../assert_equals-
|
|
5
|
-
import { t as assertNotEquals } from "../assert_not_equals-
|
|
6
|
-
import { t as normalizePublicAudience } from "../public-audience-
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-PBVKNMJd.mjs";
|
|
5
|
+
import { t as assertNotEquals } from "../assert_not_equals-C8vcTTA3.mjs";
|
|
6
|
+
import { t as normalizePublicAudience } from "../public-audience-c9zmYKgA.mjs";
|
|
7
7
|
import { Create, Note, PUBLIC_COLLECTION } from "@fedify/vocab";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
import { getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
8
|
-
import { b as autoIdAssigner, n as FederationImpl, y as actorDehydrator } from "../middleware-
|
|
4
|
+
import { t as MemoryKvStore } from "../kv-CIvR3Non.mjs";
|
|
5
|
+
import { t as assertEquals } from "../assert_equals-PBVKNMJd.mjs";
|
|
6
|
+
import { t as assertInstanceOf } from "../assert_instance_of-CxoC8bVq.mjs";
|
|
7
|
+
import { t as assert } from "../assert-DvVHoIZ0.mjs";
|
|
8
|
+
import { b as autoIdAssigner, n as FederationImpl, y as actorDehydrator } from "../middleware-CjHqy-1i.mjs";
|
|
9
9
|
import { Follow, Person } from "@fedify/vocab";
|
|
10
10
|
import { test } from "@fedify/fixture";
|
|
11
11
|
//#region src/compat/transformers.test.ts
|
|
@@ -66,7 +66,7 @@ const testDefinitions = [];
|
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/testing/context.ts
|
|
68
68
|
function createContext(values) {
|
|
69
|
-
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, meterProvider, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getCollectionUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger: lookupWebFinger$1, sendActivity, routeActivity } = values;
|
|
69
|
+
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, meterProvider, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getCollectionUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger: lookupWebFinger$1, sendActivity, routeActivity, enqueueTask, enqueueTaskMany } = values;
|
|
70
70
|
function throwRouterError() {
|
|
71
71
|
throw new RouterError("Not implemented");
|
|
72
72
|
}
|
|
@@ -126,6 +126,12 @@ function createContext(values) {
|
|
|
126
126
|
}),
|
|
127
127
|
routeActivity: routeActivity ?? ((_params) => {
|
|
128
128
|
throw new Error("Not implemented");
|
|
129
|
+
}),
|
|
130
|
+
enqueueTask: enqueueTask ?? ((_task, _data, _options) => {
|
|
131
|
+
throw new Error("Not implemented");
|
|
132
|
+
}),
|
|
133
|
+
enqueueTaskMany: enqueueTaskMany ?? ((_task, _payloads, _options) => {
|
|
134
|
+
throw new Error("Not implemented");
|
|
129
135
|
})
|
|
130
136
|
};
|
|
131
137
|
}
|
|
@@ -176,4 +182,4 @@ function createOutboxContext(args) {
|
|
|
176
182
|
};
|
|
177
183
|
}
|
|
178
184
|
//#endregion
|
|
179
|
-
export { testDefinitions as i, createOutboxContext as n, createRequestContext as r, createInboxContext as t };
|
|
185
|
+
export { testDefinitions as a, mockDocumentLoader as i, createOutboxContext as n, createRequestContext as r, createInboxContext as t };
|