@fedify/vocab 2.0.36-dev.2530 → 2.0.36-dev.2551

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.0.36-dev.2530+fb03bc56",
3
+ "version": "2.0.36-dev.2551+8b012df4",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts"
package/dist/mod.cjs CHANGED
@@ -33,7 +33,7 @@ let _fedify_vocab_runtime_temporal = require("@fedify/vocab-runtime/temporal");
33
33
  let es_toolkit = require("es-toolkit");
34
34
  //#region deno.json
35
35
  var name = "@fedify/vocab";
36
- var version = "2.0.36-dev.2530+fb03bc56";
36
+ var version = "2.0.36-dev.2551+8b012df4";
37
37
  //#endregion
38
38
  //#region src/type.ts
39
39
  function getTypeId(object) {
package/dist/mod.js CHANGED
@@ -9,7 +9,7 @@ import { isTemporalDuration, isTemporalInstant, normalizeDateTimeLiteral } from
9
9
  import { delay } from "es-toolkit";
10
10
  //#region deno.json
11
11
  var name = "@fedify/vocab";
12
- var version = "2.0.36-dev.2530+fb03bc56";
12
+ var version = "2.0.36-dev.2551+8b012df4";
13
13
  //#endregion
14
14
  //#region src/type.ts
15
15
  function getTypeId(object) {
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
3
  import { b as Service, g as Person, h as Organization, i as Application, l as Group, w as __exportAll } from "./vocab-ZYaaH8Qo.mjs";
4
- import { n as version, r as esm_default, t as name } from "./deno-B05_iH_G.mjs";
4
+ import { n as version, r as esm_default, t as name } from "./deno-DYlqMVqL.mjs";
5
5
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
6
6
  import { test } from "@fedify/fixture";
7
7
  import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
@@ -1204,6 +1204,6 @@ var esm_default = new class FetchMock {
1204
1204
  //#endregion
1205
1205
  //#region deno.json
1206
1206
  var name = "@fedify/vocab";
1207
- var version = "2.0.36-dev.2530+fb03bc56";
1207
+ var version = "2.0.36-dev.2551+8b012df4";
1208
1208
  //#endregion
1209
1209
  export { version as n, esm_default as r, name as t };
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  globalThis.addEventListener = () => {};
3
3
  import { a as Collection, f as Note, g as Person, p as Object$1 } from "./vocab-ZYaaH8Qo.mjs";
4
- import { n as version, r as esm_default, t as name } from "./deno-B05_iH_G.mjs";
4
+ import { n as version, r as esm_default, t as name } from "./deno-DYlqMVqL.mjs";
5
5
  import { t as getTypeId } from "./type-Cf-vxmre.mjs";
6
6
  import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
7
7
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -1691,14 +1691,29 @@ test("Note.fromJsonLd() accepts date-times without seconds", async () => {
1691
1691
  ["2024-01-01T10:00.5+09:00", "2024-01-01T01:00:00.5Z"],
1692
1692
  ["2024-01-01T10:00.5-05:00", "2024-01-01T15:00:00.5Z"],
1693
1693
  ["2024-01-01T10:00.5", "2024-01-01T10:00:00.5Z"]
1694
- ]) deepStrictEqual((await Note.fromJsonLd({
1694
+ ]) strictEqual((await Note.fromJsonLd({
1695
1695
  "@context": "https://www.w3.org/ns/activitystreams",
1696
1696
  type: "Note",
1697
1697
  published
1698
1698
  }, {
1699
1699
  documentLoader: mockDocumentLoader,
1700
1700
  contextLoader: mockDocumentLoader
1701
- })).published, Temporal.Instant.from(expected));
1701
+ })).published?.toString(), Temporal.Instant.from(expected).toString());
1702
+ });
1703
+ test("Question.fromJsonLd() decodes closed values without seconds", async () => {
1704
+ const parse = (closed) => Question.fromJsonLd({
1705
+ "@context": "https://www.w3.org/ns/activitystreams",
1706
+ type: "Question",
1707
+ closed
1708
+ }, {
1709
+ documentLoader: mockDocumentLoader,
1710
+ contextLoader: mockDocumentLoader
1711
+ });
1712
+ for (const [closed, expected] of [["2024-01-01T10:00.5Z", "2024-01-01T10:00:00.5Z"], ["2024-01-01T10:00.5+09:00", "2024-01-01T01:00:00.5Z"]]) strictEqual((await parse(closed)).closed?.toString(), Temporal.Instant.from(expected).toString());
1713
+ await rejects(() => parse("2024-02-31T10:00.5Z"), RangeError);
1714
+ await rejects(() => parse("Sat, 01 Jan 2024 10:00:00 GMT"), RangeError);
1715
+ strictEqual((await parse(true)).closed, true);
1716
+ strictEqual((await parse("not a date")).closed, null);
1702
1717
  });
1703
1718
  test("Note.fromJsonLd() rejects date-times that Temporal cannot parse", async () => {
1704
1719
  await rejects(() => Note.fromJsonLd({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab",
3
- "version": "2.0.36-dev.2530+fb03bc56",
3
+ "version": "2.0.36-dev.2551+8b012df4",
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/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"
49
+ "@fedify/vocab-tools": "2.0.36-dev.2551+8b012df4",
50
+ "@fedify/webfinger": "2.0.36-dev.2551+8b012df4",
51
+ "@fedify/vocab-runtime": "2.0.36-dev.2551+8b012df4"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^22.17.0",
package/src/vocab.test.ts CHANGED
@@ -2620,8 +2620,39 @@ test("Note.fromJsonLd() accepts date-times without seconds", async () => {
2620
2620
  documentLoader: mockDocumentLoader,
2621
2621
  contextLoader: mockDocumentLoader,
2622
2622
  });
2623
- deepStrictEqual(note.published, Temporal.Instant.from(expected));
2623
+ // deepStrictEqual() cannot tell Temporal.Instant values apart.
2624
+ strictEqual(
2625
+ note.published?.toString(),
2626
+ Temporal.Instant.from(expected).toString(),
2627
+ );
2628
+ }
2629
+ });
2630
+
2631
+ test("Question.fromJsonLd() decodes closed values without seconds", async () => {
2632
+ const parse = (closed: string | boolean) =>
2633
+ Question.fromJsonLd({
2634
+ "@context": "https://www.w3.org/ns/activitystreams",
2635
+ type: "Question",
2636
+ closed,
2637
+ }, {
2638
+ documentLoader: mockDocumentLoader,
2639
+ contextLoader: mockDocumentLoader,
2640
+ });
2641
+ const cases: readonly (readonly [string, string])[] = [
2642
+ ["2024-01-01T10:00.5Z", "2024-01-01T10:00:00.5Z"],
2643
+ ["2024-01-01T10:00.5+09:00", "2024-01-01T01:00:00.5Z"],
2644
+ ];
2645
+ for (const [closed, expected] of cases) {
2646
+ const question = await parse(closed);
2647
+ strictEqual(
2648
+ question.closed?.toString(),
2649
+ Temporal.Instant.from(expected).toString(),
2650
+ );
2624
2651
  }
2652
+ await rejects(() => parse("2024-02-31T10:00.5Z"), RangeError);
2653
+ await rejects(() => parse("Sat, 01 Jan 2024 10:00:00 GMT"), RangeError);
2654
+ strictEqual((await parse(true)).closed, true);
2655
+ strictEqual((await parse("not a date")).closed, null);
2625
2656
  });
2626
2657
 
2627
2658
  test("Note.fromJsonLd() rejects date-times that Temporal cannot parse", async () => {