@avaprotocol/sdk-js 2.17.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +11 -1
- package/dist/index.d.ts +1 -370
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +856 -22369
- package/dist/index.mjs +820 -22402
- package/dist/v4/auth.d.ts +79 -0
- package/dist/v4/auth.d.ts.map +1 -0
- package/dist/v4/auth.js +92 -0
- package/dist/v4/builders/nodes.d.ts +106 -0
- package/dist/v4/builders/nodes.d.ts.map +1 -0
- package/dist/v4/builders/nodes.js +133 -0
- package/dist/v4/builders/triggers.d.ts +66 -0
- package/dist/v4/builders/triggers.d.ts.map +1 -0
- package/dist/v4/builders/triggers.js +74 -0
- package/dist/v4/chains.d.ts +19 -0
- package/dist/v4/chains.d.ts.map +1 -0
- package/dist/v4/chains.js +22 -0
- package/dist/v4/client.d.ts +60 -0
- package/dist/v4/client.d.ts.map +1 -0
- package/dist/v4/client.js +53 -0
- package/dist/v4/index.d.ts +19 -0
- package/dist/v4/index.d.ts.map +1 -0
- package/dist/v4/index.js +24 -0
- package/dist/v4/internal/errors.d.ts +36 -0
- package/dist/v4/internal/errors.d.ts.map +1 -0
- package/dist/v4/internal/errors.js +32 -0
- package/dist/v4/internal/transport.d.ts +64 -0
- package/dist/v4/internal/transport.d.ts.map +1 -0
- package/dist/v4/internal/transport.js +133 -0
- package/dist/v4/protocols/index.d.ts +2 -0
- package/dist/v4/protocols/index.d.ts.map +1 -0
- package/dist/v4/protocols/index.js +13 -0
- package/dist/v4/resources/auth.d.ts +45 -0
- package/dist/v4/resources/auth.d.ts.map +1 -0
- package/dist/v4/resources/auth.js +59 -0
- package/dist/v4/resources/executions.d.ts +74 -0
- package/dist/v4/resources/executions.d.ts.map +1 -0
- package/dist/v4/resources/executions.js +132 -0
- package/dist/v4/resources/health.d.ts +19 -0
- package/dist/v4/resources/health.d.ts.map +1 -0
- package/dist/v4/resources/health.js +19 -0
- package/dist/v4/resources/nodes.d.ts +29 -0
- package/dist/v4/resources/nodes.d.ts.map +1 -0
- package/dist/v4/resources/nodes.js +33 -0
- package/dist/v4/resources/operators.d.ts +23 -0
- package/dist/v4/resources/operators.d.ts.map +1 -0
- package/dist/v4/resources/operators.js +23 -0
- package/dist/v4/resources/secrets.d.ts +34 -0
- package/dist/v4/resources/secrets.d.ts.map +1 -0
- package/dist/v4/resources/secrets.js +38 -0
- package/dist/v4/resources/tokens.d.ts +28 -0
- package/dist/v4/resources/tokens.d.ts.map +1 -0
- package/dist/v4/resources/tokens.js +29 -0
- package/dist/v4/resources/triggers.d.ts +29 -0
- package/dist/v4/resources/triggers.d.ts.map +1 -0
- package/dist/v4/resources/triggers.js +33 -0
- package/dist/v4/resources/wallets.d.ts +72 -0
- package/dist/v4/resources/wallets.d.ts.map +1 -0
- package/dist/v4/resources/wallets.js +92 -0
- package/dist/v4/resources/workflows.d.ts +64 -0
- package/dist/v4/resources/workflows.d.ts.map +1 -0
- package/dist/v4/resources/workflows.js +91 -0
- package/package.json +9 -11
- package/dist/auth.d.ts +0 -2
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -10
- package/dist/config.d.ts +0 -9
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -19
- package/dist/models/edge.d.ts +0 -12
- package/dist/models/edge.d.ts.map +0 -1
- package/dist/models/edge.js +0 -19
- package/dist/models/execution.d.ts +0 -30
- package/dist/models/execution.d.ts.map +0 -1
- package/dist/models/execution.js +0 -100
- package/dist/models/node/balance.d.ts +0 -17
- package/dist/models/node/balance.d.ts.map +0 -1
- package/dist/models/node/balance.js +0 -78
- package/dist/models/node/branch.d.ts +0 -11
- package/dist/models/node/branch.d.ts.map +0 -1
- package/dist/models/node/branch.js +0 -63
- package/dist/models/node/contractRead.d.ts +0 -17
- package/dist/models/node/contractRead.d.ts.map +0 -1
- package/dist/models/node/contractRead.js +0 -91
- package/dist/models/node/contractWrite.d.ts +0 -17
- package/dist/models/node/contractWrite.d.ts.map +0 -1
- package/dist/models/node/contractWrite.js +0 -102
- package/dist/models/node/customCode.d.ts +0 -20
- package/dist/models/node/customCode.d.ts.map +0 -1
- package/dist/models/node/customCode.js +0 -74
- package/dist/models/node/ethTransfer.d.ts +0 -20
- package/dist/models/node/ethTransfer.d.ts.map +0 -1
- package/dist/models/node/ethTransfer.js +0 -58
- package/dist/models/node/factory.d.ts +0 -24
- package/dist/models/node/factory.d.ts.map +0 -1
- package/dist/models/node/factory.js +0 -108
- package/dist/models/node/filter.d.ts +0 -11
- package/dist/models/node/filter.d.ts.map +0 -1
- package/dist/models/node/filter.js +0 -57
- package/dist/models/node/graphqlQuery.d.ts +0 -21
- package/dist/models/node/graphqlQuery.d.ts.map +0 -1
- package/dist/models/node/graphqlQuery.js +0 -74
- package/dist/models/node/interface.d.ts +0 -20
- package/dist/models/node/interface.d.ts.map +0 -1
- package/dist/models/node/interface.js +0 -58
- package/dist/models/node/loop.d.ts +0 -15
- package/dist/models/node/loop.d.ts.map +0 -1
- package/dist/models/node/loop.js +0 -235
- package/dist/models/node/restApi.d.ts +0 -23
- package/dist/models/node/restApi.d.ts.map +0 -1
- package/dist/models/node/restApi.js +0 -84
- package/dist/models/secret.d.ts +0 -16
- package/dist/models/secret.d.ts.map +0 -1
- package/dist/models/secret.js +0 -28
- package/dist/models/step.d.ts +0 -33
- package/dist/models/step.d.ts.map +0 -1
- package/dist/models/step.js +0 -287
- package/dist/models/trigger/block.d.ts +0 -21
- package/dist/models/trigger/block.d.ts.map +0 -1
- package/dist/models/trigger/block.js +0 -81
- package/dist/models/trigger/cron.d.ts +0 -23
- package/dist/models/trigger/cron.d.ts.map +0 -1
- package/dist/models/trigger/cron.js +0 -77
- package/dist/models/trigger/event.d.ts +0 -22
- package/dist/models/trigger/event.d.ts.map +0 -1
- package/dist/models/trigger/event.js +0 -244
- package/dist/models/trigger/factory.d.ts +0 -27
- package/dist/models/trigger/factory.d.ts.map +0 -1
- package/dist/models/trigger/factory.js +0 -73
- package/dist/models/trigger/fixedTime.d.ts +0 -23
- package/dist/models/trigger/fixedTime.d.ts.map +0 -1
- package/dist/models/trigger/fixedTime.js +0 -69
- package/dist/models/trigger/interface.d.ts +0 -19
- package/dist/models/trigger/interface.d.ts.map +0 -1
- package/dist/models/trigger/interface.js +0 -35
- package/dist/models/trigger/manual.d.ts +0 -16
- package/dist/models/trigger/manual.d.ts.map +0 -1
- package/dist/models/trigger/manual.js +0 -117
- package/dist/models/workflow.d.ts +0 -53
- package/dist/models/workflow.d.ts.map +0 -1
- package/dist/models/workflow.js +0 -219
- package/dist/utils.d.ts +0 -82
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -286
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
|
|
3
|
-
import Trigger from "./interface";
|
|
4
|
-
import { TriggerType, } from "@avaprotocol/types";
|
|
5
|
-
import { convertProtobufValueToJs } from "../../utils";
|
|
6
|
-
// Ref: https://github.com/AvaProtocol/EigenLayer-AVS/issues/94
|
|
7
|
-
// The trigger is an array of Condition, which can be topics, dateRage, etc.
|
|
8
|
-
// We imply or operator among all conditions.
|
|
9
|
-
// ```
|
|
10
|
-
// [
|
|
11
|
-
// { type: "topics"
|
|
12
|
-
// value: ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
|
|
13
|
-
// null,
|
|
14
|
-
// "0x000000000000000000000000c60e71bd0f2e6d8832fea1a2d56091c48493c788"],
|
|
15
|
-
// },
|
|
16
|
-
// {
|
|
17
|
-
// type: "topics",
|
|
18
|
-
// value: ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
|
|
19
|
-
// "0x000000000000000000000000c60e71bd0f2e6d8832fea1a2d56091c48493c788",
|
|
20
|
-
// ]
|
|
21
|
-
// }
|
|
22
|
-
// ]
|
|
23
|
-
// ```
|
|
24
|
-
// Required props for constructor: id, name, type and data: { queries }
|
|
25
|
-
// EventTrigger now uses queries-based filtering instead of expression/matcher
|
|
26
|
-
// Each query represents an independent filter that creates its own subscription
|
|
27
|
-
// For FROM-OR-TO scenarios, provide two queries: one for FROM, one for TO.
|
|
28
|
-
//
|
|
29
|
-
// Example queries structure:
|
|
30
|
-
// ```
|
|
31
|
-
// [
|
|
32
|
-
// {
|
|
33
|
-
// addresses: ["0xA0b86a33E6441e6067ec0da4Cc2C8ae77d85e7b1"],
|
|
34
|
-
// topics: [
|
|
35
|
-
// "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", // [0] event signature
|
|
36
|
-
// null, // [1] FROM address (wildcard - any sender)
|
|
37
|
-
// "0x000000000000000000000000c60e71bd0f2e6d8832fea1a2d56091c48493c788" // [2] TO address
|
|
38
|
-
// ]
|
|
39
|
-
// }
|
|
40
|
-
// ]
|
|
41
|
-
// ```
|
|
42
|
-
class EventTrigger extends Trigger {
|
|
43
|
-
constructor(props) {
|
|
44
|
-
super({ ...props, type: TriggerType.Event, data: props.data });
|
|
45
|
-
}
|
|
46
|
-
toRequest() {
|
|
47
|
-
const request = new avs_pb.TaskTrigger();
|
|
48
|
-
request.setName(this.name);
|
|
49
|
-
request.setId(this.id);
|
|
50
|
-
request.setType(avs_pb.TriggerType.TRIGGER_TYPE_EVENT);
|
|
51
|
-
if (!this.data) {
|
|
52
|
-
throw new Error(`Trigger data is missing for ${this.type}`);
|
|
53
|
-
}
|
|
54
|
-
const trigger = new avs_pb.EventTrigger();
|
|
55
|
-
const config = new avs_pb.EventTrigger.Config();
|
|
56
|
-
const dataConfig = this.data;
|
|
57
|
-
const queries = dataConfig.queries;
|
|
58
|
-
if (!queries || queries.length === 0) {
|
|
59
|
-
throw new Error(`Queries array is required for ${this.type}`);
|
|
60
|
-
}
|
|
61
|
-
const queryMessages = queries.map((queryData) => {
|
|
62
|
-
const query = new avs_pb.EventTrigger.Query();
|
|
63
|
-
// Set addresses if provided
|
|
64
|
-
if (queryData.addresses && queryData.addresses.length > 0) {
|
|
65
|
-
query.setAddressesList(queryData.addresses);
|
|
66
|
-
}
|
|
67
|
-
// Set topics if provided - flat array format
|
|
68
|
-
if (queryData.topics && queryData.topics.length > 0) {
|
|
69
|
-
// Convert null values to empty strings for protobuf compatibility
|
|
70
|
-
// null represents "any value" wildcards in EVM log filtering
|
|
71
|
-
const processedTopics = queryData.topics.map((value) => value === null ? "" : value);
|
|
72
|
-
query.setTopicsList(processedTopics);
|
|
73
|
-
}
|
|
74
|
-
// Set maxEventsPerBlock if provided
|
|
75
|
-
if (queryData.maxEventsPerBlock !== undefined) {
|
|
76
|
-
query.setMaxEventsPerBlock(queryData.maxEventsPerBlock);
|
|
77
|
-
}
|
|
78
|
-
// Set contractAbi if provided - must be an array like ContractRead
|
|
79
|
-
if (queryData.contractAbi !== undefined) {
|
|
80
|
-
// Strictly require array format (no string support)
|
|
81
|
-
if (!Array.isArray(queryData.contractAbi)) {
|
|
82
|
-
throw new Error("contractAbi must be an array of ABI elements");
|
|
83
|
-
}
|
|
84
|
-
// Convert array to protobuf Value list
|
|
85
|
-
const abiValueList = queryData.contractAbi.map((item) => {
|
|
86
|
-
const value = new google_protobuf_struct_pb.Value();
|
|
87
|
-
value.setStructValue(google_protobuf_struct_pb.Struct.fromJavaScript(item));
|
|
88
|
-
return value;
|
|
89
|
-
});
|
|
90
|
-
query.setContractAbiList(abiValueList);
|
|
91
|
-
}
|
|
92
|
-
// Set conditions if provided
|
|
93
|
-
if (queryData.conditions && queryData.conditions.length > 0) {
|
|
94
|
-
const conditionMessages = queryData.conditions.map((conditionData) => {
|
|
95
|
-
const condition = new avs_pb.EventCondition();
|
|
96
|
-
condition.setFieldName(conditionData.fieldName);
|
|
97
|
-
condition.setOperator(conditionData.operator);
|
|
98
|
-
condition.setValue(conditionData.value);
|
|
99
|
-
condition.setFieldType(conditionData.fieldType);
|
|
100
|
-
return condition;
|
|
101
|
-
});
|
|
102
|
-
query.setConditionsList(conditionMessages);
|
|
103
|
-
}
|
|
104
|
-
// Set method calls if provided
|
|
105
|
-
if (queryData.methodCalls && queryData.methodCalls.length > 0) {
|
|
106
|
-
const methodCallMessages = queryData.methodCalls.map((methodCallData) => {
|
|
107
|
-
const methodCall = new avs_pb.EventTrigger.MethodCall();
|
|
108
|
-
methodCall.setMethodName(methodCallData.methodName);
|
|
109
|
-
methodCall.setMethodParamsList(methodCallData.methodParams);
|
|
110
|
-
// Optional: Set callData if provided
|
|
111
|
-
if (methodCallData.callData) {
|
|
112
|
-
methodCall.setCallData(methodCallData.callData);
|
|
113
|
-
}
|
|
114
|
-
// Optional: Set applyToFields if provided
|
|
115
|
-
if (methodCallData.applyToFields &&
|
|
116
|
-
methodCallData.applyToFields.length > 0) {
|
|
117
|
-
methodCall.setApplyToFieldsList(methodCallData.applyToFields);
|
|
118
|
-
}
|
|
119
|
-
return methodCall;
|
|
120
|
-
});
|
|
121
|
-
query.setMethodCallsList(methodCallMessages);
|
|
122
|
-
}
|
|
123
|
-
return query;
|
|
124
|
-
});
|
|
125
|
-
config.setQueriesList(queryMessages);
|
|
126
|
-
// Set cooldownSeconds if provided
|
|
127
|
-
if (dataConfig.cooldownSeconds !== undefined) {
|
|
128
|
-
config.setCooldownSeconds(dataConfig.cooldownSeconds);
|
|
129
|
-
}
|
|
130
|
-
trigger.setConfig(config);
|
|
131
|
-
request.setEvent(trigger);
|
|
132
|
-
return request;
|
|
133
|
-
}
|
|
134
|
-
static fromResponse(raw) {
|
|
135
|
-
// Convert the raw object to TriggerProps, which should keep name and id
|
|
136
|
-
const obj = raw.toObject();
|
|
137
|
-
let data = { queries: [] };
|
|
138
|
-
if (raw.getEvent() && raw.getEvent().hasConfig()) {
|
|
139
|
-
const config = raw.getEvent().getConfig();
|
|
140
|
-
if (config) {
|
|
141
|
-
const queries = [];
|
|
142
|
-
if (config.getQueriesList && config.getQueriesList().length > 0) {
|
|
143
|
-
config.getQueriesList().forEach((query) => {
|
|
144
|
-
const queryData = {
|
|
145
|
-
addresses: [],
|
|
146
|
-
topics: [], // Flat array of topic strings
|
|
147
|
-
contractAbi: [], // Add the required contractAbi field
|
|
148
|
-
};
|
|
149
|
-
// Extract addresses
|
|
150
|
-
if (query.getAddressesList && query.getAddressesList().length > 0) {
|
|
151
|
-
queryData.addresses = query.getAddressesList();
|
|
152
|
-
}
|
|
153
|
-
// Extract topics - now a flat array
|
|
154
|
-
if (query.getTopicsList && query.getTopicsList().length > 0) {
|
|
155
|
-
// Convert empty strings back to null for JavaScript compatibility
|
|
156
|
-
// Empty strings represent wildcards in the protobuf representation
|
|
157
|
-
queryData.topics = query
|
|
158
|
-
.getTopicsList()
|
|
159
|
-
.map((topic) => (topic === "" ? null : topic));
|
|
160
|
-
}
|
|
161
|
-
// Extract maxEventsPerBlock
|
|
162
|
-
const maxEvents = query.getMaxEventsPerBlock();
|
|
163
|
-
if (maxEvents && maxEvents > 0) {
|
|
164
|
-
queryData.maxEventsPerBlock = maxEvents;
|
|
165
|
-
}
|
|
166
|
-
// Extract contractAbi
|
|
167
|
-
const contractAbi = query.getContractAbiList();
|
|
168
|
-
if (contractAbi && contractAbi.length > 0) {
|
|
169
|
-
queryData.contractAbi = contractAbi.map((value) => convertProtobufValueToJs(value));
|
|
170
|
-
}
|
|
171
|
-
// Extract conditions
|
|
172
|
-
const conditions = [];
|
|
173
|
-
if (query.getConditionsList &&
|
|
174
|
-
query.getConditionsList().length > 0) {
|
|
175
|
-
query.getConditionsList().forEach((condition) => {
|
|
176
|
-
const conditionData = {
|
|
177
|
-
fieldName: condition.getFieldName(),
|
|
178
|
-
operator: condition.getOperator(),
|
|
179
|
-
value: condition.getValue(),
|
|
180
|
-
fieldType: condition.getFieldType(),
|
|
181
|
-
};
|
|
182
|
-
conditions.push(conditionData);
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
if (conditions.length > 0) {
|
|
186
|
-
queryData.conditions = conditions;
|
|
187
|
-
}
|
|
188
|
-
queries.push(queryData);
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
// Extract cooldownSeconds if present
|
|
192
|
-
// Use hasCooldownSeconds() to check if field was set, since getCooldownSeconds()
|
|
193
|
-
// returns 0 (default uint32 value) when field is not set
|
|
194
|
-
data = { queries: queries };
|
|
195
|
-
if (config.hasCooldownSeconds()) {
|
|
196
|
-
data.cooldownSeconds = config.getCooldownSeconds();
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return new EventTrigger({
|
|
201
|
-
...obj,
|
|
202
|
-
type: TriggerType.Event,
|
|
203
|
-
data: data,
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Convert raw data from runTrigger response to EventOutput format
|
|
208
|
-
* @param rawData - The raw data from the gRPC response
|
|
209
|
-
* @returns {EventTriggerOutput | undefined} - The converted data
|
|
210
|
-
*/
|
|
211
|
-
getOutput() {
|
|
212
|
-
return this.output;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Extract output data from RunTriggerResp for event triggers
|
|
216
|
-
* @param outputData - The RunTriggerResp containing event trigger output
|
|
217
|
-
* @returns Plain JavaScript object with event trigger data
|
|
218
|
-
*/
|
|
219
|
-
static fromOutputData(outputData) {
|
|
220
|
-
// Try to get data from protobuf structure first
|
|
221
|
-
const eventOutput = outputData.getEventTrigger();
|
|
222
|
-
if (eventOutput) {
|
|
223
|
-
const dataValue = eventOutput.getData();
|
|
224
|
-
if (dataValue) {
|
|
225
|
-
try {
|
|
226
|
-
// Convert protobuf Value to JavaScript object
|
|
227
|
-
const convertedData = convertProtobufValueToJs(dataValue);
|
|
228
|
-
// If the converted data is an empty string, return null
|
|
229
|
-
if (convertedData === "") {
|
|
230
|
-
return null;
|
|
231
|
-
}
|
|
232
|
-
return convertedData;
|
|
233
|
-
}
|
|
234
|
-
catch (error) {
|
|
235
|
-
console.warn("Failed to convert event trigger data from protobuf Value:", error);
|
|
236
|
-
// Return the raw protobuf Value object as fallback
|
|
237
|
-
return dataValue;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return null;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
export default EventTrigger;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import BlockTrigger from "./block";
|
|
3
|
-
import CronTrigger from "./cron";
|
|
4
|
-
import EventTrigger from "./event";
|
|
5
|
-
import FixedTimeTrigger from "./fixedTime";
|
|
6
|
-
import ManualTrigger from "./manual";
|
|
7
|
-
import Trigger from "./interface";
|
|
8
|
-
import { TriggerProps, BlockTriggerProps, CronTriggerProps, EventTriggerProps, FixedTimeTriggerProps, ManualTriggerProps } from "@avaprotocol/types";
|
|
9
|
-
declare class TriggerFactory {
|
|
10
|
-
/**
|
|
11
|
-
* Static factory method to create Trigger instances
|
|
12
|
-
* @param props
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
static create(props: TriggerProps): Trigger;
|
|
16
|
-
/**
|
|
17
|
-
* Create an instance of Trigger from AVS getWorkflow or getWorkflows response
|
|
18
|
-
* @param trigger
|
|
19
|
-
* @returns
|
|
20
|
-
*/
|
|
21
|
-
static fromResponse(raw: avs_pb.TaskTrigger): Trigger;
|
|
22
|
-
static fromOutputData(outputData: avs_pb.RunTriggerResp): any;
|
|
23
|
-
}
|
|
24
|
-
export default TriggerFactory;
|
|
25
|
-
export { Trigger, BlockTrigger, CronTrigger, EventTrigger, FixedTimeTrigger, ManualTrigger, };
|
|
26
|
-
export type { TriggerProps, BlockTriggerProps, CronTriggerProps, EventTriggerProps, FixedTimeTriggerProps, ManualTriggerProps, };
|
|
27
|
-
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,YAAY,MAAM,SAAS,CAAC;AACnC,OAAO,WAAW,MAAM,QAAQ,CAAC;AACjC,OAAO,YAAY,MAAM,SAAS,CAAC;AACnC,OAAO,gBAAgB,MAAM,aAAa,CAAC;AAC3C,OAAO,aAAa,MAAM,UAAU,CAAC;AACrC,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAEL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAE5B,cAAM,cAAc;IAClB;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAkB3C;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO;IAiBrD,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAkB9D;AAED,eAAe,cAAc,CAAC;AAG9B,OAAO,EACL,OAAO,EACP,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,GACd,CAAC;AAGF,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import BlockTrigger from "./block";
|
|
3
|
-
import CronTrigger from "./cron";
|
|
4
|
-
import EventTrigger from "./event";
|
|
5
|
-
import FixedTimeTrigger from "./fixedTime";
|
|
6
|
-
import ManualTrigger from "./manual";
|
|
7
|
-
import Trigger from "./interface";
|
|
8
|
-
import { TriggerType, } from "@avaprotocol/types";
|
|
9
|
-
class TriggerFactory {
|
|
10
|
-
/**
|
|
11
|
-
* Static factory method to create Trigger instances
|
|
12
|
-
* @param props
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
static create(props) {
|
|
16
|
-
switch (props.type) {
|
|
17
|
-
case TriggerType.Block:
|
|
18
|
-
return new BlockTrigger(props);
|
|
19
|
-
case TriggerType.Cron:
|
|
20
|
-
return new CronTrigger(props);
|
|
21
|
-
case TriggerType.Event:
|
|
22
|
-
return new EventTrigger(props);
|
|
23
|
-
case TriggerType.FixedTime:
|
|
24
|
-
return new FixedTimeTrigger(props);
|
|
25
|
-
case TriggerType.Manual:
|
|
26
|
-
return new ManualTrigger(props);
|
|
27
|
-
}
|
|
28
|
-
// Add more conditions for other subclasses
|
|
29
|
-
throw new Error("Unsupported trigger type");
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Create an instance of Trigger from AVS getWorkflow or getWorkflows response
|
|
33
|
-
* @param trigger
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
|
-
static fromResponse(raw) {
|
|
37
|
-
switch (true) {
|
|
38
|
-
case !!raw.getFixedTime():
|
|
39
|
-
return FixedTimeTrigger.fromResponse(raw);
|
|
40
|
-
case !!raw.getCron():
|
|
41
|
-
return CronTrigger.fromResponse(raw);
|
|
42
|
-
case !!raw.getBlock():
|
|
43
|
-
return BlockTrigger.fromResponse(raw);
|
|
44
|
-
case !!raw.getEvent():
|
|
45
|
-
return EventTrigger.fromResponse(raw);
|
|
46
|
-
case !!raw.getManual():
|
|
47
|
-
return ManualTrigger.fromResponse(raw);
|
|
48
|
-
default:
|
|
49
|
-
throw new Error("Unknown trigger type");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
static fromOutputData(outputData) {
|
|
53
|
-
// Delegate to the specific trigger type's fromOutputData method
|
|
54
|
-
switch (outputData.getOutputDataCase()) {
|
|
55
|
-
case avs_pb.RunTriggerResp.OutputDataCase.BLOCK_TRIGGER:
|
|
56
|
-
return BlockTrigger.fromOutputData(outputData);
|
|
57
|
-
case avs_pb.RunTriggerResp.OutputDataCase.FIXED_TIME_TRIGGER:
|
|
58
|
-
return FixedTimeTrigger.fromOutputData(outputData);
|
|
59
|
-
case avs_pb.RunTriggerResp.OutputDataCase.CRON_TRIGGER:
|
|
60
|
-
return CronTrigger.fromOutputData(outputData);
|
|
61
|
-
case avs_pb.RunTriggerResp.OutputDataCase.EVENT_TRIGGER:
|
|
62
|
-
return EventTrigger.fromOutputData(outputData);
|
|
63
|
-
case avs_pb.RunTriggerResp.OutputDataCase.MANUAL_TRIGGER:
|
|
64
|
-
return ManualTrigger.fromOutputData(outputData);
|
|
65
|
-
case avs_pb.RunTriggerResp.OutputDataCase.OUTPUT_DATA_NOT_SET:
|
|
66
|
-
default:
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
export default TriggerFactory;
|
|
72
|
-
// Trigger object definitions
|
|
73
|
-
export { Trigger, BlockTrigger, CronTrigger, EventTrigger, FixedTimeTrigger, ManualTrigger, };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import Trigger from "./interface";
|
|
3
|
-
import { FixedTimeTriggerProps, FixedTimeTriggerOutput } from "@avaprotocol/types";
|
|
4
|
-
declare class FixedTimeTrigger extends Trigger {
|
|
5
|
-
constructor(props: FixedTimeTriggerProps);
|
|
6
|
-
toRequest(): avs_pb.TaskTrigger;
|
|
7
|
-
static fromResponse(raw: avs_pb.TaskTrigger): FixedTimeTrigger;
|
|
8
|
-
/**
|
|
9
|
-
* Convert raw data from runNodeWithInputs response to FixedTimeOutput format
|
|
10
|
-
* @param rawData - The raw data from the gRPC response
|
|
11
|
-
* @returns {FixedTimeTriggerOutput | undefined} - The converted data
|
|
12
|
-
*/
|
|
13
|
-
getOutput(): FixedTimeTriggerOutput | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Extract output data from RunTriggerResp for fixed time triggers
|
|
16
|
-
* Updated to handle timestamp and timestamp_iso instead of epoch
|
|
17
|
-
* @param outputData - The RunTriggerResp containing fixed time trigger output
|
|
18
|
-
* @returns Plain JavaScript object with fixed time trigger data
|
|
19
|
-
*/
|
|
20
|
-
static fromOutputData(outputData: avs_pb.RunTriggerResp): any;
|
|
21
|
-
}
|
|
22
|
-
export default FixedTimeTrigger;
|
|
23
|
-
//# sourceMappingURL=fixedTime.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EAEL,qBAAqB,EAErB,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAI5B,cAAM,gBAAiB,SAAQ,OAAO;gBACxB,KAAK,EAAE,qBAAqB;IAOxC,SAAS,IAAI,MAAM,CAAC,WAAW;IAsB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,gBAAgB;IAmB9D;;;;OAIG;IACH,SAAS,IAAI,sBAAsB,GAAG,SAAS;IAI/C;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAY9D;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import Trigger from "./interface";
|
|
3
|
-
import { TriggerType } from "@avaprotocol/types";
|
|
4
|
-
// Required props for constructor: id, name, type and data: { epochsList }
|
|
5
|
-
class FixedTimeTrigger extends Trigger {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super({
|
|
8
|
-
...props,
|
|
9
|
-
type: TriggerType.FixedTime,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
toRequest() {
|
|
13
|
-
const request = new avs_pb.TaskTrigger();
|
|
14
|
-
request.setId(this.id);
|
|
15
|
-
request.setName(this.name);
|
|
16
|
-
request.setType(avs_pb.TriggerType.TRIGGER_TYPE_FIXED_TIME);
|
|
17
|
-
if (!this.data) {
|
|
18
|
-
throw new Error(`Trigger data is missing for ${this.type}`);
|
|
19
|
-
}
|
|
20
|
-
const trigger = new avs_pb.FixedTimeTrigger();
|
|
21
|
-
const config = new avs_pb.FixedTimeTrigger.Config();
|
|
22
|
-
config.setEpochsList(this.data.epochsList || []);
|
|
23
|
-
trigger.setConfig(config);
|
|
24
|
-
request.setFixedTime(trigger);
|
|
25
|
-
return request;
|
|
26
|
-
}
|
|
27
|
-
static fromResponse(raw) {
|
|
28
|
-
const obj = raw.toObject();
|
|
29
|
-
let data = { epochsList: [] };
|
|
30
|
-
if (raw.getFixedTime() && raw.getFixedTime().hasConfig()) {
|
|
31
|
-
const config = raw.getFixedTime().getConfig();
|
|
32
|
-
data = {
|
|
33
|
-
epochsList: config.getEpochsList(),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return new FixedTimeTrigger({
|
|
37
|
-
...obj,
|
|
38
|
-
type: TriggerType.FixedTime,
|
|
39
|
-
data: data,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Convert raw data from runNodeWithInputs response to FixedTimeOutput format
|
|
44
|
-
* @param rawData - The raw data from the gRPC response
|
|
45
|
-
* @returns {FixedTimeTriggerOutput | undefined} - The converted data
|
|
46
|
-
*/
|
|
47
|
-
getOutput() {
|
|
48
|
-
return this.output;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Extract output data from RunTriggerResp for fixed time triggers
|
|
52
|
-
* Updated to handle timestamp and timestamp_iso instead of epoch
|
|
53
|
-
* @param outputData - The RunTriggerResp containing fixed time trigger output
|
|
54
|
-
* @returns Plain JavaScript object with fixed time trigger data
|
|
55
|
-
*/
|
|
56
|
-
static fromOutputData(outputData) {
|
|
57
|
-
const fixedTimeOutput = outputData.getFixedTimeTrigger();
|
|
58
|
-
if (!fixedTimeOutput)
|
|
59
|
-
return null;
|
|
60
|
-
// Extract data from the new data field
|
|
61
|
-
const dataValue = fixedTimeOutput.getData();
|
|
62
|
-
if (!dataValue)
|
|
63
|
-
return null;
|
|
64
|
-
// Convert the Value to JavaScript object
|
|
65
|
-
const result = dataValue.toJavaScript();
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export default FixedTimeTrigger;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import { TriggerType, TriggerProps, TriggerData, TriggerOutput } from "@avaprotocol/types";
|
|
3
|
-
export default abstract class Trigger implements TriggerProps {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
type: TriggerType;
|
|
7
|
-
data: TriggerData;
|
|
8
|
-
output?: TriggerOutput;
|
|
9
|
-
/**
|
|
10
|
-
* Create an instance of Trigger from user inputs
|
|
11
|
-
* @param props
|
|
12
|
-
*/
|
|
13
|
-
constructor(props: TriggerProps);
|
|
14
|
-
toRequest(): avs_pb.TaskTrigger;
|
|
15
|
-
static fromResponse(raw: avs_pb.TaskTrigger): Trigger;
|
|
16
|
-
getOutput(): TriggerOutput | undefined;
|
|
17
|
-
toJson(): TriggerProps;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,aAAa,EACd,MAAM,oBAAoB,CAAC;AAG5B,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;IAGvB;;;OAGG;gBACS,KAAK,EAAE,YAAY;IAQ/B,SAAS,IAAI,MAAM,CAAC,WAAW;IAI/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO;IASrD,SAAS,IAAI,aAAa,GAAG,SAAS;IAItC,MAAM,IAAI,YAAY;CASvB"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export default class Trigger {
|
|
2
|
-
/**
|
|
3
|
-
* Create an instance of Trigger from user inputs
|
|
4
|
-
* @param props
|
|
5
|
-
*/
|
|
6
|
-
constructor(props) {
|
|
7
|
-
this.id = props.id;
|
|
8
|
-
this.name = props.name;
|
|
9
|
-
this.type = props.type;
|
|
10
|
-
this.data = props.data;
|
|
11
|
-
this.output = props.output;
|
|
12
|
-
}
|
|
13
|
-
toRequest() {
|
|
14
|
-
throw new Error("Method not implemented.");
|
|
15
|
-
}
|
|
16
|
-
static fromResponse(raw) {
|
|
17
|
-
// Convert the raw object to TriggerProps
|
|
18
|
-
const obj = raw.toObject();
|
|
19
|
-
return new this({
|
|
20
|
-
...obj,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
getOutput() {
|
|
24
|
-
return this.output;
|
|
25
|
-
}
|
|
26
|
-
toJson() {
|
|
27
|
-
return {
|
|
28
|
-
id: this.id,
|
|
29
|
-
name: this.name,
|
|
30
|
-
type: this.type,
|
|
31
|
-
data: this.data,
|
|
32
|
-
output: this.output,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import Trigger from "./interface";
|
|
3
|
-
import { ManualTriggerProps } from "@avaprotocol/types";
|
|
4
|
-
declare class ManualTrigger extends Trigger {
|
|
5
|
-
constructor(props: ManualTriggerProps);
|
|
6
|
-
toRequest(): avs_pb.TaskTrigger;
|
|
7
|
-
static fromResponse(raw: avs_pb.TaskTrigger): ManualTrigger;
|
|
8
|
-
/**
|
|
9
|
-
* Extract output data from RunTriggerResp for manual triggers
|
|
10
|
-
* @param outputData - The RunTriggerResp containing manual trigger output
|
|
11
|
-
* @returns The parsed JSON data directly (similar to CustomCode output)
|
|
12
|
-
*/
|
|
13
|
-
static fromOutputData(outputData: avs_pb.RunTriggerResp): unknown;
|
|
14
|
-
}
|
|
15
|
-
export default ManualTrigger;
|
|
16
|
-
//# sourceMappingURL=manual.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manual.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/manual.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,OAAO,MAAM,aAAa,CAAC;AAMlC,OAAO,EAEL,kBAAkB,EAKnB,MAAM,oBAAoB,CAAC;AAE5B,cAAM,aAAc,SAAQ,OAAO;gBACrB,KAAK,EAAE,kBAAkB;IAQrC,SAAS,IAAI,MAAM,CAAC,WAAW;IAiE/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,aAAa;IA6C3D;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,OAAO;CAuBlE;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import Trigger from "./interface";
|
|
3
|
-
import { convertJSValueToProtobuf, extractInputFromProtobuf, convertProtobufValueToJs, } from "../../utils";
|
|
4
|
-
import { TriggerType, Lang, LangConverter, } from "@avaprotocol/types";
|
|
5
|
-
class ManualTrigger extends Trigger {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super({
|
|
8
|
-
...props,
|
|
9
|
-
type: TriggerType.Manual,
|
|
10
|
-
data: props.data,
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
toRequest() {
|
|
14
|
-
const trigger = new avs_pb.TaskTrigger();
|
|
15
|
-
trigger.setId(this.id);
|
|
16
|
-
trigger.setName(this.name);
|
|
17
|
-
trigger.setType(avs_pb.TriggerType.TRIGGER_TYPE_MANUAL);
|
|
18
|
-
// Create ManualTrigger with proper config structure
|
|
19
|
-
const manualTrigger = new avs_pb.ManualTrigger();
|
|
20
|
-
const config = new avs_pb.ManualTrigger.Config();
|
|
21
|
-
// Handle ManualTriggerDataType structure: { data: actualData, headers?: {}, pathParams?: {} }
|
|
22
|
-
if (this.data === null || this.data === undefined) {
|
|
23
|
-
throw new Error("ManualTrigger data is required");
|
|
24
|
-
}
|
|
25
|
-
// Extract data, headers, pathParams, and lang from ManualTriggerDataType
|
|
26
|
-
let actualData = this.data;
|
|
27
|
-
let headers = {};
|
|
28
|
-
let pathParams = {};
|
|
29
|
-
let lang = Lang.JSON; // Default to JSON
|
|
30
|
-
if (typeof this.data === 'object' && this.data !== null && !Array.isArray(this.data)) {
|
|
31
|
-
const dataObj = this.data;
|
|
32
|
-
// If this.data has the ManualTriggerDataType structure
|
|
33
|
-
if ('data' in dataObj) {
|
|
34
|
-
actualData = dataObj.data;
|
|
35
|
-
headers = dataObj.headers || {};
|
|
36
|
-
pathParams = dataObj.pathParams || {};
|
|
37
|
-
lang = dataObj.lang || Lang.JSON;
|
|
38
|
-
}
|
|
39
|
-
// Otherwise, use this.data directly as the data content
|
|
40
|
-
}
|
|
41
|
-
// Convert the actual data to protobuf Value (supports primitives, arrays, objects, null, undefined)
|
|
42
|
-
const dataValue = convertJSValueToProtobuf(actualData);
|
|
43
|
-
config.setData(dataValue);
|
|
44
|
-
// Set headers and pathParams in the config for execution step debugging
|
|
45
|
-
if (Object.keys(headers).length > 0) {
|
|
46
|
-
const headersMap = config.getHeadersMap();
|
|
47
|
-
Object.entries(headers).forEach(([key, value]) => {
|
|
48
|
-
headersMap.set(key, value);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (Object.keys(pathParams).length > 0) {
|
|
52
|
-
const pathParamsMap = config.getPathparamsMap();
|
|
53
|
-
Object.entries(pathParams).forEach(([key, value]) => {
|
|
54
|
-
pathParamsMap.set(key, value);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
// Set the lang field (required by protobuf)
|
|
58
|
-
const langValue = LangConverter.toProtobuf(lang);
|
|
59
|
-
config.setLang(langValue);
|
|
60
|
-
manualTrigger.setConfig(config);
|
|
61
|
-
trigger.setManual(manualTrigger);
|
|
62
|
-
return trigger;
|
|
63
|
-
}
|
|
64
|
-
static fromResponse(raw) {
|
|
65
|
-
const obj = raw.toObject();
|
|
66
|
-
let actualData = null;
|
|
67
|
-
let lang = Lang.JSON; // Default
|
|
68
|
-
const manualTrigger = raw.getManual();
|
|
69
|
-
if (manualTrigger) {
|
|
70
|
-
const config = manualTrigger.getConfig();
|
|
71
|
-
if (config) {
|
|
72
|
-
// Extract data only - headers and pathParams are handled by base class
|
|
73
|
-
if (config.hasData()) {
|
|
74
|
-
actualData = extractInputFromProtobuf(config.getData());
|
|
75
|
-
}
|
|
76
|
-
// Extract lang field
|
|
77
|
-
lang = LangConverter.fromProtobuf(config.getLang());
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
// Create ManualTriggerDataType structure with data and lang
|
|
81
|
-
// Headers and pathParams are available in baseInput for execution step display
|
|
82
|
-
const manualTriggerData = {
|
|
83
|
-
data: actualData,
|
|
84
|
-
lang: lang,
|
|
85
|
-
};
|
|
86
|
-
return new ManualTrigger({
|
|
87
|
-
...obj,
|
|
88
|
-
type: TriggerType.Manual,
|
|
89
|
-
data: manualTriggerData,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Extract output data from RunTriggerResp for manual triggers
|
|
94
|
-
* @param outputData - The RunTriggerResp containing manual trigger output
|
|
95
|
-
* @returns The parsed JSON data directly (similar to CustomCode output)
|
|
96
|
-
*/
|
|
97
|
-
static fromOutputData(outputData) {
|
|
98
|
-
const manualOutput = outputData.getManualTrigger();
|
|
99
|
-
if (!manualOutput) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
// Extract only the data - headers and pathParams are config-only fields
|
|
103
|
-
const dataValue = manualOutput.getData();
|
|
104
|
-
if (dataValue) {
|
|
105
|
-
try {
|
|
106
|
-
// ManualTrigger data can be any valid JSON (objects, arrays, primitives)
|
|
107
|
-
return convertProtobufValueToJs(dataValue);
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
console.warn("Failed to convert manual trigger data from protobuf Value:", error);
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
export default ManualTrigger;
|