@fedify/vocab-tools 2.0.17-dev.1080 → 2.0.17-dev.1093

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.0.17-dev.1080+6cfb9a34",
3
+ "version": "2.0.17-dev.1093+5ccc4865",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts"
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.0.17-dev.1080+6cfb9a34";
11
+ var version = "2.0.17-dev.1093+5ccc4865";
12
12
  //#endregion
13
13
  //#region src/type.ts
14
14
  const HEURISTICS_CONTEXTS = [
@@ -184,7 +184,7 @@ const scalarTypes = {
184
184
  "http://www.w3.org/2001/XMLSchema#dateTime": {
185
185
  name: "Temporal.Instant",
186
186
  typeGuard(v) {
187
- return `${v} instanceof Temporal.Instant`;
187
+ return `isTemporalInstant(${v})`;
188
188
  },
189
189
  encoder(v) {
190
190
  return `{
@@ -214,7 +214,7 @@ const scalarTypes = {
214
214
  "http://www.w3.org/2001/XMLSchema#duration": {
215
215
  name: "Temporal.Duration",
216
216
  typeGuard(v) {
217
- return `${v} instanceof Temporal.Duration`;
217
+ return `isTemporalDuration(${v})`;
218
218
  },
219
219
  encoder(v) {
220
220
  return `{
@@ -1850,6 +1850,10 @@ async function* generateClasses(types) {
1850
1850
  LanguageString,
1851
1851
  type RemoteDocument,
1852
1852
  } from "@fedify/vocab-runtime";\n`;
1853
+ yield `import {
1854
+ isTemporalDuration,
1855
+ isTemporalInstant,
1856
+ } from "@fedify/vocab-runtime/temporal";\n`;
1853
1857
  yield "\n\n";
1854
1858
  const sorted = sortTopologically(types);
1855
1859
  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.0.17-dev.1080+6cfb9a34";
10
+ var version = "2.0.17-dev.1093+5ccc4865";
11
11
  //#endregion
12
12
  //#region src/type.ts
13
13
  const HEURISTICS_CONTEXTS = [
@@ -183,7 +183,7 @@ const scalarTypes = {
183
183
  "http://www.w3.org/2001/XMLSchema#dateTime": {
184
184
  name: "Temporal.Instant",
185
185
  typeGuard(v) {
186
- return `${v} instanceof Temporal.Instant`;
186
+ return `isTemporalInstant(${v})`;
187
187
  },
188
188
  encoder(v) {
189
189
  return `{
@@ -213,7 +213,7 @@ const scalarTypes = {
213
213
  "http://www.w3.org/2001/XMLSchema#duration": {
214
214
  name: "Temporal.Duration",
215
215
  typeGuard(v) {
216
- return `${v} instanceof Temporal.Duration`;
216
+ return `isTemporalDuration(${v})`;
217
217
  },
218
218
  encoder(v) {
219
219
  return `{
@@ -1849,6 +1849,10 @@ async function* generateClasses(types) {
1849
1849
  LanguageString,
1850
1850
  type RemoteDocument,
1851
1851
  } from "@fedify/vocab-runtime";\n`;
1852
+ yield `import {
1853
+ isTemporalDuration,
1854
+ isTemporalInstant,
1855
+ } from "@fedify/vocab-runtime/temporal";\n`;
1852
1856
  yield "\n\n";
1853
1857
  const sorted = sortTopologically(types);
1854
1858
  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.0.17-dev.1080+6cfb9a34",
3
+ "version": "2.0.17-dev.1093+5ccc4865",
4
4
  "description": "Code generator for Activity Vocabulary APIs",
5
5
  "homepage": "https://fedify.dev/",
6
6
  "repository": {
@@ -51,7 +51,7 @@
51
51
  "devDependencies": {
52
52
  "@types/node": "^22.17.0",
53
53
  "tsdown": "^0.21.6",
54
- "typescript": "^5.9.2"
54
+ "typescript": "^6.0.0"
55
55
  },
56
56
  "dependencies": {
57
57
  "@cfworker/json-schema": "^4.1.1",
@@ -18,6 +18,10 @@ import {
18
18
  LanguageString,
19
19
  type RemoteDocument,
20
20
  } from \\"@fedify/vocab-runtime\\";
21
+ import {
22
+ isTemporalDuration,
23
+ isTemporalInstant,
24
+ } from \\"@fedify/vocab-runtime/temporal\\";
21
25
 
22
26
 
23
27
  /** Describes an object of any kind. The Object type serves as the base type for
@@ -388,7 +392,7 @@ proofs?: (DataIntegrityProof | URL)[];}
388
392
  }
389
393
 
390
394
  if (\\"endTime\\" in values && values.endTime != null) {
391
- if (values.endTime instanceof Temporal.Instant) {
395
+ if (isTemporalInstant(values.endTime)) {
392
396
  // @ts-ignore: type is checked above.
393
397
  this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
394
398
 
@@ -620,7 +624,7 @@ proofs?: (DataIntegrityProof | URL)[];}
620
624
  }
621
625
 
622
626
  if (\\"published\\" in values && values.published != null) {
623
- if (values.published instanceof Temporal.Instant) {
627
+ if (isTemporalInstant(values.published)) {
624
628
  // @ts-ignore: type is checked above.
625
629
  this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
626
630
 
@@ -685,7 +689,7 @@ proofs?: (DataIntegrityProof | URL)[];}
685
689
  }
686
690
 
687
691
  if (\\"startTime\\" in values && values.startTime != null) {
688
- if (values.startTime instanceof Temporal.Instant) {
692
+ if (isTemporalInstant(values.startTime)) {
689
693
  // @ts-ignore: type is checked above.
690
694
  this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
691
695
 
@@ -753,7 +757,7 @@ proofs?: (DataIntegrityProof | URL)[];}
753
757
  }
754
758
 
755
759
  if (\\"updated\\" in values && values.updated != null) {
756
- if (values.updated instanceof Temporal.Instant) {
760
+ if (isTemporalInstant(values.updated)) {
757
761
  // @ts-ignore: type is checked above.
758
762
  this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
759
763
 
@@ -975,7 +979,7 @@ proofs?: (DataIntegrityProof | URL)[];}
975
979
  }
976
980
 
977
981
  if (\\"duration\\" in values && values.duration != null) {
978
- if (values.duration instanceof Temporal.Duration) {
982
+ if (isTemporalDuration(values.duration)) {
979
983
  // @ts-ignore: type is checked above.
980
984
  this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
981
985
 
@@ -1298,7 +1302,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1298
1302
  }
1299
1303
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime;
1300
1304
  if (\\"endTime\\" in values && values.endTime != null) {
1301
- if (values.endTime instanceof Temporal.Instant) {
1305
+ if (isTemporalInstant(values.endTime)) {
1302
1306
  // @ts-ignore: type is checked above.
1303
1307
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
1304
1308
 
@@ -1536,7 +1540,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1536
1540
  }
1537
1541
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published;
1538
1542
  if (\\"published\\" in values && values.published != null) {
1539
- if (values.published instanceof Temporal.Instant) {
1543
+ if (isTemporalInstant(values.published)) {
1540
1544
  // @ts-ignore: type is checked above.
1541
1545
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
1542
1546
 
@@ -1601,7 +1605,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1601
1605
  }
1602
1606
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime;
1603
1607
  if (\\"startTime\\" in values && values.startTime != null) {
1604
- if (values.startTime instanceof Temporal.Instant) {
1608
+ if (isTemporalInstant(values.startTime)) {
1605
1609
  // @ts-ignore: type is checked above.
1606
1610
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
1607
1611
 
@@ -1670,7 +1674,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1670
1674
  }
1671
1675
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated;
1672
1676
  if (\\"updated\\" in values && values.updated != null) {
1673
- if (values.updated instanceof Temporal.Instant) {
1677
+ if (isTemporalInstant(values.updated)) {
1674
1678
  // @ts-ignore: type is checked above.
1675
1679
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
1676
1680
 
@@ -1896,7 +1900,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1896
1900
  }
1897
1901
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration;
1898
1902
  if (\\"duration\\" in values && values.duration != null) {
1899
- if (values.duration instanceof Temporal.Duration) {
1903
+ if (isTemporalDuration(values.duration)) {
1900
1904
  // @ts-ignore: type is checked above.
1901
1905
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
1902
1906
 
@@ -17191,7 +17195,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
17191
17195
  }
17192
17196
 
17193
17197
  if (\\"created\\" in values && values.created != null) {
17194
- if (values.created instanceof Temporal.Instant) {
17198
+ if (isTemporalInstant(values.created)) {
17195
17199
  // @ts-ignore: type is checked above.
17196
17200
  this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
17197
17201
 
@@ -17292,7 +17296,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
17292
17296
  }
17293
17297
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
17294
17298
  if (\\"created\\" in values && values.created != null) {
17295
- if (values.created instanceof Temporal.Instant) {
17299
+ if (isTemporalInstant(values.created)) {
17296
17300
  // @ts-ignore: type is checked above.
17297
17301
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
17298
17302
 
@@ -67912,7 +67916,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
67912
67916
  }
67913
67917
 
67914
67918
  if (\\"closed\\" in values && values.closed != null) {
67915
- if (values.closed instanceof Temporal.Instant || typeof values.closed === \\"boolean\\") {
67919
+ if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
67916
67920
  // @ts-ignore: type is checked above.
67917
67921
  this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
67918
67922
 
@@ -68041,7 +68045,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
68041
68045
  }
68042
68046
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
68043
68047
  if (\\"closed\\" in values && values.closed != null) {
68044
- if (values.closed instanceof Temporal.Instant || typeof values.closed === \\"boolean\\") {
68048
+ if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
68045
68049
  // @ts-ignore: type is checked above.
68046
68050
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
68047
68051
 
@@ -68648,7 +68652,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
68648
68652
  array = [];
68649
68653
  for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
68650
68654
  const element = (
68651
- v instanceof Temporal.Instant ? {
68655
+ isTemporalInstant(v) ? {
68652
68656
  \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\",
68653
68657
  \\"@value\\": v.toString(),
68654
68658
  } : { \\"@value\\": v }
@@ -79727,7 +79731,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;}
79727
79731
  ) {
79728
79732
  super(values, options);
79729
79733
  if (\\"deleted\\" in values && values.deleted != null) {
79730
- if (values.deleted instanceof Temporal.Instant) {
79734
+ if (isTemporalInstant(values.deleted)) {
79731
79735
  // @ts-ignore: type is checked above.
79732
79736
  this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
79733
79737
 
@@ -79784,7 +79788,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;}
79784
79788
  }
79785
79789
  const clone = super.clone(values, options) as unknown as Tombstone;clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
79786
79790
  if (\\"deleted\\" in values && values.deleted != null) {
79787
- if (values.deleted instanceof Temporal.Instant) {
79791
+ if (isTemporalInstant(values.deleted)) {
79788
79792
  // @ts-ignore: type is checked above.
79789
79793
  clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
79790
79794
 
@@ -16,6 +16,10 @@ import {
16
16
  LanguageString,
17
17
  type RemoteDocument,
18
18
  } from \\"@fedify/vocab-runtime\\";
19
+ import {
20
+ isTemporalDuration,
21
+ isTemporalInstant,
22
+ } from \\"@fedify/vocab-runtime/temporal\\";
19
23
 
20
24
 
21
25
  /** Describes an object of any kind. The Object type serves as the base type for
@@ -386,7 +390,7 @@ proofs?: (DataIntegrityProof | URL)[];}
386
390
  }
387
391
 
388
392
  if (\\"endTime\\" in values && values.endTime != null) {
389
- if (values.endTime instanceof Temporal.Instant) {
393
+ if (isTemporalInstant(values.endTime)) {
390
394
  // @ts-ignore: type is checked above.
391
395
  this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
392
396
 
@@ -618,7 +622,7 @@ proofs?: (DataIntegrityProof | URL)[];}
618
622
  }
619
623
 
620
624
  if (\\"published\\" in values && values.published != null) {
621
- if (values.published instanceof Temporal.Instant) {
625
+ if (isTemporalInstant(values.published)) {
622
626
  // @ts-ignore: type is checked above.
623
627
  this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
624
628
 
@@ -683,7 +687,7 @@ proofs?: (DataIntegrityProof | URL)[];}
683
687
  }
684
688
 
685
689
  if (\\"startTime\\" in values && values.startTime != null) {
686
- if (values.startTime instanceof Temporal.Instant) {
690
+ if (isTemporalInstant(values.startTime)) {
687
691
  // @ts-ignore: type is checked above.
688
692
  this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
689
693
 
@@ -751,7 +755,7 @@ proofs?: (DataIntegrityProof | URL)[];}
751
755
  }
752
756
 
753
757
  if (\\"updated\\" in values && values.updated != null) {
754
- if (values.updated instanceof Temporal.Instant) {
758
+ if (isTemporalInstant(values.updated)) {
755
759
  // @ts-ignore: type is checked above.
756
760
  this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
757
761
 
@@ -973,7 +977,7 @@ proofs?: (DataIntegrityProof | URL)[];}
973
977
  }
974
978
 
975
979
  if (\\"duration\\" in values && values.duration != null) {
976
- if (values.duration instanceof Temporal.Duration) {
980
+ if (isTemporalDuration(values.duration)) {
977
981
  // @ts-ignore: type is checked above.
978
982
  this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
979
983
 
@@ -1296,7 +1300,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1296
1300
  }
1297
1301
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime;
1298
1302
  if (\\"endTime\\" in values && values.endTime != null) {
1299
- if (values.endTime instanceof Temporal.Instant) {
1303
+ if (isTemporalInstant(values.endTime)) {
1300
1304
  // @ts-ignore: type is checked above.
1301
1305
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
1302
1306
 
@@ -1534,7 +1538,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1534
1538
  }
1535
1539
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published;
1536
1540
  if (\\"published\\" in values && values.published != null) {
1537
- if (values.published instanceof Temporal.Instant) {
1541
+ if (isTemporalInstant(values.published)) {
1538
1542
  // @ts-ignore: type is checked above.
1539
1543
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
1540
1544
 
@@ -1599,7 +1603,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1599
1603
  }
1600
1604
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime;
1601
1605
  if (\\"startTime\\" in values && values.startTime != null) {
1602
- if (values.startTime instanceof Temporal.Instant) {
1606
+ if (isTemporalInstant(values.startTime)) {
1603
1607
  // @ts-ignore: type is checked above.
1604
1608
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
1605
1609
 
@@ -1668,7 +1672,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1668
1672
  }
1669
1673
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated;
1670
1674
  if (\\"updated\\" in values && values.updated != null) {
1671
- if (values.updated instanceof Temporal.Instant) {
1675
+ if (isTemporalInstant(values.updated)) {
1672
1676
  // @ts-ignore: type is checked above.
1673
1677
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
1674
1678
 
@@ -1894,7 +1898,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1894
1898
  }
1895
1899
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration;
1896
1900
  if (\\"duration\\" in values && values.duration != null) {
1897
- if (values.duration instanceof Temporal.Duration) {
1901
+ if (isTemporalDuration(values.duration)) {
1898
1902
  // @ts-ignore: type is checked above.
1899
1903
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
1900
1904
 
@@ -17189,7 +17193,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
17189
17193
  }
17190
17194
 
17191
17195
  if (\\"created\\" in values && values.created != null) {
17192
- if (values.created instanceof Temporal.Instant) {
17196
+ if (isTemporalInstant(values.created)) {
17193
17197
  // @ts-ignore: type is checked above.
17194
17198
  this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
17195
17199
 
@@ -17290,7 +17294,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
17290
17294
  }
17291
17295
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
17292
17296
  if (\\"created\\" in values && values.created != null) {
17293
- if (values.created instanceof Temporal.Instant) {
17297
+ if (isTemporalInstant(values.created)) {
17294
17298
  // @ts-ignore: type is checked above.
17295
17299
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
17296
17300
 
@@ -67910,7 +67914,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
67910
67914
  }
67911
67915
 
67912
67916
  if (\\"closed\\" in values && values.closed != null) {
67913
- if (values.closed instanceof Temporal.Instant || typeof values.closed === \\"boolean\\") {
67917
+ if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
67914
67918
  // @ts-ignore: type is checked above.
67915
67919
  this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
67916
67920
 
@@ -68039,7 +68043,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
68039
68043
  }
68040
68044
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
68041
68045
  if (\\"closed\\" in values && values.closed != null) {
68042
- if (values.closed instanceof Temporal.Instant || typeof values.closed === \\"boolean\\") {
68046
+ if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
68043
68047
  // @ts-ignore: type is checked above.
68044
68048
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
68045
68049
 
@@ -68646,7 +68650,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
68646
68650
  array = [];
68647
68651
  for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
68648
68652
  const element = (
68649
- v instanceof Temporal.Instant ? {
68653
+ isTemporalInstant(v) ? {
68650
68654
  \\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\",
68651
68655
  \\"@value\\": v.toString(),
68652
68656
  } : { \\"@value\\": v }
@@ -79725,7 +79729,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;}
79725
79729
  ) {
79726
79730
  super(values, options);
79727
79731
  if (\\"deleted\\" in values && values.deleted != null) {
79728
- if (values.deleted instanceof Temporal.Instant) {
79732
+ if (isTemporalInstant(values.deleted)) {
79729
79733
  // @ts-ignore: type is checked above.
79730
79734
  this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
79731
79735
 
@@ -79782,7 +79786,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;}
79782
79786
  }
79783
79787
  const clone = super.clone(values, options) as unknown as Tombstone;clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
79784
79788
  if (\\"deleted\\" in values && values.deleted != null) {
79785
- if (values.deleted instanceof Temporal.Instant) {
79789
+ if (isTemporalInstant(values.deleted)) {
79786
79790
  // @ts-ignore: type is checked above.
79787
79791
  clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
79788
79792
 
@@ -18,6 +18,10 @@ import {
18
18
  LanguageString,
19
19
  type RemoteDocument,
20
20
  } from "@fedify/vocab-runtime";
21
+ import {
22
+ isTemporalDuration,
23
+ isTemporalInstant,
24
+ } from "@fedify/vocab-runtime/temporal";
21
25
 
22
26
 
23
27
  /** Describes an object of any kind. The Object type serves as the base type for
@@ -388,7 +392,7 @@ proofs?: (DataIntegrityProof | URL)[];}
388
392
  }
389
393
 
390
394
  if ("endTime" in values && values.endTime != null) {
391
- if (values.endTime instanceof Temporal.Instant) {
395
+ if (isTemporalInstant(values.endTime)) {
392
396
  // @ts-ignore: type is checked above.
393
397
  this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
394
398
 
@@ -620,7 +624,7 @@ proofs?: (DataIntegrityProof | URL)[];}
620
624
  }
621
625
 
622
626
  if ("published" in values && values.published != null) {
623
- if (values.published instanceof Temporal.Instant) {
627
+ if (isTemporalInstant(values.published)) {
624
628
  // @ts-ignore: type is checked above.
625
629
  this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
626
630
 
@@ -685,7 +689,7 @@ proofs?: (DataIntegrityProof | URL)[];}
685
689
  }
686
690
 
687
691
  if ("startTime" in values && values.startTime != null) {
688
- if (values.startTime instanceof Temporal.Instant) {
692
+ if (isTemporalInstant(values.startTime)) {
689
693
  // @ts-ignore: type is checked above.
690
694
  this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
691
695
 
@@ -753,7 +757,7 @@ proofs?: (DataIntegrityProof | URL)[];}
753
757
  }
754
758
 
755
759
  if ("updated" in values && values.updated != null) {
756
- if (values.updated instanceof Temporal.Instant) {
760
+ if (isTemporalInstant(values.updated)) {
757
761
  // @ts-ignore: type is checked above.
758
762
  this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
759
763
 
@@ -975,7 +979,7 @@ proofs?: (DataIntegrityProof | URL)[];}
975
979
  }
976
980
 
977
981
  if ("duration" in values && values.duration != null) {
978
- if (values.duration instanceof Temporal.Duration) {
982
+ if (isTemporalDuration(values.duration)) {
979
983
  // @ts-ignore: type is checked above.
980
984
  this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
981
985
 
@@ -1298,7 +1302,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1298
1302
  }
1299
1303
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime;
1300
1304
  if ("endTime" in values && values.endTime != null) {
1301
- if (values.endTime instanceof Temporal.Instant) {
1305
+ if (isTemporalInstant(values.endTime)) {
1302
1306
  // @ts-ignore: type is checked above.
1303
1307
  clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
1304
1308
 
@@ -1536,7 +1540,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1536
1540
  }
1537
1541
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published;
1538
1542
  if ("published" in values && values.published != null) {
1539
- if (values.published instanceof Temporal.Instant) {
1543
+ if (isTemporalInstant(values.published)) {
1540
1544
  // @ts-ignore: type is checked above.
1541
1545
  clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
1542
1546
 
@@ -1601,7 +1605,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1601
1605
  }
1602
1606
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime;
1603
1607
  if ("startTime" in values && values.startTime != null) {
1604
- if (values.startTime instanceof Temporal.Instant) {
1608
+ if (isTemporalInstant(values.startTime)) {
1605
1609
  // @ts-ignore: type is checked above.
1606
1610
  clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
1607
1611
 
@@ -1670,7 +1674,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1670
1674
  }
1671
1675
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated;
1672
1676
  if ("updated" in values && values.updated != null) {
1673
- if (values.updated instanceof Temporal.Instant) {
1677
+ if (isTemporalInstant(values.updated)) {
1674
1678
  // @ts-ignore: type is checked above.
1675
1679
  clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
1676
1680
 
@@ -1896,7 +1900,7 @@ proofs?: (DataIntegrityProof | URL)[];}
1896
1900
  }
1897
1901
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration;
1898
1902
  if ("duration" in values && values.duration != null) {
1899
- if (values.duration instanceof Temporal.Duration) {
1903
+ if (isTemporalDuration(values.duration)) {
1900
1904
  // @ts-ignore: type is checked above.
1901
1905
  clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
1902
1906
 
@@ -17191,7 +17195,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null
17191
17195
  }
17192
17196
 
17193
17197
  if ("created" in values && values.created != null) {
17194
- if (values.created instanceof Temporal.Instant) {
17198
+ if (isTemporalInstant(values.created)) {
17195
17199
  // @ts-ignore: type is checked above.
17196
17200
  this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
17197
17201
 
@@ -17292,7 +17296,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null
17292
17296
  }
17293
17297
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
17294
17298
  if ("created" in values && values.created != null) {
17295
- if (values.created instanceof Temporal.Instant) {
17299
+ if (isTemporalInstant(values.created)) {
17296
17300
  // @ts-ignore: type is checked above.
17297
17301
  clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
17298
17302
 
@@ -67912,7 +67916,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
67912
67916
  }
67913
67917
 
67914
67918
  if ("closed" in values && values.closed != null) {
67915
- if (values.closed instanceof Temporal.Instant || typeof values.closed === "boolean") {
67919
+ if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") {
67916
67920
  // @ts-ignore: type is checked above.
67917
67921
  this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
67918
67922
 
@@ -68041,7 +68045,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
68041
68045
  }
68042
68046
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
68043
68047
  if ("closed" in values && values.closed != null) {
68044
- if (values.closed instanceof Temporal.Instant || typeof values.closed === "boolean") {
68048
+ if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") {
68045
68049
  // @ts-ignore: type is checked above.
68046
68050
  clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
68047
68051
 
@@ -68648,7 +68652,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
68648
68652
  array = [];
68649
68653
  for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
68650
68654
  const element = (
68651
- v instanceof Temporal.Instant ? {
68655
+ isTemporalInstant(v) ? {
68652
68656
  "@type": "http://www.w3.org/2001/XMLSchema#dateTime",
68653
68657
  "@value": v.toString(),
68654
68658
  } : { "@value": v }
@@ -79727,7 +79731,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;}
79727
79731
  ) {
79728
79732
  super(values, options);
79729
79733
  if ("deleted" in values && values.deleted != null) {
79730
- if (values.deleted instanceof Temporal.Instant) {
79734
+ if (isTemporalInstant(values.deleted)) {
79731
79735
  // @ts-ignore: type is checked above.
79732
79736
  this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
79733
79737
 
@@ -79784,7 +79788,7 @@ proofs?: (DataIntegrityProof | URL)[];deleted?: Temporal.Instant | null;}
79784
79788
  }
79785
79789
  const clone = super.clone(values, options) as unknown as Tombstone;clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
79786
79790
  if ("deleted" in values && values.deleted != null) {
79787
- if (values.deleted instanceof Temporal.Instant) {
79791
+ if (isTemporalInstant(values.deleted)) {
79788
79792
  // @ts-ignore: type is checked above.
79789
79793
  clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
79790
79794
 
package/src/class.ts CHANGED
@@ -134,6 +134,10 @@ export async function* generateClasses(
134
134
  LanguageString,
135
135
  type RemoteDocument,
136
136
  } from "@fedify/vocab-runtime";\n`;
137
+ yield `import {
138
+ isTemporalDuration,
139
+ isTemporalInstant,
140
+ } from "@fedify/vocab-runtime/temporal";\n`;
137
141
  yield "\n\n";
138
142
  const sorted = sortTopologically(types);
139
143
  for (const typeUri of sorted) {
package/src/type.ts CHANGED
@@ -185,7 +185,7 @@ const scalarTypes: Record<string, ScalarType> = {
185
185
  "http://www.w3.org/2001/XMLSchema#dateTime": {
186
186
  name: "Temporal.Instant",
187
187
  typeGuard(v) {
188
- return `${v} instanceof Temporal.Instant`;
188
+ return `isTemporalInstant(${v})`;
189
189
  },
190
190
  encoder(v) {
191
191
  return `{
@@ -215,7 +215,7 @@ const scalarTypes: Record<string, ScalarType> = {
215
215
  "http://www.w3.org/2001/XMLSchema#duration": {
216
216
  name: "Temporal.Duration",
217
217
  typeGuard(v) {
218
- return `${v} instanceof Temporal.Duration`;
218
+ return `isTemporalDuration(${v})`;
219
219
  },
220
220
  encoder(v) {
221
221
  return `{