@fireproof/core 0.20.3 → 0.20.4-dev-preview-2
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/index.cjs +15 -12
- package/index.cjs.map +1 -1
- package/index.d.cts +0 -1
- package/index.d.ts +0 -1
- package/index.js +15 -12
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
@@ -1160,7 +1160,6 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
|
|
1160
1160
|
byKey: IndexTree<K, R>;
|
1161
1161
|
byId: IndexTree<K, R>;
|
1162
1162
|
indexHead?: ClockHead;
|
1163
|
-
includeDocsDefault: boolean;
|
1164
1163
|
initError?: Error;
|
1165
1164
|
ready(): Promise<void>;
|
1166
1165
|
readonly logger: Logger;
|
package/index.d.ts
CHANGED
@@ -1160,7 +1160,6 @@ declare class Index<K extends IndexKeyType, T extends DocTypes, R extends DocFra
|
|
1160
1160
|
byKey: IndexTree<K, R>;
|
1161
1161
|
byId: IndexTree<K, R>;
|
1162
1162
|
indexHead?: ClockHead;
|
1163
|
-
includeDocsDefault: boolean;
|
1164
1163
|
initError?: Error;
|
1165
1164
|
ready(): Promise<void>;
|
1166
1165
|
readonly logger: Logger;
|
package/index.js
CHANGED
@@ -1851,7 +1851,6 @@ var Index = class {
|
|
1851
1851
|
this.mapFnString = "";
|
1852
1852
|
this.byKey = new IndexTree();
|
1853
1853
|
this.byId = new IndexTree();
|
1854
|
-
this.includeDocsDefault = true;
|
1855
1854
|
this.logger = ensureLogger(sthis, "Index");
|
1856
1855
|
this.blockstore = crdt.indexBlockstore;
|
1857
1856
|
this.crdt = crdt;
|
@@ -1867,18 +1866,19 @@ var Index = class {
|
|
1867
1866
|
if (mapFn && meta) throw this.logger.Error().Msg("cannot provide both mapFn and meta").AsError();
|
1868
1867
|
if (this.name && this.name !== name) throw this.logger.Error().Msg("cannot change name").AsError();
|
1869
1868
|
try {
|
1869
|
+
let mapFnChanged = false;
|
1870
1870
|
if (meta) {
|
1871
1871
|
if (this.indexHead && this.indexHead.map((c) => c.toString()).join() !== meta.head.map((c) => c.toString()).join()) {
|
1872
1872
|
throw this.logger.Error().Msg("cannot apply different head meta").AsError();
|
1873
1873
|
}
|
1874
1874
|
if (this.mapFnString) {
|
1875
1875
|
if (this.mapFnString !== meta.map) {
|
1876
|
-
this.
|
1877
|
-
|
1878
|
-
this.byId.cid = meta.byId;
|
1879
|
-
this.byKey.cid = meta.byKey;
|
1880
|
-
this.indexHead = meta.head;
|
1876
|
+
this.mapFnString = meta.map;
|
1877
|
+
mapFnChanged = true;
|
1881
1878
|
}
|
1879
|
+
this.byId.cid = meta.byId;
|
1880
|
+
this.byKey.cid = meta.byKey;
|
1881
|
+
this.indexHead = meta.head;
|
1882
1882
|
} else {
|
1883
1883
|
this.mapFnString = meta.map;
|
1884
1884
|
this.byId.cid = meta.byId;
|
@@ -1889,7 +1889,9 @@ var Index = class {
|
|
1889
1889
|
if (this.mapFn) {
|
1890
1890
|
if (mapFn) {
|
1891
1891
|
if (this.mapFn.toString() !== mapFn.toString()) {
|
1892
|
-
this.
|
1892
|
+
this.mapFn = mapFn;
|
1893
|
+
this.mapFnString = mapFn.toString();
|
1894
|
+
mapFnChanged = true;
|
1893
1895
|
}
|
1894
1896
|
}
|
1895
1897
|
} else {
|
@@ -1898,7 +1900,7 @@ var Index = class {
|
|
1898
1900
|
}
|
1899
1901
|
if (this.mapFnString) {
|
1900
1902
|
if (this.mapFnString !== mapFn.toString()) {
|
1901
|
-
|
1903
|
+
mapFnChanged = true;
|
1902
1904
|
}
|
1903
1905
|
} else {
|
1904
1906
|
this.mapFnString = mapFn.toString();
|
@@ -1906,8 +1908,9 @@ var Index = class {
|
|
1906
1908
|
this.mapFn = mapFn;
|
1907
1909
|
}
|
1908
1910
|
}
|
1909
|
-
|
1910
|
-
|
1911
|
+
if (mapFnChanged) {
|
1912
|
+
this._resetIndex();
|
1913
|
+
}
|
1911
1914
|
} catch (e) {
|
1912
1915
|
this.initError = e;
|
1913
1916
|
}
|
@@ -1923,7 +1926,7 @@ var Index = class {
|
|
1923
1926
|
if (!this.byKey.root) {
|
1924
1927
|
return await applyQuery(this.crdt, { result: [] }, opts);
|
1925
1928
|
}
|
1926
|
-
if (
|
1929
|
+
if (opts.includeDocs === void 0) opts.includeDocs = true;
|
1927
1930
|
if (opts.range) {
|
1928
1931
|
const eRange = encodeRange(opts.range);
|
1929
1932
|
return await applyQuery(this.crdt, await throwFalsy(this.byKey.root).range(eRange[0], eRange[1]), opts);
|
@@ -7220,7 +7223,7 @@ function buildResDelWAL(msgCtx, req, ctx) {
|
|
7220
7223
|
|
7221
7224
|
// src/version.ts
|
7222
7225
|
var PACKAGE_VERSION = Object.keys({
|
7223
|
-
"0.20.
|
7226
|
+
"0.20.4-dev-preview-2": "xxxx"
|
7224
7227
|
})[0];
|
7225
7228
|
export {
|
7226
7229
|
CRDTImpl,
|