busabase-sdk 0.19.1 → 0.20.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/dist/airapp.d.ts +1 -1
- package/dist/{client-DPyDyOdK.d.ts → client-DF6mrd6D.d.ts} +4348 -469
- package/dist/index.d.ts +3 -2768
- package/dist/index.js +190 -138
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1161,6 +1161,23 @@ const userRefSchema = z.object({
|
|
|
1161
1161
|
image: z.string().nullable(),
|
|
1162
1162
|
role: z.string().nullable().optional()
|
|
1163
1163
|
});
|
|
1164
|
+
const sourceChannelSchema = z.enum([
|
|
1165
|
+
"web_ui",
|
|
1166
|
+
"browser",
|
|
1167
|
+
"openapi",
|
|
1168
|
+
"sdk",
|
|
1169
|
+
"cli",
|
|
1170
|
+
"mcp",
|
|
1171
|
+
"skill",
|
|
1172
|
+
"webhook",
|
|
1173
|
+
"automation",
|
|
1174
|
+
"import"
|
|
1175
|
+
]);
|
|
1176
|
+
const sourceAttributionSchema = z.object({
|
|
1177
|
+
displayName: z.string().nullable(),
|
|
1178
|
+
ownerName: z.string().nullable(),
|
|
1179
|
+
channel: sourceChannelSchema.nullable()
|
|
1180
|
+
});
|
|
1164
1181
|
const commitSchema = z.object({
|
|
1165
1182
|
id: z.string(),
|
|
1166
1183
|
baseId: z.string().nullable(),
|
|
@@ -1252,6 +1269,7 @@ const changeRequestSchema = z.object({
|
|
|
1252
1269
|
status: changeRequestStatusSchema,
|
|
1253
1270
|
submittedBy: z.string(),
|
|
1254
1271
|
submittedByUser: userRefSchema.nullable().optional().default(null),
|
|
1272
|
+
sourceAttribution: sourceAttributionSchema.nullable().optional(),
|
|
1255
1273
|
sourceMeta: z.record(z.string(), z.unknown()),
|
|
1256
1274
|
reviewPolicySnapshot: z.record(z.string(), z.unknown()),
|
|
1257
1275
|
mergeSummary: z.record(z.string(), z.unknown()),
|
|
@@ -1340,6 +1358,7 @@ const auditEventSchema = z.object({
|
|
|
1340
1358
|
action: auditActionSchema,
|
|
1341
1359
|
actorId: z.string(),
|
|
1342
1360
|
actor: userRefSchema.nullable().optional().default(null),
|
|
1361
|
+
sourceAttribution: sourceAttributionSchema.nullable().optional(),
|
|
1343
1362
|
baseId: z.string().nullable(),
|
|
1344
1363
|
recordId: z.string().nullable(),
|
|
1345
1364
|
changeRequestId: z.string().nullable(),
|
|
@@ -1461,21 +1480,30 @@ const listChangeRequestsPagedInputSchema = z.object({
|
|
|
1461
1480
|
/** Opaque base64 cursor (`createdAt|id`) for keyset pagination. */
|
|
1462
1481
|
cursor: z.string().optional(),
|
|
1463
1482
|
status: z.array(changeRequestStatusSchema).optional(),
|
|
1464
|
-
mine: z.boolean().optional()
|
|
1483
|
+
mine: z.boolean().optional(),
|
|
1484
|
+
affectsNodeId: z.string().min(1).optional()
|
|
1465
1485
|
}).optional().default({ limit: 50 });
|
|
1466
1486
|
const listChangeRequestsResponseSchema = z.object({
|
|
1467
1487
|
changeRequests: z.array(changeRequestSchema),
|
|
1468
1488
|
nextCursor: z.string().nullable()
|
|
1469
1489
|
});
|
|
1470
|
-
const
|
|
1490
|
+
const changeRequestPageInputShape = {
|
|
1471
1491
|
page: z.coerce.number().int().min(1).optional().default(1),
|
|
1472
1492
|
pageSize: z.coerce.number().int().min(1).max(100).optional().default(50),
|
|
1473
1493
|
status: z.array(changeRequestStatusSchema).optional(),
|
|
1474
1494
|
mine: z.boolean().optional()
|
|
1495
|
+
};
|
|
1496
|
+
const listChangeRequestsPageInputSchema = z.object({
|
|
1497
|
+
...changeRequestPageInputShape,
|
|
1498
|
+
affectsNodeId: z.string().min(1).optional()
|
|
1475
1499
|
}).optional().default({
|
|
1476
1500
|
page: 1,
|
|
1477
1501
|
pageSize: 50
|
|
1478
1502
|
});
|
|
1503
|
+
const inboxSnapshotInputSchema = z.object(changeRequestPageInputShape).optional().default({
|
|
1504
|
+
page: 1,
|
|
1505
|
+
pageSize: 50
|
|
1506
|
+
});
|
|
1479
1507
|
const listChangeRequestsPageResponseSchema = z.object({
|
|
1480
1508
|
changeRequests: z.array(changeRequestSchema),
|
|
1481
1509
|
total: z.number().int().nonnegative(),
|
|
@@ -1491,6 +1519,7 @@ const changeRequestCountsSchema = z.object({
|
|
|
1491
1519
|
merged: z.number().int().nonnegative(),
|
|
1492
1520
|
rejected: z.number().int().nonnegative()
|
|
1493
1521
|
});
|
|
1522
|
+
const inboxSnapshotResponseSchema = listChangeRequestsPageResponseSchema.extend({ counts: changeRequestCountsSchema });
|
|
1494
1523
|
const SEARCH_SOURCES = [
|
|
1495
1524
|
"records",
|
|
1496
1525
|
"files",
|
|
@@ -3211,6 +3240,13 @@ const InstallResultVOSchema = z.object({
|
|
|
3211
3240
|
pendingChangeRequests: z.number().int().min(0),
|
|
3212
3241
|
warnings: z.array(z.string()).default([])
|
|
3213
3242
|
});
|
|
3243
|
+
z.object({
|
|
3244
|
+
/** Which of the five passes stopped, e.g. `Pass 4/5 (sample records)`. */
|
|
3245
|
+
phase: z.string(),
|
|
3246
|
+
targetFolderSlug: z.string(),
|
|
3247
|
+
created: InstallCreatedCountsVOSchema,
|
|
3248
|
+
pendingChangeRequests: z.number().int().min(0)
|
|
3249
|
+
});
|
|
3214
3250
|
const repoUrlField = z.string().min(1).describe("GitHub repo URL: https://github.com/<owner>/<repo>[/tree/<ref>[/<subdir>]]. Only GitHub hosts are accepted.");
|
|
3215
3251
|
const intoFolderField = z.string().optional().describe("Slug of the folder to install into. Defaults to the package manifest's name.");
|
|
3216
3252
|
const renameField = z.boolean().optional().describe("Resolve slug collisions by suffixing (-2, -3, …) instead of refusing. Never overwrites anything.");
|
|
@@ -3663,6 +3699,104 @@ const listRecordActivityInputSchema = z.object({
|
|
|
3663
3699
|
recordId: z.string().min(1),
|
|
3664
3700
|
limit: z.coerce.number().int().min(1).max(100).optional().default(50)
|
|
3665
3701
|
});
|
|
3702
|
+
const EMBED_LINK_MAX_MINUTES = 1440;
|
|
3703
|
+
const EmbedNodeTypeSchema = z.enum([
|
|
3704
|
+
"base",
|
|
3705
|
+
"doc",
|
|
3706
|
+
"file",
|
|
3707
|
+
"drive",
|
|
3708
|
+
"skill",
|
|
3709
|
+
"folder",
|
|
3710
|
+
"airapp"
|
|
3711
|
+
]);
|
|
3712
|
+
const EmbedTargetTypeSchema = z.enum([
|
|
3713
|
+
"node",
|
|
3714
|
+
"change-request",
|
|
3715
|
+
"record-detail"
|
|
3716
|
+
]);
|
|
3717
|
+
const EmbedFrameModeSchema = z.enum([
|
|
3718
|
+
"anywhere",
|
|
3719
|
+
"origins",
|
|
3720
|
+
"top-level-only"
|
|
3721
|
+
]);
|
|
3722
|
+
const EmbedAllowedOriginSchema = z.string().trim().min(1).superRefine((value, ctx) => {
|
|
3723
|
+
let url;
|
|
3724
|
+
try {
|
|
3725
|
+
url = new URL(value);
|
|
3726
|
+
} catch {
|
|
3727
|
+
ctx.addIssue({
|
|
3728
|
+
code: "custom",
|
|
3729
|
+
message: "Allowed origins must be valid URLs"
|
|
3730
|
+
});
|
|
3731
|
+
return;
|
|
3732
|
+
}
|
|
3733
|
+
const isLocalHttp = url.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]");
|
|
3734
|
+
if (url.protocol !== "https:" && !isLocalHttp) ctx.addIssue({
|
|
3735
|
+
code: "custom",
|
|
3736
|
+
message: "Allowed origins must use HTTPS"
|
|
3737
|
+
});
|
|
3738
|
+
if (url.username || url.password || url.pathname !== "/" || url.search || url.hash || url.hostname.includes("*")) ctx.addIssue({
|
|
3739
|
+
code: "custom",
|
|
3740
|
+
message: "Allowed origins must be exact origins"
|
|
3741
|
+
});
|
|
3742
|
+
}).transform((value) => new URL(value).origin);
|
|
3743
|
+
const EmbedFramePolicyInputSchema = z.discriminatedUnion("mode", [
|
|
3744
|
+
z.object({
|
|
3745
|
+
mode: z.literal("anywhere"),
|
|
3746
|
+
allowedOrigins: z.array(EmbedAllowedOriginSchema).max(0).optional()
|
|
3747
|
+
}),
|
|
3748
|
+
z.object({
|
|
3749
|
+
mode: z.literal("origins"),
|
|
3750
|
+
allowedOrigins: z.array(EmbedAllowedOriginSchema).min(1).max(20)
|
|
3751
|
+
}),
|
|
3752
|
+
z.object({
|
|
3753
|
+
mode: z.literal("top-level-only"),
|
|
3754
|
+
allowedOrigins: z.array(EmbedAllowedOriginSchema).max(0).optional()
|
|
3755
|
+
})
|
|
3756
|
+
]).transform((policy) => ({
|
|
3757
|
+
mode: policy.mode,
|
|
3758
|
+
allowedOrigins: [...new Set(policy.allowedOrigins ?? [])]
|
|
3759
|
+
}));
|
|
3760
|
+
const EmbedFramePolicyVOSchema = z.object({
|
|
3761
|
+
mode: EmbedFrameModeSchema,
|
|
3762
|
+
allowedOrigins: z.array(z.string().url())
|
|
3763
|
+
}).superRefine((policy, ctx) => {
|
|
3764
|
+
if (!(policy.mode === "origins" ? policy.allowedOrigins.length > 0 : policy.allowedOrigins.length === 0)) ctx.addIssue({
|
|
3765
|
+
code: "custom",
|
|
3766
|
+
message: "Stored frame policy is invalid"
|
|
3767
|
+
});
|
|
3768
|
+
});
|
|
3769
|
+
const CreateEmbedLinkInputSchema = z.object({
|
|
3770
|
+
type: EmbedTargetTypeSchema,
|
|
3771
|
+
typeId: z.string().min(1),
|
|
3772
|
+
expiresInMinutes: z.number().int().min(1).max(EMBED_LINK_MAX_MINUTES).optional().default(15),
|
|
3773
|
+
framePolicy: EmbedFramePolicyInputSchema.optional().default({
|
|
3774
|
+
mode: "anywhere",
|
|
3775
|
+
allowedOrigins: []
|
|
3776
|
+
})
|
|
3777
|
+
});
|
|
3778
|
+
const ListEmbedLinksInputSchema = z.object({
|
|
3779
|
+
type: EmbedTargetTypeSchema.optional(),
|
|
3780
|
+
typeId: z.string().min(1).optional()
|
|
3781
|
+
}).optional().default({});
|
|
3782
|
+
const RevokeEmbedLinkInputSchema = z.object({ id: z.string().min(1) });
|
|
3783
|
+
const EmbedLinkVOSchema = z.object({
|
|
3784
|
+
id: z.string(),
|
|
3785
|
+
type: EmbedTargetTypeSchema,
|
|
3786
|
+
typeId: z.string(),
|
|
3787
|
+
targetName: z.string(),
|
|
3788
|
+
nodeType: EmbedNodeTypeSchema.nullable(),
|
|
3789
|
+
createdAt: z.string().datetime(),
|
|
3790
|
+
expiresAt: z.string().datetime(),
|
|
3791
|
+
revokedAt: z.string().datetime().nullable(),
|
|
3792
|
+
active: z.boolean(),
|
|
3793
|
+
framePolicy: EmbedFramePolicyVOSchema
|
|
3794
|
+
});
|
|
3795
|
+
const CreatedEmbedLinkVOSchema = EmbedLinkVOSchema.extend({
|
|
3796
|
+
url: z.string().url(),
|
|
3797
|
+
iframeUrl: z.string().url()
|
|
3798
|
+
});
|
|
3799
|
+
const RevokeEmbedLinkVOSchema = z.object({ revoked: z.literal(true) });
|
|
3666
3800
|
//#endregion
|
|
3667
3801
|
//#region ../../packages/busabase-contract/src/contract/grep-schemas.ts
|
|
3668
3802
|
/**
|
|
@@ -4126,6 +4260,29 @@ const changeRequestBatchFailureSchema = z.object({
|
|
|
4126
4260
|
code: z.string().optional(),
|
|
4127
4261
|
data: z.unknown().optional()
|
|
4128
4262
|
});
|
|
4263
|
+
const embedLinkErrorResponseSchema = z.object({ error: z.string() });
|
|
4264
|
+
const embedLinkErrors = {
|
|
4265
|
+
BAD_REQUEST: {
|
|
4266
|
+
status: 400,
|
|
4267
|
+
message: "Bad Request",
|
|
4268
|
+
data: embedLinkErrorResponseSchema
|
|
4269
|
+
},
|
|
4270
|
+
UNAUTHORIZED: {
|
|
4271
|
+
status: 401,
|
|
4272
|
+
message: "Unauthorized",
|
|
4273
|
+
data: embedLinkErrorResponseSchema
|
|
4274
|
+
},
|
|
4275
|
+
FORBIDDEN: {
|
|
4276
|
+
status: 403,
|
|
4277
|
+
message: "Forbidden",
|
|
4278
|
+
data: embedLinkErrorResponseSchema
|
|
4279
|
+
},
|
|
4280
|
+
NOT_FOUND: {
|
|
4281
|
+
status: 404,
|
|
4282
|
+
message: "Not Found",
|
|
4283
|
+
data: embedLinkErrorResponseSchema
|
|
4284
|
+
}
|
|
4285
|
+
};
|
|
4129
4286
|
const changeRequestReviewBatchResultSchema = z.object({ results: z.array(z.discriminatedUnion("ok", [z.object({
|
|
4130
4287
|
changeRequestId: z.string(),
|
|
4131
4288
|
ok: z.literal(true),
|
|
@@ -4162,6 +4319,29 @@ const busabaseContractRoutes = {
|
|
|
4162
4319
|
summary: "Search files, Docs, and Base records with one pattern (unified grep)",
|
|
4163
4320
|
successDescription: "Streaming regex/literal matches across every in-scope source — Drive/Skill files, Doc bodies, and Base records (canonical headCommit.payload, never the truncated search projection) — with one shared pattern, one shared maxMatches/deadline budget (files scanned first, then docs, then whatever budget remains goes to records), and a per-source honest coverage report (files keeps its existing missing/stale/unsearchable/errored/notReached; docs and records report scanned/errored/notReached). truncated is set when any source truncated or has notReached > 0."
|
|
4164
4321
|
}).input(UnifiedGrepInputSchema).output(UnifiedGrepResultVOSchema),
|
|
4322
|
+
embedLinks: {
|
|
4323
|
+
create: oc.route({
|
|
4324
|
+
method: "POST",
|
|
4325
|
+
path: "/embed-links",
|
|
4326
|
+
tags: ["Embed Links"],
|
|
4327
|
+
summary: "Create a polymorphic read-only embed link",
|
|
4328
|
+
successDescription: "The capability URL is returned once; only its secret hash is stored."
|
|
4329
|
+
}).errors(embedLinkErrors).input(CreateEmbedLinkInputSchema).output(CreatedEmbedLinkVOSchema),
|
|
4330
|
+
list: oc.route({
|
|
4331
|
+
method: "GET",
|
|
4332
|
+
path: "/embed-links",
|
|
4333
|
+
tags: ["Embed Links"],
|
|
4334
|
+
summary: "List embed links the caller can manage",
|
|
4335
|
+
successDescription: "Embed link metadata without capability secrets."
|
|
4336
|
+
}).errors(embedLinkErrors).input(ListEmbedLinksInputSchema).output(z.array(EmbedLinkVOSchema)),
|
|
4337
|
+
revoke: oc.route({
|
|
4338
|
+
method: "DELETE",
|
|
4339
|
+
path: "/embed-links/{id}",
|
|
4340
|
+
tags: ["Embed Links"],
|
|
4341
|
+
summary: "Revoke an embed link",
|
|
4342
|
+
successDescription: "The capability stops resolving immediately."
|
|
4343
|
+
}).errors(embedLinkErrors).input(RevokeEmbedLinkInputSchema).output(RevokeEmbedLinkVOSchema)
|
|
4344
|
+
},
|
|
4165
4345
|
nodes: {
|
|
4166
4346
|
list: oc.route({
|
|
4167
4347
|
method: "GET",
|
|
@@ -4427,15 +4607,16 @@ const busabaseContractRoutes = {
|
|
|
4427
4607
|
path: "/change-requests",
|
|
4428
4608
|
tags: ["Change Requests"],
|
|
4429
4609
|
summary: "List change requests",
|
|
4430
|
-
successDescription: "A page of change requests plus an opaque nextCursor (null at the end). Filter with `status` and/or `
|
|
4610
|
+
successDescription: "A page of change requests plus an opaque nextCursor (null at the end). Filter with `status`, `mine`, and/or `affectsNodeId`."
|
|
4431
4611
|
}).input(listChangeRequestsPagedInputSchema).output(listChangeRequestsResponseSchema),
|
|
4432
4612
|
listPage: oc.route({
|
|
4433
4613
|
method: "GET",
|
|
4434
4614
|
path: "/change-requests/page",
|
|
4435
4615
|
tags: ["Change Requests"],
|
|
4436
4616
|
summary: "List a numbered change request page",
|
|
4437
|
-
successDescription: "A random-access page of change requests plus the total across the whole filter. Same `status`
|
|
4617
|
+
successDescription: "A random-access page of change requests plus the total across the whole filter. Same `status`, `mine`, and `affectsNodeId` filters as the cursor listing."
|
|
4438
4618
|
}).input(listChangeRequestsPageInputSchema).output(listChangeRequestsPageResponseSchema),
|
|
4619
|
+
inboxSnapshot: oc.input(inboxSnapshotInputSchema).output(inboxSnapshotResponseSchema),
|
|
4439
4620
|
counts: oc.route({
|
|
4440
4621
|
method: "GET",
|
|
4441
4622
|
path: "/change-requests/counts",
|
|
@@ -4486,94 +4667,6 @@ const busabaseContractRoutes = {
|
|
|
4486
4667
|
views: viewContract
|
|
4487
4668
|
};
|
|
4488
4669
|
oc.prefix("/api/v1").router(busabaseContractRoutes);
|
|
4489
|
-
const EMBED_LINK_MAX_MINUTES = 1440;
|
|
4490
|
-
const EmbedNodeTypeSchema = z.enum([
|
|
4491
|
-
"base",
|
|
4492
|
-
"doc",
|
|
4493
|
-
"file",
|
|
4494
|
-
"drive",
|
|
4495
|
-
"skill",
|
|
4496
|
-
"folder",
|
|
4497
|
-
"airapp"
|
|
4498
|
-
]);
|
|
4499
|
-
const EmbedFrameModeSchema = z.enum([
|
|
4500
|
-
"anywhere",
|
|
4501
|
-
"origins",
|
|
4502
|
-
"top-level-only"
|
|
4503
|
-
]);
|
|
4504
|
-
const EmbedAllowedOriginSchema = z.string().trim().min(1).superRefine((value, ctx) => {
|
|
4505
|
-
let url;
|
|
4506
|
-
try {
|
|
4507
|
-
url = new URL(value);
|
|
4508
|
-
} catch {
|
|
4509
|
-
ctx.addIssue({
|
|
4510
|
-
code: "custom",
|
|
4511
|
-
message: "Allowed origins must be valid URLs"
|
|
4512
|
-
});
|
|
4513
|
-
return;
|
|
4514
|
-
}
|
|
4515
|
-
const isLocalHttp = url.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]");
|
|
4516
|
-
if (url.protocol !== "https:" && !isLocalHttp) ctx.addIssue({
|
|
4517
|
-
code: "custom",
|
|
4518
|
-
message: "Allowed origins must use HTTPS"
|
|
4519
|
-
});
|
|
4520
|
-
if (url.username || url.password || url.pathname !== "/" || url.search || url.hash || url.hostname.includes("*")) ctx.addIssue({
|
|
4521
|
-
code: "custom",
|
|
4522
|
-
message: "Allowed origins must be exact origins"
|
|
4523
|
-
});
|
|
4524
|
-
}).transform((value) => new URL(value).origin);
|
|
4525
|
-
const EmbedFramePolicyInputSchema = z.discriminatedUnion("mode", [
|
|
4526
|
-
z.object({
|
|
4527
|
-
mode: z.literal("anywhere"),
|
|
4528
|
-
allowedOrigins: z.array(EmbedAllowedOriginSchema).max(0).optional()
|
|
4529
|
-
}),
|
|
4530
|
-
z.object({
|
|
4531
|
-
mode: z.literal("origins"),
|
|
4532
|
-
allowedOrigins: z.array(EmbedAllowedOriginSchema).min(1).max(20)
|
|
4533
|
-
}),
|
|
4534
|
-
z.object({
|
|
4535
|
-
mode: z.literal("top-level-only"),
|
|
4536
|
-
allowedOrigins: z.array(EmbedAllowedOriginSchema).max(0).optional()
|
|
4537
|
-
})
|
|
4538
|
-
]).transform((policy) => ({
|
|
4539
|
-
mode: policy.mode,
|
|
4540
|
-
allowedOrigins: [...new Set(policy.allowedOrigins ?? [])]
|
|
4541
|
-
}));
|
|
4542
|
-
const EmbedFramePolicyVOSchema = z.object({
|
|
4543
|
-
mode: EmbedFrameModeSchema,
|
|
4544
|
-
allowedOrigins: z.array(z.string().url())
|
|
4545
|
-
}).superRefine((policy, ctx) => {
|
|
4546
|
-
if (!(policy.mode === "origins" ? policy.allowedOrigins.length > 0 : policy.allowedOrigins.length === 0)) ctx.addIssue({
|
|
4547
|
-
code: "custom",
|
|
4548
|
-
message: "Stored frame policy is invalid"
|
|
4549
|
-
});
|
|
4550
|
-
});
|
|
4551
|
-
const CreateEmbedLinkInputSchema = z.object({
|
|
4552
|
-
nodeId: z.string().min(1),
|
|
4553
|
-
expiresInMinutes: z.number().int().min(1).max(EMBED_LINK_MAX_MINUTES).optional().default(15),
|
|
4554
|
-
framePolicy: EmbedFramePolicyInputSchema.optional().default({
|
|
4555
|
-
mode: "anywhere",
|
|
4556
|
-
allowedOrigins: []
|
|
4557
|
-
})
|
|
4558
|
-
});
|
|
4559
|
-
const ListEmbedLinksInputSchema = z.object({ nodeId: z.string().min(1).optional() }).optional().default({});
|
|
4560
|
-
const RevokeEmbedLinkInputSchema = z.object({ id: z.string().min(1) });
|
|
4561
|
-
const EmbedLinkVOSchema = z.object({
|
|
4562
|
-
id: z.string(),
|
|
4563
|
-
nodeId: z.string(),
|
|
4564
|
-
nodeName: z.string(),
|
|
4565
|
-
nodeType: EmbedNodeTypeSchema,
|
|
4566
|
-
createdAt: z.string().datetime(),
|
|
4567
|
-
expiresAt: z.string().datetime(),
|
|
4568
|
-
revokedAt: z.string().datetime().nullable(),
|
|
4569
|
-
active: z.boolean(),
|
|
4570
|
-
framePolicy: EmbedFramePolicyVOSchema
|
|
4571
|
-
});
|
|
4572
|
-
const CreatedEmbedLinkVOSchema = EmbedLinkVOSchema.extend({
|
|
4573
|
-
url: z.string().url(),
|
|
4574
|
-
iframeUrl: z.string().url()
|
|
4575
|
-
});
|
|
4576
|
-
const RevokeEmbedLinkVOSchema = z.object({ revoked: z.literal(true) });
|
|
4577
4670
|
//#endregion
|
|
4578
4671
|
//#region ../../packages/busabase-contract/src/contract/cloud.ts
|
|
4579
4672
|
/**
|
|
@@ -4629,25 +4722,7 @@ const notFoundErrors = { NOT_FOUND: {
|
|
|
4629
4722
|
message: "Not Found",
|
|
4630
4723
|
data: ErrorResponseSchema
|
|
4631
4724
|
} };
|
|
4632
|
-
const
|
|
4633
|
-
BAD_REQUEST: {
|
|
4634
|
-
status: 400,
|
|
4635
|
-
message: "Bad Request",
|
|
4636
|
-
data: ErrorResponseSchema
|
|
4637
|
-
},
|
|
4638
|
-
...authenticatedErrors,
|
|
4639
|
-
FORBIDDEN: {
|
|
4640
|
-
status: 403,
|
|
4641
|
-
message: "Forbidden",
|
|
4642
|
-
data: ErrorResponseSchema
|
|
4643
|
-
},
|
|
4644
|
-
...notFoundErrors
|
|
4645
|
-
};
|
|
4646
|
-
const securedRoute = (operation) => ({
|
|
4647
|
-
...operation,
|
|
4648
|
-
security: [{ bearerAuth: [] }]
|
|
4649
|
-
});
|
|
4650
|
-
const { vault: _localVault, ...cloudWorkbenchRoutes } = busabaseContractRoutes;
|
|
4725
|
+
const { embedLinks: _embedLinksAlreadyPublishedAtRoot, vault: _localVault, ...cloudWorkbenchRoutes } = busabaseContractRoutes;
|
|
4651
4726
|
const cloudExtraRoutes = {
|
|
4652
4727
|
system: {
|
|
4653
4728
|
health: oc.route({
|
|
@@ -4712,32 +4787,7 @@ const cloudExtraRoutes = {
|
|
|
4712
4787
|
...notFoundErrors
|
|
4713
4788
|
}).input(z.object({ params: z.object({ id: z.string() }) })).output(AgentTaskDetailSchema)
|
|
4714
4789
|
},
|
|
4715
|
-
embedLinks:
|
|
4716
|
-
create: oc.route({
|
|
4717
|
-
method: "POST",
|
|
4718
|
-
path: "/embed-links",
|
|
4719
|
-
tags: ["Embed Links"],
|
|
4720
|
-
summary: "Create a short-lived read-only embed link for one node",
|
|
4721
|
-
successDescription: "The capability URL is returned once; only its secret hash is stored.",
|
|
4722
|
-
spec: securedRoute
|
|
4723
|
-
}).errors(embedLinksErrors).input(CreateEmbedLinkInputSchema).output(CreatedEmbedLinkVOSchema),
|
|
4724
|
-
list: oc.route({
|
|
4725
|
-
method: "GET",
|
|
4726
|
-
path: "/embed-links",
|
|
4727
|
-
tags: ["Embed Links"],
|
|
4728
|
-
summary: "List embed links the caller can manage",
|
|
4729
|
-
successDescription: "Embed link metadata without capability secrets.",
|
|
4730
|
-
spec: securedRoute
|
|
4731
|
-
}).errors(embedLinksErrors).input(ListEmbedLinksInputSchema).output(z.array(EmbedLinkVOSchema)),
|
|
4732
|
-
revoke: oc.route({
|
|
4733
|
-
method: "DELETE",
|
|
4734
|
-
path: "/embed-links/{id}",
|
|
4735
|
-
tags: ["Embed Links"],
|
|
4736
|
-
summary: "Revoke an embed link",
|
|
4737
|
-
successDescription: "The capability stops resolving immediately.",
|
|
4738
|
-
spec: securedRoute
|
|
4739
|
-
}).errors(embedLinksErrors).input(RevokeEmbedLinkInputSchema).output(RevokeEmbedLinkVOSchema)
|
|
4740
|
-
}
|
|
4790
|
+
embedLinks: busabaseContractRoutes.embedLinks
|
|
4741
4791
|
};
|
|
4742
4792
|
const cloudContract = oc.prefix("/api/v1").router({
|
|
4743
4793
|
...cloudWorkbenchRoutes,
|
|
@@ -4766,6 +4816,7 @@ function resolveConfig(config = {}) {
|
|
|
4766
4816
|
webUrl: normalizeBaseUrl(config.webUrl ?? env("BUSABASE_WEB_URL") ?? baseUrl),
|
|
4767
4817
|
apiKey: config.apiKey ?? env("BUSABASE_API_KEY"),
|
|
4768
4818
|
spaceId: config.spaceId ?? env("BUSABASE_SPACE_ID"),
|
|
4819
|
+
sourceChannel: config.sourceChannel ?? "sdk",
|
|
4769
4820
|
headers: config.headers,
|
|
4770
4821
|
fetch: config.fetch
|
|
4771
4822
|
};
|
|
@@ -4836,6 +4887,7 @@ function createBusabaseClient(config = {}) {
|
|
|
4836
4887
|
return {
|
|
4837
4888
|
...resolved.apiKey ? { authorization: `Bearer ${resolved.apiKey}` } : {},
|
|
4838
4889
|
...resolved.spaceId ? { "x-busabase-space": resolved.spaceId } : {},
|
|
4890
|
+
"x-busabase-channel": resolved.sourceChannel ?? "sdk",
|
|
4839
4891
|
...extra
|
|
4840
4892
|
};
|
|
4841
4893
|
}
|
|
@@ -5022,7 +5074,7 @@ var Busabase = class {
|
|
|
5022
5074
|
* This is the *authenticated*, durable link: it never expires, but the reader
|
|
5023
5075
|
* needs a session unless the node has public sharing enabled. For a no-login
|
|
5024
5076
|
* link, mint a Cloud embed link instead —
|
|
5025
|
-
* `bb.embedLinks.create({ nodeId })` returns `{ url, iframeUrl }`.
|
|
5077
|
+
* `bb.embedLinks.create({ type: "node", typeId: nodeId })` returns `{ url, iframeUrl }`.
|
|
5026
5078
|
*
|
|
5027
5079
|
* @example
|
|
5028
5080
|
* ```ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "busabase-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Typed TypeScript/JavaScript SDK for the Busabase OpenAPI REST API. Talks to a local or remote `busabase server` (or Busabase Cloud).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/busabase/busabase/tree/main/apps/busabase-sdk",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"tsx": "^4.20.5",
|
|
64
64
|
"typescript": "^7.0.2",
|
|
65
65
|
"vitest": "^4.1.11",
|
|
66
|
-
"busabase-contract": "0.
|
|
66
|
+
"busabase-contract": "0.20.0",
|
|
67
67
|
"open-domains": "0.0.2",
|
|
68
68
|
"openlib": "0.1.1"
|
|
69
69
|
},
|