@prisma-next/mongo-lowering 0.5.0-dev.9 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,9 +1,28 @@
1
+ import { CodecCallContext } from "@prisma-next/framework-components/codec";
1
2
  import { MongoQueryPlan } from "@prisma-next/mongo-query-ast/execution";
2
3
  import { AnyMongoWireCommand } from "@prisma-next/mongo-wire";
3
4
 
4
5
  //#region src/adapter-types.d.ts
5
6
  interface MongoAdapter {
6
- lower(plan: MongoQueryPlan): Promise<AnyMongoWireCommand>;
7
+ /**
8
+ * Lower a `MongoQueryPlan` to a driver-ready wire command.
9
+ *
10
+ * `ctx` carries the per-`runtime.execute()` context — today just an
11
+ * `AbortSignal` for cooperative cancellation. The runtime allocates one
12
+ * ctx per execute and threads the same reference through
13
+ * `lower → resolveValue → codec.encode`, so codec authors observe
14
+ * **signal identity** across the whole encode dispatch. The `signal`
15
+ * field inside the ctx may be `undefined`, but the ctx object itself
16
+ * is always present.
17
+ *
18
+ * Implementations are expected to:
19
+ * - Pass `ctx` through to every `resolveValue` call so the per-level
20
+ * `Promise.all` race can observe the signal.
21
+ * - Surface `RUNTIME.ABORTED { phase: 'encode' }` (via `runtimeAborted`)
22
+ * from inside `resolveValue` when the signal aborts mid-flight; no
23
+ * adapter-level abort handling is required beyond ctx forwarding.
24
+ */
25
+ lower(plan: MongoQueryPlan, ctx: CodecCallContext): Promise<AnyMongoWireCommand>;
7
26
  }
8
27
  //#endregion
9
28
  //#region src/driver-types.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/adapter-types.ts","../src/driver-types.ts"],"sourcesContent":[],"mappings":";;;;UAGiB,YAAA;cACH,iBAAiB,QAAQ;AADvC;;;UCDiB,WAAA;4BACW,sBAAsB,cAAc;WACrD;ADDX"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/adapter-types.ts","../src/driver-types.ts"],"mappings":";;;;;UAIiB,YAAA;;AAAjB;;;;;;;;;;;;;;;;;EAmBE,KAAA,CAAM,IAAA,EAAM,cAAA,EAAgB,GAAA,EAAK,gBAAA,GAAmB,OAAA,CAAQ,mBAAA;AAAA;;;UCrB7C,WAAA;EACf,OAAA,MAAa,WAAA,EAAa,mBAAA,GAAsB,aAAA,CAAc,GAAA;EAC9D,KAAA,IAAS,OAAA;AAAA"}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {};
package/package.json CHANGED
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "name": "@prisma-next/mongo-lowering",
3
- "version": "0.5.0-dev.9",
3
+ "version": "0.5.0",
4
+ "license": "Apache-2.0",
4
5
  "type": "module",
5
6
  "sideEffects": false,
6
7
  "description": "Adapter and driver interfaces for Prisma Next MongoDB lowering",
7
8
  "dependencies": {
8
- "@prisma-next/mongo-wire": "0.5.0-dev.9",
9
- "@prisma-next/mongo-query-ast": "0.5.0-dev.9"
9
+ "@prisma-next/framework-components": "0.5.0",
10
+ "@prisma-next/mongo-query-ast": "0.5.0",
11
+ "@prisma-next/mongo-wire": "0.5.0"
10
12
  },
11
13
  "devDependencies": {
12
- "tsdown": "0.18.4",
14
+ "tsdown": "0.22.0",
13
15
  "typescript": "5.9.3",
14
- "vitest": "4.0.17",
15
- "@prisma-next/tsdown": "0.0.0",
16
- "@prisma-next/tsconfig": "0.0.0"
16
+ "vitest": "4.1.5",
17
+ "@prisma-next/tsconfig": "0.0.0",
18
+ "@prisma-next/tsdown": "0.0.0"
17
19
  },
18
20
  "files": [
19
21
  "dist",
@@ -1,6 +1,25 @@
1
+ import type { CodecCallContext } from '@prisma-next/framework-components/codec';
1
2
  import type { MongoQueryPlan } from '@prisma-next/mongo-query-ast/execution';
2
3
  import type { AnyMongoWireCommand } from '@prisma-next/mongo-wire';
3
4
 
4
5
  export interface MongoAdapter {
5
- lower(plan: MongoQueryPlan): Promise<AnyMongoWireCommand>;
6
+ /**
7
+ * Lower a `MongoQueryPlan` to a driver-ready wire command.
8
+ *
9
+ * `ctx` carries the per-`runtime.execute()` context — today just an
10
+ * `AbortSignal` for cooperative cancellation. The runtime allocates one
11
+ * ctx per execute and threads the same reference through
12
+ * `lower → resolveValue → codec.encode`, so codec authors observe
13
+ * **signal identity** across the whole encode dispatch. The `signal`
14
+ * field inside the ctx may be `undefined`, but the ctx object itself
15
+ * is always present.
16
+ *
17
+ * Implementations are expected to:
18
+ * - Pass `ctx` through to every `resolveValue` call so the per-level
19
+ * `Promise.all` race can observe the signal.
20
+ * - Surface `RUNTIME.ABORTED { phase: 'encode' }` (via `runtimeAborted`)
21
+ * from inside `resolveValue` when the signal aborts mid-flight; no
22
+ * adapter-level abort handling is required beyond ctx forwarding.
23
+ */
24
+ lower(plan: MongoQueryPlan, ctx: CodecCallContext): Promise<AnyMongoWireCommand>;
6
25
  }