@bunbase-ae/js 2.10.1-next.250.3e4ff22 → 2.10.1-next.252.6c5a17b

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunbase-ae/js",
3
- "version": "2.10.1-next.250.3e4ff22",
3
+ "version": "2.10.1-next.252.6c5a17b",
4
4
  "type": "module",
5
5
  "description": "TypeScript/JavaScript SDK for BunBase",
6
6
  "license": "UNLICENSED",
package/src/admin.ts CHANGED
@@ -400,6 +400,24 @@ export interface StatsResponse {
400
400
  time_series: MinuteBucket[];
401
401
  }
402
402
 
403
+ export interface TenantSummary {
404
+ tenant_id: string;
405
+ member_count: number;
406
+ }
407
+
408
+ export interface TenantMember {
409
+ user_id: string;
410
+ role: string;
411
+ created_at: number;
412
+ }
413
+
414
+ export interface AdminTenantMembership {
415
+ tenant_id: string;
416
+ user_id: string;
417
+ role: string;
418
+ created_at: number;
419
+ }
420
+
403
421
  // ─── Sub-clients ──────────────────────────────────────────────────────────────
404
422
 
405
423
  class AdminUsersClient {
@@ -1129,6 +1147,58 @@ class AdminNamedQueriesClient {
1129
1147
  }
1130
1148
  }
1131
1149
 
1150
+ // Tenant membership management — surfaces the /api/v1/admin/tenants/* endpoints
1151
+ // added in v2.5.2 (#277/#323) so operators don't need to hand-roll fetch calls
1152
+ // to onboard a tenant member.
1153
+ class AdminTenantsClient {
1154
+ constructor(private readonly http: HttpClient) {}
1155
+
1156
+ async list(): Promise<TenantSummary[]> {
1157
+ const res = await this.http.request<{ items: TenantSummary[] }>("GET", "/api/v1/admin/tenants");
1158
+ return res.items;
1159
+ }
1160
+
1161
+ async listMembers(tenantId: string): Promise<TenantMember[]> {
1162
+ const res = await this.http.request<{ items: TenantMember[] }>(
1163
+ "GET",
1164
+ `/api/v1/admin/tenants/${encodeURIComponent(tenantId)}/members`,
1165
+ );
1166
+ return res.items;
1167
+ }
1168
+
1169
+ async addMember(
1170
+ tenantId: string,
1171
+ params: { userId: string; role?: string },
1172
+ ): Promise<AdminTenantMembership> {
1173
+ const body: Record<string, unknown> = { user_id: params.userId };
1174
+ if (params.role !== undefined) body.role = params.role;
1175
+ return this.http.request<AdminTenantMembership>(
1176
+ "POST",
1177
+ `/api/v1/admin/tenants/${encodeURIComponent(tenantId)}/members`,
1178
+ { body },
1179
+ );
1180
+ }
1181
+
1182
+ async setMemberRole(
1183
+ tenantId: string,
1184
+ userId: string,
1185
+ role: string,
1186
+ ): Promise<AdminTenantMembership> {
1187
+ return this.http.request<AdminTenantMembership>(
1188
+ "PATCH",
1189
+ `/api/v1/admin/tenants/${encodeURIComponent(tenantId)}/members/${encodeURIComponent(userId)}`,
1190
+ { body: { role } },
1191
+ );
1192
+ }
1193
+
1194
+ async removeMember(tenantId: string, userId: string): Promise<void> {
1195
+ await this.http.request<{ ok: boolean }>(
1196
+ "DELETE",
1197
+ `/api/v1/admin/tenants/${encodeURIComponent(tenantId)}/members/${encodeURIComponent(userId)}`,
1198
+ );
1199
+ }
1200
+ }
1201
+
1132
1202
  // ─── Main AdminClient ─────────────────────────────────────────────────────────
1133
1203
 
1134
1204
  export class AdminClient {
@@ -1143,6 +1213,7 @@ export class AdminClient {
1143
1213
  readonly queries: AdminNamedQueriesClient;
1144
1214
  readonly logs: AdminLogsClient;
1145
1215
  readonly system: AdminSystemClient;
1216
+ readonly tenants: AdminTenantsClient;
1146
1217
 
1147
1218
  constructor(http: HttpClient) {
1148
1219
  this.users = new AdminUsersClient(http);
@@ -1156,5 +1227,6 @@ export class AdminClient {
1156
1227
  this.queries = new AdminNamedQueriesClient(http);
1157
1228
  this.logs = new AdminLogsClient(http);
1158
1229
  this.system = new AdminSystemClient(http);
1230
+ this.tenants = new AdminTenantsClient(http);
1159
1231
  }
1160
1232
  }
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ export {
7
7
  type AdminRecord,
8
8
  type AdminSession,
9
9
  type AdminStoredFile,
10
+ type AdminTenantMembership,
10
11
  type AdminUser,
11
12
  type BackupDestinationConfig,
12
13
  type BackupFile,
@@ -38,6 +39,8 @@ export {
38
39
  type StatsResponse,
39
40
  type StorageBucket,
40
41
  type TemplateName,
42
+ type TenantMember,
43
+ type TenantSummary,
41
44
  type UpdateNamedQueryInput,
42
45
  type UpdateUserParams,
43
46
  type WebhookLogRow,