@cloudflare/workers-types 5.20261112.1 → 5.20261114.1
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/experimental/index.d.ts +272 -165
- package/experimental/index.ts +272 -165
- package/index.d.ts +265 -164
- package/index.ts +265 -164
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -15,60 +15,6 @@ and limitations under the License.
|
|
|
15
15
|
/* eslint-disable */
|
|
16
16
|
// noinspection JSUnusedGlobalSymbols
|
|
17
17
|
declare var onmessage: never;
|
|
18
|
-
/**
|
|
19
|
-
* The **`DOMException`** interface represents an abnormal event (called an exception) that occurs as a result of calling a method or accessing a property of a web API. This is how error conditions are described in web APIs.
|
|
20
|
-
*
|
|
21
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
|
|
22
|
-
*/
|
|
23
|
-
declare class DOMException extends Error {
|
|
24
|
-
constructor(message?: string, name?: string);
|
|
25
|
-
/**
|
|
26
|
-
* The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
|
|
27
|
-
*
|
|
28
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
|
|
29
|
-
*/
|
|
30
|
-
readonly message: string;
|
|
31
|
-
/**
|
|
32
|
-
* The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
|
|
33
|
-
*
|
|
34
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
|
|
35
|
-
*/
|
|
36
|
-
readonly name: string;
|
|
37
|
-
/**
|
|
38
|
-
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
|
|
39
|
-
* @deprecated
|
|
40
|
-
*
|
|
41
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
|
|
42
|
-
*/
|
|
43
|
-
readonly code: number;
|
|
44
|
-
static readonly INDEX_SIZE_ERR: number;
|
|
45
|
-
static readonly DOMSTRING_SIZE_ERR: number;
|
|
46
|
-
static readonly HIERARCHY_REQUEST_ERR: number;
|
|
47
|
-
static readonly WRONG_DOCUMENT_ERR: number;
|
|
48
|
-
static readonly INVALID_CHARACTER_ERR: number;
|
|
49
|
-
static readonly NO_DATA_ALLOWED_ERR: number;
|
|
50
|
-
static readonly NO_MODIFICATION_ALLOWED_ERR: number;
|
|
51
|
-
static readonly NOT_FOUND_ERR: number;
|
|
52
|
-
static readonly NOT_SUPPORTED_ERR: number;
|
|
53
|
-
static readonly INUSE_ATTRIBUTE_ERR: number;
|
|
54
|
-
static readonly INVALID_STATE_ERR: number;
|
|
55
|
-
static readonly SYNTAX_ERR: number;
|
|
56
|
-
static readonly INVALID_MODIFICATION_ERR: number;
|
|
57
|
-
static readonly NAMESPACE_ERR: number;
|
|
58
|
-
static readonly INVALID_ACCESS_ERR: number;
|
|
59
|
-
static readonly VALIDATION_ERR: number;
|
|
60
|
-
static readonly TYPE_MISMATCH_ERR: number;
|
|
61
|
-
static readonly SECURITY_ERR: number;
|
|
62
|
-
static readonly NETWORK_ERR: number;
|
|
63
|
-
static readonly ABORT_ERR: number;
|
|
64
|
-
static readonly URL_MISMATCH_ERR: number;
|
|
65
|
-
static readonly QUOTA_EXCEEDED_ERR: number;
|
|
66
|
-
static readonly TIMEOUT_ERR: number;
|
|
67
|
-
static readonly INVALID_NODE_TYPE_ERR: number;
|
|
68
|
-
static readonly DATA_CLONE_ERR: number;
|
|
69
|
-
get stack(): any;
|
|
70
|
-
set stack(value: any);
|
|
71
|
-
}
|
|
72
18
|
type WorkerGlobalScopeEventMap = {
|
|
73
19
|
fetch: FetchEvent;
|
|
74
20
|
scheduled: ScheduledEvent;
|
|
@@ -3413,116 +3359,6 @@ interface TraceMetrics {
|
|
|
3413
3359
|
interface UnsafeTraceMetrics {
|
|
3414
3360
|
fromTrace(item: TraceItem): TraceMetrics;
|
|
3415
3361
|
}
|
|
3416
|
-
/**
|
|
3417
|
-
* The **`URLPattern`** interface of the URL Pattern API matches URLs or parts of URLs against a pattern. The pattern can contain capturing groups that extract parts of the matched URL.
|
|
3418
|
-
*
|
|
3419
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern)
|
|
3420
|
-
*/
|
|
3421
|
-
declare class URLPattern {
|
|
3422
|
-
constructor(
|
|
3423
|
-
input?: string | URLPatternInit,
|
|
3424
|
-
baseURL?: string | URLPatternOptions,
|
|
3425
|
-
patternOptions?: URLPatternOptions,
|
|
3426
|
-
);
|
|
3427
|
-
/**
|
|
3428
|
-
* The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL.
|
|
3429
|
-
*
|
|
3430
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol)
|
|
3431
|
-
*/
|
|
3432
|
-
get protocol(): string;
|
|
3433
|
-
/**
|
|
3434
|
-
* The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL.
|
|
3435
|
-
*
|
|
3436
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username)
|
|
3437
|
-
*/
|
|
3438
|
-
get username(): string;
|
|
3439
|
-
/**
|
|
3440
|
-
* The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL.
|
|
3441
|
-
*
|
|
3442
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password)
|
|
3443
|
-
*/
|
|
3444
|
-
get password(): string;
|
|
3445
|
-
/**
|
|
3446
|
-
* The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL.
|
|
3447
|
-
*
|
|
3448
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname)
|
|
3449
|
-
*/
|
|
3450
|
-
get hostname(): string;
|
|
3451
|
-
/**
|
|
3452
|
-
* The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL.
|
|
3453
|
-
*
|
|
3454
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port)
|
|
3455
|
-
*/
|
|
3456
|
-
get port(): string;
|
|
3457
|
-
/**
|
|
3458
|
-
* The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL.
|
|
3459
|
-
*
|
|
3460
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname)
|
|
3461
|
-
*/
|
|
3462
|
-
get pathname(): string;
|
|
3463
|
-
/**
|
|
3464
|
-
* The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL.
|
|
3465
|
-
*
|
|
3466
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search)
|
|
3467
|
-
*/
|
|
3468
|
-
get search(): string;
|
|
3469
|
-
/**
|
|
3470
|
-
* The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL.
|
|
3471
|
-
*
|
|
3472
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash)
|
|
3473
|
-
*/
|
|
3474
|
-
get hash(): string;
|
|
3475
|
-
/**
|
|
3476
|
-
* The **`hasRegExpGroups`** read-only property of the URLPattern interface is a boolean indicating whether or not any of the URLPattern components contain regular expression capturing groups.
|
|
3477
|
-
*
|
|
3478
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hasRegExpGroups)
|
|
3479
|
-
*/
|
|
3480
|
-
get hasRegExpGroups(): boolean;
|
|
3481
|
-
/**
|
|
3482
|
-
* The **`test()`** method of the URLPattern interface takes a URL string or object of URL parts, and returns a boolean indicating if the given input matches the current pattern.
|
|
3483
|
-
*
|
|
3484
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test)
|
|
3485
|
-
*/
|
|
3486
|
-
test(input?: string | URLPatternInit, baseURL?: string): boolean;
|
|
3487
|
-
/**
|
|
3488
|
-
* The **`exec()`** method of the URLPattern interface takes a URL or object of URL parts, and returns either an object containing the results of matching the URL to the pattern, or null if the URL does not match the pattern.
|
|
3489
|
-
*
|
|
3490
|
-
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec)
|
|
3491
|
-
*/
|
|
3492
|
-
exec(
|
|
3493
|
-
input?: string | URLPatternInit,
|
|
3494
|
-
baseURL?: string,
|
|
3495
|
-
): URLPatternResult | null;
|
|
3496
|
-
}
|
|
3497
|
-
interface URLPatternInit {
|
|
3498
|
-
protocol?: string;
|
|
3499
|
-
username?: string;
|
|
3500
|
-
password?: string;
|
|
3501
|
-
hostname?: string;
|
|
3502
|
-
port?: string;
|
|
3503
|
-
pathname?: string;
|
|
3504
|
-
search?: string;
|
|
3505
|
-
hash?: string;
|
|
3506
|
-
baseURL?: string;
|
|
3507
|
-
}
|
|
3508
|
-
interface URLPatternComponentResult {
|
|
3509
|
-
input: string;
|
|
3510
|
-
groups: Record<string, string>;
|
|
3511
|
-
}
|
|
3512
|
-
interface URLPatternResult {
|
|
3513
|
-
inputs: (string | URLPatternInit)[];
|
|
3514
|
-
protocol: URLPatternComponentResult;
|
|
3515
|
-
username: URLPatternComponentResult;
|
|
3516
|
-
password: URLPatternComponentResult;
|
|
3517
|
-
hostname: URLPatternComponentResult;
|
|
3518
|
-
port: URLPatternComponentResult;
|
|
3519
|
-
pathname: URLPatternComponentResult;
|
|
3520
|
-
search: URLPatternComponentResult;
|
|
3521
|
-
hash: URLPatternComponentResult;
|
|
3522
|
-
}
|
|
3523
|
-
interface URLPatternOptions {
|
|
3524
|
-
ignoreCase?: boolean;
|
|
3525
|
-
}
|
|
3526
3362
|
type WebSocketEventMap = {
|
|
3527
3363
|
close: CloseEvent;
|
|
3528
3364
|
message: MessageEvent;
|
|
@@ -13313,6 +13149,49 @@ type BrowserRunDevtools = {
|
|
|
13313
13149
|
type BrowserRunCloseSessionResult = {
|
|
13314
13150
|
status: "closing" | "closed";
|
|
13315
13151
|
};
|
|
13152
|
+
/** Library the script runs against. Omit it to receive a raw CDP client. */
|
|
13153
|
+
type BrowserRunScriptLibrary = "playwright" | "puppeteer";
|
|
13154
|
+
/** Options for `script()`. */
|
|
13155
|
+
type BrowserRunScriptOptions = {
|
|
13156
|
+
/** Library whose objects are passed to the script. Omit it for raw CDP. */
|
|
13157
|
+
library?: BrowserRunScriptLibrary;
|
|
13158
|
+
/** Maximum run time of the script in milliseconds, not counting browser
|
|
13159
|
+
* acquisition. Between 1 and 120000.
|
|
13160
|
+
* @default 60000
|
|
13161
|
+
*/
|
|
13162
|
+
timeout?: number;
|
|
13163
|
+
/** How long the session stays open without activity after the run, in
|
|
13164
|
+
* milliseconds. Between 10000 and 1200000.
|
|
13165
|
+
* @default 60000
|
|
13166
|
+
*/
|
|
13167
|
+
keepAlive?: number;
|
|
13168
|
+
/** Use the experimental pool, whose browsers enable Chrome features before
|
|
13169
|
+
* they reach stable Chrome.
|
|
13170
|
+
* @default false
|
|
13171
|
+
*/
|
|
13172
|
+
lab?: boolean;
|
|
13173
|
+
/** Record the browser session. @default false */
|
|
13174
|
+
recording?: boolean;
|
|
13175
|
+
};
|
|
13176
|
+
/** Options for `scriptInSession()`. */
|
|
13177
|
+
type BrowserRunScriptSessionOptions = {
|
|
13178
|
+
/** Library whose objects are passed to the script. Omit it for raw CDP. */
|
|
13179
|
+
library?: BrowserRunScriptLibrary;
|
|
13180
|
+
/** Maximum run time of the script in milliseconds. Between 1 and 120000.
|
|
13181
|
+
* @default 60000
|
|
13182
|
+
*/
|
|
13183
|
+
timeout?: number;
|
|
13184
|
+
/** Page target the script attaches to, such as the `cf-browser-target-id`
|
|
13185
|
+
* header returned by `script()`. Defaults to the session's first page.
|
|
13186
|
+
*/
|
|
13187
|
+
targetId?: string;
|
|
13188
|
+
};
|
|
13189
|
+
/** JSON success body of `script()` and `scriptInSession()`. */
|
|
13190
|
+
type BrowserRunScriptSuccessResponse = {
|
|
13191
|
+
success: true;
|
|
13192
|
+
/** The script's return value, or `null` when it returned nothing. */
|
|
13193
|
+
result: unknown;
|
|
13194
|
+
};
|
|
13316
13195
|
/**
|
|
13317
13196
|
* Browser Run API binding for automating headless browsers.
|
|
13318
13197
|
* @see https://developers.cloudflare.com/browser-run/
|
|
@@ -13527,6 +13406,57 @@ declare abstract class BrowserRun {
|
|
|
13527
13406
|
getSession(sessionId: string): Promise<BrowserRunSession | null>;
|
|
13528
13407
|
/** Close a browser session. */
|
|
13529
13408
|
closeSession(sessionId: string): Promise<BrowserRunCloseSessionResult>;
|
|
13409
|
+
/**
|
|
13410
|
+
* Run a script against a new browser session.
|
|
13411
|
+
* @param code - Source of an async function. It receives the selected
|
|
13412
|
+
* library's objects (Playwright `{ page, context, browser }`, Puppeteer
|
|
13413
|
+
* `{ page, browser }`) or, without `library`, a CDP client.
|
|
13414
|
+
* @param options - Library, timeout and session launch options.
|
|
13415
|
+
* @returns A `Response` containing one of:
|
|
13416
|
+
*
|
|
13417
|
+
* **Success (HTTP 200):**
|
|
13418
|
+
* - `BrowserRunScriptSuccessResponse` JSON with `Content-Type: application/json`
|
|
13419
|
+
* when the script returns a JSON-serializable value or nothing
|
|
13420
|
+
* - The raw body and content type when the script returns binary or other
|
|
13421
|
+
* non-JSON output
|
|
13422
|
+
*
|
|
13423
|
+
* **Error:**
|
|
13424
|
+
* - JSON error body with an HTTP status code (400, 404, 408, 422, 429, 500, 503)
|
|
13425
|
+
* - HTTP 408 when the script exceeds `timeout`
|
|
13426
|
+
* - HTTP 422 when the script fails to compile or throws
|
|
13427
|
+
* - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
|
|
13428
|
+
* throw before any request is made.
|
|
13429
|
+
*
|
|
13430
|
+
* **Headers:**
|
|
13431
|
+
* - `cf-browser-session-id`: Session kept open for `scriptInSession()`
|
|
13432
|
+
* - `cf-browser-target-id`: Page target the script ran on
|
|
13433
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
|
|
13434
|
+
*/
|
|
13435
|
+
script(code: string, options?: BrowserRunScriptOptions): Promise<Response>;
|
|
13436
|
+
/**
|
|
13437
|
+
* Run a script against an existing browser session, such as one kept open by
|
|
13438
|
+
* `script()`.
|
|
13439
|
+
* @param sessionId - Session to run in, such as the `cf-browser-session-id`
|
|
13440
|
+
* header returned by `script()`.
|
|
13441
|
+
* @param code - Source of an async function, as for `script()`.
|
|
13442
|
+
* @param options - Library, timeout and page target options.
|
|
13443
|
+
* @returns A `Response` with the same success bodies as `script()`.
|
|
13444
|
+
*
|
|
13445
|
+
* **Error:**
|
|
13446
|
+
* - JSON error body with an HTTP status code (400, 401, 404, 408, 410, 422, 500)
|
|
13447
|
+
* - HTTP 404 when the session or `targetId` does not exist
|
|
13448
|
+
* - HTTP 410 when the session is already closed
|
|
13449
|
+
* - HTTP errors are returned as a `Response`, not thrown. Invalid `options`
|
|
13450
|
+
* throw before any request is made.
|
|
13451
|
+
*
|
|
13452
|
+
* **Headers:**
|
|
13453
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds
|
|
13454
|
+
*/
|
|
13455
|
+
scriptInSession(
|
|
13456
|
+
sessionId: string,
|
|
13457
|
+
code: string,
|
|
13458
|
+
options?: BrowserRunScriptSessionOptions,
|
|
13459
|
+
): Promise<Response>;
|
|
13530
13460
|
/** DevTools JSON methods exposed through one nested binding target. */
|
|
13531
13461
|
get devtools(): BrowserRunDevtools;
|
|
13532
13462
|
}
|
|
@@ -14843,6 +14773,60 @@ declare abstract class D1PreparedStatement {
|
|
|
14843
14773
|
// TypeScript's interface merging will ensure our empty interface is effectively
|
|
14844
14774
|
// ignored when `Disposable` is included in the standard lib.
|
|
14845
14775
|
interface Disposable {}
|
|
14776
|
+
/**
|
|
14777
|
+
* The **`DOMException`** interface represents an abnormal event (called an exception) that occurs as a result of calling a method or accessing a property of a web API. This is how error conditions are described in web APIs.
|
|
14778
|
+
*
|
|
14779
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)
|
|
14780
|
+
*/
|
|
14781
|
+
declare class DOMException extends Error {
|
|
14782
|
+
constructor(message?: string, name?: string);
|
|
14783
|
+
/**
|
|
14784
|
+
* The **`message`** read-only property of the DOMException interface returns a string representing a message or description associated with the given error name.
|
|
14785
|
+
*
|
|
14786
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)
|
|
14787
|
+
*/
|
|
14788
|
+
readonly message: string;
|
|
14789
|
+
/**
|
|
14790
|
+
* The **`name`** read-only property of the DOMException interface returns a string that contains one of the strings associated with an error name.
|
|
14791
|
+
*
|
|
14792
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)
|
|
14793
|
+
*/
|
|
14794
|
+
readonly name: string;
|
|
14795
|
+
/**
|
|
14796
|
+
* The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
|
|
14797
|
+
* @deprecated
|
|
14798
|
+
*
|
|
14799
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)
|
|
14800
|
+
*/
|
|
14801
|
+
readonly code: number;
|
|
14802
|
+
static readonly INDEX_SIZE_ERR: number;
|
|
14803
|
+
static readonly DOMSTRING_SIZE_ERR: number;
|
|
14804
|
+
static readonly HIERARCHY_REQUEST_ERR: number;
|
|
14805
|
+
static readonly WRONG_DOCUMENT_ERR: number;
|
|
14806
|
+
static readonly INVALID_CHARACTER_ERR: number;
|
|
14807
|
+
static readonly NO_DATA_ALLOWED_ERR: number;
|
|
14808
|
+
static readonly NO_MODIFICATION_ALLOWED_ERR: number;
|
|
14809
|
+
static readonly NOT_FOUND_ERR: number;
|
|
14810
|
+
static readonly NOT_SUPPORTED_ERR: number;
|
|
14811
|
+
static readonly INUSE_ATTRIBUTE_ERR: number;
|
|
14812
|
+
static readonly INVALID_STATE_ERR: number;
|
|
14813
|
+
static readonly SYNTAX_ERR: number;
|
|
14814
|
+
static readonly INVALID_MODIFICATION_ERR: number;
|
|
14815
|
+
static readonly NAMESPACE_ERR: number;
|
|
14816
|
+
static readonly INVALID_ACCESS_ERR: number;
|
|
14817
|
+
static readonly VALIDATION_ERR: number;
|
|
14818
|
+
static readonly TYPE_MISMATCH_ERR: number;
|
|
14819
|
+
static readonly SECURITY_ERR: number;
|
|
14820
|
+
static readonly NETWORK_ERR: number;
|
|
14821
|
+
static readonly ABORT_ERR: number;
|
|
14822
|
+
static readonly URL_MISMATCH_ERR: number;
|
|
14823
|
+
static readonly QUOTA_EXCEEDED_ERR: number;
|
|
14824
|
+
static readonly TIMEOUT_ERR: number;
|
|
14825
|
+
static readonly INVALID_NODE_TYPE_ERR: number;
|
|
14826
|
+
static readonly DATA_CLONE_ERR: number;
|
|
14827
|
+
get stack(): any;
|
|
14828
|
+
set stack(value: any);
|
|
14829
|
+
}
|
|
14846
14830
|
declare module "cloudflare:durable-objects" {
|
|
14847
14831
|
/**
|
|
14848
14832
|
* Marks Durable Object methods as safe to run more than once. The runtime may then retry calls
|
|
@@ -14910,6 +14894,10 @@ interface ForwardableEmailMessage extends EmailMessage {
|
|
|
14910
14894
|
* Size of the email message content.
|
|
14911
14895
|
*/
|
|
14912
14896
|
readonly rawSize: number;
|
|
14897
|
+
/**
|
|
14898
|
+
* Whether this email message can be forwarded with `forward()`.
|
|
14899
|
+
*/
|
|
14900
|
+
readonly canBeForwarded: boolean;
|
|
14913
14901
|
/**
|
|
14914
14902
|
* Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
|
|
14915
14903
|
* @param reason The reject reason.
|
|
@@ -17812,6 +17800,119 @@ declare class URLSearchParams {
|
|
|
17812
17800
|
toString(): string;
|
|
17813
17801
|
[Symbol.iterator](): IterableIterator<[key: string, value: string]>;
|
|
17814
17802
|
}
|
|
17803
|
+
// URLPattern, as the URLPattern standard declares it, for both parsers.
|
|
17804
|
+
// The legacy parser (the urlpattern_original compatibility flag, the
|
|
17805
|
+
// default before 2025-05-01) has no hasRegExpGroups.
|
|
17806
|
+
/**
|
|
17807
|
+
* The **`URLPattern`** interface of the URL Pattern API matches URLs or parts of URLs against a pattern. The pattern can contain capturing groups that extract parts of the matched URL.
|
|
17808
|
+
*
|
|
17809
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern)
|
|
17810
|
+
*/
|
|
17811
|
+
declare class URLPattern {
|
|
17812
|
+
constructor(
|
|
17813
|
+
input?: string | URLPatternInit,
|
|
17814
|
+
baseURL?: string | URLPatternOptions,
|
|
17815
|
+
patternOptions?: URLPatternOptions,
|
|
17816
|
+
);
|
|
17817
|
+
/**
|
|
17818
|
+
* The **`protocol`** read-only property of the URLPattern interface is a string containing the pattern used to match the protocol part of a URL.
|
|
17819
|
+
*
|
|
17820
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/protocol)
|
|
17821
|
+
*/
|
|
17822
|
+
get protocol(): string;
|
|
17823
|
+
/**
|
|
17824
|
+
* The **`username`** read-only property of the URLPattern interface is a string containing the pattern used to match the username part of a URL.
|
|
17825
|
+
*
|
|
17826
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/username)
|
|
17827
|
+
*/
|
|
17828
|
+
get username(): string;
|
|
17829
|
+
/**
|
|
17830
|
+
* The **`password`** read-only property of the URLPattern interface is a string containing the pattern used to match the password part of a URL.
|
|
17831
|
+
*
|
|
17832
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/password)
|
|
17833
|
+
*/
|
|
17834
|
+
get password(): string;
|
|
17835
|
+
/**
|
|
17836
|
+
* The **`hostname`** read-only property of the URLPattern interface is a string containing the pattern used to match the hostname part of a URL.
|
|
17837
|
+
*
|
|
17838
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hostname)
|
|
17839
|
+
*/
|
|
17840
|
+
get hostname(): string;
|
|
17841
|
+
/**
|
|
17842
|
+
* The **`port`** read-only property of the URLPattern interface is a string containing the pattern used to match the port part of a URL.
|
|
17843
|
+
*
|
|
17844
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/port)
|
|
17845
|
+
*/
|
|
17846
|
+
get port(): string;
|
|
17847
|
+
/**
|
|
17848
|
+
* The **`pathname`** read-only property of the URLPattern interface is a string containing the pattern used to match the pathname part of a URL.
|
|
17849
|
+
*
|
|
17850
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/pathname)
|
|
17851
|
+
*/
|
|
17852
|
+
get pathname(): string;
|
|
17853
|
+
/**
|
|
17854
|
+
* The **`search`** read-only property of the URLPattern interface is a string containing the pattern used to match the search part of a URL.
|
|
17855
|
+
*
|
|
17856
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/search)
|
|
17857
|
+
*/
|
|
17858
|
+
get search(): string;
|
|
17859
|
+
/**
|
|
17860
|
+
* The **`hash`** read-only property of the URLPattern interface is a string containing the pattern used to match the fragment part of a URL.
|
|
17861
|
+
*
|
|
17862
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hash)
|
|
17863
|
+
*/
|
|
17864
|
+
get hash(): string;
|
|
17865
|
+
/**
|
|
17866
|
+
* The **`hasRegExpGroups`** read-only property of the URLPattern interface is a boolean indicating whether or not any of the URLPattern components contain regular expression capturing groups.
|
|
17867
|
+
*
|
|
17868
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/hasRegExpGroups)
|
|
17869
|
+
*/
|
|
17870
|
+
get hasRegExpGroups(): boolean;
|
|
17871
|
+
/**
|
|
17872
|
+
* The **`test()`** method of the URLPattern interface takes a URL string or object of URL parts, and returns a boolean indicating if the given input matches the current pattern.
|
|
17873
|
+
*
|
|
17874
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/test)
|
|
17875
|
+
*/
|
|
17876
|
+
test(input?: string | URLPatternInit, baseURL?: string): boolean;
|
|
17877
|
+
/**
|
|
17878
|
+
* The **`exec()`** method of the URLPattern interface takes a URL or object of URL parts, and returns either an object containing the results of matching the URL to the pattern, or null if the URL does not match the pattern.
|
|
17879
|
+
*
|
|
17880
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLPattern/exec)
|
|
17881
|
+
*/
|
|
17882
|
+
exec(
|
|
17883
|
+
input?: string | URLPatternInit,
|
|
17884
|
+
baseURL?: string,
|
|
17885
|
+
): URLPatternResult | null;
|
|
17886
|
+
}
|
|
17887
|
+
interface URLPatternInit {
|
|
17888
|
+
protocol?: string;
|
|
17889
|
+
username?: string;
|
|
17890
|
+
password?: string;
|
|
17891
|
+
hostname?: string;
|
|
17892
|
+
port?: string;
|
|
17893
|
+
pathname?: string;
|
|
17894
|
+
search?: string;
|
|
17895
|
+
hash?: string;
|
|
17896
|
+
baseURL?: string;
|
|
17897
|
+
}
|
|
17898
|
+
interface URLPatternComponentResult {
|
|
17899
|
+
input: string;
|
|
17900
|
+
groups: Record<string, string | undefined>;
|
|
17901
|
+
}
|
|
17902
|
+
interface URLPatternResult {
|
|
17903
|
+
inputs: (string | URLPatternInit)[];
|
|
17904
|
+
protocol: URLPatternComponentResult;
|
|
17905
|
+
username: URLPatternComponentResult;
|
|
17906
|
+
password: URLPatternComponentResult;
|
|
17907
|
+
hostname: URLPatternComponentResult;
|
|
17908
|
+
port: URLPatternComponentResult;
|
|
17909
|
+
pathname: URLPatternComponentResult;
|
|
17910
|
+
search: URLPatternComponentResult;
|
|
17911
|
+
hash: URLPatternComponentResult;
|
|
17912
|
+
}
|
|
17913
|
+
interface URLPatternOptions {
|
|
17914
|
+
ignoreCase?: boolean;
|
|
17915
|
+
}
|
|
17815
17916
|
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
17816
17917
|
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
17817
17918
|
// https://opensource.org/licenses/Apache-2.0
|