aws-service-stack 0.18.449 → 0.18.450
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exception/exception-handler.d.ts.map +1 -1
- package/dist/exception/exception-handler.js +17 -2
- package/dist/exception/exception-handler.js.map +1 -1
- package/dist/repositories/base-es.repo.d.ts.map +1 -1
- package/dist/repositories/base-es.repo.js +4 -0
- package/dist/repositories/base-es.repo.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/opensearch/opensearch.mapping.d.ts +35 -0
- package/dist/utils/opensearch/opensearch.mapping.d.ts.map +1 -0
- package/dist/utils/opensearch/opensearch.mapping.js +95 -0
- package/dist/utils/opensearch/opensearch.mapping.js.map +1 -0
- package/package.json +28 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception-handler.d.ts","sourceRoot":"","sources":["../../src/exception/exception-handler.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,OAAO,CAAC;KACf,CAAC;CACH,CAAC;
|
|
1
|
+
{"version":3,"file":"exception-handler.d.ts","sourceRoot":"","sources":["../../src/exception/exception-handler.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,MAAM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;QAAI,GAAG;QAAkB,IAAI;;IACzC,+BAA+B;QAAI,GAAG;QAAqC,IAAI;;CAChF,CAAC"}
|
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HTTP = exports.refineHttpError = void 0;
|
|
4
4
|
const errors_1 = require("./errors");
|
|
5
|
+
/**
|
|
6
|
+
* `search_phase_execution_exception` covers every shard-level search failure, not just
|
|
7
|
+
* sorting on an un-keyworded text field. The OpenSearch client already flattens
|
|
8
|
+
* `body.error.root_cause` into `Error.message`, so that reason is preserved verbatim and a
|
|
9
|
+
* hint is only appended for causes we can actually recognise.
|
|
10
|
+
*/
|
|
11
|
+
const buildOpenSearchHint = (message) => {
|
|
12
|
+
if (message.includes("Fielddata is disabled on text fields")) {
|
|
13
|
+
return " Hint: sort or aggregate on '<field>.keyword' rather than '<field>'.";
|
|
14
|
+
}
|
|
15
|
+
if (message.includes("No mapping found for")) {
|
|
16
|
+
return " Hint: that field is not mapped in this index - check the requested sortField.";
|
|
17
|
+
}
|
|
18
|
+
return "";
|
|
19
|
+
};
|
|
5
20
|
const refineHttpError = (err) => {
|
|
6
21
|
let http = {
|
|
7
22
|
code: err.statusCode ?? exports.HTTP.INTERNAL_SERVER_ERROR.code,
|
|
@@ -29,9 +44,9 @@ const refineHttpError = (err) => {
|
|
|
29
44
|
}
|
|
30
45
|
message = `Database Error: ${err.tableName}`;
|
|
31
46
|
}
|
|
32
|
-
else if (message.includes("search_phase_execution_exception")) {
|
|
47
|
+
else if (typeof message === "string" && message.includes("search_phase_execution_exception")) {
|
|
33
48
|
http = exports.HTTP.BAD_REQUEST;
|
|
34
|
-
message =
|
|
49
|
+
message = `OpenSearch search failed: ${message}${buildOpenSearchHint(message)}`;
|
|
35
50
|
}
|
|
36
51
|
return {
|
|
37
52
|
statusCode: http.code,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception-handler.js","sourceRoot":"","sources":["../../src/ex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type HttpStatus = { code: number; msg: string };\n\ntype HttpErrorResponse = {\n statusCode: number;\n content: {\n error: string;\n message: unknown;\n reason?: string;\n data: unknown;\n };\n};\n\nexport const refineHttpError = (err: any): HttpErrorResponse => {\n let http: HttpStatus = {\n code: err.statusCode ?? HTTP.INTERNAL_SERVER_ERROR.code,\n msg: err.error ?? HTTP.INTERNAL_SERVER_ERROR.msg,\n };\n\n let message = err.message ?? \"An unexpected error occurred.\";\n let reason = err.reason ?? ErrorReason.UNKNOWN;\n let data = err.data;\n\n if (err instanceof ErrorValidation) {\n http = HTTP.BAD_REQUEST;\n http.msg += \" - Validation failed.\";\n } else if (err instanceof ErrorDynamoDB) {\n if (message.includes(\"requires indexName and indexValue\")) {\n http = HTTP.BAD_REQUEST;\n message = `Index name and value are required: ${err.tableName}`;\n }\n if (message.includes(\"ResourceNotFoundException\")) {\n http = HTTP.BAD_REQUEST;\n message = `Resource not found: ${err.tableName}`;\n } else if (message.includes(\"ConditionalCheckFailedException\")) {\n http = HTTP.BAD_REQUEST;\n message = `ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}}`;\n }\n message = `Database Error: ${err.tableName}`;\n } else if (message.includes(\"search_phase_execution_exception\")) {\n http = HTTP.BAD_REQUEST;\n message = \"OpenSearch: Cannot sort by text field - use '.keyword' instead.\";\n }\n\n return {\n statusCode: http.code,\n content: {\n error: http.msg,\n message,\n reason,\n data,\n },\n };\n};\n\nexport const HTTP = {\n // 1xx Informational\n CONTINUE: { msg: \"Continue\", code: 100 },\n SWITCHING_PROTOCOLS: { msg: \"Switching Protocols\", code: 101 },\n PROCESSING: { msg: \"Processing\", code: 102 },\n\n // 2xx Success\n OK: { msg: \"OK\", code: 200 },\n CREATED: { msg: \"Created\", code: 201 },\n ACCEPTED: { msg: \"Accepted\", code: 202 },\n NON_AUTHORITATIVE_INFORMATION: { msg: \"Non-Authoritative Information\", code: 203 },\n NO_CONTENT: { msg: \"No Content\", code: 204 },\n RESET_CONTENT: { msg: \"Reset Content\", code: 205 },\n PARTIAL_CONTENT: { msg: \"Partial Content\", code: 206 },\n\n // 3xx Redirection\n MULTIPLE_CHOICES: { msg: \"Multiple Choices\", code: 300 },\n MOVED_PERMANENTLY: { msg: \"Moved Permanently\", code: 301 },\n FOUND: { msg: \"Found\", code: 302 },\n SEE_OTHER: { msg: \"See Other\", code: 303 },\n NOT_MODIFIED: { msg: \"Not Modified\", code: 304 },\n TEMPORARY_REDIRECT: { msg: \"Temporary Redirect\", code: 307 },\n PERMANENT_REDIRECT: { msg: \"Permanent Redirect\", code: 308 },\n\n // 4xx Client Errors\n BAD_REQUEST: { msg: \"Bad Request\", code: 400 },\n UNAUTHORIZED: { msg: \"Unauthorized\", code: 401 },\n PAYMENT_REQUIRED: { msg: \"Payment Required\", code: 402 },\n FORBIDDEN: { msg: \"Forbidden\", code: 403 },\n NOT_FOUND: { msg: \"Not Found\", code: 404 },\n METHOD_NOT_ALLOWED: { msg: \"Method Not Allowed\", code: 405 },\n NOT_ACCEPTABLE: { msg: \"Not Acceptable\", code: 406 },\n PROXY_AUTHENTICATION_REQUIRED: { msg: \"Proxy Authentication Required\", code: 407 },\n REQUEST_TIMEOUT: { msg: \"Request Timeout\", code: 408 },\n CONFLICT: { msg: \"Conflict\", code: 409 },\n GONE: { msg: \"Gone\", code: 410 },\n LENGTH_REQUIRED: { msg: \"Length Required\", code: 411 },\n PRECONDITION_FAILED: { msg: \"Precondition Failed\", code: 412 },\n PAYLOAD_TOO_LARGE: { msg: \"Payload Too Large\", code: 413 },\n URI_TOO_LONG: { msg: \"URI Too Long\", code: 414 },\n UNSUPPORTED_MEDIA_TYPE: { msg: \"Unsupported Media Type\", code: 415 },\n RANGE_NOT_SATISFIABLE: { msg: \"Range Not Satisfiable\", code: 416 },\n EXPECTATION_FAILED: { msg: \"Expectation Failed\", code: 417 },\n IM_A_TEAPOT: { msg: \"I'm a teapot\", code: 418 },\n MISDIRECTED_REQUEST: { msg: \"Misdirected Request\", code: 421 },\n UNPROCESSABLE_ENTITY: { msg: \"Unprocessable Entity\", code: 422 },\n LOCKED: { msg: \"Locked\", code: 423 },\n FAILED_DEPENDENCY: { msg: \"Failed Dependency\", code: 424 },\n TOO_EARLY: { msg: \"Too Early\", code: 425 },\n UPGRADE_REQUIRED: { msg: \"Upgrade Required\", code: 426 },\n PRECONDITION_REQUIRED: { msg: \"Precondition Required\", code: 428 },\n TOO_MANY_REQUESTS: { msg: \"Too Many Requests\", code: 429 },\n REQUEST_HEADER_FIELDS_TOO_LARGE: { msg: \"Request Header Fields Too Large\", code: 431 },\n UNAVAILABLE_FOR_LEGAL_REASONS: { msg: \"Unavailable For Legal Reasons\", code: 451 },\n\n // 5xx Server Errors\n INTERNAL_SERVER_ERROR: { msg: \"Internal Server Error\", code: 500 },\n NOT_IMPLEMENTED: { msg: \"Not Implemented\", code: 501 },\n BAD_GATEWAY: { msg: \"Bad Gateway\", code: 502 },\n SERVICE_UNAVAILABLE: { msg: \"Service Unavailable\", code: 503 },\n GATEWAY_TIMEOUT: { msg: \"Gateway Timeout\", code: 504 },\n HTTP_VERSION_NOT_SUPPORTED: { msg: \"HTTP Version Not Supported\", code: 505 },\n VARIANT_ALSO_NEGOTIATES: { msg: \"Variant Also Negotiates\", code: 506 },\n INSUFFICIENT_STORAGE: { msg: \"Insufficient Storage\", code: 507 },\n LOOP_DETECTED: { msg: \"Loop Detected\", code: 508 },\n NOT_EXTENDED: { msg: \"Not Extended\", code: 510 },\n NETWORK_AUTHENTICATION_REQUIRED: { msg: \"Network Authentication Required\", code: 511 },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"exception-handler.js","sourceRoot":"","sources":["../../src/exception/exception-handler.ts"],"names":[],"mappings":";;;AAAA,qCAAuE;AAevE;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAU,EAAE;IACtD,IAAI,OAAO,CAAC,QAAQ,CAAC,sCAAsC,CAAC,EAAE,CAAC;QAC7D,OAAO,sEAAsE,CAAC;IAChF,CAA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;IAChD,+BAA+B,EAAE,EAAE,GAAG,EAAE,iCAAiC,EAAE,IAAI,EAAE,GAAG,EAAE;CACvF,CAAC","sourcesContent":["import { ErrorDynamoDB, ErrorReason, ErrorValidation } from \"./errors\";\nimport { HttpMethod } from \"../model/http.model\";\n\nexport type HttpStatus = { code: number; msg: string };\n\ntype HttpErrorResponse = {\n statusCode: number;\n content: {\n error: string;\n message: unknown;\n reason?: string;\n data: unknown;\n };\n};\n\n/**\n * `search_phase_execution_exception` covers every shard-level search failure, not just\n * sorting on an un-keyworded text field. The OpenSearch client already flattens\n * `body.error.root_cause` into `Error.message`, so that reason is preserved verbatim and a\n * hint is only appended for causes we can actually recognise.\n */\nconst buildOpenSearchHint = (message: string): string => {\n if (message.includes(\"Fielddata is disabled on text fields\")) {\n return \" Hint: sort or aggregate on '<field>.keyword' rather than '<field>'.\";\n }\n\n if (message.includes(\"No mapping found for\")) {\n return \" Hint: that field is not mapped in this index - check the requested sortField.\";\n }\n\n return \"\";\n};\n\nexport const refineHttpError = (err: any): HttpErrorResponse => {\n let http: HttpStatus = {\n code: err.statusCode ?? HTTP.INTERNAL_SERVER_ERROR.code,\n msg: err.error ?? HTTP.INTERNAL_SERVER_ERROR.msg,\n };\n\n let message = err.message ?? \"An unexpected error occurred.\";\n let reason = err.reason ?? ErrorReason.UNKNOWN;\n let data = err.data;\n\n if (err instanceof ErrorValidation) {\n http = HTTP.BAD_REQUEST;\n http.msg += \" - Validation failed.\";\n } else if (err instanceof ErrorDynamoDB) {\n if (message.includes(\"requires indexName and indexValue\")) {\n http = HTTP.BAD_REQUEST;\n message = `Index name and value are required: ${err.tableName}`;\n }\n if (message.includes(\"ResourceNotFoundException\")) {\n http = HTTP.BAD_REQUEST;\n message = `Resource not found: ${err.tableName}`;\n } else if (message.includes(\"ConditionalCheckFailedException\")) {\n http = HTTP.BAD_REQUEST;\n message = `ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}}`;\n }\n message = `Database Error: ${err.tableName}`;\n } else if (typeof message === \"string\" && message.includes(\"search_phase_execution_exception\")) {\n http = HTTP.BAD_REQUEST;\n message = `OpenSearch search failed: ${message}${buildOpenSearchHint(message)}`;\n }\n\n return {\n statusCode: http.code,\n content: {\n error: http.msg,\n message,\n reason,\n data,\n },\n };\n};\n\nexport const HTTP = {\n // 1xx Informational\n CONTINUE: { msg: \"Continue\", code: 100 },\n SWITCHING_PROTOCOLS: { msg: \"Switching Protocols\", code: 101 },\n PROCESSING: { msg: \"Processing\", code: 102 },\n\n // 2xx Success\n OK: { msg: \"OK\", code: 200 },\n CREATED: { msg: \"Created\", code: 201 },\n ACCEPTED: { msg: \"Accepted\", code: 202 },\n NON_AUTHORITATIVE_INFORMATION: { msg: \"Non-Authoritative Information\", code: 203 },\n NO_CONTENT: { msg: \"No Content\", code: 204 },\n RESET_CONTENT: { msg: \"Reset Content\", code: 205 },\n PARTIAL_CONTENT: { msg: \"Partial Content\", code: 206 },\n\n // 3xx Redirection\n MULTIPLE_CHOICES: { msg: \"Multiple Choices\", code: 300 },\n MOVED_PERMANENTLY: { msg: \"Moved Permanently\", code: 301 },\n FOUND: { msg: \"Found\", code: 302 },\n SEE_OTHER: { msg: \"See Other\", code: 303 },\n NOT_MODIFIED: { msg: \"Not Modified\", code: 304 },\n TEMPORARY_REDIRECT: { msg: \"Temporary Redirect\", code: 307 },\n PERMANENT_REDIRECT: { msg: \"Permanent Redirect\", code: 308 },\n\n // 4xx Client Errors\n BAD_REQUEST: { msg: \"Bad Request\", code: 400 },\n UNAUTHORIZED: { msg: \"Unauthorized\", code: 401 },\n PAYMENT_REQUIRED: { msg: \"Payment Required\", code: 402 },\n FORBIDDEN: { msg: \"Forbidden\", code: 403 },\n NOT_FOUND: { msg: \"Not Found\", code: 404 },\n METHOD_NOT_ALLOWED: { msg: \"Method Not Allowed\", code: 405 },\n NOT_ACCEPTABLE: { msg: \"Not Acceptable\", code: 406 },\n PROXY_AUTHENTICATION_REQUIRED: { msg: \"Proxy Authentication Required\", code: 407 },\n REQUEST_TIMEOUT: { msg: \"Request Timeout\", code: 408 },\n CONFLICT: { msg: \"Conflict\", code: 409 },\n GONE: { msg: \"Gone\", code: 410 },\n LENGTH_REQUIRED: { msg: \"Length Required\", code: 411 },\n PRECONDITION_FAILED: { msg: \"Precondition Failed\", code: 412 },\n PAYLOAD_TOO_LARGE: { msg: \"Payload Too Large\", code: 413 },\n URI_TOO_LONG: { msg: \"URI Too Long\", code: 414 },\n UNSUPPORTED_MEDIA_TYPE: { msg: \"Unsupported Media Type\", code: 415 },\n RANGE_NOT_SATISFIABLE: { msg: \"Range Not Satisfiable\", code: 416 },\n EXPECTATION_FAILED: { msg: \"Expectation Failed\", code: 417 },\n IM_A_TEAPOT: { msg: \"I'm a teapot\", code: 418 },\n MISDIRECTED_REQUEST: { msg: \"Misdirected Request\", code: 421 },\n UNPROCESSABLE_ENTITY: { msg: \"Unprocessable Entity\", code: 422 },\n LOCKED: { msg: \"Locked\", code: 423 },\n FAILED_DEPENDENCY: { msg: \"Failed Dependency\", code: 424 },\n TOO_EARLY: { msg: \"Too Early\", code: 425 },\n UPGRADE_REQUIRED: { msg: \"Upgrade Required\", code: 426 },\n PRECONDITION_REQUIRED: { msg: \"Precondition Required\", code: 428 },\n TOO_MANY_REQUESTS: { msg: \"Too Many Requests\", code: 429 },\n REQUEST_HEADER_FIELDS_TOO_LARGE: { msg: \"Request Header Fields Too Large\", code: 431 },\n UNAVAILABLE_FOR_LEGAL_REASONS: { msg: \"Unavailable For Legal Reasons\", code: 451 },\n\n // 5xx Server Errors\n INTERNAL_SERVER_ERROR: { msg: \"Internal Server Error\", code: 500 },\n NOT_IMPLEMENTED: { msg: \"Not Implemented\", code: 501 },\n BAD_GATEWAY: { msg: \"Bad Gateway\", code: 502 },\n SERVICE_UNAVAILABLE: { msg: \"Service Unavailable\", code: 503 },\n GATEWAY_TIMEOUT: { msg: \"Gateway Timeout\", code: 504 },\n HTTP_VERSION_NOT_SUPPORTED: { msg: \"HTTP Version Not Supported\", code: 505 },\n VARIANT_ALSO_NEGOTIATES: { msg: \"Variant Also Negotiates\", code: 506 },\n INSUFFICIENT_STORAGE: { msg: \"Insufficient Storage\", code: 507 },\n LOOP_DETECTED: { msg: \"Loop Detected\", code: 508 },\n NOT_EXTENDED: { msg: \"Not Extended\", code: 510 },\n NETWORK_AUTHENTICATION_REQUIRED: { msg: \"Network Authentication Required\", code: 511 },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-es.repo.d.ts","sourceRoot":"","sources":["../../src/repositories/base-es.repo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,IAAI,EAIL,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"base-es.repo.d.ts","sourceRoot":"","sources":["../../src/repositories/base-es.repo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,IAAI,EAIL,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAGrD,8BACsB,cAAc,CAAC,CAAC,SAAS,UAAU,CAAE,YAAW,UAAU,CAAC,CAAC,CAAC;IACjF,OAAO,CAAC,YAAY,CAAmB;IACvC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAO;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAO;IAE1B,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAI3C;IAEK,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,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AAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAgC3G;IAED,OAAO,CAAC,YAAY;CAerB"}
|
|
@@ -13,6 +13,7 @@ exports.BaseRepoESImpl = void 0;
|
|
|
13
13
|
const index_1 = require("../index");
|
|
14
14
|
const typedi_1 = require("typedi");
|
|
15
15
|
const elastic_builder_1 = __importDefault(require("elastic-builder"));
|
|
16
|
+
const opensearch_mapping_1 = require("../utils/opensearch/opensearch.mapping");
|
|
16
17
|
let BaseRepoESImpl = class BaseRepoESImpl {
|
|
17
18
|
searchClient;
|
|
18
19
|
indexName;
|
|
@@ -124,6 +125,9 @@ let BaseRepoESImpl = class BaseRepoESImpl {
|
|
|
124
125
|
if (debug) {
|
|
125
126
|
log.info("searchQuery: ", JSON.stringify(finalQuery, null, 2));
|
|
126
127
|
}
|
|
128
|
+
if (finalQuery?.body?.sort?.length) {
|
|
129
|
+
finalQuery.body.sort = await (0, opensearch_mapping_1.resolveSortFields)(this.searchClient, finalQuery.index, finalQuery.body.sort);
|
|
130
|
+
}
|
|
127
131
|
try {
|
|
128
132
|
const { body } = await this.searchClient.search(finalQuery);
|
|
129
133
|
const totalRaw = body.hits.total;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-es.repo.js","sourceRoot":"","sources":["../../src/repositories/base-es.repo.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAOkB;AAClB,mCAAiC;AACjC,sEAAkC;AAK3B,IAAe,cAAc,GAA7B,MAAe,cAAc;IAC1B,YAAY,CAAmB;IAC/B,SAAS,CAAS;IACT,YAAY,GAAG,GAAG,CAAC;IACnB,QAAQ,GAAG,GAAG,CAAC;IAEhC,KAAK,CAAC,SAAS,CAAC,GAAa;QAC3B,MAAM,MAAM,GAAW,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;CACF,CAAA;;yBApLqB,cAAc;IADnC,IAAA,gBAAO,EAAC,YAAY,CAAC;GACA,cAAc,CAoLnC","sourcesContent":["import {\n BaseRepoES,\n buildQueryOS,\n List,\n OpenSearchClient,\n removeEmptyFields,\n transformAggregationsResponse,\n} from \"../index\";\nimport { Service } from \"typedi\";\nimport esb from \"elastic-builder\";\nimport { BaseEntity, Filter } from \"@chinggis/types\";\nimport { API } from \"@opensearch-project/opensearch\";\n\n@Service(\"BaseRepoES\")\nexport abstract class BaseRepoESImpl<T extends BaseEntity> implements BaseRepoES<T> {\n private searchClient: OpenSearchClient;\n private indexName: string;\n private readonly DEFAULT_SIZE = 100;\n private readonly MAX_SIZE = 250;\n\n async findByIds(ids: string[]): Promise<T[]> {\n const filter: Filter = { id: ids.join(\",\") };\n const result = await this.find(filter);\n return result.items;\n }\n\n async find(filter: Filter, debug?: boolean): Promise<List<T>> {\n const query = buildQueryOS(filter);\n\n const res = await this.search(query, debug);\n\n return { items: res?.items, total: res?.total };\n }\n\n async fieldNotExists(\n fieldName: string,\n from: number,\n size: number,\n includeFields?: string[],\n excludeFields?: string[],\n ): Promise<T[]> {\n const filter: Filter = {\n size,\n from,\n fieldsInclude: includeFields,\n fieldsExclude: excludeFields,\n };\n const query = buildQueryOS(filter);\n query.index = this.indexName;\n\n // Add field not exists filter using elastic-builder\n const boolQuery = esb.boolQuery().mustNot(esb.existsQuery(fieldName));\n query.body.query = boolQuery.toJSON();\n\n const res = await this.search(query);\n\n return res?.items;\n }\n\n async findOne(filter: Filter): Promise<T> {\n filter.size = 1;\n return this.find(filter).then((result) => result.items[0]);\n }\n\n async nativeQuery(query: any): Promise<API.Search_ResponseBody> {\n try {\n const res = await this.searchClient.search(query);\n return res?.body;\n } catch (err) {\n console.error(JSON.stringify(err, null, 2));\n return undefined;\n }\n }\n\n async count(query: any): Promise<number> {\n const finalQuery = this.prepareQuery(query);\n\n try {\n const res = await this.searchClient.count({\n index: finalQuery.index,\n body: {\n query: finalQuery?.body?.query?.bool\n ? finalQuery.body.query\n : {\n match_all: {},\n },\n },\n });\n\n return Number(res.body.count ?? 0);\n } catch (err) {\n console.error(JSON.stringify(err, null, 2));\n return 0;\n }\n }\n\n getRaw?(filter: Filter): Promise<any> {\n throw new Error(\"Method not implemented.\");\n }\n\n setIndexName(indexName: string): boolean {\n this.indexName = indexName;\n return true;\n }\n\n setEndpoint(node: string): boolean {\n this.searchClient = new OpenSearchClient(node);\n return true;\n }\n\n getEndpoint(): string {\n throw new Error(\"Method not implemented.\");\n }\n\n getIndexName(): string {\n return this.indexName;\n }\n\n async findById(id: string): Promise<T | undefined> {\n const result = await this.findByIds([id]);\n\n if (result.length > 1) console.warn(\"More than one entity found by id\", id);\n\n return result.length > 0 ? result.at(0) : undefined;\n }\n\n async findByIdFieldSelected(id: string, includeFields?: string[], excludeFields?: string[]): Promise<T | undefined> {\n const filter: Filter = {\n id,\n size: 10,\n from: 0,\n fieldsInclude: includeFields,\n fieldsExclude: excludeFields,\n };\n const query = buildQueryOS(filter);\n\n const result = await this.search(query);\n\n return result?.items?.length > 0 ? result.items.at(0) : undefined;\n }\n\n async exists(id: string): Promise<boolean> {\n return !!(await this.findById(id));\n }\n\n findBetween<K>(fieldName: string, fromValue: K, toValue: K, includeFields: string[]): Promise<T[]> {\n throw new Error(\"Method not implemented.\");\n }\n\n async search(query: any, debug?: boolean): Promise<{ items: T[]; aggs: Record<string, any>; total: number }> {\n debug = debug || process.env.ENV?.toLowerCase()?.trim() === \"dev\";\n const finalQuery = this.prepareQuery(query);\n\n if (debug) {\n log.info(\"searchQuery: \", JSON.stringify(finalQuery, null, 2));\n }\n\n try {\n const { body } = await this.searchClient.search(finalQuery);\n const totalRaw = body.hits.total;\n const totalCount = typeof totalRaw === \"number\" ? totalRaw : totalRaw.value;\n\n return {\n items: body?.hits?.hits?.map((item) => item._source as T) || [],\n aggs: body?.aggregations ? transformAggregationsResponse(body?.aggregations) : undefined,\n total: totalCount,\n };\n } catch (err) {\n console.error(\"searchES ERROR: \", err);\n\n let message: string;\n if (err instanceof Error) message = err.message;\n else if (typeof err === \"string\") message = err;\n else message = \"Unknown searchES error\";\n\n throw new Error(message);\n }\n }\n\n private prepareQuery(query: any): any {\n if (!query.index && this.indexName) {\n query.index = this.indexName;\n }\n\n query.body = query.body ?? {};\n query.body.size = !query.body.size || query.body.size > this.MAX_SIZE ? this.DEFAULT_SIZE : query.body.size;\n\n if (query.body.size > this.MAX_SIZE)\n log.warn(`Query size is too large: ${query.body.size}. Using default size: ${this.DEFAULT_SIZE}`);\n\n query.body.from = query.body.from ?? 0;\n\n return removeEmptyFields(query);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-es.repo.js","sourceRoot":"","sources":["../../src/repositories/base-es.repo.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAOkB;AAClB,mCAAiC;AACjC,sEAAkC;AAGlC,+EAA2E;AAGpE,IAAe,cAAc,GAA7B,MAAe,cAAc;IAC1B,YAAY,CAAmB;IAC/B,SAAS,CAAS;IACT,YAAY,GAAG,GAAG,CAAC;IACnB,QAAQ,GAAG,GAAG,CAAC;IAEhC,KAAK,CAAC,SAAS,CAAC,GAAa;QAC3B,MAAM,MAAM,GAAW,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,OAAO,MAAM,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAAc,EAAE,KAAe;QACxC,MAAM,KAAK,GAAG,IAAA,oBAAY,EAAC,MAAM,CAAC,CAAC;QAEnC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAE5C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CA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CAAC,OAAO,CAAC;iBAC3C,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,OAAO,GAAG,GAAG,CAAC;;gBAC3C,OAAO,GAAG,wBAAwB,CAAC;YAExC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAEO,YAAY,CAAC,KAAU;QAC7B,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;QAC/B,CAAC;QAED,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAE5G,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ;YACjC,GAAG,CAAC,IAAI,CAAC,4BAA4B,KAAK,CAAC,IAAI,CAAC,IAAI,yBAAyB,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAEpG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;QAEvC,OAAO,IAAA,yBAAiB,EAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACF,CAAA;;yBAxLqB,cAAc;IADnC,IAAA,gBAAO,EAAC,YAAY,CAAC;GACA,cAAc,CAwLnC","sourcesContent":["import {\n BaseRepoES,\n buildQueryOS,\n List,\n OpenSearchClient,\n removeEmptyFields,\n transformAggregationsResponse,\n} from \"../index\";\nimport { Service } from \"typedi\";\nimport esb from \"elastic-builder\";\nimport { BaseEntity, Filter } from \"@chinggis/types\";\nimport { API } from \"@opensearch-project/opensearch\";\nimport { resolveSortFields } from \"../utils/opensearch/opensearch.mapping\";\n\n@Service(\"BaseRepoES\")\nexport abstract class BaseRepoESImpl<T extends BaseEntity> implements BaseRepoES<T> {\n private searchClient: OpenSearchClient;\n private indexName: string;\n private readonly DEFAULT_SIZE = 100;\n private readonly MAX_SIZE = 250;\n\n async findByIds(ids: string[]): Promise<T[]> {\n const filter: Filter = { id: ids.join(\",\") };\n const result = await this.find(filter);\n return result.items;\n }\n\n async find(filter: Filter, debug?: boolean): Promise<List<T>> {\n const query = buildQueryOS(filter);\n\n const res = await this.search(query, debug);\n\n return { items: res?.items, total: res?.total };\n }\n\n async fieldNotExists(\n fieldName: string,\n from: number,\n size: number,\n includeFields?: string[],\n excludeFields?: string[],\n ): Promise<T[]> {\n const filter: Filter = {\n size,\n from,\n fieldsInclude: includeFields,\n fieldsExclude: excludeFields,\n };\n const query = buildQueryOS(filter);\n query.index = this.indexName;\n\n // Add field not exists filter using elastic-builder\n const boolQuery = esb.boolQuery().mustNot(esb.existsQuery(fieldName));\n query.body.query = boolQuery.toJSON();\n\n const res = await this.search(query);\n\n return res?.items;\n }\n\n async findOne(filter: Filter): Promise<T> {\n filter.size = 1;\n return this.find(filter).then((result) => result.items[0]);\n }\n\n async nativeQuery(query: any): Promise<API.Search_ResponseBody> {\n try {\n const res = await this.searchClient.search(query);\n return res?.body;\n } catch (err) {\n console.error(JSON.stringify(err, null, 2));\n return undefined;\n }\n }\n\n async count(query: any): Promise<number> {\n const finalQuery = this.prepareQuery(query);\n\n try {\n const res = await this.searchClient.count({\n index: finalQuery.index,\n body: {\n query: finalQuery?.body?.query?.bool\n ? finalQuery.body.query\n : {\n match_all: {},\n },\n },\n });\n\n return Number(res.body.count ?? 0);\n } catch (err) {\n console.error(JSON.stringify(err, null, 2));\n return 0;\n }\n }\n\n getRaw?(filter: Filter): Promise<any> {\n throw new Error(\"Method not implemented.\");\n }\n\n setIndexName(indexName: string): boolean {\n this.indexName = indexName;\n return true;\n }\n\n setEndpoint(node: string): boolean {\n this.searchClient = new OpenSearchClient(node);\n return true;\n }\n\n getEndpoint(): string {\n throw new Error(\"Method not implemented.\");\n }\n\n getIndexName(): string {\n return this.indexName;\n }\n\n async findById(id: string): Promise<T | undefined> {\n const result = await this.findByIds([id]);\n\n if (result.length > 1) console.warn(\"More than one entity found by id\", id);\n\n return result.length > 0 ? result.at(0) : undefined;\n }\n\n async findByIdFieldSelected(id: string, includeFields?: string[], excludeFields?: string[]): Promise<T | undefined> {\n const filter: Filter = {\n id,\n size: 10,\n from: 0,\n fieldsInclude: includeFields,\n fieldsExclude: excludeFields,\n };\n const query = buildQueryOS(filter);\n\n const result = await this.search(query);\n\n return result?.items?.length > 0 ? result.items.at(0) : undefined;\n }\n\n async exists(id: string): Promise<boolean> {\n return !!(await this.findById(id));\n }\n\n findBetween<K>(fieldName: string, fromValue: K, toValue: K, includeFields: string[]): Promise<T[]> {\n throw new Error(\"Method not implemented.\");\n }\n\n async search(query: any, debug?: boolean): Promise<{ items: T[]; aggs: Record<string, any>; total: number }> {\n debug = debug || process.env.ENV?.toLowerCase()?.trim() === \"dev\";\n const finalQuery = this.prepareQuery(query);\n\n if (debug) {\n log.info(\"searchQuery: \", JSON.stringify(finalQuery, null, 2));\n }\n\n if (finalQuery?.body?.sort?.length) {\n finalQuery.body.sort = await resolveSortFields(this.searchClient, finalQuery.index, finalQuery.body.sort);\n }\n\n try {\n const { body } = await this.searchClient.search(finalQuery);\n const totalRaw = body.hits.total;\n const totalCount = typeof totalRaw === \"number\" ? totalRaw : totalRaw.value;\n\n return {\n items: body?.hits?.hits?.map((item) => item._source as T) || [],\n aggs: body?.aggregations ? transformAggregationsResponse(body?.aggregations) : undefined,\n total: totalCount,\n };\n } catch (err) {\n console.error(\"searchES ERROR: \", err);\n\n let message: string;\n if (err instanceof Error) message = err.message;\n else if (typeof err === \"string\") message = err;\n else message = \"Unknown searchES error\";\n\n throw new Error(message);\n }\n }\n\n private prepareQuery(query: any): any {\n if (!query.index && this.indexName) {\n query.index = this.indexName;\n }\n\n query.body = query.body ?? {};\n query.body.size = !query.body.size || query.body.size > this.MAX_SIZE ? this.DEFAULT_SIZE : query.body.size;\n\n if (query.body.size > this.MAX_SIZE)\n log.warn(`Query size is too large: ${query.body.size}. Using default size: ${this.DEFAULT_SIZE}`);\n\n query.body.from = query.body.from ?? 0;\n\n return removeEmptyFields(query);\n }\n}\n"]}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./json.util";
|
|
|
13
13
|
export * from "./opensearch.utils";
|
|
14
14
|
export * from "./reflection.util";
|
|
15
15
|
export * from "./validation.util";
|
|
16
|
+
export * from "./opensearch/opensearch.mapping";
|
|
16
17
|
export * from "./opensearch/opensearch.parser";
|
|
17
18
|
export * from "./opensearch/opensearch.transform";
|
|
18
19
|
export * from "./data.util";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,aAAa,CAAC;AAE5B,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,aAAa,CAAC;AAE5B,cAAc,oBAAoB,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -29,6 +29,7 @@ __exportStar(require("./json.util"), exports);
|
|
|
29
29
|
__exportStar(require("./opensearch.utils"), exports);
|
|
30
30
|
__exportStar(require("./reflection.util"), exports);
|
|
31
31
|
__exportStar(require("./validation.util"), exports);
|
|
32
|
+
__exportStar(require("./opensearch/opensearch.mapping"), exports);
|
|
32
33
|
__exportStar(require("./opensearch/opensearch.parser"), exports);
|
|
33
34
|
__exportStar(require("./opensearch/opensearch.transform"), exports);
|
|
34
35
|
__exportStar(require("./data.util"), exports);
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,sDAAoC;AACpC,mDAAiC;AACjC,+CAA6B;AAC7B,8CAA4B;AAC5B,gDAA8B;AAC9B,qDAAmC;AACnC,8CAA4B;AAC5B,mDAAiC;AACjC,6CAA2B;AAC3B,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC;AACnC,oDAAkC;AAClC,oDAAkC;AAClC,iEAA+C;AAC/C,oEAAkD;AAClD,8CAA4B;AAE5B,qDAAmC","sourcesContent":["export * from \"./http/http.util\";\nexport * from \"./http/http-request\";\nexport * from \"./http/api-event\";\nexport * from \"./array.util\";\nexport * from \"./auth.util\";\nexport * from \"./auth/caller\";\nexport * from \"./auth/policy-view\";\nexport * from \"./date.util\";\nexport * from \"./dynamodb.utils\";\nexport * from \"./env.util\";\nexport * from \"./error.util\";\nexport * from \"./json.util\";\nexport * from \"./opensearch.utils\";\nexport * from \"./reflection.util\";\nexport * from \"./validation.util\";\nexport * from \"./opensearch/opensearch.parser\";\nexport * from \"./opensearch/opensearch.transform\";\nexport * from \"./data.util\";\n\nexport * from \"../function/logger\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,sDAAoC;AACpC,mDAAiC;AACjC,+CAA6B;AAC7B,8CAA4B;AAC5B,gDAA8B;AAC9B,qDAAmC;AACnC,8CAA4B;AAC5B,mDAAiC;AACjC,6CAA2B;AAC3B,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC;AACnC,oDAAkC;AAClC,oDAAkC;AAClC,kEAAgD;AAChD,iEAA+C;AAC/C,oEAAkD;AAClD,8CAA4B;AAE5B,qDAAmC","sourcesContent":["export * from \"./http/http.util\";\nexport * from \"./http/http-request\";\nexport * from \"./http/api-event\";\nexport * from \"./array.util\";\nexport * from \"./auth.util\";\nexport * from \"./auth/caller\";\nexport * from \"./auth/policy-view\";\nexport * from \"./date.util\";\nexport * from \"./dynamodb.utils\";\nexport * from \"./env.util\";\nexport * from \"./error.util\";\nexport * from \"./json.util\";\nexport * from \"./opensearch.utils\";\nexport * from \"./reflection.util\";\nexport * from \"./validation.util\";\nexport * from \"./opensearch/opensearch.mapping\";\nexport * from \"./opensearch/opensearch.parser\";\nexport * from \"./opensearch/opensearch.transform\";\nexport * from \"./data.util\";\n\nexport * from \"../function/logger\";\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type MappingNode = {
|
|
2
|
+
type?: string;
|
|
3
|
+
fields?: Record<string, {
|
|
4
|
+
type?: string;
|
|
5
|
+
}>;
|
|
6
|
+
properties?: Record<string, MappingNode>;
|
|
7
|
+
};
|
|
8
|
+
type MappingProperties = Record<string, MappingNode>;
|
|
9
|
+
type MappingClient = {
|
|
10
|
+
indices: {
|
|
11
|
+
getMapping: (params: {
|
|
12
|
+
index: string;
|
|
13
|
+
}) => Promise<any>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Rewrite sort entries that target an analysed `text` field onto its keyword sub-field.
|
|
18
|
+
*
|
|
19
|
+
* OpenSearch cannot sort on a `text` field (fielddata is disabled by default), so sorting on one
|
|
20
|
+
* fails the whole search. The correct target is decided from the index mapping rather than guessed:
|
|
21
|
+
* `keyword`, numeric and date fields are left alone, and an unknown field is left alone too, so a
|
|
22
|
+
* genuine mapping mistake still surfaces as a real error instead of being silently swallowed.
|
|
23
|
+
*/
|
|
24
|
+
export declare const applyKeywordSortFields: (sort: any[], properties: MappingProperties) => any[];
|
|
25
|
+
/**
|
|
26
|
+
* Resolve a query's sort fields against the live index mapping, caching the mapping per index.
|
|
27
|
+
*
|
|
28
|
+
* Fails open: if the mapping cannot be read the sort is returned untouched, so a mapping-service
|
|
29
|
+
* hiccup degrades to today's behaviour instead of breaking search.
|
|
30
|
+
*/
|
|
31
|
+
export declare const resolveSortFields: (client: MappingClient, index: string, sort: any[]) => Promise<any[]>;
|
|
32
|
+
/** Exposed for tests and for callers that rebuild an index. */
|
|
33
|
+
export declare const clearMappingCache: (index?: string) => void;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=opensearch.mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opensearch.mapping.d.ts","sourceRoot":"","sources":["../../../src/utils/opensearch/opensearch.mapping.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,GAAG;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CAC1C,CAAC;AAEF,KAAK,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAErD,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE;QAAE,UAAU,EAAE,CAAC,MAAM,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;KAAE,CAAC;CACtE,CAAC;AAyBF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,SAAU,GAAG,EAAE,cAAc,iBAAiB,KAAG,GAAG,EAetF,CAAC;AAYF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAkB,aAAa,SAAS,MAAM,QAAQ,GAAG,EAAE,KAAG,OAAO,CAAC,GAAG,EAAE,CAsBxG,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,IAGlD,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearMappingCache = exports.resolveSortFields = exports.applyKeywordSortFields = void 0;
|
|
4
|
+
const KEYWORD_SUFFIX = ".keyword";
|
|
5
|
+
/** One in-flight/resolved mapping lookup per index, for the lifetime of the container. */
|
|
6
|
+
const mappingCache = new Map();
|
|
7
|
+
/** Walk a dotted path such as `location.area` through nested `properties` blocks. */
|
|
8
|
+
const findMappingNode = (properties, path) => {
|
|
9
|
+
const segments = path.split(".");
|
|
10
|
+
let node = properties[segments[0]];
|
|
11
|
+
for (const segment of segments.slice(1)) {
|
|
12
|
+
if (!node?.properties)
|
|
13
|
+
return undefined;
|
|
14
|
+
node = node.properties[segment];
|
|
15
|
+
}
|
|
16
|
+
return node;
|
|
17
|
+
};
|
|
18
|
+
/** The name of a keyword sub-field, if this node is a text field that has one. */
|
|
19
|
+
const keywordSubField = (node) => {
|
|
20
|
+
if (node?.type !== "text" || !node.fields)
|
|
21
|
+
return undefined;
|
|
22
|
+
return Object.entries(node.fields).find(([, subField]) => subField?.type === "keyword")?.[0];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Rewrite sort entries that target an analysed `text` field onto its keyword sub-field.
|
|
26
|
+
*
|
|
27
|
+
* OpenSearch cannot sort on a `text` field (fielddata is disabled by default), so sorting on one
|
|
28
|
+
* fails the whole search. The correct target is decided from the index mapping rather than guessed:
|
|
29
|
+
* `keyword`, numeric and date fields are left alone, and an unknown field is left alone too, so a
|
|
30
|
+
* genuine mapping mistake still surfaces as a real error instead of being silently swallowed.
|
|
31
|
+
*/
|
|
32
|
+
const applyKeywordSortFields = (sort, properties) => {
|
|
33
|
+
if (!Array.isArray(sort) || sort.length === 0)
|
|
34
|
+
return [];
|
|
35
|
+
if (!properties)
|
|
36
|
+
return sort;
|
|
37
|
+
return sort.map((entry) => {
|
|
38
|
+
if (!entry || typeof entry !== "object")
|
|
39
|
+
return entry;
|
|
40
|
+
const [field, order] = Object.entries(entry)[0] ?? [];
|
|
41
|
+
if (typeof field !== "string" || field.endsWith(KEYWORD_SUFFIX))
|
|
42
|
+
return entry;
|
|
43
|
+
const subField = keywordSubField(findMappingNode(properties, field));
|
|
44
|
+
if (!subField)
|
|
45
|
+
return entry;
|
|
46
|
+
return { [`${field}.${subField}`]: order };
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
exports.applyKeywordSortFields = applyKeywordSortFields;
|
|
50
|
+
const readMappingProperties = async (client, index) => {
|
|
51
|
+
const response = await client.indices.getMapping({ index });
|
|
52
|
+
const body = response?.body ?? response;
|
|
53
|
+
// getMapping is keyed by concrete index name, which may differ from the alias we asked for.
|
|
54
|
+
const indexBlock = body?.[index] ?? Object.values(body ?? {})[0];
|
|
55
|
+
return indexBlock?.mappings?.properties;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Resolve a query's sort fields against the live index mapping, caching the mapping per index.
|
|
59
|
+
*
|
|
60
|
+
* Fails open: if the mapping cannot be read the sort is returned untouched, so a mapping-service
|
|
61
|
+
* hiccup degrades to today's behaviour instead of breaking search.
|
|
62
|
+
*/
|
|
63
|
+
const resolveSortFields = async (client, index, sort) => {
|
|
64
|
+
if (!Array.isArray(sort) || sort.length === 0)
|
|
65
|
+
return sort;
|
|
66
|
+
if (!client?.indices?.getMapping || !index)
|
|
67
|
+
return sort;
|
|
68
|
+
try {
|
|
69
|
+
let pending = mappingCache.get(index);
|
|
70
|
+
if (!pending) {
|
|
71
|
+
pending = readMappingProperties(client, index).catch((err) => {
|
|
72
|
+
mappingCache.delete(index); // a failed lookup must not be cached forever
|
|
73
|
+
throw err;
|
|
74
|
+
});
|
|
75
|
+
mappingCache.set(index, pending);
|
|
76
|
+
}
|
|
77
|
+
const properties = await pending;
|
|
78
|
+
if (!properties)
|
|
79
|
+
return sort;
|
|
80
|
+
return (0, exports.applyKeywordSortFields)(sort, properties);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return sort;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.resolveSortFields = resolveSortFields;
|
|
87
|
+
/** Exposed for tests and for callers that rebuild an index. */
|
|
88
|
+
const clearMappingCache = (index) => {
|
|
89
|
+
if (index)
|
|
90
|
+
mappingCache.delete(index);
|
|
91
|
+
else
|
|
92
|
+
mappingCache.clear();
|
|
93
|
+
};
|
|
94
|
+
exports.clearMappingCache = clearMappingCache;
|
|
95
|
+
//# sourceMappingURL=opensearch.mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opensearch.map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}>;\n properties?: Record<string, MappingNode>;\n};\n\ntype MappingProperties = Record<string, MappingNode>;\n\ntype MappingClient = {\n indices: { getMapping: (params: { index: string }) => Promise<any> };\n};\n\n/** One in-flight/resolved mapping lookup per index, for the lifetime of the container. */\nconst mappingCache = new Map<string, Promise<MappingProperties | undefined>>();\n\n/** Walk a dotted path such as `location.area` through nested `properties` blocks. */\nconst findMappingNode = (properties: MappingProperties, path: string): MappingNode | undefined => {\n const segments = path.split(\".\");\n let node: MappingNode | undefined = properties[segments[0]];\n\n for (const segment of segments.slice(1)) {\n if (!node?.properties) return undefined;\n node = node.properties[segment];\n }\n\n return node;\n};\n\n/** The name of a keyword sub-field, if this node is a text field that has one. */\nconst keywordSubField = (node: MappingNode | undefined): string | undefined => {\n if (node?.type !== \"text\" || !node.fields) return undefined;\n\n return Object.entries(node.fields).find(([, subField]) => subField?.type === \"keyword\")?.[0];\n};\n\n/**\n * Rewrite sort entries that target an analysed `text` field onto its keyword sub-field.\n *\n * OpenSearch cannot sort on a `text` field (fielddata is disabled by default), so sorting on one\n * fails the whole search. The correct target is decided from the index mapping rather than guessed:\n * `keyword`, numeric and date fields are left alone, and an unknown field is left alone too, so a\n * genuine mapping mistake still surfaces as a real error instead of being silently swallowed.\n */\nexport const applyKeywordSortFields = (sort: any[], properties: MappingProperties): any[] => {\n if (!Array.isArray(sort) || sort.length === 0) return [];\n if (!properties) return sort;\n\n return sort.map((entry) => {\n if (!entry || typeof entry !== \"object\") return entry;\n\n const [field, order] = Object.entries(entry)[0] ?? [];\n if (typeof field !== \"string\" || field.endsWith(KEYWORD_SUFFIX)) return entry;\n\n const subField = keywordSubField(findMappingNode(properties, field));\n if (!subField) return entry;\n\n return { [`${field}.${subField}`]: order };\n });\n};\n\nconst readMappingProperties = async (client: MappingClient, index: string): Promise<MappingProperties | undefined> => {\n const response = await client.indices.getMapping({ index });\n const body = response?.body ?? response;\n\n // getMapping is keyed by concrete index name, which may differ from the alias we asked for.\n const indexBlock = body?.[index] ?? Object.values(body ?? {})[0];\n\n return (indexBlock as any)?.mappings?.properties;\n};\n\n/**\n * Resolve a query's sort fields against the live index mapping, caching the mapping per index.\n *\n * Fails open: if the mapping cannot be read the sort is returned untouched, so a mapping-service\n * hiccup degrades to today's behaviour instead of breaking search.\n */\nexport const resolveSortFields = async (client: MappingClient, index: string, sort: any[]): Promise<any[]> => {\n if (!Array.isArray(sort) || sort.length === 0) return sort;\n if (!client?.indices?.getMapping || !index) return sort;\n\n try {\n let pending = mappingCache.get(index);\n\n if (!pending) {\n pending = readMappingProperties(client, index).catch((err) => {\n mappingCache.delete(index); // a failed lookup must not be cached forever\n throw err;\n });\n mappingCache.set(index, pending);\n }\n\n const properties = await pending;\n if (!properties) return sort;\n\n return applyKeywordSortFields(sort, properties);\n } catch {\n return sort;\n }\n};\n\n/** Exposed for tests and for callers that rebuild an index. */\nexport const clearMappingCache = (index?: string): void => {\n if (index) mappingCache.delete(index);\n else mappingCache.clear();\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aws-service-stack",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.450",
|
|
4
4
|
"packageManager": "pnpm@10.33.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
18
|
+
"node": ">=24"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"check": "tsc --noEmit",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"reflect-metadata": "^0.2.2"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@aws-sdk/client-apigatewaymanagementapi": "^3.
|
|
37
|
-
"@aws-sdk/client-cognito-identity-provider": "^3.
|
|
38
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
39
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
40
|
-
"@aws-sdk/credential-provider-node": "^3.972.
|
|
41
|
-
"@aws-sdk/lib-dynamodb": "^3.
|
|
36
|
+
"@aws-sdk/client-apigatewaymanagementapi": "^3.1167.0",
|
|
37
|
+
"@aws-sdk/client-cognito-identity-provider": "^3.1167.0",
|
|
38
|
+
"@aws-sdk/client-dynamodb": "^3.1167.0",
|
|
39
|
+
"@aws-sdk/client-secrets-manager": "^3.1167.0",
|
|
40
|
+
"@aws-sdk/credential-provider-node": "^3.972.97",
|
|
41
|
+
"@aws-sdk/lib-dynamodb": "^3.1167.0",
|
|
42
42
|
"@aws-sdk/util-dynamodb": "^3.996.9",
|
|
43
|
-
"@opensearch-project/opensearch": "^3.
|
|
44
|
-
"axios": "^1.
|
|
45
|
-
"dayjs": "^1.11.
|
|
43
|
+
"@opensearch-project/opensearch": "^3.10.0",
|
|
44
|
+
"axios": "^1.21.1",
|
|
45
|
+
"dayjs": "^1.11.23",
|
|
46
46
|
"typedi": "0.10.0",
|
|
47
47
|
"yup": "^1.7.1",
|
|
48
|
-
"zod": "^4.
|
|
48
|
+
"zod": "^4.6.7"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"@aws-sdk/client-apigatewaymanagementapi": {
|
|
@@ -89,27 +89,27 @@
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@aws-sdk/client-apigatewaymanagementapi": "^3.
|
|
93
|
-
"@aws-sdk/client-cognito-identity-provider": "^3.
|
|
94
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
95
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
96
|
-
"@aws-sdk/credential-provider-node": "^3.972.
|
|
97
|
-
"@aws-sdk/lib-dynamodb": "^3.
|
|
92
|
+
"@aws-sdk/client-apigatewaymanagementapi": "^3.1167.0",
|
|
93
|
+
"@aws-sdk/client-cognito-identity-provider": "^3.1167.0",
|
|
94
|
+
"@aws-sdk/client-dynamodb": "^3.1167.0",
|
|
95
|
+
"@aws-sdk/client-secrets-manager": "^3.1167.0",
|
|
96
|
+
"@aws-sdk/credential-provider-node": "^3.972.97",
|
|
97
|
+
"@aws-sdk/lib-dynamodb": "^3.1167.0",
|
|
98
98
|
"@aws-sdk/util-dynamodb": "^3.996.9",
|
|
99
|
-
"@biomejs/biome": "^2.
|
|
100
|
-
"@opensearch-project/opensearch": "^3.
|
|
101
|
-
"@types/aws-lambda": "^8.10.
|
|
102
|
-
"@types/node": "^
|
|
103
|
-
"@vitest/coverage-v8": "^
|
|
104
|
-
"axios": "^1.
|
|
105
|
-
"dayjs": "^1.11.
|
|
99
|
+
"@biomejs/biome": "^2.6.7",
|
|
100
|
+
"@opensearch-project/opensearch": "^3.10.0",
|
|
101
|
+
"@types/aws-lambda": "^8.10.164",
|
|
102
|
+
"@types/node": "^24.19.2",
|
|
103
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
104
|
+
"axios": "^1.21.1",
|
|
105
|
+
"dayjs": "^1.11.23",
|
|
106
106
|
"ts-node": "^10.9.2",
|
|
107
|
-
"tsc-alias": "^1.9.
|
|
107
|
+
"tsc-alias": "^1.9.10",
|
|
108
108
|
"typedi": "0.10.0",
|
|
109
109
|
"typescript": "^7.0.2",
|
|
110
110
|
"typescript-transform-paths": "^4.0.0",
|
|
111
|
-
"vitest": "^
|
|
111
|
+
"vitest": "^5.1.0",
|
|
112
112
|
"yup": "^1.7.1",
|
|
113
|
-
"zod": "^4.
|
|
113
|
+
"zod": "^4.6.7"
|
|
114
114
|
}
|
|
115
115
|
}
|