@prisma/orm-family-sql 8.0.0-rc.24-dev.22 → 8.0.0-rc.24-dev.24

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.
Files changed (35) hide show
  1. package/dist/{control-DAy47VdX.d.mts → control-Cb6YoQ8j.d.mts} +15 -15
  2. package/dist/control-Cb6YoQ8j.d.mts.map +1 -0
  3. package/dist/{control-adapter-BfyLe7rh-evCd4Qt7.d.mts → control-adapter-0z3ce44U-CLj4kqLI.d.mts} +6 -18
  4. package/dist/control-adapter-0z3ce44U-CLj4kqLI.d.mts.map +1 -0
  5. package/dist/{control-adapter-B0UU7Mk7.d.mts → control-adapter-DIwBUSs6.d.mts} +2 -2
  6. package/dist/{control-adapter-B0UU7Mk7.d.mts.map → control-adapter-DIwBUSs6.d.mts.map} +1 -1
  7. package/dist/{control-C9mYI0zS.mjs → control-kHFMtE8A.mjs} +52 -8
  8. package/dist/control-kHFMtE8A.mjs.map +1 -0
  9. package/dist/{diff-BkF95ZnP.d.mts → diff-DbkXUf4C.d.mts} +2 -2
  10. package/dist/{diff-BkF95ZnP.d.mts.map → diff-DbkXUf4C.d.mts.map} +1 -1
  11. package/dist/{exports-BE9wmKAn-DI9rC9jC.mjs → exports-BR5ctYYI-C_-aedbr.mjs} +36 -31
  12. package/dist/exports-BR5ctYYI-C_-aedbr.mjs.map +1 -0
  13. package/dist/family.d.mts +7 -7
  14. package/dist/family.mjs +2 -2
  15. package/dist/family__control-adapter.d.mts +2 -2
  16. package/dist/family__control.d.mts +3 -3
  17. package/dist/family__control.mjs +2 -2
  18. package/dist/family__diff.d.mts +1 -1
  19. package/dist/family__migration.d.mts +1 -1
  20. package/dist/{index-BoxqxQ3G.d.mts → index-DA1EEz4y.d.mts} +6 -3
  21. package/dist/index-DA1EEz4y.d.mts.map +1 -0
  22. package/dist/{migration-QS2FXNb_.d.mts → migration-DctFInNJ.d.mts} +2 -2
  23. package/dist/{migration-QS2FXNb_.d.mts.map → migration-DctFInNJ.d.mts.map} +1 -1
  24. package/dist/orm-client.d.mts +1 -1
  25. package/dist/orm-client.mjs +1 -1
  26. package/dist/runtime.d.mts +1 -1
  27. package/dist/runtime.mjs +1 -1
  28. package/dist/{types-COXfSNOP-CWJkgMR8.d.mts → types-CWvmfrfd-DLQYhSUx.d.mts} +6 -5
  29. package/dist/{types-COXfSNOP-CWJkgMR8.d.mts.map → types-CWvmfrfd-DLQYhSUx.d.mts.map} +1 -1
  30. package/package.json +18 -18
  31. package/dist/control-C9mYI0zS.mjs.map +0 -1
  32. package/dist/control-DAy47VdX.d.mts.map +0 -1
  33. package/dist/control-adapter-BfyLe7rh-evCd4Qt7.d.mts.map +0 -1
  34. package/dist/exports-BE9wmKAn-DI9rC9jC.mjs.map +0 -1
  35. package/dist/index-BoxqxQ3G.d.mts.map +0 -1
@@ -2,7 +2,7 @@ import { l as SqlStorage } from "./sql-storage-B_AM6tU1-BOPQxXo7.mjs";
2
2
  import "./types-CXRxo_TK.mjs";
3
3
  import { S as SqlSchemaIRNode } from "./types-fmtEmvj3-B0fQaVes.mjs";
4
4
  import "./types-B-dwfOwQ.mjs";
5
- import { t as CodecControlHooks } from "./types-COXfSNOP-CWJkgMR8.mjs";
5
+ import { t as CodecControlHooks } from "./types-CWvmfrfd-DLQYhSUx.mjs";
6
6
  import { t as SqlSchemaDiffFn } from "./schema-differ-DmP74bB8-BXkhxcPs.mjs";
7
7
  import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
8
8
  import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
@@ -114,4 +114,4 @@ declare function verifySqlSchemaByDiff(input: VerifySqlSchemaByDiffInput): Verif
114
114
  declare function arraysEqual(a: readonly string[], b: readonly string[]): boolean;
115
115
  //#endregion
116
116
  export { VerifySqlSchemaByDiffInput as a, classifySqlDiffIssue as c, verifySqlSchemaByDiff as d, StorageTypeVerdictInput as i, computeSqlDiffVerdict as l, SqlDiffVerdictInput as n, arraysEqual as o, StorageTypeVerdict as r, classifyDiffSubjectGranularity as s, SqlDiffVerdict as t, computeStorageTypeVerdict as u };
117
- //# sourceMappingURL=diff-BkF95ZnP.d.mts.map
117
+ //# sourceMappingURL=diff-DbkXUf4C.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diff-BkF95ZnP.d.mts","names":[],"sources":["../../../../2-sql-family/9-family/dist/diff.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAkBiB,+BAA+B,OAAO,iBAAiB,gBAAgB,qBAAqB,yBAAyB;;;;;;;;;;;;;iBAarH,qBAAqB,OAAO,iBAAiB,gBAAgB,qBAAqB,yBAAyB;UAClH;;WAEC,iBAAiB;;WAEjB,uBAAuB,OAAO,oBAAoB;WAClD;WACA,sBAAsB;;WAEtB,gBAAgB,qBAAqB;;UAEtC;WACC,mBAAmB;WACnB,mBAAmB;;;;;;;;;iBASb,sBAAsB,OAAO,sBAAsB;UAC1D;WACC,UAAU,SAAS;;;;;;;WAOnB,gBAAgB;aACd,QAAQ;;WAEV,YAAY,oBAAoB;;;;;;;;;UASjC;WACC,mBAAmB;WACnB,mBAAmB;;iBAEb,0BAA0B,OAAO,0BAA0B;UAClE;WACC,UAAU,SAAS;WACnB,QAAQ;WACR;WACA,qBAAqB,cAAc;;WAEnC,YAAY;;WAEZ,gBAAgB,qBAAqB;;;;;;;;;iBAS/B,sBAAsB,OAAO,6BAA6B;;;;;;;;;;;;;;iBAc1D,YAAY,sBAAsB"}
1
+ {"version":3,"file":"diff-DbkXUf4C.d.mts","names":[],"sources":["../../../../2-sql-family/9-family/dist/diff.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAkBiB,+BAA+B,OAAO,iBAAiB,gBAAgB,qBAAqB,yBAAyB;;;;;;;;;;;;;iBAarH,qBAAqB,OAAO,iBAAiB,gBAAgB,qBAAqB,yBAAyB;UAClH;;WAEC,iBAAiB;;WAEjB,uBAAuB,OAAO,oBAAoB;WAClD;WACA,sBAAsB;;WAEtB,gBAAgB,qBAAqB;;UAEtC;WACC,mBAAmB;WACnB,mBAAmB;;;;;;;;;iBASb,sBAAsB,OAAO,sBAAsB;UAC1D;WACC,UAAU,SAAS;;;;;;;WAOnB,gBAAgB;aACd,QAAQ;;WAEV,YAAY,oBAAoB;;;;;;;;;UASjC;WACC,mBAAmB;WACnB,mBAAmB;;iBAEb,0BAA0B,OAAO,0BAA0B;UAClE;WACC,UAAU,SAAS;WACnB,QAAQ;WACR;WACA,qBAAqB,cAAc;;WAEnC,YAAY;;WAEZ,gBAAgB,qBAAqB;;;;;;;;;iBAS/B,sBAAsB,OAAO,6BAA6B;;;;;;;;;;;;;;iBAc1D,YAAY,sBAAsB"}
@@ -18,7 +18,7 @@ import { checkContractComponentRequirements, mergeCapabilityMatrices } from "@pr
18
18
  import { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, createContextBeneath, executeStatement, raceAgainstAbort, runtimeError as runtimeError$1, startClientActivity, startTransactionActivity, streamStatement } from "@prisma/orm-framework/components/runtime";
19
19
  import { createExecutionStack } from "@prisma/orm-framework/components/execution";
20
20
  import { hashContent } from "@prisma/orm-framework/utils/hash-content";
21
- //#region ../../../2-sql-family/5-runtime/dist/exports-BE9wmKAn.mjs
21
+ //#region ../../../2-sql-family/5-runtime/dist/exports-BR5ctYYI.mjs
22
22
  /** The symbol-keyed member through which a runtime, connection, transaction, `withTransaction` context or activity handle starts activities; user-facing types do not show it. */
23
23
  const activitySource = Symbol("activitySource");
24
24
  function hasActivitySourceMember(target) {
@@ -1296,7 +1296,7 @@ var TransactionBase = class {
1296
1296
  this.openTransaction = {
1297
1297
  activity,
1298
1298
  assertAcceptsStatements: () => this.assertAcceptsStatements(),
1299
- assertBeforeDeadline: () => this.assertBeforeDeadline()
1299
+ assertOpen: () => this.assertOpen()
1300
1300
  };
1301
1301
  runtime.register(driverTx, this.openTransaction);
1302
1302
  this[activitySource] = {
@@ -1398,18 +1398,17 @@ var OuterTransaction = class extends TransactionBase {
1398
1398
  get rootTransaction() {
1399
1399
  return this.self;
1400
1400
  }
1401
- assertBeforeDeadline() {
1402
- if (this.timeout === void 0) return;
1401
+ assertOpen() {
1403
1402
  if (!this.closed && performance.now() >= this.deadline) this.expire();
1404
1403
  this.signal.throwIfAborted();
1405
- if (this.closed) throw transactionClosedError();
1404
+ if (this.isClosed) throw transactionClosedError();
1406
1405
  }
1407
1406
  assertAcceptsStatements() {
1408
1407
  if (this.stack.invalidated) throw transactionClosedError();
1409
1408
  if (!this.closed && this.stack.top !== this.entry) throw transactionSuspendedError(this.stack);
1410
1409
  }
1411
1410
  async commit() {
1412
- this.assertBeforeDeadline();
1411
+ if (this.timeout !== void 0) this.assertOpen();
1413
1412
  this.assertAcceptsStatements();
1414
1413
  this.stopDeadline();
1415
1414
  this.commitAttempted = true;
@@ -1509,7 +1508,6 @@ var OuterTransaction = class extends TransactionBase {
1509
1508
  }
1510
1509
  stopAcceptingChildren() {
1511
1510
  this.activity.stopAcceptingChildren();
1512
- if (this.timeout === void 0) this.openTransaction.activity = void 0;
1513
1511
  this.runtime.unregister(this.connection, this.openTransaction);
1514
1512
  }
1515
1513
  logDroppedError(error) {
@@ -1536,8 +1534,9 @@ var Savepoint = class extends TransactionBase {
1536
1534
  get rootTransaction() {
1537
1535
  return this.root;
1538
1536
  }
1539
- assertBeforeDeadline() {
1540
- this.root.assertBeforeDeadline();
1537
+ assertOpen() {
1538
+ this.root.assertOpen();
1539
+ if (this.isClosed) throw transactionClosedError();
1541
1540
  }
1542
1541
  assertAcceptsStatements() {
1543
1542
  if (this.isClosed) throw transactionClosedError();
@@ -2083,9 +2082,8 @@ var SqlRuntimeBase = class extends RuntimeCore {
2083
2082
  if (queryable === this.driver && this.#refusing && !admittedParent) throw runtimeClosedError();
2084
2083
  return this.#inFlight.begin();
2085
2084
  }
2086
- parentOf(queryable, options) {
2087
- const transaction = this.#transactions.get(queryable);
2088
- transaction?.assertAcceptsStatements?.();
2085
+ parentOf(transaction, options) {
2086
+ transaction?.assertAcceptsStatements();
2089
2087
  const openTransaction = transaction?.activity;
2090
2088
  const activityParent = options?.activityParent;
2091
2089
  if (activityParent === void 0) return openTransaction;
@@ -2095,14 +2093,15 @@ var SqlRuntimeBase = class extends RuntimeCore {
2095
2093
  getListDecoder() {
2096
2094
  return sqlNativeArrayListDecoder;
2097
2095
  }
2098
- async *streamDecodedRows(run, exec, createDecodeContext, driverCall, codecCtx, queryable, onDriverAnswered) {
2096
+ async *streamDecodedRows(run, exec, createDecodeContext, driverCall, codecCtx, queryable, transaction, onDriverAnswered) {
2099
2097
  const rowDecodeContext = createDecodeContext();
2098
+ transaction?.assertOpen();
2100
2099
  await this.setupDriverExecution(exec, queryable);
2101
2100
  const startedAt = Date.now();
2102
2101
  let telemetryOutcome = null;
2103
2102
  try {
2104
2103
  const iterator = run.runQuery(exec, () => {
2105
- this.#transactions.get(queryable)?.assertBeforeDeadline?.();
2104
+ transaction?.assertOpen();
2106
2105
  return driverCall();
2107
2106
  })[Symbol.asyncIterator]();
2108
2107
  let answered = false;
@@ -2167,18 +2166,19 @@ var SqlRuntimeBase = class extends RuntimeCore {
2167
2166
  const { codecCtx, contextFields } = this.createQueryContexts(options);
2168
2167
  const generator = async function* () {
2169
2168
  const endOperation = self.beginOperation(queryable, options);
2169
+ const transaction = self.#transactions.get(queryable);
2170
2170
  try {
2171
2171
  yield* streamStatement({
2172
2172
  middleware: self.middleware,
2173
2173
  plan,
2174
2174
  context: contextFields,
2175
- parent: self.parentOf(queryable, options)
2175
+ parent: self.parentOf(transaction, options)
2176
2176
  }, async function* (run) {
2177
2177
  const exec = await self.prepareOperation(plan, codecCtx, run);
2178
2178
  yield* self.streamDecodedRows(run, exec, () => buildDecodeContext(exec.ast, self.contractCodecs), () => queryable.query({
2179
2179
  sql: exec.sql,
2180
2180
  params: exec.params
2181
- }), codecCtx, queryable, endOperation);
2181
+ }), codecCtx, queryable, transaction, endOperation);
2182
2182
  });
2183
2183
  } finally {
2184
2184
  endOperation();
@@ -2198,30 +2198,32 @@ var SqlRuntimeBase = class extends RuntimeCore {
2198
2198
  async executeStatisticsInFlight(plan, queryable, options) {
2199
2199
  this.ensureCodecRegistryValidated();
2200
2200
  const { codecCtx, contextFields } = this.createQueryContexts(options);
2201
- return this.executeOn(queryable, options, plan, contextFields, async (run) => {
2201
+ return this.executeOn(queryable, options, plan, contextFields, async (run, transaction) => {
2202
2202
  const exec = await this.prepareOperation(plan, codecCtx, run);
2203
- return this.executeEncodedPlan(run, exec, queryable, codecCtx, () => queryable.execute({
2203
+ return this.executeEncodedPlan(run, exec, queryable, transaction, codecCtx, () => queryable.execute({
2204
2204
  sql: exec.sql,
2205
2205
  params: exec.params
2206
2206
  }));
2207
2207
  });
2208
2208
  }
2209
2209
  executeOn(queryable, options, plan, context, body) {
2210
+ const transaction = this.#transactions.get(queryable);
2210
2211
  return executeStatement({
2211
2212
  middleware: this.middleware,
2212
2213
  plan,
2213
2214
  context,
2214
- parent: this.parentOf(queryable, options)
2215
- }, body);
2215
+ parent: this.parentOf(transaction, options)
2216
+ }, (run) => body(run, transaction));
2216
2217
  }
2217
- async executeEncodedPlan(run, exec, queryable, codecCtx, driverCall) {
2218
+ async executeEncodedPlan(run, exec, queryable, transaction, codecCtx, driverCall) {
2219
+ transaction?.assertOpen();
2218
2220
  await this.setupDriverExecution(exec, queryable);
2219
2221
  checkAborted(codecCtx, "stream");
2220
2222
  const startedAt = Date.now();
2221
2223
  let telemetryOutcome = "success";
2222
2224
  try {
2223
2225
  return await run.runExecute(exec, () => {
2224
- this.#transactions.get(queryable)?.assertBeforeDeadline?.();
2226
+ transaction?.assertOpen();
2225
2227
  return driverCall();
2226
2228
  });
2227
2229
  } catch (error) {
@@ -2263,20 +2265,21 @@ var SqlRuntimeBase = class extends RuntimeCore {
2263
2265
  const { codecCtx, contextFields } = this.createQueryContexts(options);
2264
2266
  const generator = async function* () {
2265
2267
  const endOperation = self.beginOperation(queryable, options);
2268
+ const transaction = self.#transactions.get(queryable);
2266
2269
  try {
2267
2270
  yield* streamStatement({
2268
2271
  middleware: self.middleware,
2269
2272
  plan: ps,
2270
2273
  context: contextFields,
2271
- parent: self.parentOf(queryable, options)
2272
- }, (run) => self.streamPreparedRows(run, ps, userParams, queryable, codecCtx, endOperation));
2274
+ parent: self.parentOf(transaction, options)
2275
+ }, (run) => self.streamPreparedRows(run, ps, userParams, queryable, transaction, codecCtx, endOperation));
2273
2276
  } finally {
2274
2277
  endOperation();
2275
2278
  }
2276
2279
  };
2277
2280
  return new AsyncIterableResult(generator());
2278
2281
  }
2279
- async *streamPreparedRows(run, ps, userParams, queryable, codecCtx, onDriverAnswered) {
2282
+ async *streamPreparedRows(run, ps, userParams, queryable, transaction, codecCtx, onDriverAnswered) {
2280
2283
  checkAborted(codecCtx, "stream");
2281
2284
  const preEncodeValues = resolvePreparedSlotValues(ps, userParams);
2282
2285
  const preEncodeExec = {
@@ -2305,7 +2308,7 @@ var SqlRuntimeBase = class extends RuntimeCore {
2305
2308
  }
2306
2309
  }
2307
2310
  };
2308
- yield* this.streamDecodedRows(run, exec, () => ps.decodeContext, () => queryable.query(request), codecCtx, queryable, onDriverAnswered);
2311
+ yield* this.streamDecodedRows(run, exec, () => ps.decodeContext, () => queryable.query(request), codecCtx, queryable, transaction, onDriverAnswered);
2309
2312
  }
2310
2313
  /** Execute a prepared statement's statistics against a caller-supplied queryable through the full pipeline. */
2311
2314
  async runPreparedExecuteAgainstQueryable(ps, userParams, queryable, options) {
@@ -2319,9 +2322,9 @@ var SqlRuntimeBase = class extends RuntimeCore {
2319
2322
  async runPreparedExecuteInFlight(ps, userParams, queryable, options) {
2320
2323
  this.ensureCodecRegistryValidated();
2321
2324
  const { codecCtx, contextFields } = this.createQueryContexts(options);
2322
- return this.executeOn(queryable, options, ps, contextFields, (run) => this.executePrepared(run, ps, userParams, queryable, codecCtx));
2325
+ return this.executeOn(queryable, options, ps, contextFields, (run, transaction) => this.executePrepared(run, ps, userParams, queryable, transaction, codecCtx));
2323
2326
  }
2324
- async executePrepared(run, ps, userParams, queryable, codecCtx) {
2327
+ async executePrepared(run, ps, userParams, queryable, transaction, codecCtx) {
2325
2328
  checkAborted(codecCtx, "stream");
2326
2329
  const preEncodeValues = resolvePreparedSlotValues(ps, userParams);
2327
2330
  const preEncodeExec = {
@@ -2349,7 +2352,7 @@ var SqlRuntimeBase = class extends RuntimeCore {
2349
2352
  }
2350
2353
  }
2351
2354
  };
2352
- return this.executeEncodedPlan(run, exec, queryable, codecCtx, () => queryable.execute(request));
2355
+ return this.executeEncodedPlan(run, exec, queryable, transaction, codecCtx, () => queryable.execute(request));
2353
2356
  }
2354
2357
  async connection() {
2355
2358
  return (await this.openConnection()).connection;
@@ -2397,7 +2400,7 @@ var SqlRuntimeBase = class extends RuntimeCore {
2397
2400
  };
2398
2401
  }
2399
2402
  /**
2400
- * Begins a transaction on `connection`, which `owner` wraps, as a transaction activity. When the transaction's `activityStarted` hooks refuse the start, no `BEGIN` is sent, `owner` is recorded as clean, and `withTransaction` releases it; after any other start failure it destroys it. The transaction's `activityStarted` hooks run before `BEGIN`. Every statement sent on the transaction, or on `connection`, from the end of `BEGIN` until `commit()` or `rollback()` is called is the transaction's child, and is finalized when the transaction ends, with its outcome. `commit()` and `rollback()` resolve after every finalization hook has run. A subclass that holds its own connection begins its transactions here.
2403
+ * Begins a transaction on `connection`, which `owner` wraps, as a transaction activity. When the transaction's `activityStarted` hooks refuse the start, no `BEGIN` is sent, `owner` is recorded as clean, and `withTransaction` releases it; after any other start failure it destroys it. The transaction's `activityStarted` hooks run before `BEGIN`. Every statement sent on the transaction, or on `connection`, from the end of `BEGIN` until `commit()` or `rollback()` is called is the transaction's child, and is finalized when the transaction ends, with its outcome. Once `commit()` or `rollback()` is called, a statement sent on the transaction is refused when it starts, and one started earlier that has not reached the driver yet is refused with `RUNTIME.TRANSACTION_CLOSED`, so neither runs after the `COMMIT` or `ROLLBACK`. `commit()` and `rollback()` resolve after every finalization hook has run. A subclass that holds its own connection begins its transactions here.
2401
2404
  */
2402
2405
  async beginTransactionOn(connection, owner, parent, options) {
2403
2406
  owner[transactionStart].refusedBeforeBegin = true;
@@ -2615,6 +2618,7 @@ async function withTransaction(runtime, fn, options) {
2615
2618
  async function* guardedStream(open) {
2616
2619
  if (invalidated) throw transactionClosedError();
2617
2620
  for await (const row of open()) {
2621
+ if (invalidated) throw transactionClosedError();
2618
2622
  yield row;
2619
2623
  if (invalidated) throw transactionClosedError();
2620
2624
  }
@@ -2689,6 +2693,7 @@ async function withTransaction(runtime, fn, options) {
2689
2693
  }
2690
2694
  if (!commitRequested) {
2691
2695
  const selected = error;
2696
+ invalidated = true;
2692
2697
  try {
2693
2698
  await transaction.rollback();
2694
2699
  } catch (rollbackError) {
@@ -2736,4 +2741,4 @@ function createToSql(stack, contract) {
2736
2741
  //#endregion
2737
2742
  export { validateContractCodecMappings as C, validateCodecRegistryCompleteness as S, withTransactionMembers as T, lints as _, budgets as a, startActivityOn as b, createSqlExecutionStack as c, delegatingRuntime as d, deriveParamMetadata as f, lazyActivitySource as g, findActivitySource as h, activitySource as i, createToSql as l, extractCodecIds as m, PreparedStatementImpl as n, createAstCodecRegistry as o, encodeParamsWithMetadata as p, SqlRuntimeBase as r, createExecutionContext as s, PreparedExecutionImpl as t, delegatingActivitySource as u, lowerSqlPlan as v, withTransaction as w, toRuntimeOptions as x, planContentHashOn as y };
2738
2743
 
2739
- //# sourceMappingURL=exports-BE9wmKAn-DI9rC9jC.mjs.map
2744
+ //# sourceMappingURL=exports-BR5ctYYI-C_-aedbr.mjs.map