MCPcopy
hub / github.com/prisma/prisma / loadSchemaContext

Function loadSchemaContext

packages/internals/src/cli/schemaContext.ts:57–76  ·  view source on GitHub ↗
(
  { schemaPath, printLoadMessage, allowNull, schemaPathArgumentName, cwd }: LoadSchemaContextOptions = {
    schemaPath: { baseDir: process.cwd() },
    printLoadMessage: true,
    allowNull: false,
    schemaPathArgumentName: '--schema',
    cwd: process.cwd(),
  },
)

Source from the content-addressed store, hash-verified

55): Promise<SchemaContext | null>
56export async function loadSchemaContext(opts?: LoadSchemaContextOptions): Promise<SchemaContext>
57export async function loadSchemaContext(
58 { schemaPath, printLoadMessage, allowNull, schemaPathArgumentName, cwd }: LoadSchemaContextOptions = {
59 schemaPath: { baseDir: process.cwd() },
60 printLoadMessage: true,
61 allowNull: false,
62 schemaPathArgumentName: '--schema',
63 cwd: process.cwd(),
64 },
65): Promise<SchemaContext | null> {
66 let schemaResult: GetSchemaResult | null = null
67
68 if (allowNull) {
69 schemaResult = await getSchemaWithPathOptional({ schemaPath, cwd, argumentName: schemaPathArgumentName })
70 if (!schemaResult) return null
71 } else {
72 schemaResult = await getSchemaWithPath({ schemaPath, cwd, argumentName: schemaPathArgumentName })
73 }
74
75 return processSchemaResult({ schemaResult, printLoadMessage, cwd })
76}
77
78export async function processSchemaResult({
79 schemaResult,

Callers 15

getGeneratorsFunction · 0.90
testDirectoryConfigFunction · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90

Calls 3

getSchemaWithPathFunction · 0.90
processSchemaResultFunction · 0.85

Tested by 1

testDirectoryConfigFunction · 0.72