Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@shopify/admin-graphql-api-utilities
Advanced tools
A set of utilities to use when consuming Shopify’s admin GraphQL API
@shopify/admin-graphql-api-utilities
A set of utilities to use when consuming Shopify’s admin GraphQL API.
yarn add @shopify/admin-graphql-api-utilities
parseGidType(gid: string): string
Given a Gid string, parse out the type.
import {parseGidType} from '@shopify/admin-graphql-api-utilities';
parseGidType('gid://shopify/Customer/12345');
// → 'Customer'
function parseGid(gid: string): string
Given a Gid string, parse out the id.
import {parseGid} from '@shopify/admin-graphql-api-utilities';
parseGid('gid://shopify/Customer/12345');
// → '12345'
function parseGidWithParams(gid: string): ParsedGid
Given a Gid string, parse out the id and its params.
import {parseGidWithParams} from '@shopify/admin-graphql-api-utilities';
parseGidWithParams('gid://shopify/Customer/12345?sessionId=123&foo=bar');
// → {
// id: '12345',
// params: {sessionId: '123', foo: 'bar'}
// }
function composeGidFactory<N extends string>(namespace: N): Function
Create a new composeGid
with a given namespace instead of the default shopify
namespace.
import {composeGidFactory} from '@shopify/admin-graphql-api-utilities';
const composeGid = composeGidFactory('CustomApp');
composeGid('Product', '123');
// → 'gid://CustomApp/Product/123'
function composeGid<T extends string>(key: T, id: number | string, params: Record<string, string> = {}): Gid<'shopify', T>
Given a key and id, compose a Gid string.
import {composeGid} from '@shopify/admin-graphql-api-utilities';
composeGid('Customer', 12345);
// → 'gid://shopify/Customer/12345'
composeGid('Customer', '67890', {foo: 'bar'});
// → 'gid://shopify/Customer/67890?foo=bar'
function isGidFactory<N extends string>(namespace: N): Function
Create a new isGid
with a given namespace instead of the default shopify
namespace.
import {isGidFactory} from '@shopify/admin-graphql-api-utilities';
const isGid = isGidFactory('CustomApp');
isGid('gid://CustomApp/Product/123');
// → true
isGid('gid://CustomApp/Product/123', 'Customer');
// → false
function isGid<T extends string>(gid: string, key?: T,): boolean
Check if a given string is a valid Gid.
import {isGid} from '@shopify/admin-graphql-api-utilities';
isGid('gid://shopify/Customer/12345');
// → true
isGid('gid://shopify/Customer/12345', 'Customer');
// → false
function nodesFromEdges(edges)
Given an array of edges, return the nodes.
import {nodesFromEdges} from '@shopify/admin-graphql-api-utilities';
nodesFromEdges([
{node: {id: '1', title: 'title one'}},
{node: {id: '2', title: 'title two'}},
]);
// → [{id: '1', title: 'title one'}, {id: '2', title: 'title two'}]
function keyFromEdges(edges, key)
Given an array of edges, return a new array of only the specific key from those nodes.
import {keyFromEdges} from '@shopify/admin-graphql-api-utilities';
keyFromEdges(
[
{node: {id: '1', title: 'title one'}},
{node: {id: '2', title: 'title two'}},
],
'title',
);
// → ['title one', 'title two']
FAQs
A set of utilities to use when consuming Shopify’s admin GraphQL API
The npm package @shopify/admin-graphql-api-utilities receives a total of 43,364 weekly downloads. As such, @shopify/admin-graphql-api-utilities popularity was classified as popular.
We found that @shopify/admin-graphql-api-utilities demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 24 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.