@forge/cli
14.1.0-next.21-experimental-554d41714.1.0-next.19-experimental-fd0ebbc
out/rollout/graphql-client.js~
out/rollout/graphql-client.jsModified+6−7
Index: package/out/rollout/graphql-client.js
===================================================================
--- package/out/rollout/graphql-client.js
+++ package/out/rollout/graphql-client.js
@@ -13,9 +13,9 @@
constructor(graphqlClient) {
this.graphqlClient = graphqlClient;
}
async createRollingRelease(appId, environmentId, limit) {
- const query = `
+ const mutation = (0, cli_shared_1.graphql)(`
mutation forge_cli_createRollingRelease($appId: ID!, $environmentId: ID!, $limit: Int) {
ecosystem {
createRollingRelease(appId: $appId, environmentId: $environmentId, limit: $limit) {
success
@@ -30,19 +30,18 @@
}
}
}
}
- `;
+ `);
const variables = {
appId,
environmentId,
...(limit !== undefined && { limit })
};
- const { response: { ecosystem: { createRollingRelease } }, requestId } = await this.graphqlClient.mutate(query, variables);
- if (!createRollingRelease) {
- throw new cli_shared_1.GraphQlMutationError(cli_shared_1.Text.rollout.start.error.noResponse(requestId), { requestId });
- }
- const { success, rolloutId, targetVersionId, errors } = createRollingRelease;
+ const { response, requestId } = await this.graphqlClient.mutate(mutation, variables);
+ const { createRollingRelease } = (0, cli_shared_1.requireMutationPayload)(response.ecosystem, requestId);
+ const payload = (0, cli_shared_1.requireMutationPayload)(createRollingRelease, requestId);
+ const { success, rolloutId, targetVersionId, errors } = payload;
if (!success) {
const errorList = (errors ?? []).map((error) => error?.message).filter(Boolean);
throw new Error(errorList.length > 0 ? errorList.join('\n') : cli_shared_1.Text.rollout.start.error.unknown);
}