@telia-ace/alliance-utilities 4.0.0 → 4.0.1-next.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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{queryObjects as u}from"@telia-ace/alliance-framework";async function g(){return await u("currentOrganization").resolve()}import{queryObjects as p}from"@telia-ace/alliance-framework";import{AllianceError as c,FrameworkErrorCodes as d,UtilitiesErrorCodes as l,isAllianceError as m}from"@telia-ace/alliance-internal-client-utilities";async function f(){try{let r=await p("currentUser").resolve();return{...r,workspaces:r.workspaces||[],hasRole(e){return!!r&&r.roles.includes(e)}}}catch(r){throw m(r)&&r?.code===d.MissingManagedObjectProvider?new c(l.CurrentUserMissingProvider):r.message?.includes("No User Found")?new c(l.CurrentUserMissingInDatabase):r?.name==="TRPCClientError"&&r.message.includes("is not valid JSON")?new c(l.CurrentUserMissingBackend):r}}import{queryObjects as b}from"@telia-ace/alliance-framework";async function y(){let e=await b("currentWorkspace").resolve();return{...e,disableTaskbarActions:e.disableTaskbarActions||!1}}import{getAppManifest as C,getAppManifests as w,queryObjects as O}from"@telia-ace/alliance-framework";import{AllianceError as R,FrameworkErrorCodes as k}from"@telia-ace/alliance-internal-client-utilities";function z(r){let e={"app-name":r.name,"app-description":"",...Object.entries(r?.capabilities||{}).filter(([t,n])=>!!n.label).reduce((t,[n,o])=>({...t,[`capability-${n}`]:o.label||n}),{})};return r.resources?.localization?{...Object.keys(r.resources.localization).reduce((t,n)=>(t[n]=r.resources.localization[n].value,t),{}),...e}:e}function E(r,e){return Object.entries(e).reduce((i,[s,t])=>i.replaceAll(`{{${s}}}`,t),r)}async function T(r){let e=w(),i=e.find(n=>n.name===r),s=i?z(i):{},t={};return e?.find(({name:n})=>n==="resource-management")&&(t=await O("resourceTexts",{app:i?.name}).resolve()),Object.keys(s).reduce((n,o)=>(t[o]&&(n[o]=t[o]),n),s)}var a={};async function A(r){let e=r||C()?.name;return e?((!a[e]||Object.keys(a[e]).length===0)&&(a[e]=await T(e)),(i,s)=>{let t=a[e][i];if(t===void 0)throw new R(k.LocalizationTemplateNotDefined,{key:i});return!s||typeof s!="object"||Object.keys(s).length===0?t:E(t,s)}):()=>""}export{g as getCurrentOrganization,f as getCurrentUser,y as getCurrentWorkspace,A as getTranslator};
1
+ import{queryObjects as u}from"@telia-ace/alliance-framework";async function g(){return await u("currentOrganization").resolve()}import{queryObjects as p}from"@telia-ace/alliance-framework";import{AllianceError as c,FrameworkErrorCodes as d,isAllianceError as m,UtilitiesErrorCodes as l}from"@telia-ace/alliance-internal-client-utilities";async function f(){try{let r=await p("currentUser").resolve();return{...r,workspaces:r.workspaces||[],hasRole(e){return!!r&&r.roles.includes(e)}}}catch(r){throw m(r)&&r?.code===d.MissingManagedObjectProvider?new c(l.CurrentUserMissingProvider):r.message?.includes("No User Found")?new c(l.CurrentUserMissingInDatabase):r?.name==="TRPCClientError"&&r.message.includes("is not valid JSON")?new c(l.CurrentUserMissingBackend):r}}import{queryObjects as b}from"@telia-ace/alliance-framework";async function y(){let e=await b("currentWorkspace").resolve();return{...e,disableTaskbarActions:e.disableTaskbarActions||!1}}import{getAppManifest as C,getAppManifests as w,queryObjects as O}from"@telia-ace/alliance-framework";import{AllianceError as R,FrameworkErrorCodes as k}from"@telia-ace/alliance-internal-client-utilities";function z(r){let e={"app-name":r.name,"app-description":"",...Object.entries(r?.capabilities||{}).filter(([t,n])=>!!n.label).reduce((t,[n,o])=>({...t,[`capability-${n}`]:o.label||n}),{})};return r.resources?.localization?{...Object.keys(r.resources.localization).reduce((t,n)=>(t[n]=r.resources.localization[n].value,t),{}),...e}:e}function E(r,e){return Object.entries(e).reduce((i,[s,t])=>i.replaceAll(`{{${s}}}`,t),r)}async function T(r){let e=w(),i=e.find(n=>n.name===r),s=i?z(i):{},t={};return e?.find(({name:n})=>n==="resource-management")&&(t=await O("resourceTexts",{app:i?.name}).resolve()),Object.keys(s).reduce((n,o)=>(t[o]&&(n[o]=t[o]),n),s)}var a={};async function A(r){let e=r||C()?.name;return e?((!a[e]||Object.keys(a[e]).length===0)&&(a[e]=await T(e)),(i,s)=>{let t=a[e][i];if(t===void 0)throw new R(k.LocalizationTemplateNotDefined,{key:i});return!s||typeof s!="object"||Object.keys(s).length===0?t:E(t,s)}):()=>""}export{g as getCurrentOrganization,f as getCurrentUser,y as getCurrentWorkspace,A as getTranslator};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/alliance-utilities",
3
- "version": "4.0.0",
3
+ "version": "4.0.1-next.1",
4
4
  "description": "Utilities used by ACE Alliance apps.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -17,8 +17,8 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@telia-ace/alliance-framework": "^4.0.0",
21
- "@telia-ace/alliance-internal-client-utilities": "^4.0.0"
20
+ "@telia-ace/alliance-framework": "^4.0.1-next.1",
21
+ "@telia-ace/alliance-internal-client-utilities": "^4.0.1-next.1"
22
22
  },
23
23
  "publishConfig": {
24
24
  "access": "public"