For the complete documentation index, see llms.txt. This page is also available as Markdown.

How "record scope" options map to event declaration?

Record scopes manage access to event-related actions. A persisted event is called record. You can find available scopes and their definitions here

For a scope to grant access, every option must match. Scope options are specific to each scope type. Most options control access based on the user or their jurisdiction. See administrative hierarchy to understand how jurisdictions work. Example 1: Searching for records

record.search accepts up to six options. When searching for records, scopes act as an additional filter — results are returned based on your search query, excluding any records you do not have access to. Undefined options are ignored.

export const JurisdictionFilter = z
  .enum(['administrativeArea', 'location', 'all'])
  .describe(
    'Filters based on user jurisdiction relative to their office location in hierarchy.'
  )
export type JurisdictionFilter = z.infer<typeof JurisdictionFilter>

export const UserFilter = z
  .enum(['user'])
  .describe('Filters based on the user. Limits to self.')
export type UserFilter = z.infer<typeof UserFilter>

const scopeByEvent = z
  // Ensure input is always an array for consistent parsing, even if a single string is provided by qs.
  .preprocess(
    (val) => (val === undefined ? undefined : [val].flat()),
    z.array(z.string()).optional()
  )
  .describe('Event type, e.g. birth, death')

Scope options with truncated record metadata — (Find the full type here)

Example 2: Declaring records — why options are limited As shown in the previous example, using properties like declared* or registered* implies the event has already reached that state. For an event to be declared, it must be in a NOTIFIED or CREATED state. Including declaredBy or registeredIn in a declare scope would cause it to fail the necessary access checks, so the system limits these options accordingly.

Last updated