@prisma/orm-target-postgres 8.0.0-rc.1-dev.1 → 8.0.0-rc.1-dev.3

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 (78) hide show
  1. package/dist/{adapter-BwjBEeND-B7-Hx3r9.mjs → adapter-Ddgpoq1S-D-Ftx9Ls.mjs} +3 -3
  2. package/dist/{adapter-BwjBEeND-B7-Hx3r9.mjs.map → adapter-Ddgpoq1S-D-Ftx9Ls.mjs.map} +1 -1
  3. package/dist/adapter.mjs +2 -2
  4. package/dist/adapter__adapter.mjs +1 -1
  5. package/dist/adapter__control.mjs +1 -1
  6. package/dist/adapter__control.mjs.map +1 -1
  7. package/dist/adapter__runtime.mjs +2 -2
  8. package/dist/adapter__runtime.mjs.map +1 -1
  9. package/dist/check-expressions-DwM1V1Ky-D9m3Uf8w.d.mts +52 -0
  10. package/dist/check-expressions-DwM1V1Ky-D9m3Uf8w.d.mts.map +1 -0
  11. package/dist/check-expressions-drXwak3W-DqFpQtdc.mjs +41 -0
  12. package/dist/check-expressions-drXwak3W-DqFpQtdc.mjs.map +1 -0
  13. package/dist/{control-BzDnaGim.mjs → control-8ofLM59h.mjs} +4 -4
  14. package/dist/{control-BzDnaGim.mjs.map → control-8ofLM59h.mjs.map} +1 -1
  15. package/dist/{control-adapter-CipVam9p-B-E2SF8_.mjs → control-adapter-D4fT5c42-nSea-5cg.mjs} +10 -81
  16. package/dist/control-adapter-D4fT5c42-nSea-5cg.mjs.map +1 -0
  17. package/dist/{control-policy-Cl3RRSPg-BUi6pcI-.mjs → control-policy-wC4BmQy8-Db4igfEn.mjs} +18 -139
  18. package/dist/control-policy-wC4BmQy8-Db4igfEn.mjs.map +1 -0
  19. package/dist/{descriptor-meta-DnHabAS3-BiTguA3K.mjs → descriptor-meta-B2fGOCSX-DTh_flIG.mjs} +4 -2
  20. package/dist/descriptor-meta-B2fGOCSX-DTh_flIG.mjs.map +1 -0
  21. package/dist/{diff-database-schema-BfRs2vrG-DInOv5LW.mjs → diff-database-schema-wl9GusaU-BjDyKMS6.mjs} +3 -3
  22. package/dist/{diff-database-schema-BfRs2vrG-DInOv5LW.mjs.map → diff-database-schema-wl9GusaU-BjDyKMS6.mjs.map} +1 -1
  23. package/dist/driver__runtime.mjs +11 -6
  24. package/dist/driver__runtime.mjs.map +1 -1
  25. package/dist/{issue-planner-jkY6p-Ca.d.mts → issue-planner-aw7grdXe.d.mts} +2 -2
  26. package/dist/{issue-planner-jkY6p-Ca.d.mts.map → issue-planner-aw7grdXe.d.mts.map} +1 -1
  27. package/dist/{migration-CBSAPE8S.d.mts → migration-DyZpdeyj.d.mts} +3 -3
  28. package/dist/{migration-CBSAPE8S.d.mts.map → migration-DyZpdeyj.d.mts.map} +1 -1
  29. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  30. package/dist/op-factory-call-ClseZgmP.d.mts +1 -0
  31. package/dist/{op-factory-call-jd4cgfjA-CyNT4YVn.d.mts → op-factory-call-DJEyoQmT-DSMQffKu.d.mts} +5 -5
  32. package/dist/{op-factory-call-jd4cgfjA-CyNT4YVn.d.mts.map → op-factory-call-DJEyoQmT-DSMQffKu.d.mts.map} +1 -1
  33. package/dist/{op-factory-call-DifL68KT-CNFEDNsf.mjs → op-factory-call-rf1FJg8l-C6KLaBY1.mjs} +12 -14
  34. package/dist/op-factory-call-rf1FJg8l-C6KLaBY1.mjs.map +1 -0
  35. package/dist/{pack-DFM4tmob.d.mts → pack-j8ePkv1A.d.mts} +3 -1
  36. package/dist/pack-j8ePkv1A.d.mts.map +1 -0
  37. package/dist/{planner-DL4Bh5Nk.d.mts → planner-BMBEF8Kc.d.mts} +2 -2
  38. package/dist/{planner-DL4Bh5Nk.d.mts.map → planner-BMBEF8Kc.d.mts.map} +1 -1
  39. package/dist/{planner-Bmje9ii8-DdjXZxyD.mjs → planner-CqFym7lA-BKHIkh3V.mjs} +6 -6
  40. package/dist/{planner-Bmje9ii8-DdjXZxyD.mjs.map → planner-CqFym7lA-BKHIkh3V.mjs.map} +1 -1
  41. package/dist/{planner-produced-postgres-migration-Cicg2sXg-CZI7mdz9.mjs → planner-produced-postgres-migration-Ci6O7OL5-5k5_6lcD.mjs} +3 -3
  42. package/dist/{planner-produced-postgres-migration-Cicg2sXg-CZI7mdz9.mjs.map → planner-produced-postgres-migration-Ci6O7OL5-5k5_6lcD.mjs.map} +1 -1
  43. package/dist/{planner-produced-postgres-migration-B0PQLLUb-qsS6cQqX.d.mts → planner-produced-postgres-migration-Cs252KpU-BvXMZvzX.d.mts} +3 -3
  44. package/dist/planner-produced-postgres-migration-Cs252KpU-BvXMZvzX.d.mts.map +1 -0
  45. package/dist/planner-produced-postgres-migration-Cua5YEYV.d.mts +1 -0
  46. package/dist/{postgres-migration-CJshdIZn-CT6Cxd4x.mjs → postgres-migration-DJqjEDIS-CP437pha.mjs} +4 -4
  47. package/dist/{postgres-migration-CJshdIZn-CT6Cxd4x.mjs.map → postgres-migration-DJqjEDIS-CP437pha.mjs.map} +1 -1
  48. package/dist/{postgres-migration-CDJj7CvD-Bsqs_fVo.d.mts → postgres-migration-DPK9WNF5-DHAXtwys.d.mts} +4 -5
  49. package/dist/postgres-migration-DPK9WNF5-DHAXtwys.d.mts.map +1 -0
  50. package/dist/target.d.mts +11 -10
  51. package/dist/target.mjs +9 -8
  52. package/dist/target__control.mjs +1 -1
  53. package/dist/target__diff-database-schema.mjs +1 -1
  54. package/dist/target__issue-planner.d.mts +1 -1
  55. package/dist/target__issue-planner.mjs +1 -1
  56. package/dist/target__migration.d.mts +2 -2
  57. package/dist/target__migration.mjs +2 -2
  58. package/dist/target__op-factory-call.d.mts +2 -2
  59. package/dist/target__op-factory-call.mjs +1 -1
  60. package/dist/target__pack.d.mts +1 -1
  61. package/dist/target__pack.mjs +1 -1
  62. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  63. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  64. package/dist/target__planner.d.mts +1 -1
  65. package/dist/target__planner.mjs +2 -2
  66. package/dist/target__types.d.mts +2 -1
  67. package/dist/target__types.mjs +2 -1
  68. package/dist/types-xa86TkcV.d.mts.map +1 -1
  69. package/package.json +9 -9
  70. package/dist/control-adapter-CipVam9p-B-E2SF8_.mjs.map +0 -1
  71. package/dist/control-policy-Cl3RRSPg-BUi6pcI-.mjs.map +0 -1
  72. package/dist/descriptor-meta-DnHabAS3-BiTguA3K.mjs.map +0 -1
  73. package/dist/op-factory-call-DifL68KT-CNFEDNsf.mjs.map +0 -1
  74. package/dist/op-factory-call-FEA5mnWH.d.mts +0 -1
  75. package/dist/pack-DFM4tmob.d.mts.map +0 -1
  76. package/dist/planner-produced-postgres-migration-B0PQLLUb-qsS6cQqX.d.mts.map +0 -1
  77. package/dist/planner-produced-postgres-migration-C3GPZWeC.d.mts +0 -1
  78. package/dist/postgres-migration-CDJj7CvD-Bsqs_fVo.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"driver__runtime.mjs","names":["#queue","#connection","#onRelease","#onDestroy","#transactionOpen","#onSettled","#settle","#closed","#connectionMutex","#closeWhileHoldingLease","#connected","#connectPromise","#cursorOpts","#preparedStatements","#delegate","#requireDelegate","#wrapConnection"],"sources":["../../../../3-targets/7-drivers/postgres/dist/runtime.mjs"],"sourcesContent":["import { i as postgresDriverDescriptorMeta, n as isPostgresError, r as normalizePgError, t as isAlreadyConnectedError } from \"./normalize-error-CNjgVO71.mjs\";\nimport { Pool } from \"pg\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport Cursor from \"pg-cursor\";\n//#region src/driver-error.ts\nfunction driverError(code, message, details) {\n\tconst error = new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"RuntimeError\",\n\t\tconfigurable: true\n\t});\n\treturn details === void 0 ? Object.assign(error, {\n\t\tcode,\n\t\tcategory: \"DRIVER\",\n\t\tseverity: \"error\"\n\t}) : Object.assign(error, {\n\t\tcode,\n\t\tcategory: \"DRIVER\",\n\t\tseverity: \"error\",\n\t\tdetails\n\t});\n}\n//#endregion\n//#region src/callback-to-promise.ts\nfunction callbackToPromise(fn) {\n\treturn new Promise((resolve, reject) => {\n\t\tfn((err, result) => {\n\t\t\tif (err) {\n\t\t\t\treject(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(result);\n\t\t});\n\t});\n}\n//#endregion\n//#region src/named-cursor.ts\nlet nextNamedPortalId = 1;\n/** Streaming cursor for a server-side named prepared statement. */\nvar NamedCursor = class extends Cursor {\n\tname;\n\tconstructor(opts) {\n\t\tsuper(opts.text, [...opts.values], opts.config);\n\t\tthis.name = opts.name;\n\t\tthis.submit = this.submitNamed;\n\t}\n\tsubmitNamed(connection) {\n\t\tconst self = this;\n\t\tconst conn = connection;\n\t\tself.state = \"submitted\";\n\t\tself.connection = conn;\n\t\tself._portal = `np_${nextNamedPortalId++}`;\n\t\tif (!conn.parsedStatements[this.name]) {\n\t\t\tconst parseMessage = {\n\t\t\t\ttext: self.text,\n\t\t\t\tname: this.name,\n\t\t\t\ttypes: []\n\t\t\t};\n\t\t\tconn.parse(parseMessage, true);\n\t\t}\n\t\tconst bindMessage = {\n\t\t\tportal: self._portal,\n\t\t\tstatement: this.name,\n\t\t\tvalues: self.values ?? []\n\t\t};\n\t\tconn.bind(bindMessage, true);\n\t\tconn.describe({\n\t\t\ttype: \"P\",\n\t\t\tname: self._portal\n\t\t}, true);\n\t\tconn.flush();\n\t\tif (self._conf.types) self._result._getTypeParser = self._conf.types.getTypeParser;\n\t\tconn.once(\"noData\", self._ifNoData);\n\t\tconn.once(\"rowDescription\", self._rowDescription);\n\t}\n};\n//#endregion\n//#region src/postgres-driver.ts\nconst DEFAULT_BATCH_SIZE = 100;\nconst DEFAULT_PREPARED_STATEMENTS = true;\nfunction createHandleAllocator() {\n\tlet next = 1;\n\treturn { mint: () => `pn_${next++}` };\n}\nfunction buildConnectionOptions(options) {\n\treturn {\n\t\t...options.cursor?.disabled ? { cursorDisabled: true } : {\n\t\t\tcursorBatchSize: options.cursor?.batchSize ?? DEFAULT_BATCH_SIZE,\n\t\t\tcursorDisabled: false\n\t\t},\n\t\tpreparedStatementsEnabled: options.preparedStatements ?? DEFAULT_PREPARED_STATEMENTS,\n\t\thandleAllocator: createHandleAllocator()\n\t};\n}\nfunction isStalePreparedStatementError(error) {\n\tif (!(error instanceof Error) || !(\"code\" in error) || typeof error.code !== \"string\") return false;\n\tconst code = error.code;\n\treturn code === \"26000\" || code === \"0A000\";\n}\nvar AsyncMutex = class {\n\t#queue = Promise.resolve();\n\tasync lock() {\n\t\tconst previous = this.#queue;\n\t\tlet releaseLock;\n\t\tthis.#queue = new Promise((resolve) => {\n\t\t\treleaseLock = resolve;\n\t\t});\n\t\tawait previous;\n\t\treturn () => {\n\t\t\treleaseLock?.();\n\t\t\treleaseLock = void 0;\n\t\t};\n\t}\n};\nconst clientQueryLocks = /* @__PURE__ */ new WeakMap();\nfunction acquireClientQueryLock(client) {\n\tlet mutex = clientQueryLocks.get(client);\n\tif (mutex === void 0) {\n\t\tmutex = new AsyncMutex();\n\t\tclientQueryLocks.set(client, mutex);\n\t}\n\treturn mutex.lock();\n}\nvar PostgresQueryable = class {\n\toptions;\n\tconstructor(options) {\n\t\tthis.options = options;\n\t}\n\tasync *query(request) {\n\t\ttry {\n\t\t\tconst preparedStatementHandle = request.preparedStatementHandle;\n\t\t\tif (preparedStatementHandle === void 0 || !this.options.preparedStatementsEnabled) {\n\t\t\t\tyield* this.runQuery(request);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst name = this.preparedStatementName(preparedStatementHandle);\n\t\t\tyield* this.withStaleHandleStreamRetry(preparedStatementHandle, name, (name) => this.runQuery(request, name));\n\t\t} catch (error) {\n\t\t\tthrow normalizePgError(error);\n\t\t}\n\t}\n\tasync execute(request) {\n\t\ttry {\n\t\t\tconst preparedStatementHandle = request.preparedStatementHandle;\n\t\t\tif (preparedStatementHandle === void 0 || !this.options.preparedStatementsEnabled) return await this.runExecute(request);\n\t\t\tconst name = this.preparedStatementName(preparedStatementHandle);\n\t\t\treturn await this.withStaleHandleRetry(preparedStatementHandle, name, (name) => this.runExecute(request, name));\n\t\t} catch (error) {\n\t\t\tthrow normalizePgError(error);\n\t\t}\n\t}\n\tpreparedStatementName(handle) {\n\t\tconst existingName = handle.get();\n\t\tif (typeof existingName === \"string\") return existingName;\n\t\tconst mintedName = this.options.handleAllocator.mint();\n\t\thandle.set(mintedName);\n\t\treturn mintedName;\n\t}\n\tasync withStaleHandleRetry(preparedStatementHandle, name, attempt) {\n\t\ttry {\n\t\t\treturn await attempt(name);\n\t\t} catch (error) {\n\t\t\tif (!isStalePreparedStatementError(error)) throw error;\n\t\t\tconst retryName = this.options.handleAllocator.mint();\n\t\t\tpreparedStatementHandle.set(retryName);\n\t\t\ttry {\n\t\t\t\treturn await attempt(retryName);\n\t\t\t} catch (retryError) {\n\t\t\t\tthrow prepareFailedError(retryError, retryName);\n\t\t\t}\n\t\t}\n\t}\n\tasync *withStaleHandleStreamRetry(preparedStatementHandle, name, attempt) {\n\t\tconst stream = await this.withStaleHandleRetry(preparedStatementHandle, name, async (name) => {\n\t\t\tconst iterator = attempt(name)[Symbol.asyncIterator]();\n\t\t\treturn {\n\t\t\t\titerator,\n\t\t\t\tfirst: await iterator.next()\n\t\t\t};\n\t\t});\n\t\tif (stream.first.done) return;\n\t\tlet streamCompleted = false;\n\t\ttry {\n\t\t\tyield stream.first.value;\n\t\t\twhile (true) {\n\t\t\t\tconst next = await stream.iterator.next();\n\t\t\t\tif (next.done) {\n\t\t\t\t\tstreamCompleted = true;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tyield next.value;\n\t\t\t}\n\t\t} finally {\n\t\t\tif (!streamCompleted) await stream.iterator.return?.();\n\t\t}\n\t}\n\tasync runExecute(request, name) {\n\t\tconst client = await this.acquireClient();\n\t\ttry {\n\t\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\t\ttry {\n\t\t\t\treturn { affectedRows: (await client.query({\n\t\t\t\t\tname,\n\t\t\t\t\ttext: request.sql,\n\t\t\t\t\tvalues: blindCast(request.params ?? [])\n\t\t\t\t})).rowCount ?? 0 };\n\t\t\t} finally {\n\t\t\t\treleaseLock();\n\t\t\t}\n\t\t} finally {\n\t\t\tawait this.releaseClient(client);\n\t\t}\n\t}\n\tinExplicitTransaction() {\n\t\treturn false;\n\t}\n\tasync *runQuery(request, name) {\n\t\tconst client = await this.acquireClient();\n\t\ttry {\n\t\t\tif (!this.options.cursorDisabled) {\n\t\t\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\t\t\ttry {\n\t\t\t\t\tfor await (const row of this.streamWithPortalProtection(client, request, this.options.cursorBatchSize, name)) yield blindCast(row);\n\t\t\t\t\treturn;\n\t\t\t\t} catch (cursorError) {\n\t\t\t\t\tif (!(cursorError instanceof Error) || isPostgresError(cursorError)) throw cursorError;\n\t\t\t\t} finally {\n\t\t\t\t\treleaseLock();\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor await (const row of this.executeBuffered(client, request.sql, request.params, name)) yield blindCast(row);\n\t\t} finally {\n\t\t\tawait this.releaseClient(client);\n\t\t}\n\t}\n\tasync explain(request) {\n\t\tconst text = `EXPLAIN (FORMAT JSON) ${request.sql}`;\n\t\tconst client = await this.acquireClient();\n\t\ttry {\n\t\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\t\ttry {\n\t\t\t\treturn { rows: blindCast((await client.query(text, request.params === void 0 ? void 0 : [...request.params]).catch(rethrowNormalizedError)).rows) };\n\t\t\t} finally {\n\t\t\t\treleaseLock();\n\t\t\t}\n\t\t} finally {\n\t\t\tawait this.releaseClient(client);\n\t\t}\n\t}\n\tasync *streamWithPortalProtection(client, request, cursorBatchSize, name) {\n\t\tif (this.inExplicitTransaction()) {\n\t\t\tyield* this.executeWithCursor(client, request.sql, request.params, cursorBatchSize, name);\n\t\t\treturn;\n\t\t}\n\t\tawait client.query(\"BEGIN\");\n\t\tlet streamFailed = false;\n\t\ttry {\n\t\t\tyield* this.executeWithCursor(client, request.sql, request.params, cursorBatchSize, name);\n\t\t} catch (error) {\n\t\t\tstreamFailed = true;\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tawait this.commitStreamSpan(client, streamFailed);\n\t\t}\n\t}\n\tasync commitStreamSpan(client, streamFailed) {\n\t\ttry {\n\t\t\tawait client.query(\"COMMIT\");\n\t\t} catch (commitError) {\n\t\t\tif (!streamFailed) throw commitError;\n\t\t}\n\t}\n\tasync *executeWithCursor(client, sql, params, cursorBatchSize, name) {\n\t\tconst values = blindCast(params ?? []);\n\t\tconst cursor = client.query(name === void 0 ? new Cursor(sql, values) : new NamedCursor({\n\t\t\tname,\n\t\t\ttext: sql,\n\t\t\tvalues\n\t\t}));\n\t\ttry {\n\t\t\twhile (true) {\n\t\t\t\tconst rows = await readCursor(cursor, cursorBatchSize);\n\t\t\t\tif (rows.length === 0) break;\n\t\t\t\tfor (const row of rows) yield row;\n\t\t\t}\n\t\t} finally {\n\t\t\tawait closeCursor(cursor);\n\t\t}\n\t}\n\tasync *executeBuffered(client, sql, params, name) {\n\t\tconst config = {\n\t\t\tname,\n\t\t\ttext: sql,\n\t\t\tvalues: blindCast(params ?? [])\n\t\t};\n\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await client.query(config);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t}\n\t\tfor (const row of blindCast(result.rows)) yield row;\n\t}\n};\nvar PostgresConnectionImpl = class extends PostgresQueryable {\n\t#connection;\n\t#onRelease;\n\t#onDestroy;\n\t#transactionOpen = false;\n\tconstructor(connection, options, onRelease, onDestroy) {\n\t\tsuper(options);\n\t\tthis.#connection = connection;\n\t\tthis.#onRelease = onRelease;\n\t\tthis.#onDestroy = onDestroy;\n\t}\n\tacquireClient() {\n\t\treturn Promise.resolve(this.#connection);\n\t}\n\treleaseClient(_client) {\n\t\treturn Promise.resolve();\n\t}\n\tinExplicitTransaction() {\n\t\treturn this.#transactionOpen;\n\t}\n\tasync beginTransaction() {\n\t\tconst releaseLock = await acquireClientQueryLock(this.#connection);\n\t\ttry {\n\t\t\tawait this.#connection.query(\"BEGIN\").catch(rethrowNormalizedError);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t}\n\t\tthis.#transactionOpen = true;\n\t\treturn new PostgresTransactionImpl(this.#connection, this.options, () => {\n\t\t\tthis.#transactionOpen = false;\n\t\t});\n\t}\n\tasync release() {\n\t\tconst conn = this.#connection;\n\t\tif (\"release\" in conn) conn.release();\n\t\tconst onRelease = this.#onRelease;\n\t\tthis.#onRelease = void 0;\n\t\tthis.#onDestroy = void 0;\n\t\tonRelease?.();\n\t}\n\tasync destroy(reason) {\n\t\tconst onDestroy = this.#onDestroy;\n\t\tconst onRelease = this.#onRelease;\n\t\tthis.#onDestroy = void 0;\n\t\tthis.#onRelease = void 0;\n\t\tconst conn = this.#connection;\n\t\tif (\"release\" in conn) {\n\t\t\tconst releaseArg = reason instanceof Error ? reason : /* @__PURE__ */ new Error(\"Connection destroyed\");\n\t\t\tconn.release(releaseArg);\n\t\t}\n\t\tif (onDestroy) await onDestroy(reason);\n\t\telse onRelease?.();\n\t}\n};\nvar PostgresTransactionImpl = class extends PostgresQueryable {\n\t#connection;\n\t#onSettled;\n\tconstructor(connection, options, onSettled) {\n\t\tsuper(options);\n\t\tthis.#connection = connection;\n\t\tthis.#onSettled = onSettled;\n\t}\n\tacquireClient() {\n\t\treturn Promise.resolve(this.#connection);\n\t}\n\treleaseClient(_client) {\n\t\treturn Promise.resolve();\n\t}\n\tinExplicitTransaction() {\n\t\treturn true;\n\t}\n\t#settle() {\n\t\tconst onSettled = this.#onSettled;\n\t\tthis.#onSettled = void 0;\n\t\tonSettled?.();\n\t}\n\tasync commit() {\n\t\tconst releaseLock = await acquireClientQueryLock(this.#connection);\n\t\ttry {\n\t\t\tawait this.#connection.query(\"COMMIT\").catch(rethrowNormalizedError);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t\tthis.#settle();\n\t\t}\n\t}\n\tasync rollback() {\n\t\tconst releaseLock = await acquireClientQueryLock(this.#connection);\n\t\ttry {\n\t\t\tawait this.#connection.query(\"ROLLBACK\").catch(rethrowNormalizedError);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t\tthis.#settle();\n\t\t}\n\t}\n};\nvar PostgresPoolDriverImpl = class extends PostgresQueryable {\n\tpool;\n\t#closed = false;\n\tconstructor(options) {\n\t\tsuper(buildConnectionOptions(options));\n\t\tthis.pool = options.connect.pool;\n\t}\n\tget state() {\n\t\treturn this.#closed ? \"closed\" : \"connected\";\n\t}\n\tasync connect(_binding) {}\n\tasync acquireConnection() {\n\t\treturn new PostgresConnectionImpl(await this.acquireClient(), this.options);\n\t}\n\tasync close() {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tawait this.pool.end();\n\t}\n\tasync acquireClient() {\n\t\treturn this.pool.connect();\n\t}\n\tasync releaseClient(client) {\n\t\tclient.release();\n\t}\n};\nvar PostgresDirectDriverImpl = class extends PostgresQueryable {\n\tdirectClient;\n\t#connectionMutex = new AsyncMutex();\n\t#closed = false;\n\t#connected = false;\n\t#connectPromise;\n\tconstructor(options) {\n\t\tsuper(buildConnectionOptions(options));\n\t\tthis.directClient = options.connect.client;\n\t}\n\tget state() {\n\t\treturn this.#closed ? \"closed\" : \"connected\";\n\t}\n\tasync connect(_binding) {}\n\tasync acquireConnection() {\n\t\tconst releaseLease = await this.#connectionMutex.lock();\n\t\ttry {\n\t\t\treturn new PostgresConnectionImpl(await this.acquireClient(), this.options, releaseLease, async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.#closeWhileHoldingLease();\n\t\t\t\t} finally {\n\t\t\t\t\treleaseLease();\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treleaseLease();\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync close() {\n\t\tconst releaseLease = await this.#connectionMutex.lock();\n\t\ttry {\n\t\t\tawait this.#closeWhileHoldingLease();\n\t\t} finally {\n\t\t\treleaseLease();\n\t\t}\n\t}\n\tasync #closeWhileHoldingLease() {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tawait this.directClient.end();\n\t\tthis.#connected = false;\n\t}\n\tasync acquireClient() {\n\t\tif (this.#connected) return this.directClient;\n\t\tif (this.#connectPromise !== void 0) {\n\t\t\tawait this.#connectPromise;\n\t\t\treturn this.directClient;\n\t\t}\n\t\tthis.#connectPromise = (async () => {\n\t\t\ttry {\n\t\t\t\tawait this.directClient.connect();\n\t\t\t} catch (error) {\n\t\t\t\tif (!isAlreadyConnectedError(error)) throw error;\n\t\t\t} finally {\n\t\t\t\tthis.#connectPromise = void 0;\n\t\t\t}\n\t\t\tthis.#connected = true;\n\t\t})();\n\t\tawait this.#connectPromise;\n\t\treturn this.directClient;\n\t}\n\tasync releaseClient(_client) {}\n};\nfunction createBoundDriverFromBinding(binding, cursorOpts, extraOpts) {\n\tconst preparedStatements = extraOpts?.preparedStatements;\n\tswitch (binding.kind) {\n\t\tcase \"url\": return new PostgresPoolDriverImpl({\n\t\t\tconnect: { pool: new Pool({\n\t\t\t\tconnectionString: binding.url,\n\t\t\t\tconnectionTimeoutMillis: 2e4,\n\t\t\t\tidleTimeoutMillis: 3e4\n\t\t\t}) },\n\t\t\tcursor: cursorOpts,\n\t\t\tpreparedStatements\n\t\t});\n\t\tcase \"pgPool\": return new PostgresPoolDriverImpl({\n\t\t\tconnect: { pool: binding.pool },\n\t\t\tcursor: cursorOpts,\n\t\t\tpreparedStatements\n\t\t});\n\t\tcase \"pgClient\": return new PostgresDirectDriverImpl({\n\t\t\tconnect: { client: binding.client },\n\t\t\tcursor: cursorOpts,\n\t\t\tpreparedStatements\n\t\t});\n\t}\n}\nfunction readCursor(cursor, size) {\n\treturn callbackToPromise((cb) => {\n\t\tcursor.read(size, (err, rows) => cb(err, rows));\n\t});\n}\nfunction closeCursor(cursor) {\n\treturn callbackToPromise((cb) => cursor.close(cb));\n}\nfunction rethrowNormalizedError(error) {\n\tthrow normalizePgError(error);\n}\nfunction prepareFailedError(retryError, handle) {\n\tconst cause = normalizePgError(retryError);\n\treturn Object.assign(driverError(\"DRIVER.PREPARE_FAILED\", `Prepared statement failed again after re-preparing with a fresh handle: ${cause.message}`, { handle }), { cause });\n}\n//#endregion\n//#region src/exports/runtime.ts\nconst USE_BEFORE_CONNECT_MESSAGE = \"Postgres driver not connected. Call connect(binding) before acquireConnection or execute.\";\nconst ALREADY_CONNECTED_MESSAGE = \"Postgres driver already connected. Call close() before reconnecting with a new binding.\";\nfunction unboundQuery() {\n\treturn { [Symbol.asyncIterator]() {\n\t\treturn { async next() {\n\t\t\tthrow driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\t} };\n\t} };\n}\nvar PostgresUnboundDriverImpl = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"postgres\";\n\t#delegate = null;\n\t#closed = false;\n\t#cursorOpts;\n\t#preparedStatements;\n\tconstructor(options) {\n\t\tthis.#cursorOpts = options?.cursor;\n\t\tthis.#preparedStatements = options?.preparedStatements;\n\t}\n\tget state() {\n\t\tif (this.#delegate !== null) return \"connected\";\n\t\tif (this.#closed) return \"closed\";\n\t\treturn \"unbound\";\n\t}\n\t#requireDelegate() {\n\t\tconst delegate = this.#delegate;\n\t\tif (delegate === null) throw driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\treturn delegate;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#delegate !== null) throw driverError(\"DRIVER.ALREADY_CONNECTED\", ALREADY_CONNECTED_MESSAGE, { bindingKind: binding.kind });\n\t\tthis.#delegate = createBoundDriverFromBinding(binding, this.#cursorOpts, { preparedStatements: this.#preparedStatements });\n\t\tthis.#closed = false;\n\t}\n\tasync acquireConnection() {\n\t\tconst delegate = this.#requireDelegate();\n\t\tconst connection = await delegate.acquireConnection();\n\t\treturn this.#wrapConnection(connection, delegate);\n\t}\n\t/**\n\t* Wraps an acquired connection so that teardown paths which close the\n\t* underlying delegate (notably `destroy()` on a pgClient binding, where\n\t* the single socket means a destroyed connection invalidates the driver)\n\t* also reset our own `#delegate` reference. Without this, a failed\n\t* transaction rollback would leave the outer unbound wrapper reporting\n\t* `connected` while routing subsequent work to an already-ended delegate.\n\t*/\n\t#wrapConnection(connection, delegate) {\n\t\tconst syncDelegateState = () => {\n\t\t\tif (this.#delegate === delegate && delegate.state === \"closed\") {\n\t\t\t\tthis.#delegate = null;\n\t\t\t\tthis.#closed = true;\n\t\t\t}\n\t\t};\n\t\tconst wrapped = {\n\t\t\tbeginTransaction: connection.beginTransaction.bind(connection),\n\t\t\tquery: connection.query.bind(connection),\n\t\t\texecute: connection.execute.bind(connection),\n\t\t\trelease: async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait connection.release();\n\t\t\t\t} finally {\n\t\t\t\t\tsyncDelegateState();\n\t\t\t\t}\n\t\t\t},\n\t\t\tdestroy: async (reason) => {\n\t\t\t\ttry {\n\t\t\t\t\tawait connection.destroy(reason);\n\t\t\t\t} finally {\n\t\t\t\t\tsyncDelegateState();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tif (connection.explain) wrapped.explain = connection.explain.bind(connection);\n\t\treturn wrapped;\n\t}\n\tasync close() {\n\t\tconst delegate = this.#delegate;\n\t\tif (delegate !== null) {\n\t\t\tthis.#delegate = null;\n\t\t\tawait delegate.close();\n\t\t}\n\t\tthis.#closed = true;\n\t}\n\tquery(request) {\n\t\tconst delegate = this.#delegate;\n\t\treturn delegate === null ? unboundQuery() : delegate.query(request);\n\t}\n\tasync execute(request) {\n\t\tconst delegate = this.#delegate;\n\t\tif (delegate === null) throw driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\treturn delegate.execute(request);\n\t}\n\tasync explain(request) {\n\t\tconst delegate = this.#requireDelegate();\n\t\tconst explain = delegate.explain;\n\t\tif (explain === void 0) throw driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\treturn explain.call(delegate, request);\n\t}\n};\nconst postgresRuntimeDriverDescriptor = {\n\t...postgresDriverDescriptorMeta,\n\tcreate(options) {\n\t\treturn new PostgresUnboundDriverImpl(options);\n\t}\n};\n//#endregion\nexport { postgresRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;AAKA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,MAAM,QAAQ,IAAI,MAAM,OAAO;CAC/B,OAAO,eAAe,OAAO,QAAQ;EACpC,OAAO;EACP,cAAc;CACf,CAAC;CACD,OAAO,YAAY,KAAK,IAAI,OAAO,OAAO,OAAO;EAChD;EACA,UAAU;EACV,UAAU;CACX,CAAC,IAAI,OAAO,OAAO,OAAO;EACzB;EACA,UAAU;EACV,UAAU;EACV;CACD,CAAC;AACF;AAGA,SAAS,kBAAkB,IAAI;CAC9B,OAAO,IAAI,SAAS,SAAS,WAAW;EACvC,IAAI,KAAK,WAAW;GACnB,IAAI,KAAK;IACR,OAAO,GAAG;IACV;GACD;GACA,QAAQ,MAAM;EACf,CAAC;CACF,CAAC;AACF;AAGA,IAAI,oBAAoB;;AAExB,IAAI,cAAc,cAAc,OAAO;CACtC;CACA,YAAY,MAAM;EACjB,MAAM,KAAK,MAAM,CAAC,GAAG,KAAK,MAAM,GAAG,KAAK,MAAM;EAC9C,KAAK,OAAO,KAAK;EACjB,KAAK,SAAS,KAAK;CACpB;CACA,YAAY,YAAY;EACvB,MAAM,OAAO;EACb,MAAM,OAAO;EACb,KAAK,QAAQ;EACb,KAAK,aAAa;EAClB,KAAK,UAAU,MAAM;EACrB,IAAI,CAAC,KAAK,iBAAiB,KAAK,OAAO;GACtC,MAAM,eAAe;IACpB,MAAM,KAAK;IACX,MAAM,KAAK;IACX,OAAO,CAAC;GACT;GACA,KAAK,MAAM,cAAc,IAAI;EAC9B;EACA,MAAM,cAAc;GAC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7C;AACD"}
1
+ {"version":3,"file":"driver__runtime.mjs","names":["#queue","#connection","#onRelease","#onDestroy","#txState","#onSettled","#settle","#closed","#connectionMutex","#closeWhileHoldingLease","#connected","#connectPromise","#cursorOpts","#preparedStatements","#delegate","#requireDelegate","#wrapConnection"],"sources":["../../../../3-targets/7-drivers/postgres/dist/runtime.mjs"],"sourcesContent":["import { i as postgresDriverDescriptorMeta, n as isPostgresError, r as normalizePgError, t as isAlreadyConnectedError } from \"./normalize-error-CNjgVO71.mjs\";\nimport { Pool } from \"pg\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport Cursor from \"pg-cursor\";\n//#region src/driver-error.ts\nfunction driverError(code, message, details) {\n\tconst error = new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"RuntimeError\",\n\t\tconfigurable: true\n\t});\n\treturn details === void 0 ? Object.assign(error, {\n\t\tcode,\n\t\tcategory: \"DRIVER\",\n\t\tseverity: \"error\"\n\t}) : Object.assign(error, {\n\t\tcode,\n\t\tcategory: \"DRIVER\",\n\t\tseverity: \"error\",\n\t\tdetails\n\t});\n}\n//#endregion\n//#region src/callback-to-promise.ts\nfunction callbackToPromise(fn) {\n\treturn new Promise((resolve, reject) => {\n\t\tfn((err, result) => {\n\t\t\tif (err) {\n\t\t\t\treject(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(result);\n\t\t});\n\t});\n}\n//#endregion\n//#region src/named-cursor.ts\nlet nextNamedPortalId = 1;\n/** Streaming cursor for a server-side named prepared statement. */\nvar NamedCursor = class extends Cursor {\n\tname;\n\tconstructor(opts) {\n\t\tsuper(opts.text, [...opts.values], opts.config);\n\t\tthis.name = opts.name;\n\t\tthis.submit = this.submitNamed;\n\t}\n\tsubmitNamed(connection) {\n\t\tconst self = this;\n\t\tconst conn = connection;\n\t\tself.state = \"submitted\";\n\t\tself.connection = conn;\n\t\tself._portal = `np_${nextNamedPortalId++}`;\n\t\tif (!conn.parsedStatements[this.name]) {\n\t\t\tconst parseMessage = {\n\t\t\t\ttext: self.text,\n\t\t\t\tname: this.name,\n\t\t\t\ttypes: []\n\t\t\t};\n\t\t\tconn.parse(parseMessage, true);\n\t\t}\n\t\tconst bindMessage = {\n\t\t\tportal: self._portal,\n\t\t\tstatement: this.name,\n\t\t\tvalues: self.values ?? []\n\t\t};\n\t\tconn.bind(bindMessage, true);\n\t\tconn.describe({\n\t\t\ttype: \"P\",\n\t\t\tname: self._portal\n\t\t}, true);\n\t\tconn.flush();\n\t\tif (self._conf.types) self._result._getTypeParser = self._conf.types.getTypeParser;\n\t\tconn.once(\"noData\", self._ifNoData);\n\t\tconn.once(\"rowDescription\", self._rowDescription);\n\t}\n};\n//#endregion\n//#region src/postgres-driver.ts\nconst DEFAULT_BATCH_SIZE = 100;\nconst DEFAULT_PREPARED_STATEMENTS = true;\nfunction createHandleAllocator() {\n\tlet next = 1;\n\treturn { mint: () => `pn_${next++}` };\n}\nfunction buildConnectionOptions(options) {\n\treturn {\n\t\t...options.cursor?.disabled ? { cursorDisabled: true } : {\n\t\t\tcursorBatchSize: options.cursor?.batchSize ?? DEFAULT_BATCH_SIZE,\n\t\t\tcursorDisabled: false\n\t\t},\n\t\tpreparedStatementsEnabled: options.preparedStatements ?? DEFAULT_PREPARED_STATEMENTS,\n\t\thandleAllocator: createHandleAllocator()\n\t};\n}\nfunction isStalePreparedStatementError(error) {\n\tif (!(error instanceof Error) || !(\"code\" in error) || typeof error.code !== \"string\") return false;\n\tconst code = error.code;\n\treturn code === \"26000\" || code === \"0A000\";\n}\nvar AsyncMutex = class {\n\t#queue = Promise.resolve();\n\tasync lock() {\n\t\tconst previous = this.#queue;\n\t\tlet releaseLock;\n\t\tthis.#queue = new Promise((resolve) => {\n\t\t\treleaseLock = resolve;\n\t\t});\n\t\tawait previous;\n\t\treturn () => {\n\t\t\treleaseLock?.();\n\t\t\treleaseLock = void 0;\n\t\t};\n\t}\n};\nconst clientQueryLocks = /* @__PURE__ */ new WeakMap();\nfunction acquireClientQueryLock(client) {\n\tlet mutex = clientQueryLocks.get(client);\n\tif (mutex === void 0) {\n\t\tmutex = new AsyncMutex();\n\t\tclientQueryLocks.set(client, mutex);\n\t}\n\treturn mutex.lock();\n}\nvar PostgresQueryable = class {\n\toptions;\n\tconstructor(options) {\n\t\tthis.options = options;\n\t}\n\tasync *query(request) {\n\t\ttry {\n\t\t\tconst preparedStatementHandle = request.preparedStatementHandle;\n\t\t\tif (preparedStatementHandle === void 0 || !this.options.preparedStatementsEnabled) {\n\t\t\t\tyield* this.runQuery(request);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst name = this.preparedStatementName(preparedStatementHandle);\n\t\t\tyield* this.withStaleHandleStreamRetry(preparedStatementHandle, name, (name) => this.runQuery(request, name));\n\t\t} catch (error) {\n\t\t\tthrow normalizePgError(error);\n\t\t}\n\t}\n\tasync execute(request) {\n\t\ttry {\n\t\t\tconst preparedStatementHandle = request.preparedStatementHandle;\n\t\t\tif (preparedStatementHandle === void 0 || !this.options.preparedStatementsEnabled) return await this.runExecute(request);\n\t\t\tconst name = this.preparedStatementName(preparedStatementHandle);\n\t\t\treturn await this.withStaleHandleRetry(preparedStatementHandle, name, (name) => this.runExecute(request, name));\n\t\t} catch (error) {\n\t\t\tthrow normalizePgError(error);\n\t\t}\n\t}\n\tpreparedStatementName(handle) {\n\t\tconst existingName = handle.get();\n\t\tif (typeof existingName === \"string\") return existingName;\n\t\tconst mintedName = this.options.handleAllocator.mint();\n\t\thandle.set(mintedName);\n\t\treturn mintedName;\n\t}\n\tasync withStaleHandleRetry(preparedStatementHandle, name, attempt) {\n\t\ttry {\n\t\t\treturn await attempt(name);\n\t\t} catch (error) {\n\t\t\tif (!isStalePreparedStatementError(error)) throw error;\n\t\t\tconst retryName = this.options.handleAllocator.mint();\n\t\t\tpreparedStatementHandle.set(retryName);\n\t\t\ttry {\n\t\t\t\treturn await attempt(retryName);\n\t\t\t} catch (retryError) {\n\t\t\t\tthrow prepareFailedError(retryError, retryName);\n\t\t\t}\n\t\t}\n\t}\n\tasync *withStaleHandleStreamRetry(preparedStatementHandle, name, attempt) {\n\t\tconst stream = await this.withStaleHandleRetry(preparedStatementHandle, name, async (name) => {\n\t\t\tconst iterator = attempt(name)[Symbol.asyncIterator]();\n\t\t\treturn {\n\t\t\t\titerator,\n\t\t\t\tfirst: await iterator.next()\n\t\t\t};\n\t\t});\n\t\tif (stream.first.done) return;\n\t\tlet streamCompleted = false;\n\t\ttry {\n\t\t\tyield stream.first.value;\n\t\t\twhile (true) {\n\t\t\t\tconst next = await stream.iterator.next();\n\t\t\t\tif (next.done) {\n\t\t\t\t\tstreamCompleted = true;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tyield next.value;\n\t\t\t}\n\t\t} finally {\n\t\t\tif (!streamCompleted) await stream.iterator.return?.();\n\t\t}\n\t}\n\tasync runExecute(request, name) {\n\t\tconst client = await this.acquireClient();\n\t\ttry {\n\t\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\t\ttry {\n\t\t\t\treturn { affectedRows: (await client.query({\n\t\t\t\t\tname,\n\t\t\t\t\ttext: request.sql,\n\t\t\t\t\tvalues: blindCast(request.params ?? [])\n\t\t\t\t})).rowCount ?? 0 };\n\t\t\t} finally {\n\t\t\t\treleaseLock();\n\t\t\t}\n\t\t} finally {\n\t\t\tawait this.releaseClient(client);\n\t\t}\n\t}\n\tinExplicitTransaction() {\n\t\treturn false;\n\t}\n\tasync *runQuery(request, name) {\n\t\tconst client = await this.acquireClient();\n\t\ttry {\n\t\t\tif (!this.options.cursorDisabled) {\n\t\t\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\t\t\ttry {\n\t\t\t\t\tfor await (const row of this.streamWithPortalProtection(client, request, this.options.cursorBatchSize, name)) yield blindCast(row);\n\t\t\t\t\treturn;\n\t\t\t\t} catch (cursorError) {\n\t\t\t\t\tif (!(cursorError instanceof Error) || isPostgresError(cursorError)) throw cursorError;\n\t\t\t\t} finally {\n\t\t\t\t\treleaseLock();\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor await (const row of this.executeBuffered(client, request.sql, request.params, name)) yield blindCast(row);\n\t\t} finally {\n\t\t\tawait this.releaseClient(client);\n\t\t}\n\t}\n\tasync explain(request) {\n\t\tconst text = `EXPLAIN (FORMAT JSON) ${request.sql}`;\n\t\tconst client = await this.acquireClient();\n\t\ttry {\n\t\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\t\ttry {\n\t\t\t\treturn { rows: blindCast((await client.query(text, request.params === void 0 ? void 0 : [...request.params]).catch(rethrowNormalizedError)).rows) };\n\t\t\t} finally {\n\t\t\t\treleaseLock();\n\t\t\t}\n\t\t} finally {\n\t\t\tawait this.releaseClient(client);\n\t\t}\n\t}\n\tasync *streamWithPortalProtection(client, request, cursorBatchSize, name) {\n\t\tif (this.inExplicitTransaction()) {\n\t\t\tyield* this.executeWithCursor(client, request.sql, request.params, cursorBatchSize, name);\n\t\t\treturn;\n\t\t}\n\t\tawait client.query(\"BEGIN\");\n\t\tlet streamFailed = false;\n\t\ttry {\n\t\t\tyield* this.executeWithCursor(client, request.sql, request.params, cursorBatchSize, name);\n\t\t} catch (error) {\n\t\t\tstreamFailed = true;\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tawait this.commitStreamSpan(client, streamFailed);\n\t\t}\n\t}\n\tasync commitStreamSpan(client, streamFailed) {\n\t\ttry {\n\t\t\tawait client.query(\"COMMIT\");\n\t\t} catch (commitError) {\n\t\t\tif (!streamFailed) throw commitError;\n\t\t}\n\t}\n\tasync *executeWithCursor(client, sql, params, cursorBatchSize, name) {\n\t\tconst values = blindCast(params ?? []);\n\t\tconst cursor = client.query(name === void 0 ? new Cursor(sql, values) : new NamedCursor({\n\t\t\tname,\n\t\t\ttext: sql,\n\t\t\tvalues\n\t\t}));\n\t\ttry {\n\t\t\twhile (true) {\n\t\t\t\tconst rows = await readCursor(cursor, cursorBatchSize);\n\t\t\t\tif (rows.length === 0) break;\n\t\t\t\tfor (const row of rows) yield row;\n\t\t\t}\n\t\t} finally {\n\t\t\tawait closeCursor(cursor);\n\t\t}\n\t}\n\tasync *executeBuffered(client, sql, params, name) {\n\t\tconst config = {\n\t\t\tname,\n\t\t\ttext: sql,\n\t\t\tvalues: blindCast(params ?? [])\n\t\t};\n\t\tconst releaseLock = await acquireClientQueryLock(client);\n\t\tlet result;\n\t\ttry {\n\t\t\tresult = await client.query(config);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t}\n\t\tfor (const row of blindCast(result.rows)) yield row;\n\t}\n};\nvar PostgresConnectionImpl = class extends PostgresQueryable {\n\t#connection;\n\t#onRelease;\n\t#onDestroy;\n\t#txState;\n\tconstructor(connection, options, onRelease, onDestroy, txState) {\n\t\tsuper(options);\n\t\tthis.#connection = connection;\n\t\tthis.#onRelease = onRelease;\n\t\tthis.#onDestroy = onDestroy;\n\t\tthis.#txState = txState ?? { open: false };\n\t}\n\tacquireClient() {\n\t\treturn Promise.resolve(this.#connection);\n\t}\n\treleaseClient(_client) {\n\t\treturn Promise.resolve();\n\t}\n\tinExplicitTransaction() {\n\t\treturn this.#txState.open;\n\t}\n\tasync beginTransaction() {\n\t\tconst releaseLock = await acquireClientQueryLock(this.#connection);\n\t\ttry {\n\t\t\tawait this.#connection.query(\"BEGIN\").catch(rethrowNormalizedError);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t}\n\t\tthis.#txState.open = true;\n\t\treturn new PostgresTransactionImpl(this.#connection, this.options, () => {\n\t\t\tthis.#txState.open = false;\n\t\t});\n\t}\n\tasync release() {\n\t\tconst conn = this.#connection;\n\t\tif (\"release\" in conn) conn.release();\n\t\tconst onRelease = this.#onRelease;\n\t\tthis.#onRelease = void 0;\n\t\tthis.#onDestroy = void 0;\n\t\tonRelease?.();\n\t}\n\tasync destroy(reason) {\n\t\tconst onDestroy = this.#onDestroy;\n\t\tconst onRelease = this.#onRelease;\n\t\tthis.#onDestroy = void 0;\n\t\tthis.#onRelease = void 0;\n\t\tconst conn = this.#connection;\n\t\tif (\"release\" in conn) {\n\t\t\tconst releaseArg = reason instanceof Error ? reason : /* @__PURE__ */ new Error(\"Connection destroyed\");\n\t\t\tconn.release(releaseArg);\n\t\t}\n\t\tif (onDestroy) await onDestroy(reason);\n\t\telse onRelease?.();\n\t}\n};\nvar PostgresTransactionImpl = class extends PostgresQueryable {\n\t#connection;\n\t#onSettled;\n\tconstructor(connection, options, onSettled) {\n\t\tsuper(options);\n\t\tthis.#connection = connection;\n\t\tthis.#onSettled = onSettled;\n\t}\n\tacquireClient() {\n\t\treturn Promise.resolve(this.#connection);\n\t}\n\treleaseClient(_client) {\n\t\treturn Promise.resolve();\n\t}\n\tinExplicitTransaction() {\n\t\treturn true;\n\t}\n\t#settle() {\n\t\tconst onSettled = this.#onSettled;\n\t\tthis.#onSettled = void 0;\n\t\tonSettled?.();\n\t}\n\tasync commit() {\n\t\tconst releaseLock = await acquireClientQueryLock(this.#connection);\n\t\ttry {\n\t\t\tawait this.#connection.query(\"COMMIT\").catch(rethrowNormalizedError);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t\tthis.#settle();\n\t\t}\n\t}\n\tasync rollback() {\n\t\tconst releaseLock = await acquireClientQueryLock(this.#connection);\n\t\ttry {\n\t\t\tawait this.#connection.query(\"ROLLBACK\").catch(rethrowNormalizedError);\n\t\t} finally {\n\t\t\treleaseLock();\n\t\t\tthis.#settle();\n\t\t}\n\t}\n};\nvar PostgresPoolDriverImpl = class extends PostgresQueryable {\n\tpool;\n\t#closed = false;\n\tconstructor(options) {\n\t\tsuper(buildConnectionOptions(options));\n\t\tthis.pool = options.connect.pool;\n\t}\n\tget state() {\n\t\treturn this.#closed ? \"closed\" : \"connected\";\n\t}\n\tasync connect(_binding) {}\n\tasync acquireConnection() {\n\t\treturn new PostgresConnectionImpl(await this.acquireClient(), this.options);\n\t}\n\tasync close() {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tawait this.pool.end();\n\t}\n\tasync acquireClient() {\n\t\treturn this.pool.connect();\n\t}\n\tasync releaseClient(client) {\n\t\tclient.release();\n\t}\n};\nvar PostgresDirectDriverImpl = class extends PostgresQueryable {\n\tdirectClient;\n\t#connectionMutex = new AsyncMutex();\n\t#closed = false;\n\t#connected = false;\n\t#connectPromise;\n\t#txState = { open: false };\n\tconstructor(options) {\n\t\tsuper(buildConnectionOptions(options));\n\t\tthis.directClient = options.connect.client;\n\t}\n\tinExplicitTransaction() {\n\t\treturn this.#txState.open;\n\t}\n\tget state() {\n\t\treturn this.#closed ? \"closed\" : \"connected\";\n\t}\n\tasync connect(_binding) {}\n\tasync acquireConnection() {\n\t\tconst releaseLease = await this.#connectionMutex.lock();\n\t\ttry {\n\t\t\treturn new PostgresConnectionImpl(await this.acquireClient(), this.options, releaseLease, async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.#closeWhileHoldingLease();\n\t\t\t\t} finally {\n\t\t\t\t\treleaseLease();\n\t\t\t\t}\n\t\t\t}, this.#txState);\n\t\t} catch (error) {\n\t\t\treleaseLease();\n\t\t\tthrow error;\n\t\t}\n\t}\n\tasync close() {\n\t\tconst releaseLease = await this.#connectionMutex.lock();\n\t\ttry {\n\t\t\tawait this.#closeWhileHoldingLease();\n\t\t} finally {\n\t\t\treleaseLease();\n\t\t}\n\t}\n\tasync #closeWhileHoldingLease() {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tawait this.directClient.end();\n\t\tthis.#connected = false;\n\t}\n\tasync acquireClient() {\n\t\tif (this.#connected) return this.directClient;\n\t\tif (this.#connectPromise !== void 0) {\n\t\t\tawait this.#connectPromise;\n\t\t\treturn this.directClient;\n\t\t}\n\t\tthis.#connectPromise = (async () => {\n\t\t\ttry {\n\t\t\t\tawait this.directClient.connect();\n\t\t\t} catch (error) {\n\t\t\t\tif (!isAlreadyConnectedError(error)) throw error;\n\t\t\t} finally {\n\t\t\t\tthis.#connectPromise = void 0;\n\t\t\t}\n\t\t\tthis.#connected = true;\n\t\t})();\n\t\tawait this.#connectPromise;\n\t\treturn this.directClient;\n\t}\n\tasync releaseClient(_client) {}\n};\nfunction createBoundDriverFromBinding(binding, cursorOpts, extraOpts) {\n\tconst preparedStatements = extraOpts?.preparedStatements;\n\tswitch (binding.kind) {\n\t\tcase \"url\": return new PostgresPoolDriverImpl({\n\t\t\tconnect: { pool: new Pool({\n\t\t\t\tconnectionString: binding.url,\n\t\t\t\tconnectionTimeoutMillis: 2e4,\n\t\t\t\tidleTimeoutMillis: 3e4\n\t\t\t}) },\n\t\t\tcursor: cursorOpts,\n\t\t\tpreparedStatements\n\t\t});\n\t\tcase \"pgPool\": return new PostgresPoolDriverImpl({\n\t\t\tconnect: { pool: binding.pool },\n\t\t\tcursor: cursorOpts,\n\t\t\tpreparedStatements\n\t\t});\n\t\tcase \"pgClient\": return new PostgresDirectDriverImpl({\n\t\t\tconnect: { client: binding.client },\n\t\t\tcursor: cursorOpts,\n\t\t\tpreparedStatements\n\t\t});\n\t}\n}\nfunction readCursor(cursor, size) {\n\treturn callbackToPromise((cb) => {\n\t\tcursor.read(size, (err, rows) => cb(err, rows));\n\t});\n}\nfunction closeCursor(cursor) {\n\treturn callbackToPromise((cb) => cursor.close(cb));\n}\nfunction rethrowNormalizedError(error) {\n\tthrow normalizePgError(error);\n}\nfunction prepareFailedError(retryError, handle) {\n\tconst cause = normalizePgError(retryError);\n\treturn Object.assign(driverError(\"DRIVER.PREPARE_FAILED\", `Prepared statement failed again after re-preparing with a fresh handle: ${cause.message}`, { handle }), { cause });\n}\n//#endregion\n//#region src/exports/runtime.ts\nconst USE_BEFORE_CONNECT_MESSAGE = \"Postgres driver not connected. Call connect(binding) before acquireConnection or execute.\";\nconst ALREADY_CONNECTED_MESSAGE = \"Postgres driver already connected. Call close() before reconnecting with a new binding.\";\nfunction unboundQuery() {\n\treturn { [Symbol.asyncIterator]() {\n\t\treturn { async next() {\n\t\t\tthrow driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\t} };\n\t} };\n}\nvar PostgresUnboundDriverImpl = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"postgres\";\n\t#delegate = null;\n\t#closed = false;\n\t#cursorOpts;\n\t#preparedStatements;\n\tconstructor(options) {\n\t\tthis.#cursorOpts = options?.cursor;\n\t\tthis.#preparedStatements = options?.preparedStatements;\n\t}\n\tget state() {\n\t\tif (this.#delegate !== null) return \"connected\";\n\t\tif (this.#closed) return \"closed\";\n\t\treturn \"unbound\";\n\t}\n\t#requireDelegate() {\n\t\tconst delegate = this.#delegate;\n\t\tif (delegate === null) throw driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\treturn delegate;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#delegate !== null) throw driverError(\"DRIVER.ALREADY_CONNECTED\", ALREADY_CONNECTED_MESSAGE, { bindingKind: binding.kind });\n\t\tthis.#delegate = createBoundDriverFromBinding(binding, this.#cursorOpts, { preparedStatements: this.#preparedStatements });\n\t\tthis.#closed = false;\n\t}\n\tasync acquireConnection() {\n\t\tconst delegate = this.#requireDelegate();\n\t\tconst connection = await delegate.acquireConnection();\n\t\treturn this.#wrapConnection(connection, delegate);\n\t}\n\t/**\n\t* Wraps an acquired connection so that teardown paths which close the\n\t* underlying delegate (notably `destroy()` on a pgClient binding, where\n\t* the single socket means a destroyed connection invalidates the driver)\n\t* also reset our own `#delegate` reference. Without this, a failed\n\t* transaction rollback would leave the outer unbound wrapper reporting\n\t* `connected` while routing subsequent work to an already-ended delegate.\n\t*/\n\t#wrapConnection(connection, delegate) {\n\t\tconst syncDelegateState = () => {\n\t\t\tif (this.#delegate === delegate && delegate.state === \"closed\") {\n\t\t\t\tthis.#delegate = null;\n\t\t\t\tthis.#closed = true;\n\t\t\t}\n\t\t};\n\t\tconst wrapped = {\n\t\t\tbeginTransaction: connection.beginTransaction.bind(connection),\n\t\t\tquery: connection.query.bind(connection),\n\t\t\texecute: connection.execute.bind(connection),\n\t\t\trelease: async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait connection.release();\n\t\t\t\t} finally {\n\t\t\t\t\tsyncDelegateState();\n\t\t\t\t}\n\t\t\t},\n\t\t\tdestroy: async (reason) => {\n\t\t\t\ttry {\n\t\t\t\t\tawait connection.destroy(reason);\n\t\t\t\t} finally {\n\t\t\t\t\tsyncDelegateState();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tif (connection.explain) wrapped.explain = connection.explain.bind(connection);\n\t\treturn wrapped;\n\t}\n\tasync close() {\n\t\tconst delegate = this.#delegate;\n\t\tif (delegate !== null) {\n\t\t\tthis.#delegate = null;\n\t\t\tawait delegate.close();\n\t\t}\n\t\tthis.#closed = true;\n\t}\n\tquery(request) {\n\t\tconst delegate = this.#delegate;\n\t\treturn delegate === null ? unboundQuery() : delegate.query(request);\n\t}\n\tasync execute(request) {\n\t\tconst delegate = this.#delegate;\n\t\tif (delegate === null) throw driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\treturn delegate.execute(request);\n\t}\n\tasync explain(request) {\n\t\tconst delegate = this.#requireDelegate();\n\t\tconst explain = delegate.explain;\n\t\tif (explain === void 0) throw driverError(\"DRIVER.NOT_CONNECTED\", USE_BEFORE_CONNECT_MESSAGE);\n\t\treturn explain.call(delegate, request);\n\t}\n};\nconst postgresRuntimeDriverDescriptor = {\n\t...postgresDriverDescriptorMeta,\n\tcreate(options) {\n\t\treturn new PostgresUnboundDriverImpl(options);\n\t}\n};\n//#endregion\nexport { postgresRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;AAKA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,MAAM,QAAQ,IAAI,MAAM,OAAO;CAC/B,OAAO,eAAe,OAAO,QAAQ;EACpC,OAAO;EACP,cAAc;CACf,CAAC;CACD,OAAO,YAAY,KAAK,IAAI,OAAO,OAAO,OAAO;EAChD;EACA,UAAU;EACV,UAAU;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W,QAAQ;IAC1B,UAAU;KACT,kBAAkB;IACnB;GACD;GACA,SAAS,OAAO,WAAW;IAC1B,IAAI;KACH,MAAM,WAAW,QAAQ,MAAM;IAChC,UAAU;KACT,kBAAkB;IACnB;GACD;EACD;EACA,IAAI,WAAW,SAAS,QAAQ,UAAU,WAAW,QAAQ,KAAK,UAAU;EAC5E,OAAO;CACR;CACA,MAAM,QAAQ;EACb,MAAM,WAAW,KAAKO;EACtB,IAAI,aAAa,MAAM;GACtB,KAAKA,YAAY;GACjB,MAAM,SAAS,MAAM;EACtB;EACA,KAAKP,UAAU;CAChB;CACA,MAAM,SAAS;EACd,MAAM,WAAW,KAAKO;EACtB,OAAO,aAAa,OAAO,aAAa,IAAI,SAAS,MAAM,OAAO;CACnE;CACA,MAAM,QAAQ,SAAS;EACtB,MAAM,WAAW,KAAKA;EACtB,IAAI,aAAa,MAAM,MAAM,YAAY,wBAAwB,0BAA0B;EAC3F,OAAO,SAAS,QAAQ,OAAO;CAChC;CACA,MAAM,QAAQ,SAAS;EACtB,MAAM,WAAW,KAAKC,iBAAiB;EACvC,MAAM,UAAU,SAAS;EACzB,IAAI,YAAY,KAAK,GAAG,MAAM,YAAY,wBAAwB,0BAA0B;EAC5F,OAAO,QAAQ,KAAK,UAAU,OAAO;CACtC;AACD;AACA,MAAM,kCAAkC;CACvC,GAAG;CACH,OAAO,SAAS;EACf,OAAO,IAAI,0BAA0B,OAAO;CAC7C;AACD"}
@@ -1,4 +1,4 @@
1
- import { j as PostgresOpFactoryCall } from "./op-factory-call-jd4cgfjA-CyNT4YVn.mjs";
1
+ import { j as PostgresOpFactoryCall } from "./op-factory-call-DJEyoQmT-DSMQffKu.mjs";
2
2
  import { SqlStorage, StorageTypeInstance } from "@prisma/orm-family-sql/contract/types";
3
3
  import { DiffableNode, SchemaDiffIssue } from "@prisma/orm-framework/components/control";
4
4
  import { CodecControlHooks, MigrationOperationPolicy, SqlPlannerConflict } from "@prisma/orm-family-sql/family/control";
@@ -102,4 +102,4 @@ interface IssuePlannerOptions {
102
102
  declare function planIssues(options: IssuePlannerOptions): Result<IssuePlannerValue, readonly SqlPlannerConflict[]>;
103
103
  //#endregion
104
104
  export { planIssues as n, coalesceSubtreeIssues as t };
105
- //# sourceMappingURL=issue-planner-jkY6p-Ca.d.mts.map
105
+ //# sourceMappingURL=issue-planner-aw7grdXe.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"issue-planner-jkY6p-Ca.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/issue-planner.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;UAkBU;WACC,YAAY,SAAS;WACrB,cAAc,SAAS;WACvB;WACA,YAAY,oBAAoB;WAChC,cAAc,SAAS,eAAe;WACtC,QAAQ;WACR,QAAQ;WACR,qBAAqB,cAAc;;;;;;;;;KASzC,yBAAyB,iBAAiB,mBAAmB,SAAS;EACzE;EACA,iBAAiB;EACjB,gBAAgB;;;;;;;;EAQhB;;EAEA;;;;UAIQ;WACC,gBAAgB;;;;;;;;;;;iBAWV,sBAAsB,cAAc,eAAe,cAAc,iBAAiB,gBAAgB,oBAAoB,gBAAgB;UAC7I;WACC,iBAAiB;WACjB,YAAY,SAAS;WACrB,cAAc,SAAS;WACvB;WACA,YAAY,oBAAoB;WAChC,cAAc,SAAS,eAAe;;;;;;;;WAQtC,SAAS;;;;;;WAMT,SAAS;;;;;WAKT,sBAAsB,cAAc;WACpC,sBAAsB;;;;;;;;;iBAShB,WAAW,SAAS,sBAAsB,OAAO,4BAA4B"}
1
+ {"version":3,"file":"issue-planner-aw7grdXe.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/issue-planner.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;UAkBU;WACC,YAAY,SAAS;WACrB,cAAc,SAAS;WACvB;WACA,YAAY,oBAAoB;WAChC,cAAc,SAAS,eAAe;WACtC,QAAQ;WACR,QAAQ;WACR,qBAAqB,cAAc;;;;;;;;;KASzC,yBAAyB,iBAAiB,mBAAmB,SAAS;EACzE;EACA,iBAAiB;EACjB,gBAAgB;;;;;;;;EAQhB;;EAEA;;;;UAIQ;WACC,gBAAgB;;;;;;;;;;;iBAWV,sBAAsB,cAAc,eAAe,cAAc,iBAAiB,gBAAgB,oBAAoB,gBAAgB;UAC7I;WACC,iBAAiB;WACjB,YAAY,SAAS;WACrB,cAAc,SAAS;WACvB;WACA,YAAY,oBAAoB;WAChC,cAAc,SAAS,eAAe;;;;;;;;WAQtC,SAAS;;;;;;WAMT,SAAS;;;;;WAKT,sBAAsB,cAAc;WACpC,sBAAsB;;;;;;;;;iBAShB,WAAW,SAAS,sBAAsB,OAAO,4BAA4B"}
@@ -1,6 +1,6 @@
1
1
  import "./data-transform-Ck5FbyNO-BNE7QlAo.mjs";
2
- import { A as Op$1 } from "./op-factory-call-jd4cgfjA-CyNT4YVn.mjs";
3
- import "./postgres-migration-CDJj7CvD-Bsqs_fVo.mjs";
2
+ import { A as Op$1 } from "./op-factory-call-DJEyoQmT-DSMQffKu.mjs";
3
+ import "./postgres-migration-DPK9WNF5-DHAXtwys.mjs";
4
4
  import { checkExpression, col as col$1, fn as fn$1, foreignKey, lit as lit$1, primaryKey, unique } from "@prisma/orm-family-sql/relational-core/contract-free";
5
5
  import { placeholder } from "@prisma/orm-framework/errors/migration";
6
6
  import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
@@ -22,4 +22,4 @@ declare function createExtension(extensionName: string): Op$1;
22
22
  declare function rawSql(op: Op$1): Op$1;
23
23
  //#endregion
24
24
  export { fn$1 as a, placeholder as c, unique as d, createExtension as i, primaryKey as l, checkExpression as n, foreignKey as o, col$1 as r, lit$1 as s, MigrationCLI as t, rawSql as u };
25
- //# sourceMappingURL=migration-CBSAPE8S.d.mts.map
25
+ //# sourceMappingURL=migration-DyZpdeyj.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migration-CBSAPE8S.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.d.mts"],"mappings":";;;;;;;;iBAQiB,gBAAgB,wBAAwB;;;;;;;;;;;;;iBAaxC,OAAO,IAAI,OAAK"}
1
+ {"version":3,"file":"migration-DyZpdeyj.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.d.mts"],"mappings":";;;;;;;;iBAQiB,gBAAgB,wBAAwB;;;;;;;;;;;;;iBAaxC,OAAO,IAAI,OAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"migration-PTHAY9Cv.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.mjs"],"sourcesContent":["import { F as createExtension } from \"./op-factory-call-DifL68KT.mjs\";\nimport { t as dataTransform } from \"./data-transform-ChZzy2dP.mjs\";\nimport { t as PostgresMigration } from \"./postgres-migration-CJshdIZn.mjs\";\nimport { checkExpression, col, fn, foreignKey, lit, primaryKey, unique } from \"@internal/sql-relational-core/contract-free\";\nimport { placeholder } from \"@internal/errors/migration\";\nimport { MigrationCLI } from \"@internal/cli/migration-cli\";\n//#region src/core/migrations/operations/raw.ts\n/**\n* Identity factory for an already-materialized `SqlMigrationPlanOperation`.\n*\n* The planner uses this via `liftOpToCall` to carry ops produced by SQL\n* family methods, codec control hooks, and component database dependencies\n* alongside migration IR without reverse-engineering them. Users writing\n* raw migrations can pass a full op shape directly — typically built by\n* composing SQL family helpers — to author a migration that bypasses the\n* structured call classes.\n*/\nfunction rawSql(op) {\n\treturn op;\n}\n//#endregion\nexport { PostgresMigration as Migration, MigrationCLI, checkExpression, col, createExtension, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAS,OAAO,IAAI;CACnB,OAAO;AACR"}
1
+ {"version":3,"file":"migration-PTHAY9Cv.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.mjs"],"sourcesContent":["import { F as createExtension } from \"./op-factory-call-rf1FJg8l.mjs\";\nimport { t as dataTransform } from \"./data-transform-ChZzy2dP.mjs\";\nimport { t as PostgresMigration } from \"./postgres-migration-DJqjEDIS.mjs\";\nimport { checkExpression, col, fn, foreignKey, lit, primaryKey, unique } from \"@internal/sql-relational-core/contract-free\";\nimport { placeholder } from \"@internal/errors/migration\";\nimport { MigrationCLI } from \"@internal/cli/migration-cli\";\n//#region src/core/migrations/operations/raw.ts\n/**\n* Identity factory for an already-materialized `SqlMigrationPlanOperation`.\n*\n* The planner uses this via `liftOpToCall` to carry ops produced by SQL\n* family methods, codec control hooks, and component database dependencies\n* alongside migration IR without reverse-engineering them. Users writing\n* raw migrations can pass a full op shape directly — typically built by\n* composing SQL family helpers — to author a migration that bypasses the\n* structured call classes.\n*/\nfunction rawSql(op) {\n\treturn op;\n}\n//#endregion\nexport { PostgresMigration as Migration, MigrationCLI, checkExpression, col, createExtension, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAS,OAAO,IAAI;CACnB,OAAO;AACR"}
@@ -0,0 +1 @@
1
+ import "./op-factory-call-DJEyoQmT-DSMQffKu.mjs";
@@ -7,7 +7,7 @@ import { MigrationOperationClass, OpFactoryCall } from "@prisma/orm-framework/co
7
7
  import { CodecControlHooks, SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
8
8
  import { ImportRequirement, TsExpression } from "@prisma/orm-framework/ts-render";
9
9
  import { ExecuteRequestLowerer, Lowerer } from "@prisma/orm-family-sql/family/control-adapter";
10
- //#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-jd4cgfjA.d.mts
10
+ //#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-DJEyoQmT.d.mts
11
11
  //#region src/core/migrations/operations/shared.d.ts
12
12
  type Op$1 = SqlMigrationPlanOperation<PostgresPlanTargetDetails>;
13
13
  /**
@@ -286,10 +286,10 @@ declare class AddCheckConstraintCall extends PostgresOpFactoryCallNode {
286
286
  readonly schemaName: string;
287
287
  readonly tableName: string;
288
288
  readonly constraintName: string;
289
- readonly column: string;
290
- readonly values: readonly string[];
289
+ /** Opaque SQL: the predicate body, rendered verbatim inside `CHECK (…)`. */
290
+ readonly expression: string;
291
291
  readonly label: string;
292
- constructor(schemaName: string, tableName: string, constraintName: string, column: string, values: readonly string[]);
292
+ constructor(schemaName: string, tableName: string, constraintName: string, expression: string);
293
293
  toOp(lowerer?: ExecuteRequestLowerer): Promise<Op>;
294
294
  renderTypeScript(): string;
295
295
  importRequirements(): readonly ImportRequirement[];
@@ -518,4 +518,4 @@ declare class RenamePostgresRlsPolicyCall extends PostgresOpFactoryCallNode {
518
518
  type PostgresOpFactoryCall = CreateTableCall | DropTableCall | AddColumnCall | DropColumnCall | AlterColumnTypeCall | SetNotNullCall | DropNotNullCall | SetDefaultCall | DropDefaultCall | AddNotNullColumnDirectCall | AddNotNullColumnWithTempDefaultCall | AddPrimaryKeyCall | AddForeignKeyCall | AddUniqueCall | AddCheckConstraintCall | DropCheckConstraintCall | CreateIndexCall | RenameIndexCall | DropIndexCall | DropConstraintCall | RawSqlCall | CreateExtensionCall | CreateSchemaCall | CreateNativeEnumTypeCall | DropNativeEnumTypeCall | AddNativeEnumValueCall | CreatePostgresRlsPolicyCall | DropPostgresRlsPolicyCall | EnableRowLevelSecurityCall | DisableRowLevelSecurityCall | RenamePostgresRlsPolicyCall | DataTransformCall;
519
519
  //#endregion
520
520
  export { Op$1 as A, DropIndexCall as C, DropTableCall as D, DropPostgresRlsPolicyCall as E, SetDefaultCall as F, SetNotNullCall as I, RawSqlCall as M, RenameIndexCall as N, EnableRowLevelSecurityCall as O, RenamePostgresRlsPolicyCall as P, DropDefaultCall as S, DropNotNullCall as T, DataTransformCall as _, AddNotNullColumnWithTempDefaultCall as a, DropColumnCall as b, AlterColumnTypeCall as c, CreateIndexCall as d, CreateIndexExtras as f, CreateTableCall as g, CreateSchemaCall as h, AddNativeEnumValueCall as i, PostgresOpFactoryCall as j, ForeignKeySpec as k, AlterColumnTypeOptions as l, CreatePostgresRlsPolicyCall as m, AddColumnCall as n, AddPrimaryKeyCall as o, CreateNativeEnumTypeCall as p, AddForeignKeyCall as r, AddUniqueCall as s, AddCheckConstraintCall as t, CreateExtensionCall as u, DisableRowLevelSecurityCall as v, DropNativeEnumTypeCall as w, DropConstraintCall as x, DropCheckConstraintCall as y };
521
- //# sourceMappingURL=op-factory-call-jd4cgfjA-CyNT4YVn.d.mts.map
521
+ //# sourceMappingURL=op-factory-call-DJEyoQmT-DSMQffKu.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"op-factory-call-jd4cgfjA-CyNT4YVn.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/op-factory-call-jd4cgfjA.d.mts"],"mappings":";;;;;;;;;;;KAUK,OAAO,0BAA0B;;;;;;UAM5B;WACC;WACA;WACA;aACE;aACA;aACA;;WAEF,WAAW;WACX,WAAW;;;;UAIZ;WACC;WACA,UAAU;;;;;;WAMV;WACA;;;;;;;KAON;WACM;;WAEA;;;;KAIN,KAAK,0BAA0B;uBACb,kCAAkC,wBAAwB;oBAC7D;oBACA,gBAAgB;oBAChB;WACT,KAAK,UAAU,UAAU,KAAK,QAAQ;EAC/C,+BAA+B;YACrB;;cAEE,wBAAwB;WAC3B;WACA;WACA;WACA;WACA,kBAAkB;WAClB,sBAAsB;WACtB;EACT,YAAY,oBAAoB,mBAAmB,kBAAkB,aAAa,uBAAuB;EACzG,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;cAEnB,sBAAsB;WACzB;WACA;WACA;WACA;WACA;EACT,YAAY,oBAAoB;EAChC,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;cAEnB,sBAAsB;WACzB;WACA;WACA;WACA;WACA,QAAQ;WACR;EACT,YAAY,oBAAoB,mBAAmB,QAAQ;EAC3D,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;cAEnB,uBAAuB;W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UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;cAEnB,oCAAoC;WACvC;WACA;WACA;WACA;WACA;EACT,YAAY,oBAAoB;EAChC,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;cAEnB,oCAAoC;WACvC;WACA;WACA;WACA;WACA;WACA;WACA;EACT,YAAY,oBAAoB,mBAAmB,uBAAuB;EAC1E,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;KAE5B,wBAAwB,kBAAkB,gBAAgB,gBAAgB,iBAAiB,sBAAsB,iBAAiB,kBAAkB,iBAAiB,kBAAkB,6BAA6B,sCAAsC,oBAAoB,oBAAoB,gBAAgB,yBAAyB,0BAA0B,kBAAkB,kBAAkB,gBAAgB,qBAAqB,aAAa,sBAAsB,mBAAmB,2BAA2B,yBAAyB,yBAAyB,8BAA8B,4BAA4B,6BAA6B,8BAA8B,8BAA8B"}
1
+ {"version":3,"file":"op-factory-call-DJEyoQmT-DSMQffKu.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/op-factory-call-DJEyoQmT.d.mts"],"mappings":";;;;;;;;;;;KAUK,OAAO,0BAA0B;;;;;;UAM5B;WACC;WACA;WACA;aACE;aACA;aACA;;WAEF,WAAW;WACX,WAAW;;;;UAIZ;WACC;WACA,UAAU;;;;;;WAMV;WACA;;;;;;;KAON;WACM;;WAEA;;;;KAIN,KAAK,0BAA0B;uBACb,kCAAkC,wBAAwB;oBAC7D;oBACA,gBAAgB;oBAChB;WACT,KAAK,UAAU,UAAU,KAAK,QAAQ;EAC/C,+BAA+B;YACrB;;cAEE,wBAAwB;WAC3B;WACA;WACA;WACA;WACA,kBAAkB;WAClB,sBAAsB;WACtB;EACT,YAAY,oBAAoB,mBAAmB,kBAAkB,aAAa,uBAAuB;EACzG,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;cAEnB,sBAAsB;WACzB;WACA;WACA;WACA;WACA;EACT,YAAY,oB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,+BAA+B;;cAEnB,kCAAkC;WACrC;WACA;WACA;WACA;WACA;WACA;EACT,YAAY,oBAAoB,mBAAmB;EACnD,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;cAEnB,mCAAmC;WACtC;WACA;WACA;WACA;WACA;EACT,YAAY,oBAAoB;EAChC,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;cAEnB,oCAAoC;WACvC;WACA;WACA;WACA;WACA;EACT,YAAY,oBAAoB;EAChC,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;cAEnB,oCAAoC;WACvC;WACA;WACA;WACA;WACA;WACA;WACA;EACT,YAAY,oBAAoB,mBAAmB,uBAAuB;EAC1E,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,+BAA+B;;KAE5B,wBAAwB,kBAAkB,gBAAgB,gBAAgB,iBAAiB,sBAAsB,iBAAiB,kBAAkB,iBAAiB,kBAAkB,6BAA6B,sCAAsC,oBAAoB,oBAAoB,gBAAgB,yBAAyB,0BAA0B,kBAAkB,kBAAkB,gBAAgB,qBAAqB,aAAa,sBAAsB,mBAAmB,2BAA2B,yBAAyB,yBAAyB,8BAA8B,4BAA4B,6BAA6B,8BAA8B,8BAA8B"}
@@ -14,7 +14,7 @@ import { InternalError, assertNever } from "@prisma/orm-framework/utils/internal
14
14
  import { errorUnfilledPlaceholder } from "@prisma/orm-framework/errors/migration";
15
15
  import { TsExpression, jsonToTsSource } from "@prisma/orm-framework/ts-render";
16
16
  import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
17
- //#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-DifL68KT.mjs
17
+ //#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-rf1FJg8l.mjs
18
18
  /**
19
19
  * Maps a planner schema name to the contract-free DDL builder's optional
20
20
  * `schema` field: the unbound sentinel becomes `undefined` (the builder omits
@@ -324,9 +324,8 @@ async function addForeignKey(schemaName, tableName, fk, lowerer) {
324
324
  postcheck: [step(`verify FK "${fk.name}" exists`, present.sql, present.params)]
325
325
  };
326
326
  }
327
- async function addCheckConstraint(schemaName, tableName, constraintName, column, values, lowerer) {
327
+ async function addCheckConstraint(schemaName, tableName, constraintName, expression, lowerer) {
328
328
  const qualified = qualifyTableName(schemaName, tableName);
329
- const valueList = values.map((v) => `'${escapeLiteral(v)}'`).join(", ");
330
329
  const { absent, present } = await constraintCheckSteps(lowerer, {
331
330
  constraintName,
332
331
  schema: schemaName,
@@ -334,11 +333,11 @@ async function addCheckConstraint(schemaName, tableName, constraintName, column,
334
333
  });
335
334
  return {
336
335
  id: `checkConstraint.${tableName}.${constraintName}`,
337
- label: `Add check constraint "${constraintName}" on "${tableName}"."${column}"`,
336
+ label: `Add check constraint "${constraintName}" on "${tableName}"`,
338
337
  operationClass: "additive",
339
338
  target: targetDetails("checkConstraint", constraintName, schemaName, tableName),
340
339
  precheck: [step(`ensure constraint "${constraintName}" does not exist`, absent.sql, absent.params)],
341
- execute: [step(`add check constraint "${constraintName}"`, `ALTER TABLE ${qualified} ADD CONSTRAINT ${quoteIdentifier(constraintName)} CHECK (${quoteIdentifier(column)} IN (${valueList}))`)],
340
+ execute: [step(`add check constraint "${constraintName}"`, `ALTER TABLE ${qualified} ADD CONSTRAINT ${quoteIdentifier(constraintName)} CHECK (${expression})`)],
342
341
  postcheck: [step(`verify constraint "${constraintName}" exists`, present.sql, present.params)]
343
342
  };
344
343
  }
@@ -1440,25 +1439,24 @@ var AddCheckConstraintCall = class extends PostgresOpFactoryCallNode {
1440
1439
  schemaName;
1441
1440
  tableName;
1442
1441
  constraintName;
1443
- column;
1444
- values;
1442
+ /** Opaque SQL: the predicate body, rendered verbatim inside `CHECK (…)`. */
1443
+ expression;
1445
1444
  label;
1446
- constructor(schemaName, tableName, constraintName, column, values) {
1445
+ constructor(schemaName, tableName, constraintName, expression) {
1447
1446
  super();
1448
1447
  this.schemaName = schemaName;
1449
1448
  this.tableName = tableName;
1450
1449
  this.constraintName = constraintName;
1451
- this.column = column;
1452
- this.values = values;
1453
- this.label = `Add check constraint "${constraintName}" on "${tableName}"."${column}"`;
1450
+ this.expression = expression;
1451
+ this.label = `Add check constraint "${constraintName}" on "${tableName}"`;
1454
1452
  this.freeze();
1455
1453
  }
1456
1454
  async toOp(lowerer) {
1457
1455
  if (lowerer === void 0) throw postgresError("MIGRATION.POSTGRES_CONTROL_STACK_MISSING", `AddCheckConstraintCall.toOp: a lowerer is required on the Postgres planner path (constraint "${this.constraintName}" on table "${this.tableName}"). Pass the control adapter to createPostgresMigrationPlanner.`, { meta: { factory: "AddCheckConstraintCall" } });
1458
- return addCheckConstraint(this.schemaName, this.tableName, this.constraintName, this.column, this.values, lowerer);
1456
+ return addCheckConstraint(this.schemaName, this.tableName, this.constraintName, this.expression, lowerer);
1459
1457
  }
1460
1458
  renderTypeScript() {
1461
- return `this.addCheckConstraint({ ${constraintCallOptions(this.schemaName, this.tableName, this.constraintName)}, column: ${jsonToTsSource(this.column)}, values: ${jsonToTsSource(this.values)} })`;
1459
+ return `this.addCheckConstraint({ ${constraintCallOptions(this.schemaName, this.tableName, this.constraintName)}, expression: ${jsonToTsSource(this.expression)} })`;
1462
1460
  }
1463
1461
  importRequirements() {
1464
1462
  return [];
@@ -2006,4 +2004,4 @@ var RenamePostgresRlsPolicyCall = class extends PostgresOpFactoryCallNode {
2006
2004
  //#endregion
2007
2005
  export { RenamePostgresRlsPolicyCall as A, DropNativeEnumTypeCall as C, EnableRowLevelSecurityCall as D, DropTableCall as E, installExtension as F, postgresDefaultToDdlColumnDefault as I, SetNotNullCall as M, buildTargetDetails as N, RawSqlCall as O, createExtension as P, DropIndexCall as S, DropPostgresRlsPolicyCall as T, DisableRowLevelSecurityCall as _, AddNotNullColumnDirectCall as a, DropConstraintCall as b, AddUniqueCall as c, CreateIndexCall as d, CreateNativeEnumTypeCall as f, DataTransformCall as g, CreateTableCall as h, AddNativeEnumValueCall as i, SetDefaultCall as j, RenameIndexCall as k, AlterColumnTypeCall as l, CreateSchemaCall as m, AddColumnCall as n, AddNotNullColumnWithTempDefaultCall as o, CreatePostgresRlsPolicyCall as p, AddForeignKeyCall as r, AddPrimaryKeyCall as s, AddCheckConstraintCall as t, CreateExtensionCall as u, DropCheckConstraintCall as v, DropNotNullCall as w, DropDefaultCall as x, DropColumnCall as y };
2008
2006
 
2009
- //# sourceMappingURL=op-factory-call-DifL68KT-CNFEDNsf.mjs.map
2007
+ //# sourceMappingURL=op-factory-call-rf1FJg8l-C6KLaBY1.mjs.map