graphql-compose / graphql-compose-pagination

Compare d30d18d ... +3 ... ce4fbe8

Coverage Reach

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 2 of 4 files from the diff.
Other files ignored by Codecov
package.json has changed.
yarn.lock has changed.

@@ -1,4 +1,12 @@
Loading
1 -
import { upperFirst, ObjectTypeComposer, SchemaComposer } from 'graphql-compose';
1 +
import {
2 +
  upperFirst,
3 +
  ObjectTypeComposer,
4 +
  SchemaComposer,
5 +
  InterfaceTypeComposer,
6 +
  UnionTypeComposer,
7 +
  ScalarTypeComposer,
8 +
  EnumTypeComposer,
9 +
} from 'graphql-compose';
2 10
3 11
// PaginationInfo should be global
4 12
const PaginationInfoTC = ObjectTypeComposer.createTemp(`
@@ -36,7 +44,12 @@
Loading
36 44
}
37 45
38 46
export function preparePaginationTC<TSource, TContext>(
39 -
  tc: ObjectTypeComposer<TSource, TContext>,
47 +
  tc:
48 +
    | ObjectTypeComposer<TSource, TContext>
49 +
    | InterfaceTypeComposer<TSource, TContext>
50 +
    | UnionTypeComposer<TSource, TContext>
51 +
    | ScalarTypeComposer<TContext>
52 +
    | EnumTypeComposer<TContext>,
40 53
  resolverName?: string
41 54
): ObjectTypeComposer<TSource, TContext> {
42 55
  const schemaComposer = tc.schemaComposer;

@@ -1,13 +1,24 @@
Loading
1 1
import { Resolver, inspect } from 'graphql-compose';
2 2
import type {
3 3
  ObjectTypeComposer,
4 +
  InterfaceTypeComposer,
5 +
  UnionTypeComposer,
6 +
  ScalarTypeComposer,
7 +
  EnumTypeComposer,
4 8
  ResolverResolveParams,
5 9
  ObjectTypeComposerArgumentConfigMap,
6 10
} from 'graphql-compose';
7 11
import { preparePaginationTC } from './types';
8 12
9 13
export const DEFAULT_RESOLVER_NAME = 'pagination';
10 14
export const DEFAULT_PER_PAGE = 20;
15 +
const ALLOWED_TYPE_COMPOSERS = [
16 +
  'ObjectTypeComposer',
17 +
  'InterfaceTypeComposer',
18 +
  'UnionTypeComposer',
19 +
  'ScalarTypeComposer',
20 +
  'EnumTypeComposer',
21 +
];
11 22
12 23
export type PaginationResolverOpts = {
13 24
  findManyResolver: Resolver;
@@ -39,12 +50,19 @@
Loading
39 50
}
40 51
41 52
export function preparePaginationResolver<TSource, TContext>(
42 -
  tc: ObjectTypeComposer<TSource, TContext>,
53 +
  tc:
54 +
    | ObjectTypeComposer<TSource, TContext>
55 +
    | InterfaceTypeComposer<TSource, TContext>
56 +
    | UnionTypeComposer<TSource, TContext>
57 +
    | ScalarTypeComposer<TContext>
58 +
    | EnumTypeComposer<TContext>,
43 59
  opts: PaginationResolverOpts
44 60
): Resolver<TSource, TContext, PaginationTArgs> {
45 -
  if (!tc || tc.constructor.name !== 'ObjectTypeComposer') {
61 +
  if (!tc || !ALLOWED_TYPE_COMPOSERS.includes(tc.constructor.name)) {
46 62
    throw new Error(
47 -
      'First arg for prepareConnectionResolver() should be instance of ObjectTypeComposer'
63 +
      `First arg for preparePaginationResolver() should be instance of ${ALLOWED_TYPE_COMPOSERS.join(
64 +
        ' or '
65 +
      )}`
48 66
    );
49 67
  }
50 68

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
src 0.02% 97.80%
Project Totals (3 files) 97.80%
Loading