@fireproof/core 0.20.3-dev-preview-1 → 0.20.4-dev-preview-1
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 +18 -12
- package/index.cjs.map +1 -1
- package/index.d.cts +0 -1
- package/index.d.ts +0 -1
- package/index.js +18 -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,20 @@ 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.logger.Warn().Msg(`
|
1877
|
-
|
1878
|
-
|
1879
|
-
this.byKey.cid = meta.byKey;
|
1880
|
-
this.indexHead = meta.head;
|
1876
|
+
this.logger.Warn().Msg(`applying different mapFn meta: old mapFnString ${this.mapFnString} new mapFnString ${meta.map}`);
|
1877
|
+
this.mapFnString = meta.map;
|
1878
|
+
mapFnChanged = true;
|
1881
1879
|
}
|
1880
|
+
this.byId.cid = meta.byId;
|
1881
|
+
this.byKey.cid = meta.byKey;
|
1882
|
+
this.indexHead = meta.head;
|
1882
1883
|
} else {
|
1883
1884
|
this.mapFnString = meta.map;
|
1884
1885
|
this.byId.cid = meta.byId;
|
@@ -1889,7 +1890,10 @@ var Index = class {
|
|
1889
1890
|
if (this.mapFn) {
|
1890
1891
|
if (mapFn) {
|
1891
1892
|
if (this.mapFn.toString() !== mapFn.toString()) {
|
1892
|
-
this.logger.
|
1893
|
+
this.logger.Warn().Msg("applying different mapFn, resetting index");
|
1894
|
+
this.mapFn = mapFn;
|
1895
|
+
this.mapFnString = mapFn.toString();
|
1896
|
+
mapFnChanged = true;
|
1893
1897
|
}
|
1894
1898
|
}
|
1895
1899
|
} else {
|
@@ -1898,7 +1902,8 @@ var Index = class {
|
|
1898
1902
|
}
|
1899
1903
|
if (this.mapFnString) {
|
1900
1904
|
if (this.mapFnString !== mapFn.toString()) {
|
1901
|
-
this.logger.
|
1905
|
+
this.logger.Warn().Str("old mapFnString", this.mapFnString).Str("new mapFn", mapFn.toString()).Msg("applying different mapFn, resetting index");
|
1906
|
+
mapFnChanged = true;
|
1902
1907
|
}
|
1903
1908
|
} else {
|
1904
1909
|
this.mapFnString = mapFn.toString();
|
@@ -1906,8 +1911,9 @@ var Index = class {
|
|
1906
1911
|
this.mapFn = mapFn;
|
1907
1912
|
}
|
1908
1913
|
}
|
1909
|
-
|
1910
|
-
|
1914
|
+
if (mapFnChanged) {
|
1915
|
+
this._resetIndex();
|
1916
|
+
}
|
1911
1917
|
} catch (e) {
|
1912
1918
|
this.initError = e;
|
1913
1919
|
}
|
@@ -1923,7 +1929,7 @@ var Index = class {
|
|
1923
1929
|
if (!this.byKey.root) {
|
1924
1930
|
return await applyQuery(this.crdt, { result: [] }, opts);
|
1925
1931
|
}
|
1926
|
-
if (
|
1932
|
+
if (opts.includeDocs === void 0) opts.includeDocs = true;
|
1927
1933
|
if (opts.range) {
|
1928
1934
|
const eRange = encodeRange(opts.range);
|
1929
1935
|
return await applyQuery(this.crdt, await throwFalsy(this.byKey.root).range(eRange[0], eRange[1]), opts);
|
@@ -7220,7 +7226,7 @@ function buildResDelWAL(msgCtx, req, ctx) {
|
|
7220
7226
|
|
7221
7227
|
// src/version.ts
|
7222
7228
|
var PACKAGE_VERSION = Object.keys({
|
7223
|
-
"0.20.
|
7229
|
+
"0.20.4-dev-preview-1": "xxxx"
|
7224
7230
|
})[0];
|
7225
7231
|
export {
|
7226
7232
|
CRDTImpl,
|