@octokit/oauth-app
Advanced tools
Comparing version 3.3.2 to 3.3.3
@@ -15,17 +15,2 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
@@ -36,5 +21,9 @@ var keys = Object.keys(object); | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
if (enumerableOnly) { | ||
symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
} | ||
keys.push.apply(keys, symbols); | ||
@@ -66,4 +55,19 @@ } | ||
const VERSION = "3.3.2"; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
const VERSION = "3.3.3"; | ||
function addEventHandler(state, eventName, eventHandler) { | ||
@@ -400,3 +404,3 @@ if (Array.isArray(eventName)) { | ||
async function middleware(app, options, request, response) { | ||
async function middleware(app, options, request, response, next) { | ||
// request.url mayb include ?query parameters which we don't want for `route` | ||
@@ -418,7 +422,13 @@ // hence the workaround using new URL() | ||
deleteGrant: `DELETE ${options.pathPrefix}/grant` | ||
}; | ||
}; // handle unknown routes | ||
if (!Object.values(routes).includes(route)) { | ||
options.onUnhandledRequest(request, response); | ||
return; | ||
const isExpressMiddleware = typeof next === "function"; | ||
if (isExpressMiddleware) { | ||
// @ts-ignore `next` must be a function as we check two lines above | ||
return next(); | ||
} else { | ||
return options.onUnhandledRequest(request, response); | ||
} | ||
} | ||
@@ -425,0 +435,0 @@ |
import { parseRequest } from "./parse-request"; | ||
export async function middleware(app, options, request, response) { | ||
export async function middleware(app, options, request, response, next) { | ||
// request.url mayb include ?query parameters which we don't want for `route` | ||
@@ -18,5 +18,12 @@ // hence the workaround using new URL() | ||
}; | ||
// handle unknown routes | ||
if (!Object.values(routes).includes(route)) { | ||
options.onUnhandledRequest(request, response); | ||
return; | ||
const isExpressMiddleware = typeof next === "function"; | ||
if (isExpressMiddleware) { | ||
// @ts-ignore `next` must be a function as we check two lines above | ||
return next(); | ||
} | ||
else { | ||
return options.onUnhandledRequest(request, response); | ||
} | ||
} | ||
@@ -23,0 +30,0 @@ let parsedRequest; |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "3.3.2"; | ||
export const VERSION = "3.3.3"; |
import { OAuthApp } from "../../index"; | ||
import { MiddlewareOptions } from "./types"; | ||
import { ClientType, Options } from "../../types"; | ||
export declare function createNodeMiddleware(app: OAuthApp<Options<ClientType>>, { pathPrefix, onUnhandledRequest, }?: MiddlewareOptions): (request: any, response: any) => Promise<any>; | ||
export declare function createNodeMiddleware(app: OAuthApp<Options<ClientType>>, { pathPrefix, onUnhandledRequest, }?: MiddlewareOptions): (request: any, response: any, next?: Function | undefined) => Promise<any>; |
@@ -6,3 +6,3 @@ declare type IncomingMessage = any; | ||
import { Options, ClientType } from "../../types"; | ||
export declare function middleware(app: OAuthApp<Options<ClientType>>, options: Required<MiddlewareOptions>, request: IncomingMessage, response: ServerResponse): Promise<any>; | ||
export declare function middleware(app: OAuthApp<Options<ClientType>>, options: Required<MiddlewareOptions>, request: IncomingMessage, response: ServerResponse, next?: Function): Promise<any>; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "3.3.2"; | ||
export declare const VERSION = "3.3.3"; |
{ | ||
"name": "@octokit/oauth-app", | ||
"description": "GitHub OAuth toolset for Node.js", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"license": "MIT", | ||
@@ -27,2 +27,4 @@ "files": [ | ||
"fromentries": "^1.3.1", | ||
"i": "^0.3.6", | ||
"npm": "^7.14.0", | ||
"universal-user-agent": "^6.0.0" | ||
@@ -37,10 +39,11 @@ }, | ||
"@types/node-fetch": "^2.5.4", | ||
"express": "^4.17.1", | ||
"fetch-mock": "^9.0.0", | ||
"jest": "^26.1.0", | ||
"jest": "^27.0.0", | ||
"nock": "^13.0.0", | ||
"node-fetch": "^2.6.0", | ||
"prettier": "^2.0.0", | ||
"prettier": "2.3.0", | ||
"semantic-release": "^17.0.3", | ||
"semantic-release-plugin-update-version-in-files": "^1.0.0", | ||
"ts-jest": "^26.1.3", | ||
"ts-jest": "^27.0.0-next.12", | ||
"typescript": "^4.0.2" | ||
@@ -47,0 +50,0 @@ }, |
@@ -228,3 +228,3 @@ # oauth-app.js | ||
```js | ||
const { Octokit } = require("@octokit/oauth-app"); | ||
const { Octokit } = require("@octokit/core"); | ||
new OAuthApp({ | ||
@@ -533,3 +533,3 @@ clientId: "1234567890abcdef1234", | ||
await prompt("press enter when you are ready to continue") | ||
await prompt("press enter when you are ready to continue"); | ||
}, | ||
@@ -536,0 +536,0 @@ }); |
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
133340
1485
10
16
+ Addedi@^0.3.6
+ Addednpm@^7.14.0
+ Addedi@0.3.7(transitive)
+ Addednpm@7.24.2(transitive)