@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.cjs
CHANGED
@@ -1904,7 +1904,6 @@ var Index = class {
|
|
1904
1904
|
this.mapFnString = "";
|
1905
1905
|
this.byKey = new IndexTree();
|
1906
1906
|
this.byId = new IndexTree();
|
1907
|
-
this.includeDocsDefault = true;
|
1908
1907
|
this.logger = ensureLogger(sthis, "Index");
|
1909
1908
|
this.blockstore = crdt.indexBlockstore;
|
1910
1909
|
this.crdt = crdt;
|
@@ -1920,18 +1919,20 @@ var Index = class {
|
|
1920
1919
|
if (mapFn && meta) throw this.logger.Error().Msg("cannot provide both mapFn and meta").AsError();
|
1921
1920
|
if (this.name && this.name !== name) throw this.logger.Error().Msg("cannot change name").AsError();
|
1922
1921
|
try {
|
1922
|
+
let mapFnChanged = false;
|
1923
1923
|
if (meta) {
|
1924
1924
|
if (this.indexHead && this.indexHead.map((c) => c.toString()).join() !== meta.head.map((c) => c.toString()).join()) {
|
1925
1925
|
throw this.logger.Error().Msg("cannot apply different head meta").AsError();
|
1926
1926
|
}
|
1927
1927
|
if (this.mapFnString) {
|
1928
1928
|
if (this.mapFnString !== meta.map) {
|
1929
|
-
this.logger.Warn().Msg(`
|
1930
|
-
|
1931
|
-
|
1932
|
-
this.byKey.cid = meta.byKey;
|
1933
|
-
this.indexHead = meta.head;
|
1929
|
+
this.logger.Warn().Msg(`applying different mapFn meta: old mapFnString ${this.mapFnString} new mapFnString ${meta.map}`);
|
1930
|
+
this.mapFnString = meta.map;
|
1931
|
+
mapFnChanged = true;
|
1934
1932
|
}
|
1933
|
+
this.byId.cid = meta.byId;
|
1934
|
+
this.byKey.cid = meta.byKey;
|
1935
|
+
this.indexHead = meta.head;
|
1935
1936
|
} else {
|
1936
1937
|
this.mapFnString = meta.map;
|
1937
1938
|
this.byId.cid = meta.byId;
|
@@ -1942,7 +1943,10 @@ var Index = class {
|
|
1942
1943
|
if (this.mapFn) {
|
1943
1944
|
if (mapFn) {
|
1944
1945
|
if (this.mapFn.toString() !== mapFn.toString()) {
|
1945
|
-
this.logger.
|
1946
|
+
this.logger.Warn().Msg("applying different mapFn, resetting index");
|
1947
|
+
this.mapFn = mapFn;
|
1948
|
+
this.mapFnString = mapFn.toString();
|
1949
|
+
mapFnChanged = true;
|
1946
1950
|
}
|
1947
1951
|
}
|
1948
1952
|
} else {
|
@@ -1951,7 +1955,8 @@ var Index = class {
|
|
1951
1955
|
}
|
1952
1956
|
if (this.mapFnString) {
|
1953
1957
|
if (this.mapFnString !== mapFn.toString()) {
|
1954
|
-
this.logger.
|
1958
|
+
this.logger.Warn().Str("old mapFnString", this.mapFnString).Str("new mapFn", mapFn.toString()).Msg("applying different mapFn, resetting index");
|
1959
|
+
mapFnChanged = true;
|
1955
1960
|
}
|
1956
1961
|
} else {
|
1957
1962
|
this.mapFnString = mapFn.toString();
|
@@ -1959,8 +1964,9 @@ var Index = class {
|
|
1959
1964
|
this.mapFn = mapFn;
|
1960
1965
|
}
|
1961
1966
|
}
|
1962
|
-
|
1963
|
-
|
1967
|
+
if (mapFnChanged) {
|
1968
|
+
this._resetIndex();
|
1969
|
+
}
|
1964
1970
|
} catch (e) {
|
1965
1971
|
this.initError = e;
|
1966
1972
|
}
|
@@ -1976,7 +1982,7 @@ var Index = class {
|
|
1976
1982
|
if (!this.byKey.root) {
|
1977
1983
|
return await applyQuery(this.crdt, { result: [] }, opts);
|
1978
1984
|
}
|
1979
|
-
if (
|
1985
|
+
if (opts.includeDocs === void 0) opts.includeDocs = true;
|
1980
1986
|
if (opts.range) {
|
1981
1987
|
const eRange = encodeRange(opts.range);
|
1982
1988
|
return await applyQuery(this.crdt, await throwFalsy(this.byKey.root).range(eRange[0], eRange[1]), opts);
|
@@ -7265,6 +7271,6 @@ function buildResDelWAL(msgCtx, req, ctx) {
|
|
7265
7271
|
|
7266
7272
|
// src/version.ts
|
7267
7273
|
var PACKAGE_VERSION = Object.keys({
|
7268
|
-
"0.20.
|
7274
|
+
"0.20.4-dev-preview-1": "xxxx"
|
7269
7275
|
})[0];
|
7270
7276
|
//# sourceMappingURL=index.cjs.map
|