carbond.collections.Collection
extends Endpoint
Provides a high-level abstraction for defining Endpoints that behave like a RESTful collection of resources
Static Properties
-
ALL_METHODS |
Object
|
Required |
|
Description |
A list of all HTTP methods recognized by carbond |
Instance Properties
-
ALL_COLLECTION_OPERATIONS |
array
(read-only)
|
Description |
The list of valid collection operations |
-
allowUnauthenticated |
string[]
|
Required |
|
Description |
Skip authentication for the HTTP methods listed on this endpoint |
-
defaultErrorSchema |
Object
(read-only)
|
Description |
This is the default error body schema. |
defaultIdHeaderName |
string
(read-only)
|
Description |
The default ID header name |
-
defaultIdParameter |
string
(read-only)
|
Description |
The default ID name of objects in this collection |
-
defaultIdPathParameter |
string
(read-only)
|
Description |
The default path parameter name representing the ID for an object in this collection |
-
defaultSchema |
Object
(read-only)
|
Description |
This is the default schema used to validate all objects in this collection. If a schema is not specified explicitly, this schema will be used. |
-
description |
string
|
Default |
undefined |
Description |
A brief description of what this endpoint does. This will be displayed in any generated documentation. |
-
enabled |
Object
|
Default |
{'*': false} |
Description |
Control which collection level operations |
-
endpoints |
Object.<string, carbond.Endpoint>
|
Required |
|
Description |
The endpoints that sit below this endpoint in the tree. URL paths to each endpoint are built during a depth first traversal of the tree on initialization using the property names defined on this Object. |
-
example |
Object
|
Default |
undefined |
Description |
An example object for this collection |
-
findConfig |
Object
|
Default |
o({}, carbond.collections.FindConfigClass) |
Description |
The config used to govern the behavior of the find operation |
-
FindConfigClass |
(read-only)
|
Description |
The config class used to instantiate the find operation config |
-
findObjectConfig |
Object
|
Default |
o({}, carbond.collections.FindObjectConfigClass) |
Description |
The config used to govern the behavior of the findObject operation |
-
FindObjectConfigClass |
(read-only)
|
Description |
The config class used to instantiate the findObject operation config |
-
idGenerator |
Object
|
Default |
undefined |
Description |
An object with the method “generateId” that will be called to populate ID if present and when appropriate (e.g. insert ) |
idHeaderName |
string
|
Default |
defaultIdHeaderName |
Description |
The header name which should contain the EJSON serialized ID |
-
idParameterName |
string
|
Default |
defaultIdParameter |
Description |
The ID parameter name (XXX: rename to “objectIdName” since this is not a “parameter” name?) |
-
idPathParameterName |
string
|
Default |
defaultIdParameter |
Description |
The PATH_ID parameter name (e.g., /collection/:PATH_ID) |
-
insertConfig |
Object
|
Default |
o({}, carbond.collections.InsertConfigClass) |
Description |
The config used to govern the behavior of the insert operation |
-
InsertConfigClass |
(read-only)
|
Description |
The config class used to instantiate the insert operation config |
-
insertObjectConfig |
Object
|
Default |
o({}, carbond.collections.InsertObjectConfigClass) |
Description |
The config used to govern the behavior of the insertObject operation |
-
InsertObjectConfigClass |
(read-only)
|
Description |
The config class used to instantiate the insertObject operation config |
-
noDocument |
boolean
|
Default |
false |
Description |
Controls whether documentation for this endpoint is included in generated static documentation |
-
parameters |
Object.<string, carbond.OperationParameter>
|
Required |
|
Description |
Operation parameter definitions that apply to all operations supported by this endpoint. Note, these will be merged with any parameter definitions on the operations themselves and their parsed values will be passed to the handler via req.parameters[<parameter name>] . |
-
parent |
(read-only)
|
Description |
The parent endpoint for this endpoint in the endpoint tree |
-
path |
string
(read-only)
|
Description |
The URI path that routes to this endpoint. This is built during service initialization and will overwrite any value specified on instantiation. |
-
removeConfig |
Object
|
Default |
o({}, carbond.collections.RemoveConfigClass) |
Description |
The config used to govern the behavior of the remove operation |
-
RemoveConfigClass |
(read-only)
|
Description |
The config class used to instantiate the remove operation config |
-
removeObjectConfig |
Object
|
Default |
o({}, carbond.collections.RemoveObjectConfigClass) |
Description |
The config used to govern the behavior of the removeObject operation |
-
RemoveObjectConfigClass |
(read-only)
|
Description |
The config class used to instantiate the removeObject operation config |
-
saveConfig |
Object
|
Default |
o({}, carbond.collections.SaveConfigClass) |
Description |
The config used to govern the behavior of the save operation |
-
SaveConfigClass |
(read-only)
|
Description |
The config class used to instantiate the save operation config |
-
saveObjectConfig |
Object
|
Default |
o({}, carbond.collections.SaveObjectConfigClass) |
Description |
The config used to govern the behavior of the saveObject operation |
-
SaveObjectConfigClass |
(read-only)
|
Description |
The config class used to instantiate the saveObject operation config |
-
schema |
Object
|
Default |
defaultSchema |
Description |
The schema used to validate objects in this collection |
-
service |
(read-only)
|
Deprecated |
|
Description |
The root service object managing the endpoint tree. Getting a reference to this object is sometimes necessary or just convenient (i.e., HTTP error classes can be accessed via errors ). |
-
supportsFind |
boolean
|
Required |
|
Description |
Whether or not the find operation is supported |
-
supportsFindObject |
boolean
|
Required |
|
Description |
Whether or not the findObject operation is supported |
-
supportsInsert |
boolean
|
Required |
|
Description |
Whether or not the insert operation is supported |
-
supportsInsertObject |
boolean
|
Required |
|
Description |
Whether or not the insertObject operation is supported |
-
supportsRemove |
boolean
|
Required |
|
Description |
Whether or not the remove operation is supported |
-
supportsRemoveObject |
boolean
|
Required |
|
Description |
Whether or not the removeObject operation is supported |
-
supportsSave |
boolean
|
Required |
|
Description |
Whether or not the save operation is supported |
-
supportsSaveObject |
boolean
|
Required |
|
Description |
Whether or not the saveObject operation is supported |
-
supportsUpdate |
boolean
|
Required |
|
Description |
Whether or not the update operation is supported |
-
supportsUpdateObject |
boolean
|
Required |
|
Description |
Whether or not the updateObject operation is supported |
-
updateConfig |
Object
|
Default |
o({}, carbond.collections.UpdateConfigClass) |
Description |
The config used to govern the behavior of the update operation |
-
UpdateConfigClass |
(read-only)
|
Description |
The config class used to instantiate the update operation config |
-
updateObjectConfig |
Object
|
Default |
o({}, carbond.collections.UpdateObjectConfigClass) |
Description |
The config used to govern the behavior of the updateObject operation |
-
UpdateObjectConfigClass |
(read-only)
|
Description |
The config class used to instantiate the updateObject operation config |
-
validateOutput |
boolean
|
Default |
true |
Description |
Controls whether or not response bodies are validated using the response schema corresponding to the current response code |
Abstract Methods
-
find |
|
Arguments |
- options (Object) – The operation parameters (see:
FindConfigClass )
- context (Object) – A free form object to pass data between hook and handler methods
|
Throws |
CollectionError |
Returns |
A list of objects |
Return type |
Object[] |
Description |
Retrieve objects from a collection |
-
findObject |
|
Arguments |
- id (string) – The object id
- options (Object) – The operation parameters (see:
FindObjectConfigClass )
- context (Object) – A free form object to pass data between hook and handler methods
|
Throws |
CollectionError |
Returns |
The found object or null |
Return type |
Object | null |
Description |
Retrieve a single object from a collection |
-
insert |
|
Arguments |
- objects (Array) – An array of objects to insert
- options (Object) – The operation parameters (see:
InsertConfigClass )
- context (Object) – A free form object to pass data between hook and handler methods
|
Throws |
CollectionError |
Returns |
The list of inserted objects |
Return type |
Object[] |
Description |
Bulk insert objects into a collection |
-
insertObject |
|
Arguments |
- object (Object) – An object to insert
- options (Object) – The operation parameters (see:
InsertObjectConfigClass )
- context (Object) – A free form object to pass data between hook and handler methods
|
Throws |
CollectionError |
Returns |
The inserted object |
Return type |
Object |
Description |
Insert a single object into a collection |
-
remove |
|
Arguments |
- options (Object) – The operation parameters (see:
RemoveConfigClass )
- context (Object) – A free form object to pass data between hook and handler methods
|
Throws |
CollectionError |
Returns |
An integer representing the number of objects removed or an array of the objects removed |
Return type |
number | array |
Description |
Remove objects from a collection |
-
removeObject |
|
Arguments |
- id (String) – The ID of the object to remove
- options (Object) – The operation parameters (see:
RemoveConfigClass )
- context (Object) – A free form object to pass data between hook and handler methods
|
Throws |
CollectionError |
Returns |
An integer representing the number of objects removed (0 or 1) or the the object removed |
Return type |
number | Object |
Description |
Remove a specific object from a collection |
-
save |
|
Arguments |
- objects (Array) – An array of objects (with IDs) to save
- options (Object) – The operation parameters (see:
SaveConfigClass )
- context (Object) – A free form object to pass data between hook and handler methods
|
Throws |
CollectionError |
Returns |
The list of saved objects |
Return type |
Object[] |
Description |
Replace the collection with an array of objects |
-
saveObject |
|
Arguments |
- object (Object) – The object to save (with ID)
- options (Object) – The operation parameters (see:
SaveObjectConfigClass )
- context (Object) – A free form object to pass data between hook and handler methods
|
Throws |
CollectionError |
Return type |
SaveObjectResult |
Description |
Replace or insert an object with a known ID |
-
update |
|
Arguments |
- update (*) – The update to be applied to the collection
- options (Object) – The operation parameters (see:
UpdateConfigClass )
- context (Object) – A free form object to pass data between hook and handler methods
|
Throws |
CollectionError |
Return type |
UpdateResult |
Description |
Update (or upsert) a number of objects in a collection |
-
updateObject |
|
Arguments |
- id (string) – The ID of the object to update
- update (*) – The update to be applied to the collection
- options (Object) – The operation parameters (see:
UpdateObjectConfigClass )
- context (Object) – A free form object to pass data between hook and handler methods
|
Throws |
CollectionError |
Return type |
UpdateObjectResult |
Description |
Update a specific object |
Methods
-
configureFindObjectOperation |
|
Return type |
ConfigureOperationResult |
Description |
Update the operation config using collection level config (e.g., schema ) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods. |
-
configureFindOperation |
|
Return type |
ConfigureOperationResult |
Description |
Update the operation config using collection level config (e.g., schema ) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods. |
-
configureInsertObjectOperation |
|
Return type |
ConfigureOperationResult |
Description |
Update the operation config using collection level config (e.g., schema ) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods. |
-
configureInsertOperation |
|
Return type |
ConfigureOperationResult |
Description |
Update the operation config using collection level config (e.g., schema ) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods. |
-
configureRemoveObjectOperation |
|
Return type |
ConfigureOperationResult |
Description |
Update the operation config using collection level config (e.g., schema ) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods. |
-
configureRemoveOperation |
|
Return type |
ConfigureOperationResult |
Description |
Update the operation config using collection level config (e.g., schema ) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods. |
-
configureSaveObjectOperation |
|
Return type |
ConfigureOperationResult |
Description |
Update the operation config using collection level config (e.g., schema ) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods. |
-
configureSaveOperation |
|
Return type |
ConfigureOperationResult |
Description |
Update the operation config using collection level config (e.g., schema ) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods. |
-
configureUpdateObjectOperation |
|
Return type |
ConfigureOperationResult |
Description |
Update the operation config using collection level config (e.g., schema ) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods. |
-
configureUpdateOperation |
|
Return type |
ConfigureOperationResult |
Description |
Update the operation config using collection level config (e.g., schema ) and build operation responses. In general, this method should not need to be overridden or extended. Instead, customization should be driven by the operation config and the pre/post handler methods. |
-
getOperation |
|
Arguments |
- method (string) – The HTTP method corresponding to the operation to retrieve
|
Return type |
Operation |
Description |
Retrieves the operation instance corresponding to the passed HTTP method |
-
getOperationConfig |
|
Arguments |
- op (string) – The operation name (e.g., “insert”)
|
Return type |
CollectionOperationConfig |
Description |
Get the config for an operation by name |
-
getOperationConfigFieldName |
|
Arguments |
- op (string) – The operation name (e.g., “insert”)
|
Return type |
string |
Description |
Get the property name for an operation config by name |
-
getService |
|
Return type |
Service |
Description |
Returns the root Service instance (note, this is preferred over accessing the service property itself) |
-
isOperationAuthorized |
|
Arguments |
- method (string) – The HTTP method corresponding to the operation that we are attempting to authorize
- user (Object) – The user object
- req (
Request ) – The request object
|
Returns |
Whether of not the operation is authorized |
Return type |
boolean |
Description |
Tests whether an operation is authorized given a user (as returned by the root authenticator) and any Acl that may apply to this endpoint |
-
operations |
|
Return type |
Operation[] |
Description |
Gathers all operations defined on this endpoint |
-
options |
|
Arguments |
|
Return type |
undefined |
Description |
Implements the OPTIONS method handler |
-
postFind |
|
Arguments |
- result (Object[]) – The found object(s)
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
Object[] |
Description |
Update or transform the operation result before passing it back up to the HTTP layer |
-
postFindObject |
|
Arguments |
- result (Object | null) – The found object
- id (string) – The object id
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
Object | null |
Description |
Update or transform the operation result before passing it back up to the HTTP layer |
-
postFindObjectOperation |
|
Arguments |
- result (Object | null) – The found object
- config (
findObjectConfig ) – The find object operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Returns |
Returns the found object |
Return type |
Object | null |
Description |
Update the HTTP response to reflect the result of the operation |
-
postFindOperation |
|
Arguments |
- result (Object[]) – The found objects
- config (
findConfig ) – The find operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Returns |
Returns the found objects |
Return type |
Object[] |
Description |
Update the HTTP response to reflect the result of the operation |
-
postInsert |
|
Arguments |
- result (Object[]) – The inserted object(s)
- objects (Object[]) – The object(s) to insert
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
Object[] |
Description |
Update or transform the operation result before passing it back up to the HTTP layer |
-
postInsertObject |
|
Arguments |
- result (Object) – The inserted object
- object (Object) – The object to insert
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
Object |
Description |
Update or transform the operation result before passing it back up to the HTTP layer |
-
postInsertObjectOperation |
|
Arguments |
- result (Object) – The inserted object
- config (
InsertObjectConfigClass ) – The insert object operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Returns |
Returns the inserted object if configured to do so and null otherwise |
Return type |
Object | null |
Description |
Update the HTTP response to reflect the result of the operation |
-
postInsertOperation |
|
Arguments |
- result (Object[]) – The inserted objects
- config (
InsertConfigClass ) – The insert operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Returns |
Returns the inserted objects if configured to do so and null otherwise |
Return type |
Object[] | null |
Description |
Update the HTTP response to reflect the result of the operation |
-
postRemove |
|
Arguments |
- result (number | array) – The number of objects (or the object(s) themselves) removed
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
number | array |
Description |
Update or transform the operation result before passing it back up to the HTTP layer |
-
postRemoveObject |
|
Arguments |
- result (number | Object) – The number of objects (or the object itself) removed
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
number | array |
Description |
Update or transform the operation result before passing it back up to the HTTP layer |
-
postRemoveObjectOperation |
|
Arguments |
- result (number | Object) – The number of objects removed or the removed object
- config (
RemoveObjectConfigClass ) – The remove object operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Returns |
Returns undefined} or the removed object |
Return type |
Object |
Description |
Update the HTTP response to reflect the result of the operation. It should be noted that the result can be either a number or an object. If the underlying driver does not support returning the removed object, then the result will always be a number and returnsRemovedObject should be configured to reflect this. |
-
postRemoveOperation |
|
Arguments |
- result (number | array) – The number of objects removed or the removed objec(s)
- config (
RemoveConfigClass ) – The remove operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Returns |
Returns undefined} or the removed objects |
Return type |
Object |
Description |
Update the HTTP response to reflect the result of the operation. It should be noted that the result can be either a number or an array of object(s). If the underlying driver does not support returning the removed object(s), then the result will always be a number and returnsRemovedObjects should be configured to reflect this. |
-
postSave |
|
Arguments |
- result (Object[]) – The saved objects
- objects (Object[]) – The objects to save
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
Object[] |
Description |
Update or transform the operation result before passing it back up to the HTTP layer |
-
postSaveObject |
|
Arguments |
- result (SaveObjectResult) – The
SaveObjectResult
- object (Object) – The object to save
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
SaveObjectResult |
Description |
Update or transform the operation result before passing it back up to the HTTP layer |
-
postSaveObjectOperation |
|
Arguments |
- result (SaveObjectResult) – The saved object and a flag to indicate if it was created rather than replaced
- config (
SaveObjectConfigClass ) – The save object operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Returns |
Returns the saved object if configured to do so and null if not |
Return type |
Object[] | null |
Description |
Update the HTTP response to reflect the result of the operation |
-
postSaveOperation |
|
Arguments |
- result (Object[]) – The saved objects
- config (
saveConfig ) – The save operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Returns |
Returns the saved objects if configured to do so and null if not |
Return type |
Object[] | null |
Description |
Update the HTTP response to reflect the result of the operation |
-
postUpdate |
|
Arguments |
- result (UpdateResult) – The
UpdateResult
- update (*) – The update spec
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
UpdateResult |
Description |
Update or transform the operation result before passing it back up to the HTTP layer |
-
postUpdateObject |
|
Arguments |
- result (UpdateResult) – The
UpdateResult
- update (*) – The update spec
- update – The update spec
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
UpdateResult |
Description |
Update or transform the operation result before passing it back up to the HTTP layer |
-
postUpdateObjectOperation |
|
Arguments |
- result (UpdateObjectResult) – The number of objects updated/upserted or the upserted object
- config (
UpdateObjectConfigClass ) – The update object operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Returns |
Returns undefined} or the upserted object |
Return type |
Object |
Description |
Update the HTTP response to reflect the result of the operation. It should be noted that the result can be either a number or an object. If the underlying driver does not support returning the upserted object, then the result will always be a number and returnsUpsertedObject should be configured to reflect this. |
-
postUpdateOperation |
|
Arguments |
- result (UpdateResult) – The number of objects updated/upserted or the upserted object(s)
- config (
UpdateConfigClass ) – The update operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Returns |
Returns undefined} or the upserted object(s) |
Return type |
Object |
Description |
Update the HTTP response to reflect the result of the operation. It should be noted that the result can be either a number or an array of objects. If the underlying driver does not support returning the upserted object(s), then the result will always be a number and returnsUpsertedObjects should be configured to reflect this. |
-
preFind |
|
Arguments |
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreFindResult | undefined |
Description |
Update or transform any parameters to be passed to the operation handler |
-
preFindObject |
|
Arguments |
- id (string) – The object id
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreFindObjectResult | undefined |
Description |
Update or transform any parameters to be passed to the operation handler |
-
preFindObjectOperation |
|
Arguments |
- config (
FindObjectConfig ) – The find object operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreOperationResult |
Description |
Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended. |
-
preFindOperation |
|
Arguments |
- config (
FindConfig ) – The find operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreOperationResult |
Description |
Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended. |
-
preInsert |
|
Arguments |
- objects (Object[]) – The objects to insert
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreInsertResult | undefined |
Description |
Update or transform any parameters to be passed to the operation handler |
-
preInsertObject |
|
Arguments |
- object (Object) – The object to insert
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreInsertObjectResult | undefined |
Description |
Update or transform any parameters to be passed to the operation handler |
-
preInsertObjectOperation |
|
Arguments |
- config (
InsertObjectConfig ) – The insert object operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreOperationResult |
Description |
Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended. |
-
preInsertOperation |
|
Arguments |
- config (
InsertConfig ) – The insert operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreOperationResult |
Description |
Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended. |
-
preRemove |
|
Arguments |
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreRemoveResult | undefined |
Description |
Update or transform any parameters to be passed to the operation handler |
-
preRemoveObject |
|
Arguments |
- id (string) – The object id
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreRemoveObjectResult | undefined |
Description |
Update or transform any parameters to be passed to the operation handler |
-
preRemoveObjectOperation |
|
Arguments |
- config (
RemoveObjectConfig ) – The remove object operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreOperationResult |
Description |
Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended. |
-
preRemoveOperation |
|
Arguments |
- config (
RemoveConfig ) – The remove operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreOperationResult |
Description |
Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended. |
-
preSave |
|
Arguments |
- objects (Object[]) – The objects to save
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreSaveResult | undefined |
Description |
Update or transform any parameters to be passed to the operation handler |
-
preSaveObject |
|
Arguments |
- object (Object) – The object to save
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreSaveObjectResult | undefined |
Description |
Update or transform any parameters to be passed to the operation handler |
-
preSaveObjectOperation |
|
Arguments |
- config (
SaveObjectConfig ) – The save object operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreOperationResult |
Description |
Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended. |
-
preSaveOperation |
|
Arguments |
- config (
SaveConfig ) – The save operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreOperationResult |
Description |
Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended. |
-
preUpdate |
|
Arguments |
- update (*) – The update spec
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreUpdateResult | undefined |
Description |
Update or transform any parameters to be passed to the operation handler |
-
preUpdateObject |
|
Arguments |
- id (string) – The object id
- update (*) – The update spec
- options (Object) – The operation handler options
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreUpdateObjectResult | undefined |
Description |
Update or transform any parameters to be passed to the operation handler |
-
preUpdateObjectOperation |
|
Arguments |
- config (
UpdateObjectConfig ) – The update object operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreOperationResult |
Description |
Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended. |
-
preUpdateOperation |
|
Arguments |
- config (
UpdateConfig ) – The update operation config
- req (
Request ) – The request object
- res (
Response ) – The response object
- context (Object) – A free form object to pass data between hook and handler methods
|
Return type |
PreOperationResult |
Description |
Build the options to be passed to the operation handler from the request and operation config. Note, in general, this should not need to be overridden or extended. |
-
supportedMethods |
|
Return type |
string[] |
Description |
Returns a list of HTTP methods supported by this endpoint |
Typedef: ConfigureOperationResult
Properties
-
opConfig |
|
Required |
|
Description |
The operation config |
-
defaultResponses |
OperationResponse[] | Object[]
|
Required |
|
Description |
A list of default responses (raw Objects will be converted to instances of OperationResponse ) |
Typedef: PreFindObjectResult
Properties
-
id |
string
|
Default |
undefined |
Description |
The object id |
-
options |
Object
|
Default |
undefined |
Description |
The operation handler options |
Typedef: PreFindResult
Properties
-
options |
Object
|
Default |
undefined |
Description |
The operation handler options |
Typedef: PreInsertObjectResult
Properties
-
object |
Object
|
Default |
undefined |
Description |
The object to insert |
-
options |
Object
|
Default |
undefined |
Description |
The operation handler options |
Typedef: PreInsertResult
Properties
-
objects |
Object[]
|
Default |
undefined |
Description |
The objects to insert |
-
options |
Object
|
Default |
undefined |
Description |
The operation handler options |
Typedef: PreOperationResult
Properties
-
options |
Object
|
Required |
|
Description |
A map of parameters to be passed to the operation handler. Note, this is generally just req.parameters . |
Typedef: PreRemoveObjectResult
Properties
-
id |
string
|
Default |
undefined |
Description |
The object id |
-
options |
Object
|
Default |
undefined |
Description |
The operation handler options |
Typedef: PreRemoveResult
Properties
-
options |
Object
|
Default |
undefined |
Description |
The operation handler options |
Typedef: PreSaveObjectResult
Properties
-
object |
Object
|
Default |
undefined |
Description |
The object to save |
-
options |
Object
|
Default |
undefined |
Description |
The operation handler options |
Typedef: PreSaveResult
Properties
-
objects |
Object[]
|
Default |
undefined |
Description |
The objects to save |
-
options |
Object
|
Default |
undefined |
Description |
The operation handler options |
Typedef: PreUpdateObjectResult
Properties
-
id |
string
|
Default |
undefined |
Description |
The object id |
-
update |
*
|
Default |
undefined |
Description |
The update spec |
-
options |
Object
|
Default |
undefined |
Description |
The operation handler options |
Typedef: PreUpdateResult
Properties
-
update |
*
|
Default |
undefined |
Description |
The update spec |
-
options |
Object
|
Default |
undefined |
Description |
The operation handler options |
Typedef: SaveObjectResult
Properties
-
val |
Object
|
Required |
|
Description |
The saved object |
-
created |
boolean
|
Required |
|
Description |
A flag indicating whether the object was created or replaced |
Typedef: UpdateObjectResult
Properties
-
val |
number | Object
|
Required |
|
Description |
The number of objects updated if no upsert took place, the number of objects upserted if configured not to return upserted objects, or the upserted object(s) if configured to return the upserted object(s) (see: UpdateObjectConfigClass ) |
-
created |
boolean
|
Required |
|
Description |
A flag indicating whether an upsert took place |
Typedef: UpdateResult
Properties
-
val |
number | Object
|
Required |
|
Description |
The number of objects updated if no upsert took place, the number of objects upserted if configured not to return upserted objects, or the upserted object(s) if configured to return the upserted object(s) (see: UpdateConfigClass ) |
-
created |
boolean
|
Required |
|
Description |
A flag indicating whether an upsert took place |