@exabugs/dynamodb-client 1.3.21 → 1.3.23
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 +43 -0
- package/dist/server/handler.cjs +14 -6
- package/dist/server/handler.cjs.map +2 -2
- package/dist/server/operations/updateMany.d.ts.map +1 -1
- package/dist/server/operations/updateMany.js +6 -2
- package/dist/server/operations/updateMany.js.map +1 -1
- package/dist/server/operations/updateOne.js +24 -12
- package/dist/server/operations/updateOne.js.map +1 -1
- package/dist/shared/types/index.d.ts +2 -0
- package/dist/shared/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.3.23] - 2026-01-05
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **テストファイル**: `$setOnInsert`オペレータの包括的なテストを追加
|
|
15
|
+
- `__tests__/operations/updateOne-setOnInsert.test.ts` (279行)
|
|
16
|
+
- `__tests__/operations/updateMany-setOnInsert.test.ts` (166行)
|
|
17
|
+
|
|
18
|
+
## [1.3.22] - 2026-01-05
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **$setOnInsert オペレータ**: MongoDB互換のupsert専用フィールド設定機能
|
|
23
|
+
- upsert時のinsert専用フィールドを指定可能(`$setOnInsert`)
|
|
24
|
+
- update時は`$setOnInsert`が無視され、`$set`のみが適用される
|
|
25
|
+
- `$set`と`$setOnInsert`で同じフィールドを指定した場合、`$set`が優先
|
|
26
|
+
- タイムスタンプ管理(`createdAt`は初回のみ、`updatedAt`は常に更新)が明確に
|
|
27
|
+
- MongoDB公式ドキュメントと完全互換
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- **UpdateOperators型**: `$setOnInsert?: Partial<T>` フィールドを追加
|
|
32
|
+
- **handleUpsertCreate**: `$set`と`$setOnInsert`をマージして新規作成(`$set`が優先)
|
|
33
|
+
- **handleUpsertUpdate**: `$setOnInsert`を無視して`$set`のみを適用
|
|
34
|
+
|
|
35
|
+
### Documentation
|
|
36
|
+
|
|
37
|
+
- **API.md**: `$setOnInsert`オペレータの詳細な説明を追加
|
|
38
|
+
- 動作仕様(insert時/update時の挙動)
|
|
39
|
+
- 使用例とコードスニペット
|
|
40
|
+
- MongoDB互換性の説明
|
|
41
|
+
- ユースケース(タイムスタンプ管理、デフォルト値設定、初期ステータス)
|
|
42
|
+
|
|
43
|
+
### Technical
|
|
44
|
+
|
|
45
|
+
- **テスト**: 包括的なテストカバレッジ(単体テスト・統合テスト)
|
|
46
|
+
- insert時に`$set`と`$setOnInsert`の両方を適用するテスト
|
|
47
|
+
- update時に`$setOnInsert`を無視するテスト
|
|
48
|
+
- `$set`が`$setOnInsert`より優先されるテスト
|
|
49
|
+
- `createdAt`の保持テスト
|
|
50
|
+
- シャドウレコード生成の確認
|
|
51
|
+
- 後方互換性テスト(従来のパッチ形式)
|
|
52
|
+
|
|
10
53
|
## [1.3.21] - 2026-01-04
|
|
11
54
|
|
|
12
55
|
### Changed
|
package/dist/server/handler.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @exabugs/dynamodb-client v1.3.
|
|
2
|
-
// Built: 2026-01-
|
|
1
|
+
// @exabugs/dynamodb-client v1.3.23
|
|
2
|
+
// Built: 2026-01-05T00:59:44.822Z
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -31504,7 +31504,8 @@ async function handleUpdateMany(resource, params, requestId) {
|
|
|
31504
31504
|
const existingData = item.data;
|
|
31505
31505
|
const id = existingData.id;
|
|
31506
31506
|
const oldShadowKeys = existingData.__shadowKeys || [];
|
|
31507
|
-
const
|
|
31507
|
+
const actualPatchData = patchData.$set ? patchData.$set : patchData;
|
|
31508
|
+
const mergedData = applyJsonMergePatch(removeShadowKeys(existingData), actualPatchData);
|
|
31508
31509
|
const updatedData = addUpdateTimestamp({
|
|
31509
31510
|
...mergedData,
|
|
31510
31511
|
id
|
|
@@ -31762,7 +31763,13 @@ async function handleUpdateOne(resource, params, requestId) {
|
|
|
31762
31763
|
}
|
|
31763
31764
|
__name(handleUpdateOne, "handleUpdateOne");
|
|
31764
31765
|
async function handleUpsertCreate(resource, id, data2, requestId) {
|
|
31765
|
-
const
|
|
31766
|
+
const $set = data2.$set || {};
|
|
31767
|
+
const $setOnInsert = data2.$setOnInsert || {};
|
|
31768
|
+
const mergedData = {
|
|
31769
|
+
...$setOnInsert,
|
|
31770
|
+
...$set
|
|
31771
|
+
};
|
|
31772
|
+
const recordData = addCreateTimestamps({ ...mergedData, id });
|
|
31766
31773
|
const shadowConfig = getShadowConfig();
|
|
31767
31774
|
const shadowRecords = generateShadowRecords(recordData, resource, shadowConfig);
|
|
31768
31775
|
const shadowKeys = shadowRecords.map((shadow) => shadow.SK);
|
|
@@ -31811,7 +31818,8 @@ __name(handleUpsertCreate, "handleUpsertCreate");
|
|
|
31811
31818
|
async function handleUpsertUpdate(resource, id, existingItem, patchData, requestId) {
|
|
31812
31819
|
const existingData = existingItem.data;
|
|
31813
31820
|
const oldShadowKeys = existingData.__shadowKeys || [];
|
|
31814
|
-
const
|
|
31821
|
+
const actualPatchData = patchData.$set ? patchData.$set : patchData;
|
|
31822
|
+
const mergedData = applyJsonMergePatch2(removeShadowKeys(existingData), actualPatchData);
|
|
31815
31823
|
const updatedData = addUpdateTimestamp({
|
|
31816
31824
|
...mergedData,
|
|
31817
31825
|
id
|
|
@@ -33459,7 +33467,7 @@ async function handler(event) {
|
|
|
33459
33467
|
return createCorsResponse(HTTP_STATUS.OK);
|
|
33460
33468
|
}
|
|
33461
33469
|
if (event.requestContext.http.method === "GET" && event.requestContext.http.path === "/version") {
|
|
33462
|
-
const version = "1.3.
|
|
33470
|
+
const version = "1.3.23";
|
|
33463
33471
|
return createSuccessResponse({ version, timestamp: (/* @__PURE__ */ new Date()).toISOString() }, requestId);
|
|
33464
33472
|
}
|
|
33465
33473
|
if (event.requestContext.http.method !== "POST") {
|