metal-orm 1.0.95 → 1.0.96
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/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/query-builder/update-query-state.ts +10 -2
package/dist/index.cjs
CHANGED
|
@@ -8298,8 +8298,10 @@ var InsertQueryBuilder = class _InsertQueryBuilder {
|
|
|
8298
8298
|
};
|
|
8299
8299
|
|
|
8300
8300
|
// src/query-builder/update-query-state.ts
|
|
8301
|
+
var LITERAL_VALUE_TYPES = ["string", "number", "boolean", "Date", "null"];
|
|
8301
8302
|
var isUpdateValue = (value) => {
|
|
8302
8303
|
if (value === null) return true;
|
|
8304
|
+
if (value instanceof Date) return true;
|
|
8303
8305
|
switch (typeof value) {
|
|
8304
8306
|
case "string":
|
|
8305
8307
|
case "number":
|
|
@@ -8342,8 +8344,9 @@ var UpdateQueryState = class _UpdateQueryState {
|
|
|
8342
8344
|
withSet(values) {
|
|
8343
8345
|
const assignments = Object.entries(values).map(([column, rawValue]) => {
|
|
8344
8346
|
if (!isUpdateValue(rawValue)) {
|
|
8347
|
+
const allowedTypes = [...LITERAL_VALUE_TYPES, "OperandNode"];
|
|
8345
8348
|
throw new Error(
|
|
8346
|
-
`Invalid update value for column "${column}": only
|
|
8349
|
+
`Invalid update value for column "${column}": only ${allowedTypes.join(", ")} are allowed`
|
|
8347
8350
|
);
|
|
8348
8351
|
}
|
|
8349
8352
|
return {
|