use API extractor for cleaner package separation
This commit is contained in:
parent
6990b3b5ec
commit
5f8714091a
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -41,5 +41,6 @@
|
|||||||
"prebuilt": true,
|
"prebuilt": true,
|
||||||
"src/i18n/*.po": true
|
"src/i18n/*.po": true
|
||||||
},
|
},
|
||||||
"search.collapseResults": "auto"
|
"search.collapseResults": "auto",
|
||||||
|
"files.associations": { "api-extractor.json": "jsonc" }
|
||||||
}
|
}
|
131
packages/idb-bridge/api-extractor.json
Normal file
131
packages/idb-bridge/api-extractor.json
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/**
|
||||||
|
* Config file for API Extractor. For more info, please visit: https://api-extractor.com
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
|
||||||
|
* analyzes the symbols exported by this module.
|
||||||
|
*
|
||||||
|
* The file extension must be ".d.ts" and not ".ts".
|
||||||
|
*
|
||||||
|
* The path is resolved relative to the folder of the config file that contains the setting; to change this,
|
||||||
|
* prepend a folder token such as "<projectFolder>".
|
||||||
|
*
|
||||||
|
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||||
|
*/
|
||||||
|
"mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of NPM package names whose exports should be treated as part of this package.
|
||||||
|
*
|
||||||
|
* For example, suppose that Webpack is used to generate a distributed bundle for the project "library1",
|
||||||
|
* and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part
|
||||||
|
* of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly
|
||||||
|
* imports library2. To avoid this, we can specify:
|
||||||
|
*
|
||||||
|
* "bundledPackages": [ "library2" ],
|
||||||
|
*
|
||||||
|
* This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
|
||||||
|
* local files for library1.
|
||||||
|
*/
|
||||||
|
"bundledPackages": [],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures how the API report file (*.api.md) will be generated.
|
||||||
|
*/
|
||||||
|
"apiReport": {
|
||||||
|
/**
|
||||||
|
* (REQUIRED) Whether to generate an API report.
|
||||||
|
*/
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures how the doc model file (*.api.json) will be generated.
|
||||||
|
*/
|
||||||
|
"docModel": {
|
||||||
|
/**
|
||||||
|
* (REQUIRED) Whether to generate a doc model file.
|
||||||
|
*/
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures how the .d.ts rollup file will be generated.
|
||||||
|
*/
|
||||||
|
"dtsRollup": {
|
||||||
|
/**
|
||||||
|
* (REQUIRED) Whether to generate the .d.ts rollup file.
|
||||||
|
*/
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures how the tsdoc-metadata.json file will be generated.
|
||||||
|
*/
|
||||||
|
"tsdocMetadata": {
|
||||||
|
/**
|
||||||
|
* Whether to generate the tsdoc-metadata.json file.
|
||||||
|
*
|
||||||
|
* DEFAULT VALUE: true
|
||||||
|
*/
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
|
||||||
|
* will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
|
||||||
|
* To use the OS's default newline kind, specify "os".
|
||||||
|
*
|
||||||
|
* DEFAULT VALUE: "crlf"
|
||||||
|
*/
|
||||||
|
"newlineKind": "lf",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures how API Extractor reports error and warning messages produced during analysis.
|
||||||
|
*
|
||||||
|
* There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.
|
||||||
|
*/
|
||||||
|
"messages": {
|
||||||
|
/**
|
||||||
|
* Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing
|
||||||
|
* the input .d.ts files.
|
||||||
|
*
|
||||||
|
* TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551"
|
||||||
|
*
|
||||||
|
* DEFAULT VALUE: A single "default" entry with logLevel=warning.
|
||||||
|
*/
|
||||||
|
"compilerMessageReporting": {
|
||||||
|
/**
|
||||||
|
* Configures the default routing for messages that don't match an explicit rule in this table.
|
||||||
|
*/
|
||||||
|
"default": {
|
||||||
|
"logLevel": "warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures handling of messages reported by API Extractor during its analysis.
|
||||||
|
*
|
||||||
|
* API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag"
|
||||||
|
*
|
||||||
|
* DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings
|
||||||
|
*/
|
||||||
|
"extractorMessageReporting": {
|
||||||
|
"default": {
|
||||||
|
"logLevel": "warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures handling of messages reported by the TSDoc parser when analyzing code comments.
|
||||||
|
*/
|
||||||
|
"tsdocMessageReporting": {
|
||||||
|
"default": {
|
||||||
|
"logLevel": "warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,17 +4,18 @@
|
|||||||
"description": "IndexedDB implementation that uses SQLite3 as storage",
|
"description": "IndexedDB implementation that uses SQLite3 as storage",
|
||||||
"main": "./dist/idb-bridge.js",
|
"main": "./dist/idb-bridge.js",
|
||||||
"module": "./lib/index.js",
|
"module": "./lib/index.js",
|
||||||
"types": "./lib/index.d.ts",
|
"types": "./dist/idb-bridge.d.ts",
|
||||||
"author": "Florian Dold",
|
"author": "Florian Dold",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"private": false,
|
"private": false,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "tsc && ava",
|
"test": "tsc && ava",
|
||||||
"compile": "tsc && rollup -c",
|
"compile": "tsc && rollup -c && api-extractor run",
|
||||||
"clean": "rimraf dist lib",
|
"clean": "rimraf dist lib tsconfig.tsbuildinfo",
|
||||||
"pretty": "prettier --config ../../.prettierrc --write src"
|
"pretty": "prettier --config ../../.prettierrc --write src"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@microsoft/api-extractor": "^7.9.3",
|
||||||
"@rollup/plugin-typescript": "^5.0.2",
|
"@rollup/plugin-typescript": "^5.0.2",
|
||||||
"ava": "^3.10.1",
|
"ava": "^3.10.1",
|
||||||
"esm": "^3.2.25",
|
"esm": "^3.2.25",
|
||||||
@ -27,6 +28,8 @@
|
|||||||
"tslib": "^2.0.0"
|
"tslib": "^2.0.0"
|
||||||
},
|
},
|
||||||
"ava": {
|
"ava": {
|
||||||
"require": ["esm"]
|
"require": [
|
||||||
|
"esm"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ import { BridgeIDBFactory } from "./BridgeIDBFactory";
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#cursor
|
* http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#cursor
|
||||||
|
*
|
||||||
|
* @public
|
||||||
*/
|
*/
|
||||||
export class BridgeIDBCursor {
|
export class BridgeIDBCursor {
|
||||||
_request: BridgeIDBRequest | undefined;
|
_request: BridgeIDBRequest | undefined;
|
||||||
|
@ -33,6 +33,7 @@ import {
|
|||||||
Schema,
|
Schema,
|
||||||
DatabaseTransaction,
|
DatabaseTransaction,
|
||||||
} from "./backend-interface";
|
} from "./backend-interface";
|
||||||
|
import { BridgeIDBObjectStore } from "./BridgeIDBObjectStore";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that an active version change transaction is currently running.
|
* Ensure that an active version change transaction is currently running.
|
||||||
@ -62,6 +63,7 @@ const confirmActiveVersionchangeTransaction = (database: BridgeIDBDatabase) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#database-interface
|
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#database-interface
|
||||||
|
/** @public */
|
||||||
export class BridgeIDBDatabase extends FakeEventTarget {
|
export class BridgeIDBDatabase extends FakeEventTarget {
|
||||||
_closePending = false;
|
_closePending = false;
|
||||||
_closed = false;
|
_closed = false;
|
||||||
@ -120,7 +122,7 @@ export class BridgeIDBDatabase extends FakeEventTarget {
|
|||||||
public createObjectStore(
|
public createObjectStore(
|
||||||
name: string,
|
name: string,
|
||||||
options: { autoIncrement?: boolean; keyPath?: KeyPath } | null = {},
|
options: { autoIncrement?: boolean; keyPath?: KeyPath } | null = {},
|
||||||
) {
|
): BridgeIDBObjectStore {
|
||||||
if (name === undefined) {
|
if (name === undefined) {
|
||||||
throw new TypeError();
|
throw new TypeError();
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,10 @@ import FakeEvent from "./util/FakeEvent";
|
|||||||
import { Backend, DatabaseConnection } from "./backend-interface";
|
import { Backend, DatabaseConnection } from "./backend-interface";
|
||||||
import queueTask from "./util/queueTask";
|
import queueTask from "./util/queueTask";
|
||||||
|
|
||||||
type DatabaseList = Array<{ name: string; version: number }>;
|
/** @public */
|
||||||
|
export type DatabaseList = Array<{ name: string; version: number }>;
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export class BridgeIDBFactory {
|
export class BridgeIDBFactory {
|
||||||
public cmp = compareKeys;
|
public cmp = compareKeys;
|
||||||
private backend: Backend;
|
private backend: Backend;
|
||||||
|
@ -51,6 +51,7 @@ const confirmActiveTransaction = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#idl-def-IDBIndex
|
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#idl-def-IDBIndex
|
||||||
|
/** @public */
|
||||||
export class BridgeIDBIndex {
|
export class BridgeIDBIndex {
|
||||||
objectStore: BridgeIDBObjectStore;
|
objectStore: BridgeIDBObjectStore;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import { Key } from "./util/types";
|
|||||||
import valueToKey from "./util/valueToKey";
|
import valueToKey from "./util/valueToKey";
|
||||||
|
|
||||||
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#range-concept
|
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#range-concept
|
||||||
|
/** @public */
|
||||||
export class BridgeIDBKeyRange {
|
export class BridgeIDBKeyRange {
|
||||||
public static only(value: Key) {
|
public static only(value: Key) {
|
||||||
if (arguments.length === 0) {
|
if (arguments.length === 0) {
|
||||||
|
@ -43,10 +43,14 @@ import {
|
|||||||
RecordGetRequest,
|
RecordGetRequest,
|
||||||
ResultLevel,
|
ResultLevel,
|
||||||
StoreLevel,
|
StoreLevel,
|
||||||
|
Schema,
|
||||||
|
Backend,
|
||||||
|
DatabaseConnection,
|
||||||
} from "./backend-interface";
|
} from "./backend-interface";
|
||||||
import { BridgeIDBFactory } from "./BridgeIDBFactory";
|
import { BridgeIDBFactory } from "./BridgeIDBFactory";
|
||||||
|
|
||||||
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#object-store
|
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#object-store
|
||||||
|
/** @public */
|
||||||
export class BridgeIDBObjectStore {
|
export class BridgeIDBObjectStore {
|
||||||
_indexesCache: Map<string, BridgeIDBIndex> = new Map();
|
_indexesCache: Map<string, BridgeIDBIndex> = new Map();
|
||||||
|
|
||||||
@ -68,7 +72,7 @@ export class BridgeIDBObjectStore {
|
|||||||
|
|
||||||
_name: string;
|
_name: string;
|
||||||
|
|
||||||
get _schema() {
|
get _schema(): Schema {
|
||||||
return this.transaction.db._schema;
|
return this.transaction.db._schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,11 +87,11 @@ export class BridgeIDBObjectStore {
|
|||||||
return this._name;
|
return this._name;
|
||||||
}
|
}
|
||||||
|
|
||||||
get _backend() {
|
get _backend(): Backend {
|
||||||
return this.transaction.db._backend;
|
return this.transaction.db._backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
get _backendConnection() {
|
get _backendConnection(): DatabaseConnection {
|
||||||
return this.transaction.db._backendConnection;
|
return this.transaction.db._backendConnection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,11 +16,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { BridgeIDBRequest } from "./BridgeIDBRequest";
|
import { BridgeIDBRequest } from "./BridgeIDBRequest";
|
||||||
import { EventCallback } from "./util/types";
|
import { EventListener } from "./idbtypes";
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export class BridgeIDBOpenDBRequest extends BridgeIDBRequest {
|
export class BridgeIDBOpenDBRequest extends BridgeIDBRequest {
|
||||||
public onupgradeneeded: EventCallback | null = null;
|
public onupgradeneeded: EventListener | null = null;
|
||||||
public onblocked: EventCallback | null = null;
|
public onblocked: EventListener | null = null;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
@ -21,17 +21,18 @@ import { BridgeIDBObjectStore } from "./BridgeIDBObjectStore";
|
|||||||
import { BridgeIDBTransaction } from "./BridgeIDBTransaction";
|
import { BridgeIDBTransaction } from "./BridgeIDBTransaction";
|
||||||
import { InvalidStateError } from "./util/errors";
|
import { InvalidStateError } from "./util/errors";
|
||||||
import FakeEventTarget from "./util/FakeEventTarget";
|
import FakeEventTarget from "./util/FakeEventTarget";
|
||||||
import { EventCallback } from "./util/types";
|
|
||||||
import FakeEvent from "./util/FakeEvent";
|
import FakeEvent from "./util/FakeEvent";
|
||||||
|
import { EventListener } from "./idbtypes";
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export class BridgeIDBRequest extends FakeEventTarget {
|
export class BridgeIDBRequest extends FakeEventTarget {
|
||||||
_result: any = null;
|
_result: any = null;
|
||||||
_error: Error | null | undefined = null;
|
_error: Error | null | undefined = null;
|
||||||
source: BridgeFIBCursor | BridgeIDBIndex | BridgeIDBObjectStore | null = null;
|
source: BridgeFIBCursor | BridgeIDBIndex | BridgeIDBObjectStore | null = null;
|
||||||
transaction: BridgeIDBTransaction | null = null;
|
transaction: BridgeIDBTransaction | null = null;
|
||||||
readyState: "done" | "pending" = "pending";
|
readyState: "done" | "pending" = "pending";
|
||||||
onsuccess: EventCallback | null = null;
|
onsuccess: EventListener | null = null;
|
||||||
onerror: EventCallback | null = null;
|
onerror: EventListener | null = null;
|
||||||
|
|
||||||
get error() {
|
get error() {
|
||||||
if (this.readyState === "pending") {
|
if (this.readyState === "pending") {
|
||||||
|
@ -11,7 +11,6 @@ import fakeDOMStringList from "./util/fakeDOMStringList";
|
|||||||
import FakeEvent from "./util/FakeEvent";
|
import FakeEvent from "./util/FakeEvent";
|
||||||
import FakeEventTarget from "./util/FakeEventTarget";
|
import FakeEventTarget from "./util/FakeEventTarget";
|
||||||
import {
|
import {
|
||||||
EventCallback,
|
|
||||||
FakeDOMStringList,
|
FakeDOMStringList,
|
||||||
RequestObj,
|
RequestObj,
|
||||||
TransactionMode,
|
TransactionMode,
|
||||||
@ -20,8 +19,10 @@ import queueTask from "./util/queueTask";
|
|||||||
import openPromise from "./util/openPromise";
|
import openPromise from "./util/openPromise";
|
||||||
import { DatabaseTransaction, Backend } from "./backend-interface";
|
import { DatabaseTransaction, Backend } from "./backend-interface";
|
||||||
import { BridgeIDBFactory } from "./BridgeIDBFactory";
|
import { BridgeIDBFactory } from "./BridgeIDBFactory";
|
||||||
|
import { EventListener } from "./idbtypes";
|
||||||
|
|
||||||
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#transaction
|
// http://www.w3.org/TR/2015/REC-IndexedDB-20150108/#transaction
|
||||||
|
/** @public */
|
||||||
export class BridgeIDBTransaction extends FakeEventTarget {
|
export class BridgeIDBTransaction extends FakeEventTarget {
|
||||||
public _state: "active" | "inactive" | "committing" | "finished" = "active";
|
public _state: "active" | "inactive" | "committing" | "finished" = "active";
|
||||||
public _started = false;
|
public _started = false;
|
||||||
@ -33,9 +34,9 @@ export class BridgeIDBTransaction extends FakeEventTarget {
|
|||||||
public mode: TransactionMode;
|
public mode: TransactionMode;
|
||||||
public db: BridgeIDBDatabase;
|
public db: BridgeIDBDatabase;
|
||||||
public error: Error | null = null;
|
public error: Error | null = null;
|
||||||
public onabort: EventCallback | null = null;
|
public onabort: EventListener | null = null;
|
||||||
public oncomplete: EventCallback | null = null;
|
public oncomplete: EventListener | null = null;
|
||||||
public onerror: EventCallback | null = null;
|
public onerror: EventListener | null = null;
|
||||||
|
|
||||||
private _waitPromise: Promise<void>;
|
private _waitPromise: Promise<void>;
|
||||||
private _resolveWait: () => void;
|
private _resolveWait: () => void;
|
||||||
|
@ -36,7 +36,7 @@ import {
|
|||||||
} from "./util/errors";
|
} from "./util/errors";
|
||||||
import BTree, { ISortedMapF } from "./tree/b+tree";
|
import BTree, { ISortedMapF } from "./tree/b+tree";
|
||||||
import compareKeys from "./util/cmp";
|
import compareKeys from "./util/cmp";
|
||||||
import { Key, Value, KeyPath } from "./util/types";
|
import { Key, Value, KeyPath, TransactionMode } from "./util/types";
|
||||||
import { StoreKeyResult, makeStoreKeyValue } from "./util/makeStoreKeyValue";
|
import { StoreKeyResult, makeStoreKeyValue } from "./util/makeStoreKeyValue";
|
||||||
import getIndexKeys from "./util/getIndexKeys";
|
import getIndexKeys from "./util/getIndexKeys";
|
||||||
import openPromise from "./util/openPromise";
|
import openPromise from "./util/openPromise";
|
||||||
@ -89,24 +89,28 @@ interface Database {
|
|||||||
connectionCookie: string | undefined;
|
connectionCookie: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IndexDump {
|
/** @public */
|
||||||
|
export interface IndexDump {
|
||||||
name: string;
|
name: string;
|
||||||
records: IndexRecord[];
|
records: IndexRecord[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ObjectStoreDump {
|
/** @public */
|
||||||
|
export interface ObjectStoreDump {
|
||||||
name: string;
|
name: string;
|
||||||
keyGenerator: number;
|
keyGenerator: number;
|
||||||
records: ObjectStoreRecord[];
|
records: ObjectStoreRecord[];
|
||||||
indexes: { [name: string]: IndexDump };
|
indexes: { [name: string]: IndexDump };
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DatabaseDump {
|
/** @public */
|
||||||
|
export interface DatabaseDump {
|
||||||
schema: Schema;
|
schema: Schema;
|
||||||
objectStores: { [name: string]: ObjectStoreDump };
|
objectStores: { [name: string]: ObjectStoreDump };
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MemoryBackendDump {
|
/** @public */
|
||||||
|
export interface MemoryBackendDump {
|
||||||
databases: { [name: string]: DatabaseDump };
|
databases: { [name: string]: DatabaseDump };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,12 +136,14 @@ interface Connection {
|
|||||||
objectStoreMap: { [currentName: string]: ObjectStoreMapEntry };
|
objectStoreMap: { [currentName: string]: ObjectStoreMapEntry };
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IndexRecord {
|
/** @public */
|
||||||
|
export interface IndexRecord {
|
||||||
indexKey: Key;
|
indexKey: Key;
|
||||||
primaryKeys: Key[];
|
primaryKeys: Key[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ObjectStoreRecord {
|
/** @public */
|
||||||
|
export interface ObjectStoreRecord {
|
||||||
primaryKey: Key;
|
primaryKey: Key;
|
||||||
value: Value;
|
value: Value;
|
||||||
}
|
}
|
||||||
@ -210,6 +216,8 @@ function furthestKey(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Primitive in-memory backend.
|
* Primitive in-memory backend.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
*/
|
*/
|
||||||
export class MemoryBackend implements Backend {
|
export class MemoryBackend implements Backend {
|
||||||
private databases: { [name: string]: Database } = {};
|
private databases: { [name: string]: Database } = {};
|
||||||
@ -471,7 +479,7 @@ export class MemoryBackend implements Backend {
|
|||||||
async beginTransaction(
|
async beginTransaction(
|
||||||
conn: DatabaseConnection,
|
conn: DatabaseConnection,
|
||||||
objectStores: string[],
|
objectStores: string[],
|
||||||
mode: import("./util/types").TransactionMode,
|
mode: TransactionMode,
|
||||||
): Promise<DatabaseTransaction> {
|
): Promise<DatabaseTransaction> {
|
||||||
if (this.enableTracing) {
|
if (this.enableTracing) {
|
||||||
console.log(`TRACING: beginTransaction`);
|
console.log(`TRACING: beginTransaction`);
|
||||||
@ -781,7 +789,7 @@ export class MemoryBackend implements Backend {
|
|||||||
btx: DatabaseTransaction,
|
btx: DatabaseTransaction,
|
||||||
indexName: string,
|
indexName: string,
|
||||||
objectStoreName: string,
|
objectStoreName: string,
|
||||||
keyPath: import("./util/types").KeyPath,
|
keyPath: KeyPath,
|
||||||
multiEntry: boolean,
|
multiEntry: boolean,
|
||||||
unique: boolean,
|
unique: boolean,
|
||||||
): void {
|
): void {
|
||||||
|
@ -24,44 +24,52 @@ import {
|
|||||||
} from "./util/types";
|
} from "./util/types";
|
||||||
import { BridgeIDBKeyRange } from "./BridgeIDBKeyRange";
|
import { BridgeIDBKeyRange } from "./BridgeIDBKeyRange";
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface ObjectStoreProperties {
|
export interface ObjectStoreProperties {
|
||||||
keyPath: KeyPath | null;
|
keyPath: KeyPath | null;
|
||||||
autoIncrement: boolean;
|
autoIncrement: boolean;
|
||||||
indexes: { [nameame: string]: IndexProperties };
|
indexes: { [nameame: string]: IndexProperties };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface IndexProperties {
|
export interface IndexProperties {
|
||||||
keyPath: KeyPath;
|
keyPath: KeyPath;
|
||||||
multiEntry: boolean;
|
multiEntry: boolean;
|
||||||
unique: boolean;
|
unique: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface Schema {
|
export interface Schema {
|
||||||
databaseName: string;
|
databaseName: string;
|
||||||
databaseVersion: number;
|
databaseVersion: number;
|
||||||
objectStores: { [name: string]: ObjectStoreProperties };
|
objectStores: { [name: string]: ObjectStoreProperties };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface DatabaseConnection {
|
export interface DatabaseConnection {
|
||||||
connectionCookie: string;
|
connectionCookie: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface DatabaseTransaction {
|
export interface DatabaseTransaction {
|
||||||
transactionCookie: string;
|
transactionCookie: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export enum ResultLevel {
|
export enum ResultLevel {
|
||||||
OnlyCount,
|
OnlyCount,
|
||||||
OnlyKeys,
|
OnlyKeys,
|
||||||
Full,
|
Full,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export enum StoreLevel {
|
export enum StoreLevel {
|
||||||
NoOverwrite,
|
NoOverwrite,
|
||||||
AllowOverwrite,
|
AllowOverwrite,
|
||||||
UpdateExisting,
|
UpdateExisting,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface RecordGetRequest {
|
export interface RecordGetRequest {
|
||||||
direction: BridgeIDBCursorDirection;
|
direction: BridgeIDBCursorDirection;
|
||||||
objectStoreName: string;
|
objectStoreName: string;
|
||||||
@ -104,6 +112,7 @@ export interface RecordGetRequest {
|
|||||||
resultLevel: ResultLevel;
|
resultLevel: ResultLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface RecordGetResponse {
|
export interface RecordGetResponse {
|
||||||
values: Value[] | undefined;
|
values: Value[] | undefined;
|
||||||
indexKeys: Key[] | undefined;
|
indexKeys: Key[] | undefined;
|
||||||
@ -111,6 +120,7 @@ export interface RecordGetResponse {
|
|||||||
count: number;
|
count: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface RecordStoreRequest {
|
export interface RecordStoreRequest {
|
||||||
objectStoreName: string;
|
objectStoreName: string;
|
||||||
value: Value;
|
value: Value;
|
||||||
@ -118,6 +128,7 @@ export interface RecordStoreRequest {
|
|||||||
storeLevel: StoreLevel;
|
storeLevel: StoreLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface RecordStoreResponse {
|
export interface RecordStoreResponse {
|
||||||
/**
|
/**
|
||||||
* Key that the record was stored under in the object store.
|
* Key that the record was stored under in the object store.
|
||||||
@ -125,6 +136,7 @@ export interface RecordStoreResponse {
|
|||||||
key: Key;
|
key: Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface Backend {
|
export interface Backend {
|
||||||
getDatabases(): Promise<BridgeIDBDatabaseInfo[]>;
|
getDatabases(): Promise<BridgeIDBDatabaseInfo[]>;
|
||||||
|
|
||||||
|
@ -19,32 +19,58 @@ and limitations under the License.
|
|||||||
* Instead of ambient types, we export type declarations.
|
* Instead of ambient types, we export type declarations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export type IDBKeyPath = string;
|
export type IDBKeyPath = string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface EventListener {
|
export interface EventListener {
|
||||||
(evt: Event): void;
|
(evt: Event): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface EventListenerObject {
|
export interface EventListenerObject {
|
||||||
handleEvent(evt: Event): void;
|
handleEvent(evt: Event): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface EventListenerOptions {
|
export interface EventListenerOptions {
|
||||||
capture?: boolean;
|
capture?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface AddEventListenerOptions extends EventListenerOptions {
|
export interface AddEventListenerOptions extends EventListenerOptions {
|
||||||
once?: boolean;
|
once?: boolean;
|
||||||
passive?: boolean;
|
passive?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export type IDBTransactionMode = "readonly" | "readwrite" | "versionchange";
|
export type IDBTransactionMode = "readonly" | "readwrite" | "versionchange";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export type EventListenerOrEventListenerObject =
|
export type EventListenerOrEventListenerObject =
|
||||||
| EventListener
|
| EventListener
|
||||||
| EventListenerObject;
|
| EventListenerObject;
|
||||||
|
|
||||||
/** EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. */
|
/**
|
||||||
|
* EventTarget is a DOM interface implemented by objects that can receive
|
||||||
|
* events and may have listeners for them.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface EventTarget {
|
export interface EventTarget {
|
||||||
/**
|
/**
|
||||||
* Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
|
* Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
|
||||||
@ -78,7 +104,11 @@ export interface EventTarget {
|
|||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** An event which takes place in the DOM. */
|
/**
|
||||||
|
* An event which takes place in the DOM.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface Event {
|
export interface Event {
|
||||||
/**
|
/**
|
||||||
* Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
|
* Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
|
||||||
@ -110,7 +140,9 @@ export interface Event {
|
|||||||
*/
|
*/
|
||||||
readonly isTrusted: boolean;
|
readonly isTrusted: boolean;
|
||||||
returnValue: boolean;
|
returnValue: boolean;
|
||||||
/** @deprecated */
|
/**
|
||||||
|
* @deprecated use target instead
|
||||||
|
*/
|
||||||
readonly srcElement: EventTarget | null;
|
readonly srcElement: EventTarget | null;
|
||||||
/**
|
/**
|
||||||
* Returns the object to which event is dispatched (its target).
|
* Returns the object to which event is dispatched (its target).
|
||||||
@ -147,7 +179,11 @@ export interface Event {
|
|||||||
readonly NONE: number;
|
readonly NONE: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A type returned by some APIs which contains a list of DOMString (strings). */
|
/**
|
||||||
|
* A type returned by some APIs which contains a list of DOMString (strings).
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface DOMStringList {
|
export interface DOMStringList {
|
||||||
/**
|
/**
|
||||||
* Returns the number of strings in strings.
|
* Returns the number of strings in strings.
|
||||||
@ -164,31 +200,57 @@ export interface DOMStringList {
|
|||||||
[index: number]: string;
|
[index: number]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export type BufferSource = ArrayBufferView | ArrayBuffer;
|
export type BufferSource = ArrayBufferView | ArrayBuffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export type IDBValidKey = number | string | Date | BufferSource | IDBArrayKey;
|
export type IDBValidKey = number | string | Date | BufferSource | IDBArrayKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBIndexParameters {
|
export interface IDBIndexParameters {
|
||||||
multiEntry?: boolean;
|
multiEntry?: boolean;
|
||||||
unique?: boolean;
|
unique?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBObjectStoreParameters {
|
export interface IDBObjectStoreParameters {
|
||||||
autoIncrement?: boolean;
|
autoIncrement?: boolean;
|
||||||
keyPath?: string | string[] | null;
|
keyPath?: string | string[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface EventInit {
|
export interface EventInit {
|
||||||
bubbles?: boolean;
|
bubbles?: boolean;
|
||||||
cancelable?: boolean;
|
cancelable?: boolean;
|
||||||
composed?: boolean;
|
composed?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBArrayKey extends Array<IDBValidKey> {}
|
export interface IDBArrayKey extends Array<IDBValidKey> {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique";
|
export type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique";
|
||||||
|
|
||||||
/** This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. */
|
/**
|
||||||
|
* This IndexedDB API interface represents a cursor for traversing or
|
||||||
|
* iterating over multiple records in a database.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBCursor {
|
export interface IDBCursor {
|
||||||
/**
|
/**
|
||||||
* Returns the direction ("next", "nextunique", "prev" or "prevunique") of the cursor.
|
* Returns the direction ("next", "nextunique", "prev" or "prevunique") of the cursor.
|
||||||
@ -234,7 +296,13 @@ export interface IDBCursor {
|
|||||||
update(value: any): IDBRequest<IDBValidKey>;
|
update(value: any): IDBRequest<IDBValidKey>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. */
|
/**
|
||||||
|
* This IndexedDB API interface represents a cursor for traversing or
|
||||||
|
* iterating over multiple records in a database. It is the same as the
|
||||||
|
* IDBCursor, except that it includes the value property.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBCursorWithValue extends IDBCursor {
|
export interface IDBCursorWithValue extends IDBCursor {
|
||||||
/**
|
/**
|
||||||
* Returns the cursor's current value.
|
* Returns the cursor's current value.
|
||||||
@ -242,6 +310,9 @@ export interface IDBCursorWithValue extends IDBCursor {
|
|||||||
readonly value: any;
|
readonly value: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBDatabaseEventMap {
|
export interface IDBDatabaseEventMap {
|
||||||
abort: Event;
|
abort: Event;
|
||||||
close: Event;
|
close: Event;
|
||||||
@ -249,7 +320,14 @@ export interface IDBDatabaseEventMap {
|
|||||||
versionchange: IDBVersionChangeEvent;
|
versionchange: IDBVersionChangeEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. */
|
/**
|
||||||
|
* This IndexedDB API interface provides a connection to a database; you can
|
||||||
|
* use an IDBDatabase object to open a transaction on your database then
|
||||||
|
* create, manipulate, and delete objects (data) in that database. The
|
||||||
|
* interface provides the only way to get and manage versions of the database.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBDatabase extends EventTarget {
|
export interface IDBDatabase extends EventTarget {
|
||||||
/**
|
/**
|
||||||
* Returns the name of the database.
|
* Returns the name of the database.
|
||||||
@ -317,7 +395,9 @@ export interface IDBDatabase extends EventTarget {
|
|||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. For a full working example, see our To-do Notifications app (view example live.) */
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBFactory {
|
export interface IDBFactory {
|
||||||
/**
|
/**
|
||||||
* Compares two values as keys. Returns -1 if key1 precedes key2, 1 if key2 precedes key1, and 0 if the keys are equal.
|
* Compares two values as keys. Returns -1 if key1 precedes key2, 1 if key2 precedes key1, and 0 if the keys are equal.
|
||||||
@ -326,16 +406,28 @@ export interface IDBFactory {
|
|||||||
*/
|
*/
|
||||||
cmp(first: any, second: any): number;
|
cmp(first: any, second: any): number;
|
||||||
/**
|
/**
|
||||||
* Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.
|
* Attempts to delete the named database. If the database already exists and
|
||||||
|
* there are open connections that don't close in response to a versionchange
|
||||||
|
* event, the request will be blocked until all they close. If the request is
|
||||||
|
* successful request's result will be null.
|
||||||
*/
|
*/
|
||||||
deleteDatabase(name: string): IDBOpenDBRequest;
|
deleteDatabase(name: string): IDBOpenDBRequest;
|
||||||
/**
|
/**
|
||||||
* Attempts to open a connection to the named database with the current version, or 1 if it does not already exist. If the request is successful request's result will be the connection.
|
* Attempts to open a connection to the named database with the current
|
||||||
|
* version, or 1 if it does not already exist. If the request is successful
|
||||||
|
* request's result will be the connection.
|
||||||
*/
|
*/
|
||||||
open(name: string, version?: number): IDBOpenDBRequest;
|
open(name: string, version?: number): IDBOpenDBRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. */
|
/**
|
||||||
|
* IDBIndex interface of the IndexedDB API provides asynchronous access to an
|
||||||
|
* index in a database. An index is a kind of object store for looking up
|
||||||
|
* records in another object store, called the referenced object store. You use
|
||||||
|
* this interface to retrieve data.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBIndex {
|
export interface IDBIndex {
|
||||||
readonly keyPath: string | string[];
|
readonly keyPath: string | string[];
|
||||||
readonly multiEntry: boolean;
|
readonly multiEntry: boolean;
|
||||||
@ -404,7 +496,15 @@ export interface IDBIndex {
|
|||||||
): IDBRequest<IDBCursor | null>;
|
): IDBRequest<IDBCursor | null>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A key range can be a single value or a range with upper and lower bounds or endpoints. If the key range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. A bounded key range can either be open (the endpoints are excluded) or closed (the endpoints are included). To retrieve all keys within a certain range, you can use the following code constructs: */
|
/**
|
||||||
|
* A key range can be a single value or a range with upper and lower bounds or
|
||||||
|
* endpoints. If the key range has both upper and lower bounds, then it is
|
||||||
|
* bounded; if it has no bounds, it is unbounded. A bounded key range can
|
||||||
|
* either be open (the endpoints are excluded) or closed (the endpoints are
|
||||||
|
* included).
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBKeyRange {
|
export interface IDBKeyRange {
|
||||||
/**
|
/**
|
||||||
* Returns lower bound, or undefined if none.
|
* Returns lower bound, or undefined if none.
|
||||||
@ -428,7 +528,9 @@ export interface IDBKeyRange {
|
|||||||
includes(key: any): boolean;
|
includes(key: any): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This example shows a variety of different uses of object stores, from updating the data structure with IDBObjectStore.createIndex inside an onupgradeneeded function, to adding a new item to our object store with IDBObjectStore.add. For a full working example, see our To-do Notifications app (view example live.) */
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBObjectStore {
|
export interface IDBObjectStore {
|
||||||
/**
|
/**
|
||||||
* Returns true if the store has a key generator, and false otherwise.
|
* Returns true if the store has a key generator, and false otherwise.
|
||||||
@ -555,12 +657,19 @@ export interface IDBObjectStore {
|
|||||||
put(value: any, key?: IDBValidKey): IDBRequest<IDBValidKey>;
|
put(value: any, key?: IDBValidKey): IDBRequest<IDBValidKey>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
|
export interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
|
||||||
blocked: Event;
|
blocked: Event;
|
||||||
upgradeneeded: IDBVersionChangeEvent;
|
upgradeneeded: IDBVersionChangeEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Also inherits methods from its parents IDBRequest and EventTarget. */
|
/**
|
||||||
|
* Also inherits methods from its parents IDBRequest and EventTarget.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBOpenDBRequest extends IDBRequest<IDBDatabase> {
|
export interface IDBOpenDBRequest extends IDBRequest<IDBDatabase> {
|
||||||
onblocked: ((this: IDBOpenDBRequest, ev: Event) => any) | null;
|
onblocked: ((this: IDBOpenDBRequest, ev: Event) => any) | null;
|
||||||
onupgradeneeded:
|
onupgradeneeded:
|
||||||
@ -588,14 +697,25 @@ export interface IDBOpenDBRequest extends IDBRequest<IDBDatabase> {
|
|||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export type IDBRequestReadyState = "done" | "pending";
|
export type IDBRequestReadyState = "done" | "pending";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBRequestEventMap {
|
export interface IDBRequestEventMap {
|
||||||
error: Event;
|
error: Event;
|
||||||
success: Event;
|
success: Event;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */
|
/**
|
||||||
|
* An abnormal event (called an exception) which occurs as a result of calling
|
||||||
|
* a method or accessing a property of a web API.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface DOMException {
|
export interface DOMException {
|
||||||
readonly code: number;
|
readonly code: number;
|
||||||
readonly message: string;
|
readonly message: string;
|
||||||
@ -627,7 +747,14 @@ export interface DOMException {
|
|||||||
readonly WRONG_DOCUMENT_ERR: number;
|
readonly WRONG_DOCUMENT_ERR: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The request object does not initially contain any information about the result of the operation, but once information becomes available, an event is fired on the request, and the information becomes available through the properties of the IDBRequest instance. */
|
/**
|
||||||
|
* The request object does not initially contain any information about the
|
||||||
|
* result of the operation, but once information becomes available, an event is
|
||||||
|
* fired on the request, and the information becomes available through the
|
||||||
|
* properties of the IDBRequest instance.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBRequest<T = any> extends EventTarget {
|
export interface IDBRequest<T = any> extends EventTarget {
|
||||||
/**
|
/**
|
||||||
* When a request is completed, returns the error (a DOMException), or null if the request succeeded. Throws a "InvalidStateError" DOMException if the request is still pending.
|
* When a request is completed, returns the error (a DOMException), or null if the request succeeded. Throws a "InvalidStateError" DOMException if the request is still pending.
|
||||||
@ -673,12 +800,18 @@ export interface IDBRequest<T = any> extends EventTarget {
|
|||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBTransactionEventMap {
|
export interface IDBTransactionEventMap {
|
||||||
abort: Event;
|
abort: Event;
|
||||||
complete: Event;
|
complete: Event;
|
||||||
error: Event;
|
error: Event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBTransaction extends EventTarget {
|
export interface IDBTransaction extends EventTarget {
|
||||||
/**
|
/**
|
||||||
* Returns the transaction's connection.
|
* Returns the transaction's connection.
|
||||||
@ -729,7 +862,13 @@ export interface IDBTransaction extends EventTarget {
|
|||||||
): void;
|
): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This IndexedDB API interface indicates that the version of the database has changed, as the result of an IDBOpenDBRequest.onupgradeneeded event handler function. */
|
/**
|
||||||
|
* This IndexedDB API interface indicates that the version of the database has
|
||||||
|
* changed, as the result of an IDBOpenDBRequest.onupgradeneeded event handler
|
||||||
|
* function.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export interface IDBVersionChangeEvent extends Event {
|
export interface IDBVersionChangeEvent extends Event {
|
||||||
readonly newVersion: number | null;
|
readonly newVersion: number | null;
|
||||||
readonly oldVersion: number;
|
readonly oldVersion: number;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { BridgeIDBFactory } from "./BridgeIDBFactory";
|
import { BridgeIDBFactory, DatabaseList } from "./BridgeIDBFactory";
|
||||||
import { BridgeIDBCursor } from "./BridgeIDBCursor";
|
import { BridgeIDBCursor } from "./BridgeIDBCursor";
|
||||||
import { BridgeIDBIndex } from "./BridgeIDBIndex";
|
import { BridgeIDBIndex } from "./BridgeIDBIndex";
|
||||||
import { BridgeIDBDatabase } from "./BridgeIDBDatabase";
|
import { BridgeIDBDatabase } from "./BridgeIDBDatabase";
|
||||||
@ -8,8 +8,81 @@ import { BridgeIDBOpenDBRequest } from "./BridgeIDBOpenDBRequest";
|
|||||||
import { BridgeIDBRequest } from "./BridgeIDBRequest";
|
import { BridgeIDBRequest } from "./BridgeIDBRequest";
|
||||||
import { BridgeIDBTransaction } from "./BridgeIDBTransaction";
|
import { BridgeIDBTransaction } from "./BridgeIDBTransaction";
|
||||||
import { BridgeIDBVersionChangeEvent } from "./BridgeIDBVersionChangeEvent";
|
import { BridgeIDBVersionChangeEvent } from "./BridgeIDBVersionChangeEvent";
|
||||||
|
import {
|
||||||
|
Value,
|
||||||
|
CursorSource,
|
||||||
|
CursorRange,
|
||||||
|
BridgeIDBCursorDirection,
|
||||||
|
Key,
|
||||||
|
KeyPath,
|
||||||
|
TransactionMode,
|
||||||
|
FakeDOMStringList,
|
||||||
|
RequestObj,
|
||||||
|
BridgeIDBDatabaseInfo,
|
||||||
|
EventType,
|
||||||
|
} from "./util/types";
|
||||||
|
import {
|
||||||
|
DatabaseTransaction,
|
||||||
|
RecordGetResponse,
|
||||||
|
RecordGetRequest,
|
||||||
|
Schema,
|
||||||
|
Backend,
|
||||||
|
RecordStoreRequest,
|
||||||
|
RecordStoreResponse,
|
||||||
|
DatabaseConnection,
|
||||||
|
ObjectStoreProperties,
|
||||||
|
StoreLevel,
|
||||||
|
ResultLevel,
|
||||||
|
IndexProperties,
|
||||||
|
} from "./backend-interface";
|
||||||
|
import FakeEventTarget, { Listener } from "./util/FakeEventTarget";
|
||||||
|
import { DatabaseDump, ObjectStoreDump, IndexDump, IndexRecord, ObjectStoreRecord, MemoryBackendDump } from "./MemoryBackend";
|
||||||
|
import { Event } from "./idbtypes";
|
||||||
|
|
||||||
export { BridgeIDBFactory, BridgeIDBCursor };
|
export {
|
||||||
|
BridgeIDBCursor,
|
||||||
|
BridgeIDBCursorDirection,
|
||||||
|
BridgeIDBDatabase,
|
||||||
|
BridgeIDBDatabaseInfo,
|
||||||
|
BridgeIDBFactory,
|
||||||
|
BridgeIDBIndex,
|
||||||
|
BridgeIDBKeyRange,
|
||||||
|
BridgeIDBObjectStore,
|
||||||
|
BridgeIDBOpenDBRequest,
|
||||||
|
BridgeIDBRequest,
|
||||||
|
BridgeIDBTransaction,
|
||||||
|
Value,
|
||||||
|
CursorSource,
|
||||||
|
CursorRange,
|
||||||
|
Key,
|
||||||
|
DatabaseTransaction,
|
||||||
|
RecordGetRequest,
|
||||||
|
RecordGetResponse,
|
||||||
|
KeyPath,
|
||||||
|
Schema,
|
||||||
|
Backend,
|
||||||
|
TransactionMode,
|
||||||
|
DatabaseList,
|
||||||
|
RecordStoreRequest,
|
||||||
|
RecordStoreResponse,
|
||||||
|
FakeEventTarget,
|
||||||
|
DatabaseConnection,
|
||||||
|
FakeDOMStringList,
|
||||||
|
ObjectStoreProperties,
|
||||||
|
RequestObj,
|
||||||
|
StoreLevel,
|
||||||
|
ResultLevel,
|
||||||
|
DatabaseDump,
|
||||||
|
ObjectStoreDump,
|
||||||
|
IndexDump,
|
||||||
|
IndexRecord,
|
||||||
|
ObjectStoreRecord,
|
||||||
|
EventType,
|
||||||
|
IndexProperties,
|
||||||
|
MemoryBackendDump,
|
||||||
|
Event,
|
||||||
|
Listener,
|
||||||
|
};
|
||||||
|
|
||||||
export { MemoryBackend } from "./MemoryBackend";
|
export { MemoryBackend } from "./MemoryBackend";
|
||||||
|
|
||||||
@ -31,6 +104,8 @@ export { MemoryBackend } from "./MemoryBackend";
|
|||||||
/**
|
/**
|
||||||
* Populate the global name space such that the given IndexedDB factory is made
|
* Populate the global name space such that the given IndexedDB factory is made
|
||||||
* available globally.
|
* available globally.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
*/
|
*/
|
||||||
export function shimIndexedDB(factory: BridgeIDBFactory): void {
|
export function shimIndexedDB(factory: BridgeIDBFactory): void {
|
||||||
// @ts-ignore: shimming
|
// @ts-ignore: shimming
|
||||||
@ -59,5 +134,4 @@ export function shimIndexedDB(factory: BridgeIDBFactory): void {
|
|||||||
globalThis.IDBVersionChangeEvent = BridgeIDBVersionChangeEvent;
|
globalThis.IDBVersionChangeEvent = BridgeIDBVersionChangeEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
import * as idbtypes from "./idbtypes";
|
export * from "./idbtypes";
|
||||||
export type { idbtypes };
|
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
|
|
||||||
import FakeEventTarget from "./FakeEventTarget";
|
import FakeEventTarget from "./FakeEventTarget";
|
||||||
import { EventType } from "./types";
|
import { EventType } from "./types";
|
||||||
|
import { Event, EventTarget } from "../idbtypes";
|
||||||
|
|
||||||
export class Event {
|
export class FakeEvent implements Event {
|
||||||
public eventPath: FakeEventTarget[] = [];
|
public eventPath: FakeEventTarget[] = [];
|
||||||
public type: EventType;
|
public type: EventType;
|
||||||
|
|
||||||
@ -57,6 +58,18 @@ export class Event {
|
|||||||
this.cancelable =
|
this.cancelable =
|
||||||
eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false;
|
eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false;
|
||||||
}
|
}
|
||||||
|
cancelBubble: boolean = false;
|
||||||
|
composed: boolean = false;
|
||||||
|
returnValue: boolean = false;
|
||||||
|
get srcElement(): EventTarget | null {
|
||||||
|
return this.target;
|
||||||
|
}
|
||||||
|
composedPath(): EventTarget[] {
|
||||||
|
throw new Error("Method not implemented.");
|
||||||
|
}
|
||||||
|
initEvent(type: string, bubbles?: boolean | undefined, cancelable?: boolean | undefined): void {
|
||||||
|
throw new Error("Method not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
public preventDefault() {
|
public preventDefault() {
|
||||||
if (this.cancelable) {
|
if (this.cancelable) {
|
||||||
@ -74,4 +87,4 @@ export class Event {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Event;
|
export default FakeEvent;
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
import { InvalidStateError } from "./errors";
|
import { InvalidStateError } from "./errors";
|
||||||
import FakeEvent from "./FakeEvent";
|
import FakeEvent from "./FakeEvent";
|
||||||
import { EventCallback, EventType } from "./types";
|
import { EventType } from "./types";
|
||||||
|
import { EventTarget, Event, EventListenerOrEventListenerObject, EventListener } from "../idbtypes";
|
||||||
|
|
||||||
type EventTypeProp =
|
type EventTypeProp =
|
||||||
| "onabort"
|
| "onabort"
|
||||||
@ -27,8 +28,9 @@ type EventTypeProp =
|
|||||||
| "onupgradeneeded"
|
| "onupgradeneeded"
|
||||||
| "onversionchange";
|
| "onversionchange";
|
||||||
|
|
||||||
interface Listener {
|
/** @public */
|
||||||
callback: EventCallback;
|
export interface Listener {
|
||||||
|
callback: EventListenerOrEventListenerObject;
|
||||||
capture: boolean;
|
capture: boolean;
|
||||||
type: EventType;
|
type: EventType;
|
||||||
}
|
}
|
||||||
@ -86,35 +88,44 @@ const invokeEventListeners = (event: FakeEvent, obj: FakeEventTarget) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
abstract class FakeEventTarget {
|
/** @public */
|
||||||
|
abstract class FakeEventTarget implements EventTarget {
|
||||||
public readonly listeners: Listener[] = [];
|
public readonly listeners: Listener[] = [];
|
||||||
|
|
||||||
// These will be overridden in individual subclasses and made not readonly
|
// These will be overridden in individual subclasses and made not readonly
|
||||||
public readonly onabort: EventCallback | null | undefined;
|
public readonly onabort: EventListener | null | undefined;
|
||||||
public readonly onblocked: EventCallback | null | undefined;
|
public readonly onblocked: EventListener | null | undefined;
|
||||||
public readonly oncomplete: EventCallback | null | undefined;
|
public readonly oncomplete: EventListener | null | undefined;
|
||||||
public readonly onerror: EventCallback | null | undefined;
|
public readonly onerror: EventListener | null | undefined;
|
||||||
public readonly onsuccess: EventCallback | null | undefined;
|
public readonly onsuccess: EventListener | null | undefined;
|
||||||
public readonly onupgradeneeded: EventCallback | null | undefined;
|
public readonly onupgradeneeded: EventListener | null | undefined;
|
||||||
public readonly onversionchange: EventCallback | null | undefined;
|
public readonly onversionchange: EventListener | null | undefined;
|
||||||
|
|
||||||
static enableTracing: boolean = false;
|
static enableTracing: boolean = false;
|
||||||
|
|
||||||
public addEventListener(
|
public addEventListener(
|
||||||
type: EventType,
|
type: EventType,
|
||||||
callback: EventCallback,
|
listener: EventListenerOrEventListenerObject | null,
|
||||||
capture = false,
|
capture = false,
|
||||||
) {
|
) {
|
||||||
|
if (typeof listener === "function") {
|
||||||
this.listeners.push({
|
this.listeners.push({
|
||||||
callback,
|
callback: listener,
|
||||||
|
capture,
|
||||||
|
type,
|
||||||
|
});
|
||||||
|
} else if (typeof listener === "object" && listener != null) {
|
||||||
|
this.listeners.push({
|
||||||
|
callback: (e: Event) => listener.handleEvent(e),
|
||||||
capture,
|
capture,
|
||||||
type,
|
type,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public removeEventListener(
|
public removeEventListener(
|
||||||
type: EventType,
|
type: EventType,
|
||||||
callback: EventCallback,
|
callback: EventListenerOrEventListenerObject,
|
||||||
capture = false,
|
capture = false,
|
||||||
) {
|
) {
|
||||||
const i = this.listeners.findIndex((listener) => {
|
const i = this.listeners.findIndex((listener) => {
|
||||||
@ -129,17 +140,21 @@ abstract class FakeEventTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// http://www.w3.org/TR/dom/#dispatching-events
|
// http://www.w3.org/TR/dom/#dispatching-events
|
||||||
public dispatchEvent(event: FakeEvent) {
|
public dispatchEvent(event: Event): boolean {
|
||||||
|
if (!(event instanceof FakeEvent)) {
|
||||||
|
throw Error("dispatchEvent only works with FakeEvent");
|
||||||
|
}
|
||||||
|
const fe = event as FakeEvent;
|
||||||
if (event.dispatched || !event.initialized) {
|
if (event.dispatched || !event.initialized) {
|
||||||
throw new InvalidStateError("The object is in an invalid state.");
|
throw new InvalidStateError("The object is in an invalid state.");
|
||||||
}
|
}
|
||||||
event.isTrusted = false;
|
fe.isTrusted = false;
|
||||||
|
|
||||||
event.dispatched = true;
|
fe.dispatched = true;
|
||||||
event.target = this;
|
fe.target = this;
|
||||||
// NOT SURE WHEN THIS SHOULD BE SET event.eventPath = [];
|
// NOT SURE WHEN THIS SHOULD BE SET event.eventPath = [];
|
||||||
|
|
||||||
event.eventPhase = event.CAPTURING_PHASE;
|
fe.eventPhase = event.CAPTURING_PHASE;
|
||||||
if (FakeEventTarget.enableTracing) {
|
if (FakeEventTarget.enableTracing) {
|
||||||
console.log(
|
console.log(
|
||||||
`dispatching '${event.type}' event along path with ${event.eventPath.length} elements`,
|
`dispatching '${event.type}' event along path with ${event.eventPath.length} elements`,
|
||||||
@ -151,15 +166,15 @@ abstract class FakeEventTarget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.eventPhase = event.AT_TARGET;
|
fe.eventPhase = event.AT_TARGET;
|
||||||
if (!event.propagationStopped) {
|
if (!event.propagationStopped) {
|
||||||
invokeEventListeners(event, event.target);
|
invokeEventListeners(event, fe.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.bubbles) {
|
if (event.bubbles) {
|
||||||
event.eventPath.reverse();
|
fe.eventPath.reverse();
|
||||||
event.eventPhase = event.BUBBLING_PHASE;
|
fe.eventPhase = event.BUBBLING_PHASE;
|
||||||
if (event.eventPath.length === 0 && event.type === "error") {
|
if (fe.eventPath.length === 0 && event.type === "error") {
|
||||||
console.error("Unhandled error event: ", event.target);
|
console.error("Unhandled error event: ", event.target);
|
||||||
}
|
}
|
||||||
for (const obj of event.eventPath) {
|
for (const obj of event.eventPath) {
|
||||||
@ -169,9 +184,9 @@ abstract class FakeEventTarget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.dispatched = false;
|
fe.dispatched = false;
|
||||||
event.eventPhase = event.NONE;
|
fe.eventPhase = event.NONE;
|
||||||
event.currentTarget = null;
|
fe.currentTarget = null;
|
||||||
|
|
||||||
if (event.canceled) {
|
if (event.canceled) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -18,16 +18,10 @@
|
|||||||
import { BridgeIDBRequest } from "../BridgeIDBRequest";
|
import { BridgeIDBRequest } from "../BridgeIDBRequest";
|
||||||
import { BridgeIDBKeyRange } from "../BridgeIDBKeyRange";
|
import { BridgeIDBKeyRange } from "../BridgeIDBKeyRange";
|
||||||
import { BridgeIDBIndex } from "../BridgeIDBIndex";
|
import { BridgeIDBIndex } from "../BridgeIDBIndex";
|
||||||
import { Event } from "../util/FakeEvent";
|
|
||||||
import { BridgeIDBObjectStore } from "../BridgeIDBObjectStore";
|
import { BridgeIDBObjectStore } from "../BridgeIDBObjectStore";
|
||||||
|
import { Event } from "../idbtypes";
|
||||||
|
|
||||||
interface EventInCallback extends Event {
|
/** @public */
|
||||||
target: any;
|
|
||||||
error: Error | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type EventCallback = (event: EventInCallback) => void;
|
|
||||||
|
|
||||||
export type EventType =
|
export type EventType =
|
||||||
| "abort"
|
| "abort"
|
||||||
| "blocked"
|
| "blocked"
|
||||||
@ -37,39 +31,52 @@ export type EventType =
|
|||||||
| "upgradeneeded"
|
| "upgradeneeded"
|
||||||
| "versionchange";
|
| "versionchange";
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export type CursorSource = BridgeIDBIndex | BridgeIDBObjectStore;
|
export type CursorSource = BridgeIDBIndex | BridgeIDBObjectStore;
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface FakeDOMStringList extends Array<string> {
|
export interface FakeDOMStringList extends Array<string> {
|
||||||
contains: (value: string) => boolean;
|
contains: (value: string) => boolean;
|
||||||
item: (i: number) => string | undefined;
|
item: (i: number) => string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
export type BridgeIDBCursorDirection =
|
export type BridgeIDBCursorDirection =
|
||||||
| "next"
|
| "next"
|
||||||
| "nextunique"
|
| "nextunique"
|
||||||
| "prev"
|
| "prev"
|
||||||
| "prevunique";
|
| "prevunique";
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export type KeyPath = string | string[];
|
export type KeyPath = string | string[];
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export type Key = any;
|
export type Key = any;
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export type CursorRange = Key | BridgeIDBKeyRange | undefined;
|
export type CursorRange = Key | BridgeIDBKeyRange | undefined;
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export type Value = any;
|
export type Value = any;
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface Record {
|
export interface Record {
|
||||||
key: Key;
|
key: Key;
|
||||||
value: Key | Value; // For indexes, will be Key. For object stores, will be Value.
|
value: Key | Value; // For indexes, will be Key. For object stores, will be Value.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export type TransactionMode = "readonly" | "readwrite" | "versionchange";
|
export type TransactionMode = "readonly" | "readwrite" | "versionchange";
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface BridgeIDBDatabaseInfo {
|
export interface BridgeIDBDatabaseInfo {
|
||||||
name: string;
|
name: string;
|
||||||
version: number;
|
version: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
export interface RequestObj {
|
export interface RequestObj {
|
||||||
operation: () => Promise<any>;
|
operation: () => Promise<any>;
|
||||||
request?: BridgeIDBRequest | undefined;
|
request?: BridgeIDBRequest | undefined;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"outDir": "lib",
|
"outDir": "lib",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
"noEmitOnError": true,
|
"noEmitOnError": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
"types": "./lib/index.d.ts",
|
"types": "./lib/index.d.ts",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ava/typescript": "^1.1.1",
|
"@ava/typescript": "^1.1.1",
|
||||||
|
"@microsoft/api-extractor": "^7.9.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^3.6.1",
|
"@typescript-eslint/eslint-plugin": "^3.6.1",
|
||||||
"@typescript-eslint/parser": "^3.6.1",
|
"@typescript-eslint/parser": "^3.6.1",
|
||||||
"ava": "^3.10.1",
|
"ava": "^3.10.1",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Stores } from "./types/dbTypes";
|
import { Stores } from "./types/dbTypes";
|
||||||
import { openDatabase, Database, Store, Index } from "./util/query";
|
import { openDatabase, Database, Store, Index } from "./util/query";
|
||||||
import type { idbtypes } from "idb-bridge";
|
import { IDBFactory, IDBDatabase } from "idb-bridge";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the Taler database. The name includes the
|
* Name of the Taler database. The name includes the
|
||||||
@ -24,11 +24,11 @@ export const WALLET_DB_MINOR_VERSION = 1;
|
|||||||
* to the taler wallet db.
|
* to the taler wallet db.
|
||||||
*/
|
*/
|
||||||
export function openTalerDatabase(
|
export function openTalerDatabase(
|
||||||
idbFactory: idbtypes.IDBFactory,
|
idbFactory: IDBFactory,
|
||||||
onVersionChange: () => void,
|
onVersionChange: () => void,
|
||||||
): Promise<idbtypes.IDBDatabase> {
|
): Promise<IDBDatabase> {
|
||||||
const onUpgradeNeeded = (
|
const onUpgradeNeeded = (
|
||||||
db: idbtypes.IDBDatabase,
|
db: IDBDatabase,
|
||||||
oldVersion: number,
|
oldVersion: number,
|
||||||
newVersion: number,
|
newVersion: number,
|
||||||
): void => {
|
): void => {
|
||||||
@ -61,6 +61,6 @@ export function openTalerDatabase(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteTalerDatabase(idbFactory: idbtypes.IDBFactory): void {
|
export function deleteTalerDatabase(idbFactory: IDBFactory): void {
|
||||||
Database.deleteDatabase(idbFactory, TALER_DB_NAME);
|
Database.deleteDatabase(idbFactory, TALER_DB_NAME);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ import {
|
|||||||
} from "./ReserveTransaction";
|
} from "./ReserveTransaction";
|
||||||
import { Timestamp, Duration, getTimestampNow } from "../util/time";
|
import { Timestamp, Duration, getTimestampNow } from "../util/time";
|
||||||
import { PayCoinSelection, PayCostInfo } from "../operations/pay";
|
import { PayCoinSelection, PayCostInfo } from "../operations/pay";
|
||||||
import { idbtypes } from "idb-bridge";
|
import { IDBKeyPath } from "idb-bridge";
|
||||||
|
|
||||||
export enum ReserveRecordStatus {
|
export enum ReserveRecordStatus {
|
||||||
/**
|
/**
|
||||||
@ -1666,7 +1666,7 @@ class DenominationsStore extends Store<DenominationRecord> {
|
|||||||
constructor() {
|
constructor() {
|
||||||
// cast needed because of bug in type annotations
|
// cast needed because of bug in type annotations
|
||||||
super("denominations", {
|
super("denominations", {
|
||||||
keyPath: (["exchangeBaseUrl", "denomPub"] as any) as idbtypes.IDBKeyPath,
|
keyPath: (["exchangeBaseUrl", "denomPub"] as any) as IDBKeyPath,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,17 @@
|
|||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import { openPromise } from "./promiseUtils";
|
import { openPromise } from "./promiseUtils";
|
||||||
import type { idbtypes } from "idb-bridge";
|
import {
|
||||||
|
IDBObjectStoreParameters,
|
||||||
|
IDBRequest,
|
||||||
|
IDBTransaction,
|
||||||
|
IDBValidKey,
|
||||||
|
IDBDatabase,
|
||||||
|
IDBFactory,
|
||||||
|
IDBVersionChangeEvent,
|
||||||
|
Event,
|
||||||
|
IDBCursor,
|
||||||
|
} from "idb-bridge";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception that should be thrown by client code to abort a transaction.
|
* Exception that should be thrown by client code to abort a transaction.
|
||||||
@ -37,7 +47,7 @@ export const TransactionAbort = Symbol("transaction_abort");
|
|||||||
export class Store<T> {
|
export class Store<T> {
|
||||||
constructor(
|
constructor(
|
||||||
public name: string,
|
public name: string,
|
||||||
public storeParams?: idbtypes.IDBObjectStoreParameters,
|
public storeParams?: IDBObjectStoreParameters,
|
||||||
public validator?: (v: T) => T,
|
public validator?: (v: T) => T,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
@ -55,7 +65,7 @@ export interface IndexOptions {
|
|||||||
multiEntry?: boolean;
|
multiEntry?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestToPromise(req: idbtypes.IDBRequest): Promise<any> {
|
function requestToPromise(req: IDBRequest): Promise<any> {
|
||||||
const stack = Error("Failed request was started here.");
|
const stack = Error("Failed request was started here.");
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
req.onsuccess = () => {
|
req.onsuccess = () => {
|
||||||
@ -69,7 +79,7 @@ function requestToPromise(req: idbtypes.IDBRequest): Promise<any> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function transactionToPromise(tx: idbtypes.IDBTransaction): Promise<void> {
|
function transactionToPromise(tx: IDBTransaction): Promise<void> {
|
||||||
const stack = Error("Failed transaction was started here.");
|
const stack = Error("Failed transaction was started here.");
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
tx.onabort = () => {
|
tx.onabort = () => {
|
||||||
@ -86,7 +96,7 @@ function transactionToPromise(tx: idbtypes.IDBTransaction): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function applyMutation<T>(
|
function applyMutation<T>(
|
||||||
req: idbtypes.IDBRequest,
|
req: IDBRequest,
|
||||||
f: (x: T) => T | undefined,
|
f: (x: T) => T | undefined,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -96,7 +106,7 @@ function applyMutation<T>(
|
|||||||
const val = cursor.value;
|
const val = cursor.value;
|
||||||
const modVal = f(val);
|
const modVal = f(val);
|
||||||
if (modVal !== undefined && modVal !== null) {
|
if (modVal !== undefined && modVal !== null) {
|
||||||
const req2: idbtypes.IDBRequest = cursor.update(modVal);
|
const req2: IDBRequest = cursor.update(modVal);
|
||||||
req2.onerror = () => {
|
req2.onerror = () => {
|
||||||
reject(req2.error);
|
reject(req2.error);
|
||||||
};
|
};
|
||||||
@ -132,7 +142,7 @@ class ResultStream<T> {
|
|||||||
private gotCursorEnd = false;
|
private gotCursorEnd = false;
|
||||||
private awaitingResult = false;
|
private awaitingResult = false;
|
||||||
|
|
||||||
constructor(private req: idbtypes.IDBRequest) {
|
constructor(private req: IDBRequest) {
|
||||||
this.awaitingResult = true;
|
this.awaitingResult = true;
|
||||||
let p = openPromise<void>();
|
let p = openPromise<void>();
|
||||||
this.currentPromise = p.promise;
|
this.currentPromise = p.promise;
|
||||||
@ -224,7 +234,7 @@ class ResultStream<T> {
|
|||||||
return { hasValue: false };
|
return { hasValue: false };
|
||||||
}
|
}
|
||||||
if (!this.awaitingResult) {
|
if (!this.awaitingResult) {
|
||||||
const cursor: idbtypes.IDBCursor | undefined = this.req.result;
|
const cursor: IDBCursor | undefined = this.req.result;
|
||||||
if (!cursor) {
|
if (!cursor) {
|
||||||
throw Error("assertion failed");
|
throw Error("assertion failed");
|
||||||
}
|
}
|
||||||
@ -244,7 +254,7 @@ class ResultStream<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class TransactionHandle {
|
export class TransactionHandle {
|
||||||
constructor(private tx: idbtypes.IDBTransaction) {}
|
constructor(private tx: IDBTransaction) {}
|
||||||
|
|
||||||
put<T>(store: Store<T>, value: T, key?: any): Promise<any> {
|
put<T>(store: Store<T>, value: T, key?: any): Promise<any> {
|
||||||
const req = this.tx.objectStore(store.name).put(value, key);
|
const req = this.tx.objectStore(store.name).put(value, key);
|
||||||
@ -261,7 +271,7 @@ export class TransactionHandle {
|
|||||||
return requestToPromise(req);
|
return requestToPromise(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
getIndexed<S extends idbtypes.IDBValidKey, T>(
|
getIndexed<S extends IDBValidKey, T>(
|
||||||
index: Index<S, T>,
|
index: Index<S, T>,
|
||||||
key: any,
|
key: any,
|
||||||
): Promise<T | undefined> {
|
): Promise<T | undefined> {
|
||||||
@ -277,7 +287,7 @@ export class TransactionHandle {
|
|||||||
return new ResultStream<T>(req);
|
return new ResultStream<T>(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
iterIndexed<S extends idbtypes.IDBValidKey, T>(
|
iterIndexed<S extends IDBValidKey, T>(
|
||||||
index: Index<S, T>,
|
index: Index<S, T>,
|
||||||
key?: any,
|
key?: any,
|
||||||
): ResultStream<T> {
|
): ResultStream<T> {
|
||||||
@ -304,7 +314,7 @@ export class TransactionHandle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function runWithTransaction<T>(
|
function runWithTransaction<T>(
|
||||||
db: idbtypes.IDBDatabase,
|
db: IDBDatabase,
|
||||||
stores: Store<any>[],
|
stores: Store<any>[],
|
||||||
f: (t: TransactionHandle) => Promise<T>,
|
f: (t: TransactionHandle) => Promise<T>,
|
||||||
mode: "readonly" | "readwrite",
|
mode: "readonly" | "readwrite",
|
||||||
@ -367,7 +377,7 @@ function runWithTransaction<T>(
|
|||||||
/**
|
/**
|
||||||
* Definition of an index.
|
* Definition of an index.
|
||||||
*/
|
*/
|
||||||
export class Index<S extends idbtypes.IDBValidKey, T> {
|
export class Index<S extends IDBValidKey, T> {
|
||||||
/**
|
/**
|
||||||
* Name of the store that this index is associated with.
|
* Name of the store that this index is associated with.
|
||||||
*/
|
*/
|
||||||
@ -404,24 +414,24 @@ export class Index<S extends idbtypes.IDBValidKey, T> {
|
|||||||
* to the taler wallet db.
|
* to the taler wallet db.
|
||||||
*/
|
*/
|
||||||
export function openDatabase(
|
export function openDatabase(
|
||||||
idbFactory: idbtypes.IDBFactory,
|
idbFactory: IDBFactory,
|
||||||
databaseName: string,
|
databaseName: string,
|
||||||
databaseVersion: number,
|
databaseVersion: number,
|
||||||
onVersionChange: () => void,
|
onVersionChange: () => void,
|
||||||
onUpgradeNeeded: (
|
onUpgradeNeeded: (
|
||||||
db: idbtypes.IDBDatabase,
|
db: IDBDatabase,
|
||||||
oldVersion: number,
|
oldVersion: number,
|
||||||
newVersion: number,
|
newVersion: number,
|
||||||
) => void,
|
) => void,
|
||||||
): Promise<idbtypes.IDBDatabase> {
|
): Promise<IDBDatabase> {
|
||||||
return new Promise<idbtypes.IDBDatabase>((resolve, reject) => {
|
return new Promise<IDBDatabase>((resolve, reject) => {
|
||||||
const req = idbFactory.open(databaseName, databaseVersion);
|
const req = idbFactory.open(databaseName, databaseVersion);
|
||||||
req.onerror = (e) => {
|
req.onerror = (e) => {
|
||||||
console.log("taler database error", e);
|
console.log("taler database error", e);
|
||||||
reject(new Error("database error"));
|
reject(new Error("database error"));
|
||||||
};
|
};
|
||||||
req.onsuccess = (e) => {
|
req.onsuccess = (e) => {
|
||||||
req.result.onversionchange = (evt: idbtypes.IDBVersionChangeEvent) => {
|
req.result.onversionchange = (evt: IDBVersionChangeEvent) => {
|
||||||
console.log(
|
console.log(
|
||||||
`handling live db version change from ${evt.oldVersion} to ${evt.newVersion}`,
|
`handling live db version change from ${evt.oldVersion} to ${evt.newVersion}`,
|
||||||
);
|
);
|
||||||
@ -442,9 +452,9 @@ export function openDatabase(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Database {
|
export class Database {
|
||||||
constructor(private db: idbtypes.IDBDatabase) {}
|
constructor(private db: IDBDatabase) {}
|
||||||
|
|
||||||
static deleteDatabase(idbFactory: idbtypes.IDBFactory, dbName: string): void {
|
static deleteDatabase(idbFactory: IDBFactory, dbName: string): void {
|
||||||
idbFactory.deleteDatabase(dbName);
|
idbFactory.deleteDatabase(dbName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,7 +478,7 @@ export class Database {
|
|||||||
dump.stores[name] = storeDump;
|
dump.stores[name] = storeDump;
|
||||||
tx.objectStore(name)
|
tx.objectStore(name)
|
||||||
.openCursor()
|
.openCursor()
|
||||||
.addEventListener("success", (e: idbtypes.Event) => {
|
.addEventListener("success", (e: Event) => {
|
||||||
const cursor = (e.target as any).result;
|
const cursor = (e.target as any).result;
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
storeDump[cursor.key] = cursor.value;
|
storeDump[cursor.key] = cursor.value;
|
||||||
@ -512,7 +522,7 @@ export class Database {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getIndexed<S extends idbtypes.IDBValidKey, T>(
|
async getIndexed<S extends IDBValidKey, T>(
|
||||||
index: Index<S, T>,
|
index: Index<S, T>,
|
||||||
key: any,
|
key: any,
|
||||||
): Promise<T | undefined> {
|
): Promise<T | undefined> {
|
||||||
@ -548,7 +558,7 @@ export class Database {
|
|||||||
return new ResultStream<T>(req);
|
return new ResultStream<T>(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
iterIndex<S extends idbtypes.IDBValidKey, T>(
|
iterIndex<S extends IDBValidKey, T>(
|
||||||
index: Index<S, T>,
|
index: Index<S, T>,
|
||||||
query?: any,
|
query?: any,
|
||||||
): ResultStream<T> {
|
): ResultStream<T> {
|
||||||
|
@ -28,5 +28,5 @@
|
|||||||
"path": "../idb-bridge/"
|
"path": "../idb-bridge/"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"include": ["src/**/*"]
|
"include": ["src/**/*"],
|
||||||
}
|
}
|
||||||
|
104
pnpm-lock.yaml
104
pnpm-lock.yaml
@ -6,6 +6,7 @@ importers:
|
|||||||
'@types/node': 14.0.27
|
'@types/node': 14.0.27
|
||||||
tslib: 2.0.0
|
tslib: 2.0.0
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
'@microsoft/api-extractor': 7.9.3
|
||||||
'@rollup/plugin-typescript': 5.0.2_d508d998c8e6588bf77175f7541372d0
|
'@rollup/plugin-typescript': 5.0.2_d508d998c8e6588bf77175f7541372d0
|
||||||
ava: 3.11.0
|
ava: 3.11.0
|
||||||
esm: 3.2.25
|
esm: 3.2.25
|
||||||
@ -13,6 +14,7 @@ importers:
|
|||||||
rollup: 2.23.0
|
rollup: 2.23.0
|
||||||
typescript: 3.9.7
|
typescript: 3.9.7
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@microsoft/api-extractor': ^7.9.3
|
||||||
'@rollup/plugin-typescript': ^5.0.2
|
'@rollup/plugin-typescript': ^5.0.2
|
||||||
'@types/node': ^14.0.27
|
'@types/node': ^14.0.27
|
||||||
ava: ^3.10.1
|
ava: ^3.10.1
|
||||||
@ -121,6 +123,7 @@ importers:
|
|||||||
tslib: 2.0.0
|
tslib: 2.0.0
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@ava/typescript': 1.1.1
|
'@ava/typescript': 1.1.1
|
||||||
|
'@microsoft/api-extractor': 7.9.3
|
||||||
'@typescript-eslint/eslint-plugin': 3.7.1_98f5354ad0bbc327ab4925c12674a6b1
|
'@typescript-eslint/eslint-plugin': 3.7.1_98f5354ad0bbc327ab4925c12674a6b1
|
||||||
'@typescript-eslint/parser': 3.7.1_eslint@7.6.0+typescript@3.9.7
|
'@typescript-eslint/parser': 3.7.1_eslint@7.6.0+typescript@3.9.7
|
||||||
ava: 3.11.0
|
ava: 3.11.0
|
||||||
@ -147,6 +150,7 @@ importers:
|
|||||||
typescript: 3.9.7
|
typescript: 3.9.7
|
||||||
specifiers:
|
specifiers:
|
||||||
'@ava/typescript': ^1.1.1
|
'@ava/typescript': ^1.1.1
|
||||||
|
'@microsoft/api-extractor': ^7.9.3
|
||||||
'@types/node': ^14.0.27
|
'@types/node': ^14.0.27
|
||||||
'@typescript-eslint/eslint-plugin': ^3.6.1
|
'@typescript-eslint/eslint-plugin': ^3.6.1
|
||||||
'@typescript-eslint/parser': ^3.6.1
|
'@typescript-eslint/parser': ^3.6.1
|
||||||
@ -436,6 +440,33 @@ packages:
|
|||||||
node: '>=8'
|
node: '>=8'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==
|
integrity: sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==
|
||||||
|
/@microsoft/api-extractor-model/7.8.13:
|
||||||
|
dependencies:
|
||||||
|
'@microsoft/tsdoc': 0.12.19
|
||||||
|
'@rushstack/node-core-library': 3.26.1
|
||||||
|
dev: true
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-SspJ84pZEZfF5jcVkwtdmgpnxjwMwJxQkK+v868jF6Ue/rJZ7WV/+qFB76gxLXNPsnVhF/xdS8s4AWXL0ePN8g==
|
||||||
|
/@microsoft/api-extractor/7.9.3:
|
||||||
|
dependencies:
|
||||||
|
'@microsoft/api-extractor-model': 7.8.13
|
||||||
|
'@microsoft/tsdoc': 0.12.19
|
||||||
|
'@rushstack/node-core-library': 3.26.1
|
||||||
|
'@rushstack/ts-command-line': 4.4.6
|
||||||
|
colors: 1.2.5
|
||||||
|
lodash: 4.17.19
|
||||||
|
resolve: 1.17.0
|
||||||
|
semver: 7.3.2
|
||||||
|
source-map: 0.6.1
|
||||||
|
typescript: 3.9.7
|
||||||
|
dev: true
|
||||||
|
hasBin: true
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-8NXXmL+RhkHbL84lyFcjtqm6/IJxcGCckm2bIQFTyRjH4atshvpkuYy/IsTuRSuQ6XHEPa6QNze8IwEhhV5zPA==
|
||||||
|
/@microsoft/tsdoc/0.12.19:
|
||||||
|
dev: true
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-IpgPxHrNxZiMNUSXqR1l/gePKPkfAmIKoDRP9hp7OwjU29ZR8WCJsOJ8iBKgw0Qk+pFwR+8Y1cy8ImLY6e9m4A==
|
||||||
/@nodelib/fs.scandir/2.1.3:
|
/@nodelib/fs.scandir/2.1.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@nodelib/fs.stat': 2.0.3
|
'@nodelib/fs.stat': 2.0.3
|
||||||
@ -542,6 +573,26 @@ packages:
|
|||||||
rollup: ^1.20.0||^2.0.0
|
rollup: ^1.20.0||^2.0.0
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==
|
integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==
|
||||||
|
/@rushstack/node-core-library/3.26.1:
|
||||||
|
dependencies:
|
||||||
|
'@types/node': 10.17.13
|
||||||
|
colors: 1.2.5
|
||||||
|
fs-extra: 7.0.1
|
||||||
|
jju: 1.4.0
|
||||||
|
semver: 7.3.2
|
||||||
|
timsort: 0.3.0
|
||||||
|
z-schema: 3.18.4
|
||||||
|
dev: true
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-N2wewcrJS2Jut73qxi711D1OXVKd9+8YmCllcjxEN++88qqqxCQVnn6Iu9ydu79Frm5rV8p/zvHOLCeUm/mLOQ==
|
||||||
|
/@rushstack/ts-command-line/4.4.6:
|
||||||
|
dependencies:
|
||||||
|
'@types/argparse': 1.0.38
|
||||||
|
argparse: 1.0.10
|
||||||
|
colors: 1.2.5
|
||||||
|
dev: true
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-ue3p2m773Yea/s4Ef2Q3gEyLd9T0NDjXCl+PlodGTrJHgxoiRwbROSWHAdYJL/LceGWa6Biqizu9qxUDEWFweQ==
|
||||||
/@sindresorhus/is/0.14.0:
|
/@sindresorhus/is/0.14.0:
|
||||||
dev: true
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
@ -556,6 +607,10 @@ packages:
|
|||||||
node: '>=6'
|
node: '>=6'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==
|
integrity: sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==
|
||||||
|
/@types/argparse/1.0.38:
|
||||||
|
dev: true
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==
|
||||||
/@types/cheerio/0.22.21:
|
/@types/cheerio/0.22.21:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 14.0.27
|
'@types/node': 14.0.27
|
||||||
@ -631,6 +686,10 @@ packages:
|
|||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
|
integrity: sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
|
||||||
|
/@types/node/10.17.13:
|
||||||
|
dev: true
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg==
|
||||||
/@types/node/11.15.20:
|
/@types/node/11.15.20:
|
||||||
dev: false
|
dev: false
|
||||||
resolution:
|
resolution:
|
||||||
@ -1413,6 +1472,12 @@ packages:
|
|||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||||
|
/colors/1.2.5:
|
||||||
|
dev: true
|
||||||
|
engines:
|
||||||
|
node: '>=0.1.90'
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==
|
||||||
/commander/2.20.3:
|
/commander/2.20.3:
|
||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
@ -2312,6 +2377,16 @@ packages:
|
|||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-Xu2Qh8yqYuDhQGOhD5iJGninErSfI9A3FrriD3tjUgV5VbJFeH8vfgZ9HnC6jWN80QDVNQK5vmxRAmEAp7Mevw==
|
integrity: sha512-Xu2Qh8yqYuDhQGOhD5iJGninErSfI9A3FrriD3tjUgV5VbJFeH8vfgZ9HnC6jWN80QDVNQK5vmxRAmEAp7Mevw==
|
||||||
|
/fs-extra/7.0.1:
|
||||||
|
dependencies:
|
||||||
|
graceful-fs: 4.2.4
|
||||||
|
jsonfile: 4.0.0
|
||||||
|
universalify: 0.1.2
|
||||||
|
dev: true
|
||||||
|
engines:
|
||||||
|
node: '>=6 <7 || >=8'
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==
|
||||||
/fs-extra/8.1.0:
|
/fs-extra/8.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
graceful-fs: 4.2.4
|
graceful-fs: 4.2.4
|
||||||
@ -2962,6 +3037,10 @@ packages:
|
|||||||
node: '>= 10.14.2'
|
node: '>= 10.14.2'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-+XcGMMJDTeEGncRb5M5Zq9P7K4sQ1sirhjdOxsN1462h6lFo9w59bl2LVQmdGEEeU3m+maZCkS2Tcc9SfCHO4A==
|
integrity: sha512-+XcGMMJDTeEGncRb5M5Zq9P7K4sQ1sirhjdOxsN1462h6lFo9w59bl2LVQmdGEEeU3m+maZCkS2Tcc9SfCHO4A==
|
||||||
|
/jju/1.4.0:
|
||||||
|
dev: true
|
||||||
|
resolution:
|
||||||
|
integrity: sha1-o6vicYryQaKykE+EpiWXDzia4yo=
|
||||||
/js-string-escape/1.0.1:
|
/js-string-escape/1.0.1:
|
||||||
dev: true
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
@ -3128,6 +3207,10 @@ packages:
|
|||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=
|
integrity: sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=
|
||||||
|
/lodash.get/4.4.2:
|
||||||
|
dev: true
|
||||||
|
resolution:
|
||||||
|
integrity: sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=
|
||||||
/lodash.isequal/4.5.0:
|
/lodash.isequal/4.5.0:
|
||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
@ -4538,6 +4621,10 @@ packages:
|
|||||||
node: '>=4'
|
node: '>=4'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha1-mcW/VZWJZq9tBtg73zgA3IL67F0=
|
integrity: sha1-mcW/VZWJZq9tBtg73zgA3IL67F0=
|
||||||
|
/timsort/0.3.0:
|
||||||
|
dev: true
|
||||||
|
resolution:
|
||||||
|
integrity: sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=
|
||||||
/to-fast-properties/2.0.0:
|
/to-fast-properties/2.0.0:
|
||||||
dev: true
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
@ -4755,6 +4842,12 @@ packages:
|
|||||||
dev: true
|
dev: true
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==
|
integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==
|
||||||
|
/validator/8.2.0:
|
||||||
|
dev: true
|
||||||
|
engines:
|
||||||
|
node: '>= 0.10'
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-Yw5wW34fSv5spzTXNkokD6S6/Oq92d8q/t14TqsS3fAiA1RYnxSFSIZ+CY3n6PGGRCq5HhJTSepQvFUS2QUDxA==
|
||||||
/wcwidth/1.0.1:
|
/wcwidth/1.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
defaults: 1.0.3
|
defaults: 1.0.3
|
||||||
@ -4872,3 +4965,14 @@ packages:
|
|||||||
node: '>=6'
|
node: '>=6'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==
|
integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==
|
||||||
|
/z-schema/3.18.4:
|
||||||
|
dependencies:
|
||||||
|
lodash.get: 4.4.2
|
||||||
|
lodash.isequal: 4.5.0
|
||||||
|
validator: 8.2.0
|
||||||
|
dev: true
|
||||||
|
hasBin: true
|
||||||
|
optionalDependencies:
|
||||||
|
commander: 2.20.3
|
||||||
|
resolution:
|
||||||
|
integrity: sha512-DUOKC/IhbkdLKKiV89gw9DUauTV8U/8yJl1sjf6MtDmzevLKOF2duNJ495S3MFVjqZarr+qNGCPbkg4mu4PpLw==
|
||||||
|
Loading…
Reference in New Issue
Block a user