yinzerflow 0.1.18 → 0.2.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.
@@ -0,0 +1,116 @@
1
+ # YinzerFlow Documentation
2
+
3
+ Welcome to the YinzerFlow documentation! This directory contains comprehensive documentation for the YinzerFlow framework, a lightweight, modular HTTP server framework for Node.js built with TypeScript.
4
+
5
+ ## Contents
6
+
7
+ - [Routing System](./routing.md) - Comprehensive guide to the routing system, including route definition, parameters, and groups.
8
+ - [Request Lifecycle Hooks](./hooks.md) - In-depth documentation of the hooks system for intercepting and modifying requests.
9
+ - [Request Object](./request.md) - Complete guide to request properties: headers, body, query parameters, route parameters, and security features.
10
+ - [CORS Configuration](./cors.md) - Cross-Origin Resource Sharing setup and security considerations.
11
+ - [Error Handling](./error-handling.md) - Guide to handling errors at different levels in your application.
12
+
13
+ ## Getting Started
14
+
15
+ If you're new to YinzerFlow, we recommend starting with the examples in the `/example` directory:
16
+
17
+ - [TypeScript Example](/example/typescript/README.md) - A type-safe server implementation in TypeScript
18
+
19
+ ### Installation
20
+
21
+ You can install YinzerFlow using your preferred package manager:
22
+
23
+ ```bash
24
+ # Using npm
25
+ npm install yinzerflow
26
+
27
+ # Using Yarn
28
+ yarn add yinzerflow
29
+
30
+ # Using Bun
31
+ bun add yinzerflow
32
+ ```
33
+
34
+ ### Quick Start
35
+
36
+ Here's a minimal example to get a server up and running:
37
+
38
+ ```typescript
39
+ import { YinzerFlow } from 'yinzerflow';
40
+
41
+ // Create a new YinzerFlow instance
42
+ const app = new YinzerFlow({ port: 3000 });
43
+
44
+ // Add a simple route
45
+ app.get('/hello', () => {
46
+ return { message: 'Hello, World!' };
47
+ });
48
+
49
+ // Start the server
50
+ await app.listen();
51
+ const { port, isListening } = app.getStatus();
52
+
53
+ if (isListening) console.log(`Server running on http://localhost:${port}`);
54
+ ```
55
+
56
+ #### Graceful Shutdown
57
+
58
+ To implement graceful shutdown in your application:
59
+
60
+ ```typescript
61
+ // Graceful shutdown example
62
+ process.on('SIGTERM', async () => {
63
+ console.log('SIGTERM received, shutting down gracefully');
64
+
65
+ // This will:
66
+ // 1. Stop accepting new connections
67
+ // 2. Wait for existing connections to complete (up to the configured timeout)
68
+ // 3. Close the server
69
+ await app.close();
70
+
71
+ console.log('Server shut down gracefully');
72
+ process.exit(0);
73
+ });
74
+
75
+ app.listen();
76
+ console.log('Server running on http://localhost:3000');
77
+ ```
78
+
79
+ The `close()` method handles the entire shutdown process, including:
80
+ - Stopping the server from accepting new connections
81
+ - Waiting for existing connections to finish (respecting the configured timeout)
82
+ - Closing all remaining connections and the server itself
83
+
84
+ This ensures that your application can shut down cleanly without abruptly terminating active connections.
85
+
86
+ ## Contributing to Documentation
87
+
88
+ We welcome contributions to improve this documentation! If you find any issues or have suggestions for improvements, please feel free to submit a pull request.
89
+
90
+ When contributing to documentation:
91
+
92
+ 1. Use clear, concise language
93
+ 2. Include code examples where appropriate
94
+ 3. Follow Markdown best practices
95
+ 4. Test all links to ensure they work correctly
96
+
97
+ ## Documentation Structure
98
+
99
+ The documentation is organized as follows:
100
+
101
+ ```
102
+ docs/
103
+ ├── start-here.MD # This file - overview and getting started
104
+ ├── routing.md # Comprehensive guide to the routing system
105
+ ├── hooks.md # In-depth documentation of the hooks system
106
+ ├── request.md # Request object: headers, body, query, params, and security
107
+ ├── cors.md # CORS configuration and security considerations
108
+ ├── content-types.md # Working with different content types
109
+ ├── error-handling.md # Guide to handling errors at different levels in your application
110
+ ```
111
+
112
+ Additional documentation files will be added as the framework evolves, including:
113
+
114
+ - Performance optimization guides
115
+ - Deployment strategies
116
+ - Troubleshooting and FAQs
package/example/index.ts CHANGED
@@ -1,63 +1,119 @@
1
- /**
2
- * YinzerFlow TypeScript Example
3
- *
4
- * This example demonstrates how to create a type-safe HTTP server using YinzerFlow
5
- * with routes, middleware, and error handling.
6
- */
7
-
8
- import authenticationRoutes from './routes/authentication.routes.ts';
9
- import setupContentHandlers from './routes/content-types.ts';
10
- import { HttpStatusCode, YinzerFlow } from 'yinzerflow';
11
- import type { THttpStatusCode, TResponseBody } from 'yinzerflow';
12
-
13
- // Define response types for better type safety
14
- interface ServerResponse {
15
- success: boolean;
16
- message: string;
17
- timestamp?: string;
18
- }
19
-
20
- // Create a new YinzerFlow instance
21
- export const app = new YinzerFlow({
22
- port: 5000,
23
- connectionOptions: {
24
- socketTimeout: 30000,
25
- gracefulShutdownTimeout: 5000,
26
- keepAliveTimeout: 10000,
27
- headersTimeout: 30000,
1
+ import { YinzerFlow } from '@core/YinzerFlow.ts';
2
+ import type { HandlerCallback } from '@typedefs/public/Context.js';
3
+
4
+ const app = new YinzerFlow({
5
+ logLevel: 'verbose',
6
+ cors: {
7
+ enabled: true,
8
+ // SECURITY: Use specific origins instead of wildcard when credentials are enabled
9
+ // The CORS spec prohibits origin '*' with credentials: true
10
+ origin: ['http://localhost:3000', 'https://yourapp.com'],
11
+ exposedHeaders: ['X-Total-Count', 'X-Page-Info'],
12
+ allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With'],
13
+ methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
14
+ credentials: true,
15
+ maxAge: 86400,
16
+ preflightContinue: false,
17
+ optionsSuccessStatus: 204,
28
18
  },
29
- parserOptions: {
30
- yaml: {
31
- raw: true,
32
- },
33
- json: {
34
- raw: true,
35
- },
19
+ });
20
+
21
+ app.onError((ctx) => {
22
+ ctx.response.setStatusCode(404);
23
+ return {
24
+ success: false,
25
+ message: 'Something went wrong',
26
+ };
27
+ });
28
+
29
+ app.onNotFound((ctx) => {
30
+ ctx.response.setStatusCode(404);
31
+ return {
32
+ success: false,
33
+ message: 'Not Found',
34
+ };
35
+ });
36
+
37
+ app.beforeAll([
38
+ (ctx) => {
39
+ console.log('======== beforeAll ========');
36
40
  },
37
- errorHandler: ({ response }, error): TResponseBody<ServerResponse> => {
38
- console.error('Server error:', error);
39
- response.setStatus(HttpStatusCode.INTERNAL_SERVER_ERROR as THttpStatusCode);
40
- return {
41
- success: false,
42
- message: 'An unexpected error occurred',
43
- timestamp: new Date().toISOString(),
44
- };
41
+ ]);
42
+
43
+ app.afterAll([
44
+ (ctx) => {
45
+ ctx.response.setStatusCode(202);
46
+ console.log('afterAll');
45
47
  },
46
- });
48
+ ]);
49
+ app.group('/api', (app) => {
50
+ app.post(
51
+ '/get/:id',
52
+ ((ctx) => {
53
+ console.log('route handler');
54
+ console.log(ctx.request);
47
55
 
48
- // Setup routes
49
- app.get('/status', () => ({ success: true, message: 'Server is running' }));
56
+ return {
57
+ message: 'Hello World',
58
+ };
59
+ }) satisfies HandlerCallback<{
60
+ body: {
61
+ name: string;
62
+ };
63
+ response: {
64
+ message: string;
65
+ };
66
+ }>,
67
+ {
68
+ beforeHooks: [
69
+ (ctx) => {
70
+ ctx.response.setStatusCode(200);
71
+ console.log('beforeRoute');
72
+ },
73
+ ],
74
+ afterHooks: [
75
+ () => {
76
+ console.log('afterRoute');
77
+ },
78
+ ],
79
+ },
80
+ );
81
+ });
50
82
 
51
- // Setup content type handlers
52
- setupContentHandlers(app);
83
+ const callback: HandlerCallback<{
84
+ response: {
85
+ success: false;
86
+ message: string;
87
+ };
88
+ body: {
89
+ name: string;
90
+ };
91
+ query: {
92
+ name: string;
93
+ };
94
+ params: {
95
+ id: string;
96
+ };
97
+ }> = ({ request, response }) => {
98
+ response.setStatusCode(200);
53
99
 
54
- // Setup authentication routes
55
- app.group('/auth', authenticationRoutes);
100
+ console.log(request.query.name);
56
101
 
57
- // Start the server
58
- await app.listen();
59
- const { port, isListening } = app.getStatus();
102
+ return {
103
+ success: false,
104
+ message: 'Post request received',
105
+ };
106
+ };
60
107
 
61
- if (isListening) console.log(`Server running on http://localhost:${port}`);
108
+ app.post('/login', callback);
62
109
 
110
+ app.get('/api/data', ({ request }) => {
111
+ const userAgent = request.headers['user-agent'];
112
+ const accept = request.headers['accept'];
113
+ return {
114
+ success: true,
115
+ message: `userAgent: ${userAgent}, accept: ${accept}`,
116
+ };
117
+ });
63
118
 
119
+ await app.listen();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yinzerflow",
3
- "version": "0.1.18",
3
+ "version": "0.2.0",
4
4
  "author": "Patrick Rizzardi <patrick@redact.digital> (https://redact.digital)",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/yinzers/YinzerFlow.git",
@@ -22,36 +22,34 @@
22
22
  "bun",
23
23
  "yinzerflow"
24
24
  ],
25
- "types": "index.d.ts",
26
- "main": "index.js",
25
+ "types": "lib/YinzerFlow.d.ts",
26
+ "main": "lib/YinzerFlow.js",
27
27
  "type": "module",
28
28
  "scripts": {
29
- "test": "bun test --watch",
30
- "test:production": "bun test --timeout 20 --rerun-each 10 --bail 10",
29
+ "test": "bun test --watch --coverage",
30
+ "test:production": "bun test --timeout=20 --rerun-each=1 --bail --coverage",
31
31
  "clean": "rm -rf lib && rm -rf storage && echo 'Done.'",
32
32
  "build": "bun clean; bun build.ts",
33
33
  "start:example": "bun --watch example/index.ts",
34
- "start:dev": "bun --watch local/index.ts",
35
- "lint": "eslint . --fix --quiet --color --cache",
36
- "lint:format": "prettier --check .",
37
- "lint:spelling": "cspell . --no-progress --unique",
34
+ "lint": "eslint app --fix --quiet --color --cache",
35
+ "lint:format": "prettier --check app",
36
+ "lint:spelling": "cspell app --no-progress --unique",
38
37
  "lint:size": "gzip-size lib/index.js --include-original",
39
- "format": "prettier --write app"
38
+ "format": "prettier --write app",
39
+ "find-unused-packages": "bunx depcheck --quiet --ignores=cspell,eslint-import-resolver-typescript --skip-missing"
40
40
  },
41
41
  "dependencies": {
42
- "dayjs": "^1.11.13",
43
- "ip": "^2.0.1"
42
+ "dayjs": "^1.11.13"
44
43
  },
45
44
  "devDependencies": {
46
45
  "@eslint/compat": "^1.2.7",
47
- "@types/ip": "^1.1.3",
48
46
  "bun-plugin-dts": "^0.3.0",
49
- "bun-types": "1.0.3",
50
- "cspell": "^8.17.5",
47
+ "bun-types": "1.2.17",
48
+ "cspell": "^9.1.1",
51
49
  "eslint": "^9.22.0",
52
- "eslint-import-resolver-typescript": "^3.8.5",
50
+ "eslint-import-resolver-typescript": "^4.4.3",
53
51
  "eslint-plugin-import": "^2.31.0",
54
- "globals": "^15.15.0",
52
+ "globals": "^16.2.0",
55
53
  "gzip-size-cli": "^5.1.0",
56
54
  "prettier": "^3.5.3",
57
55
  "typescript": "^5.8.2",
@@ -1,86 +0,0 @@
1
- export declare const HttpStatus: {
2
- readonly OK: "OK";
3
- readonly CREATED: "Created";
4
- readonly NO_CONTENT: "No Content";
5
- readonly BAD_REQUEST: "Bad Request";
6
- readonly UNAUTHORIZED: "Unauthorized";
7
- readonly FORBIDDEN: "Forbidden";
8
- readonly NOT_FOUND: "Not Found";
9
- readonly METHOD_NOT_ALLOWED: "Method Not Allowed";
10
- readonly CONFLICT: "Conflict";
11
- readonly UNSUPPORTED_MEDIA_TYPE: "Unsupported Media Type";
12
- readonly TOO_MANY_REQUESTS: "Too Many Requests";
13
- readonly INTERNAL_SERVER_ERROR: "Internal Server Error";
14
- };
15
- export declare const HttpStatusCode: {
16
- readonly OK: 200;
17
- readonly CREATED: 201;
18
- readonly NO_CONTENT: 204;
19
- readonly BAD_REQUEST: 400;
20
- readonly UNAUTHORIZED: 401;
21
- readonly FORBIDDEN: 403;
22
- readonly NOT_FOUND: 404;
23
- readonly METHOD_NOT_ALLOWED: 405;
24
- readonly CONFLICT: 409;
25
- readonly UNSUPPORTED_MEDIA_TYPE: 415;
26
- readonly TOO_MANY_REQUESTS: 429;
27
- readonly INTERNAL_SERVER_ERROR: 500;
28
- };
29
- export declare const HttpMethod: {
30
- readonly DELETE: "DELETE";
31
- readonly GET: "GET";
32
- readonly POST: "POST";
33
- readonly PUT: "PUT";
34
- readonly PATCH: "PATCH";
35
- readonly HEAD: "HEAD";
36
- readonly OPTIONS: "OPTIONS";
37
- };
38
- export declare const ContentType: {
39
- readonly JSON: "application/json";
40
- readonly HTML: "text/html";
41
- readonly FORM: "application/x-www-form-urlencoded";
42
- readonly MULTIPART: "multipart/form-data";
43
- readonly XML: "application/xml";
44
- readonly TEXT: "text/plain";
45
- readonly CSV: "text/csv";
46
- readonly YAML_APPLICATION: "application/yaml";
47
- readonly YAML_TEXT: "text/yaml";
48
- readonly URL_ENCODED_JSON: "application/x-www-form-urlencoded+json";
49
- };
50
- export declare const RouteRegistryEvent: {
51
- readonly ROUTE_ADDED: "route:added";
52
- readonly ROUTE_REMOVED: "route:removed";
53
- readonly ROUTES_CHANGED: "routes:changed";
54
- };
55
- export declare const HookPhase: {
56
- readonly BEFORE_ALL: "before:all";
57
- readonly BEFORE_GROUP: "before:group";
58
- readonly BEFORE_HANDLER: "before:handler";
59
- readonly AFTER_HANDLER: "after:handler";
60
- };
61
- export declare const HookManagerEvent: {
62
- readonly HOOK_ADDED: "hook:added";
63
- readonly HOOK_EXECUTED: "hook:executed";
64
- readonly BEFORE_ALL_EXECUTED: "hook:before:all:executed";
65
- readonly BEFORE_GROUP_EXECUTED: "hook:before:group:executed";
66
- readonly BEFORE_HANDLER_EXECUTED: "hook:before:handler:executed";
67
- readonly AFTER_HANDLER_EXECUTED: "hook:after:handler:executed";
68
- };
69
- export declare const PathMatchingPattern: {
70
- readonly ALL_BUT_EXCLUDED: "allButExcluded";
71
- };
72
- export declare const ConnectionEvent: {
73
- readonly CONNECTION_ADDED: "connection-added";
74
- readonly CONNECTION_CLOSED: "connection-closed";
75
- readonly CONNECTION_ERROR: "connection-error";
76
- readonly ALL_CONNECTIONS_CLOSED: "all-connections-closed";
77
- readonly SERVER_STARTED: "server-started";
78
- readonly SERVER_STOPPED: "server-stopped";
79
- };
80
- export declare const DEFAULT_SOCKET_TIMEOUT = 30000;
81
- export declare const DEFAULT_KEEP_ALIVE_TIMEOUT = 65000;
82
- export declare const DEFAULT_HEADERS_TIMEOUT = 66000;
83
- export declare const DEFAULT_GRACEFUL_SHUTDOWN_TIMEOUT = 30000;
84
- export declare const DEFAULT_PORT = 5000;
85
-
86
- export {};
@@ -1,3 +0,0 @@
1
- var t={OK:"OK",CREATED:"Created",NO_CONTENT:"No Content",BAD_REQUEST:"Bad Request",UNAUTHORIZED:"Unauthorized",FORBIDDEN:"Forbidden",NOT_FOUND:"Not Found",METHOD_NOT_ALLOWED:"Method Not Allowed",CONFLICT:"Conflict",UNSUPPORTED_MEDIA_TYPE:"Unsupported Media Type",TOO_MANY_REQUESTS:"Too Many Requests",INTERNAL_SERVER_ERROR:"Internal Server Error"},E={OK:200,CREATED:201,NO_CONTENT:204,BAD_REQUEST:400,UNAUTHORIZED:401,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,CONFLICT:409,UNSUPPORTED_MEDIA_TYPE:415,TOO_MANY_REQUESTS:429,INTERNAL_SERVER_ERROR:500},T={DELETE:"DELETE",GET:"GET",POST:"POST",PUT:"PUT",PATCH:"PATCH",HEAD:"HEAD",OPTIONS:"OPTIONS"},n={JSON:"application/json",HTML:"text/html",FORM:"application/x-www-form-urlencoded",MULTIPART:"multipart/form-data",XML:"application/xml",TEXT:"text/plain",CSV:"text/csv",YAML_APPLICATION:"application/yaml",YAML_TEXT:"text/yaml",URL_ENCODED_JSON:"application/x-www-form-urlencoded+json"};var r={ROUTE_ADDED:"route:added",ROUTE_REMOVED:"route:removed",ROUTES_CHANGED:"routes:changed"};var o={BEFORE_ALL:"before:all",BEFORE_GROUP:"before:group",BEFORE_HANDLER:"before:handler",AFTER_HANDLER:"after:handler"},U={HOOK_ADDED:"hook:added",HOOK_EXECUTED:"hook:executed",BEFORE_ALL_EXECUTED:"hook:before:all:executed",BEFORE_GROUP_EXECUTED:"hook:before:group:executed",BEFORE_HANDLER_EXECUTED:"hook:before:handler:executed",AFTER_HANDLER_EXECUTED:"hook:after:handler:executed"},_={ALL_BUT_EXCLUDED:"allButExcluded"};var a={CONNECTION_ADDED:"connection-added",CONNECTION_CLOSED:"connection-closed",CONNECTION_ERROR:"connection-error",ALL_CONNECTIONS_CLOSED:"all-connections-closed",SERVER_STARTED:"server-started",SERVER_STOPPED:"server-stopped"},i=30000,A=65000,H=66000,L=30000,M=5000;export{r as RouteRegistryEvent,_ as PathMatchingPattern,E as HttpStatusCode,t as HttpStatus,T as HttpMethod,o as HookPhase,U as HookManagerEvent,i as DEFAULT_SOCKET_TIMEOUT,M as DEFAULT_PORT,A as DEFAULT_KEEP_ALIVE_TIMEOUT,H as DEFAULT_HEADERS_TIMEOUT,L as DEFAULT_GRACEFUL_SHUTDOWN_TIMEOUT,n as ContentType,a as ConnectionEvent};
2
-
3
- //# debugId=459840CEC834087264756E2164756E21
@@ -1,13 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../app/constants/http.ts", "../../app/constants/route.ts", "../../app/constants/hooks.ts", "../../app/constants/connection.ts"],
4
- "sourcesContent": [
5
- "/**\n * HTTP Constants\n *\n * This file contains all HTTP-related constants used throughout the application.\n * Centralizing these constants makes them easier to maintain and ensures consistency.\n */\n\n/**\n * HTTP Status Text\n * Maps status codes to their standard text representations\n */\nexport const HttpStatus = <const>{\n OK: 'OK',\n CREATED: 'Created',\n NO_CONTENT: 'No Content',\n BAD_REQUEST: 'Bad Request',\n UNAUTHORIZED: 'Unauthorized',\n FORBIDDEN: 'Forbidden',\n NOT_FOUND: 'Not Found',\n METHOD_NOT_ALLOWED: 'Method Not Allowed',\n CONFLICT: 'Conflict',\n UNSUPPORTED_MEDIA_TYPE: 'Unsupported Media Type',\n TOO_MANY_REQUESTS: 'Too Many Requests',\n INTERNAL_SERVER_ERROR: 'Internal Server Error',\n};\n\n/**\n * HTTP Status Codes\n * Standard HTTP status codes used in responses\n */\nexport const HttpStatusCode = <const>{\n OK: 200,\n CREATED: 201,\n NO_CONTENT: 204,\n BAD_REQUEST: 400,\n UNAUTHORIZED: 401,\n FORBIDDEN: 403,\n NOT_FOUND: 404,\n METHOD_NOT_ALLOWED: 405,\n CONFLICT: 409,\n UNSUPPORTED_MEDIA_TYPE: 415,\n TOO_MANY_REQUESTS: 429,\n INTERNAL_SERVER_ERROR: 500,\n};\n\n/**\n * HTTP Methods\n * Standard HTTP methods used in requests\n */\nexport const HttpMethod = <const>{\n DELETE: 'DELETE',\n GET: 'GET',\n POST: 'POST',\n PUT: 'PUT',\n PATCH: 'PATCH',\n HEAD: 'HEAD',\n OPTIONS: 'OPTIONS',\n};\n\n/**\n * Common Content Types\n * Frequently used content types for HTTP communication\n */\nexport const ContentType = <const>{\n JSON: 'application/json',\n HTML: 'text/html',\n FORM: 'application/x-www-form-urlencoded',\n MULTIPART: 'multipart/form-data',\n XML: 'application/xml',\n TEXT: 'text/plain',\n CSV: 'text/csv',\n YAML_APPLICATION: 'application/yaml',\n YAML_TEXT: 'text/yaml',\n URL_ENCODED_JSON: 'application/x-www-form-urlencoded+json',\n};\n",
6
- "import type { Enum } from 'types/Common.ts';\n\n/**\n * Events emitted by RouteRegistry\n *\n * These constants are used for the event system in the routing components.\n * Using 'as const' provides better type safety than enums.\n */\nexport const RouteRegistryEvent = <const>{\n /** Emitted when a new route is added */\n ROUTE_ADDED: 'route:added',\n /** Emitted when a route is removed */\n ROUTE_REMOVED: 'route:removed',\n /** Emitted when any change is made to the routes collection */\n ROUTES_CHANGED: 'routes:changed',\n};\n\n/**\n * Type for RouteRegistryEvent values\n * This creates a union type of all the string literal values\n */\nexport type TRouteRegistryEvent = Enum<typeof RouteRegistryEvent>;\n",
7
- "import type { Enum } from 'types/Common.ts';\n\n/**\n * Hook execution phases\n *\n * These constants define the different phases of hook execution\n * in the request lifecycle.\n */\nexport const HookPhase = <const>{\n /** Executed before any route-specific hooks */\n BEFORE_ALL: 'before:all',\n /** Executed for routes in a specific group */\n BEFORE_GROUP: 'before:group',\n /** Executed before a specific route handler */\n BEFORE_HANDLER: 'before:handler',\n /** Executed after a specific route handler */\n AFTER_HANDLER: 'after:handler',\n};\n\n/**\n * Type for HookPhase values\n */\nexport type THookPhase = Enum<typeof HookPhase>;\n\n/**\n * Events emitted by HooksManager\n *\n * These constants are used for the event system in the hooks components.\n */\nexport const HookManagerEvent = <const>{\n /** Emitted when a hook is added */\n HOOK_ADDED: 'hook:added',\n /** Emitted when a hook is executed */\n HOOK_EXECUTED: 'hook:executed',\n /** Emitted when a hook is executed before all routes */\n BEFORE_ALL_EXECUTED: 'hook:before:all:executed',\n /** Emitted when a hook is executed before a group */\n BEFORE_GROUP_EXECUTED: 'hook:before:group:executed',\n /** Emitted when a hook is executed before a handler */\n BEFORE_HANDLER_EXECUTED: 'hook:before:handler:executed',\n /** Emitted when a hook is executed after a handler */\n AFTER_HANDLER_EXECUTED: 'hook:after:handler:executed',\n};\n\n/**\n * Type for HookManagerEvent values\n */\nexport type THookManagerEvent = Enum<typeof HookManagerEvent>;\n\n/**\n * Special path matching patterns\n */\nexport const PathMatchingPattern = <const>{\n /** Apply hooks to all paths except those explicitly excluded */\n ALL_BUT_EXCLUDED: 'allButExcluded',\n};\n",
8
- "/**\n * Connection-related constants\n *\n * This file contains constants related to connection management in YinzerFlow.\n */\n\n/**\n * Connection events emitted by the ConnectionManager\n */\nexport const ConnectionEvent = <const>{\n /** Emitted when a new connection is established */\n CONNECTION_ADDED: 'connection-added',\n /** Emitted when a connection is closed */\n CONNECTION_CLOSED: 'connection-closed',\n /** Emitted when a connection error occurs */\n CONNECTION_ERROR: 'connection-error',\n /** Emitted when all connections are closed */\n ALL_CONNECTIONS_CLOSED: 'all-connections-closed',\n /** Emitted when the server starts listening */\n SERVER_STARTED: 'server-started',\n /** Emitted when the server stops listening */\n SERVER_STOPPED: 'server-stopped',\n};\n\n/**\n * Default socket timeout in milliseconds (30 seconds)\n *\n * Standard timeout for most socket connections.\n * It is long enough for slow clients but short enough to prevent idle connections from staying open indefinitely.\n */\nexport const DEFAULT_SOCKET_TIMEOUT = 30000;\n\n/**\n * Default keep-alive timeout in milliseconds (65 seconds)\n *\n * This is the maximum time a connection can be idle before the server will close it.\n * This is to allow for a connection to stay open for a period of time so subsequent requests can be handled without a new connection.\n * This is also to prevent a connection from staying open indefinitely.\n * This is also useful for load balancing and preventing a single server from being overwhelmed by a large number of connections.\n * AWS recommends a keep-alive timeout of 65 seconds because there idle timeout is 60 seconds.\n */\nexport const DEFAULT_KEEP_ALIVE_TIMEOUT = 65000;\n\n/**\n * Default headers timeout in milliseconds (66 seconds)\n *\n * This is the maximum time to wait for a header from the client.\n * This is to allow for a connection to stay open for a period of time so subsequent requests can be handled without a new connection.\n * This is also to prevent a connection from staying open indefinitely.\n * This is also useful for load balancing and preventing a single server from being overwhelmed by a large number of connections.\n * It is recommended to set this value to be greater than the keep-alive timeout to prevent the server from closing the connection prematurely\n * before the keep-alive timeout has expired.\n */\nexport const DEFAULT_HEADERS_TIMEOUT = 66000;\n\n/**\n * Default graceful shutdown timeout in milliseconds (30 seconds)\n *\n * This is the maximum time to wait for a connection to complete before the server will close it.\n */\nexport const DEFAULT_GRACEFUL_SHUTDOWN_TIMEOUT = 30000;\n\n/**\n * Default port for the server\n */\nexport const DEFAULT_PORT = 5000;\n"
9
- ],
10
- "mappings": "AAWO,IAAM,EAAoB,CAC/B,GAAI,KACJ,QAAS,UACT,WAAY,aACZ,YAAa,cACb,aAAc,eACd,UAAW,YACX,UAAW,YACX,mBAAoB,qBACpB,SAAU,WACV,uBAAwB,yBACxB,kBAAmB,oBACnB,sBAAuB,uBACzB,EAMa,EAAwB,CACnC,GAAI,IACJ,QAAS,IACT,WAAY,IACZ,YAAa,IACb,aAAc,IACd,UAAW,IACX,UAAW,IACX,mBAAoB,IACpB,SAAU,IACV,uBAAwB,IACxB,kBAAmB,IACnB,sBAAuB,GACzB,EAMa,EAAoB,CAC/B,OAAQ,SACR,IAAK,MACL,KAAM,OACN,IAAK,MACL,MAAO,QACP,KAAM,OACN,QAAS,SACX,EAMa,EAAqB,CAChC,KAAM,mBACN,KAAM,YACN,KAAM,oCACN,UAAW,sBACX,IAAK,kBACL,KAAM,aACN,IAAK,WACL,iBAAkB,mBAClB,UAAW,YACX,iBAAkB,wCACpB,EClEO,IAAM,EAA4B,CAEvC,YAAa,cAEb,cAAe,gBAEf,eAAgB,gBAClB,ECPO,IAAM,EAAmB,CAE9B,WAAY,aAEZ,aAAc,eAEd,eAAgB,iBAEhB,cAAe,eACjB,EAYa,EAA0B,CAErC,WAAY,aAEZ,cAAe,gBAEf,oBAAqB,2BAErB,sBAAuB,6BAEvB,wBAAyB,+BAEzB,uBAAwB,6BAC1B,EAUa,EAA6B,CAExC,iBAAkB,gBACpB,EC9CO,IAAM,EAAyB,CAEpC,iBAAkB,mBAElB,kBAAmB,oBAEnB,iBAAkB,mBAElB,uBAAwB,yBAExB,eAAgB,iBAEhB,eAAgB,gBAClB,EAQa,EAAyB,MAWzB,EAA6B,MAY7B,EAA0B,MAO1B,EAAoC,MAKpC,EAAe",
11
- "debugId": "459840CEC834087264756E2164756E21",
12
- "names": []
13
- }