@fedify/vocab 2.0.35 → 2.0.36-dev.2530
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 +192 -192
- package/dist/mod.js +193 -193
- package/dist-tests/actor.test.mjs +2 -2
- package/dist-tests/{deno-BaFTaH7L.mjs → deno-B05_iH_G.mjs} +2 -2
- package/dist-tests/lookup.test.mjs +2 -2
- package/dist-tests/type.test.mjs +1 -1
- package/dist-tests/{vocab-4POt9BSw.mjs → vocab-ZYaaH8Qo.mjs} +192 -192
- package/dist-tests/vocab.test.mjs +30 -1
- package/package.json +4 -4
- package/src/vocab.test.ts +39 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { S as vocab_exports, _ as Place, a as Collection, c as Follow, d as Link, f as Note, g as Person, m as OrderedCollectionPage, n as Activity, o as Create, p as Object$1, r as Announce, s as CryptographicKey, t as Accept, u as Hashtag, v as PropertyValue, x as Source, y as Question } from "./vocab-
|
|
3
|
+
import { S as vocab_exports, _ as Place, a as Collection, c as Follow, d as Link, f as Note, g as Person, m as OrderedCollectionPage, n as Activity, o as Create, p as Object$1, r as Announce, s as CryptographicKey, t as Accept, u as Hashtag, v as PropertyValue, x as Source, y as Question } from "./vocab-ZYaaH8Qo.mjs";
|
|
4
4
|
import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
|
|
5
5
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
6
6
|
import { deepStrictEqual, notDeepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
|
|
@@ -1681,5 +1681,34 @@ for (const typeUri in types) {
|
|
|
1681
1681
|
deepStrictEqual(cls.typeId, new URL(type.uri));
|
|
1682
1682
|
});
|
|
1683
1683
|
}
|
|
1684
|
+
test("Note.fromJsonLd() accepts date-times without seconds", async () => {
|
|
1685
|
+
for (const [published, expected] of [
|
|
1686
|
+
["2024-01-01T10:00Z", "2024-01-01T10:00:00Z"],
|
|
1687
|
+
["2024-01-01T10:00+09:00", "2024-01-01T01:00:00Z"],
|
|
1688
|
+
["2024-01-01T10:00-05:00", "2024-01-01T15:00:00Z"],
|
|
1689
|
+
["2024-01-01T10:00", "2024-01-01T10:00:00Z"],
|
|
1690
|
+
["2024-01-01T10:00.5Z", "2024-01-01T10:00:00.5Z"],
|
|
1691
|
+
["2024-01-01T10:00.5+09:00", "2024-01-01T01:00:00.5Z"],
|
|
1692
|
+
["2024-01-01T10:00.5-05:00", "2024-01-01T15:00:00.5Z"],
|
|
1693
|
+
["2024-01-01T10:00.5", "2024-01-01T10:00:00.5Z"]
|
|
1694
|
+
]) deepStrictEqual((await Note.fromJsonLd({
|
|
1695
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
1696
|
+
type: "Note",
|
|
1697
|
+
published
|
|
1698
|
+
}, {
|
|
1699
|
+
documentLoader: mockDocumentLoader,
|
|
1700
|
+
contextLoader: mockDocumentLoader
|
|
1701
|
+
})).published, Temporal.Instant.from(expected));
|
|
1702
|
+
});
|
|
1703
|
+
test("Note.fromJsonLd() rejects date-times that Temporal cannot parse", async () => {
|
|
1704
|
+
await rejects(() => Note.fromJsonLd({
|
|
1705
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
1706
|
+
type: "Note",
|
|
1707
|
+
published: "Sat, 01 Jan 2024 10:00:00 GMT"
|
|
1708
|
+
}, {
|
|
1709
|
+
documentLoader: mockDocumentLoader,
|
|
1710
|
+
contextLoader: mockDocumentLoader
|
|
1711
|
+
}), RangeError);
|
|
1712
|
+
});
|
|
1684
1713
|
//#endregion
|
|
1685
1714
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/vocab",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.36-dev.2530+fb03bc56",
|
|
4
4
|
"homepage": "https://fedify.dev/",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"es-toolkit": "1.43.0",
|
|
47
47
|
"jsonld": "^9.0.0",
|
|
48
48
|
"pkijs": "^3.3.3",
|
|
49
|
-
"@fedify/
|
|
50
|
-
"@fedify/
|
|
51
|
-
"@fedify/vocab-runtime": "2.0.
|
|
49
|
+
"@fedify/webfinger": "2.0.36-dev.2530+fb03bc56",
|
|
50
|
+
"@fedify/vocab-tools": "2.0.36-dev.2530+fb03bc56",
|
|
51
|
+
"@fedify/vocab-runtime": "2.0.36-dev.2530+fb03bc56"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^22.17.0",
|
package/src/vocab.test.ts
CHANGED
|
@@ -2599,3 +2599,42 @@ for (const typeUri in types) {
|
|
|
2599
2599
|
deepStrictEqual(cls.typeId, new URL(type.uri));
|
|
2600
2600
|
});
|
|
2601
2601
|
}
|
|
2602
|
+
|
|
2603
|
+
test("Note.fromJsonLd() accepts date-times without seconds", async () => {
|
|
2604
|
+
const cases: readonly (readonly [string, string])[] = [
|
|
2605
|
+
["2024-01-01T10:00Z", "2024-01-01T10:00:00Z"],
|
|
2606
|
+
["2024-01-01T10:00+09:00", "2024-01-01T01:00:00Z"],
|
|
2607
|
+
["2024-01-01T10:00-05:00", "2024-01-01T15:00:00Z"],
|
|
2608
|
+
["2024-01-01T10:00", "2024-01-01T10:00:00Z"],
|
|
2609
|
+
["2024-01-01T10:00.5Z", "2024-01-01T10:00:00.5Z"],
|
|
2610
|
+
["2024-01-01T10:00.5+09:00", "2024-01-01T01:00:00.5Z"],
|
|
2611
|
+
["2024-01-01T10:00.5-05:00", "2024-01-01T15:00:00.5Z"],
|
|
2612
|
+
["2024-01-01T10:00.5", "2024-01-01T10:00:00.5Z"],
|
|
2613
|
+
];
|
|
2614
|
+
for (const [published, expected] of cases) {
|
|
2615
|
+
const note = await Note.fromJsonLd({
|
|
2616
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
2617
|
+
type: "Note",
|
|
2618
|
+
published,
|
|
2619
|
+
}, {
|
|
2620
|
+
documentLoader: mockDocumentLoader,
|
|
2621
|
+
contextLoader: mockDocumentLoader,
|
|
2622
|
+
});
|
|
2623
|
+
deepStrictEqual(note.published, Temporal.Instant.from(expected));
|
|
2624
|
+
}
|
|
2625
|
+
});
|
|
2626
|
+
|
|
2627
|
+
test("Note.fromJsonLd() rejects date-times that Temporal cannot parse", async () => {
|
|
2628
|
+
await rejects(
|
|
2629
|
+
() =>
|
|
2630
|
+
Note.fromJsonLd({
|
|
2631
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
2632
|
+
type: "Note",
|
|
2633
|
+
published: "Sat, 01 Jan 2024 10:00:00 GMT",
|
|
2634
|
+
}, {
|
|
2635
|
+
documentLoader: mockDocumentLoader,
|
|
2636
|
+
contextLoader: mockDocumentLoader,
|
|
2637
|
+
}),
|
|
2638
|
+
RangeError,
|
|
2639
|
+
);
|
|
2640
|
+
});
|