@prisma/orm-postgres 8.0.0-rc.19-dev.6 → 8.0.0-rc.19-dev.7
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/{contract-from-json-CUkbolId-DHFlcqIL.mjs → contract-from-json-Dr3aG46--C7CPjHDQ.mjs} +3 -3
- package/dist/{contract-from-json-CUkbolId-DHFlcqIL.mjs.map → contract-from-json-Dr3aG46--C7CPjHDQ.mjs.map} +1 -1
- package/dist/internal__static-context.d.mts +2 -0
- package/dist/internal__static-context.mjs +2 -0
- package/dist/internal__transaction-members.d.mts +1 -1
- package/dist/internal__transaction-members.mjs +1 -1
- package/dist/internal__validate-contract.mjs +1 -1
- package/dist/{postgres-members-CWwALshp-gx864rhm.mjs → postgres-members-BuiQxl75-CqxZVzX9.mjs} +9 -15
- package/dist/postgres-members-BuiQxl75-CqxZVzX9.mjs.map +1 -0
- package/dist/{postgres-members-DF6iy9vo-CX7AyWfg.d.mts → postgres-members-Cuvcnuok-BiaFrw1C.d.mts} +7 -7
- package/dist/postgres-members-Cuvcnuok-BiaFrw1C.d.mts.map +1 -0
- package/dist/{postgres-options-DfsyEh5L-BcnZzOBh.d.mts → postgres-options-HIC8ThD0-oCe4XrcH.d.mts} +3 -3
- package/dist/postgres-options-HIC8ThD0-oCe4XrcH.d.mts.map +1 -0
- package/dist/{postgres-runtime-xWysBSgi-DxNjQr30.mjs → postgres-runtime-xWysBSgi-BawBDlwz.mjs} +2 -2
- package/dist/{postgres-runtime-xWysBSgi-DxNjQr30.mjs.map → postgres-runtime-xWysBSgi-BawBDlwz.mjs.map} +1 -1
- package/dist/{postgres-static-Bil-5UL0-DYjYyFrX.d.mts → postgres-static-CGyjvgUc-CbtwmaLk.d.mts} +5 -4
- package/dist/{postgres-static-Bil-5UL0-DYjYyFrX.d.mts.map → postgres-static-CGyjvgUc-CbtwmaLk.d.mts.map} +1 -1
- package/dist/{postgres-static-Dm1bo8Tg-C_xfz4TE.mjs → postgres-static-DAv3kYKr-Ch2c9OEA.mjs} +5 -5
- package/dist/{postgres-static-Dm1bo8Tg-C_xfz4TE.mjs.map → postgres-static-DAv3kYKr-Ch2c9OEA.mjs.map} +1 -1
- package/dist/runtime.d.mts +3 -3
- package/dist/runtime.mjs +7 -6
- package/dist/runtime.mjs.map +1 -1
- package/dist/serverless.d.mts +2 -2
- package/dist/serverless.mjs +7 -7
- package/dist/serverless.mjs.map +1 -1
- package/dist/static.d.mts +1 -1
- package/dist/static.mjs +2 -2
- package/package.json +9 -8
- package/skills/prisma-8/SKILL.md +1 -1
- package/skills/prisma-8/references/supabase.md +3 -3
- package/dist/postgres-members-CWwALshp-gx864rhm.mjs.map +0 -1
- package/dist/postgres-members-DF6iy9vo-CX7AyWfg.d.mts.map +0 -1
- package/dist/postgres-options-DfsyEh5L-BcnZzOBh.d.mts.map +0 -1
package/dist/{contract-from-json-CUkbolId-DHFlcqIL.mjs → contract-from-json-Dr3aG46--C7CPjHDQ.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import postgresTarget, { PostgresContractSerializer } from "@prisma/orm-target-postgres/target/runtime";
|
|
2
2
|
import { validateContractOnce } from "@prisma/orm-framework/contract/validate-once";
|
|
3
|
-
//#region ../../../3-extensions/postgres/dist/contract-from-json-
|
|
4
|
-
var version = "8.0.0-rc.19-dev.
|
|
3
|
+
//#region ../../../3-extensions/postgres/dist/contract-from-json-Dr3aG46-.mjs
|
|
4
|
+
var version = "8.0.0-rc.19-dev.7";
|
|
5
5
|
const serializer = new PostgresContractSerializer();
|
|
6
6
|
const validator = `${postgresTarget.targetId}@${version}`;
|
|
7
7
|
/**
|
|
@@ -30,4 +30,4 @@ function validatePostgresContract(contract) {
|
|
|
30
30
|
//#endregion
|
|
31
31
|
export { validatePostgresContract as n, contractFromJson as t };
|
|
32
32
|
|
|
33
|
-
//# sourceMappingURL=contract-from-json-
|
|
33
|
+
//# sourceMappingURL=contract-from-json-Dr3aG46--C7CPjHDQ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-from-json-
|
|
1
|
+
{"version":3,"file":"contract-from-json-Dr3aG46--C7CPjHDQ.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/contract-from-json-Dr3aG46-.mjs"],"sourcesContent":["import postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { validateContractOnce } from \"@internal/contract/validate-once\";\n//#region package.json\nvar version = \"8.0.0-rc.19-dev.7\";\n//#endregion\n//#region src/static/contract-from-json.ts\nconst serializer = new PostgresContractSerializer();\nconst validator = `${postgresTarget.targetId}@${version}`;\n/**\n* Validates an emitted Postgres `contract.json` and returns it as the contract type the\n* application names, ready to pass to `postgres({ contract })` and the other Postgres clients.\n* Clients built from the result do not validate it again.\n*\n* The returned value's top level is frozen; its nested objects are not. Do not change `json` or the\n* returned value after the call: clients built from the value later do not validate it again.\n*\n* @example\n* ```ts\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* ```\n*/\nfunction contractFromJson(json) {\n\treturn validateContractOnce(json, validator, (input) => serializer.deserializeContract(input));\n}\n/** Validates a contract value for a Postgres client, once per value. */\nfunction validatePostgresContract(contract) {\n\treturn validateContractOnce(contract, validator, () => serializer.deserializeContract(serializer.serializeContract(contract)));\n}\n//#endregion\nexport { validatePostgresContract as n, contractFromJson as t };\n\n//# sourceMappingURL=contract-from-json-Dr3aG46-.mjs.map"],"mappings":";;;AAGA,IAAI,UAAU;AAGd,MAAM,aAAa,IAAI,2BAA2B;AAClD,MAAM,YAAY,GAAG,eAAe,SAAS,GAAG;;;;;;;;;;;;;;;;;AAiBhD,SAAS,iBAAiB,MAAM;CAC/B,OAAO,qBAAqB,MAAM,YAAY,UAAU,WAAW,oBAAoB,KAAK,CAAC;AAC9F;;AAEA,SAAS,yBAAyB,UAAU;CAC3C,OAAO,qBAAqB,UAAU,iBAAiB,WAAW,oBAAoB,WAAW,kBAAkB,QAAQ,CAAC,CAAC;AAC9H"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { o as buildPostgresQueryMembers } from "./postgres-members-
|
|
1
|
+
import { o as buildPostgresQueryMembers } from "./postgres-members-Cuvcnuok-BiaFrw1C.mjs";
|
|
2
2
|
export { buildPostgresQueryMembers };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as buildPostgresQueryMembers } from "./postgres-members-
|
|
1
|
+
import { t as buildPostgresQueryMembers } from "./postgres-members-BuiQxl75-CqxZVzX9.mjs";
|
|
2
2
|
export { buildPostgresQueryMembers };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as validatePostgresContract } from "./contract-from-json-
|
|
1
|
+
import { n as validatePostgresContract } from "./contract-from-json-Dr3aG46--C7CPjHDQ.mjs";
|
|
2
2
|
export { validatePostgresContract };
|
package/dist/{postgres-members-CWwALshp-gx864rhm.mjs → postgres-members-BuiQxl75-CqxZVzX9.mjs}
RENAMED
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
2
2
|
import { activitySource, delegatingActivitySource, withTransaction, withTransactionMembers } from "@prisma/orm-family-sql/runtime";
|
|
3
|
-
import { createRawLane, sql } from "@prisma/orm-family-sql/builder/runtime";
|
|
4
3
|
import { orm, prepareQuery } from "@prisma/orm-family-sql/orm-client";
|
|
5
|
-
//#region ../../../3-extensions/postgres/dist/postgres-members-
|
|
4
|
+
//#region ../../../3-extensions/postgres/dist/postgres-members-BuiQxl75.mjs
|
|
6
5
|
/**
|
|
7
|
-
* Builds the query members of a Postgres transaction over `txCtx`, so every statement they run goes through the transaction. `query` and `execute` are the transaction's own. Preparing sends nothing to the database, so `prepare` uses `prepareRuntime`; the prepared statement runs on the queryable it is given.
|
|
6
|
+
* Builds the query members of a Postgres transaction over `txCtx`, so every statement they run goes through the transaction. `query` and `execute` are the transaction's own; `sql`, `raw` and `toSql` are the client's. Preparing sends nothing to the database, so `prepare` uses `prepareRuntime`; the prepared statement runs on the queryable it is given.
|
|
8
7
|
*/
|
|
9
8
|
function buildPostgresQueryMembers(options, txCtx) {
|
|
10
|
-
const { context, collections,
|
|
9
|
+
const { context, collections, sql, raw, toSql, prepareRuntime } = options;
|
|
11
10
|
return {
|
|
12
11
|
toSql,
|
|
13
|
-
sql
|
|
14
|
-
|
|
15
|
-
rawCodecInferer
|
|
16
|
-
}),
|
|
17
|
-
raw: createRawLane({
|
|
18
|
-
context,
|
|
19
|
-
rawCodecInferer
|
|
20
|
-
}),
|
|
12
|
+
sql,
|
|
13
|
+
raw,
|
|
21
14
|
orm: orm({
|
|
22
15
|
runtime: {
|
|
23
16
|
query(plan) {
|
|
@@ -37,7 +30,7 @@ function buildPostgresQueryMembers(options, txCtx) {
|
|
|
37
30
|
};
|
|
38
31
|
}
|
|
39
32
|
function buildPostgresRuntimeBoundMembers(options) {
|
|
40
|
-
const { context, collections,
|
|
33
|
+
const { context, collections, sql, raw, enums, nativeEnums, toSql, getRuntime, getRuntimeForWork } = options;
|
|
41
34
|
const orm$1 = orm({
|
|
42
35
|
runtime: {
|
|
43
36
|
query(plan) {
|
|
@@ -75,7 +68,8 @@ function buildPostgresRuntimeBoundMembers(options) {
|
|
|
75
68
|
...buildPostgresQueryMembers({
|
|
76
69
|
context,
|
|
77
70
|
collections,
|
|
78
|
-
|
|
71
|
+
sql,
|
|
72
|
+
raw,
|
|
79
73
|
toSql,
|
|
80
74
|
prepareRuntime: getRuntimeForWork
|
|
81
75
|
}, txCtx),
|
|
@@ -89,4 +83,4 @@ function buildPostgresRuntimeBoundMembers(options) {
|
|
|
89
83
|
//#endregion
|
|
90
84
|
export { buildPostgresRuntimeBoundMembers as n, buildPostgresQueryMembers as t };
|
|
91
85
|
|
|
92
|
-
//# sourceMappingURL=postgres-members-
|
|
86
|
+
//# sourceMappingURL=postgres-members-BuiQxl75-CqxZVzX9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-members-BuiQxl75-CqxZVzX9.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-members-BuiQxl75.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { activitySource, delegatingActivitySource, withTransaction, withTransactionMembers } from \"@internal/sql-runtime\";\nimport { orm, prepareQuery } from \"@internal/sql-orm-client\";\n//#region src/runtime/postgres-members.ts\n/**\n* Builds the query members of a Postgres transaction over `txCtx`, so every statement they run goes through the transaction. `query` and `execute` are the transaction's own; `sql`, `raw` and `toSql` are the client's. Preparing sends nothing to the database, so `prepare` uses `prepareRuntime`; the prepared statement runs on the queryable it is given.\n*/\nfunction buildPostgresQueryMembers(options, txCtx) {\n\tconst { context, collections, sql, raw, toSql, prepareRuntime } = options;\n\treturn {\n\t\ttoSql,\n\t\tsql,\n\t\traw,\n\t\torm: orm({\n\t\t\truntime: {\n\t\t\t\tquery(plan) {\n\t\t\t\t\treturn txCtx.query(plan);\n\t\t\t\t},\n\t\t\t\texecute(plan) {\n\t\t\t\t\treturn txCtx.execute(plan);\n\t\t\t\t},\n\t\t\t\t[activitySource]: delegatingActivitySource(() => txCtx)\n\t\t\t},\n\t\t\tcontext,\n\t\t\t...ifDefined(\"collections\", collections)\n\t\t}),\n\t\tprepare(declaration, callback) {\n\t\t\treturn prepareQuery(prepareRuntime(), declaration, callback);\n\t\t}\n\t};\n}\nfunction buildPostgresRuntimeBoundMembers(options) {\n\tconst { context, collections, sql, raw, enums, nativeEnums, toSql, 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\t[activitySource]: delegatingActivitySource(() => getRuntimeForWork())\n\t\t},\n\t\tcontext,\n\t\t...ifDefined(\"collections\", collections)\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\tquery(plan, execOptions) {\n\t\t\treturn getRuntimeForWork().query(plan, execOptions);\n\t\t},\n\t\texecute(plan, execOptions) {\n\t\t\treturn getRuntimeForWork().execute(plan, execOptions);\n\t\t},\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\treturn fn(withTransactionMembers(txCtx, {\n\t\t\t\t\t...buildPostgresQueryMembers({\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tcollections,\n\t\t\t\t\t\tsql,\n\t\t\t\t\t\traw,\n\t\t\t\t\t\ttoSql,\n\t\t\t\t\t\tprepareRuntime: getRuntimeForWork\n\t\t\t\t\t}, txCtx),\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\nexport { buildPostgresRuntimeBoundMembers as n, buildPostgresQueryMembers as t };\n\n//# sourceMappingURL=postgres-members-BuiQxl75.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,0BAA0B,SAAS,OAAO;CAClD,MAAM,EAAE,SAAS,aAAa,KAAK,KAAK,OAAO,mBAAmB;CAClE,OAAO;EACN;EACA;EACA;EACA,KAAK,IAAI;GACR,SAAS;IACR,MAAM,MAAM;KACX,OAAO,MAAM,MAAM,IAAI;IACxB;IACA,QAAQ,MAAM;KACb,OAAO,MAAM,QAAQ,IAAI;IAC1B;KACC,iBAAiB,+BAA+B,KAAK;GACvD;GACA;GACA,GAAG,UAAU,eAAe,WAAW;EACxC,CAAC;EACD,QAAQ,aAAa,UAAU;GAC9B,OAAO,aAAa,eAAe,GAAG,aAAa,QAAQ;EAC5D;CACD;AACD;AACA,SAAS,iCAAiC,SAAS;CAClD,MAAM,EAAE,SAAS,aAAa,KAAK,KAAK,OAAO,aAAa,OAAO,YAAY,sBAAsB;CACrG,MAAM,QAAQ,IAAI;EACjB,SAAS;GACR,MAAM,MAAM;IACX,OAAO,kBAAkB,CAAC,CAAC,MAAM,IAAI;GACtC;GACA,QAAQ,MAAM;IACb,OAAO,kBAAkB,CAAC,CAAC,QAAQ,IAAI;GACxC;GACA,aAAa;IACZ,OAAO,kBAAkB,CAAC,CAAC,WAAW;GACvC;IACC,iBAAiB,+BAA+B,kBAAkB,CAAC;EACrE;EACA;EACA,GAAG,UAAU,eAAe,WAAW;CACxC,CAAC;CACD,SAAS,QAAQ,aAAa,UAAU;EACvC,OAAO,aAAa,kBAAkB,GAAG,aAAa,QAAQ;CAC/D;CACA,OAAO;EACN,KAAK;EACL,MAAM,MAAM,aAAa;GACxB,OAAO,kBAAkB,CAAC,CAAC,MAAM,MAAM,WAAW;EACnD;EACA,QAAQ,MAAM,aAAa;GAC1B,OAAO,kBAAkB,CAAC,CAAC,QAAQ,MAAM,WAAW;EACrD;EACA,UAAU;GACT,OAAO,WAAW;EACnB;EACA;EACA,YAAY,IAAI;GACf,OAAO,gBAAgB,kBAAkB,IAAI,UAAU;IACtD,OAAO,GAAG,uBAAuB,OAAO;KACvC,GAAG,0BAA0B;MAC5B;MACA;MACA;MACA;MACA;MACA,gBAAgB;KACjB,GAAG,KAAK;KACR;KACA;IACD,CAAC,CAAC;GACH,CAAC;EACF;CACD;AACD"}
|
package/dist/{postgres-members-DF6iy9vo-CX7AyWfg.d.mts → postgres-members-Cuvcnuok-BiaFrw1C.d.mts}
RENAMED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { n as PostgresStaticContext, r as PostgresTargetId, t as NamespacedNativeEnums } from "./postgres-static-
|
|
1
|
+
import { n as PostgresStaticContext, r as PostgresTargetId, t as NamespacedNativeEnums } from "./postgres-static-CGyjvgUc-CbtwmaLk.mjs";
|
|
2
|
+
import { NamespacedEnums } from "@prisma/orm-framework/contract/enum-accessor";
|
|
2
3
|
import { ExecutionContext, Runtime, SqlExecutionStackWithDriver, ToSqlMember, TransactionContext } from "@prisma/orm-family-sql/runtime";
|
|
3
4
|
import { CollectionClasses, NoCollectionClasses, PrepareMember, orm } from "@prisma/orm-family-sql/orm-client";
|
|
4
|
-
import { NamespacedEnums } from "@prisma/orm-framework/contract/enum-accessor";
|
|
5
5
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
6
6
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
7
7
|
import { Db, RawLane } from "@prisma/orm-family-sql/builder/types";
|
|
8
|
-
import { RawCodecInferer } from "@prisma/orm-family-sql/relational-core/expression";
|
|
9
8
|
import { RuntimeScope } from "@prisma/orm-family-sql/relational-core/types";
|
|
10
|
-
//#region ../../../3-extensions/postgres/dist/postgres-members-
|
|
9
|
+
//#region ../../../3-extensions/postgres/dist/postgres-members-Cuvcnuok.d.mts
|
|
11
10
|
//#region src/runtime/postgres-members.d.ts
|
|
12
11
|
type OrmClient<TContract extends Contract<SqlStorage>, TCollections extends CollectionClasses> = ReturnType<typeof orm<TContract, TCollections>>;
|
|
13
12
|
/** The query members of a Postgres client, which its transactions and Supabase's role-bound clients offer with the same types. */
|
|
@@ -23,12 +22,13 @@ interface PostgresTransactionContext<TContract extends Contract<SqlStorage>, TCo
|
|
|
23
22
|
interface PostgresQueryMembersOptions<TContract extends Contract<SqlStorage>, TCollections extends CollectionClasses> {
|
|
24
23
|
readonly context: ExecutionContext<TContract>;
|
|
25
24
|
readonly collections: TCollections | undefined;
|
|
26
|
-
readonly
|
|
25
|
+
readonly sql: Db<TContract>;
|
|
26
|
+
readonly raw: RawLane<TContract>;
|
|
27
27
|
readonly toSql: ToSqlMember['toSql'];
|
|
28
28
|
readonly prepareRuntime: () => Runtime;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* Builds the query members of a Postgres transaction over `txCtx`, so every statement they run goes through the transaction. `query` and `execute` are the transaction's own. Preparing sends nothing to the database, so `prepare` uses `prepareRuntime`; the prepared statement runs on the queryable it is given.
|
|
31
|
+
* Builds the query members of a Postgres transaction over `txCtx`, so every statement they run goes through the transaction. `query` and `execute` are the transaction's own; `sql`, `raw` and `toSql` are the client's. Preparing sends nothing to the database, so `prepare` uses `prepareRuntime`; the prepared statement runs on the queryable it is given.
|
|
32
32
|
*/
|
|
33
33
|
declare function buildPostgresQueryMembers<TContract extends Contract<SqlStorage>, TCollections extends CollectionClasses>(options: PostgresQueryMembersOptions<TContract, TCollections>, txCtx: TransactionContext): Omit<PostgresQueryMembers<TContract, TCollections>, keyof RuntimeScope>;
|
|
34
34
|
interface PostgresStaticMembers<TContract extends Contract<SqlStorage>> extends PostgresStaticContext<TContract> {
|
|
@@ -45,4 +45,4 @@ interface PostgresLifecycleMembers {
|
|
|
45
45
|
}
|
|
46
46
|
//#endregion
|
|
47
47
|
export { PostgresTransactionContext as a, PostgresStaticMembers as i, PostgresQueryMembers as n, buildPostgresQueryMembers as o, PostgresRuntimeBoundMembers as r, PostgresLifecycleMembers as t };
|
|
48
|
-
//# sourceMappingURL=postgres-members-
|
|
48
|
+
//# sourceMappingURL=postgres-members-Cuvcnuok-BiaFrw1C.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-members-Cuvcnuok-BiaFrw1C.d.mts","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-members-Cuvcnuok.d.mts"],"mappings":";;;;;;;;;;KASK,UAAU,kBAAkB,SAAS,aAAa,qBAAqB,qBAAqB,kBAAkB,IAAI,WAAW;;UAExH,qBAAqB,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,cAAc,YAAY,cAAc;WAC1K,KAAK,GAAG;WACR,KAAK,UAAU,WAAW;WAC1B,KAAK,QAAQ;;UAEd,2BAA2B,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,oBAAoB,qBAAqB,WAAW;WAC5L,OAAO,gBAAgB;WACvB,aAAa,sBAAsB;;UAEpC,4BAA4B,kBAAkB,SAAS,aAAa,qBAAqB;WACxF,SAAS,iBAAiB;WAC1B,aAAa;WACb,KAAK,GAAG;WACR,KAAK,QAAQ;WACb,OAAO;WACP,sBAAsB;;;;;iBAKhB,0BAA0B,kBAAkB,SAAS,aAAa,qBAAqB,mBAAmB,SAAS,4BAA4B,WAAW,eAAe,OAAO,qBAAqB,KAAK,qBAAqB,WAAW,qBAAqB;UACtQ,sBAAsB,kBAAkB,SAAS,qBAAqB,sBAAsB;WAC3F,OAAO,4BAA4B;;UAEpC,4BAA4B,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,cAAc;WACvJ,KAAK,UAAU,WAAW;EACnC,WAAW;EACX,YAAY,GAAG,KAAK,IAAI,2BAA2B,WAAW,kBAAkB,YAAY,KAAK,QAAQ;;UAEjG;EACR,SAAS;GACR,OAAO,iBAAiB"}
|
package/dist/{postgres-options-DfsyEh5L-BcnZzOBh.d.mts → postgres-options-HIC8ThD0-oCe4XrcH.d.mts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as PostgresTargetId } from "./postgres-static-
|
|
1
|
+
import { r as PostgresTargetId } from "./postgres-static-CGyjvgUc-CbtwmaLk.mjs";
|
|
2
2
|
import { Log, RuntimeMode, SqlMiddleware, SqlRuntimeExtensionDescriptor, VerifyMarkerOption } from "@prisma/orm-family-sql/runtime";
|
|
3
3
|
import "@prisma/orm-target-postgres/driver/runtime";
|
|
4
|
-
//#region ../../../3-extensions/postgres/dist/postgres-options-
|
|
4
|
+
//#region ../../../3-extensions/postgres/dist/postgres-options-HIC8ThD0.d.mts
|
|
5
5
|
//#region src/runtime/postgres-options.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Server-side cursor for reads. Unset reads the whole result before the first row; set streams
|
|
@@ -25,4 +25,4 @@ interface PostgresExecutionOptions {
|
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
export { PostgresExecutionOptions as n, PostgresCursorOptions as t };
|
|
28
|
-
//# sourceMappingURL=postgres-options-
|
|
28
|
+
//# sourceMappingURL=postgres-options-HIC8ThD0-oCe4XrcH.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-options-HIC8ThD0-oCe4XrcH.d.mts","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-options-HIC8ThD0.d.mts"],"mappings":";;;;;;;;;;UASU;WACC;;;;;;UAMD;WACC,sBAAsB,8BAA8B;WACpD,sBAAsB;WACtB,eAAe;WACf,MAAM;WACN,SAAS;WACT,OAAO"}
|
package/dist/{postgres-runtime-xWysBSgi-DxNjQr30.mjs → postgres-runtime-xWysBSgi-BawBDlwz.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as postgresError } from "./errors-DfWK9xep-CYOOg0sB.mjs";
|
|
2
2
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
3
3
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
4
|
-
import { SqlRuntimeBase } from "@prisma/orm-family-sql/runtime";
|
|
5
4
|
import postgresTarget from "@prisma/orm-target-postgres/target/runtime";
|
|
6
5
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
6
|
+
import { SqlRuntimeBase } from "@prisma/orm-family-sql/runtime";
|
|
7
7
|
import { type } from "arktype";
|
|
8
8
|
//#region ../../../3-extensions/postgres/dist/postgres-runtime-xWysBSgi.mjs
|
|
9
9
|
const isPgPool = (pg) => "totalCount" in pg && "idleCount" in pg && "waitingCount" in pg;
|
|
@@ -105,4 +105,4 @@ var PostgresRuntimeImpl = class extends SqlRuntimeBase {
|
|
|
105
105
|
//#endregion
|
|
106
106
|
export { resolveOptionalPostgresBinding as a, toRuntimeOptions as c, isPgPool as i, validateCursorOptions as l, PostgresRuntimeImpl as n, resolvePostgresBinding as o, isPgClient as r, toDriverCursorOptions as s, DEFAULT_CONNECT_TIMEOUT_MILLIS as t, validatePostgresUrl as u };
|
|
107
107
|
|
|
108
|
-
//# sourceMappingURL=postgres-runtime-xWysBSgi-
|
|
108
|
+
//# sourceMappingURL=postgres-runtime-xWysBSgi-BawBDlwz.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-runtime-xWysBSgi-
|
|
1
|
+
{"version":3,"file":"postgres-runtime-xWysBSgi-BawBDlwz.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-runtime-xWysBSgi.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 } from \"@internal/utils/casts\";\nimport { SqlRuntimeBase } from \"@internal/sql-runtime\";\nimport postgresTarget from \"@internal/target-postgres/runtime\";\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-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\t...ifDefined(\"mode\", options.mode)\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, resolveOptionalPostgresBinding as c, toRuntimeOptions as i, resolvePostgresBinding as l, DEFAULT_CONNECT_TIMEOUT_MILLIS as n, isPgClient as o, toDriverCursorOptions as r, isPgPool as s, PostgresRuntimeImpl as t, validatePostgresUrl as u };\n\n//# sourceMappingURL=postgres-runtime-xWysBSgi.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,YAAY,OAAO,gBAAgB,MAAM,eAAe,MAAM,kBAAkB;AACtF,MAAM,cAAc,OAAO,sBAAsB,MAAM,mBAAmB;AAC1E,SAAS,oBAAoB,KAAK;CACjC,MAAM,UAAU,IAAI,KAAK;CACzB,IAAI,QAAQ,WAAW,GAAG,MAAM,cAAc,2BAA2B,2CAA2C,EAAE,MAAM;EAC3H,WAAW;EACX,QAAQ;CACT,EAAE,CAAC;CACH,IAAI;CACJ,IAAI;EACH,SAAS,IAAI,IAAI,OAAO;CACzB,QAAQ;EACP,MAAM,cAAc,2BAA2B,oCAAoC,EAAE,MAAM;GAC1F,WAAW;GACX,QAAQ;EACT,EAAE,CAAC;CACJ;CACA,IAAI,OAAO,aAAa,eAAe,OAAO,aAAa,eAAe,MAAM,cAAc,2BAA2B,sDAAsD,EAAE,MAAM;EACtL,WAAW;EACX,QAAQ;EACR,UAAU,OAAO;CAClB,EAAE,CAAC;CACH,OAAO;AACR;AACA,SAAS,uBAAuB,SAAS;CACxC,IAAI,OAAO,QAAQ,YAAY,KAAK,CAAC,IAAI,OAAO,QAAQ,QAAQ,KAAK,CAAC,IAAI,OAAO,QAAQ,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,cAAc,2BAA2B,kDAAkD;EAC/M,KAAK;EACL,MAAM;GACL,WAAW;GACX,QAAQ;EACT;CACD,CAAC;CACD,IAAI,QAAQ,YAAY,KAAK,GAAG,OAAO,QAAQ;CAC/C,IAAI,QAAQ,QAAQ,KAAK,GAAG,OAAO;EAClC,MAAM;EACN,KAAK,oBAAoB,QAAQ,GAAG;CACrC;CACA,MAAM,YAAY,QAAQ;CAC1B,IAAI,cAAc,KAAK,GAAG,MAAM,IAAI,cAAc,2DAA2D;CAC7G,IAAI,SAAS,SAAS,GAAG,OAAO;EAC/B,MAAM;EACN,MAAM;CACP;CACA,IAAI,WAAW,SAAS,GAAG,OAAO;EACjC,MAAM;EACN,QAAQ;CACT;CACA,MAAM,cAAc,2BAA2B,qFAAqF;EACnI,KAAK;EACL,MAAM;GACL,WAAW;GACX,QAAQ;EACT;CACD,CAAC;AACF;AACA,SAAS,+BAA+B,SAAS;CAChD,IAAI,OAAO,QAAQ,YAAY,KAAK,CAAC,IAAI,OAAO,QAAQ,QAAQ,KAAK,CAAC,IAAI,OAAO,QAAQ,OAAO,KAAK,CAAC,MAAM,GAAG;CAC/G,OAAO,uBAAuB,UAAU,OAAO,CAAC;AACjD;;;;;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;EAC/B,GAAG,UAAU,QAAQ,QAAQ,IAAI;CAClC;AACD;AAGA,IAAI,sBAAsB,cAAc,eAAe;CACtD,iBAAiB;EAChB,OAAO,eAAe,YAAY;CACnC;AACD"}
|
package/dist/{postgres-static-Bil-5UL0-DYjYyFrX.d.mts → postgres-static-CGyjvgUc-CbtwmaLk.d.mts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ExecutionContext, SqlRuntimeExtensionDescriptor, ToSqlMember } from "@prisma/orm-family-sql/runtime";
|
|
2
1
|
import { EnumAccessor, EnumEntriesToAccessors, NamespacedEnums } from "@prisma/orm-framework/contract/enum-accessor";
|
|
2
|
+
import { ExecutionContext, SqlExecutionStackWithDriver, SqlRuntimeExtensionDescriptor, ToSqlMember } from "@prisma/orm-family-sql/runtime";
|
|
3
3
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
4
4
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
5
5
|
import { Db, RawLane } from "@prisma/orm-family-sql/builder/types";
|
|
6
|
-
//#region ../../../3-extensions/postgres/dist/postgres-static-
|
|
6
|
+
//#region ../../../3-extensions/postgres/dist/postgres-static-CGyjvgUc.d.mts
|
|
7
7
|
//#region src/runtime/native-enums.d.ts
|
|
8
8
|
declare function buildNamespacedNativeEnums(storage: SqlStorage, domain: Contract['domain']): Record<string, Record<string, EnumAccessor>>;
|
|
9
9
|
type Present<T> = Exclude<T, undefined>;
|
|
@@ -49,6 +49,7 @@ interface PostgresStaticContext<TContract extends Contract<SqlStorage>> extends
|
|
|
49
49
|
readonly sql: Db<TContract>;
|
|
50
50
|
readonly raw: RawLane<TContract>;
|
|
51
51
|
}
|
|
52
|
+
declare function buildPostgresStaticContext<TContract extends Contract<SqlStorage>>(contract: TContract, context: ExecutionContext<TContract>, stack: SqlExecutionStackWithDriver<PostgresTargetId>): PostgresStaticContext<TContract>;
|
|
52
53
|
/**
|
|
53
54
|
* The query surfaces of a Postgres client without a driver: `sql`, `raw`, `enums`, `nativeEnums`
|
|
54
55
|
* and `toSql`. Use it where loading `pg` is not wanted, for example in browser code that reads
|
|
@@ -64,5 +65,5 @@ declare function postgresStatic<TContract extends Contract<SqlStorage>>(options:
|
|
|
64
65
|
readonly extensions?: readonly SqlRuntimeExtensionDescriptor<PostgresTargetId>[];
|
|
65
66
|
}): PostgresStaticContext<TContract>;
|
|
66
67
|
//#endregion
|
|
67
|
-
export {
|
|
68
|
-
//# sourceMappingURL=postgres-static-
|
|
68
|
+
export { buildPostgresStaticContext as a, buildNamespacedNativeEnums as i, PostgresStaticContext as n, postgresStatic as o, PostgresTargetId as r, NamespacedNativeEnums as t };
|
|
69
|
+
//# sourceMappingURL=postgres-static-CGyjvgUc-CbtwmaLk.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-static-
|
|
1
|
+
{"version":3,"file":"postgres-static-CGyjvgUc-CbtwmaLk.d.mts","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-static-CGyjvgUc.d.mts"],"mappings":";;;;;;;iBAMiB,2BAA2B,SAAS,YAAY,QAAQ,qBAAqB,eAAe,eAAe;KACvH,QAAQ,KAAK,QAAQ;KACrB,yBAAyB,OAAO;WAC1B;aACE,iBAAiB;;oBAEV,IAAI,uBAAuB,QAAQ,KAAK;KACvD;WACM;;KAEN,gBAAgB,iDAAiD,WAAW;WACtE,MAAM,QAAQ,OAAO;WACrB,OAAO,OAAO;;;;;;;;KAQpB,oBAAoB,cAAc;WAC5B,SAAS,gBAAgB;;KAE/B,6BAA6B,SAAS,+BAA+B,WAAW,WAAW,QAAQ,GAAG,mBAAmB,QAAQ,WAAW,gBAAgB,oBAAoB,QAAQ;KACxL,gBAAgB,kBAAkB,UAAU,MAAM,iBAAiB,oCAAoC,kCAAkC;WACnI,aAAa;yBACC,QAAQ,mBAAmB,QAAQ;;;;KAIvD,sBAAsB,kBAAkB,wBAAwB,YAAY,qCAAqC,uBAAuB,6BAA6B,yBAAyB,mCAAmC,MAAM,gBAAgB,WAAW;;;KAGlQ;;;UAGK,sBAAsB,kBAAkB,SAAS,qBAAqB;WACrE,SAAS,iBAAiB;WAC1B,UAAU;WACV,OAAO,gBAAgB;WACvB,aAAa,sBAAsB;WACnC,KAAK,GAAG;WACR,KAAK,QAAQ;;iBAEP,2BAA2B,kBAAkB,SAAS,aAAa,UAAU,WAAW,SAAS,iBAAiB,YAAY,OAAO,4BAA4B,oBAAoB,sBAAsB;;;;;;;;;;;iBAW3M,eAAe,kBAAkB,SAAS,aAAa;WAC7D,UAAU;WACV,sBAAsB,8BAA8B;IAC3D,sBAAsB"}
|
package/dist/{postgres-static-Dm1bo8Tg-C_xfz4TE.mjs → postgres-static-DAv3kYKr-Ch2c9OEA.mjs}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as validatePostgresContract } from "./contract-from-json-
|
|
1
|
+
import { n as validatePostgresContract } from "./contract-from-json-Dr3aG46--C7CPjHDQ.mjs";
|
|
2
2
|
import { PG_ENUM_CODEC_ID } from "@prisma/orm-target-postgres/target/codec-ids";
|
|
3
|
-
import { createExecutionContext, createSqlExecutionStack, createToSql } from "@prisma/orm-family-sql/runtime";
|
|
4
|
-
import { createRawLane, sql } from "@prisma/orm-family-sql/builder/runtime";
|
|
5
3
|
import postgresTarget from "@prisma/orm-target-postgres/target/runtime";
|
|
6
4
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
7
5
|
import { buildNamespacedEnums, createEnumAccessor } from "@prisma/orm-framework/contract/enum-accessor";
|
|
8
6
|
import postgresAdapter from "@prisma/orm-target-postgres/adapter/runtime";
|
|
9
|
-
|
|
7
|
+
import { createExecutionContext, createSqlExecutionStack, createToSql } from "@prisma/orm-family-sql/runtime";
|
|
8
|
+
import { createRawLane, sql } from "@prisma/orm-family-sql/builder/runtime";
|
|
9
|
+
//#region ../../../3-extensions/postgres/dist/postgres-static-DAv3kYKr.mjs
|
|
10
10
|
/**
|
|
11
11
|
* The accessors for one namespace's value sets, leaving out each value set whose name is a domain enum's in the same namespace: a domain enum's value set takes its enum's name and namespace, and `db.enums` holds that enum. The rest are native enum types, because `native_enum` is the only pack entity that derives a value set today. Reads plain contract data, so a `validateContract`'d JSON contract works as well as a hydrated one. A member is a value, as in `CREATE TYPE … AS ENUM ('a', 'b')`, so each value is also its own name.
|
|
12
12
|
*/
|
|
@@ -77,4 +77,4 @@ function postgresStatic(options) {
|
|
|
77
77
|
//#endregion
|
|
78
78
|
export { buildPostgresStaticContext as n, postgresStatic as r, buildNamespacedNativeEnums as t };
|
|
79
79
|
|
|
80
|
-
//# sourceMappingURL=postgres-static-
|
|
80
|
+
//# sourceMappingURL=postgres-static-DAv3kYKr-Ch2c9OEA.mjs.map
|
package/dist/{postgres-static-Dm1bo8Tg-C_xfz4TE.mjs.map → postgres-static-DAv3kYKr-Ch2c9OEA.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-static-
|
|
1
|
+
{"version":3,"file":"postgres-static-DAv3kYKr-Ch2c9OEA.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-static-DAv3kYKr.mjs"],"sourcesContent":["import { n as validatePostgresContract } from \"./contract-from-json-Dr3aG46-.mjs\";\nimport { PG_ENUM_CODEC_ID } from \"@internal/target-postgres/codec-ids\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { buildNamespacedEnums, createEnumAccessor } from \"@internal/contract/enum-accessor\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport { createExecutionContext, createSqlExecutionStack, createToSql } from \"@internal/sql-runtime\";\nimport postgresTarget from \"@internal/target-postgres/runtime\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\n//#region src/runtime/native-enums.ts\n/**\n* The accessors for one namespace's value sets, leaving out each value set whose name is a domain enum's in the same namespace: a domain enum's value set takes its enum's name and namespace, and `db.enums` holds that enum. The rest are native enum types, because `native_enum` is the only pack entity that derives a value set today. Reads plain contract data, so a `validateContract`'d JSON contract works as well as a hydrated one. A member is a value, as in `CREATE TYPE … AS ENUM ('a', 'b')`, so each value is also its own name.\n*/\nfunction buildNativeEnumsMapForNamespace(storage, domain, namespaceId) {\n\tconst result = {};\n\tconst valueSets = storage.namespaces[namespaceId]?.entries.valueSet;\n\tif (!valueSets) return result;\n\tconst domainEnums = domain.namespaces[namespaceId]?.enum ?? {};\n\tfor (const [name, valueSet] of Object.entries(valueSets)) {\n\t\tif (Object.hasOwn(domainEnums, name)) continue;\n\t\tresult[name] = createEnumAccessor({\n\t\t\tcodecId: PG_ENUM_CODEC_ID,\n\t\t\tmembers: valueSet.values.map((value) => ({\n\t\t\t\tname: String(value),\n\t\t\t\tvalue\n\t\t\t}))\n\t\t});\n\t}\n\treturn result;\n}\nfunction buildNamespacedNativeEnums(storage, domain) {\n\tconst result = {};\n\tfor (const namespaceId of Object.keys(storage.namespaces)) result[namespaceId] = buildNativeEnumsMapForNamespace(storage, domain, namespaceId);\n\treturn result;\n}\n//#endregion\n//#region src/static/postgres-static.ts\nfunction buildPostgresStaticContext(contract, context, stack) {\n\tconst { rawCodecInferer } = stack.adapter;\n\tconst sqlDb = sql({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\tconst raw = createRawLane({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\treturn {\n\t\tcontext,\n\t\tcontract,\n\t\tenums: Object.freeze(buildNamespacedEnums(context.contract.domain, (codecId) => context.contractCodecs.forCodecRef({ codecId }))),\n\t\tnativeEnums: blindCast(Object.freeze(buildNamespacedNativeEnums(context.contract.storage, context.contract.domain))),\n\t\tsql: sqlDb,\n\t\traw,\n\t\ttoSql: createToSql(stack, contract)\n\t};\n}\n/**\n* The query surfaces of a Postgres client without a driver: `sql`, `raw`, `enums`, `nativeEnums`\n* and `toSql`. Use it where loading `pg` is not wanted, for example in browser code that reads\n* enums.\n*\n* @example\n* ```ts\n* const { enums } = postgresStatic({ contract: contractFromJson<Contract>(contractJson) });\n* ```\n*/\nfunction postgresStatic(options) {\n\tconst contract = validatePostgresContract(options.contract);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildPostgresStaticContext(contract, createExecutionContext({\n\t\tcontract,\n\t\tstack\n\t}), stack);\n}\n//#endregion\nexport { postgresStatic as n, buildNamespacedNativeEnums as r, buildPostgresStaticContext as t };\n\n//# sourceMappingURL=postgres-static-DAv3kYKr.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,gCAAgC,SAAS,QAAQ,aAAa;CACtE,MAAM,SAAS,CAAC;CAChB,MAAM,YAAY,QAAQ,WAAW,YAAY,EAAE,QAAQ;CAC3D,IAAI,CAAC,WAAW,OAAO;CACvB,MAAM,cAAc,OAAO,WAAW,YAAY,EAAE,QAAQ,CAAC;CAC7D,KAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,SAAS,GAAG;EACzD,IAAI,OAAO,OAAO,aAAa,IAAI,GAAG;EACtC,OAAO,QAAQ,mBAAmB;GACjC,SAAS;GACT,SAAS,SAAS,OAAO,KAAK,WAAW;IACxC,MAAM,OAAO,KAAK;IAClB;GACD,EAAE;EACH,CAAC;CACF;CACA,OAAO;AACR;AACA,SAAS,2BAA2B,SAAS,QAAQ;CACpD,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,eAAe,OAAO,KAAK,QAAQ,UAAU,GAAG,OAAO,eAAe,gCAAgC,SAAS,QAAQ,WAAW;CAC7I,OAAO;AACR;AAGA,SAAS,2BAA2B,UAAU,SAAS,OAAO;CAC7D,MAAM,EAAE,oBAAoB,MAAM;CAClC,MAAM,QAAQ,IAAI;EACjB;EACA;CACD,CAAC;CACD,MAAM,MAAM,cAAc;EACzB;EACA;CACD,CAAC;CACD,OAAO;EACN;EACA;EACA,OAAO,OAAO,OAAO,qBAAqB,QAAQ,SAAS,SAAS,YAAY,QAAQ,eAAe,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;EAChI,aAAa,UAAU,OAAO,OAAO,2BAA2B,QAAQ,SAAS,SAAS,QAAQ,SAAS,MAAM,CAAC,CAAC;EACnH,KAAK;EACL;EACA,OAAO,YAAY,OAAO,QAAQ;CACnC;AACD;;;;;;;;;;;AAWA,SAAS,eAAe,SAAS;CAChC,MAAM,WAAW,yBAAyB,QAAQ,QAAQ;CAC1D,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,2BAA2B,UAAU,uBAAuB;EAClE;EACA;CACD,CAAC,GAAG,KAAK;AACV"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as buildNamespacedNativeEnums, t as NamespacedNativeEnums } from "./postgres-static-
|
|
2
|
-
import { a as PostgresTransactionContext, i as PostgresStaticMembers, n as PostgresQueryMembers, r as PostgresRuntimeBoundMembers, t as PostgresLifecycleMembers } from "./postgres-members-
|
|
3
|
-
import { n as PostgresExecutionOptions, t as PostgresCursorOptions } from "./postgres-options-
|
|
1
|
+
import { i as buildNamespacedNativeEnums, t as NamespacedNativeEnums } from "./postgres-static-CGyjvgUc-CbtwmaLk.mjs";
|
|
2
|
+
import { a as PostgresTransactionContext, i as PostgresStaticMembers, n as PostgresQueryMembers, r as PostgresRuntimeBoundMembers, t as PostgresLifecycleMembers } from "./postgres-members-Cuvcnuok-BiaFrw1C.mjs";
|
|
3
|
+
import { n as PostgresExecutionOptions, t as PostgresCursorOptions } from "./postgres-options-HIC8ThD0-oCe4XrcH.mjs";
|
|
4
4
|
import { Runtime, SqlRuntimeBase } from "@prisma/orm-family-sql/runtime";
|
|
5
5
|
import { CollectionClasses, NoCollectionClasses } from "@prisma/orm-family-sql/orm-client";
|
|
6
6
|
import { Client, Pool } from "pg";
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as postgresError } from "./errors-DfWK9xep-CYOOg0sB.mjs";
|
|
2
|
-
import { n as
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
2
|
+
import { n as validatePostgresContract } from "./contract-from-json-Dr3aG46--C7CPjHDQ.mjs";
|
|
3
|
+
import { n as buildPostgresStaticContext, t as buildNamespacedNativeEnums } from "./postgres-static-DAv3kYKr-Ch2c9OEA.mjs";
|
|
4
|
+
import { n as buildPostgresRuntimeBoundMembers } from "./postgres-members-BuiQxl75-CqxZVzX9.mjs";
|
|
5
|
+
import { a as resolveOptionalPostgresBinding, c as toRuntimeOptions, i as isPgPool, l as validateCursorOptions, n as PostgresRuntimeImpl, o as resolvePostgresBinding, r as isPgClient, s as toDriverCursorOptions } from "./postgres-runtime-xWysBSgi-BawBDlwz.mjs";
|
|
6
6
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
7
|
-
import { createExecutionContext, createSqlExecutionStack } from "@prisma/orm-family-sql/runtime";
|
|
8
7
|
import postgresTarget from "@prisma/orm-target-postgres/target/runtime";
|
|
9
8
|
import postgresAdapter from "@prisma/orm-target-postgres/adapter/runtime";
|
|
9
|
+
import { createExecutionContext, createSqlExecutionStack } from "@prisma/orm-family-sql/runtime";
|
|
10
10
|
import postgresDriver, { suppressIdleConnectionErrors } from "@prisma/orm-target-postgres/driver/runtime";
|
|
11
11
|
import { Pool } from "pg";
|
|
12
12
|
//#region ../../../3-extensions/postgres/dist/runtime.mjs
|
|
@@ -111,7 +111,8 @@ function postgres(options) {
|
|
|
111
111
|
...buildPostgresRuntimeBoundMembers({
|
|
112
112
|
context,
|
|
113
113
|
collections: options.collections,
|
|
114
|
-
|
|
114
|
+
sql,
|
|
115
|
+
raw: rawSqlTag,
|
|
115
116
|
enums,
|
|
116
117
|
nativeEnums,
|
|
117
118
|
toSql,
|
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 resolveOptionalPostgresBinding, i as toRuntimeOptions, l as resolvePostgresBinding, o as isPgClient, r as toDriverCursorOptions, s as isPgPool, t as PostgresRuntimeImpl } from \"./postgres-runtime-xWysBSgi.mjs\";\nimport { r as buildNamespacedNativeEnums, t as buildPostgresStaticContext } from \"./postgres-static-
|
|
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 resolveOptionalPostgresBinding, i as toRuntimeOptions, l as resolvePostgresBinding, o as isPgClient, r as toDriverCursorOptions, s as isPgPool, t as PostgresRuntimeImpl } from \"./postgres-runtime-xWysBSgi.mjs\";\nimport { r as buildNamespacedNativeEnums, t as buildPostgresStaticContext } from \"./postgres-static-DAv3kYKr.mjs\";\nimport { n as validatePostgresContract } from \"./contract-from-json-Dr3aG46-.mjs\";\nimport { n as buildPostgresRuntimeBoundMembers } from \"./postgres-members-BuiQxl75.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport postgresDriver, { suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport postgresTarget from \"@internal/target-postgres/runtime\";\nimport { Pool } from \"pg\";\n//#region src/runtime/postgres.ts\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}\n/**\n* Creates a lazy Postgres client. The client infers its contract type from `contract`: a value from\n* `contractFromJson` for an emitted contract, or a TypeScript-authored contract. A contract is\n* validated once, however many clients are built from it. The static query surfaces are available\n* at once; the pool is created on the first query or `connect()`.\n*\n* @example\n* ```ts\n* import { contractFromJson } from '@prisma/orm-postgres/static';\n* import postgres from '@prisma/orm-postgres/runtime';\n* import type { Contract } from './contract.d';\n* import contractJson from './contract.json' with { type: 'json' };\n*\n* export const contract = contractFromJson<Contract>(contractJson);\n* export const db = postgres({ contract, url: process.env['DATABASE_URL']! });\n* ```\n*/\nfunction postgres(options) {\n\tconst cursor = validateCursorOptions(options.cursor, \"postgres\");\n\tconst contract = validatePostgresContract(options.contract);\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, toSql } = buildPostgresStaticContext(contract, context, stack);\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 adapter = stack.adapter.create(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,\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\tcollections: options.collections,\n\t\t\tsql,\n\t\t\traw: rawSqlTag,\n\t\t\tenums,\n\t\t\tnativeEnums,\n\t\t\ttoSql,\n\t\t\tgetRuntime,\n\t\t\tgetRuntimeForWork: getRuntime\n\t\t}),\n\t\tenums,\n\t\tnativeEnums,\n\t\traw: rawSqlTag,\n\t\ttoSql,\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,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;;;;;;;;;;;;;;;;;;AAkBA,SAAS,SAAS,SAAS;CAC1B,MAAM,SAAS,sBAAsB,QAAQ,QAAQ,UAAU;CAC/D,MAAM,WAAW,yBAAyB,QAAQ,QAAQ;CAC1D,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,aAAa,UAAU,2BAA2B,UAAU,SAAS,KAAK;CAC9G,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,iCAAiC;EAC7E,IAAI,gBAAgB,OAAO;EAC3B,MAAM,iBAAiB,iBAAiB,iBAAiB,OAAO;EAChE,MAAM,YAAY,gBAAgB,SAAS,SAAS,eAAe,SAAS,WAAW,eAAe,OAAO,KAAK;EAClH,iBAAiB,cAAc,QAAQ,cAAc,CAAC,CAAC,WAAW;GACjE,kBAAkB;GAClB,WAAW,cAAc,KAAK;EAC/B,CAAC,CAAC,CAAC,MAAM,OAAO,QAAQ;GACvB,yBAAyB;GACzB,iBAAiB,KAAK;GACtB,MAAM,WAAW,IAAI,CAAC,CAAC,YAAY,KAAK,CAAC;GACzC,MAAM;EACP,CAAC;EACD,OAAO;CACR;CACA,MAAM,mBAAmB;EACxB,IAAI,iBAAiB,KAAK,GAAG,MAAM,cAAc,wBAAwB,6BAA6B;GACrG,KAAK;GACL,KAAK;GACL,MAAM,EAAE,WAAW,WAAW;EAC/B,CAAC;EACD,IAAI,2BAA2B,KAAK,GAAG,MAAM;EAC7C,IAAI,iBAAiB,OAAO;EAC5B,MAAM,UAAU,MAAM,QAAQ,OAAO,KAAK;EAC1C,MAAM,mBAAmB,MAAM;EAC/B,IAAI,CAAC,kBAAkB,MAAM,IAAI,cAAc,gDAAgD;EAC/F,MAAM,SAAS,iBAAiB,OAAO,EAAE,QAAQ,sBAAsB,MAAM,EAAE,CAAC;EAChF,gBAAgB;EAChB,MAAM,UAAU,IAAI,oBAAoB;GACvC;GACA;GACA;GACA,GAAG,iBAAiB,OAAO;GAC3B,cAAc;EACf,CAAC;EACD,kBAAkB;EAClB,IAAI,YAAY,KAAK,GAAG,cAAc,OAAO,CAAC,CAAC,YAAY,KAAK,CAAC;EACjE,OAAO;CACR;CACA,MAAM,oBAAoB,YAAY;EACrC,IAAI,CAAC,iBAAiB,MAAM,gBAAgB,YAAY,KAAK,CAAC;EAC9D,IAAI,UAAU,MAAM,iBAAiB,MAAM;CAC5C;CACA,OAAO;EACN;EACA,GAAG,iCAAiC;GACnC;GACA,aAAa,QAAQ;GACrB;GACA,KAAK;GACL;GACA;GACA;GACA;GACA,mBAAmB;EACpB,CAAC;EACD;EACA;EACA,KAAK;EACL;EACA;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,5 +1,5 @@
|
|
|
1
|
-
import { i as PostgresStaticMembers, n as PostgresQueryMembers, r as PostgresRuntimeBoundMembers, t as PostgresLifecycleMembers } from "./postgres-members-
|
|
2
|
-
import { n as PostgresExecutionOptions, t as PostgresCursorOptions } from "./postgres-options-
|
|
1
|
+
import { i as PostgresStaticMembers, n as PostgresQueryMembers, r as PostgresRuntimeBoundMembers, t as PostgresLifecycleMembers } from "./postgres-members-Cuvcnuok-BiaFrw1C.mjs";
|
|
2
|
+
import { n as PostgresExecutionOptions, t as PostgresCursorOptions } from "./postgres-options-HIC8ThD0-oCe4XrcH.mjs";
|
|
3
3
|
import { CollectionClasses, NoCollectionClasses } from "@prisma/orm-family-sql/orm-client";
|
|
4
4
|
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
5
5
|
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
package/dist/serverless.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as postgresError } from "./errors-DfWK9xep-CYOOg0sB.mjs";
|
|
2
|
-
import { n as
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
2
|
+
import { n as validatePostgresContract } from "./contract-from-json-Dr3aG46--C7CPjHDQ.mjs";
|
|
3
|
+
import { n as buildPostgresStaticContext } from "./postgres-static-DAv3kYKr-Ch2c9OEA.mjs";
|
|
4
|
+
import { n as buildPostgresRuntimeBoundMembers } from "./postgres-members-BuiQxl75-CqxZVzX9.mjs";
|
|
5
|
+
import { c as toRuntimeOptions, l as validateCursorOptions, n as PostgresRuntimeImpl, s as toDriverCursorOptions, t as DEFAULT_CONNECT_TIMEOUT_MILLIS, u as validatePostgresUrl } from "./postgres-runtime-xWysBSgi-BawBDlwz.mjs";
|
|
6
6
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
7
|
-
import { createExecutionContext, createSqlExecutionStack } from "@prisma/orm-family-sql/runtime";
|
|
8
7
|
import postgresTarget from "@prisma/orm-target-postgres/target/runtime";
|
|
9
8
|
import postgresAdapter from "@prisma/orm-target-postgres/adapter/runtime";
|
|
9
|
+
import { createExecutionContext, createSqlExecutionStack } from "@prisma/orm-family-sql/runtime";
|
|
10
10
|
import postgresDriver, { suppressIdleConnectionErrors } from "@prisma/orm-target-postgres/driver/runtime";
|
|
11
11
|
import { Client } from "pg";
|
|
12
12
|
import { redactDatabaseUrl } from "@prisma/orm-framework/utils/redact-db-url";
|
|
@@ -69,12 +69,12 @@ function postgresServerless(options) {
|
|
|
69
69
|
stack,
|
|
70
70
|
driver: postgresDriver
|
|
71
71
|
});
|
|
72
|
-
const rawCodecInferer = stack.adapter.rawCodecInferer;
|
|
73
72
|
const { sql, raw, enums, nativeEnums, toSql } = buildPostgresStaticContext(contract, context, stack);
|
|
74
73
|
const buildRuntimeBoundMembers = (getRuntime, getRuntimeForWork) => buildPostgresRuntimeBoundMembers({
|
|
75
74
|
context,
|
|
76
75
|
collections: options.collections,
|
|
77
|
-
|
|
76
|
+
sql,
|
|
77
|
+
raw,
|
|
78
78
|
enums,
|
|
79
79
|
nativeEnums,
|
|
80
80
|
toSql,
|
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, i as toRuntimeOptions, n as DEFAULT_CONNECT_TIMEOUT_MILLIS, r as toDriverCursorOptions, t as PostgresRuntimeImpl, u as validatePostgresUrl } from \"./postgres-runtime-xWysBSgi.mjs\";\nimport { t as buildPostgresStaticContext } from \"./postgres-static-
|
|
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, i as toRuntimeOptions, n as DEFAULT_CONNECT_TIMEOUT_MILLIS, r as toDriverCursorOptions, t as PostgresRuntimeImpl, u as validatePostgresUrl } from \"./postgres-runtime-xWysBSgi.mjs\";\nimport { t as buildPostgresStaticContext } from \"./postgres-static-DAv3kYKr.mjs\";\nimport { n as validatePostgresContract } from \"./contract-from-json-Dr3aG46-.mjs\";\nimport { n as buildPostgresRuntimeBoundMembers } from \"./postgres-members-BuiQxl75.mjs\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport postgresDriver, { suppressIdleConnectionErrors } from \"@internal/driver-postgres/runtime\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport postgresTarget 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 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}\n/**\n* Creates a serverless client for serverless and edge runtimes (Cloudflare Workers + Hyperdrive,\n* AWS Lambda, Vercel, Deno Deploy).\n*\n* The serverless client holds no database connection and has the static members. Each\n* `connect({ url })` opens one database connection, a fresh `pg.Client`, and returns a connection\n* with the members of a `postgres()` client except `connect`. It rejects with\n* `DRIVER.CONNECTION_FAILED` when the database refuses the connection, rejects the credentials,\n* or does not answer within 20 seconds. Close the connection with `await using` or `close()`.\n*\n* The client infers its contract type from `contract` and validates it once, when the client is\n* created; connections reuse it.\n*\n* @example\n* ```ts\n* const postgres = postgresServerless({ contract: contractFromJson<Contract>(contractJson) });\n*\n* export default {\n* async fetch(_req: Request, env: Env): Promise<Response> {\n* await using db = await postgres.connect({ url: env.HYPERDRIVE.connectionString });\n* const users = await db.orm.public.User.all();\n* return Response.json(users);\n* },\n* };\n* ```\n*/\nfunction postgresServerless(options) {\n\tconst cursor = validateCursorOptions(options.cursor, \"postgresServerless\");\n\tconst contract = validatePostgresContract(options.contract);\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, enums, nativeEnums, toSql } = buildPostgresStaticContext(contract, context, stack);\n\tconst buildRuntimeBoundMembers = (getRuntime, getRuntimeForWork) => buildPostgresRuntimeBoundMembers({\n\t\tcontext,\n\t\tcollections: options.collections,\n\t\tsql,\n\t\traw,\n\t\tenums,\n\t\tnativeEnums,\n\t\ttoSql,\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\ttoSql,\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\ttoSql,\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 adapter = stack.adapter.create(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,\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,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;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,mBAAmB,SAAS;CACpC,MAAM,SAAS,sBAAsB,QAAQ,QAAQ,oBAAoB;CACzE,MAAM,WAAW,yBAAyB,QAAQ,QAAQ;CAC1D,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,OAAO,aAAa,UAAU,2BAA2B,UAAU,SAAS,KAAK;CACnG,MAAM,4BAA4B,YAAY,sBAAsB,iCAAiC;EACpG;EACA,aAAa,QAAQ;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAC;CACD,MAAM,kBAAkB;EACvB,MAAM,IAAI,cAAc,sCAAsC;CAC/D;CACA,yBAAyB,WAAW,SAAS;CAC7C,MAAM,oBAAoB,YAAY;EACrC,IAAI;EACJ,MAAM,cAAc;GACnB,YAAY,QAAQ,MAAM;GAC1B,OAAO;EACR;EACA,MAAM,sBAAsB,+BAA+B;GAC1D,IAAI,YAAY,KAAK,GAAG,MAAM,sBAAsB;GACpD,OAAO;EACR,SAAS,OAAO;EAChB,OAAO;GACN;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACH;IACC,OAAO,eAAe;EACxB;CACD;CACA,OAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAM,QAAQ,SAAS;GACtB,MAAM,MAAM,oBAAoB,QAAQ,GAAG;GAC3C,MAAM,mBAAmB,MAAM;GAC/B,IAAI,CAAC,kBAAkB,MAAM,IAAI,cAAc,gDAAgD;GAC/F,MAAM,UAAU,MAAM,QAAQ,OAAO,KAAK;GAC1C,MAAM,SAAS,iBAAiB,OAAO,EAAE,QAAQ,sBAAsB,MAAM,EAAE,CAAC;GAChF,MAAM,WAAW,6BAA6B,IAAI,OAAO;IACxD,kBAAkB;IAClB,yBAAyB;GAC1B,CAAC,CAAC;GACF,MAAM,OAAO,QAAQ;IACpB,MAAM;IACN,QAAQ;GACT,CAAC;GACD,MAAM,UAAU,IAAI,oBAAoB;IACvC;IACA;IACA;IACA,GAAG,iBAAiB,OAAO;IAC3B,cAAc;GACf,CAAC;GACD,MAAM,aAAa,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/dist/static.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as PostgresStaticContext, o as postgresStatic } from "./postgres-static-CGyjvgUc-CbtwmaLk.mjs";
|
|
2
2
|
import { t as contractFromJson } from "./contract-from-json-ZRZt8Cse-BkZYEfDX.mjs";
|
|
3
3
|
export { type PostgresStaticContext, contractFromJson, postgresStatic as default };
|
package/dist/static.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as contractFromJson } from "./contract-from-json-
|
|
2
|
-
import { r as postgresStatic } from "./postgres-static-
|
|
1
|
+
import { t as contractFromJson } from "./contract-from-json-Dr3aG46--C7CPjHDQ.mjs";
|
|
2
|
+
import { r as postgresStatic } from "./postgres-static-DAv3kYKr-Ch2c9OEA.mjs";
|
|
3
3
|
export { contractFromJson, postgresStatic as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-postgres",
|
|
3
|
-
"version": "8.0.0-rc.19-dev.
|
|
3
|
+
"version": "8.0.0-rc.19-dev.7",
|
|
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.19-dev.
|
|
14
|
-
"@prisma/orm-framework": "8.0.0-rc.19-dev.
|
|
15
|
-
"@prisma/orm-target-postgres": "8.0.0-rc.19-dev.
|
|
16
|
-
"@prisma/orm-toolchain": "8.0.0-rc.19-dev.
|
|
13
|
+
"@prisma/orm-family-sql": "8.0.0-rc.19-dev.7",
|
|
14
|
+
"@prisma/orm-framework": "8.0.0-rc.19-dev.7",
|
|
15
|
+
"@prisma/orm-target-postgres": "8.0.0-rc.19-dev.7",
|
|
16
|
+
"@prisma/orm-toolchain": "8.0.0-rc.19-dev.7",
|
|
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.19-dev.
|
|
26
|
-
"@repo/tsconfig": "8.0.0-rc.19-dev.
|
|
27
|
-
"@repo/tsdown": "8.0.0-rc.19-dev.
|
|
25
|
+
"@internal/postgres": "8.0.0-rc.19-dev.7",
|
|
26
|
+
"@repo/tsconfig": "8.0.0-rc.19-dev.7",
|
|
27
|
+
"@repo/tsdown": "8.0.0-rc.19-dev.7",
|
|
28
28
|
"tsdown": "0.22.14",
|
|
29
29
|
"typescript": "5.9.3"
|
|
30
30
|
},
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
"./family-contract/value-set-derivation-hook": "./dist/family-contract__value-set-derivation-hook.mjs",
|
|
110
110
|
"./family-runtime": "./dist/family-runtime.mjs",
|
|
111
111
|
"./family-runtime/internal/prepared-query": "./dist/family-runtime__internal__prepared-query.mjs",
|
|
112
|
+
"./internal/static-context": "./dist/internal__static-context.mjs",
|
|
112
113
|
"./internal/transaction-members": "./dist/internal__transaction-members.mjs",
|
|
113
114
|
"./internal/validate-contract": "./dist/internal__validate-contract.mjs",
|
|
114
115
|
"./migration": "./dist/migration.mjs",
|
package/skills/prisma-8/SKILL.md
CHANGED
|
@@ -25,7 +25,7 @@ This skill covers using Prisma 8 against a **Supabase** project end-to-end: comp
|
|
|
25
25
|
|
|
26
26
|
- **The pack is an `external` contract space.** `@internal/extension-supabase/pack` ships a complete, introspection-generated contract of everything Supabase owns — the `auth` and `storage` schemas, their native enum types, and the platform roles (`anon`, `authenticated`, `service_role`) — all with control policy `external`. Composed via `extensions`, it means: the migration planner **emits no DDL** for those objects (Supabase manages them), and `db verify` **confirms they exist** in the live database. Your own tables stay `managed` as usual.
|
|
27
27
|
- **Roles come from the pack; you never declare them.** RLS `roles = [authenticated]` identifiers resolve against the composed contract. Pointing the runtime at a non-Supabase Postgres fails verify with a `not-found` issue naming the missing role — the common "wrong database" misconfiguration surfaces before queries run.
|
|
28
|
-
- **The runtime is role-first.** `supabase()` returns a `SupabaseDb` with **no top-level query surface** — there is no `db.sql` / `db.orm` until you bind a role. `await db.asUser(jwt)` / `db.asAnon()` / `db.asServiceRole()` each return a `RoleBoundDb` exposing `.sql`, `.orm`, `.raw`, `.prepare(...)`, `.query(plan)` (rows), `.execute(plan)` (affected count), and `.transaction(fn)`. This is deliberate: in a Supabase app there is no meaningful "no role" execution context, and defaulting to the connection's login role is a silent-RLS-bypass footgun.
|
|
28
|
+
- **The runtime is role-first.** `supabase()` returns a `SupabaseDb` with **no top-level query surface** — there is no `db.sql` / `db.orm` until you bind a role. `await db.asUser(jwt)` / `db.asAnon()` / `db.asServiceRole()` each return a `RoleBoundDb` exposing `.sql`, `.orm`, `.raw`, `.prepare(...)`, `.query(plan)` (rows), `.execute(plan)` (affected count), `.enums`, `.nativeEnums`, and `.transaction(fn)`. This is deliberate: in a Supabase app there is no meaningful "no role" execution context, and defaulting to the connection's login role is a silent-RLS-bypass footgun.
|
|
29
29
|
- **Role binding is below middleware and cannot leak.** Each role-bound query runs on a connection that had `set_config('role', …)` and `set_config('request.jwt.claims', …)` applied beneath the user-middleware chain, with `RESET ALL` on release. Postgres-side `auth.uid()` / `auth.jwt()` read those session vars — RLS enforcement is Postgres's job; the runtime's job is binding the context.
|
|
30
30
|
- **RLS is enforced by policies *and* grants.** Policies filter *rows*; `GRANT` controls *table access*. Prisma 8 authors and migrates the policies; it does not author grants (see *What Prisma 8 doesn't do yet*). A role with policies but no `GRANT` gets a permission error, not filtered rows. On Supabase your `public` tables already carry the platform-role grants via default privileges — the grant that is actually missing out of the box is `service_role`'s on `auth.*` / `storage.*` (see *Workflow — Grants*).
|
|
31
31
|
- **JWT validation is eager and configurable — current Supabase projects need `jwksUrl`.** `asUser(jwt)` verifies the token (via `jose`) *before* any connection is acquired: signature + expiry against `jwksUrl` (asymmetric signing keys — **the default on current Supabase projects**, which sign ES256) **xor** `jwtSecret` (the symmetric HS256 secret — legacy projects only). Both or neither → a structured error with code `SUPABASE.CONFIG_INVALID`. Bad tokens throw a structured error with code `SUPABASE.JWT_INVALID` and a typed `meta.reason` — including a mismatch between the token's algorithm and the configured key source (an ES256 token against a `jwtSecret` client names the problem and tells you to switch to `jwksUrl`). The Postgres role is derived from the token's `role` claim (defaults to `authenticated`). Note: `supabase status` still prints a `JWT_SECRET` even on projects that sign ES256 — its presence does not mean your project uses it.
|
|
@@ -122,7 +122,7 @@ export const db = await supabase({
|
|
|
122
122
|
});
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
Options beyond the basics: `middleware` (same composition as `postgres()` — see `references/runtime.md`; middleware never sees the role-binding `set_config` calls), `poolOptions`, `pg` (BYO `pg.Pool`
|
|
125
|
+
Options beyond the basics: `middleware` (same composition as `postgres()` — see `references/runtime.md`; middleware never sees the role-binding `set_config` calls), `poolOptions`, `pg` (BYO `pg.Pool` instead of `url`; a `pg.Client` is rejected with `SUPABASE.CONFIG_INVALID`). Teardown is `await db.close()` / `await using` exactly as in `references/runtime.md` — the same script-hang rules apply.
|
|
126
126
|
|
|
127
127
|
## Workflow — Role-bound queries
|
|
128
128
|
|
|
@@ -146,7 +146,7 @@ const updated = await userDb.orm.public.Profile
|
|
|
146
146
|
.updateAndCount({ username: 'new-name' });
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
Notes: `asAnon()` / `asServiceRole()` are sync; only `asUser` is async. Multi-namespace contracts address models by coordinate (`orm.public.Profile`, `sql.public.profile`) — see `references/queries.md` § *Namespace-aware accessors*. `RoleBoundDb.transaction(fn)` wraps work in a transaction on the role-bound session; its `tx` offers `sql`, `orm` (with the client's custom collection classes), `raw`, `prepare`, `query` and `
|
|
149
|
+
Notes: `asAnon()` / `asServiceRole()` are sync; only `asUser` is async. Multi-namespace contracts address models by coordinate (`orm.public.Profile`, `sql.public.profile`) — see `references/queries.md` § *Namespace-aware accessors*. `RoleBoundDb.transaction(fn)` wraps work in a transaction on the role-bound session; its `tx` offers `sql`, `orm` (with the client's custom collection classes), `raw`, `prepare`, `query`, `execute`, `enums` and `nativeEnums`, and runs every statement under the bound role. A prepared statement runs on what it is given: `ps.query(userDb, params)` runs under that client's role, and `ps.query(tx, params)` runs inside the transaction.
|
|
150
150
|
|
|
151
151
|
## Workflow — Admin reads of `auth.*` / `storage.*`
|
|
152
152
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-members-CWwALshp-gx864rhm.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-members-CWwALshp.mjs"],"sourcesContent":["import { ifDefined } from \"@internal/utils/defined\";\nimport { activitySource, delegatingActivitySource, withTransaction, withTransactionMembers } from \"@internal/sql-runtime\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\nimport { orm, prepareQuery } from \"@internal/sql-orm-client\";\n//#region src/runtime/postgres-members.ts\n/**\n* Builds the query members of a Postgres transaction over `txCtx`, so every statement they run goes through the transaction. `query` and `execute` are the transaction's own. Preparing sends nothing to the database, so `prepare` uses `prepareRuntime`; the prepared statement runs on the queryable it is given.\n*/\nfunction buildPostgresQueryMembers(options, txCtx) {\n\tconst { context, collections, rawCodecInferer, toSql, prepareRuntime } = options;\n\treturn {\n\t\ttoSql,\n\t\tsql: sql({\n\t\t\tcontext,\n\t\t\trawCodecInferer\n\t\t}),\n\t\traw: createRawLane({\n\t\t\tcontext,\n\t\t\trawCodecInferer\n\t\t}),\n\t\torm: orm({\n\t\t\truntime: {\n\t\t\t\tquery(plan) {\n\t\t\t\t\treturn txCtx.query(plan);\n\t\t\t\t},\n\t\t\t\texecute(plan) {\n\t\t\t\t\treturn txCtx.execute(plan);\n\t\t\t\t},\n\t\t\t\t[activitySource]: delegatingActivitySource(() => txCtx)\n\t\t\t},\n\t\t\tcontext,\n\t\t\t...ifDefined(\"collections\", collections)\n\t\t}),\n\t\tprepare(declaration, callback) {\n\t\t\treturn prepareQuery(prepareRuntime(), declaration, callback);\n\t\t}\n\t};\n}\nfunction buildPostgresRuntimeBoundMembers(options) {\n\tconst { context, collections, rawCodecInferer, enums, nativeEnums, toSql, 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\t[activitySource]: delegatingActivitySource(() => getRuntimeForWork())\n\t\t},\n\t\tcontext,\n\t\t...ifDefined(\"collections\", collections)\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\tquery(plan, execOptions) {\n\t\t\treturn getRuntimeForWork().query(plan, execOptions);\n\t\t},\n\t\texecute(plan, execOptions) {\n\t\t\treturn getRuntimeForWork().execute(plan, execOptions);\n\t\t},\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\treturn fn(withTransactionMembers(txCtx, {\n\t\t\t\t\t...buildPostgresQueryMembers({\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tcollections,\n\t\t\t\t\t\trawCodecInferer,\n\t\t\t\t\t\ttoSql,\n\t\t\t\t\t\tprepareRuntime: getRuntimeForWork\n\t\t\t\t\t}, txCtx),\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\nexport { buildPostgresRuntimeBoundMembers as n, buildPostgresQueryMembers as t };\n\n//# sourceMappingURL=postgres-members-CWwALshp.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,0BAA0B,SAAS,OAAO;CAClD,MAAM,EAAE,SAAS,aAAa,iBAAiB,OAAO,mBAAmB;CACzE,OAAO;EACN;EACA,KAAK,IAAI;GACR;GACA;EACD,CAAC;EACD,KAAK,cAAc;GAClB;GACA;EACD,CAAC;EACD,KAAK,IAAI;GACR,SAAS;IACR,MAAM,MAAM;KACX,OAAO,MAAM,MAAM,IAAI;IACxB;IACA,QAAQ,MAAM;KACb,OAAO,MAAM,QAAQ,IAAI;IAC1B;KACC,iBAAiB,+BAA+B,KAAK;GACvD;GACA;GACA,GAAG,UAAU,eAAe,WAAW;EACxC,CAAC;EACD,QAAQ,aAAa,UAAU;GAC9B,OAAO,aAAa,eAAe,GAAG,aAAa,QAAQ;EAC5D;CACD;AACD;AACA,SAAS,iCAAiC,SAAS;CAClD,MAAM,EAAE,SAAS,aAAa,iBAAiB,OAAO,aAAa,OAAO,YAAY,sBAAsB;CAC5G,MAAM,QAAQ,IAAI;EACjB,SAAS;GACR,MAAM,MAAM;IACX,OAAO,kBAAkB,CAAC,CAAC,MAAM,IAAI;GACtC;GACA,QAAQ,MAAM;IACb,OAAO,kBAAkB,CAAC,CAAC,QAAQ,IAAI;GACxC;GACA,aAAa;IACZ,OAAO,kBAAkB,CAAC,CAAC,WAAW;GACvC;IACC,iBAAiB,+BAA+B,kBAAkB,CAAC;EACrE;EACA;EACA,GAAG,UAAU,eAAe,WAAW;CACxC,CAAC;CACD,SAAS,QAAQ,aAAa,UAAU;EACvC,OAAO,aAAa,kBAAkB,GAAG,aAAa,QAAQ;CAC/D;CACA,OAAO;EACN,KAAK;EACL,MAAM,MAAM,aAAa;GACxB,OAAO,kBAAkB,CAAC,CAAC,MAAM,MAAM,WAAW;EACnD;EACA,QAAQ,MAAM,aAAa;GAC1B,OAAO,kBAAkB,CAAC,CAAC,QAAQ,MAAM,WAAW;EACrD;EACA,UAAU;GACT,OAAO,WAAW;EACnB;EACA;EACA,YAAY,IAAI;GACf,OAAO,gBAAgB,kBAAkB,IAAI,UAAU;IACtD,OAAO,GAAG,uBAAuB,OAAO;KACvC,GAAG,0BAA0B;MAC5B;MACA;MACA;MACA;MACA,gBAAgB;KACjB,GAAG,KAAK;KACR;KACA;IACD,CAAC,CAAC;GACH,CAAC;EACF;CACD;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-members-DF6iy9vo-CX7AyWfg.d.mts","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-members-DF6iy9vo.d.mts"],"mappings":";;;;;;;;;;;KAUK,UAAU,kBAAkB,SAAS,aAAa,qBAAqB,qBAAqB,kBAAkB,IAAI,WAAW;;UAExH,qBAAqB,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,cAAc,YAAY,cAAc;WAC1K,KAAK,GAAG;WACR,KAAK,UAAU,WAAW;WAC1B,KAAK,QAAQ;;UAEd,2BAA2B,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,oBAAoB,qBAAqB,WAAW;WAC5L,OAAO,gBAAgB;WACvB,aAAa,sBAAsB;;UAEpC,4BAA4B,kBAAkB,SAAS,aAAa,qBAAqB;WACxF,SAAS,iBAAiB;WAC1B,aAAa;WACb,iBAAiB;WACjB,OAAO;WACP,sBAAsB;;;;;iBAKhB,0BAA0B,kBAAkB,SAAS,aAAa,qBAAqB,mBAAmB,SAAS,4BAA4B,WAAW,eAAe,OAAO,qBAAqB,KAAK,qBAAqB,WAAW,qBAAqB;UACtQ,sBAAsB,kBAAkB,SAAS,qBAAqB,sBAAsB;WAC3F,OAAO,4BAA4B;;UAEpC,4BAA4B,kBAAkB,SAAS,aAAa,qBAAqB,oBAAoB,6BAA6B,cAAc;WACvJ,KAAK,UAAU,WAAW;EACnC,WAAW;EACX,YAAY,GAAG,KAAK,IAAI,2BAA2B,WAAW,kBAAkB,YAAY,KAAK,QAAQ;;UAEjG;EACR,SAAS;GACR,OAAO,iBAAiB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-options-DfsyEh5L-BcnZzOBh.d.mts","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-options-DfsyEh5L.d.mts"],"mappings":";;;;;;;;;;UASU;WACC;;;;;;UAMD;WACC,sBAAsB,8BAA8B;WACpD,sBAAsB;WACtB,eAAe;WACf,MAAM;WACN,SAAS;WACT,OAAO"}
|