do not create columns starting with __ in firebase2graphql (fix #1001) (#1002)

This commit is contained in:
Rishichandra Wawhal 2018-11-13 16:12:41 +05:30 committed by Shahidh K Muhammed
parent 9af591e2cb
commit 51abce2c1c
3 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{
"name": "firebase2graphql",
"description": "A CLI tool to get GraphQL over Firebase data dump",
"version": "0.0.1-alpha7",
"version": "0.0.1-alpha8",
"author": "Hasura",
"bin": {
"firebase2graphql": "./bin/run",

View File

@ -25,7 +25,7 @@ const handleTableCandidate = (obj, tableName, tableDetectedCallback, isRootLevel
for (var listKey in object) {
const dummyRow = {...row};
dummyRow[getPrimaryKeyName(dummyRow, null, 'self')] = uuid();
dummyRow.__value = listKey;
dummyRow._value = listKey;
if (Object.keys(dummyRow).length > 0) {
rowArray.push(dummyRow);
}
@ -44,7 +44,7 @@ const handleTableCandidate = (obj, tableName, tableDetectedCallback, isRootLevel
tableName: parent || tableName,
name: objectKey,
pkeys: pkeyMap,
data: Object.keys(value).map(item => ({__value: item})),
data: Object.keys(value).map(item => ({_value: item})),
}
);
} else if (isObjectList(value)) {
@ -77,7 +77,7 @@ const handleTableCandidate = (obj, tableName, tableDetectedCallback, isRootLevel
if (isList(obj)) {
for (var listKey in obj) {
rowArray.push({
__value: listKey,
_value: listKey,
_id: uuid(),
});
}
@ -86,8 +86,8 @@ const handleTableCandidate = (obj, tableName, tableDetectedCallback, isRootLevel
if (isRandomList(obj)) {
for (var objKey in obj) {
rowArray.push({
__key: objKey,
__value: obj[objKey],
_key: objKey,
_value: obj[objKey],
_id: uuid(),
});
}

View File

@ -3,7 +3,7 @@ const throwError = require('../error');
const {log, spinnerStart, spinnerStop} = require('../log');
const shouldIgnoreTable = table => {
return (table.columns.find(c => c.name === '__value'));
return (table.columns.find(c => c.name === '_value'));
};
const getDupeCandidates = tables => {