RDBC-1107 sync 7.2.5 -> 7.2.6 - #578
Merged
Merged
Conversation
- Bump CLIENT_VERSION to 7.2.6 and package version to 7.2.8 - Add AiOutputOptions: per-turn output schema override (sampleObject / outputSchema / noSchema) on run() and stream(), stream(callback) for raw text answers, runWithSchema() / streamWithSchema() convenience methods; send OutputOptions in the conversation request body and allow an empty streamPropertyPath when streaming without a schema - Document and test no-args action tool handlers for handle()/receive() - Add storeChunkText to EmbeddingsGenerationConfiguration - Fix WhereToken.addAlias() returning a copy with the alias applied twice; MoreLikeThisToken is no longer aliased - Add AI exception names (incl. QueryToolFailedException) to RavenErrorType - Update CdcSinkPostgresSettings doc comments Not ported: expression-tree (preferInterpretation) and Newtonsoft-only changes, which have no Node.js counterpart.
RDBC-1107 Address final review: pin removeAt(-1) fallback, document strictness, tidy exports RDBC-1107 Document JsonPatch session patching RDBC-1107 Emit JsonPatch from session.advanced.patchObject() RDBC-1107 Assert the server error in the strict removeAt test RDBC-1107 Emit JsonPatch from session.advanced.patchArray() RDBC-1107 Align patch tests with the JsonPatch default RDBC-1107 Emit JsonPatch from session.advanced.patch() RDBC-1107 Fix JavaScriptArray/JavaScriptMap generic inference in DocumentSession RDBC-1107 Apply JsonPatch batch results to tracked entities RDBC-1107 Record operations on JavaScriptArray and JavaScriptMap, quote map keys RDBC-1107 Add JSON pointer helper for session patch paths RDBC-1107 Add sessionPatchBehavior convention
- RavenDB_22293: increment() under optimistic concurrency, increment() stays on JavaScript, tracked entity keeps saving after a JsonPatch - RavenDB_22750: indexTimestamp/lastQueryTime are valid dates for an index that never ran (query, collection query, stream statistics) - MoreLikeThisTokenAliasTests / VectorSearchTokenAliasTests: end-to-end from-alias on a JS-object projection keeps moreLikeThis() and vector.search() intact (alias applied via addFromAliasToWhereTokens)
kalczur
approved these changes
Sep 9, 2026
Merged
41 tasks
M4xymm
added a commit
that referenced
this pull request
Sep 9, 2026
RDBC-1107 Follow-up to #578: order-by aliasing, empty output options, patchObject key docs
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.
Issue link
https://issues.hibernatingrhinos.com/issue/RDBC-1107
Description
Sync of the Node.js client with the C# client
7.2.5->7.2.6(CLIENT_VERSION7.2.6, npm7.2.8), plus the RavenDB-22293 change from the same C# release: session patches are emitted as RFC 6902 JsonPatch batch commands.Synced from the C# 7.2.6 patch
AiOutputOptions: per-turn output schema override for AI conversations.run()/stream()accept{ sampleObject | outputSchema | noSchema },stream(callback)streams a plain text answer (emptystreamPropertyPath),runWithSchema()/streamWithSchema()mirror the C# convenience overloads.OutputOptionsis sent in the conversation request body.noSchemacombined with a schema throwsInvalidOperationExceptionbefore contacting the server.outputSchema(per turn and agent level) is forwarded to the model verbatim asresponse_format.json_schema, so it has to be the OpenAI-style{ name, strict, schema }wrapper. Documented in JSDoc and README (a bare JSON schema makes the model answer in prose and the turn fails to parse).handle()/receive()documented and tested.storeChunkTextonEmbeddingsGenerationConfiguration(serialized asStoreChunkText, part ofisEqual).RavenErrorType(incl.QueryToolFailedException).WhereToken.addAlias()no longer returns a copy with the alias applied twice; it updates the token in place and returns it, soVectorSearchTokenkeeps its shape.MoreLikeThisTokenoverridesaddAlias()as a no-op (no field to prefix).CdcSinkPostgresSettingsdoc comments.preferInterpretation) and Newtonsoft-only changes, no Node.js counterpart.JsonPatch session patching (RavenDB-22293, C#
SessionPatchBehavior)conventions.sessionPatchBehavior: "JsonPatch" | "JavaScript", default"JsonPatch"(same default as the C# client).session.advanced.patch(),patchArray()andpatchObject()emit aJsonPatchbatch command when the path is a plain member/index chain and every value isnullor a JSON primitive. One document gets one merged JsonPatch command persaveChanges(). Batch results are applied to tracked entities (change vector / metadata refresh) the same way as for JavaScript patches.Datevalues,increment(),addOrIncrement(),addOrPatch(), paths that are not plain member/index chains (e.g.tags[this.tags.length - 1]),removeAt()with a negative index, keys that are not valid JSON pointer segments, empty builders, and any operation queued after a JavaScript patch on the same document (order is preserved).JsonPatchDocument(add / replace / remove / move / copy / test),JsonPatchCommandData(usable withsession.advanced.defer()),SessionPatchBehavior.JavaScriptArray/JavaScriptMaprecord theiroperations;JavaScriptMapnow uses bracket notationthis.path["key"]in the JavaScript fallback so keys with spaces or dots work.RavenDB_22293(all client-portable cases),RavenDB_22750,MoreLikeThisTokenAliasTests,VectorSearchTokenAliasTests,RavenDB-24824(offline: options plumbing and request body; the live OpenAI cases have no Node.js infrastructure).FirstClassPatchTestadjusted to the new default (deferred command counts,deferred JsonPatch commandin the error message).Notes for reviewers
addFromAliasToWhereTokens()has no internal callers (public onDocumentQueryonly). The end-to-end alias tests call it explicitly, which is the only path that exercises theWhereToken.addAlias()fix.removeAt()past the end of the array orremove()of a missing key now makessaveChanges()throw where the JavaScript variants were silent no-ops. Covered by tests for both behaviors.Type of change
7.2.5->7.2.6)Target branch and backports
v7.2,v7.1,v7.0,v6.0)How risky is the change?
Backward compatibility
session.advanced.patch()/patchArray()/patchObject()sendJsonPatchcommands by default instead of JavaScript scripts, and JsonPatch is strict (out-of-rangeremoveAt(),remove()of a missing key andpatch()on a non-existing array index throw instead of being no-ops). Migration path: setstore.conventions.sessionPatchBehavior = "JavaScript"beforestore.initialize()to keep the previous behavior.WhereToken.addAlias()now returns the same token instance instead of a copy.Server compatibility
JsonPatch batch commands are supported by every server version in the CI matrix.
AiOutputOptionsis only honored by a 7.2 server that includes RavenDB-24824 (7.2.6+); the AI tests stay gated to 7.1+ and the new ones run offline. Verified locally against 7.2.6 only; behavior of older servers receivingOutputOptionswas not checked.Affected runtimes
Public API
src/index.ts(npm run check-exportspasses).package.jsonandCLIENT_VERSIONinsrc/Http/RequestExecutor.ts(sync / release PRs only)New exports:
SessionPatchBehavior,JsonPatchCommandData,JsonPatchDocument,JavaScriptArray(AiOutputOptionsviaDocuments/Operations/AI/index.ts). New methods:AiConversation.runWithSchema(),streamWithSchema(),stream(callback);run()/stream()acceptAiOutputOptions. New conventionsessionPatchBehavior, new fieldEmbeddingsGenerationConfiguration.storeChunkText.package.json7.2.7->7.2.8,CLIENT_VERSION7.2.5->7.2.6.Documentation update
README.mdhas been updatedTesting by Contributor
Tests have been added that prove the fix is effective or that the feature works
Existing tests verify the correct behavior
It has been verified by manual testing
npm run lint,npm run build,npm run check-exportsandnpm run check-importspass locallyTests have been run locally against a RavenDB server (
RAVENDB_TEST_SERVER_PATH/RAVENDB_SERVER_VERSION)Runtime-specific changes have been verified on the affected runtime (Bun / Deno / Cloudflare Workers)
Added:
test/Ported/Issues/RavenDB_22293.ts,test/Ported/Issues/RavenDB_22750.ts,test/Ported/MoreLikeThis/MoreLikeThisTokenAliasTest.ts,test/Documents/Queries/VectorSearchTokenAliasTest.ts,test/Documents/Session/Tokens/WhereTokenAliasTest.ts,test/Documents/Commands/JsonPatchCommandDataTest.ts,test/Documents/Conventions/SessionPatchBehaviorTest.ts,test/Documents/Session/JavaScriptPatchBuildersTest.ts,test/Documents/Session/JsonPatchPathTest.ts,test/Ported/Documents/Operations/AiStreamingTest.ts; extendedAiConversationTest.ts,EmbeddingsGenerationConfigurationTest.ts,FirstClassPatchTest.ts.Run locally against RavenDB 7.2.6 (
RAVENDB_SERVER_VERSION=7.2): the files above plusPatchTest,MoreLikeThisTest: 203 passing, 0 failing.Manual testing:
AiOutputOptions(sample object, explicit schema,noSchema, streaming) against a 7.2.6 server with Ollama (llama3.2).npm run lintreports only pre-existing findings unrelated to this PR: gitignoredtest/cloudflare-nitro/.nitro/*.d.tsleftovers of a local Nitro build and theno-consolewarning insrc/Auth/Certificate.ts. There is nobuildscript;tshy(thepreparestep) completes without errors.check-exportsandcheck-importspass.Dependencies
Is there any existing behavior change of other features due to this change?
Yes. Please list the affected features/subsystems and provide appropriate explanation
No
Session patching (
session.advanced.patch()/patchArray()/patchObject()):JsonPatchcommands by default, strict semantics, one merged command per document;increment()and friends unchanged. The "document modified by the session and also taking part in a deferred command" error now names theJsonPatchcommand.Query aliasing:
WhereToken.addAlias()mutates and returns the same token;MoreLikeThisTokenis no longer aliased.AI conversations:
stream()accepts an empty property path whennoSchemais set; the request body carriesOutputOptionsonly when options are given.