@uns-kit/core 2.0.26 → 2.0.27
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/logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAuEA,QAAA,MAAM,MAAM,0BAiBV,CAAC;AAEH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,4BAY3C;AAED,eAAe,MAAM,CAAA"}
|
package/dist/logger.js
CHANGED
|
@@ -6,22 +6,17 @@ import fs from 'fs';
|
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
7
|
import { ConfigFile } from './config-file.js';
|
|
8
8
|
function loadPackageMeta() {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const raw = fs.readFileSync(packageJsonPath, 'utf8');
|
|
16
|
-
const packageMeta = JSON.parse(raw);
|
|
17
|
-
if (packageMeta.name || packageMeta.version) {
|
|
18
|
-
return packageMeta;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
// Try the next candidate.
|
|
9
|
+
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
10
|
+
try {
|
|
11
|
+
const raw = fs.readFileSync(packageJsonPath, 'utf8');
|
|
12
|
+
const packageMeta = JSON.parse(raw);
|
|
13
|
+
if (packageMeta.name || packageMeta.version) {
|
|
14
|
+
return packageMeta;
|
|
23
15
|
}
|
|
24
16
|
}
|
|
17
|
+
catch {
|
|
18
|
+
// Use unknown values when the application package metadata is unavailable.
|
|
19
|
+
}
|
|
25
20
|
return {};
|
|
26
21
|
}
|
|
27
22
|
function loadLoggingConfig() {
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,aAAa,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,SAAS,eAAe;IACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,aAAa,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,SAAS,eAAe;IACtB,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAA;IAEhE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;QACpD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAwC,CAAA;QAC1E,IAAI,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YAC5C,OAAO,WAAW,CAAA;QACpB,CAAC;IACH,CAAC;IAAC,MAAM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\r\nimport os from 'os'\r\nimport path from 'path'\r\nimport fs from 'fs'\r\nimport { fileURLToPath } from 'url';\r\nimport { ConfigFile } from './config-file.js'\r\n\r\nfunction loadPackageMeta(): { name?: string; version?: string } {\r\n const packageJsonPath = path.join(process.cwd(), 'package.json')\r\n\r\n try {\r\n const raw = fs.readFileSync(packageJsonPath, 'utf8')\r\n const packageMeta = JSON.parse(raw) as { name?: string; version?: string }\r\n if (packageMeta.name || packageMeta.version) {\r\n return packageMeta\r\n }\r\n } catch {\r\n // Use unknown values when the application package metadata is unavailable.\r\n }\r\n\r\n return {}\r\n}\r\n\r\nfunction loadLoggingConfig() {\r\n try {\r\n return ConfigFile.loadRawConfig().logging\r\n } catch {\r\n return undefined\r\n }\r\n}\r\n\r\nconst packageMeta = loadPackageMeta()\r\nconst loggingConfig = loadLoggingConfig()\r\nconst gelfMeta = {\r\n service: packageMeta.name ?? 'unknown-service',\r\n version: packageMeta.version ?? 'unknown',\r\n environment: process.env.NODE_ENV || 'unknown',\r\n hostname: os.hostname()\r\n}\r\nconst consoleFormat = format.combine(\r\n format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),\r\n format.errors({ stack: true }),\r\n format.splat(),\r\n format.json()\r\n)\r\n\r\nconst loggerTransports = [\r\n new transports.Console({\r\n format: consoleFormat\r\n })\r\n]\r\n\r\nif (loggingConfig) {\r\n loggerTransports.push(\r\n new GelfTransport({\r\n format: format((info) => ({\r\n ...info,\r\n ...gelfMeta\r\n }))(),\r\n gelfPro: {\r\n adapterName: loggingConfig.adapter,\r\n adapterOptions: {\r\n host: loggingConfig.host,\r\n port: loggingConfig.port\r\n }\r\n }\r\n })\r\n )\r\n}\r\n\r\nconst logger = createLogger({\r\n level: loggingConfig?.level ?? 'info',\r\n\r\n format: format.combine(\r\n format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),\r\n format.errors({ stack: true }), // Include stack trace\r\n format.splat(),\r\n format.json()\r\n ),\r\n transports: loggerTransports,\r\n exceptionHandlers: [\r\n new transports.Console({\r\n format: consoleFormat\r\n }), // Log exceptions to console\r\n // Remove exception logging to file\r\n // new transports.File({ filename: 'logs/exceptions.log' })\r\n ]\r\n});\r\n\r\nexport function getLogger(modulePath: string) {\r\n const normalizedModulePath = modulePath.startsWith('file:')\r\n ? fileURLToPath(modulePath)\r\n : modulePath\r\n\r\n const relativePath = path.relative(process.cwd(), normalizedModulePath)\r\n const withoutExt = relativePath.replace(/\\.[^/.]+$/, '')\r\n const dotted = withoutExt.split(path.sep).join('.')\r\n\r\n return logger.child({\r\n facility: dotted\r\n })\r\n}\r\n\r\nexport default logger\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uns-core-schema.js","sourceRoot":"","sources":["../../src/uns-config/uns-core-schema.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAEhF,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC,MAAM,EAAE,CAAC;AAEZ,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAChE,cA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AC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QACzC,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QAChD,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC;KAC1C,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAEtB,KAAK,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACnC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACpC,KAAK,EAAE,iBAAiB;IACxB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC1D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;KACtC,CAAC,CAAC,MAAM,EAAE,CAAC,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({\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(),\r\n requestProblemInformation: z.boolean().optional(),\r\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\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 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({\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\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
|
+
{"version":3,"file":"uns-core-schema.js","sourceRoot":"","sources":["../../src/uns-config/uns-core-schema.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAEhF,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC5C,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC,MAAM,EAAE,CAAC;AAEZ,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAA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AO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QACzC,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QAChD,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC;KAC1C,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAEtB,KAAK,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACnC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACpC,KAAK,EAAE,iBAAiB;IACxB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC1D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;KACtC,CAAC,CAAC,MAAM,EAAE,CAAC,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\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 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"]}
|