@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 +1 -2
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -873,14 +873,18 @@ var AuthManager = class {
|
|
|
873
873
|
// never seed `sys_environment`) keep working: any lookup error
|
|
874
874
|
// is treated as "no envs to protect".
|
|
875
875
|
organizationHooks: {
|
|
876
|
-
// Gate fresh organization creation behind
|
|
876
|
+
// Gate fresh organization creation behind the multi-org flag.
|
|
877
877
|
// The plugin itself is always installed (so list/update/invite endpoints
|
|
878
878
|
// keep responding); only the `create` operation is denied when the
|
|
879
|
-
// deployment is provisioned in single-org mode.
|
|
880
|
-
//
|
|
879
|
+
// deployment is provisioned in single-org mode. Resolution order:
|
|
880
|
+
// 1. explicit `OS_MULTI_ORG_ENABLED` (wins for backwards compat),
|
|
881
|
+
// 2. else `OS_MULTI_TENANT` (multi-tenant deployments are always
|
|
882
|
+
// multi-org), default `'false'` → single-org / per-env runtime.
|
|
881
883
|
beforeCreateOrganization: async () => {
|
|
884
|
+
const env = globalThis?.process?.env ?? {};
|
|
885
|
+
const explicit = env.OS_MULTI_ORG_ENABLED;
|
|
882
886
|
const flag = String(
|
|
883
|
-
|
|
887
|
+
explicit ?? env.OS_MULTI_TENANT ?? "false"
|
|
884
888
|
).toLowerCase();
|
|
885
889
|
if (flag === "false") {
|
|
886
890
|
const { APIError } = await import("better-auth/api");
|
|
@@ -1271,8 +1275,9 @@ var AuthManager = class {
|
|
|
1271
1275
|
requireEmailVerification: emailPasswordConfig.requireEmailVerification ?? false
|
|
1272
1276
|
};
|
|
1273
1277
|
const pluginConfig = this.config.plugins ?? {};
|
|
1278
|
+
const multiOrgEnv = globalThis?.process?.env ?? {};
|
|
1274
1279
|
const multiOrgEnabled = String(
|
|
1275
|
-
|
|
1280
|
+
multiOrgEnv.OS_MULTI_ORG_ENABLED ?? multiOrgEnv.OS_MULTI_TENANT ?? "false"
|
|
1276
1281
|
).toLowerCase() !== "false";
|
|
1277
1282
|
const DEFAULT_TERMS_URL = "https://objectstack.ai/terms";
|
|
1278
1283
|
const DEFAULT_PRIVACY_URL = "https://objectstack.ai/privacy";
|