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.
@@ -1,6 +1,6 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
- import { C as Cauthy } from './cauthy-2jtP2LVQ.mjs';
3
- import { S as Session } from './system-BrrJsrFW.mjs';
2
+ import { C as Cauthy } from './cauthy-C-GoRXy9.mjs';
3
+ import { S as Session } from './system-DUGV040y.mjs';
4
4
  import 'jose';
5
5
  import './theme.mjs';
6
6
 
package/dist/express.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
- import { C as Cauthy } from './cauthy-CKfvvv_i.js';
3
- import { S as Session } from './system-BvvoNs2y.js';
2
+ import { C as Cauthy } from './cauthy-BUozWD72.js';
3
+ import { S as Session } from './system-Bz4haPrI.js';
4
4
  import 'jose';
5
5
  import './theme.js';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { FastifyReply, FastifyPluginAsync } from 'fastify';
2
- import { C as Cauthy } from './cauthy-2jtP2LVQ.mjs';
3
- import { S as Session } from './system-BrrJsrFW.mjs';
2
+ import { C as Cauthy } from './cauthy-C-GoRXy9.mjs';
3
+ import { S as Session } from './system-DUGV040y.mjs';
4
4
  import 'jose';
5
5
  import './theme.mjs';
6
6
 
package/dist/fastify.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { FastifyReply, FastifyPluginAsync } from 'fastify';
2
- import { C as Cauthy } from './cauthy-CKfvvv_i.js';
3
- import { S as Session } from './system-BvvoNs2y.js';
2
+ import { C as Cauthy } from './cauthy-BUozWD72.js';
3
+ import { S as Session } from './system-Bz4haPrI.js';
4
4
  import 'jose';
5
5
  import './theme.js';
6
6
 
package/dist/hono.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MiddlewareHandler } from 'hono';
2
- import { C as Cauthy } from './cauthy-2jtP2LVQ.mjs';
3
- import { S as Session } from './system-BrrJsrFW.mjs';
2
+ import { C as Cauthy } from './cauthy-C-GoRXy9.mjs';
3
+ import { S as Session } from './system-DUGV040y.mjs';
4
4
  import 'jose';
5
5
  import './theme.mjs';
6
6
 
package/dist/hono.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MiddlewareHandler } from 'hono';
2
- import { C as Cauthy } from './cauthy-CKfvvv_i.js';
3
- import { S as Session } from './system-BvvoNs2y.js';
2
+ import { C as Cauthy } from './cauthy-BUozWD72.js';
3
+ import { S as Session } from './system-Bz4haPrI.js';
4
4
  import 'jose';
5
5
  import './theme.js';
6
6
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as Cauthy, a as CauthyEvent, b as CauthyWebhookError, R as Resolved, V as VerifyWebhookOptions, c as createCauthy, v as verifyWebhook } from './cauthy-2jtP2LVQ.mjs';
2
- export { A as AttributeType, C as CatalogResource, a as CauthyApiError, b as CauthyConfigError, c as CauthyOptions, d as CauthySystem, e as CheckOf, f as CheckQuestion, g as CheckResult, h as CheckRule, i as ConditionalPermission, J as JsonValue, N as NewMember, O as Organization, j as OrganizationMember, k as OrganizationRef, P as PermissionOf, l as Permitted, m as Policy, n as PolicyDefinition, o as PolicyPermission, p as PolicyRole, q as PublicSession, r as PushPolicyOptions, R as RoleOf, S as Session, s as SessionOrganization, t as SessionStatus, u as SessionUser, v as SystemKey, w as SystemOptions, x as SystemPolicy, y as can, z as createSystem, B as definePolicy, D as policySource, E as pullCatalog, F as pullPolicy, G as pushCatalog, H as pushPolicy } from './system-BrrJsrFW.mjs';
1
+ export { C as Cauthy, a as CauthyEvent, b as CauthyWebhookError, R as Resolved, V as VerifyWebhookOptions, c as createCauthy, v as verifyWebhook } from './cauthy-C-GoRXy9.mjs';
2
+ export { A as AttributeType, C as CatalogResource, a as CauthyApiError, b as CauthyConfigError, c as CauthyOptions, d as CauthySystem, e as CheckOf, f as CheckQuestion, g as CheckResult, h as CheckRule, i as ConditionalPermission, J as JsonValue, N as NewMember, O as Organization, j as OrganizationMember, k as OrganizationRef, P as PermissionOf, l as Permitted, m as Policy, n as PolicyDefinition, o as PolicyPermission, p as PolicyRole, q as PublicSession, r as PushPolicyOptions, R as RoleOf, S as Session, s as SessionOrganization, t as SessionStatus, u as SessionUser, v as SystemKey, w as SystemOptions, x as SystemPolicy, y as can, z as createSystem, B as definePolicy, D as policySource, E as pullCatalog, F as pullPolicy, G as pushCatalog, H as pushPolicy } from './system-DUGV040y.mjs';
3
3
  export { CauthyTheme, ImportedTheme, PushThemeOptions, StackmythThemeOptions, StackmythTokens, ThemeFont, ThemeTexts, pushTheme, themeFromStackmyth, tokensFromStackmyth } from './theme.mjs';
4
4
  export { A as AuthField, D as DEFAULT_PASSWORD_POLICY, F as FieldProblem, M as MIN_PASSWORD, P as PasswordClass, a as PasswordLocale, b as PasswordPolicy, 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';
5
5
  import { JWTVerifyGetKey } from 'jose';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as Cauthy, a as CauthyEvent, b as CauthyWebhookError, R as Resolved, V as VerifyWebhookOptions, c as createCauthy, v as verifyWebhook } from './cauthy-CKfvvv_i.js';
2
- export { A as AttributeType, C as CatalogResource, a as CauthyApiError, b as CauthyConfigError, c as CauthyOptions, d as CauthySystem, e as CheckOf, f as CheckQuestion, g as CheckResult, h as CheckRule, i as ConditionalPermission, J as JsonValue, N as NewMember, O as Organization, j as OrganizationMember, k as OrganizationRef, P as PermissionOf, l as Permitted, m as Policy, n as PolicyDefinition, o as PolicyPermission, p as PolicyRole, q as PublicSession, r as PushPolicyOptions, R as RoleOf, S as Session, s as SessionOrganization, t as SessionStatus, u as SessionUser, v as SystemKey, w as SystemOptions, x as SystemPolicy, y as can, z as createSystem, B as definePolicy, D as policySource, E as pullCatalog, F as pullPolicy, G as pushCatalog, H as pushPolicy } from './system-BvvoNs2y.js';
1
+ export { C as Cauthy, a as CauthyEvent, b as CauthyWebhookError, R as Resolved, V as VerifyWebhookOptions, c as createCauthy, v as verifyWebhook } from './cauthy-BUozWD72.js';
2
+ export { A as AttributeType, C as CatalogResource, a as CauthyApiError, b as CauthyConfigError, c as CauthyOptions, d as CauthySystem, e as CheckOf, f as CheckQuestion, g as CheckResult, h as CheckRule, i as ConditionalPermission, J as JsonValue, N as NewMember, O as Organization, j as OrganizationMember, k as OrganizationRef, P as PermissionOf, l as Permitted, m as Policy, n as PolicyDefinition, o as PolicyPermission, p as PolicyRole, q as PublicSession, r as PushPolicyOptions, R as RoleOf, S as Session, s as SessionOrganization, t as SessionStatus, u as SessionUser, v as SystemKey, w as SystemOptions, x as SystemPolicy, y as can, z as createSystem, B as definePolicy, D as policySource, E as pullCatalog, F as pullPolicy, G as pushCatalog, H as pushPolicy } from './system-Bz4haPrI.js';
3
3
  export { CauthyTheme, ImportedTheme, PushThemeOptions, StackmythThemeOptions, StackmythTokens, ThemeFont, ThemeTexts, pushTheme, themeFromStackmyth, tokensFromStackmyth } from './theme.js';
4
4
  export { A as AuthField, D as DEFAULT_PASSWORD_POLICY, F as FieldProblem, M as MIN_PASSWORD, P as PasswordClass, a as PasswordLocale, b as PasswordPolicy, 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';
5
5
  import { JWTVerifyGetKey } from 'jose';
package/dist/index.js CHANGED
@@ -841,7 +841,7 @@ function createSystem(given = {}) {
841
841
  return toMember(await data(
842
842
  "POST",
843
843
  `/v1/organizations/${id(orgId)}/members`,
844
- { role: m.role, user_id: m.userId, email: m.email, name: m.name, locale: m.locale, client_id: clientId },
844
+ { role: m.role, user_id: m.userId, email: m.email, name: m.name, locale: m.locale, client_id: clientId, only_new: m.onlyNew !== false },
845
845
  inviteHeaders
846
846
  ));
847
847
  },
@@ -2216,8 +2216,10 @@ function createCauthy(given = {}) {
2216
2216
  role,
2217
2217
  name: typeof b.name === "string" ? b.name.trim() : "",
2218
2218
  client_id: clientId,
2219
+ only_new: true,
2219
2220
  ...typeof b.locale === "string" && b.locale ? { locale: b.locale } : {}
2220
2221
  }, pages.acceptInvite, mine.token);
2222
+ if (res.error?.code === "already_member") res.error.code = "member_exists";
2221
2223
  if (res.error) return refused(res, res.error.code === "unknown_role" ? "role" : "email");
2222
2224
  return json({ status: "added", member: orgMemberOf(res.data) }, 200, mine.headers);
2223
2225
  }