From b7184b6a590bdeeb77b63c55c1780986c2b3bba0 Mon Sep 17 00:00:00 2001 From: Safa AlFulaij Date: Wed, 13 Apr 2022 00:19:04 +0300 Subject: [PATCH] Add support for local id --- packages/@orbit/jsonapi/src/resource-document.ts | 1 + .../src/serializers/jsonapi-resource-identity-serializer.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packages/@orbit/jsonapi/src/resource-document.ts b/packages/@orbit/jsonapi/src/resource-document.ts index d2f92d865..a7c997aa6 100644 --- a/packages/@orbit/jsonapi/src/resource-document.ts +++ b/packages/@orbit/jsonapi/src/resource-document.ts @@ -24,6 +24,7 @@ export type ResourceRelationship = export interface Resource { id?: string; + lid?: string; type: string; attributes?: Dict; relationships?: Dict; diff --git a/packages/@orbit/jsonapi/src/serializers/jsonapi-resource-identity-serializer.ts b/packages/@orbit/jsonapi/src/serializers/jsonapi-resource-identity-serializer.ts index e8c0b9ff9..9e57e6ef8 100644 --- a/packages/@orbit/jsonapi/src/serializers/jsonapi-resource-identity-serializer.ts +++ b/packages/@orbit/jsonapi/src/serializers/jsonapi-resource-identity-serializer.ts @@ -91,6 +91,8 @@ export class JSONAPIResourceIdentitySerializer extends JSONAPIBaseSerializer< if (resourceId !== undefined) { resource.id = resourceId; + } else { + resource.lid = id; } return resource;