@uns-kit/cli 0.0.70 → 0.0.71

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uns-kit/cli",
3
- "version": "0.0.70",
3
+ "version": "0.0.71",
4
4
  "description": "Command line scaffolding tool for UNS applications",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,13 +26,13 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "azure-devops-node-api": "^15.1.1",
29
- "@uns-kit/core": "1.0.37"
29
+ "@uns-kit/core": "1.0.38"
30
30
  },
31
31
  "unsKitPackages": {
32
- "@uns-kit/core": "1.0.37",
33
- "@uns-kit/api": "0.0.46",
34
- "@uns-kit/cron": "0.0.46",
35
- "@uns-kit/temporal": "0.0.45"
32
+ "@uns-kit/core": "1.0.38",
33
+ "@uns-kit/api": "0.0.48",
34
+ "@uns-kit/cron": "0.0.47",
35
+ "@uns-kit/temporal": "0.0.46"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsc -p tsconfig.build.json",
@@ -15,7 +15,7 @@ import {
15
15
  GeneratedObjectTypeDescriptions,
16
16
  } from "../uns/uns-dictionary.generated.js";
17
17
  import { GeneratedPhysicalMeasurements } from "../uns/uns-measurements.generated.js";
18
- import { GeneratedAssets } from "../uns/uns-assets.js";
18
+ import { GeneratedAssets, resolveGeneratedAsset } from "../uns/uns-assets.js";
19
19
 
20
20
 
21
21
  /**
@@ -43,7 +43,7 @@ cronInput.event.on("cronEvent", async (event: UnsEvents["cronEvent"]) => {
43
43
  const time = UnsPacket.formatToISO8601(new Date());
44
44
  const numberValue: number = 42;
45
45
  const topic: UnsTopics = "example/";
46
- const asset = GeneratedAssets["asset"];
46
+ const asset = resolveGeneratedAsset("asset");
47
47
  const assetDescription = "Sample asset";
48
48
 
49
49
  const dataGroup = "sensor";
@@ -12,7 +12,7 @@ import {
12
12
  GeneratedAttributesByType,
13
13
  GeneratedObjectTypeDescriptions,
14
14
  } from "../uns/uns-dictionary.generated.js";
15
- import { GeneratedAssets } from "../uns/uns-assets.js";
15
+ import { GeneratedAssets, resolveGeneratedAsset } from "../uns/uns-assets.js";
16
16
 
17
17
  /**
18
18
  * Load the configuration from a file.
@@ -53,7 +53,7 @@ mqttInput.event.on("input", async (event) => {
53
53
  const dataGroup = "sensor";
54
54
 
55
55
  const topic: UnsTopics = "enterprise/site/area/line/";
56
- const asset = GeneratedAssets["asset"];
56
+ const asset = resolveGeneratedAsset("asset");
57
57
  const assetDescription = ""; // customize manually
58
58
 
59
59
  mqttOutput.publishMqttMessage({
@@ -12,7 +12,7 @@ import {
12
12
  GeneratedAttributeDescriptions,
13
13
  GeneratedObjectTypeDescriptions,
14
14
  } from "../uns/uns-dictionary.generated.js";
15
- import { GeneratedAssets } from "../uns/uns-assets.js";
15
+ import { GeneratedAssets, resolveGeneratedAsset } from "../uns/uns-assets.js";
16
16
  import type { IUnsTableColumn } from "@uns-kit/core/uns/uns-interfaces.js";
17
17
  import { GeneratedPhysicalMeasurements } from "../uns/uns-measurements.generated.js";
18
18
 
@@ -69,7 +69,7 @@ mqttInput.event.on("input", async (event) => {
69
69
  },
70
70
  };
71
71
  const topic: UnsTopics = "enterprise/site/area/line/";
72
- const asset = GeneratedAssets["asset"];
72
+ const asset = resolveGeneratedAsset("asset");
73
73
  const assetDescription = ""; // customize manually
74
74
  const packet = await UnsPacket.unsPacketFromUnsMessage(message);
75
75
  mqttOutput.publishMqttMessage({
@@ -4,3 +4,9 @@ export const GeneratedAssets = {
4
4
  "asset": "asset",
5
5
  } as const;
6
6
  export type GeneratedAssetName = typeof GeneratedAssets[keyof typeof GeneratedAssets];
7
+
8
+ export function resolveGeneratedAsset(name: keyof typeof GeneratedAssets): (typeof GeneratedAssets)[keyof typeof GeneratedAssets];
9
+ export function resolveGeneratedAsset<T extends string>(name: T): (typeof GeneratedAssets)[keyof typeof GeneratedAssets] | T;
10
+ export function resolveGeneratedAsset(name: string): string {
11
+ return (GeneratedAssets as Record<string, string>)[name] ?? name;
12
+ }