Skip to main content

serializeSubjectKey

@webda/core


Function: serializeSubjectKey()

serializeSubjectKey(pkFields, key): string

Defined in: packages/core/src/core/operations.ts:86

Serialize a primary key to the canonical string identifying an operation subject.

A single-field key is its string value; a composite key is the JSON array of its field values in pkFields order, so plain input objects and getPrimaryKey() results (including relation links) produce the same string.

Parameters​

pkFields​

readonly string[]

the model primary key fields

key​

unknown

a scalar key, or an object holding the key fields

Returns​

string

the canonical key, or undefined when a field is missing