@kosdev-code/kos-ui-sdk 3.0.7 → 3.0.8

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/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const log$Q = require("loglevel");
3
+ const log$R = require("loglevel");
4
4
  const mobx = require("mobx");
5
5
  const robot3 = require("robot3");
6
6
  const dateFns = require("date-fns");
@@ -54,7 +54,7 @@ var KosMockEvents = /* @__PURE__ */ ((KosMockEvents2) => {
54
54
  return KosMockEvents2;
55
55
  })(KosMockEvents || {});
56
56
  const EVENT_KOS_MODEL_READY = "/kos/model/ready/";
57
- log$Q.info("Initializing event bus");
57
+ log$R.info("Initializing event bus");
58
58
  globalThis.kos = globalThis.kos || {};
59
59
  globalThis.kos.subscriptions = globalThis.kos.subscriptions || {};
60
60
  const subscriptions = globalThis.kos.subscriptions;
@@ -65,15 +65,15 @@ function hasEventSubscriptions(eventType) {
65
65
  function subscribe(eventType, callback) {
66
66
  const id = getNextUniqueId();
67
67
  if (!subscriptions[eventType]) {
68
- log$Q.debug(`Initializing subscription for ${eventType}`);
68
+ log$R.debug(`Initializing subscription for ${eventType}`);
69
69
  subscriptions[eventType] = {};
70
70
  }
71
- log$Q.debug(`Subscribing to ${eventType} with id ${id.toString()}`);
71
+ log$R.debug(`Subscribing to ${eventType} with id ${id.toString()}`);
72
72
  subscriptions[eventType][id] = callback;
73
73
  return {
74
74
  count: subscriptions[eventType] ? Object.getOwnPropertySymbols(subscriptions[eventType]).length : 0,
75
75
  unsubscribe: () => {
76
- log$Q.debug(`Unsubscribing from ${eventType} with id ${id.toString()}`);
76
+ log$R.debug(`Unsubscribing from ${eventType} with id ${id.toString()}`);
77
77
  if (subscriptions[eventType] && subscriptions[eventType][id]) {
78
78
  delete subscriptions[eventType][id];
79
79
  }
@@ -88,7 +88,7 @@ function subscribe(eventType, callback) {
88
88
  }
89
89
  function publish(eventType, msg, headers = {}) {
90
90
  if (!subscriptions[eventType] || Object.getOwnPropertySymbols(subscriptions[eventType]).length === 0) {
91
- log$Q.debug(`No subscriptions for ${eventType}. Not publishing.`);
91
+ log$R.debug(`No subscriptions for ${eventType}. Not publishing.`);
92
92
  return {
93
93
  eventType,
94
94
  subscribers: 0
@@ -98,19 +98,19 @@ function publish(eventType, msg, headers = {}) {
98
98
  Object.getOwnPropertySymbols(subscriptions[eventType]).forEach((id) => {
99
99
  if (headers["sync"]) {
100
100
  const responseId = headers["sync"];
101
- log$Q.debug(
101
+ log$R.debug(
102
102
  `Performing sync publish for ${eventType} with sync id ${responseId}`
103
103
  );
104
104
  subscriptions[eventType][id]({ body: msg, headers }).then(
105
105
  (response) => {
106
- log$Q.debug(
106
+ log$R.debug(
107
107
  `Response recieved for ${responseId}, publishing back to source.`
108
108
  );
109
109
  publish(responseId, response);
110
110
  }
111
111
  );
112
112
  } else {
113
- log$Q.debug(`Performing async publish for ${eventType}`);
113
+ log$R.debug(`Performing async publish for ${eventType}`);
114
114
  subscriptions[eventType][id]({ body: msg, headers });
115
115
  }
116
116
  });
@@ -120,7 +120,7 @@ function publish(eventType, msg, headers = {}) {
120
120
  };
121
121
  }
122
122
  function reset() {
123
- log$Q.warn("Resetting event bus");
123
+ log$R.warn("Resetting event bus");
124
124
  Object.keys(subscriptions).forEach((key) => delete subscriptions[key]);
125
125
  }
126
126
  function once$1(eventType, callback) {
@@ -799,10 +799,10 @@ const getLogMessageToStudio = () => {
799
799
  return enableAll;
800
800
  };
801
801
  const WS_LOG = "ws-log";
802
- const originalFactory = log$Q.methodFactory;
802
+ const originalFactory = log$R.methodFactory;
803
803
  const enableMessageLogging = getKosMessageLogging();
804
804
  const enableStudioMessageLogging = getLogMessageToStudio();
805
- log$Q.methodFactory = function(methodName, logLevel, loggerName) {
805
+ log$R.methodFactory = function(methodName, logLevel, loggerName) {
806
806
  const rawMethod = originalFactory(methodName, logLevel, loggerName);
807
807
  return function(...args) {
808
808
  const _name = loggerName ? String(loggerName) : "";
@@ -817,17 +817,17 @@ log$Q.methodFactory = function(methodName, logLevel, loggerName) {
817
817
  };
818
818
  };
819
819
  let level = getLogLevel();
820
- log$Q.setLevel(level);
820
+ log$R.setLevel(level);
821
821
  window.setKosLogLevel = (_level) => {
822
822
  level = _level;
823
- log$Q.setLevel(_level);
823
+ log$R.setLevel(_level);
824
824
  };
825
- const wsLog = log$Q.getLogger(WS_LOG);
825
+ const wsLog = log$R.getLogger(WS_LOG);
826
826
  window.enableKosMessageLog = () => {
827
- wsLog.setLevel(log$Q.levels.INFO);
827
+ wsLog.setLevel(log$R.levels.INFO);
828
828
  };
829
829
  window.disableKosMessageLog = () => {
830
- wsLog.setLevel(log$Q.levels.ERROR);
830
+ wsLog.setLevel(log$R.levels.ERROR);
831
831
  };
832
832
  if (enableMessageLogging) {
833
833
  window.enableKosMessageLog();
@@ -855,21 +855,21 @@ const received = [
855
855
  "font-weight: bold"
856
856
  ].join(";");
857
857
  const conditionallyLog = (level2) => (fn) => {
858
- if (log$Q.getLevel() <= level2) {
858
+ if (log$R.getLevel() <= level2) {
859
859
  fn();
860
860
  }
861
861
  };
862
862
  const KosLog = {
863
- ...log$Q,
864
- ifDebug: conditionallyLog(log$Q.levels.DEBUG),
865
- ifInfo: conditionallyLog(log$Q.levels.INFO),
866
- ifWarn: conditionallyLog(log$Q.levels.WARN),
867
- ifError: conditionallyLog(log$Q.levels.ERROR),
868
- getLogger: (name) => log$Q.getLogger(`kos::${name}`),
869
- getLoggers: () => log$Q.getLoggers(),
863
+ ...log$R,
864
+ ifDebug: conditionallyLog(log$R.levels.DEBUG),
865
+ ifInfo: conditionallyLog(log$R.levels.INFO),
866
+ ifWarn: conditionallyLog(log$R.levels.WARN),
867
+ ifError: conditionallyLog(log$R.levels.ERROR),
868
+ getLogger: (name) => log$R.getLogger(`kos::${name}`),
869
+ getLoggers: () => log$R.getLoggers(),
870
870
  createLogger: ({ name, group }) => {
871
871
  const loggerName = `${group ? `${group}:` : "kos"}::${name}`;
872
- const _log = log$Q.getLogger(loggerName);
872
+ const _log = log$R.getLogger(loggerName);
873
873
  let _level = globalThis.kos.logOverrides?.find(
874
874
  (override) => override.name === loggerName
875
875
  )?.level;
@@ -920,7 +920,7 @@ const OptionsRequired = /* @__PURE__ */ Symbol(`OptionsRequired`);
920
920
  const KosViewModelSymbol = /* @__PURE__ */ Symbol(`KosViewModelSymbol`);
921
921
  const ViewModelConfig = /* @__PURE__ */ Symbol(`ViewModelConfig`);
922
922
  const ReloadAwareSetup = /* @__PURE__ */ Symbol(`ReloadAwareSetup`);
923
- const log$P = KosLog.createLogger({ group: "decorators", name: "fsm-injection" });
923
+ const log$Q = KosLog.createLogger({ group: "decorators", name: "fsm-injection" });
924
924
  function injectStateMachineSupport(modelInstance) {
925
925
  const fsmSetup = modelInstance[StateMachineSetup];
926
926
  if (!fsmSetup) return;
@@ -964,7 +964,7 @@ function initializeFsmProperties(modelInstance, options) {
964
964
  const config2 = modelInstance._fsmConfig;
965
965
  const initialState = computeInitialState ? computeInitialState(modelInstance) : config2.initial;
966
966
  if (computeInitialState && !config2.states[initialState]) {
967
- log$P.warn(
967
+ log$Q.warn(
968
968
  `computeInitialState returned "${initialState}" which is not a valid state. Falling back to "${config2.initial}".`
969
969
  );
970
970
  modelInstance[stateProperty] = config2.initial;
@@ -1094,7 +1094,7 @@ function handleAsyncEntryResult(instance, state, stateProperty, result) {
1094
1094
  if (stateConfig.onError && instance[stateProperty] === state) {
1095
1095
  instance.transition(stateConfig.onError);
1096
1096
  } else {
1097
- log$P.error(`Async entry handler for state "${state}" failed:`, err);
1097
+ log$Q.error(`Async entry handler for state "${state}" failed:`, err);
1098
1098
  }
1099
1099
  }
1100
1100
  );
@@ -1135,7 +1135,7 @@ function initializeStateMachine(modelInstance, lifecycle) {
1135
1135
  modelInstance._fsmInitialized = true;
1136
1136
  trackInitialStateInHistory(modelInstance, config2.initial, options);
1137
1137
  executeInitialStateEntryHandler(modelInstance, config2.initial);
1138
- log$P.debug(
1138
+ log$Q.debug(
1139
1139
  `FSM initialized for model ${modelInstance.id} at lifecycle ${lifecycle} with initial state "${config2.initial}"`
1140
1140
  );
1141
1141
  }
@@ -1373,7 +1373,7 @@ class ServiceRequestError extends Error {
1373
1373
  this.responseHeaders = details.responseHeaders ?? {};
1374
1374
  }
1375
1375
  }
1376
- const log$O = KosLog.createLogger({ name: "resolve-parameters" });
1376
+ const log$P = KosLog.createLogger({ name: "resolve-parameters" });
1377
1377
  const resolveParameters = ({
1378
1378
  value,
1379
1379
  modelId,
@@ -1405,11 +1405,11 @@ const resolveParameters = ({
1405
1405
  )) {
1406
1406
  const prop = modelData[propName];
1407
1407
  if (prop !== null && prop !== void 0) {
1408
- log$O.debug(`Resolved ${match} to ${prop}`);
1408
+ log$P.debug(`Resolved ${match} to ${prop}`);
1409
1409
  return prop;
1410
1410
  } else {
1411
1411
  const logLevel2 = isOnlyPropKey ? "debug" : "warn";
1412
- log$O[logLevel2](
1412
+ log$P[logLevel2](
1413
1413
  `Property ${propName} is null or undefined${isOnlyPropKey ? "" : " in composite string"}, marking for undefined return`
1414
1414
  );
1415
1415
  hasUnresolvedProp = true;
@@ -1417,7 +1417,7 @@ const resolveParameters = ({
1417
1417
  }
1418
1418
  }
1419
1419
  const logLevel = isOnlyPropKey ? "debug" : "warn";
1420
- log$O[logLevel](
1420
+ log$P[logLevel](
1421
1421
  `Property ${propName} not found in modelData${isOnlyPropKey ? "" : " for composite string"}`
1422
1422
  );
1423
1423
  return match;
@@ -1432,7 +1432,7 @@ const resolveParameters = ({
1432
1432
  }
1433
1433
  return _value;
1434
1434
  };
1435
- const log$N = KosLog.createLogger({ name: "ServiceRequestHelpers" });
1435
+ const log$O = KosLog.createLogger({ name: "ServiceRequestHelpers" });
1436
1436
  function resolveServiceRequestParameters(metadata, modelInstance, args, runtimeOptions) {
1437
1437
  const resolvedPath = resolveParameters({
1438
1438
  value: metadata.path,
@@ -1501,7 +1501,7 @@ function handleServiceRequestError(error, response, errorHandler, modelInstance,
1501
1501
  });
1502
1502
  switch (errorHandler.strategy) {
1503
1503
  case "log":
1504
- log$N.error(`Service request status ${richError.status} error: ${error}`);
1504
+ log$O.error(`Service request status ${richError.status} error: ${error}`);
1505
1505
  if (errorHandler.onError) {
1506
1506
  errorHandler.onError(richError, modelInstance);
1507
1507
  }
@@ -1622,7 +1622,7 @@ var ReplayStrategy = /* @__PURE__ */ ((ReplayStrategy2) => {
1622
1622
  ReplayStrategy2["NONE"] = "none";
1623
1623
  return ReplayStrategy2;
1624
1624
  })(ReplayStrategy || {});
1625
- const log$M = KosLog.createLogger({ name: "kos-state-machine" });
1625
+ const log$N = KosLog.createLogger({ name: "kos-state-machine" });
1626
1626
  function kosStateMachine(config2, options) {
1627
1627
  return (target) => {
1628
1628
  target.prototype[StateMachineSetup] = {
@@ -1677,7 +1677,7 @@ function kosStateGuard(options) {
1677
1677
  if (shouldThrow) {
1678
1678
  throw new Error(message2);
1679
1679
  } else {
1680
- log$M.warn(message2);
1680
+ log$N.warn(message2);
1681
1681
  return void 0;
1682
1682
  }
1683
1683
  }
@@ -2243,7 +2243,7 @@ function observeComputedProperties(model, callback, keys = []) {
2243
2243
  );
2244
2244
  return disposers;
2245
2245
  }
2246
- const log$L = KosLog.createLogger({ name: "kos-container-model" });
2246
+ const log$M = KosLog.createLogger({ name: "kos-container-model" });
2247
2247
  class KosModelContainer {
2248
2248
  _data;
2249
2249
  _sortKey;
@@ -2365,14 +2365,14 @@ class KosModelContainer {
2365
2365
  async removeAndDestroy(id) {
2366
2366
  const model = this.getModel(id);
2367
2367
  if (!model) {
2368
- log$L.debug(`Model ${id} not found in container, skipping destroy`);
2368
+ log$M.debug(`Model ${id} not found in container, skipping destroy`);
2369
2369
  return;
2370
2370
  }
2371
2371
  this.removeModel(id);
2372
2372
  try {
2373
2373
  await destroyKosModel(model);
2374
2374
  } catch (error) {
2375
- log$L.error(`Failed to destroy model ${id}:`, error);
2375
+ log$M.error(`Failed to destroy model ${id}:`, error);
2376
2376
  throw error;
2377
2377
  }
2378
2378
  }
@@ -2389,7 +2389,7 @@ class KosModelContainer {
2389
2389
  async removeAndDestroyAll(ids) {
2390
2390
  const models2 = ids.map((id) => this.getModel(id)).filter((model) => model !== void 0);
2391
2391
  if (models2.length === 0) {
2392
- log$L.debug("No models found to destroy");
2392
+ log$M.debug("No models found to destroy");
2393
2393
  return;
2394
2394
  }
2395
2395
  this.removeAll(ids);
@@ -2398,7 +2398,7 @@ class KosModelContainer {
2398
2398
  );
2399
2399
  results.forEach((result, index2) => {
2400
2400
  if (result.status === "rejected") {
2401
- log$L.error(
2401
+ log$M.error(
2402
2402
  `Failed to destroy model ${models2[index2].id}:`,
2403
2403
  result.reason
2404
2404
  );
@@ -2571,7 +2571,7 @@ class KosModelContainer {
2571
2571
  const idx = this.index.get(indexName);
2572
2572
  return idx.keys ?? [];
2573
2573
  } else {
2574
- log$L.info(
2574
+ log$M.info(
2575
2575
  `index ${indexName} not found in ${Array.from(this.index.keys())}`
2576
2576
  );
2577
2577
  return [];
@@ -2583,7 +2583,7 @@ class KosModelContainer {
2583
2583
  if (idx.index.has(indexKey)) {
2584
2584
  return idx.getByKey(indexKey);
2585
2585
  } else {
2586
- log$L.info(
2586
+ log$M.info(
2587
2587
  `key ${indexKey} not found in ${indexName} index: ${Array.from(
2588
2588
  idx.index.keys()
2589
2589
  )}`
@@ -2591,7 +2591,7 @@ class KosModelContainer {
2591
2591
  return [];
2592
2592
  }
2593
2593
  } else {
2594
- log$L.info(
2594
+ log$M.info(
2595
2595
  `index ${indexName} not found in ${Array.from(this.index.keys())}`
2596
2596
  );
2597
2597
  return [];
@@ -2618,7 +2618,7 @@ class KosModelContainer {
2618
2618
  * @private
2619
2619
  */
2620
2620
  _logCapacityWarning(toEvict) {
2621
- log$L.info(
2621
+ log$M.info(
2622
2622
  `Container capacity exceeded (${this._data.size}/${this._maxCapacity}). Evicting ${toEvict} models using ${this._evictionStrategy} strategy.`,
2623
2623
  { parentId: this._parentId }
2624
2624
  );
@@ -2681,7 +2681,7 @@ class KosModelContainer {
2681
2681
  const candidates = this._customEvictionFilter(this.data);
2682
2682
  return candidates.slice(0, count);
2683
2683
  }
2684
- log$L.error(
2684
+ log$M.error(
2685
2685
  "Custom eviction strategy specified but no customEvictionFilter provided. Falling back to FIFO.",
2686
2686
  { parentId: this._parentId }
2687
2687
  );
@@ -2693,7 +2693,7 @@ class KosModelContainer {
2693
2693
  */
2694
2694
  async _removeEvictedModels(models2) {
2695
2695
  for (const model of models2) {
2696
- log$L.info(
2696
+ log$M.info(
2697
2697
  `Evicting model: ${model.id} (type: ${model.constructor.name})`,
2698
2698
  {
2699
2699
  modelId: model.id,
@@ -2703,7 +2703,7 @@ class KosModelContainer {
2703
2703
  );
2704
2704
  this.removeModel(model.id, true);
2705
2705
  destroyKosModel(model).catch(
2706
- (e) => log$L.error(`Failed to destroy evicted model ${model.id}:`, e)
2706
+ (e) => log$M.error(`Failed to destroy evicted model ${model.id}:`, e)
2707
2707
  );
2708
2708
  }
2709
2709
  }
@@ -2712,7 +2712,7 @@ class KosModelContainer {
2712
2712
  * @private
2713
2713
  */
2714
2714
  _logEvictionComplete(evictedCount) {
2715
- log$L.info(
2715
+ log$M.info(
2716
2716
  `Evicted ${evictedCount} models. Current size: ${this._data.size}/${this._maxCapacity}`,
2717
2717
  { parentId: this._parentId }
2718
2718
  );
@@ -2721,9 +2721,9 @@ class KosModelContainer {
2721
2721
  this._data.forEach((model) => {
2722
2722
  const modelId = model.id;
2723
2723
  destroyKosModel(model).then(() => {
2724
- log$L.debug(`${modelId} destroyed, removing from map`);
2724
+ log$M.debug(`${modelId} destroyed, removing from map`);
2725
2725
  this.removeModel(modelId, true);
2726
- }).catch((e) => log$L.error(e));
2726
+ }).catch((e) => log$M.error(e));
2727
2727
  });
2728
2728
  this.increment();
2729
2729
  }
@@ -2915,7 +2915,7 @@ const isKosModelReady = (model) => {
2915
2915
  }
2916
2916
  return kosModel2.isReady();
2917
2917
  };
2918
- const log$K = KosLog.createLogger({ name: "kos-model-factory" });
2918
+ const log$L = KosLog.createLogger({ name: "kos-model-factory" });
2919
2919
  const KosModelFactory = {
2920
2920
  byModelType: (modelType) => KosCore.getInstance().modelManager.getModelFactory(
2921
2921
  modelType
@@ -2923,7 +2923,7 @@ const KosModelFactory = {
2923
2923
  getModelInstance: (id, modelType, options) => {
2924
2924
  const factory = KosModelFactory.byModelType(modelType);
2925
2925
  if (!factory) {
2926
- log$K.error(
2926
+ log$L.error(
2927
2927
  `No registered factory found for model type ${modelType}. Please register a factory for this model type. `
2928
2928
  );
2929
2929
  throw Error(`No factory found for model type ${modelType}`);
@@ -3234,7 +3234,7 @@ class SingletonKosModelRegistrationFactory extends KosBaseModelRegistration {
3234
3234
  };
3235
3235
  }
3236
3236
  }
3237
- const log$J = KosLog.createLogger({ group: "decorators", name: "kos-model" });
3237
+ const log$K = KosLog.createLogger({ group: "decorators", name: "kos-model" });
3238
3238
  function resolveParentContext(TargetClass, modelId, modelData) {
3239
3239
  const parentIdRaw = TargetClass[ParentModel]?.parentId;
3240
3240
  if (!parentIdRaw) return;
@@ -3538,7 +3538,7 @@ function injectCompanionSupport(modelInstance, initialData) {
3538
3538
  const { mode, parentProperty, excludeProperties } = companionConfig;
3539
3539
  const parentModel = initialData.companionParent;
3540
3540
  if (!parentModel) {
3541
- log$J.warn(
3541
+ log$K.warn(
3542
3542
  `Companion decorator configured but no parent model found in initialData.companionParent`
3543
3543
  );
3544
3544
  return;
@@ -3612,7 +3612,7 @@ function injectCompanionSupport(modelInstance, initialData) {
3612
3612
  });
3613
3613
  }
3614
3614
  } catch (error) {
3615
- log$J.debug(
3615
+ log$K.debug(
3616
3616
  `Skipping companion proxy for property ${propertyName}:`,
3617
3617
  error
3618
3618
  );
@@ -3640,7 +3640,7 @@ function makeSafeObservable$1(instance) {
3640
3640
  try {
3641
3641
  return mobx.makeAutoObservable(instance);
3642
3642
  } catch (e) {
3643
- log$J.error("Failed to make observable:", e);
3643
+ log$K.error("Failed to make observable:", e);
3644
3644
  return instance;
3645
3645
  }
3646
3646
  }
@@ -4124,7 +4124,7 @@ const KosDeletionManager = {
4124
4124
  }
4125
4125
  }
4126
4126
  };
4127
- const log$I = KosLog.createLogger({ name: "kos-dependency-manager" });
4127
+ const log$J = KosLog.createLogger({ name: "kos-dependency-manager" });
4128
4128
  class KosDependencyManager {
4129
4129
  _usedByCache = /* @__PURE__ */ new Map();
4130
4130
  _usesCache = /* @__PURE__ */ new Map();
@@ -4152,7 +4152,7 @@ class KosDependencyManager {
4152
4152
  canDestroy(modelId) {
4153
4153
  const usedBy = this._usedByCache.get(modelId);
4154
4154
  if (usedBy?.length) {
4155
- log$I.info(`Model ${modelId} is still used by: ${usedBy.join(", ")}`);
4155
+ log$J.info(`Model ${modelId} is still used by: ${usedBy.join(", ")}`);
4156
4156
  return false;
4157
4157
  }
4158
4158
  return true;
@@ -4162,7 +4162,7 @@ class KosDependencyManager {
4162
4162
  this._usesCache.clear();
4163
4163
  }
4164
4164
  }
4165
- const log$H = KosLog.createLogger({ name: "kos-model-cache" });
4165
+ const log$I = KosLog.createLogger({ name: "kos-model-cache" });
4166
4166
  class KosModelCache {
4167
4167
  constructor(preloadKeys = []) {
4168
4168
  this.preloadKeys = preloadKeys;
@@ -4213,11 +4213,11 @@ class KosModelCache {
4213
4213
  }
4214
4214
  preload(createFn) {
4215
4215
  if (this._isPreloaded) {
4216
- log$H.debug("Returning cached preloaded models");
4216
+ log$I.debug("Returning cached preloaded models");
4217
4217
  return this._preloaded;
4218
4218
  }
4219
4219
  this._preloaded = this.preloadKeys.map((key) => {
4220
- log$H.debug(
4220
+ log$I.debug(
4221
4221
  `Preloading model: ${typeof key === "string" ? key : key.modelType}`
4222
4222
  );
4223
4223
  return createFn(key);
@@ -4306,7 +4306,7 @@ function logModelInstantiationError(error, context) {
4306
4306
  });
4307
4307
  }
4308
4308
  const isKosCompanionTypeFactory = (obj) => typeof obj === "function";
4309
- const log$G = KosLog.createLogger({ name: "kos-companion-instantiator" });
4309
+ const log$H = KosLog.createLogger({ name: "kos-companion-instantiator" });
4310
4310
  class KosCompanionInstantiator {
4311
4311
  constructor(registry, cache2, createModel) {
4312
4312
  this.registry = registry;
@@ -4328,7 +4328,7 @@ class KosCompanionInstantiator {
4328
4328
  createCompanionModels(model, options, lifecycle) {
4329
4329
  const companionDefs = this.getCompanionDefinitions(model.modelTypeName);
4330
4330
  if (lifecycle !== void 0) {
4331
- log$G.debug(
4331
+ log$H.debug(
4332
4332
  `Creating ${lifecycle} lifecycle companions for ${model.modelTypeName} [${model.modelId}]`
4333
4333
  );
4334
4334
  }
@@ -4371,7 +4371,7 @@ class KosCompanionInstantiator {
4371
4371
  resolveFactoryCompanion(companionDef, model, options, requestedLifecycle) {
4372
4372
  const companionType = companionDef.type(model.modelData, options);
4373
4373
  if (!companionType) {
4374
- log$G.debug(
4374
+ log$H.debug(
4375
4375
  `Companion factory returned undefined for ${model.modelTypeName} at ${requestedLifecycle || "INIT"} phase`
4376
4376
  );
4377
4377
  return null;
@@ -4430,7 +4430,7 @@ class KosCompanionInstantiator {
4430
4430
  );
4431
4431
  if (companion) {
4432
4432
  this.attachCompanionToParent(companion, parentModel);
4433
- log$G.debug(
4433
+ log$H.debug(
4434
4434
  `Created ${lifecycle || "INIT"} companion ${companionType} for ${parentModel.modelTypeName} [${parentModel.modelId}]`
4435
4435
  );
4436
4436
  }
@@ -4446,7 +4446,7 @@ class KosCompanionInstantiator {
4446
4446
  */
4447
4447
  companionAlreadyExists(companionId, companionType, parentTypeName) {
4448
4448
  if (this.cache.hasModel(companionId)) {
4449
- log$G.debug(
4449
+ log$H.debug(
4450
4450
  `Companion ${companionType} already exists for ${parentTypeName}`
4451
4451
  );
4452
4452
  return true;
@@ -5142,7 +5142,7 @@ class KosEffectManager {
5142
5142
  this.disposers = [];
5143
5143
  }
5144
5144
  }
5145
- const log$F = KosLog.createLogger({ name: "model-active-machine" });
5145
+ const log$G = KosLog.createLogger({ name: "model-active-machine" });
5146
5146
  const activeMachine = (model) => {
5147
5147
  const machine2 = robot3.createMachine(KosModelState.INACTIVE, {
5148
5148
  [KosModelState.FAILED]: robot3.state(
@@ -5197,11 +5197,11 @@ const activeMachine = (model) => {
5197
5197
  });
5198
5198
  const service2 = robot3.interpret(
5199
5199
  machine2,
5200
- (_service) => log$F.debug(_service.machine.current)
5200
+ (_service) => log$G.debug(_service.machine.current)
5201
5201
  );
5202
5202
  return { service: service2, machine: machine2 };
5203
5203
  };
5204
- const log$E = KosLog.createLogger({ name: "model-online-machine" });
5204
+ const log$F = KosLog.createLogger({ name: "model-online-machine" });
5205
5205
  const onlineMachine = (model) => {
5206
5206
  const machine2 = robot3.createMachine(KosModelState.OFFLINE, {
5207
5207
  [KosModelState.ONLINE]: robot3.state(
@@ -5219,7 +5219,7 @@ const onlineMachine = (model) => {
5219
5219
  KosModelEvents.GO_ONLINE,
5220
5220
  KosModelState.ONLINE,
5221
5221
  robot3.action(async () => {
5222
- log$E.debug(`Going online with model ${model.modelId}`);
5222
+ log$F.debug(`Going online with model ${model.modelId}`);
5223
5223
  await model.online();
5224
5224
  model.onlineStatus = KosModelState.ONLINE;
5225
5225
  await model.fsm.transitionTo(
@@ -5232,7 +5232,7 @@ const onlineMachine = (model) => {
5232
5232
  });
5233
5233
  const service2 = robot3.interpret(
5234
5234
  machine2,
5235
- (_service) => log$E.debug(_service.machine.current)
5235
+ (_service) => log$F.debug(_service.machine.current)
5236
5236
  );
5237
5237
  return { machine: machine2, service: service2 };
5238
5238
  };
@@ -5377,11 +5377,11 @@ const machine = (model) => {
5377
5377
  [KosModelState.FAILED]: robot3.state()
5378
5378
  });
5379
5379
  };
5380
- const log$D = KosLog.createLogger({ name: "kos-model-lifecycle" });
5380
+ const log$E = KosLog.createLogger({ name: "kos-model-lifecycle" });
5381
5381
  const fsm = (model) => {
5382
5382
  const service2 = robot3.interpret(
5383
5383
  machine(model),
5384
- (_service) => log$D.debug(
5384
+ (_service) => log$E.debug(
5385
5385
  `state machine for model ${model.modelId}: ${_service.machine.current});`
5386
5386
  )
5387
5387
  );
@@ -6339,7 +6339,7 @@ const getMessageBody = (payload, skipParse) => {
6339
6339
  return payload.body || payload;
6340
6340
  }
6341
6341
  };
6342
- const log$C = KosLog.createLogger({ name: "kos-fetch" });
6342
+ const log$D = KosLog.createLogger({ name: "kos-fetch" });
6343
6343
  const WS_TIMEOUT = process.env.KOS_WS_TIMEOUT ? parseInt(process.env.KOS_WS_TIMEOUT) : 3e4;
6344
6344
  const delay = () => new Promise((resolve) => {
6345
6345
  setTimeout(() => {
@@ -6389,7 +6389,7 @@ const kosFetchWs = async (url, options) => {
6389
6389
  const requestId = uuid();
6390
6390
  const urlObj = new URL(url);
6391
6391
  const path = `${urlObj.pathname}${urlObj.search}`;
6392
- log$C.debug(`path: ${path}`);
6392
+ log$D.debug(`path: ${path}`);
6393
6393
  const TIMEOUT = options?.timeout || WS_TIMEOUT;
6394
6394
  const messageFactory = fetchMessageFactory(options);
6395
6395
  const timeoutSignal = createTimeoutSignal(TIMEOUT);
@@ -6420,9 +6420,9 @@ const kosFetchWs = async (url, options) => {
6420
6420
  if (signal.aborted) {
6421
6421
  const reason = signal.reason;
6422
6422
  if (reason?.name === "TimeoutError") {
6423
- log$C.error(`Timeout occurred - url: ${url}`);
6423
+ log$D.error(`Timeout occurred - url: ${url}`);
6424
6424
  } else {
6425
- log$C.debug(`Request aborted - url: ${url}`);
6425
+ log$D.debug(`Request aborted - url: ${url}`);
6426
6426
  }
6427
6427
  reject(reason || new DOMException("Aborted", "AbortError"));
6428
6428
  return;
@@ -6431,9 +6431,9 @@ const kosFetchWs = async (url, options) => {
6431
6431
  if (unsubscribe) unsubscribe();
6432
6432
  const reason = signal.reason;
6433
6433
  if (reason?.name === "TimeoutError") {
6434
- log$C.error(`Timeout occurred - url: ${url}`);
6434
+ log$D.error(`Timeout occurred - url: ${url}`);
6435
6435
  } else {
6436
- log$C.debug(`Request aborted - url: ${url}`);
6436
+ log$D.debug(`Request aborted - url: ${url}`);
6437
6437
  }
6438
6438
  reject(reason || new DOMException("Aborted", "AbortError"));
6439
6439
  };
@@ -6449,7 +6449,7 @@ const kosFetchWs = async (url, options) => {
6449
6449
  try {
6450
6450
  bodyData = base64ToArrayBuffer(responseBody);
6451
6451
  } catch (e) {
6452
- log$C.error("Failed to decode base64 response", e);
6452
+ log$D.error("Failed to decode base64 response", e);
6453
6453
  }
6454
6454
  }
6455
6455
  const response = {
@@ -6503,7 +6503,7 @@ const kosFetchWs = async (url, options) => {
6503
6503
  });
6504
6504
  }
6505
6505
  if (parsed.files) {
6506
- log$C.warn(
6506
+ log$D.warn(
6507
6507
  "File reconstruction in FormData not fully implemented"
6508
6508
  );
6509
6509
  }
@@ -6554,7 +6554,7 @@ const resolveBaseUrl = () => {
6554
6554
  const URL2 = exports.BASE_URL;
6555
6555
  return { isMock: MOCK, URL: URL2 };
6556
6556
  };
6557
- const log$B = KosLog.createLogger({ name: "kos-service-request" });
6557
+ const log$C = KosLog.createLogger({ name: "kos-service-request" });
6558
6558
  const ERROR_UNKNOWN = "errUnknown";
6559
6559
  const MUTATING_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "DELETE", "PATCH"]);
6560
6560
  const RETRY_DEFAULTS = {
@@ -6579,7 +6579,7 @@ async function clientRequest(endpoint, method, options, params2, body) {
6579
6579
  )}`
6580
6580
  ).join("&") : "";
6581
6581
  const fullUrl = `${resolveBaseUrl().URL}${url}${query ? `?${query}` : ""}`;
6582
- log$B.debug(`fullUrl: ${fullUrl}`);
6582
+ log$C.debug(`fullUrl: ${fullUrl}`);
6583
6583
  const fetchOptions = {
6584
6584
  method: String(method).toUpperCase(),
6585
6585
  body: null,
@@ -6607,15 +6607,15 @@ async function executeFetch(fullUrl, fetchOptions) {
6607
6607
  } catch (error) {
6608
6608
  if (error instanceof DOMException) {
6609
6609
  if (error.name === "TimeoutError") {
6610
- log$B.error(`Request timed out: ${fullUrl}`);
6610
+ log$C.error(`Request timed out: ${fullUrl}`);
6611
6611
  return ["Request timed out", null];
6612
6612
  }
6613
6613
  if (error.name === "AbortError") {
6614
- log$B.debug(`Request aborted: ${fullUrl}`);
6614
+ log$C.debug(`Request aborted: ${fullUrl}`);
6615
6615
  return ["Request aborted", null];
6616
6616
  }
6617
6617
  }
6618
- log$B.error(`Unexpected error during fetch: ${error}`);
6618
+ log$C.error(`Unexpected error during fetch: ${error}`);
6619
6619
  return [error instanceof Error ? error.message : ERROR_UNKNOWN, null];
6620
6620
  }
6621
6621
  }
@@ -6635,14 +6635,14 @@ async function executeFetchWithRetry(fullUrl, fetchOptions, config2) {
6635
6635
  errorContext
6636
6636
  ];
6637
6637
  if (config2.retryOn && !config2.retryOn(response)) {
6638
- log$B.debug(
6638
+ log$C.debug(
6639
6639
  `Retry predicate returned false for ${fullUrl} (status ${response.status}), stopping`
6640
6640
  );
6641
6641
  return lastResult;
6642
6642
  }
6643
6643
  if (attempt < config2.maxAttempts) {
6644
6644
  const delayMs = config2.baseDelayMs * Math.pow(config2.backoffFactor, attempt - 1);
6645
- log$B.warn(
6645
+ log$C.warn(
6646
6646
  `Request to ${fullUrl} failed (status ${response.status}), retrying in ${delayMs}ms (attempt ${attempt}/${config2.maxAttempts})`
6647
6647
  );
6648
6648
  await new Promise((resolve) => setTimeout(resolve, delayMs));
@@ -6650,19 +6650,19 @@ async function executeFetchWithRetry(fullUrl, fetchOptions, config2) {
6650
6650
  } catch (error) {
6651
6651
  if (error instanceof DOMException) {
6652
6652
  if (error.name === "TimeoutError") {
6653
- log$B.error(`Request timed out: ${fullUrl}`);
6653
+ log$C.error(`Request timed out: ${fullUrl}`);
6654
6654
  return ["Request timed out", null];
6655
6655
  }
6656
6656
  if (error.name === "AbortError") {
6657
- log$B.debug(`Request aborted: ${fullUrl}`);
6657
+ log$C.debug(`Request aborted: ${fullUrl}`);
6658
6658
  return ["Request aborted", null];
6659
6659
  }
6660
6660
  }
6661
- log$B.error(`Unexpected error during fetch: ${error}`);
6661
+ log$C.error(`Unexpected error during fetch: ${error}`);
6662
6662
  return [error instanceof Error ? error.message : ERROR_UNKNOWN, null];
6663
6663
  }
6664
6664
  }
6665
- log$B.error(`All ${config2.maxAttempts} attempts failed for ${fullUrl}`);
6665
+ log$C.error(`All ${config2.maxAttempts} attempts failed for ${fullUrl}`);
6666
6666
  return lastResult;
6667
6667
  }
6668
6668
  async function captureErrorResponseContext(response) {
@@ -6711,7 +6711,7 @@ const service$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
6711
6711
  default: api$9,
6712
6712
  kosServiceRequest: kosServiceRequest$8
6713
6713
  }, Symbol.toStringTag, { value: "Module" }));
6714
- const log$A = KosLog.createLogger({
6714
+ const log$B = KosLog.createLogger({
6715
6715
  name: "kos-service-request-manager",
6716
6716
  group: "Model"
6717
6717
  });
@@ -6764,7 +6764,7 @@ function isValueMissing(value) {
6764
6764
  }
6765
6765
  function validateRequiredField(value, fieldName, path, isRequired) {
6766
6766
  if (isRequired && isValueMissing(value)) {
6767
- log$A.warn(
6767
+ log$B.warn(
6768
6768
  `Required field '${fieldName}' is missing in response for ${path}`
6769
6769
  );
6770
6770
  }
@@ -6796,7 +6796,7 @@ class ServiceRequestManager {
6796
6796
  this.handlers.get(lifecycle).push(metadata);
6797
6797
  });
6798
6798
  if (Object.keys(handlerMetadata).length > 0) {
6799
- log$A.debug(
6799
+ log$B.debug(
6800
6800
  `Discovered ${Object.keys(handlerMetadata).length} service request handlers for model ${this.model.id}`
6801
6801
  );
6802
6802
  }
@@ -6811,7 +6811,7 @@ class ServiceRequestManager {
6811
6811
  if (!handlers || handlers.length === 0) {
6812
6812
  return;
6813
6813
  }
6814
- log$A.debug(
6814
+ log$B.debug(
6815
6815
  `Executing ${handlers.length} service requests for lifecycle ${lifecycle}`
6816
6816
  );
6817
6817
  await Promise.all(handlers.map((handler) => this.executeHandler(handler)));
@@ -6836,7 +6836,7 @@ class ServiceRequestManager {
6836
6836
  */
6837
6837
  shouldProcessRequest(metadata) {
6838
6838
  if (!shouldExecuteRequest(metadata, this.model)) {
6839
- log$A.debug(`Skipping request ${metadata.path} - condition returned false`);
6839
+ log$B.debug(`Skipping request ${metadata.path} - condition returned false`);
6840
6840
  return false;
6841
6841
  }
6842
6842
  return true;
@@ -7053,7 +7053,7 @@ class ServiceRequestManager {
7053
7053
  case "json":
7054
7054
  return typeof value === "string" ? JSON.parse(value) : value;
7055
7055
  default:
7056
- log$A.warn(`Unknown transformer: ${transform}`);
7056
+ log$B.warn(`Unknown transformer: ${transform}`);
7057
7057
  return value;
7058
7058
  }
7059
7059
  }
@@ -7064,7 +7064,7 @@ class ServiceRequestManager {
7064
7064
  if (!metadata.iterateOver) return data;
7065
7065
  const array = this.getNestedValue(data, metadata.iterateOver);
7066
7066
  if (!Array.isArray(array)) {
7067
- log$A.warn(
7067
+ log$B.warn(
7068
7068
  `iterateOver path '${metadata.iterateOver}' did not resolve to an array`
7069
7069
  );
7070
7070
  return [];
@@ -7107,7 +7107,7 @@ class ServiceRequestManager {
7107
7107
  case "throw":
7108
7108
  throw error;
7109
7109
  case "log":
7110
- log$A.error(
7110
+ log$B.error(
7111
7111
  `Service request failed for ${metadata.path}:`,
7112
7112
  error.message
7113
7113
  );
@@ -7710,7 +7710,7 @@ class BridgeTransport {
7710
7710
  messageQueue = [];
7711
7711
  isSending = false;
7712
7712
  constructor(addr) {
7713
- log$Q.debug(`called Bridge Transport with addr ${addr}`);
7713
+ log$R.debug(`called Bridge Transport with addr ${addr}`);
7714
7714
  const that = this;
7715
7715
  globalThis.kosWindowWebsocketRecv = (msg) => {
7716
7716
  if (that.onmessage) {
@@ -7718,19 +7718,19 @@ class BridgeTransport {
7718
7718
  that.onmessage(data);
7719
7719
  }
7720
7720
  };
7721
- log$Q.debug("Opening bridge transport");
7721
+ log$R.debug("Opening bridge transport");
7722
7722
  globalThis.kosWindowWebsocketOpen();
7723
- log$Q.debug("Opened bridge transport");
7723
+ log$R.debug("Opened bridge transport");
7724
7724
  this._onclose = null;
7725
7725
  this._onerror = null;
7726
7726
  this._onmessage = null;
7727
7727
  this._onopen = null;
7728
- this.addEventListener = () => log$Q.debug("not implemented");
7729
- this.dispatchEvent = () => log$Q.debug("not implemented");
7730
- this.removeEventListener = () => log$Q.debug("not implemented");
7728
+ this.addEventListener = () => log$R.debug("not implemented");
7729
+ this.dispatchEvent = () => log$R.debug("not implemented");
7730
+ this.removeEventListener = () => log$R.debug("not implemented");
7731
7731
  }
7732
7732
  close() {
7733
- log$Q.debug("closing");
7733
+ log$R.debug("closing");
7734
7734
  }
7735
7735
  sendNextMessage() {
7736
7736
  if (this.messageQueue.length > 0) {
@@ -7876,7 +7876,7 @@ if (params$1.fos) {
7876
7876
  const fosPort = process.env.KOS_FOS_PORT;
7877
7877
  window.kosUseFos = !!(window.kosUseFos || process.env.KOS_USE_FOS === "true");
7878
7878
  window.kosFosPort = fosPort ? parseInt(fosPort) : 0;
7879
- const log$z = log$Q.getLogger("web-socket-transport");
7879
+ const log$A = log$R.getLogger("web-socket-transport");
7880
7880
  var KosWSTransportStatus = /* @__PURE__ */ ((KosWSTransportStatus2) => {
7881
7881
  KosWSTransportStatus2["NOT_INITIALIZED"] = "not_initialized";
7882
7882
  KosWSTransportStatus2["INITIALIZED"] = "initialized";
@@ -7933,7 +7933,7 @@ class WebSocketTransport {
7933
7933
  () => this.connectionEstablished,
7934
7934
  (connectionEstablished) => {
7935
7935
  if (connectionEstablished) {
7936
- log$z.warn("Connection Established");
7936
+ log$A.warn("Connection Established");
7937
7937
  this.reconnectAttempts = 0;
7938
7938
  publish(
7939
7939
  WebSocketEvents.CONNECTED,
@@ -7984,7 +7984,7 @@ class WebSocketTransport {
7984
7984
  protocol: this.protocol,
7985
7985
  alias: this.alias,
7986
7986
  onConnectionLost: () => {
7987
- log$z.error(`Connection Lost`);
7987
+ log$A.error(`Connection Lost`);
7988
7988
  this.scheduleReconnect();
7989
7989
  }
7990
7990
  });
@@ -8030,7 +8030,7 @@ class WebSocketTransport {
8030
8030
  return Math.floor(exponentialDelay + jitter);
8031
8031
  }
8032
8032
  _sendSubscriptionMessage(topic, type, fos = false, bridge = false, connectionId, explicitDestination = false) {
8033
- log$z.debug(`${type} to topic ${topic}`);
8033
+ log$A.debug(`${type} to topic ${topic}`);
8034
8034
  let connId;
8035
8035
  if (explicitDestination) {
8036
8036
  connId = connectionId;
@@ -8039,7 +8039,7 @@ class WebSocketTransport {
8039
8039
  const connectionParam = params2?.connId;
8040
8040
  connId = connectionId ?? connectionParam ?? window?.kosBridge?.("connId");
8041
8041
  }
8042
- log$z.debug(`subscribing with connId ${connId}`);
8042
+ log$A.debug(`subscribing with connId ${connId}`);
8043
8043
  const dstAddr = connId ? `dst-addr:${connId}
8044
8044
  ` : "";
8045
8045
  const msg = fos ? `subscribe:${topic}` : bridge ? `type:fos.broker
@@ -8053,7 +8053,7 @@ ${dstAddr}topics:${topic}
8053
8053
  const socket = fos ? this.fosSocket : this.socket;
8054
8054
  socket?.socket?.send(msg);
8055
8055
  } else {
8056
- log$z.debug(`no connection adding to offline messages`);
8056
+ log$A.debug(`no connection adding to offline messages`);
8057
8057
  const socket = fos ? this.fosSocket : this.socket;
8058
8058
  socket?.addOfflineMessage(msg);
8059
8059
  }
@@ -8067,7 +8067,7 @@ ${dstAddr}topics:${topic}
8067
8067
  explicitDestination
8068
8068
  }) {
8069
8069
  const { unsubscribe, count } = subscribe(topic, callback);
8070
- log$z.debug(`Topic ${topic} currently has ${count} subscribers`);
8070
+ log$A.debug(`Topic ${topic} currently has ${count} subscribers`);
8071
8071
  this._sendSubscriptionMessage(
8072
8072
  topic,
8073
8073
  "subscribe",
@@ -8078,7 +8078,7 @@ ${dstAddr}topics:${topic}
8078
8078
  );
8079
8079
  return () => {
8080
8080
  const { count: count2 } = unsubscribe();
8081
- log$z.debug(`Topic ${topic} currently has ${count2} subscribers`);
8081
+ log$A.debug(`Topic ${topic} currently has ${count2} subscribers`);
8082
8082
  if (count2 === 0) {
8083
8083
  this._sendSubscriptionMessage(
8084
8084
  topic,
@@ -8914,7 +8914,7 @@ class KosModelComponentFactory {
8914
8914
  return components;
8915
8915
  }
8916
8916
  }
8917
- const log$y = log$Q.getLogger("kos-model");
8917
+ const log$z = log$R.getLogger("kos-model");
8918
8918
  const MODEL_LOADER = "kos.extension.model.loader";
8919
8919
  class KosModel {
8920
8920
  _id;
@@ -9022,23 +9022,23 @@ class KosModel {
9022
9022
  return this._status === KosModelState.READY;
9023
9023
  }
9024
9024
  async deactivate() {
9025
- log$y.debug(
9025
+ log$z.debug(
9026
9026
  `deactivating model ${this.modelTypeName} with id ${this.modelId}`
9027
9027
  );
9028
9028
  try {
9029
9029
  const context = KosContextManager.getContext(this.modelId);
9030
9030
  await this.modelData?.deactivate?.(context);
9031
- log$y.debug(
9031
+ log$z.debug(
9032
9032
  `Model ${this.modelTypeName} with id ${this.modelId} deactivated`
9033
9033
  );
9034
9034
  this.subscriptionManager?.deactivate();
9035
9035
  } catch (e) {
9036
- log$y.debug(`Model ${this.modelId} failed to deactivated`);
9036
+ log$z.debug(`Model ${this.modelId} failed to deactivated`);
9037
9037
  throw e;
9038
9038
  }
9039
9039
  }
9040
9040
  async activate() {
9041
- log$y.debug(`activating model ${this.modelTypeName} with id ${this.modelId}`);
9041
+ log$z.debug(`activating model ${this.modelTypeName} with id ${this.modelId}`);
9042
9042
  await executeDependentModelLifecycle(this, DependencyLifecycle.ACTIVATE);
9043
9043
  try {
9044
9044
  await this.serviceRequestManager?.executeForLifecycle(
@@ -9047,16 +9047,16 @@ class KosModel {
9047
9047
  const context = KosContextManager.getContext(this.modelId);
9048
9048
  await this.modelData?.activate?.(context);
9049
9049
  this.initializeStateMachineForLifecycle(DependencyLifecycle.ACTIVATE);
9050
- log$y.debug(
9050
+ log$z.debug(
9051
9051
  `Model ${this.modelTypeName} with id ${this.modelId} subscribing to all topics`
9052
9052
  );
9053
9053
  this.subscriptionManager?.registerAll(DependencyLifecycle.ACTIVATE);
9054
9054
  this.createLifecycleCompanions(DependencyLifecycle.ACTIVATE);
9055
- log$y.debug(
9055
+ log$z.debug(
9056
9056
  `Model ${this.modelTypeName} with id ${this.modelId} activated`
9057
9057
  );
9058
9058
  } catch (e) {
9059
- log$y.debug(`Model ${this.modelId} failed to activate`);
9059
+ log$z.debug(`Model ${this.modelId} failed to activate`);
9060
9060
  throw e;
9061
9061
  }
9062
9062
  return;
@@ -9072,7 +9072,7 @@ class KosModel {
9072
9072
  {
9073
9073
  condition: () => this.loaded,
9074
9074
  onMatch: () => {
9075
- log$y.debug(`Model ${this.modelId} is loaded`);
9075
+ log$z.debug(`Model ${this.modelId} is loaded`);
9076
9076
  }
9077
9077
  }
9078
9078
  ]);
@@ -9088,7 +9088,7 @@ class KosModel {
9088
9088
  {
9089
9089
  condition: () => this.initialized,
9090
9090
  onMatch: () => {
9091
- log$y.debug(`Model ${this.modelId} is initialized`);
9091
+ log$z.debug(`Model ${this.modelId} is initialized`);
9092
9092
  }
9093
9093
  }
9094
9094
  ]);
@@ -9104,20 +9104,20 @@ class KosModel {
9104
9104
  {
9105
9105
  condition: () => this.status === KosModelState.READY,
9106
9106
  onMatch: () => {
9107
- log$y.debug(`Model ${this.modelId} is ready`);
9107
+ log$z.debug(`Model ${this.modelId} is ready`);
9108
9108
  }
9109
9109
  }
9110
9110
  ]);
9111
9111
  }
9112
9112
  async ready() {
9113
9113
  if (this.fsm.current === KosModelState.READY) {
9114
- log$y.debug(
9114
+ log$z.debug(
9115
9115
  `already readying model ${this.modelTypeName} with id ${this.modelId} returning`
9116
9116
  );
9117
9117
  return;
9118
9118
  }
9119
9119
  try {
9120
- log$y.debug(`readying model ${this.modelTypeName} with id ${this.modelId}`);
9120
+ log$z.debug(`readying model ${this.modelTypeName} with id ${this.modelId}`);
9121
9121
  await executeDependentModelLifecycle(this, DependencyLifecycle.READY);
9122
9122
  await executeChildrenModelLifecycle(
9123
9123
  this,
@@ -9133,7 +9133,7 @@ class KosModel {
9133
9133
  this.initializeStateMachineForLifecycle(DependencyLifecycle.READY);
9134
9134
  this.subscriptionManager?.registerAll(DependencyLifecycle.READY);
9135
9135
  this.createLifecycleCompanions(DependencyLifecycle.READY);
9136
- log$y.debug(`Model ${this.modelId} is ready`);
9136
+ log$z.debug(`Model ${this.modelId} is ready`);
9137
9137
  const payload = {
9138
9138
  modelId: this.modelId,
9139
9139
  modelType: this.modelTypeName
@@ -9144,7 +9144,7 @@ class KosModel {
9144
9144
  );
9145
9145
  publish(modelTypeEventTopicFactory(this.modelTypeName), payload);
9146
9146
  } catch (e) {
9147
- log$y.error(e);
9147
+ log$z.error(e);
9148
9148
  throw Error(e);
9149
9149
  }
9150
9150
  }
@@ -9155,18 +9155,18 @@ class KosModel {
9155
9155
  }
9156
9156
  const { modelTypeName, modelId } = this;
9157
9157
  if (this.fsm.current === KosModelState.LOADED) {
9158
- log$y.debug(`Model ${modelTypeName} with id ${modelId} already loaded`);
9158
+ log$z.debug(`Model ${modelTypeName} with id ${modelId} already loaded`);
9159
9159
  return;
9160
9160
  }
9161
9161
  if (this._isLoadExecuting) {
9162
- log$y.debug(
9162
+ log$z.debug(
9163
9163
  `Model ${modelTypeName} with id ${modelId} is currently executing load`
9164
9164
  );
9165
9165
  return;
9166
9166
  }
9167
9167
  this._isLoadExecuting = true;
9168
9168
  try {
9169
- log$y.debug(`Loading model ${modelTypeName} with id ${modelId}`);
9169
+ log$z.debug(`Loading model ${modelTypeName} with id ${modelId}`);
9170
9170
  await executeDependentModelLifecycle(this, DependencyLifecycle.LOAD);
9171
9171
  const context = KosContextManager.getContext(modelId);
9172
9172
  const MODEL_LOADER_TYPE = `${MODEL_LOADER}.${modelTypeName}`;
@@ -9175,7 +9175,7 @@ class KosModel {
9175
9175
  {}
9176
9176
  );
9177
9177
  if (loadedContext) {
9178
- log$y.info(
9178
+ log$z.info(
9179
9179
  `Setting loaded context for ${modelId}, type: ${modelTypeName}`
9180
9180
  );
9181
9181
  context?.set(MODEL_LOADER_TYPE, loadedContext);
@@ -9187,7 +9187,7 @@ class KosModel {
9187
9187
  kosAction(() => {
9188
9188
  this.loaded = true;
9189
9189
  });
9190
- log$y.debug(
9190
+ log$z.debug(
9191
9191
  `Model ${modelTypeName} with id ${modelId} successfully loaded`
9192
9192
  );
9193
9193
  this.initializeStateMachineForLifecycle(DependencyLifecycle.LOAD);
@@ -9196,14 +9196,14 @@ class KosModel {
9196
9196
  this.effectManager?.setup();
9197
9197
  this.createLifecycleCompanions(DependencyLifecycle.LOAD);
9198
9198
  } catch (e) {
9199
- log$y.error(`Model ${modelId} failed to load`, e);
9199
+ log$z.error(`Model ${modelId} failed to load`, e);
9200
9200
  throw e;
9201
9201
  } finally {
9202
9202
  this._isLoadExecuting = false;
9203
9203
  }
9204
9204
  }
9205
9205
  async unload() {
9206
- log$y.debug(`unloading model ${this.modelTypeName} with id ${this.modelId}`);
9206
+ log$z.debug(`unloading model ${this.modelTypeName} with id ${this.modelId}`);
9207
9207
  try {
9208
9208
  const childrenUnload = this.getChildren().map((child) => child.unload?.()).filter((p) => !!p);
9209
9209
  await Promise.allSettled(childrenUnload);
@@ -9222,12 +9222,12 @@ class KosModel {
9222
9222
  modelData.stateHistory = [];
9223
9223
  }
9224
9224
  }
9225
- log$y.debug(`Model ${this.modelTypeName} with id ${this.modelId} unloaded`);
9225
+ log$z.debug(`Model ${this.modelTypeName} with id ${this.modelId} unloaded`);
9226
9226
  this.effectManager?.disposeAll();
9227
9227
  this.subscriptionManager?.disposeAll();
9228
9228
  this.httpRouteManager?.dispose();
9229
9229
  } catch (e) {
9230
- log$y.debug(`Model ${this.modelId} failed to unload`);
9230
+ log$z.debug(`Model ${this.modelId} failed to unload`);
9231
9231
  throw e;
9232
9232
  }
9233
9233
  }
@@ -9238,7 +9238,7 @@ class KosModel {
9238
9238
  }
9239
9239
  const { modelId, modelTypeName } = this;
9240
9240
  const context = KosContextManager.getContext(modelId);
9241
- log$y.debug(`Initializing model ${modelTypeName} with id ${modelId}`);
9241
+ log$z.debug(`Initializing model ${modelTypeName} with id ${modelId}`);
9242
9242
  await executeDependentModelLifecycle(this, DependencyLifecycle.INIT);
9243
9243
  try {
9244
9244
  await this.serviceRequestManager?.executeForLifecycle(
@@ -9246,18 +9246,18 @@ class KosModel {
9246
9246
  );
9247
9247
  await this.modelData?.init?.(context);
9248
9248
  this.initialized = true;
9249
- log$y.debug(`Model ${modelTypeName} with id ${modelId} initialized`);
9249
+ log$z.debug(`Model ${modelTypeName} with id ${modelId} initialized`);
9250
9250
  this.onlineLifecycleManager?.register();
9251
9251
  this.initializeStateMachineForLifecycle(DependencyLifecycle.INIT);
9252
9252
  this.registerSubscribers(DependencyLifecycle.INIT);
9253
9253
  this.createLifecycleCompanions(DependencyLifecycle.INIT);
9254
9254
  } catch (e) {
9255
- log$y.error(`Model ${modelId} failed to initialize`, e);
9255
+ log$z.error(`Model ${modelId} failed to initialize`, e);
9256
9256
  throw e;
9257
9257
  }
9258
9258
  }
9259
9259
  async registerSubscribers(lifecycle) {
9260
- log$y.debug(
9260
+ log$z.debug(
9261
9261
  `registering subscribers in ${this.modelTypeName} with id ${this.modelId}`
9262
9262
  );
9263
9263
  this.subscriptionManager?.registerAll(lifecycle);
@@ -9281,14 +9281,14 @@ class KosModel {
9281
9281
  this.modelManager.createLifecycleCompanions(this, {}, lifecycle);
9282
9282
  }
9283
9283
  async online() {
9284
- log$y.debug(`online model ${this.modelTypeName} with id ${this.modelId}`);
9284
+ log$z.debug(`online model ${this.modelTypeName} with id ${this.modelId}`);
9285
9285
  this.registerSubscribers();
9286
9286
  const context = KosContextManager.getContext(this.modelId);
9287
9287
  await this.modelData?.online?.(context);
9288
9288
  this.createLifecycleCompanions(DependencyLifecycle.ONLINE);
9289
9289
  }
9290
9290
  async offline() {
9291
- log$y.debug(`offline model ${this.modelTypeName} with id ${this.modelId}`);
9291
+ log$z.debug(`offline model ${this.modelTypeName} with id ${this.modelId}`);
9292
9292
  this.subscriptionManager?.disposeAll();
9293
9293
  const context = KosContextManager.getContext(this.modelId);
9294
9294
  await this.modelData?.offline?.(context);
@@ -9306,7 +9306,7 @@ class KosModel {
9306
9306
  this.companionManager.clear();
9307
9307
  }
9308
9308
  }
9309
- const log$x = KosLog.createLogger({ name: "kos-model-instantiator" });
9309
+ const log$y = KosLog.createLogger({ name: "kos-model-instantiator" });
9310
9310
  class KosModelInstantiator {
9311
9311
  constructor(registry, cache2) {
9312
9312
  this.registry = registry;
@@ -9324,7 +9324,7 @@ class KosModelInstantiator {
9324
9324
  const modelRegistry = this.registry.models[typeId];
9325
9325
  if (!modelRegistry) {
9326
9326
  const errorMessage = `No model registered for type ${typeId}`;
9327
- log$x.error(errorMessage, {
9327
+ log$y.error(errorMessage, {
9328
9328
  modelType: typeId,
9329
9329
  requestedId: id,
9330
9330
  providedOptions: options,
@@ -9343,7 +9343,7 @@ class KosModelInstantiator {
9343
9343
  const modelId = modelRegistry.singleton ? typeId : id;
9344
9344
  this.cache.restoreFromDeleteCache(modelId);
9345
9345
  if (!this.cache.hasModel(modelId)) {
9346
- log$x.debug(`Creating model instance: ${typeId} [${modelId}]`);
9346
+ log$y.debug(`Creating model instance: ${typeId} [${modelId}]`);
9347
9347
  const hasOptions = options && Object.keys(options).length > 0;
9348
9348
  const modelClass = modelRegistry.class || modelRegistry.create;
9349
9349
  const requiresOptions = modelClass?.prototype?.[OptionsRequired] === true;
@@ -9389,7 +9389,7 @@ class KosModelInstantiator {
9389
9389
  }
9390
9390
  const activeModel = this.cache.getModelById(modelId);
9391
9391
  if (!activeModel) {
9392
- log$x.error(`Model ${typeId} [${modelId}] not found in cache`);
9392
+ log$y.error(`Model ${typeId} [${modelId}] not found in cache`);
9393
9393
  throw new Error(`Model ${typeId} [${modelId}] not found in cache`);
9394
9394
  }
9395
9395
  return { model: activeModel, data: activeModel.modelData };
@@ -9455,7 +9455,7 @@ let KosModelRegistry$1 = class KosModelRegistry {
9455
9455
  }
9456
9456
  };
9457
9457
  const MODEL_DELETION_DELAY = 10;
9458
- const log$w = KosLog.createLogger({ name: "kos-model-manager" });
9458
+ const log$x = KosLog.createLogger({ name: "kos-model-manager" });
9459
9459
  class KosModelManager {
9460
9460
  cache;
9461
9461
  instantiator;
@@ -9498,7 +9498,7 @@ class KosModelManager {
9498
9498
  }
9499
9499
  static getInstance(reset2) {
9500
9500
  if (!globalThis.kos?.modelManager || reset2) {
9501
- log$w.debug("Creating new instance of KosModelManager");
9501
+ log$x.debug("Creating new instance of KosModelManager");
9502
9502
  new this();
9503
9503
  }
9504
9504
  return globalThis.kos?.modelManager;
@@ -9520,7 +9520,7 @@ class KosModelManager {
9520
9520
  */
9521
9521
  get preloadedModels() {
9522
9522
  return this.cache.preload((modelKey) => {
9523
- log$w.debug(`preloading ${modelKey}`);
9523
+ log$x.debug(`preloading ${modelKey}`);
9524
9524
  if (typeof modelKey === "string") {
9525
9525
  return this.createModelInstance(modelKey).model;
9526
9526
  } else {
@@ -9837,7 +9837,7 @@ const coreFsm = (core) => {
9837
9837
  });
9838
9838
  const online = robot3.interpret(
9839
9839
  onlineMachine2,
9840
- (_service) => log$Q.debug(_service.machine.current)
9840
+ (_service) => log$R.debug(_service.machine.current)
9841
9841
  );
9842
9842
  const machine2 = robot3.createMachine({
9843
9843
  [
@@ -9968,11 +9968,11 @@ const coreFsm = (core) => {
9968
9968
  });
9969
9969
  const service2 = robot3.interpret(
9970
9970
  machine2,
9971
- (_service) => log$Q.debug(_service.machine.current)
9971
+ (_service) => log$R.debug(_service.machine.current)
9972
9972
  );
9973
9973
  return { service: service2, online };
9974
9974
  };
9975
- const log$v = KosLog.createLogger({ name: "kos-core" });
9975
+ const log$w = KosLog.createLogger({ name: "kos-core" });
9976
9976
  const getConnectionAlias = () => {
9977
9977
  const params2 = getQueryParams();
9978
9978
  const alias = params2?.alias;
@@ -10085,7 +10085,7 @@ class KosCore {
10085
10085
  try {
10086
10086
  await model.offline?.();
10087
10087
  } catch (e) {
10088
- log$v.error(`model ${model.modelId} offline() threw:`, e);
10088
+ log$w.error(`model ${model.modelId} offline() threw:`, e);
10089
10089
  }
10090
10090
  model.onlineLifecycleManager?.dispose();
10091
10091
  })
@@ -10100,7 +10100,7 @@ class KosCore {
10100
10100
  try {
10101
10101
  await model.online?.();
10102
10102
  } catch (e) {
10103
- log$v.error(`model ${model.modelId} online() threw:`, e);
10103
+ log$w.error(`model ${model.modelId} online() threw:`, e);
10104
10104
  }
10105
10105
  })
10106
10106
  );
@@ -10116,11 +10116,11 @@ class KosCore {
10116
10116
  this.transport.authorized = false;
10117
10117
  });
10118
10118
  subscribe(WebSocketEvents.RELOAD, () => {
10119
- log$v.warn("WebSocket requested reload");
10119
+ log$w.warn("WebSocket requested reload");
10120
10120
  this.fsmService.service.send(KosCoreEvents.RELOAD);
10121
10121
  });
10122
10122
  subscribe("/studio/project/reload", () => {
10123
- log$v.warn("Project requested reload");
10123
+ log$w.warn("Project requested reload");
10124
10124
  this.fsmService.service.send(KosCoreEvents.RELOAD);
10125
10125
  });
10126
10126
  const ws = WebSocketTransport.getInstance();
@@ -10153,33 +10153,33 @@ class KosCore {
10153
10153
  async reload() {
10154
10154
  const currentTime = Date.now();
10155
10155
  if (this._reloading) {
10156
- log$v.info("reload already in progress");
10156
+ log$w.info("reload already in progress");
10157
10157
  return;
10158
10158
  }
10159
10159
  this._reloading = true;
10160
- log$v.warn("reloading KOS Core");
10161
- log$v.warn("reloading preloaded models");
10160
+ log$w.warn("reloading KOS Core");
10161
+ log$w.warn("reloading preloaded models");
10162
10162
  const modelManager = this.modelManager;
10163
10163
  for (const model of modelManager.preloadedModels) {
10164
10164
  if (isReloadable(model.modelData)) {
10165
10165
  if (isSelfManagedReload(model.modelData)) {
10166
- log$v.info(`skipping self-managed model ${model.modelId}`);
10166
+ log$w.info(`skipping self-managed model ${model.modelId}`);
10167
10167
  continue;
10168
10168
  }
10169
- log$v.info(`reloading model ${model.modelId}`);
10169
+ log$w.info(`reloading model ${model.modelId}`);
10170
10170
  model.unload?.();
10171
10171
  await model.modelData.reload();
10172
10172
  model.registerSubscribers?.();
10173
- log$v.info(`reloading model ${model.modelId} complete`);
10173
+ log$w.info(`reloading model ${model.modelId} complete`);
10174
10174
  }
10175
10175
  }
10176
10176
  for (const model of modelManager.models) {
10177
10177
  if (!modelManager.preloadedModels.includes(model) && isReloadable(model.modelData)) {
10178
10178
  if (isSelfManagedReload(model.modelData)) {
10179
- log$v.info(`skipping self-managed model ${model.modelId}`);
10179
+ log$w.info(`skipping self-managed model ${model.modelId}`);
10180
10180
  continue;
10181
10181
  }
10182
- log$v.warn(`reloading model ${model.modelId}`);
10182
+ log$w.warn(`reloading model ${model.modelId}`);
10183
10183
  model.unload?.();
10184
10184
  await model.modelData.reload();
10185
10185
  model.registerSubscribers?.();
@@ -10188,27 +10188,27 @@ class KosCore {
10188
10188
  const elapsed = Date.now() - currentTime;
10189
10189
  setTimeout(() => {
10190
10190
  mobx.runInAction(() => {
10191
- log$v.warn("reloading KOS Core complete");
10191
+ log$w.warn("reloading KOS Core complete");
10192
10192
  this._reloading = false;
10193
10193
  });
10194
10194
  }, 1e3 - elapsed);
10195
10195
  }
10196
10196
  async online() {
10197
- log$v.debug("KOS Core going online");
10197
+ log$w.debug("KOS Core going online");
10198
10198
  await this._transport.whenReady();
10199
- log$v.debug("KOS Transport Ready. Calling online() for models");
10199
+ log$w.debug("KOS Transport Ready. Calling online() for models");
10200
10200
  publish("/kosCore/online", "/kosCore/online");
10201
10201
  console.timeEnd("kosCore:startup");
10202
10202
  }
10203
10203
  async offline() {
10204
- log$v.debug("KOS Core going offline");
10204
+ log$w.debug("KOS Core going offline");
10205
10205
  publish("/kosCore/offline", "/kosCore/offline");
10206
10206
  }
10207
10207
  async unload() {
10208
- log$v.debug("Unloading KOS Core");
10208
+ log$w.debug("Unloading KOS Core");
10209
10209
  const currentTime = Date.now();
10210
10210
  this._unloading = true;
10211
- log$v.debug("unloading KOS Core");
10211
+ log$w.debug("unloading KOS Core");
10212
10212
  const modelManager = this.modelManager;
10213
10213
  for (const model of modelManager.models) {
10214
10214
  if (isUnloadable(model.modelData)) {
@@ -10226,7 +10226,7 @@ class KosCore {
10226
10226
  await mobx.when(() => this.status === KosCoreState.READY);
10227
10227
  }
10228
10228
  async ready() {
10229
- log$v.debug("Readying KOS Core");
10229
+ log$w.debug("Readying KOS Core");
10230
10230
  await this._transport.whenReady();
10231
10231
  const promises = this.modelManager.preloadedModels.map((model) => {
10232
10232
  return {
@@ -10248,14 +10248,14 @@ class KosCore {
10248
10248
  );
10249
10249
  const failed = settled.filter((p) => p.status === "rejected");
10250
10250
  if (failed.length) {
10251
- log$v.error(
10251
+ log$w.error(
10252
10252
  `There were ${failed.length} failed models on model preloading`
10253
10253
  );
10254
10254
  throw Error(
10255
10255
  `There were ${failed.length} failed models on model preloading`
10256
10256
  );
10257
10257
  }
10258
- log$v.debug(`leaving kos-core ready() `);
10258
+ log$w.debug(`leaving kos-core ready() `);
10259
10259
  }
10260
10260
  get isReady() {
10261
10261
  return this.status === KosCoreState.READY;
@@ -10273,19 +10273,19 @@ class KosCore {
10273
10273
  return this.loaded;
10274
10274
  }
10275
10275
  async init() {
10276
- log$v.debug("entering kos-core init()");
10276
+ log$w.debug("entering kos-core init()");
10277
10277
  console.time("kosCore:startup");
10278
10278
  console.time("kosCore:init");
10279
10279
  await this._transport.whenReady();
10280
10280
  this.initialized = true;
10281
- log$v.debug("initialized - leaving kos-core init()");
10281
+ log$w.debug("initialized - leaving kos-core init()");
10282
10282
  console.timeEnd("kosCore:init");
10283
10283
  }
10284
10284
  async load() {
10285
- log$v.debug("entering kos-core load()");
10285
+ log$w.debug("entering kos-core load()");
10286
10286
  console.time("kosCore:load");
10287
10287
  this.loaded = true;
10288
- log$v.debug("loaded - leaving kos-core load()");
10288
+ log$w.debug("loaded - leaving kos-core load()");
10289
10289
  console.timeEnd("kosCore:load");
10290
10290
  }
10291
10291
  static create(registry, reset2, connectionAlias) {
@@ -10364,7 +10364,7 @@ class KosCore {
10364
10364
  return this._instance;
10365
10365
  }
10366
10366
  }
10367
- const log$u = KosLog.createLogger({
10367
+ const log$v = KosLog.createLogger({
10368
10368
  name: "kos-model-visitor",
10369
10369
  group: "kos-ui-core"
10370
10370
  });
@@ -10405,7 +10405,7 @@ class KosModelVisitor {
10405
10405
  */
10406
10406
  visit(model) {
10407
10407
  if (this.visitedModels.has(model.modelId)) {
10408
- log$u.info(`model ${model.modelId} already visited`);
10408
+ log$v.info(`model ${model.modelId} already visited`);
10409
10409
  return;
10410
10410
  }
10411
10411
  const stopVisiting = !!this.visitModel(model.modelData, this);
@@ -10898,7 +10898,7 @@ async function retryWithExponentialBackoff(operation, options) {
10898
10898
  }
10899
10899
  throw new Error("All attempts failed");
10900
10900
  }
10901
- const log$t = KosLog.createLogger({ name: "kos-service-request" });
10901
+ const log$u = KosLog.createLogger({ name: "kos-service-request" });
10902
10902
  const resolveServiceUrl = (_service) => {
10903
10903
  const MOCK = false;
10904
10904
  const URL2 = exports.BASE_URL;
@@ -11070,7 +11070,7 @@ const getOne$7 = (destinationAddress2, url, _fetch) => async ({
11070
11070
  destinationAddress: destinationAddressOverride
11071
11071
  });
11072
11072
  const resolvedUrl = urlOverride || url;
11073
- log$t.debug(`resolvedUrl: ${resolvedUrl}`);
11073
+ log$u.debug(`resolvedUrl: ${resolvedUrl}`);
11074
11074
  try {
11075
11075
  const response = await _fetch(resolvedUrl, options);
11076
11076
  if (!response.ok) {
@@ -11444,7 +11444,7 @@ const getKosSessionKey = () => `kos-${_sessionKey}`;
11444
11444
  const isLocalRefId = (id) => !!id && !id.includes("VM_SERVICE") && id.startsWith(getKosSessionKey());
11445
11445
  const waitForRequest = async (requestId, timeout = 6e4) => new Promise((resolve, reject) => {
11446
11446
  const { unsubscribe } = subscribe(requestId, (op) => {
11447
- log$Q.debug(`recieved response for refId ${requestId}: ${op}`);
11447
+ log$R.debug(`recieved response for refId ${requestId}: ${op}`);
11448
11448
  unsubscribe();
11449
11449
  clearTimeout(cancel);
11450
11450
  try {
@@ -11719,7 +11719,7 @@ function collectRecords(items) {
11719
11719
  }
11720
11720
  return result;
11721
11721
  }
11722
- const log$s = KosLog.createLogger({ name: "kos-data-container" });
11722
+ const log$t = KosLog.createLogger({ name: "kos-data-container" });
11723
11723
  class KosDataContainer {
11724
11724
  _data;
11725
11725
  _sortKey;
@@ -11924,7 +11924,7 @@ class KosDataContainer {
11924
11924
  const idx = this.index.get(indexName);
11925
11925
  return idx.keys ?? [];
11926
11926
  } else {
11927
- log$s.info(
11927
+ log$t.info(
11928
11928
  `index ${indexName} not found in ${Array.from(this.index.keys())}`
11929
11929
  );
11930
11930
  return [];
@@ -11936,7 +11936,7 @@ class KosDataContainer {
11936
11936
  if (idx.index.has(indexKey)) {
11937
11937
  return idx.getByKey(indexKey);
11938
11938
  } else {
11939
- log$s.info(
11939
+ log$t.info(
11940
11940
  `key ${indexKey} not found in ${indexName} index: ${Array.from(
11941
11941
  idx.index.keys()
11942
11942
  )}`
@@ -11944,7 +11944,7 @@ class KosDataContainer {
11944
11944
  return [];
11945
11945
  }
11946
11946
  } else {
11947
- log$s.info(
11947
+ log$t.info(
11948
11948
  `index ${indexName} not found in ${Array.from(this.index.keys())}`
11949
11949
  );
11950
11950
  return [];
@@ -11971,7 +11971,7 @@ class KosDataContainer {
11971
11971
  * @private
11972
11972
  */
11973
11973
  _logDataCapacityWarning(toEvict) {
11974
- log$s.info(
11974
+ log$t.info(
11975
11975
  `Data container capacity exceeded (${this._data.size}/${this._maxCapacity}). Evicting ${toEvict} items using ${this._evictionStrategy} strategy. This may indicate missing cleanup handlers or data inconsistency.`
11976
11976
  );
11977
11977
  }
@@ -12031,7 +12031,7 @@ class KosDataContainer {
12031
12031
  const candidates = this._customEvictionFilter(this.data);
12032
12032
  return candidates.slice(0, count).map((item) => item.id);
12033
12033
  }
12034
- log$s.error(
12034
+ log$t.error(
12035
12035
  "Custom eviction strategy specified but no customEvictionFilter provided. Falling back to FIFO."
12036
12036
  );
12037
12037
  return this._selectFifoData(count);
@@ -12043,7 +12043,7 @@ class KosDataContainer {
12043
12043
  _removeEvictedData(ids) {
12044
12044
  ids.forEach((id) => {
12045
12045
  const item = this._data.get(id);
12046
- log$s.info(`Evicting data item: ${id}`, {
12046
+ log$t.info(`Evicting data item: ${id}`, {
12047
12047
  itemId: id,
12048
12048
  itemType: item ? item.constructor?.name : "unknown",
12049
12049
  strategy: this._evictionStrategy
@@ -12056,7 +12056,7 @@ class KosDataContainer {
12056
12056
  * @private
12057
12057
  */
12058
12058
  _logDataEvictionComplete(evictedCount) {
12059
- log$s.info(
12059
+ log$t.info(
12060
12060
  `Evicted ${evictedCount} data items. Current size: ${this._data.size}/${this._maxCapacity}`
12061
12061
  );
12062
12062
  }
@@ -12295,14 +12295,14 @@ class BrowserKosRouter {
12295
12295
  }, {});
12296
12296
  }
12297
12297
  }
12298
- const log$r = KosLog.createLogger({ name: "intent-service" });
12298
+ const log$s = KosLog.createLogger({ name: "intent-service" });
12299
12299
  const sendIntent = (intent) => {
12300
12300
  if (hasEventSubscriptions(`/kos/intent/${intent.type}`)) {
12301
12301
  publish(`/kos/intent/${intent.type}`, intent.options, {
12302
12302
  "kos.intent.type": intent.type
12303
12303
  });
12304
12304
  } else {
12305
- log$r.info(`No subscribers for intent ${intent.type}. Intent not sent.`);
12305
+ log$s.info(`No subscribers for intent ${intent.type}. Intent not sent.`);
12306
12306
  }
12307
12307
  };
12308
12308
  const sendAsyncIntent = async (intent) => new Promise((resolve) => {
@@ -12332,11 +12332,11 @@ const sendAsyncIntent = async (intent) => new Promise((resolve) => {
12332
12332
  sync: requestId
12333
12333
  });
12334
12334
  } else {
12335
- log$r.info(`No subscribers for intent ${intent.type}. Intent not sent.`);
12335
+ log$s.info(`No subscribers for intent ${intent.type}. Intent not sent.`);
12336
12336
  resolve([null, { body: void 0, payload: void 0 }]);
12337
12337
  }
12338
12338
  });
12339
- const log$q = KosLog.createLogger({ name: "app-startup-service" });
12339
+ const log$r = KosLog.createLogger({ name: "app-startup-service" });
12340
12340
  async function waitForAppsToStart(appIds, options = {}) {
12341
12341
  const {
12342
12342
  timeout = 3e4,
@@ -12344,10 +12344,10 @@ async function waitForAppsToStart(appIds, options = {}) {
12344
12344
  requirePostStarted = false
12345
12345
  } = options;
12346
12346
  if (appIds.length === 0) {
12347
- log$q.warn("No app IDs provided to waitForAppsToStart");
12347
+ log$r.warn("No app IDs provided to waitForAppsToStart");
12348
12348
  return true;
12349
12349
  }
12350
- log$q.debug(`Waiting for apps to start: ${appIds.join(", ")}`);
12350
+ log$r.debug(`Waiting for apps to start: ${appIds.join(", ")}`);
12351
12351
  try {
12352
12352
  const eventTopics = appIds.map((appId) => `/kos/app/started/${appId}`);
12353
12353
  const startedApps = await waitForAllWithState(eventTopics, {
@@ -12356,12 +12356,12 @@ async function waitForAppsToStart(appIds, options = {}) {
12356
12356
  const { default: api2 } = await Promise.resolve().then(() => service$8);
12357
12357
  const [error, data] = await api2.get("/api/kos/apps/started");
12358
12358
  if (error) {
12359
- log$q.error("Error fetching started apps:", error);
12359
+ log$r.error("Error fetching started apps:", error);
12360
12360
  return [];
12361
12361
  }
12362
12362
  return data;
12363
12363
  } catch (error) {
12364
- log$q.error("Failed to fetch app startup status:", error);
12364
+ log$r.error("Failed to fetch app startup status:", error);
12365
12365
  }
12366
12366
  return [];
12367
12367
  },
@@ -12383,17 +12383,17 @@ async function waitForAppsToStart(appIds, options = {}) {
12383
12383
  });
12384
12384
  if (notStartedApps.length > 0) {
12385
12385
  const message2 = `Apps not started: ${notStartedApps.join(", ")}`;
12386
- log$q.error(message2);
12386
+ log$r.error(message2);
12387
12387
  if (throwOnTimeout) {
12388
12388
  throw new Error(`App startup timeout: ${message2}`);
12389
12389
  }
12390
12390
  return false;
12391
12391
  }
12392
- log$q.info(`All apps started successfully: ${appIds.join(", ")}`);
12392
+ log$r.info(`All apps started successfully: ${appIds.join(", ")}`);
12393
12393
  return true;
12394
12394
  } catch (error) {
12395
12395
  const message2 = `Failed to wait for apps to start: ${appIds.join(", ")}`;
12396
- log$q.error(message2, error);
12396
+ log$r.error(message2, error);
12397
12397
  if (throwOnTimeout) {
12398
12398
  throw new Error(
12399
12399
  `${message2} - ${error instanceof Error ? error.message : String(error)}`
@@ -12420,7 +12420,7 @@ async function checkAppsStarted(appIds, requirePostStarted = false) {
12420
12420
  result[appId] = app?.started === true && (!requirePostStarted || app?.postStarted === true);
12421
12421
  });
12422
12422
  } catch (error) {
12423
- log$q.error("Failed to check app startup status:", error);
12423
+ log$r.error("Failed to check app startup status:", error);
12424
12424
  appIds.forEach((appId) => result[appId] = false);
12425
12425
  }
12426
12426
  return result;
@@ -12434,7 +12434,7 @@ async function getStartedApps() {
12434
12434
  const result = await response.json();
12435
12435
  return result?.data ?? [];
12436
12436
  } catch (error) {
12437
- log$q.error("Failed to fetch started apps:", error);
12437
+ log$r.error("Failed to fetch started apps:", error);
12438
12438
  return [];
12439
12439
  }
12440
12440
  }
@@ -12461,7 +12461,7 @@ var Topics = /* @__PURE__ */ ((Topics2) => {
12461
12461
  Topics2["TIMEZONE_CHANGE"] = "/kos/internal/time/timezone";
12462
12462
  return Topics2;
12463
12463
  })(Topics || {});
12464
- const log$p = KosLog.createLogger({
12464
+ const log$q = KosLog.createLogger({
12465
12465
  name: "config-bean-service",
12466
12466
  group: "Services"
12467
12467
  });
@@ -12472,7 +12472,7 @@ const { postModel: postModel$5, getOne: getOne$6 } = ServiceFactory.build({
12472
12472
  basePath: `${URL$e}/kos/config/`
12473
12473
  });
12474
12474
  const modifyConfigBean = async (id, model, path = `/api/kos/config`) => {
12475
- log$p.debug(`sending modify request for ConfigBean: ${id}`);
12475
+ log$q.debug(`sending modify request for ConfigBean: ${id}`);
12476
12476
  const response = postModel$5({
12477
12477
  model,
12478
12478
  urlOverride: `${URL$e}${path}/${id}`
@@ -12480,7 +12480,7 @@ const modifyConfigBean = async (id, model, path = `/api/kos/config`) => {
12480
12480
  return response;
12481
12481
  };
12482
12482
  const getConfigBean = async (id, path = `/api/kos/config`) => {
12483
- log$p.debug(`sending get request for ConfigBean: ${id}`);
12483
+ log$q.debug(`sending get request for ConfigBean: ${id}`);
12484
12484
  const response = await getOne$6({
12485
12485
  urlOverride: `${URL$e}${path}/details/${id}/15`
12486
12486
  });
@@ -12592,7 +12592,7 @@ function matchValue(patterns, value) {
12592
12592
  return void 0;
12593
12593
  }
12594
12594
  const CONFIG_BEAN_MODEL_TYPE = "config-bean-model";
12595
- const log$o = KosLog.getLogger(CONFIG_BEAN_MODEL_TYPE);
12595
+ const log$p = KosLog.getLogger(CONFIG_BEAN_MODEL_TYPE);
12596
12596
  const PATH_PROP$3 = createPropKey("path");
12597
12597
  function servicePathMapper$1(configBeanModel) {
12598
12598
  const hasMapper = ExtensionManager.propertyMapper.hasMapper(
@@ -12665,8 +12665,8 @@ let ConfigBeanModelImpl = class {
12665
12665
  * @internal
12666
12666
  */
12667
12667
  async ready() {
12668
- log$o.debug(`readying config bean ${this.path}`);
12669
- log$o.debug(`complete readying config bean ${this.path}`);
12668
+ log$p.debug(`readying config bean ${this.path}`);
12669
+ log$p.debug(`complete readying config bean ${this.path}`);
12670
12670
  }
12671
12671
  /**
12672
12672
  * @internal
@@ -12677,12 +12677,12 @@ let ConfigBeanModelImpl = class {
12677
12677
  * In future additional information about the workspace could be loaded
12678
12678
  */
12679
12679
  async load() {
12680
- log$o.debug(`loading config bean ${this.path}`);
12680
+ log$p.debug(`loading config bean ${this.path}`);
12681
12681
  const response = await this._getConfigBean(this.path, this.serviceBasePath);
12682
12682
  if (response?.data) {
12683
12683
  const data = response.data;
12684
12684
  mapDtoToConfigBeanModel(data, this);
12685
- log$o.debug(this.values);
12685
+ log$p.debug(this.values);
12686
12686
  const schemaResponse = response?.data.details[0].schema;
12687
12687
  kosAction(() => {
12688
12688
  if (schemaResponse) {
@@ -12950,7 +12950,7 @@ var __decorateClass$z = (decorators, target, key, kind) => {
12950
12950
  return result;
12951
12951
  };
12952
12952
  const MODEL_TYPE$w = "region-info-model";
12953
- const log$n = KosLog.createLogger({ name: "region-info-model" });
12953
+ const log$o = KosLog.createLogger({ name: "region-info-model" });
12954
12954
  function servicePathMapper(regionInfoModel) {
12955
12955
  const hasMapper = ExtensionManager.propertyMapper.hasMapper(
12956
12956
  KosCoreModelPropertyMapper.RegionServicePath
@@ -13241,7 +13241,7 @@ let RegionInfoModelImpl = class {
13241
13241
  }
13242
13242
  toUnit = measureSystems[to.system]?.["default"];
13243
13243
  if (!toUnit) {
13244
- log$n.info("Could not find default unit for measure", to.measure);
13244
+ log$o.info("Could not find default unit for measure", to.measure);
13245
13245
  }
13246
13246
  }
13247
13247
  if (!fromUnit && from.measure && from.system) {
@@ -13255,11 +13255,11 @@ let RegionInfoModelImpl = class {
13255
13255
  }
13256
13256
  fromUnit = measureSystems[from.system]?.["default"];
13257
13257
  if (!fromUnit) {
13258
- log$n.info("Could not find default unit for measure", from.measure);
13258
+ log$o.info("Could not find default unit for measure", from.measure);
13259
13259
  }
13260
13260
  }
13261
13261
  if (!fromUnit || !toUnit) {
13262
- log$n.warn("Could not find unit to convert to or from. Return value as is");
13262
+ log$o.warn("Could not find unit to convert to or from. Return value as is");
13263
13263
  return String(value);
13264
13264
  }
13265
13265
  return this.convertByUnit(value, fromUnit, toUnit);
@@ -13269,13 +13269,13 @@ let RegionInfoModelImpl = class {
13269
13269
  * @internal
13270
13270
  */
13271
13271
  async init() {
13272
- log$n.debug("initializing region info");
13272
+ log$o.debug("initializing region info");
13273
13273
  }
13274
13274
  /**
13275
13275
  * @internal
13276
13276
  */
13277
13277
  async load() {
13278
- log$n.debug("loading region info");
13278
+ log$o.debug("loading region info");
13279
13279
  const regions = await getRegions(this.serviceBasePath);
13280
13280
  if (regions) {
13281
13281
  this.regions = regions.data.map((region) => region.id);
@@ -13595,7 +13595,7 @@ function secondsToFormattedTime(secondsSinceMidnight, formatString) {
13595
13595
  return dateFns.format(time, formatString);
13596
13596
  }
13597
13597
  const MODEL_TYPE$v = "config-bean-prop-model";
13598
- const log$m = KosLog.createLogger({ name: "config-bean-prop-model" });
13598
+ const log$n = KosLog.createLogger({ name: "config-bean-prop-model" });
13599
13599
  const PATH_PROP$2 = createPropKey("path");
13600
13600
  const SERVICE_PATH_PROP = createPropKey("serviceBasePath");
13601
13601
  let KosConfigPropertyImpl = class {
@@ -13791,7 +13791,7 @@ let KosConfigPropertyImpl = class {
13791
13791
  return Number(result2);
13792
13792
  }
13793
13793
  } catch (e) {
13794
- log$m.info(`error formatting value ${_val}`, e);
13794
+ log$n.info(`error formatting value ${_val}`, e);
13795
13795
  }
13796
13796
  const result = Number(_val).toFixed(decimals);
13797
13797
  return result;
@@ -13830,7 +13830,7 @@ let KosConfigPropertyImpl = class {
13830
13830
  * @internal
13831
13831
  */
13832
13832
  async activate() {
13833
- log$m.debug(`activating config bean ${this.id}`);
13833
+ log$n.debug(`activating config bean ${this.id}`);
13834
13834
  }
13835
13835
  /**
13836
13836
  * Gets the formatted display string with units and localization.
@@ -13863,7 +13863,7 @@ let KosConfigPropertyImpl = class {
13863
13863
  return result;
13864
13864
  }
13865
13865
  } catch (e) {
13866
- log$m.error(`error formatting value ${_val}`, e);
13866
+ log$n.error(`error formatting value ${_val}`, e);
13867
13867
  }
13868
13868
  }
13869
13869
  return String(_val);
@@ -13961,13 +13961,13 @@ let KosConfigPropertyImpl = class {
13961
13961
  try {
13962
13962
  formatter2 = new Intl.NumberFormat(locale, { ...formatOptions });
13963
13963
  } catch (e) {
13964
- log$m.error(
13964
+ log$n.error(
13965
13965
  `error creating formatter ${formatOptions}. Returning the raw value`,
13966
13966
  e
13967
13967
  );
13968
13968
  }
13969
13969
  } else {
13970
- log$m.debug(
13970
+ log$n.debug(
13971
13971
  `no formatter found for config bean prop ${this.id}. Returning the raw value`
13972
13972
  );
13973
13973
  }
@@ -14036,7 +14036,7 @@ let KosConfigPropertyImpl = class {
14036
14036
  * ```
14037
14037
  */
14038
14038
  async updateProperty(value) {
14039
- log$m.debug(`updating property ${this.attribute} with value ${value}`);
14039
+ log$n.debug(`updating property ${this.attribute} with value ${value}`);
14040
14040
  let _value = value;
14041
14041
  const converter = this.getConverter();
14042
14042
  if (converter && !isNaN(_value)) {
@@ -14153,7 +14153,7 @@ const buildFuture = (factory) => (future) => pipe(
14153
14153
  mapDtoToFutureOptions,
14154
14154
  buildFutureModel$1(factory)(future.tracker || future.id)
14155
14155
  )(future);
14156
- const log$l = KosLog.createLogger({ name: "future-service", group: "Services" });
14156
+ const log$m = KosLog.createLogger({ name: "future-service", group: "Services" });
14157
14157
  const { isMock, URL: URL$c } = resolveServiceUrl();
14158
14158
  var FutureEndState = /* @__PURE__ */ ((FutureEndState2) => {
14159
14159
  FutureEndState2["Success"] = "SUCCESS";
@@ -14172,7 +14172,7 @@ const getFutures = async () => {
14172
14172
  return response;
14173
14173
  };
14174
14174
  const deleteFuture = async (id, path = "/api/kos/future") => {
14175
- log$l.info(`sending delete request for Future: ${id}`);
14175
+ log$m.info(`sending delete request for Future: ${id}`);
14176
14176
  const response = await deleteModel$1({
14177
14177
  id,
14178
14178
  urlOverride: `${URL$c}${path}/${id}`
@@ -14180,7 +14180,7 @@ const deleteFuture = async (id, path = "/api/kos/future") => {
14180
14180
  return response;
14181
14181
  };
14182
14182
  const addFuture = async (future, path = "/api/kos/future") => {
14183
- log$l.info(`sending add request for Future`);
14183
+ log$m.info(`sending add request for Future`);
14184
14184
  const response = await addModel({
14185
14185
  model: future,
14186
14186
  urlOverride: `${URL$c}${path}`
@@ -14188,7 +14188,7 @@ const addFuture = async (future, path = "/api/kos/future") => {
14188
14188
  return response;
14189
14189
  };
14190
14190
  const modifyFuture = async (id, model, path = "/api/kos/future") => {
14191
- log$l.info(`sending modify request for Future: ${id}`);
14191
+ log$m.info(`sending modify request for Future: ${id}`);
14192
14192
  const response = modifyModel({
14193
14193
  model,
14194
14194
  id,
@@ -14197,7 +14197,7 @@ const modifyFuture = async (id, model, path = "/api/kos/future") => {
14197
14197
  return response;
14198
14198
  };
14199
14199
  const cancelFuture = async (id, path = "/api/kos/future") => {
14200
- log$l.info(`sending cancel request for Future: ${id}`);
14200
+ log$m.info(`sending cancel request for Future: ${id}`);
14201
14201
  const response = postModel$4({
14202
14202
  urlOverride: `${URL$c}${path}/${id}/cancel`,
14203
14203
  ordered: true,
@@ -14380,12 +14380,12 @@ const { URL: URL$b } = resolveServiceUrl();
14380
14380
  const { getOne: getOne$4 } = ServiceFactory.build({
14381
14381
  basePath: `${URL$b}/api/kos/state`
14382
14382
  });
14383
- const log$k = KosLog.createLogger({
14383
+ const log$l = KosLog.createLogger({
14384
14384
  name: "state-bean-service",
14385
14385
  group: "Services"
14386
14386
  });
14387
14387
  const getStateBeanData = async ({ path }) => {
14388
- log$k.debug("sending GET for state-bean");
14388
+ log$l.debug("sending GET for state-bean");
14389
14389
  const response = await getOne$4({
14390
14390
  urlOverride: `${URL$b}/api/kos/state/${path}`
14391
14391
  });
@@ -14578,12 +14578,12 @@ const { URL: URL$a } = resolveServiceUrl();
14578
14578
  const { getAll: getAll$5 } = ServiceFactory.build({
14579
14579
  basePath: `${URL$a}/api/state-prop`
14580
14580
  });
14581
- const log$j = KosLog.createLogger({
14581
+ const log$k = KosLog.createLogger({
14582
14582
  name: "state-prop-service",
14583
14583
  group: "Services"
14584
14584
  });
14585
14585
  const getStateProps = async () => {
14586
- log$j.debug("sending GET for state-prop");
14586
+ log$k.debug("sending GET for state-prop");
14587
14587
  const response = await getAll$5({});
14588
14588
  return response;
14589
14589
  };
@@ -14743,7 +14743,7 @@ var __decorateClass$u = (decorators, target, key, kind) => {
14743
14743
  if (kind && result) __defProp$p(target, key, result);
14744
14744
  return result;
14745
14745
  };
14746
- const log$i = KosLog.getLogger(FutureFactory.type);
14746
+ const log$j = KosLog.getLogger(FutureFactory.type);
14747
14747
  let FutureModel$1 = class FutureModel {
14748
14748
  logger;
14749
14749
  _cancelFuture;
@@ -14767,7 +14767,7 @@ let FutureModel$1 = class FutureModel {
14767
14767
  kosWhen(
14768
14768
  () => this.status === FutureEndState.Success || this.status === FutureEndState.Fail,
14769
14769
  () => {
14770
- log$i.info(`Future ${this.id} has completed with status ${this.status}`);
14770
+ log$j.info(`Future ${this.id} has completed with status ${this.status}`);
14771
14771
  destroyKosModel(this);
14772
14772
  }
14773
14773
  );
@@ -14781,13 +14781,13 @@ let FutureModel$1 = class FutureModel {
14781
14781
  * In future additional information about the workspace could be loaded
14782
14782
  */
14783
14783
  async load() {
14784
- log$i.debug(`loading Future ${this.id}`);
14784
+ log$j.debug(`loading Future ${this.id}`);
14785
14785
  }
14786
14786
  /**
14787
14787
  * @internal
14788
14788
  */
14789
14789
  unload() {
14790
- log$i.info(`unloading Future ${this.id}`);
14790
+ log$j.info(`unloading Future ${this.id}`);
14791
14791
  }
14792
14792
  // -------------------ACTIONS----------------------------
14793
14793
  /**
@@ -14806,7 +14806,7 @@ let FutureModel$1 = class FutureModel {
14806
14806
  await kosWhen(() => this.futureId !== FUTURE_NOT_ASSIGNED);
14807
14807
  const response = await this._cancelFuture(this.futureId, path);
14808
14808
  if (response?.status !== 200) {
14809
- log$i.error(
14809
+ log$j.error(
14810
14810
  `Failed to cancel Future ${this.id}. Response: ${JSON.stringify(
14811
14811
  response
14812
14812
  )}`
@@ -14895,7 +14895,7 @@ var __decorateClass$t = (decorators, target, key, kind) => {
14895
14895
  if (kind && result) __defProp$o(target, key, result);
14896
14896
  return result;
14897
14897
  };
14898
- const log$h = KosLog.getLogger(FutureContainerFactory.type);
14898
+ const log$i = KosLog.getLogger(FutureContainerFactory.type);
14899
14899
  let FutureContainerModel$1 = class FutureContainerModel {
14900
14900
  id;
14901
14901
  logger;
@@ -15010,8 +15010,8 @@ let FutureContainerModel$1 = class FutureContainerModel {
15010
15010
  try {
15011
15011
  await this._deleteFuture(id);
15012
15012
  } catch (e) {
15013
- log$h.error(`error deleting a Future`);
15014
- log$h.error(e);
15013
+ log$i.error(`error deleting a Future`);
15014
+ log$i.error(e);
15015
15015
  }
15016
15016
  }
15017
15017
  /**
@@ -15038,8 +15038,8 @@ let FutureContainerModel$1 = class FutureContainerModel {
15038
15038
  return model2;
15039
15039
  }
15040
15040
  } catch (e) {
15041
- log$h.error(`error creating a Future`);
15042
- log$h.error(e);
15041
+ log$i.error(`error creating a Future`);
15042
+ log$i.error(e);
15043
15043
  throw e;
15044
15044
  }
15045
15045
  return void 0;
@@ -15068,7 +15068,7 @@ const { URL: URL$9 } = resolveServiceUrl();
15068
15068
  const { getOne: getOne$3, postModel: postModel$3, deleteModel } = ServiceFactory.build({
15069
15069
  basePath: `${URL$9}/api/keyVal`
15070
15070
  });
15071
- const log$g = KosLog.createLogger({
15071
+ const log$h = KosLog.createLogger({
15072
15072
  name: "key-value-service",
15073
15073
  group: "Services"
15074
15074
  });
@@ -15084,7 +15084,7 @@ const updateKeyValue = async (namespace, key, value) => {
15084
15084
  model: value.toString()
15085
15085
  });
15086
15086
  if (response?.status !== 200) {
15087
- log$g.error("Failed to update key-value data", response);
15087
+ log$h.error("Failed to update key-value data", response);
15088
15088
  throw new Error(
15089
15089
  `Failed to update key-value data for namespace ${namespace}`
15090
15090
  );
@@ -15092,12 +15092,12 @@ const updateKeyValue = async (namespace, key, value) => {
15092
15092
  return response.data;
15093
15093
  };
15094
15094
  const getKeyValue = async (namespace = "studio") => {
15095
- log$g.debug(`Retrieving all key-value data for namespace: ${namespace}`);
15095
+ log$h.debug(`Retrieving all key-value data for namespace: ${namespace}`);
15096
15096
  const response = await getOne$3({
15097
15097
  urlOverride: `${URL$9}/api/keyVal/${namespace}`
15098
15098
  });
15099
15099
  if (response?.status !== 200) {
15100
- log$g.error("Failed to retrieve key-value data", response);
15100
+ log$h.error("Failed to retrieve key-value data", response);
15101
15101
  throw new Error(
15102
15102
  `Failed to retrieve key-value data for namespace ${namespace}`
15103
15103
  );
@@ -17168,13 +17168,13 @@ KosExpressionEvaluatorModelImpl = __decorateClass$r([
17168
17168
  kosModel({ modelTypeId: MODEL_TYPE$q, singleton: false })
17169
17169
  ], KosExpressionEvaluatorModelImpl);
17170
17170
  const KosExpressionEvaluator = KosExpressionEvaluatorModelImpl.Registration;
17171
- const log$f = KosLog.createLogger({
17171
+ const log$g = KosLog.createLogger({
17172
17172
  name: "kos-log-manager-service",
17173
17173
  group: "Services"
17174
17174
  });
17175
17175
  const SERVICE_PATH$2 = "/api/kos/logs/overrides";
17176
17176
  const getLogOverrides = async () => {
17177
- log$f.debug("sending GET for kos-log-manager");
17177
+ log$g.debug("sending GET for kos-log-manager");
17178
17178
  return await api$9.get(SERVICE_PATH$2);
17179
17179
  };
17180
17180
  const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -17583,7 +17583,7 @@ __decorateClass$o([
17583
17583
  LogBlockContainerModelImpl = __decorateClass$o([
17584
17584
  kosModel(MODEL_TYPE$n)
17585
17585
  ], LogBlockContainerModelImpl);
17586
- const log$e = KosLog.createLogger({
17586
+ const log$f = KosLog.createLogger({
17587
17587
  name: "log-stream-container-service",
17588
17588
  group: "Services"
17589
17589
  });
@@ -17597,7 +17597,7 @@ const getKosConnectionId$2 = () => {
17597
17597
  const destinationAddress$3 = getKosConnectionId$2();
17598
17598
  const SERVICE_PATH$1 = "/api/kos/logs/node/{nodeId}/streams";
17599
17599
  const getLogStreams = async () => {
17600
- log$e.debug("sending GET for log-stream-container");
17600
+ log$f.debug("sending GET for log-stream-container");
17601
17601
  return await api$9.get(
17602
17602
  SERVICE_PATH$1,
17603
17603
  {
@@ -18198,23 +18198,23 @@ const { URL: URL$7 } = resolveServiceUrl();
18198
18198
  const { getAll: getAll$4, postModel: postModel$1 } = ServiceFactory.build({
18199
18199
  basePath: `${URL$7}/api/kos/troubles`
18200
18200
  });
18201
- const log$d = KosLog.createLogger({ name: "trouble-services" });
18201
+ const log$e = KosLog.createLogger({ name: "trouble-services" });
18202
18202
  const getKosConnectionId$1 = () => {
18203
18203
  const params2 = getQueryParams();
18204
18204
  const connId = params2?.connId;
18205
- log$d.debug(`connId from query params: ${connId}`);
18206
- log$d.debug(
18205
+ log$e.debug(`connId from query params: ${connId}`);
18206
+ log$e.debug(
18207
18207
  `window.kosBridge: ${window?.kosBridge ? "available" : "not available"} - ${window?.kosBridge?.("connId")}`
18208
18208
  );
18209
18209
  const result = connId || window?.kosBridge?.("connId");
18210
- log$d.info(`getKosConnectionId: ${result}`);
18210
+ log$e.info(`getKosConnectionId: ${result}`);
18211
18211
  return result;
18212
18212
  };
18213
18213
  const destinationAddress$2 = getKosConnectionId$1();
18214
- log$d.info(`Destination address for trouble services: ${destinationAddress$2}`);
18214
+ log$e.info(`Destination address for trouble services: ${destinationAddress$2}`);
18215
18215
  const getTroubles = async (servicePath) => {
18216
18216
  const isKosTroubles = servicePath.includes("/kos/troubles");
18217
- log$d.info(
18217
+ log$e.info(
18218
18218
  `Fetching troubles from ${servicePath} with destination address: ${isKosTroubles ? destinationAddress$2 : "N/A (not a kos troubles path)"}`
18219
18219
  );
18220
18220
  const response = await getAll$4({
@@ -18728,16 +18728,16 @@ const { URL: URL$6 } = resolveServiceUrl();
18728
18728
  const { getAll: getAll$3 } = ServiceFactory.build({
18729
18729
  basePath: `${URL$6}/api/kos/ota`
18730
18730
  });
18731
- const log$c = KosLog.createLogger({
18731
+ const log$d = KosLog.createLogger({
18732
18732
  name: "ota-service",
18733
18733
  group: "Services"
18734
18734
  });
18735
18735
  const getArtifacts = async () => {
18736
- log$c.debug("sending GET request to /api/kos/ota/artifacts");
18736
+ log$d.debug("sending GET request to /api/kos/ota/artifacts");
18737
18737
  const response = await getAll$3({
18738
18738
  urlOverride: `${URL$6}/api/kos/ota/artifacts`
18739
18739
  });
18740
- log$c.debug("getArtifacts - response:", response);
18740
+ log$d.debug("getArtifacts - response:", response);
18741
18741
  return response?.data;
18742
18742
  };
18743
18743
  var __defProp$e = Object.defineProperty;
@@ -18921,6 +18921,410 @@ const Ota = new SingletonKosModelRegistrationFactory({
18921
18921
  class: OtaModelImpl,
18922
18922
  type: MODEL_TYPE$h
18923
18923
  });
18924
+ const log$c = KosLog.createLogger({ name: "await-future-call", group: "Models" });
18925
+ class FutureCallError extends Error {
18926
+ endState;
18927
+ reason;
18928
+ futureId;
18929
+ constructor(endState, reason, futureId) {
18930
+ super(reason ?? `Future ended with ${endState}`);
18931
+ this.name = "FutureCallError";
18932
+ this.endState = endState;
18933
+ this.reason = reason;
18934
+ this.futureId = futureId;
18935
+ }
18936
+ get isCancelled() {
18937
+ return this.endState === FutureEndState.Canceled || this.endState === FutureEndState.Aborted;
18938
+ }
18939
+ }
18940
+ function awaitFutureCall(model, methodCall, options = {}) {
18941
+ const { alias, timeoutMs } = options;
18942
+ const initial = model.futureHandler.getFuture(alias);
18943
+ let tracked;
18944
+ let settled = false;
18945
+ let acked = false;
18946
+ let ackResponse;
18947
+ let cancelRequested = false;
18948
+ const disposers = [];
18949
+ const progressCallbacks = /* @__PURE__ */ new Set();
18950
+ const dispose = () => {
18951
+ disposers.forEach((d) => d());
18952
+ disposers.length = 0;
18953
+ progressCallbacks.clear();
18954
+ };
18955
+ const promise = new Promise((resolve, reject) => {
18956
+ const settle = (fn) => {
18957
+ if (settled) return;
18958
+ settled = true;
18959
+ dispose();
18960
+ fn();
18961
+ };
18962
+ const finishFromEndState = (endState) => {
18963
+ if (!endState) return;
18964
+ if (endState === FutureEndState.Success) {
18965
+ settle(() => resolve(ackResponse));
18966
+ } else {
18967
+ settle(
18968
+ () => reject(new FutureCallError(endState, tracked?.reason, tracked?.id))
18969
+ );
18970
+ }
18971
+ };
18972
+ const watchTracked = (future) => {
18973
+ tracked = future;
18974
+ if (cancelRequested) {
18975
+ future.cancelFuture().catch((e) => log$c.error(e));
18976
+ }
18977
+ disposers.push(
18978
+ mobx.reaction(
18979
+ () => future.endState,
18980
+ (endState) => finishFromEndState(endState),
18981
+ { fireImmediately: true }
18982
+ )
18983
+ );
18984
+ disposers.push(
18985
+ mobx.reaction(
18986
+ () => [future.progress, future.status],
18987
+ ([progress, status]) => {
18988
+ progressCallbacks.forEach((cb) => {
18989
+ try {
18990
+ cb(progress, status);
18991
+ } catch (e) {
18992
+ log$c.warn("progress callback error", e);
18993
+ }
18994
+ });
18995
+ },
18996
+ { fireImmediately: true }
18997
+ )
18998
+ );
18999
+ };
19000
+ disposers.push(
19001
+ mobx.reaction(
19002
+ () => model.futureHandler.getFuture(alias),
19003
+ (future) => {
19004
+ if (!tracked && future && future !== initial) {
19005
+ watchTracked(future);
19006
+ return;
19007
+ }
19008
+ if (tracked && !future && !tracked.endState && acked) {
19009
+ settle(() => resolve(ackResponse));
19010
+ }
19011
+ },
19012
+ { fireImmediately: true }
19013
+ )
19014
+ );
19015
+ if (timeoutMs !== void 0) {
19016
+ const timer = setTimeout(() => {
19017
+ settle(
19018
+ () => reject(
19019
+ new Error(`Future for call did not complete within ${timeoutMs}ms`)
19020
+ )
19021
+ );
19022
+ }, timeoutMs);
19023
+ disposers.push(() => clearTimeout(timer));
19024
+ }
19025
+ methodCall(model).then((response) => {
19026
+ acked = true;
19027
+ ackResponse = response;
19028
+ if (!tracked) {
19029
+ settle(() => resolve(response));
19030
+ return;
19031
+ }
19032
+ finishFromEndState(tracked.endState);
19033
+ }).catch((error) => {
19034
+ settle(() => reject(error));
19035
+ });
19036
+ });
19037
+ promise.cancel = async () => {
19038
+ cancelRequested = true;
19039
+ if (tracked && !tracked.endState) {
19040
+ await tracked.cancelFuture();
19041
+ }
19042
+ };
19043
+ promise.getController = () => void 0;
19044
+ promise.isCancelled = () => cancelRequested || tracked?.endState === FutureEndState.Canceled || tracked?.endState === FutureEndState.Aborted;
19045
+ Object.defineProperty(promise, "progress", {
19046
+ get: () => tracked?.progress ?? 0,
19047
+ enumerable: true
19048
+ });
19049
+ Object.defineProperty(promise, "status", {
19050
+ get: () => tracked?.status ?? "PENDING",
19051
+ enumerable: true
19052
+ });
19053
+ Object.defineProperty(promise, "isRunning", {
19054
+ get: () => !settled && (!tracked || !tracked.endState),
19055
+ enumerable: true
19056
+ });
19057
+ Object.defineProperty(promise, "timeRemaining", {
19058
+ get: () => tracked?.timeRemaining ?? "",
19059
+ enumerable: true
19060
+ });
19061
+ promise.onProgressUpdate = (callback) => {
19062
+ progressCallbacks.add(callback);
19063
+ callback(promise.progress, promise.status);
19064
+ return () => progressCallbacks.delete(callback);
19065
+ };
19066
+ return promise;
19067
+ }
19068
+ function createCancellablePromise(promiseOrOptions, abortController, cancelFuture2, future) {
19069
+ const options = promiseOrOptions instanceof Promise ? { promise: promiseOrOptions, abortController, cancelFuture: cancelFuture2, future } : promiseOrOptions;
19070
+ const {
19071
+ promise,
19072
+ abortController: controller,
19073
+ cancelFuture: cancelFn,
19074
+ future: futureRef
19075
+ } = options;
19076
+ const cancellablePromise = promise;
19077
+ let currentProgress = 0;
19078
+ let currentStatus = "PENDING";
19079
+ let isRunning = true;
19080
+ const progressCallbacks = /* @__PURE__ */ new Set();
19081
+ let effectDisposer;
19082
+ if (futureRef && typeof futureRef === "object") {
19083
+ effectDisposer = mobx.autorun(() => {
19084
+ const newProgress = futureRef.progress || 0;
19085
+ const newStatus = futureRef.status || "PENDING";
19086
+ const newIsRunning = !futureRef.endState;
19087
+ if (newProgress !== currentProgress || newStatus !== currentStatus || newIsRunning !== isRunning) {
19088
+ currentProgress = newProgress;
19089
+ currentStatus = newStatus;
19090
+ isRunning = newIsRunning;
19091
+ progressCallbacks.forEach((callback) => {
19092
+ try {
19093
+ callback(currentProgress, currentStatus);
19094
+ } catch (error) {
19095
+ console.warn("Progress callback error:", error);
19096
+ }
19097
+ });
19098
+ }
19099
+ });
19100
+ }
19101
+ promise.finally(() => {
19102
+ isRunning = false;
19103
+ if (!controller?.signal.aborted) {
19104
+ currentStatus = "COMPLETED";
19105
+ progressCallbacks.forEach((callback) => {
19106
+ try {
19107
+ callback(currentProgress, currentStatus);
19108
+ } catch (error) {
19109
+ console.warn("Progress callback error:", error);
19110
+ }
19111
+ });
19112
+ }
19113
+ if (effectDisposer) {
19114
+ effectDisposer();
19115
+ }
19116
+ progressCallbacks.clear();
19117
+ });
19118
+ cancellablePromise.cancel = async () => {
19119
+ if (controller && !controller.signal.aborted) {
19120
+ controller.abort();
19121
+ }
19122
+ if (cancelFn) {
19123
+ await cancelFn();
19124
+ }
19125
+ isRunning = false;
19126
+ currentStatus = "CANCELLED";
19127
+ progressCallbacks.forEach((callback) => {
19128
+ try {
19129
+ callback(currentProgress, currentStatus);
19130
+ } catch (error) {
19131
+ console.warn("Progress callback error:", error);
19132
+ }
19133
+ });
19134
+ if (effectDisposer) {
19135
+ effectDisposer();
19136
+ }
19137
+ };
19138
+ cancellablePromise.getController = () => controller;
19139
+ cancellablePromise.isCancelled = () => controller?.signal.aborted ?? false;
19140
+ Object.defineProperty(cancellablePromise, "progress", {
19141
+ get: () => currentProgress,
19142
+ enumerable: true
19143
+ });
19144
+ Object.defineProperty(cancellablePromise, "status", {
19145
+ get: () => currentStatus,
19146
+ enumerable: true
19147
+ });
19148
+ Object.defineProperty(cancellablePromise, "isRunning", {
19149
+ get: () => isRunning,
19150
+ enumerable: true
19151
+ });
19152
+ cancellablePromise.onProgressUpdate = (callback) => {
19153
+ progressCallbacks.add(callback);
19154
+ callback(currentProgress, currentStatus);
19155
+ return () => progressCallbacks.delete(callback);
19156
+ };
19157
+ return cancellablePromise;
19158
+ }
19159
+ function makeCancellable(model, methodCall) {
19160
+ const initialFuture = model.futureHandler.future;
19161
+ const promise = methodCall(model);
19162
+ let newFuture = null;
19163
+ setTimeout(() => {
19164
+ newFuture = model.futureHandler.future;
19165
+ if (newFuture === initialFuture) {
19166
+ newFuture = null;
19167
+ }
19168
+ }, 0);
19169
+ return createCancellablePromise({
19170
+ promise,
19171
+ abortController: void 0,
19172
+ // No direct AbortController access
19173
+ cancelFuture: async () => {
19174
+ if (newFuture) {
19175
+ await newFuture.cancelFuture();
19176
+ } else {
19177
+ const currentFuture = model.futureHandler.future;
19178
+ if (currentFuture) {
19179
+ await currentFuture.cancelFuture();
19180
+ }
19181
+ }
19182
+ },
19183
+ future: newFuture
19184
+ // Pass the future for progress tracking
19185
+ });
19186
+ }
19187
+ function withCancellation(model, methodName, ...args) {
19188
+ const method = model[methodName];
19189
+ if (typeof method !== "function") {
19190
+ throw new Error(`${String(methodName)} is not a method`);
19191
+ }
19192
+ const initialFuture = model.futureHandler.future;
19193
+ const promise = method.apply(model, args);
19194
+ let targetFuture = null;
19195
+ setTimeout(() => {
19196
+ const currentFuture = model.futureHandler.future;
19197
+ if (currentFuture && currentFuture !== initialFuture) {
19198
+ targetFuture = currentFuture;
19199
+ }
19200
+ }, 0);
19201
+ return createCancellablePromise({
19202
+ promise,
19203
+ abortController: void 0,
19204
+ cancelFuture: async () => {
19205
+ if (targetFuture) {
19206
+ await targetFuture.cancelFuture();
19207
+ } else {
19208
+ const fallbackFuture = model.futureHandler.future;
19209
+ if (fallbackFuture) {
19210
+ await fallbackFuture.cancelFuture();
19211
+ }
19212
+ }
19213
+ },
19214
+ future: targetFuture
19215
+ // Pass the future for progress tracking
19216
+ });
19217
+ }
19218
+ class CancellationBatch {
19219
+ operations = [];
19220
+ add(model, methodCall) {
19221
+ const cancellable = makeCancellable(model, methodCall);
19222
+ this.operations.push(cancellable);
19223
+ return cancellable;
19224
+ }
19225
+ async cancelAll() {
19226
+ await Promise.all(
19227
+ this.operations.map(
19228
+ (op) => op.cancel().catch(() => {
19229
+ KosLog.warn("Cancellation failed for operation:", op);
19230
+ })
19231
+ )
19232
+ );
19233
+ }
19234
+ getAllControllers() {
19235
+ return this.operations.map((op) => op.getController());
19236
+ }
19237
+ getActiveCount() {
19238
+ return this.operations.filter((op) => !op.isCancelled()).length;
19239
+ }
19240
+ clear() {
19241
+ this.operations = [];
19242
+ }
19243
+ }
19244
+ function createCancellationBatch() {
19245
+ return new CancellationBatch();
19246
+ }
19247
+ function createCancellableService(serviceFunction) {
19248
+ let controller;
19249
+ const wrappedFunction = async (...args) => {
19250
+ if (controller) {
19251
+ controller.abort();
19252
+ }
19253
+ controller = new AbortController();
19254
+ const currentController = controller;
19255
+ try {
19256
+ return await serviceFunction(...args, currentController.signal);
19257
+ } finally {
19258
+ if (controller === currentController) {
19259
+ controller = void 0;
19260
+ }
19261
+ }
19262
+ };
19263
+ wrappedFunction.cancel = () => {
19264
+ if (controller) {
19265
+ controller.abort();
19266
+ controller = void 0;
19267
+ }
19268
+ };
19269
+ wrappedFunction.getController = () => controller;
19270
+ wrappedFunction.isActive = () => !!controller;
19271
+ return wrappedFunction;
19272
+ }
19273
+ class CancellableServiceManager {
19274
+ controllers = /* @__PURE__ */ new Map();
19275
+ /**
19276
+ * Create a cancellable method
19277
+ */
19278
+ createMethod(name, serviceFunction) {
19279
+ const wrappedFunction = async (...args) => {
19280
+ this.cancelMethod(name);
19281
+ const controller = new AbortController();
19282
+ this.controllers.set(name, controller);
19283
+ try {
19284
+ return await serviceFunction(...args, controller.signal);
19285
+ } finally {
19286
+ if (this.controllers.get(name) === controller) {
19287
+ this.controllers.delete(name);
19288
+ }
19289
+ }
19290
+ };
19291
+ wrappedFunction.cancel = () => this.cancelMethod(name);
19292
+ wrappedFunction.getController = () => this.controllers.get(name);
19293
+ wrappedFunction.isActive = () => this.controllers.has(name);
19294
+ return wrappedFunction;
19295
+ }
19296
+ /**
19297
+ * Cancel a specific method's request
19298
+ */
19299
+ cancelMethod(name) {
19300
+ const controller = this.controllers.get(name);
19301
+ if (controller) {
19302
+ controller.abort();
19303
+ this.controllers.delete(name);
19304
+ }
19305
+ }
19306
+ /**
19307
+ * Cancel all active requests
19308
+ */
19309
+ cancelAll() {
19310
+ for (const controller of this.controllers.values()) {
19311
+ controller.abort();
19312
+ }
19313
+ this.controllers.clear();
19314
+ }
19315
+ /**
19316
+ * Get all active method names
19317
+ */
19318
+ getActiveMethods() {
19319
+ return Array.from(this.controllers.keys());
19320
+ }
19321
+ /**
19322
+ * Check if any requests are active
19323
+ */
19324
+ hasActiveRequests() {
19325
+ return this.controllers.size > 0;
19326
+ }
19327
+ }
18924
19328
  const api$8 = createClient();
18925
19329
  const params = getQueryParams();
18926
19330
  const DEBUG = params.debug === "true" || params.debug === true;
@@ -23262,32 +23666,6 @@ const updateTimeZone = async (timezone) => {
23262
23666
  await whenReady(timezoneInfo);
23263
23667
  timezoneInfo.updateProperty(timezone);
23264
23668
  };
23265
- function createCancellableService(serviceFunction) {
23266
- let controller;
23267
- const wrappedFunction = async (...args) => {
23268
- if (controller) {
23269
- controller.abort();
23270
- }
23271
- controller = new AbortController();
23272
- const currentController = controller;
23273
- try {
23274
- return await serviceFunction(...args, currentController.signal);
23275
- } finally {
23276
- if (controller === currentController) {
23277
- controller = void 0;
23278
- }
23279
- }
23280
- };
23281
- wrappedFunction.cancel = () => {
23282
- if (controller) {
23283
- controller.abort();
23284
- controller = void 0;
23285
- }
23286
- };
23287
- wrappedFunction.getController = () => controller;
23288
- wrappedFunction.isActive = () => !!controller;
23289
- return wrappedFunction;
23290
- }
23291
23669
  const log$5 = KosLog.createLogger({
23292
23670
  name: "software-info-service",
23293
23671
  group: "Services"
@@ -23495,97 +23873,6 @@ const acceptOrgInvitation = async (token2, password, name, url = `${exports.BASE
23495
23873
  const configResponse = await response.json();
23496
23874
  return configResponse;
23497
23875
  };
23498
- function createCancellablePromise(promiseOrOptions, abortController, cancelFuture2, future) {
23499
- const options = promiseOrOptions instanceof Promise ? { promise: promiseOrOptions, abortController, cancelFuture: cancelFuture2, future } : promiseOrOptions;
23500
- const {
23501
- promise,
23502
- abortController: controller,
23503
- cancelFuture: cancelFn,
23504
- future: futureRef
23505
- } = options;
23506
- const cancellablePromise = promise;
23507
- let currentProgress = 0;
23508
- let currentStatus = "PENDING";
23509
- let isRunning = true;
23510
- const progressCallbacks = /* @__PURE__ */ new Set();
23511
- let effectDisposer;
23512
- if (futureRef && typeof futureRef === "object") {
23513
- effectDisposer = mobx.autorun(() => {
23514
- const newProgress = futureRef.progress || 0;
23515
- const newStatus = futureRef.status || "PENDING";
23516
- const newIsRunning = !futureRef.endState;
23517
- if (newProgress !== currentProgress || newStatus !== currentStatus || newIsRunning !== isRunning) {
23518
- currentProgress = newProgress;
23519
- currentStatus = newStatus;
23520
- isRunning = newIsRunning;
23521
- progressCallbacks.forEach((callback) => {
23522
- try {
23523
- callback(currentProgress, currentStatus);
23524
- } catch (error) {
23525
- console.warn("Progress callback error:", error);
23526
- }
23527
- });
23528
- }
23529
- });
23530
- }
23531
- promise.finally(() => {
23532
- isRunning = false;
23533
- if (!controller?.signal.aborted) {
23534
- currentStatus = "COMPLETED";
23535
- progressCallbacks.forEach((callback) => {
23536
- try {
23537
- callback(currentProgress, currentStatus);
23538
- } catch (error) {
23539
- console.warn("Progress callback error:", error);
23540
- }
23541
- });
23542
- }
23543
- if (effectDisposer) {
23544
- effectDisposer();
23545
- }
23546
- progressCallbacks.clear();
23547
- });
23548
- cancellablePromise.cancel = async () => {
23549
- if (controller && !controller.signal.aborted) {
23550
- controller.abort();
23551
- }
23552
- if (cancelFn) {
23553
- await cancelFn();
23554
- }
23555
- isRunning = false;
23556
- currentStatus = "CANCELLED";
23557
- progressCallbacks.forEach((callback) => {
23558
- try {
23559
- callback(currentProgress, currentStatus);
23560
- } catch (error) {
23561
- console.warn("Progress callback error:", error);
23562
- }
23563
- });
23564
- if (effectDisposer) {
23565
- effectDisposer();
23566
- }
23567
- };
23568
- cancellablePromise.getController = () => controller;
23569
- cancellablePromise.isCancelled = () => controller?.signal.aborted ?? false;
23570
- Object.defineProperty(cancellablePromise, "progress", {
23571
- get: () => currentProgress,
23572
- enumerable: true
23573
- });
23574
- Object.defineProperty(cancellablePromise, "status", {
23575
- get: () => currentStatus,
23576
- enumerable: true
23577
- });
23578
- Object.defineProperty(cancellablePromise, "isRunning", {
23579
- get: () => isRunning,
23580
- enumerable: true
23581
- });
23582
- cancellablePromise.onProgressUpdate = (callback) => {
23583
- progressCallbacks.add(callback);
23584
- callback(currentProgress, currentStatus);
23585
- return () => progressCallbacks.delete(callback);
23586
- };
23587
- return cancellablePromise;
23588
- }
23589
23876
  var __defProp$3 = Object.defineProperty;
23590
23877
  var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
23591
23878
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -26622,6 +26909,8 @@ exports.AncestorPathVisitor = AncestorPathVisitor;
26622
26909
  exports.AuthState = AuthState;
26623
26910
  exports.BrowserKosRouter = BrowserKosRouter;
26624
26911
  exports.BrowserRouter = BrowserRouter;
26912
+ exports.CancellableServiceManager = CancellableServiceManager;
26913
+ exports.CancellationBatch = CancellationBatch;
26625
26914
  exports.CanvasDispatcher = CanvasDispatcher;
26626
26915
  exports.CanvasDispatcherServices = index$7;
26627
26916
  exports.CanvasRenderer = CanvasRenderer;
@@ -26663,6 +26952,7 @@ exports.FUTURE_NOT_ASSIGNED = FUTURE_NOT_ASSIGNED;
26663
26952
  exports.FeatureFlagService = FeatureFlagService;
26664
26953
  exports.FetchError = FetchError;
26665
26954
  exports.FutureAliases = FutureAliases;
26955
+ exports.FutureCallError = FutureCallError;
26666
26956
  exports.FutureContainerFactory = FutureContainerFactory;
26667
26957
  exports.FutureContainerModel = FutureContainerModel2;
26668
26958
  exports.FutureContainerSetup = FutureContainerSetup;
@@ -26861,6 +27151,7 @@ exports.api = api$8;
26861
27151
  exports.applyFunctionalEnhancements = applyFunctionalEnhancements;
26862
27152
  exports.applyMixins = applyMixins;
26863
27153
  exports.arraysEqual = arraysEqual;
27154
+ exports.awaitFutureCall = awaitFutureCall;
26864
27155
  exports.buildConfigBeanModel = buildConfigBeanModel;
26865
27156
  exports.buildFuture = buildFuture;
26866
27157
  exports.buildFutureModel = buildFutureModel$1;
@@ -26876,6 +27167,8 @@ exports.convertWithUnits = convertWithUnits;
26876
27167
  exports.createBaseMessage = createBaseMessage;
26877
27168
  exports.createBroadcastMessageResponse = createBroadcastMessageResponse;
26878
27169
  exports.createCancellablePromise = createCancellablePromise;
27170
+ exports.createCancellableService = createCancellableService;
27171
+ exports.createCancellationBatch = createCancellationBatch;
26879
27172
  exports.createClient = createClient;
26880
27173
  exports.createFosBaseMessage = createFosBaseMessage;
26881
27174
  exports.createHeaders = createHeaders;
@@ -27008,6 +27301,7 @@ exports.kosTroubleAware = kosTroubleAware;
27008
27301
  exports.kosViewModel = kosViewModel;
27009
27302
  exports.kosWhen = kosWhen;
27010
27303
  exports.login = login;
27304
+ exports.makeCancellable = makeCancellable;
27011
27305
  exports.mapConfigBeanModelToDto = mapConfigBeanModelToDto;
27012
27306
  exports.mapDataToModel = mapDataToModel;
27013
27307
  exports.mapDtoToConfigBeanModel = mapDtoToConfigBeanModel;
@@ -27135,6 +27429,7 @@ exports.waitForAppToStart = waitForAppToStart;
27135
27429
  exports.waitForAppsToStart = waitForAppsToStart;
27136
27430
  exports.waitForRequest = waitForRequest;
27137
27431
  exports.whenReady = whenReady;
27432
+ exports.withCancellation = withCancellation;
27138
27433
  exports.withDevice = withDevice;
27139
27434
  exports.withKosTime = withKosTime;
27140
27435
  exports.withNetworkInterfaceContainer = withNetworkInterfaceContainer;