You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@codefresh-io/cf-git-providers

Package Overview
Dependencies
Maintainers
24
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codefresh-io/cf-git-providers - npm Package Compare versions

Comparing version

to
0.4.2

5

lib/providers/bitbucket-server.d.ts

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

import { Provider, Repository, Branch, Webhook, ProviderName, User, PullRequest, RepositoryPermission } from './types';
import { Provider, Repository, Branch, Webhook, ProviderName, User, PullRequest, RepositoryPermission, PermissionScopes } from './types';
export default class BitbucketServer implements Provider {

@@ -109,2 +109,5 @@ private baseUrl;

}): Promise<PullRequest>;
assertApiScopes(opt: {
scopes: PermissionScopes[];
}): Promise<void>;
}

3

lib/providers/bitbucket-server.js

@@ -405,4 +405,7 @@ "use strict";

}
async assertApiScopes(opt) {
//TODO : Impl validation
}
}
exports.default = BitbucketServer;
//# sourceMappingURL=bitbucket-server.js.map

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

import { ProviderName, Provider, Branch, Repository, Webhook, User, PullRequest, RepositoryPermission } from './types';
import { ProviderName, Provider, Branch, Repository, Webhook, User, PullRequest, RepositoryPermission, PermissionScopes } from './types';
export default class Bitbucket implements Provider {

@@ -110,2 +110,5 @@ private baseUrl;

}): Promise<RepositoryPermission>;
assertApiScopes(opt: {
scopes: PermissionScopes[];
}): Promise<void>;
}

@@ -241,4 +241,7 @@ "use strict";

}
async assertApiScopes(opt) {
//TODO : Impl validation
}
}
exports.default = Bitbucket;
//# sourceMappingURL=bitbucket.js.map

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

import { ProviderName, Provider, Branch, Repository, Webhook, CommitStatus, User, PullRequest, RepositoryPermission } from './types';
import { ProviderName, Provider, Branch, Repository, Webhook, CommitStatus, User, PullRequest, RepositoryPermission, PermissionScopes } from './types';
export default class Github implements Provider {

@@ -103,2 +103,5 @@ private githubClient;

}): Promise<RepositoryPermission>;
assertApiScopes(opt: {
scopes: PermissionScopes[];
}): Promise<void>;
}

@@ -26,2 +26,7 @@ "use strict";

};
const scopesMap = {
repo_read: 'repo',
repo_write: 'repo',
admin_repo_hook: 'admin:repo_hook',
};
const _getAgent = (insecure) => {

@@ -462,4 +467,18 @@ const options = { keepAlive: true, maxSockets: 10, rejectUnauthorized: !insecure };

}
async assertApiScopes(opt) {
const [err, res] = await helpers_1.to(this.githubClient.request('/user'));
if (err) {
throw new Error(`ValidationError: ${err}, status code ${err.status}`);
}
if (!res.headers['x-oauth-scopes']) {
throw new Error(`ValidationError: missing scopes: ${opt.scopes.toString()}`);
}
const originalScopes = res.headers['x-oauth-scopes'].replace(/ /g, '').split(',');
const isValid = opt.scopes.every(val => originalScopes.includes(scopesMap[val]));
if (!isValid) {
throw new Error(`ValidationError: got scopes ${res.headers['x-oauth-scopes'].toString()} while expected: ${opt.scopes.toString()}`);
}
}
}
exports.default = Github;
//# sourceMappingURL=github.js.map

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

import { Provider, Branch, Repository, Webhook, ProviderName, User, PullRequest, RepositoryPermission } from './types';
import { Provider, Branch, Repository, Webhook, ProviderName, User, PullRequest, RepositoryPermission, PermissionScopes } from './types';
export default class Gitlab implements Provider {

@@ -106,2 +106,5 @@ private baseUrl;

}): Promise<RepositoryPermission>;
assertApiScopes(opt: {
scopes: PermissionScopes[];
}): Promise<void>;
}

@@ -376,4 +376,7 @@ "use strict";

}
async assertApiScopes(opt) {
//TODO : Impl validation
}
}
exports.default = Gitlab;
//# sourceMappingURL=gitlab.js.map

@@ -16,2 +16,3 @@ export declare type ProviderConstructor = new (opt: {

export declare type CommitStatus = 'pending' | 'running' | 'success' | 'failure' | 'error';
export declare type PermissionScopes = 'repo_read' | 'repo_write' | 'admin_repo_hook';
export interface Provider {

@@ -109,2 +110,5 @@ getName(): ProviderName;

}): Promise<RepositoryPermission>;
assertApiScopes(opt: {
scopes: PermissionScopes[];
}): Promise<void>;
}

@@ -111,0 +115,0 @@ export interface RepositoryPermission {

{
"name": "@codefresh-io/cf-git-providers",
"version": "0.4.1",
"version": "0.4.2",
"description": "An NPM module/CLI for interacting with various git providers",

@@ -5,0 +5,0 @@ "keywords": [

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