Skip to content

Commit

Permalink
chore: build
Browse files Browse the repository at this point in the history
  • Loading branch information
appy-one committed May 18, 2023
1 parent 927381a commit 104f28d
Show file tree
Hide file tree
Showing 25 changed files with 265 additions and 35 deletions.
30 changes: 24 additions & 6 deletions dist/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4588,6 +4588,7 @@ class Storage extends acebase_core_1.SimpleEventEmitter {
// private _validation = new Map<string, { validate?: (previous: any, value: any) => boolean, schema?: SchemaDefinition }>;
this._schemas = [];
this._indexes = [];
this._annoucedIndexes = new Map();
this.indexes = {
/**
* Tests if (the default storage implementation of) indexes are supported in the environment.
Expand Down Expand Up @@ -4689,9 +4690,18 @@ class Storage extends acebase_core_1.SimpleEventEmitter {
if (existingIndex) {
return existingIndex;
}
else if (this._annoucedIndexes.has(fileName)) {
// Index is already in the process of being added, wait until it becomes availabe
const index = await this._annoucedIndexes.get(fileName);
return index;
}
try {
const index = await data_index_1.DataIndex.readFromFile(this, fileName);
// Announce the index to prevent race condition in between reading and receiving the IPC index.created notification
const indexPromise = data_index_1.DataIndex.readFromFile(this, fileName);
this._annoucedIndexes.set(fileName, indexPromise);
const index = await indexPromise;
this._indexes.push(index);
this._annoucedIndexes.delete(fileName);
return index;
}
catch (err) {
Expand Down Expand Up @@ -5324,6 +5334,9 @@ class Storage extends acebase_core_1.SimpleEventEmitter {
else if (type === 'child_removed') {
trigger = oldValue !== null && newValue === null;
}
if (!trigger) {
return;
}
const pathKeys = acebase_core_1.PathInfo.getPathKeys(sub.dataPath);
variables.forEach(variable => {
// only replaces first occurrence (so multiple *'s will be processed 1 by 1)
Expand All @@ -5332,7 +5345,7 @@ class Storage extends acebase_core_1.SimpleEventEmitter {
pathKeys[index] = variable.value;
});
const dataPath = pathKeys.reduce((path, key) => acebase_core_1.PathInfo.getChildPath(path, key), '');
trigger && this.subscriptions.trigger(sub.type, sub.subscriptionPath, dataPath, oldValue, newValue, options.context);
this.subscriptions.trigger(sub.type, sub.subscriptionPath, dataPath, oldValue, newValue, options.context);
};
const prepareMutationEvents = (currentPath, oldValue, newValue, compareResult) => {
const batch = [];
Expand Down Expand Up @@ -9087,10 +9100,15 @@ class DataReferenceQuery {
}
ev = eventData;
}
listeners.forEach(callback => { try {
callback(ev);
}
catch (e) { } });
listeners.forEach(callback => {
var _a, _b;
try {
callback(ev);
}
catch (err) {
this.ref.db.debug.error(`Error executing "${ev.name}" event handler of realtime query on path "${this.ref.path}": ${(_b = (_a = err === null || err === void 0 ? void 0 : err.stack) !== null && _a !== void 0 ? _a : err === null || err === void 0 ? void 0 : err.message) !== null && _b !== void 0 ? _b : err}`);
}
});
};
// Check if there are event listeners set for realtime changes
options.monitor = { add: false, change: false, remove: false };
Expand Down
2 changes: 1 addition & 1 deletion dist/browser.min.js

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions dist/cjs/btree/binary-tree.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cjs/btree/binary-tree.js.map

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions dist/cjs/storage/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cjs/storage/index.js.map

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions dist/cjs/test/issue-225.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/cjs/test/issue-225.spec.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions dist/esm/btree/binary-tree.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/esm/btree/binary-tree.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/esm/ipc/socket.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 104f28d

Please sign in to comment.