@doany-ai/sdk 0.2.8 → 0.3.0-alpha.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.
@@ -0,0 +1,62 @@
1
+ import type { Page, PageParams } from "./project.types";
2
+ /**
3
+ * An account of the site's business, as account management shows it: the
4
+ * account's public fields (plus any custom fields saved with `auth.updateMe`)
5
+ * and how it signs in.
6
+ */
7
+ export interface UserRecord {
8
+ id: string;
9
+ email: string;
10
+ full_name: string | null;
11
+ /** `user`, `admin`, or a role the site defines. */
12
+ role: string;
13
+ /** Whether the email is verified. */
14
+ verified: boolean;
15
+ created_date: string | null;
16
+ updated_date: string | null;
17
+ status: "active" | "disabled";
18
+ /** `unknown`: an account migrated without a password. */
19
+ created_via: "email" | "oauth" | "invite" | "preview" | "unknown";
20
+ /** The account's own contact; may be empty until its email is verified. */
21
+ contact_id: string | null;
22
+ /** The site it signed up on. */
23
+ app_id: string | null;
24
+ last_signed_in_at: string | null;
25
+ /** e.g. `["email", "google"]`. */
26
+ login_methods: string[];
27
+ /** Custom fields saved with `auth.updateMe`. */
28
+ [field: string]: unknown;
29
+ }
30
+ export interface UserListParams extends PageParams {
31
+ /** Part of the email or name. */
32
+ q?: string;
33
+ status?: "active" | "disabled";
34
+ /** Accounts linked to this contact. */
35
+ contact_id?: string;
36
+ /** Accounts that signed up on this site. */
37
+ app_id?: string;
38
+ }
39
+ /**
40
+ * The site's accounts.
41
+ *
42
+ * `list` / `get` show a signed-in account only itself; the site's admin and
43
+ * service callers see every account. Disabling, enabling and setting the
44
+ * contact take the site's admin account or a service credential.
45
+ */
46
+ export interface UsersModule {
47
+ /**
48
+ * Invites someone by email; they set a password from the link they get.
49
+ * Only the site's admin (or a service caller) may invite an admin.
50
+ */
51
+ inviteUser(user_email: string, role: "user" | "admin"): Promise<any>;
52
+ list(params?: UserListParams): Promise<Page<UserRecord>>;
53
+ get(userId: string): Promise<UserRecord>;
54
+ /** The account can no longer sign in, and the tokens it holds stop working. */
55
+ disable(userId: string): Promise<UserRecord>;
56
+ enable(userId: string): Promise<UserRecord>;
57
+ /**
58
+ * Makes a contact the account's own (it sees that contact's orders and buys
59
+ * as it); `null` unlinks. For correcting an automatic link that went wrong.
60
+ */
61
+ setContact(userId: string, contactId: string | null): Promise<UserRecord>;
62
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doany-ai/sdk",
3
- "version": "0.2.8",
3
+ "version": "0.3.0-alpha.0",
4
4
  "description": "JavaScript SDK for the doany app platform (API-compatible fork of @base44/sdk)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",