@exabugs/dynamodb-client 1.3.29 → 1.3.31

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,1089 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [1.3.29] - 2026-01-08
11
-
12
- ### Added
13
-
14
- - **React-Admin多対多関係コンポーネント**: `ReferenceManyToManyField`に`_through`フィールドを追加
15
- - 各ターゲットレコードに中間テーブルのデータを`_through`フィールドとして追加
16
- - 中間テーブルのフィールドに直接アクセス可能(例: `source="_through.status"`)
17
- - N+1問題を解消し、パフォーマンスを向上
18
- - 使用例: `<StatusField source="_through.status" label="管理者ステータス" />`
19
-
20
- ## [1.3.28] - 2026-01-07
21
-
22
- ### Added
23
-
24
- - **React-Admin多対多関係コンポーネント**: `ReferenceManyToManyInput`に`filter`プロパティを追加
25
- - `filter?: Record<string, unknown>`プロパティで任意のフィルター条件を指定可能
26
- - `$near`オペレータによる地理的近傍探査をサポート
27
- - 使用例: `filter={{ location: { $near: { latitude: 35.6895, longitude: 139.6917, maxDistance: 5000 } } }}`
28
- - `ReferenceArrayInput`に透過的に渡され、Records Lambda APIで処理される
29
-
30
- ## [1.3.27] - 2026-01-07
31
-
32
- ### Changed
33
-
34
- - **React-Admin多対多関係コンポーネント**: DataProvider-level処理に変更
35
- - `ReferenceManyToManyInput`: `__manyToMany_*`形式のフィールド名を使用
36
- - `dataProvider`: `create`/`update`メソッドで自動的に中間テーブルを更新
37
- - `useManyToManyTransform`フックを削除(不要になった)
38
- - ユーザーは`transform`プロパティを書く必要がなくなった
39
- - React-Admin Enterprise Editionと同様のシンプルなAPI
40
-
41
- ## [1.3.26] - 2026-01-07
42
-
43
- ### Changed
44
-
45
- - **React-Admin多対多関係コンポーネント**: フォーム保存時にコミットする設計に変更
46
- - `ReferenceManyToManyInput`: 選択時はフォーム状態のみ更新(DB更新なし)
47
- - `useManyToManyTransform`: 親フォームの保存時に中間テーブルを更新する新しいフック
48
- - キャンセル可能: 保存前にキャンセルすれば変更が破棄される
49
- - トランザクション性: 親レコードと中間テーブルの更新が同時に行われる
50
-
51
- ### Fixed
52
-
53
- - **React-Admin多対多関係コンポーネント**: `ListContextProvider`の追加
54
- - `ReferenceManyToManyField`: 子コンポーネントに必要なListContextを提供
55
- - "useListContext must be used inside a ListContextProvider"エラーを修正
56
-
57
- ## [1.3.25] - 2026-01-07
58
-
59
- ### Fixed
60
-
61
- - **React-Admin多対多関係コンポーネント**: 無限ループの修正
62
- - `ReferenceManyToManyField`: `useMemo`を使用してrecordIdを安定化し、無限再レンダリングを防止
63
- - `ReferenceManyToManyInput`: 同様に`useMemo`を使用して無限ループを防止
64
- - レート制限を追加(1秒間隔、最大10回のフェッチ)
65
- - 依存配列を最適化(不要な依存を削除)
66
-
67
- ## [1.3.24] - 2026-01-06
68
-
69
- ### Added
70
-
71
- - **React-Admin多対多関係コンポーネント**: 中間テーブルを使用した多対多関係をサポート
72
- - `ReferenceManyToManyField`: Show/List画面で多対多関係を表示
73
- - `ReferenceManyToManyInput`: Edit/Create画面で多対多関係を編集
74
- - `createMany`: DataProviderに複数レコード一括作成メソッドを追加
75
- - 完全なTypeScript型定義とエラーハンドリング
76
- - パフォーマンス最適化(バッチ処理、リクエストキャンセル)
77
-
78
- ### Changed
79
-
80
- - **ドキュメント**: `docs/react-admin-integration.md`に多対多関係の詳細セクションを追加
81
- - **TypeScript設定**: `tsconfig.base.json`にJSXサポートを追加(`"jsx": "react-jsx"`)
82
- - **Lint設定**: max-warningsを35から41に更新(React-Admin型制約による警告を許容)
83
-
84
- ## [1.3.23] - 2026-01-05
85
-
86
- ### Added
87
-
88
- - **テストファイル**: `$setOnInsert`オペレータの包括的なテストを追加
89
- - `__tests__/operations/updateOne-setOnInsert.test.ts` (279行)
90
- - `__tests__/operations/updateMany-setOnInsert.test.ts` (166行)
91
-
92
- ## [1.3.22] - 2026-01-05
93
-
94
- ### Added
95
-
96
- - **$setOnInsert オペレータ**: MongoDB互換のupsert専用フィールド設定機能
97
- - upsert時のinsert専用フィールドを指定可能(`$setOnInsert`)
98
- - update時は`$setOnInsert`が無視され、`$set`のみが適用される
99
- - `$set`と`$setOnInsert`で同じフィールドを指定した場合、`$set`が優先
100
- - タイムスタンプ管理(`createdAt`は初回のみ、`updatedAt`は常に更新)が明確に
101
- - MongoDB公式ドキュメントと完全互換
102
-
103
- ### Changed
104
-
105
- - **UpdateOperators型**: `$setOnInsert?: Partial<T>` フィールドを追加
106
- - **handleUpsertCreate**: `$set`と`$setOnInsert`をマージして新規作成(`$set`が優先)
107
- - **handleUpsertUpdate**: `$setOnInsert`を無視して`$set`のみを適用
108
-
109
- ### Documentation
110
-
111
- - **API.md**: `$setOnInsert`オペレータの詳細な説明を追加
112
- - 動作仕様(insert時/update時の挙動)
113
- - 使用例とコードスニペット
114
- - MongoDB互換性の説明
115
- - ユースケース(タイムスタンプ管理、デフォルト値設定、初期ステータス)
116
-
117
- ### Technical
118
-
119
- - **テスト**: 包括的なテストカバレッジ(単体テスト・統合テスト)
120
- - insert時に`$set`と`$setOnInsert`の両方を適用するテスト
121
- - update時に`$setOnInsert`を無視するテスト
122
- - `$set`が`$setOnInsert`より優先されるテスト
123
- - `createdAt`の保持テスト
124
- - シャドウレコード生成の確認
125
- - 後方互換性テスト(従来のパッチ形式)
126
-
127
- ## [1.3.21] - 2026-01-04
128
-
129
- ### Changed
130
-
131
- - **Shadow仕様変更**: オブジェクト型はシャドウを作成しない仕様に変更
132
- - `inferFieldType`: オブジェクト型に対して`null`を返すように変更
133
- - `generateShadowRecords`: オブジェクト型を明示的にスキップ
134
- - `formatFieldValue`: `object`型のケースを削除
135
- - 理由: オブジェクトは構造が複雑で、シャドウキーとして適切でない
136
- - 例外: GeoCoordinates型(`{latitude, longitude}`)は地理空間検索用にGeoHashシャドウを生成
137
-
138
- ## [1.3.20] - 2026-01-03
139
-
140
- ### Added
141
-
142
- - **Geohash検索spec**: dynamodb-clientの汎用機能としてGeohash検索specを追加
143
- - `.kiro/specs/dynamodb-client/geohash-search/` ディレクトリに移動
144
- - requirements.md, design.md, tasks.md, verification-plan.mdを含む
145
-
146
- ### Changed
147
-
148
- - **$nearクエリインターフェース**: 簡易形式のみに変更
149
- - MongoDB互換のGeoJSON形式(`$geometry`)を削除
150
- - 簡易形式(`latitude`, `longitude`直接指定)のみを推奨
151
- - より直感的で使いやすいインターフェースに統一
152
-
153
- ## [1.3.19] - 2026-01-03
154
-
155
- ### Changed
156
-
157
- - デバッグログを削除(v1.3.17で追加した調査用ログを削除)
158
-
159
- ## [1.3.18] - 2026-01-03
160
-
161
- ### Fixed
162
-
163
- - **重要**: extractCleanRecord関数でdata属性が存在しない場合の処理を修正
164
- - シャドーレコードにはdata属性がないため、item自体をフォールバックとして使用
165
- - これにより$nearクエリでメインレコードが正しく抽出されるようになった
166
-
167
- ## [1.3.17] - 2026-01-03
168
-
169
- ### Fixed
170
-
171
- - **デバッグ**: $nearクエリでextractCleanRecordの動作を確認するためのデバッグログを追加
172
- - nearQuery.tsのsearchFunctionでextractCleanRecord前後のレコード構造をログ出力
173
- - これにより、data属性からのフィールド抽出が正しく行われているかを確認可能に
174
-
175
- ## [1.3.16] - 2026-01-03
176
-
177
- ### Fixed
178
-
179
- - **重要**: $nearクエリで本体レコードのdata属性からフィールドを正しく抽出するように修正
180
- - `nearQuery.ts`で`extractCleanRecord()`を使用(`removeShadowKeys()`ではなく)
181
- - 本体レコードは`{ PK, SK, data: { ...actual fields } }`という構造なので、`data`属性から実際のフィールドを取り出す必要がある
182
- - これにより、$near検索で正しくレコードデータ(id, name, location等)を取得できるようになった
183
-
184
- ## [1.3.15] - 2026-01-03
185
-
186
- ### Fixed
187
-
188
- - **重要**: $nearクエリでextractCleanRecordの誤用を修正
189
- - nearQuery.tsのsearchFunctionでremoveShadowKeysを使用(extractCleanRecordではなく)
190
- - searchFunctionが返すレコードは既にクリーンな形式(data属性なし)のため、extractCleanRecordを使用すると`undefined`になる問題を解決
191
- - これにより、$near検索で正しくレコードが返されるようになった
192
-
193
- ## [1.3.14] - 2026-01-03
194
-
195
- ### Improved
196
-
197
- - **コード品質**: $nearクエリの型定義を改善(`any` → `Record<string, unknown>`)
198
- - **ドキュメント**: nearQuery.tsのコメントを明確化(SKの構造を正確に説明)
199
- - **型安全性**: 型アサーションを改善して型安全性を向上
200
-
201
- ## [1.3.13] - 2026-01-03
202
-
203
- ### Fixed
204
-
205
- - **重要**: $nearクエリでdata.\_\_shadowKeysが除外されない問題を修正
206
- - nearQuery.tsでextractCleanRecordを使用(mainレコードのdata属性から\_\_shadowKeysを除外)
207
-
208
- ## [1.3.12] - 2026-01-02
209
-
210
- ### Fixed
211
-
212
- - **重要**: /versionエンドポイントのデフォルトバージョンを1.3.12に更新
213
- - esbuild設定でPACKAGE_VERSIONをdefineに追加(ビルド時にpackage.jsonのバージョンを埋め込み)
214
-
215
- ## [1.3.11] - 2026-01-02
216
-
217
- ### Fixed
218
-
219
- - テストコードのモック設定を修正: removeShadowKeysをエクスポートに追加
220
-
221
- ## [1.3.10] - 2026-01-02
222
-
223
- ### Fixed
224
-
225
- - **重要**: nearQuery.tsでextractCleanRecordの誤用を修正
226
- - searchFunctionが返すレコードは既にクリーンな形式(data属性なし)
227
- - extractCleanRecordではなくremoveShadowKeysを使用するように修正
228
- - これにより、$near検索で0件が返される問題を解決
229
-
230
- ## [1.3.9] - 2026-01-02
231
-
232
- ### Added
233
-
234
- - 自動テストケースを追加: DynamoDBレコード構造でのlocationフィールド取得テスト
235
- - 自動テストケースを追加: DynamoDB内部フィールド(PK, SK)が含まれる場合のテスト
10
+ ## [1.3.31] - 2026-01-08
236
11
 
237
12
  ### Fixed
238
13
 
239
- - nearSearch.tsのデバッグログを改善: locationフィールドが見つからない場合の詳細ログ
240
- - nearSearch.tsのデバッグログを改善: 距離計算結果とフィルタリング判定のログ
14
+ - **デプロイ問題の修正**: Lambda関数が古いコードを使用していた問題を修正
15
+ - handler.tsのバージョンコメントを1.3.31に更新
16
+ - デフォルトバージョンを1.3.31に更新
17
+ - v1.3.30のfilter対応コードが正しくデプロイされるようにビルド成果物を更新
241
18
 
242
- ## [1.3.8] - 2026-01-02
243
-
244
- ### Fixed
245
-
246
- - $nearクエリのデバッグログを追加(locationフィールドと距離計算の詳細)
247
-
248
- ## [1.3.7] - 2026-01-02
249
-
250
- ### Fixed
251
-
252
- - **$nearクエリのシャドーレコード検索**: SKプレフィックスパターンを修正
253
- - 修正前: `${fieldName}#${geohashPrefix}` → 修正後: `${fieldName}#${geohashPrefix}#id#`
254
- - シャドーレコードのSKパターン `location#<geohash>#id#<venue-id>` に正しく対応
255
- - これにより、$nearクエリが正常に動作し、距離順にソートされた開催地一覧を取得可能に
256
-
257
- ### Added
258
-
259
- - **$nearクエリのデバッグログ**: 各ステップでログを出力して問題追跡を容易に
260
- - シャドーレコード検索時のSKプレフィックスをログ出力
261
- - 検索結果の件数をログ出力
262
- - 本体レコード取得時のIDリストをログ出力
263
-
264
- ## [1.3.6] - 2026-01-02
265
-
266
- ### Fixed
267
-
268
- - **Lambda関数のデフォルトバージョン**: handler.tsのデフォルトバージョンを1.3.6に更新
269
- - 環境変数`DYNAMODB_CLIENT_VERSION`が設定されていない場合のフォールバック値を修正
270
- - これにより、Lambda関数のソースコードハッシュが確実に変更される
271
-
272
- ### Changed
273
-
274
- - **パブリッシュ手順の改善**: コメントだけの変更ではビルド成果物が変わらないため、実際のコード変更が必要
275
-
276
- ## [1.3.5] - 2026-01-02
277
-
278
- ### Changed
279
-
280
- - **テストリリース**: publish-and-deploy.mdの手順確認のためのテストリリース
281
- - handler.tsのバージョンコメントを1.3.5に更新
282
- - **注意**: コメントのみの変更のため、ビルド成果物は変わらず
283
-
284
- ## [1.3.4] - 2026-01-02
285
-
286
- ### Changed
287
-
288
- - **手順書の改善**: Lambda関数のソースコードハッシュ変更を確実にするため、Phase 1の最初にソースコード変更ステップを追加
289
- - バージョン番号だけの変更ではTerraformが更新を検知しないため、必ず`src/`配下のファイルに変更を加えることを明記
290
- - handler.tsにバージョンコメントを追加する例を提示
291
-
292
- ## [1.3.3] - 2026-01-02
293
-
294
- ### Changed
295
-
296
- - **手順書の追加**: dynamodb-clientパブリッシュとasanowaデプロイの標準手順を確立
297
- - `.kiro/steering/publish-and-deploy.md`を追加
298
- - npmパブリッシュからデプロイまでの完全な手順を文書化
299
- - トラブルシューティングとチェックリストを含む
300
-
301
- ## [1.3.2] - 2026-01-02
302
-
303
- ### Added
304
-
305
- - **バージョンエンドポイント**: `GET /version`エンドポイントを追加
306
- - デプロイされたdynamodb-clientのバージョンを確認可能
307
- - レスポンス形式: `{ "version": "1.3.2", "timestamp": "2026-01-02T..." }`
308
- - Lambda関数のデバッグとバージョン確認に有用
309
-
310
- ## [1.3.1] - 2026-01-02
311
-
312
- ### Fixed
313
-
314
- - **$nearオペレータ**: GeoHashシャドウレコード検索の修正
315
- - フィールド名を直接使用するように変更(`_geohash`サフィックスを削除)
316
- - シャドウレコードの実際の形式に合わせて修正(例: `location#xn74rnmx#id#...`)
317
- - これにより$nearオペレータが正しく結果を返すようになりました
318
-
319
- ## [1.3.0] - 2026-01-02
320
-
321
- ### Added
322
-
323
- - **$nearオペレータ**: MongoDB互換の地理空間検索機能
324
- - 簡易形式とGeoJSON形式の両方をサポート
325
- - 9ブロック検索アルゴリズム(中心 + 隣接8方向)
326
- - 段階的精度緩和(precision 6→5→4)
327
- - 距離フィルタリング(maxDistance、minDistance)
328
- - 自動距離計算とソート(`__distance`フィールド)
329
- - find操作との透過的な統合
330
-
331
- - **包括的なテストカバレッジ**: 115の新規テスト追加(355→449テスト)
332
- - nearQuery.ts: 100%カバレッジ(21テスト)
333
- - filter.ts: 98.37%カバレッジ(54テスト)
334
- - find/utils.ts: 100%カバレッジ(40テスト)
335
-
336
- ### Changed
337
-
338
- - **find操作**: $nearオペレータの自動検出と実行
339
- - **filter.ts**: 複雑なフィルター構文のサポート改善
340
-
341
- ### Technical
342
-
343
- - **新規ファイル**:
344
- - `src/server/operations/find/nearQuery.ts` - $near検索の実装
345
- - `__tests__/near-query.test.ts` - nearQuery単体テスト
346
- - `__tests__/near-search.test.ts` - 9ブロック検索テスト
347
- - `__tests__/find-near.test.ts` - find統合テスト
348
- - `__tests__/filter-comprehensive.test.ts` - filter包括テスト
349
- - `__tests__/find-utils-comprehensive.test.ts` - find/utils包括テスト
350
-
351
- ## [1.2.6] - 2026-01-02
352
-
353
- ### Added
354
-
355
- - **$nearオペレータの完全実装**: find操作での地理空間検索を完全サポート
356
- - `detectNearQuery()`: $nearオペレータの自動検出(簡易形式・GeoJSON形式)
357
- - `executeNearQuery()`: DynamoDB統合による$near検索の実行
358
- - `handleFind()`: $near検出時の自動切り替えロジック
359
- - 距離情報(`__distance`)の自動付与とソート
360
- - `pagination.perPage`を$near検索のlimitとして使用
361
- - 包括的なテストカバレッジ(19テスト追加)
362
-
363
- ### Changed
364
-
365
- - **find操作**: $nearオペレータが含まれる場合、自動的に地理空間検索に切り替え
366
- - 通常のfind操作との透過的な統合
367
- - エラーハンドリングとログ記録の統一
368
-
369
- ### Technical
370
-
371
- - **新規ファイル**: `src/server/operations/find/nearQuery.ts` - DynamoDB統合ロジック
372
- - **新規ファイル**: `src/server/operations/find/utils.ts` - $near検出ユーティリティ
373
- - **テスト**: `__tests__/near-search.test.ts` - executeNearSearchのユニットテスト(13テスト)
374
- - **テスト**: `__tests__/find-near.test.ts` - find操作での$near統合テスト(6テスト)
375
- - **全テスト**: 334テスト全てパス
376
-
377
- ## [1.2.5] - 2026-01-02
378
-
379
- ### Fixed
380
-
381
- - **npmパブリッシュ再実行**: v1.2.4のパブリッシュ失敗により再パブリッシュ
382
- - ビルド成果物(`dist/server/query/nearSearch.js`)が正しく含まれることを確認
383
- - `$near`オペレータが正常に動作することを確認
384
-
385
- ## [1.2.3] - 2026-01-02
386
-
387
- ### Fixed
388
-
389
- - **ビルド成果物の確実な更新**: v1.2.2で$nearオペレータのコードが含まれていなかった問題を修正
390
- - ビルド後に確実にnpmパブリッシュを実行
391
- - `dist/server/handler.cjs`に最新のコードが含まれることを確認
392
-
393
- ## [1.2.2] - 2026-01-02
394
-
395
- ### Fixed
396
-
397
- - **Terraform設定のリバート**: `source_dir`から`source_file`に戻す
398
- - dynamodb-clientはTerraformコードを内包して提供するライブラリ
399
- - `source_file`で`handler.cjs`のみを監視するのが正しい設計
400
- - asanowaプロジェクト側の変更(node_modules等)は、asanowa側のTerraformで検知すべき
401
- - v1.2.1の変更(コミットd535ba3f9019fd9c178998988300c358b4634222)をリバート
402
-
403
- ## [1.2.0] - 2026-01-02
19
+ ## [1.3.30] - 2026-01-08
404
20
 
405
21
  ### Added
406
22
 
407
- - **GeoHash地理空間検索**: MongoDB互換の`$near`オペレータを実装
408
- - 自動GeoHash変換: `{latitude, longitude}`オブジェクトを自動検出してシャドウインデックス生成
409
- - 9ブロック検索: 中心 + 隣接8方向の合計9ブロックを検索して境界をまたぐ検索漏れを防止
410
- - 段階的精度緩和: precision 6→5→4と段階的に検索範囲を拡大
411
- - 距離計算・ソート: Haversine公式による正確な距離計算と自動ソート
412
- - `__distance`フィールド: 検索地点からの距離(メートル)を自動付与
413
- - `__geohash`フィールド: 検出されたGeoHashを自動付与
414
- - フィールド名非依存: `location`固定ではなく、任意のフィールド名を自動検出
415
- - 透過的実装: クライアントはGeoHashを意識せず、通常のオブジェクトとして扱える
416
- - 設定可能なパラメータ: `GeoHashConfig`で精度や反復回数をカスタマイズ可能
417
-
418
- - **新しいユーティリティ関数**:
419
- - `isGeoCoordinates()`: 地理座標オブジェクトの自動検出
420
- - `encodeGeoHash()`: 緯度・経度からGeoHashを生成
421
- - `decodeGeoHash()`: GeoHashから緯度・経度を復元
422
- - `getNeighborGeoHashes()`: 隣接8方向のGeoHashを取得
423
- - `calculateDistance()`: Haversine公式による2点間の距離計算
424
- - `extractCoordinatesFromNearQuery()`: $nearクエリから座標を抽出
425
- - `extractMaxDistanceFromNearQuery()`: $nearクエリから最大距離を抽出
426
- - `extractMinDistanceFromNearQuery()`: $nearクエリから最小距離を抽出
427
-
428
- - **新しい型定義**:
429
- - `GeoCoordinates`: 地理座標オブジェクト型
430
- - `NearQuery`: MongoDB互換の$nearクエリ型(GeoJSON形式と簡易形式をサポート)
431
- - `DocumentWithDistance`: 距離情報付きドキュメント型
432
- - `GeoHashConfig`: GeoHash検索の設定型
433
- - `DEFAULT_GEOHASH_CONFIG`: デフォルト設定定数
23
+ - **filterによるレコード特定**: `updateOne`、`updateMany`、`deleteOne`、`deleteMany`操作で`filter`を使用したレコード特定をサポート
24
+ - `updateOne({ filter: { token: 'xxx' } }, ...)`のように任意のフィールドでレコードを特定可能
25
+ - `id`または`filter`のどちらか一方を必須とするUnion型を導入(DRY原則に基づく型定義の改善)
26
+ - デバイストークンの一意性制約など、ID以外のフィールドでのupsert操作に対応
27
+ - 既存の`id`/`ids`による操作は完全に後方互換
434
28
 
435
29
  ### Changed
436
30
 
437
- - **シャドウレコード生成**: `generator.ts`を更新して地理座標の自動検出とGeoHashシャドウレコード生成を追加
438
- - シャドウインデックスは8文字精度(±19m)で保存
439
- - 検索は6文字精度(±610m)で開始し、段階的に緩和
440
- - 既存のシャドウ化機能(文字列フィールド等)と共存
441
-
442
- ### Dependencies
443
-
444
- - **追加**: `ngeohash@^0.6.3` - GeoHashエンコード・デコードライブラリ
445
- - **追加**: `@types/ngeohash@^0.6.8` - ngeohashの型定義
446
-
447
- ### Notes
448
-
449
- - この機能は後方互換性があります。既存のコードは変更なしで動作します。
450
- - GeoHash検索を使用するには、`{latitude, longitude}`オブジェクトを持つフィールドを作成するだけです。
451
- - 詳細な使用方法は [GeoHash Search Guide](./docs/geohash-search.md) を参照してください。
452
-
453
- ## [1.1.2] - 2025-01-02
454
-
455
- ### Fixed
456
-
457
- - **Parameter Store**: outputs.tfのパラメータ参照を修正
458
- - 古いパラメータ名(`app_records_api_url`, `lambda_records_function_arn`)から新しい名前(`infra_dynamodb_client_api_url`, `infra_dynamodb_client_api_arn`)に更新
459
- - v1.1.0で変更したパラメータ名に合わせてoutputsを修正
460
-
461
- ## [1.1.1] - 2025-01-02
462
-
463
- ### Fixed
464
-
465
- - **Parameter Store**: DynamoDB Table ARNパラメータの作成を修正
466
- - `dynamodb_table_arn`をParameter Storeモジュールに渡すように修正
467
- - `/infra/dynamodb-table-arn`パラメータが正しく作成されるようになった
468
-
469
- ## [1.1.0] - 2025-01-02
470
-
471
- ### Changed
472
-
473
- - **Parameter Store命名規則の統一**: すべてのパラメータを `/infra/` カテゴリに統一
474
- - `/infra/dynamodb-client-api-url` - DynamoDB Client API URL(旧: `/app/records-api-url`)
475
- - `/infra/dynamodb-client-api-arn` - Lambda ARN(旧: `/lambda/records-function-arn`)
476
- - `/infra/dynamodb-table-name` - DynamoDB Table Name
477
- - `/infra/dynamodb-table-arn` - DynamoDB Table ARN(新規追加)
478
- - dynamodb-clientは**インフラ基盤**を提供するライブラリとして、すべて「インフラ情報」カテゴリに統一
479
-
480
- ### Breaking Changes
481
-
482
- - Parameter Storeのパラメータ名が変更されました
483
- - 既存プロジェクトは新しいパラメータ名に移行する必要があります
484
- - 詳細は [Parameter Store Migration Guide](./docs/parameter-store-migration.md) を参照
485
-
486
- ## [1.0.3] - 2025-12-31
487
-
488
- ### Fixed
489
-
490
- - **型安全性の向上**: `ParsedFilterField`の型定義を修正
491
- - `find/types.ts`の重複した型定義を削除し、`filter.ts`からインポート
492
- - `operator`フィールドを`string`型から`FilterOperator`型に変更
493
- - TypeScriptコンパイラが`$`プレフィックスなしの演算子を検出できるように修正
494
-
495
- - **ID最適化クエリ**: `$eq`演算子の比較を修正
496
- - `idQuery.ts`で演算子比較が`'eq'`(`$`なし)になっていた問題を修正
497
- - `getOne`操作で単一レコードが正しく取得できるように修正
498
- - react-admin詳細画面が正常に動作するように修正
499
-
500
- - **シャドウクエリ**: `$`プレフィックス付き演算子に統一
501
- - `shadowQuery.ts`のswitch文で`'eq'`, `'gt'`, `'gte'`, `'lt'`, `'lte'`を`'$eq'`, `'$gt'`, `'$gte'`, `'$lt'`, `'$lte'`に修正
502
- - すべてのクエリ最適化で一貫して`$`プレフィックス付き演算子を使用
503
-
504
- ## [1.0.2] - 2025-12-31
505
-
506
- ### Changed
507
-
508
- - **BREAKING**: フィルター演算子を `$` プレフィックス必須に統一
509
- - `FilterOperator` 型を `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$nin`, `$starts`, `$ends`, `$contains`, `$exists` に変更
510
- - すべてのサーバー側フィルター処理で `$` プレフィックスを標準とする
511
- - `$` なしの演算子はエラーとして扱う(明確なエラーメッセージ)
512
- - MongoDB互換性を完全に保証
513
-
514
- ### Fixed
515
-
516
- - **サーバーサイドフィルター処理**: `$` プレフィックス付き演算子を正しく処理
517
- - `find` 操作で `{ id: { $in: [...] } }` 形式のフィルターが正常に動作
518
- - react-admin統合からのフィルターが正常に動作
519
- - 一貫性のある演算子処理(モンキーパッチなし)
520
-
521
- ## [1.0.1] - 2025-12-31
522
-
523
- ### Fixed
524
-
525
- - **react-admin統合**: `convertFilter`関数が演算子に`$`プレフィックスを追加するように修正
526
- - react-adminから送信される`{id: {in: [...]}}`を`{id: {$in: [...]}}`に自動変換
527
- - `update`、`delete`、`getList`、`getManyReference`操作で正しくフィルタが適用されるように修正
528
- - dynamodb-client 1.0.0のMongoDB互換性向上に対応
529
-
530
- ## [1.0.0] - 2025-01-01
531
-
532
- ### BREAKING CHANGES
533
-
534
- - **MongoDB互換性向上**: すべての操作オペレータに `$` プレフィックスを追加
535
- - **フィルタ演算子**: `eq` → `$eq`, `gt` → `$gt`, `gte` → `$gte`, `lt` → `$lt`, `lte` → `$lte`, `in` → `$in`, `nin` → `$nin`, `exists` → `$exists`, `regex` → `$regex`, `ne` → `$ne`
536
- - **更新演算子**: `set` → `$set`, `unset` → `$unset`, `inc` → `$inc`
537
- - **論理演算子**: `and` → `$and`, `or` → `$or`
538
- - MongoDBの公式ドキュメントと完全に一致する構文を採用
539
- - TypeScriptコンパイラが自動的にエラーを検出するため、移行は比較的容易
540
-
541
- ### Migration Guide
542
-
543
- v0.xからv1.0.0へのアップグレードには、既存コードの更新が必要です。詳細なマイグレーションガイドは [docs/MIGRATION_v1.md](./docs/MIGRATION_v1.md) を参照してください。
544
-
545
- **主な変更点**:
546
-
547
- ```typescript
548
- // v0.x(旧)
549
- collection.find({ age: { gte: 18 } });
550
- collection.updateOne({ id: '123' }, { set: { name: 'John' } });
551
-
552
- // v1.0.0(新)
553
- collection.find({ age: { $gte: 18 } });
554
- collection.updateOne({ id: '123' }, { $set: { name: 'John' } });
555
- ```
556
-
557
- **自動マイグレーション**:
558
-
559
- ```bash
560
- # 一括置換(推奨)
561
- find src -name "*.ts" -type f -exec sed -i '' \
562
- -e 's/{ eq:/{ $eq:/g' \
563
- -e 's/{ gt:/{ $gt:/g' \
564
- -e 's/{ gte:/{ $gte:/g' \
565
- -e 's/{ lt:/{ $lt:/g' \
566
- -e 's/{ lte:/{ $lte:/g' \
567
- -e 's/{ in:/{ $in:/g' \
568
- -e 's/{ nin:/{ $nin:/g' \
569
- -e 's/{ exists:/{ $exists:/g' \
570
- -e 's/{ regex:/{ $regex:/g' \
571
- -e 's/{ ne:/{ $ne:/g' \
572
- -e 's/{ set:/{ $set:/g' \
573
- -e 's/{ unset:/{ $unset:/g' \
574
- -e 's/{ inc:/{ $inc:/g' \
575
- -e 's/{ and:/{ $and:/g' \
576
- -e 's/{ or:/{ $or:/g' \
577
- {} +
578
- ```
579
-
580
- ### Benefits
581
-
582
- - **MongoDB互換性**: MongoDBの公式ドキュメントと完全に一致
583
- - **学習コスト削減**: MongoDB経験者が即座に使用可能
584
- - **エコシステム統合**: MongoDB関連ツールとの統合が容易
585
- - **明確な意図**: `$` プレフィックスにより演算子であることが明確
586
- - **将来の拡張性**: MongoDB互換の新しい演算子を追加しやすい
587
-
588
- ### Changed
589
-
590
- - **型定義**: `FilterOperators`, `UpdateOperators`, `Filter` 型を更新
591
- - **サーバー側**: クエリ変換と更新演算子処理を更新
592
- - **クライアント側**: `Collection` と `FindCursor` の実装を更新
593
- - **react-admin統合**: データプロバイダーを更新
594
- - **テスト**: すべてのテストケース(314件)を更新し、全テストが通過
595
-
596
- ### Documentation
597
-
598
- - **マイグレーションガイド**: 詳細な移行手順を `docs/MIGRATION_v1.md` に追加
599
- - **APIリファレンス**: `docs/API.md` のオペレータ一覧を更新
600
- - **使用例**: すべてのコード例を新しい構文に更新
601
-
602
- ## [0.9.3] - 2024-12-31
603
-
604
- ### Fixed
605
-
606
- - **Lambda Handler**: Improved CORS and error handling
607
- - Simplified CORS preflight handling with dedicated `createCorsResponse` function
608
- - Improved error response structure with consistent CORS headers
609
- - Enhanced error logging with request context
610
- - Better separation of concerns between response builders and error handlers
611
-
612
- ## [0.9.2] - 2024-12-31
613
-
614
- ### Fixed
615
-
616
- - **Parameter Converter**: Improved code formatting and maintainability
617
- - Refactored multi-line ternary operators to single-line format for better readability
618
- - Enhanced `convertUpdateOneParams` and `convertUpdateManyParams` to properly pass through `options` parameter
619
- - Ensures upsert options are correctly propagated from MongoDB-style API to internal operations
620
- - No functional changes - purely code quality improvements
621
-
622
- ## [0.9.1] - 2024-12-30
623
-
624
- ### Fixed
625
-
626
- - **Filter Operator Support**: Added support for `in`, `nin`, `contains`, and `exists` operators
627
- - Updated `FilterOperator` type to include all supported operators
628
- - Enhanced `parseFilters` function to support nested object filter syntax: `{ id: { in: [...] } }`
629
- - Added `contains` and `exists` operator handling in `matchesAllFilters` function
630
- - Fixed react-admin integration: `getMany` operation now works correctly with `in` operator
631
- - Backward compatible: Both filter syntaxes are supported (`"id:in"` and `{ id: { in: [...] } }`)
632
-
633
- ## [0.9.0] - 2024-12-29
634
-
635
- ### Added
636
-
637
- - **Upsert Option for updateOne/updateMany**: MongoDB-compatible upsert functionality
638
- - Added `UpdateOneOptions` and `UpdateManyOptions` types with `upsert` boolean option
639
- - Added `upsertedId` field to `UpdateResult` type (set when a new document is created via upsert)
640
- - Server-side implementation: `handleUpsertCreate` and `handleUpsertUpdate` functions
641
- - Client-side implementation: Third parameter (options) for `updateOne` and `updateMany` methods
642
- - Automatic timestamp management: `createdAt` and `updatedAt` are automatically set on upsert
643
- - Automatic shadow record generation: Shadow records are created/updated during upsert operations
644
- - Comprehensive test coverage: Unit tests and integration tests for upsert functionality
645
- - Complete documentation: API reference, usage examples, and migration guide in `docs/API.md`
646
-
647
- ### Changed
648
-
649
- - **API Enhancement**: `updateOne` and `updateMany` methods now accept an optional third parameter for options
650
- - Backward compatible: Existing code continues to work without changes
651
- - Default behavior unchanged: `upsert` defaults to `false`
652
-
653
- ### Documentation
654
-
655
- - **API Reference**: Updated `docs/API.md` with detailed upsert option documentation
656
- - Added UpdateOneOptions and UpdateManyOptions type definitions
657
- - Added UpdateResult.upsertedId field explanation
658
- - Added practical usage examples for upsert operations
659
- - Added migration guide from v0.3.x to v0.4.x
660
- - Added FAQ section for common upsert questions
661
-
662
- ## [0.8.1] - 2025-12-28
663
-
664
- ### Fixed
665
-
666
- - **Terraform Outputs**: Removed deleted Cognito parameters from parameter-store module outputs
667
- - Removed `cognito_user_pool_id`, `cognito_client_id`, `cognito_domain` from outputs.tf
668
- - These parameters were removed in v0.8.0 but outputs.tf was not updated
669
- - Fixes Terraform validation errors in consuming projects
670
-
671
- ## [0.8.0] - 2025-12-28
672
-
673
- ### BREAKING CHANGES
674
-
675
- - **Removed asanowa-specific parameters for library generalization**
676
- - Removed `cognito_client_id` parameter (aud verification not needed for generic library)
677
- - Removed `cognito_admin_ui_client_id` parameter (asanowa-specific, moved to project-specific configuration)
678
- - Removed `cognito_user_pool_domain` parameter (OAuth flow specific, not needed for JWT verification)
679
- - Removed `COGNITO_CLIENT_ID` environment variable from Records Lambda
680
- - Removed `COGNITO_REGION` environment variable (redundant, extracted from user pool ID)
681
- - Removed Admin UI Cognito parameters from Parameter Store module (asanowa-specific)
682
-
683
- ### Migration Guide
684
-
685
- If your project was using the removed parameters:
686
-
687
- 1. **cognito_client_id**: Remove from module call. JWT verification now works without aud validation for better generalization.
688
- 2. **cognito_admin_ui_client_id** and **cognito_user_pool_domain**: Move these to your project-specific Parameter Store configuration.
689
- 3. **COGNITO_REGION**: No longer needed. Region is automatically extracted from `cognito_user_pool_id`.
690
-
691
- ### What remains
692
-
693
- - `cognito_user_pool_id`: Still required for JWT signature verification (JWKS endpoint construction)
694
-
695
- ## [0.7.5] - 2025-12-28
696
-
697
- ### Removed
698
-
699
- - **All KMS Settings Verification**: Removed all KMS-related settings to verify if they were actually necessary
700
- - Removed `aws_iam_role_policy.records_kms_default` IAM policy resource (Lambda execution environment)
701
- - Removed `aws_iam_role_policy.records_kms` IAM policy resource (Parameter Store access)
702
- - Removed `kms_key_arn = ""` setting from Lambda function
703
- - Current Lambda function uses only environment variables, not Parameter Store SecureString
704
- - This is part of ADR-005 verification to determine the true cause of Lambda Function URL issues
705
-
706
- ## [0.7.4] - 2025-12-28
707
-
708
- ### Fixed
709
-
710
- - **Lambda KMS Encryption**: Disabled KMS encryption for Lambda function to resolve persistent KMSAccessDeniedException (ADR-004)
711
- - **Lambda Startup**: Fixed Lambda function startup failure by explicitly setting `kms_key_arn = ""`
712
- - **502 Bad Gateway**: Resolved Function URL errors caused by Lambda execution environment KMS issues
713
-
714
- ### Changed
715
-
716
- - **Security Model**: Moved from KMS-encrypted Lambda environment to unencrypted for compatibility
717
- - **ADR-003 Deprecated**: Replaced complex KMS permission approach with simpler encryption disable approach
718
-
719
- ### Technical
720
-
721
- - **Terraform**: Added `kms_key_arn = ""` to Lambda function configuration
722
- - **Architecture Decision**: Created ADR-004 to document KMS encryption disable decision
723
-
724
- ## [0.7.3] - 2025-12-28
725
-
726
- ### Fixed
727
-
728
- - **Lambda KMS Access**: Added AWS default KMS key access permissions for Lambda execution environment (ADR-003)
729
- - **KMSAccessDeniedException**: Resolved Lambda startup failure due to missing KMS permissions
730
- - **Lambda Runtime**: Added conditional access to default KMS key used by Lambda service for function protection
731
-
732
- ### Security
733
-
734
- - **KMS Permissions**: Limited KMS access to Lambda service only with conditional access control
735
- - **Least Privilege**: Maintained security with service-specific KMS access restrictions
736
-
737
- ## [0.7.2] - 2024-12-28
738
-
739
- ### Fixed
740
-
741
- - **Parameter Store**: Added overwrite=true to all SSM parameters to handle existing parameters
742
- - Prevents ParameterAlreadyExists errors during Terraform apply
743
- - Allows updating existing Parameter Store values without manual deletion
744
-
745
- ## [0.7.1] - 2024-12-28
746
-
747
- ### Fixed
748
-
749
- - **CORS**: Removed OPTIONS method from allowMethods to comply with AWS Lambda Function URL constraints
750
- - AWS Lambda Function URL has a 6-character limit per method name
751
- - OPTIONS (7 characters) exceeded this limit causing ValidationException
752
- - Preflight OPTIONS requests are handled automatically by Lambda Function URL
753
-
754
- ## [0.7.0] - 2024-12-28
755
-
756
- ### Added
757
-
758
- - **Terraform**: KMS access policy for Parameter Store integration
759
- - Lambda functions can now decrypt SecureString environment variables
760
- - Added `kms:Decrypt` permission with SSM service condition
761
- - Enables secure configuration management through Parameter Store
762
-
763
- ### Changed
764
-
765
- - **CORS**: Expanded CORS configuration for comprehensive API support
766
- - Added support for GET, PUT, DELETE, and OPTIONS methods
767
- - Previously only supported POST method
768
- - Enables full REST API functionality for react-admin integration
769
-
770
- ### Improved
771
-
772
- - **Infrastructure**: Enhanced Lambda function permissions and dependencies
773
- - Added proper dependency management for KMS policy
774
- - Improved security with least-privilege access patterns
775
-
776
- ## [0.5.0] - 2024-12-23
777
-
778
- ### Added
779
-
780
- - 包括的なAPIリファレンスドキュメント (`docs/API.md`)
781
- - 3つの認証方式(IAM、Cognito、Token)の詳細な説明
782
- - すべてのクライアントAPIメソッドの完全な仕様
783
- - 型定義(Filter、UpdateOperators、結果型)の詳細
784
- - react-admin統合の使用方法
785
- - エラーハンドリングとベストプラクティス
786
- - コントリビューションガイド (`CONTRIBUTING.md`)
787
- - 開発環境のセットアップから本番リリースまでの完全なワークフロー
788
- - TypeScript、命名規則、JSDocコメントのコーディング規約
789
- - AAA パターンに基づくテストガイドライン
790
- - Conventional Commitsに基づくコミットメッセージ規約
791
- - セキュリティポリシー (`SECURITY.md`)
792
- - GitHub Security Advisoriesを使用した脆弱性報告手順
793
- - 責任ある開示プロセスと協調的開示タイムライン
794
- - 開発者・利用者向けのセキュリティベストプラクティス
795
-
796
- ### Changed
797
-
798
- - アーキテクチャリファクタリングによるコード構造の改善
799
- - 共通モジュールの抽出 (`src/shared/` ディレクトリ構造)
800
- - 大きな関数の分割(handler.ts ~520行 → 複数モジュール)
801
- - コードの重複排除と共通定数の統一
802
- - エラーハンドリングとログ記録の標準化
803
- - 依存関係管理と循環依存の解決
804
-
805
- ### Improved
806
-
807
- - コードの可読性と保守性の向上
808
- - 単一責任原則に基づく関数分割(50行制限)
809
- - 3回以上繰り返されるコードの共通関数化
810
- - エラーコード列挙型の拡張
811
-
812
- ## [0.4.1] - 2024-12-23
813
-
814
- ### Fixed
815
-
816
- - **Package**: Removed obsolete `bin` field for `generate-shadow-config`
817
- - CLI tool was removed in v0.3.2 but bin field was not removed from package.json
818
- - Eliminates pnpm warning about missing generate-shadow-config.js file
819
- - No functional changes - purely cleanup
820
-
821
- ## [0.4.0] - 2024-12-23
822
-
823
- ### Changed
824
-
825
- - **Architecture**: Major architecture refactoring for improved maintainability
826
- - Extracted shared modules to `src/shared/` directory structure
827
- - Organized dependencies and eliminated circular dependencies
828
- - Split large functions into modular components following single responsibility principle
829
- - Improved code organization with clear 5-layer architecture: integrations → client → server → shadows → shared
830
-
831
- ### Improved
832
-
833
- - **Code Quality**: Enhanced maintainability and readability
834
- - Split `handleFind` function (429 lines) into focused, testable modules
835
- - Created unified error hierarchy and common utilities
836
- - Standardized import paths and reduced code duplication
837
- - Added architecture documentation and dependency validation tests
838
-
839
- ### Technical
840
-
841
- - **Dependencies**: Established clear dependency direction without circular references
842
- - **Testing**: All 266 tests continue to pass with improved architecture
843
- - **Documentation**: Added comprehensive architecture documentation
844
- - **Package**: Removed obsolete `bin` field for `generate-shadow-config` CLI tool
845
-
846
- ## [0.3.7] - 2024-12-19
847
-
848
- ### Removed
849
-
850
- - **BREAKING CHANGE**: Complete removal of legacy shadow configuration support
851
- - Removed `LegacyShadowConfig` and `ResourceShadowConfig` types from shadows module
852
- - Removed duplicate shadow configuration types from server module
853
- - Removed all shadow.config.json file support
854
- - Only v0.3.x environment variable-based configuration is now supported
855
-
856
- ### Changed
857
-
858
- - Simplified type exports to only include v0.3.x specification types
859
- - Updated documentation to reflect complete v0.3.x migration
860
- - Consolidated shadow configuration to single source (environment variables)
861
-
862
- ### Migration Guide
863
-
864
- - Replace any usage of `ResourceShadowConfig` or `LegacyShadowConfig` with environment variables
865
- - Use `SHADOW_CREATED_AT_FIELD`, `SHADOW_UPDATED_AT_FIELD`, `SHADOW_STRING_MAX_BYTES`, `SHADOW_NUMBER_PADDING`
866
- - Remove any shadow.config.json files from your project
867
-
868
- ## [0.3.6] - 2024-12-02
869
-
870
- ### Changed
871
-
872
- - **Shadow Records**: Exclude `id` field from shadow record generation
873
- - `id` field no longer generates a shadow record
874
- - Main record (`SK = id#{ULID}`) is used for id-based sorting
875
- - Reduces redundant shadow records and improves performance
876
- - `find()` operation already optimized to use main records for id sorting
877
-
878
- ## [0.3.5] - 2024-12-02
879
-
880
- ### Changed
881
-
882
- - **Shadow Records**: Removed `data` field from shadow records
883
- - Shadow records now only contain `PK` and `SK` fields
884
- - Record ID is extracted from `SK` (format: `{field}#{value}#id#{recordId}`)
885
- - Reduces storage cost and simplifies data structure
886
- - No functional changes - ID extraction logic remains the same
887
-
888
- ## [0.3.4] - 2024-12-02
889
-
890
- ### Removed
891
-
892
- - **Metadata**: Removed internal metadata fields from records
893
- - Removed `__shadowKeys` field (no longer needed with auto-shadow)
894
- - Removed `__configVersion` field (no config file to track)
895
- - Removed `__configHash` field (no config file to track)
896
- - Records are now cleaner and contain only user data
897
- - **Terraform**: Removed `shadow_config` output from Terraform module
898
- - No longer needed with environment variable-based configuration
899
-
900
- ## [0.3.3] - 2024-12-02
901
-
902
- ### Fixed
903
-
904
- - **Types**: Made `shadows` property optional in `ResourceSchema` interface
905
- - Allows schemas without `shadows.sortableFields` definition
906
- - Maintains backward compatibility with v0.2.x schemas
907
- - All fields are automatically shadowed in v0.3.x
908
-
909
- ## [0.3.2] - 2024-12-02
910
-
911
- ### Changed
912
-
913
- - **Shadow Configuration**: Simplified shadow configuration (auto-shadow simplification)
914
- - Removed `shadow.config.json` file requirement
915
- - Removed `generate-shadow-config` CLI tool
916
- - All fields are now automatically shadowed without configuration
917
- - Simplified package structure and build process
918
-
919
- ## [0.3.1] - 2024-12-02
920
-
921
- ### Fixed
922
-
923
- - **Build**: Fixed TypeScript compilation errors
924
- - Fixed syntax errors in timestamps.ts and validation.ts
925
- - Updated ShadowConfig type imports
926
- - Removed unused getResourceSchema calls
927
- - **ESLint**: Fixed ESLint parsing errors for test files
928
- - Added separate ESLint configuration for test files
929
- - Configured `project: false` for test files excluded from tsconfig.json
930
-
931
- ## [0.3.0] - 2024-12-01
932
-
933
- ### Added
934
-
935
- - **Shadow Configuration**: Automatic field detection for all record types
936
- - Support for 6 field types: string, number, boolean, datetime, array, object
937
- - Automatic shadow generation for all fields in each record
938
- - Environment variable-based configuration (4 variables)
939
- - Comprehensive test suite (275 tests)
940
- - Updated documentation with new configuration guide
941
-
942
- ### Changed
943
-
944
- - **Shadow Configuration**: Simplified configuration management
945
- - Replaced JSON configuration files with environment variables
946
- - `SHADOW_CREATED_AT_FIELD` (default: `createdAt`)
947
- - `SHADOW_UPDATED_AT_FIELD` (default: `updatedAt`)
948
- - `SHADOW_STRING_MAX_BYTES` (default: `100`)
949
- - `SHADOW_NUMBER_PADDING` (default: `15`)
950
- - Primitive types truncated at 100 bytes
951
- - Complex types (array/object) truncated at 200 bytes
952
- - Number range: -10^15 to +10^15
953
-
954
- ### Removed
955
-
956
- - **Shadow Configuration**: Removed schema-based configuration
957
- - No longer requires `shadow.config.json` files
958
- - No longer requires schema definitions for shadow fields
959
- - Removed `generate-shadow-config` script
960
- - Records are now independent and self-contained
961
-
962
- ### Breaking Changes
963
-
964
- - **Shadow Configuration**: Configuration method has changed
965
- - Old: JSON configuration files with schema definitions
966
- - New: Environment variables with automatic field detection
967
- - Migration: Set environment variables and remove JSON config files
968
- - All fields are now automatically shadowed (no schema required)
969
-
970
- ## [0.2.2] - 2024-12-01
971
-
972
- ### Added
973
-
974
- - **Types**: Export `ResultBase` and `InputBase` from `@exabugs/dynamodb-client/client`
975
- - `ResultBase`: Base interface for document results (with required `id` field)
976
- - `InputBase`: Base interface for document inputs (with optional `id` field)
977
- - Allows users to extend `ResultBase` for type-safe collection definitions
978
- - Improves type safety when defining custom document interfaces
979
-
980
- ### Changed
981
-
982
- - **Client**: Updated `client/index.ts` to export base types
983
- - `export { Collection, type InputBase, type ResultBase } from './Collection.js'`
984
-
985
- ## [0.2.1] - 2025-01-19
986
-
987
- ### Fixed
988
-
989
- - **Server**: Removed `database` field validation from Lambda handler
990
- - Fixed runtime error: "Missing required field: database"
991
- - `MongoDBStyleRequest` interface no longer includes `database` field
992
- - `parseRequestBody()` function no longer validates `database` field
993
- - Completes the v0.2.0 breaking change implementation
994
-
995
- ### Added
996
-
997
- - **Tests**: Added comprehensive unit tests for Lambda handler
998
- - Request body parsing tests (7 tests)
999
- - MongoDB-style API operation tests (8 tests)
1000
- - v0.2.0 breaking change verification tests (2 tests)
1001
- - CORS and method validation tests (2 tests)
1002
- - Authentication header validation tests (2 tests)
1003
- - Total: 21 new tests to prevent regression
1004
-
1005
- ## [0.2.0] - 2024-12-01
1006
-
1007
- ### Changed
1008
-
1009
- - **BREAKING**: Removed `databaseName` parameter from all APIs
1010
- - `DynamoClient.db()` no longer requires a database name argument
1011
- - `createDataProvider()` no longer requires `databaseName` option
1012
- - `Database` class no longer stores or uses database name
1013
- - `Collection` and `FindCursor` no longer include database name in requests
1014
- - Simplified architecture: DynamoDB table is 1:1 with Lambda function
1015
- - For multi-tenant use cases, use separate DynamoDB tables instead
1016
-
1017
- ### Migration Guide
1018
-
1019
- **Before (v0.1.x):**
1020
-
1021
- ```typescript
1022
- const client = new DynamoClient(apiUrl);
1023
- await client.connect();
1024
- const db = client.db('myapp');
1025
- const collection = db.collection('users');
1026
-
1027
- const dataProvider = createDataProvider({
1028
- apiUrl: 'https://...',
1029
- databaseName: 'myapp',
1030
- tokenProvider,
1031
- });
1032
- ```
1033
-
1034
- **After (v0.2.0):**
1035
-
1036
- ```typescript
1037
- const client = new DynamoClient(apiUrl);
1038
- await client.connect();
1039
- const db = client.db();
1040
- const collection = db.collection('users');
1041
-
1042
- const dataProvider = createDataProvider({
1043
- apiUrl: 'https://...',
1044
- tokenProvider,
1045
- });
1046
- ```
1047
-
1048
- ## [0.1.2] - 2024-11-30
1049
-
1050
- ### Added
1051
-
1052
- - Boolean type support for shadow fields
1053
- - Added `'boolean'` to `ShadowFieldType`
1054
- - Added `formatBoolean()` function for boolean value formatting
1055
- - Boolean values are formatted as `'true'` or `'false'` strings
1056
- - Full test coverage for boolean shadow records
1057
-
1058
- ### Changed
1059
-
1060
- - Updated `formatFieldValue()` to handle boolean type
1061
- - Updated `generateShadowSK()` to support boolean values
1062
- - Exported `formatBoolean` from shadows module
1063
-
1064
- ## [0.1.0] - 2024-11-29
1065
-
1066
- ### Added
1067
-
1068
- - Initial release of @exabugs/dynamodb-client
1069
- - MongoDB-like API for DynamoDB Single-Table Design
1070
- - Shadow Records for efficient sorting and querying
1071
- - Multiple authentication methods:
1072
- - IAM authentication for server-side
1073
- - Cognito authentication for web applications
1074
- - Token authentication for custom scenarios
1075
- - Lambda function implementation with Function URL support
1076
- - react-admin integration for admin UIs
1077
- - Terraform modules for infrastructure deployment
1078
- - Comprehensive TypeScript support
1079
- - Full test coverage with Vitest
1080
-
1081
- ### Features
1082
-
1083
- - **Client SDK**: DynamoDB operations with MongoDB-like API
1084
- - `insertOne`, `insertMany`
1085
- - `findOne`, `find` with cursor support
1086
- - `updateOne`, `updateMany`
1087
- - `deleteOne`, `deleteMany`
1088
- - **Server Implementation**: Lambda handler for serverless deployments
1089
- - **Shadow Records**: Automatic generation and management for sorting
1090
- - **Advanced Filtering**: 7 operators (eq, lt, lte, gt, gte, starts, ends)
1091
- - **Bulk Operations**: Automatic chunking for large datasets
1092
- - **TTL Support**: Automatic data expiration
1093
-
1094
- [Unreleased]: https://github.com/exabugs/dynamodb-client/compare/v0.1.0...HEAD
1095
- [0.1.0]: https://github.com/exabugs/dynamodb-client/releases/tag/v0.1.0
31
+ - **型定義の改善**: `SingleRecordSelector`と`MultipleRecordsSelector`型を導入し、共通部分を抽出
32
+ - `UpdateOneParams`、`DeleteOneParams`: `{ id: string } | { filter: Record<string, unknown> }`
33
+ - `UpdateManyParams`、`DeleteManyParams`: `{ ids: string[] } | { filter: Record<string, unknown> }`