@avaprotocol/sdk-js 2.3.12 → 2.3.13-dev.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/dist/index.js +846 -199
- package/dist/index.mjs +852 -203
- package/dist/models/node/branch.d.ts.map +1 -1
- package/dist/models/node/branch.js +9 -0
- package/dist/models/node/contractRead.d.ts.map +1 -1
- package/dist/models/node/contractRead.js +9 -0
- package/dist/models/node/contractWrite.d.ts.map +1 -1
- package/dist/models/node/contractWrite.js +9 -0
- package/dist/models/node/customCode.d.ts.map +1 -1
- package/dist/models/node/customCode.js +9 -1
- package/dist/models/node/ethTransfer.d.ts.map +1 -1
- package/dist/models/node/ethTransfer.js +9 -0
- package/dist/models/node/filter.d.ts.map +1 -1
- package/dist/models/node/filter.js +9 -0
- package/dist/models/node/graphqlQuery.d.ts.map +1 -1
- package/dist/models/node/graphqlQuery.js +9 -0
- package/dist/models/node/interface.d.ts +1 -0
- package/dist/models/node/interface.d.ts.map +1 -1
- package/dist/models/node/interface.js +1 -0
- package/dist/models/node/loop.d.ts.map +1 -1
- package/dist/models/node/loop.js +9 -0
- package/dist/models/node/restApi.d.ts.map +1 -1
- package/dist/models/node/restApi.js +15 -1
- package/dist/models/step.d.ts +1 -0
- package/dist/models/step.d.ts.map +1 -1
- package/dist/models/step.js +11 -0
- package/dist/models/trigger/block.d.ts.map +1 -1
- package/dist/models/trigger/block.js +13 -0
- package/dist/models/trigger/cron.d.ts.map +1 -1
- package/dist/models/trigger/cron.js +20 -0
- package/dist/models/trigger/event.d.ts.map +1 -1
- package/dist/models/trigger/event.js +8 -2
- package/dist/models/trigger/interface.d.ts +1 -0
- package/dist/models/trigger/interface.d.ts.map +1 -1
- package/dist/models/trigger/interface.js +2 -0
- package/dist/models/trigger/manual.d.ts.map +1 -1
- package/dist/models/trigger/manual.js +13 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +34 -0
- package/package.json +3 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
2
|
import Trigger from "./interface";
|
|
3
|
+
import { convertInputToProtobuf, extractInputFromProtobuf } from "../../utils";
|
|
3
4
|
import { TriggerType } from "@avaprotocol/types";
|
|
4
5
|
class ManualTrigger extends Trigger {
|
|
5
6
|
constructor(props) {
|
|
@@ -11,14 +12,26 @@ class ManualTrigger extends Trigger {
|
|
|
11
12
|
trigger.setName(this.name);
|
|
12
13
|
trigger.setType(avs_pb.TriggerType.TRIGGER_TYPE_MANUAL);
|
|
13
14
|
trigger.setManual(true);
|
|
15
|
+
// Convert input field to protobuf format and set on top-level TaskTrigger
|
|
16
|
+
// Manual triggers use the top-level input field since they don't have nested structure
|
|
17
|
+
const inputValue = convertInputToProtobuf(this.input);
|
|
18
|
+
if (inputValue) {
|
|
19
|
+
trigger.setInput(inputValue);
|
|
20
|
+
}
|
|
14
21
|
return trigger;
|
|
15
22
|
}
|
|
16
23
|
static fromResponse(raw) {
|
|
17
24
|
const obj = raw.toObject();
|
|
25
|
+
// Extract input from top-level TaskTrigger input field for manual triggers
|
|
26
|
+
let input = undefined;
|
|
27
|
+
if (raw.hasInput()) {
|
|
28
|
+
input = extractInputFromProtobuf(raw.getInput());
|
|
29
|
+
}
|
|
18
30
|
return new ManualTrigger({
|
|
19
31
|
...obj,
|
|
20
32
|
type: TriggerType.Manual,
|
|
21
33
|
data: null, // Manual triggers don't have data in the protobuf response
|
|
34
|
+
input: input,
|
|
22
35
|
});
|
|
23
36
|
}
|
|
24
37
|
getInputVariables() {
|
package/dist/utils.d.ts
CHANGED
|
@@ -57,4 +57,24 @@ export declare function convertProtobufNodeTypeToSdk(protobufType: string): stri
|
|
|
57
57
|
* @returns The SDK type string (e.g., "manualTrigger" or "customCode")
|
|
58
58
|
*/
|
|
59
59
|
export declare function convertProtobufStepTypeToSdk(protobufType: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Convert input field from JavaScript object to protobuf Value format
|
|
62
|
+
*
|
|
63
|
+
* Pure utility function for converting trigger/node input data to protobuf format.
|
|
64
|
+
* Can be used by both triggers and nodes.
|
|
65
|
+
*
|
|
66
|
+
* @param input - JavaScript object with input data, or undefined
|
|
67
|
+
* @returns protobuf Value or undefined if no input
|
|
68
|
+
*/
|
|
69
|
+
export declare function convertInputToProtobuf(input?: Record<string, any>): ProtobufValue | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Extract input field from protobuf Value format to JavaScript object
|
|
72
|
+
*
|
|
73
|
+
* Pure utility function for extracting trigger/node input data from protobuf format.
|
|
74
|
+
* Can be used by both triggers and nodes.
|
|
75
|
+
*
|
|
76
|
+
* @param inputValue - protobuf Value from response, or undefined
|
|
77
|
+
* @returns JavaScript object or undefined
|
|
78
|
+
*/
|
|
79
|
+
export declare function extractInputFromProtobuf(inputValue?: ProtobufValue): Record<string, any> | undefined;
|
|
60
80
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,aAAa,EAGvB,MAAM,2CAA2C,CAAC;AAGnD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,GAAG,CAiCnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAkDxD;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,aAAa,CA6BlE;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAkB5E;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CA0BzE;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CASzE"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,aAAa,EAGvB,MAAM,2CAA2C,CAAC;AAGnD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,GAAG,CAiCnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAkDxD;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,aAAa,CA6BlE;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAkB5E;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CA0BzE;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CASzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,aAAa,GAAG,SAAS,CAK7F;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAWpG"}
|
package/dist/utils.js
CHANGED
|
@@ -228,3 +228,37 @@ export function convertProtobufStepTypeToSdk(protobufType) {
|
|
|
228
228
|
return protobufType; // fallback to raw value
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Convert input field from JavaScript object to protobuf Value format
|
|
233
|
+
*
|
|
234
|
+
* Pure utility function for converting trigger/node input data to protobuf format.
|
|
235
|
+
* Can be used by both triggers and nodes.
|
|
236
|
+
*
|
|
237
|
+
* @param input - JavaScript object with input data, or undefined
|
|
238
|
+
* @returns protobuf Value or undefined if no input
|
|
239
|
+
*/
|
|
240
|
+
export function convertInputToProtobuf(input) {
|
|
241
|
+
if (!input) {
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
return ProtobufValue.fromJavaScript(input);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Extract input field from protobuf Value format to JavaScript object
|
|
248
|
+
*
|
|
249
|
+
* Pure utility function for extracting trigger/node input data from protobuf format.
|
|
250
|
+
* Can be used by both triggers and nodes.
|
|
251
|
+
*
|
|
252
|
+
* @param inputValue - protobuf Value from response, or undefined
|
|
253
|
+
* @returns JavaScript object or undefined
|
|
254
|
+
*/
|
|
255
|
+
export function extractInputFromProtobuf(inputValue) {
|
|
256
|
+
if (!inputValue) {
|
|
257
|
+
return undefined;
|
|
258
|
+
}
|
|
259
|
+
const inputJavaScript = inputValue.toJavaScript();
|
|
260
|
+
if (inputJavaScript && typeof inputJavaScript === 'object' && !Array.isArray(inputJavaScript)) {
|
|
261
|
+
return inputJavaScript;
|
|
262
|
+
}
|
|
263
|
+
return undefined;
|
|
264
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.13-dev.0",
|
|
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",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"build:declarations": "tsc -b tsconfig.json",
|
|
28
28
|
"build:js": "tsup src/index.ts --format cjs,esm",
|
|
29
29
|
"build": "yarn build:declarations && yarn build:js",
|
|
30
|
-
"clean": "rm -rf node_modules dist tsconfig.tsbuildinfo"
|
|
30
|
+
"clean": "rm -rf node_modules dist tsconfig.tsbuildinfo",
|
|
31
|
+
"prepare": "node ../../scripts/prepare-package.js"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@avaprotocol/types": "^2.2.9",
|