s-m-r-t
Open the s-m-r-t source on GitHub Switch to dark color scheme
← All packages
Foundation v0.44.0

@happyvertical/smrt-profiles

People, organizations, identities, metadata, and reciprocal or directional relationships.

Source

What it gives you

People, organizations, identities, metadata, and reciprocal or directional relationships.

  1. 01Profiles remain separate from authentication records
  2. 02Reciprocal and directional relationship types
  3. 03Time-bounded relationship terms and contextual third parties
  4. 04Organization-to-organization links on the same Profile rows

Relate two organizations

Organization is a Profile subtype, so an organization relates to another the way a person does. Create a supplier type with getOrCreateBySlug, then call addRelationship on the mill with the shop and the supplier slug. A directional type writes that one row. A reciprocal type with a handler also writes the inverse, and the shipped handlers are friend, spouse, partner, colleague, and sibling. Read the link from either side with getRelationships, date it with addTerm, and name a third profile as its context.

Profile relationships →

A relationship is not a tenant link and not a permission

ProfileRelationship carries one tenantId, and the Tenant record in smrt-users has no profile field. A tenant-to-tenant partnership is something an application builds on top, for example one Organization profile per tenant. Permission resolution never reads a relationship, so relating two profiles changes nothing about access.

Decide where data belongs →