apcore-js 0.4.0 → 0.6.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/acl.d.ts +27 -0
- package/dist/acl.d.ts.map +1 -0
- package/dist/acl.js +175 -0
- package/dist/acl.js.map +1 -0
- package/dist/async-task.d.ts +90 -0
- package/dist/async-task.d.ts.map +1 -0
- package/dist/async-task.js +215 -0
- package/dist/async-task.js.map +1 -0
- package/dist/bindings.d.ts +12 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +185 -0
- package/dist/bindings.js.map +1 -0
- package/dist/cancel.d.ts +14 -0
- package/dist/cancel.d.ts.map +1 -0
- package/dist/cancel.js +27 -0
- package/dist/cancel.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +50 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +87 -0
- package/dist/context.js.map +1 -0
- package/dist/decorator.d.ts +57 -0
- package/dist/decorator.d.ts.map +1 -0
- package/dist/decorator.js +74 -0
- package/dist/decorator.js.map +1 -0
- package/dist/errors.d.ts +215 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +246 -0
- package/dist/errors.js.map +1 -0
- package/dist/executor.d.ts +67 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +372 -0
- package/dist/executor.js.map +1 -0
- package/dist/extensions.d.ts +58 -0
- package/dist/extensions.d.ts.map +1 -0
- package/dist/extensions.js +220 -0
- package/dist/extensions.js.map +1 -0
- package/{src/index.ts → dist/index.d.ts} +14 -59
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/adapters.d.ts +18 -0
- package/dist/middleware/adapters.d.ts.map +1 -0
- package/dist/middleware/adapters.js +25 -0
- package/dist/middleware/adapters.js.map +1 -0
- package/dist/middleware/base.d.ts +10 -0
- package/dist/middleware/base.d.ts.map +1 -0
- package/dist/middleware/base.js +15 -0
- package/dist/middleware/base.js.map +1 -0
- package/{src/middleware/index.ts → dist/middleware/index.d.ts} +1 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +5 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/logging.d.ts +25 -0
- package/dist/middleware/logging.d.ts.map +1 -0
- package/dist/middleware/logging.js +64 -0
- package/dist/middleware/logging.js.map +1 -0
- package/dist/middleware/manager.d.ts +21 -0
- package/dist/middleware/manager.d.ts.map +1 -0
- package/dist/middleware/manager.js +77 -0
- package/dist/middleware/manager.js.map +1 -0
- package/dist/module.d.ts +31 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +12 -0
- package/dist/module.js.map +1 -0
- package/dist/observability/context-logger.d.ts +54 -0
- package/dist/observability/context-logger.d.ts.map +1 -0
- package/dist/observability/context-logger.js +151 -0
- package/dist/observability/context-logger.js.map +1 -0
- package/{src/observability/index.ts → dist/observability/index.d.ts} +1 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +4 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/metrics.d.ts +30 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +177 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/observability/tracing.d.ts +62 -0
- package/dist/observability/tracing.d.ts.map +1 -0
- package/dist/observability/tracing.js +184 -0
- package/dist/observability/tracing.js.map +1 -0
- package/dist/registry/dependencies.d.ts +6 -0
- package/dist/registry/dependencies.d.ts.map +1 -0
- package/dist/registry/dependencies.js +83 -0
- package/dist/registry/dependencies.js.map +1 -0
- package/dist/registry/entry-point.d.ts +6 -0
- package/dist/registry/entry-point.d.ts.map +1 -0
- package/dist/registry/entry-point.js +55 -0
- package/dist/registry/entry-point.js.map +1 -0
- package/{src/registry/index.ts → dist/registry/index.d.ts} +2 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +8 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/metadata.d.ts +9 -0
- package/dist/registry/metadata.d.ts.map +1 -0
- package/dist/registry/metadata.js +105 -0
- package/dist/registry/metadata.js.map +1 -0
- package/dist/registry/registry.d.ts +102 -0
- package/dist/registry/registry.d.ts.map +1 -0
- package/dist/registry/registry.js +534 -0
- package/dist/registry/registry.js.map +1 -0
- package/dist/registry/scanner.d.ts +7 -0
- package/dist/registry/scanner.d.ts.map +1 -0
- package/dist/registry/scanner.js +164 -0
- package/dist/registry/scanner.js.map +1 -0
- package/dist/registry/schema-export.d.ts +9 -0
- package/dist/registry/schema-export.d.ts.map +1 -0
- package/dist/registry/schema-export.js +132 -0
- package/dist/registry/schema-export.js.map +1 -0
- package/dist/registry/types.d.ts +29 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +5 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/registry/validation.d.ts +9 -0
- package/dist/registry/validation.d.ts.map +1 -0
- package/dist/registry/validation.js +33 -0
- package/dist/registry/validation.js.map +1 -0
- package/dist/schema/annotations.d.ts +8 -0
- package/dist/schema/annotations.d.ts.map +1 -0
- package/dist/schema/annotations.js +52 -0
- package/dist/schema/annotations.js.map +1 -0
- package/dist/schema/exporter.d.ts +13 -0
- package/dist/schema/exporter.d.ts.map +1 -0
- package/dist/schema/exporter.js +71 -0
- package/dist/schema/exporter.js.map +1 -0
- package/dist/schema/index.d.ts +9 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/{src/schema/index.ts → dist/schema/index.js} +1 -7
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/loader.d.ts +30 -0
- package/dist/schema/loader.d.ts.map +1 -0
- package/dist/schema/loader.js +260 -0
- package/dist/schema/loader.js.map +1 -0
- package/dist/schema/ref-resolver.d.ts +19 -0
- package/dist/schema/ref-resolver.d.ts.map +1 -0
- package/dist/schema/ref-resolver.js +212 -0
- package/dist/schema/ref-resolver.js.map +1 -0
- package/dist/schema/strict.d.ts +7 -0
- package/dist/schema/strict.d.ts.map +1 -0
- package/dist/schema/strict.js +127 -0
- package/dist/schema/strict.js.map +1 -0
- package/dist/schema/types.d.ts +53 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +31 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/schema/validator.d.ts +16 -0
- package/dist/schema/validator.d.ts.map +1 -0
- package/dist/schema/validator.js +71 -0
- package/dist/schema/validator.js.map +1 -0
- package/dist/trace-context.d.ts +35 -0
- package/dist/trace-context.d.ts.map +1 -0
- package/dist/trace-context.js +86 -0
- package/dist/trace-context.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +32 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/pattern.d.ts +5 -0
- package/dist/utils/pattern.d.ts.map +1 -0
- package/dist/utils/pattern.js +31 -0
- package/dist/utils/pattern.js.map +1 -0
- package/package.json +8 -2
- package/.claude/settings.local.json +0 -12
- package/.github/workflows/ci.yml +0 -39
- package/.gitmessage +0 -60
- package/.pre-commit-config.yaml +0 -28
- package/CHANGELOG.md +0 -183
- package/CLAUDE.md +0 -68
- package/apcore-logo.svg +0 -79
- package/planning/acl-system/overview.md +0 -54
- package/planning/acl-system/plan.md +0 -92
- package/planning/acl-system/state.json +0 -76
- package/planning/acl-system/tasks/acl-core.md +0 -226
- package/planning/acl-system/tasks/acl-rule.md +0 -92
- package/planning/acl-system/tasks/conditional-rules.md +0 -259
- package/planning/acl-system/tasks/pattern-matching.md +0 -152
- package/planning/acl-system/tasks/yaml-loading.md +0 -271
- package/planning/core-executor/overview.md +0 -53
- package/planning/core-executor/plan.md +0 -88
- package/planning/core-executor/state.json +0 -76
- package/planning/core-executor/tasks/async-support.md +0 -106
- package/planning/core-executor/tasks/execution-pipeline.md +0 -113
- package/planning/core-executor/tasks/redaction.md +0 -85
- package/planning/core-executor/tasks/safety-checks.md +0 -65
- package/planning/core-executor/tasks/setup.md +0 -75
- package/planning/decorator-bindings/overview.md +0 -62
- package/planning/decorator-bindings/plan.md +0 -104
- package/planning/decorator-bindings/state.json +0 -87
- package/planning/decorator-bindings/tasks/binding-directory.md +0 -79
- package/planning/decorator-bindings/tasks/binding-loader.md +0 -148
- package/planning/decorator-bindings/tasks/explicit-schemas.md +0 -85
- package/planning/decorator-bindings/tasks/function-module.md +0 -127
- package/planning/decorator-bindings/tasks/module-factory.md +0 -89
- package/planning/decorator-bindings/tasks/schema-modes.md +0 -142
- package/planning/middleware-system/overview.md +0 -48
- package/planning/middleware-system/plan.md +0 -102
- package/planning/middleware-system/state.json +0 -65
- package/planning/middleware-system/tasks/adapters.md +0 -170
- package/planning/middleware-system/tasks/base.md +0 -115
- package/planning/middleware-system/tasks/logging-middleware.md +0 -304
- package/planning/middleware-system/tasks/manager.md +0 -313
- package/planning/observability/overview.md +0 -53
- package/planning/observability/plan.md +0 -119
- package/planning/observability/state.json +0 -98
- package/planning/observability/tasks/context-logger.md +0 -201
- package/planning/observability/tasks/exporters.md +0 -121
- package/planning/observability/tasks/metrics-collector.md +0 -162
- package/planning/observability/tasks/metrics-middleware.md +0 -141
- package/planning/observability/tasks/obs-logging-middleware.md +0 -179
- package/planning/observability/tasks/span-model.md +0 -120
- package/planning/observability/tasks/tracing-middleware.md +0 -179
- package/planning/overview.md +0 -81
- package/planning/registry-system/overview.md +0 -57
- package/planning/registry-system/plan.md +0 -114
- package/planning/registry-system/state.json +0 -109
- package/planning/registry-system/tasks/dependencies.md +0 -157
- package/planning/registry-system/tasks/entry-point.md +0 -148
- package/planning/registry-system/tasks/metadata.md +0 -198
- package/planning/registry-system/tasks/registry-core.md +0 -323
- package/planning/registry-system/tasks/scanner.md +0 -172
- package/planning/registry-system/tasks/schema-export.md +0 -261
- package/planning/registry-system/tasks/types.md +0 -124
- package/planning/registry-system/tasks/validation.md +0 -177
- package/planning/schema-system/overview.md +0 -56
- package/planning/schema-system/plan.md +0 -121
- package/planning/schema-system/state.json +0 -98
- package/planning/schema-system/tasks/exporter.md +0 -153
- package/planning/schema-system/tasks/loader.md +0 -106
- package/planning/schema-system/tasks/ref-resolver.md +0 -133
- package/planning/schema-system/tasks/strict-mode.md +0 -140
- package/planning/schema-system/tasks/typebox-generation.md +0 -133
- package/planning/schema-system/tasks/types-and-annotations.md +0 -160
- package/planning/schema-system/tasks/validator.md +0 -149
- package/src/acl.ts +0 -200
- package/src/bindings.ts +0 -207
- package/src/config.ts +0 -24
- package/src/context.ts +0 -78
- package/src/decorator.ts +0 -110
- package/src/errors.ts +0 -425
- package/src/executor.ts +0 -475
- package/src/middleware/adapters.ts +0 -54
- package/src/middleware/base.ts +0 -33
- package/src/middleware/logging.ts +0 -103
- package/src/middleware/manager.ts +0 -105
- package/src/module.ts +0 -43
- package/src/observability/context-logger.ts +0 -203
- package/src/observability/metrics.ts +0 -214
- package/src/observability/tracing.ts +0 -188
- package/src/registry/dependencies.ts +0 -99
- package/src/registry/entry-point.ts +0 -64
- package/src/registry/metadata.ts +0 -111
- package/src/registry/registry.ts +0 -360
- package/src/registry/scanner.ts +0 -168
- package/src/registry/schema-export.ts +0 -181
- package/src/registry/types.ts +0 -32
- package/src/registry/validation.ts +0 -38
- package/src/schema/annotations.ts +0 -68
- package/src/schema/exporter.ts +0 -90
- package/src/schema/loader.ts +0 -273
- package/src/schema/ref-resolver.ts +0 -244
- package/src/schema/strict.ts +0 -136
- package/src/schema/types.ts +0 -73
- package/src/schema/validator.ts +0 -82
- package/src/utils/index.ts +0 -5
- package/src/utils/pattern.ts +0 -30
- package/tests/helpers.ts +0 -30
- package/tests/integration/test-acl-safety.test.ts +0 -269
- package/tests/integration/test-binding-executor.test.ts +0 -194
- package/tests/integration/test-e2e-flow.test.ts +0 -117
- package/tests/integration/test-error-propagation.test.ts +0 -259
- package/tests/integration/test-middleware-chain.test.ts +0 -120
- package/tests/integration/test-observability-integration.test.ts +0 -438
- package/tests/observability/test-context-logger.test.ts +0 -123
- package/tests/observability/test-metrics.test.ts +0 -186
- package/tests/observability/test-tracing.test.ts +0 -131
- package/tests/registry/test-dependencies.test.ts +0 -70
- package/tests/registry/test-entry-point.test.ts +0 -133
- package/tests/registry/test-metadata.test.ts +0 -265
- package/tests/registry/test-registry.test.ts +0 -1008
- package/tests/registry/test-scanner.test.ts +0 -257
- package/tests/registry/test-schema-export.test.ts +0 -355
- package/tests/registry/test-validation.test.ts +0 -75
- package/tests/schema/test-annotations.test.ts +0 -137
- package/tests/schema/test-exporter.test.ts +0 -172
- package/tests/schema/test-loader.test.ts +0 -461
- package/tests/schema/test-ref-resolver.test.ts +0 -530
- package/tests/schema/test-strict.test.ts +0 -348
- package/tests/schema/test-validator.test.ts +0 -64
- package/tests/test-acl.test.ts +0 -423
- package/tests/test-bindings.test.ts +0 -227
- package/tests/test-config.test.ts +0 -76
- package/tests/test-context.test.ts +0 -151
- package/tests/test-decorator.test.ts +0 -173
- package/tests/test-errors.test.ts +0 -647
- package/tests/test-executor-stream.test.ts +0 -208
- package/tests/test-executor.test.ts +0 -252
- package/tests/test-logging-middleware.test.ts +0 -150
- package/tests/test-middleware-manager.test.ts +0 -185
- package/tests/test-middleware.test.ts +0 -86
- package/tests/utils/test-pattern.test.ts +0 -109
- package/tsconfig.build.json +0 -8
- package/tsconfig.json +0 -20
- package/vitest.config.ts +0 -18
package/src/errors.ts
DELETED
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error hierarchy for the apcore framework.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export class ModuleError extends Error {
|
|
6
|
-
readonly code: string;
|
|
7
|
-
readonly details: Record<string, unknown>;
|
|
8
|
-
override readonly cause?: Error;
|
|
9
|
-
readonly traceId?: string;
|
|
10
|
-
readonly timestamp: string;
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
code: string,
|
|
14
|
-
message: string,
|
|
15
|
-
details?: Record<string, unknown>,
|
|
16
|
-
cause?: Error,
|
|
17
|
-
traceId?: string,
|
|
18
|
-
) {
|
|
19
|
-
super(message, cause ? { cause } : undefined);
|
|
20
|
-
this.name = 'ModuleError';
|
|
21
|
-
this.code = code;
|
|
22
|
-
this.details = details ?? {};
|
|
23
|
-
this.cause = cause;
|
|
24
|
-
this.traceId = traceId;
|
|
25
|
-
this.timestamp = new Date().toISOString();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
override toString(): string {
|
|
29
|
-
return `[${this.code}] ${this.message}`;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class ConfigNotFoundError extends ModuleError {
|
|
34
|
-
constructor(configPath: string, options?: { cause?: Error; traceId?: string }) {
|
|
35
|
-
super(
|
|
36
|
-
'CONFIG_NOT_FOUND',
|
|
37
|
-
`Configuration file not found: ${configPath}`,
|
|
38
|
-
{ configPath },
|
|
39
|
-
options?.cause,
|
|
40
|
-
options?.traceId,
|
|
41
|
-
);
|
|
42
|
-
this.name = 'ConfigNotFoundError';
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export class ConfigError extends ModuleError {
|
|
47
|
-
constructor(message: string, options?: { cause?: Error; traceId?: string }) {
|
|
48
|
-
super('CONFIG_INVALID', message, {}, options?.cause, options?.traceId);
|
|
49
|
-
this.name = 'ConfigError';
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export class ACLRuleError extends ModuleError {
|
|
54
|
-
constructor(message: string, options?: { cause?: Error; traceId?: string }) {
|
|
55
|
-
super('ACL_RULE_ERROR', message, {}, options?.cause, options?.traceId);
|
|
56
|
-
this.name = 'ACLRuleError';
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export class ACLDeniedError extends ModuleError {
|
|
61
|
-
constructor(callerId: string | null, targetId: string, options?: { cause?: Error; traceId?: string }) {
|
|
62
|
-
super(
|
|
63
|
-
'ACL_DENIED',
|
|
64
|
-
`Access denied: ${callerId} -> ${targetId}`,
|
|
65
|
-
{ callerId, targetId },
|
|
66
|
-
options?.cause,
|
|
67
|
-
options?.traceId,
|
|
68
|
-
);
|
|
69
|
-
this.name = 'ACLDeniedError';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
get callerId(): string | null {
|
|
73
|
-
return this.details['callerId'] as string | null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
get targetId(): string {
|
|
77
|
-
return this.details['targetId'] as string;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export class ModuleNotFoundError extends ModuleError {
|
|
82
|
-
constructor(moduleId: string, options?: { cause?: Error; traceId?: string }) {
|
|
83
|
-
super(
|
|
84
|
-
'MODULE_NOT_FOUND',
|
|
85
|
-
`Module not found: ${moduleId}`,
|
|
86
|
-
{ moduleId },
|
|
87
|
-
options?.cause,
|
|
88
|
-
options?.traceId,
|
|
89
|
-
);
|
|
90
|
-
this.name = 'ModuleNotFoundError';
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export class ModuleTimeoutError extends ModuleError {
|
|
95
|
-
constructor(moduleId: string, timeoutMs: number, options?: { cause?: Error; traceId?: string }) {
|
|
96
|
-
super(
|
|
97
|
-
'MODULE_TIMEOUT',
|
|
98
|
-
`Module ${moduleId} timed out after ${timeoutMs}ms`,
|
|
99
|
-
{ moduleId, timeoutMs },
|
|
100
|
-
options?.cause,
|
|
101
|
-
options?.traceId,
|
|
102
|
-
);
|
|
103
|
-
this.name = 'ModuleTimeoutError';
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
get moduleId(): string {
|
|
107
|
-
return this.details['moduleId'] as string;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
get timeoutMs(): number {
|
|
111
|
-
return this.details['timeoutMs'] as number;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export class SchemaValidationError extends ModuleError {
|
|
116
|
-
constructor(
|
|
117
|
-
message: string = 'Schema validation failed',
|
|
118
|
-
errors?: Array<Record<string, unknown>>,
|
|
119
|
-
options?: { cause?: Error; traceId?: string },
|
|
120
|
-
) {
|
|
121
|
-
super(
|
|
122
|
-
'SCHEMA_VALIDATION_ERROR',
|
|
123
|
-
message,
|
|
124
|
-
{ errors: errors ?? [] },
|
|
125
|
-
options?.cause,
|
|
126
|
-
options?.traceId,
|
|
127
|
-
);
|
|
128
|
-
this.name = 'SchemaValidationError';
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export class SchemaNotFoundError extends ModuleError {
|
|
133
|
-
constructor(schemaId: string, options?: { cause?: Error; traceId?: string }) {
|
|
134
|
-
super(
|
|
135
|
-
'SCHEMA_NOT_FOUND',
|
|
136
|
-
`Schema not found: ${schemaId}`,
|
|
137
|
-
{ schemaId },
|
|
138
|
-
options?.cause,
|
|
139
|
-
options?.traceId,
|
|
140
|
-
);
|
|
141
|
-
this.name = 'SchemaNotFoundError';
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export class SchemaParseError extends ModuleError {
|
|
146
|
-
constructor(message: string, options?: { cause?: Error; traceId?: string }) {
|
|
147
|
-
super('SCHEMA_PARSE_ERROR', message, {}, options?.cause, options?.traceId);
|
|
148
|
-
this.name = 'SchemaParseError';
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export class SchemaCircularRefError extends ModuleError {
|
|
153
|
-
constructor(refPath: string, options?: { cause?: Error; traceId?: string }) {
|
|
154
|
-
super(
|
|
155
|
-
'SCHEMA_CIRCULAR_REF',
|
|
156
|
-
`Circular reference detected: ${refPath}`,
|
|
157
|
-
{ refPath },
|
|
158
|
-
options?.cause,
|
|
159
|
-
options?.traceId,
|
|
160
|
-
);
|
|
161
|
-
this.name = 'SchemaCircularRefError';
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export class CallDepthExceededError extends ModuleError {
|
|
166
|
-
constructor(depth: number, maxDepth: number, callChain: string[], options?: { cause?: Error; traceId?: string }) {
|
|
167
|
-
super(
|
|
168
|
-
'CALL_DEPTH_EXCEEDED',
|
|
169
|
-
`Call depth ${depth} exceeds maximum ${maxDepth}`,
|
|
170
|
-
{ depth, maxDepth, callChain },
|
|
171
|
-
options?.cause,
|
|
172
|
-
options?.traceId,
|
|
173
|
-
);
|
|
174
|
-
this.name = 'CallDepthExceededError';
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
get currentDepth(): number {
|
|
178
|
-
return this.details['depth'] as number;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
get maxDepth(): number {
|
|
182
|
-
return this.details['maxDepth'] as number;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export class CircularCallError extends ModuleError {
|
|
187
|
-
constructor(moduleId: string, callChain: string[], options?: { cause?: Error; traceId?: string }) {
|
|
188
|
-
super(
|
|
189
|
-
'CIRCULAR_CALL',
|
|
190
|
-
`Circular call detected for module ${moduleId}`,
|
|
191
|
-
{ moduleId, callChain },
|
|
192
|
-
options?.cause,
|
|
193
|
-
options?.traceId,
|
|
194
|
-
);
|
|
195
|
-
this.name = 'CircularCallError';
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
get moduleId(): string {
|
|
199
|
-
return this.details['moduleId'] as string;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export class CallFrequencyExceededError extends ModuleError {
|
|
204
|
-
constructor(
|
|
205
|
-
moduleId: string,
|
|
206
|
-
count: number,
|
|
207
|
-
maxRepeat: number,
|
|
208
|
-
callChain: string[],
|
|
209
|
-
options?: { cause?: Error; traceId?: string },
|
|
210
|
-
) {
|
|
211
|
-
super(
|
|
212
|
-
'CALL_FREQUENCY_EXCEEDED',
|
|
213
|
-
`Module ${moduleId} called ${count} times, max is ${maxRepeat}`,
|
|
214
|
-
{ moduleId, count, maxRepeat, callChain },
|
|
215
|
-
options?.cause,
|
|
216
|
-
options?.traceId,
|
|
217
|
-
);
|
|
218
|
-
this.name = 'CallFrequencyExceededError';
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
get moduleId(): string {
|
|
222
|
-
return this.details['moduleId'] as string;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
get count(): number {
|
|
226
|
-
return this.details['count'] as number;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
get maxRepeat(): number {
|
|
230
|
-
return this.details['maxRepeat'] as number;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export class InvalidInputError extends ModuleError {
|
|
235
|
-
constructor(message: string = 'Invalid input', options?: { cause?: Error; traceId?: string }) {
|
|
236
|
-
super('GENERAL_INVALID_INPUT', message, {}, options?.cause, options?.traceId);
|
|
237
|
-
this.name = 'InvalidInputError';
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export class FuncMissingTypeHintError extends ModuleError {
|
|
242
|
-
constructor(functionName: string, parameterName: string, options?: { cause?: Error; traceId?: string }) {
|
|
243
|
-
super(
|
|
244
|
-
'FUNC_MISSING_TYPE_HINT',
|
|
245
|
-
`Parameter '${parameterName}' in function '${functionName}' has no type annotation. Add a type annotation like '${parameterName}: string'.`,
|
|
246
|
-
{ functionName, parameterName },
|
|
247
|
-
options?.cause,
|
|
248
|
-
options?.traceId,
|
|
249
|
-
);
|
|
250
|
-
this.name = 'FuncMissingTypeHintError';
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export class FuncMissingReturnTypeError extends ModuleError {
|
|
255
|
-
constructor(functionName: string, options?: { cause?: Error; traceId?: string }) {
|
|
256
|
-
super(
|
|
257
|
-
'FUNC_MISSING_RETURN_TYPE',
|
|
258
|
-
`Function '${functionName}' has no return type annotation. Add a return type like ': Record<string, unknown>'.`,
|
|
259
|
-
{ functionName },
|
|
260
|
-
options?.cause,
|
|
261
|
-
options?.traceId,
|
|
262
|
-
);
|
|
263
|
-
this.name = 'FuncMissingReturnTypeError';
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export class BindingInvalidTargetError extends ModuleError {
|
|
268
|
-
constructor(target: string, options?: { cause?: Error; traceId?: string }) {
|
|
269
|
-
super(
|
|
270
|
-
'BINDING_INVALID_TARGET',
|
|
271
|
-
`Invalid binding target '${target}'. Expected format: 'module.path:callable_name'.`,
|
|
272
|
-
{ target },
|
|
273
|
-
options?.cause,
|
|
274
|
-
options?.traceId,
|
|
275
|
-
);
|
|
276
|
-
this.name = 'BindingInvalidTargetError';
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
export class BindingModuleNotFoundError extends ModuleError {
|
|
281
|
-
constructor(modulePath: string, options?: { cause?: Error; traceId?: string }) {
|
|
282
|
-
super(
|
|
283
|
-
'BINDING_MODULE_NOT_FOUND',
|
|
284
|
-
`Cannot import module '${modulePath}'.`,
|
|
285
|
-
{ modulePath },
|
|
286
|
-
options?.cause,
|
|
287
|
-
options?.traceId,
|
|
288
|
-
);
|
|
289
|
-
this.name = 'BindingModuleNotFoundError';
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export class BindingCallableNotFoundError extends ModuleError {
|
|
294
|
-
constructor(callableName: string, modulePath: string, options?: { cause?: Error; traceId?: string }) {
|
|
295
|
-
super(
|
|
296
|
-
'BINDING_CALLABLE_NOT_FOUND',
|
|
297
|
-
`Cannot find callable '${callableName}' in module '${modulePath}'.`,
|
|
298
|
-
{ callableName, modulePath },
|
|
299
|
-
options?.cause,
|
|
300
|
-
options?.traceId,
|
|
301
|
-
);
|
|
302
|
-
this.name = 'BindingCallableNotFoundError';
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
export class BindingNotCallableError extends ModuleError {
|
|
307
|
-
constructor(target: string, options?: { cause?: Error; traceId?: string }) {
|
|
308
|
-
super(
|
|
309
|
-
'BINDING_NOT_CALLABLE',
|
|
310
|
-
`Resolved target '${target}' is not callable.`,
|
|
311
|
-
{ target },
|
|
312
|
-
options?.cause,
|
|
313
|
-
options?.traceId,
|
|
314
|
-
);
|
|
315
|
-
this.name = 'BindingNotCallableError';
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export class BindingSchemaMissingError extends ModuleError {
|
|
320
|
-
constructor(target: string, options?: { cause?: Error; traceId?: string }) {
|
|
321
|
-
super(
|
|
322
|
-
'BINDING_SCHEMA_MISSING',
|
|
323
|
-
`No schema available for target '${target}'. Add type hints or provide an explicit schema.`,
|
|
324
|
-
{ target },
|
|
325
|
-
options?.cause,
|
|
326
|
-
options?.traceId,
|
|
327
|
-
);
|
|
328
|
-
this.name = 'BindingSchemaMissingError';
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
export class BindingFileInvalidError extends ModuleError {
|
|
333
|
-
constructor(filePath: string, reason: string, options?: { cause?: Error; traceId?: string }) {
|
|
334
|
-
super(
|
|
335
|
-
'BINDING_FILE_INVALID',
|
|
336
|
-
`Invalid binding file '${filePath}': ${reason}`,
|
|
337
|
-
{ filePath, reason },
|
|
338
|
-
options?.cause,
|
|
339
|
-
options?.traceId,
|
|
340
|
-
);
|
|
341
|
-
this.name = 'BindingFileInvalidError';
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
export class CircularDependencyError extends ModuleError {
|
|
346
|
-
constructor(cyclePath: string[], options?: { cause?: Error; traceId?: string }) {
|
|
347
|
-
super(
|
|
348
|
-
'CIRCULAR_DEPENDENCY',
|
|
349
|
-
`Circular dependency detected: ${cyclePath.join(' -> ')}`,
|
|
350
|
-
{ cyclePath },
|
|
351
|
-
options?.cause,
|
|
352
|
-
options?.traceId,
|
|
353
|
-
);
|
|
354
|
-
this.name = 'CircularDependencyError';
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
export class ModuleLoadError extends ModuleError {
|
|
359
|
-
constructor(moduleId: string, reason: string, options?: { cause?: Error; traceId?: string }) {
|
|
360
|
-
super(
|
|
361
|
-
'MODULE_LOAD_ERROR',
|
|
362
|
-
`Failed to load module '${moduleId}': ${reason}`,
|
|
363
|
-
{ moduleId, reason },
|
|
364
|
-
options?.cause,
|
|
365
|
-
options?.traceId,
|
|
366
|
-
);
|
|
367
|
-
this.name = 'ModuleLoadError';
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
export class ModuleExecuteError extends ModuleError {
|
|
372
|
-
constructor(moduleId: string, reason: string, options?: { cause?: Error; traceId?: string }) {
|
|
373
|
-
super(
|
|
374
|
-
'MODULE_EXECUTE_ERROR',
|
|
375
|
-
`Failed to execute module '${moduleId}': ${reason}`,
|
|
376
|
-
{ moduleId, reason },
|
|
377
|
-
options?.cause,
|
|
378
|
-
options?.traceId,
|
|
379
|
-
);
|
|
380
|
-
this.name = 'ModuleExecuteError';
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
export class InternalError extends ModuleError {
|
|
385
|
-
constructor(message: string = 'Internal error', options?: { cause?: Error; traceId?: string }) {
|
|
386
|
-
super('GENERAL_INTERNAL_ERROR', message, {}, options?.cause, options?.traceId);
|
|
387
|
-
this.name = 'InternalError';
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* All framework error codes as constants.
|
|
393
|
-
* Use these instead of hardcoding error code strings.
|
|
394
|
-
*/
|
|
395
|
-
export const ErrorCodes = Object.freeze({
|
|
396
|
-
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
|
|
397
|
-
CONFIG_INVALID: "CONFIG_INVALID",
|
|
398
|
-
ACL_RULE_ERROR: "ACL_RULE_ERROR",
|
|
399
|
-
ACL_DENIED: "ACL_DENIED",
|
|
400
|
-
MODULE_NOT_FOUND: "MODULE_NOT_FOUND",
|
|
401
|
-
MODULE_TIMEOUT: "MODULE_TIMEOUT",
|
|
402
|
-
MODULE_LOAD_ERROR: "MODULE_LOAD_ERROR",
|
|
403
|
-
MODULE_EXECUTE_ERROR: "MODULE_EXECUTE_ERROR",
|
|
404
|
-
SCHEMA_VALIDATION_ERROR: "SCHEMA_VALIDATION_ERROR",
|
|
405
|
-
SCHEMA_NOT_FOUND: "SCHEMA_NOT_FOUND",
|
|
406
|
-
SCHEMA_PARSE_ERROR: "SCHEMA_PARSE_ERROR",
|
|
407
|
-
SCHEMA_CIRCULAR_REF: "SCHEMA_CIRCULAR_REF",
|
|
408
|
-
CALL_DEPTH_EXCEEDED: "CALL_DEPTH_EXCEEDED",
|
|
409
|
-
CIRCULAR_CALL: "CIRCULAR_CALL",
|
|
410
|
-
CALL_FREQUENCY_EXCEEDED: "CALL_FREQUENCY_EXCEEDED",
|
|
411
|
-
GENERAL_INVALID_INPUT: "GENERAL_INVALID_INPUT",
|
|
412
|
-
GENERAL_INTERNAL_ERROR: "GENERAL_INTERNAL_ERROR",
|
|
413
|
-
FUNC_MISSING_TYPE_HINT: "FUNC_MISSING_TYPE_HINT",
|
|
414
|
-
FUNC_MISSING_RETURN_TYPE: "FUNC_MISSING_RETURN_TYPE",
|
|
415
|
-
BINDING_INVALID_TARGET: "BINDING_INVALID_TARGET",
|
|
416
|
-
BINDING_MODULE_NOT_FOUND: "BINDING_MODULE_NOT_FOUND",
|
|
417
|
-
BINDING_CALLABLE_NOT_FOUND: "BINDING_CALLABLE_NOT_FOUND",
|
|
418
|
-
BINDING_NOT_CALLABLE: "BINDING_NOT_CALLABLE",
|
|
419
|
-
BINDING_SCHEMA_MISSING: "BINDING_SCHEMA_MISSING",
|
|
420
|
-
BINDING_FILE_INVALID: "BINDING_FILE_INVALID",
|
|
421
|
-
CIRCULAR_DEPENDENCY: "CIRCULAR_DEPENDENCY",
|
|
422
|
-
MIDDLEWARE_CHAIN_ERROR: "MIDDLEWARE_CHAIN_ERROR",
|
|
423
|
-
} as const);
|
|
424
|
-
|
|
425
|
-
export type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
|