@fedify/fedify 1.6.1-dev.851 → 1.6.1-dev.856

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.
Files changed (74) hide show
  1. package/dist/_virtual/rolldown_runtime.js +26 -1
  2. package/dist/codegen/schema.js +5 -4
  3. package/dist/deno.js +15 -2
  4. package/dist/federation/middleware.test.js +62 -53
  5. package/dist/federation/send.test.js +8 -10
  6. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/_common/constants.js +1 -7
  7. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/_common/dirname.js +1 -1
  8. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/_common/normalize.js +1 -1
  9. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/dirname.js +1 -32
  10. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/join.js +1 -32
  11. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/mod.js +0 -2
  12. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/_util.js +1 -1
  13. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/dirname.js +2 -2
  14. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/posix/normalize.js +2 -2
  15. package/dist/node_modules/.pnpm/@jsr_std__url@1.0.0-rc.3/node_modules/@jsr/std__url/dirname.js +1 -1
  16. package/dist/node_modules/.pnpm/@jsr_std__url@1.0.0-rc.3/node_modules/@jsr/std__url/join.js +1 -1
  17. package/dist/node_modules/.pnpm/dequal@2.0.3/node_modules/dequal/dist/index.js +68 -0
  18. package/dist/node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/CallHistory.js +94 -0
  19. package/dist/node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/FetchMock.js +143 -0
  20. package/dist/node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/IsSubsetOf.js +103 -0
  21. package/dist/node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/Matchers.js +195 -0
  22. package/dist/node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/RequestUtils.js +83 -0
  23. package/dist/node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/Route.js +137 -0
  24. package/dist/node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/Router.js +181 -0
  25. package/dist/node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/StatusTextMap.js +73 -0
  26. package/dist/node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/TypeDescriptor.js +97 -0
  27. package/dist/node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/index.js +11 -0
  28. package/dist/node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js +87 -0
  29. package/dist/node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.js +37 -0
  30. package/dist/runtime/authdocloader.test.js +5 -5
  31. package/dist/runtime/docloader.js +1 -1
  32. package/dist/runtime/docloader.test.js +8 -0
  33. package/dist/sig/key.js +7 -2
  34. package/dist/testing/docloader.js +34 -15
  35. package/dist/testing/fixtures/example.com/{hong-gildong → hong-gildong.json} +1 -1
  36. package/dist/testing/fixtures/example.com/{object → object.json} +1 -1
  37. package/dist/testing/fixtures/example.com/person.js +29 -0
  38. package/dist/testing/fixtures/example.com/person2.js +48 -0
  39. package/dist/testing/fixtures/example.com/{test → test.json} +1 -1
  40. package/dist/testing/fixtures/w3id.org/security/data-integrity/{v1 → v1.json} +1 -1
  41. package/dist/testing/fixtures/w3id.org/security/{v1 → v1.json} +9 -9
  42. package/dist/testing/mod.d.ts +11 -0
  43. package/dist/testing/mod.js +44 -38
  44. package/dist/vocab/lookup.test.js +30 -35
  45. package/dist/vocab/vocab.js +176 -176
  46. package/dist/vocab/vocab.test.js +2 -2
  47. package/package.json +8 -3
  48. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/windows/_util.js +0 -19
  49. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/windows/dirname.js +0 -75
  50. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/windows/join.js +0 -54
  51. package/dist/node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/windows/normalize.js +0 -87
  52. /package/dist/testing/fixtures/activitypub.academy/users/{brauca_darradiul → brauca_darradiul.json} +0 -0
  53. /package/dist/testing/fixtures/example.com/{announce → announce.json} +0 -0
  54. /package/dist/testing/fixtures/example.com/{collection → collection.json} +0 -0
  55. /package/dist/testing/fixtures/example.com/{create → create.json} +0 -0
  56. /package/dist/testing/fixtures/example.com/{cross-origin-actor → cross-origin-actor.json} +0 -0
  57. /package/dist/testing/fixtures/example.com/{invite → invite.json} +0 -0
  58. /package/dist/testing/fixtures/example.com/{key → key.json} +0 -0
  59. /package/dist/testing/fixtures/example.com/{key2 → key2.json} +0 -0
  60. /package/dist/testing/fixtures/example.com/{orderedcollectionpage → orderedcollectionpage.json} +0 -0
  61. /package/dist/testing/fixtures/example.com/paged/{a → a.json} +0 -0
  62. /package/dist/testing/fixtures/example.com/paged/{b → b.json} +0 -0
  63. /package/dist/testing/fixtures/example.com/{paged-collection → paged-collection.json} +0 -0
  64. /package/dist/testing/fixtures/example.com/{person → person.json} +0 -0
  65. /package/dist/testing/fixtures/example.com/{person2 → person2.json} +0 -0
  66. /package/dist/testing/fixtures/example.com/users/{handle → handle.json} +0 -0
  67. /package/dist/testing/fixtures/example.com/{wrong-type → wrong-type.json} +0 -0
  68. /package/dist/testing/fixtures/remote.domain/users/{bob → bob.json} +0 -0
  69. /package/dist/testing/fixtures/server.example/users/{alice → alice.json} +0 -0
  70. /package/dist/testing/fixtures/w3id.org/identity/{v1 → v1.json} +0 -0
  71. /package/dist/testing/fixtures/w3id.org/security/multikey/{v1 → v1.json} +0 -0
  72. /package/dist/testing/fixtures/wizard.casa/users/{hongminhee → hongminhee.json} +0 -0
  73. /package/dist/testing/fixtures/www.w3.org/ns/{activitystreams → activitystreams.json} +0 -0
  74. /package/dist/testing/fixtures/www.w3.org/ns/did/{v1 → v1.json} +0 -0
@@ -2,14 +2,39 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
+ import { createRequire } from "node:module";
6
+
5
7
  //#region rolldown:runtime
8
+ var __create = Object.create;
6
9
  var __defProp = Object.defineProperty;
10
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
+ var __getOwnPropNames = Object.getOwnPropertyNames;
12
+ var __getProtoOf = Object.getPrototypeOf;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __commonJS = (cb, mod) => function() {
15
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
+ };
7
17
  var __export = (target, all) => {
8
18
  for (var name in all) __defProp(target, name, {
9
19
  get: all[name],
10
20
  enumerable: true
11
21
  });
12
22
  };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
25
+ key = keys[i];
26
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
27
+ get: ((k) => from[k]).bind(null, key),
28
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
+ });
30
+ }
31
+ return to;
32
+ };
33
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
34
+ value: mod,
35
+ enumerable: true
36
+ }) : target, mod));
37
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
13
38
 
14
39
  //#endregion
15
- export { __export };
40
+ export { __commonJS, __export, __require, __toESM };
@@ -3,12 +3,12 @@
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$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";
6
+ import { dirname } from "../node_modules/.pnpm/@jsr_std__url@1.0.0-rc.3/node_modules/@jsr/std__url/dirname.js";
7
+ import { 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
- import { readFile } from "node:fs/promises";
11
10
  import { Validator } from "@cfworker/json-schema";
11
+ import { readFile } from "node:fs/promises";
12
12
  import { join as join$1 } from "node:path";
13
13
 
14
14
  //#region codegen/schema.ts
@@ -41,10 +41,11 @@ async function loadSchemaValidator() {
41
41
  const schemaObject = parse(content);
42
42
  return new Validator(schemaObject);
43
43
  }
44
- const schemaValidator = await loadSchemaValidator();
44
+ let schemaValidator = void 0;
45
45
  async function loadSchema(path) {
46
46
  const content = await readFile(path, { encoding: "utf-8" });
47
47
  const schema = parse(content);
48
+ if (schemaValidator == null) schemaValidator = await loadSchemaValidator();
48
49
  const result = schemaValidator.validate(schema);
49
50
  const errors = [];
50
51
  if (result.valid) return schema;
package/dist/deno.js CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  //#region deno.json
6
6
  var name = "@fedify/fedify";
7
- var version = "1.6.1-dev.851+58ee54ab";
7
+ var version = "1.6.1-dev.856+77c62d3e";
8
8
  var license = "MIT";
9
9
  var exports = {
10
10
  ".": "./mod.ts",
@@ -36,6 +36,7 @@ var imports = {
36
36
  "asn1js": "npm:asn1js@^3.0.5",
37
37
  "byte-encodings": "npm:byte-encodings@^1.0.11",
38
38
  "fast-check": "npm:fast-check@^3.22.0",
39
+ "fetch-mock": "npm:fetch-mock@^12.5.2",
39
40
  "json-canon": "npm:json-canon@^1.0.1",
40
41
  "jsonld": "npm:jsonld@^8.3.2",
41
42
  "multicodec": "npm:multicodec@^3.2.1",
@@ -48,6 +49,13 @@ var imports = {
48
49
  var include = ["vocab/vocab.ts"];
49
50
  var exclude = [
50
51
  "apidoc/",
52
+ "cfworkers/dist/",
53
+ "cfworkers/fixtures/",
54
+ "cfworkers/imports.ts",
55
+ "cfworkers/README.md",
56
+ "cfworkers/server.ts",
57
+ "cfworkers/server.js",
58
+ "cfworkers/server.js.map",
51
59
  "codegen/schema.yaml",
52
60
  "dist/",
53
61
  "node_modules/",
@@ -102,11 +110,16 @@ var tasks = {
102
110
  "command": "cd dist/ && bun test --timeout 60000",
103
111
  "dependencies": ["pnpm:build"]
104
112
  },
113
+ "test:cfworkers": {
114
+ "command": "pnpm exec wrangler deploy --dry-run --outdir cfworkers && node --import=tsx cfworkers/client.ts",
115
+ "dependencies": ["pnpm:build"]
116
+ },
105
117
  "test-all": { "dependencies": [
106
118
  "check",
107
119
  "test",
108
120
  "test:node",
109
- "test:bun"
121
+ "test:bun",
122
+ "test:cfworkers"
110
123
  ] }
111
124
  };
112
125
  var deno_default = {
@@ -23,12 +23,11 @@ import { assertNotEquals } from "../node_modules/.pnpm/@jsr_std__assert@0.226.0/
23
23
  import { assertRejects } from "../node_modules/.pnpm/@jsr_std__assert@0.226.0/node_modules/@jsr/std__assert/assert_rejects.js";
24
24
  import { assertStrictEquals } from "../node_modules/.pnpm/@jsr_std__assert@0.226.0/node_modules/@jsr/std__assert/assert_strict_equals.js";
25
25
  import { assertThrows } from "../node_modules/.pnpm/@jsr_std__assert@0.226.0/node_modules/@jsr/std__assert/assert_throws.js";
26
- import { dirname } from "../node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/dirname.js";
27
- import { join } from "../node_modules/.pnpm/@jsr_std__path@1.0.9/node_modules/@jsr/std__path/join.js";
28
26
  import { mockDocumentLoader } from "../testing/docloader.js";
29
27
  import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../testing/keys.js";
30
- import { install, mock, uninstall } from "../node_modules/.pnpm/@jsr_hongminhee__deno-mock-fetch@0.3.2/node_modules/@jsr/hongminhee__deno-mock-fetch/mod.js";
31
- import { readFile } from "node:fs/promises";
28
+ import { esm_default } from "../node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/index.js";
29
+ import { person_default } from "../testing/fixtures/example.com/person.js";
30
+ import { person2_default } from "../testing/fixtures/example.com/person2.js";
32
31
 
33
32
  //#region federation/middleware.test.ts
34
33
  test("createFederation()", async (t) => {
@@ -148,9 +147,9 @@ test("Federation.createContext()", async (t) => {
148
147
  const documentLoader = (url) => {
149
148
  throw new FetchError(new URL(url), "Not found");
150
149
  };
151
- install();
152
- mock("GET@/object", async (req) => {
153
- const v = await verifyRequest(req, {
150
+ esm_default.spyGlobal();
151
+ esm_default.get("https://example.com/object", async (cl) => {
152
+ const v = await verifyRequest(cl.request, {
154
153
  contextLoader: mockDocumentLoader,
155
154
  documentLoader: mockDocumentLoader,
156
155
  currentTime: Temporal.Now.instant()
@@ -549,17 +548,17 @@ test("Federation.createContext()", async (t) => {
549
548
  assertStrictEquals(clone.contextLoader, ctx.contextLoader);
550
549
  assertStrictEquals(clone.federation, ctx.federation);
551
550
  });
552
- mock("GET@/.well-known/nodeinfo", (req) => {
553
- assertEquals(new URL(req.url).host, "example.com");
554
- assertEquals(req.headers.get("User-Agent"), "CustomUserAgent/1.2.3");
551
+ esm_default.get("https://example.com/.well-known/nodeinfo", (cl) => {
552
+ const headers = cl.options.headers ?? {};
553
+ assertEquals(new Headers(headers).get("User-Agent"), "CustomUserAgent/1.2.3");
555
554
  return new Response(JSON.stringify({ links: [{
556
555
  rel: "http://nodeinfo.diaspora.software/ns/schema/2.1",
557
556
  href: "https://example.com/nodeinfo/2.1"
558
557
  }] }));
559
558
  });
560
- mock("GET@/nodeinfo/2.1", (req) => {
561
- assertEquals(new URL(req.url).host, "example.com");
562
- assertEquals(req.headers.get("User-Agent"), "CustomUserAgent/1.2.3");
559
+ esm_default.get("https://example.com/nodeinfo/2.1", (cl) => {
560
+ const headers = cl.options.headers ?? {};
561
+ assertEquals(new Headers(headers).get("User-Agent"), "CustomUserAgent/1.2.3");
563
562
  return new Response(JSON.stringify({
564
563
  software: {
565
564
  name: "foo",
@@ -690,19 +689,22 @@ test("Federation.createContext()", async (t) => {
690
689
  assertStrictEquals(clone.contextLoader, ctx.contextLoader);
691
690
  assertStrictEquals(clone.federation, ctx.federation);
692
691
  });
693
- uninstall();
692
+ esm_default.hardReset();
694
693
  });
695
694
  test("Federation.setInboxListeners()", async (t) => {
696
695
  const kv = new MemoryKvStore();
697
- install();
698
- mock("GET@/key2", async () => {
699
- return new Response(JSON.stringify(await rsaPublicKey2.toJsonLd({ contextLoader: mockDocumentLoader })), { headers: { "Content-Type": "application/activity+json" } });
696
+ esm_default.spyGlobal();
697
+ esm_default.get("https://example.com/key2", {
698
+ headers: { "Content-Type": "application/activity+json" },
699
+ body: await rsaPublicKey2.toJsonLd({ contextLoader: mockDocumentLoader })
700
700
  });
701
- mock("GET@/person", async () => {
702
- return new Response(await readFile(join(dirname(import.meta.dirname), "testing", "fixtures", "example.com", "person")), { headers: { "Content-Type": "application/activity+json" } });
701
+ esm_default.get("begin:https://example.com/person2", {
702
+ headers: { "Content-Type": "application/activity+json" },
703
+ body: person2_default
703
704
  });
704
- mock("GET@/person2", async () => {
705
- return new Response(await readFile(join(dirname(import.meta.dirname), "testing", "fixtures", "example.com", "person2")), { headers: { "Content-Type": "application/activity+json" } });
705
+ esm_default.get("begin:https://example.com/person", {
706
+ headers: { "Content-Type": "application/activity+json" },
707
+ body: person_default
706
708
  });
707
709
  await t.step("path match", () => {
708
710
  const federation = createFederation({
@@ -869,7 +871,7 @@ test("Federation.setInboxListeners()", async (t) => {
869
871
  assertEquals(errors[0], error);
870
872
  assertEquals(response.status, 500);
871
873
  });
872
- uninstall();
874
+ esm_default.hardReset();
873
875
  });
874
876
  test("Federation.setInboxDispatcher()", async (t) => {
875
877
  const kv = new MemoryKvStore();
@@ -900,17 +902,17 @@ test("Federation.setInboxDispatcher()", async (t) => {
900
902
  });
901
903
  });
902
904
  test("FederationImpl.sendActivity()", async (t) => {
903
- install();
905
+ esm_default.spyGlobal();
904
906
  let verified = null;
905
907
  let request = null;
906
- mock("POST@/inbox", async (req) => {
908
+ esm_default.post("https://example.com/inbox", async (cl) => {
907
909
  verified = [];
908
- request = req.clone();
910
+ request = cl.request.clone();
909
911
  const options = {
910
912
  documentLoader: mockDocumentLoader,
911
913
  contextLoader: mockDocumentLoader
912
914
  };
913
- let json = await req.json();
915
+ let json = await cl.request.json();
914
916
  if (await verifyJsonLd(json, options)) verified.push("ld");
915
917
  json = detachSignature(json);
916
918
  let activity = await verifyObject(Activity, json, options);
@@ -983,24 +985,30 @@ test("FederationImpl.sendActivity()", async (t) => {
983
985
  assertEquals(request?.url, "https://example.com/inbox");
984
986
  assertEquals(request?.headers.get("Content-Type"), "application/activity+json");
985
987
  });
986
- uninstall();
988
+ esm_default.hardReset();
987
989
  });
988
990
  test("ContextImpl.lookupObject()", async (t) => {
989
- install();
990
- mock("GET@/.well-known/webfinger", () => new Response(JSON.stringify({
991
- subject: "acct:test@localhost",
992
- links: [{
993
- rel: "self",
994
- type: "application/activity+json",
995
- href: "https://localhost/actor"
996
- }]
997
- }), { headers: { "Content-Type": "application/jrd+json" } }));
998
- mock("GET@/actor", () => new Response(JSON.stringify({
999
- "@context": "https://www.w3.org/ns/activitystreams",
1000
- "type": "Person",
1001
- "id": "https://localhost/actor",
1002
- "preferredUsername": "test"
1003
- }), { headers: { "Content-Type": "application/activity+json" } }));
991
+ esm_default.spyGlobal();
992
+ esm_default.get("begin:https://localhost/.well-known/webfinger", {
993
+ headers: { "Content-Type": "application/jrd+json" },
994
+ body: {
995
+ subject: "acct:test@localhost",
996
+ links: [{
997
+ rel: "self",
998
+ type: "application/activity+json",
999
+ href: "https://localhost/actor"
1000
+ }]
1001
+ }
1002
+ });
1003
+ esm_default.get("https://localhost/actor", {
1004
+ headers: { "Content-Type": "application/activity+json" },
1005
+ body: {
1006
+ "@context": "https://www.w3.org/ns/activitystreams",
1007
+ "type": "Person",
1008
+ "id": "https://localhost/actor",
1009
+ "preferredUsername": "test"
1010
+ }
1011
+ });
1004
1012
  await t.step("allowPrivateAddress: true", async () => {
1005
1013
  const federation = createFederation({
1006
1014
  kv: new MemoryKvStore(),
@@ -1021,17 +1029,17 @@ test("ContextImpl.lookupObject()", async (t) => {
1021
1029
  const result = await ctx.lookupObject("@test@localhost");
1022
1030
  assertEquals(result, null);
1023
1031
  });
1024
- uninstall();
1032
+ esm_default.hardReset();
1025
1033
  });
1026
1034
  test("ContextImpl.sendActivity()", async (t) => {
1027
- install();
1035
+ esm_default.spyGlobal();
1028
1036
  let verified = null;
1029
1037
  let request = null;
1030
1038
  let collectionSyncHeader = null;
1031
- mock("POST@/inbox", async (req) => {
1039
+ esm_default.post("https://example.com/inbox", async (cl) => {
1032
1040
  verified = [];
1033
- request = req.clone();
1034
- collectionSyncHeader = req.headers.get("Collection-Synchronization");
1041
+ request = cl.request.clone();
1042
+ collectionSyncHeader = cl.request.headers.get("Collection-Synchronization");
1035
1043
  const options = {
1036
1044
  async documentLoader(url) {
1037
1045
  const response = await federation.fetch(new Request(url), { contextData: void 0 });
@@ -1054,7 +1062,7 @@ test("ContextImpl.sendActivity()", async (t) => {
1054
1062
  async set(_keyId, _key) {}
1055
1063
  }
1056
1064
  };
1057
- let json = await req.json();
1065
+ let json = await cl.request.json();
1058
1066
  if (await verifyJsonLd(json, options)) verified.push("ld");
1059
1067
  json = detachSignature(json);
1060
1068
  let activity = await verifyObject(Activity, json, options);
@@ -1328,6 +1336,7 @@ test("ContextImpl.sendActivity()", async (t) => {
1328
1336
  });
1329
1337
  assertNotEquals(collectionSyncHeader, null);
1330
1338
  });
1339
+ esm_default.hardReset();
1331
1340
  });
1332
1341
  test("ContextImpl.routeActivity()", async () => {
1333
1342
  const federation = new FederationImpl({ kv: new MemoryKvStore() });
@@ -1395,17 +1404,17 @@ test("ContextImpl.routeActivity()", async () => {
1395
1404
  ]);
1396
1405
  });
1397
1406
  test("InboxContextImpl.forwardActivity()", async (t) => {
1398
- install();
1407
+ esm_default.spyGlobal();
1399
1408
  let verified = null;
1400
1409
  let request = null;
1401
- mock("POST@/inbox", async (req) => {
1410
+ esm_default.post("https://example.com/inbox", async (cl) => {
1402
1411
  verified = [];
1403
- request = req.clone();
1412
+ request = cl.request.clone();
1404
1413
  const options = {
1405
1414
  documentLoader: mockDocumentLoader,
1406
1415
  contextLoader: mockDocumentLoader
1407
1416
  };
1408
- let json = await req.json();
1417
+ let json = await cl.request.json();
1409
1418
  if (await verifyJsonLd(json, options)) verified.push("ld");
1410
1419
  json = detachSignature(json);
1411
1420
  let activity = await verifyObject(Activity, json, options);
@@ -1514,7 +1523,7 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
1514
1523
  }, { skipIfUnsigned: true });
1515
1524
  assertEquals(verified, ["ld"]);
1516
1525
  });
1517
- uninstall();
1526
+ esm_default.hardReset();
1518
1527
  });
1519
1528
 
1520
1529
  //#endregion
@@ -14,7 +14,7 @@ import { assertNotEquals } from "../node_modules/.pnpm/@jsr_std__assert@0.226.0/
14
14
  import { assertRejects } from "../node_modules/.pnpm/@jsr_std__assert@0.226.0/node_modules/@jsr/std__assert/assert_rejects.js";
15
15
  import { mockDocumentLoader } from "../testing/docloader.js";
16
16
  import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../testing/keys.js";
17
- import { install, mock, uninstall } from "../node_modules/.pnpm/@jsr_hongminhee__deno-mock-fetch@0.3.2/node_modules/@jsr/hongminhee__deno-mock-fetch/mod.js";
17
+ import { esm_default } from "../node_modules/.pnpm/fetch-mock@12.5.2/node_modules/fetch-mock/dist/esm/index.js";
18
18
 
19
19
  //#region federation/send.test.ts
20
20
  test("extractInboxes()", () => {
@@ -129,12 +129,12 @@ test("extractInboxes()", () => {
129
129
  });
130
130
  });
131
131
  test("sendActivity()", async (t) => {
132
- install();
132
+ esm_default.spyGlobal();
133
133
  let httpSigVerified = null;
134
134
  let request = null;
135
- mock("POST@/inbox", async (req) => {
135
+ esm_default.post("https://example.com/inbox", async (cl) => {
136
136
  httpSigVerified = false;
137
- request = req.clone();
137
+ request = cl.request.clone();
138
138
  const options = {
139
139
  documentLoader: mockDocumentLoader,
140
140
  contextLoader: mockDocumentLoader
@@ -185,11 +185,9 @@ test("sendActivity()", async (t) => {
185
185
  assertEquals(request?.url, "https://example.com/inbox");
186
186
  assertEquals(request?.headers.get("Content-Type"), "application/activity+json");
187
187
  });
188
- mock("POST@/inbox2", (_req) => {
189
- return new Response("something went wrong", {
190
- status: 500,
191
- statusText: "Internal Server Error"
192
- });
188
+ esm_default.post("https://example.com/inbox2", {
189
+ status: 500,
190
+ body: "something went wrong"
193
191
  });
194
192
  await t.step("failure", async () => {
195
193
  const activity = {
@@ -208,7 +206,7 @@ test("sendActivity()", async (t) => {
208
206
  inbox: new URL("https://example.com/inbox2")
209
207
  }), Error, "Failed to send activity https://example.com/activity to https://example.com/inbox2 (500 Internal Server Error):\nsomething went wrong");
210
208
  });
211
- uninstall();
209
+ esm_default.hardReset();
212
210
  });
213
211
 
214
212
  //#endregion
@@ -3,14 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
5
  //#region node_modules/.pnpm/@jsr+std__path@1.0.9/node_modules/@jsr/std__path/_common/constants.js
6
- const CHAR_UPPERCASE_A = 65;
7
- const CHAR_LOWERCASE_A = 97;
8
- const CHAR_UPPERCASE_Z = 90;
9
- const CHAR_LOWERCASE_Z = 122;
10
6
  const CHAR_DOT = 46;
11
7
  const CHAR_FORWARD_SLASH = 47;
12
- const CHAR_BACKWARD_SLASH = 92;
13
- const CHAR_COLON = 58;
14
8
 
15
9
  //#endregion
16
- export { CHAR_BACKWARD_SLASH, CHAR_COLON, CHAR_DOT, CHAR_FORWARD_SLASH, CHAR_LOWERCASE_A, CHAR_LOWERCASE_Z, CHAR_UPPERCASE_A, CHAR_UPPERCASE_Z };
10
+ export { CHAR_DOT, CHAR_FORWARD_SLASH };
@@ -11,4 +11,4 @@ function assertArg(path) {
11
11
  }
12
12
 
13
13
  //#endregion
14
- export { assertArg as assertArg$1 };
14
+ export { assertArg as assertArg$2 };
@@ -11,4 +11,4 @@ function assertArg(path) {
11
11
  }
12
12
 
13
13
  //#endregion
14
- export { assertArg as assertArg$2 };
14
+ export { assertArg as assertArg$1 };
@@ -1,35 +1,4 @@
1
1
 
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { isWindows } from "./_os.js";
6
- import { dirname$1 as dirname } from "./posix/dirname.js";
7
- import { dirname$2 as dirname$1 } from "./windows/dirname.js";
8
-
9
- //#region node_modules/.pnpm/@jsr+std__path@1.0.9/node_modules/@jsr/std__path/dirname.js
10
- /**
11
- * Return the directory path of a path.
12
- *
13
- * @example Usage
14
- * ```ts
15
- * import { dirname } from "@std/path/dirname";
16
- * import { assertEquals } from "@std/assert";
17
- *
18
- * if (Deno.build.os === "windows") {
19
- * assertEquals(dirname("C:\\home\\user\\Documents\\image.png"), "C:\\home\\user\\Documents");
20
- * } else {
21
- * assertEquals(dirname("/home/user/Documents/image.png"), "/home/user/Documents");
22
- * }
23
- * ```
24
- *
25
- * Note: If you are working with file URLs,
26
- * use the new version of `dirname` from `@std/path/unstable-dirname`.
27
- *
28
- * @param path Path to extract the directory from.
29
- * @returns The directory path.
30
- */ function dirname$2(path) {
31
- return isWindows ? dirname$1(path) : dirname(path);
32
- }
33
-
34
- //#endregion
35
- export { dirname$2 as dirname };
4
+
@@ -1,35 +1,4 @@
1
1
 
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { isWindows } from "./_os.js";
6
- import { join$1 as join } from "./posix/join.js";
7
- import { join$2 as join$1 } from "./windows/join.js";
8
-
9
- //#region node_modules/.pnpm/@jsr+std__path@1.0.9/node_modules/@jsr/std__path/join.js
10
- /**
11
- * Joins a sequence of paths, then normalizes the resulting path.
12
- *
13
- * @example Usage
14
- * ```ts
15
- * import { join } from "@std/path/join";
16
- * import { assertEquals } from "@std/assert";
17
- *
18
- * if (Deno.build.os === "windows") {
19
- * assertEquals(join("C:\\foo", "bar", "baz\\quux", "garply", ".."), "C:\\foo\\bar\\baz\\quux");
20
- * } else {
21
- * assertEquals(join("/foo", "bar", "baz/quux", "garply", ".."), "/foo/bar/baz/quux");
22
- * }
23
- * ```
24
- *
25
- * Note: If you are working with file URLs,
26
- * use the new version of `join` from `@std/path/unstable-join`.
27
- *
28
- * @param paths Paths to be joined and normalized.
29
- * @returns The joined and normalized path.
30
- */ function join$2(...paths) {
31
- return isWindows ? join$1(...paths) : join(...paths);
32
- }
33
-
34
- //#endregion
35
- export { join$2 as join };
4
+
@@ -2,6 +2,4 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { dirname } from "./dirname.js";
6
5
  import { fromFileUrl } from "./from_file_url.js";
7
- import { join } from "./join.js";
@@ -10,4 +10,4 @@ function isPosixPathSeparator(code) {
10
10
  }
11
11
 
12
12
  //#endregion
13
- export { isPosixPathSeparator as isPosixPathSeparator$1 };
13
+ export { isPosixPathSeparator };
@@ -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$1 as isPosixPathSeparator } from "./_util.js";
7
- import { assertArg$1 as assertArg } from "../_common/dirname.js";
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
  /**
@@ -2,8 +2,8 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { isPosixPathSeparator$1 as isPosixPathSeparator } from "./_util.js";
6
- import { assertArg$2 as assertArg } from "../_common/normalize.js";
5
+ import { isPosixPathSeparator } from "./_util.js";
6
+ import { assertArg$1 as assertArg } from "../_common/normalize.js";
7
7
  import { normalizeString } from "../_common/normalize_string.js";
8
8
 
9
9
  //#region node_modules/.pnpm/@jsr+std__path@1.0.9/node_modules/@jsr/std__path/posix/normalize.js
@@ -35,4 +35,4 @@ import { strip } from "./_strip.js";
35
35
  }
36
36
 
37
37
  //#endregion
38
- export { dirname$1 as dirname$3 };
38
+ export { dirname$1 as dirname };
@@ -33,4 +33,4 @@ import { join$1 as join } from "../../../../@jsr_std__path@1.0.9/node_modules/@j
33
33
  }
34
34
 
35
35
  //#endregion
36
- export { join$1 as join$3 };
36
+ export { join$1 as join };
@@ -0,0 +1,68 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+
5
+ //#region node_modules/.pnpm/dequal@2.0.3/node_modules/dequal/dist/index.mjs
6
+ var has = Object.prototype.hasOwnProperty;
7
+ function find(iter, tar, key) {
8
+ for (key of iter.keys()) if (dequal(key, tar)) return key;
9
+ }
10
+ function dequal(foo, bar) {
11
+ var ctor, len, tmp;
12
+ if (foo === bar) return true;
13
+ if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
14
+ if (ctor === Date) return foo.getTime() === bar.getTime();
15
+ if (ctor === RegExp) return foo.toString() === bar.toString();
16
+ if (ctor === Array) {
17
+ if ((len = foo.length) === bar.length) while (len-- && dequal(foo[len], bar[len]));
18
+ return len === -1;
19
+ }
20
+ if (ctor === Set) {
21
+ if (foo.size !== bar.size) return false;
22
+ for (len of foo) {
23
+ tmp = len;
24
+ if (tmp && typeof tmp === "object") {
25
+ tmp = find(bar, tmp);
26
+ if (!tmp) return false;
27
+ }
28
+ if (!bar.has(tmp)) return false;
29
+ }
30
+ return true;
31
+ }
32
+ if (ctor === Map) {
33
+ if (foo.size !== bar.size) return false;
34
+ for (len of foo) {
35
+ tmp = len[0];
36
+ if (tmp && typeof tmp === "object") {
37
+ tmp = find(bar, tmp);
38
+ if (!tmp) return false;
39
+ }
40
+ if (!dequal(len[1], bar.get(tmp))) return false;
41
+ }
42
+ return true;
43
+ }
44
+ if (ctor === ArrayBuffer) {
45
+ foo = new Uint8Array(foo);
46
+ bar = new Uint8Array(bar);
47
+ } else if (ctor === DataView) {
48
+ if ((len = foo.byteLength) === bar.byteLength) while (len-- && foo.getInt8(len) === bar.getInt8(len));
49
+ return len === -1;
50
+ }
51
+ if (ArrayBuffer.isView(foo)) {
52
+ if ((len = foo.byteLength) === bar.byteLength) while (len-- && foo[len] === bar[len]);
53
+ return len === -1;
54
+ }
55
+ if (!ctor || typeof foo === "object") {
56
+ len = 0;
57
+ for (ctor in foo) {
58
+ if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
59
+ if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
60
+ }
61
+ return Object.keys(bar).length === len;
62
+ }
63
+ }
64
+ return foo !== foo && bar !== bar;
65
+ }
66
+
67
+ //#endregion
68
+ export { dequal };