API Reference
Typedefs
- FarmEntityMethods : 
Object The methods for writing to local copies of farmOS data structures, such as assets, logs, etc, and for transmitting those entities to a farmOS server.
- FarmObject : 
Object A collection of functions for working with farmOS data structures, their associated metadata and schemata, and for interacting with farmOS servers.
- EntityConfig : 
EntityConfig To enable support for each entity type, its config object must be provided.
- farmOS ⇒ 
FarmObject The main farmOS factory function for creating a new farm object.
- JsonSchema : 
JsonSchema JSON Schema for defining the entities supported by a farmOS instance.
- JsonSchemaDereferenced : 
JsonSchemaDereferenced JSON Schema Dereferenced: A JSON Schema, but w/o any $ref keywords. As such, it may contain circular references that cannot be serialized.
- BundleSchemata : 
Object.<string, JsonSchema> An object containing the schemata for the bundles of a farmOS entity, with the bundle name as key and its corresponding schema as its value.
- EntitySchemata : 
Object.<string, BundleSchemata> An object containing the schemata for the bundles of a farmOS entity, with the bundle name as key and its corresponding schema as its value.
- ModelEntityMethods : 
Object The methods for writing to local copies of farmOS data structures, such as assets, logs, etc.
- FarmModel : 
Object A collection of functions for working with farmOS data structures, their associated metadata and schemata.
- EntityConfig : 
EntityConfig - model ⇒ 
FarmModel Create a farm model for generating and manipulating farmOS data structures.
- ClientEntityMethods : 
Object The methods for transmitting farmOS data structures, such as assets, logs, etc, to a farmOS server.
- FetchSchema ⇒ 
Promise.<(EntitySchemata|BundleSchemata|JsonSchema)> Fetch JSON Schema documents for farmOS data structures.
- AuthMixin ⇒ 
Object.<string, function()> - FarmClient : 
Object A collection of functions for transmitting farmOS data structures to and from a farmOS Drupal 9 server using JSON:API.
- EntityConfig : 
EntityConfig - client ⇒ 
FarmClient Create a farm client for interacting with farmOS servers.
- EntityReference : 
Object - Entity : 
Object - EntityConfig : 
Object - DefaultEntities : 
Object.<String, EntityConfig> 
FarmEntityMethods : Object
The methods for writing to local copies of farmOS data structures, such as assets, logs, etc, and for transmitting those entities to a farmOS server.
Kind: global typedef
Properties
| Name | Type | 
|---|---|
| create | createEntity | 
| update | updateEntity | 
| merge | mergeEntity | 
| [fetch] | fetchEntity | 
| [send] | sendEntity | 
| [delete] | deleteEntity | 
FarmObject : Object
A collection of functions for working with farmOS data structures, their associated metadata and schemata, and for interacting with farmOS servers.
Kind: global typedef
Properties
| Name | Type | 
|---|---|
| schema | Object | 
| schema.get | function | 
| schema.set | function | 
| schema.on | function | 
| [schema.fetch] | function | 
| meta | Object | 
| meta.isUnsynced | function | 
| remote | Object | 
| remote.request | module:axios~AxiosInstance | 
| [remote.info] | function | 
| [remote.authorize] | function | 
| [remote.getToken] | function | 
| asset | FarmEntityMethods | 
| file | FarmEntityMethods | 
| log | FarmEntityMethods | 
| plan | FarmEntityMethods | 
| quantity | FarmEntityMethods | 
| term | FarmEntityMethods | 
| user | FarmEntityMethods | 
EntityConfig : EntityConfig
To enable support for each entity type, its config object must be provided.
farmOS ⇒ FarmObject
The main farmOS factory function for creating a new farm object.
Kind: global typedef
| Param | Type | 
|---|---|
| farmConfig | Object | 
Properties
| Name | Type | Default | 
|---|---|---|
| [config.schemata] | EntitySchemata | 
|
| [config.remote] | Object | 
|
| [config.remote.adapter] | client | 
d9JsonApiAdapter | 
| [config.entities] | Object.<String, EntityConfig> | 
defaultEntities | 
JsonSchema : JsonSchema
JSON Schema for defining the entities supported by a farmOS instance.
Kind: global typedef
See: https://json-schema.org/understanding-json-schema/index.html
JsonSchemaDereferenced : JsonSchemaDereferenced
JSON Schema Dereferenced: A JSON Schema, but w/o any $ref keywords. As such, it may contain circular references that cannot be serialized.
BundleSchemata : Object.<string, JsonSchema>
An object containing the schemata for the bundles of a farmOS entity, with the bundle name as key and its corresponding schema as its value.
EntitySchemata : Object.<string, BundleSchemata>
An object containing the schemata for the bundles of a farmOS entity, with the bundle name as key and its corresponding schema as its value.
ModelEntityMethods : Object
The methods for writing to local copies of farmOS data structures, such as assets, logs, etc.
Kind: global typedef
Properties
| Name | Type | 
|---|---|
| create | createEntity | 
| update | updateEntity | 
| merge | mergeEntity | 
FarmModel : Object
A collection of functions for working with farmOS data structures, their associated metadata and schemata.
Kind: global typedef
Properties
| Name | Type | 
|---|---|
| schema | Object | 
| schema.get | function | 
| schema.set | function | 
| schema.on | function | 
| meta | Object | 
| meta.isUnsynced | function | 
| asset | ModelEntityMethods | 
| file | ModelEntityMethods | 
| log | ModelEntityMethods | 
| plan | ModelEntityMethods | 
| quantity | ModelEntityMethods | 
| term | ModelEntityMethods | 
| user | ModelEntityMethods | 
EntityConfig : EntityConfig
model ⇒ FarmModel
Create a farm model for generating and manipulating farmOS data structures.
Kind: global typedef
| Param | Type | 
|---|---|
| options | Object | 
Properties
| Name | Type | Default | 
|---|---|---|
| [options.schemata] | EntitySchemata | 
|
| [options.entities] | Object.<String, EntityConfig> | 
defaultEntities | 
model~getSchemata(...args) ⇒ EntitySchemata | BundleSchemata | JsonSchemaDereferenced
Retrieve all schemata that have been previously set, or the schemata of a particular entity, or one bundle's schema, if specified.
Kind: inner method of model
| Param | Type | 
|---|---|
| ...args | String | 
model~setSchemata(...args)
Load all schemata, the schemata of a particular entity, or one bundle's schema, if specified.
Kind: inner method of model
Void:
| Param | Type | 
|---|---|
| ...args | String | EntitySchemata | BundleSchemata | JsonSchema | 
ClientEntityMethods : Object
The methods for transmitting farmOS data structures, such as assets, logs, etc, to a farmOS server.
Kind: global typedef
Properties
| Name | Type | 
|---|---|
| fetch | fetchEntity | 
| send | sendEntity | 
| delete | deleteEntity | 
FetchSchema ⇒ Promise.<(EntitySchemata|BundleSchemata|JsonSchema)>
Fetch JSON Schema documents for farmOS data structures.
Kind: global typedef
| Param | Type | Description | 
|---|---|---|
| [entity] | string | 
The farmOS entity for which you wish to retrieve schemata. | 
| [bundle] | string | 
The entity bundle for which you wish to retrieve schemata. | 
AuthMixin ⇒ Object.<string, function()>
Kind: global typedef
| Param | Type | 
|---|---|
| request | module:axios~AxiosInstance | 
| authOptions | Object | 
Properties
| Name | Type | 
|---|---|
| authOptions.host | String | 
FarmClient : Object
A collection of functions for transmitting farmOS data structures to and from a farmOS Drupal 9 server using JSON:API.
Kind: global typedef
Properties
| Name | Type | 
|---|---|
| request | module:axios~AxiosInstance | 
| [authorize] | function | 
| [getToken] | function | 
| info | function | 
| schema | Object | 
| schema.fetch | FetchSchema | 
| asset | ClientEntityMethods | 
| file | ClientEntityMethods | 
| log | ClientEntityMethods | 
| plan | ClientEntityMethods | 
| quantity | ClientEntityMethods | 
| term | ClientEntityMethods | 
| user | ClientEntityMethods | 
EntityConfig : EntityConfig
client ⇒ FarmClient
Create a farm client for interacting with farmOS servers.
Kind: global typedef
| Param | Type | 
|---|---|
| host | String | 
| [options] | Object | 
Properties
| Name | Type | Default | 
|---|---|---|
| [options.auth] | AuthMixin | 
oauth | 
| [options.entities] | Object.<String, EntityConfig> | 
defaultEntities | 
| [options.clientId] | String | 
|
| [options.getToken] | function | 
|
| [options.setToken] | function | 
EntityReference : Object
Kind: global typedef
Properties
| Name | Type | Description | 
|---|---|---|
| id | String | 
A v4 UUID as specified by RFC 4122. | 
| type | String | 
Corresponding to the entity bundle (eg, 'activity'). | 
Entity : Object
Kind: global typedef
Properties
| Name | Type | Description | 
|---|---|---|
| id | String | 
A v4 UUID as specified by RFC 4122. | 
| type | String | 
The combined form of entity & bundle (eg, 'log--activity'). | 
| attributes | Object | 
Values directly attributable to this entity. | 
| relationships | Object.<String, (EntityReference|Array.<EntityReference>)> | 
References to other entities that define a one-to-one or one-to-many relationship. | 
| meta | Object | 
Non-domain information associated with the creation, modification, storage and transmission of the entity. | 
| meta.created | String | 
An ISO 8601 date-time string indicating when the entity was first created, either locally or remotely. | 
| meta.changed | String | 
An ISO 8601 date-time string indicating when the entity was last changed, either locally or remotely. | 
| meta.remote | Object | 
|
| meta.fieldChanges | Object | 
|
| meta.conflicts | Array | 
EntityConfig : Object
Kind: global typedef
Properties
| Name | Type | 
|---|---|
| nomenclature | Object | 
| nomenclature.name | Object | 
| nomenclature.shortName | Object | 
| nomenclature.plural | Object | 
| nomenclature.shortPlural | Object | 
| nomenclature.display | Object | 
| nomenclature.displayPlural | Object | 
| defaultOptions | Object | 
| defaultOptions.byType | Object | 
| defaultOptions.byFormat | Object | 
DefaultEntities : Object.<String, EntityConfig>
Kind: global typedef
Properties
| Name | Type | 
|---|---|
| asset | EntityConfig | 
| file | EntityConfig | 
| log | EntityConfig | 
| plan | EntityConfig | 
| quantity | EntityConfig | 
| taxonomy_term | EntityConfig | 
| user | EntityConfig |