MCPcopy Create free account
hub / github.com/alephdata/aleph / getMappingKeys

Method getMappingKeys

ui/src/components/MappingEditor/MappingList.js:110–133  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

108 }
109
110 getMappingKeys(id) {
111 const mapping = this.getMapping(id);
112 if (!mapping) {
113 return [];
114 }
115 const { keys, properties, schema } = mapping;
116
117 if (schema.isEdge) {
118 let sourceKeys = [],
119 targetKeys = [];
120 const { source, target } = schema.edge;
121
122 if (properties[source]) {
123 sourceKeys = this.getMappingKeys(properties[source].entity);
124 }
125 if (properties[target]) {
126 targetKeys = this.getMappingKeys(properties[target].entity);
127 }
128
129 return [...new Set([...sourceKeys, ...targetKeys, ...keys])];
130 } else {
131 return keys;
132 }
133 }
134
135 // returns pseudo-entity for mapping, in order to be allow Entity ftm components to be used
136 getMappingAsEntity(id) {

Callers 3

validateMethod · 0.95
toApiFormatMethod · 0.95
renderKeySelectMethod · 0.80

Calls 1

getMappingMethod · 0.95

Tested by

no test coverage detected