@supabase/gotrue-js 2.43.0 → 2.44.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.
Files changed (38) hide show
  1. package/dist/main/GoTrueClient.d.ts +6 -1
  2. package/dist/main/GoTrueClient.d.ts.map +1 -1
  3. package/dist/main/GoTrueClient.js +51 -7
  4. package/dist/main/GoTrueClient.js.map +1 -1
  5. package/dist/main/index.d.ts +1 -0
  6. package/dist/main/index.d.ts.map +1 -1
  7. package/dist/main/index.js +5 -1
  8. package/dist/main/index.js.map +1 -1
  9. package/dist/main/lib/locks.d.ts +42 -0
  10. package/dist/main/lib/locks.d.ts.map +1 -0
  11. package/dist/main/lib/locks.js +135 -0
  12. package/dist/main/lib/locks.js.map +1 -0
  13. package/dist/main/lib/types.d.ts +23 -1
  14. package/dist/main/lib/types.d.ts.map +1 -1
  15. package/dist/main/lib/version.d.ts +1 -1
  16. package/dist/main/lib/version.js +1 -1
  17. package/dist/module/GoTrueClient.d.ts +6 -1
  18. package/dist/module/GoTrueClient.d.ts.map +1 -1
  19. package/dist/module/GoTrueClient.js +51 -7
  20. package/dist/module/GoTrueClient.js.map +1 -1
  21. package/dist/module/index.d.ts +1 -0
  22. package/dist/module/index.d.ts.map +1 -1
  23. package/dist/module/index.js +1 -0
  24. package/dist/module/index.js.map +1 -1
  25. package/dist/module/lib/locks.d.ts +42 -0
  26. package/dist/module/lib/locks.d.ts.map +1 -0
  27. package/dist/module/lib/locks.js +130 -0
  28. package/dist/module/lib/locks.js.map +1 -0
  29. package/dist/module/lib/types.d.ts +23 -1
  30. package/dist/module/lib/types.d.ts.map +1 -1
  31. package/dist/module/lib/version.d.ts +1 -1
  32. package/dist/module/lib/version.js +1 -1
  33. package/package.json +1 -1
  34. package/src/GoTrueClient.ts +108 -52
  35. package/src/index.ts +5 -0
  36. package/src/lib/locks.ts +161 -0
  37. package/src/lib/types.ts +24 -0
  38. package/src/lib/version.ts +1 -1
package/src/lib/types.ts CHANGED
@@ -8,6 +8,7 @@ export type Provider =
8
8
  | 'bitbucket'
9
9
  | 'discord'
10
10
  | 'facebook'
11
+ | 'figma'
11
12
  | 'github'
12
13
  | 'gitlab'
13
14
  | 'google'
@@ -33,6 +34,23 @@ export type AuthChangeEvent =
33
34
  | 'USER_UPDATED'
34
35
  | AuthChangeEventMFA
35
36
 
37
+ /**
38
+ * Provide your own global lock implementation instead of the default
39
+ * implementation. The function should acquire a lock for the duration of the
40
+ * `fn` async function, such that no other client instances will be able to
41
+ * hold it at the same time.
42
+ *
43
+ * @experimental
44
+ *
45
+ * @param name Name of the lock to be acquired.
46
+ * @param acquireTimeout If negative, no timeout should occur. If positive it
47
+ * should throw an Error with an `isAcquireTimeout`
48
+ * property set to true if the operation fails to be
49
+ * acquired after this much time (ms).
50
+ * @param fn The operation to execute when the lock is acquired.
51
+ */
52
+ export type LockFunc = <R>(name: string, acquireTimeout: number, fn: () => Promise<R>) => Promise<R>
53
+
36
54
  export type GoTrueClientOptions = {
37
55
  /* The URL of the GoTrue server. */
38
56
  url?: string
@@ -54,6 +72,12 @@ export type GoTrueClientOptions = {
54
72
  flowType?: AuthFlowType
55
73
  /* If debug messages are emitted. Can be used to inspect the behavior of the library. */
56
74
  debug?: boolean
75
+ /**
76
+ * Provide your own locking mechanism based on the environment. By default no locking is done at this time.
77
+ *
78
+ * @experimental
79
+ */
80
+ lock?: LockFunc
57
81
  }
58
82
 
59
83
  export type AuthResponse =
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '2.43.0'
2
+ export const version = '2.44.0'