@statedelta-actions/actions 0.2.0 → 0.3.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/index.d.cts CHANGED
@@ -1,21 +1,8 @@
1
- import { Directive, ExecutionFrame, DirectiveResult, RuleEngineRef, ApplyResult, HookFn, InterceptResult, AbortDecision, ActionEngineRef, FrameLimits, SlotAnalysis } from '@statedelta-actions/core';
1
+ import { Directive, ExecutionFrame, RuleEngineRef, ApplyResult, RegisterWarning, ActionEngineRef, DirectiveResult, HookFn, InterceptResult, AbortDecision, FrameLimits, SlotAnalysis } from '@statedelta-actions/core';
2
+ export { RegisterWarning } from '@statedelta-actions/core';
2
3
 
3
4
  type DirectiveHandler<TCtx> = (directive: Directive, frame: ExecutionFrame<TCtx>, engine: RuleEngineRef<TCtx>) => ApplyResult;
4
5
  type DirectiveHandlerMap<TCtx> = Record<string, DirectiveHandler<TCtx>>;
5
- interface DirectiveHooks<TCtx> {
6
- beforeDirective?: HookFn<[
7
- directive: Directive,
8
- frame: ExecutionFrame<TCtx>
9
- ], InterceptResult<TCtx>>;
10
- afterDirective?: HookFn<[
11
- directive: Directive,
12
- result: ApplyResult,
13
- frame: ExecutionFrame<TCtx>
14
- ], AbortDecision>;
15
- onDirectivesComplete?: HookFn<[result: DirectiveResult], void>;
16
- }
17
- type DirectiveExecutorFn<TCtx> = (directives: readonly Directive[], frame: ExecutionFrame<TCtx>, handlers: DirectiveHandlerMap<TCtx>, directiveHooks: DirectiveHooks<TCtx>, typeField: string, engine: RuleEngineRef<TCtx>, maxDirectives: number) => DirectiveResult | Promise<DirectiveResult>;
18
- type DirectiveRunnerFn<TCtx> = (directives: readonly Directive[], frame: ExecutionFrame<TCtx>) => DirectiveResult | Promise<DirectiveResult>;
19
6
  interface HandlerAnalysis {
20
7
  capabilities: string[];
21
8
  dependencies: string[];
@@ -103,11 +90,7 @@ interface RegisterError {
103
90
  error: string;
104
91
  code?: string;
105
92
  }
106
- interface RegisterWarning {
107
- actionId: string;
108
- code: string;
109
- message: string;
110
- }
93
+
111
94
  interface RegisterResult {
112
95
  registered: readonly string[];
113
96
  errors: readonly RegisterError[];
@@ -138,6 +121,21 @@ interface DirectivePermissionConfig {
138
121
  * String pura é equivalente a `{ pattern: string }`.
139
122
  */
140
123
  type DirectivePermissionEntry = string | DirectivePermissionConfig;
124
+
125
+ interface DirectiveHooks<TCtx> {
126
+ beforeDirective?: HookFn<[
127
+ directive: Directive,
128
+ frame: ExecutionFrame<TCtx>
129
+ ], InterceptResult<TCtx>>;
130
+ afterDirective?: HookFn<[
131
+ directive: Directive,
132
+ result: ApplyResult,
133
+ frame: ExecutionFrame<TCtx>
134
+ ], AbortDecision>;
135
+ onDirectivesComplete?: HookFn<[result: DirectiveResult], void>;
136
+ }
137
+ type DirectiveExecutorFn<TCtx> = (directives: readonly Directive[], frame: ExecutionFrame<TCtx>, handlers: DirectiveHandlerMap<TCtx>, directiveHooks: DirectiveHooks<TCtx>, typeField: string, engine: RuleEngineRef<TCtx>, maxDirectives: number) => DirectiveResult | Promise<DirectiveResult>;
138
+ type DirectiveRunnerFn<TCtx> = (directives: readonly Directive[], frame: ExecutionFrame<TCtx>) => DirectiveResult | Promise<DirectiveResult>;
141
139
  /** Resultado de interceptação do beforeAction — skip total da execução. */
142
140
  interface ActionInterceptResult {
143
141
  readonly data?: unknown;
@@ -308,4 +306,4 @@ interface GeneratedActionExecutor {
308
306
  }
309
307
  declare function buildActionExecutor(directives: readonly Directive[], analysis: SlotAnalysis, typeField: string): GeneratedActionExecutor;
310
308
 
311
- export { type ActionDefinition, type ActionHooks, type ActionInterceptResult, type DirectiveExecutorFn, type DirectiveHandler, type DirectiveHandlerMap, type DirectiveHooks, type DirectivePermission, type DirectivePermissionConfig, type DirectivePermissionEntry, type DirectivePermissionStatus, type DirectiveRunnerFn, type EngineEventMap, type EngineEventName, type GeneratedActionExecutor, type GeneratedDirectiveExecutor, type HandlerAnalysis, type HandlerDefinition, type HandlerInput, type HandlerInputMap, type IActionEngine, type IActionEngineConfig, type Listener, RESERVED_TYPES, type RegisterError, type RegisterEvent, type RegisterResult, type RegisterWarning, SimpleEmitter, type UnregisterEvent, type ValidationResult, buildActionExecutor, buildDirectiveExecutor, createActionEngine, createDirectiveInterpreter, normalizeDirectives };
309
+ export { type ActionDefinition, type ActionHooks, type ActionInterceptResult, type DirectiveExecutorFn, type DirectiveHandler, type DirectiveHandlerMap, type DirectiveHooks, type DirectivePermission, type DirectivePermissionConfig, type DirectivePermissionEntry, type DirectivePermissionStatus, type DirectiveRunnerFn, type EngineEventMap, type EngineEventName, type GeneratedActionExecutor, type GeneratedDirectiveExecutor, type HandlerAnalysis, type HandlerDefinition, type HandlerInput, type HandlerInputMap, type IActionEngine, type IActionEngineConfig, type Listener, RESERVED_TYPES, type RegisterError, type RegisterEvent, type RegisterResult, SimpleEmitter, type UnregisterEvent, type ValidationResult, buildActionExecutor, buildDirectiveExecutor, createActionEngine, createDirectiveInterpreter, normalizeDirectives };
package/dist/index.d.ts CHANGED
@@ -1,21 +1,8 @@
1
- import { Directive, ExecutionFrame, DirectiveResult, RuleEngineRef, ApplyResult, HookFn, InterceptResult, AbortDecision, ActionEngineRef, FrameLimits, SlotAnalysis } from '@statedelta-actions/core';
1
+ import { Directive, ExecutionFrame, RuleEngineRef, ApplyResult, RegisterWarning, ActionEngineRef, DirectiveResult, HookFn, InterceptResult, AbortDecision, FrameLimits, SlotAnalysis } from '@statedelta-actions/core';
2
+ export { RegisterWarning } from '@statedelta-actions/core';
2
3
 
3
4
  type DirectiveHandler<TCtx> = (directive: Directive, frame: ExecutionFrame<TCtx>, engine: RuleEngineRef<TCtx>) => ApplyResult;
4
5
  type DirectiveHandlerMap<TCtx> = Record<string, DirectiveHandler<TCtx>>;
5
- interface DirectiveHooks<TCtx> {
6
- beforeDirective?: HookFn<[
7
- directive: Directive,
8
- frame: ExecutionFrame<TCtx>
9
- ], InterceptResult<TCtx>>;
10
- afterDirective?: HookFn<[
11
- directive: Directive,
12
- result: ApplyResult,
13
- frame: ExecutionFrame<TCtx>
14
- ], AbortDecision>;
15
- onDirectivesComplete?: HookFn<[result: DirectiveResult], void>;
16
- }
17
- type DirectiveExecutorFn<TCtx> = (directives: readonly Directive[], frame: ExecutionFrame<TCtx>, handlers: DirectiveHandlerMap<TCtx>, directiveHooks: DirectiveHooks<TCtx>, typeField: string, engine: RuleEngineRef<TCtx>, maxDirectives: number) => DirectiveResult | Promise<DirectiveResult>;
18
- type DirectiveRunnerFn<TCtx> = (directives: readonly Directive[], frame: ExecutionFrame<TCtx>) => DirectiveResult | Promise<DirectiveResult>;
19
6
  interface HandlerAnalysis {
20
7
  capabilities: string[];
21
8
  dependencies: string[];
@@ -103,11 +90,7 @@ interface RegisterError {
103
90
  error: string;
104
91
  code?: string;
105
92
  }
106
- interface RegisterWarning {
107
- actionId: string;
108
- code: string;
109
- message: string;
110
- }
93
+
111
94
  interface RegisterResult {
112
95
  registered: readonly string[];
113
96
  errors: readonly RegisterError[];
@@ -138,6 +121,21 @@ interface DirectivePermissionConfig {
138
121
  * String pura é equivalente a `{ pattern: string }`.
139
122
  */
140
123
  type DirectivePermissionEntry = string | DirectivePermissionConfig;
124
+
125
+ interface DirectiveHooks<TCtx> {
126
+ beforeDirective?: HookFn<[
127
+ directive: Directive,
128
+ frame: ExecutionFrame<TCtx>
129
+ ], InterceptResult<TCtx>>;
130
+ afterDirective?: HookFn<[
131
+ directive: Directive,
132
+ result: ApplyResult,
133
+ frame: ExecutionFrame<TCtx>
134
+ ], AbortDecision>;
135
+ onDirectivesComplete?: HookFn<[result: DirectiveResult], void>;
136
+ }
137
+ type DirectiveExecutorFn<TCtx> = (directives: readonly Directive[], frame: ExecutionFrame<TCtx>, handlers: DirectiveHandlerMap<TCtx>, directiveHooks: DirectiveHooks<TCtx>, typeField: string, engine: RuleEngineRef<TCtx>, maxDirectives: number) => DirectiveResult | Promise<DirectiveResult>;
138
+ type DirectiveRunnerFn<TCtx> = (directives: readonly Directive[], frame: ExecutionFrame<TCtx>) => DirectiveResult | Promise<DirectiveResult>;
141
139
  /** Resultado de interceptação do beforeAction — skip total da execução. */
142
140
  interface ActionInterceptResult {
143
141
  readonly data?: unknown;
@@ -308,4 +306,4 @@ interface GeneratedActionExecutor {
308
306
  }
309
307
  declare function buildActionExecutor(directives: readonly Directive[], analysis: SlotAnalysis, typeField: string): GeneratedActionExecutor;
310
308
 
311
- export { type ActionDefinition, type ActionHooks, type ActionInterceptResult, type DirectiveExecutorFn, type DirectiveHandler, type DirectiveHandlerMap, type DirectiveHooks, type DirectivePermission, type DirectivePermissionConfig, type DirectivePermissionEntry, type DirectivePermissionStatus, type DirectiveRunnerFn, type EngineEventMap, type EngineEventName, type GeneratedActionExecutor, type GeneratedDirectiveExecutor, type HandlerAnalysis, type HandlerDefinition, type HandlerInput, type HandlerInputMap, type IActionEngine, type IActionEngineConfig, type Listener, RESERVED_TYPES, type RegisterError, type RegisterEvent, type RegisterResult, type RegisterWarning, SimpleEmitter, type UnregisterEvent, type ValidationResult, buildActionExecutor, buildDirectiveExecutor, createActionEngine, createDirectiveInterpreter, normalizeDirectives };
309
+ export { type ActionDefinition, type ActionHooks, type ActionInterceptResult, type DirectiveExecutorFn, type DirectiveHandler, type DirectiveHandlerMap, type DirectiveHooks, type DirectivePermission, type DirectivePermissionConfig, type DirectivePermissionEntry, type DirectivePermissionStatus, type DirectiveRunnerFn, type EngineEventMap, type EngineEventName, type GeneratedActionExecutor, type GeneratedDirectiveExecutor, type HandlerAnalysis, type HandlerDefinition, type HandlerInput, type HandlerInputMap, type IActionEngine, type IActionEngineConfig, type Listener, RESERVED_TYPES, type RegisterError, type RegisterEvent, type RegisterResult, SimpleEmitter, type UnregisterEvent, type ValidationResult, buildActionExecutor, buildDirectiveExecutor, createActionEngine, createDirectiveInterpreter, normalizeDirectives };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statedelta-actions/actions",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Directive execution engine with JIT compilation and BailHook interception",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -18,7 +18,7 @@
18
18
  "README.md"
19
19
  ],
20
20
  "dependencies": {
21
- "@statedelta-actions/core": "0.2.0"
21
+ "@statedelta-actions/core": "0.3.0"
22
22
  },
23
23
  "author": "Anderson D. Rosa <andersondrosa@outlook.com>",
24
24
  "license": "MIT",