'use strict';


const { GraphQLInt, GraphQLString } = require('graphql');


// Pagination arguments
const paginationActionTypes = ['find'];
const getPaginationArgument = function ({ action: { actionType, multiple }, defaultPageSize, maxPageSize }) {
  // Only with safe operations that return an array, i.e. only with findMany
  if (!(paginationActionTypes.includes(actionType) && multiple)) { return; }

  return {
    page_size: {
      type: GraphQLInt,
      description: `Sets pagination size.
Using 0 disables pagination.
Maximum: ${maxPageSize}`,
      defaultValue: defaultPageSize,
    },

    after: {
      type: GraphQLString,
      description: `Retrieves next pagination batch, using the previous response's last model's 'token'.
Using '' means 'from the beginning'`,
      defaultValue: '',
    },

    before: {
      type: GraphQLString,
      description: `Retrieves previous pagination batch, using the previous response's first model's 'token'.
Using '' means 'from the end'`,
    },

    page: {
      type: GraphQLInt,
      description: `Page number, for pagination.
Starts at 1.
Cannot be used with 'before' or 'after'`,
    },
  };
};


module.exports = {
  getPaginationArgument,
};

@@ -122,16 +122,80 @@
 nTypes =
+ %5B'find', 'update', 'delete'%5D;%0Aconst fullPaginationActionTypes =
  %5B'find'
@@ -326,13 +326,8 @@
 ith 
-safe 
 oper
@@ -357,29 +357,94 @@
 rray
-, i.e. only with find
+ and do not provide array of data, i.e. only with findMany, deleteMany and%0A  // update
 Many
@@ -524,22 +524,38 @@
 n; %7D%0A%0A  
-return
+const paginationArgs =
  %7B%0A    p
@@ -632,16 +632,18 @@
 n size.%0A
+  
 Using 0 
@@ -663,16 +663,18 @@
 nation.%0A
+  
 Maximum:
@@ -729,26 +729,245 @@
 eSize,%0A    %7D
-,
 %0A
+  %7D;%0A%0A  // Only with safe operations that return an array, i.e. only with findMany%0A  if (!(fullPaginationActionTypes.includes(actionType) && multiple)) %7B return paginationArgs; %7D%0A%0A  return Object.assign(paginationArgs, %7B
 %0A    after: 
@@ -1511,16 +1511,17 @@
   %7D,%0A  %7D
+)
 ;%0A%7D;%0A%0A%0Am

Add GraphQL schema description for page_size for deleteMany and updateMany