# dev.blinkers.lens

> Lets holders of a blinkers key read, change and optionally create selected records in this repo.

- Kind: record
- Record key: any
- Authority: blinkers.dev
- Lexicon: 1
- Published by [blinkers.dev](https://lexicon.garden/identity/did:web:blinkers.dev), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:web:blinkers.dev/dev.blinkers.lens)
- [Schema JSON](https://lexicon.garden/lexicon/did:web:blinkers.dev/dev.blinkers.lens/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:web:blinkers.dev/dev.blinkers.lens/analytics)

## Record (`dev.blinkers.lens`)

Type: record · key any

### Properties

- `allow` (array): add lets keys create new records.
  - `items` (string)
    - Constraints: knownValues: add
- `collection` (string · nsid, required): The collection this lens covers, in this lens's repo.
- `condition` (string): CEL expression. The lens only covers records for which it is true.
- `createdAt` (string · datetime)
- `fields` (array, required): The top-level fields of the blink.
  - `items` (ref)
    - Reference: `#field`
- `newRecord` (unknown): The object new records start from. Strings wrapped in {% %} are CEL expressions.
- `rkey` (string, required): A record key, or a pattern where * stands for one or more characters, e.g. byjp.*
  - Constraints: maxLength: 512

## #each (`dev.blinkers.lens#each`)

Type: object

With items: how each item appears in the blink. Set path for a bare value or fields for an object. Paths are relative to the item. Leave each out to show the whole item.

### Properties

- `allow` (array)
  - `items` (string)
    - Constraints: knownValues: add | remove | replace
- `fields` (array)
  - `items` (ref)
    - Reference: `#field`
- `path` (string)

## #field (`dev.blinkers.lens#field`)

Type: object

One field of the blink. Set exactly one of path, items or fields.

### Properties

- `allow` (array): Changes callers may make. Leave it out to make the field read-only.
  - `items` (string)
    - Constraints: knownValues: add | remove | replace
- `each` (ref)
  - Reference: `#each`
- `fields` (array): Child fields; the blink shows an object.
  - `items` (ref)
    - Reference: `#field`
- `items` (string): JSONPath (RFC 9535) selecting list items: a singular query followed by one filter or wildcard selector.
- `key` (string, required): The field's name in the blink.
- `newItem` (unknown): With items: the object new items start from, before posted values are filled in. Strings wrapped in {% %} are CEL expressions.
- `path` (string): JSONPath (RFC 9535) selecting at most one value in the record.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "each": {
      "description": "With items: how each item appears in the blink. Set path for a bare value or fields for an object. Paths are relative to the item. Leave each out to show the whole item.",
      "properties": {
        "allow": {
          "items": {
            "knownValues": [
              "add",
              "remove",
              "replace"
            ],
            "type": "string"
          },
          "type": "array"
        },
        "fields": {
          "items": {
            "ref": "#field",
            "type": "ref"
          },
          "type": "array"
        },
        "path": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "field": {
      "description": "One field of the blink. Set exactly one of path, items or fields.",
      "properties": {
        "allow": {
          "description": "Changes callers may make. Leave it out to make the field read-only.",
          "items": {
            "knownValues": [
              "add",
              "remove",
              "replace"
            ],
            "type": "string"
          },
          "type": "array"
        },
        "each": {
          "ref": "#each",
          "type": "ref"
        },
        "fields": {
          "description": "Child fields; the blink shows an object.",
          "items": {
            "ref": "#field",
            "type": "ref"
          },
          "type": "array"
        },
        "items": {
          "description": "JSONPath (RFC 9535) selecting list items: a singular query followed by one filter or wildcard selector.",
          "type": "string"
        },
        "key": {
          "description": "The field's name in the blink.",
          "type": "string"
        },
        "newItem": {
          "description": "With items: the object new items start from, before posted values are filled in. Strings wrapped in {% %} are CEL expressions.",
          "type": "unknown"
        },
        "path": {
          "description": "JSONPath (RFC 9535) selecting at most one value in the record.",
          "type": "string"
        }
      },
      "required": [
        "key"
      ],
      "type": "object"
    },
    "main": {
      "description": "Lets holders of a blinkers key read, change and optionally create selected records in this repo.",
      "key": "any",
      "record": {
        "properties": {
          "allow": {
            "description": "add lets keys create new records.",
            "items": {
              "knownValues": [
                "add"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "collection": {
            "description": "The collection this lens covers, in this lens's repo.",
            "format": "nsid",
            "type": "string"
          },
          "condition": {
            "description": "CEL expression. The lens only covers records for which it is true.",
            "type": "string"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "fields": {
            "description": "The top-level fields of the blink.",
            "items": {
              "ref": "#field",
              "type": "ref"
            },
            "type": "array"
          },
          "newRecord": {
            "description": "The object new records start from. Strings wrapped in {% %} are CEL expressions.",
            "type": "unknown"
          },
          "rkey": {
            "description": "A record key, or a pattern where * stands for one or more characters, e.g. byjp.*",
            "maxLength": 512,
            "type": "string"
          }
        },
        "required": [
          "collection",
          "rkey",
          "fields"
        ],
        "type": "object"
      },
      "type": "record"
    }
  },
  "id": "dev.blinkers.lens",
  "lexicon": 1
}
```
