@fedify/vocab-tools 2.4.0-dev.2127 → 2.4.0-dev.2141

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-tools",
3
- "version": "2.4.0-dev.2127+c41ce2eb",
3
+ "version": "2.4.0-dev.2141+881cc858",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts"
package/dist/mod.cjs CHANGED
@@ -8,7 +8,7 @@ let yaml = require("yaml");
8
8
  let es_toolkit = require("es-toolkit");
9
9
  //#region deno.json
10
10
  var name = "@fedify/vocab-tools";
11
- var version = "2.4.0-dev.2127+c41ce2eb";
11
+ var version = "2.4.0-dev.2141+881cc858";
12
12
  //#endregion
13
13
  //#region src/type.ts
14
14
  const HEURISTICS_CONTEXTS = [
@@ -1670,6 +1670,7 @@ async function* generateProperty(type, property, types, moduleVarNames) {
1670
1670
  crossOrigin?: "ignore" | "throw" | "trust";
1671
1671
  gateways?: readonly (string | URL)[];
1672
1672
  verifyPortableObject?: PortableObjectVerifier;
1673
+ inheritPortableObjectVerifier?: boolean;
1673
1674
  } = {},
1674
1675
  ): Promise<${getTypeNames(property.range, types)} | null> {
1675
1676
  const documentLoader =
@@ -1682,6 +1683,12 @@ async function* generateProperty(type, property, types, moduleVarNames) {
1682
1683
  ${JSON.stringify(name)},
1683
1684
  ${JSON.stringify(version)},
1684
1685
  );
1686
+ // The fetched object uses the verifier given to this call (which falls
1687
+ // back to the parent's own default) for its accessors by default,
1688
+ // unless the call keeps its verifier to itself:
1689
+ const childVerifier = options.inheritPortableObjectVerifier === false
1690
+ ? this._verifyPortableObject
1691
+ : options.verifyPortableObject;
1685
1692
  return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => {
1686
1693
  const dereferencePortable = async (
1687
1694
  portableUrl: URL,
@@ -1712,9 +1719,7 @@ async function* generateProperty(type, property, types, moduleVarNames) {
1712
1719
  documentLoader,
1713
1720
  contextLoader: parseOptions.contextLoader,
1714
1721
  tracerProvider,
1715
- // Only the parent's own default is inherited, never the
1716
- // verifier given to this call:
1717
- verifyPortableObject: this._verifyPortableObject,
1722
+ verifyPortableObject: childVerifier,
1718
1723
  baseUrl: parseOptions.baseUrl,
1719
1724
  }),
1720
1725
  });
@@ -1794,7 +1799,7 @@ async function* generateProperty(type, property, types, moduleVarNames) {
1794
1799
  documentLoader,
1795
1800
  contextLoader: scopedContext.loader,
1796
1801
  tracerProvider,
1797
- verifyPortableObject: this._verifyPortableObject,
1802
+ verifyPortableObject: childVerifier,
1798
1803
  baseUrl,
1799
1804
  }
1800
1805
  );
@@ -1975,6 +1980,19 @@ async function* generateProperty(type, property, types, moduleVarNames) {
1975
1980
  crossOrigin?: "ignore" | "throw" | "trust";
1976
1981
  gateways?: readonly (string | URL)[];
1977
1982
  verifyPortableObject?: PortableObjectVerifier;
1983
+ /**
1984
+ * Whether objects that this call newly fetches use the
1985
+ * \`verifyPortableObject\` option of this call as their default
1986
+ * verifier. Defaults to \`true\`. If \`false\`, the option
1987
+ * applies to this call only, and fetched objects use this object's
1988
+ * own default verifier, if any, as their default instead. Pass
1989
+ * \`false\` for a temporary verifier, e.g., one that accepts
1990
+ * everything. Objects that were already cached in this object or
1991
+ * embedded in it keep their defaults either way, and this option
1992
+ * itself is not passed on.
1993
+ * @since 2.4.0
1994
+ */
1995
+ inheritPortableObjectVerifier?: boolean;
1978
1996
  } = {}
1979
1997
  ): Promise<${getTypeNames(property.range, types)} | null> {
1980
1998
  if (this._warning != null) {
@@ -2039,6 +2057,9 @@ async function* generateProperty(type, property, types, moduleVarNames) {
2039
2057
  yield `
2040
2058
  v = await this.#${property.singularName}_fromJsonLd(doc, {
2041
2059
  ...options,
2060
+ // Embedded objects get this object's own default, whether or
2061
+ // not they carry their own @context, as when this object was
2062
+ // parsed:
2042
2063
  verifyPortableObject: this._verifyPortableObject,
2043
2064
  baseUrl: ${cachedPropertyBaseUrl},
2044
2065
  });
@@ -2110,6 +2131,19 @@ async function* generateProperty(type, property, types, moduleVarNames) {
2110
2131
  crossOrigin?: "ignore" | "throw" | "trust";
2111
2132
  gateways?: readonly (string | URL)[];
2112
2133
  verifyPortableObject?: PortableObjectVerifier;
2134
+ /**
2135
+ * Whether objects that this call newly fetches use the
2136
+ * \`verifyPortableObject\` option of this call as their default
2137
+ * verifier. Defaults to \`true\`. If \`false\`, the option
2138
+ * applies to this call only, and fetched objects use this object's
2139
+ * own default verifier, if any, as their default instead. Pass
2140
+ * \`false\` for a temporary verifier, e.g., one that accepts
2141
+ * everything. Objects that were already cached in this object or
2142
+ * embedded in it keep their defaults either way, and this option
2143
+ * itself is not passed on.
2144
+ * @since 2.4.0
2145
+ */
2146
+ inheritPortableObjectVerifier?: boolean;
2113
2147
  } = {}
2114
2148
  ): AsyncIterable<${getTypeNames(property.range, types)}> {
2115
2149
  if (this._warning != null) {
@@ -2179,6 +2213,9 @@ async function* generateProperty(type, property, types, moduleVarNames) {
2179
2213
  yield `
2180
2214
  v = await this.#${property.singularName}_fromJsonLd(obj, {
2181
2215
  ...options,
2216
+ // Embedded objects get this object's own default, whether or
2217
+ // not they carry their own @context, as when this object was
2218
+ // parsed:
2182
2219
  verifyPortableObject: this._verifyPortableObject,
2183
2220
  baseUrl: ${cachedPropertyBaseUrl},
2184
2221
  });
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.4.0-dev.2127+c41ce2eb";
10
+ var version = "2.4.0-dev.2141+881cc858";
11
11
  //#endregion
12
12
  //#region src/type.ts
13
13
  const HEURISTICS_CONTEXTS = [
@@ -1669,6 +1669,7 @@ async function* generateProperty(type, property, types, moduleVarNames) {
1669
1669
  crossOrigin?: "ignore" | "throw" | "trust";
1670
1670
  gateways?: readonly (string | URL)[];
1671
1671
  verifyPortableObject?: PortableObjectVerifier;
1672
+ inheritPortableObjectVerifier?: boolean;
1672
1673
  } = {},
1673
1674
  ): Promise<${getTypeNames(property.range, types)} | null> {
1674
1675
  const documentLoader =
@@ -1681,6 +1682,12 @@ async function* generateProperty(type, property, types, moduleVarNames) {
1681
1682
  ${JSON.stringify(name)},
1682
1683
  ${JSON.stringify(version)},
1683
1684
  );
1685
+ // The fetched object uses the verifier given to this call (which falls
1686
+ // back to the parent's own default) for its accessors by default,
1687
+ // unless the call keeps its verifier to itself:
1688
+ const childVerifier = options.inheritPortableObjectVerifier === false
1689
+ ? this._verifyPortableObject
1690
+ : options.verifyPortableObject;
1684
1691
  return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => {
1685
1692
  const dereferencePortable = async (
1686
1693
  portableUrl: URL,
@@ -1711,9 +1718,7 @@ async function* generateProperty(type, property, types, moduleVarNames) {
1711
1718
  documentLoader,
1712
1719
  contextLoader: parseOptions.contextLoader,
1713
1720
  tracerProvider,
1714
- // Only the parent's own default is inherited, never the
1715
- // verifier given to this call:
1716
- verifyPortableObject: this._verifyPortableObject,
1721
+ verifyPortableObject: childVerifier,
1717
1722
  baseUrl: parseOptions.baseUrl,
1718
1723
  }),
1719
1724
  });
@@ -1793,7 +1798,7 @@ async function* generateProperty(type, property, types, moduleVarNames) {
1793
1798
  documentLoader,
1794
1799
  contextLoader: scopedContext.loader,
1795
1800
  tracerProvider,
1796
- verifyPortableObject: this._verifyPortableObject,
1801
+ verifyPortableObject: childVerifier,
1797
1802
  baseUrl,
1798
1803
  }
1799
1804
  );
@@ -1974,6 +1979,19 @@ async function* generateProperty(type, property, types, moduleVarNames) {
1974
1979
  crossOrigin?: "ignore" | "throw" | "trust";
1975
1980
  gateways?: readonly (string | URL)[];
1976
1981
  verifyPortableObject?: PortableObjectVerifier;
1982
+ /**
1983
+ * Whether objects that this call newly fetches use the
1984
+ * \`verifyPortableObject\` option of this call as their default
1985
+ * verifier. Defaults to \`true\`. If \`false\`, the option
1986
+ * applies to this call only, and fetched objects use this object's
1987
+ * own default verifier, if any, as their default instead. Pass
1988
+ * \`false\` for a temporary verifier, e.g., one that accepts
1989
+ * everything. Objects that were already cached in this object or
1990
+ * embedded in it keep their defaults either way, and this option
1991
+ * itself is not passed on.
1992
+ * @since 2.4.0
1993
+ */
1994
+ inheritPortableObjectVerifier?: boolean;
1977
1995
  } = {}
1978
1996
  ): Promise<${getTypeNames(property.range, types)} | null> {
1979
1997
  if (this._warning != null) {
@@ -2038,6 +2056,9 @@ async function* generateProperty(type, property, types, moduleVarNames) {
2038
2056
  yield `
2039
2057
  v = await this.#${property.singularName}_fromJsonLd(doc, {
2040
2058
  ...options,
2059
+ // Embedded objects get this object's own default, whether or
2060
+ // not they carry their own @context, as when this object was
2061
+ // parsed:
2041
2062
  verifyPortableObject: this._verifyPortableObject,
2042
2063
  baseUrl: ${cachedPropertyBaseUrl},
2043
2064
  });
@@ -2109,6 +2130,19 @@ async function* generateProperty(type, property, types, moduleVarNames) {
2109
2130
  crossOrigin?: "ignore" | "throw" | "trust";
2110
2131
  gateways?: readonly (string | URL)[];
2111
2132
  verifyPortableObject?: PortableObjectVerifier;
2133
+ /**
2134
+ * Whether objects that this call newly fetches use the
2135
+ * \`verifyPortableObject\` option of this call as their default
2136
+ * verifier. Defaults to \`true\`. If \`false\`, the option
2137
+ * applies to this call only, and fetched objects use this object's
2138
+ * own default verifier, if any, as their default instead. Pass
2139
+ * \`false\` for a temporary verifier, e.g., one that accepts
2140
+ * everything. Objects that were already cached in this object or
2141
+ * embedded in it keep their defaults either way, and this option
2142
+ * itself is not passed on.
2143
+ * @since 2.4.0
2144
+ */
2145
+ inheritPortableObjectVerifier?: boolean;
2112
2146
  } = {}
2113
2147
  ): AsyncIterable<${getTypeNames(property.range, types)}> {
2114
2148
  if (this._warning != null) {
@@ -2178,6 +2212,9 @@ async function* generateProperty(type, property, types, moduleVarNames) {
2178
2212
  yield `
2179
2213
  v = await this.#${property.singularName}_fromJsonLd(obj, {
2180
2214
  ...options,
2215
+ // Embedded objects get this object's own default, whether or
2216
+ // not they carry their own @context, as when this object was
2217
+ // parsed:
2181
2218
  verifyPortableObject: this._verifyPortableObject,
2182
2219
  baseUrl: ${cachedPropertyBaseUrl},
2183
2220
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-tools",
3
- "version": "2.4.0-dev.2127+c41ce2eb",
3
+ "version": "2.4.0-dev.2141+881cc858",
4
4
  "description": "Code generator for Activity Vocabulary APIs",
5
5
  "homepage": "https://fedify.dev/",
6
6
  "repository": {