MCPcopy
hub / github.com/prisma/prisma / buildClient

Function buildClient

packages/client-generator-js/src/generateClient.ts:72–277  ·  view source on GitHub ↗
({
  schemaPath,
  runtimeBase,
  runtimeSourcePath,
  datamodel,
  binaryPaths,
  outputDir,
  generator,
  dmmf,
  datasources,
  engineVersion,
  clientVersion,
  activeProvider,
  typedSql,
  compilerBuild,
}: O.Required<GenerateClientOptions, 'runtimeBase'>)

Source from the content-addressed store, hash-verified

70
71// eslint-disable-next-line @typescript-eslint/require-await
72export async function buildClient({
73 schemaPath,
74 runtimeBase,
75 runtimeSourcePath,
76 datamodel,
77 binaryPaths,
78 outputDir,
79 generator,
80 dmmf,
81 datasources,
82 engineVersion,
83 clientVersion,
84 activeProvider,
85 typedSql,
86 compilerBuild,
87}: O.Required<GenerateClientOptions, 'runtimeBase'>): Promise<BuildClientResult> {
88 const baseClientOptions: Omit<TSClientOptions, 'runtimeName'> = {
89 dmmf: getPrismaClientDMMF(dmmf),
90 datasources,
91 generator,
92 binaryPaths,
93 schemaPath,
94 outputDir,
95 runtimeBase,
96 runtimeSourcePath,
97 clientVersion,
98 engineVersion,
99 activeProvider,
100 datamodel,
101 compilerBuild,
102 browser: false,
103 edge: false,
104 wasm: false,
105 }
106
107 const nodeClientOptions = {
108 ...baseClientOptions,
109 runtimeName: 'client',
110 }
111
112 // we create a regular client that is fit for Node.js
113 const nodeClient = new TSClient(nodeClientOptions)
114
115 const defaultClient = new TSClient({
116 ...nodeClientOptions,
117 reusedTs: 'index',
118 reusedJs: '.',
119 })
120
121 const trampolineTsClient = new TSClient({
122 ...nodeClientOptions,
123 reusedTs: 'index',
124 reusedJs: '#main-entry-point',
125 })
126
127 // order of keys is important here. bundler/runtime will
128 // match the first one they recognize, so it is important
129 // to go from more specific to more generic.

Callers 1

generateClientFunction · 0.70

Calls 7

JSFunction · 0.90
TSFunction · 0.90
BrowserJSFunction · 0.90
buildTypedSqlFunction · 0.90
addPreambleToJSFilesFunction · 0.90
getUniquePackageNameFunction · 0.85
getTypedSqlRuntimeBaseFunction · 0.70

Tested by

no test coverage detected