busabase-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Busabase
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # busabase-sdk
2
+
3
+ Typed TypeScript / JavaScript SDK for the [Busabase](https://busabase.com) OpenAPI REST API. Talks to a local or remote `busabase server`, or to Busabase Cloud.
4
+
5
+ It's the programmatic sibling of [`busabase-cli`](../busabase-cli): same connection model (server root, optional API key, optional space), but shipped as an importable, fully-typed library instead of a command-line tool.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install busabase-sdk
11
+ # or: pnpm add busabase-sdk / yarn add busabase-sdk
12
+ ```
13
+
14
+ Requires Node.js ≥ 20. Ships ESM with bundled type declarations. `zod` and `@orpc/*` are the only runtime dependencies.
15
+
16
+ ## Quick start
17
+
18
+ ```ts
19
+ import { Busabase } from "busabase-sdk";
20
+
21
+ const bb = new Busabase({
22
+ baseUrl: "http://localhost:15419", // or omit for Busabase Cloud
23
+ apiKey: process.env.BUSABASE_API_KEY, // cloud only; a local OSS server is open
24
+ });
25
+
26
+ await bb.health(); // { status, timestamp }
27
+
28
+ const bases = await bb.bases.list();
29
+ const record = await bb.records.get({ recordId });
30
+ const cr = await bb.changeRequests.merge({ changeRequestId });
31
+ ```
32
+
33
+ Every constructor field is optional and falls back to an environment variable:
34
+
35
+ | Option | Env var | Default |
36
+ | --------- | -------------------- | -------------------------- |
37
+ | `baseUrl` | `BUSABASE_BASE_URL` | `https://busabase.com` |
38
+ | `apiKey` | `BUSABASE_API_KEY` | — (none; local is open) |
39
+ | `spaceId` | `BUSABASE_SPACE_ID` | token's default space |
40
+
41
+ `baseUrl` accepts either the server root (`http://host`) or the full API path (`http://host/api/v1`) — the `/api/v1` suffix is normalized away.
42
+
43
+ ## Two entry points
44
+
45
+ **`Busabase` class** — an ergonomic wrapper with namespaced methods (`bb.bases`, `bb.records`, `bb.changeRequests`, `bb.nodes`, `bb.views`, `bb.skills`, `bb.docs`, `bb.folders`, `bb.comments`, `bb.auditEvents`, `bb.attachments`, `bb.agent`, `bb.agentTasks`, `bb.search()`, `bb.health()`, `bb.me()`). Drop to `bb.client` for the raw oRPC client (e.g. `bb.client.system.meta()`).
46
+
47
+ **`createBusabaseClient(config?)`** — returns the raw, fully-typed [oRPC](https://orpc.unnoq.com) client directly, if you'd rather not wrap it in a class:
48
+
49
+ ```ts
50
+ import { createBusabaseClient } from "busabase-sdk";
51
+
52
+ const client = createBusabaseClient({ apiKey: "…" });
53
+ await client.records.search({ fieldSlug: "email", valueText: "a@b.com" });
54
+ ```
55
+
56
+ ## Types
57
+
58
+ Every View Object type is re-exported, so you can annotate your own code without depending on Busabase internals:
59
+
60
+ ```ts
61
+ import type { BaseVO, RecordVO, ChangeRequestVO } from "busabase-sdk";
62
+ ```
63
+
64
+ ## Build
65
+
66
+ ```bash
67
+ pnpm build # tsup → dist/index.js (+ index.d.ts)
68
+ pnpm typecheck # tsc --noEmit
69
+ ```
70
+
71
+ The build bundles the internal `busabase-contract` (oRPC contracts + VO types) straight into `dist`, so the published package has zero workspace dependencies.