@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.
package/dist/index.d.mts DELETED
@@ -1,399 +0,0 @@
1
- interface PaginationMeta {
2
- firstPage: number;
3
- firstPageUrl: string | null;
4
- lastPage: number;
5
- lastPageUrl: string | null;
6
- nextPageUrl: string | null;
7
- page: number;
8
- perPage: number;
9
- previousPageUrl: string | null;
10
- total: number;
11
- }
12
-
13
- interface PaginationResult<Result> {
14
- data: Result[];
15
- meta: PaginationMeta;
16
- }
17
-
18
- interface Paginator$1<Result> extends Array<Result> {
19
- all: () => Result[];
20
-
21
- baseUrl: (url: string) => this;
22
- readonly currentPage: number;
23
- readonly firstPage: number;
24
- getMeta: () => PaginationMeta;
25
- getNextPageUrl: () => string | null;
26
- getPreviousPageUrl: () => string | null;
27
- getUrl: (page: number) => string;
28
- getUrlsForRange: (start: number, end: number) => { isActive: boolean; page: number; url: string }[];
29
- readonly hasMorePages: boolean;
30
-
31
- readonly hasPages: boolean;
32
- readonly hasTotal: boolean;
33
- readonly isEmpty: boolean;
34
- readonly lastPage: number;
35
- readonly perPage: number;
36
- queryString: (values: Record<string, unknown>) => this;
37
- toJSON: () => PaginationResult<Result>;
38
- readonly total: number;
39
- }
40
-
41
- type UrlsForRange = {
42
- isActive: boolean;
43
- page: number;
44
- url: string;
45
- }[];
46
- declare class Paginator<T = unknown> extends Array<T> implements Paginator$1<T> {
47
- private readonly totalNumber;
48
- readonly perPage: number;
49
- currentPage: number;
50
- readonly firstPage: number;
51
- readonly isEmpty: boolean;
52
- private qs;
53
- private readonly rows;
54
- private url;
55
- constructor(totalNumber: number, perPage: number, currentPage: number, ...rows: T[]);
56
- all(): T[];
57
- baseUrl(url: string): this;
58
- getMeta(): PaginationMeta;
59
- getNextPageUrl(): string | null;
60
- getPreviousPageUrl(): string | null;
61
- getUrl(page: number): string;
62
- getUrlsForRange(start: number, end: number): UrlsForRange;
63
- queryString(values: Record<string, unknown>): this;
64
- toJSON(): PaginationResult<T>;
65
- get hasMorePages(): boolean;
66
- get hasPages(): boolean;
67
- get hasTotal(): boolean;
68
- get lastPage(): number;
69
- get total(): number;
70
- }
71
-
72
- declare namespace OpenAPIV3 {
73
- interface Document<T extends {} = {}> {
74
- openapi: string;
75
- info: InfoObject;
76
- servers?: ServerObject[];
77
- paths: PathsObject<T>;
78
- components?: ComponentsObject;
79
- security?: SecurityRequirementObject[];
80
- tags?: TagObject[];
81
- externalDocs?: ExternalDocumentationObject;
82
- 'x-express-openapi-additional-middleware'?: (((request: any, response: any, next: any) => Promise<void>) | ((request: any, response: any, next: any) => void))[];
83
- 'x-express-openapi-validation-strict'?: boolean;
84
- }
85
- interface InfoObject {
86
- title: string;
87
- description?: string;
88
- termsOfService?: string;
89
- contact?: ContactObject;
90
- license?: LicenseObject;
91
- version: string;
92
- }
93
- interface ContactObject {
94
- name?: string;
95
- url?: string;
96
- email?: string;
97
- }
98
- interface LicenseObject {
99
- name: string;
100
- url?: string;
101
- }
102
- interface ServerObject {
103
- url: string;
104
- description?: string;
105
- variables?: {
106
- [variable: string]: ServerVariableObject;
107
- };
108
- }
109
- interface ServerVariableObject {
110
- enum?: string[];
111
- default: string;
112
- description?: string;
113
- }
114
- interface PathsObject<T extends {} = {}, P extends {} = {}> {
115
- [pattern: string]: (PathItemObject<T> & P) | undefined;
116
- }
117
- enum HttpMethods {
118
- GET = "get",
119
- PUT = "put",
120
- POST = "post",
121
- DELETE = "delete",
122
- OPTIONS = "options",
123
- HEAD = "head",
124
- PATCH = "patch",
125
- TRACE = "trace"
126
- }
127
- type PathItemObject<T extends {} = {}> = {
128
- $ref?: string;
129
- summary?: string;
130
- description?: string;
131
- servers?: ServerObject[];
132
- parameters?: (ReferenceObject | ParameterObject)[];
133
- } & {
134
- [method in HttpMethods]?: OperationObject<T>;
135
- };
136
- type OperationObject<T extends {} = {}> = {
137
- tags?: string[];
138
- summary?: string;
139
- description?: string;
140
- externalDocs?: ExternalDocumentationObject;
141
- operationId?: string;
142
- parameters?: (ReferenceObject | ParameterObject)[];
143
- requestBody?: ReferenceObject | RequestBodyObject;
144
- responses: ResponsesObject;
145
- callbacks?: {
146
- [callback: string]: ReferenceObject | CallbackObject;
147
- };
148
- deprecated?: boolean;
149
- security?: SecurityRequirementObject[];
150
- servers?: ServerObject[];
151
- } & T;
152
- interface ExternalDocumentationObject {
153
- description?: string;
154
- url: string;
155
- }
156
- interface ParameterObject extends ParameterBaseObject {
157
- name: string;
158
- in: string;
159
- }
160
- interface HeaderObject extends ParameterBaseObject {
161
- }
162
- interface ParameterBaseObject {
163
- description?: string;
164
- required?: boolean;
165
- deprecated?: boolean;
166
- allowEmptyValue?: boolean;
167
- style?: string;
168
- explode?: boolean;
169
- allowReserved?: boolean;
170
- schema?: ReferenceObject | SchemaObject;
171
- example?: any;
172
- examples?: {
173
- [media: string]: ReferenceObject | ExampleObject;
174
- };
175
- content?: {
176
- [media: string]: MediaTypeObject;
177
- };
178
- }
179
- type NonArraySchemaObjectType = 'boolean' | 'object' | 'number' | 'string' | 'integer';
180
- type ArraySchemaObjectType = 'array';
181
- type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
182
- interface ArraySchemaObject extends BaseSchemaObject {
183
- type: ArraySchemaObjectType;
184
- items: ReferenceObject | SchemaObject;
185
- }
186
- interface NonArraySchemaObject extends BaseSchemaObject {
187
- type?: NonArraySchemaObjectType;
188
- }
189
- interface BaseSchemaObject {
190
- title?: string;
191
- description?: string;
192
- format?: string;
193
- default?: any;
194
- multipleOf?: number;
195
- maximum?: number;
196
- exclusiveMaximum?: boolean;
197
- minimum?: number;
198
- exclusiveMinimum?: boolean;
199
- maxLength?: number;
200
- minLength?: number;
201
- pattern?: string;
202
- additionalProperties?: boolean | ReferenceObject | SchemaObject;
203
- maxItems?: number;
204
- minItems?: number;
205
- uniqueItems?: boolean;
206
- maxProperties?: number;
207
- minProperties?: number;
208
- required?: string[];
209
- enum?: any[];
210
- properties?: {
211
- [name: string]: ReferenceObject | SchemaObject;
212
- };
213
- allOf?: (ReferenceObject | SchemaObject)[];
214
- oneOf?: (ReferenceObject | SchemaObject)[];
215
- anyOf?: (ReferenceObject | SchemaObject)[];
216
- not?: ReferenceObject | SchemaObject;
217
- nullable?: boolean;
218
- discriminator?: DiscriminatorObject;
219
- readOnly?: boolean;
220
- writeOnly?: boolean;
221
- xml?: XMLObject;
222
- externalDocs?: ExternalDocumentationObject;
223
- example?: any;
224
- deprecated?: boolean;
225
- }
226
- interface DiscriminatorObject {
227
- propertyName: string;
228
- mapping?: {
229
- [value: string]: string;
230
- };
231
- }
232
- interface XMLObject {
233
- name?: string;
234
- namespace?: string;
235
- prefix?: string;
236
- attribute?: boolean;
237
- wrapped?: boolean;
238
- }
239
- interface ReferenceObject {
240
- $ref: string;
241
- }
242
- interface ExampleObject {
243
- summary?: string;
244
- description?: string;
245
- value?: any;
246
- externalValue?: string;
247
- }
248
- interface MediaTypeObject {
249
- schema?: ReferenceObject | SchemaObject;
250
- example?: any;
251
- examples?: {
252
- [media: string]: ReferenceObject | ExampleObject;
253
- };
254
- encoding?: {
255
- [media: string]: EncodingObject;
256
- };
257
- }
258
- interface EncodingObject {
259
- contentType?: string;
260
- headers?: {
261
- [header: string]: ReferenceObject | HeaderObject;
262
- };
263
- style?: string;
264
- explode?: boolean;
265
- allowReserved?: boolean;
266
- }
267
- interface RequestBodyObject {
268
- description?: string;
269
- content: {
270
- [media: string]: MediaTypeObject;
271
- };
272
- required?: boolean;
273
- }
274
- interface ResponsesObject {
275
- [code: string]: ReferenceObject | ResponseObject;
276
- }
277
- interface ResponseObject {
278
- description: string;
279
- headers?: {
280
- [header: string]: ReferenceObject | HeaderObject;
281
- };
282
- content?: {
283
- [media: string]: MediaTypeObject;
284
- };
285
- links?: {
286
- [link: string]: ReferenceObject | LinkObject;
287
- };
288
- }
289
- interface LinkObject {
290
- operationRef?: string;
291
- operationId?: string;
292
- parameters?: {
293
- [parameter: string]: any;
294
- };
295
- requestBody?: any;
296
- description?: string;
297
- server?: ServerObject;
298
- }
299
- interface CallbackObject {
300
- [url: string]: PathItemObject;
301
- }
302
- interface SecurityRequirementObject {
303
- [name: string]: string[];
304
- }
305
- interface ComponentsObject {
306
- schemas?: {
307
- [key: string]: ReferenceObject | SchemaObject;
308
- };
309
- responses?: {
310
- [key: string]: ReferenceObject | ResponseObject;
311
- };
312
- parameters?: {
313
- [key: string]: ReferenceObject | ParameterObject;
314
- };
315
- examples?: {
316
- [key: string]: ReferenceObject | ExampleObject;
317
- };
318
- requestBodies?: {
319
- [key: string]: ReferenceObject | RequestBodyObject;
320
- };
321
- headers?: {
322
- [key: string]: ReferenceObject | HeaderObject;
323
- };
324
- securitySchemes?: {
325
- [key: string]: ReferenceObject | SecuritySchemeObject;
326
- };
327
- links?: {
328
- [key: string]: ReferenceObject | LinkObject;
329
- };
330
- callbacks?: {
331
- [key: string]: ReferenceObject | CallbackObject;
332
- };
333
- }
334
- type SecuritySchemeObject = HttpSecurityScheme | ApiKeySecurityScheme | OAuth2SecurityScheme | OpenIdSecurityScheme;
335
- interface HttpSecurityScheme {
336
- type: 'http';
337
- description?: string;
338
- scheme: string;
339
- bearerFormat?: string;
340
- }
341
- interface ApiKeySecurityScheme {
342
- type: 'apiKey';
343
- description?: string;
344
- name: string;
345
- in: string;
346
- }
347
- interface OAuth2SecurityScheme {
348
- type: 'oauth2';
349
- description?: string;
350
- flows: {
351
- implicit?: {
352
- authorizationUrl: string;
353
- refreshUrl?: string;
354
- scopes: {
355
- [scope: string]: string;
356
- };
357
- };
358
- password?: {
359
- tokenUrl: string;
360
- refreshUrl?: string;
361
- scopes: {
362
- [scope: string]: string;
363
- };
364
- };
365
- clientCredentials?: {
366
- tokenUrl: string;
367
- refreshUrl?: string;
368
- scopes: {
369
- [scope: string]: string;
370
- };
371
- };
372
- authorizationCode?: {
373
- authorizationUrl: string;
374
- tokenUrl: string;
375
- refreshUrl?: string;
376
- scopes: {
377
- [scope: string]: string;
378
- };
379
- };
380
- };
381
- }
382
- interface OpenIdSecurityScheme {
383
- type: 'openIdConnect';
384
- description?: string;
385
- openIdConnectUrl: string;
386
- }
387
- interface TagObject {
388
- name: string;
389
- description?: string;
390
- externalDocs?: ExternalDocumentationObject;
391
- }
392
- }
393
-
394
- declare const createPaginationMetaSchemaObject: (name?: string) => Record<string, OpenAPIV3.SchemaObject>;
395
- declare const createPaginationSchemaObject: (name: string, items: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject, metaReference?: string) => Record<string, OpenAPIV3.SchemaObject>;
396
-
397
- declare const paginate: <Result>(page: number, perPage: number, total: number, rows: Result[]) => Paginator$1<Result>;
398
-
399
- export { type PaginationMeta, type PaginationResult, Paginator, type Paginator$1 as PaginatorInterface, createPaginationMetaSchemaObject, createPaginationSchemaObject, paginate };
package/dist/index.mjs DELETED
@@ -1,8 +0,0 @@
1
- import Paginator from './packem_shared/Paginator-Cn8d66Nq.mjs';
2
- export { createPaginationMetaSchemaObject, createPaginationSchemaObject } from './packem_shared/createPaginationMetaSchemaObject-fEupXBbv.mjs';
3
-
4
- var __defProp = Object.defineProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- const paginate = /* @__PURE__ */ __name((page, perPage, total, rows) => new Paginator(total, Number(perPage), Number(page), ...rows), "paginate");
7
-
8
- export { Paginator, paginate };