@spinque/query-api
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -38,3 +38,9 @@ import { Query } from './types'; | ||
get facets(): Facet[]; | ||
/** | ||
* Set a query as modifier. Only modifiers in the list passed to constructor are allowed. | ||
*/ | ||
setModifier(modifier: Query | undefined): void; | ||
/** | ||
* Get the currently active modifier query. | ||
*/ | ||
getModifier(): Query | undefined; | ||
@@ -41,0 +47,0 @@ /** |
@@ -80,2 +80,5 @@ "use strict"; | ||
}); | ||
/** | ||
* Set a query as modifier. Only modifiers in the list passed to constructor are allowed. | ||
*/ | ||
FacetedSearch.prototype.setModifier = function (modifier) { | ||
@@ -93,2 +96,5 @@ if (modifier === undefined) { | ||
}; | ||
/** | ||
* Get the currently active modifier query. | ||
*/ | ||
FacetedSearch.prototype.getModifier = function () { | ||
@@ -95,0 +101,0 @@ return this._activeModifier; |
@@ -129,5 +129,23 @@ /** | ||
} | ||
/** | ||
* Output format of Spinque's OBJ type | ||
*/ | ||
export interface SpinqueResultObject { | ||
/** | ||
* The unique identifier of the object. | ||
* Will always be a valid URI. | ||
*/ | ||
id: string; | ||
/** | ||
* Array of classes assigned to this object. | ||
* | ||
* If a value is in this list, then there is | ||
* a <https://www.w3.org/2000/01/rdf-schema#Class> | ||
* relation between that value and `id`. | ||
*/ | ||
class: string[]; | ||
/** | ||
* Object with attribute names and values. | ||
* Values can be any valid JSON type. | ||
*/ | ||
attributes?: { | ||
@@ -134,0 +152,0 @@ [attributeName: string]: any; |
@@ -30,1 +30,9 @@ import { ApiConfig, Query } from '.'; | ||
export declare const join: (...segments: string[]) => string; | ||
/** | ||
* Expects a string generated by stringifyQueries and returns an array of Query's | ||
*/ | ||
export declare const parseQueries: (stringified: string) => Query[]; | ||
/** | ||
* Expects an array of Query's and turns them into a string | ||
*/ | ||
export declare const stringifyQueries: (queries: Query[]) => string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.join = exports.tupleListToString = exports.stringToTupleList = exports.urlFromQueries = exports.pathFromQuery = exports.pathFromQueries = void 0; | ||
exports.stringifyQueries = exports.parseQueries = exports.join = exports.tupleListToString = exports.stringToTupleList = exports.urlFromQueries = exports.pathFromQuery = exports.pathFromQueries = void 0; | ||
/** | ||
@@ -179,1 +179,38 @@ * Takes an array of Query objects and returns the path they would represent in a Query API request URL. | ||
exports.join = join; | ||
/** | ||
* Expects a string generated by stringifyQueries and returns an array of Query's | ||
*/ | ||
var parseQueries = function (stringified) { | ||
if (!stringified) { | ||
return []; | ||
} | ||
try { | ||
var endpoints = JSON.parse(stringified); | ||
return endpoints.map(function (e) { | ||
if (typeof e === 'string') { | ||
return { | ||
endpoint: e, | ||
parameters: undefined, | ||
}; | ||
} | ||
else { | ||
return { | ||
endpoint: e[0], | ||
parameters: e[1], | ||
}; | ||
} | ||
}); | ||
} | ||
catch (error) { | ||
return []; | ||
} | ||
}; | ||
exports.parseQueries = parseQueries; | ||
/** | ||
* Expects an array of Query's and turns them into a string | ||
*/ | ||
var stringifyQueries = function (queries) { | ||
var endpointString = queries.map(function (q) { return (q.parameters ? [q.endpoint, q.parameters] : q.endpoint); }); | ||
return JSON.stringify(endpointString); | ||
}; | ||
exports.stringifyQueries = stringifyQueries; |
{ | ||
"name": "@spinque/query-api", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
97350
2086