metal-orm 1.0.95 → 1.0.97

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 CHANGED
@@ -5058,9 +5058,15 @@ var hydrateRows = (rows, plan) => {
5058
5058
  }
5059
5059
  return seen;
5060
5060
  };
5061
+ const hasRelations = plan.relations.length > 0;
5061
5062
  for (const row of rows) {
5062
5063
  const rootId = row[plan.rootPrimaryKey];
5063
- if (rootId === void 0) continue;
5064
+ if (rootId === void 0 || rootId === null) {
5065
+ if (!hasRelations) {
5066
+ rootMap.set(Symbol(), createBaseRow(row, plan));
5067
+ }
5068
+ continue;
5069
+ }
5064
5070
  const parent = getOrCreateParent(row);
5065
5071
  if (!parent) continue;
5066
5072
  for (const rel of plan.relations) {
@@ -8298,8 +8304,10 @@ var InsertQueryBuilder = class _InsertQueryBuilder {
8298
8304
  };
8299
8305
 
8300
8306
  // src/query-builder/update-query-state.ts
8307
+ var LITERAL_VALUE_TYPES = ["string", "number", "boolean", "Date", "null"];
8301
8308
  var isUpdateValue = (value) => {
8302
8309
  if (value === null) return true;
8310
+ if (value instanceof Date) return true;
8303
8311
  switch (typeof value) {
8304
8312
  case "string":
8305
8313
  case "number":
@@ -8342,8 +8350,9 @@ var UpdateQueryState = class _UpdateQueryState {
8342
8350
  withSet(values) {
8343
8351
  const assignments = Object.entries(values).map(([column, rawValue]) => {
8344
8352
  if (!isUpdateValue(rawValue)) {
8353
+ const allowedTypes = [...LITERAL_VALUE_TYPES, "OperandNode"];
8345
8354
  throw new Error(
8346
- `Invalid update value for column "${column}": only primitives, null, or OperandNodes are allowed`
8355
+ `Invalid update value for column "${column}": only ${allowedTypes.join(", ")} are allowed`
8347
8356
  );
8348
8357
  }
8349
8358
  return {