![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@graphitation/apollo-react-relay-duct-tape
Advanced tools
A compatibility wrapper that provides the react-relay API on top of Apollo Client.
A compatibility wrapper that provides the react-relay API on top of Apollo Client.
The name is a reference to the Apollo 13 mission.
Use this together with relay-compiler-language-graphitation to have typings generated.
Install the packages from this repo:
yarn add @graphitation/apollo-react-relay-duct-tape
yarn add --dev relay-compiler-language-graphitation
Patch your version of @apollo/client
using the patch found in the patches directory. You can either do so manually or use a tool like patch-package.
For an expedient developer-experience, you will want to install the watchman
tool.
$ brew install watchman
$ choco install watchman
Configure Apollo Client's cache to automatically add __typename
field selections, which concrete types implement the Node
interface, and the type-policies needed to read the watch query data from the store:
import { InMemoryCache } from "@apollo/client";
import { typePolicies } from "@graphitation/apollo-react-relay-duct-tape";
const cache = new InMemoryCache({
addTypename: true,
// Be sure to specify types that implement the Node interface
// See https://www.apollographql.com/docs/react/data/fragments/#using-fragments-with-unions-and-interfaces
possibleTypes: {
Node: ["Todo"],
},
// Either use the `typePolicies` object directly or otherwise extend appropriately
typePolicies: {
Query: {
fields: {
__fragments: {
read: typePolicies.Query.fields.__fragments.read,
},
node: {
read: typePolicies.Query.fields.node.read,
},
},
},
Node: {
fields: {
__fragments: {
read: typePolicies.Node.fields.__fragments.read,
},
},
},
},
});
Configure webpack to transform your code by replacing inline GraphQL documents with their compiled artefacts:
const {
createImportDocumentsTransform,
} = require("@graphitation/apollo-react-relay-duct-tape/lib/storeObservation/createImportDocumentsTransform");
const config: webpack.Configuration = {
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/,
options: {
getCustomTransformers: () => ({
before: [createImportDocumentsTransform()],
}),
},
},
],
},
};
TODO: Have a Node
interface definition
TODO: Add node
root field
Optionally, if you rely on Apollo Client's @client
directive, be sure to explicitly add it to your local copy of your schema, otherwise the compiler will not accept its use.
directive @client(always: Boolean) on FIELD
In a shell, start the compiler and point it to your schema and source. Depending on the size of the code-base a first run may take a while, but subsequent builds should cached. For developer-expedience, it is advised to run the compiler using the watch mode -- provided you have installed the watchman
tool.
$ yarn graphitation-compiler \
--schema ./path/to/schema.graphql \
--src ./path/to/source \
--watch
TODO:
Node
interface to type that you want to start a new watch query forTODO:
Node
interface instead. The one other type we can assume to exist is the Query
type.FAQs
A compatibility wrapper that provides the react-relay API on top of Apollo Client.
We found that @graphitation/apollo-react-relay-duct-tape demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.