Skip to content

Commit 0909b8a

Browse files
committed
refactor: TS
1 parent 70382f7 commit 0909b8a

File tree

104 files changed

+42799
-6186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+42799
-6186
lines changed

.eslintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ module.exports = {
9595
'Object.defineProperties',
9696
'Object.getOwnPropertyDescriptor',
9797
'Object.entries',
98+
'Object.hasOwn',
9899
'Object.keys',
99100
'Object.setPrototypeOf',
100101
'Object.values',

dist/CFG.d.ts

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
export default CFG;
2+
/**
3+
* <T>
4+
*/
5+
export type ValueOf<T> = T[keyof T];
6+
export type FSApi = {
7+
unlink: (path: string, cb: import('fs').NoParamCallback) => void;
8+
};
9+
export type ConfigValues = {
10+
DEBUG: boolean;
11+
cacheDatabaseInstances: boolean;
12+
autoName: boolean;
13+
fullIDLSupport: boolean;
14+
checkOrigin: boolean;
15+
cursorPreloadPackSize: number;
16+
UnicodeIDStart: string;
17+
UnicodeIDContinue: string;
18+
registerSCA: (preset: import('typeson').Preset) => import('typeson').Preset;
19+
avoidAutoShim: boolean;
20+
win: {
21+
openDatabase: (name: string, version: string, displayName: string, estimatedSize: number) => any;
22+
};
23+
DEFAULT_DB_SIZE: number;
24+
useSQLiteIndexes: boolean;
25+
fs: FSApi;
26+
addNonIDBGlobals: boolean;
27+
replaceNonIDBGlobals: boolean;
28+
escapeDatabaseName: (name: string) => string;
29+
unescapeDatabaseName: (name: string) => string;
30+
databaseCharacterEscapeList: string | false;
31+
databaseNameLengthLimit: number | false;
32+
escapeNFDForDatabaseNames: boolean;
33+
addSQLiteExtension: boolean;
34+
memoryDatabase: string;
35+
deleteDatabaseFiles: boolean;
36+
databaseBasePath: string;
37+
sysDatabaseBasePath: string;
38+
sqlBusyTimeout: number;
39+
sqlTrace: () => void;
40+
sqlProfile: () => void;
41+
createIndexes: boolean;
42+
};
43+
export type ConfigValue = ValueOf<ConfigValues>;
44+
export type KeyofConfigValues = keyof ConfigValues;
45+
export type Config = KeyofConfigValues[];
46+
declare namespace CFG {
47+
const DEBUG: boolean;
48+
const cacheDatabaseInstances: boolean;
49+
const autoName: boolean;
50+
const fullIDLSupport: boolean;
51+
const checkOrigin: boolean;
52+
const cursorPreloadPackSize: number;
53+
const UnicodeIDStart: string;
54+
const UnicodeIDContinue: string;
55+
const registerSCA: (preset: import("typeson").Preset) => import("typeson").Preset;
56+
const avoidAutoShim: boolean;
57+
const win: {
58+
openDatabase: (name: string, version: string, displayName: string, estimatedSize: number) => any;
59+
};
60+
const DEFAULT_DB_SIZE: number;
61+
const useSQLiteIndexes: boolean;
62+
const fs: FSApi;
63+
const addNonIDBGlobals: boolean;
64+
const replaceNonIDBGlobals: boolean;
65+
const escapeDatabaseName: (name: string) => string;
66+
const unescapeDatabaseName: (name: string) => string;
67+
const databaseCharacterEscapeList: string | false;
68+
const databaseNameLengthLimit: number | false;
69+
const escapeNFDForDatabaseNames: boolean;
70+
const addSQLiteExtension: boolean;
71+
const memoryDatabase: string;
72+
const deleteDatabaseFiles: boolean;
73+
const databaseBasePath: string;
74+
const sysDatabaseBasePath: string;
75+
const sqlBusyTimeout: number;
76+
const sqlTrace: () => void;
77+
const sqlProfile: () => void;
78+
const createIndexes: boolean;
79+
}
80+
//# sourceMappingURL=CFG.d.ts.map

dist/CFG.d.ts.map

+1
Original file line numberDiff line numberDiff line change

dist/DOMException.d.ts

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
export type ErrorLike = {
2+
message: string | DOMString;
3+
};
4+
export type ArbitraryValue = any;
5+
export type Code = "IndexSizeError" | "HierarchyRequestError" | "WrongDocumentError" | "InvalidCharacterError" | "NoModificationAllowedError" | "NotFoundError" | "NotSupportedError" | "InUseAttributeError" | "InvalidStateError" | "SyntaxError" | "InvalidModificationError" | "NamespaceError" | "InvalidAccessError" | "TypeMismatchError" | "SecurityError" | "NetworkError" | "AbortError" | "URLMismatchError" | "QuotaExceededError" | "TimeoutError" | "InvalidNodeTypeError" | "DataCloneError" | "EncodingError" | "NotReadableError" | "UnknownError" | "ConstraintError" | "DataError" | "TransactionInactiveError" | "ReadOnlyError" | "VersionError" | "OperationError" | "NotAllowedError";
6+
export type LegacyCode = "INDEX_SIZE_ERR" | "DOMSTRING_SIZE_ERR" | "HIERARCHY_REQUEST_ERR" | "WRONG_DOCUMENT_ERR" | "INVALID_CHARACTER_ERR" | "NO_DATA_ALLOWED_ERR" | "NO_MODIFICATION_ALLOWED_ERR" | "NOT_FOUND_ERR" | "NOT_SUPPORTED_ERR" | "INUSE_ATTRIBUTE_ERR" | "INVALID_STATE_ERR" | "SYNTAX_ERR" | "INVALID_MODIFICATION_ERR" | "NAMESPACE_ERR" | "INVALID_ACCESS_ERR" | "VALIDATION_ERR" | "TYPE_MISMATCH_ERR" | "SECURITY_ERR" | "NETWORK_ERR" | "ABORT_ERR" | "URL_MISMATCH_ERR" | "QUOTA_EXCEEDED_ERR" | "TIMEOUT_ERR" | "INVALID_NODE_TYPE_ERR" | "DATA_CLONE_ERR";
7+
/**
8+
* @typedef {{
9+
* message: string|DOMString
10+
* }} ErrorLike
11+
*/
12+
/**
13+
* Logs detailed error information to the console.
14+
* @param {string} name
15+
* @param {string} message
16+
* @param {string|ErrorLike|boolean|null} [error]
17+
* @returns {void}
18+
*/
19+
export function logError(name: string, message: string, error?: string | boolean | ErrorLike | null | undefined): void;
20+
/**
21+
* Finds the error argument. This is useful because some WebSQL callbacks
22+
* pass the error as the first argument, and some pass it as the second
23+
* argument.
24+
* @param {(Error|{message?: string, name?: string}|any)[]} args
25+
* @returns {Error|DOMException|undefined}
26+
*/
27+
export function findError(args: (Error | {
28+
message?: string;
29+
name?: string;
30+
} | any)[]): Error | DOMException | undefined;
31+
export const ShimDOMException: {
32+
new (message?: string | undefined, name?: string | undefined): DOMException;
33+
prototype: DOMException;
34+
readonly INDEX_SIZE_ERR: 1;
35+
readonly DOMSTRING_SIZE_ERR: 2;
36+
readonly HIERARCHY_REQUEST_ERR: 3;
37+
readonly WRONG_DOCUMENT_ERR: 4;
38+
readonly INVALID_CHARACTER_ERR: 5;
39+
readonly NO_DATA_ALLOWED_ERR: 6;
40+
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
41+
readonly NOT_FOUND_ERR: 8;
42+
readonly NOT_SUPPORTED_ERR: 9;
43+
readonly INUSE_ATTRIBUTE_ERR: 10;
44+
readonly INVALID_STATE_ERR: 11;
45+
readonly SYNTAX_ERR: 12;
46+
readonly INVALID_MODIFICATION_ERR: 13;
47+
readonly NAMESPACE_ERR: 14;
48+
readonly INVALID_ACCESS_ERR: 15;
49+
readonly VALIDATION_ERR: 16;
50+
readonly TYPE_MISMATCH_ERR: 17;
51+
readonly SECURITY_ERR: 18;
52+
readonly NETWORK_ERR: 19;
53+
readonly ABORT_ERR: 20;
54+
readonly URL_MISMATCH_ERR: 21;
55+
readonly QUOTA_EXCEEDED_ERR: 22;
56+
readonly TIMEOUT_ERR: 23;
57+
readonly INVALID_NODE_TYPE_ERR: 24;
58+
readonly DATA_CLONE_ERR: 25;
59+
};
60+
export const createDOMException: ((name: string, message: string, error?: ErrorLike | undefined) => DOMException) | ((name: string, message: string, error?: ErrorLike | undefined) => Error);
61+
/**
62+
*
63+
* @param {SQLError} webSQLErr
64+
* @returns {(DOMException|Error) & {
65+
* sqlError: SQLError
66+
* }}
67+
*/
68+
export function webSQLErrback(webSQLErr: SQLError): (DOMException | Error) & {
69+
sqlError: SQLError;
70+
};
71+
//# sourceMappingURL=DOMException.d.ts.map

dist/DOMException.d.ts.map

+1
Original file line numberDiff line numberDiff line change

dist/DOMStringList.d.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export default DOMStringList;
2+
export type Integer = number;
3+
export type DOMStringListFull = {
4+
[key: number]: string;
5+
_items: string[];
6+
_length: Integer;
7+
addIndexes: () => void;
8+
sortList: () => string[];
9+
push: (item: string) => void;
10+
clone: () => DOMStringListFull;
11+
contains: (str: string) => boolean;
12+
indexOf: (str: string) => Integer;
13+
splice: (index: Integer, howmany: Integer, ...args: any) => void;
14+
length: Integer;
15+
};
16+
export type AnyValue = any;
17+
declare class DOMStringList {
18+
get length(): any;
19+
}
20+
//# sourceMappingURL=DOMStringList.d.ts.map

dist/DOMStringList.d.ts.map

+1
Original file line numberDiff line numberDiff line change

dist/Event.d.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export type DebuggingError = Error;
2+
/**
3+
* @typedef {Error} DebuggingError
4+
*/
5+
/**
6+
*
7+
* @param {string} type
8+
* @param {DebuggingError|null} [debug]
9+
* @param {EventInit} [evInit]
10+
* @returns {Event & {
11+
* __legacyOutputDidListenersThrowError?: boolean
12+
* }}
13+
*/
14+
export function createEvent(type: string, debug?: Error | null | undefined, evInit?: EventInit | undefined): Event & {
15+
__legacyOutputDidListenersThrowError?: boolean;
16+
};
17+
import { ShimEvent } from 'eventtargeter';
18+
import { ShimCustomEvent } from 'eventtargeter';
19+
import { ShimEventTarget } from 'eventtargeter';
20+
export { ShimEvent, ShimCustomEvent, ShimEventTarget };
21+
//# sourceMappingURL=Event.d.ts.map

dist/Event.d.ts.map

+1
Original file line numberDiff line numberDiff line change

0 commit comments

Comments
 (0)