@hostlink/nuxt-light 0.0.61 → 0.0.62

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,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "0.0.61"
4
+ "version": "0.0.62"
5
5
  }
package/dist/module.mjs CHANGED
@@ -42,7 +42,7 @@ const module = defineNuxtModule({
42
42
  { name: "getApiUrl", from },
43
43
  { name: "getCurrentUser", from },
44
44
  { name: "getObject", from },
45
- { name: "id", from },
45
+ { name: "loadObject", from },
46
46
  { name: "list", from },
47
47
  { name: "listData", from },
48
48
  { name: "m", from },
@@ -7,4 +7,4 @@ interface Light {
7
7
  getVersion(): string;
8
8
  }
9
9
  export declare function useLight(): Light;
10
- export { notify, addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, m, q, removeObject, t, updateObject, getID, deleteObject, listObject, getApiBase } from "./lib";
10
+ export * from "./lib";
@@ -29,23 +29,4 @@ export function useLight() {
29
29
  }
30
30
  };
31
31
  }
32
- export {
33
- notify,
34
- addObject,
35
- f,
36
- getApiUrl,
37
- getCurrentUser,
38
- getObject,
39
- id,
40
- list,
41
- listData,
42
- m,
43
- q,
44
- removeObject,
45
- t,
46
- updateObject,
47
- getID,
48
- deleteObject,
49
- listObject,
50
- getApiBase
51
- } from "./lib/index.mjs";
32
+ export * from "./lib/index.mjs";
@@ -1,5 +1,5 @@
1
1
  import { useRoute } from "vue-router";
2
- import listData from "./listData.mjs";
2
+ import loadObject from "./loadObject.mjs";
3
3
  export default async function(fields = []) {
4
4
  let route = useRoute();
5
5
  if (!route.name) {
@@ -12,11 +12,5 @@ export default async function(fields = []) {
12
12
  if (fields instanceof Array && fields.length == 0) {
13
13
  fields.push(id_name);
14
14
  }
15
- let { data } = await listData(module, {
16
- filters
17
- }, fields);
18
- if (data.length > 0) {
19
- return data[0];
20
- }
21
- return null;
15
+ return await loadObject(module, filters, fields);
22
16
  }
@@ -3,7 +3,6 @@ import f from "./f";
3
3
  import getApiUrl from "./getApiUrl";
4
4
  import getCurrentUser from "./getCurrentUser";
5
5
  import getObject from "./getObject";
6
- import id from "./id";
7
6
  import list from "./list";
8
7
  import listData from "./listData";
9
8
  import m from "./m";
@@ -13,8 +12,9 @@ import deleteObject from "./deleteObject";
13
12
  import t from "./t";
14
13
  import updateObject from "./updateObject";
15
14
  import listObject from "./listObject";
15
+ import loadObject from "./loadObject";
16
16
  import isGranted from "./isGranted";
17
17
  declare const notify: (message: string, color?: string) => void;
18
18
  import getID from "./getID";
19
19
  declare const getApiBase: () => {};
20
- export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, m, q, removeObject, t, updateObject, notify, getID, deleteObject, listObject, isGranted, getApiBase };
20
+ export { addObject, f, getApiUrl, getCurrentUser, getObject, list, listData, m, q, removeObject, t, updateObject, notify, getID, deleteObject, listObject, isGranted, getApiBase, loadObject };
@@ -5,7 +5,6 @@ import f from "./f.mjs";
5
5
  import getApiUrl from "./getApiUrl.mjs";
6
6
  import getCurrentUser from "./getCurrentUser.mjs";
7
7
  import getObject from "./getObject.mjs";
8
- import id from "./id.mjs";
9
8
  import list from "./list.mjs";
10
9
  import listData from "./listData.mjs";
11
10
  import m from "./m.mjs";
@@ -15,6 +14,7 @@ import deleteObject from "./deleteObject.mjs";
15
14
  import t from "./t.mjs";
16
15
  import updateObject from "./updateObject.mjs";
17
16
  import listObject from "./listObject.mjs";
17
+ import loadObject from "./loadObject.mjs";
18
18
  import isGranted from "./isGranted.mjs";
19
19
  const notify = function(message, color = "green") {
20
20
  Notify.create({
@@ -34,7 +34,6 @@ export {
34
34
  getApiUrl,
35
35
  getCurrentUser,
36
36
  getObject,
37
- id,
38
37
  list,
39
38
  listData,
40
39
  m,
@@ -47,5 +46,6 @@ export {
47
46
  deleteObject,
48
47
  listObject,
49
48
  isGranted,
50
- getApiBase
49
+ getApiBase,
50
+ loadObject
51
51
  };
@@ -0,0 +1 @@
1
+ export default function (module: string, filters: Object, fields?: Array<string | Object>): Promise<any>;
@@ -0,0 +1,10 @@
1
+ import listData from "./listData.mjs";
2
+ export default async function(module, filters, fields = []) {
3
+ let { data } = await listData(module, {
4
+ filters
5
+ }, fields);
6
+ if (data.length > 0) {
7
+ return data[0];
8
+ }
9
+ return null;
10
+ }
@@ -1,6 +1,11 @@
1
1
  <script setup>
2
- import { getObject } from '../../../';
3
- const obj = await getObject(["username", "first_name", "last_name", "email", "phone", "roles"]);
2
+ import { getObject, loadObject } from '../../../';
3
+ const obj = await getObject(["user_id", "username", "first_name", "last_name", "email", "phone", "roles"]);
4
+
5
+ /* const test = async () => {
6
+ console.log(await loadObject("User", { user_id: obj.user_id }, ["username"]));
7
+ }
8
+ */
4
9
 
5
10
  </script>
6
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.61",
3
+ "version": "0.0.62",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",
@@ -1,2 +0,0 @@
1
- declare const _default: () => Number;
2
- export default _default;
@@ -1,12 +0,0 @@
1
- import { useRoute } from "vue-router";
2
- const route = useRoute();
3
- export default () => {
4
- let name = route.name?.toString();
5
- if (name == void 0)
6
- return 0;
7
- let parts = name.split("-");
8
- const module = parts[0];
9
- const moduleLower = module.charAt(0).toLowerCase() + module.slice(1);
10
- const keyname = parts[1];
11
- return parseInt(route.params[keyname]);
12
- };