conduithub 1.0.1 → 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.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/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/index.cjs +4 -2
- 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 +3 -2
- 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/index.cjs +185 -14
- package/dist/index.d.cts +67 -3
- package/dist/index.d.mts +67 -3
- package/dist/index.d.ts +67 -3
- package/dist/index.mjs +159 -6
- package/dist/plugins/index.cjs +32 -4
- package/dist/plugins/index.d.cts +4 -2
- package/dist/plugins/index.d.mts +4 -2
- package/dist/plugins/index.d.ts +4 -2
- package/dist/plugins/index.mjs +21 -3
- 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 +26 -5
- package/dist/plugins/redis/index.d.cts +59 -17
- package/dist/plugins/redis/index.d.mts +59 -17
- package/dist/plugins/redis/index.d.ts +59 -17
- package/dist/plugins/redis/index.mjs +21 -4
- 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.-bZD30_I.mjs → conduithub.BzuAKyjY.mjs} +238 -36
- package/dist/shared/conduithub.DSAmRivG.d.ts +181 -0
- package/dist/shared/{conduithub.cvEjE62V.cjs → conduithub.DhMIxMx2.cjs} +242 -36
- package/dist/shared/conduithub.GrtzQn_7.d.mts +181 -0
- package/dist/shared/conduithub.jH-df3Zd.cjs +181 -0
- package/package.json +22 -1
package/dist/core/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { ConduitHub } from './conduit-hub/index.mjs';
|
|
1
2
|
export { ConfigManager } from './config-manager/index.mjs';
|
|
2
3
|
export { EventBus } from './event-bus/index.mjs';
|
|
3
4
|
export { Hook } from './hook/index.mjs';
|
|
@@ -5,11 +6,11 @@ export { BasePlugin } from './plugin/index.mjs';
|
|
|
5
6
|
export { ServiceContainer } from './service-container/index.mjs';
|
|
6
7
|
export { StateManager } from './state-manager/index.mjs';
|
|
7
8
|
export { P as PluginManager } from '../shared/conduithub.DyQQrHW9.mjs';
|
|
8
|
-
import '../shared/conduithub.G7ICpZIy.mjs';
|
|
9
|
-
import '../shared/conduithub.alPiaJax.mjs';
|
|
10
9
|
import '../shared/conduithub.BNefRQsK.mjs';
|
|
11
10
|
import 'process';
|
|
12
11
|
import 'readline';
|
|
13
12
|
import 'uuid';
|
|
13
|
+
import '../shared/conduithub.G7ICpZIy.mjs';
|
|
14
|
+
import '../shared/conduithub.alPiaJax.mjs';
|
|
14
15
|
import '../error/index.mjs';
|
|
15
16
|
import '../shared/conduithub.CkOQG3cD.mjs';
|
|
@@ -3,5 +3,5 @@ import '../../shared/conduithub.B7aryjPG.cjs';
|
|
|
3
3
|
import '../../shared/conduithub.BZQmkQy7.cjs';
|
|
4
4
|
import '../service-container/index.cjs';
|
|
5
5
|
import '../state-manager/index.cjs';
|
|
6
|
-
export { BasePlugin, PluginConfig, PluginContext, PluginLifecycle, PluginManager, PluginMetadata, PluginStatus } from '
|
|
6
|
+
export { B as BasePlugin, P as PluginConfig, a as PluginContext, c as PluginLifecycle, e as PluginManager, b as PluginMetadata, d as PluginStatus } from '../../shared/conduithub.BW-S7Bp_.cjs';
|
|
7
7
|
import 'zod';
|
|
@@ -3,5 +3,5 @@ import '../../shared/conduithub.B7aryjPG.mjs';
|
|
|
3
3
|
import '../../shared/conduithub.BzLwccre.mjs';
|
|
4
4
|
import '../service-container/index.mjs';
|
|
5
5
|
import '../state-manager/index.mjs';
|
|
6
|
-
export { BasePlugin, PluginConfig, PluginContext, PluginLifecycle, PluginManager, PluginMetadata, PluginStatus } from '
|
|
6
|
+
export { B as BasePlugin, P as PluginConfig, a as PluginContext, c as PluginLifecycle, e as PluginManager, b as PluginMetadata, d as PluginStatus } from '../../shared/conduithub.GrtzQn_7.mjs';
|
|
7
7
|
import 'zod';
|
|
@@ -3,5 +3,5 @@ import '../../shared/conduithub.B7aryjPG.js';
|
|
|
3
3
|
import '../../shared/conduithub.DQOWQ-Bx.js';
|
|
4
4
|
import '../service-container/index.js';
|
|
5
5
|
import '../state-manager/index.js';
|
|
6
|
-
export { BasePlugin, PluginConfig, PluginContext, PluginLifecycle, PluginManager, PluginMetadata, PluginStatus } from '
|
|
6
|
+
export { B as BasePlugin, P as PluginConfig, a as PluginContext, c as PluginLifecycle, e as PluginManager, b as PluginMetadata, d as PluginStatus } from '../../shared/conduithub.DSAmRivG.js';
|
|
7
7
|
import 'zod';
|
package/dist/index.cjs
CHANGED
|
@@ -1,33 +1,178 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const node_fs = require('node:fs');
|
|
4
|
+
const fs = require('node:fs/promises');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
const error_index = require('./error/index.cjs');
|
|
7
|
+
const json = require('./shared/conduithub.DQO1dRnn.cjs');
|
|
8
|
+
const logger = require('./shared/conduithub.BNQsddJO.cjs');
|
|
9
|
+
const code = require('./shared/conduithub.CmZo_Vuc.cjs');
|
|
10
|
+
const schema = require('./shared/conduithub.jH-df3Zd.cjs');
|
|
11
|
+
const core_conduitHub_index = require('./core/conduit-hub/index.cjs');
|
|
3
12
|
const core_configManager_index = require('./core/config-manager/index.cjs');
|
|
4
13
|
const core_eventBus_index = require('./core/event-bus/index.cjs');
|
|
5
14
|
const core_hook_index = require('./core/hook/index.cjs');
|
|
6
15
|
const core_plugin_index = require('./core/plugin/index.cjs');
|
|
7
16
|
const core_serviceContainer_index = require('./core/service-container/index.cjs');
|
|
8
17
|
const core_stateManager_index = require('./core/state-manager/index.cjs');
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const logger = require('./shared/conduithub.BNQsddJO.cjs');
|
|
18
|
+
const plugin = require('./shared/conduithub.0FKJet8c.cjs');
|
|
19
|
+
const client = require('./shared/conduithub.DhMIxMx2.cjs');
|
|
12
20
|
const packageManager = require('./shared/conduithub.Dlvl2xGE.cjs');
|
|
13
21
|
const uuid = require('./shared/conduithub.Bq_7Xj0J.cjs');
|
|
14
|
-
const plugin = require('./shared/conduithub.cvEjE62V.cjs');
|
|
15
22
|
const manager = require('./shared/conduithub.DsOOeNwU.cjs');
|
|
16
|
-
|
|
23
|
+
require('zod');
|
|
17
24
|
require('process');
|
|
18
25
|
require('readline');
|
|
19
26
|
require('uuid');
|
|
20
27
|
require('ioredis');
|
|
21
|
-
require('zod');
|
|
22
28
|
|
|
29
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
23
30
|
|
|
31
|
+
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
32
|
+
const path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
33
|
+
|
|
34
|
+
async function loadConfig(options = {}) {
|
|
35
|
+
const {
|
|
36
|
+
filePath = "./config.json",
|
|
37
|
+
envPrefix = "CONDUIT_",
|
|
38
|
+
defaults = {},
|
|
39
|
+
schema,
|
|
40
|
+
override = {}
|
|
41
|
+
} = options;
|
|
42
|
+
let config = { ...defaults };
|
|
43
|
+
try {
|
|
44
|
+
const fileConfig = await loadConfigFromFile(filePath);
|
|
45
|
+
config = mergeConfigs(config, fileConfig);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
handleConfigLoadError(error, filePath);
|
|
48
|
+
}
|
|
49
|
+
const envConfig = loadConfigFromEnv(envPrefix);
|
|
50
|
+
config = mergeConfigs(config, envConfig, override);
|
|
51
|
+
if (schema) {
|
|
52
|
+
return validateConfigWithSchema(config, schema);
|
|
53
|
+
}
|
|
54
|
+
return config;
|
|
55
|
+
}
|
|
56
|
+
function handleConfigLoadError(error, filePath) {
|
|
57
|
+
if (error instanceof Error && error.code !== "ENOENT") {
|
|
58
|
+
logger.logger.warn(`Could not load config file ${filePath}:`, error.message);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function validateConfigWithSchema(config, schema) {
|
|
62
|
+
const result = schema.safeParse(config);
|
|
63
|
+
if (!result.success) {
|
|
64
|
+
throw new error_index.ConduithubError(
|
|
65
|
+
`${code.ERROR_CODE.INVALID_CONFIG}: ${result.error.message}`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return result.data;
|
|
69
|
+
}
|
|
70
|
+
async function loadConfigFromFile(filePath) {
|
|
71
|
+
const absolutePath = path__default.resolve(filePath);
|
|
72
|
+
const fileContent = await fs__default.readFile(absolutePath, "utf-8");
|
|
73
|
+
try {
|
|
74
|
+
const parsed = json.parseJson(fileContent);
|
|
75
|
+
if (!parsed) {
|
|
76
|
+
throw new error_index.ConduithubError(code.ERROR_CODE.INVALID_JSON);
|
|
77
|
+
}
|
|
78
|
+
return parsed;
|
|
79
|
+
} catch (jsonError) {
|
|
80
|
+
if (filePath.endsWith(".js")) {
|
|
81
|
+
throw new error_index.ConduithubError(code.ERROR_CODE.UNSUPPORTED_CONFIG_FORMAT);
|
|
82
|
+
}
|
|
83
|
+
throw jsonError;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function loadConfigFromEnv(prefix) {
|
|
87
|
+
const config = {};
|
|
88
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
89
|
+
if (key.startsWith(prefix) && value !== void 0) {
|
|
90
|
+
const configKey = key.slice(prefix.length);
|
|
91
|
+
const nestedKey = configKey.replace(/__/g, ".");
|
|
92
|
+
const typedValue = convertEnvValue(value);
|
|
93
|
+
setNestedValue(config, nestedKey.toLowerCase(), typedValue);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return config;
|
|
97
|
+
}
|
|
98
|
+
function convertEnvValue(value) {
|
|
99
|
+
try {
|
|
100
|
+
return JSON.parse(value);
|
|
101
|
+
} catch {
|
|
102
|
+
return convertPrimitiveValue(value);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function convertPrimitiveValue(value) {
|
|
106
|
+
const lower = value.toLowerCase();
|
|
107
|
+
if (lower === "true") return true;
|
|
108
|
+
if (lower === "false") return false;
|
|
109
|
+
if (lower === "null") return null;
|
|
110
|
+
if (lower === "undefined") return void 0;
|
|
111
|
+
if (/^-?\d+$/.test(value)) return parseInt(value, 10);
|
|
112
|
+
if (/^-?\d+\.\d+$/.test(value)) return parseFloat(value);
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
function setNestedValue(obj, path2, value) {
|
|
116
|
+
const keys = path2.split(".");
|
|
117
|
+
let current = obj;
|
|
118
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
119
|
+
const key = keys[i];
|
|
120
|
+
if (!(key in current) || typeof current[key] !== "object" || current[key] === null) {
|
|
121
|
+
current[key] = {};
|
|
122
|
+
}
|
|
123
|
+
current = current[key];
|
|
124
|
+
}
|
|
125
|
+
current[keys[keys.length - 1]] = value;
|
|
126
|
+
}
|
|
127
|
+
function createConfigLoader(schema) {
|
|
128
|
+
return async (options = {}) => {
|
|
129
|
+
return loadConfig({
|
|
130
|
+
...options,
|
|
131
|
+
schema
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function validateConfig(config, schema) {
|
|
136
|
+
const result = schema.safeParse(config);
|
|
137
|
+
if (!result.success) {
|
|
138
|
+
throw new error_index.ConduithubError(
|
|
139
|
+
`${code.ERROR_CODE.INVALID_CONFIG}: ${result.error.message}`
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
return result.data;
|
|
143
|
+
}
|
|
144
|
+
function mergeConfigs(...configs) {
|
|
145
|
+
return configs.reduce((merged, config) => deepMerge(merged, config), {});
|
|
146
|
+
}
|
|
147
|
+
function deepMerge(target, source) {
|
|
148
|
+
if (!isObject(target) || !isObject(source)) {
|
|
149
|
+
return source;
|
|
150
|
+
}
|
|
151
|
+
const result = { ...target };
|
|
152
|
+
for (const [key, sourceValue] of Object.entries(source)) {
|
|
153
|
+
const targetValue = result[key];
|
|
154
|
+
if (isObject(sourceValue) && !Array.isArray(sourceValue)) {
|
|
155
|
+
result[key] = deepMerge(targetValue, sourceValue);
|
|
156
|
+
} else {
|
|
157
|
+
result[key] = sourceValue;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
function isObject(value) {
|
|
163
|
+
return typeof value === "object" && value !== null;
|
|
164
|
+
}
|
|
165
|
+
function getConfigFilePath(configName, configDir = "./config") {
|
|
166
|
+
const possibleExtensions = [".json", ".js", ".ts"];
|
|
167
|
+
for (const ext of possibleExtensions) {
|
|
168
|
+
const filePath = path__default.join(configDir, `${configName}${ext}`);
|
|
169
|
+
if (node_fs.existsSync(filePath)) {
|
|
170
|
+
return filePath;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return path__default.join(configDir, `${configName}.json`);
|
|
174
|
+
}
|
|
24
175
|
|
|
25
|
-
exports.ConfigManager = core_configManager_index.ConfigManager;
|
|
26
|
-
exports.EventBus = core_eventBus_index.EventBus;
|
|
27
|
-
exports.Hook = core_hook_index.Hook;
|
|
28
|
-
exports.BasePlugin = core_plugin_index.BasePlugin;
|
|
29
|
-
exports.ServiceContainer = core_serviceContainer_index.ServiceContainer;
|
|
30
|
-
exports.StateManager = core_stateManager_index.StateManager;
|
|
31
176
|
exports.ConduithubError = error_index.ConduithubError;
|
|
32
177
|
exports.MissingDependencyError = error_index.MissingDependencyError;
|
|
33
178
|
exports.getPkgManager = error_index.getPkgManager;
|
|
@@ -39,11 +184,37 @@ exports.createLogger = logger.createLogger;
|
|
|
39
184
|
exports.levels = logger.levels;
|
|
40
185
|
exports.logger = logger.logger;
|
|
41
186
|
exports.shouldPublishLog = logger.shouldPublishLog;
|
|
187
|
+
exports.ERROR_CODE = code.ERROR_CODE;
|
|
188
|
+
exports.KafkaPluginConfigSchema = schema.KafkaPluginConfigSchema;
|
|
189
|
+
exports.conduithubConfigSchema = schema.conduithubConfigSchema;
|
|
190
|
+
exports.createConfigSchema = schema.createConfigSchema;
|
|
191
|
+
exports.extendConfigSchema = schema.extendConfigSchema;
|
|
192
|
+
exports.mergeConfigSchemas = schema.mergeConfigSchemas;
|
|
193
|
+
exports.ConduitHub = core_conduitHub_index.ConduitHub;
|
|
194
|
+
exports.ConfigManager = core_configManager_index.ConfigManager;
|
|
195
|
+
exports.EventBus = core_eventBus_index.EventBus;
|
|
196
|
+
exports.Hook = core_hook_index.Hook;
|
|
197
|
+
exports.BasePlugin = core_plugin_index.BasePlugin;
|
|
198
|
+
exports.ServiceContainer = core_serviceContainer_index.ServiceContainer;
|
|
199
|
+
exports.StateManager = core_stateManager_index.StateManager;
|
|
200
|
+
exports.KafkaPlugin = plugin.KafkaPlugin;
|
|
201
|
+
exports.getKafka = plugin.getKafka;
|
|
202
|
+
exports.initKafka = plugin.initKafka;
|
|
203
|
+
exports.kafka = plugin.kafka;
|
|
204
|
+
exports.shutdownKafka = plugin.shutdownKafka;
|
|
205
|
+
exports.RedisPlugin = client.RedisPlugin;
|
|
206
|
+
exports.getRedis = client.getRedis;
|
|
207
|
+
exports.initRedis = client.initRedis;
|
|
208
|
+
exports.redis = client.redis;
|
|
209
|
+
exports.shutdownRedis = client.shutdownRedis;
|
|
42
210
|
exports.PackageManagerUtil = packageManager.PackageManagerUtil;
|
|
43
211
|
exports.packageManagerUtil = packageManager.packageManagerUtil;
|
|
44
212
|
exports.generateShortId = uuid.generateShortId;
|
|
45
213
|
exports.generateUuid = uuid.generateUuid;
|
|
46
214
|
exports.isValidUuid = uuid.isValidUuid;
|
|
47
|
-
exports.RedisPlugin = plugin.RedisPlugin;
|
|
48
215
|
exports.PluginManager = manager.PluginManager;
|
|
49
|
-
exports.
|
|
216
|
+
exports.createConfigLoader = createConfigLoader;
|
|
217
|
+
exports.getConfigFilePath = getConfigFilePath;
|
|
218
|
+
exports.loadConfig = loadConfig;
|
|
219
|
+
exports.mergeConfigs = mergeConfigs;
|
|
220
|
+
exports.validateConfig = validateConfig;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export { ConduitHub } from './core/conduit-hub/index.cjs';
|
|
3
|
+
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';
|
|
2
4
|
export { E as EventBus } from './shared/conduithub.BZQmkQy7.cjs';
|
|
3
5
|
export { Hook, HookHandler, HookResult } from './core/hook/index.cjs';
|
|
4
6
|
export { ServiceContainer, ServiceDescriptor } from './core/service-container/index.cjs';
|
|
5
7
|
export { StateChangeHandler, StateManager } from './core/state-manager/index.cjs';
|
|
6
8
|
export { ConduithubError, ERROR_CODE, ErrorCode, MissingDependencyError, getPkgManager, setPkgManager } from './error/index.cjs';
|
|
9
|
+
export { KafkaConnectionInfo, KafkaConsumerInfo, KafkaMessage, KafkaPlugin, KafkaPluginConfig, KafkaPluginConfigSchema, KafkaStats, getKafka, initKafka, kafka, shutdownKafka } from './plugins/kafka/index.cjs';
|
|
10
|
+
export { RedisPlugin, getRedis, initRedis, redis, shutdownRedis } from './plugins/redis/index.cjs';
|
|
7
11
|
export { PackageManagerUtil, generateShortId, generateUuid, isValidUuid, packageManagerUtil, parseJson, safeStringifyJson, stringifyJson } from './utils/index.cjs';
|
|
8
12
|
export { b as LogHandlerParams, L as LogLevel, a as Logger, c as createLogger, l as levels, d as logger, s as shouldPublishLog } from './shared/conduithub.B7aryjPG.cjs';
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
import 'kafkajs';
|
|
14
|
+
|
|
15
|
+
interface ConfigLoadOptions<T = Record<string, unknown>> {
|
|
16
|
+
readonly filePath?: string;
|
|
17
|
+
readonly envPrefix?: string;
|
|
18
|
+
readonly defaults?: Record<string, unknown>;
|
|
19
|
+
readonly schema?: z.ZodSchema<T>;
|
|
20
|
+
readonly override?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
declare function loadConfig<T extends object = Record<string, unknown>>(options?: ConfigLoadOptions<T>): Promise<T>;
|
|
23
|
+
declare function createConfigLoader<T extends z.ZodRawShape>(schema: z.ZodObject<T>): (options?: Omit<ConfigLoadOptions<z.core.$InferObjectOutput<T, {}>>, "schema">) => Promise<z.core.$InferObjectOutput<T, {}>>;
|
|
24
|
+
declare function validateConfig<T>(config: unknown, schema: z.ZodSchema<T>): T;
|
|
25
|
+
declare function mergeConfigs(...configs: Record<string, unknown>[]): Record<string, unknown>;
|
|
26
|
+
declare function getConfigFilePath(configName: string, configDir?: string): string;
|
|
27
|
+
|
|
28
|
+
declare const conduithubConfigSchema: z.ZodObject<{
|
|
29
|
+
logLevel: z.ZodDefault<z.ZodEnum<{
|
|
30
|
+
info: "info";
|
|
31
|
+
warn: "warn";
|
|
32
|
+
error: "error";
|
|
33
|
+
debug: "debug";
|
|
34
|
+
}>>;
|
|
35
|
+
autoEnable: z.ZodDefault<z.ZodBoolean>;
|
|
36
|
+
strictMode: z.ZodDefault<z.ZodBoolean>;
|
|
37
|
+
enableHotReload: z.ZodDefault<z.ZodBoolean>;
|
|
38
|
+
plugins: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
39
|
+
redis: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
host: z.ZodDefault<z.ZodString>;
|
|
41
|
+
port: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
password: z.ZodOptional<z.ZodString>;
|
|
43
|
+
db: z.ZodDefault<z.ZodNumber>;
|
|
44
|
+
username: z.ZodOptional<z.ZodString>;
|
|
45
|
+
url: z.ZodOptional<z.ZodString>;
|
|
46
|
+
keyPrefix: z.ZodOptional<z.ZodString>;
|
|
47
|
+
tls: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
ca: z.ZodOptional<z.ZodString>;
|
|
49
|
+
cert: z.ZodOptional<z.ZodString>;
|
|
50
|
+
key: z.ZodOptional<z.ZodString>;
|
|
51
|
+
rejectUnauthorized: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
connectionTimeout: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
commandTimeout: z.ZodDefault<z.ZodNumber>;
|
|
55
|
+
maxRetriesPerRequest: z.ZodDefault<z.ZodNumber>;
|
|
56
|
+
retryDelayOnFailover: z.ZodDefault<z.ZodNumber>;
|
|
57
|
+
enableReadyCheck: z.ZodDefault<z.ZodBoolean>;
|
|
58
|
+
enableOfflineQueue: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
+
keepAlive: z.ZodDefault<z.ZodBoolean>;
|
|
60
|
+
lazyConnect: z.ZodDefault<z.ZodBoolean>;
|
|
61
|
+
family: z.ZodDefault<z.ZodEnum<{
|
|
62
|
+
IPv4: "IPv4";
|
|
63
|
+
IPv6: "IPv6";
|
|
64
|
+
}>>;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
declare function createConfigSchema<T extends z.ZodRawShape>(shape: T): z.ZodObject<{ -readonly [P in keyof T]: T[P]; }, z.core.$strip>;
|
|
68
|
+
declare function extendConfigSchema<T extends z.ZodRawShape>(baseSchema: z.ZodObject<T>, extensions: T): z.ZodObject<(keyof T extends never ? T : { [K in keyof T as K extends keyof T ? never : K]: T[K]; } & { [K_1 in keyof T]: T[K_1]; }) extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.core.$strip>;
|
|
69
|
+
declare function mergeConfigSchemas(...schemas: z.ZodObject<z.ZodRawShape>[]): z.ZodObject<Readonly<{
|
|
70
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
71
|
+
}>, z.core.$strip>;
|
|
72
|
+
|
|
73
|
+
export { conduithubConfigSchema, createConfigLoader, createConfigSchema, extendConfigSchema, getConfigFilePath, loadConfig, mergeConfigSchemas, mergeConfigs, validateConfig };
|
|
74
|
+
export type { ConfigLoadOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export { ConduitHub } from './core/conduit-hub/index.mjs';
|
|
3
|
+
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';
|
|
2
4
|
export { E as EventBus } from './shared/conduithub.BzLwccre.mjs';
|
|
3
5
|
export { Hook, HookHandler, HookResult } from './core/hook/index.mjs';
|
|
4
6
|
export { ServiceContainer, ServiceDescriptor } from './core/service-container/index.mjs';
|
|
5
7
|
export { StateChangeHandler, StateManager } from './core/state-manager/index.mjs';
|
|
6
8
|
export { ConduithubError, ERROR_CODE, ErrorCode, MissingDependencyError, getPkgManager, setPkgManager } from './error/index.mjs';
|
|
9
|
+
export { KafkaConnectionInfo, KafkaConsumerInfo, KafkaMessage, KafkaPlugin, KafkaPluginConfig, KafkaPluginConfigSchema, KafkaStats, getKafka, initKafka, kafka, shutdownKafka } from './plugins/kafka/index.mjs';
|
|
10
|
+
export { RedisPlugin, getRedis, initRedis, redis, shutdownRedis } from './plugins/redis/index.mjs';
|
|
7
11
|
export { PackageManagerUtil, generateShortId, generateUuid, isValidUuid, packageManagerUtil, parseJson, safeStringifyJson, stringifyJson } from './utils/index.mjs';
|
|
8
12
|
export { b as LogHandlerParams, L as LogLevel, a as Logger, c as createLogger, l as levels, d as logger, s as shouldPublishLog } from './shared/conduithub.B7aryjPG.mjs';
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
import 'kafkajs';
|
|
14
|
+
|
|
15
|
+
interface ConfigLoadOptions<T = Record<string, unknown>> {
|
|
16
|
+
readonly filePath?: string;
|
|
17
|
+
readonly envPrefix?: string;
|
|
18
|
+
readonly defaults?: Record<string, unknown>;
|
|
19
|
+
readonly schema?: z.ZodSchema<T>;
|
|
20
|
+
readonly override?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
declare function loadConfig<T extends object = Record<string, unknown>>(options?: ConfigLoadOptions<T>): Promise<T>;
|
|
23
|
+
declare function createConfigLoader<T extends z.ZodRawShape>(schema: z.ZodObject<T>): (options?: Omit<ConfigLoadOptions<z.core.$InferObjectOutput<T, {}>>, "schema">) => Promise<z.core.$InferObjectOutput<T, {}>>;
|
|
24
|
+
declare function validateConfig<T>(config: unknown, schema: z.ZodSchema<T>): T;
|
|
25
|
+
declare function mergeConfigs(...configs: Record<string, unknown>[]): Record<string, unknown>;
|
|
26
|
+
declare function getConfigFilePath(configName: string, configDir?: string): string;
|
|
27
|
+
|
|
28
|
+
declare const conduithubConfigSchema: z.ZodObject<{
|
|
29
|
+
logLevel: z.ZodDefault<z.ZodEnum<{
|
|
30
|
+
info: "info";
|
|
31
|
+
warn: "warn";
|
|
32
|
+
error: "error";
|
|
33
|
+
debug: "debug";
|
|
34
|
+
}>>;
|
|
35
|
+
autoEnable: z.ZodDefault<z.ZodBoolean>;
|
|
36
|
+
strictMode: z.ZodDefault<z.ZodBoolean>;
|
|
37
|
+
enableHotReload: z.ZodDefault<z.ZodBoolean>;
|
|
38
|
+
plugins: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
39
|
+
redis: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
host: z.ZodDefault<z.ZodString>;
|
|
41
|
+
port: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
password: z.ZodOptional<z.ZodString>;
|
|
43
|
+
db: z.ZodDefault<z.ZodNumber>;
|
|
44
|
+
username: z.ZodOptional<z.ZodString>;
|
|
45
|
+
url: z.ZodOptional<z.ZodString>;
|
|
46
|
+
keyPrefix: z.ZodOptional<z.ZodString>;
|
|
47
|
+
tls: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
ca: z.ZodOptional<z.ZodString>;
|
|
49
|
+
cert: z.ZodOptional<z.ZodString>;
|
|
50
|
+
key: z.ZodOptional<z.ZodString>;
|
|
51
|
+
rejectUnauthorized: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
connectionTimeout: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
commandTimeout: z.ZodDefault<z.ZodNumber>;
|
|
55
|
+
maxRetriesPerRequest: z.ZodDefault<z.ZodNumber>;
|
|
56
|
+
retryDelayOnFailover: z.ZodDefault<z.ZodNumber>;
|
|
57
|
+
enableReadyCheck: z.ZodDefault<z.ZodBoolean>;
|
|
58
|
+
enableOfflineQueue: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
+
keepAlive: z.ZodDefault<z.ZodBoolean>;
|
|
60
|
+
lazyConnect: z.ZodDefault<z.ZodBoolean>;
|
|
61
|
+
family: z.ZodDefault<z.ZodEnum<{
|
|
62
|
+
IPv4: "IPv4";
|
|
63
|
+
IPv6: "IPv6";
|
|
64
|
+
}>>;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
declare function createConfigSchema<T extends z.ZodRawShape>(shape: T): z.ZodObject<{ -readonly [P in keyof T]: T[P]; }, z.core.$strip>;
|
|
68
|
+
declare function extendConfigSchema<T extends z.ZodRawShape>(baseSchema: z.ZodObject<T>, extensions: T): z.ZodObject<(keyof T extends never ? T : { [K in keyof T as K extends keyof T ? never : K]: T[K]; } & { [K_1 in keyof T]: T[K_1]; }) extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.core.$strip>;
|
|
69
|
+
declare function mergeConfigSchemas(...schemas: z.ZodObject<z.ZodRawShape>[]): z.ZodObject<Readonly<{
|
|
70
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
71
|
+
}>, z.core.$strip>;
|
|
72
|
+
|
|
73
|
+
export { conduithubConfigSchema, createConfigLoader, createConfigSchema, extendConfigSchema, getConfigFilePath, loadConfig, mergeConfigSchemas, mergeConfigs, validateConfig };
|
|
74
|
+
export type { ConfigLoadOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export { ConduitHub } from './core/conduit-hub/index.js';
|
|
3
|
+
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.DSAmRivG.js';
|
|
2
4
|
export { E as EventBus } from './shared/conduithub.DQOWQ-Bx.js';
|
|
3
5
|
export { Hook, HookHandler, HookResult } from './core/hook/index.js';
|
|
4
6
|
export { ServiceContainer, ServiceDescriptor } from './core/service-container/index.js';
|
|
5
7
|
export { StateChangeHandler, StateManager } from './core/state-manager/index.js';
|
|
6
8
|
export { ConduithubError, ERROR_CODE, ErrorCode, MissingDependencyError, getPkgManager, setPkgManager } from './error/index.js';
|
|
9
|
+
export { KafkaConnectionInfo, KafkaConsumerInfo, KafkaMessage, KafkaPlugin, KafkaPluginConfig, KafkaPluginConfigSchema, KafkaStats, getKafka, initKafka, kafka, shutdownKafka } from './plugins/kafka/index.js';
|
|
10
|
+
export { RedisPlugin, getRedis, initRedis, redis, shutdownRedis } from './plugins/redis/index.js';
|
|
7
11
|
export { PackageManagerUtil, generateShortId, generateUuid, isValidUuid, packageManagerUtil, parseJson, safeStringifyJson, stringifyJson } from './utils/index.js';
|
|
8
12
|
export { b as LogHandlerParams, L as LogLevel, a as Logger, c as createLogger, l as levels, d as logger, s as shouldPublishLog } from './shared/conduithub.B7aryjPG.js';
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
import 'kafkajs';
|
|
14
|
+
|
|
15
|
+
interface ConfigLoadOptions<T = Record<string, unknown>> {
|
|
16
|
+
readonly filePath?: string;
|
|
17
|
+
readonly envPrefix?: string;
|
|
18
|
+
readonly defaults?: Record<string, unknown>;
|
|
19
|
+
readonly schema?: z.ZodSchema<T>;
|
|
20
|
+
readonly override?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
declare function loadConfig<T extends object = Record<string, unknown>>(options?: ConfigLoadOptions<T>): Promise<T>;
|
|
23
|
+
declare function createConfigLoader<T extends z.ZodRawShape>(schema: z.ZodObject<T>): (options?: Omit<ConfigLoadOptions<z.core.$InferObjectOutput<T, {}>>, "schema">) => Promise<z.core.$InferObjectOutput<T, {}>>;
|
|
24
|
+
declare function validateConfig<T>(config: unknown, schema: z.ZodSchema<T>): T;
|
|
25
|
+
declare function mergeConfigs(...configs: Record<string, unknown>[]): Record<string, unknown>;
|
|
26
|
+
declare function getConfigFilePath(configName: string, configDir?: string): string;
|
|
27
|
+
|
|
28
|
+
declare const conduithubConfigSchema: z.ZodObject<{
|
|
29
|
+
logLevel: z.ZodDefault<z.ZodEnum<{
|
|
30
|
+
info: "info";
|
|
31
|
+
warn: "warn";
|
|
32
|
+
error: "error";
|
|
33
|
+
debug: "debug";
|
|
34
|
+
}>>;
|
|
35
|
+
autoEnable: z.ZodDefault<z.ZodBoolean>;
|
|
36
|
+
strictMode: z.ZodDefault<z.ZodBoolean>;
|
|
37
|
+
enableHotReload: z.ZodDefault<z.ZodBoolean>;
|
|
38
|
+
plugins: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
39
|
+
redis: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
host: z.ZodDefault<z.ZodString>;
|
|
41
|
+
port: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
password: z.ZodOptional<z.ZodString>;
|
|
43
|
+
db: z.ZodDefault<z.ZodNumber>;
|
|
44
|
+
username: z.ZodOptional<z.ZodString>;
|
|
45
|
+
url: z.ZodOptional<z.ZodString>;
|
|
46
|
+
keyPrefix: z.ZodOptional<z.ZodString>;
|
|
47
|
+
tls: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
ca: z.ZodOptional<z.ZodString>;
|
|
49
|
+
cert: z.ZodOptional<z.ZodString>;
|
|
50
|
+
key: z.ZodOptional<z.ZodString>;
|
|
51
|
+
rejectUnauthorized: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
connectionTimeout: z.ZodDefault<z.ZodNumber>;
|
|
54
|
+
commandTimeout: z.ZodDefault<z.ZodNumber>;
|
|
55
|
+
maxRetriesPerRequest: z.ZodDefault<z.ZodNumber>;
|
|
56
|
+
retryDelayOnFailover: z.ZodDefault<z.ZodNumber>;
|
|
57
|
+
enableReadyCheck: z.ZodDefault<z.ZodBoolean>;
|
|
58
|
+
enableOfflineQueue: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
+
keepAlive: z.ZodDefault<z.ZodBoolean>;
|
|
60
|
+
lazyConnect: z.ZodDefault<z.ZodBoolean>;
|
|
61
|
+
family: z.ZodDefault<z.ZodEnum<{
|
|
62
|
+
IPv4: "IPv4";
|
|
63
|
+
IPv6: "IPv6";
|
|
64
|
+
}>>;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
declare function createConfigSchema<T extends z.ZodRawShape>(shape: T): z.ZodObject<{ -readonly [P in keyof T]: T[P]; }, z.core.$strip>;
|
|
68
|
+
declare function extendConfigSchema<T extends z.ZodRawShape>(baseSchema: z.ZodObject<T>, extensions: T): z.ZodObject<(keyof T extends never ? T : { [K in keyof T as K extends keyof T ? never : K]: T[K]; } & { [K_1 in keyof T]: T[K_1]; }) extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.core.$strip>;
|
|
69
|
+
declare function mergeConfigSchemas(...schemas: z.ZodObject<z.ZodRawShape>[]): z.ZodObject<Readonly<{
|
|
70
|
+
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
71
|
+
}>, z.core.$strip>;
|
|
72
|
+
|
|
73
|
+
export { conduithubConfigSchema, createConfigLoader, createConfigSchema, extendConfigSchema, getConfigFilePath, loadConfig, mergeConfigSchemas, mergeConfigs, validateConfig };
|
|
74
|
+
export type { ConfigLoadOptions };
|