cauthy-auth 0.20.0 → 0.22.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 (43) hide show
  1. package/dist/{cauthy-Bn3iv50y.d.ts → cauthy-DGAy45G2.d.ts} +1 -1
  2. package/dist/{cauthy-C29HCvag.d.mts → cauthy-XkIbG5gE.d.mts} +1 -1
  3. package/dist/client.d.mts +111 -2
  4. package/dist/client.d.ts +111 -2
  5. package/dist/client.js +25 -0
  6. package/dist/client.js.map +1 -1
  7. package/dist/client.mjs +25 -0
  8. package/dist/client.mjs.map +1 -1
  9. package/dist/express.d.mts +2 -2
  10. package/dist/express.d.ts +2 -2
  11. package/dist/fastify.d.mts +2 -2
  12. package/dist/fastify.d.ts +2 -2
  13. package/dist/hono.d.mts +2 -2
  14. package/dist/hono.d.ts +2 -2
  15. package/dist/index.d.mts +2 -2
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.js +133 -4
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +133 -4
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/next.d.mts +2 -2
  22. package/dist/next.d.ts +2 -2
  23. package/dist/react.d.mts +145 -1
  24. package/dist/react.d.ts +145 -1
  25. package/dist/react.js +200 -2
  26. package/dist/react.js.map +1 -1
  27. package/dist/react.mjs +199 -2
  28. package/dist/react.mjs.map +1 -1
  29. package/dist/svelte.d.mts +2 -2
  30. package/dist/svelte.d.ts +2 -2
  31. package/dist/svelte.js +25 -0
  32. package/dist/svelte.js.map +1 -1
  33. package/dist/svelte.mjs +25 -0
  34. package/dist/svelte.mjs.map +1 -1
  35. package/dist/{system-ZD_Wa8Bm.d.mts → system-BxMsSIu1.d.mts} +2 -0
  36. package/dist/{system-DhRr_WxR.d.ts → system-DTIeDXDP.d.ts} +2 -0
  37. package/dist/vue.d.mts +2 -2
  38. package/dist/vue.d.ts +2 -2
  39. package/dist/vue.js +25 -0
  40. package/dist/vue.js.map +1 -1
  41. package/dist/vue.mjs +25 -0
  42. package/dist/vue.mjs.map +1 -1
  43. package/package.json +1 -1
package/dist/vue.mjs CHANGED
@@ -203,6 +203,7 @@ function createAuthClient(options = {}) {
203
203
  return null;
204
204
  }
205
205
  }
206
+ const upgradeUrl = (provider, o = {}) => `${base}/me/upgrade/social/${encodeURIComponent(provider)}${o.returnTo ? `?return_to=${encodeURIComponent(o.returnTo)}` : ""}`;
206
207
  const linkUrl = (provider, o = {}) => `${base}/me/identities/link/${encodeURIComponent(provider)}${o.returnTo ? `?return_to=${encodeURIComponent(o.returnTo)}` : ""}`;
207
208
  const socialUrl = (provider, o = {}) => `${base}/sign-in/social/${encodeURIComponent(provider)}${o.returnTo ? `?return_to=${encodeURIComponent(o.returnTo)}` : ""}`;
208
209
  const ssoUrl = (target, o = {}) => {
@@ -240,6 +241,7 @@ function createAuthClient(options = {}) {
240
241
  }
241
242
  return {
242
243
  signIn: {
244
+ anonymously: (f = {}) => post("/sign-in/anonymous", {}, null, f.captchaToken),
243
245
  email: (f) => post("/sign-in/email", { email: f.email, password: f.password }, firstProblem(checkEmail(f.email), checkPassword(f.password)), f.captchaToken),
244
246
  mfa: (f) => post("/sign-in/mfa", { code: f.code }, checkCode(f.code)),
245
247
  mfaMethods: () => post("/sign-in/mfa/methods", {}, null),
@@ -337,6 +339,24 @@ function createAuthClient(options = {}) {
337
339
  resetPassword: (f) => post("/reset-password", { token: f.token, password: f.password }, checkNewPassword(f.password)),
338
340
  verifyEmail: (f) => post("/verify-email", { token: f.token }, null),
339
341
  signOut: () => post("/sign-out", {}, null),
342
+ organizations: {
343
+ async list(system) {
344
+ const body = await read(`/me/organizations${system ? `?system=${encodeURIComponent(system)}` : ""}`);
345
+ return body && Array.isArray(body.organizations) ? body.organizations : [];
346
+ },
347
+ async members(id) {
348
+ const body = await read(`/me/organizations/members?id=${encodeURIComponent(id)}`);
349
+ return body && Array.isArray(body.members) ? body.members : null;
350
+ },
351
+ async roles(id) {
352
+ const body = await read(`/me/organizations/roles?id=${encodeURIComponent(id)}`);
353
+ return body && Array.isArray(body.roles) ? body.roles : null;
354
+ },
355
+ add: (id, f) => post("/me/organizations/members/add", { organizationId: id, email: f.email, role: f.role, name: f.name ?? "", locale: f.locale ?? "" }, checkEmail(f.email)),
356
+ setRole: (id, userId, role) => post("/me/organizations/members/role", { organizationId: id, userId, role }, null),
357
+ remove: (id, userId) => post("/me/organizations/members/remove", { organizationId: id, userId }, null),
358
+ inviteAgain: (id, userId, f = {}) => post("/me/organizations/members/invite", { organizationId: id, userId, locale: f.locale ?? "" }, null)
359
+ },
340
360
  account: {
341
361
  async get() {
342
362
  const body = await read("/me");
@@ -375,6 +395,11 @@ function createAuthClient(options = {}) {
375
395
  return body && Array.isArray(body.sessions) ? body.sessions : [];
376
396
  },
377
397
  signOutEverywhere: () => post("/me/sessions/end", {}, null),
398
+ upgrade: (f) => post("/me/upgrade", { email: f.email, password: f.password, name: f.name ?? "" }, firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password))),
399
+ upgradeUrl,
400
+ upgradeWith(provider, o) {
401
+ window.location.assign(upgradeUrl(provider, o));
402
+ },
378
403
  async agents() {
379
404
  const body = await read("/me/agents");
380
405
  return body && Array.isArray(body.agents) ? body.agents : [];