@fedify/vocab-tools 2.1.11 → 2.1.13
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 +7 -3
- package/dist/mod.js +7 -3
- package/package.json +2 -2
- package/src/__snapshots__/class.test.ts.deno.snap +21 -17
- package/src/__snapshots__/class.test.ts.node.snap +21 -17
- package/src/__snapshots__/class.test.ts.snap +21 -17
- package/src/class.ts +4 -0
- package/src/type.ts +2 -2
package/deno.json
CHANGED
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.1.
|
|
11
|
+
var version = "2.1.13";
|
|
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
|
|
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
|
|
241
|
+
return `isTemporalDuration(${v})`;
|
|
242
242
|
},
|
|
243
243
|
encoder(v) {
|
|
244
244
|
return `{
|
|
@@ -1900,6 +1900,10 @@ async function* generateClasses(types) {
|
|
|
1900
1900
|
yield `import { type Span, SpanStatusCode, type TracerProvider, trace }
|
|
1901
1901
|
from "@opentelemetry/api";\n`;
|
|
1902
1902
|
yield `import {\n ${runtimeImports.join(",\n ")}\n} from "@fedify/vocab-runtime";\n`;
|
|
1903
|
+
yield `import {
|
|
1904
|
+
isTemporalDuration,
|
|
1905
|
+
isTemporalInstant,
|
|
1906
|
+
} from "@fedify/vocab-runtime/temporal";\n`;
|
|
1903
1907
|
yield "\n\n";
|
|
1904
1908
|
const sorted = sortTopologically(types);
|
|
1905
1909
|
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.1.
|
|
10
|
+
var version = "2.1.13";
|
|
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
|
|
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
|
|
240
|
+
return `isTemporalDuration(${v})`;
|
|
241
241
|
},
|
|
242
242
|
encoder(v) {
|
|
243
243
|
return `{
|
|
@@ -1899,6 +1899,10 @@ async function* generateClasses(types) {
|
|
|
1899
1899
|
yield `import { type Span, SpanStatusCode, type TracerProvider, trace }
|
|
1900
1900
|
from "@opentelemetry/api";\n`;
|
|
1901
1901
|
yield `import {\n ${runtimeImports.join(",\n ")}\n} from "@fedify/vocab-runtime";\n`;
|
|
1902
|
+
yield `import {
|
|
1903
|
+
isTemporalDuration,
|
|
1904
|
+
isTemporalInstant,
|
|
1905
|
+
} from "@fedify/vocab-runtime/temporal";\n`;
|
|
1902
1906
|
yield "\n\n";
|
|
1903
1907
|
const sorted = sortTopologically(types);
|
|
1904
1908
|
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.1.
|
|
3
|
+
"version": "2.1.13",
|
|
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": "^
|
|
54
|
+
"typescript": "^6.0.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@cfworker/json-schema": "^4.1.1",
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1983
|
+
if (isTemporalDuration(values.duration)) {
|
|
1980
1984
|
// @ts-ignore: type is checked above.
|
|
1981
1985
|
clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
|
|
1982
1986
|
|
|
@@ -23859,7 +23863,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
|
|
|
23859
23863
|
}
|
|
23860
23864
|
|
|
23861
23865
|
if (\\"created\\" in values && values.created != null) {
|
|
23862
|
-
if (values.created
|
|
23866
|
+
if (isTemporalInstant(values.created)) {
|
|
23863
23867
|
// @ts-ignore: type is checked above.
|
|
23864
23868
|
this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
23865
23869
|
|
|
@@ -23960,7 +23964,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
|
|
|
23960
23964
|
}
|
|
23961
23965
|
clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
|
|
23962
23966
|
if (\\"created\\" in values && values.created != null) {
|
|
23963
|
-
if (values.created
|
|
23967
|
+
if (isTemporalInstant(values.created)) {
|
|
23964
23968
|
// @ts-ignore: type is checked above.
|
|
23965
23969
|
clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
23966
23970
|
|
|
@@ -74580,7 +74584,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
|
|
|
74580
74584
|
}
|
|
74581
74585
|
|
|
74582
74586
|
if (\\"closed\\" in values && values.closed != null) {
|
|
74583
|
-
if (values.closed
|
|
74587
|
+
if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
|
|
74584
74588
|
// @ts-ignore: type is checked above.
|
|
74585
74589
|
this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
74586
74590
|
|
|
@@ -74709,7 +74713,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
|
|
|
74709
74713
|
}
|
|
74710
74714
|
clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
|
|
74711
74715
|
if (\\"closed\\" in values && values.closed != null) {
|
|
74712
|
-
if (values.closed
|
|
74716
|
+
if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
|
|
74713
74717
|
// @ts-ignore: type is checked above.
|
|
74714
74718
|
clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
74715
74719
|
|
|
@@ -75316,7 +75320,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
|
|
|
75316
75320
|
array = [];
|
|
75317
75321
|
for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
|
|
75318
75322
|
const element = (
|
|
75319
|
-
v
|
|
75323
|
+
isTemporalInstant(v) ? {
|
|
75320
75324
|
\\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\",
|
|
75321
75325
|
\\"@value\\": v.toString(),
|
|
75322
75326
|
} : { \\"@value\\": v }
|
|
@@ -86395,7 +86399,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
|
|
|
86395
86399
|
) {
|
|
86396
86400
|
super(values, options);
|
|
86397
86401
|
if (\\"deleted\\" in values && values.deleted != null) {
|
|
86398
|
-
if (values.deleted
|
|
86402
|
+
if (isTemporalInstant(values.deleted)) {
|
|
86399
86403
|
// @ts-ignore: type is checked above.
|
|
86400
86404
|
this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
86401
86405
|
|
|
@@ -86452,7 +86456,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
|
|
|
86452
86456
|
}
|
|
86453
86457
|
const clone = super.clone(values, options) as unknown as Tombstone;clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
|
|
86454
86458
|
if (\\"deleted\\" in values && values.deleted != null) {
|
|
86455
|
-
if (values.deleted
|
|
86459
|
+
if (isTemporalInstant(values.deleted)) {
|
|
86456
86460
|
// @ts-ignore: type is checked above.
|
|
86457
86461
|
clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
86458
86462
|
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1981
|
+
if (isTemporalDuration(values.duration)) {
|
|
1978
1982
|
// @ts-ignore: type is checked above.
|
|
1979
1983
|
clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
|
|
1980
1984
|
|
|
@@ -23857,7 +23861,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
|
|
|
23857
23861
|
}
|
|
23858
23862
|
|
|
23859
23863
|
if (\\"created\\" in values && values.created != null) {
|
|
23860
|
-
if (values.created
|
|
23864
|
+
if (isTemporalInstant(values.created)) {
|
|
23861
23865
|
// @ts-ignore: type is checked above.
|
|
23862
23866
|
this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
23863
23867
|
|
|
@@ -23958,7 +23962,7 @@ cryptosuite?: \\"eddsa-jcs-2022\\" | null;verificationMethod?: Multikey | URL |
|
|
|
23958
23962
|
}
|
|
23959
23963
|
clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
|
|
23960
23964
|
if (\\"created\\" in values && values.created != null) {
|
|
23961
|
-
if (values.created
|
|
23965
|
+
if (isTemporalInstant(values.created)) {
|
|
23962
23966
|
// @ts-ignore: type is checked above.
|
|
23963
23967
|
clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
23964
23968
|
|
|
@@ -74578,7 +74582,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
|
|
|
74578
74582
|
}
|
|
74579
74583
|
|
|
74580
74584
|
if (\\"closed\\" in values && values.closed != null) {
|
|
74581
|
-
if (values.closed
|
|
74585
|
+
if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
|
|
74582
74586
|
// @ts-ignore: type is checked above.
|
|
74583
74587
|
this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
74584
74588
|
|
|
@@ -74707,7 +74711,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
|
|
|
74707
74711
|
}
|
|
74708
74712
|
clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
|
|
74709
74713
|
if (\\"closed\\" in values && values.closed != null) {
|
|
74710
|
-
if (values.closed
|
|
74714
|
+
if (isTemporalInstant(values.closed) || typeof values.closed === \\"boolean\\") {
|
|
74711
74715
|
// @ts-ignore: type is checked above.
|
|
74712
74716
|
clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
74713
74717
|
|
|
@@ -75314,7 +75318,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
|
|
|
75314
75318
|
array = [];
|
|
75315
75319
|
for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
|
|
75316
75320
|
const element = (
|
|
75317
|
-
v
|
|
75321
|
+
isTemporalInstant(v) ? {
|
|
75318
75322
|
\\"@type\\": \\"http://www.w3.org/2001/XMLSchema#dateTime\\",
|
|
75319
75323
|
\\"@value\\": v.toString(),
|
|
75320
75324
|
} : { \\"@value\\": v }
|
|
@@ -86393,7 +86397,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
|
|
|
86393
86397
|
) {
|
|
86394
86398
|
super(values, options);
|
|
86395
86399
|
if (\\"deleted\\" in values && values.deleted != null) {
|
|
86396
|
-
if (values.deleted
|
|
86400
|
+
if (isTemporalInstant(values.deleted)) {
|
|
86397
86401
|
// @ts-ignore: type is checked above.
|
|
86398
86402
|
this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
86399
86403
|
|
|
@@ -86450,7 +86454,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
|
|
|
86450
86454
|
}
|
|
86451
86455
|
const clone = super.clone(values, options) as unknown as Tombstone;clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
|
|
86452
86456
|
if (\\"deleted\\" in values && values.deleted != null) {
|
|
86453
|
-
if (values.deleted
|
|
86457
|
+
if (isTemporalInstant(values.deleted)) {
|
|
86454
86458
|
// @ts-ignore: type is checked above.
|
|
86455
86459
|
clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
86456
86460
|
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1983
|
+
if (isTemporalDuration(values.duration)) {
|
|
1980
1984
|
// @ts-ignore: type is checked above.
|
|
1981
1985
|
clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
|
|
1982
1986
|
|
|
@@ -23859,7 +23863,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null
|
|
|
23859
23863
|
}
|
|
23860
23864
|
|
|
23861
23865
|
if ("created" in values && values.created != null) {
|
|
23862
|
-
if (values.created
|
|
23866
|
+
if (isTemporalInstant(values.created)) {
|
|
23863
23867
|
// @ts-ignore: type is checked above.
|
|
23864
23868
|
this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
23865
23869
|
|
|
@@ -23960,7 +23964,7 @@ cryptosuite?: "eddsa-jcs-2022" | null;verificationMethod?: Multikey | URL | null
|
|
|
23960
23964
|
}
|
|
23961
23965
|
clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
|
|
23962
23966
|
if ("created" in values && values.created != null) {
|
|
23963
|
-
if (values.created
|
|
23967
|
+
if (isTemporalInstant(values.created)) {
|
|
23964
23968
|
// @ts-ignore: type is checked above.
|
|
23965
23969
|
clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
23966
23970
|
|
|
@@ -74580,7 +74584,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
|
|
|
74580
74584
|
}
|
|
74581
74585
|
|
|
74582
74586
|
if ("closed" in values && values.closed != null) {
|
|
74583
|
-
if (values.closed
|
|
74587
|
+
if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") {
|
|
74584
74588
|
// @ts-ignore: type is checked above.
|
|
74585
74589
|
this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
74586
74590
|
|
|
@@ -74709,7 +74713,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
|
|
|
74709
74713
|
}
|
|
74710
74714
|
clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
|
|
74711
74715
|
if ("closed" in values && values.closed != null) {
|
|
74712
|
-
if (values.closed
|
|
74716
|
+
if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") {
|
|
74713
74717
|
// @ts-ignore: type is checked above.
|
|
74714
74718
|
clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
74715
74719
|
|
|
@@ -75316,7 +75320,7 @@ instruments?: (Object | URL)[];exclusiveOptions?: (Object | URL)[];inclusiveOpti
|
|
|
75316
75320
|
array = [];
|
|
75317
75321
|
for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
|
|
75318
75322
|
const element = (
|
|
75319
|
-
v
|
|
75323
|
+
isTemporalInstant(v) ? {
|
|
75320
75324
|
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
|
75321
75325
|
"@value": v.toString(),
|
|
75322
75326
|
} : { "@value": v }
|
|
@@ -86395,7 +86399,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
|
|
|
86395
86399
|
) {
|
|
86396
86400
|
super(values, options);
|
|
86397
86401
|
if ("deleted" in values && values.deleted != null) {
|
|
86398
|
-
if (values.deleted
|
|
86402
|
+
if (isTemporalInstant(values.deleted)) {
|
|
86399
86403
|
// @ts-ignore: type is checked above.
|
|
86400
86404
|
this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
86401
86405
|
|
|
@@ -86452,7 +86456,7 @@ proofs?: (DataIntegrityProof | URL)[];interactionPolicy?: InteractionPolicy | nu
|
|
|
86452
86456
|
}
|
|
86453
86457
|
const clone = super.clone(values, options) as unknown as Tombstone;clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
|
|
86454
86458
|
if ("deleted" in values && values.deleted != null) {
|
|
86455
|
-
if (values.deleted
|
|
86459
|
+
if (isTemporalInstant(values.deleted)) {
|
|
86456
86460
|
// @ts-ignore: type is checked above.
|
|
86457
86461
|
clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
86458
86462
|
|
package/src/class.ts
CHANGED
|
@@ -142,6 +142,10 @@ export async function* generateClasses(
|
|
|
142
142
|
yield `import {\n ${
|
|
143
143
|
runtimeImports.join(",\n ")
|
|
144
144
|
}\n} from "@fedify/vocab-runtime";\n`;
|
|
145
|
+
yield `import {
|
|
146
|
+
isTemporalDuration,
|
|
147
|
+
isTemporalInstant,
|
|
148
|
+
} from "@fedify/vocab-runtime/temporal";\n`;
|
|
145
149
|
yield "\n\n";
|
|
146
150
|
const sorted = sortTopologically(types);
|
|
147
151
|
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
|
|
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
|
|
242
|
+
return `isTemporalDuration(${v})`;
|
|
243
243
|
},
|
|
244
244
|
encoder(v) {
|
|
245
245
|
return `{
|