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.js
CHANGED
|
@@ -7939,8 +7939,10 @@ var InsertQueryBuilder = class _InsertQueryBuilder {
|
|
|
7939
7939
|
};
|
|
7940
7940
|
|
|
7941
7941
|
// src/query-builder/update-query-state.ts
|
|
7942
|
+
var LITERAL_VALUE_TYPES = ["string", "number", "boolean", "Date", "null"];
|
|
7942
7943
|
var isUpdateValue = (value) => {
|
|
7943
7944
|
if (value === null) return true;
|
|
7945
|
+
if (value instanceof Date) return true;
|
|
7944
7946
|
switch (typeof value) {
|
|
7945
7947
|
case "string":
|
|
7946
7948
|
case "number":
|
|
@@ -7983,8 +7985,9 @@ var UpdateQueryState = class _UpdateQueryState {
|
|
|
7983
7985
|
withSet(values) {
|
|
7984
7986
|
const assignments = Object.entries(values).map(([column, rawValue]) => {
|
|
7985
7987
|
if (!isUpdateValue(rawValue)) {
|
|
7988
|
+
const allowedTypes = [...LITERAL_VALUE_TYPES, "OperandNode"];
|
|
7986
7989
|
throw new Error(
|
|
7987
|
-
`Invalid update value for column "${column}": only
|
|
7990
|
+
`Invalid update value for column "${column}": only ${allowedTypes.join(", ")} are allowed`
|
|
7988
7991
|
);
|
|
7989
7992
|
}
|
|
7990
7993
|
return {
|