Repository navigation
chore: land the cleanup campaign on main - #71
Merged
Merged
Conversation
* refactor(staged-query): check kind symbols with one predicate, annotate key() and distinct() returns * refactor(atomic): narrow the adapter result with a guard and compare the prototype as unknown * test: reject through a typed helper, type the change-feed and other-instance fixtures * test(scripts): give the staged-query script its types and use registerHooks for the import guard * chore: lower the ratchet ceilings
* docs: typecheck every example and drop hand-written version prose * docs: import Schema in the complete examples and type the untyped schemas * docs: restate the schema types from the package and check them
* feat(database)!: type every query stage by name
QueryStage becomes a union discriminated on `stage`, built from the new
QueryStageMap (options and arguments of every stage the builders record),
so adapters read typed options and arguments instead of `any`.
- QueryStage(name, options, ...args) and StagedObject#stage(type, stage)
take a typed stage; ValidateAtomicMutation asserts the validated request.
- ValueProxy#eq and #ne take a constant of the value's type or any
expression.
- pluck and without return Pick and Omit of the named fields; key, lookup,
between, table, group and the aggregate field names are string keys.
- getAll accepts a list of compound keys, lookup accepts any stream.
- DeepPartial keeps scalars, null and dates, and leaves any and unknown as
they are; write builders take object documents.
- Schema.list() lists the schemas the process defined.
BREAKING CHANGE: QueryStage is a discriminated union and QueryStage() and
the protected StagedObject#stage are typed by stage name; eq and ne type
their constant operand; pluck and without narrow their result; key names,
table ids and index or field names must be string keys.
* build: set the package version to 0.3.0
Tarballs packed from this branch carry the next minor, so consumers exercise core's runtime range check against 0.3.0 before the release.
* build: keep the package version at 0.2.0
The release bumps the version from the conventional commits; campaign tarballs carry 0.3.0 through TGZ_VERSION (h9-plan decision 5).
* feat(database): add IsQueryStage to narrow a recorded stage by name
* feat(database): let QueryStage leave out options an argument-free stage does not require
* build: set the package version to 0.3.0
The wave's brief sets the next version in package.json only: tarballs packed
from this branch carry 0.3.0, so core's runtime range check runs against it
before the release.
* fix(database): keep DeepPartial a mapped type at the top level
A conditional DeepPartial<T> stays unresolved for a generic T, so a model
generic over its row type (interface-database-decorators' BasicDataModel)
could no longer pass the record it built to insert or update. Mapping T's
keys at the top level, as before, keeps that assignable; the leaves keep
scalars, null and dates.
* refactor(database): move ValueProxy's conditions and kind guard to sibling modules
valueproxy.ts sits at the size ceiling, and this wave adds to it. The exports of
the module do not change: it re-exports what moved.
* test(database): cover the operations the drivers answer beyond the 0.2 types
min and max over strings and dates and a numeric filter body run against the
driver. The operand of add, the numeric bounds of during, an expression key and
the bounds of between check the stage an adapter reads. None of these compile
against the types of this commit; the next one widens them.
* feat(database)!: type what every driver answers for add, min, max, during, filter, key and between
- add takes an operand per receiver: seconds on a date, a number on a number, a
string on a string, a list on a list, or null
- min and max take arrays of strings and dates and answer the element type
- during takes bounds as seconds since the UNIX epoch
- a list filter's predicate may answer a number, which keeps the element unless
it is 0
- Stream.key takes an expression yielding the field name
- between's bounds are a named IndexBound instead of unknown stage arguments, so
a field that is no index value stops compiling as a bound
BREAKING CHANGE: Table.between refuses a bound outside IndexBound, and adapters
must answer the widened operations.
* chore(guardrails): keep integration's ratchet file
The repo has more than one open burn-down PR, so the ceilings move in a separate
ratchet PR after this wave lands; the rows this PR removes are in its body.
* fix(database): take a proxy of the receiver's type as add's operand
A ValueProxy<number> is not a ValueProxy<number | null>, so mongodb's reads, which
add two numeric proxies, stopped compiling against the first form of the operand.
* fix(database): keep during's bounds one type and read a number as milliseconds
A union of the two bound types stopped row.key("low") inferring its field, and
postgres already reads a number as new Date(n) does.
… a single-use type parameter (#54)
* chore: count the last lint disables with their reasons * chore(ratchet): delete the guardrail ratchet * chore: run pnpm run sync after deleting the ratchet
* feat(database)!: type written documents as write values `insert`, `update` and `replace` took `DeepPartial<T> & object`, whose leaves admitted `bigint` and `symbol`, and the stages recorded the documents as `object`. No provider stores either value as given: MongoDB truncates a `bigint` to 64 bits and drops a `symbol`, RethinkDB refuses a `bigint` and drops a `symbol`, and PostgreSQL refuses both. `WriteValue` names what every provider writes and reads back: text, numbers, booleans, `null`, `undefined` (no value), dates, lists and nested documents. `DeepPartial` keeps those leaves, maps a field typed `unknown` or `any` to `WriteValue`, and maps any other non-object type to `never`. The `insert`, `update` and `replace` stages record `WriteDocument`s, so a provider reads them without an assertion. BREAKING CHANGE: a document holding a `bigint`, a `symbol`, or a value typed `unknown` no longer compiles. `WriteValue` and `WriteDocument` are new exports of `/common`. * feat(database)!: keep an any-typed field of a written document as any Mapping `any` to `WriteValue` turned `DeepPartial<any>` into an index signature of `WriteValue`, so an interface-typed row, which has no implicit index signature, no longer went into a `Table<any>` even when every value it holds is stored as given. `any` stays the caller's opt-out; a field typed `unknown` still takes a `WriteValue`, and the builders still record `WriteDocument`s. The first commit also dropped the TSDoc of `DeepPartial`; it is back, with the new mapping.
* feat(skills): add the verify-interface verification skill * fix(skills): pin the duplicate key message with two fields and type the package expectations * fix(skills): pin what an adapter validates with the atomic mutation helpers * fix(skills): expect the exports of the built head, not of a mutated build
* feat(database)!: type the operands of query stages as query values A stage recorded its operands as `Value<unknown>`, which is `unknown`: no adapter could name what it reads. `QueryValue` names it: another staged object, text, a number, a boolean, `null`, `undefined`, a date, a list of operands or a record of operands. The builders take the part of their type a stage can record (`QueryOperand<T>`, `T & QueryValue`), so a `bigint`, a `symbol`, a function or a record declared with `interface` no longer compiles as an operand, and an `any` operand stays `any`. The `add` stage records a list of `QueryValue`s instead of `unknown[]`. BREAKING CHANGE: an operand of `eq`, `ne`, `default`, `sub`, `gt`, `ge`, `lt`, `le`, `includes`, `key` (with a default), `merge` or `ValueProxy.constant` holding a `bigint`, a `symbol`, a function or an interface-typed record no longer compiles. `QueryValue`, `QueryRecord` and `QueryOperand` are new exports. * fix(valueproxy): infer a default from the whole union it is given `default<U>(value: QueryOperand<U>)` inferred `U` through the intersection `U & QueryValue`, which matched only the scalar members of a union such as a recursive field value and refused the rest. `default`, `sub`, `merge` and the default of `key` take `U extends QueryValue` instead, so `U` is the type given. `ValueProxyOrValue` moves next to the other operand types to keep `valueproxy.ts` under the size ceiling. * fix(valueproxy): leave the default of key to its argument `key` on a proxy took `U extends QueryValue = undefined`, so a call that passes the entry to a parameter typed from its context inferred `U` from that context and fell back to the whole constraint. `U` stays unconstrained as before, and only a default that is given must be a query operand. * fix(valueproxy): check a compared operand against the receiver by structure `eq`, `ne`, `gt`, `ge`, `lt`, `le` and `includes` took `T & QueryValue`, which refuses a value of a type declared with `interface` because it has no implicit index signature. `OperandValue<T>` maps the structure of `T` instead, as `DeepPartial` does for written documents, so the operand is checked member by member and an interface-typed record compiles. A `bigint`, a `symbol` and a function still map to `never`, and an `any` stays `any`. * fix(valueproxy): keep includes open on a proxy typed any `ArrayValue<any>` is `unknown`, so `includes` on a proxy typed `any` took a `QueryValue` where it took anything before. `any` is the caller's opt-out and stays one. * feat(database): add IsQueryValue, the guard of a query value A value typed `unknown` cannot be the operand of a stage once operands are query values. `IsQueryValue` narrows it at the boundary: it accepts a staged object, a scalar, a date, and a list or plain record of those, held twice or not, and refuses a bigint, a symbol, a function, a Map, a class instance and a cyclic structure. It walks with a stack of its own, so a deeply nested value cannot exhaust the call stack. * refactor(database): add no runtime export for query values `IsQueryValue` was the one runtime addition of this change. A consumer that calls it needs a provider that ships the new interface at test time too, because AntelopeJS loads the interface from the provider that implements it, and every consumer's tests pin the published providers. A consumer that narrows a value typed `unknown` writes the check for the values it holds, and the change stays type-only.
…d count (#65) Reading the result of `update` through its type (`ReturnType<typeof table.update>`) took the last overload, whose conditional return resolved to `any`. The overloads are reordered so that the document overload, which returns `Query<number>`, is the one a type-level read sees. Calls type exactly as before.
* docs: pass the database docs to the docs standard * docs: turn on the docs standard * docs: list the root Schema class and fix the W5 notes
* docs: release notes for interface-database 0.3.0 * docs: cover every breaking change in the interface-database 0.3.0 release notes
This was referenced Nov 4, 2026
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.
Lands
campaign/integrationat 6e807ac onmain. Every change on that branch landed through a verified pull request. The tree of this pull request equalscampaign/integration; the merge ofmainonly joins the histories, sincecampaign/integrationalready contains every change ofmainup to d66e33c. No package is published by this merge.