@guren/orm 2.13.1 → 2.14.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.
- package/dist/index.d.ts +8 -5
- package/dist/index.js +8 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -279,11 +279,14 @@ declare class QueryBuilder<TRecord extends PlainObject = PlainObject, TResult ex
|
|
|
279
279
|
perPage?: number;
|
|
280
280
|
}): Promise<PaginatedResult<TResult>>;
|
|
281
281
|
/**
|
|
282
|
-
* Bulk update. Mass-assignment protection and persistence preparation
|
|
283
|
-
*
|
|
284
|
-
* `
|
|
285
|
-
|
|
286
|
-
|
|
282
|
+
* Bulk update. Mass-assignment protection and persistence preparation apply
|
|
283
|
+
* exactly as in `Model.update()`; per-record hooks and observers are skipped.
|
|
284
|
+
* `set` holds the columns the server chooses (RFC 0031); `data` is untyped
|
|
285
|
+
* here, so a key in both is refused at runtime only, by `filterFillable()`.
|
|
286
|
+
*/
|
|
287
|
+
update(data: PlainObject, options?: {
|
|
288
|
+
set?: PlainObject;
|
|
289
|
+
}): Promise<TRecord>;
|
|
287
290
|
/**
|
|
288
291
|
* Bulk update bypassing mass-assignment protection. Trusted server-side data
|
|
289
292
|
* only, never raw request input.
|
package/dist/index.js
CHANGED
|
@@ -1554,12 +1554,13 @@ var QueryBuilder = class QueryBuilder {
|
|
|
1554
1554
|
};
|
|
1555
1555
|
}
|
|
1556
1556
|
/**
|
|
1557
|
-
* Bulk update. Mass-assignment protection and persistence preparation
|
|
1558
|
-
*
|
|
1559
|
-
* `
|
|
1557
|
+
* Bulk update. Mass-assignment protection and persistence preparation apply
|
|
1558
|
+
* exactly as in `Model.update()`; per-record hooks and observers are skipped.
|
|
1559
|
+
* `set` holds the columns the server chooses (RFC 0031); `data` is untyped
|
|
1560
|
+
* here, so a key in both is refused at runtime only, by `filterFillable()`.
|
|
1560
1561
|
*/
|
|
1561
|
-
async update(data) {
|
|
1562
|
-
return this.runBulkUpdate(data, true);
|
|
1562
|
+
async update(data, options) {
|
|
1563
|
+
return this.runBulkUpdate(data, true, options?.set);
|
|
1563
1564
|
}
|
|
1564
1565
|
/**
|
|
1565
1566
|
* Bulk update bypassing mass-assignment protection. Trusted server-side data
|
|
@@ -1568,9 +1569,9 @@ var QueryBuilder = class QueryBuilder {
|
|
|
1568
1569
|
async forceUpdate(data) {
|
|
1569
1570
|
return this.runBulkUpdate(data, false);
|
|
1570
1571
|
}
|
|
1571
|
-
async runBulkUpdate(data, applyFillable) {
|
|
1572
|
+
async runBulkUpdate(data, applyFillable, set) {
|
|
1572
1573
|
const model = this.modelClass;
|
|
1573
|
-
const filtered = applyFillable ? model.filterFillable(data) : { ...data };
|
|
1574
|
+
const filtered = applyFillable ? model.filterFillable(data, set) : { ...data };
|
|
1574
1575
|
const payload = await model.prepareBulkPersistencePayload(filtered);
|
|
1575
1576
|
return this[PREPARED_UPDATE](payload);
|
|
1576
1577
|
}
|