@avaprotocol/sdk-js 2.3.13-dev.0 → 2.3.13-dev.1

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.
@@ -1,5 +1,4 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
- import { Value as ProtobufValue } from "google-protobuf/google/protobuf/struct_pb";
3
2
  import { convertProtobufValueToJs, convertProtobufStepTypeToSdk, } from "../utils";
4
3
  class Step {
5
4
  constructor(props) {
@@ -35,265 +34,357 @@ class Step {
35
34
  };
36
35
  }
37
36
  static getOutput(step) {
38
- const outputDataType = step.getOutputDataCase();
39
- let nodeOutputMessage;
40
- switch (outputDataType) {
37
+ // Handle both protobuf instances and plain objects
38
+ const getOutputDataCase = () => {
39
+ if (typeof step.getOutputDataCase === "function") {
40
+ return step.getOutputDataCase();
41
+ }
42
+ // For plain objects, determine the case by checking which properties exist
43
+ const stepObj = step;
44
+ if (stepObj.blockTrigger)
45
+ return avs_pb.Execution.Step.OutputDataCase.BLOCK_TRIGGER;
46
+ if (stepObj.fixedTimeTrigger)
47
+ return avs_pb.Execution.Step.OutputDataCase.FIXED_TIME_TRIGGER;
48
+ if (stepObj.cronTrigger)
49
+ return avs_pb.Execution.Step.OutputDataCase.CRON_TRIGGER;
50
+ if (stepObj.eventTrigger)
51
+ return avs_pb.Execution.Step.OutputDataCase.EVENT_TRIGGER;
52
+ if (stepObj.manualTrigger)
53
+ return avs_pb.Execution.Step.OutputDataCase.MANUAL_TRIGGER;
54
+ if (stepObj.ethTransfer)
55
+ return avs_pb.Execution.Step.OutputDataCase.ETH_TRANSFER;
56
+ if (stepObj.graphql)
57
+ return avs_pb.Execution.Step.OutputDataCase.GRAPHQL;
58
+ if (stepObj.contractRead)
59
+ return avs_pb.Execution.Step.OutputDataCase.CONTRACT_READ;
60
+ if (stepObj.contractWrite)
61
+ return avs_pb.Execution.Step.OutputDataCase.CONTRACT_WRITE;
62
+ if (stepObj.customCode)
63
+ return avs_pb.Execution.Step.OutputDataCase.CUSTOM_CODE;
64
+ if (stepObj.restApi)
65
+ return avs_pb.Execution.Step.OutputDataCase.REST_API;
66
+ if (stepObj.branch)
67
+ return avs_pb.Execution.Step.OutputDataCase.BRANCH;
68
+ if (stepObj.filter)
69
+ return avs_pb.Execution.Step.OutputDataCase.FILTER;
70
+ if (stepObj.loop)
71
+ return avs_pb.Execution.Step.OutputDataCase.LOOP;
72
+ return avs_pb.Execution.Step.OutputDataCase.OUTPUT_DATA_NOT_SET;
73
+ };
74
+ switch (getOutputDataCase()) {
41
75
  case avs_pb.Execution.Step.OutputDataCase.OUTPUT_DATA_NOT_SET:
42
76
  return undefined;
43
77
  // Trigger outputs
44
78
  case avs_pb.Execution.Step.OutputDataCase.BLOCK_TRIGGER:
45
- const blockOutput = step.getBlockTrigger()?.toObject();
46
- return blockOutput
47
- ? { blockNumber: blockOutput.blockNumber }
48
- : undefined;
79
+ return typeof step.getBlockTrigger === "function"
80
+ ? step.getBlockTrigger()?.toObject()
81
+ : step.blockTrigger;
49
82
  case avs_pb.Execution.Step.OutputDataCase.FIXED_TIME_TRIGGER:
50
- const fixedTimeOutput = step.getFixedTimeTrigger()?.toObject();
51
- return fixedTimeOutput
52
- ? {
53
- timestamp: fixedTimeOutput.timestamp,
54
- timestampIso: fixedTimeOutput.timestampIso,
55
- }
56
- : undefined;
83
+ return typeof step.getFixedTimeTrigger === "function"
84
+ ? step.getFixedTimeTrigger()?.toObject()
85
+ : step.fixedTimeTrigger;
57
86
  case avs_pb.Execution.Step.OutputDataCase.CRON_TRIGGER:
58
- const cronOutput = step.getCronTrigger()?.toObject();
59
- return cronOutput
60
- ? {
61
- timestamp: cronOutput.timestamp,
62
- timestampIso: cronOutput.timestampIso,
63
- }
64
- : undefined;
87
+ return typeof step.getCronTrigger === "function"
88
+ ? step.getCronTrigger()?.toObject()
89
+ : step.cronTrigger;
65
90
  case avs_pb.Execution.Step.OutputDataCase.EVENT_TRIGGER:
66
- const eventTrigger = step.getEventTrigger();
91
+ const eventTrigger = typeof step.getEventTrigger === "function"
92
+ ? step.getEventTrigger()
93
+ : step.eventTrigger;
67
94
  if (eventTrigger) {
68
- if (eventTrigger.hasEvmLog()) {
95
+ if (typeof eventTrigger.hasEvmLog === "function" &&
96
+ eventTrigger.hasEvmLog()) {
69
97
  return eventTrigger.getEvmLog()?.toObject();
70
98
  }
71
- else if (eventTrigger.hasTransferLog()) {
99
+ else if (typeof eventTrigger.hasTransferLog === "function" &&
100
+ eventTrigger.hasTransferLog()) {
72
101
  return eventTrigger.getTransferLog()?.toObject();
73
102
  }
103
+ else if (eventTrigger.evmLog) {
104
+ return eventTrigger.evmLog;
105
+ }
106
+ else if (eventTrigger.transferLog) {
107
+ return eventTrigger.transferLog;
108
+ }
74
109
  }
75
110
  return undefined;
76
111
  case avs_pb.Execution.Step.OutputDataCase.MANUAL_TRIGGER:
77
- const manualOutput = step.getManualTrigger()?.toObject();
78
- return manualOutput || undefined;
79
- // Node outputs
112
+ return typeof step.getManualTrigger === "function"
113
+ ? step.getManualTrigger()?.toObject() || undefined
114
+ : step.manualTrigger;
115
+ // Node outputs - RESTORE MISSING CASES
80
116
  case avs_pb.Execution.Step.OutputDataCase.ETH_TRANSFER:
81
- const ethTransferOutput = step.getEthTransfer()?.toObject();
82
- return ethTransferOutput
83
- ? {
84
- transactionHash: ethTransferOutput.transactionHash,
117
+ return typeof step.getEthTransfer === "function"
118
+ ? step.getEthTransfer()?.toObject()
119
+ : step.ethTransfer;
120
+ case avs_pb.Execution.Step.OutputDataCase.CUSTOM_CODE:
121
+ const customCodeOutput = typeof step.getCustomCode === "function"
122
+ ? step.getCustomCode()
123
+ : step.customCode;
124
+ if (customCodeOutput) {
125
+ if (typeof customCodeOutput.hasData === "function" &&
126
+ customCodeOutput.hasData()) {
127
+ try {
128
+ return convertProtobufValueToJs(customCodeOutput.getData());
129
+ }
130
+ catch {
131
+ // Fallback: if conversion fails, return the raw data
132
+ return customCodeOutput.getData();
133
+ }
134
+ }
135
+ else if (customCodeOutput.data) {
136
+ // For plain objects, try to convert or use directly
137
+ return typeof customCodeOutput.data.getKindCase === "function"
138
+ ? convertProtobufValueToJs(customCodeOutput.data)
139
+ : customCodeOutput.data;
140
+ }
141
+ }
142
+ return undefined;
143
+ case avs_pb.Execution.Step.OutputDataCase.REST_API:
144
+ const restApiOutput = typeof step.getRestApi === "function"
145
+ ? step.getRestApi()
146
+ : step.restApi;
147
+ if (restApiOutput) {
148
+ if (typeof restApiOutput.hasData === "function" &&
149
+ restApiOutput.hasData()) {
150
+ try {
151
+ return convertProtobufValueToJs(restApiOutput.getData());
152
+ }
153
+ catch {
154
+ // Fallback: if conversion fails, return the raw data
155
+ return restApiOutput.getData();
156
+ }
157
+ }
158
+ else if (restApiOutput.data) {
159
+ // For plain objects, try to convert or use directly
160
+ return typeof restApiOutput.data.getKindCase === "function"
161
+ ? convertProtobufValueToJs(restApiOutput.data)
162
+ : restApiOutput.data;
163
+ }
164
+ }
165
+ return undefined;
166
+ case avs_pb.Execution.Step.OutputDataCase.BRANCH:
167
+ return typeof step.getBranch === "function"
168
+ ? step.getBranch()?.toObject()
169
+ : step.branch;
170
+ case avs_pb.Execution.Step.OutputDataCase.LOOP:
171
+ const loopOutput = typeof step.getLoop === "function"
172
+ ? step.getLoop()
173
+ : step.loop;
174
+ if (loopOutput) {
175
+ if (typeof loopOutput.getData === "function" &&
176
+ loopOutput.getData()) {
177
+ try {
178
+ return JSON.parse(loopOutput.getData());
179
+ }
180
+ catch {
181
+ return loopOutput.getData();
182
+ }
85
183
  }
86
- : undefined;
184
+ else if (loopOutput.data) {
185
+ // For plain objects
186
+ try {
187
+ return typeof loopOutput.data === "string"
188
+ ? JSON.parse(loopOutput.data)
189
+ : loopOutput.data;
190
+ }
191
+ catch {
192
+ return loopOutput.data;
193
+ }
194
+ }
195
+ }
196
+ return undefined;
87
197
  case avs_pb.Execution.Step.OutputDataCase.GRAPHQL:
88
- nodeOutputMessage = step.getGraphql();
89
- return nodeOutputMessage && nodeOutputMessage.hasData()
90
- ? nodeOutputMessage.getData()
91
- : undefined;
198
+ const graphqlOutput = typeof step.getGraphql === "function"
199
+ ? step.getGraphql()
200
+ : step.graphql;
201
+ if (graphqlOutput) {
202
+ try {
203
+ return typeof graphqlOutput.toObject === "function"
204
+ ? graphqlOutput.toObject()
205
+ : graphqlOutput;
206
+ }
207
+ catch {
208
+ return undefined;
209
+ }
210
+ }
211
+ return undefined;
92
212
  case avs_pb.Execution.Step.OutputDataCase.CONTRACT_READ:
93
- nodeOutputMessage = step.getContractRead();
94
- if (nodeOutputMessage) {
95
- const results = nodeOutputMessage.getResultsList();
96
- if (results && results.length > 0) {
97
- // Always return wrapped format { results: [...] } to match ContractReadNode.fromOutputData
98
- const resultArray = results.map((result) => {
99
- // Match the exact format from ContractReadNode.fromOutputData
100
- const dataFields = result.getDataList().map((field) => ({
101
- name: field.getName(),
102
- type: field.getType(),
103
- value: field.getValue()
104
- }));
105
- return {
106
- methodName: result.getMethodName(),
107
- success: result.getSuccess(),
108
- error: result.getError(),
109
- data: dataFields,
110
- };
111
- });
112
- // Return wrapped format consistently for all cases
113
- return { results: resultArray };
213
+ const contractReadOutput = typeof step.getContractRead === "function"
214
+ ? step.getContractRead()
215
+ : step.contractRead;
216
+ if (contractReadOutput) {
217
+ // Get the raw output object
218
+ const outputObj = typeof contractReadOutput.toObject === "function"
219
+ ? contractReadOutput.toObject()
220
+ : contractReadOutput;
221
+ // Convert resultsList to results for consistency with ContractReadNode.fromOutputData
222
+ if (outputObj && outputObj.resultsList) {
223
+ return {
224
+ ...outputObj,
225
+ results: outputObj.resultsList.map((result) => ({
226
+ methodName: result.methodName,
227
+ success: result.success,
228
+ error: result.error,
229
+ data: result.dataList || []
230
+ }))
231
+ };
114
232
  }
233
+ return outputObj;
115
234
  }
116
235
  return undefined;
117
236
  case avs_pb.Execution.Step.OutputDataCase.CONTRACT_WRITE:
118
- nodeOutputMessage = step.getContractWrite();
119
- if (nodeOutputMessage) {
120
- const results = nodeOutputMessage.getResultsList();
121
- if (results && results.length > 0) {
122
- // Transform enhanced results structure
123
- const transformedResults = results.map((result) => ({
124
- methodName: result.getMethodName(),
125
- success: result.getSuccess(),
126
- transaction: result.getTransaction() ? {
127
- hash: result.getTransaction()?.getHash(),
128
- status: result.getTransaction()?.getStatus(),
129
- blockNumber: result.getTransaction()?.getBlockNumber(),
130
- blockHash: result.getTransaction()?.getBlockHash(),
131
- gasUsed: result.getTransaction()?.getGasUsed(),
132
- gasLimit: result.getTransaction()?.getGasLimit(),
133
- gasPrice: result.getTransaction()?.getGasPrice(),
134
- effectiveGasPrice: result.getTransaction()?.getEffectiveGasPrice(),
135
- from: result.getTransaction()?.getFrom(),
136
- to: result.getTransaction()?.getTo(),
137
- value: result.getTransaction()?.getValue(),
138
- nonce: result.getTransaction()?.getNonce(),
139
- transactionIndex: result.getTransaction()?.getTransactionIndex(),
140
- confirmations: result.getTransaction()?.getConfirmations(),
141
- timestamp: result.getTransaction()?.getTimestamp(),
237
+ const contractWriteOutput = typeof step.getContractWrite === "function"
238
+ ? step.getContractWrite()
239
+ : step.contractWrite;
240
+ if (contractWriteOutput) {
241
+ // Get the raw output object
242
+ const outputObj = typeof contractWriteOutput.toObject === "function"
243
+ ? contractWriteOutput.toObject()
244
+ : contractWriteOutput;
245
+ // Convert resultsList to results for consistency with ContractWriteNode.fromOutputData
246
+ if (outputObj && outputObj.resultsList) {
247
+ const transformedResults = outputObj.resultsList.map((result) => ({
248
+ methodName: result.methodName,
249
+ success: result.success,
250
+ transaction: result.transaction ? {
251
+ hash: result.transaction.hash,
252
+ status: result.transaction.status,
253
+ blockNumber: result.transaction.blockNumber,
254
+ blockHash: result.transaction.blockHash,
255
+ gasUsed: result.transaction.gasUsed,
256
+ gasLimit: result.transaction.gasLimit,
257
+ gasPrice: result.transaction.gasPrice,
258
+ effectiveGasPrice: result.transaction.effectiveGasPrice,
259
+ from: result.transaction.from,
260
+ to: result.transaction.to,
261
+ value: result.transaction.value,
262
+ nonce: result.transaction.nonce,
263
+ transactionIndex: result.transaction.transactionIndex,
264
+ confirmations: result.transaction.confirmations,
265
+ timestamp: result.transaction.timestamp,
142
266
  } : null,
143
- events: result.getEventsList().map((event) => ({
144
- eventName: event.getEventName(),
145
- address: event.getAddress(),
146
- topics: event.getTopicsList(),
147
- data: event.getData(),
148
- decoded: event.getDecodedMap() ? Object.fromEntries(event.getDecodedMap().toArray()) : {},
149
- })),
150
- error: result.getError() ? {
151
- code: result.getError()?.getCode(),
152
- message: result.getError()?.getMessage(),
153
- revertReason: result.getError()?.getRevertReason(),
267
+ events: result.eventsList?.map((event) => ({
268
+ eventName: event.eventName,
269
+ address: event.address,
270
+ topics: event.topicsList || [],
271
+ data: event.data,
272
+ decoded: event.decodedMap || {},
273
+ })) || [],
274
+ error: result.error ? {
275
+ code: result.error.code,
276
+ message: result.error.message,
277
+ revertReason: result.error.revertReason,
154
278
  } : null,
155
- returnData: result.getReturnData() ? {
156
- name: result.getReturnData()?.getName(),
157
- type: result.getReturnData()?.getType(),
158
- value: result.getReturnData()?.getValue(),
279
+ returnData: result.returnData ? {
280
+ name: result.returnData.name,
281
+ type: result.returnData.type,
282
+ value: result.returnData.value,
159
283
  } : null,
160
- inputData: result.getInputData(),
284
+ inputData: result.inputData,
161
285
  }));
162
- // For single result, also provide legacy fields for backward compatibility
163
- if (transformedResults.length === 1) {
164
- return {
165
- results: transformedResults,
166
- // Legacy compatibility fields
286
+ return {
287
+ ...outputObj,
288
+ results: transformedResults,
289
+ // For backward compatibility, provide legacy fields from first result
290
+ ...(transformedResults.length > 0 && {
167
291
  transaction: transformedResults[0].transaction,
168
292
  success: transformedResults[0].success,
169
293
  hash: transformedResults[0].transaction?.hash,
170
- };
171
- }
172
- else {
173
- return { results: transformedResults };
174
- }
294
+ }),
295
+ };
175
296
  }
297
+ return outputObj;
176
298
  }
177
299
  return undefined;
178
- case avs_pb.Execution.Step.OutputDataCase.CUSTOM_CODE:
179
- nodeOutputMessage = step.getCustomCode();
180
- return nodeOutputMessage && nodeOutputMessage.hasData()
181
- ? convertProtobufValueToJs(nodeOutputMessage.getData())
182
- : undefined;
183
- case avs_pb.Execution.Step.OutputDataCase.REST_API:
184
- nodeOutputMessage = step.getRestApi();
185
- return nodeOutputMessage && nodeOutputMessage.hasData()
186
- ? convertProtobufValueToJs(nodeOutputMessage.getData())
187
- : undefined;
188
- case avs_pb.Execution.Step.OutputDataCase.BRANCH:
189
- return step.getBranch()?.toObject();
190
300
  case avs_pb.Execution.Step.OutputDataCase.FILTER:
191
- nodeOutputMessage = step.getFilter();
192
- if (nodeOutputMessage && nodeOutputMessage.hasData()) {
193
- const rawData = nodeOutputMessage.getData();
194
- if (rawData) {
195
- // Handle Any wrapper - need to unpack it first
196
- if (typeof rawData.unpack === 'function') {
197
- try {
198
- // For Any types, unpack to Value and then convert
199
- const unpackedValue = rawData.unpack(ProtobufValue.deserializeBinary, 'google.protobuf.Value');
200
- if (unpackedValue) {
201
- return convertProtobufValueToJs(unpackedValue);
202
- }
203
- }
204
- catch (error) {
205
- // If unpacking fails, log error and return undefined
206
- console.warn('Failed to unpack FilterNode Any wrapper:', error);
207
- return undefined;
208
- }
209
- }
210
- // If no unpack method, this is unexpected for FilterNode
211
- console.warn('FilterNode output data is not an Any wrapper - this is unexpected');
301
+ const filterOutput = typeof step.getFilter === "function"
302
+ ? step.getFilter()
303
+ : step.filter;
304
+ if (filterOutput) {
305
+ try {
306
+ return typeof filterOutput.toObject === "function"
307
+ ? filterOutput.toObject()
308
+ : filterOutput;
309
+ }
310
+ catch {
212
311
  return undefined;
213
312
  }
214
313
  }
215
314
  return undefined;
216
- case avs_pb.Execution.Step.OutputDataCase.LOOP:
217
- const loopOutput = step.getLoop();
218
- if (!loopOutput)
219
- return undefined;
220
- const loopData = loopOutput.getData();
221
- if (!loopData)
222
- return undefined;
223
- // Loop nodes return an array of results from child node executions
224
- // The backend should serialize this as JSON, but may have issues
225
- // Try to parse as JSON first (expected format for array of child results)
226
- try {
227
- const parsedData = JSON.parse(loopData);
228
- // If it's an array, process each item with appropriate child node conversion
229
- if (Array.isArray(parsedData)) {
230
- return parsedData.map((item, index) => {
231
- if (!item || typeof item !== 'object') {
232
- return item; // Primitive values, return as-is
233
- }
234
- // Apply child node-specific conversions based on detected structure
235
- // REST API child output (has statusCode, body, headers)
236
- if (item.statusCode !== undefined && (item.body !== undefined || item.headers !== undefined)) {
237
- return item; // Already in raw format
238
- }
239
- // Custom Code child output (arbitrary object structure)
240
- if (item.result !== undefined || item.output !== undefined || item.error !== undefined) {
241
- return item; // Already processed by convertProtobufValueToJs in backend
242
- }
243
- // ETH Transfer child output (has transactionHash)
244
- if (item.transactionHash !== undefined) {
245
- return { transactionHash: item.transactionHash };
246
- }
247
- // Contract Read child output (has methodName and data)
248
- if (item.methodName !== undefined && item.data !== undefined) {
249
- return item; // Already in structured format
250
- }
251
- // GraphQL child output (has data field)
252
- if (item.data !== undefined && typeof item.data === 'object') {
253
- return item; // Already processed
254
- }
255
- // Generic object - return as-is (might be custom structure)
256
- return item;
257
- });
258
- }
259
- // Single object result (not an array)
260
- if (parsedData && typeof parsedData === 'object') {
261
- return parsedData;
262
- }
263
- // Parsed successfully but primitive value
264
- return { data: parsedData };
265
- }
266
- catch (e) {
267
- // Not JSON or parsing failed - could be a simple string result
268
- // This might happen if backend has serialization issues
269
- return { data: loopData };
270
- }
271
315
  default:
272
- console.warn(`Unhandled output data type in Step.getOutput: ${outputDataType}`);
316
+ console.warn(`Unhandled output data type in Step.getOutput: ${step.getOutputDataCase()}`);
273
317
  return undefined;
274
318
  }
275
319
  }
276
320
  static fromResponse(step) {
277
- // Extract input data if present
321
+ // Extract input data if present - USE PROPER PROTOBUF GETTER
278
322
  let inputData = undefined;
279
- if (step.hasInput()) {
323
+ // Check for input using proper protobuf methods
324
+ if (typeof step.hasInput === "function" && step.hasInput()) {
280
325
  const inputValue = step.getInput();
281
326
  if (inputValue) {
282
- inputData = convertProtobufValueToJs(inputValue);
327
+ // If it's a protobuf Value instance, convert it
328
+ try {
329
+ inputData = convertProtobufValueToJs(inputValue);
330
+ }
331
+ catch (error) {
332
+ console.warn('Failed to convert protobuf input value:', error);
333
+ // Fallback: if conversion fails, use the raw value
334
+ inputData = inputValue;
335
+ }
336
+ }
337
+ }
338
+ else if (step.input) {
339
+ // Fallback for plain objects (from .toObject() calls)
340
+ const inputValue = step.input;
341
+ // If it's already a plain JavaScript object, use it directly
342
+ if (typeof inputValue === "object" && !inputValue.getKindCase) {
343
+ inputData = inputValue;
344
+ }
345
+ else {
346
+ // If it's a protobuf Value instance, convert it
347
+ try {
348
+ inputData = convertProtobufValueToJs(inputValue);
349
+ }
350
+ catch (error) {
351
+ // Fallback: if conversion fails, use the raw value
352
+ inputData = inputValue;
353
+ }
283
354
  }
284
355
  }
356
+ // Handle method calls safely for both protobuf instances and plain objects
357
+ const getId = () => typeof step.getId === "function" ? step.getId() : step.id;
358
+ const getType = () => typeof step.getType === "function" ? step.getType() : step.type;
359
+ const getName = () => typeof step.getName === "function" ? step.getName() : step.name;
360
+ const getSuccess = () => typeof step.getSuccess === "function"
361
+ ? step.getSuccess()
362
+ : step.success;
363
+ const getError = () => typeof step.getError === "function"
364
+ ? step.getError()
365
+ : step.error;
366
+ const getLog = () => typeof step.getLog === "function" ? step.getLog() : step.log;
367
+ const getInputsList = () => typeof step.getInputsList === "function"
368
+ ? step.getInputsList()
369
+ : step.inputsList || [];
370
+ const getStartAt = () => typeof step.getStartAt === "function"
371
+ ? step.getStartAt()
372
+ : step.startAt;
373
+ const getEndAt = () => typeof step.getEndAt === "function"
374
+ ? step.getEndAt()
375
+ : step.endAt;
285
376
  return new Step({
286
- id: step.getId(),
287
- type: convertProtobufStepTypeToSdk(step.getType()),
288
- name: step.getName(),
289
- success: step.getSuccess(),
290
- error: step.getError(),
291
- log: step.getLog(),
292
- inputsList: step.getInputsList(),
377
+ id: getId(),
378
+ type: convertProtobufStepTypeToSdk(getType()),
379
+ name: getName(),
380
+ success: getSuccess(),
381
+ error: getError(),
382
+ log: getLog(),
383
+ inputsList: getInputsList(),
293
384
  input: inputData,
294
385
  output: Step.getOutput(step),
295
- startAt: step.getStartAt(),
296
- endAt: step.getEndAt(),
386
+ startAt: getStartAt(),
387
+ endAt: getEndAt(),
297
388
  });
298
389
  }
299
390
  }
@@ -1 +1 @@
1
- {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAA0B,MAAM,aAAa,CAAC;AAErD,OAAO,EAAqC,kBAAkB,EAAE,iBAAiB,EAAgB,MAAM,oBAAoB,CAAC;AAK5H,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAsC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IA+B1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAI9D;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAAqC,kBAAkB,EAAE,iBAAiB,EAA+B,MAAM,oBAAoB,CAAC;AAM3I,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAsC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IA+B1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAI9D;AAED,eAAe,YAAY,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
2
  import Trigger from "./interface";
3
- import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
4
3
  import { TriggerType } from "@avaprotocol/types";
4
+ import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
5
5
  // Required props for constructor: id, name, type and data: { interval }
6
6
  class BlockTrigger extends Trigger {
7
7
  constructor(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAA0B,MAAM,aAAa,CAAC;AACrD,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AA6C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IA4D/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAuD1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAGlB,MAAM,oBAAoB,CAAC;AA8C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IA4D/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAuD1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fixedTime.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/fixedTime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAA0B,MAAM,aAAa,CAAC;AACrD,OAAO,EAAyC,sBAAsB,EAAE,qBAAqB,EAAgB,MAAM,oBAAoB,CAAC;AAKxI,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAoB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAuB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"fixedTime.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/fixedTime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAAyC,sBAAsB,EAAE,qBAAqB,EAA+B,MAAM,oBAAoB,CAAC;AAMvJ,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAIxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAoB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAuB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAW9D;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,14 +1,13 @@
1
1
  import * as avs_pb from "@/grpc_codegen/avs_pb";
2
- import { TriggerType, TriggerProps } from "@avaprotocol/types";
3
- export type TriggerData = avs_pb.FixedTimeTrigger.AsObject | avs_pb.CronTrigger.AsObject | avs_pb.BlockTrigger.AsObject | avs_pb.EventTrigger.AsObject | Record<string, any> | null;
4
- export type TriggerOutput = avs_pb.FixedTimeTrigger.Output.AsObject | avs_pb.CronTrigger.Output.AsObject | avs_pb.BlockTrigger.Output.AsObject | avs_pb.EventTrigger.Output.AsObject | avs_pb.ManualTrigger.Output.AsObject | null;
5
- declare class Trigger implements TriggerProps {
2
+ import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
3
+ import { TriggerType, TriggerProps, TriggerData, TriggerOutput } from "@avaprotocol/types";
4
+ export default abstract class Trigger implements TriggerProps {
6
5
  id: string;
7
6
  name: string;
8
7
  type: TriggerType;
9
8
  data: TriggerData;
10
9
  output?: TriggerOutput;
11
- input?: Record<string, any>;
10
+ input?: google_protobuf_struct_pb.Value.AsObject | Record<string, any>;
12
11
  /**
13
12
  * Create an instance of Trigger from user inputs
14
13
  * @param props
@@ -18,5 +17,4 @@ declare class Trigger implements TriggerProps {
18
17
  getOutput(): TriggerOutput | undefined;
19
18
  toJson(): TriggerProps;
20
19
  }
21
- export default Trigger;
22
20
  //# sourceMappingURL=interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,MAAM,WAAW,GACnB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,GAChC,MAAM,CAAC,WAAW,CAAC,QAAQ,GAC3B,MAAM,CAAC,YAAY,CAAC,QAAQ,GAC5B,MAAM,CAAC,YAAY,CAAC,QAAQ,GAC5B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnB,IAAI,CAAC;AAET,MAAM,MAAM,aAAa,GACrB,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,GACvC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,GAClC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,GACnC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,GACnC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,GACpC,IAAI,CAAC;AAIT,cAAM,OAAQ,YAAW,YAAY;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B;;;OAGG;gBACS,KAAK,EAAE,YAAY;IAS/B,SAAS,IAAI,MAAM,CAAC,WAAW;IAI/B,SAAS,IAAI,aAAa,GAAG,SAAS;IAItC,MAAM,IAAI,YAAY;CAUvB;AAED,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,yBAAyB,MAAM,2CAA2C,CAAC;AACvF,OAAO,EACL,WAAW,EAGX,YAAY,EACZ,WAAW,EACX,aAAa,EACd,MAAM,oBAAoB,CAAC;AAI5B,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,OAAQ,YAAW,YAAY;IAC3D,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,yBAAyB,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEvE;;;OAGG;gBACS,KAAK,EAAE,YAAY;IAS/B,SAAS,IAAI,MAAM,CAAC,WAAW;IAI/B,SAAS,IAAI,aAAa,GAAG,SAAS;IAItC,MAAM,IAAI,YAAY;CAUvB"}