graphddb 0.2.3 → 0.2.5
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/README.md +339 -284
- package/dist/{chunk-FWDJSGF3.js → chunk-4TYK3AV6.js} +911 -173
- package/dist/{chunk-CVUDLLRS.js → chunk-ITHQ2EDH.js} +1 -1
- package/dist/{chunk-NJEC76TX.js → chunk-SGYBE2OV.js} +417 -47
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +269 -12
- package/dist/index.js +13 -3
- package/dist/testing/index.d.ts +5 -5
- package/dist/testing/index.js +9 -6
- package/dist/{types-SKxZQbQO.d.ts → types--tdHK3vi.d.ts} +828 -165
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
# GraphDDB
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**DynamoDB のための型安全な Graph Query Runtime**
|
|
4
4
|
|
|
5
|
-
GraphDDB
|
|
6
|
-
PK
|
|
5
|
+
GraphDDB は DynamoDB のネイティブなアクセスパターンを GraphQL ライクなクエリモデルにマッピングする。
|
|
6
|
+
PK、GSI、Projection、Relation、Cursor、そして操作の上限(limit)はすべて隠さず可視に保たれる。
|
|
7
7
|
|
|
8
|
-
GraphDDB
|
|
9
|
-
|
|
8
|
+
GraphDDB は ORM ではない。
|
|
9
|
+
TypeScript の型を使って DynamoDB のアクセスパターンを定義・検証・実行するための Runtime である。
|
|
10
10
|
|
|
11
|
-
## Why GraphDDB?
|
|
11
|
+
## 🤔 Why GraphDDB?
|
|
12
12
|
|
|
13
|
-
DynamoDB
|
|
14
|
-
RDBMS
|
|
15
|
-
ORM
|
|
16
|
-
|
|
13
|
+
DynamoDB は高速でスケーラブルだが、誤った設計をしやすい。チームはしばしば DynamoDB を
|
|
14
|
+
RDBMS のように扱い —— エンティティごとに1テーブル、アプリケーションコード内での join、
|
|
15
|
+
ORM 抽象の裏に隠れたその場しのぎのアクセスパターン —— その結果、不安定なパフォーマンス、
|
|
16
|
+
不要な GSI、不明瞭なサービス境界に陥る。
|
|
17
17
|
|
|
18
|
-
GraphDDB
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
GraphDDB は逆のアプローチを取る。DynamoDB のアクセスパターンを **コードに直接** 表現し、
|
|
19
|
+
PK/GSI、projection、relation、cursor、操作の上限を可視に保つ。アクセスパターンと relation が
|
|
20
|
+
明示的になり、クエリプランが検査可能になり、よく設計されたアクセスパターンが自然と
|
|
21
|
+
サービス境界に整合する。GraphDDB は DynamoDB の設計を教えるのではない —— 正しい設計を、
|
|
22
|
+
コードを書く上で最も簡単な道にする。
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
access patterns:
|
|
24
|
+
これは GraphQL のクエリモデルと DynamoDB のアクセスパターンの自然な対応関係を通じて実現される:
|
|
26
25
|
|
|
27
26
|
```text
|
|
28
27
|
GraphQL Query Model DynamoDB
|
|
@@ -33,33 +32,33 @@ connection ----> Cursor pagination
|
|
|
33
32
|
complexity ----> Operation limits
|
|
34
33
|
```
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
selection set
|
|
38
|
-
|
|
35
|
+
Partition Key は Graph のエントリポイントであり、relation は明示的な traversal パスであり、
|
|
36
|
+
projection は selection set である。GraphDDB はクエリ言語を発明しない —— よく設計された
|
|
37
|
+
アクセスパターンを直接実行し、plan・limit・relation 解決を通じて曖昧さを可視化する。
|
|
39
38
|
|
|
40
|
-
## Install
|
|
39
|
+
## 📦 Install
|
|
41
40
|
|
|
42
41
|
```bash
|
|
43
42
|
npm install graphddb
|
|
44
43
|
```
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
AWS SDK v3 は peer dependency である —— 使用するクライアントをインストールすること:
|
|
47
46
|
|
|
48
47
|
```bash
|
|
49
48
|
npm install @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb
|
|
50
49
|
```
|
|
51
50
|
|
|
52
|
-
`tsx`
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
`tsx` は optional な peer dependency で、コード生成 CLI(`graphddb generate …`)を
|
|
52
|
+
TypeScript の定義ファイルに対して直接実行する場合にのみ必要となる。ライブラリの利用者には
|
|
53
|
+
不要である(そのため esbuild がランタイムバンドルに混入することはない):
|
|
55
54
|
|
|
56
55
|
```bash
|
|
57
56
|
npm install -D tsx
|
|
58
57
|
```
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
Node.js ≥ 22 が必要。
|
|
61
60
|
|
|
62
|
-
## Quick Start
|
|
61
|
+
## 🚀 Quick Start
|
|
63
62
|
|
|
64
63
|
```ts
|
|
65
64
|
import { DDBModel, model, string, key, k } from 'graphddb';
|
|
@@ -77,28 +76,76 @@ class UserModel extends DDBModel {
|
|
|
77
76
|
}
|
|
78
77
|
const User = UserModel.asModel();
|
|
79
78
|
|
|
80
|
-
//
|
|
81
|
-
|
|
79
|
+
// DynamoDB クライアントは一度だけ接続する。GraphDDB が throttle / transient の retry を
|
|
80
|
+
// 所有するため(後述の "Retry & throttling" を参照)、クライアントは `maxAttempts: 1` に設定し、
|
|
81
|
+
// 二重 retry(SDK × ライブラリ)を避けること。
|
|
82
|
+
DDBModel.setClient(new DynamoDBClient({ maxAttempts: 1 }));
|
|
82
83
|
|
|
83
|
-
// Read
|
|
84
|
+
// Read —— 結果の型に現れるのは select したフィールドのみ。
|
|
84
85
|
const user = await User.query({ userId: 'alice' }, { name: true });
|
|
85
86
|
|
|
86
|
-
//
|
|
87
|
+
// 単一アイテムの書き込み —— DynamoDB API にちなんで名付けられた raw な base 操作。
|
|
87
88
|
await User.putItem({ userId: 'alice', name: 'Alice' });
|
|
88
89
|
|
|
89
|
-
//
|
|
90
|
+
// 複数アイテムの atomic な書き込み —— 統一 envelope(デフォルト `mode: 'transaction'`)。
|
|
90
91
|
await DDBModel.mutate({
|
|
91
92
|
user: { update: User, key: { userId: 'alice' }, input: { name: 'Alice B.' } },
|
|
92
93
|
});
|
|
93
94
|
```
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
クロスサービス contract、Python bridge、複数 fragment の atomic mutation などについては、
|
|
97
|
+
以下の各セクションおよび [`docs/spec.md`](./docs/spec.md) を参照。
|
|
97
98
|
|
|
98
|
-
##
|
|
99
|
+
## 🔁 Retry & throttling
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
GraphDDB は **すべての** 単一アイテム操作(`GetItem` / `Query` / `PutItem` / `UpdateItem` /
|
|
102
|
+
`DeleteItem`)、relation read の fan-out、そして `TransactWriteItems` に対して、throttle /
|
|
103
|
+
transient エラーの retry を行う —— 設定不要で、すぐに使える。デフォルトのポリシーは
|
|
104
|
+
full jitter 付きの指数バックオフ(`min(1000, 50·2^(n-1))` ms)で、最大 10 回まで、
|
|
105
|
+
throttle / 5xx / transient エラーのみを retry する(`ValidationException` や
|
|
106
|
+
条件チェック失敗は決して retry しない)。キャンセルされた transaction は理由ごとに
|
|
107
|
+
検査される: `ConditionalCheckFailed` の理由は即座に throw し、純粋に throttle による
|
|
108
|
+
キャンセルは retry される。
|
|
109
|
+
|
|
110
|
+
> これはライブラリ自身の **error retry** であり、`batchGet` / `batchWrite` が既に行う
|
|
111
|
+
> 部分バッチの `UnprocessedKeys` / `UnprocessedItems` retry とは別物である。両者は同じ
|
|
112
|
+
> バックオフのランプを使うが、独立したメカニズムである。
|
|
113
|
+
|
|
114
|
+
**クライアントは `maxAttempts: 1` に設定すること。** ライブラリが retry を所有する以上、
|
|
115
|
+
AWS SDK をデフォルト(`maxAttempts: 3`)のままにすると、GraphDDB の下層で
|
|
116
|
+
*乗算的に* retry してしまう。ライブラリを単一の真実の源とすること:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
DDBModel.setClient(new DynamoDBClient({ maxAttempts: 1 }));
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
GraphDDB は渡されたクライアントを決して変更しない —— この設定はあなたの責任である。
|
|
123
|
+
|
|
124
|
+
ポリシーはグローバルに、あるいは呼び出しごとに調整できる:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import { DDBModel } from 'graphddb';
|
|
128
|
+
|
|
129
|
+
// グローバルな上書き(setClient / setTableMapping と同様)。`null` でデフォルトに戻る。
|
|
130
|
+
DDBModel.setRetryPolicy({
|
|
131
|
+
maxAttempts: 5,
|
|
132
|
+
jitter: 'full', // または 'none'
|
|
133
|
+
onRetry: ({ attempt, error, delayMs, operation }) => {
|
|
134
|
+
console.warn(`retry #${attempt} of ${operation} after ${delayMs}ms`, error);
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// 任意の操作の options での呼び出しごとの上書き(`RetryPolicy | false`)。`false` で retry 無効。
|
|
139
|
+
await User.putItem({ userId: 'alice', name: 'Alice' }, { retry: false });
|
|
140
|
+
await User.query({ userId: 'alice' }, { name: true }, { retry: { maxAttempts: 3 } });
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## 👥 User Permissions Example
|
|
144
|
+
|
|
145
|
+
[user-permissions](./examples/user-permissions/) の例は、ユーザー・グループ・メンバーシップ・
|
|
146
|
+
パーミッションを単一の DynamoDB テーブルでモデル化している。
|
|
147
|
+
ここで GraphDDB の設計が最も分かりやすく見えてくる: テーブルは物理的だが、クエリの表面は
|
|
148
|
+
Graph の形をしている。
|
|
102
149
|
|
|
103
150
|
```text
|
|
104
151
|
UserPermissions table
|
|
@@ -110,12 +157,12 @@ GroupMembership GROUP#<groupId> USER#<userId> USER#<userId>
|
|
|
110
157
|
Permission GROUP#<groupId> PERM#<resource>#<action>
|
|
111
158
|
```
|
|
112
159
|
|
|
113
|
-
`GroupMembership`
|
|
160
|
+
`GroupMembership` は隣接リスト(adjacency list)パターンを使う:
|
|
114
161
|
|
|
115
|
-
- `PK/SK`
|
|
116
|
-
- `GSI1PK/GSI1SK`
|
|
162
|
+
- `PK/SK` はグループのメンバーを読む
|
|
163
|
+
- `GSI1PK/GSI1SK` はユーザーが所属するグループを読む
|
|
117
164
|
|
|
118
|
-
|
|
165
|
+
同じ物理テーブルが、キーを隠すことなく両方向をサポートする。
|
|
119
166
|
|
|
120
167
|
```ts
|
|
121
168
|
const engGroup = await Group.query(
|
|
@@ -134,9 +181,9 @@ const engGroup = await Group.query(
|
|
|
134
181
|
},
|
|
135
182
|
);
|
|
136
183
|
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
184
|
+
// email(GSI)でユーザーを探し、所属グループを一覧し、各グループについてグループ本体と
|
|
185
|
+
// そのパーミッションを取得する。N 件の membership -> 親 Group の解決は単一の
|
|
186
|
+
// BatchGetItem に集約される(N+1 にならない)。
|
|
140
187
|
const alice = await User.query(
|
|
141
188
|
{ email: 'alice@example.com' },
|
|
142
189
|
{
|
|
@@ -163,24 +210,29 @@ const alice = await User.query(
|
|
|
163
210
|
);
|
|
164
211
|
```
|
|
165
212
|
|
|
166
|
-
|
|
213
|
+
最初のクエリは、小さく検査可能な DynamoDB plan に展開される:
|
|
167
214
|
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
215
|
+
```mermaid
|
|
216
|
+
flowchart LR
|
|
217
|
+
Q(["Group.query<br/>groupId: eng"]) --> S1["1 Query<br/>PK=GROUP#eng, SK=META<br/>→ Group"]
|
|
218
|
+
Q --> S2["2 Query<br/>PK=GROUP#eng, SK begins_with USER#<br/>→ members"]
|
|
219
|
+
Q --> S3["3 Query<br/>PK=GROUP#eng, SK begins_with PERM#<br/>→ permissions"]
|
|
220
|
+
S2 -.並列ディスパッチ.- S3
|
|
172
221
|
```
|
|
173
222
|
|
|
174
|
-
|
|
223
|
+
独立した relation のサブクエリ(ここでは `members` と `permissions`)は並列にディスパッチされる。
|
|
224
|
+
2番目のクエリの `belongsTo` 解決は N 件の lookup を1回の `BatchGetItem` にバッチ化する。
|
|
225
|
+
並列ディスパッチを示すタイムラインは [example](./examples/user-permissions/) を参照。
|
|
175
226
|
|
|
176
|
-
## Usage
|
|
227
|
+
## 📖 Usage
|
|
177
228
|
|
|
178
|
-
|
|
229
|
+
以下のスニペットは [user-permissions](./examples/user-permissions/) の例を圧縮したものである。
|
|
179
230
|
|
|
180
231
|
### Entity Definition
|
|
181
232
|
|
|
182
|
-
|
|
183
|
-
**
|
|
233
|
+
TypeScript クラスが単一の真実の源(single source of truth)である。Key と GSI は `k`
|
|
234
|
+
タグ付きテンプレートの **segment** から構築され、key builder の入力型がそのまま
|
|
235
|
+
クエリパラメータの型になる。
|
|
184
236
|
|
|
185
237
|
```ts
|
|
186
238
|
const TABLE = 'UserPermissions';
|
|
@@ -230,18 +282,18 @@ export const User = UserModel.asModel();
|
|
|
230
282
|
export const GroupMembership = GroupMembershipModel.asModel();
|
|
231
283
|
```
|
|
232
284
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
[
|
|
285
|
+
複数 segment の sort key は segment の配列である(例: `sk: [k\`PERM#${c.resource}\`, k\`${c.action}\`]`)。
|
|
286
|
+
partial key はマッチする segment 境界で `begins_with` にコンパイルされる。完全なキーモデルは
|
|
287
|
+
[仕様書](./docs/spec.md) を参照。
|
|
236
288
|
|
|
237
289
|
### GraphQL-like Queries
|
|
238
290
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
291
|
+
第1引数は「どうやってデータを見つけるか」を記述する。
|
|
292
|
+
第2引数は「何を返すか」を記述する。
|
|
293
|
+
Runtime は与えられたフィールド名から、どのインデックスを使うかを解決する。
|
|
242
294
|
|
|
243
295
|
```ts
|
|
244
|
-
//
|
|
296
|
+
// email でユーザーを取得し、group membership へ traverse する。
|
|
245
297
|
const alice = await User.query(
|
|
246
298
|
{ email: 'alice@example.com' },
|
|
247
299
|
{
|
|
@@ -254,11 +306,11 @@ const alice = await User.query(
|
|
|
254
306
|
},
|
|
255
307
|
);
|
|
256
308
|
|
|
257
|
-
//
|
|
309
|
+
// 未定義のキーフィールド -> コンパイルエラー
|
|
258
310
|
User.query({ foo: 'bar' }, { name: true });
|
|
259
311
|
```
|
|
260
312
|
|
|
261
|
-
|
|
313
|
+
返り値の型は `select` から推論される:
|
|
262
314
|
|
|
263
315
|
```ts
|
|
264
316
|
// alice: {
|
|
@@ -282,21 +334,21 @@ const result = await GroupMembership.list(
|
|
|
282
334
|
// result.cursor: string | null
|
|
283
335
|
```
|
|
284
336
|
|
|
285
|
-
### Filtering
|
|
337
|
+
### Filtering(サーバーサイド `filter`)
|
|
286
338
|
|
|
287
|
-
`filter`
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
339
|
+
`filter` は宣言的で型安全な条件であり、DynamoDB の **`FilterExpression`** にコンパイルされ、
|
|
340
|
+
**サーバーサイド** で評価される。AWS AppSync の `ModelFilterInput` をモデルにしている:
|
|
341
|
+
裸の値は等価の省略記法、operator オブジェクトは比較を表現し、`and` / `or` / `not` で
|
|
342
|
+
論理グループを構築する。**エンティティ全体** に対して型付けされるため、`select` に **含まれない**
|
|
343
|
+
属性も参照できる。
|
|
292
344
|
|
|
293
345
|
```ts
|
|
294
346
|
const result = await Order.list(
|
|
295
347
|
{ userId: 'u001' },
|
|
296
|
-
{ orderId: true }, // amount / status
|
|
348
|
+
{ orderId: true }, // amount / status は projection 不要
|
|
297
349
|
{
|
|
298
350
|
filter: {
|
|
299
|
-
status: 'confirmed', // #status = :v (
|
|
351
|
+
status: 'confirmed', // #status = :v (等価の省略記法)
|
|
300
352
|
amount: { gt: 100 }, // #amount > :v
|
|
301
353
|
title: { beginsWith: 'A' }, // begins_with(#title, :v)
|
|
302
354
|
shippedAt: { attributeExists: true },
|
|
@@ -306,44 +358,44 @@ const result = await Order.list(
|
|
|
306
358
|
);
|
|
307
359
|
```
|
|
308
360
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
361
|
+
Relation は対象モデルの `Model.relation(...)` を通じて同じ `filter` を取る。サーバーサイドの
|
|
362
|
+
`FilterExpression` で表現できないロジックには、返された projection に対して
|
|
363
|
+
`result.items.filter(...)` を呼ぶこと —— 各 select フィールドの宣言済みスカラー型が保たれるため、
|
|
364
|
+
`o.amount > 100` はキャスト不要である(組み込みの post-load 述語は存在しない)。
|
|
313
365
|
|
|
314
|
-
|
|
315
|
-
`between
|
|
316
|
-
`attributeType
|
|
317
|
-
|
|
318
|
-
|
|
366
|
+
利用可能な operator(フィールド型ごと): `eq`、`ne`、`ge`、`le`、`gt`、`lt`、
|
|
367
|
+
`between`、`in`、`beginsWith`、`contains`、`notContains`、`attributeExists`、
|
|
368
|
+
`attributeType`、`size`。operator は **フィールドの宣言型によって制約される** ——
|
|
369
|
+
例えば数値フィールドへの `beginsWith` / `contains`、あるいは数値への `gt: 'x'` は
|
|
370
|
+
コンパイルエラーになる。
|
|
319
371
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
`Model.col.<field>`
|
|
372
|
+
operator オブジェクトでは表現できない稀な条件のために、`cond` という raw な escape hatch が
|
|
373
|
+
式 fragment を受け取る。カラム名は bare な文字列ではなく、リファクタ安全な
|
|
374
|
+
`Model.col.<field>` 参照を使わなければならない。値はパラメータ化される:
|
|
323
375
|
|
|
324
376
|
```ts
|
|
325
377
|
filter: cond`${Order.col.amount} > ${100} AND attribute_exists(${Order.col.status})`
|
|
326
378
|
```
|
|
327
379
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
380
|
+
すべての値はパラメータ化され(`ExpressionAttributeValues`)、すべてのカラム名は
|
|
381
|
+
エイリアス化される(`ExpressionAttributeNames`)—— リテラルの補間は存在しないため、
|
|
382
|
+
コンパイルされた式はインジェクション安全であり、`KeyConditionExpression` /
|
|
383
|
+
`ProjectionExpression` とは独立して付与される。
|
|
332
384
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
385
|
+
同じ `cond` fragment は read filter としてだけでなく、書き込みの `condition`
|
|
386
|
+
(`putItem` / `updateItem` / `deleteItem`、transaction item、public command に対して)
|
|
387
|
+
としても受け付けられる。
|
|
336
388
|
|
|
337
|
-
> **RCU
|
|
338
|
-
> DynamoDB
|
|
339
|
-
>
|
|
340
|
-
>
|
|
341
|
-
>
|
|
389
|
+
> **RCU に関する注意:** `FilterExpression` は read capacity を **削減しない** ——
|
|
390
|
+
> DynamoDB はまずマッチするキーを読み、その後に filter する。`limit` は filter の
|
|
391
|
+
> **前** に適用されるため、1ページが `limit` **未満** のアイテムを返すことがある
|
|
392
|
+
> (そしてページ全体が filter で除外された場合、null でない cursor を持つ空ページになる)。
|
|
393
|
+
> 効率的な絞り込みのためにキーを設計し、`filter` は正しさのために使うこと。
|
|
342
394
|
|
|
343
395
|
### Writes
|
|
344
396
|
|
|
345
|
-
|
|
346
|
-
|
|
397
|
+
raw な base テーブルの書き込みは `putItem` / `updateItem` / `deleteItem` である ——
|
|
398
|
+
ライフサイクルのセマンティクスを持たないプリミティブな単一アイテム操作:
|
|
347
399
|
|
|
348
400
|
```ts
|
|
349
401
|
await User.putItem({
|
|
@@ -362,19 +414,18 @@ await GroupMembership.putItem({
|
|
|
362
414
|
await User.updateItem({ userId: 'alice' }, { status: 'disabled' });
|
|
363
415
|
```
|
|
364
416
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
[The in-process unified envelope](#the-in-process-unified-envelope)
|
|
417
|
+
ライフサイクルを意識した単一書き込み —— 条件ゲート、read-back、参照整合的な副作用 ——
|
|
418
|
+
は raw なプリミティブではなく `DDBModel.mutate` を経由する(後述の
|
|
419
|
+
[The in-process unified envelope](#the-in-process-unified-envelope) を参照)。
|
|
368
420
|
|
|
369
421
|
### The in-process unified envelope
|
|
370
422
|
|
|
371
|
-
`DDBModel.query`
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
aliases.
|
|
423
|
+
`DDBModel.query` と `DDBModel.mutate` は、1回の呼び出しで複数の route を実行する単一の
|
|
424
|
+
**alias-map envelope** を取る。これは GraphQL operation の in-process 版である:
|
|
425
|
+
各 alias は名前付きの route であり、結果は同じ alias でキー付けされる。
|
|
375
426
|
|
|
376
|
-
`DDBModel.query(map)`
|
|
377
|
-
|
|
427
|
+
`DDBModel.query(map)` は各 read route を独立かつ並列に実行する —— route 間の
|
|
428
|
+
一貫性はなく、GraphQL の並列フィールド解決とまったく同じである:
|
|
378
429
|
|
|
379
430
|
```ts
|
|
380
431
|
const { user, members } = await DDBModel.query({
|
|
@@ -384,12 +435,12 @@ const { user, members } = await DDBModel.query({
|
|
|
384
435
|
// user: Item | null ; members: { items, cursor }
|
|
385
436
|
```
|
|
386
437
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
`{ consistentRead?, maxDepth? }
|
|
438
|
+
read route の記述子は `{ query | list: Model, key, select, options? }` である
|
|
439
|
+
(`query` / `list` のいずれか一方)。`query` の `options` は
|
|
440
|
+
`{ consistentRead?, maxDepth? }`、`list` の場合は `{ limit?, after?, order?, filter? }` である。
|
|
390
441
|
|
|
391
|
-
`DDBModel.mutate(map, { mode })`
|
|
392
|
-
`{ create | update | remove: Model, key, input?, condition?, result? }
|
|
442
|
+
`DDBModel.mutate(map, { mode })` は write route を実行する。write route の記述子は
|
|
443
|
+
`{ create | update | remove: Model, key, input?, condition?, result? }` である:
|
|
393
444
|
|
|
394
445
|
```ts
|
|
395
446
|
const res = await DDBModel.mutate({
|
|
@@ -398,32 +449,30 @@ const res = await DDBModel.mutate({
|
|
|
398
449
|
}, { mode: 'transaction' });
|
|
399
450
|
```
|
|
400
451
|
|
|
401
|
-
- **`key`**
|
|
402
|
-
transaction
|
|
403
|
-
`BatchWriteItem
|
|
404
|
-
- **`condition`**
|
|
405
|
-
operator
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
-
|
|
412
|
-
all-or-nothing
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
per-field partial success; and `query` routes are parallel independent reads with
|
|
421
|
-
no cross-route consistency.
|
|
452
|
+
- **`key`** は単一のオブジェクト、または **オブジェクトの配列**(key-array bulk)である。
|
|
453
|
+
transaction は `TransactWriteItems` にコンパイルされ、parallel モードは
|
|
454
|
+
`BatchWriteItem`(チャンク分割され、`UnprocessedItems` retry 付き)にコンパイルされる。
|
|
455
|
+
- **`condition`** は `WriteCondition` の書き込みゲートである —— read filter と同じ宣言的
|
|
456
|
+
operator のサブセット(`eq`/`ne`/比較/`between`/`in`/文字列操作/`size`/`attributeType` +
|
|
457
|
+
`and`/`or`/`not`)、レガシーな存在プリミティブ(`notExists` / `attributeExists` /
|
|
458
|
+
`attributeNotExists`)、または raw な `cond` fragment。
|
|
459
|
+
- **`result: { select, options? }`** は書き込んだアイテムを read-back する。省略すると
|
|
460
|
+
その route は void を返す。
|
|
461
|
+
- **`mode: 'transaction'`**(デフォルト)は1回の atomic な `TransactWriteItems` である:
|
|
462
|
+
all-or-nothing のロールバック、失敗時に throw、25 件を超える map はエラーになる
|
|
463
|
+
(決して分割されない)。これは GraphQL の all-or-nothing な atomic 契約である。
|
|
464
|
+
- **`mode: 'parallel'`** は非 atomic である: 各 alias は結果オブジェクト内で
|
|
465
|
+
`{ ok }` | `{ error }` として部分的な成否を報告し、GraphQL のフィールドごとの
|
|
466
|
+
部分成功を反映する。独立した操作は並列に実行され、依存関係は `$.alias.field`
|
|
467
|
+
参照で順序付けられる。
|
|
468
|
+
|
|
469
|
+
GraphQL の用語で言えば: transaction は atomic な all-or-nothing、parallel は非 atomic な
|
|
470
|
+
フィールドごとの部分成功、そして `query` route は route 間の一貫性を持たない並列独立 read である。
|
|
422
471
|
|
|
423
472
|
### Inspect Execution Plans
|
|
424
473
|
|
|
425
|
-
`explain()`
|
|
426
|
-
`select`
|
|
474
|
+
`explain()` は、実行される前の DynamoDB 操作を表示する。
|
|
475
|
+
`select` は `ProjectionExpression` に変換されるため、要求した属性のみが読まれる。
|
|
427
476
|
|
|
428
477
|
```ts
|
|
429
478
|
const plan = GroupMembership.explain(
|
|
@@ -445,7 +494,7 @@ const plan = GroupMembership.explain(
|
|
|
445
494
|
// }
|
|
446
495
|
```
|
|
447
496
|
|
|
448
|
-
|
|
497
|
+
partial な GSI キーマッチの場合、SK 条件は `rangeCondition` として分離される:
|
|
449
498
|
|
|
450
499
|
```ts
|
|
451
500
|
const gsiPlan = GroupMembership.explain(
|
|
@@ -467,33 +516,33 @@ const gsiPlan = GroupMembership.explain(
|
|
|
467
516
|
// }
|
|
468
517
|
```
|
|
469
518
|
|
|
470
|
-
## Core Concepts
|
|
519
|
+
## 🧠 Core Concepts
|
|
471
520
|
|
|
472
521
|
### Entity = Access Pattern
|
|
473
522
|
|
|
474
|
-
|
|
475
|
-
|
|
523
|
+
Entity は ORM モデルではない。
|
|
524
|
+
DynamoDB に対する、境界付けられたアクセス表面(bounded access surface)である。
|
|
476
525
|
|
|
477
|
-
|
|
526
|
+
Entity は、サービス境界内でデータにアクセスする、サポートされたすべての方法を定義する:
|
|
478
527
|
|
|
479
|
-
-
|
|
480
|
-
-
|
|
481
|
-
-
|
|
482
|
-
-
|
|
483
|
-
- traversal
|
|
528
|
+
- 物理キー
|
|
529
|
+
- GSI
|
|
530
|
+
- relation
|
|
531
|
+
- projection
|
|
532
|
+
- traversal ルール
|
|
484
533
|
|
|
485
|
-
|
|
486
|
-
|
|
534
|
+
物理的には、Entity は DynamoDB の item にマップされる。
|
|
535
|
+
アーキテクチャ的には、サービスのその部分に許可されたアクセス表面を定義する。
|
|
487
536
|
|
|
488
537
|
### Key / GSI = Structured Segments
|
|
489
538
|
|
|
490
|
-
`key()`
|
|
491
|
-
|
|
539
|
+
`key()` と `gsi()` は `k` タグ付きテンプレートの **segment** からキーを構築する。builder の
|
|
540
|
+
入力型がキー解決に必要なフィールドを定義し、同時にクエリパラメータの型にもなる。
|
|
492
541
|
|
|
493
542
|
```ts
|
|
494
|
-
//
|
|
495
|
-
// 1.
|
|
496
|
-
// 2.
|
|
543
|
+
// 1つの定義が2つの役割を果たす:
|
|
544
|
+
// 1. 書き込みパス: Entity 保存時に PK/SK を生成
|
|
545
|
+
// 2. クエリパス: User.query({ email: ... }) のパラメータ型を定義
|
|
497
546
|
static readonly emailIndex = gsi<{ email: string }>(
|
|
498
547
|
'GSI1',
|
|
499
548
|
(c) => ({ pk: k`EMAIL#${c.email}`, sk: k`PROFILE` }),
|
|
@@ -501,14 +550,14 @@ static readonly emailIndex = gsi<{ email: string }>(
|
|
|
501
550
|
);
|
|
502
551
|
```
|
|
503
552
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
553
|
+
キーは不透明な文字列ではなく構造化された segment であるため、partial key —— sort-key
|
|
554
|
+
segment の先頭プレフィックスのみを与えたもの —— はその segment 境界で `begins_with` に
|
|
555
|
+
コンパイルされる。これが relation と prefix クエリの解決方法である。
|
|
507
556
|
|
|
508
557
|
### Relation = Bound Query
|
|
509
558
|
|
|
510
|
-
|
|
511
|
-
|
|
559
|
+
Relation は、親 Entity の値にバインドされたクエリである。
|
|
560
|
+
同じ解決ロジックが適用される: runtime はフィールド名を Key / GSI 定義に照合する。
|
|
512
561
|
|
|
513
562
|
```ts
|
|
514
563
|
@hasMany(() => GroupMembershipModel, { userId: 'userId' }, {
|
|
@@ -519,154 +568,160 @@ groups!: GroupMembershipModel[];
|
|
|
519
568
|
|
|
520
569
|
### Field Decorators
|
|
521
570
|
|
|
522
|
-
|
|
523
|
-
|
|
571
|
+
型安全なセマンティック decorator が DynamoDB の属性型を定義する。
|
|
572
|
+
`ClassFieldDecoratorContext` に基づくコンパイル時チェックが、宣言された TypeScript の型と
|
|
573
|
+
DynamoDB の型の不一致を検出する。
|
|
524
574
|
|
|
525
575
|
```ts
|
|
526
576
|
@string userId!: string; // DynamoDB S
|
|
527
577
|
@number amount!: number; // DynamoDB N
|
|
528
|
-
@datetime createdAt!: Date; //
|
|
578
|
+
@datetime createdAt!: Date; // ISO 8601 文字列として保存される
|
|
529
579
|
@boolean isActive!: boolean; // DynamoDB BOOL
|
|
530
580
|
```
|
|
531
581
|
|
|
532
582
|
### Select = Projection + Type Inference
|
|
533
583
|
|
|
534
|
-
|
|
535
|
-
|
|
584
|
+
`select` オブジェクトは DynamoDB の `ProjectionExpression` 生成と TypeScript の返り値型推論の
|
|
585
|
+
両方を制御する。
|
|
586
|
+
要求したフィールドだけが返り、結果の型にもそのフィールドだけが現れる。
|
|
536
587
|
|
|
537
588
|
### Planner = Inspectable Execution Plan
|
|
538
589
|
|
|
539
|
-
|
|
540
|
-
|
|
590
|
+
DynamoDB にアクセスする前に、runtime が実行計画(execution plan)を生成する。
|
|
591
|
+
plan はテスト・デバッグ・RCU 見積もりに利用できる。
|
|
541
592
|
|
|
542
|
-
## Architecture
|
|
593
|
+
## 🏗️ Architecture
|
|
543
594
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
Layer 2: Query Builder
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
DynamoDB DocumentClient wrapper
|
|
560
|
-
-> raw Items
|
|
561
|
-
|
|
562
|
-
Layer 5: Hydrator
|
|
563
|
-
raw Items -> Partial Entity instances
|
|
564
|
-
type conversion, Embedded reconstruction, metadata attachment
|
|
595
|
+
GraphDDB のクエリは 5 つのレイヤーを通って実行される:
|
|
596
|
+
|
|
597
|
+
```mermaid
|
|
598
|
+
flowchart TD
|
|
599
|
+
L1["🧩 Layer 1: Schema Definition<br/>Entity / Field / Key / GSI / Relation / Embedded"]
|
|
600
|
+
L2["🔧 Layer 2: Query Builder<br/>型安全な DSL: key 解決 / select バリデーション"]
|
|
601
|
+
L3["🗺️ Layer 3: Query Planner<br/>Relation traversal / Get vs Query vs BatchGet 判定<br/>Projection 生成 / GSI 選択"]
|
|
602
|
+
L4["⚡ Layer 4: Executor<br/>DynamoDB DocumentClient ラッパー"]
|
|
603
|
+
L5["💧 Layer 5: Hydrator<br/>型変換 / Embedded 再構築 / メタデータ付与"]
|
|
604
|
+
|
|
605
|
+
L1 -->|EntityMetadata Registry| L2
|
|
606
|
+
L2 -->|ExecutionPlan| L3
|
|
607
|
+
L3 -->|"DynamoDBOperation[]"| L4
|
|
608
|
+
L4 -->|raw Items| L5
|
|
609
|
+
L5 -->|Partial Entity インスタンス| OUT(["✅ 型付き結果"])
|
|
565
610
|
```
|
|
566
611
|
|
|
567
|
-
## Design Rules
|
|
612
|
+
## 📐 Design Rules
|
|
568
613
|
|
|
569
|
-
|
|
|
614
|
+
| ルール | 内容 |
|
|
570
615
|
|------|-------------|
|
|
571
|
-
| Service Boundary First |
|
|
572
|
-
| Access Pattern First |
|
|
573
|
-
| Natural Mapping |
|
|
574
|
-
| Inspectable Plans | DynamoDB
|
|
575
|
-
| Single-item query | `query`
|
|
576
|
-
| Explicit limits | `hasMany`
|
|
577
|
-
| Bounded depth | Relation traversal
|
|
578
|
-
| Parallel relations |
|
|
579
|
-
| No Scan | Full table
|
|
580
|
-
| Partial select |
|
|
581
|
-
| Structured keys |
|
|
582
|
-
| Typed consistentRead | `consistentRead`
|
|
583
|
-
| Server-side filter | `filter`
|
|
584
|
-
|
|
585
|
-
## Architectural Boundaries
|
|
586
|
-
|
|
587
|
-
Relation traversal
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
-
|
|
600
|
-
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
- **[
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
`
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
- **[
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
616
|
+
| Service Boundary First | 1テーブルは1エンティティではなく、1つのサービス境界を表す。 |
|
|
617
|
+
| Access Pattern First | テーブルや ORM 風のエンティティをモデル化する前に、DynamoDB のアクセスパターンをモデル化する。 |
|
|
618
|
+
| Natural Mapping | Query / Get / BatchGet / Projection / cursor を GraphQL ライクなクエリの形にマップする。 |
|
|
619
|
+
| Inspectable Plans | DynamoDB の操作と実行計画は、実行前に検査可能である。 |
|
|
620
|
+
| Single-item query | `query` は PK または unique GSI の lookup のみ。複数件返りうるキーには `list` を使う。 |
|
|
621
|
+
| Explicit limits | `hasMany` と `list` は default/max limit の指定が必須。 |
|
|
622
|
+
| Bounded depth | Relation traversal はデフォルトで depth=1。より深い traversal は `maxDepth` で明示的に許可する必要がある。 |
|
|
623
|
+
| Parallel relations | 独立した relation のサブクエリ、BatchGet のチャンク、ネストした解決は並列にディスパッチされる(上限あり)。DynamoDB は HTTP ベースのため、直列化すべきコネクションが存在しない。 |
|
|
624
|
+
| No Scan | Full table scan は禁止。linter が検出・ブロックする。 |
|
|
625
|
+
| Partial select | クエリ結果は partial 型。select したフィールドのみが結果の型に現れる。 |
|
|
626
|
+
| Structured keys | キーは `k` segment テンプレートから構築され、partial key は segment 境界で `begins_with` にコンパイルされる。 |
|
|
627
|
+
| Typed consistentRead | `consistentRead` は PK クエリでのみ利用可能。GSI クエリはコンパイル時に拒否される。 |
|
|
628
|
+
| Server-side filter | `filter` は宣言的な DynamoDB `FilterExpression`(AppSync `ModelFilterInput` 互換)で、エンティティ全体に対して型付けされ、projection されていない属性も参照できる。RCU は削減せず、`limit` はその前に適用される。 |
|
|
629
|
+
|
|
630
|
+
## 🚧 Architectural Boundaries
|
|
631
|
+
|
|
632
|
+
Relation traversal は、Entity 上に定義されたアクセスパスのみをたどる。
|
|
633
|
+
未定義の relation、欠けている GSI、limit のない list、許可された depth を超える traversal は、
|
|
634
|
+
実行前にチェックされる。
|
|
635
|
+
|
|
636
|
+
これにより、境界をまたぐクエリや DynamoDB に不向きなアクセスパターンが、コード上で見えやすくなる。
|
|
637
|
+
コードが人間によって書かれたものであれ、AI によって生成されたものであれ、同じアーキテクチャ上の
|
|
638
|
+
制約が適用される。
|
|
639
|
+
|
|
640
|
+
## 🔍 Linter
|
|
641
|
+
|
|
642
|
+
静的解析が、runtime の前に Entity 定義の問題を検出する:
|
|
643
|
+
|
|
644
|
+
- Scan の使用
|
|
645
|
+
- `hasMany` / `list` での limit 未指定
|
|
646
|
+
- 曖昧な GSI 解決
|
|
647
|
+
- unique GSI に対する query/list の境界違反
|
|
648
|
+
|
|
649
|
+
## 🧱 Beyond the Core
|
|
650
|
+
|
|
651
|
+
上記の query / relation / write API がコアレイヤーである。GraphDDB はさらに以下も提供する:
|
|
652
|
+
|
|
653
|
+
- **[CQRS contracts](./docs/cqrs-contract.md)** —— N+1 安全な cardinality matrix、
|
|
654
|
+
contract をまたぐ合成、context 境界の強制を備えた、public な Query/Command contract モデル。
|
|
655
|
+
- **[Mutation → command derivation](./docs/mutation-command-derivation.md)** —— public な
|
|
656
|
+
Command IF の背後にある、内部的な write-plan 合成 DSL。モデルの書き込みセマンティクス
|
|
657
|
+
(`entityWrites`: 参照整合性、一意性、edge effect、派生カウンタ、outbox event、冪等性)を
|
|
658
|
+
一度宣言すると、`mutation` が1つ以上の write fragment を合成し、コンパイラがそれらを単一の
|
|
659
|
+
atomic な `TransactWriteItems` にマージする。すべての書き込みパスは1つの共有された
|
|
660
|
+
`commitTransaction` オーケストレーションを経由する。
|
|
661
|
+
- **[Opt-in class hydration](./docs/class-hydration.md)** —— `options.hydrate` ファクトリを
|
|
662
|
+
渡すと、read 結果をデフォルトの Typed Plain Object ではなく、ホスト言語のドメインオブジェクトに
|
|
663
|
+
ロードできる。ホスト専用で、bridge SSoT にシリアライズされることはない。Phase 1
|
|
664
|
+
(`query` のトップレベル)は実装済み。`list` / relation ごとの hydration は今後の予定。
|
|
665
|
+
- **[Multi-language (Python bridge)](./docs/python-bridge.md)** —— TypeScript が単一の真実の源
|
|
666
|
+
であり、同じ定義から Python クライアント + runtime を生成し、TS↔Python の conformance スイートで
|
|
667
|
+
歩調を合わせる。
|
|
668
|
+
- **[In-memory testing](./docs/testing.md)** —— `graphddb/testing` は model-mapping、query-plan、
|
|
669
|
+
relation-traversal、CDC のテストを **Docker なしの in-process** で実行する。
|
|
670
|
+
- **[CDC emulator](./docs/cdc-emulator.md)** —— ローカルでの差分集計を駆動・テストするための、
|
|
671
|
+
DynamoDB Streams 相当の変更イベント。
|
|
672
|
+
|
|
673
|
+
## 📚 Documentation
|
|
674
|
+
|
|
675
|
+
| ドキュメント | 内容 |
|
|
629
676
|
|----------|-------------|
|
|
630
|
-
| [Specification](./docs/spec.md) |
|
|
631
|
-
| [CQRS contract layer](./docs/cqrs-contract.md) |
|
|
632
|
-
| [Mutation → command derivation](./docs/mutation-command-derivation.md) |
|
|
633
|
-
| [Class hydration](./docs/class-hydration.md) |
|
|
634
|
-
| [Multi-language / Python bridge](./docs/python-bridge.md) | TS
|
|
635
|
-
| [In-memory test adapter](./docs/testing.md) |
|
|
636
|
-
| [CDC emulator](./docs/cdc-emulator.md) |
|
|
637
|
-
| [Benchmark](./benchmark/RESULTS.md) |
|
|
638
|
-
|
|
639
|
-
## Examples
|
|
640
|
-
|
|
641
|
-
| Example |
|
|
677
|
+
| [Specification](./docs/spec.md) | コア API: entity、structured keys/GSIs、query/filter、relation、batch/transaction、design rule、runtime の挙動。 |
|
|
678
|
+
| [CQRS contract layer](./docs/cqrs-contract.md) | public な Query/Command contract、cardinality matrix、N+1 安全性、contract をまたぐ合成、context 境界。 |
|
|
679
|
+
| [Mutation → command derivation](./docs/mutation-command-derivation.md) | Command IF の背後にある内部的な write-plan 合成 DSL: モデルの write セマンティクス(`entityWrites`)、fragment 合成、atomic な `TransactWriteItems` の導出。 |
|
|
680
|
+
| [Class hydration](./docs/class-hydration.md) | read 結果をホスト言語のオブジェクトにロードする opt-in な `options.hydrate` ファクトリ(Phase 1: `query` トップレベル; Phase 2–3 は今後)。 |
|
|
681
|
+
| [Multi-language / Python bridge](./docs/python-bridge.md) | TS を SSoT としたコード生成と Python runtime; TS↔Python の conformance。 |
|
|
682
|
+
| [In-memory test adapter](./docs/testing.md) | `graphddb/testing` と `MemoryInspector` による Docker 不要の in-process テスト。 |
|
|
683
|
+
| [CDC emulator](./docs/cdc-emulator.md) | 差分集計パターン向けの変更イベント emulator(dev/test)。 |
|
|
684
|
+
| [Benchmark](./benchmark/RESULTS.md) | 手書きの AWS SDK、ElectroDB、DynamoDB Toolbox、OneTable とのライブラリ比較。 |
|
|
685
|
+
|
|
686
|
+
## 💡 Examples
|
|
687
|
+
|
|
688
|
+
| Example | 内容 |
|
|
642
689
|
|---------|-------------|
|
|
643
|
-
| [user-permissions](./examples/user-permissions/) |
|
|
644
|
-
| [aggregate-tree-pattern](./examples/aggregate-tree-pattern/) |
|
|
645
|
-
|
|
646
|
-
## Features
|
|
647
|
-
|
|
648
|
-
- Entity
|
|
649
|
-
- DDBModel
|
|
650
|
-
-
|
|
651
|
-
- CRUD
|
|
652
|
-
|
|
653
|
-
-
|
|
654
|
-
-
|
|
655
|
-
|
|
656
|
-
-
|
|
657
|
-
-
|
|
658
|
-
-
|
|
659
|
-
-
|
|
660
|
-
-
|
|
690
|
+
| [user-permissions](./examples/user-permissions/) | Single Table Design でユーザー・グループ・パーミッションを管理する。隣接リスト、転置インデックス、relation traversal、`explain` を含む。 |
|
|
691
|
+
| [aggregate-tree-pattern](./examples/aggregate-tree-pattern/) | CDC emulator で駆動される差分的なツリー集計(`siteScoreAverage`): dirty 伝播、throttle 付き sweep、再計算。 |
|
|
692
|
+
|
|
693
|
+
## ✨ Features
|
|
694
|
+
|
|
695
|
+
- Entity メタデータ / decorator
|
|
696
|
+
- DDBModel 基底クラス / コネクション管理
|
|
697
|
+
- 型システム(SelectableOf, QueryResult, QueryKeyOf)
|
|
698
|
+
- CRUD(put, update, delete, 条件付き書き込み —— `WriteCondition` は宣言的 filter operator の
|
|
699
|
+
フルセットに加え `cond` raw escape hatch を共有する)
|
|
700
|
+
- Query / List(planner, executor, hydrator, cursor pagination)
|
|
701
|
+
- 型安全な filtering: 宣言的なサーバーサイド `filter`(FilterExpression / AppSync
|
|
702
|
+
`ModelFilterInput` 互換)、加えて `Model.col` のカラム参照と `cond` raw escape hatch
|
|
703
|
+
- 構造化 segment キー(`k` タグ): partial key は segment 境界で `begins_with` にコンパイルされる
|
|
704
|
+
- 説明可能な実行計画
|
|
705
|
+
- Relation(hasMany, belongsTo, hasOne, depth 制限, traversal)
|
|
706
|
+
- BatchGet 最適化
|
|
707
|
+
- 並列 relation 実行(独立したサブクエリ、BatchGet チャンク、ネストした解決を上限付きの
|
|
708
|
+
並列度で同時にディスパッチ)
|
|
709
|
+
- Linter(no-scan, require-limit, query-boundary, GSI ambiguity, 拡張された design rule)
|
|
710
|
+
- ConsistentRead の型制約
|
|
661
711
|
- Transaction DSL
|
|
662
|
-
- Batch
|
|
663
|
-
- CQRS Query/Command contract
|
|
664
|
-
- Mutation → command derivation:
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
712
|
+
- Batch 操作
|
|
713
|
+
- CQRS Query/Command contract レイヤー(public IF, N+1 安全な合成, context 境界)—— [docs](./docs/cqrs-contract.md) を参照
|
|
714
|
+
- Mutation → command derivation: Command IF の背後にある内部的な write-plan 合成 DSL
|
|
715
|
+
(`entityWrites` + `mutation`)、複数 fragment の atomic 合成を1つの `TransactWriteItems` に
|
|
716
|
+
—— [docs](./docs/mutation-command-derivation.md) を参照
|
|
717
|
+
- Opt-in class hydration(`options.hydrate`): read 結果をホストオブジェクトにロードする;
|
|
718
|
+
ホスト専用で、シリアライズされない。Phase 1(`query` トップレベル)実装済み
|
|
719
|
+
—— [docs](./docs/class-hydration.md) を参照
|
|
720
|
+
- Multi-language: TS を SSoT とした Python コード生成器 + runtime、TS↔Python の conformance 付き
|
|
721
|
+
—— [docs](./docs/python-bridge.md) を参照
|
|
722
|
+
- In-memory test adapter(`graphddb/testing`): Docker 不要のユニットテスト —— [docs](./docs/testing.md) を参照
|
|
723
|
+
- CDC emulator: dev/test 向けの DynamoDB Streams 相当の変更イベント —— [docs](./docs/cdc-emulator.md) を参照
|
|
724
|
+
|
|
725
|
+
## 📄 License
|
|
671
726
|
|
|
672
727
|
MIT
|