@kosdev-code/kos-ui-sdk 0.1.0-next.852 → 0.1.0-next.854
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/core/util/kos-config-init.d.ts.map +1 -1
- package/index.cjs +350 -321
- package/index.cjs.map +1 -1
- package/index.js +350 -321
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/ui/components/error-boundary/error-boundary.d.ts +9 -0
- package/ui/components/error-boundary/error-boundary.d.ts.map +1 -1
- package/ui/hooks/translation-container/use-translation.d.ts.map +1 -1
package/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const log$
|
|
3
|
+
const log$S = require("loglevel");
|
|
4
4
|
const mobx = require("mobx");
|
|
5
5
|
const robot3 = require("robot3");
|
|
6
6
|
const dateFns = require("date-fns");
|
|
@@ -50,7 +50,7 @@ var KosWsEvents = /* @__PURE__ */ ((KosWsEvents2) => {
|
|
|
50
50
|
return KosWsEvents2;
|
|
51
51
|
})(KosWsEvents || {});
|
|
52
52
|
const EVENT_KOS_MODEL_READY = "/kos/model/ready/";
|
|
53
|
-
log$
|
|
53
|
+
log$S.info("Initializing event bus");
|
|
54
54
|
globalThis.kos = globalThis.kos || {};
|
|
55
55
|
globalThis.kos.subscriptions = globalThis.kos.subscriptions || {};
|
|
56
56
|
const subscriptions = globalThis.kos.subscriptions;
|
|
@@ -61,15 +61,15 @@ function hasEventSubscriptions(eventType) {
|
|
|
61
61
|
function subscribe(eventType, callback) {
|
|
62
62
|
const id = getNextUniqueId();
|
|
63
63
|
if (!subscriptions[eventType]) {
|
|
64
|
-
log$
|
|
64
|
+
log$S.debug(`Initializing subscription for ${eventType}`);
|
|
65
65
|
subscriptions[eventType] = {};
|
|
66
66
|
}
|
|
67
|
-
log$
|
|
67
|
+
log$S.debug(`Subscribing to ${eventType} with id ${id.toString()}`);
|
|
68
68
|
subscriptions[eventType][id] = callback;
|
|
69
69
|
return {
|
|
70
70
|
count: subscriptions[eventType] ? Object.getOwnPropertySymbols(subscriptions[eventType]).length : 0,
|
|
71
71
|
unsubscribe: () => {
|
|
72
|
-
log$
|
|
72
|
+
log$S.debug(`Unsubscribing from ${eventType} with id ${id.toString()}`);
|
|
73
73
|
if (subscriptions[eventType] && subscriptions[eventType][id]) {
|
|
74
74
|
delete subscriptions[eventType][id];
|
|
75
75
|
}
|
|
@@ -84,7 +84,7 @@ function subscribe(eventType, callback) {
|
|
|
84
84
|
}
|
|
85
85
|
function publish(eventType, msg, headers = {}) {
|
|
86
86
|
if (!subscriptions[eventType] || Object.getOwnPropertySymbols(subscriptions[eventType]).length === 0) {
|
|
87
|
-
log$
|
|
87
|
+
log$S.debug(`No subscriptions for ${eventType}. Not publishing.`);
|
|
88
88
|
return {
|
|
89
89
|
eventType,
|
|
90
90
|
subscribers: 0
|
|
@@ -94,19 +94,19 @@ function publish(eventType, msg, headers = {}) {
|
|
|
94
94
|
Object.getOwnPropertySymbols(subscriptions[eventType]).forEach((id) => {
|
|
95
95
|
if (headers["sync"]) {
|
|
96
96
|
const responseId = headers["sync"];
|
|
97
|
-
log$
|
|
97
|
+
log$S.debug(
|
|
98
98
|
`Performing sync publish for ${eventType} with sync id ${responseId}`
|
|
99
99
|
);
|
|
100
100
|
subscriptions[eventType][id]({ body: msg, headers }).then(
|
|
101
101
|
(response) => {
|
|
102
|
-
log$
|
|
102
|
+
log$S.debug(
|
|
103
103
|
`Response recieved for ${responseId}, publishing back to source.`
|
|
104
104
|
);
|
|
105
105
|
publish(responseId, response);
|
|
106
106
|
}
|
|
107
107
|
);
|
|
108
108
|
} else {
|
|
109
|
-
log$
|
|
109
|
+
log$S.debug(`Performing async publish for ${eventType}`);
|
|
110
110
|
subscriptions[eventType][id]({ body: msg, headers });
|
|
111
111
|
}
|
|
112
112
|
});
|
|
@@ -116,7 +116,7 @@ function publish(eventType, msg, headers = {}) {
|
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
function reset() {
|
|
119
|
-
log$
|
|
119
|
+
log$S.warn("Resetting event bus");
|
|
120
120
|
Object.keys(subscriptions).forEach((key) => delete subscriptions[key]);
|
|
121
121
|
}
|
|
122
122
|
function once$1(eventType, callback) {
|
|
@@ -766,6 +766,17 @@ const defaultConfig = {
|
|
|
766
766
|
};
|
|
767
767
|
const config = globalThis.getKosConfig?.() || JSON.stringify(defaultConfig);
|
|
768
768
|
const configObj = JSON.parse(config);
|
|
769
|
+
const urlProfiles = () => {
|
|
770
|
+
if (typeof window === "undefined") {
|
|
771
|
+
return [];
|
|
772
|
+
}
|
|
773
|
+
const value = getQueryParams()?.["kosProfiles"];
|
|
774
|
+
return value ? value.split(",").map((profile) => profile.trim()).filter(Boolean) : [];
|
|
775
|
+
};
|
|
776
|
+
configObj.profiles = [
|
|
777
|
+
...configObj.profiles ?? [],
|
|
778
|
+
...urlProfiles().filter((profile) => !configObj.profiles?.includes(profile))
|
|
779
|
+
];
|
|
769
780
|
globalThis.kosConfig = configObj;
|
|
770
781
|
const KosGlobalConfig = configObj;
|
|
771
782
|
const resolveKosProfiles = () => KosGlobalConfig.profiles || [];
|
|
@@ -795,10 +806,10 @@ const getLogMessageToStudio = () => {
|
|
|
795
806
|
return enableAll;
|
|
796
807
|
};
|
|
797
808
|
const WS_LOG = "ws-log";
|
|
798
|
-
const originalFactory = log$
|
|
809
|
+
const originalFactory = log$S.methodFactory;
|
|
799
810
|
const enableMessageLogging = getKosMessageLogging();
|
|
800
811
|
const enableStudioMessageLogging = getLogMessageToStudio();
|
|
801
|
-
log$
|
|
812
|
+
log$S.methodFactory = function(methodName, logLevel, loggerName) {
|
|
802
813
|
const rawMethod = originalFactory(methodName, logLevel, loggerName);
|
|
803
814
|
return function(...args) {
|
|
804
815
|
const _name = loggerName ? String(loggerName) : "";
|
|
@@ -813,17 +824,17 @@ log$R.methodFactory = function(methodName, logLevel, loggerName) {
|
|
|
813
824
|
};
|
|
814
825
|
};
|
|
815
826
|
let level = getLogLevel();
|
|
816
|
-
log$
|
|
827
|
+
log$S.setLevel(level);
|
|
817
828
|
window.setKosLogLevel = (_level) => {
|
|
818
829
|
level = _level;
|
|
819
|
-
log$
|
|
830
|
+
log$S.setLevel(_level);
|
|
820
831
|
};
|
|
821
|
-
const wsLog = log$
|
|
832
|
+
const wsLog = log$S.getLogger(WS_LOG);
|
|
822
833
|
window.enableKosMessageLog = () => {
|
|
823
|
-
wsLog.setLevel(log$
|
|
834
|
+
wsLog.setLevel(log$S.levels.INFO);
|
|
824
835
|
};
|
|
825
836
|
window.disableKosMessageLog = () => {
|
|
826
|
-
wsLog.setLevel(log$
|
|
837
|
+
wsLog.setLevel(log$S.levels.ERROR);
|
|
827
838
|
};
|
|
828
839
|
if (enableMessageLogging) {
|
|
829
840
|
window.enableKosMessageLog();
|
|
@@ -851,21 +862,21 @@ const received = [
|
|
|
851
862
|
"font-weight: bold"
|
|
852
863
|
].join(";");
|
|
853
864
|
const conditionallyLog = (level2) => (fn) => {
|
|
854
|
-
if (log$
|
|
865
|
+
if (log$S.getLevel() <= level2) {
|
|
855
866
|
fn();
|
|
856
867
|
}
|
|
857
868
|
};
|
|
858
869
|
const KosLog = {
|
|
859
|
-
...log$
|
|
860
|
-
ifDebug: conditionallyLog(log$
|
|
861
|
-
ifInfo: conditionallyLog(log$
|
|
862
|
-
ifWarn: conditionallyLog(log$
|
|
863
|
-
ifError: conditionallyLog(log$
|
|
864
|
-
getLogger: (name) => log$
|
|
865
|
-
getLoggers: () => log$
|
|
870
|
+
...log$S,
|
|
871
|
+
ifDebug: conditionallyLog(log$S.levels.DEBUG),
|
|
872
|
+
ifInfo: conditionallyLog(log$S.levels.INFO),
|
|
873
|
+
ifWarn: conditionallyLog(log$S.levels.WARN),
|
|
874
|
+
ifError: conditionallyLog(log$S.levels.ERROR),
|
|
875
|
+
getLogger: (name) => log$S.getLogger(`kos::${name}`),
|
|
876
|
+
getLoggers: () => log$S.getLoggers(),
|
|
866
877
|
createLogger: ({ name, group }) => {
|
|
867
878
|
const loggerName = `${group ? `${group}:` : "kos"}::${name}`;
|
|
868
|
-
const _log = log$
|
|
879
|
+
const _log = log$S.getLogger(loggerName);
|
|
869
880
|
let _level = globalThis.kos.logOverrides?.find(
|
|
870
881
|
(override) => override.name === loggerName
|
|
871
882
|
)?.level;
|
|
@@ -916,7 +927,7 @@ const OptionsRequired = /* @__PURE__ */ Symbol(`OptionsRequired`);
|
|
|
916
927
|
const KosViewModelSymbol = /* @__PURE__ */ Symbol(`KosViewModelSymbol`);
|
|
917
928
|
const ViewModelConfig = /* @__PURE__ */ Symbol(`ViewModelConfig`);
|
|
918
929
|
const ReloadAwareSetup = /* @__PURE__ */ Symbol(`ReloadAwareSetup`);
|
|
919
|
-
const log$
|
|
930
|
+
const log$R = KosLog.createLogger({ group: "decorators", name: "fsm-injection" });
|
|
920
931
|
function injectStateMachineSupport(modelInstance) {
|
|
921
932
|
const fsmSetup = modelInstance[StateMachineSetup];
|
|
922
933
|
if (!fsmSetup) return;
|
|
@@ -960,7 +971,7 @@ function initializeFsmProperties(modelInstance, options) {
|
|
|
960
971
|
const config2 = modelInstance._fsmConfig;
|
|
961
972
|
const initialState = computeInitialState ? computeInitialState(modelInstance) : config2.initial;
|
|
962
973
|
if (computeInitialState && !config2.states[initialState]) {
|
|
963
|
-
log$
|
|
974
|
+
log$R.warn(
|
|
964
975
|
`computeInitialState returned "${initialState}" which is not a valid state. Falling back to "${config2.initial}".`
|
|
965
976
|
);
|
|
966
977
|
modelInstance[stateProperty] = config2.initial;
|
|
@@ -1090,7 +1101,7 @@ function handleAsyncEntryResult(instance, state, stateProperty, result) {
|
|
|
1090
1101
|
if (stateConfig.onError && instance[stateProperty] === state) {
|
|
1091
1102
|
instance.transition(stateConfig.onError);
|
|
1092
1103
|
} else {
|
|
1093
|
-
log$
|
|
1104
|
+
log$R.error(`Async entry handler for state "${state}" failed:`, err);
|
|
1094
1105
|
}
|
|
1095
1106
|
}
|
|
1096
1107
|
);
|
|
@@ -1131,7 +1142,7 @@ function initializeStateMachine(modelInstance, lifecycle) {
|
|
|
1131
1142
|
modelInstance._fsmInitialized = true;
|
|
1132
1143
|
trackInitialStateInHistory(modelInstance, config2.initial, options);
|
|
1133
1144
|
executeInitialStateEntryHandler(modelInstance, config2.initial);
|
|
1134
|
-
log$
|
|
1145
|
+
log$R.debug(
|
|
1135
1146
|
`FSM initialized for model ${modelInstance.id} at lifecycle ${lifecycle} with initial state "${config2.initial}"`
|
|
1136
1147
|
);
|
|
1137
1148
|
}
|
|
@@ -1389,7 +1400,7 @@ class ServiceRequestError extends Error {
|
|
|
1389
1400
|
this.responseHeaders = details.responseHeaders ?? {};
|
|
1390
1401
|
}
|
|
1391
1402
|
}
|
|
1392
|
-
const log$
|
|
1403
|
+
const log$Q = KosLog.createLogger({ name: "resolve-parameters" });
|
|
1393
1404
|
const resolveParameters = ({
|
|
1394
1405
|
value,
|
|
1395
1406
|
modelId,
|
|
@@ -1421,11 +1432,11 @@ const resolveParameters = ({
|
|
|
1421
1432
|
)) {
|
|
1422
1433
|
const prop = modelData[propName];
|
|
1423
1434
|
if (prop !== null && prop !== void 0) {
|
|
1424
|
-
log$
|
|
1435
|
+
log$Q.debug(`Resolved ${match} to ${prop}`);
|
|
1425
1436
|
return prop;
|
|
1426
1437
|
} else {
|
|
1427
1438
|
const logLevel2 = isOnlyPropKey ? "debug" : "warn";
|
|
1428
|
-
log$
|
|
1439
|
+
log$Q[logLevel2](
|
|
1429
1440
|
`Property ${propName} is null or undefined${isOnlyPropKey ? "" : " in composite string"}, marking for undefined return`
|
|
1430
1441
|
);
|
|
1431
1442
|
hasUnresolvedProp = true;
|
|
@@ -1433,7 +1444,7 @@ const resolveParameters = ({
|
|
|
1433
1444
|
}
|
|
1434
1445
|
}
|
|
1435
1446
|
const logLevel = isOnlyPropKey ? "debug" : "warn";
|
|
1436
|
-
log$
|
|
1447
|
+
log$Q[logLevel](
|
|
1437
1448
|
`Property ${propName} not found in modelData${isOnlyPropKey ? "" : " for composite string"}`
|
|
1438
1449
|
);
|
|
1439
1450
|
return match;
|
|
@@ -1448,7 +1459,7 @@ const resolveParameters = ({
|
|
|
1448
1459
|
}
|
|
1449
1460
|
return _value;
|
|
1450
1461
|
};
|
|
1451
|
-
const log$
|
|
1462
|
+
const log$P = KosLog.createLogger({ name: "ServiceRequestHelpers" });
|
|
1452
1463
|
function resolveServiceRequestParameters(metadata, modelInstance, args, runtimeOptions) {
|
|
1453
1464
|
const resolvedPath = resolveParameters({
|
|
1454
1465
|
value: metadata.path,
|
|
@@ -1517,7 +1528,7 @@ function handleServiceRequestError(error, response, errorHandler, modelInstance,
|
|
|
1517
1528
|
});
|
|
1518
1529
|
switch (errorHandler.strategy) {
|
|
1519
1530
|
case "log":
|
|
1520
|
-
log$
|
|
1531
|
+
log$P.error(`Service request status ${richError.status} error: ${error}`);
|
|
1521
1532
|
if (errorHandler.onError) {
|
|
1522
1533
|
errorHandler.onError(richError, modelInstance);
|
|
1523
1534
|
}
|
|
@@ -1640,7 +1651,7 @@ var ReplayStrategy = /* @__PURE__ */ ((ReplayStrategy2) => {
|
|
|
1640
1651
|
ReplayStrategy2["NONE"] = "none";
|
|
1641
1652
|
return ReplayStrategy2;
|
|
1642
1653
|
})(ReplayStrategy || {});
|
|
1643
|
-
const log$
|
|
1654
|
+
const log$O = KosLog.createLogger({ name: "kos-state-machine" });
|
|
1644
1655
|
function kosStateMachine(config2, options) {
|
|
1645
1656
|
return (target) => {
|
|
1646
1657
|
target.prototype[StateMachineSetup] = {
|
|
@@ -1695,7 +1706,7 @@ function kosStateGuard(options) {
|
|
|
1695
1706
|
if (shouldThrow) {
|
|
1696
1707
|
throw new Error(message2);
|
|
1697
1708
|
} else {
|
|
1698
|
-
log$
|
|
1709
|
+
log$O.warn(message2);
|
|
1699
1710
|
return void 0;
|
|
1700
1711
|
}
|
|
1701
1712
|
}
|
|
@@ -2261,7 +2272,7 @@ function observeComputedProperties(model, callback, keys = []) {
|
|
|
2261
2272
|
);
|
|
2262
2273
|
return disposers;
|
|
2263
2274
|
}
|
|
2264
|
-
const log$
|
|
2275
|
+
const log$N = KosLog.createLogger({ name: "kos-container-model" });
|
|
2265
2276
|
class KosModelContainer {
|
|
2266
2277
|
_data;
|
|
2267
2278
|
_sortKey;
|
|
@@ -2383,14 +2394,14 @@ class KosModelContainer {
|
|
|
2383
2394
|
async removeAndDestroy(id) {
|
|
2384
2395
|
const model = this.getModel(id);
|
|
2385
2396
|
if (!model) {
|
|
2386
|
-
log$
|
|
2397
|
+
log$N.debug(`Model ${id} not found in container, skipping destroy`);
|
|
2387
2398
|
return;
|
|
2388
2399
|
}
|
|
2389
2400
|
this.removeModel(id);
|
|
2390
2401
|
try {
|
|
2391
2402
|
await destroyKosModel(model);
|
|
2392
2403
|
} catch (error) {
|
|
2393
|
-
log$
|
|
2404
|
+
log$N.error(`Failed to destroy model ${id}:`, error);
|
|
2394
2405
|
throw error;
|
|
2395
2406
|
}
|
|
2396
2407
|
}
|
|
@@ -2407,7 +2418,7 @@ class KosModelContainer {
|
|
|
2407
2418
|
async removeAndDestroyAll(ids) {
|
|
2408
2419
|
const models2 = ids.map((id) => this.getModel(id)).filter((model) => model !== void 0);
|
|
2409
2420
|
if (models2.length === 0) {
|
|
2410
|
-
log$
|
|
2421
|
+
log$N.debug("No models found to destroy");
|
|
2411
2422
|
return;
|
|
2412
2423
|
}
|
|
2413
2424
|
this.removeAll(ids);
|
|
@@ -2416,7 +2427,7 @@ class KosModelContainer {
|
|
|
2416
2427
|
);
|
|
2417
2428
|
results.forEach((result, index2) => {
|
|
2418
2429
|
if (result.status === "rejected") {
|
|
2419
|
-
log$
|
|
2430
|
+
log$N.error(
|
|
2420
2431
|
`Failed to destroy model ${models2[index2].id}:`,
|
|
2421
2432
|
result.reason
|
|
2422
2433
|
);
|
|
@@ -2589,7 +2600,7 @@ class KosModelContainer {
|
|
|
2589
2600
|
const idx = this.index.get(indexName);
|
|
2590
2601
|
return idx.keys ?? [];
|
|
2591
2602
|
} else {
|
|
2592
|
-
log$
|
|
2603
|
+
log$N.info(
|
|
2593
2604
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
2594
2605
|
);
|
|
2595
2606
|
return [];
|
|
@@ -2601,7 +2612,7 @@ class KosModelContainer {
|
|
|
2601
2612
|
if (idx.index.has(indexKey)) {
|
|
2602
2613
|
return idx.getByKey(indexKey);
|
|
2603
2614
|
} else {
|
|
2604
|
-
log$
|
|
2615
|
+
log$N.info(
|
|
2605
2616
|
`key ${indexKey} not found in ${indexName} index: ${Array.from(
|
|
2606
2617
|
idx.index.keys()
|
|
2607
2618
|
)}`
|
|
@@ -2609,7 +2620,7 @@ class KosModelContainer {
|
|
|
2609
2620
|
return [];
|
|
2610
2621
|
}
|
|
2611
2622
|
} else {
|
|
2612
|
-
log$
|
|
2623
|
+
log$N.info(
|
|
2613
2624
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
2614
2625
|
);
|
|
2615
2626
|
return [];
|
|
@@ -2636,7 +2647,7 @@ class KosModelContainer {
|
|
|
2636
2647
|
* @private
|
|
2637
2648
|
*/
|
|
2638
2649
|
_logCapacityWarning(toEvict) {
|
|
2639
|
-
log$
|
|
2650
|
+
log$N.info(
|
|
2640
2651
|
`Container capacity exceeded (${this._data.size}/${this._maxCapacity}). Evicting ${toEvict} models using ${this._evictionStrategy} strategy.`,
|
|
2641
2652
|
{ parentId: this._parentId }
|
|
2642
2653
|
);
|
|
@@ -2699,7 +2710,7 @@ class KosModelContainer {
|
|
|
2699
2710
|
const candidates = this._customEvictionFilter(this.data);
|
|
2700
2711
|
return candidates.slice(0, count);
|
|
2701
2712
|
}
|
|
2702
|
-
log$
|
|
2713
|
+
log$N.error(
|
|
2703
2714
|
"Custom eviction strategy specified but no customEvictionFilter provided. Falling back to FIFO.",
|
|
2704
2715
|
{ parentId: this._parentId }
|
|
2705
2716
|
);
|
|
@@ -2711,7 +2722,7 @@ class KosModelContainer {
|
|
|
2711
2722
|
*/
|
|
2712
2723
|
async _removeEvictedModels(models2) {
|
|
2713
2724
|
for (const model of models2) {
|
|
2714
|
-
log$
|
|
2725
|
+
log$N.info(
|
|
2715
2726
|
`Evicting model: ${model.id} (type: ${model.constructor.name})`,
|
|
2716
2727
|
{
|
|
2717
2728
|
modelId: model.id,
|
|
@@ -2721,7 +2732,7 @@ class KosModelContainer {
|
|
|
2721
2732
|
);
|
|
2722
2733
|
this.removeModel(model.id, true);
|
|
2723
2734
|
destroyKosModel(model).catch(
|
|
2724
|
-
(e) => log$
|
|
2735
|
+
(e) => log$N.error(`Failed to destroy evicted model ${model.id}:`, e)
|
|
2725
2736
|
);
|
|
2726
2737
|
}
|
|
2727
2738
|
}
|
|
@@ -2730,7 +2741,7 @@ class KosModelContainer {
|
|
|
2730
2741
|
* @private
|
|
2731
2742
|
*/
|
|
2732
2743
|
_logEvictionComplete(evictedCount) {
|
|
2733
|
-
log$
|
|
2744
|
+
log$N.info(
|
|
2734
2745
|
`Evicted ${evictedCount} models. Current size: ${this._data.size}/${this._maxCapacity}`,
|
|
2735
2746
|
{ parentId: this._parentId }
|
|
2736
2747
|
);
|
|
@@ -2739,9 +2750,9 @@ class KosModelContainer {
|
|
|
2739
2750
|
this._data.forEach((model) => {
|
|
2740
2751
|
const modelId = model.id;
|
|
2741
2752
|
destroyKosModel(model).then(() => {
|
|
2742
|
-
log$
|
|
2753
|
+
log$N.debug(`${modelId} destroyed, removing from map`);
|
|
2743
2754
|
this.removeModel(modelId, true);
|
|
2744
|
-
}).catch((e) => log$
|
|
2755
|
+
}).catch((e) => log$N.error(e));
|
|
2745
2756
|
});
|
|
2746
2757
|
this.increment();
|
|
2747
2758
|
}
|
|
@@ -2956,7 +2967,7 @@ const getKosModelActivationState = (model) => {
|
|
|
2956
2967
|
}
|
|
2957
2968
|
};
|
|
2958
2969
|
};
|
|
2959
|
-
const log$
|
|
2970
|
+
const log$M = KosLog.createLogger({ name: "kos-model-factory" });
|
|
2960
2971
|
const KosModelFactory = {
|
|
2961
2972
|
byModelType: (modelType) => KosCore.getInstance().modelManager.getModelFactory(
|
|
2962
2973
|
modelType
|
|
@@ -2964,7 +2975,7 @@ const KosModelFactory = {
|
|
|
2964
2975
|
getModelInstance: (id, modelType, options) => {
|
|
2965
2976
|
const factory = KosModelFactory.byModelType(modelType);
|
|
2966
2977
|
if (!factory) {
|
|
2967
|
-
log$
|
|
2978
|
+
log$M.error(
|
|
2968
2979
|
`No registered factory found for model type ${modelType}. Please register a factory for this model type. `
|
|
2969
2980
|
);
|
|
2970
2981
|
throw Error(`No factory found for model type ${modelType}`);
|
|
@@ -3275,7 +3286,7 @@ class SingletonKosModelRegistrationFactory extends KosBaseModelRegistration {
|
|
|
3275
3286
|
};
|
|
3276
3287
|
}
|
|
3277
3288
|
}
|
|
3278
|
-
const log$
|
|
3289
|
+
const log$L = KosLog.createLogger({ group: "decorators", name: "kos-model" });
|
|
3279
3290
|
function resolveParentContext(TargetClass, modelId, modelData) {
|
|
3280
3291
|
const parentIdRaw = TargetClass[ParentModel]?.parentId;
|
|
3281
3292
|
if (!parentIdRaw) return;
|
|
@@ -3579,7 +3590,7 @@ function injectCompanionSupport(modelInstance, initialData) {
|
|
|
3579
3590
|
const { mode, parentProperty, excludeProperties } = companionConfig;
|
|
3580
3591
|
const parentModel = initialData.companionParent;
|
|
3581
3592
|
if (!parentModel) {
|
|
3582
|
-
log$
|
|
3593
|
+
log$L.warn(
|
|
3583
3594
|
`Companion decorator configured but no parent model found in initialData.companionParent`
|
|
3584
3595
|
);
|
|
3585
3596
|
return;
|
|
@@ -3653,7 +3664,7 @@ function injectCompanionSupport(modelInstance, initialData) {
|
|
|
3653
3664
|
});
|
|
3654
3665
|
}
|
|
3655
3666
|
} catch (error) {
|
|
3656
|
-
log$
|
|
3667
|
+
log$L.debug(
|
|
3657
3668
|
`Skipping companion proxy for property ${propertyName}:`,
|
|
3658
3669
|
error
|
|
3659
3670
|
);
|
|
@@ -3681,7 +3692,7 @@ function makeSafeObservable$1(instance) {
|
|
|
3681
3692
|
try {
|
|
3682
3693
|
return mobx.makeAutoObservable(instance);
|
|
3683
3694
|
} catch (e) {
|
|
3684
|
-
log$
|
|
3695
|
+
log$L.error("Failed to make observable:", e);
|
|
3685
3696
|
return instance;
|
|
3686
3697
|
}
|
|
3687
3698
|
}
|
|
@@ -4165,7 +4176,7 @@ const KosDeletionManager = {
|
|
|
4165
4176
|
}
|
|
4166
4177
|
}
|
|
4167
4178
|
};
|
|
4168
|
-
const log$
|
|
4179
|
+
const log$K = KosLog.createLogger({ name: "kos-dependency-manager" });
|
|
4169
4180
|
class KosDependencyManager {
|
|
4170
4181
|
_usedByCache = /* @__PURE__ */ new Map();
|
|
4171
4182
|
_usesCache = /* @__PURE__ */ new Map();
|
|
@@ -4220,7 +4231,7 @@ class KosDependencyManager {
|
|
|
4220
4231
|
canDestroy(modelId) {
|
|
4221
4232
|
const usedBy = this._usedByCache.get(modelId);
|
|
4222
4233
|
if (usedBy?.length) {
|
|
4223
|
-
log$
|
|
4234
|
+
log$K.info(`Model ${modelId} is still used by: ${usedBy.join(", ")}`);
|
|
4224
4235
|
return false;
|
|
4225
4236
|
}
|
|
4226
4237
|
return true;
|
|
@@ -4230,7 +4241,7 @@ class KosDependencyManager {
|
|
|
4230
4241
|
this._usesCache.clear();
|
|
4231
4242
|
}
|
|
4232
4243
|
}
|
|
4233
|
-
const log$
|
|
4244
|
+
const log$J = KosLog.createLogger({ name: "kos-model-cache" });
|
|
4234
4245
|
class KosModelCache {
|
|
4235
4246
|
constructor(preloadKeys = []) {
|
|
4236
4247
|
this.preloadKeys = preloadKeys;
|
|
@@ -4281,11 +4292,11 @@ class KosModelCache {
|
|
|
4281
4292
|
}
|
|
4282
4293
|
preload(createFn) {
|
|
4283
4294
|
if (this._isPreloaded) {
|
|
4284
|
-
log$
|
|
4295
|
+
log$J.debug("Returning cached preloaded models");
|
|
4285
4296
|
return this._preloaded;
|
|
4286
4297
|
}
|
|
4287
4298
|
this._preloaded = this.preloadKeys.map((key) => {
|
|
4288
|
-
log$
|
|
4299
|
+
log$J.debug(
|
|
4289
4300
|
`Preloading model: ${typeof key === "string" ? key : key.modelType}`
|
|
4290
4301
|
);
|
|
4291
4302
|
return createFn(key);
|
|
@@ -4387,7 +4398,7 @@ function logModelInstantiationError(error, context) {
|
|
|
4387
4398
|
});
|
|
4388
4399
|
}
|
|
4389
4400
|
const isKosCompanionTypeFactory = (obj) => typeof obj === "function";
|
|
4390
|
-
const log$
|
|
4401
|
+
const log$I = KosLog.createLogger({ name: "kos-companion-instantiator" });
|
|
4391
4402
|
class KosCompanionInstantiator {
|
|
4392
4403
|
constructor(registry, cache2, createModel) {
|
|
4393
4404
|
this.registry = registry;
|
|
@@ -4409,7 +4420,7 @@ class KosCompanionInstantiator {
|
|
|
4409
4420
|
createCompanionModels(model, options, lifecycle) {
|
|
4410
4421
|
const companionDefs = this.getCompanionDefinitions(model.modelTypeName);
|
|
4411
4422
|
if (lifecycle !== void 0) {
|
|
4412
|
-
log$
|
|
4423
|
+
log$I.debug(
|
|
4413
4424
|
`Creating ${lifecycle} lifecycle companions for ${model.modelTypeName} [${model.modelId}]`
|
|
4414
4425
|
);
|
|
4415
4426
|
}
|
|
@@ -4452,7 +4463,7 @@ class KosCompanionInstantiator {
|
|
|
4452
4463
|
resolveFactoryCompanion(companionDef, model, options, requestedLifecycle) {
|
|
4453
4464
|
const companionType = companionDef.type(model.modelData, options);
|
|
4454
4465
|
if (!companionType) {
|
|
4455
|
-
log$
|
|
4466
|
+
log$I.debug(
|
|
4456
4467
|
`Companion factory returned undefined for ${model.modelTypeName} at ${requestedLifecycle || "INIT"} phase`
|
|
4457
4468
|
);
|
|
4458
4469
|
return null;
|
|
@@ -4511,7 +4522,7 @@ class KosCompanionInstantiator {
|
|
|
4511
4522
|
);
|
|
4512
4523
|
if (companion) {
|
|
4513
4524
|
this.attachCompanionToParent(companion, parentModel);
|
|
4514
|
-
log$
|
|
4525
|
+
log$I.debug(
|
|
4515
4526
|
`Created ${lifecycle || "INIT"} companion ${companionType} for ${parentModel.modelTypeName} [${parentModel.modelId}]`
|
|
4516
4527
|
);
|
|
4517
4528
|
}
|
|
@@ -4527,7 +4538,7 @@ class KosCompanionInstantiator {
|
|
|
4527
4538
|
*/
|
|
4528
4539
|
companionAlreadyExists(companionId, companionType, parentTypeName) {
|
|
4529
4540
|
if (this.cache.hasModel(companionId)) {
|
|
4530
|
-
log$
|
|
4541
|
+
log$I.debug(
|
|
4531
4542
|
`Companion ${companionType} already exists for ${parentTypeName}`
|
|
4532
4543
|
);
|
|
4533
4544
|
return true;
|
|
@@ -5223,7 +5234,7 @@ class KosEffectManager {
|
|
|
5223
5234
|
this.disposers = [];
|
|
5224
5235
|
}
|
|
5225
5236
|
}
|
|
5226
|
-
const log$
|
|
5237
|
+
const log$H = KosLog.createLogger({ name: "model-active-machine" });
|
|
5227
5238
|
const activeMachine = (model) => {
|
|
5228
5239
|
const machine2 = robot3.createMachine(KosModelState.INACTIVE, {
|
|
5229
5240
|
[KosModelState.FAILED]: robot3.state(
|
|
@@ -5278,11 +5289,11 @@ const activeMachine = (model) => {
|
|
|
5278
5289
|
});
|
|
5279
5290
|
const service2 = robot3.interpret(
|
|
5280
5291
|
machine2,
|
|
5281
|
-
(_service) => log$
|
|
5292
|
+
(_service) => log$H.debug(_service.machine.current)
|
|
5282
5293
|
);
|
|
5283
5294
|
return { service: service2, machine: machine2 };
|
|
5284
5295
|
};
|
|
5285
|
-
const log$
|
|
5296
|
+
const log$G = KosLog.createLogger({ name: "model-online-machine" });
|
|
5286
5297
|
const onlineMachine = (model) => {
|
|
5287
5298
|
const machine2 = robot3.createMachine(KosModelState.OFFLINE, {
|
|
5288
5299
|
[KosModelState.ONLINE]: robot3.state(
|
|
@@ -5300,7 +5311,7 @@ const onlineMachine = (model) => {
|
|
|
5300
5311
|
KosModelEvents.GO_ONLINE,
|
|
5301
5312
|
KosModelState.ONLINE,
|
|
5302
5313
|
robot3.action(async () => {
|
|
5303
|
-
log$
|
|
5314
|
+
log$G.debug(`Going online with model ${model.modelId}`);
|
|
5304
5315
|
await model.online();
|
|
5305
5316
|
model.onlineStatus = KosModelState.ONLINE;
|
|
5306
5317
|
await model.fsm.transitionTo(
|
|
@@ -5313,7 +5324,7 @@ const onlineMachine = (model) => {
|
|
|
5313
5324
|
});
|
|
5314
5325
|
const service2 = robot3.interpret(
|
|
5315
5326
|
machine2,
|
|
5316
|
-
(_service) => log$
|
|
5327
|
+
(_service) => log$G.debug(_service.machine.current)
|
|
5317
5328
|
);
|
|
5318
5329
|
return { machine: machine2, service: service2 };
|
|
5319
5330
|
};
|
|
@@ -5458,11 +5469,11 @@ const machine = (model) => {
|
|
|
5458
5469
|
[KosModelState.FAILED]: robot3.state()
|
|
5459
5470
|
});
|
|
5460
5471
|
};
|
|
5461
|
-
const log$
|
|
5472
|
+
const log$F = KosLog.createLogger({ name: "kos-model-lifecycle" });
|
|
5462
5473
|
const fsm = (model) => {
|
|
5463
5474
|
const service2 = robot3.interpret(
|
|
5464
5475
|
machine(model),
|
|
5465
|
-
(_service) => log$
|
|
5476
|
+
(_service) => log$F.debug(
|
|
5466
5477
|
`state machine for model ${model.modelId}: ${_service.machine.current});`
|
|
5467
5478
|
)
|
|
5468
5479
|
);
|
|
@@ -6442,7 +6453,7 @@ class TransportNotReadyError extends Error {
|
|
|
6442
6453
|
}
|
|
6443
6454
|
}
|
|
6444
6455
|
const isTransportNotReadyError = (error) => !!error && error.code === TRANSPORT_NOT_READY;
|
|
6445
|
-
const log$
|
|
6456
|
+
const log$E = KosLog.createLogger({ name: "kos-fetch" });
|
|
6446
6457
|
const DEFAULT_WS_TIMEOUT = 3e4;
|
|
6447
6458
|
const WS_TIMEOUT = (() => {
|
|
6448
6459
|
const configured = process.env.KOS_WS_TIMEOUT ? parseInt(process.env.KOS_WS_TIMEOUT) : DEFAULT_WS_TIMEOUT;
|
|
@@ -6507,7 +6518,7 @@ const kosFetchWs = async (url, options) => {
|
|
|
6507
6518
|
const requestId = uuid();
|
|
6508
6519
|
const urlObj = new URL(url);
|
|
6509
6520
|
const path = `${urlObj.pathname}${urlObj.search}`;
|
|
6510
|
-
log$
|
|
6521
|
+
log$E.debug(`path: ${path}`);
|
|
6511
6522
|
const budget = resolveTimeoutBudget(options?.timeout);
|
|
6512
6523
|
const messageFactory = fetchMessageFactory(options);
|
|
6513
6524
|
const signal = createRequestSignal(budget, options?.signal);
|
|
@@ -6515,12 +6526,12 @@ const kosFetchWs = async (url, options) => {
|
|
|
6515
6526
|
await transport.whenReady({ signal });
|
|
6516
6527
|
} catch (error) {
|
|
6517
6528
|
if (isTimeoutReason(error)) {
|
|
6518
|
-
log$
|
|
6529
|
+
log$E.error(
|
|
6519
6530
|
`Transport not ready${budget === void 0 ? "" : ` after ${budget}ms`} - request not sent - url: ${url}`
|
|
6520
6531
|
);
|
|
6521
6532
|
throw new TransportNotReadyError({ timeout: budget, url });
|
|
6522
6533
|
}
|
|
6523
|
-
log$
|
|
6534
|
+
log$E.debug(`Request aborted while waiting for transport - url: ${url}`);
|
|
6524
6535
|
throw error;
|
|
6525
6536
|
}
|
|
6526
6537
|
const processedBody = await processRequestBody(options?.body);
|
|
@@ -6549,9 +6560,9 @@ const kosFetchWs = async (url, options) => {
|
|
|
6549
6560
|
if (signal.aborted) {
|
|
6550
6561
|
const reason = signal.reason;
|
|
6551
6562
|
if (reason?.name === "TimeoutError") {
|
|
6552
|
-
log$
|
|
6563
|
+
log$E.error(`Timeout occurred - url: ${url}`);
|
|
6553
6564
|
} else {
|
|
6554
|
-
log$
|
|
6565
|
+
log$E.debug(`Request aborted - url: ${url}`);
|
|
6555
6566
|
}
|
|
6556
6567
|
reject(reason || new DOMException("Aborted", "AbortError"));
|
|
6557
6568
|
return;
|
|
@@ -6560,9 +6571,9 @@ const kosFetchWs = async (url, options) => {
|
|
|
6560
6571
|
if (unsubscribe) unsubscribe();
|
|
6561
6572
|
const reason = signal.reason;
|
|
6562
6573
|
if (reason?.name === "TimeoutError") {
|
|
6563
|
-
log$
|
|
6574
|
+
log$E.error(`Timeout occurred - url: ${url}`);
|
|
6564
6575
|
} else {
|
|
6565
|
-
log$
|
|
6576
|
+
log$E.debug(`Request aborted - url: ${url}`);
|
|
6566
6577
|
}
|
|
6567
6578
|
reject(reason || new DOMException("Aborted", "AbortError"));
|
|
6568
6579
|
};
|
|
@@ -6578,7 +6589,7 @@ const kosFetchWs = async (url, options) => {
|
|
|
6578
6589
|
try {
|
|
6579
6590
|
bodyData = base64ToArrayBuffer(responseBody);
|
|
6580
6591
|
} catch (e) {
|
|
6581
|
-
log$
|
|
6592
|
+
log$E.error("Failed to decode base64 response", e);
|
|
6582
6593
|
}
|
|
6583
6594
|
}
|
|
6584
6595
|
const response = {
|
|
@@ -6632,7 +6643,7 @@ const kosFetchWs = async (url, options) => {
|
|
|
6632
6643
|
});
|
|
6633
6644
|
}
|
|
6634
6645
|
if (parsed.files) {
|
|
6635
|
-
log$
|
|
6646
|
+
log$E.warn(
|
|
6636
6647
|
"File reconstruction in FormData not fully implemented"
|
|
6637
6648
|
);
|
|
6638
6649
|
}
|
|
@@ -6683,7 +6694,7 @@ const resolveBaseUrl = () => {
|
|
|
6683
6694
|
const URL2 = exports.BASE_URL;
|
|
6684
6695
|
return { isMock: MOCK, URL: URL2 };
|
|
6685
6696
|
};
|
|
6686
|
-
const log$
|
|
6697
|
+
const log$D = KosLog.createLogger({ name: "kos-service-request" });
|
|
6687
6698
|
const ERROR_UNKNOWN = "errUnknown";
|
|
6688
6699
|
const ERROR_TRANSPORT_NOT_READY = "Transport not ready";
|
|
6689
6700
|
const MUTATING_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "DELETE", "PATCH"]);
|
|
@@ -6709,7 +6720,7 @@ async function clientRequest(endpoint, method, options, params2, body) {
|
|
|
6709
6720
|
)}`
|
|
6710
6721
|
).join("&") : "";
|
|
6711
6722
|
const fullUrl = `${resolveBaseUrl().URL}${url}${query ? `?${query}` : ""}`;
|
|
6712
|
-
log$
|
|
6723
|
+
log$D.debug(`fullUrl: ${fullUrl}`);
|
|
6713
6724
|
const fetchOptions = {
|
|
6714
6725
|
method: String(method).toUpperCase(),
|
|
6715
6726
|
body: null,
|
|
@@ -6736,20 +6747,20 @@ async function executeFetch(fullUrl, fetchOptions) {
|
|
|
6736
6747
|
return [null, payload.data ?? payload];
|
|
6737
6748
|
} catch (error) {
|
|
6738
6749
|
if (isTransportNotReadyError(error)) {
|
|
6739
|
-
log$
|
|
6750
|
+
log$D.error(`Transport not ready, request not sent: ${fullUrl}`);
|
|
6740
6751
|
return [ERROR_TRANSPORT_NOT_READY, null];
|
|
6741
6752
|
}
|
|
6742
6753
|
if (error instanceof DOMException) {
|
|
6743
6754
|
if (error.name === "TimeoutError") {
|
|
6744
|
-
log$
|
|
6755
|
+
log$D.error(`Request timed out: ${fullUrl}`);
|
|
6745
6756
|
return ["Request timed out", null];
|
|
6746
6757
|
}
|
|
6747
6758
|
if (error.name === "AbortError") {
|
|
6748
|
-
log$
|
|
6759
|
+
log$D.debug(`Request aborted: ${fullUrl}`);
|
|
6749
6760
|
return ["Request aborted", null];
|
|
6750
6761
|
}
|
|
6751
6762
|
}
|
|
6752
|
-
log$
|
|
6763
|
+
log$D.error(`Unexpected error during fetch: ${error}`);
|
|
6753
6764
|
return [error instanceof Error ? error.message : ERROR_UNKNOWN, null];
|
|
6754
6765
|
}
|
|
6755
6766
|
}
|
|
@@ -6769,38 +6780,38 @@ async function executeFetchWithRetry(fullUrl, fetchOptions, config2) {
|
|
|
6769
6780
|
errorContext
|
|
6770
6781
|
];
|
|
6771
6782
|
if (config2.retryOn && !config2.retryOn(response)) {
|
|
6772
|
-
log$
|
|
6783
|
+
log$D.debug(
|
|
6773
6784
|
`Retry predicate returned false for ${fullUrl} (status ${response.status}), stopping`
|
|
6774
6785
|
);
|
|
6775
6786
|
return lastResult;
|
|
6776
6787
|
}
|
|
6777
6788
|
if (attempt < config2.maxAttempts) {
|
|
6778
6789
|
const delayMs = config2.baseDelayMs * Math.pow(config2.backoffFactor, attempt - 1);
|
|
6779
|
-
log$
|
|
6790
|
+
log$D.warn(
|
|
6780
6791
|
`Request to ${fullUrl} failed (status ${response.status}), retrying in ${delayMs}ms (attempt ${attempt}/${config2.maxAttempts})`
|
|
6781
6792
|
);
|
|
6782
6793
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
6783
6794
|
}
|
|
6784
6795
|
} catch (error) {
|
|
6785
6796
|
if (isTransportNotReadyError(error)) {
|
|
6786
|
-
log$
|
|
6797
|
+
log$D.error(`Transport not ready, request not sent: ${fullUrl}`);
|
|
6787
6798
|
return [ERROR_TRANSPORT_NOT_READY, null];
|
|
6788
6799
|
}
|
|
6789
6800
|
if (error instanceof DOMException) {
|
|
6790
6801
|
if (error.name === "TimeoutError") {
|
|
6791
|
-
log$
|
|
6802
|
+
log$D.error(`Request timed out: ${fullUrl}`);
|
|
6792
6803
|
return ["Request timed out", null];
|
|
6793
6804
|
}
|
|
6794
6805
|
if (error.name === "AbortError") {
|
|
6795
|
-
log$
|
|
6806
|
+
log$D.debug(`Request aborted: ${fullUrl}`);
|
|
6796
6807
|
return ["Request aborted", null];
|
|
6797
6808
|
}
|
|
6798
6809
|
}
|
|
6799
|
-
log$
|
|
6810
|
+
log$D.error(`Unexpected error during fetch: ${error}`);
|
|
6800
6811
|
return [error instanceof Error ? error.message : ERROR_UNKNOWN, null];
|
|
6801
6812
|
}
|
|
6802
6813
|
}
|
|
6803
|
-
log$
|
|
6814
|
+
log$D.error(`All ${config2.maxAttempts} attempts failed for ${fullUrl}`);
|
|
6804
6815
|
return lastResult;
|
|
6805
6816
|
}
|
|
6806
6817
|
async function captureErrorResponseContext(response) {
|
|
@@ -6849,7 +6860,7 @@ const service$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
6849
6860
|
default: api$9,
|
|
6850
6861
|
kosServiceRequest: kosServiceRequest$8
|
|
6851
6862
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6852
|
-
const log$
|
|
6863
|
+
const log$C = KosLog.createLogger({
|
|
6853
6864
|
name: "kos-service-request-manager",
|
|
6854
6865
|
group: "Model"
|
|
6855
6866
|
});
|
|
@@ -6902,7 +6913,7 @@ function isValueMissing(value) {
|
|
|
6902
6913
|
}
|
|
6903
6914
|
function validateRequiredField(value, fieldName, path, isRequired) {
|
|
6904
6915
|
if (isRequired && isValueMissing(value)) {
|
|
6905
|
-
log$
|
|
6916
|
+
log$C.warn(
|
|
6906
6917
|
`Required field '${fieldName}' is missing in response for ${path}`
|
|
6907
6918
|
);
|
|
6908
6919
|
}
|
|
@@ -6934,7 +6945,7 @@ class ServiceRequestManager {
|
|
|
6934
6945
|
this.handlers.get(lifecycle).push(metadata);
|
|
6935
6946
|
});
|
|
6936
6947
|
if (Object.keys(handlerMetadata).length > 0) {
|
|
6937
|
-
log$
|
|
6948
|
+
log$C.debug(
|
|
6938
6949
|
`Discovered ${Object.keys(handlerMetadata).length} service request handlers for model ${this.model.id}`
|
|
6939
6950
|
);
|
|
6940
6951
|
}
|
|
@@ -6949,7 +6960,7 @@ class ServiceRequestManager {
|
|
|
6949
6960
|
if (!handlers || handlers.length === 0) {
|
|
6950
6961
|
return;
|
|
6951
6962
|
}
|
|
6952
|
-
log$
|
|
6963
|
+
log$C.debug(
|
|
6953
6964
|
`Executing ${handlers.length} service requests for lifecycle ${lifecycle}`
|
|
6954
6965
|
);
|
|
6955
6966
|
await Promise.all(handlers.map((handler) => this.executeHandler(handler)));
|
|
@@ -6974,7 +6985,7 @@ class ServiceRequestManager {
|
|
|
6974
6985
|
*/
|
|
6975
6986
|
shouldProcessRequest(metadata) {
|
|
6976
6987
|
if (!shouldExecuteRequest(metadata, this.model)) {
|
|
6977
|
-
log$
|
|
6988
|
+
log$C.debug(`Skipping request ${metadata.path} - condition returned false`);
|
|
6978
6989
|
return false;
|
|
6979
6990
|
}
|
|
6980
6991
|
return true;
|
|
@@ -7191,7 +7202,7 @@ class ServiceRequestManager {
|
|
|
7191
7202
|
case "json":
|
|
7192
7203
|
return typeof value === "string" ? JSON.parse(value) : value;
|
|
7193
7204
|
default:
|
|
7194
|
-
log$
|
|
7205
|
+
log$C.warn(`Unknown transformer: ${transform}`);
|
|
7195
7206
|
return value;
|
|
7196
7207
|
}
|
|
7197
7208
|
}
|
|
@@ -7202,7 +7213,7 @@ class ServiceRequestManager {
|
|
|
7202
7213
|
if (!metadata.iterateOver) return data;
|
|
7203
7214
|
const array = this.getNestedValue(data, metadata.iterateOver);
|
|
7204
7215
|
if (!Array.isArray(array)) {
|
|
7205
|
-
log$
|
|
7216
|
+
log$C.warn(
|
|
7206
7217
|
`iterateOver path '${metadata.iterateOver}' did not resolve to an array`
|
|
7207
7218
|
);
|
|
7208
7219
|
return [];
|
|
@@ -7245,7 +7256,7 @@ class ServiceRequestManager {
|
|
|
7245
7256
|
case "throw":
|
|
7246
7257
|
throw error;
|
|
7247
7258
|
case "log":
|
|
7248
|
-
log$
|
|
7259
|
+
log$C.error(
|
|
7249
7260
|
`Service request failed for ${metadata.path}:`,
|
|
7250
7261
|
error.message
|
|
7251
7262
|
);
|
|
@@ -9723,7 +9734,7 @@ class BridgeTransport {
|
|
|
9723
9734
|
messageQueue = [];
|
|
9724
9735
|
isSending = false;
|
|
9725
9736
|
constructor(addr) {
|
|
9726
|
-
log$
|
|
9737
|
+
log$S.debug(`called Bridge Transport with addr ${addr}`);
|
|
9727
9738
|
const that = this;
|
|
9728
9739
|
globalThis.kosWindowWebsocketRecv = (msg) => {
|
|
9729
9740
|
if (that.onmessage) {
|
|
@@ -9731,19 +9742,19 @@ class BridgeTransport {
|
|
|
9731
9742
|
that.onmessage(data);
|
|
9732
9743
|
}
|
|
9733
9744
|
};
|
|
9734
|
-
log$
|
|
9745
|
+
log$S.debug("Opening bridge transport");
|
|
9735
9746
|
globalThis.kosWindowWebsocketOpen();
|
|
9736
|
-
log$
|
|
9747
|
+
log$S.debug("Opened bridge transport");
|
|
9737
9748
|
this._onclose = null;
|
|
9738
9749
|
this._onerror = null;
|
|
9739
9750
|
this._onmessage = null;
|
|
9740
9751
|
this._onopen = null;
|
|
9741
|
-
this.addEventListener = () => log$
|
|
9742
|
-
this.dispatchEvent = () => log$
|
|
9743
|
-
this.removeEventListener = () => log$
|
|
9752
|
+
this.addEventListener = () => log$S.debug("not implemented");
|
|
9753
|
+
this.dispatchEvent = () => log$S.debug("not implemented");
|
|
9754
|
+
this.removeEventListener = () => log$S.debug("not implemented");
|
|
9744
9755
|
}
|
|
9745
9756
|
close() {
|
|
9746
|
-
log$
|
|
9757
|
+
log$S.debug("closing");
|
|
9747
9758
|
}
|
|
9748
9759
|
sendNextMessage() {
|
|
9749
9760
|
if (this.messageQueue.length > 0) {
|
|
@@ -9958,7 +9969,7 @@ if (params$1.fos) {
|
|
|
9958
9969
|
const fosPort = process.env.KOS_FOS_PORT;
|
|
9959
9970
|
window.kosUseFos = !!(window.kosUseFos || process.env.KOS_USE_FOS === "true");
|
|
9960
9971
|
window.kosFosPort = fosPort ? parseInt(fosPort) : 0;
|
|
9961
|
-
const log$
|
|
9972
|
+
const log$B = log$S.getLogger("web-socket-transport");
|
|
9962
9973
|
var KosWSTransportStatus = /* @__PURE__ */ ((KosWSTransportStatus2) => {
|
|
9963
9974
|
KosWSTransportStatus2["NOT_INITIALIZED"] = "not_initialized";
|
|
9964
9975
|
KosWSTransportStatus2["INITIALIZED"] = "initialized";
|
|
@@ -10015,7 +10026,7 @@ class WebSocketTransport {
|
|
|
10015
10026
|
() => this.connectionEstablished,
|
|
10016
10027
|
(connectionEstablished) => {
|
|
10017
10028
|
if (connectionEstablished) {
|
|
10018
|
-
log$
|
|
10029
|
+
log$B.warn("Connection Established");
|
|
10019
10030
|
this.reconnectAttempts = 0;
|
|
10020
10031
|
publish(
|
|
10021
10032
|
WebSocketEvents.CONNECTED,
|
|
@@ -10066,7 +10077,7 @@ class WebSocketTransport {
|
|
|
10066
10077
|
protocol: this.protocol,
|
|
10067
10078
|
alias: this.alias,
|
|
10068
10079
|
onConnectionLost: () => {
|
|
10069
|
-
log$
|
|
10080
|
+
log$B.error(`Connection Lost`);
|
|
10070
10081
|
this.scheduleReconnect();
|
|
10071
10082
|
}
|
|
10072
10083
|
});
|
|
@@ -10112,7 +10123,7 @@ class WebSocketTransport {
|
|
|
10112
10123
|
return Math.floor(exponentialDelay + jitter);
|
|
10113
10124
|
}
|
|
10114
10125
|
_sendSubscriptionMessage(topic, type, fos = false, bridge = false, connectionId, explicitDestination = false) {
|
|
10115
|
-
log$
|
|
10126
|
+
log$B.debug(`${type} to topic ${topic}`);
|
|
10116
10127
|
let connId;
|
|
10117
10128
|
if (explicitDestination) {
|
|
10118
10129
|
connId = connectionId;
|
|
@@ -10121,7 +10132,7 @@ class WebSocketTransport {
|
|
|
10121
10132
|
const connectionParam = params2?.connId;
|
|
10122
10133
|
connId = connectionId ?? connectionParam ?? window?.kosBridge?.("connId");
|
|
10123
10134
|
}
|
|
10124
|
-
log$
|
|
10135
|
+
log$B.debug(`subscribing with connId ${connId}`);
|
|
10125
10136
|
const dstAddr = connId ? `dst-addr:${connId}
|
|
10126
10137
|
` : "";
|
|
10127
10138
|
const msg = fos ? `subscribe:${topic}` : bridge ? `type:fos.broker
|
|
@@ -10135,7 +10146,7 @@ ${dstAddr}topics:${topic}
|
|
|
10135
10146
|
const socket = fos ? this.fosSocket : this.socket;
|
|
10136
10147
|
socket?.socket?.send(msg);
|
|
10137
10148
|
} else {
|
|
10138
|
-
log$
|
|
10149
|
+
log$B.debug(`no connection adding to offline messages`);
|
|
10139
10150
|
const socket = fos ? this.fosSocket : this.socket;
|
|
10140
10151
|
socket?.addOfflineMessage(msg);
|
|
10141
10152
|
}
|
|
@@ -10149,7 +10160,7 @@ ${dstAddr}topics:${topic}
|
|
|
10149
10160
|
explicitDestination
|
|
10150
10161
|
}) {
|
|
10151
10162
|
const { unsubscribe, count } = subscribe(topic, callback);
|
|
10152
|
-
log$
|
|
10163
|
+
log$B.debug(`Topic ${topic} currently has ${count} subscribers`);
|
|
10153
10164
|
this._sendSubscriptionMessage(
|
|
10154
10165
|
topic,
|
|
10155
10166
|
"subscribe",
|
|
@@ -10160,7 +10171,7 @@ ${dstAddr}topics:${topic}
|
|
|
10160
10171
|
);
|
|
10161
10172
|
return () => {
|
|
10162
10173
|
const { count: count2 } = unsubscribe();
|
|
10163
|
-
log$
|
|
10174
|
+
log$B.debug(`Topic ${topic} currently has ${count2} subscribers`);
|
|
10164
10175
|
if (count2 === 0) {
|
|
10165
10176
|
this._sendSubscriptionMessage(
|
|
10166
10177
|
topic,
|
|
@@ -11007,7 +11018,7 @@ class KosModelComponentFactory {
|
|
|
11007
11018
|
return components;
|
|
11008
11019
|
}
|
|
11009
11020
|
}
|
|
11010
|
-
const log$
|
|
11021
|
+
const log$A = log$S.getLogger("kos-model");
|
|
11011
11022
|
const MODEL_LOADER = "kos.extension.model.loader";
|
|
11012
11023
|
class KosModel {
|
|
11013
11024
|
_id;
|
|
@@ -11115,23 +11126,23 @@ class KosModel {
|
|
|
11115
11126
|
return this._status === KosModelState.READY;
|
|
11116
11127
|
}
|
|
11117
11128
|
async deactivate() {
|
|
11118
|
-
log$
|
|
11129
|
+
log$A.debug(
|
|
11119
11130
|
`deactivating model ${this.modelTypeName} with id ${this.modelId}`
|
|
11120
11131
|
);
|
|
11121
11132
|
try {
|
|
11122
11133
|
const context = KosContextManager.getContext(this.modelId);
|
|
11123
11134
|
await this.modelData?.deactivate?.(context);
|
|
11124
|
-
log$
|
|
11135
|
+
log$A.debug(
|
|
11125
11136
|
`Model ${this.modelTypeName} with id ${this.modelId} deactivated`
|
|
11126
11137
|
);
|
|
11127
11138
|
this.subscriptionManager?.deactivate();
|
|
11128
11139
|
} catch (e) {
|
|
11129
|
-
log$
|
|
11140
|
+
log$A.debug(`Model ${this.modelId} failed to deactivated`);
|
|
11130
11141
|
throw e;
|
|
11131
11142
|
}
|
|
11132
11143
|
}
|
|
11133
11144
|
async activate() {
|
|
11134
|
-
log$
|
|
11145
|
+
log$A.debug(`activating model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11135
11146
|
await executeDependentModelLifecycle(this, DependencyLifecycle.ACTIVATE);
|
|
11136
11147
|
try {
|
|
11137
11148
|
await this.serviceRequestManager?.executeForLifecycle(
|
|
@@ -11140,16 +11151,16 @@ class KosModel {
|
|
|
11140
11151
|
const context = KosContextManager.getContext(this.modelId);
|
|
11141
11152
|
await this.modelData?.activate?.(context);
|
|
11142
11153
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.ACTIVATE);
|
|
11143
|
-
log$
|
|
11154
|
+
log$A.debug(
|
|
11144
11155
|
`Model ${this.modelTypeName} with id ${this.modelId} subscribing to all topics`
|
|
11145
11156
|
);
|
|
11146
11157
|
this.subscriptionManager?.registerAll(DependencyLifecycle.ACTIVATE);
|
|
11147
11158
|
this.createLifecycleCompanions(DependencyLifecycle.ACTIVATE);
|
|
11148
|
-
log$
|
|
11159
|
+
log$A.debug(
|
|
11149
11160
|
`Model ${this.modelTypeName} with id ${this.modelId} activated`
|
|
11150
11161
|
);
|
|
11151
11162
|
} catch (e) {
|
|
11152
|
-
log$
|
|
11163
|
+
log$A.debug(`Model ${this.modelId} failed to activate`);
|
|
11153
11164
|
throw e;
|
|
11154
11165
|
}
|
|
11155
11166
|
return;
|
|
@@ -11165,7 +11176,7 @@ class KosModel {
|
|
|
11165
11176
|
{
|
|
11166
11177
|
condition: () => this.loaded,
|
|
11167
11178
|
onMatch: () => {
|
|
11168
|
-
log$
|
|
11179
|
+
log$A.debug(`Model ${this.modelId} is loaded`);
|
|
11169
11180
|
}
|
|
11170
11181
|
}
|
|
11171
11182
|
]);
|
|
@@ -11181,7 +11192,7 @@ class KosModel {
|
|
|
11181
11192
|
{
|
|
11182
11193
|
condition: () => this.initialized,
|
|
11183
11194
|
onMatch: () => {
|
|
11184
|
-
log$
|
|
11195
|
+
log$A.debug(`Model ${this.modelId} is initialized`);
|
|
11185
11196
|
}
|
|
11186
11197
|
}
|
|
11187
11198
|
]);
|
|
@@ -11197,20 +11208,20 @@ class KosModel {
|
|
|
11197
11208
|
{
|
|
11198
11209
|
condition: () => this.status === KosModelState.READY,
|
|
11199
11210
|
onMatch: () => {
|
|
11200
|
-
log$
|
|
11211
|
+
log$A.debug(`Model ${this.modelId} is ready`);
|
|
11201
11212
|
}
|
|
11202
11213
|
}
|
|
11203
11214
|
]);
|
|
11204
11215
|
}
|
|
11205
11216
|
async ready() {
|
|
11206
11217
|
if (this.fsm.current === KosModelState.READY) {
|
|
11207
|
-
log$
|
|
11218
|
+
log$A.debug(
|
|
11208
11219
|
`already readying model ${this.modelTypeName} with id ${this.modelId} returning`
|
|
11209
11220
|
);
|
|
11210
11221
|
return;
|
|
11211
11222
|
}
|
|
11212
11223
|
try {
|
|
11213
|
-
log$
|
|
11224
|
+
log$A.debug(`readying model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11214
11225
|
await executeDependentModelLifecycle(this, DependencyLifecycle.READY);
|
|
11215
11226
|
await executeChildrenModelLifecycle(
|
|
11216
11227
|
this,
|
|
@@ -11226,7 +11237,7 @@ class KosModel {
|
|
|
11226
11237
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.READY);
|
|
11227
11238
|
this.subscriptionManager?.registerAll(DependencyLifecycle.READY);
|
|
11228
11239
|
this.createLifecycleCompanions(DependencyLifecycle.READY);
|
|
11229
|
-
log$
|
|
11240
|
+
log$A.debug(`Model ${this.modelId} is ready`);
|
|
11230
11241
|
const payload = {
|
|
11231
11242
|
modelId: this.modelId,
|
|
11232
11243
|
modelType: this.modelTypeName
|
|
@@ -11237,7 +11248,7 @@ class KosModel {
|
|
|
11237
11248
|
);
|
|
11238
11249
|
publish(modelTypeEventTopicFactory(this.modelTypeName), payload);
|
|
11239
11250
|
} catch (e) {
|
|
11240
|
-
log$
|
|
11251
|
+
log$A.error(e);
|
|
11241
11252
|
throw Error(e);
|
|
11242
11253
|
}
|
|
11243
11254
|
}
|
|
@@ -11248,18 +11259,18 @@ class KosModel {
|
|
|
11248
11259
|
}
|
|
11249
11260
|
const { modelTypeName, modelId } = this;
|
|
11250
11261
|
if (this.fsm.current === KosModelState.LOADED) {
|
|
11251
|
-
log$
|
|
11262
|
+
log$A.debug(`Model ${modelTypeName} with id ${modelId} already loaded`);
|
|
11252
11263
|
return;
|
|
11253
11264
|
}
|
|
11254
11265
|
if (this._isLoadExecuting) {
|
|
11255
|
-
log$
|
|
11266
|
+
log$A.debug(
|
|
11256
11267
|
`Model ${modelTypeName} with id ${modelId} is currently executing load`
|
|
11257
11268
|
);
|
|
11258
11269
|
return;
|
|
11259
11270
|
}
|
|
11260
11271
|
this._isLoadExecuting = true;
|
|
11261
11272
|
try {
|
|
11262
|
-
log$
|
|
11273
|
+
log$A.debug(`Loading model ${modelTypeName} with id ${modelId}`);
|
|
11263
11274
|
await executeDependentModelLifecycle(this, DependencyLifecycle.LOAD);
|
|
11264
11275
|
const context = KosContextManager.getContext(modelId);
|
|
11265
11276
|
const MODEL_LOADER_TYPE = `${MODEL_LOADER}.${modelTypeName}`;
|
|
@@ -11268,7 +11279,7 @@ class KosModel {
|
|
|
11268
11279
|
{}
|
|
11269
11280
|
);
|
|
11270
11281
|
if (loadedContext) {
|
|
11271
|
-
log$
|
|
11282
|
+
log$A.info(
|
|
11272
11283
|
`Setting loaded context for ${modelId}, type: ${modelTypeName}`
|
|
11273
11284
|
);
|
|
11274
11285
|
context?.set(MODEL_LOADER_TYPE, loadedContext);
|
|
@@ -11280,7 +11291,7 @@ class KosModel {
|
|
|
11280
11291
|
kosAction(() => {
|
|
11281
11292
|
this.loaded = true;
|
|
11282
11293
|
});
|
|
11283
|
-
log$
|
|
11294
|
+
log$A.debug(
|
|
11284
11295
|
`Model ${modelTypeName} with id ${modelId} successfully loaded`
|
|
11285
11296
|
);
|
|
11286
11297
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.LOAD);
|
|
@@ -11289,14 +11300,14 @@ class KosModel {
|
|
|
11289
11300
|
this.effectManager?.setup();
|
|
11290
11301
|
this.createLifecycleCompanions(DependencyLifecycle.LOAD);
|
|
11291
11302
|
} catch (e) {
|
|
11292
|
-
log$
|
|
11303
|
+
log$A.error(`Model ${modelId} failed to load`, e);
|
|
11293
11304
|
throw e;
|
|
11294
11305
|
} finally {
|
|
11295
11306
|
this._isLoadExecuting = false;
|
|
11296
11307
|
}
|
|
11297
11308
|
}
|
|
11298
11309
|
async unload() {
|
|
11299
|
-
log$
|
|
11310
|
+
log$A.debug(`unloading model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11300
11311
|
try {
|
|
11301
11312
|
const childrenUnload = this.getChildren().map((child) => child.unload?.()).filter((p) => !!p);
|
|
11302
11313
|
await Promise.allSettled(childrenUnload);
|
|
@@ -11315,12 +11326,12 @@ class KosModel {
|
|
|
11315
11326
|
modelData.stateHistory = [];
|
|
11316
11327
|
}
|
|
11317
11328
|
}
|
|
11318
|
-
log$
|
|
11329
|
+
log$A.debug(`Model ${this.modelTypeName} with id ${this.modelId} unloaded`);
|
|
11319
11330
|
this.effectManager?.disposeAll();
|
|
11320
11331
|
this.subscriptionManager?.disposeAll();
|
|
11321
11332
|
this.httpRouteManager?.dispose();
|
|
11322
11333
|
} catch (e) {
|
|
11323
|
-
log$
|
|
11334
|
+
log$A.debug(`Model ${this.modelId} failed to unload`);
|
|
11324
11335
|
throw e;
|
|
11325
11336
|
}
|
|
11326
11337
|
}
|
|
@@ -11331,7 +11342,7 @@ class KosModel {
|
|
|
11331
11342
|
}
|
|
11332
11343
|
const { modelId, modelTypeName } = this;
|
|
11333
11344
|
const context = KosContextManager.getContext(modelId);
|
|
11334
|
-
log$
|
|
11345
|
+
log$A.debug(`Initializing model ${modelTypeName} with id ${modelId}`);
|
|
11335
11346
|
await executeDependentModelLifecycle(this, DependencyLifecycle.INIT);
|
|
11336
11347
|
try {
|
|
11337
11348
|
await this.serviceRequestManager?.executeForLifecycle(
|
|
@@ -11339,18 +11350,18 @@ class KosModel {
|
|
|
11339
11350
|
);
|
|
11340
11351
|
await this.modelData?.init?.(context);
|
|
11341
11352
|
this.initialized = true;
|
|
11342
|
-
log$
|
|
11353
|
+
log$A.debug(`Model ${modelTypeName} with id ${modelId} initialized`);
|
|
11343
11354
|
this.onlineLifecycleManager?.register();
|
|
11344
11355
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.INIT);
|
|
11345
11356
|
this.registerSubscribers(DependencyLifecycle.INIT);
|
|
11346
11357
|
this.createLifecycleCompanions(DependencyLifecycle.INIT);
|
|
11347
11358
|
} catch (e) {
|
|
11348
|
-
log$
|
|
11359
|
+
log$A.error(`Model ${modelId} failed to initialize`, e);
|
|
11349
11360
|
throw e;
|
|
11350
11361
|
}
|
|
11351
11362
|
}
|
|
11352
11363
|
async registerSubscribers(lifecycle) {
|
|
11353
|
-
log$
|
|
11364
|
+
log$A.debug(
|
|
11354
11365
|
`registering subscribers in ${this.modelTypeName} with id ${this.modelId}`
|
|
11355
11366
|
);
|
|
11356
11367
|
this.subscriptionManager?.registerAll(lifecycle);
|
|
@@ -11374,14 +11385,14 @@ class KosModel {
|
|
|
11374
11385
|
this.modelManager.createLifecycleCompanions(this, {}, lifecycle);
|
|
11375
11386
|
}
|
|
11376
11387
|
async online() {
|
|
11377
|
-
log$
|
|
11388
|
+
log$A.debug(`online model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11378
11389
|
this.registerSubscribers();
|
|
11379
11390
|
const context = KosContextManager.getContext(this.modelId);
|
|
11380
11391
|
await this.modelData?.online?.(context);
|
|
11381
11392
|
this.createLifecycleCompanions(DependencyLifecycle.ONLINE);
|
|
11382
11393
|
}
|
|
11383
11394
|
async offline() {
|
|
11384
|
-
log$
|
|
11395
|
+
log$A.debug(`offline model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11385
11396
|
this.subscriptionManager?.disposeAll();
|
|
11386
11397
|
const context = KosContextManager.getContext(this.modelId);
|
|
11387
11398
|
await this.modelData?.offline?.(context);
|
|
@@ -11399,7 +11410,7 @@ class KosModel {
|
|
|
11399
11410
|
this.companionManager.clear();
|
|
11400
11411
|
}
|
|
11401
11412
|
}
|
|
11402
|
-
const log$
|
|
11413
|
+
const log$z = KosLog.createLogger({ name: "kos-model-instantiator" });
|
|
11403
11414
|
class KosModelInstantiator {
|
|
11404
11415
|
constructor(registry, cache2) {
|
|
11405
11416
|
this.registry = registry;
|
|
@@ -11417,7 +11428,7 @@ class KosModelInstantiator {
|
|
|
11417
11428
|
const modelRegistry = this.registry.models[typeId];
|
|
11418
11429
|
if (!modelRegistry) {
|
|
11419
11430
|
const errorMessage = `No model registered for type ${typeId}`;
|
|
11420
|
-
log$
|
|
11431
|
+
log$z.error(errorMessage, {
|
|
11421
11432
|
modelType: typeId,
|
|
11422
11433
|
requestedId: id,
|
|
11423
11434
|
providedOptions: options,
|
|
@@ -11436,7 +11447,7 @@ class KosModelInstantiator {
|
|
|
11436
11447
|
const modelId = modelRegistry.singleton ? typeId : id;
|
|
11437
11448
|
this.cache.restoreFromDeleteCache(modelId);
|
|
11438
11449
|
if (!this.cache.hasModel(modelId)) {
|
|
11439
|
-
log$
|
|
11450
|
+
log$z.debug(`Creating model instance: ${typeId} [${modelId}]`);
|
|
11440
11451
|
const hasOptions = options && Object.keys(options).length > 0;
|
|
11441
11452
|
const modelClass = modelRegistry.class || modelRegistry.create;
|
|
11442
11453
|
const requiresOptions = modelClass?.prototype?.[OptionsRequired] === true;
|
|
@@ -11482,7 +11493,7 @@ class KosModelInstantiator {
|
|
|
11482
11493
|
}
|
|
11483
11494
|
const activeModel = this.cache.getModelById(modelId);
|
|
11484
11495
|
if (!activeModel) {
|
|
11485
|
-
log$
|
|
11496
|
+
log$z.error(`Model ${typeId} [${modelId}] not found in cache`);
|
|
11486
11497
|
throw new Error(`Model ${typeId} [${modelId}] not found in cache`);
|
|
11487
11498
|
}
|
|
11488
11499
|
return { model: activeModel, data: activeModel.modelData };
|
|
@@ -11548,7 +11559,7 @@ let KosModelRegistry$1 = class KosModelRegistry {
|
|
|
11548
11559
|
}
|
|
11549
11560
|
};
|
|
11550
11561
|
const MODEL_DELETION_DELAY = 10;
|
|
11551
|
-
const log$
|
|
11562
|
+
const log$y = KosLog.createLogger({ name: "kos-model-manager" });
|
|
11552
11563
|
class KosModelManager {
|
|
11553
11564
|
cache;
|
|
11554
11565
|
instantiator;
|
|
@@ -11591,7 +11602,7 @@ class KosModelManager {
|
|
|
11591
11602
|
}
|
|
11592
11603
|
static getInstance(reset2) {
|
|
11593
11604
|
if (!globalThis.kos?.modelManager || reset2) {
|
|
11594
|
-
log$
|
|
11605
|
+
log$y.debug("Creating new instance of KosModelManager");
|
|
11595
11606
|
new this();
|
|
11596
11607
|
}
|
|
11597
11608
|
return globalThis.kos?.modelManager;
|
|
@@ -11613,7 +11624,7 @@ class KosModelManager {
|
|
|
11613
11624
|
*/
|
|
11614
11625
|
get preloadedModels() {
|
|
11615
11626
|
return this.cache.preload((modelKey) => {
|
|
11616
|
-
log$
|
|
11627
|
+
log$y.debug(`preloading ${modelKey}`);
|
|
11617
11628
|
if (typeof modelKey === "string") {
|
|
11618
11629
|
return this.createModelInstance(modelKey).model;
|
|
11619
11630
|
} else {
|
|
@@ -11903,7 +11914,7 @@ const reportFailure = async (step, run2) => {
|
|
|
11903
11914
|
return await run2();
|
|
11904
11915
|
} catch (error) {
|
|
11905
11916
|
const detail = error instanceof Error ? error.stack ?? `${error.name}: ${error.message}` : String(error);
|
|
11906
|
-
log$
|
|
11917
|
+
log$S.error(`KOS Core lifecycle step "${step}" failed. ${detail}`);
|
|
11907
11918
|
throw error;
|
|
11908
11919
|
}
|
|
11909
11920
|
};
|
|
@@ -11942,7 +11953,7 @@ const coreFsm = (core) => {
|
|
|
11942
11953
|
});
|
|
11943
11954
|
const online = robot3.interpret(
|
|
11944
11955
|
onlineMachine2,
|
|
11945
|
-
(_service) => log$
|
|
11956
|
+
(_service) => log$S.debug(_service.machine.current)
|
|
11946
11957
|
);
|
|
11947
11958
|
const failed = robot3.transition(
|
|
11948
11959
|
`error`,
|
|
@@ -12090,11 +12101,11 @@ const coreFsm = (core) => {
|
|
|
12090
12101
|
});
|
|
12091
12102
|
const service2 = robot3.interpret(
|
|
12092
12103
|
machine2,
|
|
12093
|
-
(_service) => log$
|
|
12104
|
+
(_service) => log$S.debug(_service.machine.current)
|
|
12094
12105
|
);
|
|
12095
12106
|
return { service: service2, online };
|
|
12096
12107
|
};
|
|
12097
|
-
const log$
|
|
12108
|
+
const log$x = KosLog.createLogger({ name: "kos-core" });
|
|
12098
12109
|
const getConnectionAlias = () => {
|
|
12099
12110
|
const params2 = getQueryParams();
|
|
12100
12111
|
const alias = params2?.alias;
|
|
@@ -12208,7 +12219,7 @@ class KosCore {
|
|
|
12208
12219
|
try {
|
|
12209
12220
|
await model.offline?.();
|
|
12210
12221
|
} catch (e) {
|
|
12211
|
-
log$
|
|
12222
|
+
log$x.error(`model ${model.modelId} offline() threw:`, e);
|
|
12212
12223
|
}
|
|
12213
12224
|
model.onlineLifecycleManager?.dispose();
|
|
12214
12225
|
})
|
|
@@ -12223,7 +12234,7 @@ class KosCore {
|
|
|
12223
12234
|
try {
|
|
12224
12235
|
await model.online?.();
|
|
12225
12236
|
} catch (e) {
|
|
12226
|
-
log$
|
|
12237
|
+
log$x.error(`model ${model.modelId} online() threw:`, e);
|
|
12227
12238
|
}
|
|
12228
12239
|
})
|
|
12229
12240
|
);
|
|
@@ -12239,11 +12250,11 @@ class KosCore {
|
|
|
12239
12250
|
this.transport.authorized = false;
|
|
12240
12251
|
});
|
|
12241
12252
|
subscribe(WebSocketEvents.RELOAD, () => {
|
|
12242
|
-
log$
|
|
12253
|
+
log$x.warn("WebSocket requested reload");
|
|
12243
12254
|
this.fsmService.service.send(KosCoreEvents.RELOAD);
|
|
12244
12255
|
});
|
|
12245
12256
|
subscribe("/studio/project/reload", () => {
|
|
12246
|
-
log$
|
|
12257
|
+
log$x.warn("Project requested reload");
|
|
12247
12258
|
this.fsmService.service.send(KosCoreEvents.RELOAD);
|
|
12248
12259
|
});
|
|
12249
12260
|
const ws = WebSocketTransport.getInstance();
|
|
@@ -12282,33 +12293,33 @@ class KosCore {
|
|
|
12282
12293
|
async reload() {
|
|
12283
12294
|
const currentTime = Date.now();
|
|
12284
12295
|
if (this._reloading) {
|
|
12285
|
-
log$
|
|
12296
|
+
log$x.info("reload already in progress");
|
|
12286
12297
|
return;
|
|
12287
12298
|
}
|
|
12288
12299
|
this._reloading = true;
|
|
12289
|
-
log$
|
|
12290
|
-
log$
|
|
12300
|
+
log$x.warn("reloading KOS Core");
|
|
12301
|
+
log$x.warn("reloading preloaded models");
|
|
12291
12302
|
const modelManager = this.modelManager;
|
|
12292
12303
|
for (const model of modelManager.preloadedModels) {
|
|
12293
12304
|
if (isReloadable(model.modelData)) {
|
|
12294
12305
|
if (isSelfManagedReload(model.modelData)) {
|
|
12295
|
-
log$
|
|
12306
|
+
log$x.info(`skipping self-managed model ${model.modelId}`);
|
|
12296
12307
|
continue;
|
|
12297
12308
|
}
|
|
12298
|
-
log$
|
|
12309
|
+
log$x.info(`reloading model ${model.modelId}`);
|
|
12299
12310
|
model.unload?.();
|
|
12300
12311
|
await model.modelData.reload();
|
|
12301
12312
|
model.registerSubscribers?.();
|
|
12302
|
-
log$
|
|
12313
|
+
log$x.info(`reloading model ${model.modelId} complete`);
|
|
12303
12314
|
}
|
|
12304
12315
|
}
|
|
12305
12316
|
for (const model of modelManager.models) {
|
|
12306
12317
|
if (!modelManager.preloadedModels.includes(model) && isReloadable(model.modelData)) {
|
|
12307
12318
|
if (isSelfManagedReload(model.modelData)) {
|
|
12308
|
-
log$
|
|
12319
|
+
log$x.info(`skipping self-managed model ${model.modelId}`);
|
|
12309
12320
|
continue;
|
|
12310
12321
|
}
|
|
12311
|
-
log$
|
|
12322
|
+
log$x.warn(`reloading model ${model.modelId}`);
|
|
12312
12323
|
model.unload?.();
|
|
12313
12324
|
await model.modelData.reload();
|
|
12314
12325
|
model.registerSubscribers?.();
|
|
@@ -12317,27 +12328,27 @@ class KosCore {
|
|
|
12317
12328
|
const elapsed = Date.now() - currentTime;
|
|
12318
12329
|
setTimeout(() => {
|
|
12319
12330
|
mobx.runInAction(() => {
|
|
12320
|
-
log$
|
|
12331
|
+
log$x.warn("reloading KOS Core complete");
|
|
12321
12332
|
this._reloading = false;
|
|
12322
12333
|
});
|
|
12323
12334
|
}, 1e3 - elapsed);
|
|
12324
12335
|
}
|
|
12325
12336
|
async online() {
|
|
12326
|
-
log$
|
|
12337
|
+
log$x.debug("KOS Core going online");
|
|
12327
12338
|
await this._transport.whenReady();
|
|
12328
|
-
log$
|
|
12339
|
+
log$x.debug("KOS Transport Ready. Calling online() for models");
|
|
12329
12340
|
publish("/kosCore/online", "/kosCore/online");
|
|
12330
12341
|
console.timeEnd("kosCore:startup");
|
|
12331
12342
|
}
|
|
12332
12343
|
async offline() {
|
|
12333
|
-
log$
|
|
12344
|
+
log$x.debug("KOS Core going offline");
|
|
12334
12345
|
publish("/kosCore/offline", "/kosCore/offline");
|
|
12335
12346
|
}
|
|
12336
12347
|
async unload() {
|
|
12337
|
-
log$
|
|
12348
|
+
log$x.debug("Unloading KOS Core");
|
|
12338
12349
|
const currentTime = Date.now();
|
|
12339
12350
|
this._unloading = true;
|
|
12340
|
-
log$
|
|
12351
|
+
log$x.debug("unloading KOS Core");
|
|
12341
12352
|
const modelManager = this.modelManager;
|
|
12342
12353
|
for (const model of modelManager.models) {
|
|
12343
12354
|
if (isUnloadable(model.modelData)) {
|
|
@@ -12355,9 +12366,9 @@ class KosCore {
|
|
|
12355
12366
|
await mobx.when(() => this.status === KosCoreState.READY);
|
|
12356
12367
|
}
|
|
12357
12368
|
async ready() {
|
|
12358
|
-
log$
|
|
12369
|
+
log$x.debug("Readying KOS Core");
|
|
12359
12370
|
await this._transport.whenReady();
|
|
12360
|
-
log$
|
|
12371
|
+
log$x.debug("KOS Transport ready. Preloading models");
|
|
12361
12372
|
if (!this.modelManager) {
|
|
12362
12373
|
throw new Error(
|
|
12363
12374
|
"KOS Core reached ready() with no model manager. Its lifecycle was started without a registry."
|
|
@@ -12370,7 +12381,7 @@ class KosCore {
|
|
|
12370
12381
|
promise: model.whenReady()
|
|
12371
12382
|
};
|
|
12372
12383
|
});
|
|
12373
|
-
log$
|
|
12384
|
+
log$x.debug(`Preloaded ${promises.length} models`);
|
|
12374
12385
|
const settled = await Promise.allSettled(
|
|
12375
12386
|
promises.map((promise) => {
|
|
12376
12387
|
const { promise: timeoutPromise, cancel: timeoutCancel } = rejectAfterDelay(5e3, promise.model);
|
|
@@ -12384,14 +12395,14 @@ class KosCore {
|
|
|
12384
12395
|
);
|
|
12385
12396
|
const failed = settled.filter((p) => p.status === "rejected");
|
|
12386
12397
|
if (failed.length) {
|
|
12387
|
-
log$
|
|
12398
|
+
log$x.error(
|
|
12388
12399
|
`There were ${failed.length} failed models on model preloading`
|
|
12389
12400
|
);
|
|
12390
12401
|
throw Error(
|
|
12391
12402
|
`There were ${failed.length} failed models on model preloading`
|
|
12392
12403
|
);
|
|
12393
12404
|
}
|
|
12394
|
-
log$
|
|
12405
|
+
log$x.debug(`leaving kos-core ready() `);
|
|
12395
12406
|
}
|
|
12396
12407
|
get isReady() {
|
|
12397
12408
|
return this.status === KosCoreState.READY;
|
|
@@ -12409,19 +12420,19 @@ class KosCore {
|
|
|
12409
12420
|
return this.loaded;
|
|
12410
12421
|
}
|
|
12411
12422
|
async init() {
|
|
12412
|
-
log$
|
|
12423
|
+
log$x.debug("entering kos-core init()");
|
|
12413
12424
|
console.time("kosCore:startup");
|
|
12414
12425
|
console.time("kosCore:init");
|
|
12415
12426
|
await this._transport.whenReady();
|
|
12416
12427
|
this.initialized = true;
|
|
12417
|
-
log$
|
|
12428
|
+
log$x.debug("initialized - leaving kos-core init()");
|
|
12418
12429
|
console.timeEnd("kosCore:init");
|
|
12419
12430
|
}
|
|
12420
12431
|
async load() {
|
|
12421
|
-
log$
|
|
12432
|
+
log$x.debug("entering kos-core load()");
|
|
12422
12433
|
console.time("kosCore:load");
|
|
12423
12434
|
this.loaded = true;
|
|
12424
|
-
log$
|
|
12435
|
+
log$x.debug("loaded - leaving kos-core load()");
|
|
12425
12436
|
console.timeEnd("kosCore:load");
|
|
12426
12437
|
}
|
|
12427
12438
|
static create(registry, reset2, connectionAlias) {
|
|
@@ -12501,7 +12512,7 @@ class KosCore {
|
|
|
12501
12512
|
return this._instance;
|
|
12502
12513
|
}
|
|
12503
12514
|
}
|
|
12504
|
-
const log$
|
|
12515
|
+
const log$w = KosLog.createLogger({
|
|
12505
12516
|
name: "kos-model-visitor",
|
|
12506
12517
|
group: "kos-ui-core"
|
|
12507
12518
|
});
|
|
@@ -12542,7 +12553,7 @@ class KosModelVisitor {
|
|
|
12542
12553
|
*/
|
|
12543
12554
|
visit(model) {
|
|
12544
12555
|
if (this.visitedModels.has(model.modelId)) {
|
|
12545
|
-
log$
|
|
12556
|
+
log$w.info(`model ${model.modelId} already visited`);
|
|
12546
12557
|
return;
|
|
12547
12558
|
}
|
|
12548
12559
|
const stopVisiting = !!this.visitModel(model.modelData, this);
|
|
@@ -13035,7 +13046,7 @@ async function retryWithExponentialBackoff(operation, options) {
|
|
|
13035
13046
|
}
|
|
13036
13047
|
throw new Error("All attempts failed");
|
|
13037
13048
|
}
|
|
13038
|
-
const log$
|
|
13049
|
+
const log$v = KosLog.createLogger({ name: "kos-service-request" });
|
|
13039
13050
|
const resolveServiceUrl = (_service) => {
|
|
13040
13051
|
const MOCK = false;
|
|
13041
13052
|
const URL2 = exports.BASE_URL;
|
|
@@ -13207,7 +13218,7 @@ const getOne$7 = (destinationAddress2, url, _fetch) => async ({
|
|
|
13207
13218
|
destinationAddress: destinationAddressOverride
|
|
13208
13219
|
});
|
|
13209
13220
|
const resolvedUrl = urlOverride || url;
|
|
13210
|
-
log$
|
|
13221
|
+
log$v.debug(`resolvedUrl: ${resolvedUrl}`);
|
|
13211
13222
|
try {
|
|
13212
13223
|
const response = await _fetch(resolvedUrl, options);
|
|
13213
13224
|
if (!response.ok) {
|
|
@@ -13581,7 +13592,7 @@ const getKosSessionKey = () => `kos-${_sessionKey}`;
|
|
|
13581
13592
|
const isLocalRefId = (id) => !!id && !id.includes("VM_SERVICE") && id.startsWith(getKosSessionKey());
|
|
13582
13593
|
const waitForRequest = async (requestId, timeout = 6e4) => new Promise((resolve, reject) => {
|
|
13583
13594
|
const { unsubscribe } = subscribe(requestId, (op) => {
|
|
13584
|
-
log$
|
|
13595
|
+
log$S.debug(`recieved response for refId ${requestId}: ${op}`);
|
|
13585
13596
|
unsubscribe();
|
|
13586
13597
|
clearTimeout(cancel);
|
|
13587
13598
|
try {
|
|
@@ -13856,7 +13867,7 @@ function collectRecords(items) {
|
|
|
13856
13867
|
}
|
|
13857
13868
|
return result;
|
|
13858
13869
|
}
|
|
13859
|
-
const log$
|
|
13870
|
+
const log$u = KosLog.createLogger({ name: "kos-data-container" });
|
|
13860
13871
|
class KosDataContainer {
|
|
13861
13872
|
_data;
|
|
13862
13873
|
_sortKey;
|
|
@@ -14061,7 +14072,7 @@ class KosDataContainer {
|
|
|
14061
14072
|
const idx = this.index.get(indexName);
|
|
14062
14073
|
return idx.keys ?? [];
|
|
14063
14074
|
} else {
|
|
14064
|
-
log$
|
|
14075
|
+
log$u.info(
|
|
14065
14076
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
14066
14077
|
);
|
|
14067
14078
|
return [];
|
|
@@ -14073,7 +14084,7 @@ class KosDataContainer {
|
|
|
14073
14084
|
if (idx.index.has(indexKey)) {
|
|
14074
14085
|
return idx.getByKey(indexKey);
|
|
14075
14086
|
} else {
|
|
14076
|
-
log$
|
|
14087
|
+
log$u.info(
|
|
14077
14088
|
`key ${indexKey} not found in ${indexName} index: ${Array.from(
|
|
14078
14089
|
idx.index.keys()
|
|
14079
14090
|
)}`
|
|
@@ -14081,7 +14092,7 @@ class KosDataContainer {
|
|
|
14081
14092
|
return [];
|
|
14082
14093
|
}
|
|
14083
14094
|
} else {
|
|
14084
|
-
log$
|
|
14095
|
+
log$u.info(
|
|
14085
14096
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
14086
14097
|
);
|
|
14087
14098
|
return [];
|
|
@@ -14108,7 +14119,7 @@ class KosDataContainer {
|
|
|
14108
14119
|
* @private
|
|
14109
14120
|
*/
|
|
14110
14121
|
_logDataCapacityWarning(toEvict) {
|
|
14111
|
-
log$
|
|
14122
|
+
log$u.info(
|
|
14112
14123
|
`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.`
|
|
14113
14124
|
);
|
|
14114
14125
|
}
|
|
@@ -14168,7 +14179,7 @@ class KosDataContainer {
|
|
|
14168
14179
|
const candidates = this._customEvictionFilter(this.data);
|
|
14169
14180
|
return candidates.slice(0, count).map((item) => item.id);
|
|
14170
14181
|
}
|
|
14171
|
-
log$
|
|
14182
|
+
log$u.error(
|
|
14172
14183
|
"Custom eviction strategy specified but no customEvictionFilter provided. Falling back to FIFO."
|
|
14173
14184
|
);
|
|
14174
14185
|
return this._selectFifoData(count);
|
|
@@ -14180,7 +14191,7 @@ class KosDataContainer {
|
|
|
14180
14191
|
_removeEvictedData(ids) {
|
|
14181
14192
|
ids.forEach((id) => {
|
|
14182
14193
|
const item = this._data.get(id);
|
|
14183
|
-
log$
|
|
14194
|
+
log$u.info(`Evicting data item: ${id}`, {
|
|
14184
14195
|
itemId: id,
|
|
14185
14196
|
itemType: item ? item.constructor?.name : "unknown",
|
|
14186
14197
|
strategy: this._evictionStrategy
|
|
@@ -14193,7 +14204,7 @@ class KosDataContainer {
|
|
|
14193
14204
|
* @private
|
|
14194
14205
|
*/
|
|
14195
14206
|
_logDataEvictionComplete(evictedCount) {
|
|
14196
|
-
log$
|
|
14207
|
+
log$u.info(
|
|
14197
14208
|
`Evicted ${evictedCount} data items. Current size: ${this._data.size}/${this._maxCapacity}`
|
|
14198
14209
|
);
|
|
14199
14210
|
}
|
|
@@ -14432,14 +14443,14 @@ class BrowserKosRouter {
|
|
|
14432
14443
|
}, {});
|
|
14433
14444
|
}
|
|
14434
14445
|
}
|
|
14435
|
-
const log$
|
|
14446
|
+
const log$t = KosLog.createLogger({ name: "intent-service" });
|
|
14436
14447
|
const sendIntent = (intent) => {
|
|
14437
14448
|
if (hasEventSubscriptions(`/kos/intent/${intent.type}`)) {
|
|
14438
14449
|
publish(`/kos/intent/${intent.type}`, intent.options, {
|
|
14439
14450
|
"kos.intent.type": intent.type
|
|
14440
14451
|
});
|
|
14441
14452
|
} else {
|
|
14442
|
-
log$
|
|
14453
|
+
log$t.info(`No subscribers for intent ${intent.type}. Intent not sent.`);
|
|
14443
14454
|
}
|
|
14444
14455
|
};
|
|
14445
14456
|
const sendAsyncIntent = async (intent) => new Promise((resolve) => {
|
|
@@ -14469,11 +14480,11 @@ const sendAsyncIntent = async (intent) => new Promise((resolve) => {
|
|
|
14469
14480
|
sync: requestId
|
|
14470
14481
|
});
|
|
14471
14482
|
} else {
|
|
14472
|
-
log$
|
|
14483
|
+
log$t.info(`No subscribers for intent ${intent.type}. Intent not sent.`);
|
|
14473
14484
|
resolve([null, { body: void 0, payload: void 0 }]);
|
|
14474
14485
|
}
|
|
14475
14486
|
});
|
|
14476
|
-
const log$
|
|
14487
|
+
const log$s = KosLog.createLogger({ name: "app-startup-service" });
|
|
14477
14488
|
async function waitForAppsToStart(appIds, options = {}) {
|
|
14478
14489
|
const {
|
|
14479
14490
|
timeout = 3e4,
|
|
@@ -14481,10 +14492,10 @@ async function waitForAppsToStart(appIds, options = {}) {
|
|
|
14481
14492
|
requirePostStarted = false
|
|
14482
14493
|
} = options;
|
|
14483
14494
|
if (appIds.length === 0) {
|
|
14484
|
-
log$
|
|
14495
|
+
log$s.warn("No app IDs provided to waitForAppsToStart");
|
|
14485
14496
|
return true;
|
|
14486
14497
|
}
|
|
14487
|
-
log$
|
|
14498
|
+
log$s.debug(`Waiting for apps to start: ${appIds.join(", ")}`);
|
|
14488
14499
|
try {
|
|
14489
14500
|
const eventTopics = appIds.map((appId) => `/kos/app/started/${appId}`);
|
|
14490
14501
|
const startedApps = await waitForAllWithState(eventTopics, {
|
|
@@ -14493,12 +14504,12 @@ async function waitForAppsToStart(appIds, options = {}) {
|
|
|
14493
14504
|
const { default: api2 } = await Promise.resolve().then(() => service$8);
|
|
14494
14505
|
const [error, data] = await api2.get("/api/kos/apps/started");
|
|
14495
14506
|
if (error) {
|
|
14496
|
-
log$
|
|
14507
|
+
log$s.error("Error fetching started apps:", error);
|
|
14497
14508
|
return [];
|
|
14498
14509
|
}
|
|
14499
14510
|
return data;
|
|
14500
14511
|
} catch (error) {
|
|
14501
|
-
log$
|
|
14512
|
+
log$s.error("Failed to fetch app startup status:", error);
|
|
14502
14513
|
}
|
|
14503
14514
|
return [];
|
|
14504
14515
|
},
|
|
@@ -14520,17 +14531,17 @@ async function waitForAppsToStart(appIds, options = {}) {
|
|
|
14520
14531
|
});
|
|
14521
14532
|
if (notStartedApps.length > 0) {
|
|
14522
14533
|
const message2 = `Apps not started: ${notStartedApps.join(", ")}`;
|
|
14523
|
-
log$
|
|
14534
|
+
log$s.error(message2);
|
|
14524
14535
|
if (throwOnTimeout) {
|
|
14525
14536
|
throw new Error(`App startup timeout: ${message2}`);
|
|
14526
14537
|
}
|
|
14527
14538
|
return false;
|
|
14528
14539
|
}
|
|
14529
|
-
log$
|
|
14540
|
+
log$s.info(`All apps started successfully: ${appIds.join(", ")}`);
|
|
14530
14541
|
return true;
|
|
14531
14542
|
} catch (error) {
|
|
14532
14543
|
const message2 = `Failed to wait for apps to start: ${appIds.join(", ")}`;
|
|
14533
|
-
log$
|
|
14544
|
+
log$s.error(message2, error);
|
|
14534
14545
|
if (throwOnTimeout) {
|
|
14535
14546
|
throw new Error(
|
|
14536
14547
|
`${message2} - ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -14557,7 +14568,7 @@ async function checkAppsStarted(appIds, requirePostStarted = false) {
|
|
|
14557
14568
|
result[appId] = app?.started === true && (!requirePostStarted || app?.postStarted === true);
|
|
14558
14569
|
});
|
|
14559
14570
|
} catch (error) {
|
|
14560
|
-
log$
|
|
14571
|
+
log$s.error("Failed to check app startup status:", error);
|
|
14561
14572
|
appIds.forEach((appId) => result[appId] = false);
|
|
14562
14573
|
}
|
|
14563
14574
|
return result;
|
|
@@ -14571,7 +14582,7 @@ async function getStartedApps() {
|
|
|
14571
14582
|
const result = await response.json();
|
|
14572
14583
|
return result?.data ?? [];
|
|
14573
14584
|
} catch (error) {
|
|
14574
|
-
log$
|
|
14585
|
+
log$s.error("Failed to fetch started apps:", error);
|
|
14575
14586
|
return [];
|
|
14576
14587
|
}
|
|
14577
14588
|
}
|
|
@@ -14598,7 +14609,7 @@ var Topics = /* @__PURE__ */ ((Topics2) => {
|
|
|
14598
14609
|
Topics2["TIMEZONE_CHANGE"] = "/kos/internal/time/timezone";
|
|
14599
14610
|
return Topics2;
|
|
14600
14611
|
})(Topics || {});
|
|
14601
|
-
const log$
|
|
14612
|
+
const log$r = KosLog.createLogger({
|
|
14602
14613
|
name: "config-bean-service",
|
|
14603
14614
|
group: "Services"
|
|
14604
14615
|
});
|
|
@@ -14609,7 +14620,7 @@ const { postModel: postModel$5, getOne: getOne$6 } = ServiceFactory.build({
|
|
|
14609
14620
|
basePath: `${URL$e}/kos/config/`
|
|
14610
14621
|
});
|
|
14611
14622
|
const modifyConfigBean = async (id, model, path = `/api/kos/config`) => {
|
|
14612
|
-
log$
|
|
14623
|
+
log$r.debug(`sending modify request for ConfigBean: ${id}`);
|
|
14613
14624
|
const response = postModel$5({
|
|
14614
14625
|
model,
|
|
14615
14626
|
urlOverride: `${URL$e}${path}/${id}`
|
|
@@ -14617,7 +14628,7 @@ const modifyConfigBean = async (id, model, path = `/api/kos/config`) => {
|
|
|
14617
14628
|
return response;
|
|
14618
14629
|
};
|
|
14619
14630
|
const getConfigBean = async (id, path = `/api/kos/config`) => {
|
|
14620
|
-
log$
|
|
14631
|
+
log$r.debug(`sending get request for ConfigBean: ${id}`);
|
|
14621
14632
|
const response = await getOne$6({
|
|
14622
14633
|
urlOverride: `${URL$e}${path}/details/${id}/15`
|
|
14623
14634
|
});
|
|
@@ -14729,7 +14740,7 @@ function matchValue(patterns, value) {
|
|
|
14729
14740
|
return void 0;
|
|
14730
14741
|
}
|
|
14731
14742
|
const CONFIG_BEAN_MODEL_TYPE = "config-bean-model";
|
|
14732
|
-
const log$
|
|
14743
|
+
const log$q = KosLog.getLogger(CONFIG_BEAN_MODEL_TYPE);
|
|
14733
14744
|
const PATH_PROP$3 = createPropKey("path");
|
|
14734
14745
|
function servicePathMapper$1(configBeanModel) {
|
|
14735
14746
|
const hasMapper = ExtensionManager.propertyMapper.hasMapper(
|
|
@@ -14802,8 +14813,8 @@ let ConfigBeanModelImpl = class {
|
|
|
14802
14813
|
* @internal
|
|
14803
14814
|
*/
|
|
14804
14815
|
async ready() {
|
|
14805
|
-
log$
|
|
14806
|
-
log$
|
|
14816
|
+
log$q.debug(`readying config bean ${this.path}`);
|
|
14817
|
+
log$q.debug(`complete readying config bean ${this.path}`);
|
|
14807
14818
|
}
|
|
14808
14819
|
/**
|
|
14809
14820
|
* @internal
|
|
@@ -14814,12 +14825,12 @@ let ConfigBeanModelImpl = class {
|
|
|
14814
14825
|
* In future additional information about the workspace could be loaded
|
|
14815
14826
|
*/
|
|
14816
14827
|
async load() {
|
|
14817
|
-
log$
|
|
14828
|
+
log$q.debug(`loading config bean ${this.path}`);
|
|
14818
14829
|
const response = await this._getConfigBean(this.path, this.serviceBasePath);
|
|
14819
14830
|
if (response?.data) {
|
|
14820
14831
|
const data = response.data;
|
|
14821
14832
|
mapDtoToConfigBeanModel(data, this);
|
|
14822
|
-
log$
|
|
14833
|
+
log$q.debug(this.values);
|
|
14823
14834
|
const schemaResponse = response?.data.details[0].schema;
|
|
14824
14835
|
kosAction(() => {
|
|
14825
14836
|
if (schemaResponse) {
|
|
@@ -15087,7 +15098,7 @@ var __decorateClass$z = (decorators, target, key, kind) => {
|
|
|
15087
15098
|
return result;
|
|
15088
15099
|
};
|
|
15089
15100
|
const MODEL_TYPE$w = "region-info-model";
|
|
15090
|
-
const log$
|
|
15101
|
+
const log$p = KosLog.createLogger({ name: "region-info-model" });
|
|
15091
15102
|
function servicePathMapper(regionInfoModel) {
|
|
15092
15103
|
const hasMapper = ExtensionManager.propertyMapper.hasMapper(
|
|
15093
15104
|
KosCoreModelPropertyMapper.RegionServicePath
|
|
@@ -15378,7 +15389,7 @@ let RegionInfoModelImpl = class {
|
|
|
15378
15389
|
}
|
|
15379
15390
|
toUnit = measureSystems[to.system]?.["default"];
|
|
15380
15391
|
if (!toUnit) {
|
|
15381
|
-
log$
|
|
15392
|
+
log$p.info("Could not find default unit for measure", to.measure);
|
|
15382
15393
|
}
|
|
15383
15394
|
}
|
|
15384
15395
|
if (!fromUnit && from.measure && from.system) {
|
|
@@ -15392,11 +15403,11 @@ let RegionInfoModelImpl = class {
|
|
|
15392
15403
|
}
|
|
15393
15404
|
fromUnit = measureSystems[from.system]?.["default"];
|
|
15394
15405
|
if (!fromUnit) {
|
|
15395
|
-
log$
|
|
15406
|
+
log$p.info("Could not find default unit for measure", from.measure);
|
|
15396
15407
|
}
|
|
15397
15408
|
}
|
|
15398
15409
|
if (!fromUnit || !toUnit) {
|
|
15399
|
-
log$
|
|
15410
|
+
log$p.warn("Could not find unit to convert to or from. Return value as is");
|
|
15400
15411
|
return String(value);
|
|
15401
15412
|
}
|
|
15402
15413
|
return this.convertByUnit(value, fromUnit, toUnit);
|
|
@@ -15406,13 +15417,13 @@ let RegionInfoModelImpl = class {
|
|
|
15406
15417
|
* @internal
|
|
15407
15418
|
*/
|
|
15408
15419
|
async init() {
|
|
15409
|
-
log$
|
|
15420
|
+
log$p.debug("initializing region info");
|
|
15410
15421
|
}
|
|
15411
15422
|
/**
|
|
15412
15423
|
* @internal
|
|
15413
15424
|
*/
|
|
15414
15425
|
async load() {
|
|
15415
|
-
log$
|
|
15426
|
+
log$p.debug("loading region info");
|
|
15416
15427
|
const regions = await getRegions(this.serviceBasePath);
|
|
15417
15428
|
if (regions) {
|
|
15418
15429
|
this.regions = regions.data.map((region) => region.id);
|
|
@@ -15732,7 +15743,7 @@ function secondsToFormattedTime(secondsSinceMidnight, formatString) {
|
|
|
15732
15743
|
return dateFns.format(time, formatString);
|
|
15733
15744
|
}
|
|
15734
15745
|
const MODEL_TYPE$v = "config-bean-prop-model";
|
|
15735
|
-
const log$
|
|
15746
|
+
const log$o = KosLog.createLogger({ name: "config-bean-prop-model" });
|
|
15736
15747
|
const PATH_PROP$2 = createPropKey("path");
|
|
15737
15748
|
const SERVICE_PATH_PROP = createPropKey("serviceBasePath");
|
|
15738
15749
|
let KosConfigPropertyImpl = class {
|
|
@@ -15928,7 +15939,7 @@ let KosConfigPropertyImpl = class {
|
|
|
15928
15939
|
return Number(result2);
|
|
15929
15940
|
}
|
|
15930
15941
|
} catch (e) {
|
|
15931
|
-
log$
|
|
15942
|
+
log$o.info(`error formatting value ${_val}`, e);
|
|
15932
15943
|
}
|
|
15933
15944
|
const result = Number(_val).toFixed(decimals);
|
|
15934
15945
|
return result;
|
|
@@ -15967,7 +15978,7 @@ let KosConfigPropertyImpl = class {
|
|
|
15967
15978
|
* @internal
|
|
15968
15979
|
*/
|
|
15969
15980
|
async activate() {
|
|
15970
|
-
log$
|
|
15981
|
+
log$o.debug(`activating config bean ${this.id}`);
|
|
15971
15982
|
}
|
|
15972
15983
|
/**
|
|
15973
15984
|
* Gets the formatted display string with units and localization.
|
|
@@ -16000,7 +16011,7 @@ let KosConfigPropertyImpl = class {
|
|
|
16000
16011
|
return result;
|
|
16001
16012
|
}
|
|
16002
16013
|
} catch (e) {
|
|
16003
|
-
log$
|
|
16014
|
+
log$o.error(`error formatting value ${_val}`, e);
|
|
16004
16015
|
}
|
|
16005
16016
|
}
|
|
16006
16017
|
return String(_val);
|
|
@@ -16098,13 +16109,13 @@ let KosConfigPropertyImpl = class {
|
|
|
16098
16109
|
try {
|
|
16099
16110
|
formatter2 = new Intl.NumberFormat(locale, { ...formatOptions });
|
|
16100
16111
|
} catch (e) {
|
|
16101
|
-
log$
|
|
16112
|
+
log$o.error(
|
|
16102
16113
|
`error creating formatter ${formatOptions}. Returning the raw value`,
|
|
16103
16114
|
e
|
|
16104
16115
|
);
|
|
16105
16116
|
}
|
|
16106
16117
|
} else {
|
|
16107
|
-
log$
|
|
16118
|
+
log$o.debug(
|
|
16108
16119
|
`no formatter found for config bean prop ${this.id}. Returning the raw value`
|
|
16109
16120
|
);
|
|
16110
16121
|
}
|
|
@@ -16173,7 +16184,7 @@ let KosConfigPropertyImpl = class {
|
|
|
16173
16184
|
* ```
|
|
16174
16185
|
*/
|
|
16175
16186
|
async updateProperty(value) {
|
|
16176
|
-
log$
|
|
16187
|
+
log$o.debug(`updating property ${this.attribute} with value ${value}`);
|
|
16177
16188
|
let _value = value;
|
|
16178
16189
|
const converter = this.getConverter();
|
|
16179
16190
|
if (converter && !isNaN(_value)) {
|
|
@@ -16290,7 +16301,7 @@ const buildFuture = (factory) => (future) => pipe(
|
|
|
16290
16301
|
mapDtoToFutureOptions,
|
|
16291
16302
|
buildFutureModel$1(factory)(future.tracker || future.id)
|
|
16292
16303
|
)(future);
|
|
16293
|
-
const log$
|
|
16304
|
+
const log$n = KosLog.createLogger({ name: "future-service", group: "Services" });
|
|
16294
16305
|
const { isMock, URL: URL$c } = resolveServiceUrl();
|
|
16295
16306
|
var FutureEndState = /* @__PURE__ */ ((FutureEndState2) => {
|
|
16296
16307
|
FutureEndState2["Success"] = "SUCCESS";
|
|
@@ -16309,7 +16320,7 @@ const getFutures = async () => {
|
|
|
16309
16320
|
return response;
|
|
16310
16321
|
};
|
|
16311
16322
|
const deleteFuture = async (id, path = "/api/kos/future") => {
|
|
16312
|
-
log$
|
|
16323
|
+
log$n.info(`sending delete request for Future: ${id}`);
|
|
16313
16324
|
const response = await deleteModel$1({
|
|
16314
16325
|
id,
|
|
16315
16326
|
urlOverride: `${URL$c}${path}/${id}`
|
|
@@ -16317,7 +16328,7 @@ const deleteFuture = async (id, path = "/api/kos/future") => {
|
|
|
16317
16328
|
return response;
|
|
16318
16329
|
};
|
|
16319
16330
|
const addFuture = async (future, path = "/api/kos/future") => {
|
|
16320
|
-
log$
|
|
16331
|
+
log$n.info(`sending add request for Future`);
|
|
16321
16332
|
const response = await addModel({
|
|
16322
16333
|
model: future,
|
|
16323
16334
|
urlOverride: `${URL$c}${path}`
|
|
@@ -16325,7 +16336,7 @@ const addFuture = async (future, path = "/api/kos/future") => {
|
|
|
16325
16336
|
return response;
|
|
16326
16337
|
};
|
|
16327
16338
|
const modifyFuture = async (id, model, path = "/api/kos/future") => {
|
|
16328
|
-
log$
|
|
16339
|
+
log$n.info(`sending modify request for Future: ${id}`);
|
|
16329
16340
|
const response = modifyModel({
|
|
16330
16341
|
model,
|
|
16331
16342
|
id,
|
|
@@ -16334,7 +16345,7 @@ const modifyFuture = async (id, model, path = "/api/kos/future") => {
|
|
|
16334
16345
|
return response;
|
|
16335
16346
|
};
|
|
16336
16347
|
const cancelFuture = async (id, path = "/api/kos/future") => {
|
|
16337
|
-
log$
|
|
16348
|
+
log$n.info(`sending cancel request for Future: ${id}`);
|
|
16338
16349
|
const response = postModel$4({
|
|
16339
16350
|
urlOverride: `${URL$c}${path}/${id}/cancel`,
|
|
16340
16351
|
ordered: true,
|
|
@@ -16517,12 +16528,12 @@ const { URL: URL$b } = resolveServiceUrl();
|
|
|
16517
16528
|
const { getOne: getOne$4 } = ServiceFactory.build({
|
|
16518
16529
|
basePath: `${URL$b}/api/kos/state`
|
|
16519
16530
|
});
|
|
16520
|
-
const log$
|
|
16531
|
+
const log$m = KosLog.createLogger({
|
|
16521
16532
|
name: "state-bean-service",
|
|
16522
16533
|
group: "Services"
|
|
16523
16534
|
});
|
|
16524
16535
|
const getStateBeanData = async ({ path }) => {
|
|
16525
|
-
log$
|
|
16536
|
+
log$m.debug("sending GET for state-bean");
|
|
16526
16537
|
const response = await getOne$4({
|
|
16527
16538
|
urlOverride: `${URL$b}/api/kos/state/${path}`
|
|
16528
16539
|
});
|
|
@@ -16715,12 +16726,12 @@ const { URL: URL$a } = resolveServiceUrl();
|
|
|
16715
16726
|
const { getAll: getAll$5 } = ServiceFactory.build({
|
|
16716
16727
|
basePath: `${URL$a}/api/state-prop`
|
|
16717
16728
|
});
|
|
16718
|
-
const log$
|
|
16729
|
+
const log$l = KosLog.createLogger({
|
|
16719
16730
|
name: "state-prop-service",
|
|
16720
16731
|
group: "Services"
|
|
16721
16732
|
});
|
|
16722
16733
|
const getStateProps = async () => {
|
|
16723
|
-
log$
|
|
16734
|
+
log$l.debug("sending GET for state-prop");
|
|
16724
16735
|
const response = await getAll$5({});
|
|
16725
16736
|
return response;
|
|
16726
16737
|
};
|
|
@@ -16880,7 +16891,7 @@ var __decorateClass$u = (decorators, target, key, kind) => {
|
|
|
16880
16891
|
if (kind && result) __defProp$p(target, key, result);
|
|
16881
16892
|
return result;
|
|
16882
16893
|
};
|
|
16883
|
-
const log$
|
|
16894
|
+
const log$k = KosLog.getLogger(FutureFactory.type);
|
|
16884
16895
|
let FutureModel$1 = class FutureModel {
|
|
16885
16896
|
logger;
|
|
16886
16897
|
_cancelFuture;
|
|
@@ -16904,7 +16915,7 @@ let FutureModel$1 = class FutureModel {
|
|
|
16904
16915
|
kosWhen(
|
|
16905
16916
|
() => this.status === FutureEndState.Success || this.status === FutureEndState.Fail,
|
|
16906
16917
|
() => {
|
|
16907
|
-
log$
|
|
16918
|
+
log$k.info(`Future ${this.id} has completed with status ${this.status}`);
|
|
16908
16919
|
destroyKosModel(this);
|
|
16909
16920
|
}
|
|
16910
16921
|
);
|
|
@@ -16918,13 +16929,13 @@ let FutureModel$1 = class FutureModel {
|
|
|
16918
16929
|
* In future additional information about the workspace could be loaded
|
|
16919
16930
|
*/
|
|
16920
16931
|
async load() {
|
|
16921
|
-
log$
|
|
16932
|
+
log$k.debug(`loading Future ${this.id}`);
|
|
16922
16933
|
}
|
|
16923
16934
|
/**
|
|
16924
16935
|
* @internal
|
|
16925
16936
|
*/
|
|
16926
16937
|
unload() {
|
|
16927
|
-
log$
|
|
16938
|
+
log$k.info(`unloading Future ${this.id}`);
|
|
16928
16939
|
}
|
|
16929
16940
|
// -------------------ACTIONS----------------------------
|
|
16930
16941
|
/**
|
|
@@ -16943,7 +16954,7 @@ let FutureModel$1 = class FutureModel {
|
|
|
16943
16954
|
await kosWhen(() => this.futureId !== FUTURE_NOT_ASSIGNED);
|
|
16944
16955
|
const response = await this._cancelFuture(this.futureId, path);
|
|
16945
16956
|
if (response?.status !== 200) {
|
|
16946
|
-
log$
|
|
16957
|
+
log$k.error(
|
|
16947
16958
|
`Failed to cancel Future ${this.id}. Response: ${JSON.stringify(
|
|
16948
16959
|
response
|
|
16949
16960
|
)}`
|
|
@@ -17032,7 +17043,7 @@ var __decorateClass$t = (decorators, target, key, kind) => {
|
|
|
17032
17043
|
if (kind && result) __defProp$o(target, key, result);
|
|
17033
17044
|
return result;
|
|
17034
17045
|
};
|
|
17035
|
-
const log$
|
|
17046
|
+
const log$j = KosLog.getLogger(FutureContainerFactory.type);
|
|
17036
17047
|
let FutureContainerModel$1 = class FutureContainerModel {
|
|
17037
17048
|
id;
|
|
17038
17049
|
logger;
|
|
@@ -17147,8 +17158,8 @@ let FutureContainerModel$1 = class FutureContainerModel {
|
|
|
17147
17158
|
try {
|
|
17148
17159
|
await this._deleteFuture(id);
|
|
17149
17160
|
} catch (e) {
|
|
17150
|
-
log$
|
|
17151
|
-
log$
|
|
17161
|
+
log$j.error(`error deleting a Future`);
|
|
17162
|
+
log$j.error(e);
|
|
17152
17163
|
}
|
|
17153
17164
|
}
|
|
17154
17165
|
/**
|
|
@@ -17175,8 +17186,8 @@ let FutureContainerModel$1 = class FutureContainerModel {
|
|
|
17175
17186
|
return model2;
|
|
17176
17187
|
}
|
|
17177
17188
|
} catch (e) {
|
|
17178
|
-
log$
|
|
17179
|
-
log$
|
|
17189
|
+
log$j.error(`error creating a Future`);
|
|
17190
|
+
log$j.error(e);
|
|
17180
17191
|
throw e;
|
|
17181
17192
|
}
|
|
17182
17193
|
return void 0;
|
|
@@ -17205,7 +17216,7 @@ const { URL: URL$9 } = resolveServiceUrl();
|
|
|
17205
17216
|
const { getOne: getOne$3, postModel: postModel$3, deleteModel } = ServiceFactory.build({
|
|
17206
17217
|
basePath: `${URL$9}/api/keyVal`
|
|
17207
17218
|
});
|
|
17208
|
-
const log$
|
|
17219
|
+
const log$i = KosLog.createLogger({
|
|
17209
17220
|
name: "key-value-service",
|
|
17210
17221
|
group: "Services"
|
|
17211
17222
|
});
|
|
@@ -17221,7 +17232,7 @@ const updateKeyValue = async (namespace, key, value) => {
|
|
|
17221
17232
|
model: value.toString()
|
|
17222
17233
|
});
|
|
17223
17234
|
if (response?.status !== 200) {
|
|
17224
|
-
log$
|
|
17235
|
+
log$i.error("Failed to update key-value data", response);
|
|
17225
17236
|
throw new Error(
|
|
17226
17237
|
`Failed to update key-value data for namespace ${namespace}`
|
|
17227
17238
|
);
|
|
@@ -17229,12 +17240,12 @@ const updateKeyValue = async (namespace, key, value) => {
|
|
|
17229
17240
|
return response.data;
|
|
17230
17241
|
};
|
|
17231
17242
|
const getKeyValue = async (namespace = "studio") => {
|
|
17232
|
-
log$
|
|
17243
|
+
log$i.debug(`Retrieving all key-value data for namespace: ${namespace}`);
|
|
17233
17244
|
const response = await getOne$3({
|
|
17234
17245
|
urlOverride: `${URL$9}/api/keyVal/${namespace}`
|
|
17235
17246
|
});
|
|
17236
17247
|
if (response?.status !== 200) {
|
|
17237
|
-
log$
|
|
17248
|
+
log$i.error("Failed to retrieve key-value data", response);
|
|
17238
17249
|
throw new Error(
|
|
17239
17250
|
`Failed to retrieve key-value data for namespace ${namespace}`
|
|
17240
17251
|
);
|
|
@@ -19305,13 +19316,13 @@ KosExpressionEvaluatorModelImpl = __decorateClass$r([
|
|
|
19305
19316
|
kosModel({ modelTypeId: MODEL_TYPE$q, singleton: false })
|
|
19306
19317
|
], KosExpressionEvaluatorModelImpl);
|
|
19307
19318
|
const KosExpressionEvaluator = KosExpressionEvaluatorModelImpl.Registration;
|
|
19308
|
-
const log$
|
|
19319
|
+
const log$h = KosLog.createLogger({
|
|
19309
19320
|
name: "kos-log-manager-service",
|
|
19310
19321
|
group: "Services"
|
|
19311
19322
|
});
|
|
19312
19323
|
const SERVICE_PATH$2 = "/api/kos/logs/overrides";
|
|
19313
19324
|
const getLogOverrides = async () => {
|
|
19314
|
-
log$
|
|
19325
|
+
log$h.debug("sending GET for kos-log-manager");
|
|
19315
19326
|
return await api$9.get(SERVICE_PATH$2);
|
|
19316
19327
|
};
|
|
19317
19328
|
const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -19720,7 +19731,7 @@ __decorateClass$o([
|
|
|
19720
19731
|
LogBlockContainerModelImpl = __decorateClass$o([
|
|
19721
19732
|
kosModel(MODEL_TYPE$n)
|
|
19722
19733
|
], LogBlockContainerModelImpl);
|
|
19723
|
-
const log$
|
|
19734
|
+
const log$g = KosLog.createLogger({
|
|
19724
19735
|
name: "log-stream-container-service",
|
|
19725
19736
|
group: "Services"
|
|
19726
19737
|
});
|
|
@@ -19734,7 +19745,7 @@ const getKosConnectionId$2 = () => {
|
|
|
19734
19745
|
const destinationAddress$3 = getKosConnectionId$2();
|
|
19735
19746
|
const SERVICE_PATH$1 = "/api/kos/logs/node/{nodeId}/streams";
|
|
19736
19747
|
const getLogStreams = async () => {
|
|
19737
|
-
log$
|
|
19748
|
+
log$g.debug("sending GET for log-stream-container");
|
|
19738
19749
|
return await api$9.get(
|
|
19739
19750
|
SERVICE_PATH$1,
|
|
19740
19751
|
{
|
|
@@ -20335,23 +20346,23 @@ const { URL: URL$7 } = resolveServiceUrl();
|
|
|
20335
20346
|
const { getAll: getAll$4, postModel: postModel$1 } = ServiceFactory.build({
|
|
20336
20347
|
basePath: `${URL$7}/api/kos/troubles`
|
|
20337
20348
|
});
|
|
20338
|
-
const log$
|
|
20349
|
+
const log$f = KosLog.createLogger({ name: "trouble-services" });
|
|
20339
20350
|
const getKosConnectionId$1 = () => {
|
|
20340
20351
|
const params2 = getQueryParams();
|
|
20341
20352
|
const connId = params2?.connId;
|
|
20342
|
-
log$
|
|
20343
|
-
log$
|
|
20353
|
+
log$f.debug(`connId from query params: ${connId}`);
|
|
20354
|
+
log$f.debug(
|
|
20344
20355
|
`window.kosBridge: ${window?.kosBridge ? "available" : "not available"} - ${window?.kosBridge?.("connId")}`
|
|
20345
20356
|
);
|
|
20346
20357
|
const result = connId || window?.kosBridge?.("connId");
|
|
20347
|
-
log$
|
|
20358
|
+
log$f.info(`getKosConnectionId: ${result}`);
|
|
20348
20359
|
return result;
|
|
20349
20360
|
};
|
|
20350
20361
|
const destinationAddress$2 = getKosConnectionId$1();
|
|
20351
|
-
log$
|
|
20362
|
+
log$f.info(`Destination address for trouble services: ${destinationAddress$2}`);
|
|
20352
20363
|
const getTroubles = async (servicePath) => {
|
|
20353
20364
|
const isKosTroubles = servicePath.includes("/kos/troubles");
|
|
20354
|
-
log$
|
|
20365
|
+
log$f.info(
|
|
20355
20366
|
`Fetching troubles from ${servicePath} with destination address: ${isKosTroubles ? destinationAddress$2 : "N/A (not a kos troubles path)"}`
|
|
20356
20367
|
);
|
|
20357
20368
|
const response = await getAll$4({
|
|
@@ -20865,16 +20876,16 @@ const { URL: URL$6 } = resolveServiceUrl();
|
|
|
20865
20876
|
const { getAll: getAll$3 } = ServiceFactory.build({
|
|
20866
20877
|
basePath: `${URL$6}/api/kos/ota`
|
|
20867
20878
|
});
|
|
20868
|
-
const log$
|
|
20879
|
+
const log$e = KosLog.createLogger({
|
|
20869
20880
|
name: "ota-service",
|
|
20870
20881
|
group: "Services"
|
|
20871
20882
|
});
|
|
20872
20883
|
const getArtifacts = async () => {
|
|
20873
|
-
log$
|
|
20884
|
+
log$e.debug("sending GET request to /api/kos/ota/artifacts");
|
|
20874
20885
|
const response = await getAll$3({
|
|
20875
20886
|
urlOverride: `${URL$6}/api/kos/ota/artifacts`
|
|
20876
20887
|
});
|
|
20877
|
-
log$
|
|
20888
|
+
log$e.debug("getArtifacts - response:", response);
|
|
20878
20889
|
return response?.data;
|
|
20879
20890
|
};
|
|
20880
20891
|
var __defProp$e = Object.defineProperty;
|
|
@@ -21058,7 +21069,7 @@ const Ota = new SingletonKosModelRegistrationFactory({
|
|
|
21058
21069
|
class: OtaModelImpl,
|
|
21059
21070
|
type: MODEL_TYPE$h
|
|
21060
21071
|
});
|
|
21061
|
-
const log$
|
|
21072
|
+
const log$d = KosLog.createLogger({ name: "await-future-call", group: "Models" });
|
|
21062
21073
|
class FutureCallError extends Error {
|
|
21063
21074
|
endState;
|
|
21064
21075
|
reason;
|
|
@@ -21109,7 +21120,7 @@ function awaitFutureCall(model, methodCall, options = {}) {
|
|
|
21109
21120
|
const watchTracked = (future) => {
|
|
21110
21121
|
tracked = future;
|
|
21111
21122
|
if (cancelRequested) {
|
|
21112
|
-
future.cancelFuture().catch((e) => log$
|
|
21123
|
+
future.cancelFuture().catch((e) => log$d.error(e));
|
|
21113
21124
|
}
|
|
21114
21125
|
disposers.push(
|
|
21115
21126
|
mobx.reaction(
|
|
@@ -21126,7 +21137,7 @@ function awaitFutureCall(model, methodCall, options = {}) {
|
|
|
21126
21137
|
try {
|
|
21127
21138
|
cb(progress, status);
|
|
21128
21139
|
} catch (e) {
|
|
21129
|
-
log$
|
|
21140
|
+
log$d.warn("progress callback error", e);
|
|
21130
21141
|
}
|
|
21131
21142
|
});
|
|
21132
21143
|
},
|
|
@@ -23741,9 +23752,9 @@ const { URL: URL$5 } = resolveServiceUrl();
|
|
|
23741
23752
|
const { getOne: getOne$1 } = ServiceFactory.build({
|
|
23742
23753
|
basePath: `${URL$5}/api/device`
|
|
23743
23754
|
});
|
|
23744
|
-
const log$
|
|
23755
|
+
const log$c = KosLog.createLogger({ name: "device-service", group: "Services" });
|
|
23745
23756
|
const getSerialNumber = async () => {
|
|
23746
|
-
log$
|
|
23757
|
+
log$c.debug("sending GET for device serial number");
|
|
23747
23758
|
try {
|
|
23748
23759
|
const response = await getOne$1({
|
|
23749
23760
|
urlOverride: `${URL$5}/api/kos/device/serialNumber`
|
|
@@ -23751,14 +23762,14 @@ const getSerialNumber = async () => {
|
|
|
23751
23762
|
return [void 0, response?.data.serialNumber];
|
|
23752
23763
|
} catch (error) {
|
|
23753
23764
|
if (error instanceof FetchError) {
|
|
23754
|
-
log$
|
|
23765
|
+
log$c.error(`Error fetching device serial number: ${error.payload.error}`);
|
|
23755
23766
|
return [error.payload.error, void 0];
|
|
23756
23767
|
}
|
|
23757
23768
|
}
|
|
23758
23769
|
return ["unknownError", void 0];
|
|
23759
23770
|
};
|
|
23760
23771
|
const getDeviceDetails = async () => {
|
|
23761
|
-
log$
|
|
23772
|
+
log$c.debug("sending GET for device details");
|
|
23762
23773
|
try {
|
|
23763
23774
|
const response = await getOne$1({
|
|
23764
23775
|
urlOverride: `${URL$5}/api/kos/device`
|
|
@@ -23769,7 +23780,7 @@ const getDeviceDetails = async () => {
|
|
|
23769
23780
|
return [void 0, response.data];
|
|
23770
23781
|
} catch (error) {
|
|
23771
23782
|
if (error instanceof FetchError) {
|
|
23772
|
-
log$
|
|
23783
|
+
log$c.error(`Error fetching device serial number: ${error.payload.error}`);
|
|
23773
23784
|
return [error.payload.error, void 0];
|
|
23774
23785
|
}
|
|
23775
23786
|
}
|
|
@@ -24104,12 +24115,12 @@ const { getAll: getAll$2 } = ServiceFactory.build({
|
|
|
24104
24115
|
basePath: `${URL$4}/api/kos/network/interfaces`
|
|
24105
24116
|
});
|
|
24106
24117
|
const destinationAddress$1 = getKosConnectionId();
|
|
24107
|
-
const log$
|
|
24118
|
+
const log$b = KosLog.createLogger({
|
|
24108
24119
|
name: "network-interface-service",
|
|
24109
24120
|
group: "Services"
|
|
24110
24121
|
});
|
|
24111
24122
|
const getNetworkInterfaces = async () => {
|
|
24112
|
-
log$
|
|
24123
|
+
log$b.debug("sending GET for copy-logs");
|
|
24113
24124
|
try {
|
|
24114
24125
|
const response = await getAll$2({
|
|
24115
24126
|
destinationAddress: destinationAddress$1
|
|
@@ -24117,7 +24128,7 @@ const getNetworkInterfaces = async () => {
|
|
|
24117
24128
|
return [void 0, response?.data];
|
|
24118
24129
|
} catch (error) {
|
|
24119
24130
|
if (error instanceof FetchError) {
|
|
24120
|
-
log$
|
|
24131
|
+
log$b.error(`Error fetching log file size: ${error.payload.error}`);
|
|
24121
24132
|
return [error.payload.error, void 0];
|
|
24122
24133
|
}
|
|
24123
24134
|
}
|
|
@@ -24219,15 +24230,15 @@ const { URL: URL$3 } = resolveServiceUrl();
|
|
|
24219
24230
|
const { getAll: getAll$1 } = ServiceFactory.build({
|
|
24220
24231
|
basePath: `${URL$3}/api/kos/storage/devices`
|
|
24221
24232
|
});
|
|
24222
|
-
const log$
|
|
24233
|
+
const log$a = KosLog.createLogger({
|
|
24223
24234
|
name: "storage-device-service",
|
|
24224
24235
|
group: "Services"
|
|
24225
24236
|
});
|
|
24226
24237
|
const getStorageDevices = async () => {
|
|
24227
|
-
log$
|
|
24238
|
+
log$a.debug("sending GET for storage-device");
|
|
24228
24239
|
const response = await getAll$1({});
|
|
24229
24240
|
if (!response?.data || response.status !== 200) {
|
|
24230
|
-
log$
|
|
24241
|
+
log$a.error("Failed to retrieve storage-device data", response);
|
|
24231
24242
|
return [];
|
|
24232
24243
|
}
|
|
24233
24244
|
return response.data;
|
|
@@ -24429,17 +24440,17 @@ const { URL: URL$2 } = resolveServiceUrl();
|
|
|
24429
24440
|
const { getAll, postModel } = ServiceFactory.build({
|
|
24430
24441
|
basePath: `${URL$2}/api/kos/update/available`
|
|
24431
24442
|
});
|
|
24432
|
-
const log$
|
|
24443
|
+
const log$9 = KosLog.createLogger({
|
|
24433
24444
|
name: "usb-update-service",
|
|
24434
24445
|
group: "Services"
|
|
24435
24446
|
});
|
|
24436
24447
|
const getAvailableUpdates = async () => {
|
|
24437
|
-
log$
|
|
24448
|
+
log$9.debug("sending GET for usb-update");
|
|
24438
24449
|
const response = await getAll({
|
|
24439
24450
|
urlOverride: `${URL$2}/api/kos/update/available`
|
|
24440
24451
|
});
|
|
24441
24452
|
if (!response?.data || response?.status !== 200) {
|
|
24442
|
-
log$
|
|
24453
|
+
log$9.error("Failed to retrieve usb-update data", response);
|
|
24443
24454
|
return [];
|
|
24444
24455
|
}
|
|
24445
24456
|
return response.data;
|
|
@@ -24658,7 +24669,7 @@ const { URL: URL$1 } = resolveServiceUrl();
|
|
|
24658
24669
|
const { getOne } = ServiceFactory.build({
|
|
24659
24670
|
basePath: `${URL$1}/api/translation`
|
|
24660
24671
|
});
|
|
24661
|
-
const log$
|
|
24672
|
+
const log$8 = KosLog.createLogger({
|
|
24662
24673
|
name: "translation-service",
|
|
24663
24674
|
group: "Services"
|
|
24664
24675
|
});
|
|
@@ -24670,23 +24681,23 @@ const getDefaultHost$1 = () => {
|
|
|
24670
24681
|
return result;
|
|
24671
24682
|
};
|
|
24672
24683
|
const getTranslations = async (url, root) => {
|
|
24673
|
-
log$
|
|
24684
|
+
log$8.debug(`Loading translations from: ${url}`);
|
|
24674
24685
|
const rootUrl = root ?? getDefaultHost$1();
|
|
24675
24686
|
try {
|
|
24676
24687
|
const response = await fetch(`${rootUrl}${url}`);
|
|
24677
24688
|
if (response.status !== 200) {
|
|
24678
|
-
log$
|
|
24689
|
+
log$8.warn(`Failed to fetch translations at ${url}: ${response.status}`);
|
|
24679
24690
|
return {};
|
|
24680
24691
|
}
|
|
24681
24692
|
const json = await response.json();
|
|
24682
24693
|
return json;
|
|
24683
24694
|
} catch (error) {
|
|
24684
|
-
log$
|
|
24695
|
+
log$8.error("Error fetching translations", error);
|
|
24685
24696
|
throw error;
|
|
24686
24697
|
}
|
|
24687
24698
|
};
|
|
24688
24699
|
const getLocalizationDescriptor = async () => {
|
|
24689
|
-
log$
|
|
24700
|
+
log$8.debug("Getting system localization descriptor");
|
|
24690
24701
|
const response = await getOne({
|
|
24691
24702
|
urlOverride: `${URL$1}/api/system/kos/localization`
|
|
24692
24703
|
});
|
|
@@ -24698,7 +24709,7 @@ const getLocalizationDescriptor = async () => {
|
|
|
24698
24709
|
return response.data;
|
|
24699
24710
|
};
|
|
24700
24711
|
const getKosLocalizationDescriptor = (context) => async () => {
|
|
24701
|
-
log$
|
|
24712
|
+
log$8.debug(`Getting KOS localization descriptor for context: ${context}`);
|
|
24702
24713
|
const response = await getOne({
|
|
24703
24714
|
urlOverride: `${URL$1}/api/kos/localization/contexts`
|
|
24704
24715
|
});
|
|
@@ -25528,7 +25539,7 @@ const service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
25528
25539
|
const TIMER_EVENT = `/kos-timer-event`;
|
|
25529
25540
|
const TOPIC_TIMER_TICK_EVENT = `/kos-timer-event/tick`;
|
|
25530
25541
|
const TIMER_END = "defaultTimerEnd";
|
|
25531
|
-
const log$
|
|
25542
|
+
const log$7 = KosLog.createLogger({ name: "timer-manager" });
|
|
25532
25543
|
const isConfigProperty = (value) => value.updateProperty !== void 0;
|
|
25533
25544
|
class KosTimer {
|
|
25534
25545
|
name;
|
|
@@ -25576,7 +25587,7 @@ class KosTimer {
|
|
|
25576
25587
|
*/
|
|
25577
25588
|
start() {
|
|
25578
25589
|
if (this.state === "active") {
|
|
25579
|
-
log$
|
|
25590
|
+
log$7.debug(`Timer ${this.name} already started`);
|
|
25580
25591
|
return;
|
|
25581
25592
|
}
|
|
25582
25593
|
if (this.state === "inactive" || this.state === "paused") {
|
|
@@ -25589,7 +25600,7 @@ class KosTimer {
|
|
|
25589
25600
|
*/
|
|
25590
25601
|
pause() {
|
|
25591
25602
|
if (this.timer) {
|
|
25592
|
-
log$
|
|
25603
|
+
log$7.debug(`Pausing timer ${this.name}`);
|
|
25593
25604
|
this.state = "paused";
|
|
25594
25605
|
clearInterval(this.timer);
|
|
25595
25606
|
}
|
|
@@ -25671,11 +25682,11 @@ class KosTimer {
|
|
|
25671
25682
|
executeActions(time) {
|
|
25672
25683
|
if (this.timeoutActions.has(time)) {
|
|
25673
25684
|
this.timeoutActions.get(time).forEach((timerAction) => {
|
|
25674
|
-
log$
|
|
25685
|
+
log$7.debug(`Executing timer action ${timerAction.name} at ${time}`);
|
|
25675
25686
|
timerAction.action?.(timerAction.name, time);
|
|
25676
25687
|
this.notifyTimeoutAction(timerAction);
|
|
25677
25688
|
if (timerAction.singleUse) {
|
|
25678
|
-
log$
|
|
25689
|
+
log$7.info(
|
|
25679
25690
|
`${this.name} Removing single-use action ${timerAction.name}`
|
|
25680
25691
|
);
|
|
25681
25692
|
this.removeTimeoutAction(timerAction.name);
|
|
@@ -25706,7 +25717,7 @@ const timers = /* @__PURE__ */ new Map();
|
|
|
25706
25717
|
const executeOnTimer = (name, action) => {
|
|
25707
25718
|
const timer = timers.get(name);
|
|
25708
25719
|
if (!timer) {
|
|
25709
|
-
log$
|
|
25720
|
+
log$7.error(`Timer ${name} not found`);
|
|
25710
25721
|
return;
|
|
25711
25722
|
}
|
|
25712
25723
|
action(timer);
|
|
@@ -25803,23 +25814,23 @@ const updateTimeZone = async (timezone) => {
|
|
|
25803
25814
|
await whenReady(timezoneInfo);
|
|
25804
25815
|
timezoneInfo.updateProperty(timezone);
|
|
25805
25816
|
};
|
|
25806
|
-
const log$
|
|
25817
|
+
const log$6 = KosLog.createLogger({
|
|
25807
25818
|
name: "software-info-service",
|
|
25808
25819
|
group: "Services"
|
|
25809
25820
|
});
|
|
25810
25821
|
const destinationAddress = getKosConnectionId();
|
|
25811
25822
|
const getSoftwareInfos = async (signal) => {
|
|
25812
|
-
log$
|
|
25823
|
+
log$6.debug("sending GET for software-info");
|
|
25813
25824
|
const [error, response] = await api$8.get("/api/kos/manifest/info", void 0, {
|
|
25814
25825
|
signal,
|
|
25815
25826
|
destinationAddress
|
|
25816
25827
|
});
|
|
25817
25828
|
if (!response) {
|
|
25818
25829
|
if (signal?.aborted) {
|
|
25819
|
-
log$
|
|
25830
|
+
log$6.debug("Request was aborted");
|
|
25820
25831
|
throw new FetchError("Request was aborted");
|
|
25821
25832
|
}
|
|
25822
|
-
log$
|
|
25833
|
+
log$6.error("Failed to fetch software-info", error);
|
|
25823
25834
|
throw new FetchError("Failed to fetch software-info");
|
|
25824
25835
|
}
|
|
25825
25836
|
return response;
|
|
@@ -25918,7 +25929,7 @@ const SoftwareInfo = {
|
|
|
25918
25929
|
function isTroubleAware(obj) {
|
|
25919
25930
|
return obj?.troubles !== void 0 && obj?.troubles instanceof Array && obj?.troublesByType !== void 0 && typeof obj?.troublesByType === "object";
|
|
25920
25931
|
}
|
|
25921
|
-
const log$
|
|
25932
|
+
const log$5 = KosLog.createLogger({ name: "services", group: "Services" });
|
|
25922
25933
|
const studioLogin = async (username, password) => login(username, password, `${exports.BASE_URL}/api/server/login`);
|
|
25923
25934
|
const login = async (username, password, url = `${exports.BASE_URL}/api/login`) => {
|
|
25924
25935
|
const response = await exports.kosFetch(`${url}`, {
|
|
@@ -25952,7 +25963,7 @@ const startPasswordReset = async (userId, url = `${exports.BASE_URL}/api/startPa
|
|
|
25952
25963
|
};
|
|
25953
25964
|
const studioResetPassword = async (token2, password) => resetPassword(token2, password, `${exports.BASE_URL}/api/server/resetPassword`);
|
|
25954
25965
|
const resetPassword = async (token2, password, url = `${exports.BASE_URL}/api/resetPassword`) => {
|
|
25955
|
-
log$
|
|
25966
|
+
log$5.debug(
|
|
25956
25967
|
`resetting password with token ${token2} and password ${password.replace(
|
|
25957
25968
|
/./g,
|
|
25958
25969
|
"*"
|
|
@@ -25966,9 +25977,9 @@ const resetPassword = async (token2, password, url = `${exports.BASE_URL}/api/re
|
|
|
25966
25977
|
password
|
|
25967
25978
|
})
|
|
25968
25979
|
});
|
|
25969
|
-
log$
|
|
25980
|
+
log$5.debug(`password reset returned status ${response.status}`);
|
|
25970
25981
|
if (!response.ok) {
|
|
25971
|
-
log$
|
|
25982
|
+
log$5.error(`password reset failed with message ${response.statusText}`);
|
|
25972
25983
|
const configResponse2 = await response.json();
|
|
25973
25984
|
throw Error(
|
|
25974
25985
|
`${configResponse2?.error}:There was a problem resetting the password.`
|
|
@@ -25984,7 +25995,7 @@ const studioAcceptOrgInvitation = async (token2, password, name) => acceptOrgInv
|
|
|
25984
25995
|
`${exports.BASE_URL}/api/server/acceptInvite`
|
|
25985
25996
|
);
|
|
25986
25997
|
const acceptOrgInvitation = async (token2, password, name, url = `${exports.BASE_URL}/api/server/acceptInvite`) => {
|
|
25987
|
-
log$
|
|
25998
|
+
log$5.debug(
|
|
25988
25999
|
`accepting invite with token ${token2} and password ${password.replace(
|
|
25989
26000
|
/./g,
|
|
25990
26001
|
"*"
|
|
@@ -25999,9 +26010,9 @@ const acceptOrgInvitation = async (token2, password, name, url = `${exports.BASE
|
|
|
25999
26010
|
name
|
|
26000
26011
|
})
|
|
26001
26012
|
});
|
|
26002
|
-
log$
|
|
26013
|
+
log$5.debug(`invitation accept returned status ${response.status}`);
|
|
26003
26014
|
if (!response.ok) {
|
|
26004
|
-
log$
|
|
26015
|
+
log$5.error(`invite failed with message ${response.statusText}`);
|
|
26005
26016
|
const configResponse2 = await response.json();
|
|
26006
26017
|
throw Error(
|
|
26007
26018
|
`${configResponse2?.error}:There was a problem accepting the invite.`
|
|
@@ -26307,15 +26318,15 @@ GpioChipContainerModelImpl = __decorateClass$1([
|
|
|
26307
26318
|
], GpioChipContainerModelImpl);
|
|
26308
26319
|
const GpioChipContainer = GpioChipContainerModelImpl.Registration;
|
|
26309
26320
|
GpioChipContainer.addRelatedModel(GpioChip);
|
|
26310
|
-
const log$
|
|
26321
|
+
const log$4 = KosLog.createLogger({
|
|
26311
26322
|
name: "studio-properties-service",
|
|
26312
26323
|
group: "Services"
|
|
26313
26324
|
});
|
|
26314
26325
|
const SERVICE_PATH = "/api/kos/studio/properties";
|
|
26315
26326
|
const getStudioProperties = async (connectionId) => {
|
|
26316
|
-
log$
|
|
26327
|
+
log$4.debug("sending GET for studio-properties");
|
|
26317
26328
|
if (!connectionId) {
|
|
26318
|
-
log$
|
|
26329
|
+
log$4.error("connectionId is undefined");
|
|
26319
26330
|
throw new Error("connectionId is undefined");
|
|
26320
26331
|
}
|
|
26321
26332
|
return await api$9.get(
|
|
@@ -26481,25 +26492,41 @@ const MessageContainer = styled.div`
|
|
|
26481
26492
|
color: ${({ theme }) => theme === "light" ? "black" : "white"};
|
|
26482
26493
|
z-index: 10000;
|
|
26483
26494
|
`;
|
|
26495
|
+
const log$3 = KosLog.createLogger({ name: "error-boundary" });
|
|
26484
26496
|
class ErrorBoundary extends React.Component {
|
|
26485
26497
|
constructor(props) {
|
|
26486
26498
|
super(props);
|
|
26487
26499
|
this.state = { error: null, errorInfo: null };
|
|
26488
26500
|
}
|
|
26501
|
+
/**
|
|
26502
|
+
* Recovers during the render phase. Without this React renders the boundary
|
|
26503
|
+
* with `null` children and waits for `componentDidCatch` to schedule a
|
|
26504
|
+
* fallback, and a second error in the same batch escalates past the boundary
|
|
26505
|
+
* to the root, unmounting the whole tree.
|
|
26506
|
+
*/
|
|
26507
|
+
static getDerivedStateFromError(error) {
|
|
26508
|
+
return { error };
|
|
26509
|
+
}
|
|
26489
26510
|
componentDidCatch(error, errorInfo) {
|
|
26511
|
+
const seam = this.props.name ? ` in ${this.props.name}` : "";
|
|
26512
|
+
log$3.error(
|
|
26513
|
+
`Error boundary caught${seam}: ${error?.message ?? error}`,
|
|
26514
|
+
error,
|
|
26515
|
+
errorInfo.componentStack
|
|
26516
|
+
);
|
|
26490
26517
|
this.setState({
|
|
26491
26518
|
error,
|
|
26492
26519
|
errorInfo
|
|
26493
26520
|
});
|
|
26494
26521
|
}
|
|
26495
26522
|
render() {
|
|
26496
|
-
if (this.state.
|
|
26523
|
+
if (this.state.error) {
|
|
26497
26524
|
return this.props.fallback || /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
26498
26525
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { children: "Something went wrong." }),
|
|
26499
26526
|
/* @__PURE__ */ jsxRuntime.jsxs("details", { style: { whiteSpace: `pre-wrap` }, children: [
|
|
26500
|
-
this.state.error
|
|
26527
|
+
this.state.error.toString(),
|
|
26501
26528
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
26502
|
-
this.state.errorInfo
|
|
26529
|
+
this.state.errorInfo?.componentStack
|
|
26503
26530
|
] })
|
|
26504
26531
|
] });
|
|
26505
26532
|
}
|
|
@@ -27634,9 +27661,11 @@ function fetchData(key, fetcher) {
|
|
|
27634
27661
|
const entry = cache.get(key);
|
|
27635
27662
|
if (entry.status === "finished") {
|
|
27636
27663
|
return entry.result;
|
|
27637
|
-
} else {
|
|
27638
|
-
throw entry.promise;
|
|
27639
27664
|
}
|
|
27665
|
+
if (entry.status === "error") {
|
|
27666
|
+
throw entry.error;
|
|
27667
|
+
}
|
|
27668
|
+
throw entry.promise;
|
|
27640
27669
|
} else {
|
|
27641
27670
|
const promise = fetcher().then(
|
|
27642
27671
|
(result) => {
|