@ftschopp/dynatable-core 1.4.2 → 1.4.3

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.
Files changed (81) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/builders/query/create-query-builder.d.ts.map +1 -1
  3. package/dist/builders/query/create-query-builder.js +19 -2
  4. package/dist/core/types.d.ts +5 -0
  5. package/dist/core/types.d.ts.map +1 -1
  6. package/package.json +11 -2
  7. package/eslint.config.mjs +0 -4
  8. package/jest.config.js +0 -11
  9. package/src/builders/README.md +0 -339
  10. package/src/builders/batch-get/README.md +0 -43
  11. package/src/builders/batch-get/create-batch-get-builder.test.ts +0 -193
  12. package/src/builders/batch-get/create-batch-get-builder.ts +0 -108
  13. package/src/builders/batch-get/index.ts +0 -2
  14. package/src/builders/batch-get/types.ts +0 -28
  15. package/src/builders/batch-write/README.md +0 -204
  16. package/src/builders/batch-write/create-batch-write-builder.test.ts +0 -173
  17. package/src/builders/batch-write/create-batch-write-builder.ts +0 -49
  18. package/src/builders/batch-write/index.ts +0 -2
  19. package/src/builders/batch-write/types.ts +0 -33
  20. package/src/builders/delete/create-delete-builder.test.ts +0 -294
  21. package/src/builders/delete/create-delete-builder.ts +0 -100
  22. package/src/builders/delete/index.ts +0 -2
  23. package/src/builders/delete/types.ts +0 -17
  24. package/src/builders/get/create-get-builder.test.ts +0 -272
  25. package/src/builders/get/create-get-builder.ts +0 -117
  26. package/src/builders/get/index.ts +0 -2
  27. package/src/builders/get/types.ts +0 -39
  28. package/src/builders/index.ts +0 -14
  29. package/src/builders/put/create-put-builder.test.ts +0 -213
  30. package/src/builders/put/create-put-builder.ts +0 -160
  31. package/src/builders/put/index.ts +0 -2
  32. package/src/builders/put/types.ts +0 -24
  33. package/src/builders/query/create-query-builder.test.ts +0 -770
  34. package/src/builders/query/create-query-builder.ts +0 -455
  35. package/src/builders/query/index.ts +0 -2
  36. package/src/builders/query/types.ts +0 -109
  37. package/src/builders/scan/create-scan-builder.test.ts +0 -416
  38. package/src/builders/scan/create-scan-builder.ts +0 -265
  39. package/src/builders/scan/index.ts +0 -2
  40. package/src/builders/scan/types.ts +0 -88
  41. package/src/builders/shared/conditions.ts +0 -58
  42. package/src/builders/shared/index.ts +0 -4
  43. package/src/builders/shared/operators.test.ts +0 -270
  44. package/src/builders/shared/operators.ts +0 -208
  45. package/src/builders/shared/projection.ts +0 -28
  46. package/src/builders/shared/types.ts +0 -101
  47. package/src/builders/transact-get/README.md +0 -167
  48. package/src/builders/transact-get/create-transact-get-builder.test.ts +0 -239
  49. package/src/builders/transact-get/create-transact-get-builder.ts +0 -67
  50. package/src/builders/transact-get/index.ts +0 -2
  51. package/src/builders/transact-get/types.ts +0 -31
  52. package/src/builders/transact-write/README.md +0 -202
  53. package/src/builders/transact-write/create-transact-write-builder.test.ts +0 -288
  54. package/src/builders/transact-write/create-transact-write-builder.ts +0 -124
  55. package/src/builders/transact-write/index.ts +0 -2
  56. package/src/builders/transact-write/types.ts +0 -71
  57. package/src/builders/update/create-update-builder.test.ts +0 -573
  58. package/src/builders/update/create-update-builder.ts +0 -375
  59. package/src/builders/update/index.ts +0 -2
  60. package/src/builders/update/types.ts +0 -63
  61. package/src/core/types.test.ts +0 -641
  62. package/src/core/types.ts +0 -366
  63. package/src/entity/create-entity-api.ts +0 -224
  64. package/src/entity/index.ts +0 -19
  65. package/src/entity/middleware/factories.ts +0 -15
  66. package/src/entity/middleware/types.ts +0 -7
  67. package/src/entity/middleware/with-middleware.ts +0 -37
  68. package/src/entity/types.ts +0 -79
  69. package/src/entity/validation/key-validation.ts +0 -34
  70. package/src/index.ts +0 -23
  71. package/src/table.ts +0 -116
  72. package/src/utils/dynamodb-logger.test.ts +0 -246
  73. package/src/utils/dynamodb-logger.ts +0 -175
  74. package/src/utils/model-utils.test.ts +0 -452
  75. package/src/utils/model-utils.ts +0 -188
  76. package/src/utils/zod-utils.test.ts +0 -363
  77. package/src/utils/zod-utils.ts +0 -56
  78. package/tests/integration/instagram-clone.integration.test.ts +0 -1019
  79. package/tests/integration/pagination-timestamps.integration.test.ts +0 -374
  80. package/tests/integration/transactions.integration.test.ts +0 -528
  81. package/tsconfig.json +0 -12
@@ -1,193 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
3
- import { createBatchGetBuilder } from './create-batch-get-builder';
4
-
5
- interface User {
6
- pk: string;
7
- sk: string;
8
- username: string;
9
- name: string;
10
- followerCount: number;
11
- followingCount: number;
12
- }
13
-
14
- describe('BatchGetBuilder', () => {
15
- const client = new DynamoDBClient({});
16
-
17
- describe('dbParams', () => {
18
- test('should build basic BatchGetItem params', () => {
19
- const requestItems = {
20
- Users: {
21
- Keys: [
22
- { pk: 'USER#alice', sk: 'USER#alice' },
23
- { pk: 'USER#bob', sk: 'USER#bob' },
24
- ],
25
- },
26
- };
27
-
28
- const builder = createBatchGetBuilder(requestItems, client);
29
- const params = builder.dbParams();
30
-
31
- expect(params).toEqual({
32
- RequestItems: {
33
- Users: {
34
- Keys: [
35
- { pk: 'USER#alice', sk: 'USER#alice' },
36
- { pk: 'USER#bob', sk: 'USER#bob' },
37
- ],
38
- },
39
- },
40
- });
41
- });
42
-
43
- test('should build BatchGetItem params with projection', () => {
44
- const requestItems = {
45
- Users: {
46
- Keys: [
47
- { pk: 'USER#alice', sk: 'USER#alice' },
48
- { pk: 'USER#bob', sk: 'USER#bob' },
49
- ],
50
- },
51
- };
52
-
53
- const builder = createBatchGetBuilder<User>(requestItems, client).select([
54
- 'username',
55
- 'name',
56
- 'followerCount',
57
- ]);
58
- const params = builder.dbParams();
59
-
60
- expect(params).toEqual({
61
- RequestItems: {
62
- Users: {
63
- Keys: [
64
- { pk: 'USER#alice', sk: 'USER#alice' },
65
- { pk: 'USER#bob', sk: 'USER#bob' },
66
- ],
67
- ProjectionExpression: '#username, #name, #followerCount',
68
- ExpressionAttributeNames: {
69
- '#username': 'username',
70
- '#name': 'name',
71
- '#followerCount': 'followerCount',
72
- },
73
- },
74
- },
75
- });
76
- });
77
-
78
- test('should build BatchGetItem params with consistent read', () => {
79
- const requestItems = {
80
- Users: {
81
- Keys: [
82
- { pk: 'USER#alice', sk: 'USER#alice' },
83
- { pk: 'USER#bob', sk: 'USER#bob' },
84
- ],
85
- },
86
- };
87
-
88
- const builder = createBatchGetBuilder(requestItems, client).consistentRead();
89
- const params = builder.dbParams();
90
-
91
- expect(params).toEqual({
92
- RequestItems: {
93
- Users: {
94
- Keys: [
95
- { pk: 'USER#alice', sk: 'USER#alice' },
96
- { pk: 'USER#bob', sk: 'USER#bob' },
97
- ],
98
- ConsistentRead: true,
99
- },
100
- },
101
- });
102
- });
103
-
104
- test('should build BatchGetItem params with multiple tables', () => {
105
- const requestItems = {
106
- Users: {
107
- Keys: [
108
- { pk: 'USER#alice', sk: 'USER#alice' },
109
- { pk: 'USER#bob', sk: 'USER#bob' },
110
- ],
111
- },
112
- Photos: {
113
- Keys: [
114
- { pk: 'UP#alice', sk: 'PHOTO#photo1' },
115
- { pk: 'UP#bob', sk: 'PHOTO#photo2' },
116
- ],
117
- },
118
- };
119
-
120
- const builder = createBatchGetBuilder(requestItems, client);
121
- const params = builder.dbParams();
122
-
123
- expect(params).toEqual({
124
- RequestItems: {
125
- Users: {
126
- Keys: [
127
- { pk: 'USER#alice', sk: 'USER#alice' },
128
- { pk: 'USER#bob', sk: 'USER#bob' },
129
- ],
130
- },
131
- Photos: {
132
- Keys: [
133
- { pk: 'UP#alice', sk: 'PHOTO#photo1' },
134
- { pk: 'UP#bob', sk: 'PHOTO#photo2' },
135
- ],
136
- },
137
- },
138
- });
139
- });
140
-
141
- test('should build BatchGetItem params with projection and consistent read', () => {
142
- const requestItems = {
143
- Users: {
144
- Keys: [
145
- { pk: 'USER#alice', sk: 'USER#alice' },
146
- { pk: 'USER#bob', sk: 'USER#bob' },
147
- ],
148
- },
149
- };
150
-
151
- const builder = createBatchGetBuilder<User>(requestItems, client)
152
- .select(['username', 'name'])
153
- .consistentRead();
154
- const params = builder.dbParams();
155
-
156
- expect(params).toEqual({
157
- RequestItems: {
158
- Users: {
159
- Keys: [
160
- { pk: 'USER#alice', sk: 'USER#alice' },
161
- { pk: 'USER#bob', sk: 'USER#bob' },
162
- ],
163
- ProjectionExpression: '#username, #name',
164
- ExpressionAttributeNames: {
165
- '#username': 'username',
166
- '#name': 'name',
167
- },
168
- ConsistentRead: true,
169
- },
170
- },
171
- });
172
- });
173
-
174
- test('reserved DynamoDB words like "name", "date", "status" can be projected', () => {
175
- const requestItems = {
176
- Users: {
177
- Keys: [{ pk: 'USER#alice', sk: 'USER#alice' }],
178
- },
179
- };
180
-
181
- const builder = createBatchGetBuilder<User>(requestItems, client).select(['name']);
182
- const params = builder.dbParams();
183
-
184
- expect(params.RequestItems!['Users']).toEqual({
185
- Keys: [{ pk: 'USER#alice', sk: 'USER#alice' }],
186
- ProjectionExpression: '#name',
187
- ExpressionAttributeNames: {
188
- '#name': 'name',
189
- },
190
- });
191
- });
192
- });
193
- });
@@ -1,108 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
3
- import {
4
- BatchGetCommand,
5
- BatchGetCommandInput,
6
- BatchGetCommandOutput,
7
- } from '@aws-sdk/lib-dynamodb';
8
- import { buildProjectionExpression } from '../shared';
9
- import { BatchGetBuilder } from './types';
10
- import { DynamoDBLogger } from '../../utils/dynamodb-logger';
11
-
12
- /**
13
- * Creates a BatchGetBuilder to retrieve multiple items by their keys.
14
- *
15
- * @param requestItems - An object where keys are table names and values are objects containing Keys array
16
- * @param client - DynamoDB client instance
17
- * @param options - Optional configuration (projection, consistentRead)
18
- * @param logger - Optional logger instance
19
- */
20
- export function createBatchGetBuilder<Model>(
21
- requestItems: Record<string, { Keys: any[] }>,
22
- client: DynamoDBClient,
23
- options?: {
24
- projection?: (keyof Model)[];
25
- consistentRead?: boolean;
26
- },
27
- logger?: DynamoDBLogger
28
- ): BatchGetBuilder<Model> {
29
- const projection = options?.projection ?? [];
30
- const isConsistent = options?.consistentRead ?? false;
31
-
32
- return {
33
- /**
34
- * Select only specific attributes to retrieve.
35
- */
36
- select(attrs) {
37
- return createBatchGetBuilder(
38
- requestItems,
39
- client,
40
- {
41
- projection: attrs,
42
- consistentRead: isConsistent,
43
- },
44
- logger
45
- );
46
- },
47
-
48
- /**
49
- * Enable strongly consistent read.
50
- */
51
- consistentRead() {
52
- return createBatchGetBuilder(
53
- requestItems,
54
- client,
55
- {
56
- projection,
57
- consistentRead: true,
58
- },
59
- logger
60
- );
61
- },
62
-
63
- /**
64
- * Build the underlying DynamoDB input parameters.
65
- */
66
- dbParams(): BatchGetCommandInput {
67
- // Build the projection once (with #-placeholders so reserved words
68
- // like name/date/status/type don't blow up at DynamoDB) and reuse
69
- // it per-table.
70
- const proj =
71
- projection.length > 0 ? buildProjectionExpression(projection.map(String)) : undefined;
72
-
73
- const enhancedRequestItems = Object.entries(requestItems).reduce(
74
- (acc, [tableName, tableRequest]) => {
75
- acc[tableName] = {
76
- Keys: tableRequest.Keys,
77
- ...(proj && {
78
- ProjectionExpression: proj.ProjectionExpression,
79
- ExpressionAttributeNames: proj.ExpressionAttributeNames,
80
- }),
81
- ...(isConsistent && { ConsistentRead: true }),
82
- };
83
- return acc;
84
- },
85
- {} as Record<string, any>
86
- );
87
-
88
- return {
89
- RequestItems: enhancedRequestItems,
90
- };
91
- },
92
-
93
- /**
94
- * Execute the BatchGetItem command and return the items as a flat array.
95
- */
96
- async execute(): Promise<Model[]> {
97
- const params = this.dbParams();
98
- const result: BatchGetCommandOutput = await client.send(new BatchGetCommand(params));
99
- logger?.log('BatchGetCommand', params, result);
100
-
101
- if (!result.Responses) {
102
- return [];
103
- }
104
-
105
- return Object.values(result.Responses).flat() as unknown as Model[];
106
- },
107
- };
108
- }
@@ -1,2 +0,0 @@
1
- export * from './types';
2
- export * from './create-batch-get-builder';
@@ -1,28 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { BatchGetItemCommandInput } from '@aws-sdk/client-dynamodb';
3
-
4
- /**
5
- * BatchGetBuilder allows you to retrieve multiple items from one or more tables
6
- * in a single request.
7
- */
8
- export type BatchGetBuilder<Model> = {
9
- /**
10
- * Select only specific attributes to retrieve for all items.
11
- */
12
- select(attrs: (keyof Model)[]): BatchGetBuilder<Model>;
13
-
14
- /**
15
- * Enable strongly consistent read for all items.
16
- */
17
- consistentRead(): BatchGetBuilder<Model>;
18
-
19
- /**
20
- * Build the underlying DynamoDB BatchGetItem input parameters.
21
- */
22
- dbParams(): BatchGetItemCommandInput;
23
-
24
- /**
25
- * Execute the BatchGetItem command and return the items as a flat array.
26
- */
27
- execute(): Promise<Model[]>;
28
- };
@@ -1,204 +0,0 @@
1
- # BatchWrite Builder
2
-
3
- The `BatchWriteBuilder` allows writing (put) or deleting (delete) multiple items from one or more tables in a single request to DynamoDB.
4
-
5
- ## Features
6
-
7
- - Create multiple items (PutRequest)
8
- - Delete multiple items (DeleteRequest)
9
- - Mix Put and Delete operations in a single request
10
- - Supports multiple tables in a single request
11
- - Handles unprocessed items (UnprocessedItems)
12
-
13
- ## Basic Usage - Create Items
14
-
15
- ```typescript
16
- import { createBatchWriteBuilder } from './builders/batch-write';
17
- import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
18
-
19
- const client = new DynamoDBClient({});
20
-
21
- // Create multiple users
22
- const result = await createBatchWriteBuilder(
23
- {
24
- Users: [
25
- {
26
- PutRequest: {
27
- Item: {
28
- pk: 'USER#alice',
29
- sk: 'USER#alice',
30
- username: 'alice',
31
- name: 'Alice Smith',
32
- followerCount: 0,
33
- followingCount: 0,
34
- },
35
- },
36
- },
37
- {
38
- PutRequest: {
39
- Item: {
40
- pk: 'USER#bob',
41
- sk: 'USER#bob',
42
- username: 'bob',
43
- name: 'Bob Jones',
44
- followerCount: 0,
45
- followingCount: 0,
46
- },
47
- },
48
- },
49
- ],
50
- },
51
- client
52
- ).execute();
53
- ```
54
-
55
- ## Delete Items
56
-
57
- ```typescript
58
- const result = await createBatchWriteBuilder(
59
- {
60
- Users: [
61
- {
62
- DeleteRequest: {
63
- Key: {
64
- pk: 'USER#alice',
65
- sk: 'USER#alice',
66
- },
67
- },
68
- },
69
- {
70
- DeleteRequest: {
71
- Key: {
72
- pk: 'USER#bob',
73
- sk: 'USER#bob',
74
- },
75
- },
76
- },
77
- ],
78
- },
79
- client
80
- ).execute();
81
- ```
82
-
83
- ## Mix Put and Delete
84
-
85
- ```typescript
86
- const result = await createBatchWriteBuilder(
87
- {
88
- Users: [
89
- {
90
- PutRequest: {
91
- Item: {
92
- pk: 'USER#alice',
93
- sk: 'USER#alice',
94
- username: 'alice',
95
- name: 'Alice Smith Updated',
96
- },
97
- },
98
- },
99
- {
100
- DeleteRequest: {
101
- Key: {
102
- pk: 'USER#bob',
103
- sk: 'USER#bob',
104
- },
105
- },
106
- },
107
- ],
108
- },
109
- client
110
- ).execute();
111
- ```
112
-
113
- ## Using the Table Class
114
-
115
- ```typescript
116
- // Create multiple items using the Table class
117
- const result = await table
118
- .batchWrite({
119
- InstagramClone: [
120
- {
121
- PutRequest: {
122
- Item: {
123
- pk: 'USER#alice',
124
- sk: 'USER#alice',
125
- username: 'alice',
126
- name: 'Alice Smith',
127
- },
128
- },
129
- },
130
- {
131
- DeleteRequest: {
132
- Key: {
133
- pk: 'USER#bob',
134
- sk: 'USER#bob',
135
- },
136
- },
137
- },
138
- ],
139
- })
140
- .execute();
141
-
142
- // Handle unprocessed items
143
- if (result.unprocessedItems) {
144
- console.log('Unprocessed items:', result.unprocessedItems);
145
- // Retry unprocessed items
146
- }
147
- ```
148
-
149
- ## Bulk Operations
150
-
151
- ```typescript
152
- // Create multiple photos and likes in a single request
153
- await table
154
- .batchWrite({
155
- InstagramClone: [
156
- {
157
- PutRequest: {
158
- Item: {
159
- pk: 'UP#alice',
160
- sk: 'PHOTO#photo1',
161
- username: 'alice',
162
- photoId: 'photo1',
163
- url: 'https://example.com/photo1.jpg',
164
- likesCount: 0,
165
- commentCount: 0,
166
- },
167
- },
168
- },
169
- {
170
- PutRequest: {
171
- Item: {
172
- pk: 'UP#alice',
173
- sk: 'PHOTO#photo2',
174
- username: 'alice',
175
- photoId: 'photo2',
176
- url: 'https://example.com/photo2.jpg',
177
- likesCount: 0,
178
- commentCount: 0,
179
- },
180
- },
181
- },
182
- {
183
- PutRequest: {
184
- Item: {
185
- pk: 'PL#photo1',
186
- sk: 'LIKE#bob',
187
- photoId: 'photo1',
188
- likingUsername: 'bob',
189
- likeId: 'like123',
190
- },
191
- },
192
- },
193
- ],
194
- })
195
- .execute();
196
- ```
197
-
198
- ## DynamoDB Limitations
199
-
200
- - Maximum 25 items per request
201
- - Maximum 16 MB of data per request
202
- - Does not support conditions (ConditionExpression)
203
- - Unprocessed items are returned in `UnprocessedItems` and must be retried
204
- - Put operations completely overwrite the existing item
@@ -1,173 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
3
- import { createBatchWriteBuilder } from './create-batch-write-builder';
4
-
5
- describe('BatchWriteBuilder', () => {
6
- const client = new DynamoDBClient({});
7
-
8
- describe('dbParams', () => {
9
- test('should build basic BatchWriteItem params with PutRequests', () => {
10
- const requestItems = {
11
- Users: [
12
- {
13
- PutRequest: {
14
- Item: {
15
- pk: 'USER#alice',
16
- sk: 'USER#alice',
17
- username: 'alice',
18
- name: 'Alice Smith',
19
- followerCount: 0,
20
- followingCount: 0,
21
- },
22
- },
23
- },
24
- {
25
- PutRequest: {
26
- Item: {
27
- pk: 'USER#bob',
28
- sk: 'USER#bob',
29
- username: 'bob',
30
- name: 'Bob Jones',
31
- followerCount: 0,
32
- followingCount: 0,
33
- },
34
- },
35
- },
36
- ],
37
- };
38
-
39
- const builder = createBatchWriteBuilder(requestItems, client);
40
- const params = builder.dbParams();
41
-
42
- expect(params).toEqual({
43
- RequestItems: requestItems,
44
- });
45
- });
46
-
47
- test('should build BatchWriteItem params with DeleteRequests', () => {
48
- const requestItems = {
49
- Users: [
50
- {
51
- DeleteRequest: {
52
- Key: {
53
- pk: 'USER#alice',
54
- sk: 'USER#alice',
55
- },
56
- },
57
- },
58
- {
59
- DeleteRequest: {
60
- Key: {
61
- pk: 'USER#bob',
62
- sk: 'USER#bob',
63
- },
64
- },
65
- },
66
- ],
67
- };
68
-
69
- const builder = createBatchWriteBuilder(requestItems, client);
70
- const params = builder.dbParams();
71
-
72
- expect(params).toEqual({
73
- RequestItems: requestItems,
74
- });
75
- });
76
-
77
- test('should build BatchWriteItem params with mixed Put and Delete requests', () => {
78
- const requestItems = {
79
- Users: [
80
- {
81
- PutRequest: {
82
- Item: {
83
- pk: 'USER#alice',
84
- sk: 'USER#alice',
85
- username: 'alice',
86
- name: 'Alice Smith',
87
- followerCount: 0,
88
- followingCount: 0,
89
- },
90
- },
91
- },
92
- {
93
- DeleteRequest: {
94
- Key: {
95
- pk: 'USER#bob',
96
- sk: 'USER#bob',
97
- },
98
- },
99
- },
100
- ],
101
- };
102
-
103
- const builder = createBatchWriteBuilder(requestItems, client);
104
- const params = builder.dbParams();
105
-
106
- expect(params).toEqual({
107
- RequestItems: requestItems,
108
- });
109
- });
110
-
111
- test('should build BatchWriteItem params with multiple tables', () => {
112
- const requestItems = {
113
- Users: [
114
- {
115
- PutRequest: {
116
- Item: {
117
- pk: 'USER#alice',
118
- sk: 'USER#alice',
119
- username: 'alice',
120
- name: 'Alice Smith',
121
- },
122
- },
123
- },
124
- ],
125
- Photos: [
126
- {
127
- PutRequest: {
128
- Item: {
129
- pk: 'UP#alice',
130
- sk: 'PHOTO#photo1',
131
- username: 'alice',
132
- photoId: 'photo1',
133
- url: 'https://example.com/photo1.jpg',
134
- likesCount: 0,
135
- commentCount: 0,
136
- },
137
- },
138
- },
139
- {
140
- DeleteRequest: {
141
- Key: {
142
- pk: 'UP#alice',
143
- sk: 'PHOTO#photo2',
144
- },
145
- },
146
- },
147
- ],
148
- };
149
-
150
- const builder = createBatchWriteBuilder(requestItems, client);
151
- const params = builder.dbParams();
152
-
153
- expect(params).toEqual({
154
- RequestItems: requestItems,
155
- });
156
- });
157
-
158
- test('should handle empty request items', () => {
159
- const requestItems = {
160
- Users: [],
161
- };
162
-
163
- const builder = createBatchWriteBuilder(requestItems, client);
164
- const params = builder.dbParams();
165
-
166
- expect(params).toEqual({
167
- RequestItems: {
168
- Users: [],
169
- },
170
- });
171
- });
172
- });
173
- });