Skip to content

Commit

Permalink
update lint commands ; fix ConnectionNode type
Browse files Browse the repository at this point in the history
  • Loading branch information
getlarge committed Apr 3, 2020
1 parent 3882296 commit 0226c7e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
5 changes: 2 additions & 3 deletions package.json
Expand Up @@ -8,9 +8,8 @@
"clean": "rimraf lib",
"test": "jest",
"test-watch": "jest --watch",
"lint": "eslint src/*",
"lint-fix": "eslint src/* --fix",
"lint:fix": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
"lint": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}'",
"lint-fix": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
"lint-staged": "lint-staged",
"coverage": "cross-env NODE_ENV=test jest --coverage",
"coverage-ci": "npm run coverage && cat ./coverage/lcov.info | codecov",
Expand Down
13 changes: 5 additions & 8 deletions src/graphqlProtocol/connection.ts
Expand Up @@ -15,12 +15,9 @@ import { ProtocolGraphQL } from './ProtocolGraphQL';
import { ProtocolGraphQLConfiguration } from './ProtocolGraphQLConfiguration';
import { generateSortInput } from './sort';
import { generateFilterInput } from './filter';
import { ConnectionNode } from './types';
// import { Entity } from '../engine/entity/Entity';

export type ConnectioNode = {
cursor: any;
};

export const generateConnectionArgs = (entity, graphRegistry) => {
const sortInput = generateSortInput(entity);
const filterInput = generateFilterInput(entity, graphRegistry);
Expand Down Expand Up @@ -228,7 +225,7 @@ export const connectionFromData = (
pageInfoFromData,
) => {
const entityName = entity.name;
let nodeToEdge;
let nodeToEdge: (node: any, idx?: number) => ConnectionNode;

if (entity.getPrimaryAttribute()) {
const primaryAttributeName = entity.getPrimaryAttribute().name;
Expand All @@ -247,10 +244,10 @@ export const connectionFromData = (
});
}

const edges = transformedData.map(nodeToEdge);
const edges: ConnectionNode[] = transformedData.map(nodeToEdge);

const firstNode: ConnectioNode = first(edges);
const lastNode: ConnectioNode = last(edges);
const firstNode = first(edges);
const lastNode = last(edges);

return {
edges,
Expand Down
5 changes: 5 additions & 0 deletions src/graphqlProtocol/types.ts
Expand Up @@ -23,3 +23,8 @@ export type OutputFields = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
result?: any;
};

export type ConnectionNode = {
cursor?: any;
node?: any;
};

0 comments on commit 0226c7e

Please sign in to comment.