Skip to content

Latest commit

 

History

History
348 lines (205 loc) · 8.57 KB

class.PayloadService.md

File metadata and controls

348 lines (205 loc) · 8.57 KB

directus-monorepo ( Readme | API )


directus-monorepo > PayloadService

Class: PayloadService

Process a given payload for a collection to ensure the special fields (hash, uuid, date etc) are handled correctly.

Constructors

constructor()

new PayloadService(collection, options): PayloadService

Parameters

Parameter Type
collection string
options AbstractServiceOptions

Returns

PayloadService

Source

api/src/services/payload.ts:49

Properties

accountability

accountability: any

Source

api/src/services/payload.ts:43


collection

collection: string

Source

api/src/services/payload.ts:46


helpers

helpers: object

Type declaration

helpers.date

date: DateHelperMySQL | DateHelperDefault | DateHelperSQLite | DateHelperOracle | DateHelperMSSQL

helpers.schema

schema: SchemaHelperMySQL | SchemaHelperDefault | SchemaHelperCockroachDb | SchemaHelperSQLite | SchemaHelperOracle | SchemaHelperMSSQL

helpers.sequence

sequence: AutoIncrementHelperDefault | AutoIncrementHelperPostgres

helpers.st

st: GeometryHelperMySQL | GeometryHelperPostgres | GeometryHelperSQLite | GeometryHelperOracle | GeometryHelperMSSQL | GeometryHelperRedshift

Source

api/src/services/payload.ts:45


knex

knex: Knex< any, any[] >

Source

api/src/services/payload.ts:44


schema

schema: SchemaOverview

Source

api/src/services/payload.ts:47


transformers

transformers: Transformers

Source

api/src/services/payload.ts:59

Methods

prepareDelta()

prepareDelta(data): Promise< null | string >

Transforms the input partial payload to match the output structure, to have consistency between delta and data

Parameters

Parameter Type
data Partial< Item >

Returns

Promise< null | string >

Source

api/src/services/payload.ts:817


processA2O()

processA2O(data, opts?): Promise< {nestedActionEvents: ActionEventParams[]; payload: Partial< Item >; revisions: PrimaryKey[];} >

Recursively save/update all nested related Any-to-One items

Parameters

Parameter Type
data Partial< Item >
opts? MutationOptions

Returns

Promise< {nestedActionEvents: ActionEventParams[]; payload: Partial< Item >; revisions: PrimaryKey[];} >

Source

api/src/services/payload.ts:384


processAggregates()

processAggregates(payload): void

Parameters

Parameter Type
payload Partial< Item >[]

Returns

void

Source

api/src/services/payload.ts:208


processDates()

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

Parameters

Parameter Type
payloads Partial< Record< string, any > >[]
action Action

Returns

Partial< Record< string, any > >[]

Source

api/src/services/payload.ts:276


processField()

processField( field, payload, action, accountability): Promise< any >

Parameters

Parameter Type
field SchemaOverview
payload Partial< Item >
action Action
accountability any

Returns

Promise< any >

Source

api/src/services/payload.ts:219


processGeometries()

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.

Type parameters

Parameter
T extends Partial< Record< string, any > >[]

Parameters

Parameter Type
payloads T
action Action

Returns

T

Source

api/src/services/payload.ts:252


processM2O()

processM2O(data, opts?): Promise< {nestedActionEvents: ActionEventParams[]; payload: Partial< Item >; revisions: PrimaryKey[];} >

Save/update all nested related m2o items inside the payload

Parameters

Parameter Type
data Partial< Item >
opts? MutationOptions

Returns

Promise< {nestedActionEvents: ActionEventParams[]; payload: Partial< Item >; revisions: PrimaryKey[];} >

Source

api/src/services/payload.ts:478


processO2M()

processO2M( data, parent, opts?): Promise< {nestedActionEvents: ActionEventParams[]; revisions: PrimaryKey[];} >

Recursively save/update all nested related o2m items

Parameters

Parameter Type
data Partial< Item >
parent PrimaryKey
opts? MutationOptions

Returns

Promise< {nestedActionEvents: ActionEventParams[]; revisions: PrimaryKey[];} >

Source

api/src/services/payload.ts:559


processValues()

processValues(action, payloads): Promise< Partial< Item >[] >

Parameters

Parameter Type
action Action
payloads Partial< Item >[]

Returns

Promise< Partial< Item >[] >

Source

api/src/services/payload.ts:149

processValues(action, payload): Promise< Partial< Item > >

Parameters

Parameter Type
action Action
payload Partial< Item >

Returns

Promise< Partial< Item > >

Source

api/src/services/payload.ts:150


Generated using TypeDoc and typedoc-plugin-markdown