@tagsamurai/fats-api-services 1.0.0-alpha.36 → 1.0.0-alpha.37

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,12 +1,12 @@
1
1
  import T from "axios";
2
2
  const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_APP_ADMIN_API: "https://dev-admin-api.tagsamurai.com", 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" }, $ = (t = "APP_API") => D["VITE_" + t], s = (t = {}, e = !1) => {
3
- const { env: r = "APP_API", prefix: o = "", headers: P = {}, ...O } = t, h = `${$(r)}${o}`, y = JSON.parse(localStorage.getItem("user") ?? "{}"), U = y.jwt ?? y.token ?? "";
3
+ const { env: r = "APP_API", prefix: o = "", headers: P = {}, ...O } = t, U = `${$(r)}${o}`, y = JSON.parse(localStorage.getItem("user") ?? "{}"), h = y.jwt ?? y.token ?? "";
4
4
  return T.create({
5
5
  ...O,
6
- baseURL: h,
6
+ baseURL: U,
7
7
  headers: e ? P : {
8
8
  "Content-Type": "application/json",
9
- Authorization: `Bearer ${U}`,
9
+ Authorization: `Bearer ${h}`,
10
10
  ...P
11
11
  }
12
12
  });
@@ -28,7 +28,7 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
28
28
  }, g = s({
29
29
  prefix: "/settings-attribute/v2",
30
30
  env: "APP_TAGSAMURAI_API"
31
- }), k = {
31
+ }), w = {
32
32
  getGroupCategory: (t, e) => {
33
33
  const r = t === "category" ? t : "groups";
34
34
  return g.get(`/${r}/tree`, { params: e });
@@ -61,7 +61,7 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
61
61
  }
62
62
  }, c = s({
63
63
  prefix: "/settings-attribute-go/v2"
64
- }), w = {
64
+ }), k = {
65
65
  getGroupCategory: (t, e) => {
66
66
  const r = t === "category" ? t : "groups";
67
67
  return c.get(`/${r}/tree`, { params: e });
@@ -169,6 +169,13 @@ const D = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_
169
169
  }), Q = {
170
170
  reLogin: (t) => n.post("/auth/login", t),
171
171
  changePassword: (t) => n.put("/users/change-password", t),
172
+ /**
173
+ * Retrieves the user list as dropdown options.
174
+ * @returns {Promise<AxiosResponse>} - A promise that resolves to the response from the API.
175
+ */
176
+ getUserDropdown: (t) => n.get("/users/dropdown", { params: t }),
177
+ getUserOptions: (t) => n.get("/users/options", { params: t }),
178
+ getUserList: (t) => n.get("/users", { params: t }),
172
179
  getUserDetail: (t) => n.get(`/users/${t}`),
173
180
  putEditUser: (t, e) => {
174
181
  const r = { "Content-Type": "multipart/form-data" };
@@ -427,8 +434,8 @@ export {
427
434
  ot as FileManagerServices,
428
435
  it as FileManagerServicesGo,
429
436
  tt as GeneralSettingsServices,
430
- k as GroupCategoryServices,
431
- w as GroupCategoryServicesGo,
437
+ w as GroupCategoryServices,
438
+ k as GroupCategoryServicesGo,
432
439
  Z as I18nService,
433
440
  Y as MissingServices,
434
441
  B as NotificationApprovalServices,
@@ -1 +1 @@
1
- System.register(["axios"],function(n,M){"use strict";var P;return{setters:[I=>{P=I.default}],execute:function(){const I={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_ADMIN_API:"https://dev-admin-api.tagsamurai.com",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"},S=n("getBaseURL",(e="APP_API")=>I["VITE_"+e]),s=(e={},t=!1)=>{const{env:r="APP_API",prefix:o="",headers:_={},...b}=e,R=`${S(r)}${o}`,h=JSON.parse(localStorage.getItem("user")??"{}"),E=h.jwt??h.token??"";return P.create({...b,baseURL:R,headers:t?_:{"Content-Type":"application/json",Authorization:`Bearer ${E}`,..._}})},k=n("queryParamsStringfy",e=>{if(!e||typeof e=="string")return;const t={};return Object.keys(e).forEach(r=>{Array.isArray(e[r])?e[r].length>0&&Object.assign(t,{[r]:JSON.stringify(e[r])}):e[r]!==void 0&&Object.assign(t,{[r]:e[r]})}),t}),w=n("getImageURL",e=>{if(!e)return;const t=S("APP_TAGSAMURAI_API");return e.startsWith("http")?e:`${t}/file-manager/v2/files/${e}`}),c=s({prefix:"/settings-attribute/v2",env:"APP_TAGSAMURAI_API"}),B=n("GroupCategoryServices",{getGroupCategory:(e,t)=>{const r=e==="category"?e:"groups";return c.get(`/${r}/tree`,{params:t})},getGroupCategoryList:(e,t,r)=>{const o=e==="category"?e:"groups";return c.get(`/${o}/${t}`,{params:r})},getNames:e=>{const t=e==="category"?e:"groups";return c.get(`/${t}/names`)},getCodes:e=>{const t=e==="category"?e:"groups";return c.get(`/${t}/codes`)},postCreateGroupCategory:(e,t)=>{const r=e==="category"?e:"groups";return c.post(`/${r}`,t)},putEditGroupCategory:(e,t,r)=>{const o=e==="category"?e:"groups";return c.put(`/${o}/${r}`,t)},putMoveGroup:(e,t)=>c.put(`/groups/${t}/move-group`,e),putEditBulkGroups:async e=>c.put("/groups/bulk",e),deleteGroupCategory:(e,t,r)=>{const o=e==="category"?e:"groups";return c.delete(`/${o}/${r}`,{data:t})}}),l=s({prefix:"/settings-attribute-go/v2"}),V=n("GroupCategoryServicesGo",{getGroupCategory:(e,t)=>{const r=e==="category"?e:"groups";return l.get(`/${r}/tree`,{params:t})},getGroupCategoryList:(e,t)=>{const r=e==="category"?e:"groups";return l.get(`/${r}/${t}`)},getNames:e=>{const t=e==="category"?e:"groups";return l.get(`/${t}/names`)},getCodes:e=>{const t=e==="category"?e:"groups";return l.get(`/${t}/codes`)},postCreateGroupCategory:(e,t)=>{const r=e==="category"?e:"groups";return l.post(`/${r}`,t)},putEditGroupCategory:(e,t,r)=>{const o=e==="category"?e:"groups";return l.put(`/${o}/${r}`,t)},deleteGroupCategory:(e,t,r)=>{const o=e==="category"?e:"groups";return l.delete(`/${o}/${r}`,{data:t})}}),U=s({prefix:"/v2",env:"APP_LOGS_NOTIFICATION_API"}),j=n("NotificationApprovalServices",{getTotalApprovals:()=>U.get("/approval/count")}),d=s({prefix:"/v2",env:"APP_LOGS_NOTIFICATION_API"}),Y=n("ChangelogServices",{getActionLog:e=>d.get("/change-log",{params:e}),getActionLogOption:e=>d.get("/change-log/options",{params:e}),getSessionLogList:e=>d.get("/session-log",{params:e}),getUserDetailSystemLogList:e=>d.get("/change-log",{params:e}),getUserDetailSystemLogOption:e=>d.get("/change-log/options",{params:e})}),g=s({prefix:"/assets/v2/assets"}),q=n("AssetServices",{getScanTag:e=>g.get("/scan",{params:{tag:e}}),getAllAssets:e=>g.get("/",{params:e}),getAvailableAssets:e=>g.get("/available",{params:e}),scanAsset:e=>g.get("",{params:{tag:e}}),getAssetsById:(e,t)=>g.get("/by-id",{params:{_id:e,...t}}),getOptions:(e,t)=>g.get(e?`/${e}/options`:"/options",{params:t}),getUnlinkedAssets:e=>g.get("/unlinked",{params:e}),getAssetDetail:(e,t)=>g.get(`/${e}`,{params:t}),getLinkedAssetFamily:e=>g.get("/family",{params:{id:e}}),matchAssetWithTag:(e,t)=>{const r={_id:JSON.stringify([e]),tag:t};return g.get("/by-id",{params:r})}}),G=s({prefix:"/tracking/v2/missing"}),J=n("MissingServices",{putFoundAsset:(e,t)=>{const r={ids:[e],serialNumber:t};return G.put("/found",r)}}),C=s({prefix:"/v2/notification",env:"APP_LOGS_NOTIFICATION_API"}),K=n("NotificationServices",{getNotifications:e=>C.get("/",{params:e}),readNotification:e=>C.put(`/${e}`)}),L=s({prefix:"/utility/v2/notification"}),x=n("NotificationServicesGo",{getNotifications:e=>L.get("/",{params:e}),readNotification:e=>L.put(`/${e}`)}),D=s({prefix:"/v2/session-log",env:"APP_LOGS_NOTIFICATION_API"}),W=n("SessionLogServices",{postLogout:()=>D.post("/logout")}),f=s({prefix:"/tag/v2"}),z=n("TAGServices",{getScanQR:e=>f.get("/qr",{params:{tag:e}}),getScanRFID:e=>f.get("/rfid",{params:{tag:e}}),getRFIDQRTAG:e=>f.get("/rfid-qr/scan",{params:e})}),N=s({prefix:"/tracking/v2/tracking"}),Q=n("TrackingServices",{putFoundAsset:(e,t,r)=>{const o={tag:e,group:t,serialNumber:r,type:"Global"};return N.put("/found",{params:o})}}),i=s({prefix:"/settings-user-role/v2"}),Z=n("UserServices",{reLogin:e=>i.post("/auth/login",e),changePassword:e=>i.put("/users/change-password",e),getUserDetail:e=>i.get(`/users/${e}`),putEditUser:(e,t)=>{const r={"Content-Type":"multipart/form-data"};return i.put(`/users/${e}`,t,{headers:r})},putDeleteProfilePicture:e=>i.put(`/users/${e}/delete-profile-picture`),putCancelEmailChange:(e,t)=>i.put("/auth/confirm-email-change/cancel",{user:e,companyCode:t}),getUserDetailSystemRoles:(e,t,r)=>i.get(`/user-detail/${e}/system-roles`,{params:{...r,type:t}}),getUserDetailSystemRoleList:(e,t)=>i.get(`/user-detail/${e}/system-role-list`,{params:t}),getUserDetailSystemRoleOptions:(e,t)=>i.get(`/user-detail/${e}/system-role/option`,{params:t}),getUserDetailTransactionRoleList:(e,t)=>i.get(`/user-detail/${e}/transaction-role-list`,{params:t}),getUserDetailUserLogBorrowingList:(e,t)=>i.get(`/users-log/${e}/borrowing`,{params:t}),getUserDetailUserLogAssignmentList:(e,t)=>i.get(`/users-log/${e}/assignment`,{params:t}),getUserDetailUserLogBorrowingOption:(e,t)=>i.get(`/users-log/${e}/borrowing/option`,{params:t}),getUserDetailUserLogAssignmentOption:(e,t)=>i.get(`/users-log/${e}/assignment/option`,{params:t}),getUserDetailTransactionAdminLogList:(e,t)=>i.get(`/users-log/${e}/transaction-log`,{params:t}),getUserDetailTransactionAdminLogOption:(e,t)=>i.get(`/users-log/${e}/transaction-log/option`,{params:t})}),$=s({env:"APP_ADMIN_API",prefix:"/settings-attribute/languages"}),H=n("I18nService",{getMessages:e=>$.get(`/${e}/translations`),getLanguageOptions:async()=>{const{data:e}=await $.get("/dropdown");return e.data},getLanguageOptionMeta:async e=>{const{data:t}=await $.get("/dropdown/"+e);return t.data},translateText:async(e,t)=>{const{data:r}=await $.post("/translate",{q:e,target:t});return r.data.translations[e]}}),T=s({prefix:"/dashboard/v2/dashboard"}),X=n("DashboardServices",{getLatestTask:e=>T.get("/latest-task",{params:e}),getSummary:e=>T.get("/summary",{params:e})}),y=s({prefix:"/alias-code/api/alias-code"}),ee=n("AliasCodeServices",{getAliasCode:()=>y.get("/"),postAliasCode:e=>y.post("/",e),getAliasCodeList:e=>y.get(`/${e.object}/code-list`,{params:e})}),O=s({prefix:"/settings-attribute/v2/general-settings"}),te=n("GeneralSettingsServices",{getGeneralSettings:()=>O.get("/"),putUpdateGeneralSettings:e=>O.put("/",e)}),p=s({prefix:"/settings-attribute/v2/custom-field"}),re=n("CustomFieldServices",{getCustomField:async e=>p.get("/",{params:e}),getOptions:async e=>p.get("/options",{params:e}),postCreateCustomField:async(e,t)=>p.post("/",t,{params:e}),putEditCustomField:async(e,t,r)=>p.put(`/${r}`,t,{params:e}),putChangeStatus:async(e,t)=>p.put("/bulk",t,{params:e}),deleteCustomField:async e=>p.delete("/bulk",{data:e})}),m=({headers:e={},params:t={}}={})=>{const r=S("APP_COUNTRY_STATE_API"),o=S("APP_COUNTRY_STATE_API_KEY");return P.create({baseURL:`${r}/v1`,headers:{"Content-type":"application/json","X-CSCAPI-KEY":o,...e},params:t})},ne=n("CountryStateServices",{getCountry:()=>m().get("/countries"),getState:e=>m().get(`/countries/${e}/states`),getCity:(e,t)=>m().get(`/countries/${e}/states/${t}/cities`)}),a=s({prefix:"/routine/v2"}),se=n("ServiceCenterServices",{getList:e=>a.get("/service-center",{params:e}),postList:e=>a.post("/service-center",e),putList:(e,t)=>a.put(`/service-center/${e}`,t),putActivate:e=>a.put("/service-center/bulk",e),getDetailList:e=>a.get(`/service-center/${e}`),getListOptions:e=>a.get("/service-center/options",{params:e}),deleteList:e=>a.delete("/service-center",{params:e}),getActivities:e=>a.get("/service-activities",{params:e}),getActivityOptions:e=>a.get("/service-activities/options",{params:e}),getActivityDetail:e=>a.get(`/service-activities/${e}`),getActivityLog:e=>a.get(`/service-activities/${e}/activity-log`)}),F=s({prefix:"/settings-attribute/v2/brands"}),ie=n("BrandServices",{getDropdown:e=>F.get("/dropdown",{params:e})}),A=s({prefix:"/file-manager/v2"}),oe=n("FileManagerServices",{getStorageInformation:()=>A.get("/files/storage"),getFileManager:(e,t)=>A.get(`/${e}`,{params:t}),getFileManagerOption:(e,t)=>A.get(`/${e}/options`,{params:t}),recoverFiles:(e,t)=>A.put(`/${e}/recover`,t),deleteFiles:(e,t)=>A.delete(`/${e}`,{params:t}),deletePermanently:(e,t)=>A.delete(`/${e}/delete-permanent`,{params:t})}),v=s({prefix:"/utility/v2"}),ae=n("FileManagerServicesGo",{getStorageInformation:()=>v.get("/files/storage"),getFileManager:(e,t)=>v.get(`/${e}`,{params:t}),getFileManagerOption:(e,t)=>v.get(`/${e}/options`,{params:t}),recoverFiles:(e,t)=>v.put(`/${e}/recover`,t),deleteFiles:(e,t)=>v.delete(`/${e}`,{params:t}),deletePermanently:(e,t)=>v.delete(`/${e}/delete-permanent`,{params:t})}),u=s({prefix:"/iot/v2/reader"}),ge=n("ReaderServices",{getData:e=>u.get("/",{params:e}),getDataOptions:e=>u.get("/options",{params:e}),getActivityLogData:e=>u.get("/activity-log",{params:e}),getActivityLogOptions:e=>u.get("/activity-log/options",{params:e}),getDataById:e=>u.get(`/${e}`),getChangeLog:e=>u.get(`/${e.id}/change-log`,{params:e}),getChangeLogOptions:e=>u.get(`/${e.id}/change-log/options`,{params:e}),putData:(e,t)=>u.put(`/${e}`,t)})}}});
1
+ System.register(["axios"],function(s,M){"use strict";var P;return{setters:[I=>{P=I.default}],execute:function(){const I={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_ADMIN_API:"https://dev-admin-api.tagsamurai.com",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"},S=s("getBaseURL",(e="APP_API")=>I["VITE_"+e]),n=(e={},t=!1)=>{const{env:r="APP_API",prefix:o="",headers:_={},...b}=e,R=`${S(r)}${o}`,U=JSON.parse(localStorage.getItem("user")??"{}"),E=U.jwt??U.token??"";return P.create({...b,baseURL:R,headers:t?_:{"Content-Type":"application/json",Authorization:`Bearer ${E}`,..._}})},w=s("queryParamsStringfy",e=>{if(!e||typeof e=="string")return;const t={};return Object.keys(e).forEach(r=>{Array.isArray(e[r])?e[r].length>0&&Object.assign(t,{[r]:JSON.stringify(e[r])}):e[r]!==void 0&&Object.assign(t,{[r]:e[r]})}),t}),k=s("getImageURL",e=>{if(!e)return;const t=S("APP_TAGSAMURAI_API");return e.startsWith("http")?e:`${t}/file-manager/v2/files/${e}`}),c=n({prefix:"/settings-attribute/v2",env:"APP_TAGSAMURAI_API"}),B=s("GroupCategoryServices",{getGroupCategory:(e,t)=>{const r=e==="category"?e:"groups";return c.get(`/${r}/tree`,{params:t})},getGroupCategoryList:(e,t,r)=>{const o=e==="category"?e:"groups";return c.get(`/${o}/${t}`,{params:r})},getNames:e=>{const t=e==="category"?e:"groups";return c.get(`/${t}/names`)},getCodes:e=>{const t=e==="category"?e:"groups";return c.get(`/${t}/codes`)},postCreateGroupCategory:(e,t)=>{const r=e==="category"?e:"groups";return c.post(`/${r}`,t)},putEditGroupCategory:(e,t,r)=>{const o=e==="category"?e:"groups";return c.put(`/${o}/${r}`,t)},putMoveGroup:(e,t)=>c.put(`/groups/${t}/move-group`,e),putEditBulkGroups:async e=>c.put("/groups/bulk",e),deleteGroupCategory:(e,t,r)=>{const o=e==="category"?e:"groups";return c.delete(`/${o}/${r}`,{data:t})}}),l=n({prefix:"/settings-attribute-go/v2"}),V=s("GroupCategoryServicesGo",{getGroupCategory:(e,t)=>{const r=e==="category"?e:"groups";return l.get(`/${r}/tree`,{params:t})},getGroupCategoryList:(e,t)=>{const r=e==="category"?e:"groups";return l.get(`/${r}/${t}`)},getNames:e=>{const t=e==="category"?e:"groups";return l.get(`/${t}/names`)},getCodes:e=>{const t=e==="category"?e:"groups";return l.get(`/${t}/codes`)},postCreateGroupCategory:(e,t)=>{const r=e==="category"?e:"groups";return l.post(`/${r}`,t)},putEditGroupCategory:(e,t,r)=>{const o=e==="category"?e:"groups";return l.put(`/${o}/${r}`,t)},deleteGroupCategory:(e,t,r)=>{const o=e==="category"?e:"groups";return l.delete(`/${o}/${r}`,{data:t})}}),h=n({prefix:"/v2",env:"APP_LOGS_NOTIFICATION_API"}),j=s("NotificationApprovalServices",{getTotalApprovals:()=>h.get("/approval/count")}),v=n({prefix:"/v2",env:"APP_LOGS_NOTIFICATION_API"}),Y=s("ChangelogServices",{getActionLog:e=>v.get("/change-log",{params:e}),getActionLogOption:e=>v.get("/change-log/options",{params:e}),getSessionLogList:e=>v.get("/session-log",{params:e}),getUserDetailSystemLogList:e=>v.get("/change-log",{params:e}),getUserDetailSystemLogOption:e=>v.get("/change-log/options",{params:e})}),g=n({prefix:"/assets/v2/assets"}),q=s("AssetServices",{getScanTag:e=>g.get("/scan",{params:{tag:e}}),getAllAssets:e=>g.get("/",{params:e}),getAvailableAssets:e=>g.get("/available",{params:e}),scanAsset:e=>g.get("",{params:{tag:e}}),getAssetsById:(e,t)=>g.get("/by-id",{params:{_id:e,...t}}),getOptions:(e,t)=>g.get(e?`/${e}/options`:"/options",{params:t}),getUnlinkedAssets:e=>g.get("/unlinked",{params:e}),getAssetDetail:(e,t)=>g.get(`/${e}`,{params:t}),getLinkedAssetFamily:e=>g.get("/family",{params:{id:e}}),matchAssetWithTag:(e,t)=>{const r={_id:JSON.stringify([e]),tag:t};return g.get("/by-id",{params:r})}}),D=n({prefix:"/tracking/v2/missing"}),J=s("MissingServices",{putFoundAsset:(e,t)=>{const r={ids:[e],serialNumber:t};return D.put("/found",r)}}),C=n({prefix:"/v2/notification",env:"APP_LOGS_NOTIFICATION_API"}),K=s("NotificationServices",{getNotifications:e=>C.get("/",{params:e}),readNotification:e=>C.put(`/${e}`)}),L=n({prefix:"/utility/v2/notification"}),x=s("NotificationServicesGo",{getNotifications:e=>L.get("/",{params:e}),readNotification:e=>L.put(`/${e}`)}),G=n({prefix:"/v2/session-log",env:"APP_LOGS_NOTIFICATION_API"}),W=s("SessionLogServices",{postLogout:()=>G.post("/logout")}),f=n({prefix:"/tag/v2"}),z=s("TAGServices",{getScanQR:e=>f.get("/qr",{params:{tag:e}}),getScanRFID:e=>f.get("/rfid",{params:{tag:e}}),getRFIDQRTAG:e=>f.get("/rfid-qr/scan",{params:e})}),N=n({prefix:"/tracking/v2/tracking"}),Q=s("TrackingServices",{putFoundAsset:(e,t,r)=>{const o={tag:e,group:t,serialNumber:r,type:"Global"};return N.put("/found",{params:o})}}),i=n({prefix:"/settings-user-role/v2"}),Z=s("UserServices",{reLogin:e=>i.post("/auth/login",e),changePassword:e=>i.put("/users/change-password",e),getUserDropdown:e=>i.get("/users/dropdown",{params:e}),getUserOptions:e=>i.get("/users/options",{params:e}),getUserList:e=>i.get("/users",{params:e}),getUserDetail:e=>i.get(`/users/${e}`),putEditUser:(e,t)=>{const r={"Content-Type":"multipart/form-data"};return i.put(`/users/${e}`,t,{headers:r})},putDeleteProfilePicture:e=>i.put(`/users/${e}/delete-profile-picture`),putCancelEmailChange:(e,t)=>i.put("/auth/confirm-email-change/cancel",{user:e,companyCode:t}),getUserDetailSystemRoles:(e,t,r)=>i.get(`/user-detail/${e}/system-roles`,{params:{...r,type:t}}),getUserDetailSystemRoleList:(e,t)=>i.get(`/user-detail/${e}/system-role-list`,{params:t}),getUserDetailSystemRoleOptions:(e,t)=>i.get(`/user-detail/${e}/system-role/option`,{params:t}),getUserDetailTransactionRoleList:(e,t)=>i.get(`/user-detail/${e}/transaction-role-list`,{params:t}),getUserDetailUserLogBorrowingList:(e,t)=>i.get(`/users-log/${e}/borrowing`,{params:t}),getUserDetailUserLogAssignmentList:(e,t)=>i.get(`/users-log/${e}/assignment`,{params:t}),getUserDetailUserLogBorrowingOption:(e,t)=>i.get(`/users-log/${e}/borrowing/option`,{params:t}),getUserDetailUserLogAssignmentOption:(e,t)=>i.get(`/users-log/${e}/assignment/option`,{params:t}),getUserDetailTransactionAdminLogList:(e,t)=>i.get(`/users-log/${e}/transaction-log`,{params:t}),getUserDetailTransactionAdminLogOption:(e,t)=>i.get(`/users-log/${e}/transaction-log/option`,{params:t})}),$=n({env:"APP_ADMIN_API",prefix:"/settings-attribute/languages"}),H=s("I18nService",{getMessages:e=>$.get(`/${e}/translations`),getLanguageOptions:async()=>{const{data:e}=await $.get("/dropdown");return e.data},getLanguageOptionMeta:async e=>{const{data:t}=await $.get("/dropdown/"+e);return t.data},translateText:async(e,t)=>{const{data:r}=await $.post("/translate",{q:e,target:t});return r.data.translations[e]}}),T=n({prefix:"/dashboard/v2/dashboard"}),X=s("DashboardServices",{getLatestTask:e=>T.get("/latest-task",{params:e}),getSummary:e=>T.get("/summary",{params:e})}),y=n({prefix:"/alias-code/api/alias-code"}),ee=s("AliasCodeServices",{getAliasCode:()=>y.get("/"),postAliasCode:e=>y.post("/",e),getAliasCodeList:e=>y.get(`/${e.object}/code-list`,{params:e})}),O=n({prefix:"/settings-attribute/v2/general-settings"}),te=s("GeneralSettingsServices",{getGeneralSettings:()=>O.get("/"),putUpdateGeneralSettings:e=>O.put("/",e)}),p=n({prefix:"/settings-attribute/v2/custom-field"}),re=s("CustomFieldServices",{getCustomField:async e=>p.get("/",{params:e}),getOptions:async e=>p.get("/options",{params:e}),postCreateCustomField:async(e,t)=>p.post("/",t,{params:e}),putEditCustomField:async(e,t,r)=>p.put(`/${r}`,t,{params:e}),putChangeStatus:async(e,t)=>p.put("/bulk",t,{params:e}),deleteCustomField:async e=>p.delete("/bulk",{data:e})}),m=({headers:e={},params:t={}}={})=>{const r=S("APP_COUNTRY_STATE_API"),o=S("APP_COUNTRY_STATE_API_KEY");return P.create({baseURL:`${r}/v1`,headers:{"Content-type":"application/json","X-CSCAPI-KEY":o,...e},params:t})},se=s("CountryStateServices",{getCountry:()=>m().get("/countries"),getState:e=>m().get(`/countries/${e}/states`),getCity:(e,t)=>m().get(`/countries/${e}/states/${t}/cities`)}),a=n({prefix:"/routine/v2"}),ne=s("ServiceCenterServices",{getList:e=>a.get("/service-center",{params:e}),postList:e=>a.post("/service-center",e),putList:(e,t)=>a.put(`/service-center/${e}`,t),putActivate:e=>a.put("/service-center/bulk",e),getDetailList:e=>a.get(`/service-center/${e}`),getListOptions:e=>a.get("/service-center/options",{params:e}),deleteList:e=>a.delete("/service-center",{params:e}),getActivities:e=>a.get("/service-activities",{params:e}),getActivityOptions:e=>a.get("/service-activities/options",{params:e}),getActivityDetail:e=>a.get(`/service-activities/${e}`),getActivityLog:e=>a.get(`/service-activities/${e}/activity-log`)}),F=n({prefix:"/settings-attribute/v2/brands"}),ie=s("BrandServices",{getDropdown:e=>F.get("/dropdown",{params:e})}),A=n({prefix:"/file-manager/v2"}),oe=s("FileManagerServices",{getStorageInformation:()=>A.get("/files/storage"),getFileManager:(e,t)=>A.get(`/${e}`,{params:t}),getFileManagerOption:(e,t)=>A.get(`/${e}/options`,{params:t}),recoverFiles:(e,t)=>A.put(`/${e}/recover`,t),deleteFiles:(e,t)=>A.delete(`/${e}`,{params:t}),deletePermanently:(e,t)=>A.delete(`/${e}/delete-permanent`,{params:t})}),d=n({prefix:"/utility/v2"}),ae=s("FileManagerServicesGo",{getStorageInformation:()=>d.get("/files/storage"),getFileManager:(e,t)=>d.get(`/${e}`,{params:t}),getFileManagerOption:(e,t)=>d.get(`/${e}/options`,{params:t}),recoverFiles:(e,t)=>d.put(`/${e}/recover`,t),deleteFiles:(e,t)=>d.delete(`/${e}`,{params:t}),deletePermanently:(e,t)=>d.delete(`/${e}/delete-permanent`,{params:t})}),u=n({prefix:"/iot/v2/reader"}),ge=s("ReaderServices",{getData:e=>u.get("/",{params:e}),getDataOptions:e=>u.get("/options",{params:e}),getActivityLogData:e=>u.get("/activity-log",{params:e}),getActivityLogOptions:e=>u.get("/activity-log/options",{params:e}),getDataById:e=>u.get(`/${e}`),getChangeLog:e=>u.get(`/${e.id}/change-log`,{params:e}),getChangeLogOptions:e=>u.get(`/${e.id}/change-log/options`,{params:e}),putData:(e,t)=>u.put(`/${e}`,t)})}}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagsamurai/fats-api-services",
3
- "version": "1.0.0-alpha.36",
3
+ "version": "1.0.0-alpha.37",
4
4
  "author": "developer.tagsamurai",
5
5
  "description": "Fixed Asset Tag Samurai Services Library",
6
6
  "module": "./api-services.es.js",
@@ -0,0 +1,61 @@
1
+ import { MultiSelectOption } from '../types/options.type';
2
+ import { PermissionType, UserPermission } from '../types/role.type';
3
+ import { SimpleUserType, UserType } from '../types/user.type';
4
+ export type FetchUserRoleResponse = {
5
+ status: string;
6
+ message: string;
7
+ data: {
8
+ totalRecords: number;
9
+ data: UserPermission[];
10
+ isManager?: boolean;
11
+ };
12
+ };
13
+ export type FetchUserRoleOptionResponse = {
14
+ status: string;
15
+ message: string;
16
+ data: {
17
+ positionOptions?: MultiSelectOption[];
18
+ divisionOptions?: MultiSelectOption[];
19
+ };
20
+ };
21
+ export interface RoleAssignUserDto {
22
+ userIds: string[];
23
+ groupKeys: number[];
24
+ }
25
+ export interface RoleEditUserDto {
26
+ groupKeys?: number[];
27
+ permissions?: RolePermission;
28
+ permissionType?: PermissionType;
29
+ }
30
+ export interface RoleSetActiveDto {
31
+ ids: string[];
32
+ isActive: boolean;
33
+ }
34
+ export interface RolePermission {
35
+ create: boolean;
36
+ delete: boolean;
37
+ update: boolean;
38
+ view: boolean;
39
+ defaultView?: boolean;
40
+ }
41
+ export interface TransactionRoleUpdateUser {
42
+ role: UserType;
43
+ action: 'Add' | 'Delete';
44
+ user: SimpleUserType[];
45
+ level?: number;
46
+ }
47
+ export interface TransactionRoleUserManager {
48
+ user: SimpleUserType;
49
+ isActive?: boolean;
50
+ isTotalControl?: boolean;
51
+ _id?: string;
52
+ }
53
+ export interface TransactionRoleUserApprovalLevel {
54
+ action?: 'Add' | 'Delete' | 'Edit';
55
+ level?: number;
56
+ approvalType?: 'Or' | 'And';
57
+ users?: TransactionRoleUserManager[];
58
+ }
59
+ export interface GroupManageByParent {
60
+ value: boolean;
61
+ }
@@ -129,3 +129,11 @@ export type TransactionLogLoadingFilters = {
129
129
  userFullNameOptions?: boolean;
130
130
  assignedToOptions?: boolean;
131
131
  };
132
+ export type SelectUserOptionBoolean = {
133
+ positionOptions?: boolean;
134
+ divisionOptions?: boolean;
135
+ id?: string;
136
+ excludeId?: string;
137
+ group?: string;
138
+ isTotalControl?: boolean;
139
+ };
@@ -0,0 +1,53 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { PermissionType, RoleAssignedUserQuery, RoleGroupInfo, TransactionRoleName } from '../types/role.type';
3
+ import { FetchUserRoleOptionResponse, FetchUserRoleResponse, GroupManageByParent, RoleAssignUserDto, RoleEditUserDto, RoleSetActiveDto, TransactionRoleUpdateUser, TransactionRoleUserApprovalLevel } from '../dto/role.dto';
4
+ import { SelectUserOptionBoolean } from '../dto/user.dto';
5
+ /**
6
+ * Object containing methods for interacting with role-related APIs.
7
+ */
8
+ declare const RoleServices: {
9
+ /**
10
+ * Retrieves the transaction role for the given group and transaction name.
11
+ * @param {string} groupId - The ID of the group to retrieve the transaction role for.
12
+ * @param {string} transactionName - The name of the transaction to retrieve the role for.
13
+ * @returns {Promise<AxiosResponse>} - A promise that resolves to the response from the API.
14
+ */
15
+ getTransactionRole: (groupId: RoleGroupInfo["_id"], transactionName: TransactionRoleName) => Promise<AxiosResponse>;
16
+ /**
17
+ * Updates the users assigned to the given transaction role.
18
+ * @param {string} groupId - The ID of the group the transaction role belongs to.
19
+ * @param {string} transactionName - The name of the transaction to update.
20
+ * @param {UpdateUser} body - The request body containing the updated user information.
21
+ * @returns {Promise<AxiosResponse>} - A promise that resolves to the response from the API.
22
+ */
23
+ putUpdateUsers: (groupId: RoleGroupInfo["_id"], transactionName: TransactionRoleName, body: TransactionRoleUpdateUser) => Promise<AxiosResponse>;
24
+ /**
25
+ * Updates the approval level for the given transaction role.
26
+ * @param {string} groupId - The ID of the group the transaction role belongs to.
27
+ * @param {string} transactionName - The name of the transaction to update.
28
+ * @param {UserApprovalLevel} body - The request body containing the updated approval level.
29
+ * @returns {Promise<AxiosResponse>} - A promise that resolves to the response from the API.
30
+ */
31
+ putUpdateLevel: (groupId: RoleGroupInfo["_id"], transactionName: TransactionRoleName, body: TransactionRoleUserApprovalLevel) => Promise<AxiosResponse>;
32
+ /**
33
+ * Updates the group management settings for the given transaction role.
34
+ * @param {string} groupId - The ID of the group the transaction role belongs to.
35
+ * @param {string} transactionName - The name of the transaction to update.
36
+ * @param {GroupManageByParent} body - The request body containing the updated management settings.
37
+ * @returns {Promise<AxiosResponse>} - A promise that resolves to the response from the API.
38
+ */
39
+ putUpdateGroupManage: (groupId: RoleGroupInfo["_id"], transactionName: TransactionRoleName, body: GroupManageByParent) => Promise<AxiosResponse>;
40
+ getAssignedUserAmounts: () => Promise<AxiosResponse>;
41
+ getPermissionUser: (permissionType?: PermissionType, params?: RoleAssignedUserQuery) => Promise<AxiosResponse<FetchUserRoleResponse>>;
42
+ getPermissionUserOptions: (permissionType?: PermissionType, params?: SelectUserOptionBoolean) => Promise<AxiosResponse<FetchUserRoleOptionResponse>>;
43
+ getUserGroups: (params?: {
44
+ users?: string;
45
+ }, permissionType?: PermissionType) => Promise<AxiosResponse>;
46
+ postAssignUser: (body: RoleAssignUserDto, permissionType?: PermissionType) => Promise<AxiosResponse>;
47
+ putEditUser: (body: RoleEditUserDto, roleId?: string) => Promise<AxiosResponse>;
48
+ putSetActive: (body?: RoleSetActiveDto, permissionType?: PermissionType) => Promise<AxiosResponse>;
49
+ deleteRemoveUser: (body: {
50
+ [key: string]: string[] | undefined;
51
+ }, permissionType?: PermissionType) => Promise<AxiosResponse>;
52
+ };
53
+ export default RoleServices;
@@ -1,16 +1,33 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { ChangePasswordBody, EditUserDTO, GetTransactionAdminLogOptionsResponse, GetUserLogAssignmentOptionsResponse, GetUserLogBorrowingOptionsResponse, SystemRoleFetchParams, TransactionLogFetchParams, TransactionLogLoadingFilters, TransactionLogType, TransactionRoleFetchParams, UserLogAssignmentFetchParams, UserLogAssignmentLoadingFilters, UserLogBorrowingFetchParams, UserLogBorrowingLoadingFilters } from '../dto/user.dto';
2
+ import { ChangePasswordBody, EditUserDTO, GetTransactionAdminLogOptionsResponse, GetUserLogAssignmentOptionsResponse, GetUserLogBorrowingOptionsResponse, SelectUserOptionBoolean, SystemRoleFetchParams, TransactionLogFetchParams, TransactionLogLoadingFilters, TransactionLogType, TransactionRoleFetchParams, UserLogAssignmentFetchParams, UserLogAssignmentLoadingFilters, UserLogBorrowingFetchParams, UserLogBorrowingLoadingFilters } from '../dto/user.dto';
3
3
  import { FetchDetailResponse, FetchListResponse, FetchOptionResponse } from '../types/fetchResponse.type';
4
4
  import { UserDetail } from '../types/user.type';
5
5
  import { UserSystemRole } from '../types/userSystemRole.type';
6
6
  import { MultiSelectOption } from '../types/options.type';
7
7
  import { UserTransactionRole } from '../types/userTransactionRole.type';
8
8
  import { UserLogAssignment, UserLogBorrowing } from '../types/userLog.type';
9
+ import { FetchUserRoleOptionResponse } from '../dto/role.dto';
9
10
  declare const UserServices: {
10
11
  reLogin: (body: {
11
12
  jwt: string;
12
13
  }) => Promise<AxiosResponse>;
13
14
  changePassword: (body: ChangePasswordBody) => Promise<AxiosResponse>;
15
+ /**
16
+ * Retrieves the user list as dropdown options.
17
+ * @returns {Promise<AxiosResponse>} - A promise that resolves to the response from the API.
18
+ */
19
+ getUserDropdown: (params?: {
20
+ excludeId?: string;
21
+ group?: string;
22
+ isConfirmed?: string;
23
+ useDefaultGroup?: string;
24
+ }) => Promise<AxiosResponse>;
25
+ getUserOptions: (params?: SelectUserOptionBoolean) => Promise<AxiosResponse<{
26
+ data: FetchUserRoleOptionResponse;
27
+ }>>;
28
+ getUserList: (params?: {
29
+ [key: string]: unknown;
30
+ }) => Promise<AxiosResponse>;
14
31
  getUserDetail: (id: string) => Promise<AxiosResponse<FetchDetailResponse<UserDetail>>>;
15
32
  putEditUser: (id: string, data: EditUserDTO) => Promise<AxiosResponse>;
16
33
  putDeleteProfilePicture: (id: string) => Promise<AxiosResponse>;
@@ -1,3 +1,4 @@
1
+ import { RolePermission, TransactionRoleUserApprovalLevel, TransactionRoleUserManager } from '../dto/role.dto';
1
2
  export type Role = {
2
3
  _id: string;
3
4
  name: string;
@@ -7,10 +8,113 @@ export type Role = {
7
8
  isUsedByUser: boolean;
8
9
  key: number;
9
10
  };
10
- export type RolePermission = {
11
- create: boolean;
12
- view: boolean;
13
- update: boolean;
14
- delete: boolean;
15
- defaultView?: boolean;
11
+ export type RoleGroupInfo = {
12
+ _id: string;
13
+ name: string;
14
+ key: number;
15
+ isManagedByParent?: boolean;
16
+ hasSystemRoles?: {
17
+ group?: {
18
+ create: boolean;
19
+ view: boolean;
20
+ delete: boolean;
21
+ update: boolean;
22
+ };
23
+ create?: boolean;
24
+ view?: boolean;
25
+ delete?: boolean;
26
+ update?: boolean;
27
+ };
28
+ level?: number;
29
+ };
30
+ export type UserRole = {
31
+ _id: string;
32
+ isActive?: boolean;
33
+ key: number;
34
+ name?: string;
35
+ fullName?: string;
36
+ position: string;
37
+ division: string;
38
+ updatedAt?: Date;
39
+ systemRole?: {
40
+ _id: string;
41
+ group: RoleGroupInfo[];
42
+ };
43
+ };
44
+ export type RoleAssignedUserParams = {
45
+ isActive?: (string | boolean)[];
46
+ group?: string[];
47
+ position?: string[];
48
+ division?: string[];
49
+ updatedAt?: string[];
50
+ mappedGroup?: string[];
51
+ mappedDate?: number[];
52
+ };
53
+ export type RoleAssignedUserQuery = Partial<Record<keyof RoleAssignedUserParams, string>>;
54
+ export type TransactionRoleName = 'borrowingRole' | 'transferRole' | 'auditRole' | 'disposalRole' | 'maintenanceRole' | 'damagedRole' | 'repairRole' | 'missingRole' | 'trackingRole';
55
+ export type TransactionRoleType = {
56
+ group: RoleGroupInfo;
57
+ manager: TransactionRoleUserManager[];
58
+ monitoring: TransactionRoleUserManager[];
59
+ staff: TransactionRoleUserManager[];
60
+ approval: TransactionRoleUserApprovalLevel[];
61
+ };
62
+ export type RowNameType = {
63
+ [key: string]: string;
64
+ };
65
+ export type PermissionType = 'importData' | 'assetAttribute' | 'assetPolicies' | 'tagType' | 'depreciationGroup' | 'depreciationMethod' | 'openApi' | 'documentDeletion' | 'group' | 'userAndRole' | 'iotReader' | 'license' | 'purchaseDocument' | 'purchaseInformation' | 'tag' | 'registerAsset' | 'totalControl' | 'readOnly';
66
+ export type PermissionDetail = {
67
+ permission?: PermissionType;
68
+ name?: string;
69
+ object: string;
70
+ fileName?: string;
71
+ desc?: string;
72
+ isGroupRole?: boolean;
73
+ useCRUDPermission?: boolean;
74
+ };
75
+ export type SystemRoleData = {
76
+ globalPermissions: SystemRoleAssignedData[];
77
+ groupPermissions: SystemRoleAssignedData[];
78
+ };
79
+ export type SystemRoleAssignedData = {
80
+ _id?: string;
81
+ permission: PermissionType;
82
+ assignedUser: number;
83
+ name?: string;
84
+ };
85
+ export type UserTotalControlReadOnlyPermission = UserRole & {
86
+ _id: string;
87
+ formattedIsActive?: 'Active' | 'Inactive';
88
+ isActive: boolean;
89
+ isDefault?: boolean;
90
+ profilePictureSmall?: string;
91
+ profilePictureMedium?: string;
92
+ profilePictureBig?: string;
93
+ };
94
+ export type UserSystemRolePermission = {
95
+ _id: string;
96
+ profilePictureSmall?: string;
97
+ profilePictureMedium?: string;
98
+ profilePictureBig?: string;
99
+ managePermission: Partial<{
100
+ [T in PermissionType]: RolePermission;
101
+ }>;
102
+ permissions: Omit<RolePermission, 'totalControl' | 'readOnly'>;
103
+ user: UserRole & {
104
+ isDefault?: boolean;
105
+ profilePictureSmall?: string;
106
+ profilePictureMedium?: string;
107
+ profilePictureBig?: string;
108
+ };
109
+ group: RoleGroupInfo[];
110
+ formattedIsActive?: 'Active' | 'Inactive';
111
+ formattedCreate?: 'Active' | 'Inactive';
112
+ formattedView?: 'Active' | 'Inactive';
113
+ formattedUpdate?: 'Active' | 'Inactive';
114
+ formattedDelete?: 'Active' | 'Inactive';
115
+ isActive: boolean;
116
+ isReadOnly: boolean;
117
+ isTotalControl: boolean;
118
+ isDefault?: boolean;
16
119
  };
120
+ export type UserPermission<T extends 'system' | 'totalread' = 'system' | 'totalread'> = T extends 'system' ? UserSystemRolePermission : UserTotalControlReadOnlyPermission;
@@ -124,6 +124,12 @@ export type User = {
124
124
  profilePictureMedium: string;
125
125
  profilePictureBig: string;
126
126
  };
127
+ export type SimpleUserType = {
128
+ _id?: string;
129
+ fullName?: string;
130
+ isDefault?: boolean;
131
+ key?: number;
132
+ };
127
133
  export type UserDetail = {
128
134
  _id: string;
129
135
  key: number;
@@ -1,4 +1,4 @@
1
- import { RolePermission } from './role.type';
1
+ import { RolePermission } from '../dto/role.dto';
2
2
  export type UserGlobalRole = {
3
3
  /**
4
4
  * =================
@@ -1,5 +1,5 @@
1
+ import { RolePermission } from '../dto/role.dto';
1
2
  import { Group } from './group.type';
2
- import { RolePermission } from './role.type';
3
3
  export type UserGroupRole = {
4
4
  /**
5
5
  * =================