busa-sdk 0.9.17 → 0.10.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/dist/index.d.ts +223 -33
- package/dist/index.js +34 -26
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -586,6 +586,10 @@ declare const cloudContract: {
|
|
|
586
586
|
name: z.ZodString;
|
|
587
587
|
slug: z.ZodNullable<z.ZodString>;
|
|
588
588
|
plan: z.ZodNullable<z.ZodString>;
|
|
589
|
+
nodeVisibilityMode: z.ZodOptional<z.ZodEnum<{
|
|
590
|
+
open: "open";
|
|
591
|
+
restricted: "restricted";
|
|
592
|
+
}>>;
|
|
589
593
|
}, z.core.$strip>;
|
|
590
594
|
user: z.ZodObject<{
|
|
591
595
|
id: z.ZodString;
|
|
@@ -603,6 +607,10 @@ declare const cloudContract: {
|
|
|
603
607
|
name: z.ZodString;
|
|
604
608
|
slug: z.ZodNullable<z.ZodString>;
|
|
605
609
|
plan: z.ZodNullable<z.ZodString>;
|
|
610
|
+
nodeVisibilityMode: z.ZodOptional<z.ZodEnum<{
|
|
611
|
+
open: "open";
|
|
612
|
+
restricted: "restricted";
|
|
613
|
+
}>>;
|
|
606
614
|
}, z.core.$strip>>;
|
|
607
615
|
createdSpace: z.ZodOptional<z.ZodBoolean>;
|
|
608
616
|
bootstrapRequired: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -20512,6 +20520,202 @@ declare const cloudContract: {
|
|
|
20512
20520
|
author: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
20513
20521
|
baseCommitId: z.ZodOptional<z.ZodString>;
|
|
20514
20522
|
recordId: z.ZodString;
|
|
20523
|
+
autoMerge: z.ZodOptional<z.ZodBoolean>;
|
|
20524
|
+
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
|
|
20525
|
+
id: z.ZodString;
|
|
20526
|
+
baseId: z.ZodString;
|
|
20527
|
+
headCommitId: z.ZodString;
|
|
20528
|
+
parentRecordId: z.ZodNullable<z.ZodString>;
|
|
20529
|
+
parentCommitId: z.ZodNullable<z.ZodString>;
|
|
20530
|
+
status: z.ZodEnum<{
|
|
20531
|
+
archived: "archived";
|
|
20532
|
+
active: "active";
|
|
20533
|
+
}>;
|
|
20534
|
+
createdBy: z.ZodString;
|
|
20535
|
+
createdByUser: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
20536
|
+
id: z.ZodString;
|
|
20537
|
+
name: z.ZodNullable<z.ZodString>;
|
|
20538
|
+
email: z.ZodNullable<z.ZodString>;
|
|
20539
|
+
image: z.ZodNullable<z.ZodString>;
|
|
20540
|
+
role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20541
|
+
}, z.core.$strip>>>>;
|
|
20542
|
+
archivedAt: z.ZodNullable<z.ZodString>;
|
|
20543
|
+
createdAt: z.ZodString;
|
|
20544
|
+
updatedAt: z.ZodString;
|
|
20545
|
+
base: z.ZodObject<{
|
|
20546
|
+
id: z.ZodString;
|
|
20547
|
+
nodeId: z.ZodString;
|
|
20548
|
+
slug: z.ZodString;
|
|
20549
|
+
name: z.ZodString;
|
|
20550
|
+
description: z.ZodString;
|
|
20551
|
+
reviewPolicy: z.ZodObject<{
|
|
20552
|
+
kind: z.ZodLiteral<"single">;
|
|
20553
|
+
requiredApprovals: z.ZodNumber;
|
|
20554
|
+
}, z.core.$strip>;
|
|
20555
|
+
createdAt: z.ZodString;
|
|
20556
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
20557
|
+
id: z.ZodString;
|
|
20558
|
+
baseId: z.ZodString;
|
|
20559
|
+
slug: z.ZodString;
|
|
20560
|
+
name: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodEnum<{
|
|
20561
|
+
en: "en";
|
|
20562
|
+
"zh-CN": "zh-CN";
|
|
20563
|
+
"zh-TW": "zh-TW";
|
|
20564
|
+
ja: "ja";
|
|
20565
|
+
ko: "ko";
|
|
20566
|
+
de: "de";
|
|
20567
|
+
fr: "fr";
|
|
20568
|
+
es: "es";
|
|
20569
|
+
pt: "pt";
|
|
20570
|
+
}> & z.core.$partial, z.ZodString>]>;
|
|
20571
|
+
type: z.ZodEnum<{
|
|
20572
|
+
number: "number";
|
|
20573
|
+
email: "email";
|
|
20574
|
+
date: "date";
|
|
20575
|
+
text: "text";
|
|
20576
|
+
whiteboard: "whiteboard";
|
|
20577
|
+
html: "html";
|
|
20578
|
+
longtext: "longtext";
|
|
20579
|
+
markdown: "markdown";
|
|
20580
|
+
attachment: "attachment";
|
|
20581
|
+
relation: "relation";
|
|
20582
|
+
checkbox: "checkbox";
|
|
20583
|
+
select: "select";
|
|
20584
|
+
multiselect: "multiselect";
|
|
20585
|
+
url: "url";
|
|
20586
|
+
embed: "embed";
|
|
20587
|
+
phone: "phone";
|
|
20588
|
+
created_time: "created_time";
|
|
20589
|
+
updated_time: "updated_time";
|
|
20590
|
+
created_by: "created_by";
|
|
20591
|
+
updated_by: "updated_by";
|
|
20592
|
+
auto_number: "auto_number";
|
|
20593
|
+
ai_summary: "ai_summary";
|
|
20594
|
+
ai_tags: "ai_tags";
|
|
20595
|
+
code: "code";
|
|
20596
|
+
json: "json";
|
|
20597
|
+
yaml: "yaml";
|
|
20598
|
+
formula: "formula";
|
|
20599
|
+
lookup: "lookup";
|
|
20600
|
+
}>;
|
|
20601
|
+
required: z.ZodBoolean;
|
|
20602
|
+
position: z.ZodNumber;
|
|
20603
|
+
options: z.ZodDefault<z.ZodObject<{
|
|
20604
|
+
ai: z.ZodOptional<z.ZodObject<{
|
|
20605
|
+
model: z.ZodOptional<z.ZodString>;
|
|
20606
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
20607
|
+
reviewRequired: z.ZodOptional<z.ZodBoolean>;
|
|
20608
|
+
sourceFieldIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20609
|
+
}, z.core.$strip>>;
|
|
20610
|
+
attachment: z.ZodOptional<z.ZodObject<{
|
|
20611
|
+
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
20612
|
+
allowedMimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20613
|
+
maxFileSize: z.ZodOptional<z.ZodNumber>;
|
|
20614
|
+
}, z.core.$strip>>;
|
|
20615
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
20616
|
+
color: z.ZodOptional<z.ZodString>;
|
|
20617
|
+
id: z.ZodString;
|
|
20618
|
+
name: z.ZodString;
|
|
20619
|
+
}, z.core.$strip>>>;
|
|
20620
|
+
code: z.ZodOptional<z.ZodObject<{
|
|
20621
|
+
language: z.ZodOptional<z.ZodString>;
|
|
20622
|
+
}, z.core.$strip>>;
|
|
20623
|
+
embed: z.ZodOptional<z.ZodObject<{
|
|
20624
|
+
aspectRatio: z.ZodOptional<z.ZodEnum<{
|
|
20625
|
+
"16:9": "16:9";
|
|
20626
|
+
"4:3": "4:3";
|
|
20627
|
+
"1:1": "1:1";
|
|
20628
|
+
}>>;
|
|
20629
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
20630
|
+
providers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20631
|
+
}, z.core.$strip>>;
|
|
20632
|
+
formula: z.ZodOptional<z.ZodObject<{
|
|
20633
|
+
expression: z.ZodString;
|
|
20634
|
+
}, z.core.$strip>>;
|
|
20635
|
+
inverseFieldId: z.ZodOptional<z.ZodString>;
|
|
20636
|
+
lookup: z.ZodOptional<z.ZodObject<{
|
|
20637
|
+
relationFieldSlug: z.ZodString;
|
|
20638
|
+
targetFieldSlug: z.ZodString;
|
|
20639
|
+
rollup: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
20640
|
+
values: "values";
|
|
20641
|
+
count: "count";
|
|
20642
|
+
sum: "sum";
|
|
20643
|
+
average: "average";
|
|
20644
|
+
min: "min";
|
|
20645
|
+
max: "max";
|
|
20646
|
+
concatenate: "concatenate";
|
|
20647
|
+
}>>>;
|
|
20648
|
+
limit: z.ZodOptional<z.ZodEnum<{
|
|
20649
|
+
all: "all";
|
|
20650
|
+
first: "first";
|
|
20651
|
+
}>>;
|
|
20652
|
+
}, z.core.$strip>>;
|
|
20653
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
20654
|
+
number: z.ZodOptional<z.ZodObject<{
|
|
20655
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
20656
|
+
plain: "plain";
|
|
20657
|
+
currency: "currency";
|
|
20658
|
+
}>>;
|
|
20659
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
20660
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
20661
|
+
}, z.core.$strip>>;
|
|
20662
|
+
targetBaseId: z.ZodOptional<z.ZodString>;
|
|
20663
|
+
targetBaseSlug: z.ZodOptional<z.ZodString>;
|
|
20664
|
+
}, z.core.$strip>>;
|
|
20665
|
+
}, z.core.$strip>>;
|
|
20666
|
+
}, z.core.$strip>;
|
|
20667
|
+
headCommit: z.ZodObject<{
|
|
20668
|
+
id: z.ZodString;
|
|
20669
|
+
baseId: z.ZodNullable<z.ZodString>;
|
|
20670
|
+
targetType: z.ZodEnum<{
|
|
20671
|
+
base: "base";
|
|
20672
|
+
node: "node";
|
|
20673
|
+
}>;
|
|
20674
|
+
nodeId: z.ZodNullable<z.ZodString>;
|
|
20675
|
+
operationId: z.ZodNullable<z.ZodString>;
|
|
20676
|
+
parentCommitId: z.ZodNullable<z.ZodString>;
|
|
20677
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
20678
|
+
operation: z.ZodEnum<{
|
|
20679
|
+
[x: `${string}_file_create`]: `${string}_file_create`;
|
|
20680
|
+
[x: `${string}_file_update`]: `${string}_file_update`;
|
|
20681
|
+
[x: `${string}_file_delete`]: `${string}_file_delete`;
|
|
20682
|
+
[x: `${string}_metadata_update`]: `${string}_metadata_update`;
|
|
20683
|
+
record_create: "record_create";
|
|
20684
|
+
record_update: "record_update";
|
|
20685
|
+
record_delete: "record_delete";
|
|
20686
|
+
record_variant: "record_variant";
|
|
20687
|
+
view_create: "view_create";
|
|
20688
|
+
view_update: "view_update";
|
|
20689
|
+
view_delete: "view_delete";
|
|
20690
|
+
view_restore: "view_restore";
|
|
20691
|
+
base_add_field: "base_add_field";
|
|
20692
|
+
base_delete_field: "base_delete_field";
|
|
20693
|
+
base_update_field: "base_update_field";
|
|
20694
|
+
base_convert_field: "base_convert_field";
|
|
20695
|
+
base_reorder_fields: "base_reorder_fields";
|
|
20696
|
+
base_restore_field: "base_restore_field";
|
|
20697
|
+
base_archive: "base_archive";
|
|
20698
|
+
base_restore: "base_restore";
|
|
20699
|
+
record_restore: "record_restore";
|
|
20700
|
+
doc_update: "doc_update";
|
|
20701
|
+
node_create: "node_create";
|
|
20702
|
+
node_rename: "node_rename";
|
|
20703
|
+
node_delete: "node_delete";
|
|
20704
|
+
node_restore: "node_restore";
|
|
20705
|
+
node_move: "node_move";
|
|
20706
|
+
}>;
|
|
20707
|
+
message: z.ZodString;
|
|
20708
|
+
author: z.ZodString;
|
|
20709
|
+
authorUser: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
20710
|
+
id: z.ZodString;
|
|
20711
|
+
name: z.ZodNullable<z.ZodString>;
|
|
20712
|
+
email: z.ZodNullable<z.ZodString>;
|
|
20713
|
+
image: z.ZodNullable<z.ZodString>;
|
|
20714
|
+
role: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20715
|
+
}, z.core.$strip>>>>;
|
|
20716
|
+
createdAt: z.ZodString;
|
|
20717
|
+
}, z.core.$strip>;
|
|
20718
|
+
materialized: z.ZodLiteral<true>;
|
|
20515
20719
|
}, z.core.$strip>, z.ZodObject<{
|
|
20516
20720
|
id: z.ZodString;
|
|
20517
20721
|
baseId: z.ZodNullable<z.ZodString>;
|
|
@@ -20912,7 +21116,8 @@ declare const cloudContract: {
|
|
|
20912
21116
|
visibleOperationHeads: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
20913
21117
|
createdAt: z.ZodString;
|
|
20914
21118
|
}, z.core.$strip>>;
|
|
20915
|
-
|
|
21119
|
+
materialized: z.ZodLiteral<false>;
|
|
21120
|
+
}, z.core.$strip>]>, _orpc_contract.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
20916
21121
|
deleteChangeRequest: _orpc_contract.ContractProcedure<z.ZodObject<{
|
|
20917
21122
|
message: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
20918
21123
|
submittedBy: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -23445,8 +23650,11 @@ interface BusabaseConfig {
|
|
|
23445
23650
|
*/
|
|
23446
23651
|
baseUrl?: string;
|
|
23447
23652
|
/**
|
|
23448
|
-
* Bearer token.
|
|
23449
|
-
*
|
|
23653
|
+
* Bearer token. Falls back to `BUSABASE_API_KEY`. Omit it in the two cases
|
|
23654
|
+
* where the server authenticates you some other way: a local OSS server
|
|
23655
|
+
* (`apps/busabase`) is open, and a *same-origin browser* call (e.g. from an
|
|
23656
|
+
* AirApp running inside Busabase) authenticates as the logged-in user via
|
|
23657
|
+
* the ambient session cookie.
|
|
23450
23658
|
*/
|
|
23451
23659
|
apiKey?: string;
|
|
23452
23660
|
/**
|
|
@@ -23484,43 +23692,25 @@ declare function resolveConfig(config?: BusabaseConfig): ResolvedConfig;
|
|
|
23484
23692
|
* Config fields default from `BUSABASE_BASE_URL` / `BUSABASE_API_KEY` /
|
|
23485
23693
|
* `BUSABASE_SPACE_ID` when omitted.
|
|
23486
23694
|
*
|
|
23695
|
+
* This is the *only* client the SDK ships. Browser code (an AirApp) and
|
|
23696
|
+
* server/CLI code use the same one — they differ only in where `baseUrl` and
|
|
23697
|
+
* the credential come from: an AirApp running inside Busabase passes
|
|
23698
|
+
* `baseUrl: window.location.origin` and no key (the ambient session cookie
|
|
23699
|
+
* authenticates it), while the same app run locally against a dev server
|
|
23700
|
+
* passes that server's URL and, for Busabase Cloud, an API key.
|
|
23701
|
+
*
|
|
23487
23702
|
* @example
|
|
23488
23703
|
* ```ts
|
|
23704
|
+
* // Server / CLI, against Busabase Cloud:
|
|
23489
23705
|
* const client = createBusabaseClient({ apiKey: process.env.BUSABASE_API_KEY });
|
|
23490
23706
|
* const bases = await client.bases.list();
|
|
23491
23707
|
* const record = await client.records.get({ recordId });
|
|
23708
|
+
*
|
|
23709
|
+
* // Browser (AirApp), same-origin — no key, the session cookie authenticates:
|
|
23710
|
+
* const client = createBusabaseClient({ baseUrl: window.location.origin });
|
|
23492
23711
|
* ```
|
|
23493
23712
|
*/
|
|
23494
23713
|
declare function createBusabaseClient(config?: BusabaseConfig): BusabaseClient;
|
|
23495
|
-
/** Options for {@link createBusabaseRpcClient}. No `apiKey`/`spaceId` — this
|
|
23496
|
-
* transport authenticates purely via the browser's ambient session cookie. */
|
|
23497
|
-
interface BusabaseRpcConfig {
|
|
23498
|
-
/**
|
|
23499
|
-
* Path to the internal RPC endpoint: either a full URL, or a path resolved
|
|
23500
|
-
* against `window.location.origin` (browser only — there is no ambient
|
|
23501
|
-
* session outside one).
|
|
23502
|
-
*
|
|
23503
|
-
* **The default (`/api/rpc`) only matches `apps/busabase` (the OSS app)**,
|
|
23504
|
-
* which mounts busabase's procedures unnamespaced. `apps/busabase-cloud`
|
|
23505
|
-
* mounts the *same* procedures under a `core` prefix instead — pass
|
|
23506
|
-
* `apiBasePath: "/api/rpc/core"` there, or this client will 404 on every
|
|
23507
|
-
* call. There is no single default that works for both; which one you're
|
|
23508
|
-
* targeting is something the caller has to know (this SDK doesn't probe
|
|
23509
|
-
* for it).
|
|
23510
|
-
*
|
|
23511
|
-
* From inside an AirApp running via Nodepod, prepend
|
|
23512
|
-
* `/__busabase_api__` to whichever of the above applies, to route through
|
|
23513
|
-
* the service-worker bridge instead of the sandboxed virtual server — e.g.
|
|
23514
|
-
* `/__busabase_api__/api/rpc/core` for busabase-cloud. See
|
|
23515
|
-
* apps/busabase/docs/node-types.md.
|
|
23516
|
-
*/
|
|
23517
|
-
apiBasePath?: string;
|
|
23518
|
-
/** Extra headers merged into every request. Static object or a (possibly async) factory. */
|
|
23519
|
-
headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
|
|
23520
|
-
/** Custom `fetch` implementation (e.g. a proxy-aware or instrumented fetch). */
|
|
23521
|
-
fetch?: typeof fetch;
|
|
23522
|
-
}
|
|
23523
|
-
declare function createBusabaseRpcClient(config?: BusabaseRpcConfig): BusabaseClient;
|
|
23524
23714
|
|
|
23525
23715
|
/**
|
|
23526
23716
|
* Attachments — DTO/VO Zod schemas + inferred types (the contract's type source
|
|
@@ -25834,4 +26024,4 @@ declare class Busabase {
|
|
|
25834
26024
|
}>>>>;
|
|
25835
26025
|
}
|
|
25836
26026
|
|
|
25837
|
-
export { type ActivityItemVO, type AgentTaskVO, type FileTreeFileVO as AirAppFileVO, type FileTreeReadFileVO as AirAppReadFileVO, type FileTreeNodeVO as AirAppVO, type AssetAttachmentRef, type AssetDetailVO, type AssetTextStatus, type AssetUsageVO, type AssetVO, type AttachmentRef, type AuditAction, type AuditEventVO, type BaseFieldVO, type BaseVO, Busabase, type BusabaseClient, type BusabaseConfig,
|
|
26027
|
+
export { type ActivityItemVO, type AgentTaskVO, type FileTreeFileVO as AirAppFileVO, type FileTreeReadFileVO as AirAppReadFileVO, type FileTreeNodeVO as AirAppVO, type AssetAttachmentRef, type AssetDetailVO, type AssetTextStatus, type AssetUsageVO, type AssetVO, type AttachmentRef, type AuditAction, type AuditEventVO, type BaseFieldVO, type BaseVO, Busabase, type BusabaseClient, type BusabaseConfig, CREATABLE_NODE_TYPES, type ChangeRequestBatchResultVO, type ChangeRequestCountsVO, type ChangeRequestStatus, type ChangeRequestTargetType, type ChangeRequestVO, type CloudContract, type CommentSubjectType, type CommentVO, type CommitVO, type CreatableNodeType, type CreateFormDTO, DEFAULT_BASE_URL, type FileTreeFileVO as DriveFileVO, type FileTreeReadFileVO as DriveReadFileVO, type FileTreeNodeVO as DriveVO, type FieldType, type FileNodeMetadata, type FileNodeVO, type FileTreeFileVO, type FileTreeNodeVO, type FileTreeReadFileVO, type FormFieldBindingVO, type FormPageSourceVO, type FormShareVO, type FormSubmitResultVO, type FormThemeVO, type FormVO, type GalleryCardSize, type GalleryCoverFit, type GanttScale, type LookupRollup, type NodeSearchResultVO, type NodeType, type NodeVO, type OperationKind, type OperationStatus, type OperationVO, type RecordLinkVO, type RecordVO, type ResolvedConfig, type ReviewVO, type ReviewVerdict, type SearchResponseVO, type SearchResultKind, type SearchResultVO, type FileTreeFileVO as SkillFileVO, type FileTreeReadFileVO as SkillReadFileVO, type FileTreeNodeVO as SkillVO, type SubmitFormDTO, type UpdateFormDTO, type UpdateVaultSettingsDTO, type UserRefVO, VIEW_FIELD_MAX_WIDTH, VIEW_FIELD_MIN_WIDTH, type VaultAccessPolicy, type VaultEnvironment, type VaultItemInput, type VaultItemKind, type VaultItemVO, type VaultRuntimeEnv, type VaultScopeType, type VaultSettingsVO, type ViewConfigVO, type ViewFilterOperator, type ViewFilterVO, type ViewSortVO, type ViewType, type ViewVO, cloudContract, createBusabaseClient, normalizeBaseUrl, resolveConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createORPCClient, ORPCError } from '@orpc/client';
|
|
2
|
-
import { RPCLink } from '@orpc/client/fetch';
|
|
3
|
-
import { oc, eventIterator, inferRPCMethodFromContractRouter } from '@orpc/contract';
|
|
4
2
|
import { OpenAPILink } from '@orpc/openapi-client/fetch';
|
|
3
|
+
import { oc, eventIterator } from '@orpc/contract';
|
|
5
4
|
import { z } from 'zod';
|
|
6
5
|
|
|
7
6
|
// src/client.ts
|
|
@@ -890,7 +889,23 @@ var authSpaceSchema = z.object({
|
|
|
890
889
|
id: z.string(),
|
|
891
890
|
name: z.string(),
|
|
892
891
|
slug: z.string().nullable(),
|
|
893
|
-
plan: z.string().nullable()
|
|
892
|
+
plan: z.string().nullable(),
|
|
893
|
+
/**
|
|
894
|
+
* The space's DEFAULT content visibility for its members — the same
|
|
895
|
+
* `spaces.nodeVisibilityMode` the cloud dashboard reads. `"open"` = a node
|
|
896
|
+
* with no explicit visibility anywhere in its ancestor chain is visible to
|
|
897
|
+
* every member; `"restricted"` = such a node is hidden from non-managers
|
|
898
|
+
* until it is explicitly opened (per-node visibility or a grant).
|
|
899
|
+
*
|
|
900
|
+
* Clients need it to describe a node's EFFECTIVE access truthfully ("everyone
|
|
901
|
+
* in this space can see this" is a lie in a restricted space) and to decide
|
|
902
|
+
* whether per-node grants are meaningful to show at all.
|
|
903
|
+
*
|
|
904
|
+
* OPTIONAL on purpose: it was added after this VO shipped, so an older server
|
|
905
|
+
* (or a host that doesn't model a space default at all) simply omits it.
|
|
906
|
+
* Treat an absent value as `"open"` — the historical behaviour.
|
|
907
|
+
*/
|
|
908
|
+
nodeVisibilityMode: z.enum(["open", "restricted"]).optional()
|
|
894
909
|
});
|
|
895
910
|
var authUserSchema = z.object({
|
|
896
911
|
id: z.string(),
|
|
@@ -1845,8 +1860,18 @@ var recordContract = {
|
|
|
1845
1860
|
path: "/records/{recordId}/change-requests",
|
|
1846
1861
|
tags: ["Records", "Change Requests"],
|
|
1847
1862
|
summary: "Create record update change request",
|
|
1848
|
-
successDescription: "
|
|
1849
|
-
}).input(
|
|
1863
|
+
successDescription: "Permission-aware by default: updates the record immediately when the actor has write access, otherwise returns a pending ChangeRequest. Pass `autoMerge: false` to force review."
|
|
1864
|
+
}).input(
|
|
1865
|
+
reviseOperationInputSchema.extend({
|
|
1866
|
+
recordId: z.string(),
|
|
1867
|
+
autoMerge: z.boolean().optional()
|
|
1868
|
+
})
|
|
1869
|
+
).output(
|
|
1870
|
+
z.union([
|
|
1871
|
+
recordSchema.extend({ materialized: z.literal(true) }),
|
|
1872
|
+
changeRequestSchema.extend({ materialized: z.literal(false) })
|
|
1873
|
+
])
|
|
1874
|
+
),
|
|
1850
1875
|
deleteChangeRequest: oc.route({
|
|
1851
1876
|
method: "DELETE",
|
|
1852
1877
|
path: "/records/{recordId}/change-requests",
|
|
@@ -3062,6 +3087,9 @@ var busabaseContractRoutes = {
|
|
|
3062
3087
|
live: {
|
|
3063
3088
|
// RPC-only by design: no `.route(...)`, so OpenAPI generation and MCP tool
|
|
3064
3089
|
// discovery skip this long-lived Event Iterator while `/api/rpc` stays typed.
|
|
3090
|
+
// (MCP discovery only skips it because `discoverOpenApiTools` now requires a
|
|
3091
|
+
// route with a method or path — omitting `.route()` still leaves `route: {}`,
|
|
3092
|
+
// which is truthy, and that used to publish this as a callable REST tool.)
|
|
3065
3093
|
subscribe: oc.output(eventIterator(liveEventSchema))
|
|
3066
3094
|
},
|
|
3067
3095
|
bases: baseContract,
|
|
@@ -3481,26 +3509,6 @@ function createBusabaseClient(config = {}) {
|
|
|
3481
3509
|
});
|
|
3482
3510
|
return createORPCClient(link);
|
|
3483
3511
|
}
|
|
3484
|
-
var getBrowserWindow = () => globalThis.window;
|
|
3485
|
-
function createBusabaseRpcClient(config = {}) {
|
|
3486
|
-
const apiBasePath = config.apiBasePath ?? "/api/rpc";
|
|
3487
|
-
const isAbsolute = /^https?:\/\//.test(apiBasePath);
|
|
3488
|
-
if (!isAbsolute && typeof getBrowserWindow() === "undefined") {
|
|
3489
|
-
throw new Error(
|
|
3490
|
-
"createBusabaseRpcClient: apiBasePath must be an absolute URL (http:// or https://) outside a browser \u2014 this client authenticates via the browser's ambient session cookie, which only exists client-side."
|
|
3491
|
-
);
|
|
3492
|
-
}
|
|
3493
|
-
const link = new RPCLink({
|
|
3494
|
-
method: inferRPCMethodFromContractRouter(cloudContract),
|
|
3495
|
-
url: () => isAbsolute ? apiBasePath : `${getBrowserWindow()?.location.origin}${apiBasePath}`,
|
|
3496
|
-
fetch: config.fetch,
|
|
3497
|
-
headers: async () => {
|
|
3498
|
-
const extra = typeof config.headers === "function" ? await config.headers() : config.headers;
|
|
3499
|
-
return { ...extra };
|
|
3500
|
-
}
|
|
3501
|
-
});
|
|
3502
|
-
return createORPCClient(link);
|
|
3503
|
-
}
|
|
3504
3512
|
|
|
3505
3513
|
// src/index.ts
|
|
3506
3514
|
var Busabase = class {
|
|
@@ -3630,4 +3638,4 @@ var Busabase = class {
|
|
|
3630
3638
|
}
|
|
3631
3639
|
};
|
|
3632
3640
|
|
|
3633
|
-
export { Busabase, CREATABLE_NODE_TYPES, DEFAULT_BASE_URL, cloudContract, createBusabaseClient,
|
|
3641
|
+
export { Busabase, CREATABLE_NODE_TYPES, DEFAULT_BASE_URL, cloudContract, createBusabaseClient, normalizeBaseUrl, resolveConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "busa-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Typed TypeScript/JavaScript SDK for the Busabase OpenAPI REST API. Talks to a local or remote `busabase server` (or Busabase Cloud). Short-name alias for busabase-sdk.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/busabase/busabase/tree/main/apps/busabase-sdk",
|