53 lines
2.2 KiB
JavaScript
53 lines
2.2 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.SearchableMappingTemplate = void 0;
|
|
const print_1 = require("./print");
|
|
const ast_1 = require("./ast");
|
|
const RESOLVER_VERSION_ID = '2018-05-29';
|
|
class SearchableMappingTemplate {
|
|
static genericTemplate({ operation, path, params, }) {
|
|
return (0, ast_1.obj)({
|
|
version: (0, ast_1.str)(RESOLVER_VERSION_ID),
|
|
operation,
|
|
path,
|
|
params,
|
|
});
|
|
}
|
|
static searchItem({ query, size, search_after, from, path, sort, version = (0, ast_1.bool)(false), }) {
|
|
return (0, ast_1.obj)({
|
|
version: (0, ast_1.str)(RESOLVER_VERSION_ID),
|
|
operation: (0, ast_1.str)('GET'),
|
|
path,
|
|
params: (0, ast_1.obj)({
|
|
body: (0, ast_1.raw)(`{
|
|
#if( $context.args.nextToken )"search_after": ${(0, print_1.print)(search_after)}, #end
|
|
#if( $context.args.from )"from": ${(0, print_1.print)(from)}, #end
|
|
"size": ${(0, print_1.print)(size)},
|
|
"sort": ${(0, print_1.print)(sort)},
|
|
"version": ${(0, print_1.print)(version)},
|
|
"query": ${(0, print_1.print)(query)}
|
|
}`),
|
|
}),
|
|
});
|
|
}
|
|
static searchTemplate({ query, size, search_after, from, path, sort, version = (0, ast_1.bool)(false), aggs, }) {
|
|
return (0, ast_1.obj)({
|
|
version: (0, ast_1.str)(RESOLVER_VERSION_ID),
|
|
operation: (0, ast_1.str)('GET'),
|
|
path,
|
|
params: (0, ast_1.obj)({
|
|
body: (0, ast_1.raw)(`{
|
|
#if( $context.args.nextToken )"search_after": ${(0, print_1.print)(search_after)}, #end
|
|
#if( $context.args.from )"from": ${(0, print_1.print)(from)}, #end
|
|
"size": ${(0, print_1.print)(size)},
|
|
"sort": ${(0, print_1.print)(sort)},
|
|
"version": ${(0, print_1.print)(version)},
|
|
"query": ${(0, print_1.print)(query)},
|
|
"aggs": ${(0, print_1.print)(aggs)}
|
|
}`),
|
|
}),
|
|
});
|
|
}
|
|
}
|
|
exports.SearchableMappingTemplate = SearchableMappingTemplate;
|
|
//# sourceMappingURL=searchable.js.map
|