@kosdev-code/kos-ui-sdk 0.1.0-next.948 → 0.1.0-next.958
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/.kos.json +2 -1
- package/core/core/decorators/kos-container-aware-reconcile.test-d.d.ts +2 -0
- package/core/core/decorators/kos-container-aware-reconcile.test-d.d.ts.map +1 -0
- package/core/core/decorators/kos-container-aware.d.ts +150 -88
- package/core/core/decorators/kos-container-aware.d.ts.map +1 -1
- package/core/core/decorators/kos-reload-aware.d.ts +10 -8
- package/core/core/decorators/kos-reload-aware.d.ts.map +1 -1
- package/core/core/decorators/kosModel.d.ts.map +1 -1
- package/core/core/kosCore.d.ts +4 -1
- package/core/core/kosCore.d.ts.map +1 -1
- package/core/core/kosModel.d.ts +16 -8
- package/core/core/kosModel.d.ts.map +1 -1
- package/core/core/lifecycle/constants.d.ts +6 -2
- package/core/core/lifecycle/constants.d.ts.map +1 -1
- package/core/core/lifecycle/kosCoreLifecycle.d.ts +11 -1
- package/core/core/lifecycle/kosCoreLifecycle.d.ts.map +1 -1
- package/core/core/lifecycle/kosModelLifecycle.d.ts +6 -0
- package/core/core/lifecycle/kosModelLifecycle.d.ts.map +1 -1
- package/core/core/lifecycle/model-machine.d.ts +6 -0
- package/core/core/lifecycle/model-machine.d.ts.map +1 -1
- package/core/core/model/kos-fsm-manager.d.ts +6 -0
- package/core/core/model/kos-fsm-manager.d.ts.map +1 -1
- package/core/core/reconnect/reconnect-fixture.d.ts +17 -0
- package/core/core/reconnect/reconnect-fixture.d.ts.map +1 -0
- package/core/core/transport/transport.d.ts +1 -1
- package/core/core/transport/transport.d.ts.map +1 -1
- package/core/core/transport/webSocketTransport.d.ts +10 -0
- package/core/core/transport/webSocketTransport.d.ts.map +1 -1
- package/index.cjs +134 -90
- package/index.cjs.map +1 -1
- package/index.js +163 -119
- package/index.js.map +1 -1
- package/models/models/config-bean/config-bean-model.d.ts +9 -0
- package/models/models/config-bean/config-bean-model.d.ts.map +1 -1
- package/models/models/gpio-chip/gpio-chip-builders.d.ts +14 -0
- package/models/models/gpio-chip/gpio-chip-builders.d.ts.map +1 -0
- package/models/models/gpio-chip/gpio-chip-container-model.d.ts +2 -1
- package/models/models/gpio-chip/gpio-chip-container-model.d.ts.map +1 -1
- package/models/models/trouble-container/trouble-builders.d.ts +11 -0
- package/models/models/trouble-container/trouble-builders.d.ts.map +1 -0
- package/models/models/trouble-container/trouble-container-model.d.ts +2 -1
- package/models/models/trouble-container/trouble-container-model.d.ts.map +1 -1
- package/package.json +3 -3
- package/{software-info-registration-CuuEsH8v.js → software-info-registration-C8kf-pBB.js} +467 -163
- package/software-info-registration-C8kf-pBB.js.map +1 -0
- package/{software-info-registration-CY_E6Rw7.cjs → software-info-registration-Y1iADHWT.cjs} +438 -134
- package/software-info-registration-Y1iADHWT.cjs.map +1 -0
- package/testing.cjs +1 -1
- package/testing.js +1 -1
- package/ui/components/connection-dev-button/connection-dev-button-styles.d.ts +9 -0
- package/ui/components/connection-dev-button/connection-dev-button-styles.d.ts.map +1 -0
- package/ui/components/connection-dev-button/index.d.ts +36 -0
- package/ui/components/connection-dev-button/index.d.ts.map +1 -0
- package/ui/components/connection-dev-button/use-connection-dev-state.d.ts +29 -0
- package/ui/components/connection-dev-button/use-connection-dev-state.d.ts.map +1 -0
- package/ui/components/index.d.ts +1 -0
- package/ui/components/index.d.ts.map +1 -1
- package/software-info-registration-CY_E6Rw7.cjs.map +0 -1
- package/software-info-registration-CuuEsH8v.js.map +0 -1
|
@@ -850,7 +850,8 @@ function kosContainerAware(options) {
|
|
|
850
850
|
includeGetters,
|
|
851
851
|
modelsProperty,
|
|
852
852
|
containerOptions,
|
|
853
|
-
legacy: options?.legacy || false
|
|
853
|
+
legacy: options?.legacy || false,
|
|
854
|
+
reconcile: options?.reconcile
|
|
854
855
|
};
|
|
855
856
|
return target;
|
|
856
857
|
};
|
|
@@ -2317,6 +2318,66 @@ class KosModelContainer {
|
|
|
2317
2318
|
};
|
|
2318
2319
|
}
|
|
2319
2320
|
}
|
|
2321
|
+
const deltas = (projectedModels, currentModels) => {
|
|
2322
|
+
const newIds = projectedModels.map((entity) => entity.id);
|
|
2323
|
+
const currentIds = currentModels.map((entity) => entity.id);
|
|
2324
|
+
const toRemove = currentIds.filter((modelId) => !newIds.includes(modelId));
|
|
2325
|
+
return toRemove;
|
|
2326
|
+
};
|
|
2327
|
+
const DEFAULT_REMOVE_MAPPER = (id) => id;
|
|
2328
|
+
const DEFAULT_ID_MAPPER = (entity) => entity;
|
|
2329
|
+
const resolveContainerDeltas = ({
|
|
2330
|
+
container,
|
|
2331
|
+
onAddItem,
|
|
2332
|
+
onUpdateItem,
|
|
2333
|
+
onRemoveItem = DEFAULT_REMOVE_MAPPER,
|
|
2334
|
+
idMapper = DEFAULT_ID_MAPPER
|
|
2335
|
+
}) => (entities) => {
|
|
2336
|
+
const mappedEntities = entities.map(idMapper);
|
|
2337
|
+
const toRemove = deltas(mappedEntities, container.data);
|
|
2338
|
+
const removedIds = toRemove.map(onRemoveItem).filter(Boolean);
|
|
2339
|
+
container.removeAll(removedIds);
|
|
2340
|
+
const toAdd = mappedEntities.map((entity) => {
|
|
2341
|
+
const existing = container.getModel(entity.id);
|
|
2342
|
+
if (!existing) {
|
|
2343
|
+
return onAddItem(entity);
|
|
2344
|
+
} else if (onUpdateItem) {
|
|
2345
|
+
return onUpdateItem(entity, existing);
|
|
2346
|
+
} else {
|
|
2347
|
+
return onAddItem(entity);
|
|
2348
|
+
}
|
|
2349
|
+
}).filter(Boolean);
|
|
2350
|
+
container.addAll(toAdd);
|
|
2351
|
+
};
|
|
2352
|
+
const resolveListDeltas = ({
|
|
2353
|
+
container,
|
|
2354
|
+
onAddItem,
|
|
2355
|
+
onRemoveItem = DEFAULT_REMOVE_MAPPER,
|
|
2356
|
+
idMapper = DEFAULT_ID_MAPPER
|
|
2357
|
+
}) => (entities) => {
|
|
2358
|
+
const mappedLayers = entities.map(idMapper);
|
|
2359
|
+
const toRemove = deltas(mappedLayers, container.models);
|
|
2360
|
+
toRemove.forEach(onRemoveItem);
|
|
2361
|
+
mappedLayers.forEach(onAddItem);
|
|
2362
|
+
};
|
|
2363
|
+
const resolveItemListDeltas = ({
|
|
2364
|
+
items,
|
|
2365
|
+
onAddItem,
|
|
2366
|
+
onRemoveItem,
|
|
2367
|
+
idMapper = DEFAULT_ID_MAPPER
|
|
2368
|
+
}) => (entities) => {
|
|
2369
|
+
const mappedLayers = entities.map(idMapper);
|
|
2370
|
+
const toRemove = deltas(mappedLayers, items);
|
|
2371
|
+
toRemove.forEach(onRemoveItem);
|
|
2372
|
+
mappedLayers.forEach(onAddItem);
|
|
2373
|
+
};
|
|
2374
|
+
const processId = (id, prefix = "parent-") => {
|
|
2375
|
+
let _id = id;
|
|
2376
|
+
if (_id.startsWith(prefix)) {
|
|
2377
|
+
_id = _id.replace(prefix, "");
|
|
2378
|
+
}
|
|
2379
|
+
return _id;
|
|
2380
|
+
};
|
|
2320
2381
|
var KosModelState = /* @__PURE__ */ ((KosModelState2) => {
|
|
2321
2382
|
KosModelState2["CREATING"] = `creating`;
|
|
2322
2383
|
KosModelState2["CREATED"] = `created`;
|
|
@@ -2338,6 +2399,9 @@ var KosModelState = /* @__PURE__ */ ((KosModelState2) => {
|
|
|
2338
2399
|
KosModelState2["ACTIVE"] = "active";
|
|
2339
2400
|
KosModelState2["ACTIVATING"] = "activating";
|
|
2340
2401
|
KosModelState2["DEACTIVATING"] = "deactivating";
|
|
2402
|
+
KosModelState2["RELOADING"] = `reloading`;
|
|
2403
|
+
KosModelState2["REATTACHING"] = `reattaching`;
|
|
2404
|
+
KosModelState2["RELOAD_READYING"] = `reload_readying`;
|
|
2341
2405
|
return KosModelState2;
|
|
2342
2406
|
})(KosModelState || {});
|
|
2343
2407
|
var KosModelEvents = /* @__PURE__ */ ((KosModelEvents2) => {
|
|
@@ -2353,6 +2417,7 @@ var KosModelEvents = /* @__PURE__ */ ((KosModelEvents2) => {
|
|
|
2353
2417
|
KosModelEvents2["GO_ACTIVE"] = "go_active";
|
|
2354
2418
|
KosModelEvents2["GO_INACTIVE"] = "go_inactive";
|
|
2355
2419
|
KosModelEvents2["TIMEOUT"] = "timeout";
|
|
2420
|
+
KosModelEvents2["RELOAD"] = `reload`;
|
|
2356
2421
|
return KosModelEvents2;
|
|
2357
2422
|
})(KosModelEvents || {});
|
|
2358
2423
|
const whenReady = async (dataModel) => {
|
|
@@ -3040,6 +3105,23 @@ function injectTroubleAwareSupport(modelInstance) {
|
|
|
3040
3105
|
configurable: true
|
|
3041
3106
|
});
|
|
3042
3107
|
}
|
|
3108
|
+
function createContainerReconcile(container, reconcile) {
|
|
3109
|
+
const { create, update, idMapper, filter, afterCreate } = reconcile;
|
|
3110
|
+
const apply = resolveContainerDeltas({
|
|
3111
|
+
container,
|
|
3112
|
+
onAddItem: (dto) => {
|
|
3113
|
+
const model = create(dto);
|
|
3114
|
+
afterCreate?.(model, dto);
|
|
3115
|
+
return model;
|
|
3116
|
+
},
|
|
3117
|
+
onUpdateItem: update ? (dto, existing) => {
|
|
3118
|
+
update(dto, existing);
|
|
3119
|
+
return null;
|
|
3120
|
+
} : void 0,
|
|
3121
|
+
idMapper
|
|
3122
|
+
});
|
|
3123
|
+
return (list) => apply(filter ? list.filter(filter) : list);
|
|
3124
|
+
}
|
|
3043
3125
|
function injectContainerAwareSupport(modelInstance, modelId) {
|
|
3044
3126
|
const containerSetup = modelInstance[ContainerAwareSetup];
|
|
3045
3127
|
if (!containerSetup) return;
|
|
@@ -3049,7 +3131,8 @@ function injectContainerAwareSupport(modelInstance, modelId) {
|
|
|
3049
3131
|
includeGetters,
|
|
3050
3132
|
modelsProperty,
|
|
3051
3133
|
containerOptions,
|
|
3052
|
-
legacy
|
|
3134
|
+
legacy,
|
|
3135
|
+
reconcile
|
|
3053
3136
|
} = containerSetup;
|
|
3054
3137
|
const finalContainerOptions = {
|
|
3055
3138
|
...containerOptions,
|
|
@@ -3079,6 +3162,9 @@ function injectContainerAwareSupport(modelInstance, modelId) {
|
|
|
3079
3162
|
modelInstance.removeAndDestroy = async (id) => container.removeAndDestroy(id);
|
|
3080
3163
|
modelInstance.removeAndDestroyAll = async (ids) => container.removeAndDestroyAll(ids);
|
|
3081
3164
|
}
|
|
3165
|
+
if (reconcile) {
|
|
3166
|
+
modelInstance.reconcile = createContainerReconcile(container, reconcile);
|
|
3167
|
+
}
|
|
3082
3168
|
if (includeGetters) {
|
|
3083
3169
|
Object.defineProperty(modelInstance, modelsProperty, {
|
|
3084
3170
|
get() {
|
|
@@ -4693,6 +4779,14 @@ const onlineMachine = (model) => {
|
|
|
4693
4779
|
const machine = (model) => {
|
|
4694
4780
|
const active = activeMachine(model).service;
|
|
4695
4781
|
const online = onlineMachine(model).service;
|
|
4782
|
+
const setStatus = (status) => kosAction(() => {
|
|
4783
|
+
model.status = status;
|
|
4784
|
+
});
|
|
4785
|
+
const failed = robot3.transition(
|
|
4786
|
+
`error`,
|
|
4787
|
+
KosModelState.FAILED,
|
|
4788
|
+
robot3.action(() => setStatus(KosModelState.FAILED))
|
|
4789
|
+
);
|
|
4696
4790
|
return robot3.createMachine(KosModelState.CREATING, {
|
|
4697
4791
|
[KosModelState.CREATING]: robot3.state(
|
|
4698
4792
|
robot3.transition(KosModelEvents.CREATE, KosModelState.CREATED)
|
|
@@ -4798,6 +4892,7 @@ const machine = (model) => {
|
|
|
4798
4892
|
robot3.action(model.unload?.bind(model))
|
|
4799
4893
|
),
|
|
4800
4894
|
robot3.transition(KosModelEvents.RESET, KosModelState.RESETTING),
|
|
4895
|
+
robot3.transition(KosModelEvents.RELOAD, KosModelState.RELOADING),
|
|
4801
4896
|
robot3.transition(
|
|
4802
4897
|
KosModelEvents.GO_ONLINE,
|
|
4803
4898
|
KosModelState.READY,
|
|
@@ -4827,6 +4922,49 @@ const machine = (model) => {
|
|
|
4827
4922
|
})
|
|
4828
4923
|
)
|
|
4829
4924
|
),
|
|
4925
|
+
[KosModelState.RELOADING]: robot3.invoke(
|
|
4926
|
+
() => {
|
|
4927
|
+
setStatus(KosModelState.RELOADING);
|
|
4928
|
+
return model.reloadData();
|
|
4929
|
+
},
|
|
4930
|
+
robot3.transition(`done`, KosModelState.REATTACHING),
|
|
4931
|
+
robot3.transition(
|
|
4932
|
+
`error`,
|
|
4933
|
+
KosModelState.REATTACHING,
|
|
4934
|
+
robot3.action((_ctx, event) => {
|
|
4935
|
+
KosLog.error(
|
|
4936
|
+
`Model ${model.modelId} - ${model.modelTypeName} failed to reload; its data stays as it was. ${String(
|
|
4937
|
+
event?.error
|
|
4938
|
+
)}`
|
|
4939
|
+
);
|
|
4940
|
+
})
|
|
4941
|
+
)
|
|
4942
|
+
),
|
|
4943
|
+
[KosModelState.REATTACHING]: robot3.invoke(
|
|
4944
|
+
() => {
|
|
4945
|
+
setStatus(KosModelState.REATTACHING);
|
|
4946
|
+
return model.reattach();
|
|
4947
|
+
},
|
|
4948
|
+
robot3.transition(`done`, KosModelState.RELOAD_READYING),
|
|
4949
|
+
failed
|
|
4950
|
+
),
|
|
4951
|
+
[KosModelState.RELOAD_READYING]: robot3.invoke(
|
|
4952
|
+
() => {
|
|
4953
|
+
setStatus(KosModelState.READYING);
|
|
4954
|
+
return model.ready();
|
|
4955
|
+
},
|
|
4956
|
+
robot3.transition(
|
|
4957
|
+
`done`,
|
|
4958
|
+
KosModelState.READY,
|
|
4959
|
+
robot3.action(() => {
|
|
4960
|
+
setStatus(KosModelState.READY);
|
|
4961
|
+
if (!KosCore.getInstance().isOnline) {
|
|
4962
|
+
online.send(KosModelEvents.GO_OFFLINE);
|
|
4963
|
+
}
|
|
4964
|
+
})
|
|
4965
|
+
),
|
|
4966
|
+
failed
|
|
4967
|
+
),
|
|
4830
4968
|
[KosModelState.UNLOADED]: robot3.state(),
|
|
4831
4969
|
[KosModelState.FAILED]: robot3.state()
|
|
4832
4970
|
});
|
|
@@ -4905,6 +5043,26 @@ class KosFSMManager {
|
|
|
4905
5043
|
this.disposer = void 0;
|
|
4906
5044
|
});
|
|
4907
5045
|
}
|
|
5046
|
+
/**
|
|
5047
|
+
* Re-enters a READY model through RELOADING, REATTACHING and READYING and
|
|
5048
|
+
* resolves once it is READY again; rejects if it fails. A model that is not
|
|
5049
|
+
* READY is left alone.
|
|
5050
|
+
*/
|
|
5051
|
+
async reload() {
|
|
5052
|
+
if (this.current !== KosModelState.READY) {
|
|
5053
|
+
this.log.debug(
|
|
5054
|
+
`Model ${this.model.modelId} is ${this.current}, not READY; skipping reload`
|
|
5055
|
+
);
|
|
5056
|
+
return;
|
|
5057
|
+
}
|
|
5058
|
+
this.service.send(KosModelEvents.RELOAD);
|
|
5059
|
+
await mobx.when(
|
|
5060
|
+
() => this.model.status === KosModelState.READY || this.model.status === KosModelState.FAILED
|
|
5061
|
+
);
|
|
5062
|
+
if (this.model.status === KosModelState.FAILED) {
|
|
5063
|
+
throw new Error(`reload failed for model ${this.model.modelId}`);
|
|
5064
|
+
}
|
|
5065
|
+
}
|
|
4908
5066
|
/**
|
|
4909
5067
|
* Checks if a given target maps to status, activeStatus, or onlineStatus.
|
|
4910
5068
|
* Online/offline transitions are tracked on model.onlineStatus because the
|
|
@@ -8856,9 +9014,9 @@ class MockInterceptorTransport {
|
|
|
8856
9014
|
this.inner.send(data);
|
|
8857
9015
|
}
|
|
8858
9016
|
}
|
|
8859
|
-
close() {
|
|
9017
|
+
close(code, reason) {
|
|
8860
9018
|
this.unregisterInjector();
|
|
8861
|
-
return this.inner.close();
|
|
9019
|
+
return this.inner.close(code, reason);
|
|
8862
9020
|
}
|
|
8863
9021
|
addEventListener(type, listener, options) {
|
|
8864
9022
|
this.inner.addEventListener(type, listener, options);
|
|
@@ -9393,13 +9551,9 @@ class WebSocketTransport {
|
|
|
9393
9551
|
if (connectionEstablished) {
|
|
9394
9552
|
log$v.warn("Connection Established");
|
|
9395
9553
|
this.reconnectAttempts = 0;
|
|
9396
|
-
publish(
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
);
|
|
9400
|
-
if (initialized) {
|
|
9401
|
-
publish(WebSocketEvents.RELOAD, WebSocketEvents.RELOAD);
|
|
9402
|
-
}
|
|
9554
|
+
publish(WebSocketEvents.CONNECTED, {
|
|
9555
|
+
reconnect: initialized
|
|
9556
|
+
});
|
|
9403
9557
|
initialized = true;
|
|
9404
9558
|
}
|
|
9405
9559
|
}
|
|
@@ -9574,6 +9728,13 @@ ${dstAddr}topics:${topic}
|
|
|
9574
9728
|
status: `success`
|
|
9575
9729
|
};
|
|
9576
9730
|
}
|
|
9731
|
+
dropConnection() {
|
|
9732
|
+
if (!this.connectionEstablished) {
|
|
9733
|
+
log$v.debug("dropConnection ignored: the connection is already closed");
|
|
9734
|
+
return;
|
|
9735
|
+
}
|
|
9736
|
+
this.socket?.socket.close(1e3);
|
|
9737
|
+
}
|
|
9577
9738
|
get token() {
|
|
9578
9739
|
return this._token;
|
|
9579
9740
|
}
|
|
@@ -10761,18 +10922,63 @@ class KosModel {
|
|
|
10761
10922
|
);
|
|
10762
10923
|
this.subscriptionManager?.registerAll(lifecycle);
|
|
10763
10924
|
}
|
|
10764
|
-
/**
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10925
|
+
/** Narrow, framework-owned teardown for a reload; never the author's unload(). */
|
|
10926
|
+
suspendForReload() {
|
|
10927
|
+
this.subscriptionManager?.disposeAll();
|
|
10928
|
+
this.effectManager?.disposeAll();
|
|
10929
|
+
this.httpRouteManager?.dispose();
|
|
10930
|
+
this.onlineLifecycleManager?.dispose();
|
|
10931
|
+
kosAction(() => {
|
|
10932
|
+
this.loaded = false;
|
|
10933
|
+
});
|
|
10934
|
+
}
|
|
10935
|
+
/** @internal */
|
|
10936
|
+
async reloadData() {
|
|
10937
|
+
log$u.info(`reloading model ${this.modelTypeName} with id ${this.modelId}`);
|
|
10938
|
+
this.suspendForReload();
|
|
10939
|
+
const data = this.modelData;
|
|
10940
|
+
if (typeof data?.reload === "function" && !data[SelfManagedReload]) {
|
|
10941
|
+
await data.reload();
|
|
10942
|
+
}
|
|
10943
|
+
}
|
|
10944
|
+
/** @internal */
|
|
10945
|
+
async reattach() {
|
|
10946
|
+
log$u.info(`reattaching model ${this.modelTypeName} with id ${this.modelId}`);
|
|
10947
|
+
kosAction(() => {
|
|
10948
|
+
this.loaded = true;
|
|
10949
|
+
});
|
|
10771
10950
|
this.subscriptionManager?.registerAll();
|
|
10772
10951
|
this.httpRouteManager?.registerAll();
|
|
10773
10952
|
this.effectManager?.setup();
|
|
10774
|
-
|
|
10775
|
-
|
|
10953
|
+
this.onlineLifecycleManager?.register();
|
|
10954
|
+
await this.reenterChildren();
|
|
10955
|
+
}
|
|
10956
|
+
// A READY child runs its own reload sequence; one created by reload() and
|
|
10957
|
+
// still booting is awaited through its normal lifecycle.
|
|
10958
|
+
async reenterChildren() {
|
|
10959
|
+
const children = this.getChildren();
|
|
10960
|
+
const ready = children.filter(
|
|
10961
|
+
(child) => child.fsm.current === KosModelState.READY
|
|
10962
|
+
);
|
|
10963
|
+
const booting = children.filter(
|
|
10964
|
+
(child) => child.fsm.current !== KosModelState.READY && child.fsm.current !== KosModelState.UNLOADED
|
|
10965
|
+
);
|
|
10966
|
+
const [reloaded] = await Promise.all([
|
|
10967
|
+
Promise.allSettled(ready.map((child) => child.fsm.reload())),
|
|
10968
|
+
executeListLifecycle(
|
|
10969
|
+
this,
|
|
10970
|
+
booting,
|
|
10971
|
+
Transitions.READY,
|
|
10972
|
+
DependencyLifecycle.READY
|
|
10973
|
+
)
|
|
10974
|
+
]);
|
|
10975
|
+
reloaded.forEach((result, index) => {
|
|
10976
|
+
if (result.status === "rejected") {
|
|
10977
|
+
log$u.error(
|
|
10978
|
+
`reload of child ${ready[index].modelId} of ${this.modelId} failed`,
|
|
10979
|
+
result.reason
|
|
10980
|
+
);
|
|
10981
|
+
}
|
|
10776
10982
|
});
|
|
10777
10983
|
}
|
|
10778
10984
|
/**
|
|
@@ -11352,6 +11558,9 @@ var KosCoreState = /* @__PURE__ */ ((KosCoreState2) => {
|
|
|
11352
11558
|
KosCoreState2["UNLOADING"] = `unloading`;
|
|
11353
11559
|
KosCoreState2["UNLOADED"] = `unloaded`;
|
|
11354
11560
|
KosCoreState2["RELOADING"] = `reloading`;
|
|
11561
|
+
KosCoreState2["RECONNECTING"] = `reconnecting`;
|
|
11562
|
+
KosCoreState2["RECONNECT_INTERRUPTED"] = `reconnect_interrupted`;
|
|
11563
|
+
KosCoreState2["RECONNECT_PENDING"] = `reconnect_pending`;
|
|
11355
11564
|
KosCoreState2["FAILED"] = `failed`;
|
|
11356
11565
|
return KosCoreState2;
|
|
11357
11566
|
})(KosCoreState || {});
|
|
@@ -11363,6 +11572,7 @@ var KosCoreEvents = /* @__PURE__ */ ((KosCoreEvents2) => {
|
|
|
11363
11572
|
KosCoreEvents2["GO_OFFLINE"] = `go_offline`;
|
|
11364
11573
|
KosCoreEvents2["UNLOAD"] = `unload`;
|
|
11365
11574
|
KosCoreEvents2["RELOAD"] = `reload`;
|
|
11575
|
+
KosCoreEvents2["RECONNECT"] = `reconnect`;
|
|
11366
11576
|
return KosCoreEvents2;
|
|
11367
11577
|
})(KosCoreEvents || {});
|
|
11368
11578
|
const reportFailure = async (step, run) => {
|
|
@@ -11409,8 +11619,23 @@ const coreFsm = (core) => {
|
|
|
11409
11619
|
});
|
|
11410
11620
|
const online = robot3.interpret(
|
|
11411
11621
|
onlineMachine2,
|
|
11412
|
-
(_service) => log$M.debug(_service.machine.current)
|
|
11622
|
+
(_service) => log$M.debug(`KOS Core connection: ${_service.machine.current}`)
|
|
11413
11623
|
);
|
|
11624
|
+
const syncOnline = () => online.send(
|
|
11625
|
+
core.transport.connectionEstablished ? "go_online" : "go_offline"
|
|
11626
|
+
/* GO_OFFLINE */
|
|
11627
|
+
);
|
|
11628
|
+
const setReconnecting = (reconnecting) => mobx.runInAction(() => {
|
|
11629
|
+
core.reconnecting = reconnecting;
|
|
11630
|
+
});
|
|
11631
|
+
const reconnectDone = robot3.action(() => setReconnecting(false));
|
|
11632
|
+
const reconnectedOnline = robot3.action(() => {
|
|
11633
|
+
setReconnecting(false);
|
|
11634
|
+
online.send(
|
|
11635
|
+
"go_online"
|
|
11636
|
+
/* GO_ONLINE */
|
|
11637
|
+
);
|
|
11638
|
+
});
|
|
11414
11639
|
const failed = robot3.transition(
|
|
11415
11640
|
`error`,
|
|
11416
11641
|
"failed",
|
|
@@ -11495,10 +11720,56 @@ const coreFsm = (core) => {
|
|
|
11495
11720
|
mobx.runInAction(() => {
|
|
11496
11721
|
core.status = "ready";
|
|
11497
11722
|
});
|
|
11723
|
+
syncOnline();
|
|
11498
11724
|
})
|
|
11499
11725
|
),
|
|
11500
11726
|
failed
|
|
11501
11727
|
),
|
|
11728
|
+
[
|
|
11729
|
+
"reconnecting"
|
|
11730
|
+
/* RECONNECTING */
|
|
11731
|
+
]: robot3.invoke(
|
|
11732
|
+
() => reportFailure("reconnecting", () => core.reload()),
|
|
11733
|
+
robot3.transition(`done`, "ready", reconnectedOnline),
|
|
11734
|
+
robot3.transition(`error`, "ready", reconnectedOnline),
|
|
11735
|
+
robot3.transition(
|
|
11736
|
+
"go_offline",
|
|
11737
|
+
"reconnect_interrupted"
|
|
11738
|
+
/* RECONNECT_INTERRUPTED */
|
|
11739
|
+
)
|
|
11740
|
+
),
|
|
11741
|
+
[
|
|
11742
|
+
"reconnect_interrupted"
|
|
11743
|
+
/* RECONNECT_INTERRUPTED */
|
|
11744
|
+
]: robot3.state(
|
|
11745
|
+
robot3.transition(`done`, "ready", reconnectDone),
|
|
11746
|
+
robot3.transition(`error`, "ready", reconnectDone),
|
|
11747
|
+
robot3.transition(
|
|
11748
|
+
"reconnect",
|
|
11749
|
+
"reconnect_pending"
|
|
11750
|
+
/* RECONNECT_PENDING */
|
|
11751
|
+
)
|
|
11752
|
+
),
|
|
11753
|
+
[
|
|
11754
|
+
"reconnect_pending"
|
|
11755
|
+
/* RECONNECT_PENDING */
|
|
11756
|
+
]: robot3.state(
|
|
11757
|
+
robot3.transition(
|
|
11758
|
+
`done`,
|
|
11759
|
+
"reconnecting"
|
|
11760
|
+
/* RECONNECTING */
|
|
11761
|
+
),
|
|
11762
|
+
robot3.transition(
|
|
11763
|
+
`error`,
|
|
11764
|
+
"reconnecting"
|
|
11765
|
+
/* RECONNECTING */
|
|
11766
|
+
),
|
|
11767
|
+
robot3.transition(
|
|
11768
|
+
"go_offline",
|
|
11769
|
+
"reconnect_interrupted"
|
|
11770
|
+
/* RECONNECT_INTERRUPTED */
|
|
11771
|
+
)
|
|
11772
|
+
),
|
|
11502
11773
|
[
|
|
11503
11774
|
"reloading"
|
|
11504
11775
|
/* RELOADING */
|
|
@@ -11524,6 +11795,11 @@ const coreFsm = (core) => {
|
|
|
11524
11795
|
"reloading"
|
|
11525
11796
|
/* RELOADING */
|
|
11526
11797
|
),
|
|
11798
|
+
robot3.transition(
|
|
11799
|
+
"reconnect",
|
|
11800
|
+
"reconnecting",
|
|
11801
|
+
robot3.action(() => setReconnecting(true))
|
|
11802
|
+
),
|
|
11527
11803
|
robot3.transition(
|
|
11528
11804
|
"unload",
|
|
11529
11805
|
"unloaded",
|
|
@@ -11557,7 +11833,7 @@ const coreFsm = (core) => {
|
|
|
11557
11833
|
});
|
|
11558
11834
|
const service2 = robot3.interpret(
|
|
11559
11835
|
machine2,
|
|
11560
|
-
(_service) => log$M.debug(_service.machine.current)
|
|
11836
|
+
(_service) => log$M.debug(`KOS Core state: ${_service.machine.current}`)
|
|
11561
11837
|
);
|
|
11562
11838
|
return { service: service2, online };
|
|
11563
11839
|
};
|
|
@@ -11635,6 +11911,15 @@ const rejectAfterDelay = (ms, model) => {
|
|
|
11635
11911
|
};
|
|
11636
11912
|
const isReloadable = (model) => typeof model.reload === "function";
|
|
11637
11913
|
const isSelfManagedReload = (model) => !!model[SelfManagedReload];
|
|
11914
|
+
const isCoreReloaded = (model) => isReloadable(model.modelData) && !isSelfManagedReload(model.modelData);
|
|
11915
|
+
const addDescendants = (model, into) => {
|
|
11916
|
+
model.getChildren().forEach((child) => {
|
|
11917
|
+
if (!into.has(child)) {
|
|
11918
|
+
into.add(child);
|
|
11919
|
+
addDescendants(child, into);
|
|
11920
|
+
}
|
|
11921
|
+
});
|
|
11922
|
+
};
|
|
11638
11923
|
const isUnloadable = (model) => typeof model.unload === "function";
|
|
11639
11924
|
var AuthState = /* @__PURE__ */ ((AuthState2) => {
|
|
11640
11925
|
AuthState2["LOGGED_IN"] = "logged_in";
|
|
@@ -11652,6 +11937,7 @@ class KosCore {
|
|
|
11652
11937
|
authState;
|
|
11653
11938
|
isOnline;
|
|
11654
11939
|
_reloading;
|
|
11940
|
+
reconnecting;
|
|
11655
11941
|
_unloading;
|
|
11656
11942
|
lifecycleStarted = false;
|
|
11657
11943
|
connectionAlias;
|
|
@@ -11663,6 +11949,7 @@ class KosCore {
|
|
|
11663
11949
|
this.status = KosCoreState.CREATED;
|
|
11664
11950
|
this.authState = "logged_out";
|
|
11665
11951
|
this._reloading = false;
|
|
11952
|
+
this.reconnecting = false;
|
|
11666
11953
|
this._unloading = false;
|
|
11667
11954
|
mobx.makeAutoObservable(this);
|
|
11668
11955
|
subscribe("token", (data) => {
|
|
@@ -11673,12 +11960,11 @@ class KosCore {
|
|
|
11673
11960
|
subscribe(WebSocketEvents.DISCONNECTED, () => {
|
|
11674
11961
|
this.fsmService.service.send(KosCoreEvents.GO_OFFLINE);
|
|
11675
11962
|
});
|
|
11676
|
-
subscribe(WebSocketEvents.CONNECTED,
|
|
11677
|
-
|
|
11678
|
-
this.
|
|
11679
|
-
|
|
11963
|
+
subscribe(WebSocketEvents.CONNECTED, (msg) => {
|
|
11964
|
+
const reconnect = msg?.body?.reconnect;
|
|
11965
|
+
this.fsmService.service.send(
|
|
11966
|
+
reconnect ? KosCoreEvents.RECONNECT : KosCoreEvents.GO_ONLINE
|
|
11680
11967
|
);
|
|
11681
|
-
this.fsmService.service.send(KosCoreEvents.GO_ONLINE);
|
|
11682
11968
|
});
|
|
11683
11969
|
subscribe("/studioServer/auth/LOGGED_IN", () => {
|
|
11684
11970
|
mobx.runInAction(() => {
|
|
@@ -11755,64 +12041,74 @@ alias:${alias}
|
|
|
11755
12041
|
this.fsmService.service.send(KosCoreEvents.CREATE);
|
|
11756
12042
|
}
|
|
11757
12043
|
get onlineStatus() {
|
|
11758
|
-
return this.isOnline && !this.
|
|
12044
|
+
return this.isOnline && !this.reloading && !this._unloading;
|
|
11759
12045
|
}
|
|
11760
12046
|
get reloading() {
|
|
11761
|
-
return this._reloading;
|
|
12047
|
+
return this._reloading || this.reconnecting;
|
|
11762
12048
|
}
|
|
11763
12049
|
get unloading() {
|
|
11764
12050
|
return this._unloading;
|
|
11765
12051
|
}
|
|
11766
12052
|
async reload() {
|
|
11767
|
-
const currentTime = Date.now();
|
|
11768
12053
|
if (this._reloading) {
|
|
11769
12054
|
log$r.info("reload already in progress");
|
|
11770
12055
|
return;
|
|
11771
12056
|
}
|
|
11772
12057
|
this._reloading = true;
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
12058
|
+
try {
|
|
12059
|
+
log$r.warn("reloading KOS Core");
|
|
12060
|
+
log$r.warn("reloading preloaded models");
|
|
12061
|
+
const modelManager = this.modelManager;
|
|
12062
|
+
const preloaded = [...modelManager.preloadedModels];
|
|
12063
|
+
const covered = /* @__PURE__ */ new Set();
|
|
12064
|
+
modelManager.models.filter((model) => isCoreReloaded(model)).forEach((model) => addDescendants(model, covered));
|
|
12065
|
+
const reloadRoot = async (model) => {
|
|
12066
|
+
await this.reloadOne(model);
|
|
12067
|
+
addDescendants(model, covered);
|
|
12068
|
+
};
|
|
12069
|
+
for (const model of preloaded) {
|
|
12070
|
+
if (isReloadable(model.modelData) && !covered.has(model)) {
|
|
12071
|
+
if (isSelfManagedReload(model.modelData)) {
|
|
12072
|
+
log$r.info(`skipping self-managed model ${model.modelId}`);
|
|
12073
|
+
continue;
|
|
12074
|
+
}
|
|
12075
|
+
log$r.info(`reloading model ${model.modelId}`);
|
|
12076
|
+
await reloadRoot(model);
|
|
12077
|
+
log$r.info(`reloading model ${model.modelId} complete`);
|
|
11781
12078
|
}
|
|
11782
|
-
log$r.info(`reloading model ${model.modelId}`);
|
|
11783
|
-
await this.reloadModel(model, model.modelData);
|
|
11784
|
-
log$r.info(`reloading model ${model.modelId} complete`);
|
|
11785
12079
|
}
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
12080
|
+
for (const model of [...modelManager.models]) {
|
|
12081
|
+
if (!preloaded.includes(model) && isReloadable(model.modelData) && !covered.has(model)) {
|
|
12082
|
+
if (isSelfManagedReload(model.modelData)) {
|
|
12083
|
+
log$r.info(`skipping self-managed model ${model.modelId}`);
|
|
12084
|
+
continue;
|
|
12085
|
+
}
|
|
12086
|
+
log$r.warn(`reloading model ${model.modelId}`);
|
|
12087
|
+
await reloadRoot(model);
|
|
11792
12088
|
}
|
|
11793
|
-
log$r.warn(`reloading model ${model.modelId}`);
|
|
11794
|
-
await this.reloadModel(model, model.modelData);
|
|
11795
12089
|
}
|
|
11796
|
-
}
|
|
11797
|
-
const elapsed = Date.now() - currentTime;
|
|
11798
|
-
setTimeout(() => {
|
|
12090
|
+
} finally {
|
|
11799
12091
|
mobx.runInAction(() => {
|
|
11800
12092
|
log$r.warn("reloading KOS Core complete");
|
|
11801
12093
|
this._reloading = false;
|
|
11802
12094
|
});
|
|
11803
|
-
}
|
|
12095
|
+
}
|
|
11804
12096
|
}
|
|
11805
|
-
//
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
12097
|
+
// reload never calls unload(); the model machine owns the narrow teardown
|
|
12098
|
+
async reloadOne(model) {
|
|
12099
|
+
try {
|
|
12100
|
+
await model.fsm.reload();
|
|
12101
|
+
} catch (e) {
|
|
12102
|
+
log$r.error(`reload of ${model.modelId} failed`, e);
|
|
12103
|
+
}
|
|
11811
12104
|
}
|
|
11812
12105
|
async online() {
|
|
11813
12106
|
log$r.debug("KOS Core going online");
|
|
11814
12107
|
await this._transport.whenReady();
|
|
11815
12108
|
log$r.debug("KOS Transport Ready. Calling online() for models");
|
|
12109
|
+
this.modelManager.models.forEach(
|
|
12110
|
+
(model) => model.onlineLifecycleManager?.register()
|
|
12111
|
+
);
|
|
11816
12112
|
publish("/kosCore/online", "/kosCore/online");
|
|
11817
12113
|
console.timeEnd("kosCore:startup");
|
|
11818
12114
|
}
|
|
@@ -13624,6 +13920,20 @@ let ConfigBeanModelImpl = class {
|
|
|
13624
13920
|
*/
|
|
13625
13921
|
async load() {
|
|
13626
13922
|
log$k.debug(`loading config bean ${this.path}`);
|
|
13923
|
+
await this.fetchBean();
|
|
13924
|
+
}
|
|
13925
|
+
/**
|
|
13926
|
+
* @internal
|
|
13927
|
+
*
|
|
13928
|
+
* @remarks
|
|
13929
|
+
* Fetches the bean again and updates its values and schema in place, so a
|
|
13930
|
+
* KOS Core reload after a reconnect leaves the same instance current.
|
|
13931
|
+
*/
|
|
13932
|
+
async reload() {
|
|
13933
|
+
log$k.debug(`reloading config bean ${this.path}`);
|
|
13934
|
+
await this.fetchBean();
|
|
13935
|
+
}
|
|
13936
|
+
async fetchBean() {
|
|
13627
13937
|
const response = await this._getConfigBean(
|
|
13628
13938
|
this.path,
|
|
13629
13939
|
this.serviceBasePath,
|
|
@@ -18944,30 +19254,6 @@ const LogStreamContainer = new SingletonKosModelRegistrationFactory({
|
|
|
18944
19254
|
LogStreamContainer.addRelatedModel(LogStream);
|
|
18945
19255
|
LogStreamContainer.addRelatedModel(LogBlockContainer);
|
|
18946
19256
|
LogStreamContainer.addRelatedModel(LogBlock);
|
|
18947
|
-
const isRankedInfo = (i) => i?.rank !== void 0;
|
|
18948
|
-
const isRoleAwareInfo = (i) => i?.visibleRole !== void 0;
|
|
18949
|
-
const isColorAwareInfo = (i) => i?.color !== void 0;
|
|
18950
|
-
const defaultTroubleRankMapper = (trouble) => {
|
|
18951
|
-
const info = trouble.info ?? {};
|
|
18952
|
-
if (isRankedInfo(info)) {
|
|
18953
|
-
return info.rank;
|
|
18954
|
-
}
|
|
18955
|
-
return 0;
|
|
18956
|
-
};
|
|
18957
|
-
const defaultTroubleColorMapper = (trouble) => {
|
|
18958
|
-
const info = trouble.info ?? {};
|
|
18959
|
-
if (isColorAwareInfo(info)) {
|
|
18960
|
-
return info.color;
|
|
18961
|
-
}
|
|
18962
|
-
return "orange";
|
|
18963
|
-
};
|
|
18964
|
-
const defaultTroubleRoleMapper = (trouble) => {
|
|
18965
|
-
const info = trouble.info ?? {};
|
|
18966
|
-
if (isRoleAwareInfo(info)) {
|
|
18967
|
-
return info.visibleRole;
|
|
18968
|
-
}
|
|
18969
|
-
return "TECHNICIAN";
|
|
18970
|
-
};
|
|
18971
19257
|
const { URL: URL$7 } = resolveServiceUrl();
|
|
18972
19258
|
const { getAll: getAll$4, postModel: postModel$1 } = ServiceFactory.build({
|
|
18973
19259
|
basePath: `${URL$7}/api/kos/troubles`
|
|
@@ -19034,6 +19320,30 @@ const bulkResolveTroubles = async (troubleIds, servicePath = "/api/kos/troubles"
|
|
|
19034
19320
|
return futureResponse;
|
|
19035
19321
|
}
|
|
19036
19322
|
};
|
|
19323
|
+
const isRankedInfo = (i) => i?.rank !== void 0;
|
|
19324
|
+
const isRoleAwareInfo = (i) => i?.visibleRole !== void 0;
|
|
19325
|
+
const isColorAwareInfo = (i) => i?.color !== void 0;
|
|
19326
|
+
const defaultTroubleRankMapper = (trouble) => {
|
|
19327
|
+
const info = trouble.info ?? {};
|
|
19328
|
+
if (isRankedInfo(info)) {
|
|
19329
|
+
return info.rank;
|
|
19330
|
+
}
|
|
19331
|
+
return 0;
|
|
19332
|
+
};
|
|
19333
|
+
const defaultTroubleColorMapper = (trouble) => {
|
|
19334
|
+
const info = trouble.info ?? {};
|
|
19335
|
+
if (isColorAwareInfo(info)) {
|
|
19336
|
+
return info.color;
|
|
19337
|
+
}
|
|
19338
|
+
return "orange";
|
|
19339
|
+
};
|
|
19340
|
+
const defaultTroubleRoleMapper = (trouble) => {
|
|
19341
|
+
const info = trouble.info ?? {};
|
|
19342
|
+
if (isRoleAwareInfo(info)) {
|
|
19343
|
+
return info.visibleRole;
|
|
19344
|
+
}
|
|
19345
|
+
return "TECHNICIAN";
|
|
19346
|
+
};
|
|
19037
19347
|
const EXTENSION_TROUBLE_DATA_MAPPER = "troubleDataMapper";
|
|
19038
19348
|
const troubleMappers$1 = /* @__PURE__ */ new Map();
|
|
19039
19349
|
registerExtensionPoint(EXTENSION_TROUBLE_DATA_MAPPER, {
|
|
@@ -19321,29 +19631,24 @@ const Trouble = {
|
|
|
19321
19631
|
predicate: isKosModel(MODEL_TYPE$e),
|
|
19322
19632
|
factory: Kos.Factory.create(MODEL_TYPE$e)
|
|
19323
19633
|
};
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
19328
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
19329
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19330
|
-
if (decorator = decorators[i])
|
|
19331
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19332
|
-
if (kind && result) __defProp$b(target, key, result);
|
|
19333
|
-
return result;
|
|
19334
|
-
};
|
|
19335
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
19336
|
-
const addTrouble = (trouble) => {
|
|
19337
|
-
const options = {
|
|
19634
|
+
function mapTroubleToOptions(dto) {
|
|
19635
|
+
const { trouble } = dto;
|
|
19636
|
+
return {
|
|
19338
19637
|
...trouble,
|
|
19638
|
+
servicePath: dto.servicePath,
|
|
19339
19639
|
rank: troubleRankMapper(trouble),
|
|
19340
19640
|
color: troubleColorMapper(trouble),
|
|
19341
19641
|
role: troubleRoleMapper(trouble),
|
|
19342
|
-
id: String(trouble.id)
|
|
19642
|
+
id: String(trouble.id),
|
|
19643
|
+
rawJson: trouble
|
|
19343
19644
|
};
|
|
19344
|
-
|
|
19345
|
-
|
|
19346
|
-
|
|
19645
|
+
}
|
|
19646
|
+
function createTroubleModel(dto) {
|
|
19647
|
+
return Trouble.factory(dto.id)(mapTroubleToOptions(dto));
|
|
19648
|
+
}
|
|
19649
|
+
function mapTroubleToDto(trouble, servicePath) {
|
|
19650
|
+
return { id: `trouble-${trouble.id}`, servicePath, trouble };
|
|
19651
|
+
}
|
|
19347
19652
|
function troubleRankMapper(trouble) {
|
|
19348
19653
|
const _rank = ExtensionManager.propertyMapper.hasMapper(
|
|
19349
19654
|
KosCoreModelPropertyMapper.TroubleRank
|
|
@@ -19371,6 +19676,18 @@ function troubleRoleMapper(trouble) {
|
|
|
19371
19676
|
) : defaultTroubleRoleMapper(trouble);
|
|
19372
19677
|
return role.toLowerCase();
|
|
19373
19678
|
}
|
|
19679
|
+
var __defProp$b = Object.defineProperty;
|
|
19680
|
+
var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
|
|
19681
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19682
|
+
var __decorateClass$e = (decorators, target, key, kind) => {
|
|
19683
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
|
|
19684
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19685
|
+
if (decorator = decorators[i])
|
|
19686
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19687
|
+
if (kind && result) __defProp$b(target, key, result);
|
|
19688
|
+
return result;
|
|
19689
|
+
};
|
|
19690
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
|
|
19374
19691
|
const MODEL_TYPE$d = "trouble-container-model";
|
|
19375
19692
|
class Troubles {
|
|
19376
19693
|
static INDEX_TROUBLES_BY_IFACE = "byIface";
|
|
@@ -19391,30 +19708,21 @@ let TroubleContainerModelImpl = class {
|
|
|
19391
19708
|
async reload() {
|
|
19392
19709
|
this.logger.info("reloading trouble container");
|
|
19393
19710
|
const _troubles = await getTroubles(this.servicePath);
|
|
19394
|
-
|
|
19395
|
-
|
|
19396
|
-
|
|
19397
|
-
|
|
19398
|
-
|
|
19399
|
-
this.troubles.addAll(toAdd);
|
|
19711
|
+
this.reconcile(
|
|
19712
|
+
(_troubles?.data ?? []).map(
|
|
19713
|
+
(trouble) => mapTroubleToDto(trouble, this.servicePath)
|
|
19714
|
+
)
|
|
19715
|
+
);
|
|
19400
19716
|
}
|
|
19401
19717
|
async load() {
|
|
19402
19718
|
this.logger.debug("loading trouble container");
|
|
19403
19719
|
try {
|
|
19404
19720
|
const _troubles = await getTroubles(this.servicePath);
|
|
19405
|
-
|
|
19406
|
-
|
|
19407
|
-
|
|
19408
|
-
|
|
19409
|
-
|
|
19410
|
-
color: troubleColorMapper(trouble),
|
|
19411
|
-
role: troubleRoleMapper(trouble),
|
|
19412
|
-
id: String(trouble.id),
|
|
19413
|
-
rawJson: trouble
|
|
19414
|
-
};
|
|
19415
|
-
const newTrouble = Trouble.factory(`trouble-${trouble.id}`)(options);
|
|
19416
|
-
this.troubles.addModel(newTrouble);
|
|
19417
|
-
});
|
|
19721
|
+
this.reconcile(
|
|
19722
|
+
(_troubles?.data ?? []).map(
|
|
19723
|
+
(trouble) => mapTroubleToDto(trouble, this.servicePath)
|
|
19724
|
+
)
|
|
19725
|
+
);
|
|
19418
19726
|
} catch (e) {
|
|
19419
19727
|
this.logger.error(e);
|
|
19420
19728
|
throw e;
|
|
@@ -19433,20 +19741,11 @@ let TroubleContainerModelImpl = class {
|
|
|
19433
19741
|
}
|
|
19434
19742
|
}
|
|
19435
19743
|
handleTroubleAdded(trouble) {
|
|
19436
|
-
const
|
|
19437
|
-
|
|
19438
|
-
servicePath: this.servicePath,
|
|
19439
|
-
rank: troubleRankMapper(trouble),
|
|
19440
|
-
color: troubleColorMapper(trouble),
|
|
19441
|
-
role: troubleRoleMapper(trouble),
|
|
19442
|
-
id: String(trouble.id),
|
|
19443
|
-
rawJson: trouble
|
|
19444
|
-
};
|
|
19445
|
-
if (options.role === "NONE") {
|
|
19744
|
+
const dto = mapTroubleToDto(trouble, this.servicePath);
|
|
19745
|
+
if (mapTroubleToOptions(dto).role === "NONE") {
|
|
19446
19746
|
return;
|
|
19447
19747
|
}
|
|
19448
|
-
|
|
19449
|
-
this.troubles.addModel(newTrouble);
|
|
19748
|
+
this.troubles.addModel(createTroubleModel(dto));
|
|
19450
19749
|
}
|
|
19451
19750
|
};
|
|
19452
19751
|
__publicField(TroubleContainerModelImpl, "Registration");
|
|
@@ -19477,7 +19776,8 @@ TroubleContainerModelImpl = __decorateClass$e([
|
|
|
19477
19776
|
[Troubles.INDEX_TROUBLES_BY_DEFERRED]: "deferred"
|
|
19478
19777
|
},
|
|
19479
19778
|
sortKey: Troubles.SORT_KEY_RANK
|
|
19480
|
-
}
|
|
19779
|
+
},
|
|
19780
|
+
reconcile: { create: createTroubleModel }
|
|
19481
19781
|
})
|
|
19482
19782
|
], TroubleContainerModelImpl);
|
|
19483
19783
|
const TroubleContainer = TroubleContainerModelImpl.Registration;
|
|
@@ -24322,6 +24622,7 @@ exports.parseWildcardSegment = parseWildcardSegment;
|
|
|
24322
24622
|
exports.pipe = pipe;
|
|
24323
24623
|
exports.post = post;
|
|
24324
24624
|
exports.preloadKosModel = preloadKosModel;
|
|
24625
|
+
exports.processId = processId;
|
|
24325
24626
|
exports.publish = publish;
|
|
24326
24627
|
exports.put = put;
|
|
24327
24628
|
exports.registerCompanionModel = registerCompanionModel;
|
|
@@ -24333,9 +24634,12 @@ exports.registerLegacyModel = registerLegacyModel;
|
|
|
24333
24634
|
exports.resetKosModel = resetKosModel;
|
|
24334
24635
|
exports.resolveBaseUrl = resolveBaseUrl;
|
|
24335
24636
|
exports.resolveChild = resolveChild;
|
|
24637
|
+
exports.resolveContainerDeltas = resolveContainerDeltas;
|
|
24638
|
+
exports.resolveItemListDeltas = resolveItemListDeltas;
|
|
24336
24639
|
exports.resolveKosCompanion = resolveKosCompanion;
|
|
24337
24640
|
exports.resolveKosContext = resolveKosContext;
|
|
24338
24641
|
exports.resolveKosProfiles = resolveKosProfiles;
|
|
24642
|
+
exports.resolveListDeltas = resolveListDeltas;
|
|
24339
24643
|
exports.resolveServiceRequestParameters = resolveServiceRequestParameters;
|
|
24340
24644
|
exports.resolveServiceUrl = resolveServiceUrl;
|
|
24341
24645
|
exports.resolveTrouble = resolveTrouble;
|
|
@@ -24364,4 +24668,4 @@ exports.waitForAppToStart = waitForAppToStart;
|
|
|
24364
24668
|
exports.waitForAppsToStart = waitForAppsToStart;
|
|
24365
24669
|
exports.whenReady = whenReady;
|
|
24366
24670
|
exports.wrapWithFutureLifecycle = wrapWithFutureLifecycle;
|
|
24367
|
-
//# sourceMappingURL=software-info-registration-
|
|
24671
|
+
//# sourceMappingURL=software-info-registration-Y1iADHWT.cjs.map
|