@bunyad/orm 0.2.0-beta.4 → 0.2.0-beta.5
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/model.js +3 -3
- package/package.json +3 -3
package/dist/model.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DatabaseManager as Db, setDefaultConnection, connections, LengthAwarePaginator, CursorPaginator, Paginator, dateTimeForStorage, withoutQueryWriteHook, wrapSqlName, } from "@bunyad/database";
|
|
1
|
+
import { DatabaseManager as Db, setDefaultConnection, connections, scopedConnection, LengthAwarePaginator, CursorPaginator, Paginator, dateTimeForStorage, withoutQueryWriteHook, wrapSqlName, } from "@bunyad/database";
|
|
2
2
|
import { Collection, LazyCollection } from "@bunyad/common";
|
|
3
3
|
import { OrmCollection } from "./orm-collection.js";
|
|
4
4
|
import { Attribute, castFromStorage, castToStorage, hashCastValue, isAlreadyHashed, enumFromStorage, enumToStorage, isAttribute, isCastType, parseCast, formatPhpDate, isEnumCast, } from "./casts.js";
|
|
@@ -22,7 +22,7 @@ export class ModelNotFoundException extends Error {
|
|
|
22
22
|
/** Resolve a connection name or handle to a live Connection. */
|
|
23
23
|
export function resolveConnection(connection) {
|
|
24
24
|
if (connection == null) {
|
|
25
|
-
return defaultConnection ?? connections.connection();
|
|
25
|
+
return scopedConnection() ?? defaultConnection ?? connections.connection();
|
|
26
26
|
}
|
|
27
27
|
if (typeof connection === "string") {
|
|
28
28
|
return connections.connection(connection);
|
|
@@ -915,7 +915,7 @@ export class Model {
|
|
|
915
915
|
}
|
|
916
916
|
const driver = (this.connection != null
|
|
917
917
|
? resolveConnection(this.connection)
|
|
918
|
-
: defaultConnection)?.driver;
|
|
918
|
+
: (scopedConnection() ?? defaultConnection))?.driver;
|
|
919
919
|
let out = { ...attributes };
|
|
920
920
|
for (const [key, definition] of Object.entries(casts)) {
|
|
921
921
|
if (isAttribute(definition)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunyad/orm",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.5",
|
|
4
4
|
"description": "Active-record ORM for Bunyad: models, relations, casts, scopes, events, factories.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Shah Khalid",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@bunyad/common": "^0.2.0-beta.
|
|
40
|
-
"@bunyad/database": "^0.2.0-beta.
|
|
39
|
+
"@bunyad/common": "^0.2.0-beta.5",
|
|
40
|
+
"@bunyad/database": "^0.2.0-beta.5"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|