
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@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
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 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 uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.