Socket
Socket
Sign inDemoInstall

@octokit/oauth-app

Package Overview
Dependencies
10
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.7.0 to 4.0.0

192

dist-node/index.js

@@ -15,57 +15,4 @@ 'use strict';

function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
const VERSION = "4.0.0";
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
const VERSION = "3.7.0";
function addEventHandler(state, eventName, eventHandler) {

@@ -111,5 +58,6 @@ if (Array.isArray(eventName)) {

async function getUserOctokitWithState(state, options) {
return state.octokit.auth(_objectSpread2(_objectSpread2({
type: "oauth-user"
}, options), {}, {
return state.octokit.auth({
type: "oauth-user",
...options,
async factory(options) {

@@ -134,23 +82,24 @@ const octokit = new state.Octokit({

}));
});
}
function getWebFlowAuthorizationUrlWithState(state, options) {
const optionsWithDefaults = _objectSpread2(_objectSpread2({
const optionsWithDefaults = {
clientId: state.clientId,
request: state.octokit.request
}, options), {}, {
request: state.octokit.request,
...options,
allowSignup: options.allowSignup || state.allowSignup,
scopes: options.scopes || state.defaultScopes
};
return OAuthMethods.getWebFlowAuthorizationUrl({
clientType: state.clientType,
...optionsWithDefaults
});
return OAuthMethods.getWebFlowAuthorizationUrl(_objectSpread2({
clientType: state.clientType
}, optionsWithDefaults));
}
async function createTokenWithState(state, options) {
const authentication = await state.octokit.auth(_objectSpread2({
type: "oauth-user"
}, options));
const authentication = await state.octokit.auth({
type: "oauth-user",
...options
});
await emitEvent(state, {

@@ -182,3 +131,3 @@ name: "token",

async function checkTokenWithState(state, options) {
const result = await OAuthMethods.checkToken(_objectSpread2({
const result = await OAuthMethods.checkToken({
// @ts-expect-error not worth the extra code to appease TS

@@ -188,4 +137,5 @@ clientType: state.clientType,

clientSecret: state.clientSecret,
request: state.octokit.request
}, options));
request: state.octokit.request,
...options
});
Object.assign(result.authentication, {

@@ -199,12 +149,14 @@ type: "token",

async function resetTokenWithState(state, options) {
const optionsWithDefaults = _objectSpread2({
const optionsWithDefaults = {
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request
}, options);
request: state.octokit.request,
...options
};
if (state.clientType === "oauth-app") {
const response = await OAuthMethods.resetToken(_objectSpread2({
clientType: "oauth-app"
}, optionsWithDefaults));
const response = await OAuthMethods.resetToken({
clientType: "oauth-app",
...optionsWithDefaults
});
const authentication = Object.assign(response.authentication, {

@@ -231,10 +183,11 @@ type: "token",

});
return _objectSpread2(_objectSpread2({}, response), {}, {
return { ...response,
authentication
});
};
}
const response = await OAuthMethods.resetToken(_objectSpread2({
clientType: "github-app"
}, optionsWithDefaults));
const response = await OAuthMethods.resetToken({
clientType: "github-app",
...optionsWithDefaults
});
const authentication = Object.assign(response.authentication, {

@@ -259,5 +212,5 @@ type: "token",

});
return _objectSpread2(_objectSpread2({}, response), {}, {
return { ...response,
authentication
});
};
}

@@ -296,5 +249,5 @@

});
return _objectSpread2(_objectSpread2({}, response), {}, {
return { ...response,
authentication
});
};
}

@@ -307,8 +260,9 @@

const response = await OAuthMethods.scopeToken(_objectSpread2({
const response = await OAuthMethods.scopeToken({
clientType: "github-app",
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request
}, options));
request: state.octokit.request,
...options
});
const authentication = Object.assign(response.authentication, {

@@ -333,20 +287,22 @@ type: "token",

});
return _objectSpread2(_objectSpread2({}, response), {}, {
return { ...response,
authentication
});
};
}
async function deleteTokenWithState(state, options) {
const optionsWithDefaults = _objectSpread2({
const optionsWithDefaults = {
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request
}, options);
const response = state.clientType === "oauth-app" ? await OAuthMethods.deleteToken(_objectSpread2({
clientType: "oauth-app"
}, optionsWithDefaults)) : // istanbul ignore next
await OAuthMethods.deleteToken(_objectSpread2({
clientType: "github-app"
}, optionsWithDefaults));
request: state.octokit.request,
...options
};
const response = state.clientType === "oauth-app" ? await OAuthMethods.deleteToken({
clientType: "oauth-app",
...optionsWithDefaults
}) : // istanbul ignore next
await OAuthMethods.deleteToken({
clientType: "github-app",
...optionsWithDefaults
});
await emitEvent(state, {

@@ -367,14 +323,16 @@ name: "token",

async function deleteAuthorizationWithState(state, options) {
const optionsWithDefaults = _objectSpread2({
const optionsWithDefaults = {
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request
}, options);
const response = state.clientType === "oauth-app" ? await OAuthMethods.deleteAuthorization(_objectSpread2({
clientType: "oauth-app"
}, optionsWithDefaults)) : // istanbul ignore next
await OAuthMethods.deleteAuthorization(_objectSpread2({
clientType: "github-app"
}, optionsWithDefaults));
request: state.octokit.request,
...options
};
const response = state.clientType === "oauth-app" ? await OAuthMethods.deleteAuthorization({
clientType: "oauth-app",
...optionsWithDefaults
}) : // istanbul ignore next
await OAuthMethods.deleteAuthorization({
clientType: "github-app",
...optionsWithDefaults
});
await emitEvent(state, {

@@ -445,2 +403,3 @@ name: "token",

// @ts-ignore - requires esModuleInterop flag
async function handleRequest(app, {

@@ -668,5 +627,6 @@ pathPrefix = "/api/github/oauth"

const result = await app.scopeToken(_objectSpread2({
token
}, json)); // @ts-ignore
const result = await app.scopeToken({
token,
...json
}); // @ts-ignore

@@ -894,3 +854,5 @@ delete result.authentication.clientSecret;

constructor(...args) {
super(_objectSpread2(_objectSpread2({}, defaults), args[0]));
super({ ...defaults,
...args[0]
});
}

@@ -897,0 +859,0 @@

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

export const VERSION = "3.7.0";
export const VERSION = "4.0.0";

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

export declare const VERSION = "3.7.0";
export declare const VERSION = "4.0.0";
{
"name": "@octokit/oauth-app",
"description": "GitHub OAuth toolset for Node.js",
"version": "3.7.0",
"version": "4.0.0",
"license": "MIT",

@@ -50,2 +50,5 @@ "files": [

},
"engines": {
"node": ">= 14"
},
"publishConfig": {

@@ -52,0 +55,0 @@ "access": "public"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc