@visulima/pagination 3.0.16 → 3.0.17
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/CHANGELOG.md +16 -0
- package/LICENSE.md +80 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +399 -0
- package/dist/index.d.mts +322 -2
- package/dist/index.d.ts +322 -2
- package/dist/index.mjs +1 -7
- package/package.json +22 -25
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { OpenAPIV3 } from 'openapi-types';
|
|
2
|
-
|
|
3
1
|
interface PaginationMeta {
|
|
4
2
|
firstPage: number;
|
|
5
3
|
firstPageUrl: string | null;
|
|
@@ -71,6 +69,328 @@ declare class Paginator<T = unknown> extends Array<T> implements Paginator$1<T>
|
|
|
71
69
|
get total(): number;
|
|
72
70
|
}
|
|
73
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
|
+
|
|
74
394
|
declare const createPaginationMetaSchemaObject: (name?: string) => Record<string, OpenAPIV3.SchemaObject>;
|
|
75
395
|
declare const createPaginationSchemaObject: (name: string, items: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject, metaReference?: string) => Record<string, OpenAPIV3.SchemaObject>;
|
|
76
396
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { OpenAPIV3 } from 'openapi-types';
|
|
2
|
-
|
|
3
1
|
interface PaginationMeta {
|
|
4
2
|
firstPage: number;
|
|
5
3
|
firstPageUrl: string | null;
|
|
@@ -71,6 +69,328 @@ declare class Paginator<T = unknown> extends Array<T> implements Paginator$1<T>
|
|
|
71
69
|
get total(): number;
|
|
72
70
|
}
|
|
73
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
|
+
|
|
74
394
|
declare const createPaginationMetaSchemaObject: (name?: string) => Record<string, OpenAPIV3.SchemaObject>;
|
|
75
395
|
declare const createPaginationSchemaObject: (name: string, items: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject, metaReference?: string) => Record<string, OpenAPIV3.SchemaObject>;
|
|
76
396
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var i=class extends Array{constructor(e,a,s,...r){super(...r);this.totalNumber=e;this.perPage=a;this.currentPage=s;this.totalNumber=Number(e),this.rows=r,this.isEmpty=this.rows.length===0;}firstPage=1;isEmpty;qs={};rows;url="/";all(){return this.rows}baseUrl(e){return this.url=e,this}getMeta(){return {firstPage:this.firstPage,firstPageUrl:this.getUrl(1),lastPage:this.lastPage,lastPageUrl:this.getUrl(this.lastPage),nextPageUrl:this.getNextPageUrl(),page:this.currentPage,perPage:this.perPage,previousPageUrl:this.getPreviousPageUrl(),total:this.total}}getNextPageUrl(){return this.hasMorePages?this.getUrl(this.currentPage+1):null}getPreviousPageUrl(){return this.currentPage>1?this.getUrl(this.currentPage-1):null}getUrl(e){let a=stringify({...this.qs,page:e<1?1:e});return `${this.url}?${a}`}getUrlsForRange(e,a){let s=[];for(let r=e;r<=a;r++)s.push({isActive:r===this.currentPage,page:r,url:this.getUrl(r)});return s}queryString(e){return this.qs=e,this}toJSON(){return {data:this.all(),meta:this.getMeta()}}get hasMorePages(){return this.lastPage>this.currentPage}get hasPages(){return this.lastPage!==1}get hasTotal(){return this.total>0}get lastPage(){return Math.max(Math.ceil(this.total/this.perPage),1)}get total(){return Number(this.totalNumber)}};var u=(t="PaginationData")=>({[t]:{properties:{firstPage:{description:"Returns the number for the first page. It is always 1",minimum:0,type:"integer"},firstPageUrl:{description:"The URL for the first page",type:"string"},lastPage:{description:"Returns the value for the last page by taking the total of rows into account",minimum:0,type:"integer"},lastPageUrl:{description:"The URL for the last page",type:"string"},nextPageUrl:{description:"The URL for the next page",type:"string"},page:{description:"Current page number",minimum:1,type:"integer"},perPage:{description:"Returns the value for the limit passed to the paginate method",minimum:0,type:"integer"},previousPageUrl:{description:"The URL for the previous page",type:"string"},total:{description:"Holds the value for the total number of rows in the database",minimum:0,type:"integer"}},type:"object",xml:{name:t}}}),p=(t,n,e="#/components/schemas/PaginationData")=>({[t]:{properties:{data:{items:n,type:"array",xml:{name:"data",wrapped:!0}},meta:{$ref:e}},type:"object",xml:{name:t}}});var y=(t,n,e,a)=>new i(e,Number(n),Number(t),...a);
|
|
4
|
-
|
|
5
|
-
export { i as Paginator, u as createPaginationMetaSchemaObject, p as createPaginationSchemaObject, y as paginate };
|
|
6
|
-
//# sourceMappingURL=out.js.map
|
|
7
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
var Q=Object.defineProperty;var l=(n,t)=>Q(n,"name",{value:t,configurable:!0});const W=String.prototype.replace,G=/%20/g,L={RFC1738:"RFC1738",RFC3986:"RFC3986"},J={RFC1738:l(function(n){return W.call(n,G,"+")},"RFC1738"),RFC3986:l(function(n){return String(n)},"RFC3986")},_=L.RFC1738,X=L.RFC3986,Y=Array.isArray,h=function(){const n=[];for(let t=0;t<256;++t)n.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return n}(),O=1024,Z=l(function(t,i,e,a,m){if(t.length===0)return t;let g=t;if(typeof t=="symbol"?g=Symbol.prototype.toString.call(t):typeof t!="string"&&(g=String(t)),e==="iso-8859-1")return escape(g).replace(/%u[0-9a-f]{4}/gi,function(p){return"%26%23"+parseInt(p.slice(2),16)+"%3B"});let d="";for(let p=0;p<g.length;p+=O){const c=g.length>=O?g.slice(p,p+O):g,o=[];for(let f=0;f<c.length;++f){let r=c.charCodeAt(f);if(r===45||r===46||r===95||r===126||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||m===_&&(r===40||r===41)){o[o.length]=c.charAt(f);continue}if(r<128){o[o.length]=h[r];continue}if(r<2048){o[o.length]=h[192|r>>6]+h[128|r&63];continue}if(r<55296||r>=57344){o[o.length]=h[224|r>>12]+h[128|r>>6&63]+h[128|r&63];continue}f+=1,r=65536+((r&1023)<<10|c.charCodeAt(f)&1023),o[o.length]=h[240|r>>18]+h[128|r>>12&63]+h[128|r>>6&63]+h[128|r&63]}d+=o.join("")}return d},"encode"),V=l(function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},"isBuffer"),q=l(function(t,i){if(Y(t)){const e=[];for(let a=0;a<t.length;a+=1)e.push(i(t[a]));return e}return i(t)},"maybeMap"),tt={brackets:l(function(t){return t+"[]"},"brackets"),comma:"comma",indices:l(function(t,i){return t+"["+i+"]"},"indices"),repeat:l(function(t){return t},"repeat")},y=Array.isArray,et=Array.prototype.push,$=l(function(n,t){et.apply(n,y(t)?t:[t])},"pushToArray"),nt=Date.prototype.toISOString,I=X,w={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Z,encodeValuesOnly:!1,format:I,formatter:J[I],indices:!1,serializeDate:l(function(t){return nt.call(t)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},rt=l(function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},"isNonNullishPrimitive"),T={},z=l(function(t,i,e,a,m,g,d,p,c,o,f,r,P,j,b,U,v,C){let s=t,R=C,k=0,A=!1;for(;(R=R.get(T))!==void 0&&!A;){const u=R.get(t);if(k+=1,typeof u<"u"){if(u===k)throw new RangeError("Cyclic object value");A=!0}typeof R.get(T)>"u"&&(k=0)}if(typeof o=="function"?s=o(i,s):s instanceof Date?s=P(s):e==="comma"&&y(s)&&(s=q(s,function(u){return u instanceof Date?P(u):u})),s===null){if(g)return c&&!U?c(i,w.encoder,v,"key",j):i;s=""}if(rt(s)||V(s)){if(c){const u=U?i:c(i,w.encoder,v,"key",j);return[b(u)+"="+b(c(s,w.encoder,v,"value",j))]}return[b(i)+"="+b(String(s))]}const F=[];if(typeof s>"u")return F;let S;if(e==="comma"&&y(s))U&&c&&(s=q(s,c)),S=[{value:s.length>0?s.join(",")||null:void 0}];else if(y(o))S=o;else{const u=Object.keys(s);S=f?u.sort(f):u}const E=p?i.replace(/\./g,"%2E"):i,N=a&&y(s)&&s.length===1?E+"[]":E;if(m&&y(s)&&s.length===0)return N+"[]";for(let u=0;u<S.length;++u){const x=S[u],B=typeof x=="object"&&typeof x.value<"u"?x.value:s[x];if(d&&B===null)continue;const M=r&&p?x.replace(/\./g,"%2E"):x,H=y(s)?typeof e=="function"?e(N,M):N:N+(r?"."+M:"["+M+"]");C.set(t,k);const D=new WeakMap;D.set(T,C),$(F,z(B,H,e,a,m,g,d,p,e==="comma"&&U&&y(s)?null:c,o,f,r,P,j,b,U,v,D))}return F},"stringify"),it=l(function(t){return w},"normalizeStringifyOptions");function st(n,t){let i=n;const e=it();let a,m;typeof e.filter=="function"?(m=e.filter,i=m("",i)):y(e.filter)&&(m=e.filter,a=m);const g=[];if(typeof i!="object"||i===null)return"";const d=tt[e.arrayFormat],p=d==="comma"&&e.commaRoundTrip;a||(a=Object.keys(i)),e.sort&&a.sort(e.sort);const c=new WeakMap;for(let r=0;r<a.length;++r){const P=a[r];e.skipNulls&&i[P]===null||$(g,z(i[P],P,d,p,e.allowEmptyArrays,e.strictNullHandling,e.skipNulls,e.encodeDotInKeys,e.encode?e.encoder:null,e.filter,e.sort,e.allowDots,e.serializeDate,e.format,e.formatter,e.encodeValuesOnly,e.charset,c))}const o=g.join(e.delimiter);let f=e.addQueryPrefix===!0?"?":"";return e.charsetSentinel&&(e.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),o.length>0?f+o:""}l(st,"stringify");var at=Object.defineProperty,ot=l((n,t)=>at(n,"name",{value:t,configurable:!0}),"n");class lt extends Array{static{l(this,"g")}constructor(t,i,e,...a){super(...a),this.totalNumber=t,this.perPage=i,this.currentPage=e,this.totalNumber=Number(t),this.rows=a,this.isEmpty=this.rows.length===0}static{ot(this,"Paginator")}firstPage=1;isEmpty;qs={};rows;url="/";all(){return this.rows}baseUrl(t){return this.url=t,this}getMeta(){return{firstPage:this.firstPage,firstPageUrl:this.getUrl(1),lastPage:this.lastPage,lastPageUrl:this.getUrl(this.lastPage),nextPageUrl:this.getNextPageUrl(),page:this.currentPage,perPage:this.perPage,previousPageUrl:this.getPreviousPageUrl(),total:this.total}}getNextPageUrl(){return this.hasMorePages?this.getUrl(this.currentPage+1):null}getPreviousPageUrl(){return this.currentPage>1?this.getUrl(this.currentPage-1):null}getUrl(t){const i=st({...this.qs,page:t<1?1:t});return`${this.url}?${i}`}getUrlsForRange(t,i){const e=[];for(let a=t;a<=i;a++)e.push({isActive:a===this.currentPage,page:a,url:this.getUrl(a)});return e}queryString(t){return this.qs=t,this}toJSON(){return{data:this.all(),meta:this.getMeta()}}get hasMorePages(){return this.lastPage>this.currentPage}get hasPages(){return this.lastPage!==1}get hasTotal(){return this.total>0}get lastPage(){return Math.max(Math.ceil(this.total/this.perPage),1)}get total(){return Number(this.totalNumber)}}var ct=Object.defineProperty,K=l((n,t)=>ct(n,"name",{value:t,configurable:!0}),"r");const pt=K((n="PaginationData")=>({[n]:{properties:{firstPage:{description:"Returns the number for the first page. It is always 1",minimum:0,type:"integer"},firstPageUrl:{description:"The URL for the first page",type:"string"},lastPage:{description:"Returns the value for the last page by taking the total of rows into account",minimum:0,type:"integer"},lastPageUrl:{description:"The URL for the last page",type:"string"},nextPageUrl:{description:"The URL for the next page",type:"string"},page:{description:"Current page number",minimum:1,type:"integer"},perPage:{description:"Returns the value for the limit passed to the paginate method",minimum:0,type:"integer"},previousPageUrl:{description:"The URL for the previous page",type:"string"},total:{description:"Holds the value for the total number of rows in the database",minimum:0,type:"integer"}},type:"object",xml:{name:n}}}),"createPaginationMetaSchemaObject"),ht=K((n,t,i="#/components/schemas/PaginationData")=>({[n]:{properties:{data:{items:t,type:"array",xml:{name:"data",wrapped:!0}},meta:{$ref:i}},type:"object",xml:{name:n}}}),"createPaginationSchemaObject");var ut=Object.defineProperty,ft=l((n,t)=>ut(n,"name",{value:t,configurable:!0}),"e");const mt=ft((n,t,i,e)=>new lt(i,Number(t),Number(n),...e),"paginate");export{lt as Paginator,pt as createPaginationMetaSchemaObject,ht as createPaginationSchemaObject,mt as paginate};
|