Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@homebound/graphql-typescript-response-factories
Advanced tools
This graphql-code-generator
plugin generates factory methods for the react-apollo MockedResponse
s that are used for testing client-side GraphQL code.
I.e. for a given query like:
query GetAuthorSummaries {
authorSummaries {
author {
name
}
}
}
This plugin will generate a newGetAuthorSummariesResponse
factory function:
export function newGetAuthorSummariesResponse(
data: GetAuthorSummariesQuery | Error,
): MockedResponse<GetAuthorSummariesQueryVariables, GetAuthorSummariesQuery> {
return {
request: { query: GetAuthorSummariesDocument },
result: { data: data instanceof Error ? undefined : data },
error: data instanceof Error ? data : undefined,
};
}
That you can use in a test like:
const response = newGetAuthorSummariesResponse({
// Use newAuthorSummary from the graphql-typescript-factories project
authorSummaries: [newAuthorSummary()],
});
// Something react-testing-library's render
const component = render(
<MockedProvider mocks={[response]}>
<YourComponent />
</MockedProvider>,
);
Or you can simulate an error with:
const response = newGetAuthorSummariesResponse(new Error("bad"));
For non-react-apollo
-specific factories for the rest of your GraphQL schema's types, see the graphql-typescript-factories sister project.
yarn add -D @homebound/graphql-typescript-response-factories
Add the plugin to your graphql-codegen.yml
, i.e.:
overwrite: true
schema: ./schema.json
documents: src/**/*.graphql
generates:
src/generated/graphql-types.tsx:
plugins:
- typescript
- typescript-operations
- typescript-react-apollo
- "@homebound/graphql-typescript-factories"
- "@homebound/graphql-typescript-response-factories"
MIT
FAQs
Unknown package
The npm package @homebound/graphql-typescript-response-factories receives a total of 84 weekly downloads. As such, @homebound/graphql-typescript-response-factories popularity was classified as not popular.
We found that @homebound/graphql-typescript-response-factories demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 39 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.