@avaprotocol/sdk-js 2.10.4 → 2.11.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.
- package/CHANGELOG.md +19 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +258 -104
- package/dist/index.mjs +258 -104
- package/dist/models/trigger/event.d.ts.map +1 -1
- package/dist/models/trigger/event.js +13 -1
- package/dist/models/workflow.d.ts.map +1 -1
- package/dist/models/workflow.js +15 -8
- package/package.json +2 -2
|
@@ -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;AAEhD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAIlB,MAAM,oBAAoB,CAAC;AA0C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/event.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,OAAO,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAGL,kBAAkB,EAClB,iBAAiB,EAIlB,MAAM,oBAAoB,CAAC;AA0C5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAIpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAqH/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IA0F1D;;;;OAIG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CA0B9D;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -123,6 +123,10 @@ class EventTrigger extends Trigger {
|
|
|
123
123
|
return query;
|
|
124
124
|
});
|
|
125
125
|
config.setQueriesList(queryMessages);
|
|
126
|
+
// Set cooldownSeconds if provided
|
|
127
|
+
if (dataConfig.cooldownSeconds !== undefined) {
|
|
128
|
+
config.setCooldownSeconds(dataConfig.cooldownSeconds);
|
|
129
|
+
}
|
|
126
130
|
trigger.setConfig(config);
|
|
127
131
|
request.setEvent(trigger);
|
|
128
132
|
return request;
|
|
@@ -150,7 +154,9 @@ class EventTrigger extends Trigger {
|
|
|
150
154
|
if (query.getTopicsList && query.getTopicsList().length > 0) {
|
|
151
155
|
// Convert empty strings back to null for JavaScript compatibility
|
|
152
156
|
// Empty strings represent wildcards in the protobuf representation
|
|
153
|
-
queryData.topics = query
|
|
157
|
+
queryData.topics = query
|
|
158
|
+
.getTopicsList()
|
|
159
|
+
.map((topic) => (topic === "" ? null : topic));
|
|
154
160
|
}
|
|
155
161
|
// Extract maxEventsPerBlock
|
|
156
162
|
const maxEvents = query.getMaxEventsPerBlock();
|
|
@@ -182,7 +188,13 @@ class EventTrigger extends Trigger {
|
|
|
182
188
|
queries.push(queryData);
|
|
183
189
|
});
|
|
184
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
|
|
185
194
|
data = { queries: queries };
|
|
195
|
+
if (config.hasCooldownSeconds()) {
|
|
196
|
+
data.cooldownSeconds = config.getCooldownSeconds();
|
|
197
|
+
}
|
|
186
198
|
}
|
|
187
199
|
}
|
|
188
200
|
return new EventTrigger({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/models/workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAA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AM,CAAC;IACxB,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;;OAGG;gBACS,KAAK,EAAE,aAAa;IAwBhC;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ;IA4C/C;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ;IAmCnD,SAAS,IAAI,MAAM,CAAC,aAAa;IA8DjC;;;OAGG;IACH,MAAM,IAAI,aAAa;CAmBxB;AAED,eAAe,QAAQ,CAAC"}
|
package/dist/models/workflow.js
CHANGED
|
@@ -8,14 +8,21 @@ import { WorkflowStatus } from "@avaprotocol/types";
|
|
|
8
8
|
import { convertJSValueToProtobuf } from "../utils";
|
|
9
9
|
// Function to convert TaskStatus to string
|
|
10
10
|
export function convertStatusToString(status) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
switch (status) {
|
|
12
|
+
case avs_pb.TaskStatus.ENABLED:
|
|
13
|
+
return WorkflowStatus.Enabled;
|
|
14
|
+
case avs_pb.TaskStatus.COMPLETED:
|
|
15
|
+
return WorkflowStatus.Completed;
|
|
16
|
+
case avs_pb.TaskStatus.FAILED:
|
|
17
|
+
return WorkflowStatus.Failed;
|
|
18
|
+
case avs_pb.TaskStatus.RUNNING:
|
|
19
|
+
return WorkflowStatus.Running;
|
|
20
|
+
case avs_pb.TaskStatus.DISABLED:
|
|
21
|
+
return WorkflowStatus.Disabled;
|
|
22
|
+
default: {
|
|
23
|
+
throw new Error(`Unknown TaskStatus: ${status}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
27
|
class Workflow {
|
|
21
28
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"description": "A JavaScript/TypeScript SDK designed to simplify integration with Ava Protocol's AVS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"prepare": "node ../../scripts/prepare-package.js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@avaprotocol/types": "2.
|
|
34
|
+
"@avaprotocol/types": "2.9.1",
|
|
35
35
|
"@grpc/grpc-js": "^1.11.3",
|
|
36
36
|
"@grpc/proto-loader": "^0.7.13",
|
|
37
37
|
"dotenv": "^16.4.5",
|