@irvinebroque/http-rfc-utils 0.1.0
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/LICENSE +21 -0
- package/README.md +222 -0
- package/dist/auth.d.ts +139 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +991 -0
- package/dist/auth.js.map +1 -0
- package/dist/cache-status.d.ts +15 -0
- package/dist/cache-status.d.ts.map +1 -0
- package/dist/cache-status.js +152 -0
- package/dist/cache-status.js.map +1 -0
- package/dist/cache.d.ts +94 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +244 -0
- package/dist/cache.js.map +1 -0
- package/dist/client-hints.d.ts +23 -0
- package/dist/client-hints.d.ts.map +1 -0
- package/dist/client-hints.js +81 -0
- package/dist/client-hints.js.map +1 -0
- package/dist/conditional.d.ts +97 -0
- package/dist/conditional.d.ts.map +1 -0
- package/dist/conditional.js +300 -0
- package/dist/conditional.js.map +1 -0
- package/dist/content-disposition.d.ts +23 -0
- package/dist/content-disposition.d.ts.map +1 -0
- package/dist/content-disposition.js +122 -0
- package/dist/content-disposition.js.map +1 -0
- package/dist/cookie.d.ts +43 -0
- package/dist/cookie.d.ts.map +1 -0
- package/dist/cookie.js +472 -0
- package/dist/cookie.js.map +1 -0
- package/dist/cors.d.ts +53 -0
- package/dist/cors.d.ts.map +1 -0
- package/dist/cors.js +170 -0
- package/dist/cors.js.map +1 -0
- package/dist/datetime.d.ts +53 -0
- package/dist/datetime.d.ts.map +1 -0
- package/dist/datetime.js +205 -0
- package/dist/datetime.js.map +1 -0
- package/dist/digest.d.ts +220 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +355 -0
- package/dist/digest.js.map +1 -0
- package/dist/encoding.d.ts +14 -0
- package/dist/encoding.d.ts.map +1 -0
- package/dist/encoding.js +86 -0
- package/dist/encoding.js.map +1 -0
- package/dist/etag.d.ts +55 -0
- package/dist/etag.d.ts.map +1 -0
- package/dist/etag.js +182 -0
- package/dist/etag.js.map +1 -0
- package/dist/ext-value.d.ts +40 -0
- package/dist/ext-value.d.ts.map +1 -0
- package/dist/ext-value.js +119 -0
- package/dist/ext-value.js.map +1 -0
- package/dist/forwarded.d.ts +14 -0
- package/dist/forwarded.d.ts.map +1 -0
- package/dist/forwarded.js +93 -0
- package/dist/forwarded.js.map +1 -0
- package/dist/header-utils.d.ts +71 -0
- package/dist/header-utils.d.ts.map +1 -0
- package/dist/header-utils.js +143 -0
- package/dist/header-utils.js.map +1 -0
- package/dist/headers.d.ts +71 -0
- package/dist/headers.d.ts.map +1 -0
- package/dist/headers.js +134 -0
- package/dist/headers.js.map +1 -0
- package/dist/hsts.d.ts +15 -0
- package/dist/hsts.d.ts.map +1 -0
- package/dist/hsts.js +106 -0
- package/dist/hsts.js.map +1 -0
- package/dist/http-signatures.d.ts +202 -0
- package/dist/http-signatures.d.ts.map +1 -0
- package/dist/http-signatures.js +720 -0
- package/dist/http-signatures.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -0
- package/dist/json-pointer.d.ts +97 -0
- package/dist/json-pointer.d.ts.map +1 -0
- package/dist/json-pointer.js +278 -0
- package/dist/json-pointer.js.map +1 -0
- package/dist/jsonpath.d.ts +98 -0
- package/dist/jsonpath.d.ts.map +1 -0
- package/dist/jsonpath.js +1470 -0
- package/dist/jsonpath.js.map +1 -0
- package/dist/language.d.ts +14 -0
- package/dist/language.d.ts.map +1 -0
- package/dist/language.js +95 -0
- package/dist/language.js.map +1 -0
- package/dist/link.d.ts +102 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +437 -0
- package/dist/link.js.map +1 -0
- package/dist/linkset.d.ts +111 -0
- package/dist/linkset.d.ts.map +1 -0
- package/dist/linkset.js +501 -0
- package/dist/linkset.js.map +1 -0
- package/dist/negotiate.d.ts +71 -0
- package/dist/negotiate.d.ts.map +1 -0
- package/dist/negotiate.js +357 -0
- package/dist/negotiate.js.map +1 -0
- package/dist/pagination.d.ts +80 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +188 -0
- package/dist/pagination.js.map +1 -0
- package/dist/prefer.d.ts +18 -0
- package/dist/prefer.d.ts.map +1 -0
- package/dist/prefer.js +93 -0
- package/dist/prefer.js.map +1 -0
- package/dist/problem.d.ts +54 -0
- package/dist/problem.d.ts.map +1 -0
- package/dist/problem.js +104 -0
- package/dist/problem.js.map +1 -0
- package/dist/proxy-status.d.ts +28 -0
- package/dist/proxy-status.d.ts.map +1 -0
- package/dist/proxy-status.js +220 -0
- package/dist/proxy-status.js.map +1 -0
- package/dist/range.d.ts +28 -0
- package/dist/range.d.ts.map +1 -0
- package/dist/range.js +243 -0
- package/dist/range.js.map +1 -0
- package/dist/response.d.ts +101 -0
- package/dist/response.d.ts.map +1 -0
- package/dist/response.js +200 -0
- package/dist/response.js.map +1 -0
- package/dist/sorting.d.ts +66 -0
- package/dist/sorting.d.ts.map +1 -0
- package/dist/sorting.js +168 -0
- package/dist/sorting.js.map +1 -0
- package/dist/structured-fields.d.ts +30 -0
- package/dist/structured-fields.d.ts.map +1 -0
- package/dist/structured-fields.js +468 -0
- package/dist/structured-fields.js.map +1 -0
- package/dist/types.d.ts +772 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/uri-template.d.ts +48 -0
- package/dist/uri-template.d.ts.map +1 -0
- package/dist/uri-template.js +483 -0
- package/dist/uri-template.js.map +1 -0
- package/dist/uri.d.ts +80 -0
- package/dist/uri.d.ts.map +1 -0
- package/dist/uri.js +423 -0
- package/dist/uri.js.map +1 -0
- package/package.json +66 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
export interface PaginationParams {
|
|
2
|
+
limit: number;
|
|
3
|
+
offset: number;
|
|
4
|
+
sort?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PaginationError {
|
|
7
|
+
error: string;
|
|
8
|
+
}
|
|
9
|
+
export type PaginationResult = PaginationParams | PaginationError;
|
|
10
|
+
export interface DecodedCursor {
|
|
11
|
+
offset: number;
|
|
12
|
+
}
|
|
13
|
+
export interface PaginationLinks {
|
|
14
|
+
self: string;
|
|
15
|
+
first: string;
|
|
16
|
+
next?: string;
|
|
17
|
+
prev?: string;
|
|
18
|
+
last: string;
|
|
19
|
+
}
|
|
20
|
+
export interface PaginatedMeta {
|
|
21
|
+
totalCount: number;
|
|
22
|
+
pageSize: number;
|
|
23
|
+
timestamp: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ProblemDetails {
|
|
26
|
+
type: string;
|
|
27
|
+
title: string;
|
|
28
|
+
status: number;
|
|
29
|
+
detail: string;
|
|
30
|
+
instance?: string;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
}
|
|
33
|
+
export interface LinkDefinition {
|
|
34
|
+
href: string;
|
|
35
|
+
rel: string;
|
|
36
|
+
type?: string;
|
|
37
|
+
title?: string;
|
|
38
|
+
titleLang?: string;
|
|
39
|
+
hreflang?: string | string[];
|
|
40
|
+
media?: string;
|
|
41
|
+
anchor?: string;
|
|
42
|
+
rev?: string;
|
|
43
|
+
[key: string]: string | string[] | undefined;
|
|
44
|
+
}
|
|
45
|
+
export interface ETag {
|
|
46
|
+
weak: boolean;
|
|
47
|
+
value: string;
|
|
48
|
+
}
|
|
49
|
+
export interface CacheOptions {
|
|
50
|
+
public?: boolean;
|
|
51
|
+
private?: boolean;
|
|
52
|
+
privateFields?: string[];
|
|
53
|
+
maxAge?: number;
|
|
54
|
+
sMaxAge?: number;
|
|
55
|
+
noCache?: boolean;
|
|
56
|
+
noCacheFields?: string[];
|
|
57
|
+
noStore?: boolean;
|
|
58
|
+
mustRevalidate?: boolean;
|
|
59
|
+
proxyRevalidate?: boolean;
|
|
60
|
+
immutable?: boolean;
|
|
61
|
+
staleWhileRevalidate?: number;
|
|
62
|
+
staleIfError?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface AcceptEntry {
|
|
65
|
+
type: string;
|
|
66
|
+
subtype: string;
|
|
67
|
+
q: number;
|
|
68
|
+
params: Map<string, string>;
|
|
69
|
+
}
|
|
70
|
+
export type MediaType = 'json' | 'csv' | 'html' | 'text' | 'xml';
|
|
71
|
+
export interface CorsOptions {
|
|
72
|
+
origin?: string | string[] | '*';
|
|
73
|
+
methods?: string[];
|
|
74
|
+
allowHeaders?: string[];
|
|
75
|
+
exposeHeaders?: string[];
|
|
76
|
+
credentials?: boolean;
|
|
77
|
+
maxAge?: number;
|
|
78
|
+
}
|
|
79
|
+
export interface ConditionalResult {
|
|
80
|
+
proceed: boolean;
|
|
81
|
+
status?: 304 | 412;
|
|
82
|
+
headers?: Record<string, string>;
|
|
83
|
+
}
|
|
84
|
+
export interface ByteRange {
|
|
85
|
+
start: number;
|
|
86
|
+
end: number;
|
|
87
|
+
}
|
|
88
|
+
export interface RangeSpec {
|
|
89
|
+
unit: 'bytes';
|
|
90
|
+
ranges: ByteRange[];
|
|
91
|
+
}
|
|
92
|
+
export interface ContentRange {
|
|
93
|
+
unit: 'bytes';
|
|
94
|
+
range?: ByteRange;
|
|
95
|
+
size: number | '*';
|
|
96
|
+
unsatisfied?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface RangeDecision {
|
|
99
|
+
type: 'none' | 'partial' | 'unsatisfiable' | 'ignored';
|
|
100
|
+
ranges?: ByteRange[];
|
|
101
|
+
headers?: Record<string, string>;
|
|
102
|
+
}
|
|
103
|
+
export interface PreferParam {
|
|
104
|
+
key: string;
|
|
105
|
+
value?: string;
|
|
106
|
+
}
|
|
107
|
+
export interface PreferToken {
|
|
108
|
+
token: string;
|
|
109
|
+
value?: string;
|
|
110
|
+
params: PreferParam[];
|
|
111
|
+
}
|
|
112
|
+
export type PreferMap = Map<string, PreferToken>;
|
|
113
|
+
export interface ForwardedElement {
|
|
114
|
+
for?: string;
|
|
115
|
+
by?: string;
|
|
116
|
+
host?: string;
|
|
117
|
+
proto?: string;
|
|
118
|
+
extensions?: Record<string, string>;
|
|
119
|
+
}
|
|
120
|
+
export interface ContentDisposition {
|
|
121
|
+
type: string;
|
|
122
|
+
params: Record<string, string>;
|
|
123
|
+
}
|
|
124
|
+
export interface DispositionParams {
|
|
125
|
+
filename?: string;
|
|
126
|
+
filenameStar?: {
|
|
127
|
+
value: string;
|
|
128
|
+
language?: string;
|
|
129
|
+
};
|
|
130
|
+
[key: string]: string | {
|
|
131
|
+
value: string;
|
|
132
|
+
language?: string;
|
|
133
|
+
} | undefined;
|
|
134
|
+
}
|
|
135
|
+
export interface ParamOptions {
|
|
136
|
+
extended?: boolean;
|
|
137
|
+
language?: string;
|
|
138
|
+
}
|
|
139
|
+
export interface ExtValue {
|
|
140
|
+
charset: string;
|
|
141
|
+
language?: string;
|
|
142
|
+
value: string;
|
|
143
|
+
}
|
|
144
|
+
export interface ExtValueOptions {
|
|
145
|
+
language?: string;
|
|
146
|
+
}
|
|
147
|
+
export interface LanguageRange {
|
|
148
|
+
tag: string;
|
|
149
|
+
q: number;
|
|
150
|
+
}
|
|
151
|
+
export interface EncodingRange {
|
|
152
|
+
encoding: string;
|
|
153
|
+
q: number;
|
|
154
|
+
}
|
|
155
|
+
export interface RetryAfterValue {
|
|
156
|
+
date?: Date;
|
|
157
|
+
delaySeconds?: number;
|
|
158
|
+
}
|
|
159
|
+
export type SfBareItem = number | string | boolean | Uint8Array;
|
|
160
|
+
export interface SfItem {
|
|
161
|
+
value: SfBareItem;
|
|
162
|
+
params?: Record<string, SfBareItem>;
|
|
163
|
+
}
|
|
164
|
+
export type SfInnerList = {
|
|
165
|
+
items: SfItem[];
|
|
166
|
+
params?: Record<string, SfBareItem>;
|
|
167
|
+
};
|
|
168
|
+
export type SfList = Array<SfItem | SfInnerList>;
|
|
169
|
+
export type SfDictionary = Record<string, SfItem | SfInnerList>;
|
|
170
|
+
export interface CookieAttributes {
|
|
171
|
+
expires?: Date;
|
|
172
|
+
maxAge?: number;
|
|
173
|
+
domain?: string;
|
|
174
|
+
path?: string;
|
|
175
|
+
secure?: boolean;
|
|
176
|
+
httpOnly?: boolean;
|
|
177
|
+
extensions?: Record<string, string | undefined>;
|
|
178
|
+
}
|
|
179
|
+
export interface SetCookie {
|
|
180
|
+
name: string;
|
|
181
|
+
value: string;
|
|
182
|
+
attributes?: CookieAttributes;
|
|
183
|
+
}
|
|
184
|
+
export interface StoredCookie {
|
|
185
|
+
name: string;
|
|
186
|
+
value: string;
|
|
187
|
+
domain: string;
|
|
188
|
+
path: string;
|
|
189
|
+
creationTime: Date;
|
|
190
|
+
lastAccessTime?: Date;
|
|
191
|
+
expires?: Date;
|
|
192
|
+
secureOnly?: boolean;
|
|
193
|
+
httpOnly?: boolean;
|
|
194
|
+
hostOnly?: boolean;
|
|
195
|
+
}
|
|
196
|
+
export interface CookieHeaderOptions {
|
|
197
|
+
now?: Date;
|
|
198
|
+
includeHttpOnly?: boolean;
|
|
199
|
+
isSecure?: boolean;
|
|
200
|
+
}
|
|
201
|
+
export interface StrictTransportSecurityOptions {
|
|
202
|
+
maxAge: number;
|
|
203
|
+
includeSubDomains?: boolean;
|
|
204
|
+
}
|
|
205
|
+
export type ClientHintToken = string;
|
|
206
|
+
export type ClientHintList = string[];
|
|
207
|
+
export interface CacheStatusParams {
|
|
208
|
+
hit?: boolean;
|
|
209
|
+
fwd?: string;
|
|
210
|
+
fwdStatus?: number;
|
|
211
|
+
ttl?: number;
|
|
212
|
+
stored?: boolean;
|
|
213
|
+
collapsed?: boolean;
|
|
214
|
+
key?: string;
|
|
215
|
+
detail?: string;
|
|
216
|
+
extensions?: Record<string, SfBareItem>;
|
|
217
|
+
}
|
|
218
|
+
export interface CacheStatusEntry {
|
|
219
|
+
cache: string;
|
|
220
|
+
params: CacheStatusParams;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* All 32 proxy error types defined in RFC 9209 §2.3.
|
|
224
|
+
*/
|
|
225
|
+
export type ProxyErrorType = 'dns_timeout' | 'dns_error' | 'destination_not_found' | 'destination_unavailable' | 'destination_ip_prohibited' | 'destination_ip_unroutable' | 'connection_refused' | 'connection_terminated' | 'connection_timeout' | 'connection_read_timeout' | 'connection_write_timeout' | 'connection_limit_reached' | 'tls_protocol_error' | 'tls_certificate_error' | 'tls_alert_received' | 'http_request_error' | 'http_request_denied' | 'http_response_incomplete' | 'http_response_header_section_size' | 'http_response_header_size' | 'http_response_body_size' | 'http_response_trailer_section_size' | 'http_response_trailer_size' | 'http_response_transfer_coding' | 'http_response_content_coding' | 'http_response_timeout' | 'http_upgrade_failed' | 'http_protocol_error' | 'proxy_internal_response' | 'proxy_internal_error' | 'proxy_configuration_error' | 'proxy_loop_detected';
|
|
226
|
+
/**
|
|
227
|
+
* Parameters for Proxy-Status entries.
|
|
228
|
+
* RFC 9209 §2.1.
|
|
229
|
+
*/
|
|
230
|
+
export interface ProxyStatusParams {
|
|
231
|
+
/** RFC 9209 §2.1.1: Proxy error type token. */
|
|
232
|
+
error?: string;
|
|
233
|
+
/** RFC 9209 §2.1.2: Next hop identifier (hostname, IP, or alias). */
|
|
234
|
+
nextHop?: string;
|
|
235
|
+
/** RFC 9209 §2.1.3: ALPN protocol identifier. */
|
|
236
|
+
nextProtocol?: string;
|
|
237
|
+
/** RFC 9209 §2.1.4: HTTP status code received from next hop. */
|
|
238
|
+
receivedStatus?: number;
|
|
239
|
+
/** RFC 9209 §2.1.5: Additional implementation-specific details. */
|
|
240
|
+
details?: string;
|
|
241
|
+
/** RFC 9209 §2.3.2: DNS RCODE for dns_error. */
|
|
242
|
+
rcode?: string;
|
|
243
|
+
/** RFC 9209 §2.3.2: Extended DNS Error Code INFO-CODE. */
|
|
244
|
+
infoCode?: number;
|
|
245
|
+
/** RFC 9209 §2.3.15: TLS alert ID for tls_alert_received. */
|
|
246
|
+
alertId?: number;
|
|
247
|
+
/** RFC 9209 §2.3.15: TLS alert message for tls_alert_received. */
|
|
248
|
+
alertMessage?: string;
|
|
249
|
+
/** Extension parameters not defined in RFC 9209. */
|
|
250
|
+
extensions?: Record<string, SfBareItem>;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* A single Proxy-Status entry representing one intermediary.
|
|
254
|
+
* RFC 9209 §2.
|
|
255
|
+
*/
|
|
256
|
+
export interface ProxyStatusEntry {
|
|
257
|
+
/** Proxy identifier (service name, hostname, IP, or generated string). */
|
|
258
|
+
proxy: string;
|
|
259
|
+
/** Parameters describing this proxy's handling of the response. */
|
|
260
|
+
params: ProxyStatusParams;
|
|
261
|
+
}
|
|
262
|
+
export interface AuthParam {
|
|
263
|
+
name: string;
|
|
264
|
+
value: string;
|
|
265
|
+
}
|
|
266
|
+
export interface AuthChallenge {
|
|
267
|
+
scheme: string;
|
|
268
|
+
token68?: string;
|
|
269
|
+
params?: AuthParam[];
|
|
270
|
+
}
|
|
271
|
+
export interface AuthCredentials {
|
|
272
|
+
scheme: string;
|
|
273
|
+
token68?: string;
|
|
274
|
+
params?: AuthParam[];
|
|
275
|
+
}
|
|
276
|
+
export interface BasicCredentials {
|
|
277
|
+
username: string;
|
|
278
|
+
password: string;
|
|
279
|
+
encoding: 'utf-8' | 'latin1';
|
|
280
|
+
}
|
|
281
|
+
export interface BasicChallenge {
|
|
282
|
+
scheme: 'Basic';
|
|
283
|
+
realm: string;
|
|
284
|
+
charset?: 'UTF-8';
|
|
285
|
+
}
|
|
286
|
+
export type BearerError = 'invalid_request' | 'invalid_token' | 'insufficient_scope';
|
|
287
|
+
export interface BearerChallenge {
|
|
288
|
+
realm?: string;
|
|
289
|
+
scope?: string;
|
|
290
|
+
error?: BearerError;
|
|
291
|
+
errorDescription?: string;
|
|
292
|
+
errorUri?: string;
|
|
293
|
+
params?: Record<string, string>;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Digest authentication algorithm identifiers.
|
|
297
|
+
* RFC 7616 §3.3: Algorithms for computing hash functions.
|
|
298
|
+
* MD5 included for backward compatibility; SHA-256 MUST be supported.
|
|
299
|
+
*/
|
|
300
|
+
export type DigestAuthAlgorithm = 'MD5' | 'MD5-sess' | 'SHA-256' | 'SHA-256-sess' | 'SHA-512-256' | 'SHA-512-256-sess';
|
|
301
|
+
/**
|
|
302
|
+
* Quality of protection values.
|
|
303
|
+
* RFC 7616 §3.5: qop-options in challenges, qop in credentials.
|
|
304
|
+
*/
|
|
305
|
+
export type DigestAuthQop = 'auth' | 'auth-int';
|
|
306
|
+
/**
|
|
307
|
+
* Parsed Digest WWW-Authenticate challenge.
|
|
308
|
+
* RFC 7616 §3.3.
|
|
309
|
+
*/
|
|
310
|
+
export interface DigestChallenge {
|
|
311
|
+
scheme: 'Digest';
|
|
312
|
+
realm: string;
|
|
313
|
+
domain?: string[];
|
|
314
|
+
nonce: string;
|
|
315
|
+
opaque?: string;
|
|
316
|
+
stale?: boolean;
|
|
317
|
+
algorithm?: DigestAuthAlgorithm;
|
|
318
|
+
qop?: DigestAuthQop[];
|
|
319
|
+
charset?: 'UTF-8';
|
|
320
|
+
userhash?: boolean;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Parsed Digest Authorization credentials.
|
|
324
|
+
* RFC 7616 §3.4.
|
|
325
|
+
*/
|
|
326
|
+
export interface DigestCredentials {
|
|
327
|
+
scheme: 'Digest';
|
|
328
|
+
username: string;
|
|
329
|
+
usernameEncoded?: boolean;
|
|
330
|
+
realm: string;
|
|
331
|
+
uri: string;
|
|
332
|
+
response: string;
|
|
333
|
+
algorithm?: DigestAuthAlgorithm;
|
|
334
|
+
cnonce?: string;
|
|
335
|
+
opaque?: string;
|
|
336
|
+
qop?: DigestAuthQop;
|
|
337
|
+
nc?: string;
|
|
338
|
+
userhash?: boolean;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Authentication-Info header values.
|
|
342
|
+
* RFC 7616 §3.5.
|
|
343
|
+
*/
|
|
344
|
+
export interface DigestAuthenticationInfo {
|
|
345
|
+
nextnonce?: string;
|
|
346
|
+
qop?: DigestAuthQop;
|
|
347
|
+
rspauth?: string;
|
|
348
|
+
cnonce?: string;
|
|
349
|
+
nc?: string;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Options for computing digest response.
|
|
353
|
+
* RFC 7616 §3.4.1.
|
|
354
|
+
*/
|
|
355
|
+
export interface DigestComputeOptions {
|
|
356
|
+
username: string;
|
|
357
|
+
password: string;
|
|
358
|
+
realm: string;
|
|
359
|
+
method: string;
|
|
360
|
+
uri: string;
|
|
361
|
+
nonce: string;
|
|
362
|
+
cnonce?: string;
|
|
363
|
+
nc?: string;
|
|
364
|
+
qop?: DigestAuthQop;
|
|
365
|
+
algorithm?: DigestAuthAlgorithm;
|
|
366
|
+
entityBody?: Uint8Array;
|
|
367
|
+
}
|
|
368
|
+
export interface ProblemOptions {
|
|
369
|
+
type?: string;
|
|
370
|
+
title: string;
|
|
371
|
+
status: number;
|
|
372
|
+
detail: string;
|
|
373
|
+
instance?: string;
|
|
374
|
+
extensions?: Record<string, unknown>;
|
|
375
|
+
}
|
|
376
|
+
export type UriComponent = 'path' | 'query' | 'fragment' | 'userinfo';
|
|
377
|
+
/**
|
|
378
|
+
* Internationalized string value with optional language tag.
|
|
379
|
+
* RFC 9264 §4.2.4.2, RFC 8187.
|
|
380
|
+
*/
|
|
381
|
+
export interface InternationalizedValue {
|
|
382
|
+
value: string;
|
|
383
|
+
language?: string;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Link target object in JSON linkset format.
|
|
387
|
+
* RFC 9264 §4.2.3, §4.2.4.
|
|
388
|
+
*/
|
|
389
|
+
export interface LinksetTarget {
|
|
390
|
+
href: string;
|
|
391
|
+
type?: string;
|
|
392
|
+
hreflang?: string[];
|
|
393
|
+
title?: string;
|
|
394
|
+
'title*'?: InternationalizedValue[];
|
|
395
|
+
media?: string;
|
|
396
|
+
[key: string]: string | string[] | InternationalizedValue[] | undefined;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Link context object grouping targets by relation type.
|
|
400
|
+
* RFC 9264 §4.2.2.
|
|
401
|
+
*/
|
|
402
|
+
export interface LinksetContext {
|
|
403
|
+
anchor?: string;
|
|
404
|
+
[relationType: string]: LinksetTarget[] | string | undefined;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Top-level linkset document structure.
|
|
408
|
+
* RFC 9264 §4.2.1.
|
|
409
|
+
*/
|
|
410
|
+
export interface Linkset {
|
|
411
|
+
linkset: LinksetContext[];
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Options for JSON linkset formatting.
|
|
415
|
+
*/
|
|
416
|
+
export interface LinksetJsonOptions {
|
|
417
|
+
/** Group links by anchor (default: true) */
|
|
418
|
+
groupByAnchor?: boolean;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Simple link for API catalog items.
|
|
422
|
+
* RFC 9727 §3.1, §4.1.
|
|
423
|
+
*/
|
|
424
|
+
export interface ApiCatalogLink {
|
|
425
|
+
href: string;
|
|
426
|
+
type?: string;
|
|
427
|
+
title?: string;
|
|
428
|
+
hreflang?: string;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Full API entry with service relations.
|
|
432
|
+
* RFC 9727 §4.1, RFC 8631.
|
|
433
|
+
*/
|
|
434
|
+
export interface ApiCatalogApi {
|
|
435
|
+
anchor: string;
|
|
436
|
+
'service-desc'?: LinksetTarget[];
|
|
437
|
+
'service-doc'?: LinksetTarget[];
|
|
438
|
+
'service-meta'?: LinksetTarget[];
|
|
439
|
+
status?: LinksetTarget[];
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Options for creating an API catalog document.
|
|
443
|
+
* RFC 9727 §4.
|
|
444
|
+
*/
|
|
445
|
+
export interface ApiCatalogOptions {
|
|
446
|
+
/** Context URI for the catalog (usually the well-known URL) */
|
|
447
|
+
anchor: string;
|
|
448
|
+
/** Full API entries with service relations */
|
|
449
|
+
apis?: ApiCatalogApi[];
|
|
450
|
+
/** Simple item links to API endpoints */
|
|
451
|
+
items?: ApiCatalogLink[];
|
|
452
|
+
/** Nested api-catalog links for scalability */
|
|
453
|
+
nested?: string[];
|
|
454
|
+
/** Include RFC 9727 profile parameter (default: true) */
|
|
455
|
+
profile?: boolean;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* API catalog document with optional profile.
|
|
459
|
+
* RFC 9727 §4.2, §7.3.
|
|
460
|
+
*/
|
|
461
|
+
export interface ApiCatalog extends Linkset {
|
|
462
|
+
profile?: string;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* A node in the result nodelist: value and its normalized path.
|
|
466
|
+
* RFC 9535 §2.7.
|
|
467
|
+
*/
|
|
468
|
+
export interface JsonPathNode {
|
|
469
|
+
/** The JSON value at this location */
|
|
470
|
+
value: unknown;
|
|
471
|
+
/** Normalized path to this node (e.g., "$['foo'][0]") */
|
|
472
|
+
path: string;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Options for JSONPath query execution.
|
|
476
|
+
*/
|
|
477
|
+
export interface JsonPathOptions {
|
|
478
|
+
/** Throw on invalid query instead of returning null (default: false) */
|
|
479
|
+
throwOnError?: boolean;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* JSONPath AST: root query node.
|
|
483
|
+
* RFC 9535 §2.1.
|
|
484
|
+
*/
|
|
485
|
+
export interface JsonPathQuery {
|
|
486
|
+
type: 'query';
|
|
487
|
+
root: '$' | '@';
|
|
488
|
+
segments: JsonPathSegment[];
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* JSONPath segment types.
|
|
492
|
+
* RFC 9535 §2.5.
|
|
493
|
+
*/
|
|
494
|
+
export type JsonPathSegment = JsonPathChildSegment | JsonPathDescendantSegment;
|
|
495
|
+
export interface JsonPathChildSegment {
|
|
496
|
+
type: 'child';
|
|
497
|
+
selectors: JsonPathSelector[];
|
|
498
|
+
}
|
|
499
|
+
export interface JsonPathDescendantSegment {
|
|
500
|
+
type: 'descendant';
|
|
501
|
+
selectors: JsonPathSelector[];
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* JSONPath selector types.
|
|
505
|
+
* RFC 9535 §2.3.
|
|
506
|
+
*/
|
|
507
|
+
export type JsonPathSelector = JsonPathNameSelector | JsonPathWildcardSelector | JsonPathIndexSelector | JsonPathSliceSelector | JsonPathFilterSelector;
|
|
508
|
+
export interface JsonPathNameSelector {
|
|
509
|
+
type: 'name';
|
|
510
|
+
name: string;
|
|
511
|
+
}
|
|
512
|
+
export interface JsonPathWildcardSelector {
|
|
513
|
+
type: 'wildcard';
|
|
514
|
+
}
|
|
515
|
+
export interface JsonPathIndexSelector {
|
|
516
|
+
type: 'index';
|
|
517
|
+
index: number;
|
|
518
|
+
}
|
|
519
|
+
export interface JsonPathSliceSelector {
|
|
520
|
+
type: 'slice';
|
|
521
|
+
start?: number;
|
|
522
|
+
end?: number;
|
|
523
|
+
step?: number;
|
|
524
|
+
}
|
|
525
|
+
export interface JsonPathFilterSelector {
|
|
526
|
+
type: 'filter';
|
|
527
|
+
expression: JsonPathLogicalExpr;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* JSONPath logical expression types for filter selectors.
|
|
531
|
+
* RFC 9535 §2.3.5.
|
|
532
|
+
*/
|
|
533
|
+
export type JsonPathLogicalExpr = JsonPathOrExpr | JsonPathAndExpr | JsonPathNotExpr | JsonPathComparisonExpr | JsonPathTestExpr | JsonPathFunctionExpr;
|
|
534
|
+
export interface JsonPathOrExpr {
|
|
535
|
+
type: 'or';
|
|
536
|
+
operands: JsonPathLogicalExpr[];
|
|
537
|
+
}
|
|
538
|
+
export interface JsonPathAndExpr {
|
|
539
|
+
type: 'and';
|
|
540
|
+
operands: JsonPathLogicalExpr[];
|
|
541
|
+
}
|
|
542
|
+
export interface JsonPathNotExpr {
|
|
543
|
+
type: 'not';
|
|
544
|
+
operand: JsonPathLogicalExpr;
|
|
545
|
+
}
|
|
546
|
+
export type JsonPathComparisonOp = '==' | '!=' | '<' | '<=' | '>' | '>=';
|
|
547
|
+
export interface JsonPathComparisonExpr {
|
|
548
|
+
type: 'comparison';
|
|
549
|
+
operator: JsonPathComparisonOp;
|
|
550
|
+
left: JsonPathComparable;
|
|
551
|
+
right: JsonPathComparable;
|
|
552
|
+
}
|
|
553
|
+
export interface JsonPathTestExpr {
|
|
554
|
+
type: 'test';
|
|
555
|
+
query: JsonPathQuery;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* JSONPath comparable types for comparisons.
|
|
559
|
+
* RFC 9535 §2.3.5.2.
|
|
560
|
+
*/
|
|
561
|
+
export type JsonPathComparable = JsonPathLiteral | JsonPathSingularQuery | JsonPathFunctionExpr;
|
|
562
|
+
export interface JsonPathLiteral {
|
|
563
|
+
type: 'literal';
|
|
564
|
+
value: string | number | boolean | null;
|
|
565
|
+
}
|
|
566
|
+
export interface JsonPathSingularQuery {
|
|
567
|
+
type: 'singular-query';
|
|
568
|
+
root: '$' | '@';
|
|
569
|
+
segments: JsonPathSegment[];
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* JSONPath function expression.
|
|
573
|
+
* RFC 9535 §2.4.
|
|
574
|
+
*/
|
|
575
|
+
export type JsonPathFunctionName = 'length' | 'count' | 'match' | 'search' | 'value';
|
|
576
|
+
export interface JsonPathFunctionExpr {
|
|
577
|
+
type: 'function';
|
|
578
|
+
name: JsonPathFunctionName;
|
|
579
|
+
args: JsonPathFunctionArg[];
|
|
580
|
+
}
|
|
581
|
+
export type JsonPathFunctionArg = JsonPathLiteral | JsonPathQuery | JsonPathFunctionExpr;
|
|
582
|
+
/**
|
|
583
|
+
* Active digest algorithms suitable for adversarial settings.
|
|
584
|
+
* RFC 9530 §5, §7.2.
|
|
585
|
+
*/
|
|
586
|
+
export type DigestAlgorithm = 'sha-256' | 'sha-512';
|
|
587
|
+
/**
|
|
588
|
+
* All recognized algorithms including deprecated ones.
|
|
589
|
+
* RFC 9530 §5, §7.2.
|
|
590
|
+
*/
|
|
591
|
+
export type DigestAlgorithmAny = DigestAlgorithm | 'md5' | 'sha' | 'unixsum' | 'unixcksum' | 'adler' | 'crc32c';
|
|
592
|
+
/**
|
|
593
|
+
* A parsed digest value from Content-Digest or Repr-Digest fields.
|
|
594
|
+
* RFC 9530 §2, §3.
|
|
595
|
+
*/
|
|
596
|
+
export interface Digest {
|
|
597
|
+
/** Algorithm key (lowercase) */
|
|
598
|
+
algorithm: string;
|
|
599
|
+
/** Raw digest bytes */
|
|
600
|
+
value: Uint8Array;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* A digest preference from Want-Content-Digest or Want-Repr-Digest fields.
|
|
604
|
+
* RFC 9530 §4.
|
|
605
|
+
*/
|
|
606
|
+
export interface DigestPreference {
|
|
607
|
+
/** Algorithm key (lowercase) */
|
|
608
|
+
algorithm: string;
|
|
609
|
+
/**
|
|
610
|
+
* Preference weight (0-10).
|
|
611
|
+
* 0 = not acceptable, 1 = least preferred, 10 = most preferred.
|
|
612
|
+
*/
|
|
613
|
+
weight: number;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Component identifier parameter flags.
|
|
617
|
+
* RFC 9421 §2.1.
|
|
618
|
+
*/
|
|
619
|
+
export interface SignatureComponentParams {
|
|
620
|
+
/** Strict Structured Field serialization */
|
|
621
|
+
sf?: boolean;
|
|
622
|
+
/** Dictionary member key */
|
|
623
|
+
key?: string;
|
|
624
|
+
/** Binary-wrapped */
|
|
625
|
+
bs?: boolean;
|
|
626
|
+
/** From request (response only) */
|
|
627
|
+
req?: boolean;
|
|
628
|
+
/** From trailers */
|
|
629
|
+
tr?: boolean;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* A component identifier for signature base creation.
|
|
633
|
+
* RFC 9421 §2.
|
|
634
|
+
*/
|
|
635
|
+
export interface SignatureComponent {
|
|
636
|
+
/** Component name (field name or derived component) */
|
|
637
|
+
name: string;
|
|
638
|
+
/** Optional parameters */
|
|
639
|
+
params?: SignatureComponentParams;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Signature parameters.
|
|
643
|
+
* RFC 9421 §2.3.
|
|
644
|
+
*/
|
|
645
|
+
export interface SignatureParams {
|
|
646
|
+
/** Unix timestamp when signature was created */
|
|
647
|
+
created?: number;
|
|
648
|
+
/** Unix timestamp when signature expires */
|
|
649
|
+
expires?: number;
|
|
650
|
+
/** Unique nonce for replay protection */
|
|
651
|
+
nonce?: string;
|
|
652
|
+
/** Algorithm identifier */
|
|
653
|
+
alg?: string;
|
|
654
|
+
/** Key identifier */
|
|
655
|
+
keyid?: string;
|
|
656
|
+
/** Application-specific tag */
|
|
657
|
+
tag?: string;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Parsed Signature-Input entry.
|
|
661
|
+
* RFC 9421 §4.1.
|
|
662
|
+
*/
|
|
663
|
+
export interface SignatureInput {
|
|
664
|
+
/** Signature label */
|
|
665
|
+
label: string;
|
|
666
|
+
/** Covered components */
|
|
667
|
+
components: SignatureComponent[];
|
|
668
|
+
/** Signature parameters */
|
|
669
|
+
params?: SignatureParams;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Parsed Signature entry.
|
|
673
|
+
* RFC 9421 §4.2.
|
|
674
|
+
*/
|
|
675
|
+
export interface Signature {
|
|
676
|
+
/** Signature label (must match Signature-Input label) */
|
|
677
|
+
label: string;
|
|
678
|
+
/** Raw signature bytes */
|
|
679
|
+
value: Uint8Array;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Derived component names.
|
|
683
|
+
* RFC 9421 §2.2.
|
|
684
|
+
*/
|
|
685
|
+
export type DerivedComponentName = '@method' | '@target-uri' | '@authority' | '@scheme' | '@request-target' | '@path' | '@query' | '@query-param' | '@status';
|
|
686
|
+
/**
|
|
687
|
+
* Message context for signature base creation.
|
|
688
|
+
* RFC 9421 §2.
|
|
689
|
+
*/
|
|
690
|
+
export interface SignatureMessageContext {
|
|
691
|
+
/** HTTP method (for requests) */
|
|
692
|
+
method?: string;
|
|
693
|
+
/** Full target URI */
|
|
694
|
+
targetUri?: string;
|
|
695
|
+
/** Authority (host + optional port) */
|
|
696
|
+
authority?: string;
|
|
697
|
+
/** Scheme (http/https) */
|
|
698
|
+
scheme?: string;
|
|
699
|
+
/** Absolute path */
|
|
700
|
+
path?: string;
|
|
701
|
+
/** Query string (with leading '?') */
|
|
702
|
+
query?: string;
|
|
703
|
+
/** HTTP status code (for responses) */
|
|
704
|
+
status?: number;
|
|
705
|
+
/** Header field values (field name -> values) */
|
|
706
|
+
headers: Map<string, string[]>;
|
|
707
|
+
/** Trailer field values (field name -> values) */
|
|
708
|
+
trailers?: Map<string, string[]>;
|
|
709
|
+
/** Request context (for response signatures) */
|
|
710
|
+
request?: SignatureMessageContext;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Result of signature base creation.
|
|
714
|
+
* RFC 9421 §2.5.
|
|
715
|
+
*/
|
|
716
|
+
export interface SignatureBaseResult {
|
|
717
|
+
/** The signature base string to sign */
|
|
718
|
+
base: string;
|
|
719
|
+
/** The formatted @signature-params value */
|
|
720
|
+
signatureParams: string;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* A variable value for URI Template expansion.
|
|
724
|
+
* RFC 6570 §2.3, §2.4.2.
|
|
725
|
+
*/
|
|
726
|
+
export type UriTemplateValue = string | string[] | Record<string, string> | undefined;
|
|
727
|
+
/**
|
|
728
|
+
* Variable bindings for URI Template expansion.
|
|
729
|
+
*/
|
|
730
|
+
export type UriTemplateVariables = Record<string, UriTemplateValue>;
|
|
731
|
+
/**
|
|
732
|
+
* Expression operators per RFC 6570 §2.2.
|
|
733
|
+
*/
|
|
734
|
+
export type UriTemplateOperator = '' | '+' | '#' | '.' | '/' | ';' | '?' | '&';
|
|
735
|
+
/**
|
|
736
|
+
* Variable specification with optional modifiers.
|
|
737
|
+
* RFC 6570 §2.3, §2.4.
|
|
738
|
+
*/
|
|
739
|
+
export interface UriTemplateVarSpec {
|
|
740
|
+
name: string;
|
|
741
|
+
prefix?: number;
|
|
742
|
+
explode?: boolean;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Parsed expression with operator and variables.
|
|
746
|
+
* RFC 6570 §2.2.
|
|
747
|
+
*/
|
|
748
|
+
export interface UriTemplateExpression {
|
|
749
|
+
operator: UriTemplateOperator;
|
|
750
|
+
variables: UriTemplateVarSpec[];
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Part of a parsed URI Template: either a literal string or an expression.
|
|
754
|
+
*/
|
|
755
|
+
export type UriTemplatePart = string | UriTemplateExpression;
|
|
756
|
+
/**
|
|
757
|
+
* Parsed URI Template structure.
|
|
758
|
+
*/
|
|
759
|
+
export interface UriTemplate {
|
|
760
|
+
parts: UriTemplatePart[];
|
|
761
|
+
variables: string[];
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Compiled template for efficient repeated expansion.
|
|
765
|
+
*/
|
|
766
|
+
export interface CompiledUriTemplate {
|
|
767
|
+
expand: (variables: UriTemplateVariables) => string;
|
|
768
|
+
variables: string[];
|
|
769
|
+
}
|
|
770
|
+
export declare function isPaginationError(result: PaginationResult): result is PaginationError;
|
|
771
|
+
export declare function isPaginationParams(result: PaginationResult): result is PaginationParams;
|
|
772
|
+
//# sourceMappingURL=types.d.ts.map
|