@fedify/vocab 2.4.0-dev.1668 → 2.4.0-dev.1740
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 +4650 -1205
- package/dist/mod.d.cts +42 -0
- package/dist/mod.d.ts +42 -0
- package/dist/mod.js +4542 -1103
- package/dist-tests/{actor-DMHmbHBF.mjs → actor-Du_ra6Yk.mjs} +16 -9
- package/dist-tests/actor.test.mjs +15 -10
- package/dist-tests/lookup.test.mjs +4 -4
- package/dist-tests/type.test.mjs +2 -2
- package/dist-tests/{vocab-Bjwctrxn.mjs → vocab-CNiWKo57.mjs} +4542 -1103
- package/dist-tests/vocab.test.mjs +32 -2
- package/package.json +4 -4
- package/src/vocab.test.ts +36 -0
- /package/dist-tests/{type-_BlsfT3S.mjs → type-BMdjm4Eg.mjs} +0 -0
- /package/dist-tests/{utils-CQjrpUkt.mjs → utils-Df2odC27.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { A as OrderedCollectionPage, B as
|
|
4
|
-
import { t as assertInstanceOf } from "./utils-
|
|
3
|
+
import { A as OrderedCollectionPage, B as Service, C as InteractionRule, D as Note, E as Multikey, F as Proposal, G as vocab_exports, H as Tombstone, I as Question, L as QuoteAuthorization, M as Person, N as Place, O as Object$1, P as PropertyValue, R as QuoteRequest, S as InteractionPolicy, T as Measure, V as Source, _ as Follow, a as Application, b as Image, c as Create, d as Document, f as Endpoints, g as FeaturedItem, h as FeaturedCollection, i as Announce, j as Organization, k as Offer, l as CryptographicKey, m as FeatureRequest, n as Activity, o as Collection, p as FeatureAuthorization, r as Agreement, s as Commitment, t as Accept, u as Delete, v as Group, w as Link, x as Intent, y as Hashtag, z as Reject } from "./vocab-CNiWKo57.mjs";
|
|
4
|
+
import { t as assertInstanceOf } from "./utils-Df2odC27.mjs";
|
|
5
5
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
6
6
|
import { deepStrictEqual, notDeepStrictEqual, ok, rejects, throws } from "node:assert/strict";
|
|
7
7
|
import { configure, reset } from "@logtape/logtape";
|
|
@@ -249,6 +249,36 @@ test("Object.toJsonLd()", async () => {
|
|
|
249
249
|
}
|
|
250
250
|
});
|
|
251
251
|
});
|
|
252
|
+
test("Note.fromJsonLd() ignores malformed language tags", async () => {
|
|
253
|
+
const note = await Note.fromJsonLd({
|
|
254
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
255
|
+
type: "Note",
|
|
256
|
+
contentMap: {
|
|
257
|
+
invalid_tag: "Hello",
|
|
258
|
+
en: "Hi"
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
deepStrictEqual(note.contents, [new LanguageString("Hi", "en")]);
|
|
262
|
+
deepStrictEqual((await note.toJsonLd()).contentMap, { en: "Hi" });
|
|
263
|
+
});
|
|
264
|
+
test("Note.fromJsonLd() ignores malformed language tags in nested objects", async () => {
|
|
265
|
+
const note = await Note.fromJsonLd({
|
|
266
|
+
"@type": ["https://www.w3.org/ns/activitystreams#Note"],
|
|
267
|
+
"https://www.w3.org/ns/activitystreams#attachment": [{
|
|
268
|
+
"@type": ["http://schema.org#PropertyValue"],
|
|
269
|
+
"https://www.w3.org/ns/activitystreams#name": [{
|
|
270
|
+
"@value": "Malformed",
|
|
271
|
+
"@language": "invalid_tag"
|
|
272
|
+
}, {
|
|
273
|
+
"@value": "Valid",
|
|
274
|
+
"@language": "en"
|
|
275
|
+
}]
|
|
276
|
+
}]
|
|
277
|
+
});
|
|
278
|
+
deepStrictEqual(await Array.fromAsync(note.getAttachments()), [new PropertyValue({ name: new LanguageString("Valid", "en") })]);
|
|
279
|
+
const attachment = (await note.toJsonLd()).attachment;
|
|
280
|
+
deepStrictEqual(attachment.nameMap, { en: "Valid" });
|
|
281
|
+
});
|
|
252
282
|
test("Note.toJsonLd()", async () => {
|
|
253
283
|
const note = new Note({ tags: [new Hashtag({
|
|
254
284
|
name: "#Fedify",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/vocab",
|
|
3
|
-
"version": "2.4.0-dev.
|
|
3
|
+
"version": "2.4.0-dev.1740+32e9952c",
|
|
4
4
|
"homepage": "https://fedify.dev/",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"jsonld": "^9.0.0",
|
|
44
44
|
"pkijs": "^3.3.3",
|
|
45
45
|
"temporal-polyfill": "^1.0.1",
|
|
46
|
-
"@fedify/vocab-tools": "2.4.0-dev.
|
|
47
|
-
"@fedify/webfinger": "2.4.0-dev.
|
|
48
|
-
"@fedify/vocab-runtime": "2.4.0-dev.
|
|
46
|
+
"@fedify/vocab-tools": "2.4.0-dev.1740+32e9952c",
|
|
47
|
+
"@fedify/webfinger": "2.4.0-dev.1740+32e9952c",
|
|
48
|
+
"@fedify/vocab-runtime": "2.4.0-dev.1740+32e9952c"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.17.0",
|
package/src/vocab.test.ts
CHANGED
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
Organization,
|
|
59
59
|
Person,
|
|
60
60
|
Place,
|
|
61
|
+
PropertyValue,
|
|
61
62
|
Proposal,
|
|
62
63
|
Question,
|
|
63
64
|
QuoteAuthorization,
|
|
@@ -397,6 +398,41 @@ test("Object.toJsonLd()", async () => {
|
|
|
397
398
|
});
|
|
398
399
|
});
|
|
399
400
|
|
|
401
|
+
test("Note.fromJsonLd() ignores malformed language tags", async () => {
|
|
402
|
+
const note = await Note.fromJsonLd({
|
|
403
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
404
|
+
type: "Note",
|
|
405
|
+
contentMap: {
|
|
406
|
+
invalid_tag: "Hello",
|
|
407
|
+
en: "Hi",
|
|
408
|
+
},
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
deepStrictEqual(note.contents, [new LanguageString("Hi", "en")]);
|
|
412
|
+
const jsonLd = await note.toJsonLd() as Record<string, unknown>;
|
|
413
|
+
deepStrictEqual(jsonLd.contentMap, { en: "Hi" });
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
test("Note.fromJsonLd() ignores malformed language tags in nested objects", async () => {
|
|
417
|
+
const note = await Note.fromJsonLd({
|
|
418
|
+
"@type": ["https://www.w3.org/ns/activitystreams#Note"],
|
|
419
|
+
"https://www.w3.org/ns/activitystreams#attachment": [{
|
|
420
|
+
"@type": ["http://schema.org#PropertyValue"],
|
|
421
|
+
"https://www.w3.org/ns/activitystreams#name": [
|
|
422
|
+
{ "@value": "Malformed", "@language": "invalid_tag" },
|
|
423
|
+
{ "@value": "Valid", "@language": "en" },
|
|
424
|
+
],
|
|
425
|
+
}],
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
deepStrictEqual(await Array.fromAsync(note.getAttachments()), [
|
|
429
|
+
new PropertyValue({ name: new LanguageString("Valid", "en") }),
|
|
430
|
+
]);
|
|
431
|
+
const jsonLd = await note.toJsonLd() as Record<string, unknown>;
|
|
432
|
+
const attachment = jsonLd.attachment as Record<string, unknown>;
|
|
433
|
+
deepStrictEqual(attachment.nameMap, { en: "Valid" });
|
|
434
|
+
});
|
|
435
|
+
|
|
400
436
|
test("Note.toJsonLd()", async () => {
|
|
401
437
|
const note = new Note({
|
|
402
438
|
tags: [
|
|
File without changes
|
|
File without changes
|