@supabase/auth-js 2.73.0-rc.6 → 2.73.1-canary.4

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.
Files changed (98) hide show
  1. package/README.md +97 -32
  2. package/dist/main/GoTrueAdminApi.d.ts +41 -1
  3. package/dist/main/GoTrueAdminApi.d.ts.map +1 -1
  4. package/dist/main/GoTrueAdminApi.js +137 -0
  5. package/dist/main/GoTrueAdminApi.js.map +1 -1
  6. package/dist/main/GoTrueClient.d.ts +20 -1
  7. package/dist/main/GoTrueClient.d.ts.map +1 -1
  8. package/dist/main/GoTrueClient.js +18 -22
  9. package/dist/main/GoTrueClient.js.map +1 -1
  10. package/dist/main/lib/base64url.js +10 -11
  11. package/dist/main/lib/base64url.js.map +1 -1
  12. package/dist/main/lib/error-codes.d.ts +1 -1
  13. package/dist/main/lib/error-codes.d.ts.map +1 -1
  14. package/dist/main/lib/errors.d.ts.map +1 -1
  15. package/dist/main/lib/errors.js +7 -7
  16. package/dist/main/lib/errors.js.map +1 -1
  17. package/dist/main/lib/fetch.d.ts +2 -2
  18. package/dist/main/lib/fetch.d.ts.map +1 -1
  19. package/dist/main/lib/fetch.js +8 -9
  20. package/dist/main/lib/fetch.js.map +1 -1
  21. package/dist/main/lib/helpers.d.ts +1 -1
  22. package/dist/main/lib/helpers.d.ts.map +1 -1
  23. package/dist/main/lib/helpers.js +34 -24
  24. package/dist/main/lib/helpers.js.map +1 -1
  25. package/dist/main/lib/local-storage.js +1 -2
  26. package/dist/main/lib/local-storage.js.map +1 -1
  27. package/dist/main/lib/locks.js +3 -3
  28. package/dist/main/lib/locks.js.map +1 -1
  29. package/dist/main/lib/polyfills.js +1 -2
  30. package/dist/main/lib/polyfills.js.map +1 -1
  31. package/dist/main/lib/types.d.ts +254 -122
  32. package/dist/main/lib/types.d.ts.map +1 -1
  33. package/dist/main/lib/version.d.ts +1 -1
  34. package/dist/main/lib/version.d.ts.map +1 -1
  35. package/dist/main/lib/version.js +7 -1
  36. package/dist/main/lib/version.js.map +1 -1
  37. package/dist/main/lib/web3/ethereum.d.ts +9 -9
  38. package/dist/main/lib/web3/ethereum.d.ts.map +1 -1
  39. package/dist/main/lib/web3/ethereum.js +4 -5
  40. package/dist/main/lib/web3/ethereum.js.map +1 -1
  41. package/dist/main/lib/web3/solana.d.ts +4 -4
  42. package/dist/main/lib/web3/solana.d.ts.map +1 -1
  43. package/dist/main/lib/webauthn.d.ts +3 -3
  44. package/dist/main/lib/webauthn.d.ts.map +1 -1
  45. package/dist/main/lib/webauthn.dom.d.ts +9 -9
  46. package/dist/main/lib/webauthn.dom.d.ts.map +1 -1
  47. package/dist/main/lib/webauthn.errors.d.ts +1 -1
  48. package/dist/main/lib/webauthn.errors.d.ts.map +1 -1
  49. package/dist/main/lib/webauthn.errors.js +4 -4
  50. package/dist/main/lib/webauthn.errors.js.map +1 -1
  51. package/dist/main/lib/webauthn.js +11 -11
  52. package/dist/main/lib/webauthn.js.map +1 -1
  53. package/dist/module/GoTrueAdminApi.d.ts +41 -1
  54. package/dist/module/GoTrueAdminApi.d.ts.map +1 -1
  55. package/dist/module/GoTrueAdminApi.js +137 -0
  56. package/dist/module/GoTrueAdminApi.js.map +1 -1
  57. package/dist/module/GoTrueClient.d.ts +20 -1
  58. package/dist/module/GoTrueClient.d.ts.map +1 -1
  59. package/dist/module/GoTrueClient.js +19 -22
  60. package/dist/module/GoTrueClient.js.map +1 -1
  61. package/dist/module/lib/base64url.js.map +1 -1
  62. package/dist/module/lib/error-codes.d.ts +1 -1
  63. package/dist/module/lib/error-codes.d.ts.map +1 -1
  64. package/dist/module/lib/errors.d.ts.map +1 -1
  65. package/dist/module/lib/fetch.d.ts +2 -2
  66. package/dist/module/lib/fetch.d.ts.map +1 -1
  67. package/dist/module/lib/fetch.js.map +1 -1
  68. package/dist/module/lib/helpers.d.ts +1 -1
  69. package/dist/module/lib/helpers.d.ts.map +1 -1
  70. package/dist/module/lib/helpers.js.map +1 -1
  71. package/dist/module/lib/locks.js.map +1 -1
  72. package/dist/module/lib/polyfills.js.map +1 -1
  73. package/dist/module/lib/types.d.ts +254 -122
  74. package/dist/module/lib/types.d.ts.map +1 -1
  75. package/dist/module/lib/version.d.ts +1 -1
  76. package/dist/module/lib/version.d.ts.map +1 -1
  77. package/dist/module/lib/version.js +7 -1
  78. package/dist/module/lib/version.js.map +1 -1
  79. package/dist/module/lib/web3/ethereum.d.ts +9 -9
  80. package/dist/module/lib/web3/ethereum.d.ts.map +1 -1
  81. package/dist/module/lib/web3/ethereum.js.map +1 -1
  82. package/dist/module/lib/web3/solana.d.ts +4 -4
  83. package/dist/module/lib/web3/solana.d.ts.map +1 -1
  84. package/dist/module/lib/webauthn.d.ts +3 -3
  85. package/dist/module/lib/webauthn.d.ts.map +1 -1
  86. package/dist/module/lib/webauthn.dom.d.ts +9 -9
  87. package/dist/module/lib/webauthn.dom.d.ts.map +1 -1
  88. package/dist/module/lib/webauthn.errors.d.ts +1 -1
  89. package/dist/module/lib/webauthn.errors.d.ts.map +1 -1
  90. package/dist/module/lib/webauthn.errors.js.map +1 -1
  91. package/dist/module/lib/webauthn.js +1 -1
  92. package/dist/module/lib/webauthn.js.map +1 -1
  93. package/package.json +13 -34
  94. package/src/GoTrueAdminApi.ts +163 -0
  95. package/src/GoTrueClient.ts +28 -9
  96. package/src/lib/types.ts +149 -7
  97. package/src/lib/version.ts +7 -1
  98. package/src/lib/webauthn.dom.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supabase/auth-js",
3
- "version": "2.73.0-rc.6",
3
+ "version": "2.73.1-canary.4",
4
4
  "private": false,
5
5
  "description": "Official client library for Supabase Auth",
6
6
  "keywords": [
@@ -9,8 +9,8 @@
9
9
  "auth",
10
10
  "authentication"
11
11
  ],
12
- "homepage": "https://github.com/supabase/auth-js",
13
- "bugs": "https://github.com/supabase/auth-js/issues",
12
+ "homepage": "https://github.com/supabase/supabase-js/tree/master/packages/core/auth-js",
13
+ "bugs": "https://github.com/supabase/supabase-js/issues",
14
14
  "license": "MIT",
15
15
  "author": "Supabase",
16
16
  "files": [
@@ -20,16 +20,19 @@
20
20
  "main": "dist/main/index.js",
21
21
  "module": "dist/module/index.js",
22
22
  "types": "dist/module/index.d.ts",
23
- "repository": "github:supabase/auth-js",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/supabase/supabase-js.git",
26
+ "directory": "packages/core/auth-js"
27
+ },
24
28
  "scripts": {
25
29
  "clean": "rimraf dist docs",
26
30
  "coverage": "echo \"run npm test\"",
27
- "format": "prettier --write \"{src,test}/**/*.ts\"",
28
- "build": "genversion src/lib/version.ts --es6 && run-s clean format build:* && run-s lint",
31
+ "build:node18": "npm run clean && npm run build:main && npm run build:module",
32
+ "build": "npm run clean && npx nx build:main auth-js && npx nx build:module auth-js",
29
33
  "build:main": "tsc -p tsconfig.json",
30
34
  "build:module": "tsc -p tsconfig.module.json",
31
- "lint": "eslint ./src/**/* test/**/*.test.ts",
32
- "test": "run-s test:clean test:infra test:suite test:clean",
35
+ "test:auth": "npm run test:clean && npm run test:infra && npm run test:suite && npm run test:clean",
33
36
  "test:suite": "npm --prefix ./test run test",
34
37
  "test:infra": "cd infra && docker compose down && docker compose pull && docker compose up -d && sleep 30",
35
38
  "test:clean": "cd infra && docker compose down",
@@ -37,34 +40,10 @@
37
40
  "docs:json": "typedoc --json docs/v2/spec.json --excludeExternals --excludePrivate --excludeProtected src/index.ts"
38
41
  },
39
42
  "dependencies": {
40
- "@supabase/node-fetch": "^2.6.14"
43
+ "@supabase/node-fetch": "2.6.15"
41
44
  },
42
45
  "devDependencies": {
43
- "@types/faker": "^5.1.6",
44
- "@types/jest": "^28.1.6",
45
- "@types/jsonwebtoken": "^8.5.6",
46
- "@types/node": "^18.16.19",
47
- "@types/node-fetch": "^2.6.4",
48
- "@typescript-eslint/eslint-plugin": "^5.30.7",
49
- "@typescript-eslint/parser": "^5.30.7",
50
- "eslint": "^8.20.0",
51
- "eslint-config-prettier": "^8.5.0",
52
- "eslint-config-standard": "^17.0.0",
53
- "eslint-plugin-import": "^2.26.0",
54
- "eslint-plugin-node": "^11.1.0",
55
- "eslint-plugin-promise": "^6.0.0",
56
- "faker": "^5.3.1",
57
- "genversion": "^3.1.1",
58
46
  "jest": "^28.1.3",
59
- "jest-environment-jsdom": "^28.1.3",
60
- "jest-mock-server": "^0.1.0",
61
- "jsonwebtoken": "^9.0.0",
62
- "npm-run-all": "^4.1.5",
63
- "prettier": "2.7.1",
64
- "rimraf": "^3.0.2",
65
- "semantic-release-plugin-update-version-in-files": "^1.1.0",
66
- "ts-jest": "^28.0.7",
67
- "typedoc": "^0.23.28",
68
- "typescript": "^4.7.4"
47
+ "ts-jest": "^28.0.7"
69
48
  }
70
49
  }
@@ -21,6 +21,10 @@ import {
21
21
  PageParams,
22
22
  SIGN_OUT_SCOPES,
23
23
  SignOutScope,
24
+ GoTrueAdminOAuthApi,
25
+ CreateOAuthClientParams,
26
+ OAuthClientResponse,
27
+ OAuthClientListResponse,
24
28
  } from './lib/types'
25
29
  import { AuthError, isAuthError } from './lib/errors'
26
30
 
@@ -28,6 +32,12 @@ export default class GoTrueAdminApi {
28
32
  /** Contains all MFA administration methods. */
29
33
  mfa: GoTrueAdminMFAApi
30
34
 
35
+ /**
36
+ * Contains all OAuth client administration methods.
37
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
38
+ */
39
+ oauth: GoTrueAdminOAuthApi
40
+
31
41
  protected url: string
32
42
  protected headers: {
33
43
  [key: string]: string
@@ -52,6 +62,13 @@ export default class GoTrueAdminApi {
52
62
  listFactors: this._listFactors.bind(this),
53
63
  deleteFactor: this._deleteFactor.bind(this),
54
64
  }
65
+ this.oauth = {
66
+ listClients: this._listOAuthClients.bind(this),
67
+ createClient: this._createOAuthClient.bind(this),
68
+ getClient: this._getOAuthClient.bind(this),
69
+ deleteClient: this._deleteOAuthClient.bind(this),
70
+ regenerateClientSecret: this._regenerateOAuthClientSecret.bind(this),
71
+ }
55
72
  }
56
73
 
57
74
  /**
@@ -349,4 +366,150 @@ export default class GoTrueAdminApi {
349
366
  throw error
350
367
  }
351
368
  }
369
+
370
+ /**
371
+ * Lists all OAuth clients with optional pagination.
372
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
373
+ *
374
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
375
+ */
376
+ private async _listOAuthClients(params?: PageParams): Promise<OAuthClientListResponse> {
377
+ try {
378
+ const pagination: Pagination = { nextPage: null, lastPage: 0, total: 0 }
379
+ const response = await _request(this.fetch, 'GET', `${this.url}/admin/oauth/clients`, {
380
+ headers: this.headers,
381
+ noResolveJson: true,
382
+ query: {
383
+ page: params?.page?.toString() ?? '',
384
+ per_page: params?.perPage?.toString() ?? '',
385
+ },
386
+ xform: _noResolveJsonResponse,
387
+ })
388
+ if (response.error) throw response.error
389
+
390
+ const clients = await response.json()
391
+ const total = response.headers.get('x-total-count') ?? 0
392
+ const links = response.headers.get('link')?.split(',') ?? []
393
+ if (links.length > 0) {
394
+ links.forEach((link: string) => {
395
+ const page = parseInt(link.split(';')[0].split('=')[1].substring(0, 1))
396
+ const rel = JSON.parse(link.split(';')[1].split('=')[1])
397
+ pagination[`${rel}Page`] = page
398
+ })
399
+
400
+ pagination.total = parseInt(total)
401
+ }
402
+ return { data: { ...clients, ...pagination }, error: null }
403
+ } catch (error) {
404
+ if (isAuthError(error)) {
405
+ return { data: { clients: [] }, error }
406
+ }
407
+ throw error
408
+ }
409
+ }
410
+
411
+ /**
412
+ * Creates a new OAuth client.
413
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
414
+ *
415
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
416
+ */
417
+ private async _createOAuthClient(
418
+ params: CreateOAuthClientParams
419
+ ): Promise<OAuthClientResponse> {
420
+ try {
421
+ return await _request(this.fetch, 'POST', `${this.url}/admin/oauth/clients`, {
422
+ body: params,
423
+ headers: this.headers,
424
+ xform: (client: any) => {
425
+ return { data: client, error: null }
426
+ },
427
+ })
428
+ } catch (error) {
429
+ if (isAuthError(error)) {
430
+ return { data: null, error }
431
+ }
432
+
433
+ throw error
434
+ }
435
+ }
436
+
437
+ /**
438
+ * Gets details of a specific OAuth client.
439
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
440
+ *
441
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
442
+ */
443
+ private async _getOAuthClient(clientId: string): Promise<OAuthClientResponse> {
444
+ try {
445
+ return await _request(this.fetch, 'GET', `${this.url}/admin/oauth/clients/${clientId}`, {
446
+ headers: this.headers,
447
+ xform: (client: any) => {
448
+ return { data: client, error: null }
449
+ },
450
+ })
451
+ } catch (error) {
452
+ if (isAuthError(error)) {
453
+ return { data: null, error }
454
+ }
455
+
456
+ throw error
457
+ }
458
+ }
459
+
460
+ /**
461
+ * Deletes an OAuth client.
462
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
463
+ *
464
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
465
+ */
466
+ private async _deleteOAuthClient(clientId: string): Promise<OAuthClientResponse> {
467
+ try {
468
+ return await _request(
469
+ this.fetch,
470
+ 'DELETE',
471
+ `${this.url}/admin/oauth/clients/${clientId}`,
472
+ {
473
+ headers: this.headers,
474
+ xform: (client: any) => {
475
+ return { data: client, error: null }
476
+ },
477
+ }
478
+ )
479
+ } catch (error) {
480
+ if (isAuthError(error)) {
481
+ return { data: null, error }
482
+ }
483
+
484
+ throw error
485
+ }
486
+ }
487
+
488
+ /**
489
+ * Regenerates the secret for an OAuth client.
490
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
491
+ *
492
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
493
+ */
494
+ private async _regenerateOAuthClientSecret(clientId: string): Promise<OAuthClientResponse> {
495
+ try {
496
+ return await _request(
497
+ this.fetch,
498
+ 'POST',
499
+ `${this.url}/admin/oauth/clients/${clientId}/regenerate_secret`,
500
+ {
501
+ headers: this.headers,
502
+ xform: (client: any) => {
503
+ return { data: client, error: null }
504
+ },
505
+ }
506
+ )
507
+ } catch (error) {
508
+ if (isAuthError(error)) {
509
+ return { data: null, error }
510
+ }
511
+
512
+ throw error
513
+ }
514
+ }
352
515
  }
@@ -2078,8 +2078,30 @@ export default class GoTrueClient {
2078
2078
 
2079
2079
  /**
2080
2080
  * Receive a notification every time an auth event happens.
2081
+ * Safe to use without an async function as callback.
2082
+ *
2081
2083
  * @param callback A callback function to be invoked when an auth event happens.
2082
2084
  */
2085
+ onAuthStateChange(callback: (event: AuthChangeEvent, session: Session | null) => void): {
2086
+ data: { subscription: Subscription }
2087
+ }
2088
+
2089
+ /**
2090
+ * Avoid using an async function inside `onAuthStateChange` as you might end
2091
+ * up with a deadlock. The callback function runs inside an exclusive lock,
2092
+ * so calling other Supabase Client APIs that also try to acquire the
2093
+ * exclusive lock, might cause a deadlock. This behavior is observable across
2094
+ * tabs. In the next major library version, this behavior will not be supported.
2095
+ *
2096
+ * Receive a notification every time an auth event happens.
2097
+ *
2098
+ * @param callback A callback function to be invoked when an auth event happens.
2099
+ * @deprecated Due to the possibility of deadlocks with async functions as callbacks, use the version without an async function.
2100
+ */
2101
+ onAuthStateChange(callback: (event: AuthChangeEvent, session: Session | null) => Promise<void>): {
2102
+ data: { subscription: Subscription }
2103
+ }
2104
+
2083
2105
  onAuthStateChange(
2084
2106
  callback: (event: AuthChangeEvent, session: Session | null) => void | Promise<void>
2085
2107
  ): {
@@ -3022,8 +3044,8 @@ export default class GoTrueClient {
3022
3044
  ...(params.factorType === 'phone'
3023
3045
  ? { phone: params.phone }
3024
3046
  : params.factorType === 'totp'
3025
- ? { issuer: params.issuer }
3026
- : {}),
3047
+ ? { issuer: params.issuer }
3048
+ : {}),
3027
3049
  }
3028
3050
 
3029
3051
  const { data, error } = (await _request(this.fetch, 'POST', `${this.url}/factors`, {
@@ -3072,12 +3094,9 @@ export default class GoTrueClient {
3072
3094
  | Prettify<
3073
3095
  StrictOmit<MFAVerifyWebauthnParams, 'webauthn'> & {
3074
3096
  webauthn: Prettify<
3075
- | StrictOmit<
3076
- MFAVerifyWebauthnParamFields['webauthn'],
3077
- 'credential_response'
3078
- > & {
3079
- credential_response: PublicKeyCredentialJSON
3080
- }
3097
+ StrictOmit<MFAVerifyWebauthnParamFields['webauthn'], 'credential_response'> & {
3098
+ credential_response: PublicKeyCredentialJSON
3099
+ }
3081
3100
  >
3082
3101
  }
3083
3102
  >,
@@ -3271,7 +3290,7 @@ export default class GoTrueClient {
3271
3290
  for (const factor of user?.factors ?? []) {
3272
3291
  data.all.push(factor)
3273
3292
  if (factor.status === 'verified') {
3274
- ;(data[factor.factor_type] as typeof factor[]).push(factor)
3293
+ ;(data[factor.factor_type] as (typeof factor)[]).push(factor)
3275
3294
  }
3276
3295
  }
3277
3296
 
package/src/lib/types.ts CHANGED
@@ -111,7 +111,7 @@ export type GoTrueClientOptions = {
111
111
 
112
112
  const WeakPasswordReasons = ['length', 'characters', 'pwned'] as const
113
113
 
114
- export type WeakPasswordReasons = typeof WeakPasswordReasons[number]
114
+ export type WeakPasswordReasons = (typeof WeakPasswordReasons)[number]
115
115
  export type WeakPassword = {
116
116
  reasons: WeakPasswordReasons[]
117
117
  message: string
@@ -266,7 +266,7 @@ const AMRMethods = [
266
266
  'web3',
267
267
  ] as const
268
268
 
269
- export type AMRMethod = typeof AMRMethods[number] | (string & {})
269
+ export type AMRMethod = (typeof AMRMethods)[number] | (string & {})
270
270
 
271
271
  /**
272
272
  * An authentication methord reference (AMR) entry.
@@ -305,14 +305,14 @@ const FactorTypes = ['totp', 'phone', 'webauthn'] as const
305
305
  /**
306
306
  * Type of factor. `totp` and `phone` supported with this version
307
307
  */
308
- export type FactorType = typeof FactorTypes[number]
308
+ export type FactorType = (typeof FactorTypes)[number]
309
309
 
310
310
  const FactorVerificationStatuses = ['verified', 'unverified'] as const
311
311
 
312
312
  /**
313
313
  * The verification status of the factor, default is `unverified` after `.enroll()`, then `verified` after the user verifies it with `.verify()`
314
314
  */
315
- type FactorVerificationStatus = typeof FactorVerificationStatuses[number]
315
+ type FactorVerificationStatus = (typeof FactorVerificationStatuses)[number]
316
316
 
317
317
  /**
318
318
  * A MFA factor.
@@ -323,7 +323,7 @@ type FactorVerificationStatus = typeof FactorVerificationStatuses[number]
323
323
  */
324
324
  export type Factor<
325
325
  Type extends FactorType = FactorType,
326
- Status extends FactorVerificationStatus = typeof FactorVerificationStatuses[number]
326
+ Status extends FactorVerificationStatus = (typeof FactorVerificationStatuses)[number],
327
327
  > = {
328
328
  /** ID of the factor. */
329
329
  id: string
@@ -938,7 +938,7 @@ type MFAChallengeParamsBase = {
938
938
  }
939
939
 
940
940
  const MFATOTPChannels = ['sms', 'whatsapp'] as const
941
- export type MFATOTPChannel = typeof MFATOTPChannels[number]
941
+ export type MFATOTPChannel = (typeof MFATOTPChannels)[number]
942
942
 
943
943
  export type MFAChallengeTOTPParams = Prettify<MFAChallengeParamsBase>
944
944
 
@@ -1447,4 +1447,146 @@ export interface JWK {
1447
1447
  }
1448
1448
 
1449
1449
  export const SIGN_OUT_SCOPES = ['global', 'local', 'others'] as const
1450
- export type SignOutScope = typeof SIGN_OUT_SCOPES[number]
1450
+ export type SignOutScope = (typeof SIGN_OUT_SCOPES)[number]
1451
+
1452
+ /**
1453
+ * OAuth client grant types supported by the OAuth 2.1 server.
1454
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1455
+ */
1456
+ export type OAuthClientGrantType = 'authorization_code' | 'refresh_token'
1457
+
1458
+ /**
1459
+ * OAuth client response types supported by the OAuth 2.1 server.
1460
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1461
+ */
1462
+ export type OAuthClientResponseType = 'code'
1463
+
1464
+ /**
1465
+ * OAuth client type indicating whether the client can keep credentials confidential.
1466
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1467
+ */
1468
+ export type OAuthClientType = 'public' | 'confidential'
1469
+
1470
+ /**
1471
+ * OAuth client registration type.
1472
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1473
+ */
1474
+ export type OAuthClientRegistrationType = 'dynamic' | 'manual'
1475
+
1476
+ /**
1477
+ * OAuth client object returned from the OAuth 2.1 server.
1478
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1479
+ */
1480
+ export type OAuthClient = {
1481
+ /** Unique identifier for the OAuth client */
1482
+ client_id: string
1483
+ /** Human-readable name of the OAuth client */
1484
+ client_name: string
1485
+ /** Client secret (only returned on registration and regeneration) */
1486
+ client_secret?: string
1487
+ /** Type of OAuth client */
1488
+ client_type: OAuthClientType
1489
+ /** Token endpoint authentication method */
1490
+ token_endpoint_auth_method: string
1491
+ /** Registration type of the client */
1492
+ registration_type: OAuthClientRegistrationType
1493
+ /** URI of the OAuth client */
1494
+ client_uri?: string
1495
+ /** Array of allowed redirect URIs */
1496
+ redirect_uris: string[]
1497
+ /** Array of allowed grant types */
1498
+ grant_types: OAuthClientGrantType[]
1499
+ /** Array of allowed response types */
1500
+ response_types: OAuthClientResponseType[]
1501
+ /** Scope of the OAuth client */
1502
+ scope?: string
1503
+ /** Timestamp when the client was created */
1504
+ created_at: string
1505
+ /** Timestamp when the client was last updated */
1506
+ updated_at: string
1507
+ }
1508
+
1509
+ /**
1510
+ * Parameters for creating a new OAuth client.
1511
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1512
+ */
1513
+ export type CreateOAuthClientParams = {
1514
+ /** Human-readable name of the OAuth client */
1515
+ client_name: string
1516
+ /** URI of the OAuth client */
1517
+ client_uri?: string
1518
+ /** Array of allowed redirect URIs */
1519
+ redirect_uris: string[]
1520
+ /** Array of allowed grant types (optional, defaults to authorization_code and refresh_token) */
1521
+ grant_types?: OAuthClientGrantType[]
1522
+ /** Array of allowed response types (optional, defaults to code) */
1523
+ response_types?: OAuthClientResponseType[]
1524
+ /** Scope of the OAuth client */
1525
+ scope?: string
1526
+ }
1527
+
1528
+ /**
1529
+ * Response type for OAuth client operations.
1530
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1531
+ */
1532
+ export type OAuthClientResponse = RequestResult<OAuthClient>
1533
+
1534
+ /**
1535
+ * Response type for listing OAuth clients.
1536
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1537
+ */
1538
+ export type OAuthClientListResponse =
1539
+ | {
1540
+ data: { clients: OAuthClient[]; aud: string } & Pagination
1541
+ error: null
1542
+ }
1543
+ | {
1544
+ data: { clients: [] }
1545
+ error: AuthError
1546
+ }
1547
+
1548
+ /**
1549
+ * Contains all OAuth client administration methods.
1550
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1551
+ */
1552
+ export interface GoTrueAdminOAuthApi {
1553
+ /**
1554
+ * Lists all OAuth clients with optional pagination.
1555
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1556
+ *
1557
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
1558
+ */
1559
+ listClients(params?: PageParams): Promise<OAuthClientListResponse>
1560
+
1561
+ /**
1562
+ * Creates a new OAuth client.
1563
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1564
+ *
1565
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
1566
+ */
1567
+ createClient(params: CreateOAuthClientParams): Promise<OAuthClientResponse>
1568
+
1569
+ /**
1570
+ * Gets details of a specific OAuth client.
1571
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1572
+ *
1573
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
1574
+ */
1575
+ getClient(clientId: string): Promise<OAuthClientResponse>
1576
+
1577
+ /**
1578
+ * Deletes an OAuth client.
1579
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1580
+ *
1581
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
1582
+ */
1583
+ deleteClient(clientId: string): Promise<OAuthClientResponse>
1584
+
1585
+ /**
1586
+ * Regenerates the secret for an OAuth client.
1587
+ * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
1588
+ *
1589
+ * This function should only be called on a server. Never expose your `service_role` key in the browser.
1590
+ */
1591
+ regenerateClientSecret(clientId: string): Promise<OAuthClientResponse>
1592
+ }
@@ -1 +1,7 @@
1
- export const version = '2.73.0-rc.6'
1
+ // Generated automatically during releases by scripts/update-version-files.ts
2
+ // This file provides runtime access to the package version for:
3
+ // - HTTP request headers (e.g., X-Client-Info header for API requests)
4
+ // - Debugging and support (identifying which version is running)
5
+ // - Telemetry and logging (version reporting in errors/analytics)
6
+ // - Ensuring build artifacts match the published package version
7
+ export const version = '2.73.1-canary.4'
@@ -535,7 +535,7 @@ export type PublicKeyCredentialJSON = RegistrationResponseJSON | AuthenticationR
535
535
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential MDN - PublicKeyCredential}
536
536
  */
537
537
  export interface PublicKeyCredentialFuture<
538
- T extends PublicKeyCredentialJSON = PublicKeyCredentialJSON
538
+ T extends PublicKeyCredentialJSON = PublicKeyCredentialJSON,
539
539
  > extends PublicKeyCredential {
540
540
  /**
541
541
  * The type of the credential (always "public-key").