Apps hooks

Hand-written shim. Generated CRUD hooks via ./apps.gen (`useListApps`, `useCreateApp`, `useRetrieveApp`, `useUpdateApp`, `useDeleteApp`, `useRestoreApp`). Hooks below cover the build/deploy mutations, the preview-session lifecycle, the live R2 file ops, version-scoped REST file ops, env vars, and the custom domain — none of which fit the manifest's standard CRUD kinds.

Usage

TSX
import Aeontel from "@aeontel/sdk";
import { AeontelProvider, useListApps } from "@aeontel/react";

const client = new Aeontel(import.meta.env.VITE_AEONTEL_API_KEY);

function App() {
  return (
    <AeontelProvider client={client}>
      <AppsList workspaceId="wsp_abc123" />
    </AeontelProvider>
  );
}

function AppsList({ workspaceId }: { workspaceId: string }) {
  const { data, isLoading } = useListApps({ workspace_id: workspaceId });
  if (isLoading) return <p>Loading…</p>;
  return (
    <ul>
      {data?.data.map((a) => (
        <li key={a.id}>{a.name}</li>
      ))}
    </ul>
  );
}

Hooks

useBuildApp composite

Trigger a build for an app version. Returns the freshly-created Build row (status "pending") — poll via useRetrieveBuild({ id: result.id }). Auto-invalidates build queries on success.

TypeScript
useBuildApp(options?: MutationOpts<Build, CreateBuildParams>)

Types: Build · CreateBuildParams

TypeScript
const build = useBuildApp();
build.mutate({ appVersionId: "appver_abc123" });

useCreateApp mutation

Create a new app.

TypeScript
useCreateApp(options?: MutationOpts<App, CreateAppParams>)

Types: App · CreateAppParams

useCreateAppVersionFile mutation

Create a file in a specific app version.

TypeScript
useCreateAppVersionFile(options?: MutationOpts<SuccessResponse, CreateAppVersionFileParams>)

Types: SuccessResponse · CreateAppVersionFileParams

useCreateDeploy mutation

Create a deploy from a specific build, or deploy an app's latest successful build. Use this when you have a buildId and want to ship a specific build; for "deploy this app's default version", use .

TypeScript
useCreateDeploy(options?: MutationOpts<Deploy, CreateDeployParams>)

Types: Deploy · CreateDeployParams

TypeScript
const deploy = useCreateDeploy();
deploy.mutate({ buildId: "bld_abc123" });

useDeleteApp mutation

Soft-delete an app.

TypeScript
useDeleteApp(options?: MutationOpts<SuccessResponse, string>)

Types: SuccessResponse

useDeleteAppEnvVar mutation

Delete an env var from an app's Pages project.

TypeScript
useDeleteAppEnvVar(options?: MutationOpts<SuccessResponse, { appId: string; name: string; }>)

Types: SuccessResponse

TypeScript
const del = useDeleteAppEnvVar();
del.mutate({ appId: "app_abc123", name: "API_URL" });

useDeleteAppVersionFile mutation

Delete a file from a specific app version.

TypeScript
useDeleteAppVersionFile(options?: MutationOpts<SuccessResponse, DeleteAppVersionFileParams>)

Types: SuccessResponse · DeleteAppVersionFileParams

useDeployApp composite

Deploy a build. Returns the freshly-created Deploy row (status "pending") — poll via useRetrieveDeploy({ id: result.id }). Auto-invalidates deploy queries on success.

TypeScript
useDeployApp(options?: MutationOpts<Deploy, DeployAppParams>)

Types: Deploy · DeployAppParams

TypeScript
const deploy = useDeployApp();
deploy.mutate({ id: "app_abc123", buildId: "bld_abc123" });

useGetAppDomainForApp query

Get the custom domain attached to an app (or null). Takes the app ID and reads apps.getDomain — different from the top-level useRetrieveAppDomain which takes a domain row ID.

Pass { refetchInterval: POLL_ACTIVE } to watch a pending row flip to active while the customer's CNAME is being verified.

TypeScript
useGetAppDomainForApp(id: string, options?: QueryOpts<AppDomain | null>)

Types: AppDomain

TypeScript
const { data } = useGetAppDomainForApp("app_abc123");

useGetAppPreview query

Poll the current state of a preview session. Pass refetchInterval for polling.

TypeScript
useGetAppPreview(sessionId: string | null | undefined, options?: QueryOpts<AppPreviewSession>)

Types: AppPreviewSession

TypeScript
const { data } = useGetAppPreview(sessionId, { refetchInterval: 2000 });

useKeepalivePreview composite

Heartbeat — keeps a preview session from being reaped.

TypeScript
useKeepalivePreview();
TypeScript
const keepalive = useKeepalivePreview();
keepalive.mutate({ sessionId: "appprv_abc" });

useListAppEnvVars query

Fetch env vars for an app's Pages project.

TypeScript
useListAppEnvVars(appId: string, options?: QueryOpts<{ data: EnvVar[]; }>)
TypeScript
const { data } = useListAppEnvVars("app_abc123");

useListApps query

List apps with pagination and optional filtering.

TypeScript
useListApps(params?: Omit<ListAppsParams, | > & { filter?: AppFilter; orderBy?: AppOrderBy[]; } & AppShorthands, options?: QueryOpts<Page<App>>)

Types: ListAppsParams · AppFilter · AppOrderBy · AppShorthands · Page · App

useListAppVersionFiles query

List files in a specific app version.

TypeScript
useListAppVersionFiles(appId: string, versionId: string, params?: { path?: string; }, options?: QueryOpts<AppFileListResponse>)

Types: AppFileListResponse

TypeScript
const { data } = useListAppVersionFiles("app_abc123", "appver_def456", {
  path: "src",
});

usePurgeApp composite

Permanently delete a soft-deleted app.

TypeScript
usePurgeApp(options?: MutationOpts<SuccessResponse, PurgeAppParams>)

Types: SuccessResponse · PurgeAppParams

useReadAppVersionFile composite

Read a file's content from a specific app version.

TypeScript
useReadAppVersionFile(versionId: string, path: string, options?: QueryOpts<AppFileContentResponse>)

Types: AppFileContentResponse

TypeScript
const { data } = useReadAppVersionFile("appver_abc123", "src/index.ts");

useRemoveAppDomain mutation

Detach the app's custom domain.

TypeScript
useRemoveAppDomain(options?: MutationOpts<SuccessResponse, RemoveAppDomainParams>)

Types: SuccessResponse · RemoveAppDomainParams

TypeScript
const remove = useRemoveAppDomain();
remove.mutate({ id: "app_abc123" });

useRestoreApp composite

Restore a soft-deleted app.

TypeScript
useRestoreApp(options?: MutationOpts<App, string>)

Types: App

useRetrieveApp query

Get a single app by ID.

TypeScript
useRetrieveApp(id: string, options?: QueryOpts<App>)

Types: App

useSetAppDomain composite

Attach (or replace) the app's custom domain. Invalidates the appKeys.domain(id) cache + the app detail so the overview shows the new URL.

TypeScript
useSetAppDomain(options?: MutationOpts<AppDomain, SetAppDomainParams>)

Types: AppDomain · SetAppDomainParams

TypeScript
const set = useSetAppDomain();
set.mutate({ id: "app_abc123", hostname: "app.acme.com" });

useSetAppEnvVar composite

Set (create or update) an env var on an app's Pages project.

TypeScript
useSetAppEnvVar(options?: MutationOpts<SuccessResponse, { appId: string; name: string; value: string; }>)

Types: SuccessResponse

TypeScript
const setVar = useSetAppEnvVar();
setVar.mutate({ appId: "app_abc123", name: "API_URL", value: "https://..." });

useStartAppPreview composite

Start (or wake) a live preview session for an app version. Returns the session row in hydrating status — poll useGetAppPreview until status === "ready" to get the URL.

TypeScript
useStartAppPreview(options?: MutationOpts<AppPreviewSession, { appVersionId: string; }>)

Types: AppPreviewSession

TypeScript
const start = useStartAppPreview();
start.mutate({ appVersionId: "appver_abc123" });

useStopAppPreview composite

Stop a preview session.

TypeScript
useStopAppPreview(options?: MutationOpts<SuccessResponse, { sessionId: string; }>)

Types: SuccessResponse

TypeScript
const stop = useStopAppPreview();
stop.mutate({ sessionId: "appprv_abc" });

useUpdateApp mutation

Update an app (name, description, handle, publicAccess, defaultVersionId, config).

TypeScript
useUpdateApp(options?: MutationOpts<App, UpdateAppParams>)

Types: App · UpdateAppParams

useUpdateAppVersionFile mutation

Update a file in a specific app version.

TypeScript
useUpdateAppVersionFile(options?: MutationOpts<SuccessResponse, UpdateAppVersionFileParams>)

Types: SuccessResponse · UpdateAppVersionFileParams