@fedify/fedify 1.6.1-dev.837 → 1.6.1-pr.237.838
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/dist/codegen/schema.js +2 -2
- package/dist/deno.js +1 -1
- package/dist/federation/context.d.ts +27 -0
- package/dist/federation/handler.test.js +24 -5
- package/dist/federation/middleware.js +34 -1
- package/dist/federation/middleware.test.js +28 -0
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/_common/dirname.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/_common/from_file_url.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/dirname.js +2 -2
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/join.js +2 -2
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/_util.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/dirname.js +3 -3
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/from_file_url.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/join.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/normalize.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/windows/_util.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/windows/dirname.js +3 -3
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/windows/from_file_url.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/windows/join.js +1 -1
- package/dist/node_modules/.pnpm/@jsr_std__url@1.0.0-rc.3/node_modules/@jsr/std__url/dirname.js +2 -2
- package/dist/node_modules/.pnpm/@jsr_std__url@1.0.0-rc.3/node_modules/@jsr/std__url/join.js +2 -2
- package/dist/testing/context.js +14 -2
- package/dist/vocab/vocab.js +176 -176
- package/package.json +1 -1
package/dist/codegen/schema.js
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import { fromFileUrl } from "../node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/from_file_url.js";
|
6
|
-
import { dirname$
|
7
|
-
import { join$
|
6
|
+
import { dirname$3 as dirname } from "../node_modules/.pnpm/@jsr_std__url@1.0.0-rc.3/node_modules/@jsr/std__url/dirname.js";
|
7
|
+
import { join$3 as join } from "../node_modules/.pnpm/@jsr_std__url@1.0.0-rc.3/node_modules/@jsr/std__url/join.js";
|
8
8
|
import { parse } from "../node_modules/.pnpm/@jsr_std__yaml@1.0.6/node_modules/@jsr/std__yaml/parse.js";
|
9
9
|
import { readDirRecursive } from "./fs.js";
|
10
10
|
import { readFile } from "node:fs/promises";
|
package/dist/deno.js
CHANGED
@@ -71,6 +71,15 @@ interface Context<TContextData> {
|
|
71
71
|
* @since 1.6.0
|
72
72
|
*/
|
73
73
|
readonly federation: Federation<TContextData>;
|
74
|
+
/**
|
75
|
+
* Creates a new context with the same properties as this one,
|
76
|
+
* but with the given data.
|
77
|
+
* @param data The new data to associate with the context.
|
78
|
+
* @returns A new context with the same properties as this one,
|
79
|
+
* but with the given data.
|
80
|
+
* @since 1.6.0
|
81
|
+
*/
|
82
|
+
clone(data: TContextData): Context<TContextData>;
|
74
83
|
/**
|
75
84
|
* Builds the URI of the NodeInfo document.
|
76
85
|
* @returns The NodeInfo URI.
|
@@ -373,6 +382,15 @@ interface RequestContext<TContextData> extends Context<TContextData> {
|
|
373
382
|
* The URL of the request.
|
374
383
|
*/
|
375
384
|
readonly url: URL;
|
385
|
+
/**
|
386
|
+
* Creates a new context with the same properties as this one,
|
387
|
+
* but with the given data.
|
388
|
+
* @param data The new data to associate with the context.
|
389
|
+
* @returns A new context with the same properties as this one,
|
390
|
+
* but with the given data.
|
391
|
+
* @since 1.6.0
|
392
|
+
*/
|
393
|
+
clone(data: TContextData): RequestContext<TContextData>;
|
376
394
|
/**
|
377
395
|
* Gets an {@link Actor} object for the given identifier.
|
378
396
|
* @param identifier The actor's identifier.
|
@@ -472,6 +490,15 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
472
490
|
* @since 1.2.0
|
473
491
|
*/
|
474
492
|
recipient: string | null;
|
493
|
+
/**
|
494
|
+
* Creates a new context with the same properties as this one,
|
495
|
+
* but with the given data.
|
496
|
+
* @param data The new data to associate with the context.
|
497
|
+
* @returns A new context with the same properties as this one,
|
498
|
+
* but with the given data.
|
499
|
+
* @since 1.6.0
|
500
|
+
*/
|
501
|
+
clone(data: TContextData): InboxContext<TContextData>;
|
475
502
|
/**
|
476
503
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
477
504
|
* activity will be signed in HTTP Signatures by the forwarder, but its
|
@@ -984,7 +984,10 @@ test("handleInbox()", async () => {
|
|
984
984
|
recipient: null,
|
985
985
|
context: unsignedContext,
|
986
986
|
inboxContextFactory(_activity) {
|
987
|
-
return createInboxContext(
|
987
|
+
return createInboxContext({
|
988
|
+
...unsignedContext,
|
989
|
+
clone: void 0
|
990
|
+
});
|
988
991
|
},
|
989
992
|
...inboxOptions,
|
990
993
|
actorDispatcher: void 0
|
@@ -998,6 +1001,7 @@ test("handleInbox()", async () => {
|
|
998
1001
|
inboxContextFactory(_activity) {
|
999
1002
|
return createInboxContext({
|
1000
1003
|
...unsignedContext,
|
1004
|
+
clone: void 0,
|
1001
1005
|
recipient: "nobody"
|
1002
1006
|
});
|
1003
1007
|
},
|
@@ -1010,7 +1014,10 @@ test("handleInbox()", async () => {
|
|
1010
1014
|
recipient: null,
|
1011
1015
|
context: unsignedContext,
|
1012
1016
|
inboxContextFactory(_activity) {
|
1013
|
-
return createInboxContext(
|
1017
|
+
return createInboxContext({
|
1018
|
+
...unsignedContext,
|
1019
|
+
clone: void 0
|
1020
|
+
});
|
1014
1021
|
},
|
1015
1022
|
...inboxOptions
|
1016
1023
|
});
|
@@ -1022,6 +1029,7 @@ test("handleInbox()", async () => {
|
|
1022
1029
|
inboxContextFactory(_activity) {
|
1023
1030
|
return createInboxContext({
|
1024
1031
|
...unsignedContext,
|
1032
|
+
clone: void 0,
|
1025
1033
|
recipient: "someone"
|
1026
1034
|
});
|
1027
1035
|
},
|
@@ -1042,7 +1050,10 @@ test("handleInbox()", async () => {
|
|
1042
1050
|
recipient: null,
|
1043
1051
|
context: signedContext,
|
1044
1052
|
inboxContextFactory(_activity) {
|
1045
|
-
return createInboxContext(
|
1053
|
+
return createInboxContext({
|
1054
|
+
...unsignedContext,
|
1055
|
+
clone: void 0
|
1056
|
+
});
|
1046
1057
|
},
|
1047
1058
|
...inboxOptions
|
1048
1059
|
});
|
@@ -1054,6 +1065,7 @@ test("handleInbox()", async () => {
|
|
1054
1065
|
inboxContextFactory(_activity) {
|
1055
1066
|
return createInboxContext({
|
1056
1067
|
...unsignedContext,
|
1068
|
+
clone: void 0,
|
1057
1069
|
recipient: "someone"
|
1058
1070
|
});
|
1059
1071
|
},
|
@@ -1065,7 +1077,10 @@ test("handleInbox()", async () => {
|
|
1065
1077
|
recipient: null,
|
1066
1078
|
context: unsignedContext,
|
1067
1079
|
inboxContextFactory(_activity) {
|
1068
|
-
return createInboxContext(
|
1080
|
+
return createInboxContext({
|
1081
|
+
...unsignedContext,
|
1082
|
+
clone: void 0
|
1083
|
+
});
|
1069
1084
|
},
|
1070
1085
|
...inboxOptions,
|
1071
1086
|
skipSignatureVerification: true
|
@@ -1078,6 +1093,7 @@ test("handleInbox()", async () => {
|
|
1078
1093
|
inboxContextFactory(_activity) {
|
1079
1094
|
return createInboxContext({
|
1080
1095
|
...unsignedContext,
|
1096
|
+
clone: void 0,
|
1081
1097
|
recipient: "someone"
|
1082
1098
|
});
|
1083
1099
|
},
|
@@ -1114,7 +1130,10 @@ test("handleInbox()", async () => {
|
|
1114
1130
|
recipient: null,
|
1115
1131
|
context: signedContext,
|
1116
1132
|
inboxContextFactory(_activity) {
|
1117
|
-
return createInboxContext(
|
1133
|
+
return createInboxContext({
|
1134
|
+
...signedInvalidContext,
|
1135
|
+
clone: void 0
|
1136
|
+
});
|
1118
1137
|
},
|
1119
1138
|
...inboxOptions
|
1120
1139
|
});
|
@@ -882,6 +882,16 @@ var ContextImpl = class ContextImpl {
|
|
882
882
|
this.contextLoader = contextLoader;
|
883
883
|
this.invokedFromActorKeyPairsDispatcher = invokedFromActorKeyPairsDispatcher;
|
884
884
|
}
|
885
|
+
clone(data) {
|
886
|
+
return new ContextImpl({
|
887
|
+
url: this.url,
|
888
|
+
federation: this.federation,
|
889
|
+
data,
|
890
|
+
documentLoader: this.documentLoader,
|
891
|
+
contextLoader: this.contextLoader,
|
892
|
+
invokedFromActorKeyPairsDispatcher: this.invokedFromActorKeyPairsDispatcher
|
893
|
+
});
|
894
|
+
}
|
885
895
|
toInboxContext(recipient, activity, activityId, activityType) {
|
886
896
|
return new InboxContextImpl(recipient, activity, activityId, activityType, {
|
887
897
|
url: this.url,
|
@@ -1498,6 +1508,19 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
|
|
1498
1508
|
this.request = options.request;
|
1499
1509
|
this.url = options.url;
|
1500
1510
|
}
|
1511
|
+
clone(data) {
|
1512
|
+
return new RequestContextImpl({
|
1513
|
+
url: this.url,
|
1514
|
+
federation: this.federation,
|
1515
|
+
data,
|
1516
|
+
documentLoader: this.documentLoader,
|
1517
|
+
contextLoader: this.contextLoader,
|
1518
|
+
invokedFromActorKeyPairsDispatcher: this.invokedFromActorKeyPairsDispatcher,
|
1519
|
+
invokedFromActorDispatcher: this.#invokedFromActorDispatcher,
|
1520
|
+
invokedFromObjectDispatcher: this.#invokedFromObjectDispatcher,
|
1521
|
+
request: this.request
|
1522
|
+
});
|
1523
|
+
}
|
1501
1524
|
async getActor(identifier) {
|
1502
1525
|
if (this.federation.actorCallbacks == null || this.federation.actorCallbacks.dispatcher == null) throw new Error("No actor dispatcher registered.");
|
1503
1526
|
if (this.#invokedFromActorDispatcher != null) getLogger([
|
@@ -1554,7 +1577,7 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
|
|
1554
1577
|
});
|
1555
1578
|
}
|
1556
1579
|
};
|
1557
|
-
var InboxContextImpl = class extends ContextImpl {
|
1580
|
+
var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
1558
1581
|
recipient;
|
1559
1582
|
activity;
|
1560
1583
|
activityId;
|
@@ -1566,6 +1589,16 @@ var InboxContextImpl = class extends ContextImpl {
|
|
1566
1589
|
this.activityId = activityId;
|
1567
1590
|
this.activityType = activityType;
|
1568
1591
|
}
|
1592
|
+
clone(data) {
|
1593
|
+
return new InboxContextImpl(this.recipient, this.activity, this.activityId, this.activityType, {
|
1594
|
+
url: this.url,
|
1595
|
+
federation: this.federation,
|
1596
|
+
data,
|
1597
|
+
documentLoader: this.documentLoader,
|
1598
|
+
contextLoader: this.contextLoader,
|
1599
|
+
invokedFromActorKeyPairsDispatcher: this.invokedFromActorKeyPairsDispatcher
|
1600
|
+
});
|
1601
|
+
}
|
1569
1602
|
forwardActivity(forwarder, recipients, options) {
|
1570
1603
|
const tracer = this.tracerProvider.getTracer(deno_default.name, deno_default.version);
|
1571
1604
|
return tracer.startActiveSpan("activitypub.outbox", {
|
@@ -536,6 +536,19 @@ test("Federation.createContext()", async (t) => {
|
|
536
536
|
identifier: "handle"
|
537
537
|
});
|
538
538
|
});
|
539
|
+
await t.step("Context.clone()", () => {
|
540
|
+
const federation = createFederation({ kv });
|
541
|
+
const ctx = federation.createContext(new URL("https://example.com/"), 123);
|
542
|
+
const clone = ctx.clone(456);
|
543
|
+
assertStrictEquals(clone.canonicalOrigin, ctx.canonicalOrigin);
|
544
|
+
assertStrictEquals(clone.origin, ctx.origin);
|
545
|
+
assertEquals(clone.data, 456);
|
546
|
+
assertEquals(clone.host, ctx.host);
|
547
|
+
assertEquals(clone.hostname, ctx.hostname);
|
548
|
+
assertStrictEquals(clone.documentLoader, ctx.documentLoader);
|
549
|
+
assertStrictEquals(clone.contextLoader, ctx.contextLoader);
|
550
|
+
assertStrictEquals(clone.federation, ctx.federation);
|
551
|
+
});
|
539
552
|
mock("GET@/.well-known/nodeinfo", (req) => {
|
540
553
|
assertEquals(new URL(req.url).host, "example.com");
|
541
554
|
assertEquals(req.headers.get("User-Agent"), "CustomUserAgent/1.2.3");
|
@@ -662,6 +675,21 @@ test("Federation.createContext()", async (t) => {
|
|
662
675
|
id: "123"
|
663
676
|
}), new Note({ summary: "Note 123 by john" }));
|
664
677
|
});
|
678
|
+
await t.step("RequestContext.clone()", () => {
|
679
|
+
const federation = createFederation({ kv });
|
680
|
+
const req = new Request("https://example.com/");
|
681
|
+
const ctx = federation.createContext(req, 123);
|
682
|
+
const clone = ctx.clone(456);
|
683
|
+
assertStrictEquals(clone.request, ctx.request);
|
684
|
+
assertEquals(clone.url, ctx.url);
|
685
|
+
assertEquals(clone.data, 456);
|
686
|
+
assertEquals(clone.origin, ctx.origin);
|
687
|
+
assertEquals(clone.host, ctx.host);
|
688
|
+
assertEquals(clone.hostname, ctx.hostname);
|
689
|
+
assertStrictEquals(clone.documentLoader, ctx.documentLoader);
|
690
|
+
assertStrictEquals(clone.contextLoader, ctx.contextLoader);
|
691
|
+
assertStrictEquals(clone.federation, ctx.federation);
|
692
|
+
});
|
665
693
|
uninstall();
|
666
694
|
});
|
667
695
|
test("Federation.setInboxListeners()", async (t) => {
|
@@ -3,8 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import { isWindows } from "./_os.js";
|
6
|
-
import { dirname$
|
7
|
-
import { dirname$
|
6
|
+
import { dirname$1 as dirname } from "./posix/dirname.js";
|
7
|
+
import { dirname$2 as dirname$1 } from "./windows/dirname.js";
|
8
8
|
|
9
9
|
//#region node_modules/.pnpm/@jsr+std__path@1.0.9/node_modules/@jsr/std__path/dirname.js
|
10
10
|
/**
|
@@ -3,8 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import { isWindows } from "./_os.js";
|
6
|
-
import { join$
|
7
|
-
import { join$
|
6
|
+
import { join$1 as join } from "./posix/join.js";
|
7
|
+
import { join$2 as join$1 } from "./windows/join.js";
|
8
8
|
|
9
9
|
//#region node_modules/.pnpm/@jsr+std__path@1.0.9/node_modules/@jsr/std__path/join.js
|
10
10
|
/**
|
package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/dirname.js
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import { stripTrailingSeparators } from "../_common/strip_trailing_separators.js";
|
6
|
-
import { isPosixPathSeparator
|
7
|
-
import { assertArg$
|
6
|
+
import { isPosixPathSeparator } from "./_util.js";
|
7
|
+
import { assertArg$2 as assertArg } from "../_common/dirname.js";
|
8
8
|
|
9
9
|
//#region node_modules/.pnpm/@jsr+std__path@1.0.9/node_modules/@jsr/std__path/posix/dirname.js
|
10
10
|
/**
|
@@ -51,4 +51,4 @@ import { assertArg$1 as assertArg } from "../_common/dirname.js";
|
|
51
51
|
}
|
52
52
|
|
53
53
|
//#endregion
|
54
|
-
export { dirname as dirname$
|
54
|
+
export { dirname as dirname$1 };
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { assertArg$
|
5
|
+
import { assertArg$1 as assertArg } from "../_common/from_file_url.js";
|
6
6
|
|
7
7
|
//#region node_modules/.pnpm/@jsr+std__path@1.0.9/node_modules/@jsr/std__path/posix/from_file_url.js
|
8
8
|
/**
|
package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/normalize.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { isPosixPathSeparator
|
5
|
+
import { isPosixPathSeparator } from "./_util.js";
|
6
6
|
import { assertArg } from "../_common/normalize.js";
|
7
7
|
import { normalizeString } from "../_common/normalize_string.js";
|
8
8
|
|
package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/windows/dirname.js
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
|
5
5
|
import { stripTrailingSeparators } from "../_common/strip_trailing_separators.js";
|
6
6
|
import { CHAR_COLON } from "../_common/constants.js";
|
7
|
-
import { isPathSeparator, isPosixPathSeparator, isWindowsDeviceRoot } from "./_util.js";
|
8
|
-
import { assertArg$
|
7
|
+
import { isPathSeparator, isPosixPathSeparator$1 as isPosixPathSeparator, isWindowsDeviceRoot } from "./_util.js";
|
8
|
+
import { assertArg$2 as assertArg } from "../_common/dirname.js";
|
9
9
|
|
10
10
|
//#region node_modules/.pnpm/@jsr+std__path@1.0.9/node_modules/@jsr/std__path/windows/dirname.js
|
11
11
|
/**
|
@@ -72,4 +72,4 @@ import { assertArg$1 as assertArg } from "../_common/dirname.js";
|
|
72
72
|
}
|
73
73
|
|
74
74
|
//#endregion
|
75
|
-
export { dirname as dirname$
|
75
|
+
export { dirname as dirname$2 };
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { assertArg$
|
5
|
+
import { assertArg$1 as assertArg } from "../_common/from_file_url.js";
|
6
6
|
|
7
7
|
//#region node_modules/.pnpm/@jsr+std__path@1.0.9/node_modules/@jsr/std__path/windows/from_file_url.js
|
8
8
|
/**
|
package/dist/node_modules/.pnpm/@jsr_std__url@1.0.0-rc.3/node_modules/@jsr/std__url/dirname.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { dirname$
|
5
|
+
import { dirname$1 as dirname } from "../../../../@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/dirname.js";
|
6
6
|
import { strip } from "./_strip.js";
|
7
7
|
|
8
8
|
//#region node_modules/.pnpm/@jsr+std__url@1.0.0-rc.3/node_modules/@jsr/std__url/dirname.js
|
@@ -35,4 +35,4 @@ import { strip } from "./_strip.js";
|
|
35
35
|
}
|
36
36
|
|
37
37
|
//#endregion
|
38
|
-
export { dirname$1 };
|
38
|
+
export { dirname$1 as dirname$3 };
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { join$
|
5
|
+
import { join$1 as join } from "../../../../@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/join.js";
|
6
6
|
|
7
7
|
//#region node_modules/.pnpm/@jsr+std__url@1.0.0-rc.3/node_modules/@jsr/std__url/join.js
|
8
8
|
/**
|
@@ -33,4 +33,4 @@ import { join$2 as join } from "../../../../@jsr_std__path@1.0.9/node_modules/@j
|
|
33
33
|
}
|
34
34
|
|
35
35
|
//#endregion
|
36
|
-
export { join$1 };
|
36
|
+
export { join$1 as join$3 };
|
package/dist/testing/context.js
CHANGED
@@ -9,11 +9,11 @@ import { mockDocumentLoader } from "./docloader.js";
|
|
9
9
|
import { trace } from "@opentelemetry/api";
|
10
10
|
|
11
11
|
//#region testing/context.ts
|
12
|
-
function createContext(
|
12
|
+
function createContext(values) {
|
13
|
+
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger: lookupWebFinger$1, sendActivity, routeActivity } = values;
|
13
14
|
function throwRouteError() {
|
14
15
|
throw new RouterError("Not implemented");
|
15
16
|
}
|
16
|
-
url ??= new URL("http://example.com/");
|
17
17
|
return {
|
18
18
|
federation,
|
19
19
|
data,
|
@@ -24,6 +24,10 @@ function createContext({ federation, url, canonicalOrigin, data, documentLoader,
|
|
24
24
|
documentLoader: documentLoader ?? mockDocumentLoader,
|
25
25
|
contextLoader: contextLoader ?? mockDocumentLoader,
|
26
26
|
tracerProvider: tracerProvider ?? trace.getTracerProvider(),
|
27
|
+
clone: clone ?? ((data$1) => createContext({
|
28
|
+
...values,
|
29
|
+
data: data$1
|
30
|
+
})),
|
27
31
|
getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
|
28
32
|
getActorUri: getActorUri ?? throwRouteError,
|
29
33
|
getObjectUri: getObjectUri ?? throwRouteError,
|
@@ -70,6 +74,10 @@ function createContext({ federation, url, canonicalOrigin, data, documentLoader,
|
|
70
74
|
function createRequestContext(args) {
|
71
75
|
return {
|
72
76
|
...createContext(args),
|
77
|
+
clone: args.clone ?? ((data) => createRequestContext({
|
78
|
+
...args,
|
79
|
+
data
|
80
|
+
})),
|
73
81
|
request: args.request ?? new Request(args.url),
|
74
82
|
url: args.url,
|
75
83
|
getActor: args.getActor ?? (() => Promise.resolve(null)),
|
@@ -84,6 +92,10 @@ function createRequestContext(args) {
|
|
84
92
|
function createInboxContext(args) {
|
85
93
|
return {
|
86
94
|
...createContext(args),
|
95
|
+
clone: args.clone ?? ((data) => createInboxContext({
|
96
|
+
...args,
|
97
|
+
data
|
98
|
+
})),
|
87
99
|
recipient: args.recipient ?? null,
|
88
100
|
forwardActivity: args.forwardActivity ?? ((_params) => {
|
89
101
|
throw new Error("Not implemented");
|