@visulima/pagination 3.0.26 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,527 +0,0 @@
1
- var __defProp$3 = Object.defineProperty;
2
- var __name$3 = (target, value) => __defProp$3(target, "name", { value, configurable: true });
3
- const replace = String.prototype.replace;
4
- const percentTwenties = /%20/g;
5
- const Format = {
6
- RFC1738: "RFC1738",
7
- RFC3986: "RFC3986"
8
- };
9
- const formatters = {
10
- RFC1738: /* @__PURE__ */ __name$3(function(value) {
11
- return replace.call(value, percentTwenties, "+");
12
- }, "RFC1738"),
13
- RFC3986: /* @__PURE__ */ __name$3(function(value) {
14
- return String(value);
15
- }, "RFC3986")
16
- };
17
- const RFC1738 = Format.RFC1738;
18
- const formats = Format.RFC3986;
19
-
20
- var __defProp$2 = Object.defineProperty;
21
- var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
22
- const isArray$1 = Array.isArray;
23
- const hexTable = function() {
24
- const array = [];
25
- for (let i = 0; i < 256; ++i) {
26
- array.push("%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase());
27
- }
28
- return array;
29
- }();
30
- const limit = 1024;
31
- const encode = /* @__PURE__ */ __name$2(function encode2(str, defaultEncoder, charset, kind, format) {
32
- if (str.length === 0) {
33
- return str;
34
- }
35
- let string = str;
36
- if (typeof str === "symbol") {
37
- string = Symbol.prototype.toString.call(str);
38
- } else if (typeof str !== "string") {
39
- string = String(str);
40
- }
41
- if (charset === "iso-8859-1") {
42
- return escape(string).replace(/%u[0-9a-f]{4}/gi, function($0) {
43
- return "%26%23" + parseInt($0.slice(2), 16) + "%3B";
44
- });
45
- }
46
- let out = "";
47
- for (let j = 0; j < string.length; j += limit) {
48
- const segment = string.length >= limit ? string.slice(j, j + limit) : string;
49
- const arr = [];
50
- for (let i = 0; i < segment.length; ++i) {
51
- let c = segment.charCodeAt(i);
52
- if (c === 45 || // -
53
- c === 46 || // .
54
- c === 95 || // _
55
- c === 126 || // ~
56
- c >= 48 && c <= 57 || // 0-9
57
- c >= 65 && c <= 90 || // a-z
58
- c >= 97 && c <= 122 || // A-Z
59
- format === RFC1738 && (c === 40 || c === 41)) {
60
- arr[arr.length] = segment.charAt(i);
61
- continue;
62
- }
63
- if (c < 128) {
64
- arr[arr.length] = hexTable[c];
65
- continue;
66
- }
67
- if (c < 2048) {
68
- arr[arr.length] = hexTable[192 | c >> 6] + hexTable[128 | c & 63];
69
- continue;
70
- }
71
- if (c < 55296 || c >= 57344) {
72
- arr[arr.length] = hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
73
- continue;
74
- }
75
- i += 1;
76
- c = 65536 + ((c & 1023) << 10 | segment.charCodeAt(i) & 1023);
77
- arr[arr.length] = hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
78
- }
79
- out += arr.join("");
80
- }
81
- return out;
82
- }, "encode");
83
- const isBuffer = /* @__PURE__ */ __name$2(function isBuffer2(obj) {
84
- if (!obj || typeof obj !== "object") {
85
- return false;
86
- }
87
- return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
88
- }, "isBuffer");
89
- const maybeMap = /* @__PURE__ */ __name$2(function maybeMap2(val, fn) {
90
- if (isArray$1(val)) {
91
- const mapped = [];
92
- for (let i = 0; i < val.length; i += 1) {
93
- mapped.push(fn(val[i]));
94
- }
95
- return mapped;
96
- }
97
- return fn(val);
98
- }, "maybeMap");
99
-
100
- var __defProp$1 = Object.defineProperty;
101
- var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
102
- const has = Object.prototype.hasOwnProperty;
103
- const arrayPrefixGenerators = {
104
- brackets: /* @__PURE__ */ __name$1(function brackets(prefix) {
105
- return prefix + "[]";
106
- }, "brackets"),
107
- comma: "comma",
108
- indices: /* @__PURE__ */ __name$1(function indices(prefix, key) {
109
- return prefix + "[" + key + "]";
110
- }, "indices"),
111
- repeat: /* @__PURE__ */ __name$1(function repeat(prefix) {
112
- return prefix;
113
- }, "repeat")
114
- };
115
- const isArray = Array.isArray;
116
- const push = Array.prototype.push;
117
- const pushToArray = /* @__PURE__ */ __name$1(function(arr, valueOrArray) {
118
- push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
119
- }, "pushToArray");
120
- const toISO = Date.prototype.toISOString;
121
- const defaultFormat = formats;
122
- const defaults = {
123
- addQueryPrefix: false,
124
- allowDots: false,
125
- allowEmptyArrays: false,
126
- arrayFormat: "indices",
127
- charset: "utf-8",
128
- charsetSentinel: false,
129
- delimiter: "&",
130
- encode: true,
131
- encodeDotInKeys: false,
132
- encoder: encode,
133
- encodeValuesOnly: false,
134
- format: defaultFormat,
135
- formatter: formatters[defaultFormat],
136
- // deprecated
137
- indices: false,
138
- serializeDate: /* @__PURE__ */ __name$1(function serializeDate(date) {
139
- return toISO.call(date);
140
- }, "serializeDate"),
141
- skipNulls: false,
142
- strictNullHandling: false
143
- };
144
- const isNonNullishPrimitive = /* @__PURE__ */ __name$1(function isNonNullishPrimitive2(v) {
145
- return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
146
- }, "isNonNullishPrimitive");
147
- const sentinel = {};
148
- const _stringify = /* @__PURE__ */ __name$1(function stringify2(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate2, format, formatter, encodeValuesOnly, charset, sideChannel) {
149
- let obj = object;
150
- let tmpSc = sideChannel;
151
- let step = 0;
152
- let findFlag = false;
153
- while ((tmpSc = tmpSc.get(sentinel)) !== undefined && !findFlag) {
154
- const pos = tmpSc.get(object);
155
- step += 1;
156
- if (typeof pos !== "undefined") {
157
- if (pos === step) {
158
- throw new RangeError("Cyclic object value");
159
- } else {
160
- findFlag = true;
161
- }
162
- }
163
- if (typeof tmpSc.get(sentinel) === "undefined") {
164
- step = 0;
165
- }
166
- }
167
- if (typeof filter === "function") {
168
- obj = filter(prefix, obj);
169
- } else if (obj instanceof Date) {
170
- obj = serializeDate2(obj);
171
- } else if (generateArrayPrefix === "comma" && isArray(obj)) {
172
- obj = maybeMap(obj, function(value) {
173
- if (value instanceof Date) {
174
- return serializeDate2(value);
175
- }
176
- return value;
177
- });
178
- }
179
- if (obj === null) {
180
- if (strictNullHandling) {
181
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix;
182
- }
183
- obj = "";
184
- }
185
- if (isNonNullishPrimitive(obj) || isBuffer(obj)) {
186
- if (encoder) {
187
- const keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, "key", format);
188
- return [
189
- formatter(keyValue) + "=" + formatter(encoder(obj, defaults.encoder, charset, "value", format))
190
- ];
191
- }
192
- return [formatter(prefix) + "=" + formatter(String(obj))];
193
- }
194
- const values = [];
195
- if (typeof obj === "undefined") {
196
- return values;
197
- }
198
- let objKeys;
199
- if (generateArrayPrefix === "comma" && isArray(obj)) {
200
- if (encodeValuesOnly && encoder) {
201
- obj = maybeMap(obj, encoder);
202
- }
203
- objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : undefined }];
204
- } else if (isArray(filter)) {
205
- objKeys = filter;
206
- } else {
207
- const keys = Object.keys(obj);
208
- objKeys = sort ? keys.sort(sort) : keys;
209
- }
210
- const encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, "%2E") : prefix;
211
- const adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix;
212
- if (allowEmptyArrays && isArray(obj) && obj.length === 0) {
213
- return adjustedPrefix + "[]";
214
- }
215
- for (let j = 0; j < objKeys.length; ++j) {
216
- const key = objKeys[j];
217
- const value = typeof key === "object" && typeof key.value !== "undefined" ? key.value : obj[key];
218
- if (skipNulls && value === null) {
219
- continue;
220
- }
221
- const encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, "%2E") : key;
222
- const keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]");
223
- sideChannel.set(object, step);
224
- const valueSideChannel = /* @__PURE__ */ new WeakMap();
225
- valueSideChannel.set(sentinel, sideChannel);
226
- pushToArray(
227
- values,
228
- _stringify(
229
- value,
230
- keyPrefix,
231
- generateArrayPrefix,
232
- commaRoundTrip,
233
- allowEmptyArrays,
234
- strictNullHandling,
235
- skipNulls,
236
- encodeDotInKeys,
237
- generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder,
238
- filter,
239
- sort,
240
- allowDots,
241
- serializeDate2,
242
- format,
243
- formatter,
244
- encodeValuesOnly,
245
- charset,
246
- valueSideChannel
247
- )
248
- );
249
- }
250
- return values;
251
- }, "stringify");
252
- const normalizeStringifyOptions = /* @__PURE__ */ __name$1(function normalizeStringifyOptions2(opts) {
253
- if (!opts) {
254
- return defaults;
255
- }
256
- if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") {
257
- throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
258
- }
259
- if (typeof opts.encodeDotInKeys !== "undefined" && typeof opts.encodeDotInKeys !== "boolean") {
260
- throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
261
- }
262
- if (opts.encoder !== null && typeof opts.encoder !== "undefined" && typeof opts.encoder !== "function") {
263
- throw new TypeError("Encoder has to be a function.");
264
- }
265
- const charset = opts.charset || defaults.charset;
266
- if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
267
- throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
268
- }
269
- let format = formats;
270
- if (typeof opts.format !== "undefined") {
271
- if (!has.call(formatters, opts.format)) {
272
- throw new TypeError("Unknown format option provided.");
273
- }
274
- format = opts.format;
275
- }
276
- const formatter = formatters[format];
277
- let filter = defaults.filter;
278
- if (typeof opts.filter === "function" || isArray(opts.filter)) {
279
- filter = opts.filter;
280
- }
281
- let arrayFormat;
282
- if (opts.arrayFormat in arrayPrefixGenerators) {
283
- arrayFormat = opts.arrayFormat;
284
- } else if ("indices" in opts) {
285
- arrayFormat = opts.indices ? "indices" : "repeat";
286
- } else {
287
- arrayFormat = defaults.arrayFormat;
288
- }
289
- if ("commaRoundTrip" in opts && typeof opts.commaRoundTrip !== "boolean") {
290
- throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
291
- }
292
- const allowDots = typeof opts.allowDots === "undefined" ? opts.encodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
293
- return {
294
- addQueryPrefix: typeof opts.addQueryPrefix === "boolean" ? opts.addQueryPrefix : defaults.addQueryPrefix,
295
- allowDots,
296
- allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
297
- arrayFormat,
298
- charset,
299
- charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
300
- commaRoundTrip: opts.commaRoundTrip,
301
- delimiter: typeof opts.delimiter === "undefined" ? defaults.delimiter : opts.delimiter,
302
- encode: typeof opts.encode === "boolean" ? opts.encode : defaults.encode,
303
- encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults.encodeDotInKeys,
304
- encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder,
305
- encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
306
- filter,
307
- format,
308
- formatter,
309
- serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults.serializeDate,
310
- skipNulls: typeof opts.skipNulls === "boolean" ? opts.skipNulls : defaults.skipNulls,
311
- sort: typeof opts.sort === "function" ? opts.sort : null,
312
- strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling
313
- };
314
- }, "normalizeStringifyOptions");
315
- function stringify(object, opts) {
316
- let obj = object;
317
- const options = normalizeStringifyOptions(opts);
318
- let objKeys;
319
- let filter;
320
- if (typeof options.filter === "function") {
321
- filter = options.filter;
322
- obj = filter("", obj);
323
- } else if (isArray(options.filter)) {
324
- filter = options.filter;
325
- objKeys = filter;
326
- }
327
- const keys = [];
328
- if (typeof obj !== "object" || obj === null) {
329
- return "";
330
- }
331
- const generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];
332
- const commaRoundTrip = generateArrayPrefix === "comma" && options.commaRoundTrip;
333
- if (!objKeys) {
334
- objKeys = Object.keys(obj);
335
- }
336
- if (options.sort) {
337
- objKeys.sort(options.sort);
338
- }
339
- const sideChannel = /* @__PURE__ */ new WeakMap();
340
- for (let i = 0; i < objKeys.length; ++i) {
341
- const key = objKeys[i];
342
- if (options.skipNulls && obj[key] === null) {
343
- continue;
344
- }
345
- pushToArray(
346
- keys,
347
- _stringify(
348
- obj[key],
349
- key,
350
- generateArrayPrefix,
351
- commaRoundTrip,
352
- options.allowEmptyArrays,
353
- options.strictNullHandling,
354
- options.skipNulls,
355
- options.encodeDotInKeys,
356
- options.encode ? options.encoder : null,
357
- options.filter,
358
- options.sort,
359
- options.allowDots,
360
- options.serializeDate,
361
- options.format,
362
- options.formatter,
363
- options.encodeValuesOnly,
364
- options.charset,
365
- sideChannel
366
- )
367
- );
368
- }
369
- const joined = keys.join(options.delimiter);
370
- let prefix = options.addQueryPrefix === true ? "?" : "";
371
- if (options.charsetSentinel) {
372
- if (options.charset === "iso-8859-1") {
373
- prefix += "utf8=%26%2310003%3B&";
374
- } else {
375
- prefix += "utf8=%E2%9C%93&";
376
- }
377
- }
378
- return joined.length > 0 ? prefix + joined : "";
379
- }
380
- __name$1(stringify, "stringify");
381
-
382
- var __defProp = Object.defineProperty;
383
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
384
- class Paginator extends Array {
385
- constructor(totalNumber, perPage, currentPage, ...rows) {
386
- super(...rows);
387
- this.totalNumber = totalNumber;
388
- this.perPage = perPage;
389
- this.currentPage = currentPage;
390
- this.totalNumber = Number(totalNumber);
391
- this.rows = rows;
392
- this.isEmpty = this.rows.length === 0;
393
- }
394
- static {
395
- __name(this, "Paginator");
396
- }
397
- /**
398
- * The first page is always 1
399
- */
400
- firstPage = 1;
401
- /**
402
- * Find if results set is empty or not
403
- */
404
- isEmpty;
405
- qs = {};
406
- rows;
407
- url = "/";
408
- /**
409
- * A reference to the result rows
410
- */
411
- all() {
412
- return this.rows;
413
- }
414
- /**
415
- * Define base url for making the pagination links
416
- */
417
- baseUrl(url) {
418
- this.url = url;
419
- return this;
420
- }
421
- /**
422
- * Returns JSON meta data
423
- */
424
- getMeta() {
425
- return {
426
- firstPage: this.firstPage,
427
- firstPageUrl: this.getUrl(1),
428
- lastPage: this.lastPage,
429
- lastPageUrl: this.getUrl(this.lastPage),
430
- nextPageUrl: this.getNextPageUrl(),
431
- page: this.currentPage,
432
- perPage: this.perPage,
433
- previousPageUrl: this.getPreviousPageUrl(),
434
- total: this.total
435
- };
436
- }
437
- /**
438
- * Returns url for the next page
439
- */
440
- getNextPageUrl() {
441
- if (this.hasMorePages) {
442
- return this.getUrl(this.currentPage + 1);
443
- }
444
- return null;
445
- }
446
- /**
447
- * Returns URL for the previous page
448
- */
449
- getPreviousPageUrl() {
450
- if (this.currentPage > 1) {
451
- return this.getUrl(this.currentPage - 1);
452
- }
453
- return null;
454
- }
455
- /**
456
- * Returns url for a given page. Doesn't validate the integrity of the
457
- * page
458
- */
459
- getUrl(page) {
460
- const qstring = stringify({ ...this.qs, page: page < 1 ? 1 : page });
461
- return `${this.url}?${qstring}`;
462
- }
463
- /**
464
- * Returns an array of urls under a given range
465
- */
466
- getUrlsForRange(start, end) {
467
- const urls = [];
468
- for (let index = start; index <= end; index++) {
469
- urls.push({ isActive: index === this.currentPage, page: index, url: this.getUrl(index) });
470
- }
471
- return urls;
472
- }
473
- /**
474
- * Define query string to be appended to the pagination links
475
- */
476
- queryString(values) {
477
- this.qs = values;
478
- return this;
479
- }
480
- /**
481
- * Returns JSON representation of the paginated
482
- * data
483
- */
484
- toJSON() {
485
- return {
486
- data: this.all(),
487
- meta: this.getMeta()
488
- };
489
- }
490
- /**
491
- * Find if there are more pages to come
492
- */
493
- get hasMorePages() {
494
- return this.lastPage > this.currentPage;
495
- }
496
- /**
497
- * Find if there are enough results to be paginated or not
498
- */
499
- get hasPages() {
500
- return this.lastPage !== 1;
501
- }
502
- /**
503
- * Find if there are total records or not. This is not same as
504
- * `isEmpty`.
505
- *
506
- * The `isEmpty` reports about the current set of results. However, `hasTotal`
507
- * reports about the total number of records, regardless of the current.
508
- */
509
- get hasTotal() {
510
- return this.total > 0;
511
- }
512
- /**
513
- * The Last page number
514
- */
515
- get lastPage() {
516
- return Math.max(Math.ceil(this.total / this.perPage), 1);
517
- }
518
- /**
519
- * Casting `total` to a number. Later, we can think of situations
520
- * to cast it to a bigint
521
- */
522
- get total() {
523
- return Number(this.totalNumber);
524
- }
525
- }
526
-
527
- export { Paginator as default };
@@ -1,86 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- const createPaginationMetaSchemaObject = /* @__PURE__ */ __name((name = "PaginationData") => {
8
- return {
9
- [name]: {
10
- properties: {
11
- firstPage: {
12
- description: "Returns the number for the first page. It is always 1",
13
- minimum: 0,
14
- type: "integer"
15
- },
16
- firstPageUrl: {
17
- description: "The URL for the first page",
18
- type: "string"
19
- },
20
- lastPage: {
21
- description: "Returns the value for the last page by taking the total of rows into account",
22
- minimum: 0,
23
- type: "integer"
24
- },
25
- lastPageUrl: {
26
- description: "The URL for the last page",
27
- type: "string"
28
- },
29
- nextPageUrl: {
30
- description: "The URL for the next page",
31
- type: "string"
32
- },
33
- page: {
34
- description: "Current page number",
35
- minimum: 1,
36
- type: "integer"
37
- },
38
- perPage: {
39
- description: "Returns the value for the limit passed to the paginate method",
40
- minimum: 0,
41
- type: "integer"
42
- },
43
- previousPageUrl: {
44
- description: "The URL for the previous page",
45
- type: "string"
46
- },
47
- total: {
48
- description: "Holds the value for the total number of rows in the database",
49
- minimum: 0,
50
- type: "integer"
51
- }
52
- },
53
- type: "object",
54
- xml: {
55
- name
56
- }
57
- }
58
- };
59
- }, "createPaginationMetaSchemaObject");
60
- const createPaginationSchemaObject = /* @__PURE__ */ __name((name, items, metaReference = "#/components/schemas/PaginationData") => {
61
- return {
62
- [name]: {
63
- properties: {
64
- data: {
65
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
66
- items,
67
- type: "array",
68
- xml: {
69
- name: "data",
70
- wrapped: true
71
- }
72
- },
73
- meta: {
74
- $ref: metaReference
75
- }
76
- },
77
- type: "object",
78
- xml: {
79
- name
80
- }
81
- }
82
- };
83
- }, "createPaginationSchemaObject");
84
-
85
- exports.createPaginationMetaSchemaObject = createPaginationMetaSchemaObject;
86
- exports.createPaginationSchemaObject = createPaginationSchemaObject;
@@ -1,81 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const createPaginationMetaSchemaObject = /* @__PURE__ */ __name((name = "PaginationData") => {
4
- return {
5
- [name]: {
6
- properties: {
7
- firstPage: {
8
- description: "Returns the number for the first page. It is always 1",
9
- minimum: 0,
10
- type: "integer"
11
- },
12
- firstPageUrl: {
13
- description: "The URL for the first page",
14
- type: "string"
15
- },
16
- lastPage: {
17
- description: "Returns the value for the last page by taking the total of rows into account",
18
- minimum: 0,
19
- type: "integer"
20
- },
21
- lastPageUrl: {
22
- description: "The URL for the last page",
23
- type: "string"
24
- },
25
- nextPageUrl: {
26
- description: "The URL for the next page",
27
- type: "string"
28
- },
29
- page: {
30
- description: "Current page number",
31
- minimum: 1,
32
- type: "integer"
33
- },
34
- perPage: {
35
- description: "Returns the value for the limit passed to the paginate method",
36
- minimum: 0,
37
- type: "integer"
38
- },
39
- previousPageUrl: {
40
- description: "The URL for the previous page",
41
- type: "string"
42
- },
43
- total: {
44
- description: "Holds the value for the total number of rows in the database",
45
- minimum: 0,
46
- type: "integer"
47
- }
48
- },
49
- type: "object",
50
- xml: {
51
- name
52
- }
53
- }
54
- };
55
- }, "createPaginationMetaSchemaObject");
56
- const createPaginationSchemaObject = /* @__PURE__ */ __name((name, items, metaReference = "#/components/schemas/PaginationData") => {
57
- return {
58
- [name]: {
59
- properties: {
60
- data: {
61
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
62
- items,
63
- type: "array",
64
- xml: {
65
- name: "data",
66
- wrapped: true
67
- }
68
- },
69
- meta: {
70
- $ref: metaReference
71
- }
72
- },
73
- type: "object",
74
- xml: {
75
- name
76
- }
77
- }
78
- };
79
- }, "createPaginationSchemaObject");
80
-
81
- export { createPaginationMetaSchemaObject, createPaginationSchemaObject };