@avaprotocol/sdk-js 2.6.4-dev.0 → 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.
@@ -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,OAAO,MAAM,aAAa,CAAC;AAClC,OAAO,EAEL,iBAAiB,EAEjB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAOpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAoB/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAoB1D;;;OAGG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAY9D;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,EAEL,iBAAiB,EAEjB,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAC5B,cAAM,YAAa,SAAQ,OAAO;gBACpB,KAAK,EAAE,iBAAiB;IAOpC,SAAS,IAAI,MAAM,CAAC,WAAW;IAwC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,YAAY;IAoB1D;;;OAGG;IACH,SAAS,IAAI,kBAAkB,GAAG,SAAS;IAI3C;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,cAAc,GAAG,GAAG;CAY9D;AAED,eAAe,YAAY,CAAC"}
@@ -16,7 +16,23 @@ class BlockTrigger extends Trigger {
16
16
  const blockTrigger = new avs_pb.BlockTrigger();
17
17
  const config = new avs_pb.BlockTrigger.Config();
18
18
  const blockData = this.data;
19
- config.setInterval(blockData.interval || 0);
19
+ // Validate trigger data exists
20
+ if (!blockData) {
21
+ throw new Error("Trigger data is missing for block");
22
+ }
23
+ // Validate interval is present and not null/undefined
24
+ if (blockData.interval === null || blockData.interval === undefined) {
25
+ throw new Error("Interval is required for block trigger");
26
+ }
27
+ // Validate interval is a positive integer
28
+ if (blockData.interval <= 0) {
29
+ throw new Error("Interval must be greater than 0");
30
+ }
31
+ // Validate interval is an integer (not decimal)
32
+ if (!Number.isInteger(blockData.interval)) {
33
+ throw new Error(`BlockTrigger interval must be an integer, got: ${blockData.interval}`);
34
+ }
35
+ config.setInterval(blockData.interval);
20
36
  blockTrigger.setConfig(config);
21
37
  trigger.setBlock(blockTrigger);
22
38
  return trigger;
@@ -19,11 +19,11 @@ class CronTrigger extends Trigger {
19
19
  const cronData = this.data;
20
20
  // Validate schedules is present and not null/undefined
21
21
  if (!cronData.schedules || !Array.isArray(cronData.schedules)) {
22
- throw new Error("Schedules array is required for cron trigger");
22
+ throw new Error("Schedules are required for cron trigger");
23
23
  }
24
24
  // Validate schedules array is not empty
25
25
  if (cronData.schedules.length === 0) {
26
- throw new Error("At least one schedule is required for cron trigger");
26
+ throw new Error("Schedules are required for cron trigger");
27
27
  }
28
28
  const config = new avs_pb.CronTrigger.Config();
29
29
  config.setSchedulesList(cronData.schedules);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avaprotocol/sdk-js",
3
- "version": "2.6.4-dev.0",
3
+ "version": "2.6.4",
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.4.3",
34
+ "@avaprotocol/types": "^2.4.4",
35
35
  "@grpc/grpc-js": "^1.11.3",
36
36
  "@grpc/proto-loader": "^0.7.13",
37
37
  "dotenv": "^16.4.5",