Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 20x 20x 224x 19x 19x 121x 121x 7x 7x 114x 5x 5x 109x 19x | import { Injectable } from '@nestjs/common';
import { DocumentClient } from 'aws-sdk/clients/dynamodb';
@Injectable()
export class AppSyncUtils {
getGqlResponseKeys = (
keys: DocumentClient.AttributeMap,
): string[] => {
const gqlKeys: string[] = [];
Object.keys(keys).forEach((key) => {
const value = keys[key];
if (Array.isArray(value)) {
const keyValues = this.getGqlResponseKeys(value[0]);
gqlKeys.push(`${key} {${keyValues.join(' ')}}`);
} else if (typeof value === 'object') {
const keyValue = this.getGqlResponseKeys(value);
gqlKeys.push(`${key} {${keyValue.join(' ')}}`);
} else {
gqlKeys.push(key);
}
});
return gqlKeys;
};
}
|