ngx-indexed-db 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +410 -0
- package/bundles/ngx-indexed-db.umd.js +970 -0
- package/bundles/ngx-indexed-db.umd.js.map +1 -0
- package/esm2015/lib/ngx-indexed-db.js +53 -0
- package/esm2015/lib/ngx-indexed-db.meta.js +8 -0
- package/esm2015/lib/ngx-indexed-db.service.js +513 -0
- package/esm2015/lib/ngxindexeddb.module.js +19 -0
- package/esm2015/ngx-indexed-db.js +5 -0
- package/esm2015/public-api.js +4 -0
- package/esm2015/utils/index.js +30 -0
- package/fesm2015/ngx-indexed-db.js +622 -0
- package/fesm2015/ngx-indexed-db.js.map +1 -0
- package/lib/ngx-indexed-db.d.ts +5 -0
- package/lib/ngx-indexed-db.meta.d.ts +42 -0
- package/lib/ngx-indexed-db.service.d.ts +139 -0
- package/lib/ngxindexeddb.module.d.ts +5 -0
- package/ngx-indexed-db.d.ts +4 -0
- package/ngx-indexed-db.metadata.json +1 -0
- package/package.json +38 -0
- package/public-api.d.ts +3 -0
- package/utils/index.d.ts +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-indexed-db.js","sources":["../../../projects/ngx-indexed-db/src/lib/ngx-indexed-db.ts","../../../projects/ngx-indexed-db/src/utils/index.ts","../../../projects/ngx-indexed-db/src/lib/ngx-indexed-db.meta.ts","../../../projects/ngx-indexed-db/src/lib/ngx-indexed-db.service.ts","../../../projects/ngx-indexed-db/src/lib/ngxindexeddb.module.ts","../../../projects/ngx-indexed-db/src/ngx-indexed-db.ts"],"sourcesContent":["import { ObjectStoreMeta, ObjectStoreSchema } from './ngx-indexed-db.meta';\n\nexport function openDatabase(\n indexedDB: IDBFactory,\n dbName: string,\n version?: number,\n upgradeCallback?: (a: Event, b: IDBDatabase) => void\n): Promise<IDBDatabase> {\n return new Promise<IDBDatabase>((resolve, reject) => {\n if (!indexedDB) {\n reject('IndexedDB not available');\n }\n const request = indexedDB.open(dbName, version);\n let db: IDBDatabase;\n request.onsuccess = (event: Event) => {\n db = request.result;\n resolve(db);\n };\n request.onerror = (event: Event) => {\n reject(`IndexedDB error: ${request.error}`);\n };\n if (typeof upgradeCallback === 'function') {\n request.onupgradeneeded = (event: Event) => {\n upgradeCallback(event, db);\n };\n }\n });\n}\n\nexport function CreateObjectStore(\n indexedDB: IDBFactory,\n dbName: string,\n version: number,\n storeSchemas: ObjectStoreMeta[],\n migrationFactory?: () => { [key: number]: (db: IDBDatabase, transaction: IDBTransaction) => void }\n): void {\n if (!indexedDB) {\n return;\n }\n const request: IDBOpenDBRequest = indexedDB.open(dbName, version);\n\n request.onupgradeneeded = (event: IDBVersionChangeEvent) => {\n const database: IDBDatabase = (event.target as any).result;\n\n storeSchemas.forEach((storeSchema: ObjectStoreMeta) => {\n if (!database.objectStoreNames.contains(storeSchema.store)) {\n const objectStore = database.createObjectStore(storeSchema.store, storeSchema.storeConfig);\n storeSchema.storeSchema.forEach((schema: ObjectStoreSchema) => {\n objectStore.createIndex(schema.name, schema.keypath, schema.options);\n });\n }\n });\n\n const storeMigrations = migrationFactory && migrationFactory();\n if (storeMigrations) {\n Object.keys(storeMigrations)\n .map((k) => parseInt(k, 10))\n .filter((v) => v > event.oldVersion)\n .sort((a, b) => a - b)\n .forEach((v) => {\n storeMigrations[v](database, request.transaction);\n });\n }\n\n database.close();\n };\n\n request.onsuccess = (e: any) => {\n e.target.result.close();\n };\n}\n","export interface Options {\n storeName: string;\n dbMode: IDBTransactionMode;\n error: (e: Event) => any;\n complete?: (e: Event) => any;\n abort?: any;\n}\n\nexport function validateStoreName(db: IDBDatabase, storeName: string): boolean {\n return db.objectStoreNames.contains(storeName);\n}\n\nexport function validateBeforeTransaction(db: IDBDatabase, storeName: string, reject: (message: string) => void): void {\n if (!db) {\n reject('You need to use the openDatabase function to create a database before you query it!');\n }\n if (!validateStoreName(db, storeName)) {\n reject(`objectStore does not exists: ${storeName}`);\n }\n}\n\nexport function createTransaction(db: IDBDatabase, options: Options): IDBTransaction {\n const trans: IDBTransaction = db.transaction(options.storeName, options.dbMode);\n trans.onerror = options.error;\n trans.onabort = options.abort;\n return trans;\n}\n\nexport function optionsGenerator(\n type: any,\n storeName: any,\n reject: (reason?: any) => void,\n resolve?: (e: any) => void\n): Options {\n return {\n storeName,\n dbMode: type,\n error: (e: Event) => {\n reject(e);\n },\n abort: (e: Event) => {\n reject(e);\n },\n };\n}\n","import { InjectionToken } from '@angular/core';\n\nexport interface DBConfig {\n name: string;\n version: number;\n objectStoresMeta: ObjectStoreMeta[];\n migrationFactory?: () => { [key: number]: (db: IDBDatabase, transaction: IDBTransaction) => void };\n}\n\nexport interface ObjectStoreMeta {\n store: string;\n storeConfig: { keyPath: string | string[]; autoIncrement: boolean; [key: string]: any };\n storeSchema: ObjectStoreSchema[];\n}\n\nexport interface ObjectStoreSchema {\n name: string;\n keypath: string | string[];\n options: { unique: boolean; [key: string]: any };\n}\n\nexport interface IndexDetails {\n indexName: string;\n order: string;\n}\n\nexport interface RequestEvent<T> extends Event {\n target: RequestEventTarget<T>;\n}\n\nexport interface RequestEventTarget<T> extends EventTarget {\n result: T | T[];\n}\n\nexport enum DBMode {\n readonly = 'readonly',\n readwrite = 'readwrite',\n}\n\nexport type Key = string | number | Date | ArrayBufferView | ArrayBuffer | IDBArrayKey | IDBKeyRange;\n\nexport const CONFIG_TOKEN = new InjectionToken<DBConfig>(null);\n","import { Injectable, Inject, PLATFORM_ID } from '@angular/core';\nimport { openDatabase, CreateObjectStore } from './ngx-indexed-db';\nimport { createTransaction, optionsGenerator, validateBeforeTransaction } from '../utils';\nimport { CONFIG_TOKEN, DBConfig, Key, RequestEvent, ObjectStoreMeta, DBMode } from './ngx-indexed-db.meta';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Observable, Subject, forkJoin, combineLatest, from } from 'rxjs';\nimport { take } from 'rxjs/operators';\n\n@Injectable()\nexport class NgxIndexedDBService {\n private readonly isBrowser: boolean;\n private indexedDB: IDBFactory;\n\n constructor(@Inject(CONFIG_TOKEN) private dbConfig: DBConfig, @Inject(PLATFORM_ID) private platformId: any) {\n if (!dbConfig.name) {\n throw new Error('NgxIndexedDB: Please, provide the dbName in the configuration');\n }\n if (!dbConfig.version) {\n throw new Error('NgxIndexedDB: Please, provide the db version in the configuration');\n }\n this.isBrowser = isPlatformBrowser(this.platformId);\n if (this.isBrowser) {\n this.indexedDB =\n window.indexedDB ||\n (window as any).mozIndexedDB ||\n (window as any).webkitIndexedDB ||\n (window as any).msIndexedDB;\n\n CreateObjectStore(\n this.indexedDB,\n dbConfig.name,\n dbConfig.version,\n dbConfig.objectStoresMeta,\n dbConfig.migrationFactory\n );\n\n openDatabase(this.indexedDB, dbConfig.name).then((db) => {\n if (db.version !== dbConfig.version) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`\n Your DB Config doesn't match the most recent version of the DB with name ${this.dbConfig.name}, please update it\n DB current version: ${db.version};\n Your configuration: ${dbConfig.version};\n `);\n console.warn(`Using latest version ${db.version}`);\n }\n this.dbConfig.version = db.version;\n }\n });\n }\n }\n\n /**\n * Allows to crate a new object store ad-hoc\n * @param storeName The name of the store to be created\n * @param migrationFactory The migration factory if exists\n */\n createObjectStore(\n storeSchema: ObjectStoreMeta,\n migrationFactory?: () => { [key: number]: (db: IDBDatabase, transaction: IDBTransaction) => void }\n ): void {\n const storeSchemas: ObjectStoreMeta[] = [storeSchema];\n CreateObjectStore(this.indexedDB, this.dbConfig.name, ++this.dbConfig.version, storeSchemas, migrationFactory);\n }\n\n /**\n * Adds new entry in the store and returns its key\n * @param storeName The name of the store to add the item\n * @param value The entry to be added\n * @param key The optional key for the entry\n */\n add<T>(storeName: string, value: T, key?: any): Observable<T> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db: IDBDatabase) => {\n const transaction = createTransaction(db, optionsGenerator(DBMode.readwrite, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n const request: IDBRequest<IDBValidKey> = Boolean(key) ? objectStore.add(value, key) : objectStore.add(value);\n\n request.onsuccess = async (evt: Event) => {\n const result: any = (evt.target as IDBOpenDBRequest).result;\n const getRequest: IDBRequest = objectStore.get(result) as IDBRequest<T>;\n getRequest.onsuccess = (event: Event) => {\n obs.next((event.target as IDBRequest<T>).result);\n obs.complete();\n };\n };\n })\n .catch((error) => obs.error(error));\n });\n }\n\n /**\n * Adds new entries in the store and returns its key\n * @param storeName The name of the store to add the item\n * @param values The entries to be added containing optional key attribute\n */\n bulkAdd<T>(storeName: string, values: T & { key?: any }[]): Observable<number[]> {\n const promises = values.map((value) => {\n return new Promise<number>((resolve, reject) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db: IDBDatabase) => {\n const transaction = createTransaction(db, optionsGenerator(DBMode.readwrite, storeName, reject, resolve));\n const objectStore = transaction.objectStore(storeName);\n\n const key = value.key;\n delete value.key;\n\n const request: IDBRequest<IDBValidKey> = Boolean(key)\n ? objectStore.add(value, key)\n : objectStore.add(value);\n\n request.onsuccess = (evt: Event) => {\n const result = (evt.target as IDBOpenDBRequest).result;\n resolve((result as unknown) as number);\n };\n })\n .catch((reason) => reject(reason));\n });\n });\n return forkJoin(promises);\n }\n\n /**\n * Delete entries in the store and returns current entries in the store\n * @param storeName The name of the store to add the item\n * @param keys The keys to be deleted\n */\n bulkDelete(storeName: string, keys: Key[]): Observable<number[]> {\n const promises = keys.map((key) => {\n return new Promise<number>((resolve, reject) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db: IDBDatabase) => {\n const transaction = createTransaction(db, optionsGenerator(DBMode.readwrite, storeName, reject, resolve));\n const objectStore = transaction.objectStore(storeName);\n objectStore.delete(key);\n\n transaction.oncomplete = () => {\n this.getAll(storeName)\n .pipe(take(1))\n .subscribe((newValues) => {\n resolve(newValues as any);\n });\n };\n })\n .catch((reason) => reject(reason));\n });\n });\n return from(Promise.all(promises));\n }\n\n /**\n * Returns entry by key.\n * @param storeName The name of the store to query\n * @param key The entry key\n */\n getByKey<T>(storeName: string, key: IDBValidKey): Observable<T> {\n return new Observable<T>((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db: IDBDatabase) => {\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n const request = objectStore.get(key) as IDBRequest<T>;\n request.onsuccess = (event: Event) => {\n obs.next((event.target as IDBRequest<T>).result);\n obs.complete();\n };\n request.onerror = (event: Event) => {\n obs.error(event);\n };\n })\n .catch((error) => obs.error(error));\n });\n }\n\n /**\n * Retrieve multiple entries in the store\n * @param storeName The name of the store to retrieve the items\n * @param keys The ids entries to be retrieve\n */\n bulkGet<T>(storeName: string, keys: Array<IDBValidKey>): any {\n const observables = keys.map((key) => this.getByKey(storeName, key));\n\n return new Observable((obs) => {\n combineLatest(observables).subscribe((values) => {\n obs.next(values);\n obs.complete();\n });\n });\n }\n\n /**\n * Returns entry by id.\n * @param storeName The name of the store to query\n * @param id The entry id\n */\n getByID<T>(storeName: string, id: string | number): Observable<T> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db: IDBDatabase) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, obs.error, obs.next));\n const objectStore = transaction.objectStore(storeName);\n const request: IDBRequest = objectStore.get(id) as IDBRequest<T>;\n request.onsuccess = (event: Event) => {\n obs.next((event.target as IDBRequest<T>).result);\n };\n })\n .catch((error) => obs.error(error));\n });\n }\n\n /**\n * Returns entry by index.\n * @param storeName The name of the store to query\n * @param indexName The index name to filter\n * @param key The entry key.\n */\n getByIndex<T>(storeName: string, indexName: string, key: IDBValidKey): Observable<T> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n const index = objectStore.index(indexName);\n const request = index.get(key) as IDBRequest<T>;\n request.onsuccess = (event: Event) => {\n obs.next((event.target as IDBRequest<T>).result);\n obs.complete();\n };\n })\n .catch((reason) => obs.error(reason));\n });\n }\n\n /**\n * Return all elements from one store\n * @param storeName The name of the store to select the items\n */\n getAll<T>(storeName: string): Observable<T[]> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, obs.error, obs.next));\n const objectStore = transaction.objectStore(storeName);\n\n const request: IDBRequest = objectStore.getAll();\n\n request.onerror = (evt: Event) => {\n obs.error(evt);\n };\n\n request.onsuccess = ({ target: { result: ResultAll } }: RequestEvent<T>) => {\n obs.next(ResultAll as T[]);\n obs.complete();\n };\n })\n .catch((error) => obs.error(error));\n });\n }\n\n /**\n * Returns all items from the store after update.\n * @param storeName The name of the store to update\n * @param value The new value for the entry\n * @param key The key of the entry to update if exists\n */\n update<T>(storeName: string, value: T, key?: any): Observable<T[]> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readwrite, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n\n transaction.oncomplete = () => {\n this.getAll(storeName)\n .pipe(take(1))\n .subscribe((newValues) => {\n obs.next(newValues as T[]);\n obs.complete();\n });\n };\n\n key ? objectStore.put(value, key) : objectStore.put(value);\n })\n .catch((reason) => obs.error(reason));\n });\n }\n\n /**\n * Returns the item you updated from the store after the update.\n * @param storeName The name of the store to update\n * @param value The new value for the entry\n * @param key The key of the entry to update\n */\n updateByKey<T>(storeName: string, value: T, key: IDBValidKey): Observable<T> {\n return new Observable<T>((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readwrite, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n\n transaction.oncomplete = () => {\n const request = objectStore.get(key) as IDBRequest<T>;\n request.onsuccess = (event: Event) => {\n obs.next((event.target as IDBRequest<T>).result);\n };\n request.onerror = (event: Event) => {\n obs.error(event);\n };\n };\n\n objectStore.put(value, key);\n })\n .catch((reason) => obs.error(reason));\n });\n }\n\n /**\n * Returns all items from the store after delete.\n * @param storeName The name of the store to have the entry deleted\n * @param key The key of the entry to be deleted\n */\n delete<T>(storeName: string, key: Key): Observable<T[]> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readwrite, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n objectStore.delete(key);\n\n transaction.oncomplete = () => {\n this.getAll(storeName)\n .pipe(take(1))\n .subscribe((newValues) => {\n obs.next(newValues as T[]);\n obs.complete();\n });\n };\n })\n .catch((reason) => obs.error(reason));\n });\n }\n\n /**\n * Returns true from the store after a successful delete.\n * @param storeName The name of the store to have the entry deleted\n * @param key The key of the entry to be deleted\n */\n deleteByKey(storeName: string, key: Key): Observable<boolean> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readwrite, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n\n transaction.oncomplete = () => {\n obs.next(true);\n obs.complete();\n };\n\n objectStore.delete(key);\n })\n .catch((reason) => obs.error(reason));\n });\n }\n\n /**\n * Returns true if successfully delete all entries from the store.\n * @param storeName The name of the store to have the entries deleted\n */\n clear(storeName: string): Observable<boolean> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readwrite, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n objectStore.clear();\n transaction.oncomplete = () => {\n obs.next(true);\n obs.complete();\n };\n })\n .catch((reason) => obs.error(reason));\n });\n }\n\n /**\n * Returns true if successfully delete the DB.\n */\n deleteDatabase(): Observable<boolean> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then(async (db) => {\n await db.close();\n const deleteDBRequest = this.indexedDB.deleteDatabase(this.dbConfig.name);\n deleteDBRequest.onsuccess = () => {\n obs.next(true);\n obs.complete();\n };\n deleteDBRequest.onerror = (error) => obs.error(error);\n deleteDBRequest.onblocked = () => {\n throw new Error(`Unable to delete database because it's blocked`);\n };\n })\n .catch((error) => obs.error(error));\n });\n }\n\n /**\n * Returns the open cursor event\n * @param storeName The name of the store to have the entries deleted\n * @param keyRange The key range which the cursor should be open on\n */\n openCursor(storeName: string, keyRange?: IDBKeyRange): Observable<Event> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n const request = keyRange === undefined ? objectStore.openCursor() : objectStore.openCursor(keyRange);\n\n request.onsuccess = (event: Event) => {\n obs.next(event);\n obs.complete();\n };\n })\n .catch((reason) => obs.error(reason));\n });\n }\n\n /**\n * Open a cursor by index filter.\n * @param storeName The name of the store to query.\n * @param indexName The index name to filter.\n * @param keyRange The range value and criteria to apply on the index.\n */\n openCursorByIndex(\n storeName: string,\n indexName: string,\n keyRange: IDBKeyRange,\n mode: DBMode = DBMode.readonly\n ): Observable<Event> {\n const obs = new Subject<Event>();\n\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, (reason) => {\n obs.error(reason);\n });\n const transaction = createTransaction(\n db,\n optionsGenerator(\n mode,\n storeName,\n (reason) => {\n obs.error(reason);\n },\n () => {\n obs.next();\n }\n )\n );\n const objectStore = transaction.objectStore(storeName);\n const index = objectStore.index(indexName);\n const request = index.openCursor(keyRange);\n\n request.onsuccess = (event: Event) => {\n obs.next(event);\n };\n })\n .catch((reason) => obs.error(reason));\n\n return obs;\n }\n\n /**\n * Returns all items by an index.\n * @param storeName The name of the store to query\n * @param indexName The index name to filter\n * @param keyRange The range value and criteria to apply on the index.\n */\n getAllByIndex<T>(storeName: string, indexName: string, keyRange: IDBKeyRange): Observable<T[]> {\n const data: T[] = [];\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n const index = objectStore.index(indexName);\n const request = index.openCursor(keyRange);\n request.onsuccess = (event) => {\n const cursor: IDBCursorWithValue = (event.target as IDBRequest<IDBCursorWithValue>).result;\n if (cursor) {\n data.push(cursor.value);\n cursor.continue();\n } else {\n obs.next(data);\n obs.complete();\n }\n };\n })\n .catch((reason) => obs.error(reason));\n });\n }\n\n /**\n * Returns all primary keys by an index.\n * @param storeName The name of the store to query\n * @param indexName The index name to filter\n * @param keyRange The range value and criteria to apply on the index.\n */\n getAllKeysByIndex(\n storeName: string,\n indexName: string,\n keyRange: IDBKeyRange\n ): Observable<{ primaryKey: any; key: any }[]> {\n const data: { primaryKey: any; key: any }[] = [];\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n const index = objectStore.index(indexName);\n const request = index.openKeyCursor(keyRange);\n request.onsuccess = (event) => {\n const cursor: IDBCursor = (event.target as IDBRequest<IDBCursor>).result;\n if (cursor) {\n data.push({ primaryKey: cursor.primaryKey, key: cursor.key });\n cursor.continue();\n } else {\n obs.next(data);\n obs.complete();\n }\n };\n })\n .catch((reason) => obs.error(reason));\n });\n }\n\n /**\n * Returns the number of rows in a store.\n * @param storeName The name of the store to query\n * @param keyRange The range value and criteria to apply.\n */\n count(storeName: string, keyRange?: IDBValidKey | IDBKeyRange): Observable<number> {\n return new Observable((obs) => {\n openDatabase(this.indexedDB, this.dbConfig.name, this.dbConfig.version)\n .then((db) => {\n validateBeforeTransaction(db, storeName, obs.error);\n const transaction = createTransaction(db, optionsGenerator(DBMode.readonly, storeName, obs.error));\n const objectStore = transaction.objectStore(storeName);\n const request: IDBRequest = objectStore.count(keyRange);\n request.onerror = (e) => obs.error(e);\n request.onsuccess = (e) => {\n obs.next(((e.target as IDBOpenDBRequest).result as unknown) as number);\n obs.complete();\n };\n })\n .catch((reason) => obs.error(reason));\n });\n }\n}\n","import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { NgxIndexedDBService } from './ngx-indexed-db.service';\nimport { DBConfig, CONFIG_TOKEN } from './ngx-indexed-db.meta';\n\n@NgModule({\n declarations: [],\n imports: [CommonModule]\n})\nexport class NgxIndexedDBModule {\n static forRoot(dbConfig: DBConfig): ModuleWithProviders<NgxIndexedDBModule> {\n return {\n ngModule: NgxIndexedDBModule,\n providers: [NgxIndexedDBService, { provide: CONFIG_TOKEN, useValue: dbConfig }]\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;SAEgB,YAAY,CAC1B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,GAAG,CAAC,KAAK,CAAC,CAAC;gBACpD,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;gBACnG,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;gBACvD,MAAM,OAAO,GAAe,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;gBACxD,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACtC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC;oBACpB,GAAG,CAAC,IAAI,CAAG,CAAC,CAAC,MAA2B,CAAC,MAA4B,CAAC,CAAC;oBACvE,GAAG,CAAC,QAAQ,EAAE,CAAC;iBAChB,CAAC;aACH,CAAC;iBACD,KAAK,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;SACzC,CAAC,CAAC;KACJ;;;YAnjBF,UAAU;;;4CAKI,MAAM,SAAC,YAAY;4CAA+B,MAAM,SAAC,WAAW;;;MCJtE,kBAAkB;IAC7B,OAAO,OAAO,CAAC,QAAkB;QAC/B,OAAO;YACL,QAAQ,EAAE,kBAAkB;YAC5B,SAAS,EAAE,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;SAChF,CAAC;KACH;;;YAVF,QAAQ,SAAC;gBACR,YAAY,EAAE,EAAE;gBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;aACxB;;;ACRD;;;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ObjectStoreMeta } from './ngx-indexed-db.meta';
|
|
2
|
+
export declare function openDatabase(indexedDB: IDBFactory, dbName: string, version?: number, upgradeCallback?: (a: Event, b: IDBDatabase) => void): Promise<IDBDatabase>;
|
|
3
|
+
export declare function CreateObjectStore(indexedDB: IDBFactory, dbName: string, version: number, storeSchemas: ObjectStoreMeta[], migrationFactory?: () => {
|
|
4
|
+
[key: number]: (db: IDBDatabase, transaction: IDBTransaction) => void;
|
|
5
|
+
}): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
export interface DBConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
version: number;
|
|
5
|
+
objectStoresMeta: ObjectStoreMeta[];
|
|
6
|
+
migrationFactory?: () => {
|
|
7
|
+
[key: number]: (db: IDBDatabase, transaction: IDBTransaction) => void;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface ObjectStoreMeta {
|
|
11
|
+
store: string;
|
|
12
|
+
storeConfig: {
|
|
13
|
+
keyPath: string | string[];
|
|
14
|
+
autoIncrement: boolean;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
storeSchema: ObjectStoreSchema[];
|
|
18
|
+
}
|
|
19
|
+
export interface ObjectStoreSchema {
|
|
20
|
+
name: string;
|
|
21
|
+
keypath: string | string[];
|
|
22
|
+
options: {
|
|
23
|
+
unique: boolean;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface IndexDetails {
|
|
28
|
+
indexName: string;
|
|
29
|
+
order: string;
|
|
30
|
+
}
|
|
31
|
+
export interface RequestEvent<T> extends Event {
|
|
32
|
+
target: RequestEventTarget<T>;
|
|
33
|
+
}
|
|
34
|
+
export interface RequestEventTarget<T> extends EventTarget {
|
|
35
|
+
result: T | T[];
|
|
36
|
+
}
|
|
37
|
+
export declare enum DBMode {
|
|
38
|
+
readonly = "readonly",
|
|
39
|
+
readwrite = "readwrite"
|
|
40
|
+
}
|
|
41
|
+
export declare type Key = string | number | Date | ArrayBufferView | ArrayBuffer | IDBArrayKey | IDBKeyRange;
|
|
42
|
+
export declare const CONFIG_TOKEN: InjectionToken<DBConfig>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { DBConfig, Key, ObjectStoreMeta, DBMode } from './ngx-indexed-db.meta';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
export declare class NgxIndexedDBService {
|
|
4
|
+
private dbConfig;
|
|
5
|
+
private platformId;
|
|
6
|
+
private readonly isBrowser;
|
|
7
|
+
private indexedDB;
|
|
8
|
+
constructor(dbConfig: DBConfig, platformId: any);
|
|
9
|
+
/**
|
|
10
|
+
* Allows to crate a new object store ad-hoc
|
|
11
|
+
* @param storeName The name of the store to be created
|
|
12
|
+
* @param migrationFactory The migration factory if exists
|
|
13
|
+
*/
|
|
14
|
+
createObjectStore(storeSchema: ObjectStoreMeta, migrationFactory?: () => {
|
|
15
|
+
[key: number]: (db: IDBDatabase, transaction: IDBTransaction) => void;
|
|
16
|
+
}): void;
|
|
17
|
+
/**
|
|
18
|
+
* Adds new entry in the store and returns its key
|
|
19
|
+
* @param storeName The name of the store to add the item
|
|
20
|
+
* @param value The entry to be added
|
|
21
|
+
* @param key The optional key for the entry
|
|
22
|
+
*/
|
|
23
|
+
add<T>(storeName: string, value: T, key?: any): Observable<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Adds new entries in the store and returns its key
|
|
26
|
+
* @param storeName The name of the store to add the item
|
|
27
|
+
* @param values The entries to be added containing optional key attribute
|
|
28
|
+
*/
|
|
29
|
+
bulkAdd<T>(storeName: string, values: T & {
|
|
30
|
+
key?: any;
|
|
31
|
+
}[]): Observable<number[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete entries in the store and returns current entries in the store
|
|
34
|
+
* @param storeName The name of the store to add the item
|
|
35
|
+
* @param keys The keys to be deleted
|
|
36
|
+
*/
|
|
37
|
+
bulkDelete(storeName: string, keys: Key[]): Observable<number[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Returns entry by key.
|
|
40
|
+
* @param storeName The name of the store to query
|
|
41
|
+
* @param key The entry key
|
|
42
|
+
*/
|
|
43
|
+
getByKey<T>(storeName: string, key: IDBValidKey): Observable<T>;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieve multiple entries in the store
|
|
46
|
+
* @param storeName The name of the store to retrieve the items
|
|
47
|
+
* @param keys The ids entries to be retrieve
|
|
48
|
+
*/
|
|
49
|
+
bulkGet<T>(storeName: string, keys: Array<IDBValidKey>): any;
|
|
50
|
+
/**
|
|
51
|
+
* Returns entry by id.
|
|
52
|
+
* @param storeName The name of the store to query
|
|
53
|
+
* @param id The entry id
|
|
54
|
+
*/
|
|
55
|
+
getByID<T>(storeName: string, id: string | number): Observable<T>;
|
|
56
|
+
/**
|
|
57
|
+
* Returns entry by index.
|
|
58
|
+
* @param storeName The name of the store to query
|
|
59
|
+
* @param indexName The index name to filter
|
|
60
|
+
* @param key The entry key.
|
|
61
|
+
*/
|
|
62
|
+
getByIndex<T>(storeName: string, indexName: string, key: IDBValidKey): Observable<T>;
|
|
63
|
+
/**
|
|
64
|
+
* Return all elements from one store
|
|
65
|
+
* @param storeName The name of the store to select the items
|
|
66
|
+
*/
|
|
67
|
+
getAll<T>(storeName: string): Observable<T[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Returns all items from the store after update.
|
|
70
|
+
* @param storeName The name of the store to update
|
|
71
|
+
* @param value The new value for the entry
|
|
72
|
+
* @param key The key of the entry to update if exists
|
|
73
|
+
*/
|
|
74
|
+
update<T>(storeName: string, value: T, key?: any): Observable<T[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the item you updated from the store after the update.
|
|
77
|
+
* @param storeName The name of the store to update
|
|
78
|
+
* @param value The new value for the entry
|
|
79
|
+
* @param key The key of the entry to update
|
|
80
|
+
*/
|
|
81
|
+
updateByKey<T>(storeName: string, value: T, key: IDBValidKey): Observable<T>;
|
|
82
|
+
/**
|
|
83
|
+
* Returns all items from the store after delete.
|
|
84
|
+
* @param storeName The name of the store to have the entry deleted
|
|
85
|
+
* @param key The key of the entry to be deleted
|
|
86
|
+
*/
|
|
87
|
+
delete<T>(storeName: string, key: Key): Observable<T[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Returns true from the store after a successful delete.
|
|
90
|
+
* @param storeName The name of the store to have the entry deleted
|
|
91
|
+
* @param key The key of the entry to be deleted
|
|
92
|
+
*/
|
|
93
|
+
deleteByKey(storeName: string, key: Key): Observable<boolean>;
|
|
94
|
+
/**
|
|
95
|
+
* Returns true if successfully delete all entries from the store.
|
|
96
|
+
* @param storeName The name of the store to have the entries deleted
|
|
97
|
+
*/
|
|
98
|
+
clear(storeName: string): Observable<boolean>;
|
|
99
|
+
/**
|
|
100
|
+
* Returns true if successfully delete the DB.
|
|
101
|
+
*/
|
|
102
|
+
deleteDatabase(): Observable<boolean>;
|
|
103
|
+
/**
|
|
104
|
+
* Returns the open cursor event
|
|
105
|
+
* @param storeName The name of the store to have the entries deleted
|
|
106
|
+
* @param keyRange The key range which the cursor should be open on
|
|
107
|
+
*/
|
|
108
|
+
openCursor(storeName: string, keyRange?: IDBKeyRange): Observable<Event>;
|
|
109
|
+
/**
|
|
110
|
+
* Open a cursor by index filter.
|
|
111
|
+
* @param storeName The name of the store to query.
|
|
112
|
+
* @param indexName The index name to filter.
|
|
113
|
+
* @param keyRange The range value and criteria to apply on the index.
|
|
114
|
+
*/
|
|
115
|
+
openCursorByIndex(storeName: string, indexName: string, keyRange: IDBKeyRange, mode?: DBMode): Observable<Event>;
|
|
116
|
+
/**
|
|
117
|
+
* Returns all items by an index.
|
|
118
|
+
* @param storeName The name of the store to query
|
|
119
|
+
* @param indexName The index name to filter
|
|
120
|
+
* @param keyRange The range value and criteria to apply on the index.
|
|
121
|
+
*/
|
|
122
|
+
getAllByIndex<T>(storeName: string, indexName: string, keyRange: IDBKeyRange): Observable<T[]>;
|
|
123
|
+
/**
|
|
124
|
+
* Returns all primary keys by an index.
|
|
125
|
+
* @param storeName The name of the store to query
|
|
126
|
+
* @param indexName The index name to filter
|
|
127
|
+
* @param keyRange The range value and criteria to apply on the index.
|
|
128
|
+
*/
|
|
129
|
+
getAllKeysByIndex(storeName: string, indexName: string, keyRange: IDBKeyRange): Observable<{
|
|
130
|
+
primaryKey: any;
|
|
131
|
+
key: any;
|
|
132
|
+
}[]>;
|
|
133
|
+
/**
|
|
134
|
+
* Returns the number of rows in a store.
|
|
135
|
+
* @param storeName The name of the store to query
|
|
136
|
+
* @param keyRange The range value and criteria to apply.
|
|
137
|
+
*/
|
|
138
|
+
count(storeName: string, keyRange?: IDBValidKey | IDBKeyRange): Observable<number>;
|
|
139
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"NgxIndexedDBModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":5,"character":1},"arguments":[{"declarations":[],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":7,"character":12}]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["dbConfig"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxIndexedDBModule"},"providers":[{"__symbolic":"reference","name":"NgxIndexedDBService"},{"provide":{"__symbolic":"reference","name":"CONFIG_TOKEN"},"useValue":{"__symbolic":"reference","name":"dbConfig"}}]}}}},"NgxIndexedDBService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":13,"character":15},"arguments":[{"__symbolic":"reference","name":"CONFIG_TOKEN"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":13,"character":65},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":13,"character":72}]}]],"parameters":[{"__symbolic":"reference","name":"DBConfig"},{"__symbolic":"reference","name":"any"}]}],"createObjectStore":[{"__symbolic":"method"}],"add":[{"__symbolic":"method"}],"bulkAdd":[{"__symbolic":"method"}],"bulkDelete":[{"__symbolic":"method"}],"getByKey":[{"__symbolic":"method"}],"bulkGet":[{"__symbolic":"method"}],"getByID":[{"__symbolic":"method"}],"getByIndex":[{"__symbolic":"method"}],"getAll":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"updateByKey":[{"__symbolic":"method"}],"delete":[{"__symbolic":"method"}],"deleteByKey":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"deleteDatabase":[{"__symbolic":"method"}],"openCursor":[{"__symbolic":"method"}],"openCursorByIndex":[{"__symbolic":"method"}],"getAllByIndex":[{"__symbolic":"method"}],"getAllKeysByIndex":[{"__symbolic":"method"}],"count":[{"__symbolic":"method"}]}},"DBConfig":{"__symbolic":"interface"},"ObjectStoreMeta":{"__symbolic":"interface"},"ObjectStoreSchema":{"__symbolic":"interface"},"IndexDetails":{"__symbolic":"interface"},"RequestEvent":{"__symbolic":"interface"},"RequestEventTarget":{"__symbolic":"interface"},"DBMode":{"readonly":"readonly","readwrite":"readwrite"},"Key":{"__symbolic":"interface"},"CONFIG_TOKEN":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":41,"character":32},"arguments":[null]}},"origins":{"NgxIndexedDBModule":"./lib/ngxindexeddb.module","NgxIndexedDBService":"./lib/ngx-indexed-db.service","DBConfig":"./lib/ngx-indexed-db.meta","ObjectStoreMeta":"./lib/ngx-indexed-db.meta","ObjectStoreSchema":"./lib/ngx-indexed-db.meta","IndexDetails":"./lib/ngx-indexed-db.meta","RequestEvent":"./lib/ngx-indexed-db.meta","RequestEventTarget":"./lib/ngx-indexed-db.meta","DBMode":"./lib/ngx-indexed-db.meta","Key":"./lib/ngx-indexed-db.meta","CONFIG_TOKEN":"./lib/ngx-indexed-db.meta"},"importAs":"ngx-indexed-db"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ngx-indexed-db",
|
|
3
|
+
"author": "Charles Assunção",
|
|
4
|
+
"description": "Angular wrapper to IndexedDB database.",
|
|
5
|
+
"version": "9.4.0",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"private": false,
|
|
8
|
+
"keywords": [
|
|
9
|
+
"indexed",
|
|
10
|
+
"db",
|
|
11
|
+
"indexeddb",
|
|
12
|
+
"angular",
|
|
13
|
+
"ng",
|
|
14
|
+
"ngx",
|
|
15
|
+
"storage",
|
|
16
|
+
"schema",
|
|
17
|
+
"index"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/assuncaocharles/ngx-indexed-db"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@angular/common": ">=10.0.6",
|
|
25
|
+
"@angular/core": ">=10.0.6"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"tslib": "^2.0.0"
|
|
29
|
+
},
|
|
30
|
+
"main": "bundles/ngx-indexed-db.umd.js",
|
|
31
|
+
"module": "fesm2015/ngx-indexed-db.js",
|
|
32
|
+
"es2015": "fesm2015/ngx-indexed-db.js",
|
|
33
|
+
"esm2015": "esm2015/ngx-indexed-db.js",
|
|
34
|
+
"fesm2015": "fesm2015/ngx-indexed-db.js",
|
|
35
|
+
"typings": "ngx-indexed-db.d.ts",
|
|
36
|
+
"metadata": "ngx-indexed-db.metadata.json",
|
|
37
|
+
"sideEffects": false
|
|
38
|
+
}
|
package/public-api.d.ts
ADDED
package/utils/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Options {
|
|
2
|
+
storeName: string;
|
|
3
|
+
dbMode: IDBTransactionMode;
|
|
4
|
+
error: (e: Event) => any;
|
|
5
|
+
complete?: (e: Event) => any;
|
|
6
|
+
abort?: any;
|
|
7
|
+
}
|
|
8
|
+
export declare function validateStoreName(db: IDBDatabase, storeName: string): boolean;
|
|
9
|
+
export declare function validateBeforeTransaction(db: IDBDatabase, storeName: string, reject: (message: string) => void): void;
|
|
10
|
+
export declare function createTransaction(db: IDBDatabase, options: Options): IDBTransaction;
|
|
11
|
+
export declare function optionsGenerator(type: any, storeName: any, reject: (reason?: any) => void, resolve?: (e: any) => void): Options;
|