
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@simpleview/sv-graphql-client
Advanced tools
Client and tools for communicating with sv-graphql.
npm install @simpleview/sv-graphql-client
GraphServer
is an for communicating with the sv-graphql
system. It helps eliminate some of the bloat of individual graphQL calls and makes it a little easier to work with.
acct_id
is required for any endpoints on admin
.string
| async () => string
- The token returned from the auth system. Token is required for accessing any of the non-login mechanics.class
- Prefixes which encasulate the behavior of the graphQL apis.In most cases you will be setting the context
at runtime. If so, manually update the context via setting graphServer.context.acct_id = "x"
.
Available prefixes, see the following packages to install the prefixes.
const { GraphServer } = require("@simpleview/sv-graphql-client");
const graphServer = new GraphServer({
graphUrl : GRAPH_URL,
prefixes : [PrefixOne, PrefixTwo]
});
The endpoints on the graphServer prefix should, in general, match 1-to-1 with the arguments and syntax of the GraphQL schema browser.
TestServer
is a tool for spinning up a simple GraphQL server that listens on a port and loads some graphql files via schemaLoader
for it's operations. It's usually used to simplify unit tests.
See TestServer for arguments.
const testServer = new TestServer({
port: 8080,
paths: [
"test/graphqlTest"
]
});
// start the server, listen on the port
await testServer.boot();
// ... run tests ... //
// close the server
await testServer.close();
This function will take a graphQL response and convert null
values to undefined
. It can be helpful for trimming away fields that weren't returned from graph.
This does an by reference modification of the object. It does not return a clone.
const { nullToUndefined } = require("@simpleview/sv-graphql-client");
const result = await someGraphCall();
nullToUndefined(result);
Wrapper function to make it easier to talk to sv-graphql
directly.
string
| async () => string
- The token which will be passed on the Authorization
header as a Bearer
token. If using a function it will be called to return the token.const { query } = require("@simpleview/sv-graphql-client");
const result = await query({
query : `
query($token: String) {
auth {
current
}
}
`,
variables : {
token : "my fake token"
},
url : "https://graphql.simpleviewinc.com/"
});
Simple function for testing if a function is a plain JS object.
schemaLoader takes all of the files present in paths
or loaders
and merges them into a single schema. This allows you to make your larger schema more maintainable by splitting it up into logical units. An example of a modular schema is outlined in Modularizing Your GraphQL Schema.
GraphModule
.GraphModule
. Use this when you need to load graph definitions that are dynamically generated.A GraphModule
is an object of { typeDefs, resolvers, schemaTransformers }
, all keys are optional.
Example GraphModule
:
const { gql } = require("apollo-server");
const typeDefs = gql`
extend type Query {
test_path2: Boolean
}
`;
const resolvers = {
Query: {
test_path2: function() {
return true;
}
}
}
module.exports = {
typeDefs,
resolvers
}
const { schemaLoader } = require("@simpleview/sv-graphql-client");
const schema = await schemaLoader({
paths : ['/app/lib/graphql']
});
const server = new ApolloServer({
schema,
...
});
sudo npm run docker
yarn run build
exit
sudo npm run publish VERSION
FAQs
Client for communicating with sv-graphql
We found that @simpleview/sv-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 how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.