@exabugs/dynamodb-client 1.4.10 → 1.4.12
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 +85 -31
- package/dist/server/handler.cjs.map +3 -3
- package/dist/server/operations/find/idQuery.d.ts.map +1 -1
- package/dist/server/operations/find/idQuery.js +48 -0
- package/dist/server/operations/find/idQuery.js.map +1 -1
- package/dist/server/operations/find/nearQuery.d.ts.map +1 -1
- package/dist/server/operations/find/nearQuery.js +24 -16
- package/dist/server/operations/find/nearQuery.js.map +1 -1
- package/package.json +1 -1
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.12
|
|
2
|
+
// Built: 2026-04-08T13:55:48.590Z
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -28198,7 +28198,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
28198
28198
|
return async () => handler2(this.clientCommand);
|
|
28199
28199
|
}
|
|
28200
28200
|
};
|
|
28201
|
-
var
|
|
28201
|
+
var BatchGetCommand7 = class extends DynamoDBDocumentClientCommand {
|
|
28202
28202
|
static {
|
|
28203
28203
|
__name(this, "BatchGetCommand");
|
|
28204
28204
|
}
|
|
@@ -28701,7 +28701,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
28701
28701
|
}
|
|
28702
28702
|
}
|
|
28703
28703
|
batchGet(args, optionsOrCb, cb) {
|
|
28704
|
-
const command = new
|
|
28704
|
+
const command = new BatchGetCommand7(args);
|
|
28705
28705
|
if (typeof optionsOrCb === "function") {
|
|
28706
28706
|
this.send(command, optionsOrCb);
|
|
28707
28707
|
} else if (typeof cb === "function") {
|
|
@@ -28878,7 +28878,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
28878
28878
|
}, "get")
|
|
28879
28879
|
});
|
|
28880
28880
|
exports2.BatchExecuteStatementCommand = BatchExecuteStatementCommand;
|
|
28881
|
-
exports2.BatchGetCommand =
|
|
28881
|
+
exports2.BatchGetCommand = BatchGetCommand7;
|
|
28882
28882
|
exports2.BatchWriteCommand = BatchWriteCommand;
|
|
28883
28883
|
exports2.DeleteCommand = DeleteCommand;
|
|
28884
28884
|
exports2.DynamoDBDocument = DynamoDBDocument;
|
|
@@ -30567,6 +30567,9 @@ async function executeIdQuery(resource, normalizedParams, requestId) {
|
|
|
30567
30567
|
if (idFilter && idFilter.parsed.operator === "$eq") {
|
|
30568
30568
|
return await executeSpecificIdQuery(resource, String(idFilter.value), requestId);
|
|
30569
30569
|
}
|
|
30570
|
+
if (idFilter && idFilter.parsed.operator === "$in" && Array.isArray(idFilter.value)) {
|
|
30571
|
+
return await executeInQuery(resource, idFilter.value.map(String), sort, requestId);
|
|
30572
|
+
}
|
|
30570
30573
|
return await executeAllRecordsQuery(resource, sort, perPage, nextToken, parsedFilters, requestId);
|
|
30571
30574
|
}
|
|
30572
30575
|
async function executeSpecificIdQuery(resource, targetId, requestId) {
|
|
@@ -30606,6 +30609,53 @@ async function executeSpecificIdQuery(resource, targetId, requestId) {
|
|
|
30606
30609
|
consumedCapacity: costTracker.getAggregated()
|
|
30607
30610
|
};
|
|
30608
30611
|
}
|
|
30612
|
+
async function executeInQuery(resource, targetIds, sort, requestId) {
|
|
30613
|
+
const dbClient2 = getDBClient();
|
|
30614
|
+
const tableName = getTableName();
|
|
30615
|
+
const costTracker = new CostTracker();
|
|
30616
|
+
const results = await Promise.all(
|
|
30617
|
+
targetIds.map(
|
|
30618
|
+
(id) => executeDynamoDBOperation(
|
|
30619
|
+
() => dbClient2.send(
|
|
30620
|
+
new import_lib_dynamodb2.QueryCommand({
|
|
30621
|
+
TableName: tableName,
|
|
30622
|
+
KeyConditionExpression: "PK = :pk AND SK = :sk",
|
|
30623
|
+
ExpressionAttributeValues: {
|
|
30624
|
+
":pk": resource,
|
|
30625
|
+
":sk": `id#${id}`
|
|
30626
|
+
},
|
|
30627
|
+
ConsistentRead: true,
|
|
30628
|
+
ReturnConsumedCapacity: "TOTAL"
|
|
30629
|
+
})
|
|
30630
|
+
),
|
|
30631
|
+
"Query"
|
|
30632
|
+
).then((result) => {
|
|
30633
|
+
costTracker.add(result.ConsumedCapacity);
|
|
30634
|
+
return result.Items || [];
|
|
30635
|
+
})
|
|
30636
|
+
)
|
|
30637
|
+
);
|
|
30638
|
+
let items = results.flat().map((item) => extractCleanRecord(item));
|
|
30639
|
+
items.sort((a4, b4) => {
|
|
30640
|
+
const aVal = String(a4.id ?? "");
|
|
30641
|
+
const bVal = String(b4.id ?? "");
|
|
30642
|
+
return sort.order === "ASC" ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);
|
|
30643
|
+
});
|
|
30644
|
+
logger6.info("ID $in query succeeded", {
|
|
30645
|
+
requestId,
|
|
30646
|
+
resource,
|
|
30647
|
+
requestedCount: targetIds.length,
|
|
30648
|
+
foundCount: items.length
|
|
30649
|
+
});
|
|
30650
|
+
return {
|
|
30651
|
+
items,
|
|
30652
|
+
pageInfo: {
|
|
30653
|
+
hasNextPage: false,
|
|
30654
|
+
hasPreviousPage: false
|
|
30655
|
+
},
|
|
30656
|
+
consumedCapacity: costTracker.getAggregated()
|
|
30657
|
+
};
|
|
30658
|
+
}
|
|
30609
30659
|
async function executeAllRecordsQuery(resource, sort, perPage, nextToken, parsedFilters, requestId) {
|
|
30610
30660
|
const dbClient2 = getDBClient();
|
|
30611
30661
|
const tableName = getTableName();
|
|
@@ -30689,6 +30739,7 @@ var init_idQuery = __esm({
|
|
|
30689
30739
|
});
|
|
30690
30740
|
__name(executeIdQuery, "executeIdQuery");
|
|
30691
30741
|
__name(executeSpecificIdQuery, "executeSpecificIdQuery");
|
|
30742
|
+
__name(executeInQuery, "executeInQuery");
|
|
30692
30743
|
__name(executeAllRecordsQuery, "executeAllRecordsQuery");
|
|
30693
30744
|
}
|
|
30694
30745
|
});
|
|
@@ -30748,31 +30799,34 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
|
|
|
30748
30799
|
geohashPrefix,
|
|
30749
30800
|
ids: mainRecordIds
|
|
30750
30801
|
});
|
|
30751
|
-
const
|
|
30752
|
-
|
|
30753
|
-
|
|
30754
|
-
|
|
30755
|
-
|
|
30756
|
-
|
|
30757
|
-
|
|
30758
|
-
|
|
30759
|
-
|
|
30760
|
-
|
|
30761
|
-
|
|
30762
|
-
|
|
30763
|
-
|
|
30764
|
-
|
|
30765
|
-
|
|
30766
|
-
|
|
30767
|
-
|
|
30768
|
-
|
|
30769
|
-
|
|
30770
|
-
|
|
30771
|
-
|
|
30772
|
-
|
|
30773
|
-
|
|
30774
|
-
|
|
30775
|
-
|
|
30802
|
+
const BATCH_SIZE = 100;
|
|
30803
|
+
const validRecords = [];
|
|
30804
|
+
for (let i4 = 0; i4 < mainRecordIds.length; i4 += BATCH_SIZE) {
|
|
30805
|
+
const chunk = mainRecordIds.slice(i4, i4 + BATCH_SIZE);
|
|
30806
|
+
const batchGetResult = await executeDynamoDBOperation(
|
|
30807
|
+
() => dbClient2.send(
|
|
30808
|
+
new import_lib_dynamodb3.BatchGetCommand({
|
|
30809
|
+
RequestItems: {
|
|
30810
|
+
[tableName]: {
|
|
30811
|
+
Keys: chunk.map((id) => ({
|
|
30812
|
+
PK: resource,
|
|
30813
|
+
SK: `id#${id}`
|
|
30814
|
+
})),
|
|
30815
|
+
ConsistentRead: false
|
|
30816
|
+
}
|
|
30817
|
+
},
|
|
30818
|
+
ReturnConsumedCapacity: "TOTAL"
|
|
30819
|
+
})
|
|
30820
|
+
),
|
|
30821
|
+
"BatchGetItem"
|
|
30822
|
+
);
|
|
30823
|
+
if (batchGetResult.ConsumedCapacity) {
|
|
30824
|
+
for (const capacity of batchGetResult.ConsumedCapacity) {
|
|
30825
|
+
costTracker.add(capacity);
|
|
30826
|
+
}
|
|
30827
|
+
}
|
|
30828
|
+
validRecords.push(...batchGetResult.Responses?.[tableName] || []);
|
|
30829
|
+
}
|
|
30776
30830
|
logger7.debug("Main records retrieved", {
|
|
30777
30831
|
requestId,
|
|
30778
30832
|
resource,
|
|
@@ -34500,7 +34554,7 @@ async function handler(event) {
|
|
|
34500
34554
|
return createCorsResponse(HTTP_STATUS.OK);
|
|
34501
34555
|
}
|
|
34502
34556
|
if (event.requestContext.http.method === "GET" && event.requestContext.http.path === "/version") {
|
|
34503
|
-
const version = "1.4.
|
|
34557
|
+
const version = "1.4.12";
|
|
34504
34558
|
return createSuccessResponse({ version, timestamp: (/* @__PURE__ */ new Date()).toISOString() }, requestId);
|
|
34505
34559
|
}
|
|
34506
34560
|
if (event.requestContext.http.method !== "POST") {
|