@kaleido-io/workflow-engine-sdk 0.0.1 → 0.9.2

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.
Files changed (140) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +1121 -0
  3. package/bin/init.js +200 -0
  4. package/bin/wesdk.js +57 -0
  5. package/dist/package.json +3 -0
  6. package/dist/src/client/client.d.ts +24 -0
  7. package/dist/src/client/client.d.ts.map +1 -0
  8. package/dist/src/client/client.js +58 -0
  9. package/dist/src/client/client.js.map +1 -0
  10. package/dist/src/client/rest-client.d.ts +222 -0
  11. package/dist/src/client/rest-client.d.ts.map +1 -0
  12. package/dist/src/client/rest-client.js +242 -0
  13. package/dist/src/client/rest-client.js.map +1 -0
  14. package/dist/src/config/config.d.ts +60 -0
  15. package/dist/src/config/config.d.ts.map +1 -0
  16. package/dist/src/config/config.js +117 -0
  17. package/dist/src/config/config.js.map +1 -0
  18. package/dist/src/factories/event_source.d.ts +54 -0
  19. package/dist/src/factories/event_source.d.ts.map +1 -0
  20. package/dist/src/factories/event_source.js +170 -0
  21. package/dist/src/factories/event_source.js.map +1 -0
  22. package/dist/src/factories/transaction_handler.d.ts +27 -0
  23. package/dist/src/factories/transaction_handler.d.ts.map +1 -0
  24. package/dist/src/factories/transaction_handler.js +66 -0
  25. package/dist/src/factories/transaction_handler.js.map +1 -0
  26. package/dist/src/helpers/stage_director.d.ts +42 -0
  27. package/dist/src/helpers/stage_director.d.ts.map +1 -0
  28. package/dist/src/helpers/stage_director.js +304 -0
  29. package/dist/src/helpers/stage_director.js.map +1 -0
  30. package/dist/src/i18n/errors.d.ts +61 -0
  31. package/dist/src/i18n/errors.d.ts.map +1 -0
  32. package/dist/src/i18n/errors.js +90 -0
  33. package/dist/src/i18n/errors.js.map +1 -0
  34. package/dist/src/index.d.ts +20 -0
  35. package/dist/src/index.d.ts.map +1 -0
  36. package/dist/src/index.js +85 -0
  37. package/dist/src/index.js.map +1 -0
  38. package/dist/src/interfaces/handlers.d.ts +112 -0
  39. package/dist/src/interfaces/handlers.d.ts.map +1 -0
  40. package/dist/src/interfaces/handlers.js +18 -0
  41. package/dist/src/interfaces/handlers.js.map +1 -0
  42. package/dist/src/interfaces/messages.d.ts +6 -0
  43. package/dist/src/interfaces/messages.d.ts.map +1 -0
  44. package/dist/src/interfaces/messages.js +18 -0
  45. package/dist/src/interfaces/messages.js.map +1 -0
  46. package/dist/src/log/logger.d.ts +8 -0
  47. package/dist/src/log/logger.d.ts.map +1 -0
  48. package/dist/src/log/logger.js +39 -0
  49. package/dist/src/log/logger.js.map +1 -0
  50. package/dist/src/runtime/engine_client.d.ts +37 -0
  51. package/dist/src/runtime/engine_client.d.ts.map +1 -0
  52. package/dist/src/runtime/engine_client.js +99 -0
  53. package/dist/src/runtime/engine_client.js.map +1 -0
  54. package/dist/src/runtime/handler_runtime.d.ts +124 -0
  55. package/dist/src/runtime/handler_runtime.d.ts.map +1 -0
  56. package/dist/src/runtime/handler_runtime.js +623 -0
  57. package/dist/src/runtime/handler_runtime.js.map +1 -0
  58. package/dist/src/types/core.d.ts +258 -0
  59. package/dist/src/types/core.d.ts.map +1 -0
  60. package/dist/src/types/core.js +71 -0
  61. package/dist/src/types/core.js.map +1 -0
  62. package/dist/src/types/flows.d.ts +144 -0
  63. package/dist/src/types/flows.d.ts.map +1 -0
  64. package/dist/src/types/flows.js +30 -0
  65. package/dist/src/types/flows.js.map +1 -0
  66. package/dist/src/utils/errors.d.ts +2 -0
  67. package/dist/src/utils/errors.d.ts.map +1 -0
  68. package/dist/src/utils/errors.js +23 -0
  69. package/dist/src/utils/errors.js.map +1 -0
  70. package/dist/src/utils/patch.d.ts +9 -0
  71. package/dist/src/utils/patch.d.ts.map +1 -0
  72. package/dist/src/utils/patch.js +99 -0
  73. package/dist/src/utils/patch.js.map +1 -0
  74. package/dist-esm/src/client/client.js +54 -0
  75. package/dist-esm/src/client/client.js.map +1 -0
  76. package/dist-esm/src/client/rest-client.js +238 -0
  77. package/dist-esm/src/client/rest-client.js.map +1 -0
  78. package/dist-esm/src/config/config.js +113 -0
  79. package/dist-esm/src/config/config.js.map +1 -0
  80. package/dist-esm/src/factories/event_source.js +167 -0
  81. package/dist-esm/src/factories/event_source.js.map +1 -0
  82. package/dist-esm/src/factories/transaction_handler.js +63 -0
  83. package/dist-esm/src/factories/transaction_handler.js.map +1 -0
  84. package/dist-esm/src/helpers/stage_director.js +298 -0
  85. package/dist-esm/src/helpers/stage_director.js.map +1 -0
  86. package/dist-esm/src/i18n/errors.js +85 -0
  87. package/dist-esm/src/i18n/errors.js.map +1 -0
  88. package/dist-esm/src/index.js +51 -0
  89. package/dist-esm/src/index.js.map +1 -0
  90. package/dist-esm/src/interfaces/handlers.js +17 -0
  91. package/dist-esm/src/interfaces/handlers.js.map +1 -0
  92. package/dist-esm/src/interfaces/messages.js +17 -0
  93. package/dist-esm/src/interfaces/messages.js.map +1 -0
  94. package/dist-esm/src/log/logger.js +36 -0
  95. package/dist-esm/src/log/logger.js.map +1 -0
  96. package/dist-esm/src/runtime/engine_client.js +95 -0
  97. package/dist-esm/src/runtime/engine_client.js.map +1 -0
  98. package/dist-esm/src/runtime/handler_runtime.js +586 -0
  99. package/dist-esm/src/runtime/handler_runtime.js.map +1 -0
  100. package/dist-esm/src/types/core.js +68 -0
  101. package/dist-esm/src/types/core.js.map +1 -0
  102. package/dist-esm/src/types/flows.js +27 -0
  103. package/dist-esm/src/types/flows.js.map +1 -0
  104. package/dist-esm/src/utils/errors.js +19 -0
  105. package/dist-esm/src/utils/errors.js.map +1 -0
  106. package/dist-esm/src/utils/patch.js +56 -0
  107. package/dist-esm/src/utils/patch.js.map +1 -0
  108. package/package.json +79 -11
  109. package/template/.env.sample +14 -0
  110. package/template/.vscode/launch.json +23 -0
  111. package/template/README.md +37 -0
  112. package/template/package.json +36 -0
  113. package/template/src/connect.ts +58 -0
  114. package/template/src/provider.ts +24 -0
  115. package/template/src/samples/event-source/README.md +50 -0
  116. package/template/src/samples/event-source/echo-handler.ts +65 -0
  117. package/template/src/samples/event-source/event-processor.ts +46 -0
  118. package/template/src/samples/event-source/event-source.ts +70 -0
  119. package/template/src/samples/event-source/stream.ts +34 -0
  120. package/template/src/samples/hello/README.md +52 -0
  121. package/template/src/samples/hello/flow.ts +74 -0
  122. package/template/src/samples/hello/handlers.test.ts +147 -0
  123. package/template/src/samples/hello/handlers.ts +72 -0
  124. package/template/src/samples/hello/transaction.ts +24 -0
  125. package/template/src/samples/http-invoke/README.md +42 -0
  126. package/template/src/samples/http-invoke/flow.ts +63 -0
  127. package/template/src/samples/http-invoke/handlers.ts +66 -0
  128. package/template/src/samples/http-invoke/transaction.ts +22 -0
  129. package/template/src/samples/snap/README.md +98 -0
  130. package/template/src/samples/snap/event-source.ts +104 -0
  131. package/template/src/samples/snap/flow.ts +85 -0
  132. package/template/src/samples/snap/snap-handler.ts +84 -0
  133. package/template/src/samples/snap/stream.ts +26 -0
  134. package/template/src/samples/snap/transaction.ts +26 -0
  135. package/template/src/utils/post-stream.ts +67 -0
  136. package/template/src/utils/post-transaction.ts +64 -0
  137. package/template/src/utils/post-workflow.ts +63 -0
  138. package/template/tsconfig.json +24 -0
  139. package/template/vitest.config.ts +42 -0
  140. package/CODEOWNERS +0 -5
@@ -0,0 +1,258 @@
1
+ /**
2
+ * Core types and enums for the Workflow Engine TypeScript SDK.
3
+ */
4
+ export declare enum EvalResult {
5
+ FIXABLE_ERROR = 0,
6
+ TRANSIENT_ERROR = 1,
7
+ HARD_FAILURE = 2,
8
+ COMPLETE = 3,
9
+ WAITING = 4
10
+ }
11
+ export declare enum InvocationMode {
12
+ PARALLEL = 0,
13
+ BATCH = 1
14
+ }
15
+ export declare enum WSMessageType {
16
+ PROTOCOL_ERROR = "protocol_error",
17
+ REGISTER_PROVIDER = "register_provider",
18
+ REGISTER_HANDLER = "register_handler",
19
+ EVALUATE = "evaluate",
20
+ EVALUATE_RESULT = "evaluate_result",
21
+ HANDLE_TRANSACTIONS = "handle_transactions",
22
+ HANDLE_TRANSACTIONS_RESULT = "handle_transactions_result",
23
+ EVENT_SOURCE_CONFIG = "event_source_config",
24
+ EVENT_SOURCE_POLL = "event_source_poll",
25
+ EVENT_SOURCE_POLL_RESULT = "event_source_poll_result",
26
+ EVENT_SOURCE_VALIDATE_CONFIG = "event_source_validate_config",
27
+ EVENT_SOURCE_VALIDATE_CONFIG_RESULT = "event_source_validate_config_result",
28
+ EVENT_SOURCE_DELETE = "event_source_delete",
29
+ EVENT_SOURCE_DELETE_RESULT = "event_source_delete_result",
30
+ EVENT_PROCESSOR_BATCH = "event_processor_batch",
31
+ EVENT_PROCESSOR_BATCH_RESULT = "event_processor_batch_result",
32
+ ENGINE_API_SUBMIT_TRANSACTIONS = "engineapi_submit_transactions",
33
+ ENGINE_API_SUBMIT_TRANSACTIONS_RESULT = "engineapi_submit_transactions_result"
34
+ }
35
+ export declare enum WSHandlerType {
36
+ TRANSACTION_HANDLER = "transaction_handler",
37
+ EVENT_PROCESSOR = "event_processor",
38
+ EVENT_SOURCE = "event_source"
39
+ }
40
+ export declare enum PatchOpType {
41
+ ADD = "add",
42
+ REMOVE = "remove",
43
+ REPLACE = "replace",
44
+ MOVE = "move",
45
+ COPY = "copy",
46
+ TEST = "test"
47
+ }
48
+ /**
49
+ * StageDirector controls action routing and output mapping
50
+ */
51
+ export interface StageDirector {
52
+ action: string;
53
+ outputPath: string;
54
+ nextStage: string;
55
+ failureStage: string;
56
+ }
57
+ /**
58
+ * Interface for types that can provide a StageDirector
59
+ */
60
+ export interface WithStageDirector {
61
+ getStageDirector(): StageDirector;
62
+ }
63
+ /**
64
+ * JSON Patch operation following RFC6902
65
+ */
66
+ export interface PatchOp {
67
+ op: PatchOpType;
68
+ path: string;
69
+ from?: string;
70
+ value?: any;
71
+ }
72
+ export type Patch = PatchOp[];
73
+ /**
74
+ * Event trigger for flow correlation
75
+ */
76
+ export interface Trigger {
77
+ topic: string;
78
+ ephemeral?: boolean;
79
+ }
80
+ /**
81
+ * Event emitted by a handler
82
+ */
83
+ export interface HandlerEvent {
84
+ idempotencyKey?: string;
85
+ topic: string;
86
+ data: any;
87
+ }
88
+ /**
89
+ * Flow runtime state information
90
+ */
91
+ export interface FlowRuntimeState {
92
+ handler: string;
93
+ workflowId: string;
94
+ transactionId: string;
95
+ sequence: string;
96
+ idempotencyKey?: string;
97
+ stackDepth?: number;
98
+ identity?: string;
99
+ identityContext?: any;
100
+ stage: string;
101
+ state?: any;
102
+ queueReduce?: any;
103
+ }
104
+ /**
105
+ * Event attached to a transaction
106
+ */
107
+ export interface WSEvaluateTransactionEvent {
108
+ topic: string;
109
+ data?: any;
110
+ }
111
+ /**
112
+ * Individual evaluation transaction
113
+ */
114
+ export interface WSEvaluateTransaction extends FlowRuntimeState {
115
+ authRef?: string;
116
+ input?: any;
117
+ configProfile?: any;
118
+ events?: WSEvaluateTransactionEvent[];
119
+ }
120
+ /**
121
+ * Result for an individual transaction in a batch
122
+ */
123
+ export interface WSEvaluateReplyResult {
124
+ error?: string;
125
+ stage?: string;
126
+ subflow?: string;
127
+ stateUpdates?: Patch;
128
+ triggers?: Trigger[];
129
+ events?: HandlerEvent[];
130
+ }
131
+ /**
132
+ * WebSocket message envelope
133
+ */
134
+ export interface WSHandlerEnvelope {
135
+ messageType: WSMessageType;
136
+ id: string;
137
+ handlerType?: WSHandlerType;
138
+ handler?: string;
139
+ error?: string;
140
+ authTokens?: Record<string, string>;
141
+ }
142
+ export interface WSEventProcessorBatchRequest extends WSHandlerEnvelope {
143
+ streamName: string;
144
+ streamId: string;
145
+ events: ListenerEvent[];
146
+ authRef?: string;
147
+ }
148
+ export interface WSEventProcessorBatchResult extends WSHandlerEnvelope {
149
+ checkpoint?: any;
150
+ events: ListenerEvent[];
151
+ }
152
+ /**
153
+ * Transaction handling transaction (batch of evaluate transactions).
154
+ */
155
+ export interface WSHandleTransactions extends WSHandlerEnvelope {
156
+ transactions: WSEvaluateTransaction[];
157
+ }
158
+ /**
159
+ * Transaction handling response (batch evaluate results).
160
+ */
161
+ export interface WSHandleTransactionsResult extends WSHandlerEnvelope {
162
+ results: WSEvaluateReplyResult[];
163
+ }
164
+ /**
165
+ * Provider registration message
166
+ */
167
+ export interface WSRegisterProvider extends WSHandlerEnvelope {
168
+ providerName: string;
169
+ }
170
+ /**
171
+ * Handler registration message
172
+ */
173
+ export interface WSRegisterHandler extends WSHandlerEnvelope {
174
+ }
175
+ /**
176
+ * Listener event
177
+ */
178
+ export interface ListenerEvent {
179
+ idempotencyKey: string;
180
+ topic: string;
181
+ data?: any;
182
+ }
183
+ /**
184
+ * Event source configuration
185
+ */
186
+ export interface WSEventStreamInfo {
187
+ streamId: string;
188
+ streamName: string;
189
+ }
190
+ export interface WSEventSourceConfig extends WSHandlerEnvelope {
191
+ streamName: string;
192
+ streamId: string;
193
+ config?: any;
194
+ }
195
+ /**
196
+ * Listener poll request
197
+ */
198
+ export interface WSListenerPollRequest extends WSHandlerEnvelope {
199
+ streamName: string;
200
+ streamId: string;
201
+ listenerName?: string;
202
+ checkpoint?: any;
203
+ authRef?: string;
204
+ }
205
+ /**
206
+ * Listener poll result
207
+ */
208
+ export interface WSListenerPollResult extends WSHandlerEnvelope {
209
+ checkpoint?: any;
210
+ events: ListenerEvent[];
211
+ }
212
+ export interface AsyncTransactionInput {
213
+ idempotencyKey?: string;
214
+ workflowId?: string;
215
+ workflow: string;
216
+ operation: string;
217
+ input?: any;
218
+ labels?: Record<string, string>;
219
+ }
220
+ export interface IdempotentSubmitResult {
221
+ id: string;
222
+ position: number;
223
+ idempotencyKey?: string;
224
+ preexisting?: boolean;
225
+ rejectedError?: string;
226
+ }
227
+ export interface WSEngineAPIRequest {
228
+ activeRequestId: string;
229
+ authRef?: string;
230
+ }
231
+ export interface WSEngineAPISubmitTransactions extends WSHandlerEnvelope, WSEngineAPIRequest {
232
+ transactions: AsyncTransactionInput[];
233
+ }
234
+ export interface WSEngineAPISubmitTransactionsResult extends WSHandlerEnvelope {
235
+ submissions: IdempotentSubmitResult[];
236
+ }
237
+ /**
238
+ * Action result for a single action
239
+ */
240
+ export interface ActionResult {
241
+ result: any;
242
+ output?: any;
243
+ error?: Error;
244
+ triggers?: any[];
245
+ extraUpdates?: Patch;
246
+ customStage?: string;
247
+ }
248
+ /**
249
+ * Internal type for tracking execution state during batch processing
250
+ * Used by stage_director to manage transaction execution and results
251
+ */
252
+ export interface ExecutableTransaction<T = any> {
253
+ idx: number;
254
+ transaction: WSEvaluateTransaction;
255
+ input: T;
256
+ result?: WSEvaluateReplyResult;
257
+ }
258
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/types/core.ts"],"names":[],"mappings":"AAiBA;;GAEG;AAEH,oBAAY,UAAU;IACpB,aAAa,IAAI;IACjB,eAAe,IAAI;IACnB,YAAY,IAAI;IAChB,QAAQ,IAAI;IACZ,OAAO,IAAI;CACZ;AAED,oBAAY,cAAc;IACxB,QAAQ,IAAI;IACZ,KAAK,IAAI;CACV;AAED,oBAAY,aAAa;IACvB,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,QAAQ,aAAa;IACrB,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,0BAA0B,+BAA+B;IACzD,mBAAmB,wBAAwB;IAC3C,iBAAiB,sBAAsB;IACvC,wBAAwB,6BAA6B;IACrD,4BAA4B,iCAAiC;IAC7D,mCAAmC,wCAAwC;IAC3E,mBAAmB,wBAAwB;IAC3C,0BAA0B,+BAA+B;IACzD,qBAAqB,0BAA0B;IAC/C,4BAA4B,iCAAiC;IAC7D,8BAA8B,kCAAkC;IAChE,qCAAqC,yCAAyC;CAC/E;AAED,oBAAY,aAAa;IACvB,mBAAmB,wBAAwB;IAC3C,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;CAC9B;AAED,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,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C,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,6BAA8B,SAAQ,iBAAiB,EAAE,kBAAkB;IAC1F,YAAY,EAAE,qBAAqB,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,mCAAoC,SAAQ,iBAAiB;IAC5E,WAAW,EAAE,sBAAsB,EAAE,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,GAAG,CAAC;IACZ,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,GAAG;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,qBAAqB,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC;IACT,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ // Copyright © 2026 Kaleido, Inc.
3
+ //
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ //
6
+ // Licensed under the Apache License, Version 2.0 (the "License");
7
+ // you may not use this file except in compliance with the License.
8
+ // You may obtain a copy of the License at
9
+ //
10
+ // http://www.apache.org/licenses/LICENSE-2.0
11
+ //
12
+ // Unless required by applicable law or agreed to in writing, software
13
+ // distributed under the License is distributed on an "AS IS" BASIS,
14
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ // See the License for the specific language governing permissions and
16
+ // limitations under the License.
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.PatchOpType = exports.WSHandlerType = exports.WSMessageType = exports.InvocationMode = exports.EvalResult = void 0;
19
+ /**
20
+ * Core types and enums for the Workflow Engine TypeScript SDK.
21
+ */
22
+ var EvalResult;
23
+ (function (EvalResult) {
24
+ EvalResult[EvalResult["FIXABLE_ERROR"] = 0] = "FIXABLE_ERROR";
25
+ EvalResult[EvalResult["TRANSIENT_ERROR"] = 1] = "TRANSIENT_ERROR";
26
+ EvalResult[EvalResult["HARD_FAILURE"] = 2] = "HARD_FAILURE";
27
+ EvalResult[EvalResult["COMPLETE"] = 3] = "COMPLETE";
28
+ EvalResult[EvalResult["WAITING"] = 4] = "WAITING";
29
+ })(EvalResult || (exports.EvalResult = EvalResult = {}));
30
+ var InvocationMode;
31
+ (function (InvocationMode) {
32
+ InvocationMode[InvocationMode["PARALLEL"] = 0] = "PARALLEL";
33
+ InvocationMode[InvocationMode["BATCH"] = 1] = "BATCH";
34
+ })(InvocationMode || (exports.InvocationMode = InvocationMode = {}));
35
+ var WSMessageType;
36
+ (function (WSMessageType) {
37
+ WSMessageType["PROTOCOL_ERROR"] = "protocol_error";
38
+ WSMessageType["REGISTER_PROVIDER"] = "register_provider";
39
+ WSMessageType["REGISTER_HANDLER"] = "register_handler";
40
+ WSMessageType["EVALUATE"] = "evaluate";
41
+ WSMessageType["EVALUATE_RESULT"] = "evaluate_result";
42
+ WSMessageType["HANDLE_TRANSACTIONS"] = "handle_transactions";
43
+ WSMessageType["HANDLE_TRANSACTIONS_RESULT"] = "handle_transactions_result";
44
+ WSMessageType["EVENT_SOURCE_CONFIG"] = "event_source_config";
45
+ WSMessageType["EVENT_SOURCE_POLL"] = "event_source_poll";
46
+ WSMessageType["EVENT_SOURCE_POLL_RESULT"] = "event_source_poll_result";
47
+ WSMessageType["EVENT_SOURCE_VALIDATE_CONFIG"] = "event_source_validate_config";
48
+ WSMessageType["EVENT_SOURCE_VALIDATE_CONFIG_RESULT"] = "event_source_validate_config_result";
49
+ WSMessageType["EVENT_SOURCE_DELETE"] = "event_source_delete";
50
+ WSMessageType["EVENT_SOURCE_DELETE_RESULT"] = "event_source_delete_result";
51
+ WSMessageType["EVENT_PROCESSOR_BATCH"] = "event_processor_batch";
52
+ WSMessageType["EVENT_PROCESSOR_BATCH_RESULT"] = "event_processor_batch_result";
53
+ WSMessageType["ENGINE_API_SUBMIT_TRANSACTIONS"] = "engineapi_submit_transactions";
54
+ WSMessageType["ENGINE_API_SUBMIT_TRANSACTIONS_RESULT"] = "engineapi_submit_transactions_result";
55
+ })(WSMessageType || (exports.WSMessageType = WSMessageType = {}));
56
+ var WSHandlerType;
57
+ (function (WSHandlerType) {
58
+ WSHandlerType["TRANSACTION_HANDLER"] = "transaction_handler";
59
+ WSHandlerType["EVENT_PROCESSOR"] = "event_processor";
60
+ WSHandlerType["EVENT_SOURCE"] = "event_source";
61
+ })(WSHandlerType || (exports.WSHandlerType = WSHandlerType = {}));
62
+ var PatchOpType;
63
+ (function (PatchOpType) {
64
+ PatchOpType["ADD"] = "add";
65
+ PatchOpType["REMOVE"] = "remove";
66
+ PatchOpType["REPLACE"] = "replace";
67
+ PatchOpType["MOVE"] = "move";
68
+ PatchOpType["COPY"] = "copy";
69
+ PatchOpType["TEST"] = "test";
70
+ })(PatchOpType || (exports.PatchOpType = PatchOpType = {}));
71
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/types/core.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,EAAE;AACF,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AAC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ny = any;
5
+ /** Represents the type of a flow stage */
6
+ export type FlowStageType = string;
7
+ /** Available flow stage types */
8
+ export declare const FlowStageTypes: {
9
+ readonly PENDING: FlowStageType;
10
+ readonly SUCCESS: FlowStageType;
11
+ readonly FAILURE: FlowStageType;
12
+ };
13
+ /** Represents the type of a flow operation */
14
+ export type FlowOperationType = string;
15
+ /** Available flow operation types */
16
+ export declare const FlowOperationTypes: {
17
+ readonly ASYNC: FlowOperationType;
18
+ readonly SYNC: FlowOperationType;
19
+ };
20
+ /** Input parameters for creating or updating a flow */
21
+ export interface FlowInput {
22
+ name?: string;
23
+ currentVersion?: string;
24
+ description?: string;
25
+ labels?: {
26
+ [key: string]: string;
27
+ };
28
+ }
29
+ /** Embedded version information for a flow */
30
+ export interface FlowVersionEmbedded {
31
+ version?: string;
32
+ versionDescription?: string;
33
+ }
34
+ /** Complete flow resource including base fields */
35
+ export interface Flow extends FlowInput {
36
+ id?: string;
37
+ created?: string;
38
+ updated?: string;
39
+ version?: string;
40
+ versionDescription?: string;
41
+ operations?: FlowOperation[];
42
+ stages?: FlowStage[];
43
+ events?: FlowEventHandler[];
44
+ constants?: {
45
+ [key: string]: JSONAny;
46
+ };
47
+ }
48
+ /** Handler binding target (provider and handler name). */
49
+ export interface HandlerBindingTarget {
50
+ provider?: string;
51
+ providerHandler?: string;
52
+ }
53
+ /** Flow input with inline version information. */
54
+ export interface FlowInputInlineVersion extends FlowVersionEmbedded, FlowInput, FlowDefinition {
55
+ version?: string;
56
+ versionDescription?: string;
57
+ handlerBindings?: Record<string, HandlerBindingTarget>;
58
+ }
59
+ /** Definition of a flow's structure and behavior */
60
+ export interface FlowDefinition {
61
+ operations?: FlowOperation[];
62
+ stages?: FlowStage[];
63
+ events?: FlowEventHandler[];
64
+ constants?: {
65
+ [key: string]: JSONAny;
66
+ };
67
+ }
68
+ /** Definition of a stage in the flow */
69
+ export interface FlowStage {
70
+ name: string;
71
+ type: FlowStageType;
72
+ queueReduce?: FlowReducer;
73
+ handler?: string;
74
+ fullState?: boolean;
75
+ inputMap?: FlowMapping;
76
+ errorRetry?: FlowHandlerRetry;
77
+ staleRetry?: FlowHandlerRetry;
78
+ }
79
+ /** Definition of an event handler in the flow */
80
+ export interface FlowEventHandler {
81
+ name: string;
82
+ topicMatch: string;
83
+ handler: string;
84
+ fullState?: boolean;
85
+ inputMap?: FlowMapping;
86
+ errorRetry?: FlowHandlerRetry;
87
+ }
88
+ /** Definition of an operation in the flow */
89
+ export interface FlowOperation {
90
+ name: string;
91
+ description?: string;
92
+ type: FlowOperationType;
93
+ sequenceMap?: FlowMapping;
94
+ stage?: string;
95
+ stateUpdates?: any;
96
+ inputSchema?: JSONAny;
97
+ outputSchema?: JSONAny;
98
+ outputMap?: FlowMapping;
99
+ }
100
+ /** Configuration for reducing queue state */
101
+ export interface FlowReducer {
102
+ initializer?: FlowMapping;
103
+ reducer?: FlowMapping;
104
+ }
105
+ /** Configuration for flow transitions */
106
+ export interface FlowTransitions {
107
+ onCondition: FlowConditionalTransition[];
108
+ onFailure: FlowTransition;
109
+ }
110
+ /** Definition of a conditional transition */
111
+ export interface FlowConditionalTransition {
112
+ condition?: FlowMapping;
113
+ stage: string;
114
+ data?: FlowMapping;
115
+ }
116
+ /** Definition of a transition */
117
+ export interface FlowTransition {
118
+ stage: string;
119
+ data?: FlowMapping;
120
+ }
121
+ /** Reference to a flow policy */
122
+ export interface FlowPolicyRef {
123
+ name: string;
124
+ version?: string;
125
+ hash?: string;
126
+ }
127
+ /** Configuration for data mapping */
128
+ export interface FlowMapping {
129
+ jsonata?: string;
130
+ rego?: string;
131
+ }
132
+ /** Configuration for retry timing */
133
+ export interface FlowRetryTuning {
134
+ initialDelay: string;
135
+ maxDelay: string;
136
+ factor: number;
137
+ }
138
+ /** Configuration for handler retry behavior */
139
+ export interface FlowHandlerRetry {
140
+ disabled?: boolean;
141
+ condition?: FlowMapping;
142
+ tuning?: FlowRetryTuning;
143
+ }
144
+ //# sourceMappingURL=flows.d.ts.map
@@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AA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ // Copyright © 2026 Kaleido, Inc.
3
+ //
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ //
6
+ // Licensed under the Apache License, Version 2.0 (the "License");
7
+ // you may not use this file except in compliance with the License.
8
+ // You may obtain a copy of the License at
9
+ //
10
+ // http://www.apache.org/licenses/LICENSE-2.0
11
+ //
12
+ // Unless required by applicable law or agreed to in writing, software
13
+ // distributed under the License is distributed on an "AS IS" BASIS,
14
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ // See the License for the specific language governing permissions and
16
+ // limitations under the License.
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.FlowOperationTypes = exports.FlowStageTypes = void 0;
19
+ /** Available flow stage types */
20
+ exports.FlowStageTypes = {
21
+ PENDING: 'pending',
22
+ SUCCESS: 'success',
23
+ FAILURE: 'failure',
24
+ };
25
+ /** Available flow operation types */
26
+ exports.FlowOperationTypes = {
27
+ ASYNC: 'asynchronous',
28
+ SYNC: 'synchronous',
29
+ };
30
+ //# sourceMappingURL=flows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flows.js","sourceRoot":"","sources":["../../../src/types/flows.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,EAAE;AACF,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAYjC,iCAAiC;AACpB,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,SAA0B;IACnC,OAAO,EAAE,SAA0B;IACnC,OAAO,EAAE,SAA0B;CAC3B,CAAC;AAKX,qCAAqC;AACxB,QAAA,kBAAkB,GAAG;IAChC,KAAK,EAAE,cAAmC;IAC1C,IAAI,EAAE,aAAkC;CAChC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const getErrorMessage: (error: unknown) => string;
2
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,MAEhD,CAAA"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // Copyright © 2026 Kaleido, Inc.
3
+ //
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ //
6
+ // Licensed under the Apache License, Version 2.0 (the "License");
7
+ // you may not use this file except in compliance with the License.
8
+ // You may obtain a copy of the License at
9
+ //
10
+ // http://www.apache.org/licenses/LICENSE-2.0
11
+ //
12
+ // Unless required by applicable law or agreed to in writing, software
13
+ // distributed under the License is distributed on an "AS IS" BASIS,
14
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ // See the License for the specific language governing permissions and
16
+ // limitations under the License.
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.getErrorMessage = void 0;
19
+ const getErrorMessage = (error) => {
20
+ return error instanceof Error ? error.message : String(error);
21
+ };
22
+ exports.getErrorMessage = getErrorMessage;
23
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,EAAE;AACF,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAG1B,MAAM,eAAe,GAAG,CAAC,KAAc,EAAU,EAAE;IACxD,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC,CAAA;AAFY,QAAA,eAAe,mBAE3B"}
@@ -0,0 +1,9 @@
1
+ import { PatchOp, Patch } from "../types/core";
2
+ export declare const apply: (state: unknown, patch: Patch) => unknown;
3
+ export declare const addOp: (path: string, value: unknown) => PatchOp;
4
+ export declare const removeOp: (path: string) => PatchOp;
5
+ export declare const replaceOp: (path: string, value: unknown) => PatchOp;
6
+ export declare const moveOp: (from: string, path: string) => PatchOp;
7
+ export declare const copyOp: (from: string, path: string) => PatchOp;
8
+ export declare const testOp: (path: string, value: unknown) => PatchOp;
9
+ //# sourceMappingURL=patch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../src/utils/patch.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,OAAO,EAAe,KAAK,EAAE,MAAM,eAAe,CAAC;AAI5D,eAAO,MAAM,KAAK,GAAI,OAAO,OAAO,EAAE,OAAO,KAAK,YAOjD,CAAC;AAGF,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,EAAE,OAAO,OAAO,KAAG,OAInD,CAAC;AAEH,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,OAGtC,CAAC;AAEH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,OAAO,OAAO,KAAG,OAIvD,CAAC;AAEH,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,OAIlD,CAAC;AAEH,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,OAIlD,CAAC;AAEH,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,EAAE,OAAO,OAAO,KAAG,OAIpD,CAAC"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ // Copyright © 2026 Kaleido, Inc.
3
+ //
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ //
6
+ // Licensed under the Apache License, Version 2.0 (the "License");
7
+ // you may not use this file except in compliance with the License.
8
+ // You may obtain a copy of the License at
9
+ //
10
+ // http://www.apache.org/licenses/LICENSE-2.0
11
+ //
12
+ // Unless required by applicable law or agreed to in writing, software
13
+ // distributed under the License is distributed on an "AS IS" BASIS,
14
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ // See the License for the specific language governing permissions and
16
+ // limitations under the License.
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || (function () {
34
+ var ownKeys = function(o) {
35
+ ownKeys = Object.getOwnPropertyNames || function (o) {
36
+ var ar = [];
37
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
38
+ return ar;
39
+ };
40
+ return ownKeys(o);
41
+ };
42
+ return function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ })();
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.testOp = exports.copyOp = exports.moveOp = exports.replaceOp = exports.removeOp = exports.addOp = exports.apply = void 0;
52
+ const fastJsonPatch = __importStar(require("fast-json-patch"));
53
+ const core_1 = require("../types/core");
54
+ const { applyPatch } = fastJsonPatch;
55
+ const apply = (state, patch) => {
56
+ if (!patch || patch.length === 0) {
57
+ return state;
58
+ }
59
+ const { newDocument: newState } = applyPatch(state, patch);
60
+ return newState;
61
+ };
62
+ exports.apply = apply;
63
+ // JSON Patch operation creators
64
+ const addOp = (path, value) => ({
65
+ op: core_1.PatchOpType.ADD,
66
+ path,
67
+ value,
68
+ });
69
+ exports.addOp = addOp;
70
+ const removeOp = (path) => ({
71
+ op: core_1.PatchOpType.REMOVE,
72
+ path,
73
+ });
74
+ exports.removeOp = removeOp;
75
+ const replaceOp = (path, value) => ({
76
+ op: core_1.PatchOpType.REPLACE,
77
+ path,
78
+ value,
79
+ });
80
+ exports.replaceOp = replaceOp;
81
+ const moveOp = (from, path) => ({
82
+ op: core_1.PatchOpType.MOVE,
83
+ from,
84
+ path,
85
+ });
86
+ exports.moveOp = moveOp;
87
+ const copyOp = (from, path) => ({
88
+ op: core_1.PatchOpType.COPY,
89
+ from,
90
+ path,
91
+ });
92
+ exports.copyOp = copyOp;
93
+ const testOp = (path, value) => ({
94
+ op: core_1.PatchOpType.TEST,
95
+ path,
96
+ value,
97
+ });
98
+ exports.testOp = testOp;
99
+ //# sourceMappingURL=patch.js.map