@spinque/query-api
Advanced tools
Comparing version 0.10.3 to 0.11.0
@@ -248,1 +248,2 @@ "use strict"; | ||
exports.Api = Api; | ||
//# sourceMappingURL=Api.js.map |
@@ -113,1 +113,2 @@ "use strict"; | ||
exports.Authenticator = Authenticator; | ||
//# sourceMappingURL=Authenticator.js.map |
@@ -53,2 +53,18 @@ "use strict"; | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -106,3 +122,3 @@ exports.ClientCredentials = void 0; | ||
.map(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
var _b = __read(_a, 2), key = _b[0], value = _b[1]; | ||
return "".concat(key, "=").concat(value); | ||
@@ -131,1 +147,2 @@ }) | ||
exports.ClientCredentials = ClientCredentials; | ||
//# sourceMappingURL=ClientCredentials.js.map |
@@ -10,1 +10,2 @@ "use strict"; | ||
Object.defineProperty(exports, "PKCE", { enumerable: true, get: function () { return PKCE_1.PKCE; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -53,2 +53,27 @@ "use strict"; | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -94,7 +119,7 @@ exports.bufferToBase64UrlEncoded = exports.sha256 = exports.createRandomString = exports.getCryptoSubtle = exports.getCrypto = exports.PKCE = void 0; | ||
var params = Object.fromEntries(new URLSearchParams(window.location.search).entries()); | ||
if (!params.code || !params.state) { | ||
if (!params['code'] || !params['state']) { | ||
return; | ||
} | ||
this._authInProgress = true; | ||
this.tradeCodeForToken(params.code, params.state).catch(function () { return _this.authorize(); }); | ||
this.tradeCodeForToken(params['code'], params['state']).catch(function () { return _this.authorize(); }); | ||
}; | ||
@@ -138,3 +163,3 @@ PKCE.prototype.fetchAccessToken = function () { | ||
.map(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
var _b = __read(_a, 2), key = _b[0], value = _b[1]; | ||
return "".concat(key, "=").concat(value); | ||
@@ -144,3 +169,2 @@ }) | ||
window.location.href = authorizationUrl; | ||
// tslint:disable-next-line: no-empty | ||
return [2 /*return*/, new Promise(function () { })]; | ||
@@ -181,3 +205,3 @@ } | ||
.map(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
var _b = __read(_a, 2), key = _b[0], value = _b[1]; | ||
return "".concat(key, "=").concat(value); | ||
@@ -258,3 +282,3 @@ }) | ||
var ie11SafeInput = new Uint8Array(input); | ||
return urlEncodeB64(window.btoa(String.fromCharCode.apply(String, Array.from(ie11SafeInput)))); | ||
return urlEncodeB64(window.btoa(String.fromCharCode.apply(String, __spreadArray([], __read(Array.from(ie11SafeInput)), false)))); | ||
}; | ||
@@ -266,1 +290,2 @@ exports.bufferToBase64UrlEncoded = bufferToBase64UrlEncoded; | ||
}; | ||
//# sourceMappingURL=PKCE.js.map |
@@ -13,2 +13,18 @@ "use strict"; | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
@@ -124,3 +140,3 @@ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
this.getBaseQuery() | ||
], this._facets | ||
], __read(this._facets | ||
.filter(function (f) { return f.filterParameterValue !== undefined && f.filterParameterValue !== ''; }) | ||
@@ -133,3 +149,3 @@ .map(function (f) { | ||
}); | ||
}), true); | ||
})), false); | ||
if (this._activeModifier !== undefined && this._activeModifier !== null) { | ||
@@ -151,3 +167,3 @@ q.push(this._activeModifier); | ||
this.getBaseQuery() | ||
], this._facets | ||
], __read(this._facets | ||
.filter(function (f) { | ||
@@ -164,3 +180,3 @@ return f.filterParameterValue !== undefined && | ||
}); | ||
}), true), [ | ||
})), false), [ | ||
{ endpoint: facet.optionsEndpoint }, | ||
@@ -237,1 +253,2 @@ ], false); | ||
exports.FacetedSearch = FacetedSearch; | ||
//# sourceMappingURL=FacetedSearch.js.map |
@@ -6,1 +6,2 @@ export * from './Api'; | ||
export * from './utils'; | ||
export * from './clustered-search'; |
@@ -22,1 +22,3 @@ "use strict"; | ||
__exportStar(require("./utils"), exports); | ||
__exportStar(require("./clustered-search"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -116,1 +116,2 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=Api.spec.js.map |
@@ -50,1 +50,2 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=FacetedSearch.spec.js.map |
@@ -173,1 +173,2 @@ "use strict"; | ||
}); | ||
//# sourceMappingURL=utils.spec.js.map |
@@ -19,3 +19,2 @@ "use strict"; | ||
*/ | ||
// tslint:disable-next-line: max-classes-per-file | ||
var EndpointNotFoundError = /** @class */ (function () { | ||
@@ -33,3 +32,2 @@ function EndpointNotFoundError(message, status) { | ||
*/ | ||
// tslint:disable-next-line: max-classes-per-file | ||
var UnauthorizedError = /** @class */ (function () { | ||
@@ -47,3 +45,2 @@ function UnauthorizedError(message, status) { | ||
*/ | ||
// tslint:disable-next-line: max-classes-per-file | ||
var ServerError = /** @class */ (function () { | ||
@@ -57,1 +54,2 @@ function ServerError(message, status) { | ||
exports.ServerError = ServerError; | ||
//# sourceMappingURL=types.js.map |
"use strict"; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -8,3 +44,3 @@ exports.stringifyQueries = exports.parseQueries = exports.join = exports.tupleListToString = exports.stringToTupleList = exports.urlFromQueries = exports.pathFromQuery = exports.pathFromQueries = void 0; | ||
var pathFromQueries = function (queries) { | ||
return exports.join.apply(void 0, queries.map(exports.pathFromQuery)); | ||
return exports.join.apply(void 0, __spreadArray([], __read(queries.map(exports.pathFromQuery)), false)); | ||
}; | ||
@@ -19,7 +55,7 @@ exports.pathFromQueries = pathFromQueries; | ||
Object.entries(query.parameters).forEach(function (_a) { | ||
var name = _a[0], value = _a[1]; | ||
var _b = __read(_a, 2), name = _b[0], value = _b[1]; | ||
parts.push('p', encodeURIComponent(name), encodeURIComponent(value)); | ||
}); | ||
} | ||
return exports.join.apply(void 0, parts); | ||
return exports.join.apply(void 0, __spreadArray([], __read(parts), false)); | ||
}; | ||
@@ -61,3 +97,3 @@ exports.pathFromQuery = pathFromQuery; | ||
Object.entries(options).forEach(function (_a, index) { | ||
var option = _a[0], value = _a[1]; | ||
var _b = __read(_a, 2), option = _b[0], value = _b[1]; | ||
if (index === 0 && !config.config) { | ||
@@ -118,2 +154,3 @@ url += '?'; | ||
var ensureTupleList = function (value) { | ||
var e_1, _a; | ||
// Convert string or number to nested array | ||
@@ -131,13 +168,22 @@ if (typeof value === 'string' || typeof value === 'number') { | ||
var allAreArrays = true; | ||
for (var _i = 0, value_1 = value; _i < value_1.length; _i++) { | ||
var t = value_1[_i]; | ||
if (t instanceof Array) { | ||
someAreArrays = true; | ||
if (value[0] instanceof Array && t.length !== value[0].length) { | ||
throw new Error('Tuple list has unequally sized rows (some have more columns)'); | ||
try { | ||
for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) { | ||
var t = value_1_1.value; | ||
if (t instanceof Array) { | ||
someAreArrays = true; | ||
if (value[0] instanceof Array && t.length !== value[0].length) { | ||
throw new Error('Tuple list has unequally sized rows (some have more columns)'); | ||
} | ||
} | ||
else { | ||
allAreArrays = false; | ||
} | ||
} | ||
else { | ||
allAreArrays = false; | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
@@ -156,2 +202,3 @@ if (someAreArrays && !allAreArrays) { | ||
var join = function () { | ||
var e_2, _a; | ||
var segments = []; | ||
@@ -171,12 +218,21 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
var resultParts = []; | ||
for (var _a = 0, parts_1 = parts; _a < parts_1.length; _a++) { | ||
var part = parts_1[_a]; | ||
if (part === '.') { | ||
continue; | ||
try { | ||
for (var parts_1 = __values(parts), parts_1_1 = parts_1.next(); !parts_1_1.done; parts_1_1 = parts_1.next()) { | ||
var part = parts_1_1.value; | ||
if (part === '.') { | ||
continue; | ||
} | ||
if (part === '..') { | ||
resultParts.pop(); | ||
continue; | ||
} | ||
resultParts.push(part); | ||
} | ||
if (part === '..') { | ||
resultParts.pop(); | ||
continue; | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (parts_1_1 && !parts_1_1.done && (_a = parts_1.return)) _a.call(parts_1); | ||
} | ||
resultParts.push(part); | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
@@ -223,1 +279,2 @@ return resultParts.join('/'); | ||
exports.stringifyQueries = stringifyQueries; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@spinque/query-api", | ||
"version": "0.10.3", | ||
"version": "0.11.0", | ||
"description": "", | ||
@@ -9,11 +9,10 @@ "main": "dist/index.js", | ||
"build": "tsc", | ||
"demo": "npx ts-node -r tsconfig-paths/register ./demo/authentication/server", | ||
"demo": "npx ts-node -r tsconfig-paths/register ./demo/basic/clustered-search", | ||
"docs": "npx typedoc src/index.ts", | ||
"check-format": "prettier --check \"src/**/*.ts\"", | ||
"format": "prettier --write \"src/**/*.ts\"", | ||
"lint": "tslint -p tsconfig.json", | ||
"test": "jest --config jestconfig.json", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm test && npm run lint", | ||
"preversion": "npm run lint", | ||
"prepublishOnly": "npm test && npm run check-format", | ||
"preversion": "npm run check-format", | ||
"version": "npm run format && git add -A src", | ||
@@ -46,4 +45,2 @@ "postversion": "git push && git push --tags" | ||
"tsconfig-paths": "^3.13.0", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^4.6.2" | ||
@@ -50,0 +47,0 @@ }, |
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
147663
10
41
2295