@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,378 @@
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 { BSBType, InferBSBType } from './schema-types';
28
+ /**
29
+ * Schema definition for a returnable event with input/output validation.
30
+ * Type-branded to ensure returnable events are only used in appropriate categories.
31
+ * Uses BSBType for cross-language support instead of Zod schemas.
32
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
33
+ */
34
+ export interface ReturnableEventSchema {
35
+ /** Schema for event input parameters (as a single object) */
36
+ input: BSBType;
37
+ /** Schema for event output/return value */
38
+ output: BSBType;
39
+ /** Optional description of what this event does */
40
+ description?: string;
41
+ /** Default timeout in seconds for returnable event calls */
42
+ defaultTimeout?: number;
43
+ /** Type brand for compile-time category validation */
44
+ readonly __brand: 'returnable';
45
+ }
46
+ /**
47
+ * Schema definition for fire-and-forget events.
48
+ * Type-branded to ensure fire-and-forget events are only used in appropriate categories.
49
+ * Uses BSBType for cross-language support instead of Zod schemas.
50
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
51
+ */
52
+ export interface FireAndForgetEventSchema {
53
+ /** Schema for event input parameters (as a single object) */
54
+ input: BSBType;
55
+ /** Optional description of what this event does */
56
+ description?: string;
57
+ /** Type brand for compile-time category validation */
58
+ readonly __brand: 'fire-and-forget';
59
+ }
60
+ /**
61
+ * Schema definition for broadcast events.
62
+ * Type-branded to ensure broadcast events are only used in appropriate categories.
63
+ * Broadcast events are like fire-and-forget but delivered to ALL listeners.
64
+ * Uses BSBType for cross-language support instead of Zod schemas.
65
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
66
+ */
67
+ export interface BroadcastEventSchema {
68
+ /** Schema for event input parameters (as a single object) */
69
+ input: BSBType;
70
+ /** Optional description of what this event does */
71
+ description?: string;
72
+ /** Type brand for compile-time category validation */
73
+ readonly __brand: 'broadcast';
74
+ }
75
+ /**
76
+ * Map of event names to their schemas for returnable events.
77
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
78
+ */
79
+ export type ReturnableEventSchemas = Record<string, ReturnableEventSchema>;
80
+ /**
81
+ * Map of event names to their schemas for fire-and-forget events.
82
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
83
+ */
84
+ export type FireAndForgetEventSchemas = Record<string, FireAndForgetEventSchema>;
85
+ /**
86
+ * Map of event names to their schemas for broadcast events.
87
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
88
+ */
89
+ export type BroadcastEventSchemas = Record<string, BroadcastEventSchema>;
90
+ /**
91
+ * Complete event schema definition for a plugin with full type safety.
92
+ * In v9+, use createEventSchemas() instead of 'as const' for type safety.
93
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
94
+ */
95
+ export interface BSBEventSchemas {
96
+ /** Events this plugin emits (fire-and-forget) */
97
+ emitEvents?: FireAndForgetEventSchemas;
98
+ /** Events this plugin listens to (fire-and-forget) */
99
+ onEvents?: FireAndForgetEventSchemas;
100
+ /** Returnable events this plugin emits */
101
+ emitReturnableEvents?: ReturnableEventSchemas;
102
+ /** Returnable events this plugin listens to */
103
+ onReturnableEvents?: ReturnableEventSchemas;
104
+ /** Broadcast events this plugin emits */
105
+ emitBroadcast?: BroadcastEventSchemas;
106
+ /** Broadcast events this plugin listens to */
107
+ onBroadcast?: BroadcastEventSchemas;
108
+ }
109
+ /**
110
+ * Extract the input type from an event schema by inferring from BSB type.
111
+ * Uses direct property access to avoid excessive recursion.
112
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
113
+ */
114
+ export type EventInputType<T> = T extends {
115
+ input: infer Schema extends BSBType;
116
+ } ? InferBSBType<Schema> : never;
117
+ /**
118
+ * Extract the output type from an event schema by inferring from BSB type.
119
+ * Uses direct property access to avoid excessive recursion.
120
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema-events | API: interfaces/schema-events}
121
+ */
122
+ export type EventOutputType<T> = T extends {
123
+ output: infer Schema extends BSBType;
124
+ } ? InferBSBType<Schema> : never;
125
+ /**
126
+ * Extract event names from a schema definition with full type safety.
127
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
128
+ */
129
+ export type EventNames<T extends Record<string, AnyEventSchema>> = keyof T;
130
+ /**
131
+ * Extract input type for a specific event name from a schema map.
132
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
133
+ */
134
+ export type EventInputForName<T extends Record<string, AnyEventSchema>, K extends keyof T> = EventInputType<T[K]>;
135
+ /**
136
+ * Extract output type for a specific event name from a schema map.
137
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
138
+ */
139
+ export type EventOutputForName<T extends Record<string, ReturnableEventSchema>, K extends keyof T> = EventOutputType<T[K]>;
140
+ /**
141
+ * Helper function to create a fire-and-forget event schema.
142
+ * Type-branded to ensure compile-time category validation.
143
+ * v9: Uses BSBType for cross-language support. Type inference via InferBSBType.
144
+ * @param input - BSB type schema for input validation
145
+ * @param description - Optional description
146
+ * @returns Event schema object with type brand
147
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/functions/createFireAndForgetEvent.html | API: createFireAndForgetEvent}
148
+ */
149
+ export declare function createFireAndForgetEvent<TInput extends BSBType>(input: TInput, description?: string): {
150
+ input: TInput;
151
+ description?: string;
152
+ readonly __brand: 'fire-and-forget';
153
+ };
154
+ /**
155
+ * Helper function to create a returnable event schema.
156
+ * Type-branded to ensure compile-time category validation.
157
+ * v9: Uses BSBType for cross-language support. Type inference via InferBSBType.
158
+ * @param input - BSB type schema for input validation
159
+ * @param output - BSB type schema for output validation
160
+ * @param description - Optional description
161
+ * @returns Event schema object with type brand
162
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/functions/createReturnableEvent.html | API: createReturnableEvent}
163
+ */
164
+ export declare function createReturnableEvent<TInput extends BSBType, TOutput extends BSBType>(input: TInput, output: TOutput, description?: string, defaultTimeout?: number): {
165
+ input: TInput;
166
+ output: TOutput;
167
+ description?: string;
168
+ defaultTimeout?: number;
169
+ readonly __brand: 'returnable';
170
+ };
171
+ /**
172
+ * Helper function to create a broadcast event schema.
173
+ * Broadcast events are fire-and-forget but delivered to ALL listeners, not just the first one.
174
+ * Type-branded to ensure compile-time category validation.
175
+ * v9: Uses BSBType for cross-language support. Type inference via InferBSBType.
176
+ * @param input - BSB type schema for input validation
177
+ * @param description - Optional description
178
+ * @returns Event schema object with type brand
179
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/functions/createBroadcastEvent.html | API: createBroadcastEvent}
180
+ */
181
+ export declare function createBroadcastEvent<TInput extends BSBType>(input: TInput, description?: string): {
182
+ input: TInput;
183
+ description?: string;
184
+ readonly __brand: 'broadcast';
185
+ };
186
+ /**
187
+ * Type-level validation helper for event schemas.
188
+ * Ensures that each category only contains the correct branded event types.
189
+ * @internal
190
+ */
191
+ /**
192
+ * Helper function to create a complete event schema with all 6 event types and preserve type safety.
193
+ *
194
+ * v9 Breaking Change: This function now uses const type parameters to eliminate the need for 'as const'.
195
+ * It also validates that event types match their categories at compile time using type branding.
196
+ *
197
+ * Features:
198
+ * - No 'as const' required - type inference is automatic via const type parameter
199
+ * - Compile-time validation that fire-and-forget events are in fire-and-forget categories
200
+ * - Compile-time validation that returnable events are in returnable categories
201
+ * - Compile-time validation that broadcast events are in broadcast categories
202
+ * - Runtime duplicate name detection across categories (warns for developer clarity)
203
+ *
204
+ * @param schemas - Event schema definitions with type validation
205
+ * @returns Complete event schema with preserved literal types
206
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/functions/createEventSchemas.html | API: createEventSchemas}
207
+ *
208
+ * @example
209
+ * ```typescript
210
+ * // v9: No 'as const' needed!
211
+ * export const EventSchemas = createEventSchemas({
212
+ * emitEvents: {
213
+ * 'todo.created': createFireAndForgetEvent(TodoItemSchema, 'Emitted when todo is created'),
214
+ * },
215
+ * emitReturnableEvents: {
216
+ * 'todo.create': createReturnableEvent(CreateInputSchema, TodoItemSchema, 'Create a todo'),
217
+ * },
218
+ * });
219
+ *
220
+ * // Compile error if wrong event type used:
221
+ * // emitEvents: {
222
+ * // 'todo.create': createReturnableEvent(...) // ❌ Type error!
223
+ * // }
224
+ * ```
225
+ */
226
+ export declare function createEventSchemas<const T extends BSBEventSchemas>(schemas: T): T;
227
+ /**
228
+ * Union type for all possible event schemas.
229
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/modules.html#module-interfaces_schema_events | API: interfaces/schema-events}
230
+ */
231
+ export type AnyEventSchema = FireAndForgetEventSchema | ReturnableEventSchema | BroadcastEventSchema;
232
+ /**
233
+ * Type helper to extract all event names from a complete event schema.
234
+ * Useful for ensuring type safety when referencing event names.
235
+ */
236
+ export type AllEventNames<T extends BSBEventSchemas> = (T['emitEvents'] extends Record<string, any> ? keyof T['emitEvents'] : never) | (T['onEvents'] extends Record<string, any> ? keyof T['onEvents'] : never) | (T['emitReturnableEvents'] extends Record<string, any> ? keyof T['emitReturnableEvents'] : never) | (T['onReturnableEvents'] extends Record<string, any> ? keyof T['onReturnableEvents'] : never) | (T['emitBroadcast'] extends Record<string, any> ? keyof T['emitBroadcast'] : never) | (T['onBroadcast'] extends Record<string, any> ? keyof T['onBroadcast'] : never);
237
+ /**
238
+ * Type helper to extract emit event names only.
239
+ */
240
+ export type EmitEventNames<T extends BSBEventSchemas> = T['emitEvents'] extends Record<string, any> ? keyof T['emitEvents'] : never;
241
+ /**
242
+ * Type helper to extract on event names only.
243
+ */
244
+ export type OnEventNames<T extends BSBEventSchemas> = T['onEvents'] extends Record<string, any> ? keyof T['onEvents'] : never;
245
+ /**
246
+ * Type helper to extract emit returnable event names only.
247
+ */
248
+ export type EmitReturnableEventNames<T extends BSBEventSchemas> = T['emitReturnableEvents'] extends Record<string, any> ? keyof T['emitReturnableEvents'] : never;
249
+ /**
250
+ * Type helper to extract on returnable event names only.
251
+ */
252
+ export type OnReturnableEventNames<T extends BSBEventSchemas> = T['onReturnableEvents'] extends Record<string, any> ? keyof T['onReturnableEvents'] : never;
253
+ /**
254
+ * Type helper to extract emit broadcast event names only.
255
+ */
256
+ export type EmitBroadcastEventNames<T extends BSBEventSchemas> = T['emitBroadcast'] extends Record<string, any> ? keyof T['emitBroadcast'] : never;
257
+ /**
258
+ * Type helper to extract on broadcast event names only.
259
+ */
260
+ export type OnBroadcastEventNames<T extends BSBEventSchemas> = T['onBroadcast'] extends Record<string, any> ? keyof T['onBroadcast'] : never;
261
+ /**
262
+ * ServiceClient event schema with swapped RX/TX directions.
263
+ * When using ServiceClient, the directions are inverted:
264
+ * - ServiceClient.onEvent() listens to what the target service EMITs
265
+ * - ServiceClient.emitEvent() sends to what the target service LISTENS FOR
266
+ */
267
+ export interface ServiceClientEventSchemas<T extends BSBEventSchemas> {
268
+ /** Listen to events the target service emits (fire-and-forget) */
269
+ onEvents?: T['emitEvents'];
270
+ /** Emit events to what the target service listens for (fire-and-forget) */
271
+ emitEvents?: T['onEvents'];
272
+ /** Listen to returnable events the target service emits (requests from target) */
273
+ onReturnableEvents?: T['emitReturnableEvents'];
274
+ /** Emit returnable events to what the target service handles (requests to target) */
275
+ emitReturnableEvents?: T['onReturnableEvents'];
276
+ /** Listen to broadcast events the target service emits */
277
+ onBroadcast?: T['emitBroadcast'];
278
+ /** Emit broadcast events to what the target service listens for */
279
+ emitBroadcast?: T['onBroadcast'];
280
+ }
281
+ /**
282
+ * Event category type for exported schemas.
283
+ */
284
+ export type EventCategory = 'emitEvents' | 'onEvents' | 'emitReturnableEvents' | 'onReturnableEvents' | 'emitBroadcast' | 'onBroadcast';
285
+ /**
286
+ * JSON Schema type definition for cross-language code generation.
287
+ * Uses standard JSON Schema format with BSB-specific extensions.
288
+ */
289
+ export interface JSONSchemaType {
290
+ $schema?: string;
291
+ type?: string | string[];
292
+ format?: string;
293
+ properties?: Record<string, JSONSchemaType>;
294
+ items?: JSONSchemaType;
295
+ required?: string[];
296
+ enum?: any[];
297
+ description?: string;
298
+ minLength?: number;
299
+ maxLength?: number;
300
+ minimum?: number;
301
+ maximum?: number;
302
+ 'x-bsb-type'?: string;
303
+ [key: string]: any;
304
+ }
305
+ /**
306
+ * Exported event definition in JSON format.
307
+ * Contains all information needed for cross-language client generation.
308
+ */
309
+ export interface EventExportDefinition {
310
+ /** Event type (fire-and-forget, returnable, broadcast) */
311
+ type: 'fire-and-forget' | 'returnable' | 'broadcast';
312
+ /** Event category (emitEvents, onReturnableEvents, etc.) */
313
+ category: EventCategory;
314
+ /** Human-readable description */
315
+ description?: string;
316
+ /** Default timeout in seconds for returnable event calls */
317
+ defaultTimeout?: number;
318
+ /** JSON Schema for input validation */
319
+ inputSchema: JSONSchemaType;
320
+ /** JSON Schema for output validation (null for fire-and-forget/broadcast) */
321
+ outputSchema: JSONSchemaType | null;
322
+ }
323
+ /**
324
+ * Complete exported schema for a plugin.
325
+ * This is the format consumed by cross-language code generators.
326
+ */
327
+ export interface EventSchemaExport {
328
+ /** Plugin identifier */
329
+ pluginName: string;
330
+ /** Plugin version */
331
+ version: string;
332
+ /** Map of event names to their definitions */
333
+ events: Record<string, EventExportDefinition>;
334
+ /** Auto-detected plugin dependencies (from .bsb/clients/ imports) */
335
+ dependencies?: Array<{
336
+ id: string;
337
+ version: string;
338
+ }>;
339
+ /** Config schema as JSON Schema (from Zod validation schema) */
340
+ configSchema?: Record<string, any>;
341
+ }
342
+ /**
343
+ * Export event schemas to JSON format for cross-language client generation.
344
+ *
345
+ * v9: This function converts BSB EventSchemas to a standardized JSON format
346
+ * that can be consumed by code generators in other languages (C#, Go, Java, etc.)
347
+ * similar to how TRPC exports schemas for TypeScript.
348
+ *
349
+ * The exported JSON includes:
350
+ * - Event names and categories
351
+ * - Input/output schemas in JSON Schema format
352
+ * - Type metadata for cross-language type mapping (int32, uuid, datetime, etc.)
353
+ * - Descriptions for documentation
354
+ *
355
+ * Client generators use this JSON to produce type-safe, idiomatic code
356
+ * in their target language.
357
+ *
358
+ * @param pluginName - Plugin identifier (e.g., "service-demo-todo")
359
+ * @param version - Plugin version (e.g., "1.0.0")
360
+ * @param schemas - Event schemas created with createEventSchemas()
361
+ * @returns JSON-serializable export object
362
+ *
363
+ * @example
364
+ * ```typescript
365
+ * export class Plugin extends BSBService<typeof Config, typeof EventSchemas> {
366
+ * static exportSchemas(): EventSchemaExport {
367
+ * return exportEventSchemas(
368
+ * Config.metadata.name,
369
+ * Config.metadata.version || '1.0.0',
370
+ * EventSchemas
371
+ * );
372
+ * }
373
+ * }
374
+ * ```
375
+ *
376
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/functions/exportEventSchemas.html | API: exportEventSchemas}
377
+ */
378
+ export declare function exportEventSchemas(pluginName: string, version: string, schemas: BSBEventSchemas): EventSchemaExport;
@@ -0,0 +1,247 @@
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.createFireAndForgetEvent = createFireAndForgetEvent;
30
+ exports.createReturnableEvent = createReturnableEvent;
31
+ exports.createBroadcastEvent = createBroadcastEvent;
32
+ exports.createEventSchemas = createEventSchemas;
33
+ exports.exportEventSchemas = exportEventSchemas;
34
+ /**
35
+ * Helper function to create a fire-and-forget event schema.
36
+ * Type-branded to ensure compile-time category validation.
37
+ * v9: Uses BSBType for cross-language support. Type inference via InferBSBType.
38
+ * @param input - BSB type schema for input validation
39
+ * @param description - Optional description
40
+ * @returns Event schema object with type brand
41
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/functions/createFireAndForgetEvent.html | API: createFireAndForgetEvent}
42
+ */
43
+ function createFireAndForgetEvent(input, description) {
44
+ return { input, description, __brand: 'fire-and-forget' };
45
+ }
46
+ /**
47
+ * Helper function to create a returnable event schema.
48
+ * Type-branded to ensure compile-time category validation.
49
+ * v9: Uses BSBType for cross-language support. Type inference via InferBSBType.
50
+ * @param input - BSB type schema for input validation
51
+ * @param output - BSB type schema for output validation
52
+ * @param description - Optional description
53
+ * @returns Event schema object with type brand
54
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/functions/createReturnableEvent.html | API: createReturnableEvent}
55
+ */
56
+ function createReturnableEvent(input, output, description, defaultTimeout) {
57
+ return { input, output, description, defaultTimeout, __brand: 'returnable' };
58
+ }
59
+ /**
60
+ * Helper function to create a broadcast event schema.
61
+ * Broadcast events are fire-and-forget but delivered to ALL listeners, not just the first one.
62
+ * Type-branded to ensure compile-time category validation.
63
+ * v9: Uses BSBType for cross-language support. Type inference via InferBSBType.
64
+ * @param input - BSB type schema for input validation
65
+ * @param description - Optional description
66
+ * @returns Event schema object with type brand
67
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/functions/createBroadcastEvent.html | API: createBroadcastEvent}
68
+ */
69
+ function createBroadcastEvent(input, description) {
70
+ return { input, description, __brand: 'broadcast' };
71
+ }
72
+ /**
73
+ * Type-level validation helper for event schemas.
74
+ * Ensures that each category only contains the correct branded event types.
75
+ * @internal
76
+ */
77
+ // type _ValidateEventSchemas<T> = {
78
+ // [K in keyof T]: K extends 'emitEvents' | 'onEvents'
79
+ // ? { [EventName: string]: FireAndForgetEventSchema }
80
+ // : K extends 'emitReturnableEvents' | 'onReturnableEvents'
81
+ // ? { [EventName: string]: ReturnableEventSchema }
82
+ // : K extends 'emitBroadcast' | 'onBroadcast'
83
+ // ? { [EventName: string]: BroadcastEventSchema }
84
+ // : T[K];
85
+ // };
86
+ //
87
+ /**
88
+ * Helper function to create a complete event schema with all 6 event types and preserve type safety.
89
+ *
90
+ * v9 Breaking Change: This function now uses const type parameters to eliminate the need for 'as const'.
91
+ * It also validates that event types match their categories at compile time using type branding.
92
+ *
93
+ * Features:
94
+ * - No 'as const' required - type inference is automatic via const type parameter
95
+ * - Compile-time validation that fire-and-forget events are in fire-and-forget categories
96
+ * - Compile-time validation that returnable events are in returnable categories
97
+ * - Compile-time validation that broadcast events are in broadcast categories
98
+ * - Runtime duplicate name detection across categories (warns for developer clarity)
99
+ *
100
+ * @param schemas - Event schema definitions with type validation
101
+ * @returns Complete event schema with preserved literal types
102
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/functions/createEventSchemas.html | API: createEventSchemas}
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * // v9: No 'as const' needed!
107
+ * export const EventSchemas = createEventSchemas({
108
+ * emitEvents: {
109
+ * 'todo.created': createFireAndForgetEvent(TodoItemSchema, 'Emitted when todo is created'),
110
+ * },
111
+ * emitReturnableEvents: {
112
+ * 'todo.create': createReturnableEvent(CreateInputSchema, TodoItemSchema, 'Create a todo'),
113
+ * },
114
+ * });
115
+ *
116
+ * // Compile error if wrong event type used:
117
+ * // emitEvents: {
118
+ * // 'todo.create': createReturnableEvent(...) // ❌ Type error!
119
+ * // }
120
+ * ```
121
+ */
122
+ function createEventSchemas(schemas) {
123
+ // Runtime duplicate name detection for developer clarity
124
+ // Note: Duplicate names across categories are not technically invalid, but can be confusing
125
+ if (process.env.NODE_ENV !== 'production') {
126
+ const allNames = new Set();
127
+ const duplicates = [];
128
+ const categories = [
129
+ 'emitEvents',
130
+ 'onEvents',
131
+ 'emitReturnableEvents',
132
+ 'onReturnableEvents',
133
+ 'emitBroadcast',
134
+ 'onBroadcast',
135
+ ];
136
+ for (const category of categories) {
137
+ const categorySchemas = schemas[category];
138
+ if (categorySchemas) {
139
+ for (const name of Object.keys(categorySchemas)) {
140
+ if (allNames.has(name)) {
141
+ duplicates.push(name);
142
+ }
143
+ allNames.add(name);
144
+ }
145
+ }
146
+ }
147
+ // Warn about duplicates to help developer clarity
148
+ if (duplicates.length > 0) {
149
+ const uniqueDuplicates = Array.from(new Set(duplicates));
150
+ // Note: Using console.warn here as this runs at module load time before logger is available
151
+ // In production, this check is skipped for performance
152
+ // eslint-disable-next-line no-console
153
+ console.warn(`[BSB Warning] Duplicate event names detected: ${uniqueDuplicates.join(', ')}\n` +
154
+ `While not technically invalid, duplicate names across categories can confuse developers.\n` +
155
+ `Consider using unique names for better clarity.`);
156
+ }
157
+ }
158
+ return schemas;
159
+ }
160
+ /**
161
+ * Export event schemas to JSON format for cross-language client generation.
162
+ *
163
+ * v9: This function converts BSB EventSchemas to a standardized JSON format
164
+ * that can be consumed by code generators in other languages (C#, Go, Java, etc.)
165
+ * similar to how TRPC exports schemas for TypeScript.
166
+ *
167
+ * The exported JSON includes:
168
+ * - Event names and categories
169
+ * - Input/output schemas in JSON Schema format
170
+ * - Type metadata for cross-language type mapping (int32, uuid, datetime, etc.)
171
+ * - Descriptions for documentation
172
+ *
173
+ * Client generators use this JSON to produce type-safe, idiomatic code
174
+ * in their target language.
175
+ *
176
+ * @param pluginName - Plugin identifier (e.g., "service-demo-todo")
177
+ * @param version - Plugin version (e.g., "1.0.0")
178
+ * @param schemas - Event schemas created with createEventSchemas()
179
+ * @returns JSON-serializable export object
180
+ *
181
+ * @example
182
+ * ```typescript
183
+ * export class Plugin extends BSBService<typeof Config, typeof EventSchemas> {
184
+ * static exportSchemas(): EventSchemaExport {
185
+ * return exportEventSchemas(
186
+ * Config.metadata.name,
187
+ * Config.metadata.version || '1.0.0',
188
+ * EventSchemas
189
+ * );
190
+ * }
191
+ * }
192
+ * ```
193
+ *
194
+ * @see {@link https://bsbcode.dev/languages/nodejs/types/functions/exportEventSchemas.html | API: exportEventSchemas}
195
+ */
196
+ function exportEventSchemas(pluginName, version, schemas) {
197
+ const events = {};
198
+ // Helper to process a category of events
199
+ const processCategory = (category, categorySchemas) => {
200
+ if (!categorySchemas)
201
+ return;
202
+ for (const [eventName, eventDef] of Object.entries(categorySchemas)) {
203
+ // Determine event type from brand
204
+ let type;
205
+ if (eventDef.__brand === 'returnable') {
206
+ type = 'returnable';
207
+ }
208
+ else if (eventDef.__brand === 'broadcast') {
209
+ type = 'broadcast';
210
+ }
211
+ else {
212
+ type = 'fire-and-forget';
213
+ }
214
+ // Convert BSBType input schema to JSON Schema
215
+ const { bsbToJsonSchema } = require('./schema-types');
216
+ const inputSchema = bsbToJsonSchema(eventDef.input);
217
+ // Convert output schema (if returnable)
218
+ let outputSchema = null;
219
+ if (type === 'returnable' && 'output' in eventDef) {
220
+ outputSchema = bsbToJsonSchema(eventDef.output);
221
+ }
222
+ events[eventName] = {
223
+ type,
224
+ category,
225
+ description: eventDef.description,
226
+ ...(type === 'returnable' && 'defaultTimeout' in eventDef && eventDef.defaultTimeout !== undefined
227
+ ? { defaultTimeout: eventDef.defaultTimeout }
228
+ : {}),
229
+ inputSchema,
230
+ outputSchema,
231
+ };
232
+ }
233
+ };
234
+ // Process all categories
235
+ processCategory('emitEvents', schemas.emitEvents);
236
+ processCategory('onEvents', schemas.onEvents);
237
+ processCategory('emitReturnableEvents', schemas.emitReturnableEvents);
238
+ processCategory('onReturnableEvents', schemas.onReturnableEvents);
239
+ processCategory('emitBroadcast', schemas.emitBroadcast);
240
+ processCategory('onBroadcast', schemas.onBroadcast);
241
+ return {
242
+ pluginName,
243
+ version,
244
+ events,
245
+ };
246
+ }
247
+ //# sourceMappingURL=schema-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-events.js","sourceRoot":"","sources":["../../src/interfaces/schema-events.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;AA2IH,4DASC;AAYD,sDAaC;AAYD,oDASC;AAoDD,gDA6CC;AA0LD,gDA6DC;AAxZD;;;;;;;;GAQG;AACH,SAAgB,wBAAwB,CACtC,KAAa,EACb,WAAoB;IAMpB,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,iBAA0B,EAAE,CAAC;AACrE,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CACnC,KAAa,EACb,MAAe,EACf,WAAoB,EACpB,cAAuB;IAQvB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,YAAqB,EAAE,CAAC;AACxF,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAClC,KAAa,EACb,WAAoB;IAMpB,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,WAAoB,EAAE,CAAC;AAC/D,CAAC;AAED;;;;GAIG;AACH,oCAAoC;AACpC,wDAAwD;AACxD,0DAA0D;AAC1D,gEAAgE;AAChE,uDAAuD;AACvD,kDAAkD;AAClD,sDAAsD;AACtD,cAAc;AACd,KAAK;AACL,GAAG;AACH;;;;;;;;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