Skip to content

JavaScript SDK

CURRENT · 2.3.0

@opencloud/js is the same-origin browser SDK for OpenCloud apps. Import the deployment-pinned singleton from the stable path:

js
import { opencloud, OpenCloudError } from "/_opencloud/sdk.js";

Do not install the package, fetch runtime config, construct a client, or import a versioned artifact. OpenCloud maps the stable module and /_opencloud/sdk.d.ts declarations to runtime.sdk.version for the active release.

Public surface

NamespaceMethods
versionOPEN_CLOUD_SDK_VERSION
appinfo()
authcurrentUser(), requireUser(), signInUrl()
data.table(name)list(), getById(), create(), createMany(), updateById(), deleteById()
filesupload(), info(), download(), save(), replace(), remove(), attach()
functionscall(), stream()
notificationsstatus(), subscribe(), unsubscribe()
realtimesubscribe(), publish()
telemetrysummary(), increment(), gauge()
clientdispose()

The methods return application values, opaque file metadata, typed errors, or a byte stream. Raw Response objects, REST paths, Storage buckets, Function auth modes, access tokens, and Realtime protocol envelopes are intentionally not public.

A complete small flow

js
import { opencloud } from "/_opencloud/sdk.js";

await opencloud.auth.requireUser();
const tasks = opencloud.data.table("tasks");
const task = await tasks.create({ title: "Review evidence" });

const { file } = await opencloud.files.attach({
  data: selectedFile,
  name: selectedFile.name,
  table: "task_files",
  values: { task_id: task.id },
});

const result = await opencloud.functions.call("summarize", {
  taskId: task.id,
  fileId: file.id,
});

Read Client and Auth, Data and Files, Functions, Realtime, Telemetry, Notifications, and Errors before using each capability.

Self-hosted infrastructure for agent-built applications.