akanjs 2.2.4 → 2.2.6
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/CHANGELOG.md +9 -0
- package/base/base.ts +1 -1
- package/base/primitiveRegistry.ts +6 -10
- package/base/types.ts +1 -4
- package/capacitor.base.config.ts +1 -1
- package/client/capacitor.ts +1 -1
- package/client/cookie.ts +2 -4
- package/client/createFont.ts +2 -2
- package/client/csrTypes.ts +2 -8
- package/client/makePageProto.tsx +4 -10
- package/client/router.ts +3 -8
- package/client/translator.ts +4 -12
- package/common/Logger.ts +1 -4
- package/common/formatNumber.ts +2 -5
- package/common/hmrPhase.ts +1 -1
- package/common/isValidDate.ts +0 -3
- package/constant/fieldInfo.ts +3 -3
- package/constant/purify.ts +1 -2
- package/constant/types.ts +0 -4
- package/constant/via.ts +6 -12
- package/document/databaseRegistry.ts +0 -8
- package/document/into.ts +0 -1
- package/fetch/client/fetchClient.ts +1 -6
- package/fetch/client/httpClient.ts +1 -2
- package/fetch/fetchType/appliedReturn.type.ts +0 -1
- package/fetch/fetchType/endpointFetch.type.ts +0 -3
- package/fetch/fetchType/sliceFetch.type.ts +0 -8
- package/fetch/requestStorage.ts +2 -10
- package/package.json +67 -24
- package/server/akanApp.ts +2 -5
- package/server/akanLib.ts +0 -1
- package/server/akanServer.ts +3 -4
- package/server/artifact/builderRpc.ts +2 -2
- package/server/artifact/ipcTypes.ts +0 -4
- package/server/decorators.ts +1 -1
- package/server/di/diLifecycle.ts +3 -6
- package/server/hmr/clientScript.ts +2 -20
- package/server/hmr/devHmrController.ts +0 -4
- package/server/processMetricsCollector.ts +1 -1
- package/server/resolver/database.resolver.ts +2 -2
- package/server/resolver/resolver.contract.fixture.ts +0 -1
- package/server/resolver/signal.resolver.ts +2 -10
- package/server/routing/apiRouter.ts +2 -4
- package/server/rscClient.tsx +1 -7
- package/server/rscWorkerHost.ts +11 -33
- package/server/ssrFromRscRenderer.tsx +3 -35
- package/server/types/react-server-dom-webpack.d.ts +1 -7
- package/server/vendor/react-dom-client.ts +1 -1
- package/server/vendor/react-dom.ts +2 -3
- 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 +2 -9
- package/server/vendor/scheduler.ts +2 -3
- package/server/webRouter.ts +2 -3
- package/service/adapt.ts +1 -5
- package/service/predefinedAdaptor/cache.adaptor.ts +1 -2
- package/service/predefinedAdaptor/database.adaptor.ts +2 -2
- package/service/predefinedAdaptor/solidSqlite.ts +1 -2
- package/service/predefinedAdaptor/websocket.adaptor.ts +3 -15
- package/service/serve.ts +3 -7
- package/signal/base.signal.ts +0 -1
- package/signal/endpointInfo.ts +0 -7
- package/signal/intercept.ts +0 -2
- package/signal/middleware.ts +1 -2
- package/signal/serverSignal.ts +1 -15
- package/signal/signalContext.ts +1 -1
- package/signal/signalRegistry.ts +0 -5
- package/signal/sliceInfo.ts +0 -3
- package/signal/trace.ts +0 -11
- package/signal/types.ts +2 -11
- package/store/action.ts +3 -5
- package/store/stateBuilder.ts +0 -2
- package/store/stateInfo.ts +1 -2
- package/store/types.ts +1 -1
- package/test/playwright.config.base.ts +5 -28
- package/test/playwright.pageAgent.ts +1 -1
- package/test/sampleOf.ts +1 -1
- package/test/testServer.ts +1 -1
- package/types/base/base.d.ts +53 -0
- package/types/base/baseEnv.d.ts +68 -0
- package/types/base/index.d.ts +6 -0
- package/types/base/primitiveRegistry.d.ts +134 -0
- package/types/base/symbols.d.ts +11 -0
- package/types/base/types.d.ts +68 -0
- package/types/base/utils.d.ts +4 -0
- package/types/base.d.ts +1 -0
- package/types/capacitor.base.config.d.ts +3 -0
- package/types/client/capacitor.d.ts +233 -0
- package/types/client/clientRuntime.d.ts +63 -0
- package/types/client/cookie.d.ts +33 -0
- package/types/client/createFont.d.ts +6 -0
- package/types/client/csrTypes.d.ts +262 -0
- package/types/client/decorators.d.ts +7 -0
- package/types/client/device.d.ts +41 -0
- package/types/client/fetch.d.ts +1 -0
- package/types/client/index.d.ts +14 -0
- package/types/client/locale.d.ts +5 -0
- package/types/client/makePageProto.d.ts +17002 -0
- package/types/client/router.d.ts +66 -0
- package/types/client/rscNavigation.d.ts +19 -0
- package/types/client/storage.d.ts +5 -0
- package/types/client/translator.d.ts +18 -0
- package/types/client/types.d.ts +145 -0
- package/types/client/useClient.d.ts +1 -0
- package/types/client.d.ts +1 -0
- package/types/common/Logger.d.ts +41 -0
- package/types/common/applyMixins.d.ts +3 -0
- package/types/common/capitalize.d.ts +2 -0
- package/types/common/deepObjectify.d.ts +4 -0
- package/types/common/fileUpload.d.ts +28 -0
- package/types/common/formatNumber.d.ts +1 -0
- package/types/common/formatPhone.d.ts +2 -0
- package/types/common/getAllPropertyDescriptors.d.ts +5 -0
- package/types/common/hmrPhase.d.ts +6 -0
- package/types/common/httpClient.d.ts +20 -0
- package/types/common/index.d.ts +29 -0
- package/types/common/isDayjs.d.ts +2 -0
- package/types/common/isEmail.d.ts +2 -0
- package/types/common/isPhoneNumber.d.ts +2 -0
- package/types/common/isQueryEqual.d.ts +1 -0
- package/types/common/isValidDate.d.ts +2 -0
- package/types/common/jwtDecode.d.ts +2 -0
- package/types/common/localeConfig.d.ts +11 -0
- package/types/common/lowerlize.d.ts +2 -0
- package/types/common/mergeVersion.d.ts +10 -0
- package/types/common/objectify.d.ts +1 -0
- package/types/common/pathGet.d.ts +1 -0
- package/types/common/pathSet.d.ts +3 -0
- package/types/common/randomPick.d.ts +1 -0
- package/types/common/randomPicks.d.ts +1 -0
- package/types/common/routeConvention.d.ts +35 -0
- package/types/common/sleep.d.ts +2 -0
- package/types/common/splitVersion.d.ts +11 -0
- package/types/common/subRoute.d.ts +7 -0
- package/types/common/types.d.ts +14 -0
- package/types/common.d.ts +1 -0
- package/types/constant/constantRegistry.d.ts +89 -0
- package/types/constant/crystalize.d.ts +4 -0
- package/types/constant/deserialize.d.ts +7 -0
- package/types/constant/fieldInfo.d.ts +153 -0
- package/types/constant/getDefault.d.ts +3 -0
- package/types/constant/immerify.d.ts +2 -0
- package/types/constant/index.d.ts +10 -0
- package/types/constant/purify.d.ts +12 -0
- package/types/constant/serialize.d.ts +11 -0
- package/types/constant/types.d.ts +77 -0
- package/types/constant/via.d.ts +52 -0
- package/types/constant.d.ts +1 -0
- package/types/dictionary/base.dictionary.d.ts +1 -0
- package/types/dictionary/dictInfo.d.ts +206 -0
- package/types/dictionary/dictionary.d.ts +11 -0
- package/types/dictionary/index.d.ts +4 -0
- package/types/dictionary/locale.d.ts +128 -0
- package/types/dictionary/trans.d.ts +82 -0
- package/types/dictionary.d.ts +1 -0
- package/types/document/by.d.ts +20 -0
- package/types/document/dataLoader.d.ts +36 -0
- package/types/document/database.d.ts +96 -0
- package/types/document/databaseRegistry.d.ts +36 -0
- package/types/document/documentQuery.d.ts +105 -0
- package/types/document/documentSchema.d.ts +33 -0
- package/types/document/filterMeta.d.ts +84 -0
- package/types/document/index.d.ts +11 -0
- package/types/document/into.d.ts +65 -0
- package/types/document/loaderInfo.d.ts +35 -0
- package/types/document/schema.d.ts +5 -0
- package/types/document/types.d.ts +36 -0
- package/types/document.d.ts +1 -0
- package/types/fetch/client/fetchClient.d.ts +78 -0
- package/types/fetch/client/httpClient.d.ts +39 -0
- package/types/fetch/client/index.d.ts +3 -0
- package/types/fetch/client/wsClient.d.ts +37 -0
- package/types/fetch/client.d.ts +1 -0
- package/types/fetch/fetchType/appliedReturn.type.d.ts +67 -0
- package/types/fetch/fetchType/buildFetch.type.d.ts +11 -0
- package/types/fetch/fetchType/clientSignal.type.d.ts +16 -0
- package/types/fetch/fetchType/endpointFetch.type.d.ts +29 -0
- package/types/fetch/fetchType/index.d.ts +5 -0
- package/types/fetch/fetchType/sliceFetch.type.d.ts +76 -0
- package/types/fetch/fetchType.d.ts +1 -0
- package/types/fetch/index.d.ts +4 -0
- package/types/fetch/requestStorage.d.ts +29 -0
- package/types/fetch/serializer/fetch.serializer.d.ts +14 -0
- package/types/fetch/serializer/index.d.ts +1 -0
- package/types/fetch/serializer.d.ts +1 -0
- package/types/fetch/types.d.ts +19 -0
- package/types/fetch.d.ts +1 -0
- package/types/index.d.ts +213 -0
- package/types/server/akanApp.d.ts +17 -0
- package/types/server/akanAppHeaders.d.ts +1 -0
- package/types/server/akanLib.d.ts +33 -0
- package/types/server/akanOption.d.ts +15 -0
- package/types/server/akanServer.d.ts +47 -0
- package/types/server/artifact/builderRpc.d.ts +42 -0
- package/types/server/artifact/index.d.ts +6 -0
- package/types/server/artifact/ipcTypes.d.ts +73 -0
- package/types/server/artifact/manifestTypes.d.ts +16 -0
- package/types/server/artifact/routeClientCache.d.ts +45 -0
- package/types/server/artifact/routeSeedIndexStore.d.ts +43 -0
- package/types/server/artifact/routesManifestStore.d.ts +16 -0
- package/types/server/artifact.d.ts +1 -0
- package/types/server/decorators.d.ts +6 -0
- package/types/server/di/diLifecycle.d.ts +45 -0
- package/types/server/di/index.d.ts +4 -0
- package/types/server/di/predefinedAdaptor.d.ts +33 -0
- package/types/server/di/resolveAdaptorHierarchy.d.ts +21 -0
- package/types/server/di/resolveHierarchy.d.ts +11 -0
- package/types/server/di/resolveServiceHierarchy.d.ts +13 -0
- package/types/server/di/utils.d.ts +14 -0
- package/types/server/di.d.ts +1 -0
- package/types/server/hmr/changeBatch.d.ts +13 -0
- package/types/server/hmr/clientScript.d.ts +1 -0
- package/types/server/hmr/devHmrController.d.ts +24 -0
- package/types/server/hmr/index.d.ts +4 -0
- package/types/server/hmr/wsHub.d.ts +45 -0
- package/types/server/hmr.d.ts +1 -0
- package/types/server/imageOptimizer.d.ts +12 -0
- package/types/server/imageOptimizerError.d.ts +4 -0
- package/types/server/index.d.ts +14 -0
- package/types/server/lifecycle/shutdownManager.d.ts +13 -0
- package/types/server/logging/rotatingLogWriter.d.ts +20 -0
- package/types/server/processMetricsCollector.d.ts +10 -0
- package/types/server/proxy/akanResponse.d.ts +7 -0
- package/types/server/proxy/bunRequestFields.d.ts +1 -0
- package/types/server/proxy/hostBasePathWebProxy.d.ts +6 -0
- package/types/server/proxy/index.d.ts +6 -0
- package/types/server/proxy/localeWebProxy.d.ts +5 -0
- package/types/server/proxy/types.d.ts +37 -0
- package/types/server/proxy/webProxyRunner.d.ts +7 -0
- package/types/server/proxy.d.ts +1 -0
- package/types/server/resolver/database.resolver.d.ts +6 -0
- package/types/server/resolver/index.d.ts +3 -0
- package/types/server/resolver/service.resolver.d.ts +7 -0
- package/types/server/resolver/signal.resolver.d.ts +29 -0
- package/types/server/resolver.d.ts +1 -0
- package/types/server/robots.d.ts +1 -0
- package/types/server/routeElementComposer.d.ts +41 -0
- package/types/server/routeTreeBuilder.d.ts +28 -0
- package/types/server/routing/apiRouter.d.ts +61 -0
- package/types/server/rscClient.d.ts +15 -0
- package/types/server/rscWorker.d.ts +3 -0
- package/types/server/rscWorkerHost.d.ts +83 -0
- package/types/server/sitemap.d.ts +13 -0
- package/types/server/ssrFromRscRenderer.d.ts +6 -0
- package/types/server/ssrTypes.d.ts +47 -0
- package/types/server/systemPages.d.ts +27 -0
- package/types/server/types/react-server-dom-webpack.d.ts +91 -0
- package/types/server/types.d.ts +67 -0
- package/types/server/vendor/akanjs-base.d.ts +1 -0
- package/types/server/vendor/akanjs-common.d.ts +1 -0
- package/types/server/vendor/akanjs-constant.d.ts +1 -0
- package/types/server/vendor/akanjs-store.d.ts +1 -0
- package/types/server/vendor/react-dom-client.d.ts +3 -0
- package/types/server/vendor/react-dom.d.ts +3 -0
- package/types/server/vendor/react-jsx-dev-runtime.d.ts +3 -0
- package/types/server/vendor/react-jsx-runtime.d.ts +3 -0
- package/types/server/vendor/react-refresh-runtime.d.ts +3 -0
- package/types/server/vendor/react-server-dom-webpack-client-browser.d.ts +3 -0
- package/types/server/vendor/react.d.ts +11 -0
- package/types/server/vendor/scheduler.d.ts +3 -0
- package/types/server/webRouter.d.ts +44 -0
- package/types/server.d.ts +1 -0
- package/types/service/adapt.d.ts +15 -0
- package/types/service/base.service.d.ts +18 -0
- package/types/service/index.d.ts +10 -0
- package/types/service/injectInfo.d.ts +102 -0
- package/types/service/ipcTypes.d.ts +194 -0
- package/types/service/predefinedAdaptor/cache.adaptor.d.ts +46 -0
- package/types/service/predefinedAdaptor/compress.adaptor.d.ts +22 -0
- package/types/service/predefinedAdaptor/database.adaptor.d.ts +329 -0
- package/types/service/predefinedAdaptor/index.d.ts +13 -0
- package/types/service/predefinedAdaptor/logging.adaptor.d.ts +20 -0
- package/types/service/predefinedAdaptor/queue.adaptor.d.ts +22 -0
- package/types/service/predefinedAdaptor/role.adaptor.d.ts +17 -0
- package/types/service/predefinedAdaptor/schedule.adaptor.d.ts +60 -0
- package/types/service/predefinedAdaptor/solidCache.adaptor.d.ts +25 -0
- package/types/service/predefinedAdaptor/solidPubsub.adaptor.d.ts +20 -0
- package/types/service/predefinedAdaptor/solidQueue.adaptor.d.ts +19 -0
- package/types/service/predefinedAdaptor/solidSqlite.d.ts +24 -0
- package/types/service/predefinedAdaptor/sqlitePath.d.ts +9 -0
- package/types/service/predefinedAdaptor/storage.adaptor.d.ts +80 -0
- package/types/service/predefinedAdaptor/websocket.adaptor.d.ts +49 -0
- package/types/service/predefinedAdaptor.d.ts +1 -0
- package/types/service/serve.d.ts +31 -0
- package/types/service/serviceModule.d.ts +50 -0
- package/types/service/serviceRegistry.d.ts +9 -0
- package/types/service/types.d.ts +55 -0
- package/types/service.d.ts +1 -0
- package/types/signal/base.signal.d.ts +41 -0
- package/types/signal/endpoint.d.ts +28 -0
- package/types/signal/endpointInfo.d.ts +77 -0
- package/types/signal/exception.d.ts +54786 -0
- package/types/signal/guard.d.ts +10 -0
- package/types/signal/guards.d.ts +10 -0
- package/types/signal/index.d.ts +19 -0
- package/types/signal/intercept.d.ts +17 -0
- package/types/signal/internal.d.ts +18 -0
- package/types/signal/internalArg.d.ts +31 -0
- package/types/signal/internalInfo.d.ts +45 -0
- package/types/signal/middleware.d.ts +51 -0
- package/types/signal/serializer/fetch.serializer.d.ts +14 -0
- package/types/signal/serializer/index.d.ts +1 -0
- package/types/signal/serializer.d.ts +1 -0
- package/types/signal/serverSignal.d.ts +36 -0
- package/types/signal/signalContext.d.ts +96 -0
- package/types/signal/signalRegistry.d.ts +49 -0
- package/types/signal/slice.d.ts +42 -0
- package/types/signal/sliceInfo.d.ts +51 -0
- package/types/signal/trace.d.ts +97 -0
- package/types/signal/types.d.ts +142 -0
- package/types/signal.d.ts +1 -0
- package/types/store/action.d.ts +145 -0
- package/types/store/baseSt.d.ts +412 -0
- package/types/store/hooks.d.ts +1 -0
- package/types/store/index.d.ts +8 -0
- package/types/store/rootStore.d.ts +22 -0
- package/types/store/state.d.ts +91 -0
- package/types/store/stateBuilder.d.ts +141 -0
- package/types/store/stateInfo.d.ts +23 -0
- package/types/store/store.d.ts +36 -0
- package/types/store/storeInstance.d.ts +38 -0
- package/types/store/storeRegistry.d.ts +13 -0
- package/types/store/types.d.ts +42 -0
- package/types/store/withSelector.d.ts +42 -0
- package/types/store.d.ts +1 -0
- package/types/test/index.d.ts +4 -0
- package/types/test/playwright.config.base.d.ts +9 -0
- package/types/test/playwright.pageAgent.d.ts +12 -0
- package/types/test/sample.d.ts +15 -0
- package/types/test/sampleOf.d.ts +5 -0
- package/types/test/signalTest.preload.d.ts +1 -0
- package/types/test/signalTestRuntime.d.ts +29 -0
- package/types/test/testServer.d.ts +26 -0
- package/types/test.d.ts +1 -0
- package/types/ui/BottomSheet.d.ts +13 -0
- package/types/ui/Button.d.ts +11 -0
- package/types/ui/ClientSide.d.ts +8 -0
- package/types/ui/Clipboard.d.ts +7 -0
- package/types/ui/Constant/Doc.d.ts +29 -0
- package/types/ui/Constant/Mermaid.d.ts +8 -0
- package/types/ui/Constant/index.d.ts +6 -0
- package/types/ui/Constant/schemaDoc.d.ts +84 -0
- package/types/ui/Constant.d.ts +1 -0
- package/types/ui/Copy.d.ts +10 -0
- package/types/ui/CsrImage.d.ts +18 -0
- package/types/ui/Data/CardList.d.ts +36 -0
- package/types/ui/Data/Dashboard.d.ts +11 -0
- package/types/ui/Data/Insight.d.ts +9 -0
- package/types/ui/Data/Item.d.ts +75 -0
- package/types/ui/Data/ListContainer.d.ts +49 -0
- package/types/ui/Data/Pagination.d.ts +9 -0
- package/types/ui/Data/QueryMaker.d.ts +8 -0
- package/types/ui/Data/TableList.d.ts +26 -0
- package/types/ui/Data/index.d.ts +9 -0
- package/types/ui/Data/index_.d.ts +8 -0
- package/types/ui/Data.d.ts +1 -0
- package/types/ui/DatePicker.d.ts +36 -0
- package/types/ui/Dialog/Action.d.ts +5 -0
- package/types/ui/Dialog/Close.d.ts +6 -0
- package/types/ui/Dialog/Content.d.ts +6 -0
- package/types/ui/Dialog/Modal.d.ts +9 -0
- package/types/ui/Dialog/Provider.d.ts +11 -0
- package/types/ui/Dialog/Title.d.ts +5 -0
- package/types/ui/Dialog/Trigger.d.ts +6 -0
- package/types/ui/Dialog/context.d.ts +10 -0
- package/types/ui/Dialog/index.d.ts +9 -0
- package/types/ui/Dialog.d.ts +1 -0
- package/types/ui/DragAction.d.ts +24 -0
- package/types/ui/DraggableList.d.ts +31 -0
- package/types/ui/Dropdown.d.ts +14 -0
- package/types/ui/Empty.d.ts +12 -0
- package/types/ui/Field.d.ts +411 -0
- package/types/ui/FontFace.d.ts +6 -0
- package/types/ui/Image.d.ts +49 -0
- package/types/ui/InfiniteScroll.d.ts +10 -0
- package/types/ui/Input.d.ts +95 -0
- package/types/ui/KeyboardAvoiding.d.ts +8 -0
- package/types/ui/Layout/BottomAction.d.ts +6 -0
- package/types/ui/Layout/BottomInset.d.ts +7 -0
- package/types/ui/Layout/BottomTab.d.ts +14 -0
- package/types/ui/Layout/Header.d.ts +8 -0
- package/types/ui/Layout/LeftSider.d.ts +9 -0
- package/types/ui/Layout/Navbar.d.ts +11 -0
- package/types/ui/Layout/RightSider.d.ts +10 -0
- package/types/ui/Layout/Sider.d.ts +7 -0
- package/types/ui/Layout/Template.d.ts +7 -0
- package/types/ui/Layout/TopLeftAction.d.ts +6 -0
- package/types/ui/Layout/Unit.d.ts +9 -0
- package/types/ui/Layout/View.d.ts +8 -0
- package/types/ui/Layout/Zone.d.ts +6 -0
- package/types/ui/Layout/index.d.ts +14 -0
- package/types/ui/Layout.d.ts +1 -0
- package/types/ui/Link/Back.d.ts +7 -0
- package/types/ui/Link/Close.d.ts +7 -0
- package/types/ui/Link/CsrLink.d.ts +2 -0
- package/types/ui/Link/Lang.d.ts +8 -0
- package/types/ui/Link/SsrLink.d.ts +2 -0
- package/types/ui/Link/index.d.ts +10 -0
- package/types/ui/Link/types.d.ts +42 -0
- package/types/ui/Link.d.ts +1 -0
- package/types/ui/Load/Edit.d.ts +4 -0
- package/types/ui/Load/Edit_Client.d.ts +27 -0
- package/types/ui/Load/Page.d.ts +15 -0
- package/types/ui/Load/PageCSR.d.ts +3 -0
- package/types/ui/Load/Pagination.d.ts +8 -0
- package/types/ui/Load/Units.d.ts +30 -0
- package/types/ui/Load/View.d.ts +22 -0
- package/types/ui/Load/index.d.ts +8 -0
- package/types/ui/Load/index_.d.ts +3 -0
- package/types/ui/Load.d.ts +1 -0
- package/types/ui/Loading/Area.d.ts +1 -0
- package/types/ui/Loading/Button.d.ts +7 -0
- package/types/ui/Loading/Input.d.ts +7 -0
- package/types/ui/Loading/ProgressBar.d.ts +6 -0
- package/types/ui/Loading/Skeleton.d.ts +7 -0
- package/types/ui/Loading/Spin.d.ts +7 -0
- package/types/ui/Loading/index.d.ts +8 -0
- package/types/ui/Loading.d.ts +1 -0
- package/types/ui/Menu.d.ts +26 -0
- package/types/ui/Modal.d.ts +19 -0
- package/types/ui/Model/AdminPanel.d.ts +31 -0
- package/types/ui/Model/Edit.d.ts +16 -0
- package/types/ui/Model/EditModal.d.ts +52 -0
- package/types/ui/Model/EditWrapper.d.ts +13 -0
- package/types/ui/Model/LoadInit.d.ts +10 -0
- package/types/ui/Model/New.d.ts +16 -0
- package/types/ui/Model/NewWrapper.d.ts +13 -0
- package/types/ui/Model/NewWrapper_Client.d.ts +13 -0
- package/types/ui/Model/Remove.d.ts +13 -0
- package/types/ui/Model/RemoveWrapper.d.ts +12 -0
- package/types/ui/Model/SureToRemove.d.ts +11 -0
- package/types/ui/Model/View.d.ts +19 -0
- package/types/ui/Model/ViewEditModal.d.ts +12 -0
- package/types/ui/Model/ViewModal.d.ts +14 -0
- package/types/ui/Model/ViewWrapper.d.ts +12 -0
- package/types/ui/Model/index.d.ts +16 -0
- package/types/ui/Model/index_.d.ts +14 -0
- package/types/ui/Model.d.ts +1 -0
- package/types/ui/More.d.ts +12 -0
- package/types/ui/ObjectId.d.ts +5 -0
- package/types/ui/Pagination.d.ts +20 -0
- package/types/ui/Popconfirm.d.ts +28 -0
- package/types/ui/Portal.d.ts +6 -0
- package/types/ui/Radio.d.ts +19 -0
- package/types/ui/RecentTime.d.ts +12 -0
- package/types/ui/Refresh.d.ts +7 -0
- package/types/ui/ScreenNavigator.d.ts +18 -0
- package/types/ui/Select.d.ts +43 -0
- package/types/ui/Signal/Arg.d.ts +78 -0
- package/types/ui/Signal/Doc.d.ts +33 -0
- package/types/ui/Signal/Listener.d.ts +9 -0
- package/types/ui/Signal/Message.d.ts +23 -0
- package/types/ui/Signal/Object.d.ts +20 -0
- package/types/ui/Signal/PubSub.d.ts +24 -0
- package/types/ui/Signal/Request.d.ts +8 -0
- package/types/ui/Signal/Response.d.ts +14 -0
- package/types/ui/Signal/RestApi.d.ts +40 -0
- package/types/ui/Signal/WebSocket.d.ts +11 -0
- package/types/ui/Signal/index.d.ts +18 -0
- package/types/ui/Signal/makeExample.d.ts +4 -0
- package/types/ui/Signal/style.d.ts +15 -0
- package/types/ui/Signal.d.ts +1 -0
- package/types/ui/System/CSR.d.ts +32 -0
- package/types/ui/System/Client.d.ts +47 -0
- package/types/ui/System/Common.d.ts +47 -0
- package/types/ui/System/DevModeToggle.d.ts +1 -0
- package/types/ui/System/Gtag.d.ts +4 -0
- package/types/ui/System/Messages.d.ts +1 -0
- package/types/ui/System/Reconnect.d.ts +1 -0
- package/types/ui/System/Root.d.ts +6 -0
- package/types/ui/System/SSR.d.ts +24 -0
- package/types/ui/System/SelectLanguage.d.ts +5 -0
- package/types/ui/System/ThemeToggle.d.ts +4 -0
- package/types/ui/System/index.d.ts +12 -0
- package/types/ui/System.d.ts +1 -0
- package/types/ui/Tab/Menu.d.ts +12 -0
- package/types/ui/Tab/Menus.d.ts +6 -0
- package/types/ui/Tab/Panel.d.ts +8 -0
- package/types/ui/Tab/Provider.d.ts +10 -0
- package/types/ui/Tab/context.d.ts +9 -0
- package/types/ui/Tab/index.d.ts +7 -0
- package/types/ui/Tab.d.ts +1 -0
- package/types/ui/Table.d.ts +41 -0
- package/types/ui/ToggleSelect.d.ts +33 -0
- package/types/ui/Unauthorized.d.ts +9 -0
- package/types/ui/animated.d.ts +5 -0
- package/types/ui/fontCss.d.ts +11 -0
- package/types/ui/index.d.ts +44 -0
- package/types/ui.d.ts +1 -0
- package/types/webkit/bootCsr.d.ts +16 -0
- package/types/webkit/createRobotPage.d.ts +15 -0
- package/types/webkit/createSitemapPage.d.ts +4 -0
- package/types/webkit/index.d.ts +17 -0
- package/types/webkit/lazy.d.ts +11 -0
- package/types/webkit/types.d.ts +7 -0
- package/types/webkit/useCamera.d.ts +19 -0
- package/types/webkit/useCodepush.d.ts +16 -0
- package/types/webkit/useContact.d.ts +11 -0
- package/types/webkit/useCsrValues.d.ts +30 -0
- package/types/webkit/useDebounce.d.ts +2 -0
- package/types/webkit/useFetch.d.ts +18 -0
- package/types/webkit/useGeoLocation.d.ts +8 -0
- package/types/webkit/useHistory.d.ts +23 -0
- package/types/webkit/useInterval.d.ts +2 -0
- package/types/webkit/useLocation.d.ts +8 -0
- package/types/webkit/usePurchase.d.ts +19 -0
- package/types/webkit/usePushNoti.d.ts +7 -0
- package/types/webkit/useThrottle.d.ts +2 -0
- package/types/webkit.d.ts +1 -0
- package/ui/BottomSheet.tsx +1 -1
- package/ui/Clipboard.tsx +1 -1
- package/ui/CsrImage.tsx +3 -14
- package/ui/Data/ListContainer.tsx +1 -1
- package/ui/Data/Pagination.tsx +1 -1
- package/ui/Data/QueryMaker.tsx +0 -339
- package/ui/Data/index.ts +0 -1
- package/ui/DatePicker.tsx +1 -95
- package/ui/Dialog/Modal.tsx +1 -1
- package/ui/DraggableList.tsx +5 -5
- package/ui/Field.tsx +2 -3
- package/ui/Image.tsx +2 -3
- package/ui/InfiniteScroll.tsx +0 -1
- package/ui/Input.tsx +1 -8
- package/ui/Layout/BottomTab.tsx +2 -2
- package/ui/Link/SsrLink.tsx +1 -2
- package/ui/Load/Page.tsx +1 -1
- package/ui/Load/PageCSR.tsx +0 -1
- package/ui/Load/Units.tsx +1 -2
- package/ui/Load/View.tsx +1 -2
- package/ui/Menu.tsx +5 -8
- package/ui/Model/EditModal.tsx +2 -5
- package/ui/Popconfirm.tsx +2 -4
- package/ui/ScreenNavigator.tsx +2 -3
- package/ui/Signal/Message.tsx +2 -3
- package/ui/Signal/PubSub.tsx +0 -2
- package/ui/Signal/Response.tsx +1 -1
- package/ui/Signal/WebSocket.tsx +2 -11
- package/ui/System/Client.tsx +7 -41
- package/ui/System/Gtag.tsx +2 -5
- package/ui/System/Messages.tsx +2 -2
- package/ui/System/Reconnect.tsx +5 -6
- package/ui/System/Root.tsx +0 -1
- package/ui/System/SSR.tsx +1 -7
- package/ui/ToggleSelect.tsx +3 -8
- package/ui/Unauthorized.tsx +1 -1
- package/webkit/bootCsr.tsx +3 -6
- package/webkit/lazy.tsx +1 -8
- package/webkit/useCamera.tsx +0 -1
- package/webkit/useCodepush.tsx +4 -9
- package/webkit/useContact.tsx +0 -1
- package/webkit/useCsrValues.ts +6 -10
- package/webkit/useDebounce.ts +2 -2
- package/webkit/usePurchase.tsx +5 -9
- package/webkit/usePushNoti.tsx +0 -1
- package/base/base.test.ts +0 -135
- package/base/baseEnv.test.ts +0 -146
- package/base/primitiveRegistry.test.ts +0 -127
- package/base/symbols.test.ts +0 -29
- package/base/utils.test.ts +0 -30
- package/build.ts +0 -318
- package/capacitor.base.config.test.ts +0 -83
- package/client/client.auth-storage.test.ts +0 -210
- package/client/client.decorators.test.ts +0 -74
- package/client/client.device.test.ts +0 -181
- package/client/client.page.test.tsx +0 -175
- package/client/client.pure.test.ts +0 -146
- package/client/client.router.test.ts +0 -290
- package/common/Logger.test.ts +0 -45
- package/common/formatAndValidation.test.ts +0 -61
- package/common/httpClient.test.ts +0 -91
- package/common/objectPath.test.ts +0 -108
- package/common/routeConvention.test.ts +0 -132
- package/common/runtimeConfig.test.ts +0 -84
- package/constant/constant.test.ts +0 -374
- package/dictionary/dictionary.test.ts +0 -352
- package/document/document.test.ts +0 -698
- package/fetch/fetch.test.ts +0 -838
- package/server/akanApp.test.ts +0 -130
- package/server/akanServer.test.ts +0 -157
- package/server/artifact/routeClientCache.test.ts +0 -265
- package/server/artifact/routeSeedIndex.test.ts +0 -56
- package/server/artifact/routesManifest.test.ts +0 -64
- package/server/di/diLifecycle.contract.test.ts +0 -168
- package/server/logging/rotatingLogWriter.test.ts +0 -119
- package/server/processMetrics.test.ts +0 -24
- package/server/proxy/webProxyRunner.test.ts +0 -66
- package/server/resolver/resolver.contract.test.ts +0 -594
- package/server/robots.test.ts +0 -16
- package/server/routeTree.test.tsx +0 -198
- package/server/routing/apiRouter.test.ts +0 -136
- package/server/sitemap.test.ts +0 -61
- package/server/systemPages.test.tsx +0 -93
- package/server/webRouter.test.ts +0 -49
- package/service/predefinedAdaptor/compress.adaptor.test.ts +0 -184
- package/service/predefinedAdaptor/solidCache.adaptor.test.ts +0 -107
- package/service/predefinedAdaptor/solidSqlite.test.ts +0 -457
- package/service/service.test.ts +0 -732
- package/signal/signal.test.ts +0 -892
- package/store/stateBuilder.test.ts +0 -168
- package/store/store.test.ts +0 -427
- package/tsconfig.json +0 -5
- package/ui/Constant/schemaDoc.test.ts +0 -113
- package/ui/InfiniteScroll.test.tsx +0 -155
- package/ui/System/Common.test.ts +0 -37
- package/webkit/bootCsr.test.tsx +0 -153
- package/webkit/native.test.tsx +0 -341
- package/webkit/webkit.test.tsx +0 -531
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ConstantCls } from "akanjs/constant";
|
|
2
|
+
import type { DatabaseCls, ExtractSort, FilterCls, FilterInstance } from ".";
|
|
3
|
+
import type { ModelCls } from "./loaderInfo.d.ts";
|
|
4
|
+
export interface DatabaseModel<T extends string = string, Input = any, Doc = any, Model = any, Obj = any, Insight = any, Filter extends FilterInstance = any, _Sort extends ExtractSort<Filter> = ExtractSort<Filter>> {
|
|
5
|
+
refName: T;
|
|
6
|
+
input: DatabaseCls<Input>;
|
|
7
|
+
doc: DatabaseCls<Doc>;
|
|
8
|
+
model: ModelCls<Model>;
|
|
9
|
+
filter: FilterCls<Filter>;
|
|
10
|
+
obj: ConstantCls<Obj>;
|
|
11
|
+
insight: ConstantCls<Insight>;
|
|
12
|
+
_Input: Input;
|
|
13
|
+
_Doc: Doc;
|
|
14
|
+
_Model: Model;
|
|
15
|
+
_Obj: Obj;
|
|
16
|
+
_Insight: Insight;
|
|
17
|
+
_Filter: Filter;
|
|
18
|
+
_Sort: _Sort;
|
|
19
|
+
}
|
|
20
|
+
export declare class DatabaseRegistry {
|
|
21
|
+
#private;
|
|
22
|
+
static isInput(modelRef: DatabaseCls): boolean;
|
|
23
|
+
static isDoc(modelRef: DatabaseCls): boolean;
|
|
24
|
+
static isModel(modelRef: DatabaseCls): boolean;
|
|
25
|
+
static isScalar(modelRef: DatabaseCls): boolean;
|
|
26
|
+
static setDatabase(refName: string, dbModel: DatabaseModel): DatabaseModel<string, any, any, any, any, any, any, string | number | symbol>;
|
|
27
|
+
static getDatabase<AllowEmpty extends boolean = false>(refName: string, { allowEmpty }?: {
|
|
28
|
+
allowEmpty?: AllowEmpty;
|
|
29
|
+
}): AllowEmpty extends true ? DatabaseModel | undefined : DatabaseModel;
|
|
30
|
+
static setScalar(refName: string, Model: DatabaseCls): void;
|
|
31
|
+
static getScalar<AllowEmpty extends boolean = false>(refName: string, { allowEmpty }?: {
|
|
32
|
+
allowEmpty?: AllowEmpty;
|
|
33
|
+
}): AllowEmpty extends true ? DatabaseCls | undefined : DatabaseCls;
|
|
34
|
+
static buildModel<T extends string, Input, Doc, Model, Obj, Insight, Filter extends FilterInstance, _Sort extends ExtractSort<Filter> = ExtractSort<Filter>>(refName: T, input: DatabaseCls<Input>, doc: DatabaseCls<Doc>, model: ModelCls<Model>, obj: ConstantCls<Obj>, insight: ConstantCls<Insight>, filter: FilterCls<Filter>): DatabaseModel<T, Input, Doc, Model, Obj, Insight, Filter, _Sort>;
|
|
35
|
+
static buildScalar<T extends string, Model>(refName: T, Model: DatabaseCls<Model>): DatabaseCls<Model>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { type Dayjs } from "akanjs/base";
|
|
2
|
+
export type DocumentId = string & {
|
|
3
|
+
readonly __brand: "DocumentId";
|
|
4
|
+
};
|
|
5
|
+
export declare const createDocumentId: (now?: number) => DocumentId;
|
|
6
|
+
export declare const isDocumentId: (value: unknown) => value is DocumentId;
|
|
7
|
+
export type DocumentPrimitive = string | number | boolean | null | Dayjs | Date;
|
|
8
|
+
export type DocumentPath<T = any> = Extract<keyof T, string> | (string & {});
|
|
9
|
+
export type DocumentQueryNode = {
|
|
10
|
+
kind: "all";
|
|
11
|
+
queries: DocumentQuery[];
|
|
12
|
+
} | {
|
|
13
|
+
kind: "any";
|
|
14
|
+
queries: DocumentQuery[];
|
|
15
|
+
} | {
|
|
16
|
+
kind: "not";
|
|
17
|
+
query: DocumentQuery;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "op";
|
|
20
|
+
op: DocumentQueryOperator;
|
|
21
|
+
value?: unknown;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "raw";
|
|
24
|
+
sql: string;
|
|
25
|
+
params: unknown[];
|
|
26
|
+
};
|
|
27
|
+
export type DocumentQueryOperator = "eq" | "ne" | "oneOf" | "notOneOf" | "gt" | "gte" | "lt" | "lte" | "between" | "exists" | "missing" | "empty" | "has" | "contains";
|
|
28
|
+
export type DocumentQueryValue = DocumentPrimitive | DocumentPrimitive[] | DocumentQueryNode | undefined | Record<string, unknown>;
|
|
29
|
+
export interface DocumentUpdate {
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
set?: Record<string, unknown>;
|
|
32
|
+
unset?: Record<string, unknown> | string[];
|
|
33
|
+
addToSet?: Record<string, unknown>;
|
|
34
|
+
pull?: Record<string, unknown>;
|
|
35
|
+
push?: Record<string, unknown>;
|
|
36
|
+
inc?: Record<string, number>;
|
|
37
|
+
setOnInsert?: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
export interface DocumentUpdateOptions {
|
|
40
|
+
upsert?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export type DocumentQuery<T = any> = DocumentQueryNode | {
|
|
43
|
+
[K in DocumentPath<T>]?: DocumentQueryValue;
|
|
44
|
+
};
|
|
45
|
+
export interface SqlFragment {
|
|
46
|
+
sql: string;
|
|
47
|
+
params: unknown[];
|
|
48
|
+
}
|
|
49
|
+
export declare const createDocumentQueryHelper: () => {
|
|
50
|
+
all: (...queries: (DocumentQuery | null | undefined | false)[]) => DocumentQueryNode;
|
|
51
|
+
any: (...queries: (DocumentQuery | null | undefined | false)[]) => DocumentQueryNode;
|
|
52
|
+
not: (query: DocumentQuery) => DocumentQueryNode;
|
|
53
|
+
eq: (value: unknown) => DocumentQueryNode;
|
|
54
|
+
ne: (value: unknown) => DocumentQueryNode;
|
|
55
|
+
oneOf: (values: readonly unknown[]) => DocumentQueryNode;
|
|
56
|
+
notOneOf: (values: readonly unknown[]) => DocumentQueryNode;
|
|
57
|
+
gt: (value: unknown) => DocumentQueryNode;
|
|
58
|
+
gte: (value: unknown) => DocumentQueryNode;
|
|
59
|
+
lt: (value: unknown) => DocumentQueryNode;
|
|
60
|
+
lte: (value: unknown) => DocumentQueryNode;
|
|
61
|
+
between: (from: unknown, to: unknown) => DocumentQueryNode;
|
|
62
|
+
exists: (path: string) => {
|
|
63
|
+
[x: string]: DocumentQueryNode;
|
|
64
|
+
};
|
|
65
|
+
missing: (path: string) => {
|
|
66
|
+
[x: string]: DocumentQueryNode;
|
|
67
|
+
};
|
|
68
|
+
empty: (path: string) => {
|
|
69
|
+
[x: string]: DocumentQueryNode;
|
|
70
|
+
};
|
|
71
|
+
has: (value: unknown) => DocumentQueryNode;
|
|
72
|
+
contains: (value: unknown) => DocumentQueryNode;
|
|
73
|
+
raw: (sql: string, params?: unknown[]) => DocumentQueryNode;
|
|
74
|
+
when: (condition: unknown, query: DocumentQuery) => DocumentQuery;
|
|
75
|
+
};
|
|
76
|
+
export type DocumentQueryHelper = ReturnType<typeof createDocumentQueryHelper>;
|
|
77
|
+
export declare const documentQueryHelper: {
|
|
78
|
+
all: (...queries: (DocumentQuery | null | undefined | false)[]) => DocumentQueryNode;
|
|
79
|
+
any: (...queries: (DocumentQuery | null | undefined | false)[]) => DocumentQueryNode;
|
|
80
|
+
not: (query: DocumentQuery) => DocumentQueryNode;
|
|
81
|
+
eq: (value: unknown) => DocumentQueryNode;
|
|
82
|
+
ne: (value: unknown) => DocumentQueryNode;
|
|
83
|
+
oneOf: (values: readonly unknown[]) => DocumentQueryNode;
|
|
84
|
+
notOneOf: (values: readonly unknown[]) => DocumentQueryNode;
|
|
85
|
+
gt: (value: unknown) => DocumentQueryNode;
|
|
86
|
+
gte: (value: unknown) => DocumentQueryNode;
|
|
87
|
+
lt: (value: unknown) => DocumentQueryNode;
|
|
88
|
+
lte: (value: unknown) => DocumentQueryNode;
|
|
89
|
+
between: (from: unknown, to: unknown) => DocumentQueryNode;
|
|
90
|
+
exists: (path: string) => {
|
|
91
|
+
[x: string]: DocumentQueryNode;
|
|
92
|
+
};
|
|
93
|
+
missing: (path: string) => {
|
|
94
|
+
[x: string]: DocumentQueryNode;
|
|
95
|
+
};
|
|
96
|
+
empty: (path: string) => {
|
|
97
|
+
[x: string]: DocumentQueryNode;
|
|
98
|
+
};
|
|
99
|
+
has: (value: unknown) => DocumentQueryNode;
|
|
100
|
+
contains: (value: unknown) => DocumentQueryNode;
|
|
101
|
+
raw: (sql: string, params?: unknown[]) => DocumentQueryNode;
|
|
102
|
+
when: (condition: unknown, query: DocumentQuery) => DocumentQuery;
|
|
103
|
+
};
|
|
104
|
+
export declare const encodeDocumentValue: (value: unknown) => unknown;
|
|
105
|
+
export declare const sanitizeJson: (value: unknown) => unknown;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PromiseOrObject } from "akanjs/base";
|
|
2
|
+
import type { DocumentQuery, DocumentQueryHelper } from "./documentQuery.d.ts";
|
|
3
|
+
import type { CRUDEventType, SaveEventType } from "./into.d.ts";
|
|
4
|
+
export type DocumentHookName = `before${Capitalize<SaveEventType>}` | `after${Capitalize<SaveEventType>}`;
|
|
5
|
+
export interface DocumentIndexDescriptor {
|
|
6
|
+
name?: string;
|
|
7
|
+
fields: Record<string, 1 | -1 | "text" | boolean>;
|
|
8
|
+
unique?: boolean;
|
|
9
|
+
text?: boolean;
|
|
10
|
+
where?: DocumentQuery;
|
|
11
|
+
}
|
|
12
|
+
export interface DocumentIndexBuilder<Schema> {
|
|
13
|
+
path(path: string, order?: 1 | -1): DocumentIndexBuilder<Schema>;
|
|
14
|
+
text(path: string): DocumentIndexBuilder<Schema>;
|
|
15
|
+
unique(): DocumentIndexBuilder<Schema>;
|
|
16
|
+
where(where: DocumentQuery | ((q: DocumentQueryHelper) => DocumentQuery)): DocumentIndexBuilder<Schema>;
|
|
17
|
+
done(): Schema;
|
|
18
|
+
}
|
|
19
|
+
export type DocumentSaveHook<Doc = unknown> = (this: Doc, next?: () => void, type?: CRUDEventType) => PromiseOrObject<void>;
|
|
20
|
+
export declare class DocumentSchema<Doc = unknown> {
|
|
21
|
+
readonly preHooks: Map<SaveEventType, DocumentSaveHook<Doc>[]>;
|
|
22
|
+
readonly postHooks: Map<SaveEventType, DocumentSaveHook<Doc>[]>;
|
|
23
|
+
readonly indexes: DocumentIndexDescriptor[];
|
|
24
|
+
pre<HookDoc = Doc>(type: SaveEventType, hook: DocumentSaveHook<HookDoc>): this;
|
|
25
|
+
post<HookDoc = Doc>(type: SaveEventType, hook: DocumentSaveHook<HookDoc>): this;
|
|
26
|
+
hook(type: DocumentHookName, hook: DocumentSaveHook<Doc>): this;
|
|
27
|
+
index(fields: DocumentIndexDescriptor["fields"], options?: Omit<DocumentIndexDescriptor, "fields">): this;
|
|
28
|
+
text(...fields: string[]): this;
|
|
29
|
+
createIndex(name: string): DocumentIndexBuilder<this>;
|
|
30
|
+
}
|
|
31
|
+
export type SchemaOf<Mdl = unknown, Doc = unknown> = DocumentSchema<Doc> & {
|
|
32
|
+
readonly __model?: Mdl;
|
|
33
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Cls, MergeAllDoubleKeyOfObjects, MergeAllKeyOfTypes } from "akanjs/base";
|
|
2
|
+
import { FILTER_META } from "akanjs/base";
|
|
3
|
+
import type { BaseObject, ConstantFieldTypeInput, DocumentModel, FieldToValue, PlainTypeToFieldType, QueryOf, Serialized } from "akanjs/constant";
|
|
4
|
+
import type { DocumentQuery, DocumentQueryHelper } from "./documentQuery.d.ts";
|
|
5
|
+
import type { ConstantFilterMeta } from "./types.d.ts";
|
|
6
|
+
export declare const isFilterModel: (filterRef: Cls<unknown, {
|
|
7
|
+
[FILTER_META]?: ConstantFilterMeta;
|
|
8
|
+
}>) => boolean;
|
|
9
|
+
export declare const getFilterMeta: <AllowEmpty extends boolean = false>(filterRef: Cls<unknown, {
|
|
10
|
+
[FILTER_META]?: ConstantFilterMeta;
|
|
11
|
+
}> | FilterCls, { allowEmpty }?: {
|
|
12
|
+
allowEmpty?: AllowEmpty;
|
|
13
|
+
}) => AllowEmpty extends true ? ConstantFilterMeta | undefined : ConstantFilterMeta;
|
|
14
|
+
export declare const setFilterMeta: (filterRef: Cls<unknown, {
|
|
15
|
+
[FILTER_META]?: ConstantFilterMeta;
|
|
16
|
+
sortField: Set<string>;
|
|
17
|
+
}>, filterMeta: ConstantFilterMeta, ...libFilterMetas: ConstantFilterMeta[]) => void;
|
|
18
|
+
export declare const getFilterInfoByKey: <ArgNames extends string[] = [], Args extends any[] = any[], Model = any>(modelRef: FilterCls, key: string) => FilterInfo<ArgNames, Args, Model>;
|
|
19
|
+
export declare const setFilterInfoByKey: <ArgNames extends string[] = [], Args extends any[] = any[], Model = any>(modelRef: Cls<Model>, key: string, filterInfo: FilterInfo<ArgNames, Args, Model>) => void;
|
|
20
|
+
export declare const getFilterSortByKey: (modelRef: FilterCls, key: string) => unknown;
|
|
21
|
+
export declare const fillMissingFilterArgs: (filterInfo: FilterInfo, args: unknown[]) => any[];
|
|
22
|
+
export type BaseFilterSortKey = "latest" | "oldest";
|
|
23
|
+
export type BaseFilterQueryKey = "any";
|
|
24
|
+
export type BaseFilterKey = BaseFilterSortKey | BaseFilterQueryKey;
|
|
25
|
+
export type FilterInstance<Query extends {
|
|
26
|
+
[key: string]: FilterInfo;
|
|
27
|
+
} = {}, Sort extends {
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
} = {}> = {
|
|
30
|
+
query: Query;
|
|
31
|
+
sort: Sort;
|
|
32
|
+
};
|
|
33
|
+
interface BaseQuery<Model> {
|
|
34
|
+
any: FilterInfo<[], [], Model>;
|
|
35
|
+
}
|
|
36
|
+
interface BaseSort {
|
|
37
|
+
latest: {
|
|
38
|
+
createdAt: -1;
|
|
39
|
+
};
|
|
40
|
+
oldest: {
|
|
41
|
+
createdAt: 1;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export type ExtractQuery<Filter extends FilterInstance> = {
|
|
45
|
+
[K in keyof Filter["query"]]: Filter["query"][K] extends FilterInfo<any, infer Args> ? (...args: Args) => QueryOf<any> : never;
|
|
46
|
+
};
|
|
47
|
+
export type ExtractSort<Filter extends FilterInstance> = keyof Filter["sort"];
|
|
48
|
+
export interface FilterCls<Filter extends FilterInstance = any> extends Cls<{
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
}> {
|
|
51
|
+
[FILTER_META]: Filter;
|
|
52
|
+
sortField: Set<string>;
|
|
53
|
+
}
|
|
54
|
+
export declare const from: <Full extends BaseObject, BuildFilter extends (filter: () => FilterInfo<[], [], Full>) => FilterInstance, LibFilters extends FilterCls[], _Filter extends ReturnType<BuildFilter>>(modelRef: Cls<Full>, buildFilter: BuildFilter, ...libFilterRefs: LibFilters) => Cls<{
|
|
55
|
+
query: BaseQuery<Full> & MergeAllDoubleKeyOfObjects<LibFilters, typeof FILTER_META, "query"> & _Filter["query"];
|
|
56
|
+
sort: BaseSort & MergeAllKeyOfTypes<LibFilters, "sort"> & _Filter["sort"];
|
|
57
|
+
}, {
|
|
58
|
+
[FILTER_META]: {
|
|
59
|
+
query: BaseQuery<Full> & MergeAllDoubleKeyOfObjects<LibFilters, typeof FILTER_META, "query"> & _Filter["query"];
|
|
60
|
+
sort: BaseSort & MergeAllKeyOfTypes<LibFilters, "sort"> & _Filter["sort"];
|
|
61
|
+
};
|
|
62
|
+
sortField: Set<string>;
|
|
63
|
+
}>;
|
|
64
|
+
interface ArgProps<Value = unknown> {
|
|
65
|
+
nullable?: boolean;
|
|
66
|
+
ref?: string;
|
|
67
|
+
default?: Value;
|
|
68
|
+
renderOption?: (arg: never) => string;
|
|
69
|
+
}
|
|
70
|
+
export declare class FilterInfo<ArgNames extends string[] = any, Args extends any[] = any, Model = any> {
|
|
71
|
+
readonly argNames: ArgNames;
|
|
72
|
+
readonly args: {
|
|
73
|
+
name: string;
|
|
74
|
+
argRef: ConstantFieldTypeInput;
|
|
75
|
+
option?: ArgProps;
|
|
76
|
+
}[];
|
|
77
|
+
queryFn: ((...args: [...Args, q: DocumentQueryHelper]) => DocumentQuery<Model>) | null;
|
|
78
|
+
constructor();
|
|
79
|
+
arg<ExplicitType, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, ArgName extends string = "unknown", _FieldToValue = DocumentModel<FieldToValue<Arg>>>(name: ArgName, argRef: Arg, option?: Omit<ArgProps<_FieldToValue>, "nullable">): FilterInfo<[...ArgNames, ArgName], [...Args, arg: _FieldToValue], Model>;
|
|
80
|
+
opt<ExplicitType, Arg extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>, ArgName extends string = "unknown", _FieldToValue = DocumentModel<FieldToValue<Arg>>>(name: ArgName, argRef: Arg, option?: Omit<ArgProps<_FieldToValue>, "nullable">): FilterInfo<[...ArgNames, ArgName], [...Args, opt?: _FieldToValue | null], Model>;
|
|
81
|
+
query(query: (...args: [...Args, q: DocumentQueryHelper]) => DocumentQuery<Serialized<DocumentModel<Model>>>): this;
|
|
82
|
+
}
|
|
83
|
+
export declare const filter: () => FilterInfo<[], [], any>;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./by.d.ts";
|
|
2
|
+
export * from "./database.d.ts";
|
|
3
|
+
export * from "./databaseRegistry.d.ts";
|
|
4
|
+
export * from "./dataLoader.d.ts";
|
|
5
|
+
export * from "./documentQuery.d.ts";
|
|
6
|
+
export * from "./documentSchema.d.ts";
|
|
7
|
+
export * from "./filterMeta.d.ts";
|
|
8
|
+
export * from "./into.d.ts";
|
|
9
|
+
export * from "./loaderInfo.d.ts";
|
|
10
|
+
export * from "./schema.d.ts";
|
|
11
|
+
export * from "./types.d.ts";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type Cls, type MergeAllActionTypes, type PromiseOrObject } from "akanjs/base";
|
|
2
|
+
import type { ConstantModel, DocumentModel, FieldObject, QueryOf } from "akanjs/constant";
|
|
3
|
+
import type { ExtractQuery, ExtractSort, FilterCls, FilterInstance } from ".";
|
|
4
|
+
import type { DatabaseInstance } from "./database.d.ts";
|
|
5
|
+
import type { DocumentUpdate, DocumentUpdateOptions } from "./documentQuery.d.ts";
|
|
6
|
+
import { type LoaderBuilder, type ModelCls } from "./loaderInfo.d.ts";
|
|
7
|
+
export type CRUDEventType = "create" | "update" | "remove";
|
|
8
|
+
export type SaveEventType = "save" | CRUDEventType;
|
|
9
|
+
interface DefaultMdlStats<TDocument, TSchema, _Partial extends Partial<TSchema> = Partial<TSchema>, _FilterQuery extends QueryOf<TSchema> = QueryOf<TSchema>, _Projection extends Partial<Record<keyof TSchema, boolean>> = Partial<Record<keyof TSchema, boolean>>> {
|
|
10
|
+
pickOneAndWrite: (query: _FilterQuery, rawData: _Partial) => Promise<TDocument>;
|
|
11
|
+
pickAndWrite: (docId: string, rawData: _Partial) => Promise<TDocument>;
|
|
12
|
+
pickOne: (query: _FilterQuery, projection?: _Projection) => Promise<TDocument>;
|
|
13
|
+
pickById: (docId: string | undefined, projection?: _Projection) => Promise<TDocument>;
|
|
14
|
+
sample: (query: _FilterQuery, size?: number) => Promise<TDocument[]>;
|
|
15
|
+
sampleOne: (query: _FilterQuery) => Promise<TDocument | null>;
|
|
16
|
+
preSaveListenerSet: Set<(doc: TDocument, type: CRUDEventType) => PromiseOrObject<void>>;
|
|
17
|
+
postSaveListenerSet: Set<(doc: TDocument, type: CRUDEventType) => PromiseOrObject<void>>;
|
|
18
|
+
preCreateListenerSet: Set<(doc: TDocument, type: CRUDEventType) => PromiseOrObject<void>>;
|
|
19
|
+
postCreateListenerSet: Set<(doc: TDocument, type: CRUDEventType) => PromiseOrObject<void>>;
|
|
20
|
+
preUpdateListenerSet: Set<(doc: TDocument, type: CRUDEventType) => PromiseOrObject<void>>;
|
|
21
|
+
postUpdateListenerSet: Set<(doc: TDocument, type: CRUDEventType) => PromiseOrObject<void>>;
|
|
22
|
+
preRemoveListenerSet: Set<(doc: TDocument, type: CRUDEventType) => PromiseOrObject<void>>;
|
|
23
|
+
postRemoveListenerSet: Set<(doc: TDocument, type: CRUDEventType) => PromiseOrObject<void>>;
|
|
24
|
+
listenPre: (eventType: SaveEventType, listener: (doc: TDocument, type: CRUDEventType) => PromiseOrObject<void>) => () => void;
|
|
25
|
+
listenPost: (eventType: SaveEventType, listener: (doc: TDocument, type: CRUDEventType) => PromiseOrObject<void>) => () => void;
|
|
26
|
+
}
|
|
27
|
+
export interface UpdateResult {
|
|
28
|
+
acknowledged: boolean;
|
|
29
|
+
matchedCount: number;
|
|
30
|
+
modifiedCount: number;
|
|
31
|
+
upsertedId?: string | null;
|
|
32
|
+
}
|
|
33
|
+
export interface BulkWriteOperation<Raw> {
|
|
34
|
+
updateOne: {
|
|
35
|
+
filter: QueryOf<DocumentModel<Raw>>;
|
|
36
|
+
update: DocumentUpdate;
|
|
37
|
+
upsert?: boolean;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
type FindManyChain<Doc> = Promise<Doc[]> & {
|
|
41
|
+
sort(sort: Record<string, 1 | -1>): FindManyChain<Doc>;
|
|
42
|
+
skip(skip: number): FindManyChain<Doc>;
|
|
43
|
+
limit(limit: number): FindManyChain<Doc>;
|
|
44
|
+
select(projection?: unknown): FindManyChain<Doc>;
|
|
45
|
+
};
|
|
46
|
+
type FindOneChain<Doc> = Promise<Doc | null> & {
|
|
47
|
+
sort(sort: Record<string, 1 | -1>): FindOneChain<Doc>;
|
|
48
|
+
skip(skip: number): FindOneChain<Doc>;
|
|
49
|
+
select(projection?: unknown): FindOneChain<Doc>;
|
|
50
|
+
};
|
|
51
|
+
export type Mdl<Doc, Raw> = DefaultMdlStats<Doc, DocumentModel<Raw>> & {
|
|
52
|
+
refName: string;
|
|
53
|
+
new (data: Partial<DocumentModel<Raw>>): Doc;
|
|
54
|
+
find(query: QueryOf<DocumentModel<Raw>>, projection?: Partial<Record<keyof Raw, boolean>>): FindManyChain<Doc>;
|
|
55
|
+
findOne(query: QueryOf<DocumentModel<Raw>>, projection?: Partial<Record<keyof Raw, boolean>>): FindOneChain<Doc>;
|
|
56
|
+
findById(id: string | undefined, projection?: Partial<Record<keyof Raw, boolean>>): Promise<Doc | null>;
|
|
57
|
+
countDocuments(query: QueryOf<DocumentModel<Raw>>): Promise<number>;
|
|
58
|
+
exists(query: QueryOf<DocumentModel<Raw>>): Promise<string | null>;
|
|
59
|
+
updateOne(query: QueryOf<DocumentModel<Raw>>, update: DocumentUpdate, options?: DocumentUpdateOptions): Promise<UpdateResult>;
|
|
60
|
+
updateMany(query: QueryOf<DocumentModel<Raw>>, update: DocumentUpdate): Promise<UpdateResult>;
|
|
61
|
+
deleteMany(query: QueryOf<DocumentModel<Raw>>): Promise<UpdateResult>;
|
|
62
|
+
bulkWrite(operations: BulkWriteOperation<Raw>[]): Promise<UpdateResult>;
|
|
63
|
+
};
|
|
64
|
+
export declare const into: <Doc, Filter extends FilterInstance, T extends string, Input, Obj, Full, Light, Insight, FullFieldObj extends FieldObject, AddDbModels extends ModelCls[], _CapitalizedRefName extends string, _Default, _DefaultInput, _DefaultState, _DefaultStateInput, _DefaultInsight, _PurifiedInput, _Doc, _DocInput, _QueryOfDoc, _Query = ExtractQuery<Filter>, _Sort = ExtractSort<Filter>, _DatabaseModel = DatabaseInstance<T, _DocInput, Doc, Full, Insight, Filter, _CapitalizedRefName, _QueryOfDoc, _Query, _Sort>, _LoaderBuilder extends LoaderBuilder<_Doc> = LoaderBuilder<_Doc>>(docRef: Cls<Doc>, filterRef: FilterCls<Filter>, cnst: ConstantModel<T, Input, Obj, Full, Light, Insight, FullFieldObj, _CapitalizedRefName, _Default, _DefaultInput, _DefaultState, _DefaultStateInput, _DefaultInsight, _PurifiedInput, _Doc, _DocInput, _QueryOfDoc>, loaderBuilder: _LoaderBuilder, ...addMdls: [...AddDbModels]) => ModelCls<MergeAllActionTypes<AddDbModels, keyof _DatabaseModel & string> & _DatabaseModel, ReturnType<_LoaderBuilder>>;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Cls, LOADER_META } from "akanjs/base";
|
|
2
|
+
import type { QueryOf } from "akanjs/constant";
|
|
3
|
+
import type { Loader, SchemaOf } from ".";
|
|
4
|
+
type LoaderType = "field" | "arrayField" | "query";
|
|
5
|
+
export type ModelCls<Statics = {}, LoaderMap extends {
|
|
6
|
+
[key: string]: LoaderInfo;
|
|
7
|
+
} = {}> = Cls<Statics & ExtractLoaderInfoObject<LoaderMap>, {
|
|
8
|
+
[LOADER_META]: LoaderMap;
|
|
9
|
+
_onSchema: (schema: SchemaOf<any, any>) => void;
|
|
10
|
+
_libsOnSchema: (schema: SchemaOf<any, any>) => void;
|
|
11
|
+
}>;
|
|
12
|
+
export declare class LoaderInfo<Doc = any, Key extends keyof Doc = keyof Doc, QueryArg = Doc[Key]> {
|
|
13
|
+
type: LoaderType;
|
|
14
|
+
field: Key | Key[];
|
|
15
|
+
defaultQuery: QueryOf<unknown>;
|
|
16
|
+
queryArg: QueryArg | undefined;
|
|
17
|
+
constructor(type: LoaderType, field: Key | Key[], defaultQuery?: QueryOf<unknown>);
|
|
18
|
+
}
|
|
19
|
+
export declare const makeLoaderBuilder: <Doc>() => {
|
|
20
|
+
byField: <Key extends keyof Doc & string>(fieldName: Key, defaultQuery?: QueryOf<unknown>) => LoaderInfo<Doc, Key, Doc[Key]>;
|
|
21
|
+
byArrayField: <Key extends keyof Doc & string>(fieldName: Key, defaultQuery?: QueryOf<unknown>) => LoaderInfo<Doc, Key, Doc[Key]>;
|
|
22
|
+
byQuery: <Key extends keyof Doc & string>(queryKeys: readonly Key[], defaultQuery?: QueryOf<unknown>) => LoaderInfo<Doc, Key, Pick<Doc, Key>>;
|
|
23
|
+
};
|
|
24
|
+
export type LoaderBuilder<Doc = any> = (builder: ReturnType<typeof makeLoaderBuilder<Doc>>) => {
|
|
25
|
+
[key: string]: LoaderInfo<Doc, any, any>;
|
|
26
|
+
};
|
|
27
|
+
export type ExtractLoaderInfoObject<LoaderInfoMap extends {
|
|
28
|
+
[key: string]: LoaderInfo;
|
|
29
|
+
}> = {
|
|
30
|
+
[K in keyof LoaderInfoMap]: LoaderInfoMap[K] extends LoaderInfo<infer Doc, any, infer QueryArg> ? Loader<QueryArg, Doc> : never;
|
|
31
|
+
};
|
|
32
|
+
export declare const getLoaderInfos: (modelRef: ModelCls) => {
|
|
33
|
+
[key: string]: LoaderInfo;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { EnumInstance, GetStateObject } from "akanjs/base";
|
|
2
|
+
import type { FilterInfo } from ".";
|
|
3
|
+
export type DataInputOf<Input = any, Obj = any> = {
|
|
4
|
+
[K in keyof Input as Input[K] extends (...args: any[]) => any ? never : K]: Input[K] extends any[] ? Input[K] | undefined : Input[K];
|
|
5
|
+
} & Partial<Obj>;
|
|
6
|
+
export type GetDocObject<D> = GetStateObject<Omit<D, "set" | "save" | "refresh">>;
|
|
7
|
+
export interface ConstantFilterMeta {
|
|
8
|
+
query: {
|
|
9
|
+
[key: string]: FilterInfo;
|
|
10
|
+
};
|
|
11
|
+
sort: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface FilterKeyProps {
|
|
14
|
+
type?: "database";
|
|
15
|
+
}
|
|
16
|
+
export interface FilterArgProps {
|
|
17
|
+
nullable?: boolean;
|
|
18
|
+
ref?: string;
|
|
19
|
+
default?: string | number | boolean | object | null | (() => string | number | boolean | object | null);
|
|
20
|
+
renderOption?: (value: never) => string;
|
|
21
|
+
enum?: EnumInstance;
|
|
22
|
+
}
|
|
23
|
+
export interface ListQueryOption<Sort = never, Obj = any> {
|
|
24
|
+
skip?: number | null;
|
|
25
|
+
limit?: number | null;
|
|
26
|
+
sort?: Sort | null;
|
|
27
|
+
sample?: number;
|
|
28
|
+
select?: Partial<Record<keyof Obj, boolean>>;
|
|
29
|
+
}
|
|
30
|
+
export interface FindQueryOption<Sort = never, Obj = any> {
|
|
31
|
+
skip?: number | null;
|
|
32
|
+
sort?: Sort | null;
|
|
33
|
+
sample?: boolean;
|
|
34
|
+
select?: Partial<Record<keyof Obj, boolean>>;
|
|
35
|
+
}
|
|
36
|
+
export type { SchemaOf } from "./documentSchema.d.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./document/index.d.ts";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type PromiseOrObject } from "akanjs/base";
|
|
2
|
+
import { Logger } from "akanjs/common";
|
|
3
|
+
import type { DatabaseSignal, SerializedArg, SerializedEndpoint, SerializedSignal, SerializedSlice, ServiceSignal } from "akanjs/signal";
|
|
4
|
+
import type { ClientSignal, MergeAllFetchTypes, SliceMeta } from "../fetchType.d.ts";
|
|
5
|
+
import type { GetSliceMetaObjFromDatabaseSignals } from "../types.d.ts";
|
|
6
|
+
import { type ErrorConstructor, HttpClient } from "./httpClient.d.ts";
|
|
7
|
+
import { WsClient } from "./wsClient.d.ts";
|
|
8
|
+
type FetchHandler = (...args: unknown[]) => PromiseOrObject<unknown>;
|
|
9
|
+
export type FetchProxy<FetchType = unknown, SliceMetaObj extends Record<string, SliceMeta> = Record<never, never>> = typeof global.fetch & FetchClient & FetchType & {
|
|
10
|
+
slice: SliceMetaObj;
|
|
11
|
+
instance: FetchClient;
|
|
12
|
+
_FetchType: FetchType;
|
|
13
|
+
};
|
|
14
|
+
type ClientSignalMap<SigType extends {
|
|
15
|
+
fetch: any;
|
|
16
|
+
}> = {
|
|
17
|
+
[K in keyof SigType as SigType[K] extends DatabaseSignal<any, any, any, any> ? K : never]: SigType[K] extends DatabaseSignal<any, any, infer SlceCls, any> ? ClientSignal<SlceCls["baseName"], SlceCls, SlceCls["srv"]["cnst"]> : never;
|
|
18
|
+
};
|
|
19
|
+
/** Runtime fetch client that registers serialized Akan signals as HTTP/WebSocket methods. */
|
|
20
|
+
export declare class FetchClient {
|
|
21
|
+
#private;
|
|
22
|
+
private ErrorCls?;
|
|
23
|
+
readonly logger: Logger;
|
|
24
|
+
readonly origin: string;
|
|
25
|
+
readonly http: HttpClient;
|
|
26
|
+
readonly ws: WsClient;
|
|
27
|
+
readonly handler: Record<string, FetchHandler>;
|
|
28
|
+
readonly slice: Record<string, SliceMeta>;
|
|
29
|
+
readonly sortKeyMap: Map<string, string[]>;
|
|
30
|
+
serializedSignal: {
|
|
31
|
+
[key: string]: SerializedSignal;
|
|
32
|
+
};
|
|
33
|
+
jwt: string | null;
|
|
34
|
+
constructor(origin: string, handler?: Record<string, FetchHandler>, serializedSignal?: {
|
|
35
|
+
[key: string]: SerializedSignal;
|
|
36
|
+
}, ErrorCls?: ErrorConstructor | undefined);
|
|
37
|
+
setErrorConstructor(ErrorCls?: ErrorConstructor): void;
|
|
38
|
+
applySignal(serializedSignal: {
|
|
39
|
+
[key: string]: SerializedSignal;
|
|
40
|
+
}): this;
|
|
41
|
+
connect(): void;
|
|
42
|
+
disconnect(): void;
|
|
43
|
+
clone({ origin, connect, jwt }?: {
|
|
44
|
+
origin?: string;
|
|
45
|
+
connect?: boolean;
|
|
46
|
+
jwt?: string;
|
|
47
|
+
}): FetchProxy<unknown, Record<never, never>>;
|
|
48
|
+
setJwt(jwt: string | null): void;
|
|
49
|
+
static paginationArgs: SerializedArg[];
|
|
50
|
+
static makeHttpUrl(key: string, endpoint: SerializedEndpoint, prefix: string | undefined, argMap: Map<string, unknown>): string;
|
|
51
|
+
static getBaseEndpoint(refName: string, signal: SerializedSignal): {
|
|
52
|
+
[key: string]: SerializedEndpoint;
|
|
53
|
+
};
|
|
54
|
+
static getEndpointFromSlice(refName: string, suffix: string, slice: SerializedSlice): {
|
|
55
|
+
[key: string]: SerializedEndpoint;
|
|
56
|
+
};
|
|
57
|
+
static classifyHttpArgs(args: SerializedArg[]): {
|
|
58
|
+
paramArgs: SerializedArg[];
|
|
59
|
+
searchArgs: SerializedArg[];
|
|
60
|
+
bodyArgs: SerializedArg[];
|
|
61
|
+
uploadArgs: SerializedArg[];
|
|
62
|
+
};
|
|
63
|
+
static from<Signals extends (FetchProxy<any, any> | DatabaseSignal<any, any, any, any> | ServiceSignal<any, any, any>)[]>(...signals: Signals): FetchProxy<MergeAllFetchTypes<Signals>, GetSliceMetaObjFromDatabaseSignals<Signals>>;
|
|
64
|
+
static build<SigType extends {
|
|
65
|
+
fetch: any;
|
|
66
|
+
}>(constant: object, serializedSignal: {
|
|
67
|
+
[key: string]: SerializedSignal;
|
|
68
|
+
}, { origin, connect, base, Err, }?: {
|
|
69
|
+
origin?: string;
|
|
70
|
+
connect?: boolean;
|
|
71
|
+
base?: FetchProxy;
|
|
72
|
+
Err?: ErrorConstructor;
|
|
73
|
+
}): {
|
|
74
|
+
sig: ClientSignalMap<SigType>;
|
|
75
|
+
fetch: SigType["fetch"];
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { SerializedArg } from "akanjs/signal";
|
|
2
|
+
export interface ErrorResponsePayload {
|
|
3
|
+
error: string;
|
|
4
|
+
statusCode?: number;
|
|
5
|
+
data?: Record<string, unknown>;
|
|
6
|
+
details?: unknown;
|
|
7
|
+
path?: string;
|
|
8
|
+
timestamp?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RestoredError extends Error {
|
|
11
|
+
error?: string;
|
|
12
|
+
statusCode?: number;
|
|
13
|
+
data?: unknown;
|
|
14
|
+
details?: unknown;
|
|
15
|
+
path?: string;
|
|
16
|
+
timestamp?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ErrorConstructor {
|
|
19
|
+
fromJSON: (payload: ErrorResponsePayload) => RestoredError;
|
|
20
|
+
}
|
|
21
|
+
interface FetchOptions {
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class HttpClient {
|
|
26
|
+
#private;
|
|
27
|
+
private ErrorCls?;
|
|
28
|
+
readonly baseUrl: string;
|
|
29
|
+
constructor(baseUrl: string, ErrorCls?: ErrorConstructor | undefined);
|
|
30
|
+
setErrorConstructor(ErrorCls?: ErrorConstructor): void;
|
|
31
|
+
get<Returns = unknown>(url: string, options?: FetchOptions): Promise<Returns>;
|
|
32
|
+
put<Returns = unknown>(url: string, data: FormData | Record<string, unknown>, options?: FetchOptions): Promise<Returns>;
|
|
33
|
+
post<Returns = unknown>(url: string, data: FormData | Record<string, unknown>, options?: FetchOptions): Promise<Returns>;
|
|
34
|
+
delete<Returns = unknown>(url: string, options?: FetchOptions): Promise<Returns>;
|
|
35
|
+
static makePath(key: string, paramArgs: SerializedArg[], prefix?: string): string;
|
|
36
|
+
static makeUrl(path: string, searchArgs: SerializedArg[], argMap: Map<string, unknown>): string;
|
|
37
|
+
static makeBody(bodyArgs: SerializedArg[], uploadArgs: SerializedArg[], argMap: Map<string, unknown>): Record<string, unknown> | FormData;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Logger } from "akanjs/common";
|
|
2
|
+
import type { ErrorConstructor } from "./httpClient.d.ts";
|
|
3
|
+
export interface WsClientReconnectOptions {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
interval?: number;
|
|
6
|
+
maxAttempts?: number;
|
|
7
|
+
}
|
|
8
|
+
type WsRequestPayload = unknown | unknown[];
|
|
9
|
+
export declare class WsClient {
|
|
10
|
+
#private;
|
|
11
|
+
private ErrorCls?;
|
|
12
|
+
static makeRoomId(key: string, args: unknown[]): string;
|
|
13
|
+
readonly logger: Logger;
|
|
14
|
+
readonly url: string;
|
|
15
|
+
connected: boolean;
|
|
16
|
+
constructor(url: string, ErrorCls?: ErrorConstructor | undefined);
|
|
17
|
+
setErrorConstructor(ErrorCls?: ErrorConstructor): void;
|
|
18
|
+
connect(): void;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
on<Data = unknown>(key: string, callback: (data: Data) => void): this;
|
|
21
|
+
once<Data = unknown>(key: string, callback: (data: Data) => void): this;
|
|
22
|
+
off<Data = unknown>(key: string, callback: (data: Data) => void): this;
|
|
23
|
+
removeAllListeners(key: string): this;
|
|
24
|
+
hasListeners(key: string): boolean;
|
|
25
|
+
emit(key: string, data: WsRequestPayload): this;
|
|
26
|
+
subscribe(option: {
|
|
27
|
+
key: string;
|
|
28
|
+
data: unknown[];
|
|
29
|
+
handleEvent: (data: unknown) => void;
|
|
30
|
+
}): this | undefined;
|
|
31
|
+
unsubscribe(option: {
|
|
32
|
+
key: string;
|
|
33
|
+
data: unknown[];
|
|
34
|
+
handleEvent: (data: unknown) => void;
|
|
35
|
+
}): void;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.d.ts";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { DataList, GetStateObject, PromiseOrObject } from "akanjs/base";
|
|
2
|
+
import type { ExtractSort, FilterInstance } from "akanjs/document";
|
|
3
|
+
/** Metadata that identifies a generated slice list/insight request. */
|
|
4
|
+
export type SliceMeta = {
|
|
5
|
+
refName: string;
|
|
6
|
+
sliceName: string;
|
|
7
|
+
argLength: number;
|
|
8
|
+
};
|
|
9
|
+
export type ServerInit<RefName extends string, Light, Insight = any, QueryArgs = any, Filter extends FilterInstance = any, _CapitalizedRefName extends string = Capitalize<RefName>, _LightObj = GetStateObject<Light>, _InsightObj = GetStateObject<Insight>, _Sort = ExtractSort<Filter>> = SliceMeta & {
|
|
10
|
+
[K in `${RefName}ObjList`]: _LightObj[];
|
|
11
|
+
} & {
|
|
12
|
+
[K in `${RefName}ObjInsight`]: _InsightObj;
|
|
13
|
+
} & {
|
|
14
|
+
[K in `pageOf${_CapitalizedRefName}`]: number;
|
|
15
|
+
} & {
|
|
16
|
+
[K in `lastPageOf${_CapitalizedRefName}`]: number;
|
|
17
|
+
} & {
|
|
18
|
+
[K in `limitOf${_CapitalizedRefName}`]: number;
|
|
19
|
+
} & {
|
|
20
|
+
[K in `queryArgsOf${_CapitalizedRefName}`]: QueryArgs;
|
|
21
|
+
} & {
|
|
22
|
+
[K in `sortOf${_CapitalizedRefName}`]: _Sort;
|
|
23
|
+
} & {
|
|
24
|
+
[K in `${RefName}InitAt`]: Date;
|
|
25
|
+
};
|
|
26
|
+
/** Client/server-friendly return type for initialized list and insight data. */
|
|
27
|
+
export type ClientInit<RefName extends string, Light, Insight = any, QueryArgs = any, Filter extends FilterInstance = any, _CapitalizedRefName extends string = Capitalize<RefName>, _LightObj = GetStateObject<Light>, _InsightObj = GetStateObject<Insight>, _Sort = ExtractSort<Filter>> = PromiseOrObject<ServerInit<RefName, Light, Insight, QueryArgs, Filter, _CapitalizedRefName, _LightObj, _InsightObj, _Sort>>;
|
|
28
|
+
export type ServerView<RefName extends string, Model> = {
|
|
29
|
+
refName: RefName;
|
|
30
|
+
} & {
|
|
31
|
+
[K in `${RefName}Obj`]: GetStateObject<Model>;
|
|
32
|
+
} & {
|
|
33
|
+
[K in `${RefName}ViewAt`]: Date;
|
|
34
|
+
};
|
|
35
|
+
/** Client/server-friendly return type for a single model view payload. */
|
|
36
|
+
export type ClientView<RefName extends string, Model> = PromiseOrObject<ServerView<RefName, Model>>;
|
|
37
|
+
export type ServerEdit<RefName extends string, Model> = {
|
|
38
|
+
refName: RefName;
|
|
39
|
+
} & {
|
|
40
|
+
[K in `${RefName}Obj`]: GetStateObject<Model>;
|
|
41
|
+
} & {
|
|
42
|
+
[K in `${RefName}ViewAt`]: Date;
|
|
43
|
+
};
|
|
44
|
+
export type ClientEdit<RefName extends string, Model> = PromiseOrObject<ServerEdit<RefName, Model>>;
|
|
45
|
+
export type ViewReturn<RefName extends string, Full> = {
|
|
46
|
+
[K in RefName]: Full;
|
|
47
|
+
} & {
|
|
48
|
+
[K in `${RefName}View`]: ServerView<RefName, Full>;
|
|
49
|
+
};
|
|
50
|
+
export type EditReturn<RefName extends string, Full> = {
|
|
51
|
+
[K in RefName]: Full;
|
|
52
|
+
} & {
|
|
53
|
+
[K in `${RefName}Edit`]: ServerEdit<RefName, Full>;
|
|
54
|
+
};
|
|
55
|
+
export type InitReturn<RefName extends string, Suffix extends string, Light, Insight, Args, Filter extends FilterInstance, _CapitalizedRefName extends string = Capitalize<RefName>, _CapitalizedSuffix extends string = Capitalize<Suffix>, _Light extends {
|
|
56
|
+
id: string;
|
|
57
|
+
} = Light extends {
|
|
58
|
+
id: string;
|
|
59
|
+
} ? Light : {
|
|
60
|
+
id: string;
|
|
61
|
+
}, _LightObj = GetStateObject<_Light>, _InsightObj = GetStateObject<Insight>, _Sort = ExtractSort<Filter>> = {
|
|
62
|
+
[K in `${RefName}Init${_CapitalizedSuffix}`]: ServerInit<RefName, Light, Insight, Args, Filter, _CapitalizedRefName, _LightObj, _InsightObj, _Sort>;
|
|
63
|
+
} & {
|
|
64
|
+
[K in `${RefName}List${_CapitalizedSuffix}`]: DataList<_Light>;
|
|
65
|
+
} & {
|
|
66
|
+
[K in `${RefName}Insight${_CapitalizedSuffix}`]: Insight;
|
|
67
|
+
};
|