@lingxia/types 0.10.0 → 0.12.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/dist/automation/index.d.ts +1228 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +13 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation-test-globals.d.ts +14 -0
- package/dist/error.d.ts +13 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +47 -1
- package/dist/error.js.map +1 -1
- package/dist/generated/i18n.d.ts +1 -1
- package/dist/generated/i18n.d.ts.map +1 -1
- package/dist/generated/i18n.js +37 -0
- package/dist/generated/i18n.js.map +1 -1
- package/dist/generated/logic-web.d.ts +305 -0
- package/dist/generated/logic.d.ts +2502 -0
- package/dist/generated/logic.d.ts.map +1 -0
- package/dist/generated/logic.js +5 -0
- package/dist/generated/logic.js.map +1 -0
- package/dist/index.d.ts +25 -313
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -16
- package/dist/index.js.map +1 -1
- package/dist/logic-globals.d.ts +1 -0
- package/dist/process.d.ts +117 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/process.js +10 -0
- package/dist/process.js.map +1 -0
- package/dist/testing/public-api.d.ts +429 -0
- package/dist/testing/public-api.d.ts.map +1 -0
- package/dist/testing/public-api.js +588 -0
- package/dist/testing/public-api.js.map +1 -0
- package/dist/testing/public-api.mjs +584 -0
- package/package.json +83 -48
- package/src/automation/index.ts +1370 -0
- package/src/error.ts +47 -1
- package/src/generated/i18n.ts +37 -0
- package/src/generated/logic-web.d.ts +305 -0
- package/src/generated/logic.ts +2753 -0
- package/src/index.ts +34 -459
- package/src/logic-globals.d.ts +1 -0
- package/src/process.ts +135 -0
- package/src/testing/public-api.ts +716 -0
- package/dist/app/index.d.ts +0 -328
- package/dist/app/index.d.ts.map +0 -1
- package/dist/app/index.js +0 -6
- package/dist/app/index.js.map +0 -1
- package/dist/device/actions.d.ts +0 -7
- package/dist/device/actions.d.ts.map +0 -1
- package/dist/device/actions.js +0 -6
- package/dist/device/actions.js.map +0 -1
- package/dist/device/index.d.ts +0 -5
- package/dist/device/index.d.ts.map +0 -1
- package/dist/device/index.js +0 -21
- package/dist/device/index.js.map +0 -1
- package/dist/device/info.d.ts +0 -16
- package/dist/device/info.d.ts.map +0 -1
- package/dist/device/info.js +0 -6
- package/dist/device/info.js.map +0 -1
- package/dist/device/network.d.ts +0 -12
- package/dist/device/network.d.ts.map +0 -1
- package/dist/device/network.js +0 -6
- package/dist/device/network.js.map +0 -1
- package/dist/device/wifi.d.ts +0 -20
- package/dist/device/wifi.d.ts.map +0 -1
- package/dist/device/wifi.js +0 -6
- package/dist/device/wifi.js.map +0 -1
- package/dist/display/index.d.ts +0 -8
- package/dist/display/index.d.ts.map +0 -1
- package/dist/display/index.js +0 -6
- package/dist/display/index.js.map +0 -1
- package/dist/env/index.d.ts +0 -8
- package/dist/env/index.d.ts.map +0 -1
- package/dist/env/index.js +0 -6
- package/dist/env/index.js.map +0 -1
- package/dist/file/index.d.ts +0 -146
- package/dist/file/index.d.ts.map +0 -1
- package/dist/file/index.js +0 -6
- package/dist/file/index.js.map +0 -1
- package/dist/input/index.d.ts +0 -18
- package/dist/input/index.d.ts.map +0 -1
- package/dist/input/index.js +0 -8
- package/dist/input/index.js.map +0 -1
- package/dist/location/index.d.ts +0 -19
- package/dist/location/index.d.ts.map +0 -1
- package/dist/location/index.js +0 -6
- package/dist/location/index.js.map +0 -1
- package/dist/lxapp/index.d.ts +0 -11
- package/dist/lxapp/index.d.ts.map +0 -1
- package/dist/lxapp/index.js +0 -6
- package/dist/lxapp/index.js.map +0 -1
- package/dist/media/index.d.ts +0 -372
- package/dist/media/index.d.ts.map +0 -1
- package/dist/media/index.js +0 -6
- package/dist/media/index.js.map +0 -1
- package/dist/navigator/index.d.ts +0 -14
- package/dist/navigator/index.d.ts.map +0 -1
- package/dist/navigator/index.js +0 -6
- package/dist/navigator/index.js.map +0 -1
- package/dist/share/index.d.ts +0 -90
- package/dist/share/index.d.ts.map +0 -1
- package/dist/share/index.js +0 -6
- package/dist/share/index.js.map +0 -1
- package/dist/storage/index.d.ts +0 -13
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js +0 -6
- package/dist/storage/index.js.map +0 -1
- package/dist/system/index.d.ts +0 -9
- package/dist/system/index.d.ts.map +0 -1
- package/dist/system/index.js +0 -6
- package/dist/system/index.js.map +0 -1
- package/dist/transfer/index.d.ts +0 -166
- package/dist/transfer/index.d.ts.map +0 -1
- package/dist/transfer/index.js +0 -6
- package/dist/transfer/index.js.map +0 -1
- package/dist/ui/index.d.ts +0 -134
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -6
- package/dist/ui/index.js.map +0 -1
- package/dist/update/index.d.ts +0 -17
- package/dist/update/index.d.ts.map +0 -1
- package/dist/update/index.js +0 -6
- package/dist/update/index.js.map +0 -1
- package/src/app/index.ts +0 -378
- package/src/device/actions.ts +0 -7
- package/src/device/index.ts +0 -4
- package/src/device/info.ts +0 -17
- package/src/device/network.ts +0 -23
- package/src/device/wifi.ts +0 -23
- package/src/display/index.ts +0 -9
- package/src/env/index.ts +0 -8
- package/src/file/index.ts +0 -171
- package/src/input/index.ts +0 -19
- package/src/location/index.ts +0 -20
- package/src/lxapp/index.ts +0 -12
- package/src/media/index.ts +0 -411
- package/src/navigator/index.ts +0 -16
- package/src/share/index.ts +0 -97
- package/src/storage/index.ts +0 -13
- package/src/system/index.ts +0 -9
- package/src/transfer/index.ts +0 -194
- package/src/ui/index.ts +0 -165
- package/src/update/index.ts +0 -19
package/src/error.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SurfaceErrorCode } from './generated/logic.js';
|
|
1
2
|
import { ERR_CODE_INFO_BY_CODE, type LxErrorCodeInfo } from "./generated/error";
|
|
2
3
|
|
|
3
4
|
const ERR_CODE_INDEX = ERR_CODE_INFO_BY_CODE as Record<number, LxErrorCodeInfo>;
|
|
@@ -9,11 +10,27 @@ export interface LxApiError {
|
|
|
9
10
|
readonly raw: unknown;
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
/** Check an already-normalized error without modifying the caught value. */
|
|
12
14
|
export function isLxApiError(error: unknown): error is LxApiError {
|
|
13
|
-
|
|
15
|
+
const target = toRecord(error);
|
|
16
|
+
if (!target) return false;
|
|
17
|
+
const code = parseIntegerCode(target.code);
|
|
18
|
+
if (code === null) return false;
|
|
19
|
+
const info = infoForLxErrorCode(code);
|
|
20
|
+
return Boolean(
|
|
21
|
+
info &&
|
|
22
|
+
target.code === code &&
|
|
23
|
+
target.key === info.key &&
|
|
24
|
+
typeof target.message === "string" &&
|
|
25
|
+
Object.prototype.hasOwnProperty.call(target, "raw"),
|
|
26
|
+
);
|
|
14
27
|
}
|
|
15
28
|
|
|
16
29
|
function readMessage(error: unknown): string {
|
|
30
|
+
const root = toRecord(error);
|
|
31
|
+
const data = root && toRecord(root.data);
|
|
32
|
+
const detail = data?.detail;
|
|
33
|
+
if (typeof detail === "string" && detail.trim() !== "") return detail;
|
|
17
34
|
if (typeof error === "string") return error;
|
|
18
35
|
if (error instanceof Error && typeof error.message === "string") return error.message;
|
|
19
36
|
if (typeof error === "object" && error !== null) {
|
|
@@ -50,6 +67,35 @@ export function extractLxErrorCode(error: unknown): number | null {
|
|
|
50
67
|
return parseIntegerCode(data.bizCode) ?? parseIntegerCode(data.code);
|
|
51
68
|
}
|
|
52
69
|
|
|
70
|
+
/**
|
|
71
|
+
* The surface code carried by a `lx.surface.*` / `lx.shell.*` rejection.
|
|
72
|
+
*
|
|
73
|
+
* A rejection's `code` is the transport-level host code shared with every
|
|
74
|
+
* other `lx` API; the surface-specific member of `SurfaceErrorCode` rides on
|
|
75
|
+
* `data.code`. Reading it through this helper keeps callers off both the
|
|
76
|
+
* message text and the shape.
|
|
77
|
+
*/
|
|
78
|
+
export function surfaceErrorCode(error: unknown): SurfaceErrorCode | null {
|
|
79
|
+
const root = toRecord(error);
|
|
80
|
+
const data = root ? toRecord(root.data) : null;
|
|
81
|
+
const code = data?.code;
|
|
82
|
+
return typeof code === 'string' && SURFACE_ERROR_CODES.includes(code as SurfaceErrorCode)
|
|
83
|
+
? (code as SurfaceErrorCode)
|
|
84
|
+
: null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Every member of `SurfaceErrorCode`, for runtime narrowing. */
|
|
88
|
+
export const SURFACE_ERROR_CODES = [
|
|
89
|
+
'unsupported_placement',
|
|
90
|
+
'denied',
|
|
91
|
+
'not_declared',
|
|
92
|
+
'invalid_arg',
|
|
93
|
+
'already_open_other_role',
|
|
94
|
+
'closed',
|
|
95
|
+
'capability_missing',
|
|
96
|
+
'failed',
|
|
97
|
+
] as const satisfies readonly SurfaceErrorCode[];
|
|
98
|
+
|
|
53
99
|
export function isKnownLxErrorCode(code: number): boolean {
|
|
54
100
|
return Number.isInteger(code) && Object.prototype.hasOwnProperty.call(ERR_CODE_INDEX, code);
|
|
55
101
|
}
|
package/src/generated/i18n.ts
CHANGED
|
@@ -10,6 +10,25 @@ export const I18N_KEYS = [
|
|
|
10
10
|
"album_label",
|
|
11
11
|
"album_original_image",
|
|
12
12
|
"album_selected",
|
|
13
|
+
"browser_add_bookmark",
|
|
14
|
+
"browser_address_placeholder",
|
|
15
|
+
"browser_bookmarks",
|
|
16
|
+
"browser_clear_browsing_data",
|
|
17
|
+
"browser_clear_site_data",
|
|
18
|
+
"browser_close_other_tabs",
|
|
19
|
+
"browser_close_tabs_below",
|
|
20
|
+
"browser_copy_link",
|
|
21
|
+
"browser_history",
|
|
22
|
+
"browser_label",
|
|
23
|
+
"browser_link_copied",
|
|
24
|
+
"browser_manage_bookmarks",
|
|
25
|
+
"browser_new_tab",
|
|
26
|
+
"browser_open_in_system_browser",
|
|
27
|
+
"browser_page_menu",
|
|
28
|
+
"browser_pin_to_sidebar",
|
|
29
|
+
"browser_remove_bookmark",
|
|
30
|
+
"browser_tabs",
|
|
31
|
+
"browser_unpin",
|
|
13
32
|
"camera_access_denied",
|
|
14
33
|
"camera_audio_init_failed",
|
|
15
34
|
"camera_cancelling",
|
|
@@ -31,15 +50,19 @@ export const I18N_KEYS = [
|
|
|
31
50
|
"capsule_clean_cache",
|
|
32
51
|
"capsule_restart",
|
|
33
52
|
"capsule_uninstall",
|
|
53
|
+
"common_about",
|
|
34
54
|
"common_back",
|
|
35
55
|
"common_cancel",
|
|
36
56
|
"common_close",
|
|
37
57
|
"common_confirm",
|
|
38
58
|
"common_delete",
|
|
39
59
|
"common_done",
|
|
60
|
+
"common_exit",
|
|
61
|
+
"common_forward",
|
|
40
62
|
"common_loading",
|
|
41
63
|
"common_ok",
|
|
42
64
|
"common_refresh",
|
|
65
|
+
"common_version",
|
|
43
66
|
"date_last_30_days",
|
|
44
67
|
"date_last_7_days",
|
|
45
68
|
"date_last_month",
|
|
@@ -105,7 +128,17 @@ export const I18N_KEYS = [
|
|
|
105
128
|
"permission_limited_access_add_more_photos",
|
|
106
129
|
"permission_limited_access_add_more_videos",
|
|
107
130
|
"permission_limited_access_warning",
|
|
131
|
+
"permission_location_reason",
|
|
108
132
|
"permission_media_reason",
|
|
133
|
+
"permission_network_reason",
|
|
134
|
+
"permission_wifi_reason",
|
|
135
|
+
"shell_pin_limit_message",
|
|
136
|
+
"shell_pin_limit_title",
|
|
137
|
+
"surface_close",
|
|
138
|
+
"surface_close_after",
|
|
139
|
+
"surface_close_others",
|
|
140
|
+
"surface_rename",
|
|
141
|
+
"surface_reset_title",
|
|
109
142
|
"terminal_change_title",
|
|
110
143
|
"terminal_close_pane",
|
|
111
144
|
"terminal_copy",
|
|
@@ -113,6 +146,7 @@ export const I18N_KEYS = [
|
|
|
113
146
|
"terminal_paste",
|
|
114
147
|
"terminal_read_only",
|
|
115
148
|
"terminal_reset",
|
|
149
|
+
"terminal_search",
|
|
116
150
|
"terminal_split_down",
|
|
117
151
|
"terminal_split_left",
|
|
118
152
|
"terminal_split_right",
|
|
@@ -121,6 +155,9 @@ export const I18N_KEYS = [
|
|
|
121
155
|
"update_downloading",
|
|
122
156
|
"video_quality",
|
|
123
157
|
"video_speed",
|
|
158
|
+
"webview_load_error_message",
|
|
159
|
+
"webview_load_error_title",
|
|
160
|
+
"webview_retry",
|
|
124
161
|
] as const;
|
|
125
162
|
|
|
126
163
|
export type I18nKey = (typeof I18N_KEYS)[number];
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
// Versioned `logic-web` runtime profile published with rong_typegen.
|
|
2
|
+
// Do not edit downstream copies by hand.
|
|
3
|
+
//
|
|
4
|
+
// Ambient globals implemented by the Rong Logic runtime without requiring the
|
|
5
|
+
// browser DOM library or the @rongjs/rong TypeScript package.
|
|
6
|
+
|
|
7
|
+
declare function setTimeout(callback: () => void, delay?: number): number;
|
|
8
|
+
declare function clearTimeout(id: number): void;
|
|
9
|
+
declare function setInterval(callback: () => void, delay?: number): number;
|
|
10
|
+
declare function clearInterval(id: number): void;
|
|
11
|
+
|
|
12
|
+
declare function atob(data: string): string;
|
|
13
|
+
declare function btoa(data: string): string;
|
|
14
|
+
|
|
15
|
+
interface TextEncoder {
|
|
16
|
+
readonly encoding: string;
|
|
17
|
+
encode(input?: string): Uint8Array;
|
|
18
|
+
encodeInto(source: string, destination: Uint8Array): { read: number; written: number };
|
|
19
|
+
}
|
|
20
|
+
declare var TextEncoder: { new (): TextEncoder; prototype: TextEncoder };
|
|
21
|
+
|
|
22
|
+
interface TextDecoderOptions { fatal?: boolean; ignoreBOM?: boolean }
|
|
23
|
+
interface TextDecoder {
|
|
24
|
+
readonly encoding: string;
|
|
25
|
+
readonly fatal: boolean;
|
|
26
|
+
readonly ignoreBOM: boolean;
|
|
27
|
+
decode(input?: ArrayBuffer | ArrayBufferView, options?: { stream?: boolean }): string;
|
|
28
|
+
}
|
|
29
|
+
declare var TextDecoder: { new (label?: string, options?: TextDecoderOptions): TextDecoder; prototype: TextDecoder };
|
|
30
|
+
|
|
31
|
+
interface URLSearchParams {
|
|
32
|
+
append(name: string, value: string): void;
|
|
33
|
+
delete(name: string): void;
|
|
34
|
+
get(name: string): string | null;
|
|
35
|
+
getAll(name: string): string[];
|
|
36
|
+
has(name: string): boolean;
|
|
37
|
+
set(name: string, value: string): void;
|
|
38
|
+
sort(): void;
|
|
39
|
+
entries(): Array<[string, string]>;
|
|
40
|
+
keys(): string[];
|
|
41
|
+
values(): string[];
|
|
42
|
+
forEach(callback: (value: string, key: string) => void, thisArg?: any): void;
|
|
43
|
+
toString(): string;
|
|
44
|
+
readonly size: number;
|
|
45
|
+
}
|
|
46
|
+
declare var URLSearchParams: {
|
|
47
|
+
new (init?: string | Array<[string, string]> | Record<string, string>): URLSearchParams;
|
|
48
|
+
prototype: URLSearchParams;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
interface URL {
|
|
52
|
+
hash: string;
|
|
53
|
+
host: string;
|
|
54
|
+
hostname: string;
|
|
55
|
+
href: string;
|
|
56
|
+
readonly origin: string;
|
|
57
|
+
password: string;
|
|
58
|
+
pathname: string;
|
|
59
|
+
port: string;
|
|
60
|
+
protocol: string;
|
|
61
|
+
search: string;
|
|
62
|
+
username: string;
|
|
63
|
+
readonly searchParams: URLSearchParams;
|
|
64
|
+
toString(): string;
|
|
65
|
+
toJSON(): string;
|
|
66
|
+
}
|
|
67
|
+
declare var URL: { new (url: string, base?: string): URL; prototype: URL };
|
|
68
|
+
|
|
69
|
+
interface EventOptions { bubbles?: boolean; cancelable?: boolean; composed?: boolean }
|
|
70
|
+
interface Event {
|
|
71
|
+
readonly type: string;
|
|
72
|
+
readonly bubbles: boolean;
|
|
73
|
+
readonly cancelable: boolean;
|
|
74
|
+
readonly composed: boolean;
|
|
75
|
+
}
|
|
76
|
+
declare var Event: { new (type: string, options?: EventOptions): Event; prototype: Event };
|
|
77
|
+
|
|
78
|
+
interface CustomEventOptions extends EventOptions { detail?: any }
|
|
79
|
+
interface CustomEvent extends Event { readonly detail: any }
|
|
80
|
+
declare var CustomEvent: { new (type: string, options?: CustomEventOptions): CustomEvent; prototype: CustomEvent };
|
|
81
|
+
|
|
82
|
+
type EventListener = (event: Event) => void;
|
|
83
|
+
interface AddEventListenerOptions { once?: boolean; capture?: boolean; passive?: boolean }
|
|
84
|
+
interface EventTarget {
|
|
85
|
+
addEventListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions): void;
|
|
86
|
+
removeEventListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions): void;
|
|
87
|
+
dispatchEvent(event: Event): boolean;
|
|
88
|
+
}
|
|
89
|
+
declare var EventTarget: { new (): EventTarget; prototype: EventTarget };
|
|
90
|
+
|
|
91
|
+
type EventName = string | symbol;
|
|
92
|
+
type EventEmitterListener = (...args: any[]) => void;
|
|
93
|
+
interface EventEmitter extends EventTarget {
|
|
94
|
+
on(eventName: EventName, listener: EventEmitterListener): this;
|
|
95
|
+
addListener(eventName: EventName, listener: EventEmitterListener): this;
|
|
96
|
+
once(eventName: EventName, listener: EventEmitterListener): this;
|
|
97
|
+
off(eventName: EventName, listener: EventEmitterListener): this;
|
|
98
|
+
removeListener(eventName: EventName, listener: EventEmitterListener): this;
|
|
99
|
+
removeAllListeners(eventName?: EventName): this;
|
|
100
|
+
prependListener(eventName: EventName, listener: EventEmitterListener): this;
|
|
101
|
+
prependOnceListener(eventName: EventName, listener: EventEmitterListener): this;
|
|
102
|
+
emit(eventName: EventName, ...args: any[]): boolean;
|
|
103
|
+
eventNames(): EventName[];
|
|
104
|
+
setMaxListeners(count: number): this;
|
|
105
|
+
getMaxListeners(): number;
|
|
106
|
+
listenerCount(eventName: EventName, listener?: EventEmitterListener): number;
|
|
107
|
+
}
|
|
108
|
+
declare var EventEmitter: { new (): EventEmitter; prototype: EventEmitter };
|
|
109
|
+
|
|
110
|
+
interface AbortSignal extends EventTarget {
|
|
111
|
+
readonly aborted: boolean;
|
|
112
|
+
readonly reason: any;
|
|
113
|
+
onabort: ((event: Event) => void) | null;
|
|
114
|
+
throwIfAborted(): void;
|
|
115
|
+
}
|
|
116
|
+
declare var AbortSignal: {
|
|
117
|
+
prototype: AbortSignal;
|
|
118
|
+
any(signals: AbortSignal[]): AbortSignal;
|
|
119
|
+
abort(reason?: any): AbortSignal;
|
|
120
|
+
timeout(milliseconds: number): AbortSignal;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
interface AbortController {
|
|
124
|
+
readonly signal: AbortSignal;
|
|
125
|
+
abort(reason?: any): void;
|
|
126
|
+
}
|
|
127
|
+
declare var AbortController: { new (): AbortController; prototype: AbortController };
|
|
128
|
+
|
|
129
|
+
type DOMExceptionName =
|
|
130
|
+
| 'IndexSizeError' | 'HierarchyRequestError' | 'InvalidCharacterError'
|
|
131
|
+
| 'NoModificationAllowedError' | 'NotFoundError' | 'NotSupportedError'
|
|
132
|
+
| 'InvalidStateError' | 'SyntaxError' | 'InvalidModificationError'
|
|
133
|
+
| 'NamespaceError' | 'InvalidAccessError' | 'TypeMismatchError'
|
|
134
|
+
| 'SecurityError' | 'NetworkError' | 'AbortError' | 'URLMismatchError'
|
|
135
|
+
| 'QuotaExceededError' | 'TimeoutError' | 'InvalidNodeTypeError'
|
|
136
|
+
| 'DataCloneError' | 'Error';
|
|
137
|
+
interface DOMException extends Error {
|
|
138
|
+
readonly name: string;
|
|
139
|
+
readonly message: string;
|
|
140
|
+
readonly stack: string;
|
|
141
|
+
}
|
|
142
|
+
declare var DOMException: { new (message?: string, name?: DOMExceptionName): DOMException; prototype: DOMException };
|
|
143
|
+
|
|
144
|
+
type BlobPart = Blob | ArrayBuffer | ArrayBufferView | string;
|
|
145
|
+
interface BlobOptions { type?: string; endings?: 'transparent' | 'native' }
|
|
146
|
+
interface Blob {
|
|
147
|
+
readonly size: number;
|
|
148
|
+
readonly type: string;
|
|
149
|
+
slice(start?: number, end?: number, contentType?: string): Blob;
|
|
150
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
151
|
+
text(): Promise<string>;
|
|
152
|
+
bytes(): Promise<Uint8Array>;
|
|
153
|
+
}
|
|
154
|
+
declare var Blob: { new (blobParts?: BlobPart[], options?: BlobOptions): Blob; prototype: Blob };
|
|
155
|
+
|
|
156
|
+
interface FileOptions extends BlobOptions { lastModified?: number }
|
|
157
|
+
interface File extends Blob {
|
|
158
|
+
readonly name: string;
|
|
159
|
+
readonly lastModified: number;
|
|
160
|
+
}
|
|
161
|
+
declare var File: { new (fileBits: BlobPart[], fileName: string, options?: FileOptions): File; prototype: File };
|
|
162
|
+
|
|
163
|
+
interface FormData {
|
|
164
|
+
append(name: string, value: string | Blob, filename?: string): void;
|
|
165
|
+
delete(name: string): void;
|
|
166
|
+
get(name: string): string | File | null;
|
|
167
|
+
getAll(name: string): Array<string | File>;
|
|
168
|
+
has(name: string): boolean;
|
|
169
|
+
set(name: string, value: string | Blob, filename?: string): void;
|
|
170
|
+
entries(): IterableIterator<[string, string | File]>;
|
|
171
|
+
keys(): IterableIterator<string>;
|
|
172
|
+
values(): IterableIterator<string | File>;
|
|
173
|
+
forEach(
|
|
174
|
+
callback: (value: string | File, key: string, parent: FormData) => void,
|
|
175
|
+
thisArg?: any,
|
|
176
|
+
): void;
|
|
177
|
+
}
|
|
178
|
+
declare var FormData: { new (): FormData; prototype: FormData };
|
|
179
|
+
|
|
180
|
+
interface ReadableStreamDefaultReader<R = any> {
|
|
181
|
+
read(): Promise<{ done: boolean; value: R }>;
|
|
182
|
+
releaseLock(): void;
|
|
183
|
+
cancel(reason?: any): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
interface ReadableStream<R = any> {
|
|
186
|
+
getReader(): ReadableStreamDefaultReader<R>;
|
|
187
|
+
cancel(reason?: any): Promise<void>;
|
|
188
|
+
pipeTo(destination: WritableStream<R>, options?: { preventClose?: boolean; preventAbort?: boolean; preventCancel?: boolean; signal?: AbortSignal }): Promise<void>;
|
|
189
|
+
pipeThrough<T>(transform: { writable: WritableStream<R>; readable: ReadableStream<T> }): ReadableStream<T>;
|
|
190
|
+
}
|
|
191
|
+
declare var ReadableStream: { new <R = any>(underlyingSource?: any): ReadableStream<R>; prototype: ReadableStream };
|
|
192
|
+
|
|
193
|
+
interface WritableStreamDefaultWriter<W = any> {
|
|
194
|
+
write(chunk?: W): Promise<void>;
|
|
195
|
+
close(): Promise<void>;
|
|
196
|
+
abort(reason?: any): Promise<void>;
|
|
197
|
+
releaseLock(): void;
|
|
198
|
+
}
|
|
199
|
+
interface WritableStream<W = any> {
|
|
200
|
+
getWriter(): WritableStreamDefaultWriter<W>;
|
|
201
|
+
abort(reason?: any): Promise<void>;
|
|
202
|
+
}
|
|
203
|
+
declare var WritableStream: { new <W = any>(underlyingSink?: any): WritableStream<W>; prototype: WritableStream };
|
|
204
|
+
|
|
205
|
+
type CompressionFormat = 'gzip' | 'deflate' | 'deflate-raw';
|
|
206
|
+
interface CompressionStream {
|
|
207
|
+
readonly readable: ReadableStream<Uint8Array>;
|
|
208
|
+
readonly writable: WritableStream<Uint8Array>;
|
|
209
|
+
}
|
|
210
|
+
declare var CompressionStream: {
|
|
211
|
+
new (format: CompressionFormat): CompressionStream;
|
|
212
|
+
prototype: CompressionStream;
|
|
213
|
+
};
|
|
214
|
+
interface DecompressionStream {
|
|
215
|
+
readonly readable: ReadableStream<Uint8Array>;
|
|
216
|
+
readonly writable: WritableStream<Uint8Array>;
|
|
217
|
+
}
|
|
218
|
+
declare var DecompressionStream: {
|
|
219
|
+
new (format: CompressionFormat): DecompressionStream;
|
|
220
|
+
prototype: DecompressionStream;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
type HeadersInit = Record<string, string> | Array<[string, string]> | Headers;
|
|
224
|
+
interface Headers {
|
|
225
|
+
append(name: string, value: string): void;
|
|
226
|
+
delete(name: string): void;
|
|
227
|
+
get(name: string): string | null;
|
|
228
|
+
has(name: string): boolean;
|
|
229
|
+
set(name: string, value: string): void;
|
|
230
|
+
forEach(callback: (value: string, name: string, self: Headers) => void, thisArg?: any): void;
|
|
231
|
+
entries(): IterableIterator<[string, string]>;
|
|
232
|
+
keys(): IterableIterator<string>;
|
|
233
|
+
values(): IterableIterator<string>;
|
|
234
|
+
getSetCookie(): string[];
|
|
235
|
+
}
|
|
236
|
+
declare var Headers: { new (init?: HeadersInit): Headers; prototype: Headers };
|
|
237
|
+
|
|
238
|
+
type BodyInit = string | Blob | ArrayBuffer | ArrayBufferView | FormData | URLSearchParams | ReadableStream<Uint8Array>;
|
|
239
|
+
interface Body {
|
|
240
|
+
readonly bodyUsed: boolean;
|
|
241
|
+
readonly body: ReadableStream<Uint8Array> | null;
|
|
242
|
+
text(): Promise<string>;
|
|
243
|
+
json<T = any>(): Promise<T>;
|
|
244
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
245
|
+
formData(): Promise<FormData>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
interface RequestInit {
|
|
249
|
+
method?: string;
|
|
250
|
+
headers?: HeadersInit | Headers;
|
|
251
|
+
body?: BodyInit | null;
|
|
252
|
+
redirect?: 'follow' | 'error' | 'manual';
|
|
253
|
+
signal?: AbortSignal | null;
|
|
254
|
+
}
|
|
255
|
+
type RequestInfo = string | Request | URL;
|
|
256
|
+
interface Request extends Body {
|
|
257
|
+
readonly method: string;
|
|
258
|
+
readonly headers: Headers;
|
|
259
|
+
readonly redirect: string;
|
|
260
|
+
readonly signal: AbortSignal | null;
|
|
261
|
+
readonly url: string;
|
|
262
|
+
readonly cache: string;
|
|
263
|
+
readonly keepalive: boolean;
|
|
264
|
+
clone(): Request;
|
|
265
|
+
}
|
|
266
|
+
declare var Request: { new (input: RequestInfo | string, init?: RequestInit): Request; prototype: Request };
|
|
267
|
+
|
|
268
|
+
interface ResponseInit { status?: number; statusText?: string; headers?: HeadersInit }
|
|
269
|
+
interface Response extends Body {
|
|
270
|
+
readonly status: number;
|
|
271
|
+
readonly statusText: string;
|
|
272
|
+
readonly ok: boolean;
|
|
273
|
+
readonly headers: Headers;
|
|
274
|
+
readonly type: string;
|
|
275
|
+
readonly redirected: boolean;
|
|
276
|
+
readonly url: string;
|
|
277
|
+
blob(): Promise<Blob>;
|
|
278
|
+
clone(): Response;
|
|
279
|
+
}
|
|
280
|
+
declare var Response: {
|
|
281
|
+
new (body?: BodyInit | null, init?: ResponseInit): Response;
|
|
282
|
+
prototype: Response;
|
|
283
|
+
error(): Response;
|
|
284
|
+
redirect(url: string, status?: number): Response;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
declare function fetch(url: RequestInfo | URL, options?: RequestInit): Promise<Response>;
|
|
288
|
+
|
|
289
|
+
interface Console {
|
|
290
|
+
log(...args: any[]): void;
|
|
291
|
+
error(...args: any[]): void;
|
|
292
|
+
warn(...args: any[]): void;
|
|
293
|
+
info(...args: any[]): void;
|
|
294
|
+
debug(...args: any[]): void;
|
|
295
|
+
assert(condition?: any, ...args: any[]): void;
|
|
296
|
+
dir(value?: any, options?: { depth?: number; maxArrayLength?: number; maxObjectKeys?: number }): void;
|
|
297
|
+
trace(...args: any[]): void;
|
|
298
|
+
time(label?: string): void;
|
|
299
|
+
timeLog(label?: string, ...args: any[]): void;
|
|
300
|
+
timeEnd(label?: string): void;
|
|
301
|
+
count(label?: string): void;
|
|
302
|
+
countReset(label?: string): void;
|
|
303
|
+
clear(): void;
|
|
304
|
+
}
|
|
305
|
+
declare var console: Console;
|