Constructor
new DoboAction()
- Source
// method 1:
const action = await model.getRecord() // Important: no parameter passed
const result = action.id('rec-id').noHook().dataOnly(false).run()
// method 2:
const result = await model.action().getRecord('rec-id').noHook().dataOnly(false).run()
// method 3:
const result = await model.action('getRecord').id('rec-id').noHook().dataOnly(false).run()
// method 4:
const result = await model.action('getRecord', 'rec-id').noHook().dataOnly(false).run()
// Instead of chaining options as methods, you can also pass options object as the parameter to the run() method
const result = await model.action('getRecord', 'rec-id').run({ noHook: true, dataOnly: false })Methods
_setArgs(method, args) → {void}
Internal method to set the arguments to the instance properties based on the method name and the arguments passed.
| Name | Type | Description |
|---|---|---|
method | string | The name of the method being called |
args | Array | The arguments passed to the method |
- Source
- Type:
- void
body(value) → {DoboAction}
Set the body for the corresponding record. You need this for createRecord, updateRecord or upsertRecord operations. This method is chainable.
| Name | Type | Description |
|---|---|---|
value | object | The body value to set |
- Source
The current instance for chaining
- Type:
- DoboAction
(async) dispose() → {Promise.<void>}
Dispose the instance and clean up resources.
- Source
- Type:
- Promise.<void>
filter(value) → {DoboAction}
Set the filter for the corresponding record. You optionally need this for findRecord, findOneRecord or findAllRecord operations. This method is chainable.
| Name | Type | Description |
|---|---|---|
value | object | The filter value to set |
- Source
The current instance for chaining
- Type:
- DoboAction
id(value) → {DoboAction}
Set the ID for the corresponding record. You need this for updateRecord or removeRecord operations. This method is chainable.
| Name | Type | Description |
|---|---|---|
value | string | | The ID value to set |
- Source
The current instance for chaining
- Type:
- DoboAction
options(value) → {DoboAction}
Set the options for the corresponding method. This method is chainable.
| Name | Type | Description |
|---|---|---|
value | DoboAction. | The options to set |
- Source
The current instance for chaining
- Type:
- DoboAction
(async) run(value) → {Promise.<*>}
Execute the corresponding method with the set arguments and options. This method is chainable.
| Name | Type | Description |
|---|---|---|
value | DoboAction. | If set, it will override the options set by the |
- Source
The result of the method execution
- Type:
- Promise.<*>
Type Definitions
TMethods
Dobo model's chainable methods. Only the keys listed here are allowed to be called in chainable methods. The values are the only allowed arguments for the corresponding chainable methods.
- Object
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
createRecord | Array.<string> | <optional> | ['body'] | |
updateRecord | Array.<string> | <optional> | ['id', 'body'] | |
upsertRecord | Array.<string> | <optional> | ['body'] | |
removeRecord | Array.<string> | <optional> | ['id'] | |
getRecord | Array.<string> | <optional> | ['id'] | |
findRecord | Array.<string> | <optional> | ['filter'] | |
findOneRecord | Array.<string> | <optional> | ['filter'] | |
findAllRecord | Array.<string> | <optional> | ['filter'] | |
findAllRecords | Array.<string> | <optional> | ['filter'] | Alias of |
countRecord | Array.<string> | <optional> | ['params'] | |
createAggregate | Array.<string> | <optional> | ['params'] | |
createHistogram | Array.<string> | <optional> | ['params'] | |
createAttachment | Array.<string> | <optional> | ['id'] | |
findAttachment | Array.<string> | <optional> | ['id'] | |
getAttachment | Array.<string> | <optional> | ['id', 'field', 'file'] | |
listAttachment | Array.<string> | <optional> | ['params'] | |
removeAttachment | Array.<string> | <optional> | ['id', 'field', 'file'] | |
updateAttachment | Array.<string> | <optional> | ['id'] |
- Source
TOptions
Allowed options for Dobo model's chainable methods. Only the keys listed here are allowed to be called in chainable methods. The values are the default values for the corresponding options.
- Object
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
truncateString | boolean | <optional> | true | |
noResult | boolean | <optional> | false | |
noBodySanitizer | boolean | <optional> | false | |
noResultSanitizer | boolean | <optional> | false | |
noValidation | boolean | <optional> | false | |
dataOnly | boolean | <optional> | true | |
noHook | boolean | <optional> | false | |
noModelHook | boolean | <optional> | false | |
noDynHook | boolean | <optional> | false | |
extFields | Array | <optional> | [] | |
fields | Array | <optional> | [] | |
noFlash | boolean | <optional> | false | |
hidden | Array | <optional> | [] | |
refs | Array | <optional> | [] | |
types | Array | <optional> | [] | |
type | string | | <optional> | ||
group | string | | <optional> | ||
aggregates | Array | <optional> | [] | |
field | string | | <optional> | ||
queryHandler | string | | <optional> | ||
count | boolean | <optional> | true | |
noCache | boolean | <optional> | true | |
partial | boolean | <optional> | true | |
mimeType | boolean | <optional> | true | |
fullPath | boolean | <optional> | true | |
stats | boolean | <optional> | true | |
dirOnly | boolean | <optional> | true | |
setField | string | | <optional> | ||
setFile | string | | <optional> | ||
source | string | | <optional> | ||
uriEncoded | boolean | <optional> | true |
- Source