@naturalcycles/db-lib
Advanced tools
Comparing version 8.39.0 to 8.40.0
@@ -31,2 +31,3 @@ "use strict"; | ||
createId: true, | ||
assignGeneratedIds: false, | ||
created: true, | ||
@@ -454,3 +455,3 @@ updated: true, | ||
this.requireWriteAccess(); | ||
const idWasGenerated = !bm.id; | ||
const idWasGenerated = !bm.id && this.cfg.createId; | ||
this.assignIdCreatedUpdated(bm, opt); // mutates | ||
@@ -468,2 +469,3 @@ const dbm = await this.bmToDBM(bm, opt); | ||
excludeFromIndexes: this.cfg.excludeFromIndexes, | ||
assignGeneratedIds: this.cfg.assignGeneratedIds, | ||
...opt, | ||
@@ -502,3 +504,3 @@ }); | ||
if (!opt.raw) { | ||
const idWasGenerated = !dbm.id; | ||
const idWasGenerated = !dbm.id && this.cfg.createId; | ||
this.assignIdCreatedUpdated(dbm, opt); // mutates | ||
@@ -516,2 +518,3 @@ dbm = this.anyToDBM(dbm, opt); | ||
excludeFromIndexes: this.cfg.excludeFromIndexes, | ||
assignGeneratedIds: this.cfg.assignGeneratedIds, | ||
...opt, | ||
@@ -539,2 +542,3 @@ }); | ||
excludeFromIndexes: this.cfg.excludeFromIndexes, | ||
assignGeneratedIds: this.cfg.assignGeneratedIds, | ||
...opt, | ||
@@ -564,2 +568,3 @@ }); | ||
excludeFromIndexes: this.cfg.excludeFromIndexes, | ||
assignGeneratedIds: this.cfg.assignGeneratedIds, | ||
...opt, | ||
@@ -566,0 +571,0 @@ }); |
@@ -90,2 +90,7 @@ import { CommonLogger, ErrorMode, ObjectWithId, Saved } from '@naturalcycles/js-lib'; | ||
/** | ||
* See the same option in CommonDB. | ||
* Defaults to false normally. | ||
*/ | ||
assignGeneratedIds?: boolean; | ||
/** | ||
* Defaults to true | ||
@@ -92,0 +97,0 @@ * Set to false to disable `created` field management. |
@@ -22,2 +22,9 @@ import { AnyObjectWithId, ObjectWithId } from '@naturalcycles/js-lib'; | ||
saveMethod?: CommonDBSaveMethod; | ||
/** | ||
* Only applicable to tables where id is "auto-generated by DB", e.g `auto_increment` in MySQL. | ||
* By default it's false, so, auto-generated id will NOT be assigned/returned. | ||
* Setting it to true will assign and return auto-generated id (on all rows, one by one). | ||
* It's not true by default, because getting auto-generated id incurs an overhead of doing extra call (e.g LAST_INSERT_ID() in MySQL). | ||
*/ | ||
assignGeneratedIds?: boolean; | ||
} | ||
@@ -24,0 +31,0 @@ export declare type CommonDBStreamOptions = CommonDBOptions; |
@@ -45,3 +45,3 @@ { | ||
}, | ||
"version": "8.39.0", | ||
"version": "8.40.0", | ||
"description": "Lowest Common Denominator API to supported Databases", | ||
@@ -48,0 +48,0 @@ "keywords": [ |
@@ -123,2 +123,8 @@ import { CommonLogger, ErrorMode, ObjectWithId, Saved } from '@naturalcycles/js-lib' | ||
/** | ||
* See the same option in CommonDB. | ||
* Defaults to false normally. | ||
*/ | ||
assignGeneratedIds?: boolean | ||
/** | ||
* Defaults to true | ||
@@ -125,0 +131,0 @@ * Set to false to disable `created` field management. |
@@ -76,2 +76,3 @@ import { | ||
createId: true, | ||
assignGeneratedIds: false, | ||
created: true, | ||
@@ -613,3 +614,3 @@ updated: true, | ||
this.requireWriteAccess() | ||
const idWasGenerated = !bm.id | ||
const idWasGenerated = !bm.id && this.cfg.createId | ||
this.assignIdCreatedUpdated(bm, opt) // mutates | ||
@@ -626,2 +627,3 @@ const dbm = await this.bmToDBM(bm as BM, opt) | ||
excludeFromIndexes: this.cfg.excludeFromIndexes, | ||
assignGeneratedIds: this.cfg.assignGeneratedIds, | ||
...opt, | ||
@@ -673,3 +675,3 @@ }) | ||
if (!opt.raw) { | ||
const idWasGenerated = !dbm.id | ||
const idWasGenerated = !dbm.id && this.cfg.createId | ||
this.assignIdCreatedUpdated(dbm, opt) // mutates | ||
@@ -686,2 +688,3 @@ dbm = this.anyToDBM(dbm, opt) | ||
excludeFromIndexes: this.cfg.excludeFromIndexes, | ||
assignGeneratedIds: this.cfg.assignGeneratedIds, | ||
...opt, | ||
@@ -714,2 +717,3 @@ }) | ||
excludeFromIndexes: this.cfg.excludeFromIndexes, | ||
assignGeneratedIds: this.cfg.assignGeneratedIds, | ||
...opt, | ||
@@ -745,2 +749,3 @@ }) | ||
excludeFromIndexes: this.cfg.excludeFromIndexes, | ||
assignGeneratedIds: this.cfg.assignGeneratedIds, | ||
...opt, | ||
@@ -747,0 +752,0 @@ }) |
@@ -27,2 +27,10 @@ import { AnyObjectWithId, ObjectWithId } from '@naturalcycles/js-lib' | ||
saveMethod?: CommonDBSaveMethod | ||
/** | ||
* Only applicable to tables where id is "auto-generated by DB", e.g `auto_increment` in MySQL. | ||
* By default it's false, so, auto-generated id will NOT be assigned/returned. | ||
* Setting it to true will assign and return auto-generated id (on all rows, one by one). | ||
* It's not true by default, because getting auto-generated id incurs an overhead of doing extra call (e.g LAST_INSERT_ID() in MySQL). | ||
*/ | ||
assignGeneratedIds?: boolean | ||
} | ||
@@ -29,0 +37,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
373962
9609