@avaprotocol/sdk-js 2.6.3 → 2.6.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @avaprotocol/sdk-js
2
2
 
3
+ ## 2.6.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 031f401: Update triggerWorkflow for manual trigger and fix template tests
8
+ - Updated dependencies [031f401]
9
+ - @avaprotocol/types@2.4.4
10
+
3
11
  ## 2.6.3
4
12
 
5
13
  ### Patch Changes
@@ -0,0 +1,350 @@
1
+ import { Metadata } from "@grpc/grpc-js";
2
+ import { AggregatorClient } from "@/grpc_codegen/avs_grpc_pb";
3
+ import * as avs_pb from "@/grpc_codegen/avs_pb";
4
+ import Workflow from "./models/workflow";
5
+ import Edge from "./models/edge";
6
+ import Execution from "./models/execution";
7
+ import Step from "./models/step";
8
+ import NodeFactory from "./models/node/factory";
9
+ import TriggerFactory from "./models/trigger/factory";
10
+ import Secret from "./models/secret";
11
+ import { type WorkflowProps, type GetKeyResponse, type RequestOptions, type ClientOption, type SmartWallet, type GetWalletRequest, type GetExecutionsOptions, type GetWorkflowsOptions, type GetSignatureFormatResponse, type RunNodeWithInputsRequest, type RunNodeWithInputsResponse, type RunTriggerRequest, type RunTriggerResponse, type SecretProps, type PageInfo, type GetSecretsOptions, type SecretOptions, type TriggerDataProps, type SimulateWorkflowRequest, type ExecutionProps, type GetTokenMetadataRequest, type GetTokenMetadataResponse, type TimeoutConfig, type CreateSecretResponse, type UpdateSecretResponse, type DeleteSecretResponse, type CancelTaskResponse, type DeleteTaskResponse, type GetExecutionStatsResponse, type GetExecutionStatsOptions, ExecutionStatus } from "@avaprotocol/types";
12
+ import { cleanGrpcErrorMessage } from "./utils";
13
+ declare class BaseClient {
14
+ readonly endpoint: string;
15
+ readonly rpcClient: AggregatorClient;
16
+ protected metadata: Metadata;
17
+ protected factoryAddress?: string;
18
+ protected authKey?: string;
19
+ protected timeoutConfig: TimeoutConfig;
20
+ constructor(opts: ClientOption);
21
+ /**
22
+ * Set default timeout configuration for all requests
23
+ * @param config - The timeout configuration
24
+ */
25
+ setTimeoutConfig(config: TimeoutConfig): void;
26
+ /**
27
+ * Get the current timeout configuration
28
+ * @returns {TimeoutConfig} - The current timeout configuration
29
+ */
30
+ getTimeoutConfig(): TimeoutConfig;
31
+ /**
32
+ * Send a fast gRPC request using FAST preset (5s timeout, 2 retries)
33
+ * @param method - The method name to call
34
+ * @param request - The request object
35
+ * @param options - Request options
36
+ * @returns {Promise<TResponse>} - The response from the server
37
+ */
38
+ protected sendFastRequest<TResponse, TRequest>(method: string, request: TRequest | any, options?: RequestOptions): Promise<TResponse>;
39
+ /**
40
+ * Send a slow gRPC request using SLOW preset (2min timeout, 2 retries)
41
+ * @param method - The method name to call
42
+ * @param request - The request object
43
+ * @param options - Request options
44
+ * @returns {Promise<TResponse>} - The response from the server
45
+ */
46
+ protected sendSlowRequest<TResponse, TRequest>(method: string, request: TRequest | any, options?: RequestOptions): Promise<TResponse>;
47
+ /**
48
+ * Send a no-retry gRPC request using NO_RETRY preset (30s timeout, no retries)
49
+ * @param method - The method name to call
50
+ * @param request - The request object
51
+ * @param options - Request options
52
+ * @returns {Promise<TResponse>} - The response from the server
53
+ */
54
+ protected sendNoRetryRequest<TResponse, TRequest>(method: string, request: TRequest | any, options?: RequestOptions): Promise<TResponse>;
55
+ /**
56
+ * Check if the auth key is valid by decoding the JWT token and checking the expiration
57
+ * @param key - The auth key
58
+ * @returns {boolean} - Whether the auth key is valid
59
+ */
60
+ isAuthKeyValid(key: string): boolean;
61
+ /**
62
+ * Get the signature format from the server
63
+ * @param wallet - The wallet address
64
+ * @returns {Promise<GetSignatureFormatResponse>} - The response containing the signature format
65
+ */
66
+ getSignatureFormat(wallet: string): Promise<GetSignatureFormatResponse>;
67
+ /**
68
+ * The API key could retrieve a wallet's authKey by skipping its signature verification
69
+ * @param message - The message to sign, obtained from getSignatureFormat
70
+ * @param apiKey - The API key used instead of a signature
71
+ * @returns {Promise<GetKeyResponse>} - The response from the auth call
72
+ */
73
+ authWithAPIKey({ message, apiKey, }: {
74
+ message: string;
75
+ apiKey: string;
76
+ }): Promise<GetKeyResponse>;
77
+ /**
78
+ * Getting an authKey from the server by verifying the signature of an EOA wallet
79
+ * @param message - The message to sign, obtained from getSignatureFormat
80
+ * @param signature - The signature of the message
81
+ * @returns {Promise<GetKeyResponse>} - The response from the auth call
82
+ */
83
+ authWithSignature({ message, signature, }: {
84
+ message: string;
85
+ signature: string;
86
+ }): Promise<GetKeyResponse>;
87
+ /**
88
+ * The client could choose to store the authKey and use it for all requests; setting it to undefined will unset the authKey
89
+ * The authKey can be overridden at the request level by request options
90
+ * @param authKey - The auth key
91
+ */
92
+ setAuthKey(authKey: string | undefined): void;
93
+ /**
94
+ * Get the auth key if it's set in the client
95
+ * @returns {string | undefined} - The auth key
96
+ */
97
+ getAuthKey(): string | undefined;
98
+ /**
99
+ * Set the factory address of smart wallets for the client
100
+ * @param address - The factory address
101
+ */
102
+ setFactoryAddress(address: string): void;
103
+ /**
104
+ * Get the factory address if it's set in the client
105
+ * @returns {string | undefined} - The factory address
106
+ */
107
+ getFactoryAddress(): string | undefined;
108
+ /**
109
+ * Send a gRPC request with authentication, timeout support, and error handling
110
+ * @param method - The method name to call
111
+ * @param request - The request object
112
+ * @param options - Request options including timeout configuration
113
+ * @returns {Promise<TResponse>} - The response from the server
114
+ */
115
+ protected sendGrpcRequest<TResponse, TRequest>(method: string, request: TRequest | any, options?: RequestOptions): Promise<TResponse>;
116
+ }
117
+ declare class Client extends BaseClient {
118
+ constructor(config: ClientOption);
119
+ /**
120
+ * Get the list of smart wallets; new wallets can be added to the list by calling `getWallet`
121
+ * @param {RequestOptions} options - Request options
122
+ * @returns {Promise<SmartWallet[]>} - The list of SmartWallet objects
123
+ */
124
+ getWallets(options?: RequestOptions): Promise<SmartWallet[]>;
125
+ /**
126
+ * Add a new smart wallet address to the wallet list
127
+ * @param {string} salt - The salt for the wallet
128
+ * @param {string} factoryAddress - Factory address for the wallet; if not provided, the address stored in the client will be used
129
+ * @param {RequestOptions} options - Request options
130
+ * @returns {Promise<SmartWallet>} - The added SmartWallet object
131
+ */
132
+ getWallet({ salt, factoryAddress }: GetWalletRequest, options?: RequestOptions): Promise<SmartWallet>;
133
+ /**
134
+ * Set wallet properties including hiding/unhiding a wallet
135
+ * @param {GetWalletRequest} walletRequest - The wallet request containing salt and optional factory address
136
+ * @param {object} options - Options for the wallet
137
+ * @param {boolean} options.isHidden - Whether the wallet should be hidden
138
+ * @param {RequestOptions} requestOptions - Request options
139
+ * @returns {Promise<SmartWallet>} - The updated SmartWallet object
140
+ */
141
+ setWallet({ salt, factoryAddress }: GetWalletRequest, { isHidden }: {
142
+ isHidden: boolean;
143
+ }, requestOptions?: RequestOptions): Promise<SmartWallet>;
144
+ /**
145
+ * Submit a workflow to the AVS server; once the workflow is submitted, it cannot be modified
146
+ * @param {Workflow} workflow - Workflow object to submit
147
+ * @param {RequestOptions} options - Request options
148
+ * @returns {Promise<string>} - The Id of the submitted workflow
149
+ */
150
+ submitWorkflow(workflow: Workflow, options?: RequestOptions): Promise<string>;
151
+ createWorkflow(props: WorkflowProps): Workflow;
152
+ /**
153
+ * Get the list of workflows for multiple addresses
154
+ * @param {string[]} addresses - The list of addresses
155
+ * @param {GetWorkflowsOptions} options - Request options
156
+ * @param {string} [options.before] - Get items before this cursor value (for backward pagination)
157
+ * @param {string} [options.after] - Get items after this cursor value (for forward pagination)
158
+ * @param {number} [options.limit] - The page limit of the response; default is 10
159
+ * @param {boolean} [options.includeNodes] - Include task nodes (expensive field)
160
+ * @param {boolean} [options.includeEdges] - Include task edges (expensive field)
161
+ * @param {string} [options.authKey] - The auth key for the request
162
+ * @returns {Promise<{ items: WorkflowProps[]; pageInfo: PageInfo }>} - The list of WorkflowProps objects with nested pagination metadata
163
+ */
164
+ getWorkflows(addresses: string[], options?: GetWorkflowsOptions): Promise<{
165
+ items: WorkflowProps[];
166
+ pageInfo: PageInfo;
167
+ }>;
168
+ /**
169
+ * Get the count of workflows for multiple addresses
170
+ * @param addresses - The list of addresses
171
+ * @param options - Request options
172
+ * @returns {Promise<number>} - The count of workflows
173
+ */
174
+ getWorkflowCount(addresses: string[], options?: RequestOptions): Promise<number>;
175
+ /**
176
+ * Get the list of executions for multiple workflows
177
+ * @param {string[]} workflows - The list of workflow ids to fetch execution for
178
+ * @param {GetExecutionsOptions} options - Request options
179
+ * @param {string} [options.before] - Get items before this cursor value (for backward pagination)
180
+ * @param {string} [options.after] - Get items after this cursor value (for forward pagination)
181
+ * @param {number} [options.limit] - The page limit of the response; default is 10
182
+ * @param {string} [options.authKey] - The auth key for the request
183
+ * @returns {Promise<{ items: ExecutionProps[]; pageInfo: PageInfo }>} - The list of ExecutionProps objects with nested pagination metadata
184
+ */
185
+ getExecutions(workflows: string[], options?: GetExecutionsOptions): Promise<{
186
+ items: ExecutionProps[];
187
+ pageInfo: PageInfo;
188
+ }>;
189
+ /**
190
+ * Get a specific execution by id
191
+ * @param {string} workflowId - The workflow id (taskId)
192
+ * @param {string} executionId - The execution id
193
+ * @param {RequestOptions} options - Request options
194
+ * @returns {Promise<ExecutionProps>} - The ExecutionProps object
195
+ */
196
+ getExecution(workflowId: string, executionId: string, options?: RequestOptions): Promise<ExecutionProps>;
197
+ /**
198
+ * Get the count of executions for multiple workflows
199
+ * @param workflows - The list of workflow ids
200
+ * @param options - Request options
201
+ * @returns {Promise<number>} - The count of executions
202
+ */
203
+ getExecutionCount(workflows: string[], options?: RequestOptions): Promise<number>;
204
+ /**
205
+ * Get execution statistics for a specified time period
206
+ * @param {GetExecutionStatsOptions} options - Request options
207
+ * @param {string[]} [options.workflowIds] - Optional array of workflow IDs
208
+ * @param {number} [options.days] - Number of days to look back (default: 7)
209
+ * @param {string} [options.authKey] - The auth key for the request
210
+ * @returns {Promise<GetExecutionStatsResponse>} - Execution statistics
211
+ */
212
+ getExecutionStats(options?: GetExecutionStatsOptions): Promise<GetExecutionStatsResponse>;
213
+ /**
214
+ * Get the status of an execution
215
+ * @param {string} workflowId - The workflow id (taskId)
216
+ * @param {string} executionId - The execution id
217
+ * @param {RequestOptions} options - Request options
218
+ * @returns {Promise<ExecutionStatus>} - The status of the execution
219
+ */
220
+ getExecutionStatus(workflowId: string, executionId: string, options?: RequestOptions): Promise<ExecutionStatus>;
221
+ /**
222
+ * Get a workflow by id
223
+ * @param {string} id - The workflow id
224
+ * @param {RequestOptions} options - Request options
225
+ * @returns {Promise<Workflow>} - The Workflow object
226
+ */
227
+ getWorkflow(id: string, options?: RequestOptions): Promise<Workflow>;
228
+ /**
229
+ * Trigger a workflow with the new flattened trigger data structure
230
+ * @param {Object} params - The trigger parameters
231
+ * @param {string} params.id - The workflow id
232
+ * @param {TriggerDataProps} params.triggerData - The trigger data
233
+ * @param {boolean} params.isBlocking - Whether to block until execution completes
234
+ * @param {RequestOptions} options - Request options
235
+ * @returns {Promise<avs_pb.TriggerTaskResp.AsObject>} - The response from triggering the workflow
236
+ */
237
+ triggerWorkflow({ id, triggerData, isBlocking, }: {
238
+ id: string;
239
+ triggerData: TriggerDataProps;
240
+ isBlocking?: boolean;
241
+ }, options?: RequestOptions): Promise<avs_pb.TriggerTaskResp.AsObject>;
242
+ /**
243
+ * Cancel a workflow
244
+ * @param {string} id - The workflow id
245
+ * @param {RequestOptions} options - Request options
246
+ * @returns {Promise<CancelTaskResponse>} - The response from canceling the workflow
247
+ */
248
+ cancelWorkflow(id: string, options?: RequestOptions): Promise<CancelTaskResponse>;
249
+ /**
250
+ * Delete a workflow
251
+ * @param {string} id - The workflow id
252
+ * @param {RequestOptions} options - Request options
253
+ * @returns {Promise<DeleteTaskResponse>} - The response from deleting the workflow
254
+ */
255
+ deleteWorkflow(id: string, options?: RequestOptions): Promise<DeleteTaskResponse>;
256
+ /**
257
+ * Create a new secret
258
+ * @param {string} name - The name of the secret
259
+ * @param {string} value - The value of the secret
260
+ * @param {SecretOptions} [options] - Request options
261
+ * @param {string} [options.workflowId] - The workflow ID to associate the secret with
262
+ * @param {string} [options.orgId] - The organization ID to associate the secret with
263
+ * @param {string} [options.authKey] - The auth key for the request
264
+ * @returns {Promise<CreateSecretResponse>} - Structured response with creation details
265
+ */
266
+ createSecret(name: string, value: string, options?: SecretOptions): Promise<CreateSecretResponse>;
267
+ /**
268
+ * Update a secret
269
+ * @param {string} name - The name of the secret
270
+ * @param {string} value - The value of the secret
271
+ * @param {SecretOptions} [options] - Request options
272
+ * @param {string} [options.workflowId] - The workflow ID to associate the secret with
273
+ * @param {string} [options.orgId] - The organization ID to associate the secret with
274
+ * @param {string} [options.authKey] - The auth key for the request
275
+ * @returns {Promise<UpdateSecretResponse>} - Structured response with update details
276
+ */
277
+ updateSecret(name: string, value: string, options?: SecretOptions): Promise<UpdateSecretResponse>;
278
+ /**
279
+ * Get the list of secrets
280
+ * @param {GetSecretsOptions} options - Request options
281
+ * @param {string} [options.workflowId] - Filter secrets by workflow ID
282
+ * @param {string} [options.orgId] - Filter secrets by organization ID
283
+ * @param {string} [options.before] - Get items before this cursor value (for backward pagination)
284
+ * @param {string} [options.after] - Get items after this cursor value (for forward pagination)
285
+ * @param {number} [options.limit] - The page limit of the response; default is 10
286
+ * @param {boolean} [options.includeTimestamps] - Include created_at and updated_at fields
287
+ * @param {boolean} [options.includeCreatedBy] - Include created_by field
288
+ * @param {boolean} [options.includeDescription] - Include description field
289
+ * @param {string} [options.authKey] - The auth key for the request
290
+ * @returns {Promise<{ items: SecretProps[]; pageInfo: PageInfo }>} - The list of Secret objects with nested pagination metadata
291
+ */
292
+ getSecrets(options?: GetSecretsOptions): Promise<{
293
+ items: SecretProps[];
294
+ pageInfo: PageInfo;
295
+ }>;
296
+ /**
297
+ * Delete a secret
298
+ * @param {string} name - The name of the secret
299
+ * @param {SecretOptions} [options] - Request options
300
+ * @param {string} [options.workflowId] - The workflow ID to associate the secret with
301
+ * @param {string} [options.orgId] - The organization ID to associate the secret with
302
+ * @param {string} [options.authKey] - The auth key for the request
303
+ * @returns {Promise<DeleteSecretResponse>} - Structured response with deletion details
304
+ */
305
+ deleteSecret(name: string, options?: SecretOptions): Promise<DeleteSecretResponse>;
306
+ /**
307
+ * Run a node with inputs for testing purposes
308
+ * @param {RunNodeWithInputsRequest} params - The parameters for running the node
309
+ * @param {string} params.nodeType - The type of the node (restApi, customCode, etc.)
310
+ * @param {Record<string, any>} params.nodeConfig - The configuration for the node
311
+ * @param {Record<string, any>} params.inputVariables - Variables to pass to the node
312
+ * @param {RequestOptions} options - Request options
313
+ * @returns {Promise<RunNodeWithInputsResponse>} - The response from running the node
314
+ */
315
+ runNodeWithInputs({ nodeType, nodeConfig, inputVariables }: RunNodeWithInputsRequest, options?: RequestOptions): Promise<RunNodeWithInputsResponse>;
316
+ /**
317
+ * Run a trigger for testing purposes
318
+ * @param {RunTriggerRequest} params - The parameters for running the trigger
319
+ * @param {string} params.triggerType - The type of the trigger (blockTrigger, cronTrigger, etc.)
320
+ * @param {Record<string, any>} params.triggerConfig - The configuration for the trigger
321
+ * @param {RequestOptions} options - Request options
322
+ * @returns {Promise<RunTriggerResponse>} - The response from running the trigger
323
+ */
324
+ runTrigger({ triggerType, triggerConfig }: RunTriggerRequest, options?: RequestOptions): Promise<RunTriggerResponse>;
325
+ /**
326
+ * Simulate a complete task execution including trigger and all workflow nodes
327
+ * @param {SimulateWorkflowRequest} params - The parameters for simulating the task
328
+ * @param {Record<string, any>} params.trigger - The trigger configuration
329
+ * @param {Array<Record<string, any>>} params.nodes - The workflow nodes
330
+ * @param {Array<Record<string, any>>} params.edges - The workflow edges
331
+ * @param {Record<string, any>} params.inputVariables - Input variables for the simulation
332
+ * @param {RequestOptions} options - Request options
333
+ * @returns {Promise<ExecutionProps>} - The response from simulating the task
334
+ */
335
+ simulateWorkflow({ trigger, nodes, edges, inputVariables }: SimulateWorkflowRequest, options?: RequestOptions): Promise<ExecutionProps>;
336
+ /**
337
+ * Get token metadata by contract address
338
+ * @param {GetTokenMetadataRequest} params - The parameters for getting token metadata
339
+ * @param {string} params.address - The contract address to look up
340
+ * @param {RequestOptions} options - Request options
341
+ * @returns {Promise<GetTokenMetadataResponse>} - The response containing token metadata
342
+ */
343
+ getTokenMetadata({ address }: GetTokenMetadataRequest, options?: RequestOptions): Promise<GetTokenMetadataResponse>;
344
+ }
345
+ export * from "./models/node/factory";
346
+ export * from "./models/trigger/factory";
347
+ export { Client, Workflow, Edge, Execution, Step, NodeFactory, TriggerFactory, Secret, cleanGrpcErrorMessage, };
348
+ export type { TokenMetadata, GetTokenMetadataRequest, GetTokenMetadataResponse, TokenSource, } from "@avaprotocol/types";
349
+ export { TimeoutPresets, type TimeoutConfig, type TimeoutError, } from "@avaprotocol/types";
350
+ //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,QAAQ,EAAU,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB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CAAC,yBAAyB,CAAC;IAuDrC;;;;;;;OAOG;IACG,UAAU,CACd,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,iBAAiB,EACjD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,kBAAkB,CAAC;IA0C9B;;;;;;;;;OASG;IACG,gBAAgB,CACpB,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,cAAmB,EAAE,EAAE,uBAAuB,EACvE,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,cAAc,CAAC;IAuC1B;;;;;;OAMG;IACG,gBAAgB,CACpB,EAAE,OAAO,EAAE,EAAE,uBAAuB,EACpC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,wBAAwB,CAAC;CAwBrC;AAED,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AAEzC,OAAO,EACL,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,WAAW,EACX,cAAc,EACd,MAAM,EACN,qBAAqB,GACtB,CAAC;AAGF,YAAY,EACV,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACxB,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -15391,53 +15391,54 @@ var Trigger = class {
15391
15391
  var import_types = require("@avaprotocol/types");
15392
15392
  var BlockTrigger2 = class _BlockTrigger extends Trigger {
15393
15393
  constructor(props) {
15394
- super({ ...props, type: import_types.TriggerType.Block, data: props.data });
15394
+ super({
15395
+ ...props,
15396
+ type: import_types.TriggerType.Block
15397
+ });
15395
15398
  }
15396
15399
  toRequest() {
15397
- const request = new avs_pb2.TaskTrigger();
15398
- request.setName(this.name);
15399
- request.setId(this.id);
15400
- request.setType(avs_pb2.TriggerType.TRIGGER_TYPE_BLOCK);
15401
- if (!this.data) {
15402
- throw new Error(`Trigger data is missing for block`);
15403
- }
15400
+ const trigger = new avs_pb2.TaskTrigger();
15401
+ trigger.setId(this.id);
15402
+ trigger.setName(this.name);
15403
+ trigger.setType(avs_pb2.TriggerType.TRIGGER_TYPE_BLOCK);
15404
+ const blockTrigger = new avs_pb2.BlockTrigger();
15405
+ const config = new avs_pb2.BlockTrigger.Config();
15404
15406
  const blockData = this.data;
15407
+ if (!blockData) {
15408
+ throw new Error("Trigger data is missing for block");
15409
+ }
15405
15410
  if (blockData.interval === null || blockData.interval === void 0) {
15406
15411
  throw new Error("Interval is required for block trigger");
15407
15412
  }
15413
+ if (blockData.interval <= 0) {
15414
+ throw new Error("Interval must be greater than 0");
15415
+ }
15408
15416
  if (!Number.isInteger(blockData.interval)) {
15409
15417
  throw new Error(`BlockTrigger interval must be an integer, got: ${blockData.interval}`);
15410
15418
  }
15411
- if (blockData.interval <= 0) {
15412
- throw new Error(`Interval must be greater than 0`);
15413
- }
15414
- const trigger = new avs_pb2.BlockTrigger();
15415
- const config = new avs_pb2.BlockTrigger.Config();
15416
15419
  config.setInterval(blockData.interval);
15417
- trigger.setConfig(config);
15418
- request.setBlock(trigger);
15419
- return request;
15420
+ blockTrigger.setConfig(config);
15421
+ trigger.setBlock(blockTrigger);
15422
+ return trigger;
15420
15423
  }
15421
15424
  static fromResponse(raw) {
15422
15425
  const obj = raw.toObject();
15423
15426
  let data = { interval: 0 };
15424
15427
  if (raw.getBlock() && raw.getBlock().hasConfig()) {
15425
15428
  const config = raw.getBlock().getConfig();
15426
- if (config) {
15427
- data = {
15428
- interval: config.getInterval() || 0
15429
- };
15430
- }
15429
+ data = {
15430
+ interval: config.getInterval()
15431
+ };
15431
15432
  }
15432
15433
  return new _BlockTrigger({
15433
- ...obj,
15434
- type: import_types.TriggerType.Block,
15434
+ id: obj.id,
15435
+ name: obj.name,
15436
+ type: obj.type,
15435
15437
  data
15436
15438
  });
15437
15439
  }
15438
15440
  /**
15439
- * Convert raw data from runNodeWithInputs response to BlockOutput format
15440
- * @param rawData - The raw data from the gRPC response
15441
+ * Convert the output to the expected format
15441
15442
  * @returns {BlockTriggerOutput | undefined} - The converted data
15442
15443
  */
15443
15444
  getOutput() {
@@ -15464,28 +15465,31 @@ var avs_pb3 = __toESM(require_avs_pb());
15464
15465
  var import_types2 = require("@avaprotocol/types");
15465
15466
  var CronTrigger2 = class _CronTrigger extends Trigger {
15466
15467
  constructor(props) {
15467
- super({ ...props, type: import_types2.TriggerType.Cron, data: props.data });
15468
+ super({
15469
+ ...props,
15470
+ type: import_types2.TriggerType.Cron
15471
+ });
15468
15472
  }
15469
15473
  toRequest() {
15470
15474
  const request = new avs_pb3.TaskTrigger();
15471
- request.setName(this.name);
15472
15475
  request.setId(this.id);
15476
+ request.setName(this.name);
15473
15477
  request.setType(avs_pb3.TriggerType.TRIGGER_TYPE_CRON);
15474
15478
  if (!this.data) {
15475
15479
  throw new Error(`Trigger data is missing for ${this.type}`);
15476
15480
  }
15477
15481
  const cronData = this.data;
15478
- if (cronData.schedules === null || cronData.schedules === void 0) {
15482
+ if (!cronData.schedules || !Array.isArray(cronData.schedules)) {
15479
15483
  throw new Error("Schedules are required for cron trigger");
15480
15484
  }
15481
- if (!Array.isArray(cronData.schedules) || cronData.schedules.length === 0) {
15485
+ if (cronData.schedules.length === 0) {
15482
15486
  throw new Error("Schedules are required for cron trigger");
15483
15487
  }
15484
- const trigger = new avs_pb3.CronTrigger();
15485
15488
  const config = new avs_pb3.CronTrigger.Config();
15486
15489
  config.setSchedulesList(cronData.schedules);
15487
- trigger.setConfig(config);
15488
- request.setCron(trigger);
15490
+ const cronTrigger = new avs_pb3.CronTrigger();
15491
+ cronTrigger.setConfig(config);
15492
+ request.setCron(cronTrigger);
15489
15493
  return request;
15490
15494
  }
15491
15495
  static fromResponse(raw) {
@@ -15493,11 +15497,9 @@ var CronTrigger2 = class _CronTrigger extends Trigger {
15493
15497
  let data = { schedules: [] };
15494
15498
  if (raw.getCron() && raw.getCron().hasConfig()) {
15495
15499
  const config = raw.getCron().getConfig();
15496
- if (config) {
15497
- data = {
15498
- schedules: config.getSchedulesList() || []
15499
- };
15500
- }
15500
+ data = {
15501
+ schedules: config.getSchedulesList()
15502
+ };
15501
15503
  }
15502
15504
  return new _CronTrigger({
15503
15505
  ...obj,
@@ -15506,7 +15508,7 @@ var CronTrigger2 = class _CronTrigger extends Trigger {
15506
15508
  });
15507
15509
  }
15508
15510
  /**
15509
- * Convert raw data from runTrigger response to CronOutput format
15511
+ * Convert raw data from runNodeWithInputs response to CronOutput format
15510
15512
  * @param rawData - The raw data from the gRPC response
15511
15513
  * @returns {CronTriggerOutput | undefined} - The converted data
15512
15514
  */
@@ -15904,12 +15906,15 @@ var avs_pb5 = __toESM(require_avs_pb());
15904
15906
  var import_types5 = require("@avaprotocol/types");
15905
15907
  var FixedTimeTrigger2 = class _FixedTimeTrigger extends Trigger {
15906
15908
  constructor(props) {
15907
- super({ ...props, type: import_types5.TriggerType.FixedTime, data: props.data });
15909
+ super({
15910
+ ...props,
15911
+ type: import_types5.TriggerType.FixedTime
15912
+ });
15908
15913
  }
15909
15914
  toRequest() {
15910
15915
  const request = new avs_pb5.TaskTrigger();
15911
- request.setName(this.name);
15912
15916
  request.setId(this.id);
15917
+ request.setName(this.name);
15913
15918
  request.setType(avs_pb5.TriggerType.TRIGGER_TYPE_FIXED_TIME);
15914
15919
  if (!this.data) {
15915
15920
  throw new Error(`Trigger data is missing for ${this.type}`);
@@ -15928,11 +15933,9 @@ var FixedTimeTrigger2 = class _FixedTimeTrigger extends Trigger {
15928
15933
  let data = { epochsList: [] };
15929
15934
  if (raw.getFixedTime() && raw.getFixedTime().hasConfig()) {
15930
15935
  const config = raw.getFixedTime().getConfig();
15931
- if (config) {
15932
- data = {
15933
- epochsList: config.getEpochsList() || []
15934
- };
15935
- }
15936
+ data = {
15937
+ epochsList: config.getEpochsList()
15938
+ };
15936
15939
  }
15937
15940
  return new _FixedTimeTrigger({
15938
15941
  ...obj,
@@ -15941,7 +15944,7 @@ var FixedTimeTrigger2 = class _FixedTimeTrigger extends Trigger {
15941
15944
  });
15942
15945
  }
15943
15946
  /**
15944
- * Convert raw data from runTrigger response to FixedTimeOutput format
15947
+ * Convert raw data from runNodeWithInputs response to FixedTimeOutput format
15945
15948
  * @param rawData - The raw data from the gRPC response
15946
15949
  * @returns {FixedTimeTriggerOutput | undefined} - The converted data
15947
15950
  */
@@ -17365,8 +17368,22 @@ var secret_default = Secret;
17365
17368
 
17366
17369
  // src/index.ts
17367
17370
  var import_types20 = require("@avaprotocol/types");
17371
+ var import_avs_pb = __toESM(require_avs_pb());
17368
17372
  var google_protobuf_struct_pb4 = __toESM(require("google-protobuf/google/protobuf/struct_pb"));
17369
17373
  var import_types21 = require("@avaprotocol/types");
17374
+ function convertProtobufExecutionStatus(protobufStatus) {
17375
+ switch (protobufStatus) {
17376
+ case import_avs_pb.ExecutionStatus.EXECUTION_STATUS_PENDING:
17377
+ return import_types20.ExecutionStatus.Pending;
17378
+ case import_avs_pb.ExecutionStatus.EXECUTION_STATUS_COMPLETED:
17379
+ return import_types20.ExecutionStatus.Completed;
17380
+ case import_avs_pb.ExecutionStatus.EXECUTION_STATUS_FAILED:
17381
+ return import_types20.ExecutionStatus.Failed;
17382
+ case import_avs_pb.ExecutionStatus.EXECUTION_STATUS_UNSPECIFIED:
17383
+ default:
17384
+ return import_types20.ExecutionStatus.Unspecified;
17385
+ }
17386
+ }
17370
17387
  var BaseClient = class {
17371
17388
  constructor(opts) {
17372
17389
  this.endpoint = opts.endpoint;
@@ -17857,7 +17874,7 @@ var Client = class extends BaseClient {
17857
17874
  request.setTaskId(workflowId);
17858
17875
  request.setExecutionId(executionId);
17859
17876
  const result = await this.sendGrpcRequest("getExecutionStatus", request, options);
17860
- return result.getStatus();
17877
+ return convertProtobufExecutionStatus(result.getStatus());
17861
17878
  }
17862
17879
  /**
17863
17880
  * Get a workflow by id
@@ -17901,7 +17918,9 @@ var Client = class extends BaseClient {
17901
17918
  timestampIso: triggerData.timestampIso
17902
17919
  };
17903
17920
  const dataValue = new google_protobuf_struct_pb4.Value();
17904
- dataValue.setStructValue(google_protobuf_struct_pb4.Struct.fromJavaScript(triggerOutputData));
17921
+ dataValue.setStructValue(
17922
+ google_protobuf_struct_pb4.Struct.fromJavaScript(triggerOutputData)
17923
+ );
17905
17924
  fixedTimeOutput.setData(dataValue);
17906
17925
  request.setFixedTimeTrigger(fixedTimeOutput);
17907
17926
  break;
@@ -17913,7 +17932,9 @@ var Client = class extends BaseClient {
17913
17932
  timestampIso: triggerData.timestampIso
17914
17933
  };
17915
17934
  const dataValue = new google_protobuf_struct_pb4.Value();
17916
- dataValue.setStructValue(google_protobuf_struct_pb4.Struct.fromJavaScript(triggerOutputData));
17935
+ dataValue.setStructValue(
17936
+ google_protobuf_struct_pb4.Struct.fromJavaScript(triggerOutputData)
17937
+ );
17917
17938
  cronOutput.setData(dataValue);
17918
17939
  request.setCronTrigger(cronOutput);
17919
17940
  break;
@@ -17931,7 +17952,9 @@ var Client = class extends BaseClient {
17931
17952
  gasUsed: blockData.gasUsed || 0
17932
17953
  };
17933
17954
  const dataValue = new google_protobuf_struct_pb4.Value();
17934
- dataValue.setStructValue(google_protobuf_struct_pb4.Struct.fromJavaScript(triggerOutputData));
17955
+ dataValue.setStructValue(
17956
+ google_protobuf_struct_pb4.Struct.fromJavaScript(triggerOutputData)
17957
+ );
17935
17958
  blockOutput.setData(dataValue);
17936
17959
  request.setBlockTrigger(blockOutput);
17937
17960
  break;
@@ -17964,7 +17987,11 @@ var Client = class extends BaseClient {
17964
17987
  );
17965
17988
  }
17966
17989
  const result = await this.sendGrpcRequest("triggerTask", request, options);
17967
- return result.toObject();
17990
+ const responseObject = result.toObject();
17991
+ return {
17992
+ ...responseObject,
17993
+ status: convertProtobufExecutionStatus(result.getStatus())
17994
+ };
17968
17995
  }
17969
17996
  /**
17970
17997
  * Cancel a workflow
@@ -18222,10 +18249,7 @@ var Client = class extends BaseClient {
18222
18249
  try {
18223
18250
  metadata = convertProtobufValueToJs(metadataValue);
18224
18251
  } catch (error) {
18225
- console.warn(
18226
- "Failed to convert metadata from protobuf Value:",
18227
- error
18228
- );
18252
+ console.warn("Failed to convert metadata from protobuf Value:", error);
18229
18253
  metadata = metadataValue;
18230
18254
  }
18231
18255
  }