Socket
Socket
Sign inDemoInstall

@octokit/oauth-app

Package Overview
Dependencies
9
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.2.1 to 4.2.2

537

dist-node/index.js

@@ -1,17 +0,47 @@

'use strict';
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
Object.defineProperty(exports, '__esModule', { value: true });
// pkg/dist-src/index.js
var dist_src_exports = {};
__export(dist_src_exports, {
OAuthApp: () => OAuthApp,
createAWSLambdaAPIGatewayV2Handler: () => createAWSLambdaAPIGatewayV2Handler,
createCloudflareHandler: () => createCloudflareHandler,
createNodeMiddleware: () => createNodeMiddleware,
createWebWorkerHandler: () => createWebWorkerHandler,
handleRequest: () => handleRequest
});
module.exports = __toCommonJS(dist_src_exports);
var import_auth_oauth_app = require("@octokit/auth-oauth-app");
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
// pkg/dist-src/version.js
var VERSION = "4.2.2";
var OAuthAppAuth = require('@octokit/auth-oauth-app');
var core = require('@octokit/core');
var universalUserAgent = require('universal-user-agent');
var authOauthUser = require('@octokit/auth-oauth-user');
var OAuthMethods = require('@octokit/oauth-methods');
var authUnauthenticated = require('@octokit/auth-unauthenticated');
var fromEntries = _interopDefault(require('fromentries'));
const VERSION = "4.2.1";
// pkg/dist-src/add-event-handler.js
function addEventHandler(state, eventName, eventHandler) {

@@ -30,11 +60,15 @@ if (Array.isArray(eventName)) {

const OAuthAppOctokit = core.Octokit.defaults({
userAgent: `octokit-oauth-app.js/${VERSION} ${universalUserAgent.getUserAgent()}`
// pkg/dist-src/oauth-app-octokit.js
var import_core = require("@octokit/core");
var import_universal_user_agent = require("universal-user-agent");
var OAuthAppOctokit = import_core.Octokit.defaults({
userAgent: `octokit-oauth-app.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
});
// pkg/dist-src/methods/get-user-octokit.js
var import_auth_oauth_user = require("@octokit/auth-oauth-user");
// pkg/dist-src/emit-event.js
async function emitEvent(state, context) {
const {
name,
action
} = context;
const { name, action } = context;
if (state.eventHandlers[`${name}.${action}`]) {

@@ -52,2 +86,3 @@ for (const eventHandler of state.eventHandlers[`${name}.${action}`]) {

// pkg/dist-src/methods/get-user-octokit.js
async function getUserOctokitWithState(state, options) {

@@ -57,6 +92,6 @@ return state.octokit.auth({

...options,
async factory(options) {
async factory(options2) {
const octokit = new state.Octokit({
authStrategy: authOauthUser.createOAuthUserAuth,
auth: options
authStrategy: import_auth_oauth_user.createOAuthUserAuth,
auth: options2
});

@@ -79,2 +114,4 @@ const authentication = await octokit.auth({

// pkg/dist-src/methods/get-web-flow-authorization-url.js
var OAuthMethods = __toESM(require("@octokit/oauth-methods"));
function getWebFlowAuthorizationUrlWithState(state, options) {

@@ -95,2 +132,4 @@ const optionsWithDefaults = {

// pkg/dist-src/methods/create-token.js
var OAuthAppAuth = __toESM(require("@octokit/auth-oauth-app"));
async function createTokenWithState(state, options) {

@@ -121,9 +160,9 @@ const authentication = await state.octokit.auth({

});
return {
authentication
};
return { authentication };
}
// pkg/dist-src/methods/check-token.js
var OAuthMethods2 = __toESM(require("@octokit/oauth-methods"));
async function checkTokenWithState(state, options) {
const result = await OAuthMethods.checkToken({
const result = await OAuthMethods2.checkToken({
// @ts-expect-error not worth the extra code to appease TS

@@ -136,9 +175,9 @@ clientType: state.clientType,

});
Object.assign(result.authentication, {
type: "token",
tokenType: "oauth"
});
Object.assign(result.authentication, { type: "token", tokenType: "oauth" });
return result;
}
// pkg/dist-src/methods/reset-token.js
var OAuthMethods3 = __toESM(require("@octokit/oauth-methods"));
var import_auth_oauth_user2 = require("@octokit/auth-oauth-user");
async function resetTokenWithState(state, options) {

@@ -152,7 +191,7 @@ const optionsWithDefaults = {

if (state.clientType === "oauth-app") {
const response = await OAuthMethods.resetToken({
const response2 = await OAuthMethods3.resetToken({
clientType: "oauth-app",
...optionsWithDefaults
});
const authentication = Object.assign(response.authentication, {
const authentication2 = Object.assign(response2.authentication, {
type: "token",

@@ -164,7 +203,7 @@ tokenType: "oauth"

action: "reset",
token: response.authentication.token,
scopes: response.authentication.scopes || undefined,
authentication: authentication,
token: response2.authentication.token,
scopes: response2.authentication.scopes || void 0,
authentication: authentication2,
octokit: new state.Octokit({
authStrategy: authOauthUser.createOAuthUserAuth,
authStrategy: import_auth_oauth_user2.createOAuthUserAuth,
auth: {

@@ -174,13 +213,10 @@ clientType: state.clientType,

clientSecret: state.clientSecret,
token: response.authentication.token,
scopes: response.authentication.scopes
token: response2.authentication.token,
scopes: response2.authentication.scopes
}
})
});
return {
...response,
authentication
};
return { ...response2, authentication: authentication2 };
}
const response = await OAuthMethods.resetToken({
const response = await OAuthMethods3.resetToken({
clientType: "github-app",

@@ -197,5 +233,5 @@ ...optionsWithDefaults

token: response.authentication.token,
authentication: authentication,
authentication,
octokit: new state.Octokit({
authStrategy: authOauthUser.createOAuthUserAuth,
authStrategy: import_auth_oauth_user2.createOAuthUserAuth,
auth: {

@@ -209,13 +245,15 @@ clientType: state.clientType,

});
return {
...response,
authentication
};
return { ...response, authentication };
}
// pkg/dist-src/methods/refresh-token.js
var OAuthMethods4 = __toESM(require("@octokit/oauth-methods"));
var import_auth_oauth_user3 = require("@octokit/auth-oauth-user");
async function refreshTokenWithState(state, options) {
if (state.clientType === "oauth-app") {
throw new Error("[@octokit/oauth-app] app.refreshToken() is not supported for OAuth Apps");
throw new Error(
"[@octokit/oauth-app] app.refreshToken() is not supported for OAuth Apps"
);
}
const response = await OAuthMethods.refreshToken({
const response = await OAuthMethods4.refreshToken({
clientType: "github-app",

@@ -235,5 +273,5 @@ clientId: state.clientId,

token: response.authentication.token,
authentication: authentication,
authentication,
octokit: new state.Octokit({
authStrategy: authOauthUser.createOAuthUserAuth,
authStrategy: import_auth_oauth_user3.createOAuthUserAuth,
auth: {

@@ -247,13 +285,15 @@ clientType: state.clientType,

});
return {
...response,
authentication
};
return { ...response, authentication };
}
// pkg/dist-src/methods/scope-token.js
var OAuthMethods5 = __toESM(require("@octokit/oauth-methods"));
var import_auth_oauth_user4 = require("@octokit/auth-oauth-user");
async function scopeTokenWithState(state, options) {
if (state.clientType === "oauth-app") {
throw new Error("[@octokit/oauth-app] app.scopeToken() is not supported for OAuth Apps");
throw new Error(
"[@octokit/oauth-app] app.scopeToken() is not supported for OAuth Apps"
);
}
const response = await OAuthMethods.scopeToken({
const response = await OAuthMethods5.scopeToken({
clientType: "github-app",

@@ -273,5 +313,5 @@ clientId: state.clientId,

token: response.authentication.token,
authentication: authentication,
authentication,
octokit: new state.Octokit({
authStrategy: authOauthUser.createOAuthUserAuth,
authStrategy: import_auth_oauth_user4.createOAuthUserAuth,
auth: {

@@ -285,8 +325,8 @@ clientType: state.clientType,

});
return {
...response,
authentication
};
return { ...response, authentication };
}
// pkg/dist-src/methods/delete-token.js
var OAuthMethods6 = __toESM(require("@octokit/oauth-methods"));
var import_auth_unauthenticated = require("@octokit/auth-unauthenticated");
async function deleteTokenWithState(state, options) {

@@ -299,11 +339,12 @@ const optionsWithDefaults = {

};
const response = state.clientType === "oauth-app" ? await OAuthMethods.deleteToken({
const response = state.clientType === "oauth-app" ? await OAuthMethods6.deleteToken({
clientType: "oauth-app",
...optionsWithDefaults
}) :
// istanbul ignore next
await OAuthMethods.deleteToken({
clientType: "github-app",
...optionsWithDefaults
});
}) : (
// istanbul ignore next
await OAuthMethods6.deleteToken({
clientType: "github-app",
...optionsWithDefaults
})
);
await emitEvent(state, {

@@ -314,3 +355,3 @@ name: "token",

octokit: new state.Octokit({
authStrategy: authUnauthenticated.createUnauthenticatedAuth,
authStrategy: import_auth_unauthenticated.createUnauthenticatedAuth,
auth: {

@@ -324,2 +365,5 @@ reason: `Handling "token.deleted" event. The access for the token has been revoked.`

// pkg/dist-src/methods/delete-authorization.js
var OAuthMethods7 = __toESM(require("@octokit/oauth-methods"));
var import_auth_unauthenticated2 = require("@octokit/auth-unauthenticated");
async function deleteAuthorizationWithState(state, options) {

@@ -332,11 +376,12 @@ const optionsWithDefaults = {

};
const response = state.clientType === "oauth-app" ? await OAuthMethods.deleteAuthorization({
const response = state.clientType === "oauth-app" ? await OAuthMethods7.deleteAuthorization({
clientType: "oauth-app",
...optionsWithDefaults
}) :
// istanbul ignore next
await OAuthMethods.deleteAuthorization({
clientType: "github-app",
...optionsWithDefaults
});
}) : (
// istanbul ignore next
await OAuthMethods7.deleteAuthorization({
clientType: "github-app",
...optionsWithDefaults
})
);
await emitEvent(state, {

@@ -347,3 +392,3 @@ name: "token",

octokit: new state.Octokit({
authStrategy: authUnauthenticated.createUnauthenticatedAuth,
authStrategy: import_auth_unauthenticated2.createUnauthenticatedAuth,
auth: {

@@ -359,3 +404,3 @@ reason: `Handling "token.deleted" event. The access for the token has been revoked.`

octokit: new state.Octokit({
authStrategy: authUnauthenticated.createUnauthenticatedAuth,
authStrategy: import_auth_unauthenticated2.createUnauthenticatedAuth,
auth: {

@@ -369,6 +414,6 @@ reason: `Handling "authorization.deleted" event. The access for the app has been revoked.`

// @ts-ignore - requires esModuleInterop flag
async function handleRequest(app, {
pathPrefix = "/api/github/oauth"
}, request) {
// pkg/dist-src/middleware/handle-request.js
var import_fromentries = __toESM(require("fromentries"));
async function handleRequest(app, { pathPrefix = "/api/github/oauth" }, request) {
var _a, _b, _c, _d, _e, _f;
if (request.method === "OPTIONS") {

@@ -384,7 +429,3 @@ return {

}
// request.url may include ?query parameters which we don't want for `route`
// hence the workaround using new URL()
const {
pathname
} = new URL(request.url, "http://localhost");
const { pathname } = new URL(request.url, "http://localhost");
const route = [request.method, pathname].join(" ");

@@ -402,3 +443,2 @@ const routes = {

};
// handle unknown routes
if (!Object.values(routes).includes(route)) {

@@ -423,28 +463,20 @@ return null;

}
const {
searchParams
} = new URL(request.url, "http://localhost");
const query = fromEntries(searchParams);
const { searchParams } = new URL(request.url, "http://localhost");
const query = (0, import_fromentries.default)(searchParams);
const headers = request.headers;
try {
var _headers$authorizatio6;
if (route === routes.getLogin) {
const {
url
} = app.getWebFlowAuthorizationUrl({
const { url } = app.getWebFlowAuthorizationUrl({
state: query.state,
scopes: query.scopes ? query.scopes.split(",") : undefined,
allowSignup: query.allowSignup ? query.allowSignup === "true" : undefined,
scopes: query.scopes ? query.scopes.split(",") : void 0,
allowSignup: query.allowSignup ? query.allowSignup === "true" : void 0,
redirectUrl: query.redirectUrl
});
return {
status: 302,
headers: {
location: url
}
};
return { status: 302, headers: { location: url } };
}
if (route === routes.getCallback) {
if (query.error) {
throw new Error(`[@octokit/oauth-app] ${query.error} ${query.error_description}`);
throw new Error(
`[@octokit/oauth-app] ${query.error} ${query.error_description}`
);
}

@@ -455,5 +487,3 @@ if (!query.code) {

const {
authentication: {
token
}
authentication: { token: token2 }
} = await app.createToken({

@@ -469,10 +499,7 @@ code: query.code

<p>Your token is: <strong>${token}</strong>. Copy it now as it cannot be shown again.</p>`
<p>Your token is: <strong>${token2}</strong>. Copy it now as it cannot be shown again.</p>`
};
}
if (route === routes.createToken) {
const {
code,
redirectUrl
} = json;
const { code, redirectUrl } = json;
if (!code) {

@@ -485,3 +512,2 @@ throw new Error('[@octokit/oauth-app] "code" parameter is required');

});
// @ts-ignore
delete result.authentication.clientSecret;

@@ -498,11 +524,11 @@ return {

if (route === routes.getToken) {
var _headers$authorizatio;
const token = (_headers$authorizatio = headers.authorization) === null || _headers$authorizatio === void 0 ? void 0 : _headers$authorizatio.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
const token2 = (_a = headers.authorization) == null ? void 0 : _a.substr("token ".length);
if (!token2) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
const result = await app.checkToken({
token
token: token2
});
// @ts-ignore
delete result.authentication.clientSecret;

@@ -519,11 +545,9 @@ return {

if (route === routes.patchToken) {
var _headers$authorizatio2;
const token = (_headers$authorizatio2 = headers.authorization) === null || _headers$authorizatio2 === void 0 ? void 0 : _headers$authorizatio2.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
const token2 = (_b = headers.authorization) == null ? void 0 : _b.substr("token ".length);
if (!token2) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
const result = await app.resetToken({
token
});
// @ts-ignore
const result = await app.resetToken({ token: token2 });
delete result.authentication.clientSecret;

@@ -540,17 +564,15 @@ return {

if (route === routes.patchRefreshToken) {
var _headers$authorizatio3;
const token = (_headers$authorizatio3 = headers.authorization) === null || _headers$authorizatio3 === void 0 ? void 0 : _headers$authorizatio3.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
const token2 = (_c = headers.authorization) == null ? void 0 : _c.substr("token ".length);
if (!token2) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
const {
refreshToken
} = json;
if (!refreshToken) {
throw new Error("[@octokit/oauth-app] refreshToken must be sent in request body");
const { refreshToken: refreshToken2 } = json;
if (!refreshToken2) {
throw new Error(
"[@octokit/oauth-app] refreshToken must be sent in request body"
);
}
const result = await app.refreshToken({
refreshToken
});
// @ts-ignore
const result = await app.refreshToken({ refreshToken: refreshToken2 });
delete result.authentication.clientSecret;

@@ -567,12 +589,12 @@ return {

if (route === routes.scopeToken) {
var _headers$authorizatio4;
const token = (_headers$authorizatio4 = headers.authorization) === null || _headers$authorizatio4 === void 0 ? void 0 : _headers$authorizatio4.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
const token2 = (_d = headers.authorization) == null ? void 0 : _d.substr("token ".length);
if (!token2) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
const result = await app.scopeToken({
token,
token: token2,
...json
});
// @ts-ignore
delete result.authentication.clientSecret;

@@ -589,21 +611,21 @@ return {

if (route === routes.deleteToken) {
var _headers$authorizatio5;
const token = (_headers$authorizatio5 = headers.authorization) === null || _headers$authorizatio5 === void 0 ? void 0 : _headers$authorizatio5.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
const token2 = (_e = headers.authorization) == null ? void 0 : _e.substr("token ".length);
if (!token2) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
await app.deleteToken({
token
token: token2
});
return {
status: 204,
headers: {
"access-control-allow-origin": "*"
}
headers: { "access-control-allow-origin": "*" }
};
}
// route === routes.deleteGrant
const token = (_headers$authorizatio6 = headers.authorization) === null || _headers$authorizatio6 === void 0 ? void 0 : _headers$authorizatio6.substr("token ".length);
const token = (_f = headers.authorization) == null ? void 0 : _f.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}

@@ -615,5 +637,3 @@ await app.deleteAuthorization({

status: 204,
headers: {
"access-control-allow-origin": "*"
}
headers: { "access-control-allow-origin": "*" }
};

@@ -627,5 +647,3 @@ } catch (error) {

},
text: JSON.stringify({
error: error.message
})
text: JSON.stringify({ error: error.message })
};

@@ -635,23 +653,16 @@ }

// pkg/dist-src/middleware/node/parse-request.js
function parseRequest(request) {
const {
method,
url,
headers
} = request;
const { method, url, headers } = request;
async function text() {
const text = await new Promise((resolve, reject) => {
const text2 = await new Promise((resolve, reject) => {
let bodyChunks = [];
request.on("error", reject).on("data", chunk => bodyChunks.push(chunk)).on("end", () => resolve(Buffer.concat(bodyChunks).toString()));
request.on("error", reject).on("data", (chunk) => bodyChunks.push(chunk)).on("end", () => resolve(Buffer.concat(bodyChunks).toString()));
});
return text;
return text2;
}
return {
method,
url,
headers,
text
};
return { method, url, headers, text };
}
// pkg/dist-src/middleware/node/send-response.js
function sendResponse(octokitResponse, response) {

@@ -662,8 +673,7 @@ response.writeHead(octokitResponse.status, octokitResponse.headers);

// pkg/dist-src/middleware/on-unhandled-request-default.js
function onUnhandledRequestDefault(request) {
return {
status: 404,
headers: {
"content-type": "application/json"
},
headers: { "content-type": "application/json" },
text: JSON.stringify({

@@ -675,2 +685,3 @@ error: `Unknown route: ${request.method} ${request.url}`

// pkg/dist-src/middleware/node/index.js
function onUnhandledRequestDefaultNode(request, response) {

@@ -686,10 +697,14 @@ const octokitRequest = parseRequest(request);

if (onUnhandledRequest) {
app.octokit.log.warn("[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version.");
app.octokit.log.warn(
"[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version."
);
}
onUnhandledRequest ?? (onUnhandledRequest = onUnhandledRequestDefaultNode);
return async function (request, response, next) {
return async function(request, response, next) {
const octokitRequest = parseRequest(request);
const octokitResponse = await handleRequest(app, {
pathPrefix
}, octokitRequest);
const octokitResponse = await handleRequest(
app,
{ pathPrefix },
octokitRequest
);
if (octokitResponse) {

@@ -705,4 +720,4 @@ sendResponse(octokitResponse, response);

function parseRequest$1(request) {
// @ts-ignore Worker environment supports fromEntries/entries.
// pkg/dist-src/middleware/web-worker/parse-request.js
function parseRequest2(request) {
const headers = Object.fromEntries(request.headers.entries());

@@ -717,3 +732,4 @@ return {

function sendResponse$1(octokitResponse) {
// pkg/dist-src/middleware/web-worker/send-response.js
function sendResponse2(octokitResponse) {
return new Response(octokitResponse.text, {

@@ -725,6 +741,7 @@ status: octokitResponse.status,

// pkg/dist-src/middleware/web-worker/index.js
async function onUnhandledRequestDefaultWebWorker(request) {
const octokitRequest = parseRequest$1(request);
const octokitRequest = parseRequest2(request);
const octokitResponse = onUnhandledRequestDefault(octokitRequest);
return sendResponse$1(octokitResponse);
return sendResponse2(octokitResponse);
}

@@ -736,40 +753,40 @@ function createWebWorkerHandler(app, {

if (onUnhandledRequest) {
app.octokit.log.warn("[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version.");
app.octokit.log.warn(
"[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version."
);
}
onUnhandledRequest ?? (onUnhandledRequest = onUnhandledRequestDefaultWebWorker);
return async function (request) {
const octokitRequest = parseRequest$1(request);
const octokitResponse = await handleRequest(app, {
pathPrefix
}, octokitRequest);
return octokitResponse ? sendResponse$1(octokitResponse) : await onUnhandledRequest(request);
return async function(request) {
const octokitRequest = parseRequest2(request);
const octokitResponse = await handleRequest(
app,
{ pathPrefix },
octokitRequest
);
return octokitResponse ? sendResponse2(octokitResponse) : await onUnhandledRequest(request);
};
}
/** @deprecated */
function createCloudflareHandler(...args) {
args[0].octokit.log.warn("[@octokit/oauth-app] `createCloudflareHandler` is deprecated, use `createWebWorkerHandler` instead");
args[0].octokit.log.warn(
"[@octokit/oauth-app] `createCloudflareHandler` is deprecated, use `createWebWorkerHandler` instead"
);
return createWebWorkerHandler(...args);
}
function parseRequest$2(request) {
const {
method
} = request.requestContext.http;
// pkg/dist-src/middleware/aws-lambda/api-gateway-v2-parse-request.js
function parseRequest3(request) {
const { method } = request.requestContext.http;
let url = request.rawPath;
const {
stage
} = request.requestContext;
if (url.startsWith("/" + stage)) url = url.substring(stage.length + 1);
if (request.rawQueryString) url += "?" + request.rawQueryString;
const { stage } = request.requestContext;
if (url.startsWith("/" + stage))
url = url.substring(stage.length + 1);
if (request.rawQueryString)
url += "?" + request.rawQueryString;
const headers = request.headers;
const text = async () => request.body || "";
return {
method,
url,
headers,
text
};
return { method, url, headers, text };
}
function sendResponse$2(octokitResponse) {
// pkg/dist-src/middleware/aws-lambda/api-gateway-v2-send-response.js
function sendResponse3(octokitResponse) {
return {

@@ -782,6 +799,7 @@ statusCode: octokitResponse.status,

// pkg/dist-src/middleware/aws-lambda/api-gateway-v2.js
async function onUnhandledRequestDefaultAWSAPIGatewayV2(event) {
const request = parseRequest$2(event);
const request = parseRequest3(event);
const response = onUnhandledRequestDefault(request);
return sendResponse$2(response);
return sendResponse3(response);
}

@@ -793,15 +811,16 @@ function createAWSLambdaAPIGatewayV2Handler(app, {

if (onUnhandledRequest) {
app.octokit.log.warn("[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version.");
app.octokit.log.warn(
"[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version."
);
}
onUnhandledRequest ?? (onUnhandledRequest = onUnhandledRequestDefaultAWSAPIGatewayV2);
return async function (event) {
const request = parseRequest$2(event);
const response = await handleRequest(app, {
pathPrefix
}, request);
return response ? sendResponse$2(response) : onUnhandledRequest(event);
return async function(event) {
const request = parseRequest3(event);
const response = await handleRequest(app, { pathPrefix }, request);
return response ? sendResponse3(response) : onUnhandledRequest(event);
};
}
class OAuthApp {
// pkg/dist-src/index.js
var OAuthApp = class {
static defaults(defaults) {

@@ -819,6 +838,6 @@ const OAuthAppWithDefaults = class extends this {

constructor(options) {
const Octokit = options.Octokit || OAuthAppOctokit;
const Octokit2 = options.Octokit || OAuthAppOctokit;
this.type = options.clientType || "oauth-app";
const octokit = new Octokit({
authStrategy: OAuthAppAuth.createOAuthAppAuth,
const octokit = new Octokit2({
authStrategy: import_auth_oauth_app.createOAuthAppAuth,
auth: {

@@ -840,3 +859,3 @@ clientType: this.type,

log: options.log,
Octokit,
Octokit: Octokit2,
octokit,

@@ -846,23 +865,41 @@ eventHandlers: {}

this.on = addEventHandler.bind(null, state);
// @ts-expect-error TODO: figure this out
this.octokit = octokit;
this.getUserOctokit = getUserOctokitWithState.bind(null, state);
this.getWebFlowAuthorizationUrl = getWebFlowAuthorizationUrlWithState.bind(null, state);
this.createToken = createTokenWithState.bind(null, state);
this.checkToken = checkTokenWithState.bind(null, state);
this.resetToken = resetTokenWithState.bind(null, state);
this.refreshToken = refreshTokenWithState.bind(null, state);
this.scopeToken = scopeTokenWithState.bind(null, state);
this.getWebFlowAuthorizationUrl = getWebFlowAuthorizationUrlWithState.bind(
null,
state
);
this.createToken = createTokenWithState.bind(
null,
state
);
this.checkToken = checkTokenWithState.bind(
null,
state
);
this.resetToken = resetTokenWithState.bind(
null,
state
);
this.refreshToken = refreshTokenWithState.bind(
null,
state
);
this.scopeToken = scopeTokenWithState.bind(
null,
state
);
this.deleteToken = deleteTokenWithState.bind(null, state);
this.deleteAuthorization = deleteAuthorizationWithState.bind(null, state);
}
}
};
OAuthApp.VERSION = VERSION;
exports.OAuthApp = OAuthApp;
exports.createAWSLambdaAPIGatewayV2Handler = createAWSLambdaAPIGatewayV2Handler;
exports.createCloudflareHandler = createCloudflareHandler;
exports.createNodeMiddleware = createNodeMiddleware;
exports.createWebWorkerHandler = createWebWorkerHandler;
exports.handleRequest = handleRequest;
//# sourceMappingURL=index.js.map
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
OAuthApp,
createAWSLambdaAPIGatewayV2Handler,
createCloudflareHandler,
createNodeMiddleware,
createWebWorkerHandler,
handleRequest
});

@@ -1,12 +0,15 @@

export function addEventHandler(state, eventName, eventHandler) {
if (Array.isArray(eventName)) {
for (const singleEventName of eventName) {
addEventHandler(state, singleEventName, eventHandler);
}
return;
function addEventHandler(state, eventName, eventHandler) {
if (Array.isArray(eventName)) {
for (const singleEventName of eventName) {
addEventHandler(state, singleEventName, eventHandler);
}
if (!state.eventHandlers[eventName]) {
state.eventHandlers[eventName] = [];
}
state.eventHandlers[eventName].push(eventHandler);
return;
}
if (!state.eventHandlers[eventName]) {
state.eventHandlers[eventName] = [];
}
state.eventHandlers[eventName].push(eventHandler);
}
export {
addEventHandler
};

@@ -1,13 +0,16 @@

export async function emitEvent(state, context) {
const { name, action } = context;
if (state.eventHandlers[`${name}.${action}`]) {
for (const eventHandler of state.eventHandlers[`${name}.${action}`]) {
await eventHandler(context);
}
async function emitEvent(state, context) {
const { name, action } = context;
if (state.eventHandlers[`${name}.${action}`]) {
for (const eventHandler of state.eventHandlers[`${name}.${action}`]) {
await eventHandler(context);
}
if (state.eventHandlers[name]) {
for (const eventHandler of state.eventHandlers[name]) {
await eventHandler(context);
}
}
if (state.eventHandlers[name]) {
for (const eventHandler of state.eventHandlers[name]) {
await eventHandler(context);
}
}
}
export {
emitEvent
};

@@ -5,69 +5,112 @@ import { createOAuthAppAuth } from "@octokit/auth-oauth-app";

import { OAuthAppOctokit } from "./oauth-app-octokit";
import { getUserOctokitWithState, } from "./methods/get-user-octokit";
import { getWebFlowAuthorizationUrlWithState, } from "./methods/get-web-flow-authorization-url";
import { createTokenWithState, } from "./methods/create-token";
import { checkTokenWithState, } from "./methods/check-token";
import { resetTokenWithState, } from "./methods/reset-token";
import { refreshTokenWithState, } from "./methods/refresh-token";
import { scopeTokenWithState, } from "./methods/scope-token";
import { deleteTokenWithState, } from "./methods/delete-token";
import { deleteAuthorizationWithState, } from "./methods/delete-authorization";
// generic handlers
export { handleRequest } from "./middleware/handle-request";
export { createNodeMiddleware } from "./middleware/node/index";
export { createCloudflareHandler, createWebWorkerHandler, } from "./middleware/web-worker/index";
export { createAWSLambdaAPIGatewayV2Handler } from "./middleware/aws-lambda/api-gateway-v2";
import {
getUserOctokitWithState
} from "./methods/get-user-octokit";
import {
getWebFlowAuthorizationUrlWithState
} from "./methods/get-web-flow-authorization-url";
import {
createTokenWithState
} from "./methods/create-token";
import {
checkTokenWithState
} from "./methods/check-token";
import {
resetTokenWithState
} from "./methods/reset-token";
import {
refreshTokenWithState
} from "./methods/refresh-token";
import {
scopeTokenWithState
} from "./methods/scope-token";
import {
deleteTokenWithState
} from "./methods/delete-token";
import {
deleteAuthorizationWithState
} from "./methods/delete-authorization";
import { handleRequest } from "./middleware/handle-request";
import { createNodeMiddleware } from "./middleware/node/index";
import {
createCloudflareHandler,
createWebWorkerHandler
} from "./middleware/web-worker/index";
import { createAWSLambdaAPIGatewayV2Handler } from "./middleware/aws-lambda/api-gateway-v2";
class OAuthApp {
static defaults(defaults) {
const OAuthAppWithDefaults = class extends this {
constructor(...args) {
super({
...defaults,
...args[0],
});
}
};
return OAuthAppWithDefaults;
}
constructor(options) {
const Octokit = options.Octokit || OAuthAppOctokit;
this.type = (options.clientType ||
"oauth-app");
const octokit = new Octokit({
authStrategy: createOAuthAppAuth,
auth: {
clientType: this.type,
clientId: options.clientId,
clientSecret: options.clientSecret,
},
static defaults(defaults) {
const OAuthAppWithDefaults = class extends this {
constructor(...args) {
super({
...defaults,
...args[0]
});
const state = {
clientType: this.type,
clientId: options.clientId,
clientSecret: options.clientSecret,
// @ts-expect-error defaultScopes not permitted for GitHub Apps
defaultScopes: options.defaultScopes || [],
allowSignup: options.allowSignup,
baseUrl: options.baseUrl,
redirectUrl: options.redirectUrl,
log: options.log,
Octokit,
octokit,
eventHandlers: {},
};
this.on = addEventHandler.bind(null, state);
// @ts-expect-error TODO: figure this out
this.octokit = octokit;
this.getUserOctokit = getUserOctokitWithState.bind(null, state);
this.getWebFlowAuthorizationUrl = getWebFlowAuthorizationUrlWithState.bind(null, state);
this.createToken = createTokenWithState.bind(null, state);
this.checkToken = checkTokenWithState.bind(null, state);
this.resetToken = resetTokenWithState.bind(null, state);
this.refreshToken = refreshTokenWithState.bind(null, state);
this.scopeToken = scopeTokenWithState.bind(null, state);
this.deleteToken = deleteTokenWithState.bind(null, state);
this.deleteAuthorization = deleteAuthorizationWithState.bind(null, state);
}
}
};
return OAuthAppWithDefaults;
}
constructor(options) {
const Octokit = options.Octokit || OAuthAppOctokit;
this.type = options.clientType || "oauth-app";
const octokit = new Octokit({
authStrategy: createOAuthAppAuth,
auth: {
clientType: this.type,
clientId: options.clientId,
clientSecret: options.clientSecret
}
});
const state = {
clientType: this.type,
clientId: options.clientId,
clientSecret: options.clientSecret,
// @ts-expect-error defaultScopes not permitted for GitHub Apps
defaultScopes: options.defaultScopes || [],
allowSignup: options.allowSignup,
baseUrl: options.baseUrl,
redirectUrl: options.redirectUrl,
log: options.log,
Octokit,
octokit,
eventHandlers: {}
};
this.on = addEventHandler.bind(null, state);
this.octokit = octokit;
this.getUserOctokit = getUserOctokitWithState.bind(null, state);
this.getWebFlowAuthorizationUrl = getWebFlowAuthorizationUrlWithState.bind(
null,
state
);
this.createToken = createTokenWithState.bind(
null,
state
);
this.checkToken = checkTokenWithState.bind(
null,
state
);
this.resetToken = resetTokenWithState.bind(
null,
state
);
this.refreshToken = refreshTokenWithState.bind(
null,
state
);
this.scopeToken = scopeTokenWithState.bind(
null,
state
);
this.deleteToken = deleteTokenWithState.bind(null, state);
this.deleteAuthorization = deleteAuthorizationWithState.bind(null, state);
}
}
OAuthApp.VERSION = VERSION;
export { OAuthApp };
export {
OAuthApp,
createAWSLambdaAPIGatewayV2Handler,
createCloudflareHandler,
createNodeMiddleware,
createWebWorkerHandler,
handleRequest
};
import * as OAuthMethods from "@octokit/oauth-methods";
export async function checkTokenWithState(state, options) {
const result = await OAuthMethods.checkToken({
// @ts-expect-error not worth the extra code to appease TS
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request,
...options,
});
Object.assign(result.authentication, { type: "token", tokenType: "oauth" });
return result;
async function checkTokenWithState(state, options) {
const result = await OAuthMethods.checkToken({
// @ts-expect-error not worth the extra code to appease TS
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request,
...options
});
Object.assign(result.authentication, { type: "token", tokenType: "oauth" });
return result;
}
export {
checkTokenWithState
};
import * as OAuthAppAuth from "@octokit/auth-oauth-app";
import { emitEvent } from "../emit-event";
export async function createTokenWithState(state, options) {
const authentication = await state.octokit.auth({
type: "oauth-user",
...options,
});
await emitEvent(state, {
name: "token",
action: "created",
async function createTokenWithState(state, options) {
const authentication = await state.octokit.auth({
type: "oauth-user",
...options
});
await emitEvent(state, {
name: "token",
action: "created",
token: authentication.token,
scopes: authentication.scopes,
authentication,
octokit: new state.Octokit({
authStrategy: OAuthAppAuth.createOAuthUserAuth,
auth: {
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
token: authentication.token,
scopes: authentication.scopes,
authentication,
octokit: new state.Octokit({
authStrategy: OAuthAppAuth.createOAuthUserAuth,
auth: {
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
token: authentication.token,
scopes: authentication.scopes,
refreshToken: authentication.refreshToken,
expiresAt: authentication.expiresAt,
refreshTokenExpiresAt: authentication.refreshTokenExpiresAt,
},
}),
});
return { authentication };
refreshToken: authentication.refreshToken,
expiresAt: authentication.expiresAt,
refreshTokenExpiresAt: authentication.refreshTokenExpiresAt
}
})
});
return { authentication };
}
export {
createTokenWithState
};
import * as OAuthMethods from "@octokit/oauth-methods";
import { createUnauthenticatedAuth } from "@octokit/auth-unauthenticated";
import { emitEvent } from "../emit-event";
export async function deleteAuthorizationWithState(state, options) {
const optionsWithDefaults = {
clientId: state.clientId,
clientSecret: state.clientSecret,
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, {
name: "token",
action: "deleted",
token: options.token,
octokit: new state.Octokit({
authStrategy: createUnauthenticatedAuth,
auth: {
reason: `Handling "token.deleted" event. The access for the token has been revoked.`,
},
}),
});
await emitEvent(state, {
name: "authorization",
action: "deleted",
token: options.token,
octokit: new state.Octokit({
authStrategy: createUnauthenticatedAuth,
auth: {
reason: `Handling "authorization.deleted" event. The access for the app has been revoked.`,
},
}),
});
return response;
async function deleteAuthorizationWithState(state, options) {
const optionsWithDefaults = {
clientId: state.clientId,
clientSecret: state.clientSecret,
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, {
name: "token",
action: "deleted",
token: options.token,
octokit: new state.Octokit({
authStrategy: createUnauthenticatedAuth,
auth: {
reason: `Handling "token.deleted" event. The access for the token has been revoked.`
}
})
});
await emitEvent(state, {
name: "authorization",
action: "deleted",
token: options.token,
octokit: new state.Octokit({
authStrategy: createUnauthenticatedAuth,
auth: {
reason: `Handling "authorization.deleted" event. The access for the app has been revoked.`
}
})
});
return response;
}
export {
deleteAuthorizationWithState
};
import * as OAuthMethods from "@octokit/oauth-methods";
import { createUnauthenticatedAuth } from "@octokit/auth-unauthenticated";
import { emitEvent } from "../emit-event";
export async function deleteTokenWithState(state, options) {
const optionsWithDefaults = {
clientId: state.clientId,
clientSecret: state.clientSecret,
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, {
name: "token",
action: "deleted",
token: options.token,
octokit: new state.Octokit({
authStrategy: createUnauthenticatedAuth,
auth: {
reason: `Handling "token.deleted" event. The access for the token has been revoked.`,
},
}),
});
return response;
async function deleteTokenWithState(state, options) {
const optionsWithDefaults = {
clientId: state.clientId,
clientSecret: state.clientSecret,
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, {
name: "token",
action: "deleted",
token: options.token,
octokit: new state.Octokit({
authStrategy: createUnauthenticatedAuth,
auth: {
reason: `Handling "token.deleted" event. The access for the token has been revoked.`
}
})
});
return response;
}
export {
deleteTokenWithState
};

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

export function getOAuthClientCode() {
return `import { Octokit: Core } from "https://cdn.pika.dev/@octokit/core";
function getOAuthClientCode() {
return `import { Octokit: Core } from "https://cdn.pika.dev/@octokit/core";

@@ -8,1 +8,4 @@ export const Octokit = Core.defaults({

}
export {
getOAuthClientCode
};

@@ -1,26 +0,31 @@

import { createOAuthUserAuth, } from "@octokit/auth-oauth-user";
import {
createOAuthUserAuth
} from "@octokit/auth-oauth-user";
import { emitEvent } from "../emit-event";
export async function getUserOctokitWithState(state, options) {
return state.octokit.auth({
type: "oauth-user",
...options,
async factory(options) {
const octokit = new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: options,
});
const authentication = (await octokit.auth({
type: "get",
}));
await emitEvent(state, {
name: "token",
action: "created",
token: authentication.token,
scopes: authentication.scopes,
authentication,
octokit,
});
return octokit;
},
});
async function getUserOctokitWithState(state, options) {
return state.octokit.auth({
type: "oauth-user",
...options,
async factory(options2) {
const octokit = new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: options2
});
const authentication = await octokit.auth({
type: "get"
});
await emitEvent(state, {
name: "token",
action: "created",
token: authentication.token,
scopes: authentication.scopes,
authentication,
octokit
});
return octokit;
}
});
}
export {
getUserOctokitWithState
};
import * as OAuthMethods from "@octokit/oauth-methods";
export function getWebFlowAuthorizationUrlWithState(state, options) {
const optionsWithDefaults = {
clientId: state.clientId,
request: state.octokit.request,
...options,
allowSignup: state.allowSignup ?? options.allowSignup,
redirectUrl: options.redirectUrl ?? state.redirectUrl,
scopes: options.scopes ?? state.defaultScopes,
};
return OAuthMethods.getWebFlowAuthorizationUrl({
clientType: state.clientType,
...optionsWithDefaults,
});
function getWebFlowAuthorizationUrlWithState(state, options) {
const optionsWithDefaults = {
clientId: state.clientId,
request: state.octokit.request,
...options,
allowSignup: state.allowSignup ?? options.allowSignup,
redirectUrl: options.redirectUrl ?? state.redirectUrl,
scopes: options.scopes ?? state.defaultScopes
};
return OAuthMethods.getWebFlowAuthorizationUrl({
clientType: state.clientType,
...optionsWithDefaults
});
}
export {
getWebFlowAuthorizationUrlWithState
};
import * as OAuthMethods from "@octokit/oauth-methods";
import { emitEvent } from "../emit-event";
import { createOAuthUserAuth } from "@octokit/auth-oauth-user";
export async function refreshTokenWithState(state, options) {
if (state.clientType === "oauth-app") {
throw new Error("[@octokit/oauth-app] app.refreshToken() is not supported for OAuth Apps");
}
const response = await OAuthMethods.refreshToken({
clientType: "github-app",
async function refreshTokenWithState(state, options) {
if (state.clientType === "oauth-app") {
throw new Error(
"[@octokit/oauth-app] app.refreshToken() is not supported for OAuth Apps"
);
}
const response = await OAuthMethods.refreshToken({
clientType: "github-app",
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request,
refreshToken: options.refreshToken
});
const authentication = Object.assign(response.authentication, {
type: "token",
tokenType: "oauth"
});
await emitEvent(state, {
name: "token",
action: "refreshed",
token: response.authentication.token,
authentication,
octokit: new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: {
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request,
refreshToken: options.refreshToken,
});
const authentication = Object.assign(response.authentication, {
type: "token",
tokenType: "oauth",
});
await emitEvent(state, {
name: "token",
action: "refreshed",
token: response.authentication.token,
authentication: authentication,
octokit: new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: {
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
token: response.authentication.token,
},
}),
});
return { ...response, authentication };
token: response.authentication.token
}
})
});
return { ...response, authentication };
}
export {
refreshTokenWithState
};
import * as OAuthMethods from "@octokit/oauth-methods";
import { emitEvent } from "../emit-event";
import { createOAuthUserAuth } from "@octokit/auth-oauth-user";
export async function resetTokenWithState(state, options) {
const optionsWithDefaults = {
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request,
...options,
};
if (state.clientType === "oauth-app") {
const response = await OAuthMethods.resetToken({
clientType: "oauth-app",
...optionsWithDefaults,
});
const authentication = Object.assign(response.authentication, {
type: "token",
tokenType: "oauth",
});
await emitEvent(state, {
name: "token",
action: "reset",
token: response.authentication.token,
scopes: response.authentication.scopes || undefined,
authentication: authentication,
octokit: new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: {
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
token: response.authentication.token,
scopes: response.authentication.scopes,
},
}),
});
return { ...response, authentication };
}
const response = await OAuthMethods.resetToken({
clientType: "github-app",
...optionsWithDefaults,
async function resetTokenWithState(state, options) {
const optionsWithDefaults = {
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request,
...options
};
if (state.clientType === "oauth-app") {
const response2 = await OAuthMethods.resetToken({
clientType: "oauth-app",
...optionsWithDefaults
});
const authentication = Object.assign(response.authentication, {
type: "token",
tokenType: "oauth",
const authentication2 = Object.assign(response2.authentication, {
type: "token",
tokenType: "oauth"
});
await emitEvent(state, {
name: "token",
action: "reset",
token: response.authentication.token,
authentication: authentication,
octokit: new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: {
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
token: response.authentication.token,
},
}),
name: "token",
action: "reset",
token: response2.authentication.token,
scopes: response2.authentication.scopes || void 0,
authentication: authentication2,
octokit: new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: {
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
token: response2.authentication.token,
scopes: response2.authentication.scopes
}
})
});
return { ...response, authentication };
return { ...response2, authentication: authentication2 };
}
const response = await OAuthMethods.resetToken({
clientType: "github-app",
...optionsWithDefaults
});
const authentication = Object.assign(response.authentication, {
type: "token",
tokenType: "oauth"
});
await emitEvent(state, {
name: "token",
action: "reset",
token: response.authentication.token,
authentication,
octokit: new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: {
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
token: response.authentication.token
}
})
});
return { ...response, authentication };
}
export {
resetTokenWithState
};
import * as OAuthMethods from "@octokit/oauth-methods";
import { createOAuthUserAuth } from "@octokit/auth-oauth-user";
import { emitEvent } from "../emit-event";
export async function scopeTokenWithState(state, options) {
if (state.clientType === "oauth-app") {
throw new Error("[@octokit/oauth-app] app.scopeToken() is not supported for OAuth Apps");
}
const response = await OAuthMethods.scopeToken({
clientType: "github-app",
async function scopeTokenWithState(state, options) {
if (state.clientType === "oauth-app") {
throw new Error(
"[@octokit/oauth-app] app.scopeToken() is not supported for OAuth Apps"
);
}
const response = await OAuthMethods.scopeToken({
clientType: "github-app",
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request,
...options
});
const authentication = Object.assign(response.authentication, {
type: "token",
tokenType: "oauth"
});
await emitEvent(state, {
name: "token",
action: "scoped",
token: response.authentication.token,
authentication,
octokit: new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: {
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
request: state.octokit.request,
...options,
});
const authentication = Object.assign(response.authentication, {
type: "token",
tokenType: "oauth",
});
await emitEvent(state, {
name: "token",
action: "scoped",
token: response.authentication.token,
authentication: authentication,
octokit: new state.Octokit({
authStrategy: createOAuthUserAuth,
auth: {
clientType: state.clientType,
clientId: state.clientId,
clientSecret: state.clientSecret,
token: response.authentication.token,
},
}),
});
return { ...response, authentication };
token: response.authentication.token
}
})
});
return { ...response, authentication };
}
export {
scopeTokenWithState
};

@@ -1,12 +0,15 @@

export function parseRequest(request) {
const { method } = request.requestContext.http;
let url = request.rawPath;
const { stage } = request.requestContext;
if (url.startsWith("/" + stage))
url = url.substring(stage.length + 1);
if (request.rawQueryString)
url += "?" + request.rawQueryString;
const headers = request.headers;
const text = async () => request.body || "";
return { method, url, headers, text };
function parseRequest(request) {
const { method } = request.requestContext.http;
let url = request.rawPath;
const { stage } = request.requestContext;
if (url.startsWith("/" + stage))
url = url.substring(stage.length + 1);
if (request.rawQueryString)
url += "?" + request.rawQueryString;
const headers = request.headers;
const text = async () => request.body || "";
return { method, url, headers, text };
}
export {
parseRequest
};

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

export function sendResponse(octokitResponse) {
return {
statusCode: octokitResponse.status,
headers: octokitResponse.headers,
body: octokitResponse.text,
};
function sendResponse(octokitResponse) {
return {
statusCode: octokitResponse.status,
headers: octokitResponse.headers,
body: octokitResponse.text
};
}
export {
sendResponse
};

@@ -6,16 +6,24 @@ import { parseRequest } from "./api-gateway-v2-parse-request";

async function onUnhandledRequestDefaultAWSAPIGatewayV2(event) {
const request = parseRequest(event);
const response = onUnhandledRequestDefault(request);
return sendResponse(response);
}
function createAWSLambdaAPIGatewayV2Handler(app, {
pathPrefix,
onUnhandledRequest
} = {}) {
if (onUnhandledRequest) {
app.octokit.log.warn(
"[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version."
);
}
onUnhandledRequest ?? (onUnhandledRequest = onUnhandledRequestDefaultAWSAPIGatewayV2);
return async function(event) {
const request = parseRequest(event);
const response = onUnhandledRequestDefault(request);
return sendResponse(response);
const response = await handleRequest(app, { pathPrefix }, request);
return response ? sendResponse(response) : onUnhandledRequest(event);
};
}
export function createAWSLambdaAPIGatewayV2Handler(app, { pathPrefix, onUnhandledRequest, } = {}) {
if (onUnhandledRequest) {
app.octokit.log.warn("[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version.");
}
onUnhandledRequest ?? (onUnhandledRequest = onUnhandledRequestDefaultAWSAPIGatewayV2);
return async function (event) {
const request = parseRequest(event);
const response = await handleRequest(app, { pathPrefix }, request);
return response ? sendResponse(response) : onUnhandledRequest(event);
};
}
export {
createAWSLambdaAPIGatewayV2Handler
};

@@ -1,218 +0,225 @@

// @ts-ignore - requires esModuleInterop flag
import fromEntries from "fromentries";
export async function handleRequest(app, { pathPrefix = "/api/github/oauth" }, request) {
if (request.method === "OPTIONS") {
return {
status: 200,
headers: {
"access-control-allow-origin": "*",
"access-control-allow-methods": "*",
"access-control-allow-headers": "Content-Type, User-Agent, Authorization",
},
};
}
// request.url may include ?query parameters which we don't want for `route`
// hence the workaround using new URL()
const { pathname } = new URL(request.url, "http://localhost");
const route = [request.method, pathname].join(" ");
const routes = {
getLogin: `GET ${pathPrefix}/login`,
getCallback: `GET ${pathPrefix}/callback`,
createToken: `POST ${pathPrefix}/token`,
getToken: `GET ${pathPrefix}/token`,
patchToken: `PATCH ${pathPrefix}/token`,
patchRefreshToken: `PATCH ${pathPrefix}/refresh-token`,
scopeToken: `POST ${pathPrefix}/token/scoped`,
deleteToken: `DELETE ${pathPrefix}/token`,
deleteGrant: `DELETE ${pathPrefix}/grant`,
async function handleRequest(app, { pathPrefix = "/api/github/oauth" }, request) {
if (request.method === "OPTIONS") {
return {
status: 200,
headers: {
"access-control-allow-origin": "*",
"access-control-allow-methods": "*",
"access-control-allow-headers": "Content-Type, User-Agent, Authorization"
}
};
// handle unknown routes
if (!Object.values(routes).includes(route)) {
return null;
}
const { pathname } = new URL(request.url, "http://localhost");
const route = [request.method, pathname].join(" ");
const routes = {
getLogin: `GET ${pathPrefix}/login`,
getCallback: `GET ${pathPrefix}/callback`,
createToken: `POST ${pathPrefix}/token`,
getToken: `GET ${pathPrefix}/token`,
patchToken: `PATCH ${pathPrefix}/token`,
patchRefreshToken: `PATCH ${pathPrefix}/refresh-token`,
scopeToken: `POST ${pathPrefix}/token/scoped`,
deleteToken: `DELETE ${pathPrefix}/token`,
deleteGrant: `DELETE ${pathPrefix}/grant`
};
if (!Object.values(routes).includes(route)) {
return null;
}
let json;
try {
const text = await request.text();
json = text ? JSON.parse(text) : {};
} catch (error) {
return {
status: 400,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*"
},
text: JSON.stringify({
error: "[@octokit/oauth-app] request error"
})
};
}
const { searchParams } = new URL(request.url, "http://localhost");
const query = fromEntries(searchParams);
const headers = request.headers;
try {
if (route === routes.getLogin) {
const { url } = app.getWebFlowAuthorizationUrl({
state: query.state,
scopes: query.scopes ? query.scopes.split(",") : void 0,
allowSignup: query.allowSignup ? query.allowSignup === "true" : void 0,
redirectUrl: query.redirectUrl
});
return { status: 302, headers: { location: url } };
}
let json;
try {
const text = await request.text();
json = text ? JSON.parse(text) : {};
if (route === routes.getCallback) {
if (query.error) {
throw new Error(
`[@octokit/oauth-app] ${query.error} ${query.error_description}`
);
}
if (!query.code) {
throw new Error('[@octokit/oauth-app] "code" parameter is required');
}
const {
authentication: { token: token2 }
} = await app.createToken({
code: query.code
});
return {
status: 200,
headers: {
"content-type": "text/html"
},
text: `<h1>Token created successfully</h1>
<p>Your token is: <strong>${token2}</strong>. Copy it now as it cannot be shown again.</p>`
};
}
catch (error) {
return {
status: 400,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*",
},
text: JSON.stringify({
error: "[@octokit/oauth-app] request error",
}),
};
if (route === routes.createToken) {
const { code, redirectUrl } = json;
if (!code) {
throw new Error('[@octokit/oauth-app] "code" parameter is required');
}
const result = await app.createToken({
code,
redirectUrl
});
delete result.authentication.clientSecret;
return {
status: 201,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*"
},
text: JSON.stringify(result)
};
}
const { searchParams } = new URL(request.url, "http://localhost");
const query = fromEntries(searchParams);
const headers = request.headers;
try {
if (route === routes.getLogin) {
const { url } = app.getWebFlowAuthorizationUrl({
state: query.state,
scopes: query.scopes ? query.scopes.split(",") : undefined,
allowSignup: query.allowSignup
? query.allowSignup === "true"
: undefined,
redirectUrl: query.redirectUrl,
});
return { status: 302, headers: { location: url } };
}
if (route === routes.getCallback) {
if (query.error) {
throw new Error(`[@octokit/oauth-app] ${query.error} ${query.error_description}`);
}
if (!query.code) {
throw new Error('[@octokit/oauth-app] "code" parameter is required');
}
const { authentication: { token }, } = await app.createToken({
code: query.code,
});
return {
status: 200,
headers: {
"content-type": "text/html",
},
text: `<h1>Token created successfully</h1>
<p>Your token is: <strong>${token}</strong>. Copy it now as it cannot be shown again.</p>`,
};
}
if (route === routes.createToken) {
const { code, redirectUrl } = json;
if (!code) {
throw new Error('[@octokit/oauth-app] "code" parameter is required');
}
const result = await app.createToken({
code,
redirectUrl,
});
// @ts-ignore
delete result.authentication.clientSecret;
return {
status: 201,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*",
},
text: JSON.stringify(result),
};
}
if (route === routes.getToken) {
const token = headers.authorization?.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
}
const result = await app.checkToken({
token,
});
// @ts-ignore
delete result.authentication.clientSecret;
return {
status: 200,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*",
},
text: JSON.stringify(result),
};
}
if (route === routes.patchToken) {
const token = headers.authorization?.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
}
const result = await app.resetToken({ token });
// @ts-ignore
delete result.authentication.clientSecret;
return {
status: 200,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*",
},
text: JSON.stringify(result),
};
}
if (route === routes.patchRefreshToken) {
const token = headers.authorization?.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
}
const { refreshToken } = json;
if (!refreshToken) {
throw new Error("[@octokit/oauth-app] refreshToken must be sent in request body");
}
const result = await app.refreshToken({ refreshToken });
// @ts-ignore
delete result.authentication.clientSecret;
return {
status: 200,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*",
},
text: JSON.stringify(result),
};
}
if (route === routes.scopeToken) {
const token = headers.authorization?.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
}
const result = await app.scopeToken({
token,
...json,
});
// @ts-ignore
delete result.authentication.clientSecret;
return {
status: 200,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*",
},
text: JSON.stringify(result),
};
}
if (route === routes.deleteToken) {
const token = headers.authorization?.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
}
await app.deleteToken({
token,
});
return {
status: 204,
headers: { "access-control-allow-origin": "*" },
};
}
// route === routes.deleteGrant
const token = headers.authorization?.substr("token ".length);
if (!token) {
throw new Error('[@octokit/oauth-app] "Authorization" header is required');
}
await app.deleteAuthorization({
token,
});
return {
status: 204,
headers: { "access-control-allow-origin": "*" },
};
if (route === routes.getToken) {
const token2 = headers.authorization?.substr("token ".length);
if (!token2) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
const result = await app.checkToken({
token: token2
});
delete result.authentication.clientSecret;
return {
status: 200,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*"
},
text: JSON.stringify(result)
};
}
catch (error) {
return {
status: 400,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*",
},
text: JSON.stringify({ error: error.message }),
};
if (route === routes.patchToken) {
const token2 = headers.authorization?.substr("token ".length);
if (!token2) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
const result = await app.resetToken({ token: token2 });
delete result.authentication.clientSecret;
return {
status: 200,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*"
},
text: JSON.stringify(result)
};
}
if (route === routes.patchRefreshToken) {
const token2 = headers.authorization?.substr("token ".length);
if (!token2) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
const { refreshToken } = json;
if (!refreshToken) {
throw new Error(
"[@octokit/oauth-app] refreshToken must be sent in request body"
);
}
const result = await app.refreshToken({ refreshToken });
delete result.authentication.clientSecret;
return {
status: 200,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*"
},
text: JSON.stringify(result)
};
}
if (route === routes.scopeToken) {
const token2 = headers.authorization?.substr("token ".length);
if (!token2) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
const result = await app.scopeToken({
token: token2,
...json
});
delete result.authentication.clientSecret;
return {
status: 200,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*"
},
text: JSON.stringify(result)
};
}
if (route === routes.deleteToken) {
const token2 = headers.authorization?.substr("token ".length);
if (!token2) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
await app.deleteToken({
token: token2
});
return {
status: 204,
headers: { "access-control-allow-origin": "*" }
};
}
const token = headers.authorization?.substr("token ".length);
if (!token) {
throw new Error(
'[@octokit/oauth-app] "Authorization" header is required'
);
}
await app.deleteAuthorization({
token
});
return {
status: 204,
headers: { "access-control-allow-origin": "*" }
};
} catch (error) {
return {
status: 400,
headers: {
"content-type": "application/json",
"access-control-allow-origin": "*"
},
text: JSON.stringify({ error: error.message })
};
}
}
export {
handleRequest
};

@@ -6,24 +6,34 @@ import { parseRequest } from "./parse-request";

function onUnhandledRequestDefaultNode(request, response) {
const octokitRequest = parseRequest(request);
const octokitResponse = onUnhandledRequestDefault(octokitRequest);
sendResponse(octokitResponse, response);
}
function createNodeMiddleware(app, {
pathPrefix,
onUnhandledRequest
} = {}) {
if (onUnhandledRequest) {
app.octokit.log.warn(
"[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version."
);
}
onUnhandledRequest ?? (onUnhandledRequest = onUnhandledRequestDefaultNode);
return async function(request, response, next) {
const octokitRequest = parseRequest(request);
const octokitResponse = onUnhandledRequestDefault(octokitRequest);
sendResponse(octokitResponse, response);
}
export function createNodeMiddleware(app, { pathPrefix, onUnhandledRequest, } = {}) {
if (onUnhandledRequest) {
app.octokit.log.warn("[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version.");
const octokitResponse = await handleRequest(
app,
{ pathPrefix },
octokitRequest
);
if (octokitResponse) {
sendResponse(octokitResponse, response);
} else if (typeof next === "function") {
next();
} else {
onUnhandledRequest(request, response);
}
onUnhandledRequest ?? (onUnhandledRequest = onUnhandledRequestDefaultNode);
return async function (request, response, next) {
const octokitRequest = parseRequest(request);
const octokitResponse = await handleRequest(app, { pathPrefix }, octokitRequest);
if (octokitResponse) {
sendResponse(octokitResponse, response);
}
else if (typeof next === "function") {
next();
}
else {
onUnhandledRequest(request, response);
}
};
};
}
export {
createNodeMiddleware
};

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

export function parseRequest(request) {
const { method, url, headers } = request;
async function text() {
const text = await new Promise((resolve, reject) => {
let bodyChunks = [];
request
.on("error", reject)
.on("data", (chunk) => bodyChunks.push(chunk))
.on("end", () => resolve(Buffer.concat(bodyChunks).toString()));
});
return text;
}
return { method, url, headers, text };
function parseRequest(request) {
const { method, url, headers } = request;
async function text() {
const text2 = await new Promise((resolve, reject) => {
let bodyChunks = [];
request.on("error", reject).on("data", (chunk) => bodyChunks.push(chunk)).on("end", () => resolve(Buffer.concat(bodyChunks).toString()));
});
return text2;
}
return { method, url, headers, text };
}
export {
parseRequest
};

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

export function sendResponse(octokitResponse, response) {
response.writeHead(octokitResponse.status, octokitResponse.headers);
response.end(octokitResponse.text);
function sendResponse(octokitResponse, response) {
response.writeHead(octokitResponse.status, octokitResponse.headers);
response.end(octokitResponse.text);
}
export {
sendResponse
};

@@ -1,9 +0,12 @@

export function onUnhandledRequestDefault(request) {
return {
status: 404,
headers: { "content-type": "application/json" },
text: JSON.stringify({
error: `Unknown route: ${request.method} ${request.url}`,
}),
};
function onUnhandledRequestDefault(request) {
return {
status: 404,
headers: { "content-type": "application/json" },
text: JSON.stringify({
error: `Unknown route: ${request.method} ${request.url}`
})
};
}
export {
onUnhandledRequestDefault
};

@@ -6,23 +6,35 @@ import { parseRequest } from "./parse-request";

async function onUnhandledRequestDefaultWebWorker(request) {
const octokitRequest = parseRequest(request);
const octokitResponse = onUnhandledRequestDefault(octokitRequest);
return sendResponse(octokitResponse);
}
function createWebWorkerHandler(app, {
pathPrefix,
onUnhandledRequest
} = {}) {
if (onUnhandledRequest) {
app.octokit.log.warn(
"[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version."
);
}
onUnhandledRequest ?? (onUnhandledRequest = onUnhandledRequestDefaultWebWorker);
return async function(request) {
const octokitRequest = parseRequest(request);
const octokitResponse = onUnhandledRequestDefault(octokitRequest);
return sendResponse(octokitResponse);
const octokitResponse = await handleRequest(
app,
{ pathPrefix },
octokitRequest
);
return octokitResponse ? sendResponse(octokitResponse) : await onUnhandledRequest(request);
};
}
export function createWebWorkerHandler(app, { pathPrefix, onUnhandledRequest, } = {}) {
if (onUnhandledRequest) {
app.octokit.log.warn("[@octokit/oauth-app] `onUnhandledRequest` is deprecated and will be removed from the next major version.");
}
onUnhandledRequest ?? (onUnhandledRequest = onUnhandledRequestDefaultWebWorker);
return async function (request) {
const octokitRequest = parseRequest(request);
const octokitResponse = await handleRequest(app, { pathPrefix }, octokitRequest);
return octokitResponse
? sendResponse(octokitResponse)
: await onUnhandledRequest(request);
};
function createCloudflareHandler(...args) {
args[0].octokit.log.warn(
"[@octokit/oauth-app] `createCloudflareHandler` is deprecated, use `createWebWorkerHandler` instead"
);
return createWebWorkerHandler(...args);
}
/** @deprecated */
export function createCloudflareHandler(...args) {
args[0].octokit.log.warn("[@octokit/oauth-app] `createCloudflareHandler` is deprecated, use `createWebWorkerHandler` instead");
return createWebWorkerHandler(...args);
}
export {
createCloudflareHandler,
createWebWorkerHandler
};

@@ -1,10 +0,12 @@

export function parseRequest(request) {
// @ts-ignore Worker environment supports fromEntries/entries.
const headers = Object.fromEntries(request.headers.entries());
return {
method: request.method,
url: request.url,
headers,
text: () => request.text(),
};
function parseRequest(request) {
const headers = Object.fromEntries(request.headers.entries());
return {
method: request.method,
url: request.url,
headers,
text: () => request.text()
};
}
export {
parseRequest
};

@@ -1,6 +0,9 @@

export function sendResponse(octokitResponse) {
return new Response(octokitResponse.text, {
status: octokitResponse.status,
headers: octokitResponse.headers,
});
function sendResponse(octokitResponse) {
return new Response(octokitResponse.text, {
status: octokitResponse.status,
headers: octokitResponse.headers
});
}
export {
sendResponse
};
import { Octokit } from "@octokit/core";
import { getUserAgent } from "universal-user-agent";
import { VERSION } from "./version";
export const OAuthAppOctokit = Octokit.defaults({
userAgent: `octokit-oauth-app.js/${VERSION} ${getUserAgent()}`,
const OAuthAppOctokit = Octokit.defaults({
userAgent: `octokit-oauth-app.js/${VERSION} ${getUserAgent()}`
});
export {
OAuthAppOctokit
};

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

export const VERSION = "4.2.1";
const VERSION = "4.2.2";
export {
VERSION
};

@@ -8,2 +8,2 @@ import { OAuthApp } from "../../index";

/** @deprecated */
export declare function createCloudflareHandler<T>(...args: Parameters<typeof createWebWorkerHandler>): (request: Request) => Promise<Response>;
export declare function createCloudflareHandler<T extends Options<ClientType>>(...args: Parameters<typeof createWebWorkerHandler>): (request: Request) => Promise<Response>;

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

export declare const VERSION = "4.2.1";
export declare const VERSION = "4.2.2";
{
"name": "@octokit/oauth-app",
"version": "4.2.2",
"description": "GitHub OAuth toolset for Node.js",
"version": "4.2.1",
"license": "MIT",
"files": [
"dist-*/**",
"bin/**"
],
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"main": "dist-node/index.js",
"pika": true,
"sideEffects": false,
"repository": "github:octokit/oauth-app.js",
"keywords": [

@@ -21,3 +12,4 @@ "github",

],
"repository": "github:octokit/oauth-app.js",
"author": "Gregor Martynus (https://twitter.com/gr2m)",
"license": "MIT",
"dependencies": {

@@ -35,10 +27,10 @@ "@octokit/auth-oauth-app": "^5.0.0",

"devDependencies": {
"@pika/pack": "^0.3.7",
"@pika/plugin-build-node": "^0.9.2",
"@pika/plugin-ts-standard-pkg": "^0.9.2",
"@octokit/tsconfig": "^1.0.2",
"@types/jest": "^29.0.0",
"@types/node": "^18.0.0",
"@types/node-fetch": "^2.5.4",
"esbuild": "^0.17.19",
"express": "^4.17.1",
"fetch-mock": "^9.0.0",
"glob": "^10.2.5",
"jest": "^29.0.0",

@@ -52,8 +44,16 @@ "nock": "^13.0.0",

},
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">= 14"
},
"publishConfig": {
"access": "public"
}
"files": [
"dist-*/**",
"bin/**"
],
"main": "dist-node/index.js",
"types": "dist-types/index.d.ts",
"source": "dist-src/index.js",
"sideEffects": false
}

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