How to use typed-graphqlify - 10 common examples

To help you get started, we’ve selected a few typed-graphqlify 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 acro5piano / typed-graphqlify / examples / index.ts View on Github external
/* tslint:disable */

import { params, query, types } from 'typed-graphqlify'

async function executeGraphql(gqlString: string): Promise {
  return 0
}

const getUserQuery = {
  getUser: {
    user: params(
      { id: 1 },
      {
        id: types.number,
        name: types.string,
        bankAccount: {
          id: types.number,
          branch: types.string,
        },
      },
    ),
  },
}

const gqlString = query(getUserQuery)

console.log(gqlString)
github acro5piano / typed-graphqlify / examples / index.ts View on Github external
getUser: {
    user: params(
      { id: 1 },
      {
        id: types.number,
        name: types.string,
        bankAccount: {
          id: types.number,
          branch: types.string,
        },
      },
    ),
  },
}

const gqlString = query(getUserQuery)

console.log(gqlString)
// =>
//   query getUser(id: 1) {
//     user {
//       id
//       name
//       bankAccount {
//         id
//         name
//       }
//     }
//   }

async function run() {
  // We would like to type this!
github acro5piano / typed-graphqlify / examples / index.ts View on Github external
import { params, query, types } from 'typed-graphqlify'

async function executeGraphql(gqlString: string): Promise {
  return 0
}

const getUserQuery = {
  getUser: {
    user: params(
      { id: 1 },
      {
        id: types.number,
        name: types.string,
        bankAccount: {
          id: types.number,
          branch: types.string,
        },
      },
    ),
  },
}

const gqlString = query(getUserQuery)

console.log(gqlString)
// =>
//   query getUser(id: 1) {
//     user {
//       id
//       name
//       bankAccount {
//         id
github acro5piano / typed-graphqlify / examples / index.ts View on Github external
/* tslint:disable */

import { params, query, types } from 'typed-graphqlify'

async function executeGraphql(gqlString: string): Promise {
  return 0
}

const getUserQuery = {
  getUser: {
    user: params(
      { id: 1 },
      {
        id: types.number,
        name: types.string,
        bankAccount: {
          id: types.number,
          branch: types.string,
        },
      },
    ),
  },
}

const gqlString = query(getUserQuery)

console.log(gqlString)
// =>
//   query getUser(id: 1) {
//     user {
//       id
github acro5piano / typed-graphqlify / examples / index.ts View on Github external
/* tslint:disable */

import { params, query, types } from 'typed-graphqlify'

async function executeGraphql(gqlString: string): Promise {
  return 0
}

const getUserQuery = {
  getUser: {
    user: params(
      { id: 1 },
      {
        id: types.number,
        name: types.string,
        bankAccount: {
          id: types.number,
          branch: types.string,
        },
      },
    ),
  },
}

const gqlString = query(getUserQuery)

console.log(gqlString)
// =>
//   query getUser(id: 1) {
//     user {
github acro5piano / typed-graphqlify / examples / index.ts View on Github external
import { params, query, types } from 'typed-graphqlify'

async function executeGraphql(gqlString: string): Promise {
  return 0
}

const getUserQuery = {
  getUser: {
    user: params(
      { id: 1 },
      {
        id: types.number,
        name: types.string,
        bankAccount: {
          id: types.number,
          branch: types.string,
        },
      },
    ),
  },
}

const gqlString = query(getUserQuery)

console.log(gqlString)
// =>
//   query getUser(id: 1) {
//     user {
//       id
//       name
//       bankAccount {
github paypal / paypal-smart-payment-buttons / server / service / fundingEligibility.js View on Github external
// if (isDefined(basicFundingEligibility[fundingSource].vaultable)) {
            //    delete fundingQuery[fundingSource].vaultable;
            // }

            if (isDefined(basicFundingEligibility[fundingSource].branded)) {
                delete fundingQuery[fundingSource].branded;
            }

            if (!Object.keys(fundingQuery[fundingSource]).length) {
                delete fundingQuery[fundingSource];
            }
        }
    }

    return query('GetFundingEligibility', params(InputTypes, {
        fundingEligibility: params(Inputs, fundingQuery)
    }));
}
github paypal / paypal-smart-payment-buttons / server / service / fundingEligibility.js View on Github external
// if (isDefined(basicFundingEligibility[fundingSource].vaultable)) {
            //    delete fundingQuery[fundingSource].vaultable;
            // }

            if (isDefined(basicFundingEligibility[fundingSource].branded)) {
                delete fundingQuery[fundingSource].branded;
            }

            if (!Object.keys(fundingQuery[fundingSource]).length) {
                delete fundingQuery[fundingSource];
            }
        }
    }

    return query('GetFundingEligibility', params(InputTypes, {
        fundingEligibility: params(Inputs, fundingQuery)
    }));
}
github acro5piano / typed-graphqlify / examples / index.ts View on Github external
async function run() {
  // We would like to type this!
  const result: typeof getUserQuery = await executeGraphql(query(getUserQuery))

  // As we cast `result` to `typeof getUser`,
  // Now, `result` type looks like this:
  // interface result {
  //   getUser: {
  //     id: number
  //     name: string
  //     bankAccount: {
  //       id: number
  //       branch: string
  //     }
  //   }
  // }
}
github infrastructure-components / infrastructure-components / src / datalayer / datalayer-libs.ts View on Github external
export const getEntryQuery = ( entryId, data, fields, context={}) => {
    //console.log("getEntryQuery: ", entryId, data, fields, context);

    if (data == undefined) {
        console.error("getEntryQuery requires a data argument");
        return undefined;
    }

    if (Object.keys(data).length !== 2) {
        console.error("getEntryQuery requires exact 2 fields provided in the data argument");
        return undefined;
    }

    const queryObj = {};
    queryObj[`get_${entryId}`] = params(
        Object.keys(data).reduce((result, key) => {
            result[key] = `"${data[key]}"`;
            return result;
        },{}),
        Object.keys(fields).reduce((result, key) => {
            result[key] = types.string;
            return result;
        },{})
    );

    //console.log("listQuery string: ", query(queryObj));

    return {
        query:gql`${query(queryObj)}`,
        context: context
    }

typed-graphqlify

Build Typed GraphQL Queries in TypeScript. A better TypeScript + GraphQL experience.

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis