piral-oauth2
Advanced tools
Comparing version 1.6.0-beta.7240 to 1.6.0-beta.7243
@@ -1,4 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ClientOAuth2Token = exports.ClientOAuth2 = void 0; | ||
const DEFAULT_URL_BASE = location.origin; | ||
@@ -164,3 +161,3 @@ function defaultRequest(method, url, body, headers) { | ||
*/ | ||
class ClientOAuth2 { | ||
export class ClientOAuth2 { | ||
constructor(options, request = defaultRequest) { | ||
@@ -210,3 +207,2 @@ this.options = options; | ||
} | ||
exports.ClientOAuth2 = ClientOAuth2; | ||
/** | ||
@@ -218,3 +214,3 @@ * General purpose client token generator. | ||
*/ | ||
class ClientOAuth2Token { | ||
export class ClientOAuth2Token { | ||
constructor(client, data) { | ||
@@ -301,3 +297,2 @@ this.client = client; | ||
} | ||
exports.ClientOAuth2Token = ClientOAuth2Token; | ||
/** | ||
@@ -304,0 +299,0 @@ * Support resource owner password credentials OAuth 2.0 grant. |
@@ -1,8 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createOAuth2Api = void 0; | ||
/** | ||
* Creates new Pilet API extensions for the integration of OAuth 2.0. | ||
*/ | ||
function createOAuth2Api(client) { | ||
export function createOAuth2Api(client) { | ||
return (context) => { | ||
@@ -17,3 +14,2 @@ context.on('before-fetch', client.extendHeaders); | ||
} | ||
exports.createOAuth2Api = createOAuth2Api; | ||
//# sourceMappingURL=create.js.map |
@@ -1,8 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./create"), exports); | ||
tslib_1.__exportStar(require("./setup"), exports); | ||
tslib_1.__exportStar(require("./types"), exports); | ||
tslib_1.__exportStar(require("./utils"), exports); | ||
export * from './create'; | ||
export * from './setup'; | ||
export * from './types'; | ||
export * from './utils'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,6 +0,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.setupOAuth2Client = void 0; | ||
const client_oauth2_1 = require("./client-oauth2"); | ||
const utils_1 = require("./utils"); | ||
import { ClientOAuth2 } from './client-oauth2'; | ||
import { createOAuth2MemoryPersistence } from './utils'; | ||
const callbackName = 'oauth2Cb'; | ||
@@ -11,5 +8,5 @@ /** | ||
*/ | ||
function setupOAuth2Client(config) { | ||
const { clientId, clientSecret, authorizationUri, accessTokenUri, redirectUri = `${location.origin}/auth`, scopes = [], flow, headers, query, state, restrict = false, returnPath = '/', persist = (0, utils_1.createOAuth2MemoryPersistence)(), } = config; | ||
const client = new client_oauth2_1.ClientOAuth2({ | ||
export function setupOAuth2Client(config) { | ||
const { clientId, clientSecret, authorizationUri, accessTokenUri, redirectUri = `${location.origin}/auth`, scopes = [], flow, headers, query, state, restrict = false, returnPath = '/', persist = createOAuth2MemoryPersistence(), } = config; | ||
const client = new ClientOAuth2({ | ||
clientId, | ||
@@ -107,3 +104,2 @@ clientSecret, | ||
} | ||
exports.setupOAuth2Client = setupOAuth2Client; | ||
//# sourceMappingURL=setup.js.map |
@@ -1,3 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; | ||
//# sourceMappingURL=types.js.map |
@@ -1,8 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createOAuth2BrowserPersistence = exports.createOAuth2SessionPersistence = exports.createOAuth2MemoryPersistence = void 0; | ||
/** | ||
* Creates an OAuth 2 persistence layer using memory. | ||
*/ | ||
function createOAuth2MemoryPersistence() { | ||
export function createOAuth2MemoryPersistence() { | ||
return { | ||
@@ -15,7 +12,6 @@ load() { | ||
} | ||
exports.createOAuth2MemoryPersistence = createOAuth2MemoryPersistence; | ||
/** | ||
* Creates an OAuth 2 persistence layer using sessionStorage. | ||
*/ | ||
function createOAuth2SessionPersistence(sessionKey = '$piral_oauth2_info') { | ||
export function createOAuth2SessionPersistence(sessionKey = '$piral_oauth2_info') { | ||
return { | ||
@@ -39,7 +35,6 @@ load() { | ||
} | ||
exports.createOAuth2SessionPersistence = createOAuth2SessionPersistence; | ||
/** | ||
* Creates an OAuth 2 persistence layer using localStorage. | ||
*/ | ||
function createOAuth2BrowserPersistence(localKey = '$piral_oauth2_info') { | ||
export function createOAuth2BrowserPersistence(localKey = '$piral_oauth2_info') { | ||
return { | ||
@@ -63,3 +58,2 @@ load() { | ||
} | ||
exports.createOAuth2BrowserPersistence = createOAuth2BrowserPersistence; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "piral-oauth2", | ||
"version": "1.6.0-beta.7240", | ||
"version": "1.6.0-beta.7243", | ||
"description": "Plugin to integrate OAuth 2.0 authentication in Piral.", | ||
@@ -22,20 +22,8 @@ "keywords": [ | ||
"license": "MIT", | ||
"module": "esm/index.js", | ||
"module": "lib/index.js", | ||
"main": "lib/index.js", | ||
"typings": "lib/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./esm/index.js", | ||
"require": "./lib/index.js" | ||
}, | ||
"./esm/*": { | ||
"import": "./esm/*" | ||
}, | ||
"./lib/*": { | ||
"require": "./lib/*" | ||
}, | ||
"./_/*": { | ||
"import": "./esm/*.js", | ||
"require": "./lib/*.js" | ||
}, | ||
".": "./lib/index.js", | ||
"./lib/*": "./lib/*", | ||
"./package.json": "./package.json" | ||
@@ -45,3 +33,2 @@ }, | ||
"files": [ | ||
"esm", | ||
"lib", | ||
@@ -60,6 +47,5 @@ "src", | ||
"cleanup": "rimraf esm lib piral-oauth2.min.js", | ||
"build": "yarn build:bundle && yarn build:commonjs && yarn build:esnext", | ||
"build": "yarn build:bundle && yarn build:esnext", | ||
"build:bundle": "esbuild src/index.ts --outfile=piral-oauth2.min.js --bundle --external:piral-core --minify --global-name=piralOAuth2", | ||
"build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs", | ||
"build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext", | ||
"build:esnext": "tsc --project tsconfig.json --outDir lib --module esnext", | ||
"typedoc": "typedoc --json ../../../docs/types/piral-oauth2.json src --exclude \"src/**/*.test.*\"", | ||
@@ -69,5 +55,5 @@ "test": "echo \"Error: run tests from root\" && exit 1" | ||
"devDependencies": { | ||
"piral-core": "1.6.0-beta.7240" | ||
"piral-core": "1.6.0-beta.7243" | ||
}, | ||
"gitHead": "2fd8ff47d9a7e0666e4e6bc1dc5a7ef45e8e9f39" | ||
"gitHead": "bbb6e4f78c61b6ef753099a5b378ad2708565ce3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2
98969
28
1954
24
122