@model-ts/dynamodb 3.0.1 → 3.0.2

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/src/client.ts CHANGED
@@ -741,7 +741,7 @@ export class Client {
741
741
  ? E.left({ ...state, rollbackSuccessful: true })
742
742
  : E.right(state)
743
743
 
744
- const [currentBatch, remaining] = A.splitAt(25)(operations)
744
+ const [currentBatch, remaining] = A.splitAt(100)(operations)
745
745
 
746
746
  try {
747
747
  const transactItems = currentBatch
package/src/sandbox.ts CHANGED
@@ -125,23 +125,25 @@ export const createSandbox = async (client: Client): Promise<Sandbox> => {
125
125
  seed: async (...args: Array<{ [key: string]: any }>) => {
126
126
  const chunks = chunksOf(25)(args)
127
127
 
128
- for (const chunk of chunks) {
129
- const items = chunk.map((i) =>
130
- typeof i?._model?.__dynamoDBEncode === "function"
131
- ? i._model.__dynamoDBEncode(i)
132
- : typeof i.encode === "function"
133
- ? i.encode()
134
- : i
135
- )
136
-
137
- await client.documentClient
138
- .batchWrite({
139
- RequestItems: {
140
- [tableName]: items.map((i) => ({ PutRequest: { Item: i } })),
141
- },
142
- })
143
- .promise()
144
- }
128
+ await Promise.all(
129
+ chunks.map(async (chunk) => {
130
+ const items = chunk.map((i) =>
131
+ typeof i?._model?.__dynamoDBEncode === "function"
132
+ ? i._model.__dynamoDBEncode(i)
133
+ : typeof i.encode === "function"
134
+ ? i.encode()
135
+ : i
136
+ )
137
+
138
+ return client.documentClient
139
+ .batchWrite({
140
+ RequestItems: {
141
+ [tableName]: items.map((i) => ({ PutRequest: { Item: i } })),
142
+ },
143
+ })
144
+ .promise()
145
+ })
146
+ )
145
147
  },
146
148
  get: (pk: string, sk: string) =>
147
149
  client.documentClient