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.
- package/dist/{cauthy-Bn3iv50y.d.ts → cauthy-DGAy45G2.d.ts} +1 -1
- package/dist/{cauthy-C29HCvag.d.mts → cauthy-XkIbG5gE.d.mts} +1 -1
- package/dist/client.d.mts +111 -2
- package/dist/client.d.ts +111 -2
- package/dist/client.js +25 -0
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +25 -0
- package/dist/client.mjs.map +1 -1
- package/dist/express.d.mts +2 -2
- package/dist/express.d.ts +2 -2
- package/dist/fastify.d.mts +2 -2
- package/dist/fastify.d.ts +2 -2
- package/dist/hono.d.mts +2 -2
- package/dist/hono.d.ts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +133 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +133 -4
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.mts +2 -2
- package/dist/next.d.ts +2 -2
- package/dist/react.d.mts +145 -1
- package/dist/react.d.ts +145 -1
- package/dist/react.js +200 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +199 -2
- package/dist/react.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +25 -0
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +25 -0
- package/dist/svelte.mjs.map +1 -1
- package/dist/{system-ZD_Wa8Bm.d.mts → system-BxMsSIu1.d.mts} +2 -0
- package/dist/{system-DhRr_WxR.d.ts → system-DTIeDXDP.d.ts} +2 -0
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +25 -0
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +25 -0
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -192,6 +192,8 @@ interface SessionUser {
|
|
|
192
192
|
emailVerifyBy?: string;
|
|
193
193
|
/** The language the person reads in ("es", "en-US"), when Cauthy knows it. */
|
|
194
194
|
locale?: string;
|
|
195
|
+
/** A guest: a visitor's session before they sign up. No email; `account.upgrade` makes it an account, keeping `id`. */
|
|
196
|
+
isAnonymous?: boolean;
|
|
195
197
|
}
|
|
196
198
|
/** A value JSON can carry. What crosses from server to browser is typed as this, never `unknown`. */
|
|
197
199
|
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
@@ -192,6 +192,8 @@ interface SessionUser {
|
|
|
192
192
|
emailVerifyBy?: string;
|
|
193
193
|
/** The language the person reads in ("es", "en-US"), when Cauthy knows it. */
|
|
194
194
|
locale?: string;
|
|
195
|
+
/** A guest: a visitor's session before they sign up. No email; `account.upgrade` makes it an account, keeping `id`. */
|
|
196
|
+
isAnonymous?: boolean;
|
|
195
197
|
}
|
|
196
198
|
/** A value JSON can carry. What crosses from server to browser is typed as this, never `unknown`. */
|
|
197
199
|
type JsonValue = string | number | boolean | null | JsonValue[] | {
|
package/dist/vue.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ShallowRef, Plugin } from 'vue';
|
|
2
2
|
import { SessionStore, SessionState, SessionStoreOptions, AuthClient } from './client.mjs';
|
|
3
3
|
export { Account, AccountSession, AuthError, AuthMethods, AuthResult, Passkey, PasskeyKind, SSOConnection } from './client.mjs';
|
|
4
|
-
import { i as PublicSession } from './system-
|
|
5
|
-
export { P as PermissionOf, f as Policy, R as RoleOf, k as SessionOrganization, m as SessionUser, p as can, r as definePolicy } from './system-
|
|
4
|
+
import { i as PublicSession } from './system-BxMsSIu1.mjs';
|
|
5
|
+
export { P as PermissionOf, f as Policy, R as RoleOf, k as SessionOrganization, m as SessionUser, p as can, r as definePolicy } from './system-BxMsSIu1.mjs';
|
|
6
6
|
import './theme.mjs';
|
|
7
7
|
import './validate-B_iC-4y8.mjs';
|
|
8
8
|
import 'jose';
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ShallowRef, Plugin } from 'vue';
|
|
2
2
|
import { SessionStore, SessionState, SessionStoreOptions, AuthClient } from './client.js';
|
|
3
3
|
export { Account, AccountSession, AuthError, AuthMethods, AuthResult, Passkey, PasskeyKind, SSOConnection } from './client.js';
|
|
4
|
-
import { i as PublicSession } from './system-
|
|
5
|
-
export { P as PermissionOf, f as Policy, R as RoleOf, k as SessionOrganization, m as SessionUser, p as can, r as definePolicy } from './system-
|
|
4
|
+
import { i as PublicSession } from './system-DTIeDXDP.js';
|
|
5
|
+
export { P as PermissionOf, f as Policy, R as RoleOf, k as SessionOrganization, m as SessionUser, p as can, r as definePolicy } from './system-DTIeDXDP.js';
|
|
6
6
|
import './theme.js';
|
|
7
7
|
import './validate-B_iC-4y8.js';
|
|
8
8
|
import 'jose';
|
package/dist/vue.js
CHANGED
|
@@ -231,6 +231,7 @@ function createAuthClient(options = {}) {
|
|
|
231
231
|
return null;
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
+
const upgradeUrl = (provider, o = {}) => `${base}/me/upgrade/social/${encodeURIComponent(provider)}${o.returnTo ? `?return_to=${encodeURIComponent(o.returnTo)}` : ""}`;
|
|
234
235
|
const linkUrl = (provider, o = {}) => `${base}/me/identities/link/${encodeURIComponent(provider)}${o.returnTo ? `?return_to=${encodeURIComponent(o.returnTo)}` : ""}`;
|
|
235
236
|
const socialUrl = (provider, o = {}) => `${base}/sign-in/social/${encodeURIComponent(provider)}${o.returnTo ? `?return_to=${encodeURIComponent(o.returnTo)}` : ""}`;
|
|
236
237
|
const ssoUrl = (target, o = {}) => {
|
|
@@ -268,6 +269,7 @@ function createAuthClient(options = {}) {
|
|
|
268
269
|
}
|
|
269
270
|
return {
|
|
270
271
|
signIn: {
|
|
272
|
+
anonymously: (f = {}) => post("/sign-in/anonymous", {}, null, f.captchaToken),
|
|
271
273
|
email: (f) => post("/sign-in/email", { email: f.email, password: f.password }, firstProblem(checkEmail(f.email), checkPassword(f.password)), f.captchaToken),
|
|
272
274
|
mfa: (f) => post("/sign-in/mfa", { code: f.code }, checkCode(f.code)),
|
|
273
275
|
mfaMethods: () => post("/sign-in/mfa/methods", {}, null),
|
|
@@ -365,6 +367,24 @@ function createAuthClient(options = {}) {
|
|
|
365
367
|
resetPassword: (f) => post("/reset-password", { token: f.token, password: f.password }, checkNewPassword(f.password)),
|
|
366
368
|
verifyEmail: (f) => post("/verify-email", { token: f.token }, null),
|
|
367
369
|
signOut: () => post("/sign-out", {}, null),
|
|
370
|
+
organizations: {
|
|
371
|
+
async list(system) {
|
|
372
|
+
const body = await read(`/me/organizations${system ? `?system=${encodeURIComponent(system)}` : ""}`);
|
|
373
|
+
return body && Array.isArray(body.organizations) ? body.organizations : [];
|
|
374
|
+
},
|
|
375
|
+
async members(id) {
|
|
376
|
+
const body = await read(`/me/organizations/members?id=${encodeURIComponent(id)}`);
|
|
377
|
+
return body && Array.isArray(body.members) ? body.members : null;
|
|
378
|
+
},
|
|
379
|
+
async roles(id) {
|
|
380
|
+
const body = await read(`/me/organizations/roles?id=${encodeURIComponent(id)}`);
|
|
381
|
+
return body && Array.isArray(body.roles) ? body.roles : null;
|
|
382
|
+
},
|
|
383
|
+
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)),
|
|
384
|
+
setRole: (id, userId, role) => post("/me/organizations/members/role", { organizationId: id, userId, role }, null),
|
|
385
|
+
remove: (id, userId) => post("/me/organizations/members/remove", { organizationId: id, userId }, null),
|
|
386
|
+
inviteAgain: (id, userId, f = {}) => post("/me/organizations/members/invite", { organizationId: id, userId, locale: f.locale ?? "" }, null)
|
|
387
|
+
},
|
|
368
388
|
account: {
|
|
369
389
|
async get() {
|
|
370
390
|
const body = await read("/me");
|
|
@@ -403,6 +423,11 @@ function createAuthClient(options = {}) {
|
|
|
403
423
|
return body && Array.isArray(body.sessions) ? body.sessions : [];
|
|
404
424
|
},
|
|
405
425
|
signOutEverywhere: () => post("/me/sessions/end", {}, null),
|
|
426
|
+
upgrade: (f) => post("/me/upgrade", { email: f.email, password: f.password, name: f.name ?? "" }, firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password))),
|
|
427
|
+
upgradeUrl,
|
|
428
|
+
upgradeWith(provider, o) {
|
|
429
|
+
window.location.assign(upgradeUrl(provider, o));
|
|
430
|
+
},
|
|
406
431
|
async agents() {
|
|
407
432
|
const body = await read("/me/agents");
|
|
408
433
|
return body && Array.isArray(body.agents) ? body.agents : [];
|