Skip to main content
Version: 0.1.22
Last Verified: 2025-01-27
Package: @hopx-ai/sdk on npm

Overview

Ready checks are utilities used in template building to verify that a template is ready before it’s considered complete.

Import

import {
    waitForPort,
    waitForUrl,
    waitForFile,
    waitForProcess,
    waitForCommand
} from '@hopx-ai/sdk';

Available Ready Checks

waitForPort

Wait for a port to be listening.
waitForPort(port: number, timeout?: number): ReadyCheck

waitForUrl

Wait for a URL to be accessible.
waitForUrl(url: string, timeout?: number): ReadyCheck

waitForFile

Wait for a file to exist.
waitForFile(path: string, timeout?: number): ReadyCheck

waitForProcess

Wait for a process to be running.
waitForProcess(processName: string, timeout?: number): ReadyCheck

waitForCommand

Wait for a command to succeed.
waitForCommand(command: string, timeout?: number): ReadyCheck

Example

import { Template, waitForPort } from '@hopx-ai/sdk';

const template = new Template()
    .fromNodeImage('20')
    .run('npm install express')
    .expose(3000)
    .startCmd('node server.js')
    .readyCheck(waitForPort(3000, 120000));

const result = await template.build();
console.log(`Template ready: ${result.templateId}`);

See Also

Next Steps

Now that you understand ready checks, explore: