Repository navigation
chore(deps): update dependency @signaldb/core to v2 - #583
Open
renovate[bot] wants to merge 1 commit into
Open
renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
renovate
Bot
force-pushed
the
renovate/signaldb-core-2.x
branch
2 times, most recently
from
November 16, 2026 13:51
9306062 to
7529b99
Compare
renovate
Bot
force-pushed
the
renovate/signaldb-core-2.x
branch
from
November 20, 2026 22:19
7529b99 to
9eb1759
Compare
renovate
Bot
force-pushed
the
renovate/signaldb-core-2.x
branch
from
November 25, 2026 12:43
9eb1759 to
7e47707
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^1.8.1→^2.0.0Release Notes
maxnowack/signaldb (@signaldb/core)
v2.0.2Compare Source
v2.0.1Compare Source
What's Changed
Fixed
DefaultDataAdapterloads it from storage is no longer lost. Before this fix, the load replaced memory with whatreadAllreturned. An item inserted during the first load was missing fromfind/findOneuntil the next page reload, even though storage had it, and inserting the same id again succeeded. During afetchItemsFromStorage()reload, an update was reverted and a removed item came back. Now the result of every write made during a load is applied on top of what storage returned. This holds whether or not storage already had the write, and works the same way for the legacypersistenceoption.DefaultDataAdapterfinished loading the persisted items now updates once they are loaded. Until now it kept the result it had before the load — usually empty — until a later write touched a matching item, and afindOneorfind(...).fetch()with the same selector and options returned that stale result even afterready(). A reactive query run at startup, for instance in a component that renders before the storage answers, now sees the stored items without waiting forready()first.Full Changelog: maxnowack/signaldb@v2.0.0...v2.0.1
v2.0.0Compare Source
What's Changed
BREAKING CHANGES
StorageAdapter.readIndexnow declaresMap<string | null, Set<I>>instead ofMap<any, Set<I>>. The keys always had to beserializeValue(value)— that is what SignalDB looks an index up with — but the type did not say so, and an adapter keying its index by the raw field value answered nothing for every non-string field and everything for a$neon one. If your adapter stores raw keys, wrap them inserializeValuefrom@signaldb/core.insert,insertMany,updateOne,updateMany,replaceOne,removeOneandremoveManymethods on theCollectionare now asynchronous. They resolve to what they always returned:insertto the new item's id,insertManyto the new ids,updateOne,replaceOneandremoveOneto0or1, andupdateManyandremoveManyto the number of items they touched. Await them — a rejected write that nobody awaits, a failed validation for instance, surfaces as an unhandled rejection instead of reaching your error handling.createMemoryAdaptermethod andMemoryAdaptertype were removed.memoryoption for aCollectionwas removed.AutoFetchCollectionwas removed. Use theAutoFetchDataAdapterinstead.Collection#resetData()was removed without replacement. To reload a collection from storage, dispose it and create it again.isLoading()on theCollectionno longer describes the initial load. It is initiallyfalseand istrueonly while afind(…, { async: true })query (isPulling()) or a write (isPushing()) is running. Code that waited forisLoading()to turnfalsebefore showing data should useready()/isReady()for the collection, orCursor#isLoading()for a single query.Collectionare now specified as an array of strings instead of usingIndexProviderorLowLevelIndexProviderinstances.PersistenceAdapterwas renamed toStorageAdapterand the signature was changed in a non backward compatible way.No persistence adapter for collection <name>is nowNo storage adapter for collection <name>, and theconsole.errorfor a failed background write saysError during storage operation in collection <name>. If you match on either string — in a test, a log filter, or an error reporter's grouping rule — update it.createPersistenceAdaptermethod was renamed tocreateStorageAdapter.LoadResponsetype is no longer exported from@signaldb/core. It described the shape aPersistenceAdapterloaded, which the newStorageAdapterdoes not have.@signaldb/syncstill uses a type of that name for what apullresolves to, but does not export it either — if you were naming it explicitly, infer it from theSyncManageroptions instead.combinePersistenceAdaptersmethod was removed.Collectionwere removed.createIndexProviderandcreateIndexwere removed. Specify indices as strings instead..isReady()method onCollectionwas renamed to.ready(). A new reactive.isReadymethod was added to check if the collection is ready in a reactive way.movedBeforeevents for a reordering. In v1, every item whose neighbouring item had changed was reported as moved, so moving a single item could produce amovedBeforefor several of them. Applying the reported moves still produces the same order, but consumers that countmovedBeforecalls, or that rely on being notified about items which did not themselves move, will now see fewer events.Added
DataAdapterwith aCollectionto handle data operations in a more structured way.DefaultDataAdapterwhich provides a basic and backward compatible implementation of theDataAdapterinterface.AsyncDataAdapterwhich provides an asynchronous implementation of theDataAdapterinterface.WorkerDataAdapterandWorkerDataAdapterHostwhich provides aDataAdapterimplementation that runs in a web worker.isBatchOperationInProgressmethod toCollectionto check if a batch operation is currently in progress.'changed'event handlers on theCollectionand to thechangedcallback ofobserveChanges. This provides additional information to handlers, enabling e.g. history functionality (thanks @robot-controller!)CollectionBackend—updateOne,updateManyandreplaceOne— may now resolve to{ items, previousItems }instead of a plain array, which is what lets the'changed'event report the previous state. Returning a plain array is still valid, so a custom adapter keeps working unchanged; the event then omits its third argument. All adapters shipped with SignalDB report the previous state, which grows aWorkerDataAdapterwrite response by the size of the items the write changed.onQueryStateChangeon aCollectionBackendmay now receive a second argument describing how the query result changed. Existing callbacks are unaffected — the argument is only passed when the adapter can produce it, and adapters that cannot simply omit it.CollectionBackend,QueryOptions,StateChangeCallback,WriteResult,DetailedWriteResultandQueryDeltaare now exported, so a customDataAdaptercan name the types it has to implement.WorkerDataAdapterEndpointandWorkerDataAdapterHostEndpointdescribe what the two halves of the worker adapter need from aWorker, so anything with the same shape — aMessagePort, a test stub — can take its place.find(selector, { async: true })returns a cursor whosefetch(),count(),map()andforEach()resolve to their result instead of returning it. The types follow the option, so a synchronous cursor is still synchronous. This is what makes theAsyncDataAdapter, theWorkerDataAdapterand theAutoFetchDataAdapterusable — they cannot answer a query on the spot.AnyFindOptions,AsyncFindOptionsandSyncFindOptionsare exported for naming the two forms.StorageAdaptermay implement an optionalquerymethod that answers a whole query — selector, sort, window and projection — as far as its backend can, and reports what it applied; SignalDB applies the rest. It lets a backend that can read less than everything answer a bounded query without reading the whole collection first. It is consulted by theAsyncDataAdapter, theAutoFetchDataAdapterand theWorkerDataAdapterHost; adapters without it keep working unchanged.StorageQueryandStorageQueryAnswerare exported for implementing it.Cursor.isLoading(), which reports whether the query behind a cursor has produced an outcome yet. A query that has not been answered publishes a neutral result — an empty array, a zero — and that is indistinguishable from a real one, because empty is a legitimate answer. This is the only way to tell the two apart, and it matters as soon as you use an adapter that does not answer on the spot.Cursor.applyDelta(delta), which brings a cursor up to date from a description of what changed rather than by re-running its query, falling back torequery()when the delta does not fit. For integrations that receive deltas from a data adapter themselves.query.errorevent on theCollection. A query backing a live cursor that fails keeps serving its neutral empty result, which a consumer cannot distinguish from "no data" — this event is how you find out.serializeValue,get,reactiveOrAsyncandunwrapare now exported.serializeValueis the one a customStorageAdapterneeds: it produces the keysreadIndexis looked up with.QueryStateAccessoris exported, for supplying aCursorwith the query state it reports throughisLoading().Collection.batchaccepts the collections to batch:Collection.batch([a, b], () => …). Without them it still batches every collection in the process, which defers every live query everywhere until the batch ends — fine for a few writes belonging to one event, and harmful around a loop whose length is data-dependent.Collection.reportLargeQueries(rows), which reports each live query holding more thanrowsrows once, together with the stack that registered it.enableDebugMode()switches it on at 500 rows. A reactive query registered from a long-lived place keeps its cost for the lifetime of the application, and there is otherwise nothing to see: the query works, and its price only shows up as an application that has grown slow.transformAllcan now read related data the same way its query is read. An asynchronous read ({ async: true }) calls it with{ async: true }as a third argument and awaits a promise returned for it, so atransformAllbuilt withreactiveOrAsyncreads related collections reactively inside a reactive scope and with{ async: true }— not reactively, but waiting for the real data — everywhere else. A plaintransformAllthat returns the items keeps working unchanged; one that returns a promise for a synchronous read now throws instead of handing the promise to the cursor.Changed
WorkerDataAdapterHostsends the full result only the first time a query is answered; every update after that carries just the change. Editing one field of one row no longer serialises the entire result set across the worker boundary.WorkerDataAdapteranswersisReady()from the promise it already started when the collection registered, instead of asking the worker again every time. Readiness happens once and never goes back, but each question used to cost a round trip — and callers ask often: a helper awaitingready()before touching each record turned a thousand-record sync into a thousand extra messages.DefaultDataAdapter,AsyncDataAdapterandWorkerDataAdapterHostbring a query's result up to date from its previous result where they can, instead of reading the whole collection back from storage on every write. Queries usinglimitorskip, and projected queries that are also sorted, still re-execute, because their previous result cannot answer the change on its own.WorkerDataAdapterroutes every worker message through a single listener instead of adding one per query and per pending request. Previously each incoming message was offered to every listener in turn, and each of them re-serialised its own selector to decide the message was not for it.WorkerDataAdapterno longer shows a write before the worker confirms it when the item it modifies is known only through a projected query. Applying a modifier to a projected item produces something that is not the item, and a selector naming a projected-away field would no longer match it. The write itself is unaffected; it simply becomes visible when the worker answers rather than immediately.updateOne,updateManyandreplaceOneno longer read the items back from the data layer before writing them. The write's own answer says what changed, and an empty answer is what turns an upsert into an insert. The read still happens when something is listening forvalidate, so a validator can still inspect an item — and refuse the write — before it happens.changedis no longer emitted for a write that matched nothing. It previously was, whenever the item had still existed at the moment it was read back.limitis now brought up to date from its own window where the window allows it, instead of always being re-executed against the store. A window losing one of its items still needs the store, because what fills the gap is something the window has never held.fetch(),count(),isLoading()and the other reactive cursor methods inside a reactive scope — no longer re-runs the query and compares its whole result with the previous one. Every render of a component showing a live list paid that comparison, although the observer already holds the current result; a read now only hands over the result and registers its dependency. Measured on a live query holding 5000 items, a read on a collection withtransformAll(which hands out fresh objects every time) drops from about 8 ms to about 3 ms; on a collection without one the comparison was already cheap and the read costs the same as before.mingois now required at^7.2.4instead of^7.1.1. An application that pins an oldermingo7 has to update it, or it ends up with a second copy in its bundle.Fixed
cursor.observeChanges({}), used to keep a query live — now keeps it live until it is stopped. It did not count as observing, so the first reactive read of the same cursor that ended took the shared observer down with it and unregistered the query; a cursor waiting onisLoading()could then never settle. Calling the returned stop function twice is now harmless as well.Cursor.depend()warning. The read still warns; it now behaves as it did before the warning was introduced.Cursor#isLoading()on a collection whosetransformAllreads other collections staystrueuntil the queriestransformAllmade have been answered too. With an asynchronous data adapter behind the related collection it used to report the list as loaded while the data it is enriched with was still missing — an author shown as absent rather than as loading. Like the query's own state it is latched: a later write that makestransformAllread something new does not send a loaded list back into loading.transformAllthat reads another collection no longer leaves a dependency behind when its query is brought up to date after a write. That update runs outside of any reactive scope, so each read of the other collection used to register a live query there that was never released — one more for every write — and printed theCursor.depend()warning. Reads made by atransformAlloutside of a reactive scope now register nothing; inside one they stay reactive as before.insertManyresolves to the ids in the order of the items passed to it. They were collected as the individual inserts completed, so with a storage adapter that answers out of order the ids did not line up with the items.removeOneemitsremovedonly when it removed an item. AremoveOnethat matched nothing emittedremovedwithundefined, which a listener reading the item's fields crashed on.oncecan be removed withoffbefore it fires.onceregistered a wrapper, sooffwith the original listener did nothing and the listener still ran.ready()rejects, andisReady()staysfalse, when theDefaultDataAdaptercannot set up a collection's storage adapter or load its stored items. The error was only passed toonError(or logged), andready()resolved as if the stored data had been loaded. If you awaitready(), handle its rejection; the collection keeps working in memory.WorkerDataAdapterno longer ends the adapter for all of them. It terminated the worker and rejected every call of the other collections withWorkerDataAdapter is disposed; now only that collection is unregistered, and the worker is terminated once the last collection is disposed.AutoFetchDataAdapteranswers a query on a newly observed selector only after the first fetch for it has settled. It answered from the local cache at once, soisLoading()turnedfalseand an{ async: true }read resolved — usually to an empty list — before the remote items had arrived, and an application could not tell that list from a real answer. If the first fetch fails, the query now settles as failed instead of with the cached items.AutoFetchDataAdapterpurges the items a selector fetched once its last observer is gone, also afterregisterRemoteChangefetched them again. Every refetch counted the items once more, while a purge released them once, so they were never removed.AutoFetchDataAdapterworks without astorageoption, caching the fetched items in memory. Every operation failed withNo storage adapter for collection <name>instead, although the option is optional. AfetchQueryItemsthat does not resolve to an array is reported asfetchQueryItems must resolve to an array of items; the message used to ask for the{ items }object of an earlier version.observeChangespasses the field, its old value and its new value tochangedField, asObserveCallbacksdeclares. It only passed the item and the field name — and ran the collection'stransformon the field name, so with atransformthe second argument was not even the field name.$orno longer returns documents that do not match it. The$orbranches were unioned with the ids the rest of the selector had already narrowed down to, rather than intersected with them, and the optimized selector came back empty — so nothing filtered the surplus out again.find({ status: 'open', $or: [{ tag: 'a' }, { tag: 'b' }] })returned every indexed document instead of those satisfying both halves. Only queries whose fields are all indexed were affected, so indexing more made it more likely, not less.{ id: { $in: [...] } }is now resolved through the storage adapter'sreadIds, like a single scalaridalways was, so the query costs the ids it asks for instead of the size of the collection. This applies to everyinsert, which checks for existing ids exactly that way — inserting one item into a collection of 2,000 used to read all 2,000 back first. An application reported both: a ledger lookup and each of its writes taking seconds as its history grew.DefaultDataAdapter,AsyncDataAdapterandAutoFetchDataAdapterhad the same restriction and were fixed with it.WorkerDataAdapterwhere a query going back to the'active'state discarded the result it was holding, leaving readers of that query with nothing to show until the recomputation landed.WorkerDataAdapterwhere a query usingfieldsreturned an empty result for as long as any write was in flight. Its stored items are projected, and they were being matched against the selector again — which no field the projection had dropped could satisfy.WorkerDataAdapterletting a failedregisterCollection,registerQueryorunregisterQueryescape as an uncaught promise rejection — which a disposed collection produced every time a cursor was cleaned up after it. A query the worker cannot register is now published as failed, so it reaches the collection'squery.errorevent instead of waiting forever on an empty result.New Contributors
Full Changelog: maxnowack/signaldb@v1.8.1...v2.0.0
Configuration
📅 Schedule: (in timezone America/New_York)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.