@happyvertical/smrt-users 0.45.2 → 0.46.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
@@ -552,17 +552,27 @@ keys from a single deploy process:
552
552
 
553
553
  ```typescript
554
554
  import { backfillProfileEmailKeys } from '@happyvertical/smrt-profiles';
555
- import { backfillUserEmailKeys } from '@happyvertical/smrt-users';
555
+ import {
556
+ backfillLegacyUserProfiles,
557
+ backfillUserEmailKeys,
558
+ } from '@happyvertical/smrt-users';
556
559
 
557
560
  await backfillProfileEmailKeys(database);
558
561
  await backfillUserEmailKeys(database);
562
+ await backfillLegacyUserProfiles(database);
559
563
  ```
560
564
 
561
565
  The supported backfills are transactional and idempotent. The User backfill
562
566
  fails without changing rows if legacy emails are still ambiguous; reconcile
563
- the reported normalized keys and rerun it. All OIDC paths require the Profile
567
+ the reported normalized keys and rerun it. The legacy Profile backfill creates
568
+ and links a canonical global Person for each User whose Profile link is still
569
+ null or blank. It preserves the User ID and data, creates no OIDC identity, and
570
+ never infers ownership from email: any same-email Profile, duplicate User email,
571
+ or conflicting reservation must be reconciled explicitly before retrying. Its
572
+ marker records a successful pass but does not hide Users imported later. All
573
+ OIDC paths require the Profile
564
574
  marker; paths that create a User or arbitrate User email uniqueness also require
565
- the User marker. Run both before enabling OIDC provisioning. Pass the
575
+ the User marker. Run all three before enabling OIDC provisioning. Pass the
566
576
  root database to provisioning on adapters such as DuckDB that do not support
567
577
  nested savepoints; root adapters must expose `beginTransaction`. A handle
568
578
  exposing only `transaction()` is ambiguous and fails closed before resolver
@@ -679,6 +689,7 @@ TenantService supports three modes: `flexible` (no auto-create), `personal` (aut
679
689
  | `generatePostgresPermissionSql()`, `applyPostgresPermissionPolicies()` | Preview or apply Postgres RLS helper functions and table policies. |
680
690
  | `SessionService` | High-level session management. `createSession()`, `loadSessionContext()`, `destroySession()`; tenant contexts include direct or inherited membership provenance. |
681
691
  | `OidcLoginService` | Generic OIDC authorization-code login with PKCE for Kanidm, Dex, and other standards-compliant providers. |
692
+ | `backfillLegacyUserProfiles` | Transactionally create and link canonical global Person Profiles for legacy Users; never creates OIDC identities or infers ownership. |
682
693
  | `backfillUserEmailKeys` | Idempotently populate durable normalized-email keys after migrating legacy Users; fails closed on duplicates. |
683
694
  | `OidcProfileResolver` | Transaction-bound pre-provision hook for application identity reconciliation. |
684
695
  | `OidcProfileOwnerAuthorizer` | Transaction-bound application authorization for binding a first identity to an existing canonical Profile and its sole approved User owner. |