How to use the json-to-graphql-query.jsonToGraphQLQuery function in json-to-graphql-query

To help you get started, we’ve selected a few json-to-graphql-query examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github feater-dev / feater / client / src / app / instance / detail / summary / instance-summary.component.ts View on Github external
protected getRemoveInstanceMutation(): string {
        const jsonQuery = {
            mutation: {
                removeInstance: {
                    __args: {
                        id: this.instance.id,
                    },
                    // TODO Add `removed` field.
                },
            },
        };

        return jsonToGraphQLQuery(jsonQuery);
    }
}
github RevJS / revjs / packages / rev-api-client / src / client / backend.ts View on Github external
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;
    }
github feater-dev / feater / client / src / app / asset / detail / asset-detail.component.ts View on Github external
protected getRemoveAssetMutation(): string {
        const mutation = {
            mutation: {
                removeAsset: {
                    __args: {
                        id: this.asset.id,
                        projectId: this.asset.project.id,
                    },
                },
            },
        };

        return jsonToGraphQLQuery(mutation);
    }
}
github feater-dev / feater / client / src / app / definition / add / definition-add.component.ts View on Github external
protected getCreateDefinitionMutation(): string {
        const mutation = {
            mutation: {
                createDefinition: {
                    __args: this.mapDefinitionToDto(),
                    id: true,
                    name: true,
                },
            },
        };

        return jsonToGraphQLQuery(mutation);
    }
github feater-dev / feater / client / src / app / deploy-key / detail / deploy-key-detail.component.ts View on Github external
protected getRegenerateDeployKeyMutation(): string {
        const jsonQuery = {
            mutation: {
                regenerateDeployKey: {
                    __args: {
                        cloneUrl: this.deployKey.cloneUrl,
                    },
                    cloneUrl: true,
                },
            },
        };

        return jsonToGraphQLQuery(jsonQuery);
    }

json-to-graphql-query

This is a simple module that takes a JavaScript object and turns it into a GraphQL query to be sent to a GraphQL server.

MIT
Latest version published 3 months ago

Package Health Score

75 / 100
Full package analysis

Popular json-to-graphql-query functions

Similar packages