@kosdev-code/kos-ddk-models 2.1.3 → 3.0.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.
- package/constants.d.ts.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +3102 -1
- package/index.js.map +1 -0
- package/index.mjs +2190 -1597
- package/index.mjs.map +1 -0
- package/lib/agitation-control/agitation-control-model.d.ts +4 -5
- package/lib/agitation-control/agitation-control-model.d.ts.map +1 -1
- package/lib/agitation-control/agitation-control-registration.d.ts +2 -3
- package/lib/agitation-control/agitation-control-registration.d.ts.map +1 -1
- package/lib/agitation-control/index.d.ts.map +1 -1
- package/lib/agitation-control/types/index.d.ts +1 -3
- package/lib/animation/animation-model.d.ts +1 -2
- package/lib/animation/animation-model.d.ts.map +1 -1
- package/lib/animation/animation-registration.d.ts +1 -2
- package/lib/animation/animation-registration.d.ts.map +1 -1
- package/lib/animation/index.d.ts.map +1 -1
- package/lib/animation/services/animation-services.d.ts +1 -1
- package/lib/animation/services/animation-services.d.ts.map +1 -1
- package/lib/animation/services/index.d.ts.map +1 -1
- package/lib/animation/types/index.d.ts +1 -3
- package/lib/application/application-model.d.ts +5 -6
- package/lib/application/application-model.d.ts.map +1 -1
- package/lib/application/application-registration.d.ts +1 -2
- package/lib/application/application-registration.d.ts.map +1 -1
- package/lib/application/index.d.ts.map +1 -1
- package/lib/application/services/application-services.d.ts +3 -3
- package/lib/application/services/application-services.d.ts.map +1 -1
- package/lib/application/services/index.d.ts.map +1 -1
- package/lib/application/types/index.d.ts +2 -4
- package/lib/auth/auth-model.d.ts +2 -3
- package/lib/auth/auth-model.d.ts.map +1 -1
- package/lib/auth/auth-registration.d.ts +1 -2
- package/lib/auth/auth-registration.d.ts.map +1 -1
- package/lib/auth/index.d.ts.map +1 -1
- package/lib/auth/services/auth-services.d.ts +1 -2
- package/lib/auth/services/auth-services.d.ts.map +1 -1
- package/lib/auth/services/index.d.ts.map +1 -1
- package/lib/auth/types/index.d.ts +1 -3
- package/lib/carb-water/carb-water-model.d.ts +3 -4
- package/lib/carb-water/carb-water-model.d.ts.map +1 -1
- package/lib/carb-water/carb-water-registration.d.ts +2 -3
- package/lib/carb-water/carb-water-registration.d.ts.map +1 -1
- package/lib/carb-water/index.d.ts.map +1 -1
- package/lib/carb-water/services/carb-water-services.d.ts.map +1 -1
- package/lib/carb-water/services/index.d.ts.map +1 -1
- package/lib/copy-logs/copy-logs-model.d.ts +4 -5
- package/lib/copy-logs/copy-logs-model.d.ts.map +1 -1
- package/lib/copy-logs/index.d.ts +1 -1
- package/lib/copy-logs/index.d.ts.map +1 -1
- package/lib/copy-logs/services/copy-logs-services.d.ts +1 -2
- package/lib/copy-logs/services/copy-logs-services.d.ts.map +1 -1
- package/lib/copy-logs/services/index.d.ts.map +1 -1
- package/lib/dashboard-operations/dashboard-operations-model.d.ts +4 -5
- package/lib/dashboard-operations/dashboard-operations-model.d.ts.map +1 -1
- package/lib/dashboard-operations/dashboard-operations-registration.d.ts +1 -2
- package/lib/dashboard-operations/dashboard-operations-registration.d.ts.map +1 -1
- package/lib/dashboard-operations/index.d.ts.map +1 -1
- package/lib/dashboard-operations/services/dashboard-operations-services.d.ts +2 -2
- package/lib/dashboard-operations/services/dashboard-operations-services.d.ts.map +1 -1
- package/lib/dashboard-operations/services/index.d.ts.map +1 -1
- package/lib/dashboard-operations/types/index.d.ts +1 -3
- package/lib/dispenser/dispenser-model.d.ts +1 -2
- package/lib/dispenser/dispenser-model.d.ts.map +1 -1
- package/lib/dispenser/dispenser-registration.d.ts +1 -2
- package/lib/dispenser/dispenser-registration.d.ts.map +1 -1
- package/lib/dispenser/index.d.ts.map +1 -1
- package/lib/dispenser/services/dispenser-services.d.ts +1 -1
- package/lib/dispenser/services/dispenser-services.d.ts.map +1 -1
- package/lib/dispenser/services/index.d.ts.map +1 -1
- package/lib/dispenser/types/index.d.ts +1 -3
- package/lib/dispenser-info/dispenser-info-model.d.ts +1 -2
- package/lib/dispenser-info/dispenser-info-model.d.ts.map +1 -1
- package/lib/dispenser-info/dispenser-info-registration.d.ts +1 -2
- package/lib/dispenser-info/dispenser-info-registration.d.ts.map +1 -1
- package/lib/dispenser-info/index.d.ts.map +1 -1
- package/lib/dispenser-info/services/dispenser-info-services.d.ts +1 -1
- package/lib/dispenser-info/services/dispenser-info-services.d.ts.map +1 -1
- package/lib/dispenser-info/services/index.d.ts.map +1 -1
- package/lib/dispenser-info/types/index.d.ts +1 -3
- package/lib/door/door-model.d.ts +1 -2
- package/lib/door/door-model.d.ts.map +1 -1
- package/lib/door/door-registration.d.ts +2 -3
- package/lib/door/door-registration.d.ts.map +1 -1
- package/lib/door/index.d.ts.map +1 -1
- package/lib/enrollment/enrollment-model.d.ts +1 -2
- package/lib/enrollment/enrollment-model.d.ts.map +1 -1
- package/lib/enrollment/enrollment-registration.d.ts +1 -2
- package/lib/enrollment/enrollment-registration.d.ts.map +1 -1
- package/lib/enrollment/index.d.ts.map +1 -1
- package/lib/enrollment/services/enrollment-services.d.ts +1 -1
- package/lib/enrollment/services/enrollment-services.d.ts.map +1 -1
- package/lib/enrollment/services/index.d.ts.map +1 -1
- package/lib/enrollment/types/index.d.ts +1 -3
- package/lib/extension/index.d.ts.map +1 -1
- package/lib/ingredient-summary/index.d.ts.map +1 -1
- package/lib/ingredient-summary/ingredient-summary-model.d.ts +4 -5
- package/lib/ingredient-summary/ingredient-summary-model.d.ts.map +1 -1
- package/lib/ingredient-summary/ingredient-summary-registration.d.ts +1 -2
- package/lib/ingredient-summary/ingredient-summary-registration.d.ts.map +1 -1
- package/lib/ingredient-summary/types/index.d.ts +2 -4
- package/lib/lockout/index.d.ts.map +1 -1
- package/lib/lockout/lockout-model.d.ts +1 -2
- package/lib/lockout/lockout-model.d.ts.map +1 -1
- package/lib/lockout/lockout-registration.d.ts +2 -3
- package/lib/lockout/lockout-registration.d.ts.map +1 -1
- package/lib/lockout/services/index.d.ts.map +1 -1
- package/lib/lockout/services/lockout-services.d.ts +1 -1
- package/lib/lockout/services/lockout-services.d.ts.map +1 -1
- package/lib/macro-assignment/index.d.ts.map +1 -1
- package/lib/macro-assignment/macro-assignment-model.d.ts +5 -6
- package/lib/macro-assignment/macro-assignment-model.d.ts.map +1 -1
- package/lib/macro-assignment/macro-assignment-registration.d.ts +1 -2
- package/lib/macro-assignment/macro-assignment-registration.d.ts.map +1 -1
- package/lib/macro-assignment/services/index.d.ts.map +1 -1
- package/lib/macro-assignment/services/macro-assignment-services.d.ts +1 -1
- package/lib/macro-assignment/services/macro-assignment-services.d.ts.map +1 -1
- package/lib/macro-assignment/types/index.d.ts +2 -4
- package/lib/network-test/index.d.ts.map +1 -1
- package/lib/network-test/network-test-container-model.d.ts +3 -4
- package/lib/network-test/network-test-container-model.d.ts.map +1 -1
- package/lib/network-test/network-test-container-registration.d.ts +1 -2
- package/lib/network-test/network-test-container-registration.d.ts.map +1 -1
- package/lib/network-test/network-test-model.d.ts +2 -3
- package/lib/network-test/network-test-model.d.ts.map +1 -1
- package/lib/network-test/network-test-registration.d.ts +1 -2
- package/lib/network-test/network-test-registration.d.ts.map +1 -1
- package/lib/network-test/services/index.d.ts.map +1 -1
- package/lib/network-test/services/network-test-services.d.ts +2 -3
- package/lib/network-test/services/network-test-services.d.ts.map +1 -1
- package/lib/network-test/types/index.d.ts +1 -3
- package/lib/nutritive-sweetener/index.d.ts.map +1 -1
- package/lib/nutritive-sweetener/nutritive-sweetener-model.d.ts +7 -8
- package/lib/nutritive-sweetener/nutritive-sweetener-model.d.ts.map +1 -1
- package/lib/nutritive-sweetener/nutritive-sweetener-registration.d.ts +2 -3
- package/lib/nutritive-sweetener/nutritive-sweetener-registration.d.ts.map +1 -1
- package/lib/nutritive-sweetener/services/index.d.ts.map +1 -1
- package/lib/nutritive-sweetener/services/nutritive-sweetener-services.d.ts.map +1 -1
- package/lib/plain-water/index.d.ts.map +1 -1
- package/lib/plain-water/plain-water-model.d.ts +4 -5
- package/lib/plain-water/plain-water-model.d.ts.map +1 -1
- package/lib/plain-water/plain-water-registration.d.ts +2 -3
- package/lib/plain-water/plain-water-registration.d.ts.map +1 -1
- package/lib/plain-water/services/index.d.ts.map +1 -1
- package/lib/plain-water/services/plain-water-services.d.ts.map +1 -1
- package/lib/reboot/index.d.ts.map +1 -1
- package/lib/reboot/reboot-model.d.ts +1 -2
- package/lib/reboot/reboot-model.d.ts.map +1 -1
- package/lib/reboot/reboot-registration.d.ts +1 -2
- package/lib/reboot/reboot-registration.d.ts.map +1 -1
- package/lib/reboot/services/index.d.ts.map +1 -1
- package/lib/reboot/services/reboot-services.d.ts +1 -1
- package/lib/reboot/services/reboot-services.d.ts.map +1 -1
- package/lib/reboot/types/index.d.ts +1 -3
- package/lib/registration.d.ts +1 -2
- package/lib/registration.d.ts.map +1 -1
- package/lib/settings/index.d.ts.map +1 -1
- package/lib/settings/services/index.d.ts.map +1 -1
- package/lib/settings/services/settings-services.d.ts +2 -3
- package/lib/settings/services/settings-services.d.ts.map +1 -1
- package/lib/settings/settings-model.d.ts +1 -2
- package/lib/settings/settings-model.d.ts.map +1 -1
- package/lib/settings/settings-registration.d.ts +1 -2
- package/lib/settings/settings-registration.d.ts.map +1 -1
- package/lib/settings/types/index.d.ts +1 -3
- package/lib/setup-step/index.d.ts.map +1 -1
- package/lib/setup-step/services/index.d.ts.map +1 -1
- package/lib/setup-step/services/setup-step-services.d.ts +2 -2
- package/lib/setup-step/services/setup-step-services.d.ts.map +1 -1
- package/lib/setup-step/setup-step-container-model.d.ts +3 -4
- package/lib/setup-step/setup-step-container-model.d.ts.map +1 -1
- package/lib/setup-step/setup-step-container-registration.d.ts +1 -2
- package/lib/setup-step/setup-step-container-registration.d.ts.map +1 -1
- package/lib/setup-step/setup-step-model.d.ts +1 -2
- package/lib/setup-step/setup-step-model.d.ts.map +1 -1
- package/lib/setup-step/setup-step-registration.d.ts +1 -2
- package/lib/setup-step/setup-step-registration.d.ts.map +1 -1
- package/lib/setup-step/types/index.d.ts +1 -3
- package/lib/trouble-action/index.d.ts.map +1 -1
- package/lib/trouble-action/trouble-action-model.d.ts +2 -3
- package/lib/trouble-action/trouble-action-model.d.ts.map +1 -1
- package/lib/utilities/index.d.ts.map +1 -1
- package/lib/utilities/services/index.d.ts.map +1 -1
- package/lib/utilities/services/utilities-services.d.ts.map +1 -1
- package/lib/utilities/types/index.d.ts +1 -3
- package/lib/utilities/utilities-container-model.d.ts +1 -2
- package/lib/utilities/utilities-container-model.d.ts.map +1 -1
- package/lib/utilities/utilities-container-registration.d.ts +1 -2
- package/lib/utilities/utilities-container-registration.d.ts.map +1 -1
- package/lib/utilities/utilities-model.d.ts +1 -2
- package/lib/utilities/utilities-model.d.ts.map +1 -1
- package/lib/utilities/utilities-registration.d.ts +1 -2
- package/lib/utilities/utilities-registration.d.ts.map +1 -1
- package/lib/utils/assembly-utils.d.ts +2 -3
- package/lib/utils/assembly-utils.d.ts.map +1 -1
- package/lib/utils/holder-view-extension.d.ts +1 -2
- package/lib/utils/holder-view-extension.d.ts.map +1 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/time-utils.d.ts.map +1 -1
- package/lib/utils/trouble-visibility-filter.d.ts +1 -2
- package/lib/utils/trouble-visibility-filter.d.ts.map +1 -1
- package/package.json +5 -5
- package/start/index.d.ts.map +1 -1
- package/start/services/index.d.ts.map +1 -1
- package/start/services/start-services.d.ts +1 -1
- package/start/services/start-services.d.ts.map +1 -1
- package/start/start-model.d.ts +1 -2
- package/start/start-model.d.ts.map +1 -1
- package/start/start-registration.d.ts +2 -3
- package/start/start-registration.d.ts.map +1 -1
- package/types/global.d.ts.map +1 -1
- package/types/index.d.ts.map +1 -1
- package/utils/openapi-index.d.ts.map +1 -1
- package/utils/services/kosdev.ddk/snapshot/service.d.ts +47 -48
- package/utils/services/kosdev.ddk/snapshot/service.d.ts.map +1 -1
- package/utils/services-index.d.ts.map +1 -1
- package/kos-models.json +0 -358
package/index.js
CHANGED
|
@@ -1 +1,3102 @@
|
|
|
1
|
-
"use strict";var io=Object.defineProperty;var no=(e,t,o)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var n=(e,t,o)=>(no(e,typeof t!="symbol"?t+"":t,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@kosdev-code/kos-ui-sdk"),m=require("@kosdev-code/kos-freestyle-sdk"),P=require("@kosdev-code/kos-dispense-sdk"),ke="PurgeTrouble",Xe="PrimeTrouble",{URL:Ae}=r.resolveServiceUrl("AUTH_SERVICE"),{getOne:ao,postModel:lo}=r.ServiceFactory.build({basePath:`${Ae}/api/auth`}),Je=r.KosLog.createLogger({name:"auth-service",group:"Services"}),Ze=async()=>(Je.debug("sending GET for auth"),await ao({urlOverride:`${Ae}/api/app/kosdev.ddk/auth/role`})),et=async e=>(Je.debug("sending POST for auth"),await lo({urlOverride:`${Ae}/api/app/kosdev.ddk/auth/pincode/${e}`,model:{}})),co=Object.freeze(Object.defineProperty({__proto__:null,getCurrentRole:Ze,sendPinCode:et},Symbol.toStringTag,{value:"Module"}));var uo=Object.defineProperty,po=Object.getOwnPropertyDescriptor,tt=(e,t,o,i)=>{for(var s=i>1?void 0:i?po(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&uo(t,o,s),s};const w="auth-model",ze=e=>e.toLowerCase();let ne=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"currentRole");this.id=e,this.logger=o.logger,this.currentRole="crew"}async authorize(e){if(!e)return!1;const t=await et(e);return(t==null?void 0:t.status)===200?t.data:!1}async init(){this.logger.debug(`initializing auth ${this.id}`)}async load(){this.logger.debug(`loading auth ${this.id}`);const e=await Ze();(e==null?void 0:e.status)===200&&(this.logger.debug(`response ${e.data}`),r.kosAction(()=>{this.currentRole=ze(e.data)}))}handleRoleChange(e){this.currentRole=ze(e)}forceRole(e){this.currentRole=e}};tt([r.kosTopicHandler({topic:"/app/kosdev.ddk/auth/role",websocket:!0})],ne.prototype,"handleRoleChange",1);ne=tt([r.kosModel(w)],ne);const ge={registration:{[w]:{class:ne,singleton:!1}},type:w,predicate:r.isKosModel(w),factory:r.Kos.Factory.create(w)};var go=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,Ie=(e,t,o,i)=>{for(var s=i>1?void 0:i?ho(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&go(t,o,s),s};const ot="door-model",yo=r.createPropKey("doorPath");let Q=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"doorPath");n(this,"open");n(this,"ignoreDoor");this.id=e,this.logger=o.logger,this.doorPath=t.doorPath}get currentState(){return this.open.value===void 0?"UNKNOWN":this.open.value?"OPEN":"CLOSED"}get isOpen(){const e=this.open.value===void 0?!0:this.open.value;return this.ignoreDoor.value?(this.logger.debug("Door state is being ignored (treating as closed) due to ignoreDoor config property being true."),!1):e}};Ie([r.kosStateProp({path:yo,attribute:"state"})],Q.prototype,"open",2);Ie([r.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.ignoreDoorStateOnExit"})],Q.prototype,"ignoreDoor",2);Q=Ie([r.kosModel(ot)],Q);const rt=new r.KosModelRegistrationFactory({class:Q,type:ot}),{URL:Re}=r.resolveServiceUrl("SETUP-STEP_SERVICE"),{getAll:vo,postModel:fo}=r.ServiceFactory.build({basePath:`${Re}/api/setup-step`}),st=r.KosLog.createLogger({name:"setup-step-service",group:"Services"}),it=async()=>(st.debug("sending GET for setup-step"),await vo({urlOverride:`${Re}/api/app/kosdev.ddk/setup/steps`})),nt=async e=>(st.debug("sending POST for setup-step"),await fo({urlOverride:`${Re}/api/app/kosdev.ddk/setup/complete/${e}`,model:{}})),mo=Object.freeze(Object.defineProperty({__proto__:null,getSetupSteps:it,markStepComplete:nt},Symbol.toStringTag,{value:"Module"}));var bo=Object.getOwnPropertyDescriptor,_o=(e,t,o,i)=>{for(var s=i>1?void 0:i?bo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=l(s)||s);return s};const L="setup-step-model";let Pe=class{constructor(e,t,o){n(this,"id");n(this,"idx");n(this,"name");n(this,"complete");n(this,"preStep");n(this,"exclusive");n(this,"logger");this.id=e,this.idx=t.idx,this.logger=o.logger,this.name=t.name,this.complete=t.complete,this.preStep=t.preStep,this.exclusive=t.exclusive}updateModel(e){this.name=e.name,this.idx=e.idx,this.complete=e.complete,this.preStep=e.preStep,this.exclusive=e.exclusive}get titleKey(){return`setup.${this.name}.title`}get bodyKey(){return`setup.${this.name}.body`}async completeStep(){const e=await nt(this.name);(e==null?void 0:e.status)===200&&r.kosAction(()=>{this.complete=!0})}async init(){this.logger.debug(`initializing setup-step ${this.id}`)}async load(){this.logger.debug(`loading setup-step ${this.id}`)}};Pe=_o([r.kosModel(L)],Pe);const Fe={registration:{[L]:{class:Pe,singleton:!1}},type:L,predicate:r.isKosModel(L),factory:r.Kos.Factory.create(L)};var To=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,he=(e,t,o,i)=>{for(var s=i>1?void 0:i?Mo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&To(t,o,s),s};const D="setup-step-container-model";function Be(e){return t=>{const o=Fe.factory(t.id)(t);o.updateModel(t),e.addModel(o)}}function Ye(e){return t=>{e.removeModel(t)}}let b=class{constructor(e,t,o){n(this,"id");n(this,"_currentStep");n(this,"logger");n(this,"models");n(this,"authModel");this.id=e,this.logger=o.logger,this._currentStep=void 0,this.models=new r.KosModelContainer({parentId:e,sortKey:"idx"})}get currentStep(){return this._currentStep}setCurrentStep(e){const t=this.models.getModel(e);t&&(this._currentStep=t)}nextStep(){if(!this._currentStep)this._currentStep=this.firstIncompleteStep;else{const e=this._currentStep.idx,t=this.models.data.find(o=>o.idx>e);t&&(this._currentStep=t)}}get hasIncompletePreSteps(){return this.models.data.some(e=>e.preStep&&!e.complete)}get setupRequired(){return this.models.data.some(e=>!e.complete)}get firstIncompleteStep(){return this.models.data.find(e=>!e.complete)}get isLastStep(){var e;return this.models.data[this.models.data.length-1].id===((e=this._currentStep)==null?void 0:e.id)}get data(){return this.models.data}getModel(e){return this.models.getModel(e)}addModel(e){this.models.addModel(e)}removeModel(e){this.models.removeModel(e)}async init(){this.logger.debug(`initializing setup-step-container container ${this.id}`)}async load(){this.logger.debug(`loading setup-step-container container ${this.id}`);const e=await it();if(e!=null&&e.data){const t=e.data.map((o,i)=>({...o,idx:i,id:`setup-${o.name}`}));r.resolveContainerDeltas({container:this.models,onAddItem:Be(this),onRemoveItem:Ye(this)})(t)}this.nextStep()}handleStepChanges(e){const t=e.map((o,i)=>({...o,idx:i,id:`setup-${o.name}`}));r.resolveContainerDeltas({container:this.models,onAddItem:Be(this),onRemoveItem:Ye(this)})(t)}};he([r.kosChild],b.prototype,"models",2);he([r.kosDependency({modelType:ge.type})],b.prototype,"authModel",2);he([r.kosTopicHandler({topic:"/app/kosdev.ddk/setup/steps",websocket:!0})],b.prototype,"handleStepChanges",1);b=he([r.kosModel(D)],b);const Ke={registration:{[D]:{class:b,singleton:!0},...Fe.registration},type:D,predicate:r.isKosModel(D),factory:r.Kos.Singleton.create(D)},{URL:v}=r.resolveServiceUrl("AUTH_SERVICE"),{getOne:at,getAll:se}=r.ServiceFactory.build({basePath:`${v}/api/app/kosdev.ddk/ncui/`}),X=r.KosLog.createLogger({name:"auth-service",group:"Services"}),So=async()=>{X.debug("sending GET for cuis");const e=await se({urlOverride:`${v}/api/app/kosdev.ddk/cui`});if((e==null?void 0:e.status)!==200)throw new Error("Failed to retrieve cuis");return e.data},ko=async()=>{X.debug("sending GET for navigation");try{const e=await se({urlOverride:`${v}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.navigations`});if((e==null?void 0:e.status)!==200){X.info("no extensions found, using base data");const t=await se({urlOverride:`${v}/api/kos/descriptor/system:app/kondra.ncui.navigations`});return(t==null?void 0:t.data)??[]}return(e==null?void 0:e.data)??[]}catch{const t=await se({urlOverride:`${v}/api/kos/descriptor/system:app/kondra.ncui.navigations`});return(t==null?void 0:t.data)??[]}},Po=async()=>(X.debug("navigating to CUI"),await at({urlOverride:`${v}/api/app/kosdev.ddk/cui/open`})),$o=async()=>(X.debug("navigating to NCUI"),await at({urlOverride:`${v}/api/app/kosdev.ddk/ncui/open`}));var Oo=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,y=(e,t,o,i)=>{for(var s=i>1?void 0:i?Co(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&Oo(t,o,s),s};const A="application-model",lt=(e,t="")=>e.reduce((o,i)=>{const s=t?`${t}.${i.name}`:i.name;if(o[s]={...i,root:!t},i.children){const a=lt(i.children,s);Object.keys(a).forEach(l=>{o[l]=a[l]})}return o},{});let u=class{constructor(e,t,o){n(this,"id");n(this,"device");n(this,"authModel");n(this,"setupStepContainer");n(this,"door");n(this,"ncuiLanguage");n(this,"activeCui");n(this,"fallbackCui");n(this,"_cuis",[]);n(this,"_navigationItems",[]);n(this,"languages");n(this,"logger");this.id=e,this.languages=[],this._cuis=[],this.logger=o.logger,this.door=rt.instance("app:kosdev.ddk:service:door:door").options({doorPath:"app:kosdev.ddk:service:door:door"}).build()}get setupRequired(){return this.authModel.currentRole==="crew"?!1:this.setupStepContainer.setupRequired}get currentRole(){return this.authModel.currentRole}get cuis(){return this._cuis.reduce((e,t)=>(e[t.appId]=t,e),{})}get navigationItems(){return lt(this._navigationItems)}get hasCuiDefined(){return!!this.activeCui.value||!!this.fallbackCui.value}get doorIsOpen(){return this.door.isOpen}async enter(){this.logger.info("navigating to NCUI"),await $o()}async exit(){this.logger.info("navigating to CUI"),await Po()}async load(){var o,i;this.logger.debug(`loading application ${this.id}`);const e=await ko();this._navigationItems=e;const t=await So();this._cuis=t,(o=this.setupStepContainer)!=null&&o.hasIncompletePreSteps&&((i=this.authModel)==null||i.forceRole("technician")),this.languages=[{name:"English",locale:"en"}]}};y([r.kosDependency({modelType:r.Device.type})],u.prototype,"device",2);y([r.kosDependency({modelType:ge.type})],u.prototype,"authModel",2);y([r.kosDependency({modelType:Ke.type})],u.prototype,"setupStepContainer",2);y([r.kosChild],u.prototype,"door",2);y([r.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.ncuiLanguage"})],u.prototype,"ncuiLanguage",2);y([r.kosConfigProperty({path:"app:kosdev.ddk:service:cui",attribute:"activeCui"})],u.prototype,"activeCui",2);y([r.kosConfigProperty({path:"app:kosdev.ddk:service:cui",attribute:"fallbackCui"})],u.prototype,"fallbackCui",2);u=y([r.kosModel(A)],u);const ye={registration:{[A]:{class:u,singleton:!0}},type:A,predicate:r.isKosModel(A),factory:r.Kos.Singleton.create(A)},re={none:999,crew:0,technician:1,manager:2},Ue=e=>t=>{if(t.type===m.AGITATION_REQUIRED_TROUBLE)return!1;const o=(t==null?void 0:t.role)||"technician";if(e&&o){const i=re[e.toLowerCase()]??re.crew,s=re[o.toLowerCase()]??re.crew;return i>=s}return!1};var Eo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,$=(e,t,o,i)=>{for(var s=i>1?void 0:i?wo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&Eo(t,o,s),s};const dt="agitation-control-model",$e="resolve",Lo="agitate";let g=class{constructor(e,t,o){n(this,"id");n(this,"futureHandler");n(this,"logger");n(this,"troubleContainer");n(this,"_agitationFutureId");n(this,"_canExit",!0);n(this,"_exiting",!1);n(this,"_isFailed",!1);n(this,"disposer");n(this,"application");n(this,"inProgress",[]);this.id=e,this.logger=o.logger,this.troubleContainer=t.companionParent,this.futureHandler=new r.MultipleFutureHandler(this,$e)}set isFailed(e){this._isFailed=e}get isFailed(){return this._isFailed}get isDoorClosed(){return!this.application.doorIsOpen}get isAgitating(){return!!this._agitationFutureId}set exiting(e){this._exiting=e}get exiting(){return this._exiting}get canExit(){return this.queuedTroubles.length===0&&this._canExit}clearAll(){this.queuedTroubles.forEach(e=>{e.clearDefer()})}get readyToResolve(){const e=this.queuedTroubles.length,t=this.queuedTroubles.filter(i=>i.shouldDefer),o=e>0&&t.length===0;return this.isDoorClosed&&o&&this.exiting}onFutureUpdate(e){e.endState===r.FutureEndState.Success?(this.logger.debug(`Resolve deferred troubles future ${e.id} completed successfully`),this.queuedTroubles.forEach(t=>{t.clearDefer()}),r.kosAction(()=>{this._canExit=!0,this._isFailed=!1})):(e.endState===r.FutureEndState.Fail||e.endState===r.FutureEndState.Canceled||e.endState===r.FutureEndState.Aborted)&&(this.logger.error(`Resolve deferred troubles future ${e.id} failed`),this.clearAll(),r.kosAction(()=>{this._canExit=!1,this._isFailed=!0}))}async resolveDeferredTroubles(e){const t=this.queuedTroubles.filter(i=>!i.shouldDefer).map(i=>i.rawId).filter(i=>!this.inProgress.includes(i));return this.inProgress.push(...t),t.length===0?void 0:await r.TroubleServices.bulkResolveTroubles(t,void 0,e)}get hasQueuedTroubles(){return this.queuedTroubles.length>0}get queuedTroubles(){return this.troubleContainer.troubles.getIndexByKey(r.Troubles.INDEX_TROUBLES_BY_DEFERRED,r.Troubles.TROUBLES_DEFERRED)}get visibleTroubles(){const e=this.application.currentRole;return this.troubleContainer.troubles.data.filter(Ue(e)).filter(t=>t.type!==m.AGITATION_REQUIRED_TROUBLE)}get future(){return this.futureHandler.future}get resolveFuture(){return this.futureHandler.getFuture($e)}get agitateFuture(){return this.futureHandler.getFuture(Lo)}handleAgitationStarted(e){this.logger.info(`Agitation started for ${e.path}`),this._agitationFutureId=String(e.futureId)}handleAgitationEnded(e){this.logger.info(`Agitation ended for ${e.path}`),this._agitationFutureId=void 0}async init(){this.logger.debug(`initializing agitation-control ${this.id}`)}unload(){this.logger.debug(`unloading agitation-control ${this.id}`),this.disposer&&this.disposer()}handleReadyToResolve(){this.readyToResolve&&(this.logger.info("AgitationControl - Resolving deferred troubles"),this.resolveDeferredTroubles()),this._agitationFutureId&&this.logger.info("AgitationControl - Agitation started")}async load(){this.logger.debug(`loading agitation-control ${this.id}`)}};$([r.kosDependency({modelType:ye.type})],g.prototype,"application",2);$([r.kosFuture({alias:$e})],g.prototype,"resolveDeferredTroubles",1);$([r.kosTopicHandler({topic:m.CartridgeAgitatorEvents.TOPIC_AGITATION_STARTED})],g.prototype,"handleAgitationStarted",1);$([r.kosTopicHandler({topic:m.CartridgeAgitatorEvents.TOPIC_AGITATION_ENDED})],g.prototype,"handleAgitationEnded",1);$([r.kosModelEffect({dependencies:e=>[e.readyToResolve,e._agitationFutureId]})],g.prototype,"handleReadyToResolve",1);g=$([r.kosModel(dt)],g);const Do=new r.SingletonKosModelRegistrationFactory({class:g,type:dt});var Ao=Object.defineProperty,Io=Object.getOwnPropertyDescriptor,ee=(e,t,o,i)=>{for(var s=i>1?void 0:i?Io(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&Ao(t,o,s),s};const I="animation-model";let f=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"disableAll");n(this,"enableDial");n(this,"enableModal");n(this,"enableSideBar");this.id=e,this.logger=o.logger}};ee([r.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.disableAll"})],f.prototype,"disableAll",2);ee([r.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableDial"})],f.prototype,"enableDial",2);ee([r.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableModal"})],f.prototype,"enableModal",2);ee([r.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.animations.enableSideBar"})],f.prototype,"enableSideBar",2);f=ee([r.kosModel(I)],f);const ct={registration:{[I]:{class:f,singleton:!0}},type:I,predicate:r.isKosModel(I),factory:r.Kos.Singleton.create(I)},{URL:Ro}=r.resolveServiceUrl("ANIMATION_SERVICE"),{getAll:Fo}=r.ServiceFactory.build({basePath:`${Ro}/api/animation`}),Ko=r.KosLog.createLogger({name:"animation-service",group:"Services"}),Uo=async()=>(Ko.debug("sending GET for animation"),await Fo({})),xo=Object.freeze(Object.defineProperty({__proto__:null,getAnimations:Uo},Symbol.toStringTag,{value:"Module"}));var jo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,ut=(e,t,o,i)=>{for(var s=i>1?void 0:i?No(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&jo(t,o,s),s};const R="carb-water-model";let ae=class{constructor(e,t,o){n(this,"id");n(this,"assemblyModel");n(this,"logger");this.id=e,this.logger=o.logger}getPump(){const t=this.assemblyModel.getHoldersByGroup("carb")[0].pumps.data[0];return r.getKosCompanionModel(t,m.FcmPump.type)}async init(){this.logger.debug(`initializing carb-water ${this.id}`)}async load(){this.logger.debug(`loading carb-water ${this.id}`)}};ut([r.kosDependency({modelType:P.Assembly.type})],ae.prototype,"assemblyModel",2);ae=ut([r.kosModel(R)],ae);const pt={registration:{[R]:{class:ae,singleton:!1}},type:R,predicate:r.isKosModel(R),factory:r.Kos.Factory.create(R)},{URL:O}=r.resolveServiceUrl("COPY-LOGS_SERVICE"),{getAll:Wo,getOne:Ho,postModel:gt,deleteModel:Vo}=r.ServiceFactory.build({basePath:`${O}/api/copy-logs`}),le=r.KosLog.createLogger({name:"copy-logs-service",group:"Services"}),ht=async(e,t)=>{const o=await Vo({tracker:t,id:e,urlOverride:`${O}/api/app/kosdev.ddk/copyLogs/${e}`});if(!(o!=null&&o.data))throw new Error("No response from server");return o.data},yt=async(e,t)=>{const o=await gt({model:{},tracker:t,urlOverride:`${O}/api/app/kosdev.ddk/copyLogs/eraseAndCopy/${e}`});if(!(o!=null&&o.data))throw new Error("No response from server");return o.data},vt=async(e,t)=>{const o=await gt({model:{},tracker:t,urlOverride:`${O}/api/app/kosdev.ddk/copyLogs/${e}`});if(!(o!=null&&o.data))throw new Error("No response from server");return o.data},ft=async()=>{le.debug("sending GET for copy-logs");try{const e=await Wo({urlOverride:`${O}/api/app/kosdev.ddk/copyLogs/volumes/size`});return[void 0,e==null?void 0:e.data]}catch(e){if(e instanceof r.FetchError)return le.error(`Error fetching log file size: ${e.payload.error}`),[e.payload.error,void 0]}return["unknownError",void 0]},mt=async()=>{le.debug("sending GET for log file size");try{const e=await Ho({urlOverride:`${O}/api/app/kosdev.ddk/copyLogs/files/size`});return[void 0,e==null?void 0:e.data]}catch(e){if(e instanceof r.FetchError)return le.error(`Error fetching log file size: ${e.payload.error}`),[e.payload.error,void 0]}return["unknownError",void 0]},zo=Object.freeze(Object.defineProperty({__proto__:null,copyLogFromVolume:vt,eraseAndCopyLogsToVolume:yt,eraseVolume:ht,getLogFileSize:mt,getVolumes:ft},Symbol.toStringTag,{value:"Module"}));var bt=Object.defineProperty,Bo=Object.getOwnPropertyDescriptor,Yo=(e,t,o)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,C=(e,t,o,i)=>{for(var s=i>1?void 0:i?Bo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&bt(t,o,s),s},Go=(e,t,o)=>(Yo(e,t+"",o),o);const qo="copy-logs-model";let p=class{constructor(e){n(this,"id");n(this,"_volumes");n(this,"storageDeviceContainer");n(this,"_activeVolume");n(this,"_logFileSize",0);n(this,"_actionState","idle");n(this,"copyProgress");this.id=e,this._volumes=new r.KosDataContainer,this._activeVolume=void 0,this.copyProgress={bytesCopied:0,bytesToCopy:0,filesCopied:0,filesSkipped:0}}get volumes(){return this._volumes.data}get activeVolume(){return this._activeVolume}get logFileSize(){return this._logFileSize}reset(){this.clearActiveVolume(),this.futureHandler.removeFuture()}clearActiveVolume(){this._activeVolume=void 0}updateActiveVolume(e){this._activeVolume=e}get inserted(){return this.storageDeviceContainer.isStorageInserted}updateLogFileSize(e){this._logFileSize=e}get canCopyLogs(){return this.inserted&&this._activeVolume}get actionState(){return this._actionState}get diskFull(){var e;return((e=this.future)==null?void 0:e.status)===r.FutureEndState.Success&&this.copyProgress.filesSkipped>0}onFutureUpdate(e){this.logger.info(`Future update: ${e.status}`),e.status===r.FutureEndState.Success&&(this.logger.info(`Future success: ${e.status}`),this.diskFull&&r.kosAction(()=>{e.endState=r.FutureEndState.Fail,e.reason="errDiskFull"})),e.status===r.FutureEndState.Fail&&this.logger.error(`Future failed: ${e.status}`),e.note==="copy"?r.kosAction(()=>{this._actionState="copying",this.copyProgress=e.clientData||{bytesCopied:0,bytesToCopy:0,filesCopied:0,filesSkipped:0}}):(this._actionState="erasing",r.kosAction(()=>{this.copyProgress={bytesCopied:0,bytesToCopy:0,filesCopied:0,filesSkipped:0}}))}async eraseAndCopyVolume(e){var t;if(!e)throw new Error("No tracker provided");if(r.kosAction(()=>{this._actionState="erasing"}),!this._activeVolume)throw this.logger.error("No active volume selected"),new Error("No active volume selected");return this.logger.info(`Erasing volume ${(t=this._activeVolume)==null?void 0:t.name}`),yt(this._activeVolume.id,e)}async eraseVolume(e){var t;if(!e)throw new Error("No tracker provided");if(r.kosAction(()=>{this._actionState="erasing"}),!this._activeVolume)throw this.logger.error("No active volume selected"),new Error("No active volume selected");return this.logger.info(`Erasing volume ${(t=this._activeVolume)==null?void 0:t.name}`),ht(this._activeVolume.id,e)}async copyLogs(e){var t;if(!e)throw new Error("No tracker provided");if(r.kosAction(()=>{this._actionState="copying"}),!this._activeVolume)throw this.logger.error("No active volume selected"),new Error("No active volume selected");return this.logger.info(`Copying logs to ${(t=this._activeVolume)==null?void 0:t.name}`),vt(this._activeVolume.id,e)}handleInsertion(){this.inserted?this.syncVolumes():(this._volumes.clear(),this.clearActiveVolume())}async init(){this.logger.debug(`initializing copy-logs ${this.id}`)}async syncVolumes(){const[e,t]=await ft(),[o,i]=await mt();if(o){this.logger.error(`Error fetching log file size: ${o}`);return}if(e){this.logger.error(`Error fetching volumes: ${e}`);return}t&&(t.forEach(s=>{const a=this.storageDeviceContainer.getModel(s.id);if(a){const l={id:s.id,name:a.label,freeBytes:s.info.freeBytes,totalBytes:s.info.totalBytes};this._volumes.addModel(l)}}),t.length===1?this.updateActiveVolume(this._volumes.data[0]):this.clearActiveVolume()),i&&(this.logger.info(`Log file size: ${i}`),this.updateLogFileSize(parseInt(i,10)))}async activate(){this.logger.debug(`activating copy-logs ${this.id}`),await this.syncVolumes()}async load(){this.logger.debug(`loading copy-logs ${this.id}`)}};Go(p,"Registration");C([r.kosDependency({modelType:r.StorageDeviceContainer.type})],p.prototype,"storageDeviceContainer",2);C([r.kosFuture()],p.prototype,"eraseAndCopyVolume",1);C([r.kosFuture()],p.prototype,"eraseVolume",1);C([r.kosFuture()],p.prototype,"copyLogs",1);C([r.kosModelEffect({dependencies:e=>[e.inserted]})],p.prototype,"handleInsertion",1);p=C([r.kosModel({modelTypeId:qo,singleton:!0}),r.kosFutureAware(),r.kosLoggerAware()],p);const Qo=p.Registration,_t=r.KosLog.createLogger({name:"dashboard-operations-service",group:"Services"}),Tt=async(e,t)=>(_t.debug("resolveAll"),await r.TroubleServices.bulkResolveTroubles(e,void 0,t)),Mt=async(e,t)=>(_t.debug("resolveTrouble"),await r.TroubleServices.resolveTrouble(e,void 0,t)),Xo=Object.freeze(Object.defineProperty({__proto__:null,resolveAll:Tt,resolveTrouble:Mt},Symbol.toStringTag,{value:"Module"}));var Jo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,ve=(e,t,o,i)=>{for(var s=i>1?void 0:i?Zo(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&Jo(t,o,s),s};const F="dashboard-operations-model";function Ge(e){return!e.deferred}function qe(e){return e.deferred}let _=class{constructor(e,t,o){n(this,"id");n(this,"troubles");n(this,"futureHandler");n(this,"logger");this.id=e,this.futureHandler=new r.FutureHandler(this),this.logger=o.logger}get troublesByType(){return this.troubles.troubles.data.reduce(r.troubleByTypeReducer,{})}get queuedPurgeTroubles(){return this.purgeTroubles.filter(qe)}get queuedPrimeTroubles(){return this.primeTroubles.filter(qe)}get resolvablePrimeTroubles(){return this.primeTroubles.filter(Ge)}get resolvablePurgeTroubles(){return this.purgeTroubles.filter(Ge)}get hasResolvablePurgeTroubles(){return this.resolvablePurgeTroubles.length>0}get hasResolvablePrimeTroubles(){return this.resolvablePrimeTroubles.length>0}get hasPurgeTroubles(){return this.purgeTroubles.length>0}get hasPrimeTroubles(){return this.primeTroubles.length>0}get purgeTroubles(){return this.troublesByType[ke]||[]}get primeTroubles(){return this.troublesByType[Xe]||[]}get future(){return this.futureHandler.getFuture()}async resolveAllTroubles(e,t){if(!t)throw new Error("No tracker provided");const o=e===ke?this.purgeTroubles:this.primeTroubles;o.filter(l=>l.shouldDefer).forEach(l=>{this.logger.info(`Deferring trouble ${l.rawId}`),l.defer()});const s=o.filter(l=>!l.shouldDefer).map(l=>l.rawId);return s.length===0?void 0:await Tt(s,t)}async resolveTrouble(e,t){if(!t)throw new Error("No tracker provided");return await Mt(e,t)}async init(){this.logger.debug(`initializing dashboard-operations ${this.id}`)}async load(){this.logger.debug(`loading dashboard-operations ${this.id}`)}};ve([r.kosDependency({modelType:r.TroubleContainer.type})],_.prototype,"troubles",2);ve([r.kosFuture()],_.prototype,"resolveAllTroubles",1);ve([r.kosFuture()],_.prototype,"resolveTrouble",1);_=ve([r.kosModel(F)],_);const fe={registration:{[F]:{class:_,singleton:!0}},type:F,predicate:r.isKosModel(F),factory:r.Kos.Singleton.create(F)};var er=Object.getOwnPropertyDescriptor,tr=(e,t,o,i)=>{for(var s=i>1?void 0:i?er(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=l(s)||s);return s};const K="dispenser-model";let Oe=class{constructor(e,t,o){n(this,"id");n(this,"logger");this.id=e,this.logger=o.logger}updateModel(){}async init(){this.logger.debug(`initializing dispenser ${this.id}`)}async load(){this.logger.debug(`loading dispenser ${this.id}`)}};Oe=tr([r.kosModel(K)],Oe);const St={registration:{[K]:{class:Oe,singleton:!0}},type:K,predicate:r.isKosModel(K),factory:r.Kos.Singleton.create(K)},{URL:or}=r.resolveServiceUrl("DISPENSER_SERVICE"),{getAll:rr}=r.ServiceFactory.build({basePath:`${or}/api/dispenser`}),sr=r.KosLog.createLogger({name:"dispenser-service",group:"Services"}),ir=async()=>(sr.debug("sending GET for dispenser"),await rr({})),nr=Object.freeze(Object.defineProperty({__proto__:null,getDispensers:ir},Symbol.toStringTag,{value:"Module"}));var ar=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,kt=(e,t,o,i)=>{for(var s=i>1?void 0:i?lr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&ar(t,o,s),s};const U="dispenser-info-model";let de=class{constructor(e,t,o){n(this,"logger");n(this,"id");n(this,"name");this.id=e,this.logger=o.logger}async init(){this.logger.debug(`initializing dispenser-info ${this.id}`)}async load(){this.logger.debug(`loading dispenser-info ${this.id}`)}};kt([r.kosConfigProperty({path:"kos:device",attribute:"name"})],de.prototype,"name",2);de=kt([r.kosModel(U)],de);const Pt={registration:{[U]:{class:de,singleton:!1}},type:U,predicate:r.isKosModel(U),factory:r.Kos.Factory.create(U)},{URL:dr}=r.resolveServiceUrl("DISPENSER-INFO_SERVICE"),{getAll:cr}=r.ServiceFactory.build({basePath:`${dr}/api/dispenser-info`}),ur=r.KosLog.createLogger({name:"dispenser-info-service",group:"Services"}),pr=async()=>(ur.debug("sending GET for dispenser-info"),await cr({})),gr=Object.freeze(Object.defineProperty({__proto__:null,getDispenserInfos:pr},Symbol.toStringTag,{value:"Module"}));var hr=Object.getOwnPropertyDescriptor,yr=(e,t,o,i)=>{for(var s=i>1?void 0:i?hr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=l(s)||s);return s};const x="enrollment-model";let Ce=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"enrolled");this.id=e,this.logger=o.logger,this.enrolled=!1}updateModel(e){console.log("updateModel:",e)}async init(){this.logger.debug(`initializing enrollment ${this.id}`)}async load(){this.logger.debug(`loading enrollment ${this.id}`)}};Ce=yr([r.kosModel(x)],Ce);const $t={registration:{[x]:{class:Ce,singleton:!0}},type:x,predicate:r.isKosModel(x),factory:r.Kos.Singleton.create(x)},{URL:vr}=r.resolveServiceUrl("ENROLLMENT_SERVICE"),{getAll:fr}=r.ServiceFactory.build({basePath:`${vr}/api/enrollment`}),mr=r.KosLog.createLogger({name:"enrollment-service",group:"Services"}),br=async()=>(mr.debug("sending GET for enrollment"),await fr({})),_r=Object.freeze(Object.defineProperty({__proto__:null,getEnrollments:br},Symbol.toStringTag,{value:"Module"})),Tr=e=>e.toLowerCase().includes("micros"),Mr=e=>!e.toLowerCase().includes("micros"),Sr=e=>t=>{const o=e==null?void 0:e.getHoldersByGroup(t);return o?o.map(i=>({id:i.id,name:i.ingredientName,path:i.path})):null},kr=["water","carb","ns","nss"],T="dashboardKeyFactory",Te=[];r.registerExtensionPoint(T,{register:(e,t)=>{Te.includes(t)||Te.push(t)},execute:(e,t)=>{const o=Te.sort((i,s)=>i.rank-s.rank);for(const i of o){const s=i.factory(t);if(s)return s}}});const Ot=e=>{r.ExtensionManager[T].register(T,e)},Ct=e=>r.ExtensionManager[T].execute(T,e);r.ExtensionManager.registerDashboardKeyFactory=Ot;r.ExtensionManager.executeDashboardKeyFactory=Ct;const Ee=3600,Et=60,Pr=e=>{const t=Math.floor(e/Ee),o=Math.floor(e%Ee/Et);return{hours:t,minutes:o}},$r=(e,t)=>e*Ee+t*Et,wt=e=>{const o=new Date().valueOf()-e.valueOf(),i=Math.floor(o/(1e3*60)),s=Math.floor(i/60),a=Math.floor(s/24),l=i%60,te=s%24;let oe="";return a>0&&(oe+=`${a} day${a>1?"s":""} `),te>0&&(oe+=`${te} hour${te>1?"s":""} `),(l>0||a===0&&te===0)&&(oe+=`${l} minute${l>1?"s":""} `),oe};var Or=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,me=(e,t,o,i)=>{for(var s=i>1?void 0:i?Cr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&Or(t,o,s),s};const j="ingredient-summary-model";let M=class{constructor(e,t,o){n(this,"id");n(this,"assemblyModel");n(this,"dashboardOperationModel");n(this,"appModel");n(this,"logger");this.id=e,this.logger=o.logger,this.dashboardOperationModel=fe.factory({})}get highPriorityHolders(){return this.assemblyModel.allHolders.filter(e=>e.troubles.length>0&&e.troubles.find(t=>t.rank>=400))}get actionRequiredHolders(){const e=this.appModel.currentRole,t=Ue(e);return this.assemblyModel.allHolders.filter(o=>{const i=r.getKosCompanionModel(o,m.FreestyleHolder.type);if(i!=null&&i.isRemote)return!1;const s=o.troubles.filter(t);return s.length>0&&s.find(a=>a.resolvable)})}get lowLevelHolders(){return this.assemblyModel.allHolders.filter(e=>{const t=e.fillPercent;return e.hasFuelGuage&&t<20})}async init(){this.logger.debug(`initializing ingredient-summary ${this.id}`)}async load(){this.logger.debug(`loading ingredient-summary ${this.id}`)}};me([r.kosDependency({modelType:P.Assembly.type})],M.prototype,"assemblyModel",2);me([r.kosDependency({modelType:fe.type})],M.prototype,"dashboardOperationModel",2);me([r.kosDependency({modelType:ye.type})],M.prototype,"appModel",2);M=me([r.kosModel(j)],M);const Lt={registration:{[j]:{class:M,singleton:!1}},type:j,predicate:r.isKosModel(j),factory:r.Kos.Factory.create(j)},{URL:xe}=r.resolveServiceUrl("LOCKOUT_SERVICE"),{postModel:Dt}=r.ServiceFactory.build({basePath:`${xe}/api/app/kosdev.ddk/lockout`}),At=r.KosLog.createLogger({name:"lockout-service",group:"Services"}),Er=async()=>(At.info("lock"),await Dt({model:{},urlOverride:`${xe}/api/app/kosdev.ddk/lockout/lockNow`})),It=async e=>{At.info("unlock");const t=await Dt({model:{},urlOverride:`${xe}/api/app/kosdev.ddk/lockout/unlock/${e}`});return t==null?void 0:t.data},wr=Object.freeze(Object.defineProperty({__proto__:null,lock:Er,unlock:It},Symbol.toStringTag,{value:"Module"}));var Lr=Object.defineProperty,Dr=Object.getOwnPropertyDescriptor,E=(e,t,o,i)=>{for(var s=i>1?void 0:i?Dr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&Lr(t,o,s),s};const Rt="lockout-model",Ar=[{day:"monday",lock:"dayWiseLockConfigMap.Mon.enabled",open:"dayWiseLockConfigMap.Mon.unlockTime",close:"dayWiseLockConfigMap.Mon.lockTime"},{day:"tuesday",lock:"dayWiseLockConfigMap.Tue.enabled",open:"dayWiseLockConfigMap.Tue.unlockTime",close:"dayWiseLockConfigMap.Tue.lockTime"},{day:"wednesday",lock:"dayWiseLockConfigMap.Wed.enabled",open:"dayWiseLockConfigMap.Wed.unlockTime",close:"dayWiseLockConfigMap.Wed.lockTime"},{day:"thursday",lock:"dayWiseLockConfigMap.Thu.enabled",open:"dayWiseLockConfigMap.Thu.unlockTime",close:"dayWiseLockConfigMap.Thu.lockTime"},{day:"friday",lock:"dayWiseLockConfigMap.Fri.enabled",open:"dayWiseLockConfigMap.Fri.unlockTime",close:"dayWiseLockConfigMap.Fri.lockTime"},{day:"saturday",lock:"dayWiseLockConfigMap.Sat.enabled",open:"dayWiseLockConfigMap.Sat.unlockTime",close:"dayWiseLockConfigMap.Sat.lockTime"},{day:"sunday",lock:"dayWiseLockConfigMap.Sun.enabled",open:"dayWiseLockConfigMap.Sun.unlockTime",close:"dayWiseLockConfigMap.Sun.lockTime"}];let h=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"dayEnabledList",["dayWiseLockConfigMap.Sun.enabled","dayWiseLockConfigMap.Mon.enabled","dayWiseLockConfigMap.Tue.enabled","dayWiseLockConfigMap.Wed.enabled","dayWiseLockConfigMap.Thu.enabled","dayWiseLockConfigMap.Fri.enabled","dayWiseLockConfigMap.Sat.enabled"]);n(this,"dayOpenAtList",["dayWiseLockConfigMap.Sun.unlockTime","dayWiseLockConfigMap.Mon.unlockTime","dayWiseLockConfigMap.Tue.unlockTime","dayWiseLockConfigMap.Wed.unlockTime","dayWiseLockConfigMap.Thu.unlockTime","dayWiseLockConfigMap.Fri.unlockTime","dayWiseLockConfigMap.Sat.unlockTime"]);n(this,"dayCloseAtList",["dayWiseLockConfigMap.Sun.lockTime","dayWiseLockConfigMap.Mon.lockTime","dayWiseLockConfigMap.Tue.lockTime","dayWiseLockConfigMap.Wed.lockTime","dayWiseLockConfigMap.Thu.lockTime","dayWiseLockConfigMap.Fri.lockTime","dayWiseLockConfigMap.Sat.lockTime"]);n(this,"saveMap");n(this,"pin");n(this,"nextLockSkipped");n(this,"nextLockTime");n(this,"nextUnLockTime");n(this,"cuiLockout");this.id=e,this.logger=o.logger,this.saveMap=new Map}get enabled(){const e=this.getProp("oneTimeLockConfig.lockTime"),t=e!==void 0&&e!=="",o=this.getProp("lockScheduleEnabled");return t||o}get schedule(){return Ar}getProp(e){return this.saveMap.get(e)}setProp(e,t){this.saveMap.set(e,t)}toggleSkip(){if(this.nextLockSkipped.value==="0"){const t=this.nextLockTime.value;t!==void 0&&this.nextLockSkipped.updateProperty(t)}else this.nextLockSkipped.updateProperty("0")}async unlock(e){return await It(e)}async save(){return this.saveMap.forEach((e,t)=>{e!==this.cuiLockout.props[t]&&(this.cuiLockout.props[t]=e)}),this.cuiLockout.updateConfigBean()}reset(){this.cuiLockout.props.entries.forEach(([e,t])=>this.saveMap.set(e,t))}async init(){this.logger.debug(`initializing lockout ${this.id}`),this.cuiLockout.props.entries.forEach(([e,t])=>this.saveMap.set(e,t))}async load(){this.logger.debug(`loading lockout ${this.id}`)}};E([r.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"pin"})],h.prototype,"pin",2);E([r.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextLockSkipped"})],h.prototype,"nextLockSkipped",2);E([r.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextLockTime"})],h.prototype,"nextLockTime",2);E([r.kosConfigProperty({path:"app:kosdev.ddk:service:cuiLockout",attribute:"nextUnLockTime"})],h.prototype,"nextUnLockTime",2);E([r.kosConfigBean({path:"app:kosdev.ddk:service:cuiLockout"})],h.prototype,"cuiLockout",2);h=E([r.kosModel(Rt)],h);const Ir=new r.SingletonKosModelRegistrationFactory({class:h,type:Rt}),Rr=async(e,t)=>await r.TroubleServices.bulkResolveTroubles(e,void 0,t);var Fr=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,be=(e,t,o,i)=>{for(var s=i>1?void 0:i?Kr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&Fr(t,o,s),s};const N="macro-assignment-model",Qe="PurgeTrouble",Ur="PrimeTrouble";let S=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"futureHandler");n(this,"holders");n(this,"ingredients");this.id=e,this.futureHandler=new r.FutureHandler,this.logger=o.logger}get future(){return this.futureHandler.future}get macroHolders(){return this.holders.holders.getIndexByKey("group","macros").sort((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)}get hasMacroHolders(){return this.macroHolders.length>0}get holderPurgeTroubles(){return this.macroHolders.reduce((t,o)=>{const i=o.troublesByType[Qe]||[];return t=[...t,...i],t},[])}get holderPrimeTroubles(){return this.macroHolders.reduce((t,o)=>{const i=o.troublesByType[Ur]||[];return t=[...t,...i],t},[])}get hasHolderPurgeTroubles(){return this.holderPurgeTroubles.length>0}get hasHolderPrimeTroubles(){return this.holderPrimeTroubles.length>0}get macroIngredients(){return this.ingredients.ingredients.getIndexByKey("macro","macro")}get hasMacroIngredients(){return this.macroIngredients.length>0}async resolveAll(e,t){if(!t)throw new Error("No tracker provided");const i=(e===Qe?this.holderPurgeTroubles:this.holderPrimeTroubles).map(a=>a.rawId);return await Rr(i,t)}};be([r.kosDependency({modelType:P.HolderContainer.type})],S.prototype,"holders",2);be([r.kosDependency({modelType:P.IngredientContainer.type})],S.prototype,"ingredients",2);be([r.kosFuture()],S.prototype,"resolveAll",1);S=be([r.kosModel(N)],S);const Ft={registration:{[N]:{class:S,singleton:!0}},type:N,predicate:r.isKosModel(N),factory:r.Kos.Singleton.create(N)};var xr=Object.getOwnPropertyDescriptor,jr=(e,t,o,i)=>{for(var s=i>1?void 0:i?xr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=l(s)||s);return s};const W="network-test-model";let we=class{constructor(e,t,o){n(this,"id");n(this,"group");n(this,"passed");n(this,"inProgress");n(this,"failureTime");n(this,"timestamp");n(this,"name");n(this,"results");n(this,"logger");this.id=e,this.logger=o.logger,this.group=t.group,this.passed=!1,this.inProgress=!1,this.name=t.name,this.results=[]}updateModel(e){this.group=e.group,this.name=e.name,this.passed=e.passed,this.failureTime=e.failureTime,this.inProgress=e.inProgress,this.timestamp=e.timestamp,this.results=e.results}async init(){this.logger.debug(`initializing network-test ${this.id}`)}async load(){this.logger.debug(`loading network-test ${this.id}`)}};we=jr([r.kosModel(W)],we);const je={registration:{[W]:{class:we,singleton:!1}},type:W,predicate:r.isKosModel(W),factory:r.Kos.Factory.create(W)},{URL:_e}=r.resolveServiceUrl("NETWORK-TEST_SERVICE"),{getAll:Nr,getOne:Kt}=r.ServiceFactory.build({basePath:`${_e}/api/app/ncui/network/tests`}),Wr=r.KosLog.createLogger({name:"network-test-service",group:"Services"}),Ut=async()=>{Wr.debug("sending GET for network-test");const e=await Nr({urlOverride:`${_e}/api/app/kosdev.ddk/network/tests`});return e==null?void 0:e.data},xt=async()=>{const e=await Kt({urlOverride:`${_e}/api/app/kosdev.ddk/network/reports`});return e==null?void 0:e.data},jt=async(e,t)=>await Kt({urlOverride:`${_e}/api/app/kosdev.ddk/network/tests/run/group/${e}`,tracker:t}),Hr=Object.freeze(Object.defineProperty({__proto__:null,getNetworkTests:Ut,getTestsReports:xt,performGroupTest:jt},Symbol.toStringTag,{value:"Module"}));var Vr=Object.defineProperty,zr=Object.getOwnPropertyDescriptor,Ne=(e,t,o,i)=>{for(var s=i>1?void 0:i?zr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&Vr(t,o,s),s};const H="network-test-container-model";let J=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"lastTested");n(this,"futureHandler");n(this,"models");this.id=e,this.logger=o.logger,this.futureHandler=new r.FutureHandler(this),this.models=new r.KosModelContainer({parentId:e,indexMap:{group:"group"}}),this.lastTested=new Date("default")}get data(){return this.models.data}addModel(e){this.models.addModel(e)}removeModel(e){this.models.removeModel(e)}getModel(e){return this.models.getModel(e)}async init(){this.logger.debug(`initializing network-test-container container ${this.id}`)}getLastTested(e){const t=this.models.getIndexByKey("group",e).map(i=>i.timestamp&&new Date(i.timestamp)),o=Math.max(...t.map(i=>i?i.getTime():0));return o?wt(new Date(o)):""}async load(){this.logger.debug(`loading network-test-container container ${this.id}`);const e=await Ut(),t=await xt();e&&e.forEach(o=>{const i=je.factory(o.id)(o);this.addModel(i)}),e&&t&&e.forEach(o=>{const i=t==null?void 0:t[o.group],s=i==null?void 0:i[o.id],a=this.getModel(o.id);if(a&&s){const l={group:s.group,name:s.name,passed:s.passed,failureTime:s.failureTime?new Date(s.failureTime):void 0,inProgress:s.inProgress,timestamp:new Date(s.timestamp),results:s.results};a.updateModel(l)}})}async performTest(e,t){if(!t)throw new Error("No tracker provided");const o=await jt(e,t);return o==null?void 0:o.data}onFutureUpdate(e){const{clientData:t}=e;t&&t.forEach(o=>{const i=this.getModel(o.id);if(r.kosAction(()=>{this.lastTested=this.lastTested>new Date(o.timestamp)?this.lastTested:new Date(o.timestamp)}),i){const s={group:o.group,name:o.name,passed:o.passed,failureTime:o.failureTime?new Date(o.failureTime):void 0,inProgress:o.inProgress,timestamp:new Date(o.timestamp),results:o.results};r.kosAction(()=>{i.updateModel(s)})}})}};Ne([r.kosChild],J.prototype,"models",2);Ne([r.kosFuture()],J.prototype,"performTest",1);J=Ne([r.kosModel(H)],J);const Nt={registration:{[H]:{class:J,singleton:!0},...je.registration},type:H,predicate:r.isKosModel(H),factory:r.Kos.Singleton.create(H)};var Br=Object.defineProperty,Yr=Object.getOwnPropertyDescriptor,We=(e,t,o,i)=>{for(var s=i>1?void 0:i?Yr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&Br(t,o,s),s};const V="nutritive-sweetener-model",Gr=r.createPropKey("statePath");let Z=class{constructor(e,t){n(this,"id");n(this,"assemblyModel");n(this,"pumpState");this.id=e}get holder(){return this.assemblyModel.getHoldersByGroup("ns")[0]}getHolder(){return this.holder}get statePath(){return`${this.pump.path}:airVent:state`}get pump(){return this.holder.pumps.data[0]}getPump(){return this.pump}};We([r.kosDependency({modelType:P.Assembly.type})],Z.prototype,"assemblyModel",2);We([r.kosStateBean({path:Gr})],Z.prototype,"pumpState",2);Z=We([r.kosModel(V),r.kosLoggerAware()],Z);const Wt={registration:{[V]:{class:Z,singleton:!1}},type:V,predicate:r.isKosModel(V),factory:r.Kos.Factory.create(V)};var qr=Object.defineProperty,Qr=Object.getOwnPropertyDescriptor,Ht=(e,t,o,i)=>{for(var s=i>1?void 0:i?Qr(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&qr(t,o,s),s};const z="plain-water-model";let ce=class{constructor(e,t,o){n(this,"id");n(this,"assemblyModel");n(this,"logger");this.id=e,this.logger=o.logger}getHolder(){return this.assemblyModel.getHoldersByGroup("water")[0]}getPump(){var i,s;const e=this.getHolder(),t=(s=(i=e==null?void 0:e.pumps)==null?void 0:i.data)==null?void 0:s[0];return r.getKosCompanionModel(t,m.FcmPump.type)}async init(){this.logger.debug(`initializing plain-water ${this.id}`)}async load(){this.logger.debug(`loading plain-water ${this.id}`)}};Ht([r.kosDependency({modelType:P.Assembly.type})],ce.prototype,"assemblyModel",2);ce=Ht([r.kosModel(z)],ce);const Vt={registration:{[z]:{class:ce,singleton:!1}},type:z,predicate:r.isKosModel(z),factory:r.Kos.Factory.create(z)},{URL:zt}=r.resolveServiceUrl("REBOOT_SERVICE"),{postModel:Xr}=r.ServiceFactory.build({basePath:`${zt}/api/reboot`}),Jr=r.KosLog.createLogger({name:"reboot-service",group:"Services"}),Bt=async()=>(Jr.debug("sending POST call for Reboot Dispenser"),await Xr({urlOverride:`${zt}/api/app/kosdev.ddk/ncui/reboot`,model:{}})),Zr=Object.freeze(Object.defineProperty({__proto__:null,rebootDispenser:Bt},Symbol.toStringTag,{value:"Module"}));var es=Object.getOwnPropertyDescriptor,ts=(e,t,o,i)=>{for(var s=i>1?void 0:i?es(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=l(s)||s);return s};const B="reboot-model";let Le=class{constructor(e,t,o){n(this,"id");n(this,"logger");this.id=e,this.logger=o.logger}async completeReboot(){await Bt()}updateModel(){}async init(){this.logger.debug(`initializing reboot ${this.id}`)}async load(){this.logger.debug(`loading reboot ${this.id}`)}};Le=ts([r.kosModel(B)],Le);const Yt={registration:{[B]:{class:Le,singleton:!1}},type:B,predicate:r.isKosModel(B),factory:r.Kos.Factory.create(B)};var os=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,c=(e,t,o,i)=>{for(var s=i>1?void 0:i?rs(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&os(t,o,s),s};const Y="settings-model";let d=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"ncuiLanguageData");n(this,"resolveDelaysMs");n(this,"dateFormat");n(this,"timeFormat");n(this,"hidePlainWaterBev");n(this,"hideCarbWaterBev");n(this,"ncuiLanguage");n(this,"name");n(this,"activateAndRebootTime");n(this,"horizontalMode");this.id=e,this.logger=o.logger}async ready(){this.updateDisplayMode()}async getNcuiLanguageList(){this.ncuiLanguageData={status:200,data:{languages:[{name:"English",locale:"en"}]}}}async load(){this.logger.debug(`loading settings ${this.id}`),this.ncuiLanguageData={status:200,data:{languages:[{name:"English",locale:"en"}]}}}handleUpdateDisplayMode(){this.updateDisplayMode()}updateDisplayMode(){this.horizontalMode.value?document.body.setAttribute("data-dashboard-layout","horizontal"):document.body.setAttribute("data-dashboard-layout","vertical")}};c([r.kosConfigProperty({path:"system:app",attribute:"resolveDelaysMs"})],d.prototype,"resolveDelaysMs",2);c([r.kosConfigProperty({path:"system:app",attribute:"dateFormat"})],d.prototype,"dateFormat",2);c([r.kosConfigProperty({path:"system:app",attribute:"timeFormat"})],d.prototype,"timeFormat",2);c([r.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.hidePlainWaterBev"})],d.prototype,"hidePlainWaterBev",2);c([r.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.hideCarbWaterBev"})],d.prototype,"hideCarbWaterBev",2);c([r.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.ncuiLanguage"})],d.prototype,"ncuiLanguage",2);c([r.kosConfigProperty({path:"kos:device",attribute:"name"})],d.prototype,"name",2);c([r.kosConfigProperty({path:"kos:service:OTA",attribute:"activateAndRebootTime"})],d.prototype,"activateAndRebootTime",2);c([r.kosConfigProperty({path:"app:kosdev.ddk:app",attribute:"ncui.uiConfig.display.horizontalMode"})],d.prototype,"horizontalMode",2);c([r.kosModelEffect({dependencies:e=>[e.horizontalMode.value]})],d.prototype,"handleUpdateDisplayMode",1);d=c([r.kosModel(Y)],d);const Gt={registration:{[Y]:{class:d,singleton:!0}},type:Y,predicate:r.isKosModel(Y),factory:r.Kos.Singleton.create(Y)},{URL:qt}=r.resolveServiceUrl("SETTINGS_SERVICE"),{getAll:Qt}=r.ServiceFactory.build({basePath:`${qt}/api/settings`}),ss=r.KosLog.createLogger({name:"settings-service",group:"Services"}),is=async()=>(ss.debug("sending GET for settings"),await Qt({})),ns=async()=>await Qt({urlOverride:`${qt}api/app/kosdev.ddk/ncui/languages`}),as=Object.freeze(Object.defineProperty({__proto__:null,getNcuiLanguage:ns,getSettings:is},Symbol.toStringTag,{value:"Module"}));var ls=Object.getOwnPropertyDescriptor,ds=(e,t,o,i)=>{for(var s=i>1?void 0:i?ls(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=l(s)||s);return s};const G="utilities-model";let De=class{constructor(e,t,o){n(this,"id");n(this,"name");n(this,"options");n(this,"roles");n(this,"columnId");n(this,"logger");this.id=e,this.logger=o.logger,this.name=t.name,this.options=t.options,this.roles=t==null?void 0:t.roles,this.columnId=t.columnId}updateModel(e){this.name=e.name,this.options=e.options,this.roles=e==null?void 0:e.roles}get titleKey(){return`utility.${this.id}.title`}get bodyKey(){return`utility.${this.id}.body`}async init(){this.logger.debug(`initializing utilities ${this.id}`)}async load(){this.logger.debug(`loading utilities ${this.id}`)}};De=ds([r.kosModel(G)],De);const He={registration:{[G]:{class:De,singleton:!1}},type:G,predicate:r.isKosModel(G),factory:r.Kos.Factory.create(G)},{URL:ie}=r.resolveServiceUrl("UTILITIES_SERVICE"),{getAll:Me}=r.ServiceFactory.build({basePath:`${ie}/api/utilities`}),Se=r.KosLog.createLogger({name:"utilities-service",group:"Services"}),Xt=async()=>{Se.debug("sending GET for utilities");try{const e=await Me({urlOverride:`${ie}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.utilities`});if((e==null?void 0:e.status)!==200){Se.info("no extensions found, using base data");const t=await Me({urlOverride:`${ie}/api/kos/descriptor/system:app/kondra.ncui.utilities`});return(t==null?void 0:t.data)??[]}return(e==null?void 0:e.data)??[]}catch(e){Se.info(`error fetching utilities: ${e}. Using base data`);const t=await Me({urlOverride:`${ie}/api/kos/descriptor/system:app/kondra.ncui.utilities`});return(t==null?void 0:t.data)??[]}},cs=Object.freeze(Object.defineProperty({__proto__:null,getUtilities:Xt},Symbol.toStringTag,{value:"Module"}));var us=Object.defineProperty,ps=Object.getOwnPropertyDescriptor,Jt=(e,t,o,i)=>{for(var s=i>1?void 0:i?ps(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&us(t,o,s),s};const q="utilities-container-model";let ue=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"_models");this.id=e,this.logger=o.logger,this._models=new r.KosModelContainer({parentId:e,sortKey:"id",indexMap:{byColumn:"columnId"}})}get data(){return this._models.data}get models(){return this._models}get columns(){return this._models.getIndexKeys("byColumn").sort((e,t)=>e.localeCompare(t))}addModel(e){this._models.addModel(e)}removeModel(e){this._models.removeModel(e)}getModel(e){return this._models.getModel(e)}getUtilitiesByColumn(e){return this._models.getIndexByKey("byColumn",e)}async load(){this.logger.debug(`loading utilities-container container ${this.id}`);const e=await Xt();e==null||e.forEach((t,o)=>{t.forEach(i=>{const s={...i,columnId:String(o)},a=He.factory(i.name)(s);this.addModel(a)})})}};Jt([r.kosChild],ue.prototype,"_models",2);ue=Jt([r.kosModel(q)],ue);const Zt={registration:{[q]:{class:ue,singleton:!0},...He.registration},type:q,predicate:r.isKosModel(q),factory:r.Kos.Singleton.create(q)},gs={...ct.registration,...ye.registration,...ge.registration,...pt.registration,...fe.registration,...St.registration,...Pt.registration,...$t.registration,...Lt.registration,...Ft.registration,...Nt.registration,...Wt.registration,...Vt.registration,...Yt.registration,...Gt.registration,...Ke.registration,...Zt.registration};var eo=Object.defineProperty,hs=Object.getOwnPropertyDescriptor,ys=(e,t,o)=>t in e?eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Ve=(e,t,o,i)=>{for(var s=i>1?void 0:i?hs(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&eo(t,o,s),s},vs=(e,t,o)=>(ys(e,t+"",o),o);const fs="trouble-action-model";let k=class{constructor(e,t){n(this,"id");n(this,"troubleContainer");n(this,"state");n(this,"troubleActionData");this.id=e,this.state=r.ObservableData(),this.troubleActionData=t.definitions.reduce((o,i)=>(o[i.troubleType]=i,o),{})}get activeTrouble(){const e=Object.keys(this.troubleActionData);if(e.length>0){const t=e[0],o=this.troubleContainer.troubles.getIndexByKey("byType",t);return o.length>0?o[0]:void 0}}get activeTroubleType(){var e;return(e=this.activeTrouble)==null?void 0:e.type}handleTroubleActions(){const e=this.troubleContainer.troubles.data.reduce((t,o)=>{const i=o.type;if(this.troubleActionData[i]){const s=this.troubleActionData[i].stateKey??i,a=this.troubleActionData[i].stateValue??i;t[s]=a}return t},{});this.state.setValues(e),Object.keys(this.troubleActionData).forEach(t=>{if(this.troubleContainer.troubles.getIndexByKey("byType",t).length===0){const o=this.troubleActionData[t].stateKey??t;this.state[o]=void 0}})}};vs(k,"Registration");Ve([r.kosDependency({modelType:r.TroubleContainer.type})],k.prototype,"troubleContainer",2);Ve([r.kosModelEffect({dependencies:e=>[e.troubleContainer.troubles.data]})],k.prototype,"handleTroubleActions",1);k=Ve([r.kosModel({modelTypeId:fs,singleton:!0}),r.kosLoggerAware()],k);const ms=k.Registration,{URL:to}=r.resolveServiceUrl("START_SERVICE"),{getOne:bs}=r.ServiceFactory.build({basePath:`${to}/api/start`}),_s=r.KosLog.createLogger({name:"start-service",group:"Services"}),oo=async()=>(_s.debug("navigating to NCUI"),await bs({urlOverride:`${to}/api/app/kosdev.ddk/ncui/open`})),Ts=Object.freeze(Object.defineProperty({__proto__:null,navigateToNCui:oo},Symbol.toStringTag,{value:"Module"}));var Ms=Object.defineProperty,Ss=Object.getOwnPropertyDescriptor,ro=(e,t,o,i)=>{for(var s=i>1?void 0:i?Ss(t,o):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,o,s):l(s))||s);return i&&s&&Ms(t,o,s),s};const so="start-model";let pe=class{constructor(e,t,o){n(this,"id");n(this,"logger");n(this,"troubles");this.id=e,this.logger=o.logger}get firmwareFailed(){return this.troubles.troubles.getIndexByKey("byType","FirmwareUpdateFailedTrouble").length>0}get firmwareInProgress(){return this.troubles.troubles.getIndexByKey("byType","FirmwareUpdateInProgressTrouble").length>0}async navigate(){await oo()}async init(){this.logger.debug(`initializing start ${this.id}`)}async load(){this.logger.debug(`loading start ${this.id}`)}};ro([r.kosDependency({modelType:r.TroubleContainer.type})],pe.prototype,"troubles",2);pe=ro([r.kosModel(so)],pe);const ks=new r.SingletonKosModelRegistrationFactory({class:pe,type:so});exports.AgitationControl=Do;exports.Animation=ct;exports.AnimationServices=xo;exports.Application=ye;exports.Auth=ge;exports.AuthServices=co;exports.CarbWater=pt;exports.CopyLogs=Qo;exports.CopyLogsServices=zo;exports.DDKModels=gs;exports.DashboardOperations=fe;exports.DashboardOperationsServices=Xo;exports.Dispenser=St;exports.DispenserInfo=Pt;exports.DispenserInfoServices=gr;exports.DispenserServices=nr;exports.Door=rt;exports.EXTENSION_POINT_DASHBOARD_KEY_FACTORY=T;exports.Enrollment=$t;exports.EnrollmentServices=_r;exports.IngredientSummary=Lt;exports.Lockout=Ir;exports.LockoutServices=wr;exports.MACRO_KEYS=kr;exports.MacroAssignment=Ft;exports.NetworkTest=je;exports.NetworkTestContainer=Nt;exports.NetworkTestServices=Hr;exports.NutritiveSweetener=Wt;exports.PlainWater=Vt;exports.Reboot=Yt;exports.RebootServices=Zr;exports.Settings=Gt;exports.SettingsServices=as;exports.SetupStep=Fe;exports.SetupStepContainer=Ke;exports.SetupStepServices=mo;exports.Start=ks;exports.StartServices=Ts;exports.TROUBLE_TYPE_PRIME=Xe;exports.TROUBLE_TYPE_PURGE=ke;exports.TroubleActionManager=ms;exports.Utilities=He;exports.UtilitiesContainer=Zt;exports.UtilitiesServices=cs;exports.calculateTimeDifference=wt;exports.executeDashboardKeyFactory=Ct;exports.isMacroGroup=Mr;exports.isMicroGroup=Tr;exports.macroHolderMap=Sr;exports.registerDashboardKeyFactory=Ot;exports.toSeconds=$r;exports.toTimeComponents=Pr;exports.troubleVisibilityFilter=Ue;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const kosUiSdk = require("@kosdev-code/kos-ui-sdk");
|
|
4
|
+
const kosFreestyleSdk = require("@kosdev-code/kos-freestyle-sdk");
|
|
5
|
+
const kosDispenseSdk = require("@kosdev-code/kos-dispense-sdk");
|
|
6
|
+
const TROUBLE_TYPE_PURGE$1 = "PurgeTrouble";
|
|
7
|
+
const TROUBLE_TYPE_PRIME$1 = "PrimeTrouble";
|
|
8
|
+
const { URL: URL$d } = kosUiSdk.resolveServiceUrl("AUTH_SERVICE");
|
|
9
|
+
const { getOne: getOne$4, postModel: postModel$4 } = kosUiSdk.ServiceFactory.build({
|
|
10
|
+
basePath: `${URL$d}/api/auth`
|
|
11
|
+
});
|
|
12
|
+
const log$e = kosUiSdk.KosLog.createLogger({ name: "auth-service", group: "Services" });
|
|
13
|
+
const getCurrentRole = async () => {
|
|
14
|
+
log$e.debug("sending GET for auth");
|
|
15
|
+
const response = await getOne$4({
|
|
16
|
+
urlOverride: `${URL$d}/api/app/kosdev.ddk/auth/role`
|
|
17
|
+
});
|
|
18
|
+
return response;
|
|
19
|
+
};
|
|
20
|
+
const sendPinCode = async (pinCode) => {
|
|
21
|
+
log$e.debug("sending POST for auth");
|
|
22
|
+
const response = await postModel$4({
|
|
23
|
+
urlOverride: `${URL$d}/api/app/kosdev.ddk/auth/pincode/${pinCode}`,
|
|
24
|
+
model: {}
|
|
25
|
+
});
|
|
26
|
+
return response;
|
|
27
|
+
};
|
|
28
|
+
const index$d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
29
|
+
__proto__: null,
|
|
30
|
+
getCurrentRole,
|
|
31
|
+
sendPinCode
|
|
32
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
33
|
+
var __defProp$j = Object.defineProperty;
|
|
34
|
+
var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
|
|
35
|
+
var __decorateClass$p = (decorators, target, key, kind) => {
|
|
36
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
|
|
37
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
38
|
+
if (decorator = decorators[i])
|
|
39
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
40
|
+
if (kind && result) __defProp$j(target, key, result);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
const MODEL_TYPE$p = "auth-model";
|
|
44
|
+
const convertAuthResponse = (response) => response.toLowerCase();
|
|
45
|
+
let AuthModelImpl = class {
|
|
46
|
+
id;
|
|
47
|
+
logger;
|
|
48
|
+
currentRole;
|
|
49
|
+
constructor(modelId, options, context) {
|
|
50
|
+
this.id = modelId;
|
|
51
|
+
this.logger = context.logger;
|
|
52
|
+
this.currentRole = "crew";
|
|
53
|
+
}
|
|
54
|
+
async authorize(pinCode) {
|
|
55
|
+
if (!pinCode) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const response = await sendPinCode(pinCode);
|
|
59
|
+
if (response?.status === 200) {
|
|
60
|
+
return response.data;
|
|
61
|
+
} else {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// -------------------LIFECYCLE----------------------------
|
|
66
|
+
async init() {
|
|
67
|
+
this.logger.debug(`initializing auth ${this.id}`);
|
|
68
|
+
}
|
|
69
|
+
async load() {
|
|
70
|
+
this.logger.debug(`loading auth ${this.id}`);
|
|
71
|
+
const response = await getCurrentRole();
|
|
72
|
+
if (response?.status === 200) {
|
|
73
|
+
this.logger.debug(`response ${response.data}`);
|
|
74
|
+
kosUiSdk.kosAction(() => {
|
|
75
|
+
this.currentRole = convertAuthResponse(response.data);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
handleRoleChange(role) {
|
|
80
|
+
this.currentRole = convertAuthResponse(role);
|
|
81
|
+
}
|
|
82
|
+
forceRole(role) {
|
|
83
|
+
this.currentRole = role;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
__decorateClass$p([
|
|
87
|
+
kosUiSdk.kosTopicHandler({
|
|
88
|
+
topic: "/app/kosdev.ddk/auth/role",
|
|
89
|
+
websocket: true
|
|
90
|
+
})
|
|
91
|
+
], AuthModelImpl.prototype, "handleRoleChange", 1);
|
|
92
|
+
AuthModelImpl = __decorateClass$p([
|
|
93
|
+
kosUiSdk.kosModel(MODEL_TYPE$p)
|
|
94
|
+
], AuthModelImpl);
|
|
95
|
+
const Auth = {
|
|
96
|
+
registration: {
|
|
97
|
+
[MODEL_TYPE$p]: {
|
|
98
|
+
class: AuthModelImpl,
|
|
99
|
+
singleton: false
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
type: MODEL_TYPE$p,
|
|
103
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$p),
|
|
104
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$p)
|
|
105
|
+
};
|
|
106
|
+
var __defProp$i = Object.defineProperty;
|
|
107
|
+
var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
|
|
108
|
+
var __decorateClass$o = (decorators, target, key, kind) => {
|
|
109
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
|
|
110
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
111
|
+
if (decorator = decorators[i])
|
|
112
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
113
|
+
if (kind && result) __defProp$i(target, key, result);
|
|
114
|
+
return result;
|
|
115
|
+
};
|
|
116
|
+
const MODEL_TYPE$o = "door-model";
|
|
117
|
+
const PROP_PATH = kosUiSdk.createPropKey("doorPath");
|
|
118
|
+
let DoorModelImpl = class {
|
|
119
|
+
id;
|
|
120
|
+
logger;
|
|
121
|
+
doorPath;
|
|
122
|
+
open;
|
|
123
|
+
ignoreDoor;
|
|
124
|
+
constructor(modelId, options, context) {
|
|
125
|
+
this.id = modelId;
|
|
126
|
+
this.logger = context.logger;
|
|
127
|
+
this.doorPath = options.doorPath;
|
|
128
|
+
}
|
|
129
|
+
get currentState() {
|
|
130
|
+
if (this.open.value === void 0) {
|
|
131
|
+
return "UNKNOWN";
|
|
132
|
+
}
|
|
133
|
+
return this.open.value ? "OPEN" : "CLOSED";
|
|
134
|
+
}
|
|
135
|
+
get isOpen() {
|
|
136
|
+
const value = this.open.value === void 0 ? true : this.open.value;
|
|
137
|
+
const ignore = this.ignoreDoor.value;
|
|
138
|
+
if (ignore) {
|
|
139
|
+
this.logger.debug(
|
|
140
|
+
`Door state is being ignored (treating as closed) due to ignoreDoor config property being true.`
|
|
141
|
+
);
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
__decorateClass$o([
|
|
148
|
+
kosUiSdk.kosStateProp({ path: PROP_PATH, attribute: "state" })
|
|
149
|
+
], DoorModelImpl.prototype, "open", 2);
|
|
150
|
+
__decorateClass$o([
|
|
151
|
+
kosUiSdk.kosConfigProperty({
|
|
152
|
+
path: "app:kosdev.ddk:app",
|
|
153
|
+
attribute: "ncui.ignoreDoorStateOnExit"
|
|
154
|
+
})
|
|
155
|
+
], DoorModelImpl.prototype, "ignoreDoor", 2);
|
|
156
|
+
DoorModelImpl = __decorateClass$o([
|
|
157
|
+
kosUiSdk.kosModel(MODEL_TYPE$o)
|
|
158
|
+
], DoorModelImpl);
|
|
159
|
+
const Door = new kosUiSdk.KosModelRegistrationFactory({
|
|
160
|
+
class: DoorModelImpl,
|
|
161
|
+
type: MODEL_TYPE$o
|
|
162
|
+
});
|
|
163
|
+
const { URL: URL$c } = kosUiSdk.resolveServiceUrl("SETUP-STEP_SERVICE");
|
|
164
|
+
const { getAll: getAll$9, postModel: postModel$3 } = kosUiSdk.ServiceFactory.build({
|
|
165
|
+
basePath: `${URL$c}/api/setup-step`
|
|
166
|
+
});
|
|
167
|
+
const log$d = kosUiSdk.KosLog.createLogger({
|
|
168
|
+
name: "setup-step-service",
|
|
169
|
+
group: "Services"
|
|
170
|
+
});
|
|
171
|
+
const getSetupSteps = async () => {
|
|
172
|
+
log$d.debug("sending GET for setup-step");
|
|
173
|
+
const response = await getAll$9({
|
|
174
|
+
urlOverride: `${URL$c}/api/app/kosdev.ddk/setup/steps`
|
|
175
|
+
});
|
|
176
|
+
return response;
|
|
177
|
+
};
|
|
178
|
+
const markStepComplete = async (stepId) => {
|
|
179
|
+
log$d.debug("sending POST for setup-step");
|
|
180
|
+
const response = await postModel$3({
|
|
181
|
+
urlOverride: `${URL$c}/api/app/kosdev.ddk/setup/complete/${stepId}`,
|
|
182
|
+
model: {}
|
|
183
|
+
});
|
|
184
|
+
return response;
|
|
185
|
+
};
|
|
186
|
+
const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
187
|
+
__proto__: null,
|
|
188
|
+
getSetupSteps,
|
|
189
|
+
markStepComplete
|
|
190
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
191
|
+
var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
|
|
192
|
+
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
193
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
|
|
194
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
195
|
+
if (decorator = decorators[i])
|
|
196
|
+
result = decorator(result) || result;
|
|
197
|
+
return result;
|
|
198
|
+
};
|
|
199
|
+
const MODEL_TYPE$n = "setup-step-model";
|
|
200
|
+
let SetupStepModelImpl = class {
|
|
201
|
+
id;
|
|
202
|
+
idx;
|
|
203
|
+
name;
|
|
204
|
+
complete;
|
|
205
|
+
preStep;
|
|
206
|
+
exclusive;
|
|
207
|
+
logger;
|
|
208
|
+
constructor(modelId, options, context) {
|
|
209
|
+
this.id = modelId;
|
|
210
|
+
this.idx = options.idx;
|
|
211
|
+
this.logger = context.logger;
|
|
212
|
+
this.name = options.name;
|
|
213
|
+
this.complete = options.complete;
|
|
214
|
+
this.preStep = options.preStep;
|
|
215
|
+
this.exclusive = options.exclusive;
|
|
216
|
+
}
|
|
217
|
+
updateModel(options) {
|
|
218
|
+
this.name = options.name;
|
|
219
|
+
this.idx = options.idx;
|
|
220
|
+
this.complete = options.complete;
|
|
221
|
+
this.preStep = options.preStep;
|
|
222
|
+
this.exclusive = options.exclusive;
|
|
223
|
+
}
|
|
224
|
+
get titleKey() {
|
|
225
|
+
return `setup.${this.name}.title`;
|
|
226
|
+
}
|
|
227
|
+
get bodyKey() {
|
|
228
|
+
return `setup.${this.name}.body`;
|
|
229
|
+
}
|
|
230
|
+
async completeStep() {
|
|
231
|
+
const response = await markStepComplete(this.name);
|
|
232
|
+
if (response?.status === 200) {
|
|
233
|
+
kosUiSdk.kosAction(() => {
|
|
234
|
+
this.complete = true;
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
// -------------------LIFECYCLE----------------------------
|
|
239
|
+
async init() {
|
|
240
|
+
this.logger.debug(`initializing setup-step ${this.id}`);
|
|
241
|
+
}
|
|
242
|
+
async load() {
|
|
243
|
+
this.logger.debug(`loading setup-step ${this.id}`);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
SetupStepModelImpl = __decorateClass$n([
|
|
247
|
+
kosUiSdk.kosModel(MODEL_TYPE$n)
|
|
248
|
+
], SetupStepModelImpl);
|
|
249
|
+
const SetupStep = {
|
|
250
|
+
registration: {
|
|
251
|
+
[MODEL_TYPE$n]: {
|
|
252
|
+
class: SetupStepModelImpl,
|
|
253
|
+
singleton: false
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
type: MODEL_TYPE$n,
|
|
257
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$n),
|
|
258
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$n)
|
|
259
|
+
};
|
|
260
|
+
var __defProp$h = Object.defineProperty;
|
|
261
|
+
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
262
|
+
var __decorateClass$m = (decorators, target, key, kind) => {
|
|
263
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
264
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
265
|
+
if (decorator = decorators[i])
|
|
266
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
267
|
+
if (kind && result) __defProp$h(target, key, result);
|
|
268
|
+
return result;
|
|
269
|
+
};
|
|
270
|
+
const MODEL_TYPE$m = "setup-step-container-model";
|
|
271
|
+
function addStep(container) {
|
|
272
|
+
return (step) => {
|
|
273
|
+
const model = SetupStep.factory(step.id)(step);
|
|
274
|
+
model.updateModel(step);
|
|
275
|
+
container.addModel(model);
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function removeStep(container) {
|
|
279
|
+
return (id) => {
|
|
280
|
+
container.removeModel(id);
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
let SetupStepContainerModelImpl = class {
|
|
284
|
+
id;
|
|
285
|
+
_currentStep;
|
|
286
|
+
logger;
|
|
287
|
+
models;
|
|
288
|
+
authModel;
|
|
289
|
+
constructor(modelId, options, context) {
|
|
290
|
+
this.id = modelId;
|
|
291
|
+
this.logger = context.logger;
|
|
292
|
+
this._currentStep = void 0;
|
|
293
|
+
this.models = new kosUiSdk.KosModelContainer({
|
|
294
|
+
parentId: modelId,
|
|
295
|
+
sortKey: "idx"
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
get currentStep() {
|
|
299
|
+
return this._currentStep;
|
|
300
|
+
}
|
|
301
|
+
setCurrentStep(id) {
|
|
302
|
+
const step = this.models.getModel(id);
|
|
303
|
+
if (step) {
|
|
304
|
+
this._currentStep = step;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
nextStep() {
|
|
308
|
+
if (!this._currentStep) {
|
|
309
|
+
this._currentStep = this.firstIncompleteStep;
|
|
310
|
+
} else {
|
|
311
|
+
const currentIdx = this._currentStep.idx;
|
|
312
|
+
const nextStep = this.models.data.find((step) => step.idx > currentIdx);
|
|
313
|
+
if (nextStep) {
|
|
314
|
+
this._currentStep = nextStep;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
get hasIncompletePreSteps() {
|
|
319
|
+
return this.models.data.some((step) => step.preStep && !step.complete);
|
|
320
|
+
}
|
|
321
|
+
get setupRequired() {
|
|
322
|
+
return this.models.data.some((step) => !step.complete);
|
|
323
|
+
}
|
|
324
|
+
get firstIncompleteStep() {
|
|
325
|
+
return this.models.data.find((step) => !step.complete);
|
|
326
|
+
}
|
|
327
|
+
get isLastStep() {
|
|
328
|
+
return this.models.data[this.models.data.length - 1].id === this._currentStep?.id;
|
|
329
|
+
}
|
|
330
|
+
get data() {
|
|
331
|
+
return this.models.data;
|
|
332
|
+
}
|
|
333
|
+
getModel(id) {
|
|
334
|
+
return this.models.getModel(id);
|
|
335
|
+
}
|
|
336
|
+
addModel(model) {
|
|
337
|
+
this.models.addModel(model);
|
|
338
|
+
}
|
|
339
|
+
removeModel(id) {
|
|
340
|
+
this.models.removeModel(id);
|
|
341
|
+
}
|
|
342
|
+
// -------------------LIFECYCLE----------------------------
|
|
343
|
+
async init() {
|
|
344
|
+
this.logger.debug(`initializing setup-step-container container ${this.id}`);
|
|
345
|
+
}
|
|
346
|
+
async load() {
|
|
347
|
+
this.logger.debug(`loading setup-step-container container ${this.id}`);
|
|
348
|
+
const response = await getSetupSteps();
|
|
349
|
+
if (response?.data) {
|
|
350
|
+
const identifiableSteps = response.data.map(
|
|
351
|
+
(step, index2) => {
|
|
352
|
+
return {
|
|
353
|
+
...step,
|
|
354
|
+
idx: index2,
|
|
355
|
+
id: `setup-${step.name}`
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
);
|
|
359
|
+
kosUiSdk.resolveContainerDeltas({
|
|
360
|
+
container: this.models,
|
|
361
|
+
onAddItem: addStep(this),
|
|
362
|
+
onRemoveItem: removeStep(this)
|
|
363
|
+
})(identifiableSteps);
|
|
364
|
+
}
|
|
365
|
+
this.nextStep();
|
|
366
|
+
}
|
|
367
|
+
handleStepChanges(steps) {
|
|
368
|
+
const identifiableSteps = steps.map((step, index2) => {
|
|
369
|
+
return {
|
|
370
|
+
...step,
|
|
371
|
+
idx: index2,
|
|
372
|
+
id: `setup-${step.name}`
|
|
373
|
+
};
|
|
374
|
+
});
|
|
375
|
+
kosUiSdk.resolveContainerDeltas({
|
|
376
|
+
container: this.models,
|
|
377
|
+
onAddItem: addStep(this),
|
|
378
|
+
onRemoveItem: removeStep(this)
|
|
379
|
+
})(identifiableSteps);
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
__decorateClass$m([
|
|
383
|
+
kosUiSdk.kosChild
|
|
384
|
+
], SetupStepContainerModelImpl.prototype, "models", 2);
|
|
385
|
+
__decorateClass$m([
|
|
386
|
+
kosUiSdk.kosDependency({ modelType: Auth.type })
|
|
387
|
+
], SetupStepContainerModelImpl.prototype, "authModel", 2);
|
|
388
|
+
__decorateClass$m([
|
|
389
|
+
kosUiSdk.kosTopicHandler({
|
|
390
|
+
topic: "/app/kosdev.ddk/setup/steps",
|
|
391
|
+
websocket: true
|
|
392
|
+
})
|
|
393
|
+
], SetupStepContainerModelImpl.prototype, "handleStepChanges", 1);
|
|
394
|
+
SetupStepContainerModelImpl = __decorateClass$m([
|
|
395
|
+
kosUiSdk.kosModel(MODEL_TYPE$m)
|
|
396
|
+
], SetupStepContainerModelImpl);
|
|
397
|
+
const SetupStepContainer = {
|
|
398
|
+
registration: {
|
|
399
|
+
[MODEL_TYPE$m]: {
|
|
400
|
+
class: SetupStepContainerModelImpl,
|
|
401
|
+
singleton: true
|
|
402
|
+
},
|
|
403
|
+
...SetupStep.registration
|
|
404
|
+
},
|
|
405
|
+
type: MODEL_TYPE$m,
|
|
406
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$m),
|
|
407
|
+
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$m)
|
|
408
|
+
};
|
|
409
|
+
const { URL: URL$b } = kosUiSdk.resolveServiceUrl("AUTH_SERVICE");
|
|
410
|
+
const { getOne: getOne$3, getAll: getAll$8 } = kosUiSdk.ServiceFactory.build({
|
|
411
|
+
basePath: `${URL$b}/api/app/kosdev.ddk/ncui/`
|
|
412
|
+
});
|
|
413
|
+
const log$c = kosUiSdk.KosLog.createLogger({ name: "auth-service", group: "Services" });
|
|
414
|
+
const getCuis = async () => {
|
|
415
|
+
log$c.debug("sending GET for cuis");
|
|
416
|
+
const response = await getAll$8({
|
|
417
|
+
urlOverride: `${URL$b}/api/app/kosdev.ddk/cui`
|
|
418
|
+
});
|
|
419
|
+
if (response?.status !== 200) {
|
|
420
|
+
throw new Error("Failed to retrieve cuis");
|
|
421
|
+
}
|
|
422
|
+
return response.data;
|
|
423
|
+
};
|
|
424
|
+
const getNavigation = async () => {
|
|
425
|
+
log$c.debug("sending GET for navigation");
|
|
426
|
+
try {
|
|
427
|
+
const extensionResponse = await getAll$8({
|
|
428
|
+
urlOverride: `${URL$b}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.navigations`
|
|
429
|
+
});
|
|
430
|
+
if (extensionResponse?.status !== 200) {
|
|
431
|
+
log$c.info(`no extensions found, using base data`);
|
|
432
|
+
const response = await getAll$8({
|
|
433
|
+
urlOverride: `${URL$b}/api/kos/descriptor/system:app/kondra.ncui.navigations`
|
|
434
|
+
});
|
|
435
|
+
return response?.data ?? [];
|
|
436
|
+
}
|
|
437
|
+
return extensionResponse?.data ?? [];
|
|
438
|
+
} catch (error) {
|
|
439
|
+
const response = await getAll$8({
|
|
440
|
+
urlOverride: `${URL$b}/api/kos/descriptor/system:app/kondra.ncui.navigations`
|
|
441
|
+
});
|
|
442
|
+
return response?.data ?? [];
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
const navigateToCui = async () => {
|
|
446
|
+
log$c.debug("navigating to CUI");
|
|
447
|
+
const response = await getOne$3({
|
|
448
|
+
urlOverride: `${URL$b}/api/app/kosdev.ddk/cui/open`
|
|
449
|
+
});
|
|
450
|
+
return response;
|
|
451
|
+
};
|
|
452
|
+
const navigateToNCui$1 = async () => {
|
|
453
|
+
log$c.debug("navigating to NCUI");
|
|
454
|
+
const response = await getOne$3({
|
|
455
|
+
urlOverride: `${URL$b}/api/app/kosdev.ddk/ncui/open`
|
|
456
|
+
});
|
|
457
|
+
return response;
|
|
458
|
+
};
|
|
459
|
+
var __defProp$g = Object.defineProperty;
|
|
460
|
+
var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
|
|
461
|
+
var __decorateClass$l = (decorators, target, key, kind) => {
|
|
462
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
|
|
463
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
464
|
+
if (decorator = decorators[i])
|
|
465
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
466
|
+
if (kind && result) __defProp$g(target, key, result);
|
|
467
|
+
return result;
|
|
468
|
+
};
|
|
469
|
+
const MODEL_TYPE$l = "application-model";
|
|
470
|
+
const flattenNavigationItems = (items, path = "") => items.reduce((acc, item) => {
|
|
471
|
+
const itemPath = path ? `${path}.${item.name}` : item.name;
|
|
472
|
+
acc[itemPath] = { ...item, root: !path };
|
|
473
|
+
if (item.children) {
|
|
474
|
+
const childItems = flattenNavigationItems(item.children, itemPath);
|
|
475
|
+
Object.keys(childItems).forEach((key) => {
|
|
476
|
+
acc[key] = childItems[key];
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
return acc;
|
|
480
|
+
}, {});
|
|
481
|
+
let ApplicationModelImpl = class {
|
|
482
|
+
id;
|
|
483
|
+
device;
|
|
484
|
+
authModel;
|
|
485
|
+
setupStepContainer;
|
|
486
|
+
door;
|
|
487
|
+
ncuiLanguage;
|
|
488
|
+
activeCui;
|
|
489
|
+
fallbackCui;
|
|
490
|
+
_cuis = [];
|
|
491
|
+
_navigationItems = [];
|
|
492
|
+
// @kosConfigProperty({
|
|
493
|
+
// path: 'somewhere.enable.dial.animation',
|
|
494
|
+
// attribute: 'enableDialAnimation',
|
|
495
|
+
// })
|
|
496
|
+
// enableDialAnimation!: KosConfigProperty<boolean>;
|
|
497
|
+
// @kosConfigProperty({
|
|
498
|
+
// path: 'somewhere.enable.modal.animation',
|
|
499
|
+
// attribute: 'enableModalAnimation',
|
|
500
|
+
// })
|
|
501
|
+
// enableModalAnimation!: KosConfigProperty<boolean>;
|
|
502
|
+
// @kosConfigProperty({
|
|
503
|
+
// path: 'somewhere.enable.sidebar.animation',
|
|
504
|
+
// attribute: 'enableSidebarAnimation',
|
|
505
|
+
// })
|
|
506
|
+
// enableSidebarAnimation!: KosConfigProperty<boolean>;
|
|
507
|
+
languages;
|
|
508
|
+
logger;
|
|
509
|
+
constructor(modelId, _options, context) {
|
|
510
|
+
this.id = modelId;
|
|
511
|
+
this.languages = [];
|
|
512
|
+
this._cuis = [];
|
|
513
|
+
this.logger = context.logger;
|
|
514
|
+
this.door = Door.instance("app:kosdev.ddk:service:door:door").options({
|
|
515
|
+
doorPath: "app:kosdev.ddk:service:door:door"
|
|
516
|
+
}).build();
|
|
517
|
+
}
|
|
518
|
+
get setupRequired() {
|
|
519
|
+
return this.authModel.currentRole === "crew" ? false : this.setupStepContainer.setupRequired;
|
|
520
|
+
}
|
|
521
|
+
get currentRole() {
|
|
522
|
+
return this.authModel.currentRole;
|
|
523
|
+
}
|
|
524
|
+
get cuis() {
|
|
525
|
+
return this._cuis.reduce((acc, cui) => {
|
|
526
|
+
acc[cui.appId] = cui;
|
|
527
|
+
return acc;
|
|
528
|
+
}, {});
|
|
529
|
+
}
|
|
530
|
+
get navigationItems() {
|
|
531
|
+
return flattenNavigationItems(this._navigationItems);
|
|
532
|
+
}
|
|
533
|
+
get hasCuiDefined() {
|
|
534
|
+
return !!this.activeCui.value || !!this.fallbackCui.value;
|
|
535
|
+
}
|
|
536
|
+
get doorIsOpen() {
|
|
537
|
+
return this.door.isOpen;
|
|
538
|
+
}
|
|
539
|
+
async enter() {
|
|
540
|
+
this.logger.info("navigating to NCUI");
|
|
541
|
+
await navigateToNCui$1();
|
|
542
|
+
}
|
|
543
|
+
async exit() {
|
|
544
|
+
this.logger.info("navigating to CUI");
|
|
545
|
+
await navigateToCui();
|
|
546
|
+
}
|
|
547
|
+
// -------------------LIFECYCLE----------------------------
|
|
548
|
+
async load() {
|
|
549
|
+
this.logger.debug(`loading application ${this.id}`);
|
|
550
|
+
const navigationItems = await getNavigation();
|
|
551
|
+
this._navigationItems = navigationItems;
|
|
552
|
+
const cuis = await getCuis();
|
|
553
|
+
this._cuis = cuis;
|
|
554
|
+
if (this.setupStepContainer?.hasIncompletePreSteps) {
|
|
555
|
+
this.authModel?.forceRole("technician");
|
|
556
|
+
}
|
|
557
|
+
this.languages = [
|
|
558
|
+
{
|
|
559
|
+
name: "English",
|
|
560
|
+
locale: "en"
|
|
561
|
+
}
|
|
562
|
+
];
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
__decorateClass$l([
|
|
566
|
+
kosUiSdk.kosDependency({ modelType: kosUiSdk.Device.type })
|
|
567
|
+
], ApplicationModelImpl.prototype, "device", 2);
|
|
568
|
+
__decorateClass$l([
|
|
569
|
+
kosUiSdk.kosDependency({ modelType: Auth.type })
|
|
570
|
+
], ApplicationModelImpl.prototype, "authModel", 2);
|
|
571
|
+
__decorateClass$l([
|
|
572
|
+
kosUiSdk.kosDependency({ modelType: SetupStepContainer.type })
|
|
573
|
+
], ApplicationModelImpl.prototype, "setupStepContainer", 2);
|
|
574
|
+
__decorateClass$l([
|
|
575
|
+
kosUiSdk.kosChild
|
|
576
|
+
], ApplicationModelImpl.prototype, "door", 2);
|
|
577
|
+
__decorateClass$l([
|
|
578
|
+
kosUiSdk.kosConfigProperty({
|
|
579
|
+
path: "app:kosdev.ddk:app",
|
|
580
|
+
attribute: "ncui.ncuiLanguage"
|
|
581
|
+
//updated attribute for language config property
|
|
582
|
+
})
|
|
583
|
+
], ApplicationModelImpl.prototype, "ncuiLanguage", 2);
|
|
584
|
+
__decorateClass$l([
|
|
585
|
+
kosUiSdk.kosConfigProperty({
|
|
586
|
+
path: "app:kosdev.ddk:service:cui",
|
|
587
|
+
attribute: "activeCui"
|
|
588
|
+
})
|
|
589
|
+
], ApplicationModelImpl.prototype, "activeCui", 2);
|
|
590
|
+
__decorateClass$l([
|
|
591
|
+
kosUiSdk.kosConfigProperty({
|
|
592
|
+
path: "app:kosdev.ddk:service:cui",
|
|
593
|
+
attribute: "fallbackCui"
|
|
594
|
+
})
|
|
595
|
+
], ApplicationModelImpl.prototype, "fallbackCui", 2);
|
|
596
|
+
ApplicationModelImpl = __decorateClass$l([
|
|
597
|
+
kosUiSdk.kosModel(MODEL_TYPE$l)
|
|
598
|
+
], ApplicationModelImpl);
|
|
599
|
+
const Application = {
|
|
600
|
+
registration: {
|
|
601
|
+
[MODEL_TYPE$l]: {
|
|
602
|
+
class: ApplicationModelImpl,
|
|
603
|
+
singleton: true
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
type: MODEL_TYPE$l,
|
|
607
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$l),
|
|
608
|
+
factory: kosUiSdk.Kos.Singleton.create(
|
|
609
|
+
MODEL_TYPE$l
|
|
610
|
+
)
|
|
611
|
+
};
|
|
612
|
+
const RoleMap = {
|
|
613
|
+
none: 999,
|
|
614
|
+
crew: 0,
|
|
615
|
+
technician: 1,
|
|
616
|
+
manager: 2
|
|
617
|
+
};
|
|
618
|
+
const troubleVisibilityFilter = (currentRole) => (trouble) => {
|
|
619
|
+
if (trouble.type === kosFreestyleSdk.AGITATION_REQUIRED_TROUBLE) {
|
|
620
|
+
return false;
|
|
621
|
+
}
|
|
622
|
+
const visibleRole = trouble?.role || "technician";
|
|
623
|
+
if (currentRole && visibleRole) {
|
|
624
|
+
const currentRoleIndex = RoleMap[currentRole.toLowerCase()] ?? RoleMap["crew"];
|
|
625
|
+
const visibleRoleIndex = RoleMap[visibleRole.toLowerCase()] ?? RoleMap["crew"];
|
|
626
|
+
return currentRoleIndex >= visibleRoleIndex;
|
|
627
|
+
}
|
|
628
|
+
return false;
|
|
629
|
+
};
|
|
630
|
+
var __defProp$f = Object.defineProperty;
|
|
631
|
+
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
632
|
+
var __decorateClass$k = (decorators, target, key, kind) => {
|
|
633
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
|
|
634
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
635
|
+
if (decorator = decorators[i])
|
|
636
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
637
|
+
if (kind && result) __defProp$f(target, key, result);
|
|
638
|
+
return result;
|
|
639
|
+
};
|
|
640
|
+
const MODEL_TYPE$k = "agitation-control-model";
|
|
641
|
+
const FUTURE_RESOLVE = "resolve";
|
|
642
|
+
const FUTURE_AGITATE = "agitate";
|
|
643
|
+
let AgitationControlModelImpl = class {
|
|
644
|
+
id;
|
|
645
|
+
futureHandler;
|
|
646
|
+
logger;
|
|
647
|
+
troubleContainer;
|
|
648
|
+
_agitationFutureId;
|
|
649
|
+
_canExit = true;
|
|
650
|
+
_exiting = false;
|
|
651
|
+
_isFailed = false;
|
|
652
|
+
disposer;
|
|
653
|
+
application;
|
|
654
|
+
constructor(modelId, options, context) {
|
|
655
|
+
this.id = modelId;
|
|
656
|
+
this.logger = context.logger;
|
|
657
|
+
this.troubleContainer = options.companionParent;
|
|
658
|
+
this.futureHandler = new kosUiSdk.MultipleFutureHandler(this, FUTURE_RESOLVE);
|
|
659
|
+
}
|
|
660
|
+
set isFailed(value) {
|
|
661
|
+
this._isFailed = value;
|
|
662
|
+
}
|
|
663
|
+
get isFailed() {
|
|
664
|
+
return this._isFailed;
|
|
665
|
+
}
|
|
666
|
+
get isDoorClosed() {
|
|
667
|
+
return !this.application.doorIsOpen;
|
|
668
|
+
}
|
|
669
|
+
get isAgitating() {
|
|
670
|
+
return !!this._agitationFutureId;
|
|
671
|
+
}
|
|
672
|
+
set exiting(value) {
|
|
673
|
+
this._exiting = value;
|
|
674
|
+
}
|
|
675
|
+
get exiting() {
|
|
676
|
+
return this._exiting;
|
|
677
|
+
}
|
|
678
|
+
get canExit() {
|
|
679
|
+
const allDeferredCount = this.queuedTroubles.length;
|
|
680
|
+
return allDeferredCount === 0 && this._canExit;
|
|
681
|
+
}
|
|
682
|
+
clearAll() {
|
|
683
|
+
this.queuedTroubles.forEach((trouble) => {
|
|
684
|
+
trouble.clearDefer();
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
get readyToResolve() {
|
|
688
|
+
const allDeferredCount = this.queuedTroubles.length;
|
|
689
|
+
const notResolvable = this.queuedTroubles.filter((t) => t.shouldDefer);
|
|
690
|
+
const _readyToResolve = allDeferredCount > 0 && notResolvable.length === 0;
|
|
691
|
+
return this.isDoorClosed && _readyToResolve && this.exiting;
|
|
692
|
+
}
|
|
693
|
+
onFutureUpdate(future) {
|
|
694
|
+
if (future.endState === kosUiSdk.FutureEndState.Success) {
|
|
695
|
+
this.logger.debug(
|
|
696
|
+
`Resolve deferred troubles future ${future.id} completed successfully`
|
|
697
|
+
);
|
|
698
|
+
this.queuedTroubles.forEach((trouble) => {
|
|
699
|
+
trouble.clearDefer();
|
|
700
|
+
});
|
|
701
|
+
kosUiSdk.kosAction(() => {
|
|
702
|
+
this._canExit = true;
|
|
703
|
+
this._isFailed = false;
|
|
704
|
+
});
|
|
705
|
+
} else if (future.endState === kosUiSdk.FutureEndState.Fail || future.endState === kosUiSdk.FutureEndState.Canceled || future.endState === kosUiSdk.FutureEndState.Aborted) {
|
|
706
|
+
this.logger.error(`Resolve deferred troubles future ${future.id} failed`);
|
|
707
|
+
this.clearAll();
|
|
708
|
+
kosUiSdk.kosAction(() => {
|
|
709
|
+
this._canExit = false;
|
|
710
|
+
this._isFailed = true;
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
inProgress = [];
|
|
715
|
+
async resolveDeferredTroubles(tracker) {
|
|
716
|
+
const toResolve = this.queuedTroubles.filter((t) => !t.shouldDefer).map((trouble) => trouble.rawId).filter((id) => !this.inProgress.includes(id));
|
|
717
|
+
this.inProgress.push(...toResolve);
|
|
718
|
+
if (toResolve.length === 0) {
|
|
719
|
+
return void 0;
|
|
720
|
+
}
|
|
721
|
+
const response = await kosUiSdk.TroubleServices.bulkResolveTroubles(
|
|
722
|
+
toResolve,
|
|
723
|
+
void 0,
|
|
724
|
+
tracker
|
|
725
|
+
);
|
|
726
|
+
return response;
|
|
727
|
+
}
|
|
728
|
+
get hasQueuedTroubles() {
|
|
729
|
+
return this.queuedTroubles.length > 0;
|
|
730
|
+
}
|
|
731
|
+
get queuedTroubles() {
|
|
732
|
+
return this.troubleContainer.troubles.getIndexByKey(
|
|
733
|
+
kosUiSdk.Troubles.INDEX_TROUBLES_BY_DEFERRED,
|
|
734
|
+
kosUiSdk.Troubles.TROUBLES_DEFERRED
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
get visibleTroubles() {
|
|
738
|
+
const currentRole = this.application.currentRole;
|
|
739
|
+
return this.troubleContainer.troubles.data.filter(troubleVisibilityFilter(currentRole)).filter((trouble) => trouble.type !== kosFreestyleSdk.AGITATION_REQUIRED_TROUBLE);
|
|
740
|
+
}
|
|
741
|
+
// -------------------LIFECYCLE----------------------------
|
|
742
|
+
get future() {
|
|
743
|
+
return this.futureHandler.future;
|
|
744
|
+
}
|
|
745
|
+
get resolveFuture() {
|
|
746
|
+
return this.futureHandler.getFuture(FUTURE_RESOLVE);
|
|
747
|
+
}
|
|
748
|
+
get agitateFuture() {
|
|
749
|
+
return this.futureHandler.getFuture(FUTURE_AGITATE);
|
|
750
|
+
}
|
|
751
|
+
handleAgitationStarted(event) {
|
|
752
|
+
this.logger.info(`Agitation started for ${event.path}`);
|
|
753
|
+
this._agitationFutureId = String(event.futureId);
|
|
754
|
+
}
|
|
755
|
+
handleAgitationEnded(event) {
|
|
756
|
+
this.logger.info(`Agitation ended for ${event.path}`);
|
|
757
|
+
this._agitationFutureId = void 0;
|
|
758
|
+
}
|
|
759
|
+
async init() {
|
|
760
|
+
this.logger.debug(`initializing agitation-control ${this.id}`);
|
|
761
|
+
}
|
|
762
|
+
unload() {
|
|
763
|
+
this.logger.debug(`unloading agitation-control ${this.id}`);
|
|
764
|
+
if (this.disposer) {
|
|
765
|
+
this.disposer();
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
handleReadyToResolve() {
|
|
769
|
+
if (this.readyToResolve) {
|
|
770
|
+
this.logger.info(`AgitationControl - Resolving deferred troubles`);
|
|
771
|
+
this.resolveDeferredTroubles();
|
|
772
|
+
}
|
|
773
|
+
if (this._agitationFutureId) {
|
|
774
|
+
this.logger.info(`AgitationControl - Agitation started`);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
async load() {
|
|
778
|
+
this.logger.debug(`loading agitation-control ${this.id}`);
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
__decorateClass$k([
|
|
782
|
+
kosUiSdk.kosDependency({ modelType: Application.type })
|
|
783
|
+
], AgitationControlModelImpl.prototype, "application", 2);
|
|
784
|
+
__decorateClass$k([
|
|
785
|
+
kosUiSdk.kosFuture({ alias: FUTURE_RESOLVE })
|
|
786
|
+
], AgitationControlModelImpl.prototype, "resolveDeferredTroubles", 1);
|
|
787
|
+
__decorateClass$k([
|
|
788
|
+
kosUiSdk.kosTopicHandler({ topic: kosFreestyleSdk.CartridgeAgitatorEvents.TOPIC_AGITATION_STARTED })
|
|
789
|
+
], AgitationControlModelImpl.prototype, "handleAgitationStarted", 1);
|
|
790
|
+
__decorateClass$k([
|
|
791
|
+
kosUiSdk.kosTopicHandler({ topic: kosFreestyleSdk.CartridgeAgitatorEvents.TOPIC_AGITATION_ENDED })
|
|
792
|
+
], AgitationControlModelImpl.prototype, "handleAgitationEnded", 1);
|
|
793
|
+
__decorateClass$k([
|
|
794
|
+
kosUiSdk.kosModelEffect({
|
|
795
|
+
dependencies: (model) => [model.readyToResolve, model._agitationFutureId]
|
|
796
|
+
})
|
|
797
|
+
], AgitationControlModelImpl.prototype, "handleReadyToResolve", 1);
|
|
798
|
+
AgitationControlModelImpl = __decorateClass$k([
|
|
799
|
+
kosUiSdk.kosModel(MODEL_TYPE$k)
|
|
800
|
+
], AgitationControlModelImpl);
|
|
801
|
+
const AgitationControl = new kosUiSdk.SingletonKosModelRegistrationFactory({
|
|
802
|
+
class: AgitationControlModelImpl,
|
|
803
|
+
type: MODEL_TYPE$k
|
|
804
|
+
});
|
|
805
|
+
var __defProp$e = Object.defineProperty;
|
|
806
|
+
var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
|
|
807
|
+
var __decorateClass$j = (decorators, target, key, kind) => {
|
|
808
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
|
|
809
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
810
|
+
if (decorator = decorators[i])
|
|
811
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
812
|
+
if (kind && result) __defProp$e(target, key, result);
|
|
813
|
+
return result;
|
|
814
|
+
};
|
|
815
|
+
const MODEL_TYPE$j = "animation-model";
|
|
816
|
+
let AnimationModelImpl = class {
|
|
817
|
+
id;
|
|
818
|
+
logger;
|
|
819
|
+
disableAll;
|
|
820
|
+
enableDial;
|
|
821
|
+
enableModal;
|
|
822
|
+
enableSideBar;
|
|
823
|
+
constructor(modelId, options, context) {
|
|
824
|
+
this.id = modelId;
|
|
825
|
+
this.logger = context.logger;
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
__decorateClass$j([
|
|
829
|
+
kosUiSdk.kosConfigProperty({
|
|
830
|
+
path: "app:kosdev.ddk:app",
|
|
831
|
+
attribute: "ncui.uiConfig.animations.disableAll"
|
|
832
|
+
})
|
|
833
|
+
], AnimationModelImpl.prototype, "disableAll", 2);
|
|
834
|
+
__decorateClass$j([
|
|
835
|
+
kosUiSdk.kosConfigProperty({
|
|
836
|
+
path: "app:kosdev.ddk:app",
|
|
837
|
+
attribute: "ncui.uiConfig.animations.enableDial"
|
|
838
|
+
})
|
|
839
|
+
], AnimationModelImpl.prototype, "enableDial", 2);
|
|
840
|
+
__decorateClass$j([
|
|
841
|
+
kosUiSdk.kosConfigProperty({
|
|
842
|
+
path: "app:kosdev.ddk:app",
|
|
843
|
+
attribute: "ncui.uiConfig.animations.enableModal"
|
|
844
|
+
})
|
|
845
|
+
], AnimationModelImpl.prototype, "enableModal", 2);
|
|
846
|
+
__decorateClass$j([
|
|
847
|
+
kosUiSdk.kosConfigProperty({
|
|
848
|
+
path: "app:kosdev.ddk:app",
|
|
849
|
+
attribute: "ncui.uiConfig.animations.enableSideBar"
|
|
850
|
+
})
|
|
851
|
+
], AnimationModelImpl.prototype, "enableSideBar", 2);
|
|
852
|
+
AnimationModelImpl = __decorateClass$j([
|
|
853
|
+
kosUiSdk.kosModel(MODEL_TYPE$j)
|
|
854
|
+
], AnimationModelImpl);
|
|
855
|
+
const Animation = {
|
|
856
|
+
registration: {
|
|
857
|
+
[MODEL_TYPE$j]: {
|
|
858
|
+
class: AnimationModelImpl,
|
|
859
|
+
singleton: true
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
type: MODEL_TYPE$j,
|
|
863
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$j),
|
|
864
|
+
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$j)
|
|
865
|
+
};
|
|
866
|
+
const { URL: URL$a } = kosUiSdk.resolveServiceUrl("ANIMATION_SERVICE");
|
|
867
|
+
const { getAll: getAll$7 } = kosUiSdk.ServiceFactory.build({
|
|
868
|
+
basePath: `${URL$a}/api/animation`
|
|
869
|
+
});
|
|
870
|
+
const log$b = kosUiSdk.KosLog.createLogger({
|
|
871
|
+
name: "animation-service",
|
|
872
|
+
group: "Services"
|
|
873
|
+
});
|
|
874
|
+
const getAnimations = async () => {
|
|
875
|
+
log$b.debug("sending GET for animation");
|
|
876
|
+
const response = await getAll$7({});
|
|
877
|
+
return response;
|
|
878
|
+
};
|
|
879
|
+
const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
880
|
+
__proto__: null,
|
|
881
|
+
getAnimations
|
|
882
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
883
|
+
var __defProp$d = Object.defineProperty;
|
|
884
|
+
var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
|
|
885
|
+
var __decorateClass$i = (decorators, target, key, kind) => {
|
|
886
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
|
|
887
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
888
|
+
if (decorator = decorators[i])
|
|
889
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
890
|
+
if (kind && result) __defProp$d(target, key, result);
|
|
891
|
+
return result;
|
|
892
|
+
};
|
|
893
|
+
const MODEL_TYPE$i = "carb-water-model";
|
|
894
|
+
let CarbWaterModelImpl = class {
|
|
895
|
+
id;
|
|
896
|
+
assemblyModel;
|
|
897
|
+
logger;
|
|
898
|
+
constructor(modelId, _options, context) {
|
|
899
|
+
this.id = modelId;
|
|
900
|
+
this.logger = context.logger;
|
|
901
|
+
}
|
|
902
|
+
getPump() {
|
|
903
|
+
const carbHolder = this.assemblyModel.getHoldersByGroup("carb")[0];
|
|
904
|
+
const pump = carbHolder.pumps.data[0];
|
|
905
|
+
const model = kosUiSdk.getKosCompanionModel(pump, kosFreestyleSdk.FcmPump.type);
|
|
906
|
+
return model;
|
|
907
|
+
}
|
|
908
|
+
// -------------------LIFECYCLE----------------------------
|
|
909
|
+
async init() {
|
|
910
|
+
this.logger.debug(`initializing carb-water ${this.id}`);
|
|
911
|
+
}
|
|
912
|
+
async load() {
|
|
913
|
+
this.logger.debug(`loading carb-water ${this.id}`);
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
__decorateClass$i([
|
|
917
|
+
kosUiSdk.kosDependency({ modelType: kosDispenseSdk.Assembly.type })
|
|
918
|
+
], CarbWaterModelImpl.prototype, "assemblyModel", 2);
|
|
919
|
+
CarbWaterModelImpl = __decorateClass$i([
|
|
920
|
+
kosUiSdk.kosModel(MODEL_TYPE$i)
|
|
921
|
+
], CarbWaterModelImpl);
|
|
922
|
+
const CarbWater = {
|
|
923
|
+
registration: {
|
|
924
|
+
[MODEL_TYPE$i]: {
|
|
925
|
+
class: CarbWaterModelImpl,
|
|
926
|
+
singleton: false
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
type: MODEL_TYPE$i,
|
|
930
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$i),
|
|
931
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$i)
|
|
932
|
+
};
|
|
933
|
+
const { URL: URL$9 } = kosUiSdk.resolveServiceUrl("COPY-LOGS_SERVICE");
|
|
934
|
+
const { getAll: getAll$6, getOne: getOne$2, postModel: postModel$2, deleteModel } = kosUiSdk.ServiceFactory.build({
|
|
935
|
+
basePath: `${URL$9}/api/copy-logs`
|
|
936
|
+
});
|
|
937
|
+
const log$a = kosUiSdk.KosLog.createLogger({
|
|
938
|
+
name: "copy-logs-service",
|
|
939
|
+
group: "Services"
|
|
940
|
+
});
|
|
941
|
+
const eraseVolume = async (volumeId, tracker) => {
|
|
942
|
+
const response = await deleteModel({
|
|
943
|
+
tracker,
|
|
944
|
+
id: volumeId,
|
|
945
|
+
urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/${volumeId}`
|
|
946
|
+
});
|
|
947
|
+
if (!response?.data) {
|
|
948
|
+
throw new Error("No response from server");
|
|
949
|
+
}
|
|
950
|
+
return response.data;
|
|
951
|
+
};
|
|
952
|
+
const eraseAndCopyLogsToVolume = async (volumeId, tracker) => {
|
|
953
|
+
const response = await postModel$2({
|
|
954
|
+
model: {},
|
|
955
|
+
tracker,
|
|
956
|
+
urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/eraseAndCopy/${volumeId}`
|
|
957
|
+
});
|
|
958
|
+
if (!response?.data) {
|
|
959
|
+
throw new Error("No response from server");
|
|
960
|
+
}
|
|
961
|
+
return response.data;
|
|
962
|
+
};
|
|
963
|
+
const copyLogFromVolume = async (volumeId, tracker) => {
|
|
964
|
+
const response = await postModel$2({
|
|
965
|
+
model: {},
|
|
966
|
+
tracker,
|
|
967
|
+
urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/${volumeId}`
|
|
968
|
+
});
|
|
969
|
+
if (!response?.data) {
|
|
970
|
+
throw new Error("No response from server");
|
|
971
|
+
}
|
|
972
|
+
return response.data;
|
|
973
|
+
};
|
|
974
|
+
const getVolumes = async () => {
|
|
975
|
+
log$a.debug("sending GET for copy-logs");
|
|
976
|
+
try {
|
|
977
|
+
const response = await getAll$6({
|
|
978
|
+
urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/volumes/size`
|
|
979
|
+
});
|
|
980
|
+
return [void 0, response?.data];
|
|
981
|
+
} catch (error) {
|
|
982
|
+
if (error instanceof kosUiSdk.FetchError) {
|
|
983
|
+
log$a.error(`Error fetching log file size: ${error.payload.error}`);
|
|
984
|
+
return [error.payload.error, void 0];
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
return ["unknownError", void 0];
|
|
988
|
+
};
|
|
989
|
+
const getLogFileSize = async () => {
|
|
990
|
+
log$a.debug("sending GET for log file size");
|
|
991
|
+
try {
|
|
992
|
+
const response = await getOne$2({
|
|
993
|
+
urlOverride: `${URL$9}/api/app/kosdev.ddk/copyLogs/files/size`
|
|
994
|
+
});
|
|
995
|
+
return [void 0, response?.data];
|
|
996
|
+
} catch (error) {
|
|
997
|
+
if (error instanceof kosUiSdk.FetchError) {
|
|
998
|
+
log$a.error(`Error fetching log file size: ${error.payload.error}`);
|
|
999
|
+
return [error.payload.error, void 0];
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
return ["unknownError", void 0];
|
|
1003
|
+
};
|
|
1004
|
+
const index$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1005
|
+
__proto__: null,
|
|
1006
|
+
copyLogFromVolume,
|
|
1007
|
+
eraseAndCopyLogsToVolume,
|
|
1008
|
+
eraseVolume,
|
|
1009
|
+
getLogFileSize,
|
|
1010
|
+
getVolumes
|
|
1011
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1012
|
+
var __defProp$c = Object.defineProperty;
|
|
1013
|
+
var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
|
|
1014
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1015
|
+
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
1016
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
|
|
1017
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1018
|
+
if (decorator = decorators[i])
|
|
1019
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1020
|
+
if (kind && result) __defProp$c(target, key, result);
|
|
1021
|
+
return result;
|
|
1022
|
+
};
|
|
1023
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "", value);
|
|
1024
|
+
const MODEL_TYPE$h = "copy-logs-model";
|
|
1025
|
+
let CopyLogsModelImpl = class {
|
|
1026
|
+
id;
|
|
1027
|
+
_volumes;
|
|
1028
|
+
storageDeviceContainer;
|
|
1029
|
+
_activeVolume;
|
|
1030
|
+
_logFileSize = 0;
|
|
1031
|
+
_actionState = "idle";
|
|
1032
|
+
copyProgress;
|
|
1033
|
+
constructor(modelId) {
|
|
1034
|
+
this.id = modelId;
|
|
1035
|
+
this._volumes = new kosUiSdk.KosDataContainer();
|
|
1036
|
+
this._activeVolume = void 0;
|
|
1037
|
+
this.copyProgress = {
|
|
1038
|
+
bytesCopied: 0,
|
|
1039
|
+
bytesToCopy: 0,
|
|
1040
|
+
filesCopied: 0,
|
|
1041
|
+
filesSkipped: 0
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
// -------------------LIFECYCLE----------------------------
|
|
1045
|
+
get volumes() {
|
|
1046
|
+
return this._volumes.data;
|
|
1047
|
+
}
|
|
1048
|
+
get activeVolume() {
|
|
1049
|
+
return this._activeVolume;
|
|
1050
|
+
}
|
|
1051
|
+
get logFileSize() {
|
|
1052
|
+
return this._logFileSize;
|
|
1053
|
+
}
|
|
1054
|
+
reset() {
|
|
1055
|
+
this.clearActiveVolume();
|
|
1056
|
+
this.futureHandler.removeFuture();
|
|
1057
|
+
}
|
|
1058
|
+
clearActiveVolume() {
|
|
1059
|
+
this._activeVolume = void 0;
|
|
1060
|
+
}
|
|
1061
|
+
updateActiveVolume(volume) {
|
|
1062
|
+
this._activeVolume = volume;
|
|
1063
|
+
}
|
|
1064
|
+
get inserted() {
|
|
1065
|
+
return this.storageDeviceContainer.isStorageInserted;
|
|
1066
|
+
}
|
|
1067
|
+
updateLogFileSize(size) {
|
|
1068
|
+
this._logFileSize = size;
|
|
1069
|
+
}
|
|
1070
|
+
get canCopyLogs() {
|
|
1071
|
+
return this.inserted && this._activeVolume;
|
|
1072
|
+
}
|
|
1073
|
+
get actionState() {
|
|
1074
|
+
return this._actionState;
|
|
1075
|
+
}
|
|
1076
|
+
get diskFull() {
|
|
1077
|
+
return this.future?.status === kosUiSdk.FutureEndState.Success && this.copyProgress.filesSkipped > 0;
|
|
1078
|
+
}
|
|
1079
|
+
onFutureUpdate(update) {
|
|
1080
|
+
this.logger.info(`Future update: ${update.status}`);
|
|
1081
|
+
if (update.status === kosUiSdk.FutureEndState.Success) {
|
|
1082
|
+
this.logger.info(`Future success: ${update.status}`);
|
|
1083
|
+
if (this.diskFull) {
|
|
1084
|
+
kosUiSdk.kosAction(() => {
|
|
1085
|
+
update.endState = kosUiSdk.FutureEndState.Fail;
|
|
1086
|
+
update.reason = "errDiskFull";
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
if (update.status === kosUiSdk.FutureEndState.Fail) {
|
|
1091
|
+
this.logger.error(`Future failed: ${update.status}`);
|
|
1092
|
+
}
|
|
1093
|
+
if (update.note === "copy") {
|
|
1094
|
+
kosUiSdk.kosAction(() => {
|
|
1095
|
+
this._actionState = "copying";
|
|
1096
|
+
this.copyProgress = update.clientData || {
|
|
1097
|
+
bytesCopied: 0,
|
|
1098
|
+
bytesToCopy: 0,
|
|
1099
|
+
filesCopied: 0,
|
|
1100
|
+
filesSkipped: 0
|
|
1101
|
+
};
|
|
1102
|
+
});
|
|
1103
|
+
} else {
|
|
1104
|
+
this._actionState = "erasing";
|
|
1105
|
+
kosUiSdk.kosAction(() => {
|
|
1106
|
+
this.copyProgress = {
|
|
1107
|
+
bytesCopied: 0,
|
|
1108
|
+
bytesToCopy: 0,
|
|
1109
|
+
filesCopied: 0,
|
|
1110
|
+
filesSkipped: 0
|
|
1111
|
+
};
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
async eraseAndCopyVolume(tracker) {
|
|
1116
|
+
if (!tracker) {
|
|
1117
|
+
throw new Error("No tracker provided");
|
|
1118
|
+
}
|
|
1119
|
+
kosUiSdk.kosAction(() => {
|
|
1120
|
+
this._actionState = "erasing";
|
|
1121
|
+
});
|
|
1122
|
+
if (!this._activeVolume) {
|
|
1123
|
+
this.logger.error("No active volume selected");
|
|
1124
|
+
throw new Error("No active volume selected");
|
|
1125
|
+
}
|
|
1126
|
+
this.logger.info(`Erasing volume ${this._activeVolume?.name}`);
|
|
1127
|
+
return eraseAndCopyLogsToVolume(this._activeVolume.id, tracker);
|
|
1128
|
+
}
|
|
1129
|
+
async eraseVolume(tracker) {
|
|
1130
|
+
if (!tracker) {
|
|
1131
|
+
throw new Error("No tracker provided");
|
|
1132
|
+
}
|
|
1133
|
+
kosUiSdk.kosAction(() => {
|
|
1134
|
+
this._actionState = "erasing";
|
|
1135
|
+
});
|
|
1136
|
+
if (!this._activeVolume) {
|
|
1137
|
+
this.logger.error("No active volume selected");
|
|
1138
|
+
throw new Error("No active volume selected");
|
|
1139
|
+
}
|
|
1140
|
+
this.logger.info(`Erasing volume ${this._activeVolume?.name}`);
|
|
1141
|
+
return eraseVolume(this._activeVolume.id, tracker);
|
|
1142
|
+
}
|
|
1143
|
+
async copyLogs(tracker) {
|
|
1144
|
+
if (!tracker) {
|
|
1145
|
+
throw new Error("No tracker provided");
|
|
1146
|
+
}
|
|
1147
|
+
kosUiSdk.kosAction(() => {
|
|
1148
|
+
this._actionState = "copying";
|
|
1149
|
+
});
|
|
1150
|
+
if (!this._activeVolume) {
|
|
1151
|
+
this.logger.error("No active volume selected");
|
|
1152
|
+
throw new Error("No active volume selected");
|
|
1153
|
+
}
|
|
1154
|
+
this.logger.info(`Copying logs to ${this._activeVolume?.name}`);
|
|
1155
|
+
return copyLogFromVolume(this._activeVolume.id, tracker);
|
|
1156
|
+
}
|
|
1157
|
+
handleInsertion() {
|
|
1158
|
+
if (this.inserted) {
|
|
1159
|
+
this.syncVolumes();
|
|
1160
|
+
} else {
|
|
1161
|
+
this._volumes.clear();
|
|
1162
|
+
this.clearActiveVolume();
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
async init() {
|
|
1166
|
+
this.logger.debug(`initializing copy-logs ${this.id}`);
|
|
1167
|
+
}
|
|
1168
|
+
async syncVolumes() {
|
|
1169
|
+
const [volumeError, volumes] = await getVolumes();
|
|
1170
|
+
const [error, logSize] = await getLogFileSize();
|
|
1171
|
+
if (error) {
|
|
1172
|
+
this.logger.error(`Error fetching log file size: ${error}`);
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
if (volumeError) {
|
|
1176
|
+
this.logger.error(`Error fetching volumes: ${volumeError}`);
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1179
|
+
if (volumes) {
|
|
1180
|
+
volumes.forEach((volume) => {
|
|
1181
|
+
const storageVolume = this.storageDeviceContainer.getModel(volume.id);
|
|
1182
|
+
if (storageVolume) {
|
|
1183
|
+
const _volume = {
|
|
1184
|
+
id: volume.id,
|
|
1185
|
+
name: storageVolume.label,
|
|
1186
|
+
freeBytes: volume.info.freeBytes,
|
|
1187
|
+
totalBytes: volume.info.totalBytes
|
|
1188
|
+
};
|
|
1189
|
+
this._volumes.addModel(_volume);
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
if (volumes.length === 1) {
|
|
1193
|
+
this.updateActiveVolume(this._volumes.data[0]);
|
|
1194
|
+
} else {
|
|
1195
|
+
this.clearActiveVolume();
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
if (logSize) {
|
|
1199
|
+
this.logger.info(`Log file size: ${logSize}`);
|
|
1200
|
+
this.updateLogFileSize(parseInt(logSize, 10));
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
async activate() {
|
|
1204
|
+
this.logger.debug(`activating copy-logs ${this.id}`);
|
|
1205
|
+
await this.syncVolumes();
|
|
1206
|
+
}
|
|
1207
|
+
async load() {
|
|
1208
|
+
this.logger.debug(`loading copy-logs ${this.id}`);
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1211
|
+
__publicField$1(CopyLogsModelImpl, "Registration");
|
|
1212
|
+
__decorateClass$h([
|
|
1213
|
+
kosUiSdk.kosDependency({ modelType: kosUiSdk.StorageDeviceContainer.type })
|
|
1214
|
+
], CopyLogsModelImpl.prototype, "storageDeviceContainer", 2);
|
|
1215
|
+
__decorateClass$h([
|
|
1216
|
+
kosUiSdk.kosFuture()
|
|
1217
|
+
], CopyLogsModelImpl.prototype, "eraseAndCopyVolume", 1);
|
|
1218
|
+
__decorateClass$h([
|
|
1219
|
+
kosUiSdk.kosFuture()
|
|
1220
|
+
], CopyLogsModelImpl.prototype, "eraseVolume", 1);
|
|
1221
|
+
__decorateClass$h([
|
|
1222
|
+
kosUiSdk.kosFuture()
|
|
1223
|
+
], CopyLogsModelImpl.prototype, "copyLogs", 1);
|
|
1224
|
+
__decorateClass$h([
|
|
1225
|
+
kosUiSdk.kosModelEffect({
|
|
1226
|
+
dependencies: (model) => [model.inserted]
|
|
1227
|
+
})
|
|
1228
|
+
], CopyLogsModelImpl.prototype, "handleInsertion", 1);
|
|
1229
|
+
CopyLogsModelImpl = __decorateClass$h([
|
|
1230
|
+
kosUiSdk.kosModel({ modelTypeId: MODEL_TYPE$h, singleton: true }),
|
|
1231
|
+
kosUiSdk.kosFutureAware(),
|
|
1232
|
+
kosUiSdk.kosLoggerAware()
|
|
1233
|
+
], CopyLogsModelImpl);
|
|
1234
|
+
const CopyLogs = CopyLogsModelImpl.Registration;
|
|
1235
|
+
const log$9 = kosUiSdk.KosLog.createLogger({
|
|
1236
|
+
name: "dashboard-operations-service",
|
|
1237
|
+
group: "Services"
|
|
1238
|
+
});
|
|
1239
|
+
const resolveAll = async (troubleIds, tracker) => {
|
|
1240
|
+
log$9.debug("resolveAll");
|
|
1241
|
+
const response = await kosUiSdk.TroubleServices.bulkResolveTroubles(
|
|
1242
|
+
troubleIds,
|
|
1243
|
+
void 0,
|
|
1244
|
+
tracker
|
|
1245
|
+
);
|
|
1246
|
+
return response;
|
|
1247
|
+
};
|
|
1248
|
+
const resolveTrouble = async (troubleId, tracker) => {
|
|
1249
|
+
log$9.debug("resolveTrouble");
|
|
1250
|
+
const response = await kosUiSdk.TroubleServices.resolveTrouble(
|
|
1251
|
+
troubleId,
|
|
1252
|
+
void 0,
|
|
1253
|
+
tracker
|
|
1254
|
+
);
|
|
1255
|
+
return response;
|
|
1256
|
+
};
|
|
1257
|
+
const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1258
|
+
__proto__: null,
|
|
1259
|
+
resolveAll,
|
|
1260
|
+
resolveTrouble
|
|
1261
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1262
|
+
var __defProp$b = Object.defineProperty;
|
|
1263
|
+
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
1264
|
+
var __decorateClass$g = (decorators, target, key, kind) => {
|
|
1265
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
1266
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1267
|
+
if (decorator = decorators[i])
|
|
1268
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1269
|
+
if (kind && result) __defProp$b(target, key, result);
|
|
1270
|
+
return result;
|
|
1271
|
+
};
|
|
1272
|
+
const MODEL_TYPE$g = "dashboard-operations-model";
|
|
1273
|
+
function resolvableTroubleFilter(trouble) {
|
|
1274
|
+
return !trouble.deferred;
|
|
1275
|
+
}
|
|
1276
|
+
function deferredTroubleFilter(trouble) {
|
|
1277
|
+
return trouble.deferred;
|
|
1278
|
+
}
|
|
1279
|
+
let DashboardOperationsModelImpl = class {
|
|
1280
|
+
id;
|
|
1281
|
+
troubles;
|
|
1282
|
+
futureHandler;
|
|
1283
|
+
logger;
|
|
1284
|
+
constructor(modelId, options, context) {
|
|
1285
|
+
this.id = modelId;
|
|
1286
|
+
this.futureHandler = new kosUiSdk.FutureHandler(this);
|
|
1287
|
+
this.logger = context.logger;
|
|
1288
|
+
}
|
|
1289
|
+
get troublesByType() {
|
|
1290
|
+
return this.troubles.troubles.data.reduce(
|
|
1291
|
+
kosUiSdk.troubleByTypeReducer,
|
|
1292
|
+
{}
|
|
1293
|
+
);
|
|
1294
|
+
}
|
|
1295
|
+
get queuedPurgeTroubles() {
|
|
1296
|
+
return this.purgeTroubles.filter(deferredTroubleFilter);
|
|
1297
|
+
}
|
|
1298
|
+
get queuedPrimeTroubles() {
|
|
1299
|
+
return this.primeTroubles.filter(deferredTroubleFilter);
|
|
1300
|
+
}
|
|
1301
|
+
get resolvablePrimeTroubles() {
|
|
1302
|
+
return this.primeTroubles.filter(resolvableTroubleFilter);
|
|
1303
|
+
}
|
|
1304
|
+
get resolvablePurgeTroubles() {
|
|
1305
|
+
return this.purgeTroubles.filter(resolvableTroubleFilter);
|
|
1306
|
+
}
|
|
1307
|
+
get hasResolvablePurgeTroubles() {
|
|
1308
|
+
return this.resolvablePurgeTroubles.length > 0;
|
|
1309
|
+
}
|
|
1310
|
+
get hasResolvablePrimeTroubles() {
|
|
1311
|
+
return this.resolvablePrimeTroubles.length > 0;
|
|
1312
|
+
}
|
|
1313
|
+
get hasPurgeTroubles() {
|
|
1314
|
+
return this.purgeTroubles.length > 0;
|
|
1315
|
+
}
|
|
1316
|
+
get hasPrimeTroubles() {
|
|
1317
|
+
return this.primeTroubles.length > 0;
|
|
1318
|
+
}
|
|
1319
|
+
get purgeTroubles() {
|
|
1320
|
+
return this.troublesByType[TROUBLE_TYPE_PURGE$1] || [];
|
|
1321
|
+
}
|
|
1322
|
+
get primeTroubles() {
|
|
1323
|
+
return this.troublesByType[TROUBLE_TYPE_PRIME$1] || [];
|
|
1324
|
+
}
|
|
1325
|
+
get future() {
|
|
1326
|
+
return this.futureHandler.getFuture();
|
|
1327
|
+
}
|
|
1328
|
+
async resolveAllTroubles(type, tracker) {
|
|
1329
|
+
if (!tracker) {
|
|
1330
|
+
throw new Error("No tracker provided");
|
|
1331
|
+
}
|
|
1332
|
+
const container = type === TROUBLE_TYPE_PURGE$1 ? this.purgeTroubles : this.primeTroubles;
|
|
1333
|
+
const shouldDefer = container.filter((trouble) => trouble.shouldDefer);
|
|
1334
|
+
shouldDefer.forEach((trouble) => {
|
|
1335
|
+
this.logger.info(`Deferring trouble ${trouble.rawId}`);
|
|
1336
|
+
trouble.defer();
|
|
1337
|
+
});
|
|
1338
|
+
const allTroubles = container.filter((trouble) => !trouble.shouldDefer).map((trouble) => trouble.rawId);
|
|
1339
|
+
if (allTroubles.length === 0) {
|
|
1340
|
+
return void 0;
|
|
1341
|
+
}
|
|
1342
|
+
const response = await resolveAll(allTroubles, tracker);
|
|
1343
|
+
return response;
|
|
1344
|
+
}
|
|
1345
|
+
async resolveTrouble(troubleId, tracker) {
|
|
1346
|
+
if (!tracker) {
|
|
1347
|
+
throw new Error("No tracker provided");
|
|
1348
|
+
}
|
|
1349
|
+
const response = await resolveTrouble(troubleId, tracker);
|
|
1350
|
+
return response;
|
|
1351
|
+
}
|
|
1352
|
+
// -------------------LIFECYCLE----------------------------
|
|
1353
|
+
async init() {
|
|
1354
|
+
this.logger.debug(`initializing dashboard-operations ${this.id}`);
|
|
1355
|
+
}
|
|
1356
|
+
async load() {
|
|
1357
|
+
this.logger.debug(`loading dashboard-operations ${this.id}`);
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
__decorateClass$g([
|
|
1361
|
+
kosUiSdk.kosDependency({
|
|
1362
|
+
modelType: kosUiSdk.TroubleContainer.type
|
|
1363
|
+
})
|
|
1364
|
+
], DashboardOperationsModelImpl.prototype, "troubles", 2);
|
|
1365
|
+
__decorateClass$g([
|
|
1366
|
+
kosUiSdk.kosFuture()
|
|
1367
|
+
], DashboardOperationsModelImpl.prototype, "resolveAllTroubles", 1);
|
|
1368
|
+
__decorateClass$g([
|
|
1369
|
+
kosUiSdk.kosFuture()
|
|
1370
|
+
], DashboardOperationsModelImpl.prototype, "resolveTrouble", 1);
|
|
1371
|
+
DashboardOperationsModelImpl = __decorateClass$g([
|
|
1372
|
+
kosUiSdk.kosModel(MODEL_TYPE$g)
|
|
1373
|
+
], DashboardOperationsModelImpl);
|
|
1374
|
+
const DashboardOperations = {
|
|
1375
|
+
registration: {
|
|
1376
|
+
[MODEL_TYPE$g]: {
|
|
1377
|
+
class: DashboardOperationsModelImpl,
|
|
1378
|
+
singleton: true
|
|
1379
|
+
}
|
|
1380
|
+
},
|
|
1381
|
+
type: MODEL_TYPE$g,
|
|
1382
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$g),
|
|
1383
|
+
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$g)
|
|
1384
|
+
};
|
|
1385
|
+
var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
|
|
1386
|
+
var __decorateClass$f = (decorators, target, key, kind) => {
|
|
1387
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
|
|
1388
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1389
|
+
if (decorator = decorators[i])
|
|
1390
|
+
result = decorator(result) || result;
|
|
1391
|
+
return result;
|
|
1392
|
+
};
|
|
1393
|
+
const MODEL_TYPE$f = "dispenser-model";
|
|
1394
|
+
let DispenserModelImpl = class {
|
|
1395
|
+
id;
|
|
1396
|
+
logger;
|
|
1397
|
+
constructor(modelId, options, context) {
|
|
1398
|
+
this.id = modelId;
|
|
1399
|
+
this.logger = context.logger;
|
|
1400
|
+
}
|
|
1401
|
+
updateModel() {
|
|
1402
|
+
}
|
|
1403
|
+
// -------------------LIFECYCLE----------------------------
|
|
1404
|
+
async init() {
|
|
1405
|
+
this.logger.debug(`initializing dispenser ${this.id}`);
|
|
1406
|
+
}
|
|
1407
|
+
async load() {
|
|
1408
|
+
this.logger.debug(`loading dispenser ${this.id}`);
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
DispenserModelImpl = __decorateClass$f([
|
|
1412
|
+
kosUiSdk.kosModel(MODEL_TYPE$f)
|
|
1413
|
+
], DispenserModelImpl);
|
|
1414
|
+
const Dispenser = {
|
|
1415
|
+
registration: {
|
|
1416
|
+
[MODEL_TYPE$f]: {
|
|
1417
|
+
class: DispenserModelImpl,
|
|
1418
|
+
singleton: true
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
type: MODEL_TYPE$f,
|
|
1422
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$f),
|
|
1423
|
+
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$f)
|
|
1424
|
+
};
|
|
1425
|
+
const { URL: URL$8 } = kosUiSdk.resolveServiceUrl("DISPENSER_SERVICE");
|
|
1426
|
+
const { getAll: getAll$5 } = kosUiSdk.ServiceFactory.build({
|
|
1427
|
+
basePath: `${URL$8}/api/dispenser`
|
|
1428
|
+
});
|
|
1429
|
+
const log$8 = kosUiSdk.KosLog.createLogger({
|
|
1430
|
+
name: "dispenser-service",
|
|
1431
|
+
group: "Services"
|
|
1432
|
+
});
|
|
1433
|
+
const getDispensers = async () => {
|
|
1434
|
+
log$8.debug("sending GET for dispenser");
|
|
1435
|
+
const response = await getAll$5({});
|
|
1436
|
+
return response;
|
|
1437
|
+
};
|
|
1438
|
+
const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1439
|
+
__proto__: null,
|
|
1440
|
+
getDispensers
|
|
1441
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1442
|
+
var __defProp$a = Object.defineProperty;
|
|
1443
|
+
var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
|
|
1444
|
+
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
1445
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
1446
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1447
|
+
if (decorator = decorators[i])
|
|
1448
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1449
|
+
if (kind && result) __defProp$a(target, key, result);
|
|
1450
|
+
return result;
|
|
1451
|
+
};
|
|
1452
|
+
const MODEL_TYPE$e = "dispenser-info-model";
|
|
1453
|
+
let DispenserInfoModelImpl = class {
|
|
1454
|
+
logger;
|
|
1455
|
+
id;
|
|
1456
|
+
name;
|
|
1457
|
+
constructor(modelId, _options, context) {
|
|
1458
|
+
this.id = modelId;
|
|
1459
|
+
this.logger = context.logger;
|
|
1460
|
+
}
|
|
1461
|
+
// -------------------LIFECYCLE----------------------------
|
|
1462
|
+
async init() {
|
|
1463
|
+
this.logger.debug(`initializing dispenser-info ${this.id}`);
|
|
1464
|
+
}
|
|
1465
|
+
async load() {
|
|
1466
|
+
this.logger.debug(`loading dispenser-info ${this.id}`);
|
|
1467
|
+
}
|
|
1468
|
+
};
|
|
1469
|
+
__decorateClass$e([
|
|
1470
|
+
kosUiSdk.kosConfigProperty({
|
|
1471
|
+
path: "kos:device",
|
|
1472
|
+
attribute: "name"
|
|
1473
|
+
})
|
|
1474
|
+
], DispenserInfoModelImpl.prototype, "name", 2);
|
|
1475
|
+
DispenserInfoModelImpl = __decorateClass$e([
|
|
1476
|
+
kosUiSdk.kosModel(MODEL_TYPE$e)
|
|
1477
|
+
], DispenserInfoModelImpl);
|
|
1478
|
+
const DispenserInfo = {
|
|
1479
|
+
registration: {
|
|
1480
|
+
[MODEL_TYPE$e]: {
|
|
1481
|
+
class: DispenserInfoModelImpl,
|
|
1482
|
+
singleton: false
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1485
|
+
type: MODEL_TYPE$e,
|
|
1486
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$e),
|
|
1487
|
+
factory: kosUiSdk.Kos.Factory.create(
|
|
1488
|
+
MODEL_TYPE$e
|
|
1489
|
+
)
|
|
1490
|
+
};
|
|
1491
|
+
const { URL: URL$7 } = kosUiSdk.resolveServiceUrl("DISPENSER-INFO_SERVICE");
|
|
1492
|
+
const { getAll: getAll$4 } = kosUiSdk.ServiceFactory.build({
|
|
1493
|
+
basePath: `${URL$7}/api/dispenser-info`
|
|
1494
|
+
});
|
|
1495
|
+
const log$7 = kosUiSdk.KosLog.createLogger({
|
|
1496
|
+
name: "dispenser-info-service",
|
|
1497
|
+
group: "Services"
|
|
1498
|
+
});
|
|
1499
|
+
const getDispenserInfos = async () => {
|
|
1500
|
+
log$7.debug("sending GET for dispenser-info");
|
|
1501
|
+
const response = await getAll$4({});
|
|
1502
|
+
return response;
|
|
1503
|
+
};
|
|
1504
|
+
const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1505
|
+
__proto__: null,
|
|
1506
|
+
getDispenserInfos
|
|
1507
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1508
|
+
var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
|
|
1509
|
+
var __decorateClass$d = (decorators, target, key, kind) => {
|
|
1510
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
|
|
1511
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1512
|
+
if (decorator = decorators[i])
|
|
1513
|
+
result = decorator(result) || result;
|
|
1514
|
+
return result;
|
|
1515
|
+
};
|
|
1516
|
+
const MODEL_TYPE$d = "enrollment-model";
|
|
1517
|
+
let EnrollmentModelImpl = class {
|
|
1518
|
+
id;
|
|
1519
|
+
logger;
|
|
1520
|
+
enrolled;
|
|
1521
|
+
constructor(modelId, _options, context) {
|
|
1522
|
+
this.id = modelId;
|
|
1523
|
+
this.logger = context.logger;
|
|
1524
|
+
this.enrolled = false;
|
|
1525
|
+
}
|
|
1526
|
+
updateModel(options) {
|
|
1527
|
+
console.log("updateModel:", options);
|
|
1528
|
+
}
|
|
1529
|
+
// -------------------LIFECYCLE----------------------------
|
|
1530
|
+
async init() {
|
|
1531
|
+
this.logger.debug(`initializing enrollment ${this.id}`);
|
|
1532
|
+
}
|
|
1533
|
+
async load() {
|
|
1534
|
+
this.logger.debug(`loading enrollment ${this.id}`);
|
|
1535
|
+
}
|
|
1536
|
+
};
|
|
1537
|
+
EnrollmentModelImpl = __decorateClass$d([
|
|
1538
|
+
kosUiSdk.kosModel(MODEL_TYPE$d)
|
|
1539
|
+
], EnrollmentModelImpl);
|
|
1540
|
+
const Enrollment = {
|
|
1541
|
+
registration: {
|
|
1542
|
+
[MODEL_TYPE$d]: {
|
|
1543
|
+
class: EnrollmentModelImpl,
|
|
1544
|
+
singleton: true
|
|
1545
|
+
}
|
|
1546
|
+
},
|
|
1547
|
+
type: MODEL_TYPE$d,
|
|
1548
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$d),
|
|
1549
|
+
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$d)
|
|
1550
|
+
};
|
|
1551
|
+
const { URL: URL$6 } = kosUiSdk.resolveServiceUrl("ENROLLMENT_SERVICE");
|
|
1552
|
+
const { getAll: getAll$3 } = kosUiSdk.ServiceFactory.build({
|
|
1553
|
+
basePath: `${URL$6}/api/enrollment`
|
|
1554
|
+
});
|
|
1555
|
+
const log$6 = kosUiSdk.KosLog.createLogger({
|
|
1556
|
+
name: "enrollment-service",
|
|
1557
|
+
group: "Services"
|
|
1558
|
+
});
|
|
1559
|
+
const getEnrollments = async () => {
|
|
1560
|
+
log$6.debug("sending GET for enrollment");
|
|
1561
|
+
const response = await getAll$3({});
|
|
1562
|
+
return response;
|
|
1563
|
+
};
|
|
1564
|
+
const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1565
|
+
__proto__: null,
|
|
1566
|
+
getEnrollments
|
|
1567
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1568
|
+
const isMicroGroup = (group) => group.toLowerCase().includes("micros");
|
|
1569
|
+
const isMacroGroup = (group) => !group.toLowerCase().includes("micros");
|
|
1570
|
+
const macroHolderMap = (assembly) => (holderName) => {
|
|
1571
|
+
const holderGroup = assembly?.getHoldersByGroup(holderName);
|
|
1572
|
+
if (!holderGroup) {
|
|
1573
|
+
return null;
|
|
1574
|
+
}
|
|
1575
|
+
return holderGroup.map((holder) => {
|
|
1576
|
+
return { id: holder.id, name: holder.ingredientName, path: holder.path };
|
|
1577
|
+
});
|
|
1578
|
+
};
|
|
1579
|
+
const MACRO_KEYS = ["water", "carb", "ns", "nss"];
|
|
1580
|
+
const EXTENSION_POINT_DASHBOARD_KEY_FACTORY = "dashboardKeyFactory";
|
|
1581
|
+
const dashboardKeyFactories = [];
|
|
1582
|
+
kosUiSdk.registerExtensionPoint(EXTENSION_POINT_DASHBOARD_KEY_FACTORY, {
|
|
1583
|
+
register: (_id, factory) => {
|
|
1584
|
+
if (dashboardKeyFactories.includes(factory)) {
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
dashboardKeyFactories.push(factory);
|
|
1588
|
+
},
|
|
1589
|
+
execute: (_id, holder) => {
|
|
1590
|
+
const factories = dashboardKeyFactories.sort((a, b) => a.rank - b.rank);
|
|
1591
|
+
for (const factory of factories) {
|
|
1592
|
+
const key = factory.factory(holder);
|
|
1593
|
+
if (key) {
|
|
1594
|
+
return key;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
return void 0;
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1600
|
+
const registerDashboardKeyFactory = (factory) => {
|
|
1601
|
+
kosUiSdk.ExtensionManager[EXTENSION_POINT_DASHBOARD_KEY_FACTORY].register(
|
|
1602
|
+
EXTENSION_POINT_DASHBOARD_KEY_FACTORY,
|
|
1603
|
+
factory
|
|
1604
|
+
);
|
|
1605
|
+
};
|
|
1606
|
+
const executeDashboardKeyFactory = (holder) => kosUiSdk.ExtensionManager[EXTENSION_POINT_DASHBOARD_KEY_FACTORY].execute(
|
|
1607
|
+
EXTENSION_POINT_DASHBOARD_KEY_FACTORY,
|
|
1608
|
+
holder
|
|
1609
|
+
);
|
|
1610
|
+
kosUiSdk.ExtensionManager.registerDashboardKeyFactory = registerDashboardKeyFactory;
|
|
1611
|
+
kosUiSdk.ExtensionManager.executeDashboardKeyFactory = executeDashboardKeyFactory;
|
|
1612
|
+
const HOUR = 3600;
|
|
1613
|
+
const MINUTE = 60;
|
|
1614
|
+
const toTimeComponents = (seconds) => {
|
|
1615
|
+
const hours = Math.floor(seconds / HOUR);
|
|
1616
|
+
const minutes = Math.floor(seconds % HOUR / MINUTE);
|
|
1617
|
+
return { hours, minutes };
|
|
1618
|
+
};
|
|
1619
|
+
const toSeconds = (hours, minutes) => {
|
|
1620
|
+
const time = hours * HOUR + minutes * MINUTE;
|
|
1621
|
+
return time;
|
|
1622
|
+
};
|
|
1623
|
+
const calculateTimeDifference = (date) => {
|
|
1624
|
+
const currentDate = /* @__PURE__ */ new Date();
|
|
1625
|
+
const timeDifference = currentDate.valueOf() - date.valueOf();
|
|
1626
|
+
const minutes = Math.floor(timeDifference / (1e3 * 60));
|
|
1627
|
+
const hours = Math.floor(minutes / 60);
|
|
1628
|
+
const days = Math.floor(hours / 24);
|
|
1629
|
+
const remainingMinutes = minutes % 60;
|
|
1630
|
+
const remainingHours = hours % 24;
|
|
1631
|
+
let result = "";
|
|
1632
|
+
if (days > 0) {
|
|
1633
|
+
result += `${days} day${days > 1 ? "s" : ""} `;
|
|
1634
|
+
}
|
|
1635
|
+
if (remainingHours > 0) {
|
|
1636
|
+
result += `${remainingHours} hour${remainingHours > 1 ? "s" : ""} `;
|
|
1637
|
+
}
|
|
1638
|
+
if (remainingMinutes > 0 || days === 0 && remainingHours === 0) {
|
|
1639
|
+
result += `${remainingMinutes} minute${remainingMinutes > 1 ? "s" : ""} `;
|
|
1640
|
+
}
|
|
1641
|
+
return result;
|
|
1642
|
+
};
|
|
1643
|
+
var __defProp$9 = Object.defineProperty;
|
|
1644
|
+
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
|
|
1645
|
+
var __decorateClass$c = (decorators, target, key, kind) => {
|
|
1646
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
|
|
1647
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1648
|
+
if (decorator = decorators[i])
|
|
1649
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1650
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
1651
|
+
return result;
|
|
1652
|
+
};
|
|
1653
|
+
const MODEL_TYPE$c = "ingredient-summary-model";
|
|
1654
|
+
let IngredientSummaryModelImpl = class {
|
|
1655
|
+
id;
|
|
1656
|
+
assemblyModel;
|
|
1657
|
+
dashboardOperationModel;
|
|
1658
|
+
appModel;
|
|
1659
|
+
logger;
|
|
1660
|
+
constructor(modelId, options, context) {
|
|
1661
|
+
this.id = modelId;
|
|
1662
|
+
this.logger = context.logger;
|
|
1663
|
+
this.dashboardOperationModel = DashboardOperations.factory({});
|
|
1664
|
+
}
|
|
1665
|
+
get highPriorityHolders() {
|
|
1666
|
+
return this.assemblyModel.allHolders.filter(
|
|
1667
|
+
(holder) => holder.troubles.length > 0 && holder.troubles.find((trouble) => trouble.rank >= 400)
|
|
1668
|
+
);
|
|
1669
|
+
}
|
|
1670
|
+
get actionRequiredHolders() {
|
|
1671
|
+
const currentRole = this.appModel.currentRole;
|
|
1672
|
+
const filter = troubleVisibilityFilter(currentRole);
|
|
1673
|
+
return this.assemblyModel.allHolders.filter((holder) => {
|
|
1674
|
+
const companionModel = kosUiSdk.getKosCompanionModel(
|
|
1675
|
+
holder,
|
|
1676
|
+
kosFreestyleSdk.FreestyleHolder.type
|
|
1677
|
+
);
|
|
1678
|
+
if (companionModel?.isRemote) {
|
|
1679
|
+
return false;
|
|
1680
|
+
}
|
|
1681
|
+
const visibleTroubles = holder.troubles.filter(filter);
|
|
1682
|
+
return visibleTroubles.length > 0 && visibleTroubles.find((trouble) => trouble.resolvable);
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
get lowLevelHolders() {
|
|
1686
|
+
return this.assemblyModel.allHolders.filter((holder) => {
|
|
1687
|
+
const fillPercent = holder.fillPercent;
|
|
1688
|
+
const hasFuelGuage = holder.hasFuelGuage;
|
|
1689
|
+
return hasFuelGuage && fillPercent < 20;
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
// -------------------LIFECYCLE----------------------------
|
|
1693
|
+
async init() {
|
|
1694
|
+
this.logger.debug(`initializing ingredient-summary ${this.id}`);
|
|
1695
|
+
}
|
|
1696
|
+
async load() {
|
|
1697
|
+
this.logger.debug(`loading ingredient-summary ${this.id}`);
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1700
|
+
__decorateClass$c([
|
|
1701
|
+
kosUiSdk.kosDependency({ modelType: kosDispenseSdk.Assembly.type })
|
|
1702
|
+
], IngredientSummaryModelImpl.prototype, "assemblyModel", 2);
|
|
1703
|
+
__decorateClass$c([
|
|
1704
|
+
kosUiSdk.kosDependency({ modelType: DashboardOperations.type })
|
|
1705
|
+
], IngredientSummaryModelImpl.prototype, "dashboardOperationModel", 2);
|
|
1706
|
+
__decorateClass$c([
|
|
1707
|
+
kosUiSdk.kosDependency({ modelType: Application.type })
|
|
1708
|
+
], IngredientSummaryModelImpl.prototype, "appModel", 2);
|
|
1709
|
+
IngredientSummaryModelImpl = __decorateClass$c([
|
|
1710
|
+
kosUiSdk.kosModel(MODEL_TYPE$c)
|
|
1711
|
+
], IngredientSummaryModelImpl);
|
|
1712
|
+
const IngredientSummary = {
|
|
1713
|
+
registration: {
|
|
1714
|
+
[MODEL_TYPE$c]: {
|
|
1715
|
+
class: IngredientSummaryModelImpl,
|
|
1716
|
+
singleton: false
|
|
1717
|
+
}
|
|
1718
|
+
},
|
|
1719
|
+
type: MODEL_TYPE$c,
|
|
1720
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$c),
|
|
1721
|
+
factory: kosUiSdk.Kos.Factory.create(
|
|
1722
|
+
MODEL_TYPE$c
|
|
1723
|
+
)
|
|
1724
|
+
};
|
|
1725
|
+
const { URL: URL$5 } = kosUiSdk.resolveServiceUrl("LOCKOUT_SERVICE");
|
|
1726
|
+
const { postModel: postModel$1 } = kosUiSdk.ServiceFactory.build({
|
|
1727
|
+
basePath: `${URL$5}/api/app/kosdev.ddk/lockout`
|
|
1728
|
+
});
|
|
1729
|
+
const log$5 = kosUiSdk.KosLog.createLogger({ name: "lockout-service", group: "Services" });
|
|
1730
|
+
const lock = async () => {
|
|
1731
|
+
log$5.info("lock");
|
|
1732
|
+
const response = await postModel$1({
|
|
1733
|
+
model: {},
|
|
1734
|
+
urlOverride: `${URL$5}/api/app/kosdev.ddk/lockout/lockNow`
|
|
1735
|
+
});
|
|
1736
|
+
return response;
|
|
1737
|
+
};
|
|
1738
|
+
const unlock = async (pin) => {
|
|
1739
|
+
log$5.info("unlock");
|
|
1740
|
+
const response = await postModel$1({
|
|
1741
|
+
model: {},
|
|
1742
|
+
urlOverride: `${URL$5}/api/app/kosdev.ddk/lockout/unlock/${pin}`
|
|
1743
|
+
});
|
|
1744
|
+
return response?.data;
|
|
1745
|
+
};
|
|
1746
|
+
const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1747
|
+
__proto__: null,
|
|
1748
|
+
lock,
|
|
1749
|
+
unlock
|
|
1750
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1751
|
+
var __defProp$8 = Object.defineProperty;
|
|
1752
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
1753
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
1754
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
1755
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1756
|
+
if (decorator = decorators[i])
|
|
1757
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1758
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
1759
|
+
return result;
|
|
1760
|
+
};
|
|
1761
|
+
const MODEL_TYPE$b = "lockout-model";
|
|
1762
|
+
const scheduleData = [
|
|
1763
|
+
{ day: "monday", lock: "dayWiseLockConfigMap.Mon.enabled", open: "dayWiseLockConfigMap.Mon.unlockTime", close: "dayWiseLockConfigMap.Mon.lockTime" },
|
|
1764
|
+
{ day: "tuesday", lock: "dayWiseLockConfigMap.Tue.enabled", open: "dayWiseLockConfigMap.Tue.unlockTime", close: "dayWiseLockConfigMap.Tue.lockTime" },
|
|
1765
|
+
{ day: "wednesday", lock: "dayWiseLockConfigMap.Wed.enabled", open: "dayWiseLockConfigMap.Wed.unlockTime", close: "dayWiseLockConfigMap.Wed.lockTime" },
|
|
1766
|
+
{ day: "thursday", lock: "dayWiseLockConfigMap.Thu.enabled", open: "dayWiseLockConfigMap.Thu.unlockTime", close: "dayWiseLockConfigMap.Thu.lockTime" },
|
|
1767
|
+
{ day: "friday", lock: "dayWiseLockConfigMap.Fri.enabled", open: "dayWiseLockConfigMap.Fri.unlockTime", close: "dayWiseLockConfigMap.Fri.lockTime" },
|
|
1768
|
+
{ day: "saturday", lock: "dayWiseLockConfigMap.Sat.enabled", open: "dayWiseLockConfigMap.Sat.unlockTime", close: "dayWiseLockConfigMap.Sat.lockTime" },
|
|
1769
|
+
{ day: "sunday", lock: "dayWiseLockConfigMap.Sun.enabled", open: "dayWiseLockConfigMap.Sun.unlockTime", close: "dayWiseLockConfigMap.Sun.lockTime" }
|
|
1770
|
+
];
|
|
1771
|
+
let LockoutModelImpl = class {
|
|
1772
|
+
id;
|
|
1773
|
+
logger;
|
|
1774
|
+
dayEnabledList = [
|
|
1775
|
+
"dayWiseLockConfigMap.Sun.enabled",
|
|
1776
|
+
"dayWiseLockConfigMap.Mon.enabled",
|
|
1777
|
+
"dayWiseLockConfigMap.Tue.enabled",
|
|
1778
|
+
"dayWiseLockConfigMap.Wed.enabled",
|
|
1779
|
+
"dayWiseLockConfigMap.Thu.enabled",
|
|
1780
|
+
"dayWiseLockConfigMap.Fri.enabled",
|
|
1781
|
+
"dayWiseLockConfigMap.Sat.enabled"
|
|
1782
|
+
];
|
|
1783
|
+
dayOpenAtList = [
|
|
1784
|
+
"dayWiseLockConfigMap.Sun.unlockTime",
|
|
1785
|
+
"dayWiseLockConfigMap.Mon.unlockTime",
|
|
1786
|
+
"dayWiseLockConfigMap.Tue.unlockTime",
|
|
1787
|
+
"dayWiseLockConfigMap.Wed.unlockTime",
|
|
1788
|
+
"dayWiseLockConfigMap.Thu.unlockTime",
|
|
1789
|
+
"dayWiseLockConfigMap.Fri.unlockTime",
|
|
1790
|
+
"dayWiseLockConfigMap.Sat.unlockTime"
|
|
1791
|
+
];
|
|
1792
|
+
dayCloseAtList = [
|
|
1793
|
+
"dayWiseLockConfigMap.Sun.lockTime",
|
|
1794
|
+
"dayWiseLockConfigMap.Mon.lockTime",
|
|
1795
|
+
"dayWiseLockConfigMap.Tue.lockTime",
|
|
1796
|
+
"dayWiseLockConfigMap.Wed.lockTime",
|
|
1797
|
+
"dayWiseLockConfigMap.Thu.lockTime",
|
|
1798
|
+
"dayWiseLockConfigMap.Fri.lockTime",
|
|
1799
|
+
"dayWiseLockConfigMap.Sat.lockTime"
|
|
1800
|
+
];
|
|
1801
|
+
saveMap;
|
|
1802
|
+
pin;
|
|
1803
|
+
nextLockSkipped;
|
|
1804
|
+
nextLockTime;
|
|
1805
|
+
nextUnLockTime;
|
|
1806
|
+
cuiLockout;
|
|
1807
|
+
get enabled() {
|
|
1808
|
+
const oneTimeLockConfigLockTime = this.getProp(
|
|
1809
|
+
"oneTimeLockConfig.lockTime"
|
|
1810
|
+
);
|
|
1811
|
+
const oneTimeLockEnabled = oneTimeLockConfigLockTime !== void 0 && oneTimeLockConfigLockTime !== "";
|
|
1812
|
+
const lockScheduleEnabled = this.getProp("lockScheduleEnabled");
|
|
1813
|
+
const enabled = oneTimeLockEnabled || lockScheduleEnabled;
|
|
1814
|
+
return enabled;
|
|
1815
|
+
}
|
|
1816
|
+
get schedule() {
|
|
1817
|
+
return scheduleData;
|
|
1818
|
+
}
|
|
1819
|
+
constructor(modelId, _options, context) {
|
|
1820
|
+
this.id = modelId;
|
|
1821
|
+
this.logger = context.logger;
|
|
1822
|
+
this.saveMap = /* @__PURE__ */ new Map();
|
|
1823
|
+
}
|
|
1824
|
+
getProp(key) {
|
|
1825
|
+
return this.saveMap.get(key);
|
|
1826
|
+
}
|
|
1827
|
+
setProp(key, value) {
|
|
1828
|
+
this.saveMap.set(key, value);
|
|
1829
|
+
}
|
|
1830
|
+
// Skip or resume the next lock...
|
|
1831
|
+
toggleSkip() {
|
|
1832
|
+
const nextLockSkipped = this.nextLockSkipped.value;
|
|
1833
|
+
if (nextLockSkipped === "0") {
|
|
1834
|
+
const nextLockTime = this.nextLockTime.value;
|
|
1835
|
+
if (nextLockTime !== void 0)
|
|
1836
|
+
this.nextLockSkipped.updateProperty(nextLockTime);
|
|
1837
|
+
} else {
|
|
1838
|
+
this.nextLockSkipped.updateProperty("0");
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
async unlock(pin) {
|
|
1842
|
+
return await unlock(pin);
|
|
1843
|
+
}
|
|
1844
|
+
async save() {
|
|
1845
|
+
this.saveMap.forEach((value, key) => {
|
|
1846
|
+
if (value !== this.cuiLockout.props[key])
|
|
1847
|
+
this.cuiLockout.props[key] = value;
|
|
1848
|
+
});
|
|
1849
|
+
return this.cuiLockout.updateConfigBean();
|
|
1850
|
+
}
|
|
1851
|
+
reset() {
|
|
1852
|
+
this.cuiLockout.props.entries.forEach(
|
|
1853
|
+
([key, value]) => this.saveMap.set(key, value)
|
|
1854
|
+
);
|
|
1855
|
+
}
|
|
1856
|
+
// -------------------LIFECYCLE----------------------------
|
|
1857
|
+
async init() {
|
|
1858
|
+
this.logger.debug(`initializing lockout ${this.id}`);
|
|
1859
|
+
this.cuiLockout.props.entries.forEach(
|
|
1860
|
+
([key, value]) => this.saveMap.set(key, value)
|
|
1861
|
+
);
|
|
1862
|
+
}
|
|
1863
|
+
async load() {
|
|
1864
|
+
this.logger.debug(`loading lockout ${this.id}`);
|
|
1865
|
+
}
|
|
1866
|
+
};
|
|
1867
|
+
__decorateClass$b([
|
|
1868
|
+
kosUiSdk.kosConfigProperty({
|
|
1869
|
+
path: "app:kosdev.ddk:service:cuiLockout",
|
|
1870
|
+
attribute: "pin"
|
|
1871
|
+
})
|
|
1872
|
+
], LockoutModelImpl.prototype, "pin", 2);
|
|
1873
|
+
__decorateClass$b([
|
|
1874
|
+
kosUiSdk.kosConfigProperty({
|
|
1875
|
+
path: "app:kosdev.ddk:service:cuiLockout",
|
|
1876
|
+
attribute: "nextLockSkipped"
|
|
1877
|
+
})
|
|
1878
|
+
], LockoutModelImpl.prototype, "nextLockSkipped", 2);
|
|
1879
|
+
__decorateClass$b([
|
|
1880
|
+
kosUiSdk.kosConfigProperty({
|
|
1881
|
+
path: "app:kosdev.ddk:service:cuiLockout",
|
|
1882
|
+
attribute: "nextLockTime"
|
|
1883
|
+
})
|
|
1884
|
+
], LockoutModelImpl.prototype, "nextLockTime", 2);
|
|
1885
|
+
__decorateClass$b([
|
|
1886
|
+
kosUiSdk.kosConfigProperty({
|
|
1887
|
+
path: "app:kosdev.ddk:service:cuiLockout",
|
|
1888
|
+
attribute: "nextUnLockTime"
|
|
1889
|
+
})
|
|
1890
|
+
], LockoutModelImpl.prototype, "nextUnLockTime", 2);
|
|
1891
|
+
__decorateClass$b([
|
|
1892
|
+
kosUiSdk.kosConfigBean({ path: "app:kosdev.ddk:service:cuiLockout" })
|
|
1893
|
+
], LockoutModelImpl.prototype, "cuiLockout", 2);
|
|
1894
|
+
LockoutModelImpl = __decorateClass$b([
|
|
1895
|
+
kosUiSdk.kosModel(MODEL_TYPE$b)
|
|
1896
|
+
], LockoutModelImpl);
|
|
1897
|
+
const Lockout = new kosUiSdk.SingletonKosModelRegistrationFactory({
|
|
1898
|
+
class: LockoutModelImpl,
|
|
1899
|
+
type: MODEL_TYPE$b
|
|
1900
|
+
});
|
|
1901
|
+
const purgeMacroPumps = async (troubleIds, tracker) => {
|
|
1902
|
+
const response = await kosUiSdk.TroubleServices.bulkResolveTroubles(
|
|
1903
|
+
troubleIds,
|
|
1904
|
+
void 0,
|
|
1905
|
+
tracker
|
|
1906
|
+
);
|
|
1907
|
+
return response;
|
|
1908
|
+
};
|
|
1909
|
+
var __defProp$7 = Object.defineProperty;
|
|
1910
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
1911
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
1912
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
1913
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1914
|
+
if (decorator = decorators[i])
|
|
1915
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1916
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
1917
|
+
return result;
|
|
1918
|
+
};
|
|
1919
|
+
const MODEL_TYPE$a = "macro-assignment-model";
|
|
1920
|
+
const TROUBLE_TYPE_PURGE = "PurgeTrouble";
|
|
1921
|
+
const TROUBLE_TYPE_PRIME = "PrimeTrouble";
|
|
1922
|
+
let MacroAssignmentModelImpl = class {
|
|
1923
|
+
id;
|
|
1924
|
+
logger;
|
|
1925
|
+
/**
|
|
1926
|
+
* futureHandler is used to handle async operations
|
|
1927
|
+
*/
|
|
1928
|
+
futureHandler;
|
|
1929
|
+
holders;
|
|
1930
|
+
ingredients;
|
|
1931
|
+
constructor(modelId, _options, context) {
|
|
1932
|
+
this.id = modelId;
|
|
1933
|
+
this.futureHandler = new kosUiSdk.FutureHandler();
|
|
1934
|
+
this.logger = context.logger;
|
|
1935
|
+
}
|
|
1936
|
+
/**
|
|
1937
|
+
* shortcut to the current running future
|
|
1938
|
+
*/
|
|
1939
|
+
get future() {
|
|
1940
|
+
return this.futureHandler.future;
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* Represents the subset of holder that are identified as holding macros.
|
|
1944
|
+
*
|
|
1945
|
+
* This is determined by the group property of the holder which is determined
|
|
1946
|
+
* by the holders position in the dispenser assembly.
|
|
1947
|
+
*/
|
|
1948
|
+
get macroHolders() {
|
|
1949
|
+
return this.holders.holders.getIndexByKey("group", "macros").sort((a, b) => {
|
|
1950
|
+
if (a.name < b.name) return -1;
|
|
1951
|
+
if (a.name > b.name) return 1;
|
|
1952
|
+
return 0;
|
|
1953
|
+
});
|
|
1954
|
+
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Returns true if there are any macro holders in the dispenser assembly
|
|
1957
|
+
*/
|
|
1958
|
+
get hasMacroHolders() {
|
|
1959
|
+
return this.macroHolders.length > 0;
|
|
1960
|
+
}
|
|
1961
|
+
/**
|
|
1962
|
+
* Returns all of the purge troubles for the macro holders.
|
|
1963
|
+
*
|
|
1964
|
+
* Relying on the indexing of troubles by type to find the purge troubles.
|
|
1965
|
+
*/
|
|
1966
|
+
get holderPurgeTroubles() {
|
|
1967
|
+
const troubles = this.macroHolders.reduce((acc, curr) => {
|
|
1968
|
+
const purgeTroubles = curr.troublesByType[TROUBLE_TYPE_PURGE] || [];
|
|
1969
|
+
acc = [...acc, ...purgeTroubles];
|
|
1970
|
+
return acc;
|
|
1971
|
+
}, []);
|
|
1972
|
+
return troubles;
|
|
1973
|
+
}
|
|
1974
|
+
get holderPrimeTroubles() {
|
|
1975
|
+
const troubles = this.macroHolders.reduce((acc, curr) => {
|
|
1976
|
+
const primeTroubles = curr.troublesByType[TROUBLE_TYPE_PRIME] || [];
|
|
1977
|
+
acc = [...acc, ...primeTroubles];
|
|
1978
|
+
return acc;
|
|
1979
|
+
}, []);
|
|
1980
|
+
return troubles;
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* Returns true if there are any purge troubles for the macro holders.
|
|
1984
|
+
*/
|
|
1985
|
+
get hasHolderPurgeTroubles() {
|
|
1986
|
+
return this.holderPurgeTroubles.length > 0;
|
|
1987
|
+
}
|
|
1988
|
+
get hasHolderPrimeTroubles() {
|
|
1989
|
+
return this.holderPrimeTroubles.length > 0;
|
|
1990
|
+
}
|
|
1991
|
+
/**
|
|
1992
|
+
* Represents the subset of ingredients that are identified as macros
|
|
1993
|
+
*
|
|
1994
|
+
* This is determined by the `ingredientMacro` property of the ingredient
|
|
1995
|
+
* which is derived from the `bib` and `sweetener` properties of the ingredient.
|
|
1996
|
+
*
|
|
1997
|
+
* The `ingredientMacro` property is set by the `ingredientDataMapper` extension point.
|
|
1998
|
+
*
|
|
1999
|
+
* The macro ingredients are indexed by the `ingredientIndexExtension` extension point using
|
|
2000
|
+
* the `ingredientMacro` property.
|
|
2001
|
+
*/
|
|
2002
|
+
get macroIngredients() {
|
|
2003
|
+
return this.ingredients.ingredients.getIndexByKey("macro", "macro");
|
|
2004
|
+
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Returns true if there are any macro ingredients in the dispenser brandset
|
|
2007
|
+
*/
|
|
2008
|
+
get hasMacroIngredients() {
|
|
2009
|
+
return this.macroIngredients.length > 0;
|
|
2010
|
+
}
|
|
2011
|
+
async resolveAll(type, tracker) {
|
|
2012
|
+
if (!tracker) {
|
|
2013
|
+
throw new Error("No tracker provided");
|
|
2014
|
+
}
|
|
2015
|
+
const container = type === TROUBLE_TYPE_PURGE ? this.holderPurgeTroubles : this.holderPrimeTroubles;
|
|
2016
|
+
const allTroubles = container.map((trouble) => trouble.rawId);
|
|
2017
|
+
const response = await purgeMacroPumps(allTroubles, tracker);
|
|
2018
|
+
return response;
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
__decorateClass$a([
|
|
2022
|
+
kosUiSdk.kosDependency({ modelType: kosDispenseSdk.HolderContainer.type })
|
|
2023
|
+
], MacroAssignmentModelImpl.prototype, "holders", 2);
|
|
2024
|
+
__decorateClass$a([
|
|
2025
|
+
kosUiSdk.kosDependency({ modelType: kosDispenseSdk.IngredientContainer.type })
|
|
2026
|
+
], MacroAssignmentModelImpl.prototype, "ingredients", 2);
|
|
2027
|
+
__decorateClass$a([
|
|
2028
|
+
kosUiSdk.kosFuture()
|
|
2029
|
+
], MacroAssignmentModelImpl.prototype, "resolveAll", 1);
|
|
2030
|
+
MacroAssignmentModelImpl = __decorateClass$a([
|
|
2031
|
+
kosUiSdk.kosModel(MODEL_TYPE$a)
|
|
2032
|
+
], MacroAssignmentModelImpl);
|
|
2033
|
+
const MacroAssignment = {
|
|
2034
|
+
registration: {
|
|
2035
|
+
[MODEL_TYPE$a]: {
|
|
2036
|
+
class: MacroAssignmentModelImpl,
|
|
2037
|
+
singleton: true
|
|
2038
|
+
}
|
|
2039
|
+
},
|
|
2040
|
+
type: MODEL_TYPE$a,
|
|
2041
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$a),
|
|
2042
|
+
factory: kosUiSdk.Kos.Singleton.create(
|
|
2043
|
+
MODEL_TYPE$a
|
|
2044
|
+
)
|
|
2045
|
+
};
|
|
2046
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
2047
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
2048
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
2049
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2050
|
+
if (decorator = decorators[i])
|
|
2051
|
+
result = decorator(result) || result;
|
|
2052
|
+
return result;
|
|
2053
|
+
};
|
|
2054
|
+
const MODEL_TYPE$9 = "network-test-model";
|
|
2055
|
+
let NetworkTestModelImpl = class {
|
|
2056
|
+
id;
|
|
2057
|
+
group;
|
|
2058
|
+
passed;
|
|
2059
|
+
inProgress;
|
|
2060
|
+
failureTime;
|
|
2061
|
+
timestamp;
|
|
2062
|
+
name;
|
|
2063
|
+
results;
|
|
2064
|
+
logger;
|
|
2065
|
+
constructor(modelId, options, context) {
|
|
2066
|
+
this.id = modelId;
|
|
2067
|
+
this.logger = context.logger;
|
|
2068
|
+
this.group = options.group;
|
|
2069
|
+
this.passed = false;
|
|
2070
|
+
this.inProgress = false;
|
|
2071
|
+
this.name = options.name;
|
|
2072
|
+
this.results = [];
|
|
2073
|
+
}
|
|
2074
|
+
updateModel(options) {
|
|
2075
|
+
this.group = options.group;
|
|
2076
|
+
this.name = options.name;
|
|
2077
|
+
this.passed = options.passed;
|
|
2078
|
+
this.failureTime = options.failureTime;
|
|
2079
|
+
this.inProgress = options.inProgress;
|
|
2080
|
+
this.timestamp = options.timestamp;
|
|
2081
|
+
this.results = options.results;
|
|
2082
|
+
}
|
|
2083
|
+
// -------------------LIFECYCLE----------------------------
|
|
2084
|
+
async init() {
|
|
2085
|
+
this.logger.debug(`initializing network-test ${this.id}`);
|
|
2086
|
+
}
|
|
2087
|
+
async load() {
|
|
2088
|
+
this.logger.debug(`loading network-test ${this.id}`);
|
|
2089
|
+
}
|
|
2090
|
+
};
|
|
2091
|
+
NetworkTestModelImpl = __decorateClass$9([
|
|
2092
|
+
kosUiSdk.kosModel(MODEL_TYPE$9)
|
|
2093
|
+
], NetworkTestModelImpl);
|
|
2094
|
+
const NetworkTest = {
|
|
2095
|
+
registration: {
|
|
2096
|
+
[MODEL_TYPE$9]: {
|
|
2097
|
+
class: NetworkTestModelImpl,
|
|
2098
|
+
singleton: false
|
|
2099
|
+
}
|
|
2100
|
+
},
|
|
2101
|
+
type: MODEL_TYPE$9,
|
|
2102
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$9),
|
|
2103
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$9)
|
|
2104
|
+
};
|
|
2105
|
+
const { URL: URL$4 } = kosUiSdk.resolveServiceUrl("NETWORK-TEST_SERVICE");
|
|
2106
|
+
const { getAll: getAll$2, getOne: getOne$1 } = kosUiSdk.ServiceFactory.build({
|
|
2107
|
+
basePath: `${URL$4}/api/app/ncui/network/tests`
|
|
2108
|
+
});
|
|
2109
|
+
const log$4 = kosUiSdk.KosLog.createLogger({
|
|
2110
|
+
name: "network-test-service",
|
|
2111
|
+
group: "Services"
|
|
2112
|
+
});
|
|
2113
|
+
const getNetworkTests = async () => {
|
|
2114
|
+
log$4.debug("sending GET for network-test");
|
|
2115
|
+
const response = await getAll$2({
|
|
2116
|
+
urlOverride: `${URL$4}/api/app/kosdev.ddk/network/tests`
|
|
2117
|
+
});
|
|
2118
|
+
return response?.data;
|
|
2119
|
+
};
|
|
2120
|
+
const getTestsReports = async () => {
|
|
2121
|
+
const response = await getOne$1({
|
|
2122
|
+
urlOverride: `${URL$4}/api/app/kosdev.ddk/network/reports`
|
|
2123
|
+
});
|
|
2124
|
+
return response?.data;
|
|
2125
|
+
};
|
|
2126
|
+
const performGroupTest = async (group, tracker) => {
|
|
2127
|
+
const response = await getOne$1({
|
|
2128
|
+
urlOverride: `${URL$4}/api/app/kosdev.ddk/network/tests/run/group/${group}`,
|
|
2129
|
+
tracker
|
|
2130
|
+
});
|
|
2131
|
+
return response;
|
|
2132
|
+
};
|
|
2133
|
+
const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2134
|
+
__proto__: null,
|
|
2135
|
+
getNetworkTests,
|
|
2136
|
+
getTestsReports,
|
|
2137
|
+
performGroupTest
|
|
2138
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2139
|
+
var __defProp$6 = Object.defineProperty;
|
|
2140
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
2141
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
2142
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
2143
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2144
|
+
if (decorator = decorators[i])
|
|
2145
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2146
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
2147
|
+
return result;
|
|
2148
|
+
};
|
|
2149
|
+
const MODEL_TYPE$8 = "network-test-container-model";
|
|
2150
|
+
let NetworkTestContainerModelImpl = class {
|
|
2151
|
+
id;
|
|
2152
|
+
logger;
|
|
2153
|
+
lastTested;
|
|
2154
|
+
futureHandler;
|
|
2155
|
+
models;
|
|
2156
|
+
constructor(modelId, options, context) {
|
|
2157
|
+
this.id = modelId;
|
|
2158
|
+
this.logger = context.logger;
|
|
2159
|
+
this.futureHandler = new kosUiSdk.FutureHandler(this);
|
|
2160
|
+
this.models = new kosUiSdk.KosModelContainer({
|
|
2161
|
+
parentId: modelId,
|
|
2162
|
+
indexMap: {
|
|
2163
|
+
group: "group"
|
|
2164
|
+
}
|
|
2165
|
+
});
|
|
2166
|
+
this.lastTested = /* @__PURE__ */ new Date("default");
|
|
2167
|
+
}
|
|
2168
|
+
get data() {
|
|
2169
|
+
return this.models.data;
|
|
2170
|
+
}
|
|
2171
|
+
addModel(model) {
|
|
2172
|
+
this.models.addModel(model);
|
|
2173
|
+
}
|
|
2174
|
+
removeModel(id) {
|
|
2175
|
+
this.models.removeModel(id);
|
|
2176
|
+
}
|
|
2177
|
+
getModel(id) {
|
|
2178
|
+
return this.models.getModel(id);
|
|
2179
|
+
}
|
|
2180
|
+
// -------------------LIFECYCLE----------------------------
|
|
2181
|
+
async init() {
|
|
2182
|
+
this.logger.debug(
|
|
2183
|
+
`initializing network-test-container container ${this.id}`
|
|
2184
|
+
);
|
|
2185
|
+
}
|
|
2186
|
+
getLastTested(groupName) {
|
|
2187
|
+
const dateArray = this.models.getIndexByKey("group", groupName).map((obj) => obj.timestamp && new Date(obj.timestamp));
|
|
2188
|
+
const latestDate = Math.max(
|
|
2189
|
+
...dateArray.map((date) => date ? date.getTime() : 0)
|
|
2190
|
+
);
|
|
2191
|
+
return latestDate ? calculateTimeDifference(new Date(latestDate)) : "";
|
|
2192
|
+
}
|
|
2193
|
+
async load() {
|
|
2194
|
+
this.logger.debug(`loading network-test-container container ${this.id}`);
|
|
2195
|
+
const testResponse = await getNetworkTests();
|
|
2196
|
+
const testReportResponse = await getTestsReports();
|
|
2197
|
+
if (testResponse) {
|
|
2198
|
+
testResponse.forEach((item) => {
|
|
2199
|
+
const testModel = NetworkTest.factory(item.id)(item);
|
|
2200
|
+
this.addModel(testModel);
|
|
2201
|
+
});
|
|
2202
|
+
}
|
|
2203
|
+
if (testResponse && testReportResponse) {
|
|
2204
|
+
testResponse.forEach((item) => {
|
|
2205
|
+
const groupReport = testReportResponse?.[item.group];
|
|
2206
|
+
const testReport = groupReport?.[item.id];
|
|
2207
|
+
const testModel = this.getModel(item.id);
|
|
2208
|
+
if (testModel && testReport) {
|
|
2209
|
+
const update = {
|
|
2210
|
+
group: testReport.group,
|
|
2211
|
+
name: testReport.name,
|
|
2212
|
+
passed: testReport.passed,
|
|
2213
|
+
failureTime: testReport.failureTime ? new Date(testReport.failureTime) : void 0,
|
|
2214
|
+
inProgress: testReport.inProgress,
|
|
2215
|
+
timestamp: new Date(testReport.timestamp),
|
|
2216
|
+
results: testReport.results
|
|
2217
|
+
};
|
|
2218
|
+
testModel.updateModel(update);
|
|
2219
|
+
}
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
async performTest(group, tracker) {
|
|
2224
|
+
if (!tracker) {
|
|
2225
|
+
throw new Error("No tracker provided");
|
|
2226
|
+
}
|
|
2227
|
+
const result = await performGroupTest(group, tracker);
|
|
2228
|
+
return result?.data;
|
|
2229
|
+
}
|
|
2230
|
+
onFutureUpdate(future) {
|
|
2231
|
+
const { clientData } = future;
|
|
2232
|
+
if (clientData) {
|
|
2233
|
+
clientData.forEach((item) => {
|
|
2234
|
+
const testModel = this.getModel(item.id);
|
|
2235
|
+
kosUiSdk.kosAction(() => {
|
|
2236
|
+
this.lastTested = this.lastTested > new Date(item.timestamp) ? this.lastTested : new Date(item.timestamp);
|
|
2237
|
+
});
|
|
2238
|
+
if (testModel) {
|
|
2239
|
+
const update = {
|
|
2240
|
+
group: item.group,
|
|
2241
|
+
name: item.name,
|
|
2242
|
+
passed: item.passed,
|
|
2243
|
+
failureTime: item.failureTime ? new Date(item.failureTime) : void 0,
|
|
2244
|
+
inProgress: item.inProgress,
|
|
2245
|
+
timestamp: new Date(item.timestamp),
|
|
2246
|
+
results: item.results
|
|
2247
|
+
};
|
|
2248
|
+
kosUiSdk.kosAction(() => {
|
|
2249
|
+
testModel.updateModel(update);
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
});
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
};
|
|
2256
|
+
__decorateClass$8([
|
|
2257
|
+
kosUiSdk.kosChild
|
|
2258
|
+
], NetworkTestContainerModelImpl.prototype, "models", 2);
|
|
2259
|
+
__decorateClass$8([
|
|
2260
|
+
kosUiSdk.kosFuture()
|
|
2261
|
+
], NetworkTestContainerModelImpl.prototype, "performTest", 1);
|
|
2262
|
+
NetworkTestContainerModelImpl = __decorateClass$8([
|
|
2263
|
+
kosUiSdk.kosModel(MODEL_TYPE$8)
|
|
2264
|
+
], NetworkTestContainerModelImpl);
|
|
2265
|
+
const NetworkTestContainer = {
|
|
2266
|
+
registration: {
|
|
2267
|
+
[MODEL_TYPE$8]: {
|
|
2268
|
+
class: NetworkTestContainerModelImpl,
|
|
2269
|
+
singleton: true
|
|
2270
|
+
},
|
|
2271
|
+
...NetworkTest.registration
|
|
2272
|
+
},
|
|
2273
|
+
type: MODEL_TYPE$8,
|
|
2274
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$8),
|
|
2275
|
+
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$8)
|
|
2276
|
+
};
|
|
2277
|
+
var __defProp$5 = Object.defineProperty;
|
|
2278
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
2279
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
2280
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
2281
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2282
|
+
if (decorator = decorators[i])
|
|
2283
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2284
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
2285
|
+
return result;
|
|
2286
|
+
};
|
|
2287
|
+
const MODEL_TYPE$7 = "nutritive-sweetener-model";
|
|
2288
|
+
const PATH_PUMP_STATE = kosUiSdk.createPropKey("statePath");
|
|
2289
|
+
let NutritiveSweetenerModelImpl = class {
|
|
2290
|
+
id;
|
|
2291
|
+
assemblyModel;
|
|
2292
|
+
pumpState;
|
|
2293
|
+
constructor(modelId, _options) {
|
|
2294
|
+
this.id = modelId;
|
|
2295
|
+
}
|
|
2296
|
+
get holder() {
|
|
2297
|
+
const nsHolder = this.assemblyModel.getHoldersByGroup("ns")[0];
|
|
2298
|
+
return nsHolder;
|
|
2299
|
+
}
|
|
2300
|
+
getHolder() {
|
|
2301
|
+
return this.holder;
|
|
2302
|
+
}
|
|
2303
|
+
get statePath() {
|
|
2304
|
+
return `${this.pump.path}:airVent:state`;
|
|
2305
|
+
}
|
|
2306
|
+
get pump() {
|
|
2307
|
+
return this.holder.pumps.data[0];
|
|
2308
|
+
}
|
|
2309
|
+
getPump() {
|
|
2310
|
+
return this.pump;
|
|
2311
|
+
}
|
|
2312
|
+
};
|
|
2313
|
+
__decorateClass$7([
|
|
2314
|
+
kosUiSdk.kosDependency({ modelType: kosDispenseSdk.Assembly.type })
|
|
2315
|
+
], NutritiveSweetenerModelImpl.prototype, "assemblyModel", 2);
|
|
2316
|
+
__decorateClass$7([
|
|
2317
|
+
kosUiSdk.kosStateBean({
|
|
2318
|
+
path: PATH_PUMP_STATE
|
|
2319
|
+
})
|
|
2320
|
+
], NutritiveSweetenerModelImpl.prototype, "pumpState", 2);
|
|
2321
|
+
NutritiveSweetenerModelImpl = __decorateClass$7([
|
|
2322
|
+
kosUiSdk.kosModel(MODEL_TYPE$7),
|
|
2323
|
+
kosUiSdk.kosLoggerAware()
|
|
2324
|
+
], NutritiveSweetenerModelImpl);
|
|
2325
|
+
const NutritiveSweetener = {
|
|
2326
|
+
registration: {
|
|
2327
|
+
[MODEL_TYPE$7]: {
|
|
2328
|
+
class: NutritiveSweetenerModelImpl,
|
|
2329
|
+
singleton: false
|
|
2330
|
+
}
|
|
2331
|
+
},
|
|
2332
|
+
type: MODEL_TYPE$7,
|
|
2333
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$7),
|
|
2334
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$7)
|
|
2335
|
+
};
|
|
2336
|
+
var __defProp$4 = Object.defineProperty;
|
|
2337
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
2338
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
2339
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
2340
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2341
|
+
if (decorator = decorators[i])
|
|
2342
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2343
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
2344
|
+
return result;
|
|
2345
|
+
};
|
|
2346
|
+
const MODEL_TYPE$6 = "plain-water-model";
|
|
2347
|
+
let PlainWaterModelImpl = class {
|
|
2348
|
+
id;
|
|
2349
|
+
assemblyModel;
|
|
2350
|
+
logger;
|
|
2351
|
+
constructor(modelId, _options, context) {
|
|
2352
|
+
this.id = modelId;
|
|
2353
|
+
this.logger = context.logger;
|
|
2354
|
+
}
|
|
2355
|
+
getHolder() {
|
|
2356
|
+
const waterHolder = this.assemblyModel.getHoldersByGroup("water")[0];
|
|
2357
|
+
return waterHolder;
|
|
2358
|
+
}
|
|
2359
|
+
getPump() {
|
|
2360
|
+
const waterHolder = this.getHolder();
|
|
2361
|
+
const pump = waterHolder?.pumps?.data?.[0];
|
|
2362
|
+
const model = kosUiSdk.getKosCompanionModel(pump, kosFreestyleSdk.FcmPump.type);
|
|
2363
|
+
return model;
|
|
2364
|
+
}
|
|
2365
|
+
// -------------------LIFECYCLE----------------------------
|
|
2366
|
+
async init() {
|
|
2367
|
+
this.logger.debug(`initializing plain-water ${this.id}`);
|
|
2368
|
+
}
|
|
2369
|
+
async load() {
|
|
2370
|
+
this.logger.debug(`loading plain-water ${this.id}`);
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2373
|
+
__decorateClass$6([
|
|
2374
|
+
kosUiSdk.kosDependency({ modelType: kosDispenseSdk.Assembly.type })
|
|
2375
|
+
], PlainWaterModelImpl.prototype, "assemblyModel", 2);
|
|
2376
|
+
PlainWaterModelImpl = __decorateClass$6([
|
|
2377
|
+
kosUiSdk.kosModel(MODEL_TYPE$6)
|
|
2378
|
+
], PlainWaterModelImpl);
|
|
2379
|
+
const PlainWater = {
|
|
2380
|
+
registration: {
|
|
2381
|
+
[MODEL_TYPE$6]: {
|
|
2382
|
+
class: PlainWaterModelImpl,
|
|
2383
|
+
singleton: false
|
|
2384
|
+
}
|
|
2385
|
+
},
|
|
2386
|
+
type: MODEL_TYPE$6,
|
|
2387
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$6),
|
|
2388
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$6)
|
|
2389
|
+
};
|
|
2390
|
+
const { URL: URL$3 } = kosUiSdk.resolveServiceUrl("REBOOT_SERVICE");
|
|
2391
|
+
const { postModel } = kosUiSdk.ServiceFactory.build({
|
|
2392
|
+
basePath: `${URL$3}/api/reboot`
|
|
2393
|
+
});
|
|
2394
|
+
const log$3 = kosUiSdk.KosLog.createLogger({ name: "reboot-service", group: "Services" });
|
|
2395
|
+
const rebootDispenser = async () => {
|
|
2396
|
+
log$3.debug("sending POST call for Reboot Dispenser");
|
|
2397
|
+
const response = await postModel({
|
|
2398
|
+
urlOverride: `${URL$3}/api/app/kosdev.ddk/ncui/reboot`,
|
|
2399
|
+
model: {}
|
|
2400
|
+
});
|
|
2401
|
+
return response;
|
|
2402
|
+
};
|
|
2403
|
+
const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2404
|
+
__proto__: null,
|
|
2405
|
+
rebootDispenser
|
|
2406
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2407
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
2408
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
2409
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
2410
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2411
|
+
if (decorator = decorators[i])
|
|
2412
|
+
result = decorator(result) || result;
|
|
2413
|
+
return result;
|
|
2414
|
+
};
|
|
2415
|
+
const MODEL_TYPE$5 = "reboot-model";
|
|
2416
|
+
let RebootModelImpl = class {
|
|
2417
|
+
id;
|
|
2418
|
+
logger;
|
|
2419
|
+
constructor(modelId, options, context) {
|
|
2420
|
+
this.id = modelId;
|
|
2421
|
+
this.logger = context.logger;
|
|
2422
|
+
}
|
|
2423
|
+
async completeReboot() {
|
|
2424
|
+
await rebootDispenser();
|
|
2425
|
+
}
|
|
2426
|
+
updateModel() {
|
|
2427
|
+
}
|
|
2428
|
+
// -------------------LIFECYCLE----------------------------
|
|
2429
|
+
async init() {
|
|
2430
|
+
this.logger.debug(`initializing reboot ${this.id}`);
|
|
2431
|
+
}
|
|
2432
|
+
async load() {
|
|
2433
|
+
this.logger.debug(`loading reboot ${this.id}`);
|
|
2434
|
+
}
|
|
2435
|
+
};
|
|
2436
|
+
RebootModelImpl = __decorateClass$5([
|
|
2437
|
+
kosUiSdk.kosModel(MODEL_TYPE$5)
|
|
2438
|
+
], RebootModelImpl);
|
|
2439
|
+
const Reboot = {
|
|
2440
|
+
registration: {
|
|
2441
|
+
[MODEL_TYPE$5]: {
|
|
2442
|
+
class: RebootModelImpl,
|
|
2443
|
+
singleton: false
|
|
2444
|
+
}
|
|
2445
|
+
},
|
|
2446
|
+
type: MODEL_TYPE$5,
|
|
2447
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$5),
|
|
2448
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$5)
|
|
2449
|
+
};
|
|
2450
|
+
var __defProp$3 = Object.defineProperty;
|
|
2451
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
2452
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
2453
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
2454
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2455
|
+
if (decorator = decorators[i])
|
|
2456
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2457
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
2458
|
+
return result;
|
|
2459
|
+
};
|
|
2460
|
+
const MODEL_TYPE$4 = "settings-model";
|
|
2461
|
+
let SettingsModelImpl = class {
|
|
2462
|
+
id;
|
|
2463
|
+
logger;
|
|
2464
|
+
ncuiLanguageData;
|
|
2465
|
+
resolveDelaysMs;
|
|
2466
|
+
dateFormat;
|
|
2467
|
+
timeFormat;
|
|
2468
|
+
hidePlainWaterBev;
|
|
2469
|
+
hideCarbWaterBev;
|
|
2470
|
+
ncuiLanguage;
|
|
2471
|
+
name;
|
|
2472
|
+
activateAndRebootTime;
|
|
2473
|
+
horizontalMode;
|
|
2474
|
+
constructor(modelId, _options, context) {
|
|
2475
|
+
this.id = modelId;
|
|
2476
|
+
this.logger = context.logger;
|
|
2477
|
+
}
|
|
2478
|
+
// -------------------LIFECYCLE----------------------------
|
|
2479
|
+
async ready() {
|
|
2480
|
+
this.updateDisplayMode();
|
|
2481
|
+
}
|
|
2482
|
+
async getNcuiLanguageList() {
|
|
2483
|
+
this.ncuiLanguageData = {
|
|
2484
|
+
status: 200,
|
|
2485
|
+
data: {
|
|
2486
|
+
languages: [
|
|
2487
|
+
{
|
|
2488
|
+
name: "English",
|
|
2489
|
+
locale: "en"
|
|
2490
|
+
}
|
|
2491
|
+
]
|
|
2492
|
+
}
|
|
2493
|
+
};
|
|
2494
|
+
}
|
|
2495
|
+
async load() {
|
|
2496
|
+
this.logger.debug(`loading settings ${this.id}`);
|
|
2497
|
+
this.ncuiLanguageData = {
|
|
2498
|
+
status: 200,
|
|
2499
|
+
data: {
|
|
2500
|
+
languages: [
|
|
2501
|
+
{
|
|
2502
|
+
name: "English",
|
|
2503
|
+
locale: "en"
|
|
2504
|
+
}
|
|
2505
|
+
]
|
|
2506
|
+
}
|
|
2507
|
+
};
|
|
2508
|
+
}
|
|
2509
|
+
handleUpdateDisplayMode() {
|
|
2510
|
+
this.updateDisplayMode();
|
|
2511
|
+
}
|
|
2512
|
+
updateDisplayMode() {
|
|
2513
|
+
if (this.horizontalMode.value) {
|
|
2514
|
+
document.body.setAttribute("data-dashboard-layout", "horizontal");
|
|
2515
|
+
} else {
|
|
2516
|
+
document.body.setAttribute("data-dashboard-layout", "vertical");
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
};
|
|
2520
|
+
__decorateClass$4([
|
|
2521
|
+
kosUiSdk.kosConfigProperty({
|
|
2522
|
+
path: "system:app",
|
|
2523
|
+
attribute: "resolveDelaysMs"
|
|
2524
|
+
// optionsExpander: () => [],
|
|
2525
|
+
})
|
|
2526
|
+
], SettingsModelImpl.prototype, "resolveDelaysMs", 2);
|
|
2527
|
+
__decorateClass$4([
|
|
2528
|
+
kosUiSdk.kosConfigProperty({
|
|
2529
|
+
path: "system:app",
|
|
2530
|
+
attribute: "dateFormat"
|
|
2531
|
+
// optionsExpander: () => [],
|
|
2532
|
+
})
|
|
2533
|
+
], SettingsModelImpl.prototype, "dateFormat", 2);
|
|
2534
|
+
__decorateClass$4([
|
|
2535
|
+
kosUiSdk.kosConfigProperty({
|
|
2536
|
+
path: "system:app",
|
|
2537
|
+
attribute: "timeFormat"
|
|
2538
|
+
// optionsExpander: () => [],
|
|
2539
|
+
})
|
|
2540
|
+
], SettingsModelImpl.prototype, "timeFormat", 2);
|
|
2541
|
+
__decorateClass$4([
|
|
2542
|
+
kosUiSdk.kosConfigProperty({
|
|
2543
|
+
path: "app:kosdev.ddk:app",
|
|
2544
|
+
attribute: "ncui.hidePlainWaterBev"
|
|
2545
|
+
})
|
|
2546
|
+
], SettingsModelImpl.prototype, "hidePlainWaterBev", 2);
|
|
2547
|
+
__decorateClass$4([
|
|
2548
|
+
kosUiSdk.kosConfigProperty({
|
|
2549
|
+
path: "app:kosdev.ddk:app",
|
|
2550
|
+
attribute: "ncui.hideCarbWaterBev"
|
|
2551
|
+
})
|
|
2552
|
+
], SettingsModelImpl.prototype, "hideCarbWaterBev", 2);
|
|
2553
|
+
__decorateClass$4([
|
|
2554
|
+
kosUiSdk.kosConfigProperty({
|
|
2555
|
+
path: "app:kosdev.ddk:app",
|
|
2556
|
+
attribute: "ncui.ncuiLanguage"
|
|
2557
|
+
})
|
|
2558
|
+
], SettingsModelImpl.prototype, "ncuiLanguage", 2);
|
|
2559
|
+
__decorateClass$4([
|
|
2560
|
+
kosUiSdk.kosConfigProperty({
|
|
2561
|
+
path: "kos:device",
|
|
2562
|
+
attribute: "name"
|
|
2563
|
+
})
|
|
2564
|
+
], SettingsModelImpl.prototype, "name", 2);
|
|
2565
|
+
__decorateClass$4([
|
|
2566
|
+
kosUiSdk.kosConfigProperty({
|
|
2567
|
+
path: "kos:service:OTA",
|
|
2568
|
+
attribute: "activateAndRebootTime"
|
|
2569
|
+
})
|
|
2570
|
+
], SettingsModelImpl.prototype, "activateAndRebootTime", 2);
|
|
2571
|
+
__decorateClass$4([
|
|
2572
|
+
kosUiSdk.kosConfigProperty({
|
|
2573
|
+
path: "app:kosdev.ddk:app",
|
|
2574
|
+
attribute: "ncui.uiConfig.display.horizontalMode"
|
|
2575
|
+
})
|
|
2576
|
+
], SettingsModelImpl.prototype, "horizontalMode", 2);
|
|
2577
|
+
__decorateClass$4([
|
|
2578
|
+
kosUiSdk.kosModelEffect({
|
|
2579
|
+
dependencies: (model) => [model.horizontalMode.value]
|
|
2580
|
+
})
|
|
2581
|
+
], SettingsModelImpl.prototype, "handleUpdateDisplayMode", 1);
|
|
2582
|
+
SettingsModelImpl = __decorateClass$4([
|
|
2583
|
+
kosUiSdk.kosModel(MODEL_TYPE$4)
|
|
2584
|
+
], SettingsModelImpl);
|
|
2585
|
+
const Settings = {
|
|
2586
|
+
registration: {
|
|
2587
|
+
[MODEL_TYPE$4]: {
|
|
2588
|
+
class: SettingsModelImpl,
|
|
2589
|
+
singleton: true
|
|
2590
|
+
}
|
|
2591
|
+
},
|
|
2592
|
+
type: MODEL_TYPE$4,
|
|
2593
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$4),
|
|
2594
|
+
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$4)
|
|
2595
|
+
};
|
|
2596
|
+
const { URL: URL$2 } = kosUiSdk.resolveServiceUrl("SETTINGS_SERVICE");
|
|
2597
|
+
const { getAll: getAll$1 } = kosUiSdk.ServiceFactory.build({
|
|
2598
|
+
basePath: `${URL$2}/api/settings`
|
|
2599
|
+
});
|
|
2600
|
+
const log$2 = kosUiSdk.KosLog.createLogger({
|
|
2601
|
+
name: "settings-service",
|
|
2602
|
+
group: "Services"
|
|
2603
|
+
});
|
|
2604
|
+
const getSettings = async () => {
|
|
2605
|
+
log$2.debug("sending GET for settings");
|
|
2606
|
+
const response = await getAll$1({});
|
|
2607
|
+
return response;
|
|
2608
|
+
};
|
|
2609
|
+
const getNcuiLanguage = async () => {
|
|
2610
|
+
const response = await getAll$1({
|
|
2611
|
+
urlOverride: `${URL$2}api/app/kosdev.ddk/ncui/languages`
|
|
2612
|
+
});
|
|
2613
|
+
return response;
|
|
2614
|
+
};
|
|
2615
|
+
const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2616
|
+
__proto__: null,
|
|
2617
|
+
getNcuiLanguage,
|
|
2618
|
+
getSettings
|
|
2619
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2620
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
2621
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
2622
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
2623
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2624
|
+
if (decorator = decorators[i])
|
|
2625
|
+
result = decorator(result) || result;
|
|
2626
|
+
return result;
|
|
2627
|
+
};
|
|
2628
|
+
const MODEL_TYPE$3 = "utilities-model";
|
|
2629
|
+
let UtilitiesModelImpl = class {
|
|
2630
|
+
id;
|
|
2631
|
+
name;
|
|
2632
|
+
options;
|
|
2633
|
+
roles;
|
|
2634
|
+
columnId;
|
|
2635
|
+
logger;
|
|
2636
|
+
constructor(modelId, options, context) {
|
|
2637
|
+
this.id = modelId;
|
|
2638
|
+
this.logger = context.logger;
|
|
2639
|
+
this.name = options.name;
|
|
2640
|
+
this.options = options.options;
|
|
2641
|
+
this.roles = options?.roles;
|
|
2642
|
+
this.columnId = options.columnId;
|
|
2643
|
+
}
|
|
2644
|
+
updateModel(options) {
|
|
2645
|
+
this.name = options.name;
|
|
2646
|
+
this.options = options.options;
|
|
2647
|
+
this.roles = options?.roles;
|
|
2648
|
+
}
|
|
2649
|
+
get titleKey() {
|
|
2650
|
+
return `utility.${this.id}.title`;
|
|
2651
|
+
}
|
|
2652
|
+
get bodyKey() {
|
|
2653
|
+
return `utility.${this.id}.body`;
|
|
2654
|
+
}
|
|
2655
|
+
// -------------------LIFECYCLE----------------------------
|
|
2656
|
+
async init() {
|
|
2657
|
+
this.logger.debug(`initializing utilities ${this.id}`);
|
|
2658
|
+
}
|
|
2659
|
+
async load() {
|
|
2660
|
+
this.logger.debug(`loading utilities ${this.id}`);
|
|
2661
|
+
}
|
|
2662
|
+
};
|
|
2663
|
+
UtilitiesModelImpl = __decorateClass$3([
|
|
2664
|
+
kosUiSdk.kosModel(MODEL_TYPE$3)
|
|
2665
|
+
], UtilitiesModelImpl);
|
|
2666
|
+
const Utilities = {
|
|
2667
|
+
registration: {
|
|
2668
|
+
[MODEL_TYPE$3]: {
|
|
2669
|
+
class: UtilitiesModelImpl,
|
|
2670
|
+
singleton: false
|
|
2671
|
+
}
|
|
2672
|
+
},
|
|
2673
|
+
type: MODEL_TYPE$3,
|
|
2674
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$3),
|
|
2675
|
+
factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$3)
|
|
2676
|
+
};
|
|
2677
|
+
const { URL: URL$1 } = kosUiSdk.resolveServiceUrl("UTILITIES_SERVICE");
|
|
2678
|
+
const { getAll } = kosUiSdk.ServiceFactory.build({
|
|
2679
|
+
basePath: `${URL$1}/api/utilities`
|
|
2680
|
+
});
|
|
2681
|
+
const log$1 = kosUiSdk.KosLog.createLogger({
|
|
2682
|
+
name: "utilities-service",
|
|
2683
|
+
group: "Services"
|
|
2684
|
+
});
|
|
2685
|
+
const getUtilities = async () => {
|
|
2686
|
+
log$1.debug("sending GET for utilities");
|
|
2687
|
+
try {
|
|
2688
|
+
const extensionResponse = await getAll({
|
|
2689
|
+
urlOverride: `${URL$1}/api/kos/descriptor/app:kosdev.ddk:ncuiDescriptor/kondra.ncui.utilities`
|
|
2690
|
+
});
|
|
2691
|
+
if (extensionResponse?.status !== 200) {
|
|
2692
|
+
log$1.info(`no extensions found, using base data`);
|
|
2693
|
+
const response = await getAll({
|
|
2694
|
+
urlOverride: `${URL$1}/api/kos/descriptor/system:app/kondra.ncui.utilities`
|
|
2695
|
+
});
|
|
2696
|
+
return response?.data ?? [];
|
|
2697
|
+
}
|
|
2698
|
+
return extensionResponse?.data ?? [];
|
|
2699
|
+
} catch (error) {
|
|
2700
|
+
log$1.info(`error fetching utilities: ${error}. Using base data`);
|
|
2701
|
+
const response = await getAll({
|
|
2702
|
+
urlOverride: `${URL$1}/api/kos/descriptor/system:app/kondra.ncui.utilities`
|
|
2703
|
+
});
|
|
2704
|
+
return response?.data ?? [];
|
|
2705
|
+
}
|
|
2706
|
+
};
|
|
2707
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2708
|
+
__proto__: null,
|
|
2709
|
+
getUtilities
|
|
2710
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2711
|
+
var __defProp$2 = Object.defineProperty;
|
|
2712
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
2713
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
2714
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
2715
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2716
|
+
if (decorator = decorators[i])
|
|
2717
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2718
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
2719
|
+
return result;
|
|
2720
|
+
};
|
|
2721
|
+
const MODEL_TYPE$2 = "utilities-container-model";
|
|
2722
|
+
let UtilitiesContainerModelImpl = class {
|
|
2723
|
+
id;
|
|
2724
|
+
logger;
|
|
2725
|
+
_models;
|
|
2726
|
+
constructor(modelId, _options, context) {
|
|
2727
|
+
this.id = modelId;
|
|
2728
|
+
this.logger = context.logger;
|
|
2729
|
+
this._models = new kosUiSdk.KosModelContainer({
|
|
2730
|
+
parentId: modelId,
|
|
2731
|
+
sortKey: "id",
|
|
2732
|
+
indexMap: {
|
|
2733
|
+
byColumn: "columnId"
|
|
2734
|
+
}
|
|
2735
|
+
});
|
|
2736
|
+
}
|
|
2737
|
+
get data() {
|
|
2738
|
+
return this._models.data;
|
|
2739
|
+
}
|
|
2740
|
+
get models() {
|
|
2741
|
+
return this._models;
|
|
2742
|
+
}
|
|
2743
|
+
get columns() {
|
|
2744
|
+
return this._models.getIndexKeys("byColumn").sort((a, b) => a.localeCompare(b));
|
|
2745
|
+
}
|
|
2746
|
+
addModel(model) {
|
|
2747
|
+
this._models.addModel(model);
|
|
2748
|
+
}
|
|
2749
|
+
removeModel(id) {
|
|
2750
|
+
this._models.removeModel(id);
|
|
2751
|
+
}
|
|
2752
|
+
getModel(id) {
|
|
2753
|
+
return this._models.getModel(id);
|
|
2754
|
+
}
|
|
2755
|
+
getUtilitiesByColumn(id) {
|
|
2756
|
+
return this._models.getIndexByKey("byColumn", id);
|
|
2757
|
+
}
|
|
2758
|
+
// -------------------LIFECYCLE----------------------------
|
|
2759
|
+
async load() {
|
|
2760
|
+
this.logger.debug(`loading utilities-container container ${this.id}`);
|
|
2761
|
+
const utilitiesResponse = await getUtilities();
|
|
2762
|
+
utilitiesResponse?.forEach((utilityColumnsResponse, columnId) => {
|
|
2763
|
+
utilityColumnsResponse.forEach((utilityResponse) => {
|
|
2764
|
+
const utilityOptions = {
|
|
2765
|
+
...utilityResponse,
|
|
2766
|
+
columnId: String(columnId)
|
|
2767
|
+
};
|
|
2768
|
+
const utilityModel = Utilities.factory(utilityResponse.name)(
|
|
2769
|
+
utilityOptions
|
|
2770
|
+
);
|
|
2771
|
+
this.addModel(utilityModel);
|
|
2772
|
+
});
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
};
|
|
2776
|
+
__decorateClass$2([
|
|
2777
|
+
kosUiSdk.kosChild
|
|
2778
|
+
], UtilitiesContainerModelImpl.prototype, "_models", 2);
|
|
2779
|
+
UtilitiesContainerModelImpl = __decorateClass$2([
|
|
2780
|
+
kosUiSdk.kosModel(MODEL_TYPE$2)
|
|
2781
|
+
], UtilitiesContainerModelImpl);
|
|
2782
|
+
const UtilitiesContainer = {
|
|
2783
|
+
registration: {
|
|
2784
|
+
[MODEL_TYPE$2]: {
|
|
2785
|
+
class: UtilitiesContainerModelImpl,
|
|
2786
|
+
singleton: true
|
|
2787
|
+
},
|
|
2788
|
+
...Utilities.registration
|
|
2789
|
+
},
|
|
2790
|
+
type: MODEL_TYPE$2,
|
|
2791
|
+
predicate: kosUiSdk.isKosModel(MODEL_TYPE$2),
|
|
2792
|
+
factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$2)
|
|
2793
|
+
};
|
|
2794
|
+
const DDKModels = {
|
|
2795
|
+
...Animation.registration,
|
|
2796
|
+
...Application.registration,
|
|
2797
|
+
...Auth.registration,
|
|
2798
|
+
...CarbWater.registration,
|
|
2799
|
+
...DashboardOperations.registration,
|
|
2800
|
+
...Dispenser.registration,
|
|
2801
|
+
...DispenserInfo.registration,
|
|
2802
|
+
...Enrollment.registration,
|
|
2803
|
+
...IngredientSummary.registration,
|
|
2804
|
+
...MacroAssignment.registration,
|
|
2805
|
+
...NetworkTestContainer.registration,
|
|
2806
|
+
...NutritiveSweetener.registration,
|
|
2807
|
+
...PlainWater.registration,
|
|
2808
|
+
...Reboot.registration,
|
|
2809
|
+
...Settings.registration,
|
|
2810
|
+
...SetupStepContainer.registration,
|
|
2811
|
+
...UtilitiesContainer.registration
|
|
2812
|
+
};
|
|
2813
|
+
var __defProp$1 = Object.defineProperty;
|
|
2814
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
2815
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2816
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
2817
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
2818
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2819
|
+
if (decorator = decorators[i])
|
|
2820
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2821
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
2822
|
+
return result;
|
|
2823
|
+
};
|
|
2824
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
2825
|
+
const MODEL_TYPE$1 = "trouble-action-model";
|
|
2826
|
+
let TroubleActionModelImpl = class {
|
|
2827
|
+
/**
|
|
2828
|
+
* Unique identifier for this model instance.
|
|
2829
|
+
*
|
|
2830
|
+
* Set during construction and used for model lifecycle management
|
|
2831
|
+
* and debugging purposes.
|
|
2832
|
+
*
|
|
2833
|
+
* @category Model Properties
|
|
2834
|
+
*/
|
|
2835
|
+
id;
|
|
2836
|
+
troubleContainer;
|
|
2837
|
+
/**
|
|
2838
|
+
* Observable state object mapping trouble state keys to values.
|
|
2839
|
+
*
|
|
2840
|
+
* This reactive state object is automatically updated when troubles are
|
|
2841
|
+
* added or removed from the system. Keys and values are determined by
|
|
2842
|
+
* the trouble action definitions provided during model initialization.
|
|
2843
|
+
*
|
|
2844
|
+
* State keys that no longer have associated active troubles are set to
|
|
2845
|
+
* undefined.
|
|
2846
|
+
*
|
|
2847
|
+
* @example
|
|
2848
|
+
* ```typescript
|
|
2849
|
+
* // Access state values
|
|
2850
|
+
* const isAgitationRequired = troubleActionModel.state.agitationRequired;
|
|
2851
|
+
*
|
|
2852
|
+
* // State is reactive - updates automatically propagate to React components
|
|
2853
|
+
* ```
|
|
2854
|
+
*
|
|
2855
|
+
* @category Model State
|
|
2856
|
+
*/
|
|
2857
|
+
state;
|
|
2858
|
+
/**
|
|
2859
|
+
* Internal mapping of trouble types to their action definitions.
|
|
2860
|
+
*
|
|
2861
|
+
* Built from the definitions array provided in TroubleActionOptions during
|
|
2862
|
+
* construction. Used for efficient lookup when processing trouble changes.
|
|
2863
|
+
*
|
|
2864
|
+
* @category Internal State
|
|
2865
|
+
*/
|
|
2866
|
+
troubleActionData;
|
|
2867
|
+
/**
|
|
2868
|
+
* Creates a new TroubleActionModel instance.
|
|
2869
|
+
*
|
|
2870
|
+
* Initializes the model with trouble action definitions that map trouble
|
|
2871
|
+
* types to state key-value pairs. The model begins monitoring the trouble
|
|
2872
|
+
* container immediately upon creation.
|
|
2873
|
+
*
|
|
2874
|
+
* @param modelId - Unique identifier for this model instance
|
|
2875
|
+
* @param options - Configuration options containing trouble action definitions
|
|
2876
|
+
* @param context - KOS creation context providing logger and framework services
|
|
2877
|
+
*
|
|
2878
|
+
* @category Lifecycle
|
|
2879
|
+
*/
|
|
2880
|
+
constructor(modelId, options) {
|
|
2881
|
+
this.id = modelId;
|
|
2882
|
+
this.state = kosUiSdk.ObservableData();
|
|
2883
|
+
this.troubleActionData = options.definitions.reduce((acc, curr) => {
|
|
2884
|
+
acc[curr.troubleType] = curr;
|
|
2885
|
+
return acc;
|
|
2886
|
+
}, {});
|
|
2887
|
+
}
|
|
2888
|
+
// -------------------LIFECYCLE----------------------------
|
|
2889
|
+
/**
|
|
2890
|
+
* Gets the first active trouble that has an associated action definition.
|
|
2891
|
+
*
|
|
2892
|
+
* Returns the first trouble found that matches any of the configured trouble
|
|
2893
|
+
* action definitions. If multiple troubles are active, priority is determined
|
|
2894
|
+
* by the order of trouble type keys in the troubleActionData object.
|
|
2895
|
+
*
|
|
2896
|
+
* @returns The active trouble model, or undefined if no matching troubles exist
|
|
2897
|
+
*
|
|
2898
|
+
* @example
|
|
2899
|
+
* ```typescript
|
|
2900
|
+
* const trouble = troubleActionModel.activeTrouble;
|
|
2901
|
+
* if (trouble) {
|
|
2902
|
+
* console.log(`Active trouble: ${trouble.type}`);
|
|
2903
|
+
* console.log(`Resolvable: ${trouble.resolvable}`);
|
|
2904
|
+
* }
|
|
2905
|
+
* ```
|
|
2906
|
+
*
|
|
2907
|
+
* @category Trouble Access
|
|
2908
|
+
* @see {@link TroubleContainerModel} for trouble data structure
|
|
2909
|
+
*/
|
|
2910
|
+
get activeTrouble() {
|
|
2911
|
+
const actions = Object.keys(this.troubleActionData);
|
|
2912
|
+
if (actions.length > 0) {
|
|
2913
|
+
const firstAction = actions[0];
|
|
2914
|
+
const troubles = this.troubleContainer.troubles.getIndexByKey(
|
|
2915
|
+
"byType",
|
|
2916
|
+
firstAction
|
|
2917
|
+
);
|
|
2918
|
+
if (troubles.length > 0) {
|
|
2919
|
+
return troubles[0];
|
|
2920
|
+
} else {
|
|
2921
|
+
return void 0;
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
return void 0;
|
|
2925
|
+
}
|
|
2926
|
+
/**
|
|
2927
|
+
* Gets the type of the first active trouble with an associated action definition.
|
|
2928
|
+
*
|
|
2929
|
+
* Convenience getter that extracts the trouble type from the active trouble.
|
|
2930
|
+
* Commonly used for conditional UI rendering based on trouble type.
|
|
2931
|
+
*
|
|
2932
|
+
* @returns The active trouble type string, or undefined if no troubles are active
|
|
2933
|
+
*
|
|
2934
|
+
* @example
|
|
2935
|
+
* ```typescript
|
|
2936
|
+
* const troubleType = troubleActionModel.activeTroubleType;
|
|
2937
|
+
* if (troubleType === 'InsufficientAgitationTrouble') {
|
|
2938
|
+
* // Show agitation required UI
|
|
2939
|
+
* }
|
|
2940
|
+
* ```
|
|
2941
|
+
*
|
|
2942
|
+
* @category Trouble Access
|
|
2943
|
+
*/
|
|
2944
|
+
get activeTroubleType() {
|
|
2945
|
+
return this.activeTrouble?.type;
|
|
2946
|
+
}
|
|
2947
|
+
handleTroubleActions() {
|
|
2948
|
+
const _state = this.troubleContainer.troubles.data.reduce((acc, curr) => {
|
|
2949
|
+
const _troubleType = curr.type;
|
|
2950
|
+
if (this.troubleActionData[_troubleType]) {
|
|
2951
|
+
const _stateKey = this.troubleActionData[_troubleType].stateKey ?? _troubleType;
|
|
2952
|
+
const _stateValue = this.troubleActionData[_troubleType].stateValue ?? _troubleType;
|
|
2953
|
+
acc[_stateKey] = _stateValue;
|
|
2954
|
+
}
|
|
2955
|
+
return acc;
|
|
2956
|
+
}, {});
|
|
2957
|
+
this.state.setValues(_state);
|
|
2958
|
+
Object.keys(this.troubleActionData).forEach((key) => {
|
|
2959
|
+
if (this.troubleContainer.troubles.getIndexByKey("byType", key).length === 0) {
|
|
2960
|
+
const _stateKey = this.troubleActionData[key].stateKey ?? key;
|
|
2961
|
+
this.state[_stateKey] = void 0;
|
|
2962
|
+
}
|
|
2963
|
+
});
|
|
2964
|
+
}
|
|
2965
|
+
};
|
|
2966
|
+
__publicField(TroubleActionModelImpl, "Registration");
|
|
2967
|
+
__decorateClass$1([
|
|
2968
|
+
kosUiSdk.kosDependency({ modelType: kosUiSdk.TroubleContainer.type })
|
|
2969
|
+
], TroubleActionModelImpl.prototype, "troubleContainer", 2);
|
|
2970
|
+
__decorateClass$1([
|
|
2971
|
+
kosUiSdk.kosModelEffect({
|
|
2972
|
+
dependencies: (model) => [model.troubleContainer.troubles.data]
|
|
2973
|
+
})
|
|
2974
|
+
], TroubleActionModelImpl.prototype, "handleTroubleActions", 1);
|
|
2975
|
+
TroubleActionModelImpl = __decorateClass$1([
|
|
2976
|
+
kosUiSdk.kosModel({ modelTypeId: MODEL_TYPE$1, singleton: true }),
|
|
2977
|
+
kosUiSdk.kosLoggerAware()
|
|
2978
|
+
], TroubleActionModelImpl);
|
|
2979
|
+
const TroubleAction = TroubleActionModelImpl.Registration;
|
|
2980
|
+
const { URL } = kosUiSdk.resolveServiceUrl("START_SERVICE");
|
|
2981
|
+
const { getOne } = kosUiSdk.ServiceFactory.build({
|
|
2982
|
+
basePath: `${URL}/api/start`
|
|
2983
|
+
});
|
|
2984
|
+
const log = kosUiSdk.KosLog.createLogger({ name: "start-service", group: "Services" });
|
|
2985
|
+
const navigateToNCui = async () => {
|
|
2986
|
+
log.debug("navigating to NCUI");
|
|
2987
|
+
const response = await getOne({
|
|
2988
|
+
urlOverride: `${URL}/api/app/kosdev.ddk/ncui/open`
|
|
2989
|
+
});
|
|
2990
|
+
return response;
|
|
2991
|
+
};
|
|
2992
|
+
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2993
|
+
__proto__: null,
|
|
2994
|
+
navigateToNCui
|
|
2995
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2996
|
+
var __defProp = Object.defineProperty;
|
|
2997
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2998
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
2999
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
3000
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
3001
|
+
if (decorator = decorators[i])
|
|
3002
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3003
|
+
if (kind && result) __defProp(target, key, result);
|
|
3004
|
+
return result;
|
|
3005
|
+
};
|
|
3006
|
+
const MODEL_TYPE = "start-model";
|
|
3007
|
+
let StartModelImpl = class {
|
|
3008
|
+
id;
|
|
3009
|
+
logger;
|
|
3010
|
+
troubles;
|
|
3011
|
+
constructor(modelId, options, context) {
|
|
3012
|
+
this.id = modelId;
|
|
3013
|
+
this.logger = context.logger;
|
|
3014
|
+
}
|
|
3015
|
+
get firmwareFailed() {
|
|
3016
|
+
return this.troubles.troubles.getIndexByKey(
|
|
3017
|
+
"byType",
|
|
3018
|
+
"FirmwareUpdateFailedTrouble"
|
|
3019
|
+
).length > 0;
|
|
3020
|
+
}
|
|
3021
|
+
get firmwareInProgress() {
|
|
3022
|
+
return this.troubles.troubles.getIndexByKey(
|
|
3023
|
+
"byType",
|
|
3024
|
+
"FirmwareUpdateInProgressTrouble"
|
|
3025
|
+
).length > 0;
|
|
3026
|
+
}
|
|
3027
|
+
async navigate() {
|
|
3028
|
+
await navigateToNCui();
|
|
3029
|
+
}
|
|
3030
|
+
// -------------------LIFECYCLE----------------------------
|
|
3031
|
+
async init() {
|
|
3032
|
+
this.logger.debug(`initializing start ${this.id}`);
|
|
3033
|
+
}
|
|
3034
|
+
async load() {
|
|
3035
|
+
this.logger.debug(`loading start ${this.id}`);
|
|
3036
|
+
}
|
|
3037
|
+
};
|
|
3038
|
+
__decorateClass([
|
|
3039
|
+
kosUiSdk.kosDependency({ modelType: kosUiSdk.TroubleContainer.type })
|
|
3040
|
+
], StartModelImpl.prototype, "troubles", 2);
|
|
3041
|
+
StartModelImpl = __decorateClass([
|
|
3042
|
+
kosUiSdk.kosModel(MODEL_TYPE)
|
|
3043
|
+
], StartModelImpl);
|
|
3044
|
+
const Start = new kosUiSdk.SingletonKosModelRegistrationFactory({
|
|
3045
|
+
class: StartModelImpl,
|
|
3046
|
+
type: MODEL_TYPE
|
|
3047
|
+
});
|
|
3048
|
+
exports.AgitationControl = AgitationControl;
|
|
3049
|
+
exports.Animation = Animation;
|
|
3050
|
+
exports.AnimationServices = index$b;
|
|
3051
|
+
exports.Application = Application;
|
|
3052
|
+
exports.Auth = Auth;
|
|
3053
|
+
exports.AuthServices = index$d;
|
|
3054
|
+
exports.CarbWater = CarbWater;
|
|
3055
|
+
exports.CopyLogs = CopyLogs;
|
|
3056
|
+
exports.CopyLogsServices = index$a;
|
|
3057
|
+
exports.DDKModels = DDKModels;
|
|
3058
|
+
exports.DashboardOperations = DashboardOperations;
|
|
3059
|
+
exports.DashboardOperationsServices = index$9;
|
|
3060
|
+
exports.Dispenser = Dispenser;
|
|
3061
|
+
exports.DispenserInfo = DispenserInfo;
|
|
3062
|
+
exports.DispenserInfoServices = index$7;
|
|
3063
|
+
exports.DispenserServices = index$8;
|
|
3064
|
+
exports.Door = Door;
|
|
3065
|
+
exports.EXTENSION_POINT_DASHBOARD_KEY_FACTORY = EXTENSION_POINT_DASHBOARD_KEY_FACTORY;
|
|
3066
|
+
exports.Enrollment = Enrollment;
|
|
3067
|
+
exports.EnrollmentServices = index$6;
|
|
3068
|
+
exports.IngredientSummary = IngredientSummary;
|
|
3069
|
+
exports.Lockout = Lockout;
|
|
3070
|
+
exports.LockoutServices = index$5;
|
|
3071
|
+
exports.MACRO_KEYS = MACRO_KEYS;
|
|
3072
|
+
exports.MacroAssignment = MacroAssignment;
|
|
3073
|
+
exports.NetworkTest = NetworkTest;
|
|
3074
|
+
exports.NetworkTestContainer = NetworkTestContainer;
|
|
3075
|
+
exports.NetworkTestServices = index$4;
|
|
3076
|
+
exports.NutritiveSweetener = NutritiveSweetener;
|
|
3077
|
+
exports.PlainWater = PlainWater;
|
|
3078
|
+
exports.Reboot = Reboot;
|
|
3079
|
+
exports.RebootServices = index$3;
|
|
3080
|
+
exports.Settings = Settings;
|
|
3081
|
+
exports.SettingsServices = index$2;
|
|
3082
|
+
exports.SetupStep = SetupStep;
|
|
3083
|
+
exports.SetupStepContainer = SetupStepContainer;
|
|
3084
|
+
exports.SetupStepServices = index$c;
|
|
3085
|
+
exports.Start = Start;
|
|
3086
|
+
exports.StartServices = index;
|
|
3087
|
+
exports.TROUBLE_TYPE_PRIME = TROUBLE_TYPE_PRIME$1;
|
|
3088
|
+
exports.TROUBLE_TYPE_PURGE = TROUBLE_TYPE_PURGE$1;
|
|
3089
|
+
exports.TroubleActionManager = TroubleAction;
|
|
3090
|
+
exports.Utilities = Utilities;
|
|
3091
|
+
exports.UtilitiesContainer = UtilitiesContainer;
|
|
3092
|
+
exports.UtilitiesServices = index$1;
|
|
3093
|
+
exports.calculateTimeDifference = calculateTimeDifference;
|
|
3094
|
+
exports.executeDashboardKeyFactory = executeDashboardKeyFactory;
|
|
3095
|
+
exports.isMacroGroup = isMacroGroup;
|
|
3096
|
+
exports.isMicroGroup = isMicroGroup;
|
|
3097
|
+
exports.macroHolderMap = macroHolderMap;
|
|
3098
|
+
exports.registerDashboardKeyFactory = registerDashboardKeyFactory;
|
|
3099
|
+
exports.toSeconds = toSeconds;
|
|
3100
|
+
exports.toTimeComponents = toTimeComponents;
|
|
3101
|
+
exports.troubleVisibilityFilter = troubleVisibilityFilter;
|
|
3102
|
+
//# sourceMappingURL=index.js.map
|