nodefony 7.0.2 → 10.0.0-alpha.2
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/.ai/symbols.json +36135 -0
- package/LICENSE +544 -0
- package/README.md +316 -694
- package/bin/nodefony +2183 -85
- package/dist/client/Container.js +367 -0
- package/dist/client/Event.js +198 -0
- package/dist/client/Service.js +344 -0
- package/dist/client/Tools.js +162 -0
- package/dist/client/client/ClientKernel.js +276 -0
- package/dist/client/client/angular/index.js +352 -0
- package/dist/client/client/announce.js +212 -0
- package/dist/client/client/debugbar/DebugBar.js +1624 -0
- package/dist/client/client/debugbar/format.js +103 -0
- package/dist/client/client/debugbar/hmr.js +37 -0
- package/dist/client/client/debugbar/index.js +29 -0
- package/dist/client/client/debugbar/model.js +133 -0
- package/dist/client/client/debugbar/network.js +173 -0
- package/dist/client/client/debugbar/profile.js +114 -0
- package/dist/client/client/index.js +34 -0
- package/dist/client/client/react/index.js +268 -0
- package/dist/client/client/realtime/AdaptiveRate.js +240 -0
- package/dist/client/client/realtime/BrowserWsTransport.js +57 -0
- package/dist/client/client/realtime/RealtimeClient.js +898 -0
- package/dist/client/client/realtime/localEvents.js +56 -0
- package/dist/client/client/realtime/notice.js +125 -0
- package/dist/client/client/realtime/observe.js +280 -0
- package/dist/client/client/roles/index.js +3 -0
- package/dist/client/client/roles/registry.js +97 -0
- package/dist/client/client/roles/roles.js +91 -0
- package/dist/client/client/shim/events.js +88 -0
- package/dist/client/client/shim/util.js +20 -0
- package/dist/client/client/svelte/index.js +319 -0
- package/dist/client/client/syslog/context.js +122 -0
- package/dist/client/client/syslog/errors.js +49 -0
- package/dist/client/client/syslog/uplink.js +106 -0
- package/dist/client/client/vue/index.js +321 -0
- package/dist/client/colors.js +63 -0
- package/dist/client/debugbar.standalone.js +4274 -0
- package/dist/client/realtime/IRealtimeTransport.js +32 -0
- package/dist/client/realtime/JsonRpcPeer.js +251 -0
- package/dist/client/realtime/channelRate.js +39 -0
- package/dist/client/realtime/platformChannels.js +155 -0
- package/dist/client/syslog/Pdu.js +224 -0
- package/dist/client/syslog/Syslog.js +1159 -0
- package/dist/client/syslog/drivers/pduFlow.js +106 -0
- package/dist/client/syslog/drivers/pduProtocol.js +28 -0
- package/dist/client/syslog/logColor.js +80 -0
- package/dist/client/types/src/Container.d.ts +221 -0
- package/dist/client/types/src/Event.d.ts +171 -0
- package/dist/client/types/src/FileClass.d.ts +184 -0
- package/dist/client/types/src/Service.d.ts +165 -0
- package/dist/client/types/src/Tools.d.ts +116 -0
- package/dist/client/types/src/client/ClientKernel.d.ts +90 -0
- package/dist/client/types/src/client/IClientKernel.d.ts +195 -0
- package/dist/client/types/src/client/angular/index.d.ts +273 -0
- package/dist/client/types/src/client/announce.d.ts +74 -0
- package/dist/client/types/src/client/debugbar/DebugBar.d.ts +279 -0
- package/dist/client/types/src/client/debugbar/format.d.ts +48 -0
- package/dist/client/types/src/client/debugbar/hmr.d.ts +16 -0
- package/dist/client/types/src/client/debugbar/index.d.ts +30 -0
- package/dist/client/types/src/client/debugbar/model.d.ts +158 -0
- package/dist/client/types/src/client/debugbar/network.d.ts +55 -0
- package/dist/client/types/src/client/debugbar/profile.d.ts +99 -0
- package/dist/client/types/src/client/index.d.ts +47 -0
- package/dist/client/types/src/client/react/index.d.ts +207 -0
- package/dist/client/types/src/client/realtime/AdaptiveRate.d.ts +138 -0
- package/dist/client/types/src/client/realtime/BrowserWsTransport.d.ts +27 -0
- package/dist/client/types/src/client/realtime/RealtimeClient.d.ts +573 -0
- package/dist/client/types/src/client/realtime/localEvents.d.ts +53 -0
- package/dist/client/types/src/client/realtime/notice.d.ts +70 -0
- package/dist/client/types/src/client/realtime/observe.d.ts +284 -0
- package/dist/client/types/src/client/roles/index.d.ts +15 -0
- package/dist/client/types/src/client/roles/registry.d.ts +72 -0
- package/dist/client/types/src/client/roles/roles.d.ts +68 -0
- package/dist/client/types/src/client/shim/cli-color.d.ts +2 -0
- package/dist/client/types/src/client/shim/events.d.ts +39 -0
- package/dist/client/types/src/client/shim/util.d.ts +14 -0
- package/dist/client/types/src/client/svelte/index.d.ts +216 -0
- package/dist/client/types/src/client/syslog/context.d.ts +76 -0
- package/dist/client/types/src/client/syslog/errors.d.ts +46 -0
- package/dist/client/types/src/client/syslog/uplink.d.ts +89 -0
- package/dist/client/types/src/client/transport/websocket.d.ts +5 -0
- package/dist/client/types/src/client/vue/index.d.ts +234 -0
- package/dist/client/types/src/colors.d.ts +32 -0
- package/dist/client/types/src/config/infra.d.ts +171 -0
- package/dist/client/types/src/kernel/bootReport.d.ts +112 -0
- package/dist/client/types/src/kernel/readinessRegistry.d.ts +104 -0
- package/dist/client/types/src/realtime/IRealtimeSocket.d.ts +142 -0
- package/dist/client/types/src/realtime/IRealtimeTransport.d.ts +50 -0
- package/dist/client/types/src/realtime/JsonRpcPeer.d.ts +251 -0
- package/dist/client/types/src/realtime/RealtimeEventMap.d.ts +269 -0
- package/dist/client/types/src/realtime/channelRate.d.ts +55 -0
- package/dist/client/types/src/realtime/platformChannels.d.ts +147 -0
- package/dist/client/types/src/syslog/Pdu.d.ts +134 -0
- package/dist/client/types/src/syslog/Syslog.d.ts +482 -0
- package/dist/client/types/src/syslog/drivers/ILogDriver.d.ts +177 -0
- package/dist/client/types/src/syslog/drivers/pduFlow.d.ts +53 -0
- package/dist/client/types/src/syslog/drivers/pduProtocol.d.ts +20 -0
- package/dist/client/types/src/syslog/logColor.d.ts +59 -0
- package/dist/client/types/src/types/ICliKernel.d.ts +28 -0
- package/dist/client/types/src/types/ICommand.d.ts +14 -0
- package/dist/client/types/src/types/IContainer.d.ts +35 -0
- package/dist/client/types/src/types/IKernel.d.ts +138 -0
- package/dist/client/types/src/types/IMcpTool.d.ts +157 -0
- package/dist/client/types/src/types/IModule.d.ts +73 -0
- package/dist/client/types/src/types/IPage.d.ts +119 -0
- package/dist/client/types/src/types/IService.d.ts +62 -0
- package/dist/client/types/src/types/ISyslog.d.ts +58 -0
- package/dist/client/types/src/types/ITransport.d.ts +5 -0
- package/dist/client/types/src/types/globals.d.ts +47 -0
- package/dist/node/Cli.js +750 -0
- package/dist/node/Container.js +367 -0
- package/dist/node/Error.js +309 -0
- package/dist/node/Event.js +198 -0
- package/dist/node/FileClass.js +308 -0
- package/dist/node/Nodefony.js +78 -0
- package/dist/node/Service.js +344 -0
- package/dist/node/Tools.js +205 -0
- package/dist/node/bin/resolveLocalCli.js +10 -0
- package/dist/node/bundler/index.js +103 -0
- package/dist/node/cli/agentTargets.js +461 -0
- package/dist/node/cli/aiMcp.js +553 -0
- package/dist/node/cli/aiMcpReport.js +129 -0
- package/dist/node/cli/aiSync.js +323 -0
- package/dist/node/cli/aiSyncReport.js +142 -0
- package/dist/node/cli/card.js +186 -0
- package/dist/node/cli/cardReport.js +110 -0
- package/dist/node/cli/completion.js +415 -0
- package/dist/node/cli/create.js +805 -0
- package/dist/node/cli/env.js +332 -0
- package/dist/node/cli/envReport.js +159 -0
- package/dist/node/cli/execPortable.js +60 -0
- package/dist/node/cli/gitHooks.js +191 -0
- package/dist/node/cli/gitHooksReport.js +119 -0
- package/dist/node/cli/globalFlags.js +67 -0
- package/dist/node/cli/helpReport.js +288 -0
- package/dist/node/cli/manPage.js +165 -0
- package/dist/node/cli/nodefonyBin.js +61 -0
- package/dist/node/cli/outdated.js +144 -0
- package/dist/node/cli/progress.js +555 -0
- package/dist/node/cli/projectRoot.js +32 -0
- package/dist/node/cli/promptPassword.js +44 -0
- package/dist/node/cli/prompts.js +86 -0
- package/dist/node/cli/scaffold/destination.js +92 -0
- package/dist/node/cli/scaffold/engine.js +2156 -0
- package/dist/node/cli/scaffold/entityFields.js +589 -0
- package/dist/node/cli/scaffold/format.js +243 -0
- package/dist/node/cli/scaffold/interactive.js +124 -0
- package/dist/node/cli/scaffold/moduleLayout.js +38 -0
- package/dist/node/cli/scaffold/reservedEntities.js +74 -0
- package/dist/node/cli/scaffold/spec.js +704 -0
- package/dist/node/cli/scaffold/steps.js +40 -0
- package/dist/node/cli/scaffold/userContractSource.js +133 -0
- package/dist/node/cli/scaffold/versions.js +57 -0
- package/dist/node/cli/scaffold/writer.js +172 -0
- package/dist/node/cli/startMenu.js +496 -0
- package/dist/node/cli/symbols.js +205 -0
- package/dist/node/cli/sysexits.js +34 -0
- package/dist/node/cli/tableReport.js +184 -0
- package/dist/node/cli/usageReport.js +144 -0
- package/dist/node/colors.js +63 -0
- package/dist/node/command/Builder.js +153 -0
- package/dist/node/command/Command.js +348 -0
- package/dist/node/config/configProvenance.js +101 -0
- package/dist/node/config/defaults.js +39 -0
- package/dist/node/config/defineConfig.js +129 -0
- package/dist/node/config/defineEnv.js +264 -0
- package/dist/node/config/envExample.js +41 -0
- package/dist/node/config/envOverride.js +423 -0
- package/dist/node/config/infra.js +163 -0
- package/dist/node/config/reactivity.js +23 -0
- package/dist/node/config/reservedEnv.js +118 -0
- package/dist/node/config/schema.js +134 -0
- package/dist/node/config/use.js +24 -0
- package/dist/node/finder/File.js +49 -0
- package/dist/node/finder/FileResult.js +86 -0
- package/dist/node/finder/Finder.js +201 -0
- package/dist/node/finder/Result.js +45 -0
- package/dist/node/index.js +121 -0
- package/dist/node/kernel/BootConfigurationError.js +54 -0
- package/dist/node/kernel/CliKernel.js +630 -0
- package/dist/node/kernel/Kernel.js +2198 -0
- package/dist/node/kernel/Module.js +453 -0
- package/dist/node/kernel/adminPlane/adminCaller.js +98 -0
- package/dist/node/kernel/adminPlane/adminRbac.js +51 -0
- package/dist/node/kernel/adminPlane/catalog.js +158 -0
- package/dist/node/kernel/adminPlane/executeAdmin.js +78 -0
- package/dist/node/kernel/checks/deep.js +335 -0
- package/dist/node/kernel/checks/freshness.js +139 -0
- package/dist/node/kernel/checks/gating.js +231 -0
- package/dist/node/kernel/checks/guards.js +232 -0
- package/dist/node/kernel/checks/lastBoot.js +136 -0
- package/dist/node/kernel/checks/live.js +330 -0
- package/dist/node/kernel/checks/packageDeps.js +292 -0
- package/dist/node/kernel/checks/readiness.js +153 -0
- package/dist/node/kernel/checks/renderReport.js +780 -0
- package/dist/node/kernel/checks/report.js +421 -0
- package/dist/node/kernel/checks/runDoctor.js +731 -0
- package/dist/node/kernel/checks/surface.js +364 -0
- package/dist/node/kernel/checks/walk.js +100 -0
- package/dist/node/kernel/checks/wiring.js +450 -0
- package/dist/node/kernel/commands/AiMcpCommand.js +65 -0
- package/dist/node/kernel/commands/AiSyncCommand.js +48 -0
- package/dist/node/kernel/commands/BuildCommand.js +49 -0
- package/dist/node/kernel/commands/CardCommand.js +50 -0
- package/dist/node/kernel/commands/ClusterCommand.js +58 -0
- package/dist/node/kernel/commands/CompletionCommand.js +31 -0
- package/dist/node/kernel/commands/CreateCommand.js +45 -0
- package/dist/node/kernel/commands/DevCommand.js +99 -0
- package/dist/node/kernel/commands/DoctorCommand.js +115 -0
- package/dist/node/kernel/commands/EnvCommand.js +52 -0
- package/dist/node/kernel/commands/GitHooksCommand.js +47 -0
- package/dist/node/kernel/commands/InspectCommand.js +153 -0
- package/dist/node/kernel/commands/InstallCommand.js +20 -0
- package/dist/node/kernel/commands/MenuCommand.js +261 -0
- package/dist/node/kernel/commands/OutdatedCommand.js +164 -0
- package/dist/node/kernel/commands/ProdCommand.js +60 -0
- package/dist/node/kernel/commands/StatusCommand.js +30 -0
- package/dist/node/kernel/commands/StopCommand.js +35 -0
- package/dist/node/kernel/commands/SymbolsCommand.js +45 -0
- package/dist/node/kernel/commands/runtimeLauncher.js +95 -0
- package/dist/node/kernel/decorators/kernelDecorator.js +110 -0
- package/dist/node/kernel/injector/injector.js +137 -0
- package/dist/node/kernel/injector/serviceOrder.js +106 -0
- package/dist/node/kernel/inspect/adminSubjects.js +194 -0
- package/dist/node/kernel/inspect/docOutline.js +86 -0
- package/dist/node/kernel/lifecycleTags.js +76 -0
- package/dist/node/kernel/moduleConfig.js +75 -0
- package/dist/node/kernel/moduleGating.js +68 -0
- package/dist/node/kernel/readinessRegistry.js +98 -0
- package/dist/node/kernel/resolveModuleEntry.js +61 -0
- package/dist/node/mcp/caller.js +40 -0
- package/dist/node/mcp/guard.js +51 -0
- package/dist/node/mcp/protocol.js +157 -0
- package/dist/node/mcp/server.js +216 -0
- package/dist/node/mcp/tools.js +861 -0
- package/dist/node/oauth/authorizationServer.js +221 -0
- package/dist/node/oauth/protectedResource.js +293 -0
- package/dist/node/package.js +4 -0
- package/dist/node/realtime/IRealtimeTransport.js +32 -0
- package/dist/node/realtime/JsonRpcPeer.js +251 -0
- package/dist/node/realtime/RealtimeEventMap.js +15 -0
- package/dist/node/realtime/channelRate.js +39 -0
- package/dist/node/realtime/platformChannels.js +155 -0
- package/dist/node/runtime/GcScheduler.js +92 -0
- package/dist/node/runtime/RequestContext.js +76 -0
- package/dist/node/runtime/bearer.js +84 -0
- package/dist/node/runtime/engineEnvironment.js +79 -0
- package/dist/node/runtime/loadEnv.js +105 -0
- package/dist/node/runtime/pageFacets.js +85 -0
- package/dist/node/runtime/pageFilters.js +103 -0
- package/dist/node/runtime/pageGuard.js +84 -0
- package/dist/node/runtime/pageQuery.js +160 -0
- package/dist/node/runtime/pageSort.js +114 -0
- package/dist/node/runtime/redact.js +43 -0
- package/dist/node/runtime/withTimeout.js +71 -0
- package/dist/node/service/cluster/ClusterManager.js +202 -0
- package/dist/node/service/cluster/ClusterProbeAggregator.js +120 -0
- package/dist/node/service/cluster/ClusterRelay.js +74 -0
- package/dist/node/service/cluster/clusterMaster.js +65 -0
- package/dist/node/service/cluster/clusterMessage.js +70 -0
- package/dist/node/service/cluster/cpuQuota.js +59 -0
- package/dist/node/service/cluster/instanceProbe.js +52 -0
- package/dist/node/service/cluster/podEnvironment.js +48 -0
- package/dist/node/service/cluster/processProbe.js +70 -0
- package/dist/node/service/cluster/richProcessProbe.js +115 -0
- package/dist/node/service/cluster/topology.js +71 -0
- package/dist/node/service/dev/BootReporter.js +490 -0
- package/dist/node/service/dev/DevSupervisor.js +1004 -0
- package/dist/node/service/dev/bootVerdict.js +158 -0
- package/dist/node/service/dev/detachedStart.js +372 -0
- package/dist/node/service/dev/devProcess.js +1137 -0
- package/dist/node/service/dev/devProjects.js +138 -0
- package/dist/node/service/dev/devStatusReport.js +395 -0
- package/dist/node/service/dev/devStop.js +263 -0
- package/dist/node/service/fetchService.js +35 -0
- package/dist/node/service/gitService.js +62 -0
- package/dist/node/syslog/Pdu.js +224 -0
- package/dist/node/syslog/Syslog.js +1159 -0
- package/dist/node/syslog/drivers/ClusterFileLogDriver.js +114 -0
- package/dist/node/syslog/drivers/FileLogDriver.js +127 -0
- package/dist/node/syslog/drivers/ILogDriver.js +26 -0
- package/dist/node/syslog/drivers/LokiLogDriver.js +144 -0
- package/dist/node/syslog/drivers/MemoryLogDriver.js +33 -0
- package/dist/node/syslog/drivers/OpenSearchLogDriver.js +159 -0
- package/dist/node/syslog/drivers/builtinLogDrivers.js +114 -0
- package/dist/node/syslog/drivers/filterPdus.js +71 -0
- package/dist/node/syslog/drivers/logDriverRegistry.js +83 -0
- package/dist/node/syslog/drivers/opensearchShared.js +17 -0
- package/dist/node/syslog/drivers/pduFlow.js +106 -0
- package/dist/node/syslog/drivers/pduProtocol.js +28 -0
- package/dist/node/syslog/httpFetch.js +43 -0
- package/dist/node/syslog/logColor.js +80 -0
- package/dist/node/syslog/sinks/FileSink.js +142 -0
- package/dist/node/syslog/transports/BatchingHttpTransport.js +98 -0
- package/dist/node/syslog/transports/ConsoleTransport.js +14 -0
- package/dist/node/syslog/transports/FileTransport.js +17 -0
- package/dist/node/syslog/transports/HttpTransport.js +44 -0
- package/dist/node/syslog/transports/LokiTransport.js +80 -0
- package/dist/node/syslog/transports/OpenSearchTransport.js +53 -0
- package/dist/node/syslog/transports/SyslogTransport.js +13 -0
- package/dist/node/syslog/transports/index.js +8 -0
- package/dist/node/testing/index.js +190 -0
- package/dist/types/Cli.d.ts +177 -0
- package/dist/types/Container.d.ts +221 -0
- package/dist/types/Error.d.ts +162 -0
- package/dist/types/Event.d.ts +171 -0
- package/dist/types/FileClass.d.ts +184 -0
- package/dist/types/Nodefony.d.ts +66 -0
- package/dist/types/Service.d.ts +165 -0
- package/dist/types/Tools.d.ts +116 -0
- package/dist/types/bin/resolveLocalCli.d.ts +49 -0
- package/dist/types/bundler/index.d.ts +66 -0
- package/dist/types/cli/agentTargets.d.ts +378 -0
- package/dist/types/cli/aiMcp.d.ts +239 -0
- package/dist/types/cli/aiMcpReport.d.ts +113 -0
- package/dist/types/cli/aiSync.d.ts +68 -0
- package/dist/types/cli/aiSyncReport.d.ts +149 -0
- package/dist/types/cli/card.d.ts +49 -0
- package/dist/types/cli/cardReport.d.ts +127 -0
- package/dist/types/cli/completion.d.ts +154 -0
- package/dist/types/cli/create.d.ts +177 -0
- package/dist/types/cli/env.d.ts +103 -0
- package/dist/types/cli/envReport.d.ts +153 -0
- package/dist/types/cli/execPortable.d.ts +54 -0
- package/dist/types/cli/gitHooks.d.ts +48 -0
- package/dist/types/cli/gitHooksReport.d.ts +101 -0
- package/dist/types/cli/globalFlags.d.ts +48 -0
- package/dist/types/cli/helpReport.d.ts +110 -0
- package/dist/types/cli/manPage.d.ts +21 -0
- package/dist/types/cli/nodefonyBin.d.ts +45 -0
- package/dist/types/cli/outdated.d.ts +119 -0
- package/dist/types/cli/progress.d.ts +349 -0
- package/dist/types/cli/projectRoot.d.ts +19 -0
- package/dist/types/cli/promptPassword.d.ts +22 -0
- package/dist/types/cli/prompts.d.ts +102 -0
- package/dist/types/cli/scaffold/destination.d.ts +70 -0
- package/dist/types/cli/scaffold/engine.d.ts +545 -0
- package/dist/types/cli/scaffold/entityFields.d.ts +238 -0
- package/dist/types/cli/scaffold/format.d.ts +78 -0
- package/dist/types/cli/scaffold/interactive.d.ts +11 -0
- package/dist/types/cli/scaffold/moduleLayout.d.ts +69 -0
- package/dist/types/cli/scaffold/reservedEntities.d.ts +49 -0
- package/dist/types/cli/scaffold/spec.d.ts +159 -0
- package/dist/types/cli/scaffold/steps.d.ts +24 -0
- package/dist/types/cli/scaffold/userContractSource.d.ts +86 -0
- package/dist/types/cli/scaffold/versions.d.ts +14 -0
- package/dist/types/cli/scaffold/writer.d.ts +100 -0
- package/dist/types/cli/startMenu.d.ts +195 -0
- package/dist/types/cli/symbols.d.ts +84 -0
- package/dist/types/cli/sysexits.d.ts +31 -0
- package/dist/types/cli/tableReport.d.ts +44 -0
- package/dist/types/cli/usageReport.d.ts +108 -0
- package/dist/types/client/ClientKernel.d.ts +90 -0
- package/dist/types/client/IClientKernel.d.ts +195 -0
- package/dist/types/client/angular/index.d.ts +273 -0
- package/dist/types/client/announce.d.ts +74 -0
- package/dist/types/client/debugbar/DebugBar.d.ts +279 -0
- package/dist/types/client/debugbar/format.d.ts +48 -0
- package/dist/types/client/debugbar/hmr.d.ts +16 -0
- package/dist/types/client/debugbar/index.d.ts +30 -0
- package/dist/types/client/debugbar/model.d.ts +158 -0
- package/dist/types/client/debugbar/network.d.ts +55 -0
- package/dist/types/client/debugbar/profile.d.ts +99 -0
- package/dist/types/client/index.d.ts +47 -0
- package/dist/types/client/react/index.d.ts +207 -0
- package/dist/types/client/realtime/AdaptiveRate.d.ts +138 -0
- package/dist/types/client/realtime/BrowserWsTransport.d.ts +27 -0
- package/dist/types/client/realtime/RealtimeClient.d.ts +573 -0
- package/dist/types/client/realtime/localEvents.d.ts +53 -0
- package/dist/types/client/realtime/notice.d.ts +70 -0
- package/dist/types/client/realtime/observe.d.ts +284 -0
- package/dist/types/client/roles/index.d.ts +15 -0
- package/dist/types/client/roles/registry.d.ts +72 -0
- package/dist/types/client/roles/roles.d.ts +68 -0
- package/dist/types/client/shim/cli-color.d.ts +2 -0
- package/dist/types/client/shim/events.d.ts +39 -0
- package/dist/types/client/shim/util.d.ts +14 -0
- package/dist/types/client/svelte/index.d.ts +216 -0
- package/dist/types/client/syslog/context.d.ts +76 -0
- package/dist/types/client/syslog/errors.d.ts +46 -0
- package/dist/types/client/syslog/uplink.d.ts +89 -0
- package/dist/types/client/transport/websocket.d.ts +5 -0
- package/dist/types/client/vue/index.d.ts +234 -0
- package/dist/types/colors.d.ts +32 -0
- package/dist/types/command/Builder.d.ts +47 -0
- package/dist/types/command/Command.d.ts +268 -0
- package/dist/types/config/configMeta.d.ts +53 -0
- package/dist/types/config/configProvenance.d.ts +58 -0
- package/dist/types/config/defaults.d.ts +33 -0
- package/dist/types/config/defineConfig.d.ts +70 -0
- package/dist/types/config/defineEnv.d.ts +170 -0
- package/dist/types/config/envExample.d.ts +23 -0
- package/dist/types/config/envOverride.d.ts +236 -0
- package/dist/types/config/index.d.ts +23 -0
- package/dist/types/config/infra.d.ts +171 -0
- package/dist/types/config/reactivity.d.ts +36 -0
- package/dist/types/config/reservedEnv.d.ts +145 -0
- package/dist/types/config/schema.d.ts +113 -0
- package/dist/types/config/types.d.ts +374 -0
- package/dist/types/config/use.d.ts +80 -0
- package/dist/types/finder/File.d.ts +26 -0
- package/dist/types/finder/FileResult.d.ts +14 -0
- package/dist/types/finder/Finder.d.ts +51 -0
- package/dist/types/finder/Result.d.ts +10 -0
- package/dist/types/index.d.ts +205 -0
- package/dist/types/kernel/BootConfigurationError.d.ts +50 -0
- package/dist/types/kernel/CliKernel.d.ts +289 -0
- package/dist/types/kernel/Kernel.d.ts +1255 -0
- package/dist/types/kernel/Module.d.ts +326 -0
- package/dist/types/kernel/adminPlane/adminCaller.d.ts +105 -0
- package/dist/types/kernel/adminPlane/adminRbac.d.ts +44 -0
- package/dist/types/kernel/adminPlane/catalog.d.ts +122 -0
- package/dist/types/kernel/adminPlane/executeAdmin.d.ts +99 -0
- package/dist/types/kernel/bootReport.d.ts +112 -0
- package/dist/types/kernel/checks/deep.d.ts +122 -0
- package/dist/types/kernel/checks/freshness.d.ts +49 -0
- package/dist/types/kernel/checks/gating.d.ts +134 -0
- package/dist/types/kernel/checks/guards.d.ts +57 -0
- package/dist/types/kernel/checks/lastBoot.d.ts +189 -0
- package/dist/types/kernel/checks/live.d.ts +110 -0
- package/dist/types/kernel/checks/packageDeps.d.ts +44 -0
- package/dist/types/kernel/checks/readiness.d.ts +97 -0
- package/dist/types/kernel/checks/renderReport.d.ts +107 -0
- package/dist/types/kernel/checks/report.d.ts +414 -0
- package/dist/types/kernel/checks/runDoctor.d.ts +361 -0
- package/dist/types/kernel/checks/surface.d.ts +148 -0
- package/dist/types/kernel/checks/walk.d.ts +45 -0
- package/dist/types/kernel/checks/wiring.d.ts +54 -0
- package/dist/types/kernel/commands/AiMcpCommand.d.ts +39 -0
- package/dist/types/kernel/commands/AiSyncCommand.d.ts +28 -0
- package/dist/types/kernel/commands/BuildCommand.d.ts +13 -0
- package/dist/types/kernel/commands/CardCommand.d.ts +34 -0
- package/dist/types/kernel/commands/ClusterCommand.d.ts +29 -0
- package/dist/types/kernel/commands/CompletionCommand.d.ts +17 -0
- package/dist/types/kernel/commands/CreateCommand.d.ts +16 -0
- package/dist/types/kernel/commands/DevCommand.d.ts +40 -0
- package/dist/types/kernel/commands/DoctorCommand.d.ts +55 -0
- package/dist/types/kernel/commands/EnvCommand.d.ts +35 -0
- package/dist/types/kernel/commands/GitHooksCommand.d.ts +27 -0
- package/dist/types/kernel/commands/InspectCommand.d.ts +59 -0
- package/dist/types/kernel/commands/InstallCommand.d.ts +7 -0
- package/dist/types/kernel/commands/MenuCommand.d.ts +58 -0
- package/dist/types/kernel/commands/OutdatedCommand.d.ts +47 -0
- package/dist/types/kernel/commands/ProdCommand.d.ts +29 -0
- package/dist/types/kernel/commands/StatusCommand.d.ts +17 -0
- package/dist/types/kernel/commands/StopCommand.d.ts +17 -0
- package/dist/types/kernel/commands/SymbolsCommand.d.ts +29 -0
- package/dist/types/kernel/commands/runtimeLauncher.d.ts +76 -0
- package/dist/types/kernel/decorators/kernelDecorator.d.ts +76 -0
- package/dist/types/kernel/injector/injector.d.ts +47 -0
- package/dist/types/kernel/injector/serviceOrder.d.ts +29 -0
- package/dist/types/kernel/inspect/adminSubjects.d.ts +169 -0
- package/dist/types/kernel/inspect/docOutline.d.ts +53 -0
- package/dist/types/kernel/lifecycleTags.d.ts +79 -0
- package/dist/types/kernel/moduleConfig.d.ts +35 -0
- package/dist/types/kernel/moduleGating.d.ts +78 -0
- package/dist/types/kernel/readinessRegistry.d.ts +104 -0
- package/dist/types/kernel/resolveModuleEntry.d.ts +46 -0
- package/dist/types/mcp/caller.d.ts +55 -0
- package/dist/types/mcp/guard.d.ts +66 -0
- package/dist/types/mcp/protocol.d.ts +163 -0
- package/dist/types/mcp/server.d.ts +70 -0
- package/dist/types/mcp/tools.d.ts +209 -0
- package/dist/types/oauth/authorizationServer.d.ts +204 -0
- package/dist/types/oauth/protectedResource.d.ts +339 -0
- package/dist/types/realtime/IRealtimeSocket.d.ts +142 -0
- package/dist/types/realtime/IRealtimeTransport.d.ts +50 -0
- package/dist/types/realtime/JsonRpcPeer.d.ts +251 -0
- package/dist/types/realtime/RealtimeEventMap.d.ts +269 -0
- package/dist/types/realtime/channelRate.d.ts +55 -0
- package/dist/types/realtime/platformChannels.d.ts +147 -0
- package/dist/types/runtime/GcScheduler.d.ts +96 -0
- package/dist/types/runtime/RequestContext.d.ts +152 -0
- package/dist/types/runtime/bearer.d.ts +88 -0
- package/dist/types/runtime/engineEnvironment.d.ts +115 -0
- package/dist/types/runtime/loadEnv.d.ts +86 -0
- package/dist/types/runtime/pageFacets.d.ts +104 -0
- package/dist/types/runtime/pageFilters.d.ts +139 -0
- package/dist/types/runtime/pageGuard.d.ts +78 -0
- package/dist/types/runtime/pageQuery.d.ts +138 -0
- package/dist/types/runtime/pageSort.d.ts +86 -0
- package/dist/types/runtime/redact.d.ts +27 -0
- package/dist/types/runtime/withTimeout.d.ts +51 -0
- package/dist/types/service/cluster/ClusterManager.d.ts +112 -0
- package/dist/types/service/cluster/ClusterProbeAggregator.d.ts +68 -0
- package/dist/types/service/cluster/ClusterRelay.d.ts +57 -0
- package/dist/types/service/cluster/clusterMaster.d.ts +40 -0
- package/dist/types/service/cluster/clusterMessage.d.ts +94 -0
- package/dist/types/service/cluster/cpuQuota.d.ts +37 -0
- package/dist/types/service/cluster/instanceProbe.d.ts +82 -0
- package/dist/types/service/cluster/podEnvironment.d.ts +35 -0
- package/dist/types/service/cluster/processProbe.d.ts +53 -0
- package/dist/types/service/cluster/richProcessProbe.d.ts +77 -0
- package/dist/types/service/cluster/topology.d.ts +64 -0
- package/dist/types/service/dev/BootReporter.d.ts +67 -0
- package/dist/types/service/dev/DevSupervisor.d.ts +117 -0
- package/dist/types/service/dev/bootVerdict.d.ts +99 -0
- package/dist/types/service/dev/detachedStart.d.ts +164 -0
- package/dist/types/service/dev/devProcess.d.ts +638 -0
- package/dist/types/service/dev/devProjects.d.ts +121 -0
- package/dist/types/service/dev/devStatusReport.d.ts +141 -0
- package/dist/types/service/dev/devStop.d.ts +57 -0
- package/dist/types/service/fetchService.d.ts +29 -0
- package/dist/types/service/gitService.d.ts +24 -0
- package/dist/types/syslog/Pdu.d.ts +134 -0
- package/dist/types/syslog/Syslog.d.ts +482 -0
- package/dist/types/syslog/drivers/ClusterFileLogDriver.d.ts +40 -0
- package/dist/types/syslog/drivers/FileLogDriver.d.ts +55 -0
- package/dist/types/syslog/drivers/ILogDriver.d.ts +177 -0
- package/dist/types/syslog/drivers/LokiLogDriver.d.ts +44 -0
- package/dist/types/syslog/drivers/MemoryLogDriver.d.ts +20 -0
- package/dist/types/syslog/drivers/OpenSearchLogDriver.d.ts +40 -0
- package/dist/types/syslog/drivers/builtinLogDrivers.d.ts +43 -0
- package/dist/types/syslog/drivers/filterPdus.d.ts +21 -0
- package/dist/types/syslog/drivers/logDriverRegistry.d.ts +100 -0
- package/dist/types/syslog/drivers/opensearchShared.d.ts +11 -0
- package/dist/types/syslog/drivers/pduFlow.d.ts +53 -0
- package/dist/types/syslog/drivers/pduProtocol.d.ts +20 -0
- package/dist/types/syslog/httpFetch.d.ts +48 -0
- package/dist/types/syslog/logColor.d.ts +59 -0
- package/dist/types/syslog/sinks/FileSink.d.ts +78 -0
- package/dist/types/syslog/transports/BatchingHttpTransport.d.ts +59 -0
- package/dist/types/syslog/transports/ConsoleTransport.d.ts +8 -0
- package/dist/types/syslog/transports/FileTransport.d.ts +13 -0
- package/dist/types/syslog/transports/HttpTransport.d.ts +15 -0
- package/dist/types/syslog/transports/LokiTransport.d.ts +45 -0
- package/dist/types/syslog/transports/OpenSearchTransport.d.ts +40 -0
- package/dist/types/syslog/transports/SyslogTransport.d.ts +9 -0
- package/dist/types/syslog/transports/index.d.ts +12 -0
- package/dist/types/testing/index.d.ts +197 -0
- package/dist/types/types/IAdminApi.d.ts +246 -0
- package/dist/types/types/ICliKernel.d.ts +28 -0
- package/dist/types/types/ICommand.d.ts +14 -0
- package/dist/types/types/IContainer.d.ts +35 -0
- package/dist/types/types/IIdempotencyStore.d.ts +159 -0
- package/dist/types/types/IKernel.d.ts +138 -0
- package/dist/types/types/IMcpTool.d.ts +157 -0
- package/dist/types/types/IModule.d.ts +73 -0
- package/dist/types/types/IModuleManifest.d.ts +49 -0
- package/dist/types/types/IPage.d.ts +119 -0
- package/dist/types/types/IService.d.ts +62 -0
- package/dist/types/types/ISyslog.d.ts +58 -0
- package/dist/types/types/ITransport.d.ts +5 -0
- package/dist/types/types/globals.d.ts +47 -0
- package/docs/angular-services.md +318 -0
- package/docs/catalogue.md +184 -0
- package/docs/cli.md +369 -0
- package/docs/client.md +616 -0
- package/docs/debugbar.md +218 -0
- package/docs/environnement.md +308 -0
- package/docs/index.md +388 -0
- package/docs/kernel.md +670 -0
- package/docs/progression.md +228 -0
- package/docs/react-hooks.md +686 -0
- package/docs/request-context.md +507 -0
- package/docs/service.md +590 -0
- package/docs/svelte-reactivite.md +293 -0
- package/docs/syslog.md +848 -0
- package/docs/testing.md +203 -0
- package/docs/vue-composables.md +255 -0
- package/man/nodefony.1 +152 -0
- package/package.json +163 -83
- package/templates/app/agents/AGENTS.md.tpl +967 -0
- package/templates/app/agents/POINTEUR.md.tpl +12 -0
- package/templates/app/base/Dockerfile.tpl +104 -0
- package/templates/app/base/README.md.tpl +314 -0
- package/templates/app/base/dockerignore.tpl +28 -0
- package/templates/app/base/env.ts.tpl +130 -0
- package/templates/app/base/gitattributes.tpl +28 -0
- package/templates/app/base/github/workflows/ci.yml.tpl +91 -0
- package/templates/app/base/gitignore.tpl +46 -0
- package/templates/app/base/gitlab-ci.yml.tpl +42 -0
- package/templates/app/base/index.ts.tpl +69 -0
- package/templates/app/base/nodefony.config.ts.tpl +342 -0
- package/templates/app/base/oxlintrc.json.tpl +127 -0
- package/templates/app/base/package.json.tpl +75 -0
- package/templates/app/base/prettierignore.tpl +24 -0
- package/templates/app/base/prettierrc.json.tpl +12 -0
- package/templates/app/base/rolldown.config.ts.tpl +8 -0
- package/templates/app/base/tests/config.test.ts.tpl +29 -0
- package/templates/app/base/tests/e2e.setup.ts.tpl +181 -0
- package/templates/app/base/tests/e2e.test.ts.tpl +105 -0
- package/templates/app/base/tests/migrations.e2e.test.ts.tpl +579 -0
- package/templates/app/base/tsconfig.json.tpl +47 -0
- package/templates/app/base/vitest.config.ts.tpl +88 -0
- package/templates/app/base/vitest.e2e.config.ts.tpl +39 -0
- package/templates/app/complete/compose.yaml.tpl +328 -0
- package/templates/app/complete/deploy/migrate-job.yaml.tpl +100 -0
- package/templates/app/complete/docker/db/init-nodefony-e2e.sql.tpl +30 -0
- package/templates/app/complete/docker/grafana/provisioning/datasources/loki.yaml.tpl +15 -0
- package/templates/app/complete/env.local.tpl +11 -0
- package/templates/app/complete/env.tpl +53 -0
- package/templates/app/complete/nodefony/entity/User.ts.tpl +69 -0
- package/templates/app/complete/nodefony/security/provisionUsers.ts.tpl +124 -0
- package/templates/app/complete/nodefony/service/AppBannerService.ts.tpl +98 -0
- package/templates/app/complete/nodefony/service/AppInfoService.ts.tpl +85 -0
- package/templates/app/frontend/angular/frontend/src/accent.css.tpl +34 -0
- package/templates/app/frontend/angular/frontend/src/app/app.component.ts.tpl +400 -0
- package/templates/app/frontend/react/frontend/src/App.tsx.tpl +421 -0
- package/templates/app/frontend/react/frontend/src/accent.css.tpl +30 -0
- package/templates/app/frontend/shared/frontend/src/brand.ts.tpl +3 -0
- package/templates/app/frontend/shared/frontend/src/showcase.css.tpl +224 -0
- package/templates/app/frontend/shared/nodefony/controllers/AppController.ts.tpl +45 -0
- package/templates/app/frontend/svelte/frontend/src/App.svelte.tpl +371 -0
- package/templates/app/frontend/svelte/frontend/src/accent.css.tpl +34 -0
- package/templates/app/frontend/vue/frontend/src/App.vue.tpl +367 -0
- package/templates/app/frontend/vue/frontend/src/accent.css.tpl +34 -0
- package/templates/app/home/nodefony/controllers/HomeController.ts.tpl +38 -0
- package/templates/command/nodefony/command/__NAME__.ts.tpl +132 -0
- package/templates/controller/duplex/nodefony/controllers/__NAME__.ts.tpl +188 -0
- package/templates/controller/example/nodefony/controllers/__NAME__.ts.tpl +348 -0
- package/templates/controller/hello/nodefony/controllers/__NAME__.ts.tpl +143 -0
- package/templates/controller/realtime/nodefony/controllers/__NAME__.ts.tpl +153 -0
- package/templates/controller/realtime/tests/__KEBAB__-realtime.test.ts.tpl +79 -0
- package/templates/controller/rest/nodefony/controllers/__NAME__.ts.tpl +159 -0
- package/templates/entity/base/nodefony/entity/__PASCAL__.schema.ts.tpl +31 -0
- package/templates/entity/base/nodefony/entity/__PASCAL__.ts.tpl +68 -0
- package/templates/entity/controller/nodefony/controllers/__PASCAL__Controller.ts.tpl +335 -0
- package/templates/entity/service/nodefony/service/__PASCAL__Service.ts.tpl +126 -0
- package/templates/entity/tests/tests/__KEBAB__.e2e.test.ts.tpl +358 -0
- package/templates/entity/tests/tests/__KEBAB__.test.ts.tpl +87 -0
- package/templates/front/angular/frontend/src/app/app.component.ts.tpl +30 -0
- package/templates/front/base/nodefony/controllers/__NAME__.ts.tpl +60 -0
- package/templates/front/react/frontend/src/App.tsx.tpl +26 -0
- package/templates/front/svelte/frontend/src/App.svelte.tpl +19 -0
- package/templates/front/vue/frontend/src/App.vue.tpl +23 -0
- package/templates/module/ai/AGENTS.md.tpl +71 -0
- package/templates/module/base/README.md.tpl +62 -0
- package/templates/module/base/docs/index.md.tpl +55 -0
- package/templates/module/base/index.ts.tpl +50 -0
- package/templates/module/base/nodefony/config/config.ts.tpl +60 -0
- package/templates/module/base/nodefony/config/defineModuleConfig.ts.tpl +55 -0
- package/templates/module/base/nodefony/src/errors/__PASCAL__Error.ts.tpl +20 -0
- package/templates/module/base/package.json.tpl +53 -0
- package/templates/module/base/rolldown.config.ts.tpl +14 -0
- package/templates/module/base/tests/__KEBAB__.test.ts.tpl +39 -0
- package/templates/module/base/tsconfig.json.tpl +42 -0
- package/templates/module/base/vitest.config.ts.tpl +27 -0
- package/templates/module/packages/CLAUDE.md.tpl +51 -0
- package/templates/module/packages/MEMORY.md.tpl +39 -0
- package/templates/module/packages/tsconfig.declarations.json.tpl +19 -0
- package/templates/module/packages/tsconfig.tests.json.tpl +11 -0
- package/templates/module/service/nodefony/interfaces/I__PASCAL__Service.ts.tpl +14 -0
- package/templates/module/service/nodefony/interfaces/index.ts.tpl +1 -0
- package/templates/module/service/nodefony/service/__PASCAL__Service.ts.tpl +116 -0
- package/templates/service/nodefony/interfaces/I__PASCAL__Service.ts.tpl +19 -0
- package/templates/service/nodefony/service/__PASCAL__Service.ts.tpl +136 -0
- package/templates/service/tests/__PASCAL__Service.test.ts.tpl +53 -0
- package/templates/shared/front-entry/angular/frontend/src/main.ts.tpl +17 -0
- package/templates/shared/front-entry/react/frontend/src/main.tsx.tpl +11 -0
- package/templates/shared/front-entry/svelte/frontend/src/main.ts.tpl +13 -0
- package/templates/shared/front-entry/vue/frontend/src/main.ts.tpl +12 -0
- package/templates/shared/front-registrar/nodefony/frontend/register__PASCAL__Entry.ts.tpl +40 -0
- package/templates/shared/front-shell/frontend/index.html.tpl +39 -0
- package/templates/shared/ng-app-tsconfig/frontend/tsconfig.app.json.tpl +18 -0
- package/templates/shared/svelte-shim/frontend/src/env.d.ts.tpl +12 -0
- package/templates/shared/vue-shim/frontend/src/env.d.ts.tpl +15 -0
- package/.yarnclean +0 -45
- package/CHANGELOG.md +0 -406
- package/autoloader.es6 +0 -253
- package/builder.es6 +0 -366
- package/cli/builder/bundles/bundle.js +0 -328
- package/cli/builder/bundles/controller.js +0 -73
- package/cli/builder/bundles/users-bundle/.yarnclean +0 -45
- package/cli/builder/bundles/users-bundle/Command/fixtureTask.js +0 -47
- package/cli/builder/bundles/users-bundle/Command/usersCommand.js +0 -105
- package/cli/builder/bundles/users-bundle/Entity/mongoose/userEntity.js +0 -168
- package/cli/builder/bundles/users-bundle/Entity/sequelize/userEntity.js +0 -231
- package/cli/builder/bundles/users-bundle/Fixtures/users.js +0 -117
- package/cli/builder/bundles/users-bundle/Fixtures/usersFixtures.js +0 -114
- package/cli/builder/bundles/users-bundle/Resources/config/config.js +0 -90
- package/cli/builder/bundles/users-bundle/Resources/config/routing.js +0 -17
- package/cli/builder/bundles/users-bundle/Resources/config/security.js +0 -96
- package/cli/builder/bundles/users-bundle/Resources/config/services.js +0 -7
- package/cli/builder/bundles/users-bundle/Resources/config/webpack/webpack.dev.config.js +0 -13
- package/cli/builder/bundles/users-bundle/Resources/config/webpack/webpack.prod.config.js +0 -31
- package/cli/builder/bundles/users-bundle/Resources/config/webpack.config.js +0 -146
- package/cli/builder/bundles/users-bundle/Resources/js/users.js +0 -153
- package/cli/builder/bundles/users-bundle/Resources/public/favicon.ico +0 -0
- package/cli/builder/bundles/users-bundle/Resources/public/images/users-logo.png +0 -0
- package/cli/builder/bundles/users-bundle/Resources/scss/awesome/font-awesome.config.js +0 -11
- package/cli/builder/bundles/users-bundle/Resources/scss/custom.scss +0 -23
- package/cli/builder/bundles/users-bundle/Resources/scss/users.scss +0 -59
- package/cli/builder/bundles/users-bundle/Resources/swagger/openapi/login.js +0 -235
- package/cli/builder/bundles/users-bundle/Resources/swagger/openapi/users.js +0 -232
- package/cli/builder/bundles/users-bundle/Resources/translations/login.en_en.yml +0 -14
- package/cli/builder/bundles/users-bundle/Resources/translations/login.fr_fr.yml +0 -14
- package/cli/builder/bundles/users-bundle/Resources/translations/users.en_en.yml +0 -35
- package/cli/builder/bundles/users-bundle/Resources/translations/users.fr_fr.yml +0 -36
- package/cli/builder/bundles/users-bundle/Resources/views/base.html.twig +0 -32
- package/cli/builder/bundles/users-bundle/Resources/views/footer.html.twig +0 -7
- package/cli/builder/bundles/users-bundle/Resources/views/header.html.twig +0 -90
- package/cli/builder/bundles/users-bundle/Resources/views/login/login.html.twig +0 -43
- package/cli/builder/bundles/users-bundle/Resources/views/users/createUser.html.twig +0 -296
- package/cli/builder/bundles/users-bundle/Resources/views/users/readUsers.html.twig +0 -94
- package/cli/builder/bundles/users-bundle/controller/api/graphql/graphqlController.js +0 -56
- package/cli/builder/bundles/users-bundle/controller/api/graphql/userResolver.js +0 -121
- package/cli/builder/bundles/users-bundle/controller/api/graphql/usertype.js +0 -58
- package/cli/builder/bundles/users-bundle/controller/api/openapi/loginApiController.js +0 -210
- package/cli/builder/bundles/users-bundle/controller/api/openapi/restUserController.js +0 -244
- package/cli/builder/bundles/users-bundle/controller/loginController.js +0 -91
- package/cli/builder/bundles/users-bundle/controller/usersController.js +0 -332
- package/cli/builder/bundles/users-bundle/package.json +0 -58
- package/cli/builder/bundles/users-bundle/readme.md +0 -360
- package/cli/builder/bundles/users-bundle/services/usersService.js +0 -411
- package/cli/builder/bundles/users-bundle/src/providers/mongoose/userProvider.js +0 -47
- package/cli/builder/bundles/users-bundle/src/providers/sequelize/userProvider.js +0 -48
- package/cli/builder/bundles/users-bundle/tests/loginTest.js +0 -182
- package/cli/builder/bundles/users-bundle/usersBundle.js +0 -26
- package/cli/builder/microService/microService.js +0 -261
- package/cli/builder/microService/skeletons/.editorconfig +0 -18
- package/cli/builder/microService/skeletons/.env-cmdrc.js +0 -32
- package/cli/builder/microService/skeletons/.jshintrc +0 -37
- package/cli/builder/microService/skeletons/README.md +0 -117
- package/cli/builder/microService/skeletons/bin/bash/hello.sh +0 -5
- package/cli/builder/microService/skeletons/bin/cli +0 -13
- package/cli/builder/microService/skeletons/bin/python/hello.py +0 -20
- package/cli/builder/microService/skeletons/config/config.js +0 -29
- package/cli/builder/microService/skeletons/config/pm2.config.js +0 -72
- package/cli/builder/microService/skeletons/config/webpack/webpack.config.dev.js +0 -8
- package/cli/builder/microService/skeletons/config/webpack/webpack.config.prod.js +0 -25
- package/cli/builder/microService/skeletons/config/webpack.config.js +0 -114
- package/cli/builder/microService/skeletons/package.json +0 -76
- package/cli/builder/microService/skeletons/src/browser/index.css +0 -3
- package/cli/builder/microService/skeletons/src/browser/index.js +0 -16
- package/cli/builder/microService/skeletons/src/browser/socketio.js +0 -46
- package/cli/builder/microService/skeletons/src/cli/cli.js +0 -224
- package/cli/builder/microService/skeletons/src/cli/menu.js +0 -28
- package/cli/builder/microService/skeletons/src/n-api/README.md +0 -1
- package/cli/builder/microService/skeletons/src/n-api/binding.gyp +0 -14
- package/cli/builder/microService/skeletons/src/n-api/hello.cc +0 -14
- package/cli/builder/microService/skeletons/src/n-api/hello.js +0 -23
- package/cli/builder/microService/skeletons/src/n-api/package.json +0 -15
- package/cli/builder/microService/skeletons/src/node/examples/index.js +0 -120
- package/cli/builder/microService/skeletons/src/node/index.js +0 -102
- package/cli/builder/microService/skeletons/src/node/services/markdown/markdown.js +0 -27
- package/cli/builder/microService/skeletons/src/node/services/servers/http.js +0 -45
- package/cli/builder/microService/skeletons/src/node/services/servers/https.js +0 -44
- package/cli/builder/microService/skeletons/src/node/services/socketio/socketio.js +0 -46
- package/cli/builder/microService/skeletons/src/node/services/syscall/syscall.js +0 -111
- package/cli/builder/microService/skeletons/src/node/services/worker/thread.js +0 -59
- package/cli/builder/microService/skeletons/src/node/services/worker/worker.js +0 -60
- package/cli/builder/microService/skeletons/src/templates/base.html +0 -12
- package/cli/builder/microService/skeletons/src/templates/socket.html +0 -23
- package/cli/builder/microService/skeletons/tests/unit/serviceTest.js +0 -30
- package/cli/builder/project/project.js +0 -474
- package/cli/builder/project/skeletons/README.md +0 -778
- package/cli/builder/project/skeletons/bin/dev-deploy.sh +0 -5
- package/cli/builder/project/skeletons/bin/generateCertificates.sh.skeleton +0 -180
- package/cli/builder/project/skeletons/bin/prod-deploy.sh +0 -3
- package/cli/builder/project/skeletons/config/config.js.skeleton +0 -178
- package/cli/builder/project/skeletons/config/openssl/ca/openssl.cnf.skeleton +0 -150
- package/cli/builder/project/skeletons/config/openssl/ca_intermediate/openssl.cnf.skeleton +0 -152
- package/cli/builder/project/skeletons/config/pm2.config.js.skeleton +0 -62
- package/cli/builder/project/skeletons/documentation.html.twig +0 -24
- package/cli/builder/project/skeletons/editorconfig.skeleton +0 -18
- package/cli/builder/project/skeletons/eslintignore.skeleton +0 -15
- package/cli/builder/project/skeletons/eslintrc.js.skeleton +0 -97
- package/cli/builder/project/skeletons/gitignore.skeleton +0 -32
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.37.entity-user.js +0 -137
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.38.entity-session.js +0 -97
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.39.entity-requests.js +0 -115
- package/cli/builder/project/skeletons/migrations/2022.12.25T17.37.40.entity-jwts.js +0 -97
- package/cli/builder/project/skeletons/migrations/migrations.skeleton.js +0 -101
- package/cli/builder/project/skeletons/package.json.twig +0 -71
- package/cli/builder/react/reactBuilder.js +0 -224
- package/cli/builder/react/skeletons/app/Resources/databases/nodefony.db +0 -0
- package/cli/builder/react/skeletons/app/Resources/translations/messages.en_en.yml +0 -5
- package/cli/builder/react/skeletons/app/Resources/translations/messages.fr_fr.yml +0 -5
- package/cli/builder/react/skeletons/app/Resources/views/base.html.twig +0 -33
- package/cli/builder/react/skeletons/app/config/config.js +0 -392
- package/cli/builder/react/skeletons/app/config/routing.js +0 -10
- package/cli/builder/react/skeletons/app/config/security.js +0 -74
- package/cli/builder/react/skeletons/app/controller/appController.js +0 -22
- package/cli/builder/sandbox/sandBoxBuilder.js +0 -610
- package/cli/builder/sandbox/skeletons/Resources/css/entry.css +0 -48
- package/cli/builder/sandbox/skeletons/Resources/js/entry.js +0 -60
- package/cli/builder/sandbox/skeletons/Resources/public/manifest.json +0 -32
- package/cli/builder/sandbox/skeletons/Resources/translations/messages.en_en.yml +0 -5
- package/cli/builder/sandbox/skeletons/Resources/translations/messages.fr_fr.yml +0 -5
- package/cli/builder/sandbox/skeletons/Resources/views/base.html.twig +0 -46
- package/cli/builder/sandbox/skeletons/Resources/views/index.html.twig +0 -34
- package/cli/builder/sandbox/skeletons/bootstrap/custom.scss +0 -27
- package/cli/builder/sandbox/skeletons/bootstrap/entry.scss +0 -60
- package/cli/builder/sandbox/skeletons/workbox/templates/index.html.twig +0 -32
- package/cli/builder/sandbox/skeletons/workbox/workers/service-worker.js +0 -196
- package/cli/builder/skeletons/Resources/public/favicon.ico +0 -0
- package/cli/builder/skeletons/Resources/public/images/app-logo.png +0 -0
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/401.html.twig +0 -1
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/401.json.twig +0 -24
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/403.html.twig +0 -1
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/403.json.twig +0 -20
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/404.html.twig +0 -1
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/404.json.twig +0 -20
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/500.html.twig +0 -1
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/base.html.twig +0 -30
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/exception.html.twig +0 -1
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/exception.json.twig +0 -24
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/footer.html.twig +0 -33
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/header.html.twig +0 -6
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/index.html.twig +0 -6
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/index.json.twig +0 -1
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/layout.html.twig +0 -125
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/layout.json.twig +0 -5
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/timeout.html.twig +0 -1
- package/cli/builder/skeletons/Resources/views/framework-bundle/views/timeout.json.twig +0 -24
- package/cli/builder/skeletons/app/appKernel.js +0 -133
- package/cli/builder/skeletons/binding/binding.cc +0 -26
- package/cli/builder/skeletons/binding/binding.skeleton +0 -8
- package/cli/builder/skeletons/bundle/bundleClass.js +0 -37
- package/cli/builder/skeletons/command/commandClass.js +0 -11
- package/cli/builder/skeletons/command/taskClass.js +0 -20
- package/cli/builder/skeletons/config/config.js +0 -138
- package/cli/builder/skeletons/config/nodefony/elastic-bundle.js +0 -37
- package/cli/builder/skeletons/config/nodefony/framework-bundle.js +0 -22
- package/cli/builder/skeletons/config/nodefony/http-bundle.js +0 -104
- package/cli/builder/skeletons/config/nodefony/mail-bundle.js +0 -44
- package/cli/builder/skeletons/config/nodefony/mongoose-bundle.js +0 -51
- package/cli/builder/skeletons/config/nodefony/monitoring-bundle.js +0 -34
- package/cli/builder/skeletons/config/nodefony/realtime-bundle.js +0 -15
- package/cli/builder/skeletons/config/nodefony/redis-bundle.js +0 -44
- package/cli/builder/skeletons/config/nodefony/security-bundle.js +0 -25
- package/cli/builder/skeletons/config/nodefony/sequelize-bundle.js +0 -156
- package/cli/builder/skeletons/config/routing.js +0 -55
- package/cli/builder/skeletons/config/security.js +0 -102
- package/cli/builder/skeletons/config/services.js +0 -1
- package/cli/builder/skeletons/config/webpack/webpack.dev.config.js +0 -13
- package/cli/builder/skeletons/config/webpack/webpack.prod.config.js +0 -20
- package/cli/builder/skeletons/config/webpack.config.js +0 -148
- package/cli/builder/skeletons/controller/controllerClass.js +0 -75
- package/cli/builder/skeletons/package.json.twig +0 -57
- package/cli/builder/skeletons/unittest/testFile.js +0 -46
- package/cli/builder/vue/skeletons/Resources/public/images/app-logo.png +0 -0
- package/cli/builder/vue/skeletons/Resources/translations/messages.en_en.yml +0 -5
- package/cli/builder/vue/skeletons/Resources/translations/messages.fr_fr.yml +0 -5
- package/cli/builder/vue/skeletons/vue.config.js +0 -129
- package/cli/builder/vue/vueBuilder.js +0 -410
- package/cli/generate/generate.es6 +0 -103
- package/cli/install/install.js +0 -190
- package/cli/sequelize/sequelize.js +0 -94
- package/cli/start.js +0 -702
- package/cli/tools/pm2.es6 +0 -112
- package/cli/tools/tools.es6 +0 -97
- package/cli.es6 +0 -925
- package/container.es6 +0 -272
- package/error.es6 +0 -293
- package/fileClass.es6 +0 -242
- package/finder/file.es6 +0 -33
- package/finder/fileResult.es6 +0 -138
- package/finder/finder2.es6 +0 -275
- package/finder.es6 +0 -427
- package/kernel/annotations/annotations.es6 +0 -286
- package/kernel/api/api.es6 +0 -61
- package/kernel/api/graphqlApi.es6 +0 -107
- package/kernel/api/jsonApi.es6 +0 -177
- package/kernel/api/openApi.es6 +0 -139
- package/kernel/api/schemas/openApiSchema.js +0 -394
- package/kernel/babylon.es6 +0 -162
- package/kernel/bundle.es6 +0 -1200
- package/kernel/cliKernel.es6 +0 -869
- package/kernel/command.es6 +0 -78
- package/kernel/commands/nodefonyCommand.es6 +0 -247
- package/kernel/commands/tasks/bundlesTask.es6 +0 -59
- package/kernel/controllers/controller.es6 +0 -791
- package/kernel/fixture.es6 +0 -19
- package/kernel/injections/injections.es6 +0 -424
- package/kernel/kernel.es6 +0 -1960
- package/kernel/kernelWatcher.es6 +0 -387
- package/kernel/orm/entity.es6 +0 -59
- package/kernel/orm/orm.es6 +0 -139
- package/kernel/reader.es6 +0 -290
- package/kernel/security/encoder.es6 +0 -17
- package/kernel/security/factories/factory.es6 +0 -111
- package/kernel/security/factories/passeportFactory.es6 +0 -61
- package/kernel/security/provider.es6 +0 -58
- package/kernel/security/providers/chainProvider.es6 +0 -99
- package/kernel/security/providers/memoryProvider.es6 +0 -55
- package/kernel/security/providers/providerManager.es6 +0 -67
- package/kernel/security/providers/userEntityProvider.es6 +0 -50
- package/kernel/security/role.es6 +0 -12
- package/kernel/security/secureArea.es6 +0 -431
- package/kernel/security/tokens/token.es6 +0 -171
- package/kernel/security/user.es6 +0 -106
- package/kernel/serviceRealTime.es6 +0 -21
- package/kernel/services/connectionsService.es6 +0 -93
- package/kernel/services/cron/cronService.es6 +0 -123
- package/kernel/task.es6 +0 -80
- package/kernel/templates.es6 +0 -22
- package/kernel/templating/twig.es6 +0 -218
- package/kernel/tests/cliTest.js +0 -59
- package/kernel/tests/containerTest.js +0 -232
- package/kernel/tests/kernelTest.js +0 -39
- package/nodefony.es6 +0 -1084
- package/notificationsCenter.es6 +0 -118
- package/protocol.es6 +0 -86
- package/protocols/bayeux.es6 +0 -174
- package/protocols/jsonRpc/jsonrpc.es6 +0 -56
- package/result.es6 +0 -99
- package/service.es6 +0 -288
- package/syslog/pdu.es6 +0 -141
- package/syslog/syslog.es6 +0 -754
- package/watcher.es6 +0 -113
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { CLUSTER_PROBE_ENRICH_KIND, CLUSTER_PROBE_SNAPSHOT_KIND, isClusterMessage, isClusterProbeCtl } from "./clusterMessage.js";
|
|
2
|
+
//#region src/service/cluster/ClusterProbeAggregator.ts
|
|
3
|
+
/**
|
|
4
|
+
* **Agrégateur de sondes** master-side du mode cluster (Phase 4c) — le « gardien » qui
|
|
5
|
+
* collecte la santé de chaque worker et **rediffuse la vue d'ensemble** à tous.
|
|
6
|
+
*
|
|
7
|
+
* Pourquoi : chaque worker n'a que SA sonde (`RealtimeHub.probe()`) ; l'endpoint
|
|
8
|
+
* `/nodefony/realtime/api/health` tombe sur UN worker au hasard → vue partielle. Le master
|
|
9
|
+
* (qui ne sert aucun HTTP) collecte les remontées `CLUSTER_PROBE_KIND` de tous les workers
|
|
10
|
+
* et **pousse** périodiquement le snapshot agrégé (`CLUSTER_PROBE_SNAPSHOT_KIND`) vers chacun
|
|
11
|
+
* → n'importe quel worker peut alors servir la vue POD instantanément (modèle push, pas pull :
|
|
12
|
+
* 0 latence de requête, cohérent avec les tickers Nodefony).
|
|
13
|
+
*
|
|
14
|
+
* **Opaque** comme le {@link "./ClusterRelay"} : le master ne lit JAMAIS le contenu d'une
|
|
15
|
+
* sonde (il garde le dernier payload par workerId et diffuse la liste) → 0 dépendance à
|
|
16
|
+
* `@nodefony/framework` (la consolidation des champs se fait côté worker, qui connaît le type).
|
|
17
|
+
*
|
|
18
|
+
* Cycle de vie d'un worker : `attach` au `fork` (collecte ses remontées), `detach` au `exit`
|
|
19
|
+
* (le worker mort SORT de l'agrégat → le snapshot suivant ne le contient plus). Diffusion
|
|
20
|
+
* sur timer `unref` (cloud-native).
|
|
21
|
+
*/
|
|
22
|
+
var ClusterProbeAggregator = class {
|
|
23
|
+
#workers = /* @__PURE__ */ new Map();
|
|
24
|
+
/** pid → worker (ciblage du drill-down Phase 2 ; le front identifie un worker par pid). */
|
|
25
|
+
#byPid = /* @__PURE__ */ new Map();
|
|
26
|
+
/** workerId → dernier payload de sonde (opaque). */
|
|
27
|
+
#probes = /* @__PURE__ */ new Map();
|
|
28
|
+
#intervalMs;
|
|
29
|
+
#log;
|
|
30
|
+
#timer = null;
|
|
31
|
+
#broadcastTotal = 0;
|
|
32
|
+
constructor(opts = {}) {
|
|
33
|
+
this.#intervalMs = opts.intervalMs ?? 2e3;
|
|
34
|
+
this.#log = opts.log ?? (() => {});
|
|
35
|
+
}
|
|
36
|
+
/** Nombre de workers rattachés. */
|
|
37
|
+
get size() {
|
|
38
|
+
return this.#workers.size;
|
|
39
|
+
}
|
|
40
|
+
/** Total de snapshots diffusés (sonde de la gateway). */
|
|
41
|
+
get broadcastTotal() {
|
|
42
|
+
return this.#broadcastTotal;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Rattache un worker : cible de diffusion + récepteur de ses remontées de sonde.
|
|
46
|
+
* Idempotent par `id` (un respawn réattache proprement).
|
|
47
|
+
*/
|
|
48
|
+
attach(worker) {
|
|
49
|
+
this.#workers.set(worker.id, worker);
|
|
50
|
+
this.#byPid.set(worker.pid, worker);
|
|
51
|
+
worker.onMessage((msg) => this.#collect(worker.id, msg));
|
|
52
|
+
}
|
|
53
|
+
/** Détache un worker (au `exit`) : il sort de l'agrégat. No-op s'il est déjà parti. */
|
|
54
|
+
detach(id) {
|
|
55
|
+
const w = this.#workers.get(id);
|
|
56
|
+
if (w) this.#byPid.delete(w.pid);
|
|
57
|
+
this.#workers.delete(id);
|
|
58
|
+
this.#probes.delete(id);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Traite un message d'un worker. Deux usages sur le canal partagé :
|
|
62
|
+
* - **remontée de sonde** (`CLUSTER_PROBE_KIND`) → mémorise le dernier payload (opaque) ;
|
|
63
|
+
* - **ordre d'enrichissement** (`CLUSTER_PROBE_CTL_KIND`, drill-down Phase 2) émis par le
|
|
64
|
+
* worker qui tient le navigateur → **route ciblé** vers le worker `pid` concerné
|
|
65
|
+
* (`CLUSTER_PROBE_ENRICH_KIND`). Le master ne lit toujours PAS le contenu d'une sonde
|
|
66
|
+
* (opacité), il route juste l'ordre via la map pid→worker. Autres kinds / malformés ignorés.
|
|
67
|
+
*/
|
|
68
|
+
#collect(fromId, msg) {
|
|
69
|
+
if (isClusterProbeCtl(msg)) {
|
|
70
|
+
this.#byPid.get(msg.pid)?.send({
|
|
71
|
+
kind: CLUSTER_PROBE_ENRICH_KIND,
|
|
72
|
+
enabled: msg.op === "enrich",
|
|
73
|
+
facet: msg.facet ?? "process"
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!isClusterMessage(msg) || msg.kind !== "nf:probe") return;
|
|
78
|
+
this.#probes.set(fromId, msg.payload);
|
|
79
|
+
}
|
|
80
|
+
/** Démarre la diffusion périodique du snapshot agrégé. Idempotent. Timer `unref`. */
|
|
81
|
+
start() {
|
|
82
|
+
if (this.#timer !== null) return;
|
|
83
|
+
this.#log(`probe aggregator: diffusion snapshot toutes les ${this.#intervalMs}ms`, "DEBUG");
|
|
84
|
+
this.#timer = setInterval(() => this.broadcast(), this.#intervalMs);
|
|
85
|
+
this.#timer.unref?.();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Diffuse immédiatement le snapshot courant (liste des dernières sondes connues) à
|
|
89
|
+
* tous les workers vivants. Appelable directement (tests) ou par le timer. N'envoie
|
|
90
|
+
* rien s'il n'y a aucun worker.
|
|
91
|
+
*/
|
|
92
|
+
broadcast() {
|
|
93
|
+
if (this.#workers.size === 0) return;
|
|
94
|
+
const snap = {
|
|
95
|
+
kind: CLUSTER_PROBE_SNAPSHOT_KIND,
|
|
96
|
+
ts: Date.now(),
|
|
97
|
+
instances: [...this.#probes.values()]
|
|
98
|
+
};
|
|
99
|
+
for (const w of this.#workers.values()) try {
|
|
100
|
+
w.send(snap);
|
|
101
|
+
} catch {}
|
|
102
|
+
this.#broadcastTotal += 1;
|
|
103
|
+
}
|
|
104
|
+
/** Arrête le timer de diffusion. Idempotent. */
|
|
105
|
+
stop() {
|
|
106
|
+
if (this.#timer !== null) {
|
|
107
|
+
clearInterval(this.#timer);
|
|
108
|
+
this.#timer = null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Vide l'agrégateur (arrêt du master). */
|
|
112
|
+
clear() {
|
|
113
|
+
this.stop();
|
|
114
|
+
this.#workers.clear();
|
|
115
|
+
this.#byPid.clear();
|
|
116
|
+
this.#probes.clear();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
//#endregion
|
|
120
|
+
export { ClusterProbeAggregator, ClusterProbeAggregator as default };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { isClusterMessage } from "./clusterMessage.js";
|
|
2
|
+
//#region src/service/cluster/ClusterRelay.ts
|
|
3
|
+
/**
|
|
4
|
+
* **Master-gateway** du backplane realtime cluster (Phase 3) — routeur IPC qui vit dans
|
|
5
|
+
* le process MASTER (lequel ne sert AUCUN HTTP, cf {@link ClusterManager}).
|
|
6
|
+
*
|
|
7
|
+
* Les workers d'un cluster Node natif ne se parlent **jamais** directement : un worker
|
|
8
|
+
* n'envoie qu'au master. Le relay reçoit les publications realtime d'un worker et les
|
|
9
|
+
* **rebroadcast aux AUTRES** workers — ce qui réalise le fan-out cross-process intra-pod
|
|
10
|
+
* « comme si Redis était là », sans aucune infra (cf vision cluster-backplane).
|
|
11
|
+
*
|
|
12
|
+
* Anti-echo de routage : le message **n'est jamais renvoyé à sa source** (le worker
|
|
13
|
+
* filtre AUSSI son `originId` côté `ClusterBackplane` — ceinture + bretelles).
|
|
14
|
+
*
|
|
15
|
+
* Tri par `kind` : seuls les messages realtime (`CLUSTER_RT_KIND`) sont rebroadcastés.
|
|
16
|
+
* Les autres messages de contrôle (ex. remontées de sondes à **agréger** au master,
|
|
17
|
+
* Phase 4) sont laissés à un autre consommateur — le relay les ignore (il ne les fan-out
|
|
18
|
+
* surtout PAS). Messages malformés ignorés silencieusement (robustesse IPC).
|
|
19
|
+
*
|
|
20
|
+
* Le master ne tient aucun hub realtime : il route des messages **opaques** (`channel`,
|
|
21
|
+
* `payload`, `originId` ne sont pas inspectés) → 0 dépendance à `@nodefony/framework`
|
|
22
|
+
* (respect du sens des dépendances framework→core).
|
|
23
|
+
*/
|
|
24
|
+
var ClusterRelay = class {
|
|
25
|
+
#workers = /* @__PURE__ */ new Map();
|
|
26
|
+
#log;
|
|
27
|
+
#relayedTotal = 0;
|
|
28
|
+
constructor(opts = {}) {
|
|
29
|
+
this.#log = opts.log ?? (() => {});
|
|
30
|
+
}
|
|
31
|
+
/** Nombre de workers actuellement rattachés au relay. */
|
|
32
|
+
get size() {
|
|
33
|
+
return this.#workers.size;
|
|
34
|
+
}
|
|
35
|
+
/** Total des messages realtime rebroadcastés (sonde gateway). */
|
|
36
|
+
get relayedTotal() {
|
|
37
|
+
return this.#relayedTotal;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Rattache un worker : l'enregistre comme cible de broadcast et branche la réception
|
|
41
|
+
* de ses messages. Idempotent par `id` (un respawn réattache proprement). À appeler
|
|
42
|
+
* au `fork` (et à chaque respawn) côté ClusterManager.
|
|
43
|
+
*/
|
|
44
|
+
attach(worker) {
|
|
45
|
+
this.#workers.set(worker.id, worker);
|
|
46
|
+
worker.onMessage((msg) => this.#route(worker.id, msg));
|
|
47
|
+
this.#log(`relay: worker ${worker.id} attaché au fan-out (${this.#workers.size} au total)`, "DEBUG");
|
|
48
|
+
}
|
|
49
|
+
/** Détache un worker (au `exit`). No-op s'il est déjà parti. */
|
|
50
|
+
detach(id) {
|
|
51
|
+
this.#workers.delete(id);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Route un message reçu du worker `fromId` : si c'est une publication realtime, la
|
|
55
|
+
* rebroadcast à tous les **autres** workers vivants. Sinon, ignore (autre kind /
|
|
56
|
+
* malformé). N'alloue rien sur le chemin (réutilise le message IPC tel quel).
|
|
57
|
+
*/
|
|
58
|
+
#route(fromId, msg) {
|
|
59
|
+
if (!isClusterMessage(msg) || msg.kind !== "nf:rt") return;
|
|
60
|
+
for (const [id, w] of this.#workers) {
|
|
61
|
+
if (id === fromId) continue;
|
|
62
|
+
try {
|
|
63
|
+
w.send(msg);
|
|
64
|
+
} catch {}
|
|
65
|
+
}
|
|
66
|
+
this.#relayedTotal += 1;
|
|
67
|
+
}
|
|
68
|
+
/** Vide le relay (arrêt du master). Les workers sont tués par le ClusterManager. */
|
|
69
|
+
clear() {
|
|
70
|
+
this.#workers.clear();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { ClusterRelay, ClusterRelay as default };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ClusterManager } from "./ClusterManager.js";
|
|
2
|
+
import { ClusterRelay } from "./ClusterRelay.js";
|
|
3
|
+
import { ClusterProbeAggregator } from "./ClusterProbeAggregator.js";
|
|
4
|
+
import cluster from "node:cluster";
|
|
5
|
+
//#region src/service/cluster/clusterMaster.ts
|
|
6
|
+
/**
|
|
7
|
+
* Démarre le process MASTER d'un cluster multi-worker — bootstrap partagé par les
|
|
8
|
+
* commandes de lancement (`cluster` et `production`).
|
|
9
|
+
*
|
|
10
|
+
* Le master ne sert **aucun HTTP** : il est superviseur + gateway IPC. Il
|
|
11
|
+
* 1. marque `NF_CLUSTER=1` (hérité au fork → le module Framework branche le
|
|
12
|
+
* ClusterBackplane sur son RealtimeHub),
|
|
13
|
+
* 2. branche le {@link ClusterRelay} (fan-out realtime cross-process intra-pod) et,
|
|
14
|
+
* sauf `NF_CLUSTER_PROBE=0`, le {@link ClusterProbeAggregator} (vue pod, push),
|
|
15
|
+
* 3. fork N workers via {@link ClusterManager} (respawn backoff + graceful shutdown).
|
|
16
|
+
*
|
|
17
|
+
* Les handlers `fork`/`exit` GLOBAUX couvrent forks initiaux ET respawns → un worker
|
|
18
|
+
* relancé est (ré)attaché. Attachés AVANT `manager.start()` (aucun fork manqué).
|
|
19
|
+
*
|
|
20
|
+
* ⚠️ À appeler uniquement quand `cluster.isPrimary` ET `workers >= 2` (le mono-process
|
|
21
|
+
* `workers: 1` ne passe jamais par ici — zéro machinerie cluster).
|
|
22
|
+
*
|
|
23
|
+
* @param opts.workers - nombre de workers à forker (déjà résolu, `>= 2`).
|
|
24
|
+
* @param opts.log - logger (msg + sévérité).
|
|
25
|
+
* @returns les poignées vivantes (manager/relay/probes) à conserver par l'appelant.
|
|
26
|
+
*/
|
|
27
|
+
function startClusterMaster(opts) {
|
|
28
|
+
const { workers, log } = opts;
|
|
29
|
+
process.title = `nodefony master [cluster ${workers}w]`;
|
|
30
|
+
process.env.NF_CLUSTER = "1";
|
|
31
|
+
const relay = new ClusterRelay({ log });
|
|
32
|
+
const probes = process.env.NF_CLUSTER_PROBE !== "0" ? new ClusterProbeAggregator({ log }) : null;
|
|
33
|
+
cluster.on("fork", (w) => {
|
|
34
|
+
const handle = {
|
|
35
|
+
id: w.id,
|
|
36
|
+
pid: w.process?.pid ?? -1,
|
|
37
|
+
send: (m) => {
|
|
38
|
+
try {
|
|
39
|
+
w.send(m);
|
|
40
|
+
} catch {}
|
|
41
|
+
},
|
|
42
|
+
onMessage: (cb) => w.on("message", cb)
|
|
43
|
+
};
|
|
44
|
+
relay.attach(handle);
|
|
45
|
+
probes?.attach(handle);
|
|
46
|
+
});
|
|
47
|
+
cluster.on("exit", (w) => {
|
|
48
|
+
relay.detach(w.id);
|
|
49
|
+
probes?.detach(w.id);
|
|
50
|
+
});
|
|
51
|
+
probes?.start();
|
|
52
|
+
const manager = new ClusterManager({
|
|
53
|
+
workers,
|
|
54
|
+
log
|
|
55
|
+
});
|
|
56
|
+
manager.start();
|
|
57
|
+
manager.installSignalHandlers();
|
|
58
|
+
return {
|
|
59
|
+
manager,
|
|
60
|
+
relay,
|
|
61
|
+
probes
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { startClusterMaster };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//#region src/service/cluster/clusterMessage.ts
|
|
2
|
+
/**
|
|
3
|
+
* Protocole de fil IPC du cluster Nodefony (mode sans PM2).
|
|
4
|
+
*
|
|
5
|
+
* Le master est le **gateway** : tout message worker↔worker transite par lui via IPC
|
|
6
|
+
* (`process.send` côté worker / `worker.send` côté master). Ce canal IPC est **partagé**
|
|
7
|
+
* par plusieurs usages (publications realtime, et — Phase 4 — remontées de sondes à
|
|
8
|
+
* agréger). Un **discriminant `kind`** permet à chaque consommateur (relay realtime,
|
|
9
|
+
* agrégateur de sondes) de ne traiter que ce qui le concerne.
|
|
10
|
+
*
|
|
11
|
+
* Ce protocole vit dans le **core** (et non dans `@nodefony/framework`) car le gateway
|
|
12
|
+
* est un composant core et le core est la dépendance commune : le worker realtime
|
|
13
|
+
* (`ClusterBackplane`, framework) importe `CLUSTER_RT_KIND` d'ici via `"nodefony"`, le
|
|
14
|
+
* master (`ClusterRelay`, core) l'utilise aussi → **une seule source**, pas de magic
|
|
15
|
+
* string dupliqué (anti-drift).
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* `kind` d'une publication **realtime** (port `IBackplane`). Le {@link "./ClusterRelay"}
|
|
19
|
+
* rebroadcast ces messages aux **autres** workers ; le `ClusterBackplane` (framework)
|
|
20
|
+
* les produit/consomme.
|
|
21
|
+
*/
|
|
22
|
+
const CLUSTER_RT_KIND = "nf:rt";
|
|
23
|
+
/**
|
|
24
|
+
* `kind` d'une **remontée de sonde** worker → master (Phase 4c). Chaque worker envoie
|
|
25
|
+
* périodiquement sa santé per-instance (opaque pour le master) ; le
|
|
26
|
+
* {@link "./ClusterProbeAggregator"} les collecte. Le {@link "./ClusterRelay"} IGNORE
|
|
27
|
+
* ce kind (ce n'est pas une publication realtime à rebroadcaster).
|
|
28
|
+
*/
|
|
29
|
+
const CLUSTER_PROBE_KIND = "nf:probe";
|
|
30
|
+
/**
|
|
31
|
+
* `kind` du **snapshot agrégé** master → workers (Phase 4c). Le master diffuse
|
|
32
|
+
* périodiquement la liste des sondes de TOUS les workers (`{ ts, instances }`) ; chaque
|
|
33
|
+
* worker la met en cache pour servir la vue POD sur son endpoint santé (push, pas pull).
|
|
34
|
+
*/
|
|
35
|
+
const CLUSTER_PROBE_SNAPSHOT_KIND = "nf:probe:snap";
|
|
36
|
+
/**
|
|
37
|
+
* `kind` d'un **ordre d'enrichissement** worker → master (Phase 2 drill-down). Un worker
|
|
38
|
+
* (celui qui tient la connexion navigateur) demande au master d'activer/couper la sonde
|
|
39
|
+
* **riche** (GC/heap-spaces/handles/ELU/ctx — cf `RichProcessProbe`) sur le worker `pid`
|
|
40
|
+
* ciblé. Routé par le {@link "./ClusterProbeAggregator"} vers ce worker via {@link
|
|
41
|
+
* CLUSTER_PROBE_ENRICH_KIND}. « On paie ce qu'on regarde » : aucun rich produit hors drill.
|
|
42
|
+
*/
|
|
43
|
+
const CLUSTER_PROBE_CTL_KIND = "nf:probe:ctl";
|
|
44
|
+
/**
|
|
45
|
+
* `kind` de l'**ordre ciblé** master → worker (Phase 2 drill-down). Dit au worker
|
|
46
|
+
* d'inclure (ou non) son blob de sonde **riche** dans son report périodique
|
|
47
|
+
* (`CLUSTER_PROBE_KIND`). Le rich voyage ensuite dans le snapshot agrégé EXISTANT
|
|
48
|
+
* (aucun nouveau flux de données — juste un champ `rich` de plus pour ce worker).
|
|
49
|
+
*/
|
|
50
|
+
const CLUSTER_PROBE_ENRICH_KIND = "nf:probe:enrich";
|
|
51
|
+
/** `true` si `f` est une facette valide ou absente (absente ⇒ défaut `"process"`). */
|
|
52
|
+
function isValidFacet(f) {
|
|
53
|
+
return f === void 0 || f === "process" || f === "orm";
|
|
54
|
+
}
|
|
55
|
+
/** Type-guard d'un {@link IClusterProbeCtl} — narrowing sûr du canal IPC partagé. */
|
|
56
|
+
function isClusterProbeCtl(m) {
|
|
57
|
+
if (!isClusterMessage(m) || m.kind !== "nf:probe:ctl") return false;
|
|
58
|
+
const c = m;
|
|
59
|
+
return (c.op === "enrich" || c.op === "stop") && typeof c.pid === "number" && isValidFacet(c.facet);
|
|
60
|
+
}
|
|
61
|
+
/** Type-guard d'un {@link IClusterProbeEnrich} — narrowing sûr du canal IPC partagé. */
|
|
62
|
+
function isClusterProbeEnrich(m) {
|
|
63
|
+
return isClusterMessage(m) && m.kind === "nf:probe:enrich" && typeof m.enabled === "boolean" && isValidFacet(m.facet);
|
|
64
|
+
}
|
|
65
|
+
/** Type-guard d'un message IPC cluster — narrowing sûr d'un message `unknown` du canal partagé. */
|
|
66
|
+
function isClusterMessage(m) {
|
|
67
|
+
return typeof m === "object" && m !== null && typeof m.kind === "string";
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { CLUSTER_PROBE_CTL_KIND, CLUSTER_PROBE_ENRICH_KIND, CLUSTER_PROBE_KIND, CLUSTER_PROBE_SNAPSHOT_KIND, CLUSTER_RT_KIND, CLUSTER_RT_KIND as default, isClusterMessage, isClusterProbeCtl, isClusterProbeEnrich };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
//#region src/service/cluster/cpuQuota.ts
|
|
4
|
+
/** Lecteur par défaut : lecture synchrone, `null` au lieu de throw (fichier cgroup absent hors conteneur). */
|
|
5
|
+
const defaultRead = (path) => {
|
|
6
|
+
try {
|
|
7
|
+
return fs.readFileSync(path, "utf8");
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Lit le quota CPU effectif depuis les cgroups Linux — cgroup v2 (`cpu.max`) puis
|
|
14
|
+
* v1 (`cpu.cfs_quota_us` / `cpu.cfs_period_us`).
|
|
15
|
+
*
|
|
16
|
+
* C'est LA correction du bug de l'ancien cluster JS : `os.cpus().length` lit l'hôte
|
|
17
|
+
* (ex. 64 cœurs) et IGNORE la limite cgroup du conteneur (ex. 2 cœurs) → fork de 64
|
|
18
|
+
* workers throttlés + OOM. Le quota cgroup est la seule source de vérité en conteneur.
|
|
19
|
+
*
|
|
20
|
+
* @param read - lecteur de fichier injectable (tests). Défaut : `fs.readFileSync`.
|
|
21
|
+
* @returns le nombre de cœurs alloués (fractionnaire possible, ex. `0.5`, `2.5`), ou
|
|
22
|
+
* `null` si illimité (`max`) / cgroup absent (hors conteneur ou non-Linux).
|
|
23
|
+
*/
|
|
24
|
+
function readCgroupCpuQuota(read = defaultRead) {
|
|
25
|
+
const v2 = read("/sys/fs/cgroup/cpu.max");
|
|
26
|
+
if (v2 !== null) {
|
|
27
|
+
const [quota, period] = v2.trim().split(/\s+/);
|
|
28
|
+
if (quota === "max") return null;
|
|
29
|
+
const q = Number(quota);
|
|
30
|
+
const p = Number(period);
|
|
31
|
+
return q > 0 && p > 0 ? q / p : null;
|
|
32
|
+
}
|
|
33
|
+
const quotaStr = read("/sys/fs/cgroup/cpu/cpu.cfs_quota_us");
|
|
34
|
+
const periodStr = read("/sys/fs/cgroup/cpu/cpu.cfs_period_us");
|
|
35
|
+
if (quotaStr !== null && periodStr !== null) {
|
|
36
|
+
const q = Number(quotaStr.trim());
|
|
37
|
+
const p = Number(periodStr.trim());
|
|
38
|
+
if (q > 0 && p > 0) return q / p;
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Résout le nombre de workers à forker, dans l'ordre de priorité :
|
|
44
|
+
*
|
|
45
|
+
* 1. `requested` explicite (`--workers N`) si `> 0` — honoré **tel quel**, jamais borné.
|
|
46
|
+
* 2. Quota CPU cgroup (conteneur) → arrondi au plus proche, borné par le parallélisme schedulable.
|
|
47
|
+
* 3. `os.availableParallelism()` (Node 19+, respecte l'affinité CPU) — fallback hors conteneur.
|
|
48
|
+
*
|
|
49
|
+
* @returns un entier `>= 1` (jamais 0).
|
|
50
|
+
*/
|
|
51
|
+
function resolveWorkerCount(opts = {}) {
|
|
52
|
+
if (opts.requested !== void 0 && Number.isFinite(opts.requested) && opts.requested > 0) return Math.max(1, Math.floor(opts.requested));
|
|
53
|
+
const parallelism = opts.availableParallelism ?? os.availableParallelism();
|
|
54
|
+
const quota = opts.cgroupQuota !== void 0 ? opts.cgroupQuota : readCgroupCpuQuota();
|
|
55
|
+
if (quota !== null && quota > 0) return Math.max(1, Math.min(Math.round(quota), parallelism));
|
|
56
|
+
return Math.max(1, parallelism);
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { readCgroupCpuQuota, resolveWorkerCount };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//#region src/service/cluster/instanceProbe.ts
|
|
2
|
+
/**
|
|
3
|
+
* Seam ORM : fournisseur de la santé ORM lean du process. Branché par le **module driver**
|
|
4
|
+
* (Drizzle/Mongoose) à son boot ; lu par l'assembleur du report (framework).
|
|
5
|
+
* `null` par défaut → 0 coût et `readOrmHealth()` renvoie `null` (pas d'ORM → champ omis).
|
|
6
|
+
*/
|
|
7
|
+
let _ormHealthProvider = null;
|
|
8
|
+
/**
|
|
9
|
+
* Branche (ou débranche avec `null`) le fournisseur de santé ORM lean. Idempotent
|
|
10
|
+
* (dernier gagne) — plusieurs drivers branchant la même fonction globale est sûr.
|
|
11
|
+
*
|
|
12
|
+
* @param fn - lecture lean de la santé ORM du process, ou `null` pour débrancher.
|
|
13
|
+
*/
|
|
14
|
+
function setOrmHealthProvider(fn) {
|
|
15
|
+
_ormHealthProvider = fn;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Lit la santé ORM lean du process via le fournisseur branché, ou `null` si aucun ORM
|
|
19
|
+
* n'est branché (le champ `orm` du report est alors omis). Lecture pure, jamais throw.
|
|
20
|
+
*/
|
|
21
|
+
function readOrmHealth() {
|
|
22
|
+
return _ormHealthProvider?.() ?? null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Seam ORM **riche** (drill-down @pid) : fournisseur du diagnostic ORM complet du process
|
|
26
|
+
* (par connecteur : ping/latence/stockage/pool via `connection/health` + flux requêtes via
|
|
27
|
+
* `flow`). **Opaque** côté core/framework (qui ne font que le transporter) — seul le
|
|
28
|
+
* consommateur (Studio) connaît la forme `{ health, flow }`. **Async** (le `connection/health`
|
|
29
|
+
* émet un ping) — branché par le **driver** (Drizzle) à son boot, lu par le worker UNIQUEMENT
|
|
30
|
+
* pendant un drill (« on paie ce qu'on regarde »). `null` par défaut → 0 coût.
|
|
31
|
+
*/
|
|
32
|
+
let _ormRichProvider = null;
|
|
33
|
+
/**
|
|
34
|
+
* Branche (ou débranche avec `null`) le fournisseur de diagnostic ORM riche. Idempotent
|
|
35
|
+
* (dernier gagne). Coût NUL hors drill : ce fournisseur n'est appelé que quand le master
|
|
36
|
+
* a demandé l'enrichissement ORM de CE worker.
|
|
37
|
+
*
|
|
38
|
+
* @param fn - producteur async du blob `{ health, flow }`, ou `null` pour débrancher.
|
|
39
|
+
*/
|
|
40
|
+
function setOrmRichProvider(fn) {
|
|
41
|
+
_ormRichProvider = fn;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Appelle le fournisseur ORM riche branché (async), ou `null` si aucun driver ne l'a posé.
|
|
45
|
+
* Le résultat est un blob OPAQUE (forme connue de Studio seul). Ne throw pas pour son propre
|
|
46
|
+
* compte : la propagation d'un rejet du provider reste à l'appelant (qui catch dans son tick).
|
|
47
|
+
*/
|
|
48
|
+
function readOrmRich() {
|
|
49
|
+
return _ormRichProvider?.() ?? null;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { readOrmHealth, readOrmRich, setOrmHealthProvider, setOrmRichProvider };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/service/cluster/podEnvironment.ts
|
|
2
|
+
/**
|
|
3
|
+
* Détection de l'environnement d'orchestration (pod Kubernetes).
|
|
4
|
+
*
|
|
5
|
+
* Utilité : un driver de VUE local (logs `memory`/`file`/`cluster-file`, hub
|
|
6
|
+
* realtime `cluster`) ne couvre QUE le process/pod courant. En multi-pod, une vue
|
|
7
|
+
* globale exige une agrégation centralisée (Loki/OpenSearch pour les logs, Redis
|
|
8
|
+
* pour le realtime) — dont la destination est un secret d'infra fourni par
|
|
9
|
+
* l'environnement (12-factor), JAMAIS devinable depuis le process. Ce module sert
|
|
10
|
+
* donc à **avertir** l'opérateur, jamais à choisir un driver cross-pod à sa place.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Indique si le process tourne dans un pod Kubernetes.
|
|
14
|
+
*
|
|
15
|
+
* Signal fiable et gratuit : le kubelet injecte `KUBERNETES_SERVICE_HOST` (+
|
|
16
|
+
* `KUBERNETES_SERVICE_PORT`) dans TOUT conteneur d'un pod — présence = k8s. Ne dit
|
|
17
|
+
* RIEN du nombre de replicas (un pod ignore ses pairs) : à consommer comme un
|
|
18
|
+
* indice « multi-pod POSSIBLE », pas comme un compte de pods.
|
|
19
|
+
*
|
|
20
|
+
* @param env - table d'environnement (défaut `process.env`) — injectable pour les tests.
|
|
21
|
+
* @returns `true` si des marqueurs Kubernetes sont présents.
|
|
22
|
+
*/
|
|
23
|
+
function isInKubernetes(env = process.env) {
|
|
24
|
+
return Boolean(env.KUBERNETES_SERVICE_HOST || env.KUBERNETES_SERVICE_PORT);
|
|
25
|
+
}
|
|
26
|
+
/** Drivers de relecture LOCAUX (per-pod) : ne couvrent que le process courant. */
|
|
27
|
+
const LOCAL_VIEW_DRIVERS = /* @__PURE__ */ new Set([
|
|
28
|
+
"memory",
|
|
29
|
+
"file",
|
|
30
|
+
"cluster-file"
|
|
31
|
+
]);
|
|
32
|
+
/**
|
|
33
|
+
* Décide s'il faut AVERTIR que la vue des logs est limitée à un pod. Vrai quand on
|
|
34
|
+
* tourne en Kubernetes (multi-pod possible), que le driver de relecture actif est
|
|
35
|
+
* LOCAL (per-pod), et qu'AUCUNE destination d'agrégation cross-pod (Loki/OpenSearch)
|
|
36
|
+
* n'est configurée. Pur (aucun accès système) → testable ; prend le NOM du driver
|
|
37
|
+
* (string) pour interdire le piège du comparer-un-objet-driver (bug de type réel).
|
|
38
|
+
*
|
|
39
|
+
* @param inKubernetes - résultat de {@link isInKubernetes}.
|
|
40
|
+
* @param activeDriverName - nom du driver de relecture actif (`ILogDriver.name`).
|
|
41
|
+
* @param hasAggregation - une destination Loki/OpenSearch est configurée.
|
|
42
|
+
* @returns true si un avertissement « vue par pod » est pertinent.
|
|
43
|
+
*/
|
|
44
|
+
function shouldWarnPerPodView(inKubernetes, activeDriverName, hasAggregation) {
|
|
45
|
+
return inKubernetes && !hasAggregation && LOCAL_VIEW_DRIVERS.has(activeDriverName ?? "");
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { isInKubernetes, shouldWarnPerPodView };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { monitorEventLoopDelay, performance } from "node:perf_hooks";
|
|
2
|
+
import v8 from "node:v8";
|
|
3
|
+
//#region src/service/cluster/processProbe.ts
|
|
4
|
+
const HEAP_LIMIT = v8.getHeapStatistics().heap_size_limit;
|
|
5
|
+
/**
|
|
6
|
+
* Sonde PROCESS **stateful** d'un worker — calcule les métriques par INTERVALLE (CPU,
|
|
7
|
+
* event-loop lag, ELU sont des deltas entre 2 `read()`). Une instance par process worker.
|
|
8
|
+
*
|
|
9
|
+
* Perf (worker uniquement, JAMAIS hot path request) : `read()` appelé au tick de report
|
|
10
|
+
* (≥ 1 s) → 1 `process.cpuUsage()` + 1 `memoryUsage()` + lecture histogramme. Le monitor
|
|
11
|
+
* event-loop natif est **activé au 1ᵉʳ `read()`** (lazy — pas d'overhead « au cas où » à la
|
|
12
|
+
* simple construction) puis reset à chaque tick (lag moyen sur l'intervalle). SERVEUR
|
|
13
|
+
* uniquement (`node:perf_hooks`/`process`) → non importé par le bundle client.
|
|
14
|
+
*/
|
|
15
|
+
var ProcessProbe = class {
|
|
16
|
+
#prevCpu = process.cpuUsage();
|
|
17
|
+
#prevTs = Date.now();
|
|
18
|
+
#prevElu = performance.eventLoopUtilization();
|
|
19
|
+
#eld = monitorEventLoopDelay({ resolution: 20 });
|
|
20
|
+
#enabled = false;
|
|
21
|
+
/**
|
|
22
|
+
* Lit la santé process courante (métriques par intervalle depuis le dernier `read()`).
|
|
23
|
+
*
|
|
24
|
+
* @returns {@link IProcessHealth} prêt à être joint au report de sonde du worker.
|
|
25
|
+
*/
|
|
26
|
+
read() {
|
|
27
|
+
if (!this.#enabled) {
|
|
28
|
+
this.#eld.enable();
|
|
29
|
+
this.#enabled = true;
|
|
30
|
+
}
|
|
31
|
+
const now = Date.now();
|
|
32
|
+
const cur = process.cpuUsage();
|
|
33
|
+
const userDelta = cur.user - this.#prevCpu.user;
|
|
34
|
+
const sysDelta = cur.system - this.#prevCpu.system;
|
|
35
|
+
const elapsedMs = Math.max(now - this.#prevTs, 1);
|
|
36
|
+
this.#prevCpu = cur;
|
|
37
|
+
this.#prevTs = now;
|
|
38
|
+
const cpuPercent = Math.min(100, Math.round((userDelta + sysDelta) / 1e3 / elapsedMs * 100));
|
|
39
|
+
const mean = this.#eld.mean;
|
|
40
|
+
const eventLoopMs = Number.isFinite(mean) ? Math.round(mean / 1e6 * 100) / 100 : 0;
|
|
41
|
+
this.#eld.reset();
|
|
42
|
+
const curElu = performance.eventLoopUtilization();
|
|
43
|
+
const eluDelta = performance.eventLoopUtilization(curElu, this.#prevElu);
|
|
44
|
+
this.#prevElu = curElu;
|
|
45
|
+
const elu = Number.isFinite(eluDelta.utilization) ? Math.round(eluDelta.utilization * 1e3) / 1e3 : 0;
|
|
46
|
+
const mem = process.memoryUsage();
|
|
47
|
+
return {
|
|
48
|
+
pid: process.pid,
|
|
49
|
+
uptime: Math.round(process.uptime()),
|
|
50
|
+
cpuPercent,
|
|
51
|
+
eventLoopMs,
|
|
52
|
+
eluUtilization: elu,
|
|
53
|
+
rss: mem.rss,
|
|
54
|
+
heapUsed: mem.heapUsed,
|
|
55
|
+
heapTotal: mem.heapTotal,
|
|
56
|
+
heapLimit: HEAP_LIMIT,
|
|
57
|
+
external: mem.external,
|
|
58
|
+
ts: now
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** Libère le monitor event-loop natif (à l'arrêt du worker). Idempotent. */
|
|
62
|
+
dispose() {
|
|
63
|
+
if (this.#enabled) {
|
|
64
|
+
this.#eld.disable();
|
|
65
|
+
this.#enabled = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { ProcessProbe, ProcessProbe as default };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
import { PerformanceObserver, constants, performance } from "node:perf_hooks";
|
|
3
|
+
import v8 from "node:v8";
|
|
4
|
+
//#region src/service/cluster/richProcessProbe.ts
|
|
5
|
+
/**
|
|
6
|
+
* Sonde process **riche stateful** d'un worker — calcule les métriques par INTERVALLE
|
|
7
|
+
* (GC, ELU active/idle, changements de contexte sont des deltas entre deux `read()`).
|
|
8
|
+
* Une instance par process worker, **lazy & opt-in** : créée seulement quand un drill
|
|
9
|
+
* est actif sur ce worker (« on paie ce qu'on regarde »).
|
|
10
|
+
*
|
|
11
|
+
* Perf (worker uniquement, JAMAIS hot path request) : l'observer GC n'est attaché qu'à
|
|
12
|
+
* {@link enable} (1ᵉʳ `read()` sinon) et **détaché à {@link disable}** (aucun listener
|
|
13
|
+
* orphelin). Les sondes lourdes (`getHeapSpaceStatistics`, `getActiveResourcesInfo`,
|
|
14
|
+
* `getrusage`) ne tournent qu'au `read()` (au tick de report, ≥ 1 s). SERVEUR uniquement
|
|
15
|
+
* (`node:v8`/`node:perf_hooks`/`node:os`) → non importé par le bundle client.
|
|
16
|
+
*
|
|
17
|
+
* Logique portée de `createStatsTicker` (`@nodefony/studio`) en classe réutilisable :
|
|
18
|
+
* source unique de la sonde process riche, partagée par le drill cluster et la
|
|
19
|
+
* supervision mono-process.
|
|
20
|
+
*/
|
|
21
|
+
var RichProcessProbe = class {
|
|
22
|
+
#heapLimit = v8.getHeapStatistics().heap_size_limit;
|
|
23
|
+
#cpuCount = os.cpus().length || 1;
|
|
24
|
+
#prevElu = performance.eventLoopUtilization();
|
|
25
|
+
#prevRu = process.resourceUsage();
|
|
26
|
+
#gcObs = null;
|
|
27
|
+
#gcCount = 0;
|
|
28
|
+
#gcPauseMs = 0;
|
|
29
|
+
#gcMajor = 0;
|
|
30
|
+
#gcMinor = 0;
|
|
31
|
+
#enabled = false;
|
|
32
|
+
/**
|
|
33
|
+
* Attache l'observer GC et réinitialise les baselines de delta (ELU/ctx). Idempotent.
|
|
34
|
+
* Appelé automatiquement au 1ᵉʳ `read()` ; explicite pour démarrer la collecte GC tôt.
|
|
35
|
+
*/
|
|
36
|
+
enable() {
|
|
37
|
+
if (this.#enabled) return;
|
|
38
|
+
this.#enabled = true;
|
|
39
|
+
this.#prevElu = performance.eventLoopUtilization();
|
|
40
|
+
this.#prevRu = process.resourceUsage();
|
|
41
|
+
this.#gcCount = this.#gcPauseMs = this.#gcMajor = this.#gcMinor = 0;
|
|
42
|
+
this.#gcObs = new PerformanceObserver((list) => {
|
|
43
|
+
for (const e of list.getEntries()) {
|
|
44
|
+
this.#gcCount += 1;
|
|
45
|
+
this.#gcPauseMs += e.duration;
|
|
46
|
+
const kind = e.detail?.kind;
|
|
47
|
+
if (kind === constants.NODE_PERFORMANCE_GC_MAJOR) this.#gcMajor += 1;
|
|
48
|
+
else if (kind === constants.NODE_PERFORMANCE_GC_MINOR) this.#gcMinor += 1;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
try {
|
|
52
|
+
this.#gcObs.observe({ entryTypes: ["gc"] });
|
|
53
|
+
} catch {}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Lit la sonde riche courante (deltas depuis le dernier `read()`, snapshots heap/handles).
|
|
57
|
+
*
|
|
58
|
+
* @returns {@link IProcessRich} prêt à être joint au report du worker drillé.
|
|
59
|
+
*/
|
|
60
|
+
read() {
|
|
61
|
+
if (!this.#enabled) this.enable();
|
|
62
|
+
const gc = {
|
|
63
|
+
count: this.#gcCount,
|
|
64
|
+
pauseMs: Math.round(this.#gcPauseMs * 100) / 100,
|
|
65
|
+
major: this.#gcMajor,
|
|
66
|
+
minor: this.#gcMinor
|
|
67
|
+
};
|
|
68
|
+
this.#gcCount = this.#gcPauseMs = this.#gcMajor = this.#gcMinor = 0;
|
|
69
|
+
const heapSpaces = v8.getHeapSpaceStatistics().map((s) => ({
|
|
70
|
+
name: s.space_name,
|
|
71
|
+
used: s.space_used_size,
|
|
72
|
+
size: s.space_size
|
|
73
|
+
}));
|
|
74
|
+
const resources = process.getActiveResourcesInfo();
|
|
75
|
+
const byType = Object.create(null);
|
|
76
|
+
for (const r of resources) byType[r] = (byType[r] ?? 0) + 1;
|
|
77
|
+
const curElu = performance.eventLoopUtilization();
|
|
78
|
+
const eluDelta = performance.eventLoopUtilization(curElu, this.#prevElu);
|
|
79
|
+
this.#prevElu = curElu;
|
|
80
|
+
const elu = {
|
|
81
|
+
active: Number.isFinite(eluDelta.active) ? Math.round(eluDelta.active * 100) / 100 : 0,
|
|
82
|
+
idle: Number.isFinite(eluDelta.idle) ? Math.round(eluDelta.idle * 100) / 100 : 0
|
|
83
|
+
};
|
|
84
|
+
const ru = process.resourceUsage();
|
|
85
|
+
const ctx = {
|
|
86
|
+
voluntary: ru.voluntaryContextSwitches - this.#prevRu.voluntaryContextSwitches,
|
|
87
|
+
involuntary: ru.involuntaryContextSwitches - this.#prevRu.involuntaryContextSwitches
|
|
88
|
+
};
|
|
89
|
+
this.#prevRu = ru;
|
|
90
|
+
return {
|
|
91
|
+
gc,
|
|
92
|
+
heapSpaces,
|
|
93
|
+
handles: {
|
|
94
|
+
total: resources.length,
|
|
95
|
+
byType
|
|
96
|
+
},
|
|
97
|
+
elu,
|
|
98
|
+
ctx,
|
|
99
|
+
loadavg: os.loadavg(),
|
|
100
|
+
heapLimit: this.#heapLimit,
|
|
101
|
+
cpuCount: this.#cpuCount,
|
|
102
|
+
ts: Date.now()
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** Détache l'observer GC (fin du drill / arrêt du worker). Idempotent. */
|
|
106
|
+
disable() {
|
|
107
|
+
if (this.#gcObs !== null) {
|
|
108
|
+
this.#gcObs.disconnect();
|
|
109
|
+
this.#gcObs = null;
|
|
110
|
+
}
|
|
111
|
+
this.#enabled = false;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { RichProcessProbe, RichProcessProbe as default };
|