@avaprotocol/sdk-js 1.4.0 → 1.6.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 +28 -0
- package/dist/auth.d.ts +2 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +10 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +19 -0
- package/dist/grpc_codegen/custom_types.d.ts +45 -0
- package/dist/grpc_codegen/custom_types.d.ts.map +1 -0
- package/dist/grpc_codegen/custom_types.js +179 -0
- package/dist/index.d.ts +148 -2798
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8901 -5466
- package/dist/index.mjs +8897 -5459
- package/dist/models/edge.d.ts +12 -0
- package/dist/models/edge.d.ts.map +1 -0
- package/dist/models/edge.js +19 -0
- package/dist/models/execution.d.ts +32 -0
- package/dist/models/execution.d.ts.map +1 -0
- package/dist/models/execution.js +65 -0
- package/dist/models/node/branch.d.ts +14 -0
- package/dist/models/node/branch.d.ts.map +1 -0
- package/dist/models/node/branch.js +39 -0
- package/dist/models/node/contractRead.d.ts +14 -0
- package/dist/models/node/contractRead.d.ts.map +1 -0
- package/dist/models/node/contractRead.js +33 -0
- package/dist/models/node/contractWrite.d.ts +14 -0
- package/dist/models/node/contractWrite.d.ts.map +1 -0
- package/dist/models/node/contractWrite.js +31 -0
- package/dist/models/node/customCode.d.ts +18 -0
- package/dist/models/node/customCode.d.ts.map +1 -0
- package/dist/models/node/customCode.js +36 -0
- package/dist/models/node/ethTransfer.d.ts +14 -0
- package/dist/models/node/ethTransfer.d.ts.map +1 -0
- package/dist/models/node/ethTransfer.js +30 -0
- package/dist/models/node/factory.d.ts +21 -0
- package/dist/models/node/factory.d.ts.map +1 -0
- package/dist/models/node/factory.js +70 -0
- package/dist/models/node/filter.d.ts +14 -0
- package/dist/models/node/filter.d.ts.map +1 -0
- package/dist/models/node/filter.js +32 -0
- package/dist/models/node/graphqlQuery.d.ts +14 -0
- package/dist/models/node/graphqlQuery.d.ts.map +1 -0
- package/dist/models/node/graphqlQuery.js +43 -0
- package/dist/models/node/interface.d.ts +18 -0
- package/dist/models/node/interface.d.ts.map +1 -0
- package/dist/models/node/interface.js +37 -0
- package/dist/models/node/loop.d.ts +13 -0
- package/dist/models/node/loop.d.ts.map +1 -0
- package/dist/models/node/loop.js +145 -0
- package/dist/models/node/restApi.d.ts +15 -0
- package/dist/models/node/restApi.d.ts.map +1 -0
- package/dist/models/node/restApi.js +40 -0
- package/dist/models/secret.d.ts +16 -0
- package/dist/models/secret.d.ts.map +1 -0
- package/dist/models/secret.js +28 -0
- package/dist/models/step.d.ts +19 -0
- package/dist/models/step.d.ts.map +1 -0
- package/dist/models/step.js +78 -0
- package/dist/models/trigger/block.d.ts +20 -0
- package/dist/models/trigger/block.d.ts.map +1 -0
- package/dist/models/trigger/block.js +49 -0
- package/dist/models/trigger/cron.d.ts +20 -0
- package/dist/models/trigger/cron.d.ts.map +1 -0
- package/dist/models/trigger/cron.js +49 -0
- package/dist/models/trigger/event.d.ts +20 -0
- package/dist/models/trigger/event.d.ts.map +1 -0
- package/dist/models/trigger/event.js +74 -0
- package/dist/models/trigger/factory.d.ts +25 -0
- package/dist/models/trigger/factory.d.ts.map +1 -0
- package/dist/models/trigger/factory.js +54 -0
- package/dist/models/trigger/fixedTime.d.ts +20 -0
- package/dist/models/trigger/fixedTime.d.ts.map +1 -0
- package/dist/models/trigger/fixedTime.js +49 -0
- package/dist/models/trigger/interface.d.ts +25 -0
- package/dist/models/trigger/interface.d.ts.map +1 -0
- package/dist/models/trigger/interface.js +20 -0
- package/dist/models/trigger/manual.d.ts +13 -0
- package/dist/models/trigger/manual.d.ts.map +1 -0
- package/dist/models/trigger/manual.js +27 -0
- package/dist/models/trigger/reason.d.ts +33 -0
- package/dist/models/trigger/reason.d.ts.map +1 -0
- package/dist/models/trigger/reason.js +96 -0
- package/dist/models/workflow.d.ts +54 -0
- package/dist/models/workflow.d.ts.map +1 -0
- package/dist/models/workflow.js +117 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +37 -0
- package/package.json +6 -4
- package/dist/index.d.mts +0 -2937
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
+
export type EdgeProps = avs_pb.TaskEdge.AsObject;
|
|
3
|
+
declare class Edge implements EdgeProps {
|
|
4
|
+
id: string;
|
|
5
|
+
source: string;
|
|
6
|
+
target: string;
|
|
7
|
+
constructor(edge: EdgeProps);
|
|
8
|
+
static fromResponse(edge: avs_pb.TaskEdge): Edge;
|
|
9
|
+
toRequest(): avs_pb.TaskEdge;
|
|
10
|
+
}
|
|
11
|
+
export default Edge;
|
|
12
|
+
//# sourceMappingURL=edge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/models/edge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAEjD,cAAM,IAAK,YAAW,SAAS;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;gBAEH,IAAI,EAAE,SAAS;IAM3B,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI;IAIhD,SAAS,IAAI,MAAM,CAAC,QAAQ;CAQ7B;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
+
class Edge {
|
|
3
|
+
constructor(edge) {
|
|
4
|
+
this.id = edge.id;
|
|
5
|
+
this.source = edge.source;
|
|
6
|
+
this.target = edge.target;
|
|
7
|
+
}
|
|
8
|
+
static fromResponse(edge) {
|
|
9
|
+
return new Edge(edge.toObject());
|
|
10
|
+
}
|
|
11
|
+
toRequest() {
|
|
12
|
+
const edge = new avs_pb.TaskEdge();
|
|
13
|
+
edge.setId(this.id);
|
|
14
|
+
edge.setSource(this.source);
|
|
15
|
+
edge.setTarget(this.target);
|
|
16
|
+
return edge;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export default Edge;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
+
import TriggerReason from "./trigger/reason";
|
|
3
|
+
import Step from "./step";
|
|
4
|
+
export type StepProps = avs_pb.Execution.Step.AsObject;
|
|
5
|
+
export type OutputDataProps = avs_pb.BlockTrigger.Output.AsObject | avs_pb.FixedTimeTrigger.Output.AsObject | avs_pb.CronTrigger.Output.AsObject | avs_pb.EventTrigger.Output.AsObject | avs_pb.EventTrigger.TransferLogOutput.AsObject | avs_pb.Evm.Log.AsObject | {
|
|
6
|
+
blockNumber: number;
|
|
7
|
+
} | {
|
|
8
|
+
epoch: number;
|
|
9
|
+
} | {
|
|
10
|
+
epoch: number;
|
|
11
|
+
scheduleMatched: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
export type ExecutionProps = Omit<avs_pb.Execution.AsObject, "stepsList" | "reason" | "blockTrigger" | "fixedTimeTrigger" | "cronTrigger" | "eventTrigger"> & {
|
|
14
|
+
stepsList: Step[];
|
|
15
|
+
triggerReason: TriggerReason | undefined;
|
|
16
|
+
triggerOutput: OutputDataProps;
|
|
17
|
+
};
|
|
18
|
+
declare class Execution implements ExecutionProps {
|
|
19
|
+
id: string;
|
|
20
|
+
startAt: number;
|
|
21
|
+
endAt: number;
|
|
22
|
+
success: boolean;
|
|
23
|
+
error: string;
|
|
24
|
+
stepsList: Step[];
|
|
25
|
+
triggerReason: TriggerReason | undefined;
|
|
26
|
+
triggerName: string;
|
|
27
|
+
triggerOutput: OutputDataProps;
|
|
28
|
+
constructor(props: ExecutionProps);
|
|
29
|
+
static fromResponse(execution: avs_pb.Execution): Execution;
|
|
30
|
+
}
|
|
31
|
+
export default Execution;
|
|
32
|
+
//# sourceMappingURL=execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/models/execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;AAEvD,MAAM,MAAM,eAAe,GACvB,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,GACnC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,GACvC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,GAClC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,GACnC,MAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,GAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,GACvB;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GACvB;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,GAC1C,SAAS,CAAC;AAGd,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,MAAM,CAAC,SAAS,CAAC,QAAQ,EACvB,WAAW,GACX,QAAQ,GACR,cAAc,GACd,kBAAkB,GAClB,aAAa,GACb,cAAc,CACjB,GAAG;IACF,SAAS,EAAE,IAAI,EAAE,CAAC;IAClB,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IACzC,aAAa,EAAE,eAAe,CAAC;CAChC,CAAC;AAEF,cAAM,SAAU,YAAW,cAAc;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,EAAE,CAAC;IAClB,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,eAAe,CAAC;gBAEnB,KAAK,EAAE,cAAc;IAYjC,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,GAAG,SAAS;CAoD5D;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
+
import TriggerReason from "./trigger/reason";
|
|
3
|
+
import Step from "./step";
|
|
4
|
+
class Execution {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
this.id = props.id;
|
|
7
|
+
this.startAt = props.startAt;
|
|
8
|
+
this.endAt = props.endAt;
|
|
9
|
+
this.success = props.success;
|
|
10
|
+
this.error = props.error;
|
|
11
|
+
this.stepsList = props.stepsList;
|
|
12
|
+
this.triggerName = props.triggerName;
|
|
13
|
+
this.triggerReason = props.triggerReason;
|
|
14
|
+
this.triggerOutput = props.triggerOutput;
|
|
15
|
+
}
|
|
16
|
+
static fromResponse(execution) {
|
|
17
|
+
const triggerOutputDataType = execution.getOutputDataCase();
|
|
18
|
+
let triggerOutputData;
|
|
19
|
+
switch (triggerOutputDataType) {
|
|
20
|
+
case avs_pb.Execution.OutputDataCase.BLOCK_TRIGGER:
|
|
21
|
+
const blockOutput = execution.getBlockTrigger()?.toObject();
|
|
22
|
+
// Filter to only return blockNumber for block triggers
|
|
23
|
+
triggerOutputData = blockOutput ? { blockNumber: blockOutput.blockNumber } : undefined;
|
|
24
|
+
break;
|
|
25
|
+
case avs_pb.Execution.OutputDataCase.FIXED_TIME_TRIGGER:
|
|
26
|
+
const fixedTimeOutput = execution.getFixedTimeTrigger()?.toObject();
|
|
27
|
+
// Filter to only return epoch for fixed time triggers
|
|
28
|
+
triggerOutputData = fixedTimeOutput ? { epoch: fixedTimeOutput.epoch } : undefined;
|
|
29
|
+
break;
|
|
30
|
+
case avs_pb.Execution.OutputDataCase.CRON_TRIGGER:
|
|
31
|
+
const cronOutput = execution.getCronTrigger()?.toObject();
|
|
32
|
+
// Filter to only return epoch and scheduleMatched for cron triggers
|
|
33
|
+
triggerOutputData = cronOutput ? { epoch: cronOutput.epoch, scheduleMatched: cronOutput.scheduleMatched } : undefined;
|
|
34
|
+
break;
|
|
35
|
+
case avs_pb.Execution.OutputDataCase.EVENT_TRIGGER:
|
|
36
|
+
const eventTrigger = execution.getEventTrigger();
|
|
37
|
+
if (eventTrigger) {
|
|
38
|
+
if (eventTrigger.hasEvmLog()) {
|
|
39
|
+
triggerOutputData = eventTrigger.getEvmLog()?.toObject();
|
|
40
|
+
}
|
|
41
|
+
else if (eventTrigger.hasTransferLog()) {
|
|
42
|
+
triggerOutputData = eventTrigger.getTransferLog()?.toObject();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
case avs_pb.Execution.OutputDataCase.OUTPUT_DATA_NOT_SET:
|
|
47
|
+
triggerOutputData = undefined;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return new Execution({
|
|
51
|
+
id: execution.getId(),
|
|
52
|
+
startAt: execution.getStartAt(),
|
|
53
|
+
endAt: execution.getEndAt(),
|
|
54
|
+
success: execution.getSuccess(),
|
|
55
|
+
error: execution.getError(),
|
|
56
|
+
triggerName: execution.getTriggerName(),
|
|
57
|
+
triggerReason: TriggerReason.fromResponse(execution.getReason()),
|
|
58
|
+
triggerOutput: triggerOutputData,
|
|
59
|
+
stepsList: execution
|
|
60
|
+
.getStepsList()
|
|
61
|
+
.map((step) => Step.fromResponse(step)),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export default Execution;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodeProps } from "./interface";
|
|
2
|
+
import Node from "./interface";
|
|
3
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
4
|
+
export type BranchNodeData = avs_pb.BranchNode.Config.AsObject;
|
|
5
|
+
export type BranchNodeProps = NodeProps & {
|
|
6
|
+
data: BranchNodeData;
|
|
7
|
+
};
|
|
8
|
+
declare class BranchNode extends Node {
|
|
9
|
+
constructor(props: BranchNodeProps);
|
|
10
|
+
static fromResponse(raw: avs_pb.TaskNode): BranchNode;
|
|
11
|
+
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
}
|
|
13
|
+
export default BranchNode;
|
|
14
|
+
//# sourceMappingURL=branch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/models/node/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAGhD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAUrD,SAAS,IAAI,MAAM,CAAC,QAAQ;CAgC7B;AACD,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { NodeType } from "@avaprotocol/types";
|
|
2
|
+
import Node from "./interface";
|
|
3
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
4
|
+
class BranchNode extends Node {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super({ ...props, type: NodeType.Branch, data: props.data });
|
|
7
|
+
}
|
|
8
|
+
static fromResponse(raw) {
|
|
9
|
+
// Convert the raw object to BranchNodeProps, which should keep name and id
|
|
10
|
+
const obj = raw.toObject();
|
|
11
|
+
return new BranchNode({
|
|
12
|
+
...obj,
|
|
13
|
+
type: NodeType.Branch,
|
|
14
|
+
data: raw.getBranch().toObject().config,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
toRequest() {
|
|
18
|
+
const request = new avs_pb.TaskNode();
|
|
19
|
+
request.setId(this.id);
|
|
20
|
+
request.setName(this.name);
|
|
21
|
+
const nodeData = new avs_pb.BranchNode();
|
|
22
|
+
const config = new avs_pb.BranchNode.Config();
|
|
23
|
+
if (this.data.conditionsList &&
|
|
24
|
+
this.data.conditionsList.length > 0) {
|
|
25
|
+
const conditionsList = this.data.conditionsList.map((condition) => {
|
|
26
|
+
const conditionObj = new avs_pb.BranchNode.Condition();
|
|
27
|
+
conditionObj.setId(condition.id);
|
|
28
|
+
conditionObj.setType(condition.type);
|
|
29
|
+
conditionObj.setExpression(condition.expression);
|
|
30
|
+
return conditionObj;
|
|
31
|
+
});
|
|
32
|
+
config.setConditionsList(conditionsList);
|
|
33
|
+
}
|
|
34
|
+
nodeData.setConfig(config);
|
|
35
|
+
request.setBranch(nodeData);
|
|
36
|
+
return request;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export default BranchNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodeProps } from "./interface";
|
|
2
|
+
import Node from "./interface";
|
|
3
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
4
|
+
export type ContractReadNodeData = avs_pb.ContractReadNode.AsObject;
|
|
5
|
+
export type ContractReadNodeProps = NodeProps & {
|
|
6
|
+
data: ContractReadNodeData;
|
|
7
|
+
};
|
|
8
|
+
declare class ContractReadNode extends Node {
|
|
9
|
+
constructor(props: ContractReadNodeProps);
|
|
10
|
+
static fromResponse(raw: avs_pb.TaskNode): ContractReadNode;
|
|
11
|
+
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
}
|
|
13
|
+
export default ContractReadNode;
|
|
14
|
+
//# sourceMappingURL=contractRead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contractRead.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractRead.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAIhD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC;AACpE,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG;IAC9C,IAAI,EAAE,oBAAoB,CAAC;CAC5B,CAAC;AAEF,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAIxC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAU3D,SAAS,IAAI,MAAM,CAAC,QAAQ;CAoB7B;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Node from "./interface";
|
|
2
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
|
+
import { NodeType } from "@avaprotocol/types";
|
|
4
|
+
class ContractReadNode extends Node {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super({ ...props, type: NodeType.ContractRead, data: props.data });
|
|
7
|
+
}
|
|
8
|
+
static fromResponse(raw) {
|
|
9
|
+
// Convert the raw object to ContractReadNodeProps, which should keep name and id
|
|
10
|
+
const obj = raw.toObject();
|
|
11
|
+
return new ContractReadNode({
|
|
12
|
+
...obj,
|
|
13
|
+
type: NodeType.ContractRead,
|
|
14
|
+
data: raw.getContractRead().toObject(),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
toRequest() {
|
|
18
|
+
const request = new avs_pb.TaskNode();
|
|
19
|
+
request.setId(this.id);
|
|
20
|
+
request.setName(this.name);
|
|
21
|
+
const nodeData = new avs_pb.ContractReadNode();
|
|
22
|
+
if (this.data.config) {
|
|
23
|
+
const config = new avs_pb.ContractReadNode.Config();
|
|
24
|
+
config.setContractAddress(this.data.config.contractAddress);
|
|
25
|
+
config.setCallData(this.data.config.callData);
|
|
26
|
+
config.setContractAbi(this.data.config.contractAbi);
|
|
27
|
+
nodeData.setConfig(config);
|
|
28
|
+
}
|
|
29
|
+
request.setContractRead(nodeData);
|
|
30
|
+
return request;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export default ContractReadNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodeProps } from "./interface";
|
|
2
|
+
import Node from "./interface";
|
|
3
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
4
|
+
export type ContractWriteNodeData = avs_pb.ContractWriteNode.Config.AsObject;
|
|
5
|
+
export type ContractWriteNodeProps = NodeProps & {
|
|
6
|
+
data: ContractWriteNodeData;
|
|
7
|
+
};
|
|
8
|
+
declare class ContractWriteNode extends Node {
|
|
9
|
+
constructor(props: ContractWriteNodeProps);
|
|
10
|
+
static fromResponse(raw: avs_pb.TaskNode): ContractWriteNode;
|
|
11
|
+
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
}
|
|
13
|
+
export default ContractWriteNode;
|
|
14
|
+
//# sourceMappingURL=contractWrite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contractWrite.d.ts","sourceRoot":"","sources":["../../../src/models/node/contractWrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAIhD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC;AAC7E,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG;IAC/C,IAAI,EAAE,qBAAqB,CAAC;CAC7B,CAAC;AAEF,cAAM,iBAAkB,SAAQ,IAAI;gBACtB,KAAK,EAAE,sBAAsB;IAIzC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,iBAAiB;IAU5D,SAAS,IAAI,MAAM,CAAC,QAAQ;CAkB7B;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Node from "./interface";
|
|
2
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
|
+
import { NodeType } from "@avaprotocol/types";
|
|
4
|
+
class ContractWriteNode extends Node {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super({ ...props, type: NodeType.ContractWrite, data: props.data });
|
|
7
|
+
}
|
|
8
|
+
static fromResponse(raw) {
|
|
9
|
+
// Convert the raw object to ContractWriteNodeProps, which should keep name and id
|
|
10
|
+
const obj = raw.toObject();
|
|
11
|
+
return new ContractWriteNode({
|
|
12
|
+
...obj,
|
|
13
|
+
type: NodeType.ContractWrite,
|
|
14
|
+
data: raw.getContractWrite().getConfig().toObject(),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
toRequest() {
|
|
18
|
+
const request = new avs_pb.TaskNode();
|
|
19
|
+
request.setId(this.id);
|
|
20
|
+
request.setName(this.name);
|
|
21
|
+
const nodeData = new avs_pb.ContractWriteNode();
|
|
22
|
+
const config = new avs_pb.ContractWriteNode.Config();
|
|
23
|
+
config.setContractAddress(this.data.contractAddress);
|
|
24
|
+
config.setCallData(this.data.callData);
|
|
25
|
+
config.setContractAbi(this.data.contractAbi);
|
|
26
|
+
nodeData.setConfig(config);
|
|
27
|
+
request.setContractWrite(nodeData);
|
|
28
|
+
return request;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export default ContractWriteNode;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NodeProps } from "./interface";
|
|
2
|
+
import Node from "./interface";
|
|
3
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
4
|
+
export type CustomCodeNodeData = avs_pb.CustomCodeNode.AsObject;
|
|
5
|
+
export declare const CustomCodeLangs: {
|
|
6
|
+
JAVASCRIPT: number;
|
|
7
|
+
PYTHON: number;
|
|
8
|
+
};
|
|
9
|
+
export type CustomCodeNodeProps = NodeProps & {
|
|
10
|
+
data: CustomCodeNodeData;
|
|
11
|
+
};
|
|
12
|
+
declare class CustomCodeNode extends Node {
|
|
13
|
+
constructor(props: CustomCodeNodeProps);
|
|
14
|
+
static fromResponse(raw: avs_pb.TaskNode): CustomCodeNode;
|
|
15
|
+
toRequest(): avs_pb.TaskNode;
|
|
16
|
+
}
|
|
17
|
+
export default CustomCodeNode;
|
|
18
|
+
//# sourceMappingURL=customCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customCode.d.ts","sourceRoot":"","sources":["../../../src/models/node/customCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAIhD,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC;AAChE,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG;IAC5C,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEF,cAAM,cAAe,SAAQ,IAAI;gBACnB,KAAK,EAAE,mBAAmB;IAItC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,cAAc;IAUzD,SAAS,IAAI,MAAM,CAAC,QAAQ;CAmB7B;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Node from "./interface";
|
|
2
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
|
+
import { NodeType } from "@avaprotocol/types";
|
|
4
|
+
export const CustomCodeLangs = {
|
|
5
|
+
JAVASCRIPT: 0,
|
|
6
|
+
PYTHON: 1
|
|
7
|
+
};
|
|
8
|
+
class CustomCodeNode extends Node {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
super({ ...props, type: NodeType.CustomCode, data: props.data });
|
|
11
|
+
}
|
|
12
|
+
static fromResponse(raw) {
|
|
13
|
+
// Convert the raw object to CustomCodeNodeProps, which should keep name and id
|
|
14
|
+
const obj = raw.toObject();
|
|
15
|
+
return new CustomCodeNode({
|
|
16
|
+
...obj,
|
|
17
|
+
type: NodeType.CustomCode,
|
|
18
|
+
data: raw.getCustomCode().toObject(),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
toRequest() {
|
|
22
|
+
const request = new avs_pb.TaskNode();
|
|
23
|
+
request.setId(this.id);
|
|
24
|
+
request.setName(this.name);
|
|
25
|
+
const nodeData = new avs_pb.CustomCodeNode();
|
|
26
|
+
if (this.data.config) {
|
|
27
|
+
const config = new avs_pb.CustomCodeNode.Config();
|
|
28
|
+
config.setLang(this.data.config.lang);
|
|
29
|
+
config.setSource(this.data.config.source);
|
|
30
|
+
nodeData.setConfig(config);
|
|
31
|
+
}
|
|
32
|
+
request.setCustomCode(nodeData);
|
|
33
|
+
return request;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export default CustomCodeNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodeProps } from "./interface";
|
|
2
|
+
import Node from "./interface";
|
|
3
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
4
|
+
export type ETHTransferNodeData = avs_pb.ETHTransferNode.Config.AsObject;
|
|
5
|
+
export type ETHTransferNodeProps = NodeProps & {
|
|
6
|
+
data: ETHTransferNodeData;
|
|
7
|
+
};
|
|
8
|
+
declare class ETHTransferNode extends Node {
|
|
9
|
+
constructor(props: ETHTransferNodeProps);
|
|
10
|
+
static fromResponse(raw: avs_pb.TaskNode): ETHTransferNode;
|
|
11
|
+
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
}
|
|
13
|
+
export default ETHTransferNode;
|
|
14
|
+
//# sourceMappingURL=ethTransfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ethTransfer.d.ts","sourceRoot":"","sources":["../../../src/models/node/ethTransfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAIhD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC;AACzE,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG;IAC7C,IAAI,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAEF,cAAM,eAAgB,SAAQ,IAAI;gBACpB,KAAK,EAAE,oBAAoB;IAIvC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,eAAe;IAU1D,SAAS,IAAI,MAAM,CAAC,QAAQ;CAiB7B;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Node from "./interface";
|
|
2
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
|
+
import { NodeType } from "@avaprotocol/types";
|
|
4
|
+
class ETHTransferNode extends Node {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super({ ...props, type: NodeType.ETHTransfer, data: props.data });
|
|
7
|
+
}
|
|
8
|
+
static fromResponse(raw) {
|
|
9
|
+
// Convert the raw object to ETHTransferNodeProps, which should keep name and id
|
|
10
|
+
const obj = raw.toObject();
|
|
11
|
+
return new ETHTransferNode({
|
|
12
|
+
...obj,
|
|
13
|
+
type: NodeType.ETHTransfer,
|
|
14
|
+
data: raw.getEthTransfer().getConfig().toObject(),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
toRequest() {
|
|
18
|
+
const request = new avs_pb.TaskNode();
|
|
19
|
+
request.setId(this.id);
|
|
20
|
+
request.setName(this.name);
|
|
21
|
+
const nodeData = new avs_pb.ETHTransferNode();
|
|
22
|
+
const config = new avs_pb.ETHTransferNode.Config();
|
|
23
|
+
config.setDestination(this.data.destination);
|
|
24
|
+
config.setAmount(this.data.amount);
|
|
25
|
+
nodeData.setConfig(config);
|
|
26
|
+
request.setEthTransfer(nodeData);
|
|
27
|
+
return request;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export default ETHTransferNode;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
+
import ContractWriteNode, { ContractWriteNodeData, ContractWriteNodeProps } from "./contractWrite";
|
|
3
|
+
import CustomCodeNode, { CustomCodeLangs, CustomCodeNodeData, CustomCodeNodeProps } from "./customCode";
|
|
4
|
+
import GraphQLQueryNode, { GraphQLQueryNodeData, GraphQLQueryNodeProps } from "./graphqlQuery";
|
|
5
|
+
import Node, { NodeProps } from "./interface";
|
|
6
|
+
import RestAPINode, { RestAPINodeData, RestAPINodeProps } from "./restApi";
|
|
7
|
+
import ContractReadNode, { ContractReadNodeData, ContractReadNodeProps } from "./contractRead";
|
|
8
|
+
import ETHTransferNode, { ETHTransferNodeData, ETHTransferNodeProps } from "./ethTransfer";
|
|
9
|
+
import BranchNode, { BranchNodeProps, BranchNodeData } from "./branch";
|
|
10
|
+
import FilterNode, { FilterNodeData, FilterNodeProps } from "./filter";
|
|
11
|
+
import LoopNode, { LoopNodeData, LoopNodeProps } from "./loop";
|
|
12
|
+
declare class NodeFactory {
|
|
13
|
+
static create(props: NodeProps): Node;
|
|
14
|
+
static createNodes(props: NodeProps[]): Node[];
|
|
15
|
+
static fromResponse(raw: avs_pb.TaskNode): Node;
|
|
16
|
+
}
|
|
17
|
+
export default NodeFactory;
|
|
18
|
+
export { Node, ContractWriteNode, ContractReadNode, BranchNode, ETHTransferNode, GraphQLQueryNode, RestAPINode, CustomCodeNode, CustomCodeLangs, FilterNode, LoopNode, };
|
|
19
|
+
export type { ContractWriteNodeData, ContractReadNodeData, BranchNodeData, ETHTransferNodeData, GraphQLQueryNodeData, RestAPINodeData, CustomCodeNodeData, FilterNodeData, LoopNodeData, };
|
|
20
|
+
export type { NodeProps, ContractWriteNodeProps, ContractReadNodeProps, BranchNodeProps, ETHTransferNodeProps, GraphQLQueryNodeProps, RestAPINodeProps, CustomCodeNodeProps, FilterNodeProps, LoopNodeProps, };
|
|
21
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/models/node/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,OAAO,iBAAiB,EAAE,EACxB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,cAAc,EAAE,EACrB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,gBAAgB,EAAE,EACvB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,WAAW,EAAE,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,gBAAgB,EAAE,EACvB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,eAAe,EAAE,EACtB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,UAAU,EAAE,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,UAAU,EAAE,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,QAAQ,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAG/D,cAAM,WAAW;IACf,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IA2BrC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE;IAI9C,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI;CAwBhD;AAED,eAAe,WAAW,CAAC;AAG3B,OAAO,EACL,IAAI,EACJ,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,eAAe,EACf,UAAU,EACV,QAAQ,GACT,CAAC;AAGF,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,YAAY,GACb,CAAC;AAGF,YAAY,EACV,SAAS,EACT,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,aAAa,GACd,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import ContractWriteNode from "./contractWrite";
|
|
3
|
+
import CustomCodeNode, { CustomCodeLangs, } from "./customCode";
|
|
4
|
+
import GraphQLQueryNode from "./graphqlQuery";
|
|
5
|
+
import Node from "./interface";
|
|
6
|
+
import RestAPINode from "./restApi";
|
|
7
|
+
import ContractReadNode from "./contractRead";
|
|
8
|
+
import ETHTransferNode from "./ethTransfer";
|
|
9
|
+
import BranchNode from "./branch";
|
|
10
|
+
import FilterNode from "./filter";
|
|
11
|
+
import LoopNode from "./loop";
|
|
12
|
+
import { NodeType } from "@avaprotocol/types";
|
|
13
|
+
class NodeFactory {
|
|
14
|
+
static create(props) {
|
|
15
|
+
switch (props.type) {
|
|
16
|
+
case NodeType.ContractWrite:
|
|
17
|
+
return new ContractWriteNode(props);
|
|
18
|
+
case NodeType.RestAPI:
|
|
19
|
+
return new RestAPINode(props);
|
|
20
|
+
case NodeType.CustomCode:
|
|
21
|
+
return new CustomCodeNode(props);
|
|
22
|
+
case NodeType.ContractRead:
|
|
23
|
+
return new ContractReadNode(props);
|
|
24
|
+
case NodeType.ETHTransfer:
|
|
25
|
+
return new ETHTransferNode(props);
|
|
26
|
+
case NodeType.GraphQLQuery:
|
|
27
|
+
return new GraphQLQueryNode(props);
|
|
28
|
+
case NodeType.Branch:
|
|
29
|
+
return new BranchNode(props);
|
|
30
|
+
case NodeType.Filter:
|
|
31
|
+
return new FilterNode(props);
|
|
32
|
+
case NodeType.Loop:
|
|
33
|
+
return new LoopNode(props);
|
|
34
|
+
case NodeType.Unset:
|
|
35
|
+
throw new Error("Cannot create node with unset type");
|
|
36
|
+
default:
|
|
37
|
+
throw new Error(`Unsupported node type: ${props.type}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
static createNodes(props) {
|
|
41
|
+
return _.map(props, (node) => this.create(node));
|
|
42
|
+
}
|
|
43
|
+
static fromResponse(raw) {
|
|
44
|
+
switch (true) {
|
|
45
|
+
case !!raw.getEthTransfer():
|
|
46
|
+
return ETHTransferNode.fromResponse(raw);
|
|
47
|
+
case !!raw.getContractRead():
|
|
48
|
+
return ContractReadNode.fromResponse(raw);
|
|
49
|
+
case !!raw.getContractWrite():
|
|
50
|
+
return ContractWriteNode.fromResponse(raw);
|
|
51
|
+
case !!raw.getGraphqlQuery():
|
|
52
|
+
return GraphQLQueryNode.fromResponse(raw);
|
|
53
|
+
case !!raw.getRestApi():
|
|
54
|
+
return RestAPINode.fromResponse(raw);
|
|
55
|
+
case !!raw.getCustomCode():
|
|
56
|
+
return CustomCodeNode.fromResponse(raw);
|
|
57
|
+
case !!raw.getBranch():
|
|
58
|
+
return BranchNode.fromResponse(raw);
|
|
59
|
+
case !!raw.getFilter():
|
|
60
|
+
return FilterNode.fromResponse(raw);
|
|
61
|
+
case !!raw.getLoop():
|
|
62
|
+
return LoopNode.fromResponse(raw);
|
|
63
|
+
default:
|
|
64
|
+
throw new Error(`Unsupported node type: ${raw.getName()}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export default NodeFactory;
|
|
69
|
+
// Node object definitions
|
|
70
|
+
export { Node, ContractWriteNode, ContractReadNode, BranchNode, ETHTransferNode, GraphQLQueryNode, RestAPINode, CustomCodeNode, CustomCodeLangs, FilterNode, LoopNode, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodeProps } from "./interface";
|
|
2
|
+
import Node from "./interface";
|
|
3
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
4
|
+
export type FilterNodeData = avs_pb.FilterNode.AsObject;
|
|
5
|
+
export type FilterNodeProps = NodeProps & {
|
|
6
|
+
data: FilterNodeData;
|
|
7
|
+
};
|
|
8
|
+
declare class FilterNode extends Node {
|
|
9
|
+
constructor(props: FilterNodeProps);
|
|
10
|
+
static fromResponse(raw: avs_pb.TaskNode): FilterNode;
|
|
11
|
+
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
}
|
|
13
|
+
export default FilterNode;
|
|
14
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/models/node/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAIhD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;AACxD,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG;IACxC,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF,cAAM,UAAW,SAAQ,IAAI;gBACf,KAAK,EAAE,eAAe;IAIlC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,UAAU;IAUrD,SAAS,IAAI,MAAM,CAAC,QAAQ;CAkB7B;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Node from "./interface";
|
|
2
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
|
+
import { NodeType } from "@avaprotocol/types";
|
|
4
|
+
class FilterNode extends Node {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super({ ...props, type: NodeType.Filter, data: props.data });
|
|
7
|
+
}
|
|
8
|
+
static fromResponse(raw) {
|
|
9
|
+
// Convert the raw object to FilterNodeProps, which should keep name and id
|
|
10
|
+
const obj = raw.toObject();
|
|
11
|
+
return new FilterNode({
|
|
12
|
+
...obj,
|
|
13
|
+
type: NodeType.Filter,
|
|
14
|
+
data: raw.getFilter().toObject(),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
toRequest() {
|
|
18
|
+
const request = new avs_pb.TaskNode();
|
|
19
|
+
request.setId(this.id);
|
|
20
|
+
request.setName(this.name);
|
|
21
|
+
const nodeData = new avs_pb.FilterNode();
|
|
22
|
+
if (this.data.config) {
|
|
23
|
+
const config = new avs_pb.FilterNode.Config();
|
|
24
|
+
config.setExpression(this.data.config.expression);
|
|
25
|
+
config.setSourceId(this.data.config.sourceId || '');
|
|
26
|
+
nodeData.setConfig(config);
|
|
27
|
+
}
|
|
28
|
+
request.setFilter(nodeData);
|
|
29
|
+
return request;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export default FilterNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodeProps } from "./interface";
|
|
2
|
+
import Node from "./interface";
|
|
3
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
4
|
+
export type GraphQLQueryNodeData = avs_pb.GraphQLQueryNode.AsObject;
|
|
5
|
+
export type GraphQLQueryNodeProps = NodeProps & {
|
|
6
|
+
data: GraphQLQueryNodeData;
|
|
7
|
+
};
|
|
8
|
+
declare class GraphQLQueryNode extends Node {
|
|
9
|
+
constructor(props: GraphQLQueryNodeProps);
|
|
10
|
+
static fromResponse(raw: avs_pb.TaskNode): GraphQLQueryNode;
|
|
11
|
+
toRequest(): avs_pb.TaskNode;
|
|
12
|
+
}
|
|
13
|
+
export default GraphQLQueryNode;
|
|
14
|
+
//# sourceMappingURL=graphqlQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphqlQuery.d.ts","sourceRoot":"","sources":["../../../src/models/node/graphqlQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAIhD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC;AACpE,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG;IAC9C,IAAI,EAAE,oBAAoB,CAAC;CAC5B,CAAC;AAEF,cAAM,gBAAiB,SAAQ,IAAI;gBACrB,KAAK,EAAE,qBAAqB;IAQxC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,GAAG,gBAAgB;IAU3D,SAAS,IAAI,MAAM,CAAC,QAAQ;CA4B7B;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Node from "./interface";
|
|
2
|
+
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
3
|
+
import { NodeType } from "@avaprotocol/types";
|
|
4
|
+
class GraphQLQueryNode extends Node {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
super({
|
|
7
|
+
...props,
|
|
8
|
+
type: NodeType.GraphQLQuery,
|
|
9
|
+
data: props.data,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
static fromResponse(raw) {
|
|
13
|
+
// Convert the raw object to GraphQLQueryNodeProps, which should keep name and id
|
|
14
|
+
const obj = raw.toObject();
|
|
15
|
+
return new GraphQLQueryNode({
|
|
16
|
+
...obj,
|
|
17
|
+
type: NodeType.GraphQLQuery,
|
|
18
|
+
data: raw.getGraphqlQuery().toObject(),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
toRequest() {
|
|
22
|
+
const request = new avs_pb.TaskNode();
|
|
23
|
+
request.setId(this.id);
|
|
24
|
+
request.setName(this.name);
|
|
25
|
+
const nodeData = new avs_pb.GraphQLQueryNode();
|
|
26
|
+
if (this.data.config) {
|
|
27
|
+
const config = new avs_pb.GraphQLQueryNode.Config();
|
|
28
|
+
config.setUrl(this.data.config.url);
|
|
29
|
+
config.setQuery(this.data.config.query);
|
|
30
|
+
if (this.data.config.variablesMap &&
|
|
31
|
+
this.data.config.variablesMap.length > 0) {
|
|
32
|
+
const variablesMap = config.getVariablesMap();
|
|
33
|
+
this.data.config.variablesMap.forEach(([key, value]) => {
|
|
34
|
+
variablesMap.set(key, value);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
nodeData.setConfig(config);
|
|
38
|
+
}
|
|
39
|
+
request.setGraphqlQuery(nodeData);
|
|
40
|
+
return request;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export default GraphQLQueryNode;
|