@bunbase-ae/js 3.3.1-next.420.2c6b78c → 3.3.1-next.421.7803b2a

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/admin.ts +31 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunbase-ae/js",
3
- "version": "3.3.1-next.420.2c6b78c",
3
+ "version": "3.3.1-next.421.7803b2a",
4
4
  "type": "module",
5
5
  "description": "TypeScript/JavaScript SDK for BunBase",
6
6
  "license": "UNLICENSED",
package/src/admin.ts CHANGED
@@ -56,6 +56,19 @@ export interface UpdateUserParams {
56
56
  is_verified?: boolean;
57
57
  role?: string | null;
58
58
  metadata?: Record<string, unknown>;
59
+ /**
60
+ * Link a phone number to this user (issue #700). Stored as a lookup hash (and
61
+ * encrypted plaintext when field encryption is configured); enables phone-OTP
62
+ * login for the number. Fails if the number is already linked to another user.
63
+ */
64
+ phone?: string;
65
+ }
66
+
67
+ export interface ProvisionPhoneUserParams {
68
+ /** Phone number to key the new user by (normalized to E.164 server-side). */
69
+ phone: string;
70
+ role?: string | null;
71
+ metadata?: Record<string, unknown>;
59
72
  }
60
73
 
61
74
  export type AccessRule = "public" | "authenticated" | "owner" | "disabled" | { role: string };
@@ -558,6 +571,24 @@ class AdminUsersClient {
558
571
  return this.http.request<AdminUser>("PATCH", `/api/v1/admin/users/${id}`, { body: params });
559
572
  }
560
573
 
574
+ /**
575
+ * Provision a new phone-keyed user (issue #700). Pre-creates an account so
576
+ * phone-OTP `verify` succeeds for the number under the allowlist login model
577
+ * (`auth_phone_otp_auto_provision: false`). Throws if the number is already
578
+ * bound to a user (409).
579
+ */
580
+ async provisionPhoneUser(params: ProvisionPhoneUserParams): Promise<AdminUser> {
581
+ return this.http.request<AdminUser>("POST", "/api/v1/admin/users", { body: params });
582
+ }
583
+
584
+ /**
585
+ * Link a phone number to an existing user (issue #700). Throws if the number
586
+ * is already bound to a different user (409).
587
+ */
588
+ async setUserPhone(id: string, phone: string): Promise<AdminUser> {
589
+ return this.http.request<AdminUser>("PATCH", `/api/v1/admin/users/${id}`, { body: { phone } });
590
+ }
591
+
561
592
  async delete(id: string): Promise<void> {
562
593
  await this.http.request<{ ok: boolean }>("DELETE", `/api/v1/admin/users/${id}`);
563
594
  }