akanjs 2.2.4-rc.4 → 2.2.4
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/base/base.test.ts +135 -0
- package/base/base.ts +1 -1
- package/base/baseEnv.test.ts +146 -0
- package/base/primitiveRegistry.test.ts +127 -0
- package/base/primitiveRegistry.ts +10 -6
- package/base/symbols.test.ts +29 -0
- package/base/types.ts +4 -1
- package/base/utils.test.ts +30 -0
- package/build.ts +318 -0
- package/capacitor.base.config.test.ts +83 -0
- package/capacitor.base.config.ts +1 -1
- package/client/capacitor.ts +1 -1
- package/client/client.auth-storage.test.ts +210 -0
- package/client/client.decorators.test.ts +74 -0
- package/client/client.device.test.ts +181 -0
- package/client/client.page.test.tsx +175 -0
- package/client/client.pure.test.ts +146 -0
- package/client/client.router.test.ts +290 -0
- package/client/cookie.ts +4 -2
- package/client/createFont.ts +2 -2
- package/client/csrTypes.ts +8 -2
- package/client/makePageProto.tsx +10 -4
- package/client/router.ts +8 -3
- package/client/translator.ts +12 -4
- package/common/Logger.test.ts +45 -0
- package/common/Logger.ts +4 -1
- package/common/formatAndValidation.test.ts +61 -0
- package/common/formatNumber.ts +5 -2
- package/common/hmrPhase.ts +1 -1
- package/common/httpClient.test.ts +91 -0
- package/common/isValidDate.ts +3 -0
- package/common/objectPath.test.ts +108 -0
- package/common/routeConvention.test.ts +132 -0
- package/common/runtimeConfig.test.ts +84 -0
- package/constant/constant.test.ts +374 -0
- package/constant/fieldInfo.ts +3 -3
- package/constant/purify.ts +2 -1
- package/constant/types.ts +4 -0
- package/constant/via.ts +12 -6
- package/dictionary/dictionary.test.ts +352 -0
- package/document/databaseRegistry.ts +8 -0
- package/document/document.test.ts +698 -0
- package/document/into.ts +1 -0
- package/fetch/client/fetchClient.ts +6 -1
- package/fetch/client/httpClient.ts +2 -1
- package/fetch/fetch.test.ts +838 -0
- package/fetch/fetchType/appliedReturn.type.ts +1 -0
- package/fetch/fetchType/endpointFetch.type.ts +3 -0
- package/fetch/fetchType/sliceFetch.type.ts +8 -0
- package/fetch/requestStorage.ts +10 -2
- package/package.json +24 -67
- package/server/akanApp.test.ts +130 -0
- package/server/akanApp.ts +5 -2
- package/server/akanLib.ts +1 -0
- package/server/akanServer.test.ts +157 -0
- package/server/akanServer.ts +4 -3
- package/server/artifact/builderRpc.ts +2 -2
- package/server/artifact/ipcTypes.ts +4 -0
- package/server/artifact/routeClientCache.test.ts +265 -0
- package/server/artifact/routeSeedIndex.test.ts +56 -0
- package/server/artifact/routesManifest.test.ts +64 -0
- package/server/decorators.ts +1 -1
- package/server/di/diLifecycle.contract.test.ts +168 -0
- package/server/di/diLifecycle.ts +6 -3
- package/server/hmr/clientScript.ts +20 -2
- package/server/hmr/devHmrController.ts +4 -0
- package/server/logging/rotatingLogWriter.test.ts +119 -0
- package/server/processMetrics.test.ts +24 -0
- package/server/processMetricsCollector.ts +1 -1
- package/server/proxy/webProxyRunner.test.ts +66 -0
- package/server/resolver/database.resolver.ts +2 -2
- package/server/resolver/resolver.contract.fixture.ts +1 -0
- package/server/resolver/resolver.contract.test.ts +594 -0
- package/server/resolver/signal.resolver.ts +10 -2
- package/server/robots.test.ts +16 -0
- package/server/routeTree.test.tsx +198 -0
- package/server/routing/apiRouter.test.ts +136 -0
- package/server/routing/apiRouter.ts +4 -2
- package/server/rscClient.tsx +7 -1
- package/server/rscWorkerHost.ts +33 -11
- package/server/sitemap.test.ts +61 -0
- package/server/ssrFromRscRenderer.tsx +35 -3
- package/server/systemPages.test.tsx +93 -0
- package/server/types/react-server-dom-webpack.d.ts +7 -1
- package/server/vendor/react-dom-client.ts +1 -1
- package/server/vendor/react-dom.ts +3 -2
- package/server/vendor/react-jsx-dev-runtime.ts +1 -1
- package/server/vendor/react-jsx-runtime.ts +1 -1
- package/server/vendor/react-refresh-runtime.ts +2 -2
- package/server/vendor/react-server-dom-webpack-client-browser.ts +1 -1
- package/server/vendor/react.ts +9 -2
- package/server/vendor/scheduler.ts +3 -2
- package/server/webRouter.test.ts +49 -0
- package/server/webRouter.ts +3 -2
- package/service/adapt.ts +5 -1
- package/service/predefinedAdaptor/cache.adaptor.ts +2 -1
- package/service/predefinedAdaptor/compress.adaptor.test.ts +184 -0
- package/service/predefinedAdaptor/database.adaptor.ts +20 -8
- package/service/predefinedAdaptor/solidCache.adaptor.test.ts +107 -0
- package/service/predefinedAdaptor/solidSqlite.test.ts +457 -0
- package/service/predefinedAdaptor/solidSqlite.ts +2 -1
- package/service/predefinedAdaptor/websocket.adaptor.ts +15 -3
- package/service/serve.ts +7 -3
- package/service/service.test.ts +732 -0
- package/signal/base.signal.ts +1 -0
- package/signal/endpointInfo.ts +7 -0
- package/signal/intercept.ts +2 -0
- package/signal/middleware.ts +2 -1
- package/signal/serverSignal.ts +15 -1
- package/signal/signal.test.ts +892 -0
- package/signal/signalContext.ts +1 -1
- package/signal/signalRegistry.ts +5 -0
- package/signal/sliceInfo.ts +3 -0
- package/signal/trace.ts +11 -0
- package/signal/types.ts +11 -2
- package/store/action.ts +5 -3
- package/store/stateBuilder.test.ts +168 -0
- package/store/stateBuilder.ts +2 -0
- package/store/stateInfo.ts +2 -1
- package/store/store.test.ts +427 -0
- package/store/types.ts +1 -1
- package/test/playwright.config.base.ts +28 -5
- package/test/playwright.pageAgent.ts +1 -1
- package/test/sampleOf.ts +1 -1
- package/test/testServer.ts +1 -1
- package/tsconfig.json +5 -0
- package/ui/BottomSheet.tsx +1 -1
- package/ui/Clipboard.tsx +1 -1
- package/ui/Constant/schemaDoc.test.ts +113 -0
- package/ui/CsrImage.tsx +14 -3
- package/ui/Data/ListContainer.tsx +1 -1
- package/ui/Data/Pagination.tsx +1 -1
- package/ui/Data/QueryMaker.tsx +339 -0
- package/ui/Data/index.ts +1 -0
- package/ui/DatePicker.tsx +95 -1
- package/ui/Dialog/Modal.tsx +1 -1
- package/ui/DraggableList.tsx +5 -5
- package/ui/Field.tsx +3 -2
- package/ui/Image.tsx +3 -2
- package/ui/InfiniteScroll.test.tsx +155 -0
- package/ui/InfiniteScroll.tsx +1 -0
- package/ui/Input.tsx +8 -1
- package/ui/Layout/BottomTab.tsx +2 -2
- package/ui/Link/SsrLink.tsx +2 -1
- package/ui/Load/Page.tsx +1 -1
- package/ui/Load/PageCSR.tsx +1 -0
- package/ui/Load/Units.tsx +2 -1
- package/ui/Load/View.tsx +2 -1
- package/ui/Menu.tsx +8 -5
- package/ui/Model/EditModal.tsx +5 -2
- package/ui/Popconfirm.tsx +4 -2
- package/ui/ScreenNavigator.tsx +3 -2
- package/ui/Signal/Message.tsx +3 -2
- package/ui/Signal/PubSub.tsx +2 -0
- package/ui/Signal/Response.tsx +1 -1
- package/ui/Signal/WebSocket.tsx +11 -2
- package/ui/System/Client.tsx +41 -7
- package/ui/System/Common.test.ts +37 -0
- package/ui/System/Gtag.tsx +5 -2
- package/ui/System/Messages.tsx +2 -2
- package/ui/System/Reconnect.tsx +6 -5
- package/ui/System/Root.tsx +1 -0
- package/ui/System/SSR.tsx +7 -1
- package/ui/ToggleSelect.tsx +8 -3
- package/ui/Unauthorized.tsx +1 -1
- package/webkit/bootCsr.test.tsx +153 -0
- package/webkit/bootCsr.tsx +6 -3
- package/webkit/lazy.tsx +8 -1
- package/webkit/native.test.tsx +341 -0
- package/webkit/useCamera.tsx +1 -0
- package/webkit/useCodepush.tsx +9 -4
- package/webkit/useContact.tsx +1 -0
- package/webkit/useCsrValues.ts +10 -6
- package/webkit/useDebounce.ts +2 -2
- package/webkit/usePurchase.tsx +9 -5
- package/webkit/usePushNoti.tsx +1 -0
- package/webkit/webkit.test.tsx +531 -0
- package/types/base/base.d.ts +0 -53
- package/types/base/baseEnv.d.ts +0 -68
- package/types/base/index.d.ts +0 -6
- package/types/base/primitiveRegistry.d.ts +0 -134
- package/types/base/symbols.d.ts +0 -11
- package/types/base/types.d.ts +0 -68
- package/types/base/utils.d.ts +0 -4
- package/types/base.d.ts +0 -1
- package/types/capacitor.base.config.d.ts +0 -3
- package/types/client/capacitor.d.ts +0 -233
- package/types/client/clientRuntime.d.ts +0 -63
- package/types/client/cookie.d.ts +0 -33
- package/types/client/createFont.d.ts +0 -6
- package/types/client/csrTypes.d.ts +0 -262
- package/types/client/decorators.d.ts +0 -7
- package/types/client/device.d.ts +0 -41
- package/types/client/fetch.d.ts +0 -1
- package/types/client/index.d.ts +0 -14
- package/types/client/locale.d.ts +0 -5
- package/types/client/makePageProto.d.ts +0 -17002
- package/types/client/router.d.ts +0 -66
- package/types/client/rscNavigation.d.ts +0 -19
- package/types/client/storage.d.ts +0 -5
- package/types/client/translator.d.ts +0 -18
- package/types/client/types.d.ts +0 -145
- package/types/client/useClient.d.ts +0 -1
- package/types/client.d.ts +0 -1
- package/types/common/Logger.d.ts +0 -41
- package/types/common/applyMixins.d.ts +0 -3
- package/types/common/capitalize.d.ts +0 -2
- package/types/common/deepObjectify.d.ts +0 -4
- package/types/common/fileUpload.d.ts +0 -28
- package/types/common/formatNumber.d.ts +0 -1
- package/types/common/formatPhone.d.ts +0 -2
- package/types/common/getAllPropertyDescriptors.d.ts +0 -5
- package/types/common/hmrPhase.d.ts +0 -6
- package/types/common/httpClient.d.ts +0 -20
- package/types/common/index.d.ts +0 -29
- package/types/common/isDayjs.d.ts +0 -2
- package/types/common/isEmail.d.ts +0 -2
- package/types/common/isPhoneNumber.d.ts +0 -2
- package/types/common/isQueryEqual.d.ts +0 -1
- package/types/common/isValidDate.d.ts +0 -2
- package/types/common/jwtDecode.d.ts +0 -2
- package/types/common/localeConfig.d.ts +0 -11
- package/types/common/lowerlize.d.ts +0 -2
- package/types/common/mergeVersion.d.ts +0 -10
- package/types/common/objectify.d.ts +0 -1
- package/types/common/pathGet.d.ts +0 -1
- package/types/common/pathSet.d.ts +0 -3
- package/types/common/randomPick.d.ts +0 -1
- package/types/common/randomPicks.d.ts +0 -1
- package/types/common/routeConvention.d.ts +0 -35
- package/types/common/sleep.d.ts +0 -2
- package/types/common/splitVersion.d.ts +0 -11
- package/types/common/subRoute.d.ts +0 -7
- package/types/common/types.d.ts +0 -14
- package/types/common.d.ts +0 -1
- package/types/constant/constantRegistry.d.ts +0 -89
- package/types/constant/crystalize.d.ts +0 -4
- package/types/constant/deserialize.d.ts +0 -7
- package/types/constant/fieldInfo.d.ts +0 -153
- package/types/constant/getDefault.d.ts +0 -3
- package/types/constant/immerify.d.ts +0 -2
- package/types/constant/index.d.ts +0 -10
- package/types/constant/purify.d.ts +0 -12
- package/types/constant/serialize.d.ts +0 -11
- package/types/constant/types.d.ts +0 -77
- package/types/constant/via.d.ts +0 -52
- package/types/constant.d.ts +0 -1
- package/types/dictionary/base.dictionary.d.ts +0 -1
- package/types/dictionary/dictInfo.d.ts +0 -206
- package/types/dictionary/dictionary.d.ts +0 -11
- package/types/dictionary/index.d.ts +0 -4
- package/types/dictionary/locale.d.ts +0 -128
- package/types/dictionary/trans.d.ts +0 -82
- package/types/dictionary.d.ts +0 -1
- package/types/document/by.d.ts +0 -20
- package/types/document/dataLoader.d.ts +0 -36
- package/types/document/database.d.ts +0 -96
- package/types/document/databaseRegistry.d.ts +0 -36
- package/types/document/documentQuery.d.ts +0 -105
- package/types/document/documentSchema.d.ts +0 -33
- package/types/document/filterMeta.d.ts +0 -84
- package/types/document/index.d.ts +0 -11
- package/types/document/into.d.ts +0 -65
- package/types/document/loaderInfo.d.ts +0 -35
- package/types/document/schema.d.ts +0 -5
- package/types/document/types.d.ts +0 -36
- package/types/document.d.ts +0 -1
- package/types/fetch/client/fetchClient.d.ts +0 -78
- package/types/fetch/client/httpClient.d.ts +0 -39
- package/types/fetch/client/index.d.ts +0 -3
- package/types/fetch/client/wsClient.d.ts +0 -37
- package/types/fetch/client.d.ts +0 -1
- package/types/fetch/fetchType/appliedReturn.type.d.ts +0 -67
- package/types/fetch/fetchType/buildFetch.type.d.ts +0 -11
- package/types/fetch/fetchType/clientSignal.type.d.ts +0 -16
- package/types/fetch/fetchType/endpointFetch.type.d.ts +0 -29
- package/types/fetch/fetchType/index.d.ts +0 -5
- package/types/fetch/fetchType/sliceFetch.type.d.ts +0 -76
- package/types/fetch/fetchType.d.ts +0 -1
- package/types/fetch/index.d.ts +0 -4
- package/types/fetch/requestStorage.d.ts +0 -29
- package/types/fetch/serializer/fetch.serializer.d.ts +0 -14
- package/types/fetch/serializer/index.d.ts +0 -1
- package/types/fetch/serializer.d.ts +0 -1
- package/types/fetch/types.d.ts +0 -19
- package/types/fetch.d.ts +0 -1
- package/types/index.d.ts +0 -213
- package/types/server/akanApp.d.ts +0 -17
- package/types/server/akanAppHeaders.d.ts +0 -1
- package/types/server/akanLib.d.ts +0 -33
- package/types/server/akanOption.d.ts +0 -15
- package/types/server/akanServer.d.ts +0 -47
- package/types/server/artifact/builderRpc.d.ts +0 -42
- package/types/server/artifact/index.d.ts +0 -6
- package/types/server/artifact/ipcTypes.d.ts +0 -73
- package/types/server/artifact/manifestTypes.d.ts +0 -16
- package/types/server/artifact/routeClientCache.d.ts +0 -45
- package/types/server/artifact/routeSeedIndexStore.d.ts +0 -43
- package/types/server/artifact/routesManifestStore.d.ts +0 -16
- package/types/server/artifact.d.ts +0 -1
- package/types/server/decorators.d.ts +0 -6
- package/types/server/di/diLifecycle.d.ts +0 -45
- package/types/server/di/index.d.ts +0 -4
- package/types/server/di/predefinedAdaptor.d.ts +0 -33
- package/types/server/di/resolveAdaptorHierarchy.d.ts +0 -21
- package/types/server/di/resolveHierarchy.d.ts +0 -11
- package/types/server/di/resolveServiceHierarchy.d.ts +0 -13
- package/types/server/di/utils.d.ts +0 -14
- package/types/server/di.d.ts +0 -1
- package/types/server/hmr/changeBatch.d.ts +0 -13
- package/types/server/hmr/clientScript.d.ts +0 -1
- package/types/server/hmr/devHmrController.d.ts +0 -24
- package/types/server/hmr/index.d.ts +0 -4
- package/types/server/hmr/wsHub.d.ts +0 -45
- package/types/server/hmr.d.ts +0 -1
- package/types/server/imageOptimizer.d.ts +0 -12
- package/types/server/imageOptimizerError.d.ts +0 -4
- package/types/server/index.d.ts +0 -14
- package/types/server/lifecycle/shutdownManager.d.ts +0 -13
- package/types/server/logging/rotatingLogWriter.d.ts +0 -20
- package/types/server/processMetricsCollector.d.ts +0 -10
- package/types/server/proxy/akanResponse.d.ts +0 -7
- package/types/server/proxy/bunRequestFields.d.ts +0 -1
- package/types/server/proxy/hostBasePathWebProxy.d.ts +0 -6
- package/types/server/proxy/index.d.ts +0 -6
- package/types/server/proxy/localeWebProxy.d.ts +0 -5
- package/types/server/proxy/types.d.ts +0 -37
- package/types/server/proxy/webProxyRunner.d.ts +0 -7
- package/types/server/proxy.d.ts +0 -1
- package/types/server/resolver/database.resolver.d.ts +0 -6
- package/types/server/resolver/index.d.ts +0 -3
- package/types/server/resolver/service.resolver.d.ts +0 -7
- package/types/server/resolver/signal.resolver.d.ts +0 -29
- package/types/server/resolver.d.ts +0 -1
- package/types/server/robots.d.ts +0 -1
- package/types/server/routeElementComposer.d.ts +0 -41
- package/types/server/routeTreeBuilder.d.ts +0 -28
- package/types/server/routing/apiRouter.d.ts +0 -61
- package/types/server/rscClient.d.ts +0 -15
- package/types/server/rscWorker.d.ts +0 -3
- package/types/server/rscWorkerHost.d.ts +0 -83
- package/types/server/sitemap.d.ts +0 -13
- package/types/server/ssrFromRscRenderer.d.ts +0 -6
- package/types/server/ssrTypes.d.ts +0 -47
- package/types/server/systemPages.d.ts +0 -27
- package/types/server/types/react-server-dom-webpack.d.ts +0 -91
- package/types/server/types.d.ts +0 -67
- package/types/server/vendor/akanjs-base.d.ts +0 -1
- package/types/server/vendor/akanjs-common.d.ts +0 -1
- package/types/server/vendor/akanjs-constant.d.ts +0 -1
- package/types/server/vendor/akanjs-store.d.ts +0 -1
- package/types/server/vendor/react-dom-client.d.ts +0 -3
- package/types/server/vendor/react-dom.d.ts +0 -3
- package/types/server/vendor/react-jsx-dev-runtime.d.ts +0 -3
- package/types/server/vendor/react-jsx-runtime.d.ts +0 -3
- package/types/server/vendor/react-refresh-runtime.d.ts +0 -3
- package/types/server/vendor/react-server-dom-webpack-client-browser.d.ts +0 -3
- package/types/server/vendor/react.d.ts +0 -11
- package/types/server/vendor/scheduler.d.ts +0 -3
- package/types/server/webRouter.d.ts +0 -44
- package/types/server.d.ts +0 -1
- package/types/service/adapt.d.ts +0 -15
- package/types/service/base.service.d.ts +0 -18
- package/types/service/index.d.ts +0 -10
- package/types/service/injectInfo.d.ts +0 -102
- package/types/service/ipcTypes.d.ts +0 -194
- package/types/service/predefinedAdaptor/cache.adaptor.d.ts +0 -46
- package/types/service/predefinedAdaptor/compress.adaptor.d.ts +0 -22
- package/types/service/predefinedAdaptor/database.adaptor.d.ts +0 -329
- package/types/service/predefinedAdaptor/index.d.ts +0 -13
- package/types/service/predefinedAdaptor/logging.adaptor.d.ts +0 -20
- package/types/service/predefinedAdaptor/queue.adaptor.d.ts +0 -22
- package/types/service/predefinedAdaptor/role.adaptor.d.ts +0 -17
- package/types/service/predefinedAdaptor/schedule.adaptor.d.ts +0 -60
- package/types/service/predefinedAdaptor/solidCache.adaptor.d.ts +0 -25
- package/types/service/predefinedAdaptor/solidPubsub.adaptor.d.ts +0 -20
- package/types/service/predefinedAdaptor/solidQueue.adaptor.d.ts +0 -19
- package/types/service/predefinedAdaptor/solidSqlite.d.ts +0 -24
- package/types/service/predefinedAdaptor/sqlitePath.d.ts +0 -9
- package/types/service/predefinedAdaptor/storage.adaptor.d.ts +0 -80
- package/types/service/predefinedAdaptor/websocket.adaptor.d.ts +0 -49
- package/types/service/predefinedAdaptor.d.ts +0 -1
- package/types/service/serve.d.ts +0 -31
- package/types/service/serviceModule.d.ts +0 -50
- package/types/service/serviceRegistry.d.ts +0 -9
- package/types/service/types.d.ts +0 -55
- package/types/service.d.ts +0 -1
- package/types/signal/base.signal.d.ts +0 -41
- package/types/signal/endpoint.d.ts +0 -28
- package/types/signal/endpointInfo.d.ts +0 -77
- package/types/signal/exception.d.ts +0 -54786
- package/types/signal/guard.d.ts +0 -10
- package/types/signal/guards.d.ts +0 -10
- package/types/signal/index.d.ts +0 -19
- package/types/signal/intercept.d.ts +0 -17
- package/types/signal/internal.d.ts +0 -18
- package/types/signal/internalArg.d.ts +0 -31
- package/types/signal/internalInfo.d.ts +0 -45
- package/types/signal/middleware.d.ts +0 -51
- package/types/signal/serializer/fetch.serializer.d.ts +0 -14
- package/types/signal/serializer/index.d.ts +0 -1
- package/types/signal/serializer.d.ts +0 -1
- package/types/signal/serverSignal.d.ts +0 -36
- package/types/signal/signalContext.d.ts +0 -96
- package/types/signal/signalRegistry.d.ts +0 -49
- package/types/signal/slice.d.ts +0 -42
- package/types/signal/sliceInfo.d.ts +0 -51
- package/types/signal/trace.d.ts +0 -97
- package/types/signal/types.d.ts +0 -142
- package/types/signal.d.ts +0 -1
- package/types/store/action.d.ts +0 -145
- package/types/store/baseSt.d.ts +0 -412
- package/types/store/hooks.d.ts +0 -1
- package/types/store/index.d.ts +0 -8
- package/types/store/rootStore.d.ts +0 -22
- package/types/store/state.d.ts +0 -91
- package/types/store/stateBuilder.d.ts +0 -141
- package/types/store/stateInfo.d.ts +0 -23
- package/types/store/store.d.ts +0 -36
- package/types/store/storeInstance.d.ts +0 -38
- package/types/store/storeRegistry.d.ts +0 -13
- package/types/store/types.d.ts +0 -42
- package/types/store/withSelector.d.ts +0 -42
- package/types/store.d.ts +0 -1
- package/types/test/index.d.ts +0 -4
- package/types/test/playwright.config.base.d.ts +0 -9
- package/types/test/playwright.pageAgent.d.ts +0 -12
- package/types/test/sample.d.ts +0 -15
- package/types/test/sampleOf.d.ts +0 -5
- package/types/test/signalTest.preload.d.ts +0 -1
- package/types/test/signalTestRuntime.d.ts +0 -29
- package/types/test/testServer.d.ts +0 -26
- package/types/test.d.ts +0 -1
- package/types/ui/BottomSheet.d.ts +0 -13
- package/types/ui/Button.d.ts +0 -11
- package/types/ui/ClientSide.d.ts +0 -8
- package/types/ui/Clipboard.d.ts +0 -7
- package/types/ui/Constant/Doc.d.ts +0 -29
- package/types/ui/Constant/Mermaid.d.ts +0 -8
- package/types/ui/Constant/index.d.ts +0 -6
- package/types/ui/Constant/schemaDoc.d.ts +0 -84
- package/types/ui/Constant.d.ts +0 -1
- package/types/ui/Copy.d.ts +0 -10
- package/types/ui/CsrImage.d.ts +0 -18
- package/types/ui/Data/CardList.d.ts +0 -36
- package/types/ui/Data/Dashboard.d.ts +0 -11
- package/types/ui/Data/Insight.d.ts +0 -9
- package/types/ui/Data/Item.d.ts +0 -75
- package/types/ui/Data/ListContainer.d.ts +0 -49
- package/types/ui/Data/Pagination.d.ts +0 -9
- package/types/ui/Data/QueryMaker.d.ts +0 -8
- package/types/ui/Data/TableList.d.ts +0 -26
- package/types/ui/Data/index.d.ts +0 -9
- package/types/ui/Data/index_.d.ts +0 -8
- package/types/ui/Data.d.ts +0 -1
- package/types/ui/DatePicker.d.ts +0 -36
- package/types/ui/Dialog/Action.d.ts +0 -5
- package/types/ui/Dialog/Close.d.ts +0 -6
- package/types/ui/Dialog/Content.d.ts +0 -6
- package/types/ui/Dialog/Modal.d.ts +0 -9
- package/types/ui/Dialog/Provider.d.ts +0 -11
- package/types/ui/Dialog/Title.d.ts +0 -5
- package/types/ui/Dialog/Trigger.d.ts +0 -6
- package/types/ui/Dialog/context.d.ts +0 -10
- package/types/ui/Dialog/index.d.ts +0 -9
- package/types/ui/Dialog.d.ts +0 -1
- package/types/ui/DragAction.d.ts +0 -24
- package/types/ui/DraggableList.d.ts +0 -31
- package/types/ui/Dropdown.d.ts +0 -14
- package/types/ui/Empty.d.ts +0 -12
- package/types/ui/Field.d.ts +0 -411
- package/types/ui/FontFace.d.ts +0 -6
- package/types/ui/Image.d.ts +0 -49
- package/types/ui/InfiniteScroll.d.ts +0 -10
- package/types/ui/Input.d.ts +0 -95
- package/types/ui/KeyboardAvoiding.d.ts +0 -8
- package/types/ui/Layout/BottomAction.d.ts +0 -6
- package/types/ui/Layout/BottomInset.d.ts +0 -7
- package/types/ui/Layout/BottomTab.d.ts +0 -14
- package/types/ui/Layout/Header.d.ts +0 -8
- package/types/ui/Layout/LeftSider.d.ts +0 -9
- package/types/ui/Layout/Navbar.d.ts +0 -11
- package/types/ui/Layout/RightSider.d.ts +0 -10
- package/types/ui/Layout/Sider.d.ts +0 -7
- package/types/ui/Layout/Template.d.ts +0 -7
- package/types/ui/Layout/TopLeftAction.d.ts +0 -6
- package/types/ui/Layout/Unit.d.ts +0 -9
- package/types/ui/Layout/View.d.ts +0 -8
- package/types/ui/Layout/Zone.d.ts +0 -6
- package/types/ui/Layout/index.d.ts +0 -14
- package/types/ui/Layout.d.ts +0 -1
- package/types/ui/Link/Back.d.ts +0 -7
- package/types/ui/Link/Close.d.ts +0 -7
- package/types/ui/Link/CsrLink.d.ts +0 -2
- package/types/ui/Link/Lang.d.ts +0 -8
- package/types/ui/Link/SsrLink.d.ts +0 -2
- package/types/ui/Link/index.d.ts +0 -10
- package/types/ui/Link/types.d.ts +0 -42
- package/types/ui/Link.d.ts +0 -1
- package/types/ui/Load/Edit.d.ts +0 -4
- package/types/ui/Load/Edit_Client.d.ts +0 -27
- package/types/ui/Load/Page.d.ts +0 -15
- package/types/ui/Load/PageCSR.d.ts +0 -3
- package/types/ui/Load/Pagination.d.ts +0 -8
- package/types/ui/Load/Units.d.ts +0 -30
- package/types/ui/Load/View.d.ts +0 -22
- package/types/ui/Load/index.d.ts +0 -8
- package/types/ui/Load/index_.d.ts +0 -3
- package/types/ui/Load.d.ts +0 -1
- package/types/ui/Loading/Area.d.ts +0 -1
- package/types/ui/Loading/Button.d.ts +0 -7
- package/types/ui/Loading/Input.d.ts +0 -7
- package/types/ui/Loading/ProgressBar.d.ts +0 -6
- package/types/ui/Loading/Skeleton.d.ts +0 -7
- package/types/ui/Loading/Spin.d.ts +0 -7
- package/types/ui/Loading/index.d.ts +0 -8
- package/types/ui/Loading.d.ts +0 -1
- package/types/ui/Menu.d.ts +0 -26
- package/types/ui/Modal.d.ts +0 -19
- package/types/ui/Model/AdminPanel.d.ts +0 -31
- package/types/ui/Model/Edit.d.ts +0 -16
- package/types/ui/Model/EditModal.d.ts +0 -52
- package/types/ui/Model/EditWrapper.d.ts +0 -13
- package/types/ui/Model/LoadInit.d.ts +0 -10
- package/types/ui/Model/New.d.ts +0 -16
- package/types/ui/Model/NewWrapper.d.ts +0 -13
- package/types/ui/Model/NewWrapper_Client.d.ts +0 -13
- package/types/ui/Model/Remove.d.ts +0 -13
- package/types/ui/Model/RemoveWrapper.d.ts +0 -12
- package/types/ui/Model/SureToRemove.d.ts +0 -11
- package/types/ui/Model/View.d.ts +0 -19
- package/types/ui/Model/ViewEditModal.d.ts +0 -12
- package/types/ui/Model/ViewModal.d.ts +0 -14
- package/types/ui/Model/ViewWrapper.d.ts +0 -12
- package/types/ui/Model/index.d.ts +0 -16
- package/types/ui/Model/index_.d.ts +0 -14
- package/types/ui/Model.d.ts +0 -1
- package/types/ui/More.d.ts +0 -12
- package/types/ui/ObjectId.d.ts +0 -5
- package/types/ui/Pagination.d.ts +0 -20
- package/types/ui/Popconfirm.d.ts +0 -28
- package/types/ui/Portal.d.ts +0 -6
- package/types/ui/Radio.d.ts +0 -19
- package/types/ui/RecentTime.d.ts +0 -12
- package/types/ui/Refresh.d.ts +0 -7
- package/types/ui/ScreenNavigator.d.ts +0 -18
- package/types/ui/Select.d.ts +0 -43
- package/types/ui/Signal/Arg.d.ts +0 -78
- package/types/ui/Signal/Doc.d.ts +0 -33
- package/types/ui/Signal/Listener.d.ts +0 -9
- package/types/ui/Signal/Message.d.ts +0 -23
- package/types/ui/Signal/Object.d.ts +0 -20
- package/types/ui/Signal/PubSub.d.ts +0 -24
- package/types/ui/Signal/Request.d.ts +0 -8
- package/types/ui/Signal/Response.d.ts +0 -14
- package/types/ui/Signal/RestApi.d.ts +0 -40
- package/types/ui/Signal/WebSocket.d.ts +0 -11
- package/types/ui/Signal/index.d.ts +0 -18
- package/types/ui/Signal/makeExample.d.ts +0 -4
- package/types/ui/Signal/style.d.ts +0 -15
- package/types/ui/Signal.d.ts +0 -1
- package/types/ui/System/CSR.d.ts +0 -32
- package/types/ui/System/Client.d.ts +0 -47
- package/types/ui/System/Common.d.ts +0 -47
- package/types/ui/System/DevModeToggle.d.ts +0 -1
- package/types/ui/System/Gtag.d.ts +0 -4
- package/types/ui/System/Messages.d.ts +0 -1
- package/types/ui/System/Reconnect.d.ts +0 -1
- package/types/ui/System/Root.d.ts +0 -6
- package/types/ui/System/SSR.d.ts +0 -24
- package/types/ui/System/SelectLanguage.d.ts +0 -5
- package/types/ui/System/ThemeToggle.d.ts +0 -4
- package/types/ui/System/index.d.ts +0 -12
- package/types/ui/System.d.ts +0 -1
- package/types/ui/Tab/Menu.d.ts +0 -12
- package/types/ui/Tab/Menus.d.ts +0 -6
- package/types/ui/Tab/Panel.d.ts +0 -8
- package/types/ui/Tab/Provider.d.ts +0 -10
- package/types/ui/Tab/context.d.ts +0 -9
- package/types/ui/Tab/index.d.ts +0 -7
- package/types/ui/Tab.d.ts +0 -1
- package/types/ui/Table.d.ts +0 -41
- package/types/ui/ToggleSelect.d.ts +0 -33
- package/types/ui/Unauthorized.d.ts +0 -9
- package/types/ui/animated.d.ts +0 -5
- package/types/ui/fontCss.d.ts +0 -11
- package/types/ui/index.d.ts +0 -44
- package/types/ui.d.ts +0 -1
- package/types/webkit/bootCsr.d.ts +0 -16
- package/types/webkit/createRobotPage.d.ts +0 -15
- package/types/webkit/createSitemapPage.d.ts +0 -4
- package/types/webkit/index.d.ts +0 -17
- package/types/webkit/lazy.d.ts +0 -11
- package/types/webkit/types.d.ts +0 -7
- package/types/webkit/useCamera.d.ts +0 -19
- package/types/webkit/useCodepush.d.ts +0 -16
- package/types/webkit/useContact.d.ts +0 -11
- package/types/webkit/useCsrValues.d.ts +0 -30
- package/types/webkit/useDebounce.d.ts +0 -2
- package/types/webkit/useFetch.d.ts +0 -18
- package/types/webkit/useGeoLocation.d.ts +0 -8
- package/types/webkit/useHistory.d.ts +0 -23
- package/types/webkit/useInterval.d.ts +0 -2
- package/types/webkit/useLocation.d.ts +0 -8
- package/types/webkit/usePurchase.d.ts +0 -19
- package/types/webkit/usePushNoti.d.ts +0 -7
- package/types/webkit/useThrottle.d.ts +0 -2
- package/types/webkit.d.ts +0 -1
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { afterEach, beforeAll, describe, expect, mock, test } from "bun:test";
|
|
2
|
+
|
|
3
|
+
type Side = "server" | "client";
|
|
4
|
+
|
|
5
|
+
const envState = {
|
|
6
|
+
side: "client" as Side,
|
|
7
|
+
operationMode: "local",
|
|
8
|
+
basePaths: "admin,console",
|
|
9
|
+
};
|
|
10
|
+
const requestState = {
|
|
11
|
+
request: undefined as Request | undefined,
|
|
12
|
+
headers: new Map<string, string>(),
|
|
13
|
+
};
|
|
14
|
+
const messages: unknown[] = [];
|
|
15
|
+
const timeoutCallbacks: Array<() => void> = [];
|
|
16
|
+
|
|
17
|
+
beforeAll(() => {
|
|
18
|
+
mock.module("akanjs/base", () => ({
|
|
19
|
+
getEnv: () => ({
|
|
20
|
+
side: envState.side,
|
|
21
|
+
renderMode: "csr",
|
|
22
|
+
appName: "test-app",
|
|
23
|
+
environment: "debug",
|
|
24
|
+
operationMode: envState.operationMode,
|
|
25
|
+
}),
|
|
26
|
+
}));
|
|
27
|
+
mock.module("akanjs/common", () => ({
|
|
28
|
+
Logger: { log: () => undefined, verbose: () => undefined },
|
|
29
|
+
parseAkanI18nEnv: () => ({ locales: ["en", "ko"], defaultLocale: "en" }),
|
|
30
|
+
parseBasePaths: (value?: string) => (value ? value.split(",").filter(Boolean) : []),
|
|
31
|
+
pathGet: (path: string, obj: Record<string, unknown>, separator = ".", fallback?: unknown) =>
|
|
32
|
+
path.split(separator).reduce<unknown>((acc, key) => {
|
|
33
|
+
if (!acc || typeof acc !== "object") return fallback;
|
|
34
|
+
return (acc as Record<string, unknown>)[key] ?? fallback;
|
|
35
|
+
}, obj),
|
|
36
|
+
getBasePathFromPathname: (
|
|
37
|
+
pathname: string,
|
|
38
|
+
opts: { basePaths: Set<string>; i18n: { locales: string[] }; headerBasePath?: string },
|
|
39
|
+
) => {
|
|
40
|
+
if (opts.headerBasePath) return opts.headerBasePath;
|
|
41
|
+
const [, lang, base] = pathname.split("/");
|
|
42
|
+
return opts.i18n.locales.includes(lang ?? "") && base && opts.basePaths.has(base) ? base : null;
|
|
43
|
+
},
|
|
44
|
+
}));
|
|
45
|
+
mock.module("akanjs/fetch", () => ({
|
|
46
|
+
FetchClient: {
|
|
47
|
+
build: () => ({ fetch: { setJwt: () => undefined }, sig: {} }),
|
|
48
|
+
},
|
|
49
|
+
defaultAccount: { appName: "test-app", environment: "debug" },
|
|
50
|
+
requestStorage: {
|
|
51
|
+
getStore: () => requestState.request,
|
|
52
|
+
},
|
|
53
|
+
getRequest: () => requestState.request,
|
|
54
|
+
headers: () => requestState.headers,
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const installClientWindow = (pathname = "/en/admin/current", search = "", hash = "") => {
|
|
59
|
+
Object.defineProperty(globalThis, "window", {
|
|
60
|
+
value: {
|
|
61
|
+
location: { pathname, search, hash },
|
|
62
|
+
parent: { postMessage: (message: unknown) => messages.push(message) },
|
|
63
|
+
},
|
|
64
|
+
configurable: true,
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(globalThis, "document", {
|
|
67
|
+
value: { referrer: "https://example.test/en/admin/previous" },
|
|
68
|
+
configurable: true,
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(globalThis, "location", {
|
|
71
|
+
value: { pathname, search, hash },
|
|
72
|
+
configurable: true,
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
afterEach(() => {
|
|
77
|
+
envState.side = "client";
|
|
78
|
+
envState.operationMode = "local";
|
|
79
|
+
envState.basePaths = "admin,console";
|
|
80
|
+
process.env.AKAN_PUBLIC_BASE_PATHS = envState.basePaths;
|
|
81
|
+
requestState.request = undefined;
|
|
82
|
+
requestState.headers = new Map();
|
|
83
|
+
messages.length = 0;
|
|
84
|
+
timeoutCallbacks.length = 0;
|
|
85
|
+
globalThis.__AKAN_ROUTER__ = undefined;
|
|
86
|
+
Object.defineProperty(globalThis, "window", { value: undefined, configurable: true });
|
|
87
|
+
Object.defineProperty(globalThis, "document", { value: undefined, configurable: true });
|
|
88
|
+
Object.defineProperty(globalThis, "location", { value: undefined, configurable: true });
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe("router", () => {
|
|
92
|
+
test("normalizes paths with language, prefix, query, hash, root, and absolute hrefs", async () => {
|
|
93
|
+
const { getPathInfo } = await import("./router");
|
|
94
|
+
|
|
95
|
+
expect(getPathInfo("/en/admin/users?tab=a#bio", "en", "admin")).toEqual({
|
|
96
|
+
path: "/users",
|
|
97
|
+
pathname: "/en/admin/users",
|
|
98
|
+
search: "tab=a",
|
|
99
|
+
hash: "bio",
|
|
100
|
+
href: "/en/admin/users?tab=a#bio",
|
|
101
|
+
});
|
|
102
|
+
expect(getPathInfo("/en/admin", "en", "admin").path).toBe("/");
|
|
103
|
+
expect(getPathInfo("/users", "ko", "").href).toBe("/ko/users");
|
|
104
|
+
expect(getPathInfo("https://external.test/path", "en", "admin").pathname).toBe("https://external.test/path");
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test("client router init wraps push, replace, back, refresh, and path helpers", async () => {
|
|
108
|
+
envState.side = "client";
|
|
109
|
+
installClientWindow();
|
|
110
|
+
const originalSetTimeout = globalThis.setTimeout;
|
|
111
|
+
const mockSetTimeout = ((handler: TimerHandler) => {
|
|
112
|
+
timeoutCallbacks.push(() => {
|
|
113
|
+
if (typeof handler === "function") handler();
|
|
114
|
+
});
|
|
115
|
+
return timeoutCallbacks.length as unknown as ReturnType<typeof setTimeout>;
|
|
116
|
+
}) as unknown as typeof setTimeout;
|
|
117
|
+
globalThis.setTimeout = mockSetTimeout;
|
|
118
|
+
const calls: unknown[] = [];
|
|
119
|
+
const { router } = await import("./router");
|
|
120
|
+
|
|
121
|
+
router.init({
|
|
122
|
+
type: "csr",
|
|
123
|
+
lang: "en",
|
|
124
|
+
prefix: "admin",
|
|
125
|
+
router: {
|
|
126
|
+
push: (href, options) => calls.push(["push", href, options]),
|
|
127
|
+
replace: (href, options) => calls.push(["replace", href, options]),
|
|
128
|
+
back: (options) => calls.push(["back", options]),
|
|
129
|
+
refresh: () => calls.push(["refresh"]),
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
router.push("/users", { scrollToTop: true });
|
|
134
|
+
router.replace("/settings");
|
|
135
|
+
expect(calls).toEqual([["push", "/en/admin/users", { scrollToTop: true }]]);
|
|
136
|
+
timeoutCallbacks.splice(0).forEach((callback) => {
|
|
137
|
+
callback();
|
|
138
|
+
});
|
|
139
|
+
expect(calls).toEqual([
|
|
140
|
+
["push", "/en/admin/users", { scrollToTop: true }],
|
|
141
|
+
["replace", "/en/admin/settings", undefined],
|
|
142
|
+
]);
|
|
143
|
+
router.back({ scrollToTop: false });
|
|
144
|
+
router.refresh();
|
|
145
|
+
expect(calls.at(-2)).toEqual(["back", { scrollToTop: false }]);
|
|
146
|
+
expect(calls.at(-1)).toEqual(["refresh"]);
|
|
147
|
+
expect(messages[0]).toMatchObject({ type: "pathChange", path: "/users", pathname: "/en/admin/users" });
|
|
148
|
+
expect(router.getPath("/en/admin/current")).toBe("/current");
|
|
149
|
+
expect(router.getFullPath()).toBe("/en/admin/current");
|
|
150
|
+
expect(router.getPrefixedPath("/next")).toBe("/en/admin/next");
|
|
151
|
+
|
|
152
|
+
router.setLang("ko");
|
|
153
|
+
timeoutCallbacks.splice(0).forEach((callback) => {
|
|
154
|
+
callback();
|
|
155
|
+
});
|
|
156
|
+
expect(calls.at(-1)).toEqual(["replace", "/ko/admin/current", undefined]);
|
|
157
|
+
globalThis.setTimeout = originalSetTimeout;
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test("csr navigation preserves csr runtime search params", async () => {
|
|
161
|
+
envState.side = "client";
|
|
162
|
+
installClientWindow("/en/admin/current", "?csr=true&akanMobileTarget=default&akanMobileBasePath=admin");
|
|
163
|
+
const originalSetTimeout = globalThis.setTimeout;
|
|
164
|
+
const mockSetTimeout = ((handler: TimerHandler) => {
|
|
165
|
+
timeoutCallbacks.push(() => {
|
|
166
|
+
if (typeof handler === "function") handler();
|
|
167
|
+
});
|
|
168
|
+
return timeoutCallbacks.length as unknown as ReturnType<typeof setTimeout>;
|
|
169
|
+
}) as unknown as typeof setTimeout;
|
|
170
|
+
globalThis.setTimeout = mockSetTimeout;
|
|
171
|
+
const calls: unknown[] = [];
|
|
172
|
+
const { router } = await import("./router");
|
|
173
|
+
|
|
174
|
+
router.init({
|
|
175
|
+
type: "csr",
|
|
176
|
+
lang: "en",
|
|
177
|
+
prefix: "admin",
|
|
178
|
+
router: {
|
|
179
|
+
push: (href, options) => calls.push(["push", href, options]),
|
|
180
|
+
replace: (href, options) => calls.push(["replace", href, options]),
|
|
181
|
+
back: (options) => calls.push(["back", options]),
|
|
182
|
+
refresh: () => calls.push(["refresh"]),
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
router.push("/users?tab=a#bio");
|
|
187
|
+
router.replace("/settings?csr=false");
|
|
188
|
+
timeoutCallbacks.splice(0).forEach((callback) => {
|
|
189
|
+
callback();
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
expect(calls).toEqual([
|
|
193
|
+
["push", "/en/admin/users?tab=a&csr=true&akanMobileTarget=default&akanMobileBasePath=admin#bio", undefined],
|
|
194
|
+
["replace", "/en/admin/settings?csr=false&akanMobileTarget=default&akanMobileBasePath=admin", undefined],
|
|
195
|
+
]);
|
|
196
|
+
globalThis.setTimeout = originalSetTimeout;
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("ssr client navigation hides base path outside local mode", async () => {
|
|
200
|
+
envState.side = "client";
|
|
201
|
+
envState.operationMode = "main";
|
|
202
|
+
installClientWindow("/en/current");
|
|
203
|
+
const calls: unknown[] = [];
|
|
204
|
+
const { router } = await import("./router");
|
|
205
|
+
|
|
206
|
+
router.init({
|
|
207
|
+
type: "ssr",
|
|
208
|
+
side: "client",
|
|
209
|
+
lang: "en",
|
|
210
|
+
prefix: "admin",
|
|
211
|
+
router: {
|
|
212
|
+
push: (href, options) => calls.push(["push", href, options]),
|
|
213
|
+
replace: (href, options) => calls.push(["replace", href, options]),
|
|
214
|
+
back: (options) => calls.push(["back", options]),
|
|
215
|
+
refresh: () => calls.push(["refresh"]),
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
router.push("/", { scrollToTop: true });
|
|
220
|
+
router.replace("/users?tab=a#bio");
|
|
221
|
+
|
|
222
|
+
expect(calls).toEqual([
|
|
223
|
+
["push", "/en", { scrollToTop: true }],
|
|
224
|
+
["replace", "/en/users?tab=a#bio", undefined],
|
|
225
|
+
]);
|
|
226
|
+
expect(messages[0]).toMatchObject({ type: "pathChange", path: "/", pathname: "/en/admin" });
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test("ssr setLang preserves production public paths while switching locale", async () => {
|
|
230
|
+
envState.side = "client";
|
|
231
|
+
envState.operationMode = "main";
|
|
232
|
+
installClientWindow("/ko/docs/intro/fundamentals", "?from=nav", "#section");
|
|
233
|
+
const calls: unknown[] = [];
|
|
234
|
+
const { router } = await import("./router");
|
|
235
|
+
|
|
236
|
+
router.init({
|
|
237
|
+
type: "ssr",
|
|
238
|
+
side: "client",
|
|
239
|
+
lang: "en",
|
|
240
|
+
prefix: "akanjs",
|
|
241
|
+
router: {
|
|
242
|
+
push: (href, options) => calls.push(["push", href, options]),
|
|
243
|
+
replace: (href, options) => calls.push(["replace", href, options]),
|
|
244
|
+
back: (options) => calls.push(["back", options]),
|
|
245
|
+
refresh: () => calls.push(["refresh"]),
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
router.setLang("ko");
|
|
250
|
+
|
|
251
|
+
expect(calls).toEqual([["replace", "/ko/docs/intro/fundamentals?from=nav#section", undefined]]);
|
|
252
|
+
expect(messages[0]).toMatchObject({
|
|
253
|
+
type: "pathChange",
|
|
254
|
+
path: "/docs/intro/fundamentals",
|
|
255
|
+
pathname: "/ko/akanjs/docs/intro/fundamentals",
|
|
256
|
+
hash: "section",
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
test("throws initialized guard before init and server redirect/notFound errors", async () => {
|
|
261
|
+
envState.side = "client";
|
|
262
|
+
installClientWindow();
|
|
263
|
+
const { AkanNotFoundError, AkanRedirectError, router } = await import("./router");
|
|
264
|
+
|
|
265
|
+
envState.side = "server";
|
|
266
|
+
process.env.AKAN_PUBLIC_BASE_PATHS = "admin,console";
|
|
267
|
+
requestState.request = new Request("https://example.test/en/admin/current");
|
|
268
|
+
requestState.headers = new Map([
|
|
269
|
+
["x-locale", "en"],
|
|
270
|
+
["x-base-path", "admin"],
|
|
271
|
+
]);
|
|
272
|
+
expect(() => router.redirect("/users?tab=a")).toThrow(AkanRedirectError);
|
|
273
|
+
try {
|
|
274
|
+
router.redirect("/users?tab=a");
|
|
275
|
+
} catch (error) {
|
|
276
|
+
expect(error).toBeInstanceOf(AkanRedirectError);
|
|
277
|
+
expect((error as Error & { location: string; method: string }).location).toBe("/en/admin/users?tab=a");
|
|
278
|
+
expect((error as Error & { method: string }).method).toBe("replace");
|
|
279
|
+
}
|
|
280
|
+
envState.operationMode = "main";
|
|
281
|
+
expect(() => router.redirect("/users?tab=a")).toThrow(AkanRedirectError);
|
|
282
|
+
try {
|
|
283
|
+
router.redirect("/users?tab=a");
|
|
284
|
+
} catch (error) {
|
|
285
|
+
expect(error).toBeInstanceOf(AkanRedirectError);
|
|
286
|
+
expect((error as Error & { location: string; method: string }).location).toBe("/en/users?tab=a");
|
|
287
|
+
}
|
|
288
|
+
expect(() => router.notFound()).toThrow(AkanNotFoundError);
|
|
289
|
+
});
|
|
290
|
+
});
|
package/client/cookie.ts
CHANGED
|
@@ -49,7 +49,7 @@ export const setCookie = (
|
|
|
49
49
|
const path = options.path ? `; path=${options.path}` : "";
|
|
50
50
|
const sameSite = options.sameSite ? `; SameSite=${options.sameSite}` : "";
|
|
51
51
|
const secure = options.secure ? "; Secure" : "";
|
|
52
|
-
|
|
52
|
+
// biome-ignore lint/suspicious/noDocumentCookie: Akan auth helpers intentionally manage browser cookies.
|
|
53
53
|
document.cookie = `${encoded}${path}${sameSite}${secure}`;
|
|
54
54
|
if (env.renderMode !== "csr") return;
|
|
55
55
|
void loadCapacitorCore()
|
|
@@ -59,6 +59,7 @@ export const setCookie = (
|
|
|
59
59
|
|
|
60
60
|
export const getCookie = (key: string): string | undefined => {
|
|
61
61
|
if (getEnv().side === "server") return cookies().get(key)?.value;
|
|
62
|
+
//capacitor 문서에서 document.cookie로 가져오라고 되어었음.
|
|
62
63
|
else
|
|
63
64
|
return document.cookie
|
|
64
65
|
.split(";")
|
|
@@ -69,8 +70,9 @@ export const getCookie = (key: string): string | undefined => {
|
|
|
69
70
|
export const removeCookie = (key: string, options: { path: string } = { path: "/" }) => {
|
|
70
71
|
if (getEnv().side === "server") return cookies().delete(key);
|
|
71
72
|
else {
|
|
72
|
-
|
|
73
|
+
// biome-ignore lint/suspicious/noDocumentCookie: Akan auth helpers intentionally manage browser cookies.
|
|
73
74
|
document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
|
|
75
|
+
// void CapacitorCookies.deleteCookie({ key });
|
|
74
76
|
}
|
|
75
77
|
};
|
|
76
78
|
export const headers = (): Map<string, string> => {
|
package/client/createFont.ts
CHANGED
package/client/csrTypes.ts
CHANGED
|
@@ -133,10 +133,16 @@ export interface Route {
|
|
|
133
133
|
renderLayout?: RouteRender;
|
|
134
134
|
pageIncludesOwnLayout?: boolean;
|
|
135
135
|
isSpecialRoute?: boolean;
|
|
136
|
-
|
|
136
|
+
// Page?:
|
|
137
|
+
// | (({ params, searchParams }: PageProps) => ReactNode)
|
|
138
|
+
// | (({ params, searchParams }: PageProps) => Promise<ReactNode>);
|
|
139
|
+
// Layout?:
|
|
140
|
+
// | (({ children, params, searchParams }: LayoutProps) => ReactNode)
|
|
141
|
+
// | (({ children, params, searchParams }: LayoutProps) => Promise<ReactNode>);
|
|
137
142
|
loader?: () => any;
|
|
138
143
|
pageState?: PageState;
|
|
139
|
-
|
|
144
|
+
// action?: any;
|
|
145
|
+
// ErrorBoundary?: any;
|
|
140
146
|
children: Map<string, Route>;
|
|
141
147
|
}
|
|
142
148
|
|
package/client/makePageProto.tsx
CHANGED
|
@@ -26,13 +26,17 @@ const getPageInfo = (): { locale: string; path: string } => {
|
|
|
26
26
|
if (getEnv().side !== "server") {
|
|
27
27
|
const [, firstSegment = "", ...rest] = window.location.pathname.split("/");
|
|
28
28
|
const hasLocalePrefix = localeSet.has(firstSegment);
|
|
29
|
-
|
|
29
|
+
// Prefer the server-resolved active locale (seeded via ClientWrapper) so client lookups match the
|
|
30
|
+
// SSR render even when the URL's leading segment is not the locale (base-path / cloud routing).
|
|
31
|
+
// Fall back to the URL segment for CSR or any pre-seed render.
|
|
30
32
|
const activeLocale = Translator.getActiveLocale();
|
|
31
33
|
const locale = activeLocale ?? (hasLocalePrefix ? firstSegment : defaultLocale);
|
|
32
34
|
return { locale, path: hasLocalePrefix ? `/${rest.join("/")}` : window.location.pathname };
|
|
33
35
|
}
|
|
34
36
|
const h = headers();
|
|
35
|
-
|
|
37
|
+
// Honor explicit proxy/middleware headers when present; otherwise derive
|
|
38
|
+
// locale+path from the request URL itself so unadorned dev requests (e.g.
|
|
39
|
+
// `curl /en/hello`) still work.
|
|
36
40
|
const localeHeader = h.get("x-locale");
|
|
37
41
|
const pathHeader = h.get("x-path");
|
|
38
42
|
if (localeHeader && pathHeader) return { locale: localeHeader, path: pathHeader };
|
|
@@ -158,11 +162,13 @@ export const makePageProto = <
|
|
|
158
162
|
l.rich = (key: DictKey, param?: { [key: string]: string | number }) =>
|
|
159
163
|
(
|
|
160
164
|
<span
|
|
161
|
-
|
|
165
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: <a>an explanation</a>
|
|
162
166
|
dangerouslySetInnerHTML={{
|
|
163
167
|
__html: translator.translate(lang, key, {
|
|
164
168
|
...param,
|
|
165
|
-
|
|
169
|
+
// strong: (chunks: string) => `<b>${chunks}</b>`,
|
|
170
|
+
// "bg-primary": (chunks: string) => `<span className="bg-primary text-base-100">${chunks}</span>`,
|
|
171
|
+
// primary: (chunks: string) => `<span className="bg-base-100 text-primary">${chunks}</span>`,
|
|
166
172
|
br: `<br />`,
|
|
167
173
|
}),
|
|
168
174
|
}}
|
package/client/router.ts
CHANGED
|
@@ -110,10 +110,14 @@ class Router {
|
|
|
110
110
|
push: (href: string) => {
|
|
111
111
|
const { href: fullHref } = this.#getPathInfo(href);
|
|
112
112
|
Logger.log(`push to:${fullHref}`);
|
|
113
|
+
// ! need to revive
|
|
114
|
+
// if (getEnv().side === "server") void redirect(fullHref);
|
|
113
115
|
},
|
|
114
116
|
replace: (href: string) => {
|
|
115
117
|
const { pathname } = this.#getPathInfo(href);
|
|
116
118
|
Logger.log(`replace to:${pathname}`);
|
|
119
|
+
// ! need to revive
|
|
120
|
+
// if (getEnv().side === "server") void redirect(fullHref);
|
|
117
121
|
},
|
|
118
122
|
back: () => {
|
|
119
123
|
throw new Error("back is only available in client");
|
|
@@ -123,7 +127,7 @@ class Router {
|
|
|
123
127
|
},
|
|
124
128
|
};
|
|
125
129
|
init(options: SsrClientRouterOption | SsrServerRouterOption | CSRClientRouterOption) {
|
|
126
|
-
|
|
130
|
+
// if (this.isInitialized) throw new Error("Router is already initialized");
|
|
127
131
|
this.#prefix = options.prefix ?? "";
|
|
128
132
|
this.#lang = options.lang ?? parseAkanI18nEnv().defaultLocale;
|
|
129
133
|
if (options.type === "csr") this.#initCsrClientRouter(options);
|
|
@@ -133,6 +137,7 @@ class Router {
|
|
|
133
137
|
Logger.verbose("Router initialized");
|
|
134
138
|
}
|
|
135
139
|
#initSsrServerRouter(options: SsrServerRouterOption) {
|
|
140
|
+
// already initialized in next server
|
|
136
141
|
}
|
|
137
142
|
#initSsrClientRouter(options: SsrClientRouterOption) {
|
|
138
143
|
this.#instance = {
|
|
@@ -174,7 +179,7 @@ class Router {
|
|
|
174
179
|
replace: (href: string, routeOptions) => {
|
|
175
180
|
const { path, pathname, hash, href: fullHref } = this.#getPathInfo(href);
|
|
176
181
|
this.#postPathChange({ path, pathname, hash });
|
|
177
|
-
|
|
182
|
+
// for avoiding set state while rendering in redirect
|
|
178
183
|
setTimeout(() => {
|
|
179
184
|
options.router.replace(this.#withCsrRuntimeSearchParams(fullHref), routeOptions);
|
|
180
185
|
}, 0);
|
|
@@ -235,7 +240,7 @@ class Router {
|
|
|
235
240
|
}
|
|
236
241
|
back(routeOptions?: RouteOptions) {
|
|
237
242
|
if (getEnv().side === "server") throw new Error("back is only available in client side");
|
|
238
|
-
|
|
243
|
+
// history보고 뒤로갈지 끌지 정하던가 먹통하던가
|
|
239
244
|
this.#checkInitialized();
|
|
240
245
|
this.#instance.back(routeOptions);
|
|
241
246
|
return undefined as never;
|
package/client/translator.ts
CHANGED
|
@@ -11,9 +11,15 @@ export interface AllDictionary {
|
|
|
11
11
|
|
|
12
12
|
export class Translator {
|
|
13
13
|
static #langDictionaryMap = new Map<string, Dictionary>();
|
|
14
|
-
|
|
14
|
+
// Tracks dictionary objects already merged into the static map. The seeded
|
|
15
|
+
// snapshot (`allDictionary[lang]`) is a stable module-level reference within a
|
|
16
|
+
// build, so repeat requests skip the merge entirely. A dev rebuild produces a
|
|
17
|
+
// new object reference, which re-seeds and keeps hot reload correct.
|
|
15
18
|
static #seededDicts = new WeakSet<object>();
|
|
16
|
-
|
|
19
|
+
// Browser-only source of truth for the active locale. Set by ClientWrapper from the server-resolved
|
|
20
|
+
// `lang` (Flight prop) so client lookups use the same locale that was seeded and server-rendered,
|
|
21
|
+
// instead of re-deriving it from the URL (unreliable for base-path / cloud routing). Unsafe on the
|
|
22
|
+
// server (concurrent requests share the module), so it must only be set when `typeof window !== undefined`.
|
|
17
23
|
static #activeLocale: string | undefined;
|
|
18
24
|
static setActiveLocale(lang: string | undefined) {
|
|
19
25
|
if (lang) Translator.#activeLocale = lang;
|
|
@@ -29,10 +35,12 @@ export class Translator {
|
|
|
29
35
|
hasDictionary(lang: string) {
|
|
30
36
|
return Translator.#langDictionaryMap.has(lang);
|
|
31
37
|
}
|
|
32
|
-
|
|
38
|
+
// Synchronously merge a single locale's dictionary into the shared static map.
|
|
39
|
+
// Idempotent: re-seeding the same locale merges keys without dropping existing ones.
|
|
40
|
+
// Used by ClientWrapper to seed the active locale from the server-provided prop.
|
|
33
41
|
static seed(lang: string, dict: Dictionary | undefined) {
|
|
34
42
|
if (!dict) return;
|
|
35
|
-
|
|
43
|
+
// Skip the merge when this exact dictionary snapshot was already seeded.
|
|
36
44
|
if (Translator.#seededDicts.has(dict)) return;
|
|
37
45
|
Translator.#seededDicts.add(dict);
|
|
38
46
|
const existingDictionary = Translator.#langDictionaryMap.get(lang) ?? {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { Logger, type LoggerSinkEntry } from "./Logger";
|
|
3
|
+
|
|
4
|
+
const resetLoggerLevels = () => {
|
|
5
|
+
Logger.setLevel("log");
|
|
6
|
+
Logger.setFileLevel("trace");
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
describe("Logger sinks", () => {
|
|
10
|
+
test("emits file sink entries independently from terminal log level", () => {
|
|
11
|
+
const entries: LoggerSinkEntry[] = [];
|
|
12
|
+
const removeSink = Logger.addSink((entry) => entries.push(entry));
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
Logger.setLevel("error");
|
|
16
|
+
Logger.setFileLevel("trace");
|
|
17
|
+
Logger.trace("file only", "sink-test", "LoggerTest");
|
|
18
|
+
|
|
19
|
+
expect(entries.length).toBe(1);
|
|
20
|
+
expect(entries[0]?.level).toBe("trace");
|
|
21
|
+
expect(entries[0]?.plainMessage.includes("file only")).toBe(true);
|
|
22
|
+
} finally {
|
|
23
|
+
removeSink();
|
|
24
|
+
resetLoggerLevels();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("filters sink entries with AKAN_LOG_FILE_LEVEL semantics", () => {
|
|
29
|
+
const entries: LoggerSinkEntry[] = [];
|
|
30
|
+
const removeSink = Logger.addSink((entry) => entries.push(entry));
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
Logger.setLevel("error");
|
|
34
|
+
Logger.setFileLevel("warn");
|
|
35
|
+
Logger.info("skip file", "sink-test", "LoggerTest");
|
|
36
|
+
Logger.warn("keep file", "sink-test", "LoggerTest");
|
|
37
|
+
|
|
38
|
+
expect(entries.map((entry) => entry.level)).toEqual(["warn"]);
|
|
39
|
+
expect(entries[0]?.plainMessage.includes("keep file")).toBe(true);
|
|
40
|
+
} finally {
|
|
41
|
+
removeSink();
|
|
42
|
+
resetLoggerLevels();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
package/common/Logger.ts
CHANGED
|
@@ -92,7 +92,7 @@ export class Logger {
|
|
|
92
92
|
rawLog(msg: string, method?: "console" | "process") {
|
|
93
93
|
Logger.rawLog(msg, method);
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
// biome-ignore lint/suspicious/useAdjacentOverloadSignatures: static logger API mirrors the instance API.
|
|
96
96
|
static trace(msg: string, context = "", name = "App") {
|
|
97
97
|
if (Logger.#shouldLog("trace")) Logger.#printMessages(name, msg, context, "trace");
|
|
98
98
|
}
|
|
@@ -134,6 +134,7 @@ export class Logger {
|
|
|
134
134
|
try {
|
|
135
135
|
void Promise.resolve(sink(entry)).catch(() => undefined);
|
|
136
136
|
} catch {
|
|
137
|
+
// Log sinks are observers; they must not break application logging.
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
}
|
|
@@ -162,6 +163,7 @@ export class Logger {
|
|
|
162
163
|
if (!Logger.#shouldWriteConsole(logLevel)) return;
|
|
163
164
|
if (typeof window === "undefined")
|
|
164
165
|
(process[writeStreamType] as unknown as NodeJS.WriteStream | undefined)?.write(message);
|
|
166
|
+
// biome-ignore lint/suspicious/noConsole: browser fallback
|
|
165
167
|
else console.log(message);
|
|
166
168
|
}
|
|
167
169
|
static rawLog(msg = "", method?: "console" | "process", outputStream?: "log" | "error") {
|
|
@@ -172,6 +174,7 @@ export class Logger {
|
|
|
172
174
|
Logger.#emit({ stream, message: msg, plainMessage: Logger.#stripAnsi(msg) });
|
|
173
175
|
if (typeof window === "undefined" && method !== "console" && (process as unknown as NodeJS.Process | undefined))
|
|
174
176
|
process[stream].write(msg);
|
|
177
|
+
// biome-ignore lint/suspicious/noConsole: browser fallback
|
|
175
178
|
else console[outputStream === "error" ? "error" : "log"](msg.trim());
|
|
176
179
|
}
|
|
177
180
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
capitalize,
|
|
5
|
+
formatNumber,
|
|
6
|
+
formatPhone,
|
|
7
|
+
isEmail,
|
|
8
|
+
isPhoneNumber,
|
|
9
|
+
isValidDate,
|
|
10
|
+
lowerlize,
|
|
11
|
+
mergeVersion,
|
|
12
|
+
splitVersion,
|
|
13
|
+
} from ".";
|
|
14
|
+
|
|
15
|
+
describe("format and validation helpers", () => {
|
|
16
|
+
test("capitalizes and lowerlizes only the first character", () => {
|
|
17
|
+
expect(capitalize("akan")).toBe("Akan");
|
|
18
|
+
expect(capitalize("aKan")).toBe("AKan");
|
|
19
|
+
expect(lowerlize("Akan")).toBe("akan");
|
|
20
|
+
expect(lowerlize("AKan")).toBe("aKan");
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("formats numbers while preserving decimal text", () => {
|
|
24
|
+
expect(formatNumber("1234567")).toBe("1,234,567");
|
|
25
|
+
expect(formatNumber("1,234,567.89")).toBe("1,234,567.89");
|
|
26
|
+
expect(formatNumber("12abc34")).toBe("1,234");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("formats supported phone number lengths", () => {
|
|
30
|
+
expect(formatPhone("0101234567")).toBe("010-123-4567");
|
|
31
|
+
expect(formatPhone("010-1234-5678")).toBe("010-1234-5678");
|
|
32
|
+
expect(formatPhone("0212345678")).toBe("021-234-5678");
|
|
33
|
+
expect(formatPhone("12345")).toBe("12345");
|
|
34
|
+
expect(formatPhone("")).toBe("");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test("validates email and phone strings", () => {
|
|
38
|
+
expect(isEmail("user@example.com")).toBe(true);
|
|
39
|
+
expect(isEmail("user.name@example.co.kr")).toBe(true);
|
|
40
|
+
expect(isEmail("not-an-email")).toBe(false);
|
|
41
|
+
expect(isEmail(null)).toBe(false);
|
|
42
|
+
|
|
43
|
+
expect(isPhoneNumber("010-1234-5678")).toBe(true);
|
|
44
|
+
expect(isPhoneNumber("031-123-4567")).toBe(true);
|
|
45
|
+
expect(isPhoneNumber("01012345678")).toBe(false);
|
|
46
|
+
expect(isPhoneNumber(undefined)).toBe(false);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("validates dates from strings and Date instances", () => {
|
|
50
|
+
expect(isValidDate("2025-01-01")).toBe(true);
|
|
51
|
+
expect(isValidDate("not-a-date")).toBe(false);
|
|
52
|
+
expect(isValidDate(new Date("2025-01-01T00:00:00.000Z"))).toBe(true);
|
|
53
|
+
expect(isValidDate(new Date("not-a-date"))).toBe(false);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("splits and merges semantic version parts", () => {
|
|
57
|
+
expect(splitVersion("1.2.3")).toEqual({ major: "1", minor: "2", patch: "3" });
|
|
58
|
+
expect(mergeVersion(1, 2, 3)).toBe("1.2.3");
|
|
59
|
+
expect(() => splitVersion("1.2")).toThrow("Invalid version");
|
|
60
|
+
});
|
|
61
|
+
});
|
package/common/formatNumber.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
export const formatNumber = (numString: string) => {
|
|
2
|
-
|
|
2
|
+
// 문자열이 아니면 문자열로 변환
|
|
3
3
|
if (typeof numString !== "string") {
|
|
4
4
|
numString = String(numString);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
// 소수점이 있는 경우 처리
|
|
7
8
|
const parts = numString.split(".");
|
|
8
|
-
const integerPart = parts[0]?.replace(/[^\d]/g, "") ?? "";
|
|
9
|
+
const integerPart = parts[0]?.replace(/[^\d]/g, "") ?? ""; // 정수 부분에서 숫자만 추출
|
|
9
10
|
const decimalPart = parts.length > 1 ? `.${parts[1]}` : "";
|
|
10
11
|
|
|
12
|
+
// 정수 부분에 콤마 추가
|
|
11
13
|
const formattedInteger = Number(integerPart).toLocaleString("ko-KR");
|
|
12
14
|
|
|
15
|
+
// 정수 부분과 소수 부분 합치기
|
|
13
16
|
return formattedInteger + decimalPart;
|
|
14
17
|
};
|
package/common/hmrPhase.ts
CHANGED