@camstack/core 0.1.31 → 0.1.33
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/builtins/local-auth/auth-schema.d.ts.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.d.ts +0 -6
- package/dist/builtins/local-auth/local-auth.addon.d.ts.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +4 -31
- package/dist/builtins/local-auth/local-auth.addon.js.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +4 -31
- package/dist/builtins/local-auth/local-auth.addon.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -6593,6 +6593,10 @@ var USERS_COLUMNS = [
|
|
|
6593
6593
|
name: "allowedDevices",
|
|
6594
6594
|
type: "JSON"
|
|
6595
6595
|
},
|
|
6596
|
+
{
|
|
6597
|
+
name: "scopes",
|
|
6598
|
+
type: "JSON"
|
|
6599
|
+
},
|
|
6596
6600
|
{
|
|
6597
6601
|
name: "createdAt",
|
|
6598
6602
|
type: "INTEGER",
|
|
@@ -6772,11 +6776,6 @@ var LocalAuthAddon = class extends BaseAddon {
|
|
|
6772
6776
|
this.apiKeyManager = new ApiKeyManager(storageAccess, this.authManager);
|
|
6773
6777
|
this.scopedTokenManager = new ScopedTokenManager(store);
|
|
6774
6778
|
try {
|
|
6775
|
-
try {
|
|
6776
|
-
await this.migrateLegacyUserRecords(store);
|
|
6777
|
-
} catch (err) {
|
|
6778
|
-
this.ctx.logger.warn("caps-only migration pass failed; legacy super_admin rows may still exist", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
6779
|
-
}
|
|
6780
6779
|
await this.userManager.ensureAdminExists();
|
|
6781
6780
|
const liveUsers = await this.userManager.listAll();
|
|
6782
6781
|
const liveIds = new Set(liveUsers.map((u) => u.id));
|
|
@@ -6908,32 +6907,6 @@ var LocalAuthAddon = class extends BaseAddon {
|
|
|
6908
6907
|
this.apiKeyManager = null;
|
|
6909
6908
|
this.scopedTokenManager = null;
|
|
6910
6909
|
}
|
|
6911
|
-
/**
|
|
6912
|
-
* Caps-only auth migration — rewrites legacy `super_admin` rows to
|
|
6913
|
-
* `admin` and backfills the missing `scopes` field with `[]`. Idempotent;
|
|
6914
|
-
* a re-run sees no rows needing changes.
|
|
6915
|
-
*/
|
|
6916
|
-
async migrateLegacyUserRecords(store) {
|
|
6917
|
-
const results = await store.query.query({ collection: "users" });
|
|
6918
|
-
let migrated = 0;
|
|
6919
|
-
for (const row of results) {
|
|
6920
|
-
const data = row.data;
|
|
6921
|
-
const needsRoleRewrite = (typeof data["role"] === "string" ? data["role"] : null) === "super_admin";
|
|
6922
|
-
const needsScopesBackfill = !("scopes" in data);
|
|
6923
|
-
if (!needsRoleRewrite && !needsScopesBackfill) continue;
|
|
6924
|
-
const next = { ...data };
|
|
6925
|
-
if (needsRoleRewrite) next["role"] = "admin";
|
|
6926
|
-
if (needsScopesBackfill) next["scopes"] = [];
|
|
6927
|
-
next["updatedAt"] = Date.now();
|
|
6928
|
-
await store.update.mutate({
|
|
6929
|
-
collection: "users",
|
|
6930
|
-
id: row.id,
|
|
6931
|
-
data: next
|
|
6932
|
-
});
|
|
6933
|
-
migrated++;
|
|
6934
|
-
}
|
|
6935
|
-
if (migrated > 0) this.ctx.logger.info("caps-only auth migration: rewrote legacy user records", { meta: { count: migrated } });
|
|
6936
|
-
}
|
|
6937
6910
|
};
|
|
6938
6911
|
//#endregion
|
|
6939
6912
|
export { LocalAuthAddon, LocalAuthAddon as default, AuthManager as i, ApiKeyManager as n, UserManager as r, ScopedTokenManager as t };
|