0.4.0-alpha.11 • Published 3 years ago

@dockite/field-reference v0.4.0-alpha.11

Weekly downloads
56
License
MIT
Repository
-
Last release
3 years ago

Field Reference

Field Reference handles the referencing of another document within the application. This allows for the defining and creation of relationships across/within schemas and creation of tree structures.

Caveats

Due to the cost of fetching references for a table view, references will store the last known identifier of the document that they refer to within the field for display which may become outdated if the referenced document is updated without updating the referrer.

Input

The reference field requires an input containing the id and schemaId of the document.

{
  "id": "the-document-id",
  "schemaId": "the-schema-id"
}

Output

The output type will vary based on the schema the referenced document belongs to containing it's set of fields. An example output for a document referencing the same schema can be seen below:

{
  "id": "000-000-000",
  "name": "A blog post",
  "slug": "a-blog-post",
  "relatedPost": {
    "id": "111-111-111",
    "name": "My second post",
    "slug": "my-second-post",
  }
}

### Configuration

The reference field takes a set of schemaId's to specify which documents can be chosen to refer to, additionally the fields to display in the selection modal.

Finally the optional constraints can be provided to further restrict the items that can be selected in the selection modal, useful in cases where you need to dynamically restrict the selection based on document data.

```json
{
  // The schemas to include for selection
  "schemaIds": ["111-111-111", "222-222-222"],
  // The fields to display in the reference modal (OPTIONAL)
  "fieldsToDisplay": ["name", "title", "link"],
  // The constraints to apply to the document selection modal query
  // can use data on a document with mustache syntax (OPTIONAL)
  "constraints": [
    {
      "name": "type",
      "opertator": "$eq",
      "value": "{{ data.type }}"
    },
    {
      "name": "url",
      "opertator": "$like",
      "value": "https://example.com"
    }
  ]
}
0.4.0-alpha.11

3 years ago

0.4.0-alpha.10

3 years ago

0.4.0-alpha.9

3 years ago

0.4.0-alpha.8

3 years ago

0.4.0-alpha.7

3 years ago

0.4.0-alpha.6

3 years ago

0.4.0-alpha.4

3 years ago

0.4.0-alpha.5

3 years ago

0.4.0-alpha.3

3 years ago

0.4.0-alpha.2

3 years ago

0.4.0-alpha.1

3 years ago

0.4.0-alpha.0

3 years ago

0.3.1-alpha.0

3 years ago

0.3.0

3 years ago

0.3.0-alpha.34

3 years ago

0.3.0-alpha.33

3 years ago

0.3.0-alpha.32

3 years ago

0.3.0-alpha.31

3 years ago

0.3.0-alpha.30

3 years ago

0.3.0-alpha.29

4 years ago

0.3.0-alpha.28

4 years ago

0.3.0-alpha.27

4 years ago

0.3.0-alpha.26

4 years ago

0.3.0-alpha.25

4 years ago

0.3.0-alpha.24

4 years ago

0.3.0-alpha.22

4 years ago

0.3.0-alpha.23

4 years ago

0.3.0-alpha.21

4 years ago

0.3.0-alpha.20

4 years ago

0.3.0-alpha.19

4 years ago

0.3.0-alpha.18

4 years ago

0.3.0-alpha.17

4 years ago

0.3.0-alpha.16

4 years ago

0.3.0-alpha.15

4 years ago

0.3.0-alpha.14

4 years ago

0.3.0-alpha.13

4 years ago

0.3.0-alpha.12

4 years ago

0.3.0-alpha.11

4 years ago

0.3.0-alpha.10

4 years ago

0.3.0-alpha.9

4 years ago

0.3.0-alpha.8

4 years ago

0.3.0-alpha.7

4 years ago

0.3.0-alpha.6

4 years ago

0.3.0-alpha.5

4 years ago

0.3.0-alpha.4

4 years ago

0.3.0-alpha.3

4 years ago

0.3.0-alpha.2

4 years ago

0.3.0-alpha.1

4 years ago

0.2.6-alpha.16

4 years ago

0.2.6-alpha.15

4 years ago

0.3.0-alpha.0

4 years ago

0.2.6-alpha.14

4 years ago

0.2.6-alpha.13

4 years ago

0.2.6-alpha.12

4 years ago

0.2.6-alpha.11

4 years ago

0.2.6-alpha.10

4 years ago

0.2.6-alpha.9

4 years ago

0.2.6-alpha.8

4 years ago

0.2.6-alpha.7

4 years ago

0.2.6-alpha.5

4 years ago

0.2.6-alpha.6

4 years ago

0.2.6-alpha.4

4 years ago

0.2.6-alpha.3

4 years ago

0.2.6-alpha.2

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.5

4 years ago

0.2.2-alpha.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago