@exabugs/dynamodb-client 1.4.6 → 1.4.8
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/server/handler.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @exabugs/dynamodb-client v1.4.
|
|
2
|
-
// Built: 2026-04-
|
|
1
|
+
// @exabugs/dynamodb-client v1.4.8
|
|
2
|
+
// Built: 2026-04-05T11:02:55.391Z
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -30817,7 +30817,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
30817
30817
|
const { sort, pagination, parsedFilters } = normalizedParams;
|
|
30818
30818
|
const { perPage, nextToken } = pagination;
|
|
30819
30819
|
const costTracker = new CostTracker();
|
|
30820
|
-
const filterFirstCandidate = selectFilterFirstCandidate(parsedFilters, sort.field, normalizedParams.schema);
|
|
30820
|
+
const filterFirstCandidate = selectFilterFirstCandidate(parsedFilters, sort.field, normalizedParams.schema, perPage);
|
|
30821
30821
|
const isFilterFirst = filterFirstCandidate !== void 0;
|
|
30822
30822
|
const querySort = isFilterFirst ? { field: filterFirstCandidate.parsed.field, order: "ASC" } : sort;
|
|
30823
30823
|
const optimizableFilter = isFilterFirst ? filterFirstCandidate : findOptimizableFilter(sort.field, parsedFilters);
|
|
@@ -30893,7 +30893,7 @@ async function executeShadowQuery(resource, normalizedParams, requestId) {
|
|
|
30893
30893
|
consumedCapacity: costTracker.getAggregated()
|
|
30894
30894
|
};
|
|
30895
30895
|
}
|
|
30896
|
-
function selectFilterFirstCandidate(parsedFilters, sortField, schema) {
|
|
30896
|
+
function selectFilterFirstCandidate(parsedFilters, sortField, schema, perPage) {
|
|
30897
30897
|
const eqFilters = parsedFilters.filter(
|
|
30898
30898
|
(f4) => f4.parsed.operator === "$eq" && f4.parsed.field !== sortField
|
|
30899
30899
|
);
|
|
@@ -30902,7 +30902,8 @@ function selectFilterFirstCandidate(parsedFilters, sortField, schema) {
|
|
|
30902
30902
|
if (!cardinality) {
|
|
30903
30903
|
return eqFilters[0];
|
|
30904
30904
|
}
|
|
30905
|
-
const
|
|
30905
|
+
const threshold = perPage / 2;
|
|
30906
|
+
const scored = eqFilters.map((f4) => ({ f: f4, score: cardinality[f4.parsed.field] ?? 0 })).filter(({ score }) => score > threshold).sort((a4, b4) => b4.score - a4.score);
|
|
30906
30907
|
return scored[0]?.f;
|
|
30907
30908
|
}
|
|
30908
30909
|
function sortInMemory(items, sort) {
|
|
@@ -34400,7 +34401,7 @@ async function handler(event) {
|
|
|
34400
34401
|
return createCorsResponse(HTTP_STATUS.OK);
|
|
34401
34402
|
}
|
|
34402
34403
|
if (event.requestContext.http.method === "GET" && event.requestContext.http.path === "/version") {
|
|
34403
|
-
const version = "1.4.
|
|
34404
|
+
const version = "1.4.8";
|
|
34404
34405
|
return createSuccessResponse({ version, timestamp: (/* @__PURE__ */ new Date()).toISOString() }, requestId);
|
|
34405
34406
|
}
|
|
34406
34407
|
if (event.requestContext.http.method !== "POST") {
|