@happyvertical/smrt-users 0.57.37 → 0.57.38
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/chunks/{PasswordCredentialService-DA2Y6H2X.js → PasswordCredentialService-bedKxkaa.js} +19 -17
- package/dist/chunks/PasswordCredentialService-bedKxkaa.js.map +1 -0
- package/dist/chunks/{TerminalAuthService-B2qkZqxX.js → TerminalAuthService-n0CLoMgG.js} +4 -4
- package/dist/chunks/TerminalAuthService-n0CLoMgG.js.map +1 -0
- package/dist/collections/RolePermissionCollection.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +30 -6
- package/dist/member-register/models.d.ts +4 -4
- package/dist/member-register/models.d.ts.map +1 -1
- package/dist/models/ResourceGrant.d.ts +3 -2
- package/dist/models/ResourceGrant.d.ts.map +1 -1
- package/dist/models/User.d.ts +2 -2
- package/dist/models/User.d.ts.map +1 -1
- package/dist/operator.js +1 -1
- package/dist/services/MobileAuthService.d.ts.map +1 -1
- package/dist/services/PermissionCatalogService.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +16 -4
- package/dist/sveltekit.js +2 -2
- package/package.json +9 -9
- package/dist/chunks/PasswordCredentialService-DA2Y6H2X.js.map +0 -1
- package/dist/chunks/TerminalAuthService-B2qkZqxX.js.map +0 -1
package/dist/chunks/{PasswordCredentialService-DA2Y6H2X.js → PasswordCredentialService-bedKxkaa.js}
RENAMED
|
@@ -564,12 +564,12 @@ var User = class extends SmrtObject {
|
|
|
564
564
|
this.lastLoginAt = /* @__PURE__ */ new Date();
|
|
565
565
|
}
|
|
566
566
|
/** Keep the durable email key derived from the public email field. */
|
|
567
|
-
async save() {
|
|
567
|
+
async save(options) {
|
|
568
568
|
this.email = normalizeEmail(this.email);
|
|
569
569
|
this.emailKey = this.email || null;
|
|
570
570
|
this.username = normalizeUsername(this.username) || null;
|
|
571
571
|
this.usernameKey = this.username;
|
|
572
|
-
return super.save();
|
|
572
|
+
return super.save(options);
|
|
573
573
|
}
|
|
574
574
|
};
|
|
575
575
|
__publicField$10(User, "__smrtPackage__", "@happyvertical/smrt-users");
|
|
@@ -2096,6 +2096,15 @@ RolePermission = __decorateClass$2([smrt({
|
|
|
2096
2096
|
cli: { include: ["list", "get"] },
|
|
2097
2097
|
conflictColumns: ["role_id", "permission_id"]
|
|
2098
2098
|
})], RolePermission);
|
|
2099
|
+
//#endregion
|
|
2100
|
+
//#region src/services/authorization-read-options.ts
|
|
2101
|
+
function withoutListBounds(options) {
|
|
2102
|
+
return {
|
|
2103
|
+
...options,
|
|
2104
|
+
defaultListLimit: void 0,
|
|
2105
|
+
maxListLimit: void 0
|
|
2106
|
+
};
|
|
2107
|
+
}
|
|
2099
2108
|
async function writeInSeedingBatches(db, items, write) {
|
|
2100
2109
|
for (let start = 0; start < items.length; start += 50) {
|
|
2101
2110
|
const batch = items.slice(start, start + 50);
|
|
@@ -2519,7 +2528,7 @@ var PermissionCatalogService = class PermissionCatalogService {
|
|
|
2519
2528
|
}
|
|
2520
2529
|
async syncPermissionCatalog() {
|
|
2521
2530
|
const catalog = this.getCatalog();
|
|
2522
|
-
const permissions = await PermissionCollection.create(this.options);
|
|
2531
|
+
const permissions = await PermissionCollection.create(withoutListBounds(this.options));
|
|
2523
2532
|
const created = [];
|
|
2524
2533
|
const unchanged = [];
|
|
2525
2534
|
const updated = [];
|
|
@@ -2856,8 +2865,10 @@ var RolePermissionCollection = class RolePermissionCollection extends SmrtCollec
|
|
|
2856
2865
|
const catalogService = PermissionCatalogService.create(this.options);
|
|
2857
2866
|
const syncResult = options.syncCatalog === false ? void 0 : await catalogService.syncPermissionCatalog();
|
|
2858
2867
|
const catalog = options.catalog ?? syncResult?.catalog ?? catalogService.getCatalog();
|
|
2859
|
-
const
|
|
2860
|
-
const
|
|
2868
|
+
const unboundedOptions = withoutListBounds(this.options);
|
|
2869
|
+
const permissions = await PermissionCollection.create(unboundedOptions);
|
|
2870
|
+
const roles = await RoleCollection.create(unboundedOptions);
|
|
2871
|
+
const unboundedGrants = await RolePermissionCollection.create(unboundedOptions);
|
|
2861
2872
|
const catalogSlugs = catalog.permissions.map((permission) => permission.slug);
|
|
2862
2873
|
const permissionIdBySlug = /* @__PURE__ */ new Map();
|
|
2863
2874
|
const writes = [];
|
|
@@ -2882,7 +2893,7 @@ var RolePermissionCollection = class RolePermissionCollection extends SmrtCollec
|
|
|
2882
2893
|
for (const slug of DEFAULT_SELF_PERSONALIZATION_PERMISSIONS) if (isBuiltInDefaultRoleSlug(roleSlug) && role.tenantId === null && role.isSystem === true && catalogSlugs.includes(slug) && shouldSeedDefaultRolePermission(roleSlug, slug)) matchedSlugs.add(slug);
|
|
2883
2894
|
const sortedMatchedSlugs = Array.from(matchedSlugs).sort();
|
|
2884
2895
|
result.matched[roleSlug].push(...sortedMatchedSlugs);
|
|
2885
|
-
const existingPermissionIds = new Set(await
|
|
2896
|
+
const existingPermissionIds = new Set(await unboundedGrants.getPermissionIds(role.id));
|
|
2886
2897
|
const targetPermissionIds = /* @__PURE__ */ new Set();
|
|
2887
2898
|
for (const slug of sortedMatchedSlugs) {
|
|
2888
2899
|
const permissionId = permissionIdBySlug.get(slug);
|
|
@@ -4258,15 +4269,6 @@ function requireId(value, label) {
|
|
|
4258
4269
|
function isUserOidcRaceConflict(error) {
|
|
4259
4270
|
return isOidcProvisioningRaceConflict(error, { messagePatterns: [/users[._].*profile_id|users_profile_id/iu] });
|
|
4260
4271
|
}
|
|
4261
|
-
//#endregion
|
|
4262
|
-
//#region src/services/authorization-read-options.ts
|
|
4263
|
-
function withoutListBounds(options) {
|
|
4264
|
-
return {
|
|
4265
|
-
...options,
|
|
4266
|
-
defaultListLimit: void 0,
|
|
4267
|
-
maxListLimit: void 0
|
|
4268
|
-
};
|
|
4269
|
-
}
|
|
4270
4272
|
var MAX_N = 2 ** 20;
|
|
4271
4273
|
var MAX_R = 32;
|
|
4272
4274
|
var MAX_P = 16;
|
|
@@ -6130,6 +6132,6 @@ var PasswordCredentialService = class PasswordCredentialService {
|
|
|
6130
6132
|
}
|
|
6131
6133
|
};
|
|
6132
6134
|
//#endregion
|
|
6133
|
-
export {
|
|
6135
|
+
export { deriveOperationPermissionCollectionName as $, InvalidCredentialsError as A, Session as At, TenantPermissionOverrideCollection as B, DEFAULT_LOGIN_ATTEMPT_WINDOW_SECONDS as C, SessionCollection as Ct, DEFAULT_LOGIN_MAX_ATTEMPTS as D, normalizeUsername as Dt, DEFAULT_LOGIN_LOCKOUT_MAX_SECONDS as E, normalizeEmail as Et, OidcProvisioningError as F, __exportAll as Ft, TenantHierarchyError as G, TenantCollection as H, UserCollection as I, planTenantHierarchy as J, applyTenantHierarchyUpdates as K, USER_EMAIL_KEY_BACKFILL_NAME as L, LoginRateLimitError as M, Role as Mt, hashSecret as N, Permission as Nt, DEFAULT_SOURCE_LOCKOUT_AUDIT_SECONDS as O, DEFAULT_SESSION_TTL as Ot, verifySecretHash as P, Membership as Pt, PermissionCatalogService as Q, UserEmailKeyBackfillError as R, normalizeAncestorReadPolicy as S, UsersLoginAttempt as St, DEFAULT_LOGIN_LOCKOUT_FACTOR as T, isValidEmail as Tt, Tenant as U, TenantPermissionOverride as V, MAX_TENANT_HIERARCHY_DEPTH as W, DEFAULT_ROLE_PERMISSION_PATTERNS as X, recordTenantHierarchyChanges as Y, RolePermissionCollection as Z, PermissionResolver as _, GroupCollection as _t, DEFAULT_PASSWORD_RECOVERY_MAX_AGE_SECONDS as a, RolePermission as at, getConfiguredAncestorReadPolicy as b, UsersLoginAuditEvent as bt, PASSWORD_PERMISSION_DEFINITIONS as c, UsersPasswordCredentialCollection as ct, PasswordCredentialForbiddenError as d, MembershipOverride as dt, deriveOperationPermissionSlug as et, PasswordCredentialService as f, MembershipCollection as ft, SessionService as g, GroupMember as gt, outOfBandProofSessionData as h, GroupMemberCollection as ht, DEFAULT_PASSWORD_MIN_LENGTH as i, withoutListBounds as it, LoginAttemptLimiter as j, generateSessionId as jt, DurableLoginAuditSink as k, SESSION_DATA_KEYS as kt, PASSWORD_RECOVERY_MAX_AGE_CEILING_SECONDS as l, UsersPasswordCredential as lt, ensurePasswordPermissionsRegistered as m, GroupRole as mt, DEFAULT_PASSWORD_MANAGE_PERMISSION as n, registerPermissionDefinitions as nt, PASSWORD_LOGIN_KIND as o, RoleCollection as ot, PasswordPolicyError as p, GroupRoleCollection as pt, assertTenantTableName as q, DEFAULT_PASSWORD_MAX_LENGTH as r, syncPermissionCatalog as rt, PASSWORD_MAX_LENGTH_CEILING as s, PermissionCollection as st, DEFAULT_PASSWORD_DENYLIST as t, normalizeOperationPermissionAction as tt, PasswordCredentialError as u, MembershipOverrideCollection as ut, ANCESTOR_READ_ACTION as v, Group as vt, DEFAULT_LOGIN_LOCKOUT_BASE_SECONDS as w, User as wt, isAncestorReadableSlug as x, UsersLoginAttemptCollection as xt, DEFAULT_ANCESTOR_READ_MAX_DEPTH as y, UsersLoginAuditEventCollection as yt, backfillUserEmailKeys as z };
|
|
6134
6136
|
|
|
6135
|
-
//# sourceMappingURL=PasswordCredentialService-
|
|
6137
|
+
//# sourceMappingURL=PasswordCredentialService-bedKxkaa.js.map
|