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
|
@@ -24,6 +24,7 @@ type PubsubSubscribeFn<E> = (
|
|
|
24
24
|
...args: [...EndpInfoArgs<E>, handleEvent: (data: EndpInfoReturns<E>) => PromiseOrObject<void>, options?: FetchPolicy]
|
|
25
25
|
) => () => void;
|
|
26
26
|
|
|
27
|
+
// Keys kept as-is: query / mutation / message (emit)
|
|
27
28
|
type PrimaryFetchType<EInfoObj extends { [key: string]: EndpointInfo }> = {
|
|
28
29
|
[K in keyof EInfoObj as EndpInfoType<EInfoObj[K]> extends "query" | "mutation" | "message" ? K : never]: EndpInfoType<
|
|
29
30
|
EInfoObj[K]
|
|
@@ -34,6 +35,7 @@ type PrimaryFetchType<EInfoObj extends { [key: string]: EndpointInfo }> = {
|
|
|
34
35
|
: never;
|
|
35
36
|
};
|
|
36
37
|
|
|
38
|
+
// Keys remapped to `subscribe${Key}`
|
|
37
39
|
type PubsubFetchType<EInfoObj extends { [key: string]: EndpointInfo }> = {
|
|
38
40
|
[K in keyof EInfoObj as EndpInfoType<EInfoObj[K]> extends "pubsub"
|
|
39
41
|
? K extends string
|
|
@@ -42,6 +44,7 @@ type PubsubFetchType<EInfoObj extends { [key: string]: EndpointInfo }> = {
|
|
|
42
44
|
: never]: PubsubSubscribeFn<EInfoObj[K]>;
|
|
43
45
|
};
|
|
44
46
|
|
|
47
|
+
// Keys remapped to `listen${Key}`
|
|
45
48
|
type MessageListenFetchType<EInfoObj extends { [key: string]: EndpointInfo }> = {
|
|
46
49
|
[K in keyof EInfoObj as EndpInfoType<EInfoObj[K]> extends "message"
|
|
47
50
|
? K extends string
|
|
@@ -5,6 +5,8 @@ import type { DatabaseModel, ExtractSort, FilterInstance } from "akanjs/document
|
|
|
5
5
|
import type { SliceCls, SliceInfoArgs } from "akanjs/signal";
|
|
6
6
|
import type { ClientEdit, ClientInit, ClientView, EditReturn, InitReturn, ViewReturn } from "./appliedReturn.type";
|
|
7
7
|
|
|
8
|
+
// Shortcut accessors — avoids re-typing the long lookup path and lets TS
|
|
9
|
+
// memoize each access once per SlceCls instantiation.
|
|
8
10
|
type _SliceMap<S extends SliceCls> = S[typeof SLICE_META];
|
|
9
11
|
type _RefName<S extends SliceCls> = S["srv"]["cnst"]["refName"];
|
|
10
12
|
type _Cap<S extends SliceCls> = S["srv"]["cnst"]["_CapitalizedRefName"];
|
|
@@ -21,6 +23,11 @@ type _Sort<S extends SliceCls> = S["srv"]["db"]["_Sort"];
|
|
|
21
23
|
type _LightWithId<S extends SliceCls> = _Light<S> extends { id: string } ? _Light<S> : { id: string };
|
|
22
24
|
type _SliceFetchInitOption<S extends SliceCls> = FetchInitOption<_Input<S>, _Filter<S>, _DefaultInput<S>, _Sort<S>>;
|
|
23
25
|
|
|
26
|
+
// The 4 dynamic parts below are each a single homomorphic mapped type over
|
|
27
|
+
// `keyof SliceMap`, which preserves each result key's declaration trace
|
|
28
|
+
// (better hover, slightly better go-to-def) and avoids the
|
|
29
|
+
// `UnionToIntersection`/`MergedValues` blow-up.
|
|
30
|
+
|
|
24
31
|
type SliceListFetch<S extends SliceCls> = {
|
|
25
32
|
[Suffix in keyof _SliceMap<S> as Suffix extends string ? `${_RefName<S>}List${Capitalize<Suffix>}` : never]: (
|
|
26
33
|
...args: [
|
|
@@ -138,6 +145,7 @@ type AppliedBaseSliceFetchType<
|
|
|
138
145
|
} & {
|
|
139
146
|
[K in `get${_CapitalizedRefName}Edit`]: (id: string, option?: FetchPolicy) => ClientEdit<RefName, Full>;
|
|
140
147
|
} & {
|
|
148
|
+
// TODO: migrate this to shared
|
|
141
149
|
[K in `add${_CapitalizedRefName}Files`]: (
|
|
142
150
|
fileList: FileList,
|
|
143
151
|
parentId?: string,
|
package/fetch/requestStorage.ts
CHANGED
|
@@ -15,7 +15,11 @@ declare global {
|
|
|
15
15
|
let _requestStorage: RequestStorage | null = null;
|
|
16
16
|
if (typeof window === "undefined") {
|
|
17
17
|
try {
|
|
18
|
-
|
|
18
|
+
// Keep this module synchronous. CSR builds import `akanjs/fetch` through
|
|
19
|
+
// Bun's HMR runtime, and a top-level `await import("node:async_hooks")`
|
|
20
|
+
// turns the whole `export *` chain into an async module. Named imports
|
|
21
|
+
// from that chain can then be observed as `null` during evaluation
|
|
22
|
+
// (notably `FetchClient` in `akanjs/client/useClient.ts`).
|
|
19
23
|
const { AsyncLocalStorage } = require("node:async_hooks") as typeof import("node:async_hooks");
|
|
20
24
|
globalThis.__AKAN_REQUEST_STORAGE__ ??= new AsyncLocalStorage() as RequestStorage;
|
|
21
25
|
_requestStorage = globalThis.__AKAN_REQUEST_STORAGE__;
|
|
@@ -57,6 +61,10 @@ export function pushRequestFallback(req: Request): () => void {
|
|
|
57
61
|
};
|
|
58
62
|
}
|
|
59
63
|
|
|
64
|
+
// Lightweight server-side helpers for server components to read the incoming
|
|
65
|
+
// request's headers/cookies. Kept in akanjs/fetch (no heavy client deps) so
|
|
66
|
+
// they can be imported from inside the RSC worker without pulling `akanjs/
|
|
67
|
+
// client`'s useClient macro chain.
|
|
60
68
|
/** Returns the active server request from AsyncLocalStorage or the fallback stack. */
|
|
61
69
|
export function getRequest(): Request | undefined {
|
|
62
70
|
return requestStorage?.getStore() ?? globalThis.__AKAN_REQUEST_FALLBACK_STACK__?.at(-1);
|
|
@@ -104,7 +112,7 @@ export function parseCookieHeader(cookieHeader: string): Map<string, CookieEntry
|
|
|
104
112
|
if (eq === -1) continue;
|
|
105
113
|
const name = trimmed.slice(0, eq).trim();
|
|
106
114
|
const raw = trimmed.slice(eq + 1).trim();
|
|
107
|
-
|
|
115
|
+
// Support the `j:<json>` convention used elsewhere in akanjs.
|
|
108
116
|
const value = raw.startsWith("j:")
|
|
109
117
|
? (() => {
|
|
110
118
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akanjs",
|
|
3
|
-
"version": "2.2.4
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -15,140 +15,98 @@
|
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types": "./types/index.d.ts",
|
|
19
18
|
"import": "./index.ts",
|
|
19
|
+
"types": "./index.ts",
|
|
20
20
|
"default": "./index.ts"
|
|
21
21
|
},
|
|
22
22
|
"./package.json": "./package.json",
|
|
23
23
|
"./base": {
|
|
24
|
-
"types": "./types/base/index.d.ts",
|
|
25
24
|
"import": "./base/index.ts",
|
|
25
|
+
"types": "./base/index.ts",
|
|
26
26
|
"default": "./base/index.ts"
|
|
27
27
|
},
|
|
28
28
|
"./common": {
|
|
29
|
-
"types": "./types/common/index.d.ts",
|
|
30
29
|
"import": "./common/index.ts",
|
|
30
|
+
"types": "./common/index.ts",
|
|
31
31
|
"default": "./common/index.ts"
|
|
32
32
|
},
|
|
33
|
-
"./common/*":
|
|
34
|
-
"types": "./types/common/*.d.ts",
|
|
35
|
-
"import": "./common/*",
|
|
36
|
-
"default": "./common/*"
|
|
37
|
-
},
|
|
38
|
-
"./common/*.ts": {
|
|
39
|
-
"types": "./types/common/*.d.ts",
|
|
40
|
-
"import": "./common/*.ts",
|
|
41
|
-
"default": "./common/*.ts"
|
|
42
|
-
},
|
|
43
|
-
"./common/*.tsx": {
|
|
44
|
-
"types": "./types/common/*.d.ts",
|
|
45
|
-
"import": "./common/*.tsx",
|
|
46
|
-
"default": "./common/*.tsx"
|
|
47
|
-
},
|
|
33
|
+
"./common/*": "./common/*",
|
|
48
34
|
"./fetch": {
|
|
49
|
-
"types": "./types/fetch/index.d.ts",
|
|
50
35
|
"import": "./fetch/index.ts",
|
|
36
|
+
"types": "./fetch/index.ts",
|
|
51
37
|
"default": "./fetch/index.ts"
|
|
52
38
|
},
|
|
53
39
|
"./document": {
|
|
54
|
-
"types": "./types/document/index.d.ts",
|
|
55
40
|
"import": "./document/index.ts",
|
|
41
|
+
"types": "./document/index.ts",
|
|
56
42
|
"default": "./document/index.ts"
|
|
57
43
|
},
|
|
58
44
|
"./signal": {
|
|
59
|
-
"types": "./types/signal/index.d.ts",
|
|
60
45
|
"import": "./signal/index.ts",
|
|
46
|
+
"types": "./signal/index.ts",
|
|
61
47
|
"default": "./signal/index.ts"
|
|
62
48
|
},
|
|
63
49
|
"./store": {
|
|
64
|
-
"types": "./types/store/index.d.ts",
|
|
65
50
|
"import": "./store/index.ts",
|
|
51
|
+
"types": "./store/index.ts",
|
|
66
52
|
"default": "./store/index.ts"
|
|
67
53
|
},
|
|
68
54
|
"./ui": {
|
|
69
|
-
"types": "./types/ui/index.d.ts",
|
|
70
55
|
"import": "./ui/index.ts",
|
|
56
|
+
"types": "./ui/index.ts",
|
|
71
57
|
"default": "./ui/index.ts"
|
|
72
58
|
},
|
|
73
|
-
"./ui/*":
|
|
74
|
-
"types": "./types/ui/*.d.ts",
|
|
75
|
-
"import": "./ui/*",
|
|
76
|
-
"default": "./ui/*"
|
|
77
|
-
},
|
|
78
|
-
"./ui/*.ts": {
|
|
79
|
-
"types": "./types/ui/*.d.ts",
|
|
80
|
-
"import": "./ui/*.ts",
|
|
81
|
-
"default": "./ui/*.ts"
|
|
82
|
-
},
|
|
83
|
-
"./ui/*.tsx": {
|
|
84
|
-
"types": "./types/ui/*.d.ts",
|
|
85
|
-
"import": "./ui/*.tsx",
|
|
86
|
-
"default": "./ui/*.tsx"
|
|
87
|
-
},
|
|
59
|
+
"./ui/*": "./ui/*",
|
|
88
60
|
"./client": {
|
|
89
|
-
"types": "./types/client/index.d.ts",
|
|
90
61
|
"import": "./client/index.ts",
|
|
62
|
+
"types": "./client/index.ts",
|
|
91
63
|
"default": "./client/index.ts"
|
|
92
64
|
},
|
|
93
65
|
"./client/capacitor": {
|
|
94
|
-
"types": "./types/client/capacitor.d.ts",
|
|
95
66
|
"import": "./client/capacitor.ts",
|
|
67
|
+
"types": "./client/capacitor.ts",
|
|
96
68
|
"default": "./client/capacitor.ts"
|
|
97
69
|
},
|
|
98
70
|
"./capacitor.base.config": {
|
|
99
|
-
"types": "./types/capacitor.base.config.d.ts",
|
|
100
71
|
"import": "./capacitor.base.config.ts",
|
|
72
|
+
"types": "./capacitor.base.config.ts",
|
|
101
73
|
"default": "./capacitor.base.config.ts"
|
|
102
74
|
},
|
|
103
75
|
"./webkit": {
|
|
104
|
-
"types": "./types/webkit/index.d.ts",
|
|
105
76
|
"import": "./webkit/index.ts",
|
|
77
|
+
"types": "./webkit/index.ts",
|
|
106
78
|
"default": "./webkit/index.ts"
|
|
107
79
|
},
|
|
108
|
-
"./webkit/*":
|
|
109
|
-
"types": "./types/webkit/*.d.ts",
|
|
110
|
-
"import": "./webkit/*",
|
|
111
|
-
"default": "./webkit/*"
|
|
112
|
-
},
|
|
113
|
-
"./webkit/*.ts": {
|
|
114
|
-
"types": "./types/webkit/*.d.ts",
|
|
115
|
-
"import": "./webkit/*.ts",
|
|
116
|
-
"default": "./webkit/*.ts"
|
|
117
|
-
},
|
|
118
|
-
"./webkit/*.tsx": {
|
|
119
|
-
"types": "./types/webkit/*.d.ts",
|
|
120
|
-
"import": "./webkit/*.tsx",
|
|
121
|
-
"default": "./webkit/*.tsx"
|
|
122
|
-
},
|
|
80
|
+
"./webkit/*": "./webkit/*",
|
|
123
81
|
"./server": {
|
|
124
|
-
"types": "./types/server/index.d.ts",
|
|
125
82
|
"import": "./server/index.ts",
|
|
83
|
+
"types": "./server/index.ts",
|
|
126
84
|
"default": "./server/index.ts"
|
|
127
85
|
},
|
|
128
86
|
"./service": {
|
|
129
|
-
"types": "./types/service/index.d.ts",
|
|
130
87
|
"import": "./service/index.ts",
|
|
88
|
+
"types": "./service/index.ts",
|
|
131
89
|
"default": "./service/index.ts"
|
|
132
90
|
},
|
|
133
91
|
"./constant": {
|
|
134
|
-
"types": "./types/constant/index.d.ts",
|
|
135
92
|
"import": "./constant/index.ts",
|
|
93
|
+
"types": "./constant/index.ts",
|
|
136
94
|
"default": "./constant/index.ts"
|
|
137
95
|
},
|
|
138
96
|
"./dictionary": {
|
|
139
|
-
"types": "./types/dictionary/index.d.ts",
|
|
140
97
|
"import": "./dictionary/index.ts",
|
|
98
|
+
"types": "./dictionary/index.ts",
|
|
141
99
|
"default": "./dictionary/index.ts"
|
|
142
100
|
},
|
|
143
101
|
"./test": {
|
|
144
|
-
"types": "./types/test/index.d.ts",
|
|
145
102
|
"import": "./test/index.ts",
|
|
103
|
+
"types": "./test/index.ts",
|
|
146
104
|
"default": "./test/index.ts"
|
|
147
105
|
},
|
|
148
106
|
"./ui/styles.css": "./ui/styles.css",
|
|
149
107
|
"./server/rsc-worker": {
|
|
150
|
-
"types": "./types/server/rscWorker.d.ts",
|
|
151
108
|
"import": "./server/rscWorker.tsx",
|
|
109
|
+
"types": "./server/rscWorker.tsx",
|
|
152
110
|
"default": "./server/rscWorker.tsx"
|
|
153
111
|
}
|
|
154
112
|
},
|
|
@@ -328,6 +286,5 @@
|
|
|
328
286
|
},
|
|
329
287
|
"engines": {
|
|
330
288
|
"bun": ">=1.3.13"
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test } from "bun:test";
|
|
2
|
+
import { mkdtemp, rm } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { AkanApp } from "./akanApp";
|
|
6
|
+
import { makeAkanChildProxyHeaders } from "./akanAppHeaders";
|
|
7
|
+
|
|
8
|
+
const tempRoots: string[] = [];
|
|
9
|
+
|
|
10
|
+
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
11
|
+
|
|
12
|
+
const waitFor = async <T>(fn: () => Promise<T | null>, timeoutMs = 5_000): Promise<T> => {
|
|
13
|
+
const started = Date.now();
|
|
14
|
+
while (Date.now() - started < timeoutMs) {
|
|
15
|
+
const value = await fn();
|
|
16
|
+
if (value) return value;
|
|
17
|
+
await wait(50);
|
|
18
|
+
}
|
|
19
|
+
throw new Error(`Timed out after ${timeoutMs}ms`);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
afterEach(async () => {
|
|
23
|
+
await Promise.all(tempRoots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe("makeAkanChildProxyHeaders", () => {
|
|
27
|
+
test("preserves public forwarded host and protocol for child requests", () => {
|
|
28
|
+
const req = new Request("http://akan-internal/", {
|
|
29
|
+
headers: {
|
|
30
|
+
connection: "keep-alive",
|
|
31
|
+
host: "internal.example",
|
|
32
|
+
"x-forwarded-for": "203.0.113.10",
|
|
33
|
+
"x-forwarded-host": "akanjs.com",
|
|
34
|
+
"x-forwarded-proto": "https",
|
|
35
|
+
"x-real-ip": "10.0.0.5",
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const headers = makeAkanChildProxyHeaders(req, 2);
|
|
40
|
+
|
|
41
|
+
expect(headers.get("connection")).toBeNull();
|
|
42
|
+
expect(headers.get("host")).toBe("akan-child");
|
|
43
|
+
expect(headers.get("x-forwarded-for")).toBe("203.0.113.10, 10.0.0.5");
|
|
44
|
+
expect(headers.get("x-forwarded-host")).toBe("akanjs.com");
|
|
45
|
+
expect(headers.get("x-forwarded-proto")).toBe("https");
|
|
46
|
+
expect(headers.get("x-akan-child-idx")).toBe("2");
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("falls back to request host and protocol without upstream forwarded headers", () => {
|
|
50
|
+
const req = new Request("http://internal.example/", {
|
|
51
|
+
headers: {
|
|
52
|
+
host: "internal.example",
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const headers = makeAkanChildProxyHeaders(req, 0);
|
|
57
|
+
|
|
58
|
+
expect(headers.get("x-forwarded-host")).toBe("internal.example");
|
|
59
|
+
expect(headers.get("x-forwarded-proto")).toBe("http");
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe("AkanApp", () => {
|
|
64
|
+
test("restarts only the crashed replica", async () => {
|
|
65
|
+
const root = await mkdtemp(path.join(tmpdir(), "akan-app-restart-"));
|
|
66
|
+
tempRoots.push(root);
|
|
67
|
+
const counterPath = path.join(root, "counter.txt");
|
|
68
|
+
const serverPath = path.join(root, "server.ts");
|
|
69
|
+
const runtimeDir = path.join(root, "runtime");
|
|
70
|
+
const port = 24_000 + Math.floor(Math.random() * 10_000);
|
|
71
|
+
|
|
72
|
+
await Bun.write(
|
|
73
|
+
serverPath,
|
|
74
|
+
`
|
|
75
|
+
const counterPath = ${JSON.stringify(counterPath)};
|
|
76
|
+
export const server = {
|
|
77
|
+
async start() {
|
|
78
|
+
const file = Bun.file(counterPath);
|
|
79
|
+
const previous = await file.exists() ? Number(await file.text()) : 0;
|
|
80
|
+
const next = previous + 1;
|
|
81
|
+
await Bun.write(counterPath, String(next));
|
|
82
|
+
const http = Bun.serve({
|
|
83
|
+
unix: process.env.AKAN_CHILD_SOCKET,
|
|
84
|
+
fetch() { return new Response("ok"); },
|
|
85
|
+
});
|
|
86
|
+
process.on("message", (message) => {
|
|
87
|
+
if (!message || typeof message !== "object") return;
|
|
88
|
+
if (message.type === "health.ping") {
|
|
89
|
+
process.send?.({ type: "health.pong", nonce: message.nonce, sentAt: message.sentAt, pid: process.pid });
|
|
90
|
+
}
|
|
91
|
+
if (message.type === "shutdown") {
|
|
92
|
+
http.stop(true);
|
|
93
|
+
process.exit(0);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
process.send?.({
|
|
97
|
+
type: "ready",
|
|
98
|
+
pid: process.pid,
|
|
99
|
+
replicaIdx: Number(process.env.AKAN_REPLICA_IDX ?? 0),
|
|
100
|
+
role: process.env.SERVER_MODE ?? "all",
|
|
101
|
+
upstream: { type: "unix", socketPath: process.env.AKAN_CHILD_SOCKET },
|
|
102
|
+
healthPath: "/_akan/app/child-health",
|
|
103
|
+
});
|
|
104
|
+
if (next === 1) setTimeout(() => process.exit(1), 50);
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
`,
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const app = new AkanApp(serverPath, { replica: 1, runtimeDir, port });
|
|
111
|
+
const running = app.start();
|
|
112
|
+
try {
|
|
113
|
+
const health = await waitFor(async () => {
|
|
114
|
+
const res = await fetch(`http://127.0.0.1:${port}/_akan/app/health`).catch(() => null);
|
|
115
|
+
if (!res?.ok) return null;
|
|
116
|
+
const body = (await res.json()) as {
|
|
117
|
+
children: Array<{ ready: boolean; restartCount: number; restartPending: boolean }>;
|
|
118
|
+
};
|
|
119
|
+
const child = body.children[0];
|
|
120
|
+
return child?.ready && child.restartCount > 0 && !child.restartPending ? body : null;
|
|
121
|
+
}, 6_000);
|
|
122
|
+
|
|
123
|
+
expect(health.children[0]?.restartCount).toBeGreaterThanOrEqual(1);
|
|
124
|
+
expect(await Bun.file(counterPath).text()).toBe("2");
|
|
125
|
+
} finally {
|
|
126
|
+
await app.stop();
|
|
127
|
+
await Promise.race([running, wait(1_000)]);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
package/server/akanApp.ts
CHANGED
|
@@ -154,7 +154,7 @@ export class AkanApp {
|
|
|
154
154
|
process.on("SIGINT", () => this.#handleShutdownSignal("SIGINT"));
|
|
155
155
|
process.on("SIGTERM", () => this.#handleShutdownSignal("SIGTERM"));
|
|
156
156
|
await new Promise<void>((resolve) => {
|
|
157
|
-
|
|
157
|
+
// Keep the orchestrator alive while child processes run.
|
|
158
158
|
this.#resolveStopped = resolve;
|
|
159
159
|
});
|
|
160
160
|
}
|
|
@@ -360,6 +360,7 @@ export class AkanApp {
|
|
|
360
360
|
try {
|
|
361
361
|
await rm(socketPath, { force: true });
|
|
362
362
|
} catch {
|
|
363
|
+
// Best-effort cleanup for stale Unix sockets.
|
|
363
364
|
}
|
|
364
365
|
}
|
|
365
366
|
|
|
@@ -588,7 +589,8 @@ export class AkanApp {
|
|
|
588
589
|
|
|
589
590
|
#proxyResponse(upstreamRes: Response): Response {
|
|
590
591
|
const headers = new Headers(upstreamRes.headers);
|
|
591
|
-
|
|
592
|
+
// Bun fetch transparently decompresses upstream bodies but keeps these
|
|
593
|
+
// headers, which makes browsers try to decode an already-decoded payload.
|
|
592
594
|
headers.delete("content-encoding");
|
|
593
595
|
headers.delete("content-length");
|
|
594
596
|
this.#rewriteInternalLocation(headers);
|
|
@@ -606,6 +608,7 @@ export class AkanApp {
|
|
|
606
608
|
const parsed = new URL(location);
|
|
607
609
|
if (parsed.hostname === "akan-child") headers.set("location", `${parsed.pathname}${parsed.search}${parsed.hash}`);
|
|
608
610
|
} catch {
|
|
611
|
+
// Relative redirects are already safe to pass through.
|
|
609
612
|
}
|
|
610
613
|
}
|
|
611
614
|
|
package/server/akanLib.ts
CHANGED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { mkdtemp, rm } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import type { BackendEnv } from "akanjs/base";
|
|
6
|
+
|
|
7
|
+
const createEnv = (tmp: string) =>
|
|
8
|
+
({
|
|
9
|
+
repoName: "akan",
|
|
10
|
+
serveDomain: "example.com",
|
|
11
|
+
appName: "serverGet",
|
|
12
|
+
environment: "local",
|
|
13
|
+
operationMode: "local",
|
|
14
|
+
tunnelUsername: "root",
|
|
15
|
+
tunnelPassword: "akan",
|
|
16
|
+
workspaceRoot: tmp,
|
|
17
|
+
database: {
|
|
18
|
+
sqlite: {
|
|
19
|
+
filePath: join(tmp, "akan.db"),
|
|
20
|
+
journalMode: "WAL",
|
|
21
|
+
busyTimeoutMs: 1000,
|
|
22
|
+
synchronous: "NORMAL",
|
|
23
|
+
foreignKeys: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
solid: {
|
|
27
|
+
filePath: join(tmp, "solid.db"),
|
|
28
|
+
journalMode: "WAL",
|
|
29
|
+
busyTimeoutMs: 1000,
|
|
30
|
+
synchronous: "NORMAL",
|
|
31
|
+
cleanupIntervalMs: 60_000,
|
|
32
|
+
queuePollIntervalMs: 60_000,
|
|
33
|
+
queueLeaseMs: 30_000,
|
|
34
|
+
},
|
|
35
|
+
}) satisfies BackendEnv & { workspaceRoot: string };
|
|
36
|
+
|
|
37
|
+
const setAkanEnv = () => {
|
|
38
|
+
process.env.AKAN_PUBLIC_APP_NAME = "serverGet";
|
|
39
|
+
process.env.AKAN_PUBLIC_REPO_NAME = "akan";
|
|
40
|
+
process.env.AKAN_PUBLIC_SERVE_DOMAIN = "example.com";
|
|
41
|
+
process.env.AKAN_PUBLIC_ENV = "local";
|
|
42
|
+
process.env.AKAN_PUBLIC_OPERATION_MODE = "local";
|
|
43
|
+
process.env.SERVER_MODE = "all";
|
|
44
|
+
process.env.NODE_ENV = "test";
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const loadRuntime = async () => {
|
|
48
|
+
const [
|
|
49
|
+
{ SolidPubSub, WebsocketAdaptorRole },
|
|
50
|
+
{ AkanLib },
|
|
51
|
+
{ AkanOption },
|
|
52
|
+
{ AkanServer },
|
|
53
|
+
{
|
|
54
|
+
ServerResolverTestEndpoint,
|
|
55
|
+
ServerResolverTestInternal,
|
|
56
|
+
ServerResolverTestServerSignal,
|
|
57
|
+
ServerResolverTestService,
|
|
58
|
+
ServerResolverTestSlice,
|
|
59
|
+
serverResolverTestConstant,
|
|
60
|
+
serverResolverTestDatabase,
|
|
61
|
+
serverResolverTestServiceModel,
|
|
62
|
+
},
|
|
63
|
+
] = await Promise.all([
|
|
64
|
+
import("akanjs/service"),
|
|
65
|
+
import("./akanLib"),
|
|
66
|
+
import("./akanOption"),
|
|
67
|
+
import("./akanServer"),
|
|
68
|
+
import("./resolver/resolver.contract.fixture"),
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
const createLib = () =>
|
|
72
|
+
new AkanLib("serverGetTest", {
|
|
73
|
+
databases: [
|
|
74
|
+
{
|
|
75
|
+
constant: serverResolverTestConstant,
|
|
76
|
+
database: serverResolverTestDatabase,
|
|
77
|
+
service: serverResolverTestServiceModel,
|
|
78
|
+
signal: {
|
|
79
|
+
endpoint: ServerResolverTestEndpoint,
|
|
80
|
+
slice: ServerResolverTestSlice,
|
|
81
|
+
internal: ServerResolverTestInternal,
|
|
82
|
+
server: ServerResolverTestServerSignal,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
services: [],
|
|
87
|
+
scalars: [],
|
|
88
|
+
option: new AkanOption(),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
SolidPubSub,
|
|
93
|
+
WebsocketAdaptorRole,
|
|
94
|
+
AkanServer,
|
|
95
|
+
ServerResolverTestServerSignal,
|
|
96
|
+
ServerResolverTestService,
|
|
97
|
+
createLib,
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
describe("AkanServer DI lookup", () => {
|
|
102
|
+
test("gets service, server signal, and adaptor instances", async () => {
|
|
103
|
+
setAkanEnv();
|
|
104
|
+
const {
|
|
105
|
+
SolidPubSub,
|
|
106
|
+
WebsocketAdaptorRole,
|
|
107
|
+
AkanServer,
|
|
108
|
+
ServerResolverTestServerSignal,
|
|
109
|
+
ServerResolverTestService,
|
|
110
|
+
createLib,
|
|
111
|
+
} = await loadRuntime();
|
|
112
|
+
|
|
113
|
+
const tmp = await mkdtemp(join(tmpdir(), "akan-server-get-"));
|
|
114
|
+
const server = new AkanServer("serverGet", createEnv(tmp), "all", createLib());
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
await server.start({ listen: false });
|
|
118
|
+
|
|
119
|
+
const serviceByClass = server.get(ServerResolverTestService);
|
|
120
|
+
expect(serviceByClass).toBe(server.getService("serverResolverTestItem"));
|
|
121
|
+
expect(server.getService("serverResolverTestItemService")).toBe(serviceByClass);
|
|
122
|
+
|
|
123
|
+
const signalByClass = server.get(ServerResolverTestServerSignal);
|
|
124
|
+
expect(server.getSignal("serverResolverTestItem")).toBe(signalByClass);
|
|
125
|
+
expect(server.getSignal("serverResolverTestItemSignal")).toBe(signalByClass);
|
|
126
|
+
|
|
127
|
+
const adaptorByClass = server.get(SolidPubSub);
|
|
128
|
+
expect(server.get(WebsocketAdaptorRole)).toBe(adaptorByClass);
|
|
129
|
+
expect(server.getAdaptor("solidPubsub")).toBe(adaptorByClass);
|
|
130
|
+
} finally {
|
|
131
|
+
await server.stop();
|
|
132
|
+
await rm(tmp, { recursive: true, force: true });
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test("throws clear errors before initialization and for missing dependencies", async () => {
|
|
137
|
+
setAkanEnv();
|
|
138
|
+
const { AkanServer, createLib } = await loadRuntime();
|
|
139
|
+
const tmp = await mkdtemp(join(tmpdir(), "akan-server-get-"));
|
|
140
|
+
const server = new AkanServer("serverGet", createEnv(tmp), "all", createLib());
|
|
141
|
+
|
|
142
|
+
try {
|
|
143
|
+
expect(() => server.getService("serverResolverTestItem")).toThrow(
|
|
144
|
+
'Service "serverResolverTestItem" is not initialized while AkanServer status is "stopped"',
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
await server.start({ listen: false });
|
|
148
|
+
|
|
149
|
+
expect(() => server.getService("missing")).toThrow('Service "missing" is not registered.');
|
|
150
|
+
expect(() => server.getSignal("missing")).toThrow('Server signal "missingSignal" is not registered.');
|
|
151
|
+
expect(() => server.getAdaptor("missing")).toThrow('Adaptor "missing" is not registered.');
|
|
152
|
+
} finally {
|
|
153
|
+
await server.stop();
|
|
154
|
+
await rm(tmp, { recursive: true, force: true });
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
package/server/akanServer.ts
CHANGED
|
@@ -41,7 +41,8 @@ interface AkanAppPrepared {
|
|
|
41
41
|
|
|
42
42
|
export class AkanServer {
|
|
43
43
|
status: "stopped" | "initializing" | "initialized" | "starting" | "running" | "stopping" = "stopped";
|
|
44
|
-
|
|
44
|
+
// Union the app-signal data shape with the HMR channel's data shape so
|
|
45
|
+
// `server.upgrade(...)` type-checks for both.
|
|
45
46
|
#server: Bun.Server<{ createdAt: number } | HmrWsData> | null = null;
|
|
46
47
|
#wsServer: Bun.Server<{ createdAt: number } | HmrWsData> | null = null;
|
|
47
48
|
#prepared: AkanAppPrepared | null = null;
|
|
@@ -173,10 +174,10 @@ export class AkanServer {
|
|
|
173
174
|
hmrState: webRouter ? { state: webRouter.renderState } : null,
|
|
174
175
|
logger: this.logger,
|
|
175
176
|
}),
|
|
176
|
-
|
|
177
|
+
// `data` is typed by the upgrade call site; the runtime default is unused.
|
|
177
178
|
data: {},
|
|
178
179
|
} as Bun.WebSocketHandler<{ createdAt: number } | HmrWsData>;
|
|
179
|
-
|
|
180
|
+
// `builderRpc` lives in `#prepared` only so `stop()` can dispose it.
|
|
180
181
|
this.#server = Bun.serve({
|
|
181
182
|
idleTimeout: 0,
|
|
182
183
|
...(unix ? { unix } : { port }),
|
|
@@ -51,7 +51,7 @@ export class BuilderRpc {
|
|
|
51
51
|
throw new Error("[builder] process.send unavailable — backend must be spawned by the CLI with ipc enabled");
|
|
52
52
|
this.#send = this.#proc.send.bind(this.#proc);
|
|
53
53
|
this.#offMessage = this.#listen((msg) => {
|
|
54
|
-
|
|
54
|
+
// Responses: look up the pending promise by id and settle.
|
|
55
55
|
if (msg.type === "build-route-res") {
|
|
56
56
|
const res = msg as BuilderRes;
|
|
57
57
|
const waiter = this.#pending.get(res.id);
|
|
@@ -61,7 +61,7 @@ export class BuilderRpc {
|
|
|
61
61
|
else waiter.reject(new Error(`[builder] ${res.type} failed: ${res.error}`));
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
// Broadcast events: dispatch to subscriber hooks.
|
|
65
65
|
const ev = msg as BuilderEvent;
|
|
66
66
|
switch (ev.type) {
|
|
67
67
|
case "builder-ready":
|
|
@@ -16,6 +16,8 @@ export interface CssPayload {
|
|
|
16
16
|
changedFiles?: string[];
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// --- backend → builder (request/response) -------------------------------
|
|
20
|
+
|
|
19
21
|
export type BuilderReq = {
|
|
20
22
|
type: "build-route";
|
|
21
23
|
id: number;
|
|
@@ -29,6 +31,8 @@ export type BuilderRes =
|
|
|
29
31
|
| { type: "build-route-res"; id: number; ok: true; data: BuildRouteResultPayload }
|
|
30
32
|
| { type: "build-route-res"; id: number; ok: false; error: string };
|
|
31
33
|
|
|
34
|
+
// --- builder → backend (unsolicited events) -----------------------------
|
|
35
|
+
|
|
32
36
|
export interface PagesBundlePayload {
|
|
33
37
|
bundlePath: string;
|
|
34
38
|
buildId: number;
|