@dnax/core 0.8.12 → 0.8.14

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/define/index.ts CHANGED
@@ -20,6 +20,8 @@ function Config(config: Config) {
20
20
  }
21
21
 
22
22
  function Collection(col: Collection) {
23
+ col.timestamps = col?.timestamps ?? true;
24
+
23
25
  return col;
24
26
  }
25
27
 
@@ -723,7 +723,10 @@ class useRest {
723
723
  update = omit(update, omitUpdate);
724
724
 
725
725
  if (update?.$set) {
726
- update.$set = deepSetId(col, update.$set);
726
+ update.$set = deepSetId(
727
+ col,
728
+ omit(update.$set, ["createdAt", "updatedAt"])
729
+ );
727
730
  update.$set = transformAllDate(update.$set);
728
731
  update.$set = await hashPasswordAuto(update.$set, col);
729
732
  // data = transformAllDate(data);
@@ -973,7 +976,10 @@ class useRest {
973
976
  update = omit(update, omitUpdate);
974
977
 
975
978
  if (update.$set) {
976
- update.$set = deepSetId(col, update.$set);
979
+ update.$set = deepSetId(
980
+ col,
981
+ omit(update.$set, ["createdAt", "updatedAt"])
982
+ );
977
983
  update.$set = transformAllDate(update.$set);
978
984
  update.$set = await hashPasswordAuto(update.$set, col);
979
985
  var { valid, output, error } = this.validator(
@@ -2,7 +2,7 @@ import { v4 } from "uuid";
2
2
  import type { findParam } from "./@types";
3
3
  import type { Actions, Collection } from "../../types";
4
4
  import { ObjectId } from "mongodb";
5
- import { mapKeys, omit } from "radash";
5
+ import { get, mapKeys, omit } from "radash";
6
6
  import { getCollection, getFieldCollection } from "../../lib/collection";
7
7
  import { isDate } from "../../utils";
8
8
  import generateUniqueId from "generate-unique-id";
@@ -89,7 +89,11 @@ function buildPipeline(params: findParam, col?: Collection | undefined | null) {
89
89
  },
90
90
  });
91
91
 
92
- if (!field?.relation?.hasMany) {
92
+ if (
93
+ !field?.relation?.hasMany &&
94
+ getFieldCollection(inc?.localField, col) &&
95
+ !inc?.unwind
96
+ ) {
93
97
  pipeline.push({
94
98
  $unwind: {
95
99
  path: `$${inc?.as || inc?.localField || field?.name}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.8.12",
3
+ "version": "0.8.14",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {