@kosdev-code/kos-ui-sdk 3.0.18 → 3.0.20
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/core/decorators/kos-execute-service-request.d.ts +1 -1
- package/core/core/decorators/kos-execute-service-request.d.ts.map +1 -1
- package/core/core/decorators/kos-execution-context.d.ts +3 -2
- package/core/core/decorators/kos-execution-context.d.ts.map +1 -1
- package/core/core/decorators/kos-service-request.d.ts +4 -4
- package/core/core/decorators/kos-service-request.d.ts.map +1 -1
- package/index.cjs +339 -321
- package/index.cjs.map +1 -1
- package/index.js +339 -321
- package/index.js.map +1 -1
- package/package.json +2 -2
- 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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import log$
|
|
1
|
+
import log$S from "loglevel";
|
|
2
2
|
import { makeAutoObservable, observable, makeObservable, action, createAtom, autorun, runInAction, observe, isComputedProp, reaction, when, ObservableMap, computed, isObservable } from "mobx";
|
|
3
3
|
import { makeAutoObservable as makeAutoObservable2, makeObservable as makeObservable2 } from "mobx";
|
|
4
4
|
import { createMachine, invoke, transition, action as action$1, state, interpret, immediate } from "robot3";
|
|
@@ -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) {
|
|
@@ -806,10 +806,10 @@ const getLogMessageToStudio = () => {
|
|
|
806
806
|
return enableAll;
|
|
807
807
|
};
|
|
808
808
|
const WS_LOG = "ws-log";
|
|
809
|
-
const originalFactory = log$
|
|
809
|
+
const originalFactory = log$S.methodFactory;
|
|
810
810
|
const enableMessageLogging = getKosMessageLogging();
|
|
811
811
|
const enableStudioMessageLogging = getLogMessageToStudio();
|
|
812
|
-
log$
|
|
812
|
+
log$S.methodFactory = function(methodName, logLevel, loggerName) {
|
|
813
813
|
const rawMethod = originalFactory(methodName, logLevel, loggerName);
|
|
814
814
|
return function(...args) {
|
|
815
815
|
const _name = loggerName ? String(loggerName) : "";
|
|
@@ -824,17 +824,17 @@ log$R.methodFactory = function(methodName, logLevel, loggerName) {
|
|
|
824
824
|
};
|
|
825
825
|
};
|
|
826
826
|
let level = getLogLevel();
|
|
827
|
-
log$
|
|
827
|
+
log$S.setLevel(level);
|
|
828
828
|
window.setKosLogLevel = (_level) => {
|
|
829
829
|
level = _level;
|
|
830
|
-
log$
|
|
830
|
+
log$S.setLevel(_level);
|
|
831
831
|
};
|
|
832
|
-
const wsLog = log$
|
|
832
|
+
const wsLog = log$S.getLogger(WS_LOG);
|
|
833
833
|
window.enableKosMessageLog = () => {
|
|
834
|
-
wsLog.setLevel(log$
|
|
834
|
+
wsLog.setLevel(log$S.levels.INFO);
|
|
835
835
|
};
|
|
836
836
|
window.disableKosMessageLog = () => {
|
|
837
|
-
wsLog.setLevel(log$
|
|
837
|
+
wsLog.setLevel(log$S.levels.ERROR);
|
|
838
838
|
};
|
|
839
839
|
if (enableMessageLogging) {
|
|
840
840
|
window.enableKosMessageLog();
|
|
@@ -862,21 +862,21 @@ const received = [
|
|
|
862
862
|
"font-weight: bold"
|
|
863
863
|
].join(";");
|
|
864
864
|
const conditionallyLog = (level2) => (fn) => {
|
|
865
|
-
if (log$
|
|
865
|
+
if (log$S.getLevel() <= level2) {
|
|
866
866
|
fn();
|
|
867
867
|
}
|
|
868
868
|
};
|
|
869
869
|
const KosLog = {
|
|
870
|
-
...log$
|
|
871
|
-
ifDebug: conditionallyLog(log$
|
|
872
|
-
ifInfo: conditionallyLog(log$
|
|
873
|
-
ifWarn: conditionallyLog(log$
|
|
874
|
-
ifError: conditionallyLog(log$
|
|
875
|
-
getLogger: (name) => log$
|
|
876
|
-
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(),
|
|
877
877
|
createLogger: ({ name, group }) => {
|
|
878
878
|
const loggerName = `${group ? `${group}:` : "kos"}::${name}`;
|
|
879
|
-
const _log = log$
|
|
879
|
+
const _log = log$S.getLogger(loggerName);
|
|
880
880
|
let _level = globalThis.kos.logOverrides?.find(
|
|
881
881
|
(override) => override.name === loggerName
|
|
882
882
|
)?.level;
|
|
@@ -927,7 +927,7 @@ const OptionsRequired = /* @__PURE__ */ Symbol(`OptionsRequired`);
|
|
|
927
927
|
const KosViewModelSymbol = /* @__PURE__ */ Symbol(`KosViewModelSymbol`);
|
|
928
928
|
const ViewModelConfig = /* @__PURE__ */ Symbol(`ViewModelConfig`);
|
|
929
929
|
const ReloadAwareSetup = /* @__PURE__ */ Symbol(`ReloadAwareSetup`);
|
|
930
|
-
const log$
|
|
930
|
+
const log$R = KosLog.createLogger({ group: "decorators", name: "fsm-injection" });
|
|
931
931
|
function injectStateMachineSupport(modelInstance) {
|
|
932
932
|
const fsmSetup = modelInstance[StateMachineSetup];
|
|
933
933
|
if (!fsmSetup) return;
|
|
@@ -971,7 +971,7 @@ function initializeFsmProperties(modelInstance, options) {
|
|
|
971
971
|
const config2 = modelInstance._fsmConfig;
|
|
972
972
|
const initialState = computeInitialState ? computeInitialState(modelInstance) : config2.initial;
|
|
973
973
|
if (computeInitialState && !config2.states[initialState]) {
|
|
974
|
-
log$
|
|
974
|
+
log$R.warn(
|
|
975
975
|
`computeInitialState returned "${initialState}" which is not a valid state. Falling back to "${config2.initial}".`
|
|
976
976
|
);
|
|
977
977
|
modelInstance[stateProperty] = config2.initial;
|
|
@@ -1101,7 +1101,7 @@ function handleAsyncEntryResult(instance, state2, stateProperty, result) {
|
|
|
1101
1101
|
if (stateConfig.onError && instance[stateProperty] === state2) {
|
|
1102
1102
|
instance.transition(stateConfig.onError);
|
|
1103
1103
|
} else {
|
|
1104
|
-
log$
|
|
1104
|
+
log$R.error(`Async entry handler for state "${state2}" failed:`, err);
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
1107
|
);
|
|
@@ -1142,7 +1142,7 @@ function initializeStateMachine(modelInstance, lifecycle) {
|
|
|
1142
1142
|
modelInstance._fsmInitialized = true;
|
|
1143
1143
|
trackInitialStateInHistory(modelInstance, config2.initial, options);
|
|
1144
1144
|
executeInitialStateEntryHandler(modelInstance, config2.initial);
|
|
1145
|
-
log$
|
|
1145
|
+
log$R.debug(
|
|
1146
1146
|
`FSM initialized for model ${modelInstance.id} at lifecycle ${lifecycle} with initial state "${config2.initial}"`
|
|
1147
1147
|
);
|
|
1148
1148
|
}
|
|
@@ -1400,7 +1400,7 @@ class ServiceRequestError extends Error {
|
|
|
1400
1400
|
this.responseHeaders = details.responseHeaders ?? {};
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
|
-
const log$
|
|
1403
|
+
const log$Q = KosLog.createLogger({ name: "resolve-parameters" });
|
|
1404
1404
|
const resolveParameters = ({
|
|
1405
1405
|
value,
|
|
1406
1406
|
modelId,
|
|
@@ -1432,11 +1432,11 @@ const resolveParameters = ({
|
|
|
1432
1432
|
)) {
|
|
1433
1433
|
const prop = modelData[propName];
|
|
1434
1434
|
if (prop !== null && prop !== void 0) {
|
|
1435
|
-
log$
|
|
1435
|
+
log$Q.debug(`Resolved ${match} to ${prop}`);
|
|
1436
1436
|
return prop;
|
|
1437
1437
|
} else {
|
|
1438
1438
|
const logLevel2 = isOnlyPropKey ? "debug" : "warn";
|
|
1439
|
-
log$
|
|
1439
|
+
log$Q[logLevel2](
|
|
1440
1440
|
`Property ${propName} is null or undefined${isOnlyPropKey ? "" : " in composite string"}, marking for undefined return`
|
|
1441
1441
|
);
|
|
1442
1442
|
hasUnresolvedProp = true;
|
|
@@ -1444,7 +1444,7 @@ const resolveParameters = ({
|
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
const logLevel = isOnlyPropKey ? "debug" : "warn";
|
|
1447
|
-
log$
|
|
1447
|
+
log$Q[logLevel](
|
|
1448
1448
|
`Property ${propName} not found in modelData${isOnlyPropKey ? "" : " for composite string"}`
|
|
1449
1449
|
);
|
|
1450
1450
|
return match;
|
|
@@ -1459,7 +1459,7 @@ const resolveParameters = ({
|
|
|
1459
1459
|
}
|
|
1460
1460
|
return _value;
|
|
1461
1461
|
};
|
|
1462
|
-
const log$
|
|
1462
|
+
const log$P = KosLog.createLogger({ name: "ServiceRequestHelpers" });
|
|
1463
1463
|
function resolveServiceRequestParameters(metadata, modelInstance, args, runtimeOptions) {
|
|
1464
1464
|
const resolvedPath = resolveParameters({
|
|
1465
1465
|
value: metadata.path,
|
|
@@ -1528,7 +1528,7 @@ function handleServiceRequestError(error, response, errorHandler, modelInstance,
|
|
|
1528
1528
|
});
|
|
1529
1529
|
switch (errorHandler.strategy) {
|
|
1530
1530
|
case "log":
|
|
1531
|
-
log$
|
|
1531
|
+
log$P.error(`Service request status ${richError.status} error: ${error}`);
|
|
1532
1532
|
if (errorHandler.onError) {
|
|
1533
1533
|
errorHandler.onError(richError, modelInstance);
|
|
1534
1534
|
}
|
|
@@ -1651,7 +1651,7 @@ var ReplayStrategy = /* @__PURE__ */ ((ReplayStrategy2) => {
|
|
|
1651
1651
|
ReplayStrategy2["NONE"] = "none";
|
|
1652
1652
|
return ReplayStrategy2;
|
|
1653
1653
|
})(ReplayStrategy || {});
|
|
1654
|
-
const log$
|
|
1654
|
+
const log$O = KosLog.createLogger({ name: "kos-state-machine" });
|
|
1655
1655
|
function kosStateMachine(config2, options) {
|
|
1656
1656
|
return (target) => {
|
|
1657
1657
|
target.prototype[StateMachineSetup] = {
|
|
@@ -1706,7 +1706,7 @@ function kosStateGuard(options) {
|
|
|
1706
1706
|
if (shouldThrow) {
|
|
1707
1707
|
throw new Error(message2);
|
|
1708
1708
|
} else {
|
|
1709
|
-
log$
|
|
1709
|
+
log$O.warn(message2);
|
|
1710
1710
|
return void 0;
|
|
1711
1711
|
}
|
|
1712
1712
|
}
|
|
@@ -2272,7 +2272,7 @@ function observeComputedProperties(model, callback, keys = []) {
|
|
|
2272
2272
|
);
|
|
2273
2273
|
return disposers;
|
|
2274
2274
|
}
|
|
2275
|
-
const log$
|
|
2275
|
+
const log$N = KosLog.createLogger({ name: "kos-container-model" });
|
|
2276
2276
|
class KosModelContainer {
|
|
2277
2277
|
_data;
|
|
2278
2278
|
_sortKey;
|
|
@@ -2394,14 +2394,14 @@ class KosModelContainer {
|
|
|
2394
2394
|
async removeAndDestroy(id) {
|
|
2395
2395
|
const model = this.getModel(id);
|
|
2396
2396
|
if (!model) {
|
|
2397
|
-
log$
|
|
2397
|
+
log$N.debug(`Model ${id} not found in container, skipping destroy`);
|
|
2398
2398
|
return;
|
|
2399
2399
|
}
|
|
2400
2400
|
this.removeModel(id);
|
|
2401
2401
|
try {
|
|
2402
2402
|
await destroyKosModel(model);
|
|
2403
2403
|
} catch (error) {
|
|
2404
|
-
log$
|
|
2404
|
+
log$N.error(`Failed to destroy model ${id}:`, error);
|
|
2405
2405
|
throw error;
|
|
2406
2406
|
}
|
|
2407
2407
|
}
|
|
@@ -2418,7 +2418,7 @@ class KosModelContainer {
|
|
|
2418
2418
|
async removeAndDestroyAll(ids) {
|
|
2419
2419
|
const models2 = ids.map((id) => this.getModel(id)).filter((model) => model !== void 0);
|
|
2420
2420
|
if (models2.length === 0) {
|
|
2421
|
-
log$
|
|
2421
|
+
log$N.debug("No models found to destroy");
|
|
2422
2422
|
return;
|
|
2423
2423
|
}
|
|
2424
2424
|
this.removeAll(ids);
|
|
@@ -2427,7 +2427,7 @@ class KosModelContainer {
|
|
|
2427
2427
|
);
|
|
2428
2428
|
results.forEach((result, index2) => {
|
|
2429
2429
|
if (result.status === "rejected") {
|
|
2430
|
-
log$
|
|
2430
|
+
log$N.error(
|
|
2431
2431
|
`Failed to destroy model ${models2[index2].id}:`,
|
|
2432
2432
|
result.reason
|
|
2433
2433
|
);
|
|
@@ -2600,7 +2600,7 @@ class KosModelContainer {
|
|
|
2600
2600
|
const idx = this.index.get(indexName);
|
|
2601
2601
|
return idx.keys ?? [];
|
|
2602
2602
|
} else {
|
|
2603
|
-
log$
|
|
2603
|
+
log$N.info(
|
|
2604
2604
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
2605
2605
|
);
|
|
2606
2606
|
return [];
|
|
@@ -2612,7 +2612,7 @@ class KosModelContainer {
|
|
|
2612
2612
|
if (idx.index.has(indexKey)) {
|
|
2613
2613
|
return idx.getByKey(indexKey);
|
|
2614
2614
|
} else {
|
|
2615
|
-
log$
|
|
2615
|
+
log$N.info(
|
|
2616
2616
|
`key ${indexKey} not found in ${indexName} index: ${Array.from(
|
|
2617
2617
|
idx.index.keys()
|
|
2618
2618
|
)}`
|
|
@@ -2620,7 +2620,7 @@ class KosModelContainer {
|
|
|
2620
2620
|
return [];
|
|
2621
2621
|
}
|
|
2622
2622
|
} else {
|
|
2623
|
-
log$
|
|
2623
|
+
log$N.info(
|
|
2624
2624
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
2625
2625
|
);
|
|
2626
2626
|
return [];
|
|
@@ -2647,7 +2647,7 @@ class KosModelContainer {
|
|
|
2647
2647
|
* @private
|
|
2648
2648
|
*/
|
|
2649
2649
|
_logCapacityWarning(toEvict) {
|
|
2650
|
-
log$
|
|
2650
|
+
log$N.info(
|
|
2651
2651
|
`Container capacity exceeded (${this._data.size}/${this._maxCapacity}). Evicting ${toEvict} models using ${this._evictionStrategy} strategy.`,
|
|
2652
2652
|
{ parentId: this._parentId }
|
|
2653
2653
|
);
|
|
@@ -2710,7 +2710,7 @@ class KosModelContainer {
|
|
|
2710
2710
|
const candidates = this._customEvictionFilter(this.data);
|
|
2711
2711
|
return candidates.slice(0, count);
|
|
2712
2712
|
}
|
|
2713
|
-
log$
|
|
2713
|
+
log$N.error(
|
|
2714
2714
|
"Custom eviction strategy specified but no customEvictionFilter provided. Falling back to FIFO.",
|
|
2715
2715
|
{ parentId: this._parentId }
|
|
2716
2716
|
);
|
|
@@ -2722,7 +2722,7 @@ class KosModelContainer {
|
|
|
2722
2722
|
*/
|
|
2723
2723
|
async _removeEvictedModels(models2) {
|
|
2724
2724
|
for (const model of models2) {
|
|
2725
|
-
log$
|
|
2725
|
+
log$N.info(
|
|
2726
2726
|
`Evicting model: ${model.id} (type: ${model.constructor.name})`,
|
|
2727
2727
|
{
|
|
2728
2728
|
modelId: model.id,
|
|
@@ -2732,7 +2732,7 @@ class KosModelContainer {
|
|
|
2732
2732
|
);
|
|
2733
2733
|
this.removeModel(model.id, true);
|
|
2734
2734
|
destroyKosModel(model).catch(
|
|
2735
|
-
(e) => log$
|
|
2735
|
+
(e) => log$N.error(`Failed to destroy evicted model ${model.id}:`, e)
|
|
2736
2736
|
);
|
|
2737
2737
|
}
|
|
2738
2738
|
}
|
|
@@ -2741,7 +2741,7 @@ class KosModelContainer {
|
|
|
2741
2741
|
* @private
|
|
2742
2742
|
*/
|
|
2743
2743
|
_logEvictionComplete(evictedCount) {
|
|
2744
|
-
log$
|
|
2744
|
+
log$N.info(
|
|
2745
2745
|
`Evicted ${evictedCount} models. Current size: ${this._data.size}/${this._maxCapacity}`,
|
|
2746
2746
|
{ parentId: this._parentId }
|
|
2747
2747
|
);
|
|
@@ -2750,9 +2750,9 @@ class KosModelContainer {
|
|
|
2750
2750
|
this._data.forEach((model) => {
|
|
2751
2751
|
const modelId = model.id;
|
|
2752
2752
|
destroyKosModel(model).then(() => {
|
|
2753
|
-
log$
|
|
2753
|
+
log$N.debug(`${modelId} destroyed, removing from map`);
|
|
2754
2754
|
this.removeModel(modelId, true);
|
|
2755
|
-
}).catch((e) => log$
|
|
2755
|
+
}).catch((e) => log$N.error(e));
|
|
2756
2756
|
});
|
|
2757
2757
|
this.increment();
|
|
2758
2758
|
}
|
|
@@ -2967,7 +2967,7 @@ const getKosModelActivationState = (model) => {
|
|
|
2967
2967
|
}
|
|
2968
2968
|
};
|
|
2969
2969
|
};
|
|
2970
|
-
const log$
|
|
2970
|
+
const log$M = KosLog.createLogger({ name: "kos-model-factory" });
|
|
2971
2971
|
const KosModelFactory = {
|
|
2972
2972
|
byModelType: (modelType) => KosCore.getInstance().modelManager.getModelFactory(
|
|
2973
2973
|
modelType
|
|
@@ -2975,7 +2975,7 @@ const KosModelFactory = {
|
|
|
2975
2975
|
getModelInstance: (id, modelType, options) => {
|
|
2976
2976
|
const factory = KosModelFactory.byModelType(modelType);
|
|
2977
2977
|
if (!factory) {
|
|
2978
|
-
log$
|
|
2978
|
+
log$M.error(
|
|
2979
2979
|
`No registered factory found for model type ${modelType}. Please register a factory for this model type. `
|
|
2980
2980
|
);
|
|
2981
2981
|
throw Error(`No factory found for model type ${modelType}`);
|
|
@@ -3286,7 +3286,7 @@ class SingletonKosModelRegistrationFactory extends KosBaseModelRegistration {
|
|
|
3286
3286
|
};
|
|
3287
3287
|
}
|
|
3288
3288
|
}
|
|
3289
|
-
const log$
|
|
3289
|
+
const log$L = KosLog.createLogger({ group: "decorators", name: "kos-model" });
|
|
3290
3290
|
function resolveParentContext(TargetClass, modelId, modelData) {
|
|
3291
3291
|
const parentIdRaw = TargetClass[ParentModel]?.parentId;
|
|
3292
3292
|
if (!parentIdRaw) return;
|
|
@@ -3590,7 +3590,7 @@ function injectCompanionSupport(modelInstance, initialData) {
|
|
|
3590
3590
|
const { mode, parentProperty, excludeProperties } = companionConfig;
|
|
3591
3591
|
const parentModel = initialData.companionParent;
|
|
3592
3592
|
if (!parentModel) {
|
|
3593
|
-
log$
|
|
3593
|
+
log$L.warn(
|
|
3594
3594
|
`Companion decorator configured but no parent model found in initialData.companionParent`
|
|
3595
3595
|
);
|
|
3596
3596
|
return;
|
|
@@ -3664,7 +3664,7 @@ function injectCompanionSupport(modelInstance, initialData) {
|
|
|
3664
3664
|
});
|
|
3665
3665
|
}
|
|
3666
3666
|
} catch (error) {
|
|
3667
|
-
log$
|
|
3667
|
+
log$L.debug(
|
|
3668
3668
|
`Skipping companion proxy for property ${propertyName}:`,
|
|
3669
3669
|
error
|
|
3670
3670
|
);
|
|
@@ -3692,7 +3692,7 @@ function makeSafeObservable$1(instance) {
|
|
|
3692
3692
|
try {
|
|
3693
3693
|
return makeAutoObservable(instance);
|
|
3694
3694
|
} catch (e) {
|
|
3695
|
-
log$
|
|
3695
|
+
log$L.error("Failed to make observable:", e);
|
|
3696
3696
|
return instance;
|
|
3697
3697
|
}
|
|
3698
3698
|
}
|
|
@@ -4176,7 +4176,7 @@ const KosDeletionManager = {
|
|
|
4176
4176
|
}
|
|
4177
4177
|
}
|
|
4178
4178
|
};
|
|
4179
|
-
const log$
|
|
4179
|
+
const log$K = KosLog.createLogger({ name: "kos-dependency-manager" });
|
|
4180
4180
|
class KosDependencyManager {
|
|
4181
4181
|
_usedByCache = /* @__PURE__ */ new Map();
|
|
4182
4182
|
_usesCache = /* @__PURE__ */ new Map();
|
|
@@ -4231,7 +4231,7 @@ class KosDependencyManager {
|
|
|
4231
4231
|
canDestroy(modelId) {
|
|
4232
4232
|
const usedBy = this._usedByCache.get(modelId);
|
|
4233
4233
|
if (usedBy?.length) {
|
|
4234
|
-
log$
|
|
4234
|
+
log$K.info(`Model ${modelId} is still used by: ${usedBy.join(", ")}`);
|
|
4235
4235
|
return false;
|
|
4236
4236
|
}
|
|
4237
4237
|
return true;
|
|
@@ -4241,7 +4241,7 @@ class KosDependencyManager {
|
|
|
4241
4241
|
this._usesCache.clear();
|
|
4242
4242
|
}
|
|
4243
4243
|
}
|
|
4244
|
-
const log$
|
|
4244
|
+
const log$J = KosLog.createLogger({ name: "kos-model-cache" });
|
|
4245
4245
|
class KosModelCache {
|
|
4246
4246
|
constructor(preloadKeys = []) {
|
|
4247
4247
|
this.preloadKeys = preloadKeys;
|
|
@@ -4292,11 +4292,11 @@ class KosModelCache {
|
|
|
4292
4292
|
}
|
|
4293
4293
|
preload(createFn) {
|
|
4294
4294
|
if (this._isPreloaded) {
|
|
4295
|
-
log$
|
|
4295
|
+
log$J.debug("Returning cached preloaded models");
|
|
4296
4296
|
return this._preloaded;
|
|
4297
4297
|
}
|
|
4298
4298
|
this._preloaded = this.preloadKeys.map((key) => {
|
|
4299
|
-
log$
|
|
4299
|
+
log$J.debug(
|
|
4300
4300
|
`Preloading model: ${typeof key === "string" ? key : key.modelType}`
|
|
4301
4301
|
);
|
|
4302
4302
|
return createFn(key);
|
|
@@ -4398,7 +4398,7 @@ function logModelInstantiationError(error, context) {
|
|
|
4398
4398
|
});
|
|
4399
4399
|
}
|
|
4400
4400
|
const isKosCompanionTypeFactory = (obj) => typeof obj === "function";
|
|
4401
|
-
const log$
|
|
4401
|
+
const log$I = KosLog.createLogger({ name: "kos-companion-instantiator" });
|
|
4402
4402
|
class KosCompanionInstantiator {
|
|
4403
4403
|
constructor(registry, cache2, createModel) {
|
|
4404
4404
|
this.registry = registry;
|
|
@@ -4420,7 +4420,7 @@ class KosCompanionInstantiator {
|
|
|
4420
4420
|
createCompanionModels(model, options, lifecycle) {
|
|
4421
4421
|
const companionDefs = this.getCompanionDefinitions(model.modelTypeName);
|
|
4422
4422
|
if (lifecycle !== void 0) {
|
|
4423
|
-
log$
|
|
4423
|
+
log$I.debug(
|
|
4424
4424
|
`Creating ${lifecycle} lifecycle companions for ${model.modelTypeName} [${model.modelId}]`
|
|
4425
4425
|
);
|
|
4426
4426
|
}
|
|
@@ -4463,7 +4463,7 @@ class KosCompanionInstantiator {
|
|
|
4463
4463
|
resolveFactoryCompanion(companionDef, model, options, requestedLifecycle) {
|
|
4464
4464
|
const companionType = companionDef.type(model.modelData, options);
|
|
4465
4465
|
if (!companionType) {
|
|
4466
|
-
log$
|
|
4466
|
+
log$I.debug(
|
|
4467
4467
|
`Companion factory returned undefined for ${model.modelTypeName} at ${requestedLifecycle || "INIT"} phase`
|
|
4468
4468
|
);
|
|
4469
4469
|
return null;
|
|
@@ -4522,7 +4522,7 @@ class KosCompanionInstantiator {
|
|
|
4522
4522
|
);
|
|
4523
4523
|
if (companion) {
|
|
4524
4524
|
this.attachCompanionToParent(companion, parentModel);
|
|
4525
|
-
log$
|
|
4525
|
+
log$I.debug(
|
|
4526
4526
|
`Created ${lifecycle || "INIT"} companion ${companionType} for ${parentModel.modelTypeName} [${parentModel.modelId}]`
|
|
4527
4527
|
);
|
|
4528
4528
|
}
|
|
@@ -4538,7 +4538,7 @@ class KosCompanionInstantiator {
|
|
|
4538
4538
|
*/
|
|
4539
4539
|
companionAlreadyExists(companionId, companionType, parentTypeName) {
|
|
4540
4540
|
if (this.cache.hasModel(companionId)) {
|
|
4541
|
-
log$
|
|
4541
|
+
log$I.debug(
|
|
4542
4542
|
`Companion ${companionType} already exists for ${parentTypeName}`
|
|
4543
4543
|
);
|
|
4544
4544
|
return true;
|
|
@@ -5234,7 +5234,7 @@ class KosEffectManager {
|
|
|
5234
5234
|
this.disposers = [];
|
|
5235
5235
|
}
|
|
5236
5236
|
}
|
|
5237
|
-
const log$
|
|
5237
|
+
const log$H = KosLog.createLogger({ name: "model-active-machine" });
|
|
5238
5238
|
const activeMachine = (model) => {
|
|
5239
5239
|
const machine2 = createMachine(KosModelState.INACTIVE, {
|
|
5240
5240
|
[KosModelState.FAILED]: state(
|
|
@@ -5289,11 +5289,11 @@ const activeMachine = (model) => {
|
|
|
5289
5289
|
});
|
|
5290
5290
|
const service2 = interpret(
|
|
5291
5291
|
machine2,
|
|
5292
|
-
(_service) => log$
|
|
5292
|
+
(_service) => log$H.debug(_service.machine.current)
|
|
5293
5293
|
);
|
|
5294
5294
|
return { service: service2, machine: machine2 };
|
|
5295
5295
|
};
|
|
5296
|
-
const log$
|
|
5296
|
+
const log$G = KosLog.createLogger({ name: "model-online-machine" });
|
|
5297
5297
|
const onlineMachine = (model) => {
|
|
5298
5298
|
const machine2 = createMachine(KosModelState.OFFLINE, {
|
|
5299
5299
|
[KosModelState.ONLINE]: state(
|
|
@@ -5311,7 +5311,7 @@ const onlineMachine = (model) => {
|
|
|
5311
5311
|
KosModelEvents.GO_ONLINE,
|
|
5312
5312
|
KosModelState.ONLINE,
|
|
5313
5313
|
action$1(async () => {
|
|
5314
|
-
log$
|
|
5314
|
+
log$G.debug(`Going online with model ${model.modelId}`);
|
|
5315
5315
|
await model.online();
|
|
5316
5316
|
model.onlineStatus = KosModelState.ONLINE;
|
|
5317
5317
|
await model.fsm.transitionTo(
|
|
@@ -5324,7 +5324,7 @@ const onlineMachine = (model) => {
|
|
|
5324
5324
|
});
|
|
5325
5325
|
const service2 = interpret(
|
|
5326
5326
|
machine2,
|
|
5327
|
-
(_service) => log$
|
|
5327
|
+
(_service) => log$G.debug(_service.machine.current)
|
|
5328
5328
|
);
|
|
5329
5329
|
return { machine: machine2, service: service2 };
|
|
5330
5330
|
};
|
|
@@ -5469,11 +5469,11 @@ const machine = (model) => {
|
|
|
5469
5469
|
[KosModelState.FAILED]: state()
|
|
5470
5470
|
});
|
|
5471
5471
|
};
|
|
5472
|
-
const log$
|
|
5472
|
+
const log$F = KosLog.createLogger({ name: "kos-model-lifecycle" });
|
|
5473
5473
|
const fsm = (model) => {
|
|
5474
5474
|
const service2 = interpret(
|
|
5475
5475
|
machine(model),
|
|
5476
|
-
(_service) => log$
|
|
5476
|
+
(_service) => log$F.debug(
|
|
5477
5477
|
`state machine for model ${model.modelId}: ${_service.machine.current});`
|
|
5478
5478
|
)
|
|
5479
5479
|
);
|
|
@@ -6453,7 +6453,7 @@ class TransportNotReadyError extends Error {
|
|
|
6453
6453
|
}
|
|
6454
6454
|
}
|
|
6455
6455
|
const isTransportNotReadyError = (error) => !!error && error.code === TRANSPORT_NOT_READY;
|
|
6456
|
-
const log$
|
|
6456
|
+
const log$E = KosLog.createLogger({ name: "kos-fetch" });
|
|
6457
6457
|
const DEFAULT_WS_TIMEOUT = 3e4;
|
|
6458
6458
|
const WS_TIMEOUT = (() => {
|
|
6459
6459
|
const configured = process.env.KOS_WS_TIMEOUT ? parseInt(process.env.KOS_WS_TIMEOUT) : DEFAULT_WS_TIMEOUT;
|
|
@@ -6518,7 +6518,7 @@ const kosFetchWs = async (url, options) => {
|
|
|
6518
6518
|
const requestId = uuid();
|
|
6519
6519
|
const urlObj = new URL(url);
|
|
6520
6520
|
const path = `${urlObj.pathname}${urlObj.search}`;
|
|
6521
|
-
log$
|
|
6521
|
+
log$E.debug(`path: ${path}`);
|
|
6522
6522
|
const budget = resolveTimeoutBudget(options?.timeout);
|
|
6523
6523
|
const messageFactory = fetchMessageFactory(options);
|
|
6524
6524
|
const signal = createRequestSignal(budget, options?.signal);
|
|
@@ -6526,12 +6526,12 @@ const kosFetchWs = async (url, options) => {
|
|
|
6526
6526
|
await transport.whenReady({ signal });
|
|
6527
6527
|
} catch (error) {
|
|
6528
6528
|
if (isTimeoutReason(error)) {
|
|
6529
|
-
log$
|
|
6529
|
+
log$E.error(
|
|
6530
6530
|
`Transport not ready${budget === void 0 ? "" : ` after ${budget}ms`} - request not sent - url: ${url}`
|
|
6531
6531
|
);
|
|
6532
6532
|
throw new TransportNotReadyError({ timeout: budget, url });
|
|
6533
6533
|
}
|
|
6534
|
-
log$
|
|
6534
|
+
log$E.debug(`Request aborted while waiting for transport - url: ${url}`);
|
|
6535
6535
|
throw error;
|
|
6536
6536
|
}
|
|
6537
6537
|
const processedBody = await processRequestBody(options?.body);
|
|
@@ -6560,9 +6560,9 @@ const kosFetchWs = async (url, options) => {
|
|
|
6560
6560
|
if (signal.aborted) {
|
|
6561
6561
|
const reason = signal.reason;
|
|
6562
6562
|
if (reason?.name === "TimeoutError") {
|
|
6563
|
-
log$
|
|
6563
|
+
log$E.error(`Timeout occurred - url: ${url}`);
|
|
6564
6564
|
} else {
|
|
6565
|
-
log$
|
|
6565
|
+
log$E.debug(`Request aborted - url: ${url}`);
|
|
6566
6566
|
}
|
|
6567
6567
|
reject(reason || new DOMException("Aborted", "AbortError"));
|
|
6568
6568
|
return;
|
|
@@ -6571,9 +6571,9 @@ const kosFetchWs = async (url, options) => {
|
|
|
6571
6571
|
if (unsubscribe) unsubscribe();
|
|
6572
6572
|
const reason = signal.reason;
|
|
6573
6573
|
if (reason?.name === "TimeoutError") {
|
|
6574
|
-
log$
|
|
6574
|
+
log$E.error(`Timeout occurred - url: ${url}`);
|
|
6575
6575
|
} else {
|
|
6576
|
-
log$
|
|
6576
|
+
log$E.debug(`Request aborted - url: ${url}`);
|
|
6577
6577
|
}
|
|
6578
6578
|
reject(reason || new DOMException("Aborted", "AbortError"));
|
|
6579
6579
|
};
|
|
@@ -6589,7 +6589,7 @@ const kosFetchWs = async (url, options) => {
|
|
|
6589
6589
|
try {
|
|
6590
6590
|
bodyData = base64ToArrayBuffer(responseBody);
|
|
6591
6591
|
} catch (e) {
|
|
6592
|
-
log$
|
|
6592
|
+
log$E.error("Failed to decode base64 response", e);
|
|
6593
6593
|
}
|
|
6594
6594
|
}
|
|
6595
6595
|
const response = {
|
|
@@ -6643,7 +6643,7 @@ const kosFetchWs = async (url, options) => {
|
|
|
6643
6643
|
});
|
|
6644
6644
|
}
|
|
6645
6645
|
if (parsed.files) {
|
|
6646
|
-
log$
|
|
6646
|
+
log$E.warn(
|
|
6647
6647
|
"File reconstruction in FormData not fully implemented"
|
|
6648
6648
|
);
|
|
6649
6649
|
}
|
|
@@ -6694,7 +6694,7 @@ const resolveBaseUrl = () => {
|
|
|
6694
6694
|
const URL2 = BASE_URL;
|
|
6695
6695
|
return { isMock: MOCK, URL: URL2 };
|
|
6696
6696
|
};
|
|
6697
|
-
const log$
|
|
6697
|
+
const log$D = KosLog.createLogger({ name: "kos-service-request" });
|
|
6698
6698
|
const ERROR_UNKNOWN = "errUnknown";
|
|
6699
6699
|
const ERROR_TRANSPORT_NOT_READY = "Transport not ready";
|
|
6700
6700
|
const MUTATING_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "DELETE", "PATCH"]);
|
|
@@ -6720,7 +6720,7 @@ async function clientRequest(endpoint, method, options, params2, body) {
|
|
|
6720
6720
|
)}`
|
|
6721
6721
|
).join("&") : "";
|
|
6722
6722
|
const fullUrl = `${resolveBaseUrl().URL}${url}${query ? `?${query}` : ""}`;
|
|
6723
|
-
log$
|
|
6723
|
+
log$D.debug(`fullUrl: ${fullUrl}`);
|
|
6724
6724
|
const fetchOptions = {
|
|
6725
6725
|
method: String(method).toUpperCase(),
|
|
6726
6726
|
body: null,
|
|
@@ -6747,20 +6747,20 @@ async function executeFetch(fullUrl, fetchOptions) {
|
|
|
6747
6747
|
return [null, payload.data ?? payload];
|
|
6748
6748
|
} catch (error) {
|
|
6749
6749
|
if (isTransportNotReadyError(error)) {
|
|
6750
|
-
log$
|
|
6750
|
+
log$D.error(`Transport not ready, request not sent: ${fullUrl}`);
|
|
6751
6751
|
return [ERROR_TRANSPORT_NOT_READY, null];
|
|
6752
6752
|
}
|
|
6753
6753
|
if (error instanceof DOMException) {
|
|
6754
6754
|
if (error.name === "TimeoutError") {
|
|
6755
|
-
log$
|
|
6755
|
+
log$D.error(`Request timed out: ${fullUrl}`);
|
|
6756
6756
|
return ["Request timed out", null];
|
|
6757
6757
|
}
|
|
6758
6758
|
if (error.name === "AbortError") {
|
|
6759
|
-
log$
|
|
6759
|
+
log$D.debug(`Request aborted: ${fullUrl}`);
|
|
6760
6760
|
return ["Request aborted", null];
|
|
6761
6761
|
}
|
|
6762
6762
|
}
|
|
6763
|
-
log$
|
|
6763
|
+
log$D.error(`Unexpected error during fetch: ${error}`);
|
|
6764
6764
|
return [error instanceof Error ? error.message : ERROR_UNKNOWN, null];
|
|
6765
6765
|
}
|
|
6766
6766
|
}
|
|
@@ -6780,38 +6780,38 @@ async function executeFetchWithRetry(fullUrl, fetchOptions, config2) {
|
|
|
6780
6780
|
errorContext
|
|
6781
6781
|
];
|
|
6782
6782
|
if (config2.retryOn && !config2.retryOn(response)) {
|
|
6783
|
-
log$
|
|
6783
|
+
log$D.debug(
|
|
6784
6784
|
`Retry predicate returned false for ${fullUrl} (status ${response.status}), stopping`
|
|
6785
6785
|
);
|
|
6786
6786
|
return lastResult;
|
|
6787
6787
|
}
|
|
6788
6788
|
if (attempt < config2.maxAttempts) {
|
|
6789
6789
|
const delayMs = config2.baseDelayMs * Math.pow(config2.backoffFactor, attempt - 1);
|
|
6790
|
-
log$
|
|
6790
|
+
log$D.warn(
|
|
6791
6791
|
`Request to ${fullUrl} failed (status ${response.status}), retrying in ${delayMs}ms (attempt ${attempt}/${config2.maxAttempts})`
|
|
6792
6792
|
);
|
|
6793
6793
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
6794
6794
|
}
|
|
6795
6795
|
} catch (error) {
|
|
6796
6796
|
if (isTransportNotReadyError(error)) {
|
|
6797
|
-
log$
|
|
6797
|
+
log$D.error(`Transport not ready, request not sent: ${fullUrl}`);
|
|
6798
6798
|
return [ERROR_TRANSPORT_NOT_READY, null];
|
|
6799
6799
|
}
|
|
6800
6800
|
if (error instanceof DOMException) {
|
|
6801
6801
|
if (error.name === "TimeoutError") {
|
|
6802
|
-
log$
|
|
6802
|
+
log$D.error(`Request timed out: ${fullUrl}`);
|
|
6803
6803
|
return ["Request timed out", null];
|
|
6804
6804
|
}
|
|
6805
6805
|
if (error.name === "AbortError") {
|
|
6806
|
-
log$
|
|
6806
|
+
log$D.debug(`Request aborted: ${fullUrl}`);
|
|
6807
6807
|
return ["Request aborted", null];
|
|
6808
6808
|
}
|
|
6809
6809
|
}
|
|
6810
|
-
log$
|
|
6810
|
+
log$D.error(`Unexpected error during fetch: ${error}`);
|
|
6811
6811
|
return [error instanceof Error ? error.message : ERROR_UNKNOWN, null];
|
|
6812
6812
|
}
|
|
6813
6813
|
}
|
|
6814
|
-
log$
|
|
6814
|
+
log$D.error(`All ${config2.maxAttempts} attempts failed for ${fullUrl}`);
|
|
6815
6815
|
return lastResult;
|
|
6816
6816
|
}
|
|
6817
6817
|
async function captureErrorResponseContext(response) {
|
|
@@ -6860,7 +6860,7 @@ const service$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
6860
6860
|
default: api$9,
|
|
6861
6861
|
kosServiceRequest: kosServiceRequest$8
|
|
6862
6862
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6863
|
-
const log$
|
|
6863
|
+
const log$C = KosLog.createLogger({
|
|
6864
6864
|
name: "kos-service-request-manager",
|
|
6865
6865
|
group: "Model"
|
|
6866
6866
|
});
|
|
@@ -6913,7 +6913,7 @@ function isValueMissing(value) {
|
|
|
6913
6913
|
}
|
|
6914
6914
|
function validateRequiredField(value, fieldName, path, isRequired) {
|
|
6915
6915
|
if (isRequired && isValueMissing(value)) {
|
|
6916
|
-
log$
|
|
6916
|
+
log$C.warn(
|
|
6917
6917
|
`Required field '${fieldName}' is missing in response for ${path}`
|
|
6918
6918
|
);
|
|
6919
6919
|
}
|
|
@@ -6945,7 +6945,7 @@ class ServiceRequestManager {
|
|
|
6945
6945
|
this.handlers.get(lifecycle).push(metadata);
|
|
6946
6946
|
});
|
|
6947
6947
|
if (Object.keys(handlerMetadata).length > 0) {
|
|
6948
|
-
log$
|
|
6948
|
+
log$C.debug(
|
|
6949
6949
|
`Discovered ${Object.keys(handlerMetadata).length} service request handlers for model ${this.model.id}`
|
|
6950
6950
|
);
|
|
6951
6951
|
}
|
|
@@ -6960,7 +6960,7 @@ class ServiceRequestManager {
|
|
|
6960
6960
|
if (!handlers || handlers.length === 0) {
|
|
6961
6961
|
return;
|
|
6962
6962
|
}
|
|
6963
|
-
log$
|
|
6963
|
+
log$C.debug(
|
|
6964
6964
|
`Executing ${handlers.length} service requests for lifecycle ${lifecycle}`
|
|
6965
6965
|
);
|
|
6966
6966
|
await Promise.all(handlers.map((handler) => this.executeHandler(handler)));
|
|
@@ -6985,7 +6985,7 @@ class ServiceRequestManager {
|
|
|
6985
6985
|
*/
|
|
6986
6986
|
shouldProcessRequest(metadata) {
|
|
6987
6987
|
if (!shouldExecuteRequest(metadata, this.model)) {
|
|
6988
|
-
log$
|
|
6988
|
+
log$C.debug(`Skipping request ${metadata.path} - condition returned false`);
|
|
6989
6989
|
return false;
|
|
6990
6990
|
}
|
|
6991
6991
|
return true;
|
|
@@ -7202,7 +7202,7 @@ class ServiceRequestManager {
|
|
|
7202
7202
|
case "json":
|
|
7203
7203
|
return typeof value === "string" ? JSON.parse(value) : value;
|
|
7204
7204
|
default:
|
|
7205
|
-
log$
|
|
7205
|
+
log$C.warn(`Unknown transformer: ${transform}`);
|
|
7206
7206
|
return value;
|
|
7207
7207
|
}
|
|
7208
7208
|
}
|
|
@@ -7213,7 +7213,7 @@ class ServiceRequestManager {
|
|
|
7213
7213
|
if (!metadata.iterateOver) return data;
|
|
7214
7214
|
const array = this.getNestedValue(data, metadata.iterateOver);
|
|
7215
7215
|
if (!Array.isArray(array)) {
|
|
7216
|
-
log$
|
|
7216
|
+
log$C.warn(
|
|
7217
7217
|
`iterateOver path '${metadata.iterateOver}' did not resolve to an array`
|
|
7218
7218
|
);
|
|
7219
7219
|
return [];
|
|
@@ -7256,7 +7256,7 @@ class ServiceRequestManager {
|
|
|
7256
7256
|
case "throw":
|
|
7257
7257
|
throw error;
|
|
7258
7258
|
case "log":
|
|
7259
|
-
log$
|
|
7259
|
+
log$C.error(
|
|
7260
7260
|
`Service request failed for ${metadata.path}:`,
|
|
7261
7261
|
error.message
|
|
7262
7262
|
);
|
|
@@ -9734,7 +9734,7 @@ class BridgeTransport {
|
|
|
9734
9734
|
messageQueue = [];
|
|
9735
9735
|
isSending = false;
|
|
9736
9736
|
constructor(addr) {
|
|
9737
|
-
log$
|
|
9737
|
+
log$S.debug(`called Bridge Transport with addr ${addr}`);
|
|
9738
9738
|
const that = this;
|
|
9739
9739
|
globalThis.kosWindowWebsocketRecv = (msg) => {
|
|
9740
9740
|
if (that.onmessage) {
|
|
@@ -9742,19 +9742,19 @@ class BridgeTransport {
|
|
|
9742
9742
|
that.onmessage(data);
|
|
9743
9743
|
}
|
|
9744
9744
|
};
|
|
9745
|
-
log$
|
|
9745
|
+
log$S.debug("Opening bridge transport");
|
|
9746
9746
|
globalThis.kosWindowWebsocketOpen();
|
|
9747
|
-
log$
|
|
9747
|
+
log$S.debug("Opened bridge transport");
|
|
9748
9748
|
this._onclose = null;
|
|
9749
9749
|
this._onerror = null;
|
|
9750
9750
|
this._onmessage = null;
|
|
9751
9751
|
this._onopen = null;
|
|
9752
|
-
this.addEventListener = () => log$
|
|
9753
|
-
this.dispatchEvent = () => log$
|
|
9754
|
-
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");
|
|
9755
9755
|
}
|
|
9756
9756
|
close() {
|
|
9757
|
-
log$
|
|
9757
|
+
log$S.debug("closing");
|
|
9758
9758
|
}
|
|
9759
9759
|
sendNextMessage() {
|
|
9760
9760
|
if (this.messageQueue.length > 0) {
|
|
@@ -9969,7 +9969,7 @@ if (params$1.fos) {
|
|
|
9969
9969
|
const fosPort = process.env.KOS_FOS_PORT;
|
|
9970
9970
|
window.kosUseFos = !!(window.kosUseFos || process.env.KOS_USE_FOS === "true");
|
|
9971
9971
|
window.kosFosPort = fosPort ? parseInt(fosPort) : 0;
|
|
9972
|
-
const log$
|
|
9972
|
+
const log$B = log$S.getLogger("web-socket-transport");
|
|
9973
9973
|
var KosWSTransportStatus = /* @__PURE__ */ ((KosWSTransportStatus2) => {
|
|
9974
9974
|
KosWSTransportStatus2["NOT_INITIALIZED"] = "not_initialized";
|
|
9975
9975
|
KosWSTransportStatus2["INITIALIZED"] = "initialized";
|
|
@@ -10026,7 +10026,7 @@ class WebSocketTransport {
|
|
|
10026
10026
|
() => this.connectionEstablished,
|
|
10027
10027
|
(connectionEstablished) => {
|
|
10028
10028
|
if (connectionEstablished) {
|
|
10029
|
-
log$
|
|
10029
|
+
log$B.warn("Connection Established");
|
|
10030
10030
|
this.reconnectAttempts = 0;
|
|
10031
10031
|
publish(
|
|
10032
10032
|
WebSocketEvents.CONNECTED,
|
|
@@ -10077,7 +10077,7 @@ class WebSocketTransport {
|
|
|
10077
10077
|
protocol: this.protocol,
|
|
10078
10078
|
alias: this.alias,
|
|
10079
10079
|
onConnectionLost: () => {
|
|
10080
|
-
log$
|
|
10080
|
+
log$B.error(`Connection Lost`);
|
|
10081
10081
|
this.scheduleReconnect();
|
|
10082
10082
|
}
|
|
10083
10083
|
});
|
|
@@ -10123,7 +10123,7 @@ class WebSocketTransport {
|
|
|
10123
10123
|
return Math.floor(exponentialDelay + jitter);
|
|
10124
10124
|
}
|
|
10125
10125
|
_sendSubscriptionMessage(topic, type, fos = false, bridge = false, connectionId, explicitDestination = false) {
|
|
10126
|
-
log$
|
|
10126
|
+
log$B.debug(`${type} to topic ${topic}`);
|
|
10127
10127
|
let connId;
|
|
10128
10128
|
if (explicitDestination) {
|
|
10129
10129
|
connId = connectionId;
|
|
@@ -10132,7 +10132,7 @@ class WebSocketTransport {
|
|
|
10132
10132
|
const connectionParam = params2?.connId;
|
|
10133
10133
|
connId = connectionId ?? connectionParam ?? window?.kosBridge?.("connId");
|
|
10134
10134
|
}
|
|
10135
|
-
log$
|
|
10135
|
+
log$B.debug(`subscribing with connId ${connId}`);
|
|
10136
10136
|
const dstAddr = connId ? `dst-addr:${connId}
|
|
10137
10137
|
` : "";
|
|
10138
10138
|
const msg = fos ? `subscribe:${topic}` : bridge ? `type:fos.broker
|
|
@@ -10146,7 +10146,7 @@ ${dstAddr}topics:${topic}
|
|
|
10146
10146
|
const socket = fos ? this.fosSocket : this.socket;
|
|
10147
10147
|
socket?.socket?.send(msg);
|
|
10148
10148
|
} else {
|
|
10149
|
-
log$
|
|
10149
|
+
log$B.debug(`no connection adding to offline messages`);
|
|
10150
10150
|
const socket = fos ? this.fosSocket : this.socket;
|
|
10151
10151
|
socket?.addOfflineMessage(msg);
|
|
10152
10152
|
}
|
|
@@ -10160,7 +10160,7 @@ ${dstAddr}topics:${topic}
|
|
|
10160
10160
|
explicitDestination
|
|
10161
10161
|
}) {
|
|
10162
10162
|
const { unsubscribe, count } = subscribe(topic, callback);
|
|
10163
|
-
log$
|
|
10163
|
+
log$B.debug(`Topic ${topic} currently has ${count} subscribers`);
|
|
10164
10164
|
this._sendSubscriptionMessage(
|
|
10165
10165
|
topic,
|
|
10166
10166
|
"subscribe",
|
|
@@ -10171,7 +10171,7 @@ ${dstAddr}topics:${topic}
|
|
|
10171
10171
|
);
|
|
10172
10172
|
return () => {
|
|
10173
10173
|
const { count: count2 } = unsubscribe();
|
|
10174
|
-
log$
|
|
10174
|
+
log$B.debug(`Topic ${topic} currently has ${count2} subscribers`);
|
|
10175
10175
|
if (count2 === 0) {
|
|
10176
10176
|
this._sendSubscriptionMessage(
|
|
10177
10177
|
topic,
|
|
@@ -11018,7 +11018,7 @@ class KosModelComponentFactory {
|
|
|
11018
11018
|
return components;
|
|
11019
11019
|
}
|
|
11020
11020
|
}
|
|
11021
|
-
const log$
|
|
11021
|
+
const log$A = log$S.getLogger("kos-model");
|
|
11022
11022
|
const MODEL_LOADER = "kos.extension.model.loader";
|
|
11023
11023
|
class KosModel {
|
|
11024
11024
|
_id;
|
|
@@ -11126,23 +11126,23 @@ class KosModel {
|
|
|
11126
11126
|
return this._status === KosModelState.READY;
|
|
11127
11127
|
}
|
|
11128
11128
|
async deactivate() {
|
|
11129
|
-
log$
|
|
11129
|
+
log$A.debug(
|
|
11130
11130
|
`deactivating model ${this.modelTypeName} with id ${this.modelId}`
|
|
11131
11131
|
);
|
|
11132
11132
|
try {
|
|
11133
11133
|
const context = KosContextManager.getContext(this.modelId);
|
|
11134
11134
|
await this.modelData?.deactivate?.(context);
|
|
11135
|
-
log$
|
|
11135
|
+
log$A.debug(
|
|
11136
11136
|
`Model ${this.modelTypeName} with id ${this.modelId} deactivated`
|
|
11137
11137
|
);
|
|
11138
11138
|
this.subscriptionManager?.deactivate();
|
|
11139
11139
|
} catch (e) {
|
|
11140
|
-
log$
|
|
11140
|
+
log$A.debug(`Model ${this.modelId} failed to deactivated`);
|
|
11141
11141
|
throw e;
|
|
11142
11142
|
}
|
|
11143
11143
|
}
|
|
11144
11144
|
async activate() {
|
|
11145
|
-
log$
|
|
11145
|
+
log$A.debug(`activating model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11146
11146
|
await executeDependentModelLifecycle(this, DependencyLifecycle.ACTIVATE);
|
|
11147
11147
|
try {
|
|
11148
11148
|
await this.serviceRequestManager?.executeForLifecycle(
|
|
@@ -11151,16 +11151,16 @@ class KosModel {
|
|
|
11151
11151
|
const context = KosContextManager.getContext(this.modelId);
|
|
11152
11152
|
await this.modelData?.activate?.(context);
|
|
11153
11153
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.ACTIVATE);
|
|
11154
|
-
log$
|
|
11154
|
+
log$A.debug(
|
|
11155
11155
|
`Model ${this.modelTypeName} with id ${this.modelId} subscribing to all topics`
|
|
11156
11156
|
);
|
|
11157
11157
|
this.subscriptionManager?.registerAll(DependencyLifecycle.ACTIVATE);
|
|
11158
11158
|
this.createLifecycleCompanions(DependencyLifecycle.ACTIVATE);
|
|
11159
|
-
log$
|
|
11159
|
+
log$A.debug(
|
|
11160
11160
|
`Model ${this.modelTypeName} with id ${this.modelId} activated`
|
|
11161
11161
|
);
|
|
11162
11162
|
} catch (e) {
|
|
11163
|
-
log$
|
|
11163
|
+
log$A.debug(`Model ${this.modelId} failed to activate`);
|
|
11164
11164
|
throw e;
|
|
11165
11165
|
}
|
|
11166
11166
|
return;
|
|
@@ -11176,7 +11176,7 @@ class KosModel {
|
|
|
11176
11176
|
{
|
|
11177
11177
|
condition: () => this.loaded,
|
|
11178
11178
|
onMatch: () => {
|
|
11179
|
-
log$
|
|
11179
|
+
log$A.debug(`Model ${this.modelId} is loaded`);
|
|
11180
11180
|
}
|
|
11181
11181
|
}
|
|
11182
11182
|
]);
|
|
@@ -11192,7 +11192,7 @@ class KosModel {
|
|
|
11192
11192
|
{
|
|
11193
11193
|
condition: () => this.initialized,
|
|
11194
11194
|
onMatch: () => {
|
|
11195
|
-
log$
|
|
11195
|
+
log$A.debug(`Model ${this.modelId} is initialized`);
|
|
11196
11196
|
}
|
|
11197
11197
|
}
|
|
11198
11198
|
]);
|
|
@@ -11208,20 +11208,20 @@ class KosModel {
|
|
|
11208
11208
|
{
|
|
11209
11209
|
condition: () => this.status === KosModelState.READY,
|
|
11210
11210
|
onMatch: () => {
|
|
11211
|
-
log$
|
|
11211
|
+
log$A.debug(`Model ${this.modelId} is ready`);
|
|
11212
11212
|
}
|
|
11213
11213
|
}
|
|
11214
11214
|
]);
|
|
11215
11215
|
}
|
|
11216
11216
|
async ready() {
|
|
11217
11217
|
if (this.fsm.current === KosModelState.READY) {
|
|
11218
|
-
log$
|
|
11218
|
+
log$A.debug(
|
|
11219
11219
|
`already readying model ${this.modelTypeName} with id ${this.modelId} returning`
|
|
11220
11220
|
);
|
|
11221
11221
|
return;
|
|
11222
11222
|
}
|
|
11223
11223
|
try {
|
|
11224
|
-
log$
|
|
11224
|
+
log$A.debug(`readying model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11225
11225
|
await executeDependentModelLifecycle(this, DependencyLifecycle.READY);
|
|
11226
11226
|
await executeChildrenModelLifecycle(
|
|
11227
11227
|
this,
|
|
@@ -11237,7 +11237,7 @@ class KosModel {
|
|
|
11237
11237
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.READY);
|
|
11238
11238
|
this.subscriptionManager?.registerAll(DependencyLifecycle.READY);
|
|
11239
11239
|
this.createLifecycleCompanions(DependencyLifecycle.READY);
|
|
11240
|
-
log$
|
|
11240
|
+
log$A.debug(`Model ${this.modelId} is ready`);
|
|
11241
11241
|
const payload = {
|
|
11242
11242
|
modelId: this.modelId,
|
|
11243
11243
|
modelType: this.modelTypeName
|
|
@@ -11248,7 +11248,7 @@ class KosModel {
|
|
|
11248
11248
|
);
|
|
11249
11249
|
publish(modelTypeEventTopicFactory(this.modelTypeName), payload);
|
|
11250
11250
|
} catch (e) {
|
|
11251
|
-
log$
|
|
11251
|
+
log$A.error(e);
|
|
11252
11252
|
throw Error(e);
|
|
11253
11253
|
}
|
|
11254
11254
|
}
|
|
@@ -11259,18 +11259,18 @@ class KosModel {
|
|
|
11259
11259
|
}
|
|
11260
11260
|
const { modelTypeName, modelId } = this;
|
|
11261
11261
|
if (this.fsm.current === KosModelState.LOADED) {
|
|
11262
|
-
log$
|
|
11262
|
+
log$A.debug(`Model ${modelTypeName} with id ${modelId} already loaded`);
|
|
11263
11263
|
return;
|
|
11264
11264
|
}
|
|
11265
11265
|
if (this._isLoadExecuting) {
|
|
11266
|
-
log$
|
|
11266
|
+
log$A.debug(
|
|
11267
11267
|
`Model ${modelTypeName} with id ${modelId} is currently executing load`
|
|
11268
11268
|
);
|
|
11269
11269
|
return;
|
|
11270
11270
|
}
|
|
11271
11271
|
this._isLoadExecuting = true;
|
|
11272
11272
|
try {
|
|
11273
|
-
log$
|
|
11273
|
+
log$A.debug(`Loading model ${modelTypeName} with id ${modelId}`);
|
|
11274
11274
|
await executeDependentModelLifecycle(this, DependencyLifecycle.LOAD);
|
|
11275
11275
|
const context = KosContextManager.getContext(modelId);
|
|
11276
11276
|
const MODEL_LOADER_TYPE = `${MODEL_LOADER}.${modelTypeName}`;
|
|
@@ -11279,7 +11279,7 @@ class KosModel {
|
|
|
11279
11279
|
{}
|
|
11280
11280
|
);
|
|
11281
11281
|
if (loadedContext) {
|
|
11282
|
-
log$
|
|
11282
|
+
log$A.info(
|
|
11283
11283
|
`Setting loaded context for ${modelId}, type: ${modelTypeName}`
|
|
11284
11284
|
);
|
|
11285
11285
|
context?.set(MODEL_LOADER_TYPE, loadedContext);
|
|
@@ -11291,7 +11291,7 @@ class KosModel {
|
|
|
11291
11291
|
kosAction(() => {
|
|
11292
11292
|
this.loaded = true;
|
|
11293
11293
|
});
|
|
11294
|
-
log$
|
|
11294
|
+
log$A.debug(
|
|
11295
11295
|
`Model ${modelTypeName} with id ${modelId} successfully loaded`
|
|
11296
11296
|
);
|
|
11297
11297
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.LOAD);
|
|
@@ -11300,14 +11300,14 @@ class KosModel {
|
|
|
11300
11300
|
this.effectManager?.setup();
|
|
11301
11301
|
this.createLifecycleCompanions(DependencyLifecycle.LOAD);
|
|
11302
11302
|
} catch (e) {
|
|
11303
|
-
log$
|
|
11303
|
+
log$A.error(`Model ${modelId} failed to load`, e);
|
|
11304
11304
|
throw e;
|
|
11305
11305
|
} finally {
|
|
11306
11306
|
this._isLoadExecuting = false;
|
|
11307
11307
|
}
|
|
11308
11308
|
}
|
|
11309
11309
|
async unload() {
|
|
11310
|
-
log$
|
|
11310
|
+
log$A.debug(`unloading model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11311
11311
|
try {
|
|
11312
11312
|
const childrenUnload = this.getChildren().map((child) => child.unload?.()).filter((p) => !!p);
|
|
11313
11313
|
await Promise.allSettled(childrenUnload);
|
|
@@ -11326,12 +11326,12 @@ class KosModel {
|
|
|
11326
11326
|
modelData.stateHistory = [];
|
|
11327
11327
|
}
|
|
11328
11328
|
}
|
|
11329
|
-
log$
|
|
11329
|
+
log$A.debug(`Model ${this.modelTypeName} with id ${this.modelId} unloaded`);
|
|
11330
11330
|
this.effectManager?.disposeAll();
|
|
11331
11331
|
this.subscriptionManager?.disposeAll();
|
|
11332
11332
|
this.httpRouteManager?.dispose();
|
|
11333
11333
|
} catch (e) {
|
|
11334
|
-
log$
|
|
11334
|
+
log$A.debug(`Model ${this.modelId} failed to unload`);
|
|
11335
11335
|
throw e;
|
|
11336
11336
|
}
|
|
11337
11337
|
}
|
|
@@ -11342,7 +11342,7 @@ class KosModel {
|
|
|
11342
11342
|
}
|
|
11343
11343
|
const { modelId, modelTypeName } = this;
|
|
11344
11344
|
const context = KosContextManager.getContext(modelId);
|
|
11345
|
-
log$
|
|
11345
|
+
log$A.debug(`Initializing model ${modelTypeName} with id ${modelId}`);
|
|
11346
11346
|
await executeDependentModelLifecycle(this, DependencyLifecycle.INIT);
|
|
11347
11347
|
try {
|
|
11348
11348
|
await this.serviceRequestManager?.executeForLifecycle(
|
|
@@ -11350,18 +11350,18 @@ class KosModel {
|
|
|
11350
11350
|
);
|
|
11351
11351
|
await this.modelData?.init?.(context);
|
|
11352
11352
|
this.initialized = true;
|
|
11353
|
-
log$
|
|
11353
|
+
log$A.debug(`Model ${modelTypeName} with id ${modelId} initialized`);
|
|
11354
11354
|
this.onlineLifecycleManager?.register();
|
|
11355
11355
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.INIT);
|
|
11356
11356
|
this.registerSubscribers(DependencyLifecycle.INIT);
|
|
11357
11357
|
this.createLifecycleCompanions(DependencyLifecycle.INIT);
|
|
11358
11358
|
} catch (e) {
|
|
11359
|
-
log$
|
|
11359
|
+
log$A.error(`Model ${modelId} failed to initialize`, e);
|
|
11360
11360
|
throw e;
|
|
11361
11361
|
}
|
|
11362
11362
|
}
|
|
11363
11363
|
async registerSubscribers(lifecycle) {
|
|
11364
|
-
log$
|
|
11364
|
+
log$A.debug(
|
|
11365
11365
|
`registering subscribers in ${this.modelTypeName} with id ${this.modelId}`
|
|
11366
11366
|
);
|
|
11367
11367
|
this.subscriptionManager?.registerAll(lifecycle);
|
|
@@ -11385,14 +11385,14 @@ class KosModel {
|
|
|
11385
11385
|
this.modelManager.createLifecycleCompanions(this, {}, lifecycle);
|
|
11386
11386
|
}
|
|
11387
11387
|
async online() {
|
|
11388
|
-
log$
|
|
11388
|
+
log$A.debug(`online model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11389
11389
|
this.registerSubscribers();
|
|
11390
11390
|
const context = KosContextManager.getContext(this.modelId);
|
|
11391
11391
|
await this.modelData?.online?.(context);
|
|
11392
11392
|
this.createLifecycleCompanions(DependencyLifecycle.ONLINE);
|
|
11393
11393
|
}
|
|
11394
11394
|
async offline() {
|
|
11395
|
-
log$
|
|
11395
|
+
log$A.debug(`offline model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11396
11396
|
this.subscriptionManager?.disposeAll();
|
|
11397
11397
|
const context = KosContextManager.getContext(this.modelId);
|
|
11398
11398
|
await this.modelData?.offline?.(context);
|
|
@@ -11410,7 +11410,7 @@ class KosModel {
|
|
|
11410
11410
|
this.companionManager.clear();
|
|
11411
11411
|
}
|
|
11412
11412
|
}
|
|
11413
|
-
const log$
|
|
11413
|
+
const log$z = KosLog.createLogger({ name: "kos-model-instantiator" });
|
|
11414
11414
|
class KosModelInstantiator {
|
|
11415
11415
|
constructor(registry, cache2) {
|
|
11416
11416
|
this.registry = registry;
|
|
@@ -11428,7 +11428,7 @@ class KosModelInstantiator {
|
|
|
11428
11428
|
const modelRegistry = this.registry.models[typeId];
|
|
11429
11429
|
if (!modelRegistry) {
|
|
11430
11430
|
const errorMessage = `No model registered for type ${typeId}`;
|
|
11431
|
-
log$
|
|
11431
|
+
log$z.error(errorMessage, {
|
|
11432
11432
|
modelType: typeId,
|
|
11433
11433
|
requestedId: id,
|
|
11434
11434
|
providedOptions: options,
|
|
@@ -11447,7 +11447,7 @@ class KosModelInstantiator {
|
|
|
11447
11447
|
const modelId = modelRegistry.singleton ? typeId : id;
|
|
11448
11448
|
this.cache.restoreFromDeleteCache(modelId);
|
|
11449
11449
|
if (!this.cache.hasModel(modelId)) {
|
|
11450
|
-
log$
|
|
11450
|
+
log$z.debug(`Creating model instance: ${typeId} [${modelId}]`);
|
|
11451
11451
|
const hasOptions = options && Object.keys(options).length > 0;
|
|
11452
11452
|
const modelClass = modelRegistry.class || modelRegistry.create;
|
|
11453
11453
|
const requiresOptions = modelClass?.prototype?.[OptionsRequired] === true;
|
|
@@ -11493,7 +11493,7 @@ class KosModelInstantiator {
|
|
|
11493
11493
|
}
|
|
11494
11494
|
const activeModel = this.cache.getModelById(modelId);
|
|
11495
11495
|
if (!activeModel) {
|
|
11496
|
-
log$
|
|
11496
|
+
log$z.error(`Model ${typeId} [${modelId}] not found in cache`);
|
|
11497
11497
|
throw new Error(`Model ${typeId} [${modelId}] not found in cache`);
|
|
11498
11498
|
}
|
|
11499
11499
|
return { model: activeModel, data: activeModel.modelData };
|
|
@@ -11559,7 +11559,7 @@ let KosModelRegistry$1 = class KosModelRegistry {
|
|
|
11559
11559
|
}
|
|
11560
11560
|
};
|
|
11561
11561
|
const MODEL_DELETION_DELAY = 10;
|
|
11562
|
-
const log$
|
|
11562
|
+
const log$y = KosLog.createLogger({ name: "kos-model-manager" });
|
|
11563
11563
|
class KosModelManager {
|
|
11564
11564
|
cache;
|
|
11565
11565
|
instantiator;
|
|
@@ -11602,7 +11602,7 @@ class KosModelManager {
|
|
|
11602
11602
|
}
|
|
11603
11603
|
static getInstance(reset2) {
|
|
11604
11604
|
if (!globalThis.kos?.modelManager || reset2) {
|
|
11605
|
-
log$
|
|
11605
|
+
log$y.debug("Creating new instance of KosModelManager");
|
|
11606
11606
|
new this();
|
|
11607
11607
|
}
|
|
11608
11608
|
return globalThis.kos?.modelManager;
|
|
@@ -11624,7 +11624,7 @@ class KosModelManager {
|
|
|
11624
11624
|
*/
|
|
11625
11625
|
get preloadedModels() {
|
|
11626
11626
|
return this.cache.preload((modelKey) => {
|
|
11627
|
-
log$
|
|
11627
|
+
log$y.debug(`preloading ${modelKey}`);
|
|
11628
11628
|
if (typeof modelKey === "string") {
|
|
11629
11629
|
return this.createModelInstance(modelKey).model;
|
|
11630
11630
|
} else {
|
|
@@ -11914,7 +11914,7 @@ const reportFailure = async (step, run2) => {
|
|
|
11914
11914
|
return await run2();
|
|
11915
11915
|
} catch (error) {
|
|
11916
11916
|
const detail = error instanceof Error ? error.stack ?? `${error.name}: ${error.message}` : String(error);
|
|
11917
|
-
log$
|
|
11917
|
+
log$S.error(`KOS Core lifecycle step "${step}" failed. ${detail}`);
|
|
11918
11918
|
throw error;
|
|
11919
11919
|
}
|
|
11920
11920
|
};
|
|
@@ -11953,7 +11953,7 @@ const coreFsm = (core) => {
|
|
|
11953
11953
|
});
|
|
11954
11954
|
const online = interpret(
|
|
11955
11955
|
onlineMachine2,
|
|
11956
|
-
(_service) => log$
|
|
11956
|
+
(_service) => log$S.debug(_service.machine.current)
|
|
11957
11957
|
);
|
|
11958
11958
|
const failed = transition(
|
|
11959
11959
|
`error`,
|
|
@@ -12101,11 +12101,11 @@ const coreFsm = (core) => {
|
|
|
12101
12101
|
});
|
|
12102
12102
|
const service2 = interpret(
|
|
12103
12103
|
machine2,
|
|
12104
|
-
(_service) => log$
|
|
12104
|
+
(_service) => log$S.debug(_service.machine.current)
|
|
12105
12105
|
);
|
|
12106
12106
|
return { service: service2, online };
|
|
12107
12107
|
};
|
|
12108
|
-
const log$
|
|
12108
|
+
const log$x = KosLog.createLogger({ name: "kos-core" });
|
|
12109
12109
|
const getConnectionAlias = () => {
|
|
12110
12110
|
const params2 = getQueryParams();
|
|
12111
12111
|
const alias = params2?.alias;
|
|
@@ -12219,7 +12219,7 @@ class KosCore {
|
|
|
12219
12219
|
try {
|
|
12220
12220
|
await model.offline?.();
|
|
12221
12221
|
} catch (e) {
|
|
12222
|
-
log$
|
|
12222
|
+
log$x.error(`model ${model.modelId} offline() threw:`, e);
|
|
12223
12223
|
}
|
|
12224
12224
|
model.onlineLifecycleManager?.dispose();
|
|
12225
12225
|
})
|
|
@@ -12234,7 +12234,7 @@ class KosCore {
|
|
|
12234
12234
|
try {
|
|
12235
12235
|
await model.online?.();
|
|
12236
12236
|
} catch (e) {
|
|
12237
|
-
log$
|
|
12237
|
+
log$x.error(`model ${model.modelId} online() threw:`, e);
|
|
12238
12238
|
}
|
|
12239
12239
|
})
|
|
12240
12240
|
);
|
|
@@ -12250,11 +12250,11 @@ class KosCore {
|
|
|
12250
12250
|
this.transport.authorized = false;
|
|
12251
12251
|
});
|
|
12252
12252
|
subscribe(WebSocketEvents.RELOAD, () => {
|
|
12253
|
-
log$
|
|
12253
|
+
log$x.warn("WebSocket requested reload");
|
|
12254
12254
|
this.fsmService.service.send(KosCoreEvents.RELOAD);
|
|
12255
12255
|
});
|
|
12256
12256
|
subscribe("/studio/project/reload", () => {
|
|
12257
|
-
log$
|
|
12257
|
+
log$x.warn("Project requested reload");
|
|
12258
12258
|
this.fsmService.service.send(KosCoreEvents.RELOAD);
|
|
12259
12259
|
});
|
|
12260
12260
|
const ws = WebSocketTransport.getInstance();
|
|
@@ -12293,33 +12293,33 @@ class KosCore {
|
|
|
12293
12293
|
async reload() {
|
|
12294
12294
|
const currentTime = Date.now();
|
|
12295
12295
|
if (this._reloading) {
|
|
12296
|
-
log$
|
|
12296
|
+
log$x.info("reload already in progress");
|
|
12297
12297
|
return;
|
|
12298
12298
|
}
|
|
12299
12299
|
this._reloading = true;
|
|
12300
|
-
log$
|
|
12301
|
-
log$
|
|
12300
|
+
log$x.warn("reloading KOS Core");
|
|
12301
|
+
log$x.warn("reloading preloaded models");
|
|
12302
12302
|
const modelManager = this.modelManager;
|
|
12303
12303
|
for (const model of modelManager.preloadedModels) {
|
|
12304
12304
|
if (isReloadable(model.modelData)) {
|
|
12305
12305
|
if (isSelfManagedReload(model.modelData)) {
|
|
12306
|
-
log$
|
|
12306
|
+
log$x.info(`skipping self-managed model ${model.modelId}`);
|
|
12307
12307
|
continue;
|
|
12308
12308
|
}
|
|
12309
|
-
log$
|
|
12309
|
+
log$x.info(`reloading model ${model.modelId}`);
|
|
12310
12310
|
model.unload?.();
|
|
12311
12311
|
await model.modelData.reload();
|
|
12312
12312
|
model.registerSubscribers?.();
|
|
12313
|
-
log$
|
|
12313
|
+
log$x.info(`reloading model ${model.modelId} complete`);
|
|
12314
12314
|
}
|
|
12315
12315
|
}
|
|
12316
12316
|
for (const model of modelManager.models) {
|
|
12317
12317
|
if (!modelManager.preloadedModels.includes(model) && isReloadable(model.modelData)) {
|
|
12318
12318
|
if (isSelfManagedReload(model.modelData)) {
|
|
12319
|
-
log$
|
|
12319
|
+
log$x.info(`skipping self-managed model ${model.modelId}`);
|
|
12320
12320
|
continue;
|
|
12321
12321
|
}
|
|
12322
|
-
log$
|
|
12322
|
+
log$x.warn(`reloading model ${model.modelId}`);
|
|
12323
12323
|
model.unload?.();
|
|
12324
12324
|
await model.modelData.reload();
|
|
12325
12325
|
model.registerSubscribers?.();
|
|
@@ -12328,27 +12328,27 @@ class KosCore {
|
|
|
12328
12328
|
const elapsed = Date.now() - currentTime;
|
|
12329
12329
|
setTimeout(() => {
|
|
12330
12330
|
runInAction(() => {
|
|
12331
|
-
log$
|
|
12331
|
+
log$x.warn("reloading KOS Core complete");
|
|
12332
12332
|
this._reloading = false;
|
|
12333
12333
|
});
|
|
12334
12334
|
}, 1e3 - elapsed);
|
|
12335
12335
|
}
|
|
12336
12336
|
async online() {
|
|
12337
|
-
log$
|
|
12337
|
+
log$x.debug("KOS Core going online");
|
|
12338
12338
|
await this._transport.whenReady();
|
|
12339
|
-
log$
|
|
12339
|
+
log$x.debug("KOS Transport Ready. Calling online() for models");
|
|
12340
12340
|
publish("/kosCore/online", "/kosCore/online");
|
|
12341
12341
|
console.timeEnd("kosCore:startup");
|
|
12342
12342
|
}
|
|
12343
12343
|
async offline() {
|
|
12344
|
-
log$
|
|
12344
|
+
log$x.debug("KOS Core going offline");
|
|
12345
12345
|
publish("/kosCore/offline", "/kosCore/offline");
|
|
12346
12346
|
}
|
|
12347
12347
|
async unload() {
|
|
12348
|
-
log$
|
|
12348
|
+
log$x.debug("Unloading KOS Core");
|
|
12349
12349
|
const currentTime = Date.now();
|
|
12350
12350
|
this._unloading = true;
|
|
12351
|
-
log$
|
|
12351
|
+
log$x.debug("unloading KOS Core");
|
|
12352
12352
|
const modelManager = this.modelManager;
|
|
12353
12353
|
for (const model of modelManager.models) {
|
|
12354
12354
|
if (isUnloadable(model.modelData)) {
|
|
@@ -12366,9 +12366,9 @@ class KosCore {
|
|
|
12366
12366
|
await when(() => this.status === KosCoreState.READY);
|
|
12367
12367
|
}
|
|
12368
12368
|
async ready() {
|
|
12369
|
-
log$
|
|
12369
|
+
log$x.debug("Readying KOS Core");
|
|
12370
12370
|
await this._transport.whenReady();
|
|
12371
|
-
log$
|
|
12371
|
+
log$x.debug("KOS Transport ready. Preloading models");
|
|
12372
12372
|
if (!this.modelManager) {
|
|
12373
12373
|
throw new Error(
|
|
12374
12374
|
"KOS Core reached ready() with no model manager. Its lifecycle was started without a registry."
|
|
@@ -12381,7 +12381,7 @@ class KosCore {
|
|
|
12381
12381
|
promise: model.whenReady()
|
|
12382
12382
|
};
|
|
12383
12383
|
});
|
|
12384
|
-
log$
|
|
12384
|
+
log$x.debug(`Preloaded ${promises.length} models`);
|
|
12385
12385
|
const settled = await Promise.allSettled(
|
|
12386
12386
|
promises.map((promise) => {
|
|
12387
12387
|
const { promise: timeoutPromise, cancel: timeoutCancel } = rejectAfterDelay(5e3, promise.model);
|
|
@@ -12395,14 +12395,14 @@ class KosCore {
|
|
|
12395
12395
|
);
|
|
12396
12396
|
const failed = settled.filter((p) => p.status === "rejected");
|
|
12397
12397
|
if (failed.length) {
|
|
12398
|
-
log$
|
|
12398
|
+
log$x.error(
|
|
12399
12399
|
`There were ${failed.length} failed models on model preloading`
|
|
12400
12400
|
);
|
|
12401
12401
|
throw Error(
|
|
12402
12402
|
`There were ${failed.length} failed models on model preloading`
|
|
12403
12403
|
);
|
|
12404
12404
|
}
|
|
12405
|
-
log$
|
|
12405
|
+
log$x.debug(`leaving kos-core ready() `);
|
|
12406
12406
|
}
|
|
12407
12407
|
get isReady() {
|
|
12408
12408
|
return this.status === KosCoreState.READY;
|
|
@@ -12420,19 +12420,19 @@ class KosCore {
|
|
|
12420
12420
|
return this.loaded;
|
|
12421
12421
|
}
|
|
12422
12422
|
async init() {
|
|
12423
|
-
log$
|
|
12423
|
+
log$x.debug("entering kos-core init()");
|
|
12424
12424
|
console.time("kosCore:startup");
|
|
12425
12425
|
console.time("kosCore:init");
|
|
12426
12426
|
await this._transport.whenReady();
|
|
12427
12427
|
this.initialized = true;
|
|
12428
|
-
log$
|
|
12428
|
+
log$x.debug("initialized - leaving kos-core init()");
|
|
12429
12429
|
console.timeEnd("kosCore:init");
|
|
12430
12430
|
}
|
|
12431
12431
|
async load() {
|
|
12432
|
-
log$
|
|
12432
|
+
log$x.debug("entering kos-core load()");
|
|
12433
12433
|
console.time("kosCore:load");
|
|
12434
12434
|
this.loaded = true;
|
|
12435
|
-
log$
|
|
12435
|
+
log$x.debug("loaded - leaving kos-core load()");
|
|
12436
12436
|
console.timeEnd("kosCore:load");
|
|
12437
12437
|
}
|
|
12438
12438
|
static create(registry, reset2, connectionAlias) {
|
|
@@ -12512,7 +12512,7 @@ class KosCore {
|
|
|
12512
12512
|
return this._instance;
|
|
12513
12513
|
}
|
|
12514
12514
|
}
|
|
12515
|
-
const log$
|
|
12515
|
+
const log$w = KosLog.createLogger({
|
|
12516
12516
|
name: "kos-model-visitor",
|
|
12517
12517
|
group: "kos-ui-core"
|
|
12518
12518
|
});
|
|
@@ -12553,7 +12553,7 @@ class KosModelVisitor {
|
|
|
12553
12553
|
*/
|
|
12554
12554
|
visit(model) {
|
|
12555
12555
|
if (this.visitedModels.has(model.modelId)) {
|
|
12556
|
-
log$
|
|
12556
|
+
log$w.info(`model ${model.modelId} already visited`);
|
|
12557
12557
|
return;
|
|
12558
12558
|
}
|
|
12559
12559
|
const stopVisiting = !!this.visitModel(model.modelData, this);
|
|
@@ -13046,7 +13046,7 @@ async function retryWithExponentialBackoff(operation, options) {
|
|
|
13046
13046
|
}
|
|
13047
13047
|
throw new Error("All attempts failed");
|
|
13048
13048
|
}
|
|
13049
|
-
const log$
|
|
13049
|
+
const log$v = KosLog.createLogger({ name: "kos-service-request" });
|
|
13050
13050
|
const resolveServiceUrl = (_service) => {
|
|
13051
13051
|
const MOCK = false;
|
|
13052
13052
|
const URL2 = BASE_URL;
|
|
@@ -13218,7 +13218,7 @@ const getOne$7 = (destinationAddress2, url, _fetch) => async ({
|
|
|
13218
13218
|
destinationAddress: destinationAddressOverride
|
|
13219
13219
|
});
|
|
13220
13220
|
const resolvedUrl = urlOverride || url;
|
|
13221
|
-
log$
|
|
13221
|
+
log$v.debug(`resolvedUrl: ${resolvedUrl}`);
|
|
13222
13222
|
try {
|
|
13223
13223
|
const response = await _fetch(resolvedUrl, options);
|
|
13224
13224
|
if (!response.ok) {
|
|
@@ -13592,7 +13592,7 @@ const getKosSessionKey = () => `kos-${_sessionKey}`;
|
|
|
13592
13592
|
const isLocalRefId = (id) => !!id && !id.includes("VM_SERVICE") && id.startsWith(getKosSessionKey());
|
|
13593
13593
|
const waitForRequest = async (requestId, timeout = 6e4) => new Promise((resolve, reject) => {
|
|
13594
13594
|
const { unsubscribe } = subscribe(requestId, (op) => {
|
|
13595
|
-
log$
|
|
13595
|
+
log$S.debug(`recieved response for refId ${requestId}: ${op}`);
|
|
13596
13596
|
unsubscribe();
|
|
13597
13597
|
clearTimeout(cancel);
|
|
13598
13598
|
try {
|
|
@@ -13867,7 +13867,7 @@ function collectRecords(items) {
|
|
|
13867
13867
|
}
|
|
13868
13868
|
return result;
|
|
13869
13869
|
}
|
|
13870
|
-
const log$
|
|
13870
|
+
const log$u = KosLog.createLogger({ name: "kos-data-container" });
|
|
13871
13871
|
class KosDataContainer {
|
|
13872
13872
|
_data;
|
|
13873
13873
|
_sortKey;
|
|
@@ -14072,7 +14072,7 @@ class KosDataContainer {
|
|
|
14072
14072
|
const idx = this.index.get(indexName);
|
|
14073
14073
|
return idx.keys ?? [];
|
|
14074
14074
|
} else {
|
|
14075
|
-
log$
|
|
14075
|
+
log$u.info(
|
|
14076
14076
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
14077
14077
|
);
|
|
14078
14078
|
return [];
|
|
@@ -14084,7 +14084,7 @@ class KosDataContainer {
|
|
|
14084
14084
|
if (idx.index.has(indexKey)) {
|
|
14085
14085
|
return idx.getByKey(indexKey);
|
|
14086
14086
|
} else {
|
|
14087
|
-
log$
|
|
14087
|
+
log$u.info(
|
|
14088
14088
|
`key ${indexKey} not found in ${indexName} index: ${Array.from(
|
|
14089
14089
|
idx.index.keys()
|
|
14090
14090
|
)}`
|
|
@@ -14092,7 +14092,7 @@ class KosDataContainer {
|
|
|
14092
14092
|
return [];
|
|
14093
14093
|
}
|
|
14094
14094
|
} else {
|
|
14095
|
-
log$
|
|
14095
|
+
log$u.info(
|
|
14096
14096
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
14097
14097
|
);
|
|
14098
14098
|
return [];
|
|
@@ -14119,7 +14119,7 @@ class KosDataContainer {
|
|
|
14119
14119
|
* @private
|
|
14120
14120
|
*/
|
|
14121
14121
|
_logDataCapacityWarning(toEvict) {
|
|
14122
|
-
log$
|
|
14122
|
+
log$u.info(
|
|
14123
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.`
|
|
14124
14124
|
);
|
|
14125
14125
|
}
|
|
@@ -14179,7 +14179,7 @@ class KosDataContainer {
|
|
|
14179
14179
|
const candidates = this._customEvictionFilter(this.data);
|
|
14180
14180
|
return candidates.slice(0, count).map((item) => item.id);
|
|
14181
14181
|
}
|
|
14182
|
-
log$
|
|
14182
|
+
log$u.error(
|
|
14183
14183
|
"Custom eviction strategy specified but no customEvictionFilter provided. Falling back to FIFO."
|
|
14184
14184
|
);
|
|
14185
14185
|
return this._selectFifoData(count);
|
|
@@ -14191,7 +14191,7 @@ class KosDataContainer {
|
|
|
14191
14191
|
_removeEvictedData(ids) {
|
|
14192
14192
|
ids.forEach((id) => {
|
|
14193
14193
|
const item = this._data.get(id);
|
|
14194
|
-
log$
|
|
14194
|
+
log$u.info(`Evicting data item: ${id}`, {
|
|
14195
14195
|
itemId: id,
|
|
14196
14196
|
itemType: item ? item.constructor?.name : "unknown",
|
|
14197
14197
|
strategy: this._evictionStrategy
|
|
@@ -14204,7 +14204,7 @@ class KosDataContainer {
|
|
|
14204
14204
|
* @private
|
|
14205
14205
|
*/
|
|
14206
14206
|
_logDataEvictionComplete(evictedCount) {
|
|
14207
|
-
log$
|
|
14207
|
+
log$u.info(
|
|
14208
14208
|
`Evicted ${evictedCount} data items. Current size: ${this._data.size}/${this._maxCapacity}`
|
|
14209
14209
|
);
|
|
14210
14210
|
}
|
|
@@ -14443,14 +14443,14 @@ class BrowserKosRouter {
|
|
|
14443
14443
|
}, {});
|
|
14444
14444
|
}
|
|
14445
14445
|
}
|
|
14446
|
-
const log$
|
|
14446
|
+
const log$t = KosLog.createLogger({ name: "intent-service" });
|
|
14447
14447
|
const sendIntent = (intent) => {
|
|
14448
14448
|
if (hasEventSubscriptions(`/kos/intent/${intent.type}`)) {
|
|
14449
14449
|
publish(`/kos/intent/${intent.type}`, intent.options, {
|
|
14450
14450
|
"kos.intent.type": intent.type
|
|
14451
14451
|
});
|
|
14452
14452
|
} else {
|
|
14453
|
-
log$
|
|
14453
|
+
log$t.info(`No subscribers for intent ${intent.type}. Intent not sent.`);
|
|
14454
14454
|
}
|
|
14455
14455
|
};
|
|
14456
14456
|
const sendAsyncIntent = async (intent) => new Promise((resolve) => {
|
|
@@ -14480,11 +14480,11 @@ const sendAsyncIntent = async (intent) => new Promise((resolve) => {
|
|
|
14480
14480
|
sync: requestId
|
|
14481
14481
|
});
|
|
14482
14482
|
} else {
|
|
14483
|
-
log$
|
|
14483
|
+
log$t.info(`No subscribers for intent ${intent.type}. Intent not sent.`);
|
|
14484
14484
|
resolve([null, { body: void 0, payload: void 0 }]);
|
|
14485
14485
|
}
|
|
14486
14486
|
});
|
|
14487
|
-
const log$
|
|
14487
|
+
const log$s = KosLog.createLogger({ name: "app-startup-service" });
|
|
14488
14488
|
async function waitForAppsToStart(appIds, options = {}) {
|
|
14489
14489
|
const {
|
|
14490
14490
|
timeout = 3e4,
|
|
@@ -14492,10 +14492,10 @@ async function waitForAppsToStart(appIds, options = {}) {
|
|
|
14492
14492
|
requirePostStarted = false
|
|
14493
14493
|
} = options;
|
|
14494
14494
|
if (appIds.length === 0) {
|
|
14495
|
-
log$
|
|
14495
|
+
log$s.warn("No app IDs provided to waitForAppsToStart");
|
|
14496
14496
|
return true;
|
|
14497
14497
|
}
|
|
14498
|
-
log$
|
|
14498
|
+
log$s.debug(`Waiting for apps to start: ${appIds.join(", ")}`);
|
|
14499
14499
|
try {
|
|
14500
14500
|
const eventTopics = appIds.map((appId) => `/kos/app/started/${appId}`);
|
|
14501
14501
|
const startedApps = await waitForAllWithState(eventTopics, {
|
|
@@ -14504,12 +14504,12 @@ async function waitForAppsToStart(appIds, options = {}) {
|
|
|
14504
14504
|
const { default: api2 } = await Promise.resolve().then(() => service$8);
|
|
14505
14505
|
const [error, data] = await api2.get("/api/kos/apps/started");
|
|
14506
14506
|
if (error) {
|
|
14507
|
-
log$
|
|
14507
|
+
log$s.error("Error fetching started apps:", error);
|
|
14508
14508
|
return [];
|
|
14509
14509
|
}
|
|
14510
14510
|
return data;
|
|
14511
14511
|
} catch (error) {
|
|
14512
|
-
log$
|
|
14512
|
+
log$s.error("Failed to fetch app startup status:", error);
|
|
14513
14513
|
}
|
|
14514
14514
|
return [];
|
|
14515
14515
|
},
|
|
@@ -14531,17 +14531,17 @@ async function waitForAppsToStart(appIds, options = {}) {
|
|
|
14531
14531
|
});
|
|
14532
14532
|
if (notStartedApps.length > 0) {
|
|
14533
14533
|
const message2 = `Apps not started: ${notStartedApps.join(", ")}`;
|
|
14534
|
-
log$
|
|
14534
|
+
log$s.error(message2);
|
|
14535
14535
|
if (throwOnTimeout) {
|
|
14536
14536
|
throw new Error(`App startup timeout: ${message2}`);
|
|
14537
14537
|
}
|
|
14538
14538
|
return false;
|
|
14539
14539
|
}
|
|
14540
|
-
log$
|
|
14540
|
+
log$s.info(`All apps started successfully: ${appIds.join(", ")}`);
|
|
14541
14541
|
return true;
|
|
14542
14542
|
} catch (error) {
|
|
14543
14543
|
const message2 = `Failed to wait for apps to start: ${appIds.join(", ")}`;
|
|
14544
|
-
log$
|
|
14544
|
+
log$s.error(message2, error);
|
|
14545
14545
|
if (throwOnTimeout) {
|
|
14546
14546
|
throw new Error(
|
|
14547
14547
|
`${message2} - ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -14568,7 +14568,7 @@ async function checkAppsStarted(appIds, requirePostStarted = false) {
|
|
|
14568
14568
|
result[appId] = app?.started === true && (!requirePostStarted || app?.postStarted === true);
|
|
14569
14569
|
});
|
|
14570
14570
|
} catch (error) {
|
|
14571
|
-
log$
|
|
14571
|
+
log$s.error("Failed to check app startup status:", error);
|
|
14572
14572
|
appIds.forEach((appId) => result[appId] = false);
|
|
14573
14573
|
}
|
|
14574
14574
|
return result;
|
|
@@ -14582,7 +14582,7 @@ async function getStartedApps() {
|
|
|
14582
14582
|
const result = await response.json();
|
|
14583
14583
|
return result?.data ?? [];
|
|
14584
14584
|
} catch (error) {
|
|
14585
|
-
log$
|
|
14585
|
+
log$s.error("Failed to fetch started apps:", error);
|
|
14586
14586
|
return [];
|
|
14587
14587
|
}
|
|
14588
14588
|
}
|
|
@@ -14609,7 +14609,7 @@ var Topics = /* @__PURE__ */ ((Topics2) => {
|
|
|
14609
14609
|
Topics2["TIMEZONE_CHANGE"] = "/kos/internal/time/timezone";
|
|
14610
14610
|
return Topics2;
|
|
14611
14611
|
})(Topics || {});
|
|
14612
|
-
const log$
|
|
14612
|
+
const log$r = KosLog.createLogger({
|
|
14613
14613
|
name: "config-bean-service",
|
|
14614
14614
|
group: "Services"
|
|
14615
14615
|
});
|
|
@@ -14620,7 +14620,7 @@ const { postModel: postModel$5, getOne: getOne$6 } = ServiceFactory.build({
|
|
|
14620
14620
|
basePath: `${URL$e}/kos/config/`
|
|
14621
14621
|
});
|
|
14622
14622
|
const modifyConfigBean = async (id, model, path = `/api/kos/config`) => {
|
|
14623
|
-
log$
|
|
14623
|
+
log$r.debug(`sending modify request for ConfigBean: ${id}`);
|
|
14624
14624
|
const response = postModel$5({
|
|
14625
14625
|
model,
|
|
14626
14626
|
urlOverride: `${URL$e}${path}/${id}`
|
|
@@ -14628,7 +14628,7 @@ const modifyConfigBean = async (id, model, path = `/api/kos/config`) => {
|
|
|
14628
14628
|
return response;
|
|
14629
14629
|
};
|
|
14630
14630
|
const getConfigBean = async (id, path = `/api/kos/config`) => {
|
|
14631
|
-
log$
|
|
14631
|
+
log$r.debug(`sending get request for ConfigBean: ${id}`);
|
|
14632
14632
|
const response = await getOne$6({
|
|
14633
14633
|
urlOverride: `${URL$e}${path}/details/${id}/15`
|
|
14634
14634
|
});
|
|
@@ -14740,7 +14740,7 @@ function matchValue(patterns, value) {
|
|
|
14740
14740
|
return void 0;
|
|
14741
14741
|
}
|
|
14742
14742
|
const CONFIG_BEAN_MODEL_TYPE = "config-bean-model";
|
|
14743
|
-
const log$
|
|
14743
|
+
const log$q = KosLog.getLogger(CONFIG_BEAN_MODEL_TYPE);
|
|
14744
14744
|
const PATH_PROP$3 = createPropKey("path");
|
|
14745
14745
|
function servicePathMapper$1(configBeanModel) {
|
|
14746
14746
|
const hasMapper = ExtensionManager.propertyMapper.hasMapper(
|
|
@@ -14813,8 +14813,8 @@ let ConfigBeanModelImpl = class {
|
|
|
14813
14813
|
* @internal
|
|
14814
14814
|
*/
|
|
14815
14815
|
async ready() {
|
|
14816
|
-
log$
|
|
14817
|
-
log$
|
|
14816
|
+
log$q.debug(`readying config bean ${this.path}`);
|
|
14817
|
+
log$q.debug(`complete readying config bean ${this.path}`);
|
|
14818
14818
|
}
|
|
14819
14819
|
/**
|
|
14820
14820
|
* @internal
|
|
@@ -14825,12 +14825,12 @@ let ConfigBeanModelImpl = class {
|
|
|
14825
14825
|
* In future additional information about the workspace could be loaded
|
|
14826
14826
|
*/
|
|
14827
14827
|
async load() {
|
|
14828
|
-
log$
|
|
14828
|
+
log$q.debug(`loading config bean ${this.path}`);
|
|
14829
14829
|
const response = await this._getConfigBean(this.path, this.serviceBasePath);
|
|
14830
14830
|
if (response?.data) {
|
|
14831
14831
|
const data = response.data;
|
|
14832
14832
|
mapDtoToConfigBeanModel(data, this);
|
|
14833
|
-
log$
|
|
14833
|
+
log$q.debug(this.values);
|
|
14834
14834
|
const schemaResponse = response?.data.details[0].schema;
|
|
14835
14835
|
kosAction(() => {
|
|
14836
14836
|
if (schemaResponse) {
|
|
@@ -15098,7 +15098,7 @@ var __decorateClass$z = (decorators, target, key, kind) => {
|
|
|
15098
15098
|
return result;
|
|
15099
15099
|
};
|
|
15100
15100
|
const MODEL_TYPE$w = "region-info-model";
|
|
15101
|
-
const log$
|
|
15101
|
+
const log$p = KosLog.createLogger({ name: "region-info-model" });
|
|
15102
15102
|
function servicePathMapper(regionInfoModel) {
|
|
15103
15103
|
const hasMapper = ExtensionManager.propertyMapper.hasMapper(
|
|
15104
15104
|
KosCoreModelPropertyMapper.RegionServicePath
|
|
@@ -15389,7 +15389,7 @@ let RegionInfoModelImpl = class {
|
|
|
15389
15389
|
}
|
|
15390
15390
|
toUnit = measureSystems[to.system]?.["default"];
|
|
15391
15391
|
if (!toUnit) {
|
|
15392
|
-
log$
|
|
15392
|
+
log$p.info("Could not find default unit for measure", to.measure);
|
|
15393
15393
|
}
|
|
15394
15394
|
}
|
|
15395
15395
|
if (!fromUnit && from.measure && from.system) {
|
|
@@ -15403,11 +15403,11 @@ let RegionInfoModelImpl = class {
|
|
|
15403
15403
|
}
|
|
15404
15404
|
fromUnit = measureSystems[from.system]?.["default"];
|
|
15405
15405
|
if (!fromUnit) {
|
|
15406
|
-
log$
|
|
15406
|
+
log$p.info("Could not find default unit for measure", from.measure);
|
|
15407
15407
|
}
|
|
15408
15408
|
}
|
|
15409
15409
|
if (!fromUnit || !toUnit) {
|
|
15410
|
-
log$
|
|
15410
|
+
log$p.warn("Could not find unit to convert to or from. Return value as is");
|
|
15411
15411
|
return String(value);
|
|
15412
15412
|
}
|
|
15413
15413
|
return this.convertByUnit(value, fromUnit, toUnit);
|
|
@@ -15417,13 +15417,13 @@ let RegionInfoModelImpl = class {
|
|
|
15417
15417
|
* @internal
|
|
15418
15418
|
*/
|
|
15419
15419
|
async init() {
|
|
15420
|
-
log$
|
|
15420
|
+
log$p.debug("initializing region info");
|
|
15421
15421
|
}
|
|
15422
15422
|
/**
|
|
15423
15423
|
* @internal
|
|
15424
15424
|
*/
|
|
15425
15425
|
async load() {
|
|
15426
|
-
log$
|
|
15426
|
+
log$p.debug("loading region info");
|
|
15427
15427
|
const regions = await getRegions(this.serviceBasePath);
|
|
15428
15428
|
if (regions) {
|
|
15429
15429
|
this.regions = regions.data.map((region) => region.id);
|
|
@@ -15743,7 +15743,7 @@ function secondsToFormattedTime(secondsSinceMidnight, formatString) {
|
|
|
15743
15743
|
return format(time, formatString);
|
|
15744
15744
|
}
|
|
15745
15745
|
const MODEL_TYPE$v = "config-bean-prop-model";
|
|
15746
|
-
const log$
|
|
15746
|
+
const log$o = KosLog.createLogger({ name: "config-bean-prop-model" });
|
|
15747
15747
|
const PATH_PROP$2 = createPropKey("path");
|
|
15748
15748
|
const SERVICE_PATH_PROP = createPropKey("serviceBasePath");
|
|
15749
15749
|
let KosConfigPropertyImpl = class {
|
|
@@ -15939,7 +15939,7 @@ let KosConfigPropertyImpl = class {
|
|
|
15939
15939
|
return Number(result2);
|
|
15940
15940
|
}
|
|
15941
15941
|
} catch (e) {
|
|
15942
|
-
log$
|
|
15942
|
+
log$o.info(`error formatting value ${_val}`, e);
|
|
15943
15943
|
}
|
|
15944
15944
|
const result = Number(_val).toFixed(decimals);
|
|
15945
15945
|
return result;
|
|
@@ -15978,7 +15978,7 @@ let KosConfigPropertyImpl = class {
|
|
|
15978
15978
|
* @internal
|
|
15979
15979
|
*/
|
|
15980
15980
|
async activate() {
|
|
15981
|
-
log$
|
|
15981
|
+
log$o.debug(`activating config bean ${this.id}`);
|
|
15982
15982
|
}
|
|
15983
15983
|
/**
|
|
15984
15984
|
* Gets the formatted display string with units and localization.
|
|
@@ -16011,7 +16011,7 @@ let KosConfigPropertyImpl = class {
|
|
|
16011
16011
|
return result;
|
|
16012
16012
|
}
|
|
16013
16013
|
} catch (e) {
|
|
16014
|
-
log$
|
|
16014
|
+
log$o.error(`error formatting value ${_val}`, e);
|
|
16015
16015
|
}
|
|
16016
16016
|
}
|
|
16017
16017
|
return String(_val);
|
|
@@ -16109,13 +16109,13 @@ let KosConfigPropertyImpl = class {
|
|
|
16109
16109
|
try {
|
|
16110
16110
|
formatter2 = new Intl.NumberFormat(locale, { ...formatOptions });
|
|
16111
16111
|
} catch (e) {
|
|
16112
|
-
log$
|
|
16112
|
+
log$o.error(
|
|
16113
16113
|
`error creating formatter ${formatOptions}. Returning the raw value`,
|
|
16114
16114
|
e
|
|
16115
16115
|
);
|
|
16116
16116
|
}
|
|
16117
16117
|
} else {
|
|
16118
|
-
log$
|
|
16118
|
+
log$o.debug(
|
|
16119
16119
|
`no formatter found for config bean prop ${this.id}. Returning the raw value`
|
|
16120
16120
|
);
|
|
16121
16121
|
}
|
|
@@ -16184,7 +16184,7 @@ let KosConfigPropertyImpl = class {
|
|
|
16184
16184
|
* ```
|
|
16185
16185
|
*/
|
|
16186
16186
|
async updateProperty(value) {
|
|
16187
|
-
log$
|
|
16187
|
+
log$o.debug(`updating property ${this.attribute} with value ${value}`);
|
|
16188
16188
|
let _value = value;
|
|
16189
16189
|
const converter = this.getConverter();
|
|
16190
16190
|
if (converter && !isNaN(_value)) {
|
|
@@ -16301,7 +16301,7 @@ const buildFuture = (factory) => (future) => pipe(
|
|
|
16301
16301
|
mapDtoToFutureOptions,
|
|
16302
16302
|
buildFutureModel$1(factory)(future.tracker || future.id)
|
|
16303
16303
|
)(future);
|
|
16304
|
-
const log$
|
|
16304
|
+
const log$n = KosLog.createLogger({ name: "future-service", group: "Services" });
|
|
16305
16305
|
const { isMock, URL: URL$c } = resolveServiceUrl();
|
|
16306
16306
|
var FutureEndState = /* @__PURE__ */ ((FutureEndState2) => {
|
|
16307
16307
|
FutureEndState2["Success"] = "SUCCESS";
|
|
@@ -16320,7 +16320,7 @@ const getFutures = async () => {
|
|
|
16320
16320
|
return response;
|
|
16321
16321
|
};
|
|
16322
16322
|
const deleteFuture = async (id, path = "/api/kos/future") => {
|
|
16323
|
-
log$
|
|
16323
|
+
log$n.info(`sending delete request for Future: ${id}`);
|
|
16324
16324
|
const response = await deleteModel$1({
|
|
16325
16325
|
id,
|
|
16326
16326
|
urlOverride: `${URL$c}${path}/${id}`
|
|
@@ -16328,7 +16328,7 @@ const deleteFuture = async (id, path = "/api/kos/future") => {
|
|
|
16328
16328
|
return response;
|
|
16329
16329
|
};
|
|
16330
16330
|
const addFuture = async (future, path = "/api/kos/future") => {
|
|
16331
|
-
log$
|
|
16331
|
+
log$n.info(`sending add request for Future`);
|
|
16332
16332
|
const response = await addModel({
|
|
16333
16333
|
model: future,
|
|
16334
16334
|
urlOverride: `${URL$c}${path}`
|
|
@@ -16336,7 +16336,7 @@ const addFuture = async (future, path = "/api/kos/future") => {
|
|
|
16336
16336
|
return response;
|
|
16337
16337
|
};
|
|
16338
16338
|
const modifyFuture = async (id, model, path = "/api/kos/future") => {
|
|
16339
|
-
log$
|
|
16339
|
+
log$n.info(`sending modify request for Future: ${id}`);
|
|
16340
16340
|
const response = modifyModel({
|
|
16341
16341
|
model,
|
|
16342
16342
|
id,
|
|
@@ -16345,7 +16345,7 @@ const modifyFuture = async (id, model, path = "/api/kos/future") => {
|
|
|
16345
16345
|
return response;
|
|
16346
16346
|
};
|
|
16347
16347
|
const cancelFuture = async (id, path = "/api/kos/future") => {
|
|
16348
|
-
log$
|
|
16348
|
+
log$n.info(`sending cancel request for Future: ${id}`);
|
|
16349
16349
|
const response = postModel$4({
|
|
16350
16350
|
urlOverride: `${URL$c}${path}/${id}/cancel`,
|
|
16351
16351
|
ordered: true,
|
|
@@ -16528,12 +16528,12 @@ const { URL: URL$b } = resolveServiceUrl();
|
|
|
16528
16528
|
const { getOne: getOne$4 } = ServiceFactory.build({
|
|
16529
16529
|
basePath: `${URL$b}/api/kos/state`
|
|
16530
16530
|
});
|
|
16531
|
-
const log$
|
|
16531
|
+
const log$m = KosLog.createLogger({
|
|
16532
16532
|
name: "state-bean-service",
|
|
16533
16533
|
group: "Services"
|
|
16534
16534
|
});
|
|
16535
16535
|
const getStateBeanData = async ({ path }) => {
|
|
16536
|
-
log$
|
|
16536
|
+
log$m.debug("sending GET for state-bean");
|
|
16537
16537
|
const response = await getOne$4({
|
|
16538
16538
|
urlOverride: `${URL$b}/api/kos/state/${path}`
|
|
16539
16539
|
});
|
|
@@ -16726,12 +16726,12 @@ const { URL: URL$a } = resolveServiceUrl();
|
|
|
16726
16726
|
const { getAll: getAll$5 } = ServiceFactory.build({
|
|
16727
16727
|
basePath: `${URL$a}/api/state-prop`
|
|
16728
16728
|
});
|
|
16729
|
-
const log$
|
|
16729
|
+
const log$l = KosLog.createLogger({
|
|
16730
16730
|
name: "state-prop-service",
|
|
16731
16731
|
group: "Services"
|
|
16732
16732
|
});
|
|
16733
16733
|
const getStateProps = async () => {
|
|
16734
|
-
log$
|
|
16734
|
+
log$l.debug("sending GET for state-prop");
|
|
16735
16735
|
const response = await getAll$5({});
|
|
16736
16736
|
return response;
|
|
16737
16737
|
};
|
|
@@ -16891,7 +16891,7 @@ var __decorateClass$u = (decorators, target, key, kind) => {
|
|
|
16891
16891
|
if (kind && result) __defProp$p(target, key, result);
|
|
16892
16892
|
return result;
|
|
16893
16893
|
};
|
|
16894
|
-
const log$
|
|
16894
|
+
const log$k = KosLog.getLogger(FutureFactory.type);
|
|
16895
16895
|
let FutureModel = class {
|
|
16896
16896
|
logger;
|
|
16897
16897
|
_cancelFuture;
|
|
@@ -16915,7 +16915,7 @@ let FutureModel = class {
|
|
|
16915
16915
|
kosWhen(
|
|
16916
16916
|
() => this.status === FutureEndState.Success || this.status === FutureEndState.Fail,
|
|
16917
16917
|
() => {
|
|
16918
|
-
log$
|
|
16918
|
+
log$k.info(`Future ${this.id} has completed with status ${this.status}`);
|
|
16919
16919
|
destroyKosModel(this);
|
|
16920
16920
|
}
|
|
16921
16921
|
);
|
|
@@ -16929,13 +16929,13 @@ let FutureModel = class {
|
|
|
16929
16929
|
* In future additional information about the workspace could be loaded
|
|
16930
16930
|
*/
|
|
16931
16931
|
async load() {
|
|
16932
|
-
log$
|
|
16932
|
+
log$k.debug(`loading Future ${this.id}`);
|
|
16933
16933
|
}
|
|
16934
16934
|
/**
|
|
16935
16935
|
* @internal
|
|
16936
16936
|
*/
|
|
16937
16937
|
unload() {
|
|
16938
|
-
log$
|
|
16938
|
+
log$k.info(`unloading Future ${this.id}`);
|
|
16939
16939
|
}
|
|
16940
16940
|
// -------------------ACTIONS----------------------------
|
|
16941
16941
|
/**
|
|
@@ -16954,7 +16954,7 @@ let FutureModel = class {
|
|
|
16954
16954
|
await kosWhen(() => this.futureId !== FUTURE_NOT_ASSIGNED);
|
|
16955
16955
|
const response = await this._cancelFuture(this.futureId, path);
|
|
16956
16956
|
if (response?.status !== 200) {
|
|
16957
|
-
log$
|
|
16957
|
+
log$k.error(
|
|
16958
16958
|
`Failed to cancel Future ${this.id}. Response: ${JSON.stringify(
|
|
16959
16959
|
response
|
|
16960
16960
|
)}`
|
|
@@ -17043,7 +17043,7 @@ var __decorateClass$t = (decorators, target, key, kind) => {
|
|
|
17043
17043
|
if (kind && result) __defProp$o(target, key, result);
|
|
17044
17044
|
return result;
|
|
17045
17045
|
};
|
|
17046
|
-
const log$
|
|
17046
|
+
const log$j = KosLog.getLogger(FutureContainerFactory.type);
|
|
17047
17047
|
let FutureContainerModel = class {
|
|
17048
17048
|
id;
|
|
17049
17049
|
logger;
|
|
@@ -17158,8 +17158,8 @@ let FutureContainerModel = class {
|
|
|
17158
17158
|
try {
|
|
17159
17159
|
await this._deleteFuture(id);
|
|
17160
17160
|
} catch (e) {
|
|
17161
|
-
log$
|
|
17162
|
-
log$
|
|
17161
|
+
log$j.error(`error deleting a Future`);
|
|
17162
|
+
log$j.error(e);
|
|
17163
17163
|
}
|
|
17164
17164
|
}
|
|
17165
17165
|
/**
|
|
@@ -17186,8 +17186,8 @@ let FutureContainerModel = class {
|
|
|
17186
17186
|
return model2;
|
|
17187
17187
|
}
|
|
17188
17188
|
} catch (e) {
|
|
17189
|
-
log$
|
|
17190
|
-
log$
|
|
17189
|
+
log$j.error(`error creating a Future`);
|
|
17190
|
+
log$j.error(e);
|
|
17191
17191
|
throw e;
|
|
17192
17192
|
}
|
|
17193
17193
|
return void 0;
|
|
@@ -17216,7 +17216,7 @@ const { URL: URL$9 } = resolveServiceUrl();
|
|
|
17216
17216
|
const { getOne: getOne$3, postModel: postModel$3, deleteModel } = ServiceFactory.build({
|
|
17217
17217
|
basePath: `${URL$9}/api/keyVal`
|
|
17218
17218
|
});
|
|
17219
|
-
const log$
|
|
17219
|
+
const log$i = KosLog.createLogger({
|
|
17220
17220
|
name: "key-value-service",
|
|
17221
17221
|
group: "Services"
|
|
17222
17222
|
});
|
|
@@ -17232,7 +17232,7 @@ const updateKeyValue = async (namespace, key, value) => {
|
|
|
17232
17232
|
model: value.toString()
|
|
17233
17233
|
});
|
|
17234
17234
|
if (response?.status !== 200) {
|
|
17235
|
-
log$
|
|
17235
|
+
log$i.error("Failed to update key-value data", response);
|
|
17236
17236
|
throw new Error(
|
|
17237
17237
|
`Failed to update key-value data for namespace ${namespace}`
|
|
17238
17238
|
);
|
|
@@ -17240,12 +17240,12 @@ const updateKeyValue = async (namespace, key, value) => {
|
|
|
17240
17240
|
return response.data;
|
|
17241
17241
|
};
|
|
17242
17242
|
const getKeyValue = async (namespace = "studio") => {
|
|
17243
|
-
log$
|
|
17243
|
+
log$i.debug(`Retrieving all key-value data for namespace: ${namespace}`);
|
|
17244
17244
|
const response = await getOne$3({
|
|
17245
17245
|
urlOverride: `${URL$9}/api/keyVal/${namespace}`
|
|
17246
17246
|
});
|
|
17247
17247
|
if (response?.status !== 200) {
|
|
17248
|
-
log$
|
|
17248
|
+
log$i.error("Failed to retrieve key-value data", response);
|
|
17249
17249
|
throw new Error(
|
|
17250
17250
|
`Failed to retrieve key-value data for namespace ${namespace}`
|
|
17251
17251
|
);
|
|
@@ -19316,13 +19316,13 @@ KosExpressionEvaluatorModelImpl = __decorateClass$r([
|
|
|
19316
19316
|
kosModel({ modelTypeId: MODEL_TYPE$q, singleton: false })
|
|
19317
19317
|
], KosExpressionEvaluatorModelImpl);
|
|
19318
19318
|
const KosExpressionEvaluator = KosExpressionEvaluatorModelImpl.Registration;
|
|
19319
|
-
const log$
|
|
19319
|
+
const log$h = KosLog.createLogger({
|
|
19320
19320
|
name: "kos-log-manager-service",
|
|
19321
19321
|
group: "Services"
|
|
19322
19322
|
});
|
|
19323
19323
|
const SERVICE_PATH$2 = "/api/kos/logs/overrides";
|
|
19324
19324
|
const getLogOverrides = async () => {
|
|
19325
|
-
log$
|
|
19325
|
+
log$h.debug("sending GET for kos-log-manager");
|
|
19326
19326
|
return await api$9.get(SERVICE_PATH$2);
|
|
19327
19327
|
};
|
|
19328
19328
|
const index$b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -19731,7 +19731,7 @@ __decorateClass$o([
|
|
|
19731
19731
|
LogBlockContainerModelImpl = __decorateClass$o([
|
|
19732
19732
|
kosModel(MODEL_TYPE$n)
|
|
19733
19733
|
], LogBlockContainerModelImpl);
|
|
19734
|
-
const log$
|
|
19734
|
+
const log$g = KosLog.createLogger({
|
|
19735
19735
|
name: "log-stream-container-service",
|
|
19736
19736
|
group: "Services"
|
|
19737
19737
|
});
|
|
@@ -19745,7 +19745,7 @@ const getKosConnectionId$2 = () => {
|
|
|
19745
19745
|
const destinationAddress$3 = getKosConnectionId$2();
|
|
19746
19746
|
const SERVICE_PATH$1 = "/api/kos/logs/node/{nodeId}/streams";
|
|
19747
19747
|
const getLogStreams = async () => {
|
|
19748
|
-
log$
|
|
19748
|
+
log$g.debug("sending GET for log-stream-container");
|
|
19749
19749
|
return await api$9.get(
|
|
19750
19750
|
SERVICE_PATH$1,
|
|
19751
19751
|
{
|
|
@@ -20346,23 +20346,23 @@ const { URL: URL$7 } = resolveServiceUrl();
|
|
|
20346
20346
|
const { getAll: getAll$4, postModel: postModel$1 } = ServiceFactory.build({
|
|
20347
20347
|
basePath: `${URL$7}/api/kos/troubles`
|
|
20348
20348
|
});
|
|
20349
|
-
const log$
|
|
20349
|
+
const log$f = KosLog.createLogger({ name: "trouble-services" });
|
|
20350
20350
|
const getKosConnectionId$1 = () => {
|
|
20351
20351
|
const params2 = getQueryParams();
|
|
20352
20352
|
const connId = params2?.connId;
|
|
20353
|
-
log$
|
|
20354
|
-
log$
|
|
20353
|
+
log$f.debug(`connId from query params: ${connId}`);
|
|
20354
|
+
log$f.debug(
|
|
20355
20355
|
`window.kosBridge: ${window?.kosBridge ? "available" : "not available"} - ${window?.kosBridge?.("connId")}`
|
|
20356
20356
|
);
|
|
20357
20357
|
const result = connId || window?.kosBridge?.("connId");
|
|
20358
|
-
log$
|
|
20358
|
+
log$f.info(`getKosConnectionId: ${result}`);
|
|
20359
20359
|
return result;
|
|
20360
20360
|
};
|
|
20361
20361
|
const destinationAddress$2 = getKosConnectionId$1();
|
|
20362
|
-
log$
|
|
20362
|
+
log$f.info(`Destination address for trouble services: ${destinationAddress$2}`);
|
|
20363
20363
|
const getTroubles = async (servicePath) => {
|
|
20364
20364
|
const isKosTroubles = servicePath.includes("/kos/troubles");
|
|
20365
|
-
log$
|
|
20365
|
+
log$f.info(
|
|
20366
20366
|
`Fetching troubles from ${servicePath} with destination address: ${isKosTroubles ? destinationAddress$2 : "N/A (not a kos troubles path)"}`
|
|
20367
20367
|
);
|
|
20368
20368
|
const response = await getAll$4({
|
|
@@ -20876,16 +20876,16 @@ const { URL: URL$6 } = resolveServiceUrl();
|
|
|
20876
20876
|
const { getAll: getAll$3 } = ServiceFactory.build({
|
|
20877
20877
|
basePath: `${URL$6}/api/kos/ota`
|
|
20878
20878
|
});
|
|
20879
|
-
const log$
|
|
20879
|
+
const log$e = KosLog.createLogger({
|
|
20880
20880
|
name: "ota-service",
|
|
20881
20881
|
group: "Services"
|
|
20882
20882
|
});
|
|
20883
20883
|
const getArtifacts = async () => {
|
|
20884
|
-
log$
|
|
20884
|
+
log$e.debug("sending GET request to /api/kos/ota/artifacts");
|
|
20885
20885
|
const response = await getAll$3({
|
|
20886
20886
|
urlOverride: `${URL$6}/api/kos/ota/artifacts`
|
|
20887
20887
|
});
|
|
20888
|
-
log$
|
|
20888
|
+
log$e.debug("getArtifacts - response:", response);
|
|
20889
20889
|
return response?.data;
|
|
20890
20890
|
};
|
|
20891
20891
|
var __defProp$e = Object.defineProperty;
|
|
@@ -21069,7 +21069,7 @@ const Ota = new SingletonKosModelRegistrationFactory({
|
|
|
21069
21069
|
class: OtaModelImpl,
|
|
21070
21070
|
type: MODEL_TYPE$h
|
|
21071
21071
|
});
|
|
21072
|
-
const log$
|
|
21072
|
+
const log$d = KosLog.createLogger({ name: "await-future-call", group: "Models" });
|
|
21073
21073
|
class FutureCallError extends Error {
|
|
21074
21074
|
endState;
|
|
21075
21075
|
reason;
|
|
@@ -21120,7 +21120,7 @@ function awaitFutureCall(model, methodCall, options = {}) {
|
|
|
21120
21120
|
const watchTracked = (future) => {
|
|
21121
21121
|
tracked = future;
|
|
21122
21122
|
if (cancelRequested) {
|
|
21123
|
-
future.cancelFuture().catch((e) => log$
|
|
21123
|
+
future.cancelFuture().catch((e) => log$d.error(e));
|
|
21124
21124
|
}
|
|
21125
21125
|
disposers.push(
|
|
21126
21126
|
reaction(
|
|
@@ -21137,7 +21137,7 @@ function awaitFutureCall(model, methodCall, options = {}) {
|
|
|
21137
21137
|
try {
|
|
21138
21138
|
cb(progress, status);
|
|
21139
21139
|
} catch (e) {
|
|
21140
|
-
log$
|
|
21140
|
+
log$d.warn("progress callback error", e);
|
|
21141
21141
|
}
|
|
21142
21142
|
});
|
|
21143
21143
|
},
|
|
@@ -23752,9 +23752,9 @@ const { URL: URL$5 } = resolveServiceUrl();
|
|
|
23752
23752
|
const { getOne: getOne$1 } = ServiceFactory.build({
|
|
23753
23753
|
basePath: `${URL$5}/api/device`
|
|
23754
23754
|
});
|
|
23755
|
-
const log$
|
|
23755
|
+
const log$c = KosLog.createLogger({ name: "device-service", group: "Services" });
|
|
23756
23756
|
const getSerialNumber = async () => {
|
|
23757
|
-
log$
|
|
23757
|
+
log$c.debug("sending GET for device serial number");
|
|
23758
23758
|
try {
|
|
23759
23759
|
const response = await getOne$1({
|
|
23760
23760
|
urlOverride: `${URL$5}/api/kos/device/serialNumber`
|
|
@@ -23762,14 +23762,14 @@ const getSerialNumber = async () => {
|
|
|
23762
23762
|
return [void 0, response?.data.serialNumber];
|
|
23763
23763
|
} catch (error) {
|
|
23764
23764
|
if (error instanceof FetchError) {
|
|
23765
|
-
log$
|
|
23765
|
+
log$c.error(`Error fetching device serial number: ${error.payload.error}`);
|
|
23766
23766
|
return [error.payload.error, void 0];
|
|
23767
23767
|
}
|
|
23768
23768
|
}
|
|
23769
23769
|
return ["unknownError", void 0];
|
|
23770
23770
|
};
|
|
23771
23771
|
const getDeviceDetails = async () => {
|
|
23772
|
-
log$
|
|
23772
|
+
log$c.debug("sending GET for device details");
|
|
23773
23773
|
try {
|
|
23774
23774
|
const response = await getOne$1({
|
|
23775
23775
|
urlOverride: `${URL$5}/api/kos/device`
|
|
@@ -23780,7 +23780,7 @@ const getDeviceDetails = async () => {
|
|
|
23780
23780
|
return [void 0, response.data];
|
|
23781
23781
|
} catch (error) {
|
|
23782
23782
|
if (error instanceof FetchError) {
|
|
23783
|
-
log$
|
|
23783
|
+
log$c.error(`Error fetching device serial number: ${error.payload.error}`);
|
|
23784
23784
|
return [error.payload.error, void 0];
|
|
23785
23785
|
}
|
|
23786
23786
|
}
|
|
@@ -24115,12 +24115,12 @@ const { getAll: getAll$2 } = ServiceFactory.build({
|
|
|
24115
24115
|
basePath: `${URL$4}/api/kos/network/interfaces`
|
|
24116
24116
|
});
|
|
24117
24117
|
const destinationAddress$1 = getKosConnectionId();
|
|
24118
|
-
const log$
|
|
24118
|
+
const log$b = KosLog.createLogger({
|
|
24119
24119
|
name: "network-interface-service",
|
|
24120
24120
|
group: "Services"
|
|
24121
24121
|
});
|
|
24122
24122
|
const getNetworkInterfaces = async () => {
|
|
24123
|
-
log$
|
|
24123
|
+
log$b.debug("sending GET for copy-logs");
|
|
24124
24124
|
try {
|
|
24125
24125
|
const response = await getAll$2({
|
|
24126
24126
|
destinationAddress: destinationAddress$1
|
|
@@ -24128,7 +24128,7 @@ const getNetworkInterfaces = async () => {
|
|
|
24128
24128
|
return [void 0, response?.data];
|
|
24129
24129
|
} catch (error) {
|
|
24130
24130
|
if (error instanceof FetchError) {
|
|
24131
|
-
log$
|
|
24131
|
+
log$b.error(`Error fetching log file size: ${error.payload.error}`);
|
|
24132
24132
|
return [error.payload.error, void 0];
|
|
24133
24133
|
}
|
|
24134
24134
|
}
|
|
@@ -24230,15 +24230,15 @@ const { URL: URL$3 } = resolveServiceUrl();
|
|
|
24230
24230
|
const { getAll: getAll$1 } = ServiceFactory.build({
|
|
24231
24231
|
basePath: `${URL$3}/api/kos/storage/devices`
|
|
24232
24232
|
});
|
|
24233
|
-
const log$
|
|
24233
|
+
const log$a = KosLog.createLogger({
|
|
24234
24234
|
name: "storage-device-service",
|
|
24235
24235
|
group: "Services"
|
|
24236
24236
|
});
|
|
24237
24237
|
const getStorageDevices = async () => {
|
|
24238
|
-
log$
|
|
24238
|
+
log$a.debug("sending GET for storage-device");
|
|
24239
24239
|
const response = await getAll$1({});
|
|
24240
24240
|
if (!response?.data || response.status !== 200) {
|
|
24241
|
-
log$
|
|
24241
|
+
log$a.error("Failed to retrieve storage-device data", response);
|
|
24242
24242
|
return [];
|
|
24243
24243
|
}
|
|
24244
24244
|
return response.data;
|
|
@@ -24440,17 +24440,17 @@ const { URL: URL$2 } = resolveServiceUrl();
|
|
|
24440
24440
|
const { getAll, postModel } = ServiceFactory.build({
|
|
24441
24441
|
basePath: `${URL$2}/api/kos/update/available`
|
|
24442
24442
|
});
|
|
24443
|
-
const log$
|
|
24443
|
+
const log$9 = KosLog.createLogger({
|
|
24444
24444
|
name: "usb-update-service",
|
|
24445
24445
|
group: "Services"
|
|
24446
24446
|
});
|
|
24447
24447
|
const getAvailableUpdates = async () => {
|
|
24448
|
-
log$
|
|
24448
|
+
log$9.debug("sending GET for usb-update");
|
|
24449
24449
|
const response = await getAll({
|
|
24450
24450
|
urlOverride: `${URL$2}/api/kos/update/available`
|
|
24451
24451
|
});
|
|
24452
24452
|
if (!response?.data || response?.status !== 200) {
|
|
24453
|
-
log$
|
|
24453
|
+
log$9.error("Failed to retrieve usb-update data", response);
|
|
24454
24454
|
return [];
|
|
24455
24455
|
}
|
|
24456
24456
|
return response.data;
|
|
@@ -24669,7 +24669,7 @@ const { URL: URL$1 } = resolveServiceUrl();
|
|
|
24669
24669
|
const { getOne } = ServiceFactory.build({
|
|
24670
24670
|
basePath: `${URL$1}/api/translation`
|
|
24671
24671
|
});
|
|
24672
|
-
const log$
|
|
24672
|
+
const log$8 = KosLog.createLogger({
|
|
24673
24673
|
name: "translation-service",
|
|
24674
24674
|
group: "Services"
|
|
24675
24675
|
});
|
|
@@ -24681,23 +24681,23 @@ const getDefaultHost$1 = () => {
|
|
|
24681
24681
|
return result;
|
|
24682
24682
|
};
|
|
24683
24683
|
const getTranslations = async (url, root) => {
|
|
24684
|
-
log$
|
|
24684
|
+
log$8.debug(`Loading translations from: ${url}`);
|
|
24685
24685
|
const rootUrl = root ?? getDefaultHost$1();
|
|
24686
24686
|
try {
|
|
24687
24687
|
const response = await fetch(`${rootUrl}${url}`);
|
|
24688
24688
|
if (response.status !== 200) {
|
|
24689
|
-
log$
|
|
24689
|
+
log$8.warn(`Failed to fetch translations at ${url}: ${response.status}`);
|
|
24690
24690
|
return {};
|
|
24691
24691
|
}
|
|
24692
24692
|
const json = await response.json();
|
|
24693
24693
|
return json;
|
|
24694
24694
|
} catch (error) {
|
|
24695
|
-
log$
|
|
24695
|
+
log$8.error("Error fetching translations", error);
|
|
24696
24696
|
throw error;
|
|
24697
24697
|
}
|
|
24698
24698
|
};
|
|
24699
24699
|
const getLocalizationDescriptor = async () => {
|
|
24700
|
-
log$
|
|
24700
|
+
log$8.debug("Getting system localization descriptor");
|
|
24701
24701
|
const response = await getOne({
|
|
24702
24702
|
urlOverride: `${URL$1}/api/system/kos/localization`
|
|
24703
24703
|
});
|
|
@@ -24709,7 +24709,7 @@ const getLocalizationDescriptor = async () => {
|
|
|
24709
24709
|
return response.data;
|
|
24710
24710
|
};
|
|
24711
24711
|
const getKosLocalizationDescriptor = (context) => async () => {
|
|
24712
|
-
log$
|
|
24712
|
+
log$8.debug(`Getting KOS localization descriptor for context: ${context}`);
|
|
24713
24713
|
const response = await getOne({
|
|
24714
24714
|
urlOverride: `${URL$1}/api/kos/localization/contexts`
|
|
24715
24715
|
});
|
|
@@ -25539,7 +25539,7 @@ const service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
25539
25539
|
const TIMER_EVENT = `/kos-timer-event`;
|
|
25540
25540
|
const TOPIC_TIMER_TICK_EVENT = `/kos-timer-event/tick`;
|
|
25541
25541
|
const TIMER_END = "defaultTimerEnd";
|
|
25542
|
-
const log$
|
|
25542
|
+
const log$7 = KosLog.createLogger({ name: "timer-manager" });
|
|
25543
25543
|
const isConfigProperty = (value) => value.updateProperty !== void 0;
|
|
25544
25544
|
class KosTimer {
|
|
25545
25545
|
name;
|
|
@@ -25587,7 +25587,7 @@ class KosTimer {
|
|
|
25587
25587
|
*/
|
|
25588
25588
|
start() {
|
|
25589
25589
|
if (this.state === "active") {
|
|
25590
|
-
log$
|
|
25590
|
+
log$7.debug(`Timer ${this.name} already started`);
|
|
25591
25591
|
return;
|
|
25592
25592
|
}
|
|
25593
25593
|
if (this.state === "inactive" || this.state === "paused") {
|
|
@@ -25600,7 +25600,7 @@ class KosTimer {
|
|
|
25600
25600
|
*/
|
|
25601
25601
|
pause() {
|
|
25602
25602
|
if (this.timer) {
|
|
25603
|
-
log$
|
|
25603
|
+
log$7.debug(`Pausing timer ${this.name}`);
|
|
25604
25604
|
this.state = "paused";
|
|
25605
25605
|
clearInterval(this.timer);
|
|
25606
25606
|
}
|
|
@@ -25682,11 +25682,11 @@ class KosTimer {
|
|
|
25682
25682
|
executeActions(time) {
|
|
25683
25683
|
if (this.timeoutActions.has(time)) {
|
|
25684
25684
|
this.timeoutActions.get(time).forEach((timerAction) => {
|
|
25685
|
-
log$
|
|
25685
|
+
log$7.debug(`Executing timer action ${timerAction.name} at ${time}`);
|
|
25686
25686
|
timerAction.action?.(timerAction.name, time);
|
|
25687
25687
|
this.notifyTimeoutAction(timerAction);
|
|
25688
25688
|
if (timerAction.singleUse) {
|
|
25689
|
-
log$
|
|
25689
|
+
log$7.info(
|
|
25690
25690
|
`${this.name} Removing single-use action ${timerAction.name}`
|
|
25691
25691
|
);
|
|
25692
25692
|
this.removeTimeoutAction(timerAction.name);
|
|
@@ -25717,7 +25717,7 @@ const timers = /* @__PURE__ */ new Map();
|
|
|
25717
25717
|
const executeOnTimer = (name, action2) => {
|
|
25718
25718
|
const timer = timers.get(name);
|
|
25719
25719
|
if (!timer) {
|
|
25720
|
-
log$
|
|
25720
|
+
log$7.error(`Timer ${name} not found`);
|
|
25721
25721
|
return;
|
|
25722
25722
|
}
|
|
25723
25723
|
action2(timer);
|
|
@@ -25814,23 +25814,23 @@ const updateTimeZone = async (timezone) => {
|
|
|
25814
25814
|
await whenReady(timezoneInfo);
|
|
25815
25815
|
timezoneInfo.updateProperty(timezone);
|
|
25816
25816
|
};
|
|
25817
|
-
const log$
|
|
25817
|
+
const log$6 = KosLog.createLogger({
|
|
25818
25818
|
name: "software-info-service",
|
|
25819
25819
|
group: "Services"
|
|
25820
25820
|
});
|
|
25821
25821
|
const destinationAddress = getKosConnectionId();
|
|
25822
25822
|
const getSoftwareInfos = async (signal) => {
|
|
25823
|
-
log$
|
|
25823
|
+
log$6.debug("sending GET for software-info");
|
|
25824
25824
|
const [error, response] = await api$8.get("/api/kos/manifest/info", void 0, {
|
|
25825
25825
|
signal,
|
|
25826
25826
|
destinationAddress
|
|
25827
25827
|
});
|
|
25828
25828
|
if (!response) {
|
|
25829
25829
|
if (signal?.aborted) {
|
|
25830
|
-
log$
|
|
25830
|
+
log$6.debug("Request was aborted");
|
|
25831
25831
|
throw new FetchError("Request was aborted");
|
|
25832
25832
|
}
|
|
25833
|
-
log$
|
|
25833
|
+
log$6.error("Failed to fetch software-info", error);
|
|
25834
25834
|
throw new FetchError("Failed to fetch software-info");
|
|
25835
25835
|
}
|
|
25836
25836
|
return response;
|
|
@@ -25929,7 +25929,7 @@ const SoftwareInfo = {
|
|
|
25929
25929
|
function isTroubleAware(obj) {
|
|
25930
25930
|
return obj?.troubles !== void 0 && obj?.troubles instanceof Array && obj?.troublesByType !== void 0 && typeof obj?.troublesByType === "object";
|
|
25931
25931
|
}
|
|
25932
|
-
const log$
|
|
25932
|
+
const log$5 = KosLog.createLogger({ name: "services", group: "Services" });
|
|
25933
25933
|
const studioLogin = async (username, password) => login(username, password, `${BASE_URL}/api/server/login`);
|
|
25934
25934
|
const login = async (username, password, url = `${BASE_URL}/api/login`) => {
|
|
25935
25935
|
const response = await kosFetch(`${url}`, {
|
|
@@ -25963,7 +25963,7 @@ const startPasswordReset = async (userId, url = `${BASE_URL}/api/startPasswordRe
|
|
|
25963
25963
|
};
|
|
25964
25964
|
const studioResetPassword = async (token2, password) => resetPassword(token2, password, `${BASE_URL}/api/server/resetPassword`);
|
|
25965
25965
|
const resetPassword = async (token2, password, url = `${BASE_URL}/api/resetPassword`) => {
|
|
25966
|
-
log$
|
|
25966
|
+
log$5.debug(
|
|
25967
25967
|
`resetting password with token ${token2} and password ${password.replace(
|
|
25968
25968
|
/./g,
|
|
25969
25969
|
"*"
|
|
@@ -25977,9 +25977,9 @@ const resetPassword = async (token2, password, url = `${BASE_URL}/api/resetPassw
|
|
|
25977
25977
|
password
|
|
25978
25978
|
})
|
|
25979
25979
|
});
|
|
25980
|
-
log$
|
|
25980
|
+
log$5.debug(`password reset returned status ${response.status}`);
|
|
25981
25981
|
if (!response.ok) {
|
|
25982
|
-
log$
|
|
25982
|
+
log$5.error(`password reset failed with message ${response.statusText}`);
|
|
25983
25983
|
const configResponse2 = await response.json();
|
|
25984
25984
|
throw Error(
|
|
25985
25985
|
`${configResponse2?.error}:There was a problem resetting the password.`
|
|
@@ -25995,7 +25995,7 @@ const studioAcceptOrgInvitation = async (token2, password, name) => acceptOrgInv
|
|
|
25995
25995
|
`${BASE_URL}/api/server/acceptInvite`
|
|
25996
25996
|
);
|
|
25997
25997
|
const acceptOrgInvitation = async (token2, password, name, url = `${BASE_URL}/api/server/acceptInvite`) => {
|
|
25998
|
-
log$
|
|
25998
|
+
log$5.debug(
|
|
25999
25999
|
`accepting invite with token ${token2} and password ${password.replace(
|
|
26000
26000
|
/./g,
|
|
26001
26001
|
"*"
|
|
@@ -26010,9 +26010,9 @@ const acceptOrgInvitation = async (token2, password, name, url = `${BASE_URL}/ap
|
|
|
26010
26010
|
name
|
|
26011
26011
|
})
|
|
26012
26012
|
});
|
|
26013
|
-
log$
|
|
26013
|
+
log$5.debug(`invitation accept returned status ${response.status}`);
|
|
26014
26014
|
if (!response.ok) {
|
|
26015
|
-
log$
|
|
26015
|
+
log$5.error(`invite failed with message ${response.statusText}`);
|
|
26016
26016
|
const configResponse2 = await response.json();
|
|
26017
26017
|
throw Error(
|
|
26018
26018
|
`${configResponse2?.error}:There was a problem accepting the invite.`
|
|
@@ -26318,15 +26318,15 @@ GpioChipContainerModelImpl = __decorateClass$1([
|
|
|
26318
26318
|
], GpioChipContainerModelImpl);
|
|
26319
26319
|
const GpioChipContainer = GpioChipContainerModelImpl.Registration;
|
|
26320
26320
|
GpioChipContainer.addRelatedModel(GpioChip);
|
|
26321
|
-
const log$
|
|
26321
|
+
const log$4 = KosLog.createLogger({
|
|
26322
26322
|
name: "studio-properties-service",
|
|
26323
26323
|
group: "Services"
|
|
26324
26324
|
});
|
|
26325
26325
|
const SERVICE_PATH = "/api/kos/studio/properties";
|
|
26326
26326
|
const getStudioProperties = async (connectionId) => {
|
|
26327
|
-
log$
|
|
26327
|
+
log$4.debug("sending GET for studio-properties");
|
|
26328
26328
|
if (!connectionId) {
|
|
26329
|
-
log$
|
|
26329
|
+
log$4.error("connectionId is undefined");
|
|
26330
26330
|
throw new Error("connectionId is undefined");
|
|
26331
26331
|
}
|
|
26332
26332
|
return await api$9.get(
|
|
@@ -26492,25 +26492,41 @@ const MessageContainer = styled.div`
|
|
|
26492
26492
|
color: ${({ theme }) => theme === "light" ? "black" : "white"};
|
|
26493
26493
|
z-index: 10000;
|
|
26494
26494
|
`;
|
|
26495
|
+
const log$3 = KosLog.createLogger({ name: "error-boundary" });
|
|
26495
26496
|
class ErrorBoundary extends React.Component {
|
|
26496
26497
|
constructor(props) {
|
|
26497
26498
|
super(props);
|
|
26498
26499
|
this.state = { error: null, errorInfo: null };
|
|
26499
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
|
+
}
|
|
26500
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
|
+
);
|
|
26501
26517
|
this.setState({
|
|
26502
26518
|
error,
|
|
26503
26519
|
errorInfo
|
|
26504
26520
|
});
|
|
26505
26521
|
}
|
|
26506
26522
|
render() {
|
|
26507
|
-
if (this.state.
|
|
26523
|
+
if (this.state.error) {
|
|
26508
26524
|
return this.props.fallback || /* @__PURE__ */ jsxs("div", { children: [
|
|
26509
26525
|
/* @__PURE__ */ jsx("h2", { children: "Something went wrong." }),
|
|
26510
26526
|
/* @__PURE__ */ jsxs("details", { style: { whiteSpace: `pre-wrap` }, children: [
|
|
26511
|
-
this.state.error
|
|
26527
|
+
this.state.error.toString(),
|
|
26512
26528
|
/* @__PURE__ */ jsx("br", {}),
|
|
26513
|
-
this.state.errorInfo
|
|
26529
|
+
this.state.errorInfo?.componentStack
|
|
26514
26530
|
] })
|
|
26515
26531
|
] });
|
|
26516
26532
|
}
|
|
@@ -27645,9 +27661,11 @@ function fetchData(key, fetcher) {
|
|
|
27645
27661
|
const entry = cache.get(key);
|
|
27646
27662
|
if (entry.status === "finished") {
|
|
27647
27663
|
return entry.result;
|
|
27648
|
-
} else {
|
|
27649
|
-
throw entry.promise;
|
|
27650
27664
|
}
|
|
27665
|
+
if (entry.status === "error") {
|
|
27666
|
+
throw entry.error;
|
|
27667
|
+
}
|
|
27668
|
+
throw entry.promise;
|
|
27651
27669
|
} else {
|
|
27652
27670
|
const promise = fetcher().then(
|
|
27653
27671
|
(result) => {
|