better-call 0.0.0-experimental.01ff4b77
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 +265 -0
- package/dist/capability.cjs +417 -0
- package/dist/capability.cjs.map +1 -0
- package/dist/capability.d.cts +189 -0
- package/dist/capability.d.mts +189 -0
- package/dist/capability.mjs +401 -0
- package/dist/capability.mjs.map +1 -0
- package/dist/error.cjs +76 -0
- package/dist/error.cjs.map +1 -0
- package/dist/error.d.cts +51 -0
- package/dist/error.d.mts +51 -0
- package/dist/error.mjs +72 -0
- package/dist/error.mjs.map +1 -0
- package/dist/fn.cjs +350 -0
- package/dist/fn.cjs.map +1 -0
- package/dist/fn.d.cts +378 -0
- package/dist/fn.d.mts +378 -0
- package/dist/fn.mjs +350 -0
- package/dist/fn.mjs.map +1 -0
- package/dist/index.cjs +43 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +50 -0
- package/dist/index.d.mts +50 -0
- package/dist/index.mjs +24 -0
- package/dist/index.mjs.map +1 -0
- package/dist/module.cjs +176 -0
- package/dist/module.cjs.map +1 -0
- package/dist/module.d.cts +283 -0
- package/dist/module.d.mts +283 -0
- package/dist/module.mjs +166 -0
- package/dist/module.mjs.map +1 -0
- package/dist/plugins/db.cjs +24 -0
- package/dist/plugins/db.cjs.map +1 -0
- package/dist/plugins/db.d.cts +18 -0
- package/dist/plugins/db.d.mts +18 -0
- package/dist/plugins/db.mjs +19 -0
- package/dist/plugins/db.mjs.map +1 -0
- package/dist/plugins/http/attrs.cjs +91 -0
- package/dist/plugins/http/attrs.cjs.map +1 -0
- package/dist/plugins/http/attrs.d.cts +26 -0
- package/dist/plugins/http/attrs.d.mts +26 -0
- package/dist/plugins/http/attrs.mjs +87 -0
- package/dist/plugins/http/attrs.mjs.map +1 -0
- package/dist/plugins/http/cookie.cjs +117 -0
- package/dist/plugins/http/cookie.cjs.map +1 -0
- package/dist/plugins/http/cookie.d.cts +637 -0
- package/dist/plugins/http/cookie.d.mts +637 -0
- package/dist/plugins/http/cookie.mjs +113 -0
- package/dist/plugins/http/cookie.mjs.map +1 -0
- package/dist/plugins/http/error.cjs +39 -0
- package/dist/plugins/http/error.cjs.map +1 -0
- package/dist/plugins/http/error.d.cts +38 -0
- package/dist/plugins/http/error.d.mts +38 -0
- package/dist/plugins/http/error.mjs +35 -0
- package/dist/plugins/http/error.mjs.map +1 -0
- package/dist/plugins/http/handle.cjs +73 -0
- package/dist/plugins/http/handle.cjs.map +1 -0
- package/dist/plugins/http/handle.d.cts +955 -0
- package/dist/plugins/http/handle.d.mts +955 -0
- package/dist/plugins/http/handle.mjs +72 -0
- package/dist/plugins/http/handle.mjs.map +1 -0
- package/dist/plugins/http/redirect.cjs +82 -0
- package/dist/plugins/http/redirect.cjs.map +1 -0
- package/dist/plugins/http/redirect.d.cts +67 -0
- package/dist/plugins/http/redirect.d.mts +67 -0
- package/dist/plugins/http/redirect.mjs +79 -0
- package/dist/plugins/http/redirect.mjs.map +1 -0
- package/dist/plugins/http/request.cjs +63 -0
- package/dist/plugins/http/request.cjs.map +1 -0
- package/dist/plugins/http/request.d.cts +142 -0
- package/dist/plugins/http/request.d.mts +142 -0
- package/dist/plugins/http/request.mjs +61 -0
- package/dist/plugins/http/request.mjs.map +1 -0
- package/dist/plugins/http/response.cjs +13 -0
- package/dist/plugins/http/response.cjs.map +1 -0
- package/dist/plugins/http/response.d.cts +18 -0
- package/dist/plugins/http/response.d.mts +18 -0
- package/dist/plugins/http/response.mjs +13 -0
- package/dist/plugins/http/response.mjs.map +1 -0
- package/dist/plugins/http.cjs +64 -0
- package/dist/plugins/http.cjs.map +1 -0
- package/dist/plugins/http.d.cts +945 -0
- package/dist/plugins/http.d.mts +945 -0
- package/dist/plugins/http.mjs +37 -0
- package/dist/plugins/http.mjs.map +1 -0
- package/dist/plugins/read-only.cjs +19 -0
- package/dist/plugins/read-only.cjs.map +1 -0
- package/dist/plugins/read-only.d.cts +17 -0
- package/dist/plugins/read-only.d.mts +17 -0
- package/dist/plugins/read-only.mjs +19 -0
- package/dist/plugins/read-only.mjs.map +1 -0
- package/dist/schema.cjs +245 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +411 -0
- package/dist/schema.d.mts +411 -0
- package/dist/schema.mjs +235 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/scope.d.cts +31 -0
- package/dist/scope.d.mts +31 -0
- package/dist/storage.cjs +308 -0
- package/dist/storage.cjs.map +1 -0
- package/dist/storage.d.cts +220 -0
- package/dist/storage.d.mts +220 -0
- package/dist/storage.mjs +302 -0
- package/dist/storage.mjs.map +1 -0
- package/dist/types.d.cts +8 -0
- package/dist/types.d.mts +8 -0
- package/dist/var.cjs +186 -0
- package/dist/var.cjs.map +1 -0
- package/dist/var.d.cts +46 -0
- package/dist/var.d.mts +46 -0
- package/dist/var.mjs +177 -0
- package/dist/var.mjs.map +1 -0
- package/package.json +114 -0
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
import { InferArgs, TypeDefination } from "../../schema.mjs";
|
|
2
|
+
import { FnDefination } from "../../fn.mjs";
|
|
3
|
+
import { VarDefination } from "../../var.mjs";
|
|
4
|
+
import { HttpResponse } from "./response.mjs";
|
|
5
|
+
import { HttpRequest } from "./request.mjs";
|
|
6
|
+
//#region src/plugins/http/cookie.d.ts
|
|
7
|
+
/** Cookie attributes as a SCHEMA - the source of truth. The TS type
|
|
8
|
+
* falls out of it, and everything crossing a fn door validates against
|
|
9
|
+
* it (enum-checked sameSite, `instanceof`-checked expires). */
|
|
10
|
+
declare const cookieShape: {
|
|
11
|
+
maxAge: TypeDefination<number, number | null | undefined, undefined>;
|
|
12
|
+
expires: TypeDefination<Date, Date | null | undefined, undefined>;
|
|
13
|
+
path: TypeDefination<string, string | null | undefined, undefined>;
|
|
14
|
+
domain: TypeDefination<string, string | null | undefined, undefined>;
|
|
15
|
+
secure: TypeDefination<boolean, boolean | null | undefined, undefined>;
|
|
16
|
+
httpOnly: TypeDefination<boolean, boolean | null | undefined, undefined>;
|
|
17
|
+
sameSite: TypeDefination<"strict" | "none" | "lax", "strict" | "none" | "lax" | null | undefined, undefined>;
|
|
18
|
+
};
|
|
19
|
+
type CookieOptions = InferArgs<typeof cookieShape>;
|
|
20
|
+
/**
|
|
21
|
+
* Scope-level cookie DEFAULTS, as a var: whatever sets it - app setup, a
|
|
22
|
+
* module, an interceptor - every `setCookie` below merges its per-call
|
|
23
|
+
* options ON TOP. Config that travels down the call tree is exactly what
|
|
24
|
+
* a var is, so "change the global cookie config" is just a `.set()` at
|
|
25
|
+
* any point in the scope.
|
|
26
|
+
*/
|
|
27
|
+
declare const cookieOptions: VarDefination<"cookieOptions", {
|
|
28
|
+
maxAge?: number | null | undefined;
|
|
29
|
+
expires?: Date | null | undefined;
|
|
30
|
+
path?: string | null | undefined;
|
|
31
|
+
domain?: string | null | undefined;
|
|
32
|
+
secure?: boolean | null | undefined;
|
|
33
|
+
httpOnly?: boolean | null | undefined;
|
|
34
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
35
|
+
}, TypeDefination<{
|
|
36
|
+
maxAge?: number | null | undefined;
|
|
37
|
+
expires?: Date | null | undefined;
|
|
38
|
+
path?: string | null | undefined;
|
|
39
|
+
domain?: string | null | undefined;
|
|
40
|
+
secure?: boolean | null | undefined;
|
|
41
|
+
httpOnly?: boolean | null | undefined;
|
|
42
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
maxAge?: number | null | undefined;
|
|
45
|
+
expires?: Date | null | undefined;
|
|
46
|
+
path?: string | null | undefined;
|
|
47
|
+
domain?: string | null | undefined;
|
|
48
|
+
secure?: boolean | null | undefined;
|
|
49
|
+
httpOnly?: boolean | null | undefined;
|
|
50
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
51
|
+
}, never>, never>;
|
|
52
|
+
/** Read one cookie from the REQUEST jar. Positional: `getCookie("theme")`.
|
|
53
|
+
* Readonly - reading a cookie can never write the scope. */
|
|
54
|
+
declare const getCookie: FnDefination<{
|
|
55
|
+
[x: number]: string;
|
|
56
|
+
0: string;
|
|
57
|
+
length: 1;
|
|
58
|
+
toString: () => string;
|
|
59
|
+
toLocaleString: {
|
|
60
|
+
(): string;
|
|
61
|
+
(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
|
|
62
|
+
};
|
|
63
|
+
pop: () => string | undefined;
|
|
64
|
+
push: (...items: string[]) => number;
|
|
65
|
+
concat: {
|
|
66
|
+
(...items: ConcatArray<string>[]): string[];
|
|
67
|
+
(...items: (string | ConcatArray<string>)[]): string[];
|
|
68
|
+
};
|
|
69
|
+
join: (separator?: string) => string;
|
|
70
|
+
reverse: () => string[];
|
|
71
|
+
shift: () => string | undefined;
|
|
72
|
+
slice: (start?: number, end?: number) => string[];
|
|
73
|
+
sort: (compareFn?: ((a: string, b: string) => number) | undefined) => [string] & {};
|
|
74
|
+
splice: {
|
|
75
|
+
(start: number, deleteCount?: number): string[];
|
|
76
|
+
(start: number, deleteCount: number, ...items: string[]): string[];
|
|
77
|
+
};
|
|
78
|
+
unshift: (...items: string[]) => number;
|
|
79
|
+
indexOf: (searchElement: string, fromIndex?: number) => number;
|
|
80
|
+
lastIndexOf: (searchElement: string, fromIndex?: number) => number;
|
|
81
|
+
every: {
|
|
82
|
+
<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[];
|
|
83
|
+
(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean;
|
|
84
|
+
};
|
|
85
|
+
some: (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => boolean;
|
|
86
|
+
forEach: (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void;
|
|
87
|
+
map: <U>(callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[];
|
|
88
|
+
filter: {
|
|
89
|
+
<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[];
|
|
90
|
+
(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[];
|
|
91
|
+
};
|
|
92
|
+
reduce: {
|
|
93
|
+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
94
|
+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
95
|
+
<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
96
|
+
};
|
|
97
|
+
reduceRight: {
|
|
98
|
+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string;
|
|
99
|
+
(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string;
|
|
100
|
+
<U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U;
|
|
101
|
+
};
|
|
102
|
+
find: {
|
|
103
|
+
<S extends string>(predicate: (value: string, index: number, obj: string[]) => value is S, thisArg?: any): S | undefined;
|
|
104
|
+
(predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any): string | undefined;
|
|
105
|
+
};
|
|
106
|
+
findIndex: (predicate: (value: string, index: number, obj: string[]) => unknown, thisArg?: any) => number;
|
|
107
|
+
fill: (value: string, start?: number, end?: number) => [string] & {};
|
|
108
|
+
copyWithin: (target: number, start: number, end?: number) => [string] & {};
|
|
109
|
+
entries: () => ArrayIterator<[number, string]>;
|
|
110
|
+
keys: () => ArrayIterator<number>;
|
|
111
|
+
values: () => ArrayIterator<string>;
|
|
112
|
+
includes: (searchElement: string, fromIndex?: number) => boolean;
|
|
113
|
+
flatMap: <U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined) => U[];
|
|
114
|
+
flat: <A, D extends number = 1>(this: A, depth?: D | undefined) => FlatArray<A, D>[];
|
|
115
|
+
at: (index: number) => string | undefined;
|
|
116
|
+
findLast: {
|
|
117
|
+
<S extends string>(predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S | undefined;
|
|
118
|
+
(predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string | undefined;
|
|
119
|
+
};
|
|
120
|
+
findLastIndex: (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => number;
|
|
121
|
+
toReversed: () => string[];
|
|
122
|
+
toSorted: (compareFn?: ((a: string, b: string) => number) | undefined) => string[];
|
|
123
|
+
toSpliced: {
|
|
124
|
+
(start: number, deleteCount: number, ...items: string[]): string[];
|
|
125
|
+
(start: number, deleteCount?: number): string[];
|
|
126
|
+
};
|
|
127
|
+
with: (index: number, value: string) => string[];
|
|
128
|
+
[Symbol.iterator]: () => ArrayIterator<string>;
|
|
129
|
+
readonly [Symbol.unscopables]: {
|
|
130
|
+
[x: number]: boolean | undefined;
|
|
131
|
+
length?: boolean | undefined;
|
|
132
|
+
toString?: boolean | undefined;
|
|
133
|
+
toLocaleString?: boolean | undefined;
|
|
134
|
+
pop?: boolean | undefined;
|
|
135
|
+
push?: boolean | undefined;
|
|
136
|
+
concat?: boolean | undefined;
|
|
137
|
+
join?: boolean | undefined;
|
|
138
|
+
reverse?: boolean | undefined;
|
|
139
|
+
shift?: boolean | undefined;
|
|
140
|
+
slice?: boolean | undefined;
|
|
141
|
+
sort?: boolean | undefined;
|
|
142
|
+
splice?: boolean | undefined;
|
|
143
|
+
unshift?: boolean | undefined;
|
|
144
|
+
indexOf?: boolean | undefined;
|
|
145
|
+
lastIndexOf?: boolean | undefined;
|
|
146
|
+
every?: boolean | undefined;
|
|
147
|
+
some?: boolean | undefined;
|
|
148
|
+
forEach?: boolean | undefined;
|
|
149
|
+
map?: boolean | undefined;
|
|
150
|
+
filter?: boolean | undefined;
|
|
151
|
+
reduce?: boolean | undefined;
|
|
152
|
+
reduceRight?: boolean | undefined;
|
|
153
|
+
find?: boolean | undefined;
|
|
154
|
+
findIndex?: boolean | undefined;
|
|
155
|
+
fill?: boolean | undefined;
|
|
156
|
+
copyWithin?: boolean | undefined;
|
|
157
|
+
entries?: boolean | undefined;
|
|
158
|
+
keys?: boolean | undefined;
|
|
159
|
+
values?: boolean | undefined;
|
|
160
|
+
includes?: boolean | undefined;
|
|
161
|
+
flatMap?: boolean | undefined;
|
|
162
|
+
flat?: boolean | undefined;
|
|
163
|
+
at?: boolean | undefined;
|
|
164
|
+
findLast?: boolean | undefined;
|
|
165
|
+
findLastIndex?: boolean | undefined;
|
|
166
|
+
toReversed?: boolean | undefined;
|
|
167
|
+
toSorted?: boolean | undefined;
|
|
168
|
+
toSpliced?: boolean | undefined;
|
|
169
|
+
with?: boolean | undefined;
|
|
170
|
+
[Symbol.iterator]?: boolean | undefined;
|
|
171
|
+
readonly [Symbol.unscopables]?: boolean | undefined;
|
|
172
|
+
};
|
|
173
|
+
}, string | null, "cookie.get", readonly [TypeDefination<string, string, never>], readonly [], {}, {
|
|
174
|
+
res?: ({
|
|
175
|
+
headers: {
|
|
176
|
+
append: (name: string, value: string) => void;
|
|
177
|
+
delete: (name: string) => void;
|
|
178
|
+
get: (name: string) => string | null;
|
|
179
|
+
getSetCookie: () => string[];
|
|
180
|
+
has: (name: string) => boolean;
|
|
181
|
+
set: (name: string, value: string) => void;
|
|
182
|
+
forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
|
|
183
|
+
entries: () => HeadersIterator<[string, string]>;
|
|
184
|
+
keys: () => HeadersIterator<string>;
|
|
185
|
+
values: () => HeadersIterator<string>;
|
|
186
|
+
[Symbol.iterator]: () => HeadersIterator<[string, string]>;
|
|
187
|
+
};
|
|
188
|
+
status?: number | undefined;
|
|
189
|
+
statusText?: string | undefined;
|
|
190
|
+
} & HttpResponse) | null | undefined;
|
|
191
|
+
req?: ({
|
|
192
|
+
raw: {
|
|
193
|
+
readonly cache: RequestCache;
|
|
194
|
+
readonly credentials: RequestCredentials;
|
|
195
|
+
readonly destination: RequestDestination;
|
|
196
|
+
readonly headers: {
|
|
197
|
+
append: (name: string, value: string) => void;
|
|
198
|
+
delete: (name: string) => void;
|
|
199
|
+
get: (name: string) => string | null;
|
|
200
|
+
getSetCookie: () => string[];
|
|
201
|
+
has: (name: string) => boolean;
|
|
202
|
+
set: (name: string, value: string) => void;
|
|
203
|
+
forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
|
|
204
|
+
entries: () => HeadersIterator<[string, string]>;
|
|
205
|
+
keys: () => HeadersIterator<string>;
|
|
206
|
+
values: () => HeadersIterator<string>;
|
|
207
|
+
[Symbol.iterator]: () => HeadersIterator<[string, string]>;
|
|
208
|
+
};
|
|
209
|
+
readonly integrity: string;
|
|
210
|
+
readonly keepalive: boolean;
|
|
211
|
+
readonly method: string;
|
|
212
|
+
readonly mode: RequestMode;
|
|
213
|
+
readonly redirect: RequestRedirect;
|
|
214
|
+
readonly referrer: string;
|
|
215
|
+
readonly referrerPolicy: ReferrerPolicy;
|
|
216
|
+
readonly signal: {
|
|
217
|
+
readonly aborted: boolean;
|
|
218
|
+
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
219
|
+
readonly reason: any;
|
|
220
|
+
throwIfAborted: () => void;
|
|
221
|
+
addEventListener: {
|
|
222
|
+
<K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
223
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
224
|
+
};
|
|
225
|
+
removeEventListener: {
|
|
226
|
+
<K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
227
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
228
|
+
};
|
|
229
|
+
dispatchEvent: (event: Event) => boolean;
|
|
230
|
+
};
|
|
231
|
+
readonly url: string;
|
|
232
|
+
clone: () => Request;
|
|
233
|
+
readonly body: {
|
|
234
|
+
readonly locked: boolean;
|
|
235
|
+
cancel: (reason?: any) => Promise<void>;
|
|
236
|
+
getReader: {
|
|
237
|
+
(options: {
|
|
238
|
+
mode: "byob";
|
|
239
|
+
}): ReadableStreamBYOBReader;
|
|
240
|
+
(): ReadableStreamDefaultReader<Uint8Array<ArrayBuffer>>;
|
|
241
|
+
(options?: ReadableStreamGetReaderOptions): ReadableStreamReader<Uint8Array<ArrayBuffer>>;
|
|
242
|
+
};
|
|
243
|
+
pipeThrough: <T>(transform: ReadableWritablePair<T, Uint8Array<ArrayBuffer>>, options?: StreamPipeOptions) => ReadableStream<T>;
|
|
244
|
+
pipeTo: (destination: WritableStream<Uint8Array<ArrayBuffer>>, options?: StreamPipeOptions) => Promise<void>;
|
|
245
|
+
tee: () => [ReadableStream<Uint8Array<ArrayBuffer>>, ReadableStream<Uint8Array<ArrayBuffer>>];
|
|
246
|
+
values: (options?: ReadableStreamIteratorOptions) => ReadableStreamAsyncIterator<Uint8Array<ArrayBuffer>>;
|
|
247
|
+
[Symbol.asyncIterator]: (options?: ReadableStreamIteratorOptions) => ReadableStreamAsyncIterator<Uint8Array<ArrayBuffer>>;
|
|
248
|
+
} | null;
|
|
249
|
+
readonly bodyUsed: boolean;
|
|
250
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
251
|
+
blob: () => Promise<Blob>;
|
|
252
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
253
|
+
formData: () => Promise<FormData>;
|
|
254
|
+
json: () => Promise<any>;
|
|
255
|
+
text: () => Promise<string>;
|
|
256
|
+
};
|
|
257
|
+
method: string;
|
|
258
|
+
path: string;
|
|
259
|
+
headers: {
|
|
260
|
+
append: (name: string, value: string) => void;
|
|
261
|
+
delete: (name: string) => void;
|
|
262
|
+
get: (name: string) => string | null;
|
|
263
|
+
getSetCookie: () => string[];
|
|
264
|
+
has: (name: string) => boolean;
|
|
265
|
+
set: (name: string, value: string) => void;
|
|
266
|
+
forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
|
|
267
|
+
entries: () => HeadersIterator<[string, string]>;
|
|
268
|
+
keys: () => HeadersIterator<string>;
|
|
269
|
+
values: () => HeadersIterator<string>;
|
|
270
|
+
[Symbol.iterator]: () => HeadersIterator<[string, string]>;
|
|
271
|
+
};
|
|
272
|
+
query: {
|
|
273
|
+
[x: string]: string | string[];
|
|
274
|
+
};
|
|
275
|
+
cookies: {
|
|
276
|
+
[x: string]: string;
|
|
277
|
+
};
|
|
278
|
+
body: unknown;
|
|
279
|
+
} & HttpRequest) | null | undefined;
|
|
280
|
+
cookieOptions?: ({
|
|
281
|
+
maxAge?: number | null | undefined;
|
|
282
|
+
expires?: Date | null | undefined;
|
|
283
|
+
path?: string | null | undefined;
|
|
284
|
+
domain?: string | null | undefined;
|
|
285
|
+
secure?: boolean | null | undefined;
|
|
286
|
+
httpOnly?: boolean | null | undefined;
|
|
287
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
288
|
+
} & {
|
|
289
|
+
maxAge?: number | null | undefined;
|
|
290
|
+
expires?: Date | null | undefined;
|
|
291
|
+
path?: string | null | undefined;
|
|
292
|
+
domain?: string | null | undefined;
|
|
293
|
+
secure?: boolean | null | undefined;
|
|
294
|
+
httpOnly?: boolean | null | undefined;
|
|
295
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
296
|
+
}) | undefined;
|
|
297
|
+
}, unknown>;
|
|
298
|
+
/** Queue a Set-Cookie on the scope's response headers: the scope's
|
|
299
|
+
* `cookieOptions` defaults, with per-call options merged on top. The
|
|
300
|
+
* written cookie also lands in the request jar, so a later `getCookie`
|
|
301
|
+
* in the same scope reads what was set. */
|
|
302
|
+
declare const setCookie: FnDefination<{
|
|
303
|
+
readonly name: string;
|
|
304
|
+
readonly value: string;
|
|
305
|
+
readonly options?: {
|
|
306
|
+
maxAge?: number | null | undefined;
|
|
307
|
+
expires?: Date | null | undefined;
|
|
308
|
+
path?: string | null | undefined;
|
|
309
|
+
domain?: string | null | undefined;
|
|
310
|
+
secure?: boolean | null | undefined;
|
|
311
|
+
httpOnly?: boolean | null | undefined;
|
|
312
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
313
|
+
} | null | undefined;
|
|
314
|
+
}, {
|
|
315
|
+
set: boolean;
|
|
316
|
+
}, "cookie.set", {
|
|
317
|
+
readonly name: TypeDefination<string, string, never>;
|
|
318
|
+
readonly value: TypeDefination<string, string, never>;
|
|
319
|
+
readonly options: TypeDefination<{
|
|
320
|
+
maxAge?: number | null | undefined;
|
|
321
|
+
expires?: Date | null | undefined;
|
|
322
|
+
path?: string | null | undefined;
|
|
323
|
+
domain?: string | null | undefined;
|
|
324
|
+
secure?: boolean | null | undefined;
|
|
325
|
+
httpOnly?: boolean | null | undefined;
|
|
326
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
327
|
+
}, {
|
|
328
|
+
maxAge?: number | null | undefined;
|
|
329
|
+
expires?: Date | null | undefined;
|
|
330
|
+
path?: string | null | undefined;
|
|
331
|
+
domain?: string | null | undefined;
|
|
332
|
+
secure?: boolean | null | undefined;
|
|
333
|
+
httpOnly?: boolean | null | undefined;
|
|
334
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
335
|
+
} | null | undefined, undefined>;
|
|
336
|
+
}, readonly [], {}, {
|
|
337
|
+
res?: ({
|
|
338
|
+
headers: {
|
|
339
|
+
append: (name: string, value: string) => void;
|
|
340
|
+
delete: (name: string) => void;
|
|
341
|
+
get: (name: string) => string | null;
|
|
342
|
+
getSetCookie: () => string[];
|
|
343
|
+
has: (name: string) => boolean;
|
|
344
|
+
set: (name: string, value: string) => void;
|
|
345
|
+
forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
|
|
346
|
+
entries: () => HeadersIterator<[string, string]>;
|
|
347
|
+
keys: () => HeadersIterator<string>;
|
|
348
|
+
values: () => HeadersIterator<string>;
|
|
349
|
+
[Symbol.iterator]: () => HeadersIterator<[string, string]>;
|
|
350
|
+
};
|
|
351
|
+
status?: number | undefined;
|
|
352
|
+
statusText?: string | undefined;
|
|
353
|
+
} & HttpResponse) | null | undefined;
|
|
354
|
+
req?: ({
|
|
355
|
+
raw: {
|
|
356
|
+
readonly cache: RequestCache;
|
|
357
|
+
readonly credentials: RequestCredentials;
|
|
358
|
+
readonly destination: RequestDestination;
|
|
359
|
+
readonly headers: {
|
|
360
|
+
append: (name: string, value: string) => void;
|
|
361
|
+
delete: (name: string) => void;
|
|
362
|
+
get: (name: string) => string | null;
|
|
363
|
+
getSetCookie: () => string[];
|
|
364
|
+
has: (name: string) => boolean;
|
|
365
|
+
set: (name: string, value: string) => void;
|
|
366
|
+
forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
|
|
367
|
+
entries: () => HeadersIterator<[string, string]>;
|
|
368
|
+
keys: () => HeadersIterator<string>;
|
|
369
|
+
values: () => HeadersIterator<string>;
|
|
370
|
+
[Symbol.iterator]: () => HeadersIterator<[string, string]>;
|
|
371
|
+
};
|
|
372
|
+
readonly integrity: string;
|
|
373
|
+
readonly keepalive: boolean;
|
|
374
|
+
readonly method: string;
|
|
375
|
+
readonly mode: RequestMode;
|
|
376
|
+
readonly redirect: RequestRedirect;
|
|
377
|
+
readonly referrer: string;
|
|
378
|
+
readonly referrerPolicy: ReferrerPolicy;
|
|
379
|
+
readonly signal: {
|
|
380
|
+
readonly aborted: boolean;
|
|
381
|
+
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
382
|
+
readonly reason: any;
|
|
383
|
+
throwIfAborted: () => void;
|
|
384
|
+
addEventListener: {
|
|
385
|
+
<K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
386
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
387
|
+
};
|
|
388
|
+
removeEventListener: {
|
|
389
|
+
<K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
390
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
391
|
+
};
|
|
392
|
+
dispatchEvent: (event: Event) => boolean;
|
|
393
|
+
};
|
|
394
|
+
readonly url: string;
|
|
395
|
+
clone: () => Request;
|
|
396
|
+
readonly body: {
|
|
397
|
+
readonly locked: boolean;
|
|
398
|
+
cancel: (reason?: any) => Promise<void>;
|
|
399
|
+
getReader: {
|
|
400
|
+
(options: {
|
|
401
|
+
mode: "byob";
|
|
402
|
+
}): ReadableStreamBYOBReader;
|
|
403
|
+
(): ReadableStreamDefaultReader<Uint8Array<ArrayBuffer>>;
|
|
404
|
+
(options?: ReadableStreamGetReaderOptions): ReadableStreamReader<Uint8Array<ArrayBuffer>>;
|
|
405
|
+
};
|
|
406
|
+
pipeThrough: <T>(transform: ReadableWritablePair<T, Uint8Array<ArrayBuffer>>, options?: StreamPipeOptions) => ReadableStream<T>;
|
|
407
|
+
pipeTo: (destination: WritableStream<Uint8Array<ArrayBuffer>>, options?: StreamPipeOptions) => Promise<void>;
|
|
408
|
+
tee: () => [ReadableStream<Uint8Array<ArrayBuffer>>, ReadableStream<Uint8Array<ArrayBuffer>>];
|
|
409
|
+
values: (options?: ReadableStreamIteratorOptions) => ReadableStreamAsyncIterator<Uint8Array<ArrayBuffer>>;
|
|
410
|
+
[Symbol.asyncIterator]: (options?: ReadableStreamIteratorOptions) => ReadableStreamAsyncIterator<Uint8Array<ArrayBuffer>>;
|
|
411
|
+
} | null;
|
|
412
|
+
readonly bodyUsed: boolean;
|
|
413
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
414
|
+
blob: () => Promise<Blob>;
|
|
415
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
416
|
+
formData: () => Promise<FormData>;
|
|
417
|
+
json: () => Promise<any>;
|
|
418
|
+
text: () => Promise<string>;
|
|
419
|
+
};
|
|
420
|
+
method: string;
|
|
421
|
+
path: string;
|
|
422
|
+
headers: {
|
|
423
|
+
append: (name: string, value: string) => void;
|
|
424
|
+
delete: (name: string) => void;
|
|
425
|
+
get: (name: string) => string | null;
|
|
426
|
+
getSetCookie: () => string[];
|
|
427
|
+
has: (name: string) => boolean;
|
|
428
|
+
set: (name: string, value: string) => void;
|
|
429
|
+
forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
|
|
430
|
+
entries: () => HeadersIterator<[string, string]>;
|
|
431
|
+
keys: () => HeadersIterator<string>;
|
|
432
|
+
values: () => HeadersIterator<string>;
|
|
433
|
+
[Symbol.iterator]: () => HeadersIterator<[string, string]>;
|
|
434
|
+
};
|
|
435
|
+
query: {
|
|
436
|
+
[x: string]: string | string[];
|
|
437
|
+
};
|
|
438
|
+
cookies: {
|
|
439
|
+
[x: string]: string;
|
|
440
|
+
};
|
|
441
|
+
body: unknown;
|
|
442
|
+
} & HttpRequest) | null | undefined;
|
|
443
|
+
cookieOptions?: ({
|
|
444
|
+
maxAge?: number | null | undefined;
|
|
445
|
+
expires?: Date | null | undefined;
|
|
446
|
+
path?: string | null | undefined;
|
|
447
|
+
domain?: string | null | undefined;
|
|
448
|
+
secure?: boolean | null | undefined;
|
|
449
|
+
httpOnly?: boolean | null | undefined;
|
|
450
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
451
|
+
} & {
|
|
452
|
+
maxAge?: number | null | undefined;
|
|
453
|
+
expires?: Date | null | undefined;
|
|
454
|
+
path?: string | null | undefined;
|
|
455
|
+
domain?: string | null | undefined;
|
|
456
|
+
secure?: boolean | null | undefined;
|
|
457
|
+
httpOnly?: boolean | null | undefined;
|
|
458
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
459
|
+
}) | undefined;
|
|
460
|
+
}, unknown>;
|
|
461
|
+
/** Expire a cookie: a Set-Cookie with Max-Age=0 - the attributes (path,
|
|
462
|
+
* domain) must match the ones it was set with. */
|
|
463
|
+
declare const deleteCookie: FnDefination<{
|
|
464
|
+
readonly name: string;
|
|
465
|
+
readonly options?: {
|
|
466
|
+
maxAge?: number | null | undefined;
|
|
467
|
+
expires?: Date | null | undefined;
|
|
468
|
+
path?: string | null | undefined;
|
|
469
|
+
domain?: string | null | undefined;
|
|
470
|
+
secure?: boolean | null | undefined;
|
|
471
|
+
httpOnly?: boolean | null | undefined;
|
|
472
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
473
|
+
} | null | undefined;
|
|
474
|
+
}, {
|
|
475
|
+
set: boolean;
|
|
476
|
+
}, "cookie.delete", {
|
|
477
|
+
readonly name: TypeDefination<string, string, never>;
|
|
478
|
+
readonly options: TypeDefination<{
|
|
479
|
+
maxAge?: number | null | undefined;
|
|
480
|
+
expires?: Date | null | undefined;
|
|
481
|
+
path?: string | null | undefined;
|
|
482
|
+
domain?: string | null | undefined;
|
|
483
|
+
secure?: boolean | null | undefined;
|
|
484
|
+
httpOnly?: boolean | null | undefined;
|
|
485
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
486
|
+
}, {
|
|
487
|
+
maxAge?: number | null | undefined;
|
|
488
|
+
expires?: Date | null | undefined;
|
|
489
|
+
path?: string | null | undefined;
|
|
490
|
+
domain?: string | null | undefined;
|
|
491
|
+
secure?: boolean | null | undefined;
|
|
492
|
+
httpOnly?: boolean | null | undefined;
|
|
493
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
494
|
+
} | null | undefined, undefined>;
|
|
495
|
+
}, readonly [], {}, {
|
|
496
|
+
res?: ({
|
|
497
|
+
headers: {
|
|
498
|
+
append: (name: string, value: string) => void;
|
|
499
|
+
delete: (name: string) => void;
|
|
500
|
+
get: (name: string) => string | null;
|
|
501
|
+
getSetCookie: () => string[];
|
|
502
|
+
has: (name: string) => boolean;
|
|
503
|
+
set: (name: string, value: string) => void;
|
|
504
|
+
forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
|
|
505
|
+
entries: () => HeadersIterator<[string, string]>;
|
|
506
|
+
keys: () => HeadersIterator<string>;
|
|
507
|
+
values: () => HeadersIterator<string>;
|
|
508
|
+
[Symbol.iterator]: () => HeadersIterator<[string, string]>;
|
|
509
|
+
};
|
|
510
|
+
status?: number | undefined;
|
|
511
|
+
statusText?: string | undefined;
|
|
512
|
+
} & HttpResponse) | null | undefined;
|
|
513
|
+
req?: ({
|
|
514
|
+
raw: {
|
|
515
|
+
readonly cache: RequestCache;
|
|
516
|
+
readonly credentials: RequestCredentials;
|
|
517
|
+
readonly destination: RequestDestination;
|
|
518
|
+
readonly headers: {
|
|
519
|
+
append: (name: string, value: string) => void;
|
|
520
|
+
delete: (name: string) => void;
|
|
521
|
+
get: (name: string) => string | null;
|
|
522
|
+
getSetCookie: () => string[];
|
|
523
|
+
has: (name: string) => boolean;
|
|
524
|
+
set: (name: string, value: string) => void;
|
|
525
|
+
forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
|
|
526
|
+
entries: () => HeadersIterator<[string, string]>;
|
|
527
|
+
keys: () => HeadersIterator<string>;
|
|
528
|
+
values: () => HeadersIterator<string>;
|
|
529
|
+
[Symbol.iterator]: () => HeadersIterator<[string, string]>;
|
|
530
|
+
};
|
|
531
|
+
readonly integrity: string;
|
|
532
|
+
readonly keepalive: boolean;
|
|
533
|
+
readonly method: string;
|
|
534
|
+
readonly mode: RequestMode;
|
|
535
|
+
readonly redirect: RequestRedirect;
|
|
536
|
+
readonly referrer: string;
|
|
537
|
+
readonly referrerPolicy: ReferrerPolicy;
|
|
538
|
+
readonly signal: {
|
|
539
|
+
readonly aborted: boolean;
|
|
540
|
+
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
541
|
+
readonly reason: any;
|
|
542
|
+
throwIfAborted: () => void;
|
|
543
|
+
addEventListener: {
|
|
544
|
+
<K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
545
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
546
|
+
};
|
|
547
|
+
removeEventListener: {
|
|
548
|
+
<K extends keyof AbortSignalEventMap>(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
549
|
+
(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
550
|
+
};
|
|
551
|
+
dispatchEvent: (event: Event) => boolean;
|
|
552
|
+
};
|
|
553
|
+
readonly url: string;
|
|
554
|
+
clone: () => Request;
|
|
555
|
+
readonly body: {
|
|
556
|
+
readonly locked: boolean;
|
|
557
|
+
cancel: (reason?: any) => Promise<void>;
|
|
558
|
+
getReader: {
|
|
559
|
+
(options: {
|
|
560
|
+
mode: "byob";
|
|
561
|
+
}): ReadableStreamBYOBReader;
|
|
562
|
+
(): ReadableStreamDefaultReader<Uint8Array<ArrayBuffer>>;
|
|
563
|
+
(options?: ReadableStreamGetReaderOptions): ReadableStreamReader<Uint8Array<ArrayBuffer>>;
|
|
564
|
+
};
|
|
565
|
+
pipeThrough: <T>(transform: ReadableWritablePair<T, Uint8Array<ArrayBuffer>>, options?: StreamPipeOptions) => ReadableStream<T>;
|
|
566
|
+
pipeTo: (destination: WritableStream<Uint8Array<ArrayBuffer>>, options?: StreamPipeOptions) => Promise<void>;
|
|
567
|
+
tee: () => [ReadableStream<Uint8Array<ArrayBuffer>>, ReadableStream<Uint8Array<ArrayBuffer>>];
|
|
568
|
+
values: (options?: ReadableStreamIteratorOptions) => ReadableStreamAsyncIterator<Uint8Array<ArrayBuffer>>;
|
|
569
|
+
[Symbol.asyncIterator]: (options?: ReadableStreamIteratorOptions) => ReadableStreamAsyncIterator<Uint8Array<ArrayBuffer>>;
|
|
570
|
+
} | null;
|
|
571
|
+
readonly bodyUsed: boolean;
|
|
572
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
573
|
+
blob: () => Promise<Blob>;
|
|
574
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
575
|
+
formData: () => Promise<FormData>;
|
|
576
|
+
json: () => Promise<any>;
|
|
577
|
+
text: () => Promise<string>;
|
|
578
|
+
};
|
|
579
|
+
method: string;
|
|
580
|
+
path: string;
|
|
581
|
+
headers: {
|
|
582
|
+
append: (name: string, value: string) => void;
|
|
583
|
+
delete: (name: string) => void;
|
|
584
|
+
get: (name: string) => string | null;
|
|
585
|
+
getSetCookie: () => string[];
|
|
586
|
+
has: (name: string) => boolean;
|
|
587
|
+
set: (name: string, value: string) => void;
|
|
588
|
+
forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
|
|
589
|
+
entries: () => HeadersIterator<[string, string]>;
|
|
590
|
+
keys: () => HeadersIterator<string>;
|
|
591
|
+
values: () => HeadersIterator<string>;
|
|
592
|
+
[Symbol.iterator]: () => HeadersIterator<[string, string]>;
|
|
593
|
+
};
|
|
594
|
+
query: {
|
|
595
|
+
[x: string]: string | string[];
|
|
596
|
+
};
|
|
597
|
+
cookies: {
|
|
598
|
+
[x: string]: string;
|
|
599
|
+
};
|
|
600
|
+
body: unknown;
|
|
601
|
+
} & HttpRequest) | null | undefined;
|
|
602
|
+
cookieOptions?: ({
|
|
603
|
+
maxAge?: number | null | undefined;
|
|
604
|
+
expires?: Date | null | undefined;
|
|
605
|
+
path?: string | null | undefined;
|
|
606
|
+
domain?: string | null | undefined;
|
|
607
|
+
secure?: boolean | null | undefined;
|
|
608
|
+
httpOnly?: boolean | null | undefined;
|
|
609
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
610
|
+
} & {
|
|
611
|
+
maxAge?: number | null | undefined;
|
|
612
|
+
expires?: Date | null | undefined;
|
|
613
|
+
path?: string | null | undefined;
|
|
614
|
+
domain?: string | null | undefined;
|
|
615
|
+
secure?: boolean | null | undefined;
|
|
616
|
+
httpOnly?: boolean | null | undefined;
|
|
617
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
618
|
+
}) | undefined;
|
|
619
|
+
readonly setCookie?: ((input: {
|
|
620
|
+
readonly name: string;
|
|
621
|
+
readonly value: string;
|
|
622
|
+
readonly options?: {
|
|
623
|
+
maxAge?: number | null | undefined;
|
|
624
|
+
expires?: Date | null | undefined;
|
|
625
|
+
path?: string | null | undefined;
|
|
626
|
+
domain?: string | null | undefined;
|
|
627
|
+
secure?: boolean | null | undefined;
|
|
628
|
+
httpOnly?: boolean | null | undefined;
|
|
629
|
+
sameSite?: "strict" | "none" | "lax" | null | undefined;
|
|
630
|
+
} | null | undefined;
|
|
631
|
+
}) => {
|
|
632
|
+
set: boolean;
|
|
633
|
+
}) | undefined;
|
|
634
|
+
}, unknown>;
|
|
635
|
+
//#endregion
|
|
636
|
+
export { CookieOptions, cookieOptions, cookieShape, deleteCookie, getCookie, setCookie };
|
|
637
|
+
//# sourceMappingURL=cookie.d.mts.map
|