-
-
Notifications
You must be signed in to change notification settings - Fork 190
/
Copy pathIDBObjectStore.d.ts
273 lines (273 loc) · 11.6 KB
/
IDBObjectStore.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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
export default IDBObjectStore;
export type Integer = number;
export type IDBObjectStoreFull = IDBObjectStore & {
name: string;
keyPath: import("./Key.js").KeyPath;
transaction?: import("./IDBTransaction.js").IDBTransactionFull;
indexNames: import("./DOMStringList.js").DOMStringListFull;
autoIncrement: boolean;
__autoIncrement: boolean;
__indexes: {
[key: string]: import("./IDBIndex.js").IDBIndexFull;
};
__indexHandles: {
[key: string]: import("./IDBIndex.js").IDBIndexFull;
};
__indexNames: import("./DOMStringList.js").DOMStringListFull;
__oldIndexNames: import("./DOMStringList.js").DOMStringListFull;
__transaction?: import("./IDBTransaction.js").IDBTransactionFull;
__name: string;
__keyPath: import("./Key.js").KeyPath;
__originalName: string;
__currentName: string;
__pendingName?: string;
__pendingDelete?: boolean;
__pendingCreate?: boolean;
__deleted?: boolean;
__cursors: (import("./IDBCursor.js").IDBCursorFull | import("./IDBCursor.js").IDBCursorWithValueFull)[];
__idbdb: import("./IDBDatabase.js").IDBDatabaseFull;
};
export type KeyValueArray = [import("./Key.js").Key, import("./Key.js").Value];
/**
* @typedef {number} Integer
*/
/**
* IndexedDB Object Store.
* @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStore
* @class
*/
declare function IDBObjectStore(): void;
declare class IDBObjectStore {
/**
* @typedef {[import('./Key.js').Key, import('./Key.js').Value]} KeyValueArray
*/
/**
* Determines whether the given inline or out-of-line key is valid,
* according to the object store's schema.
* @param {import('./Key.js').Value} value Used for inline keys
* @param {import('./Key.js').Key} key Used for out-of-line keys
* @param {boolean} cursorUpdate
* @throws {DOMException}
* @this {IDBObjectStoreFull}
* @returns {KeyValueArray}
*/
__validateKeyAndValueAndCloneValue(this: IDBObjectStoreFull, value: import("./Key.js").Value, key: import("./Key.js").Key, cursorUpdate: boolean): KeyValueArray;
/**
* From the store properties and object, extracts the value for the key in
* the object store
* If the table has auto increment, get the current number (unless it has
* a keyPath leading to a valid but non-numeric or < 1 key).
* @param {SQLTransaction} tx
* @param {import('./Key.js').Value} value
* @param {import('./Key.js').Key} key
* @param {(key: import('./Key.js').Key, cn?: Integer) => void} success
* @param {import('./Key.js').SQLFailureCallback} failCb
* @this {IDBObjectStoreFull}
* @returns {void}
*/
__deriveKey(this: IDBObjectStoreFull, tx: SQLTransaction, value: import("./Key.js").Value, key: import("./Key.js").Key, success: (key: import("./Key.js").Key, cn?: Integer) => void, failCb: import("./Key.js").SQLFailureCallback): void;
/**
*
* @param {SQLTransaction} tx
* @param {string} encoded
* @param {import('./Key.js').Value} value
* @param {import('./Key.js').Key|Integer} clonedKeyOrCurrentNumber
* @param {Integer|undefined} oldCn
* @param {(
* clonedKeyOrCurrentNumber: import('./Key.js').Key|Integer
* ) => void} success
* @param {(err: Error|DOMException) => void} error
* @this {IDBObjectStoreFull}
* @returns {SyncPromise}
*/
__insertData(this: IDBObjectStoreFull, tx: SQLTransaction, encoded: string, value: import("./Key.js").Value, clonedKeyOrCurrentNumber: import("./Key.js").Key | Integer, oldCn: Integer | undefined, success: (clonedKeyOrCurrentNumber: import("./Key.js").Key | Integer) => void, error: (err: Error | DOMException) => void): SyncPromise;
/**
*
* @param {import('./Key.js').Value} value
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
add(this: IDBObjectStoreFull, value: import("./Key.js").Value, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
*
* @param {import('./Key.js').Value} value
* @throws {TypeError}
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
put(this: IDBObjectStoreFull, value: import("./Key.js").Value, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
*
* @param {SQLTransaction} tx
* @param {import('./Key.js').Key} key
* @param {(tx: SQLTransaction) => void} cb
* @param {(err: SQLError) => void} error
* @this {IDBObjectStoreFull}
* @returns {void}
*/
__overwrite(this: IDBObjectStoreFull, tx: SQLTransaction, key: import("./Key.js").Key, cb: (tx: SQLTransaction) => void, error: (err: SQLError) => void): void;
/**
*
* @param {import('./Key.js').Value} query
* @param {boolean} [getKey]
* @param {boolean} [getAll]
* @param {Integer} [count]
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
__get(this: IDBObjectStoreFull, query: import("./Key.js").Value, getKey?: boolean | undefined, getAll?: boolean | undefined, count?: number | undefined): import("./IDBRequest.js").IDBRequestFull;
/**
*
* @param {import('./Key.js').Value} query
* @throws {TypeError}
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
get(this: IDBObjectStoreFull, query: import("./Key.js").Value, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
*
* @param {import('./Key.js').Value} query
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
getKey(this: IDBObjectStoreFull, query: import("./Key.js").Value, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
getAll(this: IDBObjectStoreFull, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
getAllKeys(this: IDBObjectStoreFull, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
*
* @param {import('./Key.js').Value} query
* @throws {TypeError}
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
delete(this: IDBObjectStoreFull, query: import("./Key.js").Value, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
clear(this: IDBObjectStoreFull): import("./IDBRequest.js").IDBRequestFull;
/**
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
count(this: IDBObjectStoreFull, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
openCursor(this: IDBObjectStoreFull, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
* @this {IDBObjectStoreFull}
* @returns {import('./IDBRequest.js').IDBRequestFull}
*/
openKeyCursor(this: IDBObjectStoreFull, ...args: any[]): import("./IDBRequest.js").IDBRequestFull;
/**
*
* @param {string} indexName
* @this {IDBObjectStoreFull}
* @returns {import('./IDBIndex.js').IDBIndexFull}
*/
index(this: IDBObjectStoreFull, indexName: string, ...args: any[]): import("./IDBIndex.js").IDBIndexFull;
/**
* Creates a new index on the object store.
* @param {string} indexName
* @param {string|string[]} keyPath
* @this {IDBObjectStoreFull}
* @returns {IDBIndex}
*/
createIndex(this: IDBObjectStoreFull, indexName: string, keyPath: string | string[], ...args: any[]): IDBIndex;
/**
*
* @param {string} name
* @this {IDBObjectStoreFull}
* @returns {void}
*/
deleteIndex(this: IDBObjectStoreFull, name: string, ...args: any[]): void;
}
declare namespace IDBObjectStore {
/**
* @typedef {IDBObjectStore & {
* name: string,
* keyPath: import('./Key.js').KeyPath,
* transaction?: import('./IDBTransaction.js').IDBTransactionFull,
* indexNames: import('./DOMStringList.js').DOMStringListFull,
* autoIncrement: boolean,
* __autoIncrement: boolean,
* __indexes: {[key: string]: import('./IDBIndex.js').IDBIndexFull},
* __indexHandles: {[key: string]: import('./IDBIndex.js').IDBIndexFull},
* __indexNames: import('./DOMStringList.js').DOMStringListFull,
* __oldIndexNames: import('./DOMStringList.js').DOMStringListFull,
* __transaction?: import('./IDBTransaction.js').IDBTransactionFull,
* __name: string,
* __keyPath: import('./Key.js').KeyPath,
* __originalName: string,
* __currentName: string,
* __pendingName?: string,
* __pendingDelete?: boolean,
* __pendingCreate?: boolean,
* __deleted?: boolean,
* __cursors: (
* import('./IDBCursor.js').IDBCursorFull|
* import('./IDBCursor.js').IDBCursorWithValueFull
* )[],
* __idbdb: import('./IDBDatabase.js').IDBDatabaseFull,
* }} IDBObjectStoreFull
*/
/**
*
* @param {import('./IDBDatabase.js').IDBObjectStoreProperties} storeProperties
* @param {import('./IDBTransaction.js').IDBTransactionFull} [transaction]
* @returns {IDBObjectStoreFull}
*/
function __createInstance(storeProperties: import("./IDBDatabase.js").IDBObjectStoreProperties, transaction?: import("./IDBTransaction.js").IDBTransactionFull | undefined): IDBObjectStoreFull;
/**
* Clones an IDBObjectStore instance for a different IDBTransaction instance.
* @param {IDBObjectStoreFull} store
* @param {import('./IDBTransaction.js').IDBTransactionFull} transaction
* @returns {IDBObjectStoreFull}
*/
function __clone(store: IDBObjectStoreFull, transaction: import("./IDBTransaction.js").IDBTransactionFull): IDBObjectStoreFull;
/**
*
* @param {IDBObjectStoreFull|import('./IDBIndex.js').IDBIndexFull} store
* @param {string} [msg]
* @throws {DOMException}
* @returns {void}
*/
function __invalidStateIfDeleted(store: IDBObjectStoreFull | import("./IDBIndex.js").IDBIndexFull, msg?: string | undefined): void;
/**
* Creates a new object store in the database.
* @param {import('./IDBDatabase.js').IDBDatabaseFull} db
* @param {IDBObjectStoreFull} store
* @returns {IDBObjectStore}
*/
function __createObjectStore(db: import("./IDBDatabase.js").IDBDatabaseFull, store: IDBObjectStoreFull): IDBObjectStore;
/**
* Deletes an object store from the database.
* @param {import('./IDBDatabase.js').IDBDatabaseFull} db
* @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
* @returns {void}
*/
function __deleteObjectStore(db: import("./IDBDatabase.js").IDBDatabaseFull, store: import("./IDBObjectStore.js").IDBObjectStoreFull): void;
/**
*
* @param {import('./IDBRequest.js').IDBRequestFull} request
* @param {IDBObjectStoreFull} store
* @param {boolean} invalidateCache
* @param {import('./Key.js').Value} value
* @param {boolean} noOverwrite
* @returns {void}
*/
function __storingRecordObjectStore(request: import("./IDBRequest.js").IDBRequestFull, store: IDBObjectStoreFull, invalidateCache: boolean, value: import("./Key.js").Value, noOverwrite: boolean, ...args: any[]): void;
}
import SyncPromise from 'sync-promise-expanded';
import { IDBIndex } from './IDBIndex.js';
//# sourceMappingURL=IDBObjectStore.d.ts.map