( relationships: Relationships, )
| 50 | }; |
| 51 | |
| 52 | export const getRelationshipsObject = ( |
| 53 | relationships: Relationships, |
| 54 | ): IdObj<[IdObj<Id>, IdObj<Ids>]> => { |
| 55 | const store = relationships.getStore(); |
| 56 | const relationshipsObject: IdObj<[IdObj<Id>, IdObj<Ids>]> = {}; |
| 57 | relationships.forEachRelationship((relationshipId) => { |
| 58 | relationshipsObject[relationshipId] = [{}, {}]; |
| 59 | store |
| 60 | .getRowIds(relationships.getLocalTableId(relationshipId) as string) |
| 61 | .forEach((rowId) => { |
| 62 | const remoteRowId = relationships.getRemoteRowId(relationshipId, rowId); |
| 63 | if (remoteRowId != null) { |
| 64 | relationshipsObject[relationshipId][0][rowId] = remoteRowId; |
| 65 | } |
| 66 | }); |
| 67 | store |
| 68 | .getRowIds(relationships.getRemoteTableId(relationshipId) as string) |
| 69 | .forEach((remoteRowId) => { |
| 70 | const localRowIds = relationships.getLocalRowIds( |
| 71 | relationshipId, |
| 72 | remoteRowId, |
| 73 | ); |
| 74 | if (localRowIds.length > 0) { |
| 75 | relationshipsObject[relationshipId][1][remoteRowId] = localRowIds; |
| 76 | } |
| 77 | }); |
| 78 | }); |
| 79 | return relationshipsObject; |
| 80 | }; |
| 81 | |
| 82 | export const suppressWarnings = async <Return>( |
| 83 | actions: () => Promise<Return>, |
no test coverage detected
searching dependent graphs…