@uns-kit/core 2.0.40 → 2.0.41

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 (54) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +170 -147
  3. package/dist/index.d.ts +9 -8
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +8 -7
  6. package/dist/index.js.map +1 -1
  7. package/dist/tools/datahub/datahub-client.js.map +1 -1
  8. package/dist/tools/file-utils.d.ts +2 -2
  9. package/dist/tools/file-utils.js +24 -24
  10. package/dist/tools/generate-uns-dictionary.d.ts +23 -23
  11. package/dist/tools/generate-uns-dictionary.js +154 -154
  12. package/dist/tools/generate-uns-measurements.d.ts +21 -21
  13. package/dist/tools/generate-uns-measurements.js +126 -126
  14. package/dist/tools/generate-uns-reference.d.ts +2 -2
  15. package/dist/tools/generate-uns-reference.js +85 -85
  16. package/dist/tools/refresh-uns.js +50 -50
  17. package/dist/tools/sync-uns-schema.d.ts +2 -2
  18. package/dist/tools/sync-uns-schema.js +489 -489
  19. package/dist/uns/service-metadata.d.ts +53 -0
  20. package/dist/uns/service-metadata.d.ts.map +1 -0
  21. package/dist/uns/service-metadata.js +56 -0
  22. package/dist/uns/service-metadata.js.map +1 -0
  23. package/dist/uns/uns-asset.d.ts +1 -1
  24. package/dist/uns/uns-asset.js +1 -1
  25. package/dist/uns/uns-attributes.d.ts +6 -6
  26. package/dist/uns/uns-attributes.js +9 -9
  27. package/dist/uns/uns-dictionary-registry.d.ts +4 -4
  28. package/dist/uns/uns-dictionary-registry.js +20 -20
  29. package/dist/uns/uns-dictionary.generated.d.ts +663 -663
  30. package/dist/uns/uns-dictionary.generated.js +745 -745
  31. package/dist/uns/uns-interfaces.d.ts +365 -365
  32. package/dist/uns/uns-measurements.generated.d.ts +362 -362
  33. package/dist/uns/uns-measurements.generated.js +359 -359
  34. package/dist/uns/uns-object.d.ts +20 -20
  35. package/dist/uns/uns-object.js +9 -9
  36. package/dist/uns/uns-packet.js +263 -263
  37. package/dist/uns/uns-path.d.ts +2 -2
  38. package/dist/uns/uns-path.js +10 -10
  39. package/dist/uns/uns-proxy-process.d.ts +11 -0
  40. package/dist/uns/uns-proxy-process.d.ts.map +1 -1
  41. package/dist/uns/uns-proxy-process.js +224 -203
  42. package/dist/uns/uns-proxy-process.js.map +1 -1
  43. package/dist/uns/uns-proxy.d.ts +51 -51
  44. package/dist/uns/uns-proxy.js +190 -190
  45. package/dist/uns-config/uns-core-schema.d.ts +3276 -3276
  46. package/dist/uns-grpc/uns-gateway.proto +104 -104
  47. package/dist/uns-mqtt/mqtt-topic-builder.d.ts +6 -0
  48. package/dist/uns-mqtt/mqtt-topic-builder.d.ts.map +1 -1
  49. package/dist/uns-mqtt/mqtt-topic-builder.js +8 -0
  50. package/dist/uns-mqtt/mqtt-topic-builder.js.map +1 -1
  51. package/dist/uns-mqtt/uns-mqtt-proxy.js +477 -477
  52. package/package.json +1 -1
  53. package/dist/app-config.d.ts.map +0 -1
  54. package/dist/app-config.js.map +0 -1
@@ -1,86 +1,86 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Generate both UNS dictionary and measurements in one go.
4
- * This is a small wrapper over generate-uns-dictionary.ts and
5
- * generate-uns-measurements.ts to make project setup simpler.
6
- */
7
- import path from "node:path";
8
- import { pathToFileURL } from "node:url";
9
- import { generateUnsDictionary } from "./generate-uns-dictionary.js";
10
- import { generateUnsMeasurements } from "./generate-uns-measurements.js";
11
- const DEFAULT_DICT_INPUT = "uns-dictionary.json";
12
- const DEFAULT_DICT_OUTPUT = path.resolve(process.cwd(), "src/uns/uns-dictionary.generated.ts");
13
- const DEFAULT_MEAS_INPUT = "uns-measurements.json";
14
- const DEFAULT_MEAS_OUTPUT = path.resolve(process.cwd(), "src/uns/uns-measurements.generated.ts");
15
- async function main() {
16
- const args = parseArgs(process.argv.slice(2));
17
- await generateUnsDictionary({
18
- input: args.dictionary,
19
- output: args.dictionaryOutput,
20
- lang: args.lang,
21
- });
22
- await generateUnsMeasurements({
23
- input: args.measurements,
24
- output: args.measurementsOutput,
25
- lang: args.lang,
26
- });
27
- console.log(`Generated reference -> dictionary: ${args.dictionaryOutput}, measurements: ${args.measurementsOutput}`);
28
- }
29
- function parseArgs(argv) {
30
- let dictionary = DEFAULT_DICT_INPUT;
31
- let dictionaryOutput = DEFAULT_DICT_OUTPUT;
32
- let measurements = DEFAULT_MEAS_INPUT;
33
- let measurementsOutput = DEFAULT_MEAS_OUTPUT;
34
- let lang = "sl";
35
- for (let i = 0; i < argv.length; i++) {
36
- const arg = argv[i];
37
- if (arg === "--dictionary" && argv[i + 1]) {
38
- dictionary = argv[++i];
39
- continue;
40
- }
41
- if (arg === "--dictionary-output" && argv[i + 1]) {
42
- dictionaryOutput = argv[++i];
43
- continue;
44
- }
45
- if (arg === "--measurements" && argv[i + 1]) {
46
- measurements = argv[++i];
47
- continue;
48
- }
49
- if (arg === "--measurements-output" && argv[i + 1]) {
50
- measurementsOutput = argv[++i];
51
- continue;
52
- }
53
- if (arg === "--lang" && argv[i + 1]) {
54
- lang = argv[++i];
55
- continue;
56
- }
57
- if (arg === "--help" || arg === "-h") {
58
- printHelp();
59
- process.exit(0);
60
- }
61
- throw new Error(`Unknown argument: ${arg}`);
62
- }
63
- return { dictionary, dictionaryOutput, measurements, measurementsOutput, lang };
64
- }
65
- function printHelp() {
66
- console.log(`Usage: tsx packages/uns-core/src/tools/generate-uns-reference.ts [options]
67
-
68
- Options:
69
- --dictionary <file> Path to uns-dictionary.json (default: ${DEFAULT_DICT_INPUT})
70
- --dictionary-output <file> Path to generated dictionary TS (default: ${DEFAULT_DICT_OUTPUT})
71
- --measurements <file> Path to uns-measurements.json (default: ${DEFAULT_MEAS_INPUT})
72
- --measurements-output <file> Path to generated measurements TS (default: ${DEFAULT_MEAS_OUTPUT})
73
- --lang <code> Preferred description language (default: "sl")
74
- --help, -h Show this help
75
- `);
76
- }
77
- const isDirectExecution = process.argv[1]
78
- ? import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href
79
- : false;
80
- if (isDirectExecution) {
81
- main().catch((err) => {
82
- console.error("Failed to generate UNS reference:", err);
83
- process.exitCode = 1;
84
- });
85
- }
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Generate both UNS dictionary and measurements in one go.
4
+ * This is a small wrapper over generate-uns-dictionary.ts and
5
+ * generate-uns-measurements.ts to make project setup simpler.
6
+ */
7
+ import path from "node:path";
8
+ import { pathToFileURL } from "node:url";
9
+ import { generateUnsDictionary } from "./generate-uns-dictionary.js";
10
+ import { generateUnsMeasurements } from "./generate-uns-measurements.js";
11
+ const DEFAULT_DICT_INPUT = "uns-dictionary.json";
12
+ const DEFAULT_DICT_OUTPUT = path.resolve(process.cwd(), "src/uns/uns-dictionary.generated.ts");
13
+ const DEFAULT_MEAS_INPUT = "uns-measurements.json";
14
+ const DEFAULT_MEAS_OUTPUT = path.resolve(process.cwd(), "src/uns/uns-measurements.generated.ts");
15
+ async function main() {
16
+ const args = parseArgs(process.argv.slice(2));
17
+ await generateUnsDictionary({
18
+ input: args.dictionary,
19
+ output: args.dictionaryOutput,
20
+ lang: args.lang,
21
+ });
22
+ await generateUnsMeasurements({
23
+ input: args.measurements,
24
+ output: args.measurementsOutput,
25
+ lang: args.lang,
26
+ });
27
+ console.log(`Generated reference -> dictionary: ${args.dictionaryOutput}, measurements: ${args.measurementsOutput}`);
28
+ }
29
+ function parseArgs(argv) {
30
+ let dictionary = DEFAULT_DICT_INPUT;
31
+ let dictionaryOutput = DEFAULT_DICT_OUTPUT;
32
+ let measurements = DEFAULT_MEAS_INPUT;
33
+ let measurementsOutput = DEFAULT_MEAS_OUTPUT;
34
+ let lang = "sl";
35
+ for (let i = 0; i < argv.length; i++) {
36
+ const arg = argv[i];
37
+ if (arg === "--dictionary" && argv[i + 1]) {
38
+ dictionary = argv[++i];
39
+ continue;
40
+ }
41
+ if (arg === "--dictionary-output" && argv[i + 1]) {
42
+ dictionaryOutput = argv[++i];
43
+ continue;
44
+ }
45
+ if (arg === "--measurements" && argv[i + 1]) {
46
+ measurements = argv[++i];
47
+ continue;
48
+ }
49
+ if (arg === "--measurements-output" && argv[i + 1]) {
50
+ measurementsOutput = argv[++i];
51
+ continue;
52
+ }
53
+ if (arg === "--lang" && argv[i + 1]) {
54
+ lang = argv[++i];
55
+ continue;
56
+ }
57
+ if (arg === "--help" || arg === "-h") {
58
+ printHelp();
59
+ process.exit(0);
60
+ }
61
+ throw new Error(`Unknown argument: ${arg}`);
62
+ }
63
+ return { dictionary, dictionaryOutput, measurements, measurementsOutput, lang };
64
+ }
65
+ function printHelp() {
66
+ console.log(`Usage: tsx packages/uns-core/src/tools/generate-uns-reference.ts [options]
67
+
68
+ Options:
69
+ --dictionary <file> Path to uns-dictionary.json (default: ${DEFAULT_DICT_INPUT})
70
+ --dictionary-output <file> Path to generated dictionary TS (default: ${DEFAULT_DICT_OUTPUT})
71
+ --measurements <file> Path to uns-measurements.json (default: ${DEFAULT_MEAS_INPUT})
72
+ --measurements-output <file> Path to generated measurements TS (default: ${DEFAULT_MEAS_OUTPUT})
73
+ --lang <code> Preferred description language (default: "sl")
74
+ --help, -h Show this help
75
+ `);
76
+ }
77
+ const isDirectExecution = process.argv[1]
78
+ ? import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href
79
+ : false;
80
+ if (isDirectExecution) {
81
+ main().catch((err) => {
82
+ console.error("Failed to generate UNS reference:", err);
83
+ process.exitCode = 1;
84
+ });
85
+ }
86
86
  //# sourceMappingURL=generate-uns-reference.js.map
@@ -53,38 +53,38 @@ async function requestWithAuth(document) {
53
53
  }
54
54
  // Fetch and generate UnsTopics
55
55
  async function refreshUnsTopics() {
56
- const document = gql `
57
- query GetTreeStructure {
58
- GetTreeStructure {
59
- id
60
- parent
61
- unsNode
62
- children {
63
- id
64
- parent
65
- unsNode
66
- children {
67
- id
68
- parent
69
- unsNode
70
- children {
71
- id
72
- parent
73
- unsNode
74
- children {
75
- id
76
- parent
77
- unsNode
78
- children {
79
- id
80
- parent
81
- unsNode
82
- }
83
- }
84
- }
85
- }
86
- }
87
- }
56
+ const document = gql `
57
+ query GetTreeStructure {
58
+ GetTreeStructure {
59
+ id
60
+ parent
61
+ unsNode
62
+ children {
63
+ id
64
+ parent
65
+ unsNode
66
+ children {
67
+ id
68
+ parent
69
+ unsNode
70
+ children {
71
+ id
72
+ parent
73
+ unsNode
74
+ children {
75
+ id
76
+ parent
77
+ unsNode
78
+ children {
79
+ id
80
+ parent
81
+ unsNode
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
88
  }`;
89
89
  const query = await requestWithAuth(document);
90
90
  const tree = query.GetTreeStructure;
@@ -95,9 +95,9 @@ async function refreshUnsTopics() {
95
95
  }
96
96
  // Fetch and generate UnsTags
97
97
  async function refreshUnsTags() {
98
- const document = gql `
99
- query Query {
100
- GetTags
98
+ const document = gql `
99
+ query Query {
100
+ GetTags
101
101
  }`;
102
102
  const query = await requestWithAuth(document);
103
103
  const tags = query.GetTags;
@@ -147,15 +147,15 @@ function buildAssetEntries(assets) {
147
147
  }
148
148
  // Fetch and generate UnsAssets
149
149
  async function refreshUnsAssets() {
150
- const document = gql `
151
- query GetAssets {
152
- GetAssets {
153
- path
154
- description
155
- asset
156
- objectType
157
- objectId
158
- }
150
+ const document = gql `
151
+ query GetAssets {
152
+ GetAssets {
153
+ path
154
+ description
155
+ asset
156
+ objectType
157
+ objectId
158
+ }
159
159
  }`;
160
160
  const query = await requestWithAuth(document);
161
161
  let assets = buildAssetEntries(Array.isArray(query.GetAssets) ? query.GetAssets : []);
@@ -169,12 +169,12 @@ async function refreshUnsAssets() {
169
169
  return `${comment} "${entry.asset}": "${entry.asset}",`;
170
170
  })
171
171
  .join("\n");
172
- const helpers = `
173
- export function resolveGeneratedAsset(name: keyof typeof GeneratedAssets): (typeof GeneratedAssets)[keyof typeof GeneratedAssets];
174
- export function resolveGeneratedAsset<T extends string>(name: T): (typeof GeneratedAssets)[keyof typeof GeneratedAssets] | T;
175
- export function resolveGeneratedAsset(name: string): string {
176
- return (GeneratedAssets as Record<string, string>)[name] ?? name;
177
- }
172
+ const helpers = `
173
+ export function resolveGeneratedAsset(name: keyof typeof GeneratedAssets): (typeof GeneratedAssets)[keyof typeof GeneratedAssets];
174
+ export function resolveGeneratedAsset<T extends string>(name: T): (typeof GeneratedAssets)[keyof typeof GeneratedAssets] | T;
175
+ export function resolveGeneratedAsset(name: string): string {
176
+ return (GeneratedAssets as Record<string, string>)[name] ?? name;
177
+ }
178
178
  `;
179
179
  const vsebina = `${header}export const GeneratedAssets = {\n${entries}\n} as const;\nexport type GeneratedAssetName = typeof GeneratedAssets[keyof typeof GeneratedAssets];\n${helpers}`;
180
180
  const outputPath = path.resolve(process.cwd(), "src/uns/uns-assets.ts");
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node
2
- export {};
1
+ #!/usr/bin/env node
2
+ export {};
3
3
  //# sourceMappingURL=sync-uns-schema.d.ts.map