@fntio/infra-client
Version:
Self-hosted AWS access portal: credential vending, target-account trust, and grant-driven private networking as CDK stacks and constructs.
2 lines (1 loc) • 2.37 kB
JavaScript
import{C as l,F as o,Ib as p,R as r,f as d,x as g}from"./chunk-FYA6QUPZ.js";import{a,b as s}from"./chunk-WFIHWVQO.js";var c=class n{loaded;overlayState="unknown";overlayWrittenSig=r(!1);overlayWritten=this.overlayWrittenSig.asReadonly();themeSavedSig=r(!1);themeSaved=this.themeSavedSig.asReadonly();deployBrandingBase={};brandingSig=r({});branding=this.brandingSig.asReadonly();config$=d(Promise.all([fetch("/config.json").then(t=>{if(!t.ok)throw new Error(`config.json failed: ${t.status}`);return t.json()}),fetch("/branding.json",{cache:"no-store"}).then(t=>t.ok?t.json():t.status===403||t.status===404?"absent":"unknown").catch(()=>"unknown")]).then(([t,e])=>{this.overlayState=e,this.overlayWrittenSig.set(typeof e=="object"),this.themeSavedSig.set(typeof e=="object"&&!!e.branding),this.deployBrandingBase=t.branding??{};let i=typeof e=="object"?e:void 0;return i?.branding?s(a({},t),{branding:this.mergeBranding(i.branding)}):t})).pipe(l(t=>{this.loaded=t,this.brandingSig.set(t.branding??{})}),g(1));get deployBranding(){return this.deployBrandingBase}get config(){if(!this.loaded)throw new Error("AppConfig not loaded yet");return this.loaded}get brandingOverlayAbsent(){return this.overlayState==="absent"}applyOverlay(t){if(this.overlayState=t,this.overlayWrittenSig.set(!0),t.branding&&this.themeSavedSig.set(!0),this.loaded&&t.branding){let e=this.mergeBranding(t.branding);this.loaded=s(a({},this.loaded),{branding:e}),this.brandingSig.set(e)}}mergeBranding(t){let e=a(a({},this.deployBrandingBase),t);return t.primaryColor&&!t.primaryHoverColor&&delete e.primaryHoverColor,e}static \u0275fac=function(e){return new(e||n)};static \u0275prov=o({token:n,factory:n.\u0275fac,providedIn:"root"})};var f=class n{nextId=1;toasts=r([]);success(t){this.push("success",t)}error(t,e){this.push("error",t,e)}dismiss(t){this.toasts.update(e=>e.filter(i=>i.id!==t))}push(t,e,i){let h={id:this.nextId++,kind:t,message:e,action:i};this.toasts.update(m=>[...m,h])}static \u0275fac=function(e){return new(e||n)};static \u0275prov=o({token:n,factory:n.\u0275fac,providedIn:"root"})};function C(n){let t=new p().set("limit",String(n.limit));n.q&&(t=t.set("q",n.q)),n.sort&&(t=t.set("sort",n.sort)),n.cursor&&(t=t.set("cursor",n.cursor));for(let[e,i]of Object.entries(n.filters??{}))i.length&&(t=t.set(`filter[${e}]`,i.join(",")));return t}export{c as a,C as b,f as c};