@cavuno/board 1.18.0 → 1.19.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/index.js CHANGED
@@ -149,7 +149,7 @@ async function clearSession(storage) {
149
149
  }
150
150
 
151
151
  // src/version.ts
152
- var SDK_VERSION = "1.18.0";
152
+ var SDK_VERSION = "1.19.1";
153
153
 
154
154
  // src/client.ts
155
155
  function isRawBody(body) {
@@ -374,6 +374,74 @@ function authNamespace(client) {
374
374
  method: "POST",
375
375
  body
376
376
  });
377
+ },
378
+ /**
379
+ * Request a passwordless magic link. The API always resolves 204
380
+ * when the request is accepted; the email link lands on the
381
+ * board/starter `/auth/magic-link` route.
382
+ *
383
+ * @example
384
+ * await board.auth.requestMagicLink({
385
+ * email: 'a@b.com',
386
+ * returnTo: '/account',
387
+ * });
388
+ */
389
+ requestMagicLink(body, options) {
390
+ return client.fetch("/auth/magic-link", {
391
+ ...options,
392
+ method: "POST",
393
+ body
394
+ });
395
+ },
396
+ /**
397
+ * Consume a magic-link token and persist the returned bearer pair.
398
+ *
399
+ * @example
400
+ * await board.auth.consumeMagicLink({ token });
401
+ */
402
+ async consumeMagicLink(body, options) {
403
+ const session = await client.fetch(
404
+ "/auth/magic-link/consume",
405
+ {
406
+ ...options,
407
+ method: "POST",
408
+ body
409
+ }
410
+ );
411
+ return persist(session);
412
+ },
413
+ /**
414
+ * Build a provider authorization URL. The SDK returns the URL; the
415
+ * host app owns browser navigation.
416
+ *
417
+ * @example
418
+ * const { authorizeUrl } = await board.auth.getOAuthAuthorizationUrl('google');
419
+ * window.location.href = authorizeUrl;
420
+ */
421
+ getOAuthAuthorizationUrl(provider, query, options) {
422
+ return client.fetch(`/auth/oauth/${provider}`, {
423
+ ...options,
424
+ method: "GET",
425
+ query
426
+ });
427
+ },
428
+ /**
429
+ * Exchange the provider callback one-time token and persist the
430
+ * returned bearer pair.
431
+ *
432
+ * @example
433
+ * await board.auth.exchangeOAuth({ token });
434
+ */
435
+ async exchangeOAuth(body, options) {
436
+ const session = await client.fetch(
437
+ "/auth/oauth/exchange",
438
+ {
439
+ ...options,
440
+ method: "POST",
441
+ body
442
+ }
443
+ );
444
+ return persist(session);
377
445
  }
378
446
  };
379
447
  }
package/dist/index.mjs CHANGED
@@ -109,7 +109,7 @@ async function clearSession(storage) {
109
109
  }
110
110
 
111
111
  // src/version.ts
112
- var SDK_VERSION = "1.18.0";
112
+ var SDK_VERSION = "1.19.1";
113
113
 
114
114
  // src/client.ts
115
115
  function isRawBody(body) {
@@ -334,6 +334,74 @@ function authNamespace(client) {
334
334
  method: "POST",
335
335
  body
336
336
  });
337
+ },
338
+ /**
339
+ * Request a passwordless magic link. The API always resolves 204
340
+ * when the request is accepted; the email link lands on the
341
+ * board/starter `/auth/magic-link` route.
342
+ *
343
+ * @example
344
+ * await board.auth.requestMagicLink({
345
+ * email: 'a@b.com',
346
+ * returnTo: '/account',
347
+ * });
348
+ */
349
+ requestMagicLink(body, options) {
350
+ return client.fetch("/auth/magic-link", {
351
+ ...options,
352
+ method: "POST",
353
+ body
354
+ });
355
+ },
356
+ /**
357
+ * Consume a magic-link token and persist the returned bearer pair.
358
+ *
359
+ * @example
360
+ * await board.auth.consumeMagicLink({ token });
361
+ */
362
+ async consumeMagicLink(body, options) {
363
+ const session = await client.fetch(
364
+ "/auth/magic-link/consume",
365
+ {
366
+ ...options,
367
+ method: "POST",
368
+ body
369
+ }
370
+ );
371
+ return persist(session);
372
+ },
373
+ /**
374
+ * Build a provider authorization URL. The SDK returns the URL; the
375
+ * host app owns browser navigation.
376
+ *
377
+ * @example
378
+ * const { authorizeUrl } = await board.auth.getOAuthAuthorizationUrl('google');
379
+ * window.location.href = authorizeUrl;
380
+ */
381
+ getOAuthAuthorizationUrl(provider, query, options) {
382
+ return client.fetch(`/auth/oauth/${provider}`, {
383
+ ...options,
384
+ method: "GET",
385
+ query
386
+ });
387
+ },
388
+ /**
389
+ * Exchange the provider callback one-time token and persist the
390
+ * returned bearer pair.
391
+ *
392
+ * @example
393
+ * await board.auth.exchangeOAuth({ token });
394
+ */
395
+ async exchangeOAuth(body, options) {
396
+ const session = await client.fetch(
397
+ "/auth/oauth/exchange",
398
+ {
399
+ ...options,
400
+ method: "POST",
401
+ body
402
+ }
403
+ );
404
+ return persist(session);
337
405
  }
338
406
  };
339
407
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cavuno/board",
3
- "version": "1.18.0",
3
+ "version": "1.19.1",
4
4
  "description": "Typed isomorphic client for the Cavuno Board API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.18.0",
2
+ "version": "1.19.1",
3
3
  "skills": [
4
4
  {
5
5
  "name": "cavuno-board-auth",