import { UnitInfo } from './modules/ao/v0/types/UnitInfo.cjs'; import { DryRunResult } from './modules/ao/v0/types/DryRunResult.cjs'; import { Result as Result$1 } from './modules/ao/v0/types/Result.cjs'; import { HTTPResponse } from './modules/ao/v0/types/HTTPResponse.cjs'; type GetRequestOptions$3 = { query: { from?: string; to?: string; }; } & RequestInit; type GetResponse$2 = HTTPResponse.PaginatedResponse<{ Messages: any[]; Spawns: []; Output: any; }>; /** * This class is responsible for interacting with the following endpoints: * * - `{cu-url}/cron/{process-id}` * * Methods within this class provide HTTP-like APIs. */ declare class CronProcess { protected process_id: string; protected unit: Compute; constructor(unit: Compute, processId: string); /** * Make the following request(s): * ```text * GET {cu-url}/cron/{process-id} * GET {cu-url}/cron/{process-id}?from={timestamp}&to={timestamp} * ``` * @param options Options to pass to this request. * @returns The result of the request. * * @example * ```ts * const res = await new ComputeUnit() * .cron() * .process("1447") * .get({ query: { from: "1715039710324", to: "1715039720324" } }); * * // - end of example - * ``` */ get(options: GetRequestOptions$3): Promise; } /** * This class is responsible for interacting with the following endpoints: * * - `{cu-url}/cron/*` * * Methods within this class provide HTTP-like APIs. */ declare class Cron { protected unit: Compute; constructor(unit: Compute); /** * Get the object that interacts with the process with the given ID. * @param processId The process' ID. * @returns An object with HTTP-like APIs for interacting with the process. */ process(processId: string): CronProcess; } interface DryRun$1 { /** * Send a DryRun request to a process. * * @param options Options to pass to the request. */ post(options: PostOptions): Promise; } type PostOptions = { query: { "process-id": string; }; } & RequestInit; type PostResponse = DryRunResult; /** * This class is responsible for interacting with the following endpoints: * * - `{cu-url}/dry-run` * * Methods within this class provide HTTP-like APIs. */ declare abstract class AbstractDryRun implements DryRun$1 { protected compute_unit: Compute; constructor(computeUnit: Compute); abstract post(options: PostOptions): Promise; } declare class DryRun extends AbstractDryRun { /** * Make the following request(s): * ```text * GET {cu-url}/dry-run?process-id={process-id} * ```` * @param options (Optional) Options to pass to the request. * * @example * ```ts * const res = await new ComputeUnit() * .dryRun() * .process("1557") * .post({ query: "process-id": "1557" }); * * // - end of example - * ``` */ post(options: PostOptions): Promise; } type GetRequestOptions$2 = { query: { "process-id": string; }; } & RequestInit; type GetResponse$1 = Result$1; interface Message$1 { /** * Get the result of a message. * @param options Options to pass to the request. * @returns The result of the request. */ get(options: GetRequestOptions$2): Promise; } /** * This class is responsible for interacting with the following endpoints: * * - `{cu-url}/result/{message-id}` * * Methods within this class provide HTTP-like APIs. */ declare abstract class AbstractMessage implements Message$1 { protected message_id: string; protected compute_unit: Compute; constructor(computeUnit: Compute, messageId: string); abstract get(options: GetRequestOptions$2): Promise; } declare class Message extends AbstractMessage { /** * Make the following request(s): * ```text * GET {cu-url}/result/{message-id}?process-id={process-id} * ``` * @param options Options to pass to the request. * @returns The result of the request. * * @example * ```ts * const res = await new ComputeUnit() * .result() * .message("1447") * .get({ query: { "process-id": "1557" } }); * * // - end of example - * ``` * * @link [Example URL](https://cu68.ao-testnet.xyz/result/nmrwM1i0InBqpIUHyHVrnW4o9rIgKagCLx5CPev0CJQ?process-id=91rtZiRskK4sy4aIDir-waISHDUno3v1MwctlbMpAkg) */ get(options: GetRequestOptions$2): Promise; } interface Result { /** * Get the object that interacts with the message with the given ID. * @param messageId The message's ID. * @returns An object with HTTP-like APIs for interacting with the message. */ message(messageId: string): Message; } /** * This class is responsible for interacting with the following endpoints: * * - `{cu-url}/result/*` * * Methods within this class provide HTTP-like APIs. */ declare class Result implements Result { protected compute_unit: Compute; constructor(computeUnit: Compute); } interface Process$2 { /** * Get the results from the process. * @param options Options to pass to the request. * @returns The result of the request. */ get(options: GetRequestOptions$1): Promise; } type GetRequestOptions$1 = { query: { from?: string; limit?: string; sort?: "ASC" | "DESC"; to?: string; }; }; /** * @example * ```json * { * "pageInfo": { * "hasNextPage": true * }, * "edges": [ * { * "node": { * "Messages": [], * "Assignments": [], * "Spawns": [], * "Output": { * "prompt": "aos\u003E ", * "data": "{\"price\":40.24,\"currency_id\":\"wAR-TST\"}", * "print": true * } * }, * "cursor": "eyJ0aW1lc3RhbXAiOjE3MTUwNzk4MTM5ODIsIm9yZGluYXRlIjoiMTAwMTciLCJjcm9uIjpudWxsLCJzb3J0IjoiQVNDIn0=" * }, * { * "node": { * "Messages": [], * "Assignments": [], * "Spawns": [], * "Output": { * "prompt": "aos\u003E ", * "data": "{\"price\":40.38,\"currency_id\":\"wAR-TST\"}", * "print": true * } * }, * "cursor": "eyJ0aW1lc3RhbXAiOjE3MTUwNzk4NzM5MTUsIm9yZGluYXRlIjoiMTAwMTgiLCJjcm9uIjpudWxsLCJzb3J0IjoiQVNDIn0=" * } * ] * } * ``` */ type GetResponse = { pageInfo: { hasNextPage: boolean; }; edges: { cursor: string; node: Result$1; }[]; }; /** * This class is responsible for interacting with the following endpoints: * * - `{cu-url}/results/{process-id}` * * Methods within this class provide HTTP-like APIs. */ declare abstract class AbstractProcess implements Process$2 { protected compute_unit: Compute; protected process_id: string; constructor(computeUnit: Compute, processId: string); abstract get(options: GetRequestOptions$1): Promise; } declare class Process$1 extends AbstractProcess { /** * Make the following request(s): * ```text * GET {cu-url}/results/{process-id} * GET {cu-url}/results/{process-id}?from={timestamp}&to={timestamp}&limit={limit}&sort={"ASC"|"DESC"} * ``` * @returns The result of the request. * * @example * ```ts * const res = await new ComputeUnit() * .results() * .process("1447") * .get({ query: { from: "", to: "", sort: "ASC", limit: 25 } }); * * // - end of example - * ``` * * @link [Example URL](https://cu68.ao-testnet.xyz/results/91rtZiRskK4sy4aIDir-waISHDUno3v1MwctlbMpAkg) */ get(options: GetRequestOptions$1): Promise; } interface Results { /** * Get the object that interacts with the process with the given ID. * @param process The process' ID. * @returns An object with HTTP-like APIs for interacting with the process. */ process(processId: string): Process$1; } /** * This class is responsible for interacting with the following endpoints: * * - `{cu-url}/results/*` * * Methods within this class provide HTTP-like APIs. */ declare class Results implements Results { protected compute_unit: Compute; constructor(computeUnit: Compute); } type GetRequestOptions = { query: { /** If this is not provided, the Compute Unit will evaluate the process up to the most recent Message. */ to?: string; }; } & RequestInit; /** * This class is responsible for interacting with the following endpoints: * * - `{cu-url}/state/{process-id}` * * Methods within this class provide HTTP-like APIs. */ declare class Process { protected process_id: string; protected compute_unit: Compute; constructor(compute_unit: Compute, processId: string); /** * Make the following request(s): * ```text * GET {cu-url}/state/{process-id} * GET {cu-url}/state/{process-id}?to={timestamp} * ``` * @param options Options to pass to this request. * @returns The result of the request. * * @example * ```ts * const res = await new ComputeUnit() * .state() * .process("1447") * .get({ query: { "to": "1712967091755" } }); * * // - end of example - * ``` */ get(options: GetRequestOptions): Promise; } /** * This class is responsible for interacting with the following endpoints: * * - `{cu-url}/state/*` * * Methods within this class provide HTTP-like APIs. */ declare class State { protected unit: Compute; constructor(unit: Compute); /** * Get the object that interacts with the process with the given ID. * @param processId The process' ID. * @returns An object with HTTP-like APIs for interacting with the process. */ process(processId: string): Process; } /** * This class is responsible for interacting with Compute Unit API endpoints. * * For more information on this API's endpoints, see the following: * * - https://ao.g8way.io/#/spec > Compute (CU) */ declare class Compute { /** * The URL to this unit. Examples: * * - https://cu.ao-testnet.xyz * - https://cu68.ao-testnet.xyz */ protected cu_url: string; /** * @param cuUrl (Optional) The URL to this unit. Can be a Scheduler * Unit URL or a unit Router URL. * * Defaults to the following unit Router URL: * * https://su-router.ao-testnet.xyz. */ constructor(cuUrl?: string); /** * Make a `fetch` request using this unit's URL as the request's * base URL. * @param path The path to append to this unit's base URL. * @param requestInit (Optional) Options to pass to the `fetch` API. * @returns The result of the `fetch` call. */ fetch(path: string, requestInit?: RequestInit): Promise; /** * @returns See {@linkcode DryRun}. */ dryRun(): DryRun; /** * Make the following request(s): * * ```text * GET {cu-url} * ``` * * @returns The result of the request. * * @example * ```ts * const res = await new ComputeUnit().get(); * * // - end of example - * ``` */ get(): Promise; /** * @returns See {@linkcode Result}. */ result(): Result; /** * @returns See {@linkcode Results}. */ results(): Results; /** * @returns See {@linkcode Cron}. */ cron(): Cron; /** * @returns See {@linkcode State}. */ state(): State; } export { AbstractDryRun as A, Compute as C, DryRun$1 as D, GetResponse$1 as G, Message$1 as M, PostResponse as P, Result as R, State as S, GetResponse as a, Results as b, AbstractMessage as c, AbstractProcess as d, GetRequestOptions$1 as e, GetRequestOptions$3 as f, GetResponse$2 as g, CronProcess as h, Cron as i, PostOptions as j, DryRun as k, GetRequestOptions$2 as l, Message as m, Process$2 as n, Process$1 as o, GetRequestOptions as p, Process as q };