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
|
@@ -0,0 +1,2028 @@
|
|
|
1
|
+
/***************************************************************************
|
|
2
|
+
* XyPrissSecurity - Enhanced Secure Array Core Implementation
|
|
3
|
+
*
|
|
4
|
+
* security features and array methods
|
|
5
|
+
*
|
|
6
|
+
* @author Nehonix & Community
|
|
7
|
+
*
|
|
8
|
+
* @license MIT
|
|
9
|
+
***************************************************************************** */
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
SecureArrayValue,
|
|
13
|
+
SecureArrayOptions,
|
|
14
|
+
SecureArraySerializationOptions,
|
|
15
|
+
SecureArrayEvent,
|
|
16
|
+
SecureArrayEventListener,
|
|
17
|
+
ElementMetadata,
|
|
18
|
+
SecureArrayStats,
|
|
19
|
+
DEFAULT_SECURE_ARRAY_OPTIONS,
|
|
20
|
+
PredicateFn,
|
|
21
|
+
ComparatorFn,
|
|
22
|
+
MapperFn,
|
|
23
|
+
ReducerFn,
|
|
24
|
+
} from "../types";
|
|
25
|
+
|
|
26
|
+
// Import modular components
|
|
27
|
+
import { ArrayMetadataManager } from "../metadata/metadata-manager";
|
|
28
|
+
import { ArrayValidationUtils } from "../utils/validation";
|
|
29
|
+
import { ArrayIdGenerator } from "../utils/id-generator";
|
|
30
|
+
|
|
31
|
+
// Import existing XyPrissSecurity utilities
|
|
32
|
+
import { SecureBuffer } from "../../secure-memory";
|
|
33
|
+
import { memoryManager, MemoryEventType } from "../../../utils/memory";
|
|
34
|
+
|
|
35
|
+
// Use existing event manager from secure-array
|
|
36
|
+
import { ArrayEventManager } from "../events/event-manager";
|
|
37
|
+
import { ArrayCryptoHandler } from "../crypto/ArrayCryptoHandler";
|
|
38
|
+
import { ArraySerializationHandler } from "../serialization/ArraySerializationHandler";
|
|
39
|
+
import { XyPriss } from "../../..";
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A secure array that can store sensitive data with enhanced security features
|
|
43
|
+
* T represents the type of elements stored in the array
|
|
44
|
+
*/
|
|
45
|
+
export class SecureArray<T extends SecureArrayValue = SecureArrayValue>
|
|
46
|
+
implements Iterable<T>
|
|
47
|
+
{
|
|
48
|
+
// Core data storage
|
|
49
|
+
private elements: T[] = [];
|
|
50
|
+
private secureBuffers: Map<number, SecureBuffer> = new Map();
|
|
51
|
+
|
|
52
|
+
// Modular components
|
|
53
|
+
private metadataManager: ArrayMetadataManager;
|
|
54
|
+
private eventManager: ArrayEventManager;
|
|
55
|
+
private cryptoHandler: ArrayCryptoHandler;
|
|
56
|
+
private serializationHandler: ArraySerializationHandler;
|
|
57
|
+
|
|
58
|
+
// State management
|
|
59
|
+
private _isDestroyed: boolean = false;
|
|
60
|
+
private _isReadOnly: boolean = false;
|
|
61
|
+
private _isFrozen: boolean = false;
|
|
62
|
+
private readonly _id: string;
|
|
63
|
+
private _version: number = 1;
|
|
64
|
+
private _lastModified: number = Date.now();
|
|
65
|
+
private _createdAt: number = Date.now();
|
|
66
|
+
|
|
67
|
+
// Memory management
|
|
68
|
+
private _memoryTracking: boolean = false;
|
|
69
|
+
private secureBufferPool?: any;
|
|
70
|
+
private _maxSize?: number;
|
|
71
|
+
|
|
72
|
+
// Configuration
|
|
73
|
+
private options: Required<SecureArrayOptions>;
|
|
74
|
+
|
|
75
|
+
// Snapshot functionality
|
|
76
|
+
private snapshots: Map<
|
|
77
|
+
string,
|
|
78
|
+
{
|
|
79
|
+
elements: T[];
|
|
80
|
+
metadata: Map<number, ElementMetadata>;
|
|
81
|
+
timestamp: number;
|
|
82
|
+
}
|
|
83
|
+
> = new Map();
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Creates a new secure array
|
|
87
|
+
*/
|
|
88
|
+
constructor(initialData?: T[], options?: SecureArrayOptions) {
|
|
89
|
+
this._id = ArrayIdGenerator.generate();
|
|
90
|
+
this.options = { ...DEFAULT_SECURE_ARRAY_OPTIONS, ...options };
|
|
91
|
+
this._isReadOnly = this.options.readOnly;
|
|
92
|
+
this._maxSize = this.options.maxSize;
|
|
93
|
+
|
|
94
|
+
// Initialize modular components
|
|
95
|
+
this.metadataManager = new ArrayMetadataManager();
|
|
96
|
+
this.eventManager = new ArrayEventManager();
|
|
97
|
+
this.cryptoHandler = new ArrayCryptoHandler(this._id);
|
|
98
|
+
this.serializationHandler = new ArraySerializationHandler(
|
|
99
|
+
this.cryptoHandler,
|
|
100
|
+
this.metadataManager
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
// Set encryption key if provided
|
|
104
|
+
if (this.options.encryptionKey) {
|
|
105
|
+
this.cryptoHandler.setEncryptionKey(this.options.encryptionKey);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Enable memory tracking
|
|
109
|
+
this._memoryTracking = this.options.enableMemoryTracking;
|
|
110
|
+
|
|
111
|
+
// Register with advanced memory manager if tracking is enabled
|
|
112
|
+
if (this._memoryTracking) {
|
|
113
|
+
memoryManager.registerObject(this, this._id);
|
|
114
|
+
|
|
115
|
+
// Listen to memory events for proactive management
|
|
116
|
+
memoryManager.on(MemoryEventType.MEMORY_PRESSURE, (event: any) => {
|
|
117
|
+
if (event.data?.pressure > 0.8) {
|
|
118
|
+
this.handleMemoryPressure();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
memoryManager.on(MemoryEventType.LEAK_DETECTED, (event: any) => {
|
|
123
|
+
if (event.data?.leaks?.includes(this._id)) {
|
|
124
|
+
console.warn(
|
|
125
|
+
`Potential memory leak detected in SecureArray ${this._id}`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Initialize secure buffer pool
|
|
132
|
+
this.initializeSecureBufferPool();
|
|
133
|
+
|
|
134
|
+
// Set initial data
|
|
135
|
+
if (initialData) {
|
|
136
|
+
this.pushAll(initialData);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
this.eventManager.emit("created", -1, undefined, { id: this._id });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// ===== MEMORY MANAGEMENT =====
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Initialize secure buffer pool for efficient memory reuse
|
|
146
|
+
*/
|
|
147
|
+
private initializeSecureBufferPool(): void {
|
|
148
|
+
if (!this.secureBufferPool) {
|
|
149
|
+
try {
|
|
150
|
+
this.secureBufferPool =
|
|
151
|
+
memoryManager.getPool("secure-array-buffer-pool") ||
|
|
152
|
+
memoryManager.createPool({
|
|
153
|
+
name: "secure-array-buffer-pool",
|
|
154
|
+
factory: () => new Uint8Array(1024), // 1KB buffers
|
|
155
|
+
reset: (buffer: any) => {
|
|
156
|
+
// Secure wipe before reuse
|
|
157
|
+
this.secureWipe(buffer);
|
|
158
|
+
},
|
|
159
|
+
capacity: 50,
|
|
160
|
+
strategy: "LRU" as any,
|
|
161
|
+
validator: (buffer: any) =>
|
|
162
|
+
buffer instanceof Uint8Array,
|
|
163
|
+
});
|
|
164
|
+
} catch (error) {
|
|
165
|
+
// Pool might already exist, try to get it
|
|
166
|
+
this.secureBufferPool = memoryManager.getPool(
|
|
167
|
+
"secure-array-buffer-pool"
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Handle memory pressure by cleaning up unused resources
|
|
175
|
+
*/
|
|
176
|
+
private handleMemoryPressure(): void {
|
|
177
|
+
// Clean up unused secure buffers
|
|
178
|
+
for (const [index, buffer] of this.secureBuffers.entries()) {
|
|
179
|
+
if (index >= this.elements.length) {
|
|
180
|
+
buffer.destroy();
|
|
181
|
+
this.secureBuffers.delete(index);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Clear old snapshots (keep only the latest 3)
|
|
186
|
+
const sortedSnapshots = Array.from(this.snapshots.entries()).sort(
|
|
187
|
+
([, a], [, b]) => b.timestamp - a.timestamp
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
if (sortedSnapshots.length > 3) {
|
|
191
|
+
for (let i = 3; i < sortedSnapshots.length; i++) {
|
|
192
|
+
this.snapshots.delete(sortedSnapshots[i][0]);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Trigger garbage collection if available
|
|
197
|
+
if (global.gc) {
|
|
198
|
+
global.gc();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
this.eventManager.emit("gc", -1, undefined, {
|
|
202
|
+
operation: "memory_pressure_cleanup",
|
|
203
|
+
buffersCleared: this.secureBuffers.size,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Secure wipe of buffer contents
|
|
209
|
+
*/
|
|
210
|
+
private secureWipe(buffer: Uint8Array): void {
|
|
211
|
+
return XyPriss.secureWipe(buffer);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// ===== UTILITY METHODS =====
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Ensures the array is not destroyed
|
|
218
|
+
*/
|
|
219
|
+
private ensureNotDestroyed(): void {
|
|
220
|
+
if (this._isDestroyed) {
|
|
221
|
+
console.error("Array has been destroyed and cannot be used.");
|
|
222
|
+
throw new Error("Cannot use destroyed fortified Array. ");
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Ensures the array is not read-only
|
|
228
|
+
*/
|
|
229
|
+
private ensureNotReadOnly(): void {
|
|
230
|
+
if (this._isReadOnly) {
|
|
231
|
+
throw new Error("SecureArray is read-only");
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Ensures the array is not frozen
|
|
237
|
+
*/
|
|
238
|
+
private ensureNotFrozen(): void {
|
|
239
|
+
if (this._isFrozen) {
|
|
240
|
+
throw new Error("SecureArray is frozen");
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Check if adding elements would exceed max size
|
|
246
|
+
*/
|
|
247
|
+
private checkSizeLimit(additionalElements: number = 1): void {
|
|
248
|
+
if (
|
|
249
|
+
this._maxSize &&
|
|
250
|
+
this.elements.length + additionalElements > this._maxSize
|
|
251
|
+
) {
|
|
252
|
+
throw new Error(
|
|
253
|
+
`Operation would exceed maximum size limit of ${this._maxSize}`
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Updates the last modified timestamp and version
|
|
260
|
+
*/
|
|
261
|
+
private updateLastModified(): void {
|
|
262
|
+
this._lastModified = Date.now();
|
|
263
|
+
this._version++;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Validates an index
|
|
268
|
+
*/
|
|
269
|
+
private validateIndex(index: number): void {
|
|
270
|
+
if (this.options.enableIndexValidation) {
|
|
271
|
+
if (!Number.isInteger(index) || index < 0) {
|
|
272
|
+
throw new Error(`Invalid index: ${index}`);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Validates a value
|
|
279
|
+
*/
|
|
280
|
+
private validateValue(value: T): void {
|
|
281
|
+
if (this.options.enableTypeValidation) {
|
|
282
|
+
ArrayValidationUtils.validateSecureArrayValue(value);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// ===== CORE ARRAY OPERATIONS =====
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Gets the length of the array
|
|
290
|
+
*/
|
|
291
|
+
public get length(): number {
|
|
292
|
+
this.ensureNotDestroyed();
|
|
293
|
+
return this.elements.length;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Gets the unique identifier of this array
|
|
298
|
+
*/
|
|
299
|
+
public get id(): string {
|
|
300
|
+
return this._id;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Gets the version number (increments on each mutation)
|
|
305
|
+
*/
|
|
306
|
+
public get version(): number {
|
|
307
|
+
return this._version;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Gets when the array was last modified
|
|
312
|
+
*/
|
|
313
|
+
public get lastModified(): number {
|
|
314
|
+
return this._lastModified;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Gets when the array was created
|
|
319
|
+
*/
|
|
320
|
+
public get createdAt(): number {
|
|
321
|
+
return this._createdAt;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Check if the array is empty
|
|
326
|
+
*/
|
|
327
|
+
public get isEmpty(): boolean {
|
|
328
|
+
return this.elements.length === 0;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Check if the array is read-only
|
|
333
|
+
*/
|
|
334
|
+
public get isReadOnly(): boolean {
|
|
335
|
+
return this._isReadOnly;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Check if the array is frozen
|
|
340
|
+
*/
|
|
341
|
+
public get isFrozen(): boolean {
|
|
342
|
+
return this._isFrozen;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Check if the array is destroyed
|
|
347
|
+
*/
|
|
348
|
+
public get isDestroyed(): boolean {
|
|
349
|
+
return this._isDestroyed;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Gets an element at the specified index with automatic decryption
|
|
354
|
+
*/
|
|
355
|
+
public get(index: number): T | undefined {
|
|
356
|
+
this.ensureNotDestroyed();
|
|
357
|
+
this.validateIndex(index);
|
|
358
|
+
|
|
359
|
+
if (index >= this.elements.length) {
|
|
360
|
+
return undefined;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const value = this.elements[index];
|
|
364
|
+
|
|
365
|
+
// Update access metadata
|
|
366
|
+
if (this.metadataManager.has(index)) {
|
|
367
|
+
const metadata = this.metadataManager.get(index)!;
|
|
368
|
+
this.metadataManager.update(
|
|
369
|
+
index,
|
|
370
|
+
metadata.type,
|
|
371
|
+
metadata.isSecure,
|
|
372
|
+
true
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Check if value is encrypted (starts with [ENCRYPTED:)
|
|
377
|
+
if (
|
|
378
|
+
typeof value === "string" &&
|
|
379
|
+
this.cryptoHandler.isEncrypted(value)
|
|
380
|
+
) {
|
|
381
|
+
try {
|
|
382
|
+
// Decrypt the value automatically
|
|
383
|
+
const decryptedValue = this.cryptoHandler.decryptValue(value);
|
|
384
|
+
this.eventManager.emit("get", index, decryptedValue);
|
|
385
|
+
return decryptedValue as T;
|
|
386
|
+
} catch (error) {
|
|
387
|
+
console.error(
|
|
388
|
+
`Failed to decrypt value at index ${index}:`,
|
|
389
|
+
error
|
|
390
|
+
);
|
|
391
|
+
// Return the encrypted value if decryption fails
|
|
392
|
+
this.eventManager.emit("get", index, value);
|
|
393
|
+
return value;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// Convert SecureBuffer back to original type based on metadata
|
|
398
|
+
if (value instanceof SecureBuffer) {
|
|
399
|
+
const metadata = this.metadataManager.get(index);
|
|
400
|
+
if (metadata?.type === "string") {
|
|
401
|
+
// Convert SecureBuffer back to string
|
|
402
|
+
const buffer = value.getBuffer();
|
|
403
|
+
const result = new TextDecoder().decode(buffer) as unknown as T;
|
|
404
|
+
this.eventManager.emit("get", index, result);
|
|
405
|
+
return result;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
this.eventManager.emit("get", index, value);
|
|
410
|
+
return value;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Gets element at index with bounds checking
|
|
415
|
+
*/
|
|
416
|
+
public at(index: number): T | undefined {
|
|
417
|
+
this.ensureNotDestroyed();
|
|
418
|
+
|
|
419
|
+
// Handle negative indices
|
|
420
|
+
if (index < 0) {
|
|
421
|
+
index = this.elements.length + index;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return this.get(index);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Sets an element at the specified index
|
|
429
|
+
*/
|
|
430
|
+
public set(index: number, value: T): this {
|
|
431
|
+
this.ensureNotDestroyed();
|
|
432
|
+
this.ensureNotReadOnly();
|
|
433
|
+
this.ensureNotFrozen();
|
|
434
|
+
this.validateIndex(index);
|
|
435
|
+
this.validateValue(value);
|
|
436
|
+
|
|
437
|
+
// Check size limit for new indices
|
|
438
|
+
if (index >= this.elements.length) {
|
|
439
|
+
this.checkSizeLimit(index - this.elements.length + 1);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Extend array if necessary
|
|
443
|
+
while (index >= this.elements.length) {
|
|
444
|
+
this.elements.push(undefined as any);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// Clean up any existing secure buffer for this index
|
|
448
|
+
this.cleanupIndex(index);
|
|
449
|
+
|
|
450
|
+
// Handle secure storage for strings
|
|
451
|
+
if (typeof value === "string") {
|
|
452
|
+
const secureBuffer = SecureBuffer.from(value);
|
|
453
|
+
this.secureBuffers.set(index, secureBuffer);
|
|
454
|
+
this.elements[index] = secureBuffer as any;
|
|
455
|
+
this.metadataManager.update(index, "string", true);
|
|
456
|
+
} else {
|
|
457
|
+
this.elements[index] = value;
|
|
458
|
+
this.metadataManager.update(index, typeof value, false);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
this.updateLastModified();
|
|
462
|
+
this.eventManager.emit("set", index, value);
|
|
463
|
+
return this;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Cleans up resources associated with an index
|
|
468
|
+
*/
|
|
469
|
+
private cleanupIndex(index: number): void {
|
|
470
|
+
if (this.secureBuffers.has(index)) {
|
|
471
|
+
this.secureBuffers.get(index)?.destroy();
|
|
472
|
+
this.secureBuffers.delete(index);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Adds an element to the end of the array
|
|
478
|
+
*/
|
|
479
|
+
public push(value: T): number {
|
|
480
|
+
this.ensureNotDestroyed();
|
|
481
|
+
this.ensureNotReadOnly();
|
|
482
|
+
this.ensureNotFrozen();
|
|
483
|
+
this.validateValue(value);
|
|
484
|
+
this.checkSizeLimit(1);
|
|
485
|
+
|
|
486
|
+
const index = this.elements.length;
|
|
487
|
+
|
|
488
|
+
// Handle secure storage for strings
|
|
489
|
+
if (typeof value === "string") {
|
|
490
|
+
const secureBuffer = SecureBuffer.from(value);
|
|
491
|
+
this.secureBuffers.set(index, secureBuffer);
|
|
492
|
+
this.elements.push(secureBuffer as any);
|
|
493
|
+
this.metadataManager.update(index, "string", true);
|
|
494
|
+
} else {
|
|
495
|
+
this.elements.push(value);
|
|
496
|
+
this.metadataManager.update(index, typeof value, false);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
this.updateLastModified();
|
|
500
|
+
this.eventManager.emit("push", index, value);
|
|
501
|
+
return this.elements.length;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Removes and returns the last element
|
|
506
|
+
*/
|
|
507
|
+
public pop(): T | undefined {
|
|
508
|
+
this.ensureNotDestroyed();
|
|
509
|
+
this.ensureNotReadOnly();
|
|
510
|
+
this.ensureNotFrozen();
|
|
511
|
+
|
|
512
|
+
if (this.elements.length === 0) {
|
|
513
|
+
return undefined;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
const index = this.elements.length - 1;
|
|
517
|
+
const value = this.get(index);
|
|
518
|
+
|
|
519
|
+
// Clean up resources
|
|
520
|
+
this.cleanupIndex(index);
|
|
521
|
+
this.elements.pop();
|
|
522
|
+
this.metadataManager.delete(index);
|
|
523
|
+
|
|
524
|
+
this.updateLastModified();
|
|
525
|
+
this.eventManager.emit("pop", index, value);
|
|
526
|
+
return value;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Removes and returns the first element
|
|
531
|
+
*/
|
|
532
|
+
public shift(): T | undefined {
|
|
533
|
+
this.ensureNotDestroyed();
|
|
534
|
+
this.ensureNotReadOnly();
|
|
535
|
+
this.ensureNotFrozen();
|
|
536
|
+
|
|
537
|
+
if (this.elements.length === 0) {
|
|
538
|
+
return undefined;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
const value = this.get(0);
|
|
542
|
+
|
|
543
|
+
// Clean up resources for index 0
|
|
544
|
+
this.cleanupIndex(0);
|
|
545
|
+
this.elements.shift();
|
|
546
|
+
|
|
547
|
+
// Shift all metadata indices down by 1
|
|
548
|
+
this.metadataManager.shiftIndices(0, -1);
|
|
549
|
+
|
|
550
|
+
// Shift all secure buffer indices down by 1
|
|
551
|
+
const newSecureBuffers = new Map<number, SecureBuffer>();
|
|
552
|
+
for (const [index, buffer] of this.secureBuffers.entries()) {
|
|
553
|
+
if (index > 0) {
|
|
554
|
+
newSecureBuffers.set(index - 1, buffer);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
this.secureBuffers = newSecureBuffers;
|
|
558
|
+
|
|
559
|
+
this.updateLastModified();
|
|
560
|
+
this.eventManager.emit("shift", 0, value);
|
|
561
|
+
return value;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Adds elements to the beginning of the array
|
|
566
|
+
*/
|
|
567
|
+
public unshift(...values: T[]): number {
|
|
568
|
+
this.ensureNotDestroyed();
|
|
569
|
+
this.ensureNotReadOnly();
|
|
570
|
+
this.ensureNotFrozen();
|
|
571
|
+
this.checkSizeLimit(values.length);
|
|
572
|
+
|
|
573
|
+
for (const value of values) {
|
|
574
|
+
this.validateValue(value);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// Shift existing secure buffers and metadata
|
|
578
|
+
const shiftAmount = values.length;
|
|
579
|
+
this.metadataManager.shiftIndices(0, shiftAmount);
|
|
580
|
+
|
|
581
|
+
const newSecureBuffers = new Map<number, SecureBuffer>();
|
|
582
|
+
for (const [index, buffer] of this.secureBuffers.entries()) {
|
|
583
|
+
newSecureBuffers.set(index + shiftAmount, buffer);
|
|
584
|
+
}
|
|
585
|
+
this.secureBuffers = newSecureBuffers;
|
|
586
|
+
|
|
587
|
+
// Add new values at the beginning
|
|
588
|
+
for (let i = 0; i < values.length; i++) {
|
|
589
|
+
const value = values[i];
|
|
590
|
+
|
|
591
|
+
if (typeof value === "string") {
|
|
592
|
+
const secureBuffer = SecureBuffer.from(value);
|
|
593
|
+
this.secureBuffers.set(i, secureBuffer);
|
|
594
|
+
this.metadataManager.update(i, "string", true);
|
|
595
|
+
} else {
|
|
596
|
+
this.metadataManager.update(i, typeof value, false);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
this.elements.unshift(...values);
|
|
601
|
+
this.updateLastModified();
|
|
602
|
+
this.eventManager.emit("unshift", 0, values);
|
|
603
|
+
return this.elements.length;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Adds multiple elements to the array
|
|
608
|
+
*/
|
|
609
|
+
public pushAll(values: T[]): number {
|
|
610
|
+
this.ensureNotDestroyed();
|
|
611
|
+
this.ensureNotReadOnly();
|
|
612
|
+
this.ensureNotFrozen();
|
|
613
|
+
this.checkSizeLimit(values.length);
|
|
614
|
+
|
|
615
|
+
for (const value of values) {
|
|
616
|
+
this.push(value);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
return this.elements.length;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// ===== ENHANCED ARRAY METHODS =====
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Removes elements from array and optionally inserts new elements
|
|
626
|
+
*/
|
|
627
|
+
public splice(
|
|
628
|
+
start: number,
|
|
629
|
+
deleteCount?: number,
|
|
630
|
+
...items: T[]
|
|
631
|
+
): SecureArray<T> {
|
|
632
|
+
this.ensureNotDestroyed();
|
|
633
|
+
this.ensureNotReadOnly();
|
|
634
|
+
this.ensureNotFrozen();
|
|
635
|
+
|
|
636
|
+
if (start < 0) {
|
|
637
|
+
start = Math.max(0, this.elements.length + start);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
deleteCount =
|
|
641
|
+
deleteCount === undefined
|
|
642
|
+
? this.elements.length - start
|
|
643
|
+
: Math.max(0, deleteCount);
|
|
644
|
+
|
|
645
|
+
if (items.length > 0) {
|
|
646
|
+
this.checkSizeLimit(items.length - deleteCount);
|
|
647
|
+
for (const item of items) {
|
|
648
|
+
this.validateValue(item);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// Create a new SecureArray for removed elements
|
|
653
|
+
const removedElements = new SecureArray<T>();
|
|
654
|
+
|
|
655
|
+
// Get elements to be removed
|
|
656
|
+
for (
|
|
657
|
+
let i = start;
|
|
658
|
+
i < start + deleteCount && i < this.elements.length;
|
|
659
|
+
i++
|
|
660
|
+
) {
|
|
661
|
+
const value = this.get(i);
|
|
662
|
+
if (value !== undefined) {
|
|
663
|
+
removedElements.push(value);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// Clean up secure buffers for removed elements
|
|
668
|
+
for (let i = start; i < start + deleteCount; i++) {
|
|
669
|
+
this.cleanupIndex(i);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// Perform the splice operation
|
|
673
|
+
const removed = this.elements.splice(start, deleteCount, ...items);
|
|
674
|
+
|
|
675
|
+
// Update metadata and secure buffers
|
|
676
|
+
this.metadataManager.splice(start, deleteCount, items.length);
|
|
677
|
+
|
|
678
|
+
// Handle secure storage for new items
|
|
679
|
+
for (let i = 0; i < items.length; i++) {
|
|
680
|
+
const value = items[i];
|
|
681
|
+
const index = start + i;
|
|
682
|
+
|
|
683
|
+
if (typeof value === "string") {
|
|
684
|
+
const secureBuffer = SecureBuffer.from(value);
|
|
685
|
+
this.secureBuffers.set(index, secureBuffer);
|
|
686
|
+
this.metadataManager.update(index, "string", true);
|
|
687
|
+
} else {
|
|
688
|
+
this.metadataManager.update(index, typeof value, false);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
this.updateLastModified();
|
|
693
|
+
this.eventManager.emit("splice", start, { removed, added: items });
|
|
694
|
+
|
|
695
|
+
return removedElements;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Returns a shallow copy of a portion of the array
|
|
700
|
+
*/
|
|
701
|
+
public slice(start?: number, end?: number): SecureArray<T> {
|
|
702
|
+
this.ensureNotDestroyed();
|
|
703
|
+
|
|
704
|
+
const slicedElements: T[] = [];
|
|
705
|
+
const actualStart =
|
|
706
|
+
start === undefined
|
|
707
|
+
? 0
|
|
708
|
+
: start < 0
|
|
709
|
+
? Math.max(0, this.elements.length + start)
|
|
710
|
+
: start;
|
|
711
|
+
const actualEnd =
|
|
712
|
+
end === undefined
|
|
713
|
+
? this.elements.length
|
|
714
|
+
: end < 0
|
|
715
|
+
? this.elements.length + end
|
|
716
|
+
: end;
|
|
717
|
+
|
|
718
|
+
for (
|
|
719
|
+
let i = actualStart;
|
|
720
|
+
i < actualEnd && i < this.elements.length;
|
|
721
|
+
i++
|
|
722
|
+
) {
|
|
723
|
+
const value = this.get(i);
|
|
724
|
+
if (value !== undefined) {
|
|
725
|
+
slicedElements.push(value);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
const newArray = new SecureArray<T>(slicedElements, {
|
|
730
|
+
...this.options,
|
|
731
|
+
});
|
|
732
|
+
this.eventManager.emit("slice", actualStart, {
|
|
733
|
+
start: actualStart,
|
|
734
|
+
end: actualEnd,
|
|
735
|
+
result: newArray,
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
return newArray;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Concatenates arrays and returns a new SecureArray
|
|
743
|
+
*/
|
|
744
|
+
public concat(...arrays: (T[] | SecureArray<T>)[]): SecureArray<T> {
|
|
745
|
+
this.ensureNotDestroyed();
|
|
746
|
+
|
|
747
|
+
const newElements: T[] = [];
|
|
748
|
+
|
|
749
|
+
// Add current array elements
|
|
750
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
751
|
+
const value = this.get(i);
|
|
752
|
+
if (value !== undefined) {
|
|
753
|
+
newElements.push(value);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// Add elements from other arrays
|
|
758
|
+
for (const arr of arrays) {
|
|
759
|
+
if (arr instanceof SecureArray) {
|
|
760
|
+
for (let i = 0; i < arr.length; i++) {
|
|
761
|
+
const value = arr.get(i);
|
|
762
|
+
if (value !== undefined) {
|
|
763
|
+
newElements.push(value);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
} else {
|
|
767
|
+
newElements.push(...arr);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
return new SecureArray<T>(newElements, { ...this.options });
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Joins all elements into a string
|
|
776
|
+
*/
|
|
777
|
+
public join(separator: string = ","): string {
|
|
778
|
+
this.ensureNotDestroyed();
|
|
779
|
+
|
|
780
|
+
const stringElements: string[] = [];
|
|
781
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
782
|
+
const value = this.get(i);
|
|
783
|
+
stringElements.push(value?.toString() ?? "");
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
return stringElements.join(separator);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Reverses the array in place
|
|
791
|
+
*/
|
|
792
|
+
public reverse(): this {
|
|
793
|
+
this.ensureNotDestroyed();
|
|
794
|
+
this.ensureNotReadOnly();
|
|
795
|
+
this.ensureNotFrozen();
|
|
796
|
+
|
|
797
|
+
// Create new mappings for secure buffers
|
|
798
|
+
const newSecureBuffers = new Map<number, SecureBuffer>();
|
|
799
|
+
const length = this.elements.length;
|
|
800
|
+
|
|
801
|
+
for (const [index, buffer] of this.secureBuffers.entries()) {
|
|
802
|
+
newSecureBuffers.set(length - 1 - index, buffer);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
this.secureBuffers = newSecureBuffers;
|
|
806
|
+
this.elements.reverse();
|
|
807
|
+
this.metadataManager.reverse(length);
|
|
808
|
+
|
|
809
|
+
this.updateLastModified();
|
|
810
|
+
this.eventManager.emit("reverse", -1, undefined);
|
|
811
|
+
|
|
812
|
+
return this;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Sorts the array in place
|
|
817
|
+
*/
|
|
818
|
+
public sort(compareFn?: ComparatorFn<T>): this {
|
|
819
|
+
this.ensureNotDestroyed();
|
|
820
|
+
this.ensureNotReadOnly();
|
|
821
|
+
this.ensureNotFrozen();
|
|
822
|
+
|
|
823
|
+
// Get actual values for sorting
|
|
824
|
+
const indexValuePairs: Array<{ index: number; value: T }> = [];
|
|
825
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
826
|
+
const value = this.get(i);
|
|
827
|
+
if (value !== undefined) {
|
|
828
|
+
indexValuePairs.push({ index: i, value });
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// Sort the pairs
|
|
833
|
+
indexValuePairs.sort((a, b) => {
|
|
834
|
+
if (compareFn) {
|
|
835
|
+
return compareFn(a.value, b.value);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
const aStr = String(a.value);
|
|
839
|
+
const bStr = String(b.value);
|
|
840
|
+
return aStr < bStr ? -1 : aStr > bStr ? 1 : 0;
|
|
841
|
+
});
|
|
842
|
+
|
|
843
|
+
// Rebuild the array in sorted order
|
|
844
|
+
const newElements: T[] = [];
|
|
845
|
+
const newSecureBuffers = new Map<number, SecureBuffer>();
|
|
846
|
+
|
|
847
|
+
for (let i = 0; i < indexValuePairs.length; i++) {
|
|
848
|
+
const { index: oldIndex, value } = indexValuePairs[i];
|
|
849
|
+
newElements[i] = this.elements[oldIndex];
|
|
850
|
+
|
|
851
|
+
if (this.secureBuffers.has(oldIndex)) {
|
|
852
|
+
newSecureBuffers.set(i, this.secureBuffers.get(oldIndex)!);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
this.elements = newElements;
|
|
857
|
+
this.secureBuffers = newSecureBuffers;
|
|
858
|
+
this.metadataManager.reorder(indexValuePairs.map((p) => p.index));
|
|
859
|
+
|
|
860
|
+
this.updateLastModified();
|
|
861
|
+
this.eventManager.emit("sort", -1, undefined);
|
|
862
|
+
|
|
863
|
+
return this;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// ===== FUNCTIONAL PROGRAMMING METHODS =====
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Calls a function for each element
|
|
870
|
+
*/
|
|
871
|
+
public forEach(
|
|
872
|
+
callback: (value: T, index: number, array: SecureArray<T>) => void,
|
|
873
|
+
thisArg?: any
|
|
874
|
+
): void {
|
|
875
|
+
this.ensureNotDestroyed();
|
|
876
|
+
|
|
877
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
878
|
+
const value = this.get(i);
|
|
879
|
+
if (value !== undefined) {
|
|
880
|
+
callback.call(thisArg, value, i, this);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Creates a new array with results of calling a function for every element
|
|
887
|
+
*/
|
|
888
|
+
public map<U extends SecureArrayValue>(
|
|
889
|
+
callback: MapperFn<T, U>,
|
|
890
|
+
thisArg?: any
|
|
891
|
+
): SecureArray<U> {
|
|
892
|
+
this.ensureNotDestroyed();
|
|
893
|
+
|
|
894
|
+
const mappedElements: U[] = [];
|
|
895
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
896
|
+
const value = this.get(i);
|
|
897
|
+
if (value !== undefined) {
|
|
898
|
+
mappedElements.push(callback.call(thisArg, value, i, this));
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
return new SecureArray<U>(mappedElements, { ...this.options });
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Creates a new array with elements that pass a test
|
|
907
|
+
*/
|
|
908
|
+
public filter(predicate: PredicateFn<T>, thisArg?: any): SecureArray<T> {
|
|
909
|
+
this.ensureNotDestroyed();
|
|
910
|
+
|
|
911
|
+
const filteredElements: T[] = [];
|
|
912
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
913
|
+
const value = this.get(i);
|
|
914
|
+
if (
|
|
915
|
+
value !== undefined &&
|
|
916
|
+
predicate.call(thisArg, value, i, this)
|
|
917
|
+
) {
|
|
918
|
+
filteredElements.push(value);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
return new SecureArray<T>(filteredElements, { ...this.options });
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Reduces the array to a single value
|
|
927
|
+
*/
|
|
928
|
+
public reduce<U>(callback: ReducerFn<T, U>, initialValue?: U): U {
|
|
929
|
+
this.ensureNotDestroyed();
|
|
930
|
+
|
|
931
|
+
let accumulator = initialValue;
|
|
932
|
+
let startIndex = 0;
|
|
933
|
+
|
|
934
|
+
if (accumulator === undefined) {
|
|
935
|
+
if (this.elements.length === 0) {
|
|
936
|
+
throw new TypeError(
|
|
937
|
+
"Reduce of empty array with no initial value"
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
accumulator = this.get(0) as unknown as U;
|
|
941
|
+
startIndex = 1;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
for (let i = startIndex; i < this.elements.length; i++) {
|
|
945
|
+
const value = this.get(i);
|
|
946
|
+
if (value !== undefined) {
|
|
947
|
+
accumulator = callback(accumulator!, value, i, this);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
return accumulator!;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Tests whether at least one element passes the test
|
|
956
|
+
*/
|
|
957
|
+
public some(predicate: PredicateFn<T>, thisArg?: any): boolean {
|
|
958
|
+
this.ensureNotDestroyed();
|
|
959
|
+
|
|
960
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
961
|
+
const value = this.get(i);
|
|
962
|
+
if (
|
|
963
|
+
value !== undefined &&
|
|
964
|
+
predicate.call(thisArg, value, i, this)
|
|
965
|
+
) {
|
|
966
|
+
return true;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
return false;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Tests whether all elements pass the test
|
|
975
|
+
*/
|
|
976
|
+
public every(predicate: PredicateFn<T>, thisArg?: any): boolean {
|
|
977
|
+
this.ensureNotDestroyed();
|
|
978
|
+
|
|
979
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
980
|
+
const value = this.get(i);
|
|
981
|
+
if (
|
|
982
|
+
value !== undefined &&
|
|
983
|
+
!predicate.call(thisArg, value, i, this)
|
|
984
|
+
) {
|
|
985
|
+
return false;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
return true;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Finds the first element that satisfies the predicate
|
|
994
|
+
*/
|
|
995
|
+
public find(predicate: PredicateFn<T>, thisArg?: any): T | undefined {
|
|
996
|
+
this.ensureNotDestroyed();
|
|
997
|
+
|
|
998
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
999
|
+
const value = this.get(i);
|
|
1000
|
+
if (
|
|
1001
|
+
value !== undefined &&
|
|
1002
|
+
predicate.call(thisArg, value, i, this)
|
|
1003
|
+
) {
|
|
1004
|
+
return value;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
return undefined;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* Finds the index of the first element that satisfies the predicate
|
|
1013
|
+
*/
|
|
1014
|
+
public findIndex(predicate: PredicateFn<T>, thisArg?: any): number {
|
|
1015
|
+
this.ensureNotDestroyed();
|
|
1016
|
+
|
|
1017
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1018
|
+
const value = this.get(i);
|
|
1019
|
+
if (
|
|
1020
|
+
value !== undefined &&
|
|
1021
|
+
predicate.call(thisArg, value, i, this)
|
|
1022
|
+
) {
|
|
1023
|
+
return i;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
return -1;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* Finds the last element that satisfies the predicate
|
|
1032
|
+
*/
|
|
1033
|
+
public findLast(predicate: PredicateFn<T>, thisArg?: any): T | undefined {
|
|
1034
|
+
this.ensureNotDestroyed();
|
|
1035
|
+
|
|
1036
|
+
for (let i = this.elements.length - 1; i >= 0; i--) {
|
|
1037
|
+
const value = this.get(i);
|
|
1038
|
+
if (
|
|
1039
|
+
value !== undefined &&
|
|
1040
|
+
predicate.call(thisArg, value, i, this)
|
|
1041
|
+
) {
|
|
1042
|
+
return value;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
return undefined;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Finds the index of the last element that satisfies the predicate
|
|
1051
|
+
*/
|
|
1052
|
+
public findLastIndex(predicate: PredicateFn<T>, thisArg?: any): number {
|
|
1053
|
+
this.ensureNotDestroyed();
|
|
1054
|
+
|
|
1055
|
+
for (let i = this.elements.length - 1; i >= 0; i--) {
|
|
1056
|
+
const value = this.get(i);
|
|
1057
|
+
if (
|
|
1058
|
+
value !== undefined &&
|
|
1059
|
+
predicate.call(thisArg, value, i, this)
|
|
1060
|
+
) {
|
|
1061
|
+
return i;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
return -1;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Returns the first index of an element
|
|
1070
|
+
*/
|
|
1071
|
+
public indexOf(searchElement: T, fromIndex: number = 0): number {
|
|
1072
|
+
this.ensureNotDestroyed();
|
|
1073
|
+
|
|
1074
|
+
const startIndex =
|
|
1075
|
+
fromIndex < 0
|
|
1076
|
+
? Math.max(0, this.elements.length + fromIndex)
|
|
1077
|
+
: fromIndex;
|
|
1078
|
+
|
|
1079
|
+
for (let i = startIndex; i < this.elements.length; i++) {
|
|
1080
|
+
const value = this.get(i);
|
|
1081
|
+
if (value === searchElement) {
|
|
1082
|
+
return i;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
return -1;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* Returns the last index of an element
|
|
1091
|
+
*/
|
|
1092
|
+
public lastIndexOf(searchElement: T, fromIndex?: number): number {
|
|
1093
|
+
this.ensureNotDestroyed();
|
|
1094
|
+
|
|
1095
|
+
const startIndex =
|
|
1096
|
+
fromIndex === undefined
|
|
1097
|
+
? this.elements.length - 1
|
|
1098
|
+
: fromIndex < 0
|
|
1099
|
+
? this.elements.length + fromIndex
|
|
1100
|
+
: fromIndex;
|
|
1101
|
+
|
|
1102
|
+
for (
|
|
1103
|
+
let i = Math.min(startIndex, this.elements.length - 1);
|
|
1104
|
+
i >= 0;
|
|
1105
|
+
i--
|
|
1106
|
+
) {
|
|
1107
|
+
const value = this.get(i);
|
|
1108
|
+
if (value === searchElement) {
|
|
1109
|
+
return i;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
return -1;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* Checks if an element exists in the array
|
|
1118
|
+
*/
|
|
1119
|
+
public includes(searchElement: T, fromIndex: number = 0): boolean {
|
|
1120
|
+
return this.indexOf(searchElement, fromIndex) !== -1;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
// ===== ENHANCED SECURITY METHODS =====
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Creates a snapshot of the current array state
|
|
1127
|
+
*/
|
|
1128
|
+
public createSnapshot(name?: string): string {
|
|
1129
|
+
this.ensureNotDestroyed();
|
|
1130
|
+
|
|
1131
|
+
const snapshotId =
|
|
1132
|
+
name ||
|
|
1133
|
+
`snapshot_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
1134
|
+
|
|
1135
|
+
// Deep copy elements
|
|
1136
|
+
const elementsCopy: T[] = [];
|
|
1137
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1138
|
+
const value = this.get(i);
|
|
1139
|
+
if (value !== undefined) {
|
|
1140
|
+
elementsCopy.push(value);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
// Copy metadata
|
|
1145
|
+
const metadataCopy = new Map(this.metadataManager.getAllMetadata());
|
|
1146
|
+
|
|
1147
|
+
this.snapshots.set(snapshotId, {
|
|
1148
|
+
elements: elementsCopy,
|
|
1149
|
+
metadata: metadataCopy,
|
|
1150
|
+
timestamp: Date.now(),
|
|
1151
|
+
});
|
|
1152
|
+
|
|
1153
|
+
this.eventManager.emit("snapshot_created", -1, undefined, {
|
|
1154
|
+
snapshotId,
|
|
1155
|
+
});
|
|
1156
|
+
return snapshotId;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* Restores the array from a snapshot
|
|
1161
|
+
*/
|
|
1162
|
+
public restoreFromSnapshot(snapshotId: string): boolean {
|
|
1163
|
+
this.ensureNotDestroyed();
|
|
1164
|
+
this.ensureNotReadOnly();
|
|
1165
|
+
this.ensureNotFrozen();
|
|
1166
|
+
|
|
1167
|
+
const snapshot = this.snapshots.get(snapshotId);
|
|
1168
|
+
if (!snapshot) {
|
|
1169
|
+
return false;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
// Clear current state
|
|
1173
|
+
this.clear();
|
|
1174
|
+
|
|
1175
|
+
// Restore from snapshot
|
|
1176
|
+
for (const element of snapshot.elements) {
|
|
1177
|
+
this.push(element);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
this.eventManager.emit("snapshot_restored", -1, undefined, {
|
|
1181
|
+
snapshotId,
|
|
1182
|
+
});
|
|
1183
|
+
return true;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Lists available snapshots
|
|
1188
|
+
*/
|
|
1189
|
+
public listSnapshots(): Array<{ id: string; timestamp: number }> {
|
|
1190
|
+
return Array.from(this.snapshots.entries()).map(([id, snapshot]) => ({
|
|
1191
|
+
id,
|
|
1192
|
+
timestamp: snapshot.timestamp,
|
|
1193
|
+
}));
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* Deletes a snapshot
|
|
1198
|
+
*/
|
|
1199
|
+
public deleteSnapshot(snapshotId: string): boolean {
|
|
1200
|
+
return this.snapshots.delete(snapshotId);
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* Clears all elements from the array
|
|
1205
|
+
*/
|
|
1206
|
+
public clear(): this {
|
|
1207
|
+
this.ensureNotDestroyed();
|
|
1208
|
+
this.ensureNotReadOnly();
|
|
1209
|
+
this.ensureNotFrozen();
|
|
1210
|
+
|
|
1211
|
+
// Clean up all secure buffers
|
|
1212
|
+
for (const buffer of this.secureBuffers.values()) {
|
|
1213
|
+
buffer.destroy();
|
|
1214
|
+
}
|
|
1215
|
+
this.secureBuffers.clear();
|
|
1216
|
+
|
|
1217
|
+
// Clear elements and metadata
|
|
1218
|
+
this.elements.length = 0;
|
|
1219
|
+
this.metadataManager.clear();
|
|
1220
|
+
|
|
1221
|
+
this.updateLastModified();
|
|
1222
|
+
this.eventManager.emit("clear", -1, undefined);
|
|
1223
|
+
|
|
1224
|
+
return this;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* Freezes the array to prevent modifications
|
|
1229
|
+
*/
|
|
1230
|
+
public freeze(): this {
|
|
1231
|
+
this.ensureNotDestroyed();
|
|
1232
|
+
this._isFrozen = true;
|
|
1233
|
+
this.eventManager.emit("freeze", -1, undefined);
|
|
1234
|
+
return this;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* Unfreezes the array to allow modifications
|
|
1239
|
+
*/
|
|
1240
|
+
public unfreeze(): this {
|
|
1241
|
+
this.ensureNotDestroyed();
|
|
1242
|
+
this._isFrozen = false;
|
|
1243
|
+
this.eventManager.emit("unfreeze", -1, undefined);
|
|
1244
|
+
return this;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Makes the array read-only
|
|
1249
|
+
*/
|
|
1250
|
+
public makeReadOnly(): this {
|
|
1251
|
+
this.ensureNotDestroyed();
|
|
1252
|
+
this._isReadOnly = true;
|
|
1253
|
+
this.eventManager.emit("readonly", -1, undefined);
|
|
1254
|
+
return this;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Removes read-only restriction
|
|
1259
|
+
*/
|
|
1260
|
+
public makeWritable(): this {
|
|
1261
|
+
this.ensureNotDestroyed();
|
|
1262
|
+
this._isReadOnly = false;
|
|
1263
|
+
this.eventManager.emit("writable", -1, undefined);
|
|
1264
|
+
return this;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* Securely wipes all data and destroys the array
|
|
1269
|
+
* @example
|
|
1270
|
+
* //===================== correct ===========
|
|
1271
|
+
const x = fArray([] as number[]);
|
|
1272
|
+
x.push(12);
|
|
1273
|
+
|
|
1274
|
+
console.log(x._array);
|
|
1275
|
+
x.destroy();
|
|
1276
|
+
|
|
1277
|
+
//================ incorrect ===============
|
|
1278
|
+
const x = fArray([] as number[]);
|
|
1279
|
+
x.destroy(); // will destroy the array
|
|
1280
|
+
x.push(12); // x.push will throw an error
|
|
1281
|
+
|
|
1282
|
+
console.log(x._array); // will throw an error
|
|
1283
|
+
*/
|
|
1284
|
+
public destroy(): void {
|
|
1285
|
+
if (this._isDestroyed) {
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
// Clean up all secure buffers
|
|
1290
|
+
for (const buffer of this.secureBuffers.values()) {
|
|
1291
|
+
buffer.destroy();
|
|
1292
|
+
}
|
|
1293
|
+
this.secureBuffers.clear();
|
|
1294
|
+
|
|
1295
|
+
// Clear snapshots
|
|
1296
|
+
this.snapshots.clear();
|
|
1297
|
+
|
|
1298
|
+
// Secure wipe of elements array
|
|
1299
|
+
if (this.elements.length > 0) {
|
|
1300
|
+
this.elements.fill(null as any);
|
|
1301
|
+
this.elements.length = 0;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
// Clear metadata
|
|
1305
|
+
this.metadataManager.clear();
|
|
1306
|
+
|
|
1307
|
+
// Unregister from memory manager
|
|
1308
|
+
if (this._memoryTracking) {
|
|
1309
|
+
memoryManager.unregisterObject(this._id);
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
this._isDestroyed = true;
|
|
1313
|
+
this.eventManager.emit("destroyed", -1, undefined);
|
|
1314
|
+
|
|
1315
|
+
// Clear event listeners
|
|
1316
|
+
this.eventManager.removeAllListeners();
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
// ===== UTILITY AND STATISTICS METHODS =====
|
|
1320
|
+
|
|
1321
|
+
/**
|
|
1322
|
+
* Gets comprehensive statistics about the array
|
|
1323
|
+
*/
|
|
1324
|
+
public getStats(): SecureArrayStats {
|
|
1325
|
+
this.ensureNotDestroyed();
|
|
1326
|
+
|
|
1327
|
+
const typeCount = new Map<string, number>();
|
|
1328
|
+
let secureElementCount = 0;
|
|
1329
|
+
let totalMemoryUsage = 0;
|
|
1330
|
+
let totalAccesses = 0;
|
|
1331
|
+
|
|
1332
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1333
|
+
const metadata = this.metadataManager.get(i);
|
|
1334
|
+
if (metadata) {
|
|
1335
|
+
const type = metadata.type;
|
|
1336
|
+
typeCount.set(type, (typeCount.get(type) || 0) + 1);
|
|
1337
|
+
|
|
1338
|
+
if (metadata.isSecure) {
|
|
1339
|
+
secureElementCount++;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
totalAccesses += metadata.accessCount;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
// Estimate memory usage
|
|
1346
|
+
const value = this.get(i);
|
|
1347
|
+
if (value !== undefined) {
|
|
1348
|
+
if (typeof value === "string") {
|
|
1349
|
+
totalMemoryUsage += value.length * 2; // UTF-16
|
|
1350
|
+
} else if (typeof value === "number") {
|
|
1351
|
+
totalMemoryUsage += 8; // 64-bit number
|
|
1352
|
+
} else if (typeof value === "boolean") {
|
|
1353
|
+
totalMemoryUsage += 1;
|
|
1354
|
+
} else {
|
|
1355
|
+
totalMemoryUsage += 64; // Estimate for objects
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
return {
|
|
1361
|
+
length: this.elements.length,
|
|
1362
|
+
secureElements: secureElementCount,
|
|
1363
|
+
totalAccesses,
|
|
1364
|
+
memoryUsage: totalMemoryUsage,
|
|
1365
|
+
lastModified: this._lastModified,
|
|
1366
|
+
version: this._version,
|
|
1367
|
+
createdAt: this._createdAt,
|
|
1368
|
+
isReadOnly: this._isReadOnly,
|
|
1369
|
+
isFrozen: this._isFrozen,
|
|
1370
|
+
typeDistribution: Object.fromEntries(typeCount),
|
|
1371
|
+
secureElementCount,
|
|
1372
|
+
estimatedMemoryUsage: totalMemoryUsage,
|
|
1373
|
+
snapshotCount: this.snapshots.size,
|
|
1374
|
+
encryptionEnabled:
|
|
1375
|
+
this.cryptoHandler.getEncryptionStatus().hasEncryptionKey,
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* Validates the integrity of the array
|
|
1381
|
+
*/
|
|
1382
|
+
public validateIntegrity(): { isValid: boolean; errors: string[] } {
|
|
1383
|
+
this.ensureNotDestroyed();
|
|
1384
|
+
|
|
1385
|
+
const errors: string[] = [];
|
|
1386
|
+
|
|
1387
|
+
// Check if elements length matches metadata count
|
|
1388
|
+
const metadataCount = this.metadataManager.size();
|
|
1389
|
+
if (this.elements.length !== metadataCount) {
|
|
1390
|
+
errors.push(
|
|
1391
|
+
`Element count (${this.elements.length}) doesn't match metadata count (${metadataCount})`
|
|
1392
|
+
);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// Check secure buffer consistency
|
|
1396
|
+
for (const [index, buffer] of this.secureBuffers.entries()) {
|
|
1397
|
+
if (index >= this.elements.length) {
|
|
1398
|
+
errors.push(`Secure buffer exists for invalid index: ${index}`);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
const metadata = this.metadataManager.get(index);
|
|
1402
|
+
if (!metadata || !metadata.isSecure) {
|
|
1403
|
+
errors.push(
|
|
1404
|
+
`Secure buffer exists but metadata indicates non-secure element at index: ${index}`
|
|
1405
|
+
);
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
try {
|
|
1409
|
+
buffer.getBuffer(); // Test if buffer is still valid
|
|
1410
|
+
} catch (error) {
|
|
1411
|
+
errors.push(
|
|
1412
|
+
`Invalid secure buffer at index ${index}: ${error}`
|
|
1413
|
+
);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
// Check for memory leaks in metadata
|
|
1418
|
+
for (let i = 0; i < this.metadataManager.size(); i++) {
|
|
1419
|
+
if (!this.metadataManager.has(i) && i < this.elements.length) {
|
|
1420
|
+
errors.push(`Missing metadata for element at index: ${i}`);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
return {
|
|
1425
|
+
isValid: errors.length === 0,
|
|
1426
|
+
errors,
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Compacts the array by removing undefined/null elements
|
|
1432
|
+
*/
|
|
1433
|
+
public compact(): this {
|
|
1434
|
+
this.ensureNotDestroyed();
|
|
1435
|
+
this.ensureNotReadOnly();
|
|
1436
|
+
this.ensureNotFrozen();
|
|
1437
|
+
|
|
1438
|
+
const compactedElements: T[] = [];
|
|
1439
|
+
const newSecureBuffers = new Map<number, SecureBuffer>();
|
|
1440
|
+
let newIndex = 0;
|
|
1441
|
+
|
|
1442
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1443
|
+
const value = this.get(i);
|
|
1444
|
+
if (value !== null && value !== undefined) {
|
|
1445
|
+
compactedElements.push(this.elements[i]);
|
|
1446
|
+
|
|
1447
|
+
if (this.secureBuffers.has(i)) {
|
|
1448
|
+
newSecureBuffers.set(newIndex, this.secureBuffers.get(i)!);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
const metadata = this.metadataManager.get(i);
|
|
1452
|
+
if (metadata) {
|
|
1453
|
+
this.metadataManager.update(
|
|
1454
|
+
newIndex,
|
|
1455
|
+
metadata.type,
|
|
1456
|
+
metadata.isSecure
|
|
1457
|
+
);
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
newIndex++;
|
|
1461
|
+
} else {
|
|
1462
|
+
// Clean up secure buffer for removed element
|
|
1463
|
+
this.cleanupIndex(i);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
// Clean up old metadata
|
|
1468
|
+
this.metadataManager.clear();
|
|
1469
|
+
|
|
1470
|
+
this.elements = compactedElements;
|
|
1471
|
+
this.secureBuffers = newSecureBuffers;
|
|
1472
|
+
|
|
1473
|
+
this.updateLastModified();
|
|
1474
|
+
this.eventManager.emit("compact", -1, undefined, {
|
|
1475
|
+
originalLength:
|
|
1476
|
+
this.elements.length +
|
|
1477
|
+
(this.elements.length - compactedElements.length),
|
|
1478
|
+
newLength: compactedElements.length,
|
|
1479
|
+
});
|
|
1480
|
+
|
|
1481
|
+
return this;
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* Removes duplicate elements
|
|
1486
|
+
*/
|
|
1487
|
+
public unique(): this {
|
|
1488
|
+
this.ensureNotDestroyed();
|
|
1489
|
+
this.ensureNotReadOnly();
|
|
1490
|
+
this.ensureNotFrozen();
|
|
1491
|
+
|
|
1492
|
+
const seen = new Set<T>();
|
|
1493
|
+
const uniqueElements: T[] = [];
|
|
1494
|
+
const newSecureBuffers = new Map<number, SecureBuffer>();
|
|
1495
|
+
let newIndex = 0;
|
|
1496
|
+
|
|
1497
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1498
|
+
const value = this.get(i);
|
|
1499
|
+
if (value !== undefined && !seen.has(value)) {
|
|
1500
|
+
seen.add(value);
|
|
1501
|
+
uniqueElements.push(this.elements[i]);
|
|
1502
|
+
|
|
1503
|
+
if (this.secureBuffers.has(i)) {
|
|
1504
|
+
newSecureBuffers.set(newIndex, this.secureBuffers.get(i)!);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
const metadata = this.metadataManager.get(i);
|
|
1508
|
+
if (metadata) {
|
|
1509
|
+
this.metadataManager.update(
|
|
1510
|
+
newIndex,
|
|
1511
|
+
metadata.type,
|
|
1512
|
+
metadata.isSecure
|
|
1513
|
+
);
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
newIndex++;
|
|
1517
|
+
} else if (value !== undefined) {
|
|
1518
|
+
// Clean up duplicate's secure buffer
|
|
1519
|
+
this.cleanupIndex(i);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
// Clean up old metadata
|
|
1524
|
+
this.metadataManager.clear();
|
|
1525
|
+
|
|
1526
|
+
this.elements = uniqueElements;
|
|
1527
|
+
this.secureBuffers = newSecureBuffers;
|
|
1528
|
+
|
|
1529
|
+
this.updateLastModified();
|
|
1530
|
+
this.eventManager.emit("unique", -1, undefined, {
|
|
1531
|
+
originalLength:
|
|
1532
|
+
this.elements.length +
|
|
1533
|
+
(this.elements.length - uniqueElements.length),
|
|
1534
|
+
newLength: uniqueElements.length,
|
|
1535
|
+
});
|
|
1536
|
+
|
|
1537
|
+
return this;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
/**
|
|
1541
|
+
* Groups elements by a key function
|
|
1542
|
+
*/
|
|
1543
|
+
public groupBy<K extends string | number>(
|
|
1544
|
+
keyFn: (value: T, index: number) => K
|
|
1545
|
+
): Map<K, SecureArray<T>> {
|
|
1546
|
+
this.ensureNotDestroyed();
|
|
1547
|
+
|
|
1548
|
+
const groups = new Map<K, SecureArray<T>>();
|
|
1549
|
+
|
|
1550
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1551
|
+
const value = this.get(i);
|
|
1552
|
+
if (value !== undefined) {
|
|
1553
|
+
const key = keyFn(value, i);
|
|
1554
|
+
|
|
1555
|
+
if (!groups.has(key)) {
|
|
1556
|
+
groups.set(
|
|
1557
|
+
key,
|
|
1558
|
+
new SecureArray<T>([], { ...this.options })
|
|
1559
|
+
);
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
groups.get(key)!.push(value);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
return groups;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* Returns the minimum value
|
|
1571
|
+
*/
|
|
1572
|
+
public min(compareFn?: ComparatorFn<T>): T | undefined {
|
|
1573
|
+
this.ensureNotDestroyed();
|
|
1574
|
+
|
|
1575
|
+
if (this.elements.length === 0) {
|
|
1576
|
+
return undefined;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
let min = this.get(0);
|
|
1580
|
+
if (min === undefined) {
|
|
1581
|
+
return undefined;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
for (let i = 1; i < this.elements.length; i++) {
|
|
1585
|
+
const value = this.get(i);
|
|
1586
|
+
if (value !== undefined) {
|
|
1587
|
+
if (compareFn) {
|
|
1588
|
+
if (compareFn(value, min) < 0) {
|
|
1589
|
+
min = value;
|
|
1590
|
+
}
|
|
1591
|
+
} else {
|
|
1592
|
+
if (value < min!) {
|
|
1593
|
+
min = value;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
return min;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* Returns the maximum value
|
|
1604
|
+
*/
|
|
1605
|
+
public max(compareFn?: ComparatorFn<T>): T | undefined {
|
|
1606
|
+
this.ensureNotDestroyed();
|
|
1607
|
+
|
|
1608
|
+
if (this.elements.length === 0) {
|
|
1609
|
+
return undefined;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
let max = this.get(0);
|
|
1613
|
+
if (max === undefined) {
|
|
1614
|
+
return undefined;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
for (let i = 1; i < this.elements.length; i++) {
|
|
1618
|
+
const value = this.get(i);
|
|
1619
|
+
if (value !== undefined) {
|
|
1620
|
+
if (compareFn) {
|
|
1621
|
+
if (compareFn(value, max) > 0) {
|
|
1622
|
+
max = value;
|
|
1623
|
+
}
|
|
1624
|
+
} else {
|
|
1625
|
+
if (value > max!) {
|
|
1626
|
+
max = value;
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
return max;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
/**
|
|
1636
|
+
* Shuffles the array in place using Fisher-Yates algorithm
|
|
1637
|
+
*/
|
|
1638
|
+
public shuffle(): this {
|
|
1639
|
+
this.ensureNotDestroyed();
|
|
1640
|
+
this.ensureNotReadOnly();
|
|
1641
|
+
this.ensureNotFrozen();
|
|
1642
|
+
|
|
1643
|
+
for (let i = this.elements.length - 1; i > 0; i--) {
|
|
1644
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
1645
|
+
|
|
1646
|
+
// Swap elements
|
|
1647
|
+
[this.elements[i], this.elements[j]] = [
|
|
1648
|
+
this.elements[j],
|
|
1649
|
+
this.elements[i],
|
|
1650
|
+
];
|
|
1651
|
+
|
|
1652
|
+
// Swap secure buffers if they exist
|
|
1653
|
+
const bufferI = this.secureBuffers.get(i);
|
|
1654
|
+
const bufferJ = this.secureBuffers.get(j);
|
|
1655
|
+
|
|
1656
|
+
if (bufferI) {
|
|
1657
|
+
this.secureBuffers.set(j, bufferI);
|
|
1658
|
+
} else {
|
|
1659
|
+
this.secureBuffers.delete(j);
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
if (bufferJ) {
|
|
1663
|
+
this.secureBuffers.set(i, bufferJ);
|
|
1664
|
+
} else {
|
|
1665
|
+
this.secureBuffers.delete(i);
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
// Swap metadata
|
|
1669
|
+
const metaI = this.metadataManager.get(i);
|
|
1670
|
+
const metaJ = this.metadataManager.get(j);
|
|
1671
|
+
|
|
1672
|
+
if (metaI && metaJ) {
|
|
1673
|
+
this.metadataManager.update(i, metaJ.type, metaJ.isSecure);
|
|
1674
|
+
this.metadataManager.update(j, metaI.type, metaI.isSecure);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
this.updateLastModified();
|
|
1679
|
+
this.eventManager.emit("shuffle", -1, undefined);
|
|
1680
|
+
|
|
1681
|
+
return this;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* Returns a random sample of elements
|
|
1686
|
+
*/
|
|
1687
|
+
public sample(count: number = 1): SecureArray<T> {
|
|
1688
|
+
this.ensureNotDestroyed();
|
|
1689
|
+
|
|
1690
|
+
if (count <= 0 || this.elements.length === 0) {
|
|
1691
|
+
return new SecureArray<T>([], { ...this.options });
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
const sampleCount = Math.min(count, this.elements.length);
|
|
1695
|
+
const indices = new Set<number>();
|
|
1696
|
+
const sampledElements: T[] = [];
|
|
1697
|
+
|
|
1698
|
+
while (indices.size < sampleCount) {
|
|
1699
|
+
const randomIndex = Math.floor(
|
|
1700
|
+
Math.random() * this.elements.length
|
|
1701
|
+
);
|
|
1702
|
+
if (!indices.has(randomIndex)) {
|
|
1703
|
+
indices.add(randomIndex);
|
|
1704
|
+
const value = this.get(randomIndex);
|
|
1705
|
+
if (value !== undefined) {
|
|
1706
|
+
sampledElements.push(value);
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
return new SecureArray<T>(sampledElements, { ...this.options });
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
// ===== ITERATOR IMPLEMENTATION =====
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* Returns an iterator for the array
|
|
1718
|
+
*/
|
|
1719
|
+
public *[Symbol.iterator](): Iterator<T> {
|
|
1720
|
+
this.ensureNotDestroyed();
|
|
1721
|
+
|
|
1722
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1723
|
+
const value = this.get(i);
|
|
1724
|
+
if (value !== undefined) {
|
|
1725
|
+
yield value;
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
/**
|
|
1731
|
+
* Returns an iterator for array entries [index, value]
|
|
1732
|
+
*/
|
|
1733
|
+
public *entries(): Iterator<[number, T]> {
|
|
1734
|
+
this.ensureNotDestroyed();
|
|
1735
|
+
|
|
1736
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1737
|
+
const value = this.get(i);
|
|
1738
|
+
if (value !== undefined) {
|
|
1739
|
+
yield [i, value];
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
/**
|
|
1745
|
+
* Returns an iterator for array indices
|
|
1746
|
+
*/
|
|
1747
|
+
public *keys(): Iterator<number> {
|
|
1748
|
+
this.ensureNotDestroyed();
|
|
1749
|
+
|
|
1750
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1751
|
+
yield i;
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
/**
|
|
1756
|
+
* Returns an iterator for array values
|
|
1757
|
+
*/
|
|
1758
|
+
public *values(): Iterator<T> {
|
|
1759
|
+
return this[Symbol.iterator]();
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
// ===== EVENT MANAGEMENT =====
|
|
1763
|
+
|
|
1764
|
+
/**
|
|
1765
|
+
* Adds an event listener
|
|
1766
|
+
*/
|
|
1767
|
+
public on(
|
|
1768
|
+
event: SecureArrayEvent,
|
|
1769
|
+
listener: SecureArrayEventListener
|
|
1770
|
+
): this {
|
|
1771
|
+
this.eventManager.on(event, listener);
|
|
1772
|
+
return this;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
/**
|
|
1776
|
+
* Removes an event listener
|
|
1777
|
+
*/
|
|
1778
|
+
public off(
|
|
1779
|
+
event: SecureArrayEvent,
|
|
1780
|
+
listener: SecureArrayEventListener
|
|
1781
|
+
): this {
|
|
1782
|
+
this.eventManager.off(event, listener);
|
|
1783
|
+
return this;
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* Adds a one-time event listener
|
|
1788
|
+
*/
|
|
1789
|
+
public once(
|
|
1790
|
+
event: SecureArrayEvent,
|
|
1791
|
+
listener: SecureArrayEventListener
|
|
1792
|
+
): this {
|
|
1793
|
+
this.eventManager.once(event, listener);
|
|
1794
|
+
return this;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
// ===== SERIALIZATION AND EXPORT =====
|
|
1798
|
+
|
|
1799
|
+
/**
|
|
1800
|
+
* Serializes the SecureArray to a secure format
|
|
1801
|
+
*/
|
|
1802
|
+
public serialize(options?: SecureArraySerializationOptions): string {
|
|
1803
|
+
this.ensureNotDestroyed();
|
|
1804
|
+
return this.serializationHandler.serialize(this.elements, options);
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
/**
|
|
1808
|
+
* Exports the SecureArray data in various formats
|
|
1809
|
+
*/
|
|
1810
|
+
public exportData(
|
|
1811
|
+
format: "json" | "csv" | "xml" | "yaml" = "json"
|
|
1812
|
+
): string {
|
|
1813
|
+
this.ensureNotDestroyed();
|
|
1814
|
+
|
|
1815
|
+
// Get the actual values (not SecureBuffers)
|
|
1816
|
+
const actualElements: T[] = [];
|
|
1817
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1818
|
+
const value = this.get(i);
|
|
1819
|
+
if (value !== undefined) {
|
|
1820
|
+
actualElements.push(value);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
return this.serializationHandler.exportData(actualElements, format);
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* Converts to a regular JavaScript array (loses security features)
|
|
1829
|
+
*/
|
|
1830
|
+
public toArray(): T[] {
|
|
1831
|
+
this.ensureNotDestroyed();
|
|
1832
|
+
|
|
1833
|
+
const regularArray: T[] = [];
|
|
1834
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1835
|
+
const value = this.get(i);
|
|
1836
|
+
if (value !== undefined) {
|
|
1837
|
+
regularArray.push(value);
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
return regularArray;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
/**
|
|
1845
|
+
* Converts to a regular JavaScript array (same as toArray method)
|
|
1846
|
+
*/
|
|
1847
|
+
public get _array() {
|
|
1848
|
+
return this.toArray();
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Creates a SecureArray from a regular array
|
|
1853
|
+
*/
|
|
1854
|
+
public static from<T extends SecureArrayValue>(
|
|
1855
|
+
arrayLike: ArrayLike<T> | Iterable<T>,
|
|
1856
|
+
options?: SecureArrayOptions
|
|
1857
|
+
): SecureArray<T> {
|
|
1858
|
+
const elements = Array.from(arrayLike);
|
|
1859
|
+
return new SecureArray<T>(elements, options);
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
/**
|
|
1863
|
+
* Creates a SecureArray with specified length and fill value
|
|
1864
|
+
*/
|
|
1865
|
+
public static of<T extends SecureArrayValue>(
|
|
1866
|
+
...elements: T[]
|
|
1867
|
+
): SecureArray<T> {
|
|
1868
|
+
return new SecureArray<T>(elements);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
// ===== ENCRYPTION METHODS =====
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* Gets encryption status from the crypto handler
|
|
1875
|
+
*/
|
|
1876
|
+
public getEncryptionStatus() {
|
|
1877
|
+
return this.cryptoHandler.getEncryptionStatus();
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
/**
|
|
1881
|
+
* Sets an encryption key for the array
|
|
1882
|
+
*/
|
|
1883
|
+
public setEncryptionKey(key: string): void {
|
|
1884
|
+
this.ensureNotDestroyed();
|
|
1885
|
+
this.cryptoHandler.setEncryptionKey(key);
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
/**
|
|
1889
|
+
* Gets the raw encrypted data without decryption (for verification)
|
|
1890
|
+
*/
|
|
1891
|
+
public getRawEncryptedData(): any[] {
|
|
1892
|
+
this.ensureNotDestroyed();
|
|
1893
|
+
return [...this.elements];
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
/**
|
|
1897
|
+
* Gets a specific element's raw encrypted form (for verification)
|
|
1898
|
+
*/
|
|
1899
|
+
public getRawEncryptedElement(index: number): any {
|
|
1900
|
+
this.ensureNotDestroyed();
|
|
1901
|
+
this.validateIndex(index);
|
|
1902
|
+
|
|
1903
|
+
if (index >= this.elements.length) {
|
|
1904
|
+
return undefined;
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
return this.elements[index];
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
/**
|
|
1911
|
+
* Encrypts all elements in the array using AES-256-CTR-HMAC encryption
|
|
1912
|
+
* with proper memory management and atomic operations
|
|
1913
|
+
*/
|
|
1914
|
+
public encryptAll(): this {
|
|
1915
|
+
this.ensureNotDestroyed();
|
|
1916
|
+
this.ensureNotReadOnly();
|
|
1917
|
+
this.ensureNotFrozen();
|
|
1918
|
+
|
|
1919
|
+
// Check if encryption key is set
|
|
1920
|
+
const encryptionStatus = this.cryptoHandler.getEncryptionStatus();
|
|
1921
|
+
if (!encryptionStatus.hasEncryptionKey) {
|
|
1922
|
+
throw new Error(
|
|
1923
|
+
"Encryption key must be set before calling encryptAll()"
|
|
1924
|
+
);
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
// Prepare temporary storage for atomic operation
|
|
1928
|
+
const encryptedValues: any[] = [];
|
|
1929
|
+
const originalMetadata = new Map<number, any>();
|
|
1930
|
+
const indicesToProcess: number[] = [];
|
|
1931
|
+
|
|
1932
|
+
try {
|
|
1933
|
+
// First pass: encrypt all values into temporary storage
|
|
1934
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
1935
|
+
const value = this.elements[i]; // Get raw value, not through get() method
|
|
1936
|
+
if (value !== undefined) {
|
|
1937
|
+
// Skip already encrypted values to avoid double encryption
|
|
1938
|
+
if (
|
|
1939
|
+
typeof value === "string" &&
|
|
1940
|
+
this.cryptoHandler.isEncrypted(value)
|
|
1941
|
+
) {
|
|
1942
|
+
continue;
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
// Store original metadata for rollback
|
|
1946
|
+
if (this.metadataManager.has(i)) {
|
|
1947
|
+
originalMetadata.set(i, this.metadataManager.get(i));
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
// Get the actual value to encrypt
|
|
1951
|
+
let valueToEncrypt: any = value;
|
|
1952
|
+
|
|
1953
|
+
// If it's a SecureBuffer, convert it back to its original form
|
|
1954
|
+
if (value instanceof SecureBuffer) {
|
|
1955
|
+
const metadata = this.metadataManager.get(i);
|
|
1956
|
+
if (metadata?.type === "string") {
|
|
1957
|
+
valueToEncrypt = new TextDecoder().decode(
|
|
1958
|
+
value.getBuffer()
|
|
1959
|
+
) as any;
|
|
1960
|
+
} else if (metadata?.type === "Uint8Array") {
|
|
1961
|
+
valueToEncrypt = new Uint8Array(
|
|
1962
|
+
value.getBuffer()
|
|
1963
|
+
) as any;
|
|
1964
|
+
} else {
|
|
1965
|
+
valueToEncrypt = new TextDecoder().decode(
|
|
1966
|
+
value.getBuffer()
|
|
1967
|
+
) as any;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
// Encrypt the value
|
|
1972
|
+
const encryptedValue =
|
|
1973
|
+
this.cryptoHandler.encryptValue(valueToEncrypt);
|
|
1974
|
+
encryptedValues[i] = encryptedValue;
|
|
1975
|
+
indicesToProcess.push(i);
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
// Second pass: atomically commit all changes
|
|
1980
|
+
for (const i of indicesToProcess) {
|
|
1981
|
+
const encryptedValue = encryptedValues[i];
|
|
1982
|
+
const originalValue = this.elements[i];
|
|
1983
|
+
|
|
1984
|
+
// Clean up any existing SecureBuffer for this index
|
|
1985
|
+
this.cleanupIndex(i);
|
|
1986
|
+
|
|
1987
|
+
// Store encrypted value
|
|
1988
|
+
this.elements[i] = encryptedValue;
|
|
1989
|
+
|
|
1990
|
+
// Update metadata with correct type information
|
|
1991
|
+
// Store original type in the type field using special format
|
|
1992
|
+
const originalType = typeof originalValue;
|
|
1993
|
+
this.metadataManager.update(
|
|
1994
|
+
i,
|
|
1995
|
+
`encrypted:${originalType}`,
|
|
1996
|
+
true
|
|
1997
|
+
);
|
|
1998
|
+
}
|
|
1999
|
+
} catch (error: any) {
|
|
2000
|
+
// Rollback: restore original state on any failure
|
|
2001
|
+
for (const i of indicesToProcess) {
|
|
2002
|
+
if (originalMetadata.has(i)) {
|
|
2003
|
+
// Restore original metadata
|
|
2004
|
+
const original = originalMetadata.get(i);
|
|
2005
|
+
this.metadataManager.update(
|
|
2006
|
+
i,
|
|
2007
|
+
original.type,
|
|
2008
|
+
original.isSecure
|
|
2009
|
+
);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
throw new Error(
|
|
2014
|
+
`Encryption failed: ${error?.message || "Unknown error"}`
|
|
2015
|
+
);
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
this.updateLastModified();
|
|
2019
|
+
this.eventManager.emit(
|
|
2020
|
+
"encrypt_all",
|
|
2021
|
+
-1,
|
|
2022
|
+
`${indicesToProcess.length}_elements_encrypted`
|
|
2023
|
+
);
|
|
2024
|
+
|
|
2025
|
+
return this;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
|