@codenameryuu/adonis-lucid-auto-preload 2.6.0 → 2.7.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.
|
@@ -5,8 +5,17 @@ export function AutoPreload(superclass) {
|
|
|
5
5
|
* SoftDeletes uses `query.ignoreDeleted = false` for `.withTrashed()` / `.onlyTrashed()`.
|
|
6
6
|
*/
|
|
7
7
|
static applyPreloadOptions(parent, child, options) {
|
|
8
|
-
if (options?.withTrashed
|
|
9
|
-
child
|
|
8
|
+
if (options?.withTrashed) {
|
|
9
|
+
if (typeof child?.withTrashed === 'function') {
|
|
10
|
+
child.withTrashed();
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
/**
|
|
14
|
+
* Fallback for builders that don't have the `withTrashed` macro attached.
|
|
15
|
+
* `@codenameryuu/adonis-lucid-soft-deletes` checks `ignoreDeleted === false`.
|
|
16
|
+
*/
|
|
17
|
+
child.ignoreDeleted = false;
|
|
18
|
+
}
|
|
10
19
|
}
|
|
11
20
|
this.inheritQueryFlags(parent, child);
|
|
12
21
|
}
|
package/package.json
CHANGED