Repository navigation
v3.4.0
Breaking
EntityDataProvider.insertis nowinsert(data: any[], options?): Promise<any[]>(not one object).insertManyremoved fromProxyEntityDataProvider.EntityDataProvider.deleteis nowdelete(ids: any[]): Promise<void>. REST: 1 id → DELETE, N → existing deleteMany.- Custom
LiveQueryStorage:keepAliveAndReturnUnknownQueryIdsreturns{ unknownQueryIds, versions }instead ofstring[]. The keep-alive route still accepts the old array body from older clients. Fields.literal,Fields.enum, andValueListFieldTypevalidate only when the row is new or the value changed. A stored value outside the list no longer fails a save of another field.
Added
- Native
IndexedDbDataProvider: PK + declared indexes, filter prefetch, batch insert/delete in one IDB txn, optionalencrypt: true(AES-GCM, non-extractable key in__remult_keys, PK+index fields plaintext, rest_enc+_iv). Docs: installation/database/indexeddb — see docs for threat model. DroppableDataProvider(dropDatabase/dropTable) onIndexedDbDataProviderandInMemoryDataProvider.dropTable(Task)or metadata; store + indexes recreated on next use.@Entity({ bulkInsert: true })— backendinsert([a, b])uses oneEntityDataProvider.insertafter allsavinghooks (SQL multi-rowINSERT/ one IDB txn).Validators.unique/count()only see the DB, not siblings in the same array. Frontend always POSTs the array; the entity option is what the backend honors. Do not enable ifsaving/validationdepends on sibling rows already persisted.SqlDatabase.groupByToRaw(repo, options, { sqlCommand, dbNames, wrapIdentifier, limitSyntax })andSqlDatabase.selectToRaw(repo, findOptions, …)build the select thatgroupBy/findwould run without running it, and return atoResultthat maps a result row (by column alias) to the same shape the repository method returns. For statements remult can't run on its own, such as oneUNION ALLover several databases; replacedbNames.$entityNameto address another database. Docs: Building a select with remult.SubscriptionServer.initApiServer?— a custom subscription server registers its own HTTP routes (SSE does this itself).SseSubscriptionClient,SubscriptionServerRouteApi, andDataApiResponseare exported fromremult/internals(#1036).SubscriptionListener.reconnect?()letsSubscriptionChannelsubscribers refetch state after a dropped connection.SubscriptionClientConnectiongained optionallastServerEventandresume(force?); custom clients (Ably, ...) can ignore them.flags.sseStaleMs(40s),flags.liveQueryKeepAliveMs(30s),flags.liveQueryPollWhenStaleMs(1s). Server SSE ping every 15s (was 45s), exported asssePingMs.walkFilterandomitFilterFieldare exported fromremult/internalsfor traversing and transforming nested filters (#1058).ValueListFieldType({ unknownIdValue })— value used when a stored id is not in the list (a value, or(id) => value). Defaultundefined. Onlynullandundefinedstayundefined; a blank''uses this value. A declared id of''is unaffected. A customvalueConverterstill replaces the default.ValueListInfo.byId(id, true)applies it;byId(id)stays a declared-id lookup.- A literal
includetypes its relations as loaded infindresults, sotask.category.nameneeds no?.. Same forfindFirst,findOneandfindId. A relation declared| nullstays nullable. ExportsLoaded<T, include>(#1053). - Thanks to @AndrewSouthpaw for their first contribution
Changed
- An included
toOnewith no target row isnull, where afield/fieldsrelation used to leave itundefined. The FK keeps its value. repo.insert([a, b, c])is sequential by default (this.insert(item)per row).savingandValidators.uniquesee prior rows in the same call.- From the frontend,
insert([...])always sends the array in one request. The backend wraps it in a transaction and uses bulk only when the entity hasbulkInsert: true. - SQL/knex multi-row
INSERT ... VALUES (...),(...)batched under bind-variable limits (default 2000, sqlite 999, D1 100). Used when the entity hasbulkInsert: true. - The SQL that
groupByruns now aliases every column throughwrapIdentifier(count(*) as "count","status" as "status",sum("amount") as "amount_sum"). Results are unchanged; only the statement text differs. InsertOrUpdateOptions.selectis optional.SqlDatabase.selectToRawandgroupByToRawmap JSON columns using the provider's JSON storage mode;jsonAsStringcan override it when querying a different database.SseSubscriptionClientreconnects forever with backoff (was 4 tries), reconnects onvisibilitychange/online/pageshow, and recreates a socket that stops delivering events forflags.sseStaleMs.liveQueryfirstnext()no longer waits for the SSE connection.- Each server-side live query carries a version, sent with every change and returned by the keep-alive. The client refetches the snapshot on any version gap, so a dead socket, a half-open socket, or a missed message is recovered within one keep-alive.
LiveQueryChangehas an internal{ type: 'version', from, to }member, filtered out before reachingliveQuerylisteners.
Fixed
- Live query no longer drops updates when the SSE stream dies while HTTP still works.
- REST
_select/find({ select })serialized omitted fields throughtoApiJson, so dates and custom converters leaked as''instead of being absent. repo.update(undefined | null, data)threwentity is undefinedinstead of the same not-found error as any other missing id (#1001, #1047).- Thanks to @drakeo338 for their first contribution
- REST filters, sorts, and
groupBynow ignore fields hidden from the API just as they ignore unknown fields (#1058). - SQL
contains/startsWith/endsWithfilters now treat[literally instead of as a SQL ServerLIKEcharacter-class opener (#1058). - Mongo updates wrote the field key instead of the database field name (#1049).
- Mongo inserts wrote
dbReadOnly/serverExpressionfields, which cleared an explicit foreign key when the relation was declared before the id field (#1048). - Mongo
contains/startsWith/endsWithtreated the search string as a regex. Metacharacters are escaped, so the filter is a literal (#1050). - GET
__action=groupByresponded before the query finished. Forbidden GET errors now senderr.message(#1051). - POST
__action=querysent the body twice (#1052). - Thanks to @raashish1601 for their first contribution
- Docs: REST split into read and mutations,
describeEntityargument order (#1046). - Thanks to @pluxain for their first contribution to the docs
New Contributors
- @pluxain made their first contribution in #1046
- @drakeo338 made their first contribution in #1047
- @raashish1601 made their first contribution in #1050
- @AndrewSouthpaw made their first contribution in #1053
Full Changelog: v3.3.18...v3.4.0