@nsshunt/stsvueutils 1.2.20 → 1.2.22

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.
@@ -2470,6 +2470,118 @@ _options2 = new WeakMap();
2470
2470
  _SetMessagePort = new WeakMap();
2471
2471
  _AddAsyncRunner = new WeakMap();
2472
2472
  _StopRunners = new WeakMap();
2473
+ const ModelStore = defineStore("__sts__ModelStore", {
2474
+ // State
2475
+ // https://pinia.vuejs.org/core-concepts/state.html
2476
+ state: () => {
2477
+ return {
2478
+ _models: {}
2479
+ };
2480
+ },
2481
+ // Getters
2482
+ // https://pinia.vuejs.org/core-concepts/getters.html
2483
+ // Actions
2484
+ // https://pinia.vuejs.org/core-concepts/actions.html
2485
+ actions: {
2486
+ /*
2487
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2488
+ UpdateModel(model: MasterModel): void {
2489
+ //this.masterModel.serviceModel = _cloneDeep(model.serviceModel.model);
2490
+ //this.masterModel.agentModel = _cloneDeep(model.agentModel.model);
2491
+ },
2492
+ UpdateLogDataDirect(modeNode: any, logData: string[]): void {
2493
+ if (modeNode.instruments) {
2494
+ modeNode.instruments[Gauge.LOGGER] = {
2495
+ '_': 'd',
2496
+ val: _cloneDeep(logData)
2497
+ } as any
2498
+ modeNode.instruments[Gauge.LOGGER_COPY] = {
2499
+ '_': 'd',
2500
+ val: _cloneDeep(logData)
2501
+ } as any
2502
+ }
2503
+ },
2504
+ UpdateLogData(modeNode: any, logData: string[]): void {
2505
+ this.UpdateLogDataDirect(modeNode, [ ]);
2506
+ if (modeNode.instruments && modeNode.children) {
2507
+ for (const [k, v] of Object.entries(modeNode.children) as any) {
2508
+ this.UpdateLogDataDirect(v, [ ]);
2509
+ }
2510
+ }
2511
+ },
2512
+ UpdateModelEx(model: ModelNode): void {
2513
+ try {
2514
+ this.model = _cloneDeep((model as any).data);
2515
+ if (!this.model.context?.serviceInstanceId) {
2516
+ // Remove aggregated logs (legacy instruments when logs part of payload) for non serviceInstanceId 'levels'
2517
+ this.UpdateLogData(this.model, [ ]);
2518
+ }
2519
+ } catch (error) {
2520
+ console.error(chalk.red(`${error}`));
2521
+ //console.error(chalk.red(`${JSON.stringify(this.model)}`));
2522
+ }
2523
+ },
2524
+ UpdateModelLogs(nodeId: string, logMessages: string[]): void {
2525
+ const topicSplit = nodeId.split('_');
2526
+ const serviceInstanceId = `${topicSplit[0]}@${topicSplit[1]}`;
2527
+ const serviceInstanceProcessId = `${topicSplit[2]}@${topicSplit[3]}`;
2528
+
2529
+ //topic = (serviceInstanceId + '_' + serviceInstanceProcessId).replace(/@/g, '_');
2530
+ if (this.model.children) {
2531
+ for (const [k, v] of Object.entries(this.model.children) as any) {
2532
+ if (v.context.serviceInstanceId.localeCompare(serviceInstanceId) === 0) {
2533
+ if (v.context.serviceInstanceProcessId.localeCompare(serviceInstanceProcessId) === 0) {
2534
+ this.UpdateLogDataDirect(v, logMessages);
2535
+ }
2536
+ }
2537
+ }
2538
+ }
2539
+ },
2540
+ */
2541
+ SetupNewModelId(modelId) {
2542
+ this._models[modelId] = {
2543
+ serviceModel: {},
2544
+ agentModel: {},
2545
+ modelMeta: {},
2546
+ serviceModelSubscriptionKey: null,
2547
+ agentModelSubscriptionKey: null,
2548
+ friendlyName: {},
2549
+ friendNameIndex: 1
2550
+ };
2551
+ },
2552
+ UpdateServiceModel(modelId, model, subscriptionKey) {
2553
+ try {
2554
+ if (!this._models[modelId]) {
2555
+ this.SetupNewModelId(modelId);
2556
+ }
2557
+ this._models[modelId].serviceModel = _cloneDeep(model);
2558
+ this._models[modelId].serviceModelSubscriptionKey = subscriptionKey;
2559
+ } catch (error) {
2560
+ console.error(error);
2561
+ }
2562
+ },
2563
+ UpdateAgentModel(modelId, model, subscriptionKey) {
2564
+ if (!this._models[modelId]) {
2565
+ this.SetupNewModelId(modelId);
2566
+ }
2567
+ this._models[modelId].agentModel = _cloneDeep(model);
2568
+ this._models[modelId].agentModelSubscriptionKey = subscriptionKey;
2569
+ },
2570
+ GetFriendName(modelId, id) {
2571
+ try {
2572
+ if (!this._models[modelId]) {
2573
+ this.SetupNewModelId(modelId);
2574
+ }
2575
+ if (!this._models[modelId].friendlyName[id]) {
2576
+ this._models[modelId].friendlyName[id] = `FN${this._models[modelId].friendNameIndex++}@${id.split("@")[1]}`;
2577
+ }
2578
+ return this._models[modelId].friendlyName[id];
2579
+ } catch (error) {
2580
+ return `Error: ${error}`;
2581
+ }
2582
+ }
2583
+ }
2584
+ });
2473
2585
  const _hoisted_1$3 = /* @__PURE__ */ createElementVNode("div", null, " UXTestForm ", -1);
2474
2586
  const _hoisted_2$3 = { class: "text-wrap" };
2475
2587
  const _hoisted_3$2 = { class: "ml-0 text-caption" };
@@ -8302,118 +8414,6 @@ var Filter = /* @__PURE__ */ function() {
8302
8414
  }();
8303
8415
  var ansi_to_html = Filter;
8304
8416
  const Convert = /* @__PURE__ */ getDefaultExportFromCjs(ansi_to_html);
8305
- const ModelStore = defineStore("__sts__ModelStore", {
8306
- // State
8307
- // https://pinia.vuejs.org/core-concepts/state.html
8308
- state: () => {
8309
- return {
8310
- _models: {}
8311
- };
8312
- },
8313
- // Getters
8314
- // https://pinia.vuejs.org/core-concepts/getters.html
8315
- // Actions
8316
- // https://pinia.vuejs.org/core-concepts/actions.html
8317
- actions: {
8318
- /*
8319
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
8320
- UpdateModel(model: MasterModel): void {
8321
- //this.masterModel.serviceModel = _cloneDeep(model.serviceModel.model);
8322
- //this.masterModel.agentModel = _cloneDeep(model.agentModel.model);
8323
- },
8324
- UpdateLogDataDirect(modeNode: any, logData: string[]): void {
8325
- if (modeNode.instruments) {
8326
- modeNode.instruments[Gauge.LOGGER] = {
8327
- '_': 'd',
8328
- val: _cloneDeep(logData)
8329
- } as any
8330
- modeNode.instruments[Gauge.LOGGER_COPY] = {
8331
- '_': 'd',
8332
- val: _cloneDeep(logData)
8333
- } as any
8334
- }
8335
- },
8336
- UpdateLogData(modeNode: any, logData: string[]): void {
8337
- this.UpdateLogDataDirect(modeNode, [ ]);
8338
- if (modeNode.instruments && modeNode.children) {
8339
- for (const [k, v] of Object.entries(modeNode.children) as any) {
8340
- this.UpdateLogDataDirect(v, [ ]);
8341
- }
8342
- }
8343
- },
8344
- UpdateModelEx(model: ModelNode): void {
8345
- try {
8346
- this.model = _cloneDeep((model as any).data);
8347
- if (!this.model.context?.serviceInstanceId) {
8348
- // Remove aggregated logs (legacy instruments when logs part of payload) for non serviceInstanceId 'levels'
8349
- this.UpdateLogData(this.model, [ ]);
8350
- }
8351
- } catch (error) {
8352
- console.error(chalk.red(`${error}`));
8353
- //console.error(chalk.red(`${JSON.stringify(this.model)}`));
8354
- }
8355
- },
8356
- UpdateModelLogs(nodeId: string, logMessages: string[]): void {
8357
- const topicSplit = nodeId.split('_');
8358
- const serviceInstanceId = `${topicSplit[0]}@${topicSplit[1]}`;
8359
- const serviceInstanceProcessId = `${topicSplit[2]}@${topicSplit[3]}`;
8360
-
8361
- //topic = (serviceInstanceId + '_' + serviceInstanceProcessId).replace(/@/g, '_');
8362
- if (this.model.children) {
8363
- for (const [k, v] of Object.entries(this.model.children) as any) {
8364
- if (v.context.serviceInstanceId.localeCompare(serviceInstanceId) === 0) {
8365
- if (v.context.serviceInstanceProcessId.localeCompare(serviceInstanceProcessId) === 0) {
8366
- this.UpdateLogDataDirect(v, logMessages);
8367
- }
8368
- }
8369
- }
8370
- }
8371
- },
8372
- */
8373
- SetupNewModelId(modelId) {
8374
- this._models[modelId] = {
8375
- serviceModel: {},
8376
- agentModel: {},
8377
- modelMeta: {},
8378
- serviceModelSubscriptionKey: null,
8379
- agentModelSubscriptionKey: null,
8380
- friendlyName: {},
8381
- friendNameIndex: 1
8382
- };
8383
- },
8384
- UpdateServiceModel(modelId, model, subscriptionKey) {
8385
- try {
8386
- if (!this._models[modelId]) {
8387
- this.SetupNewModelId(modelId);
8388
- }
8389
- this._models[modelId].serviceModel = _cloneDeep(model);
8390
- this._models[modelId].serviceModelSubscriptionKey = subscriptionKey;
8391
- } catch (error) {
8392
- console.error(error);
8393
- }
8394
- },
8395
- UpdateAgentModel(modelId, model, subscriptionKey) {
8396
- if (!this._models[modelId]) {
8397
- this.SetupNewModelId(modelId);
8398
- }
8399
- this._models[modelId].agentModel = _cloneDeep(model);
8400
- this._models[modelId].agentModelSubscriptionKey = subscriptionKey;
8401
- },
8402
- GetFriendName(modelId, id) {
8403
- try {
8404
- if (!this._models[modelId]) {
8405
- this.SetupNewModelId(modelId);
8406
- }
8407
- if (!this._models[modelId].friendlyName[id]) {
8408
- this._models[modelId].friendlyName[id] = `FN${this._models[modelId].friendNameIndex++}@${id.split("@")[1]}`;
8409
- }
8410
- return this._models[modelId].friendlyName[id];
8411
- } catch (error) {
8412
- return `Error: ${error}`;
8413
- }
8414
- }
8415
- }
8416
- });
8417
8417
  /*! @license DOMPurify 3.0.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.11/LICENSE */
8418
8418
  const {
8419
8419
  entries,
@@ -10667,6 +10667,7 @@ export {
10667
10667
  GetSTSInstrumentControllerPluginKeyWM,
10668
10668
  IRunnerState,
10669
10669
  IWorkerState,
10670
+ ModelStore,
10670
10671
  RequestResponseHelper,
10671
10672
  STSEmitterPlugin,
10672
10673
  STSEmitterPluginKey,