dexie 4.0.10 → 4.0.11

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 CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * By David Fahlander, david.fahlander@gmail.com
6
6
  *
7
- * Version 4.0.10, Fri Nov 15 2024
7
+ * Version 4.0.11, Wed Jan 15 2025
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -366,7 +366,6 @@ export type KeyPaths<T> = {
366
366
  ? never : T[P] extends object ? P | `${P}.${KeyPaths<T[P]>}` : P : never;
367
367
  }[keyof T];
368
368
  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] : any;
369
- export declare const PropModSymbol: unique symbol;
370
369
  export type PropModSpec = {
371
370
  replacePrefix?: [
372
371
  string,
@@ -375,16 +374,10 @@ export type PropModSpec = {
375
374
  add?: number | bigint | Array<string | number>;
376
375
  remove?: number | bigint | Array<string | number>;
377
376
  };
378
- export class PropModification implements PropModSpec {
379
- [PropModSymbol]?: true;
380
- replacePrefix?: [
381
- string,
382
- string
383
- ];
384
- add?: number | bigint | Array<string | number>;
385
- remove?: number | bigint | Array<string | number>;
386
- execute<T>(value: T): T;
377
+ export class PropModification {
378
+ ["@@propmod"]: PropModSpec;
387
379
  constructor(spec: PropModSpec);
380
+ execute<T>(value: T): T;
388
381
  }
389
382
  export type UpdateSpec<T> = {
390
383
  [KP in KeyPaths<T>]?: KeyPathValue<T, KP> | PropModification;
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.10, Fri Nov 15 2024
7
+ * Version 4.0.11, Wed Jan 15 2025
8
8
  *
9
9
  * https://dexie.org
10
10
  *
@@ -1152,7 +1152,7 @@
1152
1152
  }
1153
1153
  }
1154
1154
 
1155
- var DEXIE_VERSION = '4.0.10';
1155
+ var DEXIE_VERSION = '4.0.11';
1156
1156
  var maxString = String.fromCharCode(65535);
1157
1157
  var minKey = -Infinity;
1158
1158
  var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
@@ -1804,15 +1804,15 @@
1804
1804
  });
1805
1805
  }
1806
1806
 
1807
- var PropModSymbol = Symbol();
1808
1807
  var PropModification = (function () {
1809
1808
  function PropModification(spec) {
1810
- Object.assign(this, spec);
1809
+ this["@@propmod"] = spec;
1811
1810
  }
1812
1811
  PropModification.prototype.execute = function (value) {
1813
1812
  var _a;
1814
- if (this.add !== undefined) {
1815
- var term = this.add;
1813
+ var spec = this["@@propmod"];
1814
+ if (spec.add !== undefined) {
1815
+ var term = spec.add;
1816
1816
  if (isArray(term)) {
1817
1817
  return __spreadArray(__spreadArray([], (isArray(value) ? value : []), true), term, true).sort();
1818
1818
  }
@@ -1828,8 +1828,8 @@
1828
1828
  }
1829
1829
  throw new TypeError("Invalid term ".concat(term));
1830
1830
  }
1831
- if (this.remove !== undefined) {
1832
- var subtrahend_1 = this.remove;
1831
+ if (spec.remove !== undefined) {
1832
+ var subtrahend_1 = spec.remove;
1833
1833
  if (isArray(subtrahend_1)) {
1834
1834
  return isArray(value) ? value.filter(function (item) { return !subtrahend_1.includes(item); }).sort() : [];
1835
1835
  }
@@ -1845,9 +1845,9 @@
1845
1845
  }
1846
1846
  throw new TypeError("Invalid subtrahend ".concat(subtrahend_1));
1847
1847
  }
1848
- var prefixToReplace = (_a = this.replacePrefix) === null || _a === void 0 ? void 0 : _a[0];
1848
+ var prefixToReplace = (_a = spec.replacePrefix) === null || _a === void 0 ? void 0 : _a[0];
1849
1849
  if (prefixToReplace && typeof value === 'string' && value.startsWith(prefixToReplace)) {
1850
- return this.replacePrefix[1] + value.substring(prefixToReplace.length);
1850
+ return spec.replacePrefix[1] + value.substring(prefixToReplace.length);
1851
1851
  }
1852
1852
  return value;
1853
1853
  };
@@ -5920,7 +5920,6 @@
5920
5920
  liveQuery: liveQuery,
5921
5921
  Entity: Entity,
5922
5922
  cmp: cmp,
5923
- PropModSymbol: PropModSymbol,
5924
5923
  PropModification: PropModification,
5925
5924
  replacePrefix: replacePrefix,
5926
5925
  add: add,