jopijs 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -0
- package/bin/jopib.js +4 -0
- package/bin/jopin.js +4 -0
- package/dist/@bundler/_logs.d.ts +2 -0
- package/dist/@bundler/_logs.js +4 -0
- package/dist/@bundler/_logs.js.map +1 -0
- package/dist/@bundler/core.d.ts +1 -0
- package/dist/@bundler/core.js +34 -0
- package/dist/@bundler/core.js.map +1 -0
- package/dist/@bundler/esbuild.d.ts +6 -0
- package/dist/@bundler/esbuild.js +111 -0
- package/dist/@bundler/esbuild.js.map +1 -0
- package/dist/@bundler/index.d.ts +2 -0
- package/dist/@bundler/index.js +3 -0
- package/dist/@bundler/index.js.map +1 -0
- package/dist/@bundler/plugins.d.ts +13 -0
- package/dist/@bundler/plugins.js +145 -0
- package/dist/@bundler/plugins.js.map +1 -0
- package/dist/@bundler/tailwind.d.ts +3 -0
- package/dist/@bundler/tailwind.js +119 -0
- package/dist/@bundler/tailwind.js.map +1 -0
- package/dist/@core/PageComponent.d.ts +6 -0
- package/dist/@core/PageComponent.js +10 -0
- package/dist/@core/PageComponent.js.map +1 -0
- package/dist/@core/_logs.d.ts +7 -0
- package/dist/@core/_logs.js +9 -0
- package/dist/@core/_logs.js.map +1 -0
- package/dist/@core/automaticStartStop.d.ts +25 -0
- package/dist/@core/automaticStartStop.js +106 -0
- package/dist/@core/automaticStartStop.js.map +1 -0
- package/dist/@core/browserCacheControl.d.ts +21 -0
- package/dist/@core/browserCacheControl.js +17 -0
- package/dist/@core/browserCacheControl.js.map +1 -0
- package/dist/@core/bundler/bundler.d.ts +22 -0
- package/dist/@core/bundler/bundler.js +90 -0
- package/dist/@core/bundler/bundler.js.map +1 -0
- package/dist/@core/bundler/common.d.ts +2 -0
- package/dist/@core/bundler/common.js +17 -0
- package/dist/@core/bundler/common.js.map +1 -0
- package/dist/@core/bundler/config.d.ts +20 -0
- package/dist/@core/bundler/config.js +11 -0
- package/dist/@core/bundler/config.js.map +1 -0
- package/dist/@core/bundler/extraContent.d.ts +6 -0
- package/dist/@core/bundler/extraContent.js +27 -0
- package/dist/@core/bundler/extraContent.js.map +1 -0
- package/dist/@core/bundler/pagesGenerator.d.ts +1 -0
- package/dist/@core/bundler/pagesGenerator.js +173 -0
- package/dist/@core/bundler/pagesGenerator.js.map +1 -0
- package/dist/@core/bundler/server.d.ts +8 -0
- package/dist/@core/bundler/server.js +35 -0
- package/dist/@core/bundler/server.js.map +1 -0
- package/dist/@core/caches/InMemoryCache.d.ts +35 -0
- package/dist/@core/caches/InMemoryCache.js +353 -0
- package/dist/@core/caches/InMemoryCache.js.map +1 -0
- package/dist/@core/caches/SimpleFileCache.d.ts +18 -0
- package/dist/@core/caches/SimpleFileCache.js +171 -0
- package/dist/@core/caches/SimpleFileCache.js.map +1 -0
- package/dist/@core/caches/cache.d.ts +36 -0
- package/dist/@core/caches/cache.js +33 -0
- package/dist/@core/caches/cache.js.map +1 -0
- package/dist/@core/caches/webSiteMirrorCache.d.ts +16 -0
- package/dist/@core/caches/webSiteMirrorCache.js +81 -0
- package/dist/@core/caches/webSiteMirrorCache.js.map +1 -0
- package/dist/@core/gzip.d.ts +4 -0
- package/dist/@core/gzip.js +31 -0
- package/dist/@core/gzip.js.map +1 -0
- package/dist/@core/index.d.ts +18 -0
- package/dist/@core/index.js +19 -0
- package/dist/@core/index.js.map +1 -0
- package/dist/@core/internalTools.d.ts +14 -0
- package/dist/@core/internalTools.js +79 -0
- package/dist/@core/internalTools.js.map +1 -0
- package/dist/@core/jQuery.d.ts +5 -0
- package/dist/@core/jQuery.js +18 -0
- package/dist/@core/jQuery.js.map +1 -0
- package/dist/@core/jopiEasy.d.ts +287 -0
- package/dist/@core/jopiEasy.js +983 -0
- package/dist/@core/jopiEasy.js.map +1 -0
- package/dist/@core/jopiRequest.d.ts +269 -0
- package/dist/@core/jopiRequest.js +1060 -0
- package/dist/@core/jopiRequest.js.map +1 -0
- package/dist/@core/jopiServer.d.ts +77 -0
- package/dist/@core/jopiServer.js +100 -0
- package/dist/@core/jopiServer.js.map +1 -0
- package/dist/@core/jopiWebSite.d.ts +319 -0
- package/dist/@core/jopiWebSite.js +653 -0
- package/dist/@core/jopiWebSite.js.map +1 -0
- package/dist/@core/letsEncrypt.d.ts +25 -0
- package/dist/@core/letsEncrypt.js +189 -0
- package/dist/@core/letsEncrypt.js.map +1 -0
- package/dist/@core/linker.d.ts +4 -0
- package/dist/@core/linker.js +37 -0
- package/dist/@core/linker.js.map +1 -0
- package/dist/@core/loadBalancing.d.ts +18 -0
- package/dist/@core/loadBalancing.js +126 -0
- package/dist/@core/loadBalancing.js.map +1 -0
- package/dist/@core/middlewares/CorsMiddleware.d.ts +5 -0
- package/dist/@core/middlewares/CorsMiddleware.js +15 -0
- package/dist/@core/middlewares/CorsMiddleware.js.map +1 -0
- package/dist/@core/middlewares/DdosProtection.d.ts +42 -0
- package/dist/@core/middlewares/DdosProtection.js +62 -0
- package/dist/@core/middlewares/DdosProtection.js.map +1 -0
- package/dist/@core/middlewares/index.d.ts +10 -0
- package/dist/@core/middlewares/index.js +14 -0
- package/dist/@core/middlewares/index.js.map +1 -0
- package/dist/@core/publicTools.d.ts +8 -0
- package/dist/@core/publicTools.js +11 -0
- package/dist/@core/publicTools.js.map +1 -0
- package/dist/@core/routeConfig.d.ts +48 -0
- package/dist/@core/routeConfig.js +102 -0
- package/dist/@core/routeConfig.js.map +1 -0
- package/dist/@core/searchParamFilter.d.ts +70 -0
- package/dist/@core/searchParamFilter.js +212 -0
- package/dist/@core/searchParamFilter.js.map +1 -0
- package/dist/@core/serverFetch.d.ts +122 -0
- package/dist/@core/serverFetch.js +312 -0
- package/dist/@core/serverFetch.js.map +1 -0
- package/dist/@core/serverImpl/server_bunjs.d.ts +29 -0
- package/dist/@core/serverImpl/server_bunjs.js +180 -0
- package/dist/@core/serverImpl/server_bunjs.js.map +1 -0
- package/dist/@core/serverImpl/server_nodejs.d.ts +22 -0
- package/dist/@core/serverImpl/server_nodejs.js +235 -0
- package/dist/@core/serverImpl/server_nodejs.js.map +1 -0
- package/dist/@core/serverInstanceBuilder.d.ts +17 -0
- package/dist/@core/serverInstanceBuilder.js +14 -0
- package/dist/@core/serverInstanceBuilder.js.map +1 -0
- package/dist/@core/userStores.d.ts +13 -0
- package/dist/@core/userStores.js +20 -0
- package/dist/@core/userStores.js.map +1 -0
- package/dist/@crawler/common.d.ts +203 -0
- package/dist/@crawler/common.js +68 -0
- package/dist/@crawler/common.js.map +1 -0
- package/dist/@crawler/core.d.ts +87 -0
- package/dist/@crawler/core.js +586 -0
- package/dist/@crawler/core.js.map +1 -0
- package/dist/@crawler/directFileCache.d.ts +10 -0
- package/dist/@crawler/directFileCache.js +60 -0
- package/dist/@crawler/directFileCache.js.map +1 -0
- package/dist/@crawler/index.d.ts +4 -0
- package/dist/@crawler/index.js +5 -0
- package/dist/@crawler/index.js.map +1 -0
- package/dist/@crawler/urlMapping.d.ts +21 -0
- package/dist/@crawler/urlMapping.js +52 -0
- package/dist/@crawler/urlMapping.js.map +1 -0
- package/dist/@crawler/utils.d.ts +6 -0
- package/dist/@crawler/utils.js +13 -0
- package/dist/@crawler/utils.js.map +1 -0
- package/dist/@generated/index.d.ts +29 -0
- package/dist/@generated/index.js +93 -0
- package/dist/@generated/index.js.map +1 -0
- package/dist/@linker/arobaseTypes.d.ts +50 -0
- package/dist/@linker/arobaseTypes.js +235 -0
- package/dist/@linker/arobaseTypes.js.map +1 -0
- package/dist/@linker/changeProof.d.ts +5 -0
- package/dist/@linker/changeProof.js +50 -0
- package/dist/@linker/changeProof.js.map +1 -0
- package/dist/@linker/config.d.ts +2 -0
- package/dist/@linker/config.js +40 -0
- package/dist/@linker/config.js.map +1 -0
- package/dist/@linker/engine.d.ts +156 -0
- package/dist/@linker/engine.js +665 -0
- package/dist/@linker/engine.js.map +1 -0
- package/dist/@linker/index.d.ts +3 -0
- package/dist/@linker/index.js +4 -0
- package/dist/@linker/index.js.map +1 -0
- package/dist/@linker/install.d.ts +4 -0
- package/dist/@linker/install.js +42 -0
- package/dist/@linker/install.js.map +1 -0
- package/dist/@linker/modInstaller.d.ts +10 -0
- package/dist/@linker/modInstaller.js +38 -0
- package/dist/@linker/modInstaller.js.map +1 -0
- package/dist/@linker/typeEvents.d.ts +9 -0
- package/dist/@linker/typeEvents.js +48 -0
- package/dist/@linker/typeEvents.js.map +1 -0
- package/dist/@linker/typeRoutes.d.ts +23 -0
- package/dist/@linker/typeRoutes.js +197 -0
- package/dist/@linker/typeRoutes.js.map +1 -0
- package/dist/@linker/typeUiComposite.d.ts +6 -0
- package/dist/@linker/typeUiComposite.js +16 -0
- package/dist/@linker/typeUiComposite.js.map +1 -0
- package/dist/@loader/index.d.ts +1 -0
- package/dist/@loader/index.js +17 -0
- package/dist/@loader/index.js.map +1 -0
- package/dist/@loader/nodeJsLoader.d.ts +2 -0
- package/dist/@loader/nodeJsLoader.js +19 -0
- package/dist/@loader/nodeJsLoader.js.map +1 -0
- package/dist/@loader-client/index.d.ts +33 -0
- package/dist/@loader-client/index.js +98 -0
- package/dist/@loader-client/index.js.map +1 -0
- package/dist/@loader-tools/bunJsLoader.d.ts +1 -0
- package/dist/@loader-tools/bunJsLoader.js +28 -0
- package/dist/@loader-tools/bunJsLoader.js.map +1 -0
- package/dist/@loader-tools/config.d.ts +49 -0
- package/dist/@loader-tools/config.js +79 -0
- package/dist/@loader-tools/config.js.map +1 -0
- package/dist/@loader-tools/cssModuleCompiler.d.ts +5 -0
- package/dist/@loader-tools/cssModuleCompiler.js +65 -0
- package/dist/@loader-tools/cssModuleCompiler.js.map +1 -0
- package/dist/@loader-tools/esBuildPlugin.d.ts +5 -0
- package/dist/@loader-tools/esBuildPlugin.js +113 -0
- package/dist/@loader-tools/esBuildPlugin.js.map +1 -0
- package/dist/@loader-tools/index.d.ts +9 -0
- package/dist/@loader-tools/index.js +10 -0
- package/dist/@loader-tools/index.js.map +1 -0
- package/dist/@loader-tools/jopin.d.ts +10 -0
- package/dist/@loader-tools/jopin.js +331 -0
- package/dist/@loader-tools/jopin.js.map +1 -0
- package/dist/@loader-tools/nodeJsLoader.d.ts +13 -0
- package/dist/@loader-tools/nodeJsLoader.js +101 -0
- package/dist/@loader-tools/nodeJsLoader.js.map +1 -0
- package/dist/@loader-tools/nodeJsResolver.d.ts +2 -0
- package/dist/@loader-tools/nodeJsResolver.js +117 -0
- package/dist/@loader-tools/nodeJsResolver.js.map +1 -0
- package/dist/@loader-tools/rules.d.ts +3 -0
- package/dist/@loader-tools/rules.js +33 -0
- package/dist/@loader-tools/rules.js.map +1 -0
- package/dist/@loader-tools/sourceChangesWatcher.d.ts +39 -0
- package/dist/@loader-tools/sourceChangesWatcher.js +182 -0
- package/dist/@loader-tools/sourceChangesWatcher.js.map +1 -0
- package/dist/@loader-tools/tools.d.ts +21 -0
- package/dist/@loader-tools/tools.js +113 -0
- package/dist/@loader-tools/tools.js.map +1 -0
- package/dist/@loader-tools/transform.d.ts +5 -0
- package/dist/@loader-tools/transform.js +114 -0
- package/dist/@loader-tools/transform.js.map +1 -0
- package/dist/@loader-tools/virtualUrl.d.ts +9 -0
- package/dist/@loader-tools/virtualUrl.js +40 -0
- package/dist/@loader-tools/virtualUrl.js.map +1 -0
- package/dist/@tool-jopinb/index.d.ts +1 -0
- package/dist/@tool-jopinb/index.js +9 -0
- package/dist/@tool-jopinb/index.js.map +1 -0
- package/dist/@ui/components.d.ts +27 -0
- package/dist/@ui/components.js +42 -0
- package/dist/@ui/components.js.map +1 -0
- package/dist/@ui/cssModules.d.ts +11 -0
- package/dist/@ui/cssModules.js +17 -0
- package/dist/@ui/cssModules.js.map +1 -0
- package/dist/@ui/hooks.d.ts +31 -0
- package/dist/@ui/hooks.js +71 -0
- package/dist/@ui/hooks.js.map +1 -0
- package/dist/@ui/index.d.ts +9 -0
- package/dist/@ui/index.js +11 -0
- package/dist/@ui/index.js.map +1 -0
- package/dist/@ui/internal.d.ts +4 -0
- package/dist/@ui/internal.js +10 -0
- package/dist/@ui/internal.js.map +1 -0
- package/dist/@ui/modules.d.ts +41 -0
- package/dist/@ui/modules.js +74 -0
- package/dist/@ui/modules.js.map +1 -0
- package/dist/@ui/objectRegistry.d.ts +12 -0
- package/dist/@ui/objectRegistry.js +35 -0
- package/dist/@ui/objectRegistry.js.map +1 -0
- package/dist/@ui/pageController.d.ts +61 -0
- package/dist/@ui/pageController.js +166 -0
- package/dist/@ui/pageController.js.map +1 -0
- package/dist/@ui/tools.d.ts +24 -0
- package/dist/@ui/tools.js +78 -0
- package/dist/@ui/tools.js.map +1 -0
- package/dist/@uikit/core/UiKitModule.d.ts +6 -0
- package/dist/@uikit/core/UiKitModule.js +18 -0
- package/dist/@uikit/core/UiKitModule.js.map +1 -0
- package/dist/@uikit/core/index.d.ts +1 -0
- package/dist/@uikit/core/index.js +4 -0
- package/dist/@uikit/core/index.js.map +1 -0
- package/dist/@uikit/core/jBundler_ifBrowser.d.ts +1 -0
- package/dist/@uikit/core/jBundler_ifBrowser.js +5 -0
- package/dist/@uikit/core/jBundler_ifBrowser.js.map +1 -0
- package/dist/@uikit/core/jBundler_ifServer.d.ts +6 -0
- package/dist/@uikit/core/jBundler_ifServer.js +17 -0
- package/dist/@uikit/core/jBundler_ifServer.js.map +1 -0
- package/dist/@uikit/forms/components.d.ts +18 -0
- package/dist/@uikit/forms/components.js +69 -0
- package/dist/@uikit/forms/components.js.map +1 -0
- package/dist/@uikit/forms/hooks.d.ts +4 -0
- package/dist/@uikit/forms/hooks.js +31 -0
- package/dist/@uikit/forms/hooks.js.map +1 -0
- package/dist/@uikit/forms/index.d.ts +3 -0
- package/dist/@uikit/forms/index.js +4 -0
- package/dist/@uikit/forms/index.js.map +1 -0
- package/dist/@uikit/forms/interfaces.d.ts +101 -0
- package/dist/@uikit/forms/interfaces.js +4 -0
- package/dist/@uikit/forms/interfaces.js.map +1 -0
- package/dist/@uikit/forms/private.d.ts +40 -0
- package/dist/@uikit/forms/private.js +307 -0
- package/dist/@uikit/forms/private.js.map +1 -0
- package/dist/@uikit/helpers/hooks.d.ts +33 -0
- package/dist/@uikit/helpers/hooks.js +107 -0
- package/dist/@uikit/helpers/hooks.js.map +1 -0
- package/dist/@uikit/helpers/index.d.ts +2 -0
- package/dist/@uikit/helpers/index.js +3 -0
- package/dist/@uikit/helpers/index.js.map +1 -0
- package/dist/@uikit/helpers/tools.d.ts +8 -0
- package/dist/@uikit/helpers/tools.js +35 -0
- package/dist/@uikit/helpers/tools.js.map +1 -0
- package/dist/@uikit/index.d.ts +10 -0
- package/dist/@uikit/index.js +13 -0
- package/dist/@uikit/index.js.map +1 -0
- package/dist/@uikit/menu/core.d.ts +21 -0
- package/dist/@uikit/menu/core.js +191 -0
- package/dist/@uikit/menu/core.js.map +1 -0
- package/dist/@uikit/menu/hooks.d.ts +5 -0
- package/dist/@uikit/menu/hooks.js +24 -0
- package/dist/@uikit/menu/hooks.js.map +1 -0
- package/dist/@uikit/menu/index.d.ts +3 -0
- package/dist/@uikit/menu/index.js +4 -0
- package/dist/@uikit/menu/index.js.map +1 -0
- package/dist/@uikit/menu/interfaces.d.ts +20 -0
- package/dist/@uikit/menu/interfaces.js +8 -0
- package/dist/@uikit/menu/interfaces.js.map +1 -0
- package/dist/@uikit/menu/internal.d.ts +40 -0
- package/dist/@uikit/menu/internal.js +191 -0
- package/dist/@uikit/menu/internal.js.map +1 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifBrowser.d.ts +18 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifBrowser.js +40 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifBrowser.js.map +1 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifServer.d.ts +28 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifServer.js +35 -0
- package/dist/@uikit/reactRouter/hooks/jBundler_ifServer.js.map +1 -0
- package/dist/@uikit/reactRouter/index.d.ts +1 -0
- package/dist/@uikit/reactRouter/index.js +2 -0
- package/dist/@uikit/reactRouter/index.js.map +1 -0
- package/dist/@uikit/users/hooks.d.ts +10 -0
- package/dist/@uikit/users/hooks.js +39 -0
- package/dist/@uikit/users/hooks.js.map +1 -0
- package/dist/@uikit/users/index.d.ts +1 -0
- package/dist/@uikit/users/index.js +2 -0
- package/dist/@uikit/users/index.js.map +1 -0
- package/dist/@uikit/variants/index.d.ts +7 -0
- package/dist/@uikit/variants/index.js +16 -0
- package/dist/@uikit/variants/index.js.map +1 -0
- package/package.json +115 -0
- package/src/@bundler/README.md +1 -0
- package/src/@bundler/_logs.ts +4 -0
- package/src/@bundler/core.ts +41 -0
- package/src/@bundler/esbuild.ts +141 -0
- package/src/@bundler/index.ts +3 -0
- package/src/@bundler/plugins.ts +163 -0
- package/src/@bundler/tailwind.ts +139 -0
- package/src/@core/PageComponent.tsx +25 -0
- package/src/@core/README.md +1 -0
- package/src/@core/_logs.ts +11 -0
- package/src/@core/automaticStartStop.ts +132 -0
- package/src/@core/browserCacheControl.ts +40 -0
- package/src/@core/bundler/bundler.ts +128 -0
- package/src/@core/bundler/common.ts +18 -0
- package/src/@core/bundler/config.ts +37 -0
- package/src/@core/bundler/extraContent.ts +30 -0
- package/src/@core/bundler/pagesGenerator.ts +194 -0
- package/src/@core/bundler/server.ts +41 -0
- package/src/@core/caches/InMemoryCache.ts +483 -0
- package/src/@core/caches/SimpleFileCache.ts +205 -0
- package/src/@core/caches/cache.ts +77 -0
- package/src/@core/caches/webSiteMirrorCache.ts +90 -0
- package/src/@core/cheerio.d.ts +332 -0
- package/src/@core/gzip.ts +33 -0
- package/src/@core/index.ts +23 -0
- package/src/@core/internalTools.ts +95 -0
- package/src/@core/jQuery.ts +22 -0
- package/src/@core/jopiEasy.ts +1285 -0
- package/src/@core/jopiRequest.tsx +1279 -0
- package/src/@core/jopiServer.ts +188 -0
- package/src/@core/jopiWebSite.tsx +1027 -0
- package/src/@core/letsEncrypt.ts +243 -0
- package/src/@core/linker.ts +42 -0
- package/src/@core/loadBalancing.ts +152 -0
- package/src/@core/middlewares/CorsMiddleware.ts +23 -0
- package/src/@core/middlewares/DdosProtection.ts +120 -0
- package/src/@core/middlewares/index.ts +16 -0
- package/src/@core/publicTools.ts +14 -0
- package/src/@core/routeConfig.ts +104 -0
- package/src/@core/searchParamFilter.ts +315 -0
- package/src/@core/serverFetch.ts +454 -0
- package/src/@core/serverImpl/server_bunjs.tsx +230 -0
- package/src/@core/serverImpl/server_nodejs.ts +312 -0
- package/src/@core/serverInstanceBuilder.ts +36 -0
- package/src/@core/userStores.ts +34 -0
- package/src/@crawler/README.md +1 -0
- package/src/@crawler/common.ts +275 -0
- package/src/@crawler/core.ts +678 -0
- package/src/@crawler/directFileCache.ts +69 -0
- package/src/@crawler/index.ts +4 -0
- package/src/@crawler/urlMapping.ts +67 -0
- package/src/@crawler/utils.ts +13 -0
- package/src/@generated/index.ts +134 -0
- package/src/@linker/arobaseTypes.ts +325 -0
- package/src/@linker/changeProof.ts +53 -0
- package/src/@linker/config.ts +46 -0
- package/src/@linker/engine.ts +865 -0
- package/src/@linker/index.ts +3 -0
- package/src/@linker/install.ts +39 -0
- package/src/@linker/modInstaller.ts +50 -0
- package/src/@linker/typeEvents.ts +58 -0
- package/src/@linker/typeRoutes.ts +255 -0
- package/src/@linker/typeUiComposite.ts +19 -0
- package/src/@loader/README.md +4 -0
- package/src/@loader/bunHtmlCompiler.mjs +27 -0
- package/src/@loader/index.ts +19 -0
- package/src/@loader/loader.mjs +7 -0
- package/src/@loader/nodeJsLoader.ts +21 -0
- package/src/@loader-client/README.md +2 -0
- package/src/@loader-client/index.ts +108 -0
- package/src/@loader-tools/README.md +6 -0
- package/src/@loader-tools/bunJsLoader.ts +33 -0
- package/src/@loader-tools/config.ts +142 -0
- package/src/@loader-tools/cssModuleCompiler.ts +76 -0
- package/src/@loader-tools/esBuildPlugin.ts +142 -0
- package/src/@loader-tools/index.ts +11 -0
- package/src/@loader-tools/jopin.ts +403 -0
- package/src/@loader-tools/nodeJsLoader.ts +119 -0
- package/src/@loader-tools/nodeJsResolver.ts +140 -0
- package/src/@loader-tools/rules.ts +45 -0
- package/src/@loader-tools/sourceChangesWatcher.ts +225 -0
- package/src/@loader-tools/tools.ts +139 -0
- package/src/@loader-tools/transform.ts +138 -0
- package/src/@loader-tools/virtualUrl.ts +57 -0
- package/src/@loader-types/README.md +15 -0
- package/src/@loader-types/extensions.d.ts +65 -0
- package/src/@tool-jopinb/README.md +1 -0
- package/src/@tool-jopinb/index.ts +11 -0
- package/src/@ui/README.md +3 -0
- package/src/@ui/components.tsx +49 -0
- package/src/@ui/cssModules.tsx +27 -0
- package/src/@ui/hooks.tsx +95 -0
- package/src/@ui/index.ts +13 -0
- package/src/@ui/internal.ts +12 -0
- package/src/@ui/modules.ts +100 -0
- package/src/@ui/objectRegistry.ts +50 -0
- package/src/@ui/pageController.ts +203 -0
- package/src/@ui/tools.ts +116 -0
- package/src/@uikit/README.md +1 -0
- package/src/@uikit/core/UiKitModule.ts +20 -0
- package/src/@uikit/core/index.ts +4 -0
- package/src/@uikit/core/jBundler_ifBrowser.ts +4 -0
- package/src/@uikit/core/jBundler_ifServer.ts +18 -0
- package/src/@uikit/forms/components.tsx +97 -0
- package/src/@uikit/forms/hooks.ts +38 -0
- package/src/@uikit/forms/index.ts +3 -0
- package/src/@uikit/forms/interfaces.ts +159 -0
- package/src/@uikit/forms/private.ts +365 -0
- package/src/@uikit/helpers/hooks.ts +133 -0
- package/src/@uikit/helpers/index.ts +2 -0
- package/src/@uikit/helpers/tools.ts +39 -0
- package/src/@uikit/index.ts +15 -0
- package/src/@uikit/menu/core.ts +227 -0
- package/src/@uikit/menu/hooks.ts +28 -0
- package/src/@uikit/menu/index.ts +3 -0
- package/src/@uikit/menu/interfaces.ts +26 -0
- package/src/@uikit/menu/internal.ts +218 -0
- package/src/@uikit/package.json +15 -0
- package/src/@uikit/reactRouter/hooks/jBundler_ifBrowser.tsx +59 -0
- package/src/@uikit/reactRouter/hooks/jBundler_ifServer.tsx +51 -0
- package/src/@uikit/reactRouter/index.ts +1 -0
- package/src/@uikit/users/hooks.ts +50 -0
- package/src/@uikit/users/index.ts +1 -0
- package/src/@uikit/variants/index.tsx +20 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { JopiMiddleware, JopiPostMiddleware, WebSiteImpl } from "./jopiWebSite.tsx";
|
|
2
|
+
import type { JopiRequest } from "./jopiRequest.tsx";
|
|
3
|
+
import { PriorityLevel } from "jopi-toolkit/jk_tools";
|
|
4
|
+
export declare class RouteConfig {
|
|
5
|
+
private readonly webSite;
|
|
6
|
+
private readonly route;
|
|
7
|
+
constructor(webSite: WebSiteImpl, route: string);
|
|
8
|
+
readonly onGET: RouteConfig_OnGET;
|
|
9
|
+
readonly onPOST: RouteConfig_Core;
|
|
10
|
+
readonly onPUT: RouteConfig_Core;
|
|
11
|
+
readonly onDELETE: RouteConfig_Core;
|
|
12
|
+
readonly onHEAD: RouteConfig_Core;
|
|
13
|
+
readonly onPATCH: RouteConfig_Core;
|
|
14
|
+
readonly onOPTIONS: RouteConfig_Core;
|
|
15
|
+
readonly onALL: RouteConfig_Core;
|
|
16
|
+
}
|
|
17
|
+
declare class RouteConfig_Core {
|
|
18
|
+
protected readonly webSite: WebSiteImpl;
|
|
19
|
+
protected readonly route: string;
|
|
20
|
+
protected readonly method: string;
|
|
21
|
+
constructor(webSite: WebSiteImpl, route: string, method: string);
|
|
22
|
+
add_middleware(middleware: JopiMiddleware, priority?: PriorityLevel): void;
|
|
23
|
+
add_postMiddleware(middleware: JopiPostMiddleware, priority?: PriorityLevel): void;
|
|
24
|
+
add_requiredRole(...roles: string[]): void;
|
|
25
|
+
}
|
|
26
|
+
declare class RouteConfig_OnGET extends RouteConfig_Core {
|
|
27
|
+
cache_disableAutomaticCache(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Define a function which is called when the response is get from the cache.
|
|
30
|
+
* If a value is returned, then this value is used as the new value,
|
|
31
|
+
* allowing to replace what comes from the cache.
|
|
32
|
+
* @param handler
|
|
33
|
+
*/
|
|
34
|
+
cache_afterGetFromCache(handler: (req: JopiRequest, res: Response) => Promise<Response | undefined | void>): void;
|
|
35
|
+
/**
|
|
36
|
+
* Defines a function which can alter the response to save into the cache or avoid cache adding.
|
|
37
|
+
* If returns a response: this response will be added into the cache.
|
|
38
|
+
* If returns undefined: will not add the response into the cache.
|
|
39
|
+
*/
|
|
40
|
+
cache_beforeAddToCache(handler: (req: JopiRequest, res: Response) => Promise<Response | undefined | void>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Define a function which is called before checking the cache.
|
|
43
|
+
* This allows doing some checking, and if needed, it can return
|
|
44
|
+
* a response and bypass the request cycle.
|
|
45
|
+
*/
|
|
46
|
+
cache_beforeCheckingCache(handler: (req: JopiRequest) => Promise<Response | undefined | void>): void;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { PriorityLevel } from "jopi-toolkit/jk_tools";
|
|
2
|
+
export class RouteConfig {
|
|
3
|
+
webSite;
|
|
4
|
+
route;
|
|
5
|
+
constructor(webSite, route) {
|
|
6
|
+
this.webSite = webSite;
|
|
7
|
+
this.route = route;
|
|
8
|
+
this.onGET = new RouteConfig_OnGET(this.webSite, this.route, "GET");
|
|
9
|
+
this.onPOST = new RouteConfig_Core(this.webSite, this.route, "POST");
|
|
10
|
+
this.onPUT = new RouteConfig_Core(this.webSite, this.route, "PUT");
|
|
11
|
+
this.onDELETE = new RouteConfig_Core(this.webSite, this.route, "DELETE");
|
|
12
|
+
this.onHEAD = new RouteConfig_Core(this.webSite, this.route, "HEAD");
|
|
13
|
+
this.onPATCH = new RouteConfig_Core(this.webSite, this.route, "PATCH");
|
|
14
|
+
this.onOPTIONS = new RouteConfig_Core(this.webSite, this.route, "OPTIONS");
|
|
15
|
+
this.onALL = new RouteConfig_Core(this.webSite, this.route, "*");
|
|
16
|
+
}
|
|
17
|
+
onGET;
|
|
18
|
+
onPOST;
|
|
19
|
+
onPUT;
|
|
20
|
+
onDELETE;
|
|
21
|
+
onHEAD;
|
|
22
|
+
onPATCH;
|
|
23
|
+
onOPTIONS;
|
|
24
|
+
onALL;
|
|
25
|
+
}
|
|
26
|
+
class RouteConfig_Core {
|
|
27
|
+
webSite;
|
|
28
|
+
route;
|
|
29
|
+
method;
|
|
30
|
+
constructor(webSite, route, method) {
|
|
31
|
+
this.webSite = webSite;
|
|
32
|
+
this.route = route;
|
|
33
|
+
this.method = method;
|
|
34
|
+
}
|
|
35
|
+
add_middleware(middleware, priority = PriorityLevel.default) {
|
|
36
|
+
let routeInfos = this.webSite.getRouteInfos(this.method, this.route);
|
|
37
|
+
if (!routeInfos)
|
|
38
|
+
return;
|
|
39
|
+
if (!routeInfos.middlewares)
|
|
40
|
+
routeInfos.middlewares = [];
|
|
41
|
+
routeInfos.middlewares.push({ priority, value: middleware });
|
|
42
|
+
}
|
|
43
|
+
add_postMiddleware(middleware, priority = PriorityLevel.default) {
|
|
44
|
+
let routeInfos = this.webSite.getRouteInfos(this.method, this.route);
|
|
45
|
+
if (!routeInfos)
|
|
46
|
+
return;
|
|
47
|
+
if (!routeInfos.postMiddlewares)
|
|
48
|
+
routeInfos.postMiddlewares = [];
|
|
49
|
+
routeInfos.postMiddlewares.push({ priority, value: middleware });
|
|
50
|
+
}
|
|
51
|
+
add_requiredRole(...roles) {
|
|
52
|
+
let routeInfos = this.webSite.getRouteInfos(this.method, this.route);
|
|
53
|
+
if (!routeInfos)
|
|
54
|
+
return;
|
|
55
|
+
if (!routeInfos.requiredRoles)
|
|
56
|
+
routeInfos.requiredRoles = [];
|
|
57
|
+
routeInfos?.requiredRoles.push(...roles);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
class RouteConfig_OnGET extends RouteConfig_Core {
|
|
61
|
+
cache_disableAutomaticCache() {
|
|
62
|
+
let routeInfos = this.webSite.getRouteInfos("GET", this.route);
|
|
63
|
+
if (!routeInfos)
|
|
64
|
+
return;
|
|
65
|
+
routeInfos.mustEnableAutomaticCache = false;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Define a function which is called when the response is get from the cache.
|
|
69
|
+
* If a value is returned, then this value is used as the new value,
|
|
70
|
+
* allowing to replace what comes from the cache.
|
|
71
|
+
* @param handler
|
|
72
|
+
*/
|
|
73
|
+
cache_afterGetFromCache(handler) {
|
|
74
|
+
let routeInfos = this.webSite.getRouteInfos("GET", this.route);
|
|
75
|
+
if (!routeInfos)
|
|
76
|
+
return;
|
|
77
|
+
routeInfos.afterGetFromCache = handler;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Defines a function which can alter the response to save into the cache or avoid cache adding.
|
|
81
|
+
* If returns a response: this response will be added into the cache.
|
|
82
|
+
* If returns undefined: will not add the response into the cache.
|
|
83
|
+
*/
|
|
84
|
+
cache_beforeAddToCache(handler) {
|
|
85
|
+
let routeInfos = this.webSite.getRouteInfos("GET", this.route);
|
|
86
|
+
if (!routeInfos)
|
|
87
|
+
return;
|
|
88
|
+
routeInfos.beforeAddToCache = handler;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Define a function which is called before checking the cache.
|
|
92
|
+
* This allows doing some checking, and if needed, it can return
|
|
93
|
+
* a response and bypass the request cycle.
|
|
94
|
+
*/
|
|
95
|
+
cache_beforeCheckingCache(handler) {
|
|
96
|
+
let routeInfos = this.webSite.getRouteInfos("GET", this.route);
|
|
97
|
+
if (!routeInfos)
|
|
98
|
+
return;
|
|
99
|
+
routeInfos.beforeCheckingCache = handler;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=routeConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeConfig.js","sourceRoot":"","sources":["../../src/@core/routeConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAEpD,MAAM,OAAO,WAAW;IACS;IACA;IAD7B,YAA6B,OAAoB,EACpB,KAAa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AAK,CAAC,CAAC;IAC7C,CAAC;CACJ;AAED,MAAM,iBAAkB,SAAQ,gBAAgB;IAC5C,2BAA2B;QACvB,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU;YAAE,OAAO;QAExB,UAAU,CAAC,wBAAwB,GAAG,KAAK,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACH,uBAAuB,CAAC,OAAkF;QACtG,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU;YAAE,OAAO;QAExB,UAAU,CAAC,iBAAiB,GAAG,OAAO,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,sBAAsB,CAAC,OAAkF;QACrG,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU;YAAE,OAAO;QAExB,UAAU,CAAC,gBAAgB,GAAG,OAAO,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACH,yBAAyB,CAAC,OAAmE;QACzF,IAAI,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/D,IAAI,CAAC,UAAU;YAAE,OAAO;QAExB,UAAU,CAAC,mBAAmB,GAAG,OAAO,CAAC;IAC7C,CAAC;CACJ"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface SearchParamFilter {
|
|
2
|
+
/**
|
|
3
|
+
* If true, transform the search param value to uppercase.
|
|
4
|
+
* The default value is false.
|
|
5
|
+
*/
|
|
6
|
+
toUpperCase?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* If true, transforme the search value to lowercase.
|
|
9
|
+
* Has priority over toUpperCase.
|
|
10
|
+
* Default value is true.
|
|
11
|
+
*/
|
|
12
|
+
toLowerCase?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* If true, then ignore toLowerCase and toUpperCase.
|
|
15
|
+
* The default value is false.
|
|
16
|
+
*/
|
|
17
|
+
ignoreCase?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If true, all values are allowed.
|
|
20
|
+
* Default is false.
|
|
21
|
+
*/
|
|
22
|
+
allowAllValues?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* If defined, then limit possible value to this list.
|
|
25
|
+
* Has priority over allowAllValue.
|
|
26
|
+
*/
|
|
27
|
+
values?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* If true, then we can have the param name without a value.
|
|
30
|
+
* Default is false.
|
|
31
|
+
*/
|
|
32
|
+
allowsNameOnly?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The max number of time this search params can be present.
|
|
35
|
+
* The default value is 1.
|
|
36
|
+
*/
|
|
37
|
+
max?: number;
|
|
38
|
+
/**
|
|
39
|
+
* If this search param is not present, then add it with this value.
|
|
40
|
+
*/
|
|
41
|
+
defaultValue?: string;
|
|
42
|
+
/**
|
|
43
|
+
* For dev tests.
|
|
44
|
+
* Allow calling "debugger" when processing this rule.
|
|
45
|
+
*/
|
|
46
|
+
debug?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export declare enum SortValues {
|
|
49
|
+
ASC = "asc",
|
|
50
|
+
DESC = "desc",
|
|
51
|
+
IGNORE = "ignore"
|
|
52
|
+
}
|
|
53
|
+
export interface FilterOptions {
|
|
54
|
+
/**
|
|
55
|
+
* Allow saying how to sort params.
|
|
56
|
+
* The default value is ASC.
|
|
57
|
+
*/
|
|
58
|
+
sort?: SortValues;
|
|
59
|
+
/**
|
|
60
|
+
* If true, then remove all search params.
|
|
61
|
+
*/
|
|
62
|
+
removeAll?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export type SearchParamFilterFunction = (url: URL) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Create an optimized function which will filter a URL search params.
|
|
67
|
+
*/
|
|
68
|
+
export declare function buildSearchParamFilter(options: FilterOptions, params: {
|
|
69
|
+
[paramName: string]: SearchParamFilter;
|
|
70
|
+
}): SearchParamFilterFunction;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
export var SortValues;
|
|
2
|
+
(function (SortValues) {
|
|
3
|
+
// noinspection JSUnusedGlobalSymbols
|
|
4
|
+
SortValues["ASC"] = "asc";
|
|
5
|
+
SortValues["DESC"] = "desc";
|
|
6
|
+
SortValues["IGNORE"] = "ignore";
|
|
7
|
+
})(SortValues || (SortValues = {}));
|
|
8
|
+
/**
|
|
9
|
+
* Create an optimized function which will filter a URL search params.
|
|
10
|
+
*/
|
|
11
|
+
export function buildSearchParamFilter(options, params) {
|
|
12
|
+
if (options.removeAll) {
|
|
13
|
+
return url => url.search = "";
|
|
14
|
+
}
|
|
15
|
+
if (options.sort === undefined)
|
|
16
|
+
options.sort = SortValues.ASC;
|
|
17
|
+
const filters = {};
|
|
18
|
+
for (const paramName in params) {
|
|
19
|
+
const filter = params[paramName];
|
|
20
|
+
if (filter.max === 0)
|
|
21
|
+
continue;
|
|
22
|
+
filters[paramName] = optionsToFunction(params[paramName]);
|
|
23
|
+
}
|
|
24
|
+
let paramNames = Object.keys(filters);
|
|
25
|
+
if (options.sort === SortValues.ASC) {
|
|
26
|
+
paramNames = paramNames.sort();
|
|
27
|
+
}
|
|
28
|
+
else if (options.sort === SortValues.DESC) {
|
|
29
|
+
paramNames = paramNames.sort().reverse();
|
|
30
|
+
}
|
|
31
|
+
return function (url) {
|
|
32
|
+
if (!url.search)
|
|
33
|
+
return;
|
|
34
|
+
const sp = url.searchParams;
|
|
35
|
+
let newSearchValue = "";
|
|
36
|
+
paramNames.forEach(paramName => {
|
|
37
|
+
const filterPart = filters[paramName];
|
|
38
|
+
if (filterPart.debug)
|
|
39
|
+
debugger;
|
|
40
|
+
let values;
|
|
41
|
+
if (filterPart.onlyOneParam) {
|
|
42
|
+
const value = sp.get(paramName);
|
|
43
|
+
if (!value) {
|
|
44
|
+
if (filterPart.allowsNameOnly && sp.has(paramName)) {
|
|
45
|
+
newSearchValue += `&${paramName}`;
|
|
46
|
+
}
|
|
47
|
+
if (filterPart.defaultValue) {
|
|
48
|
+
newSearchValue += `&${paramName}=${filterPart.defaultValue}`;
|
|
49
|
+
}
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
values = [value];
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
values = sp.getAll(paramName);
|
|
56
|
+
if (values.length === 0) {
|
|
57
|
+
if (filterPart.defaultValue) {
|
|
58
|
+
newSearchValue += `&${paramName}=${filterPart.defaultValue}`;
|
|
59
|
+
}
|
|
60
|
+
else if (filterPart.allowsNameOnly && sp.has(paramName)) {
|
|
61
|
+
newSearchValue += `&${paramName}`;
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
else if ((values.length === 1) && (values[0].length === 0)) {
|
|
66
|
+
if (filterPart.allowsNameOnly) {
|
|
67
|
+
newSearchValue += `&${paramName}`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const pipeline = filterPart.pipeline;
|
|
72
|
+
if (pipeline.length === 1) {
|
|
73
|
+
pipeline[0](values);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
for (let i = 0; i < pipeline.length; i++) {
|
|
77
|
+
if (!pipeline[i](values))
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (values.length) {
|
|
82
|
+
if (values.length === 1) {
|
|
83
|
+
if (values[0].length !== 0) {
|
|
84
|
+
newSearchValue += `&${paramName}=${values[0]}`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
values.forEach(v => {
|
|
89
|
+
if (v.length !== 0)
|
|
90
|
+
newSearchValue += `&${paramName}=${v}`;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
if (newSearchValue.length)
|
|
96
|
+
url.search = "?" + newSearchValue.substring(1);
|
|
97
|
+
else
|
|
98
|
+
url.search = "";
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function optionsToFunction(filter) {
|
|
102
|
+
const res = {
|
|
103
|
+
pipeline: [],
|
|
104
|
+
isRemoveAll: false,
|
|
105
|
+
onlyOneParam: false,
|
|
106
|
+
allowsNameOnly: false,
|
|
107
|
+
debug: filter.debug
|
|
108
|
+
};
|
|
109
|
+
const pipeline = res.pipeline;
|
|
110
|
+
//region Set default filter values
|
|
111
|
+
if (filter.max === undefined)
|
|
112
|
+
filter.max = 1;
|
|
113
|
+
if (filter.allowAllValues === undefined)
|
|
114
|
+
filter.allowAllValues = false;
|
|
115
|
+
if (filter.allowsNameOnly === undefined)
|
|
116
|
+
filter.allowsNameOnly = false;
|
|
117
|
+
if (!filter.allowAllValues) {
|
|
118
|
+
if (!filter.values) {
|
|
119
|
+
res.isRemoveAll = true;
|
|
120
|
+
return res;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (filter.ignoreCase) {
|
|
124
|
+
filter.toLowerCase = false;
|
|
125
|
+
filter.toUpperCase = false;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
if (!filter.toLowerCase) {
|
|
129
|
+
filter.toLowerCase = !filter.toUpperCase;
|
|
130
|
+
}
|
|
131
|
+
if (filter.toUpperCase) {
|
|
132
|
+
if (filter.toLowerCase) {
|
|
133
|
+
filter.toUpperCase = false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
filter.toUpperCase = false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//endregion
|
|
141
|
+
const limitToOne = filter.max === 1;
|
|
142
|
+
res.onlyOneParam = limitToOne;
|
|
143
|
+
res.defaultValue = filter.defaultValue;
|
|
144
|
+
res.allowsNameOnly = filter.allowsNameOnly;
|
|
145
|
+
// Transform allowed value.
|
|
146
|
+
//
|
|
147
|
+
if (filter.values) {
|
|
148
|
+
if (filter.toLowerCase)
|
|
149
|
+
filter.values = filter.values.map(v => v.toLowerCase());
|
|
150
|
+
else if (filter.toUpperCase)
|
|
151
|
+
filter.values = filter.values.map(v => v.toUpperCase());
|
|
152
|
+
}
|
|
153
|
+
if (filter.toUpperCase) {
|
|
154
|
+
if (limitToOne) {
|
|
155
|
+
pipeline.push(all => {
|
|
156
|
+
all[0] = all[0].toUpperCase();
|
|
157
|
+
return true;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
pipeline.push(all => {
|
|
162
|
+
all.forEach((v, i) => {
|
|
163
|
+
all[i] = v.toUpperCase();
|
|
164
|
+
});
|
|
165
|
+
return true;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else if (filter.toLowerCase) {
|
|
170
|
+
if (limitToOne) {
|
|
171
|
+
pipeline.push(all => {
|
|
172
|
+
all[0] = all[0].toLowerCase();
|
|
173
|
+
return true;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
pipeline.push(all => {
|
|
178
|
+
all.forEach((v, i) => {
|
|
179
|
+
all[i] = v.toLowerCase();
|
|
180
|
+
});
|
|
181
|
+
return true;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (!filter.allowAllValues) {
|
|
186
|
+
const allowedValues = filter.values;
|
|
187
|
+
if (limitToOne) {
|
|
188
|
+
pipeline.push(v => {
|
|
189
|
+
const res = allowedValues.includes(v[0]);
|
|
190
|
+
if (!res) {
|
|
191
|
+
v[0] = "";
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
pipeline.push(v => {
|
|
199
|
+
let res = false;
|
|
200
|
+
for (let i = 0; i < v.length; i++) {
|
|
201
|
+
if (!allowedValues.includes(v[i]))
|
|
202
|
+
v[i] = "";
|
|
203
|
+
else
|
|
204
|
+
res = true;
|
|
205
|
+
}
|
|
206
|
+
return res;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return res;
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=searchParamFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchParamFilter.js","sourceRoot":"","sources":["../../src/@core/searchParamFilter.ts"],"names":[],"mappings":"AAoEA,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,qCAAqC;IACrC,yBAAW,CAAA;IAAE,2BAAa,CAAA;IAAE,+BAAiB,CAAA;AACjD,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AA2BD;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAsB,EAAE,MAAgD;IAC3G,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACpB,OAAO,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;IAClC,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAG,SAAS;QAAE,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC;IAE5D,MAAM,OAAO,GAAsC,EAAE,CAAC;IAEtD,KAAK,MAAM,SAAS,IAAI,MAAM,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QACjC,IAAI,MAAM,CAAC,GAAG,KAAG,CAAC;YAAE,SAAS;QAE7B,OAAO,CAAC,SAAS,CAAC,GAAG,iBAAiB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,IAAI,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEtC,IAAI,OAAO,CAAC,IAAI,KAAG,U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AO,IAAI,CAAC;YAChB,CAAC,CAAC,CAAA;QACN,CAAC;aACI,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;gBACd,IAAI,GAAG,GAAG,KAAK,CAAC;gBAEhB,KAAK,IAAI,CAAC,GAAC,CAAC,EAAC,CAAC,GAAC,CAAC,CAAC,MAAM,EAAC,CAAC,EAAE,EAAE,CAAC;oBAC1B,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;;wBACxC,GAAG,GAAG,IAAI,CAAC;gBACpB,CAAC;gBAED,OAAO,GAAG,CAAC;YACf,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { type SendingBody } from "./jopiWebSite.tsx";
|
|
2
|
+
import type { LoadBalancer } from "./loadBalancing.ts";
|
|
3
|
+
import { JopiRequest } from "./jopiRequest.js";
|
|
4
|
+
export interface ServerDownResult<T> {
|
|
5
|
+
newServer?: ServerFetch<T>;
|
|
6
|
+
newServerWeight?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface FetchOptions {
|
|
9
|
+
headers?: Headers;
|
|
10
|
+
method?: string;
|
|
11
|
+
verbose?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ServerFetchOptions<T> {
|
|
14
|
+
/**
|
|
15
|
+
* Allow automatically removing the trailing slashs for the website root.
|
|
16
|
+
* If I have http://127.0.0.1/, then it's begun http://127.0.0.1
|
|
17
|
+
* Default value is false.
|
|
18
|
+
*/
|
|
19
|
+
removeRootTrailingSlash?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Is called before a request.
|
|
22
|
+
* Is used to start the server if we are doing headless.
|
|
23
|
+
*/
|
|
24
|
+
beforeRequesting?: (url: string, fetchOptions: FetchOptions, data: T) => void | Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Is called if we detect that the server is down.
|
|
27
|
+
* Allow starting a script which will restart the server
|
|
28
|
+
* or send a mal to the admin.
|
|
29
|
+
*
|
|
30
|
+
* @returns
|
|
31
|
+
* true if we can retry the call.
|
|
32
|
+
* false if we can't.
|
|
33
|
+
*/
|
|
34
|
+
ifServerIsDown?: (fetcher: ServerFetch<T>, data: T) => Promise<ServerDownResult<T> | undefined>;
|
|
35
|
+
headers?: Headers;
|
|
36
|
+
userDefaultHeaders?: boolean;
|
|
37
|
+
cookies?: {
|
|
38
|
+
[key: string]: string;
|
|
39
|
+
};
|
|
40
|
+
verbose?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The public URL of the website.
|
|
43
|
+
* It's the url that he must use to build the url in his content.
|
|
44
|
+
* It's not the url of the server where he can be reached.
|
|
45
|
+
*
|
|
46
|
+
* Setting a public url will allow automatically setting the X-Forwarded-Host and X-Forwarded-Proto headers.
|
|
47
|
+
*/
|
|
48
|
+
publicUrl?: string | URL;
|
|
49
|
+
/**
|
|
50
|
+
* An object which will be sent to beforeRequesting.
|
|
51
|
+
* Will also be where ifServerIsDown can store his state.
|
|
52
|
+
*/
|
|
53
|
+
data?: T;
|
|
54
|
+
/**
|
|
55
|
+
* Allow rewriting the url for complex cases.
|
|
56
|
+
*/
|
|
57
|
+
rewriteUrl?: (url: string, headers: Headers, fetcher: ServerFetch<any>) => URL;
|
|
58
|
+
/**
|
|
59
|
+
* Allow rewriting a redirection.
|
|
60
|
+
*/
|
|
61
|
+
translateRedirect?: (url: string) => URL;
|
|
62
|
+
/**
|
|
63
|
+
* The weight of this server, if using inside a load balancer.
|
|
64
|
+
*/
|
|
65
|
+
weight?: number;
|
|
66
|
+
/**
|
|
67
|
+
* If set, then will be called to start the start.
|
|
68
|
+
* The resulting value is the number of seconds to wait for inactivity.
|
|
69
|
+
*/
|
|
70
|
+
doStartServer?: (data: any) => Promise<number>;
|
|
71
|
+
/**
|
|
72
|
+
* If set, then will be called to stop the server when not need anymore.
|
|
73
|
+
*/
|
|
74
|
+
doStopServer?: (data: any) => Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
export declare class ServerFetch<T> {
|
|
77
|
+
private readonly options;
|
|
78
|
+
private lastURL;
|
|
79
|
+
/**
|
|
80
|
+
* The load-balancer will attach himself if this instance
|
|
81
|
+
* is used by a load balancer.
|
|
82
|
+
*/
|
|
83
|
+
loadBalancer?: LoadBalancer;
|
|
84
|
+
/**
|
|
85
|
+
* Create an instance that translates urls from an origin to a destination.
|
|
86
|
+
* Ex: http://127.0.0.1 --> https://www.mywebiste.com
|
|
87
|
+
* Ex: https://my-server.com --> https://134.555.666.66:7890 (with hostname: my-server.com)
|
|
88
|
+
*
|
|
89
|
+
* @param publicUrl
|
|
90
|
+
* The origin of our current website.
|
|
91
|
+
* @param targetUrl
|
|
92
|
+
* The origin of the target website.
|
|
93
|
+
* @param hostName
|
|
94
|
+
* Must be set if toOrigin use an IP and not a hostname.
|
|
95
|
+
* (will set the Host header)
|
|
96
|
+
* @param options
|
|
97
|
+
* Options for the ServerFetch instance.
|
|
98
|
+
*/
|
|
99
|
+
static fromTo<T>(publicUrl: string, targetUrl: string, hostName?: string, options?: ServerFetchOptions<T>): ServerFetch<T>;
|
|
100
|
+
static getOptionsFor_fromTo<T>(publicUrl: string, targetUrl: string, hostName?: string, options?: ServerFetchOptions<T>): ServerFetchOptions<T>;
|
|
101
|
+
static useOrigin<T>(serverOrigin: string, options?: ServerFetchOptions<T>): ServerFetch<T>;
|
|
102
|
+
static useIP<T>(serverOrigin: string, ip: string, options?: ServerFetchOptions<T>): ServerFetch<T>;
|
|
103
|
+
static getOptionsFor_useOrigin<T>(serverOrigin: string, options?: ServerFetchOptions<T>): ServerFetchOptions<T>;
|
|
104
|
+
static getOptionsFor_useIP<T>(serverOrigin: string, ip: string, options?: ServerFetchOptions<T>): ServerFetchOptions<T>;
|
|
105
|
+
static useAsIs<T>(options?: ServerFetchOptions<T>): ServerFetch<T>;
|
|
106
|
+
protected constructor(options?: ServerFetchOptions<T> | undefined);
|
|
107
|
+
checkIfServerOk(): Promise<boolean>;
|
|
108
|
+
private useDefaultHeaders;
|
|
109
|
+
private compileCookies;
|
|
110
|
+
/**
|
|
111
|
+
* Allow directly proxy a request as if we were directly asking the target server.
|
|
112
|
+
*/
|
|
113
|
+
directProxy(req: JopiRequest): Promise<Response>;
|
|
114
|
+
fetchWith(req: JopiRequest): Promise<Response>;
|
|
115
|
+
fetch(method: string, url: URL, body?: SendingBody, headers?: Headers): Promise<Response>;
|
|
116
|
+
fetch2(method: string, url: string, body?: SendingBody, headers?: Headers): Promise<Response>;
|
|
117
|
+
normalizeUrl(urlInfos: URL): string;
|
|
118
|
+
/**
|
|
119
|
+
* Allow fetching some content.
|
|
120
|
+
*/
|
|
121
|
+
private doFetch;
|
|
122
|
+
}
|