@bsb/syslog 9.0.1 → 9.1.1

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/lib/index.d.ts CHANGED
@@ -24,5 +24,5 @@
24
24
  * You should have received a copy of the GNU Affero General Public License
25
25
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
26
26
  */
27
- export { SyslogMessageSchema, type SyslogMessage, SyslogServerConfigSchema, type SyslogServerConfig, Config as SyslogServerConfigClass, EventSchemas as SyslogServerEventSchemas, Plugin as SyslogServerPlugin, Client as SyslogServerClient, } from "./plugins/service-syslog-server";
28
- export { SyslogClientConfigSchema, type SyslogClientConfig, Config as SyslogClientConfigClass, Plugin as SyslogClientPlugin, } from "./plugins/observable-syslog";
27
+ export { SyslogMessageSchema, type SyslogMessage, SyslogServerConfigSchema, type SyslogServerConfig, Config as SyslogServerConfigClass, EventSchemas as SyslogServerEventSchemas, Plugin as SyslogServerPlugin, Client as SyslogServerClient, } from "./plugins/service-syslog-server/index.js";
28
+ export { SyslogClientConfigSchema, type SyslogClientConfig, Config as SyslogClientConfigClass, Plugin as SyslogClientPlugin, } from "./plugins/observable-syslog/index.js";
package/lib/index.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * BSB (Better-Service-Base) is an event-bus based microservice framework.
4
3
  * Copyright (C) 2016 - 2025 BetterCorp (PTY) Ltd
@@ -25,18 +24,7 @@
25
24
  * You should have received a copy of the GNU Affero General Public License
26
25
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
27
26
  */
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.SyslogClientPlugin = exports.SyslogClientConfigClass = exports.SyslogClientConfigSchema = exports.SyslogServerClient = exports.SyslogServerPlugin = exports.SyslogServerEventSchemas = exports.SyslogServerConfigClass = exports.SyslogServerConfigSchema = exports.SyslogMessageSchema = void 0;
30
27
  // Syslog server exports (receives syslog messages)
31
- var service_syslog_server_1 = require("./plugins/service-syslog-server");
32
- Object.defineProperty(exports, "SyslogMessageSchema", { enumerable: true, get: function () { return service_syslog_server_1.SyslogMessageSchema; } });
33
- Object.defineProperty(exports, "SyslogServerConfigSchema", { enumerable: true, get: function () { return service_syslog_server_1.SyslogServerConfigSchema; } });
34
- Object.defineProperty(exports, "SyslogServerConfigClass", { enumerable: true, get: function () { return service_syslog_server_1.Config; } });
35
- Object.defineProperty(exports, "SyslogServerEventSchemas", { enumerable: true, get: function () { return service_syslog_server_1.EventSchemas; } });
36
- Object.defineProperty(exports, "SyslogServerPlugin", { enumerable: true, get: function () { return service_syslog_server_1.Plugin; } });
37
- Object.defineProperty(exports, "SyslogServerClient", { enumerable: true, get: function () { return service_syslog_server_1.Client; } });
28
+ export { SyslogMessageSchema, SyslogServerConfigSchema, Config as SyslogServerConfigClass, EventSchemas as SyslogServerEventSchemas, Plugin as SyslogServerPlugin, Client as SyslogServerClient, } from "./plugins/service-syslog-server/index.js";
38
29
  // Syslog client observable exports (sends logs to syslog)
39
- var observable_syslog_1 = require("./plugins/observable-syslog");
40
- Object.defineProperty(exports, "SyslogClientConfigSchema", { enumerable: true, get: function () { return observable_syslog_1.SyslogClientConfigSchema; } });
41
- Object.defineProperty(exports, "SyslogClientConfigClass", { enumerable: true, get: function () { return observable_syslog_1.Config; } });
42
- Object.defineProperty(exports, "SyslogClientPlugin", { enumerable: true, get: function () { return observable_syslog_1.Plugin; } });
30
+ export { SyslogClientConfigSchema, Config as SyslogClientConfigClass, Plugin as SyslogClientPlugin, } from "./plugins/observable-syslog/index.js";
@@ -26,99 +26,78 @@
26
26
  */
27
27
  import { BSBObservable, BSBObservableConstructor, BSBError } from "@bsb/base";
28
28
  import { DTrace, LogMeta } from "@bsb/base";
29
- import { z } from "zod";
29
+ import * as av from "@anyvali/js";
30
30
  /**
31
31
  * Configuration schema for syslog client observable
32
32
  */
33
- export declare const SyslogClientConfigSchema: z.ZodObject<{
34
- host: z.ZodDefault<z.ZodString>;
35
- port: z.ZodDefault<z.ZodNumber>;
36
- protocol: z.ZodDefault<z.ZodEnum<{
37
- udp: "udp";
38
- tcp: "tcp";
39
- tls: "tls";
33
+ export declare const SyslogClientConfigSchema: av.ObjectSchema<{
34
+ host: av.OptionalSchema<av.StringSchema>;
35
+ port: av.OptionalSchema<av.Int32Schema>;
36
+ protocol: av.OptionalSchema<av.EnumSchema<string[]>>;
37
+ tls: av.OptionalSchema<av.ObjectSchema<{
38
+ rejectUnauthorized: av.OptionalSchema<av.BoolSchema>;
39
+ ca: av.OptionalSchema<av.StringSchema>;
40
+ cert: av.OptionalSchema<av.StringSchema>;
41
+ key: av.OptionalSchema<av.StringSchema>;
40
42
  }>>;
41
- tls: z.ZodOptional<z.ZodObject<{
42
- rejectUnauthorized: z.ZodDefault<z.ZodBoolean>;
43
- ca: z.ZodOptional<z.ZodString>;
44
- cert: z.ZodOptional<z.ZodString>;
45
- key: z.ZodOptional<z.ZodString>;
46
- }, z.core.$strip>>;
47
- facility: z.ZodDefault<z.ZodNumber>;
48
- hostname: z.ZodOptional<z.ZodString>;
49
- appName: z.ZodDefault<z.ZodString>;
50
- rfc: z.ZodDefault<z.ZodEnum<{
51
- 3164: "3164";
52
- 5424: "5424";
43
+ facility: av.OptionalSchema<av.Int32Schema>;
44
+ hostname: av.OptionalSchema<av.StringSchema>;
45
+ appName: av.OptionalSchema<av.StringSchema>;
46
+ rfc: av.OptionalSchema<av.EnumSchema<string[]>>;
47
+ levels: av.ObjectSchema<{
48
+ debug: av.OptionalSchema<av.BoolSchema>;
49
+ info: av.OptionalSchema<av.BoolSchema>;
50
+ warn: av.OptionalSchema<av.BoolSchema>;
51
+ error: av.OptionalSchema<av.BoolSchema>;
52
+ }>;
53
+ }>;
54
+ export type SyslogClientConfig = av.Infer<typeof SyslogClientConfigSchema>;
55
+ export declare const Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
56
+ host: av.OptionalSchema<av.StringSchema>;
57
+ port: av.OptionalSchema<av.Int32Schema>;
58
+ protocol: av.OptionalSchema<av.EnumSchema<string[]>>;
59
+ tls: av.OptionalSchema<av.ObjectSchema<{
60
+ rejectUnauthorized: av.OptionalSchema<av.BoolSchema>;
61
+ ca: av.OptionalSchema<av.StringSchema>;
62
+ cert: av.OptionalSchema<av.StringSchema>;
63
+ key: av.OptionalSchema<av.StringSchema>;
53
64
  }>>;
54
- levels: z.ZodObject<{
55
- debug: z.ZodDefault<z.ZodBoolean>;
56
- info: z.ZodDefault<z.ZodBoolean>;
57
- warn: z.ZodDefault<z.ZodBoolean>;
58
- error: z.ZodDefault<z.ZodBoolean>;
59
- }, z.core.$strip>;
60
- }, z.core.$strip>;
61
- export type SyslogClientConfig = z.infer<typeof SyslogClientConfigSchema>;
62
- export declare const Config: import("@bsb/base").BSBPluginConfigClass<z.ZodObject<{
63
- host: z.ZodDefault<z.ZodString>;
64
- port: z.ZodDefault<z.ZodNumber>;
65
- protocol: z.ZodDefault<z.ZodEnum<{
66
- udp: "udp";
67
- tcp: "tcp";
68
- tls: "tls";
69
- }>>;
70
- tls: z.ZodOptional<z.ZodObject<{
71
- rejectUnauthorized: z.ZodDefault<z.ZodBoolean>;
72
- ca: z.ZodOptional<z.ZodString>;
73
- cert: z.ZodOptional<z.ZodString>;
74
- key: z.ZodOptional<z.ZodString>;
75
- }, z.core.$strip>>;
76
- facility: z.ZodDefault<z.ZodNumber>;
77
- hostname: z.ZodOptional<z.ZodString>;
78
- appName: z.ZodDefault<z.ZodString>;
79
- rfc: z.ZodDefault<z.ZodEnum<{
80
- 3164: "3164";
81
- 5424: "5424";
82
- }>>;
83
- levels: z.ZodObject<{
84
- debug: z.ZodDefault<z.ZodBoolean>;
85
- info: z.ZodDefault<z.ZodBoolean>;
86
- warn: z.ZodDefault<z.ZodBoolean>;
87
- error: z.ZodDefault<z.ZodBoolean>;
88
- }, z.core.$strip>;
89
- }, z.core.$strip>>;
65
+ facility: av.OptionalSchema<av.Int32Schema>;
66
+ hostname: av.OptionalSchema<av.StringSchema>;
67
+ appName: av.OptionalSchema<av.StringSchema>;
68
+ rfc: av.OptionalSchema<av.EnumSchema<string[]>>;
69
+ levels: av.ObjectSchema<{
70
+ debug: av.OptionalSchema<av.BoolSchema>;
71
+ info: av.OptionalSchema<av.BoolSchema>;
72
+ warn: av.OptionalSchema<av.BoolSchema>;
73
+ error: av.OptionalSchema<av.BoolSchema>;
74
+ }>;
75
+ }>>;
90
76
  /**
91
77
  * Syslog client observable plugin - sends logs to syslog servers
92
78
  */
93
79
  export declare class Plugin extends BSBObservable<InstanceType<typeof Config>> {
94
- static Config: import("@bsb/base").BSBPluginConfigClass<z.ZodObject<{
95
- host: z.ZodDefault<z.ZodString>;
96
- port: z.ZodDefault<z.ZodNumber>;
97
- protocol: z.ZodDefault<z.ZodEnum<{
98
- udp: "udp";
99
- tcp: "tcp";
100
- tls: "tls";
80
+ static Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
81
+ host: av.OptionalSchema<av.StringSchema>;
82
+ port: av.OptionalSchema<av.Int32Schema>;
83
+ protocol: av.OptionalSchema<av.EnumSchema<string[]>>;
84
+ tls: av.OptionalSchema<av.ObjectSchema<{
85
+ rejectUnauthorized: av.OptionalSchema<av.BoolSchema>;
86
+ ca: av.OptionalSchema<av.StringSchema>;
87
+ cert: av.OptionalSchema<av.StringSchema>;
88
+ key: av.OptionalSchema<av.StringSchema>;
101
89
  }>>;
102
- tls: z.ZodOptional<z.ZodObject<{
103
- rejectUnauthorized: z.ZodDefault<z.ZodBoolean>;
104
- ca: z.ZodOptional<z.ZodString>;
105
- cert: z.ZodOptional<z.ZodString>;
106
- key: z.ZodOptional<z.ZodString>;
107
- }, z.core.$strip>>;
108
- facility: z.ZodDefault<z.ZodNumber>;
109
- hostname: z.ZodOptional<z.ZodString>;
110
- appName: z.ZodDefault<z.ZodString>;
111
- rfc: z.ZodDefault<z.ZodEnum<{
112
- 3164: "3164";
113
- 5424: "5424";
114
- }>>;
115
- levels: z.ZodObject<{
116
- debug: z.ZodDefault<z.ZodBoolean>;
117
- info: z.ZodDefault<z.ZodBoolean>;
118
- warn: z.ZodDefault<z.ZodBoolean>;
119
- error: z.ZodDefault<z.ZodBoolean>;
120
- }, z.core.$strip>;
121
- }, z.core.$strip>>;
90
+ facility: av.OptionalSchema<av.Int32Schema>;
91
+ hostname: av.OptionalSchema<av.StringSchema>;
92
+ appName: av.OptionalSchema<av.StringSchema>;
93
+ rfc: av.OptionalSchema<av.EnumSchema<string[]>>;
94
+ levels: av.ObjectSchema<{
95
+ debug: av.OptionalSchema<av.BoolSchema>;
96
+ info: av.OptionalSchema<av.BoolSchema>;
97
+ warn: av.OptionalSchema<av.BoolSchema>;
98
+ error: av.OptionalSchema<av.BoolSchema>;
99
+ }>;
100
+ }>>;
122
101
  private logFormatter;
123
102
  private client;
124
103
  private isDisposed;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * BSB (Better-Service-Base) is an event-bus based microservice framework.
4
3
  * Copyright (C) 2016 - 2025 BetterCorp (PTY) Ltd
@@ -25,77 +24,42 @@
25
24
  * You should have received a copy of the GNU Affero General Public License
26
25
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
27
26
  */
28
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29
- if (k2 === undefined) k2 = k;
30
- var desc = Object.getOwnPropertyDescriptor(m, k);
31
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
32
- desc = { enumerable: true, get: function() { return m[k]; } };
33
- }
34
- Object.defineProperty(o, k2, desc);
35
- }) : (function(o, m, k, k2) {
36
- if (k2 === undefined) k2 = k;
37
- o[k2] = m[k];
38
- }));
39
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
40
- Object.defineProperty(o, "default", { enumerable: true, value: v });
41
- }) : function(o, v) {
42
- o["default"] = v;
43
- });
44
- var __importStar = (this && this.__importStar) || (function () {
45
- var ownKeys = function(o) {
46
- ownKeys = Object.getOwnPropertyNames || function (o) {
47
- var ar = [];
48
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
49
- return ar;
50
- };
51
- return ownKeys(o);
52
- };
53
- return function (mod) {
54
- if (mod && mod.__esModule) return mod;
55
- var result = {};
56
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
57
- __setModuleDefault(result, mod);
58
- return result;
59
- };
60
- })();
61
- Object.defineProperty(exports, "__esModule", { value: true });
62
- exports.Plugin = exports.Config = exports.SyslogClientConfigSchema = void 0;
63
- const base_1 = require("@bsb/base");
64
- const zod_1 = require("zod");
27
+ import { BSBObservable, createConfigSchema, LogFormatter, BSBError } from "@bsb/base";
28
+ import * as av from "@anyvali/js";
29
+ import { hostname } from "node:os";
65
30
  // @ts-ignore - no types available
66
- const SyslogClient = __importStar(require("syslog-client"));
31
+ import * as SyslogClient from "syslog-client";
67
32
  /**
68
33
  * Configuration schema for syslog client observable
69
34
  */
70
- exports.SyslogClientConfigSchema = zod_1.z.object({
71
- host: zod_1.z.string().default("localhost"),
72
- port: zod_1.z.number().int().min(1).max(65535).default(514),
73
- protocol: zod_1.z.enum(["udp", "tcp", "tls"]).default("udp"),
74
- tls: zod_1.z.object({
75
- rejectUnauthorized: zod_1.z.boolean().default(true),
76
- ca: zod_1.z.string().optional(),
77
- cert: zod_1.z.string().optional(),
78
- key: zod_1.z.string().optional(),
79
- }).optional(),
80
- facility: zod_1.z.number().int().min(0).max(23).default(16), // local0
81
- hostname: zod_1.z.string().optional(),
82
- appName: zod_1.z.string().default("bsb-app"),
83
- rfc: zod_1.z.enum(["3164", "5424"]).default("5424"),
84
- // Log level filtering
85
- levels: zod_1.z.object({
86
- debug: zod_1.z.boolean().default(true),
87
- info: zod_1.z.boolean().default(true),
88
- warn: zod_1.z.boolean().default(true),
89
- error: zod_1.z.boolean().default(true),
90
- }),
91
- });
92
- exports.Config = (0, base_1.createConfigSchema)({
35
+ export const SyslogClientConfigSchema = av.object({
36
+ host: av.optional(av.string()).default("localhost"),
37
+ port: av.optional(av.int32().min(1).max(65535)).default(514),
38
+ protocol: av.optional(av.enum_(["udp", "tcp", "tls"])).default("udp"),
39
+ tls: av.optional(av.object({
40
+ rejectUnauthorized: av.optional(av.bool()).default(true),
41
+ ca: av.optional(av.string()),
42
+ cert: av.optional(av.string()),
43
+ key: av.optional(av.string()),
44
+ }, { unknownKeys: "strip" })),
45
+ facility: av.optional(av.int32().min(0).max(23)).default(16),
46
+ hostname: av.optional(av.string()),
47
+ appName: av.optional(av.string()).default("bsb-app"),
48
+ rfc: av.optional(av.enum_(["3164", "5424"])).default("5424"),
49
+ levels: av.object({
50
+ debug: av.optional(av.bool()).default(true),
51
+ info: av.optional(av.bool()).default(true),
52
+ warn: av.optional(av.bool()).default(true),
53
+ error: av.optional(av.bool()).default(true),
54
+ }, { unknownKeys: "strip" }),
55
+ }, { unknownKeys: "strip" });
56
+ export const Config = createConfigSchema({
93
57
  name: 'observable-syslog',
94
58
  description: 'Syslog client observable plugin for forwarding logs to syslog servers',
95
59
  version: '9.0.0',
96
60
  image: './assets/syslog-icon.png',
97
61
  tags: ['syslog', 'logging', 'observable', 'network'],
98
- }, exports.SyslogClientConfigSchema);
62
+ }, SyslogClientConfigSchema);
99
63
  /**
100
64
  * Convert BSB log level to syslog severity
101
65
  */
@@ -118,9 +82,9 @@ function bsbLevelToSyslogSeverity(level) {
118
82
  /**
119
83
  * Syslog client observable plugin - sends logs to syslog servers
120
84
  */
121
- class Plugin extends base_1.BSBObservable {
122
- static Config = exports.Config;
123
- logFormatter = new base_1.LogFormatter();
85
+ export class Plugin extends BSBObservable {
86
+ static Config = Config;
87
+ logFormatter = new LogFormatter();
124
88
  client = null;
125
89
  isDisposed = false;
126
90
  constructor(config) {
@@ -128,7 +92,7 @@ class Plugin extends base_1.BSBObservable {
128
92
  }
129
93
  async init() {
130
94
  const options = {
131
- syslogHostname: this.config.hostname || require("os").hostname(),
95
+ syslogHostname: this.config.hostname || hostname(),
132
96
  appName: this.config.appName,
133
97
  facility: this.config.facility,
134
98
  rfc: this.config.rfc === "3164" ? SyslogClient.RFC3164 : SyslogClient.RFC5424,
@@ -212,7 +176,7 @@ class Plugin extends base_1.BSBObservable {
212
176
  if (!this.config.levels.error) {
213
177
  return;
214
178
  }
215
- if (message instanceof base_1.BSBError) {
179
+ if (message instanceof BSBError) {
216
180
  if (message.raw !== null) {
217
181
  this.writeLog("error", message.raw.trace, pluginName, message.raw.message, message.raw.meta);
218
182
  }
@@ -232,4 +196,3 @@ class Plugin extends base_1.BSBObservable {
232
196
  }
233
197
  }
234
198
  }
235
- exports.Plugin = Plugin;
@@ -26,52 +26,45 @@
26
26
  */
27
27
  import { BSBService, BSBServiceConstructor, BSBServiceClient } from "@bsb/base";
28
28
  import { Observable } from "@bsb/base";
29
- import { z } from "zod";
29
+ import * as av from "@anyvali/js";
30
30
  /**
31
31
  * Syslog message structure
32
32
  */
33
- export declare const SyslogMessageSchema: z.ZodObject<{
34
- gatewayTime: z.ZodNumber;
35
- date: z.ZodNumber;
36
- host: z.ZodString;
37
- protocol: z.ZodString;
38
- message: z.ZodString;
39
- }, z.core.$strip>;
40
- export type SyslogMessage = z.infer<typeof SyslogMessageSchema>;
33
+ export declare const SyslogMessageSchema: av.ObjectSchema<{
34
+ gatewayTime: av.NumberSchema;
35
+ date: av.NumberSchema;
36
+ host: av.StringSchema;
37
+ protocol: av.StringSchema;
38
+ message: av.StringSchema;
39
+ }>;
40
+ export type SyslogMessage = av.Infer<typeof SyslogMessageSchema>;
41
41
  /**
42
42
  * Configuration schema for syslog server
43
43
  */
44
- export declare const SyslogServerConfigSchema: z.ZodObject<{
45
- port: z.ZodDefault<z.ZodNumber>;
46
- address: z.ZodDefault<z.ZodString>;
47
- exclusive: z.ZodDefault<z.ZodBoolean>;
48
- }, z.core.$strip>;
49
- export type SyslogServerConfig = z.infer<typeof SyslogServerConfigSchema>;
50
- export declare const Config: import("@bsb/base").BSBPluginConfigClass<z.ZodObject<{
51
- port: z.ZodDefault<z.ZodNumber>;
52
- address: z.ZodDefault<z.ZodString>;
53
- exclusive: z.ZodDefault<z.ZodBoolean>;
54
- }, z.core.$strip>>;
44
+ export declare const SyslogServerConfigSchema: av.ObjectSchema<{
45
+ port: av.OptionalSchema<av.Int32Schema>;
46
+ address: av.OptionalSchema<av.StringSchema>;
47
+ exclusive: av.OptionalSchema<av.BoolSchema>;
48
+ }>;
49
+ export type SyslogServerConfig = av.Infer<typeof SyslogServerConfigSchema>;
50
+ export declare const Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
51
+ port: av.OptionalSchema<av.Int32Schema>;
52
+ address: av.OptionalSchema<av.StringSchema>;
53
+ exclusive: av.OptionalSchema<av.BoolSchema>;
54
+ }>>;
55
55
  /**
56
56
  * Event schemas for syslog server
57
57
  */
58
58
  export declare const EventSchemas: {
59
59
  readonly emitEvents: {
60
60
  readonly onMessage: {
61
- input: {
62
- _bsb: "object";
63
- properties: {
64
- readonly gatewayTime: import("@bsb/base").BSBNumberType;
65
- readonly date: import("@bsb/base").BSBNumberType;
66
- readonly host: import("@bsb/base").BSBStringType;
67
- readonly protocol: import("@bsb/base").BSBStringType;
68
- readonly message: import("@bsb/base").BSBStringType;
69
- };
70
- required: string[];
71
- description?: string;
72
- optional?: boolean;
73
- nullable?: boolean;
74
- };
61
+ input: av.ObjectSchema<{
62
+ gatewayTime: import("@bsb/base").BSBType;
63
+ date: import("@bsb/base").BSBType;
64
+ host: av.StringSchema;
65
+ protocol: av.StringSchema;
66
+ message: av.StringSchema;
67
+ }>;
75
68
  description?: string;
76
69
  readonly __brand: "fire-and-forget";
77
70
  };
@@ -86,28 +79,21 @@ export declare const EventSchemas: {
86
79
  * Syslog server service plugin - receives syslog messages
87
80
  */
88
81
  export declare class Plugin extends BSBService<InstanceType<typeof Config>, typeof EventSchemas> {
89
- static Config: import("@bsb/base").BSBPluginConfigClass<z.ZodObject<{
90
- port: z.ZodDefault<z.ZodNumber>;
91
- address: z.ZodDefault<z.ZodString>;
92
- exclusive: z.ZodDefault<z.ZodBoolean>;
93
- }, z.core.$strip>>;
82
+ static Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
83
+ port: av.OptionalSchema<av.Int32Schema>;
84
+ address: av.OptionalSchema<av.StringSchema>;
85
+ exclusive: av.OptionalSchema<av.BoolSchema>;
86
+ }>>;
94
87
  static EventSchemas: {
95
88
  readonly emitEvents: {
96
89
  readonly onMessage: {
97
- input: {
98
- _bsb: "object";
99
- properties: {
100
- readonly gatewayTime: import("@bsb/base").BSBNumberType;
101
- readonly date: import("@bsb/base").BSBNumberType;
102
- readonly host: import("@bsb/base").BSBStringType;
103
- readonly protocol: import("@bsb/base").BSBStringType;
104
- readonly message: import("@bsb/base").BSBStringType;
105
- };
106
- required: string[];
107
- description?: string;
108
- optional?: boolean;
109
- nullable?: boolean;
110
- };
90
+ input: av.ObjectSchema<{
91
+ gatewayTime: import("@bsb/base").BSBType;
92
+ date: import("@bsb/base").BSBType;
93
+ host: av.StringSchema;
94
+ protocol: av.StringSchema;
95
+ message: av.StringSchema;
96
+ }>;
111
97
  description?: string;
112
98
  readonly __brand: "fire-and-forget";
113
99
  };
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * BSB (Better-Service-Base) is an event-bus based microservice framework.
4
3
  * Copyright (C) 2016 - 2025 BetterCorp (PTY) Ltd
@@ -25,48 +24,47 @@
25
24
  * You should have received a copy of the GNU Affero General Public License
26
25
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
27
26
  */
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Client = exports.Plugin = exports.EventSchemas = exports.Config = exports.SyslogServerConfigSchema = exports.SyslogMessageSchema = void 0;
30
- const SyslogServer = require("syslog-server");
31
- const base_1 = require("@bsb/base");
32
- const zod_1 = require("zod");
33
- const base_2 = require("@bsb/base");
27
+ import { BSBService, BSBServiceClient, createConfigSchema, bsb } from "@bsb/base";
28
+ import * as av from "@anyvali/js";
29
+ import { createFireAndForgetEvent } from "@bsb/base";
30
+ // @ts-ignore - no types available
31
+ import SyslogServer from "syslog-server";
34
32
  /**
35
33
  * Syslog message structure
36
34
  */
37
- exports.SyslogMessageSchema = zod_1.z.object({
38
- gatewayTime: zod_1.z.number(),
39
- date: zod_1.z.number(),
40
- host: zod_1.z.string(),
41
- protocol: zod_1.z.string(),
42
- message: zod_1.z.string(),
43
- });
35
+ export const SyslogMessageSchema = av.object({
36
+ gatewayTime: av.number(),
37
+ date: av.number(),
38
+ host: av.string(),
39
+ protocol: av.string(),
40
+ message: av.string(),
41
+ }, { unknownKeys: "strip" });
44
42
  /**
45
43
  * Configuration schema for syslog server
46
44
  */
47
- exports.SyslogServerConfigSchema = zod_1.z.object({
48
- port: zod_1.z.number().int().min(1).max(65535).default(514),
49
- address: zod_1.z.string().default("0.0.0.0"),
50
- exclusive: zod_1.z.boolean().default(false),
51
- });
52
- exports.Config = (0, base_1.createConfigSchema)({
45
+ export const SyslogServerConfigSchema = av.object({
46
+ port: av.optional(av.int32().min(1).max(65535)).default(514),
47
+ address: av.optional(av.string()).default("0.0.0.0"),
48
+ exclusive: av.optional(av.bool()).default(false),
49
+ }, { unknownKeys: "strip" });
50
+ export const Config = createConfigSchema({
53
51
  name: 'service-syslog-server',
54
52
  description: 'Syslog server service plugin that receives messages and emits events',
55
53
  version: '9.0.0',
56
54
  image: './assets/syslog-icon.png',
57
55
  tags: ['syslog', 'server', 'service', 'events'],
58
- }, exports.SyslogServerConfigSchema);
56
+ }, SyslogServerConfigSchema);
59
57
  /**
60
58
  * Event schemas for syslog server
61
59
  */
62
- exports.EventSchemas = {
60
+ export const EventSchemas = {
63
61
  emitEvents: {
64
- onMessage: (0, base_2.createFireAndForgetEvent)(base_1.bsb.object({
65
- gatewayTime: base_1.bsb.number({ description: "Gateway timestamp (epoch ms)" }),
66
- date: base_1.bsb.number({ description: "Original syslog timestamp (epoch ms)" }),
67
- host: base_1.bsb.string({ description: "Source host" }),
68
- protocol: base_1.bsb.string({ description: "Transport protocol" }),
69
- message: base_1.bsb.string({ description: "Syslog message content" }),
62
+ onMessage: createFireAndForgetEvent(bsb.object({
63
+ gatewayTime: bsb.number({ description: "Gateway timestamp (epoch ms)" }),
64
+ date: bsb.number({ description: "Original syslog timestamp (epoch ms)" }),
65
+ host: bsb.string({ description: "Source host" }),
66
+ protocol: bsb.string({ description: "Transport protocol" }),
67
+ message: bsb.string({ description: "Syslog message content" }),
70
68
  }, "Syslog message payload"), "Syslog message received from client"),
71
69
  },
72
70
  onEvents: {},
@@ -78,9 +76,9 @@ exports.EventSchemas = {
78
76
  /**
79
77
  * Syslog server service plugin - receives syslog messages
80
78
  */
81
- class Plugin extends base_1.BSBService {
82
- static Config = exports.Config;
83
- static EventSchemas = exports.EventSchemas;
79
+ export class Plugin extends BSBService {
80
+ static Config = Config;
81
+ static EventSchemas = EventSchemas;
84
82
  initBeforePlugins;
85
83
  initAfterPlugins;
86
84
  runBeforePlugins;
@@ -89,7 +87,7 @@ class Plugin extends base_1.BSBService {
89
87
  constructor(config) {
90
88
  super({
91
89
  ...config,
92
- eventSchemas: exports.EventSchemas,
90
+ eventSchemas: EventSchemas,
93
91
  });
94
92
  }
95
93
  async init() {
@@ -127,11 +125,10 @@ class Plugin extends base_1.BSBService {
127
125
  }
128
126
  }
129
127
  }
130
- exports.Plugin = Plugin;
131
128
  /**
132
129
  * Syslog server client - allows other services to subscribe to syslog messages
133
130
  */
134
- class Client extends base_1.BSBServiceClient {
131
+ export class Client extends BSBServiceClient {
135
132
  initBeforePlugins;
136
133
  initAfterPlugins;
137
134
  runBeforePlugins;
@@ -145,4 +142,3 @@ class Client extends base_1.BSBServiceClient {
145
142
  // });
146
143
  }
147
144
  }
148
- exports.Client = Client;
@@ -2,112 +2,6 @@
2
2
  "pluginName": "observable-syslog",
3
3
  "version": "9.0.0",
4
4
  "events": {},
5
- "configSchema": {
6
- "$schema": "https://json-schema.org/draft/2020-12/schema",
7
- "type": "object",
8
- "properties": {
9
- "host": {
10
- "default": "localhost",
11
- "type": "string"
12
- },
13
- "port": {
14
- "default": 514,
15
- "type": "integer",
16
- "minimum": 1,
17
- "maximum": 65535
18
- },
19
- "protocol": {
20
- "default": "udp",
21
- "type": "string",
22
- "enum": [
23
- "udp",
24
- "tcp",
25
- "tls"
26
- ]
27
- },
28
- "tls": {
29
- "type": "object",
30
- "properties": {
31
- "rejectUnauthorized": {
32
- "default": true,
33
- "type": "boolean"
34
- },
35
- "ca": {
36
- "type": "string"
37
- },
38
- "cert": {
39
- "type": "string"
40
- },
41
- "key": {
42
- "type": "string"
43
- }
44
- },
45
- "required": [
46
- "rejectUnauthorized"
47
- ],
48
- "additionalProperties": false
49
- },
50
- "facility": {
51
- "default": 16,
52
- "type": "integer",
53
- "minimum": 0,
54
- "maximum": 23
55
- },
56
- "hostname": {
57
- "type": "string"
58
- },
59
- "appName": {
60
- "default": "bsb-app",
61
- "type": "string"
62
- },
63
- "rfc": {
64
- "default": "5424",
65
- "type": "string",
66
- "enum": [
67
- "3164",
68
- "5424"
69
- ]
70
- },
71
- "levels": {
72
- "type": "object",
73
- "properties": {
74
- "debug": {
75
- "default": true,
76
- "type": "boolean"
77
- },
78
- "info": {
79
- "default": true,
80
- "type": "boolean"
81
- },
82
- "warn": {
83
- "default": true,
84
- "type": "boolean"
85
- },
86
- "error": {
87
- "default": true,
88
- "type": "boolean"
89
- }
90
- },
91
- "required": [
92
- "debug",
93
- "info",
94
- "warn",
95
- "error"
96
- ],
97
- "additionalProperties": false
98
- }
99
- },
100
- "required": [
101
- "host",
102
- "port",
103
- "protocol",
104
- "facility",
105
- "appName",
106
- "rfc",
107
- "levels"
108
- ],
109
- "additionalProperties": false
110
- },
111
5
  "pluginType": "observable",
112
6
  "capabilities": {
113
7
  "logging": {
@@ -12,111 +12,5 @@
12
12
  ],
13
13
  "documentation": [],
14
14
  "dependencies": [],
15
- "image": "./assets/syslog-icon.png",
16
- "configSchema": {
17
- "$schema": "https://json-schema.org/draft/2020-12/schema",
18
- "type": "object",
19
- "properties": {
20
- "host": {
21
- "default": "localhost",
22
- "type": "string"
23
- },
24
- "port": {
25
- "default": 514,
26
- "type": "integer",
27
- "minimum": 1,
28
- "maximum": 65535
29
- },
30
- "protocol": {
31
- "default": "udp",
32
- "type": "string",
33
- "enum": [
34
- "udp",
35
- "tcp",
36
- "tls"
37
- ]
38
- },
39
- "tls": {
40
- "type": "object",
41
- "properties": {
42
- "rejectUnauthorized": {
43
- "default": true,
44
- "type": "boolean"
45
- },
46
- "ca": {
47
- "type": "string"
48
- },
49
- "cert": {
50
- "type": "string"
51
- },
52
- "key": {
53
- "type": "string"
54
- }
55
- },
56
- "required": [
57
- "rejectUnauthorized"
58
- ],
59
- "additionalProperties": false
60
- },
61
- "facility": {
62
- "default": 16,
63
- "type": "integer",
64
- "minimum": 0,
65
- "maximum": 23
66
- },
67
- "hostname": {
68
- "type": "string"
69
- },
70
- "appName": {
71
- "default": "bsb-app",
72
- "type": "string"
73
- },
74
- "rfc": {
75
- "default": "5424",
76
- "type": "string",
77
- "enum": [
78
- "3164",
79
- "5424"
80
- ]
81
- },
82
- "levels": {
83
- "type": "object",
84
- "properties": {
85
- "debug": {
86
- "default": true,
87
- "type": "boolean"
88
- },
89
- "info": {
90
- "default": true,
91
- "type": "boolean"
92
- },
93
- "warn": {
94
- "default": true,
95
- "type": "boolean"
96
- },
97
- "error": {
98
- "default": true,
99
- "type": "boolean"
100
- }
101
- },
102
- "required": [
103
- "debug",
104
- "info",
105
- "warn",
106
- "error"
107
- ],
108
- "additionalProperties": false
109
- }
110
- },
111
- "required": [
112
- "host",
113
- "port",
114
- "protocol",
115
- "facility",
116
- "appName",
117
- "rfc",
118
- "levels"
119
- ],
120
- "additionalProperties": false
121
- }
15
+ "image": "./assets/syslog-icon.png"
122
16
  }
@@ -7,68 +7,45 @@
7
7
  "category": "emitEvents",
8
8
  "description": "Syslog message received from client",
9
9
  "inputSchema": {
10
- "description": "Syslog message payload",
11
- "type": "object",
12
- "properties": {
13
- "gatewayTime": {
14
- "description": "Gateway timestamp (epoch ms)",
15
- "type": "number",
16
- "format": "double"
10
+ "anyvaliVersion": "1.0",
11
+ "schemaVersion": "1",
12
+ "root": {
13
+ "kind": "object",
14
+ "properties": {
15
+ "gatewayTime": {
16
+ "kind": "number"
17
+ },
18
+ "date": {
19
+ "kind": "number"
20
+ },
21
+ "host": {
22
+ "kind": "string"
23
+ },
24
+ "protocol": {
25
+ "kind": "string"
26
+ },
27
+ "message": {
28
+ "kind": "string"
29
+ }
17
30
  },
18
- "date": {
19
- "description": "Original syslog timestamp (epoch ms)",
20
- "type": "number",
21
- "format": "double"
22
- },
23
- "host": {
24
- "description": "Source host",
25
- "type": "string"
26
- },
27
- "protocol": {
28
- "description": "Transport protocol",
29
- "type": "string"
30
- },
31
- "message": {
32
- "description": "Syslog message content",
33
- "type": "string"
34
- }
31
+ "required": [
32
+ "gatewayTime",
33
+ "date",
34
+ "host",
35
+ "protocol",
36
+ "message"
37
+ ],
38
+ "unknownKeys": "strip"
35
39
  },
36
- "required": [
37
- "gatewayTime",
38
- "date",
39
- "host",
40
- "protocol",
41
- "message"
42
- ]
40
+ "definitions": {},
41
+ "extensions": {
42
+ "bsb": {
43
+ "description": "Syslog message payload"
44
+ }
45
+ }
43
46
  },
44
47
  "outputSchema": null
45
48
  }
46
49
  },
47
- "configSchema": {
48
- "$schema": "https://json-schema.org/draft/2020-12/schema",
49
- "type": "object",
50
- "properties": {
51
- "port": {
52
- "default": 514,
53
- "type": "integer",
54
- "minimum": 1,
55
- "maximum": 65535
56
- },
57
- "address": {
58
- "default": "0.0.0.0",
59
- "type": "string"
60
- },
61
- "exclusive": {
62
- "default": false,
63
- "type": "boolean"
64
- }
65
- },
66
- "required": [
67
- "port",
68
- "address",
69
- "exclusive"
70
- ],
71
- "additionalProperties": false
72
- },
73
50
  "pluginType": "service"
74
51
  }
@@ -12,31 +12,5 @@
12
12
  ],
13
13
  "documentation": [],
14
14
  "dependencies": [],
15
- "image": "./assets/syslog-icon.png",
16
- "configSchema": {
17
- "$schema": "https://json-schema.org/draft/2020-12/schema",
18
- "type": "object",
19
- "properties": {
20
- "port": {
21
- "default": 514,
22
- "type": "integer",
23
- "minimum": 1,
24
- "maximum": 65535
25
- },
26
- "address": {
27
- "default": "0.0.0.0",
28
- "type": "string"
29
- },
30
- "exclusive": {
31
- "default": false,
32
- "type": "boolean"
33
- }
34
- },
35
- "required": [
36
- "port",
37
- "address",
38
- "exclusive"
39
- ],
40
- "additionalProperties": false
41
- }
15
+ "image": "./assets/syslog-icon.png"
42
16
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@bsb/syslog",
3
- "version": "9.0.1",
3
+ "version": "9.1.1",
4
+ "type": "module",
4
5
  "license": "(AGPL-3.0-only OR Commercial)",
5
6
  "author": {
6
7
  "name": "BetterCorp (PTY) Ltd",
@@ -41,12 +42,12 @@
41
42
  "@bsb/base": "^9.0.0"
42
43
  },
43
44
  "dependencies": {
45
+ "@anyvali/js": "^0.2.0",
44
46
  "syslog-client": "^1.1.1",
45
- "syslog-server": "^1.0.1",
46
- "zod": "^4.3.6"
47
+ "syslog-server": "^1.0.1"
47
48
  },
48
49
  "devDependencies": {
49
- "@bsb/base": "file:../../../nodejs",
50
+ "@bsb/base": "^9.0.0",
50
51
  "@types/node": "^25.0.0",
51
52
  "mocha": "^11.0.0",
52
53
  "typescript": "^5.9.0"
@@ -57,7 +58,3 @@
57
58
  },
58
59
  "homepage": "https://io.bsbcode.dev/packages/nodejs/@bsb/syslog"
59
60
  }
60
-
61
-
62
-
63
-