@avaprotocol/sdk-js 2.4.3 → 2.5.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 +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +791 -255
- package/dist/index.mjs +799 -258
- package/dist/models/node/contractRead.d.ts +14 -0
- package/dist/models/node/contractRead.d.ts.map +1 -1
- package/dist/models/node/contractRead.js +27 -18
- package/dist/models/node/contractWrite.d.ts +14 -0
- package/dist/models/node/contractWrite.d.ts.map +1 -1
- package/dist/models/node/contractWrite.js +25 -16
- package/dist/models/node/customCode.d.ts +10 -1
- package/dist/models/node/customCode.d.ts.map +1 -1
- package/dist/models/node/customCode.js +19 -9
- package/dist/models/node/ethTransfer.d.ts +9 -0
- package/dist/models/node/ethTransfer.d.ts.map +1 -1
- package/dist/models/node/ethTransfer.js +14 -5
- package/dist/models/node/filter.d.ts.map +1 -1
- package/dist/models/node/filter.js +22 -3
- package/dist/models/node/graphqlQuery.d.ts +10 -0
- package/dist/models/node/graphqlQuery.d.ts.map +1 -1
- package/dist/models/node/graphqlQuery.js +20 -12
- package/dist/models/node/loop.d.ts +5 -1
- package/dist/models/node/loop.d.ts.map +1 -1
- package/dist/models/node/loop.js +151 -99
- package/dist/models/node/restApi.d.ts +11 -0
- package/dist/models/node/restApi.d.ts.map +1 -1
- package/dist/models/node/restApi.js +21 -13
- package/dist/models/step.d.ts.map +1 -1
- package/dist/models/step.js +239 -21
- package/dist/models/trigger/manual.d.ts +6 -10
- package/dist/models/trigger/manual.d.ts.map +1 -1
- package/dist/models/trigger/manual.js +108 -25
- package/dist/models/workflow.d.ts.map +1 -1
- package/dist/models/workflow.js +0 -2
- package/dist/utils.d.ts +0 -14
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -62
- package/package.json +2 -2
package/dist/utils.js
CHANGED
|
@@ -46,68 +46,6 @@ export function convertProtobufValueToJs(value) {
|
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Convert a protobuf Value to a JavaScript value
|
|
51
|
-
*
|
|
52
|
-
* **⚠️ DEPRECATED - Use convertProtobufValueToJs() for new code**
|
|
53
|
-
*
|
|
54
|
-
* This is a legacy compatibility version for existing code that may use
|
|
55
|
-
* dynamically typed protobuf objects. It uses older has*() methods and
|
|
56
|
-
* fallback logic. Only use this if you need backward compatibility.
|
|
57
|
-
*
|
|
58
|
-
* @deprecated Use convertProtobufValueToJs() instead for better type safety
|
|
59
|
-
* @param value - The protobuf Value object (may be dynamically typed)
|
|
60
|
-
* @returns The converted JavaScript value
|
|
61
|
-
*/
|
|
62
|
-
export function convertProtobufValueToJS(value) {
|
|
63
|
-
if (!value)
|
|
64
|
-
return null;
|
|
65
|
-
// Handle different value types based on protobuf Value structure
|
|
66
|
-
if (value.hasNullValue && value.hasNullValue()) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
if (value.hasNumberValue && value.hasNumberValue()) {
|
|
70
|
-
return value.getNumberValue();
|
|
71
|
-
}
|
|
72
|
-
if (value.hasStringValue && value.hasStringValue()) {
|
|
73
|
-
return value.getStringValue();
|
|
74
|
-
}
|
|
75
|
-
if (value.hasBoolValue && value.hasBoolValue()) {
|
|
76
|
-
return value.getBoolValue();
|
|
77
|
-
}
|
|
78
|
-
if (value.hasStructValue && value.hasStructValue()) {
|
|
79
|
-
const struct = value.getStructValue();
|
|
80
|
-
const result = {};
|
|
81
|
-
if (struct && struct.getFieldsMap) {
|
|
82
|
-
const fieldsMap = struct.getFieldsMap();
|
|
83
|
-
fieldsMap.forEach((fieldValue, key) => {
|
|
84
|
-
result[key] = convertProtobufValueToJS(fieldValue);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
if (value.hasListValue && value.hasListValue()) {
|
|
90
|
-
const list = value.getListValue();
|
|
91
|
-
if (list && list.getValuesList) {
|
|
92
|
-
return list
|
|
93
|
-
.getValuesList()
|
|
94
|
-
.map((item) => convertProtobufValueToJS(item));
|
|
95
|
-
}
|
|
96
|
-
return [];
|
|
97
|
-
}
|
|
98
|
-
// Fallback: try to extract primitive values directly
|
|
99
|
-
if (typeof value.getNumberValue === "function") {
|
|
100
|
-
return value.getNumberValue();
|
|
101
|
-
}
|
|
102
|
-
if (typeof value.getStringValue === "function") {
|
|
103
|
-
return value.getStringValue();
|
|
104
|
-
}
|
|
105
|
-
if (typeof value.getBoolValue === "function") {
|
|
106
|
-
return value.getBoolValue();
|
|
107
|
-
}
|
|
108
|
-
// If all else fails, return the raw value
|
|
109
|
-
return value;
|
|
110
|
-
}
|
|
111
49
|
/**
|
|
112
50
|
* Convert a JavaScript value to a protobuf Value
|
|
113
51
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.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",
|
|
@@ -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.3.0",
|
|
35
35
|
"@grpc/grpc-js": "^1.11.3",
|
|
36
36
|
"@grpc/proto-loader": "^0.7.13",
|
|
37
37
|
"dotenv": "^16.4.5",
|