Skip to content

Commit 76b5539

Browse files
committed
fix: add graceful yml parsing, add databaseType
1 parent 68dc251 commit 76b5539

File tree

3 files changed

+657
-58
lines changed

3 files changed

+657
-58
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
"license": "Apache-2.0",
1010
"dependencies": {
1111
"graphql-config": "2.2.1",
12-
"prisma-yml": "1.0.97"
12+
"prisma-yml": "1.20.0-beta.18"
1313
},
1414
"devDependencies": {
15-
"@types/graphql": "^14.0.0",
16-
"@types/jest": "^23.3.2",
17-
"@types/node": "10.9.4",
15+
"@types/graphql": "^14.0.3",
16+
"@types/jest": "^23.3.9",
17+
"@types/node": "10.12.1",
1818
"graphql": "^14.0.2",
1919
"jest": "^23.6.0",
20-
"ts-jest": "^23.1.4",
20+
"ts-jest": "^23.10.4",
2121
"ts-node": "7.0.1",
22-
"typescript": "3.0.3"
22+
"typescript": "3.1.4"
2323
},
2424
"scripts": {
2525
"test": "jest",

src/index.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,26 @@ export function getCustomDirectives(version?: string) {
8080
// of this project.
8181
export async function patchEndpointsToConfig<
8282
T extends GraphQLConfig | GraphQLProjectConfig
83-
>(config: T, cwd?: string, envVars?: { [key: string]: any }): Promise<T> {
84-
config.config = await patchEndpointsToConfigData(config.config, cwd, envVars)
83+
>(
84+
config: T,
85+
cwd?: string,
86+
envVars?: { [key: string]: any },
87+
graceful?: boolean,
88+
): Promise<T> {
89+
config.config = await patchEndpointsToConfigData(
90+
config.config,
91+
cwd,
92+
envVars,
93+
graceful,
94+
)
8595
return config
8696
}
8797

8898
export async function patchEndpointsToConfigData(
8999
config: GraphQLConfigData,
90100
cwd?: string,
91101
envVars?: { [key: string]: any },
102+
graceful?: boolean,
92103
): Promise<GraphQLConfigData> {
93104
// return early if no prisma extension found
94105
const allExtensions = [
@@ -115,6 +126,7 @@ export async function patchEndpointsToConfigData(
115126
newConfig.extensions.prisma,
116127
cwd,
117128
envVars,
129+
graceful,
118130
),
119131
)
120132
}
@@ -132,6 +144,7 @@ export async function patchEndpointsToConfigData(
132144
project.extensions.prisma,
133145
cwd,
134146
envVars,
147+
graceful,
135148
),
136149
)
137150
}
@@ -210,10 +223,11 @@ async function getEndpointsFromPath(
210223
ymlPath: string,
211224
cwd?: string,
212225
envVars?: { [key: string]: any },
226+
graceful?: boolean,
213227
): Promise<GraphQLConfigEnpointsData> {
214228
const joinedYmlPath = cwd ? path.join(cwd, ymlPath) : ymlPath
215229
const definition = new PrismaDefinitionClass(env, joinedYmlPath, envVars)
216-
await definition.load({})
230+
await definition.load({}, undefined, graceful)
217231
const serviceName = definition.service!
218232
const stage = definition.stage!
219233
const clusterName = definition.cluster

0 commit comments

Comments
 (0)