@nextcloud/files 3.4.0 → 3.4.1

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.
@@ -60,10 +60,12 @@ export declare abstract class Node {
60
60
  get mime(): string | undefined;
61
61
  /**
62
62
  * Get the file modification time
63
- * There is no setter as the modification time is not meant to be changed manually.
64
- * It will be automatically updated when the attributes are changed.
65
63
  */
66
64
  get mtime(): Date | undefined;
65
+ /**
66
+ * Set the file modification time
67
+ */
68
+ set mtime(mtime: Date | undefined);
67
69
  /**
68
70
  * Get the file creation time
69
71
  * There is no setter as the creation time is not meant to be changed
@@ -136,11 +138,12 @@ export declare abstract class Node {
136
138
  */
137
139
  rename(basename: string): void;
138
140
  /**
139
- * Update the mtime if exists.
141
+ * Update the mtime if exists
140
142
  */
141
- private updateMtime;
143
+ updateMtime(): void;
142
144
  /**
143
145
  * Update the attributes of the node
146
+ * Warning, updating attributes will NOT automatically update the mtime.
144
147
  *
145
148
  * @param attributes The new attributes to update on the Node attributes
146
149
  */
package/dist/index.cjs CHANGED
@@ -701,14 +701,12 @@ class Node {
701
701
  if (this.readonlyAttributes.includes(prop)) {
702
702
  return false;
703
703
  }
704
- this.updateMtime();
705
704
  return Reflect.set(target, prop, value);
706
705
  },
707
706
  deleteProperty: (target, prop) => {
708
707
  if (this.readonlyAttributes.includes(prop)) {
709
708
  return false;
710
709
  }
711
- this.updateMtime();
712
710
  return Reflect.deleteProperty(target, prop);
713
711
  },
714
712
  // TODO: This is deprecated and only needed for files v3
@@ -725,7 +723,6 @@ class Node {
725
723
  this._data = { ...data, attributes: {} };
726
724
  this._attributes = new Proxy(this._data.attributes, this.handler);
727
725
  this.update(data.attributes ?? {});
728
- this._data.mtime = data.mtime;
729
726
  if (davService) {
730
727
  this._knownDavService = davService;
731
728
  }
@@ -790,12 +787,16 @@ class Node {
790
787
  }
791
788
  /**
792
789
  * Get the file modification time
793
- * There is no setter as the modification time is not meant to be changed manually.
794
- * It will be automatically updated when the attributes are changed.
795
790
  */
796
791
  get mtime() {
797
792
  return this._data.mtime;
798
793
  }
794
+ /**
795
+ * Set the file modification time
796
+ */
797
+ set mtime(mtime) {
798
+ this._data.mtime = mtime;
799
+ }
799
800
  /**
800
801
  * Get the file creation time
801
802
  * There is no setter as the creation time is not meant to be changed
@@ -927,7 +928,7 @@ class Node {
927
928
  this.move(path.dirname(this.source) + "/" + basename2);
928
929
  }
929
930
  /**
930
- * Update the mtime if exists.
931
+ * Update the mtime if exists
931
932
  */
932
933
  updateMtime() {
933
934
  if (this._data.mtime) {
@@ -936,6 +937,7 @@ class Node {
936
937
  }
937
938
  /**
938
939
  * Update the attributes of the node
940
+ * Warning, updating attributes will NOT automatically update the mtime.
939
941
  *
940
942
  * @param attributes The new attributes to update on the Node attributes
941
943
  */