@dnax/core 0.8.11 → 0.8.13

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(
package/lib/collection.ts CHANGED
@@ -234,6 +234,8 @@ function getKeyFields(col: Collection) {
234
234
  return keyFields;
235
235
  }
236
236
 
237
+
238
+
237
239
  export {
238
240
  loadAllCollections,
239
241
  getCollection,
package/lib/schema.ts CHANGED
@@ -4,6 +4,11 @@ import v, { type AnySchema } from "joi";
4
4
  function buildSchema(col: Collection) {
5
5
  let propertySchema = {} as { [key: string]: AnySchema };
6
6
 
7
+ if (col?.timestamps) {
8
+ propertySchema["createdAt"] = v.date();
9
+ propertySchema["updatedAt"] = v.date();
10
+ }
11
+
7
12
  if (col?.media) {
8
13
  propertySchema["_file"] = v.object();
9
14
  }
@@ -134,7 +139,7 @@ function buildSchema(col: Collection) {
134
139
  }
135
140
  });
136
141
 
137
- let buildSchema = v.object(propertySchema).unknown();
142
+ let buildSchema = v.object(propertySchema);
138
143
 
139
144
  return buildSchema;
140
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.8.11",
3
+ "version": "0.8.13",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {