dexie 4.0.1-beta.10 → 4.0.1-beta.12
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 +18 -2
- package/dist/dexie.js +36 -7
- 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 +34 -8
- 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 +34 -10
- 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.12, Fri Mar 01 2024
|
|
8
8
|
*
|
|
9
9
|
* https://dexie.org
|
|
10
10
|
*
|
|
@@ -363,8 +363,23 @@ 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
|
+
constructor(spec: PropModSpec);
|
|
380
|
+
}
|
|
366
381
|
export type UpdateSpec<T> = {
|
|
367
|
-
[KP in KeyPaths<T>]?: KeyPathValue<T, KP
|
|
382
|
+
[KP in KeyPaths<T>]?: KeyPathValue<T, KP> | PropModification;
|
|
368
383
|
};
|
|
369
384
|
export interface Collection<T = any, TKey = IndexableType, TInsertType = T> {
|
|
370
385
|
db: Dexie;
|
|
@@ -1140,6 +1155,7 @@ export function liveQuery<T>(querier: () => T | Promise<T>): Observable<T>;
|
|
|
1140
1155
|
export function mergeRanges(target: IntervalTree, newSet: IntervalTree): void;
|
|
1141
1156
|
export function rangesOverlap(rangeSet1: IntervalTree, rangeSet2: IntervalTree): boolean;
|
|
1142
1157
|
export function cmp(a: any, b: any): number;
|
|
1158
|
+
export function replacePrefix(a: string, b: string): PropModification;
|
|
1143
1159
|
/** Exporting 'Dexie' as the default export.
|
|
1144
1160
|
**/
|
|
1145
1161
|
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.12, 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.12';
|
|
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
|
}
|
|
@@ -5388,7 +5410,7 @@
|
|
|
5388
5410
|
Dexie.prototype.delete = function (closeOptions) {
|
|
5389
5411
|
var _this = this;
|
|
5390
5412
|
if (closeOptions === void 0) { closeOptions = { disableAutoOpen: true }; }
|
|
5391
|
-
var
|
|
5413
|
+
var hasInvalidArguments = arguments.length > 0 && typeof arguments[0] !== 'object';
|
|
5392
5414
|
var state = this._state;
|
|
5393
5415
|
return new DexiePromise(function (resolve, reject) {
|
|
5394
5416
|
var doDelete = function () {
|
|
@@ -5401,8 +5423,8 @@
|
|
|
5401
5423
|
req.onerror = eventRejectHandler(reject);
|
|
5402
5424
|
req.onblocked = _this._fireOnBlocked;
|
|
5403
5425
|
};
|
|
5404
|
-
if (
|
|
5405
|
-
throw new exceptions.InvalidArgument("
|
|
5426
|
+
if (hasInvalidArguments)
|
|
5427
|
+
throw new exceptions.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
5406
5428
|
if (state.isBeingOpened) {
|
|
5407
5429
|
state.dbReadyPromise.then(doDelete);
|
|
5408
5430
|
}
|
|
@@ -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,
|