Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected getRemoveInstanceMutation(): string {
const jsonQuery = {
mutation: {
removeInstance: {
__args: {
id: this.instance.id,
},
// TODO Add `removed` field.
},
},
};
return jsonToGraphQLQuery(jsonQuery);
}
}
private async _getGraphQLQueryResult(query: object) {
const httpResult = await this._httpClient({
url: this.apiUrl,
method: 'POST',
data: { query: jsonToGraphQLQuery(query) }
});
if (!httpResult.data) {
throw this._createHttpError('Received no data from the API', httpResult);
}
if (httpResult.data.errors) {
let message = 'GraphQL errors were returned';
if (httpResult.data.errors[0] && httpResult.data.errors[0].message) {
message += ': ' + httpResult.data.errors[0].message;
}
throw this._createHttpError(message, httpResult);
}
return httpResult;
}
protected getRemoveAssetMutation(): string {
const mutation = {
mutation: {
removeAsset: {
__args: {
id: this.asset.id,
projectId: this.asset.project.id,
},
},
},
};
return jsonToGraphQLQuery(mutation);
}
}
protected getCreateDefinitionMutation(): string {
const mutation = {
mutation: {
createDefinition: {
__args: this.mapDefinitionToDto(),
id: true,
name: true,
},
},
};
return jsonToGraphQLQuery(mutation);
}
protected getRegenerateDeployKeyMutation(): string {
const jsonQuery = {
mutation: {
regenerateDeployKey: {
__args: {
cloneUrl: this.deployKey.cloneUrl,
},
cloneUrl: true,
},
},
};
return jsonToGraphQLQuery(jsonQuery);
}