Skip to main content

decoupled-kit-js

Classes

Interfaces

Functions

defaultFetch

defaultFetch(apiUrl, requestInit?, res?, cacheControl?): Promise<Response>

fetch data from a JSON:API endpoint, bubbling up surrogate keys if possible

Parameters

NameTypeDefault valueDescription
apiUrlRequestInfoundefinedthe api url for the JSON:API endpoint
requestInitRequestInit{}fetch initialization object
res?boolean | ServerResponse<IncomingMessage>undefinedresponse object
cacheControlstringdefaultCacheControlValueoptional value to override cache control header, defaults to 'public, s-maxage=600'

Returns

Promise<Response>

a promise containing the data for the JSON:API response

Defined in

drupal-kit/src/lib/defaultFetch.ts:17


setSurrogateKeyHeader

setSurrogateKeyHeader(keys, res): string | void

Adds an aggregated list of surrogate keys in the working response.

Parameters

NameTypeDescription
keysnull | stringValue for surrogate-key header in API response.
resServerResponse<IncomingMessage>The active http.ServerResponse object.

Returns

string | void

The current known unique set of surrogate keys.

Defined in

cms-kit/dist/src/utils/setSurrogateKeyHeader.d.ts:8