conduithub 1.0.0 → 1.1.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.
- package/dist/core/conduit-hub/index.cjs +1 -1
- package/dist/core/conduit-hub/index.d.cts +1 -1
- package/dist/core/conduit-hub/index.d.mts +1 -1
- package/dist/core/conduit-hub/index.d.ts +1 -1
- package/dist/core/conduit-hub/index.mjs +1 -1
- package/dist/core/config-manager/index.d.cts +1 -1
- package/dist/core/config-manager/index.d.mts +1 -1
- package/dist/core/config-manager/index.d.ts +1 -1
- package/dist/core/event-bus/index.cjs +4 -4
- package/dist/core/event-bus/index.mjs +1 -1
- package/dist/core/hook/index.cjs +6 -6
- package/dist/core/hook/index.mjs +1 -1
- package/dist/core/index.cjs +5 -3
- package/dist/core/index.d.cts +8 -184
- package/dist/core/index.d.mts +8 -184
- package/dist/core/index.d.ts +8 -184
- package/dist/core/index.mjs +4 -3
- package/dist/core/plugin/index.d.cts +1 -1
- package/dist/core/plugin/index.d.mts +1 -1
- package/dist/core/plugin/index.d.ts +1 -1
- package/dist/core/service-container/index.cjs +9 -9
- package/dist/core/service-container/index.mjs +1 -1
- package/dist/core/state-manager/index.cjs +3 -3
- package/dist/core/state-manager/index.mjs +1 -1
- package/dist/{shared/conduithub.BqUYv04j.cjs → error/index.cjs} +3 -0
- package/dist/error/index.d.cts +47 -0
- package/dist/error/index.d.mts +47 -0
- package/dist/error/index.d.ts +47 -0
- package/dist/{shared/conduithub.BDwZXllF.mjs → error/index.mjs} +3 -1
- package/dist/index.cjs +191 -16
- package/dist/index.d.cts +65 -47
- package/dist/index.d.mts +65 -47
- package/dist/index.d.ts +65 -47
- package/dist/index.mjs +161 -5
- package/dist/plugins/index.cjs +40 -0
- package/dist/plugins/index.d.cts +10 -0
- package/dist/plugins/index.d.mts +10 -0
- package/dist/plugins/index.d.ts +10 -0
- package/dist/plugins/index.mjs +24 -0
- package/dist/plugins/kafka/index.cjs +34 -0
- package/dist/plugins/kafka/index.d.cts +250 -0
- package/dist/plugins/kafka/index.d.mts +250 -0
- package/dist/plugins/kafka/index.d.ts +250 -0
- package/dist/plugins/kafka/index.mjs +23 -0
- package/dist/plugins/redis/index.cjs +33 -0
- package/dist/plugins/redis/index.d.cts +151 -0
- package/dist/plugins/redis/index.d.mts +151 -0
- package/dist/plugins/redis/index.d.ts +151 -0
- package/dist/plugins/redis/index.mjs +23 -0
- package/dist/shared/conduithub.0FKJet8c.cjs +1130 -0
- package/dist/shared/conduithub.B16qn6pY.mjs +174 -0
- package/dist/shared/conduithub.BW-S7Bp_.d.cts +181 -0
- package/dist/shared/conduithub.BdX_BLza.mjs +1124 -0
- package/dist/shared/conduithub.BzuAKyjY.mjs +971 -0
- package/dist/shared/conduithub.DSAmRivG.d.ts +181 -0
- package/dist/shared/conduithub.DhMIxMx2.cjs +981 -0
- package/dist/shared/{conduithub.gF2DFc43.cjs → conduithub.Dlvl2xGE.cjs} +3 -3
- package/dist/shared/conduithub.GrtzQn_7.d.mts +181 -0
- package/dist/shared/{conduithub.bsiNMTVD.mjs → conduithub.Up0QYVao.mjs} +1 -1
- package/dist/shared/conduithub.jH-df3Zd.cjs +181 -0
- package/dist/utils/index.cjs +3 -2
- package/dist/utils/index.mjs +3 -2
- package/package.json +22 -1
|
@@ -12,7 +12,7 @@ const core_serviceContainer_index = require('../service-container/index.cjs');
|
|
|
12
12
|
const core_stateManager_index = require('../state-manager/index.cjs');
|
|
13
13
|
require('../../shared/conduithub.CmZo_Vuc.cjs');
|
|
14
14
|
require('../../shared/conduithub.DQO1dRnn.cjs');
|
|
15
|
-
require('../../
|
|
15
|
+
require('../../error/index.cjs');
|
|
16
16
|
require('../../shared/conduithub.Bq_7Xj0J.cjs');
|
|
17
17
|
|
|
18
18
|
class ConduitHub {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createLogger } from '../../shared/conduithub.B7aryjPG.cjs';
|
|
2
|
-
import { PluginManager, ConfigManager, BasePlugin, PluginConfig, PluginStatus } from '
|
|
2
|
+
import { e as PluginManager, C as ConfigManager, B as BasePlugin, P as PluginConfig, d as PluginStatus } from '../../shared/conduithub.BW-S7Bp_.cjs';
|
|
3
3
|
import { E as EventBus } from '../../shared/conduithub.BZQmkQy7.cjs';
|
|
4
4
|
import { Hook } from '../hook/index.cjs';
|
|
5
5
|
import { ServiceContainer } from '../service-container/index.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createLogger } from '../../shared/conduithub.B7aryjPG.mjs';
|
|
2
|
-
import { PluginManager, ConfigManager, BasePlugin, PluginConfig, PluginStatus } from '
|
|
2
|
+
import { e as PluginManager, C as ConfigManager, B as BasePlugin, P as PluginConfig, d as PluginStatus } from '../../shared/conduithub.GrtzQn_7.mjs';
|
|
3
3
|
import { E as EventBus } from '../../shared/conduithub.BzLwccre.mjs';
|
|
4
4
|
import { Hook } from '../hook/index.mjs';
|
|
5
5
|
import { ServiceContainer } from '../service-container/index.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createLogger } from '../../shared/conduithub.B7aryjPG.js';
|
|
2
|
-
import { PluginManager, ConfigManager, BasePlugin, PluginConfig, PluginStatus } from '
|
|
2
|
+
import { e as PluginManager, C as ConfigManager, B as BasePlugin, P as PluginConfig, d as PluginStatus } from '../../shared/conduithub.DSAmRivG.js';
|
|
3
3
|
import { E as EventBus } from '../../shared/conduithub.DQOWQ-Bx.js';
|
|
4
4
|
import { Hook } from '../hook/index.js';
|
|
5
5
|
import { ServiceContainer } from '../service-container/index.js';
|
|
@@ -10,7 +10,7 @@ import { ServiceContainer } from '../service-container/index.mjs';
|
|
|
10
10
|
import { StateManager } from '../state-manager/index.mjs';
|
|
11
11
|
import '../../shared/conduithub.G7ICpZIy.mjs';
|
|
12
12
|
import '../../shared/conduithub.alPiaJax.mjs';
|
|
13
|
-
import '../../
|
|
13
|
+
import '../../error/index.mjs';
|
|
14
14
|
import '../../shared/conduithub.CkOQG3cD.mjs';
|
|
15
15
|
|
|
16
16
|
class ConduitHub {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const error_index = require('../../error/index.cjs');
|
|
4
4
|
const logger = require('../../shared/conduithub.BNQsddJO.cjs');
|
|
5
5
|
require('process');
|
|
6
6
|
require('readline');
|
|
@@ -41,7 +41,7 @@ class EventBus {
|
|
|
41
41
|
}
|
|
42
42
|
ensureInitialized() {
|
|
43
43
|
if (!this.initialized) {
|
|
44
|
-
throw new
|
|
44
|
+
throw new error_index.ConduithubError(code.ERROR_CODE.EVENT_BUS_NOT_INITIALIZED);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
sanitizeLog(data) {
|
|
@@ -94,13 +94,13 @@ class EventBus {
|
|
|
94
94
|
registerHandler(type, handler, once, priority, customId) {
|
|
95
95
|
const list = this.handlers[type] ??= [];
|
|
96
96
|
if (list.length >= this.maxHandlersPerEvent) {
|
|
97
|
-
throw new
|
|
97
|
+
throw new error_index.ConduithubError(
|
|
98
98
|
`${code.ERROR_CODE.EVENT_HANDLER_LIMIT_EXCEEDED} ${String(type)} (${this.maxHandlersPerEvent})`
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
const id = customId ?? uuid.generateUuid();
|
|
102
102
|
if (customId && list.some((h) => h.id === customId)) {
|
|
103
|
-
throw new
|
|
103
|
+
throw new error_index.ConduithubError(
|
|
104
104
|
`${code.ERROR_CODE.DUPLICATE_EVENT_HANDLER_ID} ${String(type)}: ${customId}`
|
|
105
105
|
);
|
|
106
106
|
}
|
package/dist/core/hook/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const error_index = require('../../error/index.cjs');
|
|
4
4
|
const logger = require('../../shared/conduithub.BNQsddJO.cjs');
|
|
5
5
|
require('process');
|
|
6
6
|
require('readline');
|
|
@@ -39,7 +39,7 @@ class Hook {
|
|
|
39
39
|
}
|
|
40
40
|
ensureInitialized() {
|
|
41
41
|
if (!this.initialized) {
|
|
42
|
-
throw new
|
|
42
|
+
throw new error_index.ConduithubError(code.ERROR_CODE.HOOK_SYSTEM_NOT_INITIALIZED);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
sanitizeLog(data) {
|
|
@@ -81,13 +81,13 @@ class Hook {
|
|
|
81
81
|
if (!this.hooks.has(hook)) this.hooks.set(hook, []);
|
|
82
82
|
const handlers = this.hooks.get(hook);
|
|
83
83
|
if (handlers.length >= this.maxHandlersPerHook) {
|
|
84
|
-
throw new
|
|
84
|
+
throw new error_index.ConduithubError(
|
|
85
85
|
`${code.ERROR_CODE.HOOK_HANDLER_LIMIT_EXCEEDED} ${String(hook)} (${this.maxHandlersPerHook})`
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
const id = customId ?? uuid.generateUuid();
|
|
89
89
|
if (customId && handlers.some((h) => h.id === customId)) {
|
|
90
|
-
throw new
|
|
90
|
+
throw new error_index.ConduithubError(
|
|
91
91
|
`${code.ERROR_CODE.DUPLICATE_HOOK_HANDLER_ID} ${String(hook)}: ${customId}`
|
|
92
92
|
);
|
|
93
93
|
}
|
|
@@ -141,7 +141,7 @@ class Hook {
|
|
|
141
141
|
if (typeof result === "object" && result && "success" in result) {
|
|
142
142
|
const res = result;
|
|
143
143
|
if (!res.success && failFast)
|
|
144
|
-
throw new
|
|
144
|
+
throw new error_index.ConduithubError(
|
|
145
145
|
res.error ?? code.ERROR_CODE.HOOK_EXECUTION_FAILED
|
|
146
146
|
);
|
|
147
147
|
this.logger.debug(
|
|
@@ -197,7 +197,7 @@ class Hook {
|
|
|
197
197
|
} else {
|
|
198
198
|
errorCount++;
|
|
199
199
|
if (this.failFast)
|
|
200
|
-
throw new
|
|
200
|
+
throw new error_index.ConduithubError(error ?? code.ERROR_CODE.UNKNOWN_ERROR);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
this.logger.debug(
|
package/dist/core/hook/index.mjs
CHANGED
package/dist/core/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const core_conduitHub_index = require('./conduit-hub/index.cjs');
|
|
3
4
|
const core_configManager_index = require('./config-manager/index.cjs');
|
|
4
5
|
const core_eventBus_index = require('./event-bus/index.cjs');
|
|
5
6
|
const core_hook_index = require('./hook/index.cjs');
|
|
@@ -7,17 +8,18 @@ const core_plugin_index = require('./plugin/index.cjs');
|
|
|
7
8
|
const core_serviceContainer_index = require('./service-container/index.cjs');
|
|
8
9
|
const core_stateManager_index = require('./state-manager/index.cjs');
|
|
9
10
|
const manager = require('../shared/conduithub.DsOOeNwU.cjs');
|
|
10
|
-
require('../shared/conduithub.CmZo_Vuc.cjs');
|
|
11
|
-
require('../shared/conduithub.DQO1dRnn.cjs');
|
|
12
11
|
require('../shared/conduithub.BNQsddJO.cjs');
|
|
13
12
|
require('process');
|
|
14
13
|
require('readline');
|
|
15
14
|
require('uuid');
|
|
16
|
-
require('../shared/conduithub.
|
|
15
|
+
require('../shared/conduithub.CmZo_Vuc.cjs');
|
|
16
|
+
require('../shared/conduithub.DQO1dRnn.cjs');
|
|
17
|
+
require('../error/index.cjs');
|
|
17
18
|
require('../shared/conduithub.Bq_7Xj0J.cjs');
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
|
|
22
|
+
exports.ConduitHub = core_conduitHub_index.ConduitHub;
|
|
21
23
|
exports.ConfigManager = core_configManager_index.ConfigManager;
|
|
22
24
|
exports.EventBus = core_eventBus_index.EventBus;
|
|
23
25
|
exports.Hook = core_hook_index.Hook;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,184 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
export { StateChangeHandler } from './state-manager/index.cjs';
|
|
10
|
-
|
|
11
|
-
interface PluginStatus {
|
|
12
|
-
name: string;
|
|
13
|
-
version: string;
|
|
14
|
-
status: "registered" | "initialized" | "running" | "stopped" | "destroyed" | "error";
|
|
15
|
-
config: PluginConfig;
|
|
16
|
-
error?: string;
|
|
17
|
-
lastActivity: number;
|
|
18
|
-
}
|
|
19
|
-
declare class PluginManager {
|
|
20
|
-
private eventBus;
|
|
21
|
-
private logger;
|
|
22
|
-
private serviceContainer;
|
|
23
|
-
private stateManager;
|
|
24
|
-
private hookSystem;
|
|
25
|
-
private configManager;
|
|
26
|
-
private plugins;
|
|
27
|
-
private pluginStatuses;
|
|
28
|
-
private pluginConfigs;
|
|
29
|
-
constructor(eventBus: EventBus<Record<string, unknown>>, logger: Logger, serviceContainer: ServiceContainer, stateManager: StateManager, hookSystem: Hook<Record<string, {
|
|
30
|
-
input: unknown;
|
|
31
|
-
output: unknown;
|
|
32
|
-
}>>, configManager: ConfigManager);
|
|
33
|
-
private log;
|
|
34
|
-
registerPlugin(plugin: BasePlugin, config?: PluginConfig): Promise<void>;
|
|
35
|
-
unregisterPlugin(pluginName: string): Promise<void>;
|
|
36
|
-
initializePlugin(pluginName: string): Promise<void>;
|
|
37
|
-
startPlugin(pluginName: string): Promise<void>;
|
|
38
|
-
stopPlugin(pluginName: string): Promise<void>;
|
|
39
|
-
shutdownAll(): Promise<void>;
|
|
40
|
-
isPluginRegistered(pluginName: string): boolean;
|
|
41
|
-
isPluginRunning(pluginName: string): boolean;
|
|
42
|
-
getPluginStatus(pluginName: string): PluginStatus | undefined;
|
|
43
|
-
listPlugins(): string[];
|
|
44
|
-
getAllPluginStatuses(): PluginStatus[];
|
|
45
|
-
getPlugin(pluginName: string): BasePlugin | undefined;
|
|
46
|
-
getPluginConfig(pluginName: string): PluginConfig | undefined;
|
|
47
|
-
updatePluginConfig(pluginName: string, config: Partial<PluginConfig>): Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface PluginConfig {
|
|
51
|
-
name: string;
|
|
52
|
-
version: string;
|
|
53
|
-
enabled: boolean;
|
|
54
|
-
dependencies?: string[];
|
|
55
|
-
config?: Record<string, unknown>;
|
|
56
|
-
}
|
|
57
|
-
interface PluginContext<EM extends Record<string, unknown> = Record<string, unknown>, HM extends Record<string, {
|
|
58
|
-
input: unknown;
|
|
59
|
-
output: unknown;
|
|
60
|
-
}> = Record<string, {
|
|
61
|
-
input: unknown;
|
|
62
|
-
output: unknown;
|
|
63
|
-
}>> {
|
|
64
|
-
eventBus: EventBus<EM>;
|
|
65
|
-
logger: Logger;
|
|
66
|
-
config: PluginConfig;
|
|
67
|
-
serviceContainer: ServiceContainer;
|
|
68
|
-
hookSystem: Hook<HM>;
|
|
69
|
-
stateManager: StateManager;
|
|
70
|
-
}
|
|
71
|
-
interface PluginMetadata {
|
|
72
|
-
name: string;
|
|
73
|
-
version: string;
|
|
74
|
-
description?: string;
|
|
75
|
-
author?: string;
|
|
76
|
-
dependencies?: string[];
|
|
77
|
-
hooks: string[];
|
|
78
|
-
events: string[];
|
|
79
|
-
}
|
|
80
|
-
type PluginLifecycle = "beforeInit" | "afterInit" | "beforeStart" | "afterStart" | "beforeStop" | "afterStop" | "beforeDestroy" | "afterDestroy";
|
|
81
|
-
declare abstract class BasePlugin<T extends Record<string, unknown> = Record<string, unknown>, EM extends Record<string, unknown> = Record<string, unknown>, HM extends Record<string, {
|
|
82
|
-
input: unknown;
|
|
83
|
-
output: unknown;
|
|
84
|
-
}> = Record<string, {
|
|
85
|
-
input: unknown;
|
|
86
|
-
output: unknown;
|
|
87
|
-
}>> {
|
|
88
|
-
protected config: PluginConfig & {
|
|
89
|
-
config: T;
|
|
90
|
-
};
|
|
91
|
-
protected context: PluginContext<EM, HM>;
|
|
92
|
-
protected metadata: PluginMetadata;
|
|
93
|
-
protected isInitialized: boolean;
|
|
94
|
-
protected isRunning: boolean;
|
|
95
|
-
private managedEventHandlers;
|
|
96
|
-
private managedHookHandlers;
|
|
97
|
-
private lock;
|
|
98
|
-
constructor(config: PluginConfig & {
|
|
99
|
-
config: T;
|
|
100
|
-
});
|
|
101
|
-
abstract getMetadata(): PluginMetadata;
|
|
102
|
-
initialize(context: PluginContext<EM, HM>): Promise<void>;
|
|
103
|
-
start(): Promise<void>;
|
|
104
|
-
stop(): Promise<void>;
|
|
105
|
-
destroy(): Promise<void>;
|
|
106
|
-
protected abstract onInitialize(): Promise<void>;
|
|
107
|
-
protected abstract onStart(): Promise<void>;
|
|
108
|
-
protected abstract onStop(): Promise<void>;
|
|
109
|
-
protected abstract onDestroy(): Promise<void>;
|
|
110
|
-
private executeLifecycleHook;
|
|
111
|
-
getConfig(): PluginConfig & {
|
|
112
|
-
config: T;
|
|
113
|
-
};
|
|
114
|
-
getContext(): PluginContext<EM, HM>;
|
|
115
|
-
isPluginInitialized(): boolean;
|
|
116
|
-
isPluginRunning(): boolean;
|
|
117
|
-
protected emit<K extends keyof EM>(event: K, data: EM[K]): Promise<void>;
|
|
118
|
-
protected on<K extends keyof EM>(event: K, listener: (payload: EM[K], event: EventData<K & string, EM[K]>) => Promise<void> | void): string;
|
|
119
|
-
protected once<K extends keyof EM>(event: K, listener: (payload: EM[K], event: EventData<K & string, EM[K]>) => Promise<void> | void): string;
|
|
120
|
-
protected onManaged<K extends keyof EM>(event: K, listener: (payload: EM[K], event: EventData<K & string, EM[K]>) => Promise<void> | void): string;
|
|
121
|
-
protected onceManaged<K extends keyof EM>(event: K, listener: (payload: EM[K], event: EventData<K & string, EM[K]>) => Promise<void> | void): string;
|
|
122
|
-
protected off<K extends keyof EM>(event: K, handlerId: string): void;
|
|
123
|
-
protected executeHook<K extends keyof HM>(hook: K, input: HM[K]["input"]): Promise<HM[K]["output"]>;
|
|
124
|
-
protected executeHookSeries<K extends keyof HM>(hook: K, input: HM[K]["input"]): Promise<HookResult<HM[K]["output"]>[]>;
|
|
125
|
-
protected executeHookSeriesWithContext<K extends keyof HM>(hook: K, input: HM[K]["input"], context: Record<string, unknown>): Promise<HookResult<HM[K]["output"]>[]>;
|
|
126
|
-
protected registerHook<K extends keyof HM>(hook: K, handler: (data: HM[K]["input"], context?: Record<string, unknown>) => HM[K]["output"] | Promise<HM[K]["output"]> | HookResult<HM[K]["output"]> | Promise<HookResult<HM[K]["output"]>>, priority?: number, customId?: string): Promise<string>;
|
|
127
|
-
protected registerHookManaged<K extends keyof HM>(hook: K, handler: (data: HM[K]["input"], context?: Record<string, unknown>) => HM[K]["output"] | Promise<HM[K]["output"]> | HookResult<HM[K]["output"]> | Promise<HookResult<HM[K]["output"]>>, priority?: number, customId?: string): Promise<string>;
|
|
128
|
-
protected unregisterHook<K extends keyof HM>(hook: K, handlerId: string): Promise<boolean>;
|
|
129
|
-
protected getStatus(): {
|
|
130
|
-
initialized: boolean;
|
|
131
|
-
running: boolean;
|
|
132
|
-
};
|
|
133
|
-
protected getName(): string;
|
|
134
|
-
protected getVersion(): string;
|
|
135
|
-
protected isEnabled(): boolean;
|
|
136
|
-
protected getState(key: string): unknown;
|
|
137
|
-
protected setState(key: string, value: unknown): void;
|
|
138
|
-
protected deleteState(key: string): void;
|
|
139
|
-
protected get logger(): Logger;
|
|
140
|
-
updateConfig(update: Partial<PluginConfig & {
|
|
141
|
-
config: T;
|
|
142
|
-
}>): void;
|
|
143
|
-
private cleanupManagedHandlers;
|
|
144
|
-
private cleanupManagedHooks;
|
|
145
|
-
private withLock;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
declare class ConfigManager {
|
|
149
|
-
private config;
|
|
150
|
-
private pluginConfigs;
|
|
151
|
-
private isInitialized;
|
|
152
|
-
initialize(config: Record<string, unknown>): Promise<void>;
|
|
153
|
-
shutdown(): Promise<void>;
|
|
154
|
-
get<T>(key: string, defaultValue?: T): T | undefined;
|
|
155
|
-
set<T>(key: string, value: T): void;
|
|
156
|
-
has(key: string): boolean;
|
|
157
|
-
delete(key: string): boolean;
|
|
158
|
-
loadConfig(config: Record<string, unknown>): void;
|
|
159
|
-
clearConfig(): void;
|
|
160
|
-
getPluginConfig(pluginName: string): PluginConfig | undefined;
|
|
161
|
-
setPluginConfig(pluginName: string, config: PluginConfig): void;
|
|
162
|
-
updatePluginConfig(pluginName: string, updates: Partial<PluginConfig>): void;
|
|
163
|
-
hasPluginConfig(pluginName: string): boolean;
|
|
164
|
-
deletePluginConfig(pluginName: string): boolean;
|
|
165
|
-
getAllPluginConfigs(): Record<string, PluginConfig>;
|
|
166
|
-
loadPluginConfigs(configs: Record<string, PluginConfig>): void;
|
|
167
|
-
validateConfig(schema: z.ZodTypeAny, config: unknown): {
|
|
168
|
-
valid: boolean;
|
|
169
|
-
errors: string[];
|
|
170
|
-
};
|
|
171
|
-
exportConfig(format?: "json"): string;
|
|
172
|
-
importConfig(configJson: string): void;
|
|
173
|
-
getPluginConfigNames(): string[];
|
|
174
|
-
getStats(): {
|
|
175
|
-
totalConfigKeys: number;
|
|
176
|
-
totalPluginConfigs: number;
|
|
177
|
-
configKeys: string[];
|
|
178
|
-
pluginConfigNames: string[];
|
|
179
|
-
};
|
|
180
|
-
watchConfig(key: string, callback: (value: unknown) => void): () => void;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export { BasePlugin, ConfigManager, EventBus, Hook, HookResult, PluginManager, ServiceContainer, StateManager };
|
|
184
|
-
export type { PluginConfig, PluginContext, PluginLifecycle, PluginMetadata, PluginStatus };
|
|
1
|
+
export { ConduitHub } from './conduit-hub/index.cjs';
|
|
2
|
+
export { B as BasePlugin, C as ConfigManager, P as PluginConfig, a as PluginContext, c as PluginLifecycle, e as PluginManager, b as PluginMetadata, d as PluginStatus } from '../shared/conduithub.BW-S7Bp_.cjs';
|
|
3
|
+
export { E as EventBus } from '../shared/conduithub.BZQmkQy7.cjs';
|
|
4
|
+
export { Hook, HookHandler, HookResult } from './hook/index.cjs';
|
|
5
|
+
export { ServiceContainer, ServiceDescriptor } from './service-container/index.cjs';
|
|
6
|
+
export { StateChangeHandler, StateManager } from './state-manager/index.cjs';
|
|
7
|
+
import '../shared/conduithub.B7aryjPG.cjs';
|
|
8
|
+
import 'zod';
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,184 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
export { StateChangeHandler } from './state-manager/index.mjs';
|
|
10
|
-
|
|
11
|
-
interface PluginStatus {
|
|
12
|
-
name: string;
|
|
13
|
-
version: string;
|
|
14
|
-
status: "registered" | "initialized" | "running" | "stopped" | "destroyed" | "error";
|
|
15
|
-
config: PluginConfig;
|
|
16
|
-
error?: string;
|
|
17
|
-
lastActivity: number;
|
|
18
|
-
}
|
|
19
|
-
declare class PluginManager {
|
|
20
|
-
private eventBus;
|
|
21
|
-
private logger;
|
|
22
|
-
private serviceContainer;
|
|
23
|
-
private stateManager;
|
|
24
|
-
private hookSystem;
|
|
25
|
-
private configManager;
|
|
26
|
-
private plugins;
|
|
27
|
-
private pluginStatuses;
|
|
28
|
-
private pluginConfigs;
|
|
29
|
-
constructor(eventBus: EventBus<Record<string, unknown>>, logger: Logger, serviceContainer: ServiceContainer, stateManager: StateManager, hookSystem: Hook<Record<string, {
|
|
30
|
-
input: unknown;
|
|
31
|
-
output: unknown;
|
|
32
|
-
}>>, configManager: ConfigManager);
|
|
33
|
-
private log;
|
|
34
|
-
registerPlugin(plugin: BasePlugin, config?: PluginConfig): Promise<void>;
|
|
35
|
-
unregisterPlugin(pluginName: string): Promise<void>;
|
|
36
|
-
initializePlugin(pluginName: string): Promise<void>;
|
|
37
|
-
startPlugin(pluginName: string): Promise<void>;
|
|
38
|
-
stopPlugin(pluginName: string): Promise<void>;
|
|
39
|
-
shutdownAll(): Promise<void>;
|
|
40
|
-
isPluginRegistered(pluginName: string): boolean;
|
|
41
|
-
isPluginRunning(pluginName: string): boolean;
|
|
42
|
-
getPluginStatus(pluginName: string): PluginStatus | undefined;
|
|
43
|
-
listPlugins(): string[];
|
|
44
|
-
getAllPluginStatuses(): PluginStatus[];
|
|
45
|
-
getPlugin(pluginName: string): BasePlugin | undefined;
|
|
46
|
-
getPluginConfig(pluginName: string): PluginConfig | undefined;
|
|
47
|
-
updatePluginConfig(pluginName: string, config: Partial<PluginConfig>): Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface PluginConfig {
|
|
51
|
-
name: string;
|
|
52
|
-
version: string;
|
|
53
|
-
enabled: boolean;
|
|
54
|
-
dependencies?: string[];
|
|
55
|
-
config?: Record<string, unknown>;
|
|
56
|
-
}
|
|
57
|
-
interface PluginContext<EM extends Record<string, unknown> = Record<string, unknown>, HM extends Record<string, {
|
|
58
|
-
input: unknown;
|
|
59
|
-
output: unknown;
|
|
60
|
-
}> = Record<string, {
|
|
61
|
-
input: unknown;
|
|
62
|
-
output: unknown;
|
|
63
|
-
}>> {
|
|
64
|
-
eventBus: EventBus<EM>;
|
|
65
|
-
logger: Logger;
|
|
66
|
-
config: PluginConfig;
|
|
67
|
-
serviceContainer: ServiceContainer;
|
|
68
|
-
hookSystem: Hook<HM>;
|
|
69
|
-
stateManager: StateManager;
|
|
70
|
-
}
|
|
71
|
-
interface PluginMetadata {
|
|
72
|
-
name: string;
|
|
73
|
-
version: string;
|
|
74
|
-
description?: string;
|
|
75
|
-
author?: string;
|
|
76
|
-
dependencies?: string[];
|
|
77
|
-
hooks: string[];
|
|
78
|
-
events: string[];
|
|
79
|
-
}
|
|
80
|
-
type PluginLifecycle = "beforeInit" | "afterInit" | "beforeStart" | "afterStart" | "beforeStop" | "afterStop" | "beforeDestroy" | "afterDestroy";
|
|
81
|
-
declare abstract class BasePlugin<T extends Record<string, unknown> = Record<string, unknown>, EM extends Record<string, unknown> = Record<string, unknown>, HM extends Record<string, {
|
|
82
|
-
input: unknown;
|
|
83
|
-
output: unknown;
|
|
84
|
-
}> = Record<string, {
|
|
85
|
-
input: unknown;
|
|
86
|
-
output: unknown;
|
|
87
|
-
}>> {
|
|
88
|
-
protected config: PluginConfig & {
|
|
89
|
-
config: T;
|
|
90
|
-
};
|
|
91
|
-
protected context: PluginContext<EM, HM>;
|
|
92
|
-
protected metadata: PluginMetadata;
|
|
93
|
-
protected isInitialized: boolean;
|
|
94
|
-
protected isRunning: boolean;
|
|
95
|
-
private managedEventHandlers;
|
|
96
|
-
private managedHookHandlers;
|
|
97
|
-
private lock;
|
|
98
|
-
constructor(config: PluginConfig & {
|
|
99
|
-
config: T;
|
|
100
|
-
});
|
|
101
|
-
abstract getMetadata(): PluginMetadata;
|
|
102
|
-
initialize(context: PluginContext<EM, HM>): Promise<void>;
|
|
103
|
-
start(): Promise<void>;
|
|
104
|
-
stop(): Promise<void>;
|
|
105
|
-
destroy(): Promise<void>;
|
|
106
|
-
protected abstract onInitialize(): Promise<void>;
|
|
107
|
-
protected abstract onStart(): Promise<void>;
|
|
108
|
-
protected abstract onStop(): Promise<void>;
|
|
109
|
-
protected abstract onDestroy(): Promise<void>;
|
|
110
|
-
private executeLifecycleHook;
|
|
111
|
-
getConfig(): PluginConfig & {
|
|
112
|
-
config: T;
|
|
113
|
-
};
|
|
114
|
-
getContext(): PluginContext<EM, HM>;
|
|
115
|
-
isPluginInitialized(): boolean;
|
|
116
|
-
isPluginRunning(): boolean;
|
|
117
|
-
protected emit<K extends keyof EM>(event: K, data: EM[K]): Promise<void>;
|
|
118
|
-
protected on<K extends keyof EM>(event: K, listener: (payload: EM[K], event: EventData<K & string, EM[K]>) => Promise<void> | void): string;
|
|
119
|
-
protected once<K extends keyof EM>(event: K, listener: (payload: EM[K], event: EventData<K & string, EM[K]>) => Promise<void> | void): string;
|
|
120
|
-
protected onManaged<K extends keyof EM>(event: K, listener: (payload: EM[K], event: EventData<K & string, EM[K]>) => Promise<void> | void): string;
|
|
121
|
-
protected onceManaged<K extends keyof EM>(event: K, listener: (payload: EM[K], event: EventData<K & string, EM[K]>) => Promise<void> | void): string;
|
|
122
|
-
protected off<K extends keyof EM>(event: K, handlerId: string): void;
|
|
123
|
-
protected executeHook<K extends keyof HM>(hook: K, input: HM[K]["input"]): Promise<HM[K]["output"]>;
|
|
124
|
-
protected executeHookSeries<K extends keyof HM>(hook: K, input: HM[K]["input"]): Promise<HookResult<HM[K]["output"]>[]>;
|
|
125
|
-
protected executeHookSeriesWithContext<K extends keyof HM>(hook: K, input: HM[K]["input"], context: Record<string, unknown>): Promise<HookResult<HM[K]["output"]>[]>;
|
|
126
|
-
protected registerHook<K extends keyof HM>(hook: K, handler: (data: HM[K]["input"], context?: Record<string, unknown>) => HM[K]["output"] | Promise<HM[K]["output"]> | HookResult<HM[K]["output"]> | Promise<HookResult<HM[K]["output"]>>, priority?: number, customId?: string): Promise<string>;
|
|
127
|
-
protected registerHookManaged<K extends keyof HM>(hook: K, handler: (data: HM[K]["input"], context?: Record<string, unknown>) => HM[K]["output"] | Promise<HM[K]["output"]> | HookResult<HM[K]["output"]> | Promise<HookResult<HM[K]["output"]>>, priority?: number, customId?: string): Promise<string>;
|
|
128
|
-
protected unregisterHook<K extends keyof HM>(hook: K, handlerId: string): Promise<boolean>;
|
|
129
|
-
protected getStatus(): {
|
|
130
|
-
initialized: boolean;
|
|
131
|
-
running: boolean;
|
|
132
|
-
};
|
|
133
|
-
protected getName(): string;
|
|
134
|
-
protected getVersion(): string;
|
|
135
|
-
protected isEnabled(): boolean;
|
|
136
|
-
protected getState(key: string): unknown;
|
|
137
|
-
protected setState(key: string, value: unknown): void;
|
|
138
|
-
protected deleteState(key: string): void;
|
|
139
|
-
protected get logger(): Logger;
|
|
140
|
-
updateConfig(update: Partial<PluginConfig & {
|
|
141
|
-
config: T;
|
|
142
|
-
}>): void;
|
|
143
|
-
private cleanupManagedHandlers;
|
|
144
|
-
private cleanupManagedHooks;
|
|
145
|
-
private withLock;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
declare class ConfigManager {
|
|
149
|
-
private config;
|
|
150
|
-
private pluginConfigs;
|
|
151
|
-
private isInitialized;
|
|
152
|
-
initialize(config: Record<string, unknown>): Promise<void>;
|
|
153
|
-
shutdown(): Promise<void>;
|
|
154
|
-
get<T>(key: string, defaultValue?: T): T | undefined;
|
|
155
|
-
set<T>(key: string, value: T): void;
|
|
156
|
-
has(key: string): boolean;
|
|
157
|
-
delete(key: string): boolean;
|
|
158
|
-
loadConfig(config: Record<string, unknown>): void;
|
|
159
|
-
clearConfig(): void;
|
|
160
|
-
getPluginConfig(pluginName: string): PluginConfig | undefined;
|
|
161
|
-
setPluginConfig(pluginName: string, config: PluginConfig): void;
|
|
162
|
-
updatePluginConfig(pluginName: string, updates: Partial<PluginConfig>): void;
|
|
163
|
-
hasPluginConfig(pluginName: string): boolean;
|
|
164
|
-
deletePluginConfig(pluginName: string): boolean;
|
|
165
|
-
getAllPluginConfigs(): Record<string, PluginConfig>;
|
|
166
|
-
loadPluginConfigs(configs: Record<string, PluginConfig>): void;
|
|
167
|
-
validateConfig(schema: z.ZodTypeAny, config: unknown): {
|
|
168
|
-
valid: boolean;
|
|
169
|
-
errors: string[];
|
|
170
|
-
};
|
|
171
|
-
exportConfig(format?: "json"): string;
|
|
172
|
-
importConfig(configJson: string): void;
|
|
173
|
-
getPluginConfigNames(): string[];
|
|
174
|
-
getStats(): {
|
|
175
|
-
totalConfigKeys: number;
|
|
176
|
-
totalPluginConfigs: number;
|
|
177
|
-
configKeys: string[];
|
|
178
|
-
pluginConfigNames: string[];
|
|
179
|
-
};
|
|
180
|
-
watchConfig(key: string, callback: (value: unknown) => void): () => void;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export { BasePlugin, ConfigManager, EventBus, Hook, HookResult, PluginManager, ServiceContainer, StateManager };
|
|
184
|
-
export type { PluginConfig, PluginContext, PluginLifecycle, PluginMetadata, PluginStatus };
|
|
1
|
+
export { ConduitHub } from './conduit-hub/index.mjs';
|
|
2
|
+
export { B as BasePlugin, C as ConfigManager, P as PluginConfig, a as PluginContext, c as PluginLifecycle, e as PluginManager, b as PluginMetadata, d as PluginStatus } from '../shared/conduithub.GrtzQn_7.mjs';
|
|
3
|
+
export { E as EventBus } from '../shared/conduithub.BzLwccre.mjs';
|
|
4
|
+
export { Hook, HookHandler, HookResult } from './hook/index.mjs';
|
|
5
|
+
export { ServiceContainer, ServiceDescriptor } from './service-container/index.mjs';
|
|
6
|
+
export { StateChangeHandler, StateManager } from './state-manager/index.mjs';
|
|
7
|
+
import '../shared/conduithub.B7aryjPG.mjs';
|
|
8
|
+
import 'zod';
|