@nsshunt/stsvueutils 1.2.20 → 1.2.21

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