@keltoi/hydra 2.5.1 → 2.5.3

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.
Files changed (2) hide show
  1. package/index.js +8 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -212,7 +212,7 @@ class Traceable extends Entity{
212
212
  }){
213
213
  super(key,struct);
214
214
 
215
- this.#createdAt = createdAt;
215
+ this.#createdAt = createdAt instanceof Date ? createdAt : new Date(createdAt);
216
216
  }
217
217
 
218
218
  get createdAt(){ return this.#createdAt }
@@ -328,8 +328,12 @@ class Changeable extends Entity{
328
328
  struct
329
329
  );
330
330
 
331
- this.#createdAt = createdAt;
332
- this.#updatedAt = updatedAt;
331
+ this.#createdAt = createdAt instanceof Date ? createdAt : new Date(createdAt);
332
+ this.#updatedAt = updatedAt instanceof Date
333
+ ? updatedAt
334
+ : !!updatedAt
335
+ ? new Date(updatedAt)
336
+ : undefined;
333
337
  this.#active = active;
334
338
  }
335
339
 
@@ -719,7 +723,7 @@ class TraceableRepository extends Repository$1{
719
723
  this.myContext()
720
724
  .insert(
721
725
  {
722
- ...entity.$,
726
+ ...entity.data,
723
727
  createdAt:new Date()
724
728
  },
725
729
  Object.keys(entity.key)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keltoi/hydra",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "description": "Boilerplate to start your API from zero using Repository Pattern",
5
5
  "main": "index.js",
6
6
  "module": "index.js",