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
package/kernel/kernel.es6
DELETED
|
@@ -1,1960 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const os = require("os");
|
|
3
|
-
const Module = require("module");
|
|
4
|
-
let myrequire = null;
|
|
5
|
-
let mypackage = null;
|
|
6
|
-
|
|
7
|
-
const makeRequireFunction = function makeRequireFunction(mod) {
|
|
8
|
-
const myModule = mod.constructor;
|
|
9
|
-
|
|
10
|
-
function myRequire(path) {
|
|
11
|
-
try {
|
|
12
|
-
exports.requireDepth += 1;
|
|
13
|
-
return mod.require(path);
|
|
14
|
-
} finally {
|
|
15
|
-
exports.requireDepth -= 1;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function resolve(request, options) {
|
|
20
|
-
if (typeof request !== "string") {
|
|
21
|
-
throw new new Error(
|
|
22
|
-
`resolve arg must be a string ERR_INVALID_ARG_TYPE : ${request}`
|
|
23
|
-
)();
|
|
24
|
-
}
|
|
25
|
-
return myModule._resolveFilename(request, mod, false, options);
|
|
26
|
-
}
|
|
27
|
-
myRequire.resolve = resolve;
|
|
28
|
-
|
|
29
|
-
function paths(request) {
|
|
30
|
-
if (typeof request !== "string") {
|
|
31
|
-
throw new new Error(
|
|
32
|
-
`paths arg must be a string ERR_INVALID_ARG_TYPE : ${request}`
|
|
33
|
-
)();
|
|
34
|
-
}
|
|
35
|
-
return myModule._resolveLookupPaths(request, mod, true);
|
|
36
|
-
}
|
|
37
|
-
resolve.paths = paths;
|
|
38
|
-
myRequire.main = module; // process.mainModule;
|
|
39
|
-
// Enable support to add extra extension types.
|
|
40
|
-
myRequire.extensions = myModule._extensions;
|
|
41
|
-
myRequire.cache = myModule._cache;
|
|
42
|
-
return myRequire;
|
|
43
|
-
};
|
|
44
|
-
const createRequireFromPath = function createRequireFromPath(filename) {
|
|
45
|
-
const m = new Module(filename, module);
|
|
46
|
-
m.filename = filename;
|
|
47
|
-
m.paths = Module._nodeModulePaths(path.dirname(filename));
|
|
48
|
-
return makeRequireFunction(m);
|
|
49
|
-
};
|
|
50
|
-
try {
|
|
51
|
-
const filemame = path.resolve(process.cwd(), "package.json");
|
|
52
|
-
myrequire = createRequireFromPath(filemame);
|
|
53
|
-
mypackage = myrequire(filemame);
|
|
54
|
-
} catch (e) {}
|
|
55
|
-
|
|
56
|
-
const regBundleName = /^(\w+)-bundle[\.js]{0,3}$|^(\w+)[Bb]undle[\.js]{0,3}$/;
|
|
57
|
-
const regBundle = /^(\w+)[Bb]undle.js$/;
|
|
58
|
-
const regClassBundle = /^(\w+)[Bb]undle$/;
|
|
59
|
-
const regPackageFile = /^\s*file:(.*)/;
|
|
60
|
-
|
|
61
|
-
/* const promiseBundleReady = function () {
|
|
62
|
-
let myresolve = null;
|
|
63
|
-
let myPromise = new Promise((resolve) => {
|
|
64
|
-
myresolve = resolve;
|
|
65
|
-
});
|
|
66
|
-
this.promisesBundleReady.push(myPromise);
|
|
67
|
-
return function (bundle) {
|
|
68
|
-
return myresolve(bundle);
|
|
69
|
-
};
|
|
70
|
-
};*/
|
|
71
|
-
|
|
72
|
-
const bundlesCore = {
|
|
73
|
-
"framework-bundle": "framework",
|
|
74
|
-
"monitoring-bundle": "monitoring",
|
|
75
|
-
"http-bundle": "http",
|
|
76
|
-
"realtime-bundle": "realtime",
|
|
77
|
-
"security-bundle": "security",
|
|
78
|
-
"sequelize-bundle": "sequelize",
|
|
79
|
-
"unittests-bundle": "unittests",
|
|
80
|
-
"redis-bundle": "redis",
|
|
81
|
-
"mongoose-bundle": "mongoose",
|
|
82
|
-
"elastic-bundle": "elastic",
|
|
83
|
-
"mail-bundle": "mail",
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const defaultEnvEnable = {
|
|
87
|
-
dev: true,
|
|
88
|
-
development: true,
|
|
89
|
-
prod: true,
|
|
90
|
-
production: true,
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const defaultOptions = {
|
|
94
|
-
events: {
|
|
95
|
-
nbListeners: 60,
|
|
96
|
-
captureRejections: true,
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const colorLogEvent = clc.cyan.bgBlue("EVENT KERNEL");
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* KERKEL class
|
|
104
|
-
* The class is a **`KERNEL NODEFONY`** .
|
|
105
|
-
* @module NODEFONY
|
|
106
|
-
* @main nodefony
|
|
107
|
-
* @class kernel
|
|
108
|
-
* @constructor
|
|
109
|
-
* @param {String} environment DEV || PROD
|
|
110
|
-
* @param {Bollean} debug
|
|
111
|
-
* @param {class} autoLoader
|
|
112
|
-
*
|
|
113
|
-
*/
|
|
114
|
-
class Kernel extends nodefony.Service {
|
|
115
|
-
constructor(environment, cli, options) {
|
|
116
|
-
super(
|
|
117
|
-
"KERNEL",
|
|
118
|
-
cli.container,
|
|
119
|
-
cli.notificationsCenter,
|
|
120
|
-
nodefony.extend({}, defaultOptions, options)
|
|
121
|
-
);
|
|
122
|
-
this.cli = cli;
|
|
123
|
-
this.type = cli.type;
|
|
124
|
-
this.package = mypackage;
|
|
125
|
-
this.debug = Boolean(cli.commander.opts().debug) || false;
|
|
126
|
-
this.appEnvironment = {
|
|
127
|
-
environment: process.env.NODE_ENV,
|
|
128
|
-
};
|
|
129
|
-
this.setEnv(environment);
|
|
130
|
-
// Manage Kernel Container
|
|
131
|
-
this.set("kernel", this);
|
|
132
|
-
this.set("cli", this.cli);
|
|
133
|
-
// Autoloader
|
|
134
|
-
this.autoLoader = nodefony.autoloader;
|
|
135
|
-
this.autoLoader.setKernel(this);
|
|
136
|
-
this.set("autoLoader", this.autoLoader);
|
|
137
|
-
this.version = nodefony.version;
|
|
138
|
-
this.platform = process.platform;
|
|
139
|
-
this.projectName = nodefony.projectName;
|
|
140
|
-
this.isElectron = nodefony.isElectron;
|
|
141
|
-
this.uptime = new Date().getTime();
|
|
142
|
-
this.numberCpu = os.cpus().length;
|
|
143
|
-
// boolean
|
|
144
|
-
this.console = this.isConsole();
|
|
145
|
-
this.booted = false;
|
|
146
|
-
this.ready = false;
|
|
147
|
-
this.postReady = false;
|
|
148
|
-
this.started = false;
|
|
149
|
-
this.preRegistered = false;
|
|
150
|
-
this.isCore = nodefony.isCore;
|
|
151
|
-
this.settings = null;
|
|
152
|
-
this.domainCheck = true;
|
|
153
|
-
this.regBundle = regBundle;
|
|
154
|
-
this.regBundleName = regBundleName;
|
|
155
|
-
this.node_start = process.env.MODE_START || this.options.node_start;
|
|
156
|
-
this.bundles = {};
|
|
157
|
-
this.promisesBundleReady = [];
|
|
158
|
-
this.setParameters("bundles", {});
|
|
159
|
-
this.bundlesCore = bundlesCore;
|
|
160
|
-
// Paths
|
|
161
|
-
this.rootDir = process.cwd();
|
|
162
|
-
this.path = this.rootDir;
|
|
163
|
-
this.bundlesPath = path.resolve(this.rootDir, "src", "bundles");
|
|
164
|
-
this.appPath = nodefony.appPath; // path.resolve(this.rootDir, "app");
|
|
165
|
-
this.configPath = nodefony.kernelConfigPath; // path.resolve(this.rootDir, "config", "config.yml");
|
|
166
|
-
this.generateConfigPath = path.resolve(
|
|
167
|
-
this.rootDir,
|
|
168
|
-
"config",
|
|
169
|
-
"generatedConfig.yml"
|
|
170
|
-
);
|
|
171
|
-
this.publicPath = path.resolve(this.rootDir, "web");
|
|
172
|
-
this.nodefonyPath = this.autoLoader.dirname;
|
|
173
|
-
this.cacheLink = path.resolve(this.rootDir, "tmp", "assestLink");
|
|
174
|
-
this.cacheWebpack = path.resolve(this.rootDir, "tmp", "webpack");
|
|
175
|
-
this.tmpDir = null;
|
|
176
|
-
this.typeCluster = this.clusterIsMaster() ? "master" : "worker";
|
|
177
|
-
this.cli.setKernel(this);
|
|
178
|
-
try {
|
|
179
|
-
// Manage Reader
|
|
180
|
-
this.reader = new nodefony.Reader(this.container);
|
|
181
|
-
this.set("reader", this.reader);
|
|
182
|
-
// Manage Injections
|
|
183
|
-
this.injection = new nodefony.Injection(this.container);
|
|
184
|
-
this.set("injection", this.injection);
|
|
185
|
-
this.setCli();
|
|
186
|
-
this.cli.createDirectory(
|
|
187
|
-
path.resolve(this.rootDir, "tmp"),
|
|
188
|
-
null,
|
|
189
|
-
(file) => {
|
|
190
|
-
this.tmpDir = file;
|
|
191
|
-
},
|
|
192
|
-
true
|
|
193
|
-
);
|
|
194
|
-
this.git = this.cli.setGitPath(this.rootDir);
|
|
195
|
-
this.once("onPostReady", () => {
|
|
196
|
-
if (process.getuid && process.getuid() === 0) {
|
|
197
|
-
// this.drop_root();
|
|
198
|
-
}
|
|
199
|
-
// this.clean();
|
|
200
|
-
this.postReady = true;
|
|
201
|
-
switch (this.environment) {
|
|
202
|
-
case "production":
|
|
203
|
-
case "prod":
|
|
204
|
-
case "preprod":
|
|
205
|
-
case "preproduction":
|
|
206
|
-
this.clean();
|
|
207
|
-
break;
|
|
208
|
-
default:
|
|
209
|
-
this.clean();
|
|
210
|
-
myrequire = null;
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
} catch (e) {
|
|
214
|
-
console.trace(e);
|
|
215
|
-
throw e;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
clean() {
|
|
220
|
-
require.cache = null;
|
|
221
|
-
delete require.cache;
|
|
222
|
-
myrequire.cache = null;
|
|
223
|
-
delete myrequire.cache;
|
|
224
|
-
myrequire = null;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
drop_root() {
|
|
228
|
-
try {
|
|
229
|
-
process.setgid("nobody");
|
|
230
|
-
process.setuid("nobody");
|
|
231
|
-
} catch (e) {
|
|
232
|
-
console.error(e);
|
|
233
|
-
console.log("Refusing to keep the process alive as root.");
|
|
234
|
-
nodefony.cli.quit(1);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
getLocalExternalIP() {
|
|
239
|
-
return []
|
|
240
|
-
.concat(...Object.values(os.networkInterfaces()))
|
|
241
|
-
.find((details) => !details.internal);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
getNetworkInterfaces() {
|
|
245
|
-
const nets = os.networkInterfaces();
|
|
246
|
-
const devices = Object.create(null); // or just '{}', an empty object
|
|
247
|
-
for (const name of Object.keys(nets)) {
|
|
248
|
-
for (const net of nets[name]) {
|
|
249
|
-
if (!devices[name]) {
|
|
250
|
-
devices[name] = [];
|
|
251
|
-
devices[name].push(net);
|
|
252
|
-
} else {
|
|
253
|
-
devices[name].push(net);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return devices;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
start() {
|
|
261
|
-
if (!this.started) {
|
|
262
|
-
return this.cli
|
|
263
|
-
.showAsciify(this.projectName)
|
|
264
|
-
.then(async () => {
|
|
265
|
-
this.cli.showBanner();
|
|
266
|
-
this.cli.blankLine();
|
|
267
|
-
try {
|
|
268
|
-
// config
|
|
269
|
-
this.readKernelConfig();
|
|
270
|
-
this.setNodeEnv(this.environment);
|
|
271
|
-
// Clusters
|
|
272
|
-
this.initCluster();
|
|
273
|
-
// Manage Template engine
|
|
274
|
-
this.initTemplate();
|
|
275
|
-
} catch (e) {
|
|
276
|
-
throw e;
|
|
277
|
-
}
|
|
278
|
-
this.started = true;
|
|
279
|
-
return await this.boot().catch((e) => {
|
|
280
|
-
throw e;
|
|
281
|
-
});
|
|
282
|
-
})
|
|
283
|
-
.catch(async (e) => {
|
|
284
|
-
throw e;
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
loadCommand() {
|
|
290
|
-
try {
|
|
291
|
-
return this.cli.loadCommand().then((commands) => {
|
|
292
|
-
if (this.debug) {
|
|
293
|
-
this.displayCommand(commands);
|
|
294
|
-
}
|
|
295
|
-
return commands;
|
|
296
|
-
});
|
|
297
|
-
} catch (e) {
|
|
298
|
-
this.log(e, "ERROR");
|
|
299
|
-
this.terminate(e.code || 1);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
displayCommand(commands) {
|
|
304
|
-
const table = this.cli.displayTable([], {
|
|
305
|
-
head: ["BUNDLES", "COMMAND NAME"],
|
|
306
|
-
});
|
|
307
|
-
for (const bundle in commands) {
|
|
308
|
-
const cmd = commands[bundle];
|
|
309
|
-
for (const command in cmd) {
|
|
310
|
-
const tab = [];
|
|
311
|
-
tab.push(bundle);
|
|
312
|
-
tab.push(command);
|
|
313
|
-
table.push(tab);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
this.log(`\n${table.toString()}`, "DEBUG");
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
async matchCommand() {
|
|
320
|
-
try {
|
|
321
|
-
return await this.cli.matchCommand();
|
|
322
|
-
} catch (e) {
|
|
323
|
-
throw e;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
setCli() {
|
|
328
|
-
if (this.typeCluster === "worker") {
|
|
329
|
-
this.cli.setPid();
|
|
330
|
-
}
|
|
331
|
-
this.cli.setProcessTitle(this.projectName);
|
|
332
|
-
if (this.cli.commander.options.length) {
|
|
333
|
-
const index = this.cli.commander.options.findIndex((value) => {
|
|
334
|
-
if (value.flags === "-v, --version") {
|
|
335
|
-
return value;
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
if (index >= 0) {
|
|
339
|
-
// @ts-ignore
|
|
340
|
-
this.cli.commander.options.splice(index, 1);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
this.cli.setCommandVersion(
|
|
344
|
-
this.isCore ? this.version : nodefony.projectVersion
|
|
345
|
-
);
|
|
346
|
-
// this.cli.syslog.removeAllListeners();
|
|
347
|
-
this.cli.syslog.reset();
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
isBundleCore(name) {
|
|
351
|
-
if (name in bundlesCore) {
|
|
352
|
-
return true;
|
|
353
|
-
}
|
|
354
|
-
for (const bundle in bundlesCore) {
|
|
355
|
-
if (bundlesCore[bundle] === name) {
|
|
356
|
-
return true;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
const res = regBundleName.exec(name);
|
|
360
|
-
if (res) {
|
|
361
|
-
if (res[2]) {
|
|
362
|
-
return this.isBundleCore(res[2].toLowerCase());
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
return false;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
getRegisteredBundles(name = null) {
|
|
369
|
-
if (name) {
|
|
370
|
-
const bundle = this.getBundle(name);
|
|
371
|
-
if (bundle) {
|
|
372
|
-
return {
|
|
373
|
-
name: bundle.name,
|
|
374
|
-
packageName: bundle.package.name,
|
|
375
|
-
package: bundle.package,
|
|
376
|
-
path: bundle.path,
|
|
377
|
-
version: bundle.package.version,
|
|
378
|
-
registred: true,
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
return null;
|
|
382
|
-
}
|
|
383
|
-
const tab = [];
|
|
384
|
-
const bundles = this.getBundles();
|
|
385
|
-
for (const mybundle in bundles) {
|
|
386
|
-
const bundle = bundles[mybundle];
|
|
387
|
-
const ob = {
|
|
388
|
-
name: bundle.name,
|
|
389
|
-
packageName: bundle.package.name,
|
|
390
|
-
package: bundle.package,
|
|
391
|
-
path: bundle.path,
|
|
392
|
-
version: bundle.version,
|
|
393
|
-
registred: true,
|
|
394
|
-
};
|
|
395
|
-
tab.push(ob);
|
|
396
|
-
}
|
|
397
|
-
return tab;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
async getUnregistredBundle(nameBundle) {
|
|
401
|
-
const finder = new nodefony.Finder2({
|
|
402
|
-
recurse: false,
|
|
403
|
-
depth: 1,
|
|
404
|
-
});
|
|
405
|
-
let result = await finder
|
|
406
|
-
.in(this.bundlesPath)
|
|
407
|
-
.then((result) => {
|
|
408
|
-
if (result[0].children.length) {
|
|
409
|
-
return result[0].children
|
|
410
|
-
.map((bundle) => {
|
|
411
|
-
const name = this.regBundleName.exec(bundle.name);
|
|
412
|
-
if (name && nameBundle === name[1]) {
|
|
413
|
-
return this.loadBundleUnregister(name[1], bundle);
|
|
414
|
-
}
|
|
415
|
-
return null;
|
|
416
|
-
})
|
|
417
|
-
.filter((bundle) => {
|
|
418
|
-
if (bundle) {
|
|
419
|
-
return bundle;
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
return null;
|
|
424
|
-
})
|
|
425
|
-
.catch((e) => {
|
|
426
|
-
this.log(e, "ERROR");
|
|
427
|
-
});
|
|
428
|
-
if (result.length) {
|
|
429
|
-
return result[0];
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
const localNodefony = path.resolve(this.nodefonyPath, "bundles");
|
|
433
|
-
result = await finder
|
|
434
|
-
.in(localNodefony)
|
|
435
|
-
.then((result) => {
|
|
436
|
-
if (result[0].children.length) {
|
|
437
|
-
// console.log(result[0].children)
|
|
438
|
-
return result[0].children
|
|
439
|
-
.map((bundle) => {
|
|
440
|
-
const name = this.regBundleName.exec(bundle.name);
|
|
441
|
-
if (name && nameBundle === name[1]) {
|
|
442
|
-
return this.loadBundleUnregister(name[1], bundle);
|
|
443
|
-
}
|
|
444
|
-
return null;
|
|
445
|
-
})
|
|
446
|
-
.filter((bundle) => {
|
|
447
|
-
if (bundle) {
|
|
448
|
-
return bundle;
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
return null;
|
|
453
|
-
})
|
|
454
|
-
.catch((e) => {
|
|
455
|
-
this.log(e, "ERROR");
|
|
456
|
-
});
|
|
457
|
-
if (result && result.length) {
|
|
458
|
-
return result[0];
|
|
459
|
-
}
|
|
460
|
-
return null;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
loadBundleUnregister(name, bundle) {
|
|
464
|
-
try {
|
|
465
|
-
const mypackage = path.resolve(bundle.path, "package.json");
|
|
466
|
-
const pack = require(mypackage);
|
|
467
|
-
return {
|
|
468
|
-
name, // pack.name.replace("@nodefony/", "").replace("-bundle", "").replace("Bundle", ""),
|
|
469
|
-
packageName: pack.name,
|
|
470
|
-
package: pack,
|
|
471
|
-
path: bundle.path,
|
|
472
|
-
version: pack.version,
|
|
473
|
-
registred: false,
|
|
474
|
-
};
|
|
475
|
-
} catch (e) {
|
|
476
|
-
this.log(e, "WARNING");
|
|
477
|
-
return false;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
async getUnregistredBundles() {
|
|
482
|
-
let tab = [];
|
|
483
|
-
// unregistered
|
|
484
|
-
const finder = new nodefony.Finder2({
|
|
485
|
-
recurse: false,
|
|
486
|
-
depth: 1,
|
|
487
|
-
});
|
|
488
|
-
let result = await finder
|
|
489
|
-
.in(this.bundlesPath)
|
|
490
|
-
.then((result) => {
|
|
491
|
-
if (result[0].children.length) {
|
|
492
|
-
return result[0].children
|
|
493
|
-
.map((bundle) => {
|
|
494
|
-
const name = this.regBundleName.exec(bundle.name);
|
|
495
|
-
if (name && !(name[1] in this.bundles)) {
|
|
496
|
-
return this.loadBundleUnregister(name[1], bundle);
|
|
497
|
-
}
|
|
498
|
-
return false;
|
|
499
|
-
})
|
|
500
|
-
.filter((bundle) => {
|
|
501
|
-
if (true) {
|
|
502
|
-
return bundle;
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
})
|
|
507
|
-
.catch((e) => {
|
|
508
|
-
this.log(e, "ERROR");
|
|
509
|
-
});
|
|
510
|
-
tab = tab.concat(result);
|
|
511
|
-
|
|
512
|
-
let localNodefony = null;
|
|
513
|
-
if (this.isCore) {
|
|
514
|
-
localNodefony = path.resolve(this.nodefonyPath, "bundles");
|
|
515
|
-
} else {
|
|
516
|
-
localNodefony = path.resolve(this.path, "node_modules", "@nodefony");
|
|
517
|
-
}
|
|
518
|
-
result = await finder
|
|
519
|
-
.in(localNodefony)
|
|
520
|
-
.then((result) => {
|
|
521
|
-
if (result[0].children.length) {
|
|
522
|
-
// console.log(result[0].children)
|
|
523
|
-
return result[0].children
|
|
524
|
-
.map((bundle) => {
|
|
525
|
-
const name = this.regBundleName.exec(bundle.name);
|
|
526
|
-
if (name) {
|
|
527
|
-
return this.loadBundleUnregister(name[1], bundle);
|
|
528
|
-
}
|
|
529
|
-
})
|
|
530
|
-
.filter((bundle) => {
|
|
531
|
-
if (bundle) {
|
|
532
|
-
if (!(bundle.name in this.bundles)) {
|
|
533
|
-
return bundle;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
})
|
|
539
|
-
.catch((e) => {
|
|
540
|
-
this.log(e, "ERROR");
|
|
541
|
-
});
|
|
542
|
-
if (result) {
|
|
543
|
-
tab = tab.concat(result);
|
|
544
|
-
}
|
|
545
|
-
return tab;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
setEnv(environment) {
|
|
549
|
-
if (environment in defaultEnvEnable) {
|
|
550
|
-
switch (environment) {
|
|
551
|
-
case "dev":
|
|
552
|
-
case "development":
|
|
553
|
-
this.environment = "dev";
|
|
554
|
-
if (!this.appEnvironment.environment) {
|
|
555
|
-
this.appEnvironment.environment = "development";
|
|
556
|
-
}
|
|
557
|
-
break;
|
|
558
|
-
default:
|
|
559
|
-
this.environment = "prod";
|
|
560
|
-
if (!this.appEnvironment.environment) {
|
|
561
|
-
this.appEnvironment.environment = "production";
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
setNodeEnv(environment) {
|
|
568
|
-
if (environment in defaultEnvEnable) {
|
|
569
|
-
switch (environment) {
|
|
570
|
-
case "dev":
|
|
571
|
-
case "development":
|
|
572
|
-
process.env.NODE_ENV = "development";
|
|
573
|
-
process.env.BABEL_ENV = "development";
|
|
574
|
-
break;
|
|
575
|
-
default:
|
|
576
|
-
process.env.NODE_ENV = "production";
|
|
577
|
-
process.env.BABEL_ENV = "production";
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
process.env.NODE_DEBUG = this.debug;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
logEnv() {
|
|
584
|
-
let txt = ` \x1b ${this.cli.clc.blue(this.type)} `;
|
|
585
|
-
txt += ` ${this.cli.clc.magenta("Cluster")} : ${this.typeCluster} `;
|
|
586
|
-
txt += ` ${this.cli.clc.magenta("Nodefony Environment")} : ${
|
|
587
|
-
this.environment
|
|
588
|
-
} `;
|
|
589
|
-
if (this.appEnvironment) {
|
|
590
|
-
txt += ` ${this.cli.clc.magenta("App Environment")} : ${
|
|
591
|
-
this.appEnvironment.environment
|
|
592
|
-
} `;
|
|
593
|
-
}
|
|
594
|
-
txt += ` ${this.cli.clc.magenta("Debug")} : ${this.debug}\n`;
|
|
595
|
-
return txt;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
readKernelConfig() {
|
|
599
|
-
try {
|
|
600
|
-
if (path.basename(this.configPath) === "config.js") {
|
|
601
|
-
this.settings = this.autoLoader.load(this.configPath, true);
|
|
602
|
-
} else {
|
|
603
|
-
this.settings = nodefony.kernelConfig;
|
|
604
|
-
}
|
|
605
|
-
this.settings.name = "NODEFONY";
|
|
606
|
-
this.settings.version = this.version;
|
|
607
|
-
this.settings.environment = this.environment;
|
|
608
|
-
this.settings.debug = this.debug;
|
|
609
|
-
this.setParameters("kernel", this.settings);
|
|
610
|
-
this.httpPort = this.settings.system.httpPort || null;
|
|
611
|
-
this.httpsPort = this.settings.system.httpsPort || null;
|
|
612
|
-
this.domain = this.settings.system.domain || null;
|
|
613
|
-
this.hostname = this.settings.system.domain || null;
|
|
614
|
-
this.hostHttp = `${this.hostname}:${this.httpPort}`;
|
|
615
|
-
this.hostHttps = `${this.hostname}:${this.httpsPort}`;
|
|
616
|
-
this.domainAlias = this.settings.system.domainAlias;
|
|
617
|
-
this.domainCheck = this.settings.system.domainCheck;
|
|
618
|
-
this.initializeLog();
|
|
619
|
-
if (!this.settings.system.bundles) {
|
|
620
|
-
this.settings.system.bundles = {};
|
|
621
|
-
}
|
|
622
|
-
const gconf = this.readGeneratedConfig();
|
|
623
|
-
if (gconf) {
|
|
624
|
-
if (gconf.system && gconf.system.bundles) {
|
|
625
|
-
this.settings = nodefony.extend(true, gconf, this.settings);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
} catch (e) {
|
|
629
|
-
this.log(e, "ERROR");
|
|
630
|
-
throw e;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
checkPath(myPath) {
|
|
635
|
-
if (!myPath) {
|
|
636
|
-
return null;
|
|
637
|
-
}
|
|
638
|
-
const abs = path.isAbsolute(myPath);
|
|
639
|
-
if (abs) {
|
|
640
|
-
return myPath;
|
|
641
|
-
}
|
|
642
|
-
return path.resolve(this.rootDir, myPath);
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
getConfigBunbles() {
|
|
646
|
-
const config = [];
|
|
647
|
-
if (this.settings && this.settings.system && this.settings.system.bundles) {
|
|
648
|
-
for (const bundle in this.settings.system.bundles) {
|
|
649
|
-
let res = null;
|
|
650
|
-
try {
|
|
651
|
-
res = this.searchPackage(
|
|
652
|
-
bundle,
|
|
653
|
-
this.settings.system.bundles[bundle]
|
|
654
|
-
);
|
|
655
|
-
config.push(res);
|
|
656
|
-
} catch (e) {
|
|
657
|
-
this.log(e, "WARNING");
|
|
658
|
-
continue;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
return config;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
checkBundlesExist(yml, nameConfig, pathConfig, remove) {
|
|
666
|
-
if (yml && yml.system && yml.system.bundles) {
|
|
667
|
-
for (const bundle in yml.system.bundles) {
|
|
668
|
-
let exist = null;
|
|
669
|
-
try {
|
|
670
|
-
exist = this.searchPackage(bundle, yml.system.bundles[bundle]);
|
|
671
|
-
} catch (e) {
|
|
672
|
-
this.log(e, "WARNING");
|
|
673
|
-
}
|
|
674
|
-
if (!exist) {
|
|
675
|
-
delete yml.system.bundles[bundle];
|
|
676
|
-
if (remove) {
|
|
677
|
-
try {
|
|
678
|
-
fs.writeFileSync(pathConfig, yaml.dump(yml), {
|
|
679
|
-
encoding: "utf8",
|
|
680
|
-
});
|
|
681
|
-
this.log(
|
|
682
|
-
`${nameConfig} : ${bundle} Bundle don't exist in file : ${pathConfig}`,
|
|
683
|
-
"WARNING"
|
|
684
|
-
);
|
|
685
|
-
this.log(`Update Config : ${pathConfig}`);
|
|
686
|
-
} catch (e) {
|
|
687
|
-
this.log(e, "ERROR");
|
|
688
|
-
}
|
|
689
|
-
} else {
|
|
690
|
-
const error = new Error(
|
|
691
|
-
`${nameConfig} : ${bundle} Bundle don't exist in file : ${pathConfig}`
|
|
692
|
-
);
|
|
693
|
-
this.log(error, "ERROR");
|
|
694
|
-
this.log(`Config file : ${pathConfig}`);
|
|
695
|
-
this.log(yml.system.bundles);
|
|
696
|
-
}
|
|
697
|
-
try {
|
|
698
|
-
const link = path.resolve(this.publicPath, bundle);
|
|
699
|
-
const stat = fs.lstatSync(link);
|
|
700
|
-
if (stat) {
|
|
701
|
-
exist = fs.existsSync(fs.readlinkSync(link));
|
|
702
|
-
if (!exist) {
|
|
703
|
-
fs.unlinkSync(link);
|
|
704
|
-
this.log(`REMOVE LINK : ${link}`);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
} catch (e) {}
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
readGeneratedConfig() {
|
|
714
|
-
let exist = null;
|
|
715
|
-
try {
|
|
716
|
-
exist = fs.existsSync(this.generateConfigPath);
|
|
717
|
-
if (exist) {
|
|
718
|
-
try {
|
|
719
|
-
const yml = yaml.load(
|
|
720
|
-
fs.readFileSync(this.generateConfigPath, "utf8")
|
|
721
|
-
);
|
|
722
|
-
this.checkBundlesExist(
|
|
723
|
-
yml,
|
|
724
|
-
"Generated Config",
|
|
725
|
-
this.generateConfigPath,
|
|
726
|
-
true
|
|
727
|
-
);
|
|
728
|
-
return yml;
|
|
729
|
-
} catch (e) {
|
|
730
|
-
throw e;
|
|
731
|
-
}
|
|
732
|
-
} else {
|
|
733
|
-
return null;
|
|
734
|
-
}
|
|
735
|
-
} catch (e) {
|
|
736
|
-
throw e;
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
searchPackage(name, mypath) {
|
|
741
|
-
let res = null;
|
|
742
|
-
let error = null;
|
|
743
|
-
if (mypath && mypath !== "*") {
|
|
744
|
-
try {
|
|
745
|
-
res = regPackageFile.exec(mypath);
|
|
746
|
-
if (res) {
|
|
747
|
-
mypath = res[1];
|
|
748
|
-
} else {
|
|
749
|
-
try {
|
|
750
|
-
if (this.cli.checkVersion(mypath)) {
|
|
751
|
-
if (myrequire) {
|
|
752
|
-
try {
|
|
753
|
-
res = myrequire.resolve(`${name}`);
|
|
754
|
-
const { version } = myrequire(
|
|
755
|
-
path.resolve(path.dirname(res), "package.json")
|
|
756
|
-
);
|
|
757
|
-
if (version === mypath) {
|
|
758
|
-
if (this.type === "SERVER") {
|
|
759
|
-
this.log(
|
|
760
|
-
`Find NPM Bundle Package : ${name}@${mypath} in : ${res}`,
|
|
761
|
-
"DEBUG"
|
|
762
|
-
);
|
|
763
|
-
}
|
|
764
|
-
return `${name}`;
|
|
765
|
-
}
|
|
766
|
-
throw new Error(
|
|
767
|
-
`Can not found NPM Bundle Package : ${name}@${mypath}`
|
|
768
|
-
);
|
|
769
|
-
} catch (e) {
|
|
770
|
-
error = e;
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
try {
|
|
774
|
-
res = require.resolve(`${name}`);
|
|
775
|
-
const { version } = myrequire(
|
|
776
|
-
path.resolve(path.dirname(res), "package.json")
|
|
777
|
-
);
|
|
778
|
-
if (version === mypath) {
|
|
779
|
-
if (this.type === "SERVER") {
|
|
780
|
-
this.log(
|
|
781
|
-
`Find NPM Bundle Package : ${name}@${mypath} in : ${res}`,
|
|
782
|
-
"DEBUG"
|
|
783
|
-
);
|
|
784
|
-
}
|
|
785
|
-
return `${name}`;
|
|
786
|
-
}
|
|
787
|
-
throw new Error(
|
|
788
|
-
`Can not found NPM Bundle Package : ${name}@${mypath}`
|
|
789
|
-
);
|
|
790
|
-
} catch (e) {
|
|
791
|
-
if (error) {
|
|
792
|
-
throw error;
|
|
793
|
-
}
|
|
794
|
-
throw e;
|
|
795
|
-
}
|
|
796
|
-
} //
|
|
797
|
-
} catch (e) {}
|
|
798
|
-
}
|
|
799
|
-
res = null;
|
|
800
|
-
res = this.checkPath(mypath);
|
|
801
|
-
if (myrequire) {
|
|
802
|
-
try {
|
|
803
|
-
myrequire.resolve(res);
|
|
804
|
-
if (this.type === "SERVER") {
|
|
805
|
-
this.log(
|
|
806
|
-
`Find Local Bundle Package : ${name} in : ${res}`,
|
|
807
|
-
"DEBUG"
|
|
808
|
-
);
|
|
809
|
-
}
|
|
810
|
-
return res;
|
|
811
|
-
} catch (e) {}
|
|
812
|
-
}
|
|
813
|
-
try {
|
|
814
|
-
require.resolve(res);
|
|
815
|
-
} catch (e) {
|
|
816
|
-
// no main in package.json
|
|
817
|
-
const bundleName = this.getBundleName(name);
|
|
818
|
-
if (bundleName) {
|
|
819
|
-
try {
|
|
820
|
-
require.resolve(path.resolve(res, `${bundleName}Bundle.js`));
|
|
821
|
-
} catch (e) {
|
|
822
|
-
this.log(e, "ERROR");
|
|
823
|
-
throw new Error(`${name} is not a Bundle Package`);
|
|
824
|
-
}
|
|
825
|
-
} else {
|
|
826
|
-
throw new Error(`${name} is not a Bundle Package`);
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
if (this.type === "SERVER") {
|
|
830
|
-
this.log(`Find Local Bundle Package : ${name} in : ${res}`, "DEBUG");
|
|
831
|
-
}
|
|
832
|
-
return res;
|
|
833
|
-
} catch (e) {
|
|
834
|
-
if (error) {
|
|
835
|
-
throw error;
|
|
836
|
-
}
|
|
837
|
-
throw e;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
if (!this.isCore) {
|
|
841
|
-
if (myrequire) {
|
|
842
|
-
try {
|
|
843
|
-
res = myrequire.resolve(name);
|
|
844
|
-
this.log(`Find NPM Bundle Package : ${name} in : ${res}`, "DEBUG");
|
|
845
|
-
return name;
|
|
846
|
-
} catch (e) {}
|
|
847
|
-
try {
|
|
848
|
-
res = myrequire.resolve(`@nodefony/${name}`);
|
|
849
|
-
this.log(`Find NPM Bundle Package : ${name} in : ${res}`, "DEBUG");
|
|
850
|
-
return `@nodefony/${name}`;
|
|
851
|
-
} catch (e) {}
|
|
852
|
-
}
|
|
853
|
-
try {
|
|
854
|
-
res = require.resolve(name);
|
|
855
|
-
this.log(`Find NPM Bundle Package : ${name} in : ${res}`, "DEBUG");
|
|
856
|
-
return name;
|
|
857
|
-
} catch (e) {}
|
|
858
|
-
try {
|
|
859
|
-
res = null;
|
|
860
|
-
res = path.resolve(this.nodefonyPath, "bundles", name);
|
|
861
|
-
require.resolve(res);
|
|
862
|
-
if (this.type === "SERVER") {
|
|
863
|
-
this.log(`Find Core Bundle Package : ${name} in : ${res}`, "DEBUG");
|
|
864
|
-
}
|
|
865
|
-
return res;
|
|
866
|
-
} catch (e) {}
|
|
867
|
-
try {
|
|
868
|
-
res = null;
|
|
869
|
-
res = require.resolve(`@nodefony/${name}`);
|
|
870
|
-
if (this.type === "SERVER") {
|
|
871
|
-
this.log(
|
|
872
|
-
`Find NPM Bundle Package : @nodefony/${name} in : ${res}`,
|
|
873
|
-
"DEBUG"
|
|
874
|
-
);
|
|
875
|
-
}
|
|
876
|
-
return `@nodefony/${name}`;
|
|
877
|
-
} catch (e) {}
|
|
878
|
-
}
|
|
879
|
-
try {
|
|
880
|
-
res = null;
|
|
881
|
-
res = path.resolve(this.rootDir, "src", "bundles", name);
|
|
882
|
-
require.resolve(res);
|
|
883
|
-
if (this.type === "SERVER") {
|
|
884
|
-
this.log(`Find Local Bundle Package : ${name} in : ${res}`, "DEBUG");
|
|
885
|
-
}
|
|
886
|
-
return res;
|
|
887
|
-
} catch (e) {}
|
|
888
|
-
try {
|
|
889
|
-
res = null;
|
|
890
|
-
res = path.resolve(this.nodefonyPath, "bundles", name);
|
|
891
|
-
require.resolve(res);
|
|
892
|
-
if (this.type === "SERVER") {
|
|
893
|
-
this.log(`Find Core Bundle Package : ${name} in : ${res}`, "DEBUG");
|
|
894
|
-
}
|
|
895
|
-
return res;
|
|
896
|
-
} catch (e) {}
|
|
897
|
-
try {
|
|
898
|
-
res = null;
|
|
899
|
-
res = path.resolve(this.nodefonyPath, "..", "..", "src", "bundles", name);
|
|
900
|
-
require.resolve(res);
|
|
901
|
-
if (this.type === "SERVER") {
|
|
902
|
-
this.log(
|
|
903
|
-
`Find Core Local Bundle Package : ${name} in : ${res}`,
|
|
904
|
-
"DEBUG"
|
|
905
|
-
);
|
|
906
|
-
}
|
|
907
|
-
return res;
|
|
908
|
-
} catch (e) {}
|
|
909
|
-
try {
|
|
910
|
-
res = null;
|
|
911
|
-
const globalPath = path.resolve(
|
|
912
|
-
process.execPath,
|
|
913
|
-
"..",
|
|
914
|
-
"..",
|
|
915
|
-
"lib",
|
|
916
|
-
"node_modules",
|
|
917
|
-
"nodefony",
|
|
918
|
-
"bundle"
|
|
919
|
-
);
|
|
920
|
-
res = path.resolve(globalPath, `@nodefony/${name}`);
|
|
921
|
-
require.resolve(res);
|
|
922
|
-
if (this.type === "SERVER") {
|
|
923
|
-
this.log(
|
|
924
|
-
`Find Global Core Bundle Package : @nodefony/${name} in : ${res}`,
|
|
925
|
-
"DEBUG"
|
|
926
|
-
);
|
|
927
|
-
}
|
|
928
|
-
return res;
|
|
929
|
-
} catch (e) {}
|
|
930
|
-
try {
|
|
931
|
-
res = null;
|
|
932
|
-
const globalPath = path.resolve(
|
|
933
|
-
process.execPath,
|
|
934
|
-
"..",
|
|
935
|
-
"..",
|
|
936
|
-
"lib",
|
|
937
|
-
"node_modules",
|
|
938
|
-
"nodefony",
|
|
939
|
-
"node_modules"
|
|
940
|
-
);
|
|
941
|
-
res = path.resolve(globalPath, `@nodefony/${name}`);
|
|
942
|
-
require.resolve(res);
|
|
943
|
-
if (this.type === "SERVER") {
|
|
944
|
-
this.log(
|
|
945
|
-
`Find Global Bundle Package : @nodefony/${name} in : ${res}`,
|
|
946
|
-
"DEBUG"
|
|
947
|
-
);
|
|
948
|
-
}
|
|
949
|
-
return res;
|
|
950
|
-
} catch (e) {
|
|
951
|
-
if (error) {
|
|
952
|
-
throw error;
|
|
953
|
-
}
|
|
954
|
-
return require.resolve(name);
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
/**
|
|
959
|
-
* @method boot
|
|
960
|
-
*/
|
|
961
|
-
async boot() {
|
|
962
|
-
/*
|
|
963
|
-
* BUNDLES
|
|
964
|
-
*/
|
|
965
|
-
this.configBundle = this.getConfigBunbles();
|
|
966
|
-
const bundles = [];
|
|
967
|
-
let res = null;
|
|
968
|
-
try {
|
|
969
|
-
res = this.searchPackage("http-bundle");
|
|
970
|
-
bundles.push(res);
|
|
971
|
-
res = this.searchPackage("framework-bundle");
|
|
972
|
-
bundles.push(res);
|
|
973
|
-
if (this.settings.system.security) {
|
|
974
|
-
res = this.searchPackage("security-bundle");
|
|
975
|
-
bundles.push(res);
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
/* if (this.settings.system.documentation) {
|
|
979
|
-
res = this.searchPackage("documentation-bundle");
|
|
980
|
-
bundles.push(res);
|
|
981
|
-
}*/
|
|
982
|
-
switch (this.settings.orm) {
|
|
983
|
-
case "sequelize":
|
|
984
|
-
res = this.searchPackage("sequelize-bundle");
|
|
985
|
-
bundles.push(res);
|
|
986
|
-
break;
|
|
987
|
-
case "mongoose":
|
|
988
|
-
res = this.searchPackage("mongoose-bundle");
|
|
989
|
-
bundles.push(res);
|
|
990
|
-
break;
|
|
991
|
-
default:
|
|
992
|
-
const error = new Error(
|
|
993
|
-
`nodefony can't load ORM : ${this.settings.orm}`
|
|
994
|
-
);
|
|
995
|
-
this.log(error, "ERROR");
|
|
996
|
-
throw error;
|
|
997
|
-
}
|
|
998
|
-
if (this.settings.system.realtime) {
|
|
999
|
-
res = this.searchPackage("realtime-bundle");
|
|
1000
|
-
bundles.push(res);
|
|
1001
|
-
}
|
|
1002
|
-
if (this.settings.system.unitTest || this.type === "CONSOLE") {
|
|
1003
|
-
res = this.searchPackage("unittests-bundle");
|
|
1004
|
-
bundles.push(res);
|
|
1005
|
-
}
|
|
1006
|
-
if (this.settings.system.redis) {
|
|
1007
|
-
res = this.searchPackage("redis-bundle");
|
|
1008
|
-
bundles.push(res);
|
|
1009
|
-
}
|
|
1010
|
-
if (this.settings.system.mongo) {
|
|
1011
|
-
res = this.searchPackage("mongo-bundle");
|
|
1012
|
-
bundles.push(res);
|
|
1013
|
-
}
|
|
1014
|
-
if (this.settings.system.elastic) {
|
|
1015
|
-
res = this.searchPackage("elastic-bundle");
|
|
1016
|
-
bundles.push(res);
|
|
1017
|
-
}
|
|
1018
|
-
if (this.settings.system.mail) {
|
|
1019
|
-
res = this.searchPackage("mail-bundle");
|
|
1020
|
-
bundles.push(res);
|
|
1021
|
-
}
|
|
1022
|
-
if (this.settings.system.monitoring) {
|
|
1023
|
-
res = this.searchPackage("monitoring-bundle");
|
|
1024
|
-
bundles.push(res);
|
|
1025
|
-
}
|
|
1026
|
-
} catch (e) {
|
|
1027
|
-
this.log(e, "ERROR");
|
|
1028
|
-
this.terminate(1);
|
|
1029
|
-
}
|
|
1030
|
-
try {
|
|
1031
|
-
if (this.settings.system.demo) {
|
|
1032
|
-
res = this.searchPackage("demo-bundle");
|
|
1033
|
-
bundles.push(res);
|
|
1034
|
-
}
|
|
1035
|
-
} catch (e) {
|
|
1036
|
-
this.log(e, "ERROR");
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
switch (this.isInstall()) {
|
|
1040
|
-
case "install":
|
|
1041
|
-
return await this.install(bundles).catch((e) => {
|
|
1042
|
-
throw e;
|
|
1043
|
-
});
|
|
1044
|
-
case "rebuild":
|
|
1045
|
-
return await this.rebuild(bundles).catch((e) => {
|
|
1046
|
-
throw e;
|
|
1047
|
-
});
|
|
1048
|
-
default:
|
|
1049
|
-
return await this.preRegister(bundles)
|
|
1050
|
-
.then(() => this)
|
|
1051
|
-
.catch((e) => {
|
|
1052
|
-
throw e;
|
|
1053
|
-
});
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
async install(coreBundles = []) {
|
|
1058
|
-
const bundles = coreBundles.concat(this.configBundle, [this.appPath]);
|
|
1059
|
-
try {
|
|
1060
|
-
for (let i = 0; i < bundles.length; i++) {
|
|
1061
|
-
let bundleFile = null;
|
|
1062
|
-
try {
|
|
1063
|
-
bundleFile = new nodefony.fileClass(
|
|
1064
|
-
path.resolve(bundles[i], "package.json")
|
|
1065
|
-
);
|
|
1066
|
-
} catch (e) {
|
|
1067
|
-
const Path = this.isNodeModule(bundles[i]);
|
|
1068
|
-
if (Path) {
|
|
1069
|
-
bundleFile = new nodefony.fileClass(Path);
|
|
1070
|
-
} else {
|
|
1071
|
-
this.log(e, "ERROR");
|
|
1072
|
-
continue;
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
if (this.isCore) {
|
|
1076
|
-
await this.cli.installPackage(bundleFile, "development");
|
|
1077
|
-
} else {
|
|
1078
|
-
const dir = path.basename(bundleFile.dirName);
|
|
1079
|
-
if (!this.isBundleCore(dir)) {
|
|
1080
|
-
await this.cli.installPackage(bundleFile, "development");
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
return await this.preRegister(coreBundles).catch((e) => {
|
|
1085
|
-
throw e;
|
|
1086
|
-
});
|
|
1087
|
-
} catch (e) {
|
|
1088
|
-
this.log(e, "ERROR");
|
|
1089
|
-
throw e;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
async rebuild(coreBundles) {
|
|
1094
|
-
const bundles = coreBundles.concat(this.configBundle, [this.appPath]);
|
|
1095
|
-
try {
|
|
1096
|
-
for (let i = 0; i < bundles.length; i++) {
|
|
1097
|
-
let bundleFile = null;
|
|
1098
|
-
try {
|
|
1099
|
-
bundleFile = new nodefony.fileClass(
|
|
1100
|
-
path.resolve(bundles[i], "package.json")
|
|
1101
|
-
);
|
|
1102
|
-
} catch (e) {
|
|
1103
|
-
const Path = this.isNodeModule(bundles[i]);
|
|
1104
|
-
if (Path) {
|
|
1105
|
-
bundleFile = new nodefony.fileClass(Path);
|
|
1106
|
-
} else {
|
|
1107
|
-
this.log(e, "ERROR");
|
|
1108
|
-
continue;
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
await this.cli.rebuildPackage(bundleFile, "production");
|
|
1112
|
-
}
|
|
1113
|
-
return await this.preRegister(coreBundles).catch((e) => {
|
|
1114
|
-
throw e;
|
|
1115
|
-
});
|
|
1116
|
-
} catch (e) {
|
|
1117
|
-
this.log(e, "ERROR");
|
|
1118
|
-
throw e;
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
async preRegister(bundles) {
|
|
1123
|
-
try {
|
|
1124
|
-
// this.fire("onPreRegister", this);
|
|
1125
|
-
await this.emitAsync("onPreRegister", this).catch((e) => {
|
|
1126
|
-
throw e;
|
|
1127
|
-
});
|
|
1128
|
-
this.preRegistered = true;
|
|
1129
|
-
return await this.registerBundles(bundles)
|
|
1130
|
-
.then(async (res) => {
|
|
1131
|
-
this.preboot = true;
|
|
1132
|
-
// this.fire("onPreBoot", this);
|
|
1133
|
-
await this.emitAsync("onPreBoot", this);
|
|
1134
|
-
this.log(res, "DEBUG", "REGISTER BUNDLES");
|
|
1135
|
-
return await this.registerBundles(this.configBundle)
|
|
1136
|
-
.then(async (res) => {
|
|
1137
|
-
if (res.length) {
|
|
1138
|
-
this.log(res, "DEBUG", "REGISTER BUNDLES");
|
|
1139
|
-
}
|
|
1140
|
-
// this.fire("onRegister", this);
|
|
1141
|
-
await this.emitAsync("onRegister", this);
|
|
1142
|
-
return await this.initializeBundles().catch((e) => {
|
|
1143
|
-
throw e;
|
|
1144
|
-
});
|
|
1145
|
-
})
|
|
1146
|
-
.catch((e) => {
|
|
1147
|
-
throw e;
|
|
1148
|
-
});
|
|
1149
|
-
})
|
|
1150
|
-
.catch((e) => {
|
|
1151
|
-
throw e;
|
|
1152
|
-
});
|
|
1153
|
-
} catch (e) {
|
|
1154
|
-
this.log(e, "ERROR");
|
|
1155
|
-
throw e;
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
async onReady() {
|
|
1160
|
-
return new Promise((resolve, reject) => {
|
|
1161
|
-
// process.nextTick(() => {
|
|
1162
|
-
try {
|
|
1163
|
-
if (this.type === "SERVER") {
|
|
1164
|
-
this.initServers();
|
|
1165
|
-
if (global && global.gc) {
|
|
1166
|
-
this.memoryUsage("MEMORY POST READY ");
|
|
1167
|
-
setTimeout(() => {
|
|
1168
|
-
global.gc();
|
|
1169
|
-
this.memoryUsage("EXPOSE GARBADGE COLLECTOR ON START");
|
|
1170
|
-
}, 20000);
|
|
1171
|
-
} else {
|
|
1172
|
-
this.memoryUsage("MEMORY POST READY ");
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
return resolve(this);
|
|
1176
|
-
} catch (e) {
|
|
1177
|
-
this.log(e, "ERROR");
|
|
1178
|
-
return reject(e);
|
|
1179
|
-
}
|
|
1180
|
-
});
|
|
1181
|
-
// });
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
/**
|
|
1185
|
-
* initialisation all bundles
|
|
1186
|
-
* @method initializeBundles
|
|
1187
|
-
*/
|
|
1188
|
-
async initializeBundles() {
|
|
1189
|
-
const tab = [];
|
|
1190
|
-
try {
|
|
1191
|
-
this.app = await this.initApplication();
|
|
1192
|
-
await this.emitAsync("onPostRegister", this);
|
|
1193
|
-
} catch (e) {
|
|
1194
|
-
this.log(e, "ERROR");
|
|
1195
|
-
throw e;
|
|
1196
|
-
}
|
|
1197
|
-
// INITIALIZE
|
|
1198
|
-
try {
|
|
1199
|
-
await this.emitAsync("onInitialize", this);
|
|
1200
|
-
} catch (e) {
|
|
1201
|
-
this.log(e, "WARNING", "EVENTS onBoot");
|
|
1202
|
-
throw e;
|
|
1203
|
-
}
|
|
1204
|
-
for (const name in this.bundles) {
|
|
1205
|
-
this.log(
|
|
1206
|
-
`\x1b[36m INITIALIZE Bundle : ${name.toUpperCase()}\x1b[0m`,
|
|
1207
|
-
"DEBUG"
|
|
1208
|
-
);
|
|
1209
|
-
try {
|
|
1210
|
-
tab.push(await this.bundles[name].initialize());
|
|
1211
|
-
} catch (e) {
|
|
1212
|
-
// this.log(e, "ERROR");
|
|
1213
|
-
throw e;
|
|
1214
|
-
// continue;
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
// BOOT
|
|
1219
|
-
tab.length = 0;
|
|
1220
|
-
try {
|
|
1221
|
-
// this.fire("onBoot", this, tab);
|
|
1222
|
-
await this.emitAsync("onBoot", this, tab);
|
|
1223
|
-
} catch (e) {
|
|
1224
|
-
this.log(e, "WARNING", "EVENTS onBoot");
|
|
1225
|
-
throw e;
|
|
1226
|
-
}
|
|
1227
|
-
this.booted = true;
|
|
1228
|
-
|
|
1229
|
-
for (const name in this.bundles) {
|
|
1230
|
-
this.log(`\x1b[36m BOOT Bundle : ${name.toUpperCase()}\x1b[0m`, "DEBUG");
|
|
1231
|
-
try {
|
|
1232
|
-
tab.push(await this.bundles[name].boot());
|
|
1233
|
-
} catch (e) {
|
|
1234
|
-
this.log(e, "ERROR");
|
|
1235
|
-
// continue;
|
|
1236
|
-
throw e;
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
if (this.console) {
|
|
1240
|
-
await this.loadCommand();
|
|
1241
|
-
} else {
|
|
1242
|
-
await this.cli.assetInstall();
|
|
1243
|
-
|
|
1244
|
-
/* if (!fs.existsSync(this.cacheLink)) {
|
|
1245
|
-
try {
|
|
1246
|
-
fs.mkdirSync(this.cacheLink);
|
|
1247
|
-
this.cli.assetInstall();
|
|
1248
|
-
} catch (e) {
|
|
1249
|
-
this.log(e, "WARNING");
|
|
1250
|
-
}
|
|
1251
|
-
}*/
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
/* let bundles = [];
|
|
1255
|
-
for await (let boot of this.promisesBundleReady) {
|
|
1256
|
-
this.log(`End Waiting Bundle Ready ${boot.name}`, "DEBUG");
|
|
1257
|
-
bundles.push(boot);
|
|
1258
|
-
}*/
|
|
1259
|
-
// await this.emitAsync("onReady", this, tab);
|
|
1260
|
-
try {
|
|
1261
|
-
// this.fire("onReady", this, bundles);
|
|
1262
|
-
await this.emitAsync("onReady", this, tab);
|
|
1263
|
-
} catch (e) {
|
|
1264
|
-
this.log(e, "WARNING", "EVENTS onReady");
|
|
1265
|
-
throw e;
|
|
1266
|
-
}
|
|
1267
|
-
this.ready = true;
|
|
1268
|
-
|
|
1269
|
-
if (this.console) {
|
|
1270
|
-
return this.matchCommand()
|
|
1271
|
-
.then((command) => {
|
|
1272
|
-
let name = command;
|
|
1273
|
-
if (command && command.name) {
|
|
1274
|
-
name = command.name;
|
|
1275
|
-
}
|
|
1276
|
-
this.log(
|
|
1277
|
-
`${this.cli.getEmoji("checkered_flag")}`,
|
|
1278
|
-
"INFO",
|
|
1279
|
-
`Command ${name}`
|
|
1280
|
-
);
|
|
1281
|
-
return command;
|
|
1282
|
-
})
|
|
1283
|
-
.catch((error) => {
|
|
1284
|
-
// this.log(error, "ERROR", `COMMAND`);
|
|
1285
|
-
throw error;
|
|
1286
|
-
});
|
|
1287
|
-
}
|
|
1288
|
-
return await this.onReady()
|
|
1289
|
-
.then(async () => {
|
|
1290
|
-
await this.emitAsync("onPostReady", this);
|
|
1291
|
-
return this;
|
|
1292
|
-
})
|
|
1293
|
-
.catch((error) => {
|
|
1294
|
-
this.log(error, "CRITIC");
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
getOrm() {
|
|
1299
|
-
return this.settings.orm;
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
getOrmStrategy() {
|
|
1303
|
-
return this.getORM().settings.strategy;
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
getORM() {
|
|
1307
|
-
return this.get(this.getOrm());
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
initServers() {
|
|
1311
|
-
// create HTTP server
|
|
1312
|
-
let http = null;
|
|
1313
|
-
let http2 = null;
|
|
1314
|
-
try {
|
|
1315
|
-
if (this.settings.system.servers.http) {
|
|
1316
|
-
http = this.get("httpServer").createServer();
|
|
1317
|
-
}
|
|
1318
|
-
// create HTTPS/HTTP2 server
|
|
1319
|
-
if (this.settings.system.servers.https) {
|
|
1320
|
-
http2 = this.get("httpsServer").createServer();
|
|
1321
|
-
}
|
|
1322
|
-
// create WEBSOCKET server
|
|
1323
|
-
if (this.settings.system.servers.ws) {
|
|
1324
|
-
this.get("websocketServer").createServer(http);
|
|
1325
|
-
}
|
|
1326
|
-
// create WEBSOCKET SECURE server
|
|
1327
|
-
if (this.settings.system.servers.wss) {
|
|
1328
|
-
this.get("websocketServerSecure").createServer(http2);
|
|
1329
|
-
}
|
|
1330
|
-
} catch (e) {
|
|
1331
|
-
this.log(e, "ERROR");
|
|
1332
|
-
throw e;
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
/*
|
|
1337
|
-
* CLUSTERS
|
|
1338
|
-
*
|
|
1339
|
-
*/
|
|
1340
|
-
clusterIsMaster() {
|
|
1341
|
-
return cluster.isMaster;
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
initCluster() {
|
|
1345
|
-
this.processId = process.pid;
|
|
1346
|
-
this.process = process;
|
|
1347
|
-
if (
|
|
1348
|
-
this.console &&
|
|
1349
|
-
this.cli &&
|
|
1350
|
-
this.cli.commander &&
|
|
1351
|
-
this.cli.commander.opts().json
|
|
1352
|
-
) {
|
|
1353
|
-
return;
|
|
1354
|
-
}
|
|
1355
|
-
if (cluster.isMaster) {
|
|
1356
|
-
console.log(this.logEnv());
|
|
1357
|
-
this.fire("onCluster", "MASTER", this, process);
|
|
1358
|
-
} else if (cluster.isWorker) {
|
|
1359
|
-
console.log(this.logEnv());
|
|
1360
|
-
this.workerId = cluster.worker.id;
|
|
1361
|
-
this.worker = cluster.worker;
|
|
1362
|
-
this.fire("onCluster", "WORKER", this, process);
|
|
1363
|
-
// process.on("message", this.listen(this, "onMessage"));
|
|
1364
|
-
process.on("message", (msg) => {
|
|
1365
|
-
this.fire("onMessage", msg);
|
|
1366
|
-
});
|
|
1367
|
-
}
|
|
1368
|
-
if (nodefony.warning) {
|
|
1369
|
-
this.log(nodefony.warning, "WARNING");
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
fire() {
|
|
1374
|
-
this.log(`${colorLogEvent} ${arguments[0]}`, "DEBUG");
|
|
1375
|
-
return super.fire.apply(this, arguments);
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
emit() {
|
|
1379
|
-
this.log(`${colorLogEvent} ${arguments[0]}`, "DEBUG");
|
|
1380
|
-
return super.fire.apply(this, arguments);
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
|
-
emitAsync() {
|
|
1384
|
-
this.log(`${colorLogEvent} ${arguments[0]}`, "DEBUG");
|
|
1385
|
-
return super.emitAsync.apply(this, arguments);
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
sendMessage(message) {
|
|
1389
|
-
return process.send({
|
|
1390
|
-
type: "process:msg",
|
|
1391
|
-
data: message,
|
|
1392
|
-
});
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
/**
|
|
1396
|
-
* @method initializeLog
|
|
1397
|
-
*/
|
|
1398
|
-
initializeLog() {
|
|
1399
|
-
if (this.type === "CONSOLE") {
|
|
1400
|
-
return this.cli.initSyslog(this.environment, this.debug);
|
|
1401
|
-
}
|
|
1402
|
-
if (!this.settings.system.log.active) {
|
|
1403
|
-
return;
|
|
1404
|
-
}
|
|
1405
|
-
if (this.debug) {
|
|
1406
|
-
this.debug = this.settings.system.log.debug || true;
|
|
1407
|
-
}
|
|
1408
|
-
return this.cli.initSyslog(this.environment, this.debug);
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
/**
|
|
1412
|
-
* @method getTemplate
|
|
1413
|
-
*/
|
|
1414
|
-
getTemplate(name) {
|
|
1415
|
-
return nodefony.templates[name];
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
/**
|
|
1419
|
-
* @method initTemplate
|
|
1420
|
-
*/
|
|
1421
|
-
initTemplate() {
|
|
1422
|
-
const classTemplate = this.getTemplate(this.settings.templating);
|
|
1423
|
-
this.templating = new classTemplate(
|
|
1424
|
-
this.container,
|
|
1425
|
-
this.settings[this.settings.templating]
|
|
1426
|
-
);
|
|
1427
|
-
this.set("templating", this.templating);
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
/**
|
|
1431
|
-
* @method log
|
|
1432
|
-
*/
|
|
1433
|
-
log(pci, severity, msgid, msg) {
|
|
1434
|
-
if (!msgid) {
|
|
1435
|
-
msgid = this.cli.clc.magenta("KERNEL");
|
|
1436
|
-
}
|
|
1437
|
-
return super.log(pci, severity, msgid, msg);
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
/**
|
|
1441
|
-
* get bundle instance
|
|
1442
|
-
* @method getBundle
|
|
1443
|
-
* @param {String} name
|
|
1444
|
-
*/
|
|
1445
|
-
getBundle(name) {
|
|
1446
|
-
this.regBundleName.test(name);
|
|
1447
|
-
const res = regBundleName.exec(name);
|
|
1448
|
-
if (res) {
|
|
1449
|
-
name = res[1];
|
|
1450
|
-
}
|
|
1451
|
-
if (name === "App" || name === "app") {
|
|
1452
|
-
return this.bundles.app;
|
|
1453
|
-
}
|
|
1454
|
-
for (const ns in this.bundles) {
|
|
1455
|
-
if (ns === name) {
|
|
1456
|
-
return this.bundles[ns];
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
return null;
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
/**
|
|
1463
|
-
* get all Bundles instance
|
|
1464
|
-
* @method getBundles
|
|
1465
|
-
* @param {String} name
|
|
1466
|
-
*/
|
|
1467
|
-
getBundles(name) {
|
|
1468
|
-
if (name) {
|
|
1469
|
-
return this.getBundle(name);
|
|
1470
|
-
}
|
|
1471
|
-
return this.bundles;
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
/**
|
|
1475
|
-
* get Bundle name
|
|
1476
|
-
* @method getBundleName
|
|
1477
|
-
* @param {String} str
|
|
1478
|
-
*/
|
|
1479
|
-
getBundleName(str) {
|
|
1480
|
-
if (str === "app") {
|
|
1481
|
-
return str;
|
|
1482
|
-
}
|
|
1483
|
-
let ret = null;
|
|
1484
|
-
switch (typeof str) {
|
|
1485
|
-
case "string":
|
|
1486
|
-
ret = regBundleName.exec(str);
|
|
1487
|
-
if (ret) {
|
|
1488
|
-
return ret[1] || ret[2];
|
|
1489
|
-
}
|
|
1490
|
-
throw new Error(`Bundle Bad Name :${str}`);
|
|
1491
|
-
case "function":
|
|
1492
|
-
ret = regClassBundle.exec(str.name);
|
|
1493
|
-
if (ret) {
|
|
1494
|
-
return ret[1];
|
|
1495
|
-
}
|
|
1496
|
-
throw new Error(`Bundle Bad Name :${str.name}`);
|
|
1497
|
-
default:
|
|
1498
|
-
throw new Error(`Bundle Bad Name :${str}`);
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
getBundleClass(Class, Path) {
|
|
1503
|
-
try {
|
|
1504
|
-
switch (true) {
|
|
1505
|
-
case Class instanceof nodefony.fileClass:
|
|
1506
|
-
return this.getBundleClass(
|
|
1507
|
-
require(Class.path),
|
|
1508
|
-
require.resolve(Class.path)
|
|
1509
|
-
);
|
|
1510
|
-
case typeof Class === "function":
|
|
1511
|
-
if (Class.toString().indexOf("class") >= 0) {
|
|
1512
|
-
Class.prototype.path = path.dirname(Path);
|
|
1513
|
-
Class.prototype.autoLoader = this.autoLoader;
|
|
1514
|
-
return {
|
|
1515
|
-
class: Class,
|
|
1516
|
-
name: this.getBundleName(Class),
|
|
1517
|
-
};
|
|
1518
|
-
}
|
|
1519
|
-
throw new Error(
|
|
1520
|
-
`getBundleClass Bad Bundle Class : ${Class.toString()} Path : ${Path}`
|
|
1521
|
-
);
|
|
1522
|
-
|
|
1523
|
-
break;
|
|
1524
|
-
case typeof Class === "string":
|
|
1525
|
-
return this.getBundleClass(require(Class), require.resolve(Class));
|
|
1526
|
-
default:
|
|
1527
|
-
throw new Error(
|
|
1528
|
-
`getBundleClass Bad Bundle Class : ${typeof Class} Path : ${Path}`
|
|
1529
|
-
);
|
|
1530
|
-
}
|
|
1531
|
-
} catch (e) {
|
|
1532
|
-
throw e;
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
loadBundle(file, loader) {
|
|
1537
|
-
try {
|
|
1538
|
-
const bundle = this.getBundleClass(file);
|
|
1539
|
-
try {
|
|
1540
|
-
this.log(`${bundle.name} : ${file.path}`, "DEBUG", "LOADER BUNDLE");
|
|
1541
|
-
this.bundles[bundle.name] = new bundle.class(
|
|
1542
|
-
bundle.name,
|
|
1543
|
-
this,
|
|
1544
|
-
this.container
|
|
1545
|
-
);
|
|
1546
|
-
this.bundles[bundle.name].loader = loader;
|
|
1547
|
-
// console.log(bundle.name, this.notificationsCenter._events)
|
|
1548
|
-
} catch (e) {
|
|
1549
|
-
throw e;
|
|
1550
|
-
}
|
|
1551
|
-
// this.bundles[bundle.name].once("onReady", promiseBundleReady.call(this));
|
|
1552
|
-
return this.bundles[bundle.name];
|
|
1553
|
-
} catch (e) {
|
|
1554
|
-
throw e;
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
isPathExist(Path) {
|
|
1559
|
-
try {
|
|
1560
|
-
const mypath = path.resolve(Path);
|
|
1561
|
-
if (fs.existsSync(mypath)) {
|
|
1562
|
-
return mypath;
|
|
1563
|
-
}
|
|
1564
|
-
} catch (e) {
|
|
1565
|
-
return false;
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
isConsole() {
|
|
1570
|
-
return this.type === "CONSOLE";
|
|
1571
|
-
}
|
|
1572
|
-
|
|
1573
|
-
isInstall() {
|
|
1574
|
-
if (
|
|
1575
|
-
this.cli.command === "nodefony" &&
|
|
1576
|
-
this.cli.task === "bundles" &&
|
|
1577
|
-
this.cli.action === "install"
|
|
1578
|
-
) {
|
|
1579
|
-
return "install";
|
|
1580
|
-
}
|
|
1581
|
-
if (this.cli.command === "nodefony" && this.cli.task === "build") {
|
|
1582
|
-
return "install";
|
|
1583
|
-
}
|
|
1584
|
-
if (this.cli.command === "nodefony" && this.cli.task === "rebuild") {
|
|
1585
|
-
return "rebuild";
|
|
1586
|
-
}
|
|
1587
|
-
if (this.cli.command === "nodefony" && this.cli.task === "install") {
|
|
1588
|
-
return "install";
|
|
1589
|
-
}
|
|
1590
|
-
if (this.cli.command === "install") {
|
|
1591
|
-
this.cli.command = "nodefony";
|
|
1592
|
-
this.cli.task = "install";
|
|
1593
|
-
return "install";
|
|
1594
|
-
}
|
|
1595
|
-
return false;
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
async isBundleDirectory(dir) {
|
|
1599
|
-
const directory = this.isPathExist(dir);
|
|
1600
|
-
if (directory) {
|
|
1601
|
-
const finder = new nodefony.Finder2({
|
|
1602
|
-
followSymLink: true,
|
|
1603
|
-
excludeDir: nodefony.Bundle.excludeDir(),
|
|
1604
|
-
exclude: nodefony.Bundle.exclude(),
|
|
1605
|
-
recurse: false,
|
|
1606
|
-
match: this.regBundle,
|
|
1607
|
-
});
|
|
1608
|
-
const result = await finder.in(directory);
|
|
1609
|
-
return result.getFiles();
|
|
1610
|
-
}
|
|
1611
|
-
return false;
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
|
-
isNodeModule(module) {
|
|
1615
|
-
// console.log(module)
|
|
1616
|
-
let error = null;
|
|
1617
|
-
try {
|
|
1618
|
-
return require.resolve(module);
|
|
1619
|
-
} catch (e) {
|
|
1620
|
-
// this.log(e, "ERROR");
|
|
1621
|
-
error = e;
|
|
1622
|
-
}
|
|
1623
|
-
try {
|
|
1624
|
-
return myrequire.resolve(module);
|
|
1625
|
-
} catch (e) {
|
|
1626
|
-
this.log(e, "ERROR");
|
|
1627
|
-
return false;
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
/**
|
|
1632
|
-
* register Bundle
|
|
1633
|
-
* @method
|
|
1634
|
-
* @param {array} bundles
|
|
1635
|
-
*/
|
|
1636
|
-
registerBundles(bundles) {
|
|
1637
|
-
return new Promise(async (resolve, reject) => {
|
|
1638
|
-
switch (nodefony.typeOf(bundles)) {
|
|
1639
|
-
case "array":
|
|
1640
|
-
try {
|
|
1641
|
-
for (let i = 0; i < bundles.length; i++) {
|
|
1642
|
-
let Path = await this.isBundleDirectory(bundles[i]);
|
|
1643
|
-
if (Path && Path.length) {
|
|
1644
|
-
try {
|
|
1645
|
-
const bundle = this.loadBundle(Path[0], "filesystem");
|
|
1646
|
-
await bundle.find();
|
|
1647
|
-
} catch (e) {
|
|
1648
|
-
this.log(e, "ERROR");
|
|
1649
|
-
throw e;
|
|
1650
|
-
}
|
|
1651
|
-
} else {
|
|
1652
|
-
try {
|
|
1653
|
-
Path = this.isNodeModule(bundles[i]);
|
|
1654
|
-
if (Path) {
|
|
1655
|
-
const bundle = this.loadBundle(Path, "package");
|
|
1656
|
-
await bundle.find();
|
|
1657
|
-
} else {
|
|
1658
|
-
this.log("GLOBAL CONFIG REGISTER : ", "INFO");
|
|
1659
|
-
this.log(this.configBundle, "INFO");
|
|
1660
|
-
const gene = this.readGeneratedConfig();
|
|
1661
|
-
if (gene) {
|
|
1662
|
-
this.log(
|
|
1663
|
-
"GENERATED CONFIG REGISTER file ./config/GeneratedConfig.yml : ",
|
|
1664
|
-
"INFO"
|
|
1665
|
-
);
|
|
1666
|
-
this.log(gene, "INFO");
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
} catch (e) {
|
|
1670
|
-
this.log(e, "ERROR");
|
|
1671
|
-
throw e;
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
}
|
|
1675
|
-
return resolve(bundles);
|
|
1676
|
-
} catch (e) {
|
|
1677
|
-
return reject(e);
|
|
1678
|
-
}
|
|
1679
|
-
default:
|
|
1680
|
-
return reject(
|
|
1681
|
-
new Error("registerBundles argument bundles must be an array ")
|
|
1682
|
-
);
|
|
1683
|
-
}
|
|
1684
|
-
});
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
/**
|
|
1688
|
-
* initialisation application bundle
|
|
1689
|
-
* @method initApplication
|
|
1690
|
-
*/
|
|
1691
|
-
async initApplication() {
|
|
1692
|
-
const app = class appBundle extends nodefony.Bundle {
|
|
1693
|
-
constructor(name, myKernel, myContainer) {
|
|
1694
|
-
super(name, myKernel, myContainer);
|
|
1695
|
-
}
|
|
1696
|
-
};
|
|
1697
|
-
app.prototype.path = this.appPath;
|
|
1698
|
-
app.prototype.autoLoader = this.autoLoader;
|
|
1699
|
-
app.prototype.settings = this.settings;
|
|
1700
|
-
this.bundles.app = new app("app", this, this.container);
|
|
1701
|
-
await this.bundles.app.find();
|
|
1702
|
-
// OVERRIDE VIEWS BUNDLE in APP DIRECTORY
|
|
1703
|
-
this.once("onBoot", async () => {
|
|
1704
|
-
for (const bundle in this.bundles) {
|
|
1705
|
-
if (bundle === "app") {
|
|
1706
|
-
continue;
|
|
1707
|
-
}
|
|
1708
|
-
const result = this.bundles.app.resourcesFiles.find(`${bundle}-bundle`);
|
|
1709
|
-
if (result.length) {
|
|
1710
|
-
try {
|
|
1711
|
-
this.bundles[bundle].registerI18n(null, result);
|
|
1712
|
-
} catch (e) {
|
|
1713
|
-
this.log(e, "ERROR");
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
});
|
|
1718
|
-
return this.bundles.app;
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
// CONFIG
|
|
1722
|
-
readConfigFile(bundle, Path, callback) {
|
|
1723
|
-
try {
|
|
1724
|
-
this.log(`${bundle} CONFIG LOAD FILE :${Path}`, "DEBUG", "KERNEL READER");
|
|
1725
|
-
return this.reader.readConfig(Path, this.name, callback);
|
|
1726
|
-
} catch (e) {
|
|
1727
|
-
this.log(e, "ERROR", `BUNDLE ${bundle} CONFIG :${Path}`);
|
|
1728
|
-
throw e;
|
|
1729
|
-
}
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
|
-
readRoutingFile(bundle, Path) {
|
|
1733
|
-
// ROUTING
|
|
1734
|
-
try {
|
|
1735
|
-
this.log(`${bundle} ROUTER LOAD FILE :${Path}`, "DEBUG", "KERNEL READER");
|
|
1736
|
-
const router = this.get("router");
|
|
1737
|
-
if (router) {
|
|
1738
|
-
return router.reader(Path, this.name);
|
|
1739
|
-
}
|
|
1740
|
-
this.log(
|
|
1741
|
-
`${bundle} Router service not ready to LOAD FILE :${Path}`,
|
|
1742
|
-
"WARNING",
|
|
1743
|
-
"KERNEL READER"
|
|
1744
|
-
);
|
|
1745
|
-
} catch (e) {
|
|
1746
|
-
this.log(
|
|
1747
|
-
e,
|
|
1748
|
-
"ERROR",
|
|
1749
|
-
`BUNDLE ${this.name.toUpperCase()} CONFIG ROUTING :${Path}`
|
|
1750
|
-
);
|
|
1751
|
-
throw e;
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
readServicesFile(bundle, Path, callback) {
|
|
1756
|
-
try {
|
|
1757
|
-
this.log(`${bundle} LOAD FILE :${Path}`, "DEBUG", "KERNEL READER");
|
|
1758
|
-
return this.get("injection").reader(Path, this.name);
|
|
1759
|
-
} catch (e) {
|
|
1760
|
-
this.log(
|
|
1761
|
-
e,
|
|
1762
|
-
"ERROR",
|
|
1763
|
-
`BUNDLE ${this.name.toUpperCase()} CONFIG SERVICE :${Path}`
|
|
1764
|
-
);
|
|
1765
|
-
throw e;
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
readSecurityFile(bundle, Path, callback) {
|
|
1770
|
-
try {
|
|
1771
|
-
const firewall = this.get("security");
|
|
1772
|
-
if (firewall) {
|
|
1773
|
-
this.log(
|
|
1774
|
-
`${bundle} SECURITY LOAD FILE :${Path}`,
|
|
1775
|
-
"DEBUG",
|
|
1776
|
-
"KERNEL READER"
|
|
1777
|
-
);
|
|
1778
|
-
return firewall.reader(Path, this.name);
|
|
1779
|
-
}
|
|
1780
|
-
this.log(
|
|
1781
|
-
`${bundle} SECURITY LOAD FILE :${Path} BUT SERVICE NOT READY`,
|
|
1782
|
-
"WARNING"
|
|
1783
|
-
);
|
|
1784
|
-
} catch (e) {
|
|
1785
|
-
this.log(
|
|
1786
|
-
e,
|
|
1787
|
-
"ERROR",
|
|
1788
|
-
`BUNDLE ${this.name.toUpperCase()} CONFIG SECURITY :${Path}`
|
|
1789
|
-
);
|
|
1790
|
-
throw e;
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
findConfigFile(ele, callback) {
|
|
1795
|
-
const name = this.name.toUpperCase();
|
|
1796
|
-
switch (true) {
|
|
1797
|
-
case /^config\..*$/.test(ele.name):
|
|
1798
|
-
try {
|
|
1799
|
-
return this.kernel.readConfigFile.call(
|
|
1800
|
-
this,
|
|
1801
|
-
name,
|
|
1802
|
-
ele.path,
|
|
1803
|
-
callback
|
|
1804
|
-
);
|
|
1805
|
-
} catch (e) {
|
|
1806
|
-
throw e;
|
|
1807
|
-
}
|
|
1808
|
-
case /^routing\..*$/.test(ele.name):
|
|
1809
|
-
try {
|
|
1810
|
-
return this.kernel.readRoutingFile.call(
|
|
1811
|
-
this,
|
|
1812
|
-
name,
|
|
1813
|
-
ele.path,
|
|
1814
|
-
callback
|
|
1815
|
-
);
|
|
1816
|
-
} catch (e) {
|
|
1817
|
-
throw e;
|
|
1818
|
-
}
|
|
1819
|
-
case /^services\..*$/.test(ele.name):
|
|
1820
|
-
try {
|
|
1821
|
-
return this.kernel.readServicesFile.call(
|
|
1822
|
-
this,
|
|
1823
|
-
name,
|
|
1824
|
-
ele.path,
|
|
1825
|
-
callback
|
|
1826
|
-
);
|
|
1827
|
-
} catch (e) {
|
|
1828
|
-
throw e;
|
|
1829
|
-
}
|
|
1830
|
-
case /^security\..*$/.test(ele.name):
|
|
1831
|
-
try {
|
|
1832
|
-
return this.kernel.readSecurityFile.call(
|
|
1833
|
-
this,
|
|
1834
|
-
name,
|
|
1835
|
-
ele.path,
|
|
1836
|
-
callback
|
|
1837
|
-
);
|
|
1838
|
-
} catch (e) {
|
|
1839
|
-
throw e;
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
}
|
|
1843
|
-
|
|
1844
|
-
/**
|
|
1845
|
-
*
|
|
1846
|
-
* @method readConfig
|
|
1847
|
-
*/
|
|
1848
|
-
readConfig(error, result, callback) {
|
|
1849
|
-
if (error) {
|
|
1850
|
-
throw error;
|
|
1851
|
-
} else {
|
|
1852
|
-
if (!result) {
|
|
1853
|
-
throw new Error("readConfig no result found");
|
|
1854
|
-
}
|
|
1855
|
-
result.forEach((ele) => {
|
|
1856
|
-
try {
|
|
1857
|
-
this.kernel.findConfigFile.call(this, ele, callback);
|
|
1858
|
-
} catch (e) {
|
|
1859
|
-
throw e;
|
|
1860
|
-
}
|
|
1861
|
-
});
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
memoryUsage(message) {
|
|
1866
|
-
// let memory = process.memoryUsage() ;
|
|
1867
|
-
const { memory } = this.stats();
|
|
1868
|
-
for (const ele in memory) {
|
|
1869
|
-
switch (ele) {
|
|
1870
|
-
case "rss":
|
|
1871
|
-
this.log(
|
|
1872
|
-
`${message || ele} ( Resident Set Size ) PID ( ${
|
|
1873
|
-
this.processId
|
|
1874
|
-
} ) : ${nodefony.cli.niceBytes(memory[ele])}`,
|
|
1875
|
-
"DEBUG",
|
|
1876
|
-
`MEMORY ${ele}`
|
|
1877
|
-
);
|
|
1878
|
-
break;
|
|
1879
|
-
case "heapTotal":
|
|
1880
|
-
this.log(
|
|
1881
|
-
`${message || ele} ( Total Size of the Heap ) PID ( ${
|
|
1882
|
-
this.processId
|
|
1883
|
-
} ) : ${nodefony.cli.niceBytes(memory[ele])}`,
|
|
1884
|
-
"DEBUG",
|
|
1885
|
-
`MEMORY ${ele}`
|
|
1886
|
-
);
|
|
1887
|
-
break;
|
|
1888
|
-
case "heapUsed":
|
|
1889
|
-
this.log(
|
|
1890
|
-
`${message || ele} ( Heap actually Used ) PID ( ${
|
|
1891
|
-
this.processId
|
|
1892
|
-
} ) : ${nodefony.cli.niceBytes(memory[ele])}`,
|
|
1893
|
-
"DEBUG",
|
|
1894
|
-
`MEMORY ${ele}`
|
|
1895
|
-
);
|
|
1896
|
-
break;
|
|
1897
|
-
case "external":
|
|
1898
|
-
this.log(
|
|
1899
|
-
`${message || ele} PID ( ${
|
|
1900
|
-
this.processId
|
|
1901
|
-
} ) : ${nodefony.cli.niceBytes(memory[ele])}`,
|
|
1902
|
-
"DEBUG",
|
|
1903
|
-
`MEMORY ${ele}`
|
|
1904
|
-
);
|
|
1905
|
-
break;
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
}
|
|
1909
|
-
|
|
1910
|
-
stats() {
|
|
1911
|
-
const stat = {
|
|
1912
|
-
memory: {},
|
|
1913
|
-
// cpu:process.cpuUsage()
|
|
1914
|
-
};
|
|
1915
|
-
const memory = process.memoryUsage();
|
|
1916
|
-
for (const ele in memory) {
|
|
1917
|
-
stat.memory[ele] = memory[ele];
|
|
1918
|
-
}
|
|
1919
|
-
return stat;
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
/**
|
|
1923
|
-
*
|
|
1924
|
-
* @method terminate
|
|
1925
|
-
*/
|
|
1926
|
-
async terminate(code) {
|
|
1927
|
-
if (code === undefined) {
|
|
1928
|
-
code = 0;
|
|
1929
|
-
}
|
|
1930
|
-
if (this.debug) {
|
|
1931
|
-
console.trace(`terminate : ${code}`);
|
|
1932
|
-
}
|
|
1933
|
-
try {
|
|
1934
|
-
if (fs.existsSync(this.cacheLink)) {
|
|
1935
|
-
try {
|
|
1936
|
-
fs.rmdirSync(this.cacheLink);
|
|
1937
|
-
} catch (e) {
|
|
1938
|
-
this.log(e, "WARNING");
|
|
1939
|
-
}
|
|
1940
|
-
}
|
|
1941
|
-
await this.fireAsync("onTerminate", this, code);
|
|
1942
|
-
} catch (e) {
|
|
1943
|
-
this.log(e, "ERROR");
|
|
1944
|
-
code = 1;
|
|
1945
|
-
}
|
|
1946
|
-
process.nextTick(() => {
|
|
1947
|
-
this.log(`NODEFONY Kernel Life Cycle Terminate CODE : ${code}`, "INFO");
|
|
1948
|
-
try {
|
|
1949
|
-
nodefony.cli.quit(code);
|
|
1950
|
-
} catch (e) {
|
|
1951
|
-
this.log(e, "ERROR");
|
|
1952
|
-
}
|
|
1953
|
-
});
|
|
1954
|
-
return code;
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
nodefony.kernel = Kernel;
|
|
1959
|
-
nodefony.Kernel = Kernel;
|
|
1960
|
-
module.exports = Kernel;
|