@adonis-agora/authkit-server 1.0.0-rc.8 → 1.0.0-rc.9
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 +13 -0
- package/build/host/views/account/apps.edge +1 -5
- package/build/host/views/account/extension.edge +77 -0
- package/build/host/views/account/mfa.edge +2 -0
- package/build/host/views/account/partials/extension_actions.edge +14 -0
- package/build/host/views/account/partials/extension_block.edge +197 -0
- package/build/host/views/account/partials/extension_value.edge +8 -0
- package/build/host/views/account/partials/nav.edge +14 -0
- package/build/host/views/account/security.edge +1 -5
- package/build/host/views/account/tokens.edge +2 -2
- package/build/host/views/partials/styles.edge +1 -1
- package/build/providers/authkit_server_provider.js +5 -0
- package/build/src/account/extension.d.ts +323 -0
- package/build/src/account/extension.js +36 -0
- package/build/src/account/http.d.ts +71 -0
- package/build/src/account/http.js +369 -0
- package/build/src/account/mount.d.ts +35 -0
- package/build/src/account/mount.js +99 -0
- package/build/src/account/registry.d.ts +48 -0
- package/build/src/account/registry.js +229 -0
- package/build/src/account/runtime.d.ts +277 -0
- package/build/src/account/runtime.js +623 -0
- package/build/src/audit/audit_sink.d.ts +1 -1
- package/build/src/audit/audit_sink.js +4 -0
- package/build/src/define_config.d.ts +18 -0
- package/build/src/define_config.js +4 -0
- package/build/src/host/admin_api/dto.d.ts +1 -1
- package/build/src/host/auth_host_config.d.ts +3 -0
- package/build/src/host/i18n.d.ts +36 -0
- package/build/src/host/i18n.js +38 -0
- package/build/src/host/rate_limit.d.ts +8 -0
- package/build/src/host/rate_limit.js +9 -0
- package/build/src/host/register_auth_host.d.ts +6 -0
- package/build/src/host/register_auth_host.js +28 -0
- package/build/src/host/renderers/edge_renderer.js +5 -0
- package/build/src/host/renderers/inertia_renderer.js +7 -1
- package/build/src/host/screen_props.d.ts +28 -0
- package/build/src/host/ui-dist/assets/{index-DlKYAhpy.js → index-Dq3dJVBv.js} +26 -26
- package/build/src/host/ui-dist/index.html +1 -1
- package/build/types.d.ts +3 -1
- package/package.json +3 -2
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account console extensions — the surface another package (or the app) uses to add pages to the
|
|
3
|
+
* signed-in user's own console (`/account/*`).
|
|
4
|
+
*
|
|
5
|
+
* **Stable for all of 1.x.** A 1.x release only adds optional members and new block kinds. This
|
|
6
|
+
* module holds types and constants only, so a contributor can `import type` it from an internal
|
|
7
|
+
* module without a runtime dependency on authkit.
|
|
8
|
+
*
|
|
9
|
+
* A contributor registers itself from its provider's `boot()`:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* if (this.app.container.hasBinding('authkit.accountExtensions')) {
|
|
13
|
+
* const registry = await this.app.container.make('authkit.accountExtensions')
|
|
14
|
+
* if (registry.contract >= 1) registry.register(myAccountExtension)
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Everything a page returns ({@link AccountPageView}, {@link AccountActionResult}) is plain JSON
|
|
19
|
+
* (dates may be `Date` or ISO strings), so the same page can also be served from another app.
|
|
20
|
+
*/
|
|
21
|
+
/** The container binding the registry is bound at. */
|
|
22
|
+
export declare const ACCOUNT_EXTENSIONS_BINDING = "authkit.accountExtensions";
|
|
23
|
+
/** The contract major this authkit implements. */
|
|
24
|
+
export declare const ACCOUNT_EXTENSION_CONTRACT = 1;
|
|
25
|
+
/** Block kinds this authkit renders. A contributor degrades when one it needs is missing. */
|
|
26
|
+
export declare const ACCOUNT_BLOCK_KINDS: readonly ['notice', 'keyValue', 'list', 'table', 'meter', 'actions', 'link', 'toolPreview', 'component'];
|
|
27
|
+
/** One of {@link ACCOUNT_BLOCK_KINDS}. */
|
|
28
|
+
export type AccountBlockKind = (typeof ACCOUNT_BLOCK_KINDS)[number];
|
|
29
|
+
/** A message key (looked up in the merged catalog) or literal text. Always escaped. */
|
|
30
|
+
export type Text = string | {
|
|
31
|
+
key: string;
|
|
32
|
+
params?: Record<string, string | number>;
|
|
33
|
+
};
|
|
34
|
+
/** The active organization (signed cookie), when organizations are on. */
|
|
35
|
+
export interface AccountActiveOrg {
|
|
36
|
+
id: string;
|
|
37
|
+
slug: string;
|
|
38
|
+
role: string;
|
|
39
|
+
}
|
|
40
|
+
/** One level of a tenant chain (outermost first). */
|
|
41
|
+
export interface AccountTenantLevel {
|
|
42
|
+
id: string;
|
|
43
|
+
kind: string;
|
|
44
|
+
slug?: string;
|
|
45
|
+
role?: string;
|
|
46
|
+
}
|
|
47
|
+
/** The tenant of the request, in the shape `@adonis-agora/context` uses. */
|
|
48
|
+
export interface AccountTenantRef {
|
|
49
|
+
id: string;
|
|
50
|
+
kind: 'organization' | 'user' | (string & {});
|
|
51
|
+
source: 'authkit' | 'app' | 'carrier' | 'legacy' | (string & {});
|
|
52
|
+
slug?: string;
|
|
53
|
+
role?: string;
|
|
54
|
+
/** The nested chain, outermost first, ending with this tenant. */
|
|
55
|
+
chain?: readonly AccountTenantLevel[];
|
|
56
|
+
}
|
|
57
|
+
/** Who the account is in the app: what billing, media or agents key their rows on. */
|
|
58
|
+
export interface AccountSubject {
|
|
59
|
+
type: string;
|
|
60
|
+
id: string;
|
|
61
|
+
}
|
|
62
|
+
/** What every `visible`, `load` and action `handle` receives. */
|
|
63
|
+
export interface AccountExtensionContext {
|
|
64
|
+
account: {
|
|
65
|
+
id: string;
|
|
66
|
+
email: string | null;
|
|
67
|
+
name: string | null;
|
|
68
|
+
roles: readonly string[];
|
|
69
|
+
};
|
|
70
|
+
/** The active org (signed cookie, membership re-checked), when organizations are on. */
|
|
71
|
+
activeOrg: AccountActiveOrg | null;
|
|
72
|
+
/** The tenant of the request: the active organization, when there is one. */
|
|
73
|
+
tenant?: AccountTenantRef | null;
|
|
74
|
+
/**
|
|
75
|
+
* The account mapped to the app's subject by `accountConsole.subject` in `config/authkit.ts`
|
|
76
|
+
* (default `{ type: 'User', id: account.id }`). A lib may still map it its own way.
|
|
77
|
+
*/
|
|
78
|
+
subject: AccountSubject;
|
|
79
|
+
/** The admin acting as this account, when an impersonation is active. Sensitive actions refuse it. */
|
|
80
|
+
impersonatedBy: string | null;
|
|
81
|
+
/** The console locale (`'en'`, `'pt-BR'`…). */
|
|
82
|
+
locale: string;
|
|
83
|
+
/** Validated query: `cursor` and `tab` only. */
|
|
84
|
+
query: {
|
|
85
|
+
cursor?: string;
|
|
86
|
+
tab?: string;
|
|
87
|
+
};
|
|
88
|
+
/** Same-origin path of a console page (`url('payments.invoices', { cursor })`). */
|
|
89
|
+
url(pageId: string, query?: Record<string, string>): string;
|
|
90
|
+
/** Resolves a container binding. */
|
|
91
|
+
make(binding: string): Promise<any>;
|
|
92
|
+
now(): Date;
|
|
93
|
+
}
|
|
94
|
+
/** A formatted value. Money is in minor units; dates are `Date` or ISO strings. */
|
|
95
|
+
export type Value = {
|
|
96
|
+
type: 'text';
|
|
97
|
+
text: Text;
|
|
98
|
+
} | {
|
|
99
|
+
type: 'money';
|
|
100
|
+
amount: number;
|
|
101
|
+
currency: string;
|
|
102
|
+
} | {
|
|
103
|
+
type: 'date';
|
|
104
|
+
at: Date | string;
|
|
105
|
+
style?: 'date' | 'datetime' | 'relative';
|
|
106
|
+
} | {
|
|
107
|
+
type: 'badge';
|
|
108
|
+
text: Text;
|
|
109
|
+
tone?: 'neutral' | 'success' | 'warning' | 'danger';
|
|
110
|
+
} | {
|
|
111
|
+
type: 'number';
|
|
112
|
+
value: number;
|
|
113
|
+
unit?: Text;
|
|
114
|
+
};
|
|
115
|
+
/** Points at `page.actions[action]`; `target` is an opaque id the handler MUST re-authorize. */
|
|
116
|
+
export interface ActionRef {
|
|
117
|
+
action: string;
|
|
118
|
+
target?: string;
|
|
119
|
+
}
|
|
120
|
+
/** An item of a `list` block. */
|
|
121
|
+
export interface ListItem {
|
|
122
|
+
title: Text;
|
|
123
|
+
subtitle?: Text;
|
|
124
|
+
meta?: Value[];
|
|
125
|
+
badge?: Value;
|
|
126
|
+
/** Same-origin path, or an https URL with `external: true`. */
|
|
127
|
+
href?: string;
|
|
128
|
+
external?: boolean;
|
|
129
|
+
actions?: ActionRef[];
|
|
130
|
+
}
|
|
131
|
+
/** A script a `component` block loads. */
|
|
132
|
+
export interface ComponentScript {
|
|
133
|
+
/** Same-origin path (`/payments/assets/card.js`) or an https URL on one of `scriptOrigins`. */
|
|
134
|
+
src: string;
|
|
135
|
+
/** Subresource integrity (`sha384-…`). */
|
|
136
|
+
integrity?: string;
|
|
137
|
+
/** Load as an ES module. */
|
|
138
|
+
module?: boolean;
|
|
139
|
+
}
|
|
140
|
+
/** One block of a page. Unknown kinds render as a notice. */
|
|
141
|
+
export type Block = {
|
|
142
|
+
kind: 'notice';
|
|
143
|
+
tone: 'info' | 'success' | 'warning' | 'danger';
|
|
144
|
+
text: Text;
|
|
145
|
+
} | {
|
|
146
|
+
kind: 'keyValue';
|
|
147
|
+
title?: Text;
|
|
148
|
+
rows: ReadonlyArray<{
|
|
149
|
+
label: Text;
|
|
150
|
+
value: Value;
|
|
151
|
+
}>;
|
|
152
|
+
actions?: ActionRef[];
|
|
153
|
+
} | {
|
|
154
|
+
kind: 'list';
|
|
155
|
+
title?: Text;
|
|
156
|
+
empty: Text;
|
|
157
|
+
items: ReadonlyArray<ListItem>;
|
|
158
|
+
nextCursor?: string | null;
|
|
159
|
+
} | {
|
|
160
|
+
kind: 'table';
|
|
161
|
+
title?: Text;
|
|
162
|
+
empty: Text;
|
|
163
|
+
columns: ReadonlyArray<{
|
|
164
|
+
id: string;
|
|
165
|
+
label: Text;
|
|
166
|
+
}>;
|
|
167
|
+
rows: ReadonlyArray<{
|
|
168
|
+
cells: Record<string, Value>;
|
|
169
|
+
actions?: ActionRef[];
|
|
170
|
+
}>;
|
|
171
|
+
nextCursor?: string | null;
|
|
172
|
+
} | {
|
|
173
|
+
kind: 'meter';
|
|
174
|
+
label: Text;
|
|
175
|
+
used: number;
|
|
176
|
+
limit: number | null;
|
|
177
|
+
unit?: Text;
|
|
178
|
+
resetsAt?: Date | string;
|
|
179
|
+
} | {
|
|
180
|
+
kind: 'actions';
|
|
181
|
+
items: ActionRef[];
|
|
182
|
+
} | {
|
|
183
|
+
kind: 'link';
|
|
184
|
+
label: Text;
|
|
185
|
+
href: string;
|
|
186
|
+
external?: boolean;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* A structured preview of something waiting for a decision (an agent's tool call): its title,
|
|
190
|
+
* the arguments as rows, and an optional body shown verbatim (escaped).
|
|
191
|
+
*/
|
|
192
|
+
| {
|
|
193
|
+
kind: 'toolPreview';
|
|
194
|
+
title: Text;
|
|
195
|
+
tool?: string;
|
|
196
|
+
subtitle?: Text;
|
|
197
|
+
args?: ReadonlyArray<{
|
|
198
|
+
label: Text;
|
|
199
|
+
value: Value;
|
|
200
|
+
}>;
|
|
201
|
+
body?: {
|
|
202
|
+
format: 'json' | 'text';
|
|
203
|
+
content: string;
|
|
204
|
+
};
|
|
205
|
+
actions?: ActionRef[];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* A provider's own UI (card fields of Stripe Elements, Asaas, Efí, PayPal…). authkit renders
|
|
209
|
+
* the mount point, the props as a JSON data block and the scripts with the request's CSP nonce.
|
|
210
|
+
* The script mounts into `[data-block="component"][data-provider="<provider>"]`, reads its props
|
|
211
|
+
* from the `<script type="application/json">` the mount point names in `data-props`, and submits
|
|
212
|
+
* the mount point's `<form>` (the `submit` action) with the fields it adds. Until it mounts (or
|
|
213
|
+
* when scripts are blocked) the `fallback` link shows.
|
|
214
|
+
*/
|
|
215
|
+
| {
|
|
216
|
+
kind: 'component';
|
|
217
|
+
provider: string;
|
|
218
|
+
scripts: ReadonlyArray<ComponentScript>;
|
|
219
|
+
props?: Record<string, unknown>;
|
|
220
|
+
submit?: ActionRef;
|
|
221
|
+
fallback?: {
|
|
222
|
+
label: Text;
|
|
223
|
+
href: string;
|
|
224
|
+
external?: boolean;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
/** What `load` returns. */
|
|
228
|
+
export interface AccountPageView {
|
|
229
|
+
blocks: readonly Block[];
|
|
230
|
+
/** Tabs inside one page (`query.tab`). */
|
|
231
|
+
tabs?: ReadonlyArray<{
|
|
232
|
+
id: string;
|
|
233
|
+
label: Text;
|
|
234
|
+
}>;
|
|
235
|
+
}
|
|
236
|
+
/** A field of an action's form. Values arrive validated, as strings. */
|
|
237
|
+
export interface AccountActionField {
|
|
238
|
+
name: string;
|
|
239
|
+
label: Text;
|
|
240
|
+
kind: 'text' | 'select' | 'textarea';
|
|
241
|
+
options?: ReadonlyArray<{
|
|
242
|
+
value: string;
|
|
243
|
+
label: Text;
|
|
244
|
+
}>;
|
|
245
|
+
required?: boolean;
|
|
246
|
+
maxLength?: number;
|
|
247
|
+
}
|
|
248
|
+
/** What an action returns. */
|
|
249
|
+
export type AccountActionResult = {
|
|
250
|
+
ok: true;
|
|
251
|
+
flash?: Text;
|
|
252
|
+
redirectTo?: {
|
|
253
|
+
page: string;
|
|
254
|
+
} | {
|
|
255
|
+
external: string;
|
|
256
|
+
};
|
|
257
|
+
} | {
|
|
258
|
+
ok: false;
|
|
259
|
+
error: Text;
|
|
260
|
+
status?: 400 | 403 | 404 | 409;
|
|
261
|
+
};
|
|
262
|
+
/** An action a page offers. */
|
|
263
|
+
export interface AccountAction {
|
|
264
|
+
label: Text;
|
|
265
|
+
tone?: 'default' | 'danger';
|
|
266
|
+
/** Confirmation text, shown on a second step page (no inline JS). */
|
|
267
|
+
confirm?: Text;
|
|
268
|
+
/** Needs recent re-authentication: authkit sends the user through `/account/confirm` first. */
|
|
269
|
+
sudo?: boolean;
|
|
270
|
+
/** Simple form fields, shown on the confirmation step. */
|
|
271
|
+
fields?: ReadonlyArray<AccountActionField>;
|
|
272
|
+
handle(ctx: AccountExtensionContext, input: {
|
|
273
|
+
target: string | null;
|
|
274
|
+
fields: Record<string, string>;
|
|
275
|
+
}): Promise<AccountActionResult>;
|
|
276
|
+
}
|
|
277
|
+
/** Where a page sits in the console's navigation. */
|
|
278
|
+
export interface AccountPageNav {
|
|
279
|
+
label?: Text;
|
|
280
|
+
order?: number;
|
|
281
|
+
group?: 'account' | 'billing' | 'ai' | 'content';
|
|
282
|
+
}
|
|
283
|
+
/** One page of an extension. */
|
|
284
|
+
export interface AccountPage {
|
|
285
|
+
/** Stable id `<extension>.<page>` (`'payments.subscription'`). */
|
|
286
|
+
id: string;
|
|
287
|
+
/** URL segment under the account prefix (`'billing'` → `/account/billing`). The host can rename it. */
|
|
288
|
+
segment: string;
|
|
289
|
+
title: Text;
|
|
290
|
+
/** `false` hides it from the navigation (still reachable by URL and `url()`). */
|
|
291
|
+
nav?: AccountPageNav | false;
|
|
292
|
+
/** Show this page (and its nav entry) for this account? Default: yes. Runs once per request. */
|
|
293
|
+
visible?(ctx: AccountExtensionContext): boolean | Promise<boolean>;
|
|
294
|
+
/** Builds the page on every GET. */
|
|
295
|
+
load(ctx: AccountExtensionContext): Promise<AccountPageView>;
|
|
296
|
+
actions?: Readonly<Record<string, AccountAction>>;
|
|
297
|
+
}
|
|
298
|
+
/** An account console extension. */
|
|
299
|
+
export interface AccountExtension {
|
|
300
|
+
/** 2–16 of `a-z`, `0-9`, `-`; unique; not a built-in screen. */
|
|
301
|
+
readonly id: string;
|
|
302
|
+
/** The contract major it was written against. authkit skips a higher one. */
|
|
303
|
+
readonly contract: number;
|
|
304
|
+
/** `locale → key → text`; keys start with `<id>.`. The host's `i18n.messages` still win. */
|
|
305
|
+
messages?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
306
|
+
/** https origins its `component` blocks may load scripts from (`'https://js.stripe.com'`). */
|
|
307
|
+
scriptOrigins?: readonly string[];
|
|
308
|
+
pages: readonly AccountPage[];
|
|
309
|
+
}
|
|
310
|
+
/** The registry bound at {@link ACCOUNT_EXTENSIONS_BINDING}. */
|
|
311
|
+
export interface AccountExtensionRegistry {
|
|
312
|
+
readonly contract: number;
|
|
313
|
+
/** Block kinds this authkit renders. */
|
|
314
|
+
readonly blockKinds: readonly string[];
|
|
315
|
+
register(extension: AccountExtension): void;
|
|
316
|
+
}
|
|
317
|
+
/** Host controls for one extension (`accountConsole.extensions` in `config/authkit.ts`). */
|
|
318
|
+
export type AccountExtensionOverride = false | {
|
|
319
|
+
pages?: Record<string, false | {
|
|
320
|
+
segment?: string;
|
|
321
|
+
order?: number;
|
|
322
|
+
}>;
|
|
323
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account console extensions — the surface another package (or the app) uses to add pages to the
|
|
3
|
+
* signed-in user's own console (`/account/*`).
|
|
4
|
+
*
|
|
5
|
+
* **Stable for all of 1.x.** A 1.x release only adds optional members and new block kinds. This
|
|
6
|
+
* module holds types and constants only, so a contributor can `import type` it from an internal
|
|
7
|
+
* module without a runtime dependency on authkit.
|
|
8
|
+
*
|
|
9
|
+
* A contributor registers itself from its provider's `boot()`:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* if (this.app.container.hasBinding('authkit.accountExtensions')) {
|
|
13
|
+
* const registry = await this.app.container.make('authkit.accountExtensions')
|
|
14
|
+
* if (registry.contract >= 1) registry.register(myAccountExtension)
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Everything a page returns ({@link AccountPageView}, {@link AccountActionResult}) is plain JSON
|
|
19
|
+
* (dates may be `Date` or ISO strings), so the same page can also be served from another app.
|
|
20
|
+
*/
|
|
21
|
+
/** The container binding the registry is bound at. */
|
|
22
|
+
export const ACCOUNT_EXTENSIONS_BINDING = 'authkit.accountExtensions';
|
|
23
|
+
/** The contract major this authkit implements. */
|
|
24
|
+
export const ACCOUNT_EXTENSION_CONTRACT = 1;
|
|
25
|
+
/** Block kinds this authkit renders. A contributor degrades when one it needs is missing. */
|
|
26
|
+
export const ACCOUNT_BLOCK_KINDS = [
|
|
27
|
+
'notice',
|
|
28
|
+
'keyValue',
|
|
29
|
+
'list',
|
|
30
|
+
'table',
|
|
31
|
+
'meter',
|
|
32
|
+
'actions',
|
|
33
|
+
'link',
|
|
34
|
+
'toolPreview',
|
|
35
|
+
'component',
|
|
36
|
+
];
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { HttpContext } from '@adonisjs/core/http';
|
|
2
|
+
import type { AccountAction, Text } from './extension.js';
|
|
3
|
+
import type { RegisteredAccountPage } from './registry.js';
|
|
4
|
+
/** The confirmation step of an action, as the view renders it. */
|
|
5
|
+
export interface ResolvedActionStep {
|
|
6
|
+
action: string;
|
|
7
|
+
title: string;
|
|
8
|
+
text: string | null;
|
|
9
|
+
tone: 'default' | 'danger';
|
|
10
|
+
sudo: boolean;
|
|
11
|
+
/** POST target of the form. */
|
|
12
|
+
href: string;
|
|
13
|
+
target: string | null;
|
|
14
|
+
cancelHref: string;
|
|
15
|
+
submitLabel: string;
|
|
16
|
+
fields: Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
label: string;
|
|
19
|
+
kind: 'text' | 'select' | 'textarea';
|
|
20
|
+
required: boolean;
|
|
21
|
+
maxLength: number | null;
|
|
22
|
+
options: Array<{
|
|
23
|
+
value: string;
|
|
24
|
+
label: string;
|
|
25
|
+
}>;
|
|
26
|
+
value: string;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
/** An action as the JSON API describes it. */
|
|
30
|
+
export interface ResolvedActionDefinition {
|
|
31
|
+
label: string;
|
|
32
|
+
tone: 'default' | 'danger';
|
|
33
|
+
confirm: string | null;
|
|
34
|
+
sudo: boolean;
|
|
35
|
+
fields: ResolvedActionStep['fields'];
|
|
36
|
+
}
|
|
37
|
+
/** Validates the posted fields against the action's declaration. */
|
|
38
|
+
export declare function validateActionInput(action: AccountAction, raw: {
|
|
39
|
+
target?: unknown;
|
|
40
|
+
fields?: unknown;
|
|
41
|
+
}, t: (text: Text | undefined | null) => string): {
|
|
42
|
+
ok: true;
|
|
43
|
+
target: string | null;
|
|
44
|
+
fields: Record<string, string>;
|
|
45
|
+
} | {
|
|
46
|
+
ok: false;
|
|
47
|
+
error: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The `<script>` tag of a `component` block's script: the response's CSP nonce when shield set
|
|
51
|
+
* one, `integrity` + `crossorigin` when the block gave one, `type="module"` when asked.
|
|
52
|
+
*/
|
|
53
|
+
export declare function componentScriptTag(script: {
|
|
54
|
+
src: string;
|
|
55
|
+
integrity: string | null;
|
|
56
|
+
module: boolean;
|
|
57
|
+
}, nonce: string | null): string;
|
|
58
|
+
/** `GET {prefix}/{segment}` — renders an extension page. */
|
|
59
|
+
export declare function showPage(ctx: HttpContext, page: RegisteredAccountPage): Promise<unknown>;
|
|
60
|
+
/** `GET {prefix}/{segment}/actions/:action/confirm` — the no-JS confirmation step. */
|
|
61
|
+
export declare function showActionStep(ctx: HttpContext, page: RegisteredAccountPage): Promise<unknown>;
|
|
62
|
+
/** The CSP nonce shield put on this response, when there is one. */
|
|
63
|
+
export declare function cspNonceOf(ctx: HttpContext): string | null;
|
|
64
|
+
/** `POST {prefix}/{segment}/actions/:action` — a form submission (`_csrf` checked by shield). */
|
|
65
|
+
export declare function postAction(ctx: HttpContext, page: RegisteredAccountPage): Promise<unknown>;
|
|
66
|
+
/** `GET {prefix}/api/extensions` — the navigation for React hosts. */
|
|
67
|
+
export declare function apiExtensions(ctx: HttpContext): Promise<void>;
|
|
68
|
+
/** `GET {prefix}/api/x/:pageId` — one page, resolved. */
|
|
69
|
+
export declare function apiPage(ctx: HttpContext): Promise<void>;
|
|
70
|
+
/** `POST {prefix}/api/x/:pageId/actions/:action` — runs an action, answers JSON. */
|
|
71
|
+
export declare function apiAction(ctx: HttpContext): Promise<void>;
|