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

to
0.2.0

2

lib/fragments/commit.d.ts

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

export declare const CommitFragment = "\n fragment CommitEdges on CommitHistoryConnection {\n edges {\n node {\n hash: oid\n header: messageHeadline\n body: messageBody\n url\n date: committedDate\n author {\n avatar: avatarUrl\n user {\n id: databaseId\n login\n url\n }\n }\n }\n }\n }\n";
export declare const CommitFragment = "\n fragment CommitFragment on CommitHistoryConnection {\n edges {\n node {\n hash: oid\n header: messageHeadline\n body: messageBody\n url\n date: committedDate\n author {\n avatar: avatarUrl\n user {\n id: databaseId\n login\n url\n }\n }\n }\n }\n }\n";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommitFragment = `
fragment CommitEdges on CommitHistoryConnection {
fragment CommitFragment on CommitHistoryConnection {
edges {

@@ -6,0 +6,0 @@ node {

@@ -28,5 +28,5 @@ "use strict";

}
exports.GitHubProvider = GitHubProvider;
GitHubProvider.DEFAULT_USER_AGENT = `gh-gql ${universal_user_agent_1.default()}`;
GitHubProvider.ENDPOINT = 'https://api.github.com/graphql';
exports.GitHubProvider = GitHubProvider;
//# sourceMappingURL=provider.js.map

@@ -25,4 +25,4 @@ import { Query } from '../query';

private cursor;
getCommits(date: Date, pageIndex?: number): Promise<GitHubResponseCommit[]>;
getCommitsCount(date?: Date): Promise<number>;
get(since: Date, pageIndex?: number): Promise<GitHubResponseCommit[]>;
getCount(since?: Date): Promise<number>;
private getFirstCommitsEdges;

@@ -29,0 +29,0 @@ private getFirstCommitsEdgesFrom;

@@ -6,4 +6,4 @@ "use strict";

class CommitQuery extends query_1.Query {
async getCommits(date, pageIndex) {
const formattedDate = date.toISOString();
async get(since, pageIndex) {
const formattedDate = since.toISOString();
const cursor = await this.getCursor(pageIndex);

@@ -19,3 +19,3 @@ let edges;

}
async getCommitsCount(date) {
async getCount(since = new Date(0)) {
const response = await this.execute(`

@@ -36,7 +36,7 @@ query GetCommitsCount($owner: String!, $repository: String!, $branch: String!, $date: GitTimestamp!) {

`, {
date: (date || new Date(0)).toISOString(),
date: since.toISOString(),
});
return response.ref.target.history.totalCount;
}
async getFirstCommitsEdges(date) {
async getFirstCommitsEdges(since) {
const response = await this.execute(`

@@ -63,3 +63,3 @@ query GetCommits(

`, {
date,
date: since,
limit: CommitQuery.PAGE_SIZE,

@@ -69,3 +69,3 @@ }, [commit_1.CommitFragment]);

}
async getFirstCommitsEdgesFrom(date, cursor) {
async getFirstCommitsEdgesFrom(since, cursor) {
const response = await this.execute(`

@@ -93,4 +93,4 @@ query GetCommits(

`, {
date,
cursor,
date: since,
limit: CommitQuery.PAGE_SIZE,

@@ -124,4 +124,4 @@ }, [commit_1.CommitFragment]);

}
exports.CommitQuery = CommitQuery;
CommitQuery.PAGE_SIZE = 100;
exports.CommitQuery = CommitQuery;
//# sourceMappingURL=commit.js.map

@@ -7,4 +7,4 @@ import { PackageJson } from 'type-fest';

export declare class PackageQuery extends Query {
getChanges(date: string): Promise<GitHubResponsePackageChange | undefined>;
getLastChange(until: Date): Promise<GitHubResponsePackageChange | undefined>;
getContent(change: GitHubResponsePackageChange): Promise<PackageJson>;
}

@@ -5,3 +5,3 @@ "use strict";

class PackageQuery extends query_1.Query {
async getChanges(date) {
async getLastChange(until) {
const response = await this.execute(`

@@ -29,3 +29,3 @@ query GetPackageChangeCommits(

`, {
date,
date: until.toISOString(),
});

@@ -32,0 +32,0 @@ return response.ref.target.history.nodes.pop();

@@ -13,4 +13,4 @@ "use strict";

}
exports.Query = Query;
Query.FRAGMENT_SEPARATOR = '\n';
exports.Query = Query;
//# sourceMappingURL=query.js.map
{
"name": "gh-gql",
"version": "0.1.0",
"version": "0.2.0",
"description": "GitHub GraphQL API client for JavaScript",

@@ -30,3 +30,3 @@ "homepage": "https://github.com/keindev/changelog-guru#readme",

"clean": "rimraf lib coverage",
"lint": "eslint --fix",
"lint": "eslint src/**/*.ts test/**/*.ts --fix",
"spellcheck": "cspell -c .vscode/cspell.json --no-summary \"*.*\" \"docs/**/*\" \"**/*.ts\" \"**/*.js\"",

@@ -64,4 +64,4 @@ "test": "jest",

"ts-jest": "^24.0.2",
"typescript": "^3.5.3"
"typescript": "^3.6.2"
}
}

@@ -1,3 +0,9 @@

# gh-gql
<p align="center"><img width="400" src="https://cdn.jsdelivr.net/gh/keindev/gh-gql/media/logo.svg" alt="Changelog-guru logo"></p>
<p align="center">
<a href="https://codecov.io/gh/keindev/gh-gql"><img src="https://codecov.io/gh/keindev/gh-gql/branch/master/graph/badge.svg" /></a>
<a href="https://www.npmjs.com/package/gh-gql"><img alt="npm" src="https://img.shields.io/npm/v/gh-gql.svg"></a>
<a href="https://www.npmjs.com/package/gh-gql"><img alt="NPM" src="https://img.shields.io/npm/l/gh-gql.svg"></a>
</p>
GitHub GraphQL API client for JavaScript

@@ -41,13 +47,13 @@

- `provider.commit.*` - contains methods for getting commits information
- `provider.package.*` - contains methods for getting `package.json` information
- `provider.release.*` - contains methods for obtaining information about repository releases
- `provider.commit.*` - for obtaining information about commits
- `provider.package.*` - for obtaining information about `package.json`
- `provider.release.*` - for obtaining information about repository releases
### Commit
#### getCommits(date, [pageIndex])
#### get(since, [pageIndex])
Returns the first 100 commits, starting from the specified date, with the possibility of pagination.
##### date
##### since

@@ -64,7 +70,7 @@ Type: `Date`

#### getCommitsCount([date])
#### getCount([since])
Returns commits count, starting from the specified date.
##### date
##### since

@@ -77,8 +83,34 @@ Type: `Date`

#### getChanges(date)
Contains methods for obtaining data about the status of `package.json`.
#### getLastChange(until)
Returns a pointer to the last change until the specified date.
##### until
Type: `Date`
Date until which sampling is performed.
#### getContent(change)
By pointer to change, returns the contents `package.json`
##### change
Type: `Object`
The change pointer.
### Release
Contains methods for obtaining release data.
#### getLast()
Returns tag and date of last release.
## License
[MIT](LICENSE)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet