dexie 4.0.1-beta.11 → 4.0.1-beta.13
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/dist/dexie.d.ts +19 -2
- package/dist/dexie.js +33 -4
- 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 +31 -5
- 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 +31 -7
- package/dist/modern/dexie.mjs.map +1 -1
- package/package.json +1 -1
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.13, Fri Mar 01 2024
|
|
8
8
|
*
|
|
9
9
|
* https://dexie.org
|
|
10
10
|
*
|
|
@@ -363,8 +363,24 @@ 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
385
|
export interface Collection<T = any, TKey = IndexableType, TInsertType = T> {
|
|
370
386
|
db: Dexie;
|
|
@@ -1140,6 +1156,7 @@ export function liveQuery<T>(querier: () => T | Promise<T>): Observable<T>;
|
|
|
1140
1156
|
export function mergeRanges(target: IntervalTree, newSet: IntervalTree): void;
|
|
1141
1157
|
export function rangesOverlap(rangeSet1: IntervalTree, rangeSet2: IntervalTree): boolean;
|
|
1142
1158
|
export function cmp(a: any, b: any): number;
|
|
1159
|
+
export function replacePrefix(a: string, b: string): PropModification;
|
|
1143
1160
|
/** Exporting 'Dexie' as the default export.
|
|
1144
1161
|
**/
|
|
1145
1162
|
export default Dexie;
|
package/dist/dexie.js
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.13, Fri Mar 01 2024
|
|
8
8
|
*
|
|
9
9
|
* https://dexie.org
|
|
10
10
|
*
|
|
@@ -1150,7 +1150,7 @@
|
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
1152
1152
|
|
|
1153
|
-
var DEXIE_VERSION = '4.0.1-beta.
|
|
1153
|
+
var DEXIE_VERSION = '4.0.1-beta.13';
|
|
1154
1154
|
var maxString = String.fromCharCode(65535);
|
|
1155
1155
|
var minKey = -Infinity;
|
|
1156
1156
|
var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
@@ -1803,6 +1803,22 @@
|
|
|
1803
1803
|
});
|
|
1804
1804
|
}
|
|
1805
1805
|
|
|
1806
|
+
var PropModSymbol = Symbol();
|
|
1807
|
+
var PropModification = (function () {
|
|
1808
|
+
function PropModification(spec) {
|
|
1809
|
+
Object.assign(this, spec);
|
|
1810
|
+
}
|
|
1811
|
+
PropModification.prototype.execute = function (value) {
|
|
1812
|
+
var _a;
|
|
1813
|
+
var prefixToReplace = (_a = this.replacePrefix) === null || _a === void 0 ? void 0 : _a[0];
|
|
1814
|
+
if (prefixToReplace && typeof value === 'string' && value.startsWith(prefixToReplace)) {
|
|
1815
|
+
return this.replacePrefix[1] + value.substring(prefixToReplace.length);
|
|
1816
|
+
}
|
|
1817
|
+
return value;
|
|
1818
|
+
};
|
|
1819
|
+
return PropModification;
|
|
1820
|
+
}());
|
|
1821
|
+
|
|
1806
1822
|
var Collection = (function () {
|
|
1807
1823
|
function Collection() {
|
|
1808
1824
|
}
|
|
@@ -2074,8 +2090,14 @@
|
|
|
2074
2090
|
modifyer = function (item) {
|
|
2075
2091
|
var anythingModified = false;
|
|
2076
2092
|
for (var i = 0; i < numKeys; ++i) {
|
|
2077
|
-
var keyPath = keyPaths[i]
|
|
2078
|
-
|
|
2093
|
+
var keyPath = keyPaths[i];
|
|
2094
|
+
var val = changes[keyPath];
|
|
2095
|
+
var origVal = getByKeyPath(item, keyPath);
|
|
2096
|
+
if (val instanceof PropModification) {
|
|
2097
|
+
setByKeyPath(item, keyPath, val.execute(origVal));
|
|
2098
|
+
anythingModified = true;
|
|
2099
|
+
}
|
|
2100
|
+
else if (origVal !== val) {
|
|
2079
2101
|
setByKeyPath(item, keyPath, val);
|
|
2080
2102
|
anythingModified = true;
|
|
2081
2103
|
}
|
|
@@ -5791,6 +5813,10 @@
|
|
|
5791
5813
|
});
|
|
5792
5814
|
}
|
|
5793
5815
|
|
|
5816
|
+
function replacePrefix(a, b) {
|
|
5817
|
+
return new PropModification({ replacePrefix: [a, b] });
|
|
5818
|
+
}
|
|
5819
|
+
|
|
5794
5820
|
DexiePromise.rejectionMapper = mapError;
|
|
5795
5821
|
setDebug(debug);
|
|
5796
5822
|
|
|
@@ -5800,6 +5826,9 @@
|
|
|
5800
5826
|
liveQuery: liveQuery,
|
|
5801
5827
|
Entity: Entity,
|
|
5802
5828
|
cmp: cmp,
|
|
5829
|
+
PropModSymbol: PropModSymbol,
|
|
5830
|
+
PropModification: PropModification,
|
|
5831
|
+
replacePrefix: replacePrefix,
|
|
5803
5832
|
'default': Dexie$1,
|
|
5804
5833
|
RangeSet: RangeSet,
|
|
5805
5834
|
mergeRanges: mergeRanges,
|