@exabugs/dynamodb-client 1.3.34 → 1.3.35
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/CHANGELOG.md +12 -0
- package/dist/server/handler.cjs +69 -38
- package/dist/server/handler.cjs.map +2 -2
- package/dist/server/operations/findOne.d.ts +4 -2
- package/dist/server/operations/findOne.d.ts.map +1 -1
- package/dist/server/operations/findOne.js +63 -33
- package/dist/server/operations/findOne.js.map +1 -1
- package/dist/server/operations/parameterConverter.d.ts +1 -1
- package/dist/server/operations/parameterConverter.d.ts.map +1 -1
- package/dist/server/operations/parameterConverter.js +12 -5
- package/dist/server/operations/parameterConverter.js.map +1 -1
- package/dist/server/types.d.ts +4 -2
- package/dist/server/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.3.35] - 2026-01-08
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **findOneのfilter対応**: `findOne`操作が任意のフィールドでの検索をサポート
|
|
15
|
+
- `findOne({ token: 'xxx' })`が正しく動作するように修正
|
|
16
|
+
- `convertFindOneParams`が`filter.id`以外のフィールドを受け入れるように修正
|
|
17
|
+
- `handleFindOne`が`filter`パラメータをサポート(`find`操作で検索して最初の結果を返す)
|
|
18
|
+
- `filter.id`が存在する場合は従来通りGetItemで取得(後方互換性)
|
|
19
|
+
- `filter`が指定された場合は`find`操作で検索(新しいfilter対応)
|
|
20
|
+
- デバイス登録時の既存デバイスチェック(`findOne({ token })`)が正しく動作
|
|
21
|
+
|
|
10
22
|
## [1.3.34] - 2026-01-08
|
|
11
23
|
|
|
12
24
|
### Fixed
|
package/dist/server/handler.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @exabugs/dynamodb-client v1.3.
|
|
2
|
-
// Built: 2026-01-08T13:
|
|
1
|
+
// @exabugs/dynamodb-client v1.3.35
|
|
2
|
+
// Built: 2026-01-08T13:48:58.427Z
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -32281,40 +32281,68 @@ var import_lib_dynamodb9 = __toESM(require_dist_cjs66(), 1);
|
|
|
32281
32281
|
init_shared();
|
|
32282
32282
|
init_shadow();
|
|
32283
32283
|
init_dynamodb3();
|
|
32284
|
+
init_find();
|
|
32284
32285
|
var logger14 = createLogger({ service: "records-lambda" });
|
|
32285
32286
|
async function handleFindOne(resource, params, requestId) {
|
|
32286
|
-
const { id } = params;
|
|
32287
|
-
|
|
32288
|
-
|
|
32289
|
-
|
|
32290
|
-
|
|
32291
|
-
|
|
32292
|
-
|
|
32293
|
-
|
|
32294
|
-
|
|
32295
|
-
|
|
32296
|
-
|
|
32297
|
-
|
|
32298
|
-
|
|
32299
|
-
|
|
32300
|
-
|
|
32301
|
-
|
|
32302
|
-
|
|
32303
|
-
|
|
32304
|
-
|
|
32305
|
-
|
|
32306
|
-
|
|
32307
|
-
|
|
32308
|
-
|
|
32309
|
-
|
|
32287
|
+
const { id, filter } = params;
|
|
32288
|
+
if (id) {
|
|
32289
|
+
logger14.debug("Executing findOne by id", {
|
|
32290
|
+
requestId,
|
|
32291
|
+
resource,
|
|
32292
|
+
id
|
|
32293
|
+
});
|
|
32294
|
+
const dbClient2 = getDBClient();
|
|
32295
|
+
const tableName = getTableName();
|
|
32296
|
+
const sk = generateMainRecordSK2(id);
|
|
32297
|
+
const result = await executeDynamoDBOperation(
|
|
32298
|
+
() => dbClient2.send(
|
|
32299
|
+
new import_lib_dynamodb9.GetCommand({
|
|
32300
|
+
TableName: tableName,
|
|
32301
|
+
Key: {
|
|
32302
|
+
PK: resource,
|
|
32303
|
+
SK: sk
|
|
32304
|
+
},
|
|
32305
|
+
ConsistentRead: true
|
|
32306
|
+
})
|
|
32307
|
+
),
|
|
32308
|
+
"GetItem"
|
|
32309
|
+
);
|
|
32310
|
+
if (!result.Item) {
|
|
32311
|
+
throw new ItemNotFoundError(`Record not found: ${id}`, { resource, id });
|
|
32312
|
+
}
|
|
32313
|
+
const record = extractCleanRecord(result.Item);
|
|
32314
|
+
logger14.info("findOne by id succeeded", {
|
|
32315
|
+
requestId,
|
|
32316
|
+
resource,
|
|
32317
|
+
id
|
|
32318
|
+
});
|
|
32319
|
+
return record;
|
|
32310
32320
|
}
|
|
32311
|
-
|
|
32312
|
-
|
|
32313
|
-
|
|
32314
|
-
|
|
32315
|
-
|
|
32316
|
-
|
|
32317
|
-
|
|
32321
|
+
if (filter) {
|
|
32322
|
+
logger14.debug("Executing findOne by filter", {
|
|
32323
|
+
requestId,
|
|
32324
|
+
resource,
|
|
32325
|
+
filter
|
|
32326
|
+
});
|
|
32327
|
+
const findResult = await handleFind(
|
|
32328
|
+
resource,
|
|
32329
|
+
{
|
|
32330
|
+
filter,
|
|
32331
|
+
pagination: { perPage: 1 }
|
|
32332
|
+
},
|
|
32333
|
+
requestId
|
|
32334
|
+
);
|
|
32335
|
+
if (!findResult.items || findResult.items.length === 0) {
|
|
32336
|
+
throw new ItemNotFoundError(`Record not found with filter`, { resource, filter });
|
|
32337
|
+
}
|
|
32338
|
+
logger14.info("findOne by filter succeeded", {
|
|
32339
|
+
requestId,
|
|
32340
|
+
resource,
|
|
32341
|
+
filter
|
|
32342
|
+
});
|
|
32343
|
+
return findResult.items[0];
|
|
32344
|
+
}
|
|
32345
|
+
throw new Error("findOne requires either id or filter");
|
|
32318
32346
|
}
|
|
32319
32347
|
__name(handleFindOne, "handleFindOne");
|
|
32320
32348
|
|
|
@@ -33219,11 +33247,14 @@ function convertFindParams(mongoParams) {
|
|
|
33219
33247
|
}
|
|
33220
33248
|
__name(convertFindParams, "convertFindParams");
|
|
33221
33249
|
function convertFindOneParams(mongoParams) {
|
|
33222
|
-
|
|
33223
|
-
|
|
33224
|
-
throw new Error("findOne requires filter.id");
|
|
33250
|
+
if (!mongoParams.filter) {
|
|
33251
|
+
throw new Error("findOne requires filter");
|
|
33225
33252
|
}
|
|
33226
|
-
|
|
33253
|
+
const id = typeof mongoParams.filter.id === "string" ? mongoParams.filter.id : void 0;
|
|
33254
|
+
if (id) {
|
|
33255
|
+
return { id };
|
|
33256
|
+
}
|
|
33257
|
+
return { filter: mongoParams.filter };
|
|
33227
33258
|
}
|
|
33228
33259
|
__name(convertFindOneParams, "convertFindOneParams");
|
|
33229
33260
|
function convertFindManyParams(mongoParams) {
|
|
@@ -34807,7 +34838,7 @@ async function handler(event) {
|
|
|
34807
34838
|
return createCorsResponse(HTTP_STATUS.OK);
|
|
34808
34839
|
}
|
|
34809
34840
|
if (event.requestContext.http.method === "GET" && event.requestContext.http.path === "/version") {
|
|
34810
|
-
const version = "1.3.
|
|
34841
|
+
const version = "1.3.35";
|
|
34811
34842
|
return createSuccessResponse({ version, timestamp: (/* @__PURE__ */ new Date()).toISOString() }, requestId);
|
|
34812
34843
|
}
|
|
34813
34844
|
if (event.requestContext.http.method !== "POST") {
|