@bernierllc/nevar-types 0.0.1 → 0.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.
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.isConditionGroup = isConditionGroup;
11
+ exports.isCondition = isCondition;
12
+ /**
13
+ * Type guard: checks whether the given value is a ConditionGroup.
14
+ */
15
+ function isConditionGroup(value) {
16
+ if (value === null || value === undefined || typeof value !== 'object') {
17
+ return false;
18
+ }
19
+ const obj = value;
20
+ return (typeof obj.operator === 'string' &&
21
+ (obj.operator === 'AND' || obj.operator === 'OR' || obj.operator === 'NOT') &&
22
+ Array.isArray(obj.conditions));
23
+ }
24
+ /**
25
+ * Type guard: checks whether the given value is a Condition.
26
+ */
27
+ function isCondition(value) {
28
+ if (value === null || value === undefined || typeof value !== 'object') {
29
+ return false;
30
+ }
31
+ const obj = value;
32
+ return (typeof obj.field === 'string' &&
33
+ typeof obj.op === 'string' &&
34
+ 'value' in obj);
35
+ }
@@ -0,0 +1,64 @@
1
+ import { LogLevel } from './models';
2
+ import { ActionFailureMode } from './actions';
3
+ import { NevarStorageAdapter } from './storage';
4
+ /**
5
+ * Configuration for the circuit breaker that prevents cascading failures.
6
+ */
7
+ export interface CircuitBreakerConfig {
8
+ enabled?: boolean;
9
+ maxFailures?: number;
10
+ resetTimeMs?: number;
11
+ halfOpenMaxAttempts?: number;
12
+ maxCascadeDepth?: number;
13
+ maxActionsPerChain?: number;
14
+ maxChainDurationMs?: number;
15
+ maxConcurrentChains?: number;
16
+ }
17
+ /**
18
+ * Configuration for loop detection and prevention.
19
+ */
20
+ export interface LoopConfig {
21
+ maxDepth?: number;
22
+ maxExecutionsPerTrigger?: number;
23
+ windowMs?: number;
24
+ allowInfiniteLoops?: boolean;
25
+ maxConcurrentLoops?: number;
26
+ heartbeatIntervalMs?: number;
27
+ maxMissedHeartbeats?: number;
28
+ }
29
+ /**
30
+ * Configuration for the audit logger.
31
+ */
32
+ /**
33
+ * Override structure for per-rule, per-trigger, and per-action log levels.
34
+ */
35
+ export interface AuditLoggerOverrides {
36
+ byRule?: Record<string, LogLevel>;
37
+ byTrigger?: Record<string, LogLevel>;
38
+ byAction?: Record<string, LogLevel>;
39
+ }
40
+ export interface AuditLoggerConfig {
41
+ enabled?: boolean;
42
+ logLevel?: LogLevel;
43
+ retentionDays?: number;
44
+ defaultLevel?: LogLevel;
45
+ overrides?: AuditLoggerOverrides;
46
+ }
47
+ /**
48
+ * Strategy for seeding initial rules into storage.
49
+ */
50
+ export type SeedStrategy = 'skip-existing' | 'overwrite' | 'error-on-conflict' | 'skip_existing' | 'update_existing' | 'replace_all';
51
+ /**
52
+ * Top-level configuration for the Nevar engine.
53
+ */
54
+ export interface NevarConfig {
55
+ storage: NevarStorageAdapter;
56
+ defaultGroupId?: string;
57
+ logLevel?: LogLevel;
58
+ failureMode?: ActionFailureMode;
59
+ actionFailureMode?: ActionFailureMode;
60
+ circuitBreaker?: CircuitBreakerConfig;
61
+ loop?: LoopConfig;
62
+ auditLogger?: AuditLoggerConfig;
63
+ seedStrategy?: SeedStrategy;
64
+ }
package/dist/config.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Defines a context provider that enriches trigger payloads with additional data.
3
+ */
4
+ export interface ContextProviderDefinition {
5
+ key: string;
6
+ description?: string;
7
+ resolve: (payload: Record<string, unknown>) => Promise<Record<string, unknown>>;
8
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Options for constructing a NevarError.
3
+ */
4
+ export interface NevarErrorOptions {
5
+ cause?: Error;
6
+ code?: string;
7
+ context?: Record<string, unknown>;
8
+ }
9
+ /**
10
+ * Base error class for all Nevar errors.
11
+ * Follows ES2022 Error.cause pattern for error chain propagation.
12
+ */
13
+ export declare class NevarError extends Error {
14
+ readonly code: string;
15
+ readonly context?: Record<string, unknown>;
16
+ constructor(message: string, options?: NevarErrorOptions);
17
+ }
18
+ /**
19
+ * Thrown when a trigger fails to fire or is invalid.
20
+ */
21
+ export declare class NevarTriggerError extends NevarError {
22
+ constructor(message: string, options?: NevarErrorOptions);
23
+ }
24
+ /**
25
+ * Thrown when condition evaluation fails.
26
+ */
27
+ export declare class NevarEvaluationError extends NevarError {
28
+ constructor(message: string, options?: NevarErrorOptions);
29
+ }
30
+ /**
31
+ * Thrown when an action fails to execute.
32
+ */
33
+ export declare class NevarActionError extends NevarError {
34
+ constructor(message: string, options?: NevarErrorOptions);
35
+ }
36
+ /**
37
+ * Thrown when the circuit breaker trips due to too many failures.
38
+ */
39
+ export declare class NevarCircuitBreakerError extends NevarError {
40
+ constructor(message: string, options?: NevarErrorOptions);
41
+ }
42
+ /**
43
+ * Thrown when a loop is detected in the evaluation chain.
44
+ */
45
+ export declare class NevarLoopError extends NevarError {
46
+ constructor(message: string, options?: NevarErrorOptions);
47
+ }
48
+ /**
49
+ * Thrown when a storage operation fails.
50
+ */
51
+ export declare class NevarStorageError extends NevarError {
52
+ constructor(message: string, options?: NevarErrorOptions);
53
+ }
54
+ /**
55
+ * Thrown when input validation fails.
56
+ */
57
+ export declare class NevarValidationError extends NevarError {
58
+ constructor(message: string, options?: NevarErrorOptions);
59
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.NevarValidationError = exports.NevarStorageError = exports.NevarLoopError = exports.NevarCircuitBreakerError = exports.NevarActionError = exports.NevarEvaluationError = exports.NevarTriggerError = exports.NevarError = void 0;
11
+ /**
12
+ * Base error class for all Nevar errors.
13
+ * Follows ES2022 Error.cause pattern for error chain propagation.
14
+ */
15
+ class NevarError extends Error {
16
+ code;
17
+ context;
18
+ constructor(message, options) {
19
+ super(message, { cause: options?.cause });
20
+ this.name = 'NevarError';
21
+ this.code = options?.code ?? 'NEVAR_ERROR';
22
+ this.context = options?.context;
23
+ }
24
+ }
25
+ exports.NevarError = NevarError;
26
+ /**
27
+ * Thrown when a trigger fails to fire or is invalid.
28
+ */
29
+ class NevarTriggerError extends NevarError {
30
+ constructor(message, options) {
31
+ super(message, { ...options, code: options?.code ?? 'NEVAR_TRIGGER_ERROR' });
32
+ this.name = 'NevarTriggerError';
33
+ }
34
+ }
35
+ exports.NevarTriggerError = NevarTriggerError;
36
+ /**
37
+ * Thrown when condition evaluation fails.
38
+ */
39
+ class NevarEvaluationError extends NevarError {
40
+ constructor(message, options) {
41
+ super(message, { ...options, code: options?.code ?? 'NEVAR_EVALUATION_ERROR' });
42
+ this.name = 'NevarEvaluationError';
43
+ }
44
+ }
45
+ exports.NevarEvaluationError = NevarEvaluationError;
46
+ /**
47
+ * Thrown when an action fails to execute.
48
+ */
49
+ class NevarActionError extends NevarError {
50
+ constructor(message, options) {
51
+ super(message, { ...options, code: options?.code ?? 'NEVAR_ACTION_ERROR' });
52
+ this.name = 'NevarActionError';
53
+ }
54
+ }
55
+ exports.NevarActionError = NevarActionError;
56
+ /**
57
+ * Thrown when the circuit breaker trips due to too many failures.
58
+ */
59
+ class NevarCircuitBreakerError extends NevarError {
60
+ constructor(message, options) {
61
+ super(message, { ...options, code: options?.code ?? 'NEVAR_CIRCUIT_BREAKER_ERROR' });
62
+ this.name = 'NevarCircuitBreakerError';
63
+ }
64
+ }
65
+ exports.NevarCircuitBreakerError = NevarCircuitBreakerError;
66
+ /**
67
+ * Thrown when a loop is detected in the evaluation chain.
68
+ */
69
+ class NevarLoopError extends NevarError {
70
+ constructor(message, options) {
71
+ super(message, { ...options, code: options?.code ?? 'NEVAR_LOOP_ERROR' });
72
+ this.name = 'NevarLoopError';
73
+ }
74
+ }
75
+ exports.NevarLoopError = NevarLoopError;
76
+ /**
77
+ * Thrown when a storage operation fails.
78
+ */
79
+ class NevarStorageError extends NevarError {
80
+ constructor(message, options) {
81
+ super(message, { ...options, code: options?.code ?? 'NEVAR_STORAGE_ERROR' });
82
+ this.name = 'NevarStorageError';
83
+ }
84
+ }
85
+ exports.NevarStorageError = NevarStorageError;
86
+ /**
87
+ * Thrown when input validation fails.
88
+ */
89
+ class NevarValidationError extends NevarError {
90
+ constructor(message, options) {
91
+ super(message, { ...options, code: options?.code ?? 'NEVAR_VALIDATION_ERROR' });
92
+ this.name = 'NevarValidationError';
93
+ }
94
+ }
95
+ exports.NevarValidationError = NevarValidationError;
@@ -0,0 +1,12 @@
1
+ export type { LogLevel, RuleGroup, Rule, EvaluationTrace } from './models';
2
+ export type { ConditionGroup, Condition } from './conditions';
3
+ export { isConditionGroup, isCondition } from './conditions';
4
+ export type { ActionRetryConfig, ActionDefinition, ActionIntent, DeferredTrigger, ActionResult, ActionFailureMode, ActionHandlerDefinition, ExecutionResult, } from './actions';
5
+ export type { TriggerDefinition } from './triggers';
6
+ export type { ContextProviderDefinition } from './context';
7
+ export type { OperatorDefinition, OperatorInfo } from './operators';
8
+ export type { GroupFilters, RuleFilters, LogFilters, PaginatedResult, ExecutionLogEntry, NevarStorageAdapter, } from './storage';
9
+ export type { CircuitBreakerConfig, LoopConfig, AuditLoggerConfig, AuditLoggerOverrides, SeedStrategy, NevarConfig, } from './config';
10
+ export type { EvaluationResult, EmitResult, PreviewResult, MatchedRule, LoopHandle, LoopAnalysis, DetectedLoop, } from './results';
11
+ export { NevarError, NevarTriggerError, NevarEvaluationError, NevarActionError, NevarCircuitBreakerError, NevarLoopError, NevarStorageError, NevarValidationError, } from './errors';
12
+ export type { NevarErrorOptions } from './errors';
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.NevarValidationError = exports.NevarStorageError = exports.NevarLoopError = exports.NevarCircuitBreakerError = exports.NevarActionError = exports.NevarEvaluationError = exports.NevarTriggerError = exports.NevarError = exports.isCondition = exports.isConditionGroup = void 0;
11
+ var conditions_1 = require("./conditions");
12
+ Object.defineProperty(exports, "isConditionGroup", { enumerable: true, get: function () { return conditions_1.isConditionGroup; } });
13
+ Object.defineProperty(exports, "isCondition", { enumerable: true, get: function () { return conditions_1.isCondition; } });
14
+ // Errors
15
+ var errors_1 = require("./errors");
16
+ Object.defineProperty(exports, "NevarError", { enumerable: true, get: function () { return errors_1.NevarError; } });
17
+ Object.defineProperty(exports, "NevarTriggerError", { enumerable: true, get: function () { return errors_1.NevarTriggerError; } });
18
+ Object.defineProperty(exports, "NevarEvaluationError", { enumerable: true, get: function () { return errors_1.NevarEvaluationError; } });
19
+ Object.defineProperty(exports, "NevarActionError", { enumerable: true, get: function () { return errors_1.NevarActionError; } });
20
+ Object.defineProperty(exports, "NevarCircuitBreakerError", { enumerable: true, get: function () { return errors_1.NevarCircuitBreakerError; } });
21
+ Object.defineProperty(exports, "NevarLoopError", { enumerable: true, get: function () { return errors_1.NevarLoopError; } });
22
+ Object.defineProperty(exports, "NevarStorageError", { enumerable: true, get: function () { return errors_1.NevarStorageError; } });
23
+ Object.defineProperty(exports, "NevarValidationError", { enumerable: true, get: function () { return errors_1.NevarValidationError; } });
@@ -0,0 +1,56 @@
1
+ import { ConditionGroup } from './conditions';
2
+ import { ActionDefinition } from './actions';
3
+ /**
4
+ * Log level for rule evaluation and execution tracing.
5
+ */
6
+ export type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'all' | 'none' | 'matches_only' | 'errors_only';
7
+ /**
8
+ * A rule group organizes rules under a shared context (e.g., tenant, environment).
9
+ */
10
+ export interface RuleGroup {
11
+ id: string;
12
+ name: string;
13
+ slug: string;
14
+ isActive?: boolean;
15
+ isDefault: boolean;
16
+ rules?: Rule[];
17
+ metadata: Record<string, unknown>;
18
+ createdAt: Date;
19
+ updatedAt: Date;
20
+ }
21
+ /**
22
+ * A rule defines conditions that, when matched against a trigger, produce actions.
23
+ */
24
+ export interface Rule {
25
+ id: string;
26
+ groupId: string;
27
+ name: string;
28
+ slug: string;
29
+ triggerType: string;
30
+ conditions: ConditionGroup;
31
+ actions: ActionDefinition[];
32
+ executionOrder: number;
33
+ isActive: boolean;
34
+ stopOnMatch: boolean;
35
+ allowLoop: boolean;
36
+ logLevel: LogLevel;
37
+ metadata: Record<string, unknown>;
38
+ createdAt: Date;
39
+ updatedAt: Date;
40
+ }
41
+ /**
42
+ * A single step in the evaluation trace, recording what was evaluated and the outcome.
43
+ */
44
+ export interface EvaluationTrace {
45
+ type?: 'group' | 'condition';
46
+ operator?: 'AND' | 'OR' | 'NOT';
47
+ field?: string;
48
+ op?: string;
49
+ value?: unknown;
50
+ expected?: unknown;
51
+ actual?: unknown;
52
+ result?: boolean;
53
+ matched?: boolean;
54
+ children?: EvaluationTrace[];
55
+ durationMs?: number;
56
+ }
package/dist/models.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Full operator definition including the evaluate function.
3
+ * Used internally by the engine to evaluate conditions.
4
+ */
5
+ export interface OperatorDefinition {
6
+ name?: string;
7
+ description?: string;
8
+ label?: string;
9
+ category?: string;
10
+ fieldTypes?: string[];
11
+ schema?: unknown;
12
+ evaluate: (fieldValue: unknown, conditionValue: unknown) => boolean;
13
+ }
14
+ /**
15
+ * Discovery subset of an operator — excludes the evaluate function.
16
+ * Used for listing available operators to consumers.
17
+ */
18
+ export interface OperatorInfo {
19
+ name: string;
20
+ description?: string;
21
+ label?: string;
22
+ category?: string;
23
+ fieldTypes?: string[];
24
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,79 @@
1
+ import { Rule, EvaluationTrace } from './models';
2
+ import { ActionResult, ActionIntent } from './actions';
3
+ import { ExecutionLogEntry } from './storage';
4
+ /**
5
+ * The result of evaluating a single rule's conditions against a payload.
6
+ */
7
+ export interface EvaluationResult {
8
+ matched: boolean;
9
+ trace: EvaluationTrace[];
10
+ durationMs?: number;
11
+ }
12
+ /**
13
+ * The result of emitting a trigger and executing matched rules.
14
+ */
15
+ export interface EmitResult {
16
+ status: 'executed' | 'no_match' | 'loop_blocked' | 'circuit_tripped';
17
+ triggerKey: string;
18
+ groupId: string | null;
19
+ rulesEvaluated: number;
20
+ rulesMatched: number;
21
+ actionsExecuted: number;
22
+ actionResults: ActionResult[];
23
+ durationMs: number;
24
+ logs: ExecutionLogEntry[];
25
+ }
26
+ /**
27
+ * The result of previewing a trigger without executing actions.
28
+ */
29
+ export interface PreviewResult {
30
+ status: 'previewed' | 'no_match';
31
+ triggerKey: string;
32
+ groupId: string | null;
33
+ rulesEvaluated: number;
34
+ rulesMatched: number;
35
+ intents: ActionIntent[];
36
+ evaluationTraces: Array<{
37
+ rule: Rule;
38
+ trace: EvaluationTrace[];
39
+ }>;
40
+ durationMs: number;
41
+ }
42
+ /**
43
+ * A rule that matched during evaluation, along with its evaluation result.
44
+ */
45
+ export interface MatchedRule {
46
+ rule: Rule;
47
+ evaluationResult: EvaluationResult;
48
+ }
49
+ /**
50
+ * A handle to a running evaluation loop (e.g., polling or streaming).
51
+ */
52
+ export interface LoopHandle {
53
+ id: string;
54
+ stop?: () => void;
55
+ isRunning?: () => boolean;
56
+ triggerKey?: string;
57
+ status?: 'running' | 'paused' | 'killed' | 'completed' | string;
58
+ iterations?: number;
59
+ startedAt?: Date;
60
+ lastHeartbeat?: Date;
61
+ }
62
+ /**
63
+ * Analysis of a detected evaluation loop.
64
+ */
65
+ export interface LoopAnalysis {
66
+ detected?: boolean;
67
+ hasLoops?: boolean;
68
+ loops: DetectedLoop[];
69
+ }
70
+ /**
71
+ * A single detected loop in the evaluation chain.
72
+ */
73
+ export interface DetectedLoop {
74
+ triggerKey?: string;
75
+ ruleIds: string[];
76
+ depth?: number;
77
+ chain?: string[];
78
+ allOptedIn?: boolean;
79
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,100 @@
1
+ import { Rule, RuleGroup, LogLevel } from './models';
2
+ /**
3
+ * Filters for querying rule groups.
4
+ */
5
+ export interface GroupFilters {
6
+ name?: string;
7
+ isActive?: boolean;
8
+ isDefault?: boolean;
9
+ metadata?: Record<string, unknown>;
10
+ }
11
+ /**
12
+ * Filters for querying rules.
13
+ */
14
+ export interface RuleFilters {
15
+ groupId?: string;
16
+ triggerType?: string;
17
+ isActive?: boolean;
18
+ name?: string;
19
+ slug?: string;
20
+ }
21
+ /**
22
+ * Filters for querying execution logs.
23
+ */
24
+ export interface LogFilters {
25
+ triggerKey?: string;
26
+ groupId?: string;
27
+ ruleId?: string;
28
+ status?: string;
29
+ fromDate?: Date;
30
+ toDate?: Date;
31
+ from?: Date;
32
+ to?: Date;
33
+ page?: number;
34
+ pageSize?: number;
35
+ }
36
+ /**
37
+ * A paginated result set.
38
+ */
39
+ export interface PaginatedResult<T> {
40
+ items?: T[];
41
+ data?: T[];
42
+ total: number;
43
+ page: number;
44
+ pageSize: number;
45
+ totalPages?: number;
46
+ }
47
+ /**
48
+ * A log entry recording the execution of a trigger.
49
+ */
50
+ export interface ExecutionLogEntry {
51
+ id: string;
52
+ triggerKey: string;
53
+ triggerPayload?: Record<string, unknown>;
54
+ groupId: string | null;
55
+ ruleId: string | null;
56
+ ruleName?: string;
57
+ status: string;
58
+ logLevel?: LogLevel;
59
+ message?: string;
60
+ data?: Record<string, unknown>;
61
+ conditionsEvaluated?: Array<{
62
+ field?: string;
63
+ op?: string;
64
+ expected?: unknown;
65
+ actual?: unknown;
66
+ matched?: boolean;
67
+ }>;
68
+ actionsExecuted?: import('./actions').ActionResult[];
69
+ errorMessage?: string;
70
+ durationMs: number;
71
+ timestamp: Date;
72
+ }
73
+ /**
74
+ * The storage adapter interface that all persistence backends must implement.
75
+ */
76
+ export interface NevarStorageAdapter {
77
+ createGroup(group: Omit<RuleGroup, 'id'>): Promise<RuleGroup>;
78
+ updateGroup(id: string, patch: Partial<RuleGroup>): Promise<RuleGroup>;
79
+ deleteGroup(id: string): Promise<void>;
80
+ findGroup(id: string): Promise<RuleGroup | null>;
81
+ findDefaultGroup(): Promise<RuleGroup | null>;
82
+ findGroupForContext(metadata: Record<string, unknown>): Promise<RuleGroup | null>;
83
+ listGroups(filters?: GroupFilters): Promise<RuleGroup[]>;
84
+ createRule(rule: Omit<Rule, 'id'>): Promise<Rule>;
85
+ updateRule(id: string, patch: Partial<Rule>): Promise<Rule>;
86
+ deleteRule(id: string): Promise<void>;
87
+ findRule(id: string): Promise<Rule | null>;
88
+ findActiveRules(groupId: string, triggerKey: string): Promise<Rule[]>;
89
+ listRules(filters?: RuleFilters): Promise<Rule[]>;
90
+ writeLog(entry: ExecutionLogEntry): Promise<void>;
91
+ queryLogs(filters: LogFilters): Promise<PaginatedResult<ExecutionLogEntry>>;
92
+ purgeLogs(olderThan: Date): Promise<number>;
93
+ transformRules(filter: RuleFilters, transform: (rule: Rule) => Rule): Promise<{
94
+ updated: number;
95
+ failed: Array<{
96
+ ruleId: string;
97
+ error: string;
98
+ }>;
99
+ }>;
100
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Defines a trigger type that the engine listens for.
3
+ */
4
+ export interface TriggerDefinition {
5
+ key: string;
6
+ description?: string;
7
+ category?: string;
8
+ payloadSchema?: unknown;
9
+ schema?: Record<string, unknown>;
10
+ metadata?: Record<string, unknown>;
11
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code *only within the scope of the project it was delivered for*.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });