Repository navigation
v1.21.2
-
reflection_factory: ^2.11.0(requires Dart 3.13.2+):Json.decode<Map>/
decodeAsync<Map>with nested JSON lists (previously lazily cast lists that
threw when read). Reflection code regenerated (only the builder version
changed).- dev:
build_runner: ^2.16.2(analyzer14, required by it).
- dev:
-
Fix:
DBSQLiteAdapter: concurrent transactions failed (no such savepoint)
or reverted each other's writes. Every pooled connection shares one native
handle, so they were nested asSAVEPOINTs of a single stack: aCOMMIT
also released another transaction's savepoint, and aROLLBACKreverted
its writes. They now run one at a time (SQLite has a single writer
anyway); a transaction opened inside another one still nests as a
SAVEPOINT. -
Fix:
DBRelationalEntityRepository.store/update: an error raised by the
repository, not by the DB (e.g. aRecursiveRelationshipLoopError), left
its auto-commit transaction open forever, with the operations already
executed in it never committed or rolled back (holding its connection;
with SQLite, every later transaction nested inside it). It's now aborted
(rolled back). -
Fix: the connection pool (
Pool.releaseIntoPool) checked its size before
adding the released connection, so it could keepmaxConnections + 1
connections. -
Tests: concurrency integration tests (
bones_api_concurrency_*_test.dart,
tagconcurrency): parallel inserts, reads, partial updates (also of the
same entity), entities with references, connection pool pressure and
unique conflicts; transactions committed, aborted (an error orabort()),
in parallel, with parallel operations inside, a failing operation, and no
dirty reads between concurrent transactions. On the SQL memory, SQLite,
PostgreSQL and MySQL adapters, and the object memory, directory and GCS
(fake) adapters, each with its documented limitations (e.g. no rollback or
unique fields on object storage).- CI: a new
test_vm (concurrency)job (its 3 files at once); the workflow
also runs on PRs to any branch (stacked PRs).
- CI: a new
-
Fix:
APIRequest.isAuthenticatedwastrueonly when the token was
expired (it is nowtrueonly when it isn't). -
Fix:
APISecurity.autoValidateAllTokensnever ran (the elapsed time was
computed backwards, always ≤ 0): the expired tokens are now validated
(removed) at most every 5 minutes, as intended. -
Fix:
APIToken.fromJsonparsed thedurationfromissueTime; it now
readsduration(seconds), defaulting to 3 hours when absent. -
Fix:
APIRequest.pathPartAtwith a negative index (from the end) always
returnednull. -
Fix:
parseAPIRequestMethod('options')returnednull(a'optionS'
typo). -
Fix:
APIRequest.getHeaderFirstOf: the case-insensitive match of the
first key returned a parameter instead of the header. -
Fix:
APIRouteBuilder.fromwith anIterableof providers threw a
TypeError(swapped arguments). -
Fix:
DBSQLAdapter.parseConfigLogSQLwithlog: {sql: ...}parsed the
logMap(alwaysfalse) instead of itssqlvalue. -
Fix:
DBSQLAdapter.removeSQLsCommentsthrew aRangeErroron any
/* ... */comment (now replaced by a space). -
Fix:
EntityReferenceList.toEntityReferencethrew aRangeErroron an
empty list with entities;EntityReferenceList.getAtwith an
entitiesFetcherfetched all the IDs (as a nested list) instead of the one
atindex. -
Fix:
TransactionOperationTypeExtension.namethrew for
selectRelationships. -
Fix:
APIRepository.deleteignored itstransaction. -
Fix:
APIConfig.fromAsync(loadAPIConfigFromUri) of anhttp(s)URL
discarded the downloaded configuration (and requested the URL with a
trailing/): now it's returned (null, or the default, if not found). -
Fix:
APIServerwithtotalWorkers > 1failed to spawn the workers
(object is unsendable - _CustomZone) when theAPIRootwas created (or
initialized) in aZoneother thanZone.root(e.g.runZoned,
runZonedGuarded, a test):APIRoot.currentAPIRequest(aZoneField,
holding its parentZone) is moved out of the instance while it's copied.APIRoot.prepareForIsolateCopy/finishIsolateCopy: called by
APIServerbefore and after spawning the workers. In between, the
ZoneFieldof thisIsolateis kept out of the instance (in a static
Expando: not copied), and still used by thisIsolate. Otherwise it's
an instance field (the fast path), created by the constructor, as before
(the calls' zones forked from the constructor'sZone).APIRoot.initializeIsolateCopy: initializes a copy in itsIsolate
(itscurrentAPIRequestforked from thatIsolate'sZone), called by
an auxiliaryAPIServerWorkerbefore its start (otherwise created when
first used there).APIRoot.getCurrentAPIRequest([contextZone]): the currentAPIRequest
(ornull), without creating theZoneField.- The
EntityRulesResolvercontext provider of anAPIRootis registered
once perIsolate(also by a copy with its modules already loaded), and
not again afterclose.
-
Fix:
APIServerResponseCachewrote a double comma (,,) in a cached
response'sserver-timingheader. -
Fix:
AlterTableSQLwithifNotExistscut the column name of an entry
with leading spaces (line.substring(11)over the untrimmed line). -
Fix:
APIConfig.getPaththrew aRangeErrorfor aListindex out of
range (nownull). -
Fix:
registerAsDbLoggerof a logger with a dotted (hierarchical) name:
its records weren't identified as DB logs (LogRecord.loggerNameis the
full name). -
Fix:
runTestAPIServerleft the server running on an unknown channel
command (now stopped, also closing itsAPIRoot, as onstop). -
Fix:
checkTables(SQLite) suggested SQLs that SQLite can't run:SQLDialect.alterTableAddColumnIfNotExists(falsefor SQLite): no
ADD COLUMN IF NOT EXISTS.- Without
SQLDialect.alterTableAddConstraint, a missing column's foreign
key is in the column (REFERENCES), and aUNIQUEone is a unique
index (noADD CONSTRAINT). - A repeated suggested SQL is listed once.
-
Fix:
checkTableserrors with only missing enumCHECKconstraints or
values had no description (nowmissingEnumConstraintsand
missingEnumValues);missingCollectionReferenceColumnsalso listed the
non-collection reference fields. -
Fix:
checkDBTableswith a missing table threw a null-checkTypeError
(getRepositoriesSchemes) instead of reportingNo scheme for repository. -
Fix:
Transaction: an error after the first one (e.g. of an operation
after the abort) was returned as the operation's result (as R: a
TypeError, or the error object as the result); now it's rethrown (and
still added toextraErrors). -
Fix:
IterableEntityRepository.ensureReferencesStored(store,
ensureStored) didn't store the entities ofList<Entity>fields. -
Fix:
EntityHandler.decodeObjectListJsoncouldn't decode a list (cast to
O): each element is now resolved as an entity. -
Fix:
DBObjectMemoryAdapter/DBObjectDirectoryAdapterstored an
EntityReferenceListfield as the object itself (wrapped in aList),
not its IDs: the entity couldn't be read back. -
Fix:
DBObjectDirectoryAdapter/DBObjectGCSAdaptercouldn't store a
DateTime, enum orDecimalfield (not JSON encodable): now encoded as
Json.toJson(DBObjectAdapter.toEncodableJson), and parsed back by the
entity's handler. -
Fix:
DBObjectDirectoryAdapter/DBObjectGCSAdapter: selecting an entity
with sub-entities (e.g. aUser, with itsAddressandRoles) never
completed: the sub-entities' selects (by the operation'spreFinish), in
the same transaction, waited for the operation, that waited for them. The
object adapters (alsoDBObjectMemoryAdapter) now finish an operation
after its transaction execution (as the SQL adapters). -
Fix:
onStorenever notified the stores ofDBEntityRepositoryand
DBRelationalEntityRepository(inserts and updates with changes; an
unchanged entity isn't stored, nor notified). -
Fix:
APIDBModule:select,insert,updateanddeletewithout a
table (e.g./db/select) threw aRangeError(an error response), now
notFound. -
Fix:
EntityHandler.equalsValuesBasic/equalsValuesEntity/
equalsValuesEntityMap: values without an ID (or a resolvable one) were
equal (null == null), e.g. two unrelated non-entity objects, or two
entities not stored yet: anullID now never matches (as
EntityHandler.equalsValues). -
Fix:
APIServeralways sent theX-Access-Tokenheader back, also when
the client sent the token (theAuthorizationheader was checked in the
response headers, not in the request's). -
Fix:
APIAuthentication.isExpired(now:)ignorednow. -
Fix:
DBAdapter.instantiateAdaptorignored anasyncinstantiator
(returning aFuture<A?>, as declared byDBAdapterInstantiator), and
didn't skip an asyncnull. -
Fix:
IterableEntityRepository(e.g.SetEntityRepository): re-storing
an entity with a unique field (@EntityField.unique()) threw
EntityFieldInvalid(unique)against itself: the unique values are now
checked against the other entities (not the same instance or ID). -
Fix:
SetEntityRepository(IterableEntityRepository.store): an entity
with an ID (an update, or an insert with a defined ID) was only "stored"
if it was the same instance already stored: an entity with a new ID wasn't
stored, and another instance with the same ID (an updated copy) didn't
replace the stored one.SetEntityRepository.nextID(length + 1) could
reuse an ID after a remove: now the greatest ID + 1. -
Fix:
DBObjectMemoryAdapter/DBObjectDirectoryAdapter/DBObjectGCSAdapter:
a partial update (storeof a tracked entity: only its changed fields)
replaced the stored object with only those fields (the others lost): now
merged into the stored object. -
Fix:
APITokenStore.storeAPIToken: aMap<String, Object>data became an
UnmodifiableMapView<String, Object?>(not aMap<String, Object>): its
check was after theMap<String, Object?>one (that also matches it). -
Removed unreachable code:
LoggerHandler.resolveLogDestiny's 2-parameter
function branches (alreadyMessageLoggers),APIConfig's%var%
fallback (the group always matches) and a duplicated
DBAdapterException.resolveToStringbranch. -
APIServerWorker._startLetsEncrypt: removed the unreachablenull
directory check (only called with a directory:canUseLetsEncrypt); the
"directory doesn't exist" check (removed after the worker's constructor)
is now tested. -
Fix:
DBObjectDirectoryAdapter: a partial update of an object whose file
can't be parsed (e.g. truncated by a crash in the middle of a write) failed
(the merge read it): now the update rewrites it (logged). -
SetEntityRepository: its entries by ID (aLinkedHashMap):selectByID,
existsIDandstorelook up the ID without a scan
(IterableEntityRepository.getStoredByID), and an updated copy replaces
the stored entity in its position (IterableEntityRepository.replace;
previously moved to the end of the iteration order). -
Fix:
checkTablesreported a missing unique column's constraint also as a
missing unique constraint (itsADD COLUMNbrings it): the suggested SQLs
had it twice. -
Fix: an error in an operation's
preFinish(run after its transaction
execution: e.g. building the entities of a select, or storing the
relationships of an insert) didn't abort the transaction: the operation
was never finished, and the transaction never committed nor aborted
(in an auto-commit transaction, a SQL adapter's connection held). Now
DBAdapter.finishOperation(used by all the adapters) notifies it to the
transaction (notifyExecutionError): aborted, and the error (resolved by
the adapter) rethrown. -
Docs: the
DBObjectAdapters (memory, directory, GCS) don't enforce unique
fields (@EntityField.unique(),@EntityIndex(unique: true)): object
storages (e.g. GCS, S3) are not designed for that (no index over the
objects' values, nor transactions over multiple objects). Documented in
DBObjectAdapter, each object adapter,EntityField/EntityIndex.unique
and the README (newObjectAdaptersection). -
Fix:
DBObjectGCSAdapter: a partial update with an error reading the
stored object (other than not found: e.g. a timeout or a 5xx response)
overwrote it with only the changed fields: now the update fails (the
stored object is kept). A select still handles a read error as not found. -
Tests:
DBObjectGCSAdapter(with an in-memory fake of the GCS JSON API):
insert, partial updates, updated copies, read errors, enum/Decimal
fields, deletes, the local cache (limits,cacheDevelopment) and
fromConfig; also the shared object adapters tests (without and with a
cache). -
Fix:
DBObjectGCSAdapterstored anEntityReferenceListfield as the
object itself (wrapped in aList), not its IDs (as fixed for the memory
and directory adapters). -
Fix:
checkTables(MySQL) suggested SQLs that MySQL can't run:ADD COLUMN IF NOT EXISTS(a syntax error, also in the latest MySQL):
SQLDialect.alterTableAddColumnIfNotExistsisfalsefor MySQL.- The table quoted with
"(ALTER TABLE "store" ...: a string in
MySQL):AlterTableSQL/CreateTableSQL/CreateIndexSQL(SQLBuilder)
now use the dialect'selementQuoteby default ("if it has none).
-
Fix:
DBMySQLAdapter.getTableScheme/getTableFieldsTypesthrew for a
table that doesn't exist (ER_NO_SUCH_TABLE), instead ofnull(as the
other adapters). -
APIDBModule.select: paginated by default:defaultSelectLimit(default:1000): theLIMITof a request
without one (LIMIT=<n>in the URL query: a custom one;LIMIT=0: no
limit).PAGE=<n>without aLIMITis now a page of
defaultSelectLimitentities.- The HTML view has
previous/nextpage links (keeping the query and
theEAGER/ORDERdirectives), and the[first - last]entities shown;
its JSON link is for the same page (and with the query now URL-encoded).