@fedify/vocab 2.4.5-dev.2453 → 2.4.5
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/deno.json +1 -1
- package/dist/mod.cjs +80 -3
- package/dist/mod.d.cts +75 -0
- package/dist/mod.d.ts +75 -0
- package/dist/mod.js +80 -3
- package/dist-tests/{actor-BejKRRoq.mjs → actor-BWv7I2WQ.mjs} +6 -4
- package/dist-tests/actor.test.mjs +4 -3
- package/dist-tests/{esm-B55wgjAT.mjs → esm-BIqRhjGA.mjs} +1 -1
- package/dist-tests/gateway.test.mjs +4 -4
- package/dist-tests/{lookup-Bhab3PNj.mjs → lookup---G_JdKW.mjs} +2 -2
- package/dist-tests/lookup.test.mjs +35 -15
- package/dist-tests/portable-lookup.test.mjs +52 -13
- package/dist-tests/rolldown-runtime-BWJg4WE8.mjs +37 -0
- package/dist-tests/signed-representation.test.mjs +1 -1
- package/dist-tests/translation.test.mjs +3 -3
- package/dist-tests/type.test.mjs +1 -1
- package/dist-tests/undici-D88PC0XH.mjs +22898 -0
- package/dist-tests/{vocab-mc4pgfni.mjs → vocab-S9K4rFgH.mjs} +77 -34
- package/dist-tests/vocab.test.mjs +6064 -8
- package/package.json +5 -5
- package/src/actor.ts +4 -0
- package/src/gateway.test.ts +1 -1
- package/src/lookup.test.ts +37 -11
- package/src/portable-lookup.test.ts +72 -7
- package/src/vocab.test.ts +40 -5
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as lookupObject } from "./lookup
|
|
3
|
+
import { t as esm_default } from "./esm-BIqRhjGA.mjs";
|
|
4
|
+
import { n as getActorHandle } from "./actor-BWv7I2WQ.mjs";
|
|
5
|
+
import { F as Person } from "./vocab-S9K4rFgH.mjs";
|
|
6
|
+
import { t as lookupObject } from "./lookup---G_JdKW.mjs";
|
|
7
7
|
import { t as assertInstanceOf } from "./utils-Df2odC27.mjs";
|
|
8
8
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
9
9
|
import { deepStrictEqual, equal, rejects } from "node:assert/strict";
|
|
10
10
|
import { FetchError, parseIri } from "@fedify/vocab-runtime";
|
|
11
11
|
//#region src/portable-lookup.test.ts
|
|
12
|
+
const allowPrivateAddress = { allowPrivateAddress: true };
|
|
12
13
|
const did = "did:key:z6Mkabc";
|
|
13
14
|
const actorId = `ap+ef61://${did}/actor`;
|
|
14
15
|
const gatewayPath = `/.well-known/apgateway/${did}/actor`;
|
|
@@ -72,6 +73,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
72
73
|
const actor = await lookupObject("@alice@example.com", {
|
|
73
74
|
documentLoader,
|
|
74
75
|
contextLoader: mockDocumentLoader,
|
|
76
|
+
...allowPrivateAddress,
|
|
75
77
|
verifyPortableObject
|
|
76
78
|
});
|
|
77
79
|
assertInstanceOf(actor, Person);
|
|
@@ -94,6 +96,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
94
96
|
assertInstanceOf(await lookupObject("@alice@example.com", {
|
|
95
97
|
documentLoader,
|
|
96
98
|
contextLoader: mockDocumentLoader,
|
|
99
|
+
...allowPrivateAddress,
|
|
97
100
|
verifyPortableObject: createVerifier()
|
|
98
101
|
}), Person);
|
|
99
102
|
deepStrictEqual(documentLoader.fetched, [compatibleId, hinted]);
|
|
@@ -106,6 +109,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
106
109
|
assertInstanceOf(await lookupObject("@alice@example.com", {
|
|
107
110
|
documentLoader,
|
|
108
111
|
contextLoader: mockDocumentLoader,
|
|
112
|
+
...allowPrivateAddress,
|
|
109
113
|
verifyPortableObject: createVerifier(),
|
|
110
114
|
gateways: ["https://second.example"]
|
|
111
115
|
}), Person);
|
|
@@ -118,6 +122,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
118
122
|
equal(await lookupObject("@alice@example.com", {
|
|
119
123
|
documentLoader,
|
|
120
124
|
contextLoader: mockDocumentLoader,
|
|
125
|
+
...allowPrivateAddress,
|
|
121
126
|
verifyPortableObject: createVerifier(),
|
|
122
127
|
gateways: Array.from({ length: 6 }, (_, i) => `https://g${i}.example`)
|
|
123
128
|
}), null);
|
|
@@ -136,6 +141,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
136
141
|
assertInstanceOf(await lookupObject("@alice@example.com", {
|
|
137
142
|
documentLoader,
|
|
138
143
|
contextLoader: mockDocumentLoader,
|
|
144
|
+
...allowPrivateAddress,
|
|
139
145
|
verifyPortableObject: createVerifier()
|
|
140
146
|
}), Person);
|
|
141
147
|
deepStrictEqual(documentLoader.fetched, [compatibleId, other]);
|
|
@@ -149,6 +155,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
149
155
|
const actor = await lookupObject("@alice@example.com", {
|
|
150
156
|
documentLoader,
|
|
151
157
|
contextLoader: mockDocumentLoader,
|
|
158
|
+
...allowPrivateAddress,
|
|
152
159
|
verifyPortableObject
|
|
153
160
|
});
|
|
154
161
|
assertInstanceOf(actor, Person);
|
|
@@ -169,18 +176,21 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
169
176
|
equal(await lookupObject("@alice@example.com", {
|
|
170
177
|
documentLoader,
|
|
171
178
|
contextLoader: mockDocumentLoader,
|
|
179
|
+
...allowPrivateAddress,
|
|
172
180
|
verifyPortableObject
|
|
173
181
|
}), null);
|
|
174
182
|
deepStrictEqual(documentLoader.fetched, [compatibleId]);
|
|
175
183
|
await rejects(() => lookupObject("@alice@example.com", {
|
|
176
184
|
documentLoader,
|
|
177
185
|
contextLoader: mockDocumentLoader,
|
|
186
|
+
...allowPrivateAddress,
|
|
178
187
|
verifyPortableObject,
|
|
179
188
|
crossOrigin: "throw"
|
|
180
189
|
}), { name: "PortableObjectRejectedError" });
|
|
181
190
|
equal(await lookupObject("@alice@example.com", {
|
|
182
191
|
documentLoader,
|
|
183
192
|
contextLoader: mockDocumentLoader,
|
|
193
|
+
...allowPrivateAddress,
|
|
184
194
|
verifyPortableObject,
|
|
185
195
|
crossOrigin: "trust"
|
|
186
196
|
}), null);
|
|
@@ -193,17 +203,20 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
193
203
|
for (const crossOrigin of ["ignore", "trust"]) equal(await lookupObject("@alice@example.com", {
|
|
194
204
|
documentLoader,
|
|
195
205
|
contextLoader: mockDocumentLoader,
|
|
206
|
+
...allowPrivateAddress,
|
|
196
207
|
crossOrigin
|
|
197
208
|
}), null);
|
|
198
209
|
deepStrictEqual(documentLoader.fetched, [compatibleId, compatibleId]);
|
|
199
210
|
await rejects(() => lookupObject("@alice@example.com", {
|
|
200
211
|
documentLoader,
|
|
201
212
|
contextLoader: mockDocumentLoader,
|
|
213
|
+
...allowPrivateAddress,
|
|
202
214
|
crossOrigin: "throw"
|
|
203
215
|
}), /has a different origin than the document URL/);
|
|
204
216
|
const actor = await lookupObject("@alice@example.com", {
|
|
205
217
|
documentLoader: createLoader({ [compatibleId]: person(compatibleId) }),
|
|
206
|
-
contextLoader: mockDocumentLoader
|
|
218
|
+
contextLoader: mockDocumentLoader,
|
|
219
|
+
...allowPrivateAddress
|
|
207
220
|
});
|
|
208
221
|
assertInstanceOf(actor, Person);
|
|
209
222
|
deepStrictEqual(actor.id, new URL(compatibleId));
|
|
@@ -211,7 +224,8 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
211
224
|
const ordinaryLoader = createLoader({ [malformed]: person(malformed) });
|
|
212
225
|
assertInstanceOf(await lookupObject(malformed, {
|
|
213
226
|
documentLoader: ordinaryLoader,
|
|
214
|
-
contextLoader: mockDocumentLoader
|
|
227
|
+
contextLoader: mockDocumentLoader,
|
|
228
|
+
...allowPrivateAddress
|
|
215
229
|
}), Person);
|
|
216
230
|
deepStrictEqual(ordinaryLoader.fetched, [malformed]);
|
|
217
231
|
});
|
|
@@ -222,6 +236,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
222
236
|
const options = {
|
|
223
237
|
documentLoader,
|
|
224
238
|
contextLoader: mockDocumentLoader,
|
|
239
|
+
...allowPrivateAddress,
|
|
225
240
|
verifyPortableObject: createVerifier()
|
|
226
241
|
};
|
|
227
242
|
equal(await lookupObject("@alice@example.com", options), null);
|
|
@@ -235,6 +250,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
235
250
|
const options = {
|
|
236
251
|
documentLoader,
|
|
237
252
|
contextLoader: mockDocumentLoader,
|
|
253
|
+
...allowPrivateAddress,
|
|
238
254
|
verifyPortableObject: createVerifier()
|
|
239
255
|
};
|
|
240
256
|
equal(await lookupObject(dotted, options), null);
|
|
@@ -250,6 +266,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
250
266
|
equal(await lookupObject("@alice@example.com", {
|
|
251
267
|
documentLoader,
|
|
252
268
|
contextLoader: mockDocumentLoader,
|
|
269
|
+
...allowPrivateAddress,
|
|
253
270
|
verifyPortableObject: createVerifier()
|
|
254
271
|
}), null);
|
|
255
272
|
deepStrictEqual(documentLoader.fetched, [compatibleId, ...[
|
|
@@ -271,6 +288,7 @@ test("lookupObject() with FEP-ef61 portable actors", {
|
|
|
271
288
|
equal(await lookupObject("@alice@example.com", {
|
|
272
289
|
documentLoader,
|
|
273
290
|
contextLoader: mockDocumentLoader,
|
|
291
|
+
...allowPrivateAddress,
|
|
274
292
|
verifyPortableObject,
|
|
275
293
|
signal: controller.signal
|
|
276
294
|
}), null);
|
|
@@ -405,12 +423,18 @@ test("getActorHandle() with FEP-ef61 portable actors", {
|
|
|
405
423
|
await t.step("verified through the first gateway", async () => {
|
|
406
424
|
esm_default.removeRoutes();
|
|
407
425
|
esm_default.get("https://example.com/.well-known/webfinger?resource=acct%3Aalice%40example.com", selfLinks(compatibleId));
|
|
408
|
-
deepStrictEqual(await getActorHandle(actor
|
|
426
|
+
deepStrictEqual(await getActorHandle(actor, {
|
|
427
|
+
...allowPrivateAddress,
|
|
428
|
+
userAgent: void 0
|
|
429
|
+
}), "@alice@example.com");
|
|
409
430
|
});
|
|
410
431
|
await t.step("canonical self link", async () => {
|
|
411
432
|
esm_default.removeRoutes();
|
|
412
433
|
esm_default.get(webFingerPrefix, selfLinks(`ap://${did}/actor`));
|
|
413
|
-
deepStrictEqual(await getActorHandle(actor
|
|
434
|
+
deepStrictEqual(await getActorHandle(actor, {
|
|
435
|
+
...allowPrivateAddress,
|
|
436
|
+
userAgent: void 0
|
|
437
|
+
}), "@alice@example.com");
|
|
414
438
|
});
|
|
415
439
|
await t.step("follows a verified subject", async () => {
|
|
416
440
|
esm_default.removeRoutes();
|
|
@@ -422,14 +446,20 @@ test("getActorHandle() with FEP-ef61 portable actors", {
|
|
|
422
446
|
...selfLinks(compatibleId),
|
|
423
447
|
subject: "acct:alice@example.org"
|
|
424
448
|
});
|
|
425
|
-
deepStrictEqual(await getActorHandle(actor
|
|
449
|
+
deepStrictEqual(await getActorHandle(actor, {
|
|
450
|
+
...allowPrivateAddress,
|
|
451
|
+
userAgent: void 0
|
|
452
|
+
}), "@alice@example.org");
|
|
426
453
|
esm_default.removeRoutes();
|
|
427
454
|
esm_default.get(webFingerPrefix, {
|
|
428
455
|
...selfLinks(compatibleId),
|
|
429
456
|
subject: "acct:alice@example.org"
|
|
430
457
|
});
|
|
431
458
|
esm_default.get("begin:https://example.org/.well-known/webfinger", selfLinks(`ap://${did}/other`));
|
|
432
|
-
deepStrictEqual(await getActorHandle(actor
|
|
459
|
+
deepStrictEqual(await getActorHandle(actor, {
|
|
460
|
+
...allowPrivateAddress,
|
|
461
|
+
userAgent: void 0
|
|
462
|
+
}), "@alice@example.com");
|
|
433
463
|
});
|
|
434
464
|
await t.step("rejects a WebFinger response for another actor", async () => {
|
|
435
465
|
for (const jrd of [
|
|
@@ -442,13 +472,19 @@ test("getActorHandle() with FEP-ef61 portable actors", {
|
|
|
442
472
|
]) {
|
|
443
473
|
esm_default.removeRoutes();
|
|
444
474
|
esm_default.get(webFingerPrefix, jrd);
|
|
445
|
-
await rejects(() => getActorHandle(actor
|
|
475
|
+
await rejects(() => getActorHandle(actor, {
|
|
476
|
+
...allowPrivateAddress,
|
|
477
|
+
userAgent: void 0
|
|
478
|
+
}), TypeError);
|
|
446
479
|
}
|
|
447
480
|
});
|
|
448
481
|
await t.step("does not fall back when WebFinger fails", async () => {
|
|
449
482
|
esm_default.removeRoutes();
|
|
450
483
|
esm_default.get(webFingerPrefix, 404);
|
|
451
|
-
await rejects(() => getActorHandle(actor
|
|
484
|
+
await rejects(() => getActorHandle(actor, {
|
|
485
|
+
...allowPrivateAddress,
|
|
486
|
+
userAgent: void 0
|
|
487
|
+
}), TypeError);
|
|
452
488
|
});
|
|
453
489
|
await t.step("not enough information", async () => {
|
|
454
490
|
esm_default.removeRoutes();
|
|
@@ -463,7 +499,10 @@ test("getActorHandle() with FEP-ef61 portable actors", {
|
|
|
463
499
|
id: parseIri(actorId),
|
|
464
500
|
gateways: [new URL("https://example.com")]
|
|
465
501
|
})
|
|
466
|
-
]) await rejects(() => getActorHandle(target
|
|
502
|
+
]) await rejects(() => getActorHandle(target, {
|
|
503
|
+
...allowPrivateAddress,
|
|
504
|
+
userAgent: void 0
|
|
505
|
+
}), TypeError);
|
|
467
506
|
deepStrictEqual(esm_default.callHistory.calls().length, 0);
|
|
468
507
|
});
|
|
469
508
|
} finally {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "temporal-polyfill";
|
|
2
|
+
globalThis.addEventListener = () => {};
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
//#region \0rolldown/runtime.js
|
|
5
|
+
var __create = Object.create;
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
12
|
+
var __exportAll = (all, no_symbols) => {
|
|
13
|
+
let target = {};
|
|
14
|
+
for (var name in all) __defProp(target, name, {
|
|
15
|
+
get: all[name],
|
|
16
|
+
enumerable: true
|
|
17
|
+
});
|
|
18
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
23
|
+
key = keys[i];
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
25
|
+
get: ((k) => from[k]).bind(null, key),
|
|
26
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
32
|
+
value: mod,
|
|
33
|
+
enumerable: true
|
|
34
|
+
}) : target, mod));
|
|
35
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
36
|
+
//#endregion
|
|
37
|
+
export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { M as OrderedCollection, X as vocab_exports, i as Announce, k as Note, u as Create, z as Question } from "./vocab-
|
|
3
|
+
import { M as OrderedCollection, X as vocab_exports, i as Announce, k as Note, u as Create, z as Question } from "./vocab-S9K4rFgH.mjs";
|
|
4
4
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
5
5
|
import { deepStrictEqual, ok } from "node:assert/strict";
|
|
6
6
|
import { isMarkerSafeContext, retainSignedRepresentation } from "@fedify/vocab-runtime/internal/signed-representation";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import "./lookup
|
|
3
|
+
import "./actor-BWv7I2WQ.mjs";
|
|
4
|
+
import { A as Object$1, E as Link, F as Person, K as Translation, L as PropertyValue, P as Organization, U as Service, a as Application, b as Group, k as Note, o as Article, q as Update, s as Collection, u as Create } from "./vocab-S9K4rFgH.mjs";
|
|
5
|
+
import "./lookup---G_JdKW.mjs";
|
|
6
6
|
import { test } from "@fedify/fixture";
|
|
7
7
|
import { deepStrictEqual, ok, rejects } from "node:assert/strict";
|
|
8
8
|
import { LanguageString as LanguageString$1, getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
|
package/dist-tests/type.test.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { E as Link, F as Person, J as getEntityTypeById, Y as isEntityType } from "./vocab-mc4pgfni.mjs";
|
|
4
3
|
import { t as getTypeId } from "./type-BMdjm4Eg.mjs";
|
|
4
|
+
import { E as Link, F as Person, J as getEntityTypeById, Y as isEntityType } from "./vocab-S9K4rFgH.mjs";
|
|
5
5
|
import { test } from "@fedify/fixture";
|
|
6
6
|
import { deepStrictEqual } from "node:assert/strict";
|
|
7
7
|
//#region src/type.test.ts
|