@fedify/vocab-tools 2.3.0-dev.1069 → 2.3.0-dev.1099

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-tools",
3
- "version": "2.3.0-dev.1069+81e910ce",
3
+ "version": "2.3.0-dev.1099+fafcfa78",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts"
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "imports": {
14
14
  "@cfworker/json-schema": "npm:@cfworker/json-schema@^4.1.1",
15
- "yaml": "npm:yaml@^2.8.1"
15
+ "yaml": "npm:yaml@^2.9.0"
16
16
  },
17
17
  "exclude": [
18
18
  "dist",
package/dist/mod.cjs CHANGED
@@ -8,7 +8,7 @@ let yaml = require("yaml");
8
8
  let es_toolkit = require("es-toolkit");
9
9
  //#region deno.json
10
10
  var name = "@fedify/vocab-tools";
11
- var version = "2.3.0-dev.1069+81e910ce";
11
+ var version = "2.3.0-dev.1099+fafcfa78";
12
12
  //#endregion
13
13
  //#region src/type.ts
14
14
  const HEURISTICS_CONTEXTS = [
@@ -208,7 +208,7 @@ const scalarTypes = {
208
208
  "http://www.w3.org/2001/XMLSchema#dateTime": {
209
209
  name: "Temporal.Instant",
210
210
  typeGuard(v) {
211
- return `${v} instanceof Temporal.Instant`;
211
+ return `isTemporalInstant(${v})`;
212
212
  },
213
213
  encoder(v) {
214
214
  return `{
@@ -238,7 +238,7 @@ const scalarTypes = {
238
238
  "http://www.w3.org/2001/XMLSchema#duration": {
239
239
  name: "Temporal.Duration",
240
240
  typeGuard(v) {
241
- return `${v} instanceof Temporal.Duration`;
241
+ return `isTemporalDuration(${v})`;
242
242
  },
243
243
  encoder(v) {
244
244
  return `{
@@ -1976,6 +1976,10 @@ async function* generateClasses(types) {
1976
1976
  yield `import { type Span, SpanStatusCode, type TracerProvider, trace }
1977
1977
  from "@opentelemetry/api";\n`;
1978
1978
  yield `import {\n ${runtimeImports.join(",\n ")}\n} from "@fedify/vocab-runtime";\n`;
1979
+ yield `import {
1980
+ isTemporalDuration,
1981
+ isTemporalInstant,
1982
+ } from "@fedify/vocab-runtime/temporal";\n`;
1979
1983
  yield "\n\n";
1980
1984
  const sorted = sortTopologically(types);
1981
1985
  for (const typeUri of sorted) for await (const code of generateClass(typeUri, types)) yield code;
package/dist/mod.js CHANGED
@@ -7,7 +7,7 @@ import { parse } from "yaml";
7
7
  import { pascalCase } from "es-toolkit";
8
8
  //#region deno.json
9
9
  var name = "@fedify/vocab-tools";
10
- var version = "2.3.0-dev.1069+81e910ce";
10
+ var version = "2.3.0-dev.1099+fafcfa78";
11
11
  //#endregion
12
12
  //#region src/type.ts
13
13
  const HEURISTICS_CONTEXTS = [
@@ -207,7 +207,7 @@ const scalarTypes = {
207
207
  "http://www.w3.org/2001/XMLSchema#dateTime": {
208
208
  name: "Temporal.Instant",
209
209
  typeGuard(v) {
210
- return `${v} instanceof Temporal.Instant`;
210
+ return `isTemporalInstant(${v})`;
211
211
  },
212
212
  encoder(v) {
213
213
  return `{
@@ -237,7 +237,7 @@ const scalarTypes = {
237
237
  "http://www.w3.org/2001/XMLSchema#duration": {
238
238
  name: "Temporal.Duration",
239
239
  typeGuard(v) {
240
- return `${v} instanceof Temporal.Duration`;
240
+ return `isTemporalDuration(${v})`;
241
241
  },
242
242
  encoder(v) {
243
243
  return `{
@@ -1975,6 +1975,10 @@ async function* generateClasses(types) {
1975
1975
  yield `import { type Span, SpanStatusCode, type TracerProvider, trace }
1976
1976
  from "@opentelemetry/api";\n`;
1977
1977
  yield `import {\n ${runtimeImports.join(",\n ")}\n} from "@fedify/vocab-runtime";\n`;
1978
+ yield `import {
1979
+ isTemporalDuration,
1980
+ isTemporalInstant,
1981
+ } from "@fedify/vocab-runtime/temporal";\n`;
1978
1982
  yield "\n\n";
1979
1983
  const sorted = sortTopologically(types);
1980
1984
  for (const typeUri of sorted) for await (const code of generateClass(typeUri, types)) yield code;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-tools",
3
- "version": "2.3.0-dev.1069+81e910ce",
3
+ "version": "2.3.0-dev.1099+fafcfa78",
4
4
  "description": "Code generator for Activity Vocabulary APIs",
5
5
  "homepage": "https://fedify.dev/",
6
6
  "repository": {
@@ -50,14 +50,14 @@
50
50
  "license": "MIT",
51
51
  "devDependencies": {
52
52
  "@types/node": "^22.17.0",
53
- "tsdown": "^0.21.6",
54
- "typescript": "^5.9.2"
53
+ "tsdown": "^0.22.0",
54
+ "typescript": "^6.0.0"
55
55
  },
56
56
  "dependencies": {
57
57
  "@cfworker/json-schema": "^4.1.1",
58
58
  "byte-encodings": "^1.0.11",
59
- "es-toolkit": "^1.39.10",
60
- "yaml": "^2.8.1"
59
+ "es-toolkit": "^1.46.1",
60
+ "yaml": "^2.9.0"
61
61
  },
62
62
  "scripts": {
63
63
  "build:self": "tsdown",
@@ -22,6 +22,10 @@ import {
22
22
  parseDecimal,
23
23
  type RemoteDocument
24
24
  } from \\"@fedify/vocab-runtime\\";
25
+ import {
26
+ isTemporalDuration,
27
+ isTemporalInstant,
28
+ } from \\"@fedify/vocab-runtime/temporal\\";
25
29
 
26
30
 
27
31
  /** Describes an object of any kind. The Object type serves as the base type for
@@ -403,7 +407,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
403
407
  }
404
408
 
405
409
  if (\\"endTime\\" in values && values.endTime != null) {
406
- if (values.endTime instanceof Temporal.Instant) {
410
+ if (isTemporalInstant(values.endTime)) {
407
411
  // @ts-ignore: type is checked above.
408
412
  this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
409
413
 
@@ -635,7 +639,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
635
639
  }
636
640
 
637
641
  if (\\"published\\" in values && values.published != null) {
638
- if (values.published instanceof Temporal.Instant) {
642
+ if (isTemporalInstant(values.published)) {
639
643
  // @ts-ignore: type is checked above.
640
644
  this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
641
645
 
@@ -700,7 +704,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
700
704
  }
701
705
 
702
706
  if (\\"startTime\\" in values && values.startTime != null) {
703
- if (values.startTime instanceof Temporal.Instant) {
707
+ if (isTemporalInstant(values.startTime)) {
704
708
  // @ts-ignore: type is checked above.
705
709
  this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
706
710
 
@@ -768,7 +772,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
768
772
  }
769
773
 
770
774
  if (\\"updated\\" in values && values.updated != null) {
771
- if (values.updated instanceof Temporal.Instant) {
775
+ if (isTemporalInstant(values.updated)) {
772
776
  // @ts-ignore: type is checked above.
773
777
  this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
774
778
 
@@ -990,7 +994,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
990
994
  }
991
995
 
992
996
  if (\\"duration\\" in values && values.duration != null) {
993
- if (values.duration instanceof Temporal.Duration) {
997
+ if (isTemporalDuration(values.duration)) {
994
998
  // @ts-ignore: type is checked above.
995
999
  this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
996
1000
 
@@ -1378,7 +1382,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1378
1382
  }
1379
1383
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime;
1380
1384
  if (\\"endTime\\" in values && values.endTime != null) {
1381
- if (values.endTime instanceof Temporal.Instant) {
1385
+ if (isTemporalInstant(values.endTime)) {
1382
1386
  // @ts-ignore: type is checked above.
1383
1387
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
1384
1388
 
@@ -1616,7 +1620,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1616
1620
  }
1617
1621
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published;
1618
1622
  if (\\"published\\" in values && values.published != null) {
1619
- if (values.published instanceof Temporal.Instant) {
1623
+ if (isTemporalInstant(values.published)) {
1620
1624
  // @ts-ignore: type is checked above.
1621
1625
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
1622
1626
 
@@ -1681,7 +1685,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1681
1685
  }
1682
1686
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime;
1683
1687
  if (\\"startTime\\" in values && values.startTime != null) {
1684
- if (values.startTime instanceof Temporal.Instant) {
1688
+ if (isTemporalInstant(values.startTime)) {
1685
1689
  // @ts-ignore: type is checked above.
1686
1690
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
1687
1691
 
@@ -1750,7 +1754,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1750
1754
  }
1751
1755
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated;
1752
1756
  if (\\"updated\\" in values && values.updated != null) {
1753
- if (values.updated instanceof Temporal.Instant) {
1757
+ if (isTemporalInstant(values.updated)) {
1754
1758
  // @ts-ignore: type is checked above.
1755
1759
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
1756
1760
 
@@ -1976,7 +1980,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1976
1980
  }
1977
1981
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration;
1978
1982
  if (\\"duration\\" in values && values.duration != null) {
1979
- if (values.duration instanceof Temporal.Duration) {
1983
+ if (isTemporalDuration(values.duration)) {
1980
1984
  // @ts-ignore: type is checked above.
1981
1985
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
1982
1986
 
@@ -26702,7 +26706,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
26702
26706
  }
26703
26707
 
26704
26708
  if (\\"created\\" in values && values.created != null) {
26705
- if (values.created instanceof Temporal.Instant) {
26709
+ if (isTemporalInstant(values.created)) {
26706
26710
  // @ts-ignore: type is checked above.
26707
26711
  this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
26708
26712
 
@@ -26803,7 +26807,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
26803
26807
  }
26804
26808
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
26805
26809
  if (\\"created\\" in values && values.created != null) {
26806
- if (values.created instanceof Temporal.Instant) {
26810
+ if (isTemporalInstant(values.created)) {
26807
26811
  // @ts-ignore: type is checked above.
26808
26812
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
26809
26813
 
@@ -80846,7 +80850,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
80846
80850
  }
80847
80851
 
80848
80852
  if (\\"closed\\" in values && values.closed != null) {
80849
- if (values.closed instanceof Temporal.Instant || typeof values.closed === \\"boolean\\") {
80853
+ if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
80850
80854
  // @ts-ignore: type is checked above.
80851
80855
  this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
80852
80856
 
@@ -81001,7 +81005,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
81001
81005
  }
81002
81006
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
81003
81007
  if (\\"closed\\" in values && values.closed != null) {
81004
- if (values.closed instanceof Temporal.Instant || typeof values.closed === \\"boolean\\") {
81008
+ if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
81005
81009
  // @ts-ignore: type is checked above.
81006
81010
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
81007
81011
 
@@ -82067,7 +82071,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
82067
82071
  array = [];
82068
82072
  for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
82069
82073
  const element = (
82070
- v instanceof Temporal.Instant ? {
82074
+ isTemporalInstant(v) ? {
82071
82075
  \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\",
82072
82076
  \\"@value\\": v.toString(),
82073
82077
  } : { \\"@value\\": v }
@@ -93395,7 +93399,7 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;}
93395
93399
  }
93396
93400
 
93397
93401
  if (\\"deleted\\" in values && values.deleted != null) {
93398
- if (values.deleted instanceof Temporal.Instant) {
93402
+ if (isTemporalInstant(values.deleted)) {
93399
93403
  // @ts-ignore: type is checked above.
93400
93404
  this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
93401
93405
 
@@ -93489,7 +93493,7 @@ formerTypes?: (\$EntityType)[];deleted?: Temporal.Instant | null;}
93489
93493
  }
93490
93494
  clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
93491
93495
  if (\\"deleted\\" in values && values.deleted != null) {
93492
- if (values.deleted instanceof Temporal.Instant) {
93496
+ if (isTemporalInstant(values.deleted)) {
93493
93497
  // @ts-ignore: type is checked above.
93494
93498
  clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
93495
93499
 
@@ -20,6 +20,10 @@ import {
20
20
  parseDecimal,
21
21
  type RemoteDocument
22
22
  } from \\"@fedify/vocab-runtime\\";
23
+ import {
24
+ isTemporalDuration,
25
+ isTemporalInstant,
26
+ } from \\"@fedify/vocab-runtime/temporal\\";
23
27
 
24
28
 
25
29
  /** Describes an object of any kind. The Object type serves as the base type for
@@ -401,7 +405,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
401
405
  }
402
406
 
403
407
  if (\\"endTime\\" in values && values.endTime != null) {
404
- if (values.endTime instanceof Temporal.Instant) {
408
+ if (isTemporalInstant(values.endTime)) {
405
409
  // @ts-ignore: type is checked above.
406
410
  this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
407
411
 
@@ -633,7 +637,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
633
637
  }
634
638
 
635
639
  if (\\"published\\" in values && values.published != null) {
636
- if (values.published instanceof Temporal.Instant) {
640
+ if (isTemporalInstant(values.published)) {
637
641
  // @ts-ignore: type is checked above.
638
642
  this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
639
643
 
@@ -698,7 +702,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
698
702
  }
699
703
 
700
704
  if (\\"startTime\\" in values && values.startTime != null) {
701
- if (values.startTime instanceof Temporal.Instant) {
705
+ if (isTemporalInstant(values.startTime)) {
702
706
  // @ts-ignore: type is checked above.
703
707
  this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
704
708
 
@@ -766,7 +770,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
766
770
  }
767
771
 
768
772
  if (\\"updated\\" in values && values.updated != null) {
769
- if (values.updated instanceof Temporal.Instant) {
773
+ if (isTemporalInstant(values.updated)) {
770
774
  // @ts-ignore: type is checked above.
771
775
  this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
772
776
 
@@ -988,7 +992,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
988
992
  }
989
993
 
990
994
  if (\\"duration\\" in values && values.duration != null) {
991
- if (values.duration instanceof Temporal.Duration) {
995
+ if (isTemporalDuration(values.duration)) {
992
996
  // @ts-ignore: type is checked above.
993
997
  this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
994
998
 
@@ -1376,7 +1380,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1376
1380
  }
1377
1381
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime;
1378
1382
  if (\\"endTime\\" in values && values.endTime != null) {
1379
- if (values.endTime instanceof Temporal.Instant) {
1383
+ if (isTemporalInstant(values.endTime)) {
1380
1384
  // @ts-ignore: type is checked above.
1381
1385
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
1382
1386
 
@@ -1614,7 +1618,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1614
1618
  }
1615
1619
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published;
1616
1620
  if (\\"published\\" in values && values.published != null) {
1617
- if (values.published instanceof Temporal.Instant) {
1621
+ if (isTemporalInstant(values.published)) {
1618
1622
  // @ts-ignore: type is checked above.
1619
1623
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
1620
1624
 
@@ -1679,7 +1683,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1679
1683
  }
1680
1684
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime;
1681
1685
  if (\\"startTime\\" in values && values.startTime != null) {
1682
- if (values.startTime instanceof Temporal.Instant) {
1686
+ if (isTemporalInstant(values.startTime)) {
1683
1687
  // @ts-ignore: type is checked above.
1684
1688
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
1685
1689
 
@@ -1748,7 +1752,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1748
1752
  }
1749
1753
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated;
1750
1754
  if (\\"updated\\" in values && values.updated != null) {
1751
- if (values.updated instanceof Temporal.Instant) {
1755
+ if (isTemporalInstant(values.updated)) {
1752
1756
  // @ts-ignore: type is checked above.
1753
1757
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
1754
1758
 
@@ -1974,7 +1978,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1974
1978
  }
1975
1979
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration;
1976
1980
  if (\\"duration\\" in values && values.duration != null) {
1977
- if (values.duration instanceof Temporal.Duration) {
1981
+ if (isTemporalDuration(values.duration)) {
1978
1982
  // @ts-ignore: type is checked above.
1979
1983
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
1980
1984
 
@@ -26700,7 +26704,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
26700
26704
  }
26701
26705
 
26702
26706
  if (\\"created\\" in values && values.created != null) {
26703
- if (values.created instanceof Temporal.Instant) {
26707
+ if (isTemporalInstant(values.created)) {
26704
26708
  // @ts-ignore: type is checked above.
26705
26709
  this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
26706
26710
 
@@ -26801,7 +26805,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
26801
26805
  }
26802
26806
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
26803
26807
  if (\\"created\\" in values && values.created != null) {
26804
- if (values.created instanceof Temporal.Instant) {
26808
+ if (isTemporalInstant(values.created)) {
26805
26809
  // @ts-ignore: type is checked above.
26806
26810
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
26807
26811
 
@@ -80844,7 +80848,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
80844
80848
  }
80845
80849
 
80846
80850
  if (\\"closed\\" in values && values.closed != null) {
80847
- if (values.closed instanceof Temporal.Instant || typeof values.closed === \\"boolean\\") {
80851
+ if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
80848
80852
  // @ts-ignore: type is checked above.
80849
80853
  this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
80850
80854
 
@@ -80999,7 +81003,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
80999
81003
  }
81000
81004
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
81001
81005
  if (\\"closed\\" in values && values.closed != null) {
81002
- if (values.closed instanceof Temporal.Instant || typeof values.closed === \\"boolean\\") {
81006
+ if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
81003
81007
  // @ts-ignore: type is checked above.
81004
81008
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
81005
81009
 
@@ -82065,7 +82069,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
82065
82069
  array = [];
82066
82070
  for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
82067
82071
  const element = (
82068
- v instanceof Temporal.Instant ? {
82072
+ isTemporalInstant(v) ? {
82069
82073
  \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\",
82070
82074
  \\"@value\\": v.toString(),
82071
82075
  } : { \\"@value\\": v }
@@ -93393,7 +93397,7 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;}
93393
93397
  }
93394
93398
 
93395
93399
  if (\\"deleted\\" in values && values.deleted != null) {
93396
- if (values.deleted instanceof Temporal.Instant) {
93400
+ if (isTemporalInstant(values.deleted)) {
93397
93401
  // @ts-ignore: type is checked above.
93398
93402
  this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
93399
93403
 
@@ -93487,7 +93491,7 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;}
93487
93491
  }
93488
93492
  clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
93489
93493
  if (\\"deleted\\" in values && values.deleted != null) {
93490
- if (values.deleted instanceof Temporal.Instant) {
93494
+ if (isTemporalInstant(values.deleted)) {
93491
93495
  // @ts-ignore: type is checked above.
93492
93496
  clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
93493
93497
 
@@ -22,6 +22,10 @@ import {
22
22
  parseDecimal,
23
23
  type RemoteDocument
24
24
  } from "@fedify/vocab-runtime";
25
+ import {
26
+ isTemporalDuration,
27
+ isTemporalInstant,
28
+ } from "@fedify/vocab-runtime/temporal";
25
29
 
26
30
 
27
31
  /** Describes an object of any kind. The Object type serves as the base type for
@@ -403,7 +407,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
403
407
  }
404
408
 
405
409
  if ("endTime" in values && values.endTime != null) {
406
- if (values.endTime instanceof Temporal.Instant) {
410
+ if (isTemporalInstant(values.endTime)) {
407
411
  // @ts-ignore: type is checked above.
408
412
  this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
409
413
 
@@ -635,7 +639,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
635
639
  }
636
640
 
637
641
  if ("published" in values && values.published != null) {
638
- if (values.published instanceof Temporal.Instant) {
642
+ if (isTemporalInstant(values.published)) {
639
643
  // @ts-ignore: type is checked above.
640
644
  this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
641
645
 
@@ -700,7 +704,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
700
704
  }
701
705
 
702
706
  if ("startTime" in values && values.startTime != null) {
703
- if (values.startTime instanceof Temporal.Instant) {
707
+ if (isTemporalInstant(values.startTime)) {
704
708
  // @ts-ignore: type is checked above.
705
709
  this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
706
710
 
@@ -768,7 +772,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
768
772
  }
769
773
 
770
774
  if ("updated" in values && values.updated != null) {
771
- if (values.updated instanceof Temporal.Instant) {
775
+ if (isTemporalInstant(values.updated)) {
772
776
  // @ts-ignore: type is checked above.
773
777
  this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
774
778
 
@@ -990,7 +994,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
990
994
  }
991
995
 
992
996
  if ("duration" in values && values.duration != null) {
993
- if (values.duration instanceof Temporal.Duration) {
997
+ if (isTemporalDuration(values.duration)) {
994
998
  // @ts-ignore: type is checked above.
995
999
  this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
996
1000
 
@@ -1378,7 +1382,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1378
1382
  }
1379
1383
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime;
1380
1384
  if ("endTime" in values && values.endTime != null) {
1381
- if (values.endTime instanceof Temporal.Instant) {
1385
+ if (isTemporalInstant(values.endTime)) {
1382
1386
  // @ts-ignore: type is checked above.
1383
1387
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
1384
1388
 
@@ -1616,7 +1620,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1616
1620
  }
1617
1621
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published;
1618
1622
  if ("published" in values && values.published != null) {
1619
- if (values.published instanceof Temporal.Instant) {
1623
+ if (isTemporalInstant(values.published)) {
1620
1624
  // @ts-ignore: type is checked above.
1621
1625
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
1622
1626
 
@@ -1681,7 +1685,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1681
1685
  }
1682
1686
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime;
1683
1687
  if ("startTime" in values && values.startTime != null) {
1684
- if (values.startTime instanceof Temporal.Instant) {
1688
+ if (isTemporalInstant(values.startTime)) {
1685
1689
  // @ts-ignore: type is checked above.
1686
1690
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
1687
1691
 
@@ -1750,7 +1754,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1750
1754
  }
1751
1755
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated;
1752
1756
  if ("updated" in values && values.updated != null) {
1753
- if (values.updated instanceof Temporal.Instant) {
1757
+ if (isTemporalInstant(values.updated)) {
1754
1758
  // @ts-ignore: type is checked above.
1755
1759
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
1756
1760
 
@@ -1976,7 +1980,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
1976
1980
  }
1977
1981
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration;
1978
1982
  if ("duration" in values && values.duration != null) {
1979
- if (values.duration instanceof Temporal.Duration) {
1983
+ if (isTemporalDuration(values.duration)) {
1980
1984
  // @ts-ignore: type is checked above.
1981
1985
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
1982
1986
 
@@ -26702,7 +26706,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null
26702
26706
  }
26703
26707
 
26704
26708
  if ("created" in values && values.created != null) {
26705
- if (values.created instanceof Temporal.Instant) {
26709
+ if (isTemporalInstant(values.created)) {
26706
26710
  // @ts-ignore: type is checked above.
26707
26711
  this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
26708
26712
 
@@ -26803,7 +26807,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null
26803
26807
  }
26804
26808
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
26805
26809
  if ("created" in values && values.created != null) {
26806
- if (values.created instanceof Temporal.Instant) {
26810
+ if (isTemporalInstant(values.created)) {
26807
26811
  // @ts-ignore: type is checked above.
26808
26812
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
26809
26813
 
@@ -80846,7 +80850,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
80846
80850
  }
80847
80851
 
80848
80852
  if ("closed" in values && values.closed != null) {
80849
- if (values.closed instanceof Temporal.Instant || typeof values.closed === "boolean") {
80853
+ if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") {
80850
80854
  // @ts-ignore: type is checked above.
80851
80855
  this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
80852
80856
 
@@ -81001,7 +81005,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
81001
81005
  }
81002
81006
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
81003
81007
  if ("closed" in values && values.closed != null) {
81004
- if (values.closed instanceof Temporal.Instant || typeof values.closed === "boolean") {
81008
+ if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") {
81005
81009
  // @ts-ignore: type is checked above.
81006
81010
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
81007
81011
 
@@ -82067,7 +82071,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
82067
82071
  array = [];
82068
82072
  for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
82069
82073
  const element = (
82070
- v instanceof Temporal.Instant ? {
82074
+ isTemporalInstant(v) ? {
82071
82075
  "@type": "http://www.w3.org/2001/XMLSchema#dateTime",
82072
82076
  "@value": v.toString(),
82073
82077
  } : { "@value": v }
@@ -93395,7 +93399,7 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;}
93395
93399
  }
93396
93400
 
93397
93401
  if ("deleted" in values && values.deleted != null) {
93398
- if (values.deleted instanceof Temporal.Instant) {
93402
+ if (isTemporalInstant(values.deleted)) {
93399
93403
  // @ts-ignore: type is checked above.
93400
93404
  this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
93401
93405
 
@@ -93489,7 +93493,7 @@ formerTypes?: ($EntityType)[];deleted?: Temporal.Instant | null;}
93489
93493
  }
93490
93494
  clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
93491
93495
  if ("deleted" in values && values.deleted != null) {
93492
- if (values.deleted instanceof Temporal.Instant) {
93496
+ if (isTemporalInstant(values.deleted)) {
93493
93497
  // @ts-ignore: type is checked above.
93494
93498
  clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
93495
93499
 
package/src/class.ts CHANGED
@@ -192,6 +192,10 @@ export async function* generateClasses(
192
192
  yield `import {\n ${
193
193
  runtimeImports.join(",\n ")
194
194
  }\n} from "@fedify/vocab-runtime";\n`;
195
+ yield `import {
196
+ isTemporalDuration,
197
+ isTemporalInstant,
198
+ } from "@fedify/vocab-runtime/temporal";\n`;
195
199
  yield "\n\n";
196
200
  const sorted = sortTopologically(types);
197
201
  for (const typeUri of sorted) {
package/src/type.ts CHANGED
@@ -209,7 +209,7 @@ const scalarTypes: Record<string, ScalarType> = {
209
209
  "http://www.w3.org/2001/XMLSchema#dateTime": {
210
210
  name: "Temporal.Instant",
211
211
  typeGuard(v) {
212
- return `${v} instanceof Temporal.Instant`;
212
+ return `isTemporalInstant(${v})`;
213
213
  },
214
214
  encoder(v) {
215
215
  return `{
@@ -239,7 +239,7 @@ const scalarTypes: Record<string, ScalarType> = {
239
239
  "http://www.w3.org/2001/XMLSchema#duration": {
240
240
  name: "Temporal.Duration",
241
241
  typeGuard(v) {
242
- return `${v} instanceof Temporal.Duration`;
242
+ return `isTemporalDuration(${v})`;
243
243
  },
244
244
  encoder(v) {
245
245
  return `{
package/tsdown.config.ts CHANGED
@@ -7,7 +7,7 @@ export default defineConfig({
7
7
  dts: { compilerOptions: { isolatedDeclarations: true, declaration: true } },
8
8
  format: ["esm", "cjs"],
9
9
  platform: "neutral",
10
- external: [/^node:/],
10
+ deps: { neverBundle: [/^node:/] },
11
11
  hooks: {
12
12
  "build:done": async (ctx) => {
13
13
  await cp(