@bsb/base 9.0.0

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.
Files changed (182) hide show
  1. package/LICENSE +665 -0
  2. package/LICENSE.commercial +32 -0
  3. package/README.md +263 -0
  4. package/bsb-plugin.json +62 -0
  5. package/lib/base/BSBConfig.d.ts +130 -0
  6. package/lib/base/BSBConfig.js +95 -0
  7. package/lib/base/BSBConfig.js.map +1 -0
  8. package/lib/base/BSBEvents.d.ts +207 -0
  9. package/lib/base/BSBEvents.js +101 -0
  10. package/lib/base/BSBEvents.js.map +1 -0
  11. package/lib/base/BSBObservable.d.ts +178 -0
  12. package/lib/base/BSBObservable.js +91 -0
  13. package/lib/base/BSBObservable.js.map +1 -0
  14. package/lib/base/BSBService.d.ts +277 -0
  15. package/lib/base/BSBService.js +366 -0
  16. package/lib/base/BSBService.js.map +1 -0
  17. package/lib/base/BSBServiceClient.d.ts +135 -0
  18. package/lib/base/BSBServiceClient.js +130 -0
  19. package/lib/base/BSBServiceClient.js.map +1 -0
  20. package/lib/base/EventValidator.d.ts +137 -0
  21. package/lib/base/EventValidator.js +210 -0
  22. package/lib/base/EventValidator.js.map +1 -0
  23. package/lib/base/ObservableBackend.d.ts +281 -0
  24. package/lib/base/ObservableBackend.js +515 -0
  25. package/lib/base/ObservableBackend.js.map +1 -0
  26. package/lib/base/PluginConfig.d.ts +196 -0
  27. package/lib/base/PluginConfig.js +96 -0
  28. package/lib/base/PluginConfig.js.map +1 -0
  29. package/lib/base/PluginEvents.d.ts +140 -0
  30. package/lib/base/PluginEvents.js +268 -0
  31. package/lib/base/PluginEvents.js.map +1 -0
  32. package/lib/base/PluginObservable.d.ts +196 -0
  33. package/lib/base/PluginObservable.js +250 -0
  34. package/lib/base/PluginObservable.js.map +1 -0
  35. package/lib/base/ResourceContext.d.ts +70 -0
  36. package/lib/base/ResourceContext.js +54 -0
  37. package/lib/base/ResourceContext.js.map +1 -0
  38. package/lib/base/base.d.ts +264 -0
  39. package/lib/base/base.js +182 -0
  40. package/lib/base/base.js.map +1 -0
  41. package/lib/base/errorMessages.d.ts +56 -0
  42. package/lib/base/errorMessages.js +70 -0
  43. package/lib/base/errorMessages.js.map +1 -0
  44. package/lib/base/factory.d.ts +58 -0
  45. package/lib/base/factory.js +167 -0
  46. package/lib/base/factory.js.map +1 -0
  47. package/lib/base/functions.d.ts +117 -0
  48. package/lib/base/functions.js +152 -0
  49. package/lib/base/functions.js.map +1 -0
  50. package/lib/base/index.d.ts +44 -0
  51. package/lib/base/index.js +64 -0
  52. package/lib/base/index.js.map +1 -0
  53. package/lib/base/logFormatter.d.ts +50 -0
  54. package/lib/base/logFormatter.js +105 -0
  55. package/lib/base/logFormatter.js.map +1 -0
  56. package/lib/base/tools.d.ts +316 -0
  57. package/lib/base/tools.js +666 -0
  58. package/lib/base/tools.js.map +1 -0
  59. package/lib/cli.d.ts +28 -0
  60. package/lib/cli.js +254 -0
  61. package/lib/cli.js.map +1 -0
  62. package/lib/dev.d.ts +27 -0
  63. package/lib/dev.js +200 -0
  64. package/lib/dev.js.map +1 -0
  65. package/lib/index.d.ts +32 -0
  66. package/lib/index.js +49 -0
  67. package/lib/index.js.map +1 -0
  68. package/lib/interfaces/events.d.ts +67 -0
  69. package/lib/interfaces/events.js +44 -0
  70. package/lib/interfaces/events.js.map +1 -0
  71. package/lib/interfaces/index.d.ts +38 -0
  72. package/lib/interfaces/index.js +59 -0
  73. package/lib/interfaces/index.js.map +1 -0
  74. package/lib/interfaces/logging.d.ts +106 -0
  75. package/lib/interfaces/logging.js +39 -0
  76. package/lib/interfaces/logging.js.map +1 -0
  77. package/lib/interfaces/metrics.d.ts +365 -0
  78. package/lib/interfaces/metrics.js +46 -0
  79. package/lib/interfaces/metrics.js.map +1 -0
  80. package/lib/interfaces/observable-types.d.ts +63 -0
  81. package/lib/interfaces/observable-types.js +49 -0
  82. package/lib/interfaces/observable-types.js.map +1 -0
  83. package/lib/interfaces/observable.d.ts +297 -0
  84. package/lib/interfaces/observable.js +29 -0
  85. package/lib/interfaces/observable.js.map +1 -0
  86. package/lib/interfaces/options.d.ts +164 -0
  87. package/lib/interfaces/options.js +56 -0
  88. package/lib/interfaces/options.js.map +1 -0
  89. package/lib/interfaces/plugins.d.ts +143 -0
  90. package/lib/interfaces/plugins.js +45 -0
  91. package/lib/interfaces/plugins.js.map +1 -0
  92. package/lib/interfaces/result.d.ts +129 -0
  93. package/lib/interfaces/result.js +162 -0
  94. package/lib/interfaces/result.js.map +1 -0
  95. package/lib/interfaces/schema-events.d.ts +378 -0
  96. package/lib/interfaces/schema-events.js +247 -0
  97. package/lib/interfaces/schema-events.js.map +1 -0
  98. package/lib/interfaces/schema-types.d.ts +407 -0
  99. package/lib/interfaces/schema-types.js +581 -0
  100. package/lib/interfaces/schema-types.js.map +1 -0
  101. package/lib/interfaces/service.d.ts +48 -0
  102. package/lib/interfaces/service.js +29 -0
  103. package/lib/interfaces/service.js.map +1 -0
  104. package/lib/interfaces/tools.d.ts +65 -0
  105. package/lib/interfaces/tools.js +50 -0
  106. package/lib/interfaces/tools.js.map +1 -0
  107. package/lib/plugins/config-default/index.d.ts +59 -0
  108. package/lib/plugins/config-default/index.js +197 -0
  109. package/lib/plugins/config-default/index.js.map +1 -0
  110. package/lib/plugins/config-default/interfaces.d.ts +92 -0
  111. package/lib/plugins/config-default/interfaces.js +36 -0
  112. package/lib/plugins/config-default/interfaces.js.map +1 -0
  113. package/lib/plugins/events-default/events/broadcast.d.ts +36 -0
  114. package/lib/plugins/events-default/events/broadcast.js +85 -0
  115. package/lib/plugins/events-default/events/broadcast.js.map +1 -0
  116. package/lib/plugins/events-default/events/emit.d.ts +38 -0
  117. package/lib/plugins/events-default/events/emit.js +104 -0
  118. package/lib/plugins/events-default/events/emit.js.map +1 -0
  119. package/lib/plugins/events-default/events/emitAndReturn.d.ts +36 -0
  120. package/lib/plugins/events-default/events/emitAndReturn.js +100 -0
  121. package/lib/plugins/events-default/events/emitAndReturn.js.map +1 -0
  122. package/lib/plugins/events-default/events/emitStreamAndReceiveStream.d.ts +38 -0
  123. package/lib/plugins/events-default/events/emitStreamAndReceiveStream.js +134 -0
  124. package/lib/plugins/events-default/events/emitStreamAndReceiveStream.js.map +1 -0
  125. package/lib/plugins/events-default/events/index.d.ts +30 -0
  126. package/lib/plugins/events-default/events/index.js +38 -0
  127. package/lib/plugins/events-default/events/index.js.map +1 -0
  128. package/lib/plugins/events-default/index.d.ts +57 -0
  129. package/lib/plugins/events-default/index.js +86 -0
  130. package/lib/plugins/events-default/index.js.map +1 -0
  131. package/lib/plugins/observable-default/index.d.ts +43 -0
  132. package/lib/plugins/observable-default/index.js +151 -0
  133. package/lib/plugins/observable-default/index.js.map +1 -0
  134. package/lib/schemas/config-default.json +34 -0
  135. package/lib/schemas/config-default.plugin.json +36 -0
  136. package/lib/schemas/events-default.json +18 -0
  137. package/lib/schemas/events-default.plugin.json +17 -0
  138. package/lib/schemas/observable-default.json +33 -0
  139. package/lib/schemas/observable-default.plugin.json +24 -0
  140. package/lib/scripts/bsb-client-cli.d.ts +21 -0
  141. package/lib/scripts/bsb-client-cli.js +701 -0
  142. package/lib/scripts/bsb-client-cli.js.map +1 -0
  143. package/lib/scripts/bsb-plugin-cli.d.ts +15 -0
  144. package/lib/scripts/bsb-plugin-cli.js +547 -0
  145. package/lib/scripts/bsb-plugin-cli.js.map +1 -0
  146. package/lib/scripts/export-schemas.d.ts +17 -0
  147. package/lib/scripts/export-schemas.js +205 -0
  148. package/lib/scripts/export-schemas.js.map +1 -0
  149. package/lib/scripts/extract-schemas-from-source.d.ts +23 -0
  150. package/lib/scripts/extract-schemas-from-source.js +604 -0
  151. package/lib/scripts/extract-schemas-from-source.js.map +1 -0
  152. package/lib/scripts/generate-client-types.d.ts +22 -0
  153. package/lib/scripts/generate-client-types.js +537 -0
  154. package/lib/scripts/generate-client-types.js.map +1 -0
  155. package/lib/scripts/generate-plugin-json.d.ts +17 -0
  156. package/lib/scripts/generate-plugin-json.js +219 -0
  157. package/lib/scripts/generate-plugin-json.js.map +1 -0
  158. package/lib/serviceBase/config.d.ts +83 -0
  159. package/lib/serviceBase/config.js +236 -0
  160. package/lib/serviceBase/config.js.map +1 -0
  161. package/lib/serviceBase/events.d.ts +91 -0
  162. package/lib/serviceBase/events.js +519 -0
  163. package/lib/serviceBase/events.js.map +1 -0
  164. package/lib/serviceBase/index.d.ts +33 -0
  165. package/lib/serviceBase/index.js +50 -0
  166. package/lib/serviceBase/index.js.map +1 -0
  167. package/lib/serviceBase/observable.d.ts +249 -0
  168. package/lib/serviceBase/observable.js +551 -0
  169. package/lib/serviceBase/observable.js.map +1 -0
  170. package/lib/serviceBase/plugins.d.ts +48 -0
  171. package/lib/serviceBase/plugins.js +184 -0
  172. package/lib/serviceBase/plugins.js.map +1 -0
  173. package/lib/serviceBase/serviceBase.d.ts +228 -0
  174. package/lib/serviceBase/serviceBase.js +420 -0
  175. package/lib/serviceBase/serviceBase.js.map +1 -0
  176. package/lib/serviceBase/services.d.ts +63 -0
  177. package/lib/serviceBase/services.js +346 -0
  178. package/lib/serviceBase/services.js.map +1 -0
  179. package/lib/tests.d.ts +27 -0
  180. package/lib/tests.js +44 -0
  181. package/lib/tests.js.map +1 -0
  182. package/package.json +91 -0
@@ -0,0 +1,277 @@
1
+ /**
2
+ * BSB (Better-Service-Base) is an event-bus based microservice framework.
3
+ * Copyright (C) 2016 - 2025 BetterCorp (PTY) Ltd
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as published
7
+ * by the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * Alternatively, you may obtain a commercial license for this program.
11
+ * The commercial license allows you to use the Program in a closed-source manner,
12
+ * including the right to create derivative works that are not subject to the terms
13
+ * of the AGPL.
14
+ *
15
+ * To obtain a commercial license, please contact the copyright holders at
16
+ * https://www.bettercorp.dev. The terms and conditions of the commercial license
17
+ * will be provided upon request.
18
+ *
19
+ * This program is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ * GNU Affero General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU Affero General Public License
25
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
26
+ */
27
+ import { DTrace, Trace, BSBEventSchemas, Observable, EventSchemaExport, ServiceClientEventSchemas } from "../interfaces";
28
+ import { SBEvents, SBObservable } from "../serviceBase";
29
+ import { BaseWithObservableAndConfig, BaseWithObservableAndConfigConfig } from "./base";
30
+ import { BSBServiceClient } from "./BSBServiceClient";
31
+ import { BSBReferencePluginConfigDefinition, BSBReferencePluginConfigType } from "./PluginConfig";
32
+ import { PluginEvents } from "./PluginEvents";
33
+ import { z } from "zod";
34
+ /**
35
+ * @hidden
36
+ */
37
+ export interface BSBServiceConstructor<ReferencedConfig extends BSBReferencePluginConfigType = any, TEventSchemas extends BSBEventSchemas = BSBEventSchemas> extends BaseWithObservableAndConfigConfig<ReferencedConfig extends null ? null : BSBReferencePluginConfigDefinition<ReferencedConfig> & any> {
38
+ sbEvents: SBEvents;
39
+ sbObservable: SBObservable;
40
+ eventSchemas?: TEventSchemas;
41
+ }
42
+ /**
43
+ * @hidden
44
+ */
45
+ export interface BSBServiceClientDefinition {
46
+ name: string;
47
+ initBeforePlugins?: Array<string>;
48
+ initAfterPlugins?: Array<string>;
49
+ runBeforePlugins?: Array<string>;
50
+ runAfterPlugins?: Array<string>;
51
+ }
52
+ /**
53
+ * @group Services
54
+ * @category Plugins
55
+ */
56
+ /**
57
+ * Base class for implementing a service plugin.
58
+ *
59
+ * v9 Breaking Change: PLUGIN_CLIENT is now auto-generated from Config.metadata.
60
+ * You must provide a static Config property pointing to your Config class.
61
+ *
62
+ * Lifecycle:
63
+ * - constructor(config)
64
+ * - init(trace): async initialization and event registration
65
+ * - run(trace): start processing
66
+ * - dispose(): cleanup resources
67
+ *
68
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/classes/BSBService.html | API: BSBService}
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * export const Config = createConfigSchema(
73
+ * { name: 'service-demo', description: 'Demo Service' },
74
+ * ConfigSchema
75
+ * );
76
+ *
77
+ * export class Plugin extends BSBService<typeof Config, typeof EventSchemas> {
78
+ * static Config = Config; // Required for auto-generation
79
+ * // PLUGIN_CLIENT is auto-generated from Config.metadata
80
+ * }
81
+ * ```
82
+ */
83
+ export declare abstract class BSBService<ReferencedConfig extends BSBReferencePluginConfigType = any, TEventSchemas extends BSBEventSchemas = BSBEventSchemas> extends BaseWithObservableAndConfig<ReferencedConfig extends null ? null : BSBReferencePluginConfigDefinition<ReferencedConfig> & any> {
84
+ /**
85
+ * Static reference to the Config class created with createConfigSchema().
86
+ * Required for auto-generating PLUGIN_CLIENT from metadata.
87
+ *
88
+ * v9: This must be set on your plugin class for PLUGIN_CLIENT auto-generation to work.
89
+ */
90
+ static Config: any;
91
+ /**
92
+ * Static reference to EventSchemas created with createEventSchemas().
93
+ * Required for schema export functionality.
94
+ *
95
+ * v9: Set this on your plugin class to enable schema export.
96
+ */
97
+ static EventSchemas: BSBEventSchemas;
98
+ /**
99
+ * Auto-generated from Config.metadata.
100
+ * Do not set this manually - it will be ignored and replaced with auto-generated value.
101
+ *
102
+ * v9 Breaking Change: This is now a getter that derives from Config.metadata.
103
+ * If you have a manual PLUGIN_CLIENT property, remove it and set static Config instead.
104
+ */
105
+ static get PLUGIN_CLIENT(): BSBServiceClientDefinition;
106
+ /**
107
+ * Export event schemas to JSON format for cross-language client generation.
108
+ *
109
+ * v9: Call this static method to generate JSON schemas for your plugin's events.
110
+ * The generated JSON can be consumed by code generators in other languages
111
+ * to create type-safe clients.
112
+ *
113
+ * @returns EventSchemaExport object with plugin metadata and event definitions
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * // In your plugin class:
118
+ * export class Plugin extends BSBService<typeof Config, typeof EventSchemas> {
119
+ * static Config = Config;
120
+ * static EventSchemas = EventSchemas;
121
+ * }
122
+ *
123
+ * // Export schemas (typically in build script):
124
+ * const schemas = Plugin.exportSchemas();
125
+ * fs.writeFileSync('schemas.json', JSON.stringify(schemas, null, 2));
126
+ * ```
127
+ */
128
+ static exportSchemas(): EventSchemaExport;
129
+ abstract readonly initBeforePlugins?: Array<string>;
130
+ abstract readonly initAfterPlugins?: Array<string>;
131
+ abstract readonly runBeforePlugins?: Array<string>;
132
+ abstract readonly runAfterPlugins?: Array<string>;
133
+ /** Schema-first event API for this plugin with automatic validation */
134
+ readonly events: PluginEvents<TEventSchemas>;
135
+ /**
136
+ * @hidden
137
+ */
138
+ _clients: Array<BSBServiceClient<any>>;
139
+ /**
140
+ * @hidden
141
+ */
142
+ private _resourceContext;
143
+ constructor(config: BSBServiceConstructor<ReferencedConfig, TEventSchemas>);
144
+ /**
145
+ * Create an Observable from a DTrace with plugin's resource context
146
+ *
147
+ * This method wraps a DTrace object in an Observable that provides:
148
+ * - Automatic trace context for logging
149
+ * - Resource context (service name, version, region, etc.)
150
+ * - Immutable attribute propagation
151
+ * - Child span creation
152
+ *
153
+ * @param trace - DTrace object
154
+ * @param attributes - Optional initial attributes
155
+ * @param span - Optional Trace/Span object for lifecycle management (enables end() to work)
156
+ * @returns Observable wrapping the trace
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * // Create observable from DTrace
161
+ * const obs = this.createObservable(trace, { "user.id": "123" });
162
+ * obs.log.info("Processing request");
163
+ *
164
+ * // Create observable from Trace with span lifecycle
165
+ * const trace = this.__internalObservable.createTrace("http.request");
166
+ * const obs = this.createObservable(trace.trace, {}, trace);
167
+ * // ... do work ...
168
+ * obs.end(); // Properly ends the span
169
+ * ```
170
+ *
171
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/classes/BSBService.html#createObservable | API: BSBService.createObservable}
172
+ */
173
+ protected createObservable(trace: DTrace, attributes?: Record<string, string | number | boolean>, span?: Trace): Observable;
174
+ /**
175
+ * Create a new trace for distributed tracing
176
+ *
177
+ * Creates a new root trace with the given name and attributes. This is useful
178
+ * for creating new traces in contexts like HTTP handlers where you want to start
179
+ * a new trace for each request.
180
+ *
181
+ * @param name - Name for the trace (e.g., "http.request", "background.job")
182
+ * @param attributes - Optional initial attributes
183
+ * @returns Observable with a new trace and span that can be ended
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * // In an HTTP handler
188
+ * async handleRequest(request: Request) {
189
+ * const obs = this.createTrace("http.request", {
190
+ * "http.method": request.method,
191
+ * "http.url": request.url
192
+ * });
193
+ *
194
+ * try {
195
+ * await this.processRequest(obs, request);
196
+ * obs.end({ "http.status": 200 });
197
+ * } catch (error) {
198
+ * obs.error(error);
199
+ * obs.end({ "http.status": 500 });
200
+ * }
201
+ * }
202
+ * ```
203
+ *
204
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/classes/BSBService.html#createTrace | API: BSBService.createTrace}
205
+ */
206
+ createTrace(name: string, attributes?: Record<string, string | number | boolean>): Observable;
207
+ /**
208
+ * Create a self-client for calling this service's own events.
209
+ *
210
+ * Use this when you need to call your own event handlers from within the service
211
+ * (e.g., HTTP handler calling the service's event-based API). This makes self-invocation
212
+ * explicit in the code and avoids confusion about event flow.
213
+ *
214
+ * Call this method in the constructor and store the result if you need self-invocation.
215
+ * Only create it if needed to minimize startup overhead.
216
+ *
217
+ * The self-client uses the runtime mapped plugin name from the instantiated plugin,
218
+ * avoiding dependency on compile-time metadata or config. It's registered in the
219
+ * _clients array and handled normally by the BSB lifecycle.
220
+ *
221
+ * @returns Self-client with events property for calling own events
222
+ *
223
+ * @example
224
+ * ```typescript
225
+ * export class Plugin extends BSBService<typeof Config, typeof EventSchemas> {
226
+ * private self;
227
+ *
228
+ * constructor(config: BSBServiceConstructor<typeof Config, typeof EventSchemas>) {
229
+ * super({ ...config, eventSchemas: EventSchemas });
230
+ *
231
+ * // Create self-client for HTTP handler to call own events
232
+ * this.self = this.createSelf();
233
+ * }
234
+ *
235
+ * async handleHttpRequest(obs: Observable, body: any) {
236
+ * // Explicitly call own event handler
237
+ * const result = await this.self.events.emitEventAndReturn('todo.create', obs, body);
238
+ * return { status: 201, data: result };
239
+ * }
240
+ * }
241
+ * ```
242
+ */
243
+ protected createSelf(): BSBSelfServiceClient<this, TEventSchemas>;
244
+ }
245
+ /**
246
+ * @hidden
247
+ * Internal self-service client for calling a service's own events.
248
+ * Created by BSBService.createSelf() method.
249
+ */
250
+ declare class BSBSelfServiceClient<Service extends BSBService<any, TEventSchemas>, TEventSchemas extends BSBEventSchemas = any> extends BSBServiceClient<Service> {
251
+ readonly pluginName: string;
252
+ readonly initBeforePlugins?: Array<string>;
253
+ readonly initAfterPlugins?: Array<string>;
254
+ readonly runBeforePlugins?: Array<string>;
255
+ readonly runAfterPlugins?: Array<string>;
256
+ events: PluginEvents<ServiceClientEventSchemas<TEventSchemas>>;
257
+ constructor(context: Service);
258
+ dispose?(): void;
259
+ init?(obs: Observable): Promise<void>;
260
+ run?(obs: Observable): Promise<void>;
261
+ }
262
+ /**
263
+ * @hidden
264
+ * DO NOT REFERENCE/USE THIS CLASS - IT IS AN INTERNALLY REFERENCED CLASS
265
+ */
266
+ export declare class BSBServiceRef extends BSBService<any, BSBEventSchemas> {
267
+ static Config: import("./PluginConfig").BSBPluginConfigClass<z.ZodNull>;
268
+ initBeforePlugins?: string[] | undefined;
269
+ initAfterPlugins?: string[] | undefined;
270
+ runBeforePlugins?: string[] | undefined;
271
+ runAfterPlugins?: string[] | undefined;
272
+ dispose?(): void;
273
+ init?(obs: Observable): void | Promise<void>;
274
+ run?(obs: Observable): void | Promise<void>;
275
+ constructor(config: BSBServiceConstructor<null, BSBEventSchemas>);
276
+ }
277
+ export {};
@@ -0,0 +1,366 @@
1
+ "use strict";
2
+ /**
3
+ * BSB (Better-Service-Base) is an event-bus based microservice framework.
4
+ * Copyright (C) 2016 - 2025 BetterCorp (PTY) Ltd
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License as published
8
+ * by the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * Alternatively, you may obtain a commercial license for this program.
12
+ * The commercial license allows you to use the Program in a closed-source manner,
13
+ * including the right to create derivative works that are not subject to the terms
14
+ * of the AGPL.
15
+ *
16
+ * To obtain a commercial license, please contact the copyright holders at
17
+ * https://www.bettercorp.dev. The terms and conditions of the commercial license
18
+ * will be provided upon request.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU Affero General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU Affero General Public License
26
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
27
+ */
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.BSBServiceRef = exports.BSBService = void 0;
30
+ /* eslint-disable @typescript-eslint/no-unused-vars */
31
+ const interfaces_1 = require("../interfaces");
32
+ const base_1 = require("./base");
33
+ const BSBServiceClient_1 = require("./BSBServiceClient");
34
+ const PluginConfig_1 = require("./PluginConfig");
35
+ const PluginEvents_1 = require("./PluginEvents");
36
+ const ResourceContext_1 = require("./ResourceContext");
37
+ const PluginObservable_1 = require("./PluginObservable");
38
+ const zod_1 = require("zod");
39
+ /**
40
+ * @group Services
41
+ * @category Plugins
42
+ */
43
+ /**
44
+ * Base class for implementing a service plugin.
45
+ *
46
+ * v9 Breaking Change: PLUGIN_CLIENT is now auto-generated from Config.metadata.
47
+ * You must provide a static Config property pointing to your Config class.
48
+ *
49
+ * Lifecycle:
50
+ * - constructor(config)
51
+ * - init(trace): async initialization and event registration
52
+ * - run(trace): start processing
53
+ * - dispose(): cleanup resources
54
+ *
55
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/classes/BSBService.html | API: BSBService}
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * export const Config = createConfigSchema(
60
+ * { name: 'service-demo', description: 'Demo Service' },
61
+ * ConfigSchema
62
+ * );
63
+ *
64
+ * export class Plugin extends BSBService<typeof Config, typeof EventSchemas> {
65
+ * static Config = Config; // Required for auto-generation
66
+ * // PLUGIN_CLIENT is auto-generated from Config.metadata
67
+ * }
68
+ * ```
69
+ */
70
+ class BSBService extends base_1.BaseWithObservableAndConfig {
71
+ /**
72
+ * Static reference to the Config class created with createConfigSchema().
73
+ * Required for auto-generating PLUGIN_CLIENT from metadata.
74
+ *
75
+ * v9: This must be set on your plugin class for PLUGIN_CLIENT auto-generation to work.
76
+ */
77
+ static Config;
78
+ /**
79
+ * Static reference to EventSchemas created with createEventSchemas().
80
+ * Required for schema export functionality.
81
+ *
82
+ * v9: Set this on your plugin class to enable schema export.
83
+ */
84
+ static EventSchemas;
85
+ /**
86
+ * Auto-generated from Config.metadata.
87
+ * Do not set this manually - it will be ignored and replaced with auto-generated value.
88
+ *
89
+ * v9 Breaking Change: This is now a getter that derives from Config.metadata.
90
+ * If you have a manual PLUGIN_CLIENT property, remove it and set static Config instead.
91
+ */
92
+ static get PLUGIN_CLIENT() {
93
+ // Check if Config is set
94
+ if (!this.Config) {
95
+ throw new Error(`[BSB v9] PLUGIN_CLIENT auto-generation requires a static Config property.\n` +
96
+ `Add this to your plugin class:\n` +
97
+ ` static Config = Config;\n` +
98
+ `\n` +
99
+ `See migration guide: https://bsbcode.dev/migration/v9-breaking-changes`);
100
+ }
101
+ const ConfigClass = this.Config;
102
+ // Check if using old v8 Config class pattern (no metadata)
103
+ if (!ConfigClass.metadata) {
104
+ throw new Error(`[BSB v9] Config class must be created with createConfigSchema() helper.\n` +
105
+ `Old v8 pattern (extending BSBPluginConfig directly) is not supported.\n` +
106
+ `\n` +
107
+ `Migration:\n` +
108
+ ` // OLD v8:\n` +
109
+ ` export class Config extends BSBPluginConfig<typeof ConfigSchema> {\n` +
110
+ ` validationSchema = ConfigSchema;\n` +
111
+ ` }\n` +
112
+ `\n` +
113
+ ` // NEW v9:\n` +
114
+ ` export const Config = createConfigSchema(\n` +
115
+ ` { name: 'plugin-name', description: 'Description' },\n` +
116
+ ` ConfigSchema\n` +
117
+ ` );\n` +
118
+ `\n` +
119
+ `See migration guide: https://bsbcode.dev/migration/v9-breaking-changes`);
120
+ }
121
+ const meta = ConfigClass.metadata;
122
+ // Return auto-generated PLUGIN_CLIENT from metadata
123
+ return {
124
+ name: meta.name,
125
+ initBeforePlugins: meta.initBeforePlugins,
126
+ initAfterPlugins: meta.initAfterPlugins,
127
+ runBeforePlugins: meta.runBeforePlugins,
128
+ runAfterPlugins: meta.runAfterPlugins,
129
+ };
130
+ }
131
+ /**
132
+ * Export event schemas to JSON format for cross-language client generation.
133
+ *
134
+ * v9: Call this static method to generate JSON schemas for your plugin's events.
135
+ * The generated JSON can be consumed by code generators in other languages
136
+ * to create type-safe clients.
137
+ *
138
+ * @returns EventSchemaExport object with plugin metadata and event definitions
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * // In your plugin class:
143
+ * export class Plugin extends BSBService<typeof Config, typeof EventSchemas> {
144
+ * static Config = Config;
145
+ * static EventSchemas = EventSchemas;
146
+ * }
147
+ *
148
+ * // Export schemas (typically in build script):
149
+ * const schemas = Plugin.exportSchemas();
150
+ * fs.writeFileSync('schemas.json', JSON.stringify(schemas, null, 2));
151
+ * ```
152
+ */
153
+ static exportSchemas() {
154
+ // Check if Config is set
155
+ if (!this.Config) {
156
+ throw new Error(`[BSB v9] Schema export requires a static Config property.\n` +
157
+ `Add this to your plugin class:\n` +
158
+ ` static Config = Config;\n`);
159
+ }
160
+ // Check if EventSchemas is set
161
+ if (!this.EventSchemas) {
162
+ throw new Error(`[BSB v9] Schema export requires a static EventSchemas property.\n` +
163
+ `Add this to your plugin class:\n` +
164
+ ` static EventSchemas = EventSchemas;\n`);
165
+ }
166
+ const ConfigClass = this.Config;
167
+ const eventSchemas = this.EventSchemas;
168
+ if (!ConfigClass.metadata) {
169
+ throw new Error(`[BSB v9] Config class must be created with createConfigSchema() helper.`);
170
+ }
171
+ const meta = ConfigClass.metadata;
172
+ return (0, interfaces_1.exportEventSchemas)(meta.name, meta.version || '1.0.0', eventSchemas);
173
+ }
174
+ /** Schema-first event API for this plugin with automatic validation */
175
+ events;
176
+ /**
177
+ * @hidden
178
+ */
179
+ _clients = [];
180
+ /**
181
+ * @hidden
182
+ */
183
+ _resourceContext;
184
+ constructor(config) {
185
+ super(config);
186
+ // Observable backend initialized
187
+ this.events = new PluginEvents_1.PluginEvents(config.mode, config.sbEvents, this, config.eventSchemas || {}, this.__internalObservable);
188
+ // Build resource context at construction time
189
+ this._resourceContext = ResourceContext_1.ResourceContextBuilder.build({
190
+ appId: config.appId,
191
+ mode: config.mode,
192
+ pluginName: config.pluginName,
193
+ cwd: config.cwd,
194
+ packageCwd: config.packageCwd,
195
+ pluginCwd: config.pluginCwd,
196
+ pluginVersion: config.pluginVersion || 'unknown'
197
+ }, config.region);
198
+ }
199
+ /**
200
+ * Create an Observable from a DTrace with plugin's resource context
201
+ *
202
+ * This method wraps a DTrace object in an Observable that provides:
203
+ * - Automatic trace context for logging
204
+ * - Resource context (service name, version, region, etc.)
205
+ * - Immutable attribute propagation
206
+ * - Child span creation
207
+ *
208
+ * @param trace - DTrace object
209
+ * @param attributes - Optional initial attributes
210
+ * @param span - Optional Trace/Span object for lifecycle management (enables end() to work)
211
+ * @returns Observable wrapping the trace
212
+ *
213
+ * @example
214
+ * ```typescript
215
+ * // Create observable from DTrace
216
+ * const obs = this.createObservable(trace, { "user.id": "123" });
217
+ * obs.log.info("Processing request");
218
+ *
219
+ * // Create observable from Trace with span lifecycle
220
+ * const trace = this.__internalObservable.createTrace("http.request");
221
+ * const obs = this.createObservable(trace.trace, {}, trace);
222
+ * // ... do work ...
223
+ * obs.end(); // Properly ends the span
224
+ * ```
225
+ *
226
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/classes/BSBService.html#createObservable | API: BSBService.createObservable}
227
+ */
228
+ createObservable(trace, attributes, span) {
229
+ return new PluginObservable_1.PluginObservable(trace, this._resourceContext, this.__internalObservable, attributes, span);
230
+ }
231
+ /**
232
+ * Create a new trace for distributed tracing
233
+ *
234
+ * Creates a new root trace with the given name and attributes. This is useful
235
+ * for creating new traces in contexts like HTTP handlers where you want to start
236
+ * a new trace for each request.
237
+ *
238
+ * @param name - Name for the trace (e.g., "http.request", "background.job")
239
+ * @param attributes - Optional initial attributes
240
+ * @returns Observable with a new trace and span that can be ended
241
+ *
242
+ * @example
243
+ * ```typescript
244
+ * // In an HTTP handler
245
+ * async handleRequest(request: Request) {
246
+ * const obs = this.createTrace("http.request", {
247
+ * "http.method": request.method,
248
+ * "http.url": request.url
249
+ * });
250
+ *
251
+ * try {
252
+ * await this.processRequest(obs, request);
253
+ * obs.end({ "http.status": 200 });
254
+ * } catch (error) {
255
+ * obs.error(error);
256
+ * obs.end({ "http.status": 500 });
257
+ * }
258
+ * }
259
+ * ```
260
+ *
261
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/classes/BSBService.html#createTrace | API: BSBService.createTrace}
262
+ */
263
+ createTrace(name, attributes) {
264
+ const trace = this.__internalObservable.createTrace(name, attributes ?? {});
265
+ return this.createObservable(trace.trace, attributes ?? {}, trace);
266
+ }
267
+ /**
268
+ * Create a self-client for calling this service's own events.
269
+ *
270
+ * Use this when you need to call your own event handlers from within the service
271
+ * (e.g., HTTP handler calling the service's event-based API). This makes self-invocation
272
+ * explicit in the code and avoids confusion about event flow.
273
+ *
274
+ * Call this method in the constructor and store the result if you need self-invocation.
275
+ * Only create it if needed to minimize startup overhead.
276
+ *
277
+ * The self-client uses the runtime mapped plugin name from the instantiated plugin,
278
+ * avoiding dependency on compile-time metadata or config. It's registered in the
279
+ * _clients array and handled normally by the BSB lifecycle.
280
+ *
281
+ * @returns Self-client with events property for calling own events
282
+ *
283
+ * @example
284
+ * ```typescript
285
+ * export class Plugin extends BSBService<typeof Config, typeof EventSchemas> {
286
+ * private self;
287
+ *
288
+ * constructor(config: BSBServiceConstructor<typeof Config, typeof EventSchemas>) {
289
+ * super({ ...config, eventSchemas: EventSchemas });
290
+ *
291
+ * // Create self-client for HTTP handler to call own events
292
+ * this.self = this.createSelf();
293
+ * }
294
+ *
295
+ * async handleHttpRequest(obs: Observable, body: any) {
296
+ * // Explicitly call own event handler
297
+ * const result = await this.self.events.emitEventAndReturn('todo.create', obs, body);
298
+ * return { status: 201, data: result };
299
+ * }
300
+ * }
301
+ * ```
302
+ */
303
+ createSelf() {
304
+ const selfClient = new BSBSelfServiceClient(this);
305
+ this._clients.push(selfClient);
306
+ return selfClient;
307
+ }
308
+ }
309
+ exports.BSBService = BSBService;
310
+ /**
311
+ * @hidden
312
+ * Internal self-service client for calling a service's own events.
313
+ * Created by BSBService.createSelf() method.
314
+ */
315
+ class BSBSelfServiceClient extends BSBServiceClient_1.BSBServiceClient {
316
+ pluginName;
317
+ initBeforePlugins;
318
+ initAfterPlugins;
319
+ runBeforePlugins;
320
+ runAfterPlugins;
321
+ constructor(context) {
322
+ super(context);
323
+ // Use runtime mapped plugin name from the instantiated plugin
324
+ this.pluginName = context.pluginName;
325
+ // No dependencies for self-client (same as parent service)
326
+ this.initBeforePlugins = undefined;
327
+ this.initAfterPlugins = undefined;
328
+ this.runBeforePlugins = undefined;
329
+ this.runAfterPlugins = undefined;
330
+ // Share the same events instance as the parent service
331
+ this.events = context.events;
332
+ }
333
+ // Self-client has no lifecycle of its own - it just shares the parent service's events
334
+ dispose() {
335
+ // No-op: self-client shares parent's lifecycle
336
+ }
337
+ init(obs) {
338
+ // No-op: self-client shares parent's lifecycle
339
+ return Promise.resolve();
340
+ }
341
+ run(obs) {
342
+ // No-op: self-client shares parent's lifecycle
343
+ return Promise.resolve();
344
+ }
345
+ }
346
+ // Dummy Config for internal reference class
347
+ const BSBServiceRefConfig = (0, PluginConfig_1.createConfigSchema)({
348
+ name: "BSBServiceRef",
349
+ description: "Internal reference class",
350
+ }, zod_1.z.null());
351
+ /**
352
+ * @hidden
353
+ * DO NOT REFERENCE/USE THIS CLASS - IT IS AN INTERNALLY REFERENCED CLASS
354
+ */
355
+ class BSBServiceRef extends BSBService {
356
+ static Config = BSBServiceRefConfig;
357
+ initBeforePlugins;
358
+ initAfterPlugins;
359
+ runBeforePlugins;
360
+ runAfterPlugins;
361
+ constructor(config) {
362
+ super(config);
363
+ }
364
+ }
365
+ exports.BSBServiceRef = BSBServiceRef;
366
+ //# sourceMappingURL=BSBService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BSBService.js","sourceRoot":"","sources":["../../src/base/BSBService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,sDAAsD;AAEtD,8CAA6I;AAE7I,iCAAwF;AACxF,yDAAsD;AACtD,iDAAuI;AACvI,iDAA8C;AAC9C,uDAA4E;AAC5E,yDAAsD;AACtD,6BAAwB;AA8BxB;;;GAGG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAsB,UAIpB,SAAQ,kCAIP;IACD;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAM;IAEnB;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAkB;IAErC;;;;;;OAMG;IACI,MAAM,KAAK,aAAa;QAC7B,yBAAyB;QACzB,IAAI,CAAE,IAAY,CAAC,MAAM,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,6EAA6E;gBAC7E,kCAAkC;gBAClC,6BAA6B;gBAC7B,IAAI;gBACJ,wEAAwE,CACzE,CAAC;QACJ,CAAC;QAED,MAAM,WAAW,GAAI,IAAY,CAAC,MAAgC,CAAC;QAEnE,2DAA2D;QAC3D,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,2EAA2E;gBAC3E,yEAAyE;gBACzE,IAAI;gBACJ,cAAc;gBACd,gBAAgB;gBAChB,wEAAwE;gBACxE,wCAAwC;gBACxC,OAAO;gBACP,IAAI;gBACJ,gBAAgB;gBACh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