cauthy-auth 0.33.0 → 0.34.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/README.md +3 -1
- package/dist/{cauthy-CKfvvv_i.d.ts → cauthy-BUozWD72.d.ts} +1 -1
- package/dist/{cauthy-2jtP2LVQ.d.mts → cauthy-C-GoRXy9.d.mts} +1 -1
- package/dist/cli.js +1 -1
- package/dist/client.d.mts +7 -3
- package/dist/client.d.ts +7 -3
- package/dist/client.js.map +1 -1
- 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 +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- 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 +5 -1
- package/dist/react.d.ts +5 -1
- package/dist/react.js +2 -0
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +2 -0
- 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.map +1 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/{system-BvvoNs2y.d.ts → system-Bz4haPrI.d.ts} +10 -2
- package/dist/{system-BrrJsrFW.d.mts → system-DUGV040y.d.mts} +10 -2
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ import { OrganizationMembers } from 'cauthy-auth/react'
|
|
|
96
96
|
|
|
97
97
|
const { organizations } = useAuth()
|
|
98
98
|
const [org] = await organizations.list() // org.can: { readMembers, manageMembers, removeMembers, update, archive, delete }
|
|
99
|
-
await organizations.add(org.id, { email: 'ana@example.com', role: 'reader' })
|
|
99
|
+
await organizations.add(org.id, { email: 'ana@example.com', role: 'reader' }) // already a member: error member_exists, role unchanged
|
|
100
100
|
await organizations.setRole(org.id, userId, 'admin')
|
|
101
101
|
await organizations.remove(org.id, userId) // anybody may remove themselves: leave
|
|
102
102
|
await organizations.rename(org.id, 'Acme Books') // r.organization
|
|
@@ -228,6 +228,8 @@ const org = await auth.system.organizations.create({ name: 'Acme' })
|
|
|
228
228
|
await auth.system.members.add(org.id, { role: 'owner', email: 'ana@acme.com' })
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
+
`members.add` only adds: a person who already belongs keeps their role, and it throws `CauthyApiError` with `code: 'member_exists'` (409). Change a role with `members.setRole`, or pass `onlyNew: false` to set the role of whoever is already there. `<OrganizationMembers />` and `organizations.add` never change a member's role either: they answer `member_exists` (the text is `errors.member_exists`).
|
|
232
|
+
|
|
231
233
|
Its invitations open your `pages.acceptInvite` when the application knows its public origin (`baseURL`, `CAUTHY_BASE_URL`); otherwise Cauthy's own page.
|
|
232
234
|
|
|
233
235
|
A backend that is handed a Cauthy access token checks it with Cauthy's published keys: no secret, no call per request.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JsonValue, S as Session, t as SessionStatus, s as SessionOrganization, f as CheckQuestion, k as OrganizationRef, g as CheckResult, d as CauthySystem, q as PublicSession, c as CauthyOptions } from './system-
|
|
1
|
+
import { J as JsonValue, S as Session, t as SessionStatus, s as SessionOrganization, f as CheckQuestion, k as OrganizationRef, g as CheckResult, d as CauthySystem, q as PublicSession, c as CauthyOptions } from './system-Bz4haPrI.js';
|
|
2
2
|
import { JWTVerifyGetKey } from 'jose';
|
|
3
3
|
|
|
4
4
|
/** Something that happened in Cauthy, as a subscriber is told. Moments are UTC. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JsonValue, S as Session, t as SessionStatus, s as SessionOrganization, f as CheckQuestion, k as OrganizationRef, g as CheckResult, d as CauthySystem, q as PublicSession, c as CauthyOptions } from './system-
|
|
1
|
+
import { J as JsonValue, S as Session, t as SessionStatus, s as SessionOrganization, f as CheckQuestion, k as OrganizationRef, g as CheckResult, d as CauthySystem, q as PublicSession, c as CauthyOptions } from './system-DUGV040y.mjs';
|
|
2
2
|
import { JWTVerifyGetKey } from 'jose';
|
|
3
3
|
|
|
4
4
|
/** Something that happened in Cauthy, as a subscriber is told. Moments are UTC. */
|
package/dist/cli.js
CHANGED
|
@@ -1084,7 +1084,7 @@ function createSystem(given = {}) {
|
|
|
1084
1084
|
return toMember(await data(
|
|
1085
1085
|
"POST",
|
|
1086
1086
|
`/v1/organizations/${id(orgId)}/members`,
|
|
1087
|
-
{ role: m.role, user_id: m.userId, email: m.email, name: m.name, locale: m.locale, client_id: clientId },
|
|
1087
|
+
{ role: m.role, user_id: m.userId, email: m.email, name: m.name, locale: m.locale, client_id: clientId, only_new: m.onlyNew !== false },
|
|
1088
1088
|
inviteHeaders
|
|
1089
1089
|
));
|
|
1090
1090
|
},
|
package/dist/client.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CauthyTheme } from './theme.mjs';
|
|
2
|
-
import { q as PublicSession, f as CheckQuestion, k as OrganizationRef, g as CheckResult } from './system-
|
|
3
|
-
export { h as CheckRule } from './system-
|
|
2
|
+
import { q as PublicSession, f as CheckQuestion, k as OrganizationRef, g as CheckResult } from './system-DUGV040y.mjs';
|
|
3
|
+
export { h as CheckRule } from './system-DUGV040y.mjs';
|
|
4
4
|
import { A as AuthField, b as PasswordPolicy } from './validate-sEXG82po.mjs';
|
|
5
5
|
export { D as DEFAULT_PASSWORD_POLICY, F as FieldProblem, M as MIN_PASSWORD, P as PasswordClass, a as PasswordLocale, c as PasswordReason, d as checkCode, e as checkEmail, f as checkName, g as checkNewPassword, h as checkPassword, i as describePasswordPolicy, j as explainPasswordProblems, p as passwordPolicyOf, k as passwordProblems } from './validate-sEXG82po.mjs';
|
|
6
6
|
import 'jose';
|
|
@@ -291,7 +291,11 @@ interface OrganizationsClient {
|
|
|
291
291
|
members(organizationId: string): Promise<OrganizationPerson[] | null>;
|
|
292
292
|
/** The roles a member may be given, or null when the person may not see them. */
|
|
293
293
|
roles(organizationId: string): Promise<OrganizationRoleChoice[] | null>;
|
|
294
|
-
/**
|
|
294
|
+
/**
|
|
295
|
+
* Adds a person by their address; an address with no account gets one and
|
|
296
|
+
* its invitation. It only adds: a person who already belongs keeps their
|
|
297
|
+
* role and the result is the error `member_exists` (change it with `setRole`).
|
|
298
|
+
*/
|
|
295
299
|
add(organizationId: string, form: {
|
|
296
300
|
email: string;
|
|
297
301
|
role: string;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CauthyTheme } from './theme.js';
|
|
2
|
-
import { q as PublicSession, f as CheckQuestion, k as OrganizationRef, g as CheckResult } from './system-
|
|
3
|
-
export { h as CheckRule } from './system-
|
|
2
|
+
import { q as PublicSession, f as CheckQuestion, k as OrganizationRef, g as CheckResult } from './system-Bz4haPrI.js';
|
|
3
|
+
export { h as CheckRule } from './system-Bz4haPrI.js';
|
|
4
4
|
import { A as AuthField, b as PasswordPolicy } from './validate-sEXG82po.js';
|
|
5
5
|
export { D as DEFAULT_PASSWORD_POLICY, F as FieldProblem, M as MIN_PASSWORD, P as PasswordClass, a as PasswordLocale, c as PasswordReason, d as checkCode, e as checkEmail, f as checkName, g as checkNewPassword, h as checkPassword, i as describePasswordPolicy, j as explainPasswordProblems, p as passwordPolicyOf, k as passwordProblems } from './validate-sEXG82po.js';
|
|
6
6
|
import 'jose';
|
|
@@ -291,7 +291,11 @@ interface OrganizationsClient {
|
|
|
291
291
|
members(organizationId: string): Promise<OrganizationPerson[] | null>;
|
|
292
292
|
/** The roles a member may be given, or null when the person may not see them. */
|
|
293
293
|
roles(organizationId: string): Promise<OrganizationRoleChoice[] | null>;
|
|
294
|
-
/**
|
|
294
|
+
/**
|
|
295
|
+
* Adds a person by their address; an address with no account gets one and
|
|
296
|
+
* its invitation. It only adds: a person who already belongs keeps their
|
|
297
|
+
* role and the result is the error `member_exists` (change it with `setRole`).
|
|
298
|
+
*/
|
|
295
299
|
add(organizationId: string, form: {
|
|
296
300
|
email: string;
|
|
297
301
|
role: string;
|