Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 12x 4x 8x 12x 16x 16x 16x | /**
* Constantes compartilhadas do Vitek
*/
export const HTTP_METHODS = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options'] as const;
export type HttpMethod = typeof HTTP_METHODS[number];
export const API_BASE_PATH = '/api';
export const API_DIR_NAME = 'api';
export const GENERATED_TYPES_FILE = 'api.types.ts';
export const GENERATED_SERVICES_FILE = 'api.services.ts';
// Padrões de nomeação de arquivos
export const ROUTE_FILE_PATTERN = /^(.+)\.(get|post|put|patch|delete|head|options)\.(ts|js)$/;
export const MIDDLEWARE_FILE_PATTERN = /^middleware\.(ts|js)$/;
export const SOCKET_FILE_PATTERN = /^(.+)\.socket\.(ts|js)$/;
export const PARAM_PATTERN = /\[(\.\.\.)?([^\]]+)\]/g;
// WebSocket (default: under API path)
export const SOCKET_BASE_PATH = `${API_BASE_PATH}/ws`;
/**
* Resolves socket base path. Use when apiBasePath or custom socket path may override.
* Plugin option sockets: { path: '/ws' } uses path as-is; otherwise defaults to apiBasePath + '/ws'.
*/
export function getSocketBasePath(apiBasePath?: string, customSocketPath?: string): string {
if (customSocketPath != null && customSocketPath !== '') {
return customSocketPath.startsWith('/') ? customSocketPath : `/${customSocketPath}`;
}
const base = apiBasePath ?? API_BASE_PATH;
return base.endsWith('/') ? `${base.slice(0, -1)}/ws` : `${base}/ws`;
}
export const GENERATED_SOCKET_TYPES_FILE = 'socket.types.ts';
export const GENERATED_SOCKET_SERVICES_FILE = 'socket.services.ts';
export const VITEK_SOCKETS_BUNDLE_FILENAME = 'vitek-sockets.mjs';
|