@posx/core 5.5.398 → 5.5.399
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/build/index.d.ts +354 -223
- package/build/index.js +1 -1
- package/package.json +2 -2
- package/package.publish.json +2 -2
package/build/index.d.ts
CHANGED
|
@@ -444,20 +444,20 @@ declare class Till extends AppCoreModel implements ITill {
|
|
|
444
444
|
constructor();
|
|
445
445
|
}
|
|
446
446
|
//#endregion
|
|
447
|
-
//#region node_modules/.pnpm/dexie@3.
|
|
447
|
+
//#region node_modules/.pnpm/dexie@4.3.0/node_modules/dexie/dist/dexie.d.ts
|
|
448
448
|
/*
|
|
449
449
|
* Dexie.js - a minimalistic wrapper for IndexedDB
|
|
450
450
|
* ===============================================
|
|
451
451
|
*
|
|
452
452
|
* By David Fahlander, david.fahlander@gmail.com
|
|
453
453
|
*
|
|
454
|
-
* Version 3.
|
|
454
|
+
* Version 4.3.0, Sat Dec 20 2025
|
|
455
455
|
*
|
|
456
456
|
* https://dexie.org
|
|
457
457
|
*
|
|
458
458
|
* Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
|
|
459
459
|
*/
|
|
460
|
-
// Generated by dts-bundle-generator
|
|
460
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
461
461
|
|
|
462
462
|
interface IndexSpec {
|
|
463
463
|
name: string;
|
|
@@ -467,11 +467,16 @@ interface IndexSpec {
|
|
|
467
467
|
auto: boolean | undefined;
|
|
468
468
|
compound: boolean | undefined;
|
|
469
469
|
src: string;
|
|
470
|
+
type?: string | undefined;
|
|
470
471
|
}
|
|
471
472
|
interface TableSchema {
|
|
472
473
|
name: string;
|
|
473
474
|
primKey: IndexSpec;
|
|
474
475
|
indexes: IndexSpec[];
|
|
476
|
+
yProps?: {
|
|
477
|
+
prop: string;
|
|
478
|
+
updatesTable: string;
|
|
479
|
+
}[]; // Available if y-dexie addon is used and schema defines Y.Doc properties.
|
|
475
480
|
mappedClass: Function;
|
|
476
481
|
idxByName: {
|
|
477
482
|
[name: string]: IndexSpec;
|
|
@@ -495,7 +500,81 @@ interface DexieEventSet {
|
|
|
495
500
|
[eventName: string]: ("asap" | [(f1: Function, f2: Function) => Function, Function]);
|
|
496
501
|
}): DexieEvent;
|
|
497
502
|
}
|
|
498
|
-
|
|
503
|
+
interface TransactionEvents extends DexieEventSet {
|
|
504
|
+
(eventName: "complete", subscriber: () => any): void;
|
|
505
|
+
(eventName: "abort", subscriber: () => any): void;
|
|
506
|
+
(eventName: "error", subscriber: (error: any) => any): void;
|
|
507
|
+
complete: DexieEvent;
|
|
508
|
+
abort: DexieEvent;
|
|
509
|
+
error: DexieEvent;
|
|
510
|
+
}
|
|
511
|
+
interface Transaction {
|
|
512
|
+
db: Dexie;
|
|
513
|
+
active: boolean;
|
|
514
|
+
mode: IDBTransactionMode;
|
|
515
|
+
idbtrans: IDBTransaction;
|
|
516
|
+
//tables: { [type: string]: Table<any, any> }; Deprecated since 2.0. Obsolete from v3.0.
|
|
517
|
+
storeNames: Array<string>;
|
|
518
|
+
explicit?: boolean;
|
|
519
|
+
parent?: Transaction;
|
|
520
|
+
on: TransactionEvents;
|
|
521
|
+
abort(): void;
|
|
522
|
+
table(tableName: string): Table<any, any>;
|
|
523
|
+
table<T>(tableName: string): Table<T, any>;
|
|
524
|
+
table<T, Key>(tableName: string): Table<T, Key>;
|
|
525
|
+
table<T, Key, TInsertType>(tableName: string): Table<T, Key, TInsertType>;
|
|
526
|
+
}
|
|
527
|
+
interface CreatingHookContext<T, Key> {
|
|
528
|
+
onsuccess?: (primKey: Key) => void;
|
|
529
|
+
onerror?: (err: any) => void;
|
|
530
|
+
}
|
|
531
|
+
interface UpdatingHookContext<T, Key> {
|
|
532
|
+
onsuccess?: (updatedObj: T) => void;
|
|
533
|
+
onerror?: (err: any) => void;
|
|
534
|
+
}
|
|
535
|
+
interface DeletingHookContext<T, Key> {
|
|
536
|
+
onsuccess?: () => void;
|
|
537
|
+
onerror?: (err: any) => void;
|
|
538
|
+
}
|
|
539
|
+
interface TableHooks<T = any, TKey = IndexableType, TInsertType = T> extends DexieEventSet {
|
|
540
|
+
(eventName: "creating", subscriber: (this: CreatingHookContext<T, TKey>, primKey: TKey, obj: T, transaction: Transaction) => void | undefined | TKey): void;
|
|
541
|
+
(eventName: "reading", subscriber: (obj: T) => T | any): void;
|
|
542
|
+
(eventName: "updating", subscriber: (this: UpdatingHookContext<T, TKey>, modifications: Object, primKey: TKey, obj: T, transaction: Transaction) => any): void;
|
|
543
|
+
(eventName: "deleting", subscriber: (this: DeletingHookContext<T, TKey>, primKey: TKey, obj: T, transaction: Transaction) => any): void;
|
|
544
|
+
creating: DexieEvent;
|
|
545
|
+
reading: DexieEvent;
|
|
546
|
+
updating: DexieEvent;
|
|
547
|
+
deleting: DexieEvent;
|
|
548
|
+
}
|
|
549
|
+
type ThenShortcut<T, TResult> = (value: T) => TResult | PromiseLike<TResult>;
|
|
550
|
+
interface WhereClause<T = any, TKey = IndexableType, TInsertType = T> {
|
|
551
|
+
above(key: any): Collection<T, TKey, TInsertType>;
|
|
552
|
+
aboveOrEqual(key: any): Collection<T, TKey, TInsertType>;
|
|
553
|
+
anyOf(keys: ReadonlyArray<IndexableType>): Collection<T, TKey, TInsertType>;
|
|
554
|
+
anyOf(...keys: Array<IndexableType>): Collection<T, TKey, TInsertType>;
|
|
555
|
+
anyOfIgnoreCase(keys: string[]): Collection<T, TKey, TInsertType>;
|
|
556
|
+
anyOfIgnoreCase(...keys: string[]): Collection<T, TKey, TInsertType>;
|
|
557
|
+
below(key: any): Collection<T, TKey, TInsertType>;
|
|
558
|
+
belowOrEqual(key: any): Collection<T, TKey, TInsertType>;
|
|
559
|
+
between(lower: any, upper: any, includeLower?: boolean, includeUpper?: boolean): Collection<T, TKey, TInsertType>;
|
|
560
|
+
equals(key: IndexableType): Collection<T, TKey, TInsertType>;
|
|
561
|
+
equalsIgnoreCase(key: string): Collection<T, TKey, TInsertType>;
|
|
562
|
+
inAnyRange(ranges: ReadonlyArray<{
|
|
563
|
+
0: any;
|
|
564
|
+
1: any;
|
|
565
|
+
}>, options?: {
|
|
566
|
+
includeLowers?: boolean;
|
|
567
|
+
includeUppers?: boolean;
|
|
568
|
+
}): Collection<T, TKey, TInsertType>;
|
|
569
|
+
startsWith(key: string): Collection<T, TKey, TInsertType>;
|
|
570
|
+
startsWithAnyOf(prefixes: string[]): Collection<T, TKey, TInsertType>;
|
|
571
|
+
startsWithAnyOf(...prefixes: string[]): Collection<T, TKey, TInsertType>;
|
|
572
|
+
startsWithIgnoreCase(key: string): Collection<T, TKey, TInsertType>;
|
|
573
|
+
startsWithAnyOfIgnoreCase(prefixes: string[]): Collection<T, TKey, TInsertType>;
|
|
574
|
+
startsWithAnyOfIgnoreCase(...prefixes: string[]): Collection<T, TKey, TInsertType>;
|
|
575
|
+
noneOf(keys: ReadonlyArray<IndexableType>): Collection<T, TKey, TInsertType>;
|
|
576
|
+
notEqual(key: IndexableType): Collection<T, TKey, TInsertType>;
|
|
577
|
+
}
|
|
499
578
|
interface PromiseExtendedConstructor extends PromiseConstructor {
|
|
500
579
|
readonly prototype: PromiseExtended;
|
|
501
580
|
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): PromiseExtended<T>;
|
|
@@ -540,14 +619,34 @@ interface PromiseExtended<T = any> extends Promise<T> {
|
|
|
540
619
|
finally<U>(onFinally?: () => U | PromiseLike<U>): PromiseExtended<T>;
|
|
541
620
|
timeout(ms: number, msg?: string): PromiseExtended<T>;
|
|
542
621
|
}
|
|
543
|
-
type
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
622
|
+
type KeyPathIgnoreObject = ArrayBuffer | ArrayBufferView | RegExp | Blob | FileList | FileSystemFileHandle | FileSystemDirectoryHandle | DataView | ImageBitmap | ImageData | Map<any, any> | Set<any> | CryptoKey | Promise<any> | ReadableStream<any> | ReadableStreamDefaultReader<any> | ReadableStreamDefaultController<any> | {
|
|
623
|
+
whenLoaded: Promise<any>;
|
|
624
|
+
};
|
|
625
|
+
// Y.Doc
|
|
626
|
+
type KeyPaths<T, MAXDEPTH = "II", CURRDEPTH extends string = ""> = { [P in keyof T]: P extends string ? CURRDEPTH extends MAXDEPTH ? P : T[P] extends Array<infer K> ? K extends any[] // Array of arrays (issue #2026)
|
|
627
|
+
? P | `${P}.${number}` | `${P}.${number}.${number}` : K extends object // only drill into the array element if it's an object
|
|
628
|
+
? P | `${P}.${number}` | `${P}.${number}.${KeyPaths<Required<K>>}` : P | `${P}.${number}` : T[P] extends ((...args: any[]) => any // Method
|
|
629
|
+
) ? never : T[P] extends KeyPathIgnoreObject // Not valid in update spec or where clause (+ avoid circular reference)
|
|
630
|
+
? P : T[P] extends object ? P | `${P}.${KeyPaths<Required<T[P]>, MAXDEPTH, `${CURRDEPTH}I`>}` : P : never }[keyof T];
|
|
631
|
+
type KeyPathValue<T, PATH> = PATH extends `${infer R}.${infer S}` ? R extends keyof T ? KeyPathValue<Required<T[R]>, S> : T extends any[] ? PATH extends `${number}.${infer S}` ? KeyPathValue<Required<T[number]>, S> : void : void : PATH extends `${number}` ? T extends any[] ? T[number] : void : PATH extends keyof T ? T[PATH] : any;
|
|
632
|
+
type PropModSpec = {
|
|
633
|
+
replacePrefix?: [string, string];
|
|
634
|
+
add?: number | bigint | Array<string | number>;
|
|
635
|
+
remove?: number | bigint | Array<string | number>;
|
|
636
|
+
};
|
|
637
|
+
declare class PropModification {
|
|
638
|
+
["@@propmod"]: PropModSpec;
|
|
639
|
+
constructor(spec: PropModSpec);
|
|
640
|
+
execute<T>(value: T): T;
|
|
641
|
+
}
|
|
642
|
+
type UpdateSpec<T> = { [KP in KeyPaths<Required<T>>]?: KeyPathValue<Required<T>, KP> | PropModification };
|
|
643
|
+
interface Collection<T = any, TKey = IndexableType, TInsertType = T> {
|
|
644
|
+
db: Dexie;
|
|
645
|
+
and(filter: (x: T) => boolean): Collection<T, TKey, TInsertType>;
|
|
646
|
+
clone(props?: Object): Collection<T, TKey, TInsertType>;
|
|
548
647
|
count(): PromiseExtended<number>;
|
|
549
|
-
count<R>(thenShortcut: ThenShortcut<number, R>): PromiseExtended<R>;
|
|
550
|
-
distinct(): Collection<T, TKey>;
|
|
648
|
+
count<R$1>(thenShortcut: ThenShortcut<number, R$1>): PromiseExtended<R$1>;
|
|
649
|
+
distinct(): Collection<T, TKey, TInsertType>;
|
|
551
650
|
each(callback: (obj: T, cursor: {
|
|
552
651
|
key: IndexableType;
|
|
553
652
|
primaryKey: TKey;
|
|
@@ -564,117 +663,120 @@ interface Collection<T = any, TKey = IndexableType> {
|
|
|
564
663
|
key: IndexableType;
|
|
565
664
|
primaryKey: TKey;
|
|
566
665
|
}) => any): PromiseExtended<void>;
|
|
567
|
-
filter(filter: (x: T) =>
|
|
666
|
+
filter<S$1 extends T>(filter: (x: T) => x is S$1): Collection<S$1, TKey>;
|
|
667
|
+
filter(filter: (x: T) => boolean): Collection<T, TKey, TInsertType>;
|
|
568
668
|
first(): PromiseExtended<T | undefined>;
|
|
569
|
-
first<R>(thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
669
|
+
first<R$1>(thenShortcut: ThenShortcut<T | undefined, R$1>): PromiseExtended<R$1>;
|
|
670
|
+
firstKey(): PromiseExtended<IndexableType | undefined>;
|
|
570
671
|
keys(): PromiseExtended<IndexableTypeArray>;
|
|
571
|
-
keys<R>(thenShortcut: ThenShortcut<IndexableTypeArray, R>): PromiseExtended<R>;
|
|
672
|
+
keys<R$1>(thenShortcut: ThenShortcut<IndexableTypeArray, R$1>): PromiseExtended<R$1>;
|
|
572
673
|
primaryKeys(): PromiseExtended<TKey[]>;
|
|
573
|
-
primaryKeys<R>(thenShortcut: ThenShortcut<TKey[], R>): PromiseExtended<R>;
|
|
674
|
+
primaryKeys<R$1>(thenShortcut: ThenShortcut<TKey[], R$1>): PromiseExtended<R$1>;
|
|
574
675
|
last(): PromiseExtended<T | undefined>;
|
|
575
|
-
last<R>(thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
676
|
+
last<R$1>(thenShortcut: ThenShortcut<T | undefined, R$1>): PromiseExtended<R$1>;
|
|
677
|
+
lastKey(): PromiseExtended<IndexableType | undefined>;
|
|
678
|
+
limit(n: number): Collection<T, TKey, TInsertType>;
|
|
679
|
+
offset(n: number): Collection<T, TKey, TInsertType>;
|
|
680
|
+
or(indexOrPrimayKey: string): WhereClause<T, TKey, TInsertType>;
|
|
681
|
+
raw(): Collection<T, TKey, TInsertType>;
|
|
682
|
+
reverse(): Collection<T, TKey, TInsertType>;
|
|
581
683
|
sortBy(keyPath: string): PromiseExtended<T[]>;
|
|
582
|
-
sortBy<R>(keyPath: string, thenShortcut: ThenShortcut<T[], R>): PromiseExtended<R>;
|
|
684
|
+
sortBy<R$1>(keyPath: string, thenShortcut: ThenShortcut<T[], R$1>): PromiseExtended<R$1>;
|
|
583
685
|
toArray(): PromiseExtended<Array<T>>;
|
|
584
|
-
toArray<R>(thenShortcut: ThenShortcut<T[], R>): PromiseExtended<R>;
|
|
686
|
+
toArray<R$1>(thenShortcut: ThenShortcut<T[], R$1>): PromiseExtended<R$1>;
|
|
585
687
|
uniqueKeys(): PromiseExtended<IndexableTypeArray>;
|
|
586
|
-
uniqueKeys<R>(thenShortcut: ThenShortcut<IndexableTypeArray, R>): PromiseExtended<R>;
|
|
587
|
-
until(filter: (value: T) => boolean, includeStopEntry?: boolean): Collection<T, TKey>;
|
|
688
|
+
uniqueKeys<R$1>(thenShortcut: ThenShortcut<IndexableTypeArray, R$1>): PromiseExtended<R$1>;
|
|
689
|
+
until(filter: (value: T) => boolean, includeStopEntry?: boolean): Collection<T, TKey, TInsertType>;
|
|
588
690
|
// Mutating methods
|
|
589
691
|
delete(): PromiseExtended<number>;
|
|
590
692
|
modify(changeCallback: (obj: T, ctx: {
|
|
591
|
-
value:
|
|
693
|
+
value: TInsertType;
|
|
592
694
|
}) => void | boolean): PromiseExtended<number>;
|
|
593
|
-
modify(changes:
|
|
594
|
-
[keyPath: string]: any;
|
|
595
|
-
}): PromiseExtended<number>;
|
|
596
|
-
}
|
|
597
|
-
interface WhereClause<T = any, TKey = IndexableType> {
|
|
598
|
-
above(key: any): Collection<T, TKey>;
|
|
599
|
-
aboveOrEqual(key: any): Collection<T, TKey>;
|
|
600
|
-
anyOf(keys: ReadonlyArray<IndexableType>): Collection<T, TKey>;
|
|
601
|
-
anyOf(...keys: Array<IndexableType>): Collection<T, TKey>;
|
|
602
|
-
anyOfIgnoreCase(keys: string[]): Collection<T, TKey>;
|
|
603
|
-
anyOfIgnoreCase(...keys: string[]): Collection<T, TKey>;
|
|
604
|
-
below(key: any): Collection<T, TKey>;
|
|
605
|
-
belowOrEqual(key: any): Collection<T, TKey>;
|
|
606
|
-
between(lower: any, upper: any, includeLower?: boolean, includeUpper?: boolean): Collection<T, TKey>;
|
|
607
|
-
equals(key: IndexableType): Collection<T, TKey>;
|
|
608
|
-
equalsIgnoreCase(key: string): Collection<T, TKey>;
|
|
609
|
-
inAnyRange(ranges: ReadonlyArray<{
|
|
610
|
-
0: any;
|
|
611
|
-
1: any;
|
|
612
|
-
}>, options?: {
|
|
613
|
-
includeLowers?: boolean;
|
|
614
|
-
includeUppers?: boolean;
|
|
615
|
-
}): Collection<T, TKey>;
|
|
616
|
-
startsWith(key: string): Collection<T, TKey>;
|
|
617
|
-
startsWithAnyOf(prefixes: string[]): Collection<T, TKey>;
|
|
618
|
-
startsWithAnyOf(...prefixes: string[]): Collection<T, TKey>;
|
|
619
|
-
startsWithIgnoreCase(key: string): Collection<T, TKey>;
|
|
620
|
-
startsWithAnyOfIgnoreCase(prefixes: string[]): Collection<T, TKey>;
|
|
621
|
-
startsWithAnyOfIgnoreCase(...prefixes: string[]): Collection<T, TKey>;
|
|
622
|
-
noneOf(keys: ReadonlyArray<IndexableType>): Collection<T, TKey>;
|
|
623
|
-
notEqual(key: IndexableType): Collection<T, TKey>;
|
|
624
|
-
}
|
|
625
|
-
interface Database {
|
|
626
|
-
readonly name: string;
|
|
627
|
-
readonly tables: Table[];
|
|
628
|
-
table<T = any, TKey = any>(tableName: string): Table<T, TKey>;
|
|
629
|
-
transaction<U>(mode: TransactionMode, table: Table, scope: () => PromiseLike<U> | U): PromiseExtended<U>;
|
|
630
|
-
transaction<U>(mode: TransactionMode, table: Table, table2: Table, scope: () => PromiseLike<U> | U): PromiseExtended<U>;
|
|
631
|
-
transaction<U>(mode: TransactionMode, table: Table, table2: Table, table3: Table, scope: () => PromiseLike<U> | U): PromiseExtended<U>;
|
|
632
|
-
transaction<U>(mode: TransactionMode, table: Table, table2: Table, table3: Table, table4: Table, scope: () => PromiseLike<U> | U): PromiseExtended<U>;
|
|
633
|
-
transaction<U>(mode: TransactionMode, table: Table, table2: Table, table3: Table, table4: Table, table5: Table, scope: () => PromiseLike<U> | U): PromiseExtended<U>;
|
|
634
|
-
transaction<U>(mode: TransactionMode, tables: Table[], scope: () => PromiseLike<U> | U): PromiseExtended<U>;
|
|
695
|
+
modify(changes: UpdateSpec<TInsertType>): PromiseExtended<number>;
|
|
635
696
|
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
697
|
+
type IntervalTree = IntervalTreeNode | EmptyRange;
|
|
698
|
+
interface IntervalTreeNode {
|
|
699
|
+
from: IndexableType; // lower bound
|
|
700
|
+
to: IndexableType; // upper bound
|
|
701
|
+
l?: IntervalTreeNode | null; // left
|
|
702
|
+
r?: IntervalTreeNode | null; // right
|
|
703
|
+
d: number; // depth
|
|
643
704
|
}
|
|
644
|
-
interface
|
|
645
|
-
|
|
646
|
-
active: boolean;
|
|
647
|
-
mode: IDBTransactionMode;
|
|
648
|
-
//tables: { [type: string]: Table<any, any> }; Deprecated since 2.0. Obsolete from v3.0.
|
|
649
|
-
storeNames: Array<string>;
|
|
650
|
-
parent?: Transaction;
|
|
651
|
-
on: TransactionEvents;
|
|
652
|
-
abort(): void;
|
|
653
|
-
table(tableName: string): Table<any, any>;
|
|
654
|
-
table<T>(tableName: string): Table<T, any>;
|
|
655
|
-
table<T, Key>(tableName: string): Table<T, Key>;
|
|
705
|
+
interface EmptyRange {
|
|
706
|
+
d: 0;
|
|
656
707
|
}
|
|
657
|
-
interface
|
|
658
|
-
|
|
659
|
-
|
|
708
|
+
interface DexieOnReadyEvent {
|
|
709
|
+
subscribe(fn: (vipDb: Dexie) => any, bSticky: boolean): void;
|
|
710
|
+
unsubscribe(fn: (vipDb: Dexie) => any): void;
|
|
711
|
+
fire(vipDb: Dexie): any;
|
|
660
712
|
}
|
|
661
|
-
interface
|
|
662
|
-
|
|
663
|
-
|
|
713
|
+
interface DexieVersionChangeEvent {
|
|
714
|
+
subscribe(fn: (event: IDBVersionChangeEvent) => any): void;
|
|
715
|
+
unsubscribe(fn: (event: IDBVersionChangeEvent) => any): void;
|
|
716
|
+
fire(event: IDBVersionChangeEvent): any;
|
|
664
717
|
}
|
|
665
|
-
interface
|
|
666
|
-
|
|
667
|
-
|
|
718
|
+
interface DexiePopulateEvent {
|
|
719
|
+
subscribe(fn: (trans: Transaction) => any): void;
|
|
720
|
+
unsubscribe(fn: (trans: Transaction) => any): void;
|
|
721
|
+
fire(trans: Transaction): any;
|
|
668
722
|
}
|
|
669
|
-
interface
|
|
670
|
-
(
|
|
671
|
-
(
|
|
672
|
-
(
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
723
|
+
interface DexieCloseEvent {
|
|
724
|
+
subscribe(fn: (event: Event) => any): void;
|
|
725
|
+
unsubscribe(fn: (event: Event) => any): void;
|
|
726
|
+
fire(event: Event): any;
|
|
727
|
+
}
|
|
728
|
+
interface DbEventFns {
|
|
729
|
+
(eventName: "populate", subscriber: (trans: Transaction) => any): void;
|
|
730
|
+
(eventName: "blocked", subscriber: (event: IDBVersionChangeEvent) => any): void;
|
|
731
|
+
(eventName: "versionchange", subscriber: (event: IDBVersionChangeEvent) => any): void;
|
|
732
|
+
(eventName: "close", subscriber: (event: Event) => any): void;
|
|
733
|
+
}
|
|
734
|
+
interface DbEvents extends DbEventFns, DexieEventSet {
|
|
735
|
+
(eventName: "ready", subscriber: (vipDb: Dexie) => any, bSticky?: boolean): void;
|
|
736
|
+
ready: DexieOnReadyEvent;
|
|
737
|
+
populate: DexiePopulateEvent;
|
|
738
|
+
blocked: DexieEvent;
|
|
739
|
+
versionchange: DexieVersionChangeEvent;
|
|
740
|
+
close: DexieCloseEvent;
|
|
741
|
+
}
|
|
742
|
+
/** Set of mutated parts of the database
|
|
743
|
+
*/
|
|
744
|
+
type ObservabilitySet = {
|
|
745
|
+
/** Database part having been mutated.
|
|
746
|
+
*
|
|
747
|
+
* This structure is produced in observability-middleware.ts
|
|
748
|
+
* and consumed in live-query.ts.
|
|
749
|
+
*
|
|
750
|
+
* Format of 'part':
|
|
751
|
+
*
|
|
752
|
+
* `idb://${dbName}/${tableName}/${indexName}`
|
|
753
|
+
*
|
|
754
|
+
* * dbName is the database name
|
|
755
|
+
* * tableName is the table name
|
|
756
|
+
* * indexName is any of:
|
|
757
|
+
* 1. An empty string - represents the primary keys of the affected objs
|
|
758
|
+
* 2. ":dels" - represents primary keys of deleted objects in the table
|
|
759
|
+
* 3. The keyPath of an index, such as "name", "age" or "address.city" -
|
|
760
|
+
* represents indexes that, if used in a query, might affect the
|
|
761
|
+
* result of that query.
|
|
762
|
+
*
|
|
763
|
+
* IntervalTree
|
|
764
|
+
* * See definition of IntervalTree type in rangeset.d.ts
|
|
765
|
+
* * See rangesOverlap() in rangeset.ts that can be used to compare two
|
|
766
|
+
* IntervalTrees and detect collissions.
|
|
767
|
+
* * See RangeSet class that can be used to create an IntervalTree and add
|
|
768
|
+
* ranges to it.
|
|
769
|
+
*/
|
|
770
|
+
[part: string]: IntervalTree;
|
|
771
|
+
};
|
|
772
|
+
interface DexieOnStorageMutatedEvent {
|
|
773
|
+
subscribe(fn: (parts: ObservabilitySet) => any): void;
|
|
774
|
+
unsubscribe(fn: (parts: ObservabilitySet) => any): void;
|
|
775
|
+
fire(parts: ObservabilitySet): any;
|
|
776
|
+
}
|
|
777
|
+
interface GlobalDexieEvents extends DexieEventSet {
|
|
778
|
+
(eventName: "storagemutated", subscriber: (parts: ObservabilitySet) => any): void;
|
|
779
|
+
storagemutated: DexieOnStorageMutatedEvent;
|
|
678
780
|
}
|
|
679
781
|
declare const enum DBCoreRangeType {
|
|
680
782
|
Equal = 1,
|
|
@@ -702,21 +804,24 @@ interface DBCoreMutateResponse {
|
|
|
702
804
|
[operationNumber: number]: Error;
|
|
703
805
|
};
|
|
704
806
|
lastResult: any;
|
|
705
|
-
results?: any[]; //
|
|
807
|
+
results?: any[]; // Always present on responses to AddRequest and PutRequest.
|
|
706
808
|
}
|
|
707
809
|
interface DBCoreAddRequest {
|
|
708
810
|
type: "add";
|
|
709
811
|
trans: DBCoreTransaction;
|
|
710
|
-
values: any[];
|
|
812
|
+
values: readonly any[];
|
|
711
813
|
keys?: any[];
|
|
814
|
+
mutatedParts?: ObservabilitySet;
|
|
712
815
|
/** @deprecated Will always get results since 3.1.0-alpha.5 */
|
|
713
816
|
wantResults?: boolean;
|
|
714
817
|
}
|
|
715
818
|
interface DBCorePutRequest {
|
|
716
819
|
type: "put";
|
|
717
820
|
trans: DBCoreTransaction;
|
|
718
|
-
values: any[];
|
|
821
|
+
values: readonly any[];
|
|
719
822
|
keys?: any[];
|
|
823
|
+
mutatedParts?: ObservabilitySet;
|
|
824
|
+
upsert?: boolean; // If true, will insert the object if it does not exist. If false, will only update existing objects using the 'updates' property.
|
|
720
825
|
criteria?: {
|
|
721
826
|
index: string | null;
|
|
722
827
|
range: DBCoreKeyRange;
|
|
@@ -724,9 +829,13 @@ interface DBCorePutRequest {
|
|
|
724
829
|
changeSpec?: {
|
|
725
830
|
[keyPath: string]: any;
|
|
726
831
|
}; // Common changeSpec for each key
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
832
|
+
isAdditionalChunk?: boolean;
|
|
833
|
+
updates?: {
|
|
834
|
+
keys: any[];
|
|
835
|
+
changeSpecs: {
|
|
836
|
+
[keyPath: string]: any;
|
|
837
|
+
}[]; // changeSpec per key.
|
|
838
|
+
};
|
|
730
839
|
/** @deprecated Will always get results since 3.1.0-alpha.5 */
|
|
731
840
|
wantResults?: boolean;
|
|
732
841
|
}
|
|
@@ -734,24 +843,29 @@ interface DBCoreDeleteRequest {
|
|
|
734
843
|
type: "delete";
|
|
735
844
|
trans: DBCoreTransaction;
|
|
736
845
|
keys: any[];
|
|
846
|
+
mutatedParts?: ObservabilitySet;
|
|
737
847
|
criteria?: {
|
|
738
848
|
index: string | null;
|
|
739
849
|
range: DBCoreKeyRange;
|
|
740
850
|
};
|
|
851
|
+
isAdditionalChunk?: boolean;
|
|
741
852
|
}
|
|
742
853
|
interface DBCoreDeleteRangeRequest {
|
|
743
854
|
type: "deleteRange";
|
|
744
855
|
trans: DBCoreTransaction;
|
|
745
856
|
range: DBCoreKeyRange;
|
|
857
|
+
mutatedParts?: ObservabilitySet;
|
|
746
858
|
}
|
|
747
859
|
interface DBCoreGetManyRequest {
|
|
748
860
|
trans: DBCoreTransaction;
|
|
749
861
|
keys: any[];
|
|
750
862
|
cache?: "immutable" | "clone";
|
|
863
|
+
obsSet?: ObservabilitySet;
|
|
751
864
|
}
|
|
752
865
|
interface DBCoreGetRequest {
|
|
753
866
|
trans: DBCoreTransaction;
|
|
754
867
|
key: any;
|
|
868
|
+
obsSet?: ObservabilitySet;
|
|
755
869
|
}
|
|
756
870
|
interface DBCoreQuery {
|
|
757
871
|
index: DBCoreIndex; //keyPath: null | string | string[]; // null represents primary key. string a property, string[] several properties.
|
|
@@ -762,6 +876,7 @@ interface DBCoreQueryRequest {
|
|
|
762
876
|
values?: boolean;
|
|
763
877
|
limit?: number;
|
|
764
878
|
query: DBCoreQuery;
|
|
879
|
+
obsSet?: ObservabilitySet;
|
|
765
880
|
}
|
|
766
881
|
interface DBCoreQueryResponse {
|
|
767
882
|
result: any[];
|
|
@@ -772,10 +887,12 @@ interface DBCoreOpenCursorRequest {
|
|
|
772
887
|
unique?: boolean;
|
|
773
888
|
reverse?: boolean;
|
|
774
889
|
query: DBCoreQuery;
|
|
890
|
+
obsSet?: ObservabilitySet;
|
|
775
891
|
}
|
|
776
892
|
interface DBCoreCountRequest {
|
|
777
893
|
trans: DBCoreTransaction;
|
|
778
894
|
query: DBCoreQuery;
|
|
895
|
+
obsSet?: ObservabilitySet;
|
|
779
896
|
}
|
|
780
897
|
interface DBCoreCursor {
|
|
781
898
|
readonly trans: DBCoreTransaction;
|
|
@@ -820,6 +937,8 @@ interface DBCoreIndex {
|
|
|
820
937
|
readonly multiEntry?: boolean;
|
|
821
938
|
/** Extract (using keyPath) a key from given value (object). Null for outbound primary keys */
|
|
822
939
|
readonly extractKey: ((value: any) => any) | null;
|
|
940
|
+
/** If this index is a virtual index, lowLevelIndex represents the actual IndexedDB index behind it */
|
|
941
|
+
readonly lowLevelIndex?: DBCoreIndex;
|
|
823
942
|
}
|
|
824
943
|
interface DBCore {
|
|
825
944
|
stack: "dbcore";
|
|
@@ -841,133 +960,91 @@ interface DBCoreTable {
|
|
|
841
960
|
openCursor(req: DBCoreOpenCursorRequest): Promise<DBCoreCursor | null>;
|
|
842
961
|
count(req: DBCoreCountRequest): Promise<number>;
|
|
843
962
|
}
|
|
844
|
-
interface Table<T = any, TKey =
|
|
845
|
-
db:
|
|
963
|
+
interface Table<T = any, TKey = any, TInsertType = T> {
|
|
964
|
+
db: Dexie;
|
|
846
965
|
name: string;
|
|
847
966
|
schema: TableSchema;
|
|
848
|
-
hook: TableHooks<T, TKey>;
|
|
967
|
+
hook: TableHooks<T, TKey, TInsertType>;
|
|
849
968
|
core: DBCoreTable;
|
|
850
969
|
get(key: TKey): PromiseExtended<T | undefined>;
|
|
851
|
-
get<R>(key: TKey, thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
970
|
+
get<R$1>(key: TKey, thenShortcut: ThenShortcut<T | undefined, R$1>): PromiseExtended<R$1>;
|
|
852
971
|
get(equalityCriterias: {
|
|
853
972
|
[key: string]: any;
|
|
854
973
|
}): PromiseExtended<T | undefined>;
|
|
855
|
-
get<R>(equalityCriterias: {
|
|
974
|
+
get<R$1>(equalityCriterias: {
|
|
856
975
|
[key: string]: any;
|
|
857
|
-
}, thenShortcut: ThenShortcut<T | undefined, R>): PromiseExtended<R>;
|
|
858
|
-
where(index: string | string[]): WhereClause<T, TKey>;
|
|
976
|
+
}, thenShortcut: ThenShortcut<T | undefined, R$1>): PromiseExtended<R$1>;
|
|
977
|
+
where(index: string | string[]): WhereClause<T, TKey, TInsertType>;
|
|
859
978
|
where(equalityCriterias: {
|
|
860
979
|
[key: string]: any;
|
|
861
|
-
}): Collection<T, TKey>;
|
|
862
|
-
filter(fn: (obj: T) => boolean): Collection<T, TKey>;
|
|
980
|
+
}): Collection<T, TKey, TInsertType>;
|
|
981
|
+
filter(fn: (obj: T) => boolean): Collection<T, TKey, TInsertType>;
|
|
863
982
|
count(): PromiseExtended<number>;
|
|
864
|
-
count<R>(thenShortcut: ThenShortcut<number, R>): PromiseExtended<R>;
|
|
865
|
-
offset(n: number): Collection<T, TKey>;
|
|
866
|
-
limit(n: number): Collection<T, TKey>;
|
|
983
|
+
count<R$1>(thenShortcut: ThenShortcut<number, R$1>): PromiseExtended<R$1>;
|
|
984
|
+
offset(n: number): Collection<T, TKey, TInsertType>;
|
|
985
|
+
limit(n: number): Collection<T, TKey, TInsertType>;
|
|
867
986
|
each(callback: (obj: T, cursor: {
|
|
868
987
|
key: any;
|
|
869
988
|
primaryKey: TKey;
|
|
870
989
|
}) => any): PromiseExtended<void>;
|
|
871
990
|
toArray(): PromiseExtended<Array<T>>;
|
|
872
|
-
toArray<R>(thenShortcut: ThenShortcut<T[], R>): PromiseExtended<R>;
|
|
873
|
-
toCollection(): Collection<T, TKey>;
|
|
874
|
-
orderBy(index: string | string[]): Collection<T, TKey>;
|
|
875
|
-
reverse(): Collection<T, TKey>;
|
|
991
|
+
toArray<R$1>(thenShortcut: ThenShortcut<T[], R$1>): PromiseExtended<R$1>;
|
|
992
|
+
toCollection(): Collection<T, TKey, TInsertType>;
|
|
993
|
+
orderBy(index: string | string[]): Collection<T, TKey, TInsertType>;
|
|
994
|
+
reverse(): Collection<T, TKey, TInsertType>;
|
|
876
995
|
mapToClass(constructor: Function): Function;
|
|
877
|
-
add(item:
|
|
878
|
-
update(key: TKey | T, changes: {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
996
|
+
add(item: TInsertType, key?: TKey): PromiseExtended<TKey>;
|
|
997
|
+
update(key: TKey | T, changes: UpdateSpec<TInsertType> | ((obj: T, ctx: {
|
|
998
|
+
value: any;
|
|
999
|
+
primKey: IndexableType;
|
|
1000
|
+
}) => void | boolean)): PromiseExtended<number>;
|
|
1001
|
+
upsert(key: TKey | T, changes: UpdateSpec<TInsertType>): PromiseExtended<boolean>;
|
|
1002
|
+
put(item: TInsertType, key?: TKey): PromiseExtended<TKey>;
|
|
882
1003
|
delete(key: TKey): PromiseExtended<void>;
|
|
883
1004
|
clear(): PromiseExtended<void>;
|
|
884
1005
|
bulkGet(keys: TKey[]): PromiseExtended<(T | undefined)[]>;
|
|
885
|
-
bulkAdd<B extends boolean>(items: readonly
|
|
1006
|
+
bulkAdd<B extends boolean>(items: readonly TInsertType[], keys: IndexableTypeArrayReadonly, options: {
|
|
886
1007
|
allKeys: B;
|
|
887
1008
|
}): PromiseExtended<B extends true ? TKey[] : TKey>;
|
|
888
|
-
bulkAdd<B extends boolean>(items: readonly
|
|
1009
|
+
bulkAdd<B extends boolean>(items: readonly TInsertType[], options: {
|
|
889
1010
|
allKeys: B;
|
|
890
1011
|
}): PromiseExtended<B extends true ? TKey[] : TKey>;
|
|
891
|
-
bulkAdd(items: readonly
|
|
1012
|
+
bulkAdd(items: readonly TInsertType[], keys?: IndexableTypeArrayReadonly, options?: {
|
|
892
1013
|
allKeys: boolean;
|
|
893
1014
|
}): PromiseExtended<TKey>;
|
|
894
|
-
bulkPut<B extends boolean>(items: readonly
|
|
1015
|
+
bulkPut<B extends boolean>(items: readonly TInsertType[], keys: IndexableTypeArrayReadonly, options: {
|
|
895
1016
|
allKeys: B;
|
|
896
1017
|
}): PromiseExtended<B extends true ? TKey[] : TKey>;
|
|
897
|
-
bulkPut<B extends boolean>(items: readonly
|
|
1018
|
+
bulkPut<B extends boolean>(items: readonly TInsertType[], options: {
|
|
898
1019
|
allKeys: B;
|
|
899
1020
|
}): PromiseExtended<B extends true ? TKey[] : TKey>;
|
|
900
|
-
bulkPut(items: readonly
|
|
1021
|
+
bulkPut(items: readonly TInsertType[], keys?: IndexableTypeArrayReadonly, options?: {
|
|
901
1022
|
allKeys: boolean;
|
|
902
1023
|
}): PromiseExtended<TKey>;
|
|
1024
|
+
bulkUpdate(keysAndChanges: ReadonlyArray<{
|
|
1025
|
+
key: TKey;
|
|
1026
|
+
changes: UpdateSpec<T>;
|
|
1027
|
+
}>): PromiseExtended<number>;
|
|
903
1028
|
bulkDelete(keys: TKey[]): PromiseExtended<void>;
|
|
904
1029
|
}
|
|
1030
|
+
type DbSchema = {
|
|
1031
|
+
[tableName: string]: TableSchema;
|
|
1032
|
+
};
|
|
905
1033
|
interface Version {
|
|
906
1034
|
stores(schema: {
|
|
907
1035
|
[tableName: string]: string | null;
|
|
908
1036
|
}): Version;
|
|
909
1037
|
upgrade(fn: (trans: Transaction) => PromiseLike<any> | void): Version;
|
|
910
1038
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
}
|
|
919
|
-
interface EmptyRange {
|
|
920
|
-
d: 0;
|
|
921
|
-
}
|
|
922
|
-
interface DexieOnReadyEvent {
|
|
923
|
-
subscribe(fn: (vipDb: Dexie) => any, bSticky: boolean): void;
|
|
924
|
-
unsubscribe(fn: (vipDb: Dexie) => any): void;
|
|
925
|
-
fire(vipDb: Dexie): any;
|
|
926
|
-
}
|
|
927
|
-
interface DexieVersionChangeEvent {
|
|
928
|
-
subscribe(fn: (event: IDBVersionChangeEvent) => any): void;
|
|
929
|
-
unsubscribe(fn: (event: IDBVersionChangeEvent) => any): void;
|
|
930
|
-
fire(event: IDBVersionChangeEvent): any;
|
|
931
|
-
}
|
|
932
|
-
interface DexiePopulateEvent {
|
|
933
|
-
subscribe(fn: (trans: Transaction) => any): void;
|
|
934
|
-
unsubscribe(fn: (trans: Transaction) => any): void;
|
|
935
|
-
fire(trans: Transaction): any;
|
|
936
|
-
}
|
|
937
|
-
interface DexieCloseEvent {
|
|
938
|
-
subscribe(fn: (event: Event) => any): void;
|
|
939
|
-
unsubscribe(fn: (event: Event) => any): void;
|
|
940
|
-
fire(event: Event): any;
|
|
941
|
-
}
|
|
942
|
-
interface DbEvents extends DexieEventSet {
|
|
943
|
-
(eventName: "ready", subscriber: (vipDb: Dexie) => any, bSticky?: boolean): void;
|
|
944
|
-
(eventName: "populate", subscriber: (trans: Transaction) => any): void;
|
|
945
|
-
(eventName: "blocked", subscriber: (event: IDBVersionChangeEvent) => any): void;
|
|
946
|
-
(eventName: "versionchange", subscriber: (event: IDBVersionChangeEvent) => any): void;
|
|
947
|
-
(eventName: "close", subscriber: (event: Event) => any): void;
|
|
948
|
-
ready: DexieOnReadyEvent;
|
|
949
|
-
populate: DexiePopulateEvent;
|
|
950
|
-
blocked: DexieEvent;
|
|
951
|
-
versionchange: DexieVersionChangeEvent;
|
|
952
|
-
close: DexieCloseEvent;
|
|
953
|
-
}
|
|
954
|
-
type ObservabilitySet = {
|
|
955
|
-
// `idb:${dbName}/${tableName}/changedRowContents` - keys.
|
|
956
|
-
// `idb:${dbName}/${tableName}/changedIndexes/${indexName}` - indexes
|
|
957
|
-
[part: string]: IntervalTree;
|
|
958
|
-
};
|
|
959
|
-
interface DexieOnStorageMutatedEvent {
|
|
960
|
-
subscribe(fn: (parts: ObservabilitySet) => any): void;
|
|
961
|
-
unsubscribe(fn: (parts: ObservabilitySet) => any): void;
|
|
962
|
-
fire(parts: ObservabilitySet): any;
|
|
963
|
-
}
|
|
964
|
-
interface GlobalDexieEvents extends DexieEventSet {
|
|
965
|
-
(eventName: "storagemutated", subscriber: (parts: ObservabilitySet) => any): void;
|
|
966
|
-
storagemutated: DexieOnStorageMutatedEvent;
|
|
1039
|
+
interface ExtendableVersion extends Version {
|
|
1040
|
+
db: Dexie;
|
|
1041
|
+
_parseStoresSpec(stores: {
|
|
1042
|
+
[tableName: string]: string | null;
|
|
1043
|
+
}, outSchema: DbSchema): void;
|
|
1044
|
+
_createTableSchema(tableName: string, primKey: IndexSpec, indexes: IndexSpec[]): TableSchema;
|
|
1045
|
+
_parseIndexSyntax(primKeyAndIndexes: string): IndexSpec[];
|
|
967
1046
|
}
|
|
968
|
-
type
|
|
969
|
-
[tableName: string]: TableSchema;
|
|
970
|
-
};
|
|
1047
|
+
type TransactionMode = "readonly" | "readwrite" | "r" | "r!" | "r?" | "rw" | "rw!" | "rw?";
|
|
971
1048
|
interface Middleware<TStack extends {
|
|
972
1049
|
stack: string;
|
|
973
1050
|
}> {
|
|
@@ -979,7 +1056,16 @@ interface Middleware<TStack extends {
|
|
|
979
1056
|
interface DexieStacks {
|
|
980
1057
|
dbcore: DBCore;
|
|
981
1058
|
}
|
|
982
|
-
|
|
1059
|
+
type TableProp<DX> = { [K in keyof DX]: DX[K] extends {
|
|
1060
|
+
schema: any;
|
|
1061
|
+
get: any;
|
|
1062
|
+
put: any;
|
|
1063
|
+
add: any;
|
|
1064
|
+
where: any;
|
|
1065
|
+
} ? K : never }[keyof DX] & string;
|
|
1066
|
+
type TXWithTables<DX extends Dexie> = Dexie extends DX ? Transaction // If not subclassed, just expect a Transaction without table props
|
|
1067
|
+
: Transaction & { [P in TableProp<DX>]: DX[P] };
|
|
1068
|
+
interface Dexie {
|
|
983
1069
|
readonly name: string;
|
|
984
1070
|
readonly tables: Table[];
|
|
985
1071
|
readonly verno: number;
|
|
@@ -987,27 +1073,28 @@ interface Dexie extends Database {
|
|
|
987
1073
|
readonly _allTables: {
|
|
988
1074
|
[name: string]: Table<any, IndexableType>;
|
|
989
1075
|
};
|
|
1076
|
+
readonly _options: DexieOptions;
|
|
990
1077
|
readonly core: DBCore;
|
|
991
1078
|
_createTransaction: (this: Dexie, mode: IDBTransactionMode, storeNames: ArrayLike<string>, dbschema: DbSchema, parentTransaction?: Transaction | null) => Transaction;
|
|
1079
|
+
readonly _novip: Dexie;
|
|
992
1080
|
_dbSchema: DbSchema;
|
|
993
1081
|
version(versionNumber: number): Version;
|
|
994
1082
|
on: DbEvents;
|
|
1083
|
+
once: DbEventFns;
|
|
995
1084
|
open(): PromiseExtended<Dexie>;
|
|
996
|
-
table<T = any, TKey = IndexableType>(tableName: string): Table<T, TKey>;
|
|
997
|
-
transaction<U>(mode: TransactionMode,
|
|
998
|
-
transaction<U>(mode: TransactionMode, table: string, scope: (trans:
|
|
999
|
-
transaction<U>(mode: TransactionMode, table: Table, table2: Table, scope: (trans:
|
|
1000
|
-
transaction<U>(mode: TransactionMode, table: string, table2: string, scope: (trans:
|
|
1001
|
-
transaction<U>(mode: TransactionMode, table: Table, table2: Table, table3: Table, scope: (trans:
|
|
1002
|
-
transaction<U>(mode: TransactionMode, table: string, table2: string, table3: string, scope: (trans:
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
close(): void;
|
|
1010
|
-
delete(): PromiseExtended<void>;
|
|
1085
|
+
table<T = any, TKey = IndexableType, TInsertType = T>(tableName: string): Table<T, TKey, TInsertType>;
|
|
1086
|
+
transaction<U>(mode: TransactionMode, tables: readonly (string | Table)[], scope: (trans: TXWithTables<this>) => PromiseLike<U> | U): PromiseExtended<U>;
|
|
1087
|
+
transaction<U>(mode: TransactionMode, table: string | Table, scope: (trans: TXWithTables<this>) => PromiseLike<U> | U): PromiseExtended<U>;
|
|
1088
|
+
transaction<U>(mode: TransactionMode, table: string | Table, table2: string | Table, scope: (trans: TXWithTables<this>) => PromiseLike<U> | U): PromiseExtended<U>;
|
|
1089
|
+
transaction<U>(mode: TransactionMode, table: string | Table, table2: string | Table, table3: string | Table, scope: (trans: TXWithTables<this>) => PromiseLike<U> | U): PromiseExtended<U>;
|
|
1090
|
+
transaction<U>(mode: TransactionMode, table: string | Table, table2: string | Table, table3: string | Table, table4: string | Table, scope: (trans: TXWithTables<this>) => PromiseLike<U> | U): PromiseExtended<U>;
|
|
1091
|
+
transaction<U>(mode: TransactionMode, table: string | Table, table2: string | Table, table3: string | Table, table5: string | Table, scope: (trans: TXWithTables<this>) => PromiseLike<U> | U): PromiseExtended<U>;
|
|
1092
|
+
close(closeOptions?: {
|
|
1093
|
+
disableAutoOpen: boolean;
|
|
1094
|
+
}): void;
|
|
1095
|
+
delete(closeOptions?: {
|
|
1096
|
+
disableAutoOpen: boolean;
|
|
1097
|
+
}): PromiseExtended<void>;
|
|
1011
1098
|
isOpen(): boolean;
|
|
1012
1099
|
hasBeenClosed(): boolean;
|
|
1013
1100
|
hasFailed(): boolean;
|
|
@@ -1036,8 +1123,8 @@ interface Dexie extends Database {
|
|
|
1036
1123
|
WhereClause: {
|
|
1037
1124
|
prototype: WhereClause;
|
|
1038
1125
|
};
|
|
1039
|
-
Version: {
|
|
1040
|
-
prototype:
|
|
1126
|
+
Version: Function & {
|
|
1127
|
+
prototype: ExtendableVersion;
|
|
1041
1128
|
};
|
|
1042
1129
|
Transaction: {
|
|
1043
1130
|
prototype: Transaction;
|
|
@@ -1184,6 +1271,7 @@ interface DexieDOMDependencies {
|
|
|
1184
1271
|
indexedDB: IDBFactory;
|
|
1185
1272
|
IDBKeyRange: typeof IDBKeyRange;
|
|
1186
1273
|
}
|
|
1274
|
+
// There typings are extracted from https://github.com/tc39/proposal-observable
|
|
1187
1275
|
declare global {
|
|
1188
1276
|
interface SymbolConstructor {
|
|
1189
1277
|
readonly observable: symbol;
|
|
@@ -1212,6 +1300,40 @@ interface Observer<T = any> {
|
|
|
1212
1300
|
error?: (error: any) => void;
|
|
1213
1301
|
complete?: () => void;
|
|
1214
1302
|
}
|
|
1303
|
+
type GlobalQueryCache = {
|
|
1304
|
+
// TODO: Change to parts: {[part: string]: TblQueryCache}
|
|
1305
|
+
// och unsignaledParts: ObservabilitySet;
|
|
1306
|
+
[part: string]: TblQueryCache; // part is `idb://${dbName}/${tableName}`
|
|
1307
|
+
};
|
|
1308
|
+
interface TblQueryCache {
|
|
1309
|
+
queries: {
|
|
1310
|
+
query: {
|
|
1311
|
+
[indexName: string]: CacheEntry[];
|
|
1312
|
+
};
|
|
1313
|
+
count: {
|
|
1314
|
+
[indexName: string]: CacheEntry[];
|
|
1315
|
+
};
|
|
1316
|
+
};
|
|
1317
|
+
objs: Map<string | number, object>;
|
|
1318
|
+
optimisticOps: DBCoreMutateRequest[];
|
|
1319
|
+
unsignaledParts: ObservabilitySet;
|
|
1320
|
+
}
|
|
1321
|
+
interface CacheEntryCommon {
|
|
1322
|
+
subscribers: Set<() => void>;
|
|
1323
|
+
obsSet: ObservabilitySet;
|
|
1324
|
+
//txObsSet: ObservabilitySet;
|
|
1325
|
+
promise: Promise<any>;
|
|
1326
|
+
dirty: boolean;
|
|
1327
|
+
}
|
|
1328
|
+
type CacheEntry = CacheEntryCommon & ({
|
|
1329
|
+
type: "query";
|
|
1330
|
+
req: DBCoreQueryRequest;
|
|
1331
|
+
res?: readonly any[];
|
|
1332
|
+
} | {
|
|
1333
|
+
type: "count";
|
|
1334
|
+
req: DBCoreCountRequest;
|
|
1335
|
+
res?: number;
|
|
1336
|
+
});
|
|
1215
1337
|
type ChromeTransactionDurability = "default" | "strict" | "relaxed";
|
|
1216
1338
|
interface DexieOptions {
|
|
1217
1339
|
addons?: Array<(db: Dexie) => void>;
|
|
@@ -1225,27 +1347,31 @@ interface DexieOptions {
|
|
|
1225
1347
|
upperBound: Function;
|
|
1226
1348
|
};
|
|
1227
1349
|
allowEmptyDB?: boolean;
|
|
1228
|
-
modifyChunkSize?: number
|
|
1350
|
+
modifyChunkSize?: number | {
|
|
1351
|
+
[key: string]: number;
|
|
1352
|
+
};
|
|
1229
1353
|
chromeTransactionDurability?: ChromeTransactionDurability;
|
|
1354
|
+
cache?: "immutable" | "cloned" | "disabled";
|
|
1230
1355
|
}
|
|
1231
1356
|
interface DexieConstructor extends DexieExceptionClasses {
|
|
1232
1357
|
new (databaseName: string, options?: DexieOptions): Dexie;
|
|
1233
|
-
prototype:
|
|
1358
|
+
prototype: any;
|
|
1234
1359
|
addons: Array<(db: Dexie) => void>;
|
|
1235
1360
|
version: number;
|
|
1236
1361
|
semVer: string;
|
|
1237
1362
|
currentTransaction: Transaction;
|
|
1238
1363
|
waitFor<T>(promise: PromiseLike<T> | T, timeoutMilliseconds?: number): Promise<T>;
|
|
1239
1364
|
getDatabaseNames(): Promise<string[]>;
|
|
1240
|
-
getDatabaseNames<R>(thenShortcut: ThenShortcut<string[], R>): Promise<R>;
|
|
1365
|
+
getDatabaseNames<R$1>(thenShortcut: ThenShortcut<string[], R$1>): Promise<R$1>;
|
|
1241
1366
|
vip<U>(scopeFunction: () => U): U;
|
|
1242
1367
|
ignoreTransaction<U>(fn: () => U): U;
|
|
1368
|
+
disableBfCache?: boolean;
|
|
1243
1369
|
liveQuery<T>(fn: () => T | Promise<T>): Observable<T>;
|
|
1244
1370
|
extendObservabilitySet(target: ObservabilitySet, newSet: ObservabilitySet): ObservabilitySet;
|
|
1245
1371
|
override<F>(origFunc: F, overridedFactory: (fn: any) => any): F; // ?
|
|
1246
|
-
getByKeyPath(obj: Object, keyPath: string): any;
|
|
1247
|
-
setByKeyPath(obj: Object, keyPath: string, value: any): void;
|
|
1248
|
-
delByKeyPath(obj: Object, keyPath: string): void;
|
|
1372
|
+
getByKeyPath(obj: Object, keyPath: string | string[]): any;
|
|
1373
|
+
setByKeyPath(obj: Object, keyPath: string | string[], value: any): void;
|
|
1374
|
+
delByKeyPath(obj: Object, keyPath: string | string[]): void;
|
|
1249
1375
|
shallowClone<T>(obj: T): T;
|
|
1250
1376
|
deepClone<T>(obj: T): T;
|
|
1251
1377
|
asap(fn: Function): void; //?
|
|
@@ -1255,6 +1381,8 @@ interface DexieConstructor extends DexieExceptionClasses {
|
|
|
1255
1381
|
delete(dbName: string): Promise<void>;
|
|
1256
1382
|
dependencies: DexieDOMDependencies;
|
|
1257
1383
|
default: Dexie; // Work-around for different build tools handling default imports differently.
|
|
1384
|
+
cache: GlobalQueryCache;
|
|
1385
|
+
debug: false | true | "dexie";
|
|
1258
1386
|
Promise: PromiseExtendedConstructor;
|
|
1259
1387
|
//TableSchema: {}; // Deprecate!
|
|
1260
1388
|
//IndexSpec: {new():IndexSpec}; //? Deprecate
|
|
@@ -1263,13 +1391,16 @@ interface DexieConstructor extends DexieExceptionClasses {
|
|
|
1263
1391
|
errnames: DexieErrors;
|
|
1264
1392
|
}
|
|
1265
1393
|
declare var Dexie: DexieConstructor;
|
|
1266
|
-
|
|
1394
|
+
// Alias of Table and Collection in order to be able to refer them from module below...
|
|
1395
|
+
interface _Table<T, TKey, TInsertType> extends Table<T, TKey, TInsertType> {}
|
|
1267
1396
|
interface _Collection<T, TKey> extends Collection<T, TKey> {}
|
|
1397
|
+
// Besides being the only exported value, let Dexie also be
|
|
1398
|
+
// a namespace for types...
|
|
1268
1399
|
declare module Dexie {
|
|
1269
1400
|
// The "Dexie.Promise" type.
|
|
1270
1401
|
type Promise<T = any> = PromiseExtended<T>; // Because many samples have been Dexie.Promise.
|
|
1271
1402
|
// The "Dexie.Table" interface. Same as named exported interface Table.
|
|
1272
|
-
interface Table<T = any, Key = any> extends _Table<T, Key> {} // Because all samples have been Dexie.Table<...>
|
|
1403
|
+
interface Table<T = any, Key = any, TInsertType = T> extends _Table<T, Key, TInsertType> {} // Because all samples have been Dexie.Table<...>
|
|
1273
1404
|
// The "Dexie.Collection" interface. Same as named exported interface Collection.
|
|
1274
1405
|
interface Collection<T = any, Key = any> extends _Collection<T, Key> {} // Because app-code may declare it.
|
|
1275
1406
|
}
|