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

gh-gql

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gh-gql - npm Package Compare versions

Comparing version 2.0.2 to 3.0.0

SECURITY.md

71

CHANGELOG.md
# Important Changes
## Engines
- Bumped **node** from `14.0.0` to `14.13.1`
## Dependencies

@@ -8,3 +12,6 @@

- Bumped **[dotenv](https://www.npmjs.com/package/dotenv/v/10.0.0)** from `9.0.0` to `10.0.0`
- Bumped **[graphql](https://www.npmjs.com/package/graphql/v/16.0.1)** from `15.5.0` to `16.0.1`
- Bumped **[graphql-request](https://www.npmjs.com/package/graphql-request/v/3.6.1)** from `3.4.0` to `3.6.1`
- Bumped **[graphql-tag](https://www.npmjs.com/package/graphql-tag/v/2.12.6)** from `2.12.4` to `2.12.6`
- Bumped **[universal-user-agent](https://www.npmjs.com/package/universal-user-agent/v/7.0.0)** from `6.0.0` to `7.0.0`

@@ -16,33 +23,43 @@ </details>

- Bumped **[@babel/plugin-transform-runtime](https://www.npmjs.com/package/@babel/plugin-transform-runtime/v/7.14.3)** from `7.13.15` to `7.14.3`
- Bumped **[@babel/preset-env](https://www.npmjs.com/package/@babel/preset-env/v/7.14.4)** from `7.14.1` to `7.14.4`
- Bumped **[@graphql-codegen/cli](https://www.npmjs.com/package/@graphql-codegen/cli/v/1.21.5)** from `1.21.4` to `1.21.5`
- Bumped **[@graphql-codegen/import-types-preset](https://www.npmjs.com/package/@graphql-codegen/import-types-preset/v/1.18.2)** from `1.18.1` to `1.18.2`
- Bumped **[@graphql-codegen/near-operation-file-preset](https://www.npmjs.com/package/@graphql-codegen/near-operation-file-preset/v/1.18.1)** from `1.18.0` to `1.18.1`
- Bumped **[@graphql-codegen/typescript](https://www.npmjs.com/package/@graphql-codegen/typescript/v/1.22.1)** from `1.22.0` to `1.22.1`
- Bumped **[@graphql-codegen/typescript-graphql-request](https://www.npmjs.com/package/@graphql-codegen/typescript-graphql-request/v/3.2.1)** from `3.1.1` to `3.2.1`
- Bumped **[@graphql-codegen/typescript-operations](https://www.npmjs.com/package/@graphql-codegen/typescript-operations/v/1.18.0)** from `1.17.16` to `1.18.0`
- Bumped **[@tagproject/ts-package-shared-config](https://www.npmjs.com/package/@tagproject/ts-package-shared-config/v/4.0.0)** from `3.0.0` to `4.0.0`
- Bumped **[@types/node](https://www.npmjs.com/package/@types/node/v/15.6.1)** from `15.0.2` to `15.6.1`
- Bumped **[@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin/v/4.26.0)** from `4.22.1` to `4.26.0`
- Bumped **[@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser/v/4.26.0)** from `4.22.1` to `4.26.0`
- Bumped **[babel-jest](https://www.npmjs.com/package/babel-jest/v/27.0.2)** from `26.6.3` to `27.0.2`
- Bumped **[changelog-guru](https://www.npmjs.com/package/changelog-guru/v/3.0.2)** from `3.0.1` to `3.0.2`
- Bumped **[cspell](https://www.npmjs.com/package/cspell/v/5.5.2)** from `5.4.0` to `5.5.2`
- Bumped **[eslint](https://www.npmjs.com/package/eslint/v/7.27.0)** from `7.25.0` to `7.27.0`
- Bumped **[eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import/v/2.23.4)** from `2.22.1` to `2.23.4`
- Bumped **[ghinfo](https://www.npmjs.com/package/ghinfo/v/2.0.3)** from `2.0.2` to `2.0.3`
- Bumped **[jest](https://www.npmjs.com/package/jest/v/27.0.3)** from `26.6.3` to `27.0.3`
- Bumped **[prettier](https://www.npmjs.com/package/prettier/v/2.3.0)** from `2.2.1` to `2.3.0`
- Bumped **[ts-jest](https://www.npmjs.com/package/ts-jest/v/27.0.2)** from `26.5.6` to `27.0.2`
- Bumped **[typescript](https://www.npmjs.com/package/typescript/v/4.3.2)** from `4.2.4` to `4.3.2`
- Removed **[typedoc](https://www.npmjs.com/package/typedoc/v/0.20.36)**, with `^0.20.36`
- Removed **[typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown/v/3.8.0)**, with `^3.8.0`
- Bumped **[@babel/plugin-transform-runtime](https://www.npmjs.com/package/@babel/plugin-transform-runtime/v/7.16.4)** from `7.14.3` to `7.16.4`
- Bumped **[@babel/preset-env](https://www.npmjs.com/package/@babel/preset-env/v/7.16.4)** from `7.14.4` to `7.16.4`
- Bumped **[@graphql-codegen/add](https://www.npmjs.com/package/@graphql-codegen/add/v/3.1.0)** from `2.0.2` to `3.1.0`
- Bumped **[@graphql-codegen/cli](https://www.npmjs.com/package/@graphql-codegen/cli/v/2.3.0)** from `1.21.5` to `2.3.0`
- Bumped **[@graphql-codegen/import-types-preset](https://www.npmjs.com/package/@graphql-codegen/import-types-preset/v/2.1.8)** from `1.18.2` to `2.1.8`
- Bumped **[@graphql-codegen/near-operation-file-preset](https://www.npmjs.com/package/@graphql-codegen/near-operation-file-preset/v/2.2.2)** from `1.18.1` to `2.2.2`
- Bumped **[@graphql-codegen/typescript](https://www.npmjs.com/package/@graphql-codegen/typescript/v/2.4.1)** from `1.22.1` to `2.4.1`
- Bumped **[@graphql-codegen/typescript-graphql-request](https://www.npmjs.com/package/@graphql-codegen/typescript-graphql-request/v/4.3.1)** from `3.2.1` to `4.3.1`
- Bumped **[@graphql-codegen/typescript-operations](https://www.npmjs.com/package/@graphql-codegen/typescript-operations/v/2.2.1)** from `1.18.0` to `2.2.1`
- Bumped **[@tagproject/ts-package-shared-config](https://www.npmjs.com/package/@tagproject/ts-package-shared-config/v/6.0.0)** from `4.0.0` to `6.0.0`
- Bumped **[@types/jest](https://www.npmjs.com/package/@types/jest/v/27.0.3)** from `26.0.23` to `27.0.3`
- Bumped **[@types/node](https://www.npmjs.com/package/@types/node/v/16.11.10)** from `15.6.1` to `16.11.10`
- Bumped **[@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin/v/5.4.0)** from `4.26.0` to `5.4.0`
- Bumped **[@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser/v/5.4.0)** from `4.26.0` to `5.4.0`
- Bumped **[babel-jest](https://www.npmjs.com/package/babel-jest/v/27.3.1)** from `27.0.2` to `27.3.1`
- Bumped **[cspell](https://www.npmjs.com/package/cspell/v/5.13.1)** from `5.5.2` to `5.13.1`
- Bumped **[dotenv-cli](https://www.npmjs.com/package/dotenv-cli/v/4.1.0)** from `4.0.0` to `4.1.0`
- Bumped **[eslint](https://www.npmjs.com/package/eslint/v/8.3.0)** from `7.27.0` to `8.3.0`
- Bumped **[eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import/v/2.25.3)** from `2.23.4` to `2.25.3`
- Bumped **[eslint-plugin-jest](https://www.npmjs.com/package/eslint-plugin-jest/v/25.3.0)** from `24.3.6` to `25.3.0`
- Bumped **[eslint-plugin-optimize-regex](https://www.npmjs.com/package/eslint-plugin-optimize-regex/v/1.2.1)** from `1.2.0` to `1.2.1`
- Bumped **[eslint-plugin-promise](https://www.npmjs.com/package/eslint-plugin-promise/v/5.1.1)** from `5.1.0` to `5.1.1`
- Bumped **[husky](https://www.npmjs.com/package/husky/v/7.0.4)** from `6.0.0` to `7.0.4`
- Bumped **[jest](https://www.npmjs.com/package/jest/v/27.3.1)** from `27.0.3` to `27.3.1`
- Bumped **[prettier](https://www.npmjs.com/package/prettier/v/2.5.0)** from `2.3.0` to `2.5.0`
- Bumped **[ts-jest](https://www.npmjs.com/package/ts-jest/v/27.0.7)** from `27.0.2` to `27.0.7`
- Bumped **[typescript](https://www.npmjs.com/package/typescript/v/4.5.2)** from `4.3.2` to `4.5.2`
</details>
# :bug: Bug Fixes
# :memo: Internal changes
- Remove typedoc, bump deps [`32393ce`](https://github.com/keindev/gh-gql/commit/32393cece1c1daab6a86f209db79e3e8b7a50738)
- **[Config]** Update config files [`a714f1c`](https://github.com/keindev/gh-gql/commit/a714f1c0c934bd420edfed748848b708cdf12ba4)
- **[Jest]** Fix ESM mocking [`10788dd`](https://github.com/keindev/gh-gql/commit/10788dd0e79550d35ff2ec63dc1d184403021f7e)
- Add SECURITY and CODE OF CONDUCT files [`49fceb5`](https://github.com/keindev/gh-gql/commit/49fceb59575e754b7ba30cfef3f58dbcd8bbee5c)
- Update gitignore & npmignore [`6096210`](https://github.com/keindev/gh-gql/commit/60962102a5b021af7e3a18bc60e16534d56210c8)
# :wrench: Code Refactoring
- Fix eslint errors [`c9c41c4`](https://github.com/keindev/gh-gql/commit/c9c41c4fbfb2de140d380a48523256850dc8b2e6)
---

@@ -49,0 +66,0 @@

@@ -0,1 +1,7 @@

var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _Provider_queries;
import dotenv from 'dotenv';

@@ -10,7 +16,4 @@ import { GraphQLClient } from 'graphql-request';

export class Provider {
static DEFAULT_USER_AGENT = `gh-gql ${getUserAgent()}`;
static ENDPOINT = 'https://api.github.com/graphql';
query;
#queries = new Map();
constructor(userAgent = Provider.DEFAULT_USER_AGENT) {
_Provider_queries.set(this, new Map());
const client = new GraphQLClient(Provider.ENDPOINT, {

@@ -22,3 +25,3 @@ method: 'POST',

get: (_target, name) => {
if (!this.#queries.has(name)) {
if (!__classPrivateFieldGet(this, _Provider_queries, "f").has(name)) {
let query;

@@ -43,5 +46,5 @@ switch (name) {

if (query)
this.#queries.set(name, query);
__classPrivateFieldGet(this, _Provider_queries, "f").set(name, query);
}
return this.#queries.get(name);
return __classPrivateFieldGet(this, _Provider_queries, "f").get(name);
},

@@ -51,2 +54,5 @@ });

}
_Provider_queries = new WeakMap();
Provider.DEFAULT_USER_AGENT = `gh-gql ${getUserAgent()}`;
Provider.ENDPOINT = 'https://api.github.com/graphql';
export default Provider;

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

getCount({ since, ...others }: SDK.IGetCountQueryVariables): Promise<number>;
getLastCommit(options: SDK.IGetLastCommitQueryVariables): Promise<ILastCommitInfo | undefined>;
getList(options: Omit<SDK.IGetListQueryVariables, 'limit'>): Promise<ICommit[]>;
getLastCommit(options: SDK.IGetLastCommitQueryVariables): Promise<ILastCommitInfo | undefined>;
}
export {};

@@ -14,2 +14,13 @@ import * as SDK from '../__generated__/sdk/commit';

}
async getLastCommit(options) {
const response = await this.execute(this.sdk.getLastCommit, options);
const edges = response.repository?.object?.history.edges;
let info;
if (Array.isArray(edges)) {
const node = edges[0]?.node;
if (node)
info = node;
}
return info;
}
async getList(options) {

@@ -41,13 +52,2 @@ const args = { ...options, limit: CommitQuery.PAGE_SIZE };

}
async getLastCommit(options) {
const response = await this.execute(this.sdk.getLastCommit, options);
const edges = response.repository?.object?.history.edges;
let info;
if (Array.isArray(edges)) {
const node = edges[0]?.node;
if (node)
info = node;
}
return info;
}
}

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

export declare type IGetContentOptions = Omit<SDK.IGetContentQueryVariables, 'expression'> & {
filePath: string;
oid: string;
filePath: string;
};
export default class FileQuery extends Query<ReturnType<typeof SDK.getSdk>> {
constructor(client: GraphQLClient);
getContent({ oid, filePath, ...others }: IGetContentOptions): Promise<string | undefined>;
getId(variables: SDK.IGetIdQueryVariables): Promise<string | undefined>;
getContent({ oid, filePath, ...others }: IGetContentOptions): Promise<string | undefined>;
}

@@ -7,2 +7,6 @@ import * as SDK from '../__generated__/sdk/file';

}
async getContent({ oid, filePath, ...others }) {
const response = await this.execute(this.sdk.getContent, { ...others, expression: `${oid}:${filePath}` });
return response.repository?.object?.text ?? undefined;
}
async getId(variables) {

@@ -13,6 +17,2 @@ const response = await this.execute(this.sdk.getId, variables);

}
async getContent({ oid, filePath, ...others }) {
const response = await this.execute(this.sdk.getContent, { ...others, expression: `${oid}:${filePath}` });
return response.repository?.object?.text ?? undefined;
}
}

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

constructor(client: GraphQLClient, getSdk: (client: GraphQLClient) => Q);
protected execute<T, K>(callback: (variables: K) => Promise<T>, variables: K): Promise<T>;
protected execute<T, K>(callback: (variables: K) => Promise<T>, variables: K): Promise<T | Partial<T>> | never;
}

@@ -0,6 +1,3 @@

import { ClientError } from 'graphql-request';
export default class Query {
static DELIMITER = '\n';
static PAGE_SIZE = 100;
static TAB_WIDTH = 2;
sdk;
constructor(client, getSdk) {

@@ -15,5 +12,11 @@ this.sdk = getSdk(client);

catch (error) {
throw new Error(JSON.stringify(error.response, null, Query.TAB_WIDTH));
if (error instanceof ClientError) {
throw new Error(JSON.stringify(error.response, null, Query.TAB_WIDTH));
}
}
return {};
}
}
Query.DELIMITER = '\n';
Query.PAGE_SIZE = 100;
Query.TAB_WIDTH = 2;

@@ -9,3 +9,3 @@ import * as SDK from '../__generated__/sdk/repository';

const response = await this.execute(this.sdk.getInfo, variables);
return response.viewer.repository ?? undefined;
return response.viewer?.repository ?? undefined;
}

@@ -12,0 +12,0 @@ async getList(variables) {

{
"name": "gh-gql",
"version": "2.0.2",
"version": "3.0.0",
"description": "GitHub GraphQL API helper for TypeScript",

@@ -19,3 +19,3 @@ "homepage": "https://github.com/keindev/gh-gql#readme",

"type": "module",
"main": "lib/index.js",
"exports": "./lib/index.js",
"types": "lib/index.d.ts",

@@ -31,3 +31,3 @@ "repository": {

"build": "npm-run-all build:*",
"build:ts": "rimraf lib && tsc --extendedDiagnostics --project tsconfig.build.json",
"build:ts": "rimraf lib && tsc --extendedDiagnostics",
"generate": "npm-run-all generate:*",

@@ -44,49 +44,49 @@ "generate:changelog": "node --experimental-specifier-resolution=node node_modules/.bin/changelog generate --bump",

"test": "npm-run-all test:*",
"test:jest": "node --harmony node_modules/.bin/jest"
"test:jest": "node --experimental-vm-modules node_modules/.bin/jest"
},
"engines": {
"node": ">=14.0.0"
"node": "^14.13.1 || >=16.0.0"
},
"dependencies": {
"dotenv": "^10.0.0",
"graphql": "^15.5.0",
"graphql-request": "^3.4.0",
"graphql-tag": "^2.12.4",
"universal-user-agent": "^6.0.0"
"graphql": "^16.0.1",
"graphql-request": "^3.6.1",
"graphql-tag": "^2.12.6",
"universal-user-agent": "^7.0.0"
},
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.14.3",
"@babel/preset-env": "^7.14.4",
"@graphql-codegen/add": "^2.0.2",
"@graphql-codegen/cli": "^1.21.5",
"@graphql-codegen/import-types-preset": "^1.18.2",
"@graphql-codegen/near-operation-file-preset": "^1.18.1",
"@graphql-codegen/typescript": "^1.22.1",
"@graphql-codegen/typescript-graphql-request": "^3.2.1",
"@graphql-codegen/typescript-operations": "^1.18.0",
"@tagproject/ts-package-shared-config": "^4.0.0",
"@types/jest": "^26.0.23",
"@types/node": "^15.6.1",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"babel-jest": "^27.0.2",
"@babel/plugin-transform-runtime": "^7.16.4",
"@babel/preset-env": "^7.16.4",
"@graphql-codegen/add": "^3.1.0",
"@graphql-codegen/cli": "^2.3.0",
"@graphql-codegen/import-types-preset": "^2.1.8",
"@graphql-codegen/near-operation-file-preset": "^2.2.2",
"@graphql-codegen/typescript": "^2.4.1",
"@graphql-codegen/typescript-graphql-request": "^4.3.1",
"@graphql-codegen/typescript-operations": "^2.2.1",
"@tagproject/ts-package-shared-config": "^6.0.0",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.10",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"babel-jest": "^27.3.1",
"changelog-guru": "^3.0.2",
"cspell": "^5.5.2",
"dotenv-cli": "^4.0.0",
"eslint": "^7.27.0",
"cspell": "^5.13.1",
"dotenv-cli": "^4.1.0",
"eslint": "^8.3.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-optimize-regex": "^1.2.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-optimize-regex": "^1.2.1",
"eslint-plugin-promise": "^5.1.1",
"ghinfo": "^2.0.3",
"husky": "^6.0.0",
"jest": "^27.0.3",
"husky": "^7.0.4",
"jest": "^27.3.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.0",
"prettier": "^2.5.0",
"rimraf": "^3.0.2",
"ts-jest": "^27.0.2",
"typescript": "^4.3.2"
"ts-jest": "^27.0.7",
"typescript": "^4.5.2"
}
}
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