@exabugs/dynamodb-client 1.3.6 → 1.3.11

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 CHANGED
@@ -7,6 +7,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.3.11] - 2026-01-02
11
+
12
+ ### Fixed
13
+
14
+ - テストコードのモック設定を修正: removeShadowKeysをエクスポートに追加
15
+
16
+ ## [1.3.10] - 2026-01-02
17
+
18
+ ### Fixed
19
+
20
+ - **重要**: nearQuery.tsでextractCleanRecordの誤用を修正
21
+ - searchFunctionが返すレコードは既にクリーンな形式(data属性なし)
22
+ - extractCleanRecordではなくremoveShadowKeysを使用するように修正
23
+ - これにより、$near検索で0件が返される問題を解決
24
+
25
+ ## [1.3.9] - 2026-01-02
26
+
27
+ ### Added
28
+
29
+ - 自動テストケースを追加: DynamoDBレコード構造でのlocationフィールド取得テスト
30
+ - 自動テストケースを追加: DynamoDB内部フィールド(PK, SK)が含まれる場合のテスト
31
+
32
+ ### Fixed
33
+
34
+ - nearSearch.tsのデバッグログを改善: locationフィールドが見つからない場合の詳細ログ
35
+ - nearSearch.tsのデバッグログを改善: 距離計算結果とフィルタリング判定のログ
36
+
37
+ ## [1.3.8] - 2026-01-02
38
+
39
+ ### Fixed
40
+
41
+ - $nearクエリのデバッグログを追加(locationフィールドと距離計算の詳細)
42
+
43
+ ## [1.3.7] - 2026-01-02
44
+
45
+ ### Fixed
46
+
47
+ - **$nearクエリのシャドーレコード検索**: SKプレフィックスパターンを修正
48
+ - 修正前: `${fieldName}#${geohashPrefix}` → 修正後: `${fieldName}#${geohashPrefix}#id#`
49
+ - シャドーレコードのSKパターン `location#<geohash>#id#<venue-id>` に正しく対応
50
+ - これにより、$nearクエリが正常に動作し、距離順にソートされた開催地一覧を取得可能に
51
+
52
+ ### Added
53
+
54
+ - **$nearクエリのデバッグログ**: 各ステップでログを出力して問題追跡を容易に
55
+ - シャドーレコード検索時のSKプレフィックスをログ出力
56
+ - 検索結果の件数をログ出力
57
+ - 本体レコード取得時のIDリストをログ出力
58
+
10
59
  ## [1.3.6] - 2026-01-02
11
60
 
12
61
  ### Fixed
@@ -1,5 +1,5 @@
1
- // @exabugs/dynamodb-client v1.3.6
2
- // Built: 2026-01-02T13:03:16.100Z
1
+ // @exabugs/dynamodb-client v1.3.11
2
+ // Built: 2026-01-02T14:15:20.621Z
3
3
  "use strict";
4
4
  var __create = Object.create;
5
5
  var __defProp = Object.defineProperty;
@@ -30125,6 +30125,13 @@ async function executeNearSearch(nearQuery, fieldName, limit, searchFunction, co
30125
30125
  }
30126
30126
  const documentsWithDistance = allCandidates.map((doc) => {
30127
30127
  const location = doc[fieldName];
30128
+ if (!location) {
30129
+ console.log("[nearSearch] Location field not found:", {
30130
+ fieldName,
30131
+ docKeys: Object.keys(doc),
30132
+ doc: JSON.stringify(doc).substring(0, 200)
30133
+ });
30134
+ }
30128
30135
  if (!location || typeof location.latitude !== "number" || typeof location.longitude !== "number") {
30129
30136
  return null;
30130
30137
  }
@@ -30134,6 +30141,13 @@ async function executeNearSearch(nearQuery, fieldName, limit, searchFunction, co
30134
30141
  location.latitude,
30135
30142
  location.longitude
30136
30143
  );
30144
+ console.log("[nearSearch] Distance calculated:", {
30145
+ docId: doc.id,
30146
+ distance,
30147
+ maxDistance,
30148
+ minDistance,
30149
+ willBeFiltered: maxDistance !== void 0 && distance > maxDistance || minDistance !== void 0 && distance < minDistance
30150
+ });
30137
30151
  if (maxDistance !== void 0 && distance > maxDistance) {
30138
30152
  return null;
30139
30153
  }
@@ -30500,6 +30514,13 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
30500
30514
  const searchFunction = /* @__PURE__ */ __name(async (geohashPrefix) => {
30501
30515
  const dbClient2 = getDBClient();
30502
30516
  const tableName = getTableName();
30517
+ logger9.debug("Searching shadow records", {
30518
+ requestId,
30519
+ resource,
30520
+ fieldName,
30521
+ geohashPrefix,
30522
+ skPrefix: `${fieldName}#${geohashPrefix}`
30523
+ });
30503
30524
  const queryResult = await executeDynamoDBOperation(
30504
30525
  () => dbClient2.send(
30505
30526
  new import_lib_dynamodb5.QueryCommand({
@@ -30516,11 +30537,23 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
30516
30537
  "Query"
30517
30538
  );
30518
30539
  const shadowRecords = queryResult.Items || [];
30540
+ logger9.debug("Shadow records found", {
30541
+ requestId,
30542
+ resource,
30543
+ geohashPrefix,
30544
+ count: shadowRecords.length
30545
+ });
30519
30546
  const mainRecordIds = shadowRecords.map((item) => {
30520
30547
  const sk = item.SK;
30521
- const match = sk.match(/^[^#]+#[^#]+#(.+)$/);
30522
- return match ? match[1] : null;
30548
+ const parts = sk.split("#id#");
30549
+ return parts.length === 2 ? parts[1] : null;
30523
30550
  }).filter((id) => id !== null);
30551
+ logger9.debug("Main record IDs extracted", {
30552
+ requestId,
30553
+ resource,
30554
+ geohashPrefix,
30555
+ ids: mainRecordIds
30556
+ });
30524
30557
  const mainRecords = await Promise.all(
30525
30558
  mainRecordIds.map(async (id) => {
30526
30559
  const result2 = await executeDynamoDBOperation(
@@ -30540,7 +30573,14 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
30540
30573
  return result2.Items?.[0];
30541
30574
  })
30542
30575
  );
30543
- return mainRecords.filter((item) => item !== void 0);
30576
+ const validRecords = mainRecords.filter((item) => item !== void 0);
30577
+ logger9.debug("Main records retrieved", {
30578
+ requestId,
30579
+ resource,
30580
+ geohashPrefix,
30581
+ count: validRecords.length
30582
+ });
30583
+ return validRecords;
30544
30584
  }, "searchFunction");
30545
30585
  const result = await executeNearSearch(
30546
30586
  nearQuery,
@@ -30550,7 +30590,7 @@ async function executeNearQuery(resource, fieldName, nearQuery, limit, requestId
30550
30590
  DEFAULT_GEOHASH_CONFIG
30551
30591
  );
30552
30592
  const items = result.documents.map((doc) => {
30553
- const cleanRecord = extractCleanRecord(doc);
30593
+ const cleanRecord = removeShadowKeys(doc);
30554
30594
  return {
30555
30595
  ...cleanRecord,
30556
30596
  __distance: doc.__distance