velocious 1.0.507 → 1.0.508
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/build/configuration.js +2 -0
- package/build/database/migration/index.js +67 -0
- package/build/database/record/auditing.js +659 -120
- package/build/database/record/index.js +2 -1
- package/build/database/record/instance-relationships/has-many.js +6 -0
- package/build/src/configuration.d.ts.map +1 -1
- package/build/src/configuration.js +3 -1
- package/build/src/database/migration/index.d.ts +30 -0
- package/build/src/database/migration/index.d.ts.map +1 -1
- package/build/src/database/migration/index.js +58 -1
- package/build/src/database/record/auditing.d.ts +97 -40
- package/build/src/database/record/auditing.d.ts.map +1 -1
- package/build/src/database/record/auditing.js +561 -118
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +3 -2
- package/build/src/database/record/instance-relationships/has-many.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/has-many.js +5 -1
- package/package.json +1 -1
- package/src/configuration.js +2 -0
- package/src/database/migration/index.js +67 -0
- package/src/database/record/auditing.js +659 -120
- package/src/database/record/index.js +2 -1
- package/src/database/record/instance-relationships/has-many.js +6 -0
|
@@ -46,7 +46,7 @@ import singularizeModelName from "../../utils/singularize-model-name.js"
|
|
|
46
46
|
import {defineModelScope} from "../../utils/model-scope.js"
|
|
47
47
|
import { normalizeDateStringForWrite, normalizeDateValueForRead, normalizeDateValueForWrite } from "../datetime-storage.js"
|
|
48
48
|
import {formatValue} from "../../utils/format-value.js"
|
|
49
|
-
import {captureCreateAuditChanges, captureUpdateAuditChanges, createAudit, createCreateAudit, createDestroyAudit, createUpdateAudit, registerAuditCallback, registerAuditing, withoutAudit} from "./auditing.js"
|
|
49
|
+
import {captureCreateAuditChanges, captureUpdateAuditChanges, createAudit, createCreateAudit, createDestroyAudit, createUpdateAudit, initializeAuditing, registerAuditCallback, registerAuditing, withoutAudit} from "./auditing.js"
|
|
50
50
|
import {registerMagnitudeCounterCache} from "./counter-cache-magnitude.js"
|
|
51
51
|
import {stateMachine} from "./state-machine.js"
|
|
52
52
|
import ValidatorsFormat from "./validators/format.js"
|
|
@@ -1533,6 +1533,7 @@ class VelociousDatabaseRecord {
|
|
|
1533
1533
|
}
|
|
1534
1534
|
|
|
1535
1535
|
await this._defineTranslationMethods()
|
|
1536
|
+
await initializeAuditing(this)
|
|
1536
1537
|
this._initialized = true
|
|
1537
1538
|
}
|
|
1538
1539
|
|
|
@@ -218,6 +218,12 @@ export default class VelociousDatabaseRecordHasManyInstanceRelationship extends
|
|
|
218
218
|
|
|
219
219
|
whereArgs[foreignKey] = primaryModelID
|
|
220
220
|
|
|
221
|
+
if (this.getRelationship().getPolymorphic()) {
|
|
222
|
+
const typeColumn = this.getRelationship().getPolymorphicTypeColumn()
|
|
223
|
+
|
|
224
|
+
whereArgs[typeColumn] = this.getModel().getModelClass().getModelName()
|
|
225
|
+
}
|
|
226
|
+
|
|
221
227
|
const query = TargetModelClass.where(whereArgs)
|
|
222
228
|
|
|
223
229
|
return this.applyScope(query)
|