directus-monorepo ( Readme | API )
directus-monorepo > PayloadService
Process a given payload for a collection to ensure the special fields (hash, uuid, date etc) are handled correctly.
new PayloadService(
collection,options):PayloadService
| Parameter | Type |
|---|---|
collection |
string |
options |
AbstractServiceOptions |
api/src/services/payload.ts:49
accountability:
any
api/src/services/payload.ts:43
collection:
string
api/src/services/payload.ts:46
helpers:
object
date:
DateHelperMySQL|DateHelperDefault|DateHelperSQLite|DateHelperOracle|DateHelperMSSQLschema:
SchemaHelperMySQL|SchemaHelperDefault|SchemaHelperCockroachDb|SchemaHelperSQLite|SchemaHelperOracle|SchemaHelperMSSQLsequence:
AutoIncrementHelperDefault|AutoIncrementHelperPostgresst:
GeometryHelperMySQL|GeometryHelperPostgres|GeometryHelperSQLite|GeometryHelperOracle|GeometryHelperMSSQL|GeometryHelperRedshift
api/src/services/payload.ts:45
knex:
Knex<any,any[] >
api/src/services/payload.ts:44
schema:
SchemaOverview
api/src/services/payload.ts:47
transformers:
Transformers
api/src/services/payload.ts:59
prepareDelta(
data):Promise<null|string>
Transforms the input partial payload to match the output structure, to have consistency between delta and data
| Parameter | Type |
|---|---|
data |
Partial< Item > |
Promise< null | string >
api/src/services/payload.ts:817
processA2O(
data,opts?):Promise< {nestedActionEvents:ActionEventParams[];payload:Partial<Item>;revisions:PrimaryKey[];} >
Recursively save/update all nested related Any-to-One items
| Parameter | Type |
|---|---|
data |
Partial< Item > |
opts? |
MutationOptions |
Promise< {nestedActionEvents: ActionEventParams[]; payload: Partial< Item >; revisions:
PrimaryKey[];} >
api/src/services/payload.ts:384
processAggregates(
payload):void
| Parameter | Type |
|---|---|
payload |
Partial< Item >[] |
void
api/src/services/payload.ts:208
processDates(
payloads,action):Partial<Record<string,any> >[]
Knex returns datetime and date columns as Date.. This is wrong for date / datetime, as those shouldn't return with
time / timezone info respectively
| Parameter | Type |
|---|---|
payloads |
Partial< Record< string, any > >[] |
action |
Action |
Partial< Record< string, any > >[]
api/src/services/payload.ts:276
processField(
field,payload,action,accountability):Promise<any>
| Parameter | Type |
|---|---|
field |
SchemaOverview |
payload |
Partial< Item > |
action |
Action |
accountability |
any |
Promise< any >
api/src/services/payload.ts:219
processGeometries<
T>(payloads,action):T
Native geometries are stored in custom binary format. We need to insert them with the function st_geomfromtext. For this to work, that function call must not be escaped. It's therefore placed as a Knex.Raw object in the payload. Thus the need to check if the value is a raw instance before stringifying it in the next step.
| Parameter |
|---|
T extends Partial< Record< string, any > >[] |
| Parameter | Type |
|---|---|
payloads |
T |
action |
Action |
T
api/src/services/payload.ts:252
processM2O(
data,opts?):Promise< {nestedActionEvents:ActionEventParams[];payload:Partial<Item>;revisions:PrimaryKey[];} >
Save/update all nested related m2o items inside the payload
| Parameter | Type |
|---|---|
data |
Partial< Item > |
opts? |
MutationOptions |
Promise< {nestedActionEvents: ActionEventParams[]; payload: Partial< Item >; revisions:
PrimaryKey[];} >
api/src/services/payload.ts:478
processO2M(
data,parent,opts?):Promise< {nestedActionEvents:ActionEventParams[];revisions:PrimaryKey[];} >
Recursively save/update all nested related o2m items
| Parameter | Type |
|---|---|
data |
Partial< Item > |
parent |
PrimaryKey |
opts? |
MutationOptions |
Promise< {nestedActionEvents: ActionEventParams[]; revisions: PrimaryKey[];} >
api/src/services/payload.ts:559
processValues(
action,payloads):Promise<Partial<Item>[] >
| Parameter | Type |
|---|---|
action |
Action |
payloads |
Partial< Item >[] |
Promise< Partial< Item >[] >
api/src/services/payload.ts:149
processValues(
action,payload):Promise<Partial<Item> >
| Parameter | Type |
|---|---|
action |
Action |
payload |
Partial< Item > |
Promise< Partial< Item > >
api/src/services/payload.ts:150
Generated using TypeDoc and typedoc-plugin-markdown