@prisma/orm-postgres 8.0.0-rc.17-dev.35 → 8.0.0-rc.17-dev.36
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/{postgres-options-BX1KZFGn-BKLDkV4w.d.mts → postgres-options-snwVSiHP-wfK0Xrpa.d.mts} +4 -3
- package/dist/{postgres-options-BX1KZFGn-BKLDkV4w.d.mts.map → postgres-options-snwVSiHP-wfK0Xrpa.d.mts.map} +1 -1
- package/dist/{postgres-runtime-B3lGmB9G-Blyx29Cy.mjs → postgres-runtime-DnLoEvCj-BZApeGxP.mjs} +4 -3
- package/dist/{postgres-runtime-B3lGmB9G-Blyx29Cy.mjs.map → postgres-runtime-DnLoEvCj-BZApeGxP.mjs.map} +1 -1
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/serverless.d.mts +1 -1
- package/dist/serverless.mjs +1 -1
- package/dist/serverless.mjs.map +1 -1
- package/package.json +8 -8
- package/skills/prisma-8/SKILL.md +1 -1
- package/skills/prisma-8/references/runtime.md +2 -1
package/dist/{postgres-options-BX1KZFGn-BKLDkV4w.d.mts → postgres-options-snwVSiHP-wfK0Xrpa.d.mts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as PostgresStaticContext, r as PostgresTargetId, t as NamespacedNativeEnums } from "./postgres-static-Crd_bF1a-DLqHzv91.mjs";
|
|
2
|
-
import { BindSiteParams, Declaration, ParamsFromDeclaration, Runtime, SqlExecutionStackWithDriver, SqlMiddleware, SqlRuntimeExtensionDescriptor, TransactionContext, VerifyMarkerOption } from "@prisma/orm-family-sql/runtime";
|
|
2
|
+
import { BindSiteParams, Declaration, Log, ParamsFromDeclaration, Runtime, SqlExecutionStackWithDriver, SqlMiddleware, SqlRuntimeExtensionDescriptor, TransactionContext, VerifyMarkerOption } from "@prisma/orm-family-sql/runtime";
|
|
3
3
|
import { PreparedFrom, orm } from "@prisma/orm-family-sql/orm-client";
|
|
4
4
|
import { NamespacedEnums } from "@prisma/orm-framework/contract/enum-accessor";
|
|
5
5
|
import "@prisma/orm-target-postgres/driver/runtime";
|
|
@@ -8,7 +8,7 @@ import { ExtractCodecTypes, SqlStorage } from "@prisma/orm-family-sql/contract/t
|
|
|
8
8
|
import { Db } from "@prisma/orm-family-sql/builder/types";
|
|
9
9
|
import { CodecTypesBase } from "@prisma/orm-family-sql/relational-core/expression";
|
|
10
10
|
import { Preparable, SqlQueryPlan } from "@prisma/orm-family-sql/relational-core/plan";
|
|
11
|
-
//#region ../../../3-extensions/postgres/dist/postgres-options-
|
|
11
|
+
//#region ../../../3-extensions/postgres/dist/postgres-options-snwVSiHP.d.mts
|
|
12
12
|
//#region src/runtime/postgres-members.d.ts
|
|
13
13
|
type OrmClient<TContract extends Contract<SqlStorage>> = ReturnType<typeof orm<TContract>>;
|
|
14
14
|
interface PostgresTransactionContext<TContract extends Contract<SqlStorage>> extends TransactionContext {
|
|
@@ -48,8 +48,9 @@ interface PostgresExecutionOptions {
|
|
|
48
48
|
readonly extensions?: readonly SqlRuntimeExtensionDescriptor<PostgresTargetId>[];
|
|
49
49
|
readonly middleware?: readonly SqlMiddleware[];
|
|
50
50
|
readonly verifyMarker?: VerifyMarkerOption;
|
|
51
|
+
readonly log?: Log;
|
|
51
52
|
readonly cursor?: PostgresCursorOptions;
|
|
52
53
|
}
|
|
53
54
|
//#endregion
|
|
54
55
|
export { PostgresStaticMembers as a, PostgresRuntimeBoundMembers as i, PostgresExecutionOptions as n, PostgresLifecycleMembers as r, PostgresCursorOptions as t };
|
|
55
|
-
//# sourceMappingURL=postgres-options-
|
|
56
|
+
//# sourceMappingURL=postgres-options-snwVSiHP-wfK0Xrpa.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-options-
|
|
1
|
+
{"version":3,"file":"postgres-options-snwVSiHP-wfK0Xrpa.d.mts","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-options-snwVSiHP.d.mts"],"mappings":";;;;;;;;;;;;KAWK,UAAU,kBAAkB,SAAS,eAAe,kBAAkB,IAAI;UACrE,2BAA2B,kBAAkB,SAAS,qBAAqB;WAC1E,KAAK,GAAG;WACR,KAAK,UAAU;WACf,OAAO,gBAAgB;WACvB,aAAa,sBAAsB;;UAEpC,sBAAsB,kBAAkB,SAAS,qBAAqB,sBAAsB;WAC3F,OAAO,4BAA4B;;UAEpC,4BAA4B,kBAAkB,SAAS;WACtD,KAAK,UAAU;EACxB,WAAW;EACX,YAAY,GAAG,KAAK,IAAI,2BAA2B,eAAe,YAAY,KAAK,QAAQ;EAC3F,QAAQ,UAAU,YAAY,KAAK,UAAU,eAAe,8BAA8B,WAAW,iBAAiB,kBAAkB,YAAY,aAAa,GAAG,WAAW,QAAQ,eAAe,OAAO,IAAI,QAAQ,aAAa,sBAAsB,GAAG,KAAK;;UAE5P;EACR,SAAS;GACR,OAAO,iBAAiB;;;;;;;;;UASjB;WACC;;;;;;UAMD;WACC,sBAAsB,8BAA8B;WACpD,sBAAsB;WACtB,eAAe;WACf,MAAM;WACN,SAAS"}
|
package/dist/{postgres-runtime-B3lGmB9G-Blyx29Cy.mjs → postgres-runtime-DnLoEvCj-BZApeGxP.mjs}
RENAMED
|
@@ -7,7 +7,7 @@ import postgresTarget from "@prisma/orm-target-postgres/target/runtime";
|
|
|
7
7
|
import { sql } from "@prisma/orm-family-sql/builder/runtime";
|
|
8
8
|
import { orm, prepareQuery } from "@prisma/orm-family-sql/orm-client";
|
|
9
9
|
import { type } from "arktype";
|
|
10
|
-
//#region ../../../3-extensions/postgres/dist/postgres-runtime-
|
|
10
|
+
//#region ../../../3-extensions/postgres/dist/postgres-runtime-DnLoEvCj.mjs
|
|
11
11
|
const isPgPool = (pg) => "totalCount" in pg && "idleCount" in pg && "waitingCount" in pg;
|
|
12
12
|
const isPgClient = (pg) => "escapeIdentifier" in pg && "escapeLiteral" in pg;
|
|
13
13
|
function validatePostgresUrl(url) {
|
|
@@ -146,7 +146,8 @@ function toDriverCursorOptions(cursor) {
|
|
|
146
146
|
function toRuntimeOptions(options) {
|
|
147
147
|
return {
|
|
148
148
|
...ifDefined("verifyMarker", options.verifyMarker),
|
|
149
|
-
...ifDefined("middleware", options.middleware)
|
|
149
|
+
...ifDefined("middleware", options.middleware),
|
|
150
|
+
...ifDefined("log", options.log)
|
|
150
151
|
};
|
|
151
152
|
}
|
|
152
153
|
var PostgresRuntimeImpl = class extends SqlRuntimeBase {
|
|
@@ -157,4 +158,4 @@ var PostgresRuntimeImpl = class extends SqlRuntimeBase {
|
|
|
157
158
|
//#endregion
|
|
158
159
|
export { isPgPool as a, toDriverCursorOptions as c, validatePostgresUrl as d, isPgClient as i, toRuntimeOptions as l, PostgresRuntimeImpl as n, resolveOptionalPostgresBinding as o, buildPostgresRuntimeBoundMembers as r, resolvePostgresBinding as s, DEFAULT_CONNECT_TIMEOUT_MILLIS as t, validateCursorOptions as u };
|
|
159
160
|
|
|
160
|
-
//# sourceMappingURL=postgres-runtime-
|
|
161
|
+
//# sourceMappingURL=postgres-runtime-DnLoEvCj-BZApeGxP.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-runtime-
|
|
1
|
+
{"version":3,"file":"postgres-runtime-DnLoEvCj-BZApeGxP.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-runtime-DnLoEvCj.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { SqlRuntimeBase, withTransaction } from \"@internal/sql-runtime\";\nimport postgresTarget from \"@internal/target-postgres/runtime\";\nimport { sql } from \"@internal/sql-builder/runtime\";\nimport { orm, prepareQuery } from \"@internal/sql-orm-client\";\nimport { type } from \"arktype\";\n//#region src/runtime/binding.ts\nconst isPgPool = (pg) => \"totalCount\" in pg && \"idleCount\" in pg && \"waitingCount\" in pg;\nconst isPgClient = (pg) => \"escapeIdentifier\" in pg && \"escapeLiteral\" in pg;\nfunction validatePostgresUrl(url) {\n\tconst trimmed = url.trim();\n\tif (trimmed.length === 0) throw postgresError(\"RUNTIME.BINDING_INVALID\", \"Postgres URL must be a non-empty string\", { meta: {\n\t\textension: \"postgres\",\n\t\treason: \"empty url\"\n\t} });\n\tlet parsed;\n\ttry {\n\t\tparsed = new URL(trimmed);\n\t} catch {\n\t\tthrow postgresError(\"RUNTIME.BINDING_INVALID\", \"Postgres URL must be a valid URL\", { meta: {\n\t\t\textension: \"postgres\",\n\t\t\treason: \"unparseable url\"\n\t\t} });\n\t}\n\tif (parsed.protocol !== \"postgres:\" && parsed.protocol !== \"postgresql:\") throw postgresError(\"RUNTIME.BINDING_INVALID\", \"Postgres URL must use postgres:// or postgresql://\", { meta: {\n\t\textension: \"postgres\",\n\t\treason: \"wrong scheme\",\n\t\treceived: parsed.protocol\n\t} });\n\treturn trimmed;\n}\nfunction resolvePostgresBinding(options) {\n\tif (Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.pg !== void 0) !== 1) throw postgresError(\"RUNTIME.BINDING_INVALID\", \"Provide one binding input: binding, url, or pg\", {\n\t\tfix: \"Pass exactly one of `binding`, `url`, or `pg`.\",\n\t\tmeta: {\n\t\t\textension: \"postgres\",\n\t\t\treason: \"zero or multiple binding inputs\"\n\t\t}\n\t});\n\tif (options.binding !== void 0) return options.binding;\n\tif (options.url !== void 0) return {\n\t\tkind: \"url\",\n\t\turl: validatePostgresUrl(options.url)\n\t};\n\tconst pgBinding = options.pg;\n\tif (pgBinding === void 0) throw new InternalError(\"Invariant violation: expected pg binding after validation\");\n\tif (isPgPool(pgBinding)) return {\n\t\tkind: \"pgPool\",\n\t\tpool: pgBinding\n\t};\n\tif (isPgClient(pgBinding)) return {\n\t\tkind: \"pgClient\",\n\t\tclient: pgBinding\n\t};\n\tthrow postgresError(\"RUNTIME.BINDING_INVALID\", \"Unable to determine pg binding type from pg input; use binding with explicit kind\", {\n\t\tfix: \"Pass `binding: { kind: \\\"pgPool\\\", pool }` or `binding: { kind: \\\"pgClient\\\", client }` instead of `pg`.\",\n\t\tmeta: {\n\t\t\textension: \"postgres\",\n\t\t\treason: \"unrecognizable pg object\"\n\t\t}\n\t});\n}\nfunction resolveOptionalPostgresBinding(options) {\n\tif (Number(options.binding !== void 0) + Number(options.url !== void 0) + Number(options.pg !== void 0) === 0) return;\n\treturn resolvePostgresBinding(blindCast(options));\n}\n//#endregion\n//#region src/runtime/postgres-members.ts\nfunction buildPostgresRuntimeBoundMembers(options) {\n\tconst { context, rawCodecInferer, enums, nativeEnums, getRuntime, getRuntimeForWork } = options;\n\tconst orm$1 = orm({\n\t\truntime: {\n\t\t\tquery(plan) {\n\t\t\t\treturn getRuntimeForWork().query(plan);\n\t\t\t},\n\t\t\texecute(plan) {\n\t\t\t\treturn getRuntimeForWork().execute(plan);\n\t\t\t},\n\t\t\tconnection() {\n\t\t\t\treturn getRuntimeForWork().connection();\n\t\t\t}\n\t\t},\n\t\tcontext\n\t});\n\tfunction prepare(declaration, callback) {\n\t\treturn prepareQuery(getRuntimeForWork(), declaration, callback);\n\t}\n\treturn {\n\t\torm: orm$1,\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tprepare,\n\t\ttransaction(fn) {\n\t\t\treturn withTransaction(getRuntimeForWork(), (txCtx) => {\n\t\t\t\tconst txSql = sql({\n\t\t\t\t\tcontext,\n\t\t\t\t\trawCodecInferer\n\t\t\t\t});\n\t\t\t\tconst txOrm = orm({\n\t\t\t\t\truntime: {\n\t\t\t\t\t\tquery(plan) {\n\t\t\t\t\t\t\treturn txCtx.query(plan);\n\t\t\t\t\t\t},\n\t\t\t\t\t\texecute(plan) {\n\t\t\t\t\t\t\treturn txCtx.execute(plan);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcontext\n\t\t\t\t});\n\t\t\t\treturn fn(Object.assign(castAs(Object.create(txCtx)), {\n\t\t\t\t\tsql: txSql,\n\t\t\t\t\torm: txOrm,\n\t\t\t\t\tenums,\n\t\t\t\t\tnativeEnums\n\t\t\t\t}));\n\t\t\t});\n\t\t}\n\t};\n}\n//#endregion\n//#region src/runtime/postgres-options.ts\n/**\n* Default time to wait for the database to accept a connection, for a client's pool and for a\n* connection's `pg.Client`.\n*/\nconst DEFAULT_CONNECT_TIMEOUT_MILLIS = 2e4;\nconst cursorOptionsSchema = type({ \"batchSize?\": \"number.integer > 0 | undefined\" }).onUndeclaredKey(\"reject\");\nfunction validateCursorOptions(cursor, helper) {\n\tif (cursor === void 0) return;\n\tconst result = cursorOptionsSchema(cursor);\n\tif (result instanceof type.errors) throw postgresError(\"RUNTIME.ARGUMENT_INVALID\", \"Invalid cursor option\", {\n\t\twhy: result.summary,\n\t\tfix: \"Pass cursor: {} or cursor: { batchSize: <positive integer> } to read through a server-side cursor, or leave cursor unset to read without one.\",\n\t\tmeta: {\n\t\t\textension: \"postgres\",\n\t\t\thelper,\n\t\t\targument: \"cursor\",\n\t\t\treceived: cursor\n\t\t}\n\t});\n\treturn result;\n}\nfunction toDriverCursorOptions(cursor) {\n\treturn cursor === void 0 ? { disabled: true } : ifDefined(\"batchSize\", cursor.batchSize);\n}\nfunction toRuntimeOptions(options) {\n\treturn {\n\t\t...ifDefined(\"verifyMarker\", options.verifyMarker),\n\t\t...ifDefined(\"middleware\", options.middleware),\n\t\t...ifDefined(\"log\", options.log)\n\t};\n}\n//#endregion\n//#region src/runtime/postgres-runtime.ts\nvar PostgresRuntimeImpl = class extends SqlRuntimeBase {\n\tgetListDecoder() {\n\t\treturn postgresTarget.listDecoder();\n\t}\n};\n//#endregion\nexport { validateCursorOptions as a, isPgPool as c, validatePostgresUrl as d, toRuntimeOptions as i, resolveOptionalPostgresBinding as l, DEFAULT_CONNECT_TIMEOUT_MILLIS as n, buildPostgresRuntimeBoundMembers as o, toDriverCursor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ACD,CAAC,CAAC;GACH,CAAC;EACF;CACD;AACD;;;;;AAOA,MAAM,iCAAiC;AACvC,MAAM,sBAAsB,KAAK,EAAE,cAAc,iCAAiC,CAAC,CAAC,CAAC,gBAAgB,QAAQ;AAC7G,SAAS,sBAAsB,QAAQ,QAAQ;CAC9C,IAAI,WAAW,KAAK,GAAG;CACvB,MAAM,SAAS,oBAAoB,MAAM;CACzC,IAAI,kBAAkB,KAAK,QAAQ,MAAM,cAAc,4BAA4B,yBAAyB;EAC3G,KAAK,OAAO;EACZ,KAAK;EACL,MAAM;GACL,WAAW;GACX;GACA,UAAU;GACV,UAAU;EACX;CACD,CAAC;CACD,OAAO;AACR;AACA,SAAS,sBAAsB,QAAQ;CACtC,OAAO,WAAW,KAAK,IAAI,EAAE,UAAU,KAAK,IAAI,UAAU,aAAa,OAAO,SAAS;AACxF;AACA,SAAS,iBAAiB,SAAS;CAClC,OAAO;EACN,GAAG,UAAU,gBAAgB,QAAQ,YAAY;EACjD,GAAG,UAAU,cAAc,QAAQ,UAAU;EAC7C,GAAG,UAAU,OAAO,QAAQ,GAAG;CAChC;AACD;AAGA,IAAI,sBAAsB,cAAc,eAAe;CACtD,iBAAiB;EAChB,OAAO,eAAe,YAAY;CACnC;AACD"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as buildNamespacedNativeEnums, t as NamespacedNativeEnums } from "./postgres-static-Crd_bF1a-DLqHzv91.mjs";
|
|
2
|
-
import { a as PostgresStaticMembers, i as PostgresRuntimeBoundMembers, n as PostgresExecutionOptions, r as PostgresLifecycleMembers, t as PostgresCursorOptions } from "./postgres-options-
|
|
2
|
+
import { a as PostgresStaticMembers, i as PostgresRuntimeBoundMembers, n as PostgresExecutionOptions, r as PostgresLifecycleMembers, t as PostgresCursorOptions } from "./postgres-options-snwVSiHP-wfK0Xrpa.mjs";
|
|
3
3
|
import { Runtime, SqlRuntimeBase } from "@prisma/orm-family-sql/runtime";
|
|
4
4
|
import { Client, Pool } from "pg";
|
|
5
5
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as postgresError } from "./errors-DfWK9xep-CYOOg0sB.mjs";
|
|
2
|
-
import { a as isPgPool, c as toDriverCursorOptions, i as isPgClient, l as toRuntimeOptions, n as PostgresRuntimeImpl, o as resolveOptionalPostgresBinding, r as buildPostgresRuntimeBoundMembers, s as resolvePostgresBinding, u as validateCursorOptions } from "./postgres-runtime-
|
|
2
|
+
import { a as isPgPool, c as toDriverCursorOptions, i as isPgClient, l as toRuntimeOptions, n as PostgresRuntimeImpl, o as resolveOptionalPostgresBinding, r as buildPostgresRuntimeBoundMembers, s as resolvePostgresBinding, u as validateCursorOptions } from "./postgres-runtime-DnLoEvCj-BZApeGxP.mjs";
|
|
3
3
|
import { n as buildPostgresStaticContext, t as buildNamespacedNativeEnums } from "./postgres-static-DzefaBeX-Cz36Sz8Q.mjs";
|
|
4
4
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
5
5
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/runtime.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { a as validateCursorOptions, c as isPgPool, i as toRuntimeOptions, l as resolveOptionalPostgresBinding, o as buildPostgresRuntimeBoundMembers, r as toDriverCursorOptions, s as isPgClient, t as PostgresRuntimeImpl, u as resolvePostgresBinding } from \"./postgres-runtime-
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/runtime.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { a as validateCursorOptions, c as isPgPool, i as toRuntimeOptions, l as resolveOptionalPostgresBinding, o as buildPostgresRuntimeBoundMembers, r as toDriverCursorOptions, s as isPgClient, t as PostgresRuntimeImpl, u as resolvePostgresBinding } from \"./postgres-runtime-DnLoEvCj.mjs\";\nimport { r as buildNamespacedNativeEnums, t as buildPostgresStaticContext } from \"./postgres-static-DzefaBeX.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport postgresDriver, { suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport { instantiateExecutionStack } from \"@internal/framework-components/execution\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { Pool } from \"pg\";\n//#region src/runtime/postgres.ts\nfunction hasContractJson(options) {\n\treturn \"contractJson\" in options;\n}\nconst contractSerializer = new PostgresContractSerializer();\nfunction resolveContract(options) {\n\tconst contractJson = hasContractJson(options) ? options.contractJson : contractSerializer.serializeContract(options.contract);\n\treturn blindCast(contractSerializer.deserializeContract(contractJson));\n}\nfunction toRuntimeBinding(binding, options) {\n\tif (binding.kind !== \"url\") return binding;\n\treturn {\n\t\tkind: \"pgPool\",\n\t\tpool: suppressIdleConnectionErrors(new Pool({\n\t\t\tconnectionString: binding.url,\n\t\t\tconnectionTimeoutMillis: options.poolOptions?.connectionTimeoutMillis ?? 2e4,\n\t\t\tidleTimeoutMillis: options.poolOptions?.idleTimeoutMillis ?? 3e4\n\t\t}))\n\t};\n}\nfunction postgres(options) {\n\tconst cursor = validateCursorOptions(options.cursor, \"postgres\");\n\tconst contract = resolveContract(options);\n\tlet binding = resolveOptionalPostgresBinding(options);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\tdriver: postgresDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst context = createExecutionContext({\n\t\tcontract,\n\t\tstack,\n\t\tdriver: postgresDriver\n\t});\n\tconst { sql, raw: rawSqlTag, enums, nativeEnums } = buildPostgresStaticContext(context, stack.adapter.rawCodecInferer);\n\tlet runtimeInstance;\n\tlet runtimeDriver;\n\tlet driverConnected = false;\n\tlet connectPromise;\n\tlet backgroundConnectError;\n\tlet closePromise;\n\tlet ownsPool = false;\n\tconst connectDriver = async (resolvedBinding) => {\n\t\tif (driverConnected) return;\n\t\tif (!runtimeDriver) throw new InternalError(\"Postgres runtime driver missing\");\n\t\tif (connectPromise) return connectPromise;\n\t\tconst runtimeBinding = toRuntimeBinding(resolvedBinding, options);\n\t\tconst ownedPool = resolvedBinding.kind === \"url\" && runtimeBinding.kind === \"pgPool\" ? runtimeBinding.pool : void 0;\n\t\tconnectPromise = runtimeDriver.connect(runtimeBinding).then(() => {\n\t\t\tdriverConnected = true;\n\t\t\townsPool = ownedPool !== void 0;\n\t\t}).catch(async (err) => {\n\t\t\tbackgroundConnectError = err;\n\t\t\tconnectPromise = void 0;\n\t\t\tawait ownedPool?.end().catch(() => void 0);\n\t\t\tthrow err;\n\t\t});\n\t\treturn connectPromise;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closePromise !== void 0) throw postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres client is closed\", {\n\t\t\twhy: \"close() was called on this client.\",\n\t\t\tfix: \"Create a new postgres(...) client.\",\n\t\t\tmeta: { extension: \"postgres\" }\n\t\t});\n\t\tif (backgroundConnectError !== void 0) throw backgroundConnectError;\n\t\tif (runtimeInstance) return runtimeInstance;\n\t\tconst stackInstance = instantiateExecutionStack(stack);\n\t\tconst driverDescriptor = stack.driver;\n\t\tif (!driverDescriptor) throw new InternalError(\"Driver descriptor missing from execution stack\");\n\t\tconst driver = driverDescriptor.create({ cursor: toDriverCursorOptions(cursor) });\n\t\truntimeDriver = driver;\n\t\tconst runtime = new PostgresRuntimeImpl({\n\t\t\tcontext,\n\t\t\tadapter: stackInstance.adapter,\n\t\t\tdriver,\n\t\t\t...toRuntimeOptions(options),\n\t\t\tcloseRefusal: \"at-once\"\n\t\t});\n\t\truntimeInstance = runtime;\n\t\tif (binding !== void 0) connectDriver(binding).catch(() => void 0);\n\t\treturn runtime;\n\t};\n\tconst closeOwnedRuntime = async () => {\n\t\tif (!driverConnected) await connectPromise?.catch(() => void 0);\n\t\tif (ownsPool) await runtimeInstance?.close();\n\t};\n\treturn {\n\t\tsql,\n\t\t...buildPostgresRuntimeBoundMembers({\n\t\t\tcontext,\n\t\t\trawCodecInferer: stack.adapter.rawCodecInferer,\n\t\t\tenums,\n\t\t\tnativeEnums,\n\t\t\tgetRuntime,\n\t\t\tgetRuntimeForWork: getRuntime\n\t\t}),\n\t\tenums,\n\t\tnativeEnums,\n\t\traw: rawSqlTag,\n\t\tcontext,\n\t\tcontract,\n\t\tstack,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closePromise !== void 0) throw postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres client is closed\", {\n\t\t\t\twhy: \"close() was called on this client.\",\n\t\t\t\tfix: \"Create a new postgres(...) client.\",\n\t\t\t\tmeta: { extension: \"postgres\" }\n\t\t\t});\n\t\t\tif (driverConnected || connectPromise) throw postgresError(\"DRIVER.ALREADY_CONNECTED\", \"Postgres client already connected\", {\n\t\t\t\tfix: \"Call connect() at most once per client.\",\n\t\t\t\tmeta: { extension: \"postgres\" }\n\t\t\t});\n\t\t\tif (bindingInput !== void 0) binding = resolvePostgresBinding(bindingInput);\n\t\t\tif (binding === void 0) throw postgresError(\"RUNTIME.BINDING_MISSING\", \"Postgres binding not configured. Pass url/pg/binding to postgres(...) or call db.connect({ ... }).\", { meta: { extension: \"postgres\" } });\n\t\t\tconst runtime = getRuntime();\n\t\t\tif (driverConnected) return runtime;\n\t\t\tawait connectDriver(binding);\n\t\t\treturn runtime;\n\t\t},\n\t\tclose() {\n\t\t\tclosePromise ??= closeOwnedRuntime();\n\t\t\treturn closePromise;\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { PostgresRuntimeImpl, buildNamespacedNativeEnums, postgres as default, isPgClient, isPgPool };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,gBAAgB,SAAS;CACjC,OAAO,kBAAkB;AAC1B;AACA,MAAM,qBAAqB,IAAI,2BAA2B;AAC1D,SAAS,gBAAgB,SAAS;CACjC,MAAM,eAAe,gBAAgB,OAAO,IAAI,QAAQ,eAAe,mBAAmB,kBAAkB,QAAQ,QAAQ;CAC5H,OAAO,UAAU,mBAAmB,oBAAoB,YAAY,CAAC;AACtE;AACA,SAAS,iBAAiB,SAAS,SAAS;CAC3C,IAAI,QAAQ,SAAS,OAAO,OAAO;CACnC,OAAO;EACN,MAAM;EACN,MAAM,6BAA6B,IAAI,KAAK;GAC3C,kBAAkB,QAAQ;GAC1B,yBAAyB,QAAQ,aAAa,2BAA2B;GACzE,mBAAmB,QAAQ,aAAa,qBAAqB;EAC9D,CAAC,CAAC;CACH;AACD;AACA,SAAS,SAAS,SAAS;CAC1B,MAAM,SAAS,sBAAsB,QAAQ,QAAQ,UAAU;CAC/D,MAAM,WAAW,gBAAgB,OAAO;CACxC,IAAI,UAAU,+BAA+B,OAAO;CACpD,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,MAAM,UAAU,uBAAuB;EACtC;EACA;EACA,QAAQ;CACT,CAAC;CACD,MAAM,EAAE,KAAK,KAAK,WAAW,OAAO,gBAAgB,2BAA2B,SAAS,MAAM,QAAQ,eAAe;CACrH,IAAI;CACJ,IAAI;CACJ,IAAI,kBAAkB;CACtB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI,WAAW;CACf,MAAM,gBAAgB,OAAO,oBAAoB;EAChD,IAAI,iBAAiB;EACrB,IAAI,CAAC,eAAe,MAAM,IAAI,cAAc,iCA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,QAAQ;GAC/B;GACA;GACA;GACA,mBAAmB;EACpB,CAAC;EACD;EACA;EACA,KAAK;EACL;EACA;EACA;EACA,MAAM,QAAQ,cAAc;GAC3B,IAAI,iBAAiB,KAAK,GAAG,MAAM,cAAc,wBAAwB,6BAA6B;IACrG,KAAK;IACL,KAAK;IACL,MAAM,EAAE,WAAW,WAAW;GAC/B,CAAC;GACD,IAAI,mBAAmB,gBAAgB,MAAM,cAAc,4BAA4B,qCAAqC;IAC3H,KAAK;IACL,MAAM,EAAE,WAAW,WAAW;GAC/B,CAAC;GACD,IAAI,iBAAiB,KAAK,GAAG,UAAU,uBAAuB,YAAY;GAC1E,IAAI,YAAY,KAAK,GAAG,MAAM,cAAc,2BAA2B,sGAAsG,EAAE,MAAM,EAAE,WAAW,WAAW,EAAE,CAAC;GAChN,MAAM,UAAU,WAAW;GAC3B,IAAI,iBAAiB,OAAO;GAC5B,MAAM,cAAc,OAAO;GAC3B,OAAO;EACR;EACA,QAAQ;GACP,iBAAiB,kBAAkB;GACnC,OAAO;EACR;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
|
package/dist/serverless.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as PostgresStaticMembers, i as PostgresRuntimeBoundMembers, n as PostgresExecutionOptions, r as PostgresLifecycleMembers, t as PostgresCursorOptions } from "./postgres-options-
|
|
1
|
+
import { a as PostgresStaticMembers, i as PostgresRuntimeBoundMembers, n as PostgresExecutionOptions, r as PostgresLifecycleMembers, t as PostgresCursorOptions } from "./postgres-options-snwVSiHP-wfK0Xrpa.mjs";
|
|
2
2
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
3
3
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
4
4
|
//#region ../../../3-extensions/postgres/dist/serverless.d.mts
|
package/dist/serverless.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as postgresError } from "./errors-DfWK9xep-CYOOg0sB.mjs";
|
|
2
|
-
import { c as toDriverCursorOptions, d as validatePostgresUrl, l as toRuntimeOptions, n as PostgresRuntimeImpl, r as buildPostgresRuntimeBoundMembers, t as DEFAULT_CONNECT_TIMEOUT_MILLIS, u as validateCursorOptions } from "./postgres-runtime-
|
|
2
|
+
import { c as toDriverCursorOptions, d as validatePostgresUrl, l as toRuntimeOptions, n as PostgresRuntimeImpl, r as buildPostgresRuntimeBoundMembers, t as DEFAULT_CONNECT_TIMEOUT_MILLIS, u as validateCursorOptions } from "./postgres-runtime-DnLoEvCj-BZApeGxP.mjs";
|
|
3
3
|
import { n as buildPostgresStaticContext } from "./postgres-static-DzefaBeX-Cz36Sz8Q.mjs";
|
|
4
4
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
5
5
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
package/dist/serverless.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverless.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/serverless.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { a as validateCursorOptions, d as validatePostgresUrl, i as toRuntimeOptions, n as DEFAULT_CONNECT_TIMEOUT_MILLIS, o as buildPostgresRuntimeBoundMembers, r as toDriverCursorOptions, t as PostgresRuntimeImpl } from \"./postgres-runtime-
|
|
1
|
+
{"version":3,"file":"serverless.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/serverless.mjs"],"sourcesContent":["import { t as postgresError } from \"./errors-DfWK9xep.mjs\";\nimport { a as validateCursorOptions, d as validatePostgresUrl, i as toRuntimeOptions, n as DEFAULT_CONNECT_TIMEOUT_MILLIS, o as buildPostgresRuntimeBoundMembers, r as toDriverCursorOptions, t as PostgresRuntimeImpl } from \"./postgres-runtime-DnLoEvCj.mjs\";\nimport { t as buildPostgresStaticContext } from \"./postgres-static-DzefaBeX.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport postgresDriver, { suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport { instantiateExecutionStack } from \"@internal/framework-components/execution\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { Client } from \"pg\";\nimport { redactDatabaseUrl } from \"@internal/utils/redact-db-url\";\n//#region src/runtime/postgres-serverless.ts\nfunction hasContractJson(options) {\n\treturn \"contractJson\" in options;\n}\nconst contractSerializer = new PostgresContractSerializer();\nfunction resolveContract(options) {\n\tconst contractJson = hasContractJson(options) ? options.contractJson : contractSerializer.serializeContract(options.contract);\n\treturn blindCast(contractSerializer.deserializeContract(contractJson));\n}\nfunction closedConnectionError() {\n\treturn postgresError(\"DRIVER.NOT_CONNECTED\", \"Postgres connection is closed\", {\n\t\twhy: \"close() was called on this connection, or the await using scope that held it has ended.\",\n\t\tfix: \"Call connect({ url }) again to open a new connection.\",\n\t\tmeta: { extension: \"postgres\" }\n\t});\n}\nfunction connectionFailedError(url, cause) {\n\treturn postgresError(\"DRIVER.CONNECTION_FAILED\", \"Database connection failed\", {\n\t\twhy: cause instanceof Error ? cause.message : String(cause),\n\t\tfix: \"Verify the database URL, ensure the database is reachable, and confirm credentials/permissions\",\n\t\tmeta: {\n\t\t\textension: \"postgres\",\n\t\t\t...redactDatabaseUrl(url)\n\t\t},\n\t\tcause\n\t});\n}\nfunction postgresServerless(options) {\n\tconst cursor = validateCursorOptions(options.cursor, \"postgresServerless\");\n\tconst contract = resolveContract(options);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\tdriver: postgresDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst context = createExecutionContext({\n\t\tcontract,\n\t\tstack,\n\t\tdriver: postgresDriver\n\t});\n\tconst rawCodecInferer = stack.adapter.rawCodecInferer;\n\tconst { sql, raw, enums, nativeEnums } = buildPostgresStaticContext(context, rawCodecInferer);\n\tconst buildRuntimeBoundMembers = (getRuntime, getRuntimeForWork) => buildPostgresRuntimeBoundMembers({\n\t\tcontext,\n\t\trawCodecInferer,\n\t\tenums,\n\t\tnativeEnums,\n\t\tgetRuntime,\n\t\tgetRuntimeForWork\n\t});\n\tconst noRuntime = () => {\n\t\tthrow new InternalError(\"The serverless client has no runtime\");\n\t};\n\tbuildRuntimeBoundMembers(noRuntime, noRuntime);\n\tconst createConnection = (runtime) => {\n\t\tlet closing;\n\t\tconst close = () => {\n\t\t\tclosing ??= runtime.close();\n\t\t\treturn closing;\n\t\t};\n\t\tconst runtimeBoundMembers = buildRuntimeBoundMembers(() => {\n\t\t\tif (closing !== void 0) throw closedConnectionError();\n\t\t\treturn runtime;\n\t\t}, () => runtime);\n\t\treturn {\n\t\t\tsql,\n\t\t\traw,\n\t\t\tenums,\n\t\t\tnativeEnums,\n\t\t\tcontext,\n\t\t\tcontract,\n\t\t\tstack,\n\t\t\t...runtimeBoundMembers,\n\t\t\tclose,\n\t\t\t[Symbol.asyncDispose]: close\n\t\t};\n\t};\n\treturn {\n\t\tsql,\n\t\traw,\n\t\tenums,\n\t\tnativeEnums,\n\t\tcontext,\n\t\tstack,\n\t\tcontract,\n\t\tasync connect(binding) {\n\t\t\tconst url = validatePostgresUrl(binding.url);\n\t\t\tconst driverDescriptor = stack.driver;\n\t\t\tif (!driverDescriptor) throw new InternalError(\"Driver descriptor missing from execution stack\");\n\t\t\tconst stackInstance = instantiateExecutionStack(stack);\n\t\t\tconst driver = driverDescriptor.create({ cursor: toDriverCursorOptions(cursor) });\n\t\t\tconst pgClient = suppressIdleConnectionErrors(new Client({\n\t\t\t\tconnectionString: url,\n\t\t\t\tconnectionTimeoutMillis: DEFAULT_CONNECT_TIMEOUT_MILLIS\n\t\t\t}));\n\t\t\tawait driver.connect({\n\t\t\t\tkind: \"pgClient\",\n\t\t\t\tclient: pgClient\n\t\t\t});\n\t\t\tconst runtime = new PostgresRuntimeImpl({\n\t\t\t\tcontext,\n\t\t\t\tadapter: stackInstance.adapter,\n\t\t\t\tdriver,\n\t\t\t\t...toRuntimeOptions(options),\n\t\t\t\tcloseRefusal: \"when-idle\"\n\t\t\t});\n\t\t\tconst connection = createConnection(runtime);\n\t\t\ttry {\n\t\t\t\tawait (await driver.acquireConnection()).release();\n\t\t\t} catch (err) {\n\t\t\t\tpgClient.end().catch(() => void 0);\n\t\t\t\tthrow connectionFailedError(url, err);\n\t\t\t}\n\t\t\treturn connection;\n\t\t}\n\t};\n}\n//#endregion\nexport { postgresServerless as default };\n\n//# sourceMappingURL=serverless.mjs.map"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,gBAAgB,SAAS;CACjC,OAAO,kBAAkB;AAC1B;AACA,MAAM,qBAAqB,IAAI,2BAA2B;AAC1D,SAAS,gBAAgB,SAAS;CACjC,MAAM,eAAe,gBAAgB,OAAO,IAAI,QAAQ,eAAe,mBAAmB,kBAAkB,QAAQ,QAAQ;CAC5H,OAAO,UAAU,mBAAmB,oBAAoB,YAAY,CAAC;AACtE;AACA,SAAS,wBAAwB;CAChC,OAAO,cAAc,wBAAwB,iCAAiC;EAC7E,KAAK;EACL,KAAK;EACL,MAAM,EAAE,WAAW,WAAW;CAC/B,CAAC;AACF;AACA,SAAS,sBAAsB,KAAK,OAAO;CAC1C,OAAO,cAAc,4BAA4B,8BAA8B;EAC9E,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC1D,KAAK;EACL,MAAM;GACL,WAAW;GACX,GAAG,kBAAkB,GAAG;EACzB;EACA;CACD,CAAC;AACF;AACA,SAAS,mBAAmB,SAAS;CACpC,MAAM,SAAS,sBAAsB,QAAQ,QAAQ,oBAAoB;CACzE,MAAM,WAAW,gBAAgB,OAAO;CACxC,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,Q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AAa,iBAAiB,OAAO;GAC3C,IAAI;IACH,OAAO,MAAM,OAAO,kBAAkB,EAAA,CAAG,QAAQ;GAClD,SAAS,KAAK;IACb,SAAS,IAAI,CAAC,CAAC,YAAY,KAAK,CAAC;IACjC,MAAM,sBAAsB,KAAK,GAAG;GACrC;GACA,OAAO;EACR;CACD;AACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-postgres",
|
|
3
|
-
"version": "8.0.0-rc.17-dev.
|
|
3
|
+
"version": "8.0.0-rc.17-dev.36",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"skills"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@prisma/orm-family-sql": "8.0.0-rc.17-dev.
|
|
14
|
-
"@prisma/orm-framework": "8.0.0-rc.17-dev.
|
|
15
|
-
"@prisma/orm-target-postgres": "8.0.0-rc.17-dev.
|
|
16
|
-
"@prisma/orm-toolchain": "8.0.0-rc.17-dev.
|
|
13
|
+
"@prisma/orm-family-sql": "8.0.0-rc.17-dev.36",
|
|
14
|
+
"@prisma/orm-framework": "8.0.0-rc.17-dev.36",
|
|
15
|
+
"@prisma/orm-target-postgres": "8.0.0-rc.17-dev.36",
|
|
16
|
+
"@prisma/orm-toolchain": "8.0.0-rc.17-dev.36",
|
|
17
17
|
"@types/node": "26.1.2",
|
|
18
18
|
"@types/pg": "8.20.4",
|
|
19
19
|
"arktype": "^2.2.2",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"tinyglobby": "^0.2.17"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@internal/postgres": "8.0.0-rc.17-dev.
|
|
26
|
-
"@repo/tsconfig": "8.0.0-rc.17-dev.
|
|
27
|
-
"@repo/tsdown": "8.0.0-rc.17-dev.
|
|
25
|
+
"@internal/postgres": "8.0.0-rc.17-dev.36",
|
|
26
|
+
"@repo/tsconfig": "8.0.0-rc.17-dev.36",
|
|
27
|
+
"@repo/tsdown": "8.0.0-rc.17-dev.36",
|
|
28
28
|
"tsdown": "0.22.14",
|
|
29
29
|
"typescript": "5.9.3"
|
|
30
30
|
},
|
package/skills/prisma-8/SKILL.md
CHANGED
|
@@ -293,7 +293,7 @@ Order matters: `beforeEncode` runs in registration order for every middleware be
|
|
|
293
293
|
|
|
294
294
|
## Workflow — Configure the connection
|
|
295
295
|
|
|
296
|
-
The concept: the runtime takes one of three binding shapes — `url`, `pg` (a pre-constructed `pg.Pool` or `pg.Client`), or `binding` (an explicit kind tag). They're mutually exclusive. The `pg` form is for projects that already manage their own pool (e.g. a Lambda layer); `url` is the default. Pool tuning is `poolOptions.connectionTimeoutMillis` / `poolOptions.idleTimeoutMillis` — *not* `driverOptions`. Reads are buffered by default; setting `cursor` (`{ batchSize: 100 }`; `{}` or `{ batchSize: undefined }` for batches of 100; a `batchSize` that is not a positive integer fails the factory call) makes them stream through a server-side cursor, and there is no flag that turns cursors off (see `references/queries.md` § *Streaming*). `postgresServerless()` takes the same `cursor` option.
|
|
296
|
+
The concept: the runtime takes one of three binding shapes — `url`, `pg` (a pre-constructed `pg.Pool` or `pg.Client`), or `binding` (an explicit kind tag). They're mutually exclusive. The `pg` form is for projects that already manage their own pool (e.g. a Lambda layer); `url` is the default. Pool tuning is `poolOptions.connectionTimeoutMillis` / `poolOptions.idleTimeoutMillis` — *not* `driverOptions`. Reads are buffered by default; setting `cursor` (`{ batchSize: 100 }`; `{}` or `{ batchSize: undefined }` for batches of 100; a `batchSize` that is not a positive integer fails the factory call) makes them stream through a server-side cursor, and there is no flag that turns cursors off (see `references/queries.md` § *Streaming*). `postgresServerless()` takes the same `cursor` option. Pass `log` (an object with `info`, `warn`, `error` and an optional `debug`; `console` works, and the type is `Log` from `@prisma/orm-postgres/family-runtime`) to receive what the runtime logs: the marker-verification warnings `CONTRACT.MARKER_MISSING` and `CONTRACT.MARKER_MISMATCH` from the first query, the warnings `lints()` emits for rules whose severity is `warn`, and the errors a middleware's `activityEnded` or `activityFinalized` hook throws, which the runtime logs and swallows. If `log` has a `debug` method, it also receives debug events, for example when a middleware intercepts a statement. `budgets()` violations never reach `log`: the client runs its runtime in strict mode, so a violation throws, until the client exposes `mode` (TML-3567). Without `log`, the runtime drops these events. `postgresServerless()`, `sqlite()` and `supabase()` take the same option.
|
|
297
297
|
|
|
298
298
|
```typescript
|
|
299
299
|
// Default — URL string, factory constructs the pool.
|
|
@@ -305,6 +305,7 @@ postgres<Contract>({
|
|
|
305
305
|
idleTimeoutMillis: 30_000,
|
|
306
306
|
},
|
|
307
307
|
// cursor: { batchSize: 100 }, // optional — stream reads in batches instead of buffering
|
|
308
|
+
// log: console, // optional — receive marker and lints() warnings
|
|
308
309
|
});
|
|
309
310
|
|
|
310
311
|
// BYO pool — pass a pg.Pool you already created.
|