@forge/cli
14.1.0-next.21-experimental-554d41714.1.0-next.19-experimental-fd0ebbc
out/environment-variables/graphql-client.js~
out/environment-variables/graphql-client.jsModified+10−8
Index: package/out/environment-variables/graphql-client.js
===================================================================
--- package/out/environment-variables/graphql-client.js
+++ package/out/environment-variables/graphql-client.js
@@ -13,9 +13,9 @@
constructor(graphqlClient) {
this.graphqlClient = graphqlClient;
}
async listEnvironmentVariables(details) {
- const query = `
+ const query = (0, cli_shared_1.graphql)(`
query forge_cli_getAppEnvironmentVariables($appId: ID!, $key: String!) {
app(id: $appId) {
name
description
@@ -28,9 +28,9 @@
}
}
}
}
- `;
+ `);
const result = await this.graphqlClient.query(query, {
appId: details.appId,
key: details.environment
});
@@ -42,9 +42,9 @@
}
return result.app.environmentByKey.variables;
}
async setEnvironmentVariable(details) {
- const mutation = `
+ const mutation = (0, cli_shared_1.graphql)(`
mutation forge_cli_setAppEnvironmentVariable($input: SetAppEnvironmentVariableInput!) {
setAppEnvironmentVariable(input: $input) {
success
errors {
@@ -55,10 +55,10 @@
}
}
}
}
- `;
- const { response: { setAppEnvironmentVariable: { success, errors } }, requestId } = await this.graphqlClient.mutate(mutation, {
+ `);
+ const { response, requestId } = await this.graphqlClient.mutate(mutation, {
input: {
environment: {
appId: details.appId,
key: details.environment
@@ -69,8 +69,9 @@
encrypt: details.encrypt
}
}
});
+ const { success, errors } = (0, cli_shared_1.requireMutationPayload)(response.setAppEnvironmentVariable, requestId);
const error = (0, cli_shared_1.getError)(errors);
if (!success) {
throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, {
requestId,
@@ -79,9 +80,9 @@
});
}
}
async deleteEnvironmentVariable(details) {
- const mutation = `
+ const mutation = (0, cli_shared_1.graphql)(`
mutation forge_cli_deleteAppEnvironmentVariable($input: DeleteAppEnvironmentVariableInput!) {
deleteAppEnvironmentVariable(input: $input) {
success
errors {
@@ -92,18 +93,19 @@
}
}
}
}
- `;
- const { response: { deleteAppEnvironmentVariable: { success, errors } }, requestId } = await this.graphqlClient.mutate(mutation, {
+ `);
+ const { response, requestId } = await this.graphqlClient.mutate(mutation, {
input: {
environment: {
appId: details.appId,
key: details.environment
},
key: details.key
}
});
+ const { success, errors } = (0, cli_shared_1.requireMutationPayload)(response.deleteAppEnvironmentVariable, requestId);
const error = (0, cli_shared_1.getError)(errors);
if (!success) {
throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, {
requestId,