rajt 0.0.45 → 0.0.46
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/package.json +1 -1
- package/src/dynamodb/model.ts +4 -1
package/package.json
CHANGED
package/src/dynamodb/model.ts
CHANGED
|
@@ -265,6 +265,9 @@ export default class AbstractModel<T extends object> {
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
#getItemWithoutKeys(item: Partial<T>): Partial<T> {
|
|
268
|
+
if (Array.isArray(item))
|
|
269
|
+
return item?.length ? item.map(i => this.#getItemWithoutKeys(i)) as T : [] as T
|
|
270
|
+
|
|
268
271
|
if (!this.#meta.keys || !item) return { ...item }
|
|
269
272
|
|
|
270
273
|
const { PK, SK } = this.#meta.keys
|
|
@@ -296,7 +299,7 @@ export default class AbstractModel<T extends object> {
|
|
|
296
299
|
|
|
297
300
|
#withKey(model: T, keys: Record<string, string>): T {
|
|
298
301
|
// @ts-ignore
|
|
299
|
-
if (Array.isArray(model)) return model.map(m => this.#withKey(m))
|
|
302
|
+
if (Array.isArray(model)) return model.map(m => this.#withKey(m, keys))
|
|
300
303
|
// @ts-ignore
|
|
301
304
|
return model.withKey(keys[this.#meta.keys.PK], keys[this.#meta.keys.SK] || undefined)
|
|
302
305
|
}
|