busa-sdk 0.17.1 → 0.17.3
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/airapp-node.js +14 -1
- package/dist/airapp.d.ts +1 -1
- package/dist/{client-DIlpYL9z.d.ts → client-BgQn-yGL.d.ts} +26 -2
- package/dist/index.d.ts +83 -3
- package/dist/index.js +73 -6
- package/package.json +1 -1
package/dist/airapp-node.js
CHANGED
|
@@ -43,7 +43,20 @@ var normalizeOrigin = (raw, fallback = DEFAULT_CLOUD_BASE_URL) => {
|
|
|
43
43
|
}
|
|
44
44
|
return url.origin;
|
|
45
45
|
};
|
|
46
|
-
var requestOrigin = (request) =>
|
|
46
|
+
var requestOrigin = (request) => {
|
|
47
|
+
const directOrigin = new URL(request.url).origin;
|
|
48
|
+
const forwardedHost = request.headers.get("x-forwarded-host")?.split(",")[0]?.trim();
|
|
49
|
+
const forwardedProto = request.headers.get("x-forwarded-proto")?.split(",")[0]?.trim();
|
|
50
|
+
if (!forwardedHost || !forwardedProto || !["http", "https"].includes(forwardedProto))
|
|
51
|
+
return directOrigin;
|
|
52
|
+
try {
|
|
53
|
+
const forwardedOrigin = new URL(`${forwardedProto}://${forwardedHost}`).origin;
|
|
54
|
+
const browserOrigin = request.headers.get("origin");
|
|
55
|
+
return browserOrigin && browserOrigin !== forwardedOrigin ? directOrigin : forwardedOrigin;
|
|
56
|
+
} catch {
|
|
57
|
+
return directOrigin;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
47
60
|
var isLoopbackOrigin = (origin) => {
|
|
48
61
|
const url = new URL(origin);
|
|
49
62
|
return url.protocol === "http:" && LOOPBACK_HOSTNAMES.includes(url.hostname);
|
package/dist/airapp.d.ts
CHANGED
|
@@ -11163,6 +11163,8 @@ declare const cloudContract: {
|
|
|
11163
11163
|
version: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
11164
11164
|
available: z.ZodDefault<z.ZodBoolean>;
|
|
11165
11165
|
unavailableReason: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
11166
|
+
connectionRequired: z.ZodDefault<z.ZodBoolean>;
|
|
11167
|
+
connectedAgentName: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
11166
11168
|
}, z.core.$strip>>, _orpc_contract.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
11167
11169
|
sessions: {
|
|
11168
11170
|
list: _orpc_contract.ContractProcedure<_orpc_contract.Schema<unknown, unknown>, z.ZodArray<z.ZodObject<{
|
|
@@ -11210,6 +11212,14 @@ declare const cloudContract: {
|
|
|
11210
11212
|
prompt: _orpc_contract.ContractProcedure<z.ZodObject<{
|
|
11211
11213
|
sessionId: z.ZodString;
|
|
11212
11214
|
text: z.ZodString;
|
|
11215
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
11216
|
+
kind: z.ZodEnum<{
|
|
11217
|
+
image: "image";
|
|
11218
|
+
audio: "audio";
|
|
11219
|
+
}>;
|
|
11220
|
+
data: z.ZodString;
|
|
11221
|
+
mimeType: z.ZodString;
|
|
11222
|
+
}, z.core.$strip>>>;
|
|
11213
11223
|
}, z.core.$strip>, z.ZodObject<{
|
|
11214
11224
|
accepted: z.ZodBoolean;
|
|
11215
11225
|
sessionId: z.ZodString;
|
|
@@ -11761,11 +11771,11 @@ declare const cloudContract: {
|
|
|
11761
11771
|
comments: "comments";
|
|
11762
11772
|
bases: "bases";
|
|
11763
11773
|
assets: "assets";
|
|
11774
|
+
attachments: "attachments";
|
|
11764
11775
|
nodePrincipals: "nodePrincipals";
|
|
11765
11776
|
views: "views";
|
|
11766
11777
|
fieldValues: "fieldValues";
|
|
11767
11778
|
recordLinks: "recordLinks";
|
|
11768
|
-
attachments: "attachments";
|
|
11769
11779
|
assetUsages: "assetUsages";
|
|
11770
11780
|
assetTexts: "assetTexts";
|
|
11771
11781
|
commits: "commits";
|
|
@@ -11801,11 +11811,11 @@ declare const cloudContract: {
|
|
|
11801
11811
|
comments: "comments";
|
|
11802
11812
|
bases: "bases";
|
|
11803
11813
|
assets: "assets";
|
|
11814
|
+
attachments: "attachments";
|
|
11804
11815
|
nodePrincipals: "nodePrincipals";
|
|
11805
11816
|
views: "views";
|
|
11806
11817
|
fieldValues: "fieldValues";
|
|
11807
11818
|
recordLinks: "recordLinks";
|
|
11808
|
-
attachments: "attachments";
|
|
11809
11819
|
assetUsages: "assetUsages";
|
|
11810
11820
|
assetTexts: "assetTexts";
|
|
11811
11821
|
commits: "commits";
|
|
@@ -17772,6 +17782,19 @@ interface BusabaseConfig {
|
|
|
17772
17782
|
* accepts that only when the token has a single unambiguous space.
|
|
17773
17783
|
*/
|
|
17774
17784
|
spaceId?: string;
|
|
17785
|
+
/**
|
|
17786
|
+
* Origin the *web app* is served from, for building human-openable links (see
|
|
17787
|
+
* {@link Busabase.nodeUrl}). Falls back to `BUSABASE_WEB_URL`, then to
|
|
17788
|
+
* `baseUrl`.
|
|
17789
|
+
*
|
|
17790
|
+
* That fallback is why this field exists rather than being assumed: on Cloud
|
|
17791
|
+
* and on a local OSS server the API and the dashboard happen to be
|
|
17792
|
+
* same-origin, so `baseUrl` is right almost always — but "almost always" was
|
|
17793
|
+
* silently baked into every caller that hand-built a link. Behind a gateway
|
|
17794
|
+
* that mounts the API on its own host, or on a workspace subdomain, they
|
|
17795
|
+
* diverge and only the caller knows.
|
|
17796
|
+
*/
|
|
17797
|
+
webUrl?: string;
|
|
17775
17798
|
/**
|
|
17776
17799
|
* Extra headers merged into every request (after auth/space headers, so these
|
|
17777
17800
|
* win on conflict). Static object or a (possibly async) factory.
|
|
@@ -17783,6 +17806,7 @@ interface BusabaseConfig {
|
|
|
17783
17806
|
/** A {@link BusabaseConfig} with every field resolved from env / defaults. */
|
|
17784
17807
|
interface ResolvedConfig {
|
|
17785
17808
|
baseUrl: string;
|
|
17809
|
+
webUrl: string;
|
|
17786
17810
|
apiKey?: string;
|
|
17787
17811
|
spaceId?: string;
|
|
17788
17812
|
headers?: BusabaseConfig["headers"];
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import * as zod_v4_core from 'zod/v4/core';
|
|
|
3
3
|
import * as zod from 'zod';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import * as _orpc_client from '@orpc/client';
|
|
6
|
-
import { N as NodeOutput, a as NodeType, O as OperationKind, B as BusabaseClient, R as ResolvedConfig, b as BusabaseConfig } from './client-
|
|
7
|
-
export { C as CREATABLE_NODE_TYPES, c as CloudContract, d as CreatableNodeType, D as DEFAULT_BASE_URL, e as cloudContract, f as createBusabaseClient, r as resolveConfig } from './client-
|
|
6
|
+
import { N as NodeOutput, a as NodeType, O as OperationKind, B as BusabaseClient, R as ResolvedConfig, b as BusabaseConfig } from './client-BgQn-yGL.js';
|
|
7
|
+
export { C as CREATABLE_NODE_TYPES, c as CloudContract, d as CreatableNodeType, D as DEFAULT_BASE_URL, e as cloudContract, f as createBusabaseClient, r as resolveConfig } from './client-BgQn-yGL.js';
|
|
8
8
|
import '@orpc/shared';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -2909,6 +2909,60 @@ type BusabaseRecordsClient = BusabaseClient["records"] & {
|
|
|
2909
2909
|
*/
|
|
2910
2910
|
declare const getRecordByField: (client: Pick<BusabaseClient, "records">, input: RecordByFieldInput) => Promise<RecordVO | null>;
|
|
2911
2911
|
|
|
2912
|
+
/**
|
|
2913
|
+
* The canonical web URL a *human* opens for a node — the thing you paste into
|
|
2914
|
+
* chat, an email, or a "copy link" button.
|
|
2915
|
+
*
|
|
2916
|
+
* This lives in the contract package on purpose. The formula used to exist in
|
|
2917
|
+
* exactly one place: a React component (`node-share-button.tsx`), inside a
|
|
2918
|
+
* `useMemo` that reads `window.location.origin`. That made it unreachable to
|
|
2919
|
+
* every headless caller — the SDK, the CLI, and the server itself — so anyone
|
|
2920
|
+
* who needed a link had to re-derive it and hope they matched. Both
|
|
2921
|
+
* `busabase-core` (workspace dep) and `busabase-sdk` (bundled in by tsup's
|
|
2922
|
+
* `noExternal`) can import from here, so there is one definition again.
|
|
2923
|
+
*
|
|
2924
|
+
* Note this is the *authenticated* dashboard URL. It is the right link for a
|
|
2925
|
+
* reader who has a session, and the durable one (it never expires). It is NOT a
|
|
2926
|
+
* no-login link: a node is only anonymously reachable at this URL once someone
|
|
2927
|
+
* has enabled public sharing on it, and a Cloud embed link is a different URL
|
|
2928
|
+
* shape entirely (`/embed/{id}?token=…`, minted per-node and short-lived).
|
|
2929
|
+
*/
|
|
2930
|
+
/** Where the web app is served from — the *browser* origin, not the API root. */
|
|
2931
|
+
interface NodeWebUrlInput {
|
|
2932
|
+
/**
|
|
2933
|
+
* Origin the dashboard is served from, e.g. `https://busabase.com` or
|
|
2934
|
+
* `http://localhost:15419`. A trailing slash and a trailing `/api/v1` are both
|
|
2935
|
+
* tolerated, because callers routinely have only an API base URL to hand and
|
|
2936
|
+
* the two happen to be same-origin on Cloud and on a local OSS server.
|
|
2937
|
+
*/
|
|
2938
|
+
webOrigin: string;
|
|
2939
|
+
/**
|
|
2940
|
+
* Space id segment. Pass `null` for a workspace-subdomain host, where the
|
|
2941
|
+
* space is already implied by the hostname and the route drops the segment.
|
|
2942
|
+
*/
|
|
2943
|
+
spaceId: string | null;
|
|
2944
|
+
/** Node type segment: `base`, `doc`, `folder`, `file`, `drive`, `skill`, `airapp`, … */
|
|
2945
|
+
nodeType: string;
|
|
2946
|
+
/** Node slug (or id, for types addressed by id). */
|
|
2947
|
+
nodeSlug: string;
|
|
2948
|
+
/**
|
|
2949
|
+
* Extra segments below the node, already in route order — e.g. a record id
|
|
2950
|
+
* under a Base (`/base/<slug>/<recordId>`). Empty/blank entries are dropped.
|
|
2951
|
+
*/
|
|
2952
|
+
extraSegments?: readonly string[];
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* Build the canonical dashboard URL for a node.
|
|
2956
|
+
*
|
|
2957
|
+
* Every caller-supplied segment is percent-encoded: a slug is user-controlled
|
|
2958
|
+
* text, and an un-encoded `/` or `?` in one would silently retarget the link.
|
|
2959
|
+
*
|
|
2960
|
+
* @throws {TypeError} when `webOrigin` is not a parseable absolute URL, so a
|
|
2961
|
+
* malformed config fails loudly at the call site instead of producing a link
|
|
2962
|
+
* that looks fine and 404s.
|
|
2963
|
+
*/
|
|
2964
|
+
declare function nodeWebUrl({ webOrigin, spaceId, nodeType, nodeSlug, extraSegments, }: NodeWebUrlInput): string;
|
|
2965
|
+
|
|
2912
2966
|
type RawChangeRequestsClient = BusabaseClient["changeRequests"];
|
|
2913
2967
|
type ReviewBatchInput = Parameters<RawChangeRequestsClient["review"]>[0];
|
|
2914
2968
|
type MergeBatchInput = Parameters<RawChangeRequestsClient["merge"]>[0];
|
|
@@ -3007,6 +3061,32 @@ declare class Busabase {
|
|
|
3007
3061
|
get agentTasks(): BusabaseClient["agentTasks"];
|
|
3008
3062
|
get webhooks(): BusabaseClient["webhooks"];
|
|
3009
3063
|
get embedLinks(): BusabaseClient["embedLinks"];
|
|
3064
|
+
/**
|
|
3065
|
+
* The canonical dashboard URL a human opens for a node — the link you hand
|
|
3066
|
+
* back after a write.
|
|
3067
|
+
*
|
|
3068
|
+
* Uses `config.webUrl` (which defaults to `baseUrl`) and `config.spaceId`.
|
|
3069
|
+
* Pass `spaceId: null` for a workspace-subdomain host, where the route drops
|
|
3070
|
+
* the space segment.
|
|
3071
|
+
*
|
|
3072
|
+
* This is the *authenticated*, durable link: it never expires, but the reader
|
|
3073
|
+
* needs a session unless the node has public sharing enabled. For a no-login
|
|
3074
|
+
* link, mint a Cloud embed link instead —
|
|
3075
|
+
* `bb.embedLinks.create({ nodeId })` returns `{ url, iframeUrl }`.
|
|
3076
|
+
*
|
|
3077
|
+
* @example
|
|
3078
|
+
* ```ts
|
|
3079
|
+
* const doc = await bb.docs.create({ ... });
|
|
3080
|
+
* bb.nodeUrl({ nodeType: "doc", nodeSlug: doc.slug });
|
|
3081
|
+
* // → https://busabase.com/dashboard/org_123/doc/q3-pricing
|
|
3082
|
+
* ```
|
|
3083
|
+
*/
|
|
3084
|
+
nodeUrl(input: {
|
|
3085
|
+
nodeType: string;
|
|
3086
|
+
nodeSlug: string;
|
|
3087
|
+
spaceId?: string | null;
|
|
3088
|
+
extraSegments?: readonly string[];
|
|
3089
|
+
}): string;
|
|
3010
3090
|
/** Full-text search across records, change requests, and Bases. */
|
|
3011
3091
|
search(input: Parameters<BusabaseClient["search"]>[0]): _orpc_client.ClientPromiseResult<{
|
|
3012
3092
|
query: string;
|
|
@@ -3122,4 +3202,4 @@ declare class Busabase {
|
|
|
3122
3202
|
}>>>>;
|
|
3123
3203
|
}
|
|
3124
3204
|
|
|
3125
|
-
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 BusabaseAssetsClient, type BusabaseChangeRequestsClient, BusabaseClient, BusabaseConfig, type BusabaseRecordsClient, type ChangeRequestBatchFailureVO, type ChangeRequestCountsVO, type ChangeRequestMergeBatchResultVO, type ChangeRequestReviewBatchResultVO, type ChangeRequestStatus, type ChangeRequestTargetType, type ChangeRequestVO, type CommentSubjectType, type CommentVO, type CommitVO, type CreateFormDTO, 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 FormBoundFieldVO, type FormFieldBindingVO, type FormPageSourceVO, type FormShareVO, type FormSubmitResultVO, type FormThemeVO, type FormVO, type GalleryCardSize, type GalleryCoverFit, type GanttScale, type ListFormsDTO, type ListFormsVO, type LookupRollup, type NodeDetailVO, type NodeSearchResultVO, NodeType, type NodeVO, OperationKind, type OperationStatus, type OperationVO, type RecordByFieldInput, type RecordLinkVO, type RecordVO, 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, getRecordByField, grepAssets, normalizeBaseUrl, toFilesOnlyGrepResult, toUnifiedFilesGrepInput };
|
|
3205
|
+
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 BusabaseAssetsClient, type BusabaseChangeRequestsClient, BusabaseClient, BusabaseConfig, type BusabaseRecordsClient, type ChangeRequestBatchFailureVO, type ChangeRequestCountsVO, type ChangeRequestMergeBatchResultVO, type ChangeRequestReviewBatchResultVO, type ChangeRequestStatus, type ChangeRequestTargetType, type ChangeRequestVO, type CommentSubjectType, type CommentVO, type CommitVO, type CreateFormDTO, 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 FormBoundFieldVO, type FormFieldBindingVO, type FormPageSourceVO, type FormShareVO, type FormSubmitResultVO, type FormThemeVO, type FormVO, type GalleryCardSize, type GalleryCoverFit, type GanttScale, type ListFormsDTO, type ListFormsVO, type LookupRollup, type NodeDetailVO, type NodeSearchResultVO, NodeType, type NodeVO, type NodeWebUrlInput, OperationKind, type OperationStatus, type OperationVO, type RecordByFieldInput, type RecordLinkVO, type RecordVO, 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, getRecordByField, grepAssets, nodeWebUrl, normalizeBaseUrl, toFilesOnlyGrepResult, toUnifiedFilesGrepInput };
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,27 @@ import { OpenAPILink } from '@orpc/openapi-client/fetch';
|
|
|
5
5
|
import { oc, eventIterator } from '@orpc/contract';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
|
+
// ../../packages/busabase-contract/src/node-web-url.ts
|
|
9
|
+
var normalizeOrigin = (raw) => raw.trim().replace(/\/+$/, "").replace(/\/api\/v1$/, "");
|
|
10
|
+
function nodeWebUrl({
|
|
11
|
+
webOrigin,
|
|
12
|
+
spaceId,
|
|
13
|
+
nodeType,
|
|
14
|
+
nodeSlug,
|
|
15
|
+
extraSegments = []
|
|
16
|
+
}) {
|
|
17
|
+
const origin = normalizeOrigin(webOrigin);
|
|
18
|
+
const { origin: base } = new URL(origin);
|
|
19
|
+
const segments = [
|
|
20
|
+
"dashboard",
|
|
21
|
+
...spaceId ? [spaceId] : [],
|
|
22
|
+
nodeType,
|
|
23
|
+
nodeSlug,
|
|
24
|
+
...extraSegments
|
|
25
|
+
].filter((segment) => segment != null && segment !== "");
|
|
26
|
+
return `${base}/${segments.map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
8
29
|
// src/asset-grep.ts
|
|
9
30
|
var toUnifiedFilesGrepInput = (input) => ({
|
|
10
31
|
pattern: input.pattern,
|
|
@@ -41,7 +62,9 @@ var AgentCatalogEntryVOSchema = z.object({
|
|
|
41
62
|
/** Whether this entry can be launched right now (binary present / URL configured). */
|
|
42
63
|
available: z.boolean().default(false),
|
|
43
64
|
/** Human-readable reason when `available` is false — never a bare "failed". */
|
|
44
|
-
unavailableReason: z.string().nullable().default(null)
|
|
65
|
+
unavailableReason: z.string().nullable().default(null),
|
|
66
|
+
connectionRequired: z.boolean().default(false),
|
|
67
|
+
connectedAgentName: z.string().nullable().default(null)
|
|
45
68
|
});
|
|
46
69
|
var AgentSessionStatusSchema = z.enum([
|
|
47
70
|
"connecting",
|
|
@@ -93,9 +116,19 @@ var CreateAgentSessionInputSchema = z.object({
|
|
|
93
116
|
/** Must name a catalog entry. Deliberately NOT a command line — see below. */
|
|
94
117
|
slug: z.string().min(1)
|
|
95
118
|
});
|
|
119
|
+
var PromptAttachmentInputSchema = z.object({
|
|
120
|
+
kind: z.enum(["image", "audio"]),
|
|
121
|
+
data: z.string().min(1),
|
|
122
|
+
mimeType: z.string().min(1)
|
|
123
|
+
});
|
|
96
124
|
var PromptAgentSessionInputSchema = z.object({
|
|
97
125
|
sessionId: z.string().min(1),
|
|
98
|
-
|
|
126
|
+
// No longer `.min(1)`: an attachment with no caption is a valid prompt.
|
|
127
|
+
// The refine below is what actually requires SOMETHING to send.
|
|
128
|
+
text: z.string(),
|
|
129
|
+
attachments: z.array(PromptAttachmentInputSchema).optional()
|
|
130
|
+
}).refine((value) => value.text.trim().length > 0 || (value.attachments?.length ?? 0) > 0, {
|
|
131
|
+
message: "A prompt needs text, an attachment, or both."
|
|
99
132
|
});
|
|
100
133
|
var AgentSessionIdInputSchema = z.object({ sessionId: z.string().min(1) });
|
|
101
134
|
var RespondToAgentPermissionInputSchema = z.object({
|
|
@@ -3415,7 +3448,7 @@ var busabaseContractRoutes = {
|
|
|
3415
3448
|
path: "/nodes/{nodeId}/share",
|
|
3416
3449
|
tags: ["Nodes", "Sharing"],
|
|
3417
3450
|
summary: "Read a node's public link-sharing settings",
|
|
3418
|
-
successDescription: "The node's public-share settings, or null when the node was never shared. The stored password is never returned \u2014 only a `hasPassword` flag."
|
|
3451
|
+
successDescription: "The node's public-share settings, or null when the node was never shared. The stored password is never returned \u2014 only a `hasPassword` flag. No URL is returned: the shared node keeps its own canonical address, and only the caller knows which origin its reader should use (see `nodeWebUrl` in busabase-sdk)."
|
|
3419
3452
|
}).input(z.object({ nodeId: z.string() })).output(nodeShareSchema.nullable()),
|
|
3420
3453
|
set: oc.route({
|
|
3421
3454
|
method: "POST",
|
|
@@ -3437,7 +3470,7 @@ var busabaseContractRoutes = {
|
|
|
3437
3470
|
path: "/nodes/{nodeId}/share",
|
|
3438
3471
|
tags: ["Nodes", "Sharing"],
|
|
3439
3472
|
summary: "Revoke a node's public link sharing",
|
|
3440
|
-
successDescription: "Flipped the share scope to none in place
|
|
3473
|
+
successDescription: "Flipped the share scope to none in place, keeping the row, so re-enabling reopens the node's same canonical address rather than minting a new one. Requires `manage` level on the node."
|
|
3441
3474
|
}).input(z.object({ nodeId: z.string() })).output(nodeShareSchema.nullable())
|
|
3442
3475
|
}
|
|
3443
3476
|
},
|
|
@@ -3857,8 +3890,12 @@ var env = (key) => {
|
|
|
3857
3890
|
return value && value.length > 0 ? value : void 0;
|
|
3858
3891
|
};
|
|
3859
3892
|
function resolveConfig(config = {}) {
|
|
3893
|
+
const baseUrl = normalizeBaseUrl(config.baseUrl ?? env("BUSABASE_BASE_URL") ?? DEFAULT_BASE_URL);
|
|
3860
3894
|
return {
|
|
3861
|
-
baseUrl
|
|
3895
|
+
baseUrl,
|
|
3896
|
+
// Same-origin is the overwhelmingly common case (Cloud, and a local OSS
|
|
3897
|
+
// server), so default to it rather than forcing every caller to repeat it.
|
|
3898
|
+
webUrl: normalizeBaseUrl(config.webUrl ?? env("BUSABASE_WEB_URL") ?? baseUrl),
|
|
3862
3899
|
apiKey: config.apiKey ?? env("BUSABASE_API_KEY"),
|
|
3863
3900
|
spaceId: config.spaceId ?? env("BUSABASE_SPACE_ID"),
|
|
3864
3901
|
headers: config.headers,
|
|
@@ -4057,6 +4094,36 @@ var Busabase = class {
|
|
|
4057
4094
|
get embedLinks() {
|
|
4058
4095
|
return this.client.embedLinks;
|
|
4059
4096
|
}
|
|
4097
|
+
/**
|
|
4098
|
+
* The canonical dashboard URL a human opens for a node — the link you hand
|
|
4099
|
+
* back after a write.
|
|
4100
|
+
*
|
|
4101
|
+
* Uses `config.webUrl` (which defaults to `baseUrl`) and `config.spaceId`.
|
|
4102
|
+
* Pass `spaceId: null` for a workspace-subdomain host, where the route drops
|
|
4103
|
+
* the space segment.
|
|
4104
|
+
*
|
|
4105
|
+
* This is the *authenticated*, durable link: it never expires, but the reader
|
|
4106
|
+
* needs a session unless the node has public sharing enabled. For a no-login
|
|
4107
|
+
* link, mint a Cloud embed link instead —
|
|
4108
|
+
* `bb.embedLinks.create({ nodeId })` returns `{ url, iframeUrl }`.
|
|
4109
|
+
*
|
|
4110
|
+
* @example
|
|
4111
|
+
* ```ts
|
|
4112
|
+
* const doc = await bb.docs.create({ ... });
|
|
4113
|
+
* bb.nodeUrl({ nodeType: "doc", nodeSlug: doc.slug });
|
|
4114
|
+
* // → https://busabase.com/dashboard/org_123/doc/q3-pricing
|
|
4115
|
+
* ```
|
|
4116
|
+
*/
|
|
4117
|
+
nodeUrl(input) {
|
|
4118
|
+
const spaceId = input.spaceId === void 0 ? this.config.spaceId ?? null : input.spaceId;
|
|
4119
|
+
return nodeWebUrl({
|
|
4120
|
+
webOrigin: this.config.webUrl,
|
|
4121
|
+
spaceId,
|
|
4122
|
+
nodeType: input.nodeType,
|
|
4123
|
+
nodeSlug: input.nodeSlug,
|
|
4124
|
+
...input.extraSegments ? { extraSegments: input.extraSegments } : {}
|
|
4125
|
+
});
|
|
4126
|
+
}
|
|
4060
4127
|
/** Full-text search across records, change requests, and Bases. */
|
|
4061
4128
|
search(input) {
|
|
4062
4129
|
return this.client.search(input);
|
|
@@ -4117,4 +4184,4 @@ var Busabase = class {
|
|
|
4117
4184
|
}
|
|
4118
4185
|
};
|
|
4119
4186
|
|
|
4120
|
-
export { Busabase, CREATABLE_NODE_TYPES, DEFAULT_BASE_URL, cloudContract, createBusabaseClient, getRecordByField, grepAssets, resolveConfig, toFilesOnlyGrepResult, toUnifiedFilesGrepInput };
|
|
4187
|
+
export { Busabase, CREATABLE_NODE_TYPES, DEFAULT_BASE_URL, cloudContract, createBusabaseClient, getRecordByField, grepAssets, nodeWebUrl, resolveConfig, toFilesOnlyGrepResult, toUnifiedFilesGrepInput };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "busa-sdk",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.3",
|
|
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",
|