@uns-kit/core 1.0.9 → 1.0.11
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/dist/tools/generate-uns-dictionary.js +5 -1
- package/dist/tools/generate-uns-dictionary.js.map +1 -1
- package/dist/uns/uns-dictionary.generated.d.ts +72 -0
- package/dist/uns/uns-dictionary.generated.d.ts.map +1 -1
- package/dist/uns/uns-dictionary.generated.js +72 -0
- package/dist/uns/uns-dictionary.generated.js.map +1 -1
- package/dist/uns/uns-proxy.js.map +1 -1
- package/package.json +1 -1
|
@@ -237,7 +237,11 @@ async function writeDictionaryTs(dictionary, filePath, lang) {
|
|
|
237
237
|
const objectTypeEntries = Object.entries(dictionary.objectTypes ?? {});
|
|
238
238
|
const attributeEntries = Object.entries(dictionary.attributes ?? {});
|
|
239
239
|
const renderRecord = (entries) => entries
|
|
240
|
-
.map(([name]) =>
|
|
240
|
+
.map(([name, entry]) => {
|
|
241
|
+
const desc = resolveDescription(entry, lang);
|
|
242
|
+
const doc = desc ? ` /** ${desc} */\n` : "";
|
|
243
|
+
return `${doc} "${name}": "${name}",`;
|
|
244
|
+
})
|
|
241
245
|
.join("\n");
|
|
242
246
|
const renderDescriptions = (entries) => entries
|
|
243
247
|
.map(([name, value]) => ` "${name}": ${JSON.stringify(resolveDescription(value, lang) ?? "")},`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-uns-dictionary.js","sourceRoot":"","sources":["../../src/tools/generate-uns-dictionary.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;A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CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC;SAChG,IAAI,CAAC,IAAI,CAAC,CAAC;IAEhB,MAAM,eAAe,GAAG,0CAA0C,YAAY,CAAC,iBAAiB,CAAC,eAAe,CAAC;IACjH,MAAM,mBAAmB,GAAG,wGAAwG,kBAAkB,CAAC,iBAAiB,CAAC,MAAM,CAAC;IAEhL,MAAM,cAAc,GAAG,yCAAyC,YAAY,CAAC,gBAAgB,CAAC,eAAe,CAAC;IAC9G,MAAM,kBAAkB,GAAG,sGAAsG,kBAAkB,CAAC,gBAAgB,CAAC,MAAM,CAAC;IAE5K,MAAM,OAAO,GAAG,6EAA6E,eAAe,OAAO,mBAAmB,wQAAwQ,cAAc,OAAO,kBAAkB,iQAAiQ,CAAC;IAEvrB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IACvD,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,MAAM,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,wBAAwB,GAAG,aAAa,CAAC;;;;;;;;;;;CAW9C,CAAC;AAEF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;IAC3D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * Generate a TypeScript dictionary of object types and attributes (with descriptions)\n * from a JSON file or by fetching from GraphQL. The output is meant for IntelliSense\n * and metadata enrichment (e.g., emitting descriptions alongside topics).\n *\n * JSON shape (example):\n * {\n * \"objectTypes\": {\n * \"energy-resource\": { \"description\": \"Energy carriers (electricity/steam/gas)\" },\n * \"custom-type\": { \"description\": \"Tenant-specific thing\" }\n * },\n * \"attributes\": {\n * \"cumulative-active-energy-delivered\": { \"description\": \"kWh total\" },\n * \"status\": { \"description\": \"Generic status\" }\n * }\n * }\n */\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { GraphQLClient, ClientError, gql } from \"graphql-request\";\nimport { ConfigFile } from \"../config-file.js\";\nimport { AuthClient } from \"./auth/index.js\";\n\ntype DictionaryEntry = {\n description?: string | null;\n descriptions?: Record<string, string | null | undefined>;\n};\ntype UnsDictionary = {\n objectTypes?: Record<string, DictionaryEntry>;\n attributes?: Record<string, DictionaryEntry>;\n};\n\ntype CliArgs = {\n input: string;\n output: string;\n jsonOut: string;\n fromGraphql: boolean;\n queryFile?: string;\n writeMergedJson: boolean;\n priority: \"overlay\" | \"base\";\n lang: string;\n};\n\nconst DEFAULT_INPUT = \"uns-dictionary.json\";\nconst DEFAULT_OUTPUT = path.resolve(process.cwd(), \"src/uns/uns-dictionary.generated.ts\");\nconst DEFAULT_JSON_OUT = path.resolve(process.cwd(), DEFAULT_INPUT);\n\nasync function main(): Promise<void> {\n const args = parseArgs(process.argv.slice(2));\n\n const baseDictionary = await readDictionaryIfExists(args.input);\n const overlayDictionary = args.fromGraphql\n ? await fetchDictionaryFromGraphql(args.queryFile)\n : {};\n\n const { merged, differences } = mergeDictionaries(baseDictionary, overlayDictionary, args.priority, args.lang);\n\n if (differences.length) {\n console.log(\"Overlay changes applied:\");\n for (const diff of differences) {\n console.log(` [${diff.section}] ${diff.key}: \"${diff.from ?? \"\"}\" -> \"${diff.to ?? \"\"}\"`);\n }\n } else {\n console.log(\"No overlay changes applied.\");\n }\n\n // Persist the merged JSON only when explicitly requested.\n if (args.writeMergedJson) {\n await writeJson(merged, args.jsonOut);\n }\n\n await writeDictionaryTs(merged, args.output, args.lang);\n console.log(`Generated dictionary -> ${args.output}`);\n}\n\nfunction parseArgs(argv: string[]): CliArgs {\n let input = DEFAULT_INPUT;\n let output = DEFAULT_OUTPUT;\n let jsonOut = DEFAULT_JSON_OUT;\n let fromGraphql = false;\n let queryFile: string | undefined;\n let writeMergedJson = false;\n let priority: \"overlay\" | \"base\" = \"overlay\";\n let lang = \"sl\";\n\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg === \"--input\" && argv[i + 1]) {\n input = argv[++i];\n continue;\n }\n if (arg === \"--output\" && argv[i + 1]) {\n output = argv[++i];\n continue;\n }\n if (arg === \"--json-out\" && argv[i + 1]) {\n jsonOut = argv[++i];\n continue;\n }\n if (arg === \"--write-merged-json\") {\n writeMergedJson = true;\n continue;\n }\n if (arg === \"--from-graphql\") {\n fromGraphql = true;\n continue;\n }\n if (arg === \"--query-file\" && argv[i + 1]) {\n queryFile = argv[++i];\n continue;\n }\n if (arg === \"--priority\" && argv[i + 1]) {\n const val = argv[++i];\n if (val !== \"overlay\" && val !== \"base\") {\n throw new Error(`Invalid priority \"${val}\". Use \"overlay\" or \"base\".`);\n }\n priority = val;\n continue;\n }\n if (arg === \"--lang\" && argv[i + 1]) {\n lang = argv[++i];\n continue;\n }\n if (arg === \"--help\" || arg === \"-h\") {\n printHelp();\n process.exit(0);\n }\n throw new Error(`Unknown argument: ${arg}`);\n }\n\n return { input, output, jsonOut, fromGraphql, queryFile, writeMergedJson, priority, lang };\n}\n\nfunction printHelp(): void {\n console.log(`Usage: tsx packages/uns-core/src/tools/generate-uns-dictionary.ts [options]\n\nOptions:\n --input <file> Path to uns-dictionary.json (default: ${DEFAULT_INPUT})\n --output <file> Path to generated TS file (default: src/uns/uns-dictionary.generated.ts)\n --json-out <file> Where to write merged JSON (default: ${DEFAULT_JSON_OUT})\n --write-merged-json Persist the merged JSON (otherwise JSON is left untouched)\n --from-graphql Fetch dictionary from GraphQL instead of reading local JSON\n --query-file <file> Optional .graphql/.gql file to override the default query\n --priority <p> Merge priority: \"overlay\" (default) or \"base\" (keep base descriptions)\n --lang <code> Preferred description language code (default: \"sl\")\n --help, -h Show this help\n`);\n}\n\nasync function readDictionaryFromJson(filePath: string): Promise<UnsDictionary> {\n const absolute = path.resolve(process.cwd(), filePath);\n const raw = await readFile(absolute, \"utf8\");\n return JSON.parse(raw) as UnsDictionary;\n}\n\nasync function readDictionaryIfExists(filePath: string): Promise<UnsDictionary> {\n try {\n return await readDictionaryFromJson(filePath);\n } catch (error: any) {\n if (error?.code === \"ENOENT\") {\n return {};\n }\n throw error;\n }\n}\n\nasync function fetchDictionaryFromGraphql(queryFile?: string): Promise<UnsDictionary> {\n const config = await ConfigFile.loadConfig();\n const auth = await AuthClient.create();\n let accessToken = await auth.getAccessToken();\n\n const client = new GraphQLClient(config.uns.graphql, {\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n\n const querySource = queryFile\n ? await readFile(path.resolve(process.cwd(), queryFile), \"utf8\")\n : DEFAULT_DICTIONARY_QUERY;\n\n const document = gql`${querySource}`;\n\n async function requestWithAuth<T>(documentToRun: any): Promise<T> {\n try {\n return await client.request<T>(documentToRun);\n } catch (err: any) {\n const isAuthErr = err instanceof ClientError && (err.response.status === 401 || err.response.status === 403);\n if (isAuthErr) {\n accessToken = await auth.getAccessToken();\n client.setHeader(\"Authorization\", `Bearer ${accessToken}`);\n return await client.request<T>(documentToRun);\n }\n throw err;\n }\n }\n\n const data: any = await requestWithAuth(document);\n\n const objectTypeArray =\n data?.GetObjectTypes ??\n data?.objectTypes ??\n data?.unsDictionary?.objectTypes ??\n [];\n\n const attributeArray =\n data?.GetAttributes ??\n data?.attributes ??\n data?.unsDictionary?.attributes ??\n [];\n\n const objectTypes: Record<string, DictionaryEntry> = {};\n for (const item of objectTypeArray) {\n if (item?.name) {\n objectTypes[item.name] = { description: item.description ?? undefined };\n }\n }\n\n const attributes: Record<string, DictionaryEntry> = {};\n for (const item of attributeArray) {\n if (item?.name) {\n attributes[item.name] = { description: item.description ?? undefined };\n }\n }\n\n return { objectTypes, attributes };\n}\n\nasync function writeJson(dictionary: UnsDictionary, filePath: string): Promise<void> {\n const absolute = path.resolve(process.cwd(), filePath);\n await mkdir(path.dirname(absolute), { recursive: true });\n await writeFile(absolute, JSON.stringify(dictionary, null, 2) + \"\\n\", \"utf8\");\n console.log(`Wrote dictionary JSON -> ${absolute}`);\n}\n\ntype Diff = { section: \"objectTypes\" | \"attributes\"; key: string; from?: string; to?: string };\n\nconst resolveDescription = (entry: DictionaryEntry | undefined, lang: string): string | undefined => {\n if (!entry) return undefined;\n const byLang = entry.descriptions?.[lang];\n if (byLang && byLang.length > 0) return byLang;\n if (entry.description && entry.description.length > 0) return entry.description;\n return undefined;\n};\n\nfunction mergeDictionaries(base: UnsDictionary, overlay: UnsDictionary, priority: \"overlay\" | \"base\", lang: string): { merged: UnsDictionary; differences: Diff[] } {\n const differences: Diff[] = [];\n\n const mergeSection = (\n baseSection: Record<string, DictionaryEntry> = {},\n overlaySection: Record<string, DictionaryEntry> = {},\n section: Diff[\"section\"],\n ) => {\n const result: Record<string, DictionaryEntry> = { ...baseSection };\n for (const [key, value] of Object.entries(overlaySection)) {\n const baseEntry = result[key];\n const mergedEntry: DictionaryEntry = {\n ...(baseEntry ?? {}),\n descriptions: { ...(baseEntry?.descriptions ?? {}), ...(value.descriptions ?? {}) },\n };\n\n if (value.description !== undefined) {\n mergedEntry.description = value.description ?? undefined;\n }\n\n if (!baseEntry) {\n result[key] = mergedEntry;\n const toDesc = resolveDescription(mergedEntry, lang) ?? \"\";\n differences.push({ section, key, from: undefined, to: toDesc });\n continue;\n }\n\n const baseDesc = resolveDescription(baseEntry, lang);\n const overlayDesc = resolveDescription(value, lang);\n const shouldOverride = priority === \"overlay\" && overlayDesc && overlayDesc.length > 0;\n\n if (shouldOverride && overlayDesc !== baseDesc) {\n differences.push({ section, key, from: baseDesc ?? \"\", to: overlayDesc });\n // mergedEntry already contains overlay descriptions; resolved value will pick it up.\n }\n\n result[key] = mergedEntry;\n }\n return result;\n };\n\n const merged = {\n objectTypes: mergeSection(base.objectTypes, overlay.objectTypes, \"objectTypes\"),\n attributes: mergeSection(base.attributes, overlay.attributes, \"attributes\"),\n };\n\n return { merged, differences };\n}\n\nasync function writeDictionaryTs(dictionary: UnsDictionary, filePath: string, lang: string): Promise<void> {\n const objectTypeEntries = Object.entries(dictionary.objectTypes ?? {});\n const attributeEntries = Object.entries(dictionary.attributes ?? {});\n\n const renderRecord = (entries: [string, DictionaryEntry][]) =>\n entries\n .map(([name]) => ` \"${name}\": \"${name}\",`)\n .join(\"\\n\");\n\n const renderDescriptions = (entries: [string, DictionaryEntry][]) =>\n entries\n .map(([name, value]) => ` \"${name}\": ${JSON.stringify(resolveDescription(value, lang) ?? \"\")},`)\n .join(\"\\n\");\n\n const objectTypeConst = `export const GeneratedObjectTypes = {\\n${renderRecord(objectTypeEntries)}\\n} as const;`;\n const objectTypeDescConst = `export const GeneratedObjectTypeDescriptions: Record<keyof typeof GeneratedObjectTypes, string> = {\\n${renderDescriptions(objectTypeEntries)}\\n};`;\n\n const attributeConst = `export const GeneratedAttributes = {\\n${renderRecord(attributeEntries)}\\n} as const;`;\n const attributeDescConst = `export const GeneratedAttributeDescriptions: Record<keyof typeof GeneratedAttributes, string> = {\\n${renderDescriptions(attributeEntries)}\\n};`;\n\n const content = `/* Auto-generated by generate-uns-dictionary.ts. Do not edit by hand. */\\n${objectTypeConst}\\n\\n${objectTypeDescConst}\\n\\nexport type GeneratedObjectTypeName = keyof typeof GeneratedObjectTypes;\\n\\nexport function getGeneratedObjectTypeDescription(name: string): string | undefined {\\n return (GeneratedObjectTypeDescriptions as Record<string, string | undefined>)[name];\\n}\\n\\n${attributeConst}\\n\\n${attributeDescConst}\\n\\nexport type GeneratedAttributeName = keyof typeof GeneratedAttributes;\\n\\nexport function getGeneratedAttributeDescription(name: string): string | undefined {\\n return (GeneratedAttributeDescriptions as Record<string, string | undefined>)[name];\\n}\\n`;\n\n const absolute = path.resolve(process.cwd(), filePath);\n await mkdir(path.dirname(absolute), { recursive: true });\n await writeFile(absolute, content, \"utf8\");\n}\n\nconst DEFAULT_DICTIONARY_QUERY = /* GraphQL */ `\n query GetUnsDictionary {\n GetObjectTypes {\n name\n description\n }\n GetAttributes {\n name\n description\n }\n }\n`;\n\nmain().catch((error) => {\n console.error(\"Failed to generate UNS dictionary:\", error);\n process.exitCode = 1;\n});\n"]}
|
|
1
|
+
{"version":3,"file":"generate-uns-dictionary.js","sourceRoot":"","sources":["../../src/tools/generate-uns-dictionary.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAsB7C,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAC5C,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,qCAAqC,CAAC,CAAC;AAC1F,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;AAEpE,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9C,MAAM,cAAc,GAAG,MAAM,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW;QACxC,CAAC,CAAC,MAAM,0BAA0B,CAAC,IAAI,CAAC,SAAS,CAAC;QAClD,CAAC,CAAC,EAAE,CAAC;IAE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AC;IAE5K,MAAM,OAAO,GAAG,6EAA6E,eAAe,OAAO,mBAAmB,wQAAwQ,cAAc,OAAO,kBAAkB,iQAAiQ,CAAC;IAEvrB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IACvD,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,MAAM,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,wBAAwB,GAAG,aAAa,CAAC;;;;;;;;;;;CAW9C,CAAC;AAEF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;IAC3D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * Generate a TypeScript dictionary of object types and attributes (with descriptions)\n * from a JSON file or by fetching from GraphQL. The output is meant for IntelliSense\n * and metadata enrichment (e.g., emitting descriptions alongside topics).\n *\n * JSON shape (example):\n * {\n * \"objectTypes\": {\n * \"energy-resource\": { \"description\": \"Energy carriers (electricity/steam/gas)\" },\n * \"custom-type\": { \"description\": \"Tenant-specific thing\" }\n * },\n * \"attributes\": {\n * \"cumulative-active-energy-delivered\": { \"description\": \"kWh total\" },\n * \"status\": { \"description\": \"Generic status\" }\n * }\n * }\n */\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { GraphQLClient, ClientError, gql } from \"graphql-request\";\nimport { ConfigFile } from \"../config-file.js\";\nimport { AuthClient } from \"./auth/index.js\";\n\ntype DictionaryEntry = {\n description?: string | null;\n descriptions?: Record<string, string | null | undefined>;\n};\ntype UnsDictionary = {\n objectTypes?: Record<string, DictionaryEntry>;\n attributes?: Record<string, DictionaryEntry>;\n};\n\ntype CliArgs = {\n input: string;\n output: string;\n jsonOut: string;\n fromGraphql: boolean;\n queryFile?: string;\n writeMergedJson: boolean;\n priority: \"overlay\" | \"base\";\n lang: string;\n};\n\nconst DEFAULT_INPUT = \"uns-dictionary.json\";\nconst DEFAULT_OUTPUT = path.resolve(process.cwd(), \"src/uns/uns-dictionary.generated.ts\");\nconst DEFAULT_JSON_OUT = path.resolve(process.cwd(), DEFAULT_INPUT);\n\nasync function main(): Promise<void> {\n const args = parseArgs(process.argv.slice(2));\n\n const baseDictionary = await readDictionaryIfExists(args.input);\n const overlayDictionary = args.fromGraphql\n ? await fetchDictionaryFromGraphql(args.queryFile)\n : {};\n\n const { merged, differences } = mergeDictionaries(baseDictionary, overlayDictionary, args.priority, args.lang);\n\n if (differences.length) {\n console.log(\"Overlay changes applied:\");\n for (const diff of differences) {\n console.log(` [${diff.section}] ${diff.key}: \"${diff.from ?? \"\"}\" -> \"${diff.to ?? \"\"}\"`);\n }\n } else {\n console.log(\"No overlay changes applied.\");\n }\n\n // Persist the merged JSON only when explicitly requested.\n if (args.writeMergedJson) {\n await writeJson(merged, args.jsonOut);\n }\n\n await writeDictionaryTs(merged, args.output, args.lang);\n console.log(`Generated dictionary -> ${args.output}`);\n}\n\nfunction parseArgs(argv: string[]): CliArgs {\n let input = DEFAULT_INPUT;\n let output = DEFAULT_OUTPUT;\n let jsonOut = DEFAULT_JSON_OUT;\n let fromGraphql = false;\n let queryFile: string | undefined;\n let writeMergedJson = false;\n let priority: \"overlay\" | \"base\" = \"overlay\";\n let lang = \"sl\";\n\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg === \"--input\" && argv[i + 1]) {\n input = argv[++i];\n continue;\n }\n if (arg === \"--output\" && argv[i + 1]) {\n output = argv[++i];\n continue;\n }\n if (arg === \"--json-out\" && argv[i + 1]) {\n jsonOut = argv[++i];\n continue;\n }\n if (arg === \"--write-merged-json\") {\n writeMergedJson = true;\n continue;\n }\n if (arg === \"--from-graphql\") {\n fromGraphql = true;\n continue;\n }\n if (arg === \"--query-file\" && argv[i + 1]) {\n queryFile = argv[++i];\n continue;\n }\n if (arg === \"--priority\" && argv[i + 1]) {\n const val = argv[++i];\n if (val !== \"overlay\" && val !== \"base\") {\n throw new Error(`Invalid priority \"${val}\". Use \"overlay\" or \"base\".`);\n }\n priority = val;\n continue;\n }\n if (arg === \"--lang\" && argv[i + 1]) {\n lang = argv[++i];\n continue;\n }\n if (arg === \"--help\" || arg === \"-h\") {\n printHelp();\n process.exit(0);\n }\n throw new Error(`Unknown argument: ${arg}`);\n }\n\n return { input, output, jsonOut, fromGraphql, queryFile, writeMergedJson, priority, lang };\n}\n\nfunction printHelp(): void {\n console.log(`Usage: tsx packages/uns-core/src/tools/generate-uns-dictionary.ts [options]\n\nOptions:\n --input <file> Path to uns-dictionary.json (default: ${DEFAULT_INPUT})\n --output <file> Path to generated TS file (default: src/uns/uns-dictionary.generated.ts)\n --json-out <file> Where to write merged JSON (default: ${DEFAULT_JSON_OUT})\n --write-merged-json Persist the merged JSON (otherwise JSON is left untouched)\n --from-graphql Fetch dictionary from GraphQL instead of reading local JSON\n --query-file <file> Optional .graphql/.gql file to override the default query\n --priority <p> Merge priority: \"overlay\" (default) or \"base\" (keep base descriptions)\n --lang <code> Preferred description language code (default: \"sl\")\n --help, -h Show this help\n`);\n}\n\nasync function readDictionaryFromJson(filePath: string): Promise<UnsDictionary> {\n const absolute = path.resolve(process.cwd(), filePath);\n const raw = await readFile(absolute, \"utf8\");\n return JSON.parse(raw) as UnsDictionary;\n}\n\nasync function readDictionaryIfExists(filePath: string): Promise<UnsDictionary> {\n try {\n return await readDictionaryFromJson(filePath);\n } catch (error: any) {\n if (error?.code === \"ENOENT\") {\n return {};\n }\n throw error;\n }\n}\n\nasync function fetchDictionaryFromGraphql(queryFile?: string): Promise<UnsDictionary> {\n const config = await ConfigFile.loadConfig();\n const auth = await AuthClient.create();\n let accessToken = await auth.getAccessToken();\n\n const client = new GraphQLClient(config.uns.graphql, {\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n\n const querySource = queryFile\n ? await readFile(path.resolve(process.cwd(), queryFile), \"utf8\")\n : DEFAULT_DICTIONARY_QUERY;\n\n const document = gql`${querySource}`;\n\n async function requestWithAuth<T>(documentToRun: any): Promise<T> {\n try {\n return await client.request<T>(documentToRun);\n } catch (err: any) {\n const isAuthErr = err instanceof ClientError && (err.response.status === 401 || err.response.status === 403);\n if (isAuthErr) {\n accessToken = await auth.getAccessToken();\n client.setHeader(\"Authorization\", `Bearer ${accessToken}`);\n return await client.request<T>(documentToRun);\n }\n throw err;\n }\n }\n\n const data: any = await requestWithAuth(document);\n\n const objectTypeArray =\n data?.GetObjectTypes ??\n data?.objectTypes ??\n data?.unsDictionary?.objectTypes ??\n [];\n\n const attributeArray =\n data?.GetAttributes ??\n data?.attributes ??\n data?.unsDictionary?.attributes ??\n [];\n\n const objectTypes: Record<string, DictionaryEntry> = {};\n for (const item of objectTypeArray) {\n if (item?.name) {\n objectTypes[item.name] = { description: item.description ?? undefined };\n }\n }\n\n const attributes: Record<string, DictionaryEntry> = {};\n for (const item of attributeArray) {\n if (item?.name) {\n attributes[item.name] = { description: item.description ?? undefined };\n }\n }\n\n return { objectTypes, attributes };\n}\n\nasync function writeJson(dictionary: UnsDictionary, filePath: string): Promise<void> {\n const absolute = path.resolve(process.cwd(), filePath);\n await mkdir(path.dirname(absolute), { recursive: true });\n await writeFile(absolute, JSON.stringify(dictionary, null, 2) + \"\\n\", \"utf8\");\n console.log(`Wrote dictionary JSON -> ${absolute}`);\n}\n\ntype Diff = { section: \"objectTypes\" | \"attributes\"; key: string; from?: string; to?: string };\n\nconst resolveDescription = (entry: DictionaryEntry | undefined, lang: string): string | undefined => {\n if (!entry) return undefined;\n const byLang = entry.descriptions?.[lang];\n if (byLang && byLang.length > 0) return byLang;\n if (entry.description && entry.description.length > 0) return entry.description;\n return undefined;\n};\n\nfunction mergeDictionaries(base: UnsDictionary, overlay: UnsDictionary, priority: \"overlay\" | \"base\", lang: string): { merged: UnsDictionary; differences: Diff[] } {\n const differences: Diff[] = [];\n\n const mergeSection = (\n baseSection: Record<string, DictionaryEntry> = {},\n overlaySection: Record<string, DictionaryEntry> = {},\n section: Diff[\"section\"],\n ) => {\n const result: Record<string, DictionaryEntry> = { ...baseSection };\n for (const [key, value] of Object.entries(overlaySection)) {\n const baseEntry = result[key];\n const mergedEntry: DictionaryEntry = {\n ...(baseEntry ?? {}),\n descriptions: { ...(baseEntry?.descriptions ?? {}), ...(value.descriptions ?? {}) },\n };\n\n if (value.description !== undefined) {\n mergedEntry.description = value.description ?? undefined;\n }\n\n if (!baseEntry) {\n result[key] = mergedEntry;\n const toDesc = resolveDescription(mergedEntry, lang) ?? \"\";\n differences.push({ section, key, from: undefined, to: toDesc });\n continue;\n }\n\n const baseDesc = resolveDescription(baseEntry, lang);\n const overlayDesc = resolveDescription(value, lang);\n const shouldOverride = priority === \"overlay\" && overlayDesc && overlayDesc.length > 0;\n\n if (shouldOverride && overlayDesc !== baseDesc) {\n differences.push({ section, key, from: baseDesc ?? \"\", to: overlayDesc });\n // mergedEntry already contains overlay descriptions; resolved value will pick it up.\n }\n\n result[key] = mergedEntry;\n }\n return result;\n };\n\n const merged = {\n objectTypes: mergeSection(base.objectTypes, overlay.objectTypes, \"objectTypes\"),\n attributes: mergeSection(base.attributes, overlay.attributes, \"attributes\"),\n };\n\n return { merged, differences };\n}\n\nasync function writeDictionaryTs(dictionary: UnsDictionary, filePath: string, lang: string): Promise<void> {\n const objectTypeEntries = Object.entries(dictionary.objectTypes ?? {});\n const attributeEntries = Object.entries(dictionary.attributes ?? {});\n\n const renderRecord = (entries: [string, DictionaryEntry][]) =>\n entries\n .map(([name, entry]) => {\n const desc = resolveDescription(entry, lang);\n const doc = desc ? ` /** ${desc} */\\n` : \"\";\n return `${doc} \"${name}\": \"${name}\",`;\n })\n .join(\"\\n\");\n\n const renderDescriptions = (entries: [string, DictionaryEntry][]) =>\n entries\n .map(([name, value]) => ` \"${name}\": ${JSON.stringify(resolveDescription(value, lang) ?? \"\")},`)\n .join(\"\\n\");\n\n const objectTypeConst = `export const GeneratedObjectTypes = {\\n${renderRecord(objectTypeEntries)}\\n} as const;`;\n const objectTypeDescConst = `export const GeneratedObjectTypeDescriptions: Record<keyof typeof GeneratedObjectTypes, string> = {\\n${renderDescriptions(objectTypeEntries)}\\n};`;\n\n const attributeConst = `export const GeneratedAttributes = {\\n${renderRecord(attributeEntries)}\\n} as const;`;\n const attributeDescConst = `export const GeneratedAttributeDescriptions: Record<keyof typeof GeneratedAttributes, string> = {\\n${renderDescriptions(attributeEntries)}\\n};`;\n\n const content = `/* Auto-generated by generate-uns-dictionary.ts. Do not edit by hand. */\\n${objectTypeConst}\\n\\n${objectTypeDescConst}\\n\\nexport type GeneratedObjectTypeName = keyof typeof GeneratedObjectTypes;\\n\\nexport function getGeneratedObjectTypeDescription(name: string): string | undefined {\\n return (GeneratedObjectTypeDescriptions as Record<string, string | undefined>)[name];\\n}\\n\\n${attributeConst}\\n\\n${attributeDescConst}\\n\\nexport type GeneratedAttributeName = keyof typeof GeneratedAttributes;\\n\\nexport function getGeneratedAttributeDescription(name: string): string | undefined {\\n return (GeneratedAttributeDescriptions as Record<string, string | undefined>)[name];\\n}\\n`;\n\n const absolute = path.resolve(process.cwd(), filePath);\n await mkdir(path.dirname(absolute), { recursive: true });\n await writeFile(absolute, content, \"utf8\");\n}\n\nconst DEFAULT_DICTIONARY_QUERY = /* GraphQL */ `\n query GetUnsDictionary {\n GetObjectTypes {\n name\n description\n }\n GetAttributes {\n name\n description\n }\n }\n`;\n\nmain().catch((error) => {\n console.error(\"Failed to generate UNS dictionary:\", error);\n process.exitCode = 1;\n});\n"]}
|
|
@@ -1,78 +1,150 @@
|
|
|
1
1
|
export declare const GeneratedObjectTypes: {
|
|
2
|
+
/** Fizična oprema (stroji, peči, senzorji). Uporablja se za spremljanje stanja, meritev in dogodkov. */
|
|
2
3
|
readonly equipment: "equipment";
|
|
4
|
+
/** Materialne enote (loti, serije, surovine, polizdelki). Za sledljivost, količine in premike. */
|
|
3
5
|
readonly material: "material";
|
|
6
|
+
/** Osebje (operaterji, nadzorniki, tehnologi). Za prisotnost, naloge in status. */
|
|
4
7
|
readonly personnel: "personnel";
|
|
8
|
+
/** Posamezen korak v procesu (npr. valjanje, hlajenje, analiza). Za faze ali aktivnosti procesa. */
|
|
5
9
|
readonly "process-segment": "process-segment";
|
|
10
|
+
/** Definicija izdelka, recepture, tehnični opisi. Za metapodatke izdelka in revizije. */
|
|
6
11
|
readonly "product-definition": "product-definition";
|
|
12
|
+
/** Kazalniki kakovosti izdelka (odstopanja, ocene, rezultati meritev). */
|
|
7
13
|
readonly "product-quality": "product-quality";
|
|
14
|
+
/** Definicija nalog ali delovnih tokov. Za planirane operacije in navodila. */
|
|
8
15
|
readonly "work-definition": "work-definition";
|
|
16
|
+
/** Status kateregakoli vira (material, osebje, oprema). Za razpoložljivost, okvare, izrabo. */
|
|
9
17
|
readonly "resource-status": "resource-status";
|
|
18
|
+
/** Energija (elektrika, para, plin). */
|
|
10
19
|
readonly "energy-resource": "energy-resource";
|
|
20
|
+
/** Utility viri (voda, zrak, dušik, stisnjeni plini). */
|
|
11
21
|
readonly "utility-resource": "utility-resource";
|
|
22
|
+
/** Tekočine in plini, ki niso energenti. */
|
|
12
23
|
readonly "fluid-resource": "fluid-resource";
|
|
24
|
+
/** Maziva, olja, čistila, ki se porabijo in niso del izdelka. */
|
|
13
25
|
readonly "consumable-resource": "consumable-resource";
|
|
14
26
|
};
|
|
15
27
|
export declare const GeneratedObjectTypeDescriptions: Record<keyof typeof GeneratedObjectTypes, string>;
|
|
16
28
|
export declare const GeneratedAttributes: {
|
|
29
|
+
/** Trenutno stanje vira ali opreme. */
|
|
17
30
|
readonly status: "status";
|
|
31
|
+
/** Temperatura vira/opreme. */
|
|
18
32
|
readonly temperature: "temperature";
|
|
33
|
+
/** Merjena vibracija. */
|
|
19
34
|
readonly vibration: "vibration";
|
|
35
|
+
/** Število obratovalnih ur. */
|
|
20
36
|
readonly "operating-hours": "operating-hours";
|
|
37
|
+
/** Koda napake. */
|
|
21
38
|
readonly "fault-code": "fault-code";
|
|
39
|
+
/** Hitrost delovanja. */
|
|
22
40
|
readonly speed: "speed";
|
|
41
|
+
/** Poraba energije. */
|
|
23
42
|
readonly "energy-consumption": "energy-consumption";
|
|
43
|
+
/** Identifikator lota. */
|
|
24
44
|
readonly "lot-id": "lot-id";
|
|
45
|
+
/** Številka serije (batch). */
|
|
25
46
|
readonly "batch-number": "batch-number";
|
|
47
|
+
/** Tip materiala. */
|
|
26
48
|
readonly "material-type": "material-type";
|
|
49
|
+
/** Količina materiala. */
|
|
27
50
|
readonly quantity: "quantity";
|
|
51
|
+
/** Lokacija materiala ali opreme. */
|
|
28
52
|
readonly location: "location";
|
|
53
|
+
/** Prisotnost osebja. */
|
|
29
54
|
readonly presence: "presence";
|
|
55
|
+
/** Identifikator naloge. */
|
|
30
56
|
readonly "task-id": "task-id";
|
|
57
|
+
/** Vloga osebja. */
|
|
31
58
|
readonly role: "role";
|
|
59
|
+
/** Nivo pooblastil. */
|
|
32
60
|
readonly "authorization-level": "authorization-level";
|
|
61
|
+
/** Čas začetka. */
|
|
33
62
|
readonly "start-time": "start-time";
|
|
63
|
+
/** Čas zaključka. */
|
|
34
64
|
readonly "end-time": "end-time";
|
|
65
|
+
/** Trajanje faze ali naloge. */
|
|
35
66
|
readonly duration: "duration";
|
|
67
|
+
/** Izhodna količina. */
|
|
36
68
|
readonly "output-quantity": "output-quantity";
|
|
69
|
+
/** Identifikator operaterja. */
|
|
37
70
|
readonly "operator-id": "operator-id";
|
|
71
|
+
/** Koda izdelka. */
|
|
38
72
|
readonly "product-code": "product-code";
|
|
73
|
+
/** Revizija izdelka. */
|
|
39
74
|
readonly revision: "revision";
|
|
75
|
+
/** Tehnične specifikacije. */
|
|
40
76
|
readonly specification: "specification";
|
|
77
|
+
/** Ciljni parametri izdelka ali procesa. */
|
|
41
78
|
readonly "target-parameters": "target-parameters";
|
|
79
|
+
/** Sestava materiala. */
|
|
42
80
|
readonly "material-composition": "material-composition";
|
|
81
|
+
/** Zgodovina verzij. */
|
|
43
82
|
readonly "version-history": "version-history";
|
|
83
|
+
/** Rezultat pregleda. */
|
|
44
84
|
readonly "inspection-result": "inspection-result";
|
|
85
|
+
/** Odstopanje od specifikacije. */
|
|
45
86
|
readonly deviation: "deviation";
|
|
87
|
+
/** Uspešno/neuspešno (pass/fail). */
|
|
46
88
|
readonly "pass-fail": "pass-fail";
|
|
89
|
+
/** Površinska napaka. */
|
|
47
90
|
readonly "surface-defect": "surface-defect";
|
|
91
|
+
/** Trdota materiala. */
|
|
48
92
|
readonly hardness: "hardness";
|
|
93
|
+
/** Natezna trdnost. */
|
|
49
94
|
readonly "tensile-strength": "tensile-strength";
|
|
95
|
+
/** Identifikator delovnega naloga. */
|
|
50
96
|
readonly "work-order-id": "work-order-id";
|
|
97
|
+
/** Seznam nalog. */
|
|
51
98
|
readonly "task-list": "task-list";
|
|
99
|
+
/** Planirani začetek. */
|
|
52
100
|
readonly "planned-start": "planned-start";
|
|
101
|
+
/** Planirani zaključek. */
|
|
53
102
|
readonly "planned-end": "planned-end";
|
|
103
|
+
/** Dodeljeno osebi ali ekipi. */
|
|
54
104
|
readonly "assigned-to": "assigned-to";
|
|
105
|
+
/** Povezava do navodil. */
|
|
55
106
|
readonly "instruction-url": "instruction-url";
|
|
107
|
+
/** Razpoložljivost vira. */
|
|
56
108
|
readonly availability: "availability";
|
|
109
|
+
/** Izraba vira. */
|
|
57
110
|
readonly utilization: "utilization";
|
|
111
|
+
/** Zastoj/izpad. */
|
|
58
112
|
readonly downtime: "downtime";
|
|
113
|
+
/** Stanje vzdrževanja. */
|
|
59
114
|
readonly "maintenance-status": "maintenance-status";
|
|
115
|
+
/** Moč. */
|
|
60
116
|
readonly power: "power";
|
|
117
|
+
/** Energija. */
|
|
61
118
|
readonly energy: "energy";
|
|
119
|
+
/** Napetost. */
|
|
62
120
|
readonly voltage: "voltage";
|
|
121
|
+
/** Tok. */
|
|
63
122
|
readonly current: "current";
|
|
123
|
+
/** Frekvenca. */
|
|
64
124
|
readonly frequency: "frequency";
|
|
125
|
+
/** Strošek. */
|
|
65
126
|
readonly cost: "cost";
|
|
127
|
+
/** Tlak. */
|
|
66
128
|
readonly pressure: "pressure";
|
|
129
|
+
/** Pretok. */
|
|
67
130
|
readonly flow: "flow";
|
|
131
|
+
/** Poraba. */
|
|
68
132
|
readonly consumption: "consumption";
|
|
133
|
+
/** Alarmni signal. */
|
|
69
134
|
readonly alarm: "alarm";
|
|
135
|
+
/** Skupni pretok. */
|
|
70
136
|
readonly "total-flow": "total-flow";
|
|
137
|
+
/** Prevodnost. */
|
|
71
138
|
readonly conductivity: "conductivity";
|
|
139
|
+
/** pH vrednost. */
|
|
72
140
|
readonly ph: "ph";
|
|
141
|
+
/** Nivo zaloge ali rezervoarja. */
|
|
73
142
|
readonly level: "level";
|
|
143
|
+
/** Hitrost porabe. */
|
|
74
144
|
readonly "consumption-rate": "consumption-rate";
|
|
145
|
+
/** Potrebno dolivanje/dopolnitev. */
|
|
75
146
|
readonly "refill-required": "refill-required";
|
|
147
|
+
/** Zadnje polnjenje. */
|
|
76
148
|
readonly "last-refill": "last-refill";
|
|
77
149
|
};
|
|
78
150
|
export declare const GeneratedAttributeDescriptions: Record<keyof typeof GeneratedAttributes, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uns-dictionary.generated.d.ts","sourceRoot":"","sources":["../../src/uns/uns-dictionary.generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"uns-dictionary.generated.d.ts","sourceRoot":"","sources":["../../src/uns/uns-dictionary.generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oBAAoB;IAC/B,wGAAwG;;IAExG,kGAAkG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,sBAAsB;;IAEtB,qCAAqC;;IAErC,wBAAwB;;CAEhB,CAAC;AAEX,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,MAAM,OAAO,mBAAmB,EAAE,MAAM,CA6D3F,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,oBAAoB,CAAC;AACxE,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAElF;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,mBAAmB,CAAC;AACtE,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjF"}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
/* Stub dictionary. Regenerate via generate-uns-dictionary.ts if you want to override. */
|
|
2
2
|
export const GeneratedObjectTypes = {
|
|
3
|
+
/** Fizična oprema (stroji, peči, senzorji). Uporablja se za spremljanje stanja, meritev in dogodkov. */
|
|
3
4
|
"equipment": "equipment",
|
|
5
|
+
/** Materialne enote (loti, serije, surovine, polizdelki). Za sledljivost, količine in premike. */
|
|
4
6
|
"material": "material",
|
|
7
|
+
/** Osebje (operaterji, nadzorniki, tehnologi). Za prisotnost, naloge in status. */
|
|
5
8
|
"personnel": "personnel",
|
|
9
|
+
/** Posamezen korak v procesu (npr. valjanje, hlajenje, analiza). Za faze ali aktivnosti procesa. */
|
|
6
10
|
"process-segment": "process-segment",
|
|
11
|
+
/** Definicija izdelka, recepture, tehnični opisi. Za metapodatke izdelka in revizije. */
|
|
7
12
|
"product-definition": "product-definition",
|
|
13
|
+
/** Kazalniki kakovosti izdelka (odstopanja, ocene, rezultati meritev). */
|
|
8
14
|
"product-quality": "product-quality",
|
|
15
|
+
/** Definicija nalog ali delovnih tokov. Za planirane operacije in navodila. */
|
|
9
16
|
"work-definition": "work-definition",
|
|
17
|
+
/** Status kateregakoli vira (material, osebje, oprema). Za razpoložljivost, okvare, izrabo. */
|
|
10
18
|
"resource-status": "resource-status",
|
|
19
|
+
/** Energija (elektrika, para, plin). */
|
|
11
20
|
"energy-resource": "energy-resource",
|
|
21
|
+
/** Utility viri (voda, zrak, dušik, stisnjeni plini). */
|
|
12
22
|
"utility-resource": "utility-resource",
|
|
23
|
+
/** Tekočine in plini, ki niso energenti. */
|
|
13
24
|
"fluid-resource": "fluid-resource",
|
|
25
|
+
/** Maziva, olja, čistila, ki se porabijo in niso del izdelka. */
|
|
14
26
|
"consumable-resource": "consumable-resource",
|
|
15
27
|
};
|
|
16
28
|
export const GeneratedObjectTypeDescriptions = {
|
|
@@ -28,65 +40,125 @@ export const GeneratedObjectTypeDescriptions = {
|
|
|
28
40
|
"consumable-resource": "Maziva, olja, čistila, ki se porabijo in niso del izdelka.",
|
|
29
41
|
};
|
|
30
42
|
export const GeneratedAttributes = {
|
|
43
|
+
/** Trenutno stanje vira ali opreme. */
|
|
31
44
|
"status": "status",
|
|
45
|
+
/** Temperatura vira/opreme. */
|
|
32
46
|
"temperature": "temperature",
|
|
47
|
+
/** Merjena vibracija. */
|
|
33
48
|
"vibration": "vibration",
|
|
49
|
+
/** Število obratovalnih ur. */
|
|
34
50
|
"operating-hours": "operating-hours",
|
|
51
|
+
/** Koda napake. */
|
|
35
52
|
"fault-code": "fault-code",
|
|
53
|
+
/** Hitrost delovanja. */
|
|
36
54
|
"speed": "speed",
|
|
55
|
+
/** Poraba energije. */
|
|
37
56
|
"energy-consumption": "energy-consumption",
|
|
57
|
+
/** Identifikator lota. */
|
|
38
58
|
"lot-id": "lot-id",
|
|
59
|
+
/** Številka serije (batch). */
|
|
39
60
|
"batch-number": "batch-number",
|
|
61
|
+
/** Tip materiala. */
|
|
40
62
|
"material-type": "material-type",
|
|
63
|
+
/** Količina materiala. */
|
|
41
64
|
"quantity": "quantity",
|
|
65
|
+
/** Lokacija materiala ali opreme. */
|
|
42
66
|
"location": "location",
|
|
67
|
+
/** Prisotnost osebja. */
|
|
43
68
|
"presence": "presence",
|
|
69
|
+
/** Identifikator naloge. */
|
|
44
70
|
"task-id": "task-id",
|
|
71
|
+
/** Vloga osebja. */
|
|
45
72
|
"role": "role",
|
|
73
|
+
/** Nivo pooblastil. */
|
|
46
74
|
"authorization-level": "authorization-level",
|
|
75
|
+
/** Čas začetka. */
|
|
47
76
|
"start-time": "start-time",
|
|
77
|
+
/** Čas zaključka. */
|
|
48
78
|
"end-time": "end-time",
|
|
79
|
+
/** Trajanje faze ali naloge. */
|
|
49
80
|
"duration": "duration",
|
|
81
|
+
/** Izhodna količina. */
|
|
50
82
|
"output-quantity": "output-quantity",
|
|
83
|
+
/** Identifikator operaterja. */
|
|
51
84
|
"operator-id": "operator-id",
|
|
85
|
+
/** Koda izdelka. */
|
|
52
86
|
"product-code": "product-code",
|
|
87
|
+
/** Revizija izdelka. */
|
|
53
88
|
"revision": "revision",
|
|
89
|
+
/** Tehnične specifikacije. */
|
|
54
90
|
"specification": "specification",
|
|
91
|
+
/** Ciljni parametri izdelka ali procesa. */
|
|
55
92
|
"target-parameters": "target-parameters",
|
|
93
|
+
/** Sestava materiala. */
|
|
56
94
|
"material-composition": "material-composition",
|
|
95
|
+
/** Zgodovina verzij. */
|
|
57
96
|
"version-history": "version-history",
|
|
97
|
+
/** Rezultat pregleda. */
|
|
58
98
|
"inspection-result": "inspection-result",
|
|
99
|
+
/** Odstopanje od specifikacije. */
|
|
59
100
|
"deviation": "deviation",
|
|
101
|
+
/** Uspešno/neuspešno (pass/fail). */
|
|
60
102
|
"pass-fail": "pass-fail",
|
|
103
|
+
/** Površinska napaka. */
|
|
61
104
|
"surface-defect": "surface-defect",
|
|
105
|
+
/** Trdota materiala. */
|
|
62
106
|
"hardness": "hardness",
|
|
107
|
+
/** Natezna trdnost. */
|
|
63
108
|
"tensile-strength": "tensile-strength",
|
|
109
|
+
/** Identifikator delovnega naloga. */
|
|
64
110
|
"work-order-id": "work-order-id",
|
|
111
|
+
/** Seznam nalog. */
|
|
65
112
|
"task-list": "task-list",
|
|
113
|
+
/** Planirani začetek. */
|
|
66
114
|
"planned-start": "planned-start",
|
|
115
|
+
/** Planirani zaključek. */
|
|
67
116
|
"planned-end": "planned-end",
|
|
117
|
+
/** Dodeljeno osebi ali ekipi. */
|
|
68
118
|
"assigned-to": "assigned-to",
|
|
119
|
+
/** Povezava do navodil. */
|
|
69
120
|
"instruction-url": "instruction-url",
|
|
121
|
+
/** Razpoložljivost vira. */
|
|
70
122
|
"availability": "availability",
|
|
123
|
+
/** Izraba vira. */
|
|
71
124
|
"utilization": "utilization",
|
|
125
|
+
/** Zastoj/izpad. */
|
|
72
126
|
"downtime": "downtime",
|
|
127
|
+
/** Stanje vzdrževanja. */
|
|
73
128
|
"maintenance-status": "maintenance-status",
|
|
129
|
+
/** Moč. */
|
|
74
130
|
"power": "power",
|
|
131
|
+
/** Energija. */
|
|
75
132
|
"energy": "energy",
|
|
133
|
+
/** Napetost. */
|
|
76
134
|
"voltage": "voltage",
|
|
135
|
+
/** Tok. */
|
|
77
136
|
"current": "current",
|
|
137
|
+
/** Frekvenca. */
|
|
78
138
|
"frequency": "frequency",
|
|
139
|
+
/** Strošek. */
|
|
79
140
|
"cost": "cost",
|
|
141
|
+
/** Tlak. */
|
|
80
142
|
"pressure": "pressure",
|
|
143
|
+
/** Pretok. */
|
|
81
144
|
"flow": "flow",
|
|
145
|
+
/** Poraba. */
|
|
82
146
|
"consumption": "consumption",
|
|
147
|
+
/** Alarmni signal. */
|
|
83
148
|
"alarm": "alarm",
|
|
149
|
+
/** Skupni pretok. */
|
|
84
150
|
"total-flow": "total-flow",
|
|
151
|
+
/** Prevodnost. */
|
|
85
152
|
"conductivity": "conductivity",
|
|
153
|
+
/** pH vrednost. */
|
|
86
154
|
"ph": "ph",
|
|
155
|
+
/** Nivo zaloge ali rezervoarja. */
|
|
87
156
|
"level": "level",
|
|
157
|
+
/** Hitrost porabe. */
|
|
88
158
|
"consumption-rate": "consumption-rate",
|
|
159
|
+
/** Potrebno dolivanje/dopolnitev. */
|
|
89
160
|
"refill-required": "refill-required",
|
|
161
|
+
/** Zadnje polnjenje. */
|
|
90
162
|
"last-refill": "last-refill",
|
|
91
163
|
};
|
|
92
164
|
export const GeneratedAttributeDescriptions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uns-dictionary.generated.js","sourceRoot":"","sources":["../../src/uns/uns-dictionary.generated.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE,WAAW;IACxB,UAAU,EAAE,UAAU;IACtB,WAAW,EAAE,WAAW;IACxB,iBAAiB,EAAE,iBAAiB;IACpC,oBAAoB,EAAE,oBAAoB;IAC1C,iBAAiB,EAAE,iBAAiB;IACpC,iBAAiB,EAAE,iBAAiB;IACpC,iBAAiB,EAAE,iBAAiB;IACpC,iBAAiB,EAAE,iBAAiB;IACpC,kBAAkB,EAAE,kBAAkB;IACtC,gBAAgB,EAAE,gBAAgB;IAClC,qBAAqB,EAAE,qBAAqB;CACpC,CAAC;AAEX,MAAM,CAAC,MAAM,+BAA+B,GAAsD;IAChG,WAAW,EAAE,mGAAmG;IAChH,UAAU,EAAE,6FAA6F;IACzG,WAAW,EAAE,8EAA8E;IAC3F,iBAAiB,EAAE,+FAA+F;IAClH,oBAAoB,EAAE,oFAAoF;IAC1G,iBAAiB,EAAE,qEAAqE;IACxF,iBAAiB,EAAE,0EAA0E;IAC7F,iBAAiB,EAAE,0FAA0F;IAC7G,iBAAiB,EAAE,mCAAmC;IACtD,kBAAkB,EAAE,oDAAoD;IACxE,gBAAgB,EAAE,uCAAuC;IACzD,qBAAqB,EAAE,4DAA4D;CACpF,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ,EAAE,QAAQ;IAClB,aAAa,EAAE,aAAa;IAC5B,WAAW,EAAE,WAAW;IACxB,iBAAiB,EAAE,iBAAiB;IACpC,YAAY,EAAE,YAAY;IAC1B,OAAO,EAAE,OAAO;IACh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4BAA4B;IAC3C,iBAAiB,EAAE,sBAAsB;IACzC,cAAc,EAAE,uBAAuB;IACvC,aAAa,EAAE,cAAc;IAC7B,UAAU,EAAE,eAAe;IAC3B,oBAAoB,EAAE,qBAAqB;IAC3C,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,YAAY;IACzB,MAAM,EAAE,UAAU;IAClB,UAAU,EAAE,OAAO;IACnB,MAAM,EAAE,SAAS;IACjB,aAAa,EAAE,SAAS;IACxB,OAAO,EAAE,iBAAiB;IAC1B,YAAY,EAAE,gBAAgB;IAC9B,cAAc,EAAE,aAAa;IAC7B,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,8BAA8B;IACvC,kBAAkB,EAAE,iBAAiB;IACrC,iBAAiB,EAAE,gCAAgC;IACnD,aAAa,EAAE,mBAAmB;CACnC,CAAC;AAGF,MAAM,UAAU,iCAAiC,CAAC,IAAY;IAC5D,OAAQ,+BAAsE,CAAC,IAAI,CAAC,CAAC;AACvF,CAAC;AAGD,MAAM,UAAU,gCAAgC,CAAC,IAAY;IAC3D,OAAQ,8BAAqE,CAAC,IAAI,CAAC,CAAC;AACtF,CAAC","sourcesContent":["/* Stub dictionary. Regenerate via generate-uns-dictionary.ts if you want to override. */\nexport const GeneratedObjectTypes = {\n \"equipment\": \"equipment\",\n \"material\": \"material\",\n \"personnel\": \"personnel\",\n \"process-segment\": \"process-segment\",\n \"product-definition\": \"product-definition\",\n \"product-quality\": \"product-quality\",\n \"work-definition\": \"work-definition\",\n \"resource-status\": \"resource-status\",\n \"energy-resource\": \"energy-resource\",\n \"utility-resource\": \"utility-resource\",\n \"fluid-resource\": \"fluid-resource\",\n \"consumable-resource\": \"consumable-resource\",\n} as const;\n\nexport const GeneratedObjectTypeDescriptions: Record<keyof typeof GeneratedObjectTypes, string> = {\n \"equipment\": \"Fizična oprema (stroji, peči, senzorji). Uporablja se za spremljanje stanja, meritev in dogodkov.\",\n \"material\": \"Materialne enote (loti, serije, surovine, polizdelki). Za sledljivost, količine in premike.\",\n \"personnel\": \"Osebje (operaterji, nadzorniki, tehnologi). Za prisotnost, naloge in status.\",\n \"process-segment\": \"Posamezen korak v procesu (npr. valjanje, hlajenje, analiza). Za faze ali aktivnosti procesa.\",\n \"product-definition\": \"Definicija izdelka, recepture, tehnični opisi. Za metapodatke izdelka in revizije.\",\n \"product-quality\": \"Kazalniki kakovosti izdelka (odstopanja, ocene, rezultati meritev).\",\n \"work-definition\": \"Definicija nalog ali delovnih tokov. Za planirane operacije in navodila.\",\n \"resource-status\": \"Status kateregakoli vira (material, osebje, oprema). Za razpoložljivost, okvare, izrabo.\",\n \"energy-resource\": \"Energija (elektrika, para, plin).\",\n \"utility-resource\": \"Utility viri (voda, zrak, dušik, stisnjeni plini).\",\n \"fluid-resource\": \"Tekočine in plini, ki niso energenti.\",\n \"consumable-resource\": \"Maziva, olja, čistila, ki se porabijo in niso del izdelka.\",\n};\n\nexport const GeneratedAttributes = {\n \"status\": \"status\",\n \"temperature\": \"temperature\",\n \"vibration\": \"vibration\",\n \"operating-hours\": \"operating-hours\",\n \"fault-code\": \"fault-code\",\n \"speed\": \"speed\",\n \"energy-consumption\": \"energy-consumption\",\n \"lot-id\": \"lot-id\",\n \"batch-number\": \"batch-number\",\n \"material-type\": \"material-type\",\n \"quantity\": \"quantity\",\n \"location\": \"location\",\n \"presence\": \"presence\",\n \"task-id\": \"task-id\",\n \"role\": \"role\",\n \"authorization-level\": \"authorization-level\",\n \"start-time\": \"start-time\",\n \"end-time\": \"end-time\",\n \"duration\": \"duration\",\n \"output-quantity\": \"output-quantity\",\n \"operator-id\": \"operator-id\",\n \"product-code\": \"product-code\",\n \"revision\": \"revision\",\n \"specification\": \"specification\",\n \"target-parameters\": \"target-parameters\",\n \"material-composition\": \"material-composition\",\n \"version-history\": \"version-history\",\n \"inspection-result\": \"inspection-result\",\n \"deviation\": \"deviation\",\n \"pass-fail\": \"pass-fail\",\n \"surface-defect\": \"surface-defect\",\n \"hardness\": \"hardness\",\n \"tensile-strength\": \"tensile-strength\",\n \"work-order-id\": \"work-order-id\",\n \"task-list\": \"task-list\",\n \"planned-start\": \"planned-start\",\n \"planned-end\": \"planned-end\",\n \"assigned-to\": \"assigned-to\",\n \"instruction-url\": \"instruction-url\",\n \"availability\": \"availability\",\n \"utilization\": \"utilization\",\n \"downtime\": \"downtime\",\n \"maintenance-status\": \"maintenance-status\",\n \"power\": \"power\",\n \"energy\": \"energy\",\n \"voltage\": \"voltage\",\n \"current\": \"current\",\n \"frequency\": \"frequency\",\n \"cost\": \"cost\",\n \"pressure\": \"pressure\",\n \"flow\": \"flow\",\n \"consumption\": \"consumption\",\n \"alarm\": \"alarm\",\n \"total-flow\": \"total-flow\",\n \"conductivity\": \"conductivity\",\n \"ph\": \"ph\",\n \"level\": \"level\",\n \"consumption-rate\": \"consumption-rate\",\n \"refill-required\": \"refill-required\",\n \"last-refill\": \"last-refill\",\n} as const;\n\nexport const GeneratedAttributeDescriptions: Record<keyof typeof GeneratedAttributes, string> = {\n \"status\": \"Trenutno stanje vira ali opreme.\",\n \"temperature\": \"Temperatura vira/opreme.\",\n \"vibration\": \"Merjena vibracija.\",\n \"operating-hours\": \"Število obratovalnih ur.\",\n \"fault-code\": \"Koda napake.\",\n \"speed\": \"Hitrost delovanja.\",\n \"energy-consumption\": \"Poraba energije.\",\n \"lot-id\": \"Identifikator lota.\",\n \"batch-number\": \"Številka serije (batch).\",\n \"material-type\": \"Tip materiala.\",\n \"quantity\": \"Količina materiala.\",\n \"location\": \"Lokacija materiala ali opreme.\",\n \"presence\": \"Prisotnost osebja.\",\n \"task-id\": \"Identifikator naloge.\",\n \"role\": \"Vloga osebja.\",\n \"authorization-level\": \"Nivo pooblastil.\",\n \"start-time\": \"Čas začetka.\",\n \"end-time\": \"Čas zaključka.\",\n \"duration\": \"Trajanje faze ali naloge.\",\n \"output-quantity\": \"Izhodna količina.\",\n \"operator-id\": \"Identifikator operaterja.\",\n \"product-code\": \"Koda izdelka.\",\n \"revision\": \"Revizija izdelka.\",\n \"specification\": \"Tehnične specifikacije.\",\n \"target-parameters\": \"Ciljni parametri izdelka ali procesa.\",\n \"material-composition\": \"Sestava materiala.\",\n \"version-history\": \"Zgodovina verzij.\",\n \"inspection-result\": \"Rezultat pregleda.\",\n \"deviation\": \"Odstopanje od specifikacije.\",\n \"pass-fail\": \"Uspešno/neuspešno (pass/fail).\",\n \"surface-defect\": \"Površinska napaka.\",\n \"hardness\": \"Trdota materiala.\",\n \"tensile-strength\": \"Natezna trdnost.\",\n \"work-order-id\": \"Identifikator delovnega naloga.\",\n \"task-list\": \"Seznam nalog.\",\n \"planned-start\": \"Planirani začetek.\",\n \"planned-end\": \"Planirani zaključek.\",\n \"assigned-to\": \"Dodeljeno osebi ali ekipi.\",\n \"instruction-url\": \"Povezava do navodil.\",\n \"availability\": \"Razpoložljivost vira.\",\n \"utilization\": \"Izraba vira.\",\n \"downtime\": \"Zastoj/izpad.\",\n \"maintenance-status\": \"Stanje vzdrževanja.\",\n \"power\": \"Moč.\",\n \"energy\": \"Energija.\",\n \"voltage\": \"Napetost.\",\n \"current\": \"Tok.\",\n \"frequency\": \"Frekvenca.\",\n \"cost\": \"Strošek.\",\n \"pressure\": \"Tlak.\",\n \"flow\": \"Pretok.\",\n \"consumption\": \"Poraba.\",\n \"alarm\": \"Alarmni signal.\",\n \"total-flow\": \"Skupni pretok.\",\n \"conductivity\": \"Prevodnost.\",\n \"ph\": \"pH vrednost.\",\n \"level\": \"Nivo zaloge ali rezervoarja.\",\n \"consumption-rate\": \"Hitrost porabe.\",\n \"refill-required\": \"Potrebno dolivanje/dopolnitev.\",\n \"last-refill\": \"Zadnje polnjenje.\",\n};\n\nexport type GeneratedObjectTypeName = keyof typeof GeneratedObjectTypes;\nexport function getGeneratedObjectTypeDescription(name: string): string | undefined {\n return (GeneratedObjectTypeDescriptions as Record<string, string | undefined>)[name];\n}\n\nexport type GeneratedAttributeName = keyof typeof GeneratedAttributes;\nexport function getGeneratedAttributeDescription(name: string): string | undefined {\n return (GeneratedAttributeDescriptions as Record<string, string | undefined>)[name];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"uns-dictionary.generated.js","sourceRoot":"","sources":["../../src/uns/uns-dictionary.generated.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,wGAAwG;IACxG,WAAW,EAAE,WAAW;IACxB,kGAAkG;IAClG,UAAU,EAAE,UAAU;IACtB,mFAAmF;IACnF,WAAW,EAAE,WAAW;IACxB,oGAAoG;IACpG,iBAAiB,EAAE,iBAAiB;IACpC,yFAAyF;IACzF,oBAAoB,EAAE,oBAAoB;IAC1C,0EAA0E;IAC1E,iBAAiB,EAAE,iBAAiB;IACpC,+EAA+E;IAC/E,iBAAiB,EAAE,iBAAiB;IACpC,+FAA+F;IAC/F,iBAAiB,EAAE,iBAAiB;IACpC,wCAAwC;IACxC,iBAAiB,EAAE,iBAAiB;IACpC,yDAAyD;IACzD,kBAAkB,EAAE,kBAAkB;IACtC,4CAA4C;IAC5C,gBAAgB,EAAE,gBAAgB;IAClC,iEAAiE;IACjE,qBAAqB,EAAE,qBAAqB;CACpC,CAAC;AAEX,MAAM,CAAC,MAAM,+BAA+B,GAAsD;IAChG,WAAW,EAAE,mGAAmG;IAChH,UAAU,EAAE,6FAA6F;IACzG,WAAW,EAAE,8EAA8E;IAC3F,iBAAiB,EAAE,+FAA+F;IAClH,oBAAoB,EAAE,oFAAoF;IAC1G,iBAAiB,EAAE,qEAAqE;IACxF,iBAAiB,EAAE,0EAA0E;IAC7F,iBAAiB,EAAE,0FAA0F;IAC7G,iBAAiB,EAAE,mCAAmC;IACtD,kBAAkB,EAAE,oDAAoD;IACxE,gBAAgB,EAAE,uCAAuC;IACzD,qBAAqB,EAAE,4DAA4D;CACpF,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG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AAW;IACtB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,YAAY;IACzB,MAAM,EAAE,UAAU;IAClB,UAAU,EAAE,OAAO;IACnB,MAAM,EAAE,SAAS;IACjB,aAAa,EAAE,SAAS;IACxB,OAAO,EAAE,iBAAiB;IAC1B,YAAY,EAAE,gBAAgB;IAC9B,cAAc,EAAE,aAAa;IAC7B,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,8BAA8B;IACvC,kBAAkB,EAAE,iBAAiB;IACrC,iBAAiB,EAAE,gCAAgC;IACnD,aAAa,EAAE,mBAAmB;CACnC,CAAC;AAGF,MAAM,UAAU,iCAAiC,CAAC,IAAY;IAC5D,OAAQ,+BAAsE,CAAC,IAAI,CAAC,CAAC;AACvF,CAAC;AAGD,MAAM,UAAU,gCAAgC,CAAC,IAAY;IAC3D,OAAQ,8BAAqE,CAAC,IAAI,CAAC,CAAC;AACtF,CAAC","sourcesContent":["/* Stub dictionary. Regenerate via generate-uns-dictionary.ts if you want to override. */\nexport const GeneratedObjectTypes = {\n /** Fizična oprema (stroji, peči, senzorji). Uporablja se za spremljanje stanja, meritev in dogodkov. */\n \"equipment\": \"equipment\",\n /** Materialne enote (loti, serije, surovine, polizdelki). Za sledljivost, količine in premike. */\n \"material\": \"material\",\n /** Osebje (operaterji, nadzorniki, tehnologi). Za prisotnost, naloge in status. */\n \"personnel\": \"personnel\",\n /** Posamezen korak v procesu (npr. valjanje, hlajenje, analiza). Za faze ali aktivnosti procesa. */\n \"process-segment\": \"process-segment\",\n /** Definicija izdelka, recepture, tehnični opisi. Za metapodatke izdelka in revizije. */\n \"product-definition\": \"product-definition\",\n /** Kazalniki kakovosti izdelka (odstopanja, ocene, rezultati meritev). */\n \"product-quality\": \"product-quality\",\n /** Definicija nalog ali delovnih tokov. Za planirane operacije in navodila. */\n \"work-definition\": \"work-definition\",\n /** Status kateregakoli vira (material, osebje, oprema). Za razpoložljivost, okvare, izrabo. */\n \"resource-status\": \"resource-status\",\n /** Energija (elektrika, para, plin). */\n \"energy-resource\": \"energy-resource\",\n /** Utility viri (voda, zrak, dušik, stisnjeni plini). */\n \"utility-resource\": \"utility-resource\",\n /** Tekočine in plini, ki niso energenti. */\n \"fluid-resource\": \"fluid-resource\",\n /** Maziva, olja, čistila, ki se porabijo in niso del izdelka. */\n \"consumable-resource\": \"consumable-resource\",\n} as const;\n\nexport const GeneratedObjectTypeDescriptions: Record<keyof typeof GeneratedObjectTypes, string> = {\n \"equipment\": \"Fizična oprema (stroji, peči, senzorji). Uporablja se za spremljanje stanja, meritev in dogodkov.\",\n \"material\": \"Materialne enote (loti, serije, surovine, polizdelki). Za sledljivost, količine in premike.\",\n \"personnel\": \"Osebje (operaterji, nadzorniki, tehnologi). Za prisotnost, naloge in status.\",\n \"process-segment\": \"Posamezen korak v procesu (npr. valjanje, hlajenje, analiza). Za faze ali aktivnosti procesa.\",\n \"product-definition\": \"Definicija izdelka, recepture, tehnični opisi. Za metapodatke izdelka in revizije.\",\n \"product-quality\": \"Kazalniki kakovosti izdelka (odstopanja, ocene, rezultati meritev).\",\n \"work-definition\": \"Definicija nalog ali delovnih tokov. Za planirane operacije in navodila.\",\n \"resource-status\": \"Status kateregakoli vira (material, osebje, oprema). Za razpoložljivost, okvare, izrabo.\",\n \"energy-resource\": \"Energija (elektrika, para, plin).\",\n \"utility-resource\": \"Utility viri (voda, zrak, dušik, stisnjeni plini).\",\n \"fluid-resource\": \"Tekočine in plini, ki niso energenti.\",\n \"consumable-resource\": \"Maziva, olja, čistila, ki se porabijo in niso del izdelka.\",\n};\n\nexport const GeneratedAttributes = {\n /** Trenutno stanje vira ali opreme. */\n \"status\": \"status\",\n /** Temperatura vira/opreme. */\n \"temperature\": \"temperature\",\n /** Merjena vibracija. */\n \"vibration\": \"vibration\",\n /** Število obratovalnih ur. */\n \"operating-hours\": \"operating-hours\",\n /** Koda napake. */\n \"fault-code\": \"fault-code\",\n /** Hitrost delovanja. */\n \"speed\": \"speed\",\n /** Poraba energije. */\n \"energy-consumption\": \"energy-consumption\",\n /** Identifikator lota. */\n \"lot-id\": \"lot-id\",\n /** Številka serije (batch). */\n \"batch-number\": \"batch-number\",\n /** Tip materiala. */\n \"material-type\": \"material-type\",\n /** Količina materiala. */\n \"quantity\": \"quantity\",\n /** Lokacija materiala ali opreme. */\n \"location\": \"location\",\n /** Prisotnost osebja. */\n \"presence\": \"presence\",\n /** Identifikator naloge. */\n \"task-id\": \"task-id\",\n /** Vloga osebja. */\n \"role\": \"role\",\n /** Nivo pooblastil. */\n \"authorization-level\": \"authorization-level\",\n /** Čas začetka. */\n \"start-time\": \"start-time\",\n /** Čas zaključka. */\n \"end-time\": \"end-time\",\n /** Trajanje faze ali naloge. */\n \"duration\": \"duration\",\n /** Izhodna količina. */\n \"output-quantity\": \"output-quantity\",\n /** Identifikator operaterja. */\n \"operator-id\": \"operator-id\",\n /** Koda izdelka. */\n \"product-code\": \"product-code\",\n /** Revizija izdelka. */\n \"revision\": \"revision\",\n /** Tehnične specifikacije. */\n \"specification\": \"specification\",\n /** Ciljni parametri izdelka ali procesa. */\n \"target-parameters\": \"target-parameters\",\n /** Sestava materiala. */\n \"material-composition\": \"material-composition\",\n /** Zgodovina verzij. */\n \"version-history\": \"version-history\",\n /** Rezultat pregleda. */\n \"inspection-result\": \"inspection-result\",\n /** Odstopanje od specifikacije. */\n \"deviation\": \"deviation\",\n /** Uspešno/neuspešno (pass/fail). */\n \"pass-fail\": \"pass-fail\",\n /** Površinska napaka. */\n \"surface-defect\": \"surface-defect\",\n /** Trdota materiala. */\n \"hardness\": \"hardness\",\n /** Natezna trdnost. */\n \"tensile-strength\": \"tensile-strength\",\n /** Identifikator delovnega naloga. */\n \"work-order-id\": \"work-order-id\",\n /** Seznam nalog. */\n \"task-list\": \"task-list\",\n /** Planirani začetek. */\n \"planned-start\": \"planned-start\",\n /** Planirani zaključek. */\n \"planned-end\": \"planned-end\",\n /** Dodeljeno osebi ali ekipi. */\n \"assigned-to\": \"assigned-to\",\n /** Povezava do navodil. */\n \"instruction-url\": \"instruction-url\",\n /** Razpoložljivost vira. */\n \"availability\": \"availability\",\n /** Izraba vira. */\n \"utilization\": \"utilization\",\n /** Zastoj/izpad. */\n \"downtime\": \"downtime\",\n /** Stanje vzdrževanja. */\n \"maintenance-status\": \"maintenance-status\",\n /** Moč. */\n \"power\": \"power\",\n /** Energija. */\n \"energy\": \"energy\",\n /** Napetost. */\n \"voltage\": \"voltage\",\n /** Tok. */\n \"current\": \"current\",\n /** Frekvenca. */\n \"frequency\": \"frequency\",\n /** Strošek. */\n \"cost\": \"cost\",\n /** Tlak. */\n \"pressure\": \"pressure\",\n /** Pretok. */\n \"flow\": \"flow\",\n /** Poraba. */\n \"consumption\": \"consumption\",\n /** Alarmni signal. */\n \"alarm\": \"alarm\",\n /** Skupni pretok. */\n \"total-flow\": \"total-flow\",\n /** Prevodnost. */\n \"conductivity\": \"conductivity\",\n /** pH vrednost. */\n \"ph\": \"ph\",\n /** Nivo zaloge ali rezervoarja. */\n \"level\": \"level\",\n /** Hitrost porabe. */\n \"consumption-rate\": \"consumption-rate\",\n /** Potrebno dolivanje/dopolnitev. */\n \"refill-required\": \"refill-required\",\n /** Zadnje polnjenje. */\n \"last-refill\": \"last-refill\",\n} as const;\n\nexport const GeneratedAttributeDescriptions: Record<keyof typeof GeneratedAttributes, string> = {\n \"status\": \"Trenutno stanje vira ali opreme.\",\n \"temperature\": \"Temperatura vira/opreme.\",\n \"vibration\": \"Merjena vibracija.\",\n \"operating-hours\": \"Število obratovalnih ur.\",\n \"fault-code\": \"Koda napake.\",\n \"speed\": \"Hitrost delovanja.\",\n \"energy-consumption\": \"Poraba energije.\",\n \"lot-id\": \"Identifikator lota.\",\n \"batch-number\": \"Številka serije (batch).\",\n \"material-type\": \"Tip materiala.\",\n \"quantity\": \"Količina materiala.\",\n \"location\": \"Lokacija materiala ali opreme.\",\n \"presence\": \"Prisotnost osebja.\",\n \"task-id\": \"Identifikator naloge.\",\n \"role\": \"Vloga osebja.\",\n \"authorization-level\": \"Nivo pooblastil.\",\n \"start-time\": \"Čas začetka.\",\n \"end-time\": \"Čas zaključka.\",\n \"duration\": \"Trajanje faze ali naloge.\",\n \"output-quantity\": \"Izhodna količina.\",\n \"operator-id\": \"Identifikator operaterja.\",\n \"product-code\": \"Koda izdelka.\",\n \"revision\": \"Revizija izdelka.\",\n \"specification\": \"Tehnične specifikacije.\",\n \"target-parameters\": \"Ciljni parametri izdelka ali procesa.\",\n \"material-composition\": \"Sestava materiala.\",\n \"version-history\": \"Zgodovina verzij.\",\n \"inspection-result\": \"Rezultat pregleda.\",\n \"deviation\": \"Odstopanje od specifikacije.\",\n \"pass-fail\": \"Uspešno/neuspešno (pass/fail).\",\n \"surface-defect\": \"Površinska napaka.\",\n \"hardness\": \"Trdota materiala.\",\n \"tensile-strength\": \"Natezna trdnost.\",\n \"work-order-id\": \"Identifikator delovnega naloga.\",\n \"task-list\": \"Seznam nalog.\",\n \"planned-start\": \"Planirani začetek.\",\n \"planned-end\": \"Planirani zaključek.\",\n \"assigned-to\": \"Dodeljeno osebi ali ekipi.\",\n \"instruction-url\": \"Povezava do navodil.\",\n \"availability\": \"Razpoložljivost vira.\",\n \"utilization\": \"Izraba vira.\",\n \"downtime\": \"Zastoj/izpad.\",\n \"maintenance-status\": \"Stanje vzdrževanja.\",\n \"power\": \"Moč.\",\n \"energy\": \"Energija.\",\n \"voltage\": \"Napetost.\",\n \"current\": \"Tok.\",\n \"frequency\": \"Frekvenca.\",\n \"cost\": \"Strošek.\",\n \"pressure\": \"Tlak.\",\n \"flow\": \"Pretok.\",\n \"consumption\": \"Poraba.\",\n \"alarm\": \"Alarmni signal.\",\n \"total-flow\": \"Skupni pretok.\",\n \"conductivity\": \"Prevodnost.\",\n \"ph\": \"pH vrednost.\",\n \"level\": \"Nivo zaloge ali rezervoarja.\",\n \"consumption-rate\": \"Hitrost porabe.\",\n \"refill-required\": \"Potrebno dolivanje/dopolnitev.\",\n \"last-refill\": \"Zadnje polnjenje.\",\n};\n\nexport type GeneratedObjectTypeName = keyof typeof GeneratedObjectTypes;\nexport function getGeneratedObjectTypeDescription(name: string): string | undefined {\n return (GeneratedObjectTypeDescriptions as Record<string, string | undefined>)[name];\n}\n\nexport type GeneratedAttributeName = keyof typeof GeneratedAttributes;\nexport function getGeneratedAttributeDescription(name: string): string | undefined {\n return (GeneratedAttributeDescriptions as Record<string, string | undefined>)[name];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uns-proxy.js","sourceRoot":"","sources":["../../src/uns/uns-proxy.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,QAAQ;IACnB,eAAe,GAA0B,IAAI,CAAC;IAC/C,KAAK,GAA+B,IAAI,eAAe,EAAa,CAAC;IAClE,mBAAmB,CAAS;IAC5B,sBAAsB,CAAS,CAAC,UAAU;IAC5C,cAAc,GAA8B,IAAI,GAAG,EAAE,CAAC;IACtD,oBAAoB,GAA4B,IAAI,GAAG,EAAE,CAAC;IAElE;QACE,+DAA+D;QAC/D,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE;YACtC,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAClC,CAAC,EAAE,KAAK,CAAC,CAAC;IACZ,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,kBAAkB;QAC9B,IAAI,IAAI,CAAC,mBAAmB,KAAK,EAAE,EAAE,CAAC;YACpC,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;YACtD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,IAAI,CAAC;oBACH,IAAI,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C,SAAS,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,sBAAsB,iCAAiC,SAAS,EAAE,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;IACM,KAAK,CAAC,IAAI;QACf,iCAAiC;QACjC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC9B,CAAC;IAEH,CAAC;CAEF","sourcesContent":["import { IApiObject, ITopicObject, UnsEvents } from \"./uns-interfaces.js\";\nimport logger from \"../logger.js\";\nimport { UnsEventEmitter } from \"./uns-event-emitter.js\";\nimport { UnsPacket } from \"./uns-packet.js\";\nimport { UnsAsset } from \"./uns-asset.js\";\nimport { UnsObjectId, UnsObjectType } from \"./uns-object.js\";\n\nexport default class UnsProxy {\n private publishInterval: NodeJS.Timeout | null = null;\n public event: UnsEventEmitter<UnsEvents> = new UnsEventEmitter<UnsEvents>();\n protected instanceStatusTopic: string;\n protected instanceNameWithSuffix: string; //was prot\n private producedTopics: Map<string, ITopicObject> = new Map();\n private producedApiEndpoints: Map<string, IApiObject> = new Map();\n\n constructor() {\n // Set up interval to publish produced topics every 60 seconds.\n this.publishInterval = setInterval(() => {\n this.emitProducedTopics();\n this.emitProducedApiEndpoints();\n }, 60000); \n }\n \n /**\n * Publishes the list of produced topics to the MQTT broker.\n */\n private async emitProducedTopics(): Promise<void> {\n if (this.instanceStatusTopic !== \"\") {\n const topicsArray = [...this.producedTopics.values()];\n if (topicsArray.length > 0) {\n try {\n if (topicsArray.length > 0) {\n this.event.emit(\"unsProxyProducedTopics\", { producedTopics: topicsArray, statusTopic: this.instanceStatusTopic + \"topics\" });\n }\n } catch (error) {\n logger.error(`${this.instanceNameWithSuffix} - Error publishing produced topics: ${error.message}`);\n }\n logger.debug(`${this.instanceNameWithSuffix} - Published produced topics.`);\n }\n }\n }\n\n /**\n * Publishes the list of produced API endpoints to the MQTT broker.\n */\n private async emitProducedApiEndpoints(): Promise<void> {\n if (this.instanceStatusTopic !== \"\") {\n const apiEndpointsArray = [...this.producedApiEndpoints.values()];\n if (apiEndpointsArray.length > 0) {\n try {\n if (apiEndpointsArray.length > 0) {\n this.event.emit(\"unsProxyProducedApiEndpoints\", { producedApiEndpoints: apiEndpointsArray, statusTopic: this.instanceStatusTopic + \"api-endpoints\" });\n }\n } catch (error) {\n logger.error(`${this.instanceNameWithSuffix} - Error publishing produced API endpoints: ${error.message}`);\n }\n logger.debug(`${this.instanceNameWithSuffix} - Published produced API endpoints.`);\n }\n }\n }\n\n /**\n * Registers a unique topic so that it is tracked and published only once.\n *\n * @param topicObject - The object containing topic details.\n */\n protected registerUniqueTopic(topicObject: ITopicObject): void {\n if (this.instanceStatusTopic !== \"\") {\n const fullTopic = `${topicObject.topic}${topicObject.asset}/${topicObject.objectType}/${topicObject.objectId}/${topicObject.attribute}`;\n if (!this.producedTopics.has(fullTopic)) {\n this.producedTopics.set(fullTopic, {\n timestamp: topicObject.timestamp,\n topic: topicObject.topic,\n attribute: topicObject.attribute,\n attributeType: topicObject.attributeType,\n description: topicObject.description,\n tags: topicObject.tags,\n attributeNeedsPersistence: topicObject.attributeNeedsPersistence ?? true,\n dataGroup: topicObject.dataGroup ?? \"\",\n asset: topicObject.asset,\n assetDescription: topicObject.assetDescription,\n objectType: topicObject.objectType,\n objectTypeDescription: topicObject.objectTypeDescription,\n objectId: topicObject.objectId\n });\n this.emitProducedTopics();\n logger.info(`${this.instanceNameWithSuffix} - Registered new topic: ${fullTopic}`);\n }\n }\n } \n\n /**\n * Registers an API endpoint to handle requests for a specific topic and attribute.\n */\n protected registerApiEndpoint(apiObject: IApiObject): void {\n if (this.instanceStatusTopic !== \"\") {\n const fullTopic = `${apiObject.topic}${apiObject.asset}/${apiObject.objectType}/${apiObject.objectId}/${apiObject.attribute}`;\n if (!this.producedApiEndpoints.has(fullTopic)) {\n const time = UnsPacket.formatToISO8601(new Date());\n this.producedApiEndpoints.set(fullTopic, {\n timestamp: time,\n topic: apiObject.topic,\n attribute: apiObject.attribute,\n apiHost: apiObject.apiHost,\n apiEndpoint: apiObject.apiEndpoint,\n apiMethod: apiObject.apiMethod,\n apiQueryParams: apiObject.apiQueryParams,\n apiDescription: apiObject.apiDescription,\n attributeType: apiObject.attributeType,\n apiSwaggerEndpoint: apiObject.apiSwaggerEndpoint,\n asset: apiObject.asset,\n objectType: apiObject.objectType,\n objectId: apiObject.objectId\n });\n this.emitProducedApiEndpoints();\n logger.info(`${this.instanceNameWithSuffix} - Registered new api endpoint: /${fullTopic}`);\n }\n }\n }\n\n protected unregisterApiEndpoint(topic: string, asset:UnsAsset, objectType: UnsObjectType, objectId: UnsObjectId, attribute: string): void {\n const fullTopic = `${topic}/${asset}/${objectType}/${objectId}/${attribute}`;\n if (this.producedApiEndpoints.has(fullTopic)) {\n this.producedApiEndpoints.delete(fullTopic);\n this.emitProducedApiEndpoints();\n logger.info(`${this.instanceNameWithSuffix} - Unregistered API endpoint: ${fullTopic}`);\n }\n }\n public async stop() {\n // Clear the publishing interval.\n if (this.publishInterval) {\n clearInterval(this.publishInterval);\n this.publishInterval = null;\n }\n\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"uns-proxy.js","sourceRoot":"","sources":["../../src/uns/uns-proxy.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,QAAQ;IACnB,eAAe,GAA0B,IAAI,CAAC;IAC/C,KAAK,GAA+B,IAAI,eAAe,EAAa,CAAC;IAClE,mBAAmB,CAAS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Aa,EAAE,SAAS,CAAC,aAAa;oBACtC,kBAAkB,EAAE,SAAS,CAAC,kBAAkB;oBAChD,KAAK,EAAE,SAAS,CAAC,KAAK;oBACtB,UAAU,EAAE,SAAS,CAAC,UAAU;oBAChC,QAAQ,EAAE,SAAS,CAAC,QAAQ;iBAC7B,CAAC,CAAC;gBACH,IAAI,CAAC,wBAAwB,EAAE,CAAC;gBAChC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,sBAAsB,oCAAoC,SAAS,EAAE,CAAC,CAAC;YAC7F,CAAC;QACH,CAAC;IACH,CAAC;IAES,qBAAqB,CAAC,KAAa,EAAE,KAAc,EAAE,UAAyB,EAAE,QAAqB,EAAE,SAAiB;QAChI,MAAM,SAAS,GAAG,GAAG,KAAK,IAAI,KAAK,IAAI,UAAU,IAAI,QAAQ,IAAI,SAAS,EAAE,CAAC;QAC7E,IAAI,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,sBAAsB,iCAAiC,SAAS,EAAE,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;IACM,KAAK,CAAC,IAAI;QACf,iCAAiC;QACjC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC9B,CAAC;IAEH,CAAC;CAEF","sourcesContent":["import { IApiObject, ITopicObject, UnsEvents } from \"./uns-interfaces.js\";\nimport logger from \"../logger.js\";\nimport { UnsEventEmitter } from \"./uns-event-emitter.js\";\nimport { UnsPacket } from \"./uns-packet.js\";\nimport { UnsAsset } from \"./uns-asset.js\";\nimport { UnsObjectId, UnsObjectType } from \"./uns-object.js\";\n\nexport default class UnsProxy {\n private publishInterval: NodeJS.Timeout | null = null;\n public event: UnsEventEmitter<UnsEvents> = new UnsEventEmitter<UnsEvents>();\n protected instanceStatusTopic: string;\n protected instanceNameWithSuffix: string; //was prot\n private producedTopics: Map<string, ITopicObject> = new Map();\n private producedApiEndpoints: Map<string, IApiObject> = new Map();\n\n constructor() {\n // Set up interval to publish produced topics every 60 seconds.\n this.publishInterval = setInterval(() => {\n this.emitProducedTopics();\n this.emitProducedApiEndpoints();\n }, 60000); \n }\n \n /**\n * Publishes the list of produced topics to the MQTT broker.\n */\n private async emitProducedTopics(): Promise<void> {\n if (this.instanceStatusTopic !== \"\") {\n const topicsArray = [...this.producedTopics.values()];\n if (topicsArray.length > 0) {\n try {\n if (topicsArray.length > 0) {\n this.event.emit(\"unsProxyProducedTopics\", { producedTopics: topicsArray, statusTopic: this.instanceStatusTopic + \"topics\" });\n }\n } catch (error) {\n logger.error(`${this.instanceNameWithSuffix} - Error publishing produced topics: ${error.message}`);\n }\n logger.debug(`${this.instanceNameWithSuffix} - Published produced topics.`);\n }\n }\n }\n\n /**\n * Publishes the list of produced API endpoints to the MQTT broker.\n */\n private async emitProducedApiEndpoints(): Promise<void> {\n if (this.instanceStatusTopic !== \"\") {\n const apiEndpointsArray = [...this.producedApiEndpoints.values()];\n if (apiEndpointsArray.length > 0) {\n try {\n if (apiEndpointsArray.length > 0) {\n this.event.emit(\"unsProxyProducedApiEndpoints\", { producedApiEndpoints: apiEndpointsArray, statusTopic: this.instanceStatusTopic + \"api-endpoints\" });\n }\n } catch (error) {\n logger.error(`${this.instanceNameWithSuffix} - Error publishing produced API endpoints: ${error.message}`);\n }\n logger.debug(`${this.instanceNameWithSuffix} - Published produced API endpoints.`);\n }\n }\n }\n\n /**\n * Registers a unique topic so that it is tracked and published only once.\n *\n * @param topicObject - The object containing topic details.\n */\n protected registerUniqueTopic(topicObject: ITopicObject): void {\n if (this.instanceStatusTopic !== \"\") {\n const fullTopic = `${topicObject.topic}${topicObject.asset}/${topicObject.objectType}/${topicObject.objectId}/${topicObject.attribute}`;\n if (!this.producedTopics.has(fullTopic)) {\n this.producedTopics.set(fullTopic, {\n timestamp: topicObject.timestamp,\n topic: topicObject.topic,\n attribute: topicObject.attribute,\n attributeType: topicObject.attributeType,\n description: topicObject.description,\n tags: topicObject.tags,\n attributeNeedsPersistence: topicObject.attributeNeedsPersistence ?? true,\n dataGroup: topicObject.dataGroup ?? \"\",\n asset: topicObject.asset,\n assetDescription: topicObject.assetDescription,\n objectType: topicObject.objectType,\n objectTypeDescription: topicObject.objectTypeDescription,\n objectId: topicObject.objectId\n });\n this.emitProducedTopics();\n logger.info(`${this.instanceNameWithSuffix} - Registered new topic: ${fullTopic}`);\n }\n }\n } \n\n /**\n * Registers an API endpoint to handle requests for a specific topic and attribute.\n */\n protected registerApiEndpoint(apiObject: IApiObject): void {\n if (this.instanceStatusTopic !== \"\") {\n const fullTopic = `${apiObject.topic}${apiObject.asset}/${apiObject.objectType}/${apiObject.objectId}/${apiObject.attribute}`;\n if (!this.producedApiEndpoints.has(fullTopic)) {\n const time = UnsPacket.formatToISO8601(new Date());\n this.producedApiEndpoints.set(fullTopic, {\n timestamp: time,\n topic: apiObject.topic,\n attribute: apiObject.attribute,\n apiHost: apiObject.apiHost,\n apiEndpoint: apiObject.apiEndpoint,\n apiMethod: apiObject.apiMethod,\n apiQueryParams: apiObject.apiQueryParams,\n apiDescription: apiObject.apiDescription,\n attributeType: apiObject.attributeType,\n apiSwaggerEndpoint: apiObject.apiSwaggerEndpoint,\n asset: apiObject.asset,\n objectType: apiObject.objectType,\n objectId: apiObject.objectId\n });\n this.emitProducedApiEndpoints();\n logger.info(`${this.instanceNameWithSuffix} - Registered new api endpoint: /${fullTopic}`);\n }\n }\n }\n\n protected unregisterApiEndpoint(topic: string, asset:UnsAsset, objectType: UnsObjectType, objectId: UnsObjectId, attribute: string): void {\n const fullTopic = `${topic}/${asset}/${objectType}/${objectId}/${attribute}`;\n if (this.producedApiEndpoints.has(fullTopic)) {\n this.producedApiEndpoints.delete(fullTopic);\n this.emitProducedApiEndpoints();\n logger.info(`${this.instanceNameWithSuffix} - Unregistered API endpoint: ${fullTopic}`);\n }\n }\n public async stop() {\n // Clear the publishing interval.\n if (this.publishInterval) {\n clearInterval(this.publishInterval);\n this.publishInterval = null;\n }\n\n }\n\n}\n"]}
|