@exaudeus/workrail 0.0.17 → 0.0.18
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/LICENSE +21 -0
- package/README.md +9 -9
- package/dist/application/app.d.ts +0 -7
- package/dist/application/app.js +1 -18
- package/dist/application/services/enhanced-error-service.d.ts +0 -64
- package/dist/application/services/enhanced-error-service.js +11 -82
- package/dist/application/services/validation-engine.d.ts +0 -65
- package/dist/application/services/validation-engine.js +5 -91
- package/dist/application/services/workflow-service.d.ts +0 -11
- package/dist/application/services/workflow-service.js +0 -17
- package/dist/application/use-cases/get-next-step.d.ts +0 -9
- package/dist/application/use-cases/get-next-step.js +0 -9
- package/dist/application/use-cases/get-workflow.d.ts +0 -9
- package/dist/application/use-cases/get-workflow.js +0 -17
- package/dist/application/use-cases/list-workflows.d.ts +0 -9
- package/dist/application/use-cases/list-workflows.js +0 -9
- package/dist/application/use-cases/validate-step-output.d.ts +0 -9
- package/dist/application/use-cases/validate-step-output.js +0 -9
- package/dist/application/use-cases/validate-workflow-json.d.ts +0 -12
- package/dist/application/use-cases/validate-workflow-json.js +0 -21
- package/dist/application/validation.d.ts +0 -1
- package/dist/application/validation.js +6 -5
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +7 -12
- package/dist/container.d.ts +0 -11
- package/dist/container.js +0 -6
- package/dist/core/error-handler.d.ts +0 -43
- package/dist/core/error-handler.js +0 -65
- package/dist/domain/index.d.ts +0 -1
- package/dist/domain/index.js +16 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2
- package/dist/infrastructure/index.d.ts +0 -1
- package/dist/infrastructure/index.js +16 -4
- package/dist/infrastructure/rpc/handler.d.ts +0 -9
- package/dist/infrastructure/rpc/handler.js +3 -16
- package/dist/infrastructure/rpc/index.d.ts +0 -1
- package/dist/infrastructure/rpc/index.js +15 -3
- package/dist/infrastructure/rpc/server.d.ts +0 -1
- package/dist/infrastructure/rpc/server.js +0 -3
- package/dist/infrastructure/storage/caching-workflow-storage.d.ts +0 -4
- package/dist/infrastructure/storage/caching-workflow-storage.js +2 -9
- package/dist/infrastructure/storage/file-workflow-storage.d.ts +0 -28
- package/dist/infrastructure/storage/file-workflow-storage.js +14 -57
- package/dist/infrastructure/storage/git-workflow-storage.d.ts +0 -14
- package/dist/infrastructure/storage/git-workflow-storage.js +19 -51
- package/dist/infrastructure/storage/in-memory-storage.d.ts +0 -6
- package/dist/infrastructure/storage/in-memory-storage.js +0 -7
- package/dist/infrastructure/storage/index.d.ts +0 -1
- package/dist/infrastructure/storage/index.js +19 -7
- package/dist/infrastructure/storage/multi-directory-workflow-storage.d.ts +0 -18
- package/dist/infrastructure/storage/multi-directory-workflow-storage.js +7 -36
- package/dist/infrastructure/storage/plugin-workflow-storage.d.ts +0 -43
- package/dist/infrastructure/storage/plugin-workflow-storage.js +17 -78
- package/dist/infrastructure/storage/remote-workflow-storage.d.ts +0 -10
- package/dist/infrastructure/storage/remote-workflow-storage.js +6 -39
- package/dist/infrastructure/storage/schema-validating-workflow-storage.d.ts +0 -5
- package/dist/infrastructure/storage/schema-validating-workflow-storage.js +7 -12
- package/dist/infrastructure/storage/storage.d.ts +0 -14
- package/dist/infrastructure/storage/storage.js +2 -21
- package/dist/mcp-server.d.ts +0 -1
- package/dist/mcp-server.js +2 -14
- package/dist/tools/mcp_initialize.d.ts +0 -1
- package/dist/tools/mcp_initialize.js +2 -9
- package/dist/tools/mcp_shutdown.d.ts +0 -1
- package/dist/tools/mcp_shutdown.js +0 -1
- package/dist/tools/mcp_tools_list.d.ts +0 -1
- package/dist/tools/mcp_tools_list.js +0 -1
- package/dist/types/mcp-types.d.ts +0 -1
- package/dist/types/mcp-types.js +0 -8
- package/dist/types/server.d.ts +0 -1
- package/dist/types/server.js +0 -1
- package/dist/types/storage.d.ts +0 -20
- package/dist/types/storage.js +0 -4
- package/dist/types/workflow-types.d.ts +0 -1
- package/dist/types/workflow-types.js +0 -3
- package/dist/utils/condition-evaluator.d.ts +0 -15
- package/dist/utils/condition-evaluator.js +0 -24
- package/dist/utils/config.d.ts +0 -55
- package/dist/utils/config.js +0 -84
- package/dist/utils/storage-security.d.ts +0 -62
- package/dist/utils/storage-security.js +6 -62
- package/dist/validation/request-validator.d.ts +0 -1
- package/dist/validation/request-validator.js +6 -6
- package/dist/validation/response-validator.d.ts +0 -1
- package/dist/validation/response-validator.js +4 -21
- package/dist/validation/schemas.d.ts +0 -5
- package/dist/validation/schemas.js +0 -5
- package/package.json +7 -14
- package/spec/mcp-protocol-handshake.md +4 -3
- package/workflows/coding-task-workflow.json +32 -0
- package/workflows/document-creation-workflow.json +235 -0
- package/workflows/exploration-workflow.json +254 -0
- package/workflows/presentation-creation.json +71 -0
- package/workflows/systemic-bug-investigation.json +32 -14
- package/workflows/systemic-bug-investigation.json.bak +196 -0
- package/dist/mcp-server-simple.js +0 -391
- package/dist/types/session-types.d.ts +0 -354
- package/dist/types/session-types.d.ts.map +0 -1
- package/dist/types/session-types.js +0 -89
- package/dist/types/session-types.js.map +0 -1
- package/workflows/example-agent-role-workflow.json +0 -83
package/dist/mcp-server.js
CHANGED
|
@@ -39,13 +39,11 @@ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
|
39
39
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
40
40
|
const container_js_1 = require("./container.js");
|
|
41
41
|
class WorkflowOrchestrationServer {
|
|
42
|
-
container;
|
|
43
42
|
constructor() {
|
|
44
43
|
this.container = (0, container_js_1.createAppContainer)();
|
|
45
44
|
}
|
|
46
45
|
async callWorkflowMethod(method, params) {
|
|
47
46
|
try {
|
|
48
|
-
// Use the workflow service directly
|
|
49
47
|
const { workflowService } = this.container;
|
|
50
48
|
let result;
|
|
51
49
|
switch (method) {
|
|
@@ -54,7 +52,6 @@ class WorkflowOrchestrationServer {
|
|
|
54
52
|
result = { workflows };
|
|
55
53
|
break;
|
|
56
54
|
case 'workflow_get':
|
|
57
|
-
// Import and use the get workflow use case to handle mode parameter
|
|
58
55
|
const { createGetWorkflow } = await Promise.resolve().then(() => __importStar(require('./application/use-cases/get-workflow.js')));
|
|
59
56
|
const getWorkflowUseCase = createGetWorkflow(workflowService);
|
|
60
57
|
result = await getWorkflowUseCase(params.id, params.mode);
|
|
@@ -104,7 +101,6 @@ class WorkflowOrchestrationServer {
|
|
|
104
101
|
}
|
|
105
102
|
async validateWorkflowJson(workflowJson) {
|
|
106
103
|
try {
|
|
107
|
-
// Import and use the validation use case
|
|
108
104
|
const { createValidateWorkflowJson } = await Promise.resolve().then(() => __importStar(require('./application/use-cases/validate-workflow-json.js')));
|
|
109
105
|
const validateWorkflowJsonUseCase = createValidateWorkflowJson();
|
|
110
106
|
const result = await validateWorkflowJsonUseCase(workflowJson);
|
|
@@ -132,14 +128,11 @@ class WorkflowOrchestrationServer {
|
|
|
132
128
|
}
|
|
133
129
|
async getWorkflowSchema() {
|
|
134
130
|
try {
|
|
135
|
-
// Import fs and path for schema loading
|
|
136
131
|
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
137
132
|
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
138
|
-
// Load the workflow schema
|
|
139
133
|
const schemaPath = path.resolve(__dirname, '../spec/workflow.schema.json');
|
|
140
134
|
const schemaContent = fs.readFileSync(schemaPath, 'utf-8');
|
|
141
135
|
const schema = JSON.parse(schemaContent);
|
|
142
|
-
// Add helpful metadata
|
|
143
136
|
const result = {
|
|
144
137
|
schema,
|
|
145
138
|
metadata: {
|
|
@@ -189,7 +182,6 @@ class WorkflowOrchestrationServer {
|
|
|
189
182
|
}
|
|
190
183
|
}
|
|
191
184
|
}
|
|
192
|
-
// Define the workflow orchestration tools
|
|
193
185
|
const WORKFLOW_LIST_TOOL = {
|
|
194
186
|
name: "workflow_list",
|
|
195
187
|
description: `Your primary tool for any complex or multi-step request. Call this FIRST to see if a reliable, pre-defined workflow exists, as this is the preferred method over improvisation.
|
|
@@ -334,17 +326,15 @@ const WORKFLOW_GET_SCHEMA_TOOL = {
|
|
|
334
326
|
additionalProperties: false
|
|
335
327
|
}
|
|
336
328
|
};
|
|
337
|
-
// Create and configure the MCP server
|
|
338
329
|
const server = new index_js_1.Server({
|
|
339
|
-
name: "
|
|
340
|
-
version: "0.0
|
|
330
|
+
name: "workrail-server",
|
|
331
|
+
version: "0.1.0",
|
|
341
332
|
}, {
|
|
342
333
|
capabilities: {
|
|
343
334
|
tools: {},
|
|
344
335
|
},
|
|
345
336
|
});
|
|
346
337
|
const workflowServer = new WorkflowOrchestrationServer();
|
|
347
|
-
// Register request handlers
|
|
348
338
|
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
|
|
349
339
|
tools: [
|
|
350
340
|
WORKFLOW_LIST_TOOL,
|
|
@@ -401,7 +391,6 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
|
401
391
|
};
|
|
402
392
|
}
|
|
403
393
|
});
|
|
404
|
-
// Start the server
|
|
405
394
|
async function runServer() {
|
|
406
395
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
407
396
|
await server.connect(transport);
|
|
@@ -411,4 +400,3 @@ runServer().catch((error) => {
|
|
|
411
400
|
console.error("Fatal error running server:", error);
|
|
412
401
|
process.exit(1);
|
|
413
402
|
});
|
|
414
|
-
//# sourceMappingURL=mcp-server.js.map
|
|
@@ -3,30 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initializeHandler = initializeHandler;
|
|
4
4
|
const mcp_types_1 = require("../types/mcp-types");
|
|
5
5
|
const error_handler_1 = require("../core/error-handler");
|
|
6
|
-
// Supported MCP protocol versions
|
|
7
6
|
const SUPPORTED_PROTOCOL_VERSIONS = ['2024-11-05'];
|
|
8
7
|
async function initializeHandler(request) {
|
|
9
|
-
// Validate required parameters
|
|
10
8
|
if (!request.params) {
|
|
11
9
|
throw new error_handler_1.MCPError(mcp_types_1.MCPErrorCodes.INVALID_PARAMS, 'Invalid params: params object is required');
|
|
12
10
|
}
|
|
13
11
|
const { protocolVersion, capabilities } = request.params;
|
|
14
|
-
// Validate protocolVersion is provided
|
|
15
12
|
if (!protocolVersion) {
|
|
16
13
|
throw new error_handler_1.MCPError(mcp_types_1.MCPErrorCodes.INVALID_PARAMS, 'Invalid params: protocolVersion is required');
|
|
17
14
|
}
|
|
18
|
-
// Validate capabilities is provided
|
|
19
15
|
if (!capabilities) {
|
|
20
16
|
throw new error_handler_1.MCPError(mcp_types_1.MCPErrorCodes.INVALID_PARAMS, 'Invalid params: capabilities is required');
|
|
21
17
|
}
|
|
22
|
-
// Validate protocol version is supported
|
|
23
18
|
if (!SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) {
|
|
24
19
|
throw new error_handler_1.MCPError(mcp_types_1.MCPErrorCodes.SERVER_ERROR, 'Unsupported protocol version', {
|
|
25
20
|
supportedVersions: SUPPORTED_PROTOCOL_VERSIONS,
|
|
26
21
|
requestedVersion: protocolVersion
|
|
27
22
|
});
|
|
28
23
|
}
|
|
29
|
-
// Return successful initialization response
|
|
30
24
|
return {
|
|
31
25
|
jsonrpc: '2.0',
|
|
32
26
|
id: request.id,
|
|
@@ -34,11 +28,11 @@ async function initializeHandler(request) {
|
|
|
34
28
|
protocolVersion: protocolVersion,
|
|
35
29
|
capabilities: {
|
|
36
30
|
tools: {
|
|
37
|
-
listChanged: false,
|
|
31
|
+
listChanged: false,
|
|
38
32
|
notifyProgress: false
|
|
39
33
|
},
|
|
40
34
|
resources: {
|
|
41
|
-
listChanged: false
|
|
35
|
+
listChanged: false
|
|
42
36
|
}
|
|
43
37
|
},
|
|
44
38
|
serverInfo: {
|
|
@@ -49,4 +43,3 @@ async function initializeHandler(request) {
|
|
|
49
43
|
}
|
|
50
44
|
};
|
|
51
45
|
}
|
|
52
|
-
//# sourceMappingURL=mcp_initialize.js.map
|
|
@@ -249,4 +249,3 @@ export type MCPRequest = MCPInitializeRequest | MCPToolsListRequest | MCPToolCal
|
|
|
249
249
|
export type MCPResponse = MCPInitializeResponse | MCPToolsListResponse | MCPToolCallResponse | MCPShutdownResponse;
|
|
250
250
|
export type WorkflowToolRequest = WorkflowListRequest | WorkflowGetRequest | WorkflowNextRequest | WorkflowValidateRequest;
|
|
251
251
|
export type WorkflowToolResponse = WorkflowListResponse | WorkflowGetResponse | WorkflowNextResponse | WorkflowValidateResponse;
|
|
252
|
-
//# sourceMappingURL=mcp-types.d.ts.map
|
package/dist/types/mcp-types.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// MCP Protocol Type Definitions
|
|
3
|
-
// Model Context Protocol (MCP) specification types
|
|
4
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
3
|
exports.MCPErrorCodes = void 0;
|
|
6
|
-
// =============================================================================
|
|
7
|
-
// MCP ERROR CODES
|
|
8
|
-
// =============================================================================
|
|
9
4
|
var MCPErrorCodes;
|
|
10
5
|
(function (MCPErrorCodes) {
|
|
11
|
-
// Standard JSON-RPC 2.0 error codes
|
|
12
6
|
MCPErrorCodes[MCPErrorCodes["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
|
|
13
7
|
MCPErrorCodes[MCPErrorCodes["INVALID_REQUEST"] = -32600] = "INVALID_REQUEST";
|
|
14
8
|
MCPErrorCodes[MCPErrorCodes["METHOD_NOT_FOUND"] = -32601] = "METHOD_NOT_FOUND";
|
|
15
9
|
MCPErrorCodes[MCPErrorCodes["INVALID_PARAMS"] = -32602] = "INVALID_PARAMS";
|
|
16
10
|
MCPErrorCodes[MCPErrorCodes["INTERNAL_ERROR"] = -32603] = "INTERNAL_ERROR";
|
|
17
|
-
// MCP-specific error codes (-32000 to -32099)
|
|
18
11
|
MCPErrorCodes[MCPErrorCodes["SERVER_ERROR"] = -32000] = "SERVER_ERROR";
|
|
19
12
|
MCPErrorCodes[MCPErrorCodes["WORKFLOW_NOT_FOUND"] = -32001] = "WORKFLOW_NOT_FOUND";
|
|
20
13
|
MCPErrorCodes[MCPErrorCodes["INVALID_WORKFLOW"] = -32002] = "INVALID_WORKFLOW";
|
|
@@ -24,4 +17,3 @@ var MCPErrorCodes;
|
|
|
24
17
|
MCPErrorCodes[MCPErrorCodes["STORAGE_ERROR"] = -32006] = "STORAGE_ERROR";
|
|
25
18
|
MCPErrorCodes[MCPErrorCodes["SECURITY_ERROR"] = -32007] = "SECURITY_ERROR";
|
|
26
19
|
})(MCPErrorCodes || (exports.MCPErrorCodes = MCPErrorCodes = {}));
|
|
27
|
-
//# sourceMappingURL=mcp-types.js.map
|
package/dist/types/server.d.ts
CHANGED
package/dist/types/server.js
CHANGED
package/dist/types/storage.d.ts
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
import { Workflow, WorkflowSummary } from './mcp-types';
|
|
2
|
-
/**
|
|
3
|
-
* Generic interface for any workflow storage backend.
|
|
4
|
-
* The default implementation uses the local filesystem, but additional
|
|
5
|
-
* backends (e.g., in-memory, database, remote) can implement this contract.
|
|
6
|
-
*/
|
|
7
2
|
export interface IWorkflowStorage {
|
|
8
|
-
/**
|
|
9
|
-
* Load and return all workflows available in this storage backend.
|
|
10
|
-
*/
|
|
11
3
|
loadAllWorkflows(): Promise<Workflow[]>;
|
|
12
|
-
/**
|
|
13
|
-
* Retrieve a single workflow by its unique identifier.
|
|
14
|
-
* @param id The workflow `id` field.
|
|
15
|
-
*/
|
|
16
4
|
getWorkflowById(id: string): Promise<Workflow | null>;
|
|
17
|
-
/**
|
|
18
|
-
* Return lightweight summaries for all workflows (used by `workflow_list`).
|
|
19
|
-
*/
|
|
20
5
|
listWorkflowSummaries(): Promise<WorkflowSummary[]>;
|
|
21
|
-
/**
|
|
22
|
-
* (Optional) Persist or update a workflow definition.
|
|
23
|
-
* Not used by the current read-only MVP but included for future parity.
|
|
24
|
-
*/
|
|
25
6
|
save?(workflow: Workflow): Promise<void>;
|
|
26
7
|
}
|
|
27
|
-
//# sourceMappingURL=storage.d.ts.map
|
package/dist/types/storage.js
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// =============================================================================
|
|
3
|
-
// WORKFLOW STORAGE INTERFACES
|
|
4
|
-
// =============================================================================
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
//# sourceMappingURL=storage.js.map
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Safe condition evaluator for workflow step runCondition expressions.
|
|
3
|
-
* Supports a limited set of operators to prevent code injection.
|
|
4
|
-
*/
|
|
5
1
|
export interface ConditionContext {
|
|
6
2
|
[key: string]: any;
|
|
7
3
|
}
|
|
@@ -17,16 +13,5 @@ export interface Condition {
|
|
|
17
13
|
or?: Condition[];
|
|
18
14
|
not?: Condition;
|
|
19
15
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Evaluates a condition expression against a context.
|
|
22
|
-
* Returns true if the condition passes, false otherwise.
|
|
23
|
-
* If condition is null/undefined, returns true (step is eligible).
|
|
24
|
-
* If evaluation fails, returns false (step is skipped for safety).
|
|
25
|
-
*/
|
|
26
16
|
export declare function evaluateCondition(condition: Condition | null | undefined, context?: ConditionContext): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Validates that a condition uses only supported operators.
|
|
29
|
-
* Throws an error if unsupported operators are found.
|
|
30
|
-
*/
|
|
31
17
|
export declare function validateCondition(condition: any): void;
|
|
32
|
-
//# sourceMappingURL=condition-evaluator.d.ts.map
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Safe condition evaluator for workflow step runCondition expressions.
|
|
4
|
-
* Supports a limited set of operators to prevent code injection.
|
|
5
|
-
*/
|
|
6
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
3
|
exports.evaluateCondition = evaluateCondition;
|
|
8
4
|
exports.validateCondition = validateCondition;
|
|
9
|
-
/**
|
|
10
|
-
* Evaluates a condition expression against a context.
|
|
11
|
-
* Returns true if the condition passes, false otherwise.
|
|
12
|
-
* If condition is null/undefined, returns true (step is eligible).
|
|
13
|
-
* If evaluation fails, returns false (step is skipped for safety).
|
|
14
|
-
*/
|
|
15
5
|
function evaluateCondition(condition, context = {}) {
|
|
16
|
-
// No condition means step is always eligible
|
|
17
6
|
if (!condition || typeof condition !== 'object') {
|
|
18
7
|
return true;
|
|
19
8
|
}
|
|
20
|
-
// Empty object means no condition, so step is eligible
|
|
21
9
|
if (Object.keys(condition).length === 0) {
|
|
22
10
|
return true;
|
|
23
11
|
}
|
|
@@ -25,16 +13,13 @@ function evaluateCondition(condition, context = {}) {
|
|
|
25
13
|
return evaluateConditionUnsafe(condition, context);
|
|
26
14
|
}
|
|
27
15
|
catch (error) {
|
|
28
|
-
// Log error in production, but return false for safety
|
|
29
16
|
console.warn('Condition evaluation failed:', error);
|
|
30
17
|
return false;
|
|
31
18
|
}
|
|
32
19
|
}
|
|
33
20
|
function evaluateConditionUnsafe(condition, context) {
|
|
34
|
-
// Variable reference
|
|
35
21
|
if (condition.var !== undefined) {
|
|
36
22
|
const value = context[condition.var];
|
|
37
|
-
// Comparison operators
|
|
38
23
|
if (condition.equals !== undefined) {
|
|
39
24
|
return value === condition.equals;
|
|
40
25
|
}
|
|
@@ -53,10 +38,8 @@ function evaluateConditionUnsafe(condition, context) {
|
|
|
53
38
|
if (condition.lte !== undefined) {
|
|
54
39
|
return typeof value === 'number' && value <= condition.lte;
|
|
55
40
|
}
|
|
56
|
-
// If only var is specified, check for truthiness
|
|
57
41
|
return !!value;
|
|
58
42
|
}
|
|
59
|
-
// Logical operators
|
|
60
43
|
if (condition.and !== undefined) {
|
|
61
44
|
if (!Array.isArray(condition.and)) {
|
|
62
45
|
throw new Error('and operator requires an array');
|
|
@@ -72,13 +55,8 @@ function evaluateConditionUnsafe(condition, context) {
|
|
|
72
55
|
if (condition.not !== undefined) {
|
|
73
56
|
return !evaluateConditionUnsafe(condition.not, context);
|
|
74
57
|
}
|
|
75
|
-
// Unknown condition format
|
|
76
58
|
throw new Error('Invalid condition format');
|
|
77
59
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Validates that a condition uses only supported operators.
|
|
80
|
-
* Throws an error if unsupported operators are found.
|
|
81
|
-
*/
|
|
82
60
|
function validateCondition(condition) {
|
|
83
61
|
if (!condition || typeof condition !== 'object') {
|
|
84
62
|
return;
|
|
@@ -91,7 +69,6 @@ function validateCondition(condition) {
|
|
|
91
69
|
if (unsupportedKeys.length > 0) {
|
|
92
70
|
throw new Error(`Unsupported condition operators: ${unsupportedKeys.join(', ')}`);
|
|
93
71
|
}
|
|
94
|
-
// Recursively validate nested conditions
|
|
95
72
|
if (condition.and && Array.isArray(condition.and)) {
|
|
96
73
|
condition.and.forEach(validateCondition);
|
|
97
74
|
}
|
|
@@ -102,4 +79,3 @@ function validateCondition(condition) {
|
|
|
102
79
|
validateCondition(condition.not);
|
|
103
80
|
}
|
|
104
81
|
}
|
|
105
|
-
//# sourceMappingURL=condition-evaluator.js.map
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -120,85 +120,30 @@ export declare class Configuration {
|
|
|
120
120
|
private config;
|
|
121
121
|
private constructor();
|
|
122
122
|
static getInstance(): Configuration;
|
|
123
|
-
/**
|
|
124
|
-
* Load and validate configuration from environment variables
|
|
125
|
-
*/
|
|
126
123
|
private loadConfiguration;
|
|
127
|
-
/**
|
|
128
|
-
* Get the complete configuration object
|
|
129
|
-
*/
|
|
130
124
|
getConfig(): z.infer<typeof configSchema>;
|
|
131
|
-
/**
|
|
132
|
-
* Get server configuration
|
|
133
|
-
*/
|
|
134
125
|
getServerConfig(): ServerConfig;
|
|
135
|
-
/**
|
|
136
|
-
* Get a specific configuration value
|
|
137
|
-
*/
|
|
138
126
|
get<K extends keyof z.infer<typeof configSchema>>(key: K): z.infer<typeof configSchema>[K];
|
|
139
|
-
/**
|
|
140
|
-
* Check if running in development mode
|
|
141
|
-
*/
|
|
142
127
|
isDevelopment(): boolean;
|
|
143
|
-
/**
|
|
144
|
-
* Check if running in production mode
|
|
145
|
-
*/
|
|
146
128
|
isProduction(): boolean;
|
|
147
|
-
/**
|
|
148
|
-
* Check if running in test mode
|
|
149
|
-
*/
|
|
150
129
|
isTest(): boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Check if debug mode is enabled
|
|
153
|
-
*/
|
|
154
130
|
isDebugEnabled(): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Check if metrics are enabled
|
|
157
|
-
*/
|
|
158
131
|
isMetricsEnabled(): boolean;
|
|
159
|
-
/**
|
|
160
|
-
* Get CORS origins as array
|
|
161
|
-
*/
|
|
162
132
|
getCorsOrigins(): string[];
|
|
163
|
-
/**
|
|
164
|
-
* Get memory limit in bytes
|
|
165
|
-
*/
|
|
166
133
|
getMemoryLimitBytes(): number;
|
|
167
|
-
/**
|
|
168
|
-
* Validate configuration for specific features
|
|
169
|
-
*/
|
|
170
134
|
validateFeatureConfig(feature: string): {
|
|
171
135
|
valid: boolean;
|
|
172
136
|
errors: string[];
|
|
173
137
|
};
|
|
174
|
-
/**
|
|
175
|
-
* Get configuration summary for logging
|
|
176
|
-
*/
|
|
177
138
|
getConfigSummary(): Record<string, any>;
|
|
178
|
-
/**
|
|
179
|
-
* Reload configuration (useful for testing)
|
|
180
|
-
*/
|
|
181
139
|
reload(): void;
|
|
182
140
|
}
|
|
183
141
|
export declare const config: Configuration;
|
|
184
|
-
/**
|
|
185
|
-
* Get configuration value with type safety
|
|
186
|
-
*/
|
|
187
142
|
export declare function getConfig<K extends keyof z.infer<typeof configSchema>>(key: K): z.infer<typeof configSchema>[K];
|
|
188
|
-
/**
|
|
189
|
-
* Check if feature is enabled
|
|
190
|
-
*/
|
|
191
143
|
export declare function isFeatureEnabled(feature: string): boolean;
|
|
192
|
-
/**
|
|
193
|
-
* Validate all configuration
|
|
194
|
-
*/
|
|
195
144
|
export declare function validateConfiguration(): {
|
|
196
145
|
valid: boolean;
|
|
197
146
|
errors: string[];
|
|
198
147
|
};
|
|
199
|
-
/**
|
|
200
|
-
* Print configuration summary
|
|
201
|
-
*/
|
|
202
148
|
export declare function printConfigSummary(): void;
|
|
203
149
|
export {};
|
|
204
|
-
//# sourceMappingURL=config.d.ts.map
|