equipped 5.0.0-alpha.4 → 5.0.0-alpha.6

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 CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [5.0.0-alpha.6](https://github.com/kevinand11/equipped/compare/v5.0.0-alpha.5...v5.0.0-alpha.6) (2024-06-26)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * openapi.json relative to index html ([31658f9](https://github.com/kevinand11/equipped/commit/31658f924263ff88dfe2ac757e032e9412598665))
11
+
12
+ ## [5.0.0-alpha.5](https://github.com/kevinand11/equipped/compare/v5.0.0-alpha.4...v5.0.0-alpha.5) (2024-06-26)
13
+
14
+
15
+ ### Features
16
+
17
+ * route tag descriptions ([644ef9f](https://github.com/kevinand11/equipped/commit/644ef9f5f929b738aabc99f55d3c61af8a85266e))
18
+
5
19
  ## [5.0.0-alpha.4](https://github.com/kevinand11/equipped/compare/v5.0.0-alpha.3...v5.0.0-alpha.4) (2024-06-18)
6
20
 
7
21
  ## [5.0.0-alpha.3](https://github.com/kevinand11/equipped/compare/v5.0.0-alpha.2...v5.0.0-alpha.3) (2024-06-18)
@@ -1,28 +1,3 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose/types/inferschematype" />
25
- /// <reference types="mongoose/types/inferrawdoctype" />
26
1
  import mongoose from 'mongoose';
27
2
  import { BaseEntity } from '../../structure';
28
3
  import { DbChange, DbChangeCallbacks } from '../_instance';
@@ -1,28 +1,3 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose/types/inferschematype" />
25
- /// <reference types="mongoose/types/inferrawdoctype" />
26
1
  import mongoose from 'mongoose';
27
2
  import { BaseEntity } from '../../structure';
28
3
  import { Db, DbChangeCallbacks } from '../_instance';
@@ -1,28 +1,3 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose/types/inferschematype" />
25
- /// <reference types="mongoose/types/inferrawdoctype" />
26
1
  import mongoose from 'mongoose';
27
2
  import { QueryParams, QueryResults } from '../query';
28
3
  export declare const parseMongodbQueryParams: <Model>(model: mongoose.Model<Model>, params: QueryParams) => Promise<QueryResults<Model>>;
@@ -3,7 +3,7 @@ export declare class KafkaEventBus extends EventBus {
3
3
  #private;
4
4
  constructor();
5
5
  createPublisher<Event extends Events[keyof Events]>(topic: Event['topic']): {
6
- publish: (data: Event['data']) => Promise<boolean>;
6
+ publish: (data: Event["data"]) => Promise<boolean>;
7
7
  };
8
8
  createSubscriber<Event extends Events[keyof Events]>(topic: Event['topic'], onMessage: (data: Event['data']) => Promise<void>, options?: Partial<SubscribeOptions>): {
9
9
  subscribe: () => Promise<void>;
@@ -3,7 +3,7 @@ export declare class RabbitEventBus extends EventBus {
3
3
  #private;
4
4
  constructor();
5
5
  createPublisher<Event extends Events[keyof Events]>(topic: Event['topic']): {
6
- publish: (data: Event['data']) => Promise<boolean>;
6
+ publish: (data: Event["data"]) => Promise<boolean>;
7
7
  };
8
8
  createSubscriber<Event extends Events[keyof Events]>(topic: Event['topic'], onMessage: (data: Event['data']) => Promise<void>, options?: Partial<SubscribeOptions>): {
9
9
  subscribe: () => Promise<void>;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.generateJSONSchema = void 0;
26
+ exports.generateJSONSchema = generateJSONSchema;
27
27
  const ts_oas_1 = __importStar(require("ts-oas"));
28
28
  const instance_1 = require("../instance");
29
29
  const server_1 = require("../server");
@@ -100,7 +100,6 @@ function generateJSONSchema(patterns, paths, options) {
100
100
  return acc;
101
101
  }, {});
102
102
  }
103
- exports.generateJSONSchema = generateJSONSchema;
104
103
  function stripEmptyObjects(obj) {
105
104
  return Object.entries(obj).reduce((acc, [key, value]) => {
106
105
  if (!value || typeof value === 'object' && Object.keys(value).length === 0)
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node/http" />
3
- /// <reference types="pino-http" />
4
1
  import http from 'http';
5
2
  import { OpenAPIV3_1 } from 'openapi-types';
6
3
  import supertest from 'supertest';
@@ -20,6 +17,7 @@ export declare abstract class Server<Req = any, Res = any> {
20
17
  protected server: http.Server;
21
18
  protected staticPath: string;
22
19
  protected settings: import("../../instance/settings").Settings;
20
+ protected openapiJsonUrl: string;
23
21
  protected baseOpenapiDoc: OpenAPIV3_1.Document;
24
22
  protected abstract onLoad(): Promise<void>;
25
23
  protected abstract startServer(port: number): Promise<boolean>;
@@ -13,7 +13,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- var _Server_instances, _Server_routesByPath, _Server_routesByKey, _Server_schemas, _Server_listener, _Server_regRoute;
16
+ var _Server_instances, _Server_routesByPath, _Server_routesByKey, _Server_schemas, _Server_listener, _Server_registeredTags, _Server_registerTag, _Server_regRoute;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.Server = void 0;
19
19
  const socket_io_1 = __importDefault(require("socket.io"));
@@ -22,6 +22,7 @@ const path_1 = __importDefault(require("path"));
22
22
  const instance_1 = require("../../instance");
23
23
  const listeners_1 = require("../../listeners");
24
24
  const middlewares_1 = require("../middlewares");
25
+ const requests_1 = require("../requests");
25
26
  const routes_1 = require("../routes");
26
27
  class Server {
27
28
  constructor(server) {
@@ -30,8 +31,10 @@ class Server {
30
31
  _Server_routesByKey.set(this, new Map());
31
32
  _Server_schemas.set(this, {});
32
33
  _Server_listener.set(this, null);
34
+ _Server_registeredTags.set(this, {});
33
35
  this.staticPath = path_1.default.join(process.cwd(), 'public');
34
36
  this.settings = instance_1.Instance.get().settings;
37
+ this.openapiJsonUrl = `${this.settings.openapiDocsPath}/openapi.json`;
35
38
  this.baseOpenapiDoc = {
36
39
  openapi: '3.0.0',
37
40
  info: { title: this.settings.appId, version: this.settings.openapiDocsVersion },
@@ -51,7 +54,8 @@ class Server {
51
54
  in: 'header',
52
55
  }
53
56
  },
54
- }
57
+ },
58
+ tags: [],
55
59
  };
56
60
  this.server = server;
57
61
  }
@@ -81,15 +85,22 @@ class Server {
81
85
  return (0, supertest_1.default)(this.server);
82
86
  }
83
87
  async start(port) {
88
+ this.addRoute({
89
+ method: 'get',
90
+ path: `${this.settings.openapiDocsPath}/index.html`,
91
+ handler: () => new requests_1.Response({
92
+ body: openapiHtml
93
+ .replaceAll('__API_TITLE__', this.settings.appId)
94
+ .replaceAll('__OPENAPI_JSON_URL__', './openapi.json'),
95
+ headers: { 'Content-Type': 'text/html' },
96
+ }),
97
+ hideSchema: true,
98
+ });
84
99
  this.addRoute({
85
100
  method: 'get',
86
101
  path: '__health',
87
102
  handler: async () => `${this.settings.appId} service running`,
88
- schema: {
89
- response: {
90
- 200: { type: 'string' }
91
- }
92
- },
103
+ hideSchema: true,
93
104
  });
94
105
  const started = await this.startServer(port);
95
106
  if (started)
@@ -98,25 +109,35 @@ class Server {
98
109
  }
99
110
  }
100
111
  exports.Server = Server;
101
- _Server_routesByPath = new WeakMap(), _Server_routesByKey = new WeakMap(), _Server_schemas = new WeakMap(), _Server_listener = new WeakMap(), _Server_instances = new WeakSet(), _Server_regRoute = function _Server_regRoute(route) {
112
+ _Server_routesByPath = new WeakMap(), _Server_routesByKey = new WeakMap(), _Server_schemas = new WeakMap(), _Server_listener = new WeakMap(), _Server_registeredTags = new WeakMap(), _Server_instances = new WeakSet(), _Server_registerTag = function _Server_registerTag(name, description) {
113
+ var _a;
114
+ if (__classPrivateFieldGet(this, _Server_registeredTags, "f")[name])
115
+ return;
116
+ __classPrivateFieldGet(this, _Server_registeredTags, "f")[name] = true;
117
+ (_a = this.baseOpenapiDoc).tags ?? (_a.tags = []);
118
+ this.baseOpenapiDoc.tags.push({ name, description });
119
+ }, _Server_regRoute = function _Server_regRoute(route) {
102
120
  const middlewares = [middlewares_1.parseAuthUser, ...(route.middlewares ?? [])];
103
- middlewares.forEach((m) => m.onSetup?.(route));
104
121
  route.onSetupHandler?.(route);
122
+ middlewares.forEach((m) => m.onSetup?.(route));
105
123
  route.onError?.onSetup?.(route);
106
124
  const { method, path, handler, schema, security, onError, hideSchema = false } = route;
107
125
  const pathKey = `(${method.toUpperCase()}) ${path}`;
108
126
  const { key = pathKey } = route;
109
- const scheme = schema ?? __classPrivateFieldGet(this, _Server_schemas, "f")[key] ?? {};
127
+ const groups = route.groups?.map((g) => typeof g === 'string' ? { name: g } : g) ?? [];
128
+ const groupName = groups.map((g) => g.name).join(' > ');
129
+ const groupDescription = groups.map((g) => g.description?.trim() ?? '').filter(Boolean).join('\n\n\n\n');
130
+ const scheme = Object.assign({}, schema, __classPrivateFieldGet(this, _Server_schemas, "f")[key]);
110
131
  const fullRoute = {
111
132
  method, middlewares, handler, key,
112
133
  path: (0, routes_1.cleanPath)(path),
113
134
  onError,
114
135
  schema: {
115
136
  ...scheme,
137
+ ...(scheme.title ? { summary: scheme.title } : {}),
116
138
  hide: hideSchema,
117
- operationId: scheme.operationId ?? handler.name,
118
- tags: route.groups?.length ? [route.groups.join(' > ')] : undefined,
119
- description: route.descriptions?.join(' | '),
139
+ tags: groups.length ? [groupName] : undefined,
140
+ description: route.descriptions?.join('\n\n'),
120
141
  security,
121
142
  }
122
143
  };
@@ -127,4 +148,28 @@ _Server_routesByPath = new WeakMap(), _Server_routesByKey = new WeakMap(), _Serv
127
148
  __classPrivateFieldGet(this, _Server_routesByPath, "f").set(pathKey, fullRoute);
128
149
  __classPrivateFieldGet(this, _Server_routesByKey, "f").set(key, fullRoute);
129
150
  this.registerRoute(fullRoute);
151
+ __classPrivateFieldGet(this, _Server_instances, "m", _Server_registerTag).call(this, groupName, groupDescription);
130
152
  };
153
+ const openapiHtml = `
154
+ <!doctype html>
155
+ <html>
156
+ <head>
157
+ <title>__API_TITLE__</title>
158
+ <meta charset="utf-8" />
159
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
160
+ <style>
161
+ .darklight-reference {
162
+ display: none;
163
+ }
164
+ </style>
165
+ </head>
166
+ <body>
167
+ <script id="api-reference" data-url="__OPENAPI_JSON_URL__"></script>
168
+ <script>
169
+ const configuration = { theme: 'purple' };
170
+ document.getElementById('api-reference').dataset.configuration = JSON.stringify(configuration);
171
+ </script>
172
+ <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
173
+ </body>
174
+ </html>
175
+ `;
@@ -1,6 +1,5 @@
1
1
  import express from 'express';
2
2
  import { Defined } from '../../types';
3
- import { Request, Response } from '../requests';
4
3
  import { Route } from '../types';
5
4
  import { FullRoute, Server } from './base';
6
5
  export declare class ExpressServer extends Server<express.Request, express.Response> {
@@ -40,7 +40,7 @@ class ExpressServer extends base_1.Server {
40
40
  const app = (0, express_1.default)();
41
41
  super(http_1.default.createServer(app));
42
42
  _ExpressServer_expressApp.set(this, void 0);
43
- _ExpressServer_oapi.set(this, (0, openapi_1.default)(`${this.settings.openapiDocsPath}/json`, this.baseOpenapiDoc, { coerce: false }));
43
+ _ExpressServer_oapi.set(this, (0, openapi_1.default)(this.openapiJsonUrl.replace('.json', ''), this.baseOpenapiDoc, { coerce: false }));
44
44
  _ExpressServer_ref.set(this, (0, json_schema_resolver_1.default)({ clone: true }));
45
45
  __classPrivateFieldSet(this, _ExpressServer_expressApp, app, "f");
46
46
  app.disable('x-powered-by');
@@ -49,12 +49,14 @@ class ExpressServer extends base_1.Server {
49
49
  app.use(express_1.default.json());
50
50
  app.use(express_1.default.text());
51
51
  app.use((0, cookie_parser_1.default)());
52
- app.use(helmet_1.default.crossOriginResourcePolicy({ policy: 'cross-origin' }));
52
+ app.use((0, helmet_1.default)({
53
+ crossOriginResourcePolicy: { policy: 'cross-origin' },
54
+ contentSecurityPolicy: false
55
+ }));
53
56
  app.use((0, cors_1.default)({ origin: '*' }));
54
57
  app.use(express_1.default.urlencoded({ extended: false }));
55
58
  app.use(express_1.default.static(this.staticPath));
56
59
  app.use(__classPrivateFieldGet(this, _ExpressServer_oapi, "f"));
57
- app.use(this.settings.openapiDocsPath, __classPrivateFieldGet(this, _ExpressServer_oapi, "f").swaggerui());
58
60
  app.use((0, express_fileupload_1.default)({
59
61
  limits: { fileSize: this.settings.maxFileUploadSizeInMb * 1024 * 1024 },
60
62
  useTempFiles: false
@@ -1,5 +1,3 @@
1
- /// <reference types="node/http" />
2
- /// <reference types="pino-http" />
3
1
  import { FastifyReply, FastifyRequest, preHandlerHookHandler, RouteHandlerMethod } from 'fastify';
4
2
  import { Defined } from '../../types';
5
3
  import { Request } from '../requests';
@@ -14,7 +12,7 @@ export declare class FastifyServer extends Server<FastifyRequest, FastifyReply>
14
12
  protected parse(req: FastifyRequest, res: FastifyReply): Promise<Request<import("../types").Api<any, string, import("../types").MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, import("../types").SupportedStatusCodes>>>;
15
13
  makeController(cb: Defined<Route['handler']>): RouteHandlerMethod;
16
14
  makeMiddleware(cb: Defined<Route['middlewares']>[number]['cb']): preHandlerHookHandler<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").RouteGenericInterface, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
17
- makeErrorMiddleware(cb: Defined<Route['onError']>['cb']): (error: import("fastify").FastifyError, request: FastifyRequest<import("fastify").RouteGenericInterface, import("fastify").RawServerDefault, import("http").IncomingMessage, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown, import("fastify").FastifyBaseLogger, import("fastify/types/type-provider").ResolveFastifyRequestType<import("fastify").FastifyTypeProviderDefault, import("fastify").FastifySchema, import("fastify").RouteGenericInterface>>, reply: FastifyReply<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").RouteGenericInterface, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>) => void;
15
+ makeErrorMiddleware(cb: Defined<Route['onError']>['cb']): (error: import("fastify").FastifyError, request: FastifyRequest, reply: FastifyReply) => void;
18
16
  }
19
17
  declare module 'fastify' {
20
18
  interface FastifyRequest {
@@ -24,7 +24,6 @@ const multipart_1 = __importDefault(require("@fastify/multipart"));
24
24
  const rate_limit_1 = __importDefault(require("@fastify/rate-limit"));
25
25
  const static_1 = __importDefault(require("@fastify/static"));
26
26
  const swagger_1 = __importDefault(require("@fastify/swagger"));
27
- const swagger_ui_1 = __importDefault(require("@fastify/swagger-ui"));
28
27
  const fastify_1 = __importDefault(require("fastify"));
29
28
  const qs_1 = __importDefault(require("qs"));
30
29
  const errors_1 = require("../../errors");
@@ -55,9 +54,11 @@ class FastifyServer extends base_1.Server {
55
54
  app.register(cookie_1.default, {});
56
55
  app.register(cors_1.default, { origin: '*' });
57
56
  app.register(swagger_1.default, { openapi: this.baseOpenapiDoc });
58
- app.register(swagger_ui_1.default, { routePrefix: this.settings.openapiDocsPath });
57
+ app.get(this.openapiJsonUrl, (_, res) => {
58
+ res.code(200).send(app.swagger({}));
59
+ });
59
60
  app.register(formbody_1.default, { parser: (str) => qs_1.default.parse(str) });
60
- app.register(helmet_1.default, { crossOriginResourcePolicy: { policy: 'cross-origin' } });
61
+ app.register(helmet_1.default, { crossOriginResourcePolicy: { policy: 'cross-origin' }, contentSecurityPolicy: false });
61
62
  app.register(multipart_1.default, {
62
63
  attachFieldsToBody: 'keyValues',
63
64
  throwFileSizeLimit: false,
@@ -1,4 +1,4 @@
1
1
  export declare const errorHandler: {
2
2
  cb: import("../types").ErrorHandler<import("../types").Api<any, string, import("../types").MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, import("../types").SupportedStatusCodes>>;
3
- onSetup?: import("../types").HandlerSetup | undefined;
3
+ onSetup?: import("../types").HandlerSetup;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  export declare const notFoundHandler: {
2
2
  cb: import("../types").RouteMiddlewareHandler<import("../types").Api<any, string, import("../types").MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, import("../types").SupportedStatusCodes>>;
3
- onSetup?: import("../types").HandlerSetup | undefined;
3
+ onSetup?: import("../types").HandlerSetup;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  export declare const parseAuthUser: {
2
2
  cb: import("../types").RouteMiddlewareHandler<import("../types").Api<any, string, import("../types").MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, import("../types").SupportedStatusCodes>>;
3
- onSetup?: import("../types").HandlerSetup | undefined;
3
+ onSetup?: import("../types").HandlerSetup;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  export declare const requireAuthUser: {
2
2
  cb: import("../types").RouteMiddlewareHandler<import("../types").Api<any, string, import("../types").MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, import("../types").SupportedStatusCodes>>;
3
- onSetup?: import("../types").HandlerSetup | undefined;
3
+ onSetup?: import("../types").HandlerSetup;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  export declare const requireRefreshUser: {
2
2
  cb: import("../types").RouteMiddlewareHandler<import("../types").Api<any, string, import("../types").MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, import("../types").SupportedStatusCodes>>;
3
- onSetup?: import("../types").HandlerSetup | undefined;
3
+ onSetup?: import("../types").HandlerSetup;
4
4
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Writable } from 'stream';
3
2
  import { CustomError } from '../errors';
4
3
  import { StorageFile } from '../storage';
@@ -57,6 +57,11 @@ export type RouteMiddlewareHandler<Def extends Api = Api> = (req: Request<Def>)
57
57
  export type HandlerSetup = (route: Route) => void;
58
58
  export type RouteSchema = Omit<FastifySchema, 'tags' | 'security' | 'hide' | 'description'> & {
59
59
  descriptions?: string[];
60
+ title?: string;
61
+ };
62
+ type RouteGroup = {
63
+ name: string;
64
+ description?: string;
60
65
  };
61
66
  export interface Route<Def extends ApiDef<AnyApi> = ApiDef<Api>> {
62
67
  key?: Def['key'];
@@ -67,7 +72,7 @@ export interface Route<Def extends ApiDef<AnyApi> = ApiDef<Api>> {
67
72
  middlewares?: ReturnType<typeof makeMiddleware>[];
68
73
  onError?: ReturnType<typeof makeErrorMiddleware>;
69
74
  schema?: RouteSchema;
70
- groups?: string[];
75
+ groups?: (RouteGroup | RouteGroup['name'])[];
71
76
  descriptions?: string[];
72
77
  hideSchema?: boolean;
73
78
  security?: Record<string, string[]>[];
@@ -83,6 +88,6 @@ declare class MiddlewareHandler<Cb extends Function> {
83
88
  private constructor();
84
89
  static make<Cb extends Function>(cb: Cb, onSetup?: HandlerSetup): MiddlewareHandler<Cb>;
85
90
  }
86
- export declare const makeMiddleware: <Def extends Api<any, string, MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, SupportedStatusCodes> = Api<any, string, MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, SupportedStatusCodes>>(cb: RouteMiddlewareHandler<Def>, onSetup?: HandlerSetup | undefined) => MiddlewareHandler<RouteMiddlewareHandler<Def>>;
87
- export declare const makeErrorMiddleware: <Def extends Api<any, string, MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, SupportedStatusCodes> = Api<any, string, MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, SupportedStatusCodes>>(cb: ErrorHandler<Def>, onSetup?: HandlerSetup | undefined) => MiddlewareHandler<ErrorHandler<Def>>;
91
+ export declare const makeMiddleware: <Def extends Api = Api<any, string, MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, SupportedStatusCodes>>(cb: RouteMiddlewareHandler<Def>, onSetup?: HandlerSetup | undefined) => MiddlewareHandler<RouteMiddlewareHandler<Def>>;
92
+ export declare const makeErrorMiddleware: <Def extends Api = Api<any, string, MethodTypes, any, Record<string, boolean>, Record<string, string>, Record<string, any>, Record<string, string | string[]>, SupportedStatusCodes>>(cb: ErrorHandler<Def>, onSetup?: HandlerSetup | undefined) => MiddlewareHandler<ErrorHandler<Def>>;
88
93
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export interface StorageFile {
3
2
  name: string;
4
3
  type: string;
@@ -1,21 +1,21 @@
1
1
  export declare const signinWithGoogle: (idToken: string) => Promise<{
2
2
  email: string;
3
- email_verified: 'true' | 'false';
3
+ email_verified: "true" | "false";
4
4
  first_name: string;
5
5
  last_name: string;
6
6
  picture: string;
7
7
  sub: string;
8
8
  } & Record<string, any>>;
9
9
  export declare const signinWithApple: (idToken: string) => Promise<{
10
- email?: string | undefined;
10
+ email?: string;
11
11
  sub: string;
12
- email_verified?: "false" | "true" | undefined;
13
- is_private_email?: "false" | "true" | undefined;
12
+ email_verified?: "true" | "false";
13
+ is_private_email?: "true" | "false";
14
14
  } & Record<string, any>>;
15
15
  export declare const signinWithFacebook: (accessToken: string, fields?: string[]) => Promise<{
16
16
  id: string;
17
17
  email: string;
18
- email_verified: 'true' | 'false';
18
+ email_verified: "true" | "false";
19
19
  name: string;
20
20
  picture: {
21
21
  data: {
@@ -1,2 +1 @@
1
- /// <reference types="node" />
2
1
  export declare const getMediaDuration: (buffer: Buffer) => Promise<number>;
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.clone = exports.Random = void 0;
6
+ exports.Random = void 0;
7
+ exports.clone = clone;
7
8
  const crypto_1 = __importDefault(require("crypto"));
8
9
  class Random {
9
10
  static string(length = 20) {
@@ -22,4 +23,3 @@ function clone(value) {
22
23
  return value;
23
24
  }
24
25
  }
25
- exports.clone = clone;
@@ -8,24 +8,24 @@ type Phone = {
8
8
  number: string;
9
9
  };
10
10
  export declare const Schema: {
11
- is: <T>(value: T, comparer?: ((val: any, comp: T) => boolean) | undefined, err?: string | undefined) => Validate.VCore<T>;
12
- in: <T_1>(values: readonly T_1[], comparer?: ((val: any, arrayItem: T_1) => boolean) | undefined, err?: string | undefined) => Validate.VCore<T_1>;
11
+ is: <T>(value: T, comparer?: (val: any, comp: T) => boolean, err?: string) => Validate.VCore<T>;
12
+ in: <T_1>(values: readonly T_1[], comparer?: (val: any, arrayItem: T_1) => boolean, err?: string) => Validate.VCore<T_1>;
13
13
  or: <T_2 extends Validate.VCore<any>[]>(options: T_2, err?: string | undefined) => import("valleyed/lib/api/junctions").VOr<T_2>;
14
14
  and: <I>(options: Validate.VCore<I>[], err?: string | undefined) => import("valleyed/lib/api/junctions").VAnd<I>;
15
15
  string: (err?: string | undefined) => import("valleyed/lib/api/strings").VString;
16
- discriminate: <D extends Record<string, Validate.VCore<any>>>(discriminator: (val: ExtractI<D[keyof D]>) => string, schemas: D, err?: string | undefined) => import("valleyed/lib/api/junctions").VDiscriminator<D>;
16
+ discriminate: <D extends Record<string, Validate.VCore<any>>>(discriminator: (val: import("valleyed/lib/api/base").ExtractI<D[keyof D]>) => string, schemas: D, err?: string | undefined) => import("valleyed/lib/api/junctions").VDiscriminator<D>;
17
17
  number: (err?: string | undefined) => import("valleyed/lib/api/numbers").VNumber;
18
18
  boolean: (err?: string | undefined) => import("valleyed/lib/api/booleans").VBoolean;
19
- time: <T_3 extends Validate.Timeable = Validate.Timeable>(err?: string | undefined) => import("valleyed/lib/api/times").VTime<T_3>;
19
+ time: <T_3 extends import("valleyed/lib/api/times").Timeable = import("valleyed/lib/api/times").Timeable>(err?: string | undefined) => import("valleyed/lib/api/times").VTime<T_3>;
20
20
  file: (err?: string | undefined) => import("valleyed/lib/api/files").VFile;
21
21
  array: <I_1>(comparer: Validate.VCore<I_1>, err?: string | undefined) => import("valleyed/lib/api/arrays").VArray<I_1>;
22
22
  tuple: <T_4 extends readonly Validate.VCore<any>[]>(schema: readonly [...T_4], err?: string | undefined) => import("valleyed/lib/api/tuples").VTuple<T_4>;
23
23
  object: <T_5 extends Record<string, Validate.VCore<any>>>(schema: T_5, trim?: boolean | undefined, err?: string | undefined) => VObject<T_5>;
24
24
  record: <VI>(vCom: Validate.VCore<VI>, err?: string | undefined) => import("valleyed/lib/api/records").VRecord<VI>;
25
25
  map: <KI, VI_1>(kCom: Validate.VCore<KI>, vCom: Validate.VCore<VI_1>, err?: string | undefined) => import("valleyed/lib/api/records").VMap<KI, VI_1>;
26
- null: (err?: string | undefined) => Validate.VCore<null>;
27
- undefined: (err?: string | undefined) => Validate.VCore<undefined>;
28
- instanceof: <T_6>(classDef: new () => T_6, err?: string | undefined) => Validate.VCore<T_6>;
26
+ null: (err?: string) => Validate.VCore<null>;
27
+ undefined: (err?: string) => Validate.VCore<undefined>;
28
+ instanceof: <T_6>(classDef: new () => T_6, err?: string) => Validate.VCore<T_6>;
29
29
  any: <T_7 = any>() => Validate.VCore<T_7>;
30
30
  force: {
31
31
  string: (err?: string | undefined) => import("valleyed/lib/api/strings").VString;
@@ -40,24 +40,24 @@ export declare const Validation: {
40
40
  Validator: typeof Validate.Validator;
41
41
  VCore: typeof Validate.VCore;
42
42
  v: {
43
- is: <T>(value: T, comparer?: ((val: any, comp: T) => boolean) | undefined, err?: string | undefined) => Validate.VCore<T>;
44
- in: <T_1>(values: readonly T_1[], comparer?: ((val: any, arrayItem: T_1) => boolean) | undefined, err?: string | undefined) => Validate.VCore<T_1>;
43
+ is: <T>(value: T, comparer?: (val: any, comp: T) => boolean, err?: string) => Validate.VCore<T>;
44
+ in: <T_1>(values: readonly T_1[], comparer?: (val: any, arrayItem: T_1) => boolean, err?: string) => Validate.VCore<T_1>;
45
45
  or: <T_2 extends Validate.VCore<any>[]>(options: T_2, err?: string | undefined) => import("valleyed/lib/api/junctions").VOr<T_2>;
46
46
  and: <I>(options: Validate.VCore<I>[], err?: string | undefined) => import("valleyed/lib/api/junctions").VAnd<I>;
47
47
  string: (err?: string | undefined) => import("valleyed/lib/api/strings").VString;
48
- discriminate: <D extends Record<string, Validate.VCore<any>>>(discriminator: (val: ExtractI<D[keyof D]>) => string, schemas: D, err?: string | undefined) => import("valleyed/lib/api/junctions").VDiscriminator<D>;
48
+ discriminate: <D extends Record<string, Validate.VCore<any>>>(discriminator: (val: import("valleyed/lib/api/base").ExtractI<D[keyof D]>) => string, schemas: D, err?: string | undefined) => import("valleyed/lib/api/junctions").VDiscriminator<D>;
49
49
  number: (err?: string | undefined) => import("valleyed/lib/api/numbers").VNumber;
50
50
  boolean: (err?: string | undefined) => import("valleyed/lib/api/booleans").VBoolean;
51
- time: <T_3 extends Validate.Timeable = Validate.Timeable>(err?: string | undefined) => import("valleyed/lib/api/times").VTime<T_3>;
51
+ time: <T_3 extends import("valleyed/lib/api/times").Timeable = import("valleyed/lib/api/times").Timeable>(err?: string | undefined) => import("valleyed/lib/api/times").VTime<T_3>;
52
52
  file: (err?: string | undefined) => import("valleyed/lib/api/files").VFile;
53
53
  array: <I_1>(comparer: Validate.VCore<I_1>, err?: string | undefined) => import("valleyed/lib/api/arrays").VArray<I_1>;
54
54
  tuple: <T_4 extends readonly Validate.VCore<any>[]>(schema: readonly [...T_4], err?: string | undefined) => import("valleyed/lib/api/tuples").VTuple<T_4>;
55
55
  object: <T_5 extends Record<string, Validate.VCore<any>>>(schema: T_5, trim?: boolean | undefined, err?: string | undefined) => VObject<T_5>;
56
56
  record: <VI>(vCom: Validate.VCore<VI>, err?: string | undefined) => import("valleyed/lib/api/records").VRecord<VI>;
57
57
  map: <KI, VI_1>(kCom: Validate.VCore<KI>, vCom: Validate.VCore<VI_1>, err?: string | undefined) => import("valleyed/lib/api/records").VMap<KI, VI_1>;
58
- null: (err?: string | undefined) => Validate.VCore<null>;
59
- undefined: (err?: string | undefined) => Validate.VCore<undefined>;
60
- instanceof: <T_6>(classDef: new () => T_6, err?: string | undefined) => Validate.VCore<T_6>;
58
+ null: (err?: string) => Validate.VCore<null>;
59
+ undefined: (err?: string) => Validate.VCore<undefined>;
60
+ instanceof: <T_6>(classDef: new () => T_6, err?: string) => Validate.VCore<T_6>;
61
61
  any: <T_7 = any>() => Validate.VCore<T_7>;
62
62
  force: {
63
63
  string: (err?: string | undefined) => import("valleyed/lib/api/strings").VString;
@@ -66,46 +66,46 @@ export declare const Validation: {
66
66
  time: (err?: string | undefined) => import("valleyed/lib/api/times").VTime<Date>;
67
67
  };
68
68
  };
69
- isEqualTo: <Type>(compare: Type, comparer?: ((val: any, compare: Type) => boolean) | undefined, error?: string | undefined) => Validate.Rule<Type>;
70
- isNotEqualTo: <Compare, Type_1>(compare: Compare, comparer?: ((val: Type_1, compare: Compare) => boolean) | undefined, error?: string | undefined) => Validate.Rule<Type_1>;
71
- arrayContains: <Type_2>(array: readonly Type_2[], comparer?: ((val: any, arrayItem: Type_2) => boolean) | undefined, error?: string | undefined) => Validate.Rule<Type_2>;
72
- arrayNotContains: <Compare_1, Type_3>(array: readonly Compare_1[], comparer?: ((val: Type_3, arrayItem: Compare_1) => boolean) | undefined, error?: string | undefined) => Validate.Rule<Type_3>;
73
- isString: (error?: string | undefined) => Validate.Rule<any>;
74
- isLengthOf: (length: number, stripHTMLTags?: boolean | undefined, error?: string | undefined) => Validate.Rule<string>;
75
- isMinOf: (length: number, stripHTMLTags?: boolean | undefined, error?: string | undefined) => Validate.Rule<string>;
76
- isMaxOf: (length: number, stripHTMLTags?: boolean | undefined, error?: string | undefined) => Validate.Rule<string>;
77
- isEmail: (error?: string | undefined) => Validate.Rule<string>;
78
- isUrl: (error?: string | undefined) => Validate.Rule<string>;
79
- isNumber: (error?: string | undefined) => Validate.Rule<any>;
80
- isInt: (error?: string | undefined) => Validate.Rule<any>;
81
- isMoreThan: (compare: number, error?: string | undefined) => Validate.Rule<number>;
82
- isMoreThanOrEqualTo: (compare: number, error?: string | undefined) => Validate.Rule<number>;
83
- isLessThan: (compare: number, error?: string | undefined) => Validate.Rule<number>;
84
- isLessThanOrEqualTo: (compare: number, error?: string | undefined) => Validate.Rule<number>;
85
- isArray: (error?: string | undefined) => Validate.Rule<any>;
86
- hasLengthOf: <Type_4>(length: number, error?: string | undefined) => Validate.Rule<Type_4[]>;
87
- hasMinOf: <Type_5>(length: number, error?: string | undefined) => Validate.Rule<Type_5[]>;
88
- hasMaxOf: <Type_6>(length: number, error?: string | undefined) => Validate.Rule<Type_6[]>;
89
- isArrayOf: <Type_7>(comparer: (cur: Type_7, idx: number) => boolean, error?: string | undefined) => Validate.Rule<Type_7[]>;
90
- isUndefined: (error?: string | undefined) => Validate.Rule<undefined>;
91
- isNull: (error?: string | undefined) => Validate.Rule<null>;
92
- isBoolean: (error?: string | undefined) => Validate.Rule<boolean>;
93
- isInstanceOf: <T>(classDef: new () => T, error?: string | undefined) => Validate.Rule<T>;
69
+ isEqualTo: <Type>(compare: Type, comparer?: (val: any, compare: Type) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Type>;
70
+ isNotEqualTo: <Compare, Type>(compare: Compare, comparer?: (val: Type, compare: Compare) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Type>;
71
+ arrayContains: <Type>(array: Readonly<Type[]>, comparer?: (val: any, arrayItem: Type) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Type>;
72
+ arrayNotContains: <Compare, Type>(array: Readonly<Compare[]>, comparer?: (val: Type, arrayItem: Compare) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Type>;
73
+ isString: (error?: string) => import("valleyed/lib/utils/rules").Rule<any>;
74
+ isLengthOf: (length: number, stripHTMLTags?: boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<string>;
75
+ isMinOf: (length: number, stripHTMLTags?: boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<string>;
76
+ isMaxOf: (length: number, stripHTMLTags?: boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<string>;
77
+ isEmail: (error?: string) => import("valleyed/lib/utils/rules").Rule<string>;
78
+ isUrl: (error?: string) => import("valleyed/lib/utils/rules").Rule<string>;
79
+ isNumber: (error?: string) => import("valleyed/lib/utils/rules").Rule<any>;
80
+ isInt: (error?: string) => import("valleyed/lib/utils/rules").Rule<any>;
81
+ isMoreThan: (compare: number, error?: string) => import("valleyed/lib/utils/rules").Rule<number>;
82
+ isMoreThanOrEqualTo: (compare: number, error?: string) => import("valleyed/lib/utils/rules").Rule<number>;
83
+ isLessThan: (compare: number, error?: string) => import("valleyed/lib/utils/rules").Rule<number>;
84
+ isLessThanOrEqualTo: (compare: number, error?: string) => import("valleyed/lib/utils/rules").Rule<number>;
85
+ isArray: (error?: string) => import("valleyed/lib/utils/rules").Rule<any>;
86
+ hasLengthOf: <Type>(length: number, error?: string) => import("valleyed/lib/utils/rules").Rule<Type[]>;
87
+ hasMinOf: <Type>(length: number, error?: string) => import("valleyed/lib/utils/rules").Rule<Type[]>;
88
+ hasMaxOf: <Type>(length: number, error?: string) => import("valleyed/lib/utils/rules").Rule<Type[]>;
89
+ isArrayOf: <Type>(comparer: (cur: Type, idx: number) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Type[]>;
90
+ isUndefined: (error?: string) => import("valleyed/lib/utils/rules").Rule<undefined>;
91
+ isNull: (error?: string) => import("valleyed/lib/utils/rules").Rule<null>;
92
+ isBoolean: (error?: string) => import("valleyed/lib/utils/rules").Rule<boolean>;
93
+ isInstanceOf: <T>(classDef: new () => T, error?: string) => import("valleyed/lib/utils/rules").Rule<T>;
94
94
  fileMimeTypes: string[];
95
95
  videoMimeTypes: string[];
96
96
  audioMimeTypes: string[];
97
97
  imageMimeTypes: string[];
98
- isImage: (error?: string | undefined) => Validate.Rule<import("valleyed/lib/types").File>;
99
- isAudio: (error?: string | undefined) => Validate.Rule<import("valleyed/lib/types").File>;
100
- isVideo: (error?: string | undefined) => Validate.Rule<import("valleyed/lib/types").File>;
101
- isFile: (error?: string | undefined) => Validate.Rule<import("valleyed/lib/types").File>;
102
- isTuple: <T_1 extends readonly ((v: any, idx: number) => boolean)[]>(comparer: readonly [...T_1], error?: string | undefined) => Validate.Rule<{ [K in keyof T_1]: T_1[K] extends (v: infer V, idx: number) => boolean ? V : never; }>;
103
- isRecord: <V_1>(com: (cur: V_1) => boolean, error?: string | undefined) => Validate.Rule<Record<string, V_1>>;
104
- isMap: <K_1, V_2>(kCom: (cur: K_1) => boolean, vCom: (cur: V_2) => boolean, error?: string | undefined) => Validate.Rule<Map<K_1, V_2>>;
105
- isCustom: <T_8>(validity: (v: T_8) => boolean, error?: string | undefined) => Validate.Rule<T_8>;
106
- isTime: <T_9 extends Validate.Timeable>(error?: string | undefined) => Validate.Rule<T_9>;
107
- isLaterThan: <T_10 extends Validate.Timeable>(compare: Validate.Timeable, error?: string | undefined) => Validate.Rule<T_10>;
108
- isEarlierThan: <T_11 extends Validate.Timeable>(compare: Validate.Timeable, error?: string | undefined) => Validate.Rule<T_11>;
98
+ isImage: (error?: string) => import("valleyed/lib/utils/rules").Rule<import("valleyed/lib/types").File>;
99
+ isAudio: (error?: string) => import("valleyed/lib/utils/rules").Rule<import("valleyed/lib/types").File>;
100
+ isVideo: (error?: string) => import("valleyed/lib/utils/rules").Rule<import("valleyed/lib/types").File>;
101
+ isFile: (error?: string) => import("valleyed/lib/utils/rules").Rule<import("valleyed/lib/types").File>;
102
+ isTuple: <T extends readonly ((v: any, idx: number) => boolean)[]>(comparer: Validate.GetMap<T>, error?: string) => import("valleyed/lib/utils/rules").Rule<{ [K in keyof T]: T[K] extends (v: infer V, idx: number) => boolean ? V : never; }>;
103
+ isRecord: <V>(com: (cur: V) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Record<string, V>>;
104
+ isMap: <K, V>(kCom: (cur: K) => boolean, vCom: (cur: V) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Map<K, V>>;
105
+ isCustom: <T>(validity: (v: T) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<T>;
106
+ isTime: <T extends Validate.Timeable>(error?: string) => import("valleyed/lib/utils/rules").Rule<T>;
107
+ isLaterThan: <T extends Validate.Timeable>(compare: Validate.Timeable, error?: string) => import("valleyed/lib/utils/rules").Rule<T>;
108
+ isEarlierThan: <T extends Validate.Timeable>(compare: Validate.Timeable, error?: string) => import("valleyed/lib/utils/rules").Rule<T>;
109
109
  ClassPropertiesWrapper: typeof Validate.ClassPropertiesWrapper;
110
110
  Differ: typeof Validate.Differ;
111
111
  capitalize: (text: string) => string;
@@ -115,46 +115,36 @@ export declare const Validation: {
115
115
  original: string;
116
116
  normalized: string;
117
117
  }[];
118
- formatNumber: (num: number, dp?: number | undefined) => string;
118
+ formatNumber: (num: number, dp?: number) => string;
119
119
  pluralize: (count: number, singular: string, plural: string) => string;
120
120
  getRandomValue: () => string;
121
- groupBy: <Type_8, Unique extends string | number>(array: Type_8[], func: (item: Type_8) => Unique) => {
121
+ groupBy: <Type, Unique extends string | number>(array: Array<Type>, func: (item: Type) => Unique) => {
122
122
  key: Unique;
123
- values: Type_8[];
123
+ values: Type[];
124
124
  }[];
125
125
  getAlphabet: (num: number) => string;
126
- addToArray: <T_12>(array: T_12[], item: T_12, getKey: (a: T_12) => any, getComparer: (a: T_12) => string | number, asc?: boolean | undefined) => T_12[];
126
+ addToArray: <T>(array: T[], item: T, getKey: (a: T) => any, getComparer: (a: T) => number | string, asc?: boolean) => T[];
127
127
  divideByZero: (num: number, den: number) => number;
128
128
  getPercentage: (num: number, den: number) => number;
129
- getRandomSample: <Type_9>(population: Type_9[], n: number) => Type_9[];
130
- shuffleArray: <Type_10>(array: Type_10[]) => Type_10[];
131
- chunkArray: <T_13>(arr: T_13[], size: number) => T_13[][];
129
+ getRandomSample: <Type>(population: Array<Type>, n: number) => Type[];
130
+ shuffleArray: <Type>(array: Array<Type>) => Type[];
131
+ chunkArray: <T>(arr: T[], size: number) => T[][];
132
132
  Geohash: typeof Validate.Geohash;
133
- isValid: <T_14>(value: T_14, ignored?: boolean | undefined) => {
133
+ isValid: <T>(value: T, ignored?: boolean) => {
134
134
  valid: true;
135
135
  errors: string[];
136
- value: T_14;
136
+ value: T;
137
137
  ignored: boolean;
138
138
  };
139
- isInvalid: <T_15>(errors: string[], value: T_15) => {
139
+ isInvalid: <T>(errors: string[], value: T) => {
140
140
  valid: false;
141
141
  errors: string[];
142
142
  value: unknown;
143
143
  ignored: boolean;
144
144
  };
145
- makeRule: <T_16>(func: Validate.Rule<T_16>) => Validate.Rule<T_16>;
146
- makeSanitizer: <T_17>(func: Validate.Sanitizer<T_17>) => (val: T_17) => T_17;
147
- check: <T_18>(value: T_18, rules: Validate.Rule<T_18>[], options?: Partial<Validate.Options> | undefined) => {
148
- valid: false;
149
- errors: string[];
150
- value: unknown;
151
- ignored: boolean;
152
- } | {
153
- valid: true;
154
- errors: string[];
155
- value: T_18;
156
- ignored: boolean;
157
- };
145
+ makeRule: <T>(func: Validate.Rule<T>) => Validate.Rule<T>;
146
+ makeSanitizer: <T>(func: Validate.Sanitizer<T>) => (val: T) => T;
147
+ check: <T>(value: T, rules: Validate.Rule<T>[], options?: Partial<Validate.Options>) => ReturnType<Validate.Rule<T>>;
158
148
  };
159
149
  export declare function validate<T extends Record<string, VCore<any>>>(schema: T, value: unknown): ExtractI<VObject<T>>;
160
150
  export declare function validate<T extends VCore<any>>(schema: T, value: unknown): ExtractI<T>;
@@ -23,7 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Hash = exports.validate = exports.Validation = exports.Schema = void 0;
26
+ exports.Hash = exports.Validation = exports.Schema = void 0;
27
+ exports.validate = validate;
27
28
  const bcrypt = __importStar(require("bcryptjs"));
28
29
  const Validate = __importStar(require("valleyed"));
29
30
  const errors_1 = require("../errors");
@@ -67,7 +68,6 @@ function validate(schema, value) {
67
68
  throw new errors_1.ValidationError(Object.entries(errorsObject)
68
69
  .map(([key, value]) => ({ field: key, messages: value })));
69
70
  }
70
- exports.validate = validate;
71
71
  const hash = async (password) => {
72
72
  password = password.trim();
73
73
  if (!password)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "equipped",
3
- "version": "5.0.0-alpha.4",
3
+ "version": "5.0.0-alpha.6",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "main": "lib/index.js",
@@ -46,7 +46,6 @@
46
46
  "@fastify/rate-limit": "^9.1.0",
47
47
  "@fastify/static": "^7.0.4",
48
48
  "@fastify/swagger": "^8.14.0",
49
- "@fastify/swagger-ui": "^3.1.0",
50
49
  "@wesleytodd/openapi": "^1.0.0",
51
50
  "amqp-connection-manager": "^4.1.14",
52
51
  "amqplib": "^0.10.4",