Skip to content
module@warp-drive/utilities/json-api

Function serializeResources() ​

ts
function serializeResources(cache: Cache, identifiers: ResourceKey): {
  data: ResourceObject;
};
function serializeResources(cache: Cache, identifiers: ResourceKey[]): {
  data: ResourceObject[];
};

Call Signature ​

ts
function serializeResources(cache: Cache, identifiers: ResourceKey): {
  data: ResourceObject;
};

Defined in: -private/json-api/serialize.ts:49

⚠️ This util often won't produce the necessary body for a {json:api} request

While this may come as a surprise, they are intended to serialize cache state for more generalized usage. {json:api} has a large variance in acceptable shapes, and only your app can ensure that the body is correctly formatted and contains all necessary data.

Serializes the current state of a resource or array of resources for use with POST or PUT requests.

Parameters ​

cache ​

Cache

the cache to serialize the resource(s) from

identifiers ​

ResourceKey

the resource(s) to serialize

Returns ​

an object with a data property containing the serialized resource(s)

data ​

ts
data: ResourceObject;

The serialized resource.

Call Signature ​

ts
function serializeResources(cache: Cache, identifiers: ResourceKey[]): {
  data: ResourceObject[];
};

Defined in: -private/json-api/serialize.ts:58

⚠️ This util often won't produce the necessary body for a {json:api} request

While this may come as a surprise, they are intended to serialize cache state for more generalized usage. {json:api} has a large variance in acceptable shapes, and only your app can ensure that the body is correctly formatted and contains all necessary data.

Serializes the current state of a resource or array of resources for use with POST or PUT requests.

Parameters ​

cache ​

Cache

the cache to serialize the resource(s) from

identifiers ​

ResourceKey[]

the resource(s) to serialize

Returns ​

an object with a data property containing the serialized resource(s)

data ​

ts
data: ResourceObject[];

The serialized resources.

Released under the MIT License.