Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'prisma-yml' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
config: GraphQLConfigData,
cwd?: string,
envVars?: { [key: string]: any },
graceful?: boolean,
): Promise {
// return early if no prisma extension found
const allExtensions = [config.extensions, ...values(config.projects).map(p => p.extensions)]
if (!allExtensions.some(e => e && e.prisma)) {
return config
}
const newConfig = { ...config }
const home = os.homedir()
const env = new Environment(home)
await env.load()
if (newConfig.extensions && newConfig.extensions.prisma) {
set(
newConfig,
['extensions', 'endpoints'],
await getEndpointsFromPath(env, newConfig.extensions.prisma, cwd, envVars, graceful),
)
}
if (newConfig.projects) {
await Promise.all(
Object.keys(newConfig.projects).map(async projectName => {
const project = newConfig.projects![projectName]
if (project.extensions && project.extensions.prisma) {
set(
export async function makeConfigFromPath(
cwd: string = process.cwd(),
envVars?: { [key: string]: any },
): Promise {
const ymlPath = path.join(cwd, 'prisma.yml')
if (!fs.existsSync(ymlPath)) {
return null
}
const home = os.homedir()
const env = new Environment(home)
await env.load()
const definition = new PrismaDefinitionClass(env, ymlPath, envVars)
await definition.load({})
const serviceName = definition.service!
const stage = definition.stage!
const clusterName = definition.cluster
if (!clusterName) {
throw new Error(`No cluster set. Please set the "cluster" property in your prisma.yml`)
}
const cluster = await definition.getCluster()
if (!cluster) {
throw new Error(
`Cluster ${clusterName} provided in prisma.yml could not be found in global ~/.prisma/config.yml.
Please check in ~/.prisma/config.yml, if the cluster exists.
You can use \`docker-compose up -d\` to start a new cluster.`,
)
}
const url = cluster.getApiEndpoint(serviceName, stage, definition.getWorkspace() || undefined)
async function getEndpointsFromPath(
env: Environment,
ymlPath: string,
cwd?: string,
envVars?: { [key: string]: any },
graceful?: boolean,
): Promise {
const joinedYmlPath = cwd ? path.join(cwd, ymlPath) : ymlPath
const definition = new PrismaDefinitionClass(env, joinedYmlPath, envVars)
await definition.load({}, undefined, graceful)
const serviceName = definition.service!
const stage = definition.stage!
const clusterName = definition.cluster
if (!clusterName) {
throw new Error(`No cluster set. Please set the "cluster" property in your prisma.yml`)
}
const cluster = await definition.getCluster()
if (!cluster) {
throw new Error(
`Cluster ${clusterName} provided in prisma.yml could not be found in global ~/.prisma/config.yml.
Please check in ~/.prisma/config.yml, if the cluster exists.
You can use \`docker-compose up -d\` to start a new cluster.`,
)
}
const url = cluster.getApiEndpoint(serviceName, stage, definition.getWorkspace() || undefined)
export async function makeConfigFromPath(
cwd: string = process.cwd(),
envVars?: { [key: string]: any },
): Promise {
const ymlPath = path.join(cwd, 'prisma.yml')
if (!fs.existsSync(ymlPath)) {
return null
}
const home = os.homedir()
const env = new Environment(home)
await env.load()
const definition = new PrismaDefinitionClass(env, ymlPath, envVars)
await definition.load({})
const serviceName = definition.service!
const stage = definition.stage!
const clusterName = definition.cluster
if (!clusterName) {
throw new Error(`No cluster set. Please set the "cluster" property in your prisma.yml`)
}
const cluster = await definition.getCluster()
if (!cluster) {
throw new Error(
`Cluster ${clusterName} provided in prisma.yml could not be found in global ~/.prisma/config.yml.
Please check in ~/.prisma/config.yml, if the cluster exists.
You can use \`docker-compose up -d\` to start a new cluster.`,