@nhost/nhost-js 3.2.8 → 5.0.0-beta.2

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 (120) hide show
  1. package/README.md +73 -37
  2. package/dist/nhost-js/auth.cjs.js +2 -0
  3. package/dist/nhost-js/auth.cjs.js.map +1 -0
  4. package/dist/nhost-js/auth.es.js +589 -0
  5. package/dist/nhost-js/auth.es.js.map +1 -0
  6. package/dist/nhost-js/fetch.cjs.js +2 -0
  7. package/dist/nhost-js/fetch.cjs.js.map +1 -0
  8. package/dist/nhost-js/fetch.es.js +10 -0
  9. package/dist/nhost-js/fetch.es.js.map +1 -0
  10. package/dist/nhost-js/functions.cjs.js +2 -0
  11. package/dist/nhost-js/functions.cjs.js.map +1 -0
  12. package/dist/nhost-js/functions.es.js +31 -0
  13. package/dist/nhost-js/functions.es.js.map +1 -0
  14. package/dist/nhost-js/graphql.cjs.js +2 -0
  15. package/dist/nhost-js/graphql.cjs.js.map +1 -0
  16. package/dist/nhost-js/graphql.es.js +35 -0
  17. package/dist/nhost-js/graphql.es.js.map +1 -0
  18. package/dist/nhost-js/storage.cjs.js +2 -0
  19. package/dist/nhost-js/storage.cjs.js.map +1 -0
  20. package/dist/nhost-js/storage.es.js +205 -0
  21. package/dist/nhost-js/storage.es.js.map +1 -0
  22. package/dist/nhost-js.cjs.js +2 -0
  23. package/dist/nhost-js.cjs.js.map +1 -0
  24. package/dist/nhost-js.es.js +497 -0
  25. package/dist/nhost-js.es.js.map +1 -0
  26. package/dist/nhost-js.umd.js +2 -0
  27. package/dist/nhost-js.umd.js.map +1 -0
  28. package/dist/src/auth/client.d.ts +430 -0
  29. package/dist/src/auth/client.d.ts.map +1 -0
  30. package/dist/src/auth/client.js +727 -0
  31. package/dist/src/auth/client.js.map +1 -0
  32. package/dist/src/auth/index.d.ts +11 -0
  33. package/dist/src/auth/index.d.ts.map +1 -0
  34. package/dist/src/auth/index.js +11 -0
  35. package/dist/src/auth/index.js.map +1 -0
  36. package/dist/src/auth/interface.d.ts +142 -0
  37. package/dist/src/auth/interface.d.ts.map +1 -0
  38. package/dist/src/auth/interface.js +2 -0
  39. package/dist/src/auth/interface.js.map +1 -0
  40. package/dist/src/fetch/index.d.ts +53 -0
  41. package/dist/src/fetch/index.d.ts.map +1 -0
  42. package/dist/src/fetch/index.js +40 -0
  43. package/dist/src/fetch/index.js.map +1 -0
  44. package/dist/src/functions/client.d.ts +47 -0
  45. package/dist/src/functions/client.d.ts.map +1 -0
  46. package/dist/src/functions/client.js +62 -0
  47. package/dist/src/functions/client.js.map +1 -0
  48. package/dist/src/functions/index.d.ts +10 -0
  49. package/dist/src/functions/index.d.ts.map +1 -0
  50. package/dist/src/functions/index.js +10 -0
  51. package/dist/src/functions/index.js.map +1 -0
  52. package/dist/src/graphql/client.d.ts +89 -0
  53. package/dist/src/graphql/client.d.ts.map +1 -0
  54. package/dist/src/graphql/client.js +49 -0
  55. package/dist/src/graphql/client.js.map +1 -0
  56. package/dist/src/graphql/index.d.ts +10 -0
  57. package/dist/src/graphql/index.d.ts.map +1 -0
  58. package/dist/src/graphql/index.js +10 -0
  59. package/dist/src/graphql/index.js.map +1 -0
  60. package/dist/src/index.d.ts +184 -0
  61. package/dist/src/index.d.ts.map +1 -0
  62. package/dist/src/index.js +251 -0
  63. package/dist/src/index.js.map +1 -0
  64. package/dist/src/middlewareAttachToken.d.ts +24 -0
  65. package/dist/src/middlewareAttachToken.d.ts.map +1 -0
  66. package/dist/src/middlewareAttachToken.js +60 -0
  67. package/dist/src/middlewareAttachToken.js.map +1 -0
  68. package/dist/src/middlewareRefreshSession.d.ts +43 -0
  69. package/dist/src/middlewareRefreshSession.d.ts.map +1 -0
  70. package/dist/src/middlewareRefreshSession.js +190 -0
  71. package/dist/src/middlewareRefreshSession.js.map +1 -0
  72. package/dist/src/middlewareResponseSession.d.ts +26 -0
  73. package/dist/src/middlewareResponseSession.d.ts.map +1 -0
  74. package/dist/src/middlewareResponseSession.js +83 -0
  75. package/dist/src/middlewareResponseSession.js.map +1 -0
  76. package/dist/src/sessionStorage.d.ts +123 -0
  77. package/dist/src/sessionStorage.d.ts.map +1 -0
  78. package/dist/src/sessionStorage.js +165 -0
  79. package/dist/src/sessionStorage.js.map +1 -0
  80. package/dist/src/storage/client.d.ts +184 -0
  81. package/dist/src/storage/client.d.ts.map +1 -0
  82. package/dist/src/storage/client.js +249 -0
  83. package/dist/src/storage/client.js.map +1 -0
  84. package/dist/src/storage/index.d.ts +11 -0
  85. package/dist/src/storage/index.d.ts.map +1 -0
  86. package/dist/src/storage/index.js +11 -0
  87. package/dist/src/storage/index.js.map +1 -0
  88. package/dist/src/storage/interface.d.ts +52 -0
  89. package/dist/src/storage/interface.d.ts.map +1 -0
  90. package/dist/src/storage/interface.js +2 -0
  91. package/dist/src/storage/interface.js.map +1 -0
  92. package/dist/tsconfig.tsbuildinfo +1 -0
  93. package/package.json +109 -63
  94. package/LICENSE +0 -21
  95. package/dist/clients/auth.d.ts +0 -8
  96. package/dist/clients/auth.d.ts.map +0 -1
  97. package/dist/clients/functions/index.d.ts +0 -107
  98. package/dist/clients/functions/index.d.ts.map +0 -1
  99. package/dist/clients/functions/types.d.ts +0 -28
  100. package/dist/clients/functions/types.d.ts.map +0 -1
  101. package/dist/clients/graphql.d.ts +0 -8
  102. package/dist/clients/graphql.d.ts.map +0 -1
  103. package/dist/clients/index.d.ts +0 -6
  104. package/dist/clients/index.d.ts.map +0 -1
  105. package/dist/clients/nhost.d.ts +0 -83
  106. package/dist/clients/nhost.d.ts.map +0 -1
  107. package/dist/clients/storage.d.ts +0 -8
  108. package/dist/clients/storage.d.ts.map +0 -1
  109. package/dist/index.cjs.js +0 -2
  110. package/dist/index.cjs.js.map +0 -1
  111. package/dist/index.d.ts +0 -6
  112. package/dist/index.d.ts.map +0 -1
  113. package/dist/index.esm.js +0 -344
  114. package/dist/index.esm.js.map +0 -1
  115. package/dist/utils/helpers.d.ts +0 -20
  116. package/dist/utils/helpers.d.ts.map +0 -1
  117. package/dist/utils/types.d.ts +0 -57
  118. package/dist/utils/types.d.ts.map +0 -1
  119. package/umd/nhost-js.umd.js +0 -22
  120. package/umd/nhost-js.umd.js.map +0 -1
@@ -0,0 +1,589 @@
1
+ import { createEnhancedFetch } from "./fetch.es.js";
2
+ const createAPIClient = (baseURL, chainFunctions = []) => {
3
+ let fetch = createEnhancedFetch(chainFunctions);
4
+ const pushChainFunction = (chainFunction) => {
5
+ chainFunctions.push(chainFunction);
6
+ fetch = createEnhancedFetch(chainFunctions);
7
+ };
8
+ const healthCheckHead = async (options) => {
9
+ const res = await fetch(getHealthCheckHeadUrl(), {
10
+ ...options,
11
+ method: "HEAD"
12
+ });
13
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
14
+ const payload = body ? JSON.parse(body) : {};
15
+ const response = {
16
+ body: payload,
17
+ status: res.status,
18
+ headers: res.headers
19
+ };
20
+ if (!res.ok) {
21
+ throw response;
22
+ }
23
+ return response;
24
+ };
25
+ const getHealthCheckHeadUrl = () => {
26
+ return baseURL + `/healthz`;
27
+ };
28
+ const healthCheckGet = async (options) => {
29
+ const res = await fetch(getHealthCheckGetUrl(), {
30
+ ...options,
31
+ method: "GET"
32
+ });
33
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
34
+ const payload = body ? JSON.parse(body) : {};
35
+ const response = {
36
+ body: payload,
37
+ status: res.status,
38
+ headers: res.headers
39
+ };
40
+ if (!res.ok) {
41
+ throw response;
42
+ }
43
+ return response;
44
+ };
45
+ const getHealthCheckGetUrl = () => {
46
+ return baseURL + `/healthz`;
47
+ };
48
+ const getVersion = async (options) => {
49
+ const res = await fetch(getGetVersionUrl(), {
50
+ ...options,
51
+ method: "GET"
52
+ });
53
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
54
+ const payload = body ? JSON.parse(body) : {};
55
+ const response = {
56
+ body: payload,
57
+ status: res.status,
58
+ headers: res.headers
59
+ };
60
+ if (!res.ok) {
61
+ throw response;
62
+ }
63
+ return response;
64
+ };
65
+ const getGetVersionUrl = () => {
66
+ return baseURL + `/version`;
67
+ };
68
+ const refreshToken = async (refreshTokenRequest, options) => {
69
+ const res = await fetch(getRefreshTokenUrl(), {
70
+ ...options,
71
+ method: "POST",
72
+ headers: { "Content-Type": "application/json", ...options?.headers },
73
+ body: JSON.stringify(refreshTokenRequest)
74
+ });
75
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
76
+ const payload = body ? JSON.parse(body) : {};
77
+ const response = {
78
+ body: payload,
79
+ status: res.status,
80
+ headers: res.headers
81
+ };
82
+ if (!res.ok) {
83
+ throw response;
84
+ }
85
+ return response;
86
+ };
87
+ const getRefreshTokenUrl = () => {
88
+ return baseURL + `/token`;
89
+ };
90
+ const signOut = async (signOutSchema, options) => {
91
+ const res = await fetch(getSignOutUrl(), {
92
+ ...options,
93
+ method: "POST",
94
+ headers: { "Content-Type": "application/json", ...options?.headers },
95
+ body: JSON.stringify(signOutSchema)
96
+ });
97
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
98
+ const payload = body ? JSON.parse(body) : {};
99
+ const response = {
100
+ body: payload,
101
+ status: res.status,
102
+ headers: res.headers
103
+ };
104
+ if (!res.ok) {
105
+ throw response;
106
+ }
107
+ return response;
108
+ };
109
+ const getSignOutUrl = () => {
110
+ return baseURL + `/signout`;
111
+ };
112
+ const signInEmailPassword = async (signInEmailPasswordRequest, options) => {
113
+ const res = await fetch(getSignInEmailPasswordUrl(), {
114
+ ...options,
115
+ method: "POST",
116
+ headers: { "Content-Type": "application/json", ...options?.headers },
117
+ body: JSON.stringify(signInEmailPasswordRequest)
118
+ });
119
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
120
+ const payload = body ? JSON.parse(body) : {};
121
+ const response = {
122
+ body: payload,
123
+ status: res.status,
124
+ headers: res.headers
125
+ };
126
+ if (!res.ok) {
127
+ throw response;
128
+ }
129
+ return response;
130
+ };
131
+ const getSignInEmailPasswordUrl = () => {
132
+ return baseURL + `/signin/email-password`;
133
+ };
134
+ const signInVerifyMfaTotp = async (signInMfaTotpRequest, options) => {
135
+ const res = await fetch(getSignInVerifyMfaTotpUrl(), {
136
+ ...options,
137
+ method: "POST",
138
+ headers: { "Content-Type": "application/json", ...options?.headers },
139
+ body: JSON.stringify(signInMfaTotpRequest)
140
+ });
141
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
142
+ const payload = body ? JSON.parse(body) : {};
143
+ const response = {
144
+ body: payload,
145
+ status: res.status,
146
+ headers: res.headers
147
+ };
148
+ if (!res.ok) {
149
+ throw response;
150
+ }
151
+ return response;
152
+ };
153
+ const getSignInVerifyMfaTotpUrl = () => {
154
+ return baseURL + `/signin/mfa/totp`;
155
+ };
156
+ const signInPasswordlessEmail = async (signInPasswordlessEmailRequest, options) => {
157
+ const res = await fetch(getSignInPasswordlessEmailUrl(), {
158
+ ...options,
159
+ method: "POST",
160
+ headers: { "Content-Type": "application/json", ...options?.headers },
161
+ body: JSON.stringify(signInPasswordlessEmailRequest)
162
+ });
163
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
164
+ const payload = body ? JSON.parse(body) : {};
165
+ const response = {
166
+ body: payload,
167
+ status: res.status,
168
+ headers: res.headers
169
+ };
170
+ if (!res.ok) {
171
+ throw response;
172
+ }
173
+ return response;
174
+ };
175
+ const getSignInPasswordlessEmailUrl = () => {
176
+ return baseURL + `/signin/passwordless/email`;
177
+ };
178
+ const signUpEmailPassword = async (signUpEmailPasswordRequest, options) => {
179
+ const res = await fetch(getSignUpEmailPasswordUrl(), {
180
+ ...options,
181
+ method: "POST",
182
+ headers: { "Content-Type": "application/json", ...options?.headers },
183
+ body: JSON.stringify(signUpEmailPasswordRequest)
184
+ });
185
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
186
+ const payload = body ? JSON.parse(body) : {};
187
+ const response = {
188
+ body: payload,
189
+ status: res.status,
190
+ headers: res.headers
191
+ };
192
+ if (!res.ok) {
193
+ throw response;
194
+ }
195
+ return response;
196
+ };
197
+ const getSignUpEmailPasswordUrl = () => {
198
+ return baseURL + `/signup/email-password`;
199
+ };
200
+ const changeUserMfaVerify = async (userMfaRequest, options) => {
201
+ const res = await fetch(getChangeUserMfaVerifyUrl(), {
202
+ ...options,
203
+ method: "POST",
204
+ headers: { "Content-Type": "application/json", ...options?.headers },
205
+ body: JSON.stringify(userMfaRequest)
206
+ });
207
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
208
+ const payload = body ? JSON.parse(body) : {};
209
+ const response = {
210
+ body: payload,
211
+ status: res.status,
212
+ headers: res.headers
213
+ };
214
+ if (!res.ok) {
215
+ throw response;
216
+ }
217
+ return response;
218
+ };
219
+ const getChangeUserMfaVerifyUrl = () => {
220
+ return baseURL + `/user/mfa`;
221
+ };
222
+ const changeUserMfa = async (options) => {
223
+ const res = await fetch(getChangeUserMfaUrl(), {
224
+ ...options,
225
+ method: "GET"
226
+ });
227
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
228
+ const payload = body ? JSON.parse(body) : {};
229
+ const response = {
230
+ body: payload,
231
+ status: res.status,
232
+ headers: res.headers
233
+ };
234
+ if (!res.ok) {
235
+ throw response;
236
+ }
237
+ return response;
238
+ };
239
+ const getChangeUserMfaUrl = () => {
240
+ return baseURL + `/mfa/totp/generate`;
241
+ };
242
+ const getJWKs = async (options) => {
243
+ const res = await fetch(getGetJWKsUrl(), {
244
+ ...options,
245
+ method: "GET"
246
+ });
247
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
248
+ const payload = body ? JSON.parse(body) : {};
249
+ const response = {
250
+ body: payload,
251
+ status: res.status,
252
+ headers: res.headers
253
+ };
254
+ if (!res.ok) {
255
+ throw response;
256
+ }
257
+ return response;
258
+ };
259
+ const getGetJWKsUrl = () => {
260
+ return baseURL + `/.well-known/jwks.json`;
261
+ };
262
+ const createPAT = async (createPATRequest, options) => {
263
+ const res = await fetch(getCreatePATUrl(), {
264
+ ...options,
265
+ method: "POST",
266
+ headers: { "Content-Type": "application/json", ...options?.headers },
267
+ body: JSON.stringify(createPATRequest)
268
+ });
269
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
270
+ const payload = body ? JSON.parse(body) : {};
271
+ const response = {
272
+ body: payload,
273
+ status: res.status,
274
+ headers: res.headers
275
+ };
276
+ if (!res.ok) {
277
+ throw response;
278
+ }
279
+ return response;
280
+ };
281
+ const getCreatePATUrl = () => {
282
+ return baseURL + `/pat`;
283
+ };
284
+ const signInAnonymous = async (signinAnonymousRequest, options) => {
285
+ const res = await fetch(getSignInAnonymousUrl(), {
286
+ ...options,
287
+ method: "POST",
288
+ headers: { "Content-Type": "application/json", ...options?.headers },
289
+ body: JSON.stringify(signinAnonymousRequest)
290
+ });
291
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
292
+ const payload = body ? JSON.parse(body) : {};
293
+ const response = {
294
+ body: payload,
295
+ status: res.status,
296
+ headers: res.headers
297
+ };
298
+ if (!res.ok) {
299
+ throw response;
300
+ }
301
+ return response;
302
+ };
303
+ const getSignInAnonymousUrl = () => {
304
+ return baseURL + `/signin/anonymous`;
305
+ };
306
+ const signInOTPEmail = async (signInOTPEmailRequest, options) => {
307
+ const res = await fetch(getSignInOTPEmailUrl(), {
308
+ ...options,
309
+ method: "POST",
310
+ headers: { "Content-Type": "application/json", ...options?.headers },
311
+ body: JSON.stringify(signInOTPEmailRequest)
312
+ });
313
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
314
+ const payload = body ? JSON.parse(body) : {};
315
+ const response = {
316
+ body: payload,
317
+ status: res.status,
318
+ headers: res.headers
319
+ };
320
+ if (!res.ok) {
321
+ throw response;
322
+ }
323
+ return response;
324
+ };
325
+ const getSignInOTPEmailUrl = () => {
326
+ return baseURL + `/signin/otp/email`;
327
+ };
328
+ const verifySignInOTPEmail = async (signInOTPEmailVerifyRequest, options) => {
329
+ const res = await fetch(getVerifySignInOTPEmailUrl(), {
330
+ ...options,
331
+ method: "POST",
332
+ headers: { "Content-Type": "application/json", ...options?.headers },
333
+ body: JSON.stringify(signInOTPEmailVerifyRequest)
334
+ });
335
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
336
+ const payload = body ? JSON.parse(body) : {};
337
+ const response = {
338
+ body: payload,
339
+ status: res.status,
340
+ headers: res.headers
341
+ };
342
+ if (!res.ok) {
343
+ throw response;
344
+ }
345
+ return response;
346
+ };
347
+ const getVerifySignInOTPEmailUrl = () => {
348
+ return baseURL + `/signin/otp/email/verify`;
349
+ };
350
+ const signInPAT = async (signInPATRequest, options) => {
351
+ const res = await fetch(getSignInPATUrl(), {
352
+ ...options,
353
+ method: "POST",
354
+ headers: { "Content-Type": "application/json", ...options?.headers },
355
+ body: JSON.stringify(signInPATRequest)
356
+ });
357
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
358
+ const payload = body ? JSON.parse(body) : {};
359
+ const response = {
360
+ body: payload,
361
+ status: res.status,
362
+ headers: res.headers
363
+ };
364
+ if (!res.ok) {
365
+ throw response;
366
+ }
367
+ return response;
368
+ };
369
+ const getSignInPATUrl = () => {
370
+ return baseURL + `/signin/pat`;
371
+ };
372
+ const signInIdToken = async (signInIdTokenRequest, options) => {
373
+ const res = await fetch(getSignInIdTokenUrl(), {
374
+ ...options,
375
+ method: "POST",
376
+ headers: { "Content-Type": "application/json", ...options?.headers },
377
+ body: JSON.stringify(signInIdTokenRequest)
378
+ });
379
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
380
+ const payload = body ? JSON.parse(body) : {};
381
+ const response = {
382
+ body: payload,
383
+ status: res.status,
384
+ headers: res.headers
385
+ };
386
+ if (!res.ok) {
387
+ throw response;
388
+ }
389
+ return response;
390
+ };
391
+ const getSignInIdTokenUrl = () => {
392
+ return baseURL + `/signin/idtoken`;
393
+ };
394
+ const linkIdToken = async (linkIdTokenRequest, options) => {
395
+ const res = await fetch(getLinkIdTokenUrl(), {
396
+ ...options,
397
+ method: "POST",
398
+ headers: { "Content-Type": "application/json", ...options?.headers },
399
+ body: JSON.stringify(linkIdTokenRequest)
400
+ });
401
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
402
+ const payload = body ? JSON.parse(body) : {};
403
+ const response = {
404
+ body: payload,
405
+ status: res.status,
406
+ headers: res.headers
407
+ };
408
+ if (!res.ok) {
409
+ throw response;
410
+ }
411
+ return response;
412
+ };
413
+ const getLinkIdTokenUrl = () => {
414
+ return baseURL + `/link/idtoken`;
415
+ };
416
+ const deanonymizeUser = async (userDeanonymizeRequest, options) => {
417
+ const res = await fetch(getDeanonymizeUserUrl(), {
418
+ ...options,
419
+ method: "POST",
420
+ headers: { "Content-Type": "application/json", ...options?.headers },
421
+ body: JSON.stringify(userDeanonymizeRequest)
422
+ });
423
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
424
+ const payload = body ? JSON.parse(body) : {};
425
+ const response = {
426
+ body: payload,
427
+ status: res.status,
428
+ headers: res.headers
429
+ };
430
+ if (!res.ok) {
431
+ throw response;
432
+ }
433
+ return response;
434
+ };
435
+ const getDeanonymizeUserUrl = () => {
436
+ return baseURL + `/user/deanonymize`;
437
+ };
438
+ const changeUserEmail = async (userEmailChangeRequest, options) => {
439
+ const res = await fetch(getChangeUserEmailUrl(), {
440
+ ...options,
441
+ method: "POST",
442
+ headers: { "Content-Type": "application/json", ...options?.headers },
443
+ body: JSON.stringify(userEmailChangeRequest)
444
+ });
445
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
446
+ const payload = body ? JSON.parse(body) : {};
447
+ const response = {
448
+ body: payload,
449
+ status: res.status,
450
+ headers: res.headers
451
+ };
452
+ if (!res.ok) {
453
+ throw response;
454
+ }
455
+ return response;
456
+ };
457
+ const getChangeUserEmailUrl = () => {
458
+ return baseURL + `/user/email/change`;
459
+ };
460
+ const sendVerificationEmail = async (userEmailSendVerificationEmailRequest, options) => {
461
+ const res = await fetch(getSendVerificationEmailUrl(), {
462
+ ...options,
463
+ method: "POST",
464
+ headers: { "Content-Type": "application/json", ...options?.headers },
465
+ body: JSON.stringify(userEmailSendVerificationEmailRequest)
466
+ });
467
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
468
+ const payload = body ? JSON.parse(body) : {};
469
+ const response = {
470
+ body: payload,
471
+ status: res.status,
472
+ headers: res.headers
473
+ };
474
+ if (!res.ok) {
475
+ throw response;
476
+ }
477
+ return response;
478
+ };
479
+ const getSendVerificationEmailUrl = () => {
480
+ return baseURL + `/user/email/send-verification-email`;
481
+ };
482
+ const changeUserPassword = async (userPasswordRequest, options) => {
483
+ const res = await fetch(getChangeUserPasswordUrl(), {
484
+ ...options,
485
+ method: "POST",
486
+ headers: { "Content-Type": "application/json", ...options?.headers },
487
+ body: JSON.stringify(userPasswordRequest)
488
+ });
489
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
490
+ const payload = body ? JSON.parse(body) : {};
491
+ const response = {
492
+ body: payload,
493
+ status: res.status,
494
+ headers: res.headers
495
+ };
496
+ if (!res.ok) {
497
+ throw response;
498
+ }
499
+ return response;
500
+ };
501
+ const getChangeUserPasswordUrl = () => {
502
+ return baseURL + `/user/password`;
503
+ };
504
+ const sendPasswordResetEmail = async (userPasswordResetRequest, options) => {
505
+ const res = await fetch(getSendPasswordResetEmailUrl(), {
506
+ ...options,
507
+ method: "POST",
508
+ headers: { "Content-Type": "application/json", ...options?.headers },
509
+ body: JSON.stringify(userPasswordResetRequest)
510
+ });
511
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
512
+ const payload = body ? JSON.parse(body) : {};
513
+ const response = {
514
+ body: payload,
515
+ status: res.status,
516
+ headers: res.headers
517
+ };
518
+ if (!res.ok) {
519
+ throw response;
520
+ }
521
+ return response;
522
+ };
523
+ const getSendPasswordResetEmailUrl = () => {
524
+ return baseURL + `/user/password/reset`;
525
+ };
526
+ const verifyTicket = async (params, options) => {
527
+ const res = await fetch(getVerifyTicketUrl(params), {
528
+ ...options,
529
+ method: "GET"
530
+ });
531
+ const body = [204, 205, 304, 412].includes(res.status) ? null : await res.text();
532
+ const payload = body ? JSON.parse(body) : {};
533
+ const response = {
534
+ body: payload,
535
+ status: res.status,
536
+ headers: res.headers
537
+ };
538
+ if (!res.ok) {
539
+ throw response;
540
+ }
541
+ return response;
542
+ };
543
+ const getVerifyTicketUrl = (params) => {
544
+ const normalizedParams = new URLSearchParams();
545
+ Object.entries(params || {}).forEach(([key, value]) => {
546
+ if (value !== void 0) {
547
+ normalizedParams.append(
548
+ key,
549
+ value === null ? "null" : value.toString()
550
+ );
551
+ }
552
+ });
553
+ const stringifiedParams = normalizedParams.toString();
554
+ return stringifiedParams.length > 0 ? baseURL + `/verify?${stringifiedParams}` : baseURL + `/verify`;
555
+ };
556
+ return {
557
+ healthCheckHead,
558
+ healthCheckGet,
559
+ getVersion,
560
+ refreshToken,
561
+ signOut,
562
+ signInEmailPassword,
563
+ signInVerifyMfaTotp,
564
+ signInPasswordlessEmail,
565
+ signUpEmailPassword,
566
+ changeUserMfaVerify,
567
+ changeUserMfa,
568
+ getJWKs,
569
+ createPAT,
570
+ signInAnonymous,
571
+ signInOTPEmail,
572
+ verifySignInOTPEmail,
573
+ signInPAT,
574
+ signInIdToken,
575
+ linkIdToken,
576
+ deanonymizeUser,
577
+ changeUserEmail,
578
+ sendVerificationEmail,
579
+ changeUserPassword,
580
+ sendPasswordResetEmail,
581
+ verifyTicket,
582
+ pushChainFunction,
583
+ baseURL
584
+ };
585
+ };
586
+ export {
587
+ createAPIClient
588
+ };
589
+ //# sourceMappingURL=auth.es.js.map