@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,88 +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 zod_1 = require("zod");
31
- const base_1 = require("../../base");
32
- const schema_events_1 = require("../../interfaces/schema-events");
33
- exports.Config = (0, base_1.createConfigSchema)({
34
- name: 'service-default3',
35
- description: 'Default service plugin 3 for testing',
36
- version: '1.0.0',
37
- image: '../docs/public/assets/images/bsb-logo.png',
38
- tags: ['default', 'example', 'test'],
39
- initAfterPlugins: ['service-default2'],
40
- }, zod_1.z.object({}));
41
- exports.EventSchemas = (0, schema_events_1.createEventSchemas)({
42
- onReturnableEvents: {
43
- onReverseReturnable: (0, schema_events_1.createReturnableEvent)(base_1.bsb.object({
44
- text: base_1.bsb.string({ description: 'Text to reverse' })
45
- }, 'Reverse input parameters'), base_1.bsb.string({ description: 'Reversed text' }), 'Reverse a string')
46
- },
47
- emitReturnableEvents: {
48
- calculate: (0, schema_events_1.createReturnableEvent)(base_1.bsb.object({
49
- a: base_1.bsb.number({ description: 'First number' }),
50
- b: base_1.bsb.number({ description: 'Second number' })
51
- }, 'Calculate input parameters'), base_1.bsb.number({ description: 'Calculation result' }), 'Calculate with two numbers')
52
- }
53
- });
54
- class Plugin extends base_1.BSBService {
55
- static Config = exports.Config;
56
- static EventSchemas = exports.EventSchemas;
57
- // PLUGIN_CLIENT auto-generated from Config.metadata
58
- initBeforePlugins;
59
- runBeforePlugins;
60
- runAfterPlugins;
61
- initAfterPlugins = ["service-default2"];
62
- constructor(config) {
63
- super(config);
64
- }
65
- async init(obs) {
66
- obs.log.info("Initializing service-default3");
67
- await this.events.onReturnableEvent("onReverseReturnable", obs, async (obs, input) => {
68
- obs.log.warn("onReverseReturnable ({text})", { text: input.text });
69
- return input.text.split("").reverse().join("");
70
- });
71
- }
72
- async run(obs) {
73
- obs.log.info("Running service-default3");
74
- // NEW API: Use events to calculate with object parameter
75
- const result = await this.events.emitEventAndReturn("calculate", obs, {
76
- a: 18,
77
- b: 19
78
- }, 5 // timeout
79
- );
80
- obs.log.info("Calculation result: {result}", { result });
81
- obs.log.debug("Debug {a}", { a: "IT IS AN DEBUG!" });
82
- obs.log.info("Info {a}", { a: "IT IS AN INFO!" });
83
- obs.log.warn("Warning {a}", { a: "IT IS AN WARNING!" });
84
- obs.log.error("Error {a}", { a: "IT IS AN ERROR!" });
85
- }
86
- }
87
- exports.Plugin = Plugin;
88
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/service-default3/index.ts"],"names":[],"mappings":"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"}
@@ -1,81 +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 emitReturnableEvents: {
33
- readonly onReverseReturnable: {
34
- input: {
35
- _bsb: "object";
36
- properties: {
37
- readonly text: import("../../index").BSBStringType;
38
- };
39
- required: string[];
40
- description?: string;
41
- optional?: boolean;
42
- nullable?: boolean;
43
- };
44
- output: import("../../index").BSBStringType;
45
- description?: string;
46
- defaultTimeout?: number;
47
- readonly __brand: "returnable";
48
- };
49
- };
50
- };
51
- export declare class Plugin extends BSBService<InstanceType<typeof Config>, typeof EventSchemas> {
52
- static Config: import("../../index").BSBPluginConfigClass<z.ZodNull>;
53
- static EventSchemas: {
54
- readonly emitReturnableEvents: {
55
- readonly onReverseReturnable: {
56
- input: {
57
- _bsb: "object";
58
- properties: {
59
- readonly text: import("../../index").BSBStringType;
60
- };
61
- required: string[];
62
- description?: string;
63
- optional?: boolean;
64
- nullable?: boolean;
65
- };
66
- output: import("../../index").BSBStringType;
67
- description?: string;
68
- defaultTimeout?: number;
69
- readonly __brand: "returnable";
70
- };
71
- };
72
- };
73
- initBeforePlugins?: string[] | undefined;
74
- runBeforePlugins?: string[] | undefined;
75
- runAfterPlugins?: string[] | undefined;
76
- initAfterPlugins: string[];
77
- dispose?(): void;
78
- init?(): void | Promise<void>;
79
- constructor(config: BSBServiceConstructor<InstanceType<typeof Config>, typeof EventSchemas>);
80
- run(obs: Observable): Promise<void>;
81
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/service-default4/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAGH,qCAAwF;AACxF,kEAA2F;AAC3F,6BAAwB;AAEX,QAAA,MAAM,GAAG,IAAA,yBAAkB,EACtC;IACE,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,sCAAsC;IACnD,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,oBAAoB,EAAE;QACpB,mBAAmB,EAAE,IAAA,qCAAqB,EACxC,UAAG,CAAC,MAAM,CAAC;YACT,IAAI,EAAE,UAAG,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;SACrD,EAAE,0BAA0B,CAAC,EAC9B,UAAG,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC,EAC5C,qBAAqB,CACtB;KACF;CACF,CAAC,CAAC;AAEH,MAAa,MAAO,SAAQ,iBAA4D;IACtF,MAAM,CAAC,MAAM,GAAG,cAAM,CAAC;IACvB,MAAM,CAAC,YAAY,GAAG,oBAAY,CAAC;IACnC,oDAAoD;IAE7C,iBAAiB,CAAwB;IACzC,gBAAgB,CAAwB;IACxC,eAAe,CAAwB;IAC9B,gBAAgB,GAAa,EAAE,CAAC;IAKhD,YAAY,MAA+E;QACzF,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAEe,KAAK,CAAC,GAAG,CAAC,GAAe;QACvC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAC3C,CAAC;;AAnBH,wBAoBC"}
@@ -1,229 +0,0 @@
1
- {
2
- "pluginName": "service-benchmarkify",
3
- "version": "1.0.0",
4
- "events": {
5
- "benchmark.started": {
6
- "type": "fire-and-forget",
7
- "category": "emitEvents",
8
- "description": "Benchmark test started",
9
- "inputSchema": {
10
- "description": "Benchmark start parameters",
11
- "type": "object",
12
- "properties": {
13
- "name": {
14
- "description": "Benchmark name",
15
- "type": "string"
16
- },
17
- "timestamp": {
18
- "description": "Start timestamp",
19
- "type": "string",
20
- "format": "datetime"
21
- }
22
- },
23
- "required": [
24
- "name",
25
- "timestamp"
26
- ]
27
- },
28
- "outputSchema": null
29
- },
30
- "benchmark.trigger": {
31
- "type": "fire-and-forget",
32
- "category": "onEvents",
33
- "description": "Trigger benchmark execution",
34
- "inputSchema": {
35
- "description": "Benchmark trigger parameters",
36
- "type": "object",
37
- "properties": {
38
- "testName": {
39
- "description": "Name of test to run",
40
- "type": "string"
41
- }
42
- },
43
- "required": []
44
- },
45
- "outputSchema": null
46
- },
47
- "performance.test": {
48
- "type": "returnable",
49
- "category": "emitReturnableEvents",
50
- "description": "Request performance test execution",
51
- "inputSchema": {
52
- "description": "Performance test parameters",
53
- "type": "object",
54
- "properties": {
55
- "iterations": {
56
- "description": "Number of iterations to run",
57
- "type": "number",
58
- "format": "double"
59
- },
60
- "warmup": {
61
- "description": "Whether to run warmup iterations",
62
- "type": "boolean"
63
- }
64
- },
65
- "required": [
66
- "iterations",
67
- "warmup"
68
- ]
69
- },
70
- "outputSchema": {
71
- "description": "Performance test results",
72
- "type": "object",
73
- "properties": {
74
- "duration": {
75
- "description": "Test duration in milliseconds",
76
- "type": "number",
77
- "format": "double"
78
- },
79
- "opsPerSecond": {
80
- "description": "Operations per second",
81
- "type": "number",
82
- "format": "double"
83
- }
84
- },
85
- "required": [
86
- "duration",
87
- "opsPerSecond"
88
- ]
89
- }
90
- },
91
- "add": {
92
- "type": "returnable",
93
- "category": "onReturnableEvents",
94
- "description": "Add two numbers",
95
- "inputSchema": {
96
- "description": "Add input parameters",
97
- "type": "object",
98
- "properties": {
99
- "a": {
100
- "description": "First number",
101
- "type": "number",
102
- "format": "double"
103
- },
104
- "b": {
105
- "description": "Second number",
106
- "type": "number",
107
- "format": "double"
108
- }
109
- },
110
- "required": [
111
- "a",
112
- "b"
113
- ]
114
- },
115
- "outputSchema": {
116
- "description": "Sum of numbers",
117
- "type": "number",
118
- "format": "double"
119
- }
120
- },
121
- "void": {
122
- "type": "returnable",
123
- "category": "onReturnableEvents",
124
- "description": "Void event for benchmarking",
125
- "inputSchema": {
126
- "description": "Empty parameters",
127
- "type": "object",
128
- "properties": {},
129
- "required": []
130
- },
131
- "outputSchema": {
132
- "description": "void",
133
- "oneOf": []
134
- }
135
- },
136
- "benchmark.results": {
137
- "type": "broadcast",
138
- "category": "emitBroadcast",
139
- "description": "Broadcast benchmark results to all interested parties",
140
- "inputSchema": {
141
- "description": "Benchmark results parameters",
142
- "type": "object",
143
- "properties": {
144
- "testName": {
145
- "description": "Test name",
146
- "type": "string"
147
- },
148
- "results": {
149
- "description": "Array of benchmark results",
150
- "type": "array",
151
- "items": {
152
- "description": "Benchmark result entry",
153
- "type": "object",
154
- "properties": {
155
- "operation": {
156
- "description": "Operation name",
157
- "type": "string"
158
- },
159
- "opsPerSecond": {
160
- "description": "Operations per second",
161
- "type": "number",
162
- "format": "double"
163
- },
164
- "duration": {
165
- "description": "Duration in milliseconds",
166
- "type": "number",
167
- "format": "double"
168
- }
169
- },
170
- "required": [
171
- "operation",
172
- "opsPerSecond",
173
- "duration"
174
- ]
175
- }
176
- },
177
- "timestamp": {
178
- "description": "Results timestamp",
179
- "type": "string",
180
- "format": "datetime"
181
- }
182
- },
183
- "required": [
184
- "testName",
185
- "results",
186
- "timestamp"
187
- ]
188
- },
189
- "outputSchema": null
190
- },
191
- "system.load": {
192
- "type": "broadcast",
193
- "category": "onBroadcast",
194
- "description": "Listen for system load updates",
195
- "inputSchema": {
196
- "description": "System load parameters",
197
- "type": "object",
198
- "properties": {
199
- "cpuUsage": {
200
- "description": "CPU usage percentage",
201
- "type": "number",
202
- "format": "double"
203
- },
204
- "memoryUsage": {
205
- "description": "Memory usage percentage",
206
- "type": "number",
207
- "format": "double"
208
- },
209
- "timestamp": {
210
- "description": "Load measurement timestamp",
211
- "type": "string",
212
- "format": "datetime"
213
- }
214
- },
215
- "required": [
216
- "cpuUsage",
217
- "memoryUsage",
218
- "timestamp"
219
- ]
220
- },
221
- "outputSchema": null
222
- }
223
- },
224
- "pluginType": "service",
225
- "configSchema": {
226
- "$schema": "https://json-schema.org/draft/2020-12/schema",
227
- "type": "null"
228
- }
229
- }
@@ -1,216 +0,0 @@
1
- {
2
- "pluginName": "service-default0",
3
- "version": "1.0.0",
4
- "events": {
5
- "test": {
6
- "type": "fire-and-forget",
7
- "category": "emitEvents",
8
- "description": "Test event with string parameters",
9
- "inputSchema": {
10
- "description": "Test event parameters",
11
- "type": "object",
12
- "properties": {
13
- "a": {
14
- "description": "First string parameter",
15
- "type": "string"
16
- },
17
- "b": {
18
- "description": "Second string parameter",
19
- "type": "string"
20
- }
21
- },
22
- "required": [
23
- "a",
24
- "b"
25
- ]
26
- },
27
- "outputSchema": null
28
- },
29
- "startup": {
30
- "type": "fire-and-forget",
31
- "category": "onEvents",
32
- "description": "Handle system startup notification",
33
- "inputSchema": {
34
- "description": "Startup event parameters",
35
- "type": "object",
36
- "properties": {
37
- "timestamp": {
38
- "description": "Startup timestamp",
39
- "type": "string",
40
- "format": "datetime"
41
- },
42
- "source": {
43
- "description": "Source identifier",
44
- "type": "string"
45
- }
46
- },
47
- "required": [
48
- "timestamp",
49
- "source"
50
- ]
51
- },
52
- "outputSchema": null
53
- },
54
- "calculate": {
55
- "type": "returnable",
56
- "category": "emitReturnableEvents",
57
- "description": "Calculate with two numbers",
58
- "inputSchema": {
59
- "description": "Calculate input parameters",
60
- "type": "object",
61
- "properties": {
62
- "a": {
63
- "description": "First number",
64
- "type": "number",
65
- "format": "double",
66
- "minimum": 0
67
- },
68
- "b": {
69
- "description": "Second number",
70
- "type": "number",
71
- "format": "double",
72
- "minimum": 0
73
- }
74
- },
75
- "required": [
76
- "a",
77
- "b"
78
- ]
79
- },
80
- "outputSchema": {
81
- "description": "Calculation result",
82
- "type": "number",
83
- "format": "double"
84
- }
85
- },
86
- "data.validate": {
87
- "type": "returnable",
88
- "category": "onReturnableEvents",
89
- "description": "Validate data against a schema",
90
- "inputSchema": {
91
- "description": "Validation input",
92
- "type": "object",
93
- "properties": {
94
- "data": {
95
- "description": "Data to validate",
96
- "oneOf": []
97
- },
98
- "schema": {
99
- "description": "Schema name",
100
- "type": "string"
101
- }
102
- },
103
- "required": [
104
- "data",
105
- "schema"
106
- ]
107
- },
108
- "outputSchema": {
109
- "description": "Validation output",
110
- "type": "object",
111
- "properties": {
112
- "valid": {
113
- "description": "Validation result",
114
- "type": "boolean"
115
- },
116
- "errors": {
117
- "description": "Validation errors",
118
- "type": "array",
119
- "items": {
120
- "description": "Error message",
121
- "type": "string"
122
- }
123
- }
124
- },
125
- "required": [
126
- "valid",
127
- "errors"
128
- ]
129
- }
130
- },
131
- "system.alert": {
132
- "type": "broadcast",
133
- "category": "emitBroadcast",
134
- "description": "System-wide alert broadcast",
135
- "inputSchema": {
136
- "description": "System alert parameters",
137
- "type": "object",
138
- "properties": {
139
- "level": {
140
- "description": "Alert level",
141
- "type": "string",
142
- "enum": [
143
- "info",
144
- "warning",
145
- "error",
146
- "critical"
147
- ]
148
- },
149
- "message": {
150
- "description": "Alert message",
151
- "type": "string"
152
- },
153
- "timestamp": {
154
- "description": "Alert timestamp",
155
- "type": "string",
156
- "format": "datetime"
157
- },
158
- "source": {
159
- "description": "Alert source",
160
- "type": "string"
161
- }
162
- },
163
- "required": [
164
- "level",
165
- "message",
166
- "timestamp",
167
- "source"
168
- ]
169
- },
170
- "outputSchema": null
171
- },
172
- "system.shutdown": {
173
- "type": "broadcast",
174
- "category": "onBroadcast",
175
- "description": "Listen for system shutdown broadcasts",
176
- "inputSchema": {
177
- "description": "Shutdown parameters",
178
- "type": "object",
179
- "properties": {
180
- "reason": {
181
- "description": "Shutdown reason",
182
- "type": "string"
183
- },
184
- "gracefulTimeout": {
185
- "description": "Graceful timeout in milliseconds",
186
- "type": "number",
187
- "format": "double"
188
- }
189
- },
190
- "required": [
191
- "reason",
192
- "gracefulTimeout"
193
- ]
194
- },
195
- "outputSchema": null
196
- }
197
- },
198
- "pluginType": "service",
199
- "configSchema": {
200
- "$schema": "https://json-schema.org/draft/2020-12/schema",
201
- "type": "object",
202
- "properties": {
203
- "testa": {
204
- "type": "number"
205
- },
206
- "testb": {
207
- "type": "number"
208
- }
209
- },
210
- "required": [
211
- "testa",
212
- "testb"
213
- ],
214
- "additionalProperties": false
215
- }
216
- }