@polaris-auth/client 0.6.1 → 0.7.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/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  The TypeScript client for [Polaris for PHP](https://github.com/univeros/polaris-core), generated from
4
4
  the route manifest: `openapi-fetch` typed by the 52 core endpoints and the routes of the `polaris/audit`,
5
- `polaris/admin`, `polaris/sentinel`, `polaris/sso` and `polaris/scim` plugins, so a request body, its
5
+ `polaris/admin`, `polaris/sentinel`, `polaris/sso`, `polaris/scim`, `polaris/passwordless`,
6
+ `polaris/username`, `polaris/anonymous` and `polaris/multi-session` plugins, so a request body, its
6
7
  `data` and its `error` are checked at compile time against the same contract the PHP hosts serve.
7
8
 
8
9
  ```sh
@@ -44,11 +45,15 @@ const trail = await polaris.withToken(accessToken).audit.me();
44
45
  `client.audit` (`me`, `organization`, `types`), `client.admin` (users, sessions, MFA, organizations,
45
46
  audit, drains, stats, keys, grants; see the package README), `client.sentinel` (`listDecisions`,
46
47
  `listIpRules`, `createIpRule`, `deleteIpRule`, `unblock`), `client.sso` (`signIn`, `exchange`, `logout`,
47
- the organization's providers and domains, the operators' list) and `client.scim` (the organization's
48
- connections, the operators' list, and the SCIM server's own routes for a directory client) are generated
49
- into `src/audit.ts`, `src/admin.ts`, `src/sentinel.ts`, `src/sso.ts` and `src/scim.ts` by
50
- `scripts/generate-namespaces.mjs` from the `x-polaris-plugin` marker of the OpenAPI document; a later
51
- plugin gets its namespace the same way. Their errors are RFC 9457 problem documents,
48
+ the organization's providers and domains, the operators' list), `client.scim` (the organization's
49
+ connections, the operators' list, and the SCIM server's own routes for a directory client),
50
+ `client.passwordless` (`magicLinkSend`, `magicLinkVerify`, `magicLinkExchange`, `emailOtpSend`,
51
+ `emailOtpVerify`, `emailOtpVerifyEmail`, `emailOtpResetPassword`, `phoneSend`, `phoneVerify`, `phoneAdd`,
52
+ `phoneConfirm`, `oneTimeTokenGenerate`, `oneTimeTokenVerify`), `client.username` (`signIn`, `update`),
53
+ `client.anonymous` (`signIn`, `convert`) and `client.multiSession` (`list`, `switch`, `revoke`,
54
+ `lastMethod`) are generated into `src/<plugin id>.ts` by `scripts/generate-namespaces.mjs` from the
55
+ `x-polaris-plugin` marker of the OpenAPI document; a later plugin gets its namespace the same way, its id
56
+ camel-cased (`multi-session` is `client.multiSession`). Their errors are RFC 9457 problem documents,
52
57
  `ProblemBody` (`{ type, title, status, detail, error, message, errors? }`), served as
53
58
  `application/problem+json`.
54
59
 
@@ -56,6 +61,19 @@ Response types come from each endpoint's `output.example` in the manifest (JSON
56
61
  `docs/adapters/spec.md` §7): a documented approximation, exact for the shapes the specs show. Error
57
62
  bodies are `ErrorBody` (`{ error, message }`) and `ValidationErrorBody` (`{ errors }`).
58
63
 
64
+ ## Several accounts on one device
65
+
66
+ With `polaris/multi-session`, every response that carries a token pair also carries the device id in
67
+ `X-Polaris-Device` (and, for a browser, the HttpOnly cookie `polaris_ms_device`). A client that is not a
68
+ browser sends it back on the multi-session routes:
69
+
70
+ ```ts
71
+ const device = signIn.response.headers.get("X-Polaris-Device")!;
72
+ const accounts = await polaris.withToken(access).multiSession.list({ headers: { "X-Polaris-Device": device } });
73
+ const other = await polaris.withToken(access).multiSession.switch({ body: { session_id: accounts.data!.data[1]!.session_id }, headers: { "X-Polaris-Device": device } });
74
+ const button = (await polaris.multiSession.lastMethod({ headers: { "X-Polaris-Device": device } })).data?.data.last_method;
75
+ ```
76
+
59
77
  ## The sentinel challenge
60
78
 
61
79
  With `polaris/sentinel` enforcing, a sign-up, sign-in, password reset or code send may answer `403` with
@@ -89,7 +107,8 @@ npm test # starts examples/slim (installed and set up) and runs regi
89
107
  `src/sso.ts`, `src/scim.ts`) are checked in; CI regenerates them and fails on a difference, so a manifest
90
108
  change ships with its types. `polaris.php` is the application the client is generated for (core with the
91
109
  five plugins that have routes). `POLARIS_URL=http://host:port npm test` runs the test against a server
92
- you started. Node 20 or later.
110
+ you started. Node 20 or later. Every `v*` tag of the monorepo publishes the package to npm through
111
+ trusted publishing (`.github/workflows/npm-publish.yml`, OIDC, provenance attached, no token).
93
112
 
94
113
  ## License
95
114
 
@@ -0,0 +1,513 @@
1
+ import type { Client } from "openapi-fetch";
2
+ import type { paths } from "./schema.js";
3
+ import type { Init } from "./namespace.js";
4
+ /** The `anonymous` plugin's routes as methods of `client.anonymous`. */
5
+ export declare function anonymous(client: Client<paths>): {
6
+ /** POST /anonymous/convert: Convert the guest into an account */
7
+ convert: (init_0: {
8
+ params?: {
9
+ query?: never;
10
+ header?: never;
11
+ path?: never;
12
+ cookie?: never;
13
+ };
14
+ } & {
15
+ body: {
16
+ access_token: string;
17
+ } & {};
18
+ } & {
19
+ baseUrl?: string;
20
+ querySerializer?: import("openapi-fetch").QuerySerializerOptions | import("openapi-fetch").QuerySerializer<{
21
+ parameters: {
22
+ query?: never;
23
+ header?: never;
24
+ path?: never;
25
+ cookie?: never;
26
+ };
27
+ requestBody: {
28
+ content: {
29
+ "application/json": {
30
+ access_token: string;
31
+ };
32
+ };
33
+ };
34
+ responses: {
35
+ 200: {
36
+ headers: {
37
+ [name: string]: unknown;
38
+ };
39
+ content: {
40
+ "application/json": {
41
+ data: {
42
+ guest_id: string;
43
+ user_id: string;
44
+ status: string;
45
+ };
46
+ };
47
+ };
48
+ };
49
+ 401: {
50
+ headers: {
51
+ [name: string]: unknown;
52
+ };
53
+ content: {
54
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
55
+ };
56
+ };
57
+ 403: {
58
+ headers: {
59
+ [name: string]: unknown;
60
+ };
61
+ content: {
62
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
63
+ };
64
+ };
65
+ 422: {
66
+ headers: {
67
+ [name: string]: unknown;
68
+ };
69
+ content: {
70
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
71
+ };
72
+ };
73
+ };
74
+ }>;
75
+ bodySerializer?: import("openapi-fetch").BodySerializer<{
76
+ parameters: {
77
+ query?: never;
78
+ header?: never;
79
+ path?: never;
80
+ cookie?: never;
81
+ };
82
+ requestBody: {
83
+ content: {
84
+ "application/json": {
85
+ access_token: string;
86
+ };
87
+ };
88
+ };
89
+ responses: {
90
+ 200: {
91
+ headers: {
92
+ [name: string]: unknown;
93
+ };
94
+ content: {
95
+ "application/json": {
96
+ data: {
97
+ guest_id: string;
98
+ user_id: string;
99
+ status: string;
100
+ };
101
+ };
102
+ };
103
+ };
104
+ 401: {
105
+ headers: {
106
+ [name: string]: unknown;
107
+ };
108
+ content: {
109
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
110
+ };
111
+ };
112
+ 403: {
113
+ headers: {
114
+ [name: string]: unknown;
115
+ };
116
+ content: {
117
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
118
+ };
119
+ };
120
+ 422: {
121
+ headers: {
122
+ [name: string]: unknown;
123
+ };
124
+ content: {
125
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
126
+ };
127
+ };
128
+ };
129
+ }>;
130
+ pathSerializer?: import("openapi-fetch").PathSerializer;
131
+ parseAs?: import("openapi-fetch").ParseAs;
132
+ fetch?: import("openapi-fetch").ClientOptions["fetch"];
133
+ headers?: import("openapi-fetch").HeadersOptions;
134
+ middleware?: import("openapi-fetch").Middleware[];
135
+ } & Omit<RequestInit, "body" | "headers"> & {
136
+ [key: string]: unknown;
137
+ }) => Promise<import("openapi-fetch").FetchResponse<{
138
+ parameters: {
139
+ query?: never;
140
+ header?: never;
141
+ path?: never;
142
+ cookie?: never;
143
+ };
144
+ requestBody: {
145
+ content: {
146
+ "application/json": {
147
+ access_token: string;
148
+ };
149
+ };
150
+ };
151
+ responses: {
152
+ 200: {
153
+ headers: {
154
+ [name: string]: unknown;
155
+ };
156
+ content: {
157
+ "application/json": {
158
+ data: {
159
+ guest_id: string;
160
+ user_id: string;
161
+ status: string;
162
+ };
163
+ };
164
+ };
165
+ };
166
+ 401: {
167
+ headers: {
168
+ [name: string]: unknown;
169
+ };
170
+ content: {
171
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
172
+ };
173
+ };
174
+ 403: {
175
+ headers: {
176
+ [name: string]: unknown;
177
+ };
178
+ content: {
179
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
180
+ };
181
+ };
182
+ 422: {
183
+ headers: {
184
+ [name: string]: unknown;
185
+ };
186
+ content: {
187
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
188
+ };
189
+ };
190
+ };
191
+ }, {
192
+ params?: {
193
+ query?: never;
194
+ header?: never;
195
+ path?: never;
196
+ cookie?: never;
197
+ };
198
+ } & {
199
+ body: {
200
+ access_token: string;
201
+ } & {};
202
+ } & {
203
+ baseUrl?: string;
204
+ querySerializer?: import("openapi-fetch").QuerySerializerOptions | import("openapi-fetch").QuerySerializer<{
205
+ parameters: {
206
+ query?: never;
207
+ header?: never;
208
+ path?: never;
209
+ cookie?: never;
210
+ };
211
+ requestBody: {
212
+ content: {
213
+ "application/json": {
214
+ access_token: string;
215
+ };
216
+ };
217
+ };
218
+ responses: {
219
+ 200: {
220
+ headers: {
221
+ [name: string]: unknown;
222
+ };
223
+ content: {
224
+ "application/json": {
225
+ data: {
226
+ guest_id: string;
227
+ user_id: string;
228
+ status: string;
229
+ };
230
+ };
231
+ };
232
+ };
233
+ 401: {
234
+ headers: {
235
+ [name: string]: unknown;
236
+ };
237
+ content: {
238
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
239
+ };
240
+ };
241
+ 403: {
242
+ headers: {
243
+ [name: string]: unknown;
244
+ };
245
+ content: {
246
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
247
+ };
248
+ };
249
+ 422: {
250
+ headers: {
251
+ [name: string]: unknown;
252
+ };
253
+ content: {
254
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
255
+ };
256
+ };
257
+ };
258
+ }>;
259
+ bodySerializer?: import("openapi-fetch").BodySerializer<{
260
+ parameters: {
261
+ query?: never;
262
+ header?: never;
263
+ path?: never;
264
+ cookie?: never;
265
+ };
266
+ requestBody: {
267
+ content: {
268
+ "application/json": {
269
+ access_token: string;
270
+ };
271
+ };
272
+ };
273
+ responses: {
274
+ 200: {
275
+ headers: {
276
+ [name: string]: unknown;
277
+ };
278
+ content: {
279
+ "application/json": {
280
+ data: {
281
+ guest_id: string;
282
+ user_id: string;
283
+ status: string;
284
+ };
285
+ };
286
+ };
287
+ };
288
+ 401: {
289
+ headers: {
290
+ [name: string]: unknown;
291
+ };
292
+ content: {
293
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
294
+ };
295
+ };
296
+ 403: {
297
+ headers: {
298
+ [name: string]: unknown;
299
+ };
300
+ content: {
301
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
302
+ };
303
+ };
304
+ 422: {
305
+ headers: {
306
+ [name: string]: unknown;
307
+ };
308
+ content: {
309
+ "application/problem+json": import("./schema.js").components["schemas"]["Problem"];
310
+ };
311
+ };
312
+ };
313
+ }>;
314
+ pathSerializer?: import("openapi-fetch").PathSerializer;
315
+ parseAs?: import("openapi-fetch").ParseAs;
316
+ fetch?: import("openapi-fetch").ClientOptions["fetch"];
317
+ headers?: import("openapi-fetch").HeadersOptions;
318
+ middleware?: import("openapi-fetch").Middleware[];
319
+ } & Omit<RequestInit, "body" | "headers">, `${string}/${string}`>>;
320
+ /** POST /anonymous/sign-in: Sign in as a guest */
321
+ signIn: (init_0?: ({
322
+ params?: {
323
+ query?: never;
324
+ header?: never;
325
+ path?: never;
326
+ cookie?: never;
327
+ };
328
+ } & {
329
+ body?: undefined;
330
+ } & {
331
+ baseUrl?: string;
332
+ querySerializer?: import("openapi-fetch").QuerySerializerOptions | import("openapi-fetch").QuerySerializer<{
333
+ parameters: {
334
+ query?: never;
335
+ header?: never;
336
+ path?: never;
337
+ cookie?: never;
338
+ };
339
+ requestBody?: never;
340
+ responses: {
341
+ 201: {
342
+ headers: {
343
+ [name: string]: unknown;
344
+ };
345
+ content: {
346
+ "application/json": {
347
+ data: {
348
+ access_token: string;
349
+ token_type: string;
350
+ expires_in: number;
351
+ refresh_token: string;
352
+ user: {
353
+ id: string;
354
+ email: string;
355
+ email_verified: boolean;
356
+ };
357
+ };
358
+ };
359
+ };
360
+ };
361
+ };
362
+ }>;
363
+ bodySerializer?: import("openapi-fetch").BodySerializer<{
364
+ parameters: {
365
+ query?: never;
366
+ header?: never;
367
+ path?: never;
368
+ cookie?: never;
369
+ };
370
+ requestBody?: never;
371
+ responses: {
372
+ 201: {
373
+ headers: {
374
+ [name: string]: unknown;
375
+ };
376
+ content: {
377
+ "application/json": {
378
+ data: {
379
+ access_token: string;
380
+ token_type: string;
381
+ expires_in: number;
382
+ refresh_token: string;
383
+ user: {
384
+ id: string;
385
+ email: string;
386
+ email_verified: boolean;
387
+ };
388
+ };
389
+ };
390
+ };
391
+ };
392
+ };
393
+ }>;
394
+ pathSerializer?: import("openapi-fetch").PathSerializer;
395
+ parseAs?: import("openapi-fetch").ParseAs;
396
+ fetch?: import("openapi-fetch").ClientOptions["fetch"];
397
+ headers?: import("openapi-fetch").HeadersOptions;
398
+ middleware?: import("openapi-fetch").Middleware[];
399
+ } & Omit<RequestInit, "body" | "headers"> & {
400
+ [key: string]: unknown;
401
+ }) | undefined) => Promise<import("openapi-fetch").FetchResponse<{
402
+ parameters: {
403
+ query?: never;
404
+ header?: never;
405
+ path?: never;
406
+ cookie?: never;
407
+ };
408
+ requestBody?: never;
409
+ responses: {
410
+ 201: {
411
+ headers: {
412
+ [name: string]: unknown;
413
+ };
414
+ content: {
415
+ "application/json": {
416
+ data: {
417
+ access_token: string;
418
+ token_type: string;
419
+ expires_in: number;
420
+ refresh_token: string;
421
+ user: {
422
+ id: string;
423
+ email: string;
424
+ email_verified: boolean;
425
+ };
426
+ };
427
+ };
428
+ };
429
+ };
430
+ };
431
+ }, ({
432
+ params?: {
433
+ query?: never;
434
+ header?: never;
435
+ path?: never;
436
+ cookie?: never;
437
+ };
438
+ } & {
439
+ body?: undefined;
440
+ } & {
441
+ baseUrl?: string;
442
+ querySerializer?: import("openapi-fetch").QuerySerializerOptions | import("openapi-fetch").QuerySerializer<{
443
+ parameters: {
444
+ query?: never;
445
+ header?: never;
446
+ path?: never;
447
+ cookie?: never;
448
+ };
449
+ requestBody?: never;
450
+ responses: {
451
+ 201: {
452
+ headers: {
453
+ [name: string]: unknown;
454
+ };
455
+ content: {
456
+ "application/json": {
457
+ data: {
458
+ access_token: string;
459
+ token_type: string;
460
+ expires_in: number;
461
+ refresh_token: string;
462
+ user: {
463
+ id: string;
464
+ email: string;
465
+ email_verified: boolean;
466
+ };
467
+ };
468
+ };
469
+ };
470
+ };
471
+ };
472
+ }>;
473
+ bodySerializer?: import("openapi-fetch").BodySerializer<{
474
+ parameters: {
475
+ query?: never;
476
+ header?: never;
477
+ path?: never;
478
+ cookie?: never;
479
+ };
480
+ requestBody?: never;
481
+ responses: {
482
+ 201: {
483
+ headers: {
484
+ [name: string]: unknown;
485
+ };
486
+ content: {
487
+ "application/json": {
488
+ data: {
489
+ access_token: string;
490
+ token_type: string;
491
+ expires_in: number;
492
+ refresh_token: string;
493
+ user: {
494
+ id: string;
495
+ email: string;
496
+ email_verified: boolean;
497
+ };
498
+ };
499
+ };
500
+ };
501
+ };
502
+ };
503
+ }>;
504
+ pathSerializer?: import("openapi-fetch").PathSerializer;
505
+ parseAs?: import("openapi-fetch").ParseAs;
506
+ fetch?: import("openapi-fetch").ClientOptions["fetch"];
507
+ headers?: import("openapi-fetch").HeadersOptions;
508
+ middleware?: import("openapi-fetch").Middleware[];
509
+ } & Omit<RequestInit, "body" | "headers"> & {
510
+ [key: string]: unknown;
511
+ }) | undefined, `${string}/${string}`>>;
512
+ };
513
+ export type AnonymousApi = ReturnType<typeof anonymous>;
@@ -0,0 +1,9 @@
1
+ /** The `anonymous` plugin's routes as methods of `client.anonymous`. */
2
+ export function anonymous(client) {
3
+ return {
4
+ /** POST /anonymous/convert: Convert the guest into an account */
5
+ convert: (...init) => client.POST("/anonymous/convert", ...init),
6
+ /** POST /anonymous/sign-in: Sign in as a guest */
7
+ signIn: (...init) => client.POST("/anonymous/sign-in", ...init),
8
+ };
9
+ }
package/dist/index.d.ts CHANGED
@@ -1,23 +1,31 @@
1
1
  import { type Client, type ClientOptions } from "openapi-fetch";
2
2
  import { type AdminApi } from "./admin.js";
3
+ import { type AnonymousApi } from "./anonymous.js";
3
4
  import { type AuditApi } from "./audit.js";
4
5
  import { type ChallengeOptions } from "./challenge.js";
6
+ import { type MultiSessionApi } from "./multi-session.js";
7
+ import { type PasswordlessApi } from "./passwordless.js";
5
8
  import { type SentinelApi } from "./sentinel.js";
6
9
  import { type ScimApi } from "./scim.js";
7
10
  import { type SsoApi } from "./sso.js";
11
+ import { type UsernameApi } from "./username.js";
8
12
  import type { components, paths } from "./schema.js";
9
13
  export type { components, operations, paths } from "./schema.js";
10
14
  export { admin, type AdminApi } from "./admin.js";
15
+ export { anonymous, type AnonymousApi } from "./anonymous.js";
11
16
  export { audit, type AuditApi } from "./audit.js";
12
17
  export { challengeRetry, type ChallengeOptions } from "./challenge.js";
18
+ export { multiSession, type MultiSessionApi } from "./multi-session.js";
19
+ export { passwordless, type PasswordlessApi } from "./passwordless.js";
13
20
  export { sentinel, type SentinelApi } from "./sentinel.js";
14
21
  export { scim, type ScimApi } from "./scim.js";
15
22
  export { sso, type SsoApi } from "./sso.js";
23
+ export { username, type UsernameApi } from "./username.js";
16
24
  /** The `{ error, message }` envelope every non-2xx response of a core route carries. */
17
25
  export type ErrorBody = components["schemas"]["Error"];
18
26
  /** The `{ errors: [...] }` envelope of a core route's 422. */
19
27
  export type ValidationErrorBody = components["schemas"]["ValidationError"];
20
- /** The RFC 9457 problem document every non-2xx response of a plugin route (`audit`, `admin`, `sentinel`, `sso`, `scim`) carries. */
28
+ /** The RFC 9457 problem document every non-2xx response of a plugin route (`audit`, `admin`, `sentinel`, `sso`, `scim`, `passwordless`, `username`, `anonymous`, `multi-session`) carries. */
21
29
  export type ProblemBody = components["schemas"]["Problem"];
22
30
  export interface PolarisClientOptions extends ClientOptions {
23
31
  /** Where Polaris is mounted: `https://app.example.com`, or `https://app.example.com/api/auth` behind a prefix. */
@@ -44,13 +52,25 @@ export interface PolarisClient extends Client<paths> {
44
52
  readonly sso: SsoApi;
45
53
  /** The `polaris/scim` routes: the organization's connections, the operators' list, and the SCIM server itself for a directory client. */
46
54
  readonly scim: ScimApi;
55
+ /** The `polaris/passwordless` routes: `client.passwordless.magicLinkSend()`, `magicLinkExchange()`, `emailOtpSend()`, `emailOtpVerify()`, `phoneSend()`, `phoneVerify()`, `oneTimeTokenGenerate()`, ... */
56
+ readonly passwordless: PasswordlessApi;
57
+ /** The `polaris/username` routes: `client.username.signIn()` (a username or an email) and `update()`. */
58
+ readonly username: UsernameApi;
59
+ /** The `polaris/anonymous` routes: `client.anonymous.signIn()` for a guest and `convert()` once it has an account. */
60
+ readonly anonymous: AnonymousApi;
61
+ /**
62
+ * The `polaris/multi-session` routes: `client.multiSession.list()`, `switch()`, `revoke()`, `lastMethod()`.
63
+ * The device travels as the `X-Polaris-Device` header a sign-in answers (or the HttpOnly cookie in a browser).
64
+ */
65
+ readonly multiSession: MultiSessionApi;
47
66
  /** A new client on the same options bound to another token (null for anonymous); this one is unchanged. */
48
67
  withToken(token: string | null): PolarisClient;
49
68
  }
50
69
  /**
51
70
  * An `openapi-fetch` client typed by `paths` (generated from `polaris manifest --format=openapi`), so
52
71
  * `client.POST("/auth/login", { body })` checks the body and types `data` and `error`; the plugins' routes
53
- * are also methods of `client.audit`, `client.admin`, `client.sentinel`, `client.sso` and `client.scim`; `challenge.captcha`
72
+ * are also methods of `client.audit`, `client.admin`, `client.sentinel`, `client.sso`, `client.scim`, `client.passwordless`,
73
+ * `client.username`, `client.anonymous` and `client.multiSession`; `challenge.captcha`
54
74
  * answers a sentinel captcha challenge with one retry. No refresh loop and no storage: when to refresh
55
75
  * and where to keep tokens is the application's policy.
56
76
  */
package/dist/index.js CHANGED
@@ -1,20 +1,29 @@
1
1
  import createOpenApiClient from "openapi-fetch";
2
2
  import { admin } from "./admin.js";
3
+ import { anonymous } from "./anonymous.js";
3
4
  import { audit } from "./audit.js";
4
5
  import { challengeRetry } from "./challenge.js";
6
+ import { multiSession } from "./multi-session.js";
7
+ import { passwordless } from "./passwordless.js";
5
8
  import { sentinel } from "./sentinel.js";
6
9
  import { scim } from "./scim.js";
7
10
  import { sso } from "./sso.js";
11
+ import { username } from "./username.js";
8
12
  export { admin } from "./admin.js";
13
+ export { anonymous } from "./anonymous.js";
9
14
  export { audit } from "./audit.js";
10
15
  export { challengeRetry } from "./challenge.js";
16
+ export { multiSession } from "./multi-session.js";
17
+ export { passwordless } from "./passwordless.js";
11
18
  export { sentinel } from "./sentinel.js";
12
19
  export { scim } from "./scim.js";
13
20
  export { sso } from "./sso.js";
21
+ export { username } from "./username.js";
14
22
  /**
15
23
  * An `openapi-fetch` client typed by `paths` (generated from `polaris manifest --format=openapi`), so
16
24
  * `client.POST("/auth/login", { body })` checks the body and types `data` and `error`; the plugins' routes
17
- * are also methods of `client.audit`, `client.admin`, `client.sentinel`, `client.sso` and `client.scim`; `challenge.captcha`
25
+ * are also methods of `client.audit`, `client.admin`, `client.sentinel`, `client.sso`, `client.scim`, `client.passwordless`,
26
+ * `client.username`, `client.anonymous` and `client.multiSession`; `challenge.captcha`
18
27
  * answers a sentinel captcha challenge with one retry. No refresh loop and no storage: when to refresh
19
28
  * and where to keep tokens is the application's policy.
20
29
  */
@@ -40,6 +49,10 @@ export function createClient(options) {
40
49
  sentinel: sentinel(client),
41
50
  sso: sso(client),
42
51
  scim: scim(client),
52
+ passwordless: passwordless(client),
53
+ username: username(client),
54
+ anonymous: anonymous(client),
55
+ multiSession: multiSession(client),
43
56
  withToken: (next) => createClient({ ...options, token: next }),
44
57
  };
45
58
  }