@happyvertical/smrt-users 0.57.2 → 0.57.4

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
@@ -1336,10 +1336,68 @@ TenantService supports three modes: `flexible` (no auto-create), `personal` (aut
1336
1336
  | `Group` | Team within a tenant. Gains permissions via GroupRole. |
1337
1337
  | `Membership` | User + Tenant + Role junction. UNIQUE(userId, tenantId). |
1338
1338
  | `MembershipOverride` | Per-user permission grant/deny on a membership. |
1339
+ | `LegalMember` | Tenant-scoped legal member register entry, separate from authentication/RBAC membership and subscriptions. |
1340
+ | `MemberClass` | Configurable legal member classification; classes have no built-in authority or entitlement effect. |
1341
+ | `LegalMemberStatusHistory` | Append-only effective status history for historical and record-date queries. |
1342
+ | `LegalMemberReference` | Qualified reference to authoritative shares, dues, subscription, agreement, or ledger evidence; it never stores a balance. |
1343
+ | `MemberOfficerAppointment` | Effective-dated board/officer register entry; it is not an RBAC grant or ballot engine. |
1339
1344
  | `TenantPermissionOverride` | Tenant-level permission override (INHERIT/GRANT/DENY). |
1340
1345
  | `GroupMember`, `GroupRole`, `RolePermission` | Junction tables for groups and role-permission assignments. |
1341
1346
  | `AccessRequest` | "Request access / waitlist" record captured before a `User` exists. Closed generated surface — all access via `AccessRequestService`. |
1342
1347
 
1348
+ ## Legal member register
1349
+
1350
+ `MemberRegisterService` manages a tenant's legal member register. It is distinct
1351
+ from `Membership`, which is a user-to-tenant authorization row, and from
1352
+ subscriptions, which resolve paid entitlements. A legal member may be an
1353
+ individual or organisation and may link to a user/profile or an external-party
1354
+ reference, without requiring any of them.
1355
+
1356
+ The service writes effective status history, references financial evidence
1357
+ without copying balances, and effective board/officer terms. `asOf(recordDate,
1358
+ policy)` produces persisted, neutral eligibility snapshots plus CSV/JSON
1359
+ exports. A policy that requires shares or dues evidence fails closed unless the
1360
+ register has an explicitly authoritative reference for every required kind; the
1361
+ snapshot names that missing evidence rather than inferring payment status.
1362
+
1363
+ An omitted `memberClassKeys` policy allows every class; an explicit empty list
1364
+ allows none. `statuses` defaults to `['active']`, and an empty status list also
1365
+ allows none. Snapshots preserve normalized class keys (`null` means unrestricted),
1366
+ statuses, and required evidence kinds so the decision retains its policy inputs.
1367
+
1368
+ Hosts must authorize the trusted `MemberRegisterActor` before constructing the
1369
+ service. Generated REST, CLI and MCP operations are closed for these sensitive
1370
+ records. Every service lookup and write stays in the actor's tenant; an active
1371
+ context for another tenant is rejected. Direct collections are trusted internal
1372
+ APIs, not an authorization boundary for untrusted input.
1373
+
1374
+ `enroll`, `setStatus` and `asOf` require database transaction support and commit
1375
+ all of their writes together. History and references are append-only, and
1376
+ snapshots reject updates and deletes. Same-day history corrections use persisted
1377
+ sequence order. Eligibility uses effective history; `LegalMember.status` and
1378
+ `leftOn` are display caches refreshed by `setStatus`, so scheduled changes may
1379
+ make those caches stale until another write. Use `asOf` for record-date decisions.
1380
+
1381
+ Use `revokeReference(referenceId, { effectiveOn })` when previously authoritative
1382
+ evidence is withdrawn. It appends a dated record targeting the original reference;
1383
+ that original stops supporting eligibility on the revocation date. Earlier dates
1384
+ and already saved snapshots remain unchanged. A replacement authoritative reference
1385
+ must be explicitly added when evidence becomes valid again.
1386
+
1387
+ Enrollment accepts global profiles or profiles owned by the actor's tenant, and
1388
+ rejects foreign-tenant profiles. Members returned from enrollment and status changes
1389
+ are rebound to the caller's database so subsequent saves do not reuse a completed
1390
+ transaction's connection. Saves still require the appropriate tenant context.
1391
+
1392
+ Apply the generated s-m-r-t manifest migration before using the register; its six
1393
+ new tables require no auth-membership or subscription backfill. `userId` links
1394
+ to the local `User`; `profileId` uses the cross-package reference
1395
+ `@happyvertical/smrt-profiles:Profile`. Financial evidence is an opaque
1396
+ `sourceType`/`sourceId` reference (for example
1397
+ `@happyvertical/smrt-ledgers:JournalEntry` or
1398
+ `@happyvertical/smrt-subscriptions:TenantSubscription`); the host validates its
1399
+ authority and effective dates, and no posting or balance is copied here.
1400
+
1343
1401
  ### Collections
1344
1402
 
1345
1403
  | Export | Description |