@objectstack/plugin-auth 6.9.0 → 7.0.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/dist/index.js +20 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -69,6 +69,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
69
69
|
|
|
70
70
|
// src/auth-plugin.ts
|
|
71
71
|
var import_apps = require("@objectstack/platform-objects/apps");
|
|
72
|
+
var import_pages = require("@objectstack/platform-objects/pages");
|
|
72
73
|
|
|
73
74
|
// src/objectql-adapter.ts
|
|
74
75
|
var import_adapters = require("better-auth/adapters");
|
|
@@ -694,8 +695,7 @@ var AuthManager = class {
|
|
|
694
695
|
relatedId: user.id
|
|
695
696
|
});
|
|
696
697
|
} catch (err) {
|
|
697
|
-
console.error(`[AuthManager] sendResetPassword failed: ${err?.message ?? err}`);
|
|
698
|
-
throw err;
|
|
698
|
+
console.error(`[AuthManager] sendResetPassword failed (swallowed): ${err?.message ?? err}`);
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
701
|
};
|
|
@@ -731,8 +731,7 @@ var AuthManager = class {
|
|
|
731
731
|
relatedId: user.id
|
|
732
732
|
});
|
|
733
733
|
} catch (err) {
|
|
734
|
-
console.error(`[AuthManager] sendVerificationEmail failed: ${err?.message ?? err}`);
|
|
735
|
-
throw err;
|
|
734
|
+
console.error(`[AuthManager] sendVerificationEmail failed (swallowed): ${err?.message ?? err}`);
|
|
736
735
|
}
|
|
737
736
|
}
|
|
738
737
|
}
|
|
@@ -873,12 +872,14 @@ var AuthManager = class {
|
|
|
873
872
|
async buildPluginList() {
|
|
874
873
|
const pluginConfig = this.config.plugins ?? {};
|
|
875
874
|
const plugins = [];
|
|
875
|
+
const oidcEnv = globalThis?.process?.env?.OS_OIDC_PROVIDER_ENABLED;
|
|
876
|
+
const oidcFromEnv = oidcEnv != null ? String(oidcEnv).toLowerCase() === "true" : void 0;
|
|
876
877
|
const enabled = {
|
|
877
878
|
organization: pluginConfig.organization ?? true,
|
|
878
879
|
twoFactor: pluginConfig.twoFactor ?? false,
|
|
879
880
|
passkeys: pluginConfig.passkeys ?? false,
|
|
880
881
|
magicLink: pluginConfig.magicLink ?? false,
|
|
881
|
-
oidcProvider: pluginConfig.oidcProvider ?? false,
|
|
882
|
+
oidcProvider: oidcFromEnv ?? pluginConfig.oidcProvider ?? false,
|
|
882
883
|
deviceAuthorization: pluginConfig.deviceAuthorization ?? false,
|
|
883
884
|
admin: pluginConfig.admin ?? false
|
|
884
885
|
};
|
|
@@ -1023,8 +1024,7 @@ var AuthManager = class {
|
|
|
1023
1024
|
relatedId: invitation.id
|
|
1024
1025
|
});
|
|
1025
1026
|
} catch (err) {
|
|
1026
|
-
console.error(`[AuthManager] sendInvitationEmail failed: ${err?.message ?? err}`);
|
|
1027
|
-
throw err;
|
|
1027
|
+
console.error(`[AuthManager] sendInvitationEmail failed (swallowed): ${err?.message ?? err}`);
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
1030
|
}));
|
|
@@ -1355,13 +1355,15 @@ var AuthManager = class {
|
|
|
1355
1355
|
};
|
|
1356
1356
|
const termsUrl = resolveLegalUrl(rawTermsUrl, DEFAULT_TERMS_URL);
|
|
1357
1357
|
const privacyUrl = resolveLegalUrl(rawPrivacyUrl, DEFAULT_PRIVACY_URL);
|
|
1358
|
+
const oidcEnv = globalThis?.process?.env?.OS_OIDC_PROVIDER_ENABLED;
|
|
1359
|
+
const oidcFromEnv = oidcEnv != null ? String(oidcEnv).toLowerCase() === "true" : void 0;
|
|
1358
1360
|
const features = {
|
|
1359
1361
|
twoFactor: pluginConfig.twoFactor ?? false,
|
|
1360
1362
|
passkeys: pluginConfig.passkeys ?? false,
|
|
1361
1363
|
magicLink: pluginConfig.magicLink ?? false,
|
|
1362
1364
|
organization: pluginConfig.organization ?? true,
|
|
1363
1365
|
multiOrgEnabled,
|
|
1364
|
-
oidcProvider: pluginConfig.oidcProvider ?? false,
|
|
1366
|
+
oidcProvider: oidcFromEnv ?? pluginConfig.oidcProvider ?? false,
|
|
1365
1367
|
deviceAuthorization: pluginConfig.deviceAuthorization ?? false,
|
|
1366
1368
|
...termsUrl ? { termsUrl } : {},
|
|
1367
1369
|
...privacyUrl ? { privacyUrl } : {}
|
|
@@ -1453,7 +1455,12 @@ var AuthPlugin = class {
|
|
|
1453
1455
|
// @objectstack/platform-objects/apps). plugin-auth is the natural
|
|
1454
1456
|
// owner of its registration since it loads first among the trio
|
|
1455
1457
|
// (auth + security + audit) that supplies the underlying objects.
|
|
1456
|
-
apps: [import_apps.SETUP_APP, import_apps.STUDIO_APP],
|
|
1458
|
+
apps: [import_apps.SETUP_APP, import_apps.STUDIO_APP, import_apps.ACCOUNT_APP],
|
|
1459
|
+
// Slotted record-detail pages for system objects — currently
|
|
1460
|
+
// sys_organization gets a Members / Invitations / Teams tab strip
|
|
1461
|
+
// (see SysOrganizationDetailPage for the rationale and the
|
|
1462
|
+
// intentionally-omitted OAuth / SSO tabs).
|
|
1463
|
+
pages: [import_pages.SysOrganizationDetailPage, import_pages.SysUserDetailPage],
|
|
1457
1464
|
// List views for each Setup-nav object are defined on the schema
|
|
1458
1465
|
// itself via the canonical `listViews` map (e.g.
|
|
1459
1466
|
// sys_user.listViews.{all_users,unverified,two_factor}). Registering
|
|
@@ -1472,30 +1479,6 @@ var AuthPlugin = class {
|
|
|
1472
1479
|
if (!this.authManager) {
|
|
1473
1480
|
throw new Error("Auth manager not initialized");
|
|
1474
1481
|
}
|
|
1475
|
-
ctx.hook("kernel:ready", async () => {
|
|
1476
|
-
try {
|
|
1477
|
-
const i18n = ctx.getService("i18n");
|
|
1478
|
-
let loaded = 0;
|
|
1479
|
-
for (const [locale, data] of Object.entries(import_apps.SetupAppTranslations)) {
|
|
1480
|
-
if (data && typeof data === "object") {
|
|
1481
|
-
try {
|
|
1482
|
-
i18n.loadTranslations(locale, data);
|
|
1483
|
-
loaded++;
|
|
1484
|
-
} catch (err) {
|
|
1485
|
-
ctx.logger.warn(
|
|
1486
|
-
`Auth: failed to load Setup App translations for '${locale}': ${err?.message ?? err}`
|
|
1487
|
-
);
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
if (loaded > 0) {
|
|
1492
|
-
ctx.logger.info(
|
|
1493
|
-
`Auth: contributed Setup App translations (${loaded} locale${loaded > 1 ? "s" : ""})`
|
|
1494
|
-
);
|
|
1495
|
-
}
|
|
1496
|
-
} catch {
|
|
1497
|
-
}
|
|
1498
|
-
});
|
|
1499
1482
|
if (this.options.registerRoutes) {
|
|
1500
1483
|
ctx.hook("kernel:ready", async () => {
|
|
1501
1484
|
if (this.authManager) {
|
|
@@ -1753,7 +1736,10 @@ var AuthPlugin = class {
|
|
|
1753
1736
|
);
|
|
1754
1737
|
}
|
|
1755
1738
|
});
|
|
1756
|
-
|
|
1739
|
+
const oidcEnv = globalThis?.process?.env?.OS_OIDC_PROVIDER_ENABLED;
|
|
1740
|
+
const oidcFromEnv = oidcEnv != null ? String(oidcEnv).toLowerCase() === "true" : void 0;
|
|
1741
|
+
const oidcEnabled = oidcFromEnv ?? this.options.plugins?.oidcProvider ?? false;
|
|
1742
|
+
if (oidcEnabled) {
|
|
1757
1743
|
void this.registerOidcDiscoveryRoutes(rawApp, ctx).catch((error) => {
|
|
1758
1744
|
ctx.logger.error("Failed to register OIDC discovery routes", error);
|
|
1759
1745
|
});
|