@bsb/base 9.0.1 → 9.0.3

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 (56) hide show
  1. package/README.md +5 -8
  2. package/lib/schemas/config-default.plugin.json +1 -1
  3. package/lib/schemas/events-default.plugin.json +1 -1
  4. package/lib/schemas/observable-default.plugin.json +1 -1
  5. package/lib/serviceBase/plugins.js +10 -20
  6. package/lib/serviceBase/plugins.js.map +1 -1
  7. package/lib/tests/mocks.d.ts +37 -0
  8. package/lib/tests/mocks.js +164 -0
  9. package/lib/tests/mocks.js.map +1 -0
  10. package/lib/tests/sb/plugins/events/broadcast.d.ts +30 -0
  11. package/lib/tests/sb/plugins/events/broadcast.js +357 -0
  12. package/lib/tests/sb/plugins/events/broadcast.js.map +1 -0
  13. package/lib/tests/sb/plugins/events/emit.d.ts +30 -0
  14. package/lib/tests/sb/plugins/events/emit.js +353 -0
  15. package/lib/tests/sb/plugins/events/emit.js.map +1 -0
  16. package/lib/tests/sb/plugins/events/emitAndReturn.d.ts +30 -0
  17. package/lib/tests/sb/plugins/events/emitAndReturn.js +382 -0
  18. package/lib/tests/sb/plugins/events/emitAndReturn.js.map +1 -0
  19. package/lib/{plugins/service-default1/client.d.ts → tests/sb/plugins/events/emitStreamAndReceiveStream.d.ts} +4 -16
  20. package/lib/tests/sb/plugins/events/emitStreamAndReceiveStream.js +298 -0
  21. package/lib/tests/sb/plugins/events/emitStreamAndReceiveStream.js.map +1 -0
  22. package/lib/tests/sb/plugins/events/index.d.ts +28 -0
  23. package/lib/tests/sb/plugins/events/index.js +69 -0
  24. package/lib/tests/sb/plugins/events/index.js.map +1 -0
  25. package/lib/tests/trace.d.ts +41 -0
  26. package/lib/tests/trace.js +85 -0
  27. package/lib/tests/trace.js.map +1 -0
  28. package/lib/tests.d.ts +27 -0
  29. package/lib/{plugins/service-default4/index.js → tests.js} +16 -35
  30. package/lib/tests.js.map +1 -0
  31. package/package.json +92 -91
  32. package/lib/plugins/service-benchmarkify/index.d.ts +0 -312
  33. package/lib/plugins/service-benchmarkify/index.js +0 -138
  34. package/lib/plugins/service-benchmarkify/index.js.map +0 -1
  35. package/lib/plugins/service-default0/index.d.ts +0 -287
  36. package/lib/plugins/service-default0/index.js +0 -118
  37. package/lib/plugins/service-default0/index.js.map +0 -1
  38. package/lib/plugins/service-default1/client.js +0 -70
  39. package/lib/plugins/service-default1/client.js.map +0 -1
  40. package/lib/plugins/service-default1/index.d.ts +0 -304
  41. package/lib/plugins/service-default1/index.js +0 -179
  42. package/lib/plugins/service-default1/index.js.map +0 -1
  43. package/lib/plugins/service-default2/index.d.ts +0 -359
  44. package/lib/plugins/service-default2/index.js +0 -137
  45. package/lib/plugins/service-default2/index.js.map +0 -1
  46. package/lib/plugins/service-default3/index.d.ts +0 -119
  47. package/lib/plugins/service-default3/index.js +0 -88
  48. package/lib/plugins/service-default3/index.js.map +0 -1
  49. package/lib/plugins/service-default4/index.d.ts +0 -81
  50. package/lib/plugins/service-default4/index.js.map +0 -1
  51. package/lib/schemas/service-benchmarkify.json +0 -229
  52. package/lib/schemas/service-default0.json +0 -216
  53. package/lib/schemas/service-default1.json +0 -242
  54. package/lib/schemas/service-default2.json +0 -268
  55. package/lib/schemas/service-default3.json +0 -65
  56. package/lib/schemas/service-default4.json +0 -33
@@ -1,359 +0,0 @@
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 { Observable } from "../../index";
28
- import { BSBService, BSBServiceConstructor } from "../../base";
29
- import { z } from "zod";
30
- export declare const Config: import("../../index").BSBPluginConfigClass<z.ZodNull>;
31
- export declare const EventSchemas: {
32
- readonly emitEvents: {
33
- readonly 'task.completed': {
34
- input: {
35
- _bsb: "object";
36
- properties: {
37
- readonly taskId: import("../../index").BSBStringType;
38
- readonly duration: import("../../index").BSBNumberType;
39
- readonly success: import("../../index").BSBBooleanType;
40
- };
41
- required: string[];
42
- description?: string;
43
- optional?: boolean;
44
- nullable?: boolean;
45
- };
46
- description?: string;
47
- readonly __brand: "fire-and-forget";
48
- };
49
- };
50
- readonly onEvents: {
51
- readonly 'task.assigned': {
52
- input: {
53
- _bsb: "object";
54
- properties: {
55
- readonly taskId: import("../../index").BSBStringType;
56
- readonly type: import("../../index").BSBStringType;
57
- readonly priority: import("../../index").BSBEnumType;
58
- };
59
- required: string[];
60
- description?: string;
61
- optional?: boolean;
62
- nullable?: boolean;
63
- };
64
- description?: string;
65
- readonly __brand: "fire-and-forget";
66
- };
67
- };
68
- readonly emitReturnableEvents: {
69
- readonly 'resource.request': {
70
- input: {
71
- _bsb: "object";
72
- properties: {
73
- readonly resourceType: import("../../index").BSBStringType;
74
- readonly amount: import("../../index").BSBNumberType;
75
- readonly timeout: import("../../index").BSBNumberType & {
76
- optional: true;
77
- };
78
- };
79
- required: string[];
80
- description?: string;
81
- optional?: boolean;
82
- nullable?: boolean;
83
- };
84
- output: {
85
- _bsb: "object";
86
- properties: {
87
- readonly allocated: import("../../index").BSBBooleanType;
88
- readonly resourceId: import("../../index").BSBStringType & {
89
- optional: true;
90
- };
91
- readonly waitTime: import("../../index").BSBNumberType & {
92
- optional: true;
93
- };
94
- };
95
- required: string[];
96
- description?: string;
97
- optional?: boolean;
98
- nullable?: boolean;
99
- };
100
- description?: string;
101
- defaultTimeout?: number;
102
- readonly __brand: "returnable";
103
- };
104
- };
105
- readonly onReturnableEvents: {
106
- readonly calculate: {
107
- input: {
108
- _bsb: "object";
109
- properties: {
110
- readonly a: import("../../index").BSBNumberType;
111
- readonly b: import("../../index").BSBNumberType;
112
- };
113
- required: string[];
114
- description?: string;
115
- optional?: boolean;
116
- nullable?: boolean;
117
- };
118
- output: import("../../index").BSBNumberType;
119
- description?: string;
120
- defaultTimeout?: number;
121
- readonly __brand: "returnable";
122
- };
123
- readonly 'health.check': {
124
- input: {
125
- _bsb: "object";
126
- properties: {
127
- readonly includeDetails: import("../../index").BSBBooleanType;
128
- };
129
- required: string[];
130
- description?: string;
131
- optional?: boolean;
132
- nullable?: boolean;
133
- };
134
- output: {
135
- _bsb: "object";
136
- properties: {
137
- readonly status: import("../../index").BSBEnumType;
138
- readonly uptime: import("../../index").BSBNumberType;
139
- readonly details: import("../../index").BSBType & {
140
- optional: true;
141
- };
142
- };
143
- required: string[];
144
- description?: string;
145
- optional?: boolean;
146
- nullable?: boolean;
147
- };
148
- description?: string;
149
- defaultTimeout?: number;
150
- readonly __brand: "returnable";
151
- };
152
- };
153
- readonly emitBroadcast: {
154
- readonly 'metrics.report': {
155
- input: {
156
- _bsb: "object";
157
- properties: {
158
- readonly timestamp: import("../../index").BSBStringType;
159
- readonly metrics: import("../../index").BSBType;
160
- readonly period: import("../../index").BSBStringType;
161
- };
162
- required: string[];
163
- description?: string;
164
- optional?: boolean;
165
- nullable?: boolean;
166
- };
167
- description?: string;
168
- readonly __brand: "broadcast";
169
- };
170
- };
171
- readonly onBroadcast: {
172
- readonly 'emergency.stop': {
173
- input: {
174
- _bsb: "object";
175
- properties: {
176
- readonly reason: import("../../index").BSBStringType;
177
- readonly immediate: import("../../index").BSBBooleanType;
178
- };
179
- required: string[];
180
- description?: string;
181
- optional?: boolean;
182
- nullable?: boolean;
183
- };
184
- description?: string;
185
- readonly __brand: "broadcast";
186
- };
187
- };
188
- };
189
- export declare class Plugin extends BSBService<InstanceType<typeof Config>, typeof EventSchemas> {
190
- static Config: import("../../index").BSBPluginConfigClass<z.ZodNull>;
191
- static EventSchemas: {
192
- readonly emitEvents: {
193
- readonly 'task.completed': {
194
- input: {
195
- _bsb: "object";
196
- properties: {
197
- readonly taskId: import("../../index").BSBStringType;
198
- readonly duration: import("../../index").BSBNumberType;
199
- readonly success: import("../../index").BSBBooleanType;
200
- };
201
- required: string[];
202
- description?: string;
203
- optional?: boolean;
204
- nullable?: boolean;
205
- };
206
- description?: string;
207
- readonly __brand: "fire-and-forget";
208
- };
209
- };
210
- readonly onEvents: {
211
- readonly 'task.assigned': {
212
- input: {
213
- _bsb: "object";
214
- properties: {
215
- readonly taskId: import("../../index").BSBStringType;
216
- readonly type: import("../../index").BSBStringType;
217
- readonly priority: import("../../index").BSBEnumType;
218
- };
219
- required: string[];
220
- description?: string;
221
- optional?: boolean;
222
- nullable?: boolean;
223
- };
224
- description?: string;
225
- readonly __brand: "fire-and-forget";
226
- };
227
- };
228
- readonly emitReturnableEvents: {
229
- readonly 'resource.request': {
230
- input: {
231
- _bsb: "object";
232
- properties: {
233
- readonly resourceType: import("../../index").BSBStringType;
234
- readonly amount: import("../../index").BSBNumberType;
235
- readonly timeout: import("../../index").BSBNumberType & {
236
- optional: true;
237
- };
238
- };
239
- required: string[];
240
- description?: string;
241
- optional?: boolean;
242
- nullable?: boolean;
243
- };
244
- output: {
245
- _bsb: "object";
246
- properties: {
247
- readonly allocated: import("../../index").BSBBooleanType;
248
- readonly resourceId: import("../../index").BSBStringType & {
249
- optional: true;
250
- };
251
- readonly waitTime: import("../../index").BSBNumberType & {
252
- optional: true;
253
- };
254
- };
255
- required: string[];
256
- description?: string;
257
- optional?: boolean;
258
- nullable?: boolean;
259
- };
260
- description?: string;
261
- defaultTimeout?: number;
262
- readonly __brand: "returnable";
263
- };
264
- };
265
- readonly onReturnableEvents: {
266
- readonly calculate: {
267
- input: {
268
- _bsb: "object";
269
- properties: {
270
- readonly a: import("../../index").BSBNumberType;
271
- readonly b: import("../../index").BSBNumberType;
272
- };
273
- required: string[];
274
- description?: string;
275
- optional?: boolean;
276
- nullable?: boolean;
277
- };
278
- output: import("../../index").BSBNumberType;
279
- description?: string;
280
- defaultTimeout?: number;
281
- readonly __brand: "returnable";
282
- };
283
- readonly 'health.check': {
284
- input: {
285
- _bsb: "object";
286
- properties: {
287
- readonly includeDetails: import("../../index").BSBBooleanType;
288
- };
289
- required: string[];
290
- description?: string;
291
- optional?: boolean;
292
- nullable?: boolean;
293
- };
294
- output: {
295
- _bsb: "object";
296
- properties: {
297
- readonly status: import("../../index").BSBEnumType;
298
- readonly uptime: import("../../index").BSBNumberType;
299
- readonly details: import("../../index").BSBType & {
300
- optional: true;
301
- };
302
- };
303
- required: string[];
304
- description?: string;
305
- optional?: boolean;
306
- nullable?: boolean;
307
- };
308
- description?: string;
309
- defaultTimeout?: number;
310
- readonly __brand: "returnable";
311
- };
312
- };
313
- readonly emitBroadcast: {
314
- readonly 'metrics.report': {
315
- input: {
316
- _bsb: "object";
317
- properties: {
318
- readonly timestamp: import("../../index").BSBStringType;
319
- readonly metrics: import("../../index").BSBType;
320
- readonly period: import("../../index").BSBStringType;
321
- };
322
- required: string[];
323
- description?: string;
324
- optional?: boolean;
325
- nullable?: boolean;
326
- };
327
- description?: string;
328
- readonly __brand: "broadcast";
329
- };
330
- };
331
- readonly onBroadcast: {
332
- readonly 'emergency.stop': {
333
- input: {
334
- _bsb: "object";
335
- properties: {
336
- readonly reason: import("../../index").BSBStringType;
337
- readonly immediate: import("../../index").BSBBooleanType;
338
- };
339
- required: string[];
340
- description?: string;
341
- optional?: boolean;
342
- nullable?: boolean;
343
- };
344
- description?: string;
345
- readonly __brand: "broadcast";
346
- };
347
- };
348
- };
349
- initBeforePlugins?: string[] | undefined;
350
- runBeforePlugins?: string[] | undefined;
351
- runAfterPlugins?: string[] | undefined;
352
- initAfterPlugins: string[];
353
- dispose?(): void;
354
- private service1;
355
- private service3;
356
- constructor(config: BSBServiceConstructor<InstanceType<typeof Config>, typeof EventSchemas>);
357
- init(obs: Observable): Promise<void>;
358
- run(obs: Observable): Promise<void>;
359
- }
@@ -1,137 +0,0 @@
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.Plugin = exports.EventSchemas = exports.Config = void 0;
30
- const index_1 = require("../../index");
31
- const base_1 = require("../../base");
32
- const service_default1_1 = require("../service-default1");
33
- const service_default3_1 = require("../service-default3");
34
- const schema_events_1 = require("../../interfaces/schema-events");
35
- const zod_1 = require("zod");
36
- exports.Config = (0, base_1.createConfigSchema)({
37
- name: 'service-default2',
38
- description: 'Default service plugin 2 for testing inter-service communication',
39
- version: '1.0.0',
40
- image: '../docs/public/assets/images/bsb-logo.png',
41
- tags: ['default', 'example', 'test'],
42
- }, zod_1.z.null());
43
- exports.EventSchemas = (0, schema_events_1.createEventSchemas)({
44
- // Events this service emits (fire-and-forget, first listener receives)
45
- emitEvents: {
46
- 'task.completed': (0, schema_events_1.createFireAndForgetEvent)(base_1.bsb.object({
47
- taskId: base_1.bsb.string({ description: 'Task identifier' }),
48
- duration: base_1.bsb.number({ description: 'Task duration in milliseconds' }),
49
- success: base_1.bsb.boolean('Whether the task completed successfully')
50
- }, 'Task completion parameters'), 'Emitted when a task is completed')
51
- },
52
- // Events this service listens to (fire-and-forget)
53
- onEvents: {
54
- 'task.assigned': (0, schema_events_1.createFireAndForgetEvent)(base_1.bsb.object({
55
- taskId: base_1.bsb.string({ description: 'Task identifier' }),
56
- type: base_1.bsb.string({ description: 'Task type' }),
57
- priority: base_1.bsb.enum(['low', 'medium', 'high', 'urgent'], 'Task priority level')
58
- }, 'Task assignment parameters'), 'Handle new task assignments')
59
- },
60
- // Returnable events this service emits (requests from this service)
61
- emitReturnableEvents: {
62
- 'resource.request': (0, schema_events_1.createReturnableEvent)(base_1.bsb.object({
63
- resourceType: base_1.bsb.string({ description: 'Type of resource requested' }),
64
- amount: base_1.bsb.number({ description: 'Amount of resources needed' }),
65
- timeout: (0, base_1.optional)(base_1.bsb.number({ description: 'Request timeout in milliseconds' }))
66
- }, 'Resource request parameters'), base_1.bsb.object({
67
- allocated: base_1.bsb.boolean('Whether resources were allocated'),
68
- resourceId: (0, base_1.optional)(base_1.bsb.string({ description: 'Allocated resource identifier' })),
69
- waitTime: (0, base_1.optional)(base_1.bsb.number({ description: 'Wait time in milliseconds' }))
70
- }, 'Resource allocation response'), 'Request resource allocation')
71
- },
72
- // Returnable events this service listens to (requests to this service)
73
- onReturnableEvents: {
74
- calculate: (0, schema_events_1.createReturnableEvent)(base_1.bsb.object({
75
- a: base_1.bsb.number({ description: 'First number' }),
76
- b: base_1.bsb.number({ description: 'Second number' })
77
- }, 'Calculate input parameters'), base_1.bsb.number({ description: 'Calculation result' }), 'Calculate with two numbers'),
78
- 'health.check': (0, schema_events_1.createReturnableEvent)(base_1.bsb.object({
79
- includeDetails: base_1.bsb.boolean('Whether to include detailed information')
80
- }, 'Health check parameters'), base_1.bsb.object({
81
- status: base_1.bsb.enum(['healthy', 'degraded', 'unhealthy'], 'Service health status'),
82
- uptime: base_1.bsb.number({ description: 'Service uptime in milliseconds' }),
83
- details: (0, base_1.optional)(base_1.bsb.record(base_1.bsb.string({ description: 'Detail key' }), base_1.bsb.unknown('Detail value'), 'Health check details'))
84
- }, 'Health check response'), 'Perform health check')
85
- },
86
- // Broadcast events this service emits (all listeners receive)
87
- emitBroadcast: {
88
- 'metrics.report': (0, schema_events_1.createBroadcastEvent)(base_1.bsb.object({
89
- timestamp: base_1.bsb.datetime('Metrics timestamp'),
90
- metrics: base_1.bsb.record(base_1.bsb.string({ description: 'Metric name' }), base_1.bsb.number({ description: 'Metric value' }), 'Performance metrics'),
91
- period: base_1.bsb.string({ description: 'Reporting period' })
92
- }, 'Metrics report parameters'), 'Broadcast performance metrics')
93
- },
94
- // Broadcast events this service listens to
95
- onBroadcast: {
96
- 'emergency.stop': (0, schema_events_1.createBroadcastEvent)(base_1.bsb.object({
97
- reason: base_1.bsb.string({ description: 'Emergency stop reason' }),
98
- immediate: base_1.bsb.boolean('Whether to stop immediately without cleanup')
99
- }, 'Emergency stop parameters'), 'Listen for emergency stop broadcasts')
100
- }
101
- });
102
- class Plugin extends base_1.BSBService {
103
- static Config = exports.Config;
104
- static EventSchemas = exports.EventSchemas;
105
- // PLUGIN_CLIENT auto-generated from Config.metadata
106
- initBeforePlugins;
107
- runBeforePlugins;
108
- runAfterPlugins;
109
- initAfterPlugins = [];
110
- service1;
111
- service3;
112
- constructor(config) {
113
- super(config);
114
- this.service1 = new index_1.ServiceClient(service_default1_1.Plugin, this);
115
- this.service3 = new index_1.ServiceClient(service_default3_1.Plugin, this);
116
- }
117
- async init(obs) {
118
- this.events.onReturnableEvent("calculate", obs, async (obs, input) => {
119
- obs.log.info("Calculating {a} * {b}", { a: input.a, b: input.b });
120
- return input.a * input.b;
121
- });
122
- }
123
- async run(obs) {
124
- obs.log.info("Running service-default2");
125
- const result = await this.service1.events.emitEventAndReturn("calculate", obs, {
126
- a: 5,
127
- b: 5
128
- }, 5);
129
- await this.service3.events.onReturnableEvent("calculate", obs, async (obs, input) => {
130
- obs.log.info("Calculating {a} * {b}", { a: input.a, b: input.b });
131
- return input.a * input.b;
132
- });
133
- obs.log.info("Calculation result: {result}", { result });
134
- }
135
- }
136
- exports.Plugin = Plugin;
137
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/service-default2/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,uCAAwD;AACxD,qCAAkG;AAClG,0DAA+F;AAC/F,0DAA+F;AAC/F,kEAA2I;AAC3I,6BAAwB;AAEX,QAAA,MAAM,GAAG,IAAA,yBAAkB,EACtC;IACE,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kEAAkE;IAC/E,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,2CAA2C;IAClD,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC;CACrC,EACD,OAAC,CAAC,IAAI,EAAE,CACT,CAAC;AAEW,QAAA,YAAY,GAAG,IAAA,kCAAkB,EAAC;IAC7C,uEAAuE;IACvE,UAAU,EAAE;QACV,gBAAgB,EAAE,IAAA,wCAAwB,EACxC,UAAG,CAAC,MAAM,CAAC;YACT,MAAM,EAAE,UAAG,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;YACtD,QAAQ,EAAE,UAAG,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;YACtE,OAAO,EAAE,UAAG,CAAC,OAAO,CAAC,yCAAyC,CAAC;SAChE,EAAE,4BAA4B,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,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YAClE,OAAO,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAe;QAC9B,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,kBAAkB,CAAC,WAAW,EAAE,GAAG,EAAE;YAC7E,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;SACL,EAAE,CAAC,CAAC,CAAC;QACN,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,GAAe,EAAE,KAAK,EAAE,EAAE;YAC9F,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YAClE,OAAO,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3D,CAAC;;AAvCH,wBAwCC"}
@@ -1,119 +0,0 @@
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 { z } from "zod";
28
- import { BSBService, BSBServiceConstructor } from "../../base";
29
- import { Observable } from "../../interfaces";
30
- export declare const Config: import("../../base").BSBPluginConfigClass<z.ZodObject<{}, z.core.$strip>>;
31
- export declare const EventSchemas: {
32
- readonly onReturnableEvents: {
33
- readonly onReverseReturnable: {
34
- input: {
35
- _bsb: "object";
36
- properties: {
37
- readonly text: import("../../interfaces").BSBStringType;
38
- };
39
- required: string[];
40
- description?: string;
41
- optional?: boolean;
42
- nullable?: boolean;
43
- };
44
- output: import("../../interfaces").BSBStringType;
45
- description?: string;
46
- defaultTimeout?: number;
47
- readonly __brand: "returnable";
48
- };
49
- };
50
- readonly emitReturnableEvents: {
51
- readonly calculate: {
52
- input: {
53
- _bsb: "object";
54
- properties: {
55
- readonly a: import("../../interfaces").BSBNumberType;
56
- readonly b: import("../../interfaces").BSBNumberType;
57
- };
58
- required: string[];
59
- description?: string;
60
- optional?: boolean;
61
- nullable?: boolean;
62
- };
63
- output: import("../../interfaces").BSBNumberType;
64
- description?: string;
65
- defaultTimeout?: number;
66
- readonly __brand: "returnable";
67
- };
68
- };
69
- };
70
- export declare class Plugin extends BSBService<InstanceType<typeof Config>, typeof EventSchemas> {
71
- static Config: import("../../base").BSBPluginConfigClass<z.ZodObject<{}, z.core.$strip>>;
72
- static EventSchemas: {
73
- readonly onReturnableEvents: {
74
- readonly onReverseReturnable: {
75
- input: {
76
- _bsb: "object";
77
- properties: {
78
- readonly text: import("../../interfaces").BSBStringType;
79
- };
80
- required: string[];
81
- description?: string;
82
- optional?: boolean;
83
- nullable?: boolean;
84
- };
85
- output: import("../../interfaces").BSBStringType;
86
- description?: string;
87
- defaultTimeout?: number;
88
- readonly __brand: "returnable";
89
- };
90
- };
91
- readonly emitReturnableEvents: {
92
- readonly calculate: {
93
- input: {
94
- _bsb: "object";
95
- properties: {
96
- readonly a: import("../../interfaces").BSBNumberType;
97
- readonly b: import("../../interfaces").BSBNumberType;
98
- };
99
- required: string[];
100
- description?: string;
101
- optional?: boolean;
102
- nullable?: boolean;
103
- };
104
- output: import("../../interfaces").BSBNumberType;
105
- description?: string;
106
- defaultTimeout?: number;
107
- readonly __brand: "returnable";
108
- };
109
- };
110
- };
111
- initBeforePlugins?: string[] | undefined;
112
- runBeforePlugins?: string[] | undefined;
113
- runAfterPlugins?: string[] | undefined;
114
- initAfterPlugins: string[];
115
- dispose?(): void;
116
- constructor(config: BSBServiceConstructor<InstanceType<typeof Config>, typeof EventSchemas>);
117
- init(obs: Observable): Promise<void>;
118
- run(obs: Observable): Promise<void>;
119
- }