dexie 4.0.1-beta.8 → 4.0.1-rc.1
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/SECURITY.md +1 -1
- package/dist/dexie.d.ts +68 -49
- package/dist/dexie.js +157 -220
- package/dist/dexie.js.map +1 -1
- package/dist/dexie.min.js +1 -1
- package/dist/dexie.min.js.map +1 -1
- package/dist/dexie.mjs +155 -221
- package/dist/dexie.mjs.map +1 -1
- package/dist/modern/dexie.min.mjs +1 -1
- package/dist/modern/dexie.min.mjs.map +1 -1
- package/dist/modern/dexie.mjs +160 -235
- package/dist/modern/dexie.mjs.map +1 -1
- package/import-wrapper-prod.mjs +2 -2
- package/import-wrapper.mjs +2 -2
- package/package.json +2 -2
- package/tsconfig.json +3 -0
package/SECURITY.md
CHANGED
package/dist/dexie.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* By David Fahlander, david.fahlander@gmail.com
|
|
6
6
|
*
|
|
7
|
-
* Version 4.0.1-
|
|
7
|
+
* Version 4.0.1-rc.1, Wed Mar 20 2024
|
|
8
8
|
*
|
|
9
9
|
* https://dexie.org
|
|
10
10
|
*
|
|
@@ -85,7 +85,7 @@ export interface DeletingHookContext<T, Key> {
|
|
|
85
85
|
onsuccess?: () => void;
|
|
86
86
|
onerror?: (err: any) => void;
|
|
87
87
|
}
|
|
88
|
-
export interface TableHooks<T = any, TKey = IndexableType> extends DexieEventSet {
|
|
88
|
+
export interface TableHooks<T = any, TKey = IndexableType, TInsertType = T> extends DexieEventSet {
|
|
89
89
|
(eventName: "creating", subscriber: (this: CreatingHookContext<T, TKey>, primKey: TKey, obj: T, transaction: Transaction) => void | undefined | TKey): void;
|
|
90
90
|
(eventName: "reading", subscriber: (obj: T) => T | any): void;
|
|
91
91
|
(eventName: "updating", subscriber: (this: UpdatingHookContext<T, TKey>, modifications: Object, primKey: TKey, obj: T, transaction: Transaction) => any): void;
|
|
@@ -96,33 +96,33 @@ export interface TableHooks<T = any, TKey = IndexableType> extends DexieEventSet
|
|
|
96
96
|
deleting: DexieEvent;
|
|
97
97
|
}
|
|
98
98
|
export type ThenShortcut<T, TResult> = (value: T) => TResult | PromiseLike<TResult>;
|
|
99
|
-
export interface WhereClause<T = any, TKey = IndexableType> {
|
|
100
|
-
above(key: any): Collection<T, TKey>;
|
|
101
|
-
aboveOrEqual(key: any): Collection<T, TKey>;
|
|
102
|
-
anyOf(keys: ReadonlyArray<IndexableType>): Collection<T, TKey>;
|
|
103
|
-
anyOf(...keys: Array<IndexableType>): Collection<T, TKey>;
|
|
104
|
-
anyOfIgnoreCase(keys: string[]): Collection<T, TKey>;
|
|
105
|
-
anyOfIgnoreCase(...keys: string[]): Collection<T, TKey>;
|
|
106
|
-
below(key: any): Collection<T, TKey>;
|
|
107
|
-
belowOrEqual(key: any): Collection<T, TKey>;
|
|
108
|
-
between(lower: any, upper: any, includeLower?: boolean, includeUpper?: boolean): Collection<T, TKey>;
|
|
109
|
-
equals(key: IndexableType): Collection<T, TKey>;
|
|
110
|
-
equalsIgnoreCase(key: string): Collection<T, TKey>;
|
|
99
|
+
export interface WhereClause<T = any, TKey = IndexableType, TInsertType = T> {
|
|
100
|
+
above(key: any): Collection<T, TKey, TInsertType>;
|
|
101
|
+
aboveOrEqual(key: any): Collection<T, TKey, TInsertType>;
|
|
102
|
+
anyOf(keys: ReadonlyArray<IndexableType>): Collection<T, TKey, TInsertType>;
|
|
103
|
+
anyOf(...keys: Array<IndexableType>): Collection<T, TKey, TInsertType>;
|
|
104
|
+
anyOfIgnoreCase(keys: string[]): Collection<T, TKey, TInsertType>;
|
|
105
|
+
anyOfIgnoreCase(...keys: string[]): Collection<T, TKey, TInsertType>;
|
|
106
|
+
below(key: any): Collection<T, TKey, TInsertType>;
|
|
107
|
+
belowOrEqual(key: any): Collection<T, TKey, TInsertType>;
|
|
108
|
+
between(lower: any, upper: any, includeLower?: boolean, includeUpper?: boolean): Collection<T, TKey, TInsertType>;
|
|
109
|
+
equals(key: IndexableType): Collection<T, TKey, TInsertType>;
|
|
110
|
+
equalsIgnoreCase(key: string): Collection<T, TKey, TInsertType>;
|
|
111
111
|
inAnyRange(ranges: ReadonlyArray<{
|
|
112
112
|
0: any;
|
|
113
113
|
1: any;
|
|
114
114
|
}>, options?: {
|
|
115
115
|
includeLowers?: boolean;
|
|
116
116
|
includeUppers?: boolean;
|
|
117
|
-
}): Collection<T, TKey>;
|
|
118
|
-
startsWith(key: string): Collection<T, TKey>;
|
|
119
|
-
startsWithAnyOf(prefixes: string[]): Collection<T, TKey>;
|
|
120
|
-
startsWithAnyOf(...prefixes: string[]): Collection<T, TKey>;
|
|
121
|
-
startsWithIgnoreCase(key: string): Collection<T, TKey>;
|
|
122
|
-
startsWithAnyOfIgnoreCase(prefixes: string[]): Collection<T, TKey>;
|
|
123
|
-
startsWithAnyOfIgnoreCase(...prefixes: string[]): Collection<T, TKey>;
|
|
124
|
-
noneOf(keys: ReadonlyArray<IndexableType>): Collection<T, TKey>;
|
|
125
|
-
notEqual(key: IndexableType): Collection<T, TKey>;
|
|
117
|
+
}): Collection<T, TKey, TInsertType>;
|
|
118
|
+
startsWith(key: string): Collection<T, TKey, TInsertType>;
|
|
119
|
+
startsWithAnyOf(prefixes: string[]): Collection<T, TKey, TInsertType>;
|
|
120
|
+
startsWithAnyOf(...prefixes: string[]): Collection<T, TKey, TInsertType>;
|
|
121
|
+
startsWithIgnoreCase(key: string): Collection<T, TKey, TInsertType>;
|
|
122
|
+
startsWithAnyOfIgnoreCase(prefixes: string[]): Collection<T, TKey, TInsertType>;
|
|
123
|
+
startsWithAnyOfIgnoreCase(...prefixes: string[]): Collection<T, TKey, TInsertType>;
|
|
124
|
+
noneOf(keys: ReadonlyArray<IndexableType>): Collection<T, TKey, TInsertType>;
|
|
125
|
+
notEqual(key: IndexableType): Collection<T, TKey, TInsertType>;
|
|
126
126
|
}
|
|
127
127
|
export interface PromiseExtendedConstructor extends PromiseConstructor {
|
|
128
128
|
readonly prototype: PromiseExtended;
|
|
@@ -363,16 +363,32 @@ export type KeyPaths<T> = {
|
|
|
363
363
|
? never : T[P] extends object ? P | `${P}.${KeyPaths<T[P]>}` : P : never;
|
|
364
364
|
}[keyof T];
|
|
365
365
|
export type KeyPathValue<T, PATH> = PATH extends `${infer R}.${infer S}` ? R extends keyof T ? KeyPathValue<T[R], S> : T extends any[] ? PATH extends `${number}.${infer S}` ? KeyPathValue<T[number], S> : void : void : PATH extends `${number}` ? T extends any[] ? T[number] : void : PATH extends keyof T ? T[PATH] : void;
|
|
366
|
+
export declare const PropModSymbol: unique symbol;
|
|
367
|
+
export type PropModSpec = {
|
|
368
|
+
replacePrefix?: [
|
|
369
|
+
string,
|
|
370
|
+
string
|
|
371
|
+
];
|
|
372
|
+
};
|
|
373
|
+
export class PropModification implements PropModSpec {
|
|
374
|
+
[PropModSymbol]?: true;
|
|
375
|
+
replacePrefix?: [
|
|
376
|
+
string,
|
|
377
|
+
string
|
|
378
|
+
];
|
|
379
|
+
execute<T>(value: T): T;
|
|
380
|
+
constructor(spec: PropModSpec);
|
|
381
|
+
}
|
|
366
382
|
export type UpdateSpec<T> = {
|
|
367
|
-
[KP in KeyPaths<T>]?: KeyPathValue<T, KP
|
|
383
|
+
[KP in KeyPaths<T>]?: KeyPathValue<T, KP> | PropModification;
|
|
368
384
|
};
|
|
369
|
-
export interface Collection<T = any, TKey = IndexableType> {
|
|
385
|
+
export interface Collection<T = any, TKey = IndexableType, TInsertType = T> {
|
|
370
386
|
db: Dexie;
|
|
371
|
-
and(filter: (x: T) => boolean): Collection<T, TKey>;
|
|
372
|
-
clone(props?: Object): Collection<T, TKey>;
|
|
387
|
+
and(filter: (x: T) => boolean): Collection<T, TKey, TInsertType>;
|
|
388
|
+
clone(props?: Object): Collection<T, TKey, TInsertType>;
|
|
373
389
|
count(): PromiseExtended<number>;
|
|
374
390
|
count<R>(thenShortcut: ThenShortcut<number, R>): PromiseExtended<R>;
|
|
375
|
-
distinct(): Collection<T, TKey>;
|
|
391
|
+
distinct(): Collection<T, TKey, TInsertType>;
|
|
376
392
|
each(callback: (obj: T, cursor: {
|
|
377
393
|
key: IndexableType;
|
|
378
394
|
primaryKey: TKey;
|
|
@@ -390,7 +406,7 @@ export interface Collection<T = any, TKey = IndexableType> {
|
|
|
390
406
|
primaryKey: TKey;
|
|
391
407
|
}) => any): PromiseExtended<void>;
|
|
392
408
|
filter<S extends T>(filter: (x: T) => x is S): Collection<S, TKey>;
|
|
393
|
-
filter(filter: (x: T) => boolean): Collection<T, TKey>;
|
|
409
|
+
filter(filter: (x: T) => boolean): Collection<T, TKey, TInsertType>;
|
|
394
410
|
first(): PromiseExtended<T | undefined>;
|
|
395
411
|
first<R>(thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
396
412
|
keys(): PromiseExtended<IndexableTypeArray>;
|
|
@@ -399,24 +415,24 @@ export interface Collection<T = any, TKey = IndexableType> {
|
|
|
399
415
|
primaryKeys<R>(thenShortcut: ThenShortcut<TKey[], R>): PromiseExtended<R>;
|
|
400
416
|
last(): PromiseExtended<T | undefined>;
|
|
401
417
|
last<R>(thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
402
|
-
limit(n: number): Collection<T, TKey>;
|
|
403
|
-
offset(n: number): Collection<T, TKey>;
|
|
404
|
-
or(indexOrPrimayKey: string): WhereClause<T, TKey>;
|
|
405
|
-
raw(): Collection<T, TKey>;
|
|
406
|
-
reverse(): Collection<T, TKey>;
|
|
418
|
+
limit(n: number): Collection<T, TKey, TInsertType>;
|
|
419
|
+
offset(n: number): Collection<T, TKey, TInsertType>;
|
|
420
|
+
or(indexOrPrimayKey: string): WhereClause<T, TKey, TInsertType>;
|
|
421
|
+
raw(): Collection<T, TKey, TInsertType>;
|
|
422
|
+
reverse(): Collection<T, TKey, TInsertType>;
|
|
407
423
|
sortBy(keyPath: string): PromiseExtended<T[]>;
|
|
408
424
|
sortBy<R>(keyPath: string, thenShortcut: ThenShortcut<T[], R>): PromiseExtended<R>;
|
|
409
425
|
toArray(): PromiseExtended<Array<T>>;
|
|
410
426
|
toArray<R>(thenShortcut: ThenShortcut<T[], R>): PromiseExtended<R>;
|
|
411
427
|
uniqueKeys(): PromiseExtended<IndexableTypeArray>;
|
|
412
428
|
uniqueKeys<R>(thenShortcut: ThenShortcut<IndexableTypeArray, R>): PromiseExtended<R>;
|
|
413
|
-
until(filter: (value: T) => boolean, includeStopEntry?: boolean): Collection<T, TKey>;
|
|
429
|
+
until(filter: (value: T) => boolean, includeStopEntry?: boolean): Collection<T, TKey, TInsertType>;
|
|
414
430
|
// Mutating methods
|
|
415
431
|
delete(): PromiseExtended<number>;
|
|
416
432
|
modify(changeCallback: (obj: T, ctx: {
|
|
417
|
-
value:
|
|
433
|
+
value: TInsertType;
|
|
418
434
|
}) => void | boolean): PromiseExtended<number>;
|
|
419
|
-
modify(changes: UpdateSpec<
|
|
435
|
+
modify(changes: UpdateSpec<TInsertType>): PromiseExtended<number>;
|
|
420
436
|
}
|
|
421
437
|
export type IntervalTree = IntervalTreeNode | EmptyRange;
|
|
422
438
|
export interface IntervalTreeNode {
|
|
@@ -683,7 +699,7 @@ export interface Table<T = any, TKey = any, TInsertType = T> {
|
|
|
683
699
|
db: Dexie;
|
|
684
700
|
name: string;
|
|
685
701
|
schema: TableSchema;
|
|
686
|
-
hook: TableHooks<T, TKey>;
|
|
702
|
+
hook: TableHooks<T, TKey, TInsertType>;
|
|
687
703
|
core: DBCoreTable;
|
|
688
704
|
get(key: TKey): PromiseExtended<T | undefined>;
|
|
689
705
|
get<R>(key: TKey, thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
@@ -693,27 +709,27 @@ export interface Table<T = any, TKey = any, TInsertType = T> {
|
|
|
693
709
|
get<R>(equalityCriterias: {
|
|
694
710
|
[key: string]: any;
|
|
695
711
|
}, thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
696
|
-
where(index: string | string[]): WhereClause<T, TKey>;
|
|
712
|
+
where(index: string | string[]): WhereClause<T, TKey, TInsertType>;
|
|
697
713
|
where(equalityCriterias: {
|
|
698
714
|
[key: string]: any;
|
|
699
|
-
}): Collection<T, TKey>;
|
|
700
|
-
filter(fn: (obj: T) => boolean): Collection<T, TKey>;
|
|
715
|
+
}): Collection<T, TKey, TInsertType>;
|
|
716
|
+
filter(fn: (obj: T) => boolean): Collection<T, TKey, TInsertType>;
|
|
701
717
|
count(): PromiseExtended<number>;
|
|
702
718
|
count<R>(thenShortcut: ThenShortcut<number, R>): PromiseExtended<R>;
|
|
703
|
-
offset(n: number): Collection<T, TKey>;
|
|
704
|
-
limit(n: number): Collection<T, TKey>;
|
|
719
|
+
offset(n: number): Collection<T, TKey, TInsertType>;
|
|
720
|
+
limit(n: number): Collection<T, TKey, TInsertType>;
|
|
705
721
|
each(callback: (obj: T, cursor: {
|
|
706
722
|
key: any;
|
|
707
723
|
primaryKey: TKey;
|
|
708
724
|
}) => any): PromiseExtended<void>;
|
|
709
725
|
toArray(): PromiseExtended<Array<T>>;
|
|
710
726
|
toArray<R>(thenShortcut: ThenShortcut<T[], R>): PromiseExtended<R>;
|
|
711
|
-
toCollection(): Collection<T, TKey>;
|
|
712
|
-
orderBy(index: string | string[]): Collection<T, TKey>;
|
|
713
|
-
reverse(): Collection<T, TKey>;
|
|
727
|
+
toCollection(): Collection<T, TKey, TInsertType>;
|
|
728
|
+
orderBy(index: string | string[]): Collection<T, TKey, TInsertType>;
|
|
729
|
+
reverse(): Collection<T, TKey, TInsertType>;
|
|
714
730
|
mapToClass(constructor: Function): Function;
|
|
715
731
|
add(item: TInsertType, key?: TKey): PromiseExtended<TKey>;
|
|
716
|
-
update(key: TKey | T, changes: UpdateSpec<
|
|
732
|
+
update(key: TKey | T, changes: UpdateSpec<TInsertType> | ((obj: T, ctx: {
|
|
717
733
|
value: any;
|
|
718
734
|
primKey: IndexableType;
|
|
719
735
|
}) => void | boolean)): PromiseExtended<number>;
|
|
@@ -804,7 +820,9 @@ export interface Dexie {
|
|
|
804
820
|
close(closeOptions?: {
|
|
805
821
|
disableAutoOpen: boolean;
|
|
806
822
|
}): void;
|
|
807
|
-
delete(
|
|
823
|
+
delete(closeOptions?: {
|
|
824
|
+
disableAutoOpen: boolean;
|
|
825
|
+
}): PromiseExtended<void>;
|
|
808
826
|
isOpen(): boolean;
|
|
809
827
|
hasBeenClosed(): boolean;
|
|
810
828
|
hasFailed(): boolean;
|
|
@@ -1022,7 +1040,6 @@ export interface TblQueryCache {
|
|
|
1022
1040
|
objs: Map<string | number, object>;
|
|
1023
1041
|
optimisticOps: DBCoreMutateRequest[];
|
|
1024
1042
|
unsignaledParts: ObservabilitySet;
|
|
1025
|
-
signalTimer?: number;
|
|
1026
1043
|
}
|
|
1027
1044
|
export interface CacheEntryCommon {
|
|
1028
1045
|
subscribers: Set<() => void>;
|
|
@@ -1069,6 +1086,7 @@ export interface DexieConstructor extends DexieExceptionClasses {
|
|
|
1069
1086
|
getDatabaseNames<R>(thenShortcut: ThenShortcut<string[], R>): Promise<R>;
|
|
1070
1087
|
vip<U>(scopeFunction: () => U): U;
|
|
1071
1088
|
ignoreTransaction<U>(fn: () => U): U;
|
|
1089
|
+
disableBfCache?: boolean;
|
|
1072
1090
|
liveQuery<T>(fn: () => T | Promise<T>): Observable<T>;
|
|
1073
1091
|
extendObservabilitySet(target: ObservabilitySet, newSet: ObservabilitySet): ObservabilitySet;
|
|
1074
1092
|
override<F>(origFunc: F, overridedFactory: (fn: any) => any): F; // ?
|
|
@@ -1138,6 +1156,7 @@ export function liveQuery<T>(querier: () => T | Promise<T>): Observable<T>;
|
|
|
1138
1156
|
export function mergeRanges(target: IntervalTree, newSet: IntervalTree): void;
|
|
1139
1157
|
export function rangesOverlap(rangeSet1: IntervalTree, rangeSet2: IntervalTree): boolean;
|
|
1140
1158
|
export function cmp(a: any, b: any): number;
|
|
1159
|
+
export function replacePrefix(a: string, b: string): PropModification;
|
|
1141
1160
|
/** Exporting 'Dexie' as the default export.
|
|
1142
1161
|
**/
|
|
1143
1162
|
export default Dexie;
|