Comparing version 4.0.1-alpha.10 to 4.0.1-alpha.11
@@ -7,3 +7,3 @@ /* | ||
* | ||
* Version 4.0.1-alpha.10, Wed Mar 29 2023 | ||
* Version 4.0.1-alpha.11, Wed May 24 2023 | ||
* | ||
@@ -69,2 +69,3 @@ * https://dexie.org | ||
storeNames: Array<string>; | ||
explicit?: boolean; | ||
parent?: Transaction; | ||
@@ -362,3 +363,4 @@ on: TransactionEvents; | ||
export type KeyPaths<T> = { | ||
[P in keyof T]: P extends string ? T[P] extends any[] ? P | `${P}.${number}` | `${P}.${number}.${KeyPaths<T[P][number]>}` : T[P] extends (...args: any[]) => any // Method | ||
[P in keyof T]: P extends string ? T[P] extends Array<infer K> ? K extends object // only drill into the array element if it's an object | ||
? P | `${P}.${number}` | `${P}.${number}.${KeyPaths<K>}` : P | `${P}.${number}` : T[P] extends (...args: any[]) => any // Method | ||
? never : T[P] extends object ? P | `${P}.${KeyPaths<T[P]>}` : P : never; | ||
@@ -422,2 +424,84 @@ }[keyof T]; | ||
} | ||
export type IntervalTree = IntervalTreeNode | EmptyRange; | ||
export interface IntervalTreeNode { | ||
from: IndexableType; // lower bound | ||
to: IndexableType; // upper bound | ||
l: IntervalTreeNode | null; // left | ||
r: IntervalTreeNode | null; // right | ||
d: number; // depth | ||
} | ||
export interface EmptyRange { | ||
d: 0; | ||
} | ||
export interface DexieOnReadyEvent { | ||
subscribe(fn: (vipDb: Dexie) => any, bSticky: boolean): void; | ||
unsubscribe(fn: (vipDb: Dexie) => any): void; | ||
fire(vipDb: Dexie): any; | ||
} | ||
export interface DexieVersionChangeEvent { | ||
subscribe(fn: (event: IDBVersionChangeEvent) => any): void; | ||
unsubscribe(fn: (event: IDBVersionChangeEvent) => any): void; | ||
fire(event: IDBVersionChangeEvent): any; | ||
} | ||
export interface DexiePopulateEvent { | ||
subscribe(fn: (trans: Transaction) => any): void; | ||
unsubscribe(fn: (trans: Transaction) => any): void; | ||
fire(trans: Transaction): any; | ||
} | ||
export interface DexieCloseEvent { | ||
subscribe(fn: (event: Event) => any): void; | ||
unsubscribe(fn: (event: Event) => any): void; | ||
fire(event: Event): any; | ||
} | ||
export interface DbEvents extends DexieEventSet { | ||
(eventName: "ready", subscriber: (vipDb: Dexie) => any, bSticky?: boolean): void; | ||
(eventName: "populate", subscriber: (trans: Transaction) => any): void; | ||
(eventName: "blocked", subscriber: (event: IDBVersionChangeEvent) => any): void; | ||
(eventName: "versionchange", subscriber: (event: IDBVersionChangeEvent) => any): void; | ||
(eventName: "close", subscriber: (event: Event) => any): void; | ||
ready: DexieOnReadyEvent; | ||
populate: DexiePopulateEvent; | ||
blocked: DexieEvent; | ||
versionchange: DexieVersionChangeEvent; | ||
close: DexieCloseEvent; | ||
} | ||
/** Set of mutated parts of the database | ||
*/ | ||
export type ObservabilitySet = { | ||
/** Database part having been mutated. | ||
* | ||
* This structure is produced in observability-middleware.ts | ||
* and consumed in live-query.ts. | ||
* | ||
* Format of 'part': | ||
* | ||
* `idb://${dbName}/${tableName}/${indexName}` | ||
* | ||
* * dbName is the database name | ||
* * tableName is the table name | ||
* * indexName is any of: | ||
* 1. An empty string - represents the primary keys of the affected objs | ||
* 2. ":dels" - represents primary keys of deleted objects in the table | ||
* 3. The keyPath of an index, such as "name", "age" or "address.city" - | ||
* represents indexes that, if used in a query, might affect the | ||
* result of that query. | ||
* | ||
* IntervalTree | ||
* * See definition of IntervalTree type in rangeset.d.ts | ||
* * See rangesOverlap() in rangeset.ts that can be used to compare two | ||
* IntervalTrees and detect collissions. | ||
* * See RangeSet class that can be used to create an IntervalTree and add | ||
* ranges to it. | ||
*/ | ||
[part: string]: IntervalTree; | ||
}; | ||
export interface DexieOnStorageMutatedEvent { | ||
subscribe(fn: (parts: ObservabilitySet) => any): void; | ||
unsubscribe(fn: (parts: ObservabilitySet) => any): void; | ||
fire(parts: ObservabilitySet): any; | ||
} | ||
export interface GlobalDexieEvents extends DexieEventSet { | ||
(eventName: "storagemutated", subscriber: (parts: ObservabilitySet) => any): void; | ||
storagemutated: DexieOnStorageMutatedEvent; | ||
} | ||
export const enum DBCoreRangeType { | ||
@@ -456,2 +540,3 @@ Equal = 1, | ||
keys?: any[]; | ||
mutatedParts?: ObservabilitySet; | ||
/** @deprecated Will always get results since 3.1.0-alpha.5 */ | ||
@@ -465,2 +550,3 @@ wantResults?: boolean; | ||
keys?: any[]; | ||
mutatedParts?: ObservabilitySet; | ||
criteria?: { | ||
@@ -486,2 +572,3 @@ index: string | null; | ||
keys: any[]; | ||
mutatedParts?: ObservabilitySet; | ||
criteria?: { | ||
@@ -496,2 +583,3 @@ index: string | null; | ||
range: DBCoreKeyRange; | ||
mutatedParts?: ObservabilitySet; | ||
} | ||
@@ -502,2 +590,3 @@ export interface DBCoreGetManyRequest { | ||
cache?: "immutable" | "clone"; | ||
obsSet?: ObservabilitySet; | ||
} | ||
@@ -507,2 +596,3 @@ export interface DBCoreGetRequest { | ||
key: any; | ||
obsSet?: ObservabilitySet; | ||
} | ||
@@ -518,2 +608,3 @@ export interface DBCoreQuery { | ||
query: DBCoreQuery; | ||
obsSet?: ObservabilitySet; | ||
} | ||
@@ -529,2 +620,3 @@ export interface DBCoreQueryResponse { | ||
query: DBCoreQuery; | ||
obsSet?: ObservabilitySet; | ||
} | ||
@@ -534,2 +626,3 @@ export interface DBCoreCountRequest { | ||
query: DBCoreQuery; | ||
obsSet?: ObservabilitySet; | ||
} | ||
@@ -672,84 +765,2 @@ export interface DBCoreCursor { | ||
} | ||
export type IntervalTree = IntervalTreeNode | EmptyRange; | ||
export interface IntervalTreeNode { | ||
from: IndexableType; // lower bound | ||
to: IndexableType; // upper bound | ||
l: IntervalTreeNode | null; // left | ||
r: IntervalTreeNode | null; // right | ||
d: number; // depth | ||
} | ||
export interface EmptyRange { | ||
d: 0; | ||
} | ||
export interface DexieOnReadyEvent { | ||
subscribe(fn: (vipDb: Dexie) => any, bSticky: boolean): void; | ||
unsubscribe(fn: (vipDb: Dexie) => any): void; | ||
fire(vipDb: Dexie): any; | ||
} | ||
export interface DexieVersionChangeEvent { | ||
subscribe(fn: (event: IDBVersionChangeEvent) => any): void; | ||
unsubscribe(fn: (event: IDBVersionChangeEvent) => any): void; | ||
fire(event: IDBVersionChangeEvent): any; | ||
} | ||
export interface DexiePopulateEvent { | ||
subscribe(fn: (trans: Transaction) => any): void; | ||
unsubscribe(fn: (trans: Transaction) => any): void; | ||
fire(trans: Transaction): any; | ||
} | ||
export interface DexieCloseEvent { | ||
subscribe(fn: (event: Event) => any): void; | ||
unsubscribe(fn: (event: Event) => any): void; | ||
fire(event: Event): any; | ||
} | ||
export interface DbEvents extends DexieEventSet { | ||
(eventName: "ready", subscriber: (vipDb: Dexie) => any, bSticky?: boolean): void; | ||
(eventName: "populate", subscriber: (trans: Transaction) => any): void; | ||
(eventName: "blocked", subscriber: (event: IDBVersionChangeEvent) => any): void; | ||
(eventName: "versionchange", subscriber: (event: IDBVersionChangeEvent) => any): void; | ||
(eventName: "close", subscriber: (event: Event) => any): void; | ||
ready: DexieOnReadyEvent; | ||
populate: DexiePopulateEvent; | ||
blocked: DexieEvent; | ||
versionchange: DexieVersionChangeEvent; | ||
close: DexieCloseEvent; | ||
} | ||
/** Set of mutated parts of the database | ||
*/ | ||
export type ObservabilitySet = { | ||
/** Database part having been mutated. | ||
* | ||
* This structure is produced in observability-middleware.ts | ||
* and consumed in live-query.ts. | ||
* | ||
* Format of 'part': | ||
* | ||
* `idb://${dbName}/${tableName}/${indexName}` | ||
* | ||
* * dbName is the database name | ||
* * tableName is the table name | ||
* * indexName is any of: | ||
* 1. An empty string - represents the primary keys of the affected objs | ||
* 2. ":dels" - represents primary keys of deleted objects in the table | ||
* 3. The keyPath of an index, such as "name", "age" or "address.city" - | ||
* represents indexes that, if used in a query, might affect the | ||
* result of that query. | ||
* | ||
* IntervalTree | ||
* * See definition of IntervalTree type in rangeset.d.ts | ||
* * See rangesOverlap() in rangeset.ts that can be used to compare two | ||
* IntervalTrees and detect collissions. | ||
* * See RangeSet class that can be used to create an IntervalTree and add | ||
* ranges to it. | ||
*/ | ||
[part: string]: IntervalTree; | ||
}; | ||
export interface DexieOnStorageMutatedEvent { | ||
subscribe(fn: (parts: ObservabilitySet) => any): void; | ||
unsubscribe(fn: (parts: ObservabilitySet) => any): void; | ||
fire(parts: ObservabilitySet): any; | ||
} | ||
export interface GlobalDexieEvents extends DexieEventSet { | ||
(eventName: "storagemutated", subscriber: (parts: ObservabilitySet) => any): void; | ||
storagemutated: DexieOnStorageMutatedEvent; | ||
} | ||
export type TransactionMode = "readonly" | "readwrite" | "r" | "r!" | "r?" | "rw" | "rw!" | "rw?"; | ||
@@ -1005,2 +1016,37 @@ export type DbSchema = { | ||
} | ||
export type GlobalQueryCache = { | ||
// TODO: Change to parts: {[part: string]: TblQueryCache} | ||
// och unsignaledParts: ObservabilitySet; | ||
[part: string]: TblQueryCache; // part is `idb://${dbName}/${tableName}` | ||
}; | ||
export interface TblQueryCache { | ||
queries: { | ||
query: { | ||
[indexName: string]: CacheEntry[]; | ||
}; | ||
count: { | ||
[indexName: string]: CacheEntry[]; | ||
}; | ||
}; | ||
objs: Map<string | number, object>; | ||
optimisticOps: DBCoreMutateRequest[]; | ||
unsignaledParts: ObservabilitySet; | ||
signalTimer?: number; | ||
} | ||
export interface CacheEntryCommon { | ||
subscribers: Set<() => void>; | ||
obsSet: ObservabilitySet; | ||
//txObsSet: ObservabilitySet; | ||
promise: Promise<any>; | ||
dirty: boolean; | ||
} | ||
export type CacheEntry = CacheEntryCommon & ({ | ||
type: "query"; | ||
req: DBCoreQueryRequest; | ||
res?: readonly any[]; | ||
} | { | ||
type: "count"; | ||
req: DBCoreCountRequest; | ||
res?: number; | ||
}); | ||
export type ChromeTransactionDurability = "default" | "strict" | "relaxed"; | ||
@@ -1021,2 +1067,3 @@ export interface DexieOptions { | ||
chromeTransactionDurability?: ChromeTransactionDurability; | ||
cache?: "immutable" | "cloned" | "disabled"; | ||
} | ||
@@ -1050,2 +1097,3 @@ export interface DexieConstructor extends DexieExceptionClasses { | ||
default: Dexie; // Work-around for different build tools handling default imports differently. | ||
cache: GlobalQueryCache; | ||
Promise: PromiseExtendedConstructor; | ||
@@ -1052,0 +1100,0 @@ //TableSchema: {}; // Deprecate! |
{ | ||
"name": "dexie", | ||
"version": "4.0.1-alpha.10", | ||
"version": "4.0.1-alpha.11", | ||
"description": "A Minimalistic Wrapper for IndexedDB", | ||
@@ -132,3 +132,3 @@ "main": "dist/dexie.js", | ||
"tslib": "^2.1.0", | ||
"typescript": "^4.9.4", | ||
"typescript": "^5.0.4", | ||
"uglify-js": "^3.9.2" | ||
@@ -135,0 +135,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2841755
23
18507