@octokit/app
Advanced tools
Comparing version 11.1.0 to 11.2.0
@@ -190,3 +190,3 @@ 'use strict'; | ||
const VERSION = "11.1.0"; | ||
const VERSION = "11.2.0"; | ||
@@ -198,3 +198,2 @@ function webhooks(appOctokit, options // Explict return type for better debugability and performance, | ||
secret: options.secret, | ||
path: "/api/github/webhooks", | ||
transform: async event => { | ||
@@ -416,2 +415,34 @@ if (!("installation" in event.payload) || typeof event.payload.installation !== "object") { | ||
function onUnhandledRequestDefault(request, response) { | ||
response.writeHead(404, { | ||
"content-type": "application/json" | ||
}); | ||
response.end(JSON.stringify({ | ||
error: `Unknown route: ${request.method} ${request.url}` | ||
})); | ||
} | ||
function noop() {} | ||
function createNodeMiddleware(app, { | ||
pathPrefix = "/api/github", | ||
onUnhandledRequest = onUnhandledRequestDefault, | ||
log | ||
} = {}) { | ||
const logWithDefaults = Object.assign({ | ||
debug: noop, | ||
info: noop, | ||
warn: console.warn.bind(console), | ||
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" | ||
}) | ||
}); | ||
} | ||
class App { | ||
@@ -481,9 +512,2 @@ constructor(options) { | ||
App.VERSION = VERSION; | ||
function createNodeMiddleware(app) { | ||
return oauthApp.createNodeMiddleware(app.oauth, { | ||
onUnhandledRequest: (request, response) => { | ||
return app.webhooks.middleware(request, response); | ||
} | ||
}); | ||
} | ||
@@ -490,0 +514,0 @@ exports.App = App; |
import { Octokit as OctokitCore } from "@octokit/core"; | ||
import { createAppAuth } from "@octokit/auth-app"; | ||
import { OAuthApp, createNodeMiddleware as oauthNodeMiddleware, } from "@octokit/oauth-app"; | ||
import { OAuthApp } from "@octokit/oauth-app"; | ||
import { VERSION } from "./version"; | ||
@@ -74,8 +74,2 @@ import { webhooks } from "./webhooks"; | ||
App.VERSION = VERSION; | ||
export function createNodeMiddleware(app) { | ||
return oauthNodeMiddleware(app.oauth, { | ||
onUnhandledRequest: (request, response) => { | ||
return app.webhooks.middleware(request, response); | ||
}, | ||
}); | ||
} | ||
export { createNodeMiddleware } from "./middleware/node/index"; |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "11.1.0"; | ||
export const VERSION = "11.2.0"; |
@@ -10,3 +10,2 @@ import { createAppAuth } from "@octokit/auth-app"; | ||
secret: options.secret, | ||
path: "/api/github/webhooks", | ||
transform: async (event) => { | ||
@@ -13,0 +12,0 @@ if (!("installation" in event.payload) || |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { Octokit as OctokitCore } from "@octokit/core"; | ||
@@ -29,3 +28,2 @@ import { OAuthApp } from "@octokit/oauth-app"; | ||
} | ||
export declare function createNodeMiddleware(app: App): (request: import("http").IncomingMessage, response: import("http").ServerResponse) => Promise<void>; | ||
export {}; | ||
export { createNodeMiddleware } from "./middleware/node/index"; |
@@ -16,6 +16,6 @@ import { Octokit } from "@octokit/core"; | ||
log?: { | ||
debug: (message: string) => unknown; | ||
info: (message: string) => unknown; | ||
warn: (message: string) => unknown; | ||
error: (message: string) => unknown; | ||
debug: (...data: any[]) => void; | ||
info: (...data: any[]) => void; | ||
warn: (...data: any[]) => void; | ||
error: (...data: any[]) => void; | ||
}; | ||
@@ -22,0 +22,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "11.1.0"; | ||
export declare const VERSION = "11.2.0"; |
{ | ||
"name": "@octokit/app", | ||
"description": "GitHub Apps toolset for Node.js", | ||
"version": "11.1.0", | ||
"version": "11.2.0", | ||
"license": "MIT", | ||
@@ -20,3 +20,3 @@ "files": [ | ||
"@octokit/types": "^6.0.3", | ||
"@octokit/webhooks": "^8.0.2", | ||
"@octokit/webhooks": "^9.0.0-beta.3", | ||
"deprecation": "^2.3.1" | ||
@@ -30,5 +30,7 @@ }, | ||
"@types/node": "^14.14.6", | ||
"@types/node-fetch": "^2.5.8", | ||
"fetch-mock": "^9.10.7", | ||
"jest": "^26.6.1", | ||
"mockdate": "^3.0.2", | ||
"node-fetch": "^2.6.1", | ||
"prettier": "^2.0.0", | ||
@@ -35,0 +37,0 @@ "semantic-release": "^17.0.0", |
@@ -382,2 +382,15 @@ # app.js | ||
<tr> | ||
<td> | ||
<code>log</code> | ||
<em> | ||
object | ||
</em> | ||
</td> | ||
<td> | ||
Used for internal logging. Defaults to [`console`](https://developer.mozilla.org/en-US/docs/Web/API/console) with `debug` and `info` doing nothing. | ||
</td> | ||
</tr> | ||
<tr> | ||
<th> | ||
@@ -384,0 +397,0 @@ <code>options.onUnhandledRequest</code> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71662
23
1102
429
15
+ Added@octokit/webhooks@9.26.3(transitive)
+ Added@octokit/webhooks-methods@2.0.0(transitive)
+ Added@octokit/webhooks-types@5.8.0(transitive)
- Removed@octokit/webhooks@8.12.3(transitive)
- Removed@octokit/webhooks-definitions@3.67.3(transitive)
- Removeddebug@4.3.7(transitive)