Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@screencloud/studio-graphql-client
Advanced tools
a micro package for querying the studio graphql api.
a micro package for querying the studio graphql api.
This project is exposed as a public npm package
Run npm i -S @screencloud/studio-graphql-client
to add it to your project.
StudioGraphQLClient
-classA minimalistic class for quick and easy graphql requests. Wraps around the popular graphql-request
npm package.
Instantiate with StudioGraphQLClientOptions
such as
const client = new StudioGraphQLClient({
endpoint: '<your graphql endpoint>',
token: '<your developer token>',
});
Notes:
token
or set it to undefined
to run anonymous queries against the API.'eu'
or 'us'
as shorthands if you know your region.Use async request()
to run queries against the API.
const client = new StudioGraphQLClient({
endpoint: '<your graphql endpoint>',
token: '<your developer token>',
});
client.request(`
query {
currentOrg {
id
name
}
}
`).then((result) => {
if (result.errors) {
console.log('The request was unsuccessful', result.errors);
} else {
console.log('Your current org is ', result.data);
}
});
getClient()
singleton helper functionA function that exposes a shared instance (aka. singleton) to your package or script.
Run initClient()
once during startup of your application.
import { initClient } from '@screencloud/studio-graphql-client';
initClient({
endpoint: '<your graphql endpoint>',
token: '<your developer token>',
});
Afterwards retrieve the singleton via getClient()
in other files
import { getClient } from '@screencloud/studio-graphql-client';
const client = getClient();
client.request('<your graphql query>').then((result) => {
console.log('query result', result);
});
fetch()
The StudioGraphQLClient
-class by default requires fetch
to be a globally available function. This is always the case
in modern browsers, but may not be the case in your local nodejs.
The package offers a polyfillFetch()
-function to quickly help out.
import { polyfillFetch } from '@screencloud/studio-graphql-client';
polyfillFetch();
The package exposes most of its helper functions for various use-cases.
isStudioGraphQLToken(str: string): boolean
Returns true if a string is shaped like a valid studio graphql token;
This is used by StudioGraphQLCLient
by default during construction.
parseGraphQLRequest(query: string): undefined
Attempts to parse the supplied query
-argument as a graphql request. Throws if an invalid request is provided.
This is done by StudioGraphQLCLient
by default when calling request()
.
mapStudioGraphQLEndpoint(endpoint: string): string | undefined
Maps a graphql endpoint such as 'eu'
or 'us'
to the full endpoint url of that region.
Url-like strings will be returned as they are.
If the value can't be mapped otherwise, then undefined
will be returned.
This is done by StudioGraphQLCLient
by default during construction.
FAQs
a micro package for querying the studio graphql api.
The npm package @screencloud/studio-graphql-client receives a total of 12 weekly downloads. As such, @screencloud/studio-graphql-client popularity was classified as not popular.
We found that @screencloud/studio-graphql-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.