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

@octokit/app

Package Overview
Dependencies
Maintainers
4
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 13.0.11 to 13.1.0

97

dist-node/index.js

@@ -12,5 +12,6 @@ 'use strict';

const VERSION = "13.0.11";
const VERSION = "13.1.0";
function webhooks(appOctokit, options // Explict return type for better debugability and performance,
function webhooks(appOctokit, options
// Explict return type for better debugability and performance,
// see https://github.com/octokit/app.js/pull/201

@@ -28,7 +29,7 @@ ) {

});
return { ...event,
octokit: octokit
return {
...event,
octokit
};
}
const installationId = event.payload.installation.id;

@@ -38,8 +39,9 @@ const octokit = await appOctokit.auth({

installationId,
factory(auth) {
return new auth.octokit.constructor({ ...auth.octokitOptions,
return new auth.octokit.constructor({
...auth.octokitOptions,
authStrategy: authApp.createAppAuth,
...{
auth: { ...auth,
auth: {
...auth,
installationId

@@ -50,6 +52,15 @@ }

}
});
return { ...event,
octokit: octokit
// set `x-github-delivery` header on all requests sent in response to the current
// event. This allows GitHub Support to correlate the request with the event.
// This is not documented and not considered public API, the header may change.
// Once we document this as best practice on https://docs.github.com/en/rest/guides/best-practices-for-integrators
// we will make it official
/* istanbul ignore next */
octokit.hook.before("request", options => {
options.headers["x-github-delivery"] = event.id;
});
return {
...event,
octokit
};

@@ -64,8 +75,9 @@ }

installationId: installationId,
factory(auth) {
const options = { ...auth.octokitOptions,
const options = {
...auth.octokitOptions,
authStrategy: authApp.createAppAuth,
...{
auth: { ...auth,
auth: {
...auth,
installationId: installationId

@@ -77,3 +89,2 @@ }

}
});

@@ -90,3 +101,2 @@ }

let result = await i.next();
while (!result.done) {

@@ -101,3 +111,2 @@ await callback(result.value);

const iterator = pluginPaginateRest.composePaginateRest.iterator(app.octokit, "GET /app/installations");
for await (const {

@@ -115,3 +124,2 @@ data: installations

}
};

@@ -128,3 +136,2 @@ }

let result = await i.next();
while (!result.done) {

@@ -136,7 +143,5 @@ if (callback) {

}
result = await i.next();
}
}
function singleInstallationIterator(app, installationId) {

@@ -149,6 +154,4 @@ return {

}
};
}
function eachRepositoryIterator(app, query) {

@@ -158,3 +161,2 @@ return {

const iterator = query ? singleInstallationIterator(app, query.installationId) : app.eachInstallation.iterator();
for await (const {

@@ -164,3 +166,2 @@ octokit

const repositoriesIterator = pluginPaginateRest.composePaginateRest.iterator(octokit, "GET /installation/repositories");
for await (const {

@@ -178,3 +179,2 @@ data: repositories

}
};

@@ -193,3 +193,2 @@ }

function noop() {}
function createNodeMiddleware(app, options = {}) {

@@ -229,13 +228,9 @@ const log = Object.assign({

} = 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) {

@@ -245,3 +240,2 @@ // @ts-ignore `next` must be a function as we check two lines above

}
return options.onUnhandledRequest(request, response);

@@ -251,2 +245,13 @@ }

class App {
static defaults(defaults) {
const AppWithDefaults = class extends this {
constructor(...args) {
super({
...defaults,
...args[0]
});
}
};
return AppWithDefaults;
}
constructor(options) {

@@ -271,4 +276,4 @@ const Octokit = options.Octokit || core.Octokit;

error: console.error.bind(console)
}, options.log); // set app.webhooks depending on whether "webhooks" option has been passed
}, options.log);
// set app.webhooks depending on whether "webhooks" option has been passed
if (options.webhooks) {

@@ -282,9 +287,8 @@ // @ts-expect-error TODO: figure this out

}
});
} // set app.oauth depending on whether "oauth" option has been passed
}
// set app.oauth depending on whether "oauth" option has been passed
if (options.oauth) {
this.oauth = new oauthApp.OAuthApp({ ...options.oauth,
this.oauth = new oauthApp.OAuthApp({
...options.oauth,
clientType: "github-app",

@@ -298,6 +302,4 @@ Octokit

}
});
}
this.getInstallationOctokit = getInstallationOctokit.bind(null, this);

@@ -307,15 +309,2 @@ this.eachInstallation = eachInstallationFactory(this);

}
static defaults(defaults) {
const AppWithDefaults = class extends this {
constructor(...args) {
super({ ...defaults,
...args[0]
});
}
};
return AppWithDefaults;
}
}

@@ -322,0 +311,0 @@ App.VERSION = VERSION;

@@ -10,2 +10,13 @@ import { Octokit as OctokitCore } from "@octokit/core";

export class App {
static defaults(defaults) {
const AppWithDefaults = class extends this {
constructor(...args) {
super({
...defaults,
...args[0],
});
}
};
return AppWithDefaults;
}
constructor(options) {

@@ -65,15 +76,4 @@ const Octokit = (options.Octokit ||

}
static defaults(defaults) {
const AppWithDefaults = class extends this {
constructor(...args) {
super({
...defaults,
...args[0],
});
}
};
return AppWithDefaults;
}
}
App.VERSION = VERSION;
export { createNodeMiddleware } from "./middleware/node/index";

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

export const VERSION = "13.0.11";
export const VERSION = "13.1.0";

@@ -21,3 +21,3 @@ import { createAppAuth } from "@octokit/auth-app";

...event,
octokit: octokit,
octokit,
};

@@ -42,5 +42,14 @@ }

}));
// set `x-github-delivery` header on all requests sent in response to the current
// event. This allows GitHub Support to correlate the request with the event.
// This is not documented and not considered public API, the header may change.
// Once we document this as best practice on https://docs.github.com/en/rest/guides/best-practices-for-integrators
// we will make it official
/* istanbul ignore next */
octokit.hook.before("request", (options) => {
options.headers["x-github-delivery"] = event.id;
});
return {
...event,
octokit: octokit,
octokit,
};

@@ -47,0 +56,0 @@ },

@@ -5,5 +5,5 @@ import { Octokit as OctokitCore } from "@octokit/core";

import { Options, ConstructorOptions, EachInstallationInterface, EachRepositoryInterface, GetInstallationOctokitInterface } from "./types";
declare type Constructor<T> = new (...args: any[]) => T;
declare type OctokitType<TOptions extends Options> = TOptions["Octokit"] extends typeof OctokitCore ? InstanceType<TOptions["Octokit"]> : OctokitCore;
declare type OctokitClassType<TOptions extends Options> = TOptions["Octokit"] extends typeof OctokitCore ? TOptions["Octokit"] : typeof OctokitCore;
type Constructor<T> = new (...args: any[]) => T;
type OctokitType<TOptions extends Options> = TOptions["Octokit"] extends typeof OctokitCore ? InstanceType<TOptions["Octokit"]> : OctokitCore;
type OctokitClassType<TOptions extends Options> = TOptions["Octokit"] extends typeof OctokitCore ? TOptions["Octokit"] : typeof OctokitCore;
export declare class App<TOptions extends Options = Options> {

@@ -10,0 +10,0 @@ static VERSION: string;

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

declare type IncomingMessage = any;
declare type ServerResponse = any;
type IncomingMessage = any;
type ServerResponse = any;
import { App } from "../../index";
import { Options } from "../../types";
export declare type MiddlewareOptions = {
export type MiddlewareOptions = {
pathPrefix?: string;

@@ -7,0 +7,0 @@ log?: Options["log"];

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

declare type IncomingMessage = any;
declare type ServerResponse = any;
type IncomingMessage = any;
type ServerResponse = any;
export declare function onUnhandledRequestDefault(request: IncomingMessage, response: ServerResponse): void;
export {};
import { Octokit } from "@octokit/core";
import { Endpoints } from "@octokit/types";
export declare type Options = {
export type Options = {
appId?: number | string;

@@ -22,11 +22,11 @@ privateKey?: string;

};
export declare type ConstructorOptions<TOptions extends Options> = TOptions & {
export type ConstructorOptions<TOptions extends Options> = TOptions & {
appId: number | string;
privateKey: string;
};
export declare type InstallationFunctionOptions<O> = {
export type InstallationFunctionOptions<O> = {
octokit: O;
installation: Endpoints["GET /app/installations"]["response"]["data"][0];
};
export declare type EachInstallationFunction<O> = (options: InstallationFunctionOptions<O>) => unknown | Promise<unknown>;
export type EachInstallationFunction<O> = (options: InstallationFunctionOptions<O>) => unknown | Promise<unknown>;
export interface EachInstallationInterface<O> {

@@ -36,8 +36,8 @@ (callback: EachInstallationFunction<O>): Promise<void>;

}
declare type EachRepositoryFunctionOptions<O> = {
type EachRepositoryFunctionOptions<O> = {
octokit: O;
repository: Endpoints["GET /installation/repositories"]["response"]["data"]["repositories"][0];
};
export declare type EachRepositoryFunction<O> = (options: EachRepositoryFunctionOptions<O>) => unknown | Promise<unknown>;
export declare type EachRepositoryQuery = {
export type EachRepositoryFunction<O> = (options: EachRepositoryFunctionOptions<O>) => unknown | Promise<unknown>;
export type EachRepositoryQuery = {
installationId: number;

@@ -44,0 +44,0 @@ };

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

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

@@ -30,3 +30,3 @@ "files": [

"@types/jest": "^29.0.0",
"@types/node": "^16.0.0",
"@types/node": "^18.0.0",
"@types/node-fetch": "^2.5.8",

@@ -38,3 +38,3 @@ "express": "^4.17.1",

"node-fetch": "^2.6.7",
"prettier": "2.7.1",
"prettier": "2.8.0",
"semantic-release-plugin-update-version-in-files": "^1.0.0",

@@ -41,0 +41,0 @@ "ts-jest": "^29.0.0",

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