@veroxm/sdk 1.7.0 → 1.9.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/CHANGELOG.md +16 -0
- package/dist/auth.d.ts +32 -6
- package/dist/auth.js +31 -9
- package/dist/content.d.ts +9 -4
- package/dist/content.js +12 -7
- package/dist/generated/api.d.ts +139 -17
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.0
|
|
4
|
+
|
|
5
|
+
- Bot protection (public API 2.12): `auth.getConfig()` says what a sign-in page should show (sign-up, social sign-in,
|
|
6
|
+
passkeys, and `botProtection`: the captcha provider, its site key, which forms need it, the honeypot and timing).
|
|
7
|
+
`signUp`, `signInWithEmail` and `requestPasswordReset` take a `BotCheck`: `botToken` (the Turnstile, hCaptcha or
|
|
8
|
+
reCAPTCHA v3 token), `website` (the hidden honeypot field) and `formStartedAt` (sent as `formElapsedMs`, so the
|
|
9
|
+
device's clock doesn't matter). Refusals are `VeroXMApiError`s with code `bot_check_required`, `bot_check_failed` or
|
|
10
|
+
`bot_check_unavailable`.
|
|
11
|
+
|
|
12
|
+
## 1.8.0
|
|
13
|
+
|
|
14
|
+
- Writes to database content models (public API 2.11): `create`, `update` and `delete` work on a model that allows
|
|
15
|
+
them, with its writable fields. `update(id)` and `delete(id)` take a text key too, and all three take `userId` and
|
|
16
|
+
`ctx` (sent as `?userId=` and `?ctx.<name>=`) for a model limited to the caller's rows, from a project key on your
|
|
17
|
+
server.
|
|
18
|
+
|
|
3
19
|
## 1.7.0
|
|
4
20
|
|
|
5
21
|
- Database content models (public API 2.10): `app.content(slug)` reads them like any collection; their entries come
|
package/dist/auth.d.ts
CHANGED
|
@@ -15,6 +15,22 @@ export type EmailCode = {
|
|
|
15
15
|
export type Account = Schemas['Account'];
|
|
16
16
|
/** A social sign-in option to show a button for. */
|
|
17
17
|
export type SocialProvider = Schemas['SocialProvider'];
|
|
18
|
+
/** What a sign-in page should show, from `getConfig()`: sign-up, social sign-in, passkeys and the bot check. */
|
|
19
|
+
export type AuthConfig = Schemas['AuthConfig'];
|
|
20
|
+
/** The bot check a project wants on its forms: the captcha provider and site key, the honeypot and timing. */
|
|
21
|
+
export type BotProtectionConfig = Schemas['BotProtectionConfig'];
|
|
22
|
+
/**
|
|
23
|
+
* Bot protection fields for sign-up, email sign-in and password reset, when the project has them on (see
|
|
24
|
+
* `getConfig().botProtection`). All optional.
|
|
25
|
+
*/
|
|
26
|
+
export interface BotCheck {
|
|
27
|
+
/** The captcha widget's token (Turnstile, hCaptcha or reCAPTCHA v3). Each token works once: get a new one per try. */
|
|
28
|
+
botToken?: string;
|
|
29
|
+
/** The honeypot: the value of the hidden `website` field, which people leave empty. */
|
|
30
|
+
website?: string;
|
|
31
|
+
/** When the form was shown (`Date.now()` then). Sent as how long it was on screen, so the device's clock doesn't matter. */
|
|
32
|
+
formStartedAt?: number;
|
|
33
|
+
}
|
|
18
34
|
/** The signed-in person's two-step sign-in and passkeys, from `twoStep()`. */
|
|
19
35
|
export type TwoStepStatus = Schemas['TwoStepStatus'];
|
|
20
36
|
/** A passkey on the person's account. */
|
|
@@ -77,20 +93,22 @@ export declare class VeroXMAuth {
|
|
|
77
93
|
signInWithCredentials(username: string, password: string): Promise<AuthUser | null>;
|
|
78
94
|
/**
|
|
79
95
|
* Signs in a built-in account with its email and password. Throws VeroXMApiError with code `email_not_verified` until
|
|
80
|
-
* the email is confirmed, and VeroXMTwoStepRequiredError when the person has two-step sign-in on.
|
|
96
|
+
* the email is confirmed, and VeroXMTwoStepRequiredError when the person has two-step sign-in on. Pass `bot` when the
|
|
97
|
+
* project's bot protection covers sign-in (codes `bot_check_required`, `bot_check_failed`, `bot_check_unavailable`).
|
|
81
98
|
*/
|
|
82
|
-
signInWithEmail(email: string, password: string): Promise<AuthUser | null>;
|
|
99
|
+
signInWithEmail(email: string, password: string, bot?: BotCheck): Promise<AuthUser | null>;
|
|
83
100
|
/** Signs out here: the refresh token is revoked on the server too (best effort), and the stored session cleared. */
|
|
84
101
|
signOut(): Promise<void>;
|
|
85
102
|
/**
|
|
86
103
|
* Creates an account. When the project wants emails confirmed, resolves `{ verificationSent: true }` and the person
|
|
87
|
-
* gets a 6-digit code (finish with `verifyEmail`); otherwise they're signed in and it resolves `{ user }`.
|
|
104
|
+
* gets a 6-digit code (finish with `verifyEmail`); otherwise they're signed in and it resolves `{ user }`. Add the
|
|
105
|
+
* `BotCheck` fields when the project's bot protection covers sign-up.
|
|
88
106
|
*/
|
|
89
107
|
signUp(input: {
|
|
90
108
|
email: string;
|
|
91
109
|
password: string;
|
|
92
110
|
name?: string;
|
|
93
|
-
}): Promise<{
|
|
111
|
+
} & BotCheck): Promise<{
|
|
94
112
|
verificationSent: true;
|
|
95
113
|
} | {
|
|
96
114
|
user: AuthUser | null;
|
|
@@ -99,8 +117,16 @@ export declare class VeroXMAuth {
|
|
|
99
117
|
verifyEmail(input: EmailCode): Promise<AuthUser | null>;
|
|
100
118
|
/** Sends a new confirmation code. Resolves the same whether or not the address has an account. */
|
|
101
119
|
resendVerification(email: string): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Emails a password reset code. Resolves the same whether or not the address has an account. Pass `bot` when the
|
|
122
|
+
* project's bot protection covers password reset.
|
|
123
|
+
*/
|
|
124
|
+
requestPasswordReset(email: string, bot?: BotCheck): Promise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* What a sign-in page should show: whether people can sign up, the social sign-in buttons, passkeys, and the bot
|
|
127
|
+
* check to render (`botProtection`: the provider, its site key, which forms need it, the honeypot and timing).
|
|
128
|
+
*/
|
|
129
|
+
getConfig(): Promise<AuthConfig>;
|
|
104
130
|
/** Sets a new password with the reset code (or the link's token), signs out every other device, and signs in here. */
|
|
105
131
|
resetPassword(input: EmailCode & {
|
|
106
132
|
password: string;
|
package/dist/auth.js
CHANGED
|
@@ -2,6 +2,16 @@ import { rawRequest } from './http.js';
|
|
|
2
2
|
import { VeroXMNotAuthenticatedError } from './errors.js';
|
|
3
3
|
import { createPkce, randomString } from './pkce.js';
|
|
4
4
|
import { browserPasskeys } from './passkeys.js';
|
|
5
|
+
/** The fields as the API takes them. */
|
|
6
|
+
function botFields(bot) {
|
|
7
|
+
if (!bot)
|
|
8
|
+
return {};
|
|
9
|
+
return {
|
|
10
|
+
...(bot.botToken ? { botToken: bot.botToken } : {}),
|
|
11
|
+
...(bot.website !== undefined ? { website: bot.website } : {}),
|
|
12
|
+
...(typeof bot.formStartedAt === 'number' ? { formElapsedMs: Math.max(0, Date.now() - bot.formStartedAt) } : {}),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
5
15
|
function defaultPendingStore() {
|
|
6
16
|
try {
|
|
7
17
|
if (typeof window !== 'undefined' && window.sessionStorage) {
|
|
@@ -69,11 +79,11 @@ export class VeroXMAuth {
|
|
|
69
79
|
}
|
|
70
80
|
/**
|
|
71
81
|
* Signs in a built-in account with its email and password. Throws VeroXMApiError with code `email_not_verified` until
|
|
72
|
-
* the email is confirmed, and VeroXMTwoStepRequiredError when the person has two-step sign-in on.
|
|
82
|
+
* the email is confirmed, and VeroXMTwoStepRequiredError when the person has two-step sign-in on. Pass `bot` when the
|
|
83
|
+
* project's bot protection covers sign-in (codes `bot_check_required`, `bot_check_failed`, `bot_check_unavailable`).
|
|
73
84
|
*/
|
|
74
|
-
async signInWithEmail(email, password) {
|
|
75
|
-
|
|
76
|
-
return this.currentUser();
|
|
85
|
+
async signInWithEmail(email, password, bot) {
|
|
86
|
+
return this.signInWith('/auth/token', { username: email, password, ...botFields(bot) });
|
|
77
87
|
}
|
|
78
88
|
/** Signs out here: the refresh token is revoked on the server too (best effort), and the stored session cleared. */
|
|
79
89
|
async signOut() {
|
|
@@ -91,10 +101,12 @@ export class VeroXMAuth {
|
|
|
91
101
|
// ------------------------------------------------------------------ built-in accounts
|
|
92
102
|
/**
|
|
93
103
|
* Creates an account. When the project wants emails confirmed, resolves `{ verificationSent: true }` and the person
|
|
94
|
-
* gets a 6-digit code (finish with `verifyEmail`); otherwise they're signed in and it resolves `{ user }`.
|
|
104
|
+
* gets a 6-digit code (finish with `verifyEmail`); otherwise they're signed in and it resolves `{ user }`. Add the
|
|
105
|
+
* `BotCheck` fields when the project's bot protection covers sign-up.
|
|
95
106
|
*/
|
|
96
107
|
async signUp(input) {
|
|
97
|
-
const
|
|
108
|
+
const { botToken, website, formStartedAt, ...account } = input;
|
|
109
|
+
const data = (await this.post('/auth/signup', { ...account, ...botFields({ botToken, website, formStartedAt }) }));
|
|
98
110
|
if ('accessToken' in data) {
|
|
99
111
|
await this.persistSession(data);
|
|
100
112
|
return { user: this.currentUser() };
|
|
@@ -109,9 +121,19 @@ export class VeroXMAuth {
|
|
|
109
121
|
async resendVerification(email) {
|
|
110
122
|
await this.post('/auth/verify/resend', { email });
|
|
111
123
|
}
|
|
112
|
-
/**
|
|
113
|
-
|
|
114
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Emails a password reset code. Resolves the same whether or not the address has an account. Pass `bot` when the
|
|
126
|
+
* project's bot protection covers password reset.
|
|
127
|
+
*/
|
|
128
|
+
async requestPasswordReset(email, bot) {
|
|
129
|
+
await this.post('/auth/password/forgot', { email, ...botFields(bot) });
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* What a sign-in page should show: whether people can sign up, the social sign-in buttons, passkeys, and the bot
|
|
133
|
+
* check to render (`botProtection`: the provider, its site key, which forms need it, the honeypot and timing).
|
|
134
|
+
*/
|
|
135
|
+
async getConfig() {
|
|
136
|
+
return (await rawRequest(this.apiBase, { path: '/auth/config' }));
|
|
115
137
|
}
|
|
116
138
|
/** Sets a new password with the reset code (or the link's token), signs out every other device, and signs in here. */
|
|
117
139
|
async resetPassword(input) {
|
package/dist/content.d.ts
CHANGED
|
@@ -68,15 +68,20 @@ export declare class ContentResource<T = Record<string, unknown>> {
|
|
|
68
68
|
get(id: number | string, options?: {
|
|
69
69
|
timestamps?: boolean;
|
|
70
70
|
} & Pick<ListOptions, 'userId' | 'ctx'>): Promise<T>;
|
|
71
|
-
/**
|
|
72
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Fields are sent flat (no wrapper). Pass `draft: true` to create without publishing; omit it (or pass false) to
|
|
73
|
+
* publish immediately. A database content model that allows creating entries takes its writable fields (and `id` when
|
|
74
|
+
* it takes the key from you); `userId` / `ctx` say whose row it is for a model limited to the caller's rows.
|
|
75
|
+
*/
|
|
76
|
+
create(data: Record<string, unknown>, options?: Pick<ListOptions, 'userId' | 'ctx'>): Promise<T>;
|
|
73
77
|
/**
|
|
74
78
|
* A partial update -- only the fields present in `data` are changed.
|
|
75
79
|
* Publish state follows the same rule as create(): omitting `draft` (or
|
|
76
80
|
* passing `draft: false`) PUBLISHES the record immediately, even if it
|
|
77
81
|
* was previously a draft and this update doesn't touch content fields.
|
|
78
82
|
* Pass `draft: true` explicitly to keep (or return) it unpublished.
|
|
83
|
+
* (A database content model has no drafts: its writable fields only.)
|
|
79
84
|
*/
|
|
80
|
-
update(id: number, data: Record<string, unknown>): Promise<T>;
|
|
81
|
-
delete(id: number): Promise<void>;
|
|
85
|
+
update(id: number | string, data: Record<string, unknown>, options?: Pick<ListOptions, 'userId' | 'ctx'>): Promise<T>;
|
|
86
|
+
delete(id: number | string, options?: Pick<ListOptions, 'userId' | 'ctx'>): Promise<void>;
|
|
82
87
|
}
|
package/dist/content.js
CHANGED
|
@@ -66,9 +66,13 @@ export class ContentResource {
|
|
|
66
66
|
query: { timestamps: options.timestamps ? '1' : undefined, ...callerQuery(options) },
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Fields are sent flat (no wrapper). Pass `draft: true` to create without publishing; omit it (or pass false) to
|
|
71
|
+
* publish immediately. A database content model that allows creating entries takes its writable fields (and `id` when
|
|
72
|
+
* it takes the key from you); `userId` / `ctx` say whose row it is for a model limited to the caller's rows.
|
|
73
|
+
*/
|
|
74
|
+
async create(data, options = {}) {
|
|
75
|
+
return this.app.request({ method: 'POST', path: this.root(), query: callerQuery(options), json: data });
|
|
72
76
|
}
|
|
73
77
|
/**
|
|
74
78
|
* A partial update -- only the fields present in `data` are changed.
|
|
@@ -76,11 +80,12 @@ export class ContentResource {
|
|
|
76
80
|
* passing `draft: false`) PUBLISHES the record immediately, even if it
|
|
77
81
|
* was previously a draft and this update doesn't touch content fields.
|
|
78
82
|
* Pass `draft: true` explicitly to keep (or return) it unpublished.
|
|
83
|
+
* (A database content model has no drafts: its writable fields only.)
|
|
79
84
|
*/
|
|
80
|
-
async update(id, data) {
|
|
81
|
-
return this.app.request({ method: 'PATCH', path: `${this.root()}/${id}`, json: data });
|
|
85
|
+
async update(id, data, options = {}) {
|
|
86
|
+
return this.app.request({ method: 'PATCH', path: `${this.root()}/${encodeURIComponent(String(id))}`, query: callerQuery(options), json: data });
|
|
82
87
|
}
|
|
83
|
-
async delete(id) {
|
|
84
|
-
await this.app.request({ method: 'DELETE', path: `${this.root()}/${id}
|
|
88
|
+
async delete(id, options = {}) {
|
|
89
|
+
await this.app.request({ method: 'DELETE', path: `${this.root()}/${encodeURIComponent(String(id))}`, query: callerQuery(options) });
|
|
85
90
|
}
|
|
86
91
|
}
|
package/dist/generated/api.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface paths {
|
|
|
10
10
|
put?: never;
|
|
11
11
|
/**
|
|
12
12
|
* Sign in with a username (or email) and password
|
|
13
|
-
* @description With two-step sign-in on for the person, answers 401 with code `two_step_required` and a `ticket` for /auth/two-step; when the project requires it and they have nothing set up, `two_step_setup_required` and a ticket for /auth/two-step/setup/...
|
|
13
|
+
* @description With two-step sign-in on for the person, answers 401 with code `two_step_required` and a `ticket` for /auth/two-step; when the project requires it and they have nothing set up, `two_step_setup_required` and a ticket for /auth/two-step/setup/... When the project's bot protection covers this form (GET /auth/config): send the captcha's `botToken`, the empty `website` honeypot, and `formElapsedMs`. No token is a 400 `bot_check_required`, a token the provider refuses a 403 `bot_check_failed`, and a 503 `bot_check_unavailable` when the provider cannot be reached (try again). A filled honeypot or a form sent too fast gets the usual answer (for sign-in, the wrong-password one), but nothing happens. It applies to signing in with an email address; usernames (API credentials, device accounts) are not asked.
|
|
14
14
|
*/
|
|
15
15
|
post: operations["signIn"];
|
|
16
16
|
delete?: never;
|
|
@@ -64,7 +64,7 @@ export interface paths {
|
|
|
64
64
|
put?: never;
|
|
65
65
|
/**
|
|
66
66
|
* Create a built-in account
|
|
67
|
-
* @description Signs the person in, or answers `{status: "verification_sent"}` when the project asks for a confirmed email first (or the address is already taken: the answer does not say which).
|
|
67
|
+
* @description Signs the person in, or answers `{status: "verification_sent"}` when the project asks for a confirmed email first (or the address is already taken: the answer does not say which). When the project's bot protection covers this form (GET /auth/config): send the captcha's `botToken`, the empty `website` honeypot, and `formElapsedMs`. No token is a 400 `bot_check_required`, a token the provider refuses a 403 `bot_check_failed`, and a 503 `bot_check_unavailable` when the provider cannot be reached (try again). A filled honeypot or a form sent too fast gets the usual answer (for sign-in, the wrong-password one), but nothing happens. The project limits sign-ups per IP address an hour (`too_many_attempts`, 429).
|
|
68
68
|
*/
|
|
69
69
|
post: operations["signUp"];
|
|
70
70
|
delete?: never;
|
|
@@ -116,7 +116,10 @@ export interface paths {
|
|
|
116
116
|
};
|
|
117
117
|
get?: never;
|
|
118
118
|
put?: never;
|
|
119
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Email a password reset code
|
|
121
|
+
* @description When the project's bot protection covers this form (GET /auth/config): send the captcha's `botToken`, the empty `website` honeypot, and `formElapsedMs`. No token is a 400 `bot_check_required`, a token the provider refuses a 403 `bot_check_failed`, and a 503 `bot_check_unavailable` when the provider cannot be reached (try again). A filled honeypot or a form sent too fast gets the usual answer (for sign-in, the wrong-password one), but nothing happens.
|
|
122
|
+
*/
|
|
120
123
|
post: operations["requestPasswordReset"];
|
|
121
124
|
delete?: never;
|
|
122
125
|
options?: never;
|
|
@@ -194,6 +197,26 @@ export interface paths {
|
|
|
194
197
|
patch?: never;
|
|
195
198
|
trace?: never;
|
|
196
199
|
};
|
|
200
|
+
"/projects/{uuid}/auth/config": {
|
|
201
|
+
parameters: {
|
|
202
|
+
query?: never;
|
|
203
|
+
header?: never;
|
|
204
|
+
path?: never;
|
|
205
|
+
cookie?: never;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* What a sign-in page should show
|
|
209
|
+
* @description Whether people can sign up, the social sign-in buttons, passkeys, and the bot check to render: the provider and its public site key, never the secret.
|
|
210
|
+
*/
|
|
211
|
+
get: operations["getAuthConfig"];
|
|
212
|
+
put?: never;
|
|
213
|
+
post?: never;
|
|
214
|
+
delete?: never;
|
|
215
|
+
options?: never;
|
|
216
|
+
head?: never;
|
|
217
|
+
patch?: never;
|
|
218
|
+
trace?: never;
|
|
219
|
+
};
|
|
197
220
|
"/projects/{uuid}/auth/social": {
|
|
198
221
|
parameters: {
|
|
199
222
|
query?: never;
|
|
@@ -540,11 +563,14 @@ export interface paths {
|
|
|
540
563
|
};
|
|
541
564
|
/**
|
|
542
565
|
* A collection's entries
|
|
543
|
-
* @description Flags are on when present (`?count`, `?timestamps`). With `count` the answer is a number. The slug can also name a database content model (entries read from a connected database): the key then also needs database:<db>:read, `filter.<field>[.<op>]=` filters, `userId=` or `ctx.<name>=` say whose rows for a model limited to the caller’s, and `state`, `locale` and `timestamps` don’t apply.
|
|
566
|
+
* @description Flags are on when present (`?count`, `?timestamps`). With `count` the answer is a number. The slug can also name a database content model (entries read from a connected database): the key then also needs database:<db>:read, `filter.<field>[.<op>]=` filters, `userId=` or `ctx.<name>=` say whose rows for a model limited to the caller’s, and `state`, `locale` and `timestamps` don’t apply. `unmask=true` returns masked fields in full and needs database:<db>:unmask (403 `forbidden` without it); each such read is marked in the database access log.
|
|
544
567
|
*/
|
|
545
568
|
get: operations["listEntries"];
|
|
546
569
|
put?: never;
|
|
547
|
-
/**
|
|
570
|
+
/**
|
|
571
|
+
* Create an entry
|
|
572
|
+
* @description A database content model takes this when it allows creating entries (405 `read_only` otherwise): the key also needs database:<db>:write, `userId=` or `ctx.<name>=` say whose row for a model limited to the caller’s (it is set to them), and the answer is the new entry as read back.
|
|
573
|
+
*/
|
|
548
574
|
post: operations["createEntry"];
|
|
549
575
|
delete?: never;
|
|
550
576
|
options?: never;
|
|
@@ -580,11 +606,17 @@ export interface paths {
|
|
|
580
606
|
get: operations["getEntry"];
|
|
581
607
|
put?: never;
|
|
582
608
|
post?: never;
|
|
583
|
-
/**
|
|
609
|
+
/**
|
|
610
|
+
* Delete an entry
|
|
611
|
+
* @description A database content model takes this when it allows deleting entries (405 `read_only` otherwise): the key also needs database:<db>:write, and only the caller’s rows are deleted. A row other rows still point at is 409 `in_use`.
|
|
612
|
+
*/
|
|
584
613
|
delete: operations["deleteEntry"];
|
|
585
614
|
options?: never;
|
|
586
615
|
head?: never;
|
|
587
|
-
/**
|
|
616
|
+
/**
|
|
617
|
+
* Change some fields of an entry
|
|
618
|
+
* @description A database content model takes this when it allows changing entries (405 `read_only` otherwise): the key also needs database:<db>:write, only the caller’s rows are changed (404 for any other), and the answer is the entry as read back.
|
|
619
|
+
*/
|
|
588
620
|
patch: operations["updateEntry"];
|
|
589
621
|
trace?: never;
|
|
590
622
|
};
|
|
@@ -769,7 +801,7 @@ export interface paths {
|
|
|
769
801
|
};
|
|
770
802
|
/**
|
|
771
803
|
* A page of rows from an exposed table of a connected database
|
|
772
|
-
* @description Needs database:<db>:read. Filters are filter.<column>=value or filter.<column>.<op>=value (eq, ne, gt, gte, lt, lte, in (comma-separated), contains, null (true/false)), on columns the table lets you filter. A table limited to the caller’s rows takes userId= or ctx.<name>= from a project key; an end user’s login is always themselves.
|
|
804
|
+
* @description Needs database:<db>:read. Filters are filter.<column>=value or filter.<column>.<op>=value (eq, ne, gt, gte, lt, lte, in (comma-separated), contains, null (true/false)), on columns the table lets you filter. A table limited to the caller’s rows takes userId= or ctx.<name>= from a project key; an end user’s login is always themselves. `unmask=true` returns masked columns in full and needs database:<db>:unmask; each such read is marked in the access log.
|
|
773
805
|
*/
|
|
774
806
|
get: operations["listDatabaseRows"];
|
|
775
807
|
put?: never;
|
|
@@ -1189,11 +1221,51 @@ export interface components {
|
|
|
1189
1221
|
kind: "google" | "microsoft" | "apple" | "oidc";
|
|
1190
1222
|
name: string;
|
|
1191
1223
|
};
|
|
1224
|
+
BotProtectionConfig: {
|
|
1225
|
+
/**
|
|
1226
|
+
* @description The captcha to show: Cloudflare Turnstile, hCaptcha or Google reCAPTCHA v3.
|
|
1227
|
+
* @enum {string}
|
|
1228
|
+
*/
|
|
1229
|
+
provider: "off" | "turnstile" | "hcaptcha" | "recaptcha";
|
|
1230
|
+
/** @description The provider's public site key, for the widget. */
|
|
1231
|
+
siteKey: string | null;
|
|
1232
|
+
/** @description The forms that need the check (and the honeypot and timing, when on). */
|
|
1233
|
+
actions: ("signup" | "signin" | "passwordReset")[];
|
|
1234
|
+
/** @description reCAPTCHA v3 only: the action name to pass to grecaptcha.execute for each form. */
|
|
1235
|
+
recaptchaActions: {
|
|
1236
|
+
signup: string;
|
|
1237
|
+
signin: string;
|
|
1238
|
+
passwordReset: string;
|
|
1239
|
+
} | null;
|
|
1240
|
+
/** @description Add a hidden `website` field to the forms and send it (empty). */
|
|
1241
|
+
honeypot: boolean;
|
|
1242
|
+
/** @description Send `formElapsedMs` with sign-up and password reset. */
|
|
1243
|
+
formTiming: boolean;
|
|
1244
|
+
};
|
|
1245
|
+
AuthConfig: {
|
|
1246
|
+
/**
|
|
1247
|
+
* @description Who can sign up: nobody by themselves (invitations), anyone, or people at some email domains.
|
|
1248
|
+
* @enum {string}
|
|
1249
|
+
*/
|
|
1250
|
+
signup: "closed" | "open" | "domains";
|
|
1251
|
+
/** @description Whether people can sign in with a passkey. */
|
|
1252
|
+
passkeys: boolean;
|
|
1253
|
+
socialProviders: components["schemas"]["SocialProvider"][];
|
|
1254
|
+
botProtection: components["schemas"]["BotProtectionConfig"];
|
|
1255
|
+
};
|
|
1256
|
+
BotFields: {
|
|
1257
|
+
/** @description The captcha widget's token, when the project has a bot check for this form (or send it as `X-VeroXM-Bot-Token`). Each token works once. */
|
|
1258
|
+
botToken?: string;
|
|
1259
|
+
/** @description The honeypot: a field hidden from people. Leave it empty. */
|
|
1260
|
+
website?: string;
|
|
1261
|
+
/** @description How long the form was on screen before it was sent, in milliseconds (Date.now() minus when it was shown). */
|
|
1262
|
+
formElapsedMs?: number;
|
|
1263
|
+
};
|
|
1192
1264
|
SignInRequest: {
|
|
1193
1265
|
username?: string;
|
|
1194
1266
|
email?: string;
|
|
1195
1267
|
password?: string;
|
|
1196
|
-
};
|
|
1268
|
+
} & components["schemas"]["BotFields"];
|
|
1197
1269
|
RefreshRequest: {
|
|
1198
1270
|
refreshToken?: string;
|
|
1199
1271
|
};
|
|
@@ -1201,7 +1273,7 @@ export interface components {
|
|
|
1201
1273
|
email?: string;
|
|
1202
1274
|
password?: string;
|
|
1203
1275
|
name?: string;
|
|
1204
|
-
};
|
|
1276
|
+
} & components["schemas"]["BotFields"];
|
|
1205
1277
|
CodeRequest: {
|
|
1206
1278
|
email?: string;
|
|
1207
1279
|
/** @description The 6-digit code from the email. */
|
|
@@ -1212,6 +1284,7 @@ export interface components {
|
|
|
1212
1284
|
EmailRequest: {
|
|
1213
1285
|
email?: string;
|
|
1214
1286
|
};
|
|
1287
|
+
ForgotPasswordRequest: components["schemas"]["EmailRequest"] & components["schemas"]["BotFields"];
|
|
1215
1288
|
ResetPasswordRequest: components["schemas"]["CodeRequest"] & {
|
|
1216
1289
|
password?: string;
|
|
1217
1290
|
};
|
|
@@ -1400,7 +1473,7 @@ export interface components {
|
|
|
1400
1473
|
/** @description One locale's entries; omitted = the default locale. */
|
|
1401
1474
|
locale?: string;
|
|
1402
1475
|
};
|
|
1403
|
-
/** @description Field values by name. `draft: true` keeps the entry unpublished; anything else publishes it. */
|
|
1476
|
+
/** @description Field values by name. `draft: true` keeps the entry unpublished; anything else publishes it. For a database content model that takes writes: only its writable fields (no `draft` or `locale`), and `id` only when the model takes the key from the caller. */
|
|
1404
1477
|
EntryWrite: {
|
|
1405
1478
|
[key: string]: unknown;
|
|
1406
1479
|
};
|
|
@@ -2110,6 +2183,7 @@ export interface operations {
|
|
|
2110
2183
|
403: components["responses"]["E403"];
|
|
2111
2184
|
404: components["responses"]["E404"];
|
|
2112
2185
|
429: components["responses"]["E429"];
|
|
2186
|
+
503: components["responses"]["E503"];
|
|
2113
2187
|
};
|
|
2114
2188
|
};
|
|
2115
2189
|
refreshSession: {
|
|
@@ -2200,6 +2274,7 @@ export interface operations {
|
|
|
2200
2274
|
404: components["responses"]["E404"];
|
|
2201
2275
|
409: components["responses"]["E409"];
|
|
2202
2276
|
429: components["responses"]["E429"];
|
|
2277
|
+
503: components["responses"]["E503"];
|
|
2203
2278
|
};
|
|
2204
2279
|
};
|
|
2205
2280
|
verifyEmail: {
|
|
@@ -2276,7 +2351,7 @@ export interface operations {
|
|
|
2276
2351
|
};
|
|
2277
2352
|
requestBody: {
|
|
2278
2353
|
content: {
|
|
2279
|
-
"application/json": components["schemas"]["
|
|
2354
|
+
"application/json": components["schemas"]["ForgotPasswordRequest"];
|
|
2280
2355
|
};
|
|
2281
2356
|
};
|
|
2282
2357
|
responses: {
|
|
@@ -2290,8 +2365,10 @@ export interface operations {
|
|
|
2290
2365
|
};
|
|
2291
2366
|
};
|
|
2292
2367
|
400: components["responses"]["E400"];
|
|
2368
|
+
403: components["responses"]["E403"];
|
|
2293
2369
|
404: components["responses"]["E404"];
|
|
2294
2370
|
429: components["responses"]["E429"];
|
|
2371
|
+
503: components["responses"]["E503"];
|
|
2295
2372
|
};
|
|
2296
2373
|
};
|
|
2297
2374
|
resetPassword: {
|
|
@@ -2480,6 +2557,30 @@ export interface operations {
|
|
|
2480
2557
|
429: components["responses"]["E429"];
|
|
2481
2558
|
};
|
|
2482
2559
|
};
|
|
2560
|
+
getAuthConfig: {
|
|
2561
|
+
parameters: {
|
|
2562
|
+
query?: never;
|
|
2563
|
+
header?: never;
|
|
2564
|
+
path: {
|
|
2565
|
+
/** @description The project's UUID. */
|
|
2566
|
+
uuid: string;
|
|
2567
|
+
};
|
|
2568
|
+
cookie?: never;
|
|
2569
|
+
};
|
|
2570
|
+
requestBody?: never;
|
|
2571
|
+
responses: {
|
|
2572
|
+
/** @description OK */
|
|
2573
|
+
200: {
|
|
2574
|
+
headers: {
|
|
2575
|
+
[name: string]: unknown;
|
|
2576
|
+
};
|
|
2577
|
+
content: {
|
|
2578
|
+
"application/json": components["schemas"]["AuthConfig"];
|
|
2579
|
+
};
|
|
2580
|
+
};
|
|
2581
|
+
404: components["responses"]["E404"];
|
|
2582
|
+
};
|
|
2583
|
+
};
|
|
2483
2584
|
listSocialProviders: {
|
|
2484
2585
|
parameters: {
|
|
2485
2586
|
query?: never;
|
|
@@ -3142,7 +3243,10 @@ export interface operations {
|
|
|
3142
3243
|
};
|
|
3143
3244
|
createEntry: {
|
|
3144
3245
|
parameters: {
|
|
3145
|
-
query?:
|
|
3246
|
+
query?: {
|
|
3247
|
+
/** @description A database content model limited to the caller's rows: whose (project keys). */
|
|
3248
|
+
userId?: string;
|
|
3249
|
+
};
|
|
3146
3250
|
header?: never;
|
|
3147
3251
|
path: {
|
|
3148
3252
|
/** @description The project's UUID. */
|
|
@@ -3173,6 +3277,9 @@ export interface operations {
|
|
|
3173
3277
|
405: components["responses"]["E405"];
|
|
3174
3278
|
409: components["responses"]["E409"];
|
|
3175
3279
|
429: components["responses"]["E429"];
|
|
3280
|
+
502: components["responses"]["E502"];
|
|
3281
|
+
503: components["responses"]["E503"];
|
|
3282
|
+
504: components["responses"]["E504"];
|
|
3176
3283
|
};
|
|
3177
3284
|
};
|
|
3178
3285
|
searchEntries: {
|
|
@@ -3256,13 +3363,17 @@ export interface operations {
|
|
|
3256
3363
|
};
|
|
3257
3364
|
deleteEntry: {
|
|
3258
3365
|
parameters: {
|
|
3259
|
-
query?:
|
|
3366
|
+
query?: {
|
|
3367
|
+
/** @description A database content model limited to the caller's rows: whose (project keys). */
|
|
3368
|
+
userId?: string;
|
|
3369
|
+
};
|
|
3260
3370
|
header?: never;
|
|
3261
3371
|
path: {
|
|
3262
3372
|
/** @description The project's UUID. */
|
|
3263
3373
|
uuid: string;
|
|
3264
3374
|
slug: string;
|
|
3265
|
-
id: number
|
|
3375
|
+
/** @description The entry's id: a number, or a database content model's key. */
|
|
3376
|
+
id: string;
|
|
3266
3377
|
};
|
|
3267
3378
|
cookie?: never;
|
|
3268
3379
|
};
|
|
@@ -3282,18 +3393,26 @@ export interface operations {
|
|
|
3282
3393
|
403: components["responses"]["E403"];
|
|
3283
3394
|
404: components["responses"]["E404"];
|
|
3284
3395
|
405: components["responses"]["E405"];
|
|
3396
|
+
409: components["responses"]["E409"];
|
|
3285
3397
|
429: components["responses"]["E429"];
|
|
3398
|
+
502: components["responses"]["E502"];
|
|
3399
|
+
503: components["responses"]["E503"];
|
|
3400
|
+
504: components["responses"]["E504"];
|
|
3286
3401
|
};
|
|
3287
3402
|
};
|
|
3288
3403
|
updateEntry: {
|
|
3289
3404
|
parameters: {
|
|
3290
|
-
query?:
|
|
3405
|
+
query?: {
|
|
3406
|
+
/** @description A database content model limited to the caller's rows: whose (project keys). */
|
|
3407
|
+
userId?: string;
|
|
3408
|
+
};
|
|
3291
3409
|
header?: never;
|
|
3292
3410
|
path: {
|
|
3293
3411
|
/** @description The project's UUID. */
|
|
3294
3412
|
uuid: string;
|
|
3295
3413
|
slug: string;
|
|
3296
|
-
id: number
|
|
3414
|
+
/** @description The entry's id: a number, or a database content model's key. */
|
|
3415
|
+
id: string;
|
|
3297
3416
|
};
|
|
3298
3417
|
cookie?: never;
|
|
3299
3418
|
};
|
|
@@ -3319,6 +3438,9 @@ export interface operations {
|
|
|
3319
3438
|
405: components["responses"]["E405"];
|
|
3320
3439
|
409: components["responses"]["E409"];
|
|
3321
3440
|
429: components["responses"]["E429"];
|
|
3441
|
+
502: components["responses"]["E502"];
|
|
3442
|
+
503: components["responses"]["E503"];
|
|
3443
|
+
504: components["responses"]["E504"];
|
|
3322
3444
|
};
|
|
3323
3445
|
};
|
|
3324
3446
|
listMedia: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { VeroXMApp } from './client.js';
|
|
2
2
|
export type { VeroXMAppOptions } from './client.js';
|
|
3
3
|
export { VeroXMAuth } from './auth.js';
|
|
4
|
-
export type { Account, AuthenticatorSetup, EmailCode, Passkey, PendingStore, SecondStep, SocialProvider, SocialSignInStart, TwoStepStatus, WithTicket, } from './auth.js';
|
|
4
|
+
export type { Account, AuthConfig, AuthenticatorSetup, BotCheck, BotProtectionConfig, EmailCode, Passkey, PendingStore, SecondStep, SocialProvider, SocialSignInStart, TwoStepStatus, WithTicket, } from './auth.js';
|
|
5
5
|
export { browserPasskeys, creationOptionsFromJSON, credentialToJSON, requestOptionsFromJSON } from './passkeys.js';
|
|
6
6
|
export type { PasskeyOptionsJSON, PasskeyProvider } from './passkeys.js';
|
|
7
7
|
export { createPkce } from './pkce.js';
|