@uns-kit/cli 0.0.68 → 0.0.70

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/README.md CHANGED
@@ -107,6 +107,7 @@ pnpm run refresh-uns
107
107
  ```
108
108
 
109
109
  Adds `codegen.ts`, seeds `src/uns/` placeholder types, and wires the GraphQL Code Generator / `refresh-uns` script into `package.json`. After installing the new dev dependencies you can regenerate strongly-typed operations (`pnpm run codegen`) and rebuild UNS topics/tags from your environment (`pnpm run refresh-uns`).
110
+ After installing the new dev dependencies you can regenerate strongly-typed operations (`pnpm run codegen`) and rebuild UNS metadata (topics/tags/assets) from your environment (`pnpm run generate-uns-metadata`).
110
111
 
111
112
  ### Add UNS API scaffolding
112
113
 
package/dist/index.js CHANGED
@@ -511,15 +511,8 @@ async function configureCodegen(targetPath, options = {}) {
511
511
  scripts["generate-codegen"] = "graphql-code-generator --config codegen.ts";
512
512
  pkgChanged = true;
513
513
  }
514
- if (!scripts["generate-uns-topics-tags"]) {
515
- scripts["generate-uns-topics-tags"] = "node ./node_modules/@uns-kit/core/dist/tools/refresh-uns.js";
516
- pkgChanged = true;
517
- }
518
- // Preserve legacy name if it already exists; otherwise, prefer the new name.
519
- if (!scripts["refresh-uns"] && !scripts["generate-uns-topics-tags"]) {
520
- scripts["refresh-uns"] = "node ./node_modules/@uns-kit/core/dist/tools/refresh-uns.js";
521
- pkgChanged = true;
522
- }
514
+ scripts["generate-uns-metadata"] = "node ./node_modules/@uns-kit/core/dist/tools/refresh-uns.js";
515
+ pkgChanged = true;
523
516
  if (pkgChanged) {
524
517
  await writeFile(packagePath, JSON.stringify(pkg, null, 2) + "\n", "utf8");
525
518
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uns-kit/cli",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
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.34"
29
+ "@uns-kit/core": "1.0.37"
30
30
  },
31
31
  "unsKitPackages": {
32
- "@uns-kit/core": "1.0.34",
33
- "@uns-kit/api": "0.0.44",
34
- "@uns-kit/cron": "0.0.44",
35
- "@uns-kit/temporal": "0.0.43"
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"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsc -p tsconfig.build.json",
@@ -15,6 +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
19
 
19
20
 
20
21
  /**
@@ -42,7 +43,7 @@ cronInput.event.on("cronEvent", async (event: UnsEvents["cronEvent"]) => {
42
43
  const time = UnsPacket.formatToISO8601(new Date());
43
44
  const numberValue: number = 42;
44
45
  const topic: UnsTopics = "example/";
45
- const asset = "asset";
46
+ const asset = GeneratedAssets["asset"];
46
47
  const assetDescription = "Sample asset";
47
48
 
48
49
  const dataGroup = "sensor";
@@ -24,7 +24,7 @@
24
24
  "start": "node dist/index.js",
25
25
  "generate-config-schema": "node ./node_modules/@uns-kit/core/dist/tools/generate-config-schema.js",
26
26
  "generate-codegen": "graphql-code-generator --require dotenv/config --config codegen.ts",
27
- "generate-uns-topics-tags": "node ./node_modules/@uns-kit/core/dist/tools/refresh-uns.js",
27
+ "generate-uns-metadata": "node ./node_modules/@uns-kit/core/dist/tools/refresh-uns.js",
28
28
  "generate-uns-measurements": "node ./node_modules/@uns-kit/core/dist/tools/generate-uns-measurements.js --input uns-measurements.json --output src/uns/uns-measurements.generated.ts"
29
29
  },
30
30
  "dependencies": {
@@ -10,9 +10,9 @@ import {
10
10
  GeneratedObjectTypes,
11
11
  GeneratedAttributes,
12
12
  GeneratedAttributesByType,
13
- GeneratedAttributeDescriptions,
14
13
  GeneratedObjectTypeDescriptions,
15
14
  } from "../uns/uns-dictionary.generated.js";
15
+ import { GeneratedAssets } from "../uns/uns-assets.js";
16
16
 
17
17
  /**
18
18
  * Load the configuration from a file.
@@ -21,7 +21,6 @@ import {
21
21
  */
22
22
  const config = await ConfigFile.loadConfig();
23
23
  registerObjectTypeDescriptions(GeneratedObjectTypeDescriptions);
24
- registerAttributeDescriptions(GeneratedAttributeDescriptions);
25
24
 
26
25
  /**
27
26
  * Connect to input and output brokers
@@ -54,8 +53,8 @@ mqttInput.event.on("input", async (event) => {
54
53
  const dataGroup = "sensor";
55
54
 
56
55
  const topic: UnsTopics = "enterprise/site/area/line/";
57
- const asset = "asset";
58
- const assetDescription = "Sample asset";
56
+ const asset = GeneratedAssets["asset"];
57
+ const assetDescription = ""; // customize manually
59
58
 
60
59
  mqttOutput.publishMqttMessage({
61
60
  topic,
@@ -12,6 +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
16
  import type { IUnsTableColumn } from "@uns-kit/core/uns/uns-interfaces.js";
16
17
  import { GeneratedPhysicalMeasurements } from "../uns/uns-measurements.generated.js";
17
18
 
@@ -68,11 +69,13 @@ mqttInput.event.on("input", async (event) => {
68
69
  },
69
70
  };
70
71
  const topic: UnsTopics = "enterprise/site/area/line/";
72
+ const asset = GeneratedAssets["asset"];
73
+ const assetDescription = ""; // customize manually
71
74
  const packet = await UnsPacket.unsPacketFromUnsMessage(message);
72
75
  mqttOutput.publishMqttMessage({
73
76
  topic,
74
- asset: "asset",
75
- assetDescription: "Sample asset",
77
+ asset,
78
+ assetDescription,
76
79
  objectType: GeneratedObjectTypes["resource-status"],
77
80
  objectId: "main",
78
81
  attribute: GeneratedAttributes["status"] ?? "status",
@@ -0,0 +1,6 @@
1
+ // Generated UNS asset list. Run `pnpm refresh-uns` to update.
2
+ export const GeneratedAssets = {
3
+ /** Example asset. Replace with your own names after running generate-uns-metadata. */
4
+ "asset": "asset",
5
+ } as const;
6
+ export type GeneratedAssetName = typeof GeneratedAssets[keyof typeof GeneratedAssets];