@kosdev-code/kos-ui-sdk 3.0.34 → 3.0.36

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.
Files changed (30) hide show
  1. package/core/core/model/kos-subscription-manager.d.ts.map +1 -1
  2. package/core/core/registration/registration-manager.d.ts.map +1 -1
  3. package/core/util/index.d.ts +2 -0
  4. package/core/util/index.d.ts.map +1 -1
  5. package/core/util/kos-local-topic.d.ts +73 -0
  6. package/core/util/kos-local-topic.d.ts.map +1 -0
  7. package/core/util/kos-topic-client.d.ts +79 -0
  8. package/core/util/kos-topic-client.d.ts.map +1 -0
  9. package/index.cjs +77 -7
  10. package/index.cjs.map +1 -1
  11. package/index.js +286 -216
  12. package/index.js.map +1 -1
  13. package/models/models/storage-device/storage-device-container-model.d.ts +4 -3
  14. package/models/models/storage-device/storage-device-container-model.d.ts.map +1 -1
  15. package/models/utils/index.d.ts +1 -0
  16. package/models/utils/index.d.ts.map +1 -1
  17. package/models/utils/topics/kos/daily/topic.d.ts +74 -0
  18. package/models/utils/topics/kos/daily/topic.d.ts.map +1 -0
  19. package/models/utils/topics/kos/daily/topics.d.ts +1026 -0
  20. package/models/utils/topics-index.d.ts +8 -0
  21. package/models/utils/topics-index.d.ts.map +1 -0
  22. package/package.json +2 -2
  23. package/{software-info-registration-dW2ssLDY.js → software-info-registration-BhOmDkag.js} +316 -315
  24. package/software-info-registration-BhOmDkag.js.map +1 -0
  25. package/{software-info-registration-CZq-jfVp.cjs → software-info-registration-JdgonknE.cjs} +15 -14
  26. package/software-info-registration-JdgonknE.cjs.map +1 -0
  27. package/testing.cjs +1 -1
  28. package/testing.js +1 -1
  29. package/software-info-registration-CZq-jfVp.cjs.map +0 -1
  30. package/software-info-registration-dW2ssLDY.js.map +0 -1
@@ -2684,15 +2684,16 @@ const RegistrationManager = {
2684
2684
  (model) => models.set(model.type, model.registration())
2685
2685
  );
2686
2686
  }
2687
- if (KosCore.getInstance().isReady) {
2688
- if (!KosCore.getInstance().modelManager.registry.models[register.type]) {
2687
+ const liveModels = KosCore.getInstance().modelManager?.registry?.models;
2688
+ if (liveModels) {
2689
+ if (!liveModels[register.type]) {
2689
2690
  log$15.info(
2690
2691
  `Model with type ${register.type} doesn't exist. Adding new registration`
2691
2692
  );
2692
- KosCore.getInstance().modelManager.registry.models[register.type] = register.registration[register.type];
2693
+ liveModels[register.type] = register.registration[register.type];
2693
2694
  if (isKosModelRegistration(registration)) {
2694
2695
  registration.relatedModels.forEach(
2695
- (model) => KosCore.getInstance().modelManager.registry.models[model.type] = model.registration().registration
2696
+ (model) => liveModels[model.type] = model.registration().registration[model.type]
2696
2697
  );
2697
2698
  }
2698
2699
  }
@@ -10203,13 +10204,11 @@ class KosSubscriptionManager {
10203
10204
  };
10204
10205
  }
10205
10206
  resolvePropKey(template) {
10206
- const propRegex = /.*({PROP_(.+)})/;
10207
- let topic = template.includes("{MODEL_ID}") ? template.replace("{MODEL_ID}", this.modelId) : template;
10208
- const match = topic.match(propRegex);
10209
- if (match && match[2] in this.modelData) {
10210
- topic = topic.replace(match[1], this.modelData[match[2]]);
10211
- }
10212
- return topic;
10207
+ const topic = template.includes("{MODEL_ID}") ? template.replace("{MODEL_ID}", this.modelId) : template;
10208
+ return topic.replace(
10209
+ /{PROP_([^}]+)}/g,
10210
+ (placeholder, propName) => propName in this.modelData ? this.modelData[propName] : placeholder
10211
+ );
10213
10212
  }
10214
10213
  // ===== FLOW CONTROL METHODS =====
10215
10214
  async subscribeWithFlowControl(config2, resolvedTopic, lifecycle) {
@@ -23651,6 +23650,7 @@ var __decorateClass$6 = (decorators, target, key, kind) => {
23651
23650
  };
23652
23651
  const MODEL_TYPE$5 = "storage-device-container-model";
23653
23652
  const TOPIC_STORAGE_AVAILABILITY = "/kos/storage";
23653
+ const isInsertedStorage = (device) => !device.local;
23654
23654
  let StorageDeviceContainerModelImpl = class {
23655
23655
  id;
23656
23656
  logger;
@@ -23689,7 +23689,8 @@ let StorageDeviceContainerModelImpl = class {
23689
23689
  get volumes() {
23690
23690
  return this.data;
23691
23691
  }
23692
- handleStorageAvailability(devices) {
23692
+ handleStorageAvailability(payload) {
23693
+ const devices = payload.filter(isInsertedStorage);
23693
23694
  const toRemove = this._models.data.filter(
23694
23695
  (model) => !devices.find((device) => device.id === model.id)
23695
23696
  );
@@ -23717,7 +23718,7 @@ let StorageDeviceContainerModelImpl = class {
23717
23718
  async load() {
23718
23719
  this.logger.debug(`loading storage-device-container container ${this.id}`);
23719
23720
  const storageDevices = await getStorageDevices();
23720
- storageDevices.forEach((storageDevice) => {
23721
+ storageDevices.filter(isInsertedStorage).forEach((storageDevice) => {
23721
23722
  if (storageDevice.deviceType !== "disk") {
23722
23723
  const options = {
23723
23724
  ...storageDevice,
@@ -25408,4 +25409,4 @@ exports.waitForRequest = waitForRequest;
25408
25409
  exports.whenReady = whenReady;
25409
25410
  exports.withCancellation = withCancellation;
25410
25411
  exports.wrapWithFutureLifecycle = wrapWithFutureLifecycle;
25411
- //# sourceMappingURL=software-info-registration-CZq-jfVp.cjs.map
25412
+ //# sourceMappingURL=software-info-registration-JdgonknE.cjs.map