Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
nuxt-graphql-client
Advanced tools
- Zero Configuration - 🚀 [Nuxt 3](https://v3.nuxtjs.org) Support - Full Typescript Support - HMR (Hot Module Reload) for GraphQL documents - Minimal [GraphQL Client](https://github.com/prisma-labs/graphql-request#graphql-request) + [Code Generation](http
⚡️ Minimal GraphQL Client + Code Generation for Nuxt
⚡️ Minimal GraphQL Client + Code Generation for Nuxt
# using yarn
yarn add nuxt-graphql-client
# using npm
npm install nuxt-graphql-client --save
nuxt-graphql-client
to the buildModules
section of nuxt.config.ts
Configuration Optionsimport { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
buildModules: ['nuxt-graphql-client'],
gql: {
// configuration
},
})
GQL_HOST
to the URL of your GraphQL APIpublicRuntimeConfig: {
GQL_HOST: 'https://api.spacex.land/graphql' // SpaceX GraphQL API for example
}
Example using the SpaceX GraphQL API:
./queries/starlink.gql
- This query will for the SpaceX API to retrieve the launches for Starlink missions.
query launches($sort: String = "launch_year", $order: String = "desc") {
launches(sort: $sort, order: $order, find: { mission_name: "Starlink" }) {
id
details
mission_name
launch_year
launch_success
links {
article_link
flickr_images
}
rocket {
rocket_name
rocket_type
}
}
}
With autoImport
enabled, the query above can be accessed in the Vue portion of your app by prefixing the Operation name (launches
in this example with the Function Prefix).
The launches
query can be executed as GqlLaunches()
Run yarn dev
for the nuxt-graphql-client
module to generate the necessary types and functions.
useGql
composable to execute all your queries / mutations.autoImport
enabled, your queries / mutations are accessible within your app by calling the Operation name prefixed by Function Prefix<script lang="ts" setup>
const { data } = await useAsyncData('starlink', () => GqlLaunches({ order: 'desc' }))
</script>
Your data is now fully-typed based on it's pertinent GraphQL Document.
This module can be configured by adding a gql
section inside your nuxt.config.ts
import { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
gql: {
/**
* Prevent codegen from printing to console in dev mode
*
* @type boolean
* @default true
*/
silent: boolean,
/**
* Enable hot reloading for GraphQL documents
*
* @type boolean
* @default true
*/
watch: boolean,
/**
* Auto import functions based on the operation names of your queries & mutations
*
* @type boolean
* @default true
*/
autoImport: boolean,
/**
* Prefix for auto imported functions
*
* @type string
* @default 'Gql'
*/
functionPrefix: string,
/**
* Path to folder(s) containing .gql or .graphql files. Can be omitted,
* module will automatically search for GraphQL Documents in the project's root directory.
*
* @note Useful for mono repos.
*
* @type string[]
* @example ['../shared/queries']
* */
documentPaths: string[],
/**
* Only generate the types for the operations in your GraphQL documents.
* When set to true, only the types needed for your operations will be generated.
* When set to false, all types from the GraphQL API will be generated.
*
* @type boolean
* @default true
* */
onlyOperationTypes: boolean
/**
* Allows generating multiple clients with different GraphQL hosts.
*
* @note this option overrides the `GQL_HOST` in `publicRuntimeConfig`.
* */
clients: GqlClientOptions[]
},
publicRuntimeConfig: {
/**
* URL pointing to a GraphQL endpoint
*
* @type string
*/
GQL_HOST: string,
},
})
nuxt-graphql-client
is developed by @diizzayy.
Special thanks to @danielroe for helping me navigate and making this possible!
FAQs
[![nuxt-graphql-client](./docs/public/cover.png)](https://nuxt-graphql-client.web.app)
The npm package nuxt-graphql-client receives a total of 7,274 weekly downloads. As such, nuxt-graphql-client popularity was classified as popular.
We found that nuxt-graphql-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.