Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"lint": "eslint packages && lerna run tslint",
"flow": "flow",
"flow:check": "flow check",
"prettier": "prettier 'packages/*/src/**/*.{ts,js,tsx,jsx}'",
"prettier:fix": "yarn prettier --write",
"test": "lerna run --concurrency 1 test",
"prepack:all": "scripts/prepack-all",
"watch": "for I in packages/*/; do echo \"cd $I && npm run watch\" | perl -p -e 's/\\n/\\0/;'; done | xargs -0 node_modules/.bin/concurrently --kill-others",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// It only exists here (rather than using `graphql-type-json` directly) because
// we need to export Json along with JSON.
//

/*
The MIT License (MIT)

Expand Down Expand Up @@ -39,25 +40,30 @@ export default function makeGraphQLJSONType(graphql, name) {
case Kind.STRING:
case Kind.BOOLEAN:
return ast.value;

case Kind.INT:
case Kind.FLOAT:
return parseFloat(ast.value);

case Kind.OBJECT: {
const value = Object.create(null);
ast.fields.forEach(field => {
value[field.name.value] = parseLiteral(field.value, variables);
});

return value;
}

case Kind.LIST:
return ast.values.map(n => parseLiteral(n, variables));

case Kind.NULL:
return null;

case Kind.VARIABLE: {
const name = ast.name.value;
return variables ? variables[name] : undefined;
}

default:
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// @flow
import { LiveProvider } from "graphile-build";
import type { PgClass } from "./plugins/PgIntrospectionPlugin";

import { PgClass } from "./plugins/PgIntrospectionPlugin";
export default class PgLiveProvider extends LiveProvider {
// eslint-disable-next-line flowtype/no-weak-types
constructor(...args: any[]) {
Expand All @@ -14,19 +12,19 @@ export default class PgLiveProvider extends LiveProvider {
}

recordIdentifierIsValid(
collectionIdentifier: PgClass,
// eslint-disable-next-line flowtype/no-weak-types
collectionIdentifier: PgClass, // eslint-disable-next-line flowtype/no-weak-types
recordIdentifier: Array<any>
) {
if (!Array.isArray(recordIdentifier)) return false;
if (!collectionIdentifier.primaryKeyConstraint) return false;

if (
recordIdentifier.length !==
collectionIdentifier.primaryKeyConstraint.keyAttributes.length
) {
return false;
}
// TODO: more validation would not go amiss
} // TODO: more validation would not go amiss

return true;
}
}
Loading