@hostlink/nuxt-light 1.33.0 → 1.33.1

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,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.33.0",
4
+ "version": "1.33.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
@@ -1 +1 @@
1
- export default function (fields: Object): import("#app").AsyncData<any, import("#app").NuxtError<unknown> | null> | undefined;
1
+ export default function (fields: Object): import("#app").AsyncData<void | null, import("#app").NuxtError<unknown> | null> | undefined;
@@ -12,14 +12,22 @@ export default function(fields) {
12
12
  const [module, id_name] = route.name.split("-");
13
13
  const id = parseInt(route.params[id_name]);
14
14
  let query = {};
15
+ const specialFields = {};
15
16
  for (const [key, value] of Object.entries(fields)) {
16
- query[key] = value;
17
17
  const f = getModelField(module, key);
18
18
  if (f) {
19
19
  query = defu(query, f.getGQLField());
20
+ specialFields[key] = f;
21
+ } else {
22
+ query[key] = value;
20
23
  }
21
24
  }
22
25
  return useAsyncData(async () => {
23
- return await collect(module, toQuery(query)).where(id_name, id).first();
26
+ const data = await collect(module, toQuery(query)).where(id_name, id).first();
27
+ for (const [key, value] of Object.entries(specialFields)) {
28
+ if (value && typeof value === "object" && "field" in value && typeof value.field === "function") {
29
+ data[key] = value.field(data);
30
+ }
31
+ }
24
32
  });
25
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.33.0",
3
+ "version": "1.33.1",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",