@rebasepro/types 0.34.2 → 0.35.1
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/controllers/client.d.ts +23 -1
- package/dist/index.es.js +458 -2316
- package/dist/index.es.js.map +1 -1
- package/dist/schema/column_options.d.ts +6 -0
- package/dist/schema/columns.d.ts +12 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/rpc.d.ts +148 -0
- package/dist/types/backend.d.ts +86 -0
- package/dist/types/database_adapter.d.ts +7 -1
- package/dist/types/project_manifest.d.ts +198 -0
- package/dist/types/storage_authorize.d.ts +54 -0
- package/dist/users/import.d.ts +123 -0
- package/dist/users/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Importing accounts from another system: `POST /admin/users/import`,
|
|
3
|
+
* `client.admin.importUsers()` and `rebase users import`.
|
|
4
|
+
*
|
|
5
|
+
* An import keeps the ids the accounts had, so every row that points at a user
|
|
6
|
+
* still points at the same one. It carries no password and sends no email: an
|
|
7
|
+
* imported account signs in by magic link, an email code, a provider, or a
|
|
8
|
+
* password reset.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The most accounts one `POST /admin/users/import` takes. The CLI sends a
|
|
12
|
+
* longer file in requests of this size.
|
|
13
|
+
*
|
|
14
|
+
* @group Admin
|
|
15
|
+
*/
|
|
16
|
+
export declare const MAX_USERS_PER_IMPORT = 100;
|
|
17
|
+
/**
|
|
18
|
+
* The longest id an imported account may keep.
|
|
19
|
+
*
|
|
20
|
+
* @group Admin
|
|
21
|
+
*/
|
|
22
|
+
export declare const MAX_IMPORTED_USER_ID_LENGTH = 128;
|
|
23
|
+
/**
|
|
24
|
+
* Why `id` cannot be kept as an imported account's id, or `undefined` when it
|
|
25
|
+
* can.
|
|
26
|
+
*
|
|
27
|
+
* A uuid is the common case (Supabase, Cognito). Other systems' ids fit too:
|
|
28
|
+
* letters, digits and `_ - . : |`, starting with a letter or a digit, at most
|
|
29
|
+
* {@link MAX_IMPORTED_USER_ID_LENGTH} characters (Firebase's 28-character
|
|
30
|
+
* uids, Auth0's `auth0|5f7c…`, Clerk's `user_2abc…`). Refused: what would read
|
|
31
|
+
* as something else on the way through a URL, a storage path or a CLI argument
|
|
32
|
+
* (`/`, `?`, `%`, whitespace, `@`, which the CLI reads as an email), and the
|
|
33
|
+
* ids that already name a caller who is not an account (`service`,
|
|
34
|
+
* `anonymous`).
|
|
35
|
+
*
|
|
36
|
+
* The users table's id column has the last word: a uuid column refuses an id
|
|
37
|
+
* that is not a uuid.
|
|
38
|
+
*
|
|
39
|
+
* @group Admin
|
|
40
|
+
*/
|
|
41
|
+
export declare function importedUserIdProblem(id: unknown): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* One account to import.
|
|
44
|
+
*
|
|
45
|
+
* @group Admin
|
|
46
|
+
*/
|
|
47
|
+
export interface ImportUserInput {
|
|
48
|
+
/**
|
|
49
|
+
* The id the account had in the system it comes from, kept as its id here.
|
|
50
|
+
* Omitted, the users table generates one. See {@link importedUserIdProblem}.
|
|
51
|
+
*/
|
|
52
|
+
id?: string;
|
|
53
|
+
email: string;
|
|
54
|
+
displayName?: string;
|
|
55
|
+
photoUrl?: string;
|
|
56
|
+
/** When the account was created in the system it comes from, as an ISO 8601 date. Omitted: now. */
|
|
57
|
+
createdAt?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Whether that system had confirmed the address. Omitted: `false`, and the
|
|
60
|
+
* first magic link or reset the account follows confirms it. An unconfirmed
|
|
61
|
+
* account cannot be signed into by a provider (Google, GitHub) until then.
|
|
62
|
+
*/
|
|
63
|
+
emailVerified?: boolean;
|
|
64
|
+
/** Role names, as `POST /admin/users` takes them. No caller may grant a role above its own. */
|
|
65
|
+
roles?: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The body of `POST /admin/users/import`.
|
|
69
|
+
*
|
|
70
|
+
* @group Admin
|
|
71
|
+
*/
|
|
72
|
+
export interface ImportUsersRequest {
|
|
73
|
+
/** At most {@link MAX_USERS_PER_IMPORT}. */
|
|
74
|
+
users: ImportUserInput[];
|
|
75
|
+
/** Check every account and report what would happen, writing nothing. */
|
|
76
|
+
dryRun?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* What happened to one account of an import. `index` is its place in the
|
|
80
|
+
* request's `users`.
|
|
81
|
+
*
|
|
82
|
+
* - `created`: the account exists now (with `dryRun`, it would be created).
|
|
83
|
+
* - `skipped`: an account already holds the id (`ID_EXISTS`) or the email
|
|
84
|
+
* (`EMAIL_EXISTS`), an earlier one in this request included. It is left as
|
|
85
|
+
* it is: an import never updates an account.
|
|
86
|
+
* - `failed`: the account was refused, and `code` and `message` say why.
|
|
87
|
+
*
|
|
88
|
+
* @group Admin
|
|
89
|
+
*/
|
|
90
|
+
export type ImportUserOutcome = {
|
|
91
|
+
index: number;
|
|
92
|
+
status: "created";
|
|
93
|
+
uid?: string;
|
|
94
|
+
email: string;
|
|
95
|
+
} | {
|
|
96
|
+
index: number;
|
|
97
|
+
status: "skipped";
|
|
98
|
+
uid?: string;
|
|
99
|
+
email: string;
|
|
100
|
+
code: "ID_EXISTS" | "EMAIL_EXISTS";
|
|
101
|
+
message: string;
|
|
102
|
+
} | {
|
|
103
|
+
index: number;
|
|
104
|
+
status: "failed";
|
|
105
|
+
uid?: string;
|
|
106
|
+
email?: string;
|
|
107
|
+
code: string;
|
|
108
|
+
message: string;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* The answer of `POST /admin/users/import`: one outcome per account, in the
|
|
112
|
+
* order they were sent, and how many of each.
|
|
113
|
+
*
|
|
114
|
+
* @group Admin
|
|
115
|
+
*/
|
|
116
|
+
export interface ImportUsersResult {
|
|
117
|
+
/** Nothing was written: `created` counts the accounts that would be. */
|
|
118
|
+
dryRun: boolean;
|
|
119
|
+
created: number;
|
|
120
|
+
skipped: number;
|
|
121
|
+
failed: number;
|
|
122
|
+
results: ImportUserOutcome[];
|
|
123
|
+
}
|
package/dist/users/index.d.ts
CHANGED