@hostlink/nuxt-light 0.0.59 → 0.0.61
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 +1 -1
- package/dist/runtime/lib/getObject.d.ts +1 -1
- package/dist/runtime/lib/getObject.mjs +1 -1
- package/dist/runtime/lib/listData.d.ts +1 -1
- package/dist/runtime/lib/listData.mjs +36 -20
- package/dist/runtime/lib/q.d.ts +1 -1
- package/dist/runtime/lib/q.mjs +1 -1
- package/package.json +1 -2
package/dist/module.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function (fields?: Array<string>): Promise<any>;
|
|
1
|
+
export default function (fields?: Array<string | Object>): Promise<any>;
|
|
@@ -9,7 +9,7 @@ export default async function(fields = []) {
|
|
|
9
9
|
const id = parseInt(route.params[id_name]);
|
|
10
10
|
const filters = {};
|
|
11
11
|
filters[id_name] = id;
|
|
12
|
-
if (fields.length == 0) {
|
|
12
|
+
if (fields instanceof Array && fields.length == 0) {
|
|
13
13
|
fields.push(id_name);
|
|
14
14
|
}
|
|
15
15
|
let { data } = await listData(module, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function listData(name: string, props?: any, fields?: Array<string>): Promise<any>;
|
|
1
|
+
export default function listData(name: string, props?: any, fields?: Array<string | Object> | Object): Promise<any>;
|
|
@@ -1,32 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import f from "./f.mjs";
|
|
1
|
+
import { query, toQuery } from "@hostlink/light";
|
|
3
2
|
export default async function listData(name, props = {}, fields = []) {
|
|
4
|
-
let
|
|
3
|
+
let json = {};
|
|
5
4
|
if (props.sort) {
|
|
6
|
-
|
|
5
|
+
json.__args = json.__args || {};
|
|
6
|
+
json.__args.sort = props.sort;
|
|
7
7
|
}
|
|
8
8
|
if (props.filters) {
|
|
9
|
-
|
|
9
|
+
json.__args = json.__args || {};
|
|
10
|
+
json.__args.filters = props.filters;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
json.data = {};
|
|
12
13
|
if (props.offset) {
|
|
13
|
-
|
|
14
|
+
json.data.__args = json.data.__args || {};
|
|
15
|
+
json.data.__args.offset = props.offset;
|
|
14
16
|
}
|
|
15
17
|
if (props.limit) {
|
|
16
|
-
|
|
18
|
+
json.data.__args = json.data.__args || {};
|
|
19
|
+
json.data.__args.limit = props.limit;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
key: data.meta.key,
|
|
28
|
-
name: data.meta.name
|
|
21
|
+
if (fields instanceof Array) {
|
|
22
|
+
fields.forEach((field) => {
|
|
23
|
+
if (field instanceof Object) {
|
|
24
|
+
Object.entries(field).forEach(([key, value]) => {
|
|
25
|
+
json.data[key] = toQuery(value);
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
json.data[field] = true;
|
|
29
|
+
}
|
|
29
30
|
});
|
|
31
|
+
} else if (fields instanceof Object) {
|
|
32
|
+
json.data = Object.assign({}, fields);
|
|
33
|
+
if (props.fields) {
|
|
34
|
+
props.fields.forEach((field) => {
|
|
35
|
+
json.data[field] = true;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
30
38
|
}
|
|
31
|
-
|
|
39
|
+
json.meta = {
|
|
40
|
+
total: true,
|
|
41
|
+
key: true,
|
|
42
|
+
name: true
|
|
43
|
+
};
|
|
44
|
+
const q = {};
|
|
45
|
+
q[`list${name}`] = json;
|
|
46
|
+
let data = await query(q);
|
|
47
|
+
return data[`list${name}`];
|
|
32
48
|
}
|
package/dist/runtime/lib/q.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function (operation: string | object, args
|
|
1
|
+
export default function (operation: string | object, args?: any, fields?: Array<any>): Promise<any>;
|
package/dist/runtime/lib/q.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import f from "./f.mjs";
|
|
|
3
3
|
import { jsonToGraphQLQuery } from "json-to-graphql-query";
|
|
4
4
|
import { getApiBase } from "./index.mjs";
|
|
5
5
|
import toJson from "./toJson.mjs";
|
|
6
|
-
export default async function(operation, args, fields = []) {
|
|
6
|
+
export default async function(operation, args = null, fields = []) {
|
|
7
7
|
const service = axios.create({
|
|
8
8
|
withCredentials: true
|
|
9
9
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hostlink/nuxt-light",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.61",
|
|
4
4
|
"description": "HostLink Nuxt Light Framework",
|
|
5
5
|
"repository": "@hostlink/nuxt-light",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"route-gen": "node route-generate.mjs"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@formkit/inputs": "^1.1.0",
|
|
38
37
|
"@hostlink/light": "^0.0.12",
|
|
39
38
|
"@nuxt/kit": "^3.7.0",
|
|
40
39
|
"@quasar/extras": "^1.16.6",
|