@uns-kit/core 2.0.43 → 2.0.45

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.
@@ -53,13 +53,13 @@ function parseArgs(argv) {
53
53
  return { input, output, lang };
54
54
  }
55
55
  function printHelp() {
56
- console.log(`Usage: tsx packages/uns-core/src/tools/generate-uns-dictionary.ts [options]
57
-
58
- Options:
59
- --input <file> Path to uns-dictionary.json (default: ${DEFAULT_INPUT})
60
- --output <file> Path to generated TS file (default: src/uns/uns-dictionary.generated.ts)
61
- --lang <code> Preferred description language code (default: "sl")
62
- --help, -h Show this help
56
+ console.log(`Usage: tsx packages/uns-core/src/tools/generate-uns-dictionary.ts [options]
57
+
58
+ Options:
59
+ --input <file> Path to uns-dictionary.json (default: ${DEFAULT_INPUT})
60
+ --output <file> Path to generated TS file (default: src/uns/uns-dictionary.generated.ts)
61
+ --lang <code> Preferred description language code (default: "sl")
62
+ --help, -h Show this help
63
63
  `);
64
64
  }
65
65
  async function readDictionaryFromJson(filePath) {
@@ -53,13 +53,13 @@ function parseArgs(argv) {
53
53
  return { input, output, lang };
54
54
  }
55
55
  function printHelp() {
56
- console.log(`Usage: tsx packages/uns-core/src/tools/generate-uns-measurements.ts [options]
57
-
58
- Options:
59
- --input <file> Path to uns-measurements.json (default: ${DEFAULT_INPUT})
60
- --output <file> Path to generated TS file (default: src/uns/uns-measurements.generated.ts)
61
- --lang <code> Preferred description language (default: "sl")
62
- --help, -h Show this help
56
+ console.log(`Usage: tsx packages/uns-core/src/tools/generate-uns-measurements.ts [options]
57
+
58
+ Options:
59
+ --input <file> Path to uns-measurements.json (default: ${DEFAULT_INPUT})
60
+ --output <file> Path to generated TS file (default: src/uns/uns-measurements.generated.ts)
61
+ --lang <code> Preferred description language (default: "sl")
62
+ --help, -h Show this help
63
63
  `);
64
64
  }
65
65
  async function loadJson(filePath) {
@@ -63,15 +63,15 @@ function parseArgs(argv) {
63
63
  return { dictionary, dictionaryOutput, measurements, measurementsOutput, lang };
64
64
  }
65
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
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
75
  `);
76
76
  }
77
77
  const isDirectExecution = process.argv[1]
@@ -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");
@@ -250,23 +250,23 @@ function assertValidUrl(value) {
250
250
  }
251
251
  }
252
252
  function printHelp() {
253
- console.log(`Usage: tsx packages/uns-core/src/tools/sync-uns-schema.ts [options]
254
-
255
- Pull the canonical UNS schema export from a controller and refresh the local
256
- JSON files plus generated TypeScript artifacts.
257
-
258
- Options:
259
- --controller-url <url> Controller base URL (env: UNS_CONTROLLER_URL, or config.json > uns.rest)
260
- --token <token> Bearer token for REST export (env: UNS_CONTROLLER_TOKEN)
261
- --status <value> Dictionary status filter: ${STATUS_VALUES.join("|")} (default: ${DEFAULT_STATUS}, env: UNS_SCHEMA_STATUS)
262
- --project-root <dir> Write into a generated microservice project root (env: UNS_SCHEMA_PROJECT_ROOT).
263
- When omitted, the tool auto-detects a generated project from the current working directory
264
- and otherwise updates the uns-kit repo templates.
265
- --dry-run Report file changes without writing anything
266
- --dictionary-only Sync only the UNS dictionary export
267
- --measurements-only Sync only the UNS measurements export
268
- --skip-generate Skip generated TypeScript refresh
269
- --help, -h Show this help
253
+ console.log(`Usage: tsx packages/uns-core/src/tools/sync-uns-schema.ts [options]
254
+
255
+ Pull the canonical UNS schema export from a controller and refresh the local
256
+ JSON files plus generated TypeScript artifacts.
257
+
258
+ Options:
259
+ --controller-url <url> Controller base URL (env: UNS_CONTROLLER_URL, or config.json > uns.rest)
260
+ --token <token> Bearer token for REST export (env: UNS_CONTROLLER_TOKEN)
261
+ --status <value> Dictionary status filter: ${STATUS_VALUES.join("|")} (default: ${DEFAULT_STATUS}, env: UNS_SCHEMA_STATUS)
262
+ --project-root <dir> Write into a generated microservice project root (env: UNS_SCHEMA_PROJECT_ROOT).
263
+ When omitted, the tool auto-detects a generated project from the current working directory
264
+ and otherwise updates the uns-kit repo templates.
265
+ --dry-run Report file changes without writing anything
266
+ --dictionary-only Sync only the UNS dictionary export
267
+ --measurements-only Sync only the UNS measurements export
268
+ --skip-generate Skip generated TypeScript refresh
269
+ --help, -h Show this help
270
270
  `);
271
271
  }
272
272
  async function findRepoRoot() {
@@ -698,9 +698,9 @@ export declare const unsCoreSchema: z.ZodObject<{
698
698
  projectId?: string;
699
699
  };
700
700
  processName?: string;
701
- email?: string;
702
701
  graphql?: string;
703
702
  rest?: string;
703
+ email?: string;
704
704
  instanceMode?: "wait" | "force" | "handover";
705
705
  supervisor?: {
706
706
  enabled?: boolean;
@@ -730,9 +730,9 @@ export declare const unsCoreSchema: z.ZodObject<{
730
730
  projectId?: string;
731
731
  };
732
732
  processName?: string;
733
- email?: string;
734
733
  graphql?: string;
735
734
  rest?: string;
735
+ email?: string;
736
736
  instanceMode?: "wait" | "force" | "handover";
737
737
  supervisor?: {
738
738
  enabled?: boolean;
@@ -2687,9 +2687,9 @@ export declare const unsCoreSchema: z.ZodObject<{
2687
2687
  projectId?: string;
2688
2688
  };
2689
2689
  processName?: string;
2690
- email?: string;
2691
2690
  graphql?: string;
2692
2691
  rest?: string;
2692
+ email?: string;
2693
2693
  instanceMode?: "wait" | "force" | "handover";
2694
2694
  supervisor?: {
2695
2695
  enabled?: boolean;
@@ -3016,9 +3016,9 @@ export declare const unsCoreSchema: z.ZodObject<{
3016
3016
  projectId?: string;
3017
3017
  };
3018
3018
  processName?: string;
3019
- email?: string;
3020
3019
  graphql?: string;
3021
3020
  rest?: string;
3021
+ email?: string;
3022
3022
  instanceMode?: "wait" | "force" | "handover";
3023
3023
  supervisor?: {
3024
3024
  enabled?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"uns-core-schema.js","sourceRoot":"","sources":["../../src/uns-config/uns-core-sch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port { z } from \"zod\";\nimport { secretValueSchema } from \"./secret-placeholders.js\";\nimport { hostValueSchema } from \"./host-placeholders.js\";\n\nconst mqttProtocolSchema = z.enum([\"mqtt\", \"mqtts\", \"ws\", \"wss\", \"tcp\", \"ssl\"]);\n\nconst mqttServerSchema = z.object({\n host: hostValueSchema,\n port: z.number().int().positive().optional(),\n protocol: mqttProtocolSchema.optional(),\n}).strict();\n\nconst mqttConnectPropertiesSchema = z.object({\n sessionExpiryInterval: z.number().int().nonnegative().optional(),\n receiveMaximum: z.number().int().positive().optional(),\n maximumPacketSize: z.number().int().positive().optional(),\n topicAliasMaximum: z.number().int().nonnegative().optional(),\n requestResponseInformation: z.boolean().optional(),\n requestProblemInformation: z.boolean().optional(),\n userProperties: z.record(z.string()).optional(),\n}).strict();\n\nconst loggingLevelSchema = z.enum([\n \"error\",\n \"warn\",\n \"info\",\n \"http\",\n \"verbose\",\n \"debug\",\n \"silly\",\n]);\n\nconst supervisorSchema = z.object({\n enabled: z\n .boolean()\n .default(false)\n .describe(\"Enable controller/PM2 supervisor handling for this RTT instance.\"),\n restartOnExit: z\n .boolean()\n .default(false)\n .describe(\"Let PM2 restart the process when it exits unexpectedly.\"),\n maxMemoryMb: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\"Optional PM2 memory restart limit in megabytes.\"),\n restartOnUnhealthy: z\n .boolean()\n .default(false)\n .describe(\"Let the controller auto-start this instance when required system-service runtime signals are absent.\"),\n unhealthyAfterMs: z\n .number()\n .int()\n .positive()\n .default(60_000)\n .describe(\"How long runtime signals must stay unhealthy before the controller supervisor can act.\"),\n restartCooldownMs: z\n .number()\n .int()\n .positive()\n .default(300_000)\n .describe(\"Minimum time between controller supervisor restart attempts for this instance.\"),\n}).strict().describe(\"Optional PM2/controller supervisor guard settings for this RTT instance.\");\n\nexport const mqttChannelSchema = z.object({\n host: hostValueSchema.optional(),\n hosts: z.array(hostValueSchema).optional(),\n servers: z.array(mqttServerSchema).optional(),\n port: z.number().int().positive().optional(),\n protocol: mqttProtocolSchema.optional(),\n username: z.string().optional(),\n password: secretValueSchema.optional(),\n clientId: z.string().optional(),\n clean: z.boolean().optional(),\n keepalive: z.number().int().nonnegative().optional(),\n connectTimeout: z.number().int().nonnegative().optional(),\n reconnectPeriod: z.number().int().nonnegative().optional(),\n reconnectOnConnackError: z.boolean().optional(),\n resubscribe: z.boolean().optional(),\n queueQoSZero: z.boolean().optional(),\n rejectUnauthorized: z.boolean().optional(),\n properties: mqttConnectPropertiesSchema.optional(),\n ca: z.string().optional(),\n cert: z.string().optional(),\n key: z.string().optional(),\n servername: z.string().optional(),\n}).strict().refine((value) => {\n return !!value.host || (Array.isArray(value.hosts) && value.hosts.length > 0) || (Array.isArray(value.servers) && value.servers.length > 0);\n}, {\n message: \"One of host, hosts, or servers must be provided.\",\n});\n\nexport const unsCoreSchema = z.object({\n uns: z.object({\n graphql: z.string().url(),\n rest: z.string().url(),\n email: z.string().email().describe(\"Email used when authenticating to graphql endpoint of the UNS instance.\"),\n password: secretValueSchema.describe(\"Password or secret value paired with the UNS email.\"),\n instanceMode: z.enum([\"wait\", \"force\", \"handover\"]).default(\"wait\"),\n processName: z\n .string()\n .min(1)\n .describe(\"Process name used in MQTT topics and logs.\"),\n handover: z.boolean().default(true),\n supervisor: supervisorSchema.optional(),\n jwksWellKnownUrl: z.string().url().optional(),\n kidWellKnownUrl: z.string().url().optional(),\n env: z.enum([\"dev\", \"staging\", \"test\", \"prod\"]).default(\"dev\"),\n }).strict(),\n\n logging: z.object({\n adapter: z.string().min(1).default(\"udp\"),\n host: hostValueSchema,\n port: z.number().int().positive().default(12201),\n level: loggingLevelSchema.default(\"info\"),\n }).strict().optional(),\n\n input: mqttChannelSchema.optional(),\n output: mqttChannelSchema.optional(),\n infra: mqttChannelSchema,\n devops: z.object({\n provider: z.enum([\"azure-devops\"]).default(\"azure-devops\"),\n organization: z.string().min(1),\n project: z.string().min(1).optional(),\n }).strict().optional(),\n}).strict();\n\nexport type UnsCore = z.infer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C,QAAQ,EAAE;CACvB,CAAC,CAAC,MAAM,EAAE,CAAC","sourcesContent":["// src/uns-config/uns-core-schema.ts\r\nimport { z } from \"zod\";\r\nimport { secretValueSchema } from \"./secret-placeholders.js\";\r\nimport { hostValueSchema } from \"./host-placeholders.js\";\r\n\r\nconst mqttProtocolSchema = z.enum([\"mqtt\", \"mqtts\", \"ws\", \"wss\", \"tcp\", \"ssl\"]);\r\n\r\nconst mqttServerSchema = z.object({\r\n host: hostValueSchema,\r\n port: z.number().int().positive().optional(),\r\n protocol: mqttProtocolSchema.optional(),\r\n}).strict();\r\n\r\nconst mqttConnectPropertiesSchema = z.object({\r\n sessionExpiryInterval: z.number().int().nonnegative().optional(),\r\n receiveMaximum: z.number().int().positive().optional(),\r\n maximumPacketSize: z.number().int().positive().optional(),\r\n topicAliasMaximum: z.number().int().nonnegative().optional(),\r\n requestResponseInformation: z.boolean().optional(),\r\n requestProblemInformation: z.boolean().optional(),\r\n userProperties: z.record(z.string()).optional(),\r\n}).strict();\r\n\r\nconst loggingLevelSchema = z.enum([\r\n \"error\",\r\n \"warn\",\r\n \"info\",\r\n \"http\",\r\n \"verbose\",\r\n \"debug\",\r\n \"silly\",\r\n]);\r\n\r\nconst supervisorSchema = z.object({\r\n enabled: z\r\n .boolean()\r\n .default(false)\r\n .describe(\"Enable controller/PM2 supervisor handling for this RTT instance.\"),\r\n restartOnExit: z\r\n .boolean()\r\n .default(false)\r\n .describe(\"Let PM2 restart the process when it exits unexpectedly.\"),\r\n maxMemoryMb: z\r\n .number()\r\n .int()\r\n .positive()\r\n .optional()\r\n .describe(\"Optional PM2 memory restart limit in megabytes.\"),\r\n restartOnUnhealthy: z\r\n .boolean()\r\n .default(false)\r\n .describe(\"Let the controller auto-start this instance when required system-service runtime signals are absent.\"),\r\n unhealthyAfterMs: z\r\n .number()\r\n .int()\r\n .positive()\r\n .default(60_000)\r\n .describe(\"How long runtime signals must stay unhealthy before the controller supervisor can act.\"),\r\n restartCooldownMs: z\r\n .number()\r\n .int()\r\n .positive()\r\n .default(300_000)\r\n .describe(\"Minimum time between controller supervisor restart attempts for this instance.\"),\r\n}).strict().describe(\"Optional PM2/controller supervisor guard settings for this RTT instance.\");\r\n\r\nexport const mqttChannelSchema = z.object({\r\n host: hostValueSchema.optional(),\r\n hosts: z.array(hostValueSchema).optional(),\r\n servers: z.array(mqttServerSchema).optional(),\r\n port: z.number().int().positive().optional(),\r\n protocol: mqttProtocolSchema.optional(),\r\n username: z.string().optional(),\r\n password: secretValueSchema.optional(),\r\n clientId: z.string().optional(),\r\n clean: z.boolean().optional(),\r\n keepalive: z.number().int().nonnegative().optional(),\r\n connectTimeout: z.number().int().nonnegative().optional(),\r\n reconnectPeriod: z.number().int().nonnegative().optional(),\r\n reconnectOnConnackError: z.boolean().optional(),\r\n resubscribe: z.boolean().optional(),\r\n queueQoSZero: z.boolean().optional(),\r\n rejectUnauthorized: z.boolean().optional(),\r\n properties: mqttConnectPropertiesSchema.optional(),\r\n ca: z.string().optional(),\r\n cert: z.string().optional(),\r\n key: z.string().optional(),\r\n servername: z.string().optional(),\r\n}).strict().refine((value) => {\r\n return !!value.host || (Array.isArray(value.hosts) && value.hosts.length > 0) || (Array.isArray(value.servers) && value.servers.length > 0);\r\n}, {\r\n message: \"One of host, hosts, or servers must be provided.\",\r\n});\r\n\r\nexport const unsCoreSchema = z.object({\r\n uns: z.object({\r\n graphql: z.string().url(),\r\n rest: z.string().url(),\r\n email: z.string().email().describe(\"Email used when authenticating to graphql endpoint of the UNS instance.\"),\r\n password: secretValueSchema.describe(\"Password or secret value paired with the UNS email.\"),\r\n instanceMode: z.enum([\"wait\", \"force\", \"handover\"]).default(\"wait\"),\r\n processName: z\r\n .string()\r\n .min(1)\r\n .describe(\"Process name used in MQTT topics and logs.\"),\r\n handover: z.boolean().default(true),\r\n supervisor: supervisorSchema.optional(),\r\n jwksWellKnownUrl: z.string().url().optional(),\r\n kidWellKnownUrl: z.string().url().optional(),\r\n env: z.enum([\"dev\", \"staging\", \"test\", \"prod\"]).default(\"dev\"),\r\n }).strict(),\r\n\r\n logging: z.object({\r\n adapter: z.string().min(1).default(\"udp\"),\r\n host: hostValueSchema,\r\n port: z.number().int().positive().default(12201),\r\n level: loggingLevelSchema.default(\"info\"),\r\n }).strict().optional(),\r\n\r\n input: mqttChannelSchema.optional(),\r\n output: mqttChannelSchema.optional(),\r\n infra: mqttChannelSchema,\r\n devops: z.object({\r\n provider: z.enum([\"azure-devops\"]).default(\"azure-devops\"),\r\n organization: z.string().min(1),\r\n project: z.string().min(1).optional(),\r\n }).strict().optional(),\r\n}).strict();\r\n\r\nexport type UnsCore = z.infer<typeof unsCoreSchema>;\r\n"]}
@@ -1,104 +1,104 @@
1
- syntax = "proto3";
2
-
3
- package uns;
4
-
5
- service UnsGateway {
6
- rpc Publish (PublishRequest) returns (Ack);
7
- rpc Subscribe (SubscribeRequest) returns (stream MqttMessage);
8
- rpc RegisterApiGet (RegisterApiGetRequest) returns (Ack);
9
- rpc UnregisterApiGet (UnregisterApiGetRequest) returns (Ack);
10
- rpc ApiEventStream (stream ApiEventResponse) returns (stream ApiEvent);
11
- rpc Ready (ReadyRequest) returns (Ack);
12
- }
13
-
14
- message PublishRequest {
15
- string topic = 1;
16
- string attribute = 2;
17
- string description = 3;
18
- repeated string tags = 4;
19
- bool attribute_needs_persistence = 5;
20
- oneof content {
21
- Data data = 6;
22
- Table table = 7;
23
- }
24
- bool value_is_cumulative = 8; // for Data: publish as delta
25
- }
26
-
27
- message Data {
28
- string time = 1;
29
- double value_number = 2;
30
- string value_string = 3;
31
- string uom = 4;
32
- string data_group = 5;
33
- string foreign_event_key = 6;
34
- }
35
-
36
- message TableValue {
37
- string name = 1;
38
- string type = 2; // QuestDB column type (e.g., int, double, geohash(5c))
39
- string uom = 3; // Optional unit of measure
40
- double value_number = 4;
41
- string value_string = 5;
42
- }
43
-
44
- message Table {
45
- string time = 1;
46
- repeated TableValue columns = 2;
47
- string data_group = 3;
48
- }
49
-
50
- message SubscribeRequest {
51
- repeated string topics = 1;
52
- }
53
-
54
- message MqttMessage {
55
- string topic = 1;
56
- string payload = 2; // UNS packet JSON
57
- }
58
-
59
- message Ack {
60
- bool ok = 1;
61
- string error = 2;
62
- }
63
-
64
- message ReadyRequest {
65
- int32 timeout_ms = 1; // default 15000
66
- bool wait_output = 2; // wait for publisher active (output)
67
- bool wait_input = 3; // wait for subscriber active (input)
68
- bool wait_api = 4; // wait for API server (optional)
69
- }
70
-
71
- message ApiQueryParam {
72
- string name = 1;
73
- string type = 2; // string | number | boolean
74
- bool required = 3;
75
- string description = 4;
76
- }
77
-
78
- message RegisterApiGetRequest {
79
- string topic = 1;
80
- string attribute = 2;
81
- string api_description = 3;
82
- repeated string tags = 4;
83
- repeated ApiQueryParam query_params = 5;
84
- }
85
-
86
- message UnregisterApiGetRequest {
87
- string topic = 1;
88
- string attribute = 2;
89
- }
90
-
91
- message ApiEvent {
92
- string id = 1;
93
- string method = 2; // GET only for now
94
- string path = 3; // /{topic}{attribute}
95
- map<string, string> query = 4;
96
- string bearer = 5; // access token (optional)
97
- }
98
-
99
- message ApiEventResponse {
100
- string id = 1; // correlation
101
- int32 status = 2; // HTTP status
102
- string body = 3; // response body as string (JSON string if needed)
103
- map<string, string> headers = 4; // optional extra headers
104
- }
1
+ syntax = "proto3";
2
+
3
+ package uns;
4
+
5
+ service UnsGateway {
6
+ rpc Publish (PublishRequest) returns (Ack);
7
+ rpc Subscribe (SubscribeRequest) returns (stream MqttMessage);
8
+ rpc RegisterApiGet (RegisterApiGetRequest) returns (Ack);
9
+ rpc UnregisterApiGet (UnregisterApiGetRequest) returns (Ack);
10
+ rpc ApiEventStream (stream ApiEventResponse) returns (stream ApiEvent);
11
+ rpc Ready (ReadyRequest) returns (Ack);
12
+ }
13
+
14
+ message PublishRequest {
15
+ string topic = 1;
16
+ string attribute = 2;
17
+ string description = 3;
18
+ repeated string tags = 4;
19
+ bool attribute_needs_persistence = 5;
20
+ oneof content {
21
+ Data data = 6;
22
+ Table table = 7;
23
+ }
24
+ bool value_is_cumulative = 8; // for Data: publish as delta
25
+ }
26
+
27
+ message Data {
28
+ string time = 1;
29
+ double value_number = 2;
30
+ string value_string = 3;
31
+ string uom = 4;
32
+ string data_group = 5;
33
+ string foreign_event_key = 6;
34
+ }
35
+
36
+ message TableValue {
37
+ string name = 1;
38
+ string type = 2; // QuestDB column type (e.g., int, double, geohash(5c))
39
+ string uom = 3; // Optional unit of measure
40
+ double value_number = 4;
41
+ string value_string = 5;
42
+ }
43
+
44
+ message Table {
45
+ string time = 1;
46
+ repeated TableValue columns = 2;
47
+ string data_group = 3;
48
+ }
49
+
50
+ message SubscribeRequest {
51
+ repeated string topics = 1;
52
+ }
53
+
54
+ message MqttMessage {
55
+ string topic = 1;
56
+ string payload = 2; // UNS packet JSON
57
+ }
58
+
59
+ message Ack {
60
+ bool ok = 1;
61
+ string error = 2;
62
+ }
63
+
64
+ message ReadyRequest {
65
+ int32 timeout_ms = 1; // default 15000
66
+ bool wait_output = 2; // wait for publisher active (output)
67
+ bool wait_input = 3; // wait for subscriber active (input)
68
+ bool wait_api = 4; // wait for API server (optional)
69
+ }
70
+
71
+ message ApiQueryParam {
72
+ string name = 1;
73
+ string type = 2; // string | number | boolean
74
+ bool required = 3;
75
+ string description = 4;
76
+ }
77
+
78
+ message RegisterApiGetRequest {
79
+ string topic = 1;
80
+ string attribute = 2;
81
+ string api_description = 3;
82
+ repeated string tags = 4;
83
+ repeated ApiQueryParam query_params = 5;
84
+ }
85
+
86
+ message UnregisterApiGetRequest {
87
+ string topic = 1;
88
+ string attribute = 2;
89
+ }
90
+
91
+ message ApiEvent {
92
+ string id = 1;
93
+ string method = 2; // GET only for now
94
+ string path = 3; // /{topic}{attribute}
95
+ map<string, string> query = 4;
96
+ string bearer = 5; // access token (optional)
97
+ }
98
+
99
+ message ApiEventResponse {
100
+ string id = 1; // correlation
101
+ int32 status = 2; // HTTP status
102
+ string body = 3; // response body as string (JSON string if needed)
103
+ map<string, string> headers = 4; // optional extra headers
104
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uns-kit/core",
3
- "version": "2.0.43",
3
+ "version": "2.0.45",
4
4
  "description": "Core utilities and runtime building blocks for UNS-based realtime transformers.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,8 +0,0 @@
1
- /**
2
- * Retrieves a persistent process name.
3
- * - Checks if a process name is provided via command-line args.
4
- * - Otherwise, reads the process name from a file.
5
- * - If the file does not exist, generates a new name and stores it.
6
- */
7
- export declare function getProcessName(): string;
8
- //# sourceMappingURL=process-name-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"process-name-service.d.ts","sourceRoot":"","sources":["../../src/uns/process-name-service.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAoBvC"}
@@ -1,29 +0,0 @@
1
- import { readFileSync, writeFileSync } from "fs";
2
- import { PROCESS_NAME_FILE } from "./process-config.js";
3
- import logger from "../logger.js";
4
- /**
5
- * Retrieves a persistent process name.
6
- * - Checks if a process name is provided via command-line args.
7
- * - Otherwise, reads the process name from a file.
8
- * - If the file does not exist, generates a new name and stores it.
9
- */
10
- export function getProcessName() {
11
- // Try to read the process name from the configuration file.
12
- try {
13
- return readFileSync(PROCESS_NAME_FILE, "utf8").trim();
14
- }
15
- catch {
16
- // Generate a new process name if reading fails
17
- const chars = "abcdefghijklmnopqrstuvwxyz0123456789";
18
- const newProcessName = Array.from({ length: 6 }, () => chars.charAt(Math.floor(Math.random() * chars.length))).join("");
19
- // Write the new process name to the file for persistence
20
- try {
21
- writeFileSync(PROCESS_NAME_FILE, newProcessName, "utf8");
22
- }
23
- catch (err) {
24
- logger.error("Failed to write process name file:", err);
25
- }
26
- return newProcessName;
27
- }
28
- }
29
- //# sourceMappingURL=process-name-service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"process-name-service.js","sourceRoot":"","sources":["../../src/uns/process-name-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,cAAc;IAC5B,4DAA4D;IAC5D,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,+CAA+C;QAC/C,MAAM,KAAK,GAAG,sCAAsC,CAAC;QACrD,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CACpD,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CACvD,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEX,yDAAyD;QACzD,IAAI,CAAC;YACH,aAAa,CAAC,iBAAiB,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,oCAAoC,EAAE,GAAG,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;AACH,CAAC","sourcesContent":["import { readFileSync, writeFileSync } from \"fs\";\nimport { PROCESS_NAME_FILE } from \"./process-config.js\";\nimport logger from \"../logger.js\";\n\n/**\n * Retrieves a persistent process name.\n * - Checks if a process name is provided via command-line args.\n * - Otherwise, reads the process name from a file.\n * - If the file does not exist, generates a new name and stores it.\n */\nexport function getProcessName(): string {\n // Try to read the process name from the configuration file.\n try {\n return readFileSync(PROCESS_NAME_FILE, \"utf8\").trim();\n } catch {\n // Generate a new process name if reading fails\n const chars = \"abcdefghijklmnopqrstuvwxyz0123456789\";\n const newProcessName = Array.from({ length: 6 }, () =>\n chars.charAt(Math.floor(Math.random() * chars.length))\n ).join(\"\");\n\n // Write the new process name to the file for persistence\n try {\n writeFileSync(PROCESS_NAME_FILE, newProcessName, \"utf8\");\n } catch (err) {\n logger.error(\"Failed to write process name file:\", err);\n }\n\n return newProcessName;\n }\n}\n"]}