-
-
Notifications
You must be signed in to change notification settings - Fork 190
/
Copy pathIDBIndex.d.ts
243 lines (243 loc) · 9.14 KB
/
IDBIndex.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
export type Integer = number;
export type IDBIndexProperties = {
columnName: string;
keyPath: import("./Key.js").KeyPath;
optionalParams: {
unique: boolean;
multiEntry: boolean;
};
deleted?: boolean;
__deleted?: boolean;
cursors?: import("./IDBCursor.js").IDBCursorWithValueFull[];
};
export type IDBIndexFull = IDBIndex & {
name: string;
keyPath: import("./Key.js").KeyPath;
multiEntry: boolean;
unique: boolean;
objectStore: import("./IDBObjectStore.js").IDBObjectStoreFull;
__pendingCreate?: boolean;
__deleted?: boolean;
__originalName: string;
__currentName: string;
__pendingName?: string;
__pendingDelete?: boolean;
__name: string;
__multiEntry: boolean;
__unique: boolean;
__objectStore: import("./IDBObjectStore.js").IDBObjectStoreFull;
__keyPath: import("./Key.js").KeyPath;
__recreated?: boolean;
};
export type IndexList = {
[key: string]: IDBIndexProperties;
};
export type Query = any | IDBKeyRange;
export type AnyValue = any;
/**
* @param {boolean} nullDisallowed
* @param {IDBIndexFull} index
* @param {import('./Key.js').Value|import('./Key.js').Key} range
* @param {"value"|"key"|"count"} opType
* @param {boolean} multiChecks
* @returns {[
* nullDisallowed: boolean,
* index: IDBIndexFull,
* hasRange: boolean,
* range: import('./Key.js').Value|import('./Key.js').Key,
* opType: "value"|"key"|"count",
* multiChecks: boolean,
* sql: string[],
* sqlValues: string[]
* ]}
*/
export function buildFetchIndexDataSQL(nullDisallowed: boolean, index: IDBIndexFull, range: import("./Key.js").Value | import("./Key.js").Key, opType: "value" | "key" | "count", multiChecks: boolean): [nullDisallowed: boolean, index: IDBIndexFull, hasRange: boolean, range: import("./Key.js").Value | import("./Key.js").Key, opType: "value" | "key" | "count", multiChecks: boolean, sql: string[], sqlValues: string[]];
/**
* @param {number|null} count
* @param {boolean} unboundedDisallowed
* @param {IDBIndexFull} index
* @param {boolean} hasKey
* @param {import('./Key.js').Value|import('./Key.js').Key} range
* @param {"value"|"key"|"count"} opType
* @param {boolean} multiChecks
* @param {string[]} sql
* @param {string[]} sqlValues
* @param {SQLTransaction} tx
* @param {null|undefined} args
* @param {(result: number|undefined|[]|AnyValue|AnyValue[]) => void} success
* @param {(tx: SQLTransaction, err: SQLError) => void} error
* @returns {void}
*/
export function executeFetchIndexData(count: number | null, unboundedDisallowed: boolean, index: IDBIndexFull, hasKey: boolean, range: import("./Key.js").Value | import("./Key.js").Key, opType: "value" | "key" | "count", multiChecks: boolean, sql: string[], sqlValues: string[], tx: SQLTransaction, args: null | undefined, success: (result: number | undefined | [] | AnyValue | AnyValue[]) => void, error: (tx: SQLTransaction, err: SQLError) => void): void;
/**
* @typedef {number} Integer
*/
/**
* @typedef {{
* columnName: string,
* keyPath: import('./Key.js').KeyPath,
* optionalParams: {
* unique: boolean,
* multiEntry: boolean
* }
* deleted?: boolean,
* __deleted?: boolean,
* cursors?: import('./IDBCursor.js').IDBCursorWithValueFull[],
* }} IDBIndexProperties
*/
/**
* IDB Index.
* @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBIndex
* @class
*/
export function IDBIndex(): void;
export class IDBIndex {
/**
* @typedef {any|IDBKeyRange} Query
*/
/**
* Retrieves index data for the given key.
* @param {Query} range
* @param {"value"|"key"|"count"} opType
* @param {boolean} nullDisallowed
* @param {number} [count]
* @this {IDBIndexFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
__fetchIndexData(this: IDBIndexFull, range: Query, opType: "value" | "key" | "count", nullDisallowed: boolean, count?: number | undefined): import("./IDBRequest.js").IDBRequestFull;
/**
* Opens a cursor over the given key range.
* @this {IDBIndexFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
openCursor(this: IDBIndexFull, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
* Opens a cursor over the given key range. The cursor only includes key values, not data.
* @this {IDBIndexFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
openKeyCursor(this: IDBIndexFull, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
*
* @param {Query} query
* @throws {TypeError}
* @this {IDBIndexFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
get(this: IDBIndexFull, query: Query, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
*
* @param {Query} query
* @throws {TypeError}
* @this {IDBIndexFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
getKey(this: IDBIndexFull, query: Query, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
* @this {IDBIndexFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
getAll(this: IDBIndexFull, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
* @this {IDBIndexFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
getAllKeys(this: IDBIndexFull, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
* @this {IDBIndexFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
count(this: IDBIndexFull, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
*
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
* @param {string} oldName
* @param {string} newName
* @param {string[][]} colInfoToPreserveArr
* @param {null|((
* tx: SQLTransaction,
* success: ((store: IDBObjectStore) => void)
* ) => void)} cb
* @this {IDBIndexFull}
* @returns {void}
*/
__renameIndex(this: IDBIndexFull, store: import("./IDBObjectStore.js").IDBObjectStoreFull, oldName: string, newName: string, colInfoToPreserveArr?: string[][], cb?: null | ((tx: SQLTransaction, success: ((store: IDBObjectStore) => void)) => void)): void;
}
export namespace IDBIndex {
/**
* @typedef {IDBIndex & {
* name: string,
* keyPath: import('./Key.js').KeyPath,
* multiEntry: boolean,
* unique: boolean,
* objectStore: import('./IDBObjectStore.js').IDBObjectStoreFull,
* __pendingCreate?: boolean,
* __deleted?: boolean,
* __originalName: string,
* __currentName: string,
* __pendingName?: string,
* __pendingDelete?: boolean,
* __name: string,
* __multiEntry: boolean,
* __unique: boolean,
* __objectStore: import('./IDBObjectStore.js').IDBObjectStoreFull,
* __keyPath: import('./Key.js').KeyPath,
* __recreated?: boolean
* }} IDBIndexFull
*/
/**
*
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
* @param {IDBIndexProperties} indexProperties
* @returns {IDBIndexFull}
*/
function __createInstance(store: import("./IDBObjectStore.js").IDBObjectStoreFull, indexProperties: IDBIndexProperties): IDBIndexFull;
/**
*
* @param {IDBIndexFull} index
* @param {string} [msg]
* @throws {DOMException}
* @returns {void}
*/
function __invalidStateIfDeleted(index: IDBIndexFull, msg?: string | undefined): void;
/**
* Clones an IDBIndex instance for a different IDBObjectStore instance.
* @param {IDBIndexFull} index
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
* @returns {IDBIndexFull}
*/
function __clone(index: IDBIndexFull, store: import("./IDBObjectStore.js").IDBObjectStoreFull): IDBIndexFull;
/**
* Creates a new index on an object store.
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
* @param {IDBIndexFull} index
* @returns {void}
*/
function __createIndex(store: import("./IDBObjectStore.js").IDBObjectStoreFull, index: IDBIndexFull): void;
/**
* Deletes an index from an object store.
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
* @param {IDBIndexFull} index
* @returns {void}
*/
function __deleteIndex(store: import("./IDBObjectStore.js").IDBObjectStoreFull, index: IDBIndexFull): void;
/**
* @typedef {{[key: string]: IDBIndexProperties}} IndexList
*/
/**
* Updates index list for the given object store.
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
* @param {SQLTransaction} tx
* @param {(store: IDBObjectStore) => void} success
* @param {(
* tx: SQLTransaction,
* err: SQLError
* ) => boolean} [failure]
* @returns {void}
*/
function __updateIndexList(store: import("./IDBObjectStore.js").IDBObjectStoreFull, tx: SQLTransaction, success: (store: IDBObjectStore) => void, failure?: ((tx: SQLTransaction, err: SQLError) => boolean) | undefined): void;
}
import { IDBKeyRange } from './IDBKeyRange.js';
import IDBObjectStore from './IDBObjectStore.js';
export { IDBIndex as default };
//# sourceMappingURL=IDBIndex.d.ts.map