@emmvish/stable-request 2.8.4 → 3.0.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/LICENSE +1 -1
- package/README.md +1153 -2319
- package/dist/constants/index.d.ts +0 -10
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +0 -113
- package/dist/constants/index.js.map +1 -1
- package/dist/core/index.d.ts +0 -5
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +0 -5
- package/dist/core/index.js.map +1 -1
- package/dist/core/stable-request.d.ts.map +1 -1
- package/dist/core/stable-request.js +22 -7
- package/dist/core/stable-request.js.map +1 -1
- package/dist/enums/index.d.ts +0 -37
- package/dist/enums/index.d.ts.map +1 -1
- package/dist/enums/index.js +0 -43
- package/dist/enums/index.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +100 -1135
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utilities/index.d.ts +0 -18
- package/dist/utilities/index.d.ts.map +1 -1
- package/dist/utilities/index.js +0 -18
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/infrastructure-persistence.d.ts +0 -1
- package/dist/utilities/infrastructure-persistence.d.ts.map +1 -1
- package/dist/utilities/infrastructure-persistence.js +12 -15
- package/dist/utilities/infrastructure-persistence.js.map +1 -1
- package/dist/utilities/metrics-aggregator.d.ts +2 -13
- package/dist/utilities/metrics-aggregator.d.ts.map +1 -1
- package/dist/utilities/metrics-aggregator.js +9 -251
- package/dist/utilities/metrics-aggregator.js.map +1 -1
- package/dist/utilities/metrics-validator.d.ts +6 -76
- package/dist/utilities/metrics-validator.d.ts.map +1 -1
- package/dist/utilities/metrics-validator.js +12 -181
- package/dist/utilities/metrics-validator.js.map +1 -1
- package/dist/utilities/validate-trial-mode-probabilities.js +2 -2
- package/dist/utilities/validate-trial-mode-probabilities.js.map +1 -1
- package/package.json +20 -24
- package/dist/core/stable-api-gateway.d.ts +0 -4
- package/dist/core/stable-api-gateway.d.ts.map +0 -1
- package/dist/core/stable-api-gateway.js +0 -136
- package/dist/core/stable-api-gateway.js.map +0 -1
- package/dist/core/stable-function.d.ts +0 -11
- package/dist/core/stable-function.d.ts.map +0 -1
- package/dist/core/stable-function.js +0 -340
- package/dist/core/stable-function.js.map +0 -1
- package/dist/core/stable-scheduler.d.ts +0 -71
- package/dist/core/stable-scheduler.d.ts.map +0 -1
- package/dist/core/stable-scheduler.js +0 -768
- package/dist/core/stable-scheduler.js.map +0 -1
- package/dist/core/stable-workflow-graph.d.ts +0 -3
- package/dist/core/stable-workflow-graph.d.ts.map +0 -1
- package/dist/core/stable-workflow-graph.js +0 -5
- package/dist/core/stable-workflow-graph.js.map +0 -1
- package/dist/core/stable-workflow.d.ts +0 -3
- package/dist/core/stable-workflow.d.ts.map +0 -1
- package/dist/core/stable-workflow.js +0 -362
- package/dist/core/stable-workflow.js.map +0 -1
- package/dist/stable-runner/index.d.ts +0 -2
- package/dist/stable-runner/index.d.ts.map +0 -1
- package/dist/stable-runner/index.js +0 -324
- package/dist/stable-runner/index.js.map +0 -1
- package/dist/utilities/concurrency-limiter.d.ts +0 -46
- package/dist/utilities/concurrency-limiter.d.ts.map +0 -1
- package/dist/utilities/concurrency-limiter.js +0 -172
- package/dist/utilities/concurrency-limiter.js.map +0 -1
- package/dist/utilities/execute-branch-workflow.d.ts +0 -3
- package/dist/utilities/execute-branch-workflow.d.ts.map +0 -1
- package/dist/utilities/execute-branch-workflow.js +0 -730
- package/dist/utilities/execute-branch-workflow.js.map +0 -1
- package/dist/utilities/execute-concurrently.d.ts +0 -3
- package/dist/utilities/execute-concurrently.d.ts.map +0 -1
- package/dist/utilities/execute-concurrently.js +0 -258
- package/dist/utilities/execute-concurrently.js.map +0 -1
- package/dist/utilities/execute-gateway-item.d.ts +0 -6
- package/dist/utilities/execute-gateway-item.d.ts.map +0 -1
- package/dist/utilities/execute-gateway-item.js +0 -127
- package/dist/utilities/execute-gateway-item.js.map +0 -1
- package/dist/utilities/execute-non-linear-workflow.d.ts +0 -3
- package/dist/utilities/execute-non-linear-workflow.d.ts.map +0 -1
- package/dist/utilities/execute-non-linear-workflow.js +0 -483
- package/dist/utilities/execute-non-linear-workflow.js.map +0 -1
- package/dist/utilities/execute-phase.d.ts +0 -3
- package/dist/utilities/execute-phase.d.ts.map +0 -1
- package/dist/utilities/execute-phase.js +0 -129
- package/dist/utilities/execute-phase.js.map +0 -1
- package/dist/utilities/execute-sequentially.d.ts +0 -3
- package/dist/utilities/execute-sequentially.d.ts.map +0 -1
- package/dist/utilities/execute-sequentially.js +0 -49
- package/dist/utilities/execute-sequentially.js.map +0 -1
- package/dist/utilities/execute-with-timeout.d.ts +0 -6
- package/dist/utilities/execute-with-timeout.d.ts.map +0 -1
- package/dist/utilities/execute-with-timeout.js +0 -28
- package/dist/utilities/execute-with-timeout.js.map +0 -1
- package/dist/utilities/execute-workflow-graph.d.ts +0 -3
- package/dist/utilities/execute-workflow-graph.d.ts.map +0 -1
- package/dist/utilities/execute-workflow-graph.js +0 -429
- package/dist/utilities/execute-workflow-graph.js.map +0 -1
- package/dist/utilities/extract-common-request-config-options.d.ts +0 -3
- package/dist/utilities/extract-common-request-config-options.d.ts.map +0 -1
- package/dist/utilities/extract-common-request-config-options.js +0 -12
- package/dist/utilities/extract-common-request-config-options.js.map +0 -1
- package/dist/utilities/fn-exec.d.ts +0 -3
- package/dist/utilities/fn-exec.d.ts.map +0 -1
- package/dist/utilities/fn-exec.js +0 -66
- package/dist/utilities/fn-exec.js.map +0 -1
- package/dist/utilities/function-cache-manager.d.ts +0 -32
- package/dist/utilities/function-cache-manager.d.ts.map +0 -1
- package/dist/utilities/function-cache-manager.js +0 -172
- package/dist/utilities/function-cache-manager.js.map +0 -1
- package/dist/utilities/prepare-api-function-options.d.ts +0 -3
- package/dist/utilities/prepare-api-function-options.d.ts.map +0 -1
- package/dist/utilities/prepare-api-function-options.js +0 -51
- package/dist/utilities/prepare-api-function-options.js.map +0 -1
- package/dist/utilities/prepare-api-request-data.d.ts +0 -3
- package/dist/utilities/prepare-api-request-data.d.ts.map +0 -1
- package/dist/utilities/prepare-api-request-data.js +0 -15
- package/dist/utilities/prepare-api-request-data.js.map +0 -1
- package/dist/utilities/prepare-api-request-options.d.ts +0 -3
- package/dist/utilities/prepare-api-request-options.d.ts.map +0 -1
- package/dist/utilities/prepare-api-request-options.js +0 -22
- package/dist/utilities/prepare-api-request-options.js.map +0 -1
- package/dist/utilities/rate-limiter.d.ts +0 -49
- package/dist/utilities/rate-limiter.d.ts.map +0 -1
- package/dist/utilities/rate-limiter.js +0 -197
- package/dist/utilities/rate-limiter.js.map +0 -1
- package/dist/utilities/validate-workflow-graph.d.ts +0 -7
- package/dist/utilities/validate-workflow-graph.d.ts.map +0 -1
- package/dist/utilities/validate-workflow-graph.js +0 -235
- package/dist/utilities/validate-workflow-graph.js.map +0 -1
- package/dist/utilities/workflow-graph-builder.d.ts +0 -37
- package/dist/utilities/workflow-graph-builder.d.ts.map +0 -1
- package/dist/utilities/workflow-graph-builder.js +0 -225
- package/dist/utilities/workflow-graph-builder.js.map +0 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import {
|
|
3
|
-
import { CircuitBreaker
|
|
2
|
+
import { REQUEST_METHODS, RESPONSE_ERRORS, RETRY_STRATEGIES, VALID_REQUEST_PROTOCOLS, AnomalySeverity, ViolationType, PersistenceStage, CircuitBreakerState } from '../enums/index.js';
|
|
3
|
+
import { CircuitBreaker } from '../utilities/index.js';
|
|
4
4
|
export type CreateHash = (algorithm: string) => {
|
|
5
5
|
update: (data: string) => {
|
|
6
6
|
digest: (encoding: 'hex') => string;
|
|
@@ -22,50 +22,6 @@ export interface MetricsGuardrailsRequest {
|
|
|
22
22
|
totalExecutionTime?: MetricGuardrail;
|
|
23
23
|
averageAttemptTime?: MetricGuardrail;
|
|
24
24
|
}
|
|
25
|
-
export interface MetricsGuardrailsApiGateway {
|
|
26
|
-
totalRequests?: MetricGuardrail;
|
|
27
|
-
successfulRequests?: MetricGuardrail;
|
|
28
|
-
failedRequests?: MetricGuardrail;
|
|
29
|
-
successRate?: MetricGuardrail;
|
|
30
|
-
failureRate?: MetricGuardrail;
|
|
31
|
-
executionTime?: MetricGuardrail;
|
|
32
|
-
throughput?: MetricGuardrail;
|
|
33
|
-
averageRequestDuration?: MetricGuardrail;
|
|
34
|
-
}
|
|
35
|
-
export interface MetricsGuardrailsWorkflow {
|
|
36
|
-
totalPhases?: MetricGuardrail;
|
|
37
|
-
completedPhases?: MetricGuardrail;
|
|
38
|
-
failedPhases?: MetricGuardrail;
|
|
39
|
-
totalRequests?: MetricGuardrail;
|
|
40
|
-
successfulRequests?: MetricGuardrail;
|
|
41
|
-
failedRequests?: MetricGuardrail;
|
|
42
|
-
requestSuccessRate?: MetricGuardrail;
|
|
43
|
-
requestFailureRate?: MetricGuardrail;
|
|
44
|
-
executionTime?: MetricGuardrail;
|
|
45
|
-
averagePhaseExecutionTime?: MetricGuardrail;
|
|
46
|
-
throughput?: MetricGuardrail;
|
|
47
|
-
phaseCompletionRate?: MetricGuardrail;
|
|
48
|
-
}
|
|
49
|
-
export interface MetricsGuardrailsPhase {
|
|
50
|
-
totalRequests?: MetricGuardrail;
|
|
51
|
-
successfulRequests?: MetricGuardrail;
|
|
52
|
-
failedRequests?: MetricGuardrail;
|
|
53
|
-
requestSuccessRate?: MetricGuardrail;
|
|
54
|
-
requestFailureRate?: MetricGuardrail;
|
|
55
|
-
executionTime?: MetricGuardrail;
|
|
56
|
-
}
|
|
57
|
-
export interface MetricsGuardrailsBranch {
|
|
58
|
-
totalPhases?: MetricGuardrail;
|
|
59
|
-
completedPhases?: MetricGuardrail;
|
|
60
|
-
failedPhases?: MetricGuardrail;
|
|
61
|
-
totalRequests?: MetricGuardrail;
|
|
62
|
-
successfulRequests?: MetricGuardrail;
|
|
63
|
-
failedRequests?: MetricGuardrail;
|
|
64
|
-
requestSuccessRate?: MetricGuardrail;
|
|
65
|
-
requestFailureRate?: MetricGuardrail;
|
|
66
|
-
executionTime?: MetricGuardrail;
|
|
67
|
-
phaseCompletionRate?: MetricGuardrail;
|
|
68
|
-
}
|
|
69
25
|
export interface MetricsGuardrailsCircuitBreaker {
|
|
70
26
|
failureRate?: MetricGuardrail;
|
|
71
27
|
totalRequests?: MetricGuardrail;
|
|
@@ -77,22 +33,9 @@ export interface MetricsGuardrailsCache {
|
|
|
77
33
|
utilizationPercentage?: MetricGuardrail;
|
|
78
34
|
evictionRate?: MetricGuardrail;
|
|
79
35
|
}
|
|
80
|
-
export interface MetricsGuardrailsRateLimiter {
|
|
81
|
-
throttleRate?: MetricGuardrail;
|
|
82
|
-
queueLength?: MetricGuardrail;
|
|
83
|
-
utilizationPercentage?: MetricGuardrail;
|
|
84
|
-
averageQueueWaitTime?: MetricGuardrail;
|
|
85
|
-
}
|
|
86
|
-
export interface MetricsGuardrailsConcurrencyLimiter {
|
|
87
|
-
utilizationPercentage?: MetricGuardrail;
|
|
88
|
-
queueLength?: MetricGuardrail;
|
|
89
|
-
averageQueueWaitTime?: MetricGuardrail;
|
|
90
|
-
}
|
|
91
36
|
export interface MetricsGuardrailsInfrastructure {
|
|
92
37
|
circuitBreaker?: MetricsGuardrailsCircuitBreaker;
|
|
93
38
|
cache?: MetricsGuardrailsCache;
|
|
94
|
-
rateLimiter?: MetricsGuardrailsRateLimiter;
|
|
95
|
-
concurrencyLimiter?: MetricsGuardrailsConcurrencyLimiter;
|
|
96
39
|
}
|
|
97
40
|
export interface MetricsGuardrailsCommon {
|
|
98
41
|
successRate?: MetricGuardrail;
|
|
@@ -100,33 +43,14 @@ export interface MetricsGuardrailsCommon {
|
|
|
100
43
|
executionTime?: MetricGuardrail;
|
|
101
44
|
throughput?: MetricGuardrail;
|
|
102
45
|
}
|
|
103
|
-
export interface MetricsGuardrailsScheduler {
|
|
104
|
-
totalJobs?: MetricGuardrail;
|
|
105
|
-
queued?: MetricGuardrail;
|
|
106
|
-
running?: MetricGuardrail;
|
|
107
|
-
completed?: MetricGuardrail;
|
|
108
|
-
failed?: MetricGuardrail;
|
|
109
|
-
dropped?: MetricGuardrail;
|
|
110
|
-
totalRuns?: MetricGuardrail;
|
|
111
|
-
successRate?: MetricGuardrail;
|
|
112
|
-
failureRate?: MetricGuardrail;
|
|
113
|
-
throughput?: MetricGuardrail;
|
|
114
|
-
averageExecutionTime?: MetricGuardrail;
|
|
115
|
-
averageQueueDelay?: MetricGuardrail;
|
|
116
|
-
}
|
|
117
46
|
export interface MetricsGuardrailsStableBuffer {
|
|
118
47
|
totalTransactions?: MetricGuardrail;
|
|
119
48
|
averageQueueWaitMs?: MetricGuardrail;
|
|
120
49
|
}
|
|
121
50
|
export interface MetricsGuardrails {
|
|
122
51
|
request?: MetricsGuardrailsRequest;
|
|
123
|
-
apiGateway?: MetricsGuardrailsApiGateway;
|
|
124
|
-
workflow?: MetricsGuardrailsWorkflow;
|
|
125
|
-
phase?: MetricsGuardrailsPhase;
|
|
126
|
-
branch?: MetricsGuardrailsBranch;
|
|
127
52
|
infrastructure?: MetricsGuardrailsInfrastructure;
|
|
128
53
|
common?: MetricsGuardrailsCommon;
|
|
129
|
-
scheduler?: MetricsGuardrailsScheduler;
|
|
130
54
|
stableBuffer?: MetricsGuardrailsStableBuffer;
|
|
131
55
|
}
|
|
132
56
|
export interface MetricAnomaly {
|
|
@@ -142,55 +66,6 @@ export interface MetricsValidationResult {
|
|
|
142
66
|
anomalies: MetricAnomaly[];
|
|
143
67
|
validatedAt: string;
|
|
144
68
|
}
|
|
145
|
-
export interface SchedulerInfrastructureMetrics {
|
|
146
|
-
circuitBreaker?: {
|
|
147
|
-
state: string;
|
|
148
|
-
totalRequests: number;
|
|
149
|
-
failedRequests: number;
|
|
150
|
-
successfulRequests: number;
|
|
151
|
-
failurePercentage: number;
|
|
152
|
-
};
|
|
153
|
-
rateLimiter?: {
|
|
154
|
-
totalRequests: number;
|
|
155
|
-
throttledRequests: number;
|
|
156
|
-
throttleRate: number;
|
|
157
|
-
queueLength: number;
|
|
158
|
-
averageQueueWaitTime: number;
|
|
159
|
-
};
|
|
160
|
-
concurrencyLimiter?: {
|
|
161
|
-
totalRequests: number;
|
|
162
|
-
completedRequests: number;
|
|
163
|
-
queuedRequests: number;
|
|
164
|
-
queueLength: number;
|
|
165
|
-
averageQueueWaitTime: number;
|
|
166
|
-
utilizationPercentage: number;
|
|
167
|
-
};
|
|
168
|
-
cacheManager?: {
|
|
169
|
-
hits: number;
|
|
170
|
-
misses: number;
|
|
171
|
-
hitRate: number;
|
|
172
|
-
missRate: number;
|
|
173
|
-
utilizationPercentage: number;
|
|
174
|
-
evictions: number;
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
export interface SchedulerMetrics {
|
|
178
|
-
totalJobs: number;
|
|
179
|
-
queued: number;
|
|
180
|
-
running: number;
|
|
181
|
-
completed: number;
|
|
182
|
-
failed: number;
|
|
183
|
-
dropped: number;
|
|
184
|
-
totalRuns: number;
|
|
185
|
-
successRate: number;
|
|
186
|
-
failureRate: number;
|
|
187
|
-
throughput: number;
|
|
188
|
-
averageExecutionTime: number;
|
|
189
|
-
averageQueueDelay: number;
|
|
190
|
-
startedAt?: string;
|
|
191
|
-
lastUpdated: string;
|
|
192
|
-
infrastructure?: SchedulerInfrastructureMetrics;
|
|
193
|
-
}
|
|
194
69
|
export interface StableBufferMetrics {
|
|
195
70
|
totalTransactions: number;
|
|
196
71
|
averageQueueWaitMs: number;
|
|
@@ -237,6 +112,15 @@ export interface StableBufferReplayResult {
|
|
|
237
112
|
error: unknown;
|
|
238
113
|
}>;
|
|
239
114
|
}
|
|
115
|
+
export type TransactionLogsLoader = (context: ExecutionContext) => StableBufferTransactionLog[] | Promise<StableBufferTransactionLog[]>;
|
|
116
|
+
export type StableBufferState = Record<string, any>;
|
|
117
|
+
export interface StableBufferOptions {
|
|
118
|
+
initialState?: StableBufferState;
|
|
119
|
+
clone?: (state: StableBufferState) => StableBufferState;
|
|
120
|
+
metricsGuardrails?: MetricsGuardrailsStableBuffer;
|
|
121
|
+
transactionTimeoutMs?: number;
|
|
122
|
+
logTransaction?: StableBufferTransactionLogger;
|
|
123
|
+
}
|
|
240
124
|
export interface ExecutionContext {
|
|
241
125
|
workflowId?: string;
|
|
242
126
|
branchId?: string;
|
|
@@ -244,123 +128,12 @@ export interface ExecutionContext {
|
|
|
244
128
|
requestId?: string;
|
|
245
129
|
}
|
|
246
130
|
export interface StableBufferInstance {
|
|
247
|
-
run<T>(fn: (state:
|
|
248
|
-
read():
|
|
249
|
-
getState():
|
|
250
|
-
setState(state:
|
|
131
|
+
run<T>(fn: (state: StableBufferState) => T | Promise<T>, options?: StableBufferTransactionOptions): Promise<T>;
|
|
132
|
+
read(): StableBufferState;
|
|
133
|
+
getState(): StableBufferState;
|
|
134
|
+
setState(state: StableBufferState): void;
|
|
251
135
|
}
|
|
252
136
|
export type BufferLike = Record<string, any> | StableBufferInstance;
|
|
253
|
-
export interface API_GATEWAY_OPTIONS<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
254
|
-
commonRequestData?: Partial<REQUEST_DATA<RequestDataType>>;
|
|
255
|
-
commonAttempts?: number;
|
|
256
|
-
commonHookParams?: HookParams;
|
|
257
|
-
commonPerformAllAttempts?: boolean;
|
|
258
|
-
commonWait?: number;
|
|
259
|
-
commonMaxAllowedWait?: number;
|
|
260
|
-
commonRetryStrategy?: RETRY_STRATEGY_TYPES;
|
|
261
|
-
commonJitter?: number;
|
|
262
|
-
commonLogAllErrors?: boolean;
|
|
263
|
-
commonLogAllSuccessfulAttempts?: boolean;
|
|
264
|
-
commonMaxSerializableChars?: number;
|
|
265
|
-
commonTrialMode?: TRIAL_MODE_OPTIONS;
|
|
266
|
-
commonResponseAnalyzer?: (options: ResponseAnalysisHookOptions<RequestDataType, ResponseDataType>) => boolean | Promise<boolean>;
|
|
267
|
-
commonResReq?: boolean;
|
|
268
|
-
commonFinalErrorAnalyzer?: (options: FinalErrorAnalysisHookOptions<RequestDataType>) => boolean | Promise<boolean>;
|
|
269
|
-
commonHandleErrors?: (options: HandleErrorHookOptions<RequestDataType>) => any | Promise<any>;
|
|
270
|
-
commonHandleSuccessfulAttemptData?: (options: HandleSuccessfulAttemptDataHookOptions<RequestDataType, ResponseDataType>) => any | Promise<any>;
|
|
271
|
-
commonPreExecution?: RequestPreExecutionOptions;
|
|
272
|
-
commonCache?: CacheConfig;
|
|
273
|
-
commonStatePersistence?: StatePersistenceConfig;
|
|
274
|
-
commonExecutionTimeout?: number;
|
|
275
|
-
commonFunctionHookParams?: FunctionHookParams;
|
|
276
|
-
commonFunctionResponseAnalyzer?: (options: FunctionResponseAnalysisHookOptions<FunctionArgsType, FunctionReturnType>) => boolean | Promise<boolean>;
|
|
277
|
-
commonReturnResult?: boolean;
|
|
278
|
-
commonFinalFunctionErrorAnalyzer?: (options: FinalFunctionErrorAnalysisHookOptions<FunctionArgsType>) => boolean | Promise<boolean>;
|
|
279
|
-
commonHandleFunctionErrors?: (options: HandleFunctionErrorHookOptions<FunctionArgsType>) => any | Promise<any>;
|
|
280
|
-
commonHandleSuccessfulFunctionAttemptData?: (options: HandleSuccessfulFunctionAttemptDataHookOptions<FunctionArgsType, FunctionReturnType>) => any | Promise<any>;
|
|
281
|
-
commonFunctionPreExecution?: FunctionPreExecutionOptions<FunctionArgsType, FunctionReturnType>;
|
|
282
|
-
commonFunctionCache?: FunctionCacheConfig<FunctionArgsType, FunctionReturnType>;
|
|
283
|
-
concurrentExecution?: boolean;
|
|
284
|
-
requestGroups?: RequestGroup<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
285
|
-
stopOnFirstError?: boolean;
|
|
286
|
-
sharedBuffer?: BufferLike;
|
|
287
|
-
maxConcurrentRequests?: number;
|
|
288
|
-
rateLimit?: RateLimitConfig;
|
|
289
|
-
circuitBreaker?: CircuitBreakerConfig | CircuitBreaker;
|
|
290
|
-
executionContext?: Partial<ExecutionContext>;
|
|
291
|
-
metricsGuardrails?: MetricsGuardrails;
|
|
292
|
-
enableRacing?: boolean;
|
|
293
|
-
maxTimeout?: number;
|
|
294
|
-
}
|
|
295
|
-
export interface RequestGroup<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
296
|
-
id: string;
|
|
297
|
-
commonConfig?: Omit<API_GATEWAY_OPTIONS<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>, "concurrentExecution" | "stopOnFirstError" | "requestGroups" | "maxConcurrentRequests" | "rateLimit" | "circuitBreaker" | "maxTimeout" | "executionContext" | "enableRacing" | "metricsGuardrails">;
|
|
298
|
-
}
|
|
299
|
-
export type API_GATEWAY_REQUEST_OPTIONS_TYPE<RequestDataType, ResponseDataType> = Omit<STABLE_REQUEST<RequestDataType, ResponseDataType>, 'reqData'> & {
|
|
300
|
-
reqData?: Partial<STABLE_REQUEST<RequestDataType, ResponseDataType>['reqData']>;
|
|
301
|
-
};
|
|
302
|
-
export interface API_GATEWAY_REQUEST<RequestDataType = any, ResponseDataType = any> {
|
|
303
|
-
id: string;
|
|
304
|
-
groupId?: string;
|
|
305
|
-
requestOptions: API_GATEWAY_REQUEST_OPTIONS_TYPE<RequestDataType, ResponseDataType>;
|
|
306
|
-
}
|
|
307
|
-
export type API_GATEWAY_FUNCTION_OPTIONS_TYPE<FunctionArgsType extends any[], FunctionReturnType> = Omit<STABLE_FUNCTION<FunctionArgsType, FunctionReturnType>, 'fn' | 'args'> & {
|
|
308
|
-
fn?: STABLE_FUNCTION<FunctionArgsType, FunctionReturnType>['fn'];
|
|
309
|
-
args?: FunctionArgsType;
|
|
310
|
-
};
|
|
311
|
-
export interface API_GATEWAY_FUNCTION<FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
312
|
-
id: string;
|
|
313
|
-
groupId?: string;
|
|
314
|
-
functionOptions: API_GATEWAY_FUNCTION_OPTIONS_TYPE<FunctionArgsType, FunctionReturnType>;
|
|
315
|
-
}
|
|
316
|
-
export type RequestOrFunctionType = RequestOrFunction.REQUEST | RequestOrFunction.FUNCTION;
|
|
317
|
-
export type API_GATEWAY_ITEM<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> = {
|
|
318
|
-
type: RequestOrFunction.REQUEST;
|
|
319
|
-
request: API_GATEWAY_REQUEST<RequestDataType, ResponseDataType>;
|
|
320
|
-
} | {
|
|
321
|
-
type: RequestOrFunction.FUNCTION;
|
|
322
|
-
function: API_GATEWAY_FUNCTION<FunctionArgsType, FunctionReturnType>;
|
|
323
|
-
};
|
|
324
|
-
export interface API_GATEWAY_RESPONSE<ResponseDataType = any, FunctionReturnType = any> {
|
|
325
|
-
requestId: string;
|
|
326
|
-
groupId?: string;
|
|
327
|
-
success: boolean;
|
|
328
|
-
data?: ResponseDataType | FunctionReturnType | boolean;
|
|
329
|
-
error?: string;
|
|
330
|
-
type?: RequestOrFunctionType;
|
|
331
|
-
}
|
|
332
|
-
export interface ApiGatewayInfrastructureMetrics {
|
|
333
|
-
circuitBreaker?: CircuitBreakerDashboardMetrics;
|
|
334
|
-
cache?: CacheDashboardMetrics;
|
|
335
|
-
rateLimiter?: RateLimiterDashboardMetrics;
|
|
336
|
-
concurrencyLimiter?: ConcurrencyLimiterDashboardMetrics;
|
|
337
|
-
}
|
|
338
|
-
export interface ApiGatewayMetrics {
|
|
339
|
-
totalRequests: number;
|
|
340
|
-
successfulRequests: number;
|
|
341
|
-
failedRequests: number;
|
|
342
|
-
successRate: number;
|
|
343
|
-
failureRate: number;
|
|
344
|
-
executionTime: number;
|
|
345
|
-
timestamp: string;
|
|
346
|
-
throughput: number;
|
|
347
|
-
averageRequestDuration: number;
|
|
348
|
-
requestGroups?: RequestGroupMetrics[];
|
|
349
|
-
infrastructureMetrics?: ApiGatewayInfrastructureMetrics;
|
|
350
|
-
validation?: MetricsValidationResult;
|
|
351
|
-
}
|
|
352
|
-
export interface API_GATEWAY_RESULT<ResponseDataType = any, FunctionReturnType = any> extends Array<API_GATEWAY_RESPONSE<ResponseDataType, FunctionReturnType>> {
|
|
353
|
-
metrics?: ApiGatewayMetrics;
|
|
354
|
-
}
|
|
355
|
-
export type ApiRequestOptionsMapping = {
|
|
356
|
-
localKey: string;
|
|
357
|
-
commonKey: string;
|
|
358
|
-
groupCommonKey: string;
|
|
359
|
-
targetKey: string;
|
|
360
|
-
};
|
|
361
|
-
export type CONCURRENT_REQUEST_EXECUTION_OPTIONS<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> = Omit<API_GATEWAY_OPTIONS<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>, "concurrentExecution"> & {
|
|
362
|
-
executionContext?: Partial<ExecutionContext>;
|
|
363
|
-
};
|
|
364
137
|
export interface ERROR_LOG {
|
|
365
138
|
timestamp: string;
|
|
366
139
|
executionTime: number;
|
|
@@ -370,6 +143,7 @@ export interface ERROR_LOG {
|
|
|
370
143
|
type: RESPONSE_ERROR_TYPES;
|
|
371
144
|
isRetryable: boolean;
|
|
372
145
|
}
|
|
146
|
+
type RESPONSE_ERROR_TYPES = RESPONSE_ERRORS.HTTP_ERROR | RESPONSE_ERRORS.INVALID_CONTENT;
|
|
373
147
|
export interface ReqFnResponse<ResponseDataType = any> {
|
|
374
148
|
ok: boolean;
|
|
375
149
|
isRetryable: boolean;
|
|
@@ -382,18 +156,8 @@ export interface ReqFnResponse<ResponseDataType = any> {
|
|
|
382
156
|
};
|
|
383
157
|
fromCache?: boolean;
|
|
384
158
|
}
|
|
385
|
-
export interface FnExecResponse<FunctionReturnType = any> {
|
|
386
|
-
ok: boolean;
|
|
387
|
-
isRetryable: boolean;
|
|
388
|
-
timestamp: string;
|
|
389
|
-
executionTime: number;
|
|
390
|
-
error?: string;
|
|
391
|
-
data?: FunctionReturnType | {
|
|
392
|
-
trialMode: TRIAL_MODE_OPTIONS;
|
|
393
|
-
};
|
|
394
|
-
fromCache?: boolean;
|
|
395
|
-
}
|
|
396
159
|
export type REQUEST_METHOD_TYPES = REQUEST_METHODS.GET | REQUEST_METHODS.POST | REQUEST_METHODS.DELETE | REQUEST_METHODS.PATCH | REQUEST_METHODS.PUT;
|
|
160
|
+
export type VALID_REQUEST_PROTOCOL_TYPES = VALID_REQUEST_PROTOCOLS.HTTP | VALID_REQUEST_PROTOCOLS.HTTPS;
|
|
397
161
|
export interface REQUEST_DATA<RequestDataType = any> {
|
|
398
162
|
hostname: string;
|
|
399
163
|
protocol?: VALID_REQUEST_PROTOCOL_TYPES;
|
|
@@ -406,11 +170,7 @@ export interface REQUEST_DATA<RequestDataType = any> {
|
|
|
406
170
|
timeout?: number;
|
|
407
171
|
signal?: AbortSignal;
|
|
408
172
|
}
|
|
409
|
-
type RESPONSE_ERROR_TYPES = RESPONSE_ERRORS.HTTP_ERROR | RESPONSE_ERRORS.INVALID_CONTENT;
|
|
410
173
|
export type RETRY_STRATEGY_TYPES = RETRY_STRATEGIES.FIXED | RETRY_STRATEGIES.LINEAR | RETRY_STRATEGIES.EXPONENTIAL;
|
|
411
|
-
export type SEQUENTIAL_REQUEST_EXECUTION_OPTIONS<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> = Omit<API_GATEWAY_OPTIONS<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>, "concurrentExecution"> & {
|
|
412
|
-
executionContext?: Partial<ExecutionContext>;
|
|
413
|
-
};
|
|
414
174
|
interface ObservabilityHooksOptions<RequestDataType = any> {
|
|
415
175
|
reqData: AxiosRequestConfig<RequestDataType>;
|
|
416
176
|
params?: any;
|
|
@@ -418,6 +178,7 @@ interface ObservabilityHooksOptions<RequestDataType = any> {
|
|
|
418
178
|
preExecutionResult?: any;
|
|
419
179
|
commonBuffer?: Record<string, any>;
|
|
420
180
|
executionContext?: ExecutionContext;
|
|
181
|
+
transactionLogs?: StableBufferTransactionLog[];
|
|
421
182
|
}
|
|
422
183
|
interface AnalysisHookOptions<RequestDataType = any> extends Omit<ObservabilityHooksOptions<RequestDataType>, "maxSerializableChars"> {
|
|
423
184
|
trialMode?: TRIAL_MODE_OPTIONS;
|
|
@@ -425,6 +186,7 @@ interface AnalysisHookOptions<RequestDataType = any> extends Omit<ObservabilityH
|
|
|
425
186
|
preExecutionResult?: any;
|
|
426
187
|
executionContext?: ExecutionContext;
|
|
427
188
|
commonBuffer?: Record<string, any>;
|
|
189
|
+
transactionLogs?: StableBufferTransactionLog[];
|
|
428
190
|
}
|
|
429
191
|
export interface ResponseAnalysisHookOptions<RequestDataType = any, ResponseDataType = any> extends AnalysisHookOptions<RequestDataType> {
|
|
430
192
|
data: ResponseDataType;
|
|
@@ -444,65 +206,11 @@ export interface HookParams {
|
|
|
444
206
|
handleErrorsParams?: any;
|
|
445
207
|
finalErrorAnalyzerParams?: any;
|
|
446
208
|
}
|
|
447
|
-
export interface FunctionHookParams {
|
|
448
|
-
responseAnalyzerParams?: any;
|
|
449
|
-
handleSuccessfulAttemptDataParams?: any;
|
|
450
|
-
handleErrorsParams?: any;
|
|
451
|
-
finalErrorAnalyzerParams?: any;
|
|
452
|
-
}
|
|
453
|
-
interface FunctionObservabilityHooksOptions<FunctionArgsType extends any[] = any[]> {
|
|
454
|
-
fn: (...args: FunctionArgsType) => any;
|
|
455
|
-
args: FunctionArgsType;
|
|
456
|
-
params?: any;
|
|
457
|
-
maxSerializableChars?: number;
|
|
458
|
-
preExecutionResult?: any;
|
|
459
|
-
commonBuffer?: Record<string, any>;
|
|
460
|
-
executionContext?: ExecutionContext;
|
|
461
|
-
}
|
|
462
|
-
interface FunctionAnalysisHookOptions<FunctionArgsType extends any[] = any[]> extends Omit<FunctionObservabilityHooksOptions<FunctionArgsType>, "maxSerializableChars"> {
|
|
463
|
-
trialMode?: TRIAL_MODE_OPTIONS;
|
|
464
|
-
params?: any;
|
|
465
|
-
preExecutionResult?: any;
|
|
466
|
-
executionContext?: ExecutionContext;
|
|
467
|
-
commonBuffer?: Record<string, any>;
|
|
468
|
-
}
|
|
469
|
-
export interface FunctionResponseAnalysisHookOptions<FunctionArgsType extends any[] = any[], FunctionReturnType = any> extends FunctionAnalysisHookOptions<FunctionArgsType> {
|
|
470
|
-
data: FunctionReturnType;
|
|
471
|
-
}
|
|
472
|
-
export interface FinalFunctionErrorAnalysisHookOptions<FunctionArgsType extends any[] = any[]> extends FunctionAnalysisHookOptions<FunctionArgsType> {
|
|
473
|
-
error: any;
|
|
474
|
-
}
|
|
475
|
-
export interface HandleFunctionErrorHookOptions<FunctionArgsType extends any[] = any[]> extends FunctionObservabilityHooksOptions<FunctionArgsType> {
|
|
476
|
-
errorLog: FUNCTION_ERROR_LOG;
|
|
477
|
-
}
|
|
478
|
-
export interface HandleSuccessfulFunctionAttemptDataHookOptions<FunctionArgsType extends any[] = any[], FunctionReturnType = any> extends FunctionObservabilityHooksOptions<FunctionArgsType> {
|
|
479
|
-
successfulAttemptData: SUCCESSFUL_FUNCTION_ATTEMPT_DATA<FunctionReturnType>;
|
|
480
|
-
}
|
|
481
209
|
export interface PreExecutionHookOptions<RequestDataType = any, ResponseDataType = any> {
|
|
482
210
|
inputParams?: any;
|
|
483
211
|
commonBuffer?: Record<string, any>;
|
|
484
212
|
stableRequestOptions: STABLE_REQUEST<RequestDataType, ResponseDataType>;
|
|
485
|
-
|
|
486
|
-
export interface FunctionPreExecutionHookOptions<FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
487
|
-
inputParams?: any;
|
|
488
|
-
commonBuffer?: Record<string, any>;
|
|
489
|
-
stableFunctionOptions: STABLE_FUNCTION<FunctionArgsType, FunctionReturnType>;
|
|
490
|
-
}
|
|
491
|
-
interface WorkflowPreExecutionHookOptions {
|
|
492
|
-
params?: any;
|
|
493
|
-
sharedBuffer?: Record<string, any>;
|
|
494
|
-
workflowId: string;
|
|
495
|
-
branchId?: string;
|
|
496
|
-
}
|
|
497
|
-
export interface PrePhaseExecutionHookOptions<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> extends WorkflowPreExecutionHookOptions {
|
|
498
|
-
phaseId: string;
|
|
499
|
-
phaseIndex: number;
|
|
500
|
-
phase: STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
501
|
-
}
|
|
502
|
-
export interface PreBranchExecutionHookOptions<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> extends Omit<WorkflowPreExecutionHookOptions, 'branchId'> {
|
|
503
|
-
branchId: string;
|
|
504
|
-
branchIndex: number;
|
|
505
|
-
branch: STABLE_WORKFLOW_BRANCH<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
213
|
+
transactionLogs?: StableBufferTransactionLog[];
|
|
506
214
|
}
|
|
507
215
|
export interface RequestPreExecutionOptions<RequestDataType = any, ResponseDataType = any> {
|
|
508
216
|
preExecutionHook: (options: PreExecutionHookOptions<RequestDataType, ResponseDataType>) => any | Promise<any>;
|
|
@@ -510,12 +218,6 @@ export interface RequestPreExecutionOptions<RequestDataType = any, ResponseDataT
|
|
|
510
218
|
applyPreExecutionConfigOverride?: boolean;
|
|
511
219
|
continueOnPreExecutionHookFailure?: boolean;
|
|
512
220
|
}
|
|
513
|
-
export interface FunctionPreExecutionOptions<FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
514
|
-
preExecutionHook: (options: FunctionPreExecutionHookOptions<FunctionArgsType, FunctionReturnType>) => any | Promise<any>;
|
|
515
|
-
preExecutionHookParams?: any;
|
|
516
|
-
applyPreExecutionConfigOverride?: boolean;
|
|
517
|
-
continueOnPreExecutionHookFailure?: boolean;
|
|
518
|
-
}
|
|
519
221
|
export interface StatePersistenceOptions {
|
|
520
222
|
executionContext: ExecutionContext;
|
|
521
223
|
persistenceStage: PersistenceStage;
|
|
@@ -528,251 +230,6 @@ export interface StatePersistenceConfig {
|
|
|
528
230
|
loadBeforeHooks?: boolean;
|
|
529
231
|
storeAfterHooks?: boolean;
|
|
530
232
|
}
|
|
531
|
-
export interface STABLE_REQUEST<RequestDataType = any, ResponseDataType = any> {
|
|
532
|
-
reqData: REQUEST_DATA<RequestDataType>;
|
|
533
|
-
responseAnalyzer?: (options: ResponseAnalysisHookOptions<RequestDataType, ResponseDataType>) => boolean | Promise<boolean>;
|
|
534
|
-
resReq?: boolean;
|
|
535
|
-
attempts?: number;
|
|
536
|
-
performAllAttempts?: boolean;
|
|
537
|
-
wait?: number;
|
|
538
|
-
maxAllowedWait?: number;
|
|
539
|
-
retryStrategy?: RETRY_STRATEGY_TYPES;
|
|
540
|
-
jitter?: number;
|
|
541
|
-
logAllErrors?: boolean;
|
|
542
|
-
handleErrors?: (options: HandleErrorHookOptions<RequestDataType>) => any | Promise<any>;
|
|
543
|
-
logAllSuccessfulAttempts?: boolean;
|
|
544
|
-
handleSuccessfulAttemptData?: (options: HandleSuccessfulAttemptDataHookOptions<RequestDataType, ResponseDataType>) => any | Promise<any>;
|
|
545
|
-
maxSerializableChars?: number;
|
|
546
|
-
finalErrorAnalyzer?: (options: FinalErrorAnalysisHookOptions<RequestDataType>) => boolean | Promise<boolean>;
|
|
547
|
-
trialMode?: TRIAL_MODE_OPTIONS;
|
|
548
|
-
hookParams?: HookParams;
|
|
549
|
-
preExecution?: RequestPreExecutionOptions;
|
|
550
|
-
commonBuffer?: BufferLike;
|
|
551
|
-
cache?: CacheConfig;
|
|
552
|
-
executionContext?: ExecutionContext;
|
|
553
|
-
circuitBreaker?: CircuitBreakerConfig | CircuitBreaker;
|
|
554
|
-
statePersistence?: StatePersistenceConfig;
|
|
555
|
-
metricsGuardrails?: MetricsGuardrails;
|
|
556
|
-
throwOnFailedErrorAnalysis?: boolean;
|
|
557
|
-
}
|
|
558
|
-
export interface STABLE_FUNCTION<FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
559
|
-
fn: (...args: FunctionArgsType) => FunctionReturnType | Promise<FunctionReturnType>;
|
|
560
|
-
args: FunctionArgsType;
|
|
561
|
-
responseAnalyzer?: (options: FunctionResponseAnalysisHookOptions<FunctionArgsType, FunctionReturnType>) => boolean | Promise<boolean>;
|
|
562
|
-
returnResult?: boolean;
|
|
563
|
-
attempts?: number;
|
|
564
|
-
performAllAttempts?: boolean;
|
|
565
|
-
wait?: number;
|
|
566
|
-
maxAllowedWait?: number;
|
|
567
|
-
retryStrategy?: RETRY_STRATEGY_TYPES;
|
|
568
|
-
jitter?: number;
|
|
569
|
-
logAllErrors?: boolean;
|
|
570
|
-
handleErrors?: (options: HandleFunctionErrorHookOptions<FunctionArgsType>) => any | Promise<any>;
|
|
571
|
-
logAllSuccessfulAttempts?: boolean;
|
|
572
|
-
handleSuccessfulAttemptData?: (options: HandleSuccessfulFunctionAttemptDataHookOptions<FunctionArgsType, FunctionReturnType>) => any | Promise<any>;
|
|
573
|
-
maxSerializableChars?: number;
|
|
574
|
-
finalErrorAnalyzer?: (options: FinalFunctionErrorAnalysisHookOptions<FunctionArgsType>) => boolean | Promise<boolean>;
|
|
575
|
-
trialMode?: TRIAL_MODE_OPTIONS;
|
|
576
|
-
hookParams?: FunctionHookParams;
|
|
577
|
-
preExecution?: FunctionPreExecutionOptions<FunctionArgsType, FunctionReturnType>;
|
|
578
|
-
commonBuffer?: BufferLike;
|
|
579
|
-
cache?: FunctionCacheConfig<FunctionArgsType, FunctionReturnType>;
|
|
580
|
-
executionContext?: ExecutionContext;
|
|
581
|
-
circuitBreaker?: CircuitBreakerConfig | CircuitBreaker;
|
|
582
|
-
statePersistence?: StatePersistenceConfig;
|
|
583
|
-
rateLimit?: RateLimitConfig;
|
|
584
|
-
maxConcurrentRequests?: number;
|
|
585
|
-
metricsGuardrails?: MetricsGuardrails;
|
|
586
|
-
throwOnFailedErrorAnalysis?: boolean;
|
|
587
|
-
executionTimeout?: number;
|
|
588
|
-
}
|
|
589
|
-
export interface StableRequestInfrastructureMetrics {
|
|
590
|
-
circuitBreaker?: CircuitBreakerDashboardMetrics;
|
|
591
|
-
cache?: CacheDashboardMetrics;
|
|
592
|
-
}
|
|
593
|
-
export interface StableRequestMetrics {
|
|
594
|
-
totalAttempts: number;
|
|
595
|
-
successfulAttempts: number;
|
|
596
|
-
failedAttempts: number;
|
|
597
|
-
totalExecutionTime: number;
|
|
598
|
-
averageAttemptTime: number;
|
|
599
|
-
infrastructureMetrics?: StableRequestInfrastructureMetrics;
|
|
600
|
-
validation?: MetricsValidationResult;
|
|
601
|
-
}
|
|
602
|
-
export interface StableFunctionInfrastructureMetrics {
|
|
603
|
-
circuitBreaker?: CircuitBreakerDashboardMetrics;
|
|
604
|
-
cache?: CacheDashboardMetrics;
|
|
605
|
-
rateLimiter?: RateLimiterDashboardMetrics;
|
|
606
|
-
concurrencyLimiter?: ConcurrencyLimiterDashboardMetrics;
|
|
607
|
-
}
|
|
608
|
-
export interface StableFunctionMetrics {
|
|
609
|
-
totalAttempts: number;
|
|
610
|
-
successfulAttempts: number;
|
|
611
|
-
failedAttempts: number;
|
|
612
|
-
totalExecutionTime: number;
|
|
613
|
-
averageAttemptTime: number;
|
|
614
|
-
infrastructureMetrics?: StableFunctionInfrastructureMetrics;
|
|
615
|
-
validation?: MetricsValidationResult;
|
|
616
|
-
}
|
|
617
|
-
export interface STABLE_REQUEST_RESULT<ResponseDataType = any> {
|
|
618
|
-
success: boolean;
|
|
619
|
-
data?: ResponseDataType | boolean;
|
|
620
|
-
error?: string;
|
|
621
|
-
errorLogs?: ERROR_LOG[];
|
|
622
|
-
successfulAttempts?: SUCCESSFUL_ATTEMPT_DATA<ResponseDataType>[];
|
|
623
|
-
metrics?: StableRequestMetrics;
|
|
624
|
-
}
|
|
625
|
-
export interface STABLE_FUNCTION_RESULT<FunctionReturnType = any, ReturnResult extends boolean = boolean> {
|
|
626
|
-
success: boolean;
|
|
627
|
-
data?: ReturnResult extends true ? FunctionReturnType : boolean;
|
|
628
|
-
error?: string;
|
|
629
|
-
errorLogs?: FUNCTION_ERROR_LOG[];
|
|
630
|
-
successfulAttempts?: SUCCESSFUL_FUNCTION_ATTEMPT_DATA<FunctionReturnType>[];
|
|
631
|
-
metrics?: StableFunctionMetrics;
|
|
632
|
-
}
|
|
633
|
-
export interface SUCCESSFUL_ATTEMPT_DATA<ResponseDataType = any> {
|
|
634
|
-
attempt: string;
|
|
635
|
-
timestamp: string;
|
|
636
|
-
executionTime: number;
|
|
637
|
-
data: ResponseDataType;
|
|
638
|
-
statusCode: number;
|
|
639
|
-
}
|
|
640
|
-
export interface SUCCESSFUL_FUNCTION_ATTEMPT_DATA<FunctionReturnType = any> {
|
|
641
|
-
attempt: string;
|
|
642
|
-
timestamp: string;
|
|
643
|
-
executionTime: number;
|
|
644
|
-
data: FunctionReturnType;
|
|
645
|
-
}
|
|
646
|
-
export interface FUNCTION_ERROR_LOG {
|
|
647
|
-
timestamp: string;
|
|
648
|
-
executionTime: number;
|
|
649
|
-
attempt: string;
|
|
650
|
-
error: string;
|
|
651
|
-
isRetryable: boolean;
|
|
652
|
-
}
|
|
653
|
-
export interface TRIAL_MODE_OPTIONS {
|
|
654
|
-
enabled: boolean;
|
|
655
|
-
reqFailureProbability?: number;
|
|
656
|
-
retryFailureProbability?: number;
|
|
657
|
-
}
|
|
658
|
-
export type VALID_REQUEST_PROTOCOL_TYPES = VALID_REQUEST_PROTOCOLS.HTTP | VALID_REQUEST_PROTOCOLS.HTTPS;
|
|
659
|
-
export interface STABLE_WORKFLOW_PHASE<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
660
|
-
id?: string;
|
|
661
|
-
requests?: API_GATEWAY_REQUEST<RequestDataType, ResponseDataType>[];
|
|
662
|
-
functions?: API_GATEWAY_FUNCTION<FunctionArgsType, FunctionReturnType>[];
|
|
663
|
-
items?: API_GATEWAY_ITEM<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
664
|
-
concurrentExecution?: boolean;
|
|
665
|
-
stopOnFirstError?: boolean;
|
|
666
|
-
markConcurrentPhase?: boolean;
|
|
667
|
-
maxConcurrentRequests?: number;
|
|
668
|
-
rateLimit?: RateLimitConfig;
|
|
669
|
-
circuitBreaker?: CircuitBreakerConfig;
|
|
670
|
-
maxReplayCount?: number;
|
|
671
|
-
allowReplay?: boolean;
|
|
672
|
-
allowSkip?: boolean;
|
|
673
|
-
phaseDecisionHook?: (options: PhaseDecisionHookOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => PhaseExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType> | Promise<PhaseExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
674
|
-
commonConfig?: Omit<API_GATEWAY_OPTIONS<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>, 'concurrentExecution' | 'stopOnFirstError' | 'requestGroups' | "maxConcurrentRequests" | "rateLimit" | "circuitBreaker" | "maxTimeout" | "executionContext" | "metricsGuardrails">;
|
|
675
|
-
branchId?: string;
|
|
676
|
-
statePersistence?: StatePersistenceConfig;
|
|
677
|
-
metricsGuardrails?: MetricsGuardrails;
|
|
678
|
-
maxTimeout?: number;
|
|
679
|
-
}
|
|
680
|
-
export interface STABLE_WORKFLOW_OPTIONS<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> extends Omit<API_GATEWAY_OPTIONS<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>, 'concurrentExecution' | 'stopOnFirstError' | 'commonMaxSerializableChars'> {
|
|
681
|
-
workflowId?: string;
|
|
682
|
-
startPhaseIndex?: number;
|
|
683
|
-
stopOnFirstPhaseError?: boolean;
|
|
684
|
-
logPhaseResults?: boolean;
|
|
685
|
-
concurrentPhaseExecution?: boolean;
|
|
686
|
-
enableBranchExecution?: boolean;
|
|
687
|
-
enableBranchRacing?: boolean;
|
|
688
|
-
branches?: STABLE_WORKFLOW_BRANCH<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
689
|
-
enableMixedExecution?: boolean;
|
|
690
|
-
enableNonLinearExecution?: boolean;
|
|
691
|
-
maxWorkflowIterations?: number;
|
|
692
|
-
statePersistence?: StatePersistenceConfig;
|
|
693
|
-
handlePhaseCompletion?: (options: HandlePhaseCompletionHookOptions<ResponseDataType, FunctionReturnType>) => any | Promise<any>;
|
|
694
|
-
handlePhaseError?: (options: HandlePhaseErrorHookOptions<ResponseDataType, FunctionReturnType>) => any | Promise<any>;
|
|
695
|
-
handlePhaseDecision?: (options: HandlePhaseDecisionHookOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => any | Promise<any>;
|
|
696
|
-
handleBranchCompletion?: (options: HandleBranchCompletionHookOptions<ResponseDataType, FunctionReturnType>) => any | Promise<any>;
|
|
697
|
-
handleBranchDecision?: (decision: BranchExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>, branchResult: BranchExecutionResult<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>, maxSerializableChars?: number) => any | Promise<any>;
|
|
698
|
-
prePhaseExecutionHook?: (options: PrePhaseExecutionHookOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType> | Promise<STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
699
|
-
preBranchExecutionHook?: (options: PreBranchExecutionHookOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => STABLE_WORKFLOW_BRANCH<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType> | Promise<STABLE_WORKFLOW_BRANCH<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
700
|
-
maxSerializableChars?: number;
|
|
701
|
-
workflowHookParams?: WorkflowHookParams;
|
|
702
|
-
}
|
|
703
|
-
export interface WorkflowInfrastructureMetrics {
|
|
704
|
-
circuitBreaker?: CircuitBreakerDashboardMetrics;
|
|
705
|
-
cache?: CacheDashboardMetrics;
|
|
706
|
-
rateLimiter?: RateLimiterDashboardMetrics;
|
|
707
|
-
concurrencyLimiter?: ConcurrencyLimiterDashboardMetrics;
|
|
708
|
-
}
|
|
709
|
-
export interface STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType = any, FunctionReturnType = any, RequestDataType = any, FunctionArgsType extends any[] = any[]> {
|
|
710
|
-
workflowId: string;
|
|
711
|
-
branchId?: string;
|
|
712
|
-
phaseId: string;
|
|
713
|
-
phaseIndex: number;
|
|
714
|
-
success: boolean;
|
|
715
|
-
executionTime: number;
|
|
716
|
-
timestamp: string;
|
|
717
|
-
totalRequests: number;
|
|
718
|
-
successfulRequests: number;
|
|
719
|
-
failedRequests: number;
|
|
720
|
-
responses: API_GATEWAY_RESPONSE<ResponseDataType, FunctionReturnType>[];
|
|
721
|
-
executionNumber?: number;
|
|
722
|
-
skipped?: boolean;
|
|
723
|
-
decision?: PhaseExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
724
|
-
error?: string;
|
|
725
|
-
metrics?: PhaseMetrics;
|
|
726
|
-
validation?: MetricsValidationResult;
|
|
727
|
-
infrastructureMetrics?: WorkflowInfrastructureMetrics;
|
|
728
|
-
}
|
|
729
|
-
export interface STABLE_WORKFLOW_RESULT<ResponseDataType = any, FunctionReturnType = any, RequestDataType = any, FunctionArgsType extends any[] = any[]> {
|
|
730
|
-
workflowId: string;
|
|
731
|
-
success: boolean;
|
|
732
|
-
executionTime: number;
|
|
733
|
-
timestamp: string;
|
|
734
|
-
totalPhases: number;
|
|
735
|
-
completedPhases: number;
|
|
736
|
-
totalRequests: number;
|
|
737
|
-
successfulRequests: number;
|
|
738
|
-
failedRequests: number;
|
|
739
|
-
phases: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>[];
|
|
740
|
-
executionHistory: PhaseExecutionRecord<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
741
|
-
branches?: BranchExecutionResult<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>[];
|
|
742
|
-
branchExecutionHistory?: BranchExecutionRecord<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
743
|
-
terminatedEarly?: boolean;
|
|
744
|
-
terminationReason?: string;
|
|
745
|
-
error?: string;
|
|
746
|
-
metrics?: WorkflowMetrics;
|
|
747
|
-
validation?: MetricsValidationResult;
|
|
748
|
-
requestGroupMetrics?: RequestGroupMetrics[];
|
|
749
|
-
infrastructureMetrics?: WorkflowInfrastructureMetrics;
|
|
750
|
-
}
|
|
751
|
-
export interface WorkflowHookParams {
|
|
752
|
-
handlePhaseCompletionParams?: any;
|
|
753
|
-
handlePhaseErrorParams?: any;
|
|
754
|
-
handlePhaseDecisionParams?: any;
|
|
755
|
-
handleBranchDecisionParams?: any;
|
|
756
|
-
prePhaseExecutionHookParams?: any;
|
|
757
|
-
preBranchExecutionHookParams?: any;
|
|
758
|
-
statePersistence?: StatePersistenceConfig;
|
|
759
|
-
}
|
|
760
|
-
export interface HandlePhaseCompletionHookOptions<ResponseDataType = any, FunctionReturnType = any> {
|
|
761
|
-
workflowId: string;
|
|
762
|
-
branchId?: string;
|
|
763
|
-
phaseResult: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType>;
|
|
764
|
-
maxSerializableChars?: number;
|
|
765
|
-
params?: any;
|
|
766
|
-
sharedBuffer?: Record<string, any>;
|
|
767
|
-
}
|
|
768
|
-
export interface HandlePhaseErrorHookOptions<ResponseDataType = any, FunctionReturnType = any> extends HandlePhaseCompletionHookOptions<ResponseDataType, FunctionReturnType> {
|
|
769
|
-
error: any;
|
|
770
|
-
}
|
|
771
|
-
export interface HandlePhaseDecisionHookOptions<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
772
|
-
decision: PhaseExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
773
|
-
phaseResult: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType>;
|
|
774
|
-
maxSerializableChars?: number;
|
|
775
|
-
}
|
|
776
233
|
export type InfrastructurePersistenceOperationType = 'load' | 'store';
|
|
777
234
|
export interface InfrastructurePersistenceOperation<TState> {
|
|
778
235
|
operationId: string;
|
|
@@ -812,27 +269,36 @@ export interface CircuitBreakerPersistedState {
|
|
|
812
269
|
successfulRecoveries: number;
|
|
813
270
|
failedRecoveries: number;
|
|
814
271
|
}
|
|
815
|
-
export interface
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
peakRequestRate: number;
|
|
824
|
-
requestsInCurrentWindow: number;
|
|
825
|
-
windowStartTime: number;
|
|
272
|
+
export interface CircuitBreakerConfig {
|
|
273
|
+
failureThresholdPercentage: number;
|
|
274
|
+
minimumRequests: number;
|
|
275
|
+
recoveryTimeoutMs: number;
|
|
276
|
+
successThresholdPercentage?: number;
|
|
277
|
+
halfOpenMaxRequests?: number;
|
|
278
|
+
trackIndividualAttempts?: boolean;
|
|
279
|
+
persistence?: InfrastructurePersistence<CircuitBreakerPersistedState>;
|
|
826
280
|
}
|
|
827
|
-
export interface
|
|
281
|
+
export interface CircuitBreakerDashboardMetrics {
|
|
282
|
+
state: string;
|
|
283
|
+
isHealthy: boolean;
|
|
828
284
|
totalRequests: number;
|
|
829
|
-
|
|
285
|
+
successfulRequests: number;
|
|
830
286
|
failedRequests: number;
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
287
|
+
failurePercentage: number;
|
|
288
|
+
stateTransitions: number;
|
|
289
|
+
lastStateChangeTime: number;
|
|
290
|
+
timeSinceLastStateChange: number;
|
|
291
|
+
openCount: number;
|
|
292
|
+
totalOpenDuration: number;
|
|
293
|
+
averageOpenDuration: number;
|
|
294
|
+
isCurrentlyOpen: boolean;
|
|
295
|
+
openUntil: number | null;
|
|
296
|
+
timeUntilRecovery: number | null;
|
|
297
|
+
recoveryAttempts: number;
|
|
298
|
+
successfulRecoveries: number;
|
|
299
|
+
failedRecoveries: number;
|
|
300
|
+
recoverySuccessRate: number;
|
|
301
|
+
config: Required<Omit<CircuitBreakerConfig, 'persistence'>>;
|
|
836
302
|
}
|
|
837
303
|
export interface CacheManagerPersistedState {
|
|
838
304
|
entries: Array<{
|
|
@@ -846,36 +312,6 @@ export interface CacheManagerPersistedState {
|
|
|
846
312
|
evictions: number;
|
|
847
313
|
expirations: number;
|
|
848
314
|
}
|
|
849
|
-
export interface FunctionCacheManagerPersistedState {
|
|
850
|
-
entries: Array<{
|
|
851
|
-
key: string;
|
|
852
|
-
value: CachedFunctionResponse;
|
|
853
|
-
}>;
|
|
854
|
-
stats: {
|
|
855
|
-
hits: number;
|
|
856
|
-
misses: number;
|
|
857
|
-
sets: number;
|
|
858
|
-
evictions: number;
|
|
859
|
-
};
|
|
860
|
-
}
|
|
861
|
-
export interface RateLimitConfig {
|
|
862
|
-
maxRequests: number;
|
|
863
|
-
windowMs: number;
|
|
864
|
-
persistence?: InfrastructurePersistence<RateLimiterPersistedState>;
|
|
865
|
-
}
|
|
866
|
-
export interface ConcurrencyLimiterConfig {
|
|
867
|
-
limit: number;
|
|
868
|
-
persistence?: InfrastructurePersistence<ConcurrencyLimiterPersistedState>;
|
|
869
|
-
}
|
|
870
|
-
export interface CircuitBreakerConfig {
|
|
871
|
-
failureThresholdPercentage: number;
|
|
872
|
-
minimumRequests: number;
|
|
873
|
-
recoveryTimeoutMs: number;
|
|
874
|
-
successThresholdPercentage?: number;
|
|
875
|
-
halfOpenMaxRequests?: number;
|
|
876
|
-
trackIndividualAttempts?: boolean;
|
|
877
|
-
persistence?: InfrastructurePersistence<CircuitBreakerPersistedState>;
|
|
878
|
-
}
|
|
879
315
|
export interface CacheConfig {
|
|
880
316
|
enabled: boolean;
|
|
881
317
|
ttl?: number;
|
|
@@ -886,13 +322,6 @@ export interface CacheConfig {
|
|
|
886
322
|
keyGenerator?: (config: AxiosRequestConfig) => string;
|
|
887
323
|
persistence?: InfrastructurePersistence<CacheManagerPersistedState>;
|
|
888
324
|
}
|
|
889
|
-
export interface FunctionCacheConfig<TArgs extends any[] = any[], TReturn = any> {
|
|
890
|
-
enabled: boolean;
|
|
891
|
-
ttl?: number;
|
|
892
|
-
maxSize?: number;
|
|
893
|
-
keyGenerator?: (fn: (...args: TArgs) => any, args: TArgs) => string;
|
|
894
|
-
persistence?: InfrastructurePersistence<FunctionCacheManagerPersistedState>;
|
|
895
|
-
}
|
|
896
325
|
export interface CachedResponse<T = any> {
|
|
897
326
|
data: T;
|
|
898
327
|
status: number;
|
|
@@ -901,263 +330,6 @@ export interface CachedResponse<T = any> {
|
|
|
901
330
|
timestamp: number;
|
|
902
331
|
expiresAt: number;
|
|
903
332
|
}
|
|
904
|
-
export interface CachedFunctionResponse<T = any> {
|
|
905
|
-
data: T;
|
|
906
|
-
timestamp: number;
|
|
907
|
-
expiresAt: number;
|
|
908
|
-
}
|
|
909
|
-
export interface PhaseExecutionDecision<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
910
|
-
action: PHASE_DECISION_ACTIONS;
|
|
911
|
-
targetPhaseId?: string;
|
|
912
|
-
replayCount?: number;
|
|
913
|
-
metadata?: Record<string, any>;
|
|
914
|
-
addPhases?: ReadonlyArray<STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
915
|
-
}
|
|
916
|
-
export interface PhaseDecisionHookOptions<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
917
|
-
workflowId: string;
|
|
918
|
-
branchId?: string;
|
|
919
|
-
phaseResult: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType>;
|
|
920
|
-
phaseId: string;
|
|
921
|
-
phaseIndex: number;
|
|
922
|
-
executionHistory: PhaseExecutionRecord<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
923
|
-
sharedBuffer?: Record<string, any>;
|
|
924
|
-
params?: any;
|
|
925
|
-
concurrentPhaseResults?: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType>[];
|
|
926
|
-
}
|
|
927
|
-
export interface PhaseExecutionRecord<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
928
|
-
phaseId: string;
|
|
929
|
-
phaseIndex: number;
|
|
930
|
-
executionNumber: number;
|
|
931
|
-
timestamp: string;
|
|
932
|
-
success: boolean;
|
|
933
|
-
executionTime: number;
|
|
934
|
-
decision?: PhaseExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
935
|
-
}
|
|
936
|
-
export interface NonLinearWorkflowContext<RequestDataType, ResponseDataType, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
937
|
-
phases: STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
938
|
-
startPhaseIndex?: number;
|
|
939
|
-
workflowId: string;
|
|
940
|
-
branchId?: string;
|
|
941
|
-
commonGatewayOptions: any;
|
|
942
|
-
requestGroups: any[];
|
|
943
|
-
logPhaseResults: boolean;
|
|
944
|
-
handlePhaseCompletion: (options: HandlePhaseCompletionHookOptions<ResponseDataType, FunctionReturnType>) => any | Promise<any>;
|
|
945
|
-
handlePhaseError: (options: HandlePhaseErrorHookOptions<ResponseDataType, FunctionReturnType>) => any | Promise<any>;
|
|
946
|
-
handlePhaseDecision?: (options: HandlePhaseDecisionHookOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => any | Promise<any>;
|
|
947
|
-
prePhaseExecutionHook?: (options: PrePhaseExecutionHookOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType> | Promise<STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
948
|
-
maxSerializableChars: number;
|
|
949
|
-
workflowHookParams: any;
|
|
950
|
-
sharedBuffer?: Record<string, any>;
|
|
951
|
-
stopOnFirstPhaseError: boolean;
|
|
952
|
-
maxWorkflowIterations: number;
|
|
953
|
-
}
|
|
954
|
-
export interface EXECUTE_NON_LINEAR_WORKFLOW_RESPONSE<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
955
|
-
phaseResults: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>[];
|
|
956
|
-
executionHistory: PhaseExecutionRecord<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
957
|
-
totalRequests: number;
|
|
958
|
-
successfulRequests: number;
|
|
959
|
-
failedRequests: number;
|
|
960
|
-
terminatedEarly: boolean;
|
|
961
|
-
terminationReason?: string;
|
|
962
|
-
}
|
|
963
|
-
export interface STABLE_WORKFLOW_BRANCH<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
964
|
-
id: string;
|
|
965
|
-
phases: STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
966
|
-
markConcurrentBranch?: boolean;
|
|
967
|
-
allowReplay?: boolean;
|
|
968
|
-
maxReplayCount?: number;
|
|
969
|
-
allowSkip?: boolean;
|
|
970
|
-
branchDecisionHook?: (options: BranchDecisionHookOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => BranchExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType> | Promise<BranchExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
971
|
-
statePersistence?: StatePersistenceConfig;
|
|
972
|
-
commonConfig?: Omit<API_GATEWAY_OPTIONS<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>, 'concurrentExecution' | 'stopOnFirstError' | 'requestGroups' | 'maxConcurrentRequests' | 'rateLimit' | 'circuitBreaker' | 'maxTimeout' | "executionContext" | "metricsGuardrails">;
|
|
973
|
-
metricsGuardrails?: MetricsGuardrails;
|
|
974
|
-
maxTimeout?: number;
|
|
975
|
-
}
|
|
976
|
-
export interface BranchDecisionHookOptions<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
977
|
-
workflowId: string;
|
|
978
|
-
branchResults: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>[];
|
|
979
|
-
branchId: string;
|
|
980
|
-
branchIndex: number;
|
|
981
|
-
executionNumber: number;
|
|
982
|
-
executionHistory: PhaseExecutionRecord<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
983
|
-
branchExecutionHistory: BranchExecutionRecord<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
984
|
-
sharedBuffer?: Record<string, any>;
|
|
985
|
-
params?: any;
|
|
986
|
-
concurrentBranchResults?: BranchExecutionResult<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>[];
|
|
987
|
-
}
|
|
988
|
-
export interface BranchExecutionDecision<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
989
|
-
action: PHASE_DECISION_ACTIONS;
|
|
990
|
-
targetBranchId?: string;
|
|
991
|
-
metadata?: Record<string, any>;
|
|
992
|
-
addPhases?: ReadonlyArray<STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
993
|
-
addBranches?: ReadonlyArray<STABLE_WORKFLOW_BRANCH<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
994
|
-
}
|
|
995
|
-
export interface BranchExecutionResult<ResponseDataType = any, FunctionReturnType = any, RequestDataType = any, FunctionArgsType extends any[] = any[]> {
|
|
996
|
-
workflowId: string;
|
|
997
|
-
branchId: string;
|
|
998
|
-
branchIndex: number;
|
|
999
|
-
success: boolean;
|
|
1000
|
-
executionTime: number;
|
|
1001
|
-
completedPhases: number;
|
|
1002
|
-
phaseResults: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>[];
|
|
1003
|
-
decision?: BranchExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
1004
|
-
executionNumber: number;
|
|
1005
|
-
skipped?: boolean;
|
|
1006
|
-
error?: string;
|
|
1007
|
-
metrics?: BranchMetrics;
|
|
1008
|
-
validation?: MetricsValidationResult;
|
|
1009
|
-
}
|
|
1010
|
-
export interface BranchExecutionRecord<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1011
|
-
branchId: string;
|
|
1012
|
-
branchIndex: number;
|
|
1013
|
-
executionNumber: number;
|
|
1014
|
-
timestamp: string;
|
|
1015
|
-
success: boolean;
|
|
1016
|
-
executionTime: number;
|
|
1017
|
-
decision?: BranchExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
1018
|
-
}
|
|
1019
|
-
export interface HandleBranchCompletionHookOptions<ResponseDataType = any, FunctionReturnType = any> {
|
|
1020
|
-
workflowId: string;
|
|
1021
|
-
branchId: string;
|
|
1022
|
-
branchResults: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType, any, any[]>[];
|
|
1023
|
-
success: boolean;
|
|
1024
|
-
maxSerializableChars?: number;
|
|
1025
|
-
}
|
|
1026
|
-
export interface BranchWorkflowContext<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1027
|
-
branches: STABLE_WORKFLOW_BRANCH<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
1028
|
-
workflowId: string;
|
|
1029
|
-
commonGatewayOptions: any;
|
|
1030
|
-
requestGroups: any[];
|
|
1031
|
-
logPhaseResults: boolean;
|
|
1032
|
-
handlePhaseCompletion: (options: HandlePhaseCompletionHookOptions<ResponseDataType, FunctionReturnType>) => any | Promise<any>;
|
|
1033
|
-
handlePhaseError: (options: HandlePhaseErrorHookOptions<ResponseDataType, FunctionReturnType>) => any | Promise<any>;
|
|
1034
|
-
handleBranchCompletion?: (options: HandleBranchCompletionHookOptions<ResponseDataType, FunctionReturnType>) => any | Promise<any>;
|
|
1035
|
-
handleBranchDecision?: (decision: BranchExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>, branchResult: BranchExecutionResult<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>, maxSerializableChars?: number) => any | Promise<any>;
|
|
1036
|
-
preBranchExecutionHook?: (options: PreBranchExecutionHookOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => STABLE_WORKFLOW_BRANCH<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType> | Promise<STABLE_WORKFLOW_BRANCH<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
1037
|
-
prePhaseExecutionHook?: (options: PrePhaseExecutionHookOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType> | Promise<STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
1038
|
-
maxSerializableChars: number;
|
|
1039
|
-
workflowHookParams: any;
|
|
1040
|
-
sharedBuffer?: Record<string, any>;
|
|
1041
|
-
stopOnFirstPhaseError: boolean;
|
|
1042
|
-
enableBranchRacing?: boolean;
|
|
1043
|
-
maxWorkflowIterations: number;
|
|
1044
|
-
}
|
|
1045
|
-
export interface EXECUTE_BRANCH_WORKFLOW_RESPONSE<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1046
|
-
branchResults: BranchExecutionResult<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>[];
|
|
1047
|
-
allPhaseResults: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>[];
|
|
1048
|
-
executionHistory: PhaseExecutionRecord<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
1049
|
-
branchExecutionHistory: BranchExecutionRecord<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
1050
|
-
totalRequests: number;
|
|
1051
|
-
successfulRequests: number;
|
|
1052
|
-
failedRequests: number;
|
|
1053
|
-
terminatedEarly: boolean;
|
|
1054
|
-
terminationReason?: string;
|
|
1055
|
-
}
|
|
1056
|
-
export interface WorkflowMetrics {
|
|
1057
|
-
workflowId: string;
|
|
1058
|
-
success: boolean;
|
|
1059
|
-
executionTime: number;
|
|
1060
|
-
timestamp: string;
|
|
1061
|
-
totalPhases: number;
|
|
1062
|
-
completedPhases: number;
|
|
1063
|
-
skippedPhases: number;
|
|
1064
|
-
failedPhases: number;
|
|
1065
|
-
phaseCompletionRate: number;
|
|
1066
|
-
averagePhaseExecutionTime: number;
|
|
1067
|
-
totalRequests: number;
|
|
1068
|
-
successfulRequests: number;
|
|
1069
|
-
failedRequests: number;
|
|
1070
|
-
requestSuccessRate: number;
|
|
1071
|
-
requestFailureRate: number;
|
|
1072
|
-
terminatedEarly: boolean;
|
|
1073
|
-
terminationReason?: string;
|
|
1074
|
-
totalPhaseReplays: number;
|
|
1075
|
-
totalPhaseSkips: number;
|
|
1076
|
-
totalBranches?: number;
|
|
1077
|
-
completedBranches?: number;
|
|
1078
|
-
failedBranches?: number;
|
|
1079
|
-
branchSuccessRate?: number;
|
|
1080
|
-
throughput: number;
|
|
1081
|
-
averageRequestDuration?: number;
|
|
1082
|
-
}
|
|
1083
|
-
export interface BranchMetrics {
|
|
1084
|
-
branchId: string;
|
|
1085
|
-
branchIndex: number;
|
|
1086
|
-
executionNumber: number;
|
|
1087
|
-
success: boolean;
|
|
1088
|
-
executionTime: number;
|
|
1089
|
-
skipped: boolean;
|
|
1090
|
-
totalPhases: number;
|
|
1091
|
-
completedPhases: number;
|
|
1092
|
-
failedPhases: number;
|
|
1093
|
-
phaseCompletionRate: number;
|
|
1094
|
-
totalRequests: number;
|
|
1095
|
-
successfulRequests: number;
|
|
1096
|
-
failedRequests: number;
|
|
1097
|
-
requestSuccessRate: number;
|
|
1098
|
-
hasDecision: boolean;
|
|
1099
|
-
decisionAction?: string;
|
|
1100
|
-
error?: string;
|
|
1101
|
-
}
|
|
1102
|
-
export interface PhaseMetrics {
|
|
1103
|
-
phaseId: string;
|
|
1104
|
-
phaseIndex: number;
|
|
1105
|
-
workflowId: string;
|
|
1106
|
-
branchId?: string;
|
|
1107
|
-
executionNumber: number;
|
|
1108
|
-
success: boolean;
|
|
1109
|
-
skipped: boolean;
|
|
1110
|
-
executionTime: number;
|
|
1111
|
-
timestamp: string;
|
|
1112
|
-
totalRequests: number;
|
|
1113
|
-
successfulRequests: number;
|
|
1114
|
-
failedRequests: number;
|
|
1115
|
-
requestSuccessRate: number;
|
|
1116
|
-
requestFailureRate: number;
|
|
1117
|
-
hasDecision: boolean;
|
|
1118
|
-
decisionAction?: string;
|
|
1119
|
-
targetPhaseId?: string;
|
|
1120
|
-
replayCount?: number;
|
|
1121
|
-
error?: string;
|
|
1122
|
-
}
|
|
1123
|
-
export interface RequestGroupMetrics {
|
|
1124
|
-
groupId: string;
|
|
1125
|
-
totalRequests: number;
|
|
1126
|
-
successfulRequests: number;
|
|
1127
|
-
failedRequests: number;
|
|
1128
|
-
successRate: number;
|
|
1129
|
-
failureRate: number;
|
|
1130
|
-
requestIds: string[];
|
|
1131
|
-
}
|
|
1132
|
-
export interface RequestMetrics {
|
|
1133
|
-
requestId: string;
|
|
1134
|
-
groupId?: string;
|
|
1135
|
-
success: boolean;
|
|
1136
|
-
hasError: boolean;
|
|
1137
|
-
errorMessage?: string;
|
|
1138
|
-
}
|
|
1139
|
-
export interface CircuitBreakerDashboardMetrics {
|
|
1140
|
-
state: string;
|
|
1141
|
-
isHealthy: boolean;
|
|
1142
|
-
totalRequests: number;
|
|
1143
|
-
successfulRequests: number;
|
|
1144
|
-
failedRequests: number;
|
|
1145
|
-
failurePercentage: number;
|
|
1146
|
-
stateTransitions: number;
|
|
1147
|
-
lastStateChangeTime: number;
|
|
1148
|
-
timeSinceLastStateChange: number;
|
|
1149
|
-
openCount: number;
|
|
1150
|
-
totalOpenDuration: number;
|
|
1151
|
-
averageOpenDuration: number;
|
|
1152
|
-
isCurrentlyOpen: boolean;
|
|
1153
|
-
openUntil: number | null;
|
|
1154
|
-
timeUntilRecovery: number | null;
|
|
1155
|
-
recoveryAttempts: number;
|
|
1156
|
-
successfulRecoveries: number;
|
|
1157
|
-
failedRecoveries: number;
|
|
1158
|
-
recoverySuccessRate: number;
|
|
1159
|
-
config: Required<Omit<CircuitBreakerConfig, 'persistence'>>;
|
|
1160
|
-
}
|
|
1161
333
|
export interface CacheDashboardMetrics {
|
|
1162
334
|
isEnabled: boolean;
|
|
1163
335
|
currentSize: number;
|
|
@@ -1181,274 +353,67 @@ export interface CacheDashboardMetrics {
|
|
|
1181
353
|
networkRequestsSaved: number;
|
|
1182
354
|
cacheEfficiency: number;
|
|
1183
355
|
}
|
|
1184
|
-
export interface
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
queueLength: number;
|
|
1189
|
-
requestsInCurrentWindow: number;
|
|
1190
|
-
totalRequests: number;
|
|
1191
|
-
completedRequests: number;
|
|
1192
|
-
throttledRequests: number;
|
|
1193
|
-
throttleRate: number;
|
|
1194
|
-
currentRequestRate: number;
|
|
1195
|
-
peakRequestRate: number;
|
|
1196
|
-
averageRequestRate: number;
|
|
1197
|
-
peakQueueLength: number;
|
|
1198
|
-
averageQueueWaitTime: number;
|
|
1199
|
-
isThrottling: boolean;
|
|
1200
|
-
utilizationPercentage: number;
|
|
356
|
+
export interface TRIAL_MODE_OPTIONS {
|
|
357
|
+
enabled: boolean;
|
|
358
|
+
reqFailureProbability?: number;
|
|
359
|
+
retryFailureProbability?: number;
|
|
1201
360
|
}
|
|
1202
|
-
export interface
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
completedRequests: number;
|
|
1209
|
-
failedRequests: number;
|
|
1210
|
-
queuedRequests: number;
|
|
1211
|
-
successRate: number;
|
|
1212
|
-
peakConcurrency: number;
|
|
1213
|
-
averageConcurrency: number;
|
|
1214
|
-
concurrencyUtilization: number;
|
|
1215
|
-
peakQueueLength: number;
|
|
1216
|
-
averageQueueWaitTime: number;
|
|
1217
|
-
averageExecutionTime: number;
|
|
1218
|
-
isAtCapacity: boolean;
|
|
1219
|
-
hasQueuedRequests: boolean;
|
|
361
|
+
export interface SUCCESSFUL_ATTEMPT_DATA<ResponseDataType = any> {
|
|
362
|
+
attempt: string;
|
|
363
|
+
timestamp: string;
|
|
364
|
+
executionTime: number;
|
|
365
|
+
data: ResponseDataType;
|
|
366
|
+
statusCode: number;
|
|
1220
367
|
}
|
|
1221
|
-
export interface
|
|
1222
|
-
workflow?: WorkflowMetrics;
|
|
1223
|
-
branches: BranchMetrics[];
|
|
1224
|
-
phases: PhaseMetrics[];
|
|
1225
|
-
requestGroups: RequestGroupMetrics[];
|
|
1226
|
-
requests: RequestMetrics[];
|
|
368
|
+
export interface StableRequestInfrastructureMetrics {
|
|
1227
369
|
circuitBreaker?: CircuitBreakerDashboardMetrics;
|
|
1228
370
|
cache?: CacheDashboardMetrics;
|
|
1229
|
-
rateLimiter?: RateLimiterDashboardMetrics;
|
|
1230
|
-
concurrencyLimiter?: ConcurrencyLimiterDashboardMetrics;
|
|
1231
|
-
}
|
|
1232
|
-
export type WorkflowNodeType = WorkflowNodeTypes.PHASE | WorkflowNodeTypes.BRANCH | WorkflowNodeTypes.CONDITIONAL | WorkflowNodeTypes.PARALLEL_GROUP | WorkflowNodeTypes.MERGE_POINT;
|
|
1233
|
-
export interface WorkflowGraph<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1234
|
-
nodes: Map<string, WorkflowNode<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
1235
|
-
edges: Map<string, WorkflowEdge<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[]>;
|
|
1236
|
-
entryPoint: string;
|
|
1237
|
-
exitPoints?: string[];
|
|
1238
|
-
metadata?: Record<string, any>;
|
|
1239
|
-
}
|
|
1240
|
-
export interface WorkflowNode<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1241
|
-
id: string;
|
|
1242
|
-
type: WorkflowNodeType;
|
|
1243
|
-
phase?: STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
1244
|
-
branch?: STABLE_WORKFLOW_BRANCH<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
1245
|
-
condition?: ConditionalNode<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
1246
|
-
parallelNodes?: string[];
|
|
1247
|
-
waitForNodes?: string[];
|
|
1248
|
-
metadata?: Record<string, any>;
|
|
1249
|
-
phaseDecisionHook?: (context: PhaseDecisionHookOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => PhaseExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType> | Promise<PhaseExecutionDecision<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
1250
|
-
}
|
|
1251
|
-
export interface WorkflowEdge<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1252
|
-
from: string;
|
|
1253
|
-
to: string;
|
|
1254
|
-
condition?: EdgeCondition<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
1255
|
-
weight?: number;
|
|
1256
|
-
label?: string;
|
|
1257
|
-
metadata?: Record<string, any>;
|
|
1258
|
-
}
|
|
1259
|
-
export type EdgeConditionType = WorkflowEdgeConditionTypes.SUCCESS | WorkflowEdgeConditionTypes.FAILURE | WorkflowEdgeConditionTypes.CUSTOM | WorkflowEdgeConditionTypes.ALWAYS;
|
|
1260
|
-
export interface EdgeCondition<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1261
|
-
type: EdgeConditionType;
|
|
1262
|
-
evaluate?: (context: EdgeEvaluationContext<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => boolean | Promise<boolean>;
|
|
1263
|
-
}
|
|
1264
|
-
export interface EdgeEvaluationContext<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1265
|
-
results: Map<string, STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>>;
|
|
1266
|
-
sharedBuffer?: Record<string, any>;
|
|
1267
|
-
executionHistory: ReadonlyArray<PhaseExecutionRecord<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
1268
|
-
currentNodeId: string;
|
|
1269
|
-
}
|
|
1270
|
-
export interface ConditionalNode<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1271
|
-
evaluate: (context: ConditionalEvaluationContext<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>) => string | Promise<string>;
|
|
1272
|
-
}
|
|
1273
|
-
export interface ConditionalEvaluationContext<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1274
|
-
results: Map<string, STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>>;
|
|
1275
|
-
sharedBuffer?: Record<string, any>;
|
|
1276
|
-
executionHistory: ReadonlyArray<PhaseExecutionRecord<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>>;
|
|
1277
|
-
currentNodeId: string;
|
|
1278
|
-
phaseResult?: STABLE_WORKFLOW_PHASE_RESULT<ResponseDataType, FunctionReturnType, RequestDataType, FunctionArgsType>;
|
|
1279
371
|
}
|
|
1280
|
-
export interface
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
warnings: string[];
|
|
1289
|
-
cycles?: string[][];
|
|
1290
|
-
unreachableNodes?: string[];
|
|
1291
|
-
orphanNodes?: string[];
|
|
1292
|
-
}
|
|
1293
|
-
export interface WorkflowGraphExecutionPlan {
|
|
1294
|
-
orderedNodes: string[];
|
|
1295
|
-
parallelGroups: string[][];
|
|
1296
|
-
dependencies: Map<string, string[]>;
|
|
1297
|
-
estimatedDepth: number;
|
|
1298
|
-
}
|
|
1299
|
-
export type SchedulerSchedule = {
|
|
1300
|
-
type: ScheduleTypes.CRON;
|
|
1301
|
-
expression: string;
|
|
1302
|
-
timezone?: string;
|
|
1303
|
-
} | {
|
|
1304
|
-
type: ScheduleTypes.INTERVAL;
|
|
1305
|
-
everyMs: number;
|
|
1306
|
-
startAt?: string | number;
|
|
1307
|
-
} | {
|
|
1308
|
-
type: ScheduleTypes.TIMESTAMP;
|
|
1309
|
-
at: string | number;
|
|
1310
|
-
} | {
|
|
1311
|
-
type: ScheduleTypes.TIMESTAMPS;
|
|
1312
|
-
at: Array<string | number>;
|
|
1313
|
-
};
|
|
1314
|
-
export interface SchedulerRetryConfig {
|
|
1315
|
-
maxAttempts?: number;
|
|
1316
|
-
delayMs?: number;
|
|
1317
|
-
backoffMultiplier?: number;
|
|
1318
|
-
maxDelayMs?: number;
|
|
1319
|
-
}
|
|
1320
|
-
export interface SchedulerPersistence<TJob = unknown> {
|
|
1321
|
-
enabled?: boolean;
|
|
1322
|
-
saveState?: (state: SchedulerState<TJob>) => Promise<void> | void;
|
|
1323
|
-
loadState?: () => Promise<SchedulerState<TJob> | null> | SchedulerState<TJob> | null;
|
|
1324
|
-
persistenceDebounceMs?: number;
|
|
1325
|
-
}
|
|
1326
|
-
export interface SchedulerSharedInfrastructure {
|
|
1327
|
-
circuitBreaker?: CircuitBreaker;
|
|
1328
|
-
rateLimiter?: RateLimiter;
|
|
1329
|
-
concurrencyLimiter?: ConcurrencyLimiter;
|
|
1330
|
-
cacheManager?: CacheManager;
|
|
372
|
+
export interface StableRequestMetrics {
|
|
373
|
+
totalAttempts: number;
|
|
374
|
+
successfulAttempts: number;
|
|
375
|
+
failedAttempts: number;
|
|
376
|
+
totalExecutionTime: number;
|
|
377
|
+
averageAttemptTime: number;
|
|
378
|
+
infrastructureMetrics?: StableRequestInfrastructureMetrics;
|
|
379
|
+
validation?: MetricsValidationResult;
|
|
1331
380
|
}
|
|
1332
|
-
export interface
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
381
|
+
export interface STABLE_REQUEST<RequestDataType = any, ResponseDataType = any> {
|
|
382
|
+
reqData: REQUEST_DATA<RequestDataType>;
|
|
383
|
+
responseAnalyzer?: (options: ResponseAnalysisHookOptions<RequestDataType, ResponseDataType>) => boolean | Promise<boolean>;
|
|
384
|
+
resReq?: boolean;
|
|
385
|
+
attempts?: number;
|
|
386
|
+
performAllAttempts?: boolean;
|
|
387
|
+
wait?: number;
|
|
388
|
+
maxAllowedWait?: number;
|
|
389
|
+
retryStrategy?: RETRY_STRATEGY_TYPES;
|
|
390
|
+
jitter?: number;
|
|
391
|
+
logAllErrors?: boolean;
|
|
392
|
+
handleErrors?: (options: HandleErrorHookOptions<RequestDataType>) => any | Promise<any>;
|
|
393
|
+
logAllSuccessfulAttempts?: boolean;
|
|
394
|
+
handleSuccessfulAttemptData?: (options: HandleSuccessfulAttemptDataHookOptions<RequestDataType, ResponseDataType>) => any | Promise<any>;
|
|
395
|
+
maxSerializableChars?: number;
|
|
396
|
+
finalErrorAnalyzer?: (options: FinalErrorAnalysisHookOptions<RequestDataType>) => boolean | Promise<boolean>;
|
|
397
|
+
trialMode?: TRIAL_MODE_OPTIONS;
|
|
398
|
+
hookParams?: HookParams;
|
|
399
|
+
preExecution?: RequestPreExecutionOptions;
|
|
400
|
+
commonBuffer?: BufferLike;
|
|
401
|
+
cache?: CacheConfig;
|
|
402
|
+
executionContext?: ExecutionContext;
|
|
403
|
+
circuitBreaker?: CircuitBreakerConfig | CircuitBreaker;
|
|
404
|
+
statePersistence?: StatePersistenceConfig;
|
|
1340
405
|
metricsGuardrails?: MetricsGuardrails;
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
export interface SchedulerRunContext {
|
|
1345
|
-
runId: string;
|
|
1346
|
-
jobId: string;
|
|
1347
|
-
scheduledAt: string;
|
|
1348
|
-
startedAt: string;
|
|
1349
|
-
schedule?: SchedulerSchedule;
|
|
1350
|
-
sharedBuffer?: Record<string, any>;
|
|
1351
|
-
sharedInfrastructure?: SchedulerSharedInfrastructure;
|
|
1352
|
-
}
|
|
1353
|
-
export interface SchedulerJobState<TJob> {
|
|
1354
|
-
id: string;
|
|
1355
|
-
job: TJob;
|
|
1356
|
-
schedule?: SchedulerSchedule;
|
|
1357
|
-
nextRunAt: number | null;
|
|
1358
|
-
lastRunAt: number | null;
|
|
1359
|
-
remainingTimestamps: number[] | null;
|
|
1360
|
-
runOnce: boolean;
|
|
1361
|
-
isRunning: boolean;
|
|
1362
|
-
retryAttempts: number;
|
|
1363
|
-
}
|
|
1364
|
-
export interface SchedulerState<TJob> {
|
|
1365
|
-
jobs: SchedulerJobState<TJob>[];
|
|
1366
|
-
queue: string[];
|
|
1367
|
-
stats: {
|
|
1368
|
-
completed: number;
|
|
1369
|
-
failed: number;
|
|
1370
|
-
dropped: number;
|
|
1371
|
-
sequence: number;
|
|
1372
|
-
};
|
|
1373
|
-
sharedBuffer?: BufferLike;
|
|
1374
|
-
}
|
|
1375
|
-
export type SchedulerJobHandler<TJob> = (job: TJob, context: SchedulerRunContext) => Promise<unknown>;
|
|
1376
|
-
export type ScheduledJob<TJob extends {
|
|
1377
|
-
id?: string;
|
|
1378
|
-
schedule?: SchedulerSchedule;
|
|
1379
|
-
}> = {
|
|
1380
|
-
id: string;
|
|
1381
|
-
job: TJob;
|
|
1382
|
-
schedule?: SchedulerSchedule;
|
|
1383
|
-
nextRunAt: number | null;
|
|
1384
|
-
lastRunAt: number | null;
|
|
1385
|
-
remainingTimestamps: number[] | null;
|
|
1386
|
-
runOnce: boolean;
|
|
1387
|
-
isRunning: boolean;
|
|
1388
|
-
retryAttempts: number;
|
|
1389
|
-
};
|
|
1390
|
-
export interface InternalSchedulerConfig<TJob = any> {
|
|
1391
|
-
maxParallel: number;
|
|
1392
|
-
tickIntervalMs: number;
|
|
1393
|
-
queueLimit: number;
|
|
1394
|
-
timezone?: string;
|
|
1395
|
-
persistence: {
|
|
1396
|
-
enabled: boolean;
|
|
1397
|
-
saveState?: (state: SchedulerState<TJob>) => Promise<void> | void;
|
|
1398
|
-
loadState?: () => Promise<SchedulerState<TJob> | null> | SchedulerState<TJob> | null;
|
|
1399
|
-
persistenceDebounceMs?: number;
|
|
1400
|
-
};
|
|
1401
|
-
retry?: SchedulerRetryConfig;
|
|
1402
|
-
executionTimeoutMs?: number;
|
|
1403
|
-
metricsGuardrails?: SchedulerConfig<TJob>['metricsGuardrails'];
|
|
1404
|
-
sharedBuffer?: BufferLike;
|
|
1405
|
-
sharedInfrastructure?: SchedulerSharedInfrastructure;
|
|
1406
|
-
}
|
|
1407
|
-
export interface RunnerRequestJob<RequestDataType = any, ResponseDataType = any> {
|
|
1408
|
-
kind: RunnerJobs.STABLE_REQUEST;
|
|
1409
|
-
options: STABLE_REQUEST<RequestDataType, ResponseDataType>;
|
|
1410
|
-
}
|
|
1411
|
-
export interface RunnerFunctionJob<FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1412
|
-
kind: RunnerJobs.STABLE_FUNCTION;
|
|
1413
|
-
options: STABLE_FUNCTION<FunctionArgsType, FunctionReturnType>;
|
|
1414
|
-
}
|
|
1415
|
-
export interface RunnerApiGatewayJob<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1416
|
-
kind: RunnerJobs.STABLE_API_GATEWAY;
|
|
1417
|
-
requests: API_GATEWAY_REQUEST<RequestDataType, ResponseDataType>[] | API_GATEWAY_ITEM<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
1418
|
-
options: API_GATEWAY_OPTIONS<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
1419
|
-
functions?: API_GATEWAY_FUNCTION<FunctionArgsType, FunctionReturnType>[];
|
|
1420
|
-
}
|
|
1421
|
-
export interface RunnerWorkflowJob<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1422
|
-
kind: RunnerJobs.STABLE_WORKFLOW;
|
|
1423
|
-
phases: STABLE_WORKFLOW_PHASE<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>[];
|
|
1424
|
-
options?: STABLE_WORKFLOW_OPTIONS<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
1425
|
-
}
|
|
1426
|
-
export interface RunnerWorkflowGraphJob<RequestDataType = any, ResponseDataType = any, FunctionArgsType extends any[] = any[], FunctionReturnType = any> {
|
|
1427
|
-
kind: RunnerJobs.STABLE_WORKFLOW_GRAPH;
|
|
1428
|
-
graph: WorkflowGraph<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
1429
|
-
options?: WorkflowGraphOptions<RequestDataType, ResponseDataType, FunctionArgsType, FunctionReturnType>;
|
|
406
|
+
throwOnFailedErrorAnalysis?: boolean;
|
|
407
|
+
loadTransactionLogs?: TransactionLogsLoader;
|
|
408
|
+
transactionLogs?: StableBufferTransactionLog[];
|
|
1430
409
|
}
|
|
1431
|
-
export
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
export type RunnerConfig<T extends RunnerJob = RunnerJob> = {
|
|
1439
|
-
outputPath?: string;
|
|
1440
|
-
jobId?: string;
|
|
1441
|
-
job?: T;
|
|
1442
|
-
jobs?: RunnerScheduledJob<T>[];
|
|
1443
|
-
scheduler?: SchedulerConfig;
|
|
1444
|
-
};
|
|
1445
|
-
export type StableBufferState = Record<string, any>;
|
|
1446
|
-
export interface StableBufferOptions {
|
|
1447
|
-
initialState?: StableBufferState;
|
|
1448
|
-
clone?: (state: StableBufferState) => StableBufferState;
|
|
1449
|
-
metricsGuardrails?: MetricsGuardrailsStableBuffer;
|
|
1450
|
-
transactionTimeoutMs?: number;
|
|
1451
|
-
logTransaction?: StableBufferTransactionLogger;
|
|
410
|
+
export interface STABLE_REQUEST_RESULT<ResponseDataType = any> {
|
|
411
|
+
success: boolean;
|
|
412
|
+
data?: ResponseDataType | boolean;
|
|
413
|
+
error?: string;
|
|
414
|
+
errorLogs?: ERROR_LOG[];
|
|
415
|
+
successfulAttempts?: SUCCESSFUL_ATTEMPT_DATA<ResponseDataType>[];
|
|
416
|
+
metrics?: StableRequestMetrics;
|
|
1452
417
|
}
|
|
1453
418
|
export {};
|
|
1454
419
|
//# sourceMappingURL=index.d.ts.map
|