Skip to content
SurfaceDocs
FRGet started
DocsModel reference

WorkspaceRule · types

Interfaces, values and named contracts for WorkspaceRule.

The following types define named objects and their relationships. Tables include inherited properties. Schema-derived types refer to their validated structures; a TypeScript declaration does not replace the compiler’s semantic checks.

WorkspaceRule

Admitted complete Rule declaration using the shared scalar and typed expression grammar.

export type WorkspaceRule = z.infer<typeof workspaceRuleSchema>;

ModelRuleExpression

Expression syntax accepted by the complete Model Rule declaration.

export type ModelRuleExpression = WorkspaceRule['expression'];
type ModelRuleExpression = import("./WorkspaceModelFoundationDeclarations.js").ScalarModelRuleExpression | { kind: "exact-compare"; operator: "eq" | "ne" | "lt" | "lte" | "gt" | "gte"; left: import("./WorkspaceExactData.js").ManagedExactDataExpression; right: import("./WorkspaceExactData.js").ManagedExactDataExpression; } | { kind: "integer-compare"; schema: { kind: "integer"; minimum: string; maximum: string; unit: { kind: "dimensionless"; } | { kind: "unit"; key: string; } | { kind: "currency"; key: string; }; }; operator: "eq" | "ne" | "lt" | "lte" | "gt" | "gte"; left: { kind: "field"; field: { definitionPath: string; fieldKey: string; }; } | { kind: "literal"; value: string; }; right: { kind: "field"; field: { definitionPath: string; fieldKey: string; }; } | { kind: "literal"; value: string; }; } | { kind: "real-compare"; schema: { kind: "real"; representation: "binary64"; precisionBits: 53; minimum: number; maximum: number; tolerance: { absolute: number; relative: number; }; unit: { kind: "dimensionless"; } | { kind: "unit"; key: string; }; }; operator: "approximately-equal" | "not-approximately-equal"; left: { kind: "field"; field: { definitionPath: string; fieldKey: string; }; } | { kind: "literal"; value: number; }; right: { kind: "field"; field: { definitionPath: string; fieldKey: string; }; } | { kind: "literal"; value: number; }; };

All references

Applied examples : Check before confirming

One rule requires a company; another rejects a zero or negative amount.

Configuration

Fragment placed in rules[]. Properties and accepted values.

{
  "contract": "WorkspaceRule@1",
  "key": "company-required",
  "label": "Company provided",
  "expression": {
    "kind": "present",
    "field": {
      "definitionPath": "workspace/clients/surface/client",
      "fieldKey": "company"
    }
  }
}

Variation and connection

Fragment placed in rules[]. Properties and accepted values.

{
  "contract": "WorkspaceRule@1",
  "key": "positive-amount",
  "label": "Positive amount",
  "expression": {
    "kind": "compare",
    "field": {
      "definitionPath": "workspace/quotes/surface/quote",
      "fieldKey": "amount"
    },
    "operator": "gt",
    "value": 0
  }
}

UI layout example

The illustrative layout below places this configuration in the Clients/Quotes app. Insert each fragment at the stated location, with Field, Query and Action references matching the Model declarations.

  1. Company *
  2. Status *
  3. Notes
  4. Create client
ILLUSTRATIVE LAYOUTClients / Quotes app
SurfaceClients / North StudioExample
WorkspaceRule · typesCheck before confirming
Clients
New client
Company *North Studio
Status *Prospect

Add notes to the record after creation.

CancelCreate client
Search for a concept, field or action.Esc