@objectstack/plugin-auth 6.8.0 → 6.9.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 CHANGED
@@ -300,5 +300,4 @@ pnpm test
300
300
 
301
301
  ## License
302
302
 
303
- BUSL-1.1 with a four-year conversion to Apache-2.0. See
304
- [LICENSING.md](../../../LICENSING.md).
303
+ Apache-2.0. See [LICENSING.md](../../../LICENSING.md).
package/dist/index.js CHANGED
@@ -937,14 +937,18 @@ var AuthManager = class {
937
937
  // never seed `sys_environment`) keep working: any lookup error
938
938
  // is treated as "no envs to protect".
939
939
  organizationHooks: {
940
- // Gate fresh organization creation behind `OS_MULTI_ORG_ENABLED`.
940
+ // Gate fresh organization creation behind the multi-org flag.
941
941
  // The plugin itself is always installed (so list/update/invite endpoints
942
942
  // keep responding); only the `create` operation is denied when the
943
- // deployment is provisioned in single-org mode. Default is enabled
944
- // to preserve historical behaviour.
943
+ // deployment is provisioned in single-org mode. Resolution order:
944
+ // 1. explicit `OS_MULTI_ORG_ENABLED` (wins for backwards compat),
945
+ // 2. else `OS_MULTI_TENANT` (multi-tenant deployments are always
946
+ // multi-org), default `'false'` → single-org / per-env runtime.
945
947
  beforeCreateOrganization: async () => {
948
+ const env = globalThis?.process?.env ?? {};
949
+ const explicit = env.OS_MULTI_ORG_ENABLED;
946
950
  const flag = String(
947
- globalThis?.process?.env?.OS_MULTI_ORG_ENABLED ?? "true"
951
+ explicit ?? env.OS_MULTI_TENANT ?? "false"
948
952
  ).toLowerCase();
949
953
  if (flag === "false") {
950
954
  const { APIError } = await import("better-auth/api");
@@ -1335,8 +1339,9 @@ var AuthManager = class {
1335
1339
  requireEmailVerification: emailPasswordConfig.requireEmailVerification ?? false
1336
1340
  };
1337
1341
  const pluginConfig = this.config.plugins ?? {};
1342
+ const multiOrgEnv = globalThis?.process?.env ?? {};
1338
1343
  const multiOrgEnabled = String(
1339
- globalThis?.process?.env?.OS_MULTI_ORG_ENABLED ?? "true"
1344
+ multiOrgEnv.OS_MULTI_ORG_ENABLED ?? multiOrgEnv.OS_MULTI_TENANT ?? "false"
1340
1345
  ).toLowerCase() !== "false";
1341
1346
  const DEFAULT_TERMS_URL = "https://objectstack.ai/terms";
1342
1347
  const DEFAULT_PRIVACY_URL = "https://objectstack.ai/privacy";