@fedify/vocab-runtime 2.3.0-dev.1273 → 2.3.0-dev.1280

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-runtime",
3
- "version": "2.3.0-dev.1273+6b46a8b5",
3
+ "version": "2.3.0-dev.1280+7bca39c7",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts",
package/dist/mod.cjs CHANGED
@@ -4346,7 +4346,7 @@ const preloadedContexts = {
4346
4346
  //#endregion
4347
4347
  //#region deno.json
4348
4348
  var name = "@fedify/vocab-runtime";
4349
- var version = "2.3.0-dev.1273+6b46a8b5";
4349
+ var version = "2.3.0-dev.1280+7bca39c7";
4350
4350
  //#endregion
4351
4351
  //#region src/link.ts
4352
4352
  const parametersNeedLowerCase = ["rel", "type"];
package/dist/mod.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { Logger } from "@logtape/logtape";
3
+ import { TracerProvider } from "@opentelemetry/api";
3
4
 
4
5
  //#region src/contexts.d.ts
5
6
  declare const preloadedContexts: Record<string, unknown>;
@@ -422,6 +423,39 @@ declare function decodeMultibase(data: Uint8Array | string): Uint8Array;
422
423
  */
423
424
  declare function encodingFromBaseData(data: string | Uint8Array): Base;
424
425
  //#endregion
426
+ //#region src/preprocessor.d.ts
427
+ /**
428
+ * JSON value shape passed to property preprocessors.
429
+ * @since 2.3.0
430
+ */
431
+ type Json = string | number | boolean | null | readonly Json[] | {
432
+ readonly [key: string]: Json;
433
+ };
434
+ /**
435
+ * Runtime context provided to property preprocessors.
436
+ * @since 2.3.0
437
+ */
438
+ interface PropertyPreprocessorContext {
439
+ /** Loader for remote JSON-LD documents. */
440
+ documentLoader?: DocumentLoader;
441
+ /** Loader for remote JSON-LD contexts. */
442
+ contextLoader?: DocumentLoader;
443
+ /** OpenTelemetry tracer provider for instrumentation. */
444
+ tracerProvider?: TracerProvider;
445
+ /** Base URL for resolving relative references. */
446
+ baseUrl?: URL;
447
+ }
448
+ /**
449
+ * Function signature for schema-configured property preprocessors.
450
+ *
451
+ * Receives an expanded JSON-LD property value and returns a vocabulary
452
+ * object when the value is handled, `undefined` when the value should
453
+ * fall through to the normal range decoder, or an `Error` when the value
454
+ * is recognized but cannot be converted.
455
+ * @since 2.3.0
456
+ */
457
+ type PropertyPreprocessor<T = unknown> = (value: Json, context: PropertyPreprocessorContext) => T | undefined | Error | Promise<T | undefined | Error>;
458
+ //#endregion
425
459
  //#region src/url.d.ts
426
460
  declare class UrlError extends Error {
427
461
  constructor(message: string);
@@ -434,4 +468,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
434
468
  declare function isValidPublicIPv6Address(address: string): boolean;
435
469
  declare function expandIPv6Address(address: string): string;
436
470
  //#endregion
437
- export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, LanguageString, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, preloadedContexts, validatePublicUrl };
471
+ export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, preloadedContexts, validatePublicUrl };
package/dist/mod.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { Logger } from "@logtape/logtape";
3
+ import { TracerProvider } from "@opentelemetry/api";
3
4
 
4
5
  //#region src/contexts.d.ts
5
6
  declare const preloadedContexts: Record<string, unknown>;
@@ -422,6 +423,39 @@ declare function decodeMultibase(data: Uint8Array | string): Uint8Array;
422
423
  */
423
424
  declare function encodingFromBaseData(data: string | Uint8Array): Base;
424
425
  //#endregion
426
+ //#region src/preprocessor.d.ts
427
+ /**
428
+ * JSON value shape passed to property preprocessors.
429
+ * @since 2.3.0
430
+ */
431
+ type Json = string | number | boolean | null | readonly Json[] | {
432
+ readonly [key: string]: Json;
433
+ };
434
+ /**
435
+ * Runtime context provided to property preprocessors.
436
+ * @since 2.3.0
437
+ */
438
+ interface PropertyPreprocessorContext {
439
+ /** Loader for remote JSON-LD documents. */
440
+ documentLoader?: DocumentLoader;
441
+ /** Loader for remote JSON-LD contexts. */
442
+ contextLoader?: DocumentLoader;
443
+ /** OpenTelemetry tracer provider for instrumentation. */
444
+ tracerProvider?: TracerProvider;
445
+ /** Base URL for resolving relative references. */
446
+ baseUrl?: URL;
447
+ }
448
+ /**
449
+ * Function signature for schema-configured property preprocessors.
450
+ *
451
+ * Receives an expanded JSON-LD property value and returns a vocabulary
452
+ * object when the value is handled, `undefined` when the value should
453
+ * fall through to the normal range decoder, or an `Error` when the value
454
+ * is recognized but cannot be converted.
455
+ * @since 2.3.0
456
+ */
457
+ type PropertyPreprocessor<T = unknown> = (value: Json, context: PropertyPreprocessorContext) => T | undefined | Error | Promise<T | undefined | Error>;
458
+ //#endregion
425
459
  //#region src/url.d.ts
426
460
  declare class UrlError extends Error {
427
461
  constructor(message: string);
@@ -434,4 +468,4 @@ declare function isValidPublicIPv4Address(address: string): boolean;
434
468
  declare function isValidPublicIPv6Address(address: string): boolean;
435
469
  declare function expandIPv6Address(address: string): string;
436
470
  //#endregion
437
- export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, LanguageString, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, preloadedContexts, validatePublicUrl };
471
+ export { type AuthenticatedDocumentLoaderFactory, type CreateRequestOptions, type Decimal, type DocumentLoader, type DocumentLoaderFactory, type DocumentLoaderFactoryOptions, type DocumentLoaderOptions, FetchError, type GetDocumentLoaderOptions, type GetUserAgentOptions, type Json, LanguageString, type PropertyPreprocessor, type PropertyPreprocessorContext, type RemoteDocument, UrlError, canParseDecimal, createActivityPubRequest, decodeMultibase, encodeMultibase, encodingFromBaseData, expandIPv6Address, exportMultibaseKey, exportSpki, getDocumentLoader, getRemoteDocument, getUserAgent, importMultibaseKey, importPem, importPkcs1, importSpki, isDecimal, isValidPublicIPv4Address, isValidPublicIPv6Address, logRequest, parseDecimal, preloadedContexts, validatePublicUrl };
package/dist/mod.js CHANGED
@@ -4342,7 +4342,7 @@ const preloadedContexts = {
4342
4342
  //#endregion
4343
4343
  //#region deno.json
4344
4344
  var name = "@fedify/vocab-runtime";
4345
- var version = "2.3.0-dev.1273+6b46a8b5";
4345
+ var version = "2.3.0-dev.1280+7bca39c7";
4346
4346
  //#endregion
4347
4347
  //#region src/link.ts
4348
4348
  const parametersNeedLowerCase = ["rel", "type"];
@@ -1,5 +1,5 @@
1
1
  require("./chunk-C2EiDwsr.cjs");
2
- require("./docloader-CZpfmQV5.cjs");
2
+ require("./docloader-BncEYlGn.cjs");
3
3
  require("./url-C20FhC7p.cjs");
4
4
  require("./key-pMmqUKuo.cjs");
5
5
  require("./multibase-Bz_UUDtL.cjs");
@@ -1,4 +1,4 @@
1
- import "./docloader-cKh7vj7X.mjs";
1
+ import "./docloader-Cj4nLvSv.mjs";
2
2
  import "./url-m9Qzxy-Y.mjs";
3
3
  import "./key-CrrK9mYh.mjs";
4
4
  import "./multibase-B4bvakyA.mjs";
@@ -1,5 +1,5 @@
1
1
  require("./chunk-C2EiDwsr.cjs");
2
- const require_request = require("./request-B4qs-Od5.cjs");
2
+ const require_request = require("./request--iJUBB5d.cjs");
3
3
  const require_link = require("./link-FguCydMA.cjs");
4
4
  const require_url = require("./url-C20FhC7p.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
@@ -1,4 +1,4 @@
1
- import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-Df2a150C.mjs";
1
+ import { a as name, i as logRequest, n as createActivityPubRequest, o as version, t as FetchError } from "./request-C357OI5N.mjs";
2
2
  import { t as HttpHeaderLink } from "./link-NUUWCdnK.mjs";
3
3
  import { a as validatePublicUrl, t as UrlError } from "./url-m9Qzxy-Y.mjs";
4
4
  import { getLogger } from "@logtape/logtape";
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require("./chunk-C2EiDwsr.cjs");
2
- const require_docloader = require("./docloader-CZpfmQV5.cjs");
3
- const require_request = require("./request-B4qs-Od5.cjs");
2
+ const require_docloader = require("./docloader-BncEYlGn.cjs");
3
+ const require_request = require("./request--iJUBB5d.cjs");
4
4
  const require_url = require("./url-C20FhC7p.cjs");
5
5
  let node_assert = require("node:assert");
6
6
  let node_test = require("node:test");
@@ -1,5 +1,5 @@
1
- import { n as preloadedContexts, t as getDocumentLoader } from "./docloader-cKh7vj7X.mjs";
2
- import { t as FetchError } from "./request-Df2a150C.mjs";
1
+ import { n as preloadedContexts, t as getDocumentLoader } from "./docloader-Cj4nLvSv.mjs";
2
+ import { t as FetchError } from "./request-C357OI5N.mjs";
3
3
  import { t as UrlError } from "./url-m9Qzxy-Y.mjs";
4
4
  import { deepStrictEqual, ok, rejects } from "node:assert";
5
5
  import { test } from "node:test";
@@ -3,7 +3,7 @@ let node_process = require("node:process");
3
3
  node_process = require_chunk.__toESM(node_process, 1);
4
4
  //#region deno.json
5
5
  var name = "@fedify/vocab-runtime";
6
- var version = "2.3.0-dev.1273+6b46a8b5";
6
+ var version = "2.3.0-dev.1280+7bca39c7";
7
7
  //#endregion
8
8
  //#region src/request.ts
9
9
  /**
@@ -1,7 +1,7 @@
1
1
  import process from "node:process";
2
2
  //#region deno.json
3
3
  var name = "@fedify/vocab-runtime";
4
- var version = "2.3.0-dev.1273+6b46a8b5";
4
+ var version = "2.3.0-dev.1280+7bca39c7";
5
5
  //#endregion
6
6
  //#region src/request.ts
7
7
  /**
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-C2EiDwsr.cjs");
2
- const require_request = require("./request-B4qs-Od5.cjs");
2
+ const require_request = require("./request--iJUBB5d.cjs");
3
3
  let node_assert = require("node:assert");
4
4
  let node_test = require("node:test");
5
5
  let node_process = require("node:process");
@@ -1,4 +1,4 @@
1
- import { o as version, r as getUserAgent } from "./request-Df2a150C.mjs";
1
+ import { o as version, r as getUserAgent } from "./request-C357OI5N.mjs";
2
2
  import { deepStrictEqual } from "node:assert";
3
3
  import { test } from "node:test";
4
4
  import process from "node:process";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-runtime",
3
- "version": "2.3.0-dev.1273+6b46a8b5",
3
+ "version": "2.3.0-dev.1280+7bca39c7",
4
4
  "homepage": "https://fedify.dev/",
5
5
  "repository": {
6
6
  "type": "git",
package/src/mod.ts CHANGED
@@ -44,6 +44,11 @@ export {
44
44
  type GetUserAgentOptions,
45
45
  logRequest,
46
46
  } from "./request.ts";
47
+ export {
48
+ type Json,
49
+ type PropertyPreprocessor,
50
+ type PropertyPreprocessorContext,
51
+ } from "./preprocessor.ts";
47
52
  export {
48
53
  expandIPv6Address,
49
54
  isValidPublicIPv4Address,
@@ -0,0 +1,43 @@
1
+ import type { DocumentLoader } from "./docloader.ts";
2
+ import type { TracerProvider } from "@opentelemetry/api";
3
+
4
+ /**
5
+ * JSON value shape passed to property preprocessors.
6
+ * @since 2.3.0
7
+ */
8
+ export type Json =
9
+ | string
10
+ | number
11
+ | boolean
12
+ | null
13
+ | readonly Json[]
14
+ | { readonly [key: string]: Json };
15
+
16
+ /**
17
+ * Runtime context provided to property preprocessors.
18
+ * @since 2.3.0
19
+ */
20
+ export interface PropertyPreprocessorContext {
21
+ /** Loader for remote JSON-LD documents. */
22
+ documentLoader?: DocumentLoader;
23
+ /** Loader for remote JSON-LD contexts. */
24
+ contextLoader?: DocumentLoader;
25
+ /** OpenTelemetry tracer provider for instrumentation. */
26
+ tracerProvider?: TracerProvider;
27
+ /** Base URL for resolving relative references. */
28
+ baseUrl?: URL;
29
+ }
30
+
31
+ /**
32
+ * Function signature for schema-configured property preprocessors.
33
+ *
34
+ * Receives an expanded JSON-LD property value and returns a vocabulary
35
+ * object when the value is handled, `undefined` when the value should
36
+ * fall through to the normal range decoder, or an `Error` when the value
37
+ * is recognized but cannot be converted.
38
+ * @since 2.3.0
39
+ */
40
+ export type PropertyPreprocessor<T = unknown> = (
41
+ value: Json,
42
+ context: PropertyPreprocessorContext,
43
+ ) => T | undefined | Error | Promise<T | undefined | Error>;