s3db.js 4.1.1 → 4.1.2

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/s3db.cjs.js CHANGED
@@ -9606,20 +9606,13 @@ class Resource extends EventEmitter {
9606
9606
  * @returns {string} SHA256 hash of the schema definition
9607
9607
  */
9608
9608
  getDefinitionHash() {
9609
- const exportedSchema = this.schema.export();
9610
- const stableSchema = {
9611
- ...exportedSchema,
9612
- attributes: { ...exportedSchema.attributes }
9613
- };
9609
+ const attributes = this.schema.export().attributes;
9610
+ const stableAttributes = { ...attributes };
9614
9611
  if (this.options.timestamps) {
9615
- delete stableSchema.attributes.createdAt;
9616
- delete stableSchema.attributes.updatedAt;
9617
- if (stableSchema.options && stableSchema.options.partitions) {
9618
- delete stableSchema.options.partitions.byCreatedDate;
9619
- delete stableSchema.options.partitions.byUpdatedDate;
9620
- }
9612
+ delete stableAttributes.createdAt;
9613
+ delete stableAttributes.updatedAt;
9621
9614
  }
9622
- const stableString = jsonStableStringify(stableSchema);
9615
+ const stableString = jsonStableStringify(stableAttributes);
9623
9616
  return `sha256:${crypto.createHash("sha256").update(stableString).digest("hex")}`;
9624
9617
  }
9625
9618
  /**
@@ -9813,7 +9806,7 @@ class Database extends EventEmitter {
9813
9806
  this.version = "1";
9814
9807
  this.s3dbVersion = (() => {
9815
9808
  try {
9816
- return true ? "4.1.0" : "latest";
9809
+ return true ? "4.1.1" : "latest";
9817
9810
  } catch (e) {
9818
9811
  return "latest";
9819
9812
  }
@@ -9928,7 +9921,13 @@ class Database extends EventEmitter {
9928
9921
  * @returns {string} SHA256 hash
9929
9922
  */
9930
9923
  generateDefinitionHash(definition) {
9931
- const stableString = jsonStableStringify(definition);
9924
+ const attributes = definition.attributes;
9925
+ const stableAttributes = { ...attributes };
9926
+ if (definition.options?.timestamps) {
9927
+ delete stableAttributes.createdAt;
9928
+ delete stableAttributes.updatedAt;
9929
+ }
9930
+ const stableString = jsonStableStringify(stableAttributes);
9932
9931
  return `sha256:${crypto.createHash("sha256").update(stableString).digest("hex")}`;
9933
9932
  }
9934
9933
  /**