@fedify/vocab-tools 2.4.0-dev.2129 → 2.4.0-dev.2149
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 +42 -5
- package/dist/mod.js +42 -5
- package/package.json +1 -1
- package/src/__snapshots__/class.test.ts.deno.snap +4328 -588
- package/src/__snapshots__/class.test.ts.node.snap +4328 -588
- package/src/__snapshots__/class.test.ts.snap +4328 -588
- package/src/property.ts +41 -4
package/src/property.ts
CHANGED
|
@@ -76,6 +76,7 @@ async function* generateProperty(
|
|
|
76
76
|
crossOrigin?: "ignore" | "throw" | "trust";
|
|
77
77
|
gateways?: readonly (string | URL)[];
|
|
78
78
|
verifyPortableObject?: PortableObjectVerifier;
|
|
79
|
+
inheritPortableObjectVerifier?: boolean;
|
|
79
80
|
} = {},
|
|
80
81
|
): Promise<${getTypeNames(property.range, types)} | null> {
|
|
81
82
|
const documentLoader =
|
|
@@ -88,6 +89,12 @@ async function* generateProperty(
|
|
|
88
89
|
${JSON.stringify(metadata.name)},
|
|
89
90
|
${JSON.stringify(metadata.version)},
|
|
90
91
|
);
|
|
92
|
+
// The fetched object uses the verifier given to this call (which falls
|
|
93
|
+
// back to the parent's own default) for its accessors by default,
|
|
94
|
+
// unless the call keeps its verifier to itself:
|
|
95
|
+
const childVerifier = options.inheritPortableObjectVerifier === false
|
|
96
|
+
? this._verifyPortableObject
|
|
97
|
+
: options.verifyPortableObject;
|
|
91
98
|
return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => {
|
|
92
99
|
const dereferencePortable = async (
|
|
93
100
|
portableUrl: URL,
|
|
@@ -118,9 +125,7 @@ async function* generateProperty(
|
|
|
118
125
|
documentLoader,
|
|
119
126
|
contextLoader: parseOptions.contextLoader,
|
|
120
127
|
tracerProvider,
|
|
121
|
-
|
|
122
|
-
// verifier given to this call:
|
|
123
|
-
verifyPortableObject: this._verifyPortableObject,
|
|
128
|
+
verifyPortableObject: childVerifier,
|
|
124
129
|
baseUrl: parseOptions.baseUrl,
|
|
125
130
|
}),
|
|
126
131
|
});
|
|
@@ -200,7 +205,7 @@ async function* generateProperty(
|
|
|
200
205
|
documentLoader,
|
|
201
206
|
contextLoader: scopedContext.loader,
|
|
202
207
|
tracerProvider,
|
|
203
|
-
verifyPortableObject:
|
|
208
|
+
verifyPortableObject: childVerifier,
|
|
204
209
|
baseUrl,
|
|
205
210
|
}
|
|
206
211
|
);
|
|
@@ -395,6 +400,19 @@ async function* generateProperty(
|
|
|
395
400
|
crossOrigin?: "ignore" | "throw" | "trust";
|
|
396
401
|
gateways?: readonly (string | URL)[];
|
|
397
402
|
verifyPortableObject?: PortableObjectVerifier;
|
|
403
|
+
/**
|
|
404
|
+
* Whether objects that this call newly fetches use the
|
|
405
|
+
* \`verifyPortableObject\` option of this call as their default
|
|
406
|
+
* verifier. Defaults to \`true\`. If \`false\`, the option
|
|
407
|
+
* applies to this call only, and fetched objects use this object's
|
|
408
|
+
* own default verifier, if any, as their default instead. Pass
|
|
409
|
+
* \`false\` for a temporary verifier, e.g., one that accepts
|
|
410
|
+
* everything. Objects that were already cached in this object or
|
|
411
|
+
* embedded in it keep their defaults either way, and this option
|
|
412
|
+
* itself is not passed on.
|
|
413
|
+
* @since 2.4.0
|
|
414
|
+
*/
|
|
415
|
+
inheritPortableObjectVerifier?: boolean;
|
|
398
416
|
} = {}
|
|
399
417
|
): Promise<${getTypeNames(property.range, types)} | null> {
|
|
400
418
|
if (this._warning != null) {
|
|
@@ -463,6 +481,9 @@ async function* generateProperty(
|
|
|
463
481
|
yield `
|
|
464
482
|
v = await this.#${property.singularName}_fromJsonLd(doc, {
|
|
465
483
|
...options,
|
|
484
|
+
// Embedded objects get this object's own default, whether or
|
|
485
|
+
// not they carry their own @context, as when this object was
|
|
486
|
+
// parsed:
|
|
466
487
|
verifyPortableObject: this._verifyPortableObject,
|
|
467
488
|
baseUrl: ${cachedPropertyBaseUrl},
|
|
468
489
|
});
|
|
@@ -544,6 +565,19 @@ async function* generateProperty(
|
|
|
544
565
|
crossOrigin?: "ignore" | "throw" | "trust";
|
|
545
566
|
gateways?: readonly (string | URL)[];
|
|
546
567
|
verifyPortableObject?: PortableObjectVerifier;
|
|
568
|
+
/**
|
|
569
|
+
* Whether objects that this call newly fetches use the
|
|
570
|
+
* \`verifyPortableObject\` option of this call as their default
|
|
571
|
+
* verifier. Defaults to \`true\`. If \`false\`, the option
|
|
572
|
+
* applies to this call only, and fetched objects use this object's
|
|
573
|
+
* own default verifier, if any, as their default instead. Pass
|
|
574
|
+
* \`false\` for a temporary verifier, e.g., one that accepts
|
|
575
|
+
* everything. Objects that were already cached in this object or
|
|
576
|
+
* embedded in it keep their defaults either way, and this option
|
|
577
|
+
* itself is not passed on.
|
|
578
|
+
* @since 2.4.0
|
|
579
|
+
*/
|
|
580
|
+
inheritPortableObjectVerifier?: boolean;
|
|
547
581
|
} = {}
|
|
548
582
|
): AsyncIterable<${getTypeNames(property.range, types)}> {
|
|
549
583
|
if (this._warning != null) {
|
|
@@ -617,6 +651,9 @@ async function* generateProperty(
|
|
|
617
651
|
yield `
|
|
618
652
|
v = await this.#${property.singularName}_fromJsonLd(obj, {
|
|
619
653
|
...options,
|
|
654
|
+
// Embedded objects get this object's own default, whether or
|
|
655
|
+
// not they carry their own @context, as when this object was
|
|
656
|
+
// parsed:
|
|
620
657
|
verifyPortableObject: this._verifyPortableObject,
|
|
621
658
|
baseUrl: ${cachedPropertyBaseUrl},
|
|
622
659
|
});
|