cauthy-auth 0.30.0 → 0.31.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 (46) hide show
  1. package/README.md +10 -3
  2. package/dist/{cauthy-BXgsZ-Um.d.mts → cauthy-2jtP2LVQ.d.mts} +1 -1
  3. package/dist/{cauthy-CHENs452.d.ts → cauthy-CKfvvv_i.d.ts} +1 -1
  4. package/dist/cli.js +8 -5
  5. package/dist/client.d.mts +47 -6
  6. package/dist/client.d.ts +47 -6
  7. package/dist/client.js +16 -2
  8. package/dist/client.js.map +1 -1
  9. package/dist/client.mjs +16 -2
  10. package/dist/client.mjs.map +1 -1
  11. package/dist/express.d.mts +2 -2
  12. package/dist/express.d.ts +2 -2
  13. package/dist/fastify.d.mts +2 -2
  14. package/dist/fastify.d.ts +2 -2
  15. package/dist/hono.d.mts +2 -2
  16. package/dist/hono.d.ts +2 -2
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +64 -21
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +64 -21
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/next.d.mts +2 -2
  24. package/dist/next.d.ts +2 -2
  25. package/dist/react.d.mts +61 -5
  26. package/dist/react.d.ts +61 -5
  27. package/dist/react.js +183 -46
  28. package/dist/react.js.map +1 -1
  29. package/dist/react.mjs +182 -46
  30. package/dist/react.mjs.map +1 -1
  31. package/dist/styles.css +8 -0
  32. package/dist/svelte.d.mts +2 -2
  33. package/dist/svelte.d.ts +2 -2
  34. package/dist/svelte.js +16 -2
  35. package/dist/svelte.js.map +1 -1
  36. package/dist/svelte.mjs +16 -2
  37. package/dist/svelte.mjs.map +1 -1
  38. package/dist/{system-0mHrdAgO.d.mts → system-BrrJsrFW.d.mts} +14 -0
  39. package/dist/{system-BIYbS7h2.d.ts → system-BvvoNs2y.d.ts} +14 -0
  40. package/dist/vue.d.mts +2 -2
  41. package/dist/vue.d.ts +2 -2
  42. package/dist/vue.js +16 -2
  43. package/dist/vue.js.map +1 -1
  44. package/dist/vue.mjs +16 -2
  45. package/dist/vue.mjs.map +1 -1
  46. package/package.json +1 -1
package/dist/next.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Cauthy } from './cauthy-BXgsZ-Um.mjs';
2
- import { S as Session } from './system-0mHrdAgO.mjs';
1
+ import { C as Cauthy } from './cauthy-2jtP2LVQ.mjs';
2
+ import { S as Session } from './system-BrrJsrFW.mjs';
3
3
  import 'jose';
4
4
  import './theme.mjs';
5
5
 
package/dist/next.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Cauthy } from './cauthy-CHENs452.js';
2
- import { S as Session } from './system-BIYbS7h2.js';
1
+ import { C as Cauthy } from './cauthy-CKfvvv_i.js';
2
+ import { S as Session } from './system-BvvoNs2y.js';
3
3
  import 'jose';
4
4
  import './theme.js';
5
5
 
package/dist/react.d.mts CHANGED
@@ -403,11 +403,25 @@ type AuthResult<S extends string, More = unknown> = ({
403
403
  };
404
404
  /** What the screen may offer. */
405
405
  interface AuthMethods {
406
- /** The providers the workspace signs people in with: `{ id: 'google', name: 'Google' }`. */
406
+ /**
407
+ * The providers the workspace signs people in with and has turned on:
408
+ * `{ id: 'google', name: 'Google', iconUrl: 'https://…/v1/social/icons/google.svg' }`.
409
+ * `iconUrl` is the provider's logo, served by Cauthy; absent from a Cauthy
410
+ * that does not serve logos.
411
+ */
407
412
  providers: {
408
413
  id: string;
409
414
  name: string;
415
+ iconUrl?: string;
410
416
  }[];
417
+ /**
418
+ * Whether the workspace signs people in with a password. False: the
419
+ * password field, "forgot your password" and a sign-up with a password are
420
+ * not offered, and Cauthy refuses them (`password_disabled`). True from a
421
+ * server that does not say. (`password` is something else: the policy a new
422
+ * password must meet.)
423
+ */
424
+ passwordSignIn: boolean;
411
425
  /** Whether people may create an account themselves. */
412
426
  signUp: boolean;
413
427
  /** Set when the application's system makes an organization per sign-up: the form asks the company's name. */
@@ -416,7 +430,7 @@ interface AuthMethods {
416
430
  required: boolean;
417
431
  };
418
432
  magicLink: boolean;
419
- /** Whether to offer a passkey. */
433
+ /** Whether to offer a passkey. False when the workspace turned passkeys off. */
420
434
  passkey: boolean;
421
435
  /**
422
436
  * Whether the passkey is used on this page itself. False: `signIn.passkey`
@@ -468,6 +482,15 @@ interface AuthMethods {
468
482
  */
469
483
  password?: PasswordPolicy;
470
484
  }
485
+ /** An invitation, as its page shows it before the person chooses a password. */
486
+ interface Invitation {
487
+ /** The address invited: the account the person signs in as. */
488
+ email: string;
489
+ /** The workspace's name. */
490
+ workspace: string;
491
+ /** The organization the person was invited to, when there is one. */
492
+ organization?: string;
493
+ }
471
494
  /** A legal document the person owes: not yet accepted in its current version. */
472
495
  interface PendingLegal {
473
496
  kind: string;
@@ -1059,7 +1082,25 @@ interface AuthClient {
1059
1082
  token: string;
1060
1083
  password: string;
1061
1084
  }): Promise<AuthResult<'changed'>>;
1062
- /** Confirms the address, with the token the mailed link opened the page with (`token`). */
1085
+ /**
1086
+ * Who an invitation is for and to what, with the token the mailed link
1087
+ * opened the page with (`token`). Reading it does not spend it.
1088
+ * `invalid_token`: unknown, spent or expired.
1089
+ */
1090
+ invitation(token: string): Promise<AuthResult<'ok', {
1091
+ invitation: Invitation;
1092
+ }>>;
1093
+ /**
1094
+ * Accepts an invitation with the password the person chose (the workspace's
1095
+ * policy, as for a sign-up) and signs them in. `mfa_required`: the account
1096
+ * owes a second step; ask for the code and call `signIn.mfa`, as after
1097
+ * `signIn.email`. A password refused leaves the invitation good.
1098
+ */
1099
+ acceptInvitation(token: string, password: string): Promise<AuthResult<'signed_in', {
1100
+ session: PublicSession;
1101
+ }> | AuthResult<'mfa_required', {
1102
+ method?: 'email';
1103
+ }>>;
1063
1104
  /** Confirms the address a mailed link is for. The person is signed in from the link when their account asks no second step. */
1064
1105
  verifyEmail(form: {
1065
1106
  token: string;
@@ -1151,6 +1192,13 @@ interface AuthTexts {
1151
1192
  passwordChanged: string;
1152
1193
  confirming: string;
1153
1194
  emailConfirmed: string;
1195
+ invitedTo: string;
1196
+ invitedToOrganization: string;
1197
+ invitedAs: string;
1198
+ choosePassword: string;
1199
+ acceptInvite: string;
1200
+ openingInvitation: string;
1201
+ invitationInvalid: string;
1154
1202
  profile: string;
1155
1203
  save: string;
1156
1204
  saved: string;
@@ -1226,7 +1274,7 @@ interface AuthTexts {
1226
1274
  /** By error code; one missing shows what the server said. */
1227
1275
  errors: Record<string, string>;
1228
1276
  }
1229
- type Slot = 'form' | 'field' | 'label' | 'input' | 'button' | 'providerButton' | 'link' | 'error' | 'fieldError' | 'hint' | 'notice' | 'separator' | 'footer' | 'check' | 'account' | 'section' | 'heading' | 'secret' | 'codes' | 'sessions' | 'session';
1277
+ type Slot = 'form' | 'field' | 'label' | 'input' | 'button' | 'providerButton' | 'providerIcon' | 'link' | 'error' | 'fieldError' | 'hint' | 'notice' | 'separator' | 'footer' | 'check' | 'account' | 'section' | 'heading' | 'secret' | 'codes' | 'sessions' | 'session';
1230
1278
  interface AuthFormProps {
1231
1279
  /** The language of the built-in sentences. Default: `en`. */
1232
1280
  locale?: 'en' | 'es';
@@ -1316,6 +1364,14 @@ declare function ForgotPassword(props: AuthFormProps): react.JSX.Element;
1316
1364
  declare function ResetPassword(props: AuthFormProps): react.JSX.Element;
1317
1365
  /** The page a "confirm your address" link opens: `pages.verifyEmail`. It confirms as it opens. */
1318
1366
  declare function VerifyEmail(props: AuthFormProps): react.JSX.Element;
1367
+ /**
1368
+ * The page an invitation opens: `pages.acceptInvite`. It says who is invited
1369
+ * to what, asks for a password under the workspace's policy, signs the person
1370
+ * in (with the second step, when their account owes one) and goes on to
1371
+ * `returnTo`. The invitation is good until it is accepted: reading it, or a
1372
+ * password refused, does not spend it.
1373
+ */
1374
+ declare function AcceptInvite(props: AuthFormProps): react.JSX.Element;
1319
1375
  interface AccountProps extends Omit<AuthFormProps, 'links' | 'returnTo' | 'onSuccess'> {
1320
1376
  /** Called after "sign out everywhere". Default: go to `/`. */
1321
1377
  onSignedOut?: () => void;
@@ -1390,4 +1446,4 @@ declare function useSession(): SessionContext;
1390
1446
  */
1391
1447
  declare function useAuth(): AuthClient & Pick<SessionContext, 'session' | 'status' | 'refresh'>;
1392
1448
 
1393
- export { Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, OrganizationMembers, type OrganizationMembersProps, type OrganizationPerson, type OrganizationRoleChoice, type OrganizationSeat, type OrganizationsClient, type Passkey, type PasskeyKind, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SSOConnection, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
1449
+ export { AcceptInvite, Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type Invitation, type JsonValue, type LinkedIdentity, OrganizationMembers, type OrganizationMembersProps, type OrganizationPerson, type OrganizationRoleChoice, type OrganizationSeat, type OrganizationsClient, type Passkey, type PasskeyKind, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SSOConnection, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
package/dist/react.d.ts CHANGED
@@ -403,11 +403,25 @@ type AuthResult<S extends string, More = unknown> = ({
403
403
  };
404
404
  /** What the screen may offer. */
405
405
  interface AuthMethods {
406
- /** The providers the workspace signs people in with: `{ id: 'google', name: 'Google' }`. */
406
+ /**
407
+ * The providers the workspace signs people in with and has turned on:
408
+ * `{ id: 'google', name: 'Google', iconUrl: 'https://…/v1/social/icons/google.svg' }`.
409
+ * `iconUrl` is the provider's logo, served by Cauthy; absent from a Cauthy
410
+ * that does not serve logos.
411
+ */
407
412
  providers: {
408
413
  id: string;
409
414
  name: string;
415
+ iconUrl?: string;
410
416
  }[];
417
+ /**
418
+ * Whether the workspace signs people in with a password. False: the
419
+ * password field, "forgot your password" and a sign-up with a password are
420
+ * not offered, and Cauthy refuses them (`password_disabled`). True from a
421
+ * server that does not say. (`password` is something else: the policy a new
422
+ * password must meet.)
423
+ */
424
+ passwordSignIn: boolean;
411
425
  /** Whether people may create an account themselves. */
412
426
  signUp: boolean;
413
427
  /** Set when the application's system makes an organization per sign-up: the form asks the company's name. */
@@ -416,7 +430,7 @@ interface AuthMethods {
416
430
  required: boolean;
417
431
  };
418
432
  magicLink: boolean;
419
- /** Whether to offer a passkey. */
433
+ /** Whether to offer a passkey. False when the workspace turned passkeys off. */
420
434
  passkey: boolean;
421
435
  /**
422
436
  * Whether the passkey is used on this page itself. False: `signIn.passkey`
@@ -468,6 +482,15 @@ interface AuthMethods {
468
482
  */
469
483
  password?: PasswordPolicy;
470
484
  }
485
+ /** An invitation, as its page shows it before the person chooses a password. */
486
+ interface Invitation {
487
+ /** The address invited: the account the person signs in as. */
488
+ email: string;
489
+ /** The workspace's name. */
490
+ workspace: string;
491
+ /** The organization the person was invited to, when there is one. */
492
+ organization?: string;
493
+ }
471
494
  /** A legal document the person owes: not yet accepted in its current version. */
472
495
  interface PendingLegal {
473
496
  kind: string;
@@ -1059,7 +1082,25 @@ interface AuthClient {
1059
1082
  token: string;
1060
1083
  password: string;
1061
1084
  }): Promise<AuthResult<'changed'>>;
1062
- /** Confirms the address, with the token the mailed link opened the page with (`token`). */
1085
+ /**
1086
+ * Who an invitation is for and to what, with the token the mailed link
1087
+ * opened the page with (`token`). Reading it does not spend it.
1088
+ * `invalid_token`: unknown, spent or expired.
1089
+ */
1090
+ invitation(token: string): Promise<AuthResult<'ok', {
1091
+ invitation: Invitation;
1092
+ }>>;
1093
+ /**
1094
+ * Accepts an invitation with the password the person chose (the workspace's
1095
+ * policy, as for a sign-up) and signs them in. `mfa_required`: the account
1096
+ * owes a second step; ask for the code and call `signIn.mfa`, as after
1097
+ * `signIn.email`. A password refused leaves the invitation good.
1098
+ */
1099
+ acceptInvitation(token: string, password: string): Promise<AuthResult<'signed_in', {
1100
+ session: PublicSession;
1101
+ }> | AuthResult<'mfa_required', {
1102
+ method?: 'email';
1103
+ }>>;
1063
1104
  /** Confirms the address a mailed link is for. The person is signed in from the link when their account asks no second step. */
1064
1105
  verifyEmail(form: {
1065
1106
  token: string;
@@ -1151,6 +1192,13 @@ interface AuthTexts {
1151
1192
  passwordChanged: string;
1152
1193
  confirming: string;
1153
1194
  emailConfirmed: string;
1195
+ invitedTo: string;
1196
+ invitedToOrganization: string;
1197
+ invitedAs: string;
1198
+ choosePassword: string;
1199
+ acceptInvite: string;
1200
+ openingInvitation: string;
1201
+ invitationInvalid: string;
1154
1202
  profile: string;
1155
1203
  save: string;
1156
1204
  saved: string;
@@ -1226,7 +1274,7 @@ interface AuthTexts {
1226
1274
  /** By error code; one missing shows what the server said. */
1227
1275
  errors: Record<string, string>;
1228
1276
  }
1229
- type Slot = 'form' | 'field' | 'label' | 'input' | 'button' | 'providerButton' | 'link' | 'error' | 'fieldError' | 'hint' | 'notice' | 'separator' | 'footer' | 'check' | 'account' | 'section' | 'heading' | 'secret' | 'codes' | 'sessions' | 'session';
1277
+ type Slot = 'form' | 'field' | 'label' | 'input' | 'button' | 'providerButton' | 'providerIcon' | 'link' | 'error' | 'fieldError' | 'hint' | 'notice' | 'separator' | 'footer' | 'check' | 'account' | 'section' | 'heading' | 'secret' | 'codes' | 'sessions' | 'session';
1230
1278
  interface AuthFormProps {
1231
1279
  /** The language of the built-in sentences. Default: `en`. */
1232
1280
  locale?: 'en' | 'es';
@@ -1316,6 +1364,14 @@ declare function ForgotPassword(props: AuthFormProps): react.JSX.Element;
1316
1364
  declare function ResetPassword(props: AuthFormProps): react.JSX.Element;
1317
1365
  /** The page a "confirm your address" link opens: `pages.verifyEmail`. It confirms as it opens. */
1318
1366
  declare function VerifyEmail(props: AuthFormProps): react.JSX.Element;
1367
+ /**
1368
+ * The page an invitation opens: `pages.acceptInvite`. It says who is invited
1369
+ * to what, asks for a password under the workspace's policy, signs the person
1370
+ * in (with the second step, when their account owes one) and goes on to
1371
+ * `returnTo`. The invitation is good until it is accepted: reading it, or a
1372
+ * password refused, does not spend it.
1373
+ */
1374
+ declare function AcceptInvite(props: AuthFormProps): react.JSX.Element;
1319
1375
  interface AccountProps extends Omit<AuthFormProps, 'links' | 'returnTo' | 'onSuccess'> {
1320
1376
  /** Called after "sign out everywhere". Default: go to `/`. */
1321
1377
  onSignedOut?: () => void;
@@ -1390,4 +1446,4 @@ declare function useSession(): SessionContext;
1390
1446
  */
1391
1447
  declare function useAuth(): AuthClient & Pick<SessionContext, 'session' | 'status' | 'refresh'>;
1392
1448
 
1393
- export { Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, OrganizationMembers, type OrganizationMembersProps, type OrganizationPerson, type OrganizationRoleChoice, type OrganizationSeat, type OrganizationsClient, type Passkey, type PasskeyKind, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SSOConnection, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
1449
+ export { AcceptInvite, Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type Invitation, type JsonValue, type LinkedIdentity, OrganizationMembers, type OrganizationMembersProps, type OrganizationPerson, type OrganizationRoleChoice, type OrganizationSeat, type OrganizationsClient, type Passkey, type PasskeyKind, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SSOConnection, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };