@prisma/client 7.1.0-dev.32 → 7.1.0-dev.34
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/generator-build/index.js +31 -4
- package/package.json +30 -28
- package/runtime/client.d.mts +130 -2
- package/runtime/client.d.ts +130 -2
- package/runtime/client.js +20 -20
- package/runtime/client.js.map +4 -4
- package/runtime/client.mjs +20 -20
- package/runtime/client.mjs.map +4 -4
- package/runtime/wasm-compiler-edge.js +18 -18
- package/runtime/wasm-compiler-edge.js.map +4 -4
- package/runtime/wasm-compiler-edge.mjs +18 -18
- package/runtime/wasm-compiler-edge.mjs.map +4 -4
- package/scripts/default-index.js +1 -1
package/generator-build/index.js
CHANGED
|
@@ -4659,7 +4659,7 @@ var import_path4 = __toESM(require("path"));
|
|
|
4659
4659
|
// package.json
|
|
4660
4660
|
var package_default = {
|
|
4661
4661
|
name: "@prisma/client",
|
|
4662
|
-
version: "7.1.0-dev.
|
|
4662
|
+
version: "7.1.0-dev.34",
|
|
4663
4663
|
description: "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.",
|
|
4664
4664
|
keywords: [
|
|
4665
4665
|
"ORM",
|
|
@@ -4865,9 +4865,11 @@ var package_default = {
|
|
|
4865
4865
|
"@prisma/get-platform": "workspace:*",
|
|
4866
4866
|
"@prisma/instrumentation": "workspace:*",
|
|
4867
4867
|
"@prisma/internals": "workspace:*",
|
|
4868
|
+
"@prisma/json-protocol": "workspace:*",
|
|
4868
4869
|
"@prisma/migrate": "workspace:*",
|
|
4869
4870
|
"@prisma/query-compiler-wasm": "7.1.0-5.ab17e348034e9823a063101c707b39f4ba1e6dd4",
|
|
4870
4871
|
"@prisma/query-plan-executor": "workspace:*",
|
|
4872
|
+
"@prisma/sqlcommenter": "workspace:*",
|
|
4871
4873
|
"@prisma/ts-builders": "workspace:*",
|
|
4872
4874
|
"@snaplet/copycat": "6.0.0",
|
|
4873
4875
|
"@swc-node/register": "1.10.9",
|
|
@@ -8859,14 +8861,19 @@ var GenerateContext = class {
|
|
|
8859
8861
|
dmmf;
|
|
8860
8862
|
genericArgsInfo;
|
|
8861
8863
|
generator;
|
|
8862
|
-
|
|
8864
|
+
provider;
|
|
8865
|
+
constructor({ dmmf, genericArgsInfo, generator, provider }) {
|
|
8863
8866
|
this.dmmf = dmmf;
|
|
8864
8867
|
this.genericArgsInfo = genericArgsInfo;
|
|
8865
8868
|
this.generator = generator;
|
|
8869
|
+
this.provider = provider;
|
|
8866
8870
|
}
|
|
8867
8871
|
isPreviewFeatureOn(previewFeature) {
|
|
8868
8872
|
return this.generator?.previewFeatures?.includes(previewFeature) ?? false;
|
|
8869
8873
|
}
|
|
8874
|
+
isSqlProvider() {
|
|
8875
|
+
return this.provider !== "mongodb";
|
|
8876
|
+
}
|
|
8870
8877
|
};
|
|
8871
8878
|
|
|
8872
8879
|
// ../client-generator-js/src/TSClient/PrismaClient.ts
|
|
@@ -9380,6 +9387,25 @@ export type TransactionClient = Omit<Prisma.DefaultPrismaClient, runtime.ITXClie
|
|
|
9380
9387
|
\`\`\`
|
|
9381
9388
|
`)
|
|
9382
9389
|
);
|
|
9390
|
+
if (this.context.isSqlProvider()) {
|
|
9391
|
+
clientOptions.add(
|
|
9392
|
+
property("comments", array(namedType("runtime.SqlCommenterPlugin"))).optional().setDocComment(docComment`
|
|
9393
|
+
SQL commenter plugins that add metadata to SQL queries as comments.
|
|
9394
|
+
Comments follow the sqlcommenter format: https://google.github.io/sqlcommenter/
|
|
9395
|
+
|
|
9396
|
+
@example
|
|
9397
|
+
\`\`\`
|
|
9398
|
+
const prisma = new PrismaClient({
|
|
9399
|
+
adapter,
|
|
9400
|
+
comments: [
|
|
9401
|
+
traceContext(),
|
|
9402
|
+
queryInsights(),
|
|
9403
|
+
],
|
|
9404
|
+
})
|
|
9405
|
+
\`\`\`
|
|
9406
|
+
`)
|
|
9407
|
+
);
|
|
9408
|
+
}
|
|
9383
9409
|
return clientOptions;
|
|
9384
9410
|
}
|
|
9385
9411
|
};
|
|
@@ -9446,7 +9472,8 @@ Object.assign(exports, Prisma)
|
|
|
9446
9472
|
const context = new GenerateContext({
|
|
9447
9473
|
dmmf: this.dmmf,
|
|
9448
9474
|
genericArgsInfo: this.genericsInfo,
|
|
9449
|
-
generator: this.options.generator
|
|
9475
|
+
generator: this.options.generator,
|
|
9476
|
+
provider: this.options.activeProvider
|
|
9450
9477
|
});
|
|
9451
9478
|
const prismaClientClass = new PrismaClientClass(
|
|
9452
9479
|
context,
|
|
@@ -10397,7 +10424,7 @@ var import_node_path4 = __toESM(require("node:path"));
|
|
|
10397
10424
|
var import_engines_version = __toESM(require_engines_version());
|
|
10398
10425
|
|
|
10399
10426
|
// ../client-generator-js/package.json
|
|
10400
|
-
var version = "7.1.0-dev.
|
|
10427
|
+
var version = "7.1.0-dev.34";
|
|
10401
10428
|
|
|
10402
10429
|
// ../client-generator-js/src/resolvePrismaClient.ts
|
|
10403
10430
|
var import_promises5 = __toESM(require("node:fs/promises"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/client",
|
|
3
|
-
"version": "7.1.0-dev.
|
|
3
|
+
"version": "7.1.0-dev.34",
|
|
4
4
|
"description": "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ORM",
|
|
@@ -218,35 +218,37 @@
|
|
|
218
218
|
"typescript": "5.4.5",
|
|
219
219
|
"undici": "7.4.0",
|
|
220
220
|
"zx": "8.4.1",
|
|
221
|
-
"@prisma/adapter-
|
|
222
|
-
"@prisma/adapter-
|
|
223
|
-
"@prisma/adapter-
|
|
224
|
-
"@prisma/adapter-
|
|
225
|
-
"@prisma/adapter-
|
|
226
|
-
"@prisma/adapter-
|
|
227
|
-
"@prisma/adapter-
|
|
228
|
-
"@prisma/
|
|
229
|
-
"@prisma/client-
|
|
230
|
-
"@prisma/
|
|
231
|
-
"@prisma/client-generator-js": "7.1.0-dev.
|
|
232
|
-
"@prisma/
|
|
233
|
-
"@prisma/
|
|
234
|
-
"@prisma/dmmf": "7.1.0-dev.
|
|
235
|
-
"@prisma/
|
|
236
|
-
"@prisma/
|
|
237
|
-
"@prisma/engines": "7.1.0-dev.
|
|
238
|
-
"@prisma/fetch-engine": "7.1.0-dev.
|
|
239
|
-
"@prisma/generator": "7.1.0-dev.
|
|
240
|
-
"@prisma/
|
|
241
|
-
"@prisma/
|
|
242
|
-
"@prisma/
|
|
243
|
-
"@prisma/
|
|
244
|
-
"@prisma/
|
|
245
|
-
"@prisma/
|
|
246
|
-
"@prisma/
|
|
221
|
+
"@prisma/adapter-d1": "7.1.0-dev.34",
|
|
222
|
+
"@prisma/adapter-libsql": "7.1.0-dev.34",
|
|
223
|
+
"@prisma/adapter-better-sqlite3": "7.1.0-dev.34",
|
|
224
|
+
"@prisma/adapter-mssql": "7.1.0-dev.34",
|
|
225
|
+
"@prisma/adapter-mariadb": "7.1.0-dev.34",
|
|
226
|
+
"@prisma/adapter-neon": "7.1.0-dev.34",
|
|
227
|
+
"@prisma/adapter-pg": "7.1.0-dev.34",
|
|
228
|
+
"@prisma/client-common": "7.1.0-dev.34",
|
|
229
|
+
"@prisma/client-engine-runtime": "7.1.0-dev.34",
|
|
230
|
+
"@prisma/adapter-planetscale": "7.1.0-dev.34",
|
|
231
|
+
"@prisma/client-generator-js": "7.1.0-dev.34",
|
|
232
|
+
"@prisma/client-generator-ts": "7.1.0-dev.34",
|
|
233
|
+
"@prisma/config": "7.1.0-dev.34",
|
|
234
|
+
"@prisma/dmmf": "7.1.0-dev.34",
|
|
235
|
+
"@prisma/driver-adapter-utils": "7.1.0-dev.34",
|
|
236
|
+
"@prisma/debug": "7.1.0-dev.34",
|
|
237
|
+
"@prisma/engines": "7.1.0-dev.34",
|
|
238
|
+
"@prisma/fetch-engine": "7.1.0-dev.34",
|
|
239
|
+
"@prisma/generator-helper": "7.1.0-dev.34",
|
|
240
|
+
"@prisma/get-platform": "7.1.0-dev.34",
|
|
241
|
+
"@prisma/instrumentation": "7.1.0-dev.34",
|
|
242
|
+
"@prisma/internals": "7.1.0-dev.34",
|
|
243
|
+
"@prisma/generator": "7.1.0-dev.34",
|
|
244
|
+
"@prisma/migrate": "7.1.0-dev.34",
|
|
245
|
+
"@prisma/json-protocol": "7.1.0-dev.34",
|
|
246
|
+
"@prisma/query-plan-executor": "7.1.0-dev.34",
|
|
247
|
+
"@prisma/sqlcommenter": "7.1.0-dev.34",
|
|
248
|
+
"@prisma/ts-builders": "7.1.0-dev.34"
|
|
247
249
|
},
|
|
248
250
|
"dependencies": {
|
|
249
|
-
"@prisma/client-runtime-utils": "7.1.0-dev.
|
|
251
|
+
"@prisma/client-runtime-utils": "7.1.0-dev.34"
|
|
250
252
|
},
|
|
251
253
|
"peerDependencies": {
|
|
252
254
|
"prisma": "*",
|
package/runtime/client.d.mts
CHANGED
|
@@ -802,6 +802,11 @@ declare interface EngineConfig {
|
|
|
802
802
|
* Web Assembly module loading configuration
|
|
803
803
|
*/
|
|
804
804
|
compilerWasm?: CompilerWasmLoadingConfig;
|
|
805
|
+
/**
|
|
806
|
+
* SQL commenter plugins that add metadata to SQL queries as comments.
|
|
807
|
+
* Each plugin receives query context and returns key-value pairs.
|
|
808
|
+
*/
|
|
809
|
+
sqlCommenters?: SqlCommenterPlugin[];
|
|
805
810
|
}
|
|
806
811
|
|
|
807
812
|
declare type EngineEvent<E extends EngineEventType> = E extends QueryEventType ? QueryEvent : LogEvent;
|
|
@@ -1611,12 +1616,14 @@ export declare type JsonObject = {
|
|
|
1611
1616
|
|
|
1612
1617
|
export declare type JsonQuery = {
|
|
1613
1618
|
modelName?: string;
|
|
1614
|
-
action:
|
|
1619
|
+
action: JsonQueryAction_2;
|
|
1615
1620
|
query: JsonFieldSelection;
|
|
1616
1621
|
};
|
|
1617
1622
|
|
|
1618
1623
|
declare type JsonQueryAction = 'findUnique' | 'findUniqueOrThrow' | 'findFirst' | 'findFirstOrThrow' | 'findMany' | 'createOne' | 'createMany' | 'createManyAndReturn' | 'updateOne' | 'updateMany' | 'updateManyAndReturn' | 'deleteOne' | 'deleteMany' | 'upsertOne' | 'aggregate' | 'groupBy' | 'executeRaw' | 'queryRaw' | 'runCommandRaw' | 'findRaw' | 'aggregateRaw';
|
|
1619
1624
|
|
|
1625
|
+
declare type JsonQueryAction_2 = 'findUnique' | 'findUniqueOrThrow' | 'findFirst' | 'findFirstOrThrow' | 'findMany' | 'createOne' | 'createMany' | 'createManyAndReturn' | 'updateOne' | 'updateMany' | 'updateManyAndReturn' | 'deleteOne' | 'deleteMany' | 'upsertOne' | 'aggregate' | 'groupBy' | 'executeRaw' | 'queryRaw' | 'runCommandRaw' | 'findRaw' | 'aggregateRaw';
|
|
1626
|
+
|
|
1620
1627
|
declare type JsonSelectionSet = {
|
|
1621
1628
|
$scalars?: boolean;
|
|
1622
1629
|
$composites?: boolean;
|
|
@@ -2017,6 +2024,22 @@ export declare type PrismaClientOptions = PrismaClientMutuallyExclusiveOptions &
|
|
|
2017
2024
|
*/
|
|
2018
2025
|
log?: Array<LogLevel | LogDefinition>;
|
|
2019
2026
|
omit?: GlobalOmitOptions;
|
|
2027
|
+
/**
|
|
2028
|
+
* SQL commenter plugins that add metadata to SQL queries as comments.
|
|
2029
|
+
* Comments follow the sqlcommenter format: https://google.github.io/sqlcommenter/
|
|
2030
|
+
*
|
|
2031
|
+
* @example
|
|
2032
|
+
* ```ts
|
|
2033
|
+
* new PrismaClient({
|
|
2034
|
+
* adapter: new PrismaPg({ connectionString }),
|
|
2035
|
+
* comments: [
|
|
2036
|
+
* traceContext(),
|
|
2037
|
+
* queryInsights(),
|
|
2038
|
+
* ],
|
|
2039
|
+
* })
|
|
2040
|
+
* ```
|
|
2041
|
+
*/
|
|
2042
|
+
comments?: SqlCommenterPlugin[];
|
|
2020
2043
|
/**
|
|
2021
2044
|
* @internal
|
|
2022
2045
|
* You probably don't want to use this. \`__internal\` is used by internal tooling.
|
|
@@ -2882,6 +2905,111 @@ declare enum SpanStatusCode {
|
|
|
2882
2905
|
|
|
2883
2906
|
export { Sql }
|
|
2884
2907
|
|
|
2908
|
+
/**
|
|
2909
|
+
* Information about a compacted batch query (e.g. multiple independent
|
|
2910
|
+
* `findUnique` queries automatically merged into a single `SELECT` SQL
|
|
2911
|
+
* statement).
|
|
2912
|
+
*/
|
|
2913
|
+
declare interface SqlCommenterCompactedQueryInfo {
|
|
2914
|
+
/**
|
|
2915
|
+
* The model name (e.g., "User", "Post").
|
|
2916
|
+
*/
|
|
2917
|
+
readonly modelName: string;
|
|
2918
|
+
/**
|
|
2919
|
+
* The Prisma operation (e.g., "findUnique").
|
|
2920
|
+
*/
|
|
2921
|
+
readonly action: SqlCommenterQueryAction;
|
|
2922
|
+
/**
|
|
2923
|
+
* The full query objects (selections, arguments, etc.).
|
|
2924
|
+
* Specifics of the query representation are not part of the public API yet.
|
|
2925
|
+
*/
|
|
2926
|
+
readonly queries: ReadonlyArray<unknown>;
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
/**
|
|
2930
|
+
* Context provided to SQL commenter plugins.
|
|
2931
|
+
*/
|
|
2932
|
+
export declare interface SqlCommenterContext {
|
|
2933
|
+
/**
|
|
2934
|
+
* Information about the Prisma query being executed.
|
|
2935
|
+
*/
|
|
2936
|
+
readonly query: SqlCommenterQueryInfo;
|
|
2937
|
+
/**
|
|
2938
|
+
* Raw SQL query generated from this Prisma query.
|
|
2939
|
+
*
|
|
2940
|
+
* It is always available when `PrismaClient` connects to the database and
|
|
2941
|
+
* renders SQL queries directly.
|
|
2942
|
+
*
|
|
2943
|
+
* When using Prisma Accelerate, SQL rendering happens on Accelerate side and the raw
|
|
2944
|
+
* SQL strings are not yet available when SQL commenter plugins are executed.
|
|
2945
|
+
*/
|
|
2946
|
+
readonly sql?: string;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
/**
|
|
2950
|
+
* A SQL commenter plugin that returns key-value pairs to be added as comments.
|
|
2951
|
+
* Return an empty object to add no comments. Keys with undefined values will be omitted.
|
|
2952
|
+
*
|
|
2953
|
+
* @example
|
|
2954
|
+
* ```ts
|
|
2955
|
+
* const myPlugin: SqlCommenterPlugin = (context) => {
|
|
2956
|
+
* return {
|
|
2957
|
+
* application: 'my-app',
|
|
2958
|
+
* model: context.query.modelName ?? 'raw',
|
|
2959
|
+
* // Conditional key - will be omitted if ctx.sql is undefined
|
|
2960
|
+
* sqlLength: context.sql ? String(context.sql.length) : undefined,
|
|
2961
|
+
* }
|
|
2962
|
+
* }
|
|
2963
|
+
* ```
|
|
2964
|
+
*/
|
|
2965
|
+
export declare interface SqlCommenterPlugin {
|
|
2966
|
+
(context: SqlCommenterContext): SqlCommenterTags;
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
/**
|
|
2970
|
+
* Prisma query type corresponding to this SQL query.
|
|
2971
|
+
*/
|
|
2972
|
+
declare type SqlCommenterQueryAction = JsonQueryAction;
|
|
2973
|
+
|
|
2974
|
+
/**
|
|
2975
|
+
* Information about the query or queries being executed.
|
|
2976
|
+
*
|
|
2977
|
+
* - `single`: A single query is being executed
|
|
2978
|
+
* - `compacted`: Multiple queries have been compacted into a single SQL statement
|
|
2979
|
+
*/
|
|
2980
|
+
export declare type SqlCommenterQueryInfo = ({
|
|
2981
|
+
readonly type: 'single';
|
|
2982
|
+
} & SqlCommenterSingleQueryInfo) | ({
|
|
2983
|
+
readonly type: 'compacted';
|
|
2984
|
+
} & SqlCommenterCompactedQueryInfo);
|
|
2985
|
+
|
|
2986
|
+
/**
|
|
2987
|
+
* Information about a single Prisma query.
|
|
2988
|
+
*/
|
|
2989
|
+
export declare interface SqlCommenterSingleQueryInfo {
|
|
2990
|
+
/**
|
|
2991
|
+
* The model name (e.g., "User", "Post"). Undefined for raw queries.
|
|
2992
|
+
*/
|
|
2993
|
+
readonly modelName?: string;
|
|
2994
|
+
/**
|
|
2995
|
+
* The Prisma operation (e.g., "findMany", "createOne", "queryRaw").
|
|
2996
|
+
*/
|
|
2997
|
+
readonly action: SqlCommenterQueryAction;
|
|
2998
|
+
/**
|
|
2999
|
+
* The full query object (selection, arguments, etc.).
|
|
3000
|
+
* Specifics of the query representation are not part of the public API yet.
|
|
3001
|
+
*/
|
|
3002
|
+
readonly query: unknown;
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
/**
|
|
3006
|
+
* Key-value pairs to add as SQL comments.
|
|
3007
|
+
* Keys with undefined values will be omitted from the final comment.
|
|
3008
|
+
*/
|
|
3009
|
+
export declare type SqlCommenterTags = {
|
|
3010
|
+
readonly [key: string]: string | undefined;
|
|
3011
|
+
};
|
|
3012
|
+
|
|
2885
3013
|
declare interface SqlDriverAdapter extends SqlQueryable {
|
|
2886
3014
|
/**
|
|
2887
3015
|
* Execute multiple SQL statements separated by semicolon.
|
|
@@ -3010,8 +3138,8 @@ declare interface Transaction extends AdapterInfo, SqlQueryable {
|
|
|
3010
3138
|
|
|
3011
3139
|
declare namespace Transaction_2 {
|
|
3012
3140
|
export {
|
|
3013
|
-
Options,
|
|
3014
3141
|
IsolationLevel_2 as IsolationLevel,
|
|
3142
|
+
Options,
|
|
3015
3143
|
InteractiveTransactionInfo,
|
|
3016
3144
|
TransactionHeaders
|
|
3017
3145
|
}
|
package/runtime/client.d.ts
CHANGED
|
@@ -802,6 +802,11 @@ declare interface EngineConfig {
|
|
|
802
802
|
* Web Assembly module loading configuration
|
|
803
803
|
*/
|
|
804
804
|
compilerWasm?: CompilerWasmLoadingConfig;
|
|
805
|
+
/**
|
|
806
|
+
* SQL commenter plugins that add metadata to SQL queries as comments.
|
|
807
|
+
* Each plugin receives query context and returns key-value pairs.
|
|
808
|
+
*/
|
|
809
|
+
sqlCommenters?: SqlCommenterPlugin[];
|
|
805
810
|
}
|
|
806
811
|
|
|
807
812
|
declare type EngineEvent<E extends EngineEventType> = E extends QueryEventType ? QueryEvent : LogEvent;
|
|
@@ -1611,12 +1616,14 @@ export declare type JsonObject = {
|
|
|
1611
1616
|
|
|
1612
1617
|
export declare type JsonQuery = {
|
|
1613
1618
|
modelName?: string;
|
|
1614
|
-
action:
|
|
1619
|
+
action: JsonQueryAction_2;
|
|
1615
1620
|
query: JsonFieldSelection;
|
|
1616
1621
|
};
|
|
1617
1622
|
|
|
1618
1623
|
declare type JsonQueryAction = 'findUnique' | 'findUniqueOrThrow' | 'findFirst' | 'findFirstOrThrow' | 'findMany' | 'createOne' | 'createMany' | 'createManyAndReturn' | 'updateOne' | 'updateMany' | 'updateManyAndReturn' | 'deleteOne' | 'deleteMany' | 'upsertOne' | 'aggregate' | 'groupBy' | 'executeRaw' | 'queryRaw' | 'runCommandRaw' | 'findRaw' | 'aggregateRaw';
|
|
1619
1624
|
|
|
1625
|
+
declare type JsonQueryAction_2 = 'findUnique' | 'findUniqueOrThrow' | 'findFirst' | 'findFirstOrThrow' | 'findMany' | 'createOne' | 'createMany' | 'createManyAndReturn' | 'updateOne' | 'updateMany' | 'updateManyAndReturn' | 'deleteOne' | 'deleteMany' | 'upsertOne' | 'aggregate' | 'groupBy' | 'executeRaw' | 'queryRaw' | 'runCommandRaw' | 'findRaw' | 'aggregateRaw';
|
|
1626
|
+
|
|
1620
1627
|
declare type JsonSelectionSet = {
|
|
1621
1628
|
$scalars?: boolean;
|
|
1622
1629
|
$composites?: boolean;
|
|
@@ -2017,6 +2024,22 @@ export declare type PrismaClientOptions = PrismaClientMutuallyExclusiveOptions &
|
|
|
2017
2024
|
*/
|
|
2018
2025
|
log?: Array<LogLevel | LogDefinition>;
|
|
2019
2026
|
omit?: GlobalOmitOptions;
|
|
2027
|
+
/**
|
|
2028
|
+
* SQL commenter plugins that add metadata to SQL queries as comments.
|
|
2029
|
+
* Comments follow the sqlcommenter format: https://google.github.io/sqlcommenter/
|
|
2030
|
+
*
|
|
2031
|
+
* @example
|
|
2032
|
+
* ```ts
|
|
2033
|
+
* new PrismaClient({
|
|
2034
|
+
* adapter: new PrismaPg({ connectionString }),
|
|
2035
|
+
* comments: [
|
|
2036
|
+
* traceContext(),
|
|
2037
|
+
* queryInsights(),
|
|
2038
|
+
* ],
|
|
2039
|
+
* })
|
|
2040
|
+
* ```
|
|
2041
|
+
*/
|
|
2042
|
+
comments?: SqlCommenterPlugin[];
|
|
2020
2043
|
/**
|
|
2021
2044
|
* @internal
|
|
2022
2045
|
* You probably don't want to use this. \`__internal\` is used by internal tooling.
|
|
@@ -2882,6 +2905,111 @@ declare enum SpanStatusCode {
|
|
|
2882
2905
|
|
|
2883
2906
|
export { Sql }
|
|
2884
2907
|
|
|
2908
|
+
/**
|
|
2909
|
+
* Information about a compacted batch query (e.g. multiple independent
|
|
2910
|
+
* `findUnique` queries automatically merged into a single `SELECT` SQL
|
|
2911
|
+
* statement).
|
|
2912
|
+
*/
|
|
2913
|
+
declare interface SqlCommenterCompactedQueryInfo {
|
|
2914
|
+
/**
|
|
2915
|
+
* The model name (e.g., "User", "Post").
|
|
2916
|
+
*/
|
|
2917
|
+
readonly modelName: string;
|
|
2918
|
+
/**
|
|
2919
|
+
* The Prisma operation (e.g., "findUnique").
|
|
2920
|
+
*/
|
|
2921
|
+
readonly action: SqlCommenterQueryAction;
|
|
2922
|
+
/**
|
|
2923
|
+
* The full query objects (selections, arguments, etc.).
|
|
2924
|
+
* Specifics of the query representation are not part of the public API yet.
|
|
2925
|
+
*/
|
|
2926
|
+
readonly queries: ReadonlyArray<unknown>;
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
/**
|
|
2930
|
+
* Context provided to SQL commenter plugins.
|
|
2931
|
+
*/
|
|
2932
|
+
export declare interface SqlCommenterContext {
|
|
2933
|
+
/**
|
|
2934
|
+
* Information about the Prisma query being executed.
|
|
2935
|
+
*/
|
|
2936
|
+
readonly query: SqlCommenterQueryInfo;
|
|
2937
|
+
/**
|
|
2938
|
+
* Raw SQL query generated from this Prisma query.
|
|
2939
|
+
*
|
|
2940
|
+
* It is always available when `PrismaClient` connects to the database and
|
|
2941
|
+
* renders SQL queries directly.
|
|
2942
|
+
*
|
|
2943
|
+
* When using Prisma Accelerate, SQL rendering happens on Accelerate side and the raw
|
|
2944
|
+
* SQL strings are not yet available when SQL commenter plugins are executed.
|
|
2945
|
+
*/
|
|
2946
|
+
readonly sql?: string;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
/**
|
|
2950
|
+
* A SQL commenter plugin that returns key-value pairs to be added as comments.
|
|
2951
|
+
* Return an empty object to add no comments. Keys with undefined values will be omitted.
|
|
2952
|
+
*
|
|
2953
|
+
* @example
|
|
2954
|
+
* ```ts
|
|
2955
|
+
* const myPlugin: SqlCommenterPlugin = (context) => {
|
|
2956
|
+
* return {
|
|
2957
|
+
* application: 'my-app',
|
|
2958
|
+
* model: context.query.modelName ?? 'raw',
|
|
2959
|
+
* // Conditional key - will be omitted if ctx.sql is undefined
|
|
2960
|
+
* sqlLength: context.sql ? String(context.sql.length) : undefined,
|
|
2961
|
+
* }
|
|
2962
|
+
* }
|
|
2963
|
+
* ```
|
|
2964
|
+
*/
|
|
2965
|
+
export declare interface SqlCommenterPlugin {
|
|
2966
|
+
(context: SqlCommenterContext): SqlCommenterTags;
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
/**
|
|
2970
|
+
* Prisma query type corresponding to this SQL query.
|
|
2971
|
+
*/
|
|
2972
|
+
declare type SqlCommenterQueryAction = JsonQueryAction;
|
|
2973
|
+
|
|
2974
|
+
/**
|
|
2975
|
+
* Information about the query or queries being executed.
|
|
2976
|
+
*
|
|
2977
|
+
* - `single`: A single query is being executed
|
|
2978
|
+
* - `compacted`: Multiple queries have been compacted into a single SQL statement
|
|
2979
|
+
*/
|
|
2980
|
+
export declare type SqlCommenterQueryInfo = ({
|
|
2981
|
+
readonly type: 'single';
|
|
2982
|
+
} & SqlCommenterSingleQueryInfo) | ({
|
|
2983
|
+
readonly type: 'compacted';
|
|
2984
|
+
} & SqlCommenterCompactedQueryInfo);
|
|
2985
|
+
|
|
2986
|
+
/**
|
|
2987
|
+
* Information about a single Prisma query.
|
|
2988
|
+
*/
|
|
2989
|
+
export declare interface SqlCommenterSingleQueryInfo {
|
|
2990
|
+
/**
|
|
2991
|
+
* The model name (e.g., "User", "Post"). Undefined for raw queries.
|
|
2992
|
+
*/
|
|
2993
|
+
readonly modelName?: string;
|
|
2994
|
+
/**
|
|
2995
|
+
* The Prisma operation (e.g., "findMany", "createOne", "queryRaw").
|
|
2996
|
+
*/
|
|
2997
|
+
readonly action: SqlCommenterQueryAction;
|
|
2998
|
+
/**
|
|
2999
|
+
* The full query object (selection, arguments, etc.).
|
|
3000
|
+
* Specifics of the query representation are not part of the public API yet.
|
|
3001
|
+
*/
|
|
3002
|
+
readonly query: unknown;
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
/**
|
|
3006
|
+
* Key-value pairs to add as SQL comments.
|
|
3007
|
+
* Keys with undefined values will be omitted from the final comment.
|
|
3008
|
+
*/
|
|
3009
|
+
export declare type SqlCommenterTags = {
|
|
3010
|
+
readonly [key: string]: string | undefined;
|
|
3011
|
+
};
|
|
3012
|
+
|
|
2885
3013
|
declare interface SqlDriverAdapter extends SqlQueryable {
|
|
2886
3014
|
/**
|
|
2887
3015
|
* Execute multiple SQL statements separated by semicolon.
|
|
@@ -3010,8 +3138,8 @@ declare interface Transaction extends AdapterInfo, SqlQueryable {
|
|
|
3010
3138
|
|
|
3011
3139
|
declare namespace Transaction_2 {
|
|
3012
3140
|
export {
|
|
3013
|
-
Options,
|
|
3014
3141
|
IsolationLevel_2 as IsolationLevel,
|
|
3142
|
+
Options,
|
|
3015
3143
|
InteractiveTransactionInfo,
|
|
3016
3144
|
TransactionHeaders
|
|
3017
3145
|
}
|