Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
graphql-codegen-data-persist
Advanced tools
This plugin for [GraphQL Code Generator](https://www.graphql-code-generator.com/) facilitates fetching data from a GraphQL server using specific queries and subsequently generates static TypeScript files that encapsulate this data.
This plugin for GraphQL Code Generator facilitates fetching data from a GraphQL server using specific queries and subsequently generates static TypeScript files that encapsulate this data.
To install the plugin, run:
npm install --save-dev @graphql-codegen/plugin-helpers graphql-request
In your codegen.yml
file, the plugin should be configured as follows:
schema: "http://localhost:4000/graphql"
documents: "src/**/*.graphql"
generates:
src/generated/staticData.ts:
plugins:
- "path/to/your-plugin"
config:
url: "http://localhost:4000/graphql"
queries:
- |
query {
data {
foo
bar
}
}
- |
query {
otherData {
id
value
}
}
outputFile: "src/generated/staticData.ts"
Define your GraphQL queries to fetch the required static data.
Configure the plugin in your codegen.yml
file as shown above.
Run the GraphQL Code Generator:
npx graphql-codegen
The plugin will generate a TypeScript file containing static constants that hold the data fetched by your queries.
The generated TypeScript file (staticData.ts
) will include static constants representing the results of your queries, structured as follows:
export const Query0 = {
data: {
boo: false,
bar: true
// ... other data
}
};
export const Query1 = {
otherData: {
id: 1,
value: 'example'
// ... other data
}
};
// ... other queries
To build the plugin for both CommonJS and ES Modules:
Ensure TypeScript is installed:
npm install --save-dev typescript
Execute the build scripts:
npm run build:cjs
npm run build:esm
The compiled files will be available in the cjs
and esm
directories.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
This plugin for [GraphQL Code Generator](https://www.graphql-code-generator.com/) facilitates fetching data from a GraphQL server using specific queries and subsequently generates static TypeScript files that encapsulate this data.
The npm package graphql-codegen-data-persist receives a total of 0 weekly downloads. As such, graphql-codegen-data-persist popularity was classified as not popular.
We found that graphql-codegen-data-persist 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.