@avaprotocol/sdk-js 2.5.0 → 2.5.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 +8 -0
- package/dist/index.js +100 -80
- package/dist/index.mjs +100 -80
- package/dist/models/node/loop.js +3 -3
- package/dist/models/node/restApi.d.ts +2 -2
- package/dist/models/node/restApi.d.ts.map +1 -1
- package/dist/models/node/restApi.js +15 -3
- package/dist/models/step.d.ts.map +1 -1
- package/dist/models/step.js +80 -66
- package/dist/models/trigger/manual.d.ts +2 -2
- package/dist/models/trigger/manual.d.ts.map +1 -1
- package/dist/models/trigger/manual.js +26 -26
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -17458,8 +17458,8 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17458
17458
|
data: props.data,
|
|
17459
17459
|
input: props.input
|
|
17460
17460
|
});
|
|
17461
|
-
this.
|
|
17462
|
-
this.
|
|
17461
|
+
this.headers = props.headers;
|
|
17462
|
+
this.pathParams = props.pathParams;
|
|
17463
17463
|
}
|
|
17464
17464
|
toRequest() {
|
|
17465
17465
|
const trigger = new avs_pb6.TaskTrigger();
|
|
@@ -17475,15 +17475,15 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17475
17475
|
config.setData(inputValue);
|
|
17476
17476
|
}
|
|
17477
17477
|
}
|
|
17478
|
-
if (this.
|
|
17478
|
+
if (this.headers && Object.keys(this.headers).length > 0) {
|
|
17479
17479
|
const headersMap = config.getHeadersMap();
|
|
17480
|
-
this.
|
|
17480
|
+
Object.entries(this.headers).forEach(([key, value]) => {
|
|
17481
17481
|
headersMap.set(key, value);
|
|
17482
17482
|
});
|
|
17483
17483
|
}
|
|
17484
|
-
if (this.
|
|
17484
|
+
if (this.pathParams && Object.keys(this.pathParams).length > 0) {
|
|
17485
17485
|
const pathParamsMap = config.getPathparamsMap();
|
|
17486
|
-
this.
|
|
17486
|
+
Object.entries(this.pathParams).forEach(([key, value]) => {
|
|
17487
17487
|
pathParamsMap.set(key, value);
|
|
17488
17488
|
});
|
|
17489
17489
|
}
|
|
@@ -17495,8 +17495,8 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17495
17495
|
const obj = raw.toObject();
|
|
17496
17496
|
let data = null;
|
|
17497
17497
|
const input = void 0;
|
|
17498
|
-
let
|
|
17499
|
-
let
|
|
17498
|
+
let headers = void 0;
|
|
17499
|
+
let pathParams = void 0;
|
|
17500
17500
|
const manualTrigger = raw.getManual();
|
|
17501
17501
|
if (manualTrigger) {
|
|
17502
17502
|
const config = manualTrigger.getConfig();
|
|
@@ -17506,16 +17506,16 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17506
17506
|
}
|
|
17507
17507
|
const headersMapProto = config.getHeadersMap();
|
|
17508
17508
|
if (headersMapProto && headersMapProto.getLength() > 0) {
|
|
17509
|
-
|
|
17509
|
+
headers = {};
|
|
17510
17510
|
headersMapProto.forEach((value, key) => {
|
|
17511
|
-
|
|
17511
|
+
headers[key] = value;
|
|
17512
17512
|
});
|
|
17513
17513
|
}
|
|
17514
17514
|
const pathParamsMapProto = config.getPathparamsMap();
|
|
17515
17515
|
if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
|
|
17516
|
-
|
|
17516
|
+
pathParams = {};
|
|
17517
17517
|
pathParamsMapProto.forEach((value, key) => {
|
|
17518
|
-
|
|
17518
|
+
pathParams[key] = value;
|
|
17519
17519
|
});
|
|
17520
17520
|
}
|
|
17521
17521
|
}
|
|
@@ -17525,8 +17525,8 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17525
17525
|
type: import_types6.TriggerType.Manual,
|
|
17526
17526
|
data,
|
|
17527
17527
|
input,
|
|
17528
|
-
|
|
17529
|
-
|
|
17528
|
+
headers,
|
|
17529
|
+
pathParams
|
|
17530
17530
|
});
|
|
17531
17531
|
}
|
|
17532
17532
|
getInputVariables() {
|
|
@@ -17559,19 +17559,19 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17559
17559
|
}
|
|
17560
17560
|
const headersMapProto = manualOutput.getHeadersMap();
|
|
17561
17561
|
if (headersMapProto && headersMapProto.getLength() > 0) {
|
|
17562
|
-
const
|
|
17562
|
+
const headersObject = {};
|
|
17563
17563
|
headersMapProto.forEach((value, key) => {
|
|
17564
|
-
|
|
17564
|
+
headersObject[key] = value;
|
|
17565
17565
|
});
|
|
17566
|
-
result.headers =
|
|
17566
|
+
result.headers = headersObject;
|
|
17567
17567
|
}
|
|
17568
17568
|
const pathParamsMapProto = manualOutput.getPathparamsMap();
|
|
17569
17569
|
if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
|
|
17570
|
-
const
|
|
17570
|
+
const pathParamsObject = {};
|
|
17571
17571
|
pathParamsMapProto.forEach((value, key) => {
|
|
17572
|
-
|
|
17572
|
+
pathParamsObject[key] = value;
|
|
17573
17573
|
});
|
|
17574
|
-
result.pathParams =
|
|
17574
|
+
result.pathParams = pathParamsObject;
|
|
17575
17575
|
}
|
|
17576
17576
|
return result;
|
|
17577
17577
|
}
|
|
@@ -17904,9 +17904,9 @@ var RestAPINode2 = class _RestAPINode extends Node {
|
|
|
17904
17904
|
config.setUrl(configData.url);
|
|
17905
17905
|
config.setMethod(configData.method);
|
|
17906
17906
|
config.setBody(configData.body || "");
|
|
17907
|
-
if (configData.
|
|
17907
|
+
if (configData.headers && Object.keys(configData.headers).length > 0) {
|
|
17908
17908
|
const headersMap = config.getHeadersMap();
|
|
17909
|
-
configData.
|
|
17909
|
+
Object.entries(configData.headers).forEach(([key, value]) => {
|
|
17910
17910
|
headersMap.set(key, value);
|
|
17911
17911
|
});
|
|
17912
17912
|
}
|
|
@@ -17922,7 +17922,19 @@ var RestAPINode2 = class _RestAPINode extends Node {
|
|
|
17922
17922
|
return new _RestAPINode({
|
|
17923
17923
|
...obj,
|
|
17924
17924
|
type: import_types12.NodeType.RestAPI,
|
|
17925
|
-
data:
|
|
17925
|
+
data: {
|
|
17926
|
+
url: raw.getRestApi().getConfig().getUrl(),
|
|
17927
|
+
method: raw.getRestApi().getConfig().getMethod(),
|
|
17928
|
+
body: raw.getRestApi().getConfig().getBody(),
|
|
17929
|
+
headers: (() => {
|
|
17930
|
+
const headersMap = raw.getRestApi().getConfig().getHeadersMap();
|
|
17931
|
+
const headers = {};
|
|
17932
|
+
headersMap.forEach((value, key) => {
|
|
17933
|
+
headers[key] = value;
|
|
17934
|
+
});
|
|
17935
|
+
return headers;
|
|
17936
|
+
})()
|
|
17937
|
+
},
|
|
17926
17938
|
input
|
|
17927
17939
|
// Include input data from top-level TaskNode
|
|
17928
17940
|
});
|
|
@@ -18280,9 +18292,9 @@ var LoopNode2 = class _LoopNode extends Node {
|
|
|
18280
18292
|
}
|
|
18281
18293
|
if (typeof executionMode === "string") {
|
|
18282
18294
|
switch (executionMode.toLowerCase()) {
|
|
18283
|
-
case
|
|
18295
|
+
case import_types17.ExecutionMode.Parallel:
|
|
18284
18296
|
return 1;
|
|
18285
|
-
case
|
|
18297
|
+
case import_types17.ExecutionMode.Sequential:
|
|
18286
18298
|
default:
|
|
18287
18299
|
return 0;
|
|
18288
18300
|
}
|
|
@@ -18384,7 +18396,7 @@ var LoopNode2 = class _LoopNode extends Node {
|
|
|
18384
18396
|
url: apiConfig.url,
|
|
18385
18397
|
method: apiConfig.method,
|
|
18386
18398
|
body: apiConfig.body || "",
|
|
18387
|
-
|
|
18399
|
+
headers: apiConfig.headers
|
|
18388
18400
|
});
|
|
18389
18401
|
loopNode.setRestApi(restApi);
|
|
18390
18402
|
}
|
|
@@ -18804,43 +18816,43 @@ var Step = class _Step {
|
|
|
18804
18816
|
if (userData.headers) {
|
|
18805
18817
|
if (Array.isArray(userData.headers)) {
|
|
18806
18818
|
if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
|
|
18807
|
-
|
|
18819
|
+
const headersObject = {};
|
|
18820
|
+
for (const [key, value] of userData.headers) {
|
|
18821
|
+
headersObject[key] = value;
|
|
18822
|
+
}
|
|
18823
|
+
result.headers = headersObject;
|
|
18808
18824
|
} else {
|
|
18809
|
-
const
|
|
18825
|
+
const headersObject = {};
|
|
18810
18826
|
for (const header of userData.headers) {
|
|
18811
18827
|
for (const [key, value] of Object.entries(header)) {
|
|
18812
|
-
|
|
18828
|
+
headersObject[key] = value;
|
|
18813
18829
|
}
|
|
18814
18830
|
}
|
|
18815
|
-
result.headers =
|
|
18831
|
+
result.headers = headersObject;
|
|
18816
18832
|
}
|
|
18817
18833
|
} else {
|
|
18818
|
-
|
|
18819
|
-
for (const [key, value] of Object.entries(userData.headers)) {
|
|
18820
|
-
headersArray.push([key, value]);
|
|
18821
|
-
}
|
|
18822
|
-
result.headers = headersArray;
|
|
18834
|
+
result.headers = userData.headers;
|
|
18823
18835
|
}
|
|
18824
18836
|
}
|
|
18825
18837
|
if (userData.pathParams) {
|
|
18826
18838
|
if (Array.isArray(userData.pathParams)) {
|
|
18827
18839
|
if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
|
|
18828
|
-
|
|
18840
|
+
const pathParamsObject = {};
|
|
18841
|
+
for (const [key, value] of userData.pathParams) {
|
|
18842
|
+
pathParamsObject[key] = value;
|
|
18843
|
+
}
|
|
18844
|
+
result.pathParams = pathParamsObject;
|
|
18829
18845
|
} else {
|
|
18830
|
-
const
|
|
18846
|
+
const pathParamsObject = {};
|
|
18831
18847
|
for (const pathParam of userData.pathParams) {
|
|
18832
18848
|
for (const [key, value] of Object.entries(pathParam)) {
|
|
18833
|
-
|
|
18849
|
+
pathParamsObject[key] = value;
|
|
18834
18850
|
}
|
|
18835
18851
|
}
|
|
18836
|
-
result.pathParams =
|
|
18852
|
+
result.pathParams = pathParamsObject;
|
|
18837
18853
|
}
|
|
18838
18854
|
} else {
|
|
18839
|
-
|
|
18840
|
-
for (const [key, value] of Object.entries(userData.pathParams)) {
|
|
18841
|
-
pathParamsArray.push([key, value]);
|
|
18842
|
-
}
|
|
18843
|
-
result.pathParams = pathParamsArray;
|
|
18855
|
+
result.pathParams = userData.pathParams;
|
|
18844
18856
|
}
|
|
18845
18857
|
}
|
|
18846
18858
|
} else {
|
|
@@ -18860,43 +18872,43 @@ var Step = class _Step {
|
|
|
18860
18872
|
if (userData.headers) {
|
|
18861
18873
|
if (Array.isArray(userData.headers)) {
|
|
18862
18874
|
if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
|
|
18863
|
-
|
|
18875
|
+
const headersObject = {};
|
|
18876
|
+
for (const [key, value] of userData.headers) {
|
|
18877
|
+
headersObject[key] = value;
|
|
18878
|
+
}
|
|
18879
|
+
result.headers = headersObject;
|
|
18864
18880
|
} else {
|
|
18865
|
-
const
|
|
18881
|
+
const headersObject = {};
|
|
18866
18882
|
for (const header of userData.headers) {
|
|
18867
18883
|
for (const [key, value] of Object.entries(header)) {
|
|
18868
|
-
|
|
18884
|
+
headersObject[key] = value;
|
|
18869
18885
|
}
|
|
18870
18886
|
}
|
|
18871
|
-
result.headers =
|
|
18887
|
+
result.headers = headersObject;
|
|
18872
18888
|
}
|
|
18873
18889
|
} else {
|
|
18874
|
-
|
|
18875
|
-
for (const [key, value] of Object.entries(userData.headers)) {
|
|
18876
|
-
headersArray.push([key, value]);
|
|
18877
|
-
}
|
|
18878
|
-
result.headers = headersArray;
|
|
18890
|
+
result.headers = userData.headers;
|
|
18879
18891
|
}
|
|
18880
18892
|
}
|
|
18881
18893
|
if (userData.pathParams) {
|
|
18882
18894
|
if (Array.isArray(userData.pathParams)) {
|
|
18883
18895
|
if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
|
|
18884
|
-
|
|
18896
|
+
const pathParamsObject = {};
|
|
18897
|
+
for (const [key, value] of userData.pathParams) {
|
|
18898
|
+
pathParamsObject[key] = value;
|
|
18899
|
+
}
|
|
18900
|
+
result.pathParams = pathParamsObject;
|
|
18885
18901
|
} else {
|
|
18886
|
-
const
|
|
18902
|
+
const pathParamsObject = {};
|
|
18887
18903
|
for (const pathParam of userData.pathParams) {
|
|
18888
18904
|
for (const [key, value] of Object.entries(pathParam)) {
|
|
18889
|
-
|
|
18905
|
+
pathParamsObject[key] = value;
|
|
18890
18906
|
}
|
|
18891
18907
|
}
|
|
18892
|
-
result.pathParams =
|
|
18908
|
+
result.pathParams = pathParamsObject;
|
|
18893
18909
|
}
|
|
18894
18910
|
} else {
|
|
18895
|
-
|
|
18896
|
-
for (const [key, value] of Object.entries(userData.pathParams)) {
|
|
18897
|
-
pathParamsArray.push([key, value]);
|
|
18898
|
-
}
|
|
18899
|
-
result.pathParams = pathParamsArray;
|
|
18911
|
+
result.pathParams = userData.pathParams;
|
|
18900
18912
|
}
|
|
18901
18913
|
}
|
|
18902
18914
|
} else {
|
|
@@ -18906,34 +18918,42 @@ var Step = class _Step {
|
|
|
18906
18918
|
if (typeof manualTrigger.getHeadersMap === "function") {
|
|
18907
18919
|
const headersMap = manualTrigger.getHeadersMap();
|
|
18908
18920
|
if (headersMap && headersMap.getLength() > 0) {
|
|
18909
|
-
const
|
|
18921
|
+
const headersObject = {};
|
|
18910
18922
|
headersMap.forEach((value, key) => {
|
|
18911
|
-
|
|
18923
|
+
headersObject[key] = value;
|
|
18912
18924
|
});
|
|
18913
|
-
result.headers =
|
|
18925
|
+
result.headers = headersObject;
|
|
18914
18926
|
}
|
|
18915
18927
|
} else if (manualTrigger.headers) {
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18928
|
+
if (Array.isArray(manualTrigger.headers)) {
|
|
18929
|
+
const headersObject = {};
|
|
18930
|
+
for (const [key, value] of Object.entries(manualTrigger.headers)) {
|
|
18931
|
+
headersObject[key] = value;
|
|
18932
|
+
}
|
|
18933
|
+
result.headers = headersObject;
|
|
18934
|
+
} else {
|
|
18935
|
+
result.headers = manualTrigger.headers;
|
|
18919
18936
|
}
|
|
18920
|
-
result.headers = headersArray;
|
|
18921
18937
|
}
|
|
18922
18938
|
if (typeof manualTrigger.getPathparamsMap === "function") {
|
|
18923
18939
|
const pathParamsMap = manualTrigger.getPathparamsMap();
|
|
18924
18940
|
if (pathParamsMap && pathParamsMap.getLength() > 0) {
|
|
18925
|
-
const
|
|
18941
|
+
const pathParamsObject = {};
|
|
18926
18942
|
pathParamsMap.forEach((value, key) => {
|
|
18927
|
-
|
|
18943
|
+
pathParamsObject[key] = value;
|
|
18928
18944
|
});
|
|
18929
|
-
result.pathParams =
|
|
18945
|
+
result.pathParams = pathParamsObject;
|
|
18930
18946
|
}
|
|
18931
18947
|
} else if (manualTrigger.pathparams) {
|
|
18932
|
-
|
|
18933
|
-
|
|
18934
|
-
|
|
18948
|
+
if (Array.isArray(manualTrigger.pathparams)) {
|
|
18949
|
+
const pathParamsObject = {};
|
|
18950
|
+
for (const [key, value] of Object.entries(manualTrigger.pathparams)) {
|
|
18951
|
+
pathParamsObject[key] = value;
|
|
18952
|
+
}
|
|
18953
|
+
result.pathParams = pathParamsObject;
|
|
18954
|
+
} else {
|
|
18955
|
+
result.pathParams = manualTrigger.pathparams;
|
|
18935
18956
|
}
|
|
18936
|
-
result.pathParams = pathParamsArray;
|
|
18937
18957
|
}
|
|
18938
18958
|
if (Object.keys(result).length === 0) {
|
|
18939
18959
|
const objData = manualTrigger.toObject?.() || manualTrigger;
|
|
@@ -19810,15 +19830,15 @@ var Client = class extends BaseClient {
|
|
|
19810
19830
|
const protobufValue = convertJSValueToProtobuf(manualData.data);
|
|
19811
19831
|
manualOutput.setData(protobufValue);
|
|
19812
19832
|
}
|
|
19813
|
-
if (manualData.
|
|
19833
|
+
if (manualData.headers) {
|
|
19814
19834
|
const headersMap = manualOutput.getHeadersMap();
|
|
19815
|
-
manualData.
|
|
19835
|
+
Object.entries(manualData.headers).forEach(([key, value]) => {
|
|
19816
19836
|
headersMap.set(key, value);
|
|
19817
19837
|
});
|
|
19818
19838
|
}
|
|
19819
|
-
if (manualData.
|
|
19839
|
+
if (manualData.pathParams) {
|
|
19820
19840
|
const pathParamsMap = manualOutput.getPathparamsMap();
|
|
19821
|
-
manualData.
|
|
19841
|
+
Object.entries(manualData.pathParams).forEach(([key, value]) => {
|
|
19822
19842
|
pathParamsMap.set(key, value);
|
|
19823
19843
|
});
|
|
19824
19844
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -17436,8 +17436,8 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17436
17436
|
data: props.data,
|
|
17437
17437
|
input: props.input
|
|
17438
17438
|
});
|
|
17439
|
-
this.
|
|
17440
|
-
this.
|
|
17439
|
+
this.headers = props.headers;
|
|
17440
|
+
this.pathParams = props.pathParams;
|
|
17441
17441
|
}
|
|
17442
17442
|
toRequest() {
|
|
17443
17443
|
const trigger = new avs_pb6.TaskTrigger();
|
|
@@ -17453,15 +17453,15 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17453
17453
|
config.setData(inputValue);
|
|
17454
17454
|
}
|
|
17455
17455
|
}
|
|
17456
|
-
if (this.
|
|
17456
|
+
if (this.headers && Object.keys(this.headers).length > 0) {
|
|
17457
17457
|
const headersMap = config.getHeadersMap();
|
|
17458
|
-
this.
|
|
17458
|
+
Object.entries(this.headers).forEach(([key, value]) => {
|
|
17459
17459
|
headersMap.set(key, value);
|
|
17460
17460
|
});
|
|
17461
17461
|
}
|
|
17462
|
-
if (this.
|
|
17462
|
+
if (this.pathParams && Object.keys(this.pathParams).length > 0) {
|
|
17463
17463
|
const pathParamsMap = config.getPathparamsMap();
|
|
17464
|
-
this.
|
|
17464
|
+
Object.entries(this.pathParams).forEach(([key, value]) => {
|
|
17465
17465
|
pathParamsMap.set(key, value);
|
|
17466
17466
|
});
|
|
17467
17467
|
}
|
|
@@ -17473,8 +17473,8 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17473
17473
|
const obj = raw.toObject();
|
|
17474
17474
|
let data = null;
|
|
17475
17475
|
const input = void 0;
|
|
17476
|
-
let
|
|
17477
|
-
let
|
|
17476
|
+
let headers = void 0;
|
|
17477
|
+
let pathParams = void 0;
|
|
17478
17478
|
const manualTrigger = raw.getManual();
|
|
17479
17479
|
if (manualTrigger) {
|
|
17480
17480
|
const config = manualTrigger.getConfig();
|
|
@@ -17484,16 +17484,16 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17484
17484
|
}
|
|
17485
17485
|
const headersMapProto = config.getHeadersMap();
|
|
17486
17486
|
if (headersMapProto && headersMapProto.getLength() > 0) {
|
|
17487
|
-
|
|
17487
|
+
headers = {};
|
|
17488
17488
|
headersMapProto.forEach((value, key) => {
|
|
17489
|
-
|
|
17489
|
+
headers[key] = value;
|
|
17490
17490
|
});
|
|
17491
17491
|
}
|
|
17492
17492
|
const pathParamsMapProto = config.getPathparamsMap();
|
|
17493
17493
|
if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
|
|
17494
|
-
|
|
17494
|
+
pathParams = {};
|
|
17495
17495
|
pathParamsMapProto.forEach((value, key) => {
|
|
17496
|
-
|
|
17496
|
+
pathParams[key] = value;
|
|
17497
17497
|
});
|
|
17498
17498
|
}
|
|
17499
17499
|
}
|
|
@@ -17503,8 +17503,8 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17503
17503
|
type: TriggerType11.Manual,
|
|
17504
17504
|
data,
|
|
17505
17505
|
input,
|
|
17506
|
-
|
|
17507
|
-
|
|
17506
|
+
headers,
|
|
17507
|
+
pathParams
|
|
17508
17508
|
});
|
|
17509
17509
|
}
|
|
17510
17510
|
getInputVariables() {
|
|
@@ -17537,19 +17537,19 @@ var ManualTrigger2 = class _ManualTrigger extends Trigger {
|
|
|
17537
17537
|
}
|
|
17538
17538
|
const headersMapProto = manualOutput.getHeadersMap();
|
|
17539
17539
|
if (headersMapProto && headersMapProto.getLength() > 0) {
|
|
17540
|
-
const
|
|
17540
|
+
const headersObject = {};
|
|
17541
17541
|
headersMapProto.forEach((value, key) => {
|
|
17542
|
-
|
|
17542
|
+
headersObject[key] = value;
|
|
17543
17543
|
});
|
|
17544
|
-
result.headers =
|
|
17544
|
+
result.headers = headersObject;
|
|
17545
17545
|
}
|
|
17546
17546
|
const pathParamsMapProto = manualOutput.getPathparamsMap();
|
|
17547
17547
|
if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
|
|
17548
|
-
const
|
|
17548
|
+
const pathParamsObject = {};
|
|
17549
17549
|
pathParamsMapProto.forEach((value, key) => {
|
|
17550
|
-
|
|
17550
|
+
pathParamsObject[key] = value;
|
|
17551
17551
|
});
|
|
17552
|
-
result.pathParams =
|
|
17552
|
+
result.pathParams = pathParamsObject;
|
|
17553
17553
|
}
|
|
17554
17554
|
return result;
|
|
17555
17555
|
}
|
|
@@ -17890,9 +17890,9 @@ var RestAPINode2 = class _RestAPINode extends Node {
|
|
|
17890
17890
|
config.setUrl(configData.url);
|
|
17891
17891
|
config.setMethod(configData.method);
|
|
17892
17892
|
config.setBody(configData.body || "");
|
|
17893
|
-
if (configData.
|
|
17893
|
+
if (configData.headers && Object.keys(configData.headers).length > 0) {
|
|
17894
17894
|
const headersMap = config.getHeadersMap();
|
|
17895
|
-
configData.
|
|
17895
|
+
Object.entries(configData.headers).forEach(([key, value]) => {
|
|
17896
17896
|
headersMap.set(key, value);
|
|
17897
17897
|
});
|
|
17898
17898
|
}
|
|
@@ -17908,7 +17908,19 @@ var RestAPINode2 = class _RestAPINode extends Node {
|
|
|
17908
17908
|
return new _RestAPINode({
|
|
17909
17909
|
...obj,
|
|
17910
17910
|
type: NodeType6.RestAPI,
|
|
17911
|
-
data:
|
|
17911
|
+
data: {
|
|
17912
|
+
url: raw.getRestApi().getConfig().getUrl(),
|
|
17913
|
+
method: raw.getRestApi().getConfig().getMethod(),
|
|
17914
|
+
body: raw.getRestApi().getConfig().getBody(),
|
|
17915
|
+
headers: (() => {
|
|
17916
|
+
const headersMap = raw.getRestApi().getConfig().getHeadersMap();
|
|
17917
|
+
const headers = {};
|
|
17918
|
+
headersMap.forEach((value, key) => {
|
|
17919
|
+
headers[key] = value;
|
|
17920
|
+
});
|
|
17921
|
+
return headers;
|
|
17922
|
+
})()
|
|
17923
|
+
},
|
|
17912
17924
|
input
|
|
17913
17925
|
// Include input data from top-level TaskNode
|
|
17914
17926
|
});
|
|
@@ -18273,9 +18285,9 @@ var LoopNode2 = class _LoopNode extends Node {
|
|
|
18273
18285
|
}
|
|
18274
18286
|
if (typeof executionMode === "string") {
|
|
18275
18287
|
switch (executionMode.toLowerCase()) {
|
|
18276
|
-
case
|
|
18288
|
+
case ExecutionMode.Parallel:
|
|
18277
18289
|
return 1;
|
|
18278
|
-
case
|
|
18290
|
+
case ExecutionMode.Sequential:
|
|
18279
18291
|
default:
|
|
18280
18292
|
return 0;
|
|
18281
18293
|
}
|
|
@@ -18377,7 +18389,7 @@ var LoopNode2 = class _LoopNode extends Node {
|
|
|
18377
18389
|
url: apiConfig.url,
|
|
18378
18390
|
method: apiConfig.method,
|
|
18379
18391
|
body: apiConfig.body || "",
|
|
18380
|
-
|
|
18392
|
+
headers: apiConfig.headers
|
|
18381
18393
|
});
|
|
18382
18394
|
loopNode.setRestApi(restApi);
|
|
18383
18395
|
}
|
|
@@ -18799,43 +18811,43 @@ var Step = class _Step {
|
|
|
18799
18811
|
if (userData.headers) {
|
|
18800
18812
|
if (Array.isArray(userData.headers)) {
|
|
18801
18813
|
if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
|
|
18802
|
-
|
|
18814
|
+
const headersObject = {};
|
|
18815
|
+
for (const [key, value] of userData.headers) {
|
|
18816
|
+
headersObject[key] = value;
|
|
18817
|
+
}
|
|
18818
|
+
result.headers = headersObject;
|
|
18803
18819
|
} else {
|
|
18804
|
-
const
|
|
18820
|
+
const headersObject = {};
|
|
18805
18821
|
for (const header of userData.headers) {
|
|
18806
18822
|
for (const [key, value] of Object.entries(header)) {
|
|
18807
|
-
|
|
18823
|
+
headersObject[key] = value;
|
|
18808
18824
|
}
|
|
18809
18825
|
}
|
|
18810
|
-
result.headers =
|
|
18826
|
+
result.headers = headersObject;
|
|
18811
18827
|
}
|
|
18812
18828
|
} else {
|
|
18813
|
-
|
|
18814
|
-
for (const [key, value] of Object.entries(userData.headers)) {
|
|
18815
|
-
headersArray.push([key, value]);
|
|
18816
|
-
}
|
|
18817
|
-
result.headers = headersArray;
|
|
18829
|
+
result.headers = userData.headers;
|
|
18818
18830
|
}
|
|
18819
18831
|
}
|
|
18820
18832
|
if (userData.pathParams) {
|
|
18821
18833
|
if (Array.isArray(userData.pathParams)) {
|
|
18822
18834
|
if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
|
|
18823
|
-
|
|
18835
|
+
const pathParamsObject = {};
|
|
18836
|
+
for (const [key, value] of userData.pathParams) {
|
|
18837
|
+
pathParamsObject[key] = value;
|
|
18838
|
+
}
|
|
18839
|
+
result.pathParams = pathParamsObject;
|
|
18824
18840
|
} else {
|
|
18825
|
-
const
|
|
18841
|
+
const pathParamsObject = {};
|
|
18826
18842
|
for (const pathParam of userData.pathParams) {
|
|
18827
18843
|
for (const [key, value] of Object.entries(pathParam)) {
|
|
18828
|
-
|
|
18844
|
+
pathParamsObject[key] = value;
|
|
18829
18845
|
}
|
|
18830
18846
|
}
|
|
18831
|
-
result.pathParams =
|
|
18847
|
+
result.pathParams = pathParamsObject;
|
|
18832
18848
|
}
|
|
18833
18849
|
} else {
|
|
18834
|
-
|
|
18835
|
-
for (const [key, value] of Object.entries(userData.pathParams)) {
|
|
18836
|
-
pathParamsArray.push([key, value]);
|
|
18837
|
-
}
|
|
18838
|
-
result.pathParams = pathParamsArray;
|
|
18850
|
+
result.pathParams = userData.pathParams;
|
|
18839
18851
|
}
|
|
18840
18852
|
}
|
|
18841
18853
|
} else {
|
|
@@ -18855,43 +18867,43 @@ var Step = class _Step {
|
|
|
18855
18867
|
if (userData.headers) {
|
|
18856
18868
|
if (Array.isArray(userData.headers)) {
|
|
18857
18869
|
if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
|
|
18858
|
-
|
|
18870
|
+
const headersObject = {};
|
|
18871
|
+
for (const [key, value] of userData.headers) {
|
|
18872
|
+
headersObject[key] = value;
|
|
18873
|
+
}
|
|
18874
|
+
result.headers = headersObject;
|
|
18859
18875
|
} else {
|
|
18860
|
-
const
|
|
18876
|
+
const headersObject = {};
|
|
18861
18877
|
for (const header of userData.headers) {
|
|
18862
18878
|
for (const [key, value] of Object.entries(header)) {
|
|
18863
|
-
|
|
18879
|
+
headersObject[key] = value;
|
|
18864
18880
|
}
|
|
18865
18881
|
}
|
|
18866
|
-
result.headers =
|
|
18882
|
+
result.headers = headersObject;
|
|
18867
18883
|
}
|
|
18868
18884
|
} else {
|
|
18869
|
-
|
|
18870
|
-
for (const [key, value] of Object.entries(userData.headers)) {
|
|
18871
|
-
headersArray.push([key, value]);
|
|
18872
|
-
}
|
|
18873
|
-
result.headers = headersArray;
|
|
18885
|
+
result.headers = userData.headers;
|
|
18874
18886
|
}
|
|
18875
18887
|
}
|
|
18876
18888
|
if (userData.pathParams) {
|
|
18877
18889
|
if (Array.isArray(userData.pathParams)) {
|
|
18878
18890
|
if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
|
|
18879
|
-
|
|
18891
|
+
const pathParamsObject = {};
|
|
18892
|
+
for (const [key, value] of userData.pathParams) {
|
|
18893
|
+
pathParamsObject[key] = value;
|
|
18894
|
+
}
|
|
18895
|
+
result.pathParams = pathParamsObject;
|
|
18880
18896
|
} else {
|
|
18881
|
-
const
|
|
18897
|
+
const pathParamsObject = {};
|
|
18882
18898
|
for (const pathParam of userData.pathParams) {
|
|
18883
18899
|
for (const [key, value] of Object.entries(pathParam)) {
|
|
18884
|
-
|
|
18900
|
+
pathParamsObject[key] = value;
|
|
18885
18901
|
}
|
|
18886
18902
|
}
|
|
18887
|
-
result.pathParams =
|
|
18903
|
+
result.pathParams = pathParamsObject;
|
|
18888
18904
|
}
|
|
18889
18905
|
} else {
|
|
18890
|
-
|
|
18891
|
-
for (const [key, value] of Object.entries(userData.pathParams)) {
|
|
18892
|
-
pathParamsArray.push([key, value]);
|
|
18893
|
-
}
|
|
18894
|
-
result.pathParams = pathParamsArray;
|
|
18906
|
+
result.pathParams = userData.pathParams;
|
|
18895
18907
|
}
|
|
18896
18908
|
}
|
|
18897
18909
|
} else {
|
|
@@ -18901,34 +18913,42 @@ var Step = class _Step {
|
|
|
18901
18913
|
if (typeof manualTrigger.getHeadersMap === "function") {
|
|
18902
18914
|
const headersMap = manualTrigger.getHeadersMap();
|
|
18903
18915
|
if (headersMap && headersMap.getLength() > 0) {
|
|
18904
|
-
const
|
|
18916
|
+
const headersObject = {};
|
|
18905
18917
|
headersMap.forEach((value, key) => {
|
|
18906
|
-
|
|
18918
|
+
headersObject[key] = value;
|
|
18907
18919
|
});
|
|
18908
|
-
result.headers =
|
|
18920
|
+
result.headers = headersObject;
|
|
18909
18921
|
}
|
|
18910
18922
|
} else if (manualTrigger.headers) {
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18923
|
+
if (Array.isArray(manualTrigger.headers)) {
|
|
18924
|
+
const headersObject = {};
|
|
18925
|
+
for (const [key, value] of Object.entries(manualTrigger.headers)) {
|
|
18926
|
+
headersObject[key] = value;
|
|
18927
|
+
}
|
|
18928
|
+
result.headers = headersObject;
|
|
18929
|
+
} else {
|
|
18930
|
+
result.headers = manualTrigger.headers;
|
|
18914
18931
|
}
|
|
18915
|
-
result.headers = headersArray;
|
|
18916
18932
|
}
|
|
18917
18933
|
if (typeof manualTrigger.getPathparamsMap === "function") {
|
|
18918
18934
|
const pathParamsMap = manualTrigger.getPathparamsMap();
|
|
18919
18935
|
if (pathParamsMap && pathParamsMap.getLength() > 0) {
|
|
18920
|
-
const
|
|
18936
|
+
const pathParamsObject = {};
|
|
18921
18937
|
pathParamsMap.forEach((value, key) => {
|
|
18922
|
-
|
|
18938
|
+
pathParamsObject[key] = value;
|
|
18923
18939
|
});
|
|
18924
|
-
result.pathParams =
|
|
18940
|
+
result.pathParams = pathParamsObject;
|
|
18925
18941
|
}
|
|
18926
18942
|
} else if (manualTrigger.pathparams) {
|
|
18927
|
-
|
|
18928
|
-
|
|
18929
|
-
|
|
18943
|
+
if (Array.isArray(manualTrigger.pathparams)) {
|
|
18944
|
+
const pathParamsObject = {};
|
|
18945
|
+
for (const [key, value] of Object.entries(manualTrigger.pathparams)) {
|
|
18946
|
+
pathParamsObject[key] = value;
|
|
18947
|
+
}
|
|
18948
|
+
result.pathParams = pathParamsObject;
|
|
18949
|
+
} else {
|
|
18950
|
+
result.pathParams = manualTrigger.pathparams;
|
|
18930
18951
|
}
|
|
18931
|
-
result.pathParams = pathParamsArray;
|
|
18932
18952
|
}
|
|
18933
18953
|
if (Object.keys(result).length === 0) {
|
|
18934
18954
|
const objData = manualTrigger.toObject?.() || manualTrigger;
|
|
@@ -19815,15 +19835,15 @@ var Client = class extends BaseClient {
|
|
|
19815
19835
|
const protobufValue = convertJSValueToProtobuf(manualData.data);
|
|
19816
19836
|
manualOutput.setData(protobufValue);
|
|
19817
19837
|
}
|
|
19818
|
-
if (manualData.
|
|
19838
|
+
if (manualData.headers) {
|
|
19819
19839
|
const headersMap = manualOutput.getHeadersMap();
|
|
19820
|
-
manualData.
|
|
19840
|
+
Object.entries(manualData.headers).forEach(([key, value]) => {
|
|
19821
19841
|
headersMap.set(key, value);
|
|
19822
19842
|
});
|
|
19823
19843
|
}
|
|
19824
|
-
if (manualData.
|
|
19844
|
+
if (manualData.pathParams) {
|
|
19825
19845
|
const pathParamsMap = manualOutput.getPathparamsMap();
|
|
19826
|
-
manualData.
|
|
19846
|
+
Object.entries(manualData.pathParams).forEach(([key, value]) => {
|
|
19827
19847
|
pathParamsMap.set(key, value);
|
|
19828
19848
|
});
|
|
19829
19849
|
}
|
package/dist/models/node/loop.js
CHANGED
|
@@ -81,9 +81,9 @@ class LoopNode extends Node {
|
|
|
81
81
|
}
|
|
82
82
|
if (typeof executionMode === "string") {
|
|
83
83
|
switch (executionMode.toLowerCase()) {
|
|
84
|
-
case
|
|
84
|
+
case ExecutionMode.Parallel:
|
|
85
85
|
return 1;
|
|
86
|
-
case
|
|
86
|
+
case ExecutionMode.Sequential:
|
|
87
87
|
default:
|
|
88
88
|
return 0; // Default to sequential for safety
|
|
89
89
|
}
|
|
@@ -191,7 +191,7 @@ class LoopNode extends Node {
|
|
|
191
191
|
url: apiConfig.url,
|
|
192
192
|
method: apiConfig.method,
|
|
193
193
|
body: apiConfig.body || "",
|
|
194
|
-
|
|
194
|
+
headers: apiConfig.headers,
|
|
195
195
|
});
|
|
196
196
|
loopNode.setRestApi(restApi);
|
|
197
197
|
}
|
|
@@ -12,11 +12,11 @@ declare class RestAPINode extends Node {
|
|
|
12
12
|
url: string;
|
|
13
13
|
method: string;
|
|
14
14
|
body?: string;
|
|
15
|
-
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
16
|
}): avs_pb.RestAPINode;
|
|
17
17
|
static fromResponse(raw: avs_pb.TaskNode): RestAPINode;
|
|
18
18
|
toRequest(): avs_pb.TaskNode;
|
|
19
|
-
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp):
|
|
19
|
+
static fromOutputData(outputData: avs_pb.RunNodeWithInputsResp): Record<string, unknown> | null;
|
|
20
20
|
}
|
|
21
21
|
export default RestAPINode;
|
|
22
22
|
//# sourceMappingURL=restApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restApi.d.ts","sourceRoot":"","sources":["../../../src/models/node/restApi.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAGL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAS5B,cAAM,WAAY,SAAQ,IAAI;gBAChB,KAAK,EAAE,gBAAgB;IAInC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,
|
|
1
|
+
{"version":3,"file":"restApi.d.ts","sourceRoot":"","sources":["../../../src/models/node/restApi.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAGL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAS5B,cAAM,WAAY,SAAQ,IAAI;gBAChB,KAAK,EAAE,gBAAgB;IAInC;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE;QACpC,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,GAAG,MAAM,CAAC,WAAW;IAmBtB,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,WAAW;IA+BtD,SAAS,IAAI,MAAM,CAAC,QAAQ;IAwB5B,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAehG;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -18,9 +18,9 @@ class RestAPINode extends Node {
|
|
|
18
18
|
config.setUrl(configData.url);
|
|
19
19
|
config.setMethod(configData.method);
|
|
20
20
|
config.setBody(configData.body || "");
|
|
21
|
-
if (configData.
|
|
21
|
+
if (configData.headers && Object.keys(configData.headers).length > 0) {
|
|
22
22
|
const headersMap = config.getHeadersMap();
|
|
23
|
-
configData.
|
|
23
|
+
Object.entries(configData.headers).forEach(([key, value]) => {
|
|
24
24
|
headersMap.set(key, value);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -39,7 +39,19 @@ class RestAPINode extends Node {
|
|
|
39
39
|
return new RestAPINode({
|
|
40
40
|
...obj,
|
|
41
41
|
type: NodeType.RestAPI,
|
|
42
|
-
data:
|
|
42
|
+
data: {
|
|
43
|
+
url: raw.getRestApi().getConfig().getUrl(),
|
|
44
|
+
method: raw.getRestApi().getConfig().getMethod(),
|
|
45
|
+
body: raw.getRestApi().getConfig().getBody(),
|
|
46
|
+
headers: (() => {
|
|
47
|
+
const headersMap = raw.getRestApi().getConfig().getHeadersMap();
|
|
48
|
+
const headers = {};
|
|
49
|
+
headersMap.forEach((value, key) => {
|
|
50
|
+
headers[key] = value;
|
|
51
|
+
});
|
|
52
|
+
return headers;
|
|
53
|
+
})(),
|
|
54
|
+
},
|
|
43
55
|
input: input, // Include input data from top-level TaskNode
|
|
44
56
|
});
|
|
45
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/models/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhE,cAAM,IAAK,YAAW,SAAS;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;gBAEF,KAAK,EAAE,SAAS;IAc5B;;;OAGG;IACH,MAAM,IAAI,SAAS;IAgBnB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,eAAe;
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/models/step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAMhD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhE,cAAM,IAAK,YAAW,SAAS;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;gBAEF,KAAK,EAAE,SAAS;IAc5B;;;OAGG;IACH,MAAM,IAAI,SAAS;IAgBnB,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,eAAe;IAkmB9D,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI;CAqFvD;AAED,eAAe,IAAI,CAAC"}
|
package/dist/models/step.js
CHANGED
|
@@ -150,57 +150,59 @@ class Step {
|
|
|
150
150
|
// Flatten it by extracting the nested data
|
|
151
151
|
result.data = userData.data;
|
|
152
152
|
if (userData.headers) {
|
|
153
|
-
//
|
|
153
|
+
// Keep headers as object format for consistency
|
|
154
154
|
if (Array.isArray(userData.headers)) {
|
|
155
155
|
// Check if it's already in Array<[string, string]> format
|
|
156
156
|
if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
|
|
157
|
-
|
|
157
|
+
// Convert from Array<[string, string]> to object format
|
|
158
|
+
const headersObject = {};
|
|
159
|
+
for (const [key, value] of userData.headers) {
|
|
160
|
+
headersObject[key] = value;
|
|
161
|
+
}
|
|
162
|
+
result.headers = headersObject;
|
|
158
163
|
}
|
|
159
164
|
else {
|
|
160
|
-
// Convert from Array<{key: value}> to
|
|
161
|
-
const
|
|
165
|
+
// Convert from Array<{key: value}> to object format
|
|
166
|
+
const headersObject = {};
|
|
162
167
|
for (const header of userData.headers) {
|
|
163
168
|
for (const [key, value] of Object.entries(header)) {
|
|
164
|
-
|
|
169
|
+
headersObject[key] = value;
|
|
165
170
|
}
|
|
166
171
|
}
|
|
167
|
-
result.headers =
|
|
172
|
+
result.headers = headersObject;
|
|
168
173
|
}
|
|
169
174
|
}
|
|
170
175
|
else {
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
for (const [key, value] of Object.entries(userData.headers)) {
|
|
174
|
-
headersArray.push([key, value]);
|
|
175
|
-
}
|
|
176
|
-
result.headers = headersArray;
|
|
176
|
+
// Already in object format
|
|
177
|
+
result.headers = userData.headers;
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
if (userData.pathParams) {
|
|
180
|
-
//
|
|
181
|
+
// Keep pathParams as object format for consistency
|
|
181
182
|
if (Array.isArray(userData.pathParams)) {
|
|
182
183
|
// Check if it's already in Array<[string, string]> format
|
|
183
184
|
if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
|
|
184
|
-
|
|
185
|
+
// Convert from Array<[string, string]> to object format
|
|
186
|
+
const pathParamsObject = {};
|
|
187
|
+
for (const [key, value] of userData.pathParams) {
|
|
188
|
+
pathParamsObject[key] = value;
|
|
189
|
+
}
|
|
190
|
+
result.pathParams = pathParamsObject;
|
|
185
191
|
}
|
|
186
192
|
else {
|
|
187
|
-
// Convert from Array<{key: value}> to
|
|
188
|
-
const
|
|
193
|
+
// Convert from Array<{key: value}> to object format
|
|
194
|
+
const pathParamsObject = {};
|
|
189
195
|
for (const pathParam of userData.pathParams) {
|
|
190
196
|
for (const [key, value] of Object.entries(pathParam)) {
|
|
191
|
-
|
|
197
|
+
pathParamsObject[key] = value;
|
|
192
198
|
}
|
|
193
199
|
}
|
|
194
|
-
result.pathParams =
|
|
200
|
+
result.pathParams = pathParamsObject;
|
|
195
201
|
}
|
|
196
202
|
}
|
|
197
203
|
else {
|
|
198
|
-
//
|
|
199
|
-
|
|
200
|
-
for (const [key, value] of Object.entries(userData.pathParams)) {
|
|
201
|
-
pathParamsArray.push([key, value]);
|
|
202
|
-
}
|
|
203
|
-
result.pathParams = pathParamsArray;
|
|
204
|
+
// Already in object format
|
|
205
|
+
result.pathParams = userData.pathParams;
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
}
|
|
@@ -227,57 +229,59 @@ class Step {
|
|
|
227
229
|
// Flatten it by extracting the nested data
|
|
228
230
|
result.data = userData.data;
|
|
229
231
|
if (userData.headers) {
|
|
230
|
-
//
|
|
232
|
+
// Keep headers as object format for consistency
|
|
231
233
|
if (Array.isArray(userData.headers)) {
|
|
232
234
|
// Check if it's already in Array<[string, string]> format
|
|
233
235
|
if (userData.headers.length > 0 && Array.isArray(userData.headers[0])) {
|
|
234
|
-
|
|
236
|
+
// Convert from Array<[string, string]> to object format
|
|
237
|
+
const headersObject = {};
|
|
238
|
+
for (const [key, value] of userData.headers) {
|
|
239
|
+
headersObject[key] = value;
|
|
240
|
+
}
|
|
241
|
+
result.headers = headersObject;
|
|
235
242
|
}
|
|
236
243
|
else {
|
|
237
|
-
// Convert from Array<{key: value}> to
|
|
238
|
-
const
|
|
244
|
+
// Convert from Array<{key: value}> to object format
|
|
245
|
+
const headersObject = {};
|
|
239
246
|
for (const header of userData.headers) {
|
|
240
247
|
for (const [key, value] of Object.entries(header)) {
|
|
241
|
-
|
|
248
|
+
headersObject[key] = value;
|
|
242
249
|
}
|
|
243
250
|
}
|
|
244
|
-
result.headers =
|
|
251
|
+
result.headers = headersObject;
|
|
245
252
|
}
|
|
246
253
|
}
|
|
247
254
|
else {
|
|
248
|
-
//
|
|
249
|
-
|
|
250
|
-
for (const [key, value] of Object.entries(userData.headers)) {
|
|
251
|
-
headersArray.push([key, value]);
|
|
252
|
-
}
|
|
253
|
-
result.headers = headersArray;
|
|
255
|
+
// Already in object format
|
|
256
|
+
result.headers = userData.headers;
|
|
254
257
|
}
|
|
255
258
|
}
|
|
256
259
|
if (userData.pathParams) {
|
|
257
|
-
//
|
|
260
|
+
// Keep pathParams as object format for consistency
|
|
258
261
|
if (Array.isArray(userData.pathParams)) {
|
|
259
262
|
// Check if it's already in Array<[string, string]> format
|
|
260
263
|
if (userData.pathParams.length > 0 && Array.isArray(userData.pathParams[0])) {
|
|
261
|
-
|
|
264
|
+
// Convert from Array<[string, string]> to object format
|
|
265
|
+
const pathParamsObject = {};
|
|
266
|
+
for (const [key, value] of userData.pathParams) {
|
|
267
|
+
pathParamsObject[key] = value;
|
|
268
|
+
}
|
|
269
|
+
result.pathParams = pathParamsObject;
|
|
262
270
|
}
|
|
263
271
|
else {
|
|
264
|
-
// Convert from Array<{key: value}> to
|
|
265
|
-
const
|
|
272
|
+
// Convert from Array<{key: value}> to object format
|
|
273
|
+
const pathParamsObject = {};
|
|
266
274
|
for (const pathParam of userData.pathParams) {
|
|
267
275
|
for (const [key, value] of Object.entries(pathParam)) {
|
|
268
|
-
|
|
276
|
+
pathParamsObject[key] = value;
|
|
269
277
|
}
|
|
270
278
|
}
|
|
271
|
-
result.pathParams =
|
|
279
|
+
result.pathParams = pathParamsObject;
|
|
272
280
|
}
|
|
273
281
|
}
|
|
274
282
|
else {
|
|
275
|
-
//
|
|
276
|
-
|
|
277
|
-
for (const [key, value] of Object.entries(userData.pathParams)) {
|
|
278
|
-
pathParamsArray.push([key, value]);
|
|
279
|
-
}
|
|
280
|
-
result.pathParams = pathParamsArray;
|
|
283
|
+
// Already in object format
|
|
284
|
+
result.pathParams = userData.pathParams;
|
|
281
285
|
}
|
|
282
286
|
}
|
|
283
287
|
}
|
|
@@ -286,43 +290,53 @@ class Step {
|
|
|
286
290
|
result.data = userData;
|
|
287
291
|
}
|
|
288
292
|
}
|
|
289
|
-
// Include headers for webhook testing - use
|
|
293
|
+
// Include headers for webhook testing - use object format for consistency
|
|
290
294
|
if (typeof manualTrigger.getHeadersMap === "function") {
|
|
291
295
|
const headersMap = manualTrigger.getHeadersMap();
|
|
292
296
|
if (headersMap && headersMap.getLength() > 0) {
|
|
293
|
-
const
|
|
297
|
+
const headersObject = {};
|
|
294
298
|
headersMap.forEach((value, key) => {
|
|
295
|
-
|
|
299
|
+
headersObject[key] = value;
|
|
296
300
|
});
|
|
297
|
-
result.headers =
|
|
301
|
+
result.headers = headersObject;
|
|
298
302
|
}
|
|
299
303
|
}
|
|
300
304
|
else if (manualTrigger.headers) {
|
|
301
|
-
// For plain objects, convert to
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
+
// For plain objects, convert to object format
|
|
306
|
+
if (Array.isArray(manualTrigger.headers)) {
|
|
307
|
+
const headersObject = {};
|
|
308
|
+
for (const [key, value] of Object.entries(manualTrigger.headers)) {
|
|
309
|
+
headersObject[key] = value;
|
|
310
|
+
}
|
|
311
|
+
result.headers = headersObject;
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
result.headers = manualTrigger.headers;
|
|
305
315
|
}
|
|
306
|
-
result.headers = headersArray;
|
|
307
316
|
}
|
|
308
|
-
// Include pathParams for webhook testing - use
|
|
317
|
+
// Include pathParams for webhook testing - use object format for consistency
|
|
309
318
|
if (typeof manualTrigger.getPathparamsMap === "function") {
|
|
310
319
|
const pathParamsMap = manualTrigger.getPathparamsMap();
|
|
311
320
|
if (pathParamsMap && pathParamsMap.getLength() > 0) {
|
|
312
|
-
const
|
|
321
|
+
const pathParamsObject = {};
|
|
313
322
|
pathParamsMap.forEach((value, key) => {
|
|
314
|
-
|
|
323
|
+
pathParamsObject[key] = value;
|
|
315
324
|
});
|
|
316
|
-
result.pathParams =
|
|
325
|
+
result.pathParams = pathParamsObject;
|
|
317
326
|
}
|
|
318
327
|
}
|
|
319
328
|
else if (manualTrigger.pathparams) {
|
|
320
|
-
// For plain objects, convert to
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
329
|
+
// For plain objects, convert to object format
|
|
330
|
+
if (Array.isArray(manualTrigger.pathparams)) {
|
|
331
|
+
const pathParamsObject = {};
|
|
332
|
+
for (const [key, value] of Object.entries(manualTrigger.pathparams)) {
|
|
333
|
+
pathParamsObject[key] = value;
|
|
334
|
+
}
|
|
335
|
+
result.pathParams = pathParamsObject;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
result.pathParams = manualTrigger.pathparams;
|
|
324
339
|
}
|
|
325
|
-
result.pathParams = pathParamsArray;
|
|
326
340
|
}
|
|
327
341
|
// Check if this is the new format with no data field or null data
|
|
328
342
|
if (Object.keys(result).length === 0) {
|
|
@@ -2,8 +2,8 @@ import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
|
2
2
|
import Trigger from "./interface";
|
|
3
3
|
import { ManualTriggerProps } from "@avaprotocol/types";
|
|
4
4
|
declare class ManualTrigger extends Trigger {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
pathParams?: Record<string, string>;
|
|
7
7
|
constructor(props: ManualTriggerProps);
|
|
8
8
|
toRequest(): avs_pb.TaskTrigger;
|
|
9
9
|
static fromResponse(raw: avs_pb.TaskTrigger): ManualTrigger;
|
|
@@ -1 +1 @@
|
|
|
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,EAEnB,MAAM,oBAAoB,CAAC;AAE5B,cAAM,aAAc,SAAQ,OAAO;IAC1B,
|
|
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,EAEnB,MAAM,oBAAoB,CAAC;AAE5B,cAAM,aAAc,SAAQ,OAAO;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAE/B,KAAK,EAAE,kBAAkB;IAWrC,SAAS,IAAI,MAAM,CAAC,WAAW;IAyC/B,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,WAAW,GAAG,aAAa;IA+C3D,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAKnD;;;;OAIG;IACH,MAAM,CAAC,cAAc,CACnB,UAAU,EAAE,MAAM,CAAC,cAAc,GAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CA6ClC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -10,8 +10,8 @@ class ManualTrigger extends Trigger {
|
|
|
10
10
|
data: props.data,
|
|
11
11
|
input: props.input,
|
|
12
12
|
});
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
13
|
+
this.headers = props.headers;
|
|
14
|
+
this.pathParams = props.pathParams;
|
|
15
15
|
}
|
|
16
16
|
toRequest() {
|
|
17
17
|
const trigger = new avs_pb.TaskTrigger();
|
|
@@ -29,17 +29,17 @@ class ManualTrigger extends Trigger {
|
|
|
29
29
|
config.setData(inputValue);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
// Set headers if provided -
|
|
33
|
-
if (this.
|
|
32
|
+
// Set headers if provided - direct object to protobuf map mapping
|
|
33
|
+
if (this.headers && Object.keys(this.headers).length > 0) {
|
|
34
34
|
const headersMap = config.getHeadersMap();
|
|
35
|
-
this.
|
|
35
|
+
Object.entries(this.headers).forEach(([key, value]) => {
|
|
36
36
|
headersMap.set(key, value);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
// Set pathParams if provided -
|
|
40
|
-
if (this.
|
|
39
|
+
// Set pathParams if provided - direct object to protobuf map mapping
|
|
40
|
+
if (this.pathParams && Object.keys(this.pathParams).length > 0) {
|
|
41
41
|
const pathParamsMap = config.getPathparamsMap();
|
|
42
|
-
this.
|
|
42
|
+
Object.entries(this.pathParams).forEach(([key, value]) => {
|
|
43
43
|
pathParamsMap.set(key, value);
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -51,8 +51,8 @@ class ManualTrigger extends Trigger {
|
|
|
51
51
|
const obj = raw.toObject();
|
|
52
52
|
let data = null;
|
|
53
53
|
const input = undefined;
|
|
54
|
-
let
|
|
55
|
-
let
|
|
54
|
+
let headers = undefined;
|
|
55
|
+
let pathParams = undefined;
|
|
56
56
|
const manualTrigger = raw.getManual();
|
|
57
57
|
if (manualTrigger) {
|
|
58
58
|
const config = manualTrigger.getConfig();
|
|
@@ -61,20 +61,20 @@ class ManualTrigger extends Trigger {
|
|
|
61
61
|
if (config.hasData()) {
|
|
62
62
|
data = extractInputFromProtobuf(config.getData());
|
|
63
63
|
}
|
|
64
|
-
// Extract headers -
|
|
64
|
+
// Extract headers - direct protobuf map to object mapping
|
|
65
65
|
const headersMapProto = config.getHeadersMap();
|
|
66
66
|
if (headersMapProto && headersMapProto.getLength() > 0) {
|
|
67
|
-
|
|
67
|
+
headers = {};
|
|
68
68
|
headersMapProto.forEach((value, key) => {
|
|
69
|
-
|
|
69
|
+
headers[key] = value;
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
// Extract pathParams -
|
|
72
|
+
// Extract pathParams - direct protobuf map to object mapping
|
|
73
73
|
const pathParamsMapProto = config.getPathparamsMap();
|
|
74
74
|
if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
|
|
75
|
-
|
|
75
|
+
pathParams = {};
|
|
76
76
|
pathParamsMapProto.forEach((value, key) => {
|
|
77
|
-
|
|
77
|
+
pathParams[key] = value;
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -84,8 +84,8 @@ class ManualTrigger extends Trigger {
|
|
|
84
84
|
type: TriggerType.Manual,
|
|
85
85
|
data: data,
|
|
86
86
|
input: input,
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
headers: headers,
|
|
88
|
+
pathParams: pathParams,
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
getInputVariables() {
|
|
@@ -117,23 +117,23 @@ class ManualTrigger extends Trigger {
|
|
|
117
117
|
else {
|
|
118
118
|
result.data = null;
|
|
119
119
|
}
|
|
120
|
-
// Extract headers -
|
|
120
|
+
// Extract headers - always as object
|
|
121
121
|
const headersMapProto = manualOutput.getHeadersMap();
|
|
122
122
|
if (headersMapProto && headersMapProto.getLength() > 0) {
|
|
123
|
-
const
|
|
123
|
+
const headersObject = {};
|
|
124
124
|
headersMapProto.forEach((value, key) => {
|
|
125
|
-
|
|
125
|
+
headersObject[key] = value;
|
|
126
126
|
});
|
|
127
|
-
result.headers =
|
|
127
|
+
result.headers = headersObject;
|
|
128
128
|
}
|
|
129
|
-
// Extract pathParams -
|
|
129
|
+
// Extract pathParams - always as object
|
|
130
130
|
const pathParamsMapProto = manualOutput.getPathparamsMap();
|
|
131
131
|
if (pathParamsMapProto && pathParamsMapProto.getLength() > 0) {
|
|
132
|
-
const
|
|
132
|
+
const pathParamsObject = {};
|
|
133
133
|
pathParamsMapProto.forEach((value, key) => {
|
|
134
|
-
|
|
134
|
+
pathParamsObject[key] = value;
|
|
135
135
|
});
|
|
136
|
-
result.pathParams =
|
|
136
|
+
result.pathParams = pathParamsObject;
|
|
137
137
|
}
|
|
138
138
|
return result;
|
|
139
139
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avaprotocol/sdk-js",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.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.3.
|
|
34
|
+
"@avaprotocol/types": "^2.3.1",
|
|
35
35
|
"@grpc/grpc-js": "^1.11.3",
|
|
36
36
|
"@grpc/proto-loader": "^0.7.13",
|
|
37
37
|
"dotenv": "^16.4.5",
|