@kosdev-code/kos-ui-sdk 0.1.0-next.979 → 0.1.0-next.991
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/common/events/async-event-bus.d.ts.map +1 -1
- package/common/events/eventBus.d.ts.map +1 -1
- package/core/core/decorators/index.d.ts +0 -1
- package/core/core/decorators/index.d.ts.map +1 -1
- package/core/core/decorators/kos-logger-aware.d.ts.map +1 -1
- package/core/core/decorators/kosModel.d.ts.map +1 -1
- package/core/core/decorators/propKeys.d.ts +0 -1
- package/core/core/decorators/propKeys.d.ts.map +1 -1
- package/core/core/extension/extension-manager.d.ts.map +1 -1
- package/core/core/kos-container-index.d.ts.map +1 -1
- package/core/core/kos-registration.d.ts.map +1 -1
- package/core/core/kosModel.d.ts.map +1 -1
- package/core/core/lifecycle/kosCoreLifecycle.d.ts.map +1 -1
- package/core/core/lifecycle/model-machine.d.ts.map +1 -1
- package/core/core/log/index.d.ts +1 -0
- package/core/core/log/index.d.ts.map +1 -1
- package/core/core/log/log-groups.d.ts +25 -0
- package/core/core/log/log-groups.d.ts.map +1 -0
- package/core/core/log/log.d.ts +10 -6
- package/core/core/log/log.d.ts.map +1 -1
- package/core/core/model/kos-logger-factory.d.ts +6 -4
- package/core/core/model/kos-logger-factory.d.ts.map +1 -1
- package/core/core/model/kos-model-component-factory.d.ts.map +1 -1
- package/core/core/model/kos-service-request-manager.d.ts.map +1 -1
- package/core/core/registration/registration-manager.d.ts.map +1 -1
- package/core/core/transport/base-message-transport.d.ts.map +1 -1
- package/core/core/transport/bridge-transport.d.ts.map +1 -1
- package/core/core/transport/mock/future-simulator.d.ts.map +1 -1
- package/core/core/transport/mock/mock-config.d.ts.map +1 -1
- package/core/core/transport/mock/mock-fixtures.d.ts.map +1 -1
- package/core/core/transport/mock/mock-playback.d.ts.map +1 -1
- package/core/core/transport/mock/mock-recorder.d.ts.map +1 -1
- package/core/core/transport/mock/mock-registry.d.ts.map +1 -1
- package/core/core/transport/mock/mock-setups.d.ts.map +1 -1
- package/core/core/transport/mock/standalone-mock-socket.d.ts.map +1 -1
- package/core/core/transport/transport-factory.d.ts.map +1 -1
- package/core/core/transport/webSocketTransport.d.ts.map +1 -1
- package/core/types/global.d.ts +0 -6
- package/core/util/feature-flags.d.ts.map +1 -1
- package/core/util/kos-message-utils.d.ts.map +1 -1
- package/core/util/kos-model-utils.d.ts.map +1 -1
- package/core/util/kos-model-visitor.d.ts.map +1 -1
- package/core/util/log-utils.d.ts +0 -10
- package/core/util/log-utils.d.ts.map +1 -1
- package/core/util/model-error-utils.d.ts.map +1 -1
- package/core/util/model-utils.d.ts.map +1 -1
- package/core/util/promise-utils.d.ts.map +1 -1
- package/core/util/retry-with-exponential-backoff.d.ts.map +1 -1
- package/core/util/wait-for-request.d.ts.map +1 -1
- package/index.cjs +60 -312
- package/index.cjs.map +1 -1
- package/index.js +236 -488
- package/index.js.map +1 -1
- package/models/decorators/future-service.d.ts.map +1 -1
- package/models/models/config-bean/config-bean-model.d.ts.map +1 -1
- package/models/models/config-bean-prop/config-bean-prop-model.d.ts.map +1 -1
- package/models/models/future/future-aware.d.ts.map +1 -1
- package/models/models/future/future-model-builder.d.ts.map +1 -1
- package/models/models/future/future-model.d.ts.map +1 -1
- package/models/models/future-container/future-container-model.d.ts.map +1 -1
- package/models/models/key-value/services/key-value-services.d.ts.map +1 -1
- package/models/models/kos-log-manager/services/kos-log-manager-services.d.ts.map +1 -1
- package/models/models/log-stream/services/log-stream-services.d.ts.map +1 -1
- package/models/models/network-interface/services/network-interface-services.d.ts.map +1 -1
- package/models/models/ota/services/ota-services.d.ts.map +1 -1
- package/models/models/software-info/services/software-info-services.d.ts.map +1 -1
- package/models/models/state-bean/services/state-bean-services.d.ts.map +1 -1
- package/models/models/state-prop/services/state-prop-services.d.ts.map +1 -1
- package/models/models/storage-device/services/storage-device-services.d.ts.map +1 -1
- package/models/models/studio-properties/services/studio-properties-services.d.ts.map +1 -1
- package/models/models/studio-properties/studio-properties-model.d.ts.map +1 -1
- package/models/models/translation/services/translation-services.d.ts.map +1 -1
- package/models/models/trouble/utils/trouble-data-extension.d.ts.map +1 -1
- package/models/models/trouble/utils/trouble-extension.d.ts.map +1 -1
- package/models/models/usb-update/services/usb-update-services.d.ts.map +1 -1
- package/models/models/ws-event/ws-event-model.d.ts.map +1 -1
- package/models/services/config-bean/index.d.ts.map +1 -1
- package/models/services/login/index.d.ts.map +1 -1
- package/models/utils/await-future-call.d.ts.map +1 -1
- package/models/utils/cancellable-future-call.d.ts.map +1 -1
- package/models/utils/core-registration-manager.d.ts +13 -2
- package/models/utils/core-registration-manager.d.ts.map +1 -1
- package/models/utils/get-kos-connection-id.d.ts.map +1 -1
- package/models/utils/timer-manager.d.ts.map +1 -1
- package/package.json +3 -3
- package/{software-info-registration-Cbvzr2Q-.js → software-info-registration-Bz_s3zOp.js} +1244 -925
- package/software-info-registration-Bz_s3zOp.js.map +1 -0
- package/{software-info-registration-rg4pjrxg.cjs → software-info-registration-CagrRzH8.cjs} +978 -659
- package/software-info-registration-CagrRzH8.cjs.map +1 -0
- package/testing.cjs +1 -2
- package/testing.cjs.map +1 -1
- package/testing.js +1 -2
- package/testing.js.map +1 -1
- package/ui/components/kos-model-loader/contexts/kos-model-hierarchy-context.d.ts.map +1 -1
- package/ui/components/kos-model-loader/kos-model-loader.d.ts.map +1 -1
- package/ui/contexts/kos-model-context.d.ts.map +1 -1
- package/ui/contexts/translation-container/kos-translations-provider.d.ts.map +1 -1
- package/ui/hooks/translation-container/use-translation.d.ts.map +1 -1
- package/ui/hooks/use-mutation-observer.d.ts.map +1 -1
- package/ui/hooks/use-press-gesture/use-press-gesture.d.ts.map +1 -1
- package/ui/policies/reload-on-disconnect-policy.d.ts.map +1 -1
- package/core/core/decorators/kos-log.d.ts +0 -14
- package/core/core/decorators/kos-log.d.ts.map +0 -1
- package/software-info-registration-Cbvzr2Q-.js.map +0 -1
- package/software-info-registration-rg4pjrxg.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const mobx = require("mobx");
|
|
3
|
-
const log$
|
|
3
|
+
const log$1h = require("loglevel");
|
|
4
4
|
const robot3 = require("robot3");
|
|
5
5
|
const dateFns = require("date-fns");
|
|
6
6
|
const HEADER_METHOD = `method`;
|
|
@@ -27,7 +27,140 @@ var KosWsEvents = /* @__PURE__ */ ((KosWsEvents2) => {
|
|
|
27
27
|
return KosWsEvents2;
|
|
28
28
|
})(KosWsEvents || {});
|
|
29
29
|
const EVENT_KOS_MODEL_READY = "/kos/model/ready/";
|
|
30
|
-
|
|
30
|
+
const getQueryParams = (query = null) => (query || window.location.search.replace("?", "")).split("&").map((pair) => {
|
|
31
|
+
const [key, val] = pair.split("=");
|
|
32
|
+
return [key, decodeURIComponent(val || "")];
|
|
33
|
+
}).reduce((result, [key, val]) => {
|
|
34
|
+
result[key] = val;
|
|
35
|
+
return result;
|
|
36
|
+
}, {});
|
|
37
|
+
const PROFILE_ENABLE_RELEASES = "studio.enable.releases";
|
|
38
|
+
const PROFILE_TOOLS_PREVIEW = "studio.tools.preview";
|
|
39
|
+
const PROFILE_RELAX_STORE_VALIDATION = "studio.relax.store.validation";
|
|
40
|
+
const PROFILE_LOG_DEBUG = "studio.log.debug";
|
|
41
|
+
const PROFILE_LOG_INFO = "studio.log.info";
|
|
42
|
+
const defaultConfig = {
|
|
43
|
+
profiles: [PROFILE_TOOLS_PREVIEW]
|
|
44
|
+
};
|
|
45
|
+
const config = globalThis.getKosConfig?.() || JSON.stringify(defaultConfig);
|
|
46
|
+
const configObj = JSON.parse(config);
|
|
47
|
+
const urlProfiles = () => {
|
|
48
|
+
if (typeof window === "undefined") {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
const value = getQueryParams()?.["kosProfiles"];
|
|
52
|
+
return value ? value.split(",").map((profile) => profile.trim()).filter(Boolean) : [];
|
|
53
|
+
};
|
|
54
|
+
configObj.profiles = [
|
|
55
|
+
...configObj.profiles ?? [],
|
|
56
|
+
...urlProfiles().filter((profile) => !configObj.profiles?.includes(profile))
|
|
57
|
+
];
|
|
58
|
+
globalThis.kosConfig = configObj;
|
|
59
|
+
const KosGlobalConfig = configObj;
|
|
60
|
+
const resolveKosProfiles = () => KosGlobalConfig.profiles || [];
|
|
61
|
+
const hasKosProfile = (profile) => resolveKosProfiles().includes(profile);
|
|
62
|
+
const isKosLoggingEnabled = () => KosGlobalConfig.logging || false;
|
|
63
|
+
const resolveLogLevelProfile = () => {
|
|
64
|
+
const showDebugLogProfile = hasKosProfile(PROFILE_LOG_DEBUG);
|
|
65
|
+
const showInfoLogProfile = hasKosProfile(PROFILE_LOG_INFO);
|
|
66
|
+
return showDebugLogProfile ? "DEBUG" : showInfoLogProfile ? "INFO" : void 0;
|
|
67
|
+
};
|
|
68
|
+
const getLogLevel = () => {
|
|
69
|
+
const params2 = getQueryParams();
|
|
70
|
+
const profileLogLevel = resolveLogLevelProfile();
|
|
71
|
+
const logLevelParam = params2["kosLogLevel"];
|
|
72
|
+
const logLevel = logLevelParam ?? profileLogLevel ?? window.kosLogLevel ?? process.env.KOS_LOG_LEVEL;
|
|
73
|
+
if (logLevel) {
|
|
74
|
+
return logLevel;
|
|
75
|
+
}
|
|
76
|
+
return "WARN";
|
|
77
|
+
};
|
|
78
|
+
const LogGroup = {
|
|
79
|
+
core: "core",
|
|
80
|
+
transport: "transport",
|
|
81
|
+
model: "model",
|
|
82
|
+
service: "service",
|
|
83
|
+
ui: "ui"
|
|
84
|
+
};
|
|
85
|
+
const UI_GROUP_OVERRIDE = "ui:group";
|
|
86
|
+
const UI_LOGGER_OVERRIDE = "ui:logger";
|
|
87
|
+
const LEVELS = ["trace", "debug", "info", "warn", "error"];
|
|
88
|
+
const getLoggerGroup = (loggerName) => {
|
|
89
|
+
const grouped = loggerName.indexOf(":::");
|
|
90
|
+
if (grouped >= 0) {
|
|
91
|
+
return loggerName.slice(0, grouped);
|
|
92
|
+
}
|
|
93
|
+
const ungrouped = loggerName.indexOf("::");
|
|
94
|
+
return ungrouped >= 0 ? loggerName.slice(0, ungrouped) : "";
|
|
95
|
+
};
|
|
96
|
+
const matchesPattern = (value, pattern) => {
|
|
97
|
+
const source = pattern.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join(".*");
|
|
98
|
+
return new RegExp(`^${source}$`).test(value);
|
|
99
|
+
};
|
|
100
|
+
const matches = (loggerName, override) => {
|
|
101
|
+
const wildcard = override.name.includes("*");
|
|
102
|
+
if (override.type === UI_GROUP_OVERRIDE) {
|
|
103
|
+
const group = getLoggerGroup(loggerName);
|
|
104
|
+
return wildcard ? matchesPattern(group, override.name) : group === override.name;
|
|
105
|
+
}
|
|
106
|
+
if (override.type === UI_LOGGER_OVERRIDE) {
|
|
107
|
+
return wildcard ? matchesPattern(loggerName, override.name) : loggerName.startsWith(override.name);
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
};
|
|
111
|
+
const resolveOverrideLevel = (loggerName, overrides) => overrides.filter((override) => matches(loggerName, override)).map((override) => override.level.toLowerCase()).filter((level2) => LEVELS.includes(level2)).sort((a, b) => LEVELS.indexOf(a) - LEVELS.indexOf(b))[0];
|
|
112
|
+
const MESSAGE_LOGGER_NAME = "messages";
|
|
113
|
+
const MESSAGE_LOGGER = `${LogGroup.transport}:::${MESSAGE_LOGGER_NAME}`;
|
|
114
|
+
const originalFactory = log$1h.methodFactory;
|
|
115
|
+
log$1h.methodFactory = function(methodName, logLevel, loggerName) {
|
|
116
|
+
const rawMethod = originalFactory(methodName, logLevel, loggerName);
|
|
117
|
+
return function(...args) {
|
|
118
|
+
const _name = loggerName ? String(loggerName) : "";
|
|
119
|
+
const prefix = _name ? `[${String(_name).substring(_name.lastIndexOf(":") + 1)}] | ` : "[root] | ";
|
|
120
|
+
const message = args.map(
|
|
121
|
+
(arg) => typeof arg === "object" ? JSON.stringify(arg) : String(arg)
|
|
122
|
+
).join(" ");
|
|
123
|
+
rawMethod(`${prefix}${message}`);
|
|
124
|
+
if (globalThis?.kosConfig?.logging && globalThis.kosLog && loggerName !== MESSAGE_LOGGER) {
|
|
125
|
+
globalThis.kosLog(`UI: ${prefix}${message}`);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
let level = getLogLevel();
|
|
130
|
+
log$1h.setLevel(level);
|
|
131
|
+
window.setKosLogLevel = (_level) => {
|
|
132
|
+
level = _level;
|
|
133
|
+
log$1h.setLevel(_level);
|
|
134
|
+
};
|
|
135
|
+
const conditionallyLog = (level2) => (fn, logger = log$1h) => {
|
|
136
|
+
if (logger.getLevel() <= level2) {
|
|
137
|
+
fn();
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const createLogger = ({ name, group }) => {
|
|
141
|
+
const loggerName = `${group ? `${group}:` : "kos"}::${name}`;
|
|
142
|
+
const _log = log$1h.getLogger(loggerName);
|
|
143
|
+
const _level = resolveOverrideLevel(
|
|
144
|
+
loggerName,
|
|
145
|
+
globalThis.kos?.logOverrides ?? []
|
|
146
|
+
);
|
|
147
|
+
if (_level) {
|
|
148
|
+
_log.setLevel(_level);
|
|
149
|
+
}
|
|
150
|
+
return _log;
|
|
151
|
+
};
|
|
152
|
+
const KosLog = {
|
|
153
|
+
...log$1h,
|
|
154
|
+
ifDebug: conditionallyLog(log$1h.levels.DEBUG),
|
|
155
|
+
ifInfo: conditionallyLog(log$1h.levels.INFO),
|
|
156
|
+
ifWarn: conditionallyLog(log$1h.levels.WARN),
|
|
157
|
+
ifError: conditionallyLog(log$1h.levels.ERROR),
|
|
158
|
+
getLogger: (name) => createLogger({ name }),
|
|
159
|
+
getLoggers: () => log$1h.getLoggers(),
|
|
160
|
+
createLogger
|
|
161
|
+
};
|
|
162
|
+
const log$1g = KosLog.createLogger({ group: LogGroup.core, name: "event-bus" });
|
|
163
|
+
log$1g.info("Initializing event bus");
|
|
31
164
|
globalThis.kos = globalThis.kos || {};
|
|
32
165
|
globalThis.kos.subscriptions = globalThis.kos.subscriptions || {};
|
|
33
166
|
const subscriptions = globalThis.kos.subscriptions;
|
|
@@ -38,15 +171,15 @@ function hasEventSubscriptions(eventType) {
|
|
|
38
171
|
function subscribe(eventType, callback) {
|
|
39
172
|
const id = getNextUniqueId();
|
|
40
173
|
if (!subscriptions[eventType]) {
|
|
41
|
-
log$
|
|
174
|
+
log$1g.debug(`Initializing subscription for ${eventType}`);
|
|
42
175
|
subscriptions[eventType] = {};
|
|
43
176
|
}
|
|
44
|
-
log$
|
|
177
|
+
log$1g.debug(`Subscribing to ${eventType} with id ${id.toString()}`);
|
|
45
178
|
subscriptions[eventType][id] = callback;
|
|
46
179
|
return {
|
|
47
180
|
count: subscriptions[eventType] ? Object.getOwnPropertySymbols(subscriptions[eventType]).length : 0,
|
|
48
181
|
unsubscribe: () => {
|
|
49
|
-
log$
|
|
182
|
+
log$1g.debug(`Unsubscribing from ${eventType} with id ${id.toString()}`);
|
|
50
183
|
if (subscriptions[eventType] && subscriptions[eventType][id]) {
|
|
51
184
|
delete subscriptions[eventType][id];
|
|
52
185
|
}
|
|
@@ -61,7 +194,7 @@ function subscribe(eventType, callback) {
|
|
|
61
194
|
}
|
|
62
195
|
function publish(eventType, msg, headers = {}) {
|
|
63
196
|
if (!subscriptions[eventType] || Object.getOwnPropertySymbols(subscriptions[eventType]).length === 0) {
|
|
64
|
-
log$
|
|
197
|
+
log$1g.debug(`No subscriptions for ${eventType}. Not publishing.`);
|
|
65
198
|
return {
|
|
66
199
|
eventType,
|
|
67
200
|
subscribers: 0
|
|
@@ -71,19 +204,19 @@ function publish(eventType, msg, headers = {}) {
|
|
|
71
204
|
Object.getOwnPropertySymbols(subscriptions[eventType]).forEach((id) => {
|
|
72
205
|
if (headers["sync"]) {
|
|
73
206
|
const responseId = headers["sync"];
|
|
74
|
-
log$
|
|
207
|
+
log$1g.debug(
|
|
75
208
|
`Performing sync publish for ${eventType} with sync id ${responseId}`
|
|
76
209
|
);
|
|
77
210
|
subscriptions[eventType][id]({ body: msg, headers }).then(
|
|
78
211
|
(response) => {
|
|
79
|
-
log$
|
|
212
|
+
log$1g.debug(
|
|
80
213
|
`Response recieved for ${responseId}, publishing back to source.`
|
|
81
214
|
);
|
|
82
215
|
publish(responseId, response);
|
|
83
216
|
}
|
|
84
217
|
);
|
|
85
218
|
} else {
|
|
86
|
-
log$
|
|
219
|
+
log$1g.debug(`Performing async publish for ${eventType}`);
|
|
87
220
|
subscriptions[eventType][id]({ body: msg, headers });
|
|
88
221
|
}
|
|
89
222
|
});
|
|
@@ -93,7 +226,7 @@ function publish(eventType, msg, headers = {}) {
|
|
|
93
226
|
};
|
|
94
227
|
}
|
|
95
228
|
function reset() {
|
|
96
|
-
log$
|
|
229
|
+
log$1g.warn("Resetting event bus");
|
|
97
230
|
Object.keys(subscriptions).forEach((key) => delete subscriptions[key]);
|
|
98
231
|
}
|
|
99
232
|
function once(eventType, callback) {
|
|
@@ -409,185 +542,11 @@ const eventBus_state = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defi
|
|
|
409
542
|
waitForAllWithState,
|
|
410
543
|
waitForOrGetState
|
|
411
544
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
412
|
-
const getQueryParams = (query = null) => (query || window.location.search.replace("?", "")).split("&").map((pair) => {
|
|
413
|
-
const [key, val] = pair.split("=");
|
|
414
|
-
return [key, decodeURIComponent(val || "")];
|
|
415
|
-
}).reduce((result, [key, val]) => {
|
|
416
|
-
result[key] = val;
|
|
417
|
-
return result;
|
|
418
|
-
}, {});
|
|
419
|
-
const PROFILE_ENABLE_RELEASES = "studio.enable.releases";
|
|
420
|
-
const PROFILE_TOOLS_PREVIEW = "studio.tools.preview";
|
|
421
|
-
const PROFILE_RELAX_STORE_VALIDATION = "studio.relax.store.validation";
|
|
422
|
-
const PROFILE_LOG_DEBUG = "studio.log.debug";
|
|
423
|
-
const PROFILE_LOG_INFO = "studio.log.info";
|
|
424
|
-
const defaultConfig = {
|
|
425
|
-
profiles: [PROFILE_TOOLS_PREVIEW]
|
|
426
|
-
};
|
|
427
|
-
const config = globalThis.getKosConfig?.() || JSON.stringify(defaultConfig);
|
|
428
|
-
const configObj = JSON.parse(config);
|
|
429
|
-
const urlProfiles = () => {
|
|
430
|
-
if (typeof window === "undefined") {
|
|
431
|
-
return [];
|
|
432
|
-
}
|
|
433
|
-
const value = getQueryParams()?.["kosProfiles"];
|
|
434
|
-
return value ? value.split(",").map((profile) => profile.trim()).filter(Boolean) : [];
|
|
435
|
-
};
|
|
436
|
-
configObj.profiles = [
|
|
437
|
-
...configObj.profiles ?? [],
|
|
438
|
-
...urlProfiles().filter((profile) => !configObj.profiles?.includes(profile))
|
|
439
|
-
];
|
|
440
|
-
globalThis.kosConfig = configObj;
|
|
441
|
-
const KosGlobalConfig = configObj;
|
|
442
|
-
const resolveKosProfiles = () => KosGlobalConfig.profiles || [];
|
|
443
|
-
const hasKosProfile = (profile) => resolveKosProfiles().includes(profile);
|
|
444
|
-
const isKosLoggingEnabled = () => KosGlobalConfig.logging || false;
|
|
445
|
-
const resolveLogLevelProfile = () => {
|
|
446
|
-
const showDebugLogProfile = hasKosProfile(PROFILE_LOG_DEBUG);
|
|
447
|
-
const showInfoLogProfile = hasKosProfile(PROFILE_LOG_INFO);
|
|
448
|
-
return showDebugLogProfile ? "DEBUG" : showInfoLogProfile ? "INFO" : void 0;
|
|
449
|
-
};
|
|
450
|
-
const getLogLevel = () => {
|
|
451
|
-
const params2 = getQueryParams();
|
|
452
|
-
const profileLogLevel = resolveLogLevelProfile();
|
|
453
|
-
const logLevelParam = params2["kosLogLevel"];
|
|
454
|
-
const logLevel = logLevelParam ?? profileLogLevel ?? window.kosLogLevel ?? process.env.KOS_LOG_LEVEL;
|
|
455
|
-
if (logLevel) {
|
|
456
|
-
return logLevel;
|
|
457
|
-
}
|
|
458
|
-
return "WARN";
|
|
459
|
-
};
|
|
460
|
-
const getKosMessageLogging = () => {
|
|
461
|
-
const enableAll = window.kosMessageLogging || process.env.KOS_MESSAGE_LOGGING === "true";
|
|
462
|
-
return enableAll;
|
|
463
|
-
};
|
|
464
|
-
const getLogMessageToStudio = () => {
|
|
465
|
-
const enableAll = window.kosMessageStudioLogging || process.env.KOS_MESSAGE_STUDIO_LOGGING === "true";
|
|
466
|
-
return enableAll;
|
|
467
|
-
};
|
|
468
|
-
const UI_GROUP_OVERRIDE = "ui:group";
|
|
469
|
-
const UI_LOGGER_OVERRIDE = "ui:logger";
|
|
470
|
-
const LEVELS = ["trace", "debug", "info", "warn", "error"];
|
|
471
|
-
const getLoggerGroup = (loggerName) => {
|
|
472
|
-
const grouped = loggerName.indexOf(":::");
|
|
473
|
-
if (grouped >= 0) {
|
|
474
|
-
return loggerName.slice(0, grouped);
|
|
475
|
-
}
|
|
476
|
-
const ungrouped = loggerName.indexOf("::");
|
|
477
|
-
return ungrouped >= 0 ? loggerName.slice(0, ungrouped) : "";
|
|
478
|
-
};
|
|
479
|
-
const matchesPattern = (value, pattern) => {
|
|
480
|
-
const source = pattern.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join(".*");
|
|
481
|
-
return new RegExp(`^${source}$`).test(value);
|
|
482
|
-
};
|
|
483
|
-
const matches = (loggerName, override) => {
|
|
484
|
-
const wildcard = override.name.includes("*");
|
|
485
|
-
if (override.type === UI_GROUP_OVERRIDE) {
|
|
486
|
-
const group = getLoggerGroup(loggerName);
|
|
487
|
-
return wildcard ? matchesPattern(group, override.name) : group === override.name;
|
|
488
|
-
}
|
|
489
|
-
if (override.type === UI_LOGGER_OVERRIDE) {
|
|
490
|
-
return wildcard ? matchesPattern(loggerName, override.name) : loggerName.startsWith(override.name);
|
|
491
|
-
}
|
|
492
|
-
return false;
|
|
493
|
-
};
|
|
494
|
-
const resolveOverrideLevel = (loggerName, overrides) => overrides.filter((override) => matches(loggerName, override)).map((override) => override.level.toLowerCase()).filter((level2) => LEVELS.includes(level2)).sort((a, b) => LEVELS.indexOf(a) - LEVELS.indexOf(b))[0];
|
|
495
|
-
const WS_LOG = "ws-log";
|
|
496
|
-
const originalFactory = log$M.methodFactory;
|
|
497
|
-
const enableMessageLogging = getKosMessageLogging();
|
|
498
|
-
const enableStudioMessageLogging = getLogMessageToStudio();
|
|
499
|
-
log$M.methodFactory = function(methodName, logLevel, loggerName) {
|
|
500
|
-
const rawMethod = originalFactory(methodName, logLevel, loggerName);
|
|
501
|
-
return function(...args) {
|
|
502
|
-
const _name = loggerName ? String(loggerName) : "";
|
|
503
|
-
const prefix = _name ? `[${String(_name).substring(_name.lastIndexOf(":") + 1)}] | ` : "[root] | ";
|
|
504
|
-
const message = args.map(
|
|
505
|
-
(arg) => typeof arg === "object" ? JSON.stringify(arg) : String(arg)
|
|
506
|
-
).join(" ");
|
|
507
|
-
rawMethod(`${prefix}${message}`);
|
|
508
|
-
if (globalThis?.kosConfig?.logging && globalThis.kosLog && (loggerName !== WS_LOG || enableMessageLogging && enableStudioMessageLogging)) {
|
|
509
|
-
globalThis.kosLog(`UI: ${prefix}${message}`);
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
};
|
|
513
|
-
let level = getLogLevel();
|
|
514
|
-
log$M.setLevel(level);
|
|
515
|
-
window.setKosLogLevel = (_level) => {
|
|
516
|
-
level = _level;
|
|
517
|
-
log$M.setLevel(_level);
|
|
518
|
-
};
|
|
519
|
-
const wsLog = log$M.getLogger(WS_LOG);
|
|
520
|
-
window.enableKosMessageLog = () => {
|
|
521
|
-
wsLog.setLevel(log$M.levels.INFO);
|
|
522
|
-
};
|
|
523
|
-
window.disableKosMessageLog = () => {
|
|
524
|
-
wsLog.setLevel(log$M.levels.ERROR);
|
|
525
|
-
};
|
|
526
|
-
if (enableMessageLogging) {
|
|
527
|
-
window.enableKosMessageLog();
|
|
528
|
-
} else {
|
|
529
|
-
window.disableKosMessageLog();
|
|
530
|
-
}
|
|
531
|
-
const styles = [
|
|
532
|
-
"color: black",
|
|
533
|
-
"display: block",
|
|
534
|
-
"background-color: lightgreen",
|
|
535
|
-
"padding: 4px",
|
|
536
|
-
"margin: 0",
|
|
537
|
-
"text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3)",
|
|
538
|
-
"box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 5px 3px -5px rgba(0, 0, 0, 0.5), 0 -13px 5px -10px rgba(255, 255, 255, 0.4) inset",
|
|
539
|
-
"font-weight: bold"
|
|
540
|
-
].join(";");
|
|
541
|
-
const received = [
|
|
542
|
-
"color: black",
|
|
543
|
-
"display: block",
|
|
544
|
-
"padding: 4px",
|
|
545
|
-
"background-color: yellow",
|
|
546
|
-
"margin: 0",
|
|
547
|
-
"text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3)",
|
|
548
|
-
"box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 5px 3px -5px rgba(0, 0, 0, 0.5), 0 -13px 5px -10px rgba(255, 255, 255, 0.4) inset",
|
|
549
|
-
"font-weight: bold"
|
|
550
|
-
].join(";");
|
|
551
|
-
const conditionallyLog = (level2) => (fn) => {
|
|
552
|
-
if (log$M.getLevel() <= level2) {
|
|
553
|
-
fn();
|
|
554
|
-
}
|
|
555
|
-
};
|
|
556
|
-
const KosLog = {
|
|
557
|
-
...log$M,
|
|
558
|
-
ifDebug: conditionallyLog(log$M.levels.DEBUG),
|
|
559
|
-
ifInfo: conditionallyLog(log$M.levels.INFO),
|
|
560
|
-
ifWarn: conditionallyLog(log$M.levels.WARN),
|
|
561
|
-
ifError: conditionallyLog(log$M.levels.ERROR),
|
|
562
|
-
getLogger: (name) => log$M.getLogger(`kos::${name}`),
|
|
563
|
-
getLoggers: () => log$M.getLoggers(),
|
|
564
|
-
createLogger: ({ name, group }) => {
|
|
565
|
-
const loggerName = `${group ? `${group}:` : "kos"}::${name}`;
|
|
566
|
-
const _log = log$M.getLogger(loggerName);
|
|
567
|
-
const _level = resolveOverrideLevel(
|
|
568
|
-
loggerName,
|
|
569
|
-
globalThis.kos?.logOverrides ?? []
|
|
570
|
-
);
|
|
571
|
-
if (_level) {
|
|
572
|
-
_log.setLevel(_level);
|
|
573
|
-
}
|
|
574
|
-
return _log;
|
|
575
|
-
},
|
|
576
|
-
wsSend: (...msg) => {
|
|
577
|
-
const str = String(msg).replace(/\n/g, "\\n");
|
|
578
|
-
wsLog.info(`%c⬆ ${str}`, styles);
|
|
579
|
-
},
|
|
580
|
-
wsReceive: (...msg) => {
|
|
581
|
-
const str = String(msg).replace(/\n/g, "\\n");
|
|
582
|
-
wsLog.info(`%c⬇ ${str}`, received);
|
|
583
|
-
}
|
|
584
|
-
};
|
|
585
545
|
const SubscriptionHandlers = /* @__PURE__ */ Symbol(`SubscriptionHandlers`);
|
|
586
546
|
const DependencyModels = /* @__PURE__ */ Symbol(`DependencyModels`);
|
|
587
547
|
const FutureService = /* @__PURE__ */ Symbol(`FutureService`);
|
|
588
548
|
const ChildModels = /* @__PURE__ */ Symbol(`ChildModels`);
|
|
589
549
|
const ParentModel = /* @__PURE__ */ Symbol(`ParentModel`);
|
|
590
|
-
const LogConfig = /* @__PURE__ */ Symbol(`LogConfig`);
|
|
591
550
|
const ReferenceConfig = /* @__PURE__ */ Symbol(`ReferenceConfig`);
|
|
592
551
|
const KosModelSymbol = /* @__PURE__ */ Symbol(`KosModelSymbol`);
|
|
593
552
|
const ModelEffects = /* @__PURE__ */ Symbol(`ModelEffects`);
|
|
@@ -609,7 +568,7 @@ const KosViewModelSymbol = /* @__PURE__ */ Symbol(`KosViewModelSymbol`);
|
|
|
609
568
|
const ViewModelConfig = /* @__PURE__ */ Symbol(`ViewModelConfig`);
|
|
610
569
|
const ReloadAwareSetup = /* @__PURE__ */ Symbol(`ReloadAwareSetup`);
|
|
611
570
|
const MixinModels = /* @__PURE__ */ Symbol(`MixinModels`);
|
|
612
|
-
const log$
|
|
571
|
+
const log$1f = KosLog.createLogger({ group: LogGroup.core, name: "fsm-injection" });
|
|
613
572
|
function injectStateMachineSupport(modelInstance) {
|
|
614
573
|
const fsmSetup = modelInstance[StateMachineSetup];
|
|
615
574
|
if (!fsmSetup) return;
|
|
@@ -653,7 +612,7 @@ function initializeFsmProperties(modelInstance, options) {
|
|
|
653
612
|
const config2 = modelInstance._fsmConfig;
|
|
654
613
|
const initialState = computeInitialState ? computeInitialState(modelInstance) : config2.initial;
|
|
655
614
|
if (computeInitialState && !config2.states[initialState]) {
|
|
656
|
-
log$
|
|
615
|
+
log$1f.warn(
|
|
657
616
|
`computeInitialState returned "${initialState}" which is not a valid state. Falling back to "${config2.initial}".`
|
|
658
617
|
);
|
|
659
618
|
modelInstance[stateProperty] = config2.initial;
|
|
@@ -783,7 +742,7 @@ function handleAsyncEntryResult(instance, state, stateProperty, result) {
|
|
|
783
742
|
if (stateConfig.onError && instance[stateProperty] === state) {
|
|
784
743
|
instance.transition(stateConfig.onError);
|
|
785
744
|
} else {
|
|
786
|
-
log$
|
|
745
|
+
log$1f.error(`Async entry handler for state "${state}" failed:`, err);
|
|
787
746
|
}
|
|
788
747
|
}
|
|
789
748
|
);
|
|
@@ -824,7 +783,7 @@ function initializeStateMachine(modelInstance, lifecycle) {
|
|
|
824
783
|
modelInstance._fsmInitialized = true;
|
|
825
784
|
trackInitialStateInHistory(modelInstance, config2.initial, options);
|
|
826
785
|
executeInitialStateEntryHandler(modelInstance, config2.initial);
|
|
827
|
-
log$
|
|
786
|
+
log$1f.debug(
|
|
828
787
|
`FSM initialized for model ${modelInstance.id} at lifecycle ${lifecycle} with initial state "${config2.initial}"`
|
|
829
788
|
);
|
|
830
789
|
}
|
|
@@ -948,9 +907,12 @@ function getHttpRouteHandlers(model) {
|
|
|
948
907
|
return model?.[HttpRouteHandlers] || [];
|
|
949
908
|
}
|
|
950
909
|
class KosLoggerFactory {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
910
|
+
/**
|
|
911
|
+
* The logger for a model type, `model:::{modelTypeName}`. Every instance of
|
|
912
|
+
* the type shares it; put the instance id in the message where it matters.
|
|
913
|
+
*/
|
|
914
|
+
static create({ modelTypeName }) {
|
|
915
|
+
return KosLog.createLogger({ group: LogGroup.model, name: modelTypeName });
|
|
954
916
|
}
|
|
955
917
|
}
|
|
956
918
|
function kosLoggerAware(options) {
|
|
@@ -968,8 +930,7 @@ function kosLoggerAware(options) {
|
|
|
968
930
|
if (!sharedLogger) {
|
|
969
931
|
const modelType = getModelType();
|
|
970
932
|
sharedLogger = KosLoggerFactory.create({
|
|
971
|
-
modelTypeName: loggerContext || modelType
|
|
972
|
-
component: "kos-model"
|
|
933
|
+
modelTypeName: loggerContext || modelType
|
|
973
934
|
});
|
|
974
935
|
}
|
|
975
936
|
return sharedLogger;
|
|
@@ -1020,7 +981,7 @@ class ServiceRequestError extends Error {
|
|
|
1020
981
|
this.responseHeaders = details.responseHeaders ?? {};
|
|
1021
982
|
}
|
|
1022
983
|
}
|
|
1023
|
-
const log$
|
|
984
|
+
const log$1e = KosLog.createLogger({ group: LogGroup.core, name: "resolve-parameters" });
|
|
1024
985
|
const resolveParameters = ({
|
|
1025
986
|
value,
|
|
1026
987
|
modelId,
|
|
@@ -1052,11 +1013,11 @@ const resolveParameters = ({
|
|
|
1052
1013
|
)) {
|
|
1053
1014
|
const prop = modelData[propName];
|
|
1054
1015
|
if (prop !== null && prop !== void 0) {
|
|
1055
|
-
log$
|
|
1016
|
+
log$1e.debug(`Resolved ${match} to ${prop}`);
|
|
1056
1017
|
return prop;
|
|
1057
1018
|
} else {
|
|
1058
1019
|
const logLevel2 = isOnlyPropKey ? "debug" : "warn";
|
|
1059
|
-
log$
|
|
1020
|
+
log$1e[logLevel2](
|
|
1060
1021
|
`Property ${propName} is null or undefined${isOnlyPropKey ? "" : " in composite string"}, marking for undefined return`
|
|
1061
1022
|
);
|
|
1062
1023
|
hasUnresolvedProp = true;
|
|
@@ -1064,7 +1025,7 @@ const resolveParameters = ({
|
|
|
1064
1025
|
}
|
|
1065
1026
|
}
|
|
1066
1027
|
const logLevel = isOnlyPropKey ? "debug" : "warn";
|
|
1067
|
-
log$
|
|
1028
|
+
log$1e[logLevel](
|
|
1068
1029
|
`Property ${propName} not found in modelData${isOnlyPropKey ? "" : " for composite string"}`
|
|
1069
1030
|
);
|
|
1070
1031
|
return match;
|
|
@@ -1079,7 +1040,7 @@ const resolveParameters = ({
|
|
|
1079
1040
|
}
|
|
1080
1041
|
return _value;
|
|
1081
1042
|
};
|
|
1082
|
-
const log$
|
|
1043
|
+
const log$1d = KosLog.createLogger({ group: LogGroup.core, name: "ServiceRequestHelpers" });
|
|
1083
1044
|
function resolveServiceRequestParameters(metadata, modelInstance, args, runtimeOptions) {
|
|
1084
1045
|
const resolvedPath = resolveParameters({
|
|
1085
1046
|
value: metadata.path,
|
|
@@ -1148,7 +1109,7 @@ function handleServiceRequestError(error, response, errorHandler, modelInstance,
|
|
|
1148
1109
|
});
|
|
1149
1110
|
switch (errorHandler.strategy) {
|
|
1150
1111
|
case "log":
|
|
1151
|
-
log$
|
|
1112
|
+
log$1d.error(`Service request status ${richError.status} error: ${error}`);
|
|
1152
1113
|
if (errorHandler.onError) {
|
|
1153
1114
|
errorHandler.onError(richError, modelInstance);
|
|
1154
1115
|
}
|
|
@@ -1261,7 +1222,7 @@ var ReplayStrategy = /* @__PURE__ */ ((ReplayStrategy2) => {
|
|
|
1261
1222
|
ReplayStrategy2["NONE"] = "none";
|
|
1262
1223
|
return ReplayStrategy2;
|
|
1263
1224
|
})(ReplayStrategy || {});
|
|
1264
|
-
const log$
|
|
1225
|
+
const log$1c = KosLog.createLogger({ group: LogGroup.core, name: "kos-state-machine" });
|
|
1265
1226
|
function kosStateMachine(config2, options) {
|
|
1266
1227
|
return (target) => {
|
|
1267
1228
|
target.prototype[StateMachineSetup] = {
|
|
@@ -1318,7 +1279,7 @@ function kosStateGuard(options) {
|
|
|
1318
1279
|
if (shouldThrow) {
|
|
1319
1280
|
throw new Error(message);
|
|
1320
1281
|
} else {
|
|
1321
|
-
log$
|
|
1282
|
+
log$1c.warn(message);
|
|
1322
1283
|
return void 0;
|
|
1323
1284
|
}
|
|
1324
1285
|
}
|
|
@@ -1344,6 +1305,10 @@ const kosDependency = ({
|
|
|
1344
1305
|
resolutionPolicy
|
|
1345
1306
|
};
|
|
1346
1307
|
};
|
|
1308
|
+
const log$1b = KosLog.createLogger({
|
|
1309
|
+
group: LogGroup.model,
|
|
1310
|
+
name: "future-aware"
|
|
1311
|
+
});
|
|
1347
1312
|
class MultipleFutureHandler {
|
|
1348
1313
|
futures;
|
|
1349
1314
|
defaultContext;
|
|
@@ -1434,7 +1399,7 @@ class FutureHandler {
|
|
|
1434
1399
|
try {
|
|
1435
1400
|
await this._future.cancelFuture();
|
|
1436
1401
|
} catch (e) {
|
|
1437
|
-
|
|
1402
|
+
log$1b.error(e);
|
|
1438
1403
|
throw e;
|
|
1439
1404
|
}
|
|
1440
1405
|
}
|
|
@@ -1559,6 +1524,10 @@ const ObservableData = (initialData) => {
|
|
|
1559
1524
|
const od = createObservableData(ObservableDataMap, initialData);
|
|
1560
1525
|
return new od(initialData);
|
|
1561
1526
|
};
|
|
1527
|
+
const log$1a = KosLog.createLogger({
|
|
1528
|
+
group: LogGroup.core,
|
|
1529
|
+
name: "extension-manager"
|
|
1530
|
+
});
|
|
1562
1531
|
const DEFAULT_EXTENSION_OPTIONS = {
|
|
1563
1532
|
failurePolicy: "throw"
|
|
1564
1533
|
};
|
|
@@ -1610,8 +1579,8 @@ const _ExtensionManager = {
|
|
|
1610
1579
|
return await loader(data);
|
|
1611
1580
|
} catch (e) {
|
|
1612
1581
|
if (options.failurePolicy === "continue") {
|
|
1613
|
-
|
|
1614
|
-
|
|
1582
|
+
log$1a.error(`Error executing data loader for id ${id}`);
|
|
1583
|
+
log$1a.error(e);
|
|
1615
1584
|
return void 0;
|
|
1616
1585
|
}
|
|
1617
1586
|
throw new ExtensionException(id, "dataLoader", e);
|
|
@@ -1636,8 +1605,8 @@ const _ExtensionManager = {
|
|
|
1636
1605
|
return mapper(data, context);
|
|
1637
1606
|
} catch (e) {
|
|
1638
1607
|
if (options.failurePolicy === "continue") {
|
|
1639
|
-
|
|
1640
|
-
|
|
1608
|
+
log$1a.error(`Error executing property mapper for id ${id}`);
|
|
1609
|
+
log$1a.error(e);
|
|
1641
1610
|
return "";
|
|
1642
1611
|
}
|
|
1643
1612
|
throw new ExtensionException(id, "propertyMapper", e);
|
|
@@ -1665,8 +1634,8 @@ const _ExtensionManager = {
|
|
|
1665
1634
|
Object.assign(result, _interim);
|
|
1666
1635
|
} catch (e) {
|
|
1667
1636
|
if (options.failurePolicy === "continue") {
|
|
1668
|
-
|
|
1669
|
-
|
|
1637
|
+
log$1a.error(`Error executing data mapper for id ${id}`);
|
|
1638
|
+
log$1a.error(e);
|
|
1670
1639
|
continue;
|
|
1671
1640
|
}
|
|
1672
1641
|
throw new ExtensionException(id, "dataMapper", e);
|
|
@@ -1678,7 +1647,7 @@ const _ExtensionManager = {
|
|
|
1678
1647
|
canvas: {
|
|
1679
1648
|
registerRenderer: (id, renderer) => {
|
|
1680
1649
|
if (!ExtensionManager[EXTENSION_CANVAS_RENDERER]) {
|
|
1681
|
-
|
|
1650
|
+
log$1a.warn(
|
|
1682
1651
|
`Canvas renderer extension point is not registered. Cannot register renderer "${id}".`
|
|
1683
1652
|
);
|
|
1684
1653
|
return;
|
|
@@ -1704,6 +1673,10 @@ const INDEX_COLLECTION_KEY = "@kosdev-code/kos-ui-sdk.collection";
|
|
|
1704
1673
|
function isIndexableItem(value) {
|
|
1705
1674
|
return typeof value === "object" && value !== null && INDEX_RECORD_SYMBOL in value;
|
|
1706
1675
|
}
|
|
1676
|
+
const log$19 = KosLog.createLogger({
|
|
1677
|
+
group: LogGroup.core,
|
|
1678
|
+
name: "kos-container-index"
|
|
1679
|
+
});
|
|
1707
1680
|
function isPromiseLike(value) {
|
|
1708
1681
|
return typeof value?.then === "function";
|
|
1709
1682
|
}
|
|
@@ -1755,7 +1728,7 @@ class KosContainerIndex {
|
|
|
1755
1728
|
const set = map.get(key) || /* @__PURE__ */ new Set();
|
|
1756
1729
|
this._map.set(key, set);
|
|
1757
1730
|
} else {
|
|
1758
|
-
|
|
1731
|
+
log$19.debug(`KosContainerIndex - Index ${key} is the same`);
|
|
1759
1732
|
}
|
|
1760
1733
|
});
|
|
1761
1734
|
}
|
|
@@ -1831,7 +1804,7 @@ function observeComputedProperties(model, callback, keys = []) {
|
|
|
1831
1804
|
);
|
|
1832
1805
|
return disposers;
|
|
1833
1806
|
}
|
|
1834
|
-
const log$
|
|
1807
|
+
const log$18 = KosLog.createLogger({ group: LogGroup.core, name: "kos-container-model" });
|
|
1835
1808
|
class KosModelContainer {
|
|
1836
1809
|
_data;
|
|
1837
1810
|
_sortKey;
|
|
@@ -1953,14 +1926,14 @@ class KosModelContainer {
|
|
|
1953
1926
|
async removeAndDestroy(id) {
|
|
1954
1927
|
const model = this.getModel(id);
|
|
1955
1928
|
if (!model) {
|
|
1956
|
-
log$
|
|
1929
|
+
log$18.debug(`Model ${id} not found in container, skipping destroy`);
|
|
1957
1930
|
return;
|
|
1958
1931
|
}
|
|
1959
1932
|
this.removeModel(id);
|
|
1960
1933
|
try {
|
|
1961
1934
|
await destroyKosModel(model);
|
|
1962
1935
|
} catch (error) {
|
|
1963
|
-
log$
|
|
1936
|
+
log$18.error(`Failed to destroy model ${id}:`, error);
|
|
1964
1937
|
throw error;
|
|
1965
1938
|
}
|
|
1966
1939
|
}
|
|
@@ -1977,7 +1950,7 @@ class KosModelContainer {
|
|
|
1977
1950
|
async removeAndDestroyAll(ids) {
|
|
1978
1951
|
const models2 = ids.map((id) => this.getModel(id)).filter((model) => model !== void 0);
|
|
1979
1952
|
if (models2.length === 0) {
|
|
1980
|
-
log$
|
|
1953
|
+
log$18.debug("No models found to destroy");
|
|
1981
1954
|
return;
|
|
1982
1955
|
}
|
|
1983
1956
|
this.removeAll(ids);
|
|
@@ -1986,7 +1959,7 @@ class KosModelContainer {
|
|
|
1986
1959
|
);
|
|
1987
1960
|
results.forEach((result, index) => {
|
|
1988
1961
|
if (result.status === "rejected") {
|
|
1989
|
-
log$
|
|
1962
|
+
log$18.error(
|
|
1990
1963
|
`Failed to destroy model ${models2[index].id}:`,
|
|
1991
1964
|
result.reason
|
|
1992
1965
|
);
|
|
@@ -2159,7 +2132,7 @@ class KosModelContainer {
|
|
|
2159
2132
|
const idx = this.index.get(indexName);
|
|
2160
2133
|
return idx.keys ?? [];
|
|
2161
2134
|
} else {
|
|
2162
|
-
log$
|
|
2135
|
+
log$18.info(
|
|
2163
2136
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
2164
2137
|
);
|
|
2165
2138
|
return [];
|
|
@@ -2171,7 +2144,7 @@ class KosModelContainer {
|
|
|
2171
2144
|
if (idx.index.has(indexKey)) {
|
|
2172
2145
|
return idx.getByKey(indexKey);
|
|
2173
2146
|
} else {
|
|
2174
|
-
log$
|
|
2147
|
+
log$18.info(
|
|
2175
2148
|
`key ${indexKey} not found in ${indexName} index: ${Array.from(
|
|
2176
2149
|
idx.index.keys()
|
|
2177
2150
|
)}`
|
|
@@ -2179,7 +2152,7 @@ class KosModelContainer {
|
|
|
2179
2152
|
return [];
|
|
2180
2153
|
}
|
|
2181
2154
|
} else {
|
|
2182
|
-
log$
|
|
2155
|
+
log$18.info(
|
|
2183
2156
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
2184
2157
|
);
|
|
2185
2158
|
return [];
|
|
@@ -2206,7 +2179,7 @@ class KosModelContainer {
|
|
|
2206
2179
|
* @private
|
|
2207
2180
|
*/
|
|
2208
2181
|
_logCapacityWarning(toEvict) {
|
|
2209
|
-
log$
|
|
2182
|
+
log$18.info(
|
|
2210
2183
|
`Container capacity exceeded (${this._data.size}/${this._maxCapacity}). Evicting ${toEvict} models using ${this._evictionStrategy} strategy.`,
|
|
2211
2184
|
{ parentId: this._parentId }
|
|
2212
2185
|
);
|
|
@@ -2269,7 +2242,7 @@ class KosModelContainer {
|
|
|
2269
2242
|
const candidates = this._customEvictionFilter(this.data);
|
|
2270
2243
|
return candidates.slice(0, count);
|
|
2271
2244
|
}
|
|
2272
|
-
log$
|
|
2245
|
+
log$18.error(
|
|
2273
2246
|
"Custom eviction strategy specified but no customEvictionFilter provided. Falling back to FIFO.",
|
|
2274
2247
|
{ parentId: this._parentId }
|
|
2275
2248
|
);
|
|
@@ -2281,7 +2254,7 @@ class KosModelContainer {
|
|
|
2281
2254
|
*/
|
|
2282
2255
|
async _removeEvictedModels(models2) {
|
|
2283
2256
|
for (const model of models2) {
|
|
2284
|
-
log$
|
|
2257
|
+
log$18.info(
|
|
2285
2258
|
`Evicting model: ${model.id} (type: ${model.constructor.name})`,
|
|
2286
2259
|
{
|
|
2287
2260
|
modelId: model.id,
|
|
@@ -2291,7 +2264,7 @@ class KosModelContainer {
|
|
|
2291
2264
|
);
|
|
2292
2265
|
this.removeModel(model.id, true);
|
|
2293
2266
|
destroyKosModel(model).catch(
|
|
2294
|
-
(e) => log$
|
|
2267
|
+
(e) => log$18.error(`Failed to destroy evicted model ${model.id}:`, e)
|
|
2295
2268
|
);
|
|
2296
2269
|
}
|
|
2297
2270
|
}
|
|
@@ -2300,7 +2273,7 @@ class KosModelContainer {
|
|
|
2300
2273
|
* @private
|
|
2301
2274
|
*/
|
|
2302
2275
|
_logEvictionComplete(evictedCount) {
|
|
2303
|
-
log$
|
|
2276
|
+
log$18.info(
|
|
2304
2277
|
`Evicted ${evictedCount} models. Current size: ${this._data.size}/${this._maxCapacity}`,
|
|
2305
2278
|
{ parentId: this._parentId }
|
|
2306
2279
|
);
|
|
@@ -2309,9 +2282,9 @@ class KosModelContainer {
|
|
|
2309
2282
|
this._data.forEach((model) => {
|
|
2310
2283
|
const modelId = model.id;
|
|
2311
2284
|
destroyKosModel(model).then(() => {
|
|
2312
|
-
log$
|
|
2285
|
+
log$18.debug(`${modelId} destroyed, removing from map`);
|
|
2313
2286
|
this.removeModel(modelId, true);
|
|
2314
|
-
}).catch((e) => log$
|
|
2287
|
+
}).catch((e) => log$18.error(e));
|
|
2315
2288
|
});
|
|
2316
2289
|
this.increment();
|
|
2317
2290
|
}
|
|
@@ -2454,12 +2427,16 @@ const whenReady = async (dataModel) => {
|
|
|
2454
2427
|
}
|
|
2455
2428
|
return dataModel;
|
|
2456
2429
|
};
|
|
2430
|
+
const log$17 = KosLog.createLogger({
|
|
2431
|
+
group: LogGroup.core,
|
|
2432
|
+
name: "kos-model-utils"
|
|
2433
|
+
});
|
|
2457
2434
|
const destroyKosModel = async (model) => {
|
|
2458
2435
|
await KosCore.getInstance().whenReady();
|
|
2459
2436
|
await KosCore.getInstance().modelManager.initiateDestroyModel(model);
|
|
2460
2437
|
};
|
|
2461
2438
|
const unloadKosModel = async (dataModel) => {
|
|
2462
|
-
|
|
2439
|
+
log$17.warn(
|
|
2463
2440
|
`unloadKosModel(${dataModel?.id}) is deprecated and never resolves. Use destroyKosModel() to release a model, or reload() to refresh it.`
|
|
2464
2441
|
);
|
|
2465
2442
|
await KosCore.getInstance().whenReady();
|
|
@@ -2472,16 +2449,16 @@ const unloadKosModel = async (dataModel) => {
|
|
|
2472
2449
|
}
|
|
2473
2450
|
};
|
|
2474
2451
|
const resetKosModel = async (model) => {
|
|
2475
|
-
|
|
2452
|
+
log$17.warn(
|
|
2476
2453
|
`resetKosModel(${model?.id}) is deprecated: the reset route drops every topic handler registered at INIT or with no lifecycle. Implement reload() on the model and refetch and reconcile in place.`
|
|
2477
2454
|
);
|
|
2478
2455
|
await KosCore.getInstance().whenReady();
|
|
2479
2456
|
await KosCore.getInstance().modelManager.reloadModel(model);
|
|
2480
|
-
|
|
2457
|
+
log$17.debug(
|
|
2481
2458
|
`reload model initiated for model ${model.id}, model ready: ${isKosModelReady(model)} - ${Date.now()} `
|
|
2482
2459
|
);
|
|
2483
2460
|
await whenReady(model);
|
|
2484
|
-
|
|
2461
|
+
log$17.debug(
|
|
2485
2462
|
`reload model complete for model ${model.id}, model ready: ${isKosModelReady(model)} - ${Date.now()} `
|
|
2486
2463
|
);
|
|
2487
2464
|
};
|
|
@@ -2557,7 +2534,7 @@ const getObservableCompanions = (modelId) => {
|
|
|
2557
2534
|
const resolveKosCompanion = (modelId, resolver) => {
|
|
2558
2535
|
const model = KosCore.getInstance().modelManager.getModelById(modelId);
|
|
2559
2536
|
if (!model) {
|
|
2560
|
-
|
|
2537
|
+
log$17.info(`Model not found for id ${modelId}`);
|
|
2561
2538
|
return void 0;
|
|
2562
2539
|
}
|
|
2563
2540
|
const companionModel = Array.from(model.companionModels.all()).find(
|
|
@@ -2596,7 +2573,7 @@ const getKosModelActivationState = (model) => {
|
|
|
2596
2573
|
}
|
|
2597
2574
|
};
|
|
2598
2575
|
};
|
|
2599
|
-
const log$
|
|
2576
|
+
const log$16 = KosLog.createLogger({ group: LogGroup.core, name: "kos-model-factory" });
|
|
2600
2577
|
const KosModelFactory = {
|
|
2601
2578
|
byModelType: (modelType) => KosCore.getInstance().modelManager.getModelFactory(
|
|
2602
2579
|
modelType
|
|
@@ -2604,7 +2581,7 @@ const KosModelFactory = {
|
|
|
2604
2581
|
getModelInstance: (id, modelType, options) => {
|
|
2605
2582
|
const factory = KosModelFactory.byModelType(modelType);
|
|
2606
2583
|
if (!factory) {
|
|
2607
|
-
log$
|
|
2584
|
+
log$16.error(
|
|
2608
2585
|
`No registered factory found for model type ${modelType}. Please register a factory for this model type. `
|
|
2609
2586
|
);
|
|
2610
2587
|
throw Error(`No factory found for model type ${modelType}`);
|
|
@@ -2643,6 +2620,10 @@ const Kos = {
|
|
|
2643
2620
|
instance: (modelType) => (id) => KosModelFactory.getModelInstance(id, modelType)
|
|
2644
2621
|
}
|
|
2645
2622
|
};
|
|
2623
|
+
const log$15 = KosLog.createLogger({
|
|
2624
|
+
group: LogGroup.core,
|
|
2625
|
+
name: "registration-manager"
|
|
2626
|
+
});
|
|
2646
2627
|
window.KosRegistry = window.KosRegistry || {
|
|
2647
2628
|
coreModels: /* @__PURE__ */ new Map(),
|
|
2648
2629
|
preloadModels: [],
|
|
@@ -2687,7 +2668,7 @@ const RegistrationManager = {
|
|
|
2687
2668
|
}
|
|
2688
2669
|
if (KosCore.getInstance().isReady) {
|
|
2689
2670
|
if (!KosCore.getInstance().modelManager.registry.models[register.type]) {
|
|
2690
|
-
|
|
2671
|
+
log$15.info(
|
|
2691
2672
|
`Model with type ${register.type} doesn't exist. Adding new registration`
|
|
2692
2673
|
);
|
|
2693
2674
|
KosCore.getInstance().modelManager.registry.models[register.type] = register.registration[register.type];
|
|
@@ -2919,7 +2900,7 @@ class SingletonKosModelRegistrationFactory extends KosBaseModelRegistration {
|
|
|
2919
2900
|
};
|
|
2920
2901
|
}
|
|
2921
2902
|
}
|
|
2922
|
-
const log$
|
|
2903
|
+
const log$14 = KosLog.createLogger({ group: LogGroup.core, name: "kos-model" });
|
|
2923
2904
|
const FUTURE_CANCEL_END_STATE = "CANCEL";
|
|
2924
2905
|
function resolveParentContext(TargetClass, modelId, modelData) {
|
|
2925
2906
|
const parentIdRaw = TargetClass[ParentModel]?.parentId;
|
|
@@ -3214,7 +3195,7 @@ function injectCompanionSupport(modelInstance, initialData) {
|
|
|
3214
3195
|
const { mode, parentProperty, excludeProperties } = companionConfig;
|
|
3215
3196
|
const parentModel = initialData.companionParent;
|
|
3216
3197
|
if (!parentModel) {
|
|
3217
|
-
log$
|
|
3198
|
+
log$14.warn(
|
|
3218
3199
|
`Companion decorator configured but no parent model found in initialData.companionParent`
|
|
3219
3200
|
);
|
|
3220
3201
|
return;
|
|
@@ -3288,7 +3269,7 @@ function injectCompanionSupport(modelInstance, initialData) {
|
|
|
3288
3269
|
});
|
|
3289
3270
|
}
|
|
3290
3271
|
} catch (error) {
|
|
3291
|
-
log$
|
|
3272
|
+
log$14.debug(
|
|
3292
3273
|
`Skipping companion proxy for property ${propertyName}:`,
|
|
3293
3274
|
error
|
|
3294
3275
|
);
|
|
@@ -3325,7 +3306,7 @@ function makeSafeObservable(instance) {
|
|
|
3325
3306
|
try {
|
|
3326
3307
|
return mobx.makeAutoObservable(instance);
|
|
3327
3308
|
} catch (e) {
|
|
3328
|
-
log$
|
|
3309
|
+
log$14.error("Failed to make observable:", e);
|
|
3329
3310
|
return instance;
|
|
3330
3311
|
}
|
|
3331
3312
|
}
|
|
@@ -3335,9 +3316,8 @@ const modelConstructorProxy = {
|
|
|
3335
3316
|
const kosContext = KosContextManager.createContext(modelId);
|
|
3336
3317
|
resolveParentContext(TargetClass, modelId, initialData);
|
|
3337
3318
|
const hasLoggerAware = !!TargetClass.prototype[LoggerSetup];
|
|
3338
|
-
const logger = hasLoggerAware ? null :
|
|
3339
|
-
|
|
3340
|
-
group: TargetClass[LogConfig]?.group ?? "kos-model"
|
|
3319
|
+
const logger = hasLoggerAware ? null : KosLoggerFactory.create({
|
|
3320
|
+
modelTypeName: TargetClass.prototype.modelTypeId
|
|
3341
3321
|
});
|
|
3342
3322
|
const modelInstance = new TargetClass(modelId, initialData, {
|
|
3343
3323
|
logger,
|
|
@@ -3368,8 +3348,8 @@ function kosModel(config2) {
|
|
|
3368
3348
|
typedCtor.prototype[OptionsRequired] = true;
|
|
3369
3349
|
}
|
|
3370
3350
|
KosLog.ifDebug(() => {
|
|
3371
|
-
|
|
3372
|
-
});
|
|
3351
|
+
log$14.debug(`Registering model with id ${modelConfig.modelTypeId}`);
|
|
3352
|
+
}, log$14);
|
|
3373
3353
|
const proxiedCtor = new Proxy(typedCtor, modelConstructorProxy);
|
|
3374
3354
|
if (modelConfig.singleton !== void 0) {
|
|
3375
3355
|
let registration;
|
|
@@ -3665,7 +3645,7 @@ const KosDeletionManager = {
|
|
|
3665
3645
|
}
|
|
3666
3646
|
}
|
|
3667
3647
|
};
|
|
3668
|
-
const log$
|
|
3648
|
+
const log$13 = KosLog.createLogger({ group: LogGroup.core, name: "kos-dependency-manager" });
|
|
3669
3649
|
class KosDependencyManager {
|
|
3670
3650
|
_usedByCache = /* @__PURE__ */ new Map();
|
|
3671
3651
|
_usesCache = /* @__PURE__ */ new Map();
|
|
@@ -3720,7 +3700,7 @@ class KosDependencyManager {
|
|
|
3720
3700
|
canDestroy(modelId) {
|
|
3721
3701
|
const usedBy = this._usedByCache.get(modelId);
|
|
3722
3702
|
if (usedBy?.length) {
|
|
3723
|
-
log$
|
|
3703
|
+
log$13.info(`Model ${modelId} is still used by: ${usedBy.join(", ")}`);
|
|
3724
3704
|
return false;
|
|
3725
3705
|
}
|
|
3726
3706
|
return true;
|
|
@@ -3730,7 +3710,7 @@ class KosDependencyManager {
|
|
|
3730
3710
|
this._usesCache.clear();
|
|
3731
3711
|
}
|
|
3732
3712
|
}
|
|
3733
|
-
const log$
|
|
3713
|
+
const log$12 = KosLog.createLogger({ group: LogGroup.core, name: "kos-model-cache" });
|
|
3734
3714
|
class KosModelCache {
|
|
3735
3715
|
constructor(preloadKeys = []) {
|
|
3736
3716
|
this.preloadKeys = preloadKeys;
|
|
@@ -3781,11 +3761,11 @@ class KosModelCache {
|
|
|
3781
3761
|
}
|
|
3782
3762
|
preload(createFn) {
|
|
3783
3763
|
if (this._isPreloaded) {
|
|
3784
|
-
log$
|
|
3764
|
+
log$12.debug("Returning cached preloaded models");
|
|
3785
3765
|
return this._preloaded;
|
|
3786
3766
|
}
|
|
3787
3767
|
this._preloaded = this.preloadKeys.map((key) => {
|
|
3788
|
-
log$
|
|
3768
|
+
log$12.debug(
|
|
3789
3769
|
`Preloading model: ${typeof key === "string" ? key : key.modelType}`
|
|
3790
3770
|
);
|
|
3791
3771
|
return createFn(key);
|
|
@@ -3807,6 +3787,10 @@ const clearModelHookCacheEntry = (modelId) => {
|
|
|
3807
3787
|
cache.delete(modelId);
|
|
3808
3788
|
}
|
|
3809
3789
|
};
|
|
3790
|
+
const log$11 = KosLog.createLogger({
|
|
3791
|
+
group: LogGroup.core,
|
|
3792
|
+
name: "model-error-utils"
|
|
3793
|
+
});
|
|
3810
3794
|
class KosModelError extends Error {
|
|
3811
3795
|
context;
|
|
3812
3796
|
originalCause;
|
|
@@ -3868,10 +3852,10 @@ function enrichError(error, context) {
|
|
|
3868
3852
|
}
|
|
3869
3853
|
function logErrorCollection(errors, summary) {
|
|
3870
3854
|
if (errors.length === 0) return;
|
|
3871
|
-
|
|
3855
|
+
log$11.error(`${summary} - ${errors.length} error(s) occurred:`);
|
|
3872
3856
|
errors.forEach(({ error, context }, index) => {
|
|
3873
3857
|
const enriched = error instanceof KosModelError ? error : enrichError(error, context);
|
|
3874
|
-
|
|
3858
|
+
log$11.error(
|
|
3875
3859
|
` [${index + 1}/${errors.length}] ${enriched.toDetailedString()}`
|
|
3876
3860
|
);
|
|
3877
3861
|
});
|
|
@@ -3887,7 +3871,7 @@ function logModelInstantiationError(error, context) {
|
|
|
3887
3871
|
});
|
|
3888
3872
|
}
|
|
3889
3873
|
const isKosCompanionTypeFactory = (obj) => typeof obj === "function";
|
|
3890
|
-
const log$
|
|
3874
|
+
const log$10 = KosLog.createLogger({ group: LogGroup.core, name: "kos-companion-instantiator" });
|
|
3891
3875
|
class KosCompanionInstantiator {
|
|
3892
3876
|
constructor(registry, cache2, createModel) {
|
|
3893
3877
|
this.registry = registry;
|
|
@@ -3909,7 +3893,7 @@ class KosCompanionInstantiator {
|
|
|
3909
3893
|
createCompanionModels(model, options, lifecycle) {
|
|
3910
3894
|
const companionDefs = this.getCompanionDefinitions(model.modelTypeName);
|
|
3911
3895
|
if (lifecycle !== void 0) {
|
|
3912
|
-
log$
|
|
3896
|
+
log$10.debug(
|
|
3913
3897
|
`Creating ${lifecycle} lifecycle companions for ${model.modelTypeName} [${model.modelId}]`
|
|
3914
3898
|
);
|
|
3915
3899
|
}
|
|
@@ -3961,7 +3945,7 @@ class KosCompanionInstantiator {
|
|
|
3961
3945
|
mobx.runInAction(() => {
|
|
3962
3946
|
model.modelData[property] = mixin.modelData;
|
|
3963
3947
|
});
|
|
3964
|
-
log$
|
|
3948
|
+
log$10.debug(
|
|
3965
3949
|
`Created mixin ${registration.type} for ${model.modelTypeName} [${model.modelId}]`
|
|
3966
3950
|
);
|
|
3967
3951
|
});
|
|
@@ -3993,7 +3977,7 @@ class KosCompanionInstantiator {
|
|
|
3993
3977
|
resolveFactoryCompanion(companionDef, model, options, requestedLifecycle) {
|
|
3994
3978
|
const companionType = companionDef.type(model.modelData, options);
|
|
3995
3979
|
if (!companionType) {
|
|
3996
|
-
log$
|
|
3980
|
+
log$10.debug(
|
|
3997
3981
|
`Companion factory returned undefined for ${model.modelTypeName} at ${requestedLifecycle || "INIT"} phase`
|
|
3998
3982
|
);
|
|
3999
3983
|
return null;
|
|
@@ -4052,7 +4036,7 @@ class KosCompanionInstantiator {
|
|
|
4052
4036
|
);
|
|
4053
4037
|
if (companion) {
|
|
4054
4038
|
this.attachCompanionToParent(companion, parentModel);
|
|
4055
|
-
log$
|
|
4039
|
+
log$10.debug(
|
|
4056
4040
|
`Created ${lifecycle || "INIT"} companion ${companionType} for ${parentModel.modelTypeName} [${parentModel.modelId}]`
|
|
4057
4041
|
);
|
|
4058
4042
|
}
|
|
@@ -4068,7 +4052,7 @@ class KosCompanionInstantiator {
|
|
|
4068
4052
|
*/
|
|
4069
4053
|
companionAlreadyExists(companionId, companionType, parentTypeName) {
|
|
4070
4054
|
if (this.cache.hasModel(companionId)) {
|
|
4071
|
-
log$
|
|
4055
|
+
log$10.debug(
|
|
4072
4056
|
`Companion ${companionType} already exists for ${parentTypeName}`
|
|
4073
4057
|
);
|
|
4074
4058
|
return true;
|
|
@@ -4153,6 +4137,10 @@ const TransitionMap = {
|
|
|
4153
4137
|
/* INIT */
|
|
4154
4138
|
]: transitionToInit
|
|
4155
4139
|
};
|
|
4140
|
+
const log$$ = KosLog.createLogger({
|
|
4141
|
+
group: LogGroup.core,
|
|
4142
|
+
name: "promise-utils"
|
|
4143
|
+
});
|
|
4156
4144
|
class ModelError extends Error {
|
|
4157
4145
|
model;
|
|
4158
4146
|
constructor(message, model) {
|
|
@@ -4164,7 +4152,7 @@ const rejectAfterDelay$1 = (ms, model, status) => {
|
|
|
4164
4152
|
let timeoutId;
|
|
4165
4153
|
const promise = new Promise((_, reject) => {
|
|
4166
4154
|
timeoutId = setTimeout(() => {
|
|
4167
|
-
|
|
4155
|
+
log$$.error(
|
|
4168
4156
|
`Model ${model.modelId} - ${model.modelTypeName} - ${status} timed out after ${ms}ms`
|
|
4169
4157
|
);
|
|
4170
4158
|
reject(
|
|
@@ -4180,6 +4168,7 @@ const rejectAfterDelay$1 = (ms, model, status) => {
|
|
|
4180
4168
|
};
|
|
4181
4169
|
return { promise, cancel };
|
|
4182
4170
|
};
|
|
4171
|
+
const log$_ = KosLog.createLogger({ group: LogGroup.core, name: "model-utils" });
|
|
4183
4172
|
const createModelDependency = (model, dependency) => {
|
|
4184
4173
|
const _dataModelId = dependency.id || dependency.modelType;
|
|
4185
4174
|
const dataModelId = resolveParameters({
|
|
@@ -4188,7 +4177,7 @@ const createModelDependency = (model, dependency) => {
|
|
|
4188
4177
|
modelId: model.modelId
|
|
4189
4178
|
});
|
|
4190
4179
|
const resolutionPolicy = dependency.resolutionPolicy || DependencyResolutionPolicy.CREATE;
|
|
4191
|
-
|
|
4180
|
+
log$_.debug(
|
|
4192
4181
|
`Resolving dependent model ${dependency.modelType} with id ${dataModelId} (policy: ${resolutionPolicy})`
|
|
4193
4182
|
);
|
|
4194
4183
|
const options = Object.keys(dependency?.options || {}).reduce((acc, curr) => {
|
|
@@ -4204,7 +4193,7 @@ const createModelDependency = (model, dependency) => {
|
|
|
4204
4193
|
const modelRegistry = modelManager.registry.models[dependency.modelType];
|
|
4205
4194
|
if (!modelRegistry) {
|
|
4206
4195
|
const errorMessage = `No model registered for type ${dependency.modelType}`;
|
|
4207
|
-
|
|
4196
|
+
log$_.error(
|
|
4208
4197
|
`Failed to resolve dependency for model ${model.modelId}:
|
|
4209
4198
|
- Dependency Type: ${dependency.modelType}
|
|
4210
4199
|
- Dependency ID: ${dataModelId}
|
|
@@ -4214,7 +4203,7 @@ const createModelDependency = (model, dependency) => {
|
|
|
4214
4203
|
- Error: ${errorMessage}`
|
|
4215
4204
|
);
|
|
4216
4205
|
if (resolutionPolicy === DependencyResolutionPolicy.CONTINUE) {
|
|
4217
|
-
|
|
4206
|
+
log$_.warn(
|
|
4218
4207
|
`Model type not registered (policy: CONTINUE) - Model ${model.modelId} will continue without dependency ${dependency.modelType} [${dataModelId}]`
|
|
4219
4208
|
);
|
|
4220
4209
|
return { dependentModel: null, dataModelId, success: false };
|
|
@@ -4227,7 +4216,7 @@ const createModelDependency = (model, dependency) => {
|
|
|
4227
4216
|
if (existingModel) {
|
|
4228
4217
|
if (existingModel.modelTypeName !== dependency.modelType) {
|
|
4229
4218
|
const errorMessage = `Model type mismatch: expected ${dependency.modelType}, found ${existingModel.modelTypeName}`;
|
|
4230
|
-
|
|
4219
|
+
log$_.error(
|
|
4231
4220
|
`Failed to resolve dependency for model ${model.modelId}:
|
|
4232
4221
|
- Dependency Type: ${dependency.modelType}
|
|
4233
4222
|
- Dependency ID: ${dataModelId}
|
|
@@ -4238,7 +4227,7 @@ const createModelDependency = (model, dependency) => {
|
|
|
4238
4227
|
- Error: ${errorMessage}`
|
|
4239
4228
|
);
|
|
4240
4229
|
if (resolutionPolicy === DependencyResolutionPolicy.CONTINUE) {
|
|
4241
|
-
|
|
4230
|
+
log$_.warn(
|
|
4242
4231
|
`Model type mismatch (policy: CONTINUE) - Model ${model.modelId} will continue without dependency`
|
|
4243
4232
|
);
|
|
4244
4233
|
return { dependentModel: null, dataModelId, success: false };
|
|
@@ -4247,7 +4236,7 @@ const createModelDependency = (model, dependency) => {
|
|
|
4247
4236
|
`Dependency resolution failed - Model ${model.modelId} cannot resolve dependency ${dependency.modelType} [${dataModelId}]: ${errorMessage}`
|
|
4248
4237
|
);
|
|
4249
4238
|
}
|
|
4250
|
-
|
|
4239
|
+
log$_.debug(
|
|
4251
4240
|
`Found existing dependent model ${dependency.modelType} with id ${dataModelId}`
|
|
4252
4241
|
);
|
|
4253
4242
|
return {
|
|
@@ -4256,18 +4245,18 @@ const createModelDependency = (model, dependency) => {
|
|
|
4256
4245
|
success: true
|
|
4257
4246
|
};
|
|
4258
4247
|
}
|
|
4259
|
-
|
|
4248
|
+
log$_.debug(
|
|
4260
4249
|
`Model ${dependency.modelType} [${dataModelId}] does not exist. Applying resolution policy: ${resolutionPolicy}`
|
|
4261
4250
|
);
|
|
4262
4251
|
if (resolutionPolicy === DependencyResolutionPolicy.CONTINUE) {
|
|
4263
|
-
|
|
4252
|
+
log$_.warn(
|
|
4264
4253
|
`Model ${dependency.modelType} [${dataModelId}] not found (policy: CONTINUE) - Model ${model.modelId} will continue without this dependency`
|
|
4265
4254
|
);
|
|
4266
4255
|
return { dependentModel: null, dataModelId, success: false };
|
|
4267
4256
|
}
|
|
4268
4257
|
if (resolutionPolicy === DependencyResolutionPolicy.FAIL) {
|
|
4269
4258
|
const errorMessage = `No ${dependency.modelType} model with id ${dataModelId} exists`;
|
|
4270
|
-
|
|
4259
|
+
log$_.error(
|
|
4271
4260
|
`Failed to resolve dependency for model ${model.modelId}:
|
|
4272
4261
|
- Dependency Type: ${dependency.modelType}
|
|
4273
4262
|
- Dependency ID: ${dataModelId}
|
|
@@ -4285,7 +4274,7 @@ const createModelDependency = (model, dependency) => {
|
|
|
4285
4274
|
const requiresOptions = modelClass?.prototype?.[OptionsRequired] === true;
|
|
4286
4275
|
if (requiresOptions && !hasOptions) {
|
|
4287
4276
|
const errorMessage = `Model ${dependency.modelType} requires options but none were provided`;
|
|
4288
|
-
|
|
4277
|
+
log$_.error(
|
|
4289
4278
|
`Failed to resolve dependency for model ${model.modelId}:
|
|
4290
4279
|
- Dependency Type: ${dependency.modelType}
|
|
4291
4280
|
- Dependency ID: ${dataModelId}
|
|
@@ -4306,13 +4295,13 @@ const createModelDependency = (model, dependency) => {
|
|
|
4306
4295
|
dataModelId,
|
|
4307
4296
|
options
|
|
4308
4297
|
);
|
|
4309
|
-
|
|
4298
|
+
log$_.debug(
|
|
4310
4299
|
`Successfully created dependent model ${dependency.modelType} with id ${dataModelId}`
|
|
4311
4300
|
);
|
|
4312
4301
|
return { dependentModel, dataModelId, success: true };
|
|
4313
4302
|
} catch (error) {
|
|
4314
4303
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
4315
|
-
|
|
4304
|
+
log$_.error(
|
|
4316
4305
|
`Failed to create dependency for model ${model.modelId}:
|
|
4317
4306
|
- Dependency Type: ${dependency.modelType}
|
|
4318
4307
|
- Dependency ID: ${dataModelId}
|
|
@@ -4328,14 +4317,14 @@ const createModelDependency = (model, dependency) => {
|
|
|
4328
4317
|
const getDependenciesByLifecycle = (model, lifecycle = DependencyLifecycle.READY) => {
|
|
4329
4318
|
const dependencies = model.modelData?.[DependencyModels] || {};
|
|
4330
4319
|
if (Object.keys(dependencies).length === 0) {
|
|
4331
|
-
|
|
4320
|
+
log$_.debug(`${model.modelId} has no dependencies. Returning`);
|
|
4332
4321
|
return [];
|
|
4333
4322
|
}
|
|
4334
4323
|
const dependenciesByLifecycle = Object.keys(dependencies).filter((key) => dependencies[key].lifecycle === lifecycle).map((key) => {
|
|
4335
4324
|
const dependency = dependencies[key];
|
|
4336
4325
|
const resolutionResult = createModelDependency(model, dependency);
|
|
4337
4326
|
if (!resolutionResult.success || !resolutionResult.dependentModel) {
|
|
4338
|
-
|
|
4327
|
+
log$_.debug(
|
|
4339
4328
|
`Skipping dependency ${dependency.modelType} with id ${resolutionResult.dataModelId} - resolution failed with CONTINUE policy`
|
|
4340
4329
|
);
|
|
4341
4330
|
model.modelData[key] = void 0;
|
|
@@ -4343,12 +4332,12 @@ const getDependenciesByLifecycle = (model, lifecycle = DependencyLifecycle.READY
|
|
|
4343
4332
|
}
|
|
4344
4333
|
const { dependentModel, dataModelId } = resolutionResult;
|
|
4345
4334
|
model.modelData[key] = dependentModel.data;
|
|
4346
|
-
|
|
4335
|
+
log$_.debug(
|
|
4347
4336
|
`waiting for dependent model ${dependency.modelType} with id ${dataModelId} - waiting for WHENREADY`
|
|
4348
4337
|
);
|
|
4349
4338
|
const readyFn = async (dependentModel2, modelType, id) => {
|
|
4350
4339
|
await dependentModel2.whenReady?.();
|
|
4351
|
-
|
|
4340
|
+
log$_.debug(`dependent model ${modelType} with id ${id} - READY`);
|
|
4352
4341
|
};
|
|
4353
4342
|
const { promise, cancel } = rejectAfterDelay$1(
|
|
4354
4343
|
MODEL_PROMISE_TIMEOUT_MS,
|
|
@@ -4369,7 +4358,7 @@ const getDependenciesByLifecycle = (model, lifecycle = DependencyLifecycle.READY
|
|
|
4369
4358
|
lifecycle,
|
|
4370
4359
|
operation: "dependency whenReady()"
|
|
4371
4360
|
});
|
|
4372
|
-
|
|
4361
|
+
log$_.error(enrichedError.toDetailedString());
|
|
4373
4362
|
cancel();
|
|
4374
4363
|
throw enrichedError;
|
|
4375
4364
|
}),
|
|
@@ -4379,13 +4368,13 @@ const getDependenciesByLifecycle = (model, lifecycle = DependencyLifecycle.READY
|
|
|
4379
4368
|
return dependenciesByLifecycle;
|
|
4380
4369
|
};
|
|
4381
4370
|
const executeListLifecycle = async (sourceModel, models2, target, sourceLifecycle) => {
|
|
4382
|
-
|
|
4371
|
+
log$_.debug(`Execute lifecycle with ${models2.length} models`);
|
|
4383
4372
|
if (models2.length === 0) {
|
|
4384
|
-
|
|
4373
|
+
log$_.debug(`${sourceModel.modelId} has no children. Returning`);
|
|
4385
4374
|
return;
|
|
4386
4375
|
}
|
|
4387
4376
|
if (!target) {
|
|
4388
|
-
|
|
4377
|
+
log$_.error(
|
|
4389
4378
|
`${sourceModel.modelId} is not transitioning with a valid target ${target}`
|
|
4390
4379
|
);
|
|
4391
4380
|
return;
|
|
@@ -4396,12 +4385,10 @@ const executeListLifecycle = async (sourceModel, models2, target, sourceLifecycl
|
|
|
4396
4385
|
p = TransitionMap[target](model);
|
|
4397
4386
|
} else {
|
|
4398
4387
|
if (!model) {
|
|
4399
|
-
|
|
4388
|
+
log$_.error("model is undefined. This shouldn't happen");
|
|
4400
4389
|
}
|
|
4401
4390
|
if (!TransitionMap[target]) {
|
|
4402
|
-
|
|
4403
|
-
`There is no promise in the Transition Map for ${target}`
|
|
4404
|
-
);
|
|
4391
|
+
log$_.error(`There is no promise in the Transition Map for ${target}`);
|
|
4405
4392
|
}
|
|
4406
4393
|
}
|
|
4407
4394
|
return {
|
|
@@ -4413,11 +4400,11 @@ const executeListLifecycle = async (sourceModel, models2, target, sourceLifecycl
|
|
|
4413
4400
|
};
|
|
4414
4401
|
}).filter((modelPromise) => {
|
|
4415
4402
|
if (!modelPromise.promise) {
|
|
4416
|
-
|
|
4403
|
+
log$_.error(`No promise found ${modelPromise.modelId}`);
|
|
4417
4404
|
return false;
|
|
4418
4405
|
}
|
|
4419
4406
|
if (!modelPromise.model) {
|
|
4420
|
-
|
|
4407
|
+
log$_.error(`No model found ${modelPromise.modelId}`);
|
|
4421
4408
|
return false;
|
|
4422
4409
|
}
|
|
4423
4410
|
return true;
|
|
@@ -4446,7 +4433,7 @@ const executeListLifecycle = async (sourceModel, models2, target, sourceLifecycl
|
|
|
4446
4433
|
lifecycle: sourceLifecycle,
|
|
4447
4434
|
operation: `transition to ${target}`
|
|
4448
4435
|
});
|
|
4449
|
-
|
|
4436
|
+
log$_.error(enrichedError.toDetailedString());
|
|
4450
4437
|
timeoutCancel();
|
|
4451
4438
|
throw enrichedError;
|
|
4452
4439
|
}),
|
|
@@ -4492,10 +4479,10 @@ const executeDependentModelLifecycle = async (model, lifecycle) => {
|
|
|
4492
4479
|
);
|
|
4493
4480
|
const failed = settled.filter((p) => p.status === "rejected");
|
|
4494
4481
|
if (failed.length) {
|
|
4495
|
-
|
|
4482
|
+
log$_.error(
|
|
4496
4483
|
`There were ${failed.length} failed dependent models on ${lifecycle}`
|
|
4497
4484
|
);
|
|
4498
|
-
|
|
4485
|
+
log$_.error(failed);
|
|
4499
4486
|
}
|
|
4500
4487
|
};
|
|
4501
4488
|
function applyKosModelDevtoolsSupport(model) {
|
|
@@ -4759,7 +4746,7 @@ class KosEffectManager {
|
|
|
4759
4746
|
this.disposers = [];
|
|
4760
4747
|
}
|
|
4761
4748
|
}
|
|
4762
|
-
const log$
|
|
4749
|
+
const log$Z = KosLog.createLogger({ group: LogGroup.core, name: "model-active-machine" });
|
|
4763
4750
|
const activeMachine = (model) => {
|
|
4764
4751
|
const machine2 = robot3.createMachine(KosModelState.INACTIVE, {
|
|
4765
4752
|
[KosModelState.FAILED]: robot3.state(
|
|
@@ -4814,11 +4801,11 @@ const activeMachine = (model) => {
|
|
|
4814
4801
|
});
|
|
4815
4802
|
const service2 = robot3.interpret(
|
|
4816
4803
|
machine2,
|
|
4817
|
-
(_service) => log$
|
|
4804
|
+
(_service) => log$Z.debug(_service.machine.current)
|
|
4818
4805
|
);
|
|
4819
4806
|
return { service: service2, machine: machine2 };
|
|
4820
4807
|
};
|
|
4821
|
-
const log$
|
|
4808
|
+
const log$Y = KosLog.createLogger({ group: LogGroup.core, name: "model-online-machine" });
|
|
4822
4809
|
const onlineMachine = (model) => {
|
|
4823
4810
|
const machine2 = robot3.createMachine(KosModelState.OFFLINE, {
|
|
4824
4811
|
[KosModelState.ONLINE]: robot3.state(
|
|
@@ -4836,7 +4823,7 @@ const onlineMachine = (model) => {
|
|
|
4836
4823
|
KosModelEvents.GO_ONLINE,
|
|
4837
4824
|
KosModelState.ONLINE,
|
|
4838
4825
|
robot3.action(async () => {
|
|
4839
|
-
log$
|
|
4826
|
+
log$Y.debug(`Going online with model ${model.modelId}`);
|
|
4840
4827
|
await model.online();
|
|
4841
4828
|
model.onlineStatus = KosModelState.ONLINE;
|
|
4842
4829
|
await model.fsm.transitionTo(
|
|
@@ -4849,10 +4836,14 @@ const onlineMachine = (model) => {
|
|
|
4849
4836
|
});
|
|
4850
4837
|
const service2 = robot3.interpret(
|
|
4851
4838
|
machine2,
|
|
4852
|
-
(_service) => log$
|
|
4839
|
+
(_service) => log$Y.debug(_service.machine.current)
|
|
4853
4840
|
);
|
|
4854
4841
|
return { machine: machine2, service: service2 };
|
|
4855
4842
|
};
|
|
4843
|
+
const log$X = KosLog.createLogger({
|
|
4844
|
+
group: LogGroup.core,
|
|
4845
|
+
name: "model-machine"
|
|
4846
|
+
});
|
|
4856
4847
|
const machine = (model) => {
|
|
4857
4848
|
const active = activeMachine(model).service;
|
|
4858
4849
|
const online = onlineMachine(model).service;
|
|
@@ -4887,7 +4878,7 @@ const machine = (model) => {
|
|
|
4887
4878
|
`error`,
|
|
4888
4879
|
KosModelState.FAILED,
|
|
4889
4880
|
robot3.action(() => {
|
|
4890
|
-
|
|
4881
|
+
log$X.error(
|
|
4891
4882
|
`Model ${model.modelId} - ${model.modelTypeName} failed to initialize. Transitioning to FAILED state.`
|
|
4892
4883
|
);
|
|
4893
4884
|
model.status = KosModelState.FAILED;
|
|
@@ -5009,7 +5000,7 @@ const machine = (model) => {
|
|
|
5009
5000
|
`error`,
|
|
5010
5001
|
KosModelState.REATTACHING,
|
|
5011
5002
|
robot3.action((_ctx, event) => {
|
|
5012
|
-
|
|
5003
|
+
log$X.error(
|
|
5013
5004
|
`Model ${model.modelId} - ${model.modelTypeName} failed to reload; its data stays as it was. ${String(
|
|
5014
5005
|
event?.error
|
|
5015
5006
|
)}`
|
|
@@ -5046,11 +5037,11 @@ const machine = (model) => {
|
|
|
5046
5037
|
[KosModelState.FAILED]: robot3.state()
|
|
5047
5038
|
});
|
|
5048
5039
|
};
|
|
5049
|
-
const log$
|
|
5040
|
+
const log$W = KosLog.createLogger({ group: LogGroup.core, name: "kos-model-lifecycle" });
|
|
5050
5041
|
const fsm = (model) => {
|
|
5051
5042
|
const service2 = robot3.interpret(
|
|
5052
5043
|
machine(model),
|
|
5053
|
-
(_service) => log$
|
|
5044
|
+
(_service) => log$W.debug(
|
|
5054
5045
|
`state machine for model ${model.modelId}: ${_service.machine.current});`
|
|
5055
5046
|
)
|
|
5056
5047
|
);
|
|
@@ -5652,6 +5643,10 @@ async function processRequestBody(body) {
|
|
|
5652
5643
|
}
|
|
5653
5644
|
throw new Error("Unsupported body type");
|
|
5654
5645
|
}
|
|
5646
|
+
const log$V = KosLog.createLogger({
|
|
5647
|
+
group: LogGroup.transport,
|
|
5648
|
+
name: "kos-message-utils"
|
|
5649
|
+
});
|
|
5655
5650
|
const createStudioMessage = ({
|
|
5656
5651
|
path,
|
|
5657
5652
|
requestId,
|
|
@@ -5865,10 +5860,10 @@ const sendKosMessage = (msg, options) => {
|
|
|
5865
5860
|
);
|
|
5866
5861
|
const socketTransport = KosCore.getInstance().transport.socket;
|
|
5867
5862
|
if (socketTransport) {
|
|
5868
|
-
|
|
5863
|
+
log$V.debug("Sending message", _msg);
|
|
5869
5864
|
socketTransport.socket.send(_msg);
|
|
5870
5865
|
} else {
|
|
5871
|
-
|
|
5866
|
+
log$V.error("socket transport is not initialized");
|
|
5872
5867
|
}
|
|
5873
5868
|
};
|
|
5874
5869
|
const createStudioMessageResponse = ({
|
|
@@ -5903,7 +5898,7 @@ const sendStudioMessageRequest = (msg, options) => {
|
|
|
5903
5898
|
if (socketTransport) {
|
|
5904
5899
|
socketTransport.socket.send(_msg);
|
|
5905
5900
|
} else {
|
|
5906
|
-
|
|
5901
|
+
log$V.error("socket transport is not initialized");
|
|
5907
5902
|
}
|
|
5908
5903
|
};
|
|
5909
5904
|
const sendStudioMessage = (msg, options) => {
|
|
@@ -5916,7 +5911,7 @@ const sendStudioMessage = (msg, options) => {
|
|
|
5916
5911
|
if (socketTransport) {
|
|
5917
5912
|
socketTransport.socket.send(_msg);
|
|
5918
5913
|
} else {
|
|
5919
|
-
|
|
5914
|
+
log$V.error("socket transport is not initialized");
|
|
5920
5915
|
}
|
|
5921
5916
|
};
|
|
5922
5917
|
const createBroadcastMessageResponse = ({
|
|
@@ -5986,7 +5981,7 @@ const sendBroadcastMessage = ({
|
|
|
5986
5981
|
if (socketTransport) {
|
|
5987
5982
|
socketTransport.socket.send(_msg);
|
|
5988
5983
|
} else {
|
|
5989
|
-
|
|
5984
|
+
log$V.error("socket transport is not initialized");
|
|
5990
5985
|
}
|
|
5991
5986
|
};
|
|
5992
5987
|
const sendKosMessageResponse = ({
|
|
@@ -6002,7 +5997,7 @@ const sendKosMessageResponse = ({
|
|
|
6002
5997
|
if (socketTransport) {
|
|
6003
5998
|
socketTransport.socket.send(_msg);
|
|
6004
5999
|
} else {
|
|
6005
|
-
|
|
6000
|
+
log$V.error("socket transport is not initialized");
|
|
6006
6001
|
}
|
|
6007
6002
|
};
|
|
6008
6003
|
const sendKosHttpMessageResponse = ({
|
|
@@ -6018,7 +6013,7 @@ const sendKosHttpMessageResponse = ({
|
|
|
6018
6013
|
if (socketTransport) {
|
|
6019
6014
|
socketTransport.socket.send(_msg);
|
|
6020
6015
|
} else {
|
|
6021
|
-
|
|
6016
|
+
log$V.error("socket transport is not initialized");
|
|
6022
6017
|
}
|
|
6023
6018
|
};
|
|
6024
6019
|
const getMessageBody = (payload, skipParse) => {
|
|
@@ -6050,7 +6045,7 @@ class TransportNotReadyError extends Error {
|
|
|
6050
6045
|
}
|
|
6051
6046
|
}
|
|
6052
6047
|
const isTransportNotReadyError = (error) => !!error && error.code === TRANSPORT_NOT_READY;
|
|
6053
|
-
const log$
|
|
6048
|
+
const log$U = KosLog.createLogger({ group: LogGroup.transport, name: "kos-fetch" });
|
|
6054
6049
|
const DEFAULT_WS_TIMEOUT = 3e4;
|
|
6055
6050
|
const WS_TIMEOUT = (() => {
|
|
6056
6051
|
const configured = process.env.KOS_WS_TIMEOUT ? parseInt(process.env.KOS_WS_TIMEOUT) : DEFAULT_WS_TIMEOUT;
|
|
@@ -6115,7 +6110,7 @@ const kosFetchWs = async (url, options) => {
|
|
|
6115
6110
|
const requestId = uuid();
|
|
6116
6111
|
const urlObj = new URL(url);
|
|
6117
6112
|
const path = `${urlObj.pathname}${urlObj.search}`;
|
|
6118
|
-
log$
|
|
6113
|
+
log$U.debug(`path: ${path}`);
|
|
6119
6114
|
const budget = resolveTimeoutBudget(options?.timeout);
|
|
6120
6115
|
const messageFactory = fetchMessageFactory(options);
|
|
6121
6116
|
const signal = createRequestSignal(budget, options?.signal);
|
|
@@ -6123,12 +6118,12 @@ const kosFetchWs = async (url, options) => {
|
|
|
6123
6118
|
await transport.whenReady({ signal });
|
|
6124
6119
|
} catch (error) {
|
|
6125
6120
|
if (isTimeoutReason(error)) {
|
|
6126
|
-
log$
|
|
6121
|
+
log$U.error(
|
|
6127
6122
|
`Transport not ready${budget === void 0 ? "" : ` after ${budget}ms`} - request not sent - url: ${url}`
|
|
6128
6123
|
);
|
|
6129
6124
|
throw new TransportNotReadyError({ timeout: budget, url });
|
|
6130
6125
|
}
|
|
6131
|
-
log$
|
|
6126
|
+
log$U.debug(`Request aborted while waiting for transport - url: ${url}`);
|
|
6132
6127
|
throw error;
|
|
6133
6128
|
}
|
|
6134
6129
|
const processedBody = await processRequestBody(options?.body);
|
|
@@ -6157,9 +6152,9 @@ const kosFetchWs = async (url, options) => {
|
|
|
6157
6152
|
if (signal.aborted) {
|
|
6158
6153
|
const reason = signal.reason;
|
|
6159
6154
|
if (reason?.name === "TimeoutError") {
|
|
6160
|
-
log$
|
|
6155
|
+
log$U.error(`Timeout occurred - url: ${url}`);
|
|
6161
6156
|
} else {
|
|
6162
|
-
log$
|
|
6157
|
+
log$U.debug(`Request aborted - url: ${url}`);
|
|
6163
6158
|
}
|
|
6164
6159
|
reject(reason || new DOMException("Aborted", "AbortError"));
|
|
6165
6160
|
return;
|
|
@@ -6168,9 +6163,9 @@ const kosFetchWs = async (url, options) => {
|
|
|
6168
6163
|
if (unsubscribe) unsubscribe();
|
|
6169
6164
|
const reason = signal.reason;
|
|
6170
6165
|
if (reason?.name === "TimeoutError") {
|
|
6171
|
-
log$
|
|
6166
|
+
log$U.error(`Timeout occurred - url: ${url}`);
|
|
6172
6167
|
} else {
|
|
6173
|
-
log$
|
|
6168
|
+
log$U.debug(`Request aborted - url: ${url}`);
|
|
6174
6169
|
}
|
|
6175
6170
|
reject(reason || new DOMException("Aborted", "AbortError"));
|
|
6176
6171
|
};
|
|
@@ -6186,7 +6181,7 @@ const kosFetchWs = async (url, options) => {
|
|
|
6186
6181
|
try {
|
|
6187
6182
|
bodyData = base64ToArrayBuffer(responseBody);
|
|
6188
6183
|
} catch (e) {
|
|
6189
|
-
log$
|
|
6184
|
+
log$U.error("Failed to decode base64 response", e);
|
|
6190
6185
|
}
|
|
6191
6186
|
}
|
|
6192
6187
|
const response = {
|
|
@@ -6240,7 +6235,7 @@ const kosFetchWs = async (url, options) => {
|
|
|
6240
6235
|
});
|
|
6241
6236
|
}
|
|
6242
6237
|
if (parsed.files) {
|
|
6243
|
-
log$
|
|
6238
|
+
log$U.warn(
|
|
6244
6239
|
"File reconstruction in FormData not fully implemented"
|
|
6245
6240
|
);
|
|
6246
6241
|
}
|
|
@@ -6291,7 +6286,7 @@ const resolveBaseUrl = () => {
|
|
|
6291
6286
|
const URL2 = exports.BASE_URL;
|
|
6292
6287
|
return { isMock: MOCK, URL: URL2 };
|
|
6293
6288
|
};
|
|
6294
|
-
const log$
|
|
6289
|
+
const log$T = KosLog.createLogger({ group: LogGroup.transport, name: "kos-service-request" });
|
|
6295
6290
|
const ERROR_UNKNOWN = "errUnknown";
|
|
6296
6291
|
const ERROR_TRANSPORT_NOT_READY = "Transport not ready";
|
|
6297
6292
|
const MUTATING_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "DELETE", "PATCH"]);
|
|
@@ -6317,7 +6312,7 @@ async function clientRequest(endpoint, method, options, params2, body) {
|
|
|
6317
6312
|
)}`
|
|
6318
6313
|
).join("&") : "";
|
|
6319
6314
|
const fullUrl = `${resolveBaseUrl().URL}${url}${query ? `?${query}` : ""}`;
|
|
6320
|
-
log$
|
|
6315
|
+
log$T.debug(`fullUrl: ${fullUrl}`);
|
|
6321
6316
|
const fetchOptions = {
|
|
6322
6317
|
method: String(method).toUpperCase(),
|
|
6323
6318
|
body: null,
|
|
@@ -6351,20 +6346,20 @@ async function executeFetch(fullUrl, fetchOptions) {
|
|
|
6351
6346
|
return [null, payload.data ?? payload, responseContext(response)];
|
|
6352
6347
|
} catch (error) {
|
|
6353
6348
|
if (isTransportNotReadyError(error)) {
|
|
6354
|
-
log$
|
|
6349
|
+
log$T.error(`Transport not ready, request not sent: ${fullUrl}`);
|
|
6355
6350
|
return [ERROR_TRANSPORT_NOT_READY, null];
|
|
6356
6351
|
}
|
|
6357
6352
|
if (error instanceof DOMException) {
|
|
6358
6353
|
if (error.name === "TimeoutError") {
|
|
6359
|
-
log$
|
|
6354
|
+
log$T.error(`Request timed out: ${fullUrl}`);
|
|
6360
6355
|
return ["Request timed out", null];
|
|
6361
6356
|
}
|
|
6362
6357
|
if (error.name === "AbortError") {
|
|
6363
|
-
log$
|
|
6358
|
+
log$T.debug(`Request aborted: ${fullUrl}`);
|
|
6364
6359
|
return ["Request aborted", null];
|
|
6365
6360
|
}
|
|
6366
6361
|
}
|
|
6367
|
-
log$
|
|
6362
|
+
log$T.error(`Unexpected error during fetch: ${error}`);
|
|
6368
6363
|
return [error instanceof Error ? error.message : ERROR_UNKNOWN, null];
|
|
6369
6364
|
}
|
|
6370
6365
|
}
|
|
@@ -6384,38 +6379,38 @@ async function executeFetchWithRetry(fullUrl, fetchOptions, config2) {
|
|
|
6384
6379
|
errorContext
|
|
6385
6380
|
];
|
|
6386
6381
|
if (config2.retryOn && !config2.retryOn(response)) {
|
|
6387
|
-
log$
|
|
6382
|
+
log$T.debug(
|
|
6388
6383
|
`Retry predicate returned false for ${fullUrl} (status ${response.status}), stopping`
|
|
6389
6384
|
);
|
|
6390
6385
|
return lastResult;
|
|
6391
6386
|
}
|
|
6392
6387
|
if (attempt < config2.maxAttempts) {
|
|
6393
6388
|
const delayMs = config2.baseDelayMs * Math.pow(config2.backoffFactor, attempt - 1);
|
|
6394
|
-
log$
|
|
6389
|
+
log$T.warn(
|
|
6395
6390
|
`Request to ${fullUrl} failed (status ${response.status}), retrying in ${delayMs}ms (attempt ${attempt}/${config2.maxAttempts})`
|
|
6396
6391
|
);
|
|
6397
6392
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
6398
6393
|
}
|
|
6399
6394
|
} catch (error) {
|
|
6400
6395
|
if (isTransportNotReadyError(error)) {
|
|
6401
|
-
log$
|
|
6396
|
+
log$T.error(`Transport not ready, request not sent: ${fullUrl}`);
|
|
6402
6397
|
return [ERROR_TRANSPORT_NOT_READY, null];
|
|
6403
6398
|
}
|
|
6404
6399
|
if (error instanceof DOMException) {
|
|
6405
6400
|
if (error.name === "TimeoutError") {
|
|
6406
|
-
log$
|
|
6401
|
+
log$T.error(`Request timed out: ${fullUrl}`);
|
|
6407
6402
|
return ["Request timed out", null];
|
|
6408
6403
|
}
|
|
6409
6404
|
if (error.name === "AbortError") {
|
|
6410
|
-
log$
|
|
6405
|
+
log$T.debug(`Request aborted: ${fullUrl}`);
|
|
6411
6406
|
return ["Request aborted", null];
|
|
6412
6407
|
}
|
|
6413
6408
|
}
|
|
6414
|
-
log$
|
|
6409
|
+
log$T.error(`Unexpected error during fetch: ${error}`);
|
|
6415
6410
|
return [error instanceof Error ? error.message : ERROR_UNKNOWN, null];
|
|
6416
6411
|
}
|
|
6417
6412
|
}
|
|
6418
|
-
log$
|
|
6413
|
+
log$T.error(`All ${config2.maxAttempts} attempts failed for ${fullUrl}`);
|
|
6419
6414
|
return lastResult;
|
|
6420
6415
|
}
|
|
6421
6416
|
async function captureErrorResponseContext(response) {
|
|
@@ -6464,10 +6459,7 @@ const service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
6464
6459
|
default: api$1,
|
|
6465
6460
|
kosServiceRequest
|
|
6466
6461
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6467
|
-
const log$
|
|
6468
|
-
name: "kos-service-request-manager",
|
|
6469
|
-
group: "Model"
|
|
6470
|
-
});
|
|
6462
|
+
const log$S = KosLog.createLogger({ group: LogGroup.core, name: "kos-service-request-manager" });
|
|
6471
6463
|
function shouldExecuteRequest(metadata, model) {
|
|
6472
6464
|
return !metadata.condition || metadata.condition(model);
|
|
6473
6465
|
}
|
|
@@ -6517,7 +6509,7 @@ function isValueMissing(value) {
|
|
|
6517
6509
|
}
|
|
6518
6510
|
function validateRequiredField(value, fieldName, path, isRequired) {
|
|
6519
6511
|
if (isRequired && isValueMissing(value)) {
|
|
6520
|
-
log$
|
|
6512
|
+
log$S.warn(
|
|
6521
6513
|
`Required field '${fieldName}' is missing in response for ${path}`
|
|
6522
6514
|
);
|
|
6523
6515
|
}
|
|
@@ -6552,7 +6544,7 @@ class ServiceRequestManager {
|
|
|
6552
6544
|
this.handlers.get(lifecycle).push(metadata);
|
|
6553
6545
|
});
|
|
6554
6546
|
if (Object.keys(handlerMetadata).length > 0) {
|
|
6555
|
-
log$
|
|
6547
|
+
log$S.debug(
|
|
6556
6548
|
`Discovered ${Object.keys(handlerMetadata).length} service request handlers for model ${this.model.id}`
|
|
6557
6549
|
);
|
|
6558
6550
|
}
|
|
@@ -6567,7 +6559,7 @@ class ServiceRequestManager {
|
|
|
6567
6559
|
if (!handlers || handlers.length === 0) {
|
|
6568
6560
|
return;
|
|
6569
6561
|
}
|
|
6570
|
-
log$
|
|
6562
|
+
log$S.debug(
|
|
6571
6563
|
`Executing ${handlers.length} service requests for lifecycle ${lifecycle}`
|
|
6572
6564
|
);
|
|
6573
6565
|
await Promise.all(handlers.map((handler) => this.executeHandler(handler)));
|
|
@@ -6602,7 +6594,7 @@ class ServiceRequestManager {
|
|
|
6602
6594
|
*/
|
|
6603
6595
|
shouldProcessRequest(metadata) {
|
|
6604
6596
|
if (!shouldExecuteRequest(metadata, this.model)) {
|
|
6605
|
-
log$
|
|
6597
|
+
log$S.debug(`Skipping request ${metadata.path} - condition returned false`);
|
|
6606
6598
|
return false;
|
|
6607
6599
|
}
|
|
6608
6600
|
return true;
|
|
@@ -6807,7 +6799,7 @@ class ServiceRequestManager {
|
|
|
6807
6799
|
case "json":
|
|
6808
6800
|
return typeof value === "string" ? JSON.parse(value) : value;
|
|
6809
6801
|
default:
|
|
6810
|
-
log$
|
|
6802
|
+
log$S.warn(`Unknown transformer: ${transform}`);
|
|
6811
6803
|
return value;
|
|
6812
6804
|
}
|
|
6813
6805
|
}
|
|
@@ -6818,7 +6810,7 @@ class ServiceRequestManager {
|
|
|
6818
6810
|
if (!metadata.iterateOver) return data;
|
|
6819
6811
|
const array = this.getNestedValue(data, metadata.iterateOver);
|
|
6820
6812
|
if (!Array.isArray(array)) {
|
|
6821
|
-
log$
|
|
6813
|
+
log$S.warn(
|
|
6822
6814
|
`iterateOver path '${metadata.iterateOver}' did not resolve to an array`
|
|
6823
6815
|
);
|
|
6824
6816
|
return [];
|
|
@@ -6861,7 +6853,7 @@ class ServiceRequestManager {
|
|
|
6861
6853
|
case "throw":
|
|
6862
6854
|
throw error;
|
|
6863
6855
|
case "log":
|
|
6864
|
-
log$
|
|
6856
|
+
log$S.error(
|
|
6865
6857
|
`Service request failed for ${metadata.path}:`,
|
|
6866
6858
|
error.message
|
|
6867
6859
|
);
|
|
@@ -6921,6 +6913,10 @@ class ServiceRequestManager {
|
|
|
6921
6913
|
}
|
|
6922
6914
|
}
|
|
6923
6915
|
}
|
|
6916
|
+
KosLog.createLogger({
|
|
6917
|
+
group: LogGroup.core,
|
|
6918
|
+
name: "async-event-bus"
|
|
6919
|
+
});
|
|
6924
6920
|
class AsyncEventIterator {
|
|
6925
6921
|
subscription;
|
|
6926
6922
|
unsubscribe;
|
|
@@ -7370,6 +7366,10 @@ function encodeFutureFrame(future) {
|
|
|
7370
7366
|
JSON.stringify(future)
|
|
7371
7367
|
);
|
|
7372
7368
|
}
|
|
7369
|
+
const log$R = KosLog.createLogger({
|
|
7370
|
+
group: LogGroup.transport,
|
|
7371
|
+
name: "future-simulator"
|
|
7372
|
+
});
|
|
7373
7373
|
const DEFAULT_DURATION_MS = 5e3;
|
|
7374
7374
|
const DEFAULT_INTERVAL_MS = 250;
|
|
7375
7375
|
class KosMockFutureHandle {
|
|
@@ -7480,7 +7480,7 @@ class KosMockFutureSimulator {
|
|
|
7480
7480
|
this.deps.ensureCancelRoutes();
|
|
7481
7481
|
}
|
|
7482
7482
|
if (!options.tracker) {
|
|
7483
|
-
|
|
7483
|
+
log$R.warn(
|
|
7484
7484
|
`KosMock future ${handle.id} has no tracker — models will not link it to their request; prefer futures.fromRequest`
|
|
7485
7485
|
);
|
|
7486
7486
|
}
|
|
@@ -7512,6 +7512,10 @@ class KosMockFutureSimulator {
|
|
|
7512
7512
|
this.futures.clear();
|
|
7513
7513
|
}
|
|
7514
7514
|
}
|
|
7515
|
+
const log$Q = KosLog.createLogger({
|
|
7516
|
+
group: LogGroup.transport,
|
|
7517
|
+
name: "mock-fixtures"
|
|
7518
|
+
});
|
|
7515
7519
|
const DEFAULT_FIXTURE_SERVER_URL = "http://localhost:5676";
|
|
7516
7520
|
const DB_NAME = "kos-mock-fixtures";
|
|
7517
7521
|
const STORE_NAME = "fixtures";
|
|
@@ -7664,7 +7668,7 @@ function createFixtureStore(registry, deps = {}) {
|
|
|
7664
7668
|
);
|
|
7665
7669
|
}
|
|
7666
7670
|
await target.save(name, named);
|
|
7667
|
-
|
|
7671
|
+
log$Q.info(`KosMock fixture "${name}" saved`);
|
|
7668
7672
|
return name;
|
|
7669
7673
|
},
|
|
7670
7674
|
saveRecording(name) {
|
|
@@ -7687,7 +7691,7 @@ function createFixtureStore(registry, deps = {}) {
|
|
|
7687
7691
|
(summary) => summaries.push({ ...summary, source: "server" })
|
|
7688
7692
|
);
|
|
7689
7693
|
} catch {
|
|
7690
|
-
|
|
7694
|
+
log$Q.warn(`KosMock fixture server unreachable at ${serverUrl}`);
|
|
7691
7695
|
}
|
|
7692
7696
|
}
|
|
7693
7697
|
try {
|
|
@@ -7708,7 +7712,7 @@ function createFixtureStore(registry, deps = {}) {
|
|
|
7708
7712
|
},
|
|
7709
7713
|
async import() {
|
|
7710
7714
|
if (typeof document === "undefined") {
|
|
7711
|
-
|
|
7715
|
+
log$Q.warn(`KosMock fixture import requires a browser environment`);
|
|
7712
7716
|
return void 0;
|
|
7713
7717
|
}
|
|
7714
7718
|
return new Promise((resolve) => {
|
|
@@ -7728,7 +7732,7 @@ function createFixtureStore(registry, deps = {}) {
|
|
|
7728
7732
|
});
|
|
7729
7733
|
resolve(name);
|
|
7730
7734
|
} catch (error) {
|
|
7731
|
-
|
|
7735
|
+
log$Q.error(`KosMock fixture import failed`, error?.message);
|
|
7732
7736
|
resolve(void 0);
|
|
7733
7737
|
}
|
|
7734
7738
|
};
|
|
@@ -7803,6 +7807,10 @@ function splitUrl(url) {
|
|
|
7803
7807
|
function methodMatches(routeMethod, requestMethod) {
|
|
7804
7808
|
return routeMethod === "*" || routeMethod.toUpperCase() === requestMethod.toUpperCase();
|
|
7805
7809
|
}
|
|
7810
|
+
const log$P = KosLog.createLogger({
|
|
7811
|
+
group: LogGroup.transport,
|
|
7812
|
+
name: "mock-playback"
|
|
7813
|
+
});
|
|
7806
7814
|
const rewriteTrackers = (raw, trackerMap) => {
|
|
7807
7815
|
let out = raw;
|
|
7808
7816
|
trackerMap.forEach((liveTracker, capturedTracker) => {
|
|
@@ -7964,7 +7972,7 @@ ${rewriteTrackers(push.body, trackerMap)}`
|
|
|
7964
7972
|
if ((options.pushes ?? "scheduled") === "scheduled") {
|
|
7965
7973
|
startPushes();
|
|
7966
7974
|
}
|
|
7967
|
-
|
|
7975
|
+
log$P.info(
|
|
7968
7976
|
`KosMock fixture${name ? ` "${name}"` : ""} loaded: ${groups.size} routes, ${fixture.pushes.length} pushes (${fixture.pushes.length - unanchored.length} anchored), consume: ${consume}`
|
|
7969
7977
|
);
|
|
7970
7978
|
return {
|
|
@@ -7978,6 +7986,10 @@ ${rewriteTrackers(push.body, trackerMap)}`
|
|
|
7978
7986
|
}
|
|
7979
7987
|
};
|
|
7980
7988
|
}
|
|
7989
|
+
const log$O = KosLog.createLogger({
|
|
7990
|
+
group: LogGroup.transport,
|
|
7991
|
+
name: "mock-recorder"
|
|
7992
|
+
});
|
|
7981
7993
|
class KosMockRecorder {
|
|
7982
7994
|
recording = false;
|
|
7983
7995
|
name;
|
|
@@ -7999,14 +8011,14 @@ class KosMockRecorder {
|
|
|
7999
8011
|
this.exchanges = [];
|
|
8000
8012
|
this.pushes = [];
|
|
8001
8013
|
this.sends = [];
|
|
8002
|
-
|
|
8014
|
+
log$O.info(
|
|
8003
8015
|
`KosMock recorder started${options.name ? ` (${options.name})` : ""}`
|
|
8004
8016
|
);
|
|
8005
8017
|
}
|
|
8006
8018
|
stop() {
|
|
8007
8019
|
const fixture = this.toFixture();
|
|
8008
8020
|
this.recording = false;
|
|
8009
|
-
|
|
8021
|
+
log$O.info(
|
|
8010
8022
|
`KosMock recorder stopped: ${fixture.exchanges.length} exchanges, ${fixture.pushes.length} pushes, ${fixture.sends?.length ?? 0} sends`
|
|
8011
8023
|
);
|
|
8012
8024
|
return fixture;
|
|
@@ -8023,7 +8035,7 @@ class KosMockRecorder {
|
|
|
8023
8035
|
}
|
|
8024
8036
|
download(filename) {
|
|
8025
8037
|
if (typeof document === "undefined") {
|
|
8026
|
-
|
|
8038
|
+
log$O.warn(`KosMock recorder download requires a browser environment`);
|
|
8027
8039
|
return;
|
|
8028
8040
|
}
|
|
8029
8041
|
const fixture = this.toFixture();
|
|
@@ -8138,6 +8150,10 @@ class KosMockRecorder {
|
|
|
8138
8150
|
}
|
|
8139
8151
|
}
|
|
8140
8152
|
}
|
|
8153
|
+
const log$N = KosLog.createLogger({
|
|
8154
|
+
group: LogGroup.transport,
|
|
8155
|
+
name: "mock-setups"
|
|
8156
|
+
});
|
|
8141
8157
|
const dynamicImport = (url) => import(
|
|
8142
8158
|
/* @vite-ignore */
|
|
8143
8159
|
/* webpackIgnore: true */
|
|
@@ -8170,7 +8186,7 @@ function createSetupStore(registry, deps = {}) {
|
|
|
8170
8186
|
try {
|
|
8171
8187
|
entry.teardown?.();
|
|
8172
8188
|
} catch (error) {
|
|
8173
|
-
|
|
8189
|
+
log$N.error(`KosMock setup "${name}" teardown threw`, error?.message);
|
|
8174
8190
|
}
|
|
8175
8191
|
return true;
|
|
8176
8192
|
};
|
|
@@ -8197,7 +8213,7 @@ function createSetupStore(registry, deps = {}) {
|
|
|
8197
8213
|
handle,
|
|
8198
8214
|
teardown: typeof result === "function" ? result : void 0
|
|
8199
8215
|
});
|
|
8200
|
-
|
|
8216
|
+
log$N.info(`KosMock setup "${name}" installed from ${url}`);
|
|
8201
8217
|
return handle;
|
|
8202
8218
|
},
|
|
8203
8219
|
async list() {
|
|
@@ -8220,6 +8236,10 @@ function createSetupStore(registry, deps = {}) {
|
|
|
8220
8236
|
};
|
|
8221
8237
|
return store;
|
|
8222
8238
|
}
|
|
8239
|
+
const log$M = KosLog.createLogger({
|
|
8240
|
+
group: LogGroup.transport,
|
|
8241
|
+
name: "mock-config"
|
|
8242
|
+
});
|
|
8223
8243
|
const asWireValue = (value) => typeof value === "string" ? value : JSON.stringify(value);
|
|
8224
8244
|
const configTopic = (beanId) => `/kos/config/${beanId}`;
|
|
8225
8245
|
const changeEnvelope = (props, previousValues = {}) => {
|
|
@@ -8287,7 +8307,7 @@ function createConfigFacade(registry) {
|
|
|
8287
8307
|
return void 0;
|
|
8288
8308
|
}
|
|
8289
8309
|
if (injectedKeys.length < keys.length) {
|
|
8290
|
-
|
|
8310
|
+
log$M.warn(
|
|
8291
8311
|
`KosMock config.inject ${beanId}: mixed write passes through; injected props will be rejected by the backend: ${injectedKeys.join(
|
|
8292
8312
|
", "
|
|
8293
8313
|
)}`
|
|
@@ -8322,6 +8342,10 @@ function createConfigFacade(registry) {
|
|
|
8322
8342
|
};
|
|
8323
8343
|
return { update, inject };
|
|
8324
8344
|
}
|
|
8345
|
+
const log$L = KosLog.createLogger({
|
|
8346
|
+
group: LogGroup.transport,
|
|
8347
|
+
name: "mock-registry"
|
|
8348
|
+
});
|
|
8325
8349
|
const PENDING_REQUEST_CAP = 500;
|
|
8326
8350
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
8327
8351
|
const asHandler = (handler) => typeof handler === "function" ? handler : () => handler;
|
|
@@ -8427,7 +8451,7 @@ class KosMockRegistry {
|
|
|
8427
8451
|
changed = true;
|
|
8428
8452
|
}
|
|
8429
8453
|
} catch (error) {
|
|
8430
|
-
|
|
8454
|
+
log$L.error(
|
|
8431
8455
|
`KosMock transformer for ${transformer.method} ${transformer.pattern} threw`,
|
|
8432
8456
|
error?.message
|
|
8433
8457
|
);
|
|
@@ -8543,7 +8567,7 @@ class KosMockRegistry {
|
|
|
8543
8567
|
try {
|
|
8544
8568
|
notify();
|
|
8545
8569
|
} catch (error) {
|
|
8546
|
-
|
|
8570
|
+
log$L.error(`KosMock observer threw`, error?.message);
|
|
8547
8571
|
}
|
|
8548
8572
|
}
|
|
8549
8573
|
loadFixture(fixture, options) {
|
|
@@ -8566,13 +8590,13 @@ class KosMockRegistry {
|
|
|
8566
8590
|
enable() {
|
|
8567
8591
|
if (!this.enabledFlag) {
|
|
8568
8592
|
this.enabledFlag = true;
|
|
8569
|
-
|
|
8593
|
+
log$L.info(`KosMock enabled`);
|
|
8570
8594
|
}
|
|
8571
8595
|
}
|
|
8572
8596
|
disable() {
|
|
8573
8597
|
if (this.enabledFlag) {
|
|
8574
8598
|
this.enabledFlag = false;
|
|
8575
|
-
|
|
8599
|
+
log$L.info(`KosMock disabled`);
|
|
8576
8600
|
}
|
|
8577
8601
|
}
|
|
8578
8602
|
get standalone() {
|
|
@@ -8648,7 +8672,7 @@ class KosMockRegistry {
|
|
|
8648
8672
|
}
|
|
8649
8673
|
publishFrame(rawFrame) {
|
|
8650
8674
|
if (this.injectors.size === 0) {
|
|
8651
|
-
|
|
8675
|
+
log$L.warn(
|
|
8652
8676
|
`KosMock.publishFrame: no active transport to deliver the frame`
|
|
8653
8677
|
);
|
|
8654
8678
|
return;
|
|
@@ -8691,7 +8715,7 @@ class KosMockRegistry {
|
|
|
8691
8715
|
if (teardown) {
|
|
8692
8716
|
this.scenarioTeardowns.set(id, teardown);
|
|
8693
8717
|
}
|
|
8694
|
-
|
|
8718
|
+
log$L.info(`KosMock scenario "${scenario.name}" installed`);
|
|
8695
8719
|
const remove = () => {
|
|
8696
8720
|
const dispose = this.scenarioTeardowns.get(id);
|
|
8697
8721
|
this.scenarioTeardowns.delete(id);
|
|
@@ -8795,7 +8819,7 @@ class KosMockRegistry {
|
|
|
8795
8819
|
return true;
|
|
8796
8820
|
}
|
|
8797
8821
|
if (policy === "warn") {
|
|
8798
|
-
|
|
8822
|
+
log$L.warn(`KosMock: unmatched ${frame.method} ${path}`);
|
|
8799
8823
|
}
|
|
8800
8824
|
return false;
|
|
8801
8825
|
}
|
|
@@ -8831,7 +8855,7 @@ class KosMockRegistry {
|
|
|
8831
8855
|
try {
|
|
8832
8856
|
accepted = route.when(scopedRequest);
|
|
8833
8857
|
} catch (error) {
|
|
8834
|
-
|
|
8858
|
+
log$L.error(
|
|
8835
8859
|
`KosMock \`when\` guard for ${route.method} ${route.pattern} threw`,
|
|
8836
8860
|
error?.message
|
|
8837
8861
|
);
|
|
@@ -8844,7 +8868,7 @@ class KosMockRegistry {
|
|
|
8844
8868
|
try {
|
|
8845
8869
|
response = await route.handler(scopedRequest, this.context());
|
|
8846
8870
|
} catch (error) {
|
|
8847
|
-
|
|
8871
|
+
log$L.error(
|
|
8848
8872
|
`KosMock handler for ${route.method} ${route.pattern} threw`,
|
|
8849
8873
|
error?.message
|
|
8850
8874
|
);
|
|
@@ -8877,7 +8901,7 @@ class KosMockRegistry {
|
|
|
8877
8901
|
return;
|
|
8878
8902
|
}
|
|
8879
8903
|
if (policy === "warn") {
|
|
8880
|
-
|
|
8904
|
+
log$L.warn(
|
|
8881
8905
|
`KosMock: all routes declined ${request.method} ${request.path}`
|
|
8882
8906
|
);
|
|
8883
8907
|
}
|
|
@@ -8992,7 +9016,7 @@ if (typeof window !== "undefined") {
|
|
|
8992
9016
|
if (fixture) {
|
|
8993
9017
|
bootLoads.push(
|
|
8994
9018
|
KosMock.fixtures.play(fixture).then(() => void 0).catch(
|
|
8995
|
-
(error) =>
|
|
9019
|
+
(error) => log$L.error(
|
|
8996
9020
|
`KosMock: boot fixture "${fixture}" failed to load`,
|
|
8997
9021
|
error?.message
|
|
8998
9022
|
)
|
|
@@ -9003,7 +9027,7 @@ if (typeof window !== "undefined") {
|
|
|
9003
9027
|
for (const name of setups.split(",").filter(Boolean)) {
|
|
9004
9028
|
bootLoads.push(
|
|
9005
9029
|
KosMock.setups.load(name).then(() => void 0).catch(
|
|
9006
|
-
(error) =>
|
|
9030
|
+
(error) => log$L.error(
|
|
9007
9031
|
`KosMock: boot setup "${name}" failed to load`,
|
|
9008
9032
|
error?.message
|
|
9009
9033
|
)
|
|
@@ -9113,6 +9137,14 @@ class WebSocketBridgeTransport extends WebSocket {
|
|
|
9113
9137
|
super(address);
|
|
9114
9138
|
}
|
|
9115
9139
|
}
|
|
9140
|
+
const log$K = KosLog.createLogger({
|
|
9141
|
+
group: LogGroup.transport,
|
|
9142
|
+
name: "base-message-transport"
|
|
9143
|
+
});
|
|
9144
|
+
const messageLog = KosLog.createLogger({
|
|
9145
|
+
group: LogGroup.transport,
|
|
9146
|
+
name: MESSAGE_LOGGER_NAME
|
|
9147
|
+
});
|
|
9116
9148
|
var WebSocketEvents = /* @__PURE__ */ ((WebSocketEvents2) => {
|
|
9117
9149
|
WebSocketEvents2["CONNECTED"] = `websocket.connected`;
|
|
9118
9150
|
WebSocketEvents2["DISCONNECTED"] = `websocket.disconnected`;
|
|
@@ -9209,9 +9241,9 @@ class BaseTransport {
|
|
|
9209
9241
|
}
|
|
9210
9242
|
onMessage(event) {
|
|
9211
9243
|
try {
|
|
9212
|
-
|
|
9244
|
+
log$K.debug("webSocketTransport: onMessage received");
|
|
9213
9245
|
const { headers, body } = this.processMessageEvent(event);
|
|
9214
|
-
|
|
9246
|
+
messageLog.debug("received", event.data);
|
|
9215
9247
|
const subscriptionTopic = headers["subscription"] || headers[this.RESPONSE_ID_HEADER] || headers["topic"] || headers["type"];
|
|
9216
9248
|
if (subscriptionTopic) {
|
|
9217
9249
|
let msgBody = body;
|
|
@@ -9227,11 +9259,11 @@ class BaseTransport {
|
|
|
9227
9259
|
publish(subscriptionTopic, msgBody, msgHeaders);
|
|
9228
9260
|
}
|
|
9229
9261
|
} catch (ex) {
|
|
9230
|
-
|
|
9262
|
+
log$K.error(`onMessage exception`, ex.message, ex.stack);
|
|
9231
9263
|
}
|
|
9232
9264
|
}
|
|
9233
9265
|
onOpen(event) {
|
|
9234
|
-
|
|
9266
|
+
log$K.info(`websocket connection opened`);
|
|
9235
9267
|
this.socket = event.currentTarget;
|
|
9236
9268
|
mobx.runInAction(() => {
|
|
9237
9269
|
this.connectionEstablished = true;
|
|
@@ -9241,11 +9273,9 @@ alias:${this.alias}
|
|
|
9241
9273
|
|
|
9242
9274
|
`);
|
|
9243
9275
|
}
|
|
9244
|
-
|
|
9245
|
-
`sending ${this.offlineMessages.length} offline FOS messages`
|
|
9246
|
-
);
|
|
9276
|
+
log$K.debug(`sending ${this.offlineMessages.length} offline FOS messages`);
|
|
9247
9277
|
this.offlineMessages.forEach((msg) => {
|
|
9248
|
-
|
|
9278
|
+
log$K.debug(`sending offline message ${msg.msg}`);
|
|
9249
9279
|
this.socket?.send(msg.msg);
|
|
9250
9280
|
});
|
|
9251
9281
|
this.offlineMessages = [];
|
|
@@ -9254,7 +9284,7 @@ alias:${this.alias}
|
|
|
9254
9284
|
}
|
|
9255
9285
|
onClose(event) {
|
|
9256
9286
|
const { code, reason, wasClean } = event;
|
|
9257
|
-
|
|
9287
|
+
log$K.warn(
|
|
9258
9288
|
`WebSocket closed: code=${code}, reason=${reason || "none"}, wasClean=${wasClean}`
|
|
9259
9289
|
);
|
|
9260
9290
|
mobx.runInAction(() => {
|
|
@@ -9264,13 +9294,13 @@ alias:${this.alias}
|
|
|
9264
9294
|
if (this.shouldAttemptReconnection(code)) {
|
|
9265
9295
|
this.onConnectionLost?.();
|
|
9266
9296
|
} else {
|
|
9267
|
-
|
|
9297
|
+
log$K.info(
|
|
9268
9298
|
`Not reconnecting due to close code ${code} (intentional close or configuration error)`
|
|
9269
9299
|
);
|
|
9270
9300
|
}
|
|
9271
9301
|
}
|
|
9272
9302
|
onError(ev) {
|
|
9273
|
-
|
|
9303
|
+
log$K.error(`websocket error: `, ev);
|
|
9274
9304
|
publish("websocket.error", { event: ev });
|
|
9275
9305
|
}
|
|
9276
9306
|
/**
|
|
@@ -9315,7 +9345,7 @@ alias:${this.alias}
|
|
|
9315
9345
|
}
|
|
9316
9346
|
}
|
|
9317
9347
|
send(data) {
|
|
9318
|
-
|
|
9348
|
+
messageLog.debug("sent", data);
|
|
9319
9349
|
if (window.kosLogEvents) {
|
|
9320
9350
|
const { headers, body } = processKosMessage(String(data));
|
|
9321
9351
|
publish(KosWsEvents.SEND, { headers, body });
|
|
@@ -9323,6 +9353,10 @@ alias:${this.alias}
|
|
|
9323
9353
|
this.oldSend.call(this.socket, data);
|
|
9324
9354
|
}
|
|
9325
9355
|
}
|
|
9356
|
+
const log$J = KosLog.createLogger({
|
|
9357
|
+
group: LogGroup.transport,
|
|
9358
|
+
name: "bridge-transport"
|
|
9359
|
+
});
|
|
9326
9360
|
class BridgeTransport {
|
|
9327
9361
|
addEventListener;
|
|
9328
9362
|
dispatchEvent;
|
|
@@ -9334,7 +9368,7 @@ class BridgeTransport {
|
|
|
9334
9368
|
messageQueue = [];
|
|
9335
9369
|
isSending = false;
|
|
9336
9370
|
constructor(addr) {
|
|
9337
|
-
log$
|
|
9371
|
+
log$J.debug(`called Bridge Transport with addr ${addr}`);
|
|
9338
9372
|
const that = this;
|
|
9339
9373
|
globalThis.kosWindowWebsocketRecv = (msg) => {
|
|
9340
9374
|
if (that.onmessage) {
|
|
@@ -9342,19 +9376,19 @@ class BridgeTransport {
|
|
|
9342
9376
|
that.onmessage(data);
|
|
9343
9377
|
}
|
|
9344
9378
|
};
|
|
9345
|
-
log$
|
|
9379
|
+
log$J.debug("Opening bridge transport");
|
|
9346
9380
|
globalThis.kosWindowWebsocketOpen();
|
|
9347
|
-
log$
|
|
9381
|
+
log$J.debug("Opened bridge transport");
|
|
9348
9382
|
this._onclose = null;
|
|
9349
9383
|
this._onerror = null;
|
|
9350
9384
|
this._onmessage = null;
|
|
9351
9385
|
this._onopen = null;
|
|
9352
|
-
this.addEventListener = () => log$
|
|
9353
|
-
this.dispatchEvent = () => log$
|
|
9354
|
-
this.removeEventListener = () => log$
|
|
9386
|
+
this.addEventListener = () => log$J.debug("not implemented");
|
|
9387
|
+
this.dispatchEvent = () => log$J.debug("not implemented");
|
|
9388
|
+
this.removeEventListener = () => log$J.debug("not implemented");
|
|
9355
9389
|
}
|
|
9356
9390
|
close() {
|
|
9357
|
-
log$
|
|
9391
|
+
log$J.debug("closing");
|
|
9358
9392
|
}
|
|
9359
9393
|
sendNextMessage() {
|
|
9360
9394
|
if (this.messageQueue.length > 0) {
|
|
@@ -9441,6 +9475,10 @@ class KosTransport extends BaseTransport {
|
|
|
9441
9475
|
this.RESPONSE_ID_HEADER = `response-id`;
|
|
9442
9476
|
}
|
|
9443
9477
|
}
|
|
9478
|
+
const log$I = KosLog.createLogger({
|
|
9479
|
+
group: LogGroup.transport,
|
|
9480
|
+
name: "standalone-mock-socket"
|
|
9481
|
+
});
|
|
9444
9482
|
const LOGGED_IN_FRAME = `topic:/studioServer/auth/LOGGED_IN
|
|
9445
9483
|
type:kos.broker.topic
|
|
9446
9484
|
|
|
@@ -9451,7 +9489,7 @@ class StandaloneMockSocket {
|
|
|
9451
9489
|
onmessage = null;
|
|
9452
9490
|
onopen = null;
|
|
9453
9491
|
constructor(url) {
|
|
9454
|
-
|
|
9492
|
+
log$I.info(`KosMock standalone socket replacing ${url}`);
|
|
9455
9493
|
setTimeout(async () => {
|
|
9456
9494
|
await kosMockRegistry.bootGate;
|
|
9457
9495
|
this.onopen?.({ currentTarget: this });
|
|
@@ -9462,7 +9500,7 @@ class StandaloneMockSocket {
|
|
|
9462
9500
|
}
|
|
9463
9501
|
send(data) {
|
|
9464
9502
|
if (peekFrameType(data) === KOS_HTTP_REQUEST_TYPE) {
|
|
9465
|
-
|
|
9503
|
+
log$I.warn(
|
|
9466
9504
|
`KosMock standalone: unmatched request reached the loopback socket and will hang — add a route or use onUnmatched: "respond404"`,
|
|
9467
9505
|
String(data).split("\n", 2).join(" ")
|
|
9468
9506
|
);
|
|
@@ -9500,6 +9538,10 @@ class MockMessageTransport extends BaseTransport {
|
|
|
9500
9538
|
this.RESPONSE_ID_HEADER = `response-id`;
|
|
9501
9539
|
}
|
|
9502
9540
|
}
|
|
9541
|
+
const log$H = KosLog.createLogger({
|
|
9542
|
+
group: LogGroup.transport,
|
|
9543
|
+
name: "transport-factory"
|
|
9544
|
+
});
|
|
9503
9545
|
window.kosLogEvents = process.env.KOS_LOG_WS === "true";
|
|
9504
9546
|
class TransportFactory {
|
|
9505
9547
|
static build({
|
|
@@ -9511,13 +9553,13 @@ class TransportFactory {
|
|
|
9511
9553
|
onConnectionEstablished,
|
|
9512
9554
|
onConnectionLost
|
|
9513
9555
|
}) {
|
|
9514
|
-
|
|
9515
|
-
|
|
9556
|
+
log$H.debug(`initializing websocket connection`);
|
|
9557
|
+
log$H.warn(
|
|
9516
9558
|
`kosWindowWebsocketOpen: ${globalThis.kosWindowWebsocketOpen ? `true` : `false`}`
|
|
9517
9559
|
);
|
|
9518
|
-
|
|
9560
|
+
log$H.warn(`fos: ${fos ? `true` : `false`}`);
|
|
9519
9561
|
if (KosMock.standalone && !fos) {
|
|
9520
|
-
|
|
9562
|
+
log$H.warn(`Using KosMock standalone transport`);
|
|
9521
9563
|
return new MockMessageTransport({
|
|
9522
9564
|
host,
|
|
9523
9565
|
port,
|
|
@@ -9528,7 +9570,7 @@ class TransportFactory {
|
|
|
9528
9570
|
});
|
|
9529
9571
|
}
|
|
9530
9572
|
if (globalThis.kosWindowWebsocketOpen && !fos) {
|
|
9531
|
-
|
|
9573
|
+
log$H.warn(`Using bridged message transport`);
|
|
9532
9574
|
const transport = new BridgeMessageTransport({
|
|
9533
9575
|
host,
|
|
9534
9576
|
port,
|
|
@@ -9569,7 +9611,10 @@ if (params$1.fos) {
|
|
|
9569
9611
|
const fosPort = process.env.KOS_FOS_PORT;
|
|
9570
9612
|
window.kosUseFos = !!(window.kosUseFos || process.env.KOS_USE_FOS === "true");
|
|
9571
9613
|
window.kosFosPort = fosPort ? parseInt(fosPort) : 0;
|
|
9572
|
-
const log$
|
|
9614
|
+
const log$G = KosLog.createLogger({
|
|
9615
|
+
group: LogGroup.transport,
|
|
9616
|
+
name: "web-socket-transport"
|
|
9617
|
+
});
|
|
9573
9618
|
var KosWSTransportStatus = /* @__PURE__ */ ((KosWSTransportStatus2) => {
|
|
9574
9619
|
KosWSTransportStatus2["NOT_INITIALIZED"] = "not_initialized";
|
|
9575
9620
|
KosWSTransportStatus2["INITIALIZED"] = "initialized";
|
|
@@ -9626,7 +9671,7 @@ class WebSocketTransport {
|
|
|
9626
9671
|
() => this.connectionEstablished,
|
|
9627
9672
|
(connectionEstablished) => {
|
|
9628
9673
|
if (connectionEstablished) {
|
|
9629
|
-
log$
|
|
9674
|
+
log$G.warn("Connection Established");
|
|
9630
9675
|
this.reconnectAttempts = 0;
|
|
9631
9676
|
publish(WebSocketEvents.CONNECTED, {
|
|
9632
9677
|
reconnect: initialized
|
|
@@ -9658,7 +9703,7 @@ class WebSocketTransport {
|
|
|
9658
9703
|
return false;
|
|
9659
9704
|
}
|
|
9660
9705
|
init() {
|
|
9661
|
-
|
|
9706
|
+
log$G.warn(`Initializing WebSocketTransport on ${this.host}:${this.port}`);
|
|
9662
9707
|
if (this.useFosTransport) {
|
|
9663
9708
|
this.fosSocket = TransportFactory.build({
|
|
9664
9709
|
host: this.host,
|
|
@@ -9673,7 +9718,7 @@ class WebSocketTransport {
|
|
|
9673
9718
|
protocol: this.protocol,
|
|
9674
9719
|
alias: this.alias,
|
|
9675
9720
|
onConnectionLost: () => {
|
|
9676
|
-
log$
|
|
9721
|
+
log$G.error(`Connection Lost`);
|
|
9677
9722
|
this.scheduleReconnect();
|
|
9678
9723
|
}
|
|
9679
9724
|
});
|
|
@@ -9693,7 +9738,7 @@ class WebSocketTransport {
|
|
|
9693
9738
|
*/
|
|
9694
9739
|
scheduleReconnect() {
|
|
9695
9740
|
if (this.reconnectAttempts >= WebSocketTransport.MAX_RECONNECT_ATTEMPTS) {
|
|
9696
|
-
|
|
9741
|
+
log$G.error(
|
|
9697
9742
|
`Max reconnection attempts (${WebSocketTransport.MAX_RECONNECT_ATTEMPTS}) reached. Giving up.`
|
|
9698
9743
|
);
|
|
9699
9744
|
publish(WebSocketEvents.MAX_RETRIES_EXCEEDED, {
|
|
@@ -9702,7 +9747,7 @@ class WebSocketTransport {
|
|
|
9702
9747
|
return;
|
|
9703
9748
|
}
|
|
9704
9749
|
const delay2 = this.calculateBackoffDelay();
|
|
9705
|
-
|
|
9750
|
+
log$G.debug(
|
|
9706
9751
|
`Reconnecting in ${delay2}ms (attempt ${this.reconnectAttempts + 1}/${WebSocketTransport.MAX_RECONNECT_ATTEMPTS})`
|
|
9707
9752
|
);
|
|
9708
9753
|
setTimeout(() => {
|
|
@@ -9719,7 +9764,7 @@ class WebSocketTransport {
|
|
|
9719
9764
|
return Math.floor(exponentialDelay + jitter);
|
|
9720
9765
|
}
|
|
9721
9766
|
_sendSubscriptionMessage(topic, type, fos = false, bridge = false, connectionId, explicitDestination = false) {
|
|
9722
|
-
log$
|
|
9767
|
+
log$G.debug(`${type} to topic ${topic}`);
|
|
9723
9768
|
let connId;
|
|
9724
9769
|
if (explicitDestination) {
|
|
9725
9770
|
connId = connectionId;
|
|
@@ -9728,7 +9773,7 @@ class WebSocketTransport {
|
|
|
9728
9773
|
const connectionParam = params2?.connId;
|
|
9729
9774
|
connId = connectionId ?? connectionParam ?? window?.kosBridge?.("connId");
|
|
9730
9775
|
}
|
|
9731
|
-
log$
|
|
9776
|
+
log$G.debug(`subscribing with connId ${connId}`);
|
|
9732
9777
|
const dstAddr = connId ? `dst-addr:${connId}
|
|
9733
9778
|
` : "";
|
|
9734
9779
|
const msg = fos ? `subscribe:${topic}` : bridge ? `type:fos.broker
|
|
@@ -9742,7 +9787,7 @@ ${dstAddr}topics:${topic}
|
|
|
9742
9787
|
const socket = fos ? this.fosSocket : this.socket;
|
|
9743
9788
|
socket?.socket?.send(msg);
|
|
9744
9789
|
} else {
|
|
9745
|
-
log$
|
|
9790
|
+
log$G.debug(`no connection adding to offline messages`);
|
|
9746
9791
|
const socket = fos ? this.fosSocket : this.socket;
|
|
9747
9792
|
socket?.addOfflineMessage(msg);
|
|
9748
9793
|
}
|
|
@@ -9756,7 +9801,7 @@ ${dstAddr}topics:${topic}
|
|
|
9756
9801
|
explicitDestination
|
|
9757
9802
|
}) {
|
|
9758
9803
|
const { unsubscribe, count } = subscribe(topic, callback);
|
|
9759
|
-
log$
|
|
9804
|
+
log$G.debug(`Topic ${topic} currently has ${count} subscribers`);
|
|
9760
9805
|
this._sendSubscriptionMessage(
|
|
9761
9806
|
topic,
|
|
9762
9807
|
"subscribe",
|
|
@@ -9767,7 +9812,7 @@ ${dstAddr}topics:${topic}
|
|
|
9767
9812
|
);
|
|
9768
9813
|
return () => {
|
|
9769
9814
|
const { count: count2 } = unsubscribe();
|
|
9770
|
-
log$
|
|
9815
|
+
log$G.debug(`Topic ${topic} currently has ${count2} subscribers`);
|
|
9771
9816
|
if (count2 === 0) {
|
|
9772
9817
|
this._sendSubscriptionMessage(
|
|
9773
9818
|
topic,
|
|
@@ -9807,7 +9852,7 @@ ${dstAddr}topics:${topic}
|
|
|
9807
9852
|
}
|
|
9808
9853
|
dropConnection() {
|
|
9809
9854
|
if (!this.connectionEstablished) {
|
|
9810
|
-
log$
|
|
9855
|
+
log$G.debug("dropConnection ignored: the connection is already closed");
|
|
9811
9856
|
return;
|
|
9812
9857
|
}
|
|
9813
9858
|
this.socket?.socket.close(1e3);
|
|
@@ -10593,21 +10638,17 @@ class ServiceResponseStore {
|
|
|
10593
10638
|
class KosModelComponentFactory {
|
|
10594
10639
|
static createAll(model) {
|
|
10595
10640
|
const { modelId, modelTypeName, modelData } = model;
|
|
10596
|
-
const log3 = KosLoggerFactory.create({
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
const fsm2 = new KosFSMManager(model, createTaggedLogger(log3, "fsm"));
|
|
10601
|
-
const offlineQueue = new KosOfflineQueue(
|
|
10602
|
-
createTaggedLogger(log3, "offline-queue")
|
|
10603
|
-
);
|
|
10641
|
+
const log3 = KosLoggerFactory.create({ modelTypeName });
|
|
10642
|
+
const tagged = (tag) => createTaggedLogger(log3, `${modelId}:${tag}`);
|
|
10643
|
+
const fsm2 = new KosFSMManager(model, tagged("fsm"));
|
|
10644
|
+
const offlineQueue = new KosOfflineQueue(tagged("offline-queue"));
|
|
10604
10645
|
const companionManager = new KosCompanionModelManager(model);
|
|
10605
10646
|
const childResolver = new KosChildResolver(model);
|
|
10606
10647
|
const serviceResponseStore = new ServiceResponseStore();
|
|
10607
10648
|
modelData.serviceResponses = serviceResponseStore;
|
|
10608
10649
|
const onlineLifecycleManager = new KosOnlineLifecycleManager(
|
|
10609
10650
|
model,
|
|
10610
|
-
|
|
10651
|
+
tagged("online")
|
|
10611
10652
|
);
|
|
10612
10653
|
const components = {
|
|
10613
10654
|
fsm: fsm2,
|
|
@@ -10622,11 +10663,11 @@ class KosModelComponentFactory {
|
|
|
10622
10663
|
modelTypeName,
|
|
10623
10664
|
modelId,
|
|
10624
10665
|
modelData,
|
|
10625
|
-
|
|
10666
|
+
tagged("effect")
|
|
10626
10667
|
);
|
|
10627
10668
|
}
|
|
10628
10669
|
if (hasSubscriptionHandlers(modelData)) {
|
|
10629
|
-
const subLogger =
|
|
10670
|
+
const subLogger = tagged("subscription");
|
|
10630
10671
|
components.subscriptionManager = new KosSubscriptionManager(
|
|
10631
10672
|
model,
|
|
10632
10673
|
modelData,
|
|
@@ -10638,7 +10679,7 @@ class KosModelComponentFactory {
|
|
|
10638
10679
|
if (hasHttpRouteHandlers(modelData)) {
|
|
10639
10680
|
components.httpRouteManager = new KosHttpRouteManager(
|
|
10640
10681
|
modelData,
|
|
10641
|
-
|
|
10682
|
+
tagged("http-routes")
|
|
10642
10683
|
);
|
|
10643
10684
|
}
|
|
10644
10685
|
if (hasServiceRequestHandlers(modelData)) {
|
|
@@ -10651,7 +10692,7 @@ class KosModelComponentFactory {
|
|
|
10651
10692
|
return components;
|
|
10652
10693
|
}
|
|
10653
10694
|
}
|
|
10654
|
-
const log$
|
|
10695
|
+
const log$F = KosLog.createLogger({ group: LogGroup.core, name: "kos-model" });
|
|
10655
10696
|
const MODEL_LOADER = "kos.extension.model.loader";
|
|
10656
10697
|
class KosModel {
|
|
10657
10698
|
_id;
|
|
@@ -10759,23 +10800,23 @@ class KosModel {
|
|
|
10759
10800
|
return this._status === KosModelState.READY;
|
|
10760
10801
|
}
|
|
10761
10802
|
async deactivate() {
|
|
10762
|
-
log$
|
|
10803
|
+
log$F.debug(
|
|
10763
10804
|
`deactivating model ${this.modelTypeName} with id ${this.modelId}`
|
|
10764
10805
|
);
|
|
10765
10806
|
try {
|
|
10766
10807
|
const context = KosContextManager.getContext(this.modelId);
|
|
10767
10808
|
await this.modelData?.deactivate?.(context);
|
|
10768
|
-
log$
|
|
10809
|
+
log$F.debug(
|
|
10769
10810
|
`Model ${this.modelTypeName} with id ${this.modelId} deactivated`
|
|
10770
10811
|
);
|
|
10771
10812
|
this.subscriptionManager?.deactivate();
|
|
10772
10813
|
} catch (e) {
|
|
10773
|
-
log$
|
|
10814
|
+
log$F.debug(`Model ${this.modelId} failed to deactivated`);
|
|
10774
10815
|
throw e;
|
|
10775
10816
|
}
|
|
10776
10817
|
}
|
|
10777
10818
|
async activate() {
|
|
10778
|
-
log$
|
|
10819
|
+
log$F.debug(`activating model ${this.modelTypeName} with id ${this.modelId}`);
|
|
10779
10820
|
await executeDependentModelLifecycle(this, DependencyLifecycle.ACTIVATE);
|
|
10780
10821
|
try {
|
|
10781
10822
|
await this.serviceRequestManager?.executeForLifecycle(
|
|
@@ -10784,16 +10825,16 @@ class KosModel {
|
|
|
10784
10825
|
const context = KosContextManager.getContext(this.modelId);
|
|
10785
10826
|
await this.modelData?.activate?.(context);
|
|
10786
10827
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.ACTIVATE);
|
|
10787
|
-
log$
|
|
10828
|
+
log$F.debug(
|
|
10788
10829
|
`Model ${this.modelTypeName} with id ${this.modelId} subscribing to all topics`
|
|
10789
10830
|
);
|
|
10790
10831
|
this.subscriptionManager?.registerAll(DependencyLifecycle.ACTIVATE);
|
|
10791
10832
|
this.createLifecycleCompanions(DependencyLifecycle.ACTIVATE);
|
|
10792
|
-
log$
|
|
10833
|
+
log$F.debug(
|
|
10793
10834
|
`Model ${this.modelTypeName} with id ${this.modelId} activated`
|
|
10794
10835
|
);
|
|
10795
10836
|
} catch (e) {
|
|
10796
|
-
log$
|
|
10837
|
+
log$F.debug(`Model ${this.modelId} failed to activate`);
|
|
10797
10838
|
throw e;
|
|
10798
10839
|
}
|
|
10799
10840
|
return;
|
|
@@ -10809,7 +10850,7 @@ class KosModel {
|
|
|
10809
10850
|
{
|
|
10810
10851
|
condition: () => this.loaded,
|
|
10811
10852
|
onMatch: () => {
|
|
10812
|
-
log$
|
|
10853
|
+
log$F.debug(`Model ${this.modelId} is loaded`);
|
|
10813
10854
|
}
|
|
10814
10855
|
}
|
|
10815
10856
|
]);
|
|
@@ -10825,7 +10866,7 @@ class KosModel {
|
|
|
10825
10866
|
{
|
|
10826
10867
|
condition: () => this.initialized,
|
|
10827
10868
|
onMatch: () => {
|
|
10828
|
-
log$
|
|
10869
|
+
log$F.debug(`Model ${this.modelId} is initialized`);
|
|
10829
10870
|
}
|
|
10830
10871
|
}
|
|
10831
10872
|
]);
|
|
@@ -10841,20 +10882,20 @@ class KosModel {
|
|
|
10841
10882
|
{
|
|
10842
10883
|
condition: () => this.status === KosModelState.READY,
|
|
10843
10884
|
onMatch: () => {
|
|
10844
|
-
log$
|
|
10885
|
+
log$F.debug(`Model ${this.modelId} is ready`);
|
|
10845
10886
|
}
|
|
10846
10887
|
}
|
|
10847
10888
|
]);
|
|
10848
10889
|
}
|
|
10849
10890
|
async ready() {
|
|
10850
10891
|
if (this.fsm.current === KosModelState.READY) {
|
|
10851
|
-
log$
|
|
10892
|
+
log$F.debug(
|
|
10852
10893
|
`already readying model ${this.modelTypeName} with id ${this.modelId} returning`
|
|
10853
10894
|
);
|
|
10854
10895
|
return;
|
|
10855
10896
|
}
|
|
10856
10897
|
try {
|
|
10857
|
-
log$
|
|
10898
|
+
log$F.debug(`readying model ${this.modelTypeName} with id ${this.modelId}`);
|
|
10858
10899
|
await executeDependentModelLifecycle(this, DependencyLifecycle.READY);
|
|
10859
10900
|
await executeChildrenModelLifecycle(
|
|
10860
10901
|
this,
|
|
@@ -10870,7 +10911,7 @@ class KosModel {
|
|
|
10870
10911
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.READY);
|
|
10871
10912
|
this.subscriptionManager?.registerAll(DependencyLifecycle.READY);
|
|
10872
10913
|
this.createLifecycleCompanions(DependencyLifecycle.READY);
|
|
10873
|
-
log$
|
|
10914
|
+
log$F.debug(`Model ${this.modelId} is ready`);
|
|
10874
10915
|
const payload = {
|
|
10875
10916
|
modelId: this.modelId,
|
|
10876
10917
|
modelType: this.modelTypeName
|
|
@@ -10881,7 +10922,7 @@ class KosModel {
|
|
|
10881
10922
|
);
|
|
10882
10923
|
publish(modelTypeEventTopicFactory(this.modelTypeName), payload);
|
|
10883
10924
|
} catch (e) {
|
|
10884
|
-
log$
|
|
10925
|
+
log$F.error(e);
|
|
10885
10926
|
throw Error(e);
|
|
10886
10927
|
}
|
|
10887
10928
|
}
|
|
@@ -10892,18 +10933,18 @@ class KosModel {
|
|
|
10892
10933
|
}
|
|
10893
10934
|
const { modelTypeName, modelId } = this;
|
|
10894
10935
|
if (this.fsm.current === KosModelState.LOADED) {
|
|
10895
|
-
log$
|
|
10936
|
+
log$F.debug(`Model ${modelTypeName} with id ${modelId} already loaded`);
|
|
10896
10937
|
return;
|
|
10897
10938
|
}
|
|
10898
10939
|
if (this._isLoadExecuting) {
|
|
10899
|
-
log$
|
|
10940
|
+
log$F.debug(
|
|
10900
10941
|
`Model ${modelTypeName} with id ${modelId} is currently executing load`
|
|
10901
10942
|
);
|
|
10902
10943
|
return;
|
|
10903
10944
|
}
|
|
10904
10945
|
this._isLoadExecuting = true;
|
|
10905
10946
|
try {
|
|
10906
|
-
log$
|
|
10947
|
+
log$F.debug(`Loading model ${modelTypeName} with id ${modelId}`);
|
|
10907
10948
|
await executeDependentModelLifecycle(this, DependencyLifecycle.LOAD);
|
|
10908
10949
|
const context = KosContextManager.getContext(modelId);
|
|
10909
10950
|
const MODEL_LOADER_TYPE = `${MODEL_LOADER}.${modelTypeName}`;
|
|
@@ -10912,7 +10953,7 @@ class KosModel {
|
|
|
10912
10953
|
{}
|
|
10913
10954
|
);
|
|
10914
10955
|
if (loadedContext) {
|
|
10915
|
-
log$
|
|
10956
|
+
log$F.info(
|
|
10916
10957
|
`Setting loaded context for ${modelId}, type: ${modelTypeName}`
|
|
10917
10958
|
);
|
|
10918
10959
|
context?.set(MODEL_LOADER_TYPE, loadedContext);
|
|
@@ -10924,7 +10965,7 @@ class KosModel {
|
|
|
10924
10965
|
kosAction(() => {
|
|
10925
10966
|
this.loaded = true;
|
|
10926
10967
|
});
|
|
10927
|
-
log$
|
|
10968
|
+
log$F.debug(
|
|
10928
10969
|
`Model ${modelTypeName} with id ${modelId} successfully loaded`
|
|
10929
10970
|
);
|
|
10930
10971
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.LOAD);
|
|
@@ -10933,14 +10974,14 @@ class KosModel {
|
|
|
10933
10974
|
this.effectManager?.setup();
|
|
10934
10975
|
this.createLifecycleCompanions(DependencyLifecycle.LOAD);
|
|
10935
10976
|
} catch (e) {
|
|
10936
|
-
log$
|
|
10977
|
+
log$F.error(`Model ${modelId} failed to load`, e);
|
|
10937
10978
|
throw e;
|
|
10938
10979
|
} finally {
|
|
10939
10980
|
this._isLoadExecuting = false;
|
|
10940
10981
|
}
|
|
10941
10982
|
}
|
|
10942
10983
|
async unload() {
|
|
10943
|
-
log$
|
|
10984
|
+
log$F.debug(`unloading model ${this.modelTypeName} with id ${this.modelId}`);
|
|
10944
10985
|
try {
|
|
10945
10986
|
const childrenUnload = this.getChildren().map((child) => child.unload?.()).filter((p) => !!p);
|
|
10946
10987
|
await Promise.allSettled(childrenUnload);
|
|
@@ -10959,12 +11000,12 @@ class KosModel {
|
|
|
10959
11000
|
modelData.stateHistory = [];
|
|
10960
11001
|
}
|
|
10961
11002
|
}
|
|
10962
|
-
log$
|
|
11003
|
+
log$F.debug(`Model ${this.modelTypeName} with id ${this.modelId} unloaded`);
|
|
10963
11004
|
this.effectManager?.disposeAll();
|
|
10964
11005
|
this.subscriptionManager?.disposeAll();
|
|
10965
11006
|
this.httpRouteManager?.dispose();
|
|
10966
11007
|
} catch (e) {
|
|
10967
|
-
log$
|
|
11008
|
+
log$F.debug(`Model ${this.modelId} failed to unload`);
|
|
10968
11009
|
throw e;
|
|
10969
11010
|
}
|
|
10970
11011
|
}
|
|
@@ -10975,7 +11016,7 @@ class KosModel {
|
|
|
10975
11016
|
}
|
|
10976
11017
|
const { modelId, modelTypeName } = this;
|
|
10977
11018
|
const context = KosContextManager.getContext(modelId);
|
|
10978
|
-
log$
|
|
11019
|
+
log$F.debug(`Initializing model ${modelTypeName} with id ${modelId}`);
|
|
10979
11020
|
await executeDependentModelLifecycle(this, DependencyLifecycle.INIT);
|
|
10980
11021
|
try {
|
|
10981
11022
|
await this.serviceRequestManager?.executeForLifecycle(
|
|
@@ -10983,18 +11024,18 @@ class KosModel {
|
|
|
10983
11024
|
);
|
|
10984
11025
|
await this.modelData?.init?.(context);
|
|
10985
11026
|
this.initialized = true;
|
|
10986
|
-
log$
|
|
11027
|
+
log$F.debug(`Model ${modelTypeName} with id ${modelId} initialized`);
|
|
10987
11028
|
this.onlineLifecycleManager?.register();
|
|
10988
11029
|
this.initializeStateMachineForLifecycle(DependencyLifecycle.INIT);
|
|
10989
11030
|
this.registerSubscribers(DependencyLifecycle.INIT);
|
|
10990
11031
|
this.createLifecycleCompanions(DependencyLifecycle.INIT);
|
|
10991
11032
|
} catch (e) {
|
|
10992
|
-
log$
|
|
11033
|
+
log$F.error(`Model ${modelId} failed to initialize`, e);
|
|
10993
11034
|
throw e;
|
|
10994
11035
|
}
|
|
10995
11036
|
}
|
|
10996
11037
|
async registerSubscribers(lifecycle) {
|
|
10997
|
-
log$
|
|
11038
|
+
log$F.debug(
|
|
10998
11039
|
`registering subscribers in ${this.modelTypeName} with id ${this.modelId}`
|
|
10999
11040
|
);
|
|
11000
11041
|
this.subscriptionManager?.registerAll(lifecycle);
|
|
@@ -11011,7 +11052,7 @@ class KosModel {
|
|
|
11011
11052
|
}
|
|
11012
11053
|
/** @internal */
|
|
11013
11054
|
async reloadData() {
|
|
11014
|
-
log$
|
|
11055
|
+
log$F.info(`reloading model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11015
11056
|
this.suspendForReload();
|
|
11016
11057
|
const data = this.modelData;
|
|
11017
11058
|
if (typeof data?.reload === "function" && !data[SelfManagedReload]) {
|
|
@@ -11020,7 +11061,7 @@ class KosModel {
|
|
|
11020
11061
|
}
|
|
11021
11062
|
/** @internal */
|
|
11022
11063
|
async reattach() {
|
|
11023
|
-
log$
|
|
11064
|
+
log$F.info(`reattaching model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11024
11065
|
kosAction(() => {
|
|
11025
11066
|
this.loaded = true;
|
|
11026
11067
|
});
|
|
@@ -11051,7 +11092,7 @@ class KosModel {
|
|
|
11051
11092
|
]);
|
|
11052
11093
|
reloaded.forEach((result, index) => {
|
|
11053
11094
|
if (result.status === "rejected") {
|
|
11054
|
-
log$
|
|
11095
|
+
log$F.error(
|
|
11055
11096
|
`reload of child ${ready[index].modelId} of ${this.modelId} failed`,
|
|
11056
11097
|
result.reason
|
|
11057
11098
|
);
|
|
@@ -11082,7 +11123,7 @@ class KosModel {
|
|
|
11082
11123
|
* each time. A state machine with `initializeAt: ONLINE` starts once.
|
|
11083
11124
|
*/
|
|
11084
11125
|
async online() {
|
|
11085
|
-
log$
|
|
11126
|
+
log$F.debug(`online model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11086
11127
|
this.registerSubscribers();
|
|
11087
11128
|
await executeDependentModelLifecycle(this, DependencyLifecycle.ONLINE);
|
|
11088
11129
|
await this.serviceRequestManager?.executeForLifecycle(
|
|
@@ -11094,7 +11135,7 @@ class KosModel {
|
|
|
11094
11135
|
this.createLifecycleCompanions(DependencyLifecycle.ONLINE);
|
|
11095
11136
|
}
|
|
11096
11137
|
async offline() {
|
|
11097
|
-
log$
|
|
11138
|
+
log$F.debug(`offline model ${this.modelTypeName} with id ${this.modelId}`);
|
|
11098
11139
|
this.subscriptionManager?.disposeAll();
|
|
11099
11140
|
const context = KosContextManager.getContext(this.modelId);
|
|
11100
11141
|
await this.modelData?.offline?.(context);
|
|
@@ -11112,7 +11153,7 @@ class KosModel {
|
|
|
11112
11153
|
this.companionManager.clear();
|
|
11113
11154
|
}
|
|
11114
11155
|
}
|
|
11115
|
-
const log$
|
|
11156
|
+
const log$E = KosLog.createLogger({ group: LogGroup.core, name: "kos-model-instantiator" });
|
|
11116
11157
|
class KosModelInstantiator {
|
|
11117
11158
|
constructor(registry, cache2) {
|
|
11118
11159
|
this.registry = registry;
|
|
@@ -11130,7 +11171,7 @@ class KosModelInstantiator {
|
|
|
11130
11171
|
const modelRegistry = this.registry.models[typeId];
|
|
11131
11172
|
if (!modelRegistry) {
|
|
11132
11173
|
const errorMessage = `No model registered for type ${typeId}`;
|
|
11133
|
-
log$
|
|
11174
|
+
log$E.error(errorMessage, {
|
|
11134
11175
|
modelType: typeId,
|
|
11135
11176
|
requestedId: id,
|
|
11136
11177
|
providedOptions: options,
|
|
@@ -11149,7 +11190,7 @@ class KosModelInstantiator {
|
|
|
11149
11190
|
const modelId = modelRegistry.singleton ? typeId : id;
|
|
11150
11191
|
this.cache.restoreFromDeleteCache(modelId);
|
|
11151
11192
|
if (!this.cache.hasModel(modelId)) {
|
|
11152
|
-
log$
|
|
11193
|
+
log$E.debug(`Creating model instance: ${typeId} [${modelId}]`);
|
|
11153
11194
|
const hasOptions = options && Object.keys(options).length > 0;
|
|
11154
11195
|
const modelClass = modelRegistry.class || modelRegistry.create;
|
|
11155
11196
|
const requiresOptions = modelClass?.prototype?.[OptionsRequired] === true;
|
|
@@ -11195,7 +11236,7 @@ class KosModelInstantiator {
|
|
|
11195
11236
|
}
|
|
11196
11237
|
const activeModel = this.cache.getModelById(modelId);
|
|
11197
11238
|
if (!activeModel) {
|
|
11198
|
-
log$
|
|
11239
|
+
log$E.error(`Model ${typeId} [${modelId}] not found in cache`);
|
|
11199
11240
|
throw new Error(`Model ${typeId} [${modelId}] not found in cache`);
|
|
11200
11241
|
}
|
|
11201
11242
|
return { model: activeModel, data: activeModel.modelData };
|
|
@@ -11261,7 +11302,7 @@ let KosModelRegistry$1 = class KosModelRegistry {
|
|
|
11261
11302
|
}
|
|
11262
11303
|
};
|
|
11263
11304
|
const MODEL_DELETION_DELAY = 10;
|
|
11264
|
-
const log$
|
|
11305
|
+
const log$D = KosLog.createLogger({ group: LogGroup.core, name: "kos-model-manager" });
|
|
11265
11306
|
class KosModelManager {
|
|
11266
11307
|
cache;
|
|
11267
11308
|
instantiator;
|
|
@@ -11304,7 +11345,7 @@ class KosModelManager {
|
|
|
11304
11345
|
}
|
|
11305
11346
|
static getInstance(reset2) {
|
|
11306
11347
|
if (!globalThis.kos?.modelManager || reset2) {
|
|
11307
|
-
log$
|
|
11348
|
+
log$D.debug("Creating new instance of KosModelManager");
|
|
11308
11349
|
new this();
|
|
11309
11350
|
}
|
|
11310
11351
|
return globalThis.kos?.modelManager;
|
|
@@ -11325,7 +11366,7 @@ class KosModelManager {
|
|
|
11325
11366
|
*/
|
|
11326
11367
|
get preloadedModels() {
|
|
11327
11368
|
return this.cache.preload((modelKey) => {
|
|
11328
|
-
log$
|
|
11369
|
+
log$D.debug(`preloading ${modelKey}`);
|
|
11329
11370
|
if (typeof modelKey === "string") {
|
|
11330
11371
|
return this.createModelInstance(modelKey).model;
|
|
11331
11372
|
} else {
|
|
@@ -11621,6 +11662,10 @@ class KosModelManager {
|
|
|
11621
11662
|
this._registry.registerModel(reg);
|
|
11622
11663
|
}
|
|
11623
11664
|
}
|
|
11665
|
+
const log$C = KosLog.createLogger({
|
|
11666
|
+
group: LogGroup.core,
|
|
11667
|
+
name: "kos-core-lifecycle"
|
|
11668
|
+
});
|
|
11624
11669
|
var KosCoreState = /* @__PURE__ */ ((KosCoreState2) => {
|
|
11625
11670
|
KosCoreState2["CREATING"] = `creating`;
|
|
11626
11671
|
KosCoreState2["CREATED"] = `created`;
|
|
@@ -11657,7 +11702,7 @@ const reportFailure = async (step, run) => {
|
|
|
11657
11702
|
return await run();
|
|
11658
11703
|
} catch (error) {
|
|
11659
11704
|
const detail = error instanceof Error ? error.stack ?? `${error.name}: ${error.message}` : String(error);
|
|
11660
|
-
log$
|
|
11705
|
+
log$C.error(`KOS Core lifecycle step "${step}" failed. ${detail}`);
|
|
11661
11706
|
throw error;
|
|
11662
11707
|
}
|
|
11663
11708
|
};
|
|
@@ -11696,7 +11741,7 @@ const coreFsm = (core) => {
|
|
|
11696
11741
|
});
|
|
11697
11742
|
const online = robot3.interpret(
|
|
11698
11743
|
onlineMachine2,
|
|
11699
|
-
(_service) => log$
|
|
11744
|
+
(_service) => log$C.debug(`KOS Core connection: ${_service.machine.current}`)
|
|
11700
11745
|
);
|
|
11701
11746
|
const syncOnline = () => online.send(
|
|
11702
11747
|
core.transport.connectionEstablished ? "go_online" : "go_offline"
|
|
@@ -11910,11 +11955,11 @@ const coreFsm = (core) => {
|
|
|
11910
11955
|
});
|
|
11911
11956
|
const service2 = robot3.interpret(
|
|
11912
11957
|
machine2,
|
|
11913
|
-
(_service) => log$
|
|
11958
|
+
(_service) => log$C.debug(`KOS Core state: ${_service.machine.current}`)
|
|
11914
11959
|
);
|
|
11915
11960
|
return { service: service2, online };
|
|
11916
11961
|
};
|
|
11917
|
-
const log$
|
|
11962
|
+
const log$B = KosLog.createLogger({ group: LogGroup.core, name: "kos-core" });
|
|
11918
11963
|
const getConnectionAlias = () => {
|
|
11919
11964
|
const params2 = getQueryParams();
|
|
11920
11965
|
const alias = params2?.alias;
|
|
@@ -11968,11 +12013,11 @@ const rejectAfterDelay = (ms, model) => {
|
|
|
11968
12013
|
const promise = new Promise((_, reject) => {
|
|
11969
12014
|
timeoutId = setTimeout(() => {
|
|
11970
12015
|
if (model) {
|
|
11971
|
-
|
|
12016
|
+
log$B.error(
|
|
11972
12017
|
`Model ${model.modelId} - ${model.modelTypeName} preloading - timed out after ${ms}ms`
|
|
11973
12018
|
);
|
|
11974
12019
|
} else {
|
|
11975
|
-
|
|
12020
|
+
log$B.error(`KOS Core preloading timed out after ${ms}ms`);
|
|
11976
12021
|
}
|
|
11977
12022
|
reject(
|
|
11978
12023
|
new Error(
|
|
@@ -12057,11 +12102,11 @@ class KosCore {
|
|
|
12057
12102
|
});
|
|
12058
12103
|
});
|
|
12059
12104
|
subscribe(WebSocketEvents.RELOAD, () => {
|
|
12060
|
-
log$
|
|
12105
|
+
log$B.warn("WebSocket requested reload");
|
|
12061
12106
|
this.fsmService.service.send(KosCoreEvents.RELOAD);
|
|
12062
12107
|
});
|
|
12063
12108
|
subscribe("/studio/project/reload", () => {
|
|
12064
|
-
log$
|
|
12109
|
+
log$B.warn("Project requested reload");
|
|
12065
12110
|
this.fsmService.service.send(KosCoreEvents.RELOAD);
|
|
12066
12111
|
});
|
|
12067
12112
|
const ws = WebSocketTransport.getInstance();
|
|
@@ -12090,7 +12135,7 @@ class KosCore {
|
|
|
12090
12135
|
applyConnectionAlias(connectionAlias) {
|
|
12091
12136
|
if (this._transport.alias) {
|
|
12092
12137
|
if (this.connectionAlias && this.connectionAlias !== connectionAlias) {
|
|
12093
|
-
log$
|
|
12138
|
+
log$B.warn(
|
|
12094
12139
|
`Connection alias ${connectionAlias} ignored; the connection already uses ${this._transport.alias}`
|
|
12095
12140
|
);
|
|
12096
12141
|
}
|
|
@@ -12128,13 +12173,13 @@ alias:${alias}
|
|
|
12128
12173
|
}
|
|
12129
12174
|
async reload() {
|
|
12130
12175
|
if (this._reloading) {
|
|
12131
|
-
log$
|
|
12176
|
+
log$B.info("reload already in progress");
|
|
12132
12177
|
return;
|
|
12133
12178
|
}
|
|
12134
12179
|
this._reloading = true;
|
|
12135
12180
|
try {
|
|
12136
|
-
log$
|
|
12137
|
-
log$
|
|
12181
|
+
log$B.warn("reloading KOS Core");
|
|
12182
|
+
log$B.warn("reloading preloaded models");
|
|
12138
12183
|
const modelManager = this.modelManager;
|
|
12139
12184
|
const preloaded = [...modelManager.preloadedModels];
|
|
12140
12185
|
const covered = /* @__PURE__ */ new Set();
|
|
@@ -12146,27 +12191,27 @@ alias:${alias}
|
|
|
12146
12191
|
for (const model of preloaded) {
|
|
12147
12192
|
if (isReloadable(model.modelData) && !covered.has(model)) {
|
|
12148
12193
|
if (isSelfManagedReload(model.modelData)) {
|
|
12149
|
-
log$
|
|
12194
|
+
log$B.info(`skipping self-managed model ${model.modelId}`);
|
|
12150
12195
|
continue;
|
|
12151
12196
|
}
|
|
12152
|
-
log$
|
|
12197
|
+
log$B.info(`reloading model ${model.modelId}`);
|
|
12153
12198
|
await reloadRoot(model);
|
|
12154
|
-
log$
|
|
12199
|
+
log$B.info(`reloading model ${model.modelId} complete`);
|
|
12155
12200
|
}
|
|
12156
12201
|
}
|
|
12157
12202
|
for (const model of [...modelManager.models]) {
|
|
12158
12203
|
if (!preloaded.includes(model) && isReloadable(model.modelData) && !covered.has(model)) {
|
|
12159
12204
|
if (isSelfManagedReload(model.modelData)) {
|
|
12160
|
-
log$
|
|
12205
|
+
log$B.info(`skipping self-managed model ${model.modelId}`);
|
|
12161
12206
|
continue;
|
|
12162
12207
|
}
|
|
12163
|
-
log$
|
|
12208
|
+
log$B.warn(`reloading model ${model.modelId}`);
|
|
12164
12209
|
await reloadRoot(model);
|
|
12165
12210
|
}
|
|
12166
12211
|
}
|
|
12167
12212
|
} finally {
|
|
12168
12213
|
mobx.runInAction(() => {
|
|
12169
|
-
log$
|
|
12214
|
+
log$B.warn("reloading KOS Core complete");
|
|
12170
12215
|
this._reloading = false;
|
|
12171
12216
|
});
|
|
12172
12217
|
}
|
|
@@ -12176,13 +12221,13 @@ alias:${alias}
|
|
|
12176
12221
|
try {
|
|
12177
12222
|
await model.fsm.reload();
|
|
12178
12223
|
} catch (e) {
|
|
12179
|
-
log$
|
|
12224
|
+
log$B.error(`reload of ${model.modelId} failed`, e);
|
|
12180
12225
|
}
|
|
12181
12226
|
}
|
|
12182
12227
|
async online() {
|
|
12183
|
-
log$
|
|
12228
|
+
log$B.debug("KOS Core going online");
|
|
12184
12229
|
await this._transport.whenReady();
|
|
12185
|
-
log$
|
|
12230
|
+
log$B.debug("KOS Transport Ready. Calling online() for models");
|
|
12186
12231
|
this.modelManager.models.forEach(
|
|
12187
12232
|
(model) => model.onlineLifecycleManager?.register()
|
|
12188
12233
|
);
|
|
@@ -12190,14 +12235,14 @@ alias:${alias}
|
|
|
12190
12235
|
console.timeEnd("kosCore:startup");
|
|
12191
12236
|
}
|
|
12192
12237
|
async offline() {
|
|
12193
|
-
log$
|
|
12238
|
+
log$B.debug("KOS Core going offline");
|
|
12194
12239
|
publish("/kosCore/offline", "/kosCore/offline");
|
|
12195
12240
|
}
|
|
12196
12241
|
async unload() {
|
|
12197
|
-
log$
|
|
12242
|
+
log$B.debug("Unloading KOS Core");
|
|
12198
12243
|
const currentTime = Date.now();
|
|
12199
12244
|
this._unloading = true;
|
|
12200
|
-
log$
|
|
12245
|
+
log$B.debug("unloading KOS Core");
|
|
12201
12246
|
const modelManager = this.modelManager;
|
|
12202
12247
|
for (const model of modelManager.models) {
|
|
12203
12248
|
if (isUnloadable(model.modelData)) {
|
|
@@ -12215,9 +12260,9 @@ alias:${alias}
|
|
|
12215
12260
|
await mobx.when(() => this.status === KosCoreState.READY);
|
|
12216
12261
|
}
|
|
12217
12262
|
async ready() {
|
|
12218
|
-
log$
|
|
12263
|
+
log$B.debug("Readying KOS Core");
|
|
12219
12264
|
await this._transport.whenReady();
|
|
12220
|
-
log$
|
|
12265
|
+
log$B.debug("KOS Transport ready. Preloading models");
|
|
12221
12266
|
if (!this.modelManager) {
|
|
12222
12267
|
throw new Error(
|
|
12223
12268
|
"KOS Core reached ready() with no model manager. Its lifecycle was started without a registry."
|
|
@@ -12230,7 +12275,7 @@ alias:${alias}
|
|
|
12230
12275
|
promise: model.whenReady()
|
|
12231
12276
|
};
|
|
12232
12277
|
});
|
|
12233
|
-
log$
|
|
12278
|
+
log$B.debug(`Preloaded ${promises.length} models`);
|
|
12234
12279
|
const settled = await Promise.allSettled(
|
|
12235
12280
|
promises.map((promise) => {
|
|
12236
12281
|
const { promise: timeoutPromise, cancel: timeoutCancel } = rejectAfterDelay(5e3, promise.model);
|
|
@@ -12244,14 +12289,14 @@ alias:${alias}
|
|
|
12244
12289
|
);
|
|
12245
12290
|
const failed = settled.filter((p) => p.status === "rejected");
|
|
12246
12291
|
if (failed.length) {
|
|
12247
|
-
log$
|
|
12292
|
+
log$B.error(
|
|
12248
12293
|
`There were ${failed.length} failed models on model preloading`
|
|
12249
12294
|
);
|
|
12250
12295
|
throw Error(
|
|
12251
12296
|
`There were ${failed.length} failed models on model preloading`
|
|
12252
12297
|
);
|
|
12253
12298
|
}
|
|
12254
|
-
log$
|
|
12299
|
+
log$B.debug(`leaving kos-core ready() `);
|
|
12255
12300
|
}
|
|
12256
12301
|
get isReady() {
|
|
12257
12302
|
return this.status === KosCoreState.READY;
|
|
@@ -12269,19 +12314,19 @@ alias:${alias}
|
|
|
12269
12314
|
return this.loaded;
|
|
12270
12315
|
}
|
|
12271
12316
|
async init() {
|
|
12272
|
-
log$
|
|
12317
|
+
log$B.debug("entering kos-core init()");
|
|
12273
12318
|
console.time("kosCore:startup");
|
|
12274
12319
|
console.time("kosCore:init");
|
|
12275
12320
|
await this._transport.whenReady();
|
|
12276
12321
|
this.initialized = true;
|
|
12277
|
-
log$
|
|
12322
|
+
log$B.debug("initialized - leaving kos-core init()");
|
|
12278
12323
|
console.timeEnd("kosCore:init");
|
|
12279
12324
|
}
|
|
12280
12325
|
async load() {
|
|
12281
|
-
log$
|
|
12326
|
+
log$B.debug("entering kos-core load()");
|
|
12282
12327
|
console.time("kosCore:load");
|
|
12283
12328
|
this.loaded = true;
|
|
12284
|
-
log$
|
|
12329
|
+
log$B.debug("loaded - leaving kos-core load()");
|
|
12285
12330
|
console.timeEnd("kosCore:load");
|
|
12286
12331
|
}
|
|
12287
12332
|
static create(registry, reset2, connectionAlias) {
|
|
@@ -12371,10 +12416,7 @@ alias:${alias}
|
|
|
12371
12416
|
return this._instance;
|
|
12372
12417
|
}
|
|
12373
12418
|
}
|
|
12374
|
-
const log$
|
|
12375
|
-
name: "kos-model-visitor",
|
|
12376
|
-
group: "kos-ui-core"
|
|
12377
|
-
});
|
|
12419
|
+
const log$A = KosLog.createLogger({ group: LogGroup.core, name: "kos-model-visitor" });
|
|
12378
12420
|
class KosModelVisitor {
|
|
12379
12421
|
/**
|
|
12380
12422
|
* A set to keep track of visited model IDs to prevent redundant visits.
|
|
@@ -12412,7 +12454,7 @@ class KosModelVisitor {
|
|
|
12412
12454
|
*/
|
|
12413
12455
|
visit(model) {
|
|
12414
12456
|
if (this.visitedModels.has(model.modelId)) {
|
|
12415
|
-
log$
|
|
12457
|
+
log$A.info(`model ${model.modelId} already visited`);
|
|
12416
12458
|
return;
|
|
12417
12459
|
}
|
|
12418
12460
|
const stopVisiting = !!this.visitModel(model.modelData, this);
|
|
@@ -12425,6 +12467,10 @@ class KosModelVisitor {
|
|
|
12425
12467
|
});
|
|
12426
12468
|
}
|
|
12427
12469
|
}
|
|
12470
|
+
const log$z = KosLog.createLogger({
|
|
12471
|
+
group: LogGroup.core,
|
|
12472
|
+
name: "feature-flags"
|
|
12473
|
+
});
|
|
12428
12474
|
const EXTENSION_FEATURE_FLAG_RESOLVER = "featureFlagResolver";
|
|
12429
12475
|
const flagResolvers = /* @__PURE__ */ new Map();
|
|
12430
12476
|
registerExtensionPoint(EXTENSION_FEATURE_FLAG_RESOLVER, {
|
|
@@ -12445,7 +12491,7 @@ registerExtensionPoint(EXTENSION_FEATURE_FLAG_RESOLVER, {
|
|
|
12445
12491
|
if (r.status === "fulfilled") {
|
|
12446
12492
|
return r.value;
|
|
12447
12493
|
} else {
|
|
12448
|
-
|
|
12494
|
+
log$z.info(`Feature flag resolver ${id} failed: ${r.reason}`);
|
|
12449
12495
|
return [];
|
|
12450
12496
|
}
|
|
12451
12497
|
}).flat();
|
|
@@ -12518,7 +12564,38 @@ const modelFactory = (typeId) => {
|
|
|
12518
12564
|
};
|
|
12519
12565
|
};
|
|
12520
12566
|
const pipe = (...fns) => (x) => fns.reduce((v, f) => f(v), x);
|
|
12521
|
-
const log$
|
|
12567
|
+
const log$y = KosLog.createLogger({
|
|
12568
|
+
group: LogGroup.core,
|
|
12569
|
+
name: "retry-with-exponential-backoff"
|
|
12570
|
+
});
|
|
12571
|
+
const BASE_OPTIONS = {
|
|
12572
|
+
maxAttempts: 5,
|
|
12573
|
+
baseDelayMs: 100,
|
|
12574
|
+
backoffFactor: 1.5
|
|
12575
|
+
};
|
|
12576
|
+
async function retryWithExponentialBackoff(operation, options) {
|
|
12577
|
+
let attempt = 1;
|
|
12578
|
+
const _options = { ...BASE_OPTIONS, ...options };
|
|
12579
|
+
const { maxAttempts, baseDelayMs, backoffFactor } = _options;
|
|
12580
|
+
let delayMs = baseDelayMs;
|
|
12581
|
+
while (attempt <= maxAttempts) {
|
|
12582
|
+
try {
|
|
12583
|
+
const result = await operation();
|
|
12584
|
+
return result;
|
|
12585
|
+
} catch (error) {
|
|
12586
|
+
log$y.error(`Attempt ${attempt} failed: ${error}`);
|
|
12587
|
+
if (attempt < maxAttempts) {
|
|
12588
|
+
delayMs = baseDelayMs * Math.pow(backoffFactor, attempt);
|
|
12589
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
12590
|
+
attempt++;
|
|
12591
|
+
} else {
|
|
12592
|
+
throw error;
|
|
12593
|
+
}
|
|
12594
|
+
}
|
|
12595
|
+
}
|
|
12596
|
+
throw new Error("All attempts failed");
|
|
12597
|
+
}
|
|
12598
|
+
const log$x = KosLog.createLogger({ group: LogGroup.transport, name: "kos-service-request" });
|
|
12522
12599
|
const resolveServiceUrl = (_service) => {
|
|
12523
12600
|
const MOCK = false;
|
|
12524
12601
|
const URL2 = exports.BASE_URL;
|
|
@@ -12690,7 +12767,7 @@ const getOne$7 = (destinationAddress, url, _fetch) => async ({
|
|
|
12690
12767
|
destinationAddress: destinationAddressOverride
|
|
12691
12768
|
});
|
|
12692
12769
|
const resolvedUrl = urlOverride || url;
|
|
12693
|
-
log$
|
|
12770
|
+
log$x.debug(`resolvedUrl: ${resolvedUrl}`);
|
|
12694
12771
|
try {
|
|
12695
12772
|
const response = await _fetch(resolvedUrl, options);
|
|
12696
12773
|
if (!response.ok) {
|
|
@@ -13009,6 +13086,62 @@ const ServiceFactory = {
|
|
|
13009
13086
|
const _sessionKey = uuid();
|
|
13010
13087
|
const getKosSessionKey = () => `kos-${_sessionKey}`;
|
|
13011
13088
|
const isLocalRefId = (id) => !!id && !id.includes("VM_SERVICE") && id.startsWith(getKosSessionKey());
|
|
13089
|
+
const log$w = KosLog.createLogger({
|
|
13090
|
+
group: LogGroup.transport,
|
|
13091
|
+
name: "wait-for-request"
|
|
13092
|
+
});
|
|
13093
|
+
const waitForRequest = async (requestId, timeout = 6e4) => new Promise((resolve, reject) => {
|
|
13094
|
+
const { unsubscribe } = subscribe(requestId, (op) => {
|
|
13095
|
+
log$w.debug(`recieved response for refId ${requestId}: ${op}`);
|
|
13096
|
+
unsubscribe();
|
|
13097
|
+
clearTimeout(cancel);
|
|
13098
|
+
try {
|
|
13099
|
+
const body = op?.body ? JSON.parse(op.body) : {};
|
|
13100
|
+
resolve(body);
|
|
13101
|
+
} catch {
|
|
13102
|
+
const body = op?.body || {};
|
|
13103
|
+
resolve(body);
|
|
13104
|
+
}
|
|
13105
|
+
});
|
|
13106
|
+
const cancel = setTimeout(() => {
|
|
13107
|
+
unsubscribe();
|
|
13108
|
+
reject(Error(`Request with ID ${requestId} timed out. Cancelling.`));
|
|
13109
|
+
}, timeout);
|
|
13110
|
+
});
|
|
13111
|
+
const sendRequest = async (requestPromise, params2, refId) => {
|
|
13112
|
+
const op = waitForRequest(refId);
|
|
13113
|
+
const result = await Promise.allSettled([requestPromise(params2), op]);
|
|
13114
|
+
if (result[0].status === "fulfilled") {
|
|
13115
|
+
if (result[1].status === "rejected") {
|
|
13116
|
+
throw Error(result[1].reason);
|
|
13117
|
+
} else {
|
|
13118
|
+
if (result[0].value) {
|
|
13119
|
+
if (result[1].value.error) {
|
|
13120
|
+
throw Error(result[1].value.error);
|
|
13121
|
+
}
|
|
13122
|
+
result[0].value.data = result[1].value;
|
|
13123
|
+
return result[0].value;
|
|
13124
|
+
}
|
|
13125
|
+
}
|
|
13126
|
+
} else {
|
|
13127
|
+
throw Error(result[0].reason);
|
|
13128
|
+
}
|
|
13129
|
+
return void 0;
|
|
13130
|
+
};
|
|
13131
|
+
const syncPublish = async ({
|
|
13132
|
+
topic,
|
|
13133
|
+
msg,
|
|
13134
|
+
requestId
|
|
13135
|
+
}) => {
|
|
13136
|
+
const _requestId = requestId ?? uuid();
|
|
13137
|
+
const responsePromise = waitForRequest(_requestId);
|
|
13138
|
+
publish(topic, msg, { sync: _requestId });
|
|
13139
|
+
const response = await responsePromise;
|
|
13140
|
+
if (response.error) {
|
|
13141
|
+
throw Error(response.error);
|
|
13142
|
+
}
|
|
13143
|
+
return response;
|
|
13144
|
+
};
|
|
13012
13145
|
const contextMap = /* @__PURE__ */ new Map();
|
|
13013
13146
|
class KosContextBean {
|
|
13014
13147
|
_context;
|
|
@@ -13105,7 +13238,7 @@ const KosContextManager = {
|
|
|
13105
13238
|
};
|
|
13106
13239
|
KosContextManager.createContext("root");
|
|
13107
13240
|
const resolveKosContext = (model) => KosContextManager.getContext(model.id);
|
|
13108
|
-
const log$
|
|
13241
|
+
const log$v = KosLog.createLogger({ group: LogGroup.core, name: "kos-data-container" });
|
|
13109
13242
|
class KosDataContainer {
|
|
13110
13243
|
_data;
|
|
13111
13244
|
_sortKey;
|
|
@@ -13310,7 +13443,7 @@ class KosDataContainer {
|
|
|
13310
13443
|
const idx = this.index.get(indexName);
|
|
13311
13444
|
return idx.keys ?? [];
|
|
13312
13445
|
} else {
|
|
13313
|
-
log$
|
|
13446
|
+
log$v.info(
|
|
13314
13447
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
13315
13448
|
);
|
|
13316
13449
|
return [];
|
|
@@ -13322,7 +13455,7 @@ class KosDataContainer {
|
|
|
13322
13455
|
if (idx.index.has(indexKey)) {
|
|
13323
13456
|
return idx.getByKey(indexKey);
|
|
13324
13457
|
} else {
|
|
13325
|
-
log$
|
|
13458
|
+
log$v.info(
|
|
13326
13459
|
`key ${indexKey} not found in ${indexName} index: ${Array.from(
|
|
13327
13460
|
idx.index.keys()
|
|
13328
13461
|
)}`
|
|
@@ -13330,7 +13463,7 @@ class KosDataContainer {
|
|
|
13330
13463
|
return [];
|
|
13331
13464
|
}
|
|
13332
13465
|
} else {
|
|
13333
|
-
log$
|
|
13466
|
+
log$v.info(
|
|
13334
13467
|
`index ${indexName} not found in ${Array.from(this.index.keys())}`
|
|
13335
13468
|
);
|
|
13336
13469
|
return [];
|
|
@@ -13357,7 +13490,7 @@ class KosDataContainer {
|
|
|
13357
13490
|
* @private
|
|
13358
13491
|
*/
|
|
13359
13492
|
_logDataCapacityWarning(toEvict) {
|
|
13360
|
-
log$
|
|
13493
|
+
log$v.info(
|
|
13361
13494
|
`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.`
|
|
13362
13495
|
);
|
|
13363
13496
|
}
|
|
@@ -13417,7 +13550,7 @@ class KosDataContainer {
|
|
|
13417
13550
|
const candidates = this._customEvictionFilter(this.data);
|
|
13418
13551
|
return candidates.slice(0, count).map((item) => item.id);
|
|
13419
13552
|
}
|
|
13420
|
-
log$
|
|
13553
|
+
log$v.error(
|
|
13421
13554
|
"Custom eviction strategy specified but no customEvictionFilter provided. Falling back to FIFO."
|
|
13422
13555
|
);
|
|
13423
13556
|
return this._selectFifoData(count);
|
|
@@ -13429,7 +13562,7 @@ class KosDataContainer {
|
|
|
13429
13562
|
_removeEvictedData(ids) {
|
|
13430
13563
|
ids.forEach((id) => {
|
|
13431
13564
|
const item = this._data.get(id);
|
|
13432
|
-
log$
|
|
13565
|
+
log$v.info(`Evicting data item: ${id}`, {
|
|
13433
13566
|
itemId: id,
|
|
13434
13567
|
itemType: item ? item.constructor?.name : "unknown",
|
|
13435
13568
|
strategy: this._evictionStrategy
|
|
@@ -13442,7 +13575,7 @@ class KosDataContainer {
|
|
|
13442
13575
|
* @private
|
|
13443
13576
|
*/
|
|
13444
13577
|
_logDataEvictionComplete(evictedCount) {
|
|
13445
|
-
log$
|
|
13578
|
+
log$v.info(
|
|
13446
13579
|
`Evicted ${evictedCount} data items. Current size: ${this._data.size}/${this._maxCapacity}`
|
|
13447
13580
|
);
|
|
13448
13581
|
}
|
|
@@ -13614,14 +13747,14 @@ class BrowserKosRouter {
|
|
|
13614
13747
|
}, {});
|
|
13615
13748
|
}
|
|
13616
13749
|
}
|
|
13617
|
-
const log$
|
|
13750
|
+
const log$u = KosLog.createLogger({ group: LogGroup.core, name: "intent-service" });
|
|
13618
13751
|
const sendIntent = (intent) => {
|
|
13619
13752
|
if (hasEventSubscriptions(`/kos/intent/${intent.type}`)) {
|
|
13620
13753
|
publish(`/kos/intent/${intent.type}`, intent.options, {
|
|
13621
13754
|
"kos.intent.type": intent.type
|
|
13622
13755
|
});
|
|
13623
13756
|
} else {
|
|
13624
|
-
log$
|
|
13757
|
+
log$u.info(`No subscribers for intent ${intent.type}. Intent not sent.`);
|
|
13625
13758
|
}
|
|
13626
13759
|
};
|
|
13627
13760
|
const sendAsyncIntent = async (intent) => new Promise((resolve) => {
|
|
@@ -13651,11 +13784,11 @@ const sendAsyncIntent = async (intent) => new Promise((resolve) => {
|
|
|
13651
13784
|
sync: requestId
|
|
13652
13785
|
});
|
|
13653
13786
|
} else {
|
|
13654
|
-
log$
|
|
13787
|
+
log$u.info(`No subscribers for intent ${intent.type}. Intent not sent.`);
|
|
13655
13788
|
resolve([null, { body: void 0, payload: void 0 }]);
|
|
13656
13789
|
}
|
|
13657
13790
|
});
|
|
13658
|
-
const log$
|
|
13791
|
+
const log$t = KosLog.createLogger({ group: LogGroup.core, name: "app-startup-service" });
|
|
13659
13792
|
async function waitForAppsToStart(appIds, options = {}) {
|
|
13660
13793
|
const {
|
|
13661
13794
|
timeout = 3e4,
|
|
@@ -13663,10 +13796,10 @@ async function waitForAppsToStart(appIds, options = {}) {
|
|
|
13663
13796
|
requirePostStarted = false
|
|
13664
13797
|
} = options;
|
|
13665
13798
|
if (appIds.length === 0) {
|
|
13666
|
-
log$
|
|
13799
|
+
log$t.warn("No app IDs provided to waitForAppsToStart");
|
|
13667
13800
|
return true;
|
|
13668
13801
|
}
|
|
13669
|
-
log$
|
|
13802
|
+
log$t.debug(`Waiting for apps to start: ${appIds.join(", ")}`);
|
|
13670
13803
|
try {
|
|
13671
13804
|
const eventTopics = appIds.map((appId) => `/kos/app/started/${appId}`);
|
|
13672
13805
|
const startedApps = await waitForAllWithState(eventTopics, {
|
|
@@ -13675,12 +13808,12 @@ async function waitForAppsToStart(appIds, options = {}) {
|
|
|
13675
13808
|
const { default: api2 } = await Promise.resolve().then(() => service);
|
|
13676
13809
|
const [error, data] = await api2.get("/api/kos/apps/started");
|
|
13677
13810
|
if (error) {
|
|
13678
|
-
log$
|
|
13811
|
+
log$t.error("Error fetching started apps:", error);
|
|
13679
13812
|
return [];
|
|
13680
13813
|
}
|
|
13681
13814
|
return data;
|
|
13682
13815
|
} catch (error) {
|
|
13683
|
-
log$
|
|
13816
|
+
log$t.error("Failed to fetch app startup status:", error);
|
|
13684
13817
|
}
|
|
13685
13818
|
return [];
|
|
13686
13819
|
},
|
|
@@ -13702,17 +13835,17 @@ async function waitForAppsToStart(appIds, options = {}) {
|
|
|
13702
13835
|
});
|
|
13703
13836
|
if (notStartedApps.length > 0) {
|
|
13704
13837
|
const message = `Apps not started: ${notStartedApps.join(", ")}`;
|
|
13705
|
-
log$
|
|
13838
|
+
log$t.error(message);
|
|
13706
13839
|
if (throwOnTimeout) {
|
|
13707
13840
|
throw new Error(`App startup timeout: ${message}`);
|
|
13708
13841
|
}
|
|
13709
13842
|
return false;
|
|
13710
13843
|
}
|
|
13711
|
-
log$
|
|
13844
|
+
log$t.info(`All apps started successfully: ${appIds.join(", ")}`);
|
|
13712
13845
|
return true;
|
|
13713
13846
|
} catch (error) {
|
|
13714
13847
|
const message = `Failed to wait for apps to start: ${appIds.join(", ")}`;
|
|
13715
|
-
log$
|
|
13848
|
+
log$t.error(message, error);
|
|
13716
13849
|
if (throwOnTimeout) {
|
|
13717
13850
|
throw new Error(
|
|
13718
13851
|
`${message} - ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -13739,7 +13872,7 @@ async function checkAppsStarted(appIds, requirePostStarted = false) {
|
|
|
13739
13872
|
result[appId] = app?.started === true && (!requirePostStarted || app?.postStarted === true);
|
|
13740
13873
|
});
|
|
13741
13874
|
} catch (error) {
|
|
13742
|
-
log$
|
|
13875
|
+
log$t.error("Failed to check app startup status:", error);
|
|
13743
13876
|
appIds.forEach((appId) => result[appId] = false);
|
|
13744
13877
|
}
|
|
13745
13878
|
return result;
|
|
@@ -13753,7 +13886,7 @@ async function getStartedApps() {
|
|
|
13753
13886
|
const result = await response.json();
|
|
13754
13887
|
return result?.data ?? [];
|
|
13755
13888
|
} catch (error) {
|
|
13756
|
-
log$
|
|
13889
|
+
log$t.error("Failed to fetch started apps:", error);
|
|
13757
13890
|
return [];
|
|
13758
13891
|
}
|
|
13759
13892
|
}
|
|
@@ -13780,10 +13913,7 @@ var Topics = /* @__PURE__ */ ((Topics2) => {
|
|
|
13780
13913
|
Topics2["TIMEZONE_CHANGE"] = "/kos/internal/time/timezone";
|
|
13781
13914
|
return Topics2;
|
|
13782
13915
|
})(Topics || {});
|
|
13783
|
-
const log$
|
|
13784
|
-
name: "config-bean-service",
|
|
13785
|
-
group: "Services"
|
|
13786
|
-
});
|
|
13916
|
+
const log$s = KosLog.createLogger({ group: LogGroup.service, name: "config-bean-service" });
|
|
13787
13917
|
const URL$e = exports.BASE_URL;
|
|
13788
13918
|
const hasDecimals = (option) => option?.decimals !== void 0;
|
|
13789
13919
|
const { postModel: postModel$5, getOne: getOne$6 } = ServiceFactory.build({
|
|
@@ -13791,7 +13921,7 @@ const { postModel: postModel$5, getOne: getOne$6 } = ServiceFactory.build({
|
|
|
13791
13921
|
basePath: `${URL$e}/kos/config/`
|
|
13792
13922
|
});
|
|
13793
13923
|
const modifyConfigBean = async (id, model, path = `/api/kos/config`, destinationAddress = "") => {
|
|
13794
|
-
log$
|
|
13924
|
+
log$s.debug(`sending modify request for ConfigBean: ${id}`);
|
|
13795
13925
|
const response = postModel$5({
|
|
13796
13926
|
model,
|
|
13797
13927
|
urlOverride: `${URL$e}${path}/${id}`,
|
|
@@ -13800,7 +13930,7 @@ const modifyConfigBean = async (id, model, path = `/api/kos/config`, destination
|
|
|
13800
13930
|
return response;
|
|
13801
13931
|
};
|
|
13802
13932
|
const getConfigBean = async (id, path = `/api/kos/config`, destinationAddress = "") => {
|
|
13803
|
-
log$
|
|
13933
|
+
log$s.debug(`sending get request for ConfigBean: ${id}`);
|
|
13804
13934
|
const response = await getOne$6({
|
|
13805
13935
|
urlOverride: `${URL$e}${path}/details/${id}/15`,
|
|
13806
13936
|
destinationAddress
|
|
@@ -13913,7 +14043,10 @@ function matchValue(patterns, value) {
|
|
|
13913
14043
|
return void 0;
|
|
13914
14044
|
}
|
|
13915
14045
|
const CONFIG_BEAN_MODEL_TYPE = "config-bean-model";
|
|
13916
|
-
const log$
|
|
14046
|
+
const log$r = KosLog.createLogger({
|
|
14047
|
+
group: LogGroup.model,
|
|
14048
|
+
name: CONFIG_BEAN_MODEL_TYPE
|
|
14049
|
+
});
|
|
13917
14050
|
const PATH_PROP$3 = createPropKey("path");
|
|
13918
14051
|
const DESTINATION_PROP$2 = createPropKey("destinationAddress");
|
|
13919
14052
|
function configBeanModelId(path, destinationAddress) {
|
|
@@ -13986,8 +14119,8 @@ let ConfigBeanModelImpl = class {
|
|
|
13986
14119
|
* @internal
|
|
13987
14120
|
*/
|
|
13988
14121
|
async ready() {
|
|
13989
|
-
log$
|
|
13990
|
-
log$
|
|
14122
|
+
log$r.debug(`readying config bean ${this.path}`);
|
|
14123
|
+
log$r.debug(`complete readying config bean ${this.path}`);
|
|
13991
14124
|
}
|
|
13992
14125
|
/**
|
|
13993
14126
|
* @internal
|
|
@@ -13996,7 +14129,7 @@ let ConfigBeanModelImpl = class {
|
|
|
13996
14129
|
* Fetches the bean's values and schema.
|
|
13997
14130
|
*/
|
|
13998
14131
|
async load() {
|
|
13999
|
-
log$
|
|
14132
|
+
log$r.debug(`loading config bean ${this.path}`);
|
|
14000
14133
|
await this.fetchBean();
|
|
14001
14134
|
}
|
|
14002
14135
|
/**
|
|
@@ -14007,7 +14140,7 @@ let ConfigBeanModelImpl = class {
|
|
|
14007
14140
|
* KOS Core reload after a reconnect leaves the same instance current.
|
|
14008
14141
|
*/
|
|
14009
14142
|
async reload() {
|
|
14010
|
-
log$
|
|
14143
|
+
log$r.debug(`reloading config bean ${this.path}`);
|
|
14011
14144
|
await this.fetchBean();
|
|
14012
14145
|
}
|
|
14013
14146
|
async fetchBean() {
|
|
@@ -14019,7 +14152,7 @@ let ConfigBeanModelImpl = class {
|
|
|
14019
14152
|
if (response?.data) {
|
|
14020
14153
|
const data = response.data;
|
|
14021
14154
|
mapDtoToConfigBeanModel(data, this);
|
|
14022
|
-
log$
|
|
14155
|
+
log$r.debug(this.values);
|
|
14023
14156
|
const schemaResponse = response?.data.details[0].schema;
|
|
14024
14157
|
kosAction(() => {
|
|
14025
14158
|
if (schemaResponse) {
|
|
@@ -14264,7 +14397,7 @@ var __decorateClass$u = (decorators, target, key, kind) => {
|
|
|
14264
14397
|
return result;
|
|
14265
14398
|
};
|
|
14266
14399
|
const MODEL_TYPE$r = "region-info-model";
|
|
14267
|
-
const log$
|
|
14400
|
+
const log$q = KosLog.createLogger({ group: LogGroup.model, name: "region-info-model" });
|
|
14268
14401
|
function servicePathMapper(regionInfoModel) {
|
|
14269
14402
|
const hasMapper = ExtensionManager.propertyMapper.hasMapper(
|
|
14270
14403
|
KosCoreModelPropertyMapper.RegionServicePath
|
|
@@ -14577,7 +14710,7 @@ let RegionInfoModelImpl = class {
|
|
|
14577
14710
|
}
|
|
14578
14711
|
toUnit = measureSystems[to.system]?.["default"];
|
|
14579
14712
|
if (!toUnit) {
|
|
14580
|
-
log$
|
|
14713
|
+
log$q.info("Could not find default unit for measure", to.measure);
|
|
14581
14714
|
}
|
|
14582
14715
|
}
|
|
14583
14716
|
if (!fromUnit && from.measure && from.system) {
|
|
@@ -14591,11 +14724,11 @@ let RegionInfoModelImpl = class {
|
|
|
14591
14724
|
}
|
|
14592
14725
|
fromUnit = measureSystems[from.system]?.["default"];
|
|
14593
14726
|
if (!fromUnit) {
|
|
14594
|
-
log$
|
|
14727
|
+
log$q.info("Could not find default unit for measure", from.measure);
|
|
14595
14728
|
}
|
|
14596
14729
|
}
|
|
14597
14730
|
if (!fromUnit || !toUnit) {
|
|
14598
|
-
log$
|
|
14731
|
+
log$q.warn("Could not find unit to convert to or from. Return value as is");
|
|
14599
14732
|
return String(value);
|
|
14600
14733
|
}
|
|
14601
14734
|
return this.convertByUnit(value, fromUnit, toUnit);
|
|
@@ -14605,13 +14738,13 @@ let RegionInfoModelImpl = class {
|
|
|
14605
14738
|
* @internal
|
|
14606
14739
|
*/
|
|
14607
14740
|
async init() {
|
|
14608
|
-
log$
|
|
14741
|
+
log$q.debug("initializing region info");
|
|
14609
14742
|
}
|
|
14610
14743
|
/**
|
|
14611
14744
|
* @internal
|
|
14612
14745
|
*/
|
|
14613
14746
|
async load() {
|
|
14614
|
-
log$
|
|
14747
|
+
log$q.debug("loading region info");
|
|
14615
14748
|
const regions = await getRegions(
|
|
14616
14749
|
this.serviceBasePath,
|
|
14617
14750
|
this.destinationAddress
|
|
@@ -14948,7 +15081,7 @@ function secondsToFormattedTime(secondsSinceMidnight, formatString) {
|
|
|
14948
15081
|
return dateFns.format(time, formatString);
|
|
14949
15082
|
}
|
|
14950
15083
|
const MODEL_TYPE$q = "config-bean-prop-model";
|
|
14951
|
-
const log$
|
|
15084
|
+
const log$p = KosLog.createLogger({ group: LogGroup.model, name: "config-bean-prop-model" });
|
|
14952
15085
|
const PATH_PROP$2 = createPropKey("path");
|
|
14953
15086
|
const SERVICE_PATH_PROP = createPropKey("serviceBasePath");
|
|
14954
15087
|
const DESTINATION_PROP = createPropKey("destinationAddress");
|
|
@@ -15135,7 +15268,7 @@ let KosConfigPropertyImpl = class {
|
|
|
15135
15268
|
return Number(result2);
|
|
15136
15269
|
}
|
|
15137
15270
|
} catch (e) {
|
|
15138
|
-
log$
|
|
15271
|
+
log$p.info(`error formatting value ${_val}`, e);
|
|
15139
15272
|
}
|
|
15140
15273
|
const result = Number(_val).toFixed(decimals);
|
|
15141
15274
|
return result;
|
|
@@ -15167,7 +15300,7 @@ let KosConfigPropertyImpl = class {
|
|
|
15167
15300
|
* @internal
|
|
15168
15301
|
*/
|
|
15169
15302
|
async activate() {
|
|
15170
|
-
log$
|
|
15303
|
+
log$p.debug(`activating config bean ${this.id}`);
|
|
15171
15304
|
}
|
|
15172
15305
|
/**
|
|
15173
15306
|
* The value formatted with its unit for the active locale, such as `"72.5 °F"`.
|
|
@@ -15194,7 +15327,7 @@ let KosConfigPropertyImpl = class {
|
|
|
15194
15327
|
return result;
|
|
15195
15328
|
}
|
|
15196
15329
|
} catch (e) {
|
|
15197
|
-
log$
|
|
15330
|
+
log$p.error(`error formatting value ${_val}`, e);
|
|
15198
15331
|
}
|
|
15199
15332
|
}
|
|
15200
15333
|
return String(_val);
|
|
@@ -15286,13 +15419,13 @@ let KosConfigPropertyImpl = class {
|
|
|
15286
15419
|
try {
|
|
15287
15420
|
formatter = new Intl.NumberFormat(locale, { ...formatOptions });
|
|
15288
15421
|
} catch (e) {
|
|
15289
|
-
log$
|
|
15422
|
+
log$p.error(
|
|
15290
15423
|
`error creating formatter ${formatOptions}. Returning the raw value`,
|
|
15291
15424
|
e
|
|
15292
15425
|
);
|
|
15293
15426
|
}
|
|
15294
15427
|
} else {
|
|
15295
|
-
log$
|
|
15428
|
+
log$p.debug(
|
|
15296
15429
|
`no formatter found for config bean prop ${this.id}. Returning the raw value`
|
|
15297
15430
|
);
|
|
15298
15431
|
}
|
|
@@ -15353,7 +15486,7 @@ let KosConfigPropertyImpl = class {
|
|
|
15353
15486
|
* @param value - The new value in display units
|
|
15354
15487
|
*/
|
|
15355
15488
|
async updateProperty(value) {
|
|
15356
|
-
log$
|
|
15489
|
+
log$p.debug(`updating property ${this.attribute} with value ${value}`);
|
|
15357
15490
|
let _value = value;
|
|
15358
15491
|
const converter = this.getConverter();
|
|
15359
15492
|
if (converter && !isNaN(_value)) {
|
|
@@ -15397,6 +15530,10 @@ const Registration = {
|
|
|
15397
15530
|
MODEL_TYPE$q
|
|
15398
15531
|
)
|
|
15399
15532
|
};
|
|
15533
|
+
const log$o = KosLog.createLogger({
|
|
15534
|
+
group: LogGroup.model,
|
|
15535
|
+
name: "future-model-builder"
|
|
15536
|
+
});
|
|
15400
15537
|
const mapDtoToFutureOptions = (dto) => {
|
|
15401
15538
|
const options = {
|
|
15402
15539
|
id: String(dto.id),
|
|
@@ -15412,10 +15549,10 @@ const mapDtoToFutureOptions = (dto) => {
|
|
|
15412
15549
|
return options;
|
|
15413
15550
|
};
|
|
15414
15551
|
const mapDtoToFutureModel = (dto, model) => {
|
|
15415
|
-
|
|
15416
|
-
|
|
15552
|
+
log$o.debug(`future dto ${dto.id} end state ${dto.endState}`);
|
|
15553
|
+
log$o.debug(`future model ${model.id} end state ${model.endState}`);
|
|
15417
15554
|
if (!model.endState) {
|
|
15418
|
-
|
|
15555
|
+
log$o.debug(`updating future model ${model.id}`);
|
|
15419
15556
|
mobx.runInAction(() => {
|
|
15420
15557
|
const options = mapDtoToFutureOptions(dto);
|
|
15421
15558
|
kosAction(() => {
|
|
@@ -15434,7 +15571,7 @@ const mapDtoToFutureModel = (dto, model) => {
|
|
|
15434
15571
|
});
|
|
15435
15572
|
});
|
|
15436
15573
|
} else {
|
|
15437
|
-
|
|
15574
|
+
log$o.debug(`future model ${model.id} is already complete`);
|
|
15438
15575
|
}
|
|
15439
15576
|
};
|
|
15440
15577
|
const buildFutureModel$1 = (factory) => (modelId) => (futureOptions) => {
|
|
@@ -15445,7 +15582,7 @@ const buildFuture = (factory) => (future) => pipe(
|
|
|
15445
15582
|
mapDtoToFutureOptions,
|
|
15446
15583
|
buildFutureModel$1(factory)(future.tracker || future.id)
|
|
15447
15584
|
)(future);
|
|
15448
|
-
const log$
|
|
15585
|
+
const log$n = KosLog.createLogger({ group: LogGroup.service, name: "future-service" });
|
|
15449
15586
|
const { isMock, URL: URL$c } = resolveServiceUrl();
|
|
15450
15587
|
var FutureEndState = /* @__PURE__ */ ((FutureEndState2) => {
|
|
15451
15588
|
FutureEndState2["Success"] = "SUCCESS";
|
|
@@ -15464,7 +15601,7 @@ const getFutures = async () => {
|
|
|
15464
15601
|
return response;
|
|
15465
15602
|
};
|
|
15466
15603
|
const deleteFuture = async (id, path = "/api/kos/future") => {
|
|
15467
|
-
log$
|
|
15604
|
+
log$n.info(`sending delete request for Future: ${id}`);
|
|
15468
15605
|
const response = await deleteModel$1({
|
|
15469
15606
|
id,
|
|
15470
15607
|
urlOverride: `${URL$c}${path}/${id}`
|
|
@@ -15472,7 +15609,7 @@ const deleteFuture = async (id, path = "/api/kos/future") => {
|
|
|
15472
15609
|
return response;
|
|
15473
15610
|
};
|
|
15474
15611
|
const addFuture = async (future, path = "/api/kos/future") => {
|
|
15475
|
-
log$
|
|
15612
|
+
log$n.info(`sending add request for Future`);
|
|
15476
15613
|
const response = await addModel({
|
|
15477
15614
|
model: future,
|
|
15478
15615
|
urlOverride: `${URL$c}${path}`
|
|
@@ -15480,7 +15617,7 @@ const addFuture = async (future, path = "/api/kos/future") => {
|
|
|
15480
15617
|
return response;
|
|
15481
15618
|
};
|
|
15482
15619
|
const modifyFuture = async (id, model, path = "/api/kos/future") => {
|
|
15483
|
-
log$
|
|
15620
|
+
log$n.info(`sending modify request for Future: ${id}`);
|
|
15484
15621
|
const response = modifyModel({
|
|
15485
15622
|
model,
|
|
15486
15623
|
id,
|
|
@@ -15489,7 +15626,7 @@ const modifyFuture = async (id, model, path = "/api/kos/future") => {
|
|
|
15489
15626
|
return response;
|
|
15490
15627
|
};
|
|
15491
15628
|
const cancelFuture = async (id, path = "/api/kos/future") => {
|
|
15492
|
-
log$
|
|
15629
|
+
log$n.info(`sending cancel request for Future: ${id}`);
|
|
15493
15630
|
const response = postModel$4({
|
|
15494
15631
|
urlOverride: `${URL$c}${path}/${id}/cancel`,
|
|
15495
15632
|
ordered: true,
|
|
@@ -15529,6 +15666,10 @@ const FutureManager = {
|
|
|
15529
15666
|
initiateFuture,
|
|
15530
15667
|
getFuture
|
|
15531
15668
|
};
|
|
15669
|
+
const log$m = KosLog.createLogger({
|
|
15670
|
+
group: LogGroup.model,
|
|
15671
|
+
name: "future-service"
|
|
15672
|
+
});
|
|
15532
15673
|
const isFutureResponse = (response) => !response || !response.data;
|
|
15533
15674
|
const resolveFutureHandler = (model) => {
|
|
15534
15675
|
const handlerProperty = model?.[MultipleFutureContainerSetup]?.handlerProperty ?? model?.[FutureContainerSetup]?.handlerProperty ?? "futureHandler";
|
|
@@ -15543,9 +15684,7 @@ function wrapWithFutureLifecycle(original, methodName, props = {}) {
|
|
|
15543
15684
|
} = props;
|
|
15544
15685
|
return async function(...args) {
|
|
15545
15686
|
const tracker = uuid();
|
|
15546
|
-
|
|
15547
|
-
`Calling future service ${methodName} with tracker ${tracker}`
|
|
15548
|
-
);
|
|
15687
|
+
log$m.debug(`Calling future service ${methodName} with tracker ${tracker}`);
|
|
15549
15688
|
let abortControllerInstance;
|
|
15550
15689
|
let effectDisposer;
|
|
15551
15690
|
if (abortController) {
|
|
@@ -15558,17 +15697,17 @@ function wrapWithFutureLifecycle(original, methodName, props = {}) {
|
|
|
15558
15697
|
if (namespace) {
|
|
15559
15698
|
future.namespace = namespace;
|
|
15560
15699
|
}
|
|
15561
|
-
|
|
15700
|
+
log$m.debug(`waiting for future ${future.id} to be ready`);
|
|
15562
15701
|
await whenReady(future);
|
|
15563
|
-
|
|
15702
|
+
log$m.debug(`future ${future.id} is ready`);
|
|
15564
15703
|
kosAction(() => {
|
|
15565
|
-
|
|
15704
|
+
log$m.debug(`Adding future ${future.id} to futureHandler`);
|
|
15566
15705
|
resolveFutureHandler(this).addFuture(future, alias);
|
|
15567
15706
|
});
|
|
15568
15707
|
if (abortController && abortControllerInstance) {
|
|
15569
15708
|
effectDisposer = kosAutoEffect(() => {
|
|
15570
15709
|
if (future.status === "CANCELLED" || future.endState === FutureEndState.Canceled) {
|
|
15571
|
-
|
|
15710
|
+
log$m.debug(`Future ${future.id} cancelled, aborting request`);
|
|
15572
15711
|
abortControllerInstance?.abort();
|
|
15573
15712
|
}
|
|
15574
15713
|
});
|
|
@@ -15576,13 +15715,13 @@ function wrapWithFutureLifecycle(original, methodName, props = {}) {
|
|
|
15576
15715
|
"abort",
|
|
15577
15716
|
async () => {
|
|
15578
15717
|
if (future.status !== "CANCELLED" && future.endState !== FutureEndState.Canceled && !future.endState) {
|
|
15579
|
-
|
|
15718
|
+
log$m.debug(
|
|
15580
15719
|
`AbortController aborted, cancelling future ${future.id}`
|
|
15581
15720
|
);
|
|
15582
15721
|
try {
|
|
15583
15722
|
await future.cancelFuture();
|
|
15584
15723
|
} catch (error) {
|
|
15585
|
-
|
|
15724
|
+
log$m.error(`Failed to cancel future ${future.id}:`, error);
|
|
15586
15725
|
}
|
|
15587
15726
|
}
|
|
15588
15727
|
},
|
|
@@ -15623,15 +15762,15 @@ function wrapWithFutureLifecycle(original, methodName, props = {}) {
|
|
|
15623
15762
|
// eslint-disable-next-line no-invalid-this
|
|
15624
15763
|
await original.apply(this, enhancedArgs)
|
|
15625
15764
|
);
|
|
15626
|
-
|
|
15765
|
+
log$m.debug(`received future response for ${tracker}`, futureResponse);
|
|
15627
15766
|
const response = isFutureResponse(futureResponse) ? futureResponse : futureResponse?.data;
|
|
15628
15767
|
if (response) {
|
|
15629
15768
|
response.progress = 1;
|
|
15630
|
-
|
|
15769
|
+
log$m.debug(`mapping future response to future model`);
|
|
15631
15770
|
if (!future.endState) {
|
|
15632
15771
|
mapDtoToFutureModel(response, future);
|
|
15633
15772
|
} else {
|
|
15634
|
-
|
|
15773
|
+
log$m.debug(
|
|
15635
15774
|
`future ${future.id} has already completed. Not updating the model`
|
|
15636
15775
|
);
|
|
15637
15776
|
}
|
|
@@ -15644,10 +15783,10 @@ function wrapWithFutureLifecycle(original, methodName, props = {}) {
|
|
|
15644
15783
|
cleanup();
|
|
15645
15784
|
if (abortController && abortControllerInstance?.signal.aborted) {
|
|
15646
15785
|
const cancelledError = new Error("Operation cancelled");
|
|
15647
|
-
|
|
15786
|
+
log$m.debug(`Operation ${methodName} was cancelled`);
|
|
15648
15787
|
throw cancelledError;
|
|
15649
15788
|
}
|
|
15650
|
-
|
|
15789
|
+
log$m.error(e);
|
|
15651
15790
|
throw e;
|
|
15652
15791
|
}
|
|
15653
15792
|
};
|
|
@@ -15676,12 +15815,9 @@ const { URL: URL$b } = resolveServiceUrl();
|
|
|
15676
15815
|
const { getOne: getOne$4 } = ServiceFactory.build({
|
|
15677
15816
|
basePath: `${URL$b}/api/kos/state`
|
|
15678
15817
|
});
|
|
15679
|
-
const log$
|
|
15680
|
-
name: "state-bean-service",
|
|
15681
|
-
group: "Services"
|
|
15682
|
-
});
|
|
15818
|
+
const log$l = KosLog.createLogger({ group: LogGroup.service, name: "state-bean-service" });
|
|
15683
15819
|
const getStateBeanData = async ({ path }) => {
|
|
15684
|
-
log$
|
|
15820
|
+
log$l.debug("sending GET for state-bean");
|
|
15685
15821
|
const response = await getOne$4({
|
|
15686
15822
|
urlOverride: `${URL$b}/api/kos/state/${path}`
|
|
15687
15823
|
});
|
|
@@ -15859,12 +15995,9 @@ const { URL: URL$a } = resolveServiceUrl();
|
|
|
15859
15995
|
const { getAll: getAll$5 } = ServiceFactory.build({
|
|
15860
15996
|
basePath: `${URL$a}/api/state-prop`
|
|
15861
15997
|
});
|
|
15862
|
-
const log$
|
|
15863
|
-
name: "state-prop-service",
|
|
15864
|
-
group: "Services"
|
|
15865
|
-
});
|
|
15998
|
+
const log$k = KosLog.createLogger({ group: LogGroup.service, name: "state-prop-service" });
|
|
15866
15999
|
const getStateProps = async () => {
|
|
15867
|
-
log$
|
|
16000
|
+
log$k.debug("sending GET for state-prop");
|
|
15868
16001
|
const response = await getAll$5({});
|
|
15869
16002
|
return response;
|
|
15870
16003
|
};
|
|
@@ -16006,7 +16139,7 @@ var __decorateClass$p = (decorators, target, key, kind) => {
|
|
|
16006
16139
|
if (kind && result) __defProp$l(target, key, result);
|
|
16007
16140
|
return result;
|
|
16008
16141
|
};
|
|
16009
|
-
const log$
|
|
16142
|
+
const log$j = KosLog.createLogger({ group: LogGroup.model, name: FutureFactory.type });
|
|
16010
16143
|
let FutureModel$1 = class FutureModel {
|
|
16011
16144
|
logger;
|
|
16012
16145
|
_cancelFuture;
|
|
@@ -16030,7 +16163,7 @@ let FutureModel$1 = class FutureModel {
|
|
|
16030
16163
|
kosWhen(
|
|
16031
16164
|
() => this.status === FutureEndState.Success || this.status === FutureEndState.Fail,
|
|
16032
16165
|
() => {
|
|
16033
|
-
log$
|
|
16166
|
+
log$j.info(`Future ${this.id} has completed with status ${this.status}`);
|
|
16034
16167
|
destroyKosModel(this);
|
|
16035
16168
|
}
|
|
16036
16169
|
);
|
|
@@ -16044,13 +16177,13 @@ let FutureModel$1 = class FutureModel {
|
|
|
16044
16177
|
* In future additional information about the workspace could be loaded
|
|
16045
16178
|
*/
|
|
16046
16179
|
async load() {
|
|
16047
|
-
log$
|
|
16180
|
+
log$j.debug(`loading Future ${this.id}`);
|
|
16048
16181
|
}
|
|
16049
16182
|
/**
|
|
16050
16183
|
* @internal
|
|
16051
16184
|
*/
|
|
16052
16185
|
unload() {
|
|
16053
|
-
log$
|
|
16186
|
+
log$j.info(`unloading Future ${this.id}`);
|
|
16054
16187
|
}
|
|
16055
16188
|
// -------------------ACTIONS----------------------------
|
|
16056
16189
|
/**
|
|
@@ -16069,7 +16202,7 @@ let FutureModel$1 = class FutureModel {
|
|
|
16069
16202
|
await kosWhen(() => this.futureId !== FUTURE_NOT_ASSIGNED);
|
|
16070
16203
|
const response = await this._cancelFuture(this.futureId, path);
|
|
16071
16204
|
if (response?.status !== 200) {
|
|
16072
|
-
log$
|
|
16205
|
+
log$j.error(
|
|
16073
16206
|
`Failed to cancel Future ${this.id}. Response: ${JSON.stringify(
|
|
16074
16207
|
response
|
|
16075
16208
|
)}`
|
|
@@ -16138,7 +16271,7 @@ var __decorateClass$o = (decorators, target, key, kind) => {
|
|
|
16138
16271
|
if (kind && result) __defProp$k(target, key, result);
|
|
16139
16272
|
return result;
|
|
16140
16273
|
};
|
|
16141
|
-
const log$
|
|
16274
|
+
const log$i = KosLog.createLogger({ group: LogGroup.model, name: FutureContainerFactory.type });
|
|
16142
16275
|
let FutureContainerModel$1 = class FutureContainerModel {
|
|
16143
16276
|
id;
|
|
16144
16277
|
logger;
|
|
@@ -16253,8 +16386,8 @@ let FutureContainerModel$1 = class FutureContainerModel {
|
|
|
16253
16386
|
try {
|
|
16254
16387
|
await this._deleteFuture(id);
|
|
16255
16388
|
} catch (e) {
|
|
16256
|
-
log$
|
|
16257
|
-
log$
|
|
16389
|
+
log$i.error(`error deleting a Future`);
|
|
16390
|
+
log$i.error(e);
|
|
16258
16391
|
}
|
|
16259
16392
|
}
|
|
16260
16393
|
/**
|
|
@@ -16281,8 +16414,8 @@ let FutureContainerModel$1 = class FutureContainerModel {
|
|
|
16281
16414
|
return model2;
|
|
16282
16415
|
}
|
|
16283
16416
|
} catch (e) {
|
|
16284
|
-
log$
|
|
16285
|
-
log$
|
|
16417
|
+
log$i.error(`error creating a Future`);
|
|
16418
|
+
log$i.error(e);
|
|
16286
16419
|
throw e;
|
|
16287
16420
|
}
|
|
16288
16421
|
return void 0;
|
|
@@ -16311,10 +16444,7 @@ const { URL: URL$9 } = resolveServiceUrl();
|
|
|
16311
16444
|
const { getOne: getOne$3, postModel: postModel$3, deleteModel } = ServiceFactory.build({
|
|
16312
16445
|
basePath: `${URL$9}/api/keyVal`
|
|
16313
16446
|
});
|
|
16314
|
-
const log$
|
|
16315
|
-
name: "key-value-service",
|
|
16316
|
-
group: "Services"
|
|
16317
|
-
});
|
|
16447
|
+
const log$h = KosLog.createLogger({ group: LogGroup.service, name: "key-value-service" });
|
|
16318
16448
|
const deleteKeyValue = async (namespace, key) => {
|
|
16319
16449
|
await deleteModel({
|
|
16320
16450
|
urlOverride: `${URL$9}/api/keyVal/${namespace}/${key}`,
|
|
@@ -16327,7 +16457,7 @@ const updateKeyValue = async (namespace, key, value) => {
|
|
|
16327
16457
|
model: value.toString()
|
|
16328
16458
|
});
|
|
16329
16459
|
if (response?.status !== 200) {
|
|
16330
|
-
log$
|
|
16460
|
+
log$h.error("Failed to update key-value data", response);
|
|
16331
16461
|
throw new Error(
|
|
16332
16462
|
`Failed to update key-value data for namespace ${namespace}`
|
|
16333
16463
|
);
|
|
@@ -16335,12 +16465,12 @@ const updateKeyValue = async (namespace, key, value) => {
|
|
|
16335
16465
|
return response.data;
|
|
16336
16466
|
};
|
|
16337
16467
|
const getKeyValue = async (namespace = "studio") => {
|
|
16338
|
-
log$
|
|
16468
|
+
log$h.debug(`Retrieving all key-value data for namespace: ${namespace}`);
|
|
16339
16469
|
const response = await getOne$3({
|
|
16340
16470
|
urlOverride: `${URL$9}/api/keyVal/${namespace}`
|
|
16341
16471
|
});
|
|
16342
16472
|
if (response?.status !== 200) {
|
|
16343
|
-
log$
|
|
16473
|
+
log$h.error("Failed to retrieve key-value data", response);
|
|
16344
16474
|
throw new Error(
|
|
16345
16475
|
`Failed to retrieve key-value data for namespace ${namespace}`
|
|
16346
16476
|
);
|
|
@@ -18416,39 +18546,40 @@ KosExpressionEvaluatorModelImpl = __decorateClass$m([
|
|
|
18416
18546
|
kosModel({ modelTypeId: MODEL_TYPE$l, singleton: false })
|
|
18417
18547
|
], KosExpressionEvaluatorModelImpl);
|
|
18418
18548
|
const KosExpressionEvaluator = KosExpressionEvaluatorModelImpl.Registration;
|
|
18549
|
+
const log$g = KosLog.createLogger({
|
|
18550
|
+
group: LogGroup.transport,
|
|
18551
|
+
name: "get-kos-connection-id"
|
|
18552
|
+
});
|
|
18419
18553
|
const getKosConnectionId = () => {
|
|
18420
18554
|
const params2 = getQueryParams();
|
|
18421
18555
|
const connId = params2?.connId;
|
|
18422
18556
|
const result = connId || window?.kosBridge?.("connId");
|
|
18423
|
-
|
|
18557
|
+
log$g.debug(`getKosConnectionId: ${result}`);
|
|
18424
18558
|
return result;
|
|
18425
18559
|
};
|
|
18426
|
-
const log$
|
|
18427
|
-
name: "kos-log-manager-service",
|
|
18428
|
-
group: "Services"
|
|
18429
|
-
});
|
|
18560
|
+
const log$f = KosLog.createLogger({ group: LogGroup.service, name: "kos-log-manager-service" });
|
|
18430
18561
|
const SERVICE_PATH$1 = "/api/kos/logs/overrides";
|
|
18431
18562
|
const GROUPS_PATH = "/api/kos/logs/groups";
|
|
18432
18563
|
const getLogOverrides = async () => {
|
|
18433
|
-
log$
|
|
18564
|
+
log$f.debug("sending GET for kos-log-manager");
|
|
18434
18565
|
return await api$1.get(SERVICE_PATH$1, void 0, {
|
|
18435
18566
|
destinationAddress: getKosConnectionId()
|
|
18436
18567
|
});
|
|
18437
18568
|
};
|
|
18438
18569
|
const getLogGroups = async () => {
|
|
18439
|
-
log$
|
|
18570
|
+
log$f.debug("sending GET for log groups");
|
|
18440
18571
|
return await api$1.get(GROUPS_PATH, void 0, {
|
|
18441
18572
|
destinationAddress: getKosConnectionId()
|
|
18442
18573
|
});
|
|
18443
18574
|
};
|
|
18444
18575
|
const addLogOverride = async (override) => {
|
|
18445
|
-
log$
|
|
18576
|
+
log$f.debug(`sending POST for log override ${override.name}`);
|
|
18446
18577
|
return await api$1.post(SERVICE_PATH$1, void 0, override, {
|
|
18447
18578
|
destinationAddress: getKosConnectionId()
|
|
18448
18579
|
});
|
|
18449
18580
|
};
|
|
18450
18581
|
const removeLogOverride = async (override) => {
|
|
18451
|
-
log$
|
|
18582
|
+
log$f.debug(`sending DELETE for log override ${override.name}`);
|
|
18452
18583
|
return await api$1.delete(SERVICE_PATH$1, void 0, override, {
|
|
18453
18584
|
destinationAddress: getKosConnectionId()
|
|
18454
18585
|
});
|
|
@@ -18926,14 +19057,11 @@ __decorateClass$j([
|
|
|
18926
19057
|
LogBlockContainerModelImpl = __decorateClass$j([
|
|
18927
19058
|
kosModel(MODEL_TYPE$i)
|
|
18928
19059
|
], LogBlockContainerModelImpl);
|
|
18929
|
-
const log$
|
|
18930
|
-
name: "log-stream-container-service",
|
|
18931
|
-
group: "Services"
|
|
18932
|
-
});
|
|
19060
|
+
const log$e = KosLog.createLogger({ group: LogGroup.service, name: "log-stream-container-service" });
|
|
18933
19061
|
const SERVICE_PATH = "/api/kos/logs/node/{nodeId}/streams";
|
|
18934
19062
|
const getLogStreams = async () => {
|
|
18935
19063
|
const destinationAddress = getKosConnectionId();
|
|
18936
|
-
log$
|
|
19064
|
+
log$e.debug("sending GET for log-stream-container");
|
|
18937
19065
|
return await api$1.get(
|
|
18938
19066
|
SERVICE_PATH,
|
|
18939
19067
|
{
|
|
@@ -19505,11 +19633,11 @@ const { URL: URL$7 } = resolveServiceUrl();
|
|
|
19505
19633
|
const { getAll: getAll$4, postModel: postModel$1 } = ServiceFactory.build({
|
|
19506
19634
|
basePath: `${URL$7}/api/kos/troubles`
|
|
19507
19635
|
});
|
|
19508
|
-
const log$
|
|
19636
|
+
const log$d = KosLog.createLogger({ group: LogGroup.service, name: "trouble-services" });
|
|
19509
19637
|
const getTroubles = async (servicePath) => {
|
|
19510
19638
|
const isKosTroubles = servicePath.includes("/kos/troubles");
|
|
19511
19639
|
const destinationAddress = getKosConnectionId();
|
|
19512
|
-
log$
|
|
19640
|
+
log$d.info(
|
|
19513
19641
|
`Fetching troubles from ${servicePath} with destination address: ${isKosTroubles ? destinationAddress : "N/A (not a kos troubles path)"}`
|
|
19514
19642
|
);
|
|
19515
19643
|
const response = await getAll$4({
|
|
@@ -19591,6 +19719,10 @@ const defaultTroubleRoleMapper = (trouble) => {
|
|
|
19591
19719
|
}
|
|
19592
19720
|
return "TECHNICIAN";
|
|
19593
19721
|
};
|
|
19722
|
+
const log$c = KosLog.createLogger({
|
|
19723
|
+
group: LogGroup.model,
|
|
19724
|
+
name: "trouble-data-extension"
|
|
19725
|
+
});
|
|
19594
19726
|
const EXTENSION_TROUBLE_DATA_MAPPER = "troubleDataMapper";
|
|
19595
19727
|
const troubleMappers$1 = /* @__PURE__ */ new Map();
|
|
19596
19728
|
registerExtensionPoint(EXTENSION_TROUBLE_DATA_MAPPER, {
|
|
@@ -19614,7 +19746,7 @@ registerExtensionPoint(EXTENSION_TROUBLE_DATA_MAPPER, {
|
|
|
19614
19746
|
if (r.status === "fulfilled") {
|
|
19615
19747
|
acc = { ...acc, ...r.value };
|
|
19616
19748
|
} else {
|
|
19617
|
-
|
|
19749
|
+
log$c.info(`Trouble mapper ${id} failed: ${r.reason}`);
|
|
19618
19750
|
}
|
|
19619
19751
|
return acc;
|
|
19620
19752
|
},
|
|
@@ -19623,6 +19755,10 @@ registerExtensionPoint(EXTENSION_TROUBLE_DATA_MAPPER, {
|
|
|
19623
19755
|
return data;
|
|
19624
19756
|
}
|
|
19625
19757
|
});
|
|
19758
|
+
const log$b = KosLog.createLogger({
|
|
19759
|
+
group: LogGroup.model,
|
|
19760
|
+
name: "trouble-extension"
|
|
19761
|
+
});
|
|
19626
19762
|
const EXTENSION_TROUBLE_MAPPER = "troubleMapper";
|
|
19627
19763
|
const troubleMappers = /* @__PURE__ */ new Map();
|
|
19628
19764
|
registerExtensionPoint(EXTENSION_TROUBLE_MAPPER, {
|
|
@@ -19643,7 +19779,7 @@ registerExtensionPoint(EXTENSION_TROUBLE_MAPPER, {
|
|
|
19643
19779
|
if (r.status === "fulfilled") {
|
|
19644
19780
|
return r.value;
|
|
19645
19781
|
} else {
|
|
19646
|
-
|
|
19782
|
+
log$b.info(`Trouble mapper ${id} failed: ${r.reason}`);
|
|
19647
19783
|
return [];
|
|
19648
19784
|
}
|
|
19649
19785
|
}).flat();
|
|
@@ -20032,16 +20168,13 @@ const { URL: URL$6 } = resolveServiceUrl();
|
|
|
20032
20168
|
const { getAll: getAll$3 } = ServiceFactory.build({
|
|
20033
20169
|
basePath: `${URL$6}/api/kos/ota`
|
|
20034
20170
|
});
|
|
20035
|
-
const log$
|
|
20036
|
-
name: "ota-service",
|
|
20037
|
-
group: "Services"
|
|
20038
|
-
});
|
|
20171
|
+
const log$a = KosLog.createLogger({ group: LogGroup.service, name: "ota-service" });
|
|
20039
20172
|
const getArtifacts = async () => {
|
|
20040
|
-
log$
|
|
20173
|
+
log$a.debug("sending GET request to /api/kos/ota/artifacts");
|
|
20041
20174
|
const response = await getAll$3({
|
|
20042
20175
|
urlOverride: `${URL$6}/api/kos/ota/artifacts`
|
|
20043
20176
|
});
|
|
20044
|
-
log$
|
|
20177
|
+
log$a.debug("getArtifacts - response:", response);
|
|
20045
20178
|
return response?.data;
|
|
20046
20179
|
};
|
|
20047
20180
|
var __defProp$a = Object.defineProperty;
|
|
@@ -20225,7 +20358,10 @@ const Ota = new SingletonKosModelRegistrationFactory({
|
|
|
20225
20358
|
class: OtaModelImpl,
|
|
20226
20359
|
type: MODEL_TYPE$c
|
|
20227
20360
|
});
|
|
20228
|
-
const log$
|
|
20361
|
+
const log$9 = KosLog.createLogger({
|
|
20362
|
+
group: LogGroup.model,
|
|
20363
|
+
name: "await-future-call"
|
|
20364
|
+
});
|
|
20229
20365
|
class FutureCallError extends Error {
|
|
20230
20366
|
endState;
|
|
20231
20367
|
reason;
|
|
@@ -20276,7 +20412,7 @@ function awaitFutureCall(model, methodCall, options = {}) {
|
|
|
20276
20412
|
const watchTracked = (future) => {
|
|
20277
20413
|
tracked = future;
|
|
20278
20414
|
if (cancelRequested) {
|
|
20279
|
-
future.cancelFuture().catch((e) => log$
|
|
20415
|
+
future.cancelFuture().catch((e) => log$9.error(e));
|
|
20280
20416
|
}
|
|
20281
20417
|
disposers.push(
|
|
20282
20418
|
mobx.reaction(
|
|
@@ -20293,7 +20429,7 @@ function awaitFutureCall(model, methodCall, options = {}) {
|
|
|
20293
20429
|
try {
|
|
20294
20430
|
cb(progress, status);
|
|
20295
20431
|
} catch (e) {
|
|
20296
|
-
log$
|
|
20432
|
+
log$9.warn("progress callback error", e);
|
|
20297
20433
|
}
|
|
20298
20434
|
});
|
|
20299
20435
|
},
|
|
@@ -20369,6 +20505,189 @@ function awaitFutureCall(model, methodCall, options = {}) {
|
|
|
20369
20505
|
};
|
|
20370
20506
|
return promise;
|
|
20371
20507
|
}
|
|
20508
|
+
function createCancellablePromise(promiseOrOptions, abortController, cancelFuture2, future) {
|
|
20509
|
+
const options = promiseOrOptions instanceof Promise ? { promise: promiseOrOptions, abortController, cancelFuture: cancelFuture2, future } : promiseOrOptions;
|
|
20510
|
+
const {
|
|
20511
|
+
promise,
|
|
20512
|
+
abortController: controller,
|
|
20513
|
+
cancelFuture: cancelFn,
|
|
20514
|
+
future: futureRef
|
|
20515
|
+
} = options;
|
|
20516
|
+
const cancellablePromise = promise;
|
|
20517
|
+
let currentProgress = 0;
|
|
20518
|
+
let currentStatus = "PENDING";
|
|
20519
|
+
let isRunning = true;
|
|
20520
|
+
const progressCallbacks = /* @__PURE__ */ new Set();
|
|
20521
|
+
let effectDisposer;
|
|
20522
|
+
if (futureRef && typeof futureRef === "object") {
|
|
20523
|
+
effectDisposer = mobx.autorun(() => {
|
|
20524
|
+
const newProgress = futureRef.progress || 0;
|
|
20525
|
+
const newStatus = futureRef.status || "PENDING";
|
|
20526
|
+
const newIsRunning = !futureRef.endState;
|
|
20527
|
+
if (newProgress !== currentProgress || newStatus !== currentStatus || newIsRunning !== isRunning) {
|
|
20528
|
+
currentProgress = newProgress;
|
|
20529
|
+
currentStatus = newStatus;
|
|
20530
|
+
isRunning = newIsRunning;
|
|
20531
|
+
progressCallbacks.forEach((callback) => {
|
|
20532
|
+
try {
|
|
20533
|
+
callback(currentProgress, currentStatus);
|
|
20534
|
+
} catch (error) {
|
|
20535
|
+
console.warn("Progress callback error:", error);
|
|
20536
|
+
}
|
|
20537
|
+
});
|
|
20538
|
+
}
|
|
20539
|
+
});
|
|
20540
|
+
}
|
|
20541
|
+
promise.finally(() => {
|
|
20542
|
+
isRunning = false;
|
|
20543
|
+
if (!controller?.signal.aborted) {
|
|
20544
|
+
currentStatus = "COMPLETED";
|
|
20545
|
+
progressCallbacks.forEach((callback) => {
|
|
20546
|
+
try {
|
|
20547
|
+
callback(currentProgress, currentStatus);
|
|
20548
|
+
} catch (error) {
|
|
20549
|
+
console.warn("Progress callback error:", error);
|
|
20550
|
+
}
|
|
20551
|
+
});
|
|
20552
|
+
}
|
|
20553
|
+
if (effectDisposer) {
|
|
20554
|
+
effectDisposer();
|
|
20555
|
+
}
|
|
20556
|
+
progressCallbacks.clear();
|
|
20557
|
+
});
|
|
20558
|
+
cancellablePromise.cancel = async () => {
|
|
20559
|
+
if (controller && !controller.signal.aborted) {
|
|
20560
|
+
controller.abort();
|
|
20561
|
+
}
|
|
20562
|
+
if (cancelFn) {
|
|
20563
|
+
await cancelFn();
|
|
20564
|
+
}
|
|
20565
|
+
isRunning = false;
|
|
20566
|
+
currentStatus = "CANCELLED";
|
|
20567
|
+
progressCallbacks.forEach((callback) => {
|
|
20568
|
+
try {
|
|
20569
|
+
callback(currentProgress, currentStatus);
|
|
20570
|
+
} catch (error) {
|
|
20571
|
+
console.warn("Progress callback error:", error);
|
|
20572
|
+
}
|
|
20573
|
+
});
|
|
20574
|
+
if (effectDisposer) {
|
|
20575
|
+
effectDisposer();
|
|
20576
|
+
}
|
|
20577
|
+
};
|
|
20578
|
+
cancellablePromise.getController = () => controller;
|
|
20579
|
+
cancellablePromise.isCancelled = () => controller?.signal.aborted ?? false;
|
|
20580
|
+
Object.defineProperty(cancellablePromise, "progress", {
|
|
20581
|
+
get: () => currentProgress,
|
|
20582
|
+
enumerable: true
|
|
20583
|
+
});
|
|
20584
|
+
Object.defineProperty(cancellablePromise, "status", {
|
|
20585
|
+
get: () => currentStatus,
|
|
20586
|
+
enumerable: true
|
|
20587
|
+
});
|
|
20588
|
+
Object.defineProperty(cancellablePromise, "isRunning", {
|
|
20589
|
+
get: () => isRunning,
|
|
20590
|
+
enumerable: true
|
|
20591
|
+
});
|
|
20592
|
+
cancellablePromise.onProgressUpdate = (callback) => {
|
|
20593
|
+
progressCallbacks.add(callback);
|
|
20594
|
+
callback(currentProgress, currentStatus);
|
|
20595
|
+
return () => progressCallbacks.delete(callback);
|
|
20596
|
+
};
|
|
20597
|
+
return cancellablePromise;
|
|
20598
|
+
}
|
|
20599
|
+
const log$8 = KosLog.createLogger({
|
|
20600
|
+
group: LogGroup.model,
|
|
20601
|
+
name: "cancellable-future-call"
|
|
20602
|
+
});
|
|
20603
|
+
function makeCancellable(model, methodCall) {
|
|
20604
|
+
const initialFuture = model.futureHandler.future;
|
|
20605
|
+
const promise = methodCall(model);
|
|
20606
|
+
let newFuture = null;
|
|
20607
|
+
setTimeout(() => {
|
|
20608
|
+
newFuture = model.futureHandler.future;
|
|
20609
|
+
if (newFuture === initialFuture) {
|
|
20610
|
+
newFuture = null;
|
|
20611
|
+
}
|
|
20612
|
+
}, 0);
|
|
20613
|
+
return createCancellablePromise({
|
|
20614
|
+
promise,
|
|
20615
|
+
abortController: void 0,
|
|
20616
|
+
// No direct AbortController access
|
|
20617
|
+
cancelFuture: async () => {
|
|
20618
|
+
if (newFuture) {
|
|
20619
|
+
await newFuture.cancelFuture();
|
|
20620
|
+
} else {
|
|
20621
|
+
const currentFuture = model.futureHandler.future;
|
|
20622
|
+
if (currentFuture) {
|
|
20623
|
+
await currentFuture.cancelFuture();
|
|
20624
|
+
}
|
|
20625
|
+
}
|
|
20626
|
+
},
|
|
20627
|
+
future: newFuture
|
|
20628
|
+
// Pass the future for progress tracking
|
|
20629
|
+
});
|
|
20630
|
+
}
|
|
20631
|
+
function withCancellation(model, methodName, ...args) {
|
|
20632
|
+
const method = model[methodName];
|
|
20633
|
+
if (typeof method !== "function") {
|
|
20634
|
+
throw new Error(`${String(methodName)} is not a method`);
|
|
20635
|
+
}
|
|
20636
|
+
const initialFuture = model.futureHandler.future;
|
|
20637
|
+
const promise = method.apply(model, args);
|
|
20638
|
+
let targetFuture = null;
|
|
20639
|
+
setTimeout(() => {
|
|
20640
|
+
const currentFuture = model.futureHandler.future;
|
|
20641
|
+
if (currentFuture && currentFuture !== initialFuture) {
|
|
20642
|
+
targetFuture = currentFuture;
|
|
20643
|
+
}
|
|
20644
|
+
}, 0);
|
|
20645
|
+
return createCancellablePromise({
|
|
20646
|
+
promise,
|
|
20647
|
+
abortController: void 0,
|
|
20648
|
+
cancelFuture: async () => {
|
|
20649
|
+
if (targetFuture) {
|
|
20650
|
+
await targetFuture.cancelFuture();
|
|
20651
|
+
} else {
|
|
20652
|
+
const fallbackFuture = model.futureHandler.future;
|
|
20653
|
+
if (fallbackFuture) {
|
|
20654
|
+
await fallbackFuture.cancelFuture();
|
|
20655
|
+
}
|
|
20656
|
+
}
|
|
20657
|
+
},
|
|
20658
|
+
future: targetFuture
|
|
20659
|
+
// Pass the future for progress tracking
|
|
20660
|
+
});
|
|
20661
|
+
}
|
|
20662
|
+
class CancellationBatch {
|
|
20663
|
+
operations = [];
|
|
20664
|
+
add(model, methodCall) {
|
|
20665
|
+
const cancellable = makeCancellable(model, methodCall);
|
|
20666
|
+
this.operations.push(cancellable);
|
|
20667
|
+
return cancellable;
|
|
20668
|
+
}
|
|
20669
|
+
async cancelAll() {
|
|
20670
|
+
await Promise.all(
|
|
20671
|
+
this.operations.map(
|
|
20672
|
+
(op) => op.cancel().catch(() => {
|
|
20673
|
+
log$8.warn("Cancellation failed for operation:", op);
|
|
20674
|
+
})
|
|
20675
|
+
)
|
|
20676
|
+
);
|
|
20677
|
+
}
|
|
20678
|
+
getAllControllers() {
|
|
20679
|
+
return this.operations.map((op) => op.getController());
|
|
20680
|
+
}
|
|
20681
|
+
getActiveCount() {
|
|
20682
|
+
return this.operations.filter((op) => !op.isCancelled()).length;
|
|
20683
|
+
}
|
|
20684
|
+
clear() {
|
|
20685
|
+
this.operations = [];
|
|
20686
|
+
}
|
|
20687
|
+
}
|
|
20688
|
+
function createCancellationBatch() {
|
|
20689
|
+
return new CancellationBatch();
|
|
20690
|
+
}
|
|
20372
20691
|
function createCancellableService(serviceFunction) {
|
|
20373
20692
|
let controller;
|
|
20374
20693
|
const wrappedFunction = async (...args) => {
|
|
@@ -22725,9 +23044,9 @@ const { URL: URL$5 } = resolveServiceUrl();
|
|
|
22725
23044
|
const { getOne: getOne$1 } = ServiceFactory.build({
|
|
22726
23045
|
basePath: `${URL$5}/api/device`
|
|
22727
23046
|
});
|
|
22728
|
-
const log$
|
|
23047
|
+
const log$7 = KosLog.createLogger({ group: LogGroup.service, name: "device-service" });
|
|
22729
23048
|
const getSerialNumber = async () => {
|
|
22730
|
-
log$
|
|
23049
|
+
log$7.debug("sending GET for device serial number");
|
|
22731
23050
|
try {
|
|
22732
23051
|
const response = await getOne$1({
|
|
22733
23052
|
urlOverride: `${URL$5}/api/kos/device/serialNumber`
|
|
@@ -22735,14 +23054,14 @@ const getSerialNumber = async () => {
|
|
|
22735
23054
|
return [void 0, response?.data.serialNumber];
|
|
22736
23055
|
} catch (error) {
|
|
22737
23056
|
if (error instanceof FetchError) {
|
|
22738
|
-
log$
|
|
23057
|
+
log$7.error(`Error fetching device serial number: ${error.payload.error}`);
|
|
22739
23058
|
return [error.payload.error, void 0];
|
|
22740
23059
|
}
|
|
22741
23060
|
}
|
|
22742
23061
|
return ["unknownError", void 0];
|
|
22743
23062
|
};
|
|
22744
23063
|
const getDeviceDetails = async () => {
|
|
22745
|
-
log$
|
|
23064
|
+
log$7.debug("sending GET for device details");
|
|
22746
23065
|
try {
|
|
22747
23066
|
const response = await getOne$1({
|
|
22748
23067
|
urlOverride: `${URL$5}/api/kos/device`
|
|
@@ -22753,7 +23072,7 @@ const getDeviceDetails = async () => {
|
|
|
22753
23072
|
return [void 0, response.data];
|
|
22754
23073
|
} catch (error) {
|
|
22755
23074
|
if (error instanceof FetchError) {
|
|
22756
|
-
log$
|
|
23075
|
+
log$7.error(`Error fetching device serial number: ${error.payload.error}`);
|
|
22757
23076
|
return [error.payload.error, void 0];
|
|
22758
23077
|
}
|
|
22759
23078
|
}
|
|
@@ -22964,13 +23283,10 @@ const { URL: URL$4 } = resolveServiceUrl();
|
|
|
22964
23283
|
const { getAll: getAll$2 } = ServiceFactory.build({
|
|
22965
23284
|
basePath: `${URL$4}/api/kos/network/interfaces`
|
|
22966
23285
|
});
|
|
22967
|
-
const log$
|
|
22968
|
-
name: "network-interface-service",
|
|
22969
|
-
group: "Services"
|
|
22970
|
-
});
|
|
23286
|
+
const log$6 = KosLog.createLogger({ group: LogGroup.service, name: "network-interface-service" });
|
|
22971
23287
|
const getNetworkInterfaces = async () => {
|
|
22972
23288
|
const destinationAddress = getKosConnectionId();
|
|
22973
|
-
log$
|
|
23289
|
+
log$6.debug("sending GET for copy-logs");
|
|
22974
23290
|
try {
|
|
22975
23291
|
const response = await getAll$2({
|
|
22976
23292
|
destinationAddress
|
|
@@ -22978,7 +23294,7 @@ const getNetworkInterfaces = async () => {
|
|
|
22978
23294
|
return [void 0, response?.data];
|
|
22979
23295
|
} catch (error) {
|
|
22980
23296
|
if (error instanceof FetchError) {
|
|
22981
|
-
log$
|
|
23297
|
+
log$6.error(`Error fetching log file size: ${error.payload.error}`);
|
|
22982
23298
|
return [error.payload.error, void 0];
|
|
22983
23299
|
}
|
|
22984
23300
|
}
|
|
@@ -23076,15 +23392,12 @@ const { URL: URL$3 } = resolveServiceUrl();
|
|
|
23076
23392
|
const { getAll: getAll$1 } = ServiceFactory.build({
|
|
23077
23393
|
basePath: `${URL$3}/api/kos/storage/devices`
|
|
23078
23394
|
});
|
|
23079
|
-
const log$
|
|
23080
|
-
name: "storage-device-service",
|
|
23081
|
-
group: "Services"
|
|
23082
|
-
});
|
|
23395
|
+
const log$5 = KosLog.createLogger({ group: LogGroup.service, name: "storage-device-service" });
|
|
23083
23396
|
const getStorageDevices = async () => {
|
|
23084
|
-
log$
|
|
23397
|
+
log$5.debug("sending GET for storage-device");
|
|
23085
23398
|
const response = await getAll$1({});
|
|
23086
23399
|
if (!response?.data || response.status !== 200) {
|
|
23087
|
-
log$
|
|
23400
|
+
log$5.error("Failed to retrieve storage-device data", response);
|
|
23088
23401
|
return [];
|
|
23089
23402
|
}
|
|
23090
23403
|
return response.data;
|
|
@@ -23282,17 +23595,14 @@ const { URL: URL$2 } = resolveServiceUrl();
|
|
|
23282
23595
|
const { getAll, postModel } = ServiceFactory.build({
|
|
23283
23596
|
basePath: `${URL$2}/api/kos/update/available`
|
|
23284
23597
|
});
|
|
23285
|
-
const log$
|
|
23286
|
-
name: "usb-update-service",
|
|
23287
|
-
group: "Services"
|
|
23288
|
-
});
|
|
23598
|
+
const log$4 = KosLog.createLogger({ group: LogGroup.service, name: "usb-update-service" });
|
|
23289
23599
|
const getAvailableUpdates = async () => {
|
|
23290
|
-
log$
|
|
23600
|
+
log$4.debug("sending GET for usb-update");
|
|
23291
23601
|
const response = await getAll({
|
|
23292
23602
|
urlOverride: `${URL$2}/api/kos/update/available`
|
|
23293
23603
|
});
|
|
23294
23604
|
if (!response?.data || response?.status !== 200) {
|
|
23295
|
-
log$
|
|
23605
|
+
log$4.error("Failed to retrieve usb-update data", response);
|
|
23296
23606
|
return [];
|
|
23297
23607
|
}
|
|
23298
23608
|
return response.data;
|
|
@@ -23533,10 +23843,7 @@ const { URL: URL$1 } = resolveServiceUrl();
|
|
|
23533
23843
|
const { getOne } = ServiceFactory.build({
|
|
23534
23844
|
basePath: `${URL$1}/api/translation`
|
|
23535
23845
|
});
|
|
23536
|
-
const log$
|
|
23537
|
-
name: "translation-service",
|
|
23538
|
-
group: "Services"
|
|
23539
|
-
});
|
|
23846
|
+
const log$3 = KosLog.createLogger({ group: LogGroup.service, name: "translation-service" });
|
|
23540
23847
|
const getDefaultHost = () => {
|
|
23541
23848
|
const defaultHost = window.location.origin;
|
|
23542
23849
|
const params2 = getQueryParams();
|
|
@@ -23545,23 +23852,23 @@ const getDefaultHost = () => {
|
|
|
23545
23852
|
return result;
|
|
23546
23853
|
};
|
|
23547
23854
|
const getTranslations = async (url, root) => {
|
|
23548
|
-
log$
|
|
23855
|
+
log$3.debug(`Loading translations from: ${url}`);
|
|
23549
23856
|
const rootUrl = root ?? getDefaultHost();
|
|
23550
23857
|
try {
|
|
23551
23858
|
const response = await fetch(`${rootUrl}${url}`);
|
|
23552
23859
|
if (response.status !== 200) {
|
|
23553
|
-
log$
|
|
23860
|
+
log$3.warn(`Failed to fetch translations at ${url}: ${response.status}`);
|
|
23554
23861
|
return {};
|
|
23555
23862
|
}
|
|
23556
23863
|
const json = await response.json();
|
|
23557
23864
|
return json;
|
|
23558
23865
|
} catch (error) {
|
|
23559
|
-
log$
|
|
23866
|
+
log$3.error("Error fetching translations", error);
|
|
23560
23867
|
throw error;
|
|
23561
23868
|
}
|
|
23562
23869
|
};
|
|
23563
23870
|
const getLocalizationDescriptor = async () => {
|
|
23564
|
-
log$
|
|
23871
|
+
log$3.debug("Getting system localization descriptor");
|
|
23565
23872
|
const response = await getOne({
|
|
23566
23873
|
urlOverride: `${URL$1}/api/system/kos/localization`
|
|
23567
23874
|
});
|
|
@@ -23573,7 +23880,7 @@ const getLocalizationDescriptor = async () => {
|
|
|
23573
23880
|
return response.data;
|
|
23574
23881
|
};
|
|
23575
23882
|
const getKosLocalizationDescriptor = (context) => async () => {
|
|
23576
|
-
log$
|
|
23883
|
+
log$3.debug(`Getting KOS localization descriptor for context: ${context}`);
|
|
23577
23884
|
const response = await getOne({
|
|
23578
23885
|
urlOverride: `${URL$1}/api/kos/localization/contexts`
|
|
23579
23886
|
});
|
|
@@ -24062,6 +24369,10 @@ var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
|
24062
24369
|
if (kind && result) __defProp(target, key, result);
|
|
24063
24370
|
return result;
|
|
24064
24371
|
};
|
|
24372
|
+
const log$2 = KosLog.createLogger({
|
|
24373
|
+
group: LogGroup.model,
|
|
24374
|
+
name: "ws-event-model"
|
|
24375
|
+
});
|
|
24065
24376
|
const stringify = ({ headers, body }) => {
|
|
24066
24377
|
const headText = Object.entries(headers).map(([key, value]) => `${key}:${value}`).join("\\n");
|
|
24067
24378
|
return headText + "\\n\\n" + body;
|
|
@@ -24085,7 +24396,7 @@ exports.WsEventModel = class WsEventModel {
|
|
|
24085
24396
|
this.processEvent(payload);
|
|
24086
24397
|
}
|
|
24087
24398
|
processEvent(data, isSend = false) {
|
|
24088
|
-
|
|
24399
|
+
log$2.debug("kos event received");
|
|
24089
24400
|
const { body, headers } = data.body;
|
|
24090
24401
|
const isUnique = headers["request-id"] || headers["response-id"];
|
|
24091
24402
|
const msgId = headers["request-id"] || headers["response-id"] || headers["topic"] || headers["type"];
|
|
@@ -24109,7 +24420,7 @@ exports.WsEventModel = class WsEventModel {
|
|
|
24109
24420
|
mocked: !!headers["mocked"]
|
|
24110
24421
|
};
|
|
24111
24422
|
this.events.set(rawKey, rawData);
|
|
24112
|
-
|
|
24423
|
+
log$2.debug(`logged ${this.events.size} events`);
|
|
24113
24424
|
}
|
|
24114
24425
|
}
|
|
24115
24426
|
};
|
|
@@ -24156,9 +24467,9 @@ const Registry = {
|
|
|
24156
24467
|
preloadModels: []
|
|
24157
24468
|
};
|
|
24158
24469
|
const PRELOAD = true;
|
|
24159
|
-
const registerCoreModels = (root) => () => {
|
|
24470
|
+
const registerCoreModels = (root) => ({ preloadLogManager = true } = {}) => {
|
|
24160
24471
|
const coreModels2 = CoreModels;
|
|
24161
|
-
registerKosModel(KosModelRegistry2)(Trouble).model(TroubleContainer).model(StorageDeviceContainer).model(UsbUpdateContainer).model(Device).model(Ota).model(ConfigBean).model(SoftwareInfo).model(KeyValue).model(NetworkInterfaceContainer).model(CanvasDispatcher).model(CanvasRenderer).model(KosExpressionEvaluator).model(BrowserRouter, PRELOAD).model(LogStreamContainer).model(KosLogManager,
|
|
24472
|
+
registerKosModel(KosModelRegistry2)(Trouble).model(TroubleContainer).model(StorageDeviceContainer).model(UsbUpdateContainer).model(Device).model(Ota).model(ConfigBean).model(SoftwareInfo).model(KeyValue).model(NetworkInterfaceContainer).model(CanvasDispatcher).model(CanvasRenderer).model(KosExpressionEvaluator).model(BrowserRouter, PRELOAD).model(LogStreamContainer).model(KosLogManager, preloadLogManager);
|
|
24162
24473
|
Object.keys(coreModels2).forEach((key) => {
|
|
24163
24474
|
const model = coreModels2[key];
|
|
24164
24475
|
registerLegacyModel(KosModelRegistry2)(key, model);
|
|
@@ -24182,7 +24493,10 @@ const KosModelRegistry2 = _KosModelRegistry;
|
|
|
24182
24493
|
const TIMER_EVENT = `/kos-timer-event`;
|
|
24183
24494
|
const TOPIC_TIMER_TICK_EVENT = `/kos-timer-event/tick`;
|
|
24184
24495
|
const TIMER_END = "defaultTimerEnd";
|
|
24185
|
-
const log$1 = KosLog.createLogger({
|
|
24496
|
+
const log$1 = KosLog.createLogger({
|
|
24497
|
+
group: LogGroup.model,
|
|
24498
|
+
name: "timer-manager"
|
|
24499
|
+
});
|
|
24186
24500
|
const isConfigProperty = (value) => value.updateProperty !== void 0;
|
|
24187
24501
|
class KosTimer {
|
|
24188
24502
|
name;
|
|
@@ -24209,7 +24523,7 @@ class KosTimer {
|
|
|
24209
24523
|
this.remainingTime = timeoutValue;
|
|
24210
24524
|
if (isConfigProperty(timeout)) {
|
|
24211
24525
|
kosAutoEffect(() => {
|
|
24212
|
-
|
|
24526
|
+
log$1.info(
|
|
24213
24527
|
`Updating config value timer ${name} with new timeout value ${timeout.value}`
|
|
24214
24528
|
);
|
|
24215
24529
|
const newValue = timeout.value || 60;
|
|
@@ -24446,10 +24760,7 @@ const TimerManager = {
|
|
|
24446
24760
|
executeOnTimer(name, (timer) => timer.start());
|
|
24447
24761
|
}
|
|
24448
24762
|
};
|
|
24449
|
-
const log = KosLog.createLogger({
|
|
24450
|
-
name: "software-info-service",
|
|
24451
|
-
group: "Services"
|
|
24452
|
-
});
|
|
24763
|
+
const log = KosLog.createLogger({ group: LogGroup.service, name: "software-info-service" });
|
|
24453
24764
|
const getSoftwareInfos = async (signal) => {
|
|
24454
24765
|
const destinationAddress = getKosConnectionId();
|
|
24455
24766
|
log.debug("sending GET for software-info");
|
|
@@ -24557,6 +24868,7 @@ exports.AuthState = AuthState;
|
|
|
24557
24868
|
exports.BrowserKosRouter = BrowserKosRouter;
|
|
24558
24869
|
exports.BrowserRouter = BrowserRouter;
|
|
24559
24870
|
exports.CancellableServiceManager = CancellableServiceManager;
|
|
24871
|
+
exports.CancellationBatch = CancellationBatch;
|
|
24560
24872
|
exports.CanvasDispatcher = CanvasDispatcher;
|
|
24561
24873
|
exports.CanvasRenderer = CanvasRenderer;
|
|
24562
24874
|
exports.ChildModels = ChildModels;
|
|
@@ -24651,10 +24963,11 @@ exports.LOGIN_HOST = LOGIN_HOST;
|
|
|
24651
24963
|
exports.LOGIN_URL = LOGIN_URL;
|
|
24652
24964
|
exports.LogBlock = LogBlock;
|
|
24653
24965
|
exports.LogBlockContainer = LogBlockContainer;
|
|
24654
|
-
exports.
|
|
24966
|
+
exports.LogGroup = LogGroup;
|
|
24655
24967
|
exports.LogStream = LogStream;
|
|
24656
24968
|
exports.LogStreamContainer = LogStreamContainer;
|
|
24657
24969
|
exports.LoggerSetup = LoggerSetup;
|
|
24970
|
+
exports.MESSAGE_LOGGER_NAME = MESSAGE_LOGGER_NAME;
|
|
24658
24971
|
exports.MODEL_DELETION_DELAY = MODEL_DELETION_DELAY;
|
|
24659
24972
|
exports.MixinModels = MixinModels;
|
|
24660
24973
|
exports.ModelEffects = ModelEffects;
|
|
@@ -24739,7 +25052,9 @@ exports.convert = convert;
|
|
|
24739
25052
|
exports.convertWithUnits = convertWithUnits;
|
|
24740
25053
|
exports.createBaseMessage = createBaseMessage;
|
|
24741
25054
|
exports.createBroadcastMessageResponse = createBroadcastMessageResponse;
|
|
25055
|
+
exports.createCancellablePromise = createCancellablePromise;
|
|
24742
25056
|
exports.createCancellableService = createCancellableService;
|
|
25057
|
+
exports.createCancellationBatch = createCancellationBatch;
|
|
24743
25058
|
exports.createClient = createClient;
|
|
24744
25059
|
exports.createFosBaseMessage = createFosBaseMessage;
|
|
24745
25060
|
exports.createHeaders = createHeaders;
|
|
@@ -24781,7 +25096,6 @@ exports.getKeyValue = getKeyValue;
|
|
|
24781
25096
|
exports.getKosCompanionModel = getKosCompanionModel;
|
|
24782
25097
|
exports.getKosConnectionId = getKosConnectionId;
|
|
24783
25098
|
exports.getKosLocalizationDescriptor = getKosLocalizationDescriptor;
|
|
24784
|
-
exports.getKosMessageLogging = getKosMessageLogging;
|
|
24785
25099
|
exports.getKosModel = getKosModel$1;
|
|
24786
25100
|
exports.getKosModelActivationState = getKosModelActivationState;
|
|
24787
25101
|
exports.getKosModelSync = getKosModelSync;
|
|
@@ -24790,7 +25104,6 @@ exports.getKosSessionKey = getKosSessionKey;
|
|
|
24790
25104
|
exports.getLocalizationDescriptor = getLocalizationDescriptor;
|
|
24791
25105
|
exports.getLogGroups = getLogGroups;
|
|
24792
25106
|
exports.getLogLevel = getLogLevel;
|
|
24793
|
-
exports.getLogMessageToStudio = getLogMessageToStudio;
|
|
24794
25107
|
exports.getLogOverrides = getLogOverrides;
|
|
24795
25108
|
exports.getLogStreamBlock = getLogStreamBlock;
|
|
24796
25109
|
exports.getLogStreamBlocks = getLogStreamBlocks;
|
|
@@ -24856,6 +25169,7 @@ exports.kosStateGuard = kosStateGuard;
|
|
|
24856
25169
|
exports.kosStateMachine = kosStateMachine;
|
|
24857
25170
|
exports.kosTopicHandler = kosTopicHandler;
|
|
24858
25171
|
exports.kosWhen = kosWhen;
|
|
25172
|
+
exports.makeCancellable = makeCancellable;
|
|
24859
25173
|
exports.mapConfigBeanModelToDto = mapConfigBeanModelToDto;
|
|
24860
25174
|
exports.mapDataToModel = mapDataToModel;
|
|
24861
25175
|
exports.mapDtoToConfigBeanModel = mapDtoToConfigBeanModel;
|
|
@@ -24894,6 +25208,7 @@ exports.resolveListDeltas = resolveListDeltas;
|
|
|
24894
25208
|
exports.resolveServiceRequestParameters = resolveServiceRequestParameters;
|
|
24895
25209
|
exports.resolveServiceUrl = resolveServiceUrl;
|
|
24896
25210
|
exports.resolveTrouble = resolveTrouble;
|
|
25211
|
+
exports.retryWithExponentialBackoff = retryWithExponentialBackoff;
|
|
24897
25212
|
exports.sendAsyncIntent = sendAsyncIntent;
|
|
24898
25213
|
exports.sendBroadcastMessage = sendBroadcastMessage;
|
|
24899
25214
|
exports.sendCanvasData = sendCanvasData;
|
|
@@ -24901,6 +25216,7 @@ exports.sendIntent = sendIntent;
|
|
|
24901
25216
|
exports.sendKosHttpMessageResponse = sendKosHttpMessageResponse;
|
|
24902
25217
|
exports.sendKosMessage = sendKosMessage;
|
|
24903
25218
|
exports.sendKosMessageResponse = sendKosMessageResponse;
|
|
25219
|
+
exports.sendRequest = sendRequest;
|
|
24904
25220
|
exports.sendStudioMessage = sendStudioMessage;
|
|
24905
25221
|
exports.sendStudioMessageRequest = sendStudioMessageRequest;
|
|
24906
25222
|
exports.service = service;
|
|
@@ -24909,6 +25225,7 @@ exports.setTime = setTime;
|
|
|
24909
25225
|
exports.setTimezone = setTimezone;
|
|
24910
25226
|
exports.subscribe = subscribe;
|
|
24911
25227
|
exports.subscribeToLogStream = subscribeToLogStream;
|
|
25228
|
+
exports.syncPublish = syncPublish;
|
|
24912
25229
|
exports.troubleByTypeReducer = troubleByTypeReducer;
|
|
24913
25230
|
exports.troubleDataFactory = troubleDataFactory;
|
|
24914
25231
|
exports.unloadKosModel = unloadKosModel;
|
|
@@ -24917,6 +25234,8 @@ exports.updateKeyValue = updateKeyValue;
|
|
|
24917
25234
|
exports.uuid = uuid;
|
|
24918
25235
|
exports.waitForAppToStart = waitForAppToStart;
|
|
24919
25236
|
exports.waitForAppsToStart = waitForAppsToStart;
|
|
25237
|
+
exports.waitForRequest = waitForRequest;
|
|
24920
25238
|
exports.whenReady = whenReady;
|
|
25239
|
+
exports.withCancellation = withCancellation;
|
|
24921
25240
|
exports.wrapWithFutureLifecycle = wrapWithFutureLifecycle;
|
|
24922
|
-
//# sourceMappingURL=software-info-registration-
|
|
25241
|
+
//# sourceMappingURL=software-info-registration-CagrRzH8.cjs.map
|