@tagsamurai/fats-api-services 1.0.0-alpha.2 → 1.0.0-alpha.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.
@@ -1,101 +1,114 @@
1
- import P from "axios";
2
- const _ = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_APP_API: "https://dev-api.tagsamurai.com", VITE_APP_COUNTRY_STATE_API: "https://api.countrystatecity.in", VITE_APP_COUNTRY_STATE_API_KEY: "ZTc5TVc2STlwTkFFNFltYTRjc05sOHR3ODJEYzVMVTZ5UnBJaWU5SA==", VITE_APP_LOGS_NOTIFICATION_API: "https://dev-api-logs-notification.tagsamurai.com", VITE_APP_TAGSAMURAI_API: "https://dev-api.tagsamurai.com" }, u = (t = "APP_API") => _["VITE_" + t], i = (t = {}, r = !1) => {
3
- const { env: e = "APP_API", prefix: o = "", headers: a = {}, ...g } = t, p = `${u(e)}${o}`, c = JSON.parse(localStorage.getItem("user") ?? "{}"), A = c.jwt ?? c.token ?? "";
4
- return P.create({
1
+ import _ from "axios";
2
+ const I = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_APP_API: "https://dev-api.tagsamurai.com", VITE_APP_COUNTRY_STATE_API: "https://api.countrystatecity.in", VITE_APP_COUNTRY_STATE_API_KEY: "ZTc5TVc2STlwTkFFNFltYTRjc05sOHR3ODJEYzVMVTZ5UnBJaWU5SA==", VITE_APP_LOGS_NOTIFICATION_API: "https://dev-api-logs-notification.tagsamurai.com", VITE_APP_TAGSAMURAI_API: "https://dev-api.tagsamurai.com" }, i = (t = "APP_API") => I["VITE_" + t], c = (t = {}, e = !1) => {
3
+ const { env: r = "APP_API", prefix: o = "", headers: a = {}, ...g } = t, A = `${i(r)}${o}`, u = JSON.parse(localStorage.getItem("user") ?? "{}"), P = u.jwt ?? u.token ?? "";
4
+ return _.create({
5
5
  ...g,
6
- baseURL: p,
7
- headers: r ? a : {
6
+ baseURL: A,
7
+ headers: e ? a : {
8
8
  "Content-Type": "application/json",
9
- Authorization: `Bearer ${A}`,
9
+ Authorization: `Bearer ${P}`,
10
10
  ...a
11
11
  }
12
12
  });
13
- }, I = (t) => {
13
+ }, f = (t) => {
14
14
  if (!t || typeof t == "string")
15
15
  return;
16
- const r = {};
17
- return Object.keys(t).forEach((e) => {
18
- Array.isArray(t[e]) ? t[e].length > 0 && Object.assign(r, {
19
- [e]: JSON.stringify(t[e])
20
- }) : t[e] !== void 0 && Object.assign(r, {
21
- [e]: t[e]
16
+ const e = {};
17
+ return Object.keys(t).forEach((r) => {
18
+ Array.isArray(t[r]) ? t[r].length > 0 && Object.assign(e, {
19
+ [r]: JSON.stringify(t[r])
20
+ }) : t[r] !== void 0 && Object.assign(e, {
21
+ [r]: t[r]
22
22
  });
23
- }), r;
24
- }, f = (t, r, e) => {
23
+ }), e;
24
+ }, S = (t, e, r) => {
25
25
  if (!t) return;
26
- const o = u("APP_API"), a = t.startsWith("http") ? t : `${o}/utility/v2/files/${t.replace(/^\/+/, "")}`;
27
- if (r || e) {
26
+ const o = i("APP_API"), a = t.startsWith("http") ? t : `${o}/utility/v2/files/${t.replace(/^\/+/, "")}`;
27
+ if (e || r) {
28
28
  const g = new URLSearchParams();
29
- return r && (g.set("width", r.toString()), g.set("height", e ? e == null ? void 0 : e.toString() : r.toString())), `${a}?${g.toString()}`;
29
+ return e && (g.set("width", e.toString()), g.set("height", r ? r == null ? void 0 : r.toString() : e.toString())), `${a}?${g.toString()}`;
30
30
  }
31
31
  return a;
32
- }, l = (t) => {
32
+ }, T = (t) => {
33
33
  if (!t) return;
34
- const r = u("APP_TAGSAMURAI_API");
35
- return t.startsWith("http") ? t : `${r}/file-manager/v2/files/${t}`;
36
- }, n = i({
34
+ const e = i("APP_TAGSAMURAI_API");
35
+ return t.startsWith("http") ? t : `${e}/file-manager/v2/files/${t}`;
36
+ }, n = c({
37
37
  prefix: "/settings-attribute/v2"
38
38
  }), y = {
39
39
  getGroupCategory: (t) => {
40
- const r = t === "category" ? t : "groups";
41
- return n.get(`/${r}/tree`);
42
- },
43
- getGroupCategoryList: (t, r) => {
44
40
  const e = t === "category" ? t : "groups";
45
- return n.get(`/${e}/${r}`);
41
+ return n.get(`/${e}/tree`);
46
42
  },
47
- getNames: (t) => {
43
+ getGroupCategoryList: (t, e) => {
48
44
  const r = t === "category" ? t : "groups";
49
- return n.get(`/${r}/names`);
45
+ return n.get(`/${r}/${e}`);
50
46
  },
51
- postCreateGroupCategory: (t, r) => {
47
+ getNames: (t) => {
52
48
  const e = t === "category" ? t : "groups";
53
- return n.post(`/${e}`, r);
49
+ return n.get(`/${e}/names`);
50
+ },
51
+ postCreateGroupCategory: (t, e) => {
52
+ const r = t === "category" ? t : "groups";
53
+ return n.post(`/${r}`, e);
54
54
  },
55
- putEditGroupCategory: (t, r, e) => {
55
+ putEditGroupCategory: (t, e, r) => {
56
56
  const o = t === "category" ? t : "groups";
57
- return n.put(`/${o}/${e}`, r);
57
+ return n.put(`/${o}/${r}`, e);
58
58
  },
59
- deleteGroupCategory: (t, r, e) => {
59
+ deleteGroupCategory: (t, e, r) => {
60
60
  const o = t === "category" ? t : "groups";
61
- return n.delete(`/${o}/${e}`, { data: r });
61
+ return n.delete(`/${o}/${r}`, { data: e });
62
62
  }
63
- }, s = i({
63
+ }, s = c({
64
64
  prefix: "/settings-attribute/v2",
65
65
  baseURL: "APP_TAGSAMURAI_API"
66
- }), S = {
66
+ }), v = {
67
67
  getGroupCategory: (t) => {
68
- const r = t === "category" ? t : "groups";
69
- return s.get(`/${r}/tree`);
70
- },
71
- getGroupCategoryList: (t, r) => {
72
68
  const e = t === "category" ? t : "groups";
73
- return s.get(`/${e}/${r}`);
69
+ return s.get(`/${e}/tree`);
74
70
  },
75
- getNames: (t) => {
71
+ getGroupCategoryList: (t, e) => {
76
72
  const r = t === "category" ? t : "groups";
77
- return s.get(`/${r}/names`);
73
+ return s.get(`/${r}/${e}`);
78
74
  },
79
- postCreateGroupCategory: (t, r) => {
75
+ getNames: (t) => {
80
76
  const e = t === "category" ? t : "groups";
81
- return s.post(`/${e}`, r);
77
+ return s.get(`/${e}/names`);
78
+ },
79
+ postCreateGroupCategory: (t, e) => {
80
+ const r = t === "category" ? t : "groups";
81
+ return s.post(`/${r}`, e);
82
82
  },
83
- putEditGroupCategory: (t, r, e) => {
83
+ putEditGroupCategory: (t, e, r) => {
84
84
  const o = t === "category" ? t : "groups";
85
- return s.put(`/${o}/${e}`, r);
85
+ return s.put(`/${o}/${r}`, e);
86
86
  },
87
- putMoveGroup: (t, r) => s.put(`/groups/${r}/move-group`, t),
87
+ putMoveGroup: (t, e) => s.put(`/groups/${e}/move-group`, t),
88
88
  putEditBulkGroups: async (t) => s.put("/bulk", t),
89
- deleteGroupCategory: (t, r, e) => {
89
+ deleteGroupCategory: (t, e, r) => {
90
90
  const o = t === "category" ? t : "groups";
91
- return s.delete(`/${o}/${e}`, { data: r });
91
+ return s.delete(`/${o}/${r}`, { data: e });
92
92
  }
93
+ }, l = c({
94
+ prefix: "/v2",
95
+ baseURL: "APP_LOGS_NOTIFICATION_API"
96
+ }), C = {
97
+ getTotalApprovals: () => l.get("/approval/count")
98
+ }, p = c({
99
+ prefix: "/v2",
100
+ baseURL: "APP_LOGS_NOTIFICATION_API"
101
+ }), G = {
102
+ getActionLog: (t) => p.get("/change-log", { params: t }),
103
+ getActionLogOption: (t) => p.get("/change-log/options", { params: t })
93
104
  };
94
105
  export {
106
+ G as ChangelogServices,
95
107
  y as GroupCategoryServices,
96
- S as OldGroupCategoryServices,
97
- u as getBaseURL,
98
- f as getImageURL,
99
- l as oldGetImageURL,
100
- I as queryParamsStringfy
108
+ C as NotificationApprovalServices,
109
+ v as OldGroupCategoryServices,
110
+ i as getBaseURL,
111
+ S as getImageURL,
112
+ T as oldGetImageURL,
113
+ f as queryParamsStringfy
101
114
  };
@@ -1 +1 @@
1
- System.register(["axios"],function(n,f){"use strict";var p;return{setters:[c=>{p=c.default}],execute:function(){const c={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_API:"https://dev-api.tagsamurai.com",VITE_APP_COUNTRY_STATE_API:"https://api.countrystatecity.in",VITE_APP_COUNTRY_STATE_API_KEY:"ZTc5TVc2STlwTkFFNFltYTRjc05sOHR3ODJEYzVMVTZ5UnBJaWU5SA==",VITE_APP_LOGS_NOTIFICATION_API:"https://dev-api-logs-notification.tagsamurai.com",VITE_APP_TAGSAMURAI_API:"https://dev-api.tagsamurai.com"},i=n("getBaseURL",(t="APP_API")=>c["VITE_"+t]),A=(t={},e=!1)=>{const{env:r="APP_API",prefix:o="",headers:u={},...g}=t,_=`${i(r)}${o}`,P=JSON.parse(localStorage.getItem("user")??"{}"),$=P.jwt??P.token??"";return p.create({...g,baseURL:_,headers:e?u:{"Content-Type":"application/json",Authorization:`Bearer ${$}`,...u}})},I=n("queryParamsStringfy",t=>{if(!t||typeof t=="string")return;const e={};return Object.keys(t).forEach(r=>{Array.isArray(t[r])?t[r].length>0&&Object.assign(e,{[r]:JSON.stringify(t[r])}):t[r]!==void 0&&Object.assign(e,{[r]:t[r]})}),e}),l=n("getImageURL",(t,e,r)=>{if(!t)return;const o=i("APP_API"),u=t.startsWith("http")?t:`${o}/utility/v2/files/${t.replace(/^\/+/,"")}`;if(e||r){const g=new URLSearchParams;return e&&(g.set("width",e.toString()),g.set("height",r?r==null?void 0:r.toString():e.toString())),`${u}?${g.toString()}`}return u}),y=n("oldGetImageURL",t=>{if(!t)return;const e=i("APP_TAGSAMURAI_API");return t.startsWith("http")?t:`${e}/file-manager/v2/files/${t}`}),a=A({prefix:"/settings-attribute/v2"}),S=n("GroupCategoryServices",{getGroupCategory:t=>{const e=t==="category"?t:"groups";return a.get(`/${e}/tree`)},getGroupCategoryList:(t,e)=>{const r=t==="category"?t:"groups";return a.get(`/${r}/${e}`)},getNames:t=>{const e=t==="category"?t:"groups";return a.get(`/${e}/names`)},postCreateGroupCategory:(t,e)=>{const r=t==="category"?t:"groups";return a.post(`/${r}`,e)},putEditGroupCategory:(t,e,r)=>{const o=t==="category"?t:"groups";return a.put(`/${o}/${r}`,e)},deleteGroupCategory:(t,e,r)=>{const o=t==="category"?t:"groups";return a.delete(`/${o}/${r}`,{data:e})}}),s=A({prefix:"/settings-attribute/v2",baseURL:"APP_TAGSAMURAI_API"}),d=n("OldGroupCategoryServices",{getGroupCategory:t=>{const e=t==="category"?t:"groups";return s.get(`/${e}/tree`)},getGroupCategoryList:(t,e)=>{const r=t==="category"?t:"groups";return s.get(`/${r}/${e}`)},getNames:t=>{const e=t==="category"?t:"groups";return s.get(`/${e}/names`)},postCreateGroupCategory:(t,e)=>{const r=t==="category"?t:"groups";return s.post(`/${r}`,e)},putEditGroupCategory:(t,e,r)=>{const o=t==="category"?t:"groups";return s.put(`/${o}/${r}`,e)},putMoveGroup:(t,e)=>s.put(`/groups/${e}/move-group`,t),putEditBulkGroups:async t=>s.put("/bulk",t),deleteGroupCategory:(t,e,r)=>{const o=t==="category"?t:"groups";return s.delete(`/${o}/${r}`,{data:e})}})}}});
1
+ System.register(["axios"],function(n,S){"use strict";var A;return{setters:[u=>{A=u.default}],execute:function(){const u={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_API:"https://dev-api.tagsamurai.com",VITE_APP_COUNTRY_STATE_API:"https://api.countrystatecity.in",VITE_APP_COUNTRY_STATE_API_KEY:"ZTc5TVc2STlwTkFFNFltYTRjc05sOHR3ODJEYzVMVTZ5UnBJaWU5SA==",VITE_APP_LOGS_NOTIFICATION_API:"https://dev-api-logs-notification.tagsamurai.com",VITE_APP_TAGSAMURAI_API:"https://dev-api.tagsamurai.com"},p=n("getBaseURL",(t="APP_API")=>u["VITE_"+t]),c=(t={},e=!1)=>{const{env:r="APP_API",prefix:o="",headers:g={},...i}=t,l=`${p(r)}${o}`,_=JSON.parse(localStorage.getItem("user")??"{}"),f=_.jwt??_.token??"";return A.create({...i,baseURL:l,headers:e?g:{"Content-Type":"application/json",Authorization:`Bearer ${f}`,...g}})},$=n("queryParamsStringfy",t=>{if(!t||typeof t=="string")return;const e={};return Object.keys(t).forEach(r=>{Array.isArray(t[r])?t[r].length>0&&Object.assign(e,{[r]:JSON.stringify(t[r])}):t[r]!==void 0&&Object.assign(e,{[r]:t[r]})}),e}),y=n("getImageURL",(t,e,r)=>{if(!t)return;const o=p("APP_API"),g=t.startsWith("http")?t:`${o}/utility/v2/files/${t.replace(/^\/+/,"")}`;if(e||r){const i=new URLSearchParams;return e&&(i.set("width",e.toString()),i.set("height",r?r==null?void 0:r.toString():e.toString())),`${g}?${i.toString()}`}return g}),T=n("oldGetImageURL",t=>{if(!t)return;const e=p("APP_TAGSAMURAI_API");return t.startsWith("http")?t:`${e}/file-manager/v2/files/${t}`}),a=c({prefix:"/settings-attribute/v2"}),v=n("GroupCategoryServices",{getGroupCategory:t=>{const e=t==="category"?t:"groups";return a.get(`/${e}/tree`)},getGroupCategoryList:(t,e)=>{const r=t==="category"?t:"groups";return a.get(`/${r}/${e}`)},getNames:t=>{const e=t==="category"?t:"groups";return a.get(`/${e}/names`)},postCreateGroupCategory:(t,e)=>{const r=t==="category"?t:"groups";return a.post(`/${r}`,e)},putEditGroupCategory:(t,e,r)=>{const o=t==="category"?t:"groups";return a.put(`/${o}/${r}`,e)},deleteGroupCategory:(t,e,r)=>{const o=t==="category"?t:"groups";return a.delete(`/${o}/${r}`,{data:e})}}),s=c({prefix:"/settings-attribute/v2",baseURL:"APP_TAGSAMURAI_API"}),C=n("OldGroupCategoryServices",{getGroupCategory:t=>{const e=t==="category"?t:"groups";return s.get(`/${e}/tree`)},getGroupCategoryList:(t,e)=>{const r=t==="category"?t:"groups";return s.get(`/${r}/${e}`)},getNames:t=>{const e=t==="category"?t:"groups";return s.get(`/${e}/names`)},postCreateGroupCategory:(t,e)=>{const r=t==="category"?t:"groups";return s.post(`/${r}`,e)},putEditGroupCategory:(t,e,r)=>{const o=t==="category"?t:"groups";return s.put(`/${o}/${r}`,e)},putMoveGroup:(t,e)=>s.put(`/groups/${e}/move-group`,t),putEditBulkGroups:async t=>s.put("/bulk",t),deleteGroupCategory:(t,e,r)=>{const o=t==="category"?t:"groups";return s.delete(`/${o}/${r}`,{data:e})}}),I=c({prefix:"/v2",baseURL:"APP_LOGS_NOTIFICATION_API"}),d=n("NotificationApprovalServices",{getTotalApprovals:()=>I.get("/approval/count")}),P=c({prefix:"/v2",baseURL:"APP_LOGS_NOTIFICATION_API"}),G=n("ChangelogServices",{getActionLog:t=>P.get("/change-log",{params:t}),getActionLogOption:t=>P.get("/change-log/options",{params:t})})}}});
package/main.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { default as GroupCategoryServices } from './src/services/groupCategory.service';
2
2
  export { default as OldGroupCategoryServices } from './src/services/oldGroupCategory.service';
3
+ export { default as NotificationApprovalServices } from './src/services/oldNotificationApproval.service';
4
+ export { default as ChangelogServices } from './src/services/oldChangelog.service';
3
5
  export { getImageURL, oldGetImageURL, getBaseURL, queryParamsStringfy, } from './src/utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/fats-api-services",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.3",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Fixed Asset Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -0,0 +1,30 @@
1
+ import { MultiSelectOption } from '../types/options.type';
2
+ export type ActionLogParams = {
3
+ object?: string;
4
+ objectId?: string;
5
+ createdAt?: number[];
6
+ action?: string[];
7
+ name?: string[];
8
+ assetName?: string[];
9
+ objectName?: string[];
10
+ field?: string[];
11
+ newValue?: string[];
12
+ oldValue?: string[];
13
+ modifiedBy?: string[];
14
+ };
15
+ export type ActionLogFilterParams = Partial<Record<keyof ActionLogParams, string>>;
16
+ export type ActionLogOptionFilter = {
17
+ actionOptions?: MultiSelectOption[];
18
+ fieldOptions?: MultiSelectOption[];
19
+ modifiedByOptions?: MultiSelectOption[];
20
+ objectNameOptions?: MultiSelectOption[];
21
+ nameOptions?: MultiSelectOption[];
22
+ taskNameOptions?: MultiSelectOption[];
23
+ };
24
+ export type ActionLogOptionParams = {
25
+ object?: string;
26
+ actionOptions?: boolean;
27
+ objectNameOptions?: boolean;
28
+ fieldOptions?: boolean;
29
+ modifiedByOptions?: boolean;
30
+ };
@@ -0,0 +1,10 @@
1
+ export type ApprovalCountData = {
2
+ transfer: number;
3
+ borrowing: number;
4
+ assignment: number;
5
+ audit: number;
6
+ disposal: number;
7
+ maintenanceRoutine: number;
8
+ repairTicketing: number;
9
+ tracking: number;
10
+ };
@@ -0,0 +1,9 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { ApprovalCountData } from '../dto/notificationApproval.dto';
3
+ import { FetchDetailResponse } from '../types/fetchResponse.type';
4
+ import { ActionLogFilterParams, ActionLogOptionParams } from '../dto/changelog.dto';
5
+ declare const ChangelogServices: {
6
+ getActionLog: (params?: ActionLogFilterParams) => Promise<AxiosResponse<FetchDetailResponse<ApprovalCountData>>>;
7
+ getActionLogOption: (params?: ActionLogOptionParams) => Promise<AxiosResponse<FetchDetailResponse<ApprovalCountData>>>;
8
+ };
9
+ export default ChangelogServices;
@@ -0,0 +1,7 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { ApprovalCountData } from '../dto/notificationApproval.dto';
3
+ import { FetchDetailResponse } from '../types/fetchResponse.type';
4
+ declare const NotificationApprovalServices: {
5
+ getTotalApprovals: () => Promise<AxiosResponse<FetchDetailResponse<ApprovalCountData>>>;
6
+ };
7
+ export default NotificationApprovalServices;
@@ -0,0 +1,26 @@
1
+ import { Ref } from 'vue';
2
+ export type ActionLogType = {
3
+ _id: string;
4
+ action: string;
5
+ field: string;
6
+ oldValue: string;
7
+ value?: string;
8
+ newValue: string;
9
+ modifiedBy: string;
10
+ object: string;
11
+ objectId: string;
12
+ objectName: string;
13
+ assetName?: string;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ };
17
+ export type LogDialogType = {
18
+ type: string;
19
+ header: string;
20
+ fileName: string;
21
+ objectId?: string;
22
+ fields?: string[];
23
+ buttonModel?: Ref<boolean>;
24
+ };
25
+ export type ChangelogObject = 'Asset' | 'Account Code' | 'Linked Asset' | 'Purchase Attachment' | 'Product Attachment' | 'Depreciation Group' | 'Transaction Settings Audit' | 'Transaction Settings Borrowing/Assignment' | 'Transaction Settings Disposal' | 'Transaction Settings Transfer' | 'General Settings' | 'Group' | 'Category' | 'Measurement' | 'Brand' | 'Asset Name' | 'Asset Policy' | 'Custom Field > General Information' | 'Custom Field > Purchase' | 'Custom Field > Accounting' | 'Custom Field > Maintenance Routine' | 'Custom Field > Audit' | 'Import' | 'Role > Borrowing/Assignment' | 'Role > Transfer' | 'Role > Disposal' | 'Role > Maintenance' | 'Role > Tracking' | 'Role > Missing' | 'Role > Audit' | 'Role > Repair Ticketing' | 'Role > Damaged' | 'Role > Total Control' | 'Role > Read Only' | 'Role > Import data' | 'Role > Manage asset names, brands, categories, and custom fields' | 'Role > Manage asset policy' | 'Role > Manage depreciation group' | 'Role > Manage depreciation method' | 'Role > Manage document deletion' | 'Role > Manage group' | 'Role > Manage user' | 'Role > Manage IOT and reader' | 'Role > Manage license' | 'Role > Manage purchase document' | 'Role > Manage purchase information' | 'Role > Manage role' | 'Role > Manage TAG' | 'Role > Register assets' | 'Role > Manage TAG type' | 'Role > Open API' | 'Report' | 'User' | 'Global Role User' | 'Group Role User' | 'Transaction Role User' | 'Audit' | 'Open API > API Token' | 'Maintenance Routine' | 'Detail Asset > Maintenance' | 'Detail Asset > Audit' | 'Sub User' | 'Allocation' | 'Service Center' | 'IOT > Reader' | 'IOT > Antenna' | 'Fixed Asset License' | 'Repair Ticketing Addon' | 'Maintenance Addon' | 'Tracking Addon' | 'Asset Control Addon' | 'Audit Addon';
26
+ export type LogAction = 'Create' | 'Edit' | 'Delete';