@spinque/query-api
Advanced tools
Comparing version 0.15.4 to 0.15.5
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Authenticator = exports.DEFAULT_AUDIENCE = exports.DEFAULT_AUTH_SERVER = void 0; | ||
var browser_or_node_1 = require("browser-or-node"); | ||
var utils_1 = require("../utils"); | ||
exports.DEFAULT_AUTH_SERVER = 'https://login.spinque.com/'; | ||
@@ -80,3 +80,3 @@ exports.DEFAULT_AUDIENCE = 'https://rest.spinque.com/'; | ||
Authenticator.prototype.putInStorage = function (accessToken, expires) { | ||
if (browser_or_node_1.isBrowser && !!localStorage) { | ||
if (utils_1.isBrowser && !!localStorage) { | ||
// TODO: configure keys | ||
@@ -86,3 +86,3 @@ localStorage.setItem('@spinque/query-api/access-token', accessToken); | ||
} | ||
if (!browser_or_node_1.isBrowser && this._tokenCachePath) { | ||
if (!utils_1.isBrowser && this._tokenCachePath) { | ||
try { | ||
@@ -103,6 +103,6 @@ var fs = require('fs'); | ||
// Localstorage is only available for browser applications | ||
if (browser_or_node_1.isBrowser) { | ||
if (utils_1.isBrowser) { | ||
return this.getFromBrowserLocalStorage(); | ||
} | ||
if (!browser_or_node_1.isBrowser && this._tokenCachePath) { | ||
if (!utils_1.isBrowser && this._tokenCachePath) { | ||
return this.getFromFileStorage(this._tokenCachePath); | ||
@@ -109,0 +109,0 @@ } |
@@ -73,3 +73,3 @@ "use strict"; | ||
var utils_1 = require("../utils"); | ||
var browser_or_node_1 = require("browser-or-node"); | ||
var utils_2 = require("../utils"); | ||
/** | ||
@@ -97,3 +97,3 @@ * An Authenticator class for the OAuth 2.0 Client Credentials grant. | ||
_this.baseUrl = baseUrl; | ||
if (browser_or_node_1.isBrowser) { | ||
if (utils_2.isBrowser) { | ||
throw new Error('The Client Credentials Flow is only allowed for server applications.'); | ||
@@ -100,0 +100,0 @@ } |
@@ -82,3 +82,3 @@ "use strict"; | ||
var utils_1 = require("../utils"); | ||
var browser_or_node_1 = require("browser-or-node"); | ||
var utils_2 = require("../utils"); | ||
/** | ||
@@ -103,3 +103,3 @@ * An Authenticator class for the OAuth 2.0 Authorization Code with PKCE grant. | ||
_this.baseUrl = baseUrl; | ||
if (!browser_or_node_1.isBrowser) { | ||
if (!utils_2.isBrowser) { | ||
throw new Error('PKCE is only available for browser applications'); | ||
@@ -106,0 +106,0 @@ } |
@@ -38,1 +38,2 @@ import { ApiConfig, Query } from '.'; | ||
export declare const stringifyQueries: (queries: Query[]) => string; | ||
export declare const isBrowser: boolean; |
@@ -39,3 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stringifyQueries = exports.parseQueries = exports.join = exports.tupleListToString = exports.stringToTupleList = exports.urlFromQueries = exports.pathFromQuery = exports.pathFromQueries = void 0; | ||
exports.isBrowser = exports.stringifyQueries = exports.parseQueries = exports.join = exports.tupleListToString = exports.stringToTupleList = exports.urlFromQueries = exports.pathFromQuery = exports.pathFromQueries = void 0; | ||
/** | ||
@@ -273,2 +273,3 @@ * Takes an array of Query objects and returns the path they would represent in a Query API request URL. | ||
exports.stringifyQueries = stringifyQueries; | ||
exports.isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@spinque/query-api", | ||
"version": "0.15.4", | ||
"version": "0.15.5", | ||
"description": "", | ||
@@ -46,6 +46,3 @@ "main": "dist/index.js", | ||
"typescript": "^4.6.2" | ||
}, | ||
"dependencies": { | ||
"browser-or-node": "^2.1.1" | ||
} | ||
} |
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
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
161597
0
2389
- Removedbrowser-or-node@^2.1.1
- Removedbrowser-or-node@2.1.1(transitive)