dexie 4.0.1-beta.1 → 4.0.1-beta.10
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/README.md +3 -0
- package/SECURITY.md +1 -1
- package/dist/dexie.d.ts +52 -50
- package/dist/dexie.js +392 -356
- 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 +392 -356
- 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 +382 -356
- package/dist/modern/dexie.mjs.map +1 -1
- package/import-wrapper-prod.mjs +8 -3
- package/import-wrapper.mjs +8 -3
- package/package.json +9 -12
- package/tsconfig.json +3 -0
package/README.md
CHANGED
|
@@ -250,6 +250,9 @@ Watch
|
|
|
250
250
|
pnpm run watch
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
+
<br/>
|
|
254
|
+
|
|
255
|
+
[](https://www.lambdatest.com/)
|
|
253
256
|
|
|
254
257
|
[npm-image]: https://img.shields.io/npm/v/dexie.svg?style=flat
|
|
255
258
|
[npm-url]: https://npmjs.org/package/dexie
|
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-beta.
|
|
7
|
+
* Version 4.0.1-beta.10, Mon Feb 12 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;
|
|
@@ -366,13 +366,13 @@ export type KeyPathValue<T, PATH> = PATH extends `${infer R}.${infer S}` ? R ext
|
|
|
366
366
|
export type UpdateSpec<T> = {
|
|
367
367
|
[KP in KeyPaths<T>]?: KeyPathValue<T, KP>;
|
|
368
368
|
};
|
|
369
|
-
export interface Collection<T = any, TKey = IndexableType> {
|
|
369
|
+
export interface Collection<T = any, TKey = IndexableType, TInsertType = T> {
|
|
370
370
|
db: Dexie;
|
|
371
|
-
and(filter: (x: T) => boolean): Collection<T, TKey>;
|
|
372
|
-
clone(props?: Object): Collection<T, TKey>;
|
|
371
|
+
and(filter: (x: T) => boolean): Collection<T, TKey, TInsertType>;
|
|
372
|
+
clone(props?: Object): Collection<T, TKey, TInsertType>;
|
|
373
373
|
count(): PromiseExtended<number>;
|
|
374
374
|
count<R>(thenShortcut: ThenShortcut<number, R>): PromiseExtended<R>;
|
|
375
|
-
distinct(): Collection<T, TKey>;
|
|
375
|
+
distinct(): Collection<T, TKey, TInsertType>;
|
|
376
376
|
each(callback: (obj: T, cursor: {
|
|
377
377
|
key: IndexableType;
|
|
378
378
|
primaryKey: TKey;
|
|
@@ -390,7 +390,7 @@ export interface Collection<T = any, TKey = IndexableType> {
|
|
|
390
390
|
primaryKey: TKey;
|
|
391
391
|
}) => any): PromiseExtended<void>;
|
|
392
392
|
filter<S extends T>(filter: (x: T) => x is S): Collection<S, TKey>;
|
|
393
|
-
filter(filter: (x: T) => boolean): Collection<T, TKey>;
|
|
393
|
+
filter(filter: (x: T) => boolean): Collection<T, TKey, TInsertType>;
|
|
394
394
|
first(): PromiseExtended<T | undefined>;
|
|
395
395
|
first<R>(thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
396
396
|
keys(): PromiseExtended<IndexableTypeArray>;
|
|
@@ -399,24 +399,24 @@ export interface Collection<T = any, TKey = IndexableType> {
|
|
|
399
399
|
primaryKeys<R>(thenShortcut: ThenShortcut<TKey[], R>): PromiseExtended<R>;
|
|
400
400
|
last(): PromiseExtended<T | undefined>;
|
|
401
401
|
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>;
|
|
402
|
+
limit(n: number): Collection<T, TKey, TInsertType>;
|
|
403
|
+
offset(n: number): Collection<T, TKey, TInsertType>;
|
|
404
|
+
or(indexOrPrimayKey: string): WhereClause<T, TKey, TInsertType>;
|
|
405
|
+
raw(): Collection<T, TKey, TInsertType>;
|
|
406
|
+
reverse(): Collection<T, TKey, TInsertType>;
|
|
407
407
|
sortBy(keyPath: string): PromiseExtended<T[]>;
|
|
408
408
|
sortBy<R>(keyPath: string, thenShortcut: ThenShortcut<T[], R>): PromiseExtended<R>;
|
|
409
409
|
toArray(): PromiseExtended<Array<T>>;
|
|
410
410
|
toArray<R>(thenShortcut: ThenShortcut<T[], R>): PromiseExtended<R>;
|
|
411
411
|
uniqueKeys(): PromiseExtended<IndexableTypeArray>;
|
|
412
412
|
uniqueKeys<R>(thenShortcut: ThenShortcut<IndexableTypeArray, R>): PromiseExtended<R>;
|
|
413
|
-
until(filter: (value: T) => boolean, includeStopEntry?: boolean): Collection<T, TKey>;
|
|
413
|
+
until(filter: (value: T) => boolean, includeStopEntry?: boolean): Collection<T, TKey, TInsertType>;
|
|
414
414
|
// Mutating methods
|
|
415
415
|
delete(): PromiseExtended<number>;
|
|
416
416
|
modify(changeCallback: (obj: T, ctx: {
|
|
417
|
-
value:
|
|
417
|
+
value: TInsertType;
|
|
418
418
|
}) => void | boolean): PromiseExtended<number>;
|
|
419
|
-
modify(changes: UpdateSpec<
|
|
419
|
+
modify(changes: UpdateSpec<TInsertType>): PromiseExtended<number>;
|
|
420
420
|
}
|
|
421
421
|
export type IntervalTree = IntervalTreeNode | EmptyRange;
|
|
422
422
|
export interface IntervalTreeNode {
|
|
@@ -683,7 +683,7 @@ export interface Table<T = any, TKey = any, TInsertType = T> {
|
|
|
683
683
|
db: Dexie;
|
|
684
684
|
name: string;
|
|
685
685
|
schema: TableSchema;
|
|
686
|
-
hook: TableHooks<T, TKey>;
|
|
686
|
+
hook: TableHooks<T, TKey, TInsertType>;
|
|
687
687
|
core: DBCoreTable;
|
|
688
688
|
get(key: TKey): PromiseExtended<T | undefined>;
|
|
689
689
|
get<R>(key: TKey, thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
@@ -693,27 +693,27 @@ export interface Table<T = any, TKey = any, TInsertType = T> {
|
|
|
693
693
|
get<R>(equalityCriterias: {
|
|
694
694
|
[key: string]: any;
|
|
695
695
|
}, thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
696
|
-
where(index: string | string[]): WhereClause<T, TKey>;
|
|
696
|
+
where(index: string | string[]): WhereClause<T, TKey, TInsertType>;
|
|
697
697
|
where(equalityCriterias: {
|
|
698
698
|
[key: string]: any;
|
|
699
|
-
}): Collection<T, TKey>;
|
|
700
|
-
filter(fn: (obj: T) => boolean): Collection<T, TKey>;
|
|
699
|
+
}): Collection<T, TKey, TInsertType>;
|
|
700
|
+
filter(fn: (obj: T) => boolean): Collection<T, TKey, TInsertType>;
|
|
701
701
|
count(): PromiseExtended<number>;
|
|
702
702
|
count<R>(thenShortcut: ThenShortcut<number, R>): PromiseExtended<R>;
|
|
703
|
-
offset(n: number): Collection<T, TKey>;
|
|
704
|
-
limit(n: number): Collection<T, TKey>;
|
|
703
|
+
offset(n: number): Collection<T, TKey, TInsertType>;
|
|
704
|
+
limit(n: number): Collection<T, TKey, TInsertType>;
|
|
705
705
|
each(callback: (obj: T, cursor: {
|
|
706
706
|
key: any;
|
|
707
707
|
primaryKey: TKey;
|
|
708
708
|
}) => any): PromiseExtended<void>;
|
|
709
709
|
toArray(): PromiseExtended<Array<T>>;
|
|
710
710
|
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>;
|
|
711
|
+
toCollection(): Collection<T, TKey, TInsertType>;
|
|
712
|
+
orderBy(index: string | string[]): Collection<T, TKey, TInsertType>;
|
|
713
|
+
reverse(): Collection<T, TKey, TInsertType>;
|
|
714
714
|
mapToClass(constructor: Function): Function;
|
|
715
715
|
add(item: TInsertType, key?: TKey): PromiseExtended<TKey>;
|
|
716
|
-
update(key: TKey | T, changes: UpdateSpec<
|
|
716
|
+
update(key: TKey | T, changes: UpdateSpec<TInsertType> | ((obj: T, ctx: {
|
|
717
717
|
value: any;
|
|
718
718
|
primKey: IndexableType;
|
|
719
719
|
}) => void | boolean)): PromiseExtended<number>;
|
|
@@ -804,7 +804,9 @@ export interface Dexie {
|
|
|
804
804
|
close(closeOptions?: {
|
|
805
805
|
disableAutoOpen: boolean;
|
|
806
806
|
}): void;
|
|
807
|
-
delete(
|
|
807
|
+
delete(closeOptions?: {
|
|
808
|
+
disableAutoOpen: boolean;
|
|
809
|
+
}): PromiseExtended<void>;
|
|
808
810
|
isOpen(): boolean;
|
|
809
811
|
hasBeenClosed(): boolean;
|
|
810
812
|
hasFailed(): boolean;
|
|
@@ -1022,7 +1024,6 @@ export interface TblQueryCache {
|
|
|
1022
1024
|
objs: Map<string | number, object>;
|
|
1023
1025
|
optimisticOps: DBCoreMutateRequest[];
|
|
1024
1026
|
unsignaledParts: ObservabilitySet;
|
|
1025
|
-
signalTimer?: number;
|
|
1026
1027
|
}
|
|
1027
1028
|
export interface CacheEntryCommon {
|
|
1028
1029
|
subscribers: Set<() => void>;
|
|
@@ -1069,6 +1070,7 @@ export interface DexieConstructor extends DexieExceptionClasses {
|
|
|
1069
1070
|
getDatabaseNames<R>(thenShortcut: ThenShortcut<string[], R>): Promise<R>;
|
|
1070
1071
|
vip<U>(scopeFunction: () => U): U;
|
|
1071
1072
|
ignoreTransaction<U>(fn: () => U): U;
|
|
1073
|
+
disableBfCache?: boolean;
|
|
1072
1074
|
liveQuery<T>(fn: () => T | Promise<T>): Observable<T>;
|
|
1073
1075
|
extendObservabilitySet(target: ObservabilitySet, newSet: ObservabilitySet): ObservabilitySet;
|
|
1074
1076
|
override<F>(origFunc: F, overridedFactory: (fn: any) => any): F; // ?
|
|
@@ -1120,7 +1122,7 @@ export type InsertType<T, OptionalProps extends keyof T> = Omit<T, OptionalProps
|
|
|
1120
1122
|
export type IDType<T, TKeyPropNameOrKeyType> = IsStrictlyAny<T> extends true ? TKeyPropNameOrKeyType : TKeyPropNameOrKeyType extends string ? TKeyPropNameOrKeyType extends keyof T ? T[TKeyPropNameOrKeyType] : TKeyPropNameOrKeyType : TKeyPropNameOrKeyType;
|
|
1121
1123
|
export type EntityTable<T, TKeyPropName extends keyof T = never, TInsertType = InsertType<T, TKeyPropName>> = Table<T, IDType<T, TKeyPropName>, TInsertType>;
|
|
1122
1124
|
export declare var Dexie: DexieConstructor;
|
|
1123
|
-
export interface _Table<T, TKey> extends Table<T, TKey> {
|
|
1125
|
+
export interface _Table<T, TKey, TInsertType> extends Table<T, TKey, TInsertType> {
|
|
1124
1126
|
}
|
|
1125
1127
|
export interface _Collection<T, TKey> extends Collection<T, TKey> {
|
|
1126
1128
|
}
|
|
@@ -1128,7 +1130,7 @@ export declare module Dexie {
|
|
|
1128
1130
|
// The "Dexie.Promise" type.
|
|
1129
1131
|
type Promise<T = any> = PromiseExtended<T>; // Because many samples have been Dexie.Promise.
|
|
1130
1132
|
// The "Dexie.Table" interface. Same as named exported interface Table.
|
|
1131
|
-
interface Table<T = any, Key = any> extends _Table<T, Key> {
|
|
1133
|
+
interface Table<T = any, Key = any, TInsertType = T> extends _Table<T, Key, TInsertType> {
|
|
1132
1134
|
} // Because all samples have been Dexie.Table<...>
|
|
1133
1135
|
// The "Dexie.Collection" interface. Same as named exported interface Collection.
|
|
1134
1136
|
interface Collection<T = any, Key = any> extends _Collection<T, Key> {
|