ObjectStackObjectStack

Sharing schema — Security Protocol reference

Sharing schemas of the ObjectStack Security Protocol: CriteriaSharingRule, OWDModel and 4 more — each property with its type, default and a TypeScript example.

Source: packages/spec/src/security/sharing.zod.ts

TypeScript Usage

import { CriteriaSharingRuleSchema, OWDModel, ShareRecipientType, SharingLevel, SharingRuleSchema, SharingRuleType } from '@objectstack/spec/security';
import type { CriteriaSharingRule, OWDModel, ShareRecipientType, SharingLevel, SharingRule, SharingRuleType } from '@objectstack/spec/security';

// Validate data
const result = CriteriaSharingRuleSchema.parse(data);

CriteriaSharingRule

Properties

PropertyTypeRequiredDescription
namestring✅Unique rule name (snake_case)
labelstringoptionalHuman-readable label
descriptionstringoptionalAdministrative notes
objectstring✅Target Object Name
activebooleanoptional (default: true)
accessLevelEnum<'read' | 'edit'>optional (default: "read")
sharedWith{ type: Enum<'user' | 'team' | 'position' | 'unit_and_subordinates' | 'business_unit' | 'field'>; value: string }✅The recipient of the shared access: a principal resolved once per rule, or — type: field — the user or users named by a field on each matched record
_lockEnum<'none' | 'no-overlay' | 'no-delete' | 'full'>optionalItem-level lock — controls overlay & delete (ADR-0010).
_lockReasonstringoptionalHuman-readable reason shown when a write is refused by _lock.
_lockSourceEnum<'artifact' | 'package' | 'env-forced'>optionalLayer that set _lock (artifact | package | env-forced).
_provenanceEnum<'package' | 'org' | 'env-forced'>optionalOrigin of the item (package | org | env-forced).
_packageIdstringoptionalOwning package machine id.
_packageVersionstringoptionalOwning package version.
_lockDocsUrlstringoptionalOptional documentation link surfaced next to _lockReason.
type'criteria'✅
conditionstring | { dialect: Enum<'cel' | 'cron' | 'template'>; source: string; ast?: any; meta?: object }✅Predicate (CEL). e.g. Precord.department == "Sales"

Nested Shape: CriteriaSharingRule.sharedWith

PropertyTypeRequiredDescription
typeEnum<'user' | 'team' | 'position' | 'unit_and_subordinates' | 'business_unit' | 'field'>✅
valuestring✅The recipient principal: the id or code of the user / team / position / business unit — or, for type: 'field', the snake_case name of a user-typed field on the record whose value names the user or users to share each matched record with

OWDModel

Allowed Values

  • private
  • public_read
  • public_read_write
  • controlled_by_parent

ShareRecipientType

Allowed Values

  • user
  • team
  • position
  • unit_and_subordinates
  • business_unit
  • field

SharingLevel

Allowed Values

  • read
  • edit

SharingRule

Properties

PropertyTypeRequiredDescription
namestring✅Unique rule name (snake_case)
labelstringoptionalHuman-readable label
descriptionstringoptionalAdministrative notes
objectstring✅Target Object Name
activebooleanoptional (default: true)
accessLevelEnum<'read' | 'edit'>optional (default: "read")
sharedWith{ type: Enum<'user' | 'team' | 'position' | 'unit_and_subordinates' | 'business_unit' | 'field'>; value: string }✅The recipient of the shared access: a principal resolved once per rule, or — type: field — the user or users named by a field on each matched record
_lockEnum<'none' | 'no-overlay' | 'no-delete' | 'full'>optionalItem-level lock — controls overlay & delete (ADR-0010).
_lockReasonstringoptionalHuman-readable reason shown when a write is refused by _lock.
_lockSourceEnum<'artifact' | 'package' | 'env-forced'>optionalLayer that set _lock (artifact | package | env-forced).
_provenanceEnum<'package' | 'org' | 'env-forced'>optionalOrigin of the item (package | org | env-forced).
_packageIdstringoptionalOwning package machine id.
_packageVersionstringoptionalOwning package version.
_lockDocsUrlstringoptionalOptional documentation link surfaced next to _lockReason.
type'criteria'✅
conditionstring | { dialect: Enum<'cel' | 'cron' | 'template'>; source: string; ast?: any; meta?: object }✅Predicate (CEL). e.g. Precord.department == "Sales"

Nested Shape: SharingRule.sharedWith

PropertyTypeRequiredDescription
typeEnum<'user' | 'team' | 'position' | 'unit_and_subordinates' | 'business_unit' | 'field'>✅
valuestring✅The recipient principal: the id or code of the user / team / position / business unit — or, for type: 'field', the snake_case name of a user-typed field on the record whose value names the user or users to share each matched record with

SharingRuleType

Allowed Values

  • criteria

On this page