@forge/cli
14.1.0-next.21-experimental-554d41714.1.0-next.19-experimental-fd0ebbc
out/deploy/uploader/artifact-graphql-client.js~
out/deploy/uploader/artifact-graphql-client.jsModified+13−10
Index: package/out/deploy/uploader/artifact-graphql-client.js
===================================================================
--- package/out/deploy/uploader/artifact-graphql-client.js
+++ package/out/deploy/uploader/artifact-graphql-client.js
@@ -25,9 +25,9 @@
constructor(graphqlClient) {
this.graphqlClient = graphqlClient;
}
async getUploadUrl(appDetails, buildTag) {
- const artifactQuery = `
+ const artifactQuery = (0, cli_shared_1.graphql)(`
mutation forge_cli_getDeploymentUrl($input: CreateAppDeploymentUrlInput!) {
createAppDeploymentUrl(input: $input) {
success
errors {
@@ -39,15 +39,16 @@
}
deploymentUrl
}
}
- `;
- const { response: { createAppDeploymentUrl: { deploymentUrl, success, errors } }, requestId } = await this.graphqlClient.mutate(artifactQuery, {
+ `);
+ const { response, requestId } = await this.graphqlClient.mutate(artifactQuery, {
input: {
appId: appDetails.id,
buildTag
}
});
+ const { deploymentUrl, success, errors } = (0, cli_shared_1.requireMutationPayload)(response.createAppDeploymentUrl, requestId);
const error = (0, cli_shared_1.getError)(errors);
if (!success) {
throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, {
requestId,
@@ -60,9 +61,9 @@
}
return deploymentUrl;
}
async processCombinedBuild(appDetails, buildTag) {
- const query = `
+ const query = (0, cli_shared_1.graphql)(`
mutation forge_cli_processCombinedAppBuild($input: ProcessCombinedAppBuildInput!) {
processCombinedAppBuild(input: $input) {
success
errors {
@@ -74,15 +75,16 @@
}
buildTag
}
}
- `;
- const { response: { processCombinedAppBuild: { success, errors } }, requestId } = await this.graphqlClient.mutate(query, {
+ `);
+ const { response, requestId } = await this.graphqlClient.mutate(query, {
input: {
appId: appDetails.id,
buildTag
}
});
+ const { success, errors } = (0, cli_shared_1.requireMutationPayload)(response.processCombinedAppBuild, requestId);
const error = (0, cli_shared_1.getError)(errors);
if (!success) {
throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, {
requestId,
@@ -91,9 +93,9 @@
});
}
}
async getHostedResourcesUploadUrls(appDetails, resourceKeys, environmentKey, buildTag) {
- const artifactQuery = `
+ const artifactQuery = (0, cli_shared_1.graphql)(`
mutation forge_cli_getHostedResourcesUploadUrls($input: CreateHostedResourceUploadUrlInput!) {
createHostedResourceUploadUrl(input: $input) {
success
errors {
@@ -109,17 +111,18 @@
}
uploadId
}
}
- `;
- const { response: { createHostedResourceUploadUrl: { preSignedUrls, success, errors, uploadId } }, requestId } = await this.graphqlClient.mutate(artifactQuery, {
+ `);
+ const { response, requestId } = await this.graphqlClient.mutate(artifactQuery, {
input: {
appId: appDetails.id,
environmentKey: environmentKey,
resourceKeys,
buildTag
}
});
+ const { preSignedUrls, success, errors, uploadId } = (0, cli_shared_1.requireMutationPayload)(response.createHostedResourceUploadUrl, requestId);
const error = (0, cli_shared_1.getError)(errors);
if (!success) {
throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, {
requestId,
@@ -129,9 +132,9 @@
}
if (!preSignedUrls) {
throw new NoPresignedUrlsError();
}
- return { preSignedUrls, uploadId };
+ return { preSignedUrls: preSignedUrls, uploadId };
}
}
exports.ArtifactGraphQLClient = ArtifactGraphQLClient;
//# sourceMappingURL=artifact-graphql-client.js.map
\ No newline at end of file