xypriss 9.0.13 → 9.1.1
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/.agent/workflows/build-xems.md +9 -0
- package/.editorconfig +12 -0
- package/.env.test +4 -0
- package/.github/FUNDING.yml +15 -0
- package/.github/dependabot.yml +11 -0
- package/.github/workflows/codeql.yml +98 -0
- package/.github/workflows/release.yml +91 -0
- package/.private/.meta/+xypriss.meta.ts +6 -0
- package/.private/ACPES_UTF8_FIXES.md +129 -0
- package/.private/PLUGIN_API_TEST_PLAN.md +555 -0
- package/.private/README.md +6 -0
- package/.private/SESSION_SUMMARY_2025-12-12.md +229 -0
- package/.private/XYPRISS_BUG_FIX_REPORT.md +198 -0
- package/.private/XYPRISS_BUG_REPORT.md +140 -0
- package/.private/XYPRISS_RUST_CORE_BRAINSTORM.md +110 -0
- package/.private/acpes_gl_test.ts +38 -0
- package/.private/acpes_test_data.txt +6 -0
- package/.private/algos/comparison.md +87 -0
- package/.private/configs-example.ts +290 -0
- package/.private/configs.ts +22 -0
- package/.private/console-demo-simple.ts +61 -0
- package/.private/console-interception-examples.ts +260 -0
- package/.private/const.ts +6 -0
- package/.private/cpu.bench.md +53 -0
- package/.private/create_test_files.ts +43 -0
- package/.private/diagnose-proxy.cjs +176 -0
- package/.private/feedb.md +16 -0
- package/.private/filesystem-api.md +119 -0
- package/.private/fw.ts +10 -0
- package/.private/goserver.ts +56 -0
- package/.private/important/xm +12 -0
- package/.private/index.html +23 -0
- package/.private/intensive_test_server.ts +244 -0
- package/.private/k.md +2 -0
- package/.private/middlewares/testMiddleware.ts +11 -0
- package/.private/ms1.ts +12 -0
- package/.private/ms1_router2.ts +13 -0
- package/.private/ms1router.ts +10 -0
- package/.private/mserver.ts +14 -0
- package/.private/otherRouterFromFile.ts +11 -0
- package/.private/package_manager_brainstorming.md +804 -0
- package/.private/payload.json +46 -0
- package/.private/plg.json +3 -0
- package/.private/plugins/+plg.ts +8 -0
- package/.private/plugins/authServer.ts +24 -0
- package/.private/plugins/mainServer.ts +28 -0
- package/.private/plugins/t.ts +7 -0
- package/.private/productionCsp.ts +48 -0
- package/.private/repro_memory_error.ts +10 -0
- package/.private/repro_memory_error_dist.ts +10 -0
- package/.private/repro_sys.ts +10 -0
- package/.private/response_control_demo.ts +57 -0
- package/.private/rex.ts +22 -0
- package/.private/router/auth.route.ts +96 -0
- package/.private/router/index.router.ts +20 -0
- package/.private/router/index.ts +35 -0
- package/.private/router/v1.route.ts +9 -0
- package/.private/sandbox/xms/router/index.ts +12 -0
- package/.private/sandbox/xms/router/xserver1.route.ts +12 -0
- package/.private/sandbox/xms/router/xserver2.route.ts +37 -0
- package/.private/sandbox/xms/server.ts +14 -0
- package/.private/sandbox/xms/servers/xserver1.ts +8 -0
- package/.private/sandbox/xms/servers/xserver2.ts +6 -0
- package/.private/security-example.ts +149 -0
- package/.private/serializer.ts +13 -0
- package/.private/server.ts +200 -0
- package/.private/server2.ts +12 -0
- package/.private/test-mob.ts +15 -0
- package/.private/test-pkce.ts +43 -0
- package/.private/test-proxy.cjs +161 -0
- package/.private/test-query-endpoint.ts +28 -0
- package/.private/test-query-params-fix.cjs +184 -0
- package/.private/test-ratelimit.ts +27 -0
- package/.private/test-router.ts +40 -0
- package/.private/test-server-prod.ts +43 -0
- package/.private/test-server.ts +55 -0
- package/.private/test-trust-proxy-ranges.cjs +139 -0
- package/.private/test.json +53 -0
- package/.private/test.pluging.ts +37 -0
- package/.private/testPlugin_Logger.ts +20 -0
- package/.private/test_lifecycle_hooks.ts +120 -0
- package/.private/test_methods_suite.ts +134 -0
- package/.private/test_multi_server.ts +62 -0
- package/.private/test_plugin_api.ts +150 -0
- package/.private/test_upload.ts +103 -0
- package/.private/test_upload_comprehensive.ts +185 -0
- package/.private/testing-meta-config/.meta/+xypriss.meta.ts +4 -0
- package/.private/testing-meta-config/.quickdevignore +1 -0
- package/.private/testing-meta-config/README.md +238 -0
- package/.private/testing-meta-config/bun.lock +1184 -0
- package/.private/testing-meta-config/package-lock.json +4172 -0
- package/.private/testing-meta-config/package.json +31 -0
- package/.private/testing-meta-config/quickdev.config.json +34 -0
- package/.private/testing-meta-config/src/configs/host.conf.ts +83 -0
- package/.private/testing-meta-config/src/configs/xypriss.config.ts +45 -0
- package/.private/testing-meta-config/src/middleware/index.ts +40 -0
- package/.private/testing-meta-config/src/middleware/security.mlw.ts +29 -0
- package/.private/testing-meta-config/src/middleware/validation.middleware.ts +53 -0
- package/.private/testing-meta-config/src/routes/index.ts +97 -0
- package/.private/testing-meta-config/src/schema/user.schema.ts +8 -0
- package/.private/testing-meta-config/src/server.ts +67 -0
- package/.private/testing-meta-config/tsconfig.json +31 -0
- package/.private/testing-meta-config/xypriss.config.json +12 -0
- package/.private/type-safe-configs.ts +323 -0
- package/.private/upload_router.ts +28 -0
- package/.private/upload_serv.ts +48 -0
- package/.private/xms.md +1 -0
- package/.private/xvault.xems +0 -0
- package/.private/xypriss-cors-methods-array-bug.md +297 -0
- package/.quickdevignore +3 -0
- package/CONTRIBUTING.md +411 -0
- package/README.md +2 -1
- package/RELEASE_XFPM_G0.1.48.md +30 -0
- package/__tests__/COMPRESSION_FIX_SUMMARY.md +268 -0
- package/__tests__/COMPRESSION_PLUGIN_COMPLETE.md +224 -0
- package/__tests__/COMPRESSION_PLUGIN_IMPLEMENTATION_PLAN.md +253 -0
- package/__tests__/README.md +192 -0
- package/__tests__/TEST_INVESTIGATION_REPORT.md +247 -0
- package/__tests__/XYPRISS_COMPRESSION_SUMMARY.md +279 -0
- package/__tests__/acpes.test.html +12 -0
- package/__tests__/acpes_gl_test.ts +38 -0
- package/__tests__/analytics-engine.test.ts +292 -0
- package/__tests__/automatic-json-parsing.js +188 -0
- package/__tests__/bun-port-test.ts +186 -0
- package/__tests__/bun_cluster_test.ts +603 -0
- package/__tests__/bun_cluster_testv2.ts +448 -0
- package/__tests__/cache-persistence-fix-test.ts +149 -0
- package/__tests__/cache_testing/simplified_cache_test.ts +114 -0
- package/__tests__/cache_testing/test_redis_cache.ts +62 -0
- package/__tests__/cache_testing/type_safety_test.ts +200 -0
- package/__tests__/check_date.ts +10 -0
- package/__tests__/cluster_test.cjs +583 -0
- package/__tests__/cluster_test.js +38 -0
- package/__tests__/comprehensive-port-test.ts +192 -0
- package/__tests__/console.test.ts +262 -0
- package/__tests__/cors-multiserver-bug.test.ts +243 -0
- package/__tests__/cors-test-server.ts +124 -0
- package/__tests__/cors-test.html +98 -0
- package/__tests__/cors.test.ts +325 -0
- package/__tests__/crypto-operations.test.ts +334 -0
- package/__tests__/debug-conflict.js +69 -0
- package/__tests__/debug-memory.js +94 -0
- package/__tests__/debug-port.js +66 -0
- package/__tests__/debug-security.ts +54 -0
- package/__tests__/debug-server-startup.ts +187 -0
- package/__tests__/debug-test.js +73 -0
- package/__tests__/debug_logging.ts +104 -0
- package/__tests__/example-circular-fix.cjs +133 -0
- package/__tests__/express-listen-test.ts +144 -0
- package/__tests__/fObject.test.ts +38 -0
- package/__tests__/fast-routing-example.ts +166 -0
- package/__tests__/final-port-switch-test.ts +192 -0
- package/__tests__/fix-imports.cjs +109 -0
- package/__tests__/gl.ts +137 -0
- package/__tests__/gl_ts.ts +49 -0
- package/__tests__/glob.test.ts +11 -0
- package/__tests__/integration.test.ts +414 -0
- package/__tests__/memory-manager.test.ts +401 -0
- package/__tests__/memory-optimized-cluster.ts +359 -0
- package/__tests__/memory_friendly_test.ts +444 -0
- package/__tests__/middleware-id-tracking.test.ts +344 -0
- package/__tests__/middleware-system.test.ts +149 -0
- package/__tests__/middleware_test1.ts +61 -0
- package/__tests__/mobile-test/test-okhttp.js +71 -0
- package/__tests__/multi-server-404-config-test.ts +346 -0
- package/__tests__/network-plugin-example.js +203 -0
- package/__tests__/network-plugins-comprehensive.test.ts +523 -0
- package/__tests__/network-plugins-manual-demo.ts +376 -0
- package/__tests__/network-plugins-quick-test.ts +132 -0
- package/__tests__/object-collection-tracking.test.ts +337 -0
- package/__tests__/optimization-engine.test.ts +394 -0
- package/__tests__/plugin-system-test.ts +92 -0
- package/__tests__/plugins/+plg.ts +8 -0
- package/__tests__/plugins/t.ts +7 -0
- package/__tests__/port-availability-test.ts +153 -0
- package/__tests__/port-switch-conflict-test.ts +144 -0
- package/__tests__/port-switch-debug.ts +116 -0
- package/__tests__/rate-limiting.test.ts +221 -0
- package/__tests__/rate_lim.ts +44 -0
- package/__tests__/redirect.ts +164 -0
- package/__tests__/redis_cache_test.ts +25 -0
- package/__tests__/repro_rate_limit.ts +24 -0
- package/__tests__/router/index.ts +13 -0
- package/__tests__/router/test_router.ts +57 -0
- package/__tests__/router copy/index.router.ts +20 -0
- package/__tests__/router_test.ts +32 -0
- package/__tests__/run-all-tests.ts +179 -0
- package/__tests__/run-network-tests.sh +261 -0
- package/__tests__/run-placeholder-tests.ts +137 -0
- package/__tests__/security-example.ts +149 -0
- package/__tests__/security.test.ts +305 -0
- package/__tests__/server-creation.test.ts +253 -0
- package/__tests__/server.test.ts +70 -0
- package/__tests__/simple-port-test.ts +180 -0
- package/__tests__/simple_router_test.ts +45 -0
- package/__tests__/stress-test-network-plugins-fixed.sh +305 -0
- package/__tests__/stress-test-network-plugins.sh +328 -0
- package/__tests__/stress_test_intelligence.sh +384 -0
- package/__tests__/test/bun.lock +846 -0
- package/__tests__/test-acpes-utf8-fix.js +105 -0
- package/__tests__/test-acpes.js +102 -0
- package/__tests__/test-advanced-encryption.js +163 -0
- package/__tests__/test-all-network-plugins.mjs +353 -0
- package/__tests__/test-auto-port.cjs +109 -0
- package/__tests__/test-auto-ts/auto-check-test.ts +18 -0
- package/__tests__/test-cache-persistence-fix.ts +195 -0
- package/__tests__/test-circular-reference-fix.ts +214 -0
- package/__tests__/test-cluster-startup copy.ts +222 -0
- package/__tests__/test-cluster-startup.ts +222 -0
- package/__tests__/test-console-debug.ts +106 -0
- package/__tests__/test-cors.js +36 -0
- package/__tests__/test-ffunc.ts +138 -0
- package/__tests__/test-import.mjs +63 -0
- package/__tests__/test-integrated-network-plugins.mjs +493 -0
- package/__tests__/test-interface.ts +40 -0
- package/__tests__/test-json-parsing.mjs +87 -0
- package/__tests__/test-local-import.cjs +25 -0
- package/__tests__/test-local-import.js +28 -0
- package/__tests__/test-memory-cli.js +21 -0
- package/__tests__/test-modular.js +141 -0
- package/__tests__/test-no-conflict.ts +107 -0
- package/__tests__/test-port-conflict.js +64 -0
- package/__tests__/test-port-error.js +41 -0
- package/__tests__/test-port-manager.js +64 -0
- package/__tests__/test-power.ts +54 -0
- package/__tests__/test-realistic-bug-scenario.ts +101 -0
- package/__tests__/test-resilience.ts +53 -0
- package/__tests__/test-ultra-fast.ts +121 -0
- package/__tests__/test-user-example.mjs +114 -0
- package/__tests__/test-xhsc.ts +90 -0
- package/__tests__/test_cluster.ts +342 -0
- package/__tests__/test_cluster_simple.ts +221 -0
- package/__tests__/test_csrf_and_final.ts +187 -0
- package/__tests__/test_logging.ts +140 -0
- package/__tests__/test_manual_multer.ts +59 -0
- package/__tests__/test_manual_multer_client.ts +62 -0
- package/__tests__/test_matchit.rs +14 -0
- package/__tests__/test_plugins.ts +307 -0
- package/__tests__/test_real_cpu_work.ts +317 -0
- package/__tests__/test_request_management.ts +161 -0
- package/__tests__/test_router_and_middleware.ts +154 -0
- package/__tests__/test_upload.ts +62 -0
- package/__tests__/test_worker_direct.ts +77 -0
- package/__tests__/test_worker_pool.ts +224 -0
- package/__tests__/test_xjson.sh +21 -0
- package/__tests__/utils/cache.ts +15 -0
- package/__tests__/verify-network-plugins.sh +248 -0
- package/__tests__/wildcard-cors.test.ts +90 -0
- package/cache/.write_test +1 -0
- package/docs/ENVIRONMENT_SHIELD.md +68 -0
- package/docs/README.md +49 -0
- package/docs/XEMS_TUTORIAL.md +205 -0
- package/docs/cluster/MULTI_SERVER.md +479 -0
- package/docs/cluster/cluster-configuration-guide.md +92 -0
- package/docs/cluster/cluster-overview.md +33 -0
- package/docs/cluster/cluster-performance-tuning-updated.md +78 -0
- package/docs/cluster/multi-server.md +288 -0
- package/docs/config/CFG_API.md +61 -0
- package/docs/config/CONFIGS_API.md +414 -0
- package/docs/config/CONFIGS_QUICK_REFERENCE.md +124 -0
- package/docs/config/META_CONFIG.md +65 -0
- package/docs/config/NETWORK_CONFIG_GUIDE.md +441 -0
- package/docs/config/configuration.md +383 -0
- package/docs/core/CONST_API.md +88 -0
- package/docs/core/GLOBAL_APIS.md +190 -0
- package/docs/core/MEMORY_DETECTION.md +206 -0
- package/docs/core/MIDDLEWARE_ARCHITECTURE.md +227 -0
- package/docs/core/SERVER_CORE_ARCHITECTURE.md +68 -0
- package/docs/core/WORKSPACE_SYSTEM.md +97 -0
- package/docs/core/XHSC_CORE.md +90 -0
- package/docs/core/api-reference.md +406 -0
- package/docs/core/memory-management.md +350 -0
- package/docs/features/CONSOLE_INTERCEPTION_GUIDE.md +698 -0
- package/docs/features/CONSOLE_INTERCEPT_HOOK.md +516 -0
- package/docs/features/FILE_UPLOAD_GUIDE.md +486 -0
- package/docs/features/SYSTEM_INTELLIGENCE.md +81 -0
- package/docs/features/XJSON_API.md +445 -0
- package/docs/features/browser-terminal-control.md +707 -0
- package/docs/features/file-upload.md +674 -0
- package/docs/features/filesystem-api.md +242 -0
- package/docs/features/xfpm.md +157 -0
- package/docs/guides/EXAMPLES.md +483 -0
- package/docs/guides/FEATURES_OVERVIEW.md +59 -0
- package/docs/guides/INSTALLATION.md +114 -0
- package/docs/guides/QUICK_START.md +278 -0
- package/docs/guides/getting-started.md +472 -0
- package/docs/plugins/PLUGIN_API_IMPLEMENTATION.md +151 -0
- package/docs/plugins/PLUGIN_CORE_HOOKS.md +212 -0
- package/docs/plugins/PLUGIN_DATA_MASKING.md +53 -0
- package/docs/plugins/PLUGIN_DEVELOPMENT_GUIDE.md +1158 -0
- package/docs/plugins/PLUGIN_ERROR_HANDLING.md +82 -0
- package/docs/plugins/PLUGIN_MANAGEMENT_API.md +92 -0
- package/docs/plugins/PLUGIN_PERMISSIONS.md +123 -0
- package/docs/plugins/PLUGIN_STABILITY.md +66 -0
- package/docs/plugins/PLUGIN_SYSTEM_GUIDE.md +714 -0
- package/docs/plugins/plugins.md +550 -0
- package/docs/routing/HTTP_METHODS_REFERENCE.md +152 -0
- package/docs/routing/ROUTING.md +145 -0
- package/docs/routing/routing.md +456 -0
- package/docs/security/RATE_LIMIT_EXCLUSIONS.md +85 -0
- package/docs/security/ROUTE_BASED_SECURITY.md +373 -0
- package/docs/security/SECURITY.md +285 -0
- package/docs/security/TRUST_PROXY.md +353 -0
- package/docs/security/WILDCARD_CORS.md +284 -0
- package/docs/security/access-control-middleware.md +366 -0
- package/docs/security/advanced-cors-regexp.md +612 -0
- package/docs/security/enhanced-csp-configuration.md +520 -0
- package/docs/security/request-signature-auth.md +456 -0
- package/docs/security/security-features-overview.md +483 -0
- package/docs/system/README.md +202 -0
- package/docs/system/complete-reference.md +563 -0
- package/docs/system/configuration.md +438 -0
- package/docs/system/cpu-monitoring.md +462 -0
- package/docs/system/directory-management.md +611 -0
- package/docs/system/disk-information.md +554 -0
- package/docs/system/environment.md +445 -0
- package/docs/system/file-io.md +676 -0
- package/docs/system/memory-management.md +549 -0
- package/docs/system/migration-v5-to-v6.md +507 -0
- package/docs/system/network-statistics.md +645 -0
- package/docs/system/path-operations.md +506 -0
- package/docs/system/process-management.md +483 -0
- package/docs/system/search-filter.md +562 -0
- package/docs/system/sys-globals.md +119 -0
- package/docs/system/watching-streaming.md +99 -0
- package/examples/plugin-api-examples.ts +139 -0
- package/examples/security-example.ts +121 -0
- package/examples/security-showcase.ts +334 -0
- package/examples/server/package.json +0 -0
- package/examples/server/src/index.ts +5 -0
- package/examples/simple-cluster-example.ts +95 -0
- package/examples/xjson-example.ts +288 -0
- package/index.html +261 -0
- package/mods/ACPES/.acpes/2720a0cba:nehonix.a0cba72125.enc +1 -0
- package/mods/ACPES/LICENSE +21 -0
- package/mods/ACPES/README.md +203 -0
- package/mods/ACPES/docs/README.md +62 -0
- package/mods/ACPES/docs/advanced-encryption.md +248 -0
- package/mods/ACPES/docs/api-reference.md +216 -0
- package/mods/ACPES/docs/architecture.md +188 -0
- package/mods/ACPES/docs/getting-started.md +182 -0
- package/mods/ACPES/docs/platform-support.md +265 -0
- package/mods/ACPES/docs/security.md +292 -0
- package/mods/ACPES/docs/troubleshooting.md +0 -0
- package/mods/ACPES/package-lock.json +76 -0
- package/mods/ACPES/package.json +177 -0
- package/mods/ACPES/rollup.config.js +244 -0
- package/mods/ACPES/src/components/advancedEncryption.ts +354 -0
- package/mods/ACPES/src/components/compression.ts +52 -0
- package/mods/ACPES/src/components/encryption.ts +147 -0
- package/mods/ACPES/src/components/fingerprint.ts +45 -0
- package/mods/ACPES/src/components/index.ts +11 -0
- package/mods/ACPES/src/components/keyRotation.ts +299 -0
- package/mods/ACPES/src/components/security.ts +232 -0
- package/mods/ACPES/src/core/index.ts +11 -0
- package/mods/ACPES/src/core/platform.ts +112 -0
- package/mods/ACPES/src/core/storage.ts +730 -0
- package/mods/ACPES/src/index.ts +113 -0
- package/mods/ACPES/src/platforms/fallback.ts +80 -0
- package/mods/ACPES/src/platforms/index.ts +10 -0
- package/mods/ACPES/src/platforms/mobile.ts +101 -0
- package/mods/ACPES/src/platforms/node.ts +175 -0
- package/mods/ACPES/src/platforms/web.ts +147 -0
- package/mods/ACPES/src/types/index.ts +11 -0
- package/mods/ACPES/src/types/keyRotation.t.ts +20 -0
- package/mods/ACPES/src/types/options.ts +42 -0
- package/mods/ACPES/src/types/platform.ts +28 -0
- package/mods/ACPES/src/types/security.ts +39 -0
- package/mods/ACPES/src/types/storage.ts +23 -0
- package/mods/ACPES/src/utils/constants.ts +45 -0
- package/mods/ACPES/src/utils/helpers.ts +18 -0
- package/mods/ACPES/src/utils/index.ts +36 -0
- package/mods/ACPES/src/utils/prompt.ts +89 -0
- package/mods/ACPES/src/utils/validation.ts +51 -0
- package/mods/ACPES/tsconfig.json +42 -0
- package/mods/ACPES/yarn.lock +23 -0
- package/mods/memory-manager/Cargo.lock +974 -0
- package/mods/memory-manager/Cargo.toml +41 -0
- package/mods/memory-manager/NOTE.txt +3 -0
- package/mods/memory-manager/src/allocation_tracker.rs +371 -0
- package/mods/memory-manager/src/error.rs +294 -0
- package/mods/memory-manager/src/ffi.rs +469 -0
- package/mods/memory-manager/src/garbage_collector.rs +401 -0
- package/mods/memory-manager/src/lib.rs +138 -0
- package/mods/memory-manager/src/memory_manager.rs +429 -0
- package/mods/memory-manager/src/memory_pool.rs +564 -0
- package/mods/memory-manager/src/types.rs +285 -0
- package/mods/memory-manager/src/utils.rs +374 -0
- package/mods/security/LICENSE +21 -0
- package/mods/security/README.md +311 -0
- package/mods/security/bun.lock +1490 -0
- package/mods/security/docs/PKCE_API_DOCUMENTATION.md +255 -0
- package/mods/security/docs/api-reference.md +412 -0
- package/mods/security/docs/environment-setup.md +88 -0
- package/mods/security/docs/security-guide.md +395 -0
- package/mods/security/package-lock.json +7586 -0
- package/mods/security/package.json +249 -0
- package/mods/security/rollup.config.js +243 -0
- package/mods/security/src/algorithms/hash-algorithms.ts +894 -0
- package/mods/security/src/algorithms/registry.ts +82 -0
- package/mods/security/src/components/attestation.ts +1380 -0
- package/mods/security/src/components/cache/FastLRU.ts +402 -0
- package/mods/security/src/components/cache/SCC.ts +665 -0
- package/mods/security/src/components/cache/UFSIMC.ts +1399 -0
- package/mods/security/src/components/cache/cacheSys.ts +775 -0
- package/mods/security/src/components/cache/cacheSys.utils.ts +121 -0
- package/mods/security/src/components/cache/config/cache.config.ts +40 -0
- package/mods/security/src/components/cache/index.ts +1127 -0
- package/mods/security/src/components/cache/types/UFSIMC.type.ts +43 -0
- package/mods/security/src/components/cache/types/cache.type.ts +162 -0
- package/mods/security/src/components/cache/useCache.ts +287 -0
- package/mods/security/src/components/canary-tokens.ts +457 -0
- package/mods/security/src/components/entropy-augmentation.ts +611 -0
- package/mods/security/src/components/fortified-function/UFA/ultra-fast-allocator.ts +407 -0
- package/mods/security/src/components/fortified-function/UFA/ultra-fast-cache.ts +645 -0
- package/mods/security/src/components/fortified-function/UFA/ultra-fast-engine.ts +745 -0
- package/mods/security/src/components/fortified-function/const/exec.const.ts +26 -0
- package/mods/security/src/components/fortified-function/core/fortified-config.ts +443 -0
- package/mods/security/src/components/fortified-function/core/fortified-core.ts.txt +1347 -0
- package/mods/security/src/components/fortified-function/core/fortified-function-core.ts +785 -0
- package/mods/security/src/components/fortified-function/core/fortified-logger.ts +330 -0
- package/mods/security/src/components/fortified-function/core/index.ts +27 -0
- package/mods/security/src/components/fortified-function/core/mods/api-manager.ts +254 -0
- package/mods/security/src/components/fortified-function/core/mods/cache-manager.ts +148 -0
- package/mods/security/src/components/fortified-function/core/mods/execution-context.ts +135 -0
- package/mods/security/src/components/fortified-function/core/mods/execution-engine.ts +186 -0
- package/mods/security/src/components/fortified-function/core/mods/execution-router.ts +136 -0
- package/mods/security/src/components/fortified-function/core/mods/index.ts +20 -0
- package/mods/security/src/components/fortified-function/core/mods/memory-manager.ts +184 -0
- package/mods/security/src/components/fortified-function/core/mods/security-manager.ts +123 -0
- package/mods/security/src/components/fortified-function/core/mods/stats-manager.ts +194 -0
- package/mods/security/src/components/fortified-function/core/mods/timing-manager.ts +150 -0
- package/mods/security/src/components/fortified-function/engines/analytics-engine.ts +502 -0
- package/mods/security/src/components/fortified-function/engines/execution-engine.ts +520 -0
- package/mods/security/src/components/fortified-function/engines/index.ts +13 -0
- package/mods/security/src/components/fortified-function/engines/optimization-engine.ts +626 -0
- package/mods/security/src/components/fortified-function/fortified-function.ts +273 -0
- package/mods/security/src/components/fortified-function/index.ts +234 -0
- package/mods/security/src/components/fortified-function/performance/index.ts +15 -0
- package/mods/security/src/components/fortified-function/performance/performance-monitor.ts +293 -0
- package/mods/security/src/components/fortified-function/performance/performance-timer.ts +239 -0
- package/mods/security/src/components/fortified-function/security/index.ts +8 -0
- package/mods/security/src/components/fortified-function/security/security-handler.ts +283 -0
- package/mods/security/src/components/fortified-function/serializer/safe-serializer.ts +454 -0
- package/mods/security/src/components/fortified-function/smart-cache.ts +781 -0
- package/mods/security/src/components/fortified-function/types/fortified-types.ts +322 -0
- package/mods/security/src/components/fortified-function/types/types.ts +412 -0
- package/mods/security/src/components/fortified-function/types/ufa.type.ts +9 -0
- package/mods/security/src/components/fortified-function/utils/index.ts +13 -0
- package/mods/security/src/components/fortified-function/utils/utils.ts +98 -0
- package/mods/security/src/components/index.ts +37 -0
- package/mods/security/src/components/memory-hard.ts +1300 -0
- package/mods/security/src/components/post-quantum.ts +1366 -0
- package/mods/security/src/components/runtime-verification.ts +867 -0
- package/mods/security/src/components/secure-array/core/secure-array-core.ts +2028 -0
- package/mods/security/src/components/secure-array/crypto/ArrayCryptoHandler.ts +401 -0
- package/mods/security/src/components/secure-array/events/event-manager.ts +372 -0
- package/mods/security/src/components/secure-array/index.ts +295 -0
- package/mods/security/src/components/secure-array/metadata/metadata-manager.ts +406 -0
- package/mods/security/src/components/secure-array/serialization/ArraySerializationHandler.ts +469 -0
- package/mods/security/src/components/secure-array/types/index.ts +327 -0
- package/mods/security/src/components/secure-array/utils/id-generator.ts +86 -0
- package/mods/security/src/components/secure-array/utils/validation.ts +350 -0
- package/mods/security/src/components/secure-memory.ts +1155 -0
- package/mods/security/src/components/secure-object/README.md +217 -0
- package/mods/security/src/components/secure-object/core/secure-object-core.ts +2051 -0
- package/mods/security/src/components/secure-object/encryption/crypto-handler.ts +447 -0
- package/mods/security/src/components/secure-object/encryption/sensitive-keys.ts +227 -0
- package/mods/security/src/components/secure-object/events/event-manager.ts +246 -0
- package/mods/security/src/components/secure-object/index.ts +151 -0
- package/mods/security/src/components/secure-object/metadata/metadata-manager.ts +217 -0
- package/mods/security/src/components/secure-object/serialization/serialization-handler.ts +244 -0
- package/mods/security/src/components/secure-object/types/index.ts +124 -0
- package/mods/security/src/components/secure-object/utils/id-generator.ts +66 -0
- package/mods/security/src/components/secure-object/utils/validation.ts +288 -0
- package/mods/security/src/components/secure-serialization.ts +1178 -0
- package/mods/security/src/components/secure-string/README.md +275 -0
- package/mods/security/src/components/secure-string/advanced/entropy-analyzer.ts +402 -0
- package/mods/security/src/components/secure-string/advanced/performance-monitor.ts +527 -0
- package/mods/security/src/components/secure-string/advanced/quantum-safe.ts +385 -0
- package/mods/security/src/components/secure-string/buffer/buffer-manager.ts +246 -0
- package/mods/security/src/components/secure-string/core/secure-string-core.ts +1105 -0
- package/mods/security/src/components/secure-string/crypto/crypto-operations.ts +452 -0
- package/mods/security/src/components/secure-string/index.ts +274 -0
- package/mods/security/src/components/secure-string/operations/comparison-operations.ts +266 -0
- package/mods/security/src/components/secure-string/operations/string-operations.ts +333 -0
- package/mods/security/src/components/secure-string/types/index.ts +250 -0
- package/mods/security/src/components/secure-string/validation/string-validator.ts +401 -0
- package/mods/security/src/components/side-channel.ts +299 -0
- package/mods/security/src/components/tamper-evident-logging.ts +517 -0
- package/mods/security/src/const/DEFAULT_CONSOLE_CONFIG.ts +83 -0
- package/mods/security/src/const/buffer.const.ts +11 -0
- package/mods/security/src/core/crypt.ts +52 -0
- package/mods/security/src/core/crypto.ts +1001 -0
- package/mods/security/src/core/hash/hash-advanced.ts +530 -0
- package/mods/security/src/core/hash/hash-core.ts +556 -0
- package/mods/security/src/core/hash/hash-entropy.ts +359 -0
- package/mods/security/src/core/hash/hash-security.ts +538 -0
- package/mods/security/src/core/hash/hash-types.ts +107 -0
- package/mods/security/src/core/hash/hash-utils.ts +345 -0
- package/mods/security/src/core/hash/hash-validator.ts +382 -0
- package/mods/security/src/core/hash/index.ts +27 -0
- package/mods/security/src/core/hash.ts +34 -0
- package/mods/security/src/core/index.ts +6 -0
- package/mods/security/src/core/keys/ARCHITECTURE +82 -0
- package/mods/security/src/core/keys/algorithms/index.ts +9 -0
- package/mods/security/src/core/keys/algorithms/mods/Argon2Algo.ts +192 -0
- package/mods/security/src/core/keys/algorithms/mods/PBKDF2Algo.ts +374 -0
- package/mods/security/src/core/keys/algorithms/mods/ScryptAlgo.ts +401 -0
- package/mods/security/src/core/keys/index.ts +90 -0
- package/mods/security/src/core/keys/keys-core.ts +279 -0
- package/mods/security/src/core/keys/keys-logger.ts +278 -0
- package/mods/security/src/core/keys/keys-types.ts +255 -0
- package/mods/security/src/core/keys/keys-utils.ts +391 -0
- package/mods/security/src/core/keys.ts +135 -0
- package/mods/security/src/core/password/ARCHITECTURE +9 -0
- package/mods/security/src/core/password/index.ts +329 -0
- package/mods/security/src/core/password/password-algorithms.ts +519 -0
- package/mods/security/src/core/password/password-core.ts +394 -0
- package/mods/security/src/core/password/password-generator.ts +515 -0
- package/mods/security/src/core/password/password-migration.ts +324 -0
- package/mods/security/src/core/password/password-security.ts +649 -0
- package/mods/security/src/core/password/password-types.ts +246 -0
- package/mods/security/src/core/password/password-utils.ts +816 -0
- package/mods/security/src/core/password/swlist.ts +1117 -0
- package/mods/security/src/core/random/ARCHITECTURE +10 -0
- package/mods/security/src/core/random/index.ts +37 -0
- package/mods/security/src/core/random/random-core.ts +1115 -0
- package/mods/security/src/core/random/random-crypto.ts +446 -0
- package/mods/security/src/core/random/random-entropy.ts +453 -0
- package/mods/security/src/core/random/random-generators.ts +445 -0
- package/mods/security/src/core/random/random-security.ts +542 -0
- package/mods/security/src/core/random/random-sources.ts +461 -0
- package/mods/security/src/core/random/random-tokens.ts +421 -0
- package/mods/security/src/core/random/random-types.ts +255 -0
- package/mods/security/src/core/random.ts +14 -0
- package/mods/security/src/core/validators.ts +251 -0
- package/mods/security/src/generators/rsaKeyCalculator.ts +772 -0
- package/mods/security/src/helpers/Uint8Array.ts +392 -0
- package/mods/security/src/helpers/createEnu.ts +30 -0
- package/mods/security/src/helpers/express.middleware.helper.ts +59 -0
- package/mods/security/src/index.ts +1719 -0
- package/mods/security/src/types/console.ts +83 -0
- package/mods/security/src/types/global.ts +129 -0
- package/mods/security/src/types/index.ts +6 -0
- package/mods/security/src/types/options.ts +270 -0
- package/mods/security/src/types/random.ts +77 -0
- package/mods/security/src/types/secure-mem.type.ts +141 -0
- package/mods/security/src/types/secure-memory.ts +28 -0
- package/mods/security/src/types/security.ts +164 -0
- package/mods/security/src/types/stats.ts +149 -0
- package/mods/security/src/types/string.ts +69 -0
- package/mods/security/src/types.ts +582 -0
- package/mods/security/src/utils/CryptoAlgorithmUtils.ts +90 -0
- package/mods/security/src/utils/browserPolyfills.ts +288 -0
- package/mods/security/src/utils/constants.ts +169 -0
- package/mods/security/src/utils/crypto.type.ts +12 -0
- package/mods/security/src/utils/crypto.utils.ts +479 -0
- package/mods/security/src/utils/dataConverter.ts +89 -0
- package/mods/security/src/utils/detectInjection.ts +60 -0
- package/mods/security/src/utils/enc.test.ts +12 -0
- package/mods/security/src/utils/encoding.ts +999 -0
- package/mods/security/src/utils/errorHandler.ts +389 -0
- package/mods/security/src/utils/index.ts +10 -0
- package/mods/security/src/utils/memory/config-manager.ts +375 -0
- package/mods/security/src/utils/memory/event-manager.ts +320 -0
- package/mods/security/src/utils/memory/index.ts +304 -0
- package/mods/security/src/utils/memory/memory-manager.ts +1106 -0
- package/mods/security/src/utils/memory/memory-pool.ts +427 -0
- package/mods/security/src/utils/memory/reference-tracker.ts +454 -0
- package/mods/security/src/utils/memory/types.ts +255 -0
- package/mods/security/src/utils/memory-manager-new.ts +286 -0
- package/mods/security/src/utils/nodeModules.ts +307 -0
- package/mods/security/src/utils/patterns.ts +389 -0
- package/mods/security/src/utils/performanceMonitor.ts +412 -0
- package/mods/security/src/utils/securityUtils.ts +385 -0
- package/mods/security/src/utils/stats.ts +206 -0
- package/mods/security/src/utils/testing.ts +264 -0
- package/mods/security/tsconfig.json +40 -0
- package/package.json +57 -211
- package/quickdev.config.json +35 -0
- package/rollup.config.js +301 -0
- package/scripts/xys.run.js +1 -1
- package/secureStorage.xems +4 -0
- package/shared/logger/Logger.ts +841 -0
- package/shared/logger/index.ts +2 -0
- package/shared/logger/v2/Logger.ts..back.txt +812 -0
- package/shared/types/index.ts +2 -0
- package/shared/types/logger.type.ts +96 -0
- package/simulations/.meta/+xypriss.meta.ts +4 -0
- package/simulations/goxfpm-test2/.quickdevignore +1 -0
- package/simulations/goxfpm-test2/README.md +236 -0
- package/simulations/goxfpm-test2/package-lock.json +7108 -0
- package/simulations/goxfpm-test2/package.json +27 -0
- package/simulations/goxfpm-test2/quickdev.config.json +34 -0
- package/simulations/goxfpm-test2/src/configs/host.conf.ts +83 -0
- package/simulations/goxfpm-test2/src/configs/xypriss.config.ts +284 -0
- package/simulations/goxfpm-test2/src/middleware/index.ts +40 -0
- package/simulations/goxfpm-test2/src/middleware/security.mlw.ts +29 -0
- package/simulations/goxfpm-test2/src/middleware/validation.middleware.ts +53 -0
- package/simulations/goxfpm-test2/src/routes/index.ts +142 -0
- package/simulations/goxfpm-test2/src/schema/user.schema.ts +53 -0
- package/simulations/goxfpm-test2/src/server.ts +68 -0
- package/simulations/goxfpm-test2/tsconfig.json +35 -0
- package/simulations/goxfpm-test2/xypriss.config.json +21 -0
- package/simulations/lxpm_pkg_simulation/.quickdevignore +1 -0
- package/simulations/lxpm_pkg_simulation/README.md +236 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/.quickdevignore +1 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/README.md +236 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/package-lock.json +7108 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/package.json +31 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/quickdev.config.json +34 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/src/configs/host.conf.ts +83 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/src/configs/xypriss.config.ts +286 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/src/middleware/index.ts +40 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/src/middleware/security.mlw.ts +29 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/src/middleware/validation.middleware.ts +53 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/src/routes/index.ts +97 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/src/schema/user.schema.ts +53 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/src/server.ts +64 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/tsconfig.json +35 -0
- package/simulations/lxpm_pkg_simulation/lxpm_pkg_simulation/xypriss.config.json +21 -0
- package/simulations/lxpm_pkg_simulation/package-lock.json +7108 -0
- package/simulations/lxpm_pkg_simulation/package.json +31 -0
- package/simulations/lxpm_pkg_simulation/quickdev.config.json +34 -0
- package/simulations/lxpm_pkg_simulation/src/configs/host.conf.ts +83 -0
- package/simulations/lxpm_pkg_simulation/src/configs/xypriss.config.ts +286 -0
- package/simulations/lxpm_pkg_simulation/src/middleware/index.ts +40 -0
- package/simulations/lxpm_pkg_simulation/src/middleware/security.mlw.ts +29 -0
- package/simulations/lxpm_pkg_simulation/src/middleware/validation.middleware.ts +53 -0
- package/simulations/lxpm_pkg_simulation/src/routes/index.ts +97 -0
- package/simulations/lxpm_pkg_simulation/src/schema/user.schema.ts +53 -0
- package/simulations/lxpm_pkg_simulation/src/server.ts +64 -0
- package/simulations/lxpm_pkg_simulation/tsconfig.json +35 -0
- package/simulations/lxpm_pkg_simulation/xypriss.config.json +21 -0
- package/simulations/pkg/.meta/+xypriss.meta.ts +6 -0
- package/simulations/pkg/bun.lock +815 -0
- package/simulations/pkg/package-lock.json +4895 -0
- package/simulations/pkg/package.json +25 -0
- package/simulations/pkg/src/index.ts +15 -0
- package/simulations/pkg/src/logger.ts +0 -0
- package/simulations/pkg/tsconfig.json +29 -0
- package/simulations/pkg/xypriss.config.json +13 -0
- package/simulations/server/.meta/+xypriss.meta.ts +6 -0
- package/simulations/server/.quickdevignore +1 -0
- package/simulations/server/README.md +238 -0
- package/simulations/server/bun.lock +1184 -0
- package/simulations/server/package-lock.json +4829 -0
- package/simulations/server/package.json +25 -0
- package/simulations/server/quickdev.config.json +34 -0
- package/simulations/server/src/configs/host.conf.ts +83 -0
- package/simulations/server/src/configs/xypriss.config.ts +48 -0
- package/simulations/server/src/middleware/index.ts +40 -0
- package/simulations/server/src/middleware/security.mlw.ts +29 -0
- package/simulations/server/src/middleware/validation.middleware.ts +53 -0
- package/simulations/server/src/routes/index.ts +97 -0
- package/simulations/server/src/schema/user.schema.ts +8 -0
- package/simulations/server/src/server.ts +67 -0
- package/simulations/server/test_res.js +3 -0
- package/simulations/server/tsconfig.json +32 -0
- package/simulations/server/xypriss.config.json +22 -0
- package/simulations/test-project-goxfpm/.config +37 -0
- package/simulations/test-project-goxfpm/.quickdevignore +1 -0
- package/simulations/test-project-goxfpm/README.md +236 -0
- package/simulations/test-project-goxfpm/package-lock.json +7108 -0
- package/simulations/test-project-goxfpm/package.json +9 -0
- package/simulations/test-project-goxfpm/quickdev.config.json +34 -0
- package/simulations/test-project-goxfpm/src/configs/host.conf.ts +83 -0
- package/simulations/test-project-goxfpm/src/configs/xypriss.config.ts +302 -0
- package/simulations/test-project-goxfpm/src/middleware/index.ts +40 -0
- package/simulations/test-project-goxfpm/src/middleware/security.mlw.ts +29 -0
- package/simulations/test-project-goxfpm/src/middleware/validation.middleware.ts +53 -0
- package/simulations/test-project-goxfpm/src/routes/index.ts +142 -0
- package/simulations/test-project-goxfpm/src/schema/user.schema.ts +53 -0
- package/simulations/test-project-goxfpm/src/server.ts +68 -0
- package/simulations/test-project-goxfpm/tsconfig.json +35 -0
- package/simulations/test-project-goxfpm/xypriss.config.json +12 -0
- package/simulations/unpacking-test2/.quickdevignore +1 -0
- package/simulations/unpacking-test2/README.md +236 -0
- package/simulations/unpacking-test2/package-lock.json +7108 -0
- package/simulations/unpacking-test2/package.json +31 -0
- package/simulations/unpacking-test2/quickdev.config.json +34 -0
- package/simulations/unpacking-test2/src/configs/host.conf.ts +83 -0
- package/simulations/unpacking-test2/src/configs/xypriss.config.ts +286 -0
- package/simulations/unpacking-test2/src/middleware/index.ts +40 -0
- package/simulations/unpacking-test2/src/middleware/security.mlw.ts +29 -0
- package/simulations/unpacking-test2/src/middleware/validation.middleware.ts +53 -0
- package/simulations/unpacking-test2/src/routes/index.ts +97 -0
- package/simulations/unpacking-test2/src/schema/user.schema.ts +53 -0
- package/simulations/unpacking-test2/src/server.ts +64 -0
- package/simulations/unpacking-test2/tsconfig.json +35 -0
- package/simulations/unpacking-test2/xypriss.config.json +21 -0
- package/simulations/xems-realworld-testing/README.md +73 -0
- package/simulations/xems-realworld-testing/eslint.config.js +23 -0
- package/simulations/xems-realworld-testing/index.html +13 -0
- package/simulations/xems-realworld-testing/package.json +32 -0
- package/simulations/xems-realworld-testing/public/vite.svg +1 -0
- package/simulations/xems-realworld-testing/src/App.css +42 -0
- package/simulations/xems-realworld-testing/src/App.tsx +56 -0
- package/simulations/xems-realworld-testing/src/api.ts +104 -0
- package/simulations/xems-realworld-testing/src/components/Dashboard.tsx +219 -0
- package/simulations/xems-realworld-testing/src/components/LoginForm.tsx +155 -0
- package/simulations/xems-realworld-testing/src/components/RegisterForm.tsx +171 -0
- package/simulations/xems-realworld-testing/src/index.css +2 -0
- package/simulations/xems-realworld-testing/src/main.tsx +10 -0
- package/simulations/xems-realworld-testing/tsconfig.app.json +28 -0
- package/simulations/xems-realworld-testing/tsconfig.json +7 -0
- package/simulations/xems-realworld-testing/tsconfig.node.json +26 -0
- package/simulations/xems-realworld-testing/vite.config.ts +9 -0
- package/simulations/xems-server-test/.quickdevignore +1 -0
- package/simulations/xems-server-test/README.md +236 -0
- package/simulations/xems-server-test/package-lock.json +7108 -0
- package/simulations/xems-server-test/package.json +30 -0
- package/simulations/xems-server-test/quickdev.config.json +34 -0
- package/simulations/xems-server-test/src/configs/host.conf.ts +83 -0
- package/simulations/xems-server-test/src/configs/xypriss.config.ts +286 -0
- package/simulations/xems-server-test/src/middleware/index.ts +40 -0
- package/simulations/xems-server-test/src/middleware/security.mlw.ts +29 -0
- package/simulations/xems-server-test/src/middleware/validation.middleware.ts +53 -0
- package/simulations/xems-server-test/src/routes/index.ts +97 -0
- package/simulations/xems-server-test/src/schema/user.schema.ts +53 -0
- package/simulations/xems-server-test/src/server.ts +64 -0
- package/simulations/xems-server-test/tsconfig.json +35 -0
- package/simulations/xems-server-test/xypriss.config.json +21 -0
- package/src/FiUp.ts +102 -0
- package/src/cache/CacheFactory.ts +850 -0
- package/src/cache/SecureCacheAdapter.ts +1495 -0
- package/src/cache/cache-engine.ts +586 -0
- package/src/cache/index.ts +28 -0
- package/src/cache/type.ts +141 -0
- package/src/config.ts +455 -0
- package/src/const.ts +730 -0
- package/src/encryption/EncryptionService.ts +597 -0
- package/src/encryption/index.ts +36 -0
- package/src/file-upload.ts +288 -0
- package/src/index.ts +183 -0
- package/src/middleware/XJsonResponseHandler.ts +210 -0
- package/src/middleware/XemsSessionMiddleware.ts +125 -0
- package/src/middleware/XyPrissMiddlewareAPI.ts +518 -0
- package/src/middleware/built-in/BuiltInMiddleware.ts +567 -0
- package/src/middleware/built-in/security/BrowserOnlyProtector.ts +702 -0
- package/src/middleware/built-in/security/CommandInjectionDetector.ts +265 -0
- package/src/middleware/built-in/security/LDAPInjectionDetector.ts +113 -0
- package/src/middleware/built-in/security/MobileOnlyProtector.ts +664 -0
- package/src/middleware/built-in/security/PathTraversalDetector.ts +265 -0
- package/src/middleware/built-in/security/README.md +208 -0
- package/src/middleware/built-in/security/RequestSignatureProtector.ts +626 -0
- package/src/middleware/built-in/security/SQLInjectionDetector.ts +434 -0
- package/src/middleware/built-in/security/TerminalOnlyProtector.ts +624 -0
- package/src/middleware/built-in/security/XXEProtector.ts +212 -0
- package/src/middleware/built-in/security/index.ts +26 -0
- package/src/middleware/built-in/security/types.ts +175 -0
- package/src/middleware/safe-json-middleware.ts +236 -0
- package/src/middleware/security-middleware.ts +1541 -0
- package/src/plugins/PluginManager.ts +487 -0
- package/src/plugins/README.md +25 -0
- package/src/plugins/api/PluginAPI.ts +220 -0
- package/src/plugins/const/PluginHookIds.ts +76 -0
- package/src/plugins/core/PluginManager.ts +977 -0
- package/src/plugins/modules/PluginEngine.ts +676 -0
- package/src/plugins/modules/PluginRegistry.ts +419 -0
- package/src/plugins/modules/PluginRegistry.ts.bak +408 -0
- package/src/plugins/modules/builtin/SmartCachePlugin.ts +1082 -0
- package/src/plugins/modules/builtin/server-maintenance-plugin.ts +698 -0
- package/src/plugins/modules/core/CachePlugin.ts +2523 -0
- package/src/plugins/modules/index.ts +48 -0
- package/src/plugins/modules/network/builtin/CompressionPlugin.ts +343 -0
- package/src/plugins/modules/network/builtin/ConnectionPlugin.ts +941 -0
- package/src/plugins/modules/network/builtin/ProxyPlugin.ts +522 -0
- package/src/plugins/modules/network/core/NetworkPlugin.ts +323 -0
- package/src/plugins/modules/network/core/NetworkPluginFactory.ts +47 -0
- package/src/plugins/modules/network/index.ts +28 -0
- package/src/plugins/modules/network/types/NetworkTypes.ts +331 -0
- package/src/plugins/modules/network/types/cnp.type.ts +17 -0
- package/src/plugins/modules/network/utils/NetworkPluginUtils.ts +69 -0
- package/src/plugins/modules/types/PluginTypes.ts +277 -0
- package/src/plugins/modules/xems/XemsBuiltinPlugin.ts +291 -0
- package/src/plugins/modules/xems/XemsPlugin.ts +484 -0
- package/src/plugins/modules/xems/index.ts +2 -0
- package/src/plugins/plugin-manager.ts +188 -0
- package/src/plugins/route-optimization-plugin.ts +559 -0
- package/src/plugins/types/PluginTypes.ts +187 -0
- package/src/plugins/types/index.ts +84 -0
- package/src/quick-start.ts +41 -0
- package/src/schemas/plugingSchema.ts +42 -0
- package/src/server/FastServer.ts +1196 -0
- package/src/server/ServerFactory.ts +105 -0
- package/src/server/components/fastapi/CacheManager.ts +292 -0
- package/src/server/components/fastapi/FileUploadManager.ts +289 -0
- package/src/server/components/fastapi/FileWatcherManager.ts +646 -0
- package/src/server/components/fastapi/MonitoringManager.ts +375 -0
- package/src/server/components/fastapi/PerformanceManager.ts +382 -0
- package/src/server/components/fastapi/RedirectManager.ts +730 -0
- package/src/server/components/fastapi/RequestProcessor.ts +404 -0
- package/src/server/components/fastapi/RouteManager.ts +250 -0
- package/src/server/components/fastapi/WorkerPoolComponent.ts +114 -0
- package/src/server/components/fastapi/console/ConsoleInterceptor.ts +1202 -0
- package/src/server/components/fastapi/console/encryption/ConsoleEncryption.ts +299 -0
- package/src/server/components/fastapi/console/types.ts +318 -0
- package/src/server/components/fastapi/smart-routes.ts +485 -0
- package/src/server/components/fastapi/templates/redirectHtml.html +863 -0
- package/src/server/components/fastapi/templates/redirectTemp.ts +105 -0
- package/src/server/components/fastapi/typescript/TypeScriptChecker.ts +502 -0
- package/src/server/components/lifecycle/slcm.type.ts +45 -0
- package/src/server/components/multi-server/MultiServerApp.ts +667 -0
- package/src/server/components/multi-server/MultiServerManager.ts +451 -0
- package/src/server/conf/networkConnectionConf.ts +26 -0
- package/src/server/conf/proxyConfig.ts +21 -0
- package/src/server/conf/rateLimitConfig.ts +57 -0
- package/src/server/const/ExecutionPredictor_EP.const.ts +88 -0
- package/src/server/const/FileWatcher.config.ts +97 -0
- package/src/server/const/default.ts +366 -0
- package/src/server/const/http.ts +32 -0
- package/src/server/core/HttpServer.ts +574 -0
- package/src/server/core/RequestApp.ts +106 -0
- package/src/server/core/RequestEnhancer.ts +348 -0
- package/src/server/core/ResponseEnhancer.ts +588 -0
- package/src/server/core/StartupProcessor.ts +168 -0
- package/src/server/core/VirtualServer.ts +32 -0
- package/src/server/core/XHSCBridge.ts +779 -0
- package/src/server/core/XHSCProtocol.ts +389 -0
- package/src/server/core/XyDiagnosticsManager.ts +88 -0
- package/src/server/core/XyLifecycleManager.ts +348 -0
- package/src/server/core/XyModuleManager.ts +195 -0
- package/src/server/core/XyRoutingManager.ts +251 -0
- package/src/server/core/XyServerCreator.ts +117 -0
- package/src/server/core/XyprissApp.ts +758 -0
- package/src/server/core/request/XyRequestManager.ts +288 -0
- package/src/server/handlers/NotFoundHandler.ts +99 -0
- package/src/server/handlers/templates/notFoundTemplate.ts +662 -0
- package/src/server/middleware/MiddlewareManager.ts +296 -0
- package/src/server/optimization/ExecutionPredictor.nxs +0 -0
- package/src/server/optimization/ExecutionPredictor.ts +274 -0
- package/src/server/optimization/PerformanceProfiler.ts +318 -0
- package/src/server/optimization/RequestPreCompiler.ts +928 -0
- package/src/server/optimization/UltraFastOptimizer.ts +545 -0
- package/src/server/optimization/performance-monitor.ts +241 -0
- package/src/server/routing/Router.ts +506 -0
- package/src/server/routing/index.ts +14 -0
- package/src/server/service/Reload/FileWatcher.ts +982 -0
- package/src/server/service/Reload/HotReloader.ts +1050 -0
- package/src/server/service/Reload/exec/ExecutableBuilder.ts +419 -0
- package/src/server/service/Reload/exec/TypeScriptExecutor.ts +439 -0
- package/src/server/service/Reload/exec/build-executable.ts +50 -0
- package/src/server/service/Reload/types/TSExecutor.type.ts +18 -0
- package/src/server/service/Reload/types/fw.types.ts +117 -0
- package/src/server/service/Reload/types/hotreloader.ts +29 -0
- package/src/server/service/Reload/types/quickdev.type.ts +30 -0
- package/src/server/utils/ConfigLoader.ts +437 -0
- package/src/server/utils/PortManager.ts +316 -0
- package/src/server/utils/WorkerModeHandler.ts +72 -0
- package/src/server/utils/es_modules.ts +6 -0
- package/src/server/utils/forceClosePort.ts +427 -0
- package/src/server/utils/shouldRegisterRouteOnServer.ts +39 -0
- package/src/server/utils/trustProxy.ts +1005 -0
- package/src/server/utils/wildcardMatcher.ts +281 -0
- package/src/sys/FSApi.ts +1271 -0
- package/src/sys/PathApi.ts +209 -0
- package/src/sys/SysApi.ts +490 -0
- package/src/sys/System.ts +36 -0
- package/src/sys/XyPrissCache.ts +84 -0
- package/src/sys/XyPrissRunner.ts +299 -0
- package/src/sys/cmdr.ts +9 -0
- package/src/sys/types.ts +250 -0
- package/src/sys.ts +473 -0
- package/src/types/CpuMon.t.ts +46 -0
- package/src/types/ExecutionPredictor.type.ts +26 -0
- package/src/types/FiUp.type.ts +90 -0
- package/src/types/NotFoundConfig.ts +114 -0
- package/src/types/README.md +277 -0
- package/src/types/ReqPreCompiler.type.ts +55 -0
- package/src/types/UFOptimizer.type.ts +49 -0
- package/src/types/XyPrissRouter.types.ts +27 -0
- package/src/types/bun_cluster.t.ts +42 -0
- package/src/types/cluster.ipc.t.ts +198 -0
- package/src/types/components/CacheManager.type.ts +8 -0
- package/src/types/components/FWM.type.ts +10 -0
- package/src/types/components/MonitoringM.type.ts +13 -0
- package/src/types/components/PerfomanceMonitory.type.ts +13 -0
- package/src/types/components/PlugingM.type.ts +9 -0
- package/src/types/components/ReqProcessor.type.ts +14 -0
- package/src/types/components/RouteM.type.ts +12 -0
- package/src/types/httpServer.type.ts +154 -0
- package/src/types/index.ts +280 -0
- package/src/types/middleware-api.types.ts +220 -0
- package/src/types/middlewareManager.types.ts +20 -0
- package/src/types/mod/cache.ts +491 -0
- package/src/types/mod/core.ts +426 -0
- package/src/types/mod/monitoring.ts +544 -0
- package/src/types/mod/performance.ts +470 -0
- package/src/types/mod/routing.ts +454 -0
- package/src/types/mod/security.ts +1622 -0
- package/src/types/perfomance.ts +58 -0
- package/src/types/trustProxy.ts +148 -0
- package/src/types/types.ts +2189 -0
- package/src/types/xems.type.ts +89 -0
- package/src/utils/DotEnvLoader.ts +84 -0
- package/src/utils/mergeWithDefaults.ts +223 -0
- package/src/xhs/cluster/XHSCWorker.ts +238 -0
- package/tools/memory-cli/build.sh +36 -0
- package/tools/memory-cli/main.go +401 -0
- package/tools/xfpm-go/LICENSE +13 -0
- package/tools/xfpm-go/README.md +82 -0
- package/tools/xfpm-go/build.sh +91 -0
- package/tools/xfpm-go/cmd/xfpm/exec.go +68 -0
- package/tools/xfpm-go/cmd/xfpm/init.go +491 -0
- package/tools/xfpm-go/cmd/xfpm/list.go +287 -0
- package/tools/xfpm-go/cmd/xfpm/main.go +304 -0
- package/tools/xfpm-go/cmd/xfpm/run.go +107 -0
- package/tools/xfpm-go/cmd/xfpm/uninstall.go +233 -0
- package/tools/xfpm-go/cmd/xfpm/update.go +36 -0
- package/tools/xfpm-go/dev.sh +1 -0
- package/tools/xfpm-go/go.mod +46 -0
- package/tools/xfpm-go/go.sum +173 -0
- package/tools/xfpm-go/internal/core/cas.go +297 -0
- package/tools/xfpm-go/internal/core/config.go +83 -0
- package/tools/xfpm-go/internal/core/extractor.go +54 -0
- package/tools/xfpm-go/internal/core/installer.go +505 -0
- package/tools/xfpm-go/internal/core/project.go +53 -0
- package/tools/xfpm-go/internal/core/registry.go +303 -0
- package/tools/xfpm-go/internal/core/resolver.go +471 -0
- package/tools/xfpm-go/internal/core/script_runner.go +175 -0
- package/tools/xfpm-go/internal/utils/lib_version.go +5 -0
- package/tools/xfpm-go/internal/utils/logger.go +145 -0
- package/tools/xfpm-go/internal/utils/updater.go +131 -0
- package/tools/xfpm-go/pkg/npm/README.md +39 -0
- package/tools/xfpm-go/pkg/npm/install.js +51 -0
- package/tools/xfpm-go/pkg/npm/package.json +29 -0
- package/tools/xfpm-go/scripts/bridge.js +130 -0
- package/tools/xfpm-go/scripts/install.js +146 -0
- package/tools/xfpm-go/scripts/install.ps1 +140 -0
- package/tools/xfpm-go/scripts/install.sh +117 -0
- package/tools/xfpm-go/test/package/LICENSE +21 -0
- package/tools/xfpm-go/test/package/README.md +218 -0
- package/tools/xfpm-go/test/package/package.json +115 -0
- package/tools/xfpm-go/test.tgz +0 -0
- package/tools/xfpm-go/utils/helper_5936.ts +9 -0
- package/tools/xfpm-go/version.json +10 -0
- package/tools/xfpm-go/xfpm +0 -0
- package/tools/xyp/.intentionally-empty-file.o +0 -0
- package/tools/xyp/Cargo.lock +2602 -0
- package/tools/xyp/Cargo.toml +56 -0
- package/tools/xyp/README.md +78 -0
- package/tools/xyp/dev +3 -0
- package/tools/xyp/index.js +75 -0
- package/tools/xyp/install.js +286 -0
- package/tools/xyp/package copy.json +64 -0
- package/tools/xyp/package.json +65 -0
- package/tools/xyp/scripts/build.js +123 -0
- package/tools/xyp/scripts/build.sh +85 -0
- package/tools/xyp/src/commands/exec.rs +113 -0
- package/tools/xyp/src/commands/init.rs +378 -0
- package/tools/xyp/src/commands/install.rs +387 -0
- package/tools/xyp/src/commands/list.rs +62 -0
- package/tools/xyp/src/commands/mod.rs +7 -0
- package/tools/xyp/src/commands/run.rs +98 -0
- package/tools/xyp/src/commands/start.rs +18 -0
- package/tools/xyp/src/commands/uninstall.rs +156 -0
- package/tools/xyp/src/core/cas.rs +250 -0
- package/tools/xyp/src/core/config.rs +87 -0
- package/tools/xyp/src/core/extractor.rs +85 -0
- package/tools/xyp/src/core/installer.rs +683 -0
- package/tools/xyp/src/core/mod.rs +7 -0
- package/tools/xyp/src/core/registry.rs +333 -0
- package/tools/xyp/src/core/resolver.rs +830 -0
- package/tools/xyp/src/core/script_runner.rs +291 -0
- package/tools/xyp/src/main.rs +264 -0
- package/tools/xyp/src/utils/mod.rs +1 -0
- package/tools/xyp/src/utils/shell.rs +89 -0
- package/tools/xyp/xfpm +0 -0
- package/tools/xypriss-sys-go/README.md +47 -0
- package/tools/xypriss-sys-go/build.sh +139 -0
- package/tools/xypriss-sys-go/cmd/xsys/main.go +44 -0
- package/tools/xypriss-sys-go/go.mod +35 -0
- package/tools/xypriss-sys-go/go.sum +80 -0
- package/tools/xypriss-sys-go/internal/cli/archive.go +142 -0
- package/tools/xypriss-sys-go/internal/cli/fs.go +462 -0
- package/tools/xypriss-sys-go/internal/cli/monitor.go +110 -0
- package/tools/xypriss-sys-go/internal/cli/path.go +166 -0
- package/tools/xypriss-sys-go/internal/cli/root.go +140 -0
- package/tools/xypriss-sys-go/internal/cli/search.go +156 -0
- package/tools/xypriss-sys-go/internal/cli/server.go +240 -0
- package/tools/xypriss-sys-go/internal/cli/sys.go +321 -0
- package/tools/xypriss-sys-go/internal/cluster/intelligence.go +159 -0
- package/tools/xypriss-sys-go/internal/cluster/intelligence_unix.go +50 -0
- package/tools/xypriss-sys-go/internal/cluster/intelligence_windows.go +39 -0
- package/tools/xypriss-sys-go/internal/cluster/manager.go +226 -0
- package/tools/xypriss-sys-go/internal/cluster/strategy.go +41 -0
- package/tools/xypriss-sys-go/internal/cluster/worker.go +343 -0
- package/tools/xypriss-sys-go/internal/cluster/worker_unix.go +45 -0
- package/tools/xypriss-sys-go/internal/cluster/worker_windows.go +32 -0
- package/tools/xypriss-sys-go/internal/fs/fs.go +783 -0
- package/tools/xypriss-sys-go/internal/handlers/archive.go +68 -0
- package/tools/xypriss-sys-go/internal/handlers/fs.go +153 -0
- package/tools/xypriss-sys-go/internal/handlers/monitor.go +54 -0
- package/tools/xypriss-sys-go/internal/handlers/path.go +79 -0
- package/tools/xypriss-sys-go/internal/handlers/search.go +60 -0
- package/tools/xypriss-sys-go/internal/handlers/sys.go +110 -0
- package/tools/xypriss-sys-go/internal/ipc/bridge.go +352 -0
- package/tools/xypriss-sys-go/internal/ipc/circuit_breaker.go +93 -0
- package/tools/xypriss-sys-go/internal/ipc/metrics.go +85 -0
- package/tools/xypriss-sys-go/internal/ipc/types.go +102 -0
- package/tools/xypriss-sys-go/internal/proxy/proxy.go +538 -0
- package/tools/xypriss-sys-go/internal/router/router.go +332 -0
- package/tools/xypriss-sys-go/internal/server/server.go +658 -0
- package/tools/xypriss-sys-go/internal/sys/sys.go +432 -0
- package/tools/xypriss-sys-go/internal/sys/types.go +167 -0
- package/tools/xypriss-sys-go/internal/watcher/watcher.go +104 -0
- package/tsconfig.json +51 -0
- package/vault.xems +1 -0
- package/xfpm +0 -0
- package/xypriss.config.jsonc +22 -0
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/mods/security/src/algorithms/hash-algorithms.js +0 -718
- package/dist/cjs/mods/security/src/algorithms/hash-algorithms.js.map +0 -1
- package/dist/cjs/mods/security/src/algorithms/registry.js +0 -83
- package/dist/cjs/mods/security/src/algorithms/registry.js.map +0 -1
- package/dist/cjs/mods/security/src/components/attestation.js +0 -1065
- package/dist/cjs/mods/security/src/components/attestation.js.map +0 -1
- package/dist/cjs/mods/security/src/components/cache/FastLRU.js +0 -323
- package/dist/cjs/mods/security/src/components/cache/FastLRU.js.map +0 -1
- package/dist/cjs/mods/security/src/components/cache/UFSIMC.js +0 -1133
- package/dist/cjs/mods/security/src/components/cache/UFSIMC.js.map +0 -1
- package/dist/cjs/mods/security/src/components/cache/cacheSys.js +0 -624
- package/dist/cjs/mods/security/src/components/cache/cacheSys.js.map +0 -1
- package/dist/cjs/mods/security/src/components/cache/cacheSys.utils.js +0 -127
- package/dist/cjs/mods/security/src/components/cache/cacheSys.utils.js.map +0 -1
- package/dist/cjs/mods/security/src/components/cache/config/cache.config.js +0 -39
- package/dist/cjs/mods/security/src/components/cache/config/cache.config.js.map +0 -1
- package/dist/cjs/mods/security/src/components/cache/index.js +0 -374
- package/dist/cjs/mods/security/src/components/cache/index.js.map +0 -1
- package/dist/cjs/mods/security/src/components/cache/useCache.js +0 -235
- package/dist/cjs/mods/security/src/components/cache/useCache.js.map +0 -1
- package/dist/cjs/mods/security/src/components/canary-tokens.js +0 -351
- package/dist/cjs/mods/security/src/components/canary-tokens.js.map +0 -1
- package/dist/cjs/mods/security/src/components/entropy-augmentation.js +0 -478
- package/dist/cjs/mods/security/src/components/entropy-augmentation.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/UFA/ultra-fast-allocator.js +0 -338
- package/dist/cjs/mods/security/src/components/fortified-function/UFA/ultra-fast-allocator.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/UFA/ultra-fast-cache.js +0 -536
- package/dist/cjs/mods/security/src/components/fortified-function/UFA/ultra-fast-cache.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/UFA/ultra-fast-engine.js +0 -614
- package/dist/cjs/mods/security/src/components/fortified-function/UFA/ultra-fast-engine.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/const/exec.const.js +0 -18
- package/dist/cjs/mods/security/src/components/fortified-function/const/exec.const.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/fortified-config.js +0 -356
- package/dist/cjs/mods/security/src/components/fortified-function/core/fortified-config.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/fortified-function-core.js +0 -520
- package/dist/cjs/mods/security/src/components/fortified-function/core/fortified-function-core.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/fortified-logger.js +0 -246
- package/dist/cjs/mods/security/src/components/fortified-function/core/fortified-logger.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/api-manager.js +0 -189
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/api-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/cache-manager.js +0 -107
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/cache-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/execution-context.js +0 -105
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/execution-context.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/execution-engine.js +0 -127
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/execution-engine.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/execution-router.js +0 -93
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/execution-router.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/memory-manager.js +0 -147
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/memory-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/security-manager.js +0 -102
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/security-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/stats-manager.js +0 -159
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/stats-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/timing-manager.js +0 -125
- package/dist/cjs/mods/security/src/components/fortified-function/core/mods/timing-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/engines/analytics-engine.js +0 -370
- package/dist/cjs/mods/security/src/components/fortified-function/engines/analytics-engine.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/engines/execution-engine.js +0 -402
- package/dist/cjs/mods/security/src/components/fortified-function/engines/execution-engine.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/index.js +0 -174
- package/dist/cjs/mods/security/src/components/fortified-function/index.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/performance/performance-monitor.js +0 -240
- package/dist/cjs/mods/security/src/components/fortified-function/performance/performance-monitor.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/performance/performance-timer.js +0 -188
- package/dist/cjs/mods/security/src/components/fortified-function/performance/performance-timer.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/security/security-handler.js +0 -254
- package/dist/cjs/mods/security/src/components/fortified-function/security/security-handler.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/serializer/safe-serializer.js +0 -350
- package/dist/cjs/mods/security/src/components/fortified-function/serializer/safe-serializer.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/smart-cache.js +0 -693
- package/dist/cjs/mods/security/src/components/fortified-function/smart-cache.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/types/types.js +0 -16
- package/dist/cjs/mods/security/src/components/fortified-function/types/types.js.map +0 -1
- package/dist/cjs/mods/security/src/components/fortified-function/utils/utils.js +0 -76
- package/dist/cjs/mods/security/src/components/fortified-function/utils/utils.js.map +0 -1
- package/dist/cjs/mods/security/src/components/memory-hard.js +0 -922
- package/dist/cjs/mods/security/src/components/memory-hard.js.map +0 -1
- package/dist/cjs/mods/security/src/components/post-quantum.js +0 -323
- package/dist/cjs/mods/security/src/components/post-quantum.js.map +0 -1
- package/dist/cjs/mods/security/src/components/runtime-verification.js +0 -645
- package/dist/cjs/mods/security/src/components/runtime-verification.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-array/core/secure-array-core.js +0 -1572
- package/dist/cjs/mods/security/src/components/secure-array/core/secure-array-core.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-array/crypto/ArrayCryptoHandler.js +0 -330
- package/dist/cjs/mods/security/src/components/secure-array/crypto/ArrayCryptoHandler.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-array/events/event-manager.js +0 -270
- package/dist/cjs/mods/security/src/components/secure-array/events/event-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-array/index.js +0 -66
- package/dist/cjs/mods/security/src/components/secure-array/index.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-array/metadata/metadata-manager.js +0 -331
- package/dist/cjs/mods/security/src/components/secure-array/metadata/metadata-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-array/serialization/ArraySerializationHandler.js +0 -390
- package/dist/cjs/mods/security/src/components/secure-array/serialization/ArraySerializationHandler.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-array/types/index.js +0 -87
- package/dist/cjs/mods/security/src/components/secure-array/types/index.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-array/utils/id-generator.js +0 -80
- package/dist/cjs/mods/security/src/components/secure-array/utils/id-generator.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-array/utils/validation.js +0 -275
- package/dist/cjs/mods/security/src/components/secure-array/utils/validation.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-memory.js +0 -906
- package/dist/cjs/mods/security/src/components/secure-memory.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-object/core/secure-object-core.js +0 -1605
- package/dist/cjs/mods/security/src/components/secure-object/core/secure-object-core.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-object/encryption/crypto-handler.js +0 -362
- package/dist/cjs/mods/security/src/components/secure-object/encryption/crypto-handler.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-object/encryption/sensitive-keys.js +0 -206
- package/dist/cjs/mods/security/src/components/secure-object/encryption/sensitive-keys.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-object/events/event-manager.js +0 -197
- package/dist/cjs/mods/security/src/components/secure-object/events/event-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-object/index.js +0 -67
- package/dist/cjs/mods/security/src/components/secure-object/index.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-object/metadata/metadata-manager.js +0 -183
- package/dist/cjs/mods/security/src/components/secure-object/metadata/metadata-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-object/serialization/serialization-handler.js +0 -197
- package/dist/cjs/mods/security/src/components/secure-object/serialization/serialization-handler.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-object/utils/id-generator.js +0 -64
- package/dist/cjs/mods/security/src/components/secure-object/utils/id-generator.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-object/utils/validation.js +0 -239
- package/dist/cjs/mods/security/src/components/secure-object/utils/validation.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-serialization.js +0 -772
- package/dist/cjs/mods/security/src/components/secure-serialization.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-string/advanced/entropy-analyzer.js +0 -308
- package/dist/cjs/mods/security/src/components/secure-string/advanced/entropy-analyzer.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-string/advanced/performance-monitor.js +0 -335
- package/dist/cjs/mods/security/src/components/secure-string/advanced/performance-monitor.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-string/advanced/quantum-safe.js +0 -245
- package/dist/cjs/mods/security/src/components/secure-string/advanced/quantum-safe.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-string/buffer/buffer-manager.js +0 -205
- package/dist/cjs/mods/security/src/components/secure-string/buffer/buffer-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-string/core/secure-string-core.js +0 -788
- package/dist/cjs/mods/security/src/components/secure-string/core/secure-string-core.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-string/crypto/crypto-operations.js +0 -319
- package/dist/cjs/mods/security/src/components/secure-string/crypto/crypto-operations.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-string/operations/comparison-operations.js +0 -221
- package/dist/cjs/mods/security/src/components/secure-string/operations/comparison-operations.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-string/operations/string-operations.js +0 -234
- package/dist/cjs/mods/security/src/components/secure-string/operations/string-operations.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-string/types/index.js +0 -41
- package/dist/cjs/mods/security/src/components/secure-string/types/index.js.map +0 -1
- package/dist/cjs/mods/security/src/components/secure-string/validation/string-validator.js +0 -334
- package/dist/cjs/mods/security/src/components/secure-string/validation/string-validator.js.map +0 -1
- package/dist/cjs/mods/security/src/components/side-channel.js +0 -146
- package/dist/cjs/mods/security/src/components/side-channel.js.map +0 -1
- package/dist/cjs/mods/security/src/components/tamper-evident-logging.js +0 -391
- package/dist/cjs/mods/security/src/components/tamper-evident-logging.js.map +0 -1
- package/dist/cjs/mods/security/src/const/buffer.const.js +0 -15
- package/dist/cjs/mods/security/src/const/buffer.const.js.map +0 -1
- package/dist/cjs/mods/security/src/core/crypto.js +0 -779
- package/dist/cjs/mods/security/src/core/crypto.js.map +0 -1
- package/dist/cjs/mods/security/src/core/hash/hash-advanced.js +0 -388
- package/dist/cjs/mods/security/src/core/hash/hash-advanced.js.map +0 -1
- package/dist/cjs/mods/security/src/core/hash/hash-core.js +0 -410
- package/dist/cjs/mods/security/src/core/hash/hash-core.js.map +0 -1
- package/dist/cjs/mods/security/src/core/hash/hash-entropy.js +0 -307
- package/dist/cjs/mods/security/src/core/hash/hash-entropy.js.map +0 -1
- package/dist/cjs/mods/security/src/core/hash/hash-security.js +0 -372
- package/dist/cjs/mods/security/src/core/hash/hash-security.js.map +0 -1
- package/dist/cjs/mods/security/src/core/hash/hash-types.js +0 -16
- package/dist/cjs/mods/security/src/core/hash/hash-types.js.map +0 -1
- package/dist/cjs/mods/security/src/core/hash/hash-utils.js +0 -328
- package/dist/cjs/mods/security/src/core/hash/hash-utils.js.map +0 -1
- package/dist/cjs/mods/security/src/core/hash/hash-validator.js +0 -312
- package/dist/cjs/mods/security/src/core/hash/hash-validator.js.map +0 -1
- package/dist/cjs/mods/security/src/core/hash.js +0 -25
- package/dist/cjs/mods/security/src/core/hash.js.map +0 -1
- package/dist/cjs/mods/security/src/core/keys/algorithms/mods/Argon2Algo.js +0 -135
- package/dist/cjs/mods/security/src/core/keys/algorithms/mods/Argon2Algo.js.map +0 -1
- package/dist/cjs/mods/security/src/core/keys/algorithms/mods/PBKDF2Algo.js +0 -293
- package/dist/cjs/mods/security/src/core/keys/algorithms/mods/PBKDF2Algo.js.map +0 -1
- package/dist/cjs/mods/security/src/core/keys/algorithms/mods/ScryptAlgo.js +0 -317
- package/dist/cjs/mods/security/src/core/keys/algorithms/mods/ScryptAlgo.js.map +0 -1
- package/dist/cjs/mods/security/src/core/keys/keys-core.js +0 -201
- package/dist/cjs/mods/security/src/core/keys/keys-core.js.map +0 -1
- package/dist/cjs/mods/security/src/core/keys/keys-logger.js +0 -234
- package/dist/cjs/mods/security/src/core/keys/keys-logger.js.map +0 -1
- package/dist/cjs/mods/security/src/core/keys/keys-types.js +0 -65
- package/dist/cjs/mods/security/src/core/keys/keys-types.js.map +0 -1
- package/dist/cjs/mods/security/src/core/keys/keys-utils.js +0 -322
- package/dist/cjs/mods/security/src/core/keys/keys-utils.js.map +0 -1
- package/dist/cjs/mods/security/src/core/keys.js +0 -136
- package/dist/cjs/mods/security/src/core/keys.js.map +0 -1
- package/dist/cjs/mods/security/src/core/password/index.js +0 -122
- package/dist/cjs/mods/security/src/core/password/index.js.map +0 -1
- package/dist/cjs/mods/security/src/core/password/password-algorithms.js +0 -397
- package/dist/cjs/mods/security/src/core/password/password-algorithms.js.map +0 -1
- package/dist/cjs/mods/security/src/core/password/password-core.js +0 -294
- package/dist/cjs/mods/security/src/core/password/password-core.js.map +0 -1
- package/dist/cjs/mods/security/src/core/password/password-generator.js +0 -365
- package/dist/cjs/mods/security/src/core/password/password-generator.js.map +0 -1
- package/dist/cjs/mods/security/src/core/password/password-migration.js +0 -237
- package/dist/cjs/mods/security/src/core/password/password-migration.js.map +0 -1
- package/dist/cjs/mods/security/src/core/password/password-security.js +0 -534
- package/dist/cjs/mods/security/src/core/password/password-security.js.map +0 -1
- package/dist/cjs/mods/security/src/core/password/password-types.js +0 -39
- package/dist/cjs/mods/security/src/core/password/password-types.js.map +0 -1
- package/dist/cjs/mods/security/src/core/password/password-utils.js +0 -651
- package/dist/cjs/mods/security/src/core/password/password-utils.js.map +0 -1
- package/dist/cjs/mods/security/src/core/password/swlist.js +0 -1122
- package/dist/cjs/mods/security/src/core/password/swlist.js.map +0 -1
- package/dist/cjs/mods/security/src/core/random/random-core.js +0 -962
- package/dist/cjs/mods/security/src/core/random/random-core.js.map +0 -1
- package/dist/cjs/mods/security/src/core/random/random-crypto.js +0 -339
- package/dist/cjs/mods/security/src/core/random/random-crypto.js.map +0 -1
- package/dist/cjs/mods/security/src/core/random/random-entropy.js +0 -387
- package/dist/cjs/mods/security/src/core/random/random-entropy.js.map +0 -1
- package/dist/cjs/mods/security/src/core/random/random-generators.js +0 -344
- package/dist/cjs/mods/security/src/core/random/random-generators.js.map +0 -1
- package/dist/cjs/mods/security/src/core/random/random-sources.js +0 -426
- package/dist/cjs/mods/security/src/core/random/random-sources.js.map +0 -1
- package/dist/cjs/mods/security/src/core/random/random-tokens.js +0 -309
- package/dist/cjs/mods/security/src/core/random/random-tokens.js.map +0 -1
- package/dist/cjs/mods/security/src/core/random/random-types.js +0 -36
- package/dist/cjs/mods/security/src/core/random/random-types.js.map +0 -1
- package/dist/cjs/mods/security/src/core/validators.js +0 -200
- package/dist/cjs/mods/security/src/core/validators.js.map +0 -1
- package/dist/cjs/mods/security/src/helpers/Uint8Array.js +0 -335
- package/dist/cjs/mods/security/src/helpers/Uint8Array.js.map +0 -1
- package/dist/cjs/mods/security/src/helpers/createEnu.js +0 -27
- package/dist/cjs/mods/security/src/helpers/createEnu.js.map +0 -1
- package/dist/cjs/mods/security/src/index.js +0 -406
- package/dist/cjs/mods/security/src/index.js.map +0 -1
- package/dist/cjs/mods/security/src/types/global.js +0 -51
- package/dist/cjs/mods/security/src/types/global.js.map +0 -1
- package/dist/cjs/mods/security/src/types/secure-mem.type.js +0 -106
- package/dist/cjs/mods/security/src/types/secure-mem.type.js.map +0 -1
- package/dist/cjs/mods/security/src/types/secure-memory.js +0 -20
- package/dist/cjs/mods/security/src/types/secure-memory.js.map +0 -1
- package/dist/cjs/mods/security/src/types.js +0 -63
- package/dist/cjs/mods/security/src/types.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/CryptoAlgorithmUtils.js +0 -71
- package/dist/cjs/mods/security/src/utils/CryptoAlgorithmUtils.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/constants.js +0 -111
- package/dist/cjs/mods/security/src/utils/constants.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/crypto.utils.js +0 -386
- package/dist/cjs/mods/security/src/utils/crypto.utils.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/dataConverter.js +0 -74
- package/dist/cjs/mods/security/src/utils/dataConverter.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/encoding.js +0 -290
- package/dist/cjs/mods/security/src/utils/encoding.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/errorHandler.js +0 -140
- package/dist/cjs/mods/security/src/utils/errorHandler.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/memory/config-manager.js +0 -290
- package/dist/cjs/mods/security/src/utils/memory/config-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/memory/event-manager.js +0 -277
- package/dist/cjs/mods/security/src/utils/memory/event-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/memory/index.js +0 -162
- package/dist/cjs/mods/security/src/utils/memory/index.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/memory/memory-manager.js +0 -888
- package/dist/cjs/mods/security/src/utils/memory/memory-manager.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/memory/memory-pool.js +0 -356
- package/dist/cjs/mods/security/src/utils/memory/memory-pool.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/memory/reference-tracker.js +0 -384
- package/dist/cjs/mods/security/src/utils/memory/reference-tracker.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/memory/types.js +0 -56
- package/dist/cjs/mods/security/src/utils/memory/types.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/patterns.js +0 -127
- package/dist/cjs/mods/security/src/utils/patterns.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/performanceMonitor.js +0 -249
- package/dist/cjs/mods/security/src/utils/performanceMonitor.js.map +0 -1
- package/dist/cjs/mods/security/src/utils/stats.js +0 -182
- package/dist/cjs/mods/security/src/utils/stats.js.map +0 -1
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/shared/logger/Logger.js +0 -591
- package/dist/cjs/shared/logger/Logger.js.map +0 -1
- package/dist/cjs/src/FiUp.js +0 -88
- package/dist/cjs/src/FiUp.js.map +0 -1
- package/dist/cjs/src/cache/CacheFactory.js +0 -416
- package/dist/cjs/src/cache/CacheFactory.js.map +0 -1
- package/dist/cjs/src/cache/SecureCacheAdapter.js +0 -1239
- package/dist/cjs/src/cache/SecureCacheAdapter.js.map +0 -1
- package/dist/cjs/src/cluster/bun-cluster-manager.js +0 -1656
- package/dist/cjs/src/cluster/bun-cluster-manager.js.map +0 -1
- package/dist/cjs/src/cluster/cluster-manager.js +0 -1023
- package/dist/cjs/src/cluster/cluster-manager.js.map +0 -1
- package/dist/cjs/src/cluster/memory-manager.js +0 -485
- package/dist/cjs/src/cluster/memory-manager.js.map +0 -1
- package/dist/cjs/src/cluster/modules/AutoScaler.js +0 -532
- package/dist/cjs/src/cluster/modules/AutoScaler.js.map +0 -1
- package/dist/cjs/src/cluster/modules/BunIPCManager.js +0 -603
- package/dist/cjs/src/cluster/modules/BunIPCManager.js.map +0 -1
- package/dist/cjs/src/cluster/modules/ClusterPersistenceManager.js +0 -437
- package/dist/cjs/src/cluster/modules/ClusterPersistenceManager.js.map +0 -1
- package/dist/cjs/src/cluster/modules/CpuMonitor.js +0 -659
- package/dist/cjs/src/cluster/modules/CpuMonitor.js.map +0 -1
- package/dist/cjs/src/cluster/modules/CrossPlatformMemory.js +0 -329
- package/dist/cjs/src/cluster/modules/CrossPlatformMemory.js.map +0 -1
- package/dist/cjs/src/cluster/modules/EventLoopMonitor.js +0 -265
- package/dist/cjs/src/cluster/modules/EventLoopMonitor.js.map +0 -1
- package/dist/cjs/src/cluster/modules/GCStatsTracker.js +0 -200
- package/dist/cjs/src/cluster/modules/GCStatsTracker.js.map +0 -1
- package/dist/cjs/src/cluster/modules/HealthMonitor.js +0 -461
- package/dist/cjs/src/cluster/modules/HealthMonitor.js.map +0 -1
- package/dist/cjs/src/cluster/modules/HeapStatsCollector.js +0 -111
- package/dist/cjs/src/cluster/modules/HeapStatsCollector.js.map +0 -1
- package/dist/cjs/src/cluster/modules/IPCManager.js +0 -781
- package/dist/cjs/src/cluster/modules/IPCManager.js.map +0 -1
- package/dist/cjs/src/cluster/modules/MetricsCollector.js +0 -559
- package/dist/cjs/src/cluster/modules/MetricsCollector.js.map +0 -1
- package/dist/cjs/src/cluster/modules/NetworkTracker.js +0 -162
- package/dist/cjs/src/cluster/modules/NetworkTracker.js.map +0 -1
- package/dist/cjs/src/cluster/modules/ProcessMonitor.js +0 -513
- package/dist/cjs/src/cluster/modules/ProcessMonitor.js.map +0 -1
- package/dist/cjs/src/cluster/modules/ThroughputCalculator.js +0 -186
- package/dist/cjs/src/cluster/modules/ThroughputCalculator.js.map +0 -1
- package/dist/cjs/src/cluster/modules/WorkerManager.js +0 -1186
- package/dist/cjs/src/cluster/modules/WorkerManager.js.map +0 -1
- package/dist/cjs/src/cluster/modules/strategy/LoadBalancer.js +0 -1123
- package/dist/cjs/src/cluster/modules/strategy/LoadBalancer.js.map +0 -1
- package/dist/cjs/src/config.js +0 -366
- package/dist/cjs/src/config.js.map +0 -1
- package/dist/cjs/src/const.js +0 -577
- package/dist/cjs/src/const.js.map +0 -1
- package/dist/cjs/src/encryption/EncryptionService.js +0 -422
- package/dist/cjs/src/encryption/EncryptionService.js.map +0 -1
- package/dist/cjs/src/file-upload.js +0 -259
- package/dist/cjs/src/file-upload.js.map +0 -1
- package/dist/cjs/src/index.js +0 -100
- package/dist/cjs/src/index.js.map +0 -1
- package/dist/cjs/src/middleware/XJsonResponseHandler.js +0 -152
- package/dist/cjs/src/middleware/XJsonResponseHandler.js.map +0 -1
- package/dist/cjs/src/middleware/XemsSessionMiddleware.js +0 -88
- package/dist/cjs/src/middleware/XemsSessionMiddleware.js.map +0 -1
- package/dist/cjs/src/middleware/XyPrissMiddlewareAPI.js +0 -354
- package/dist/cjs/src/middleware/XyPrissMiddlewareAPI.js.map +0 -1
- package/dist/cjs/src/middleware/built-in/BuiltInMiddleware.js +0 -524
- package/dist/cjs/src/middleware/built-in/BuiltInMiddleware.js.map +0 -1
- package/dist/cjs/src/middleware/built-in/security/BrowserOnlyProtector.js +0 -552
- package/dist/cjs/src/middleware/built-in/security/BrowserOnlyProtector.js.map +0 -1
- package/dist/cjs/src/middleware/built-in/security/CommandInjectionDetector.js +0 -215
- package/dist/cjs/src/middleware/built-in/security/CommandInjectionDetector.js.map +0 -1
- package/dist/cjs/src/middleware/built-in/security/LDAPInjectionDetector.js +0 -96
- package/dist/cjs/src/middleware/built-in/security/LDAPInjectionDetector.js.map +0 -1
- package/dist/cjs/src/middleware/built-in/security/MobileOnlyProtector.js +0 -504
- package/dist/cjs/src/middleware/built-in/security/MobileOnlyProtector.js.map +0 -1
- package/dist/cjs/src/middleware/built-in/security/PathTraversalDetector.js +0 -212
- package/dist/cjs/src/middleware/built-in/security/PathTraversalDetector.js.map +0 -1
- package/dist/cjs/src/middleware/built-in/security/RequestSignatureProtector.js +0 -481
- package/dist/cjs/src/middleware/built-in/security/RequestSignatureProtector.js.map +0 -1
- package/dist/cjs/src/middleware/built-in/security/SQLInjectionDetector.js +0 -335
- package/dist/cjs/src/middleware/built-in/security/SQLInjectionDetector.js.map +0 -1
- package/dist/cjs/src/middleware/built-in/security/TerminalOnlyProtector.js +0 -478
- package/dist/cjs/src/middleware/built-in/security/TerminalOnlyProtector.js.map +0 -1
- package/dist/cjs/src/middleware/built-in/security/XXEProtector.js +0 -175
- package/dist/cjs/src/middleware/built-in/security/XXEProtector.js.map +0 -1
- package/dist/cjs/src/middleware/safe-json-middleware.js +0 -159
- package/dist/cjs/src/middleware/safe-json-middleware.js.map +0 -1
- package/dist/cjs/src/middleware/security-middleware.js +0 -1059
- package/dist/cjs/src/middleware/security-middleware.js.map +0 -1
- package/dist/cjs/src/plugins/PluginManager.js +0 -410
- package/dist/cjs/src/plugins/PluginManager.js.map +0 -1
- package/dist/cjs/src/plugins/api/PluginAPI.js +0 -188
- package/dist/cjs/src/plugins/api/PluginAPI.js.map +0 -1
- package/dist/cjs/src/plugins/const/PluginHookIds.js +0 -64
- package/dist/cjs/src/plugins/const/PluginHookIds.js.map +0 -1
- package/dist/cjs/src/plugins/core/PluginManager.js +0 -677
- package/dist/cjs/src/plugins/core/PluginManager.js.map +0 -1
- package/dist/cjs/src/plugins/modules/PluginEngine.js +0 -494
- package/dist/cjs/src/plugins/modules/PluginEngine.js.map +0 -1
- package/dist/cjs/src/plugins/modules/PluginRegistry.js +0 -309
- package/dist/cjs/src/plugins/modules/PluginRegistry.js.map +0 -1
- package/dist/cjs/src/plugins/modules/builtin/JWTAuthPlugin.js +0 -591
- package/dist/cjs/src/plugins/modules/builtin/JWTAuthPlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/builtin/ResponseTimePlugin.js +0 -413
- package/dist/cjs/src/plugins/modules/builtin/ResponseTimePlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/builtin/SmartCachePlugin.js +0 -843
- package/dist/cjs/src/plugins/modules/builtin/SmartCachePlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/builtin/server-maintenance-plugin.js +0 -588
- package/dist/cjs/src/plugins/modules/builtin/server-maintenance-plugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/core/CachePlugin.js +0 -1977
- package/dist/cjs/src/plugins/modules/core/CachePlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/core/PerformancePlugin.js +0 -894
- package/dist/cjs/src/plugins/modules/core/PerformancePlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/core/SecurityPlugin.js +0 -799
- package/dist/cjs/src/plugins/modules/core/SecurityPlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/index.js +0 -302
- package/dist/cjs/src/plugins/modules/index.js.map +0 -1
- package/dist/cjs/src/plugins/modules/network/builtin/CompressionPlugin.js +0 -302
- package/dist/cjs/src/plugins/modules/network/builtin/CompressionPlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/network/builtin/ConnectionPlugin.js +0 -797
- package/dist/cjs/src/plugins/modules/network/builtin/ConnectionPlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/network/builtin/ProxyPlugin.js +0 -424
- package/dist/cjs/src/plugins/modules/network/builtin/ProxyPlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/network/builtin/RateLimitPlugin.js +0 -605
- package/dist/cjs/src/plugins/modules/network/builtin/RateLimitPlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/network/core/NetworkPlugin.js +0 -230
- package/dist/cjs/src/plugins/modules/network/core/NetworkPlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/network/core/NetworkPluginFactory.js +0 -40
- package/dist/cjs/src/plugins/modules/network/core/NetworkPluginFactory.js.map +0 -1
- package/dist/cjs/src/plugins/modules/network/types/NetworkTypes.js +0 -24
- package/dist/cjs/src/plugins/modules/network/types/NetworkTypes.js.map +0 -1
- package/dist/cjs/src/plugins/modules/network/utils/NetworkPluginUtils.js +0 -63
- package/dist/cjs/src/plugins/modules/network/utils/NetworkPluginUtils.js.map +0 -1
- package/dist/cjs/src/plugins/modules/types/PluginTypes.js +0 -48
- package/dist/cjs/src/plugins/modules/types/PluginTypes.js.map +0 -1
- package/dist/cjs/src/plugins/modules/xems/XemsBuiltinPlugin.js +0 -216
- package/dist/cjs/src/plugins/modules/xems/XemsBuiltinPlugin.js.map +0 -1
- package/dist/cjs/src/plugins/modules/xems/XemsPlugin.js +0 -354
- package/dist/cjs/src/plugins/modules/xems/XemsPlugin.js.map +0 -1
- package/dist/cjs/src/plugins/plugin-manager.js +0 -151
- package/dist/cjs/src/plugins/plugin-manager.js.map +0 -1
- package/dist/cjs/src/plugins/route-optimization-plugin.js +0 -421
- package/dist/cjs/src/plugins/route-optimization-plugin.js.map +0 -1
- package/dist/cjs/src/plugins/server-maintenance-plugin.js +0 -588
- package/dist/cjs/src/plugins/server-maintenance-plugin.js.map +0 -1
- package/dist/cjs/src/quick-start.js +0 -43
- package/dist/cjs/src/quick-start.js.map +0 -1
- package/dist/cjs/src/schemas/plugingSchema.js +0 -40
- package/dist/cjs/src/schemas/plugingSchema.js.map +0 -1
- package/dist/cjs/src/server/FastServer.js +0 -858
- package/dist/cjs/src/server/FastServer.js.map +0 -1
- package/dist/cjs/src/server/ServerFactory.js +0 -67
- package/dist/cjs/src/server/ServerFactory.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/CacheManager.js +0 -245
- package/dist/cjs/src/server/components/fastapi/CacheManager.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/ClusterManagerComponent.js +0 -569
- package/dist/cjs/src/server/components/fastapi/ClusterManagerComponent.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/FileUploadManager.js +0 -197
- package/dist/cjs/src/server/components/fastapi/FileUploadManager.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/FileWatcherManager.js +0 -536
- package/dist/cjs/src/server/components/fastapi/FileWatcherManager.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/MonitoringManager.js +0 -307
- package/dist/cjs/src/server/components/fastapi/MonitoringManager.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/PerformanceManager.js +0 -297
- package/dist/cjs/src/server/components/fastapi/PerformanceManager.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/PluginManager.js +0 -395
- package/dist/cjs/src/server/components/fastapi/PluginManager.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/RedirectManager.js +0 -487
- package/dist/cjs/src/server/components/fastapi/RedirectManager.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/RequestProcessor.js +0 -213
- package/dist/cjs/src/server/components/fastapi/RequestProcessor.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/RouteManager.js +0 -190
- package/dist/cjs/src/server/components/fastapi/RouteManager.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/WorkerPoolComponent.js +0 -82
- package/dist/cjs/src/server/components/fastapi/WorkerPoolComponent.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/console/ConsoleInterceptor.js +0 -980
- package/dist/cjs/src/server/components/fastapi/console/ConsoleInterceptor.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/console/encryption/ConsoleEncryption.js +0 -216
- package/dist/cjs/src/server/components/fastapi/console/encryption/ConsoleEncryption.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/console/types.js +0 -163
- package/dist/cjs/src/server/components/fastapi/console/types.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/modules/UFRP/WorkerPoolManager.js +0 -265
- package/dist/cjs/src/server/components/fastapi/modules/UFRP/WorkerPoolManager.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/modules/UFRP/workers/Logger.js +0 -236
- package/dist/cjs/src/server/components/fastapi/modules/UFRP/workers/cpu-tasks.js +0 -294
- package/dist/cjs/src/server/components/fastapi/modules/UFRP/workers/enhanced-cpu-worker.js +0 -433
- package/dist/cjs/src/server/components/fastapi/modules/UFRP/workers/io-worker.js +0 -1617
- package/dist/cjs/src/server/components/fastapi/smart-routes.js +0 -347
- package/dist/cjs/src/server/components/fastapi/smart-routes.js.map +0 -1
- package/dist/cjs/src/server/components/fastapi/templates/redirectTemp.js +0 -101
- package/dist/cjs/src/server/components/fastapi/templates/redirectTemp.js.map +0 -1
- package/dist/cjs/src/server/components/lifecycle/ServerLifecycleManager.js +0 -522
- package/dist/cjs/src/server/components/lifecycle/ServerLifecycleManager.js.map +0 -1
- package/dist/cjs/src/server/components/multi-server/MultiServerApp.js +0 -534
- package/dist/cjs/src/server/components/multi-server/MultiServerApp.js.map +0 -1
- package/dist/cjs/src/server/components/multi-server/MultiServerManager.js +0 -326
- package/dist/cjs/src/server/components/multi-server/MultiServerManager.js.map +0 -1
- package/dist/cjs/src/server/conf/networkConnectionConf.js +0 -25
- package/dist/cjs/src/server/conf/networkConnectionConf.js.map +0 -1
- package/dist/cjs/src/server/conf/proxyConfig.js +0 -23
- package/dist/cjs/src/server/conf/proxyConfig.js.map +0 -1
- package/dist/cjs/src/server/const/Cluster.config.js +0 -215
- package/dist/cjs/src/server/const/Cluster.config.js.map +0 -1
- package/dist/cjs/src/server/const/ExecutionPredictor_EP.const.js +0 -73
- package/dist/cjs/src/server/const/ExecutionPredictor_EP.const.js.map +0 -1
- package/dist/cjs/src/server/const/FileWatcher.config.js +0 -98
- package/dist/cjs/src/server/const/FileWatcher.config.js.map +0 -1
- package/dist/cjs/src/server/const/default.js +0 -393
- package/dist/cjs/src/server/const/default.js.map +0 -1
- package/dist/cjs/src/server/const/http.js +0 -19
- package/dist/cjs/src/server/const/http.js.map +0 -1
- package/dist/cjs/src/server/core/HttpServer.js +0 -396
- package/dist/cjs/src/server/core/HttpServer.js.map +0 -1
- package/dist/cjs/src/server/core/RequestApp.js +0 -95
- package/dist/cjs/src/server/core/RequestApp.js.map +0 -1
- package/dist/cjs/src/server/core/RequestEnhancer.js +0 -288
- package/dist/cjs/src/server/core/RequestEnhancer.js.map +0 -1
- package/dist/cjs/src/server/core/ResponseEnhancer.js +0 -518
- package/dist/cjs/src/server/core/ResponseEnhancer.js.map +0 -1
- package/dist/cjs/src/server/core/StartupProcessor.js +0 -111
- package/dist/cjs/src/server/core/StartupProcessor.js.map +0 -1
- package/dist/cjs/src/server/core/VirtualServer.js +0 -33
- package/dist/cjs/src/server/core/VirtualServer.js.map +0 -1
- package/dist/cjs/src/server/core/XHSCBridge.js +0 -524
- package/dist/cjs/src/server/core/XHSCBridge.js.map +0 -1
- package/dist/cjs/src/server/core/XHSCProtocol.js +0 -314
- package/dist/cjs/src/server/core/XHSCProtocol.js.map +0 -1
- package/dist/cjs/src/server/core/XyDiagnosticsManager.js +0 -78
- package/dist/cjs/src/server/core/XyDiagnosticsManager.js.map +0 -1
- package/dist/cjs/src/server/core/XyLifecycleManager.js +0 -237
- package/dist/cjs/src/server/core/XyLifecycleManager.js.map +0 -1
- package/dist/cjs/src/server/core/XyModuleManager.js +0 -161
- package/dist/cjs/src/server/core/XyModuleManager.js.map +0 -1
- package/dist/cjs/src/server/core/XyRoutingManager.js +0 -187
- package/dist/cjs/src/server/core/XyRoutingManager.js.map +0 -1
- package/dist/cjs/src/server/core/XyServerCreator.js +0 -97
- package/dist/cjs/src/server/core/XyServerCreator.js.map +0 -1
- package/dist/cjs/src/server/core/XyprissApp.js +0 -483
- package/dist/cjs/src/server/core/XyprissApp.js.map +0 -1
- package/dist/cjs/src/server/core/request/XyRequestManager.js +0 -229
- package/dist/cjs/src/server/core/request/XyRequestManager.js.map +0 -1
- package/dist/cjs/src/server/handlers/NotFoundHandler.js +0 -84
- package/dist/cjs/src/server/handlers/NotFoundHandler.js.map +0 -1
- package/dist/cjs/src/server/handlers/templates/notFoundTemplate.js +0 -655
- package/dist/cjs/src/server/handlers/templates/notFoundTemplate.js.map +0 -1
- package/dist/cjs/src/server/middleware/MiddlewareManager.js +0 -197
- package/dist/cjs/src/server/middleware/MiddlewareManager.js.map +0 -1
- package/dist/cjs/src/server/optimization/ExecutionPredictor.js +0 -218
- package/dist/cjs/src/server/optimization/ExecutionPredictor.js.map +0 -1
- package/dist/cjs/src/server/optimization/PerformanceProfiler.js +0 -234
- package/dist/cjs/src/server/optimization/PerformanceProfiler.js.map +0 -1
- package/dist/cjs/src/server/optimization/RequestPreCompiler.js +0 -709
- package/dist/cjs/src/server/optimization/RequestPreCompiler.js.map +0 -1
- package/dist/cjs/src/server/optimization/UltraFastOptimizer.js +0 -427
- package/dist/cjs/src/server/optimization/UltraFastOptimizer.js.map +0 -1
- package/dist/cjs/src/server/optimization/performance-monitor.js +0 -162
- package/dist/cjs/src/server/optimization/performance-monitor.js.map +0 -1
- package/dist/cjs/src/server/routing/Router.js +0 -353
- package/dist/cjs/src/server/routing/Router.js.map +0 -1
- package/dist/cjs/src/server/service/Reload/FileWatcher.js +0 -756
- package/dist/cjs/src/server/service/Reload/FileWatcher.js.map +0 -1
- package/dist/cjs/src/server/service/Reload/HotReloader.js +0 -738
- package/dist/cjs/src/server/service/Reload/HotReloader.js.map +0 -1
- package/dist/cjs/src/server/service/Reload/exec/TypeScriptExecutor.js +0 -342
- package/dist/cjs/src/server/service/Reload/exec/TypeScriptExecutor.js.map +0 -1
- package/dist/cjs/src/server/utils/ConfigLoader.js +0 -362
- package/dist/cjs/src/server/utils/ConfigLoader.js.map +0 -1
- package/dist/cjs/src/server/utils/PortManager.js +0 -237
- package/dist/cjs/src/server/utils/PortManager.js.map +0 -1
- package/dist/cjs/src/server/utils/WorkerModeHandler.js +0 -65
- package/dist/cjs/src/server/utils/WorkerModeHandler.js.map +0 -1
- package/dist/cjs/src/server/utils/forceClosePort.js +0 -332
- package/dist/cjs/src/server/utils/forceClosePort.js.map +0 -1
- package/dist/cjs/src/server/utils/shouldRegisterRouteOnServer.js +0 -34
- package/dist/cjs/src/server/utils/shouldRegisterRouteOnServer.js.map +0 -1
- package/dist/cjs/src/server/utils/trustProxy.js +0 -778
- package/dist/cjs/src/server/utils/trustProxy.js.map +0 -1
- package/dist/cjs/src/sys/FSApi.js +0 -1144
- package/dist/cjs/src/sys/FSApi.js.map +0 -1
- package/dist/cjs/src/sys/FileSystem.js +0 -1302
- package/dist/cjs/src/sys/FileSystem.js.map +0 -1
- package/dist/cjs/src/sys/PathApi.js +0 -202
- package/dist/cjs/src/sys/PathApi.js.map +0 -1
- package/dist/cjs/src/sys/SysApi.js +0 -421
- package/dist/cjs/src/sys/SysApi.js.map +0 -1
- package/dist/cjs/src/sys/System.js +0 -40
- package/dist/cjs/src/sys/System.js.map +0 -1
- package/dist/cjs/src/sys/XyPrissCache.js +0 -70
- package/dist/cjs/src/sys/XyPrissCache.js.map +0 -1
- package/dist/cjs/src/sys/XyPrissRunner.js +0 -248
- package/dist/cjs/src/sys/XyPrissRunner.js.map +0 -1
- package/dist/cjs/src/sys.js +0 -404
- package/dist/cjs/src/sys.js.map +0 -1
- package/dist/cjs/src/types/NotFoundConfig.js +0 -86
- package/dist/cjs/src/types/NotFoundConfig.js.map +0 -1
- package/dist/cjs/src/utils/DotEnvLoader.js +0 -74
- package/dist/cjs/src/utils/DotEnvLoader.js.map +0 -1
- package/dist/cjs/src/utils/mergeWithDefaults.js +0 -176
- package/dist/cjs/src/utils/mergeWithDefaults.js.map +0 -1
- package/dist/cjs/src/xhs/cluster/XHSCWorker.js +0 -202
- package/dist/cjs/src/xhs/cluster/XHSCWorker.js.map +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/mods/security/src/algorithms/hash-algorithms.js +0 -696
- package/dist/esm/mods/security/src/algorithms/hash-algorithms.js.map +0 -1
- package/dist/esm/mods/security/src/algorithms/registry.js +0 -81
- package/dist/esm/mods/security/src/algorithms/registry.js.map +0 -1
- package/dist/esm/mods/security/src/components/attestation.js +0 -1059
- package/dist/esm/mods/security/src/components/attestation.js.map +0 -1
- package/dist/esm/mods/security/src/components/cache/FastLRU.js +0 -320
- package/dist/esm/mods/security/src/components/cache/FastLRU.js.map +0 -1
- package/dist/esm/mods/security/src/components/cache/UFSIMC.js +0 -1111
- package/dist/esm/mods/security/src/components/cache/UFSIMC.js.map +0 -1
- package/dist/esm/mods/security/src/components/cache/cacheSys.js +0 -622
- package/dist/esm/mods/security/src/components/cache/cacheSys.js.map +0 -1
- package/dist/esm/mods/security/src/components/cache/cacheSys.utils.js +0 -102
- package/dist/esm/mods/security/src/components/cache/cacheSys.utils.js.map +0 -1
- package/dist/esm/mods/security/src/components/cache/config/cache.config.js +0 -36
- package/dist/esm/mods/security/src/components/cache/config/cache.config.js.map +0 -1
- package/dist/esm/mods/security/src/components/cache/index.js +0 -367
- package/dist/esm/mods/security/src/components/cache/index.js.map +0 -1
- package/dist/esm/mods/security/src/components/cache/useCache.js +0 -232
- package/dist/esm/mods/security/src/components/cache/useCache.js.map +0 -1
- package/dist/esm/mods/security/src/components/canary-tokens.js +0 -346
- package/dist/esm/mods/security/src/components/canary-tokens.js.map +0 -1
- package/dist/esm/mods/security/src/components/entropy-augmentation.js +0 -476
- package/dist/esm/mods/security/src/components/entropy-augmentation.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/UFA/ultra-fast-allocator.js +0 -336
- package/dist/esm/mods/security/src/components/fortified-function/UFA/ultra-fast-allocator.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/UFA/ultra-fast-cache.js +0 -534
- package/dist/esm/mods/security/src/components/fortified-function/UFA/ultra-fast-cache.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/UFA/ultra-fast-engine.js +0 -612
- package/dist/esm/mods/security/src/components/fortified-function/UFA/ultra-fast-engine.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/const/exec.const.js +0 -11
- package/dist/esm/mods/security/src/components/fortified-function/const/exec.const.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/fortified-config.js +0 -351
- package/dist/esm/mods/security/src/components/fortified-function/core/fortified-config.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/fortified-function-core.js +0 -518
- package/dist/esm/mods/security/src/components/fortified-function/core/fortified-function-core.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/fortified-logger.js +0 -243
- package/dist/esm/mods/security/src/components/fortified-function/core/fortified-logger.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/api-manager.js +0 -187
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/api-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/cache-manager.js +0 -105
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/cache-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/execution-context.js +0 -103
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/execution-context.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/execution-engine.js +0 -125
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/execution-engine.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/execution-router.js +0 -91
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/execution-router.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/memory-manager.js +0 -145
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/memory-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/security-manager.js +0 -100
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/security-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/stats-manager.js +0 -157
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/stats-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/timing-manager.js +0 -123
- package/dist/esm/mods/security/src/components/fortified-function/core/mods/timing-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/engines/analytics-engine.js +0 -368
- package/dist/esm/mods/security/src/components/fortified-function/engines/analytics-engine.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/engines/execution-engine.js +0 -400
- package/dist/esm/mods/security/src/components/fortified-function/engines/execution-engine.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/index.js +0 -167
- package/dist/esm/mods/security/src/components/fortified-function/index.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/performance/performance-monitor.js +0 -238
- package/dist/esm/mods/security/src/components/fortified-function/performance/performance-monitor.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/performance/performance-timer.js +0 -186
- package/dist/esm/mods/security/src/components/fortified-function/performance/performance-timer.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/security/security-handler.js +0 -252
- package/dist/esm/mods/security/src/components/fortified-function/security/security-handler.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/serializer/safe-serializer.js +0 -344
- package/dist/esm/mods/security/src/components/fortified-function/serializer/safe-serializer.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/smart-cache.js +0 -691
- package/dist/esm/mods/security/src/components/fortified-function/smart-cache.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/types/types.js +0 -14
- package/dist/esm/mods/security/src/components/fortified-function/types/types.js.map +0 -1
- package/dist/esm/mods/security/src/components/fortified-function/utils/utils.js +0 -74
- package/dist/esm/mods/security/src/components/fortified-function/utils/utils.js.map +0 -1
- package/dist/esm/mods/security/src/components/memory-hard.js +0 -919
- package/dist/esm/mods/security/src/components/memory-hard.js.map +0 -1
- package/dist/esm/mods/security/src/components/post-quantum.js +0 -316
- package/dist/esm/mods/security/src/components/post-quantum.js.map +0 -1
- package/dist/esm/mods/security/src/components/runtime-verification.js +0 -643
- package/dist/esm/mods/security/src/components/runtime-verification.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-array/core/secure-array-core.js +0 -1570
- package/dist/esm/mods/security/src/components/secure-array/core/secure-array-core.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-array/crypto/ArrayCryptoHandler.js +0 -328
- package/dist/esm/mods/security/src/components/secure-array/crypto/ArrayCryptoHandler.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-array/events/event-manager.js +0 -268
- package/dist/esm/mods/security/src/components/secure-array/events/event-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-array/index.js +0 -61
- package/dist/esm/mods/security/src/components/secure-array/index.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-array/metadata/metadata-manager.js +0 -329
- package/dist/esm/mods/security/src/components/secure-array/metadata/metadata-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-array/serialization/ArraySerializationHandler.js +0 -388
- package/dist/esm/mods/security/src/components/secure-array/serialization/ArraySerializationHandler.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-array/types/index.js +0 -84
- package/dist/esm/mods/security/src/components/secure-array/types/index.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-array/utils/id-generator.js +0 -78
- package/dist/esm/mods/security/src/components/secure-array/utils/id-generator.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-array/utils/validation.js +0 -273
- package/dist/esm/mods/security/src/components/secure-array/utils/validation.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-memory.js +0 -884
- package/dist/esm/mods/security/src/components/secure-memory.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-object/core/secure-object-core.js +0 -1603
- package/dist/esm/mods/security/src/components/secure-object/core/secure-object-core.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-object/encryption/crypto-handler.js +0 -360
- package/dist/esm/mods/security/src/components/secure-object/encryption/crypto-handler.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-object/encryption/sensitive-keys.js +0 -203
- package/dist/esm/mods/security/src/components/secure-object/encryption/sensitive-keys.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-object/events/event-manager.js +0 -195
- package/dist/esm/mods/security/src/components/secure-object/events/event-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-object/index.js +0 -63
- package/dist/esm/mods/security/src/components/secure-object/index.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-object/metadata/metadata-manager.js +0 -181
- package/dist/esm/mods/security/src/components/secure-object/metadata/metadata-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-object/serialization/serialization-handler.js +0 -195
- package/dist/esm/mods/security/src/components/secure-object/serialization/serialization-handler.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-object/utils/id-generator.js +0 -62
- package/dist/esm/mods/security/src/components/secure-object/utils/id-generator.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-object/utils/validation.js +0 -237
- package/dist/esm/mods/security/src/components/secure-object/utils/validation.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-serialization.js +0 -769
- package/dist/esm/mods/security/src/components/secure-serialization.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-string/advanced/entropy-analyzer.js +0 -306
- package/dist/esm/mods/security/src/components/secure-string/advanced/entropy-analyzer.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-string/advanced/performance-monitor.js +0 -333
- package/dist/esm/mods/security/src/components/secure-string/advanced/performance-monitor.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-string/advanced/quantum-safe.js +0 -243
- package/dist/esm/mods/security/src/components/secure-string/advanced/quantum-safe.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-string/buffer/buffer-manager.js +0 -203
- package/dist/esm/mods/security/src/components/secure-string/buffer/buffer-manager.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-string/core/secure-string-core.js +0 -786
- package/dist/esm/mods/security/src/components/secure-string/core/secure-string-core.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-string/crypto/crypto-operations.js +0 -298
- package/dist/esm/mods/security/src/components/secure-string/crypto/crypto-operations.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-string/operations/comparison-operations.js +0 -219
- package/dist/esm/mods/security/src/components/secure-string/operations/comparison-operations.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-string/operations/string-operations.js +0 -232
- package/dist/esm/mods/security/src/components/secure-string/operations/string-operations.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-string/types/index.js +0 -37
- package/dist/esm/mods/security/src/components/secure-string/types/index.js.map +0 -1
- package/dist/esm/mods/security/src/components/secure-string/validation/string-validator.js +0 -332
- package/dist/esm/mods/security/src/components/secure-string/validation/string-validator.js.map +0 -1
- package/dist/esm/mods/security/src/components/side-channel.js +0 -142
- package/dist/esm/mods/security/src/components/side-channel.js.map +0 -1
- package/dist/esm/mods/security/src/components/tamper-evident-logging.js +0 -389
- package/dist/esm/mods/security/src/components/tamper-evident-logging.js.map +0 -1
- package/dist/esm/mods/security/src/const/buffer.const.js +0 -13
- package/dist/esm/mods/security/src/const/buffer.const.js.map +0 -1
- package/dist/esm/mods/security/src/core/crypto.js +0 -777
- package/dist/esm/mods/security/src/core/crypto.js.map +0 -1
- package/dist/esm/mods/security/src/core/hash/hash-advanced.js +0 -367
- package/dist/esm/mods/security/src/core/hash/hash-advanced.js.map +0 -1
- package/dist/esm/mods/security/src/core/hash/hash-core.js +0 -389
- package/dist/esm/mods/security/src/core/hash/hash-core.js.map +0 -1
- package/dist/esm/mods/security/src/core/hash/hash-entropy.js +0 -286
- package/dist/esm/mods/security/src/core/hash/hash-entropy.js.map +0 -1
- package/dist/esm/mods/security/src/core/hash/hash-security.js +0 -351
- package/dist/esm/mods/security/src/core/hash/hash-security.js.map +0 -1
- package/dist/esm/mods/security/src/core/hash/hash-types.js +0 -16
- package/dist/esm/mods/security/src/core/hash/hash-types.js.map +0 -1
- package/dist/esm/mods/security/src/core/hash/hash-utils.js +0 -307
- package/dist/esm/mods/security/src/core/hash/hash-utils.js.map +0 -1
- package/dist/esm/mods/security/src/core/hash/hash-validator.js +0 -310
- package/dist/esm/mods/security/src/core/hash/hash-validator.js.map +0 -1
- package/dist/esm/mods/security/src/core/hash.js +0 -9
- package/dist/esm/mods/security/src/core/hash.js.map +0 -1
- package/dist/esm/mods/security/src/core/keys/algorithms/mods/Argon2Algo.js +0 -133
- package/dist/esm/mods/security/src/core/keys/algorithms/mods/Argon2Algo.js.map +0 -1
- package/dist/esm/mods/security/src/core/keys/algorithms/mods/PBKDF2Algo.js +0 -272
- package/dist/esm/mods/security/src/core/keys/algorithms/mods/PBKDF2Algo.js.map +0 -1
- package/dist/esm/mods/security/src/core/keys/algorithms/mods/ScryptAlgo.js +0 -296
- package/dist/esm/mods/security/src/core/keys/algorithms/mods/ScryptAlgo.js.map +0 -1
- package/dist/esm/mods/security/src/core/keys/keys-core.js +0 -199
- package/dist/esm/mods/security/src/core/keys/keys-core.js.map +0 -1
- package/dist/esm/mods/security/src/core/keys/keys-logger.js +0 -231
- package/dist/esm/mods/security/src/core/keys/keys-logger.js.map +0 -1
- package/dist/esm/mods/security/src/core/keys/keys-types.js +0 -63
- package/dist/esm/mods/security/src/core/keys/keys-types.js.map +0 -1
- package/dist/esm/mods/security/src/core/keys/keys-utils.js +0 -316
- package/dist/esm/mods/security/src/core/keys/keys-utils.js.map +0 -1
- package/dist/esm/mods/security/src/core/keys.js +0 -134
- package/dist/esm/mods/security/src/core/keys.js.map +0 -1
- package/dist/esm/mods/security/src/core/password/index.js +0 -110
- package/dist/esm/mods/security/src/core/password/index.js.map +0 -1
- package/dist/esm/mods/security/src/core/password/password-algorithms.js +0 -395
- package/dist/esm/mods/security/src/core/password/password-algorithms.js.map +0 -1
- package/dist/esm/mods/security/src/core/password/password-core.js +0 -292
- package/dist/esm/mods/security/src/core/password/password-core.js.map +0 -1
- package/dist/esm/mods/security/src/core/password/password-generator.js +0 -363
- package/dist/esm/mods/security/src/core/password/password-generator.js.map +0 -1
- package/dist/esm/mods/security/src/core/password/password-migration.js +0 -235
- package/dist/esm/mods/security/src/core/password/password-migration.js.map +0 -1
- package/dist/esm/mods/security/src/core/password/password-security.js +0 -532
- package/dist/esm/mods/security/src/core/password/password-security.js.map +0 -1
- package/dist/esm/mods/security/src/core/password/password-types.js +0 -34
- package/dist/esm/mods/security/src/core/password/password-types.js.map +0 -1
- package/dist/esm/mods/security/src/core/password/password-utils.js +0 -630
- package/dist/esm/mods/security/src/core/password/password-utils.js.map +0 -1
- package/dist/esm/mods/security/src/core/password/swlist.js +0 -1120
- package/dist/esm/mods/security/src/core/password/swlist.js.map +0 -1
- package/dist/esm/mods/security/src/core/random/random-core.js +0 -960
- package/dist/esm/mods/security/src/core/random/random-core.js.map +0 -1
- package/dist/esm/mods/security/src/core/random/random-crypto.js +0 -337
- package/dist/esm/mods/security/src/core/random/random-crypto.js.map +0 -1
- package/dist/esm/mods/security/src/core/random/random-entropy.js +0 -366
- package/dist/esm/mods/security/src/core/random/random-entropy.js.map +0 -1
- package/dist/esm/mods/security/src/core/random/random-generators.js +0 -323
- package/dist/esm/mods/security/src/core/random/random-generators.js.map +0 -1
- package/dist/esm/mods/security/src/core/random/random-sources.js +0 -405
- package/dist/esm/mods/security/src/core/random/random-sources.js.map +0 -1
- package/dist/esm/mods/security/src/core/random/random-tokens.js +0 -307
- package/dist/esm/mods/security/src/core/random/random-tokens.js.map +0 -1
- package/dist/esm/mods/security/src/core/random/random-types.js +0 -27
- package/dist/esm/mods/security/src/core/random/random-types.js.map +0 -1
- package/dist/esm/mods/security/src/core/validators.js +0 -198
- package/dist/esm/mods/security/src/core/validators.js.map +0 -1
- package/dist/esm/mods/security/src/helpers/Uint8Array.js +0 -333
- package/dist/esm/mods/security/src/helpers/Uint8Array.js.map +0 -1
- package/dist/esm/mods/security/src/helpers/createEnu.js +0 -25
- package/dist/esm/mods/security/src/helpers/createEnu.js.map +0 -1
- package/dist/esm/mods/security/src/index.js +0 -340
- package/dist/esm/mods/security/src/index.js.map +0 -1
- package/dist/esm/mods/security/src/types/global.js +0 -49
- package/dist/esm/mods/security/src/types/global.js.map +0 -1
- package/dist/esm/mods/security/src/types/secure-mem.type.js +0 -102
- package/dist/esm/mods/security/src/types/secure-mem.type.js.map +0 -1
- package/dist/esm/mods/security/src/types/secure-memory.js +0 -20
- package/dist/esm/mods/security/src/types/secure-memory.js.map +0 -1
- package/dist/esm/mods/security/src/types.js +0 -63
- package/dist/esm/mods/security/src/types.js.map +0 -1
- package/dist/esm/mods/security/src/utils/CryptoAlgorithmUtils.js +0 -69
- package/dist/esm/mods/security/src/utils/CryptoAlgorithmUtils.js.map +0 -1
- package/dist/esm/mods/security/src/utils/constants.js +0 -105
- package/dist/esm/mods/security/src/utils/constants.js.map +0 -1
- package/dist/esm/mods/security/src/utils/crypto.utils.js +0 -380
- package/dist/esm/mods/security/src/utils/crypto.utils.js.map +0 -1
- package/dist/esm/mods/security/src/utils/dataConverter.js +0 -72
- package/dist/esm/mods/security/src/utils/dataConverter.js.map +0 -1
- package/dist/esm/mods/security/src/utils/encoding.js +0 -279
- package/dist/esm/mods/security/src/utils/encoding.js.map +0 -1
- package/dist/esm/mods/security/src/utils/errorHandler.js +0 -137
- package/dist/esm/mods/security/src/utils/errorHandler.js.map +0 -1
- package/dist/esm/mods/security/src/utils/memory/config-manager.js +0 -288
- package/dist/esm/mods/security/src/utils/memory/config-manager.js.map +0 -1
- package/dist/esm/mods/security/src/utils/memory/event-manager.js +0 -275
- package/dist/esm/mods/security/src/utils/memory/event-manager.js.map +0 -1
- package/dist/esm/mods/security/src/utils/memory/index.js +0 -141
- package/dist/esm/mods/security/src/utils/memory/index.js.map +0 -1
- package/dist/esm/mods/security/src/utils/memory/memory-manager.js +0 -886
- package/dist/esm/mods/security/src/utils/memory/memory-manager.js.map +0 -1
- package/dist/esm/mods/security/src/utils/memory/memory-pool.js +0 -354
- package/dist/esm/mods/security/src/utils/memory/memory-pool.js.map +0 -1
- package/dist/esm/mods/security/src/utils/memory/reference-tracker.js +0 -382
- package/dist/esm/mods/security/src/utils/memory/reference-tracker.js.map +0 -1
- package/dist/esm/mods/security/src/utils/memory/types.js +0 -56
- package/dist/esm/mods/security/src/utils/memory/types.js.map +0 -1
- package/dist/esm/mods/security/src/utils/patterns.js +0 -124
- package/dist/esm/mods/security/src/utils/patterns.js.map +0 -1
- package/dist/esm/mods/security/src/utils/performanceMonitor.js +0 -246
- package/dist/esm/mods/security/src/utils/performanceMonitor.js.map +0 -1
- package/dist/esm/mods/security/src/utils/stats.js +0 -180
- package/dist/esm/mods/security/src/utils/stats.js.map +0 -1
- package/dist/esm/package.json +0 -3
- package/dist/esm/shared/logger/Logger.js +0 -587
- package/dist/esm/shared/logger/Logger.js.map +0 -1
- package/dist/esm/src/FiUp.js +0 -82
- package/dist/esm/src/FiUp.js.map +0 -1
- package/dist/esm/src/cache/CacheFactory.js +0 -412
- package/dist/esm/src/cache/CacheFactory.js.map +0 -1
- package/dist/esm/src/cache/SecureCacheAdapter.js +0 -1237
- package/dist/esm/src/cache/SecureCacheAdapter.js.map +0 -1
- package/dist/esm/src/cluster/bun-cluster-manager.js +0 -1654
- package/dist/esm/src/cluster/bun-cluster-manager.js.map +0 -1
- package/dist/esm/src/cluster/cluster-manager.js +0 -1002
- package/dist/esm/src/cluster/cluster-manager.js.map +0 -1
- package/dist/esm/src/cluster/memory-manager.js +0 -483
- package/dist/esm/src/cluster/memory-manager.js.map +0 -1
- package/dist/esm/src/cluster/modules/AutoScaler.js +0 -530
- package/dist/esm/src/cluster/modules/AutoScaler.js.map +0 -1
- package/dist/esm/src/cluster/modules/BunIPCManager.js +0 -601
- package/dist/esm/src/cluster/modules/BunIPCManager.js.map +0 -1
- package/dist/esm/src/cluster/modules/ClusterPersistenceManager.js +0 -435
- package/dist/esm/src/cluster/modules/ClusterPersistenceManager.js.map +0 -1
- package/dist/esm/src/cluster/modules/CpuMonitor.js +0 -657
- package/dist/esm/src/cluster/modules/CpuMonitor.js.map +0 -1
- package/dist/esm/src/cluster/modules/CrossPlatformMemory.js +0 -326
- package/dist/esm/src/cluster/modules/CrossPlatformMemory.js.map +0 -1
- package/dist/esm/src/cluster/modules/EventLoopMonitor.js +0 -263
- package/dist/esm/src/cluster/modules/EventLoopMonitor.js.map +0 -1
- package/dist/esm/src/cluster/modules/GCStatsTracker.js +0 -198
- package/dist/esm/src/cluster/modules/GCStatsTracker.js.map +0 -1
- package/dist/esm/src/cluster/modules/HealthMonitor.js +0 -440
- package/dist/esm/src/cluster/modules/HealthMonitor.js.map +0 -1
- package/dist/esm/src/cluster/modules/HeapStatsCollector.js +0 -109
- package/dist/esm/src/cluster/modules/HeapStatsCollector.js.map +0 -1
- package/dist/esm/src/cluster/modules/IPCManager.js +0 -759
- package/dist/esm/src/cluster/modules/IPCManager.js.map +0 -1
- package/dist/esm/src/cluster/modules/MetricsCollector.js +0 -538
- package/dist/esm/src/cluster/modules/MetricsCollector.js.map +0 -1
- package/dist/esm/src/cluster/modules/NetworkTracker.js +0 -160
- package/dist/esm/src/cluster/modules/NetworkTracker.js.map +0 -1
- package/dist/esm/src/cluster/modules/ProcessMonitor.js +0 -511
- package/dist/esm/src/cluster/modules/ProcessMonitor.js.map +0 -1
- package/dist/esm/src/cluster/modules/ThroughputCalculator.js +0 -184
- package/dist/esm/src/cluster/modules/ThroughputCalculator.js.map +0 -1
- package/dist/esm/src/cluster/modules/WorkerManager.js +0 -1165
- package/dist/esm/src/cluster/modules/WorkerManager.js.map +0 -1
- package/dist/esm/src/cluster/modules/strategy/LoadBalancer.js +0 -1102
- package/dist/esm/src/cluster/modules/strategy/LoadBalancer.js.map +0 -1
- package/dist/esm/src/config.js +0 -362
- package/dist/esm/src/config.js.map +0 -1
- package/dist/esm/src/const.js +0 -574
- package/dist/esm/src/const.js.map +0 -1
- package/dist/esm/src/encryption/EncryptionService.js +0 -401
- package/dist/esm/src/encryption/EncryptionService.js.map +0 -1
- package/dist/esm/src/file-upload.js +0 -251
- package/dist/esm/src/file-upload.js.map +0 -1
- package/dist/esm/src/index.js +0 -62
- package/dist/esm/src/index.js.map +0 -1
- package/dist/esm/src/middleware/XJsonResponseHandler.js +0 -150
- package/dist/esm/src/middleware/XJsonResponseHandler.js.map +0 -1
- package/dist/esm/src/middleware/XemsSessionMiddleware.js +0 -86
- package/dist/esm/src/middleware/XemsSessionMiddleware.js.map +0 -1
- package/dist/esm/src/middleware/XyPrissMiddlewareAPI.js +0 -352
- package/dist/esm/src/middleware/XyPrissMiddlewareAPI.js.map +0 -1
- package/dist/esm/src/middleware/built-in/BuiltInMiddleware.js +0 -522
- package/dist/esm/src/middleware/built-in/BuiltInMiddleware.js.map +0 -1
- package/dist/esm/src/middleware/built-in/security/BrowserOnlyProtector.js +0 -550
- package/dist/esm/src/middleware/built-in/security/BrowserOnlyProtector.js.map +0 -1
- package/dist/esm/src/middleware/built-in/security/CommandInjectionDetector.js +0 -213
- package/dist/esm/src/middleware/built-in/security/CommandInjectionDetector.js.map +0 -1
- package/dist/esm/src/middleware/built-in/security/LDAPInjectionDetector.js +0 -94
- package/dist/esm/src/middleware/built-in/security/LDAPInjectionDetector.js.map +0 -1
- package/dist/esm/src/middleware/built-in/security/MobileOnlyProtector.js +0 -502
- package/dist/esm/src/middleware/built-in/security/MobileOnlyProtector.js.map +0 -1
- package/dist/esm/src/middleware/built-in/security/PathTraversalDetector.js +0 -210
- package/dist/esm/src/middleware/built-in/security/PathTraversalDetector.js.map +0 -1
- package/dist/esm/src/middleware/built-in/security/RequestSignatureProtector.js +0 -460
- package/dist/esm/src/middleware/built-in/security/RequestSignatureProtector.js.map +0 -1
- package/dist/esm/src/middleware/built-in/security/SQLInjectionDetector.js +0 -333
- package/dist/esm/src/middleware/built-in/security/SQLInjectionDetector.js.map +0 -1
- package/dist/esm/src/middleware/built-in/security/TerminalOnlyProtector.js +0 -476
- package/dist/esm/src/middleware/built-in/security/TerminalOnlyProtector.js.map +0 -1
- package/dist/esm/src/middleware/built-in/security/XXEProtector.js +0 -173
- package/dist/esm/src/middleware/built-in/security/XXEProtector.js.map +0 -1
- package/dist/esm/src/middleware/safe-json-middleware.js +0 -153
- package/dist/esm/src/middleware/safe-json-middleware.js.map +0 -1
- package/dist/esm/src/middleware/security-middleware.js +0 -1057
- package/dist/esm/src/middleware/security-middleware.js.map +0 -1
- package/dist/esm/src/plugins/PluginManager.js +0 -408
- package/dist/esm/src/plugins/PluginManager.js.map +0 -1
- package/dist/esm/src/plugins/api/PluginAPI.js +0 -184
- package/dist/esm/src/plugins/api/PluginAPI.js.map +0 -1
- package/dist/esm/src/plugins/const/PluginHookIds.js +0 -61
- package/dist/esm/src/plugins/const/PluginHookIds.js.map +0 -1
- package/dist/esm/src/plugins/core/PluginManager.js +0 -675
- package/dist/esm/src/plugins/core/PluginManager.js.map +0 -1
- package/dist/esm/src/plugins/modules/PluginEngine.js +0 -492
- package/dist/esm/src/plugins/modules/PluginEngine.js.map +0 -1
- package/dist/esm/src/plugins/modules/PluginRegistry.js +0 -307
- package/dist/esm/src/plugins/modules/PluginRegistry.js.map +0 -1
- package/dist/esm/src/plugins/modules/builtin/JWTAuthPlugin.js +0 -589
- package/dist/esm/src/plugins/modules/builtin/JWTAuthPlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/builtin/ResponseTimePlugin.js +0 -411
- package/dist/esm/src/plugins/modules/builtin/ResponseTimePlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/builtin/SmartCachePlugin.js +0 -841
- package/dist/esm/src/plugins/modules/builtin/SmartCachePlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/builtin/server-maintenance-plugin.js +0 -566
- package/dist/esm/src/plugins/modules/builtin/server-maintenance-plugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/core/CachePlugin.js +0 -1975
- package/dist/esm/src/plugins/modules/core/CachePlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/core/PerformancePlugin.js +0 -872
- package/dist/esm/src/plugins/modules/core/PerformancePlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/core/SecurityPlugin.js +0 -797
- package/dist/esm/src/plugins/modules/core/SecurityPlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/index.js +0 -273
- package/dist/esm/src/plugins/modules/index.js.map +0 -1
- package/dist/esm/src/plugins/modules/network/builtin/CompressionPlugin.js +0 -281
- package/dist/esm/src/plugins/modules/network/builtin/CompressionPlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/network/builtin/ConnectionPlugin.js +0 -776
- package/dist/esm/src/plugins/modules/network/builtin/ConnectionPlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/network/builtin/ProxyPlugin.js +0 -422
- package/dist/esm/src/plugins/modules/network/builtin/ProxyPlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/network/builtin/RateLimitPlugin.js +0 -584
- package/dist/esm/src/plugins/modules/network/builtin/RateLimitPlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/network/core/NetworkPlugin.js +0 -228
- package/dist/esm/src/plugins/modules/network/core/NetworkPlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/network/core/NetworkPluginFactory.js +0 -38
- package/dist/esm/src/plugins/modules/network/core/NetworkPluginFactory.js.map +0 -1
- package/dist/esm/src/plugins/modules/network/types/NetworkTypes.js +0 -24
- package/dist/esm/src/plugins/modules/network/types/NetworkTypes.js.map +0 -1
- package/dist/esm/src/plugins/modules/network/utils/NetworkPluginUtils.js +0 -61
- package/dist/esm/src/plugins/modules/network/utils/NetworkPluginUtils.js.map +0 -1
- package/dist/esm/src/plugins/modules/types/PluginTypes.js +0 -48
- package/dist/esm/src/plugins/modules/types/PluginTypes.js.map +0 -1
- package/dist/esm/src/plugins/modules/xems/XemsBuiltinPlugin.js +0 -214
- package/dist/esm/src/plugins/modules/xems/XemsBuiltinPlugin.js.map +0 -1
- package/dist/esm/src/plugins/modules/xems/XemsPlugin.js +0 -349
- package/dist/esm/src/plugins/modules/xems/XemsPlugin.js.map +0 -1
- package/dist/esm/src/plugins/plugin-manager.js +0 -149
- package/dist/esm/src/plugins/plugin-manager.js.map +0 -1
- package/dist/esm/src/plugins/route-optimization-plugin.js +0 -419
- package/dist/esm/src/plugins/route-optimization-plugin.js.map +0 -1
- package/dist/esm/src/plugins/server-maintenance-plugin.js +0 -566
- package/dist/esm/src/plugins/server-maintenance-plugin.js.map +0 -1
- package/dist/esm/src/quick-start.js +0 -41
- package/dist/esm/src/quick-start.js.map +0 -1
- package/dist/esm/src/schemas/plugingSchema.js +0 -38
- package/dist/esm/src/schemas/plugingSchema.js.map +0 -1
- package/dist/esm/src/server/FastServer.js +0 -856
- package/dist/esm/src/server/FastServer.js.map +0 -1
- package/dist/esm/src/server/ServerFactory.js +0 -62
- package/dist/esm/src/server/ServerFactory.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/CacheManager.js +0 -243
- package/dist/esm/src/server/components/fastapi/CacheManager.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/ClusterManagerComponent.js +0 -567
- package/dist/esm/src/server/components/fastapi/ClusterManagerComponent.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/FileUploadManager.js +0 -176
- package/dist/esm/src/server/components/fastapi/FileUploadManager.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/FileWatcherManager.js +0 -534
- package/dist/esm/src/server/components/fastapi/FileWatcherManager.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/MonitoringManager.js +0 -305
- package/dist/esm/src/server/components/fastapi/MonitoringManager.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/PerformanceManager.js +0 -295
- package/dist/esm/src/server/components/fastapi/PerformanceManager.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/PluginManager.js +0 -393
- package/dist/esm/src/server/components/fastapi/PluginManager.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/RedirectManager.js +0 -485
- package/dist/esm/src/server/components/fastapi/RedirectManager.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/RequestProcessor.js +0 -211
- package/dist/esm/src/server/components/fastapi/RequestProcessor.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/RouteManager.js +0 -188
- package/dist/esm/src/server/components/fastapi/RouteManager.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/WorkerPoolComponent.js +0 -80
- package/dist/esm/src/server/components/fastapi/WorkerPoolComponent.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/console/ConsoleInterceptor.js +0 -978
- package/dist/esm/src/server/components/fastapi/console/ConsoleInterceptor.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/console/encryption/ConsoleEncryption.js +0 -214
- package/dist/esm/src/server/components/fastapi/console/encryption/ConsoleEncryption.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/console/types.js +0 -160
- package/dist/esm/src/server/components/fastapi/console/types.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/modules/UFRP/WorkerPoolManager.js +0 -263
- package/dist/esm/src/server/components/fastapi/modules/UFRP/WorkerPoolManager.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/modules/UFRP/workers/Logger.js +0 -236
- package/dist/esm/src/server/components/fastapi/modules/UFRP/workers/cpu-tasks.js +0 -294
- package/dist/esm/src/server/components/fastapi/modules/UFRP/workers/enhanced-cpu-worker.js +0 -433
- package/dist/esm/src/server/components/fastapi/modules/UFRP/workers/io-worker.js +0 -1617
- package/dist/esm/src/server/components/fastapi/smart-routes.js +0 -345
- package/dist/esm/src/server/components/fastapi/smart-routes.js.map +0 -1
- package/dist/esm/src/server/components/fastapi/templates/redirectTemp.js +0 -99
- package/dist/esm/src/server/components/fastapi/templates/redirectTemp.js.map +0 -1
- package/dist/esm/src/server/components/lifecycle/ServerLifecycleManager.js +0 -520
- package/dist/esm/src/server/components/lifecycle/ServerLifecycleManager.js.map +0 -1
- package/dist/esm/src/server/components/multi-server/MultiServerApp.js +0 -532
- package/dist/esm/src/server/components/multi-server/MultiServerApp.js.map +0 -1
- package/dist/esm/src/server/components/multi-server/MultiServerManager.js +0 -324
- package/dist/esm/src/server/components/multi-server/MultiServerManager.js.map +0 -1
- package/dist/esm/src/server/conf/networkConnectionConf.js +0 -23
- package/dist/esm/src/server/conf/networkConnectionConf.js.map +0 -1
- package/dist/esm/src/server/conf/proxyConfig.js +0 -21
- package/dist/esm/src/server/conf/proxyConfig.js.map +0 -1
- package/dist/esm/src/server/const/Cluster.config.js +0 -213
- package/dist/esm/src/server/const/Cluster.config.js.map +0 -1
- package/dist/esm/src/server/const/ExecutionPredictor_EP.const.js +0 -62
- package/dist/esm/src/server/const/ExecutionPredictor_EP.const.js.map +0 -1
- package/dist/esm/src/server/const/FileWatcher.config.js +0 -96
- package/dist/esm/src/server/const/FileWatcher.config.js.map +0 -1
- package/dist/esm/src/server/const/default.js +0 -389
- package/dist/esm/src/server/const/default.js.map +0 -1
- package/dist/esm/src/server/const/http.js +0 -17
- package/dist/esm/src/server/const/http.js.map +0 -1
- package/dist/esm/src/server/core/HttpServer.js +0 -394
- package/dist/esm/src/server/core/HttpServer.js.map +0 -1
- package/dist/esm/src/server/core/RequestApp.js +0 -93
- package/dist/esm/src/server/core/RequestApp.js.map +0 -1
- package/dist/esm/src/server/core/RequestEnhancer.js +0 -286
- package/dist/esm/src/server/core/RequestEnhancer.js.map +0 -1
- package/dist/esm/src/server/core/ResponseEnhancer.js +0 -516
- package/dist/esm/src/server/core/ResponseEnhancer.js.map +0 -1
- package/dist/esm/src/server/core/StartupProcessor.js +0 -109
- package/dist/esm/src/server/core/StartupProcessor.js.map +0 -1
- package/dist/esm/src/server/core/VirtualServer.js +0 -31
- package/dist/esm/src/server/core/VirtualServer.js.map +0 -1
- package/dist/esm/src/server/core/XHSCBridge.js +0 -502
- package/dist/esm/src/server/core/XHSCBridge.js.map +0 -1
- package/dist/esm/src/server/core/XHSCProtocol.js +0 -311
- package/dist/esm/src/server/core/XHSCProtocol.js.map +0 -1
- package/dist/esm/src/server/core/XyDiagnosticsManager.js +0 -76
- package/dist/esm/src/server/core/XyDiagnosticsManager.js.map +0 -1
- package/dist/esm/src/server/core/XyLifecycleManager.js +0 -235
- package/dist/esm/src/server/core/XyLifecycleManager.js.map +0 -1
- package/dist/esm/src/server/core/XyModuleManager.js +0 -159
- package/dist/esm/src/server/core/XyModuleManager.js.map +0 -1
- package/dist/esm/src/server/core/XyRoutingManager.js +0 -185
- package/dist/esm/src/server/core/XyRoutingManager.js.map +0 -1
- package/dist/esm/src/server/core/XyServerCreator.js +0 -95
- package/dist/esm/src/server/core/XyServerCreator.js.map +0 -1
- package/dist/esm/src/server/core/XyprissApp.js +0 -481
- package/dist/esm/src/server/core/XyprissApp.js.map +0 -1
- package/dist/esm/src/server/core/request/XyRequestManager.js +0 -227
- package/dist/esm/src/server/core/request/XyRequestManager.js.map +0 -1
- package/dist/esm/src/server/handlers/NotFoundHandler.js +0 -81
- package/dist/esm/src/server/handlers/NotFoundHandler.js.map +0 -1
- package/dist/esm/src/server/handlers/templates/notFoundTemplate.js +0 -653
- package/dist/esm/src/server/handlers/templates/notFoundTemplate.js.map +0 -1
- package/dist/esm/src/server/middleware/MiddlewareManager.js +0 -195
- package/dist/esm/src/server/middleware/MiddlewareManager.js.map +0 -1
- package/dist/esm/src/server/optimization/ExecutionPredictor.js +0 -216
- package/dist/esm/src/server/optimization/ExecutionPredictor.js.map +0 -1
- package/dist/esm/src/server/optimization/PerformanceProfiler.js +0 -232
- package/dist/esm/src/server/optimization/PerformanceProfiler.js.map +0 -1
- package/dist/esm/src/server/optimization/RequestPreCompiler.js +0 -707
- package/dist/esm/src/server/optimization/RequestPreCompiler.js.map +0 -1
- package/dist/esm/src/server/optimization/UltraFastOptimizer.js +0 -424
- package/dist/esm/src/server/optimization/UltraFastOptimizer.js.map +0 -1
- package/dist/esm/src/server/optimization/performance-monitor.js +0 -160
- package/dist/esm/src/server/optimization/performance-monitor.js.map +0 -1
- package/dist/esm/src/server/routing/Router.js +0 -351
- package/dist/esm/src/server/routing/Router.js.map +0 -1
- package/dist/esm/src/server/service/Reload/FileWatcher.js +0 -734
- package/dist/esm/src/server/service/Reload/FileWatcher.js.map +0 -1
- package/dist/esm/src/server/service/Reload/HotReloader.js +0 -735
- package/dist/esm/src/server/service/Reload/HotReloader.js.map +0 -1
- package/dist/esm/src/server/service/Reload/exec/TypeScriptExecutor.js +0 -339
- package/dist/esm/src/server/service/Reload/exec/TypeScriptExecutor.js.map +0 -1
- package/dist/esm/src/server/utils/ConfigLoader.js +0 -339
- package/dist/esm/src/server/utils/ConfigLoader.js.map +0 -1
- package/dist/esm/src/server/utils/PortManager.js +0 -235
- package/dist/esm/src/server/utils/PortManager.js.map +0 -1
- package/dist/esm/src/server/utils/WorkerModeHandler.js +0 -63
- package/dist/esm/src/server/utils/WorkerModeHandler.js.map +0 -1
- package/dist/esm/src/server/utils/forceClosePort.js +0 -330
- package/dist/esm/src/server/utils/forceClosePort.js.map +0 -1
- package/dist/esm/src/server/utils/shouldRegisterRouteOnServer.js +0 -32
- package/dist/esm/src/server/utils/shouldRegisterRouteOnServer.js.map +0 -1
- package/dist/esm/src/server/utils/trustProxy.js +0 -776
- package/dist/esm/src/server/utils/trustProxy.js.map +0 -1
- package/dist/esm/src/sys/FSApi.js +0 -1142
- package/dist/esm/src/sys/FSApi.js.map +0 -1
- package/dist/esm/src/sys/FileSystem.js +0 -1300
- package/dist/esm/src/sys/FileSystem.js.map +0 -1
- package/dist/esm/src/sys/PathApi.js +0 -199
- package/dist/esm/src/sys/PathApi.js.map +0 -1
- package/dist/esm/src/sys/SysApi.js +0 -419
- package/dist/esm/src/sys/SysApi.js.map +0 -1
- package/dist/esm/src/sys/System.js +0 -38
- package/dist/esm/src/sys/System.js.map +0 -1
- package/dist/esm/src/sys/XyPrissCache.js +0 -68
- package/dist/esm/src/sys/XyPrissCache.js.map +0 -1
- package/dist/esm/src/sys/XyPrissRunner.js +0 -244
- package/dist/esm/src/sys/XyPrissRunner.js.map +0 -1
- package/dist/esm/src/sys.js +0 -401
- package/dist/esm/src/sys.js.map +0 -1
- package/dist/esm/src/types/NotFoundConfig.js +0 -84
- package/dist/esm/src/types/NotFoundConfig.js.map +0 -1
- package/dist/esm/src/utils/DotEnvLoader.js +0 -72
- package/dist/esm/src/utils/DotEnvLoader.js.map +0 -1
- package/dist/esm/src/utils/mergeWithDefaults.js +0 -174
- package/dist/esm/src/utils/mergeWithDefaults.js.map +0 -1
- package/dist/esm/src/xhs/cluster/XHSCWorker.js +0 -181
- package/dist/esm/src/xhs/cluster/XHSCWorker.js.map +0 -1
- package/dist/index.d.ts +0 -9398
|
@@ -1,1654 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { logger } from '../../shared/logger/Logger.js';
|
|
3
|
-
import { MemoryManager } from './memory-manager.js';
|
|
4
|
-
import { randomBytes, createHash } from 'crypto';
|
|
5
|
-
import { performance } from 'perf_hooks';
|
|
6
|
-
import { CpuMonitor } from './modules/CpuMonitor.js';
|
|
7
|
-
import net from 'net';
|
|
8
|
-
import os__default from 'os';
|
|
9
|
-
import { HeapStatsCollector } from './modules/HeapStatsCollector.js';
|
|
10
|
-
import { NetworkTracker } from './modules/NetworkTracker.js';
|
|
11
|
-
import { ThroughputCalculator } from './modules/ThroughputCalculator.js';
|
|
12
|
-
import { GCStatsTracker } from './modules/GCStatsTracker.js';
|
|
13
|
-
import { EventLoopMonitor } from './modules/EventLoopMonitor.js';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Robust Bun-compatible cluster manager
|
|
17
|
-
* Uses Bun's native process spawning and IPC capabilities with enhanced security and reliability
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* Bun-compatible cluster manager with enhanced security and robustness
|
|
21
|
-
*/
|
|
22
|
-
class BunClusterManager extends EventEmitter {
|
|
23
|
-
constructor(config, basePort = 8085, serverOptions = {}) {
|
|
24
|
-
super();
|
|
25
|
-
this.workers = new Map();
|
|
26
|
-
this.isRunning = false;
|
|
27
|
-
this.startTime = 0;
|
|
28
|
-
this.maxShutdownTime = 30000; // 30 seconds
|
|
29
|
-
this.workerPorts = new Set();
|
|
30
|
-
this.serverOptions = {}; // Store server options to pass to workers
|
|
31
|
-
this._validateConfig(config);
|
|
32
|
-
this.config = config;
|
|
33
|
-
this.basePort = basePort;
|
|
34
|
-
this.serverOptions = serverOptions; // Store server options
|
|
35
|
-
this.masterToken = this._generateSecureToken();
|
|
36
|
-
// Initialize security configuration
|
|
37
|
-
this.securityConfig = {
|
|
38
|
-
maxRestartAttempts: config.processManagement?.maxRestarts || 3,
|
|
39
|
-
restartWindow: 300000, // 5 minutes
|
|
40
|
-
maxMemoryPerWorker: this._parseMemoryString(config.resources?.maxMemoryPerWorker || "512MB"),
|
|
41
|
-
allowedSignals: ["SIGTERM", "SIGKILL", "SIGUSR1", "SIGUSR2"],
|
|
42
|
-
processTimeout: 30000, // 30 seconds
|
|
43
|
-
enableResourceLimits: true,
|
|
44
|
-
};
|
|
45
|
-
// Initialize memory manager with error handling
|
|
46
|
-
try {
|
|
47
|
-
this.memoryManager = new MemoryManager(config.resources);
|
|
48
|
-
this._setupMemoryManagement();
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
logger.error("cluster", "Failed to initialize memory manager:", error);
|
|
52
|
-
throw new Error("Failed to initialize cluster manager");
|
|
53
|
-
}
|
|
54
|
-
// Initialize CPU monitor
|
|
55
|
-
this.cpuMonitor = new CpuMonitor({
|
|
56
|
-
enabled: true,
|
|
57
|
-
sampleInterval: 5000,
|
|
58
|
-
historySize: 100,
|
|
59
|
-
smoothingFactor: 0.3,
|
|
60
|
-
alertThresholds: {
|
|
61
|
-
warning: 70,
|
|
62
|
-
critical: 90,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
// Initialize performance monitoring modules
|
|
66
|
-
this.heapStatsCollector = new HeapStatsCollector();
|
|
67
|
-
this.networkTracker = new NetworkTracker();
|
|
68
|
-
this.throughputCalculator = new ThroughputCalculator();
|
|
69
|
-
this.gcStatsTracker = new GCStatsTracker();
|
|
70
|
-
this.eventLoopMonitor = new EventLoopMonitor();
|
|
71
|
-
// Setup graceful shutdown handlers
|
|
72
|
-
this._setupGracefulShutdown();
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Parse memory string to bytes
|
|
76
|
-
*/
|
|
77
|
-
_parseMemoryString(memoryStr) {
|
|
78
|
-
const units = {
|
|
79
|
-
B: 1,
|
|
80
|
-
KB: 1024,
|
|
81
|
-
MB: 1024 * 1024,
|
|
82
|
-
GB: 1024 * 1024 * 1024,
|
|
83
|
-
TB: 1024 * 1024 * 1024 * 1024,
|
|
84
|
-
};
|
|
85
|
-
const match = memoryStr.match(/^(\d+(?:\.\d+)?)\s*([KMGT]?B)$/i);
|
|
86
|
-
if (!match) {
|
|
87
|
-
throw new Error(`Invalid memory format: ${memoryStr}`);
|
|
88
|
-
}
|
|
89
|
-
const value = parseFloat(match[1]);
|
|
90
|
-
const unit = match[2].toUpperCase();
|
|
91
|
-
return value * (units[unit] || 1);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Validate cluster configuration
|
|
95
|
-
*/
|
|
96
|
-
_validateConfig(config) {
|
|
97
|
-
if (!config) {
|
|
98
|
-
throw new Error("Cluster configuration is required");
|
|
99
|
-
}
|
|
100
|
-
if (typeof config.workers === "number" &&
|
|
101
|
-
(config.workers < 1 || config.workers > 64)) {
|
|
102
|
-
throw new Error("Worker count must be between 1 and 64");
|
|
103
|
-
}
|
|
104
|
-
if (config.resources?.maxMemoryPerWorker) {
|
|
105
|
-
const memoryLimit = this._parseMemoryString(config.resources.maxMemoryPerWorker);
|
|
106
|
-
if (memoryLimit < 64 * 1024 * 1024) {
|
|
107
|
-
throw new Error("Minimum memory limit is 64MB per worker");
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Generate a secure token for worker authentication
|
|
113
|
-
*/
|
|
114
|
-
_generateSecureToken() {
|
|
115
|
-
return randomBytes(32).toString("hex");
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Create a worker-specific security token
|
|
119
|
-
*/
|
|
120
|
-
_createWorkerToken(workerId) {
|
|
121
|
-
return createHash("sha256")
|
|
122
|
-
.update(this.masterToken)
|
|
123
|
-
.update(workerId)
|
|
124
|
-
.update(Date.now().toString())
|
|
125
|
-
.digest("hex");
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Allocate a safe port for a worker
|
|
129
|
-
*/
|
|
130
|
-
_allocatePort() {
|
|
131
|
-
let attempts = 0;
|
|
132
|
-
const maxAttempts = 100;
|
|
133
|
-
while (attempts < maxAttempts) {
|
|
134
|
-
const port = this.basePort + Math.floor(Math.random() * 1000) + 1;
|
|
135
|
-
if (!this.workerPorts.has(port) && port > 1024 && port < 65535) {
|
|
136
|
-
this.workerPorts.add(port);
|
|
137
|
-
return port;
|
|
138
|
-
}
|
|
139
|
-
attempts++;
|
|
140
|
-
}
|
|
141
|
-
throw new Error("Unable to allocate safe port for worker");
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Release a port back to the pool
|
|
145
|
-
*/
|
|
146
|
-
_releasePort(port) {
|
|
147
|
-
this.workerPorts.delete(port);
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Setup enhanced memory management event handlers
|
|
151
|
-
*/
|
|
152
|
-
_setupMemoryManagement() {
|
|
153
|
-
if (!this.config.resources?.memoryManagement?.enabled) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
this.memoryManager.on("memory_alert", (alert) => {
|
|
157
|
-
logger.warn("cluster", `Memory Alert: ${alert.message}`);
|
|
158
|
-
this._handleMemoryAlert(alert);
|
|
159
|
-
});
|
|
160
|
-
this.memoryManager.on("low_memory_mode_enabled", () => {
|
|
161
|
-
logger.info("cluster", "Cluster entering low memory mode");
|
|
162
|
-
this.emit("low_memory_mode", {
|
|
163
|
-
enabled: true,
|
|
164
|
-
timestamp: Date.now(),
|
|
165
|
-
});
|
|
166
|
-
this._enableEmergencyMode();
|
|
167
|
-
});
|
|
168
|
-
this.memoryManager.on("low_memory_mode_disabled", () => {
|
|
169
|
-
logger.info("cluster", "Cluster exiting low memory mode");
|
|
170
|
-
this.emit("low_memory_mode", {
|
|
171
|
-
enabled: false,
|
|
172
|
-
timestamp: Date.now(),
|
|
173
|
-
});
|
|
174
|
-
this._disableEmergencyMode();
|
|
175
|
-
});
|
|
176
|
-
this.memoryManager.on("error", (error) => {
|
|
177
|
-
logger.error("cluster", "Memory manager error:", error);
|
|
178
|
-
this.emit("error", { type: "memory_manager", error });
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Handle memory alerts with appropriate actions
|
|
183
|
-
*/
|
|
184
|
-
async _handleMemoryAlert(alert) {
|
|
185
|
-
try {
|
|
186
|
-
switch (alert.action) {
|
|
187
|
-
case "scale_down":
|
|
188
|
-
await this._handleMemoryScaleDown(alert);
|
|
189
|
-
break;
|
|
190
|
-
case "restart_worker":
|
|
191
|
-
if (alert.workerId) {
|
|
192
|
-
await this._handleWorkerMemoryIssue(alert.workerId, alert);
|
|
193
|
-
}
|
|
194
|
-
break;
|
|
195
|
-
case "throttle":
|
|
196
|
-
this._handleMemoryThrottling(alert);
|
|
197
|
-
break;
|
|
198
|
-
default:
|
|
199
|
-
logger.warn("cluster", `Unknown memory alert action: ${alert.action}`);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
catch (error) {
|
|
203
|
-
logger.error("cluster", "Error handling memory alert:", error);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Setup graceful shutdown handlers
|
|
208
|
-
*/
|
|
209
|
-
_setupGracefulShutdown() {
|
|
210
|
-
const shutdownHandler = async (signal) => {
|
|
211
|
-
logger.info("cluster", `Received ${signal}, initiating graceful shutdown...`);
|
|
212
|
-
if (!this.shutdownPromise) {
|
|
213
|
-
this.shutdownPromise = this.stop(true);
|
|
214
|
-
}
|
|
215
|
-
await this.shutdownPromise;
|
|
216
|
-
process.exit(0);
|
|
217
|
-
};
|
|
218
|
-
process.on("SIGTERM", () => shutdownHandler("SIGTERM"));
|
|
219
|
-
process.on("SIGINT", () => shutdownHandler("SIGINT"));
|
|
220
|
-
// Handle uncaught exceptions
|
|
221
|
-
process.on("uncaughtException", (error) => {
|
|
222
|
-
logger.error("cluster", "Uncaught exception in cluster manager:", error);
|
|
223
|
-
this.stop(false).then(() => process.exit(1));
|
|
224
|
-
});
|
|
225
|
-
process.on("unhandledRejection", (reason, promise) => {
|
|
226
|
-
logger.error("cluster", "Unhandled rejection in cluster manager:", reason);
|
|
227
|
-
this.emit("error", {
|
|
228
|
-
type: "unhandled_rejection",
|
|
229
|
-
reason,
|
|
230
|
-
promise,
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Start the Bun cluster with comprehensive error handling
|
|
236
|
-
*/
|
|
237
|
-
async start() {
|
|
238
|
-
if (this.isRunning) {
|
|
239
|
-
logger.warn("cluster", "Bun cluster is already running");
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
try {
|
|
243
|
-
logger.info("cluster", "Starting Bun cluster manager...");
|
|
244
|
-
this.startTime = performance.now();
|
|
245
|
-
this.isRunning = true;
|
|
246
|
-
const workerCount = this._getOptimalWorkerCount();
|
|
247
|
-
logger.info("cluster", `Spawning ${workerCount} Bun workers`);
|
|
248
|
-
// Validate system resources before starting
|
|
249
|
-
await this._validateSystemResources(workerCount);
|
|
250
|
-
// Spawn workers with staggered startup
|
|
251
|
-
const spawnPromises = Array.from({ length: workerCount }, (_, i) => this._spawnWorkerWithRetry(i));
|
|
252
|
-
const workers = await Promise.allSettled(spawnPromises);
|
|
253
|
-
const successfulWorkers = workers.filter((result) => result.status === "fulfilled").length;
|
|
254
|
-
if (successfulWorkers === 0) {
|
|
255
|
-
throw new Error("Failed to start any workers");
|
|
256
|
-
}
|
|
257
|
-
if (successfulWorkers < workerCount) {
|
|
258
|
-
logger.warn("cluster", `Started ${successfulWorkers}/${workerCount} workers`);
|
|
259
|
-
}
|
|
260
|
-
// Start monitoring services
|
|
261
|
-
this._startHealthMonitoring();
|
|
262
|
-
this._startMetricsCollection();
|
|
263
|
-
this._startPerformanceMonitoring();
|
|
264
|
-
// Start memory monitoring if enabled
|
|
265
|
-
if (this.config.resources?.memoryManagement?.enabled !== false) {
|
|
266
|
-
this.memoryManager.startMonitoring();
|
|
267
|
-
}
|
|
268
|
-
// Start CPU monitoring
|
|
269
|
-
this.cpuMonitor.startMonitoring();
|
|
270
|
-
logger.info("cluster", `Bun cluster started with ${successfulWorkers} workers`);
|
|
271
|
-
this.emit("cluster:started", {
|
|
272
|
-
workerCount: successfulWorkers,
|
|
273
|
-
requestedCount: workerCount,
|
|
274
|
-
timestamp: Date.now(),
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
catch (error) {
|
|
278
|
-
this.isRunning = false;
|
|
279
|
-
logger.error("cluster", "Failed to start cluster:", error);
|
|
280
|
-
await this._cleanupPartialStart();
|
|
281
|
-
throw error;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Validate system resources before starting workers
|
|
286
|
-
*/
|
|
287
|
-
async _validateSystemResources(workerCount) {
|
|
288
|
-
try {
|
|
289
|
-
// Get actual system memory information
|
|
290
|
-
const systemMemory = await this.memoryManager.getSystemMemoryStats();
|
|
291
|
-
const availableMemory = systemMemory.freeMemory;
|
|
292
|
-
const requiredMemory = workerCount * this.securityConfig.maxMemoryPerWorker;
|
|
293
|
-
// Check if we have enough memory (leave 20% buffer)
|
|
294
|
-
const memoryWithBuffer = availableMemory * 0.8;
|
|
295
|
-
if (requiredMemory > memoryWithBuffer) {
|
|
296
|
-
// Check if we can reduce to a single worker with minimal memory
|
|
297
|
-
const minMemoryPerWorker = 128 * 1024 * 1024; // 128MB minimum
|
|
298
|
-
if (workerCount === 1 &&
|
|
299
|
-
minMemoryPerWorker <= memoryWithBuffer) {
|
|
300
|
-
logger.warn("cluster", `Reducing memory limit to ${Math.round(minMemoryPerWorker / 1024 / 1024)}MB per worker due to low system memory`);
|
|
301
|
-
this.securityConfig.maxMemoryPerWorker = minMemoryPerWorker;
|
|
302
|
-
return; // Allow startup with reduced memory
|
|
303
|
-
}
|
|
304
|
-
throw new Error(`Insufficient memory for ${workerCount} workers. Required: ${Math.round(requiredMemory / 1024 / 1024)}MB, Available: ${Math.round(memoryWithBuffer / 1024 / 1024)}MB (${Math.round(availableMemory / 1024 / 1024)}MB total free). Consider disabling clustering or increasing system memory.`);
|
|
305
|
-
}
|
|
306
|
-
logger.debug("cluster", `Memory validation passed: Required ${Math.round(requiredMemory / 1024 / 1024)}MB, Available ${Math.round(memoryWithBuffer / 1024 / 1024)}MB`);
|
|
307
|
-
}
|
|
308
|
-
catch (error) {
|
|
309
|
-
if (error instanceof Error &&
|
|
310
|
-
error.message.includes("Insufficient memory")) {
|
|
311
|
-
throw error;
|
|
312
|
-
}
|
|
313
|
-
// If memory manager fails, fall back to basic validation
|
|
314
|
-
logger.warn("cluster", "Failed to get system memory stats, using fallback validation:", error);
|
|
315
|
-
const os = await import('os');
|
|
316
|
-
const freeMemory = os.freemem();
|
|
317
|
-
const requiredMemory = workerCount * this.securityConfig.maxMemoryPerWorker;
|
|
318
|
-
const availableMemoryFallback = freeMemory * 0.8;
|
|
319
|
-
if (requiredMemory > availableMemoryFallback) {
|
|
320
|
-
// Try with minimal memory for single worker
|
|
321
|
-
const minMemoryPerWorker = 128 * 1024 * 1024; // 128MB minimum
|
|
322
|
-
if (workerCount === 1 &&
|
|
323
|
-
minMemoryPerWorker <= availableMemoryFallback) {
|
|
324
|
-
logger.warn("cluster", `Fallback: Reducing memory limit to ${Math.round(minMemoryPerWorker / 1024 / 1024)}MB per worker`);
|
|
325
|
-
this.securityConfig.maxMemoryPerWorker = minMemoryPerWorker;
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
throw new Error(`Insufficient memory for ${workerCount} workers. Required: ${Math.round(requiredMemory / 1024 / 1024)}MB, Available: ${Math.round(availableMemoryFallback / 1024 / 1024)}MB (fallback). Consider disabling clustering or increasing system memory.`);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
// Validate port availability
|
|
332
|
-
if (this.basePort < 1024 || this.basePort > 65000) {
|
|
333
|
-
throw new Error(`Invalid base port: ${this.basePort}. Must be between 1024 and 65000`);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Cleanup after partial startup failure
|
|
338
|
-
*/
|
|
339
|
-
async _cleanupPartialStart() {
|
|
340
|
-
try {
|
|
341
|
-
const stopPromises = Array.from(this.workers.values()).map((worker) => this._stopWorker(worker.id, false));
|
|
342
|
-
await Promise.allSettled(stopPromises);
|
|
343
|
-
this.workers.clear();
|
|
344
|
-
this.workerPorts.clear();
|
|
345
|
-
}
|
|
346
|
-
catch (error) {
|
|
347
|
-
logger.error("cluster", "Error during cleanup:", error);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Stop the Bun cluster with timeout protection
|
|
352
|
-
*/
|
|
353
|
-
async stop(graceful = true) {
|
|
354
|
-
if (!this.isRunning) {
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
logger.info("cluster", `Stopping Bun cluster (graceful: ${graceful})...`);
|
|
358
|
-
this.isRunning = false;
|
|
359
|
-
// Create shutdown timeout
|
|
360
|
-
const shutdownTimeout = new Promise((_, reject) => {
|
|
361
|
-
setTimeout(() => reject(new Error("Shutdown timeout exceeded")), this.maxShutdownTime);
|
|
362
|
-
});
|
|
363
|
-
try {
|
|
364
|
-
// Stop monitoring first
|
|
365
|
-
this._stopMonitoring();
|
|
366
|
-
// Stop memory manager
|
|
367
|
-
if (this.memoryManager) {
|
|
368
|
-
this.memoryManager.stopMonitoring?.();
|
|
369
|
-
}
|
|
370
|
-
// Stop CPU monitoring
|
|
371
|
-
this.cpuMonitor.stopMonitoring();
|
|
372
|
-
// Stop all workers
|
|
373
|
-
const stopPromises = Array.from(this.workers.values()).map((worker) => this._stopWorker(worker.id, graceful));
|
|
374
|
-
await Promise.race([Promise.all(stopPromises), shutdownTimeout]);
|
|
375
|
-
this.workers.clear();
|
|
376
|
-
this.workerPorts.clear();
|
|
377
|
-
logger.info("cluster", "Bun cluster stopped successfully");
|
|
378
|
-
this.emit("cluster:stopped", { timestamp: Date.now() });
|
|
379
|
-
}
|
|
380
|
-
catch (error) {
|
|
381
|
-
logger.error("cluster", "Error during cluster shutdown:", error);
|
|
382
|
-
// Force kill remaining workers
|
|
383
|
-
await this._forceKillAllWorkers();
|
|
384
|
-
throw error;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Force kill all workers in emergency situations
|
|
389
|
-
*/
|
|
390
|
-
async _forceKillAllWorkers() {
|
|
391
|
-
const forceKillPromises = Array.from(this.workers.values()).map(async (worker) => {
|
|
392
|
-
try {
|
|
393
|
-
worker.subprocess.kill("SIGKILL");
|
|
394
|
-
await worker.subprocess.exited;
|
|
395
|
-
this._releasePort(worker.port);
|
|
396
|
-
}
|
|
397
|
-
catch (error) {
|
|
398
|
-
logger.error("cluster", `Error force killing worker ${worker.id}:`, error);
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
await Promise.allSettled(forceKillPromises);
|
|
402
|
-
this.workers.clear();
|
|
403
|
-
this.workerPorts.clear();
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Stop all monitoring services
|
|
407
|
-
*/
|
|
408
|
-
_stopMonitoring() {
|
|
409
|
-
if (this.healthCheckInterval) {
|
|
410
|
-
clearInterval(this.healthCheckInterval);
|
|
411
|
-
this.healthCheckInterval = undefined;
|
|
412
|
-
}
|
|
413
|
-
if (this.metricsInterval) {
|
|
414
|
-
clearInterval(this.metricsInterval);
|
|
415
|
-
this.metricsInterval = undefined;
|
|
416
|
-
}
|
|
417
|
-
if (this.performanceInterval) {
|
|
418
|
-
clearInterval(this.performanceInterval);
|
|
419
|
-
this.performanceInterval = undefined;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* Spawn a worker with retry logic
|
|
424
|
-
*/
|
|
425
|
-
async _spawnWorkerWithRetry(index, retries = 3) {
|
|
426
|
-
let lastError = null;
|
|
427
|
-
for (let attempt = 0; attempt < retries; attempt++) {
|
|
428
|
-
try {
|
|
429
|
-
// Add delay between retry attempts
|
|
430
|
-
if (attempt > 0) {
|
|
431
|
-
await new Promise((resolve) => setTimeout(resolve, 1000 * attempt));
|
|
432
|
-
}
|
|
433
|
-
return await this._spawnWorker(index);
|
|
434
|
-
}
|
|
435
|
-
catch (error) {
|
|
436
|
-
lastError = error;
|
|
437
|
-
logger.warn("cluster", `Worker spawn attempt ${attempt + 1} failed:`, error);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
throw lastError || new Error("Failed to spawn worker after retries");
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Spawn a new Bun worker process with enhanced security
|
|
444
|
-
*/
|
|
445
|
-
async _spawnWorker(index) {
|
|
446
|
-
const workerId = `worker-${index}-${Date.now()}`;
|
|
447
|
-
const port = this._allocatePort();
|
|
448
|
-
const securityToken = this._createWorkerToken(workerId);
|
|
449
|
-
logger.debug("cluster", `Spawning Bun worker ${workerId} on port ${port}`);
|
|
450
|
-
try {
|
|
451
|
-
// Validate script path exists and is accessible
|
|
452
|
-
if (!process.argv[1]) {
|
|
453
|
-
throw new Error("Unable to determine script path for worker");
|
|
454
|
-
}
|
|
455
|
-
// Enhanced environment with security measures
|
|
456
|
-
const workerEnv = {
|
|
457
|
-
...this._getSecureEnvironment(),
|
|
458
|
-
WORKER_ID: workerId,
|
|
459
|
-
WORKER_PORT: port.toString(),
|
|
460
|
-
WORKER_SECURITY_TOKEN: securityToken,
|
|
461
|
-
MASTER_TOKEN: this.masterToken,
|
|
462
|
-
NODE_ENV: "worker",
|
|
463
|
-
CLUSTER_MODE: "true",
|
|
464
|
-
WORKER_MEMORY_LIMIT: this.securityConfig.maxMemoryPerWorker.toString(),
|
|
465
|
-
WORKER_MAX_REQUESTS: "10000", // Prevent memory leaks
|
|
466
|
-
// Pass server configuration to worker
|
|
467
|
-
XYPRISS_SERVER_CONFIG: JSON.stringify(this.serverOptions),
|
|
468
|
-
};
|
|
469
|
-
const subprocess = Bun.spawn({
|
|
470
|
-
cmd: ["bun", "run", process.argv[1]],
|
|
471
|
-
env: workerEnv,
|
|
472
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
473
|
-
});
|
|
474
|
-
const worker = {
|
|
475
|
-
id: workerId,
|
|
476
|
-
subprocess,
|
|
477
|
-
port,
|
|
478
|
-
status: "starting",
|
|
479
|
-
startTime: Date.now(),
|
|
480
|
-
restarts: 0,
|
|
481
|
-
lastPing: Date.now(),
|
|
482
|
-
health: {
|
|
483
|
-
status: "unknown",
|
|
484
|
-
consecutiveFailures: 0,
|
|
485
|
-
},
|
|
486
|
-
securityToken,
|
|
487
|
-
performance: {
|
|
488
|
-
requestCount: 0,
|
|
489
|
-
errorCount: 0,
|
|
490
|
-
averageResponseTime: 0,
|
|
491
|
-
lastRequestTime: 0,
|
|
492
|
-
cpuUsage: 0,
|
|
493
|
-
memoryUsage: 0,
|
|
494
|
-
},
|
|
495
|
-
resourceLimits: {
|
|
496
|
-
maxMemory: this.securityConfig.maxMemoryPerWorker,
|
|
497
|
-
maxCpu: 80, // 80% CPU usage limit
|
|
498
|
-
},
|
|
499
|
-
restartHistory: [],
|
|
500
|
-
};
|
|
501
|
-
this.workers.set(workerId, worker);
|
|
502
|
-
// Setup process event handlers
|
|
503
|
-
subprocess.exited
|
|
504
|
-
.then((exitCode) => {
|
|
505
|
-
this._handleWorkerExit(workerId, exitCode);
|
|
506
|
-
})
|
|
507
|
-
.catch((error) => {
|
|
508
|
-
logger.error("cluster", `Worker ${workerId} exit handler error:`, error);
|
|
509
|
-
this._handleWorkerExit(workerId, -1);
|
|
510
|
-
});
|
|
511
|
-
// Setup stdout/stderr handling for better debugging
|
|
512
|
-
this._setupWorkerLogging(worker);
|
|
513
|
-
// Wait for worker to be ready with timeout
|
|
514
|
-
await this._waitForWorkerReady(worker);
|
|
515
|
-
worker.status = "running";
|
|
516
|
-
worker.health.status = "healthy";
|
|
517
|
-
// Register worker with IPC manager if available
|
|
518
|
-
if (this.ipcManager) {
|
|
519
|
-
this.ipcManager.registerWorker(workerId, worker.subprocess);
|
|
520
|
-
logger.debug("cluster", `Worker ${workerId} registered with IPC manager`);
|
|
521
|
-
}
|
|
522
|
-
logger.info("cluster", `Bun worker ${workerId} started on port ${port}`);
|
|
523
|
-
// Start monitoring for this worker
|
|
524
|
-
this.eventLoopMonitor.startMonitoring(workerId);
|
|
525
|
-
this.emit("worker:started", {
|
|
526
|
-
workerId,
|
|
527
|
-
port,
|
|
528
|
-
timestamp: Date.now(),
|
|
529
|
-
});
|
|
530
|
-
return worker;
|
|
531
|
-
}
|
|
532
|
-
catch (error) {
|
|
533
|
-
this._releasePort(port);
|
|
534
|
-
logger.error("cluster", `Failed to spawn Bun worker ${workerId}:`, error);
|
|
535
|
-
throw error;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Get secure environment variables for workers
|
|
540
|
-
*/
|
|
541
|
-
_getSecureEnvironment() {
|
|
542
|
-
// Only pass safe environment variables to workers
|
|
543
|
-
const safeEnvVars = [
|
|
544
|
-
"NODE_ENV",
|
|
545
|
-
"PATH",
|
|
546
|
-
"HOME",
|
|
547
|
-
"USER",
|
|
548
|
-
"PWD",
|
|
549
|
-
"LOG_LEVEL",
|
|
550
|
-
"DEBUG",
|
|
551
|
-
"TZ",
|
|
552
|
-
];
|
|
553
|
-
const secureEnv = {};
|
|
554
|
-
for (const key of safeEnvVars) {
|
|
555
|
-
if (process.env[key]) {
|
|
556
|
-
secureEnv[key] = process.env[key];
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
return secureEnv;
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* Setup logging for worker process
|
|
563
|
-
*/
|
|
564
|
-
_setupWorkerLogging(worker) {
|
|
565
|
-
if (worker.subprocess.stdout) {
|
|
566
|
-
worker.subprocess.stdout.pipeTo(new WritableStream({
|
|
567
|
-
write(chunk) {
|
|
568
|
-
const data = new TextDecoder().decode(chunk);
|
|
569
|
-
logger.debug("cluster", `[${worker.id}] stdout: ${data.trim()}`);
|
|
570
|
-
},
|
|
571
|
-
}));
|
|
572
|
-
}
|
|
573
|
-
if (worker.subprocess.stderr) {
|
|
574
|
-
worker.subprocess.stderr.pipeTo(new WritableStream({
|
|
575
|
-
write(chunk) {
|
|
576
|
-
const data = new TextDecoder().decode(chunk);
|
|
577
|
-
logger.warn("cluster", `[${worker.id}] stderr: ${data.trim()}`);
|
|
578
|
-
},
|
|
579
|
-
}));
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* Check if worker is ready and responding with multiple strategies
|
|
584
|
-
*/
|
|
585
|
-
async _checkWorkerReadiness(worker) {
|
|
586
|
-
try {
|
|
587
|
-
// Check if process is still running
|
|
588
|
-
if (worker.subprocess.killed) {
|
|
589
|
-
logger.debug("cluster", `Worker ${worker.id} process is killed`);
|
|
590
|
-
return false;
|
|
591
|
-
}
|
|
592
|
-
// Strategy 1: Check if process is responsive (basic check)
|
|
593
|
-
if (!worker.subprocess.pid) {
|
|
594
|
-
logger.debug("cluster", `Worker ${worker.id} has no PID`);
|
|
595
|
-
return false;
|
|
596
|
-
}
|
|
597
|
-
// Strategy 2: Try IPC communication first (faster than port check)
|
|
598
|
-
if (this.ipcManager) {
|
|
599
|
-
try {
|
|
600
|
-
// Try to send a ping via IPC
|
|
601
|
-
const ipcReady = await this._checkWorkerIPCReadiness(worker);
|
|
602
|
-
if (ipcReady) {
|
|
603
|
-
logger.debug("cluster", `Worker ${worker.id} ready via IPC`);
|
|
604
|
-
return true;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
catch (error) {
|
|
608
|
-
logger.debug("cluster", `Worker ${worker.id} IPC check failed:`, error);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
// Strategy 3: Check port listening (fallback)
|
|
612
|
-
const isListening = await this._checkPortListening(worker.port);
|
|
613
|
-
if (isListening) {
|
|
614
|
-
logger.debug("cluster", `Worker ${worker.id} ready via port check`);
|
|
615
|
-
return true;
|
|
616
|
-
}
|
|
617
|
-
// Strategy 4: Check if worker has been running for a minimum time (more lenient)
|
|
618
|
-
const runningTime = Date.now() - worker.startTime;
|
|
619
|
-
if (runningTime > 3000) {
|
|
620
|
-
// 3 seconds minimum (reduced from 5)
|
|
621
|
-
logger.debug("cluster", `Worker ${worker.id} assumed ready after ${runningTime}ms (time-based)`);
|
|
622
|
-
return true;
|
|
623
|
-
}
|
|
624
|
-
// Strategy 5: If worker process is stable and not killed, assume it's working
|
|
625
|
-
if (runningTime > 1000 &&
|
|
626
|
-
!worker.subprocess.killed &&
|
|
627
|
-
worker.subprocess.pid) {
|
|
628
|
-
logger.debug("cluster", `Worker ${worker.id} process stable after ${runningTime}ms (process-based)`);
|
|
629
|
-
return true;
|
|
630
|
-
}
|
|
631
|
-
logger.debug("cluster", `Worker ${worker.id} not ready yet (running for ${runningTime}ms)`);
|
|
632
|
-
return false;
|
|
633
|
-
}
|
|
634
|
-
catch (error) {
|
|
635
|
-
logger.debug("cluster", `Worker ${worker.id} readiness check failed:`, error);
|
|
636
|
-
return false;
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Check worker readiness via IPC
|
|
641
|
-
*/
|
|
642
|
-
async _checkWorkerIPCReadiness(worker) {
|
|
643
|
-
try {
|
|
644
|
-
// Register worker with IPC manager temporarily for ping
|
|
645
|
-
if (!this.ipcManager)
|
|
646
|
-
return false;
|
|
647
|
-
this.ipcManager.registerWorker(worker.id, worker.subprocess);
|
|
648
|
-
// Try to ping the worker
|
|
649
|
-
const response = await Promise.race([
|
|
650
|
-
this.ipcManager.sendToWorker(worker.id, "ping", {}),
|
|
651
|
-
new Promise((_, reject) => setTimeout(() => reject(new Error("IPC timeout")), 2000)),
|
|
652
|
-
]);
|
|
653
|
-
// Check if we got a real response or a mock response
|
|
654
|
-
if (response && typeof response === "object") {
|
|
655
|
-
if (response.status === "ok" &&
|
|
656
|
-
response.message === "IPC not fully supported in Bun mode") {
|
|
657
|
-
logger.debug("cluster", `Worker ${worker.id} IPC not fully supported, but worker is registered`);
|
|
658
|
-
return true; // Worker is registered, even if IPC isn't fully functional
|
|
659
|
-
}
|
|
660
|
-
if (response.status === "fallback") {
|
|
661
|
-
logger.debug("cluster", `Worker ${worker.id} IPC communication failed, but worker exists`);
|
|
662
|
-
return true; // Worker exists, even if IPC failed
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
return response !== undefined;
|
|
666
|
-
}
|
|
667
|
-
catch (error) {
|
|
668
|
-
return false;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* Check if a port is listening
|
|
673
|
-
*/
|
|
674
|
-
async _checkPortListening(port) {
|
|
675
|
-
return new Promise((resolve) => {
|
|
676
|
-
const socket = new net.Socket();
|
|
677
|
-
const timeout = setTimeout(() => {
|
|
678
|
-
socket.destroy();
|
|
679
|
-
resolve(false);
|
|
680
|
-
}, 2000); // Increased timeout to 2 seconds
|
|
681
|
-
socket.on("connect", () => {
|
|
682
|
-
clearTimeout(timeout);
|
|
683
|
-
socket.destroy();
|
|
684
|
-
resolve(true);
|
|
685
|
-
});
|
|
686
|
-
socket.on("error", (error) => {
|
|
687
|
-
clearTimeout(timeout);
|
|
688
|
-
// Log the specific error for debugging
|
|
689
|
-
logger.debug("cluster", `Port ${port} connection error:`, error.code);
|
|
690
|
-
resolve(false);
|
|
691
|
-
});
|
|
692
|
-
try {
|
|
693
|
-
socket.connect(port, "localhost");
|
|
694
|
-
}
|
|
695
|
-
catch (error) {
|
|
696
|
-
clearTimeout(timeout);
|
|
697
|
-
logger.debug("cluster", `Port ${port} connect attempt failed:`, error);
|
|
698
|
-
resolve(false);
|
|
699
|
-
}
|
|
700
|
-
});
|
|
701
|
-
}
|
|
702
|
-
/**
|
|
703
|
-
* Wait for worker to be ready with progressive timeout and better diagnostics
|
|
704
|
-
*/
|
|
705
|
-
async _waitForWorkerReady(worker, timeout = 15000 // Further reduced to 15 seconds
|
|
706
|
-
) {
|
|
707
|
-
return new Promise((resolve, reject) => {
|
|
708
|
-
const checkInterval = 500; // Increased interval to reduce CPU usage
|
|
709
|
-
let attempts = 0;
|
|
710
|
-
const maxAttempts = Math.floor(timeout / checkInterval);
|
|
711
|
-
logger.debug("cluster", `Waiting for worker ${worker.id} to be ready (timeout: ${timeout}ms)`);
|
|
712
|
-
const timeoutId = setTimeout(() => {
|
|
713
|
-
logger.error("cluster", `Worker ${worker.id} startup timeout after ${timeout}ms`);
|
|
714
|
-
logger.error("cluster", `Worker ${worker.id} diagnostics:`, {
|
|
715
|
-
pid: worker.subprocess.pid,
|
|
716
|
-
killed: worker.subprocess.killed,
|
|
717
|
-
port: worker.port,
|
|
718
|
-
startTime: worker.startTime,
|
|
719
|
-
runningTime: Date.now() - worker.startTime,
|
|
720
|
-
});
|
|
721
|
-
reject(new Error(`Worker ${worker.id} failed to start within ${timeout}ms`));
|
|
722
|
-
}, timeout);
|
|
723
|
-
const checkReady = async () => {
|
|
724
|
-
try {
|
|
725
|
-
attempts++;
|
|
726
|
-
// Check if process is still running
|
|
727
|
-
if (worker.subprocess.killed) {
|
|
728
|
-
clearTimeout(timeoutId);
|
|
729
|
-
logger.error("cluster", `Worker ${worker.id} process died during startup`);
|
|
730
|
-
reject(new Error(`Worker ${worker.id} process died during startup`));
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
// Log progress every 10 attempts (5 seconds)
|
|
734
|
-
if (attempts % 10 === 0) {
|
|
735
|
-
const runningTime = Date.now() - worker.startTime;
|
|
736
|
-
logger.debug("cluster", `Worker ${worker.id} still starting... (${runningTime}ms, attempt ${attempts}/${maxAttempts})`);
|
|
737
|
-
}
|
|
738
|
-
// Real readiness check - verify worker is actually responding
|
|
739
|
-
const isReady = await this._checkWorkerReadiness(worker);
|
|
740
|
-
if (isReady) {
|
|
741
|
-
clearTimeout(timeoutId);
|
|
742
|
-
const startupTime = Date.now() - worker.startTime;
|
|
743
|
-
logger.info("cluster", `Worker ${worker.id} ready after ${startupTime}ms`);
|
|
744
|
-
resolve();
|
|
745
|
-
return;
|
|
746
|
-
}
|
|
747
|
-
// Continue checking
|
|
748
|
-
setTimeout(checkReady, checkInterval);
|
|
749
|
-
}
|
|
750
|
-
catch (error) {
|
|
751
|
-
clearTimeout(timeoutId);
|
|
752
|
-
logger.error("cluster", `Worker ${worker.id} readiness check error:`, error);
|
|
753
|
-
reject(error);
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
// Start checking immediately
|
|
757
|
-
checkReady();
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* Stop a specific worker with enhanced safety measures
|
|
762
|
-
*/
|
|
763
|
-
async _stopWorker(workerId, graceful = true) {
|
|
764
|
-
const worker = this.workers.get(workerId);
|
|
765
|
-
if (!worker) {
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
logger.debug("cluster", `Stopping Bun worker ${workerId} (graceful: ${graceful})`);
|
|
769
|
-
worker.status = "stopping";
|
|
770
|
-
try {
|
|
771
|
-
const stopPromise = this._executeWorkerStop(worker, graceful);
|
|
772
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
773
|
-
setTimeout(() => reject(new Error("Worker stop timeout")), this.securityConfig.processTimeout);
|
|
774
|
-
});
|
|
775
|
-
await Promise.race([stopPromise, timeoutPromise]);
|
|
776
|
-
worker.status = "stopped";
|
|
777
|
-
this._releasePort(worker.port);
|
|
778
|
-
// Unregister worker from IPC manager if available
|
|
779
|
-
if (this.ipcManager) {
|
|
780
|
-
this.ipcManager.unregisterWorker(workerId);
|
|
781
|
-
logger.debug("cluster", `Worker ${workerId} unregistered from IPC manager`);
|
|
782
|
-
}
|
|
783
|
-
// Clean up monitoring for this worker
|
|
784
|
-
this.eventLoopMonitor.clearWorkerStats(workerId);
|
|
785
|
-
this.heapStatsCollector.clearWorkerStats(workerId);
|
|
786
|
-
this.networkTracker.clearWorkerStats(workerId);
|
|
787
|
-
this.throughputCalculator.clearWorkerStats(workerId);
|
|
788
|
-
this.gcStatsTracker.clearWorkerStats(workerId);
|
|
789
|
-
logger.info("cluster", `Bun worker ${workerId} stopped`);
|
|
790
|
-
this.emit("worker:stopped", { workerId, timestamp: Date.now() });
|
|
791
|
-
}
|
|
792
|
-
catch (error) {
|
|
793
|
-
logger.error("cluster", `Error stopping Bun worker ${workerId}:`, error);
|
|
794
|
-
worker.status = "error";
|
|
795
|
-
// Force kill if graceful stop failed
|
|
796
|
-
try {
|
|
797
|
-
worker.subprocess.kill("SIGKILL");
|
|
798
|
-
await worker.subprocess.exited;
|
|
799
|
-
this._releasePort(worker.port);
|
|
800
|
-
}
|
|
801
|
-
catch (forceError) {
|
|
802
|
-
logger.error("cluster", `Error force killing worker ${workerId}:`, forceError);
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
/**
|
|
807
|
-
* Execute worker stop with proper signal handling
|
|
808
|
-
*/
|
|
809
|
-
async _executeWorkerStop(worker, graceful) {
|
|
810
|
-
if (graceful) {
|
|
811
|
-
// Send SIGTERM for graceful shutdown
|
|
812
|
-
worker.subprocess.kill("SIGTERM");
|
|
813
|
-
// Wait for graceful shutdown with timeout
|
|
814
|
-
const gracefulTimeout = setTimeout(() => {
|
|
815
|
-
logger.warn("cluster", `Worker ${worker.id} graceful shutdown timeout, force killing`);
|
|
816
|
-
worker.subprocess.kill("SIGKILL");
|
|
817
|
-
}, 5000);
|
|
818
|
-
await worker.subprocess.exited;
|
|
819
|
-
clearTimeout(gracefulTimeout);
|
|
820
|
-
}
|
|
821
|
-
else {
|
|
822
|
-
worker.subprocess.kill("SIGKILL");
|
|
823
|
-
await worker.subprocess.exited;
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Handle worker process exit with enhanced tracking
|
|
828
|
-
*/
|
|
829
|
-
async _handleWorkerExit(workerId, exitCode) {
|
|
830
|
-
const worker = this.workers.get(workerId);
|
|
831
|
-
if (!worker) {
|
|
832
|
-
return;
|
|
833
|
-
}
|
|
834
|
-
const exitReason = this._determineExitReason(exitCode);
|
|
835
|
-
logger.warn("cluster", `Bun worker ${workerId} exited: ${exitReason}`);
|
|
836
|
-
// Update worker state
|
|
837
|
-
worker.status = "stopped";
|
|
838
|
-
worker.health.status = "unhealthy";
|
|
839
|
-
worker.health.consecutiveFailures++;
|
|
840
|
-
// Unregister worker from IPC manager if available
|
|
841
|
-
if (this.ipcManager) {
|
|
842
|
-
this.ipcManager.unregisterWorker(workerId);
|
|
843
|
-
logger.debug("cluster", `Worker ${workerId} unregistered from IPC manager`);
|
|
844
|
-
}
|
|
845
|
-
// Add to restart history
|
|
846
|
-
worker.restartHistory.push({
|
|
847
|
-
timestamp: Date.now(),
|
|
848
|
-
reason: exitReason,
|
|
849
|
-
exitCode: exitCode || undefined,
|
|
850
|
-
});
|
|
851
|
-
this.emit("worker:exit", {
|
|
852
|
-
workerId,
|
|
853
|
-
exitCode,
|
|
854
|
-
reason: exitReason,
|
|
855
|
-
timestamp: Date.now(),
|
|
856
|
-
});
|
|
857
|
-
// Check if restart is needed and allowed
|
|
858
|
-
if (this._shouldRestartWorker(worker)) {
|
|
859
|
-
await this._attemptWorkerRestart(worker);
|
|
860
|
-
}
|
|
861
|
-
else {
|
|
862
|
-
logger.warn("cluster", `Worker ${workerId} will not be restarted: ${this._getRestartBlockReason(worker)}`);
|
|
863
|
-
this.workers.delete(workerId);
|
|
864
|
-
this._releasePort(worker.port);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
/**
|
|
868
|
-
* Determine the reason for worker exit
|
|
869
|
-
*/
|
|
870
|
-
_determineExitReason(exitCode) {
|
|
871
|
-
if (exitCode === null)
|
|
872
|
-
return "killed";
|
|
873
|
-
if (exitCode === 0)
|
|
874
|
-
return "normal_exit";
|
|
875
|
-
if (exitCode === 1)
|
|
876
|
-
return "error_exit";
|
|
877
|
-
if (exitCode === 130)
|
|
878
|
-
return "sigint";
|
|
879
|
-
if (exitCode === 143)
|
|
880
|
-
return "sigterm";
|
|
881
|
-
if (exitCode === 137)
|
|
882
|
-
return "sigkill";
|
|
883
|
-
return `exit_code_${exitCode}`;
|
|
884
|
-
}
|
|
885
|
-
/**
|
|
886
|
-
* Check if worker should be restarted
|
|
887
|
-
*/
|
|
888
|
-
_shouldRestartWorker(worker) {
|
|
889
|
-
if (!this.isRunning)
|
|
890
|
-
return false;
|
|
891
|
-
const autoRestart = this.config.processManagement?.respawn !== false;
|
|
892
|
-
if (!autoRestart)
|
|
893
|
-
return false;
|
|
894
|
-
// Check restart count limits
|
|
895
|
-
if (worker.restarts >= this.securityConfig.maxRestartAttempts)
|
|
896
|
-
return false;
|
|
897
|
-
// Check restart frequency (prevent restart loops)
|
|
898
|
-
const recentRestarts = worker.restartHistory.filter((r) => Date.now() - r.timestamp < this.securityConfig.restartWindow).length;
|
|
899
|
-
return recentRestarts < this.securityConfig.maxRestartAttempts;
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
* Get reason why restart is blocked
|
|
903
|
-
*/
|
|
904
|
-
_getRestartBlockReason(worker) {
|
|
905
|
-
if (!this.isRunning)
|
|
906
|
-
return "cluster_shutting_down";
|
|
907
|
-
if (!this.config.processManagement?.respawn)
|
|
908
|
-
return "auto_restart_disabled";
|
|
909
|
-
if (worker.restarts >= this.securityConfig.maxRestartAttempts)
|
|
910
|
-
return "max_restarts_exceeded";
|
|
911
|
-
const recentRestarts = worker.restartHistory.filter((r) => Date.now() - r.timestamp < this.securityConfig.restartWindow).length;
|
|
912
|
-
if (recentRestarts >= this.securityConfig.maxRestartAttempts)
|
|
913
|
-
return "restart_frequency_limit";
|
|
914
|
-
return "unknown";
|
|
915
|
-
}
|
|
916
|
-
/**
|
|
917
|
-
* Attempt to restart a worker with backoff
|
|
918
|
-
*/
|
|
919
|
-
async _attemptWorkerRestart(worker) {
|
|
920
|
-
logger.info("cluster", `Restarting Bun worker ${worker.id}...`);
|
|
921
|
-
worker.restarts++;
|
|
922
|
-
// Calculate backoff delay
|
|
923
|
-
const backoffDelay = Math.min(1000 * Math.pow(2, worker.restarts - 1), 30000);
|
|
924
|
-
await new Promise((resolve) => setTimeout(resolve, backoffDelay));
|
|
925
|
-
try {
|
|
926
|
-
const index = parseInt(worker.id.split("-")[1]) || 0;
|
|
927
|
-
this.workers.delete(worker.id);
|
|
928
|
-
this._releasePort(worker.port);
|
|
929
|
-
await this._spawnWorkerWithRetry(index, 2);
|
|
930
|
-
logger.info("cluster", `Successfully restarted worker (was ${worker.id})`);
|
|
931
|
-
this.emit("worker:restarted", {
|
|
932
|
-
oldWorkerId: worker.id,
|
|
933
|
-
restartCount: worker.restarts,
|
|
934
|
-
timestamp: Date.now(),
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
catch (error) {
|
|
938
|
-
logger.error("cluster", `Failed to restart worker ${worker.id}:`, error);
|
|
939
|
-
this.workers.delete(worker.id);
|
|
940
|
-
this._releasePort(worker.port);
|
|
941
|
-
this.emit("worker:restart_failed", {
|
|
942
|
-
workerId: worker.id,
|
|
943
|
-
error: error instanceof Error ? error.message : String(error),
|
|
944
|
-
timestamp: Date.now(),
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
/**
|
|
949
|
-
* Get optimal worker count with system constraints
|
|
950
|
-
*/
|
|
951
|
-
_getOptimalWorkerCount() {
|
|
952
|
-
if (typeof this.config.workers === "number") {
|
|
953
|
-
return Math.max(1, Math.min(this.config.workers, 32)); // Cap at 32 workers
|
|
954
|
-
}
|
|
955
|
-
if (this.config.workers === "auto") {
|
|
956
|
-
const cpuCount = navigator.hardwareConcurrency || 4;
|
|
957
|
-
// Use OS-level memory information for better accuracy
|
|
958
|
-
const totalSystemMemory = os__default.totalmem();
|
|
959
|
-
const freeSystemMemory = os__default.freemem();
|
|
960
|
-
// Calculate based on available memory (leave 20% buffer)
|
|
961
|
-
const usableMemory = Math.min(totalSystemMemory * 0.6, freeSystemMemory * 0.8);
|
|
962
|
-
const memoryBasedCount = Math.floor(usableMemory / this.securityConfig.maxMemoryPerWorker);
|
|
963
|
-
// Use the minimum of CPU-based and memory-based counts
|
|
964
|
-
const optimalCount = Math.max(1, Math.min(cpuCount - 1, memoryBasedCount, 16));
|
|
965
|
-
logger.debug("cluster", `Optimal worker calculation: CPU=${cpuCount - 1}, Memory=${memoryBasedCount}, Selected=${optimalCount}`);
|
|
966
|
-
return optimalCount;
|
|
967
|
-
}
|
|
968
|
-
return 2; // Safe default
|
|
969
|
-
}
|
|
970
|
-
/**
|
|
971
|
-
* Start comprehensive health monitoring
|
|
972
|
-
*/
|
|
973
|
-
_startHealthMonitoring() {
|
|
974
|
-
this.healthCheckInterval = setInterval(async () => {
|
|
975
|
-
try {
|
|
976
|
-
await this._performHealthCheck();
|
|
977
|
-
}
|
|
978
|
-
catch (error) {
|
|
979
|
-
logger.error("cluster", "Health check error:", error);
|
|
980
|
-
}
|
|
981
|
-
}, 15000); // Check every 15 seconds
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Perform comprehensive health check on all workers
|
|
985
|
-
*/
|
|
986
|
-
async _performHealthCheck() {
|
|
987
|
-
const healthPromises = Array.from(this.workers.values()).map(async (worker) => {
|
|
988
|
-
try {
|
|
989
|
-
// Check process status
|
|
990
|
-
if (worker.subprocess.killed) {
|
|
991
|
-
worker.health.status = "unhealthy";
|
|
992
|
-
worker.health.consecutiveFailures++;
|
|
993
|
-
worker.health.lastError = "Process killed";
|
|
994
|
-
return;
|
|
995
|
-
}
|
|
996
|
-
// Check memory usage if available
|
|
997
|
-
const memoryUsage = await this._getWorkerMemoryUsage(worker);
|
|
998
|
-
if (memoryUsage > worker.resourceLimits.maxMemory) {
|
|
999
|
-
worker.health.status = "unhealthy";
|
|
1000
|
-
worker.health.consecutiveFailures++;
|
|
1001
|
-
worker.health.lastError = `Memory limit exceeded: ${Math.round(memoryUsage / 1024 / 1024)}MB`;
|
|
1002
|
-
this.emit("worker:memory_exceeded", {
|
|
1003
|
-
workerId: worker.id,
|
|
1004
|
-
memoryUsage,
|
|
1005
|
-
limit: worker.resourceLimits.maxMemory,
|
|
1006
|
-
});
|
|
1007
|
-
return;
|
|
1008
|
-
}
|
|
1009
|
-
// Update performance metrics
|
|
1010
|
-
worker.performance.memoryUsage = memoryUsage;
|
|
1011
|
-
// Health check passed
|
|
1012
|
-
worker.health.status = "healthy";
|
|
1013
|
-
worker.health.consecutiveFailures = 0;
|
|
1014
|
-
worker.lastPing = Date.now();
|
|
1015
|
-
}
|
|
1016
|
-
catch (error) {
|
|
1017
|
-
worker.health.status = "unhealthy";
|
|
1018
|
-
worker.health.consecutiveFailures++;
|
|
1019
|
-
worker.health.lastError =
|
|
1020
|
-
error instanceof Error ? error.message : String(error);
|
|
1021
|
-
logger.warn("cluster", `Health check failed for worker ${worker.id}:`, error);
|
|
1022
|
-
}
|
|
1023
|
-
});
|
|
1024
|
-
await Promise.allSettled(healthPromises);
|
|
1025
|
-
// Check overall cluster health
|
|
1026
|
-
const unhealthyWorkers = this.getAllWorkers().filter((w) => w.health.status === "unhealthy");
|
|
1027
|
-
if (unhealthyWorkers.length > 0) {
|
|
1028
|
-
this.emit("cluster:health_degraded", {
|
|
1029
|
-
unhealthyCount: unhealthyWorkers.length,
|
|
1030
|
-
totalCount: this.workers.size,
|
|
1031
|
-
timestamp: Date.now(),
|
|
1032
|
-
});
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
/**
|
|
1036
|
-
* Get worker memory usage using actual process monitoring
|
|
1037
|
-
*/
|
|
1038
|
-
async _getWorkerMemoryUsage(worker) {
|
|
1039
|
-
try {
|
|
1040
|
-
// Use Bun's process monitoring if available
|
|
1041
|
-
if (worker.subprocess && !worker.subprocess.killed) {
|
|
1042
|
-
// For Bun processes, we need to use system-level monitoring
|
|
1043
|
-
// since Bun doesn't expose process.memoryUsage() for subprocesses
|
|
1044
|
-
const pid = worker.subprocess.pid;
|
|
1045
|
-
if (pid) {
|
|
1046
|
-
return await this._getProcessMemoryUsage(pid);
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
// Fallback to estimated usage if process monitoring fails
|
|
1050
|
-
logger.warn("cluster", `Unable to get actual memory usage for worker ${worker.id}, using fallback`);
|
|
1051
|
-
return 64 * 1024 * 1024; // 64MB fallback
|
|
1052
|
-
}
|
|
1053
|
-
catch (error) {
|
|
1054
|
-
logger.error("cluster", `Error getting memory usage for worker ${worker.id}:`, error);
|
|
1055
|
-
return 64 * 1024 * 1024; // 64MB fallback
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
/**
|
|
1059
|
-
* Get actual memory usage for a process by PID
|
|
1060
|
-
*/
|
|
1061
|
-
async _getProcessMemoryUsage(pid) {
|
|
1062
|
-
try {
|
|
1063
|
-
if (process.platform === "linux") {
|
|
1064
|
-
const fs = await import('fs');
|
|
1065
|
-
const statm = await fs.promises.readFile(`/proc/${pid}/statm`, "utf8");
|
|
1066
|
-
const pages = parseInt(statm.split(" ")[1]); // RSS in pages
|
|
1067
|
-
const pageSize = 4096; // Standard page size on Linux
|
|
1068
|
-
return pages * pageSize;
|
|
1069
|
-
}
|
|
1070
|
-
else if (process.platform === "darwin") {
|
|
1071
|
-
// macOS implementation using ps command
|
|
1072
|
-
const { spawn } = await import('child_process');
|
|
1073
|
-
return new Promise((resolve, reject) => {
|
|
1074
|
-
const ps = spawn("ps", [
|
|
1075
|
-
"-o",
|
|
1076
|
-
"rss=",
|
|
1077
|
-
"-p",
|
|
1078
|
-
pid.toString(),
|
|
1079
|
-
]);
|
|
1080
|
-
let output = "";
|
|
1081
|
-
ps.stdout.on("data", (data) => {
|
|
1082
|
-
output += data.toString();
|
|
1083
|
-
});
|
|
1084
|
-
ps.on("close", (code) => {
|
|
1085
|
-
if (code === 0) {
|
|
1086
|
-
const rssKB = parseInt(output.trim());
|
|
1087
|
-
resolve(rssKB * 1024); // Convert KB to bytes
|
|
1088
|
-
}
|
|
1089
|
-
else {
|
|
1090
|
-
reject(new Error(`ps command failed with code ${code}`));
|
|
1091
|
-
}
|
|
1092
|
-
});
|
|
1093
|
-
ps.on("error", reject);
|
|
1094
|
-
});
|
|
1095
|
-
}
|
|
1096
|
-
else {
|
|
1097
|
-
// Windows or other platforms - use fallback
|
|
1098
|
-
throw new Error(`Memory monitoring not implemented for platform: ${process.platform}`);
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
catch (error) {
|
|
1102
|
-
throw new Error(`Failed to get process memory usage: ${error}`);
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
/**
|
|
1106
|
-
* Start metrics collection with detailed tracking
|
|
1107
|
-
*/
|
|
1108
|
-
_startMetricsCollection() {
|
|
1109
|
-
this.metricsInterval = setInterval(async () => {
|
|
1110
|
-
try {
|
|
1111
|
-
await this._collectMetrics();
|
|
1112
|
-
}
|
|
1113
|
-
catch (error) {
|
|
1114
|
-
logger.error("cluster", "Metrics collection error:", error);
|
|
1115
|
-
}
|
|
1116
|
-
}, 60000); // Collect every minute
|
|
1117
|
-
}
|
|
1118
|
-
/**
|
|
1119
|
-
* Collect comprehensive cluster metrics
|
|
1120
|
-
*/
|
|
1121
|
-
async _collectMetrics() {
|
|
1122
|
-
const workers = Array.from(this.workers.values());
|
|
1123
|
-
const activeWorkers = workers.filter((w) => w.health.status === "healthy");
|
|
1124
|
-
const totalRequests = workers.reduce((sum, w) => sum + w.performance.requestCount, 0);
|
|
1125
|
-
const totalErrors = workers.reduce((sum, w) => sum + w.performance.errorCount, 0);
|
|
1126
|
-
const avgResponseTimes = workers
|
|
1127
|
-
.filter((w) => w.performance.averageResponseTime > 0)
|
|
1128
|
-
.map((w) => w.performance.averageResponseTime);
|
|
1129
|
-
const averageResponseTime = avgResponseTimes.length > 0
|
|
1130
|
-
? avgResponseTimes.reduce((sum, time) => sum + time, 0) /
|
|
1131
|
-
avgResponseTimes.length
|
|
1132
|
-
: 0;
|
|
1133
|
-
const memoryUsage = process.memoryUsage();
|
|
1134
|
-
const workerMemoryUsage = workers.reduce((sum, w) => sum + w.performance.memoryUsage, 0);
|
|
1135
|
-
const metrics = {
|
|
1136
|
-
totalWorkers: workers.length,
|
|
1137
|
-
activeWorkers: activeWorkers.length,
|
|
1138
|
-
totalRequests,
|
|
1139
|
-
averageResponseTime: Math.round(averageResponseTime * 100) / 100, // Round to 2 decimal places
|
|
1140
|
-
memoryUsage: memoryUsage.heapUsed + workerMemoryUsage,
|
|
1141
|
-
cpuUsage: await this._calculateCpuUsage(),
|
|
1142
|
-
uptime: performance.now() - this.startTime,
|
|
1143
|
-
errorRate: totalRequests > 0 ? (totalErrors / totalRequests) * 100 : 0,
|
|
1144
|
-
restartCount: workers.reduce((sum, w) => sum + w.restarts, 0),
|
|
1145
|
-
};
|
|
1146
|
-
this.emit("metrics:collected", { metrics, timestamp: Date.now() });
|
|
1147
|
-
return metrics;
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Calculate CPU usage for the cluster using sophisticated monitoring
|
|
1151
|
-
*/
|
|
1152
|
-
async _calculateCpuUsage() {
|
|
1153
|
-
const workers = this.getAllWorkers();
|
|
1154
|
-
return await this.cpuMonitor.calculateClusterCpuUsage(workers);
|
|
1155
|
-
}
|
|
1156
|
-
/**
|
|
1157
|
-
* Start performance monitoring
|
|
1158
|
-
*/
|
|
1159
|
-
_startPerformanceMonitoring() {
|
|
1160
|
-
this.performanceInterval = setInterval(() => {
|
|
1161
|
-
this._updateWorkerPerformanceMetrics();
|
|
1162
|
-
}, 30000); // Update every 30 seconds
|
|
1163
|
-
}
|
|
1164
|
-
/**
|
|
1165
|
-
* Update worker performance metrics with real data
|
|
1166
|
-
*/
|
|
1167
|
-
_updateWorkerPerformanceMetrics() {
|
|
1168
|
-
for (const [, worker] of this.workers) {
|
|
1169
|
-
// Update memory usage with actual data
|
|
1170
|
-
this._getWorkerMemoryUsage(worker)
|
|
1171
|
-
.then((memoryUsage) => {
|
|
1172
|
-
worker.performance.memoryUsage = memoryUsage;
|
|
1173
|
-
})
|
|
1174
|
-
.catch((error) => {
|
|
1175
|
-
logger.debug("cluster", `Failed to update memory usage for worker ${worker.id}:`, error);
|
|
1176
|
-
});
|
|
1177
|
-
// Update CPU usage if available
|
|
1178
|
-
this._getWorkerCpuUsage(worker)
|
|
1179
|
-
.then((cpuUsage) => {
|
|
1180
|
-
worker.performance.cpuUsage = cpuUsage;
|
|
1181
|
-
})
|
|
1182
|
-
.catch((error) => {
|
|
1183
|
-
logger.debug("cluster", `Failed to update CPU usage for worker ${worker.id}:`, error);
|
|
1184
|
-
});
|
|
1185
|
-
// Decay old metrics to prevent infinite growth
|
|
1186
|
-
const timeSinceLastUpdate = Date.now() -
|
|
1187
|
-
(worker.performance.lastRequestTime || worker.startTime);
|
|
1188
|
-
if (timeSinceLastUpdate > 300000) {
|
|
1189
|
-
// 5 minutes - decay counters
|
|
1190
|
-
worker.performance.requestCount = Math.floor(worker.performance.requestCount * 0.9);
|
|
1191
|
-
worker.performance.errorCount = Math.floor(worker.performance.errorCount * 0.9);
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
/**
|
|
1196
|
-
* Get actual CPU usage for a worker
|
|
1197
|
-
*/
|
|
1198
|
-
async _getWorkerCpuUsage(worker) {
|
|
1199
|
-
try {
|
|
1200
|
-
if (worker.subprocess && !worker.subprocess.killed) {
|
|
1201
|
-
const pid = worker.subprocess.pid;
|
|
1202
|
-
if (pid) {
|
|
1203
|
-
return await this._getProcessCpuUsage(pid);
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
return 0;
|
|
1207
|
-
}
|
|
1208
|
-
catch (error) {
|
|
1209
|
-
logger.debug("cluster", `Error getting CPU usage for worker ${worker.id}:`, error);
|
|
1210
|
-
return 0;
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
/**
|
|
1214
|
-
* Get actual CPU usage for a process by PID using sophisticated monitoring
|
|
1215
|
-
*/
|
|
1216
|
-
async _getProcessCpuUsage(pid) {
|
|
1217
|
-
return await this.cpuMonitor.getProcessCpuUsage(pid);
|
|
1218
|
-
}
|
|
1219
|
-
/**
|
|
1220
|
-
* Enable emergency mode for resource conservation
|
|
1221
|
-
*/
|
|
1222
|
-
_enableEmergencyMode() {
|
|
1223
|
-
logger.warn("cluster", "Enabling emergency mode - reducing resource usage");
|
|
1224
|
-
// Reduce monitoring frequency
|
|
1225
|
-
if (this.healthCheckInterval) {
|
|
1226
|
-
clearInterval(this.healthCheckInterval);
|
|
1227
|
-
this.healthCheckInterval = setInterval(() => this._performHealthCheck(), 60000); // 1 minute
|
|
1228
|
-
}
|
|
1229
|
-
if (this.metricsInterval) {
|
|
1230
|
-
clearInterval(this.metricsInterval);
|
|
1231
|
-
this.metricsInterval = setInterval(() => this._collectMetrics(), 300000); // 5 minutes
|
|
1232
|
-
}
|
|
1233
|
-
this.emit("emergency_mode", { enabled: true, timestamp: Date.now() });
|
|
1234
|
-
}
|
|
1235
|
-
/**
|
|
1236
|
-
* Disable emergency mode and restore normal operation
|
|
1237
|
-
*/
|
|
1238
|
-
_disableEmergencyMode() {
|
|
1239
|
-
logger.info("cluster", "Disabling emergency mode - restoring normal operation");
|
|
1240
|
-
// Restore normal monitoring frequency
|
|
1241
|
-
if (this.healthCheckInterval) {
|
|
1242
|
-
clearInterval(this.healthCheckInterval);
|
|
1243
|
-
this._startHealthMonitoring();
|
|
1244
|
-
}
|
|
1245
|
-
if (this.metricsInterval) {
|
|
1246
|
-
clearInterval(this.metricsInterval);
|
|
1247
|
-
this._startMetricsCollection();
|
|
1248
|
-
}
|
|
1249
|
-
this.emit("emergency_mode", { enabled: false, timestamp: Date.now() });
|
|
1250
|
-
}
|
|
1251
|
-
// Public API methods (maintaining compatibility)
|
|
1252
|
-
/**
|
|
1253
|
-
* Get all workers
|
|
1254
|
-
*/
|
|
1255
|
-
getAllWorkers() {
|
|
1256
|
-
return Array.from(this.workers.values());
|
|
1257
|
-
}
|
|
1258
|
-
/**
|
|
1259
|
-
* Get active workers
|
|
1260
|
-
*/
|
|
1261
|
-
getActiveWorkers() {
|
|
1262
|
-
return this.getAllWorkers().filter((w) => w.health.status === "healthy");
|
|
1263
|
-
}
|
|
1264
|
-
/**
|
|
1265
|
-
* Set IPC manager for worker communication
|
|
1266
|
-
*/
|
|
1267
|
-
setIPCManager(ipcManager) {
|
|
1268
|
-
this.ipcManager = ipcManager;
|
|
1269
|
-
logger.debug("cluster", "IPC Manager set for Bun cluster");
|
|
1270
|
-
// Register existing workers with IPC manager
|
|
1271
|
-
for (const [workerId, worker] of this.workers) {
|
|
1272
|
-
if (worker.subprocess && worker.status === "running") {
|
|
1273
|
-
this.ipcManager.registerWorker(workerId, worker.subprocess);
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
/**
|
|
1278
|
-
* Get cluster metrics
|
|
1279
|
-
*/
|
|
1280
|
-
async getMetrics() {
|
|
1281
|
-
return this._collectMetrics();
|
|
1282
|
-
}
|
|
1283
|
-
/**
|
|
1284
|
-
* Check cluster health with detailed information
|
|
1285
|
-
*/
|
|
1286
|
-
async checkHealth() {
|
|
1287
|
-
const workers = this.getAllWorkers();
|
|
1288
|
-
const activeWorkers = this.getActiveWorkers();
|
|
1289
|
-
const healthyPercentage = workers.length > 0
|
|
1290
|
-
? (activeWorkers.length / workers.length) * 100
|
|
1291
|
-
: 0;
|
|
1292
|
-
const uptime = performance.now() - this.startTime;
|
|
1293
|
-
const unhealthyWorkers = workers.filter((w) => w.health.status === "unhealthy");
|
|
1294
|
-
const criticalIssues = unhealthyWorkers.filter((w) => w.health.consecutiveFailures >= 3);
|
|
1295
|
-
return {
|
|
1296
|
-
healthy: healthyPercentage >= 70 && criticalIssues.length === 0,
|
|
1297
|
-
details: {
|
|
1298
|
-
totalWorkers: workers.length,
|
|
1299
|
-
activeWorkers: activeWorkers.length,
|
|
1300
|
-
healthyPercentage: Math.round(healthyPercentage),
|
|
1301
|
-
uptime: Math.round(uptime),
|
|
1302
|
-
criticalIssues: criticalIssues.length,
|
|
1303
|
-
memoryUsage: process.memoryUsage().heapUsed,
|
|
1304
|
-
isEmergencyMode: false, // Will be implemented when MemoryManager is updated
|
|
1305
|
-
lastHealthCheck: Date.now(),
|
|
1306
|
-
},
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
/**
|
|
1310
|
-
* Scale up workers with validation
|
|
1311
|
-
*/
|
|
1312
|
-
async scaleUp(count = 1) {
|
|
1313
|
-
if (!this.isRunning) {
|
|
1314
|
-
throw new Error("Cannot scale up: cluster is not running");
|
|
1315
|
-
}
|
|
1316
|
-
if (count <= 0 || count > 16) {
|
|
1317
|
-
throw new Error("Invalid scale up count: must be between 1 and 16");
|
|
1318
|
-
}
|
|
1319
|
-
logger.info("cluster", `Scaling up Bun cluster by ${count} workers`);
|
|
1320
|
-
// Validate resources before scaling
|
|
1321
|
-
const currentCount = this.workers.size;
|
|
1322
|
-
const newCount = currentCount + count;
|
|
1323
|
-
await this._validateSystemResources(newCount);
|
|
1324
|
-
const spawnPromises = Array.from({ length: count }, (_, i) => this._spawnWorkerWithRetry(currentCount + i));
|
|
1325
|
-
const results = await Promise.allSettled(spawnPromises);
|
|
1326
|
-
const successful = results.filter((r) => r.status === "fulfilled").length;
|
|
1327
|
-
logger.info("cluster", `Scale up completed: ${successful}/${count} workers started`);
|
|
1328
|
-
this.emit("cluster:scaled_up", {
|
|
1329
|
-
requested: count,
|
|
1330
|
-
successful,
|
|
1331
|
-
newTotal: this.workers.size,
|
|
1332
|
-
timestamp: Date.now(),
|
|
1333
|
-
});
|
|
1334
|
-
if (successful === 0) {
|
|
1335
|
-
throw new Error("Failed to start any new workers during scale up");
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
/**
|
|
1339
|
-
* Scale down workers with safety checks
|
|
1340
|
-
*/
|
|
1341
|
-
async scaleDown(count = 1) {
|
|
1342
|
-
if (!this.isRunning) {
|
|
1343
|
-
throw new Error("Cannot scale down: cluster is not running");
|
|
1344
|
-
}
|
|
1345
|
-
const activeWorkers = this.getActiveWorkers();
|
|
1346
|
-
if (activeWorkers.length <= 1) {
|
|
1347
|
-
throw new Error("Cannot scale down: must maintain at least one active worker");
|
|
1348
|
-
}
|
|
1349
|
-
const actualCount = Math.min(count, activeWorkers.length - 1);
|
|
1350
|
-
logger.info("cluster", `Scaling down Bun cluster by ${actualCount} workers`);
|
|
1351
|
-
// Select workers to stop (prefer oldest workers)
|
|
1352
|
-
const workersToStop = activeWorkers
|
|
1353
|
-
.sort((a, b) => a.startTime - b.startTime)
|
|
1354
|
-
.slice(-actualCount);
|
|
1355
|
-
const stopPromises = workersToStop.map(async (worker) => {
|
|
1356
|
-
await this._stopWorker(worker.id, true);
|
|
1357
|
-
this.workers.delete(worker.id);
|
|
1358
|
-
return worker.id;
|
|
1359
|
-
});
|
|
1360
|
-
const results = await Promise.allSettled(stopPromises);
|
|
1361
|
-
const successful = results.filter((r) => r.status === "fulfilled").length;
|
|
1362
|
-
logger.info("cluster", `Scale down completed: ${successful}/${actualCount} workers stopped`);
|
|
1363
|
-
this.emit("cluster:scaled_down", {
|
|
1364
|
-
requested: actualCount,
|
|
1365
|
-
successful,
|
|
1366
|
-
newTotal: this.workers.size,
|
|
1367
|
-
timestamp: Date.now(),
|
|
1368
|
-
});
|
|
1369
|
-
}
|
|
1370
|
-
/**
|
|
1371
|
-
* Handle memory-based scale down with safety measures
|
|
1372
|
-
*/
|
|
1373
|
-
async _handleMemoryScaleDown(alert) {
|
|
1374
|
-
const enhancedWorkers = Array.from(this.workers.values()).filter((w) => w.health.status === "healthy");
|
|
1375
|
-
if (enhancedWorkers.length <= 1) {
|
|
1376
|
-
logger.warn("cluster", "Cannot scale down further - only one worker remaining");
|
|
1377
|
-
return;
|
|
1378
|
-
}
|
|
1379
|
-
// Find the worker using the most memory
|
|
1380
|
-
const workerToStop = enhancedWorkers.reduce((prev, current) => prev.performance.memoryUsage > current.performance.memoryUsage
|
|
1381
|
-
? prev
|
|
1382
|
-
: current);
|
|
1383
|
-
logger.info("cluster", `Scaling down due to memory pressure - stopping worker ${workerToStop.id}`);
|
|
1384
|
-
try {
|
|
1385
|
-
await this._stopWorker(workerToStop.id, true);
|
|
1386
|
-
this.workers.delete(workerToStop.id);
|
|
1387
|
-
this.emit("worker:scaled_down_memory", {
|
|
1388
|
-
workerId: workerToStop.id,
|
|
1389
|
-
memoryUsage: workerToStop.performance.memoryUsage,
|
|
1390
|
-
alert,
|
|
1391
|
-
timestamp: Date.now(),
|
|
1392
|
-
});
|
|
1393
|
-
}
|
|
1394
|
-
catch (error) {
|
|
1395
|
-
logger.error("cluster", `Failed to scale down worker ${workerToStop.id}:`, error);
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
/**
|
|
1399
|
-
* Handle worker memory issues with enhanced recovery
|
|
1400
|
-
*/
|
|
1401
|
-
async _handleWorkerMemoryIssue(workerId, alert) {
|
|
1402
|
-
const worker = this.workers.get(workerId);
|
|
1403
|
-
if (!worker) {
|
|
1404
|
-
return;
|
|
1405
|
-
}
|
|
1406
|
-
logger.warn("cluster", `Handling memory issue for worker ${workerId}: ${alert.message}`);
|
|
1407
|
-
// Add to restart history
|
|
1408
|
-
worker.restartHistory.push({
|
|
1409
|
-
timestamp: Date.now(),
|
|
1410
|
-
reason: `memory_issue: ${alert.message}`,
|
|
1411
|
-
});
|
|
1412
|
-
try {
|
|
1413
|
-
// Force stop for memory issues (no graceful shutdown)
|
|
1414
|
-
await this._stopWorker(workerId, false);
|
|
1415
|
-
// Wait before restart to allow memory cleanup
|
|
1416
|
-
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
1417
|
-
// Restart with the same index
|
|
1418
|
-
const index = parseInt(workerId.split("-")[1]) || 0;
|
|
1419
|
-
await this._spawnWorkerWithRetry(index, 2);
|
|
1420
|
-
this.emit("worker:memory_restart", {
|
|
1421
|
-
oldWorkerId: workerId,
|
|
1422
|
-
alert,
|
|
1423
|
-
timestamp: Date.now(),
|
|
1424
|
-
});
|
|
1425
|
-
}
|
|
1426
|
-
catch (error) {
|
|
1427
|
-
logger.error("cluster", `Failed to restart worker ${workerId} after memory issue:`, error);
|
|
1428
|
-
this.workers.delete(workerId);
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
/**
|
|
1432
|
-
* Handle memory throttling with appropriate measures
|
|
1433
|
-
*/
|
|
1434
|
-
_handleMemoryThrottling(alert) {
|
|
1435
|
-
logger.info("cluster", `Implementing memory throttling: ${alert.message}`);
|
|
1436
|
-
// Reduce monitoring frequency to save memory
|
|
1437
|
-
this._enableEmergencyMode();
|
|
1438
|
-
// Emit throttling event for application to handle
|
|
1439
|
-
this.emit("memory_throttling", {
|
|
1440
|
-
alert,
|
|
1441
|
-
timestamp: Date.now(),
|
|
1442
|
-
action: "reduce_concurrency",
|
|
1443
|
-
recommendations: {
|
|
1444
|
-
reduceWorkerCount: true,
|
|
1445
|
-
enableCompression: true,
|
|
1446
|
-
clearCaches: true,
|
|
1447
|
-
deferNonCriticalTasks: true,
|
|
1448
|
-
},
|
|
1449
|
-
});
|
|
1450
|
-
}
|
|
1451
|
-
/**
|
|
1452
|
-
* Get memory optimization recommendations
|
|
1453
|
-
*/
|
|
1454
|
-
getMemoryRecommendations() {
|
|
1455
|
-
const enhancedWorkers = Array.from(this.workers.values());
|
|
1456
|
-
const totalMemory = enhancedWorkers.reduce((sum, w) => sum + w.performance.memoryUsage, 0);
|
|
1457
|
-
const avgMemoryPerWorker = enhancedWorkers.length > 0
|
|
1458
|
-
? totalMemory / enhancedWorkers.length
|
|
1459
|
-
: 0;
|
|
1460
|
-
return {
|
|
1461
|
-
currentWorkerCount: enhancedWorkers.length,
|
|
1462
|
-
optimalWorkerCount: this.getOptimalWorkerCountForMemory(),
|
|
1463
|
-
averageMemoryPerWorker: Math.round(avgMemoryPerWorker / 1024 / 1024), // MB
|
|
1464
|
-
recommendations: this.memoryManager.getMemoryOptimizationRecommendations?.() || {
|
|
1465
|
-
scaleDown: enhancedWorkers.length >
|
|
1466
|
-
this.getOptimalWorkerCountForMemory(),
|
|
1467
|
-
enableCompression: true,
|
|
1468
|
-
optimizeGarbageCollection: true,
|
|
1469
|
-
monitorMemoryLeaks: totalMemory > 1024 * 1024 * 1024, // > 1GB
|
|
1470
|
-
},
|
|
1471
|
-
timestamp: Date.now(),
|
|
1472
|
-
};
|
|
1473
|
-
}
|
|
1474
|
-
/**
|
|
1475
|
-
* Get optimal worker count based on memory constraints
|
|
1476
|
-
*/
|
|
1477
|
-
getOptimalWorkerCountForMemory() {
|
|
1478
|
-
// Use OS-level memory information for accurate calculation
|
|
1479
|
-
const freeMemory = os__default.freemem();
|
|
1480
|
-
const totalMemory = os__default.totalmem();
|
|
1481
|
-
// Use the smaller of free memory or 60% of total memory (conservative approach)
|
|
1482
|
-
const available = Math.min(freeMemory * 0.8, totalMemory * 0.6);
|
|
1483
|
-
const perWorker = this.securityConfig.maxMemoryPerWorker;
|
|
1484
|
-
const memoryBasedCount = Math.floor(available / perWorker);
|
|
1485
|
-
const result = Math.max(1, Math.min(memoryBasedCount, this._getOptimalWorkerCount()));
|
|
1486
|
-
logger.debug("cluster", `Memory-based worker count: ${memoryBasedCount} (available: ${Math.round(available / 1024 / 1024)}MB, per worker: ${Math.round(perWorker / 1024 / 1024)}MB)`);
|
|
1487
|
-
return result;
|
|
1488
|
-
}
|
|
1489
|
-
/**
|
|
1490
|
-
* Enable low memory mode with comprehensive measures
|
|
1491
|
-
*/
|
|
1492
|
-
enableLowMemoryMode() {
|
|
1493
|
-
logger.info("cluster", "Manually enabling low memory mode");
|
|
1494
|
-
this.memoryManager.enableLowMemoryMode?.();
|
|
1495
|
-
this._enableEmergencyMode();
|
|
1496
|
-
}
|
|
1497
|
-
/**
|
|
1498
|
-
* Disable low memory mode and restore normal operation
|
|
1499
|
-
*/
|
|
1500
|
-
disableLowMemoryMode() {
|
|
1501
|
-
logger.info("cluster", "Manually disabling low memory mode");
|
|
1502
|
-
this.memoryManager.disableLowMemoryMode?.();
|
|
1503
|
-
this._disableEmergencyMode();
|
|
1504
|
-
}
|
|
1505
|
-
/**
|
|
1506
|
-
* Get detailed worker information for debugging
|
|
1507
|
-
*/
|
|
1508
|
-
getWorkerDetails(workerId) {
|
|
1509
|
-
if (workerId) {
|
|
1510
|
-
const worker = this.workers.get(workerId);
|
|
1511
|
-
if (!worker) {
|
|
1512
|
-
return null;
|
|
1513
|
-
}
|
|
1514
|
-
return {
|
|
1515
|
-
id: worker.id,
|
|
1516
|
-
port: worker.port,
|
|
1517
|
-
status: worker.status,
|
|
1518
|
-
health: worker.health,
|
|
1519
|
-
performance: worker.performance,
|
|
1520
|
-
uptime: Date.now() - worker.startTime,
|
|
1521
|
-
restarts: worker.restarts,
|
|
1522
|
-
restartHistory: worker.restartHistory.slice(-5), // Last 5 restarts
|
|
1523
|
-
resourceLimits: worker.resourceLimits,
|
|
1524
|
-
};
|
|
1525
|
-
}
|
|
1526
|
-
return Array.from(this.workers.values()).map((worker) => ({
|
|
1527
|
-
id: worker.id,
|
|
1528
|
-
port: worker.port,
|
|
1529
|
-
status: worker.status,
|
|
1530
|
-
health: worker.health.status,
|
|
1531
|
-
uptime: Date.now() - worker.startTime,
|
|
1532
|
-
restarts: worker.restarts,
|
|
1533
|
-
memoryUsage: Math.round(worker.performance.memoryUsage / 1024 / 1024), // MB
|
|
1534
|
-
requestCount: worker.performance.requestCount,
|
|
1535
|
-
}));
|
|
1536
|
-
}
|
|
1537
|
-
/**
|
|
1538
|
-
* Force restart of a specific worker (for debugging/maintenance)
|
|
1539
|
-
*/
|
|
1540
|
-
async forceRestartWorker(workerId) {
|
|
1541
|
-
const worker = this.workers.get(workerId);
|
|
1542
|
-
if (!worker) {
|
|
1543
|
-
throw new Error(`Worker ${workerId} not found`);
|
|
1544
|
-
}
|
|
1545
|
-
logger.info("cluster", `Force restarting worker ${workerId}`);
|
|
1546
|
-
worker.restartHistory.push({
|
|
1547
|
-
timestamp: Date.now(),
|
|
1548
|
-
reason: "manual_restart",
|
|
1549
|
-
});
|
|
1550
|
-
await this._attemptWorkerRestart(worker);
|
|
1551
|
-
}
|
|
1552
|
-
/**
|
|
1553
|
-
* Get cluster status summary
|
|
1554
|
-
*/
|
|
1555
|
-
getStatus() {
|
|
1556
|
-
const workers = this.getAllWorkers();
|
|
1557
|
-
const activeWorkers = this.getActiveWorkers();
|
|
1558
|
-
const enhancedWorkers = Array.from(this.workers.values());
|
|
1559
|
-
return {
|
|
1560
|
-
isRunning: this.isRunning,
|
|
1561
|
-
uptime: performance.now() - this.startTime,
|
|
1562
|
-
workers: {
|
|
1563
|
-
total: workers.length,
|
|
1564
|
-
active: activeWorkers.length,
|
|
1565
|
-
starting: workers.filter((w) => w.status === "starting").length,
|
|
1566
|
-
stopping: workers.filter((w) => w.status === "stopping").length,
|
|
1567
|
-
unhealthy: workers.filter((w) => w.health.status === "unhealthy").length,
|
|
1568
|
-
},
|
|
1569
|
-
performance: {
|
|
1570
|
-
totalRequests: enhancedWorkers.reduce((sum, w) => sum + w.performance.requestCount, 0),
|
|
1571
|
-
totalErrors: enhancedWorkers.reduce((sum, w) => sum + w.performance.errorCount, 0),
|
|
1572
|
-
totalRestarts: workers.reduce((sum, w) => sum + w.restarts, 0),
|
|
1573
|
-
},
|
|
1574
|
-
memory: {
|
|
1575
|
-
masterUsage: Math.round(process.memoryUsage().heapUsed / 1024 / 1024), // MB
|
|
1576
|
-
workerUsage: Math.round(enhancedWorkers.reduce((sum, w) => sum + w.performance.memoryUsage, 0) /
|
|
1577
|
-
1024 /
|
|
1578
|
-
1024), // MB
|
|
1579
|
-
isLowMemoryMode: false, // Will be implemented in MemoryManager
|
|
1580
|
-
},
|
|
1581
|
-
timestamp: Date.now(),
|
|
1582
|
-
};
|
|
1583
|
-
}
|
|
1584
|
-
/**
|
|
1585
|
-
* Select worker for request using load balancing strategy
|
|
1586
|
-
*/
|
|
1587
|
-
selectWorkerForRequest(workers, request) {
|
|
1588
|
-
// For now, use simple round-robin until we integrate the LoadBalancer class
|
|
1589
|
-
if (workers.length === 0) {
|
|
1590
|
-
throw new Error("No workers available for load balancing");
|
|
1591
|
-
}
|
|
1592
|
-
// Simple round-robin implementation
|
|
1593
|
-
const workerIds = workers.map((w) => w.workerId);
|
|
1594
|
-
const index = Math.floor(Math.random() * workerIds.length);
|
|
1595
|
-
return workerIds[index];
|
|
1596
|
-
}
|
|
1597
|
-
/**
|
|
1598
|
-
* Get worker metrics for load balancing
|
|
1599
|
-
*/
|
|
1600
|
-
async getWorkerMetrics() {
|
|
1601
|
-
const workers = [];
|
|
1602
|
-
for (const [workerId, worker] of this.workers) {
|
|
1603
|
-
if (worker.status === "running" &&
|
|
1604
|
-
worker.health.status === "healthy") {
|
|
1605
|
-
workers.push({
|
|
1606
|
-
workerId,
|
|
1607
|
-
pid: worker.subprocess.pid || 0,
|
|
1608
|
-
uptime: Date.now() - worker.startTime,
|
|
1609
|
-
restarts: worker.restarts,
|
|
1610
|
-
lastRestart: worker.restarts > 0 ? new Date() : undefined,
|
|
1611
|
-
cpu: {
|
|
1612
|
-
usage: worker.performance.cpuUsage,
|
|
1613
|
-
average: worker.performance.cpuUsage,
|
|
1614
|
-
peak: worker.performance.cpuUsage,
|
|
1615
|
-
},
|
|
1616
|
-
memory: {
|
|
1617
|
-
usage: worker.performance.memoryUsage * 1024 * 1024, // Convert MB to bytes
|
|
1618
|
-
peak: worker.performance.memoryUsage * 1024 * 1024,
|
|
1619
|
-
percentage: worker.performance.memoryUsage,
|
|
1620
|
-
...(await this.heapStatsCollector.getHeapStats(workerId, worker.subprocess.pid || 0)),
|
|
1621
|
-
},
|
|
1622
|
-
network: await this.networkTracker.getNetworkStats(workerId, worker.subprocess.pid || 0),
|
|
1623
|
-
requests: {
|
|
1624
|
-
total: worker.performance.requestCount,
|
|
1625
|
-
errors: worker.performance.errorCount,
|
|
1626
|
-
averageResponseTime: worker.performance.averageResponseTime || 0,
|
|
1627
|
-
p95ResponseTime: (worker.performance.averageResponseTime || 0) * 1.2,
|
|
1628
|
-
p99ResponseTime: (worker.performance.averageResponseTime || 0) * 1.5,
|
|
1629
|
-
...(() => {
|
|
1630
|
-
const throughputStats = this.throughputCalculator.calculateThroughput(workerId, worker.performance.requestCount);
|
|
1631
|
-
return {
|
|
1632
|
-
perSecond: throughputStats.requestsPerSecond,
|
|
1633
|
-
activeRequests: throughputStats.activeRequests,
|
|
1634
|
-
queuedRequests: throughputStats.queuedRequests,
|
|
1635
|
-
};
|
|
1636
|
-
})(),
|
|
1637
|
-
},
|
|
1638
|
-
health: {
|
|
1639
|
-
status: worker.health.status,
|
|
1640
|
-
lastCheck: new Date(),
|
|
1641
|
-
consecutiveFailures: worker.health.consecutiveFailures,
|
|
1642
|
-
healthScore: 100, // Default healthy score
|
|
1643
|
-
},
|
|
1644
|
-
gc: await this.gcStatsTracker.getGCStats(workerId, worker.subprocess.pid || 0),
|
|
1645
|
-
eventLoop: await this.eventLoopMonitor.getEventLoopStats(workerId),
|
|
1646
|
-
});
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
return workers;
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
export { BunClusterManager };
|
|
1654
|
-
//# sourceMappingURL=bun-cluster-manager.js.map
|