Skip to content

Commit

Permalink
Added cancel, delete and getTask tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisli30 committed Nov 5, 2024
1 parent 4ad79ca commit b47d3ef
Show file tree
Hide file tree
Showing 13 changed files with 1,125 additions and 314 deletions.
17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,6 @@ To ensure the SDK is functioning correctly, we have a comprehensive test suite.

This will execute all unit and integration tests. Make sure all tests pass before submitting a pull request or deploying changes.

## Version Management

This project uses [Changesets](https://github.com/changesets/changesets) to manage versions and changelogs. To contribute changes:

1. Make your changes to the codebase.
2. Run `npm run changeset` to create a new changeset.
3. Follow the prompts to describe your changes.
4. Commit the generated changeset file along with your changes.

To release a new version:

1. Run `npm run version` to update package versions and changelogs.
2. Review and commit the changes.
3. Run `npm run release` to publish the new version to npm.

For more detailed information on using Changesets, refer to the [Changesets documentation](https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md).

## Release Process

This repository uses a two-step workflow process for creating new releases:
Expand Down
130 changes: 84 additions & 46 deletions dist/index.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ declare namespace BranchAction {
}

declare class TaskAction extends jspb.Message {
getTaskType(): TaskType;
setTaskType(value: TaskType): TaskAction;
getTaskType(): TaskType$1;
setTaskType(value: TaskType$1): TaskAction;
getId(): string;
setId(value: string): TaskAction;
getName(): string;
Expand Down Expand Up @@ -527,7 +527,7 @@ declare class TaskAction extends jspb.Message {

declare namespace TaskAction {
export type AsObject = {
taskType: TaskType,
taskType: TaskType$1,
id: string,
name: string,
nextList: Array<string>,
Expand Down Expand Up @@ -566,53 +566,53 @@ declare namespace Execution {
}
}

declare class Task$1 extends jspb.Message {
declare class Task extends jspb.Message {

hasId(): boolean;
clearId(): void;
getId(): UUID | undefined;
setId(value?: UUID): Task$1;
setId(value?: UUID): Task;
getOwner(): string;
setOwner(value: string): Task$1;
setOwner(value: string): Task;
getSmartAccountAddress(): string;
setSmartAccountAddress(value: string): Task$1;
setSmartAccountAddress(value: string): Task;

hasTrigger(): boolean;
clearTrigger(): void;
getTrigger(): TaskTrigger | undefined;
setTrigger(value?: TaskTrigger): Task$1;
setTrigger(value?: TaskTrigger): Task;
clearNodesList(): void;
getNodesList(): Array<TaskAction>;
setNodesList(value: Array<TaskAction>): Task$1;
setNodesList(value: Array<TaskAction>): Task;
addNodes(value?: TaskAction, index?: number): TaskAction;
getStartAt(): number;
setStartAt(value: number): Task$1;
setStartAt(value: number): Task;
getExpiredAt(): number;
setExpiredAt(value: number): Task$1;
setExpiredAt(value: number): Task;
getMemo(): string;
setMemo(value: string): Task$1;
setMemo(value: string): Task;
getCompletedAt(): number;
setCompletedAt(value: number): Task$1;
setCompletedAt(value: number): Task;
getStatus(): TaskStatus;
setStatus(value: TaskStatus): Task$1;
setStatus(value: TaskStatus): Task;
getRepeatable(): boolean;
setRepeatable(value: boolean): Task$1;
setRepeatable(value: boolean): Task;
clearExecutionsList(): void;
getExecutionsList(): Array<Execution>;
setExecutionsList(value: Array<Execution>): Task$1;
setExecutionsList(value: Array<Execution>): Task;
addExecutions(value?: Execution, index?: number): Execution;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Task$1.AsObject;
static toObject(includeInstance: boolean, msg: Task$1): Task$1.AsObject;
toObject(includeInstance?: boolean): Task.AsObject;
static toObject(includeInstance: boolean, msg: Task): Task.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Task$1, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Task$1;
static deserializeBinaryFromReader(message: Task$1, reader: jspb.BinaryReader): Task$1;
static serializeBinaryToWriter(message: Task, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Task;
static deserializeBinaryFromReader(message: Task, reader: jspb.BinaryReader): Task;
}

declare namespace Task$1 {
declare namespace Task {
export type AsObject = {
id?: UUID.AsObject,
owner: string,
Expand Down Expand Up @@ -939,7 +939,7 @@ declare enum TriggerType {
EXPRESSIONTRIGGER = 2,
}

declare enum TaskType {
declare enum TaskType$1 {
ETHTRANSFERTASK = 0,
CONTRACTEXECUTIONTASK = 1,
GRAPHQLDATAQUERYTASK = 2,
Expand Down Expand Up @@ -1088,18 +1088,18 @@ interface IAggregatorClient {
): grpc.ClientUnaryCall;
getTask(
request: UUID,
callback: (error: grpc.ServiceError | null, response: Task$1) => void
callback: (error: grpc.ServiceError | null, response: Task) => void
): grpc.ClientUnaryCall;
getTask(
request: UUID,
metadata: grpc.Metadata,
callback: (error: grpc.ServiceError | null, response: Task$1) => void
callback: (error: grpc.ServiceError | null, response: Task) => void
): grpc.ClientUnaryCall;
getTask(
request: UUID,
metadata: grpc.Metadata,
options: Partial<grpc.CallOptions>,
callback: (error: grpc.ServiceError | null, response: Task$1) => void
callback: (error: grpc.ServiceError | null, response: Task) => void
): grpc.ClientUnaryCall;
cancelTask(
request: UUID,
Expand Down Expand Up @@ -1336,18 +1336,18 @@ declare class AggregatorClient extends grpc.Client implements IAggregatorClient
): grpc.ClientUnaryCall;
public getTask(
request: UUID,
callback: (error: grpc.ServiceError | null, response: Task$1) => void
callback: (error: grpc.ServiceError | null, response: Task) => void
): grpc.ClientUnaryCall;
public getTask(
request: UUID,
metadata: grpc.Metadata,
callback: (error: grpc.ServiceError | null, response: Task$1) => void
callback: (error: grpc.ServiceError | null, response: Task) => void
): grpc.ClientUnaryCall;
public getTask(
request: UUID,
metadata: grpc.Metadata,
options: Partial<grpc.CallOptions>,
callback: (error: grpc.ServiceError | null, response: Task$1) => void
callback: (error: grpc.ServiceError | null, response: Task) => void
): grpc.ClientUnaryCall;
public cancelTask(
request: UUID,
Expand Down Expand Up @@ -1466,30 +1466,58 @@ interface GetKeyResponse {
}
interface ClientOption {
endpoint: string;
jwtApiKey?: string;
}
interface Task {
interface TaskType {
id: string;
status: string;
result?: any;
error?: string;
owner: string;
smartAccountAddress: string;
trigger: {
triggerType: number;
schedule?: any;
contractQuery?: any;
expression: {
expression: string;
};
};
nodesList: Array<{
taskType: number;
id: string;
name: string;
nextList: any[];
ethTransfer?: any;
contractExecution: any;
graphqlDataQuery?: any;
httpDataQuery?: any;
customCode?: any;
branch?: any;
}>;
startAt: number;
expiredAt: number;
memo: string;
completedAt: number;
status: number;
repeatable: boolean;
executionsList: any[];
}
interface CreateTaskResponse {
id: string;
}
interface ListTasksResponse {
tasks: Task[];
tasks: {
id: string;
status: string;
}[];
}
interface CancelTaskResponse {
value: boolean;
}
interface DeleteTaskResponse {
value: boolean;
}
interface GetAddressesResponse {
owner: string;
smart_account_address: string;
}
interface TransactionResp {
hash: string;
}
interface BalanceResp {
balance: string;
}

declare class BaseClient {
readonly endpoint: string;
Expand All @@ -1510,11 +1538,21 @@ declare class Client extends BaseClient {
address: string;
tokenContract: string;
oracleContract: string;
}, { authKey }: {
authKey: string;
}): Promise<CreateTaskResponse>;
listTasks(address: string): Promise<ListTasksResponse>;
getTask(id: string): Promise<object>;
cancelTask(id: string): Promise<boolean>;
deleteTask(id: string): Promise<boolean>;
listTasks(address: string, { authKey }: {
authKey: string;
}): Promise<ListTasksResponse>;
getTask(id: string, { authKey }: {
authKey: string;
}): Promise<TaskType>;
cancelTask(id: string, { authKey }: {
authKey: string;
}): Promise<CancelTaskResponse>;
deleteTask(id: string, { authKey }: {
authKey: string;
}): Promise<DeleteTaskResponse>;
}

export { AUTH_KEY_HEADER, type BalanceResp, type ClientOption, type CreateTaskResponse, type Environment, type GetAddressesResponse, type GetKeyResponse, type ListTasksResponse, type RequestOptions, type Task, type TransactionResp, Client as default, getKeyRequestMessage };
export { AUTH_KEY_HEADER, type CancelTaskResponse, type ClientOption, type CreateTaskResponse, type DeleteTaskResponse, type Environment, type GetAddressesResponse, type GetKeyResponse, type ListTasksResponse, type RequestOptions, type TaskType, Client as default, getKeyRequestMessage };
Loading

0 comments on commit b47d3ef

Please sign in to comment.