Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .changeset/add-ops-lexicon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
"@hypercerts-org/lexicon": minor
---

Add ops lexicon for work scope logic operator nodes

**New Features:**

- **New lexicon (`org.hypercerts.helper.ops`):**
- Operator node record type for work scope logic expressions
- Supports nested boolean logic operations (AND, OR, NOT)
- Fields:
- `op` (required): Operator identifier (e.g., 'all', 'any', 'not')
- `args` (required): Array of strongRefs pointing to `org.hypercerts.helper.workScopeTag` (leaf atoms) or other `org.hypercerts.helper.ops` records (nested expressions)
- `createdAt` (required): Client-declared timestamp
- Enables complex work scope logic by allowing operators to reference other operators or scope tags recursively
- Operator semantics are defined by consuming applications

**Usage:**

The `org.hypercerts.helper.ops` lexicon works together with `org.hypercerts.helper.workScopeTag` to create nested boolean logic expressions for work scope definitions. Operators can be referenced via strongRefs in activity records' `workScope` field.

**Example:**

```json
{
"$type": "org.hypercerts.helper.ops",
"op": "all",
"args": [
{ "uri": "at://.../workScopeTag/ipfs", "cid": "..." },
{ "uri": "at://.../workScopeTag/go", "cid": "..." }
],
"createdAt": "2024-01-01T00:00:00Z"
}
```
34 changes: 34 additions & 0 deletions lexicons/org/hypercerts/helper/ops.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"lexicon": 1,
"id": "org.hypercerts.helper.ops",
"defs": {
"main": {
"type": "record",
"description": "Operator node for work scope logic. Nesting is achieved by having args strongRefs point to either workScopeTag records (leaf atoms) or other ops records (nested expressions). Operator semantics are defined by consuming applications.\n\nExamples: op='all' (AND), op='any' (OR), op='not' (NOT; typically unary).",
"key": "tid",
"record": {
"type": "object",
"required": ["createdAt", "op", "args"],
"properties": {
"op": {
"type": "string",
"maxLength": 64,
"description": "Operator identifier. Semantics are defined by the evaluating application. Examples: 'all', 'any', 'not'."
},
"args": {
"type": "array",
"minLength": 1,
"maxLength": 100,
"items": { "type": "ref", "ref": "com.atproto.repo.strongRef" },
"description": "Arguments. Each strongRef should point to either org.hypercerts.helper.workScopeTag (leaf) or org.hypercerts.helper.ops (nested). For op='not', args SHOULD have exactly one element (enforced by clients)."
},
"createdAt": {
"type": "string",
"format": "datetime",
"description": "Client-declared timestamp when this record was originally created"
}
}
}
}
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.