@fedify/vocab 2.3.0-dev.1079 → 2.3.0-dev.1110
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 +19 -18
- package/dist/mod.d.cts +1 -0
- package/dist/mod.d.ts +1 -1
- package/dist/mod.js +19 -18
- package/dist-tests/actor.test.mjs +2 -2
- package/dist-tests/{deno-BNlyFwdW.mjs → deno-CR37lL9i.mjs} +2 -2
- package/dist-tests/lookup.test.mjs +2 -2
- package/dist-tests/type.test.mjs +1 -1
- package/dist-tests/{vocab-CbuinVXl.mjs → vocab-B0Z-tH4q.mjs} +18 -17
- package/dist-tests/vocab.test.mjs +17 -1
- package/package.json +6 -6
- package/src/vocab.test.ts +37 -0
- package/tsdown.config.ts +8 -11
package/deno.json
CHANGED
package/dist/mod.cjs
CHANGED
|
@@ -29,10 +29,11 @@ let _fedify_vocab_runtime_jsonld = require("@fedify/vocab-runtime/jsonld");
|
|
|
29
29
|
_fedify_vocab_runtime_jsonld = __toESM(_fedify_vocab_runtime_jsonld, 1);
|
|
30
30
|
let _logtape_logtape = require("@logtape/logtape");
|
|
31
31
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
32
|
+
let _fedify_vocab_runtime_temporal = require("@fedify/vocab-runtime/temporal");
|
|
32
33
|
let es_toolkit = require("es-toolkit");
|
|
33
34
|
//#region deno.json
|
|
34
35
|
var name = "@fedify/vocab";
|
|
35
|
-
var version = "2.3.0-dev.
|
|
36
|
+
var version = "2.3.0-dev.1110+3ba84466";
|
|
36
37
|
//#endregion
|
|
37
38
|
//#region src/type.ts
|
|
38
39
|
function getTypeId(object) {
|
|
@@ -194,7 +195,7 @@ var Object$1 = class Object$1 {
|
|
|
194
195
|
if (Array.isArray(values.names) && values.names.every((v) => typeof v === "string" || v instanceof _fedify_vocab_runtime.LanguageString)) this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names;
|
|
195
196
|
else throw new TypeError("The names must be an array of type string | LanguageString.");
|
|
196
197
|
}
|
|
197
|
-
if ("endTime" in values && values.endTime != null) if (values.endTime
|
|
198
|
+
if ("endTime" in values && values.endTime != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.endTime)) this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
|
|
198
199
|
else throw new TypeError("The endTime must be of type Temporal.Instant.");
|
|
199
200
|
if ("generators" in values && values.generators != null) if (Array.isArray(values.generators) && values.generators.every((v) => v instanceof Object$1 || v instanceof Link || v instanceof URL)) {
|
|
200
201
|
this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators;
|
|
@@ -255,7 +256,7 @@ var Object$1 = class Object$1 {
|
|
|
255
256
|
for (let i = 0; i < values.previews.length; i++) this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i);
|
|
256
257
|
} else throw new TypeError("The previews must be an array of type Link | Object | URL.");
|
|
257
258
|
}
|
|
258
|
-
if ("published" in values && values.published != null) if (values.published
|
|
259
|
+
if ("published" in values && values.published != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.published)) this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
|
|
259
260
|
else throw new TypeError("The published must be of type Temporal.Instant.");
|
|
260
261
|
if ("replies" in values && values.replies != null) if (values.replies instanceof Collection || values.replies instanceof URL) {
|
|
261
262
|
this.#_7UpwM3JWcXhADcscukEehBorf6k_replies = [values.replies];
|
|
@@ -273,7 +274,7 @@ var Object$1 = class Object$1 {
|
|
|
273
274
|
this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = [values.emojiReactions];
|
|
274
275
|
this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.add(0);
|
|
275
276
|
} else throw new TypeError("The emojiReactions must be of type Collection | URL.");
|
|
276
|
-
if ("startTime" in values && values.startTime != null) if (values.startTime
|
|
277
|
+
if ("startTime" in values && values.startTime != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.startTime)) this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
|
|
277
278
|
else throw new TypeError("The startTime must be of type Temporal.Instant.");
|
|
278
279
|
if ("summary" in values && values.summary != null) if (typeof values.summary === "string" || values.summary instanceof _fedify_vocab_runtime.LanguageString) this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = [values.summary];
|
|
279
280
|
else throw new TypeError("The summary must be of type string | LanguageString.");
|
|
@@ -286,7 +287,7 @@ var Object$1 = class Object$1 {
|
|
|
286
287
|
this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags;
|
|
287
288
|
for (let i = 0; i < values.tags.length; i++) this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i);
|
|
288
289
|
} else throw new TypeError("The tags must be an array of type Object | Link | URL.");
|
|
289
|
-
if ("updated" in values && values.updated != null) if (values.updated
|
|
290
|
+
if ("updated" in values && values.updated != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.updated)) this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
|
|
290
291
|
else throw new TypeError("The updated must be of type Temporal.Instant.");
|
|
291
292
|
if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
|
|
292
293
|
else throw new TypeError("The url must be of type URL | Link.");
|
|
@@ -341,7 +342,7 @@ var Object$1 = class Object$1 {
|
|
|
341
342
|
}
|
|
342
343
|
if ("mediaType" in values && values.mediaType != null) if (typeof values.mediaType === "string") this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = [values.mediaType];
|
|
343
344
|
else throw new TypeError("The mediaType must be of type string.");
|
|
344
|
-
if ("duration" in values && values.duration != null) if (values.duration
|
|
345
|
+
if ("duration" in values && values.duration != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalDuration)(values.duration)) this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
|
|
345
346
|
else throw new TypeError("The duration must be of type Temporal.Duration.");
|
|
346
347
|
if ("sensitive" in values && values.sensitive != null) if (typeof values.sensitive === "boolean") this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = [values.sensitive];
|
|
347
348
|
else throw new TypeError("The sensitive must be of type boolean.");
|
|
@@ -449,7 +450,7 @@ var Object$1 = class Object$1 {
|
|
|
449
450
|
else throw new TypeError("The names must be an array of type string | LanguageString.");
|
|
450
451
|
}
|
|
451
452
|
clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime;
|
|
452
|
-
if ("endTime" in values && values.endTime != null) if (values.endTime
|
|
453
|
+
if ("endTime" in values && values.endTime != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.endTime)) clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
|
|
453
454
|
else throw new TypeError("The endTime must be of type Temporal.Instant.");
|
|
454
455
|
clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator;
|
|
455
456
|
clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = new Set(this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator);
|
|
@@ -529,7 +530,7 @@ var Object$1 = class Object$1 {
|
|
|
529
530
|
} else throw new TypeError("The previews must be an array of type Link | Object | URL.");
|
|
530
531
|
}
|
|
531
532
|
clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published;
|
|
532
|
-
if ("published" in values && values.published != null) if (values.published
|
|
533
|
+
if ("published" in values && values.published != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.published)) clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
|
|
533
534
|
else throw new TypeError("The published must be of type Temporal.Instant.");
|
|
534
535
|
clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies;
|
|
535
536
|
clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set(this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies);
|
|
@@ -556,7 +557,7 @@ var Object$1 = class Object$1 {
|
|
|
556
557
|
clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set([0]);
|
|
557
558
|
} else throw new TypeError("The emojiReactions must be of type Collection | URL.");
|
|
558
559
|
clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime;
|
|
559
|
-
if ("startTime" in values && values.startTime != null) if (values.startTime
|
|
560
|
+
if ("startTime" in values && values.startTime != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.startTime)) clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
|
|
560
561
|
else throw new TypeError("The startTime must be of type Temporal.Instant.");
|
|
561
562
|
clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary;
|
|
562
563
|
if ("summary" in values && values.summary != null) if (typeof values.summary === "string" || values.summary instanceof _fedify_vocab_runtime.LanguageString) clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = [values.summary];
|
|
@@ -574,7 +575,7 @@ var Object$1 = class Object$1 {
|
|
|
574
575
|
for (let i = 0; i < values.tags.length; i++) clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i);
|
|
575
576
|
} else throw new TypeError("The tags must be an array of type Object | Link | URL.");
|
|
576
577
|
clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated;
|
|
577
|
-
if ("updated" in values && values.updated != null) if (values.updated
|
|
578
|
+
if ("updated" in values && values.updated != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.updated)) clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
|
|
578
579
|
else throw new TypeError("The updated must be of type Temporal.Instant.");
|
|
579
580
|
clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
580
581
|
if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
|
|
@@ -644,7 +645,7 @@ var Object$1 = class Object$1 {
|
|
|
644
645
|
if ("mediaType" in values && values.mediaType != null) if (typeof values.mediaType === "string") clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = [values.mediaType];
|
|
645
646
|
else throw new TypeError("The mediaType must be of type string.");
|
|
646
647
|
clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration;
|
|
647
|
-
if ("duration" in values && values.duration != null) if (values.duration
|
|
648
|
+
if ("duration" in values && values.duration != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalDuration)(values.duration)) clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
|
|
648
649
|
else throw new TypeError("The duration must be of type Temporal.Duration.");
|
|
649
650
|
clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive;
|
|
650
651
|
if ("sensitive" in values && values.sensitive != null) if (typeof values.sensitive === "boolean") clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = [values.sensitive];
|
|
@@ -13158,7 +13159,7 @@ var DataIntegrityProof = class {
|
|
|
13158
13159
|
else throw new TypeError("The proofPurpose must be of type \"assertionMethod\" | \"authentication\" | \"capabilityInvocation\" | \"capabilityDelegation\" | \"keyAgreement\".");
|
|
13159
13160
|
if ("proofValue" in values && values.proofValue != null) if (values.proofValue instanceof Uint8Array) this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = [values.proofValue];
|
|
13160
13161
|
else throw new TypeError("The proofValue must be of type Uint8Array.");
|
|
13161
|
-
if ("created" in values && values.created != null) if (values.created
|
|
13162
|
+
if ("created" in values && values.created != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.created)) this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
13162
13163
|
else throw new TypeError("The created must be of type Temporal.Instant.");
|
|
13163
13164
|
}
|
|
13164
13165
|
/**
|
|
@@ -13192,7 +13193,7 @@ var DataIntegrityProof = class {
|
|
|
13192
13193
|
if ("proofValue" in values && values.proofValue != null) if (values.proofValue instanceof Uint8Array) clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = [values.proofValue];
|
|
13193
13194
|
else throw new TypeError("The proofValue must be of type Uint8Array.");
|
|
13194
13195
|
clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
|
|
13195
|
-
if ("created" in values && values.created != null) if (values.created
|
|
13196
|
+
if ("created" in values && values.created != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.created)) clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
13196
13197
|
else throw new TypeError("The created must be of type Temporal.Instant.");
|
|
13197
13198
|
return clone;
|
|
13198
13199
|
}
|
|
@@ -40032,7 +40033,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
40032
40033
|
this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = values.inclusiveOptions;
|
|
40033
40034
|
for (let i = 0; i < values.inclusiveOptions.length; i++) this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i);
|
|
40034
40035
|
} else throw new TypeError("The inclusiveOptions must be an array of type Object | URL.");
|
|
40035
|
-
if ("closed" in values && values.closed != null) if (values.closed
|
|
40036
|
+
if ("closed" in values && values.closed != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.closed) || typeof values.closed === "boolean") this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
40036
40037
|
else throw new TypeError("The closed must be of type Temporal.Instant | boolean.");
|
|
40037
40038
|
if ("voters" in values && values.voters != null) if (typeof values.voters === "number" && Number.isInteger(values.voters) && values.voters >= 0) this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = [values.voters];
|
|
40038
40039
|
else throw new TypeError("The voters must be of type number.");
|
|
@@ -40077,7 +40078,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
40077
40078
|
for (let i = 0; i < values.inclusiveOptions.length; i++) clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i);
|
|
40078
40079
|
} else throw new TypeError("The inclusiveOptions must be an array of type Object | URL.");
|
|
40079
40080
|
clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
|
|
40080
|
-
if ("closed" in values && values.closed != null) if (values.closed
|
|
40081
|
+
if ("closed" in values && values.closed != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.closed) || typeof values.closed === "boolean") clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
40081
40082
|
else throw new TypeError("The closed must be of type Temporal.Instant | boolean.");
|
|
40082
40083
|
clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount;
|
|
40083
40084
|
if ("voters" in values && values.voters != null) if (typeof values.voters === "number" && Number.isInteger(values.voters) && values.voters >= 0) clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = [values.voters];
|
|
@@ -40655,7 +40656,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
40655
40656
|
if (array.length > 0) values["https://www.w3.org/ns/activitystreams#anyOf"] = array;
|
|
40656
40657
|
array = [];
|
|
40657
40658
|
for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
|
|
40658
|
-
const element =
|
|
40659
|
+
const element = (0, _fedify_vocab_runtime_temporal.isTemporalInstant)(v) ? {
|
|
40659
40660
|
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
|
40660
40661
|
"@value": v.toString()
|
|
40661
40662
|
} : { "@value": v };
|
|
@@ -46095,7 +46096,7 @@ var Tombstone = class Tombstone extends Object$1 {
|
|
|
46095
46096
|
if (Array.isArray(values.formerTypes) && values.formerTypes.every((v) => isEntityType(v))) this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = values.formerTypes;
|
|
46096
46097
|
else throw new TypeError("The formerTypes must be an array of type $EntityType.");
|
|
46097
46098
|
}
|
|
46098
|
-
if ("deleted" in values && values.deleted != null) if (values.deleted
|
|
46099
|
+
if ("deleted" in values && values.deleted != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.deleted)) this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
46099
46100
|
else throw new TypeError("The deleted must be of type Temporal.Instant.");
|
|
46100
46101
|
}
|
|
46101
46102
|
/**
|
|
@@ -46122,7 +46123,7 @@ var Tombstone = class Tombstone extends Object$1 {
|
|
|
46122
46123
|
else throw new TypeError("The formerTypes must be an array of type $EntityType.");
|
|
46123
46124
|
}
|
|
46124
46125
|
clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
|
|
46125
|
-
if ("deleted" in values && values.deleted != null) if (values.deleted
|
|
46126
|
+
if ("deleted" in values && values.deleted != null) if ((0, _fedify_vocab_runtime_temporal.isTemporalInstant)(values.deleted)) clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
46126
46127
|
else throw new TypeError("The deleted must be of type Temporal.Instant.");
|
|
46127
46128
|
return clone;
|
|
46128
46129
|
}
|
package/dist/mod.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
1
2
|
import { Decimal, DocumentLoader, DocumentLoader as DocumentLoader$1, GetUserAgentOptions, GetUserAgentOptions as GetUserAgentOptions$1, LanguageString, LanguageString as LanguageString$1, RemoteDocument } from "@fedify/vocab-runtime";
|
|
2
3
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
|
3
4
|
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { Span, TracerProvider } from "@opentelemetry/api";
|
|
3
3
|
import { Decimal, DocumentLoader, DocumentLoader as DocumentLoader$1, GetUserAgentOptions, GetUserAgentOptions as GetUserAgentOptions$1, LanguageString, LanguageString as LanguageString$1, RemoteDocument } from "@fedify/vocab-runtime";
|
|
4
4
|
|
package/dist/mod.js
CHANGED
|
@@ -5,10 +5,11 @@ import { domainToASCII, domainToUnicode } from "node:url";
|
|
|
5
5
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { LanguageString, LanguageString as LanguageString$1, decodeMultibase, encodeMultibase, exportMultibaseKey, exportSpki, getDocumentLoader, importMultibaseKey, importPem, isDecimal, parseDecimal } from "@fedify/vocab-runtime";
|
|
8
|
+
import { isTemporalDuration, isTemporalInstant } from "@fedify/vocab-runtime/temporal";
|
|
8
9
|
import { delay } from "es-toolkit";
|
|
9
10
|
//#region deno.json
|
|
10
11
|
var name = "@fedify/vocab";
|
|
11
|
-
var version = "2.3.0-dev.
|
|
12
|
+
var version = "2.3.0-dev.1110+3ba84466";
|
|
12
13
|
//#endregion
|
|
13
14
|
//#region src/type.ts
|
|
14
15
|
function getTypeId(object) {
|
|
@@ -170,7 +171,7 @@ var Object$1 = class Object$1 {
|
|
|
170
171
|
if (Array.isArray(values.names) && values.names.every((v) => typeof v === "string" || v instanceof LanguageString$1)) this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names;
|
|
171
172
|
else throw new TypeError("The names must be an array of type string | LanguageString.");
|
|
172
173
|
}
|
|
173
|
-
if ("endTime" in values && values.endTime != null) if (values.endTime
|
|
174
|
+
if ("endTime" in values && values.endTime != null) if (isTemporalInstant(values.endTime)) this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
|
|
174
175
|
else throw new TypeError("The endTime must be of type Temporal.Instant.");
|
|
175
176
|
if ("generators" in values && values.generators != null) if (Array.isArray(values.generators) && values.generators.every((v) => v instanceof Object$1 || v instanceof Link || v instanceof URL)) {
|
|
176
177
|
this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators;
|
|
@@ -231,7 +232,7 @@ var Object$1 = class Object$1 {
|
|
|
231
232
|
for (let i = 0; i < values.previews.length; i++) this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i);
|
|
232
233
|
} else throw new TypeError("The previews must be an array of type Link | Object | URL.");
|
|
233
234
|
}
|
|
234
|
-
if ("published" in values && values.published != null) if (values.published
|
|
235
|
+
if ("published" in values && values.published != null) if (isTemporalInstant(values.published)) this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
|
|
235
236
|
else throw new TypeError("The published must be of type Temporal.Instant.");
|
|
236
237
|
if ("replies" in values && values.replies != null) if (values.replies instanceof Collection || values.replies instanceof URL) {
|
|
237
238
|
this.#_7UpwM3JWcXhADcscukEehBorf6k_replies = [values.replies];
|
|
@@ -249,7 +250,7 @@ var Object$1 = class Object$1 {
|
|
|
249
250
|
this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = [values.emojiReactions];
|
|
250
251
|
this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.add(0);
|
|
251
252
|
} else throw new TypeError("The emojiReactions must be of type Collection | URL.");
|
|
252
|
-
if ("startTime" in values && values.startTime != null) if (values.startTime
|
|
253
|
+
if ("startTime" in values && values.startTime != null) if (isTemporalInstant(values.startTime)) this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
|
|
253
254
|
else throw new TypeError("The startTime must be of type Temporal.Instant.");
|
|
254
255
|
if ("summary" in values && values.summary != null) if (typeof values.summary === "string" || values.summary instanceof LanguageString$1) this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = [values.summary];
|
|
255
256
|
else throw new TypeError("The summary must be of type string | LanguageString.");
|
|
@@ -262,7 +263,7 @@ var Object$1 = class Object$1 {
|
|
|
262
263
|
this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags;
|
|
263
264
|
for (let i = 0; i < values.tags.length; i++) this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i);
|
|
264
265
|
} else throw new TypeError("The tags must be an array of type Object | Link | URL.");
|
|
265
|
-
if ("updated" in values && values.updated != null) if (values.updated
|
|
266
|
+
if ("updated" in values && values.updated != null) if (isTemporalInstant(values.updated)) this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
|
|
266
267
|
else throw new TypeError("The updated must be of type Temporal.Instant.");
|
|
267
268
|
if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
|
|
268
269
|
else throw new TypeError("The url must be of type URL | Link.");
|
|
@@ -317,7 +318,7 @@ var Object$1 = class Object$1 {
|
|
|
317
318
|
}
|
|
318
319
|
if ("mediaType" in values && values.mediaType != null) if (typeof values.mediaType === "string") this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = [values.mediaType];
|
|
319
320
|
else throw new TypeError("The mediaType must be of type string.");
|
|
320
|
-
if ("duration" in values && values.duration != null) if (values.duration
|
|
321
|
+
if ("duration" in values && values.duration != null) if (isTemporalDuration(values.duration)) this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
|
|
321
322
|
else throw new TypeError("The duration must be of type Temporal.Duration.");
|
|
322
323
|
if ("sensitive" in values && values.sensitive != null) if (typeof values.sensitive === "boolean") this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = [values.sensitive];
|
|
323
324
|
else throw new TypeError("The sensitive must be of type boolean.");
|
|
@@ -425,7 +426,7 @@ var Object$1 = class Object$1 {
|
|
|
425
426
|
else throw new TypeError("The names must be an array of type string | LanguageString.");
|
|
426
427
|
}
|
|
427
428
|
clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime;
|
|
428
|
-
if ("endTime" in values && values.endTime != null) if (values.endTime
|
|
429
|
+
if ("endTime" in values && values.endTime != null) if (isTemporalInstant(values.endTime)) clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
|
|
429
430
|
else throw new TypeError("The endTime must be of type Temporal.Instant.");
|
|
430
431
|
clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator;
|
|
431
432
|
clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = new Set(this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator);
|
|
@@ -505,7 +506,7 @@ var Object$1 = class Object$1 {
|
|
|
505
506
|
} else throw new TypeError("The previews must be an array of type Link | Object | URL.");
|
|
506
507
|
}
|
|
507
508
|
clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published;
|
|
508
|
-
if ("published" in values && values.published != null) if (values.published
|
|
509
|
+
if ("published" in values && values.published != null) if (isTemporalInstant(values.published)) clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
|
|
509
510
|
else throw new TypeError("The published must be of type Temporal.Instant.");
|
|
510
511
|
clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies;
|
|
511
512
|
clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set(this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies);
|
|
@@ -532,7 +533,7 @@ var Object$1 = class Object$1 {
|
|
|
532
533
|
clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set([0]);
|
|
533
534
|
} else throw new TypeError("The emojiReactions must be of type Collection | URL.");
|
|
534
535
|
clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime;
|
|
535
|
-
if ("startTime" in values && values.startTime != null) if (values.startTime
|
|
536
|
+
if ("startTime" in values && values.startTime != null) if (isTemporalInstant(values.startTime)) clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
|
|
536
537
|
else throw new TypeError("The startTime must be of type Temporal.Instant.");
|
|
537
538
|
clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary;
|
|
538
539
|
if ("summary" in values && values.summary != null) if (typeof values.summary === "string" || values.summary instanceof LanguageString$1) clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = [values.summary];
|
|
@@ -550,7 +551,7 @@ var Object$1 = class Object$1 {
|
|
|
550
551
|
for (let i = 0; i < values.tags.length; i++) clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i);
|
|
551
552
|
} else throw new TypeError("The tags must be an array of type Object | Link | URL.");
|
|
552
553
|
clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated;
|
|
553
|
-
if ("updated" in values && values.updated != null) if (values.updated
|
|
554
|
+
if ("updated" in values && values.updated != null) if (isTemporalInstant(values.updated)) clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
|
|
554
555
|
else throw new TypeError("The updated must be of type Temporal.Instant.");
|
|
555
556
|
clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
556
557
|
if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
|
|
@@ -620,7 +621,7 @@ var Object$1 = class Object$1 {
|
|
|
620
621
|
if ("mediaType" in values && values.mediaType != null) if (typeof values.mediaType === "string") clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = [values.mediaType];
|
|
621
622
|
else throw new TypeError("The mediaType must be of type string.");
|
|
622
623
|
clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration;
|
|
623
|
-
if ("duration" in values && values.duration != null) if (values.duration
|
|
624
|
+
if ("duration" in values && values.duration != null) if (isTemporalDuration(values.duration)) clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
|
|
624
625
|
else throw new TypeError("The duration must be of type Temporal.Duration.");
|
|
625
626
|
clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive;
|
|
626
627
|
if ("sensitive" in values && values.sensitive != null) if (typeof values.sensitive === "boolean") clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = [values.sensitive];
|
|
@@ -13134,7 +13135,7 @@ var DataIntegrityProof = class {
|
|
|
13134
13135
|
else throw new TypeError("The proofPurpose must be of type \"assertionMethod\" | \"authentication\" | \"capabilityInvocation\" | \"capabilityDelegation\" | \"keyAgreement\".");
|
|
13135
13136
|
if ("proofValue" in values && values.proofValue != null) if (values.proofValue instanceof Uint8Array) this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = [values.proofValue];
|
|
13136
13137
|
else throw new TypeError("The proofValue must be of type Uint8Array.");
|
|
13137
|
-
if ("created" in values && values.created != null) if (values.created
|
|
13138
|
+
if ("created" in values && values.created != null) if (isTemporalInstant(values.created)) this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
13138
13139
|
else throw new TypeError("The created must be of type Temporal.Instant.");
|
|
13139
13140
|
}
|
|
13140
13141
|
/**
|
|
@@ -13168,7 +13169,7 @@ var DataIntegrityProof = class {
|
|
|
13168
13169
|
if ("proofValue" in values && values.proofValue != null) if (values.proofValue instanceof Uint8Array) clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = [values.proofValue];
|
|
13169
13170
|
else throw new TypeError("The proofValue must be of type Uint8Array.");
|
|
13170
13171
|
clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
|
|
13171
|
-
if ("created" in values && values.created != null) if (values.created
|
|
13172
|
+
if ("created" in values && values.created != null) if (isTemporalInstant(values.created)) clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
13172
13173
|
else throw new TypeError("The created must be of type Temporal.Instant.");
|
|
13173
13174
|
return clone;
|
|
13174
13175
|
}
|
|
@@ -40008,7 +40009,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
40008
40009
|
this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = values.inclusiveOptions;
|
|
40009
40010
|
for (let i = 0; i < values.inclusiveOptions.length; i++) this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i);
|
|
40010
40011
|
} else throw new TypeError("The inclusiveOptions must be an array of type Object | URL.");
|
|
40011
|
-
if ("closed" in values && values.closed != null) if (values.closed
|
|
40012
|
+
if ("closed" in values && values.closed != null) if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
40012
40013
|
else throw new TypeError("The closed must be of type Temporal.Instant | boolean.");
|
|
40013
40014
|
if ("voters" in values && values.voters != null) if (typeof values.voters === "number" && Number.isInteger(values.voters) && values.voters >= 0) this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = [values.voters];
|
|
40014
40015
|
else throw new TypeError("The voters must be of type number.");
|
|
@@ -40053,7 +40054,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
40053
40054
|
for (let i = 0; i < values.inclusiveOptions.length; i++) clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i);
|
|
40054
40055
|
} else throw new TypeError("The inclusiveOptions must be an array of type Object | URL.");
|
|
40055
40056
|
clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
|
|
40056
|
-
if ("closed" in values && values.closed != null) if (values.closed
|
|
40057
|
+
if ("closed" in values && values.closed != null) if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
40057
40058
|
else throw new TypeError("The closed must be of type Temporal.Instant | boolean.");
|
|
40058
40059
|
clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount;
|
|
40059
40060
|
if ("voters" in values && values.voters != null) if (typeof values.voters === "number" && Number.isInteger(values.voters) && values.voters >= 0) clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = [values.voters];
|
|
@@ -40631,7 +40632,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
40631
40632
|
if (array.length > 0) values["https://www.w3.org/ns/activitystreams#anyOf"] = array;
|
|
40632
40633
|
array = [];
|
|
40633
40634
|
for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
|
|
40634
|
-
const element = v
|
|
40635
|
+
const element = isTemporalInstant(v) ? {
|
|
40635
40636
|
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
|
40636
40637
|
"@value": v.toString()
|
|
40637
40638
|
} : { "@value": v };
|
|
@@ -46071,7 +46072,7 @@ var Tombstone = class Tombstone extends Object$1 {
|
|
|
46071
46072
|
if (Array.isArray(values.formerTypes) && values.formerTypes.every((v) => isEntityType(v))) this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = values.formerTypes;
|
|
46072
46073
|
else throw new TypeError("The formerTypes must be an array of type $EntityType.");
|
|
46073
46074
|
}
|
|
46074
|
-
if ("deleted" in values && values.deleted != null) if (values.deleted
|
|
46075
|
+
if ("deleted" in values && values.deleted != null) if (isTemporalInstant(values.deleted)) this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
46075
46076
|
else throw new TypeError("The deleted must be of type Temporal.Instant.");
|
|
46076
46077
|
}
|
|
46077
46078
|
/**
|
|
@@ -46098,7 +46099,7 @@ var Tombstone = class Tombstone extends Object$1 {
|
|
|
46098
46099
|
else throw new TypeError("The formerTypes must be an array of type $EntityType.");
|
|
46099
46100
|
}
|
|
46100
46101
|
clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
|
|
46101
|
-
if ("deleted" in values && values.deleted != null) if (values.deleted
|
|
46102
|
+
if ("deleted" in values && values.deleted != null) if (isTemporalInstant(values.deleted)) clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
46102
46103
|
else throw new TypeError("The deleted must be of type Temporal.Instant.");
|
|
46103
46104
|
return clone;
|
|
46104
46105
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { j as __exportAll, r as Application, u as Group, v as Organization, w as Service, y as Person } from "./vocab-
|
|
4
|
-
import { n as version, r as esm_default, t as name } from "./deno-
|
|
3
|
+
import { j as __exportAll, r as Application, u as Group, v as Organization, w as Service, y as Person } from "./vocab-B0Z-tH4q.mjs";
|
|
4
|
+
import { n as version, r as esm_default, t as name } from "./deno-CR37lL9i.mjs";
|
|
5
5
|
import { t as getTypeId } from "./type-Cf-vxmre.mjs";
|
|
6
6
|
import { test } from "@fedify/fixture";
|
|
7
7
|
import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { A as __commonJSMin, M as __toESM } from "./vocab-
|
|
3
|
+
import { A as __commonJSMin, M as __toESM } from "./vocab-B0Z-tH4q.mjs";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region ../../node_modules/.pnpm/regexparam@3.0.0/node_modules/regexparam/dist/index.mjs
|
|
6
6
|
var import_glob_to_regexp = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -1202,6 +1202,6 @@ var esm_default = new class FetchMock {
|
|
|
1202
1202
|
//#endregion
|
|
1203
1203
|
//#region deno.json
|
|
1204
1204
|
var name = "@fedify/vocab";
|
|
1205
|
-
var version = "2.3.0-dev.
|
|
1205
|
+
var version = "2.3.0-dev.1110+3ba84466";
|
|
1206
1206
|
//#endregion
|
|
1207
1207
|
export { version as n, esm_default as r, name as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { g as Object$1, h as Note, i as Collection, y as Person } from "./vocab-
|
|
4
|
-
import { n as version, r as esm_default, t as name } from "./deno-
|
|
3
|
+
import { g as Object$1, h as Note, i as Collection, y as Person } from "./vocab-B0Z-tH4q.mjs";
|
|
4
|
+
import { n as version, r as esm_default, t as name } from "./deno-CR37lL9i.mjs";
|
|
5
5
|
import { t as getTypeId } from "./type-Cf-vxmre.mjs";
|
|
6
6
|
import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
|
|
7
7
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
package/dist-tests/type.test.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { D as getEntityTypeById, O as isEntityType, m as Link, y as Person } from "./vocab-
|
|
3
|
+
import { D as getEntityTypeById, O as isEntityType, m as Link, y as Person } from "./vocab-B0Z-tH4q.mjs";
|
|
4
4
|
import { t as getTypeId } from "./type-Cf-vxmre.mjs";
|
|
5
5
|
import { test } from "@fedify/fixture";
|
|
6
6
|
import { deepStrictEqual } from "node:assert/strict";
|
|
@@ -4,6 +4,7 @@ import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
|
4
4
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
|
6
6
|
import { LanguageString, decodeMultibase, encodeMultibase, exportMultibaseKey, exportSpki, getDocumentLoader, importMultibaseKey, importPem, isDecimal, parseDecimal } from "@fedify/vocab-runtime";
|
|
7
|
+
import { isTemporalDuration, isTemporalInstant } from "@fedify/vocab-runtime/temporal";
|
|
7
8
|
//#region \0rolldown/runtime.js
|
|
8
9
|
var __create = Object.create;
|
|
9
10
|
var __defProp = Object.defineProperty;
|
|
@@ -273,7 +274,7 @@ var Object$1 = class Object$1 {
|
|
|
273
274
|
if (Array.isArray(values.names) && values.names.every((v) => typeof v === "string" || v instanceof LanguageString)) this.#_4ZHbBuK7PrsvGgrjM8wgc6KMWjav_name = values.names;
|
|
274
275
|
else throw new TypeError("The names must be an array of type string | LanguageString.");
|
|
275
276
|
}
|
|
276
|
-
if ("endTime" in values && values.endTime != null) if (values.endTime
|
|
277
|
+
if ("endTime" in values && values.endTime != null) if (isTemporalInstant(values.endTime)) this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
|
|
277
278
|
else throw new TypeError("The endTime must be of type Temporal.Instant.");
|
|
278
279
|
if ("generators" in values && values.generators != null) if (Array.isArray(values.generators) && values.generators.every((v) => v instanceof Object$1 || v instanceof Link || v instanceof URL)) {
|
|
279
280
|
this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = values.generators;
|
|
@@ -334,7 +335,7 @@ var Object$1 = class Object$1 {
|
|
|
334
335
|
for (let i = 0; i < values.previews.length; i++) this.#_trust_gCVTegXxWWCw6wWRxa1QF65zusg_preview.add(i);
|
|
335
336
|
} else throw new TypeError("The previews must be an array of type Link | Object | URL.");
|
|
336
337
|
}
|
|
337
|
-
if ("published" in values && values.published != null) if (values.published
|
|
338
|
+
if ("published" in values && values.published != null) if (isTemporalInstant(values.published)) this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
|
|
338
339
|
else throw new TypeError("The published must be of type Temporal.Instant.");
|
|
339
340
|
if ("replies" in values && values.replies != null) if (values.replies instanceof Collection || values.replies instanceof URL) {
|
|
340
341
|
this.#_7UpwM3JWcXhADcscukEehBorf6k_replies = [values.replies];
|
|
@@ -352,7 +353,7 @@ var Object$1 = class Object$1 {
|
|
|
352
353
|
this.#_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = [values.emojiReactions];
|
|
353
354
|
this.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions.add(0);
|
|
354
355
|
} else throw new TypeError("The emojiReactions must be of type Collection | URL.");
|
|
355
|
-
if ("startTime" in values && values.startTime != null) if (values.startTime
|
|
356
|
+
if ("startTime" in values && values.startTime != null) if (isTemporalInstant(values.startTime)) this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
|
|
356
357
|
else throw new TypeError("The startTime must be of type Temporal.Instant.");
|
|
357
358
|
if ("summary" in values && values.summary != null) if (typeof values.summary === "string" || values.summary instanceof LanguageString) this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = [values.summary];
|
|
358
359
|
else throw new TypeError("The summary must be of type string | LanguageString.");
|
|
@@ -365,7 +366,7 @@ var Object$1 = class Object$1 {
|
|
|
365
366
|
this.#_5chuqj6s95p5gg2sk1HntGfarRf_tag = values.tags;
|
|
366
367
|
for (let i = 0; i < values.tags.length; i++) this.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i);
|
|
367
368
|
} else throw new TypeError("The tags must be an array of type Object | Link | URL.");
|
|
368
|
-
if ("updated" in values && values.updated != null) if (values.updated
|
|
369
|
+
if ("updated" in values && values.updated != null) if (isTemporalInstant(values.updated)) this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
|
|
369
370
|
else throw new TypeError("The updated must be of type Temporal.Instant.");
|
|
370
371
|
if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
|
|
371
372
|
else throw new TypeError("The url must be of type URL | Link.");
|
|
@@ -420,7 +421,7 @@ var Object$1 = class Object$1 {
|
|
|
420
421
|
}
|
|
421
422
|
if ("mediaType" in values && values.mediaType != null) if (typeof values.mediaType === "string") this.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = [values.mediaType];
|
|
422
423
|
else throw new TypeError("The mediaType must be of type string.");
|
|
423
|
-
if ("duration" in values && values.duration != null) if (values.duration
|
|
424
|
+
if ("duration" in values && values.duration != null) if (isTemporalDuration(values.duration)) this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
|
|
424
425
|
else throw new TypeError("The duration must be of type Temporal.Duration.");
|
|
425
426
|
if ("sensitive" in values && values.sensitive != null) if (typeof values.sensitive === "boolean") this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = [values.sensitive];
|
|
426
427
|
else throw new TypeError("The sensitive must be of type boolean.");
|
|
@@ -528,7 +529,7 @@ var Object$1 = class Object$1 {
|
|
|
528
529
|
else throw new TypeError("The names must be an array of type string | LanguageString.");
|
|
529
530
|
}
|
|
530
531
|
clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = this.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime;
|
|
531
|
-
if ("endTime" in values && values.endTime != null) if (values.endTime
|
|
532
|
+
if ("endTime" in values && values.endTime != null) if (isTemporalInstant(values.endTime)) clone.#_219RwDanjScTv5tYCjwGZVCM7KZ9_endTime = [values.endTime];
|
|
532
533
|
else throw new TypeError("The endTime must be of type Temporal.Instant.");
|
|
533
534
|
clone.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator = this.#_86xFhmgBapoMvYqjbjRuDPayTrS_generator;
|
|
534
535
|
clone.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator = new Set(this.#_trust_86xFhmgBapoMvYqjbjRuDPayTrS_generator);
|
|
@@ -608,7 +609,7 @@ var Object$1 = class Object$1 {
|
|
|
608
609
|
} else throw new TypeError("The previews must be an array of type Link | Object | URL.");
|
|
609
610
|
}
|
|
610
611
|
clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = this.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published;
|
|
611
|
-
if ("published" in values && values.published != null) if (values.published
|
|
612
|
+
if ("published" in values && values.published != null) if (isTemporalInstant(values.published)) clone.#_5e258TDXtuhaFRPZiGoDfEpjdMr_published = [values.published];
|
|
612
613
|
else throw new TypeError("The published must be of type Temporal.Instant.");
|
|
613
614
|
clone.#_7UpwM3JWcXhADcscukEehBorf6k_replies = this.#_7UpwM3JWcXhADcscukEehBorf6k_replies;
|
|
614
615
|
clone.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies = new Set(this.#_trust_7UpwM3JWcXhADcscukEehBorf6k_replies);
|
|
@@ -635,7 +636,7 @@ var Object$1 = class Object$1 {
|
|
|
635
636
|
clone.#_trust_kMatyyNAuxoTD8GQMBfA5ogThMR_emojiReactions = new Set([0]);
|
|
636
637
|
} else throw new TypeError("The emojiReactions must be of type Collection | URL.");
|
|
637
638
|
clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = this.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime;
|
|
638
|
-
if ("startTime" in values && values.startTime != null) if (values.startTime
|
|
639
|
+
if ("startTime" in values && values.startTime != null) if (isTemporalInstant(values.startTime)) clone.#_2w3Jmue4up8iVDUA51WZqomEF438_startTime = [values.startTime];
|
|
639
640
|
else throw new TypeError("The startTime must be of type Temporal.Instant.");
|
|
640
641
|
clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = this.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary;
|
|
641
642
|
if ("summary" in values && values.summary != null) if (typeof values.summary === "string" || values.summary instanceof LanguageString) clone.#_4LqirZspQbFWWQEbFcXAxm7tTDN1_summary = [values.summary];
|
|
@@ -653,7 +654,7 @@ var Object$1 = class Object$1 {
|
|
|
653
654
|
for (let i = 0; i < values.tags.length; i++) clone.#_trust_5chuqj6s95p5gg2sk1HntGfarRf_tag.add(i);
|
|
654
655
|
} else throw new TypeError("The tags must be an array of type Object | Link | URL.");
|
|
655
656
|
clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = this.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated;
|
|
656
|
-
if ("updated" in values && values.updated != null) if (values.updated
|
|
657
|
+
if ("updated" in values && values.updated != null) if (isTemporalInstant(values.updated)) clone.#_385aB7ySixcf5Un6z3VsWmThgCzQ_updated = [values.updated];
|
|
657
658
|
else throw new TypeError("The updated must be of type Temporal.Instant.");
|
|
658
659
|
clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = this.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url;
|
|
659
660
|
if ("url" in values && values.url != null) if (values.url instanceof URL || values.url instanceof Link) clone.#_2oPEH9MQ3aj8JVwyYuWkqoVwV865_url = [values.url];
|
|
@@ -723,7 +724,7 @@ var Object$1 = class Object$1 {
|
|
|
723
724
|
if ("mediaType" in values && values.mediaType != null) if (typeof values.mediaType === "string") clone.#_3BLrzmscsjHCw8TF5BHRW9WkPnX8_mediaType = [values.mediaType];
|
|
724
725
|
else throw new TypeError("The mediaType must be of type string.");
|
|
725
726
|
clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = this.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration;
|
|
726
|
-
if ("duration" in values && values.duration != null) if (values.duration
|
|
727
|
+
if ("duration" in values && values.duration != null) if (isTemporalDuration(values.duration)) clone.#_3bNvLMBN1bCJETiTihM3wvi1B2JX_duration = [values.duration];
|
|
727
728
|
else throw new TypeError("The duration must be of type Temporal.Duration.");
|
|
728
729
|
clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = this.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive;
|
|
729
730
|
if ("sensitive" in values && values.sensitive != null) if (typeof values.sensitive === "boolean") clone.#_u8gdcDTtChQ4tbSQMXc4cYWyum7_sensitive = [values.sensitive];
|
|
@@ -13237,7 +13238,7 @@ var DataIntegrityProof = class {
|
|
|
13237
13238
|
else throw new TypeError("The proofPurpose must be of type \"assertionMethod\" | \"authentication\" | \"capabilityInvocation\" | \"capabilityDelegation\" | \"keyAgreement\".");
|
|
13238
13239
|
if ("proofValue" in values && values.proofValue != null) if (values.proofValue instanceof Uint8Array) this.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = [values.proofValue];
|
|
13239
13240
|
else throw new TypeError("The proofValue must be of type Uint8Array.");
|
|
13240
|
-
if ("created" in values && values.created != null) if (values.created
|
|
13241
|
+
if ("created" in values && values.created != null) if (isTemporalInstant(values.created)) this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
13241
13242
|
else throw new TypeError("The created must be of type Temporal.Instant.");
|
|
13242
13243
|
}
|
|
13243
13244
|
/**
|
|
@@ -13271,7 +13272,7 @@ var DataIntegrityProof = class {
|
|
|
13271
13272
|
if ("proofValue" in values && values.proofValue != null) if (values.proofValue instanceof Uint8Array) clone.#_3CjFK5vfKpX4HQuNh2b18TykoVLq_proofValue = [values.proofValue];
|
|
13272
13273
|
else throw new TypeError("The proofValue must be of type Uint8Array.");
|
|
13273
13274
|
clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = this.#_3qzP3ukEZoUziK5FEiA1RhU4aqac;
|
|
13274
|
-
if ("created" in values && values.created != null) if (values.created
|
|
13275
|
+
if ("created" in values && values.created != null) if (isTemporalInstant(values.created)) clone.#_3qzP3ukEZoUziK5FEiA1RhU4aqac = [values.created];
|
|
13275
13276
|
else throw new TypeError("The created must be of type Temporal.Instant.");
|
|
13276
13277
|
return clone;
|
|
13277
13278
|
}
|
|
@@ -40111,7 +40112,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
40111
40112
|
this.#_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf = values.inclusiveOptions;
|
|
40112
40113
|
for (let i = 0; i < values.inclusiveOptions.length; i++) this.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i);
|
|
40113
40114
|
} else throw new TypeError("The inclusiveOptions must be an array of type Object | URL.");
|
|
40114
|
-
if ("closed" in values && values.closed != null) if (values.closed
|
|
40115
|
+
if ("closed" in values && values.closed != null) if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
40115
40116
|
else throw new TypeError("The closed must be of type Temporal.Instant | boolean.");
|
|
40116
40117
|
if ("voters" in values && values.voters != null) if (typeof values.voters === "number" && Number.isInteger(values.voters) && values.voters >= 0) this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = [values.voters];
|
|
40117
40118
|
else throw new TypeError("The voters must be of type number.");
|
|
@@ -40156,7 +40157,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
40156
40157
|
for (let i = 0; i < values.inclusiveOptions.length; i++) clone.#_trust_2mV6isMTPRKbWdLCjcpiEysq5dAY_anyOf.add(i);
|
|
40157
40158
|
} else throw new TypeError("The inclusiveOptions must be an array of type Object | URL.");
|
|
40158
40159
|
clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed;
|
|
40159
|
-
if ("closed" in values && values.closed != null) if (values.closed
|
|
40160
|
+
if ("closed" in values && values.closed != null) if (isTemporalInstant(values.closed) || typeof values.closed === "boolean") clone.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed = [values.closed];
|
|
40160
40161
|
else throw new TypeError("The closed must be of type Temporal.Instant | boolean.");
|
|
40161
40162
|
clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = this.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount;
|
|
40162
40163
|
if ("voters" in values && values.voters != null) if (typeof values.voters === "number" && Number.isInteger(values.voters) && values.voters >= 0) clone.#_3H4RdST7dxfmghccvE3rKD3KgcxG_votersCount = [values.voters];
|
|
@@ -40734,7 +40735,7 @@ var Question = class Question extends IntransitiveActivity {
|
|
|
40734
40735
|
if (array.length > 0) values["https://www.w3.org/ns/activitystreams#anyOf"] = array;
|
|
40735
40736
|
array = [];
|
|
40736
40737
|
for (const v of this.#_3KronwL8DiiKBRcJFKQPiEHm8xb6_closed) {
|
|
40737
|
-
const element = v
|
|
40738
|
+
const element = isTemporalInstant(v) ? {
|
|
40738
40739
|
"@type": "http://www.w3.org/2001/XMLSchema#dateTime",
|
|
40739
40740
|
"@value": v.toString()
|
|
40740
40741
|
} : { "@value": v };
|
|
@@ -46174,7 +46175,7 @@ var Tombstone = class Tombstone extends Object$1 {
|
|
|
46174
46175
|
if (Array.isArray(values.formerTypes) && values.formerTypes.every((v) => isEntityType(v))) this.#_Pn8kdUztYSt4nyoAkVsMcQaLo9U_formerType = values.formerTypes;
|
|
46175
46176
|
else throw new TypeError("The formerTypes must be an array of type $EntityType.");
|
|
46176
46177
|
}
|
|
46177
|
-
if ("deleted" in values && values.deleted != null) if (values.deleted
|
|
46178
|
+
if ("deleted" in values && values.deleted != null) if (isTemporalInstant(values.deleted)) this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
46178
46179
|
else throw new TypeError("The deleted must be of type Temporal.Instant.");
|
|
46179
46180
|
}
|
|
46180
46181
|
/**
|
|
@@ -46201,7 +46202,7 @@ var Tombstone = class Tombstone extends Object$1 {
|
|
|
46201
46202
|
else throw new TypeError("The formerTypes must be an array of type $EntityType.");
|
|
46202
46203
|
}
|
|
46203
46204
|
clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = this.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted;
|
|
46204
|
-
if ("deleted" in values && values.deleted != null) if (values.deleted
|
|
46205
|
+
if ("deleted" in values && values.deleted != null) if (isTemporalInstant(values.deleted)) clone.#_8g8g4LiVMhFTXskuDEqx4ascxUr_deleted = [values.deleted];
|
|
46205
46206
|
else throw new TypeError("The deleted must be of type Temporal.Instant.");
|
|
46206
46207
|
return clone;
|
|
46207
46208
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
|
-
import { C as QuoteRequest, E as Tombstone, S as QuoteAuthorization, T as Source, _ as OrderedCollectionPage, a as Create, b as Place, c as Endpoints, d as Hashtag, f as InteractionPolicy, g as Object$1, h as Note, i as Collection, k as vocab_exports, l as Follow, m as Link, n as Announce, o as CryptographicKey, p as InteractionRule, s as Delete, t as Activity, x as Question, y as Person } from "./vocab-
|
|
3
|
+
import { C as QuoteRequest, E as Tombstone, S as QuoteAuthorization, T as Source, _ as OrderedCollectionPage, a as Create, b as Place, c as Endpoints, d as Hashtag, f as InteractionPolicy, g as Object$1, h as Note, i as Collection, k as vocab_exports, l as Follow, m as Link, n as Announce, o as CryptographicKey, p as InteractionRule, s as Delete, t as Activity, x as Question, y as Person } from "./vocab-B0Z-tH4q.mjs";
|
|
4
4
|
import { t as assertInstanceOf } from "./utils-CE8Dk5hm.mjs";
|
|
5
5
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
6
6
|
import { deepStrictEqual, notDeepStrictEqual, ok, rejects, throws } from "node:assert/strict";
|
|
@@ -102,6 +102,22 @@ test("new Object()", () => {
|
|
|
102
102
|
throws(() => new Object$1({ names: "foo" }), TypeError);
|
|
103
103
|
throws(() => new Object$1({ names: ["foo", 123] }), TypeError);
|
|
104
104
|
});
|
|
105
|
+
test("new Object() accepts foreign Temporal.Instant (issue #767)", () => {
|
|
106
|
+
const foreignInstant = globalThis.Object.create(globalThis.Object.prototype, {
|
|
107
|
+
[Symbol.toStringTag]: { value: "Temporal.Instant" },
|
|
108
|
+
epochNanoseconds: { value: 0n },
|
|
109
|
+
toString: { value: () => "1970-01-01T00:00:00Z" }
|
|
110
|
+
});
|
|
111
|
+
ok(new Object$1({ published: foreignInstant }).published === foreignInstant);
|
|
112
|
+
});
|
|
113
|
+
test("Object.clone() accepts foreign Temporal.Instant (issue #767)", () => {
|
|
114
|
+
const foreignInstant = globalThis.Object.create(globalThis.Object.prototype, {
|
|
115
|
+
[Symbol.toStringTag]: { value: "Temporal.Instant" },
|
|
116
|
+
epochNanoseconds: { value: 0n },
|
|
117
|
+
toString: { value: () => "1970-01-01T00:00:00Z" }
|
|
118
|
+
});
|
|
119
|
+
ok(new Object$1({}).clone({ published: foreignInstant }).published === foreignInstant);
|
|
120
|
+
});
|
|
105
121
|
test("Object.clone()", () => {
|
|
106
122
|
const obj = new Object$1({
|
|
107
123
|
id: new URL("https://example.com/"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/vocab",
|
|
3
|
-
"version": "2.3.0-dev.
|
|
3
|
+
"version": "2.3.0-dev.1110+3ba84466",
|
|
4
4
|
"homepage": "https://fedify.dev/",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,22 +40,22 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@js-temporal/polyfill": "^0.5.1",
|
|
42
42
|
"@multiformats/base-x": "^4.0.1",
|
|
43
|
-
"@logtape/logtape": "^2.0
|
|
43
|
+
"@logtape/logtape": "^2.1.0",
|
|
44
44
|
"@opentelemetry/api": "^1.9.1",
|
|
45
45
|
"asn1js": "^3.0.10",
|
|
46
46
|
"es-toolkit": "1.46.1",
|
|
47
47
|
"jsonld": "^9.0.0",
|
|
48
48
|
"pkijs": "^3.3.3",
|
|
49
|
-
"@fedify/vocab-tools": "2.3.0-dev.
|
|
50
|
-
"@fedify/webfinger": "2.3.0-dev.
|
|
51
|
-
"@fedify/vocab-runtime": "2.3.0-dev.
|
|
49
|
+
"@fedify/vocab-tools": "2.3.0-dev.1110+3ba84466",
|
|
50
|
+
"@fedify/webfinger": "2.3.0-dev.1110+3ba84466",
|
|
51
|
+
"@fedify/vocab-runtime": "2.3.0-dev.1110+3ba84466"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^22.17.0",
|
|
55
55
|
"fast-check": "^3.22.0",
|
|
56
56
|
"fetch-mock": "^12.5.4",
|
|
57
57
|
"tsdown": "^0.22.0",
|
|
58
|
-
"typescript": "^
|
|
58
|
+
"typescript": "^6.0.0",
|
|
59
59
|
"@fedify/fixture": "2.0.0"
|
|
60
60
|
},
|
|
61
61
|
"keywords": [
|
package/src/vocab.test.ts
CHANGED
|
@@ -160,6 +160,43 @@ test("new Object()", () => {
|
|
|
160
160
|
);
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
+
test(
|
|
164
|
+
// Regression test for
|
|
165
|
+
// https://github.com/fedify-dev/fedify/issues/767:
|
|
166
|
+
// values produced by a `Temporal` implementation other than the one bundled
|
|
167
|
+
// with Fedify (e.g. Node.js 26+ native `Temporal`) must be accepted as
|
|
168
|
+
// long as they conform to the spec-mandated `Symbol.toStringTag`.
|
|
169
|
+
"new Object() accepts foreign Temporal.Instant (issue #767)",
|
|
170
|
+
() => {
|
|
171
|
+
const foreignInstant = globalThis.Object.create(
|
|
172
|
+
globalThis.Object.prototype,
|
|
173
|
+
{
|
|
174
|
+
[Symbol.toStringTag]: { value: "Temporal.Instant" },
|
|
175
|
+
epochNanoseconds: { value: 0n },
|
|
176
|
+
toString: { value: () => "1970-01-01T00:00:00Z" },
|
|
177
|
+
},
|
|
178
|
+
) as Temporal.Instant;
|
|
179
|
+
const obj = new Object({ published: foreignInstant });
|
|
180
|
+
ok(obj.published === foreignInstant);
|
|
181
|
+
},
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
test(
|
|
185
|
+
"Object.clone() accepts foreign Temporal.Instant (issue #767)",
|
|
186
|
+
() => {
|
|
187
|
+
const foreignInstant = globalThis.Object.create(
|
|
188
|
+
globalThis.Object.prototype,
|
|
189
|
+
{
|
|
190
|
+
[Symbol.toStringTag]: { value: "Temporal.Instant" },
|
|
191
|
+
epochNanoseconds: { value: 0n },
|
|
192
|
+
toString: { value: () => "1970-01-01T00:00:00Z" },
|
|
193
|
+
},
|
|
194
|
+
) as Temporal.Instant;
|
|
195
|
+
const obj = new Object({}).clone({ published: foreignInstant });
|
|
196
|
+
ok(obj.published === foreignInstant);
|
|
197
|
+
},
|
|
198
|
+
);
|
|
199
|
+
|
|
163
200
|
test("Object.clone()", () => {
|
|
164
201
|
const obj = new Object({
|
|
165
202
|
id: new URL("https://example.com/"),
|
package/tsdown.config.ts
CHANGED
|
@@ -19,17 +19,14 @@ export default [
|
|
|
19
19
|
format: ["esm", "cjs"],
|
|
20
20
|
platform: "neutral",
|
|
21
21
|
deps: { neverBundle: [/^node:/] },
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
`;
|
|
31
|
-
}
|
|
32
|
-
return outputOptions;
|
|
22
|
+
banner({ format }) {
|
|
23
|
+
const js = format === "cjs"
|
|
24
|
+
? `const { Temporal } = require("@js-temporal/polyfill");`
|
|
25
|
+
: `import { Temporal } from "@js-temporal/polyfill";`;
|
|
26
|
+
return {
|
|
27
|
+
js,
|
|
28
|
+
dts: `/// <reference lib="esnext.temporal" />`,
|
|
29
|
+
};
|
|
33
30
|
},
|
|
34
31
|
}),
|
|
35
32
|
defineConfig({
|