@zuzjs/orm 0.2.9 → 0.3.0

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.
@@ -20,6 +20,7 @@ declare class ZormQueryBuilder<T extends ObjectLiteral, R = QueryResult> extends
20
20
  _getRawQuery(): [string, any[]];
21
21
  active(): this;
22
22
  _saveActiveRecord(activeRecord: T): Promise<T | null>;
23
+ clone(): ZormQueryBuilder<T, R>;
23
24
  /**
24
25
  * Sets the values for an insert or update query.
25
26
  * @param data - The data to be inserted or updated.
@@ -96,6 +96,16 @@ class ZormQueryBuilder extends Promise {
96
96
  return this.repository.save(activeRecord);
97
97
  // return this
98
98
  }
99
+ clone() {
100
+ const cloned = new ZormQueryBuilder(this.repository, this.action, this.usePromise);
101
+ cloned.queryBuilder = this.queryBuilder.clone(); // Deep clone of query builder
102
+ cloned.entityAlias = this.entityAlias;
103
+ cloned.queryValues = this.queryValues ? structuredClone(this.queryValues) : null;
104
+ cloned.whereCount = this.whereCount;
105
+ cloned.isActiveRecord = this.isActiveRecord;
106
+ cloned.activeRecord = this.activeRecord;
107
+ return cloned;
108
+ }
99
109
  /**
100
110
  * Sets the values for an insert or update query.
101
111
  * @param data - The data to be inserted or updated.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuzjs/orm",
3
- "version": "0.2.9",
3
+ "version": "0.3.0",
4
4
  "keywords": [
5
5
  "orm",
6
6
  "zuz",