@hostlink/nuxt-light 1.33.1 → 1.33.3
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/module.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function (fields: Object): import("#app").AsyncData<
|
|
1
|
+
export default function (fields: Object): import("#app").AsyncData<any, import("#app").NuxtError<unknown> | null> | undefined;
|
|
@@ -16,8 +16,13 @@ export default function(fields) {
|
|
|
16
16
|
for (const [key, value] of Object.entries(fields)) {
|
|
17
17
|
const f = getModelField(module, key);
|
|
18
18
|
if (f) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const gqlField = f.getGQLField();
|
|
20
|
+
if (typeof gqlField === "string") {
|
|
21
|
+
query[gqlField] = value;
|
|
22
|
+
} else {
|
|
23
|
+
query = defu(query, gqlField);
|
|
24
|
+
specialFields[key] = f;
|
|
25
|
+
}
|
|
21
26
|
} else {
|
|
22
27
|
query[key] = value;
|
|
23
28
|
}
|
|
@@ -25,9 +30,10 @@ export default function(fields) {
|
|
|
25
30
|
return useAsyncData(async () => {
|
|
26
31
|
const data = await collect(module, toQuery(query)).where(id_name, id).first();
|
|
27
32
|
for (const [key, value] of Object.entries(specialFields)) {
|
|
28
|
-
if (value && typeof value === "object" &&
|
|
29
|
-
data[key] = value.
|
|
33
|
+
if (value && typeof value === "object" && typeof value.getValue === "function") {
|
|
34
|
+
data[key] = value.getValue(data);
|
|
30
35
|
}
|
|
31
36
|
}
|
|
37
|
+
return data;
|
|
32
38
|
});
|
|
33
39
|
}
|