@fedify/vocab-runtime 2.1.0-dev.405 → 2.1.0-dev.408
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 +7 -7
- package/dist/mod.d.cts +184 -181
- package/dist/mod.d.ts +184 -181
- package/dist/mod.js +7 -7
- package/dist/tests/docloader.test.cjs +1 -1
- package/dist/tests/docloader.test.js +1 -1
- package/dist/tests/langstr.test.cjs +6 -6
- package/dist/tests/langstr.test.js +6 -6
- package/dist/tests/{request-EmPLtSio.cjs → request-DJxgzecL.cjs} +1 -1
- package/dist/tests/{request-CzFDnxjS.js → request-DuqQMin-.js} +1 -1
- package/dist/tests/request.test.cjs +1 -1
- package/dist/tests/request.test.js +1 -1
- package/package.json +1 -1
- package/src/langstr.ts +17 -9
- package/src/multibase/constants.ts +6 -2
- package/src/request.ts +1 -1
- package/tsdown.config.ts +1 -1
package/deno.json
CHANGED
package/dist/mod.cjs
CHANGED
|
@@ -4182,7 +4182,7 @@ var contexts_default = preloadedContexts;
|
|
|
4182
4182
|
//#endregion
|
|
4183
4183
|
//#region deno.json
|
|
4184
4184
|
var name = "@fedify/vocab-runtime";
|
|
4185
|
-
var version = "2.1.0-dev.
|
|
4185
|
+
var version = "2.1.0-dev.408+5c3c9d78";
|
|
4186
4186
|
var license = "MIT";
|
|
4187
4187
|
var exports$1 = { ".": "./src/mod.ts" };
|
|
4188
4188
|
var description = "Runtime library for @fedify/vocab";
|
|
@@ -5199,12 +5199,12 @@ var LanguageString = class extends String {
|
|
|
5199
5199
|
super(value);
|
|
5200
5200
|
this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
|
|
5201
5201
|
}
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
}
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
}
|
|
5202
|
+
};
|
|
5203
|
+
LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
5204
|
+
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
5205
|
+
};
|
|
5206
|
+
LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
5207
|
+
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
5208
5208
|
};
|
|
5209
5209
|
|
|
5210
5210
|
//#endregion
|
package/dist/mod.d.cts
CHANGED
|
@@ -1,188 +1,191 @@
|
|
|
1
1
|
import { Logger } from "@logtape/logtape";
|
|
2
2
|
|
|
3
3
|
//#region src/contexts.d.ts
|
|
4
|
+
// Preloaded context documents
|
|
5
|
+
// https://github.com/fedify-dev/fedify/issues/74
|
|
6
|
+
// cSpell: disable
|
|
4
7
|
declare const preloadedContexts: Record<string, unknown>;
|
|
5
8
|
//#endregion
|
|
6
9
|
//#region src/request.d.ts
|
|
7
10
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
* Error thrown when fetching a JSON-LD document failed.
|
|
12
|
+
*/
|
|
10
13
|
declare class FetchError extends Error {
|
|
11
14
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
* The URL that failed to fetch.
|
|
16
|
+
*/
|
|
14
17
|
url: URL;
|
|
15
18
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
* Constructs a new `FetchError`.
|
|
20
|
+
*
|
|
21
|
+
* @param url The URL that failed to fetch.
|
|
22
|
+
* @param message Error message.
|
|
23
|
+
*/
|
|
21
24
|
constructor(url: URL | string, message?: string);
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
* Options for creating a request.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
27
30
|
interface CreateRequestOptions {
|
|
28
31
|
userAgent?: GetUserAgentOptions | string;
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
* Creates a request for the given URL.
|
|
35
|
+
* @param url The URL to create the request for.
|
|
36
|
+
* @param options The options for the request.
|
|
37
|
+
* @returns The created request.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
37
40
|
declare function createActivityPubRequest(url: string, options?: CreateRequestOptions): Request;
|
|
38
41
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
* Options for making `User-Agent` string.
|
|
43
|
+
* @see {@link getUserAgent}
|
|
44
|
+
* @since 1.3.0
|
|
45
|
+
*/
|
|
43
46
|
interface GetUserAgentOptions {
|
|
44
47
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
* An optional software name and version, e.g., `"Hollo/1.0.0"`.
|
|
49
|
+
*/
|
|
47
50
|
software?: string | null;
|
|
48
51
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
* An optional URL to append to the user agent string.
|
|
53
|
+
* Usually the URL of the ActivityPub instance.
|
|
54
|
+
*/
|
|
52
55
|
url?: string | URL | null;
|
|
53
56
|
}
|
|
54
57
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
* Gets the user agent string for the given application and URL.
|
|
59
|
+
* @param options The options for making the user agent string.
|
|
60
|
+
* @returns The user agent string.
|
|
61
|
+
* @since 1.3.0
|
|
62
|
+
*/
|
|
60
63
|
declare function getUserAgent({
|
|
61
64
|
software,
|
|
62
65
|
url
|
|
63
66
|
}?: GetUserAgentOptions): string;
|
|
64
67
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
* Logs the request.
|
|
69
|
+
* @param request The request to log.
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
69
72
|
declare function logRequest(logger: Logger, request: Request): void;
|
|
70
73
|
//#endregion
|
|
71
74
|
//#region src/docloader.d.ts
|
|
72
75
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
* A remote JSON-LD document and its context fetched by
|
|
77
|
+
* a {@link DocumentLoader}.
|
|
78
|
+
*/
|
|
76
79
|
interface RemoteDocument {
|
|
77
80
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
* The URL of the context document.
|
|
82
|
+
*/
|
|
80
83
|
contextUrl: string | null;
|
|
81
84
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
* The fetched JSON-LD document.
|
|
86
|
+
*/
|
|
84
87
|
document: unknown;
|
|
85
88
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
* The URL of the fetched document.
|
|
90
|
+
*/
|
|
88
91
|
documentUrl: string;
|
|
89
92
|
}
|
|
90
93
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
* Options for {@link DocumentLoader}.
|
|
95
|
+
* @since 1.8.0
|
|
96
|
+
*/
|
|
94
97
|
interface DocumentLoaderOptions {
|
|
95
98
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
* An `AbortSignal` for cancellation.
|
|
100
|
+
* @since 1.8.0
|
|
101
|
+
*/
|
|
99
102
|
signal?: AbortSignal;
|
|
100
103
|
}
|
|
101
104
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
* A JSON-LD document loader that fetches documents from the Web.
|
|
106
|
+
* @param url The URL of the document to load.
|
|
107
|
+
* @param options The options for the document loader.
|
|
108
|
+
* @returns The loaded remote document.
|
|
109
|
+
*/
|
|
107
110
|
type DocumentLoader = (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>;
|
|
108
111
|
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
* A factory function that creates a {@link DocumentLoader} with options.
|
|
113
|
+
* @param options The options for the document loader.
|
|
114
|
+
* @returns The document loader.
|
|
115
|
+
* @since 1.4.0
|
|
116
|
+
*/
|
|
114
117
|
type DocumentLoaderFactory = (options?: DocumentLoaderFactoryOptions) => DocumentLoader;
|
|
115
118
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
* Options for {@link DocumentLoaderFactory}.
|
|
120
|
+
* @see {@link DocumentLoaderFactory}
|
|
121
|
+
* @see {@link AuthenticatedDocumentLoaderFactory}
|
|
122
|
+
* @since 1.4.0
|
|
123
|
+
*/
|
|
121
124
|
interface DocumentLoaderFactoryOptions {
|
|
122
125
|
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
* Whether to allow fetching private network addresses.
|
|
127
|
+
* Turned off by default.
|
|
128
|
+
* @default `false``
|
|
129
|
+
*/
|
|
127
130
|
allowPrivateAddress?: boolean;
|
|
128
131
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
* Options for making `User-Agent` string.
|
|
133
|
+
* If a string is given, it is used as the `User-Agent` header value.
|
|
134
|
+
* If an object is given, it is passed to {@link getUserAgent} function.
|
|
135
|
+
*/
|
|
133
136
|
userAgent?: GetUserAgentOptions | string;
|
|
134
137
|
}
|
|
135
138
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
* A factory function that creates an authenticated {@link DocumentLoader} for
|
|
140
|
+
* a given identity. This is used for fetching documents that require
|
|
141
|
+
* authentication.
|
|
142
|
+
* @param identity The identity to create the document loader for.
|
|
143
|
+
* The actor's key pair.
|
|
144
|
+
* @param options The options for the document loader.
|
|
145
|
+
* @returns The authenticated document loader.
|
|
146
|
+
* @since 0.4.0
|
|
147
|
+
*/
|
|
145
148
|
type AuthenticatedDocumentLoaderFactory = (identity: {
|
|
146
149
|
keyId: URL;
|
|
147
150
|
privateKey: CryptoKey;
|
|
148
151
|
}, options?: DocumentLoaderFactoryOptions) => DocumentLoader;
|
|
149
152
|
/**
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
* Gets a {@link RemoteDocument} from the given response.
|
|
154
|
+
* @param url The URL of the document to load.
|
|
155
|
+
* @param response The response to get the document from.
|
|
156
|
+
* @param fetch The function to fetch the document.
|
|
157
|
+
* @returns The loaded remote document.
|
|
158
|
+
* @throws {FetchError} If the response is not OK.
|
|
159
|
+
* @internal
|
|
160
|
+
*/
|
|
158
161
|
declare function getRemoteDocument(url: string, response: Response, fetch: (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>): Promise<RemoteDocument>;
|
|
159
162
|
/**
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
* Options for {@link getDocumentLoader}.
|
|
164
|
+
* @since 1.3.0
|
|
165
|
+
*/
|
|
163
166
|
interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
164
167
|
/**
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
* Whether to preload the frequently used contexts.
|
|
169
|
+
*/
|
|
167
170
|
skipPreloadedContexts?: boolean;
|
|
168
171
|
}
|
|
169
172
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
173
|
+
* Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
|
|
174
|
+
*
|
|
175
|
+
* The created loader preloads the below frequently used contexts by default
|
|
176
|
+
* (unless `options.skipPreloadedContexts` is set to `true`):
|
|
177
|
+
*
|
|
178
|
+
* - <https://www.w3.org/ns/activitystreams>
|
|
179
|
+
* - <https://w3id.org/security/v1>
|
|
180
|
+
* - <https://w3id.org/security/data-integrity/v1>
|
|
181
|
+
* - <https://www.w3.org/ns/did/v1>
|
|
182
|
+
* - <https://w3id.org/security/multikey/v1>
|
|
183
|
+
* - <https://purl.archive.org/socialweb/webfinger>
|
|
184
|
+
* - <http://schema.org/>
|
|
185
|
+
* @param options Options for the document loader.
|
|
186
|
+
* @returns The document loader.
|
|
187
|
+
* @since 1.3.0
|
|
188
|
+
*/
|
|
186
189
|
declare function getDocumentLoader({
|
|
187
190
|
allowPrivateAddress,
|
|
188
191
|
skipPreloadedContexts,
|
|
@@ -191,74 +194,74 @@ declare function getDocumentLoader({
|
|
|
191
194
|
//#endregion
|
|
192
195
|
//#region src/key.d.ts
|
|
193
196
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
* Imports a PEM-SPKI formatted public key.
|
|
198
|
+
* @param pem The PEM-SPKI formatted public key.
|
|
199
|
+
* @returns The imported public key.
|
|
200
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
201
|
+
* @since 0.5.0
|
|
202
|
+
*/
|
|
200
203
|
declare function importSpki(pem: string): Promise<CryptoKey>;
|
|
201
204
|
/**
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
* Exports a public key in PEM-SPKI format.
|
|
206
|
+
* @param key The public key to export.
|
|
207
|
+
* @returns The exported public key in PEM-SPKI format.
|
|
208
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
209
|
+
* @since 0.5.0
|
|
210
|
+
*/
|
|
208
211
|
declare function exportSpki(key: CryptoKey): Promise<string>;
|
|
209
212
|
/**
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
* Imports a PEM-PKCS#1 formatted public key.
|
|
214
|
+
* @param pem The PEM-PKCS#1 formatted public key.
|
|
215
|
+
* @returns The imported public key.
|
|
216
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
217
|
+
* @since 1.5.0
|
|
218
|
+
*/
|
|
216
219
|
declare function importPkcs1(pem: string): Promise<CryptoKey>;
|
|
217
220
|
/**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
* Imports a PEM formatted public key (SPKI or PKCS#1).
|
|
222
|
+
* @param pem The PEM formatted public key to import (SPKI or PKCS#1).
|
|
223
|
+
* @returns The imported public key.
|
|
224
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
225
|
+
* @since 1.5.0
|
|
226
|
+
*/
|
|
224
227
|
declare function importPem(pem: string): Promise<CryptoKey>;
|
|
225
228
|
/**
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
* Imports a [Multibase]-encoded public key.
|
|
230
|
+
*
|
|
231
|
+
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
|
|
232
|
+
* @param key The Multibase-encoded public key.
|
|
233
|
+
* @returns The imported public key.
|
|
234
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
235
|
+
* @since 0.10.0
|
|
236
|
+
*/
|
|
234
237
|
declare function importMultibaseKey(key: string): Promise<CryptoKey>;
|
|
235
238
|
/**
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
239
|
+
* Exports a public key in [Multibase] format.
|
|
240
|
+
*
|
|
241
|
+
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
|
|
242
|
+
* @param key The public key to export.
|
|
243
|
+
* @returns The exported public key in Multibase format.
|
|
244
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
245
|
+
* @since 0.10.0
|
|
246
|
+
*/
|
|
244
247
|
declare function exportMultibaseKey(key: CryptoKey): Promise<string>;
|
|
245
248
|
//#endregion
|
|
246
249
|
//#region src/langstr.d.ts
|
|
247
250
|
/**
|
|
248
|
-
|
|
249
|
-
|
|
251
|
+
* A language-tagged string which corresponds to the `rdf:langString` type.
|
|
252
|
+
*/
|
|
250
253
|
declare class LanguageString extends String {
|
|
251
254
|
/**
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
* The locale of the string.
|
|
256
|
+
* @since 2.0.0
|
|
257
|
+
*/
|
|
255
258
|
readonly locale: Intl.Locale;
|
|
256
259
|
/**
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
* Constructs a new `LanguageString`.
|
|
261
|
+
* @param value A string value written in the given language.
|
|
262
|
+
* @param language The language of the string. If a string is given, it will
|
|
263
|
+
* be parsed as a `Intl.Locale` object.
|
|
264
|
+
*/
|
|
262
265
|
constructor(value: string, language: Intl.Locale | string);
|
|
263
266
|
}
|
|
264
267
|
//#endregion
|
|
@@ -280,8 +283,8 @@ interface CodecFactory {
|
|
|
280
283
|
//#endregion
|
|
281
284
|
//#region src/multibase/base.d.ts
|
|
282
285
|
/**
|
|
283
|
-
|
|
284
|
-
|
|
286
|
+
* Class to encode/decode in the supported Bases
|
|
287
|
+
*/
|
|
285
288
|
declare class Base {
|
|
286
289
|
name: BaseName;
|
|
287
290
|
private code;
|
|
@@ -295,25 +298,25 @@ declare class Base {
|
|
|
295
298
|
//#endregion
|
|
296
299
|
//#region src/multibase/mod.d.ts
|
|
297
300
|
/**
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
* Encode data with the specified base and add the multibase prefix.
|
|
302
|
+
*
|
|
303
|
+
* @throws {Error} Will throw if the encoding is not supported
|
|
304
|
+
*/
|
|
302
305
|
declare function encodeMultibase(nameOrCode: BaseNameOrCode, buf: Uint8Array): Uint8Array;
|
|
303
306
|
/**
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
307
|
+
* Takes a Uint8Array or string encoded with multibase header, decodes it and
|
|
308
|
+
* returns the decoded buffer
|
|
309
|
+
*
|
|
310
|
+
* @throws {Error} Will throw if the encoding is not supported
|
|
311
|
+
*/
|
|
309
312
|
declare function decodeMultibase(data: Uint8Array | string): Uint8Array;
|
|
310
313
|
/**
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
314
|
+
* Get encoding multibase from data
|
|
315
|
+
*
|
|
316
|
+
* @param {string|Uint8Array} data
|
|
317
|
+
* @returns {Base}
|
|
318
|
+
* @throws {Error} Will throw if the encoding is not supported
|
|
319
|
+
*/
|
|
317
320
|
declare function encodingFromBaseData(data: string | Uint8Array): Base;
|
|
318
321
|
//#endregion
|
|
319
322
|
//#region src/url.d.ts
|
|
@@ -321,8 +324,8 @@ declare class UrlError extends Error {
|
|
|
321
324
|
constructor(message: string);
|
|
322
325
|
}
|
|
323
326
|
/**
|
|
324
|
-
|
|
325
|
-
|
|
327
|
+
* Validates a URL to prevent SSRF attacks.
|
|
328
|
+
*/
|
|
326
329
|
declare function validatePublicUrl(url: string): Promise<void>;
|
|
327
330
|
declare function isValidPublicIPv4Address(address: string): boolean;
|
|
328
331
|
declare function isValidPublicIPv6Address(address: string): boolean;
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,188 +1,191 @@
|
|
|
1
1
|
import { Logger } from "@logtape/logtape";
|
|
2
2
|
|
|
3
3
|
//#region src/contexts.d.ts
|
|
4
|
+
// Preloaded context documents
|
|
5
|
+
// https://github.com/fedify-dev/fedify/issues/74
|
|
6
|
+
// cSpell: disable
|
|
4
7
|
declare const preloadedContexts: Record<string, unknown>;
|
|
5
8
|
//#endregion
|
|
6
9
|
//#region src/request.d.ts
|
|
7
10
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
* Error thrown when fetching a JSON-LD document failed.
|
|
12
|
+
*/
|
|
10
13
|
declare class FetchError extends Error {
|
|
11
14
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
* The URL that failed to fetch.
|
|
16
|
+
*/
|
|
14
17
|
url: URL;
|
|
15
18
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
* Constructs a new `FetchError`.
|
|
20
|
+
*
|
|
21
|
+
* @param url The URL that failed to fetch.
|
|
22
|
+
* @param message Error message.
|
|
23
|
+
*/
|
|
21
24
|
constructor(url: URL | string, message?: string);
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
* Options for creating a request.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
27
30
|
interface CreateRequestOptions {
|
|
28
31
|
userAgent?: GetUserAgentOptions | string;
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
* Creates a request for the given URL.
|
|
35
|
+
* @param url The URL to create the request for.
|
|
36
|
+
* @param options The options for the request.
|
|
37
|
+
* @returns The created request.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
37
40
|
declare function createActivityPubRequest(url: string, options?: CreateRequestOptions): Request;
|
|
38
41
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
* Options for making `User-Agent` string.
|
|
43
|
+
* @see {@link getUserAgent}
|
|
44
|
+
* @since 1.3.0
|
|
45
|
+
*/
|
|
43
46
|
interface GetUserAgentOptions {
|
|
44
47
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
* An optional software name and version, e.g., `"Hollo/1.0.0"`.
|
|
49
|
+
*/
|
|
47
50
|
software?: string | null;
|
|
48
51
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
* An optional URL to append to the user agent string.
|
|
53
|
+
* Usually the URL of the ActivityPub instance.
|
|
54
|
+
*/
|
|
52
55
|
url?: string | URL | null;
|
|
53
56
|
}
|
|
54
57
|
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
* Gets the user agent string for the given application and URL.
|
|
59
|
+
* @param options The options for making the user agent string.
|
|
60
|
+
* @returns The user agent string.
|
|
61
|
+
* @since 1.3.0
|
|
62
|
+
*/
|
|
60
63
|
declare function getUserAgent({
|
|
61
64
|
software,
|
|
62
65
|
url
|
|
63
66
|
}?: GetUserAgentOptions): string;
|
|
64
67
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
* Logs the request.
|
|
69
|
+
* @param request The request to log.
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
69
72
|
declare function logRequest(logger: Logger, request: Request): void;
|
|
70
73
|
//#endregion
|
|
71
74
|
//#region src/docloader.d.ts
|
|
72
75
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
* A remote JSON-LD document and its context fetched by
|
|
77
|
+
* a {@link DocumentLoader}.
|
|
78
|
+
*/
|
|
76
79
|
interface RemoteDocument {
|
|
77
80
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
81
|
+
* The URL of the context document.
|
|
82
|
+
*/
|
|
80
83
|
contextUrl: string | null;
|
|
81
84
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
* The fetched JSON-LD document.
|
|
86
|
+
*/
|
|
84
87
|
document: unknown;
|
|
85
88
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
* The URL of the fetched document.
|
|
90
|
+
*/
|
|
88
91
|
documentUrl: string;
|
|
89
92
|
}
|
|
90
93
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
* Options for {@link DocumentLoader}.
|
|
95
|
+
* @since 1.8.0
|
|
96
|
+
*/
|
|
94
97
|
interface DocumentLoaderOptions {
|
|
95
98
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
* An `AbortSignal` for cancellation.
|
|
100
|
+
* @since 1.8.0
|
|
101
|
+
*/
|
|
99
102
|
signal?: AbortSignal;
|
|
100
103
|
}
|
|
101
104
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
* A JSON-LD document loader that fetches documents from the Web.
|
|
106
|
+
* @param url The URL of the document to load.
|
|
107
|
+
* @param options The options for the document loader.
|
|
108
|
+
* @returns The loaded remote document.
|
|
109
|
+
*/
|
|
107
110
|
type DocumentLoader = (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>;
|
|
108
111
|
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
* A factory function that creates a {@link DocumentLoader} with options.
|
|
113
|
+
* @param options The options for the document loader.
|
|
114
|
+
* @returns The document loader.
|
|
115
|
+
* @since 1.4.0
|
|
116
|
+
*/
|
|
114
117
|
type DocumentLoaderFactory = (options?: DocumentLoaderFactoryOptions) => DocumentLoader;
|
|
115
118
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
* Options for {@link DocumentLoaderFactory}.
|
|
120
|
+
* @see {@link DocumentLoaderFactory}
|
|
121
|
+
* @see {@link AuthenticatedDocumentLoaderFactory}
|
|
122
|
+
* @since 1.4.0
|
|
123
|
+
*/
|
|
121
124
|
interface DocumentLoaderFactoryOptions {
|
|
122
125
|
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
* Whether to allow fetching private network addresses.
|
|
127
|
+
* Turned off by default.
|
|
128
|
+
* @default `false``
|
|
129
|
+
*/
|
|
127
130
|
allowPrivateAddress?: boolean;
|
|
128
131
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
* Options for making `User-Agent` string.
|
|
133
|
+
* If a string is given, it is used as the `User-Agent` header value.
|
|
134
|
+
* If an object is given, it is passed to {@link getUserAgent} function.
|
|
135
|
+
*/
|
|
133
136
|
userAgent?: GetUserAgentOptions | string;
|
|
134
137
|
}
|
|
135
138
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
* A factory function that creates an authenticated {@link DocumentLoader} for
|
|
140
|
+
* a given identity. This is used for fetching documents that require
|
|
141
|
+
* authentication.
|
|
142
|
+
* @param identity The identity to create the document loader for.
|
|
143
|
+
* The actor's key pair.
|
|
144
|
+
* @param options The options for the document loader.
|
|
145
|
+
* @returns The authenticated document loader.
|
|
146
|
+
* @since 0.4.0
|
|
147
|
+
*/
|
|
145
148
|
type AuthenticatedDocumentLoaderFactory = (identity: {
|
|
146
149
|
keyId: URL;
|
|
147
150
|
privateKey: CryptoKey;
|
|
148
151
|
}, options?: DocumentLoaderFactoryOptions) => DocumentLoader;
|
|
149
152
|
/**
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
* Gets a {@link RemoteDocument} from the given response.
|
|
154
|
+
* @param url The URL of the document to load.
|
|
155
|
+
* @param response The response to get the document from.
|
|
156
|
+
* @param fetch The function to fetch the document.
|
|
157
|
+
* @returns The loaded remote document.
|
|
158
|
+
* @throws {FetchError} If the response is not OK.
|
|
159
|
+
* @internal
|
|
160
|
+
*/
|
|
158
161
|
declare function getRemoteDocument(url: string, response: Response, fetch: (url: string, options?: DocumentLoaderOptions) => Promise<RemoteDocument>): Promise<RemoteDocument>;
|
|
159
162
|
/**
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
* Options for {@link getDocumentLoader}.
|
|
164
|
+
* @since 1.3.0
|
|
165
|
+
*/
|
|
163
166
|
interface GetDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
164
167
|
/**
|
|
165
|
-
|
|
166
|
-
|
|
168
|
+
* Whether to preload the frequently used contexts.
|
|
169
|
+
*/
|
|
167
170
|
skipPreloadedContexts?: boolean;
|
|
168
171
|
}
|
|
169
172
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
173
|
+
* Creates a JSON-LD document loader that utilizes the browser's `fetch` API.
|
|
174
|
+
*
|
|
175
|
+
* The created loader preloads the below frequently used contexts by default
|
|
176
|
+
* (unless `options.skipPreloadedContexts` is set to `true`):
|
|
177
|
+
*
|
|
178
|
+
* - <https://www.w3.org/ns/activitystreams>
|
|
179
|
+
* - <https://w3id.org/security/v1>
|
|
180
|
+
* - <https://w3id.org/security/data-integrity/v1>
|
|
181
|
+
* - <https://www.w3.org/ns/did/v1>
|
|
182
|
+
* - <https://w3id.org/security/multikey/v1>
|
|
183
|
+
* - <https://purl.archive.org/socialweb/webfinger>
|
|
184
|
+
* - <http://schema.org/>
|
|
185
|
+
* @param options Options for the document loader.
|
|
186
|
+
* @returns The document loader.
|
|
187
|
+
* @since 1.3.0
|
|
188
|
+
*/
|
|
186
189
|
declare function getDocumentLoader({
|
|
187
190
|
allowPrivateAddress,
|
|
188
191
|
skipPreloadedContexts,
|
|
@@ -191,74 +194,74 @@ declare function getDocumentLoader({
|
|
|
191
194
|
//#endregion
|
|
192
195
|
//#region src/key.d.ts
|
|
193
196
|
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
* Imports a PEM-SPKI formatted public key.
|
|
198
|
+
* @param pem The PEM-SPKI formatted public key.
|
|
199
|
+
* @returns The imported public key.
|
|
200
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
201
|
+
* @since 0.5.0
|
|
202
|
+
*/
|
|
200
203
|
declare function importSpki(pem: string): Promise<CryptoKey>;
|
|
201
204
|
/**
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
* Exports a public key in PEM-SPKI format.
|
|
206
|
+
* @param key The public key to export.
|
|
207
|
+
* @returns The exported public key in PEM-SPKI format.
|
|
208
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
209
|
+
* @since 0.5.0
|
|
210
|
+
*/
|
|
208
211
|
declare function exportSpki(key: CryptoKey): Promise<string>;
|
|
209
212
|
/**
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
* Imports a PEM-PKCS#1 formatted public key.
|
|
214
|
+
* @param pem The PEM-PKCS#1 formatted public key.
|
|
215
|
+
* @returns The imported public key.
|
|
216
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
217
|
+
* @since 1.5.0
|
|
218
|
+
*/
|
|
216
219
|
declare function importPkcs1(pem: string): Promise<CryptoKey>;
|
|
217
220
|
/**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
* Imports a PEM formatted public key (SPKI or PKCS#1).
|
|
222
|
+
* @param pem The PEM formatted public key to import (SPKI or PKCS#1).
|
|
223
|
+
* @returns The imported public key.
|
|
224
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
225
|
+
* @since 1.5.0
|
|
226
|
+
*/
|
|
224
227
|
declare function importPem(pem: string): Promise<CryptoKey>;
|
|
225
228
|
/**
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
* Imports a [Multibase]-encoded public key.
|
|
230
|
+
*
|
|
231
|
+
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
|
|
232
|
+
* @param key The Multibase-encoded public key.
|
|
233
|
+
* @returns The imported public key.
|
|
234
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
235
|
+
* @since 0.10.0
|
|
236
|
+
*/
|
|
234
237
|
declare function importMultibaseKey(key: string): Promise<CryptoKey>;
|
|
235
238
|
/**
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
239
|
+
* Exports a public key in [Multibase] format.
|
|
240
|
+
*
|
|
241
|
+
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
|
|
242
|
+
* @param key The public key to export.
|
|
243
|
+
* @returns The exported public key in Multibase format.
|
|
244
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
245
|
+
* @since 0.10.0
|
|
246
|
+
*/
|
|
244
247
|
declare function exportMultibaseKey(key: CryptoKey): Promise<string>;
|
|
245
248
|
//#endregion
|
|
246
249
|
//#region src/langstr.d.ts
|
|
247
250
|
/**
|
|
248
|
-
|
|
249
|
-
|
|
251
|
+
* A language-tagged string which corresponds to the `rdf:langString` type.
|
|
252
|
+
*/
|
|
250
253
|
declare class LanguageString extends String {
|
|
251
254
|
/**
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
* The locale of the string.
|
|
256
|
+
* @since 2.0.0
|
|
257
|
+
*/
|
|
255
258
|
readonly locale: Intl.Locale;
|
|
256
259
|
/**
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
* Constructs a new `LanguageString`.
|
|
261
|
+
* @param value A string value written in the given language.
|
|
262
|
+
* @param language The language of the string. If a string is given, it will
|
|
263
|
+
* be parsed as a `Intl.Locale` object.
|
|
264
|
+
*/
|
|
262
265
|
constructor(value: string, language: Intl.Locale | string);
|
|
263
266
|
}
|
|
264
267
|
//#endregion
|
|
@@ -280,8 +283,8 @@ interface CodecFactory {
|
|
|
280
283
|
//#endregion
|
|
281
284
|
//#region src/multibase/base.d.ts
|
|
282
285
|
/**
|
|
283
|
-
|
|
284
|
-
|
|
286
|
+
* Class to encode/decode in the supported Bases
|
|
287
|
+
*/
|
|
285
288
|
declare class Base {
|
|
286
289
|
name: BaseName;
|
|
287
290
|
private code;
|
|
@@ -295,25 +298,25 @@ declare class Base {
|
|
|
295
298
|
//#endregion
|
|
296
299
|
//#region src/multibase/mod.d.ts
|
|
297
300
|
/**
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
* Encode data with the specified base and add the multibase prefix.
|
|
302
|
+
*
|
|
303
|
+
* @throws {Error} Will throw if the encoding is not supported
|
|
304
|
+
*/
|
|
302
305
|
declare function encodeMultibase(nameOrCode: BaseNameOrCode, buf: Uint8Array): Uint8Array;
|
|
303
306
|
/**
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
307
|
+
* Takes a Uint8Array or string encoded with multibase header, decodes it and
|
|
308
|
+
* returns the decoded buffer
|
|
309
|
+
*
|
|
310
|
+
* @throws {Error} Will throw if the encoding is not supported
|
|
311
|
+
*/
|
|
309
312
|
declare function decodeMultibase(data: Uint8Array | string): Uint8Array;
|
|
310
313
|
/**
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
314
|
+
* Get encoding multibase from data
|
|
315
|
+
*
|
|
316
|
+
* @param {string|Uint8Array} data
|
|
317
|
+
* @returns {Base}
|
|
318
|
+
* @throws {Error} Will throw if the encoding is not supported
|
|
319
|
+
*/
|
|
317
320
|
declare function encodingFromBaseData(data: string | Uint8Array): Base;
|
|
318
321
|
//#endregion
|
|
319
322
|
//#region src/url.d.ts
|
|
@@ -321,8 +324,8 @@ declare class UrlError extends Error {
|
|
|
321
324
|
constructor(message: string);
|
|
322
325
|
}
|
|
323
326
|
/**
|
|
324
|
-
|
|
325
|
-
|
|
327
|
+
* Validates a URL to prevent SSRF attacks.
|
|
328
|
+
*/
|
|
326
329
|
declare function validatePublicUrl(url: string): Promise<void>;
|
|
327
330
|
declare function isValidPublicIPv4Address(address: string): boolean;
|
|
328
331
|
declare function isValidPublicIPv6Address(address: string): boolean;
|
package/dist/mod.js
CHANGED
|
@@ -4159,7 +4159,7 @@ var contexts_default = preloadedContexts;
|
|
|
4159
4159
|
//#endregion
|
|
4160
4160
|
//#region deno.json
|
|
4161
4161
|
var name = "@fedify/vocab-runtime";
|
|
4162
|
-
var version = "2.1.0-dev.
|
|
4162
|
+
var version = "2.1.0-dev.408+5c3c9d78";
|
|
4163
4163
|
var license = "MIT";
|
|
4164
4164
|
var exports = { ".": "./src/mod.ts" };
|
|
4165
4165
|
var description = "Runtime library for @fedify/vocab";
|
|
@@ -5176,12 +5176,12 @@ var LanguageString = class extends String {
|
|
|
5176
5176
|
super(value);
|
|
5177
5177
|
this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
|
|
5178
5178
|
}
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
}
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
}
|
|
5179
|
+
};
|
|
5180
|
+
LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
5181
|
+
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
5182
|
+
};
|
|
5183
|
+
LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
5184
|
+
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
5185
5185
|
};
|
|
5186
5186
|
|
|
5187
5187
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-DWy1uDak.cjs');
|
|
2
|
-
const require_request = require('./request-
|
|
2
|
+
const require_request = require('./request-DJxgzecL.cjs');
|
|
3
3
|
const require_link = require('./link-CdFPEo9O.cjs');
|
|
4
4
|
const require_url = require('./url-C5Vs9nYh.cjs');
|
|
5
5
|
const node_assert = require_chunk.__toESM(require("node:assert"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchError, createActivityPubRequest, deno_default, logRequest } from "./request-
|
|
1
|
+
import { FetchError, createActivityPubRequest, deno_default, logRequest } from "./request-DuqQMin-.js";
|
|
2
2
|
import { HttpHeaderLink } from "./link-Ck2yj4dH.js";
|
|
3
3
|
import { UrlError, validatePublicUrl } from "./url-fW_DHbih.js";
|
|
4
4
|
import "node:module";
|
|
@@ -23,12 +23,12 @@ var LanguageString = class extends String {
|
|
|
23
23
|
super(value);
|
|
24
24
|
this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
26
|
+
};
|
|
27
|
+
LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
28
|
+
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
29
|
+
};
|
|
30
|
+
LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
31
|
+
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
//#endregion
|
|
@@ -22,12 +22,12 @@ var LanguageString = class extends String {
|
|
|
22
22
|
super(value);
|
|
23
23
|
this.locale = typeof language === "string" ? new Intl.Locale(language) : language;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
25
|
+
};
|
|
26
|
+
LanguageString.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
|
|
27
|
+
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
28
|
+
};
|
|
29
|
+
LanguageString.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
|
|
30
|
+
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
@@ -3,7 +3,7 @@ const node_process = require_chunk.__toESM(require("node:process"));
|
|
|
3
3
|
|
|
4
4
|
//#region deno.json
|
|
5
5
|
var name = "@fedify/vocab-runtime";
|
|
6
|
-
var version = "2.1.0-dev.
|
|
6
|
+
var version = "2.1.0-dev.408+5c3c9d78";
|
|
7
7
|
var license = "MIT";
|
|
8
8
|
var exports$1 = { ".": "./src/mod.ts" };
|
|
9
9
|
var description = "Runtime library for @fedify/vocab";
|
|
@@ -2,7 +2,7 @@ import process from "node:process";
|
|
|
2
2
|
|
|
3
3
|
//#region deno.json
|
|
4
4
|
var name = "@fedify/vocab-runtime";
|
|
5
|
-
var version = "2.1.0-dev.
|
|
5
|
+
var version = "2.1.0-dev.408+5c3c9d78";
|
|
6
6
|
var license = "MIT";
|
|
7
7
|
var exports = { ".": "./src/mod.ts" };
|
|
8
8
|
var description = "Runtime library for @fedify/vocab";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-DWy1uDak.cjs');
|
|
2
|
-
const require_request = require('./request-
|
|
2
|
+
const require_request = require('./request-DJxgzecL.cjs');
|
|
3
3
|
const node_assert = require_chunk.__toESM(require("node:assert"));
|
|
4
4
|
const node_test = require_chunk.__toESM(require("node:test"));
|
|
5
5
|
const node_process = require_chunk.__toESM(require("node:process"));
|
package/package.json
CHANGED
package/src/langstr.ts
CHANGED
|
@@ -20,19 +20,27 @@ export class LanguageString extends String {
|
|
|
20
20
|
? new Intl.Locale(language)
|
|
21
21
|
: language;
|
|
22
22
|
}
|
|
23
|
+
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
// Custom inspect hooks for Deno and Node.js debuggers are assigned outside
|
|
26
|
+
// the class body because computed property names using Symbol.for() are
|
|
27
|
+
// incompatible with isolatedDeclarations mode.
|
|
28
|
+
// deno-lint-ignore no-explicit-any
|
|
29
|
+
(LanguageString.prototype as any)[Symbol.for("Deno.customInspect")] = function (
|
|
30
|
+
this: LanguageString,
|
|
31
|
+
inspect: (val: unknown, opts: unknown) => string,
|
|
32
|
+
options: unknown,
|
|
33
|
+
): string {
|
|
34
|
+
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
35
|
+
};
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
// deno-lint-ignore no-explicit-any
|
|
38
|
+
(LanguageString.prototype as any)[Symbol.for("nodejs.util.inspect.custom")] =
|
|
39
|
+
function (
|
|
40
|
+
this: LanguageString,
|
|
32
41
|
_depth: number,
|
|
33
42
|
options: unknown,
|
|
34
43
|
inspect: (value: unknown, options: unknown) => string,
|
|
35
44
|
): string {
|
|
36
45
|
return `<${this.locale.baseName}> ${inspect(this.toString(), options)}`;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
46
|
+
};
|
|
@@ -72,7 +72,9 @@ const constants: Array<[BaseName, BaseCode, CodecFactory, string]> = [
|
|
|
72
72
|
],
|
|
73
73
|
];
|
|
74
74
|
|
|
75
|
-
export const names = constants.reduce<
|
|
75
|
+
export const names: Record<BaseName, Base> = constants.reduce<
|
|
76
|
+
Record<BaseName, Base>
|
|
77
|
+
>(
|
|
76
78
|
(prev, tupple) => {
|
|
77
79
|
prev[tupple[0]] = new Base(tupple[0], tupple[1], tupple[2], tupple[3]);
|
|
78
80
|
return prev;
|
|
@@ -80,7 +82,9 @@ export const names = constants.reduce<Record<BaseName, Base>>(
|
|
|
80
82
|
{} as Record<BaseName, Base>,
|
|
81
83
|
);
|
|
82
84
|
|
|
83
|
-
export const codes = constants.reduce<
|
|
85
|
+
export const codes: Record<BaseCode, Base> = constants.reduce<
|
|
86
|
+
Record<BaseCode, Base>
|
|
87
|
+
>(
|
|
84
88
|
(prev, tupple) => {
|
|
85
89
|
prev[tupple[1]] = names[tupple[0]];
|
|
86
90
|
return prev;
|
package/src/request.ts
CHANGED
|
@@ -103,7 +103,7 @@ export function getUserAgent(
|
|
|
103
103
|
* @param request The request to log.
|
|
104
104
|
* @internal
|
|
105
105
|
*/
|
|
106
|
-
export function logRequest(logger: Logger, request: Request) {
|
|
106
|
+
export function logRequest(logger: Logger, request: Request): void {
|
|
107
107
|
logger.debug(
|
|
108
108
|
"Fetching document: {method} {url} {headers}",
|
|
109
109
|
{
|
package/tsdown.config.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { defineConfig } from "tsdown";
|
|
|
5
5
|
export default [
|
|
6
6
|
defineConfig({
|
|
7
7
|
entry: ["src/mod.ts"],
|
|
8
|
-
dts: true,
|
|
8
|
+
dts: { compilerOptions: { isolatedDeclarations: true, declaration: true } },
|
|
9
9
|
format: ["esm", "cjs"],
|
|
10
10
|
platform: "neutral",
|
|
11
11
|
external: [/^node:/],
|