@ferlab/next
Advanced tools
Comparing version 0.0.23 to 0.0.24
@@ -48,1 +48,8 @@ import { Client } from '@opensearch-project/opensearch'; | ||
}) => Promise<EsMapping>; | ||
/** | ||
* Calls the `search` on the given elasticsearch.Client to get a single page of results. | ||
* @param {Object} esClient - an elasticsearch.Client object. | ||
* @param {String} index - the name of the index (or alias) on which to search. | ||
* @param {Object} query - an object containing the query, | ||
*/ | ||
export declare const executeSearch: (esClient: any, index: any, query: any) => Promise<any>; |
@@ -46,2 +46,24 @@ export const getBody = ({ field, value, path, nested = false }) => { | ||
}; | ||
/** | ||
* Calls the `search` on the given elasticsearch.Client to get a single page of results. | ||
* @param {Object} esClient - an elasticsearch.Client object. | ||
* @param {String} index - the name of the index (or alias) on which to search. | ||
* @param {Object} query - an object containing the query, | ||
*/ | ||
export const executeSearch = async (esClient, index, query) => { | ||
const searchParams = { | ||
index, | ||
body: { | ||
...query, | ||
size: typeof query.size === 'number' ? query.size : 0, | ||
}, | ||
}; | ||
try { | ||
return esClient.search(searchParams); | ||
} | ||
catch (err) { | ||
console.error(`Error searching ES with params ${JSON.stringify(searchParams)}`, err); | ||
throw err; | ||
} | ||
}; | ||
//# sourceMappingURL=utils.js.map |
@@ -10,5 +10,5 @@ import { Output } from '../usersApi'; | ||
export declare const getSets: (accessToken: string, usersApiURL: string) => Promise<Set[]>; | ||
export declare const createSet: (requestBody: CreateSetBody, accessToken: string, userId: string, usersApiURL: any, esClient: any, schema: any, maxSetContentSize: number) => Promise<Set>; | ||
export declare const createSet: (requestBody: CreateSetBody, accessToken: string, userId: string, usersApiURL: any, esClient: any, schema: any, maxSetContentSize: number, esFileIndex: string) => Promise<Set>; | ||
export declare const updateSetTag: (requestBody: UpdateSetTagBody, accessToken: string, userId: string, setId: string, usersApiURL: string) => Promise<Set>; | ||
export declare const updateSetContent: (requestBody: UpdateSetContentBody, accessToken: string, userId: string, setId: string, esClient: any, schema: any, usersApiURL: string, maxSetContentSize: number) => Promise<Set>; | ||
export declare const deleteSet: (accessToken: string, setId: string, usersApiURL: string) => Promise<boolean>; |
@@ -8,2 +8,3 @@ import difference from 'lodash/difference'; | ||
import { deleteUserContent, getUserContents, postUserContent, putUserContent } from '../usersApi'; | ||
import getFamilyIds from './getFamilyIds'; | ||
import { SetNotFoundError } from './setError'; | ||
@@ -27,7 +28,8 @@ export const SubActionTypes = { | ||
}; | ||
export const createSet = async (requestBody, accessToken, userId, usersApiURL, esClient, schema, maxSetContentSize) => { | ||
const { sqon, sort, type, idField, tag, sharedpublicly, is_phantom_manifest } = requestBody; | ||
export const createSet = async (requestBody, accessToken, userId, usersApiURL, esClient, schema, maxSetContentSize, esFileIndex) => { | ||
const { sqon, sort, type, idField, tag, sharedpublicly, is_phantom_manifest, withFamily } = requestBody; | ||
const sqonAfterReplace = await resolveSetsInSqon(sqon, userId, accessToken, usersApiURL); | ||
const ids = await searchSqon(sqonAfterReplace, type, sort, idField, esClient, schema, maxSetContentSize); | ||
const truncatedIds = truncateIds(ids, maxSetContentSize); | ||
const idsWithFamily = withFamily ? await getFamilyIds(esClient, ids, maxSetContentSize, esFileIndex) : ids; | ||
const truncatedIds = truncateIds(idsWithFamily, maxSetContentSize); | ||
const payload = { | ||
@@ -34,0 +36,0 @@ alias: tag, |
@@ -18,2 +18,3 @@ export type SetSqon = { | ||
is_phantom_manifest: boolean; | ||
withFamily?: boolean; | ||
}; | ||
@@ -20,0 +21,0 @@ export type UpdateSetTagBody = { |
{ | ||
"name": "@ferlab/next", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"description": "Shared library for our wrappers GraphQL APIs", | ||
@@ -5,0 +5,0 @@ "main": "lib/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
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
536494
205
6995