busa-sdk 0.9.5 → 0.9.6
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 +40 -3
- package/dist/index.js +37 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -239,6 +239,7 @@ type CreatableNodeType = Extract<BuiltinDefinition, {
|
|
|
239
239
|
creatable: true;
|
|
240
240
|
};
|
|
241
241
|
}>["type"];
|
|
242
|
+
declare const CREATABLE_NODE_TYPES: [CreatableNodeType, ...CreatableNodeType[]];
|
|
242
243
|
type GenericOperationKind = (typeof GENERIC_NODE_OPERATIONS)[number]["kind"];
|
|
243
244
|
type RegisteredOperationKind = BuiltinDefinition["operations"][number]["kind"];
|
|
244
245
|
type OperationKind = GenericOperationKind | RegisteredOperationKind;
|
|
@@ -261,6 +262,17 @@ interface NodeOutput {
|
|
|
261
262
|
updatedAt: string;
|
|
262
263
|
baseId: string | null;
|
|
263
264
|
children: NodeOutput[];
|
|
265
|
+
/**
|
|
266
|
+
* Whether this node has children beyond what `children` carries. Always
|
|
267
|
+
* accurate when the full subtree was loaded (equals `children.length > 0`).
|
|
268
|
+
* The one case it differs: a node sitting exactly at a `nodes.list` `depth`
|
|
269
|
+
* boundary — `children` is `[]` (not fetched) but `hasChildren` is `true`,
|
|
270
|
+
* telling the sidebar to render an expand affordance and lazy-fetch on
|
|
271
|
+
* click instead of rendering it as a leaf. Optional or missing means the
|
|
272
|
+
* caller can safely treat it as `children.length > 0` (which is exactly
|
|
273
|
+
* what it equals whenever it's omitted).
|
|
274
|
+
*/
|
|
275
|
+
hasChildren?: boolean;
|
|
264
276
|
}
|
|
265
277
|
|
|
266
278
|
declare const cloudContract: {
|
|
@@ -387,6 +399,15 @@ declare const cloudContract: {
|
|
|
387
399
|
query: z.ZodDefault<z.ZodString>;
|
|
388
400
|
limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
389
401
|
offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
402
|
+
sources: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodArray<z.ZodEnum<{
|
|
403
|
+
records: "records";
|
|
404
|
+
files: "files";
|
|
405
|
+
names: "names";
|
|
406
|
+
}>>, z.ZodEnum<{
|
|
407
|
+
records: "records";
|
|
408
|
+
files: "files";
|
|
409
|
+
names: "names";
|
|
410
|
+
}>]>, z.ZodTransform<("records" | "files" | "names")[], "records" | "files" | "names" | ("records" | "files" | "names")[]>>>;
|
|
390
411
|
}, z.core.$strip>, z.ZodObject<{
|
|
391
412
|
query: z.ZodString;
|
|
392
413
|
limit: z.ZodNumber;
|
|
@@ -411,9 +432,9 @@ declare const cloudContract: {
|
|
|
411
432
|
pattern: z.ZodString;
|
|
412
433
|
flags: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
413
434
|
sources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
435
|
+
records: "records";
|
|
414
436
|
files: "files";
|
|
415
437
|
docs: "docs";
|
|
416
|
-
records: "records";
|
|
417
438
|
}>>>;
|
|
418
439
|
scope: z.ZodOptional<z.ZodObject<{
|
|
419
440
|
files: z.ZodOptional<z.ZodObject<{
|
|
@@ -487,7 +508,16 @@ declare const cloudContract: {
|
|
|
487
508
|
truncated: z.ZodBoolean;
|
|
488
509
|
}, z.core.$strip>, _orpc_contract.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
489
510
|
nodes: {
|
|
490
|
-
list: _orpc_contract.ContractProcedure<
|
|
511
|
+
list: _orpc_contract.ContractProcedure<z.ZodOptional<z.ZodObject<{
|
|
512
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
513
|
+
depth: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
514
|
+
}, z.core.$strip>>, z.ZodArray<z.ZodType<NodeOutput, unknown, z.core.$ZodTypeInternals<NodeOutput, unknown>>>, _orpc_contract.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
515
|
+
isDescendant: _orpc_contract.ContractProcedure<z.ZodObject<{
|
|
516
|
+
nodeId: z.ZodString;
|
|
517
|
+
potentialAncestorId: z.ZodString;
|
|
518
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
519
|
+
isDescendant: z.ZodBoolean;
|
|
520
|
+
}, z.core.$strip>, _orpc_contract.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
491
521
|
listArchived: _orpc_contract.ContractProcedure<_orpc_contract.Schema<unknown, unknown>, z.ZodArray<z.ZodType<NodeOutput, unknown, z.core.$ZodTypeInternals<NodeOutput, unknown>>>, _orpc_contract.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
492
522
|
createChangeRequest: _orpc_contract.ContractProcedure<z.ZodObject<{
|
|
493
523
|
message: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -22543,6 +22573,13 @@ interface NodeVO {
|
|
|
22543
22573
|
updatedAt: string;
|
|
22544
22574
|
baseId: string | null;
|
|
22545
22575
|
children: NodeVO[];
|
|
22576
|
+
/**
|
|
22577
|
+
* Whether this node has children beyond what `children` carries — see the
|
|
22578
|
+
* matching field on the contract's `NodeOutput` (contract/schemas.ts) for
|
|
22579
|
+
* the full depth-boundary explanation. Optional/omitted is safe to treat
|
|
22580
|
+
* as `children.length > 0`.
|
|
22581
|
+
*/
|
|
22582
|
+
hasChildren?: boolean;
|
|
22546
22583
|
}
|
|
22547
22584
|
|
|
22548
22585
|
interface CommitVO {
|
|
@@ -22844,4 +22881,4 @@ declare class Busabase {
|
|
|
22844
22881
|
}>>>>;
|
|
22845
22882
|
}
|
|
22846
22883
|
|
|
22847
|
-
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, type ChangeRequestBatchResultVO, type ChangeRequestCountsVO, type ChangeRequestStatus, type ChangeRequestTargetType, type ChangeRequestVO, type CloudContract, type CommentSubjectType, type CommentVO, type CommitVO, type CreatableNodeType, 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 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 UpdateVaultSettingsDTO, type UserRefVO, 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 ViewVO, cloudContract, createBusabaseClient, normalizeBaseUrl, resolveConfig };
|
|
22884
|
+
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, 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 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 UpdateVaultSettingsDTO, type UserRefVO, 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 ViewVO, cloudContract, createBusabaseClient, normalizeBaseUrl, resolveConfig };
|
package/dist/index.js
CHANGED
|
@@ -429,9 +429,23 @@ var nodeSchema = z.lazy(
|
|
|
429
429
|
createdAt: z.string(),
|
|
430
430
|
updatedAt: z.string(),
|
|
431
431
|
baseId: z.string().nullable(),
|
|
432
|
-
children: z.array(nodeSchema)
|
|
432
|
+
children: z.array(nodeSchema),
|
|
433
|
+
hasChildren: z.boolean().optional()
|
|
433
434
|
})
|
|
434
435
|
);
|
|
436
|
+
var listNodesInputSchema = z.object({
|
|
437
|
+
parentId: z.string().nullable().optional().describe("Node to start from. Omit or null to start from the space root."),
|
|
438
|
+
depth: z.coerce.number().int().min(1).max(5).optional().describe(
|
|
439
|
+
"How many levels beneath the start point to eagerly include (default 2 once either field is set). Capped at 5."
|
|
440
|
+
)
|
|
441
|
+
}).optional();
|
|
442
|
+
var isDescendantInputSchema = z.object({
|
|
443
|
+
nodeId: z.string(),
|
|
444
|
+
potentialAncestorId: z.string()
|
|
445
|
+
});
|
|
446
|
+
var isDescendantOutputSchema = z.object({
|
|
447
|
+
isDescendant: z.boolean()
|
|
448
|
+
});
|
|
435
449
|
var userRefSchema = z.object({
|
|
436
450
|
id: z.string(),
|
|
437
451
|
name: z.string().nullable(),
|
|
@@ -754,10 +768,21 @@ var changeRequestCountsSchema = z.object({
|
|
|
754
768
|
merged: z.number().int().nonnegative(),
|
|
755
769
|
rejected: z.number().int().nonnegative()
|
|
756
770
|
});
|
|
771
|
+
var SEARCH_SOURCES = ["records", "files", "names"];
|
|
757
772
|
var searchInputSchema = z.object({
|
|
758
773
|
query: z.string().default(""),
|
|
759
774
|
limit: z.coerce.number().int().min(1).max(100).optional().default(20),
|
|
760
|
-
offset: z.coerce.number().int().min(0).optional().default(0)
|
|
775
|
+
offset: z.coerce.number().int().min(0).optional().default(0),
|
|
776
|
+
/**
|
|
777
|
+
* Restrict which content this call searches. Omitted means all three
|
|
778
|
+
* (unchanged behavior for every caller before this parameter existed).
|
|
779
|
+
*
|
|
780
|
+
* A GET query param that occurs exactly once (`?sources=records`) arrives
|
|
781
|
+
* as a bare string, not a 1-element array — only a REPEATED occurrence
|
|
782
|
+
* (`?sources=records&sources=files`) becomes an array. Accept both shapes
|
|
783
|
+
* and normalize to an array.
|
|
784
|
+
*/
|
|
785
|
+
sources: z.union([z.array(z.enum(SEARCH_SOURCES)), z.enum(SEARCH_SOURCES)]).transform((value) => Array.isArray(value) ? value : [value]).optional()
|
|
761
786
|
});
|
|
762
787
|
var authSpaceSchema = z.object({
|
|
763
788
|
id: z.string(),
|
|
@@ -2328,8 +2353,15 @@ var busabaseContractRoutes = {
|
|
|
2328
2353
|
path: "/nodes",
|
|
2329
2354
|
tags: ["Nodes"],
|
|
2330
2355
|
summary: "List node tree",
|
|
2331
|
-
successDescription: "Workspace node tree including folders, Bases, files, and agents."
|
|
2332
|
-
}).output(z.array(nodeSchema)),
|
|
2356
|
+
successDescription: "Workspace node tree including folders, Bases, files, and agents. With no `parentId`/`depth`, returns the FULL tree (legacy behavior, still what every non-sidebar caller gets). Passing `parentId` and/or `depth` switches to a depth-bounded fetch: `parentId` omitted/null starts from the space root and returns it wrapped exactly like the legacy call (just depth-limited); an explicit `parentId` returns that node's children directly, ready to merge into its `NodeVO.children` for a sidebar's lazy per-folder expand. See `NodeVO.hasChildren` for how a depth boundary is surfaced."
|
|
2357
|
+
}).input(listNodesInputSchema).output(z.array(nodeSchema)),
|
|
2358
|
+
isDescendant: oc.route({
|
|
2359
|
+
method: "GET",
|
|
2360
|
+
path: "/nodes/{nodeId}/is-descendant",
|
|
2361
|
+
tags: ["Nodes"],
|
|
2362
|
+
summary: "Check whether a node is a descendant of another",
|
|
2363
|
+
successDescription: "Server-authoritative parentId-chain walk from nodeId up to potentialAncestorId. Used to gate cross-branch drag-and-drop drops in the sidebar, since the full tree is no longer guaranteed to be loaded client-side (depth-bounded lazy load) \u2014 a purely local walk could wrongly allow dropping a folder into its own unloaded descendant."
|
|
2364
|
+
}).input(isDescendantInputSchema).output(isDescendantOutputSchema),
|
|
2333
2365
|
listArchived: oc.route({
|
|
2334
2366
|
method: "GET",
|
|
2335
2367
|
path: "/nodes/archived",
|
|
@@ -2816,4 +2848,4 @@ var Busabase = class {
|
|
|
2816
2848
|
}
|
|
2817
2849
|
};
|
|
2818
2850
|
|
|
2819
|
-
export { Busabase, DEFAULT_BASE_URL, cloudContract, createBusabaseClient, normalizeBaseUrl, resolveConfig };
|
|
2851
|
+
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.9.
|
|
3
|
+
"version": "0.9.6",
|
|
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",
|