@bsb/observable-pino 9.0.1 → 9.1.2

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,4 +24,4 @@
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 { PinoConfigSchema, type PinoConfig, Config, Plugin, } from "./plugins/observable-pino";
27
+ export { PinoConfigSchema, type PinoConfig, Config, Plugin, } from "./plugins/observable-pino/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,9 +24,4 @@
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.Plugin = exports.Config = exports.PinoConfigSchema = void 0;
30
- var observable_pino_1 = require("./plugins/observable-pino");
31
- Object.defineProperty(exports, "PinoConfigSchema", { enumerable: true, get: function () { return observable_pino_1.PinoConfigSchema; } });
32
- Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return observable_pino_1.Config; } });
33
- Object.defineProperty(exports, "Plugin", { enumerable: true, get: function () { return observable_pino_1.Plugin; } });
27
+ export { PinoConfigSchema, Config, Plugin, } from "./plugins/observable-pino/index.js";
@@ -26,93 +26,72 @@
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 Pino observable
32
32
  */
33
- export declare const PinoConfigSchema: z.ZodObject<{
34
- level: z.ZodDefault<z.ZodEnum<{
35
- fatal: "fatal";
36
- error: "error";
37
- warn: "warn";
38
- info: "info";
39
- debug: "debug";
40
- trace: "trace";
41
- }>>;
42
- prettyPrint: z.ZodObject<{
43
- enabled: z.ZodDefault<z.ZodBoolean>;
44
- colorize: z.ZodDefault<z.ZodBoolean>;
45
- translateTime: z.ZodDefault<z.ZodString>;
46
- ignore: z.ZodDefault<z.ZodString>;
47
- }, z.core.$strip>;
48
- transport: z.ZodObject<{
49
- enabled: z.ZodDefault<z.ZodBoolean>;
50
- target: z.ZodOptional<z.ZodString>;
51
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
52
- }, z.core.$strip>;
53
- serializers: z.ZodObject<{
54
- error: z.ZodDefault<z.ZodBoolean>;
55
- }, z.core.$strip>;
56
- base: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
57
- redact: z.ZodDefault<z.ZodArray<z.ZodString>>;
58
- }, z.core.$strip>;
59
- export type PinoConfig = z.infer<typeof PinoConfigSchema>;
60
- export declare const Config: import("@bsb/base").BSBPluginConfigClass<z.ZodObject<{
61
- level: z.ZodDefault<z.ZodEnum<{
62
- fatal: "fatal";
63
- error: "error";
64
- warn: "warn";
65
- info: "info";
66
- debug: "debug";
67
- trace: "trace";
68
- }>>;
69
- prettyPrint: z.ZodObject<{
70
- enabled: z.ZodDefault<z.ZodBoolean>;
71
- colorize: z.ZodDefault<z.ZodBoolean>;
72
- translateTime: z.ZodDefault<z.ZodString>;
73
- ignore: z.ZodDefault<z.ZodString>;
74
- }, z.core.$strip>;
75
- transport: z.ZodObject<{
76
- enabled: z.ZodDefault<z.ZodBoolean>;
77
- target: z.ZodOptional<z.ZodString>;
78
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
79
- }, z.core.$strip>;
80
- serializers: z.ZodObject<{
81
- error: z.ZodDefault<z.ZodBoolean>;
82
- }, z.core.$strip>;
83
- base: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
84
- redact: z.ZodDefault<z.ZodArray<z.ZodString>>;
85
- }, z.core.$strip>>;
33
+ export declare const PinoConfigSchema: av.ObjectSchema<{
34
+ level: av.OptionalSchema<av.EnumSchema<string[]>>;
35
+ prettyPrint: av.ObjectSchema<{
36
+ enabled: av.OptionalSchema<av.BoolSchema>;
37
+ colorize: av.OptionalSchema<av.BoolSchema>;
38
+ translateTime: av.OptionalSchema<av.StringSchema>;
39
+ ignore: av.OptionalSchema<av.StringSchema>;
40
+ }>;
41
+ transport: av.ObjectSchema<{
42
+ enabled: av.OptionalSchema<av.BoolSchema>;
43
+ target: av.OptionalSchema<av.StringSchema>;
44
+ options: av.OptionalSchema<av.RecordSchema<av.UnknownSchema>>;
45
+ }>;
46
+ serializers: av.ObjectSchema<{
47
+ error: av.OptionalSchema<av.BoolSchema>;
48
+ }>;
49
+ base: av.OptionalSchema<av.RecordSchema<av.UnknownSchema>>;
50
+ redact: av.OptionalSchema<av.ArraySchema<av.StringSchema>>;
51
+ }>;
52
+ export type PinoConfig = av.Infer<typeof PinoConfigSchema>;
53
+ export declare const Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
54
+ level: av.OptionalSchema<av.EnumSchema<string[]>>;
55
+ prettyPrint: av.ObjectSchema<{
56
+ enabled: av.OptionalSchema<av.BoolSchema>;
57
+ colorize: av.OptionalSchema<av.BoolSchema>;
58
+ translateTime: av.OptionalSchema<av.StringSchema>;
59
+ ignore: av.OptionalSchema<av.StringSchema>;
60
+ }>;
61
+ transport: av.ObjectSchema<{
62
+ enabled: av.OptionalSchema<av.BoolSchema>;
63
+ target: av.OptionalSchema<av.StringSchema>;
64
+ options: av.OptionalSchema<av.RecordSchema<av.UnknownSchema>>;
65
+ }>;
66
+ serializers: av.ObjectSchema<{
67
+ error: av.OptionalSchema<av.BoolSchema>;
68
+ }>;
69
+ base: av.OptionalSchema<av.RecordSchema<av.UnknownSchema>>;
70
+ redact: av.OptionalSchema<av.ArraySchema<av.StringSchema>>;
71
+ }>>;
86
72
  /**
87
73
  * Pino observable plugin - high-performance JSON logger
88
74
  */
89
75
  export declare class Plugin extends BSBObservable<InstanceType<typeof Config>> {
90
- static Config: import("@bsb/base").BSBPluginConfigClass<z.ZodObject<{
91
- level: z.ZodDefault<z.ZodEnum<{
92
- fatal: "fatal";
93
- error: "error";
94
- warn: "warn";
95
- info: "info";
96
- debug: "debug";
97
- trace: "trace";
98
- }>>;
99
- prettyPrint: z.ZodObject<{
100
- enabled: z.ZodDefault<z.ZodBoolean>;
101
- colorize: z.ZodDefault<z.ZodBoolean>;
102
- translateTime: z.ZodDefault<z.ZodString>;
103
- ignore: z.ZodDefault<z.ZodString>;
104
- }, z.core.$strip>;
105
- transport: z.ZodObject<{
106
- enabled: z.ZodDefault<z.ZodBoolean>;
107
- target: z.ZodOptional<z.ZodString>;
108
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
109
- }, z.core.$strip>;
110
- serializers: z.ZodObject<{
111
- error: z.ZodDefault<z.ZodBoolean>;
112
- }, z.core.$strip>;
113
- base: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
114
- redact: z.ZodDefault<z.ZodArray<z.ZodString>>;
115
- }, z.core.$strip>>;
76
+ static Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
77
+ level: av.OptionalSchema<av.EnumSchema<string[]>>;
78
+ prettyPrint: av.ObjectSchema<{
79
+ enabled: av.OptionalSchema<av.BoolSchema>;
80
+ colorize: av.OptionalSchema<av.BoolSchema>;
81
+ translateTime: av.OptionalSchema<av.StringSchema>;
82
+ ignore: av.OptionalSchema<av.StringSchema>;
83
+ }>;
84
+ transport: av.ObjectSchema<{
85
+ enabled: av.OptionalSchema<av.BoolSchema>;
86
+ target: av.OptionalSchema<av.StringSchema>;
87
+ options: av.OptionalSchema<av.RecordSchema<av.UnknownSchema>>;
88
+ }>;
89
+ serializers: av.ObjectSchema<{
90
+ error: av.OptionalSchema<av.BoolSchema>;
91
+ }>;
92
+ base: av.OptionalSchema<av.RecordSchema<av.UnknownSchema>>;
93
+ redact: av.OptionalSchema<av.ArraySchema<av.StringSchema>>;
94
+ }>>;
116
95
  private logFormatter;
117
96
  private logger;
118
97
  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,44 +24,39 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.Plugin = exports.Config = exports.PinoConfigSchema = void 0;
33
- const base_1 = require("@bsb/base");
34
- const zod_1 = require("zod");
35
- const pino_1 = __importDefault(require("pino"));
27
+ import { BSBObservable, createConfigSchema, LogFormatter, BSBError } from "@bsb/base";
28
+ import * as av from "@anyvali/js";
29
+ import pino from "pino";
36
30
  /**
37
31
  * Configuration schema for Pino observable
38
32
  */
39
- exports.PinoConfigSchema = zod_1.z.object({
40
- level: zod_1.z.enum(["fatal", "error", "warn", "info", "debug", "trace"]).default("info"),
41
- prettyPrint: zod_1.z.object({
42
- enabled: zod_1.z.boolean().default(false),
43
- colorize: zod_1.z.boolean().default(true),
44
- translateTime: zod_1.z.string().default("SYS:standard"),
45
- ignore: zod_1.z.string().default("pid,hostname"),
46
- }),
47
- transport: zod_1.z.object({
48
- enabled: zod_1.z.boolean().default(false),
49
- target: zod_1.z.string().optional(),
50
- options: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
51
- }),
52
- serializers: zod_1.z.object({
53
- error: zod_1.z.boolean().default(true),
54
- }),
55
- base: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
56
- redact: zod_1.z.array(zod_1.z.string()).default([]),
57
- });
58
- exports.Config = (0, base_1.createConfigSchema)({
33
+ export const PinoConfigSchema = av.object({
34
+ level: av.optional(av.enum_(["fatal", "error", "warn", "info", "debug", "trace"])).default("info"),
35
+ prettyPrint: av.object({
36
+ enabled: av.optional(av.bool()).default(false),
37
+ colorize: av.optional(av.bool()).default(true),
38
+ translateTime: av.optional(av.string()).default("SYS:standard"),
39
+ ignore: av.optional(av.string()).default("pid,hostname"),
40
+ }, { unknownKeys: "strip" }),
41
+ transport: av.object({
42
+ enabled: av.optional(av.bool()).default(false),
43
+ target: av.optional(av.string()),
44
+ options: av.optional(av.record(av.unknown())),
45
+ }, { unknownKeys: "strip" }),
46
+ serializers: av.object({
47
+ error: av.optional(av.bool()).default(true),
48
+ }, { unknownKeys: "strip" }),
49
+ base: av.optional(av.record(av.unknown())),
50
+ redact: av.optional(av.array(av.string())).default([]),
51
+ }, { unknownKeys: "strip" });
52
+ export const Config = createConfigSchema({
59
53
  name: 'observable-pino',
60
54
  description: 'Pino-based high-performance structured logging observable',
61
55
  version: '9.0.0',
62
56
  image: './observable-pino.png',
63
57
  tags: ['pino', 'logging', 'observability', 'json'],
64
58
  documentation: ['./docs/plugin.md'],
65
- }, exports.PinoConfigSchema);
59
+ }, PinoConfigSchema);
66
60
  /**
67
61
  * Convert BSB log level to Pino log level
68
62
  */
@@ -85,9 +79,9 @@ function bsbLevelToPinoLevel(level) {
85
79
  /**
86
80
  * Pino observable plugin - high-performance JSON logger
87
81
  */
88
- class Plugin extends base_1.BSBObservable {
89
- static Config = exports.Config;
90
- logFormatter = new base_1.LogFormatter();
82
+ export class Plugin extends BSBObservable {
83
+ static Config = Config;
84
+ logFormatter = new LogFormatter();
91
85
  logger;
92
86
  isDisposed = false;
93
87
  constructor(config) {
@@ -100,8 +94,8 @@ class Plugin extends base_1.BSBObservable {
100
94
  // Configure serializers
101
95
  if (this.config.serializers.error) {
102
96
  pinoOptions.serializers = {
103
- err: pino_1.default.stdSerializers.err,
104
- error: pino_1.default.stdSerializers.err,
97
+ err: pino.stdSerializers.err,
98
+ error: pino.stdSerializers.err,
105
99
  };
106
100
  }
107
101
  // Configure base fields
@@ -131,7 +125,7 @@ class Plugin extends base_1.BSBObservable {
131
125
  };
132
126
  }
133
127
  // Create logger
134
- this.logger = (0, pino_1.default)(pinoOptions);
128
+ this.logger = pino(pinoOptions);
135
129
  }
136
130
  async run() {
137
131
  // No runtime setup needed
@@ -174,7 +168,7 @@ class Plugin extends base_1.BSBObservable {
174
168
  this.sendLog("warn", trace, pluginName, message, meta);
175
169
  }
176
170
  error(trace, pluginName, message, meta) {
177
- if (message instanceof base_1.BSBError) {
171
+ if (message instanceof BSBError) {
178
172
  if (message.raw !== null) {
179
173
  this.sendLog("error", message.raw.trace, pluginName, message.raw.message, message.raw.meta);
180
174
  }
@@ -193,4 +187,3 @@ class Plugin extends base_1.BSBObservable {
193
187
  }
194
188
  }
195
189
  }
196
- exports.Plugin = Plugin;
@@ -2,110 +2,6 @@
2
2
  "pluginName": "observable-pino",
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
- "level": {
10
- "default": "info",
11
- "type": "string",
12
- "enum": [
13
- "fatal",
14
- "error",
15
- "warn",
16
- "info",
17
- "debug",
18
- "trace"
19
- ]
20
- },
21
- "prettyPrint": {
22
- "type": "object",
23
- "properties": {
24
- "enabled": {
25
- "default": false,
26
- "type": "boolean"
27
- },
28
- "colorize": {
29
- "default": true,
30
- "type": "boolean"
31
- },
32
- "translateTime": {
33
- "default": "SYS:standard",
34
- "type": "string"
35
- },
36
- "ignore": {
37
- "default": "pid,hostname",
38
- "type": "string"
39
- }
40
- },
41
- "required": [
42
- "enabled",
43
- "colorize",
44
- "translateTime",
45
- "ignore"
46
- ],
47
- "additionalProperties": false
48
- },
49
- "transport": {
50
- "type": "object",
51
- "properties": {
52
- "enabled": {
53
- "default": false,
54
- "type": "boolean"
55
- },
56
- "target": {
57
- "type": "string"
58
- },
59
- "options": {
60
- "type": "object",
61
- "propertyNames": {
62
- "type": "string"
63
- },
64
- "additionalProperties": {}
65
- }
66
- },
67
- "required": [
68
- "enabled"
69
- ],
70
- "additionalProperties": false
71
- },
72
- "serializers": {
73
- "type": "object",
74
- "properties": {
75
- "error": {
76
- "default": true,
77
- "type": "boolean"
78
- }
79
- },
80
- "required": [
81
- "error"
82
- ],
83
- "additionalProperties": false
84
- },
85
- "base": {
86
- "type": "object",
87
- "propertyNames": {
88
- "type": "string"
89
- },
90
- "additionalProperties": {}
91
- },
92
- "redact": {
93
- "default": [],
94
- "type": "array",
95
- "items": {
96
- "type": "string"
97
- }
98
- }
99
- },
100
- "required": [
101
- "level",
102
- "prettyPrint",
103
- "transport",
104
- "serializers",
105
- "redact"
106
- ],
107
- "additionalProperties": false
108
- },
109
5
  "pluginType": "observable",
110
6
  "capabilities": {
111
7
  "logging": {
@@ -14,109 +14,5 @@
14
14
  "./docs/plugin.md"
15
15
  ],
16
16
  "dependencies": [],
17
- "image": "./observable-pino.png",
18
- "configSchema": {
19
- "$schema": "https://json-schema.org/draft/2020-12/schema",
20
- "type": "object",
21
- "properties": {
22
- "level": {
23
- "default": "info",
24
- "type": "string",
25
- "enum": [
26
- "fatal",
27
- "error",
28
- "warn",
29
- "info",
30
- "debug",
31
- "trace"
32
- ]
33
- },
34
- "prettyPrint": {
35
- "type": "object",
36
- "properties": {
37
- "enabled": {
38
- "default": false,
39
- "type": "boolean"
40
- },
41
- "colorize": {
42
- "default": true,
43
- "type": "boolean"
44
- },
45
- "translateTime": {
46
- "default": "SYS:standard",
47
- "type": "string"
48
- },
49
- "ignore": {
50
- "default": "pid,hostname",
51
- "type": "string"
52
- }
53
- },
54
- "required": [
55
- "enabled",
56
- "colorize",
57
- "translateTime",
58
- "ignore"
59
- ],
60
- "additionalProperties": false
61
- },
62
- "transport": {
63
- "type": "object",
64
- "properties": {
65
- "enabled": {
66
- "default": false,
67
- "type": "boolean"
68
- },
69
- "target": {
70
- "type": "string"
71
- },
72
- "options": {
73
- "type": "object",
74
- "propertyNames": {
75
- "type": "string"
76
- },
77
- "additionalProperties": {}
78
- }
79
- },
80
- "required": [
81
- "enabled"
82
- ],
83
- "additionalProperties": false
84
- },
85
- "serializers": {
86
- "type": "object",
87
- "properties": {
88
- "error": {
89
- "default": true,
90
- "type": "boolean"
91
- }
92
- },
93
- "required": [
94
- "error"
95
- ],
96
- "additionalProperties": false
97
- },
98
- "base": {
99
- "type": "object",
100
- "propertyNames": {
101
- "type": "string"
102
- },
103
- "additionalProperties": {}
104
- },
105
- "redact": {
106
- "default": [],
107
- "type": "array",
108
- "items": {
109
- "type": "string"
110
- }
111
- }
112
- },
113
- "required": [
114
- "level",
115
- "prettyPrint",
116
- "transport",
117
- "serializers",
118
- "redact"
119
- ],
120
- "additionalProperties": false
121
- }
17
+ "image": "./observable-pino.png"
122
18
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@bsb/observable-pino",
3
- "version": "9.0.1",
3
+ "version": "9.1.2",
4
+ "type": "module",
4
5
  "license": "(AGPL-3.0-only OR Commercial)",
5
6
  "author": {
6
7
  "name": "BetterCorp (PTY) Ltd",
@@ -40,12 +41,12 @@
40
41
  "@bsb/base": "^9.0.0"
41
42
  },
42
43
  "dependencies": {
44
+ "@anyvali/js": "^0.2.0",
43
45
  "pino": "^9.6.0",
44
- "pino-pretty": "^13.0.0",
45
- "zod": "^4.3.6"
46
+ "pino-pretty": "^13.0.0"
46
47
  },
47
48
  "devDependencies": {
48
- "@bsb/base": "file:../../../nodejs",
49
+ "@bsb/base": "^9.0.0",
49
50
  "@types/node": "^25.0.0",
50
51
  "mocha": "^11.0.0",
51
52
  "typescript": "^5.9.0"
@@ -56,7 +57,3 @@
56
57
  },
57
58
  "homepage": "https://io.bsbcode.dev/packages/nodejs/@bsb/observable-pino"
58
59
  }
59
-
60
-
61
-
62
-