logo logo
Design: Database: Links meta

Database Links
Purpose Hold the invitation links in the engagement.
Cardinality exactly one Links database in the engagement
exactly one item per guest in the engagement
Source Code
Items src/ts/dbitems/Links.ts
Zod Models
item LinksItem
item.item LinksRecord
itemId number of member in the Members database (first is 1)
item: LinksRecord
    kind 'link'
    mnum number of member in the Members db (same as itemId)
    link member's invitation link


Each guest invited to an engagement is assigned an initial username and password. These are encoded in the member's invitation link and stored in the Links database to allow the host to provide the guest with their member link.

(see userbase-js/types/index.d.ts)

  export interface Item {
    itemId: string
    item: any                   ◄────────────────┐
    createdBy: Attribution                       │
    updatedBy?: Attribution                      │
    fileId?: string                              │
    fileName?: string                            │
    fileSize?: number                            │
    fileUploadedBy?: Attribution                 │
    writeAccess?: AccessControl                  │
  }                                              │
LinksRecord represents the specific type of Item.item
for a member's invitation link.

The invitation link is constructed by concatenating the following values:

the site domain                 e.g. https://gl2401.securepub.org
the site path prefix            e.g. /_v1.2401_/join/#
the userbase AppId ULID         e.g. 23CQK4H9179YXRYYBG6GZ5HRV4
the Member's roledbid ULID      e.g. 6FHZVG8H4C8MES5G9HV47154ND
the Member's initial password   e.g. 7XQ5SZAZ6J8VZVSH3XJQT627YF

Invited members change their initial username and password when they accept their invitation and become accepted members.

Ownership and Access

The engagement host is the owner of the Links database.

The Links database is not shared. Only the host may access it.

Zod models

The following Zod models show how the Userbase items are represented in memory.

Note that in addition to the values specified by the Userbase Item interface the kind and database attributes are added during deserialization.

export type  LinksItem = z.infer<typeof LinksItem>;
export const LinksItem = z.object({
  kind:                 z.literal('linksitem'),
  itemId:               z.string(),
  item:                 LinksRecord,
  updatedBy:            z.custom<Attribution>(),
  database:             z.custom<Database>()
export type  LinksRecord = z.infer<typeof LinksRecord>;
export const LinksRecord = z.object({
  kind:                 z.literal('link'),
  mnum:                 z.number(),
  link:                 z.string()