New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@screencloud/studio-graphql-client

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@screencloud/studio-graphql-client - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

0

build/constants.d.ts

@@ -0,0 +0,0 @@ export declare const studioGraphQLEndpoints: Readonly<{

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export * from './constants';

@@ -0,0 +0,0 @@ "use strict";

export declare function polyfillFetch(): void;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { GraphQLClient } from 'graphql-request';

18

build/StudioGraphQLClient.js
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -63,7 +52,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

}
this.graphQLClient = new graphql_request_1.GraphQLClient(endpoint, {
headers: __assign({}, (token ? { authorization: "Bearer " + token } : {})),
credentials: 'include',
mode: 'no-cors',
});
this.graphQLClient = new graphql_request_1.GraphQLClient(endpoint);
this.graphQLClient.setHeader('authorization', token ? "Bearer " + token : '');
}

@@ -70,0 +56,0 @@ StudioGraphQLClient.prototype.request = function (query, variables) {

@@ -82,4 +82,2 @@ "use strict";

},
credentials: 'include',
mode: 'no-cors',
}));

@@ -86,0 +84,0 @@ });

@@ -0,0 +0,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,0 +0,0 @@ import { StudioGraphQLClient, StudioGraphQLClientOptions } from './StudioGraphQLClient';

@@ -0,0 +0,0 @@ "use strict";

13

package.json
{
"name": "@screencloud/studio-graphql-client",
"version": "1.0.2",
"description": "",

@@ -46,3 +45,13 @@ "main": "build/index.js",

"node-fetch": "^2.6.0"
}
},
"release": {
"branches": [
"main",
{
"name": "pre",
"prerelease": "beta"
}
]
},
"version": "1.0.3"
}

@@ -5,4 +5,12 @@ # @screencloud/studio-graphql-client

## `StudioGraphQLClient`-class
## install
This project is exposed as a public npm package
Run `npm i -S @screencloud/studio-graphql-client` to add it to your project.
## usage
### `StudioGraphQLClient`-class
A minimalistic class for quick and easy graphql requests. Wraps around the popular `graphql-request` npm package.

@@ -21,5 +29,5 @@

- Your endpoint is shown on the "Developer"-tab in your studio account settings.
- You can also use 'eu' or 'us' as shorthands if you know your region.
- You can also use `'eu'` or `'us'` as shorthands if you know your region.
### Making requests
#### executing queries

@@ -33,5 +41,20 @@ Use `async request()` to run queries against the API.

});
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 function
### `getClient()` singleton helper function
A function that exposes a shared instance (aka. singleton) to your package or script.

@@ -61,3 +84,3 @@

## nodejs and `fetch()`
### nodejs and `fetch()`
The `StudioGraphQLClient`-class by default requires `fetch` to be a globally available function. This is always the case

@@ -74,6 +97,6 @@ in modern browsers, but may not be the case in your local nodejs.

## Other functions
### other functions
The package exposes most of its helper functions for various use-cases.
### `isStudioGraphQLToken(str: string): boolean`
#### `isStudioGraphQLToken(str: string): boolean`
Returns true if a string is shaped like a valid studio graphql token;

@@ -83,3 +106,3 @@

### `parseGraphQLRequest(query: string): undefined`
#### `parseGraphQLRequest(query: string): undefined`
Attempts to parse the supplied `query`-argument as a graphql request. Throws if an invalid request is provided.

@@ -89,3 +112,3 @@

### `mapStudioGraphQLEndpoint(endpoint: string): string | undefined`
#### `mapStudioGraphQLEndpoint(endpoint: string): string | undefined`
Maps a graphql endpoint such as `'eu'` or `'us'` to the full endpoint url of that region.

@@ -96,2 +119,2 @@ Url-like strings will be returned as they are.

This is done by `StudioGraphQLCLient` by default during construction.
This is done by `StudioGraphQLCLient` by default during construction.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc