@octokit/oauth-app
Advanced tools
Comparing version 6.1.0 to 7.0.0-beta.1
@@ -1,46 +0,6 @@ | ||
"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); | ||
// pkg/dist-src/index.js | ||
var dist_src_exports = {}; | ||
__export(dist_src_exports, { | ||
OAuthApp: () => OAuthApp, | ||
createAWSLambdaAPIGatewayV2Handler: () => createAWSLambdaAPIGatewayV2Handler, | ||
createNodeMiddleware: () => createNodeMiddleware, | ||
createWebWorkerHandler: () => createWebWorkerHandler, | ||
handleRequest: () => handleRequest, | ||
sendNodeResponse: () => sendResponse, | ||
unknownRouteResponse: () => unknownRouteResponse | ||
}); | ||
module.exports = __toCommonJS(dist_src_exports); | ||
var import_auth_oauth_app = require("@octokit/auth-oauth-app"); | ||
import { createOAuthAppAuth } from "@octokit/auth-oauth-app"; | ||
// pkg/dist-src/version.js | ||
var VERSION = "6.1.0"; | ||
var VERSION = "7.0.0-beta.1"; | ||
@@ -62,10 +22,10 @@ // pkg/dist-src/add-event-handler.js | ||
// 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)()}` | ||
import { Octokit } from "@octokit/core"; | ||
import { getUserAgent } from "universal-user-agent"; | ||
var OAuthAppOctokit = Octokit.defaults({ | ||
userAgent: `octokit-oauth-app.js/${VERSION} ${getUserAgent()}` | ||
}); | ||
// pkg/dist-src/methods/get-user-octokit.js | ||
var import_auth_oauth_user = require("@octokit/auth-oauth-user"); | ||
import { createOAuthUserAuth } from "@octokit/auth-oauth-user"; | ||
@@ -94,3 +54,3 @@ // pkg/dist-src/emit-event.js | ||
const octokit = new state.Octokit({ | ||
authStrategy: import_auth_oauth_user.createOAuthUserAuth, | ||
authStrategy: createOAuthUserAuth, | ||
auth: options2 | ||
@@ -115,3 +75,3 @@ }); | ||
// pkg/dist-src/methods/get-web-flow-authorization-url.js | ||
var OAuthMethods = __toESM(require("@octokit/oauth-methods")); | ||
import * as OAuthMethods from "@octokit/oauth-methods"; | ||
function getWebFlowAuthorizationUrlWithState(state, options) { | ||
@@ -133,3 +93,3 @@ const optionsWithDefaults = { | ||
// pkg/dist-src/methods/create-token.js | ||
var OAuthAppAuth = __toESM(require("@octokit/auth-oauth-app")); | ||
import * as OAuthAppAuth from "@octokit/auth-oauth-app"; | ||
async function createTokenWithState(state, options) { | ||
@@ -164,3 +124,3 @@ const authentication = await state.octokit.auth({ | ||
// pkg/dist-src/methods/check-token.js | ||
var OAuthMethods2 = __toESM(require("@octokit/oauth-methods")); | ||
import * as OAuthMethods2 from "@octokit/oauth-methods"; | ||
async function checkTokenWithState(state, options) { | ||
@@ -180,4 +140,4 @@ const result = await OAuthMethods2.checkToken({ | ||
// pkg/dist-src/methods/reset-token.js | ||
var OAuthMethods3 = __toESM(require("@octokit/oauth-methods")); | ||
var import_auth_oauth_user2 = require("@octokit/auth-oauth-user"); | ||
import * as OAuthMethods3 from "@octokit/oauth-methods"; | ||
import { createOAuthUserAuth as createOAuthUserAuth3 } from "@octokit/auth-oauth-user"; | ||
async function resetTokenWithState(state, options) { | ||
@@ -206,3 +166,3 @@ const optionsWithDefaults = { | ||
octokit: new state.Octokit({ | ||
authStrategy: import_auth_oauth_user2.createOAuthUserAuth, | ||
authStrategy: createOAuthUserAuth3, | ||
auth: { | ||
@@ -233,3 +193,3 @@ clientType: state.clientType, | ||
octokit: new state.Octokit({ | ||
authStrategy: import_auth_oauth_user2.createOAuthUserAuth, | ||
authStrategy: createOAuthUserAuth3, | ||
auth: { | ||
@@ -247,4 +207,4 @@ clientType: state.clientType, | ||
// pkg/dist-src/methods/refresh-token.js | ||
var OAuthMethods4 = __toESM(require("@octokit/oauth-methods")); | ||
var import_auth_oauth_user3 = require("@octokit/auth-oauth-user"); | ||
import * as OAuthMethods4 from "@octokit/oauth-methods"; | ||
import { createOAuthUserAuth as createOAuthUserAuth4 } from "@octokit/auth-oauth-user"; | ||
async function refreshTokenWithState(state, options) { | ||
@@ -273,3 +233,3 @@ if (state.clientType === "oauth-app") { | ||
octokit: new state.Octokit({ | ||
authStrategy: import_auth_oauth_user3.createOAuthUserAuth, | ||
authStrategy: createOAuthUserAuth4, | ||
auth: { | ||
@@ -287,4 +247,4 @@ clientType: state.clientType, | ||
// pkg/dist-src/methods/scope-token.js | ||
var OAuthMethods5 = __toESM(require("@octokit/oauth-methods")); | ||
var import_auth_oauth_user4 = require("@octokit/auth-oauth-user"); | ||
import * as OAuthMethods5 from "@octokit/oauth-methods"; | ||
import { createOAuthUserAuth as createOAuthUserAuth5 } from "@octokit/auth-oauth-user"; | ||
async function scopeTokenWithState(state, options) { | ||
@@ -313,3 +273,3 @@ if (state.clientType === "oauth-app") { | ||
octokit: new state.Octokit({ | ||
authStrategy: import_auth_oauth_user4.createOAuthUserAuth, | ||
authStrategy: createOAuthUserAuth5, | ||
auth: { | ||
@@ -327,4 +287,4 @@ clientType: state.clientType, | ||
// pkg/dist-src/methods/delete-token.js | ||
var OAuthMethods6 = __toESM(require("@octokit/oauth-methods")); | ||
var import_auth_unauthenticated = require("@octokit/auth-unauthenticated"); | ||
import * as OAuthMethods6 from "@octokit/oauth-methods"; | ||
import { createUnauthenticatedAuth } from "@octokit/auth-unauthenticated"; | ||
async function deleteTokenWithState(state, options) { | ||
@@ -352,3 +312,3 @@ const optionsWithDefaults = { | ||
octokit: new state.Octokit({ | ||
authStrategy: import_auth_unauthenticated.createUnauthenticatedAuth, | ||
authStrategy: createUnauthenticatedAuth, | ||
auth: { | ||
@@ -363,4 +323,4 @@ 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"); | ||
import * as OAuthMethods7 from "@octokit/oauth-methods"; | ||
import { createUnauthenticatedAuth as createUnauthenticatedAuth2 } from "@octokit/auth-unauthenticated"; | ||
async function deleteAuthorizationWithState(state, options) { | ||
@@ -388,3 +348,3 @@ const optionsWithDefaults = { | ||
octokit: new state.Octokit({ | ||
authStrategy: import_auth_unauthenticated2.createUnauthenticatedAuth, | ||
authStrategy: createUnauthenticatedAuth2, | ||
auth: { | ||
@@ -400,3 +360,3 @@ reason: `Handling "token.deleted" event. The access for the token has been revoked.` | ||
octokit: new state.Octokit({ | ||
authStrategy: import_auth_unauthenticated2.createUnauthenticatedAuth, | ||
authStrategy: createUnauthenticatedAuth2, | ||
auth: { | ||
@@ -744,5 +704,3 @@ reason: `Handling "authorization.deleted" event. The access for the app has been revoked.` | ||
var OAuthApp = class { | ||
static { | ||
this.VERSION = VERSION; | ||
} | ||
static VERSION = VERSION; | ||
static defaults(defaults) { | ||
@@ -763,3 +721,3 @@ const OAuthAppWithDefaults = class extends this { | ||
const octokit = new Octokit2({ | ||
authStrategy: import_auth_oauth_app.createOAuthAppAuth, | ||
authStrategy: createOAuthAppAuth, | ||
auth: { | ||
@@ -815,5 +773,17 @@ clientType: this.type, | ||
} | ||
// assigned during constructor | ||
type; | ||
on; | ||
octokit; | ||
getUserOctokit; | ||
getWebFlowAuthorizationUrl; | ||
createToken; | ||
checkToken; | ||
resetToken; | ||
refreshToken; | ||
scopeToken; | ||
deleteToken; | ||
deleteAuthorization; | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
export { | ||
OAuthApp, | ||
@@ -824,4 +794,4 @@ createAWSLambdaAPIGatewayV2Handler, | ||
handleRequest, | ||
sendNodeResponse, | ||
sendResponse as sendNodeResponse, | ||
unknownRouteResponse | ||
}); | ||
}; |
import { createOAuthAppAuth } from "@octokit/auth-oauth-app"; | ||
import { VERSION } from "./version"; | ||
import { addEventHandler } from "./add-event-handler"; | ||
import { OAuthAppOctokit } from "./oauth-app-octokit"; | ||
import { VERSION } from "./version.js"; | ||
import { addEventHandler } from "./add-event-handler.js"; | ||
import { OAuthAppOctokit } from "./oauth-app-octokit.js"; | ||
import { | ||
@@ -39,5 +39,3 @@ getUserOctokitWithState | ||
class OAuthApp { | ||
static { | ||
this.VERSION = VERSION; | ||
} | ||
static VERSION = VERSION; | ||
static defaults(defaults) { | ||
@@ -109,2 +107,15 @@ const OAuthAppWithDefaults = class extends this { | ||
} | ||
// assigned during constructor | ||
type; | ||
on; | ||
octokit; | ||
getUserOctokit; | ||
getWebFlowAuthorizationUrl; | ||
createToken; | ||
checkToken; | ||
resetToken; | ||
refreshToken; | ||
scopeToken; | ||
deleteToken; | ||
deleteAuthorization; | ||
} | ||
@@ -111,0 +122,0 @@ export { |
@@ -1,2 +0,2 @@ | ||
import { parseRequest } from "./api-gateway-v2-parse-request"; | ||
import { parseRequest } from "./api-gateway-v2-parse-request.js"; | ||
import { sendResponse } from "./api-gateway-v2-send-response.js"; | ||
@@ -3,0 +3,0 @@ import { handleRequest } from "../handle-request.js"; |
@@ -1,4 +0,4 @@ | ||
const VERSION = "6.1.0"; | ||
const VERSION = "7.0.0-beta.1"; | ||
export { | ||
VERSION | ||
}; |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { OAuthApp } from "../../index.js"; | ||
@@ -2,0 +3,0 @@ import type { HandlerOptions } from "../types.js"; |
@@ -0,2 +1,3 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { OctokitRequest } from "../types.js"; | ||
export declare function parseRequest(request: Request): OctokitRequest; |
@@ -0,2 +1,3 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
import type { OctokitResponse } from "../types.js"; | ||
export declare function sendResponse(octokitResponse: OctokitResponse): Response; |
@@ -0,4 +1,6 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
import { Octokit } from "@octokit/core"; | ||
import type { OAuthAppUserAuthentication, GitHubAppUserAuthentication, GitHubAppUserAuthenticationWithExpiration } from "@octokit/auth-oauth-app"; | ||
import { OAuthAppOctokit } from "./oauth-app-octokit"; | ||
import { OAuthAppOctokit } from "./oauth-app-octokit.js"; | ||
export type ClientType = "oauth-app" | "github-app"; | ||
@@ -5,0 +7,0 @@ export type OAuthAppOctokitClassType = typeof OAuthAppOctokit; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "6.1.0"; | ||
export declare const VERSION = "7.0.0-beta.1"; |
{ | ||
"name": "@octokit/oauth-app", | ||
"version": "6.1.0", | ||
"version": "7.0.0-beta.1", | ||
"description": "GitHub OAuth toolset for Node.js", | ||
"type": "module", | ||
"repository": "github:octokit/oauth-app.js", | ||
@@ -15,16 +16,16 @@ "keywords": [ | ||
"dependencies": { | ||
"@octokit/auth-oauth-app": "^7.0.0", | ||
"@octokit/auth-oauth-user": "^4.0.0", | ||
"@octokit/auth-unauthenticated": "^5.0.0", | ||
"@octokit/core": "^5.0.0", | ||
"@octokit/oauth-authorization-url": "^6.0.2", | ||
"@octokit/oauth-methods": "^4.0.0", | ||
"@octokit/auth-oauth-app": "^8.0.0", | ||
"@octokit/auth-oauth-user": "^5.0.1", | ||
"@octokit/auth-unauthenticated": "^6.0.0-beta.1", | ||
"@octokit/core": "^6.0.0", | ||
"@octokit/oauth-authorization-url": "^7.0.0", | ||
"@octokit/oauth-methods": "^5.0.0", | ||
"@types/aws-lambda": "^8.10.83", | ||
"universal-user-agent": "^6.0.0" | ||
"universal-user-agent": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"@octokit/tsconfig": "^2.0.0", | ||
"@octokit/tsconfig": "^3.0.0", | ||
"@types/jest": "^29.0.0", | ||
"@types/node": "^20.0.0", | ||
"esbuild": "^0.19.0", | ||
"esbuild": "^0.20.0", | ||
"express": "^4.17.1", | ||
@@ -35,3 +36,3 @@ "fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1", | ||
"nock": "^13.0.0", | ||
"prettier": "3.2.4", | ||
"prettier": "3.2.5", | ||
"semantic-release-plugin-update-version-in-files": "^1.0.0", | ||
@@ -51,6 +52,9 @@ "ts-jest": "^29.0.0", | ||
], | ||
"main": "dist-node/index.js", | ||
"types": "dist-types/index.d.ts", | ||
"source": "dist-src/index.js", | ||
"exports": { | ||
".": { | ||
"types": "./dist-types/index.d.ts", | ||
"import": "./dist-node/index.js" | ||
} | ||
}, | ||
"sideEffects": false | ||
} |
@@ -72,3 +72,4 @@ # oauth-app.js | ||
```js | ||
const { OAuthApp, createNodeMiddleware } = require("@octokit/oauth-app"); | ||
import { OAuthApp, createNodeMiddleware } from "@octokit/oauth-app"; | ||
import { createServer } from "node:http"; | ||
@@ -86,3 +87,3 @@ const app = new OAuthApp({ | ||
require("http").createServer(createNodeMiddleware(app)).listen(3000); | ||
createServer(createNodeMiddleware(app)).listen(3000); | ||
// can now receive user authorization callbacks at /api/github/oauth/callback | ||
@@ -94,6 +95,7 @@ // See all endpoints at https://github.com/octokit/oauth-app.js#middlewares | ||
GitHub Apps do not support `scopes`. If the GitHub App has expiring user tokens enabled, the token used for the `octokit` instance will be refreshed automatically, and the additional refresh-releated properties will be passed to the `"token"` event handler. | ||
GitHub Apps do not support `scopes`. If the GitHub App has expiring user tokens enabled, the token used for the `octokit` instance will be refreshed automatically, and the additional refresh-related properties will be passed to the `"token"` event handler. | ||
```js | ||
const { OAuthApp, createNodeMiddleware } = require("@octokit/oauth-app"); | ||
import { OAuthApp, createNodeMiddleware } from "@octokit/oauth-app"; | ||
import { createServer } from "node:http"; | ||
@@ -111,3 +113,3 @@ const app = new OAuthApp({ | ||
require("http").createServer(createNodeMiddleware(app)).listen(3000); | ||
createServer(createNodeMiddleware(app)).listen(3000); | ||
// can now receive user authorization callbacks at /api/github/oauth/callback | ||
@@ -241,3 +243,3 @@ // See all endpoints at https://github.com/octokit/oauth-app.js#middlewares | ||
You can pass in your own Octokit constructor with custom defaults and plugins. The Octokit Constructor must use an authenticatio strategy that is compatible with[`@octokit/auth-oauth-app](https://github.com/octokit/auth-oauth-app.js/#readme). | ||
You can pass in your own Octokit constructor with custom defaults and plugins. The Octokit Constructor must use an authentication strategy that is compatible with[`@octokit/auth-oauth-app](https://github.com/octokit/auth-oauth-app.js/#readme). | ||
@@ -247,3 +249,3 @@ For usage with enterprise, set `baseUrl` to the hostname + `/api/v3`. Example: | ||
```js | ||
const { Octokit } = require("@octokit/core"); | ||
import { Octokit } from "@octokit/core"; | ||
new OAuthApp({ | ||
@@ -258,3 +260,3 @@ clientId: "1234567890abcdef1234", | ||
Defaults to `@octokit/oauth-app`'s owne `Octokit` constructor which can be imported separately from `OAuthApp`. It's [`@octokit/core`](https://github.com/octokit/core.js) with the [`@octokit/auth-oauth-user`](https://github.com/octokit/auth-oauth-user.js/#readme) authentication strategy. | ||
Defaults to `@octokit/oauth-app`'s own `Octokit` constructor which can be imported separately from `OAuthApp`. It's [`@octokit/core`](https://github.com/octokit/core.js) with the [`@octokit/auth-oauth-user`](https://github.com/octokit/auth-oauth-user.js/#readme) authentication strategy. | ||
@@ -510,3 +512,3 @@ </td></tr> | ||
Resolves with with an [user authentication object](https://github.com/octokit/auth-oauth-app.js#authentication-object) | ||
Resolves with an [user authentication object](https://github.com/octokit/auth-oauth-app.js#authentication-object) | ||
@@ -578,3 +580,3 @@ ### For OAuth Device flow | ||
Resolves with with an [user authentication object](https://github.com/octokit/auth-oauth-app.js#authentication-object) | ||
Resolves with an [user authentication object](https://github.com/octokit/auth-oauth-app.js#authentication-object) | ||
@@ -907,3 +909,5 @@ ## `app.checkToken(options)` | ||
```js | ||
const { OAuthApp, createNodeMiddleware } = require("@octokit/oauth-app"); | ||
import { OAuthApp, createNodeMiddleware } from "@octokit/oauth-app"; | ||
import { createServer } from "node:http"; | ||
const app = new OAuthApp({ | ||
@@ -919,3 +923,3 @@ clientType: "oauth-app", | ||
require("http").createServer(middleware).listen(3000); | ||
createServer(middleware).listen(3000); | ||
// can now receive user authorization callbacks at /api/github/oauth/callback | ||
@@ -922,0 +926,0 @@ ``` |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1171
Yes
144738
1935
2
0
+ Added@octokit/auth-oauth-app@8.1.1(transitive)
+ Added@octokit/auth-oauth-device@7.1.1(transitive)
+ Added@octokit/auth-oauth-user@5.1.1(transitive)
+ Added@octokit/auth-token@5.1.1(transitive)
+ Added@octokit/auth-unauthenticated@6.1.0(transitive)
+ Added@octokit/core@6.1.2(transitive)
+ Added@octokit/endpoint@10.1.1(transitive)
+ Added@octokit/graphql@8.1.1(transitive)
+ Added@octokit/oauth-authorization-url@7.1.1(transitive)
+ Added@octokit/oauth-methods@5.1.2(transitive)
+ Added@octokit/request@9.1.1(transitive)
+ Added@octokit/request-error@6.1.1(transitive)
+ Addedbefore-after-hook@3.0.2(transitive)
+ Addeduniversal-user-agent@7.0.2(transitive)
- Removed@octokit/auth-oauth-app@7.1.0(transitive)
- Removed@octokit/auth-oauth-device@6.1.0(transitive)
- Removed@octokit/auth-oauth-user@4.1.0(transitive)
- Removed@octokit/auth-token@4.0.0(transitive)
- Removed@octokit/auth-unauthenticated@5.0.1(transitive)
- Removed@octokit/core@5.2.0(transitive)
- Removed@octokit/endpoint@9.0.5(transitive)
- Removed@octokit/graphql@7.1.0(transitive)
- Removed@octokit/oauth-authorization-url@6.0.2(transitive)
- Removed@octokit/oauth-methods@4.1.0(transitive)
- Removed@octokit/openapi-types@20.0.0(transitive)
- Removed@octokit/request@8.4.0(transitive)
- Removed@octokit/request-error@5.1.0(transitive)
- Removed@octokit/types@12.6.0(transitive)
- Removed@types/btoa-lite@1.0.2(transitive)
- Removedbefore-after-hook@2.2.3(transitive)
- Removedbtoa-lite@1.0.0(transitive)
- Removeddeprecation@2.3.1(transitive)
- Removedonce@1.4.0(transitive)
- Removeduniversal-user-agent@6.0.1(transitive)
- Removedwrappy@1.0.2(transitive)
Updated@octokit/core@^6.0.0
Updateduniversal-user-agent@^7.0.0