@fedify/vocab-runtime 2.4.0-dev.2056 → 2.4.0-dev.2065

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.
Files changed (34) hide show
  1. package/deno.json +1 -1
  2. package/dist/internal/portable-dereference.cjs +355 -8
  3. package/dist/internal/portable-dereference.d.cts +238 -6
  4. package/dist/internal/portable-dereference.d.ts +238 -6
  5. package/dist/internal/portable-dereference.js +343 -10
  6. package/dist/mod.cjs +1 -1
  7. package/dist/mod.d.cts +2 -2
  8. package/dist/mod.d.ts +2 -2
  9. package/dist/mod.js +1 -1
  10. package/dist/portable-DH3947GK.d.ts +160 -0
  11. package/dist/portable-comBI05Y.d.cts +160 -0
  12. package/dist/tests/{body-wkL-XGhe.mjs → body-CNO0jMV8.mjs} +1 -1
  13. package/dist/tests/{body-h9zUR79f.cjs → body-DXHOazEl.cjs} +1 -1
  14. package/dist/tests/body.test.cjs +1 -1
  15. package/dist/tests/body.test.mjs +1 -1
  16. package/dist/tests/decimal.test.cjs +1 -1
  17. package/dist/tests/decimal.test.mjs +1 -1
  18. package/dist/tests/{docloader-CBLgaVPd.cjs → docloader-4Txefi7y.cjs} +2 -2
  19. package/dist/tests/{docloader-DMGssPEX.mjs → docloader-C-nWtUWo.mjs} +2 -2
  20. package/dist/tests/docloader.test.cjs +2 -2
  21. package/dist/tests/docloader.test.mjs +2 -2
  22. package/dist/tests/internal/portable-dereference.test.cjs +87 -0
  23. package/dist/tests/internal/portable-dereference.test.mjs +87 -0
  24. package/dist/tests/{request-ClFs0ePp.cjs → request-BOLanqAd.cjs} +1 -1
  25. package/dist/tests/{request-Ytm0xyZH.mjs → request-dpFdQKXr.mjs} +1 -1
  26. package/dist/tests/request.test.cjs +1 -1
  27. package/dist/tests/request.test.mjs +1 -1
  28. package/package.json +1 -1
  29. package/src/internal/portable-dereference.test.ts +32 -0
  30. package/src/internal/portable-dereference.ts +521 -12
  31. package/src/mod.ts +2 -0
  32. package/src/portable.ts +136 -8
  33. package/dist/portable-CduElToy.d.ts +0 -52
  34. package/dist/portable-DxF2Ut-Z.d.cts +0 -52
@@ -1,10 +1,207 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { n as DocumentLoader } from "../docloader-Dr8wEkif.cjs";
3
- import { t as PortableObjectVerifier } from "../portable-DxF2Ut-Z.cjs";
2
+ import { n as DocumentLoader, s as RemoteDocument } from "../docloader-Dr8wEkif.cjs";
3
+ import { r as PortableObjectVerifier } from "../portable-comBI05Y.cjs";
4
4
  import { Span, TracerProvider } from "@opentelemetry/api";
5
5
 
6
6
  //#region src/internal/portable-dereference.d.ts
7
7
  /**
8
+ * A reference from a vocabulary object's property, which generated
9
+ * accessors pass to {@link dereferencePortableIri}.
10
+ *
11
+ * @internal
12
+ */
13
+ interface PortableReferrerLink {
14
+ readonly object: object;
15
+ readonly property: string;
16
+ }
17
+ /**
18
+ * Checks whether a vocabulary object is part of a chain of portable objects,
19
+ * i.e., whether it has a portable ID or was obtained from a portable object.
20
+ *
21
+ * @internal Technically exported for generated vocabulary classes, but not
22
+ * part of the public API contract. This is not considered public API for
23
+ * Semantic Versioning decisions.
24
+ */
25
+ declare function isInPortableChain(object: object): boolean;
26
+ /**
27
+ * Checks whether a vocabulary object was accepted without an integrity
28
+ * proof, e.g., as an unsecured portable collection served by a trusted
29
+ * gateway. Objects embedded in such an object must not be trusted because
30
+ * of their origin.
31
+ *
32
+ * @internal Technically exported for generated vocabulary classes, but not
33
+ * part of the public API contract. This is not considered public API for
34
+ * Semantic Versioning decisions.
35
+ */
36
+ declare function isUnsecuredPortableObject(object: object): boolean;
37
+ /**
38
+ * Checks whether a URL is an FEP-ef61 compatible identifier, i.e., an HTTP(S)
39
+ * URL under a gateway's `/.well-known/apgateway/` path that stands for
40
+ * a portable object. Malformed compatible identifiers count as compatible
41
+ * identifiers too.
42
+ *
43
+ * @internal Technically exported for generated vocabulary classes, but not
44
+ * part of the public API contract. This is not considered public API for
45
+ * Semantic Versioning decisions.
46
+ */
47
+ declare function isCompatibleEf61Iri(url: URL | string): boolean;
48
+ /**
49
+ * Records that a vocabulary object returned by a property accessor was
50
+ * obtained through the given property of a portable object, so that later
51
+ * dereferences from it can tell where it came from. Nothing is recorded if
52
+ * the parent is not in a portable chain, or if the child already has its
53
+ * provenance.
54
+ *
55
+ * @internal Technically exported for generated vocabulary classes, but not
56
+ * part of the public API contract. This is not considered public API for
57
+ * Semantic Versioning decisions.
58
+ */
59
+ declare function recordPortableReferrer(parent: object, child: unknown, property: string): void;
60
+ /**
61
+ * Copies the provenance of a vocabulary object to its clone. The clone
62
+ * keeps where the original came from and the restriction on unsecured
63
+ * objects, but not a positive verification status nor a collection context,
64
+ * since the clone may have different property values.
65
+ *
66
+ * @internal Technically exported for generated vocabulary classes, but not
67
+ * part of the public API contract. This is not considered public API for
68
+ * Semantic Versioning decisions.
69
+ */
70
+ declare function copyPortableProvenance(from: object, to: object): void;
71
+ /**
72
+ * Recognizes an FEP-ef61 compatible identifier to dereference as a portable
73
+ * object.
74
+ *
75
+ * @returns `undefined` if the URL is not a compatible identifier; `null` if
76
+ * it is a malformed compatible identifier; otherwise, the portable
77
+ * ID it stands for and the gateway it names.
78
+ * @internal Technically exported for generated vocabulary classes, but not
79
+ * part of the public API contract. This is not considered public API for
80
+ * Semantic Versioning decisions.
81
+ */
82
+ declare function parseCompatibleEf61Reference(url: URL | string): {
83
+ readonly id: URL;
84
+ readonly gateway: URL;
85
+ } | null | undefined;
86
+ /**
87
+ * Checks whether a property accessor call on a vocabulary object applies the
88
+ * FEP-ef61 portable object policy, i.e., whether the `verifyPortableObject`
89
+ * option is given or the object is part of a chain of portable objects.
90
+ * In this mode, compatible identifiers are dereferenced as portable objects,
91
+ * and fetched documents that turn out to stand for portable objects are
92
+ * verified as such.
93
+ *
94
+ * @internal Technically exported for generated vocabulary classes, but not
95
+ * part of the public API contract. This is not considered public API for
96
+ * Semantic Versioning decisions.
97
+ */
98
+ declare function isPortableMode(object: object, options: {
99
+ readonly verifyPortableObject?: PortableObjectVerifier;
100
+ }): boolean;
101
+ /**
102
+ * Checks whether an object embedded in a property of a vocabulary object has
103
+ * to be dereferenced by its `@id` and verified as a portable object rather
104
+ * than trusted as embedded, even with `crossOrigin: "trust"`. This is the
105
+ * case in {@link isPortableMode | portable mode} if its `@id` is an FEP-ef61
106
+ * compatible identifier, or a portable IRI whose DID differs from the
107
+ * owner's portable ID.
108
+ *
109
+ * @param parent The object whose property embeds the object.
110
+ * @param ownerId The ID of the object that vouches for embedded objects, or
111
+ * `null` if embedded objects are not trusted by their owner.
112
+ * @param id The `@id` of the embedded object.
113
+ * @param options The options of the accessor.
114
+ * @internal Technically exported for generated vocabulary classes, but not
115
+ * part of the public API contract. This is not considered public API for
116
+ * Semantic Versioning decisions.
117
+ */
118
+ declare function mustDereferencePortableObject(parent: object, ownerId: URL | null, id: URL, options: {
119
+ readonly verifyPortableObject?: PortableObjectVerifier;
120
+ }): boolean;
121
+ /**
122
+ * The portable object that a document fetched as an ordinary HTTP(S)
123
+ * document claims to be.
124
+ *
125
+ * @internal
126
+ */
127
+ interface PortableResponseClaim {
128
+ /** The portable ID that the document has to have. */
129
+ readonly id: URL;
130
+ /**
131
+ * The gateways inferred from the document's URL or `@id`, which are
132
+ * reported to the verifier as gateway hints.
133
+ */
134
+ readonly inferredGateways: readonly URL[];
135
+ }
136
+ /**
137
+ * Finds out whether a document fetched as an ordinary HTTP(S) document
138
+ * claims to be a portable object: its final URL is a portable IRI or an
139
+ * FEP-ef61 compatible identifier, or else its `@id` is. The final URL takes
140
+ * precedence, so a document whose `@id` claims another object fails the
141
+ * identity check against the final URL.
142
+ *
143
+ * @param documentUrl The final URL of the document.
144
+ * @param objectId The `@id` of the parsed document.
145
+ * @returns `undefined` if the document does not claim to be a portable
146
+ * object; `null` if the claim is malformed; otherwise, the claim.
147
+ * @internal Technically exported for generated vocabulary classes, but not
148
+ * part of the public API contract. This is not considered public API for
149
+ * Semantic Versioning decisions.
150
+ */
151
+ declare function getPortableResponseClaim(documentUrl: string, objectId: URL | null): PortableResponseClaim | null | undefined;
152
+ /**
153
+ * Records that an object fetched as an ordinary HTTP(S) object stands for
154
+ * a portable object if its reference, its final URL, or its `@id` is
155
+ * a portable IRI or an FEP-ef61 compatible identifier. Accessors do not
156
+ * cache such objects in their parents, so that a later call with the
157
+ * `verifyPortableObject` option dereferences and verifies them.
158
+ *
159
+ * @internal Technically exported for generated vocabulary classes, but not
160
+ * part of the public API contract. This is not considered public API for
161
+ * Semantic Versioning decisions.
162
+ */
163
+ declare function markUnverifiedPortableClaim(object: object, reference: URL, documentUrl: string): void;
164
+ /**
165
+ * Checks whether an object was fetched as an ordinary HTTP(S) object although
166
+ * it stands for a portable object. See {@link markUnverifiedPortableClaim}.
167
+ *
168
+ * @internal Technically exported for generated vocabulary classes, but not
169
+ * part of the public API contract. This is not considered public API for
170
+ * Semantic Versioning decisions.
171
+ */
172
+ declare function isUnverifiedPortableClaim(object: object): boolean;
173
+ /**
174
+ * Rejects a malformed FEP-ef61 compatible identifier found in a reference,
175
+ * the final URL of a fetched document, or its `@id`, when it would be
176
+ * dereferenced as a portable object. It is rejected without a request (or
177
+ * without returning the fetched document), since it cannot be verified as
178
+ * a portable object, and fetching it as an ordinary HTTP(S) object would
179
+ * skip the portable object policy.
180
+ *
181
+ * @param url The rejected URL, for the log message.
182
+ * @param options The options of the accessor.
183
+ * @returns Always `null`.
184
+ * @throws {Error} If `crossOrigin` is `"throw"` and `suppressError` is not
185
+ * set.
186
+ * @internal Technically exported for generated vocabulary classes, but not
187
+ * part of the public API contract. This is not considered public API for
188
+ * Semantic Versioning decisions.
189
+ */
190
+ declare function rejectMalformedCompatibleReference(url: string, options: {
191
+ readonly crossOrigin?: "ignore" | "throw" | "trust";
192
+ readonly suppressError?: boolean;
193
+ }): null;
194
+ /**
195
+ * Logs that an embedded object without `@id` in an object accepted without
196
+ * an integrity proof is dropped, because it cannot be dereferenced and
197
+ * verified on its own.
198
+ *
199
+ * @internal Technically exported for generated vocabulary classes, but not
200
+ * part of the public API contract. This is not considered public API for
201
+ * Semantic Versioning decisions.
202
+ */
203
+ declare function warnUnverifiableEmbeddedObject(parent: object, property: string): void;
204
+ /**
8
205
  * Checks whether a URL is an FEP-ef61 portable ActivityPub IRI.
9
206
  *
10
207
  * @internal Technically exported for generated vocabulary classes, but not
@@ -25,6 +222,25 @@ declare function isPortableIri(url: URL): boolean;
25
222
  */
26
223
  declare function getPortableGatewayCandidates(url: URL, gateways?: readonly (string | URL)[]): URL[];
27
224
  /**
225
+ * Creates a context loader that returns the same context documents for the
226
+ * whole dereference operation, so that the identity check, the proof
227
+ * verifier, and the parser interpret the fetched document identically even
228
+ * if the underlying loader is nondeterministic. Failed loads are not
229
+ * remembered, so a transient failure does not affect the next gateway.
230
+ *
231
+ * The parsed object keeps the loader for its own later dereferences, so
232
+ * `release()` turns it into a plain pass-through to the underlying loader
233
+ * once the operation is over.
234
+ *
235
+ * @internal Technically exported for generated vocabulary classes, but not
236
+ * part of the public API contract. This is not considered public API for
237
+ * Semantic Versioning decisions.
238
+ */
239
+ declare function createSnapshotContextLoader(contextLoader: DocumentLoader): {
240
+ loader: DocumentLoader;
241
+ release: () => void;
242
+ };
243
+ /**
28
244
  * Options for {@link dereferencePortableIri}.
29
245
  *
30
246
  * @internal Technically exported for generated vocabulary classes, but not
@@ -36,7 +252,22 @@ interface DereferencePortableIriOptions<T> {
36
252
  contextLoader: DocumentLoader;
37
253
  tracerProvider: TracerProvider;
38
254
  gateways?: readonly (string | URL)[];
255
+ /**
256
+ * The gateways inferred from where the reference came from, e.g., the
257
+ * gateway of a compatible identifier. When given, they replace the
258
+ * `@gateway` location hints of the IRI, are asked before the explicit
259
+ * `gateways`, and are reported to the verifier as gateway hints unless
260
+ * `gateways` is given.
261
+ */
262
+ inferredGateways?: readonly URL[];
263
+ /**
264
+ * An already fetched document to validate instead of fetching the object
265
+ * from gateways. It is validated the same way as a gateway's response,
266
+ * and nothing else is tried if it is rejected.
267
+ */
268
+ response?: RemoteDocument;
39
269
  verifyPortableObject?: PortableObjectVerifier;
270
+ referrer?: PortableReferrerLink;
40
271
  suppressError?: boolean;
41
272
  crossOrigin?: "ignore" | "throw" | "trust";
42
273
  /**
@@ -66,9 +297,10 @@ declare class PortableObjectRejectedError extends Error {
66
297
  *
67
298
  * Gateways are tried one by one until one of them returns a single-node
68
299
  * document whose `@id`, if any, canonically matches the requested IRI and
69
- * which passes `verifyPortableObject`. When there is no gateway to try, the document
70
- * loader is asked for the portable IRI itself, and its result is validated
71
- * the same way.
300
+ * which passes `verifyPortableObject`. When there is no gateway to try, the
301
+ * document loader is asked for the portable IRI itself, and its result is
302
+ * validated the same way. If the `response` option is given, only that
303
+ * document is validated, and nothing is fetched.
72
304
  *
73
305
  * @returns The parsed object, or `null` if no valid object was retrieved and
74
306
  * `suppressError` is set or the failure was a rejected object
@@ -84,4 +316,4 @@ declare function dereferencePortableIri<T extends {
84
316
  id: URL | null;
85
317
  }>(url: URL, options: DereferencePortableIriOptions<T>): Promise<T | null>;
86
318
  //#endregion
87
- export { DereferencePortableIriOptions, PortableObjectRejectedError, dereferencePortableIri, getPortableGatewayCandidates, isPortableIri };
319
+ export { DereferencePortableIriOptions, PortableObjectRejectedError, PortableReferrerLink, PortableResponseClaim, copyPortableProvenance, createSnapshotContextLoader, dereferencePortableIri, getPortableGatewayCandidates, getPortableResponseClaim, isCompatibleEf61Iri, isInPortableChain, isPortableIri, isPortableMode, isUnsecuredPortableObject, isUnverifiedPortableClaim, markUnverifiedPortableClaim, mustDereferencePortableObject, parseCompatibleEf61Reference, recordPortableReferrer, rejectMalformedCompatibleReference, warnUnverifiableEmbeddedObject };
@@ -1,10 +1,207 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { n as DocumentLoader } from "../docloader-Dr8wEkif.js";
3
- import { t as PortableObjectVerifier } from "../portable-CduElToy.js";
2
+ import { n as DocumentLoader, s as RemoteDocument } from "../docloader-Dr8wEkif.js";
3
+ import { r as PortableObjectVerifier } from "../portable-DH3947GK.js";
4
4
  import { Span, TracerProvider } from "@opentelemetry/api";
5
5
 
6
6
  //#region src/internal/portable-dereference.d.ts
7
7
  /**
8
+ * A reference from a vocabulary object's property, which generated
9
+ * accessors pass to {@link dereferencePortableIri}.
10
+ *
11
+ * @internal
12
+ */
13
+ interface PortableReferrerLink {
14
+ readonly object: object;
15
+ readonly property: string;
16
+ }
17
+ /**
18
+ * Checks whether a vocabulary object is part of a chain of portable objects,
19
+ * i.e., whether it has a portable ID or was obtained from a portable object.
20
+ *
21
+ * @internal Technically exported for generated vocabulary classes, but not
22
+ * part of the public API contract. This is not considered public API for
23
+ * Semantic Versioning decisions.
24
+ */
25
+ declare function isInPortableChain(object: object): boolean;
26
+ /**
27
+ * Checks whether a vocabulary object was accepted without an integrity
28
+ * proof, e.g., as an unsecured portable collection served by a trusted
29
+ * gateway. Objects embedded in such an object must not be trusted because
30
+ * of their origin.
31
+ *
32
+ * @internal Technically exported for generated vocabulary classes, but not
33
+ * part of the public API contract. This is not considered public API for
34
+ * Semantic Versioning decisions.
35
+ */
36
+ declare function isUnsecuredPortableObject(object: object): boolean;
37
+ /**
38
+ * Checks whether a URL is an FEP-ef61 compatible identifier, i.e., an HTTP(S)
39
+ * URL under a gateway's `/.well-known/apgateway/` path that stands for
40
+ * a portable object. Malformed compatible identifiers count as compatible
41
+ * identifiers too.
42
+ *
43
+ * @internal Technically exported for generated vocabulary classes, but not
44
+ * part of the public API contract. This is not considered public API for
45
+ * Semantic Versioning decisions.
46
+ */
47
+ declare function isCompatibleEf61Iri(url: URL | string): boolean;
48
+ /**
49
+ * Records that a vocabulary object returned by a property accessor was
50
+ * obtained through the given property of a portable object, so that later
51
+ * dereferences from it can tell where it came from. Nothing is recorded if
52
+ * the parent is not in a portable chain, or if the child already has its
53
+ * provenance.
54
+ *
55
+ * @internal Technically exported for generated vocabulary classes, but not
56
+ * part of the public API contract. This is not considered public API for
57
+ * Semantic Versioning decisions.
58
+ */
59
+ declare function recordPortableReferrer(parent: object, child: unknown, property: string): void;
60
+ /**
61
+ * Copies the provenance of a vocabulary object to its clone. The clone
62
+ * keeps where the original came from and the restriction on unsecured
63
+ * objects, but not a positive verification status nor a collection context,
64
+ * since the clone may have different property values.
65
+ *
66
+ * @internal Technically exported for generated vocabulary classes, but not
67
+ * part of the public API contract. This is not considered public API for
68
+ * Semantic Versioning decisions.
69
+ */
70
+ declare function copyPortableProvenance(from: object, to: object): void;
71
+ /**
72
+ * Recognizes an FEP-ef61 compatible identifier to dereference as a portable
73
+ * object.
74
+ *
75
+ * @returns `undefined` if the URL is not a compatible identifier; `null` if
76
+ * it is a malformed compatible identifier; otherwise, the portable
77
+ * ID it stands for and the gateway it names.
78
+ * @internal Technically exported for generated vocabulary classes, but not
79
+ * part of the public API contract. This is not considered public API for
80
+ * Semantic Versioning decisions.
81
+ */
82
+ declare function parseCompatibleEf61Reference(url: URL | string): {
83
+ readonly id: URL;
84
+ readonly gateway: URL;
85
+ } | null | undefined;
86
+ /**
87
+ * Checks whether a property accessor call on a vocabulary object applies the
88
+ * FEP-ef61 portable object policy, i.e., whether the `verifyPortableObject`
89
+ * option is given or the object is part of a chain of portable objects.
90
+ * In this mode, compatible identifiers are dereferenced as portable objects,
91
+ * and fetched documents that turn out to stand for portable objects are
92
+ * verified as such.
93
+ *
94
+ * @internal Technically exported for generated vocabulary classes, but not
95
+ * part of the public API contract. This is not considered public API for
96
+ * Semantic Versioning decisions.
97
+ */
98
+ declare function isPortableMode(object: object, options: {
99
+ readonly verifyPortableObject?: PortableObjectVerifier;
100
+ }): boolean;
101
+ /**
102
+ * Checks whether an object embedded in a property of a vocabulary object has
103
+ * to be dereferenced by its `@id` and verified as a portable object rather
104
+ * than trusted as embedded, even with `crossOrigin: "trust"`. This is the
105
+ * case in {@link isPortableMode | portable mode} if its `@id` is an FEP-ef61
106
+ * compatible identifier, or a portable IRI whose DID differs from the
107
+ * owner's portable ID.
108
+ *
109
+ * @param parent The object whose property embeds the object.
110
+ * @param ownerId The ID of the object that vouches for embedded objects, or
111
+ * `null` if embedded objects are not trusted by their owner.
112
+ * @param id The `@id` of the embedded object.
113
+ * @param options The options of the accessor.
114
+ * @internal Technically exported for generated vocabulary classes, but not
115
+ * part of the public API contract. This is not considered public API for
116
+ * Semantic Versioning decisions.
117
+ */
118
+ declare function mustDereferencePortableObject(parent: object, ownerId: URL | null, id: URL, options: {
119
+ readonly verifyPortableObject?: PortableObjectVerifier;
120
+ }): boolean;
121
+ /**
122
+ * The portable object that a document fetched as an ordinary HTTP(S)
123
+ * document claims to be.
124
+ *
125
+ * @internal
126
+ */
127
+ interface PortableResponseClaim {
128
+ /** The portable ID that the document has to have. */
129
+ readonly id: URL;
130
+ /**
131
+ * The gateways inferred from the document's URL or `@id`, which are
132
+ * reported to the verifier as gateway hints.
133
+ */
134
+ readonly inferredGateways: readonly URL[];
135
+ }
136
+ /**
137
+ * Finds out whether a document fetched as an ordinary HTTP(S) document
138
+ * claims to be a portable object: its final URL is a portable IRI or an
139
+ * FEP-ef61 compatible identifier, or else its `@id` is. The final URL takes
140
+ * precedence, so a document whose `@id` claims another object fails the
141
+ * identity check against the final URL.
142
+ *
143
+ * @param documentUrl The final URL of the document.
144
+ * @param objectId The `@id` of the parsed document.
145
+ * @returns `undefined` if the document does not claim to be a portable
146
+ * object; `null` if the claim is malformed; otherwise, the claim.
147
+ * @internal Technically exported for generated vocabulary classes, but not
148
+ * part of the public API contract. This is not considered public API for
149
+ * Semantic Versioning decisions.
150
+ */
151
+ declare function getPortableResponseClaim(documentUrl: string, objectId: URL | null): PortableResponseClaim | null | undefined;
152
+ /**
153
+ * Records that an object fetched as an ordinary HTTP(S) object stands for
154
+ * a portable object if its reference, its final URL, or its `@id` is
155
+ * a portable IRI or an FEP-ef61 compatible identifier. Accessors do not
156
+ * cache such objects in their parents, so that a later call with the
157
+ * `verifyPortableObject` option dereferences and verifies them.
158
+ *
159
+ * @internal Technically exported for generated vocabulary classes, but not
160
+ * part of the public API contract. This is not considered public API for
161
+ * Semantic Versioning decisions.
162
+ */
163
+ declare function markUnverifiedPortableClaim(object: object, reference: URL, documentUrl: string): void;
164
+ /**
165
+ * Checks whether an object was fetched as an ordinary HTTP(S) object although
166
+ * it stands for a portable object. See {@link markUnverifiedPortableClaim}.
167
+ *
168
+ * @internal Technically exported for generated vocabulary classes, but not
169
+ * part of the public API contract. This is not considered public API for
170
+ * Semantic Versioning decisions.
171
+ */
172
+ declare function isUnverifiedPortableClaim(object: object): boolean;
173
+ /**
174
+ * Rejects a malformed FEP-ef61 compatible identifier found in a reference,
175
+ * the final URL of a fetched document, or its `@id`, when it would be
176
+ * dereferenced as a portable object. It is rejected without a request (or
177
+ * without returning the fetched document), since it cannot be verified as
178
+ * a portable object, and fetching it as an ordinary HTTP(S) object would
179
+ * skip the portable object policy.
180
+ *
181
+ * @param url The rejected URL, for the log message.
182
+ * @param options The options of the accessor.
183
+ * @returns Always `null`.
184
+ * @throws {Error} If `crossOrigin` is `"throw"` and `suppressError` is not
185
+ * set.
186
+ * @internal Technically exported for generated vocabulary classes, but not
187
+ * part of the public API contract. This is not considered public API for
188
+ * Semantic Versioning decisions.
189
+ */
190
+ declare function rejectMalformedCompatibleReference(url: string, options: {
191
+ readonly crossOrigin?: "ignore" | "throw" | "trust";
192
+ readonly suppressError?: boolean;
193
+ }): null;
194
+ /**
195
+ * Logs that an embedded object without `@id` in an object accepted without
196
+ * an integrity proof is dropped, because it cannot be dereferenced and
197
+ * verified on its own.
198
+ *
199
+ * @internal Technically exported for generated vocabulary classes, but not
200
+ * part of the public API contract. This is not considered public API for
201
+ * Semantic Versioning decisions.
202
+ */
203
+ declare function warnUnverifiableEmbeddedObject(parent: object, property: string): void;
204
+ /**
8
205
  * Checks whether a URL is an FEP-ef61 portable ActivityPub IRI.
9
206
  *
10
207
  * @internal Technically exported for generated vocabulary classes, but not
@@ -25,6 +222,25 @@ declare function isPortableIri(url: URL): boolean;
25
222
  */
26
223
  declare function getPortableGatewayCandidates(url: URL, gateways?: readonly (string | URL)[]): URL[];
27
224
  /**
225
+ * Creates a context loader that returns the same context documents for the
226
+ * whole dereference operation, so that the identity check, the proof
227
+ * verifier, and the parser interpret the fetched document identically even
228
+ * if the underlying loader is nondeterministic. Failed loads are not
229
+ * remembered, so a transient failure does not affect the next gateway.
230
+ *
231
+ * The parsed object keeps the loader for its own later dereferences, so
232
+ * `release()` turns it into a plain pass-through to the underlying loader
233
+ * once the operation is over.
234
+ *
235
+ * @internal Technically exported for generated vocabulary classes, but not
236
+ * part of the public API contract. This is not considered public API for
237
+ * Semantic Versioning decisions.
238
+ */
239
+ declare function createSnapshotContextLoader(contextLoader: DocumentLoader): {
240
+ loader: DocumentLoader;
241
+ release: () => void;
242
+ };
243
+ /**
28
244
  * Options for {@link dereferencePortableIri}.
29
245
  *
30
246
  * @internal Technically exported for generated vocabulary classes, but not
@@ -36,7 +252,22 @@ interface DereferencePortableIriOptions<T> {
36
252
  contextLoader: DocumentLoader;
37
253
  tracerProvider: TracerProvider;
38
254
  gateways?: readonly (string | URL)[];
255
+ /**
256
+ * The gateways inferred from where the reference came from, e.g., the
257
+ * gateway of a compatible identifier. When given, they replace the
258
+ * `@gateway` location hints of the IRI, are asked before the explicit
259
+ * `gateways`, and are reported to the verifier as gateway hints unless
260
+ * `gateways` is given.
261
+ */
262
+ inferredGateways?: readonly URL[];
263
+ /**
264
+ * An already fetched document to validate instead of fetching the object
265
+ * from gateways. It is validated the same way as a gateway's response,
266
+ * and nothing else is tried if it is rejected.
267
+ */
268
+ response?: RemoteDocument;
39
269
  verifyPortableObject?: PortableObjectVerifier;
270
+ referrer?: PortableReferrerLink;
40
271
  suppressError?: boolean;
41
272
  crossOrigin?: "ignore" | "throw" | "trust";
42
273
  /**
@@ -66,9 +297,10 @@ declare class PortableObjectRejectedError extends Error {
66
297
  *
67
298
  * Gateways are tried one by one until one of them returns a single-node
68
299
  * document whose `@id`, if any, canonically matches the requested IRI and
69
- * which passes `verifyPortableObject`. When there is no gateway to try, the document
70
- * loader is asked for the portable IRI itself, and its result is validated
71
- * the same way.
300
+ * which passes `verifyPortableObject`. When there is no gateway to try, the
301
+ * document loader is asked for the portable IRI itself, and its result is
302
+ * validated the same way. If the `response` option is given, only that
303
+ * document is validated, and nothing is fetched.
72
304
  *
73
305
  * @returns The parsed object, or `null` if no valid object was retrieved and
74
306
  * `suppressError` is set or the failure was a rejected object
@@ -84,4 +316,4 @@ declare function dereferencePortableIri<T extends {
84
316
  id: URL | null;
85
317
  }>(url: URL, options: DereferencePortableIriOptions<T>): Promise<T | null>;
86
318
  //#endregion
87
- export { DereferencePortableIriOptions, PortableObjectRejectedError, dereferencePortableIri, getPortableGatewayCandidates, isPortableIri };
319
+ export { DereferencePortableIriOptions, PortableObjectRejectedError, PortableReferrerLink, PortableResponseClaim, copyPortableProvenance, createSnapshotContextLoader, dereferencePortableIri, getPortableGatewayCandidates, getPortableResponseClaim, isCompatibleEf61Iri, isInPortableChain, isPortableIri, isPortableMode, isUnsecuredPortableObject, isUnverifiedPortableClaim, markUnverifiedPortableClaim, mustDereferencePortableObject, parseCompatibleEf61Reference, recordPortableReferrer, rejectMalformedCompatibleReference, warnUnverifiableEmbeddedObject };