Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@octokit/app

Package Overview
Dependencies
Maintainers
2
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/app - npm Package Compare versions

Comparing version 12.0.2 to 12.0.3

160

dist-node/index.js

@@ -12,20 +12,54 @@ 'use strict';

function _asyncIterator(iterable) {
var method;
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (typeof Symbol !== "undefined") {
if (Symbol.asyncIterator) {
method = iterable[Symbol.asyncIterator];
if (method != null) return method.call(iterable);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
if (Symbol.iterator) {
method = iterable[Symbol.iterator];
if (method != null) return method.call(iterable);
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));
});
}
}
throw new TypeError("Object is not async iterable");
return target;
}
function _asyncIterator(iterable) {
var method;
if (typeof Symbol !== "undefined") {
if (Symbol.asyncIterator) method = iterable[Symbol.asyncIterator];
if (method == null && Symbol.iterator) method = iterable[Symbol.iterator];
}
if (method == null) method = iterable["@@asyncIterator"];
if (method == null) method = iterable["@@iterator"];
if (method == null) throw new TypeError("Object is not async iterable");
return method.call(iterable);
}
function _AwaitValue(value) {

@@ -114,7 +148,5 @@ this.wrapped = value;

if (typeof Symbol === "function" && Symbol.asyncIterator) {
_AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}
_AsyncGenerator.prototype[typeof Symbol === "function" && Symbol.asyncIterator || "@@asyncIterator"] = function () {
return this;
};

@@ -158,38 +190,4 @@ _AsyncGenerator.prototype.next = function (arg) {

function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
const VERSION = "12.0.3";
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;
}
const VERSION = "12.0.2";
function webhooks(appOctokit, options // Explict return type for better debugability and performance,

@@ -427,8 +425,4 @@ // see https://github.com/octokit/app.js/pull/201

function createNodeMiddleware(app, {
pathPrefix = "/api/github",
onUnhandledRequest = onUnhandledRequestDefault,
log
} = {}) {
const logWithDefaults = Object.assign({
function createNodeMiddleware(app, options = {}) {
const log = Object.assign({
debug: noop,

@@ -438,13 +432,51 @@ info: noop,

error: console.error.bind(console)
}, log);
return webhooks$1.createNodeMiddleware(app.webhooks, {
path: pathPrefix + "/webhooks",
log: logWithDefaults,
onUnhandledRequest: oauthApp.createNodeMiddleware(app.oauth, {
onUnhandledRequest,
pathPrefix: pathPrefix + "/oauth"
})
}, options.log);
const optionsWithDefaults = _objectSpread2(_objectSpread2({
onUnhandledRequest: onUnhandledRequestDefault,
pathPrefix: "/api/github"
}, options), {}, {
log
});
const webhooksMiddleware = webhooks$1.createNodeMiddleware(app.webhooks, {
path: optionsWithDefaults.pathPrefix + "/webhooks",
log,
onUnhandledRequest: optionsWithDefaults.onUnhandledRequest
});
const oauthMiddleware = oauthApp.createNodeMiddleware(app.oauth, {
pathPrefix: optionsWithDefaults.pathPrefix + "/oauth",
onUnhandledRequest: optionsWithDefaults.onUnhandledRequest
});
return middleware.bind(null, optionsWithDefaults, {
webhooksMiddleware,
oauthMiddleware
});
}
async function middleware(options, {
webhooksMiddleware,
oauthMiddleware
}, request, response, next) {
const {
pathname
} = new URL(request.url, "http://localhost");
if (pathname === `${options.pathPrefix}/webhooks`) {
return webhooksMiddleware(request, response, next);
}
if (pathname.startsWith(`${options.pathPrefix}/oauth/`)) {
return oauthMiddleware(request, response, next);
}
const isExpressMiddleware = typeof next === "function";
if (isExpressMiddleware) {
// @ts-ignore `next` must be a function as we check two lines above
return next();
}
return options.onUnhandledRequest(request, response);
}
class App {

@@ -451,0 +483,0 @@ constructor(options) {

46

dist-src/middleware/node/index.js

@@ -5,4 +5,4 @@ import { createNodeMiddleware as oauthNodeMiddleware } from "@octokit/oauth-app";

function noop() { }
export function createNodeMiddleware(app, { pathPrefix = "/api/github", onUnhandledRequest = onUnhandledRequestDefault, log, } = {}) {
const logWithDefaults = Object.assign({
export function createNodeMiddleware(app, options = {}) {
const log = Object.assign({
debug: noop,

@@ -12,11 +12,37 @@ info: noop,

error: console.error.bind(console),
}, log);
return webhooksNodeMiddleware(app.webhooks, {
path: pathPrefix + "/webhooks",
log: logWithDefaults,
onUnhandledRequest: oauthNodeMiddleware(app.oauth, {
onUnhandledRequest,
pathPrefix: pathPrefix + "/oauth",
}),
}, options.log);
const optionsWithDefaults = {
onUnhandledRequest: onUnhandledRequestDefault,
pathPrefix: "/api/github",
...options,
log,
};
const webhooksMiddleware = webhooksNodeMiddleware(app.webhooks, {
path: optionsWithDefaults.pathPrefix + "/webhooks",
log,
onUnhandledRequest: optionsWithDefaults.onUnhandledRequest,
});
const oauthMiddleware = oauthNodeMiddleware(app.oauth, {
pathPrefix: optionsWithDefaults.pathPrefix + "/oauth",
onUnhandledRequest: optionsWithDefaults.onUnhandledRequest,
});
return middleware.bind(null, optionsWithDefaults, {
webhooksMiddleware,
oauthMiddleware,
});
}
export async function middleware(options, { webhooksMiddleware, oauthMiddleware }, request, response, next) {
const { pathname } = new URL(request.url, "http://localhost");
if (pathname === `${options.pathPrefix}/webhooks`) {
return webhooksMiddleware(request, response, next);
}
if (pathname.startsWith(`${options.pathPrefix}/oauth/`)) {
return oauthMiddleware(request, response, next);
}
const isExpressMiddleware = typeof next === "function";
if (isExpressMiddleware) {
// @ts-ignore `next` must be a function as we check two lines above
return next();
}
return options.onUnhandledRequest(request, response);
}

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

export const VERSION = "12.0.2";
export const VERSION = "12.0.3";

@@ -67,3 +67,3 @@ import { Octokit } from "@octokit/core";

app_slug: string;
suspended_by?: {
suspended_by: {
login: string;

@@ -88,4 +88,4 @@ id: number;

starred_at?: string | undefined;
} | null | undefined;
suspended_at?: string | null | undefined;
} | null;
suspended_at: string | null;
contact_email?: string | null | undefined;

@@ -92,0 +92,0 @@ };

@@ -22,2 +22,23 @@ import { Octokit } from "@octokit/core";

};
organization: {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at: string;
};
forks: number;

@@ -24,0 +45,0 @@ permissions: {

@@ -5,3 +5,3 @@ declare type IncomingMessage = any;

import { Options } from "../../types";
export declare type CreateNodeMiddlewareOptions = {
export declare type MiddlewareOptions = {
pathPrefix?: string;

@@ -11,3 +11,4 @@ log?: Options["log"];

};
export declare function createNodeMiddleware(app: App, { pathPrefix, onUnhandledRequest, log, }?: CreateNodeMiddlewareOptions): (request: any, response: any, next?: Function | undefined) => Promise<any>;
export declare function createNodeMiddleware(app: App, options?: MiddlewareOptions): (request: any, response: any, next?: Function | undefined) => Promise<any>;
export declare function middleware(options: Required<MiddlewareOptions>, { webhooksMiddleware, oauthMiddleware }: any, request: IncomingMessage, response: ServerResponse, next?: Function): Promise<any>;
export {};

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

export declare const VERSION = "12.0.2";
export declare const VERSION = "12.0.3";
{
"name": "@octokit/app",
"description": "GitHub Apps toolset for Node.js",
"version": "12.0.2",
"version": "12.0.3",
"license": "MIT",

@@ -29,10 +29,11 @@ "files": [

"@types/node-fetch": "^2.5.8",
"express": "^4.17.1",
"fetch-mock": "^9.10.7",
"jest": "^26.6.1",
"jest": "^27.0.0",
"mockdate": "^3.0.2",
"node-fetch": "^2.6.1",
"prettier": "^2.0.0",
"prettier": "2.3.0",
"semantic-release": "^17.0.0",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
"ts-jest": "^26.4.3",
"ts-jest": "^27.0.0-next.12",
"typescript": "^4.0.5"

@@ -39,0 +40,0 @@ },

@@ -320,3 +320,3 @@ # app.js

Native http server middleware for Node.js
Middleware for Node's built in http server or [`express`](https://expressjs.com/).

@@ -323,0 +323,0 @@ ```js

Sorry, the diff of this file is not supported yet

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