tiny-essentials 1.28.19 → 1.29.0
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 +1 -1
- package/changelog/1/28/19.md +24 -0
- package/changelog/1/29/0.md +58 -0
- package/dist/v1/ColorSafeStringify.min.js +1 -1
- package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyAnalogClock.min.js +1 -1
- package/dist/v1/TinyArrayComparator.min.js +1 -1
- package/dist/v1/TinyArrayPaginator.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyBrowserMonitor.min.js +1 -0
- package/dist/v1/TinyClassManager.min.js +1 -1
- package/dist/v1/TinyClipboard.min.js +1 -1
- package/dist/v1/TinyCloner.min.js +1 -0
- package/dist/v1/TinyColorConverter.min.js +1 -1
- package/dist/v1/TinyColorValidator.min.js +1 -1
- package/dist/v1/TinyCookieConsent.min.js +1 -1
- package/dist/v1/TinyDayNightCycle.min.js +1 -1
- package/dist/v1/TinyDebugger.min.js +1 -1
- package/dist/v1/TinyDomReadyManager.min.js +1 -1
- package/dist/v1/TinyDragDropDetector.min.js +1 -1
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyElementObserver.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyGamepad.min.js +1 -1
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyHtmlTagRegexBuilder.min.js +1 -0
- package/dist/v1/TinyHttpResponseRegistry.min.js +1 -0
- package/dist/v1/TinyI18.min.js +1 -1
- package/dist/v1/TinyIframeEvents.min.js +1 -1
- package/dist/v1/TinyInventory.min.js +1 -1
- package/dist/v1/TinyInventoryTrader.min.js +1 -1
- package/dist/v1/TinyLevelUp.min.js +1 -1
- package/dist/v1/TinyLoadingScreen.min.js +1 -1
- package/dist/v1/TinyLocalStorage.min.js +1 -1
- package/dist/v1/TinyMaInSys.min.js +1 -1
- package/dist/v1/TinyMapCache.min.js +1 -0
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyNeedBar.min.js +1 -1
- package/dist/v1/TinyNewWinEvents.min.js +1 -1
- package/dist/v1/TinyNotificationAdapter.min.js +1 -0
- package/dist/v1/TinyNotifications.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyOPFSFileSystem.min.js +1 -0
- package/dist/v1/TinyPasswordValidator.min.js +1 -0
- package/dist/v1/TinyPluginPackage.min.js +1 -0
- package/dist/v1/TinyPromiseQueue.min.js +1 -1
- package/dist/v1/TinyPushManager.min.js +1 -0
- package/dist/v1/TinyPushPayload.min.js +1 -0
- package/dist/v1/TinyPushRouter.min.js +1 -0
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinyRegexEs.min.js +1 -0
- package/dist/v1/TinyRouter.min.js +1 -0
- package/dist/v1/TinyServiceWorker.min.js +1 -0
- package/dist/v1/TinyServiceWorkerEngine.min.js +1 -0
- package/dist/v1/TinySetMapPackage.min.js +1 -0
- package/dist/v1/TinySimpleDice.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyStorageBucketFileSystem.min.js +1 -0
- package/dist/v1/TinyTextDiffer.min.js +1 -1
- package/dist/v1/TinyTextRangeEditor.min.js +1 -1
- package/dist/v1/TinyTextarea.min.js +1 -1
- package/dist/v1/TinyThrottledApi.min.js +1 -0
- package/dist/v1/TinyTimeout.min.js +1 -1
- package/dist/v1/TinyToastNotify.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/TinyUriParser.min.js +1 -0
- package/dist/v1/TinyVersion.min.js +1 -0
- package/dist/v1/TinyWebWorker.min.js +1 -0
- package/dist/v1/TinyWebWorkerEngine.min.js +1 -0
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/array.cjs +2 -2
- package/dist/v1/basics/array.d.mts +2 -0
- package/dist/v1/basics/array.d.mts.map +1 -1
- package/dist/v1/basics/array.mjs +2 -1
- package/dist/v1/basics/browserDetector.cjs +37 -12
- package/dist/v1/basics/browserDetector.d.mts +8 -0
- package/dist/v1/basics/browserDetector.d.mts.map +1 -1
- package/dist/v1/basics/browserDetector.mjs +32 -13
- package/dist/v1/basics/crypto.cjs +23 -0
- package/dist/v1/basics/crypto.d.mts +10 -0
- package/dist/v1/basics/crypto.d.mts.map +1 -0
- package/dist/v1/basics/crypto.mjs +18 -0
- package/dist/v1/basics/html.cjs +0 -3
- package/dist/v1/basics/html.d.mts.map +1 -1
- package/dist/v1/basics/html.mjs +0 -2
- package/dist/v1/basics/index.cjs +8 -1
- package/dist/v1/basics/index.d.mts +6 -5
- package/dist/v1/basics/index.d.mts.map +1 -1
- package/dist/v1/basics/index.mjs +6 -5
- package/dist/v1/basics/objChecker.cjs +88 -0
- package/dist/v1/basics/objChecker.d.mts +26 -0
- package/dist/v1/basics/objChecker.d.mts.map +1 -1
- package/dist/v1/basics/objChecker.mjs +74 -0
- package/dist/v1/basics/objFilter.cjs +234 -93
- package/dist/v1/basics/objFilter.d.mts +96 -22
- package/dist/v1/basics/objFilter.d.mts.map +1 -1
- package/dist/v1/basics/objFilter.mjs +216 -92
- package/dist/v1/basics/promiseUtils.cjs +48 -12
- package/dist/v1/basics/promiseUtils.d.mts +45 -12
- package/dist/v1/basics/promiseUtils.d.mts.map +1 -1
- package/dist/v1/basics/promiseUtils.mjs +47 -12
- package/dist/v1/basics/text.cjs +0 -12
- package/dist/v1/basics/text.d.mts +0 -10
- package/dist/v1/basics/text.d.mts.map +1 -1
- package/dist/v1/basics/text.mjs +0 -10
- package/dist/v1/index.cjs +88 -3
- package/dist/v1/index.d.mts +31 -6
- package/dist/v1/index.d.mts.map +1 -1
- package/dist/v1/index.mjs +32 -7
- package/dist/v1/jsdoc/EventEmitter.cjs +4 -0
- package/dist/v1/jsdoc/EventEmitter.d.mts +33 -0
- package/dist/v1/jsdoc/EventEmitter.d.mts.map +1 -0
- package/dist/v1/jsdoc/EventEmitter.mjs +18 -0
- package/dist/v1/libs/array/TinyArrayComparator.cjs +240 -25
- package/dist/v1/libs/array/TinyArrayComparator.d.mts +130 -22
- package/dist/v1/libs/array/TinyArrayComparator.d.mts.map +1 -1
- package/dist/v1/libs/array/TinyArrayComparator.mjs +210 -24
- package/dist/v1/libs/fs/constants.cjs +74 -0
- package/dist/v1/libs/fs/constants.d.mts +22 -0
- package/dist/v1/libs/fs/constants.d.mts.map +1 -0
- package/dist/v1/libs/fs/constants.mjs +53 -0
- package/dist/v1/libs/fs/encoding.cjs +118 -0
- package/dist/v1/libs/fs/encoding.d.mts +50 -0
- package/dist/v1/libs/fs/encoding.d.mts.map +1 -0
- package/dist/v1/libs/fs/encoding.mjs +102 -0
- package/dist/v1/libs/fs/error.cjs +188 -0
- package/dist/v1/libs/fs/error.d.mts +105 -0
- package/dist/v1/libs/fs/error.d.mts.map +1 -0
- package/dist/v1/libs/fs/error.mjs +158 -0
- package/dist/v1/libs/fs/handle.cjs +121 -0
- package/dist/v1/libs/fs/handle.d.mts +56 -0
- package/dist/v1/libs/fs/handle.d.mts.map +1 -0
- package/dist/v1/libs/fs/handle.mjs +100 -0
- package/dist/v1/libs/fs/index.cjs +700 -0
- package/dist/v1/libs/fs/index.d.mts +377 -0
- package/dist/v1/libs/fs/index.d.mts.map +1 -0
- package/dist/v1/libs/fs/index.mjs +630 -0
- package/dist/v1/libs/fs/path.cjs +234 -0
- package/dist/v1/libs/fs/path.d.mts +176 -0
- package/dist/v1/libs/fs/path.d.mts.map +1 -0
- package/dist/v1/libs/fs/path.mjs +197 -0
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.cjs +202 -0
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts +121 -0
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts.map +1 -0
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.mjs +172 -0
- package/dist/v1/libs/fs/plugins/OPFS/index.cjs +334 -0
- package/dist/v1/libs/fs/plugins/OPFS/index.d.mts +98 -0
- package/dist/v1/libs/fs/plugins/OPFS/index.d.mts.map +1 -0
- package/dist/v1/libs/fs/plugins/OPFS/index.mjs +300 -0
- package/dist/v1/libs/fs/stats.cjs +245 -0
- package/dist/v1/libs/fs/stats.d.mts +226 -0
- package/dist/v1/libs/fs/stats.d.mts.map +1 -0
- package/dist/v1/libs/fs/stats.mjs +197 -0
- package/dist/v1/libs/html/events/TinyIframeEvents.cjs +10 -1
- package/dist/v1/libs/html/events/TinyIframeEvents.d.mts +9 -2
- package/dist/v1/libs/html/events/TinyIframeEvents.d.mts.map +1 -1
- package/dist/v1/libs/html/events/TinyIframeEvents.mjs +8 -1
- package/dist/v1/libs/html/events/TinyNewWinEvents.cjs +14 -3
- package/dist/v1/libs/html/events/TinyNewWinEvents.d.mts +21 -5
- package/dist/v1/libs/html/events/TinyNewWinEvents.d.mts.map +1 -1
- package/dist/v1/libs/html/events/TinyNewWinEvents.mjs +12 -3
- package/dist/v1/libs/html/scroll/TinySmartScroller.cjs +13 -1
- package/dist/v1/libs/html/scroll/TinySmartScroller.d.mts +29 -2
- package/dist/v1/libs/html/scroll/TinySmartScroller.d.mts.map +1 -1
- package/dist/v1/libs/html/scroll/TinySmartScroller.mjs +11 -1
- package/dist/v1/libs/math/TinyAdvancedRaffle.cjs +13 -1
- package/dist/v1/libs/math/TinyAdvancedRaffle.d.mts +32 -2
- package/dist/v1/libs/math/TinyAdvancedRaffle.d.mts.map +1 -1
- package/dist/v1/libs/math/TinyAdvancedRaffle.mjs +11 -1
- package/dist/v1/libs/math/TinyTimeout.cjs +0 -14
- package/dist/v1/libs/math/TinyTimeout.d.mts +0 -11
- package/dist/v1/libs/math/TinyTimeout.d.mts.map +1 -1
- package/dist/v1/libs/math/TinyTimeout.mjs +0 -13
- package/dist/v1/libs/media/TinyMediaPlayer/index.cjs +25 -1
- package/dist/v1/libs/media/TinyMediaPlayer/index.d.mts +35 -2
- package/dist/v1/libs/media/TinyMediaPlayer/index.d.mts.map +1 -1
- package/dist/v1/libs/media/TinyMediaPlayer/index.mjs +23 -1
- package/dist/v1/libs/media/TinyMediaPlayer.cjs +2 -2
- package/dist/v1/libs/media/TinyMediaPlayer.d.mts +2 -2
- package/dist/v1/libs/media/TinyMediaPlayer.d.mts.map +1 -1
- package/dist/v1/libs/media/TinyMediaPlayer.mjs +2 -2
- package/dist/v1/libs/media/TinyRadioFm.cjs +19 -1
- package/dist/v1/libs/media/TinyRadioFm.d.mts +78 -2
- package/dist/v1/libs/media/TinyRadioFm.d.mts.map +1 -1
- package/dist/v1/libs/media/TinyRadioFm.mjs +17 -1
- package/dist/v1/libs/plugin/TinyPlugin.cjs +1630 -0
- package/dist/v1/libs/plugin/TinyPlugin.d.mts +753 -0
- package/dist/v1/libs/plugin/TinyPlugin.d.mts.map +1 -0
- package/dist/v1/libs/plugin/TinyPlugin.mjs +1376 -0
- package/dist/v1/libs/plugin/TinyVersion.cjs +204 -0
- package/dist/v1/libs/plugin/TinyVersion.d.mts +70 -0
- package/dist/v1/libs/plugin/TinyVersion.d.mts.map +1 -0
- package/dist/v1/libs/plugin/TinyVersion.mjs +179 -0
- package/dist/v1/libs/router/TinyRouter.cjs +661 -0
- package/dist/v1/libs/router/TinyRouter.d.mts +320 -0
- package/dist/v1/libs/router/TinyRouter.d.mts.map +1 -0
- package/dist/v1/libs/router/TinyRouter.mjs +572 -0
- package/dist/v1/libs/storage/TinyLocalStorage.cjs +20 -1
- package/dist/v1/libs/storage/TinyLocalStorage.d.mts +64 -2
- package/dist/v1/libs/storage/TinyLocalStorage.d.mts.map +1 -1
- package/dist/v1/libs/storage/TinyLocalStorage.mjs +18 -1
- package/dist/v1/libs/storage/TinyMapCache.cjs +373 -0
- package/dist/v1/libs/storage/TinyMapCache.d.mts +274 -0
- package/dist/v1/libs/storage/TinyMapCache.d.mts.map +1 -0
- package/dist/v1/libs/storage/TinyMapCache.mjs +333 -0
- package/dist/v1/libs/storage/TinySetMapDatabase.cjs +1167 -0
- package/dist/v1/libs/storage/TinySetMapDatabase.d.mts +603 -0
- package/dist/v1/libs/storage/TinySetMapDatabase.d.mts.map +1 -0
- package/dist/v1/libs/storage/TinySetMapDatabase.mjs +1059 -0
- package/dist/v1/libs/sw/browser/TinyNotificationAdapter.cjs +126 -0
- package/dist/v1/libs/sw/browser/TinyNotificationAdapter.d.mts +132 -0
- package/dist/v1/libs/sw/browser/TinyNotificationAdapter.d.mts.map +1 -0
- package/dist/v1/libs/sw/browser/TinyNotificationAdapter.mjs +109 -0
- package/dist/v1/libs/sw/browser/TinyPushManager.cjs +310 -0
- package/dist/v1/libs/sw/browser/TinyPushManager.d.mts +168 -0
- package/dist/v1/libs/sw/browser/TinyPushManager.d.mts.map +1 -0
- package/dist/v1/libs/sw/browser/TinyPushManager.mjs +264 -0
- package/dist/v1/libs/sw/browser/TinyServiceWorker.cjs +1060 -0
- package/dist/v1/libs/sw/browser/TinyServiceWorker.d.mts +348 -0
- package/dist/v1/libs/sw/browser/TinyServiceWorker.d.mts.map +1 -0
- package/dist/v1/libs/sw/browser/TinyServiceWorker.mjs +933 -0
- package/dist/v1/libs/sw/browser/plugins/TabManager.cjs +315 -0
- package/dist/v1/libs/sw/browser/plugins/TabManager.d.mts +178 -0
- package/dist/v1/libs/sw/browser/plugins/TabManager.d.mts.map +1 -0
- package/dist/v1/libs/sw/browser/plugins/TabManager.mjs +274 -0
- package/dist/v1/libs/sw/browser/utils.cjs +28 -0
- package/dist/v1/libs/sw/browser/utils.d.mts +8 -0
- package/dist/v1/libs/sw/browser/utils.d.mts.map +1 -0
- package/dist/v1/libs/sw/browser/utils.mjs +21 -0
- package/dist/v1/libs/sw/service/TinyPushRouter.cjs +222 -0
- package/dist/v1/libs/sw/service/TinyPushRouter.d.mts +138 -0
- package/dist/v1/libs/sw/service/TinyPushRouter.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/TinyPushRouter.mjs +201 -0
- package/dist/v1/libs/sw/service/TinyServiceWorkerEngine.cjs +3016 -0
- package/dist/v1/libs/sw/service/TinyServiceWorkerEngine.d.mts +993 -0
- package/dist/v1/libs/sw/service/TinyServiceWorkerEngine.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/TinyServiceWorkerEngine.mjs +2558 -0
- package/dist/v1/libs/sw/service/plugins/GlobBypassPlugin.cjs +88 -0
- package/dist/v1/libs/sw/service/plugins/GlobBypassPlugin.d.mts +32 -0
- package/dist/v1/libs/sw/service/plugins/GlobBypassPlugin.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/plugins/GlobBypassPlugin.mjs +69 -0
- package/dist/v1/libs/sw/service/plugins/GlobCachePlugin.cjs +112 -0
- package/dist/v1/libs/sw/service/plugins/GlobCachePlugin.d.mts +31 -0
- package/dist/v1/libs/sw/service/plugins/GlobCachePlugin.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/plugins/GlobCachePlugin.mjs +91 -0
- package/dist/v1/libs/sw/service/plugins/Ping.cjs +32 -0
- package/dist/v1/libs/sw/service/plugins/Ping.d.mts +9 -0
- package/dist/v1/libs/sw/service/plugins/Ping.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/plugins/Ping.mjs +25 -0
- package/dist/v1/libs/sw/service/plugins/TabManager.cjs +457 -0
- package/dist/v1/libs/sw/service/plugins/TabManager.d.mts +91 -0
- package/dist/v1/libs/sw/service/plugins/TabManager.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/plugins/TabManager.mjs +372 -0
- package/dist/v1/libs/sw/service/plugins/ViteFileDetector.cjs +180 -0
- package/dist/v1/libs/sw/service/plugins/ViteFileDetector.d.mts +28 -0
- package/dist/v1/libs/sw/service/plugins/ViteFileDetector.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/plugins/ViteFileDetector.mjs +148 -0
- package/dist/v1/libs/sw/service/shared/TinyPushPayload.cjs +199 -0
- package/dist/v1/libs/sw/service/shared/TinyPushPayload.d.mts +80 -0
- package/dist/v1/libs/sw/service/shared/TinyPushPayload.d.mts.map +1 -0
- package/dist/v1/libs/sw/service/shared/TinyPushPayload.mjs +174 -0
- package/dist/v1/libs/sw/utils.cjs +57 -0
- package/dist/v1/libs/sw/utils.d.mts +173 -0
- package/dist/v1/libs/sw/utils.d.mts.map +1 -0
- package/dist/v1/libs/sw/utils.mjs +50 -0
- package/dist/v1/libs/text/TinyI18/Browser-NON-DOM.cjs +57 -0
- package/dist/v1/libs/text/TinyI18/Browser-NON-DOM.d.mts +39 -0
- package/dist/v1/libs/text/TinyI18/Browser-NON-DOM.d.mts.map +1 -0
- package/dist/v1/libs/text/TinyI18/Browser-NON-DOM.mjs +48 -0
- package/dist/v1/libs/text/TinyI18/Browser.cjs +64 -0
- package/dist/v1/libs/text/TinyI18/Browser.d.mts +47 -0
- package/dist/v1/libs/text/TinyI18/Browser.d.mts.map +1 -0
- package/dist/v1/libs/text/TinyI18/Browser.mjs +57 -0
- package/dist/v1/libs/text/TinyI18/Node.cjs +49 -0
- package/dist/v1/libs/text/TinyI18/Node.d.mts +38 -0
- package/dist/v1/libs/text/TinyI18/Node.d.mts.map +1 -0
- package/dist/v1/libs/text/TinyI18/Node.mjs +43 -0
- package/dist/v1/libs/text/TinyI18/browser-utils.cjs +17 -0
- package/dist/v1/libs/text/TinyI18/browser-utils.d.mts +8 -0
- package/dist/v1/libs/text/TinyI18/browser-utils.d.mts.map +1 -0
- package/dist/v1/libs/text/TinyI18/browser-utils.mjs +13 -0
- package/dist/v1/libs/text/{TinyI18.cjs → TinyI18/index.cjs} +205 -104
- package/dist/v1/libs/text/{TinyI18.d.mts → TinyI18/index.d.mts} +141 -92
- package/dist/v1/libs/text/TinyI18/index.d.mts.map +1 -0
- package/dist/v1/libs/text/{TinyI18.mjs → TinyI18/index.mjs} +195 -101
- package/dist/v1/libs/tools/TinyBrowserMonitor.cjs +1088 -0
- package/dist/v1/libs/tools/TinyBrowserMonitor.d.mts +621 -0
- package/dist/v1/libs/tools/TinyBrowserMonitor.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyBrowserMonitor.mjs +940 -0
- package/dist/v1/libs/tools/TinyDebugger.cjs +180 -19
- package/dist/v1/libs/tools/TinyDebugger.d.mts +220 -24
- package/dist/v1/libs/tools/TinyDebugger.d.mts.map +1 -1
- package/dist/v1/libs/tools/TinyDebugger.mjs +161 -19
- package/dist/v1/libs/tools/TinyHtmlTagRegexBuilder.cjs +256 -0
- package/dist/v1/libs/tools/TinyHtmlTagRegexBuilder.d.mts +125 -0
- package/dist/v1/libs/tools/TinyHtmlTagRegexBuilder.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHtmlTagRegexBuilder.mjs +223 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser-NON-DOM.cjs +23 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser-NON-DOM.d.mts +17 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser-NON-DOM.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser-NON-DOM.mjs +19 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser.cjs +23 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser.d.mts +17 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Browser.mjs +19 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/EmptyRequestCodes.cjs +390 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/EmptyRequestCodes.d.mts +9 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/EmptyRequestCodes.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/EmptyRequestCodes.mjs +387 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/JsDoc.cjs +2 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/JsDoc.d.mts +27 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/JsDoc.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/JsDoc.mjs +12 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/MozillaRequestCodes/LICENSE +53 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/MozillaRequestCodes/index.cjs +405 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/MozillaRequestCodes/index.d.mts +34 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/MozillaRequestCodes/index.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/MozillaRequestCodes/index.mjs +342 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Node.cjs +23 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Node.d.mts +17 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Node.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/Node.mjs +19 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/RequestCodes.cjs +327 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/RequestCodes.d.mts +9 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/RequestCodes.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/RequestCodes.mjs +324 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/index.cjs +268 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/index.d.mts +107 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/index.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyHttpResponseRegistry/index.mjs +238 -0
- package/dist/v1/libs/tools/TinyPasswordValidator.cjs +491 -0
- package/dist/v1/libs/tools/TinyPasswordValidator.d.mts +246 -0
- package/dist/v1/libs/tools/TinyPasswordValidator.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyPasswordValidator.mjs +434 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.cjs +48 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts +14 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts.map +1 -1
- package/dist/v1/libs/tools/TinyPkgExportValidator.mjs +44 -0
- package/dist/v1/libs/tools/TinySiteMap.cjs +1029 -0
- package/dist/v1/libs/tools/TinySiteMap.d.mts +429 -0
- package/dist/v1/libs/tools/TinySiteMap.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinySiteMap.mjs +910 -0
- package/dist/v1/libs/tools/TinySiteMapStream.cjs +121 -0
- package/dist/v1/libs/tools/TinySiteMapStream.d.mts +51 -0
- package/dist/v1/libs/tools/TinySiteMapStream.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinySiteMapStream.mjs +85 -0
- package/dist/v1/libs/tools/TinyURLSecurityVerifier.cjs +444 -0
- package/dist/v1/libs/tools/TinyURLSecurityVerifier.d.mts +217 -0
- package/dist/v1/libs/tools/TinyURLSecurityVerifier.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyURLSecurityVerifier.mjs +394 -0
- package/dist/v1/libs/tools/TinyUriParser/BlueSky.cjs +613 -0
- package/dist/v1/libs/tools/TinyUriParser/BlueSky.d.mts +152 -0
- package/dist/v1/libs/tools/TinyUriParser/BlueSky.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyUriParser/BlueSky.mjs +527 -0
- package/dist/v1/libs/tools/TinyUriParser/Discord.cjs +1119 -0
- package/dist/v1/libs/tools/TinyUriParser/Discord.d.mts +306 -0
- package/dist/v1/libs/tools/TinyUriParser/Discord.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyUriParser/Discord.mjs +968 -0
- package/dist/v1/libs/tools/TinyUriParser/MatrixProtocol.cjs +469 -0
- package/dist/v1/libs/tools/TinyUriParser/MatrixProtocol.d.mts +80 -0
- package/dist/v1/libs/tools/TinyUriParser/MatrixProtocol.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyUriParser/MatrixProtocol.mjs +379 -0
- package/dist/v1/libs/tools/TinyUriParser.cjs +217 -0
- package/dist/v1/libs/tools/TinyUriParser.d.mts +109 -0
- package/dist/v1/libs/tools/TinyUriParser.d.mts.map +1 -0
- package/dist/v1/libs/tools/TinyUriParser.mjs +183 -0
- package/dist/v1/libs/utils/TinyCloner.cjs +466 -0
- package/dist/v1/libs/utils/TinyCloner.d.mts +221 -0
- package/dist/v1/libs/utils/TinyCloner.d.mts.map +1 -0
- package/dist/v1/libs/utils/TinyCloner.mjs +416 -0
- package/dist/v1/libs/utils/TinyPromiseQueue.cjs +1 -1
- package/dist/v1/libs/utils/TinyPromiseQueue.d.mts +2 -2
- package/dist/v1/libs/utils/TinyPromiseQueue.d.mts.map +1 -1
- package/dist/v1/libs/utils/TinyPromiseQueue.mjs +1 -1
- package/dist/v1/libs/utils/TinyThrottledApi.cjs +333 -0
- package/dist/v1/libs/utils/TinyThrottledApi.d.mts +163 -0
- package/dist/v1/libs/utils/TinyThrottledApi.d.mts.map +1 -0
- package/dist/v1/libs/utils/TinyThrottledApi.mjs +294 -0
- package/dist/v1/libs/worker/browser/TinyWebWorker.cjs +342 -0
- package/dist/v1/libs/worker/browser/TinyWebWorker.d.mts +97 -0
- package/dist/v1/libs/worker/browser/TinyWebWorker.d.mts.map +1 -0
- package/dist/v1/libs/worker/browser/TinyWebWorker.mjs +305 -0
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.cjs +346 -0
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts +127 -0
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts.map +1 -0
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.mjs +304 -0
- package/dist/v1/regexp/Email.cjs +185 -0
- package/dist/v1/regexp/Email.d.mts +73 -0
- package/dist/v1/regexp/Email.d.mts.map +1 -0
- package/dist/v1/regexp/Email.mjs +153 -0
- package/dist/v1/regexp/Glob.cjs +293 -0
- package/dist/v1/regexp/Glob.d.mts +45 -0
- package/dist/v1/regexp/Glob.d.mts.map +1 -0
- package/dist/v1/regexp/Glob.mjs +260 -0
- package/dist/v1/regexp/Ipv4.cjs +57 -0
- package/dist/v1/regexp/Ipv4.d.mts +29 -0
- package/dist/v1/regexp/Ipv4.d.mts.map +1 -0
- package/dist/v1/regexp/Ipv4.mjs +45 -0
- package/dist/v1/regexp/Ipv6.cjs +67 -0
- package/dist/v1/regexp/Ipv6.d.mts +29 -0
- package/dist/v1/regexp/Ipv6.d.mts.map +1 -0
- package/dist/v1/regexp/Ipv6.mjs +54 -0
- package/dist/v1/regexp/SegmentExtractor.cjs +145 -0
- package/dist/v1/regexp/SegmentExtractor.d.mts +91 -0
- package/dist/v1/regexp/SegmentExtractor.d.mts.map +1 -0
- package/dist/v1/regexp/SegmentExtractor.mjs +116 -0
- package/dist/v1/regexp/UrlDetector.cjs +125 -0
- package/dist/v1/regexp/UrlDetector.d.mts +67 -0
- package/dist/v1/regexp/UrlDetector.d.mts.map +1 -0
- package/dist/v1/regexp/UrlDetector.mjs +102 -0
- package/dist/v1/regexp/Username/index.cjs +233 -0
- package/dist/v1/regexp/Username/index.d.mts +77 -0
- package/dist/v1/regexp/Username/index.d.mts.map +1 -0
- package/dist/v1/regexp/Username/index.mjs +199 -0
- package/dist/v1/regexp/Username/jsDoc.cjs +2 -0
- package/dist/v1/regexp/Username/jsDoc.d.mts +57 -0
- package/dist/v1/regexp/Username/jsDoc.d.mts.map +1 -0
- package/dist/v1/regexp/Username/jsDoc.mjs +18 -0
- package/dist/v1/regexp/Username/templates/BlueSky.cjs +56 -0
- package/dist/v1/regexp/Username/templates/BlueSky.d.mts +35 -0
- package/dist/v1/regexp/Username/templates/BlueSky.d.mts.map +1 -0
- package/dist/v1/regexp/Username/templates/BlueSky.mjs +52 -0
- package/dist/v1/regexp/Username/templates/Discord.cjs +505 -0
- package/dist/v1/regexp/Username/templates/Discord.d.mts +209 -0
- package/dist/v1/regexp/Username/templates/Discord.d.mts.map +1 -0
- package/dist/v1/regexp/Username/templates/Discord.mjs +458 -0
- package/dist/v1/regexp/Username/templates/MatrixProtocol.cjs +143 -0
- package/dist/v1/regexp/Username/templates/MatrixProtocol.d.mts +70 -0
- package/dist/v1/regexp/Username/templates/MatrixProtocol.d.mts.map +1 -0
- package/dist/v1/regexp/Username/templates/MatrixProtocol.mjs +128 -0
- package/dist/v1/regexp/Username/templates/deprecated/Discord.cjs +24 -0
- package/dist/v1/regexp/Username/templates/deprecated/Discord.d.mts +17 -0
- package/dist/v1/regexp/Username/templates/deprecated/Discord.d.mts.map +1 -0
- package/dist/v1/regexp/Username/templates/deprecated/Discord.mjs +20 -0
- package/dist/v1/regexp/Username/templates/index.cjs +11 -0
- package/dist/v1/regexp/Username/templates/index.d.mts +5 -0
- package/dist/v1/regexp/Username/templates/index.d.mts.map +1 -0
- package/dist/v1/regexp/Username/templates/index.mjs +4 -0
- package/dist/v1/regexp/index.cjs +41 -0
- package/dist/v1/regexp/index.d.mts +9 -0
- package/dist/v1/regexp/index.d.mts.map +1 -0
- package/dist/v1/regexp/index.mjs +8 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Browser.cjs +64 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Browser.d.mts +11 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Browser.d.mts.map +1 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Browser.mjs +51 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/FileInput.cjs +66 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/FileInput.d.mts +11 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/FileInput.d.mts.map +1 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/FileInput.mjs +51 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Node.cjs +39 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Node.d.mts +11 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Node.d.mts.map +1 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Node.mjs +28 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Template.cjs +494 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Template.d.mts +142 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Template.d.mts.map +1 -0
- package/dist/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters/Template.mjs +445 -0
- package/dist/v1/webTemplates/bootstrap/5.3/html/BootstrapDialogs.cjs +30 -4
- package/dist/v1/webTemplates/bootstrap/5.3/html/BootstrapDialogs.d.mts +5 -2
- package/dist/v1/webTemplates/bootstrap/5.3/html/BootstrapDialogs.d.mts.map +1 -1
- package/dist/v1/webTemplates/bootstrap/5.3/html/BootstrapDialogs.mjs +29 -5
- package/dist/v1/webTemplates/media/MediaValidator/v1/Browser/index.cjs +135 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Browser/index.d.mts +83 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Browser/index.d.mts.map +1 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Browser/index.mjs +120 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Node/index.cjs +127 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Node/index.d.mts +95 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Node/index.d.mts.map +1 -0
- package/dist/v1/webTemplates/media/MediaValidator/v1/Node/index.mjs +109 -0
- package/dist/v1/webTemplates/multiformats/14.0/IPFSHasher/index.cjs +83 -0
- package/dist/v1/webTemplates/multiformats/14.0/IPFSHasher/index.d.mts +46 -0
- package/dist/v1/webTemplates/multiformats/14.0/IPFSHasher/index.d.mts.map +1 -0
- package/dist/v1/webTemplates/multiformats/14.0/IPFSHasher/index.mjs +71 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/TinyVitePwaPlugin.cjs +493 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/TinyVitePwaPlugin.d.mts +67 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/TinyVitePwaPlugin.d.mts.map +1 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/TinyVitePwaPlugin.mjs +399 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/githubUtils.cjs +35 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/githubUtils.d.mts +6 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/githubUtils.d.mts.map +1 -0
- package/dist/v1/webTemplates/vite/7.3/plugins/githubUtils.mjs +29 -0
- package/docs/info/RegExp.md +74 -0
- package/docs/v1/Exports.md +101 -0
- package/docs/v1/README.md +113 -15
- package/docs/v1/basics/asyncReplace.md +2 -0
- package/docs/v1/basics/browserDetector.md +28 -11
- package/docs/v1/basics/crypto.md +85 -0
- package/docs/v1/basics/deprecated/html.md +2 -0
- package/docs/v1/basics/deprecated/objFilter.md +2 -0
- package/docs/v1/basics/html.md +2 -0
- package/docs/v1/basics/objChecker.md +55 -0
- package/docs/v1/basics/objFilter.md +57 -86
- package/docs/v1/basics/promiseUtils.md +12 -3
- package/docs/v1/basics/text.md +0 -1
- package/docs/v1/libs/array/TinyArrayComparator.md +50 -39
- package/docs/v1/libs/fs/TinyFS.md +752 -0
- package/docs/v1/libs/fs/TinyOPFSFileSystem.md +495 -0
- package/docs/v1/libs/fs/TinyStorageBucketFileSystem.md +407 -0
- package/docs/v1/libs/plugin/TinyPlugin.md +441 -0
- package/docs/v1/libs/plugin/TinyVersion.md +145 -0
- package/docs/v1/libs/router/TinyRouter.md +216 -0
- package/docs/v1/libs/storage/TinyMapCache.md +219 -0
- package/docs/v1/libs/storage/TinySetMapDatabase.md +478 -0
- package/docs/v1/libs/sw/browser/TinyNotificationAdapter.md +280 -0
- package/docs/v1/libs/sw/browser/TinyPushManager.md +782 -0
- package/docs/v1/libs/sw/browser/TinyServiceWorker.md +365 -0
- package/docs/v1/libs/sw/browser/plugins/TabManager.md +133 -0
- package/docs/v1/libs/sw/service/TinyPushRouter.md +314 -0
- package/docs/v1/libs/sw/service/TinyServiceWorkerEngine.md +748 -0
- package/docs/v1/libs/sw/service/plugins/GlobBypassPlugin.md +229 -0
- package/docs/v1/libs/sw/service/plugins/GlobCachePlugin.md +91 -0
- package/docs/v1/libs/sw/service/plugins/Ping.md +36 -0
- package/docs/v1/libs/sw/service/plugins/TabManager.md +64 -0
- package/docs/v1/libs/sw/service/plugins/ViteFileDetector.md +92 -0
- package/docs/v1/libs/sw/service/shared/TinyPushPayload.md +316 -0
- package/docs/v1/libs/text/TinyI18.md +80 -56
- package/docs/v1/libs/tools/TinyBrowserMonitor.md +170 -0
- package/docs/v1/libs/tools/TinyDebugger.md +117 -1
- package/docs/v1/libs/tools/TinyHtmlTagRegexBuilder.md +141 -0
- package/docs/v1/libs/tools/TinyHttpResponseRegistry.md +129 -0
- package/docs/v1/libs/tools/TinyPasswordValidator.md +153 -0
- package/docs/v1/libs/tools/TinyPkgExportValidator.md +45 -1
- package/docs/v1/libs/tools/TinySiteMap.md +134 -0
- package/docs/v1/libs/tools/TinySiteMapStream.md +97 -0
- package/docs/v1/libs/tools/TinyURLSecurityVerifier.md +146 -0
- package/docs/v1/libs/tools/TinyUriParser/Discord.md +374 -0
- package/docs/v1/libs/tools/TinyUriParser/MatrixProtocol.md +54 -0
- package/docs/v1/libs/tools/TinyUriParser.md +128 -0
- package/docs/v1/libs/utils/TinyCloner.md +126 -0
- package/docs/v1/libs/utils/TinyPromiseQueue.md +1 -1
- package/docs/v1/libs/utils/TinyThrottledApi.md +219 -0
- package/docs/v1/libs/worker/browser/TinyWebWorker.md +331 -0
- package/docs/v1/libs/worker/engine/TinyWebWorkerEngine.md +137 -0
- package/docs/v1/regexp/Email.md +127 -0
- package/docs/v1/regexp/Glob.md +155 -0
- package/docs/v1/regexp/IPv4.md +103 -0
- package/docs/v1/regexp/IPv6.md +122 -0
- package/docs/v1/regexp/SegmentExtractor.md +120 -0
- package/docs/v1/regexp/UrlDetector.md +117 -0
- package/docs/v1/regexp/Username/Base.md +131 -0
- package/docs/v1/regexp/Username/Discord.md +267 -0
- package/docs/v1/regexp/Username/MatrixProtocol.md +131 -0
- package/docs/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters.md +569 -0
- package/docs/v1/webTemplates/bootstrap/5.3/html/BootstrapDialogs.md +19 -7
- package/docs/v1/webTemplates/media/MediaValidator/v1/Browser.md +123 -0
- package/docs/v1/webTemplates/media/MediaValidator/v1/Node.md +136 -0
- package/docs/v1/webTemplates/multiformats/14.0/IPFSHasher.md +310 -0
- package/docs/v1/webTemplates/vite/7.3/plugins/TinyVitePwaPlugin.md +131 -0
- package/docs/v1/webTemplates/vite/7.3/plugins/githubUtils.md +50 -0
- package/package.json +303 -13
- package/types/EventEmitter.d.ts +48 -0
- package/dist/v1/libs/text/TinyI18.d.mts.map +0 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# 🛡️ TinyPasswordValidator
|
|
2
|
+
|
|
3
|
+
A lightweight, robust, and highly customizable JavaScript utility for validating password strength and security requirements. This library is designed for developers who need precise control over password policies and detailed feedback for end-users.
|
|
4
|
+
|
|
5
|
+
## 🌟 Features
|
|
6
|
+
|
|
7
|
+
* **📏 Rule-Based Validation:** Check for length, casing, numbers, and special characters.
|
|
8
|
+
* **📊 Strength Assessment:** Automatically classifies passwords as `strong`, `medium`, or `weak`.
|
|
9
|
+
* **🛠️ Custom Validator Engine:** Add your own logic (e.g., checking against "forbidden words") using the manager pattern.
|
|
10
|
+
* **⚠️ Strict Error Reporting:** Provides specific error messages and unique error codes for every failed rule.
|
|
11
|
+
* **🔒 Security Oriented:** Built-in support for asynchronous hashing functions.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 🚀 Getting Started
|
|
16
|
+
|
|
17
|
+
### 1. Installation
|
|
18
|
+
Since this is a module, ensure your project supports ES6 modules. Import the class into your file:
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
import TinyPasswordValidator from 'tiny-essentials/libs/tools/TinyPasswordValidator';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 2. Basic Usage (Default Rules)
|
|
25
|
+
By default, the validator requires: 8-128 characters, at least one lowercase, one uppercase, one number, and one special character (`@$!%*?&`).
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
const validator = new TinyPasswordValidator();
|
|
29
|
+
|
|
30
|
+
const result = validator.validate('Password123!');
|
|
31
|
+
|
|
32
|
+
console.log(result.isValid); // true
|
|
33
|
+
console.log(result.strength); // 'strong'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## ⚙️ Configuration & Customization
|
|
39
|
+
|
|
40
|
+
### 🛠️ Customizing Rules
|
|
41
|
+
You can define specific rules during instantiation or update them later using `setRules()`.
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
// Example: A much stricter configuration
|
|
45
|
+
const strictValidator = new TinyPasswordValidator({
|
|
46
|
+
minLength: 12,
|
|
47
|
+
maxLength: 20,
|
|
48
|
+
requireSpecial: true,
|
|
49
|
+
requireNumbers: true
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Updating rules dynamically
|
|
53
|
+
strictValidator.setRules({
|
|
54
|
+
minLength: 16,
|
|
55
|
+
requireUppercase: true
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 🧩 Adding Custom Validators
|
|
60
|
+
The `TinyPasswordValidator` allows you to extend its logic. This is useful for complex checks like "Password cannot contain the user's name."
|
|
61
|
+
|
|
62
|
+
**Step-by-step implementation:**
|
|
63
|
+
|
|
64
|
+
1. **Define a validator object** following the `CustomValidator` structure.
|
|
65
|
+
2. **Use the `.add()` method** to register it.
|
|
66
|
+
3. **Use the `.execute()` method** to run all registered validators.
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
const validator = new TinyPasswordValidator();
|
|
70
|
+
|
|
71
|
+
// 1. Define custom validator
|
|
72
|
+
const noCommonWordsValidator = {
|
|
73
|
+
id: 'no-common-words',
|
|
74
|
+
name: 'No Common Words',
|
|
75
|
+
validate: (password) => {
|
|
76
|
+
const forbidden = ['password', '123456', 'qwerty'];
|
|
77
|
+
const isForbidden = forbidden.some(word => password.toLowerCase().includes(word));
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
isValid: !isForbidden,
|
|
81
|
+
strength: isForbidden ? 'weak' : 'strong',
|
|
82
|
+
errors: isForbidden ? ['Password contains a common forbidden word.'] : [],
|
|
83
|
+
errorCodes: isForbidden ? [7] : [],
|
|
84
|
+
score: isForbidden ? 0 : 1,
|
|
85
|
+
totalPossiblePoints: 1
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// 2. Register the validator
|
|
91
|
+
validator.add(noCommonWordsValidator);
|
|
92
|
+
|
|
93
|
+
// 3. Execute all validators
|
|
94
|
+
const result = validator.execute('Password123!');
|
|
95
|
+
console.log(result.allPassed); // true (if 'Password123!' passes the custom check)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🔍 Understanding the Output
|
|
101
|
+
|
|
102
|
+
The `.validate()` method returns a `ValidationResult` object. Here is how to use it in your UI:
|
|
103
|
+
|
|
104
|
+
| Property | Type | Description |
|
|
105
|
+
| :--- | :--- | :--- |
|
|
106
|
+
| `isValid` | `boolean` | `true` if all rules are met, `false` otherwise. |
|
|
107
|
+
| `strength` | `string` | `'strong'`, `'medium'`, or `'weak'`. |
|
|
108
|
+
| `errors` | `string[]` | Array of human-readable error messages. |
|
|
109
|
+
| `errorCodes` | `number[]` | Array of numeric IDs for the failed rules. |
|
|
110
|
+
| `score` | `number` | How many requirements were successfully met. |
|
|
111
|
+
|
|
112
|
+
### 🔢 Error Code Reference
|
|
113
|
+
| Code | Meaning |
|
|
114
|
+
| :--- | :--- |
|
|
115
|
+
| `1` | Password is too short. |
|
|
116
|
+
| `2` | Password is too long. |
|
|
117
|
+
| `3` | Missing lowercase letter. |
|
|
118
|
+
| `4` | Missing uppercase letter. |
|
|
119
|
+
| `5` | Missing number. |
|
|
120
|
+
| `6` | Missing special character. |
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 🔐 Security & Hashing
|
|
125
|
+
|
|
126
|
+
The class includes a static `hashText` method.
|
|
127
|
+
|
|
128
|
+
⚠️ **IMPORTANT:** By default, `hashText` is a "dummy" function that returns the plain text. **This is only for testing purposes.**
|
|
129
|
+
|
|
130
|
+
In a production environment, you **must** replace this with a real cryptographic function.
|
|
131
|
+
|
|
132
|
+
**Recommended implementation:**
|
|
133
|
+
```javascript
|
|
134
|
+
import { hashText } from 'tiny-essentials/basics/crypto';
|
|
135
|
+
|
|
136
|
+
// Replace the dummy function with a real one
|
|
137
|
+
TinyPasswordValidator.hashText = hashText;
|
|
138
|
+
|
|
139
|
+
// Usage
|
|
140
|
+
const secureHash = await TinyPasswordValidator.hashText('my-secret-password');
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 🛠️ Advanced Management
|
|
146
|
+
|
|
147
|
+
The validator acts as a manager for your custom rules. You can:
|
|
148
|
+
|
|
149
|
+
* **`reorder(oldIndex, newIndex)`**: Change the priority of custom validators.
|
|
150
|
+
* **`sort(comparator)`**: Sort validators using a custom comparison function.
|
|
151
|
+
* **`remove(id)`**: Delete a specific validator by its ID.
|
|
152
|
+
* **`clear()`**: Remove all custom validators.
|
|
153
|
+
* **`size`**: Check how many custom validators are currently registered.
|
|
@@ -150,6 +150,17 @@ The core logic. It traverses the `exports` field and checks the filesystem.
|
|
|
150
150
|
|
|
151
151
|
---
|
|
152
152
|
|
|
153
|
+
### `async execCommandTester(actions)`
|
|
154
|
+
|
|
155
|
+
**Method**
|
|
156
|
+
|
|
157
|
+
Provides a CLI-based testing interface to execute specific methods or tasks defined in the `actions` object via command-line arguments.
|
|
158
|
+
|
|
159
|
+
* **Returns:** `Promise<void>`
|
|
160
|
+
* **Throws:** `TypeError` if `actions` is not a non-null object.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
153
164
|
### `get results()`
|
|
154
165
|
|
|
155
166
|
**Getter**
|
|
@@ -163,7 +174,40 @@ Returns a detailed list of the validation results.
|
|
|
163
174
|
|
|
164
175
|
---
|
|
165
176
|
|
|
166
|
-
|
|
177
|
+
## 🚀 CLI Testing (Developer Mode)
|
|
178
|
+
|
|
179
|
+
The `execCommandTester` method allows you to turn your script into a CLI tool easily, making it ideal for testing specific workflows without running the entire suite.
|
|
180
|
+
|
|
181
|
+
### Example Setup
|
|
182
|
+
|
|
183
|
+
```javascript
|
|
184
|
+
// test-tool.mjs
|
|
185
|
+
import TinyPkgExportValidator from 'tiny-essentials/libs/tools/TinyPkgExportValidator';
|
|
186
|
+
|
|
187
|
+
const validator = new TinyPkgExportValidator('./package.json', '.');
|
|
188
|
+
|
|
189
|
+
await validator.execCommandTester({
|
|
190
|
+
validate: async () => {
|
|
191
|
+
// Script test...
|
|
192
|
+
},
|
|
193
|
+
info: async () => {
|
|
194
|
+
console.log('Validator Version: 1.0.0');
|
|
195
|
+
console.log('Status: Ready');
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Usage via Terminal
|
|
201
|
+
|
|
202
|
+
1. **Run all registered actions:**
|
|
203
|
+
`node test-tool.mjs`
|
|
204
|
+
|
|
205
|
+
2. **Run a specific action (e.g., only 'validate'):**
|
|
206
|
+
`node test-tool.mjs validate`
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 📝 Customizing Messages (Templates)
|
|
167
211
|
|
|
168
212
|
The `messages` option allows you to override the default output. You can use **placeholders** within your strings to inject dynamic data at runtime.
|
|
169
213
|
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# 🗺️ TinySiteMap Documentation
|
|
2
|
+
|
|
3
|
+
`TinySiteMap` is a robust, secure, and lightweight JavaScript service designed to manage and generate XML sitemaps or sitemap indexes. It is built to handle the complexities of XML namespaces, URL resolution, and security validation automatically.
|
|
4
|
+
|
|
5
|
+
## 🚀 Overview
|
|
6
|
+
|
|
7
|
+
When building websites, sitemaps are essential for SEO (Search Engine Optimization). They tell search engines which pages are available for crawling. `TinySiteMap` automates the creation of these files while ensuring they are valid and safe from common web vulnerabilities.
|
|
8
|
+
|
|
9
|
+
### 🛡️ Security First (The "Why")
|
|
10
|
+
This project implements two critical security layers:
|
|
11
|
+
1. **XML Injection Prevention:** The `#escapeXml` method ensures that special characters (like `<` or `&`) are converted into XML entities. This prevents malicious users from injecting unauthorized XML tags into your sitemap.
|
|
12
|
+
2. **URL Origin Validation:** The `#resolveAndValidate` method checks that every URL added to the sitemap belongs to the same origin as your `baseUrl`. This prevents "Open Redirect" style vulnerabilities where a sitemap might accidentally point to a malicious third-party domain.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 🛠️ Getting Started
|
|
17
|
+
|
|
18
|
+
### 1. Installation & Import
|
|
19
|
+
Since this project uses ES6 modules, you must import it using the `import` syntax.
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
import TinySiteMap from 'tiny-essentials/libs/tools/TinySiteMap';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. Basic Configuration
|
|
26
|
+
To start, you need to create an instance of `TinySiteMap` by providing a configuration object.
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
const config = {
|
|
30
|
+
baseUrl: 'https://www.yourwebsite.com',
|
|
31
|
+
type: 'normal', // Use 'index' if you are creating a sitemap index
|
|
32
|
+
lastmodDateOnly: true // Formats dates as YYYY-MM-DD
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const sitemap = new TinySiteMap(config);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 📝 Managing Entries
|
|
41
|
+
|
|
42
|
+
An "entry" is a single URL or a single sitemap file within an index.
|
|
43
|
+
|
|
44
|
+
### Adding a Standard URL Entry
|
|
45
|
+
You can add URLs using absolute paths or relative paths. The class will automatically convert relative paths into absolute URLs based on your `baseUrl`.
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
sitemap.addEntry({
|
|
49
|
+
loc: '/products/awesome-item', // Will become https://www.yourwebsite.com/products/awesome-item
|
|
50
|
+
lastmod: '2023-10-27T10:00:00Z',
|
|
51
|
+
changefreq: 'daily',
|
|
52
|
+
priority: 0.8
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Adding Custom XML Tags
|
|
57
|
+
If you need to include non-standard XML tags (for specific SEO requirements), use the `customTags` property.
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
sitemap.addEntry({
|
|
61
|
+
loc: '/special-page',
|
|
62
|
+
customTags: {
|
|
63
|
+
'example:data': 'some-value'
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### CRUD Operations (Create, Read, Update, Delete)
|
|
69
|
+
* **Update:** `sitemap.updateEntry(index, { priority: 0.9 });`
|
|
70
|
+
* **Move:** `sitemap.moveEntry(fromIndex, toIndex);`
|
|
71
|
+
* **Remove:** `sitemap.removeEntry(index);`
|
|
72
|
+
* **Clear All:** `sitemap.clearAll();`
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 🧬 Advanced: Namespaces & Strategies
|
|
77
|
+
|
|
78
|
+
XML namespaces allow you to include different types of data (like images or video) within your sitemap.
|
|
79
|
+
|
|
80
|
+
### 1. Manual Namespaces
|
|
81
|
+
You can manually add namespaces if you have specific requirements.
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
sitemap.addNamespace({
|
|
85
|
+
type: 'xmlns',
|
|
86
|
+
prefix: 'myprefix',
|
|
87
|
+
uri: 'http://www.example.com/schema'
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 2. Namespace Strategies (The Easy Way)
|
|
92
|
+
Instead of manually adding every namespace, you can use built-in strategies:
|
|
93
|
+
|
|
94
|
+
* **`TinySiteMap.simpleStrategy()`**: Only includes the standard ROOT namespace.
|
|
95
|
+
* **`TinySiteMap.kaliStrategy()`**: Includes standard Google namespaces (news, image, video, xhtml).
|
|
96
|
+
* **`TinySiteMap.protocolStrategy(instance)`**: A comprehensive strategy that handles `xsi:schemaLocation` and custom tags automatically.
|
|
97
|
+
|
|
98
|
+
**Example using a strategy:**
|
|
99
|
+
```javascript
|
|
100
|
+
const sitemap = new TinySiteMap({
|
|
101
|
+
baseUrl: 'https://www.example.com',
|
|
102
|
+
namespaceStrategy: TinySiteMap.kaliStrategy
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 📤 Generating the Output
|
|
109
|
+
|
|
110
|
+
Once you have finished adding your entries, you can generate the final XML string.
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
const xmlOutput = sitemap.generateXml();
|
|
114
|
+
console.log(xmlOutput);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 🎨 Adding Styles (XSL)
|
|
118
|
+
To make the XML file readable in a web browser, you can provide an XSL stylesheet URL in the config:
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
const sitemap = new TinySiteMap({
|
|
122
|
+
baseUrl: 'https://www.example.com',
|
|
123
|
+
xslUrl: '/styles/sitemap.xsl'
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## ⚠️ Error Handling
|
|
130
|
+
|
|
131
|
+
The class uses strict validation. If you provide invalid data, it will throw specific errors:
|
|
132
|
+
* `TypeError`: If data types are incorrect (e.g., passing a string where a number is expected).
|
|
133
|
+
* `RangeError`: If a value is out of bounds (e.g., a `priority` higher than `1.0` or more than `50,000` entries).
|
|
134
|
+
* `Error`: If security checks fail (e.g., a URL belongs to a different domain).
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# 🗺️ TinySiteMapStream Documentation
|
|
2
|
+
|
|
3
|
+
`TinySiteMapStream` is a high-performance Node.js **Transform stream** designed for generating XML sitemaps incrementally.
|
|
4
|
+
|
|
5
|
+
Instead of building a massive XML string in your computer's memory (which can cause crashes if your website has millions of pages), this class processes one entry at a time and "streams" it to its destination (like a file or an HTTP response).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Core Concepts
|
|
10
|
+
|
|
11
|
+
### 🛠️ What is a Transform Stream?
|
|
12
|
+
Think of a Transform stream as a "processing station" on a factory conveyor belt:
|
|
13
|
+
1. **Input:** It receives raw data objects (like a list of URLs from a database).
|
|
14
|
+
2. **Transformation:** It converts those objects into formatted XML text.
|
|
15
|
+
3. **Output:** It pushes that XML text out to the next station.
|
|
16
|
+
|
|
17
|
+
### 🧬 Configuration Inheritance
|
|
18
|
+
The `TinySiteMapStream` does not work alone. It requires an existing `TinySiteMap` instance. This allows the stream to "inherit" (copy) the settings you already defined, such as your `baseUrl`, `namespaces`, and `type`.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## ⚙️ Configuration Options
|
|
23
|
+
|
|
24
|
+
When you create a new stream, you can pass a `TinySiteMapStreamOptions` object.
|
|
25
|
+
|
|
26
|
+
| Property | Type | Description |
|
|
27
|
+
| :--- | :--- | :--- |
|
|
28
|
+
| `level` | `'silent' \| 'warn' \| 'error'` | Controls how the stream reacts when it encounters a bad URL or invalid data. |
|
|
29
|
+
| `xmlns` | `SitemapNamespace[]` | Custom XML namespaces to include in the header. |
|
|
30
|
+
|
|
31
|
+
### ⚠️ Error Handling Levels
|
|
32
|
+
Choosing the right `level` is crucial for your workflow:
|
|
33
|
+
|
|
34
|
+
* ❌ **`error`**: The stream will stop immediately and emit an error if a single entry is invalid. Use this during **development** to catch bugs.
|
|
35
|
+
* ⚠️ **`warn`**: The stream will log a warning to the console but will **continue** processing the rest of the entries. Use this in **production** to prevent one bad URL from breaking your entire sitemap.
|
|
36
|
+
* 🤫 **`silent`**: The stream will skip invalid entries without saying anything. Use this if you want a completely clean log and don't care about missing specific URLs.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🛠️ Implementation Guide (Step-by-Step)
|
|
41
|
+
|
|
42
|
+
To use this in your project, follow these three logical steps.
|
|
43
|
+
|
|
44
|
+
### 1. Setup the Main Instance
|
|
45
|
+
First, you must have your primary `TinySiteMap` configuration ready.
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
import TinySiteMap from 'tiny-essentials/libs/tools/TinySiteMap';
|
|
49
|
+
import TinySiteMapStream from 'tiny-essentials/libs/tools/TinySiteMapStream';
|
|
50
|
+
import { createWriteStream } from 'node:fs';
|
|
51
|
+
|
|
52
|
+
// 1. Initialize the main configuration
|
|
53
|
+
const sitemapManager = new TinySiteMap({
|
|
54
|
+
baseUrl: 'https://example.com',
|
|
55
|
+
type: 'normal' // or 'index'
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 2. Initialize the Stream
|
|
60
|
+
Create the stream and pass the manager into it.
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
// 2. Create the transform stream
|
|
64
|
+
const stream = new TinySiteMapStream(sitemapManager, {
|
|
65
|
+
level: 'warn' // We want to know if something is wrong, but keep going
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 3. The Data Pipeline (The "Daily Workflow")
|
|
70
|
+
In a real-world scenario, you will likely pull data from a database and "pipe" it through the stream into a file.
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
// 3. Create a destination (a file on your Linux system)
|
|
74
|
+
const fileDestination = createWriteStream('./sitemap.xml');
|
|
75
|
+
|
|
76
|
+
// 4. Start the pipeline
|
|
77
|
+
// We pipe: [Your Data] -> [The Transformer] -> [The File]
|
|
78
|
+
myDatabaseQueryStream
|
|
79
|
+
.pipe(stream)
|
|
80
|
+
.pipe(fileDestination)
|
|
81
|
+
.on('finish', () => console.log('✅ Sitemap generated successfully!'));
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 📝 Developer Cheat Sheet
|
|
87
|
+
|
|
88
|
+
### 💡 Pro-Tips for Daily Use
|
|
89
|
+
|
|
90
|
+
* **Memory Efficiency:** Always use `.pipe()` instead of collecting all results in an array. This keeps your RAM usage low, even if you have 1,000,000 URLs. 📉
|
|
91
|
+
* **Debugging:** If your sitemap is missing pages, change your `level` to `'warn'` temporarily. Check your terminal for `[TinySiteMapStream Warn]` messages. 🔍
|
|
92
|
+
* **Validation:** The stream automatically calls `TinySiteMap.resolveAndValidate`. This means you don't need to manually check if your URLs are valid before sending them to the stream; the stream handles the heavy lifting for you. ✅
|
|
93
|
+
|
|
94
|
+
### 🛠️ Summary of Internal Logic
|
|
95
|
+
1. **First Entry:** The stream automatically injects the `<?xml...?>` declaration and the `<urlset>` header.
|
|
96
|
+
2. **Middle Entries:** Each object is converted to an `<url>` or `<sitemap>` XML fragment.
|
|
97
|
+
3. **End of Stream:** When the data ends, the stream automatically injects the `</urlset>` footer.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# 🛡️ TinyURLSecurityVerifier Documentation
|
|
2
|
+
|
|
3
|
+
Welcome to the official documentation for **TinyURLSecurityVerifier**. This library is a specialized tool designed to protect your applications from malicious URL-based attacks, such as Cross-Site Scripting (XSS), phishing, and credential theft.
|
|
4
|
+
|
|
5
|
+
## 📝 Table of Contents
|
|
6
|
+
1. [Overview](#overview)
|
|
7
|
+
2. [Core Concepts](#core-concepts)
|
|
8
|
+
3. [🚀 Quick Start](#-quick-start)
|
|
9
|
+
4. [⚙️ Configuration](#-configuration)
|
|
10
|
+
5. [🛡️ Security Layers](#-security-layers)
|
|
11
|
+
6. [🛠️ API Reference](#-api-reference)
|
|
12
|
+
7. [📚 Real-World Use Cases](#-real-world-use-cases)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 🔍 Overview
|
|
17
|
+
The `TinyURLSecurityVerifier` provides a multi-layered approach to URL validation. Instead of just checking if a string is a valid URL, it inspects the **intent** and **safety** of the link by analyzing protocols, domains, IP addresses, and embedded credentials.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 🧠 Core Concepts
|
|
22
|
+
|
|
23
|
+
To use this library effectively, you must understand two primary modes of operation:
|
|
24
|
+
|
|
25
|
+
### 🚫 Blacklist Mode (Default)
|
|
26
|
+
In this mode, the verifier looks for "bad" things. If a URL contains a protocol or domain that you have explicitly added to your lists, it is flagged as **dangerous**.
|
|
27
|
+
|
|
28
|
+
### ✅ Whitelist Mode
|
|
29
|
+
In this mode, the verifier looks for "good" things. It assumes everything is dangerous **unless** it is explicitly present in your allowed lists. This is the most secure setting for high-sensitivity applications.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🚀 Quick Start
|
|
34
|
+
|
|
35
|
+
To begin using the verifier, import the class into your module:
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
import TinyURLSecurityVerifier from 'tiny-essentials/libs/tools/TinyURLSecurityVerifier';
|
|
39
|
+
|
|
40
|
+
// Initialize the verifier
|
|
41
|
+
const verifier = new TinyURLSecurityVerifier();
|
|
42
|
+
|
|
43
|
+
// Check a URL
|
|
44
|
+
const urlToCheck = 'https://example.com';
|
|
45
|
+
if (verifier.isDangerous(urlToCheck)) {
|
|
46
|
+
console.error('⚠️ Warning: This URL is potentially malicious!');
|
|
47
|
+
} else {
|
|
48
|
+
console.log('✅ This URL is safe to use.');
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## ⚙️ Configuration
|
|
55
|
+
|
|
56
|
+
The library offers two levels of configuration: **Static** (Global) and **Instance-based** (Local).
|
|
57
|
+
|
|
58
|
+
### 🌐 Global Configuration (Static)
|
|
59
|
+
Static methods affect every instance of the verifier created in your application. Use these for settings that should never change, such as a global list of dangerous protocols (e.g., `javascript:`).
|
|
60
|
+
|
|
61
|
+
* `TinyURLSecurityVerifier.addProtocol(protocol)`: Adds a protocol to the global default list.
|
|
62
|
+
* `TinyURLSecurityVerifier.set defaultProtocols(array)`: Overwrites all global default protocols.
|
|
63
|
+
|
|
64
|
+
### 🛠️ Local Configuration (Instance)
|
|
65
|
+
Instance methods allow you to create specific verifiers for different contexts (e.g., one verifier for "User Comments" and another for "Admin Dashboard").
|
|
66
|
+
|
|
67
|
+
* `verifier.addProtocol(protocol)`: Adds a protocol only to this specific instance.
|
|
68
|
+
* `verifier.addBlacklistedDomain(domain)`: Blocks a specific domain in this instance.
|
|
69
|
+
* `verifier.isWhitelistMode = true`: Switches this specific instance to strict Whitelist mode.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 🛡️ Security Layers
|
|
74
|
+
|
|
75
|
+
The `isDangerous()` method performs a comprehensive scan across these five layers:
|
|
76
|
+
|
|
77
|
+
1. **Protocol Check 🔑**: Detects dangerous schemes like `javascript:`, `data:`, or `file:`.
|
|
78
|
+
2. **Search Parameter Check 🔍**: Inspects the query strings (e.g., `?redirect=javascript:alert(1)`) to ensure no dangerous protocols are hidden inside parameters.
|
|
79
|
+
3. **Credential Check 👤**: Detects if the URL contains embedded usernames or passwords (e.g., `https://user:pass@example.com`), which is a common phishing tactic.
|
|
80
|
+
4. **Domain Reputation Check 🌐**: Checks the hostname against your custom Blacklists or Whitelists.
|
|
81
|
+
5. **IP Address Check 📍**: Flags URLs that use raw IP addresses (IPv4 or IPv6) instead of domain names, as these are frequently used in phishing to bypass DNS filters.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 🛠️ API Reference
|
|
86
|
+
|
|
87
|
+
### Class: `TinyURLSecurityVerifier`
|
|
88
|
+
|
|
89
|
+
#### `constructor()`
|
|
90
|
+
Creates a new instance. It automatically inherits the current global default protocols.
|
|
91
|
+
|
|
92
|
+
#### `isDangerous(href)`
|
|
93
|
+
**The primary method.** Performs all security checks.
|
|
94
|
+
* **Returns:** `boolean` (`true` if dangerous, `false` if safe).
|
|
95
|
+
|
|
96
|
+
#### `isProtocolDangerous(href)`
|
|
97
|
+
Checks if the URL's protocol is in the dangerous list.
|
|
98
|
+
* **Note:** Behavior changes based on `isWhitelistMode`.
|
|
99
|
+
|
|
100
|
+
#### `isSearchParamDangerous(href)`
|
|
101
|
+
Scans all URL parameters for hidden protocol injections.
|
|
102
|
+
|
|
103
|
+
#### `hasCredentials(href)`
|
|
104
|
+
Checks if the URL contains user/password information in the authority component.
|
|
105
|
+
|
|
106
|
+
#### `isIPAddress(href)`
|
|
107
|
+
Checks if the hostname is a raw IPv4 or IPv6 address.
|
|
108
|
+
|
|
109
|
+
#### `isBlacklisted(href)` / `isWhitelisted(href)`
|
|
110
|
+
Checks the domain against the instance's domain lists.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 📚 Real-World Use Cases
|
|
115
|
+
|
|
116
|
+
### 1. Protecting a Comment Section (Blacklist Mode)
|
|
117
|
+
When allowing users to post links, you want to block known bad domains and dangerous protocols.
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
const commentVerifier = new TinyURLSecurityVerifier();
|
|
121
|
+
commentVerifier.addBlacklistedDomain('malicious-site.com');
|
|
122
|
+
commentVerifier.addBlacklistedDomain('phishing-link.net');
|
|
123
|
+
|
|
124
|
+
const userLink = 'https://malicious-site.com/login';
|
|
125
|
+
|
|
126
|
+
if (commentVerifier.isDangerous(userLink)) {
|
|
127
|
+
// Block the comment or flag it for moderation
|
|
128
|
+
console.log("Comment blocked: Malicious link detected.");
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 2. High-Security Admin Redirects (Whitelist Mode)
|
|
133
|
+
In an admin panel, you might only want to allow redirects to your own domain.
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
const adminVerifier = new TinyURLSecurityVerifier();
|
|
137
|
+
adminVerifier.isWhitelistMode = true; // Strict mode enabled
|
|
138
|
+
adminVerifier.addAllowedDomain('my-secure-app.com');
|
|
139
|
+
|
|
140
|
+
const redirectUrl = 'https://external-site.com/hack';
|
|
141
|
+
|
|
142
|
+
if (adminVerifier.isDangerous(redirectUrl)) {
|
|
143
|
+
// Prevent the redirect to protect the admin
|
|
144
|
+
console.error("Security Alert: Redirect blocked!");
|
|
145
|
+
}
|
|
146
|
+
```
|