@prisma/client-generator-ts 6.6.0-dev.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -0
  3. package/dist/GenericsArgsInfo.d.ts +18 -0
  4. package/dist/GenericsArgsInfo.test.d.ts +1 -0
  5. package/dist/TSClient/Args.d.ts +44 -0
  6. package/dist/TSClient/Count.d.ts +11 -0
  7. package/dist/TSClient/Datasources.d.ts +7 -0
  8. package/dist/TSClient/DefaultArgsAliases.d.ts +4 -0
  9. package/dist/TSClient/Enum.d.ts +13 -0
  10. package/dist/TSClient/FieldRefInput.d.ts +8 -0
  11. package/dist/TSClient/Generable.d.ts +9 -0
  12. package/dist/TSClient/GenerateContext.d.ts +15 -0
  13. package/dist/TSClient/Input.d.ts +21 -0
  14. package/dist/TSClient/Model.d.ts +47 -0
  15. package/dist/TSClient/ModelFieldRefs.d.ts +8 -0
  16. package/dist/TSClient/Output.d.ts +5 -0
  17. package/dist/TSClient/Payload.d.ts +4 -0
  18. package/dist/TSClient/PrismaClient.d.ts +16 -0
  19. package/dist/TSClient/SelectIncludeOmit.d.ts +25 -0
  20. package/dist/TSClient/TSClient.d.ts +37 -0
  21. package/dist/TSClient/common.d.ts +7 -0
  22. package/dist/TSClient/constants.d.ts +1 -0
  23. package/dist/TSClient/globalOmit.d.ts +3 -0
  24. package/dist/TSClient/helpers.d.ts +6 -0
  25. package/dist/TSClient/index.d.ts +5 -0
  26. package/dist/TSClient/jsdoc.d.ts +20 -0
  27. package/dist/TSClient/utils/getModelActions.d.ts +3 -0
  28. package/dist/dmmf.d.ts +40 -0
  29. package/dist/externalToInternalDmmf.d.ts +7 -0
  30. package/dist/extractSqliteSources.d.ts +6 -0
  31. package/dist/extractSqliteSources.test.d.ts +1 -0
  32. package/dist/generateClient.d.ts +40 -0
  33. package/dist/generator.d.ts +13 -0
  34. package/dist/getDMMF.d.ts +4 -0
  35. package/dist/index.d.mts +67 -0
  36. package/dist/index.d.ts +67 -0
  37. package/dist/index.js +7284 -0
  38. package/dist/index.mjs +7281 -0
  39. package/dist/resolveDatasources.d.ts +1 -0
  40. package/dist/resolveDatasources.test.d.ts +1 -0
  41. package/dist/resolvePrismaClient.d.ts +16 -0
  42. package/dist/serializeDatasources.d.ts +4 -0
  43. package/dist/serializeDatasources.test.d.ts +1 -0
  44. package/dist/typedSql/buildDbEnums.d.ts +17 -0
  45. package/dist/typedSql/buildIndex.d.ts +5 -0
  46. package/dist/typedSql/buildTypedQuery.d.ts +12 -0
  47. package/dist/typedSql/mapTypes.d.ts +5 -0
  48. package/dist/typedSql/typedSql.d.ts +12 -0
  49. package/dist/utils/buildDMMF.d.ts +16 -0
  50. package/dist/utils/buildDebugInitialization.d.ts +12 -0
  51. package/dist/utils/buildDirname.d.ts +7 -0
  52. package/dist/utils/buildGetQueryCompilerWasmModule.d.ts +6 -0
  53. package/dist/utils/buildGetQueryEngineWasmModule.d.ts +6 -0
  54. package/dist/utils/buildInjectableEdgeEnv.d.ts +20 -0
  55. package/dist/utils/buildNFTAnnotations.d.ts +11 -0
  56. package/dist/utils/buildNFTAnnotations.test.d.ts +1 -0
  57. package/dist/utils/buildRequirePath.d.ts +6 -0
  58. package/dist/utils/buildWarnEnvConflicts.d.ts +10 -0
  59. package/dist/utils/common.d.ts +29 -0
  60. package/dist/utils/runtimeImport.d.ts +11 -0
  61. package/dist/utils/types/buildComment.d.ts +6 -0
  62. package/dist/utils/types/dmmfToTypes.d.ts +6 -0
  63. package/dist/utils/types/dmmfToTypes.spec.d.ts +1 -0
  64. package/dist/utils.d.ts +36 -0
  65. package/package.json +59 -0
@@ -0,0 +1 @@
1
+ export declare function absolutizeRelativePath(url: string, cwd: string, outputDir: string, absolutePaths?: boolean): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { Command } from '@antfu/ni';
2
+ export declare const debug: ((...args: any[]) => void) & {
3
+ color: string;
4
+ enabled: boolean;
5
+ namespace: string;
6
+ log: (...args: string[]) => void;
7
+ extend: () => void;
8
+ };
9
+ /**
10
+ * Resolve the path to the Prisma Client to determine the default output directory.
11
+ */
12
+ export declare function resolvePrismaClient(baseDir: string): Promise<string>;
13
+ /**
14
+ * Get the command to run for the given package manager in the given directory.
15
+ */
16
+ export declare function getPackageCmd(cwd: string, cmd: Command, ...args: string[]): Promise<string>;
@@ -0,0 +1,4 @@
1
+ import type { DataSource } from '@prisma/generator';
2
+ import type { DatasourceOverwrite } from './extractSqliteSources';
3
+ export declare function serializeDatasources(datasources: DatasourceOverwrite[]): string;
4
+ export declare function datasourceToDatasourceOverwrite(datasource: DataSource): DatasourceOverwrite;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import type * as DMMF from '@prisma/dmmf';
2
+ import { SqlQueryOutput } from '@prisma/generator';
3
+ type DbEnum = {
4
+ name: string;
5
+ values: string[];
6
+ };
7
+ export declare class DbEnumsList {
8
+ private enums;
9
+ constructor(enums: readonly DMMF.DatamodelEnum[]);
10
+ isEmpty(): boolean;
11
+ hasEnum(name: string): boolean;
12
+ validJsIdentifiers(): Generator<DbEnum, void, unknown>;
13
+ invalidJsIdentifiers(): Generator<DbEnum, void, unknown>;
14
+ }
15
+ export declare function buildDbEnums(list: DbEnumsList): string;
16
+ export declare function queryUsesEnums(query: SqlQueryOutput, enums: DbEnumsList): boolean;
17
+ export {};
@@ -0,0 +1,5 @@
1
+ import { SqlQueryOutput } from '@prisma/generator';
2
+ import { DbEnumsList } from './buildDbEnums';
3
+ export declare function buildIndexTs(queries: SqlQueryOutput[], enums: DbEnumsList): string;
4
+ export declare function buildIndexCjs(queries: SqlQueryOutput[], edgeRuntimeSuffix?: 'wasm' | 'edge' | undefined): string;
5
+ export declare function buildIndexEsm(queries: SqlQueryOutput[], edgeRuntimeSuffix?: 'wasm' | 'edge' | undefined): string;
@@ -0,0 +1,12 @@
1
+ import { SqlQueryOutput } from '@prisma/generator';
2
+ import { DbEnumsList } from './buildDbEnums';
3
+ type BuildTypedQueryOptions = {
4
+ runtimeBase: string;
5
+ runtimeName: string;
6
+ query: SqlQueryOutput;
7
+ enums: DbEnumsList;
8
+ };
9
+ export declare function buildTypedQueryTs({ query, runtimeBase, runtimeName, enums }: BuildTypedQueryOptions): string;
10
+ export declare function buildTypedQueryCjs({ query, runtimeBase, runtimeName }: BuildTypedQueryOptions): string;
11
+ export declare function buildTypedQueryEsm({ query, runtimeBase, runtimeName }: BuildTypedQueryOptions): string;
12
+ export {};
@@ -0,0 +1,5 @@
1
+ import { QueryIntrospectionType } from '@prisma/generator';
2
+ import * as ts from '@prisma/ts-builders';
3
+ import { DbEnumsList } from './buildDbEnums';
4
+ export declare function getInputType(introspectionType: QueryIntrospectionType, nullable: boolean, enums: DbEnumsList): ts.TypeBuilder;
5
+ export declare function getOutputType(introspectionType: QueryIntrospectionType, nullable: boolean, enums: DbEnumsList): ts.TypeBuilder;
@@ -0,0 +1,12 @@
1
+ import type * as DMMF from '@prisma/dmmf';
2
+ import { SqlQueryOutput } from '@prisma/generator';
3
+ import { FileMap } from '../generateClient';
4
+ type TypeSqlBuildOptions = {
5
+ runtimeBase: string;
6
+ mainRuntimeName: string;
7
+ edgeRuntimeName: 'wasm' | 'edge';
8
+ dmmf: DMMF.Document;
9
+ queries: SqlQueryOutput[];
10
+ };
11
+ export declare function buildTypedSql({ queries, runtimeBase, edgeRuntimeName, mainRuntimeName, dmmf, }: TypeSqlBuildOptions): FileMap;
12
+ export {};
@@ -0,0 +1,16 @@
1
+ import type * as DMMF from '@prisma/dmmf';
2
+ import { TSClientOptions } from '../TSClient/TSClient';
3
+ /**
4
+ * Given DMMF models, computes runtime datamodel from it and embeds
5
+ * it into generated client. Creates lazy `Prisma.dmmf` property for backward
6
+ * compatibility, which will dynamically compute DMMF.Datamodel from runtime
7
+ * datamodel when accessed.
8
+ * Note: Prisma client itself never uses `Prisma.dmmf` and uses runtime datamodel
9
+ * instead. We are preserving it only for backward compatibility with third party tools.
10
+ * If we remove it in a future major version, we can further optimize the format — client
11
+ * needs way less information that is present there at the moment
12
+ *
13
+ * @param datamodel
14
+ * @returns
15
+ */
16
+ export declare function buildRuntimeDataModel(datamodel: DMMF.Datamodel, runtimeNameJs: TSClientOptions['runtimeNameJs']): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Builds the code to initialize the `debug` package.
3
+ *
4
+ * The code running in the Edge Client entry point has access to `process.env`
5
+ * if it's defined, but the code in the runtime bundle doesn't. Furthermore, in
6
+ * some environments `DEBUG` may be defined as a global variable rather than
7
+ * available in `process.env`. The entry point fetches the value of `DEBUG` and
8
+ * passes into the `debug` package.
9
+ *
10
+ * @param edge Whether the edge runtime is used
11
+ */
12
+ export declare function buildDebugInitialization(edge: boolean): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Builds a `dirname` variable that holds the location of the generated client.
3
+ * @param edge
4
+ * @param relativeOutdir
5
+ * @returns
6
+ */
7
+ export declare function buildDirname(edge: boolean, relativeOutdir: string): string;
@@ -0,0 +1,6 @@
1
+ import { TSClientOptions } from '../TSClient/TSClient';
2
+ /**
3
+ * Builds the necessary glue code to load the query compiler wasm module.
4
+ * @returns
5
+ */
6
+ export declare function buildQueryCompilerWasmModule(wasm: boolean, copyCompiler: boolean, runtimeNameJs: TSClientOptions['runtimeNameJs']): "config.compilerWasm = {\n getRuntime: () => require('./query_compiler_bg.js'),\n getQueryCompilerWasmModule: async () => {\n const queryCompilerWasmFilePath = require('path').join(config.dirname, 'query_compiler_bg.wasm')\n const queryCompilerWasmFileBytes = require('fs').readFileSync(queryCompilerWasmFilePath)\n \n return new WebAssembly.Module(queryCompilerWasmFileBytes)\n }\n }" | "config.compilerWasm = {\n getRuntime: () => require('./query_compiler_bg.js'),\n getQueryCompilerWasmModule: async () => {\n const loader = (await import('#wasm-compiler-loader')).default\n const compiler = (await loader).default\n return compiler \n }\n}" | "config.compilerWasm = undefined";
@@ -0,0 +1,6 @@
1
+ import { TSClientOptions } from '../TSClient/TSClient';
2
+ /**
3
+ * Builds the necessary glue code to load the query engine wasm module.
4
+ * @returns
5
+ */
6
+ export declare function buildQueryEngineWasmModule(wasm: boolean, copyEngine: boolean, runtimeNameJs: TSClientOptions['runtimeNameJs']): "config.engineWasm = {\n getRuntime: () => require('./query_engine_bg.js'),\n getQueryEngineWasmModule: async () => {\n const queryEngineWasmFilePath = require('path').join(config.dirname, 'query_engine_bg.wasm')\n const queryEngineWasmFileBytes = require('fs').readFileSync(queryEngineWasmFilePath)\n \n return new WebAssembly.Module(queryEngineWasmFileBytes)\n }\n }" | "config.engineWasm = {\n getRuntime: () => require('./query_engine_bg.js'),\n getQueryEngineWasmModule: async () => {\n const loader = (await import('#wasm-engine-loader')).default\n const engine = (await loader).default\n return engine \n }\n}" | "config.engineWasm = undefined";
@@ -0,0 +1,20 @@
1
+ import { DataSource } from '@prisma/generator';
2
+ /**
3
+ * Builds an injectable environment for the data proxy edge client. It's useful
4
+ * because it is designed to run in browser-like environments where things like
5
+ * `fs`, `process.env`, and .env file loading are not available. That means env
6
+ * vars are represented as a global variable or injected at build time. This is
7
+ * the glue code to make this work with our existing env var loading logic. It
8
+ * is the place where we make collect the env vars for the edge client. To
9
+ * understand this better, take a look at the generated code in the edge client.
10
+ * @see {@link declareInjectableEdgeEnv}
11
+ * @param edge
12
+ * @param datasources
13
+ * @returns
14
+ */
15
+ export declare function buildInjectableEdgeEnv(edge: boolean, datasources: DataSource[]): string;
16
+ /**
17
+ * Builds the expression to get the value of an environment variable at run time.
18
+ * @param envVarName Name of the environment variable
19
+ */
20
+ export declare function getRuntimeEdgeEnvVar(envVarName: string): string;
@@ -0,0 +1,11 @@
1
+ import type { BinaryTarget } from '@prisma/get-platform';
2
+ import { ClientEngineType } from '@prisma/internals';
3
+ /**
4
+ * Build bundler-like annotations so that Vercel automatically uploads the
5
+ * prisma schema as well as the query engine binaries to the deployments.
6
+ * @param engineType the client engine in use
7
+ * @param binaryTargets the targeted binaryTargets
8
+ * @param relativeOutdir outdir relative to root
9
+ * @returns
10
+ */
11
+ export declare function buildNFTAnnotations(noEngine: boolean, engineType: ClientEngineType, binaryTargets: BinaryTarget[] | undefined, relativeOutdir: string): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Builds a require statement for `path`.
3
+ * @param edge
4
+ * @returns
5
+ */
6
+ export declare function buildRequirePath(edge: boolean): "" | "\n const path = require('path')";
@@ -0,0 +1,10 @@
1
+ import { TSClientOptions } from '../TSClient/TSClient';
2
+ /**
3
+ * Builds the necessary bits so that our users can get a helpful warning during
4
+ * "generate" in case of conflicts between their environment & their env files.
5
+ * @param edge
6
+ * @param runtimeBase
7
+ * @param runtimeNameJs
8
+ * @returns
9
+ */
10
+ export declare function buildWarnEnvConflicts(edge: boolean, runtimeBase: string, runtimeNameJs: TSClientOptions['runtimeNameJs']): string;
@@ -0,0 +1,29 @@
1
+ import type * as DMMF from '@prisma/dmmf';
2
+ export declare const needNamespace: {
3
+ Json: string;
4
+ Decimal: string;
5
+ };
6
+ export declare function needsNamespace(field: DMMF.Field): boolean;
7
+ export declare const GraphQLScalarToJSTypeTable: {
8
+ String: string;
9
+ Int: string;
10
+ Float: string;
11
+ Boolean: string;
12
+ Long: string;
13
+ DateTime: string[];
14
+ ID: string;
15
+ UUID: string;
16
+ Json: string;
17
+ Bytes: string;
18
+ Decimal: string[];
19
+ BigInt: string[];
20
+ };
21
+ export declare const JSOutputTypeToInputType: {
22
+ JsonValue: string;
23
+ };
24
+ export declare const JSTypeToGraphQLType: {
25
+ string: string;
26
+ boolean: string;
27
+ object: string;
28
+ symbol: string;
29
+ };
@@ -0,0 +1,11 @@
1
+ import * as ts from '@prisma/ts-builders';
2
+ type RuntimeExport = keyof typeof import('@prisma/client/runtime/library') & string;
3
+ /**
4
+ * Helps to ensure that when we want to refer to a type or value, imported from runtime Module
5
+ * we are referring to the name, that is actually exported
6
+ *
7
+ * @param name imported name
8
+ */
9
+ export declare function runtimeImport(name: RuntimeExport): string;
10
+ export declare function runtimeImportedType(name: RuntimeExport): ts.NamedType;
11
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Build comments for generating ts docs
3
+ * @param documentation
4
+ * @returns
5
+ */
6
+ export declare function buildComment(documentation?: string): string;
@@ -0,0 +1,6 @@
1
+ import type * as DMMF from '@prisma/dmmf';
2
+ /**
3
+ * @internal
4
+ * @remarks Used by, for example, the PDP to avoid child process calls to the CLI.
5
+ */
6
+ export declare function dmmfToTypes(dmmf: DMMF.Document): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import * as DMMF from '@prisma/dmmf';
2
+ import * as ts from '@prisma/ts-builders';
3
+ import { GenerateContext } from './TSClient/GenerateContext';
4
+ export declare function getSelectName(modelName: string): string;
5
+ export declare function getSelectCreateManyAndReturnName(modelName: string): string;
6
+ export declare function getSelectUpdateManyAndReturnName(modelName: string): string;
7
+ export declare function getIncludeName(modelName: string): string;
8
+ export declare function getIncludeCreateManyAndReturnName(modelName: string): string;
9
+ export declare function getIncludeUpdateManyAndReturnName(modelName: string): string;
10
+ export declare function getCreateManyAndReturnOutputType(modelName: string): string;
11
+ export declare function getUpdateManyAndReturnOutputType(modelName: string): string;
12
+ export declare function getOmitName(modelName: string): string;
13
+ export declare function getAggregateName(modelName: string): string;
14
+ export declare function getGroupByName(modelName: string): string;
15
+ export declare function getAvgAggregateName(modelName: string): string;
16
+ export declare function getSumAggregateName(modelName: string): string;
17
+ export declare function getMinAggregateName(modelName: string): string;
18
+ export declare function getMaxAggregateName(modelName: string): string;
19
+ export declare function getCountAggregateInputName(modelName: string): string;
20
+ export declare function getCountAggregateOutputName(modelName: string): string;
21
+ export declare function getAggregateInputType(aggregateOutputType: string): string;
22
+ export declare function getGroupByArgsName(modelName: string): string;
23
+ export declare function getGroupByPayloadName(modelName: string): string;
24
+ export declare function getAggregateArgsName(modelName: string): string;
25
+ export declare function getAggregateGetName(modelName: string): string;
26
+ export declare function getAggregateScalarGetName(modelName: string): string;
27
+ export declare function getFieldArgName(field: DMMF.SchemaField, modelName: string): string;
28
+ export declare function getModelFieldArgsName(field: DMMF.SchemaField, modelName: string): string;
29
+ export declare function getModelArgName(modelName: string, action?: DMMF.ModelAction): string;
30
+ export declare function getPayloadName(modelName: string, namespace?: boolean): string;
31
+ export declare function getFieldRefsTypeName(name: string): string;
32
+ export declare function getType(name: string, isList: boolean, isOptional?: boolean): string;
33
+ export declare function capitalize(str: string): string;
34
+ export declare function getRefAllowedTypeName(type: DMMF.OutputTypeRef): string;
35
+ export declare function appendSkipType(context: GenerateContext, type: ts.TypeBuilder): ts.TypeBuilder;
36
+ export declare const extArgsParam: ts.GenericParameter;
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@prisma/client-generator-ts",
3
+ "version": "6.6.0-dev.63",
4
+ "description": "This package is intended for Prisma's internal use",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "require": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "import": {
15
+ "types": "./dist/index.d.mts",
16
+ "default": "./dist/index.mjs"
17
+ }
18
+ }
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/prisma/prisma.git",
23
+ "directory": "packages/client-generator-ts"
24
+ },
25
+ "license": "Apache-2.0",
26
+ "dependencies": {
27
+ "@antfu/ni": "0.21.12",
28
+ "@prisma/engines-version": "6.6.0-30.baa69bfeca2f318076d19b6ce650fd8c9b4cb452",
29
+ "ci-info": "4.2.0",
30
+ "env-paths": "2.2.1",
31
+ "indent-string": "4.0.0",
32
+ "klona": "2.0.6",
33
+ "pkg-up": "3.1.0",
34
+ "pluralize": "8.0.0",
35
+ "ts-pattern": "5.6.2",
36
+ "@prisma/client-common": "6.6.0-dev.63",
37
+ "@prisma/debug": "6.6.0-dev.63",
38
+ "@prisma/fetch-engine": "6.6.0-dev.63",
39
+ "@prisma/generator": "6.6.0-dev.63",
40
+ "@prisma/dmmf": "6.6.0-dev.63",
41
+ "@prisma/get-platform": "6.6.0-dev.63",
42
+ "@prisma/internals": "6.6.0-dev.63",
43
+ "@prisma/ts-builders": "6.6.0-dev.63"
44
+ },
45
+ "devDependencies": {
46
+ "@types/pluralize": "0.0.33",
47
+ "strip-ansi": "7.1.0",
48
+ "vitest": "3.0.9"
49
+ },
50
+ "files": [
51
+ "dist"
52
+ ],
53
+ "sideEffects": false,
54
+ "scripts": {
55
+ "dev": "DEV=true tsx helpers/build.ts",
56
+ "build": "tsx helpers/build.ts",
57
+ "test": "vitest run"
58
+ }
59
+ }