semantic-network
Advanced tools
Comparing version 0.7.30 to 0.7.31
import { CollectionRepresentation, LinkedRepresentation, RelationshipType } from 'semantic-link'; | ||
import { ApiOptions } from '../interfaces/apiOptions'; | ||
import { DocumentRepresentation } from '../interfaces/document'; | ||
export default class SearchUtil { | ||
export declare class SearchUtil { | ||
/** | ||
@@ -6,0 +6,0 @@ * Create or get a tracked resource that is a collection to store search collections. It |
@@ -49,2 +49,13 @@ "use strict"; | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -54,2 +65,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SearchUtil = void 0; | ||
var semantic_link_1 = require("semantic-link"); | ||
@@ -64,3 +76,3 @@ var instanceOfTrackedRepresentation_1 = require("../utils/instanceOf/instanceOfTrackedRepresentation"); | ||
var linkRelation_1 = require("../linkRelation"); | ||
var resourceUtil_1 = __importDefault(require("../utils/resourceUtil")); | ||
var resourceUtil_1 = require("../utils/resourceUtil"); | ||
var get_1 = require("../representation/get"); | ||
@@ -86,3 +98,3 @@ var equalityUtil_1 = require("../utils/equalityUtil"); | ||
if (uri) { | ||
var poolName = resourceUtil_1.default.makeName(options); | ||
var poolName = resourceUtil_1.ResourceUtil.makeName(options); | ||
var pool = context[poolName]; | ||
@@ -136,12 +148,12 @@ if (pool) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, _b, searchRel, _c, searchName, _d, searchPooledPrefix, pooledResource, searchResource, results; | ||
var _a, _b, searchRel, _c, searchName, _d, searchPooledPrefix, opts, pooledResource, searchResource, results; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
case 0: | ||
_a = __assign({}, options), _b = _a.searchRel, searchRel = _b === void 0 ? linkRelation_1.LinkRelation.Search : _b, _c = _a.searchName, searchName = _c === void 0 ? undefined : _c, _d = _a.searchPooledPrefix, searchPooledPrefix = _d === void 0 ? '.pooled-' : _d; | ||
_a = __assign({}, options), _b = _a.searchRel, searchRel = _b === void 0 ? linkRelation_1.LinkRelation.Search : _b, _c = _a.searchName, searchName = _c === void 0 ? undefined : _c, _d = _a.searchPooledPrefix, searchPooledPrefix = _d === void 0 ? '.pooled-' : _d, opts = __rest(_a, ["searchRel", "searchName", "searchPooledPrefix"]); | ||
pooledResource = SearchUtil.makePooledCollection(context, __assign(__assign({}, options), { rel: searchRel, name: searchName || "".concat(searchPooledPrefix).concat(searchRel) })); | ||
return [4 /*yield*/, (0, get_1.get)(context, __assign(__assign({}, options), { rel: searchRel }))]; | ||
return [4 /*yield*/, (0, get_1.get)(context, __assign(__assign({}, opts), { rel: searchRel }))]; | ||
case 1: | ||
searchResource = _e.sent(); | ||
return [4 /*yield*/, (0, create_1.create)(document, __assign(__assign({}, options), { createContext: searchResource, makeSparseStrategy: function (options) { return (0, sparseRepresentationFactory_1.pooledCollectionMakeStrategy)(pooledResource, options); } }))]; | ||
return [4 /*yield*/, (0, create_1.create)(document, __assign(__assign({}, opts), { createContext: searchResource, makeSparseStrategy: function (options) { return (0, sparseRepresentationFactory_1.pooledCollectionMakeStrategy)(pooledResource, options); } }))]; | ||
case 2: | ||
@@ -151,3 +163,3 @@ results = _e.sent(); | ||
// search collections don't want to merge the result links into the original search links | ||
collectionMerger_1.CollectionMerger.merge(searchResource, results, __assign({ mergeLinks: false }, options)); | ||
collectionMerger_1.CollectionMerger.merge(searchResource, results, __assign({ mergeLinks: false }, opts)); | ||
} | ||
@@ -186,3 +198,3 @@ else { | ||
}()); | ||
exports.default = SearchUtil; | ||
exports.SearchUtil = SearchUtil; | ||
//# sourceMappingURL=searchUtil.js.map |
import { ApiOptions } from '../interfaces/apiOptions'; | ||
export default class ResourceUtil { | ||
export declare class ResourceUtil { | ||
/** | ||
@@ -4,0 +4,0 @@ * Given a set of {@link ApiOptions}, use the {@link ApiOptions.name} and {@ApiOptions.rel} |
@@ -14,2 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ResourceUtil = void 0; | ||
var linkRelConvertUtil_1 = require("./linkRelConvertUtil"); | ||
@@ -40,3 +41,3 @@ var ResourceUtil = /** @class */ (function () { | ||
}()); | ||
exports.default = ResourceUtil; | ||
exports.ResourceUtil = ResourceUtil; | ||
//# sourceMappingURL=resourceUtil.js.map |
import { CollectionRepresentation, LinkedRepresentation, RelationshipType } from 'semantic-link'; | ||
import { ApiOptions } from '../interfaces/apiOptions'; | ||
import { DocumentRepresentation } from '../interfaces/document'; | ||
export default class SearchUtil { | ||
export declare class SearchUtil { | ||
/** | ||
@@ -6,0 +6,0 @@ * Create or get a tracked resource that is a collection to store search collections. It |
@@ -1,2 +0,2 @@ | ||
import { __awaiter } from "tslib"; | ||
import { __awaiter, __rest } from "tslib"; | ||
import { LinkUtil } from 'semantic-link'; | ||
@@ -11,7 +11,7 @@ import { instanceOfTrackedRepresentation } from '../utils/instanceOf/instanceOfTrackedRepresentation'; | ||
import { LinkRelation } from '../linkRelation'; | ||
import ResourceUtil from '../utils/resourceUtil'; | ||
import { ResourceUtil } from '../utils/resourceUtil'; | ||
import { get } from '../representation/get'; | ||
import { EqualityUtil } from '../utils/equalityUtil'; | ||
const log = anylogger('SearchUtil'); | ||
export default class SearchUtil { | ||
export class SearchUtil { | ||
/** | ||
@@ -80,11 +80,9 @@ * Create or get a tracked resource that is a collection to store search collections. It | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { searchRel = LinkRelation.Search, searchName = undefined, searchPooledPrefix = '.pooled-', } = Object.assign({}, options); | ||
// TODO: be better to strip {@link PooledSearchOptions} options going forward | ||
// need a clone without/omit Omit<ApiOptions, keyof<CollectionMergerOptions>> | ||
const _a = Object.assign({}, options), { searchRel = LinkRelation.Search, searchName = undefined, searchPooledPrefix = '.pooled-' } = _a, opts = __rest(_a, ["searchRel", "searchName", "searchPooledPrefix"]); | ||
const pooledResource = SearchUtil.makePooledCollection(context, Object.assign(Object.assign({}, options), { rel: searchRel, name: searchName || `${searchPooledPrefix}${searchRel}` })); | ||
const searchResource = yield get(context, Object.assign(Object.assign({}, options), { rel: searchRel })); | ||
const results = yield create(document, Object.assign(Object.assign({}, options), { createContext: searchResource, makeSparseStrategy: (options) => pooledCollectionMakeStrategy(pooledResource, options) })); | ||
const searchResource = yield get(context, Object.assign(Object.assign({}, opts), { rel: searchRel })); | ||
const results = yield create(document, Object.assign(Object.assign({}, opts), { createContext: searchResource, makeSparseStrategy: (options) => pooledCollectionMakeStrategy(pooledResource, options) })); | ||
if (results) { | ||
// search collections don't want to merge the result links into the original search links | ||
CollectionMerger.merge(searchResource, results, Object.assign({ mergeLinks: false }, options)); | ||
CollectionMerger.merge(searchResource, results, Object.assign({ mergeLinks: false }, opts)); | ||
} | ||
@@ -91,0 +89,0 @@ else { |
import { ApiOptions } from '../interfaces/apiOptions'; | ||
export default class ResourceUtil { | ||
export declare class ResourceUtil { | ||
/** | ||
@@ -4,0 +4,0 @@ * Given a set of {@link ApiOptions}, use the {@link ApiOptions.name} and {@ApiOptions.rel} |
import { LinkRelConvertUtil } from './linkRelConvertUtil'; | ||
export default class ResourceUtil { | ||
export class ResourceUtil { | ||
/** | ||
@@ -4,0 +4,0 @@ * Given a set of {@link ApiOptions}, use the {@link ApiOptions.name} and {@ApiOptions.rel} |
{ | ||
"name": "semantic-network", | ||
"version": "0.7.30", | ||
"version": "0.7.31", | ||
"description": "A utility library for manipulating a list of links that form a semantic interface to a network of resources.", | ||
@@ -5,0 +5,0 @@ "main": "lib/es5/index.js", |
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
1261316
20699