rajt 0.0.24 → 0.0.25
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/action.ts +2 -2
- package/src/dynamodb/model.ts +4 -4
package/package.json
CHANGED
package/src/action.ts
CHANGED
|
@@ -101,7 +101,7 @@ export default abstract class Action {
|
|
|
101
101
|
|
|
102
102
|
async body<E>() {
|
|
103
103
|
const cType = this.context.req.header('Content-Type')
|
|
104
|
-
if (!cType) return {}
|
|
104
|
+
if (!cType) return {} as E
|
|
105
105
|
|
|
106
106
|
if (/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/.test(cType)) {
|
|
107
107
|
return await this.json<E>()
|
|
@@ -114,7 +114,7 @@ export default abstract class Action {
|
|
|
114
114
|
return await this.form() as E
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
return {}
|
|
117
|
+
return {} as E
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
get response() {
|
package/src/dynamodb/model.ts
CHANGED
|
@@ -105,7 +105,7 @@ export default class AbstractModel<T extends object> {
|
|
|
105
105
|
keys = this.#getItemKey(item, key)
|
|
106
106
|
this.#validateKeys(keys)
|
|
107
107
|
// @ts-ignore
|
|
108
|
-
item = { ...keys, V: Compact.encode(this
|
|
108
|
+
item = { ...keys, V: Compact.encode(this.#getItemWithoutKeys(item), this.#meta.fields) }
|
|
109
109
|
} else {
|
|
110
110
|
this.#validateKeys(item)
|
|
111
111
|
}
|
|
@@ -120,7 +120,7 @@ export default class AbstractModel<T extends object> {
|
|
|
120
120
|
keys = this.#getItemKey(attrs, key)
|
|
121
121
|
this.#validateKeys(keys)
|
|
122
122
|
// @ts-ignore
|
|
123
|
-
attrs = { V: Compact.encode(this
|
|
123
|
+
attrs = { V: Compact.encode(this.#getItemWithoutKeys(attrs), this.#meta.fields) }
|
|
124
124
|
} else {
|
|
125
125
|
this.#validateKeys(attrs)
|
|
126
126
|
}
|
|
@@ -226,7 +226,7 @@ export default class AbstractModel<T extends object> {
|
|
|
226
226
|
if (this.#meta.keys?.SK) {
|
|
227
227
|
if (key.length > 1)
|
|
228
228
|
// @ts-ignore
|
|
229
|
-
keys[this
|
|
229
|
+
keys[this.#meta.keys.SK] = key[1]
|
|
230
230
|
else if (this.#meta.defaultSK)
|
|
231
231
|
keys[this.#meta.keys.SK] = this.#meta.defaultSK
|
|
232
232
|
}
|
|
@@ -284,7 +284,7 @@ export default class AbstractModel<T extends object> {
|
|
|
284
284
|
if (!keys) keys = this.#getItemKey(item)
|
|
285
285
|
|
|
286
286
|
// @ts-ignore
|
|
287
|
-
return model.withKey(keys[this
|
|
287
|
+
return model.withKey(keys[this.#meta.keys.PK], keys[this.#meta.keys.SK] || undefined)
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
return new this.#cls(item)
|