@@ -145,13 +145,13 @@ type Query {
145
145
resultroot : " values[]"
146
146
147
147
# Ecmascript (with empty endpoint) is used to mimic the response from a REST api.
148
- # Note ECMAScript is only used to generate a mock response with customer objects and page number metadata,
148
+ # Note ECMAScript is only used to generate a mock response with customer objects and offset metadata,
149
149
# using @rest against a real endpoint would not typically require any ECMAScript.
150
150
endpoint : " stepzen:empty"
151
151
ecmascript : " " "
152
152
function transformREST() {
153
153
// A total of 23 items will be returned
154
- const totalItems = 23;
154
+ const records = 23;
155
155
156
156
// Pagination field arguments
157
157
// Since this is OFFSET pagination
@@ -161,12 +161,9 @@ type Query {
161
161
const limit = get('first');
162
162
const offset = get('after');
163
163
164
- // metadata - total number of records
165
- const records = Math.ceil(totalItems / limit)
166
-
167
164
// generate customers for nodes based on the limit and offset values
168
165
const startIndex = offset+1 || 1;
169
- const endIndex = Math.min(startIndex + limit, totalItems +1);
166
+ const endIndex = Math.min(startIndex + limit, records +1);
170
167
var customers = []
171
168
for (let i = startIndex; i < endIndex; i++) {
172
169
customers.push({
@@ -180,7 +177,7 @@ type Query {
180
177
// when pagination is through an offset.
181
178
// @rest must be configured to match the REST response layout.
182
179
//
183
- // pagination setters defines that the page count
180
+ // pagination setters defines that total number of records
184
181
// is taken from meta.records
185
182
//
186
183
// resultroot corresponds to the location that contains the
0 commit comments