@biab-dev/sdk 0.1.0

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 Business In A Box
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,125 @@
1
+ # `@biab-dev/sdk`
2
+
3
+ **Alpha:** This package is in an **alpha** release. APIs and behavior may change without notice. It is **not** intended for production use yet—evaluate only in development, staging, or experiments.
4
+
5
+ Phase 4 scaffold for the Business In A Box developer SDK.
6
+
7
+ This package is the client-side half of the package architecture defined in:
8
+
9
+ - [Phase4.md](../Resources/NPM%20Package/Phase4.md)
10
+ - [Phase3.md](../Resources/NPM%20Package/Phase3.md)
11
+ - [Phase2.md](../Resources/NPM%20Package/Phase2.md)
12
+
13
+ ## Purpose
14
+
15
+ The SDK is intended to talk to package-facing host routes under:
16
+
17
+ ```txt
18
+ /api/package/v1
19
+ ```
20
+
21
+ The host app stays responsible for:
22
+
23
+ - WorkOS identity mapping
24
+ - organization and site ownership checks
25
+ - API key verification
26
+ - permission enforcement
27
+ - Drizzle persistence
28
+ - collection schema validation
29
+
30
+ The package is responsible for:
31
+
32
+ - typed contracts
33
+ - fetch transport
34
+ - developer ergonomics
35
+ - stable client abstractions
36
+
37
+ ## Current Surface
38
+
39
+ The scaffold currently provides:
40
+
41
+ - Zod contracts for collections, rows, assets, actions, and auth introspection
42
+ - a typed fetch client
43
+ - site-scoped resource helpers
44
+ - structured API errors
45
+
46
+ ## Example
47
+
48
+ ```ts
49
+ import { createBiabDevClient } from "@biab-dev/sdk";
50
+
51
+ const client = createBiabDevClient({
52
+ baseUrl: "https://host.example.com/api/package/v1",
53
+ apiKey: process.env.BIAB_API_KEY!,
54
+ });
55
+
56
+ const site = client.site("00000000-0000-0000-0000-000000000000");
57
+
58
+ await client.introspect();
59
+ await site.collections.list();
60
+ await site.collections.get("products");
61
+ await site.rows.query("products", {
62
+ filters: [{ fieldName: "title", operator: "contains", value: "chair" }],
63
+ limit: 10,
64
+ });
65
+ ```
66
+
67
+ ## Notes
68
+
69
+ - This package is scaffolded first; the host package routes still need to be implemented.
70
+ - Collection contracts intentionally mirror the current BIAB `site_data_*` model instead of inventing a second schema system.
71
+
72
+ ## Publishing to npm
73
+
74
+ Scoped packages like `@biab-dev/sdk` only publish if the **`@biab-dev` scope exists on npm** and your user is allowed to publish to it. If you skip this, `npm publish` fails with **`404 Scope not found`** / `PUT .../@biab-dev%2fsdk`.
75
+
76
+ ### 1. Create the npm org (required once)
77
+
78
+ 1. Open **[npmjs.com → Create an organization](https://www.npmjs.com/org/create)**.
79
+ 2. Choose the **Organization name** **`biab-dev`** (must match the scope in `package.json`).
80
+ 3. Complete signup (a free org can publish public packages).
81
+
82
+ After this, your logged-in user (check with `npm whoami`) is typically an **owner** and can publish `@biab-dev/*` without extra steps.
83
+
84
+ If the name **`biab-dev` is already taken** on npm, pick another org name and change the `name` field in `package.json` to `@that-org/sdk` (and update imports across this monorepo that reference `@biab-dev/sdk`).
85
+
86
+ ### 2. Login
87
+
88
+ ```bash
89
+ npm login
90
+ ```
91
+
92
+ ### 3. Build and dry run (from this `biab-dev` folder)
93
+
94
+ ```bash
95
+ npm run build
96
+ npm pack --dry-run
97
+ ```
98
+
99
+ Confirm only `dist/`, `README.md`, `LICENSE`, and `package.json` are packed (`"files": ["dist"]`).
100
+
101
+ ### 4. Publish
102
+
103
+ ```bash
104
+ npm publish --access public
105
+ ```
106
+
107
+ `prepublishOnly` runs `npm run build` automatically before publish.
108
+
109
+ ### 5. Later releases
110
+
111
+ Bump `version` in `package.json` (or `npm version patch|minor|major`), then `npm publish` again.
112
+
113
+ Consumers install with:
114
+
115
+ ```bash
116
+ npm install @biab-dev/sdk
117
+ ```
118
+
119
+ ### Troubleshooting
120
+
121
+ | Error | Meaning |
122
+ | --- | --- |
123
+ | **`404 Scope not found`** | The **`@biab-dev` organization was never created** (or you’re logged into a user that isn’t a member). Create the org (step 1) or use a scope you own. |
124
+ | **`403 Forbidden`** | You’re not allowed to publish this scope. Ask an org **owner** to add your npm user with **publish** rights, or publish under your own scope. |
125
+ | **Web login during publish** | Normal if you use **2FA** — complete the browser prompt, then retry if needed. |
@@ -0,0 +1,107 @@
1
+ import type { z } from "zod";
2
+ import { type AuthIntrospectResponse, type CreateCollectionInput, type CreateCollectionResponse, type CreateEmailTemplateInput, type CreateEmailTemplateResponse, type CreateEmailTemplateVersionInput, type CreateEmailTemplateVersionResponse, type DashboardSessionResponse, type ExecuteActionInput, type ExecuteActionResponse, type FollowerEditInput, type FollowerEditResponse, type FollowerJoinInput, type FollowerJoinResponse, type FollowerLeaveInput, type FollowerLeaveResponse, type FollowerMeInput, type FollowerMeResponse, type GetCollectionResponse, type GetEmailTemplateResponse, type ListCollectionsResponse, type ListEmailTemplatesInput, type ListEmailTemplatesResponse, type ListRowsInput, type ListRowsResponse, type QueryRowsInput, type QueryRowsResponse, type SiteAssetInput, type UploadSiteAssetResponse, type UpsertRowInput, type UpsertRowResponse } from "./contracts";
3
+ export type FetchLike = typeof fetch;
4
+ /** Options for {@link BiabDevClient} / {@link createBiabDevClient}. */
5
+ export type BiabDevClientOptions = {
6
+ baseUrl: string;
7
+ apiKey: string;
8
+ fetch?: FetchLike;
9
+ defaultHeaders?: HeadersInit;
10
+ };
11
+ type RequestOptions<T> = {
12
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
13
+ path: string;
14
+ query?: Record<string, string | number | boolean | undefined>;
15
+ body?: unknown;
16
+ responseSchema: z.ZodType<T, z.ZodTypeDef, unknown>;
17
+ };
18
+ /**
19
+ * Typed client for the BIAB package HTTP API.
20
+ *
21
+ * @remarks
22
+ * **Alpha:** This SDK is in alpha. Surfaces and behavior may change without semver guarantees.
23
+ * Do not rely on it for production workloads—use development, staging, or experiments only.
24
+ */
25
+ export declare class BiabDevClient {
26
+ private readonly baseUrl;
27
+ private readonly apiKey;
28
+ private readonly fetchImpl;
29
+ private readonly defaultHeaders;
30
+ constructor(options: BiabDevClientOptions);
31
+ site(siteId: string): BiabDevSiteClient;
32
+ get emailTemplates(): BiabDevEmailTemplatesClient;
33
+ get dashboard(): BiabDevDashboardClient;
34
+ introspect(): Promise<AuthIntrospectResponse>;
35
+ request<T>(options: RequestOptions<T>): Promise<T>;
36
+ }
37
+ export declare class BiabDevSiteClient {
38
+ readonly client: BiabDevClient;
39
+ readonly siteId: string;
40
+ readonly collections: BiabDevCollectionsClient;
41
+ readonly rows: BiabDevRowsClient;
42
+ readonly assets: BiabDevAssetsClient;
43
+ readonly actions: BiabDevActionsClient;
44
+ readonly followers: BiabDevFollowersClient;
45
+ constructor(client: BiabDevClient, siteId: string);
46
+ }
47
+ export declare class BiabDevCollectionsClient {
48
+ private readonly client;
49
+ private readonly siteId;
50
+ constructor(client: BiabDevClient, siteId: string);
51
+ list(): Promise<ListCollectionsResponse>;
52
+ create(input: CreateCollectionInput): Promise<CreateCollectionResponse>;
53
+ get(slug: string): Promise<GetCollectionResponse>;
54
+ }
55
+ export declare class BiabDevRowsClient {
56
+ private readonly client;
57
+ private readonly siteId;
58
+ constructor(client: BiabDevClient, siteId: string);
59
+ list(collectionSlug: string, input?: ListRowsInput): Promise<ListRowsResponse>;
60
+ upsert(collectionSlug: string, input: UpsertRowInput): Promise<UpsertRowResponse>;
61
+ query(collectionSlug: string, input: QueryRowsInput): Promise<QueryRowsResponse>;
62
+ }
63
+ export declare class BiabDevAssetsClient {
64
+ private readonly client;
65
+ private readonly siteId;
66
+ constructor(client: BiabDevClient, siteId: string);
67
+ create(input: SiteAssetInput): Promise<UploadSiteAssetResponse>;
68
+ }
69
+ export declare class BiabDevActionsClient {
70
+ private readonly client;
71
+ private readonly siteId;
72
+ constructor(client: BiabDevClient, siteId: string);
73
+ run(actionName: string, input?: ExecuteActionInput): Promise<ExecuteActionResponse>;
74
+ }
75
+ export declare class BiabDevEmailTemplatesClient {
76
+ private readonly client;
77
+ constructor(client: BiabDevClient);
78
+ list(input?: ListEmailTemplatesInput): Promise<ListEmailTemplatesResponse>;
79
+ get(templateId: number): Promise<GetEmailTemplateResponse>;
80
+ create(input: CreateEmailTemplateInput): Promise<CreateEmailTemplateResponse>;
81
+ createVersion(templateId: number, input: CreateEmailTemplateVersionInput): Promise<CreateEmailTemplateVersionResponse>;
82
+ }
83
+ export declare class BiabDevFollowersClient {
84
+ private readonly client;
85
+ private readonly siteId;
86
+ constructor(client: BiabDevClient, siteId: string);
87
+ private actionPath;
88
+ join(input: FollowerJoinInput): Promise<FollowerJoinResponse>;
89
+ me(input: FollowerMeInput): Promise<FollowerMeResponse>;
90
+ edit(input: FollowerEditInput): Promise<FollowerEditResponse>;
91
+ leave(input: FollowerLeaveInput): Promise<FollowerLeaveResponse>;
92
+ }
93
+ export declare class BiabDevDashboardClient {
94
+ private readonly client;
95
+ constructor(client: BiabDevClient);
96
+ createSession(): Promise<DashboardSessionResponse>;
97
+ }
98
+ /**
99
+ * Creates a {@link BiabDevClient} for the given host `baseUrl` and package API key.
100
+ *
101
+ * @remarks
102
+ * **Alpha:** This package is still in alpha release. APIs may change; it is **not** intended
103
+ * for production use yet. Prefer non-production environments until a stable major is published.
104
+ */
105
+ export declare function createBiabDevClient(options: BiabDevClientOptions): BiabDevClient;
106
+ export {};
107
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,EACN,KAAK,sBAAsB,EAE3B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EAOvC,KAAK,wBAAwB,EAE7B,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAG1B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,kBAAkB,EASvB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAG7B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAMrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAGtB,KAAK,cAAc,EAEnB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAItB,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC,uEAAuE;AACvE,MAAM,MAAM,oBAAoB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf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 import { authIntrospectResponseSchema, createCollectionInputSchema, createCollectionResponseSchema, createEmailTemplateInputSchema, createEmailTemplateResponseSchema, createEmailTemplateVersionInputSchema, createEmailTemplateVersionResponseSchema, dashboardSessionResponseSchema, executeActionInputSchema, executeActionResponseSchema, followerEditInputSchema, followerEditResponseSchema, followerJoinInputSchema, followerJoinResponseSchema, followerLeaveInputSchema, followerLeaveResponseSchema, followerMeInputSchema, followerMeResponseSchema, getCollectionResponseSchema, getEmailTemplateResponseSchema, listCollectionsResponseSchema, listEmailTemplatesInputSchema, listEmailTemplatesResponseSchema, listRowsInputSchema, listRowsResponseSchema, queryRowsInputSchema, queryRowsResponseSchema, siteAssetInputSchema, uploadSiteAssetResponseSchema, upsertRowInputSchema, upsertRowResponseSchema, } from "./contracts";
2
+ import { BiabApiError } from "./errors";
3
+ function buildUrl(baseUrl, path, query) {
4
+ const url = new URL(path.startsWith("/") ? path : `/${path}`, baseUrl);
5
+ for (const [key, value] of Object.entries(query ?? {})) {
6
+ if (value == null)
7
+ continue;
8
+ url.searchParams.set(key, String(value));
9
+ }
10
+ return url;
11
+ }
12
+ async function parseResponseBody(response) {
13
+ const text = await response.text();
14
+ if (!text)
15
+ return null;
16
+ try {
17
+ return JSON.parse(text);
18
+ }
19
+ catch {
20
+ return text;
21
+ }
22
+ }
23
+ function extractErrorMessage(body, fallback) {
24
+ if (body && typeof body === "object" && "message" in body) {
25
+ const message = body.message;
26
+ if (typeof message === "string" && message.trim()) {
27
+ return message;
28
+ }
29
+ }
30
+ return fallback;
31
+ }
32
+ /**
33
+ * Typed client for the BIAB package HTTP API.
34
+ *
35
+ * @remarks
36
+ * **Alpha:** This SDK is in alpha. Surfaces and behavior may change without semver guarantees.
37
+ * Do not rely on it for production workloads—use development, staging, or experiments only.
38
+ */
39
+ export class BiabDevClient {
40
+ baseUrl;
41
+ apiKey;
42
+ fetchImpl;
43
+ defaultHeaders;
44
+ constructor(options) {
45
+ this.baseUrl = options.baseUrl.endsWith("/")
46
+ ? options.baseUrl
47
+ : `${options.baseUrl}/`;
48
+ this.apiKey = options.apiKey;
49
+ this.fetchImpl = options.fetch ?? fetch;
50
+ this.defaultHeaders = options.defaultHeaders;
51
+ }
52
+ site(siteId) {
53
+ return new BiabDevSiteClient(this, siteId);
54
+ }
55
+ get emailTemplates() {
56
+ return new BiabDevEmailTemplatesClient(this);
57
+ }
58
+ get dashboard() {
59
+ return new BiabDevDashboardClient(this);
60
+ }
61
+ async introspect() {
62
+ return this.request({
63
+ method: "POST",
64
+ path: "auth/introspect",
65
+ responseSchema: authIntrospectResponseSchema,
66
+ });
67
+ }
68
+ async request(options) {
69
+ const url = buildUrl(this.baseUrl, options.path, options.query);
70
+ const init = {
71
+ method: options.method ?? "GET",
72
+ headers: {
73
+ Accept: "application/json",
74
+ Authorization: `Bearer ${this.apiKey}`,
75
+ ...(options.body === undefined
76
+ ? {}
77
+ : { "Content-Type": "application/json" }),
78
+ ...(this.defaultHeaders ?? {}),
79
+ },
80
+ };
81
+ if (options.body !== undefined) {
82
+ init.body = JSON.stringify(options.body);
83
+ }
84
+ const response = await this.fetchImpl(url, init);
85
+ const body = await parseResponseBody(response);
86
+ if (!response.ok) {
87
+ throw new BiabApiError({
88
+ status: response.status,
89
+ path: url.pathname,
90
+ message: extractErrorMessage(body, `BIAB API request failed with status ${response.status}.`),
91
+ body,
92
+ });
93
+ }
94
+ return options.responseSchema.parse(body);
95
+ }
96
+ }
97
+ export class BiabDevSiteClient {
98
+ client;
99
+ siteId;
100
+ collections;
101
+ rows;
102
+ assets;
103
+ actions;
104
+ followers;
105
+ constructor(client, siteId) {
106
+ this.client = client;
107
+ this.siteId = siteId;
108
+ this.collections = new BiabDevCollectionsClient(client, siteId);
109
+ this.rows = new BiabDevRowsClient(client, siteId);
110
+ this.assets = new BiabDevAssetsClient(client, siteId);
111
+ this.actions = new BiabDevActionsClient(client, siteId);
112
+ this.followers = new BiabDevFollowersClient(client, siteId);
113
+ }
114
+ }
115
+ export class BiabDevCollectionsClient {
116
+ client;
117
+ siteId;
118
+ constructor(client, siteId) {
119
+ this.client = client;
120
+ this.siteId = siteId;
121
+ }
122
+ async list() {
123
+ return this.client.request({
124
+ path: `sites/${encodeURIComponent(this.siteId)}/collections`,
125
+ responseSchema: listCollectionsResponseSchema,
126
+ });
127
+ }
128
+ async create(input) {
129
+ const body = createCollectionInputSchema.parse(input);
130
+ return this.client.request({
131
+ method: "POST",
132
+ path: `sites/${encodeURIComponent(this.siteId)}/collections`,
133
+ body,
134
+ responseSchema: createCollectionResponseSchema,
135
+ });
136
+ }
137
+ async get(slug) {
138
+ return this.client.request({
139
+ path: `sites/${encodeURIComponent(this.siteId)}/collections/${encodeURIComponent(slug)}`,
140
+ responseSchema: getCollectionResponseSchema,
141
+ });
142
+ }
143
+ }
144
+ export class BiabDevRowsClient {
145
+ client;
146
+ siteId;
147
+ constructor(client, siteId) {
148
+ this.client = client;
149
+ this.siteId = siteId;
150
+ }
151
+ async list(collectionSlug, input = {}) {
152
+ const query = listRowsInputSchema.parse(input);
153
+ return this.client.request({
154
+ path: `sites/${encodeURIComponent(this.siteId)}/collections/${encodeURIComponent(collectionSlug)}/rows`,
155
+ query,
156
+ responseSchema: listRowsResponseSchema,
157
+ });
158
+ }
159
+ async upsert(collectionSlug, input) {
160
+ const body = upsertRowInputSchema.parse(input);
161
+ return this.client.request({
162
+ method: "POST",
163
+ path: `sites/${encodeURIComponent(this.siteId)}/collections/${encodeURIComponent(collectionSlug)}/rows`,
164
+ body,
165
+ responseSchema: upsertRowResponseSchema,
166
+ });
167
+ }
168
+ async query(collectionSlug, input) {
169
+ const body = queryRowsInputSchema.parse(input);
170
+ return this.client.request({
171
+ method: "POST",
172
+ path: `sites/${encodeURIComponent(this.siteId)}/collections/${encodeURIComponent(collectionSlug)}/query`,
173
+ body,
174
+ responseSchema: queryRowsResponseSchema,
175
+ });
176
+ }
177
+ }
178
+ export class BiabDevAssetsClient {
179
+ client;
180
+ siteId;
181
+ constructor(client, siteId) {
182
+ this.client = client;
183
+ this.siteId = siteId;
184
+ }
185
+ async create(input) {
186
+ const body = siteAssetInputSchema.parse(input);
187
+ return this.client.request({
188
+ method: "POST",
189
+ path: `sites/${encodeURIComponent(this.siteId)}/assets`,
190
+ body,
191
+ responseSchema: uploadSiteAssetResponseSchema,
192
+ });
193
+ }
194
+ }
195
+ export class BiabDevActionsClient {
196
+ client;
197
+ siteId;
198
+ constructor(client, siteId) {
199
+ this.client = client;
200
+ this.siteId = siteId;
201
+ }
202
+ async run(actionName, input = { payload: {} }) {
203
+ const body = executeActionInputSchema.parse(input);
204
+ return this.client.request({
205
+ method: "POST",
206
+ path: `sites/${encodeURIComponent(this.siteId)}/actions/${encodeURIComponent(actionName)}`,
207
+ body,
208
+ responseSchema: executeActionResponseSchema,
209
+ });
210
+ }
211
+ }
212
+ export class BiabDevEmailTemplatesClient {
213
+ client;
214
+ constructor(client) {
215
+ this.client = client;
216
+ }
217
+ async list(input = {}) {
218
+ const query = listEmailTemplatesInputSchema.parse(input);
219
+ return this.client.request({
220
+ path: "email/templates",
221
+ query,
222
+ responseSchema: listEmailTemplatesResponseSchema,
223
+ });
224
+ }
225
+ async get(templateId) {
226
+ return this.client.request({
227
+ path: `email/templates/${templateId}`,
228
+ responseSchema: getEmailTemplateResponseSchema,
229
+ });
230
+ }
231
+ async create(input) {
232
+ const body = createEmailTemplateInputSchema.parse(input);
233
+ return this.client.request({
234
+ method: "POST",
235
+ path: "email/templates",
236
+ body,
237
+ responseSchema: createEmailTemplateResponseSchema,
238
+ });
239
+ }
240
+ async createVersion(templateId, input) {
241
+ const body = createEmailTemplateVersionInputSchema.parse(input);
242
+ return this.client.request({
243
+ method: "POST",
244
+ path: `email/templates/${templateId}/versions`,
245
+ body,
246
+ responseSchema: createEmailTemplateVersionResponseSchema,
247
+ });
248
+ }
249
+ }
250
+ export class BiabDevFollowersClient {
251
+ client;
252
+ siteId;
253
+ constructor(client, siteId) {
254
+ this.client = client;
255
+ this.siteId = siteId;
256
+ }
257
+ actionPath(action) {
258
+ return `sites/${encodeURIComponent(this.siteId)}/actions/${encodeURIComponent(action)}`;
259
+ }
260
+ async join(input) {
261
+ const payload = followerJoinInputSchema.parse(input);
262
+ const body = executeActionInputSchema.parse({ payload });
263
+ const response = await this.client.request({
264
+ method: "POST",
265
+ path: this.actionPath("followers.join"),
266
+ body,
267
+ responseSchema: executeActionResponseSchema,
268
+ });
269
+ return followerJoinResponseSchema.parse(response.result);
270
+ }
271
+ async me(input) {
272
+ const payload = followerMeInputSchema.parse(input);
273
+ const body = executeActionInputSchema.parse({ payload });
274
+ const response = await this.client.request({
275
+ method: "POST",
276
+ path: this.actionPath("followers.me"),
277
+ body,
278
+ responseSchema: executeActionResponseSchema,
279
+ });
280
+ return followerMeResponseSchema.parse(response.result);
281
+ }
282
+ async edit(input) {
283
+ const payload = followerEditInputSchema.parse(input);
284
+ const body = executeActionInputSchema.parse({ payload });
285
+ const response = await this.client.request({
286
+ method: "POST",
287
+ path: this.actionPath("followers.edit"),
288
+ body,
289
+ responseSchema: executeActionResponseSchema,
290
+ });
291
+ return followerEditResponseSchema.parse(response.result);
292
+ }
293
+ async leave(input) {
294
+ const payload = followerLeaveInputSchema.parse(input);
295
+ const body = executeActionInputSchema.parse({ payload });
296
+ const response = await this.client.request({
297
+ method: "POST",
298
+ path: this.actionPath("followers.leave"),
299
+ body,
300
+ responseSchema: executeActionResponseSchema,
301
+ });
302
+ return followerLeaveResponseSchema.parse(response.result);
303
+ }
304
+ }
305
+ export class BiabDevDashboardClient {
306
+ client;
307
+ constructor(client) {
308
+ this.client = client;
309
+ }
310
+ async createSession() {
311
+ return this.client.request({
312
+ method: "POST",
313
+ path: "dashboard/session",
314
+ responseSchema: dashboardSessionResponseSchema,
315
+ });
316
+ }
317
+ }
318
+ /**
319
+ * Creates a {@link BiabDevClient} for the given host `baseUrl` and package API key.
320
+ *
321
+ * @remarks
322
+ * **Alpha:** This package is still in alpha release. APIs may change; it is **not** intended
323
+ * for production use yet. Prefer non-production environments until a stable major is published.
324
+ */
325
+ export function createBiabDevClient(options) {
326
+ return new BiabDevClient(options);
327
+ }
328
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,4BAA4B,EAO5B,2BAA2B,EAC3B,8BAA8B,EAC9B,8BAA8B,EAC9B,iCAAiC,EACjC,qCAAqC,EACrC,wCAAwC,EAExC,8BAA8B,EAG9B,wBAAwB,EACxB,2BAA2B,EAS3B,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,wBAAwB,EAGxB,2BAA2B,EAC3B,8BAA8B,EAM9B,6BAA6B,EAC7B,6BAA6B,EAC7B,gCAAgC,EAChC,mBAAmB,EACnB,sBAAsB,EAGtB,oBAAoB,EACpB,uBAAuB,EAEvB,oBAAoB,EAIpB,6BAA6B,EAC7B,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAoBxC,SAAS,QAAQ,CAChB,OAAe,EACf,IAAY,EACZ,KAA6D;IAE7D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IAEvE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;QACxD,IAAI,KAAK,IAAI,IAAI;YAAE,SAAS;QAC5B,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,GAAG,CAA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