@avaprotocol/sdk-js 1.7.0 → 1.7.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.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16219 -740
- package/dist/index.mjs +47 -100
- package/dist/models/trigger/block.d.ts.map +1 -1
- package/dist/models/trigger/block.js +1 -0
- package/dist/models/trigger/cron.d.ts.map +1 -1
- package/dist/models/trigger/cron.js +1 -0
- package/dist/models/trigger/event.d.ts.map +1 -1
- package/dist/models/trigger/event.js +1 -0
- package/dist/models/trigger/fixedTime.d.ts.map +1 -1
- package/dist/models/trigger/fixedTime.js +1 -0
- package/dist/models/trigger/manual.d.ts.map +1 -1
- package/dist/models/trigger/manual.js +1 -0
- package/package.json +2 -2
- package/dist/auth.d.ts +0 -2
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -10
- package/dist/config.d.ts +0 -9
- package/dist/grpc_codegen/custom_types.d.ts +0 -45
- package/dist/grpc_codegen/custom_types.d.ts.map +0 -1
- package/dist/grpc_codegen/custom_types.js +0 -179
- package/dist/models/edge.d.ts +0 -12
- package/dist/models/execution.d.ts +0 -24
- package/dist/models/node/branch.d.ts +0 -15
- package/dist/models/node/contractRead.d.ts +0 -15
- package/dist/models/node/contractWrite.d.ts +0 -15
- package/dist/models/node/customCode.d.ts +0 -15
- package/dist/models/node/ethTransfer.d.ts +0 -15
- package/dist/models/node/factory.d.ts +0 -23
- package/dist/models/node/filter.d.ts +0 -15
- package/dist/models/node/graphqlQuery.d.ts +0 -15
- package/dist/models/node/interface.d.ts +0 -25
- package/dist/models/node/loop.d.ts +0 -14
- package/dist/models/node/restApi.d.ts +0 -15
- package/dist/models/secret.d.ts +0 -16
- package/dist/models/step.d.ts +0 -21
- package/dist/models/trigger/block.d.ts +0 -25
- package/dist/models/trigger/cron.d.ts +0 -26
- package/dist/models/trigger/event.d.ts +0 -25
- package/dist/models/trigger/factory.d.ts +0 -26
- package/dist/models/trigger/fixedTime.d.ts +0 -26
- package/dist/models/trigger/interface.d.ts +0 -25
- package/dist/models/trigger/manual.d.ts +0 -26
- package/dist/models/trigger/reason.d.ts +0 -33
- package/dist/models/trigger/reason.d.ts.map +0 -1
- package/dist/models/trigger/reason.js +0 -96
- package/dist/models/workflow.d.ts +0 -54
- package/dist/utils.d.ts +0 -60
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import { TriggerType } from "@avaprotocol/types";
|
|
3
|
-
export type TriggerReasonProps = {
|
|
4
|
-
type: TriggerType.FixedTime;
|
|
5
|
-
epoch: number;
|
|
6
|
-
} | {
|
|
7
|
-
type: TriggerType.Cron;
|
|
8
|
-
epoch: number;
|
|
9
|
-
} | {
|
|
10
|
-
type: TriggerType.Block;
|
|
11
|
-
blockNumber: number;
|
|
12
|
-
} | {
|
|
13
|
-
type: TriggerType.Event;
|
|
14
|
-
blockNumber: number;
|
|
15
|
-
logIndex: number;
|
|
16
|
-
txHash: string;
|
|
17
|
-
} | {
|
|
18
|
-
type: TriggerType.Manual;
|
|
19
|
-
} | {
|
|
20
|
-
type: TriggerType.Unspecified;
|
|
21
|
-
};
|
|
22
|
-
declare class TriggerReason {
|
|
23
|
-
type: TriggerType;
|
|
24
|
-
blockNumber?: number;
|
|
25
|
-
epoch?: number;
|
|
26
|
-
logIndex?: number;
|
|
27
|
-
txHash?: string;
|
|
28
|
-
constructor(props: TriggerReasonProps);
|
|
29
|
-
static fromResponse(data: avs_pb.TriggerReason | undefined): TriggerReason | undefined;
|
|
30
|
-
toRequest(): avs_pb.TriggerReason;
|
|
31
|
-
}
|
|
32
|
-
export default TriggerReason;
|
|
33
|
-
//# sourceMappingURL=reason.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reason.d.ts","sourceRoot":"","sources":["../../../src/models/trigger/reason.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,WAAW,CAAC,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAChD;IACE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,GACD;IAAE,IAAI,EAAE,WAAW,CAAC,MAAM,CAAA;CAAE,GAC5B;IAAE,IAAI,EAAE,WAAW,CAAC,WAAW,CAAA;CAAE,CAAC;AAoBtC,cAAM,aAAa;IACjB,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;gBAEJ,KAAK,EAAE,kBAAkB;IAyBrC,MAAM,CAAC,YAAY,CACjB,IAAI,EAAE,MAAM,CAAC,aAAa,GAAG,SAAS,GACrC,aAAa,GAAG,SAAS;IAc5B,SAAS,IAAI,MAAM,CAAC,aAAa;CA8ClC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import { TriggerType } from "@avaprotocol/types";
|
|
3
|
-
// Convert the number values of gRPC TriggerType to string values of TriggerType
|
|
4
|
-
const convertTriggerType = (grpcType) => {
|
|
5
|
-
const conversionMap = {
|
|
6
|
-
[avs_pb.TriggerType.TRIGGER_TYPE_FIXED_TIME]: TriggerType.FixedTime,
|
|
7
|
-
[avs_pb.TriggerType.TRIGGER_TYPE_CRON]: TriggerType.Cron,
|
|
8
|
-
[avs_pb.TriggerType.TRIGGER_TYPE_BLOCK]: TriggerType.Block,
|
|
9
|
-
[avs_pb.TriggerType.TRIGGER_TYPE_EVENT]: TriggerType.Event,
|
|
10
|
-
[avs_pb.TriggerType.TRIGGER_TYPE_MANUAL]: TriggerType.Manual,
|
|
11
|
-
[avs_pb.TriggerType.TRIGGER_TYPE_UNSPECIFIED]: TriggerType.Unspecified,
|
|
12
|
-
};
|
|
13
|
-
return conversionMap[grpcType];
|
|
14
|
-
};
|
|
15
|
-
class TriggerReason {
|
|
16
|
-
constructor(props) {
|
|
17
|
-
this.type = props.type;
|
|
18
|
-
// Configure reason based on trigger type
|
|
19
|
-
switch (props.type) {
|
|
20
|
-
case TriggerType.FixedTime:
|
|
21
|
-
case TriggerType.Cron:
|
|
22
|
-
this.epoch = props.epoch;
|
|
23
|
-
break;
|
|
24
|
-
case TriggerType.Block:
|
|
25
|
-
this.blockNumber = props.blockNumber;
|
|
26
|
-
break;
|
|
27
|
-
case TriggerType.Event:
|
|
28
|
-
this.blockNumber = props.blockNumber;
|
|
29
|
-
this.logIndex = props.logIndex;
|
|
30
|
-
this.txHash = props.txHash;
|
|
31
|
-
break;
|
|
32
|
-
case TriggerType.Manual:
|
|
33
|
-
case TriggerType.Unspecified:
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
throw new Error("Unsupported trigger type");
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
static fromResponse(data) {
|
|
40
|
-
if (!data) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
return new TriggerReason({
|
|
44
|
-
type: convertTriggerType(data.getType()),
|
|
45
|
-
blockNumber: data.getBlockNumber(),
|
|
46
|
-
epoch: data.getEpoch(),
|
|
47
|
-
logIndex: data.getLogIndex(),
|
|
48
|
-
txHash: data.getTxHash(),
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
toRequest() {
|
|
52
|
-
const request = new avs_pb.TriggerReason();
|
|
53
|
-
switch (this.type) {
|
|
54
|
-
case TriggerType.FixedTime:
|
|
55
|
-
request.setType(avs_pb.TriggerType.TRIGGER_TYPE_FIXED_TIME);
|
|
56
|
-
if (this.epoch) {
|
|
57
|
-
request.setEpoch(this.epoch);
|
|
58
|
-
}
|
|
59
|
-
break;
|
|
60
|
-
case TriggerType.Cron:
|
|
61
|
-
request.setType(avs_pb.TriggerType.TRIGGER_TYPE_CRON);
|
|
62
|
-
if (this.epoch) {
|
|
63
|
-
request.setEpoch(this.epoch);
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
case TriggerType.Block:
|
|
67
|
-
request.setType(avs_pb.TriggerType.TRIGGER_TYPE_BLOCK);
|
|
68
|
-
if (this.blockNumber) {
|
|
69
|
-
request.setBlockNumber(this.blockNumber);
|
|
70
|
-
}
|
|
71
|
-
break;
|
|
72
|
-
case TriggerType.Event:
|
|
73
|
-
request.setType(avs_pb.TriggerType.TRIGGER_TYPE_EVENT);
|
|
74
|
-
if (this.blockNumber) {
|
|
75
|
-
request.setBlockNumber(this.blockNumber);
|
|
76
|
-
}
|
|
77
|
-
if (this.logIndex) {
|
|
78
|
-
request.setLogIndex(this.logIndex);
|
|
79
|
-
}
|
|
80
|
-
if (this.txHash) {
|
|
81
|
-
request.setTxHash(this.txHash);
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
case TriggerType.Manual:
|
|
85
|
-
request.setType(avs_pb.TriggerType.TRIGGER_TYPE_MANUAL);
|
|
86
|
-
break;
|
|
87
|
-
case TriggerType.Unspecified:
|
|
88
|
-
request.setType(avs_pb.TriggerType.TRIGGER_TYPE_UNSPECIFIED);
|
|
89
|
-
break;
|
|
90
|
-
default:
|
|
91
|
-
throw new Error("Unsupported trigger type");
|
|
92
|
-
}
|
|
93
|
-
return request;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export default TriggerReason;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import * as avs_pb from "@/grpc_codegen/avs_pb";
|
|
2
|
-
import Node from "./node/interface";
|
|
3
|
-
import Edge from "./edge";
|
|
4
|
-
import Trigger from "./trigger/interface";
|
|
5
|
-
export declare const DefaultExpiredAt = -1;
|
|
6
|
-
import { WorkflowStatus } from "@avaprotocol/types";
|
|
7
|
-
export declare function convertStatusToString(status: avs_pb.TaskStatus): WorkflowStatus;
|
|
8
|
-
export type WorkflowProps = Omit<avs_pb.Task.AsObject, "id" | "owner" | "completedAt" | "status" | "name" | "trigger" | "nodesList" | "edgesList" | "lastRanAt" | "executionCount"> & {
|
|
9
|
-
id?: string;
|
|
10
|
-
owner?: string;
|
|
11
|
-
completedAt?: number;
|
|
12
|
-
status?: WorkflowStatus;
|
|
13
|
-
name?: string;
|
|
14
|
-
trigger: Trigger;
|
|
15
|
-
nodes: Node[];
|
|
16
|
-
edges: Edge[];
|
|
17
|
-
lastRanAt?: number;
|
|
18
|
-
executionCount?: number;
|
|
19
|
-
};
|
|
20
|
-
declare class Workflow implements WorkflowProps {
|
|
21
|
-
smartWalletAddress: string;
|
|
22
|
-
trigger: Trigger;
|
|
23
|
-
nodes: Node[];
|
|
24
|
-
edges: Edge[];
|
|
25
|
-
startAt: number;
|
|
26
|
-
expiredAt: number;
|
|
27
|
-
maxExecution: number;
|
|
28
|
-
id?: string;
|
|
29
|
-
owner?: string;
|
|
30
|
-
name?: string;
|
|
31
|
-
completedAt?: number;
|
|
32
|
-
status?: WorkflowStatus;
|
|
33
|
-
lastRanAt?: number;
|
|
34
|
-
executionCount?: number;
|
|
35
|
-
/**
|
|
36
|
-
* Create an instance of Workflow from user inputs
|
|
37
|
-
* @param props
|
|
38
|
-
*/
|
|
39
|
-
constructor(props: WorkflowProps);
|
|
40
|
-
/**
|
|
41
|
-
* Create an instance of Workflow from AVS getWorkflow response
|
|
42
|
-
* @param res
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
static fromResponse(obj: avs_pb.Task): Workflow;
|
|
46
|
-
/**
|
|
47
|
-
* Create an instance of Workflow with only selected fields
|
|
48
|
-
* @param obj
|
|
49
|
-
*/
|
|
50
|
-
static fromListResponse(obj: avs_pb.Task): Workflow;
|
|
51
|
-
toRequest(): avs_pb.CreateTaskReq;
|
|
52
|
-
}
|
|
53
|
-
export default Workflow;
|
|
54
|
-
//# sourceMappingURL=workflow.d.ts.map
|
package/dist/utils.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Value as ProtobufValue } from "google-protobuf/google/protobuf/struct_pb";
|
|
2
|
-
/**
|
|
3
|
-
* Convert a protobuf Value to a JavaScript value
|
|
4
|
-
*
|
|
5
|
-
* **🏆 RECOMMENDED for modern protobuf usage**
|
|
6
|
-
*
|
|
7
|
-
* This is the primary implementation using proper TypeScript types and getKindCase()
|
|
8
|
-
* for the latest protobuf libraries. Use this for all new code.
|
|
9
|
-
*
|
|
10
|
-
* @param value - The protobuf Value to convert
|
|
11
|
-
* @returns The converted JavaScript value
|
|
12
|
-
*/
|
|
13
|
-
export declare function convertProtobufValueToJs(value?: ProtobufValue): any;
|
|
14
|
-
/**
|
|
15
|
-
* Convert a protobuf Value to a JavaScript value
|
|
16
|
-
*
|
|
17
|
-
* **⚠️ DEPRECATED - Use convertProtobufValueToJs() for new code**
|
|
18
|
-
*
|
|
19
|
-
* This is a legacy compatibility version for existing code that may use
|
|
20
|
-
* dynamically typed protobuf objects. It uses older has*() methods and
|
|
21
|
-
* fallback logic. Only use this if you need backward compatibility.
|
|
22
|
-
*
|
|
23
|
-
* @deprecated Use convertProtobufValueToJs() instead for better type safety
|
|
24
|
-
* @param value - The protobuf Value object (may be dynamically typed)
|
|
25
|
-
* @returns The converted JavaScript value
|
|
26
|
-
*/
|
|
27
|
-
export declare function convertProtobufValueToJS(value: any): any;
|
|
28
|
-
/**
|
|
29
|
-
* Convert a JavaScript value to a protobuf Value
|
|
30
|
-
*
|
|
31
|
-
* Uses proper TypeScript types for modern protobuf usage.
|
|
32
|
-
*
|
|
33
|
-
* @param value - The JavaScript value to convert
|
|
34
|
-
* @returns The protobuf Value object
|
|
35
|
-
*/
|
|
36
|
-
export declare function convertJSValueToProtobuf(value: any): ProtobufValue;
|
|
37
|
-
/**
|
|
38
|
-
* Convert protobuf trigger type string to SDK trigger type string
|
|
39
|
-
*
|
|
40
|
-
* @param protobufType - The protobuf trigger type string (e.g., "TRIGGER_TYPE_MANUAL")
|
|
41
|
-
* @returns The SDK trigger type string (e.g., "manualTrigger")
|
|
42
|
-
*/
|
|
43
|
-
export declare function convertProtobufTriggerTypeToSdk(protobufType: string): string;
|
|
44
|
-
/**
|
|
45
|
-
* Convert protobuf node type string to SDK node type string
|
|
46
|
-
*
|
|
47
|
-
* @param protobufType - The protobuf node type string (e.g., "NODE_TYPE_CUSTOM_CODE")
|
|
48
|
-
* @returns The SDK node type string (e.g., "customCode")
|
|
49
|
-
*/
|
|
50
|
-
export declare function convertProtobufNodeTypeToSdk(protobufType: string): string;
|
|
51
|
-
/**
|
|
52
|
-
* Convert protobuf step type string to SDK step type string
|
|
53
|
-
*
|
|
54
|
-
* Automatically detects whether the type is a trigger or node type and converts accordingly.
|
|
55
|
-
*
|
|
56
|
-
* @param protobufType - The protobuf type string (e.g., "TRIGGER_TYPE_MANUAL" or "NODE_TYPE_CUSTOM_CODE")
|
|
57
|
-
* @returns The SDK type string (e.g., "manualTrigger" or "customCode")
|
|
58
|
-
*/
|
|
59
|
-
export declare function convertProtobufStepTypeToSdk(protobufType: string): string;
|
|
60
|
-
//# sourceMappingURL=utils.d.ts.map
|