velocious 1.0.615 → 1.0.617
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/README.md +11 -0
- package/build/database/record/index.js +14 -0
- package/build/database/record/instance-relationships/has-one.js +6 -0
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +16 -1
- package/build/src/database/record/instance-relationships/has-one.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/has-one.js +5 -1
- package/build/src/testing/test-runner.d.ts.map +1 -1
- package/build/src/testing/test-runner.js +26 -18
- package/build/testing/test-runner.js +24 -17
- package/package.json +1 -1
- package/src/database/record/index.js +14 -0
- package/src/database/record/instance-relationships/has-one.js +6 -0
- package/src/testing/test-runner.js +24 -17
|
@@ -1307,26 +1307,33 @@ export default class TestRunner {
|
|
|
1307
1307
|
})
|
|
1308
1308
|
} finally {
|
|
1309
1309
|
try {
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
}
|
|
1310
|
+
// Framework-owned post-commit broadcasts are intentionally
|
|
1311
|
+
// detached; drain them before test cleanup so their DB
|
|
1312
|
+
// checkouts cannot leak into the next test's lifecycle.
|
|
1313
|
+
await this.getConfiguration().awaitPendingBroadcasts()
|
|
1315
1314
|
} finally {
|
|
1316
1315
|
try {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1316
|
+
if (testSharedConnectionsActive) {
|
|
1317
|
+
this.clearTestSharedConnections(testSharedConnectionRegistrations)
|
|
1318
|
+
testSharedConnectionRegistrations = []
|
|
1319
|
+
testSharedConnectionsActive = false
|
|
1320
|
+
}
|
|
1320
1321
|
} finally {
|
|
1321
|
-
|
|
1322
|
-
await this.
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1322
|
+
try {
|
|
1323
|
+
await this.stopSharedTransactionBroker(sharedTransactionBrokerRegistration || sharedTransactionBrokerPreparation)
|
|
1324
|
+
sharedTransactionBrokerRegistration = undefined
|
|
1325
|
+
sharedTransactionBrokerPreparation = undefined
|
|
1326
|
+
} finally {
|
|
1327
|
+
for (const afterEachData of newAfterEaches) {
|
|
1328
|
+
await this.runProfileSpan({
|
|
1329
|
+
phase: "afterEach",
|
|
1330
|
+
declarationIndex: afterEachData.declarationIndex,
|
|
1331
|
+
declarationScopeId: afterEachData.declarationScopeId,
|
|
1332
|
+
filePath: afterEachData.ownerFilePath
|
|
1333
|
+
}, async () => {
|
|
1334
|
+
await afterEachData.callback({configuration: this.getConfiguration(), testArgs, testData})
|
|
1335
|
+
})
|
|
1336
|
+
}
|
|
1330
1337
|
}
|
|
1331
1338
|
}
|
|
1332
1339
|
}
|
package/package.json
CHANGED
|
@@ -3992,6 +3992,20 @@ class VelociousDatabaseRecord {
|
|
|
3992
3992
|
} else {
|
|
3993
3993
|
throw new Error(`Unexpected loaded type: ${typeof loadedModels}`)
|
|
3994
3994
|
}
|
|
3995
|
+
} else if (instanceRelationship.getType() == "hasOne") {
|
|
3996
|
+
if (!instanceRelationship.isLoaded()) {
|
|
3997
|
+
await instanceRelationship.load()
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
const loadedModel = instanceRelationship.loaded()
|
|
4001
|
+
|
|
4002
|
+
if (loadedModel instanceof VelociousDatabaseRecord) {
|
|
4003
|
+
models = [loadedModel]
|
|
4004
|
+
} else if (loadedModel === undefined) {
|
|
4005
|
+
models = []
|
|
4006
|
+
} else {
|
|
4007
|
+
throw new Error(`Unexpected loaded type: ${typeof loadedModel}`)
|
|
4008
|
+
}
|
|
3995
4009
|
} else {
|
|
3996
4010
|
throw new Error(`Unhandled relationship type: ${instanceRelationship.getType()}`)
|
|
3997
4011
|
}
|
|
@@ -66,6 +66,12 @@ export default class VelociousDatabaseRecordHasOneInstanceRelationship extends B
|
|
|
66
66
|
|
|
67
67
|
whereArgs[foreignKey] = primaryModelID
|
|
68
68
|
|
|
69
|
+
if (this.getRelationship().getPolymorphic()) {
|
|
70
|
+
const typeColumn = this.getRelationship().getPolymorphicTypeColumn()
|
|
71
|
+
|
|
72
|
+
whereArgs[typeColumn] = this.getModel().getModelClass().getModelName()
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
let query = this.getModel().queryForModel(TargetModelClass).where(whereArgs)
|
|
70
76
|
|
|
71
77
|
query = this.applyScope(query)
|
|
@@ -1307,26 +1307,33 @@ export default class TestRunner {
|
|
|
1307
1307
|
})
|
|
1308
1308
|
} finally {
|
|
1309
1309
|
try {
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
}
|
|
1310
|
+
// Framework-owned post-commit broadcasts are intentionally
|
|
1311
|
+
// detached; drain them before test cleanup so their DB
|
|
1312
|
+
// checkouts cannot leak into the next test's lifecycle.
|
|
1313
|
+
await this.getConfiguration().awaitPendingBroadcasts()
|
|
1315
1314
|
} finally {
|
|
1316
1315
|
try {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1316
|
+
if (testSharedConnectionsActive) {
|
|
1317
|
+
this.clearTestSharedConnections(testSharedConnectionRegistrations)
|
|
1318
|
+
testSharedConnectionRegistrations = []
|
|
1319
|
+
testSharedConnectionsActive = false
|
|
1320
|
+
}
|
|
1320
1321
|
} finally {
|
|
1321
|
-
|
|
1322
|
-
await this.
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1322
|
+
try {
|
|
1323
|
+
await this.stopSharedTransactionBroker(sharedTransactionBrokerRegistration || sharedTransactionBrokerPreparation)
|
|
1324
|
+
sharedTransactionBrokerRegistration = undefined
|
|
1325
|
+
sharedTransactionBrokerPreparation = undefined
|
|
1326
|
+
} finally {
|
|
1327
|
+
for (const afterEachData of newAfterEaches) {
|
|
1328
|
+
await this.runProfileSpan({
|
|
1329
|
+
phase: "afterEach",
|
|
1330
|
+
declarationIndex: afterEachData.declarationIndex,
|
|
1331
|
+
declarationScopeId: afterEachData.declarationScopeId,
|
|
1332
|
+
filePath: afterEachData.ownerFilePath
|
|
1333
|
+
}, async () => {
|
|
1334
|
+
await afterEachData.callback({configuration: this.getConfiguration(), testArgs, testData})
|
|
1335
|
+
})
|
|
1336
|
+
}
|
|
1330
1337
|
}
|
|
1331
1338
|
}
|
|
1332
1339
|
}
|