[DEV-1654] Support V2 projection engine on createProjection#502
Conversation
Adds ProjectionEngineVersion enum and engineVersion option to createProjection, plumbed through both gRPC (CreateReq.Options.engine_version) and the HTTP fallback (engineversion query param).
Review Summary by QodoSupport V2 projection engine selection in createProjection
WalkthroughsDescription• Adds ProjectionEngineVersion enum with V1 and V2 options • Introduces engineVersion parameter to createProjection method • Plumbs engine version through gRPC and HTTP protocols • Adds test coverage for V2 projection engine creation Diagramflowchart LR
A["ProjectionEngineVersion enum<br/>V1 default, V2 opt-in"] -->|"engineVersion option"| B["CreateProjectionOptions"]
B -->|"gRPC path"| C["CreateReq.Options<br/>engine_version field"]
B -->|"HTTP path"| D["Query param<br/>engineversion"]
C --> E["Projection created<br/>with selected engine"]
D --> E
File Changes1. packages/db-client/src/projections/createProjection.ts
|
Code Review by Qodo
1.
|
Switch the public enum to string values (V1="v1", V2="v2") and map to the int32 wire format at the gRPC/HTTP boundary. Resolve option defaults once at the entry instead of duplicating them in each helper.
879611a to
89bbff7
Compare
Replace the local TypeScript enum with constants in src/constants.ts (PROJECTION_ENGINE_V1 / PROJECTION_ENGINE_V2) plus a union type in src/types, matching the pattern used by NodePreference, ConsumerStrategy, and other public string-valued enums.
89bbff7 to
8bde488
Compare
Summary
Adds a new
engineVersionoption tocreateProjectionso callers can opt into the V2 projection engine. V1 remains the default and the existing call shape is unchanged for V1 callers.Usage
The accepted values are
PROJECTION_ENGINE_V1("v1") andPROJECTION_ENGINE_V2("v2"), exposed as theProjectionEngineVersionunion type.Notes
trackEmittedStreams, bi-state projections, or liveoutputStateresult streams. See the KurrentDB docs for the full list of V2 limitations before opting in.engine_versionfield (gRPC) orengineversionquery parameter (HTTP fallback) when V2 is explicitly selected, so legacy servers continue to receive the same request shape as before.Refs DEV-1654.