akanjs 2.2.4-rc.5 → 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 +2 -2
- 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,93 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { DEFAULT_AKAN_I18N } from "akanjs/common";
|
|
3
|
+
import {
|
|
4
|
+
createSystemPageFallbackText,
|
|
5
|
+
createSystemPageHeaders,
|
|
6
|
+
createSystemPageResponse,
|
|
7
|
+
getSystemPageHomeHref,
|
|
8
|
+
} from "./systemPages";
|
|
9
|
+
|
|
10
|
+
describe("system pages", () => {
|
|
11
|
+
test("renders a pretty not-found page with no-store headers", async () => {
|
|
12
|
+
const response = await createSystemPageResponse({
|
|
13
|
+
kind: "not-found",
|
|
14
|
+
pathname: "/ko/akanjs/missing",
|
|
15
|
+
homeHref: "/ko/akanjs",
|
|
16
|
+
lang: "ko",
|
|
17
|
+
stylesheetHref: "/_akan/styles/akanjs.css",
|
|
18
|
+
});
|
|
19
|
+
const html = await response.text();
|
|
20
|
+
|
|
21
|
+
expect(response.status).toBe(404);
|
|
22
|
+
expect(response.headers.get("Content-Type")).toBe("text/html; charset=utf-8");
|
|
23
|
+
expect(response.headers.get("Cache-Control")).toBe("no-store");
|
|
24
|
+
expect(html).toContain("Page not found");
|
|
25
|
+
expect(html).toContain("This page is off the flight path.");
|
|
26
|
+
expect(html).toContain("/ko/akanjs/missing");
|
|
27
|
+
expect(html).toContain('href="/ko/akanjs"');
|
|
28
|
+
expect(html).toContain('href="/_akan/styles/akanjs.css"');
|
|
29
|
+
expect(html).toContain('name="robots"');
|
|
30
|
+
expect(html).toContain("noindex");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("keeps server error details dev-only", async () => {
|
|
34
|
+
const error = new Error("database password leaked in stack");
|
|
35
|
+
const productionResponse = await createSystemPageResponse({
|
|
36
|
+
kind: "error",
|
|
37
|
+
pathname: "/en/broken",
|
|
38
|
+
homeHref: "/en",
|
|
39
|
+
showDetails: false,
|
|
40
|
+
error,
|
|
41
|
+
});
|
|
42
|
+
const devResponse = await createSystemPageResponse({
|
|
43
|
+
kind: "error",
|
|
44
|
+
pathname: "/en/broken",
|
|
45
|
+
homeHref: "/en",
|
|
46
|
+
showDetails: true,
|
|
47
|
+
error,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
expect(productionResponse.status).toBe(500);
|
|
51
|
+
expect(await productionResponse.text()).not.toContain("database password leaked in stack");
|
|
52
|
+
expect(await devResponse.text()).toContain("database password leaked in stack");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("returns HEAD metadata without a body", async () => {
|
|
56
|
+
const response = await createSystemPageResponse({
|
|
57
|
+
kind: "not-found",
|
|
58
|
+
method: "HEAD",
|
|
59
|
+
pathname: "/en/missing",
|
|
60
|
+
homeHref: "/en",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
expect(response.status).toBe(404);
|
|
64
|
+
expect(response.headers.get("Cache-Control")).toBe("no-store");
|
|
65
|
+
expect(await response.text()).toBe("");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("builds locale and base-path aware home links", () => {
|
|
69
|
+
expect(
|
|
70
|
+
getSystemPageHomeHref({
|
|
71
|
+
pathname: "/ko/akanjs/docs/missing",
|
|
72
|
+
i18n: DEFAULT_AKAN_I18N,
|
|
73
|
+
basePaths: ["akanjs", "soft"],
|
|
74
|
+
}),
|
|
75
|
+
).toBe("/ko/akanjs");
|
|
76
|
+
expect(
|
|
77
|
+
getSystemPageHomeHref({
|
|
78
|
+
pathname: "/unknown/missing",
|
|
79
|
+
i18n: DEFAULT_AKAN_I18N,
|
|
80
|
+
basePaths: ["akanjs", "soft"],
|
|
81
|
+
headerBasePath: "soft",
|
|
82
|
+
}),
|
|
83
|
+
).toBe("/en/soft");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("provides final fallback text and no-store headers", () => {
|
|
87
|
+
const headers = createSystemPageHeaders();
|
|
88
|
+
|
|
89
|
+
expect(createSystemPageFallbackText("error")).toBe("500 Server error");
|
|
90
|
+
expect(headers.get("Content-Type")).toBe("text/html; charset=utf-8");
|
|
91
|
+
expect(headers.get("Cache-Control")).toBe("no-store");
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// Minimal ambient declarations for the `react-server-dom-webpack` subpaths we
|
|
2
|
+
// use. The upstream package ships runtime code only; no types are published.
|
|
3
|
+
// We only declare the surface our SSR/RSC pipeline actually touches.
|
|
4
|
+
//
|
|
5
|
+
// This file is intentionally a top-level ambient declaration (no `import`/
|
|
6
|
+
// `export` at file scope) so that TypeScript registers the module names below
|
|
7
|
+
// globally.
|
|
2
8
|
|
|
3
9
|
declare module "react-server-dom-webpack/server.node" {
|
|
4
10
|
export interface ClientReferenceManifestEntry {
|
package/server/vendor/react.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// @ts-nocheck — `@types/react` declares its module via `export =`, which TS
|
|
2
|
+
// refuses to combine with wildcard re-export forms. At bundle time Bun sees
|
|
3
|
+
// the JS module (CJS) which does expose these named properties.
|
|
4
|
+
//
|
|
5
|
+
// We enumerate exports explicitly because Bun's `export * from "<cjs>"` only
|
|
6
|
+
// emits an internal `__reExport` object and never generates top-level ESM
|
|
7
|
+
// named bindings — so downstream chunks that `import { useState } from
|
|
8
|
+
// "react"` would silently get `undefined`. See the importmap dedup story
|
|
9
|
+
// in `vendorSpecifiers.ts` for the rationale behind these entries.
|
|
3
10
|
import * as m from "react";
|
|
4
11
|
|
|
5
12
|
export default m;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { DEFAULT_AKAN_I18N } from "akanjs/common";
|
|
3
|
+
import { normalizeRscTargetUrlForHostBasePath } from "./webRouter";
|
|
4
|
+
|
|
5
|
+
describe("WebRouter RSC target normalization", () => {
|
|
6
|
+
test("maps public host paths to the hidden basePath route for RSC navigation", () => {
|
|
7
|
+
const target = new URL("https://akanjs.com/en/docs/intro/quickstart");
|
|
8
|
+
|
|
9
|
+
const normalized = normalizeRscTargetUrlForHostBasePath(target, {
|
|
10
|
+
basePath: "akanjs",
|
|
11
|
+
i18n: DEFAULT_AKAN_I18N,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
expect(normalized.url.href).toBe("https://akanjs.com/en/akanjs/docs/intro/quickstart");
|
|
15
|
+
expect(normalized.basePath).toBe("akanjs");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("maps debug public paths by matching configured basePath route seeds", () => {
|
|
19
|
+
const target = new URL("https://akanjs-debug.akanjs.com/en/references/cli/overview");
|
|
20
|
+
|
|
21
|
+
const normalized = normalizeRscTargetUrlForHostBasePath(target, {
|
|
22
|
+
basePath: null,
|
|
23
|
+
basePaths: ["office", "akanjs", "soft"],
|
|
24
|
+
i18n: DEFAULT_AKAN_I18N,
|
|
25
|
+
seedEntries: [
|
|
26
|
+
{
|
|
27
|
+
routeId: "/:lang/akanjs/references/cli/overview",
|
|
28
|
+
pattern: "/:lang/akanjs/references/cli/overview",
|
|
29
|
+
seeds: [],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
expect(normalized.url.href).toBe("https://akanjs-debug.akanjs.com/en/akanjs/references/cli/overview");
|
|
35
|
+
expect(normalized.basePath).toBe("akanjs");
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("does not duplicate an already internal basePath route", () => {
|
|
39
|
+
const target = new URL("https://akanjs.com/en/akanjs/docs/intro/quickstart");
|
|
40
|
+
|
|
41
|
+
const normalized = normalizeRscTargetUrlForHostBasePath(target, {
|
|
42
|
+
basePath: "akanjs",
|
|
43
|
+
i18n: DEFAULT_AKAN_I18N,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
expect(normalized.url.href).toBe("https://akanjs.com/en/akanjs/docs/intro/quickstart");
|
|
47
|
+
expect(normalized.basePath).toBe("akanjs");
|
|
48
|
+
});
|
|
49
|
+
});
|
package/server/webRouter.ts
CHANGED
|
@@ -437,11 +437,12 @@ export class WebRouter {
|
|
|
437
437
|
const fwdProto = req.headers.get("x-forwarded-proto")?.split(",")[0]?.trim();
|
|
438
438
|
const fwdHost = req.headers.get("x-forwarded-host")?.split(",")[0]?.trim();
|
|
439
439
|
const hostFallback = fwdHost ?? req.headers.get("host");
|
|
440
|
-
const protoFallback = fwdProto ?? parsed.protocol.slice(0, -1);
|
|
440
|
+
const protoFallback = fwdProto ?? parsed.protocol.slice(0, -1); // strip trailing ':'
|
|
441
441
|
if (hostFallback && protoFallback) {
|
|
442
442
|
try {
|
|
443
443
|
return new URL(`${protoFallback}://${hostFallback}`).origin;
|
|
444
444
|
} catch {
|
|
445
|
+
/* fallthrough */
|
|
445
446
|
}
|
|
446
447
|
}
|
|
447
448
|
return parsed.origin;
|
|
@@ -461,7 +462,7 @@ export class WebRouter {
|
|
|
461
462
|
static #isTrustedRscTarget(clientOrigin: string, targetUrl: URL): boolean {
|
|
462
463
|
try {
|
|
463
464
|
if (targetUrl.origin === clientOrigin) return true;
|
|
464
|
-
|
|
465
|
+
// TLS termination + missing/partial forwarded headers may skew scheme while hostname matches the public host.
|
|
465
466
|
return targetUrl.hostname === new URL(clientOrigin).hostname;
|
|
466
467
|
} catch {
|
|
467
468
|
return false;
|
package/service/adapt.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface Adaptor {
|
|
|
10
10
|
|
|
11
11
|
export type AdaptorCls<
|
|
12
12
|
Methods = any,
|
|
13
|
-
|
|
13
|
+
// biome-ignore lint/complexity/noBannedTypes: `{}` keeps un-injected adaptor classes assignable.
|
|
14
14
|
InjectMap extends Record<string, InjectInfo> = {},
|
|
15
15
|
> = Cls<
|
|
16
16
|
Methods & ExtractInjectInfoObject<InjectMap> & Adaptor,
|
|
@@ -22,6 +22,7 @@ export function adapt<Name extends string>(name: Name): AdaptorCls;
|
|
|
22
22
|
export function adapt<Name extends string, Injection extends InjectBuilder<"use" | "env" | "memory" | "plug">>(
|
|
23
23
|
name: Name,
|
|
24
24
|
injectBuilder: Injection,
|
|
25
|
+
// biome-ignore lint/complexity/noBannedTypes: `{}` preserves adaptor method inference for generated class types.
|
|
25
26
|
): AdaptorCls<{}, ReturnType<Injection>>;
|
|
26
27
|
|
|
27
28
|
export function adapt(name: string, injectBuilder?: InjectBuilder) {
|
|
@@ -31,8 +32,10 @@ export function adapt(name: string, injectBuilder?: InjectBuilder) {
|
|
|
31
32
|
static readonly [INJECT_META] = injectInfoMap;
|
|
32
33
|
static readonly refName = name;
|
|
33
34
|
async onInit() {
|
|
35
|
+
//
|
|
34
36
|
}
|
|
35
37
|
async onDestroy() {
|
|
38
|
+
//
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
return Adaptor;
|
|
@@ -41,6 +44,7 @@ export function adapt(name: string, injectBuilder?: InjectBuilder) {
|
|
|
41
44
|
export function dangerouslyAdapt<Name extends string, Injection extends InjectBuilder>(
|
|
42
45
|
name: Name,
|
|
43
46
|
injectBuilder: Injection,
|
|
47
|
+
// biome-ignore lint/complexity/noBannedTypes: `{}` preserves adaptor method inference for generated class types.
|
|
44
48
|
): AdaptorCls<{}, ReturnType<Injection>>;
|
|
45
49
|
export function dangerouslyAdapt(name: string, injectBuilder?: InjectBuilder) {
|
|
46
50
|
return adapt(name, injectBuilder as InjectBuilder<"use" | "env" | "memory" | "plug">);
|
|
@@ -35,7 +35,8 @@ export class RedisCache
|
|
|
35
35
|
operationMode,
|
|
36
36
|
repoName,
|
|
37
37
|
redis = {
|
|
38
|
-
|
|
38
|
+
// username, // TODO: Implement username and password
|
|
39
|
+
// password, // TODO: Implement username and password
|
|
39
40
|
sshOptions: {
|
|
40
41
|
host: `${appName}-${environment}.${serveDomain}`,
|
|
41
42
|
port: 32767,
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { beforeAll, describe, expect, test } from "bun:test";
|
|
2
|
+
import { Any, dayjs, Float, Int, type PrimitiveScalar } from "akanjs/base";
|
|
3
|
+
import { ConstantRegistry, via } from "akanjs/constant";
|
|
4
|
+
import { ProtobufCompressor } from "./compress.adaptor";
|
|
5
|
+
|
|
6
|
+
const NestedScalar = via((f) => ({
|
|
7
|
+
label: f(String),
|
|
8
|
+
point: f(Int),
|
|
9
|
+
}));
|
|
10
|
+
ConstantRegistry.buildScalar("ServiceCompressNestedScalar", NestedScalar, { NestedScalar });
|
|
11
|
+
|
|
12
|
+
const TestScalar = via((f) => ({
|
|
13
|
+
name: f(String),
|
|
14
|
+
age: f(Int),
|
|
15
|
+
score: f(Float),
|
|
16
|
+
active: f(Boolean),
|
|
17
|
+
tags: f([String]),
|
|
18
|
+
nested: f(NestedScalar),
|
|
19
|
+
nestedList: f([NestedScalar]),
|
|
20
|
+
meta: f(Map, { of: String }),
|
|
21
|
+
nestedMap: f(Map, { of: NestedScalar as unknown as typeof PrimitiveScalar }),
|
|
22
|
+
}));
|
|
23
|
+
ConstantRegistry.buildScalar("ServiceCompressTestScalar", TestScalar, { TestScalar });
|
|
24
|
+
|
|
25
|
+
const Compressor = new ProtobufCompressor();
|
|
26
|
+
|
|
27
|
+
beforeAll(async () => {
|
|
28
|
+
await Compressor.onInit();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const expectBuffer = (buffer: Buffer | null) => {
|
|
32
|
+
expect(buffer).toBeInstanceOf(Buffer);
|
|
33
|
+
if (!buffer) throw new Error("Expected compressor to return a buffer");
|
|
34
|
+
return buffer;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
describe("Compressor", () => {
|
|
38
|
+
describe("encode/decode primitives (arrDepth=0)", () => {
|
|
39
|
+
test("String", () => {
|
|
40
|
+
const buf = expectBuffer(Compressor.encode(String, 0, "hello"));
|
|
41
|
+
const decoded = Compressor.decode<string>(String, 0, buf);
|
|
42
|
+
expect(decoded).toBe("hello");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("Int", () => {
|
|
46
|
+
const buf = expectBuffer(Compressor.encode(Int, 0, 42));
|
|
47
|
+
const decoded = Compressor.decode<number>(Int, 0, buf);
|
|
48
|
+
expect(decoded).toBe(42);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("Float", () => {
|
|
52
|
+
const buf = expectBuffer(Compressor.encode(Float, 0, 3.14));
|
|
53
|
+
const decoded = Compressor.decode<number>(Float, 0, buf);
|
|
54
|
+
expect(decoded).toBeCloseTo(3.14, 2);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test("Boolean", () => {
|
|
58
|
+
const buf = expectBuffer(Compressor.encode(Boolean, 0, true));
|
|
59
|
+
const decoded = Compressor.decode<boolean>(Boolean, 0, buf);
|
|
60
|
+
expect(decoded).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("Date", () => {
|
|
64
|
+
const now = dayjs("2025-01-01T00:00:00Z");
|
|
65
|
+
const buf = expectBuffer(Compressor.encode(Date, 0, now));
|
|
66
|
+
const decoded = Compressor.decode<Date>(Date, 0, buf);
|
|
67
|
+
expect(dayjs(decoded).toISOString()).toBe(now.toISOString());
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("Any (JSON object)", () => {
|
|
71
|
+
const obj = { key: "value", nested: { a: 1 } };
|
|
72
|
+
const buf = expectBuffer(Compressor.encode(Any, 0, obj));
|
|
73
|
+
const decoded = Compressor.decode(Any, 0, buf);
|
|
74
|
+
expect(decoded).toEqual(obj);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe("encode/decode array of primitives (arrDepth=1)", () => {
|
|
79
|
+
test("[String]", () => {
|
|
80
|
+
const values = ["hello", "world", "test"];
|
|
81
|
+
const buf = expectBuffer(Compressor.encode(String, 1, values));
|
|
82
|
+
const decoded = Compressor.decode<string[]>(String, 1, buf);
|
|
83
|
+
expect(decoded).toEqual(values);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("[Int]", () => {
|
|
87
|
+
const values = [1, 2, 3, 100];
|
|
88
|
+
const buf = expectBuffer(Compressor.encode(Int, 1, values));
|
|
89
|
+
const decoded = Compressor.decode<number[]>(Int, 1, buf);
|
|
90
|
+
expect(decoded).toEqual(values);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("[Boolean]", () => {
|
|
94
|
+
const values = [true, false, true];
|
|
95
|
+
const buf = expectBuffer(Compressor.encode(Boolean, 1, values));
|
|
96
|
+
const decoded = Compressor.decode<boolean[]>(Boolean, 1, buf);
|
|
97
|
+
expect(decoded).toEqual(values);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("empty array", () => {
|
|
101
|
+
const buf = expectBuffer(Compressor.encode(String, 1, []));
|
|
102
|
+
const decoded = Compressor.decode<string[]>(String, 1, buf);
|
|
103
|
+
expect(decoded).toEqual([]);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe("encode/decode ConstantCls (arrDepth=0, delegates)", () => {
|
|
108
|
+
test("round-trips through encode/decode", () => {
|
|
109
|
+
const original = new TestScalar({
|
|
110
|
+
name: "bob",
|
|
111
|
+
age: 25,
|
|
112
|
+
score: 8.0,
|
|
113
|
+
active: false,
|
|
114
|
+
tags: ["one", "two"],
|
|
115
|
+
nested: { label: "nested", point: 1 },
|
|
116
|
+
nestedList: [
|
|
117
|
+
{ label: "a", point: 2 },
|
|
118
|
+
{ label: "b", point: 3 },
|
|
119
|
+
],
|
|
120
|
+
} as never);
|
|
121
|
+
Object.defineProperty(original, "meta", { value: new Map([["locale", "ko"]]), configurable: true });
|
|
122
|
+
Object.defineProperty(original, "nestedMap", {
|
|
123
|
+
value: new Map([["home", new NestedScalar({ label: "home", point: 4 })]]),
|
|
124
|
+
configurable: true,
|
|
125
|
+
});
|
|
126
|
+
const buf = expectBuffer(Compressor.encode(TestScalar, 0, original));
|
|
127
|
+
const decoded = Compressor.decode<typeof original>(TestScalar, 0, buf, { raw: true }) as typeof original & {
|
|
128
|
+
nestedList: InstanceType<typeof NestedScalar>[];
|
|
129
|
+
meta: Map<string, string>;
|
|
130
|
+
};
|
|
131
|
+
const nestedMapHome = (decoded.nestedMap as Map<string, { label: string; point: number }>).get("home");
|
|
132
|
+
expect(decoded.name).toBe("bob");
|
|
133
|
+
expect(decoded.age).toBe(25);
|
|
134
|
+
expect(decoded.active).toBe(false);
|
|
135
|
+
expect(decoded.tags).toEqual(["one", "two"]);
|
|
136
|
+
expect(decoded.nested.label).toBe("nested");
|
|
137
|
+
expect(decoded.nestedList[1]?.point).toBe(3);
|
|
138
|
+
expect(decoded.meta.get("locale")).toBe("ko");
|
|
139
|
+
expect(nestedMapHome?.point).toBe(4);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
describe("encode/decode array of ConstantCls (arrDepth=1)", () => {
|
|
144
|
+
test("[TestScalar]", () => {
|
|
145
|
+
const items = [
|
|
146
|
+
new TestScalar({
|
|
147
|
+
name: "alice",
|
|
148
|
+
age: 30,
|
|
149
|
+
score: 9.5,
|
|
150
|
+
active: true,
|
|
151
|
+
tags: [],
|
|
152
|
+
nested: { label: "n1", point: 1 },
|
|
153
|
+
nestedList: [],
|
|
154
|
+
meta: {} as never,
|
|
155
|
+
nestedMap: {} as never,
|
|
156
|
+
} as never),
|
|
157
|
+
new TestScalar({
|
|
158
|
+
name: "bob",
|
|
159
|
+
age: 25,
|
|
160
|
+
score: 8.0,
|
|
161
|
+
active: false,
|
|
162
|
+
tags: [],
|
|
163
|
+
nested: { label: "n2", point: 2 },
|
|
164
|
+
nestedList: [],
|
|
165
|
+
meta: {} as never,
|
|
166
|
+
nestedMap: {} as never,
|
|
167
|
+
} as never),
|
|
168
|
+
];
|
|
169
|
+
const buf = expectBuffer(Compressor.encode(TestScalar, 1, items));
|
|
170
|
+
const decoded = Compressor.decode<(typeof items)[0][]>(TestScalar, 1, buf);
|
|
171
|
+
expect(decoded).toHaveLength(2);
|
|
172
|
+
expect(decoded[0]?.name).toBe("alice");
|
|
173
|
+
expect(decoded[0]?.age).toBe(30);
|
|
174
|
+
expect(decoded[1]?.name).toBe("bob");
|
|
175
|
+
expect(decoded[1]?.active).toBe(false);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test("empty model array", () => {
|
|
179
|
+
const buf = expectBuffer(Compressor.encode(TestScalar, 1, []));
|
|
180
|
+
const decoded = Compressor.decode<InstanceType<typeof TestScalar>[]>(TestScalar, 1, buf);
|
|
181
|
+
expect(decoded).toEqual([]);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
});
|
|
@@ -300,7 +300,7 @@ const jsonPath = (path: string) =>
|
|
|
300
300
|
.map((part) => part.replaceAll('"', '\\"'))
|
|
301
301
|
.join(".")}`;
|
|
302
302
|
const encodeSqlValue = (value: unknown) => encodeDocumentValue(value);
|
|
303
|
-
|
|
303
|
+
// Dates are persisted as epoch ms, but legacy rows may hold ISO strings; accept both.
|
|
304
304
|
const decodeDateValue = (value: unknown) => {
|
|
305
305
|
if (value === null || value === undefined) return value;
|
|
306
306
|
if (typeof value === "number") return dayjs(value);
|
|
@@ -1128,7 +1128,7 @@ export class SqliteDocumentStore {
|
|
|
1128
1128
|
private prepareReadStmt(sql: string) {
|
|
1129
1129
|
const cached = this.#readStmtCache.get(sql);
|
|
1130
1130
|
if (cached) return cached;
|
|
1131
|
-
|
|
1131
|
+
// Keep the cache bounded; list/find query shapes repeat heavily, while ad-hoc filters should not grow forever.
|
|
1132
1132
|
if (this.#readStmtCache.size >= 128) {
|
|
1133
1133
|
const oldest = this.#readStmtCache.keys().next().value;
|
|
1134
1134
|
if (oldest) this.#readStmtCache.delete(oldest);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
2
|
+
import { rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { dayjs } from "akanjs/base";
|
|
6
|
+
import { SolidCache } from "./solidCache.adaptor";
|
|
7
|
+
import { getSolidConfig } from "./solidSqlite";
|
|
8
|
+
|
|
9
|
+
const createCache = async () => {
|
|
10
|
+
const filePath = path.join(tmpdir(), `solid-cache-test-${Date.now()}-${Math.random().toString(36).slice(2)}.db`);
|
|
11
|
+
const config = getSolidConfig({ appName: "test", environment: "test", solid: { filePath } });
|
|
12
|
+
const cache = new SolidCache();
|
|
13
|
+
// The DI container injects `config`; in tests we assign it directly before init.
|
|
14
|
+
Object.assign(cache, { config });
|
|
15
|
+
await cache.onInit();
|
|
16
|
+
return { cache, filePath };
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const cleanup = (filePath: string) => {
|
|
20
|
+
for (const suffix of ["", "-wal", "-shm"]) {
|
|
21
|
+
try {
|
|
22
|
+
rmSync(`${filePath}${suffix}`);
|
|
23
|
+
} catch {
|
|
24
|
+
// ignore missing files
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
describe("SolidCache adaptor (sqlite)", () => {
|
|
30
|
+
let cache: SolidCache;
|
|
31
|
+
let filePath: string;
|
|
32
|
+
|
|
33
|
+
beforeEach(async () => {
|
|
34
|
+
({ cache, filePath } = await createCache());
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
afterEach(async () => {
|
|
38
|
+
await cache.onDestroy();
|
|
39
|
+
cleanup(filePath);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("round-trips string and number values like the redis cache", async () => {
|
|
43
|
+
await cache.set("remoteAuthToken", "remote-1", "jwt-token");
|
|
44
|
+
expect(await cache.get<string>("remoteAuthToken", "remote-1")).toBe("jwt-token");
|
|
45
|
+
|
|
46
|
+
await cache.set("lastResetAt", "user-1", 1234);
|
|
47
|
+
expect(await cache.get<number>("lastResetAt", "user-1")).toBe(1234);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("overwrites an existing key on repeated set", async () => {
|
|
51
|
+
await cache.set("remoteAuthToken", "remote-1", "first");
|
|
52
|
+
await cache.set("remoteAuthToken", "remote-1", "second");
|
|
53
|
+
expect(await cache.get<string>("remoteAuthToken", "remote-1")).toBe("second");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("returns the value while the expiration is in the future", async () => {
|
|
57
|
+
await cache.set("remoteAuthToken", "remote-1", "jwt-token", { expireAt: dayjs().add(30, "second") });
|
|
58
|
+
expect(await cache.get<string>("remoteAuthToken", "remote-1")).toBe("jwt-token");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test("returns undefined once the expiration has passed", async () => {
|
|
62
|
+
await cache.set("remoteAuthToken", "remote-1", "jwt-token", { expireAt: dayjs().subtract(1, "second") });
|
|
63
|
+
expect(await cache.get<string>("remoteAuthToken", "remote-1")).toBeUndefined();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("returns undefined for an unknown key", async () => {
|
|
67
|
+
expect(await cache.get<string>("remoteAuthToken", "missing")).toBeUndefined();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("deletes a stored value", async () => {
|
|
71
|
+
await cache.set("remoteAuthToken", "remote-1", "jwt-token");
|
|
72
|
+
await cache.delete("remoteAuthToken", "remote-1");
|
|
73
|
+
expect(await cache.get<string>("remoteAuthToken", "remote-1")).toBeUndefined();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("round-trips and removes hash values", async () => {
|
|
77
|
+
await cache.hset("session", "user-1", "field-a", "value-a");
|
|
78
|
+
await cache.hset("session", "user-1", "field-b", "value-b");
|
|
79
|
+
expect(await cache.hget<string>("session", "user-1", "field-a")).toBe("value-a");
|
|
80
|
+
expect(await cache.hget<string>("session", "user-1", "field-b")).toBe("value-b");
|
|
81
|
+
|
|
82
|
+
await cache.hdelete("session", "user-1", "field-a");
|
|
83
|
+
expect(await cache.hget<string>("session", "user-1", "field-a")).toBeUndefined();
|
|
84
|
+
expect(await cache.hget<string>("session", "user-1", "field-b")).toBe("value-b");
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("lists and clears hash values", async () => {
|
|
88
|
+
await cache.hset("session", "user-1", "field-b", "value-b");
|
|
89
|
+
await cache.hset("session", "user-1", "field-a", "value-a");
|
|
90
|
+
await cache.hset("session", "user-2", "field-c", "value-c");
|
|
91
|
+
|
|
92
|
+
expect(await cache.hkeys("session", "user-1")).toEqual(["field-a", "field-b"]);
|
|
93
|
+
expect(await cache.hentries<string>("session", "user-1")).toEqual([
|
|
94
|
+
["field-a", "value-a"],
|
|
95
|
+
["field-b", "value-b"],
|
|
96
|
+
]);
|
|
97
|
+
|
|
98
|
+
await cache.hclear("session", "user-1");
|
|
99
|
+
expect(await cache.hkeys("session", "user-1")).toEqual([]);
|
|
100
|
+
expect(await cache.hget<string>("session", "user-2", "field-c")).toBe("value-c");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("expires hash values once the expiration has passed", async () => {
|
|
104
|
+
await cache.hset("session", "user-1", "field-a", "value-a", { expireAt: dayjs().subtract(1, "second") });
|
|
105
|
+
expect(await cache.hget<string>("session", "user-1", "field-a")).toBeUndefined();
|
|
106
|
+
});
|
|
107
|
+
});
|