akanjs 3.2.0-rc.2 → 3.2.0-rc.21
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/ARCHITECTURE.md +42 -41
- package/CHANGELOG.md +593 -3
- package/CONTRIBUTING.md +26 -0
- package/base/base.ts +2 -1
- package/client/clientRuntime.ts +1 -0
- package/client/cn.ts +2 -2
- package/client/csrTypes.ts +15 -1
- package/client/frameConfig.ts +5 -2
- package/client/index.ts +249 -26
- package/client/locale.ts +1 -0
- package/client/makePageProto.tsx +33 -82
- package/client/nativeThemeColor.ts +51 -0
- package/client/route/RouteDefinition.ts +24 -7
- package/client/route/RouteGuards.ts +2 -1
- package/client/route/RouteHead.ts +11 -2
- package/client/route/routeArgs.ts +7 -0
- package/client/router.ts +25 -6
- package/client/rscNavigation.ts +3 -3
- package/client/rscRoutePatch.ts +42 -0
- package/client/viewportMeta.ts +34 -4
- package/common/CodeTranscript.ts +1 -1
- package/common/PipelinePlanSchema.ts +2 -2
- package/common/akanGraph.ts +1 -1
- package/common/err.ts +122 -0
- package/common/facetBarrel.ts +38 -0
- package/common/failureCode.ts +18 -0
- package/common/index.ts +9 -0
- package/common/isGuardRefusal.ts +14 -0
- package/common/mcpExposure.ts +17 -4
- package/common/mcpFailure.ts +9 -0
- package/common/pipelinePlan.ts +1 -1
- package/common/restartSchedule.ts +55 -0
- package/common/routeConvention.ts +3 -1
- package/common/types.ts +18 -1
- package/constant/constantRegistry.ts +4 -8
- package/constant/crystalize.ts +1 -2
- package/constant/getDefault.ts +1 -1
- package/constant/immerify.ts +1 -1
- package/constant/index.ts +78 -21
- package/constant/purify.ts +4 -9
- package/constant/serialize.ts +4 -2
- package/constant/types.ts +1 -0
- package/constant/via.ts +1 -2
- package/dictionary/agent.dictionary.ts +4 -0
- package/dictionary/base.dictionary.ts +1 -0
- package/dictionary/locale.ts +1 -1
- package/dictionary/trans.ts +14 -97
- package/document/databaseRegistry.ts +2 -1
- package/document/documentSchema.ts +1 -0
- package/document/filterMeta.ts +4 -1
- package/document/into.ts +2 -1
- package/document/loaderInfo.ts +2 -1
- package/document/noDocumentError.ts +4 -1
- package/document/queryEvaluator.ts +1 -1
- package/document/types.ts +1 -1
- package/fetch/client/fetchClient.ts +87 -270
- package/fetch/client/fetchClientTypes.ts +49 -0
- package/fetch/client/fetchHandle.ts +11 -1
- package/fetch/client/httpClient.ts +14 -2
- package/fetch/client/inflightQueries.ts +17 -0
- package/fetch/client/remoteError.ts +4 -20
- package/fetch/client/requestScope.ts +32 -0
- package/fetch/client/signalCatalog.ts +131 -0
- package/fetch/client/wsClient.ts +11 -0
- package/fetch/index.ts +1 -0
- package/fetch/staleReads.ts +27 -0
- package/fetch/streamedRead.ts +23 -0
- package/package.json +1 -1
- package/server/agentHooks.ts +16 -0
- package/server/akanApp.ts +107 -1272
- package/server/akanOption.ts +17 -4
- package/server/akanServer.ts +167 -675
- package/server/artifact/builderRpc.ts +33 -10
- package/server/artifact/ipcTypes.ts +9 -3
- package/server/artifact/routeSeedIndexStore.ts +4 -2
- package/server/assetHeaders.ts +6 -0
- package/server/console.ts +6 -4
- package/server/decorators.ts +2 -2
- package/server/devtools/README.md +4 -3
- package/server/devtools/devtoolsRouter.ts +9 -5
- package/server/devtools/studio/studioRoute.ts +18 -11
- package/server/di/diLifecycle.ts +24 -35
- package/server/di/predefinedAdaptor.ts +24 -1
- package/server/di/resolveHierarchy.ts +19 -6
- package/server/di/utils.ts +7 -3
- package/server/ed25519Key.ts +31 -15
- package/server/flightRowReader.ts +95 -18
- package/server/gateway/childSupervisor.ts +326 -0
- package/server/gateway/devHostChannel.ts +47 -0
- package/server/gateway/gatewayChildren.ts +135 -0
- package/server/gateway/gatewayConfig.ts +182 -0
- package/server/gateway/gatewayHttpProxy.ts +231 -0
- package/server/gateway/gatewayLogging.ts +111 -0
- package/server/gateway/gatewayRooms.ts +141 -0
- package/server/gateway/gatewayStatus.ts +116 -0
- package/server/gateway/gatewayStatusPage.ts +54 -0
- package/server/gateway/gatewayWebSocketRelay.ts +149 -0
- package/server/head.tsx +4 -19
- package/server/hmr/devHmrController.ts +10 -1
- package/server/htmlResultCache.ts +234 -0
- package/server/imageOptimizer.ts +4 -1
- package/server/index.ts +257 -17
- package/server/lifecycle/parentChannel.ts +78 -0
- package/server/lifecycle/shutdownManager.ts +6 -3
- package/server/lifecycle/startGuard.ts +90 -0
- package/server/logging/logControlSocket.ts +42 -3
- package/server/logging/serverLogging.ts +74 -0
- package/server/machine/machineToken.ts +10 -3
- package/server/mcp/AgentTools.ts +149 -0
- package/server/mcp/AgentToolsAccount.ts +26 -0
- package/server/mcp/McpDispatcher.ts +48 -19
- package/server/mcp/McpPages.ts +21 -6
- package/server/mcp/McpRateLimiter.ts +14 -0
- package/server/mcp/McpRouter.ts +52 -23
- package/server/mcp/McpUiSession.ts +2 -1
- package/server/mcp/index.ts +1 -0
- package/server/nativeFile.ts +30 -11
- package/server/nativeSecret.ts +12 -3
- package/server/oauth/OAuthClientIdMetadata.ts +2 -2
- package/server/ops/opsRoute.ts +5 -1
- package/server/ops/opsToken.ts +3 -1
- package/server/resolver/CascadeRunner.ts +10 -4
- package/server/resolver/database.resolver.ts +10 -417
- package/server/resolver/databaseModelInstance.ts +200 -0
- package/server/resolver/invalidSignal.ts +7 -0
- package/server/resolver/livePause.ts +34 -0
- package/server/resolver/modelFacade.ts +136 -0
- package/server/resolver/modelLoaders.ts +52 -0
- package/server/resolver/modelSchema.ts +52 -0
- package/server/resolver/signal.resolver.ts +92 -116
- package/server/resolver/timedQuery.ts +16 -0
- package/server/resolver/websocketOf.ts +23 -0
- package/server/routeElementComposer.tsx +131 -9
- package/server/routeState.ts +5 -1
- package/server/routeTreeBuilder.ts +22 -9
- package/server/routing/apiRouter.ts +44 -25
- package/server/routing/builtinRoutes.ts +194 -0
- package/server/routing/localRooms.ts +34 -0
- package/server/routing/roomReplay.ts +2 -2
- package/server/routing/serverLimits.ts +4 -1
- package/server/routing/serverListener.ts +194 -0
- package/server/rscClient.tsx +210 -227
- package/server/rscClientCache.ts +165 -0
- package/server/rscClientChunks.ts +209 -0
- package/server/rscClientFetch.ts +15 -3
- package/server/rscClientPatch.ts +78 -15
- package/server/rscDocumentHead.tsx +170 -0
- package/server/rscFlightRenderer.ts +83 -0
- package/server/rscFlightStream.ts +257 -0
- package/server/rscHeadPatch.ts +17 -56
- package/server/rscHostReloads.ts +238 -0
- package/server/rscHostRenderStream.ts +297 -0
- package/server/rscHostRequests.ts +158 -0
- package/server/rscHttp.ts +18 -6
- package/server/rscInlineStream.ts +34 -0
- package/server/rscNavigationState.ts +21 -1
- package/server/rscPagePrompts.ts +11 -5
- package/server/rscParkedRedirect.ts +23 -0
- package/server/rscPatchPlanner.ts +220 -0
- package/server/rscPrefetchCache.ts +68 -32
- package/server/rscRenderControl.ts +33 -0
- package/server/rscRenderFallbacks.ts +297 -0
- package/server/rscRenderHandler.ts +439 -0
- package/server/rscRenderStats.ts +49 -0
- package/server/rscResponse.ts +78 -0
- package/server/rscResultCaches.ts +74 -0
- package/server/rscRouteDocument.tsx +299 -0
- package/server/rscSegmentOutlet.tsx +24 -5
- package/server/rscSegmentOutletReference.ts +14 -12
- package/server/rscWorker.tsx +86 -1392
- package/server/rscWorkerCache.ts +56 -0
- package/server/rscWorkerHost.ts +145 -811
- package/server/rscWorkerProcess.ts +155 -0
- package/server/rscWorkerRecycler.ts +128 -0
- package/server/serverConfig.ts +128 -0
- package/server/serverMetrics.ts +52 -0
- package/server/sitemap.ts +1 -0
- package/server/ssrFromRscRenderer.tsx +20 -20
- package/server/ssrTypes.ts +9 -0
- package/server/webArtifact.ts +86 -0
- package/server/webAssetRoutes.ts +84 -0
- package/server/webCsrSurface.ts +172 -0
- package/server/webDocumentRoute.ts +180 -0
- package/server/webRouteContext.ts +232 -0
- package/server/webRouter.ts +126 -1242
- package/server/webRscRoute.ts +155 -0
- package/server/webSiteFiles.ts +139 -0
- package/server/wellKnownRoutes.ts +73 -0
- package/service/agent.service.ts +59 -5
- package/service/agentAccounts.ts +19 -0
- package/service/agentLoop/agentLoop.ts +387 -0
- package/service/agentLoop/agentLoopTypes.ts +112 -0
- package/service/agentLoop/deltaStream.ts +40 -0
- package/service/agentLoop/loopCompaction.ts +135 -0
- package/service/agentLoop/loopRequest.ts +62 -0
- package/service/agentLoop/loopToolOutput.ts +54 -0
- package/service/agentLoop/loopToolkits.ts +107 -0
- package/service/agentLoop/loopTranscript.ts +102 -0
- package/{signal → service}/agentMeter.ts +83 -15
- package/{signal → service}/agentRelayPolicy.ts +30 -7
- package/service/documentStoreError.ts +16 -0
- package/service/index.ts +7 -0
- package/service/injectError.ts +5 -0
- package/service/injectInfo.ts +30 -18
- package/service/insightQueryError.ts +19 -0
- package/service/ipcTypes.ts +3 -1
- package/service/liveSyncHub.ts +5 -2
- package/service/predefinedAdaptor/agentTools.adaptor.ts +34 -0
- package/service/predefinedAdaptor/anthropicLlm.ts +52 -21
- package/service/predefinedAdaptor/cache.adaptor.ts +3 -2
- package/service/predefinedAdaptor/compress.adaptor.ts +7 -3
- package/service/predefinedAdaptor/database.adaptor.ts +3 -1
- package/service/predefinedAdaptor/documentTransfer.ts +2 -1
- package/service/predefinedAdaptor/index.ts +2 -0
- package/service/predefinedAdaptor/insightQuery.ts +35 -11
- package/service/predefinedAdaptor/llm.adaptor.ts +22 -2
- package/service/predefinedAdaptor/llmSpend.ts +80 -0
- package/service/predefinedAdaptor/openaiDialect.ts +52 -17
- package/service/predefinedAdaptor/openaiLlm.ts +17 -9
- package/service/predefinedAdaptor/role.adaptor.ts +2 -0
- package/service/predefinedAdaptor/searchIndex.ts +5 -1
- package/service/predefinedAdaptor/solidPubsub.adaptor.ts +35 -2
- package/service/predefinedAdaptor/solidQueue.adaptor.ts +2 -2
- package/service/predefinedAdaptor/solidSqlite.ts +3 -2
- package/service/predefinedAdaptor/sql/DocumentHydrator.ts +95 -0
- package/service/predefinedAdaptor/sql/DocumentRowCodec.ts +192 -0
- package/service/predefinedAdaptor/sql/DocumentWriter.ts +292 -0
- package/service/predefinedAdaptor/sql/PostgresInsightSession.ts +15 -5
- package/service/predefinedAdaptor/sql/QueryCompiler.ts +29 -13
- package/service/predefinedAdaptor/sql/QueryScope.ts +70 -0
- package/service/predefinedAdaptor/sql/QueryWriter.ts +200 -0
- package/service/predefinedAdaptor/sql/RawDocumentTable.ts +20 -8
- package/service/predefinedAdaptor/sql/SqlDocumentStore.ts +83 -1124
- package/service/predefinedAdaptor/sql/SqlTableSchema.ts +319 -0
- package/service/predefinedAdaptor/sql/SqliteInsightSession.ts +2 -1
- package/service/predefinedAdaptor/sql/StoredRows.ts +95 -0
- package/service/predefinedAdaptor/sql/UpdateCompiler.ts +6 -2
- package/service/predefinedAdaptor/sql/driver/bunSqlite.ts +3 -3
- package/service/predefinedAdaptor/sql/driver/postgres.ts +1 -1
- package/service/predefinedAdaptor/sql/fieldValues.ts +74 -0
- package/service/predefinedAdaptor/sql/search/fts5.ts +4 -1
- package/service/predefinedAdaptor/sql/search/postgres.ts +6 -2
- package/service/predefinedAdaptor/sql/values.ts +8 -4
- package/service/predefinedAdaptor/sseData.ts +14 -0
- package/service/predefinedAdaptor/storage.adaptor.ts +9 -4
- package/service/predefinedAdaptor/websocket.adaptor.ts +199 -43
- package/service/serve.ts +3 -2
- package/service/serviceModule.ts +2 -2
- package/service/serviceRegistry.ts +1 -0
- package/signal/SignalFailure.ts +30 -1
- package/signal/agent.signal.ts +30 -9
- package/signal/agentTurnStream.ts +12 -8
- package/signal/byIdRead.ts +18 -0
- package/signal/carriedClientIps.ts +1 -0
- package/signal/endpointErrorContract.ts +20 -2
- package/signal/endpointInfo.ts +6 -5
- package/signal/exception.ts +1 -0
- package/signal/index.ts +314 -30
- package/signal/internalInfo.ts +6 -4
- package/signal/mcp/McpDocument.ts +8 -1
- package/signal/mcp/Msg.ts +23 -10
- package/signal/mcp/index.ts +1 -0
- package/signal/mcp/promptError.ts +9 -0
- package/signal/middleware.ts +12 -3
- package/signal/openapi/openapi.ts +10 -1
- package/signal/resolveFieldContext.ts +34 -0
- package/signal/serializer/fetch.serializer.ts +23 -15
- package/signal/signalContext.ts +24 -57
- package/signal/signalContractError.ts +10 -0
- package/signal/signalDeclarationError.ts +13 -0
- package/signal/signalRegistry.ts +3 -1
- package/signal/slice.ts +24 -20
- package/signal/sliceInfo.ts +12 -9
- package/signal/trace.ts +3 -0
- package/signal/types.ts +35 -6
- package/store/action.ts +44 -1086
- package/store/actionErrorKey.ts +9 -0
- package/store/actionOption.ts +22 -0
- package/store/baseSt.ts +1 -0
- package/store/draftFlush.ts +5 -0
- package/store/draftStore.ts +2 -0
- package/store/formDrafts.ts +115 -0
- package/store/formFieldSetters.ts +229 -0
- package/store/index.ts +125 -17
- package/store/modelActionContext.ts +65 -0
- package/store/modelListPatch.ts +53 -0
- package/store/modelOpenActions.ts +158 -0
- package/store/modelWriteActions.ts +240 -0
- package/store/modelWriteGuard.ts +82 -0
- package/store/openSeq.ts +34 -0
- package/store/rootStore.ts +2 -0
- package/store/sliceListActions.ts +370 -0
- package/store/sliceLiveActions.ts +130 -0
- package/store/stateBuilder.ts +2 -0
- package/store/storeInstance.ts +9 -10
- package/store/uploadPoll.ts +52 -0
- package/store/withSelector.ts +6 -4
- package/types/base/base.d.ts +2 -1
- package/types/client/clientRuntime.d.ts +1 -0
- package/types/client/cn.d.ts +2 -2
- package/types/client/csrTypes.d.ts +15 -1
- package/types/client/frameConfig.d.ts +1 -0
- package/types/client/index.d.ts +25 -26
- package/types/client/locale.d.ts +1 -0
- package/types/client/makePageProto.d.ts +28 -26091
- package/types/client/nativeThemeColor.d.ts +6 -0
- package/types/client/route/RouteDefinition.d.ts +2 -2
- package/types/client/route/RouteHead.d.ts +5 -1
- package/types/client/route/routeArgs.d.ts +6 -0
- package/types/client/router.d.ts +6 -3
- package/types/client/rscNavigation.d.ts +3 -2
- package/types/client/rscRoutePatch.d.ts +22 -0
- package/types/client/viewportMeta.d.ts +3 -1
- package/types/common/CodeTranscript.d.ts +1 -1
- package/types/common/akanGraph.d.ts +1 -1
- package/types/common/err.d.ts +48 -0
- package/types/common/facetBarrel.d.ts +4 -0
- package/types/common/failureCode.d.ts +6 -0
- package/types/common/index.d.ts +8 -2
- package/types/common/isGuardRefusal.d.ts +3 -0
- package/types/common/mcpExposure.d.ts +9 -2
- package/types/common/mcpFailure.d.ts +6 -0
- package/types/common/restartSchedule.d.ts +16 -0
- package/types/common/routeConvention.d.ts +2 -0
- package/types/common/types.d.ts +18 -1
- package/types/constant/constantRegistry.d.ts +3 -1
- package/types/constant/crystalize.d.ts +1 -1
- package/types/constant/getDefault.d.ts +1 -1
- package/types/constant/immerify.d.ts +1 -1
- package/types/constant/index.d.ts +21 -21
- package/types/constant/purify.d.ts +2 -1
- package/types/constant/serialize.d.ts +1 -1
- package/types/constant/types.d.ts +1 -0
- package/types/dictionary/agent.dictionary.d.ts +1 -1
- package/types/dictionary/base.dictionary.d.ts +1 -1
- package/types/dictionary/dictionary.d.ts +9 -9
- package/types/dictionary/locale.d.ts +1 -1
- package/types/dictionary/trans.d.ts +3 -26
- package/types/document/databaseRegistry.d.ts +2 -1
- package/types/document/documentSchema.d.ts +1 -0
- package/types/document/filterMeta.d.ts +4 -1
- package/types/document/into.d.ts +1 -1
- package/types/document/loaderInfo.d.ts +2 -1
- package/types/document/noDocumentError.d.ts +8 -1
- package/types/document/queryEvaluator.d.ts +1 -1
- package/types/document/types.d.ts +1 -1
- package/types/fetch/client/fetchClient.d.ts +6 -36
- package/types/fetch/client/fetchClientTypes.d.ts +40 -0
- package/types/fetch/client/fetchHandle.d.ts +1 -0
- package/types/fetch/client/httpClient.d.ts +2 -0
- package/types/fetch/client/inflightQueries.d.ts +2 -0
- package/types/fetch/client/remoteError.d.ts +0 -4
- package/types/fetch/client/requestScope.d.ts +6 -0
- package/types/fetch/client/signalCatalog.d.ts +25 -0
- package/types/fetch/client/wsClient.d.ts +1 -0
- package/types/fetch/index.d.ts +1 -0
- package/types/fetch/staleReads.d.ts +8 -0
- package/types/fetch/streamedRead.d.ts +8 -0
- package/types/server/agentHooks.d.ts +4 -0
- package/types/server/akanApp.d.ts +2 -20
- package/types/server/akanOption.d.ts +9 -3
- package/types/server/akanServer.d.ts +1 -1
- package/types/server/artifact/builderRpc.d.ts +8 -0
- package/types/server/artifact/ipcTypes.d.ts +8 -0
- package/types/server/assetHeaders.d.ts +1 -0
- package/types/server/console.d.ts +4 -3
- package/types/server/devtools/devtoolsRouter.d.ts +4 -1
- package/types/server/devtools/studio/studioRoute.d.ts +2 -1
- package/types/server/di/predefinedAdaptor.d.ts +1 -0
- package/types/server/ed25519Key.d.ts +1 -0
- package/types/server/flightRowReader.d.ts +3 -1
- package/types/server/gateway/childSupervisor.d.ts +33 -0
- package/types/server/gateway/devHostChannel.d.ts +14 -0
- package/types/server/gateway/gatewayChildren.d.ts +47 -0
- package/types/server/gateway/gatewayConfig.d.ts +82 -0
- package/types/server/gateway/gatewayHttpProxy.d.ts +22 -0
- package/types/server/gateway/gatewayLogging.d.ts +16 -0
- package/types/server/gateway/gatewayRooms.d.ts +25 -0
- package/types/server/gateway/gatewayStatus.d.ts +62 -0
- package/types/server/gateway/gatewayStatusPage.d.ts +9 -0
- package/types/server/gateway/gatewayWebSocketRelay.d.ts +17 -0
- package/types/server/head.d.ts +2 -2
- package/types/server/htmlResultCache.d.ts +51 -0
- package/types/server/index.d.ts +17 -17
- package/types/server/lifecycle/parentChannel.d.ts +13 -0
- package/types/server/lifecycle/startGuard.d.ts +10 -0
- package/types/server/logging/rotatingLogWriter.d.ts +1 -1
- package/types/server/logging/serverLogging.d.ts +12 -0
- package/types/server/mcp/AgentTools.d.ts +31 -0
- package/types/server/mcp/AgentToolsAccount.d.ts +7 -0
- package/types/server/mcp/McpDispatcher.d.ts +10 -1
- package/types/server/mcp/McpPages.d.ts +2 -1
- package/types/server/mcp/McpRateLimiter.d.ts +3 -0
- package/types/server/mcp/index.d.ts +1 -0
- package/types/server/resolver/database.resolver.d.ts +2 -2
- package/types/server/resolver/databaseModelInstance.d.ts +4 -0
- package/types/server/resolver/invalidSignal.d.ts +2 -0
- package/types/server/resolver/livePause.d.ts +5 -0
- package/types/server/resolver/modelFacade.d.ts +5 -0
- package/types/server/resolver/modelLoaders.d.ts +9 -0
- package/types/server/resolver/modelSchema.d.ts +6 -0
- package/types/server/resolver/signal.resolver.d.ts +2 -2
- package/types/server/resolver/timedQuery.d.ts +8 -0
- package/types/server/resolver/websocketOf.d.ts +2 -0
- package/types/server/routeElementComposer.d.ts +45 -6
- package/types/server/routeState.d.ts +2 -0
- package/types/server/routing/builtinRoutes.d.ts +24 -0
- package/types/server/routing/localRooms.d.ts +14 -0
- package/types/server/routing/roomReplay.d.ts +2 -2
- package/types/server/routing/serverListener.d.ts +31 -0
- package/types/server/rscClient.d.ts +1 -5
- package/types/server/rscClientCache.d.ts +34 -0
- package/types/server/rscClientChunks.d.ts +18 -0
- package/types/server/rscClientFetch.d.ts +1 -1
- package/types/server/rscClientPatch.d.ts +12 -1
- package/types/server/rscDocumentHead.d.ts +32 -0
- package/types/server/rscFlightRenderer.d.ts +14 -0
- package/types/server/rscFlightStream.d.ts +52 -0
- package/types/server/rscHeadPatch.d.ts +5 -4
- package/types/server/rscHostReloads.d.ts +54 -0
- package/types/server/rscHostRenderStream.d.ts +53 -0
- package/types/server/rscHostRequests.d.ts +29 -0
- package/types/server/rscHttp.d.ts +4 -2
- package/types/server/rscInlineStream.d.ts +9 -0
- package/types/server/rscNavigationState.d.ts +8 -3
- package/types/server/rscParkedRedirect.d.ts +12 -0
- package/types/server/rscPatchPlanner.d.ts +49 -0
- package/types/server/rscPrefetchCache.d.ts +8 -7
- package/types/server/rscRenderControl.d.ts +12 -0
- package/types/server/rscRenderFallbacks.d.ts +41 -0
- package/types/server/rscRenderHandler.d.ts +29 -0
- package/types/server/rscRenderStats.d.ts +32 -0
- package/types/server/rscResponse.d.ts +9 -0
- package/types/server/rscResultCaches.d.ts +18 -0
- package/types/server/rscRouteDocument.d.ts +52 -0
- package/types/server/rscSegmentOutlet.d.ts +5 -0
- package/types/server/rscSegmentOutletReference.d.ts +2 -1
- package/types/server/rscWorker.d.ts +1 -3
- package/types/server/rscWorkerCache.d.ts +33 -1
- package/types/server/rscWorkerHost.d.ts +9 -76
- package/types/server/rscWorkerProcess.d.ts +31 -0
- package/types/server/rscWorkerRecycler.d.ts +22 -0
- package/types/server/serverConfig.d.ts +30 -0
- package/types/server/serverMetrics.d.ts +11 -0
- package/types/server/sitemap.d.ts +1 -0
- package/types/server/ssrFromRscRenderer.d.ts +2 -2
- package/types/server/ssrTypes.d.ts +8 -0
- package/types/server/webArtifact.d.ts +7 -0
- package/types/server/webAssetRoutes.d.ts +11 -0
- package/types/server/webCsrSurface.d.ts +18 -0
- package/types/server/webDocumentRoute.d.ts +19 -0
- package/types/server/webRouteContext.d.ts +45 -0
- package/types/server/webRouter.d.ts +4 -35
- package/types/server/webRscRoute.d.ts +24 -0
- package/types/server/webSiteFiles.d.ts +12 -0
- package/types/server/wellKnownRoutes.d.ts +5 -0
- package/types/service/agent.service.d.ts +13 -4
- package/types/service/agentAccounts.d.ts +8 -0
- package/types/service/agentLoop/agentLoop.d.ts +31 -0
- package/types/service/agentLoop/agentLoopTypes.d.ts +126 -0
- package/types/service/agentLoop/deltaStream.d.ts +3 -0
- package/types/service/agentLoop/loopCompaction.d.ts +11 -0
- package/types/service/agentLoop/loopRequest.d.ts +6 -0
- package/types/service/agentLoop/loopToolOutput.d.ts +7 -0
- package/types/service/agentLoop/loopToolkits.d.ts +14 -0
- package/types/service/agentLoop/loopTranscript.d.ts +12 -0
- package/types/service/agentMeter.d.ts +50 -0
- package/types/service/agentRelayPolicy.d.ts +45 -0
- package/types/service/documentStoreError.d.ts +7 -0
- package/types/service/index.d.ts +7 -0
- package/types/service/injectError.d.ts +4 -0
- package/types/service/injectInfo.d.ts +2 -1
- package/types/service/insightQueryError.d.ts +9 -0
- package/types/service/ipcTypes.d.ts +6 -0
- package/types/service/predefinedAdaptor/agentTools.adaptor.d.ts +31 -0
- package/types/service/predefinedAdaptor/anthropicLlm.d.ts +2 -2
- package/types/service/predefinedAdaptor/index.d.ts +2 -0
- package/types/service/predefinedAdaptor/llm.adaptor.d.ts +18 -2
- package/types/service/predefinedAdaptor/llmSpend.d.ts +22 -0
- package/types/service/predefinedAdaptor/openaiDialect.d.ts +2 -1
- package/types/service/predefinedAdaptor/openaiLlm.d.ts +1 -1
- package/types/service/predefinedAdaptor/role.adaptor.d.ts +2 -0
- package/types/service/predefinedAdaptor/solidPubsub.adaptor.d.ts +3 -0
- package/types/service/predefinedAdaptor/solidSqlite.d.ts +1 -1
- package/types/service/predefinedAdaptor/sql/DocumentHydrator.d.ts +11 -0
- package/types/service/predefinedAdaptor/sql/DocumentRowCodec.d.ts +26 -0
- package/types/service/predefinedAdaptor/sql/DocumentWriter.d.ts +24 -0
- package/types/service/predefinedAdaptor/sql/QueryScope.d.ts +16 -0
- package/types/service/predefinedAdaptor/sql/QueryWriter.d.ts +20 -0
- package/types/service/predefinedAdaptor/sql/SqlDocumentStore.d.ts +1 -32
- package/types/service/predefinedAdaptor/sql/SqlTableSchema.d.ts +20 -0
- package/types/service/predefinedAdaptor/sql/StoredRows.d.ts +27 -0
- package/types/service/predefinedAdaptor/sql/driver/bunSqlite.d.ts +1 -14
- package/types/service/predefinedAdaptor/sql/driver/postgres.d.ts +0 -8
- package/types/service/predefinedAdaptor/sql/fieldValues.d.ts +5 -0
- package/types/service/predefinedAdaptor/sseData.d.ts +5 -0
- package/types/service/predefinedAdaptor/websocket.adaptor.d.ts +14 -5
- package/types/service/serviceModule.d.ts +1 -1
- package/types/service/serviceRegistry.d.ts +1 -0
- package/types/signal/SignalFailure.d.ts +2 -0
- package/types/signal/agentTurnStream.d.ts +2 -1
- package/types/signal/byIdRead.d.ts +7 -0
- package/types/signal/carriedClientIps.d.ts +4 -0
- package/types/signal/endpointErrorContract.d.ts +3 -0
- package/types/signal/exception.d.ts +1 -0
- package/types/signal/index.d.ts +32 -30
- package/types/signal/mcp/McpDocument.d.ts +2 -0
- package/types/signal/mcp/index.d.ts +1 -0
- package/types/signal/mcp/promptError.d.ts +5 -0
- package/types/signal/resolveFieldContext.d.ts +15 -0
- package/types/signal/serializer/fetch.serializer.d.ts +3 -1
- package/types/signal/signalContext.d.ts +1 -13
- package/types/signal/signalContractError.d.ts +4 -0
- package/types/signal/signalDeclarationError.d.ts +4 -0
- package/types/signal/slice.d.ts +15 -13
- package/types/signal/trace.d.ts +3 -0
- package/types/signal/types.d.ts +33 -6
- package/types/store/action.d.ts +8 -27
- package/types/store/actionErrorKey.d.ts +1 -0
- package/types/store/actionOption.d.ts +24 -0
- package/types/store/baseSt.d.ts +2 -295
- package/types/store/draftFlush.d.ts +4 -0
- package/types/store/formDrafts.d.ts +21 -0
- package/types/store/formFieldSetters.d.ts +80 -0
- package/types/store/index.d.ts +17 -16
- package/types/store/modelActionContext.d.ts +189 -0
- package/types/store/modelListPatch.d.ts +34 -0
- package/types/store/modelOpenActions.d.ts +12 -0
- package/types/store/modelWriteActions.d.ts +16 -0
- package/types/store/modelWriteGuard.d.ts +42 -0
- package/types/store/openSeq.d.ts +17 -0
- package/types/store/rootStore.d.ts +6 -0
- package/types/store/sliceListActions.d.ts +295 -0
- package/types/store/sliceLiveActions.d.ts +6 -0
- package/types/store/stateBuilder.d.ts +2 -0
- package/types/store/uploadPoll.d.ts +16 -0
- package/types/store/withSelector.d.ts +1 -1
- package/types/ui/Agent/Chat.d.ts +5 -2
- package/types/ui/Agent/ChatHeader.d.ts +13 -0
- package/types/ui/Agent/ChatPendingCards.d.ts +23 -0
- package/types/ui/Field/Choice.d.ts +2 -1
- package/types/ui/Field/index.d.ts +1 -1
- package/types/ui/Link/inputModality.d.ts +5 -0
- package/types/ui/Link/viewportPrefetch.d.ts +4 -0
- package/types/ui/Load/Edit_Client.d.ts +2 -0
- package/types/ui/Load/Pagination.d.ts +4 -1
- package/types/ui/Load/Stream.d.ts +7 -1
- package/types/ui/Load/StreamBoundary.d.ts +20 -0
- package/types/ui/Load/Units.d.ts +2 -0
- package/types/ui/Load/View.d.ts +2 -0
- package/types/ui/Reference/origin.d.ts +1 -0
- package/types/ui/index.d.ts +1 -1
- package/types/ui/overlayLayer.d.ts +6 -1
- package/types/ui/recipe/badgeRecipe.d.ts +3 -3
- package/types/ui/recipe/buttonRecipe.d.ts +3 -3
- package/types/ui/recipe/inputRecipe.d.ts +1 -1
- package/types/vendor/@akanjs/native/packages/cli/src/lib/project.d.ts +4 -0
- package/types/vendor/@akanjs/native/packages/desktop/src/relaunch.d.ts +1 -0
- package/types/vendor/@akanjs/native/plugins/appearance/src/index.d.ts +9 -0
- package/types/vendor/@akanjs/native/plugins/external-view/src/index.d.ts +18 -11
- package/types/vendor/use-agentic/AgentClientTools.d.ts +19 -0
- package/types/vendor/use-agentic/failureCode.d.ts +4 -0
- package/types/vendor/use-agentic/index.d.ts +1 -0
- package/types/vendor/use-agentic/types.d.ts +11 -0
- package/types/webkit/CsrGuards.d.ts +2 -0
- package/types/webkit/RouteLevelBoundary.d.ts +17 -0
- package/types/webkit/nativeCore.d.ts +1 -0
- package/types/webkit/nativePurchase.d.ts +2 -1
- package/types/webkit/useCsrKeyboard.d.ts +19 -0
- package/types/webkit/useCsrLocationState.d.ts +21 -0
- package/types/webkit/useCsrNavigation.d.ts +25 -0
- package/types/webkit/useCsrRefs.d.ts +33 -0
- package/types/webkit/useCsrRenderTrace.d.ts +13 -0
- package/types/webkit/useCsrStackLifecycle.d.ts +12 -0
- package/types/webkit/useCsrTransitions.d.ts +2 -0
- package/types/webkit/useFrameRuntime.d.ts +1 -0
- package/types/webkit/useGeoLocation.d.ts +1 -1
- package/types/webkit/useHistory.d.ts +2 -3
- package/types/webkit/usePurchase.d.ts +1 -1
- package/types/webkit/useResolvedFrame.d.ts +38 -0
- package/types/webkit/useSyncNavigation.d.ts +22 -0
- package/types/webkit/useTransitionStore.d.ts +1 -0
- package/ui/Agent/Chat.tsx +392 -235
- package/ui/Agent/ChatHeader.tsx +59 -0
- package/ui/Agent/ChatPendingCards.tsx +49 -0
- package/ui/Agent/fetchRunner.ts +8 -1
- package/ui/BottomSheet.tsx +1 -1
- package/ui/Button.tsx +1 -0
- package/ui/Data/Item.tsx +2 -2
- package/ui/Data/ListContainer.tsx +348 -181
- package/ui/Data/useViewModal.ts +10 -4
- package/ui/Dialog/LegacyModal.tsx +1 -1
- package/ui/Dialog/Modal.tsx +1 -1
- package/ui/Field/Choice.tsx +3 -1
- package/ui/Link/inputModality.ts +21 -0
- package/ui/Link/prefetchIntent.ts +7 -25
- package/ui/Link/viewportPrefetch.ts +30 -0
- package/ui/Load/Edit_Client.tsx +7 -1
- package/ui/Load/Pagination.tsx +10 -2
- package/ui/Load/Stream.tsx +24 -4
- package/ui/Load/StreamBoundary.tsx +65 -0
- package/ui/Load/Units.tsx +3 -0
- package/ui/Load/View.tsx +5 -1
- package/ui/Model/EditModal.tsx +2 -1
- package/ui/Popconfirm.tsx +1 -1
- package/ui/Reference/origin.ts +1 -0
- package/ui/Select.tsx +43 -51
- package/ui/Signal/RestApi.tsx +3 -2
- package/ui/System/Client.tsx +32 -8
- package/ui/index.ts +4 -0
- package/ui/overlayLayer.ts +22 -1
- package/vendor/@akanjs/native/CHANGELOG.md +7 -1
- package/vendor/@akanjs/native/native/android/src/com/akanjs/runtime/AkanNativeActivity.kt +27 -12
- package/vendor/@akanjs/native/native/android/src/com/akanjs/runtime/AkanNativePlugin.kt +4 -0
- package/vendor/@akanjs/native/native/desktop/src/external.rs +213 -111
- package/vendor/@akanjs/native/native/desktop/src/lib.rs +12 -4
- package/vendor/@akanjs/native/native/desktop/src/linux/external.rs +509 -0
- package/vendor/@akanjs/native/native/desktop/src/linux/mod.rs +1 -0
- package/vendor/@akanjs/native/native/ios/Sources/AkanNativeViewController.swift +6 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/native-plugins.ts +5 -3
- package/vendor/@akanjs/native/packages/cli/src/lib/project.ts +25 -1
- package/vendor/@akanjs/native/packages/desktop/src/deeplinks.ts +2 -2
- package/vendor/@akanjs/native/packages/desktop/src/host.ts +2 -2
- package/vendor/@akanjs/native/packages/desktop/src/relaunch.ts +8 -3
- package/vendor/@akanjs/native/plugins/app/src/desktop.ts +2 -2
- package/vendor/@akanjs/native/plugins/appearance/android/AppearancePlugin.kt +13 -0
- package/vendor/@akanjs/native/plugins/appearance/ios/AppearancePlugin.swift +27 -0
- package/vendor/@akanjs/native/plugins/appearance/native-plugin.json +2 -2
- package/vendor/@akanjs/native/plugins/appearance/src/index.ts +8 -1
- package/vendor/@akanjs/native/plugins/autostart/src/desktop.ts +2 -1
- package/vendor/@akanjs/native/plugins/external-view/native-plugin.json +4 -1
- package/vendor/@akanjs/native/plugins/external-view/src/index.ts +18 -11
- package/vendor/use-agentic/AgentClientTools.ts +33 -0
- package/vendor/use-agentic/AgentSession.ts +11 -11
- package/vendor/use-agentic/CHANGELOG.md +46 -1
- package/vendor/use-agentic/Compaction.ts +2 -1
- package/vendor/use-agentic/ToolRunner.ts +6 -3
- package/vendor/use-agentic/Transcript.ts +6 -3
- package/vendor/use-agentic/WIRE.md +29 -7
- package/vendor/use-agentic/failureCode.ts +44 -0
- package/vendor/use-agentic/httpRunner.ts +15 -4
- package/vendor/use-agentic/index.ts +1 -0
- package/vendor/use-agentic/types.ts +11 -0
- package/webkit/CsrGuards.ts +7 -2
- package/webkit/McpAppAgent.ts +8 -3
- package/webkit/McpAppFetchBridge.ts +11 -5
- package/webkit/RouteLevelBoundary.tsx +37 -0
- package/webkit/nativeCore.ts +1 -0
- package/webkit/nativePurchase.ts +6 -3
- package/webkit/useCamera.tsx +22 -21
- package/webkit/useCsrKeyboard.ts +155 -0
- package/webkit/useCsrLocationState.ts +58 -0
- package/webkit/useCsrNavigation.ts +302 -0
- package/webkit/useCsrRefs.ts +52 -0
- package/webkit/useCsrRenderTrace.ts +68 -0
- package/webkit/useCsrStackLifecycle.ts +120 -0
- package/webkit/useCsrTransitions.ts +552 -0
- package/webkit/useCsrValues.ts +69 -1234
- package/webkit/useGeoLocation.tsx +4 -1
- package/webkit/useHistory.ts +2 -2
- package/webkit/useLocation.ts +3 -2
- package/webkit/usePurchase.tsx +4 -2
- package/webkit/useResolvedFrame.ts +116 -0
- package/webkit/useSyncNavigation.ts +109 -0
- package/webkit/useTransitionStore.ts +13 -0
- package/types/signal/agentMeter.d.ts +0 -27
- package/types/signal/agentRelayPolicy.d.ts +0 -25
package/common/mcpExposure.ts
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { modelNames } from "./akanNames";
|
|
2
2
|
|
|
3
|
+
/** `"agent"` lists it to the in-process agent (`AgentToolsRole`, `agentService.loop`) and keeps it off `/mcp`. */
|
|
4
|
+
export type McpShelf = boolean | "agent";
|
|
5
|
+
|
|
6
|
+
export const narrowestMcpShelf = (shelves: readonly McpShelf[]): McpShelf =>
|
|
7
|
+
shelves.includes(false) ? false : shelves.includes("agent") ? "agent" : true;
|
|
8
|
+
|
|
3
9
|
export interface McpExposureEndpoint {
|
|
4
10
|
type: string;
|
|
5
11
|
returns: { refName: string };
|
|
6
12
|
args: { name: string; refName: string; type: string; arrDepth?: number; nullable?: boolean }[];
|
|
7
13
|
guards?: string[];
|
|
8
14
|
fileUpload?: boolean;
|
|
9
|
-
mcp?:
|
|
15
|
+
mcp?: McpShelf;
|
|
10
16
|
/** `false` when a guard declares `static agents = false`: no model may ever pass, whatever else the guards say. */
|
|
11
17
|
agents?: boolean;
|
|
18
|
+
destructive?: boolean;
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
export interface McpExposureOption {
|
|
@@ -18,6 +25,8 @@ export interface McpExposureOption {
|
|
|
18
25
|
readOnly?: boolean;
|
|
19
26
|
/** MCP Apps: judges what a rendered view may call, which lifts the two refusals that only curate a model's shelf. */
|
|
20
27
|
view?: boolean;
|
|
28
|
+
/** The in-process agent catalogue, which also lists an endpoint declared `mcp: "agent"`. */
|
|
29
|
+
agent?: boolean;
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
/** `Any` publishes as the empty schema, which tells a model nothing, so it is left out. */
|
|
@@ -33,9 +42,11 @@ export const mcpBaseVerbOf = (refName: string, key: string) => {
|
|
|
33
42
|
};
|
|
34
43
|
|
|
35
44
|
/** Hints never stand in for a guard; `openWorldHint` is false: every endpoint reaches this app's own database. */
|
|
36
|
-
export const mcpHintsOf = (key: string, endpoint: { type: string }) => {
|
|
45
|
+
export const mcpHintsOf = (key: string, endpoint: { type: string; destructive?: boolean }) => {
|
|
37
46
|
const readOnly = endpoint.type === "query";
|
|
38
|
-
const destructive =
|
|
47
|
+
const destructive =
|
|
48
|
+
!readOnly &&
|
|
49
|
+
(endpoint.destructive ?? /^(remove|delete|purge|destroy|erase|wipe|drop|cancel|bulkRemove|bulkDelete)/.test(key));
|
|
39
50
|
return {
|
|
40
51
|
readOnlyHint: readOnly,
|
|
41
52
|
destructiveHint: destructive,
|
|
@@ -46,10 +57,12 @@ export const mcpHintsOf = (key: string, endpoint: { type: string }) => {
|
|
|
46
57
|
|
|
47
58
|
export const mcpRefusalOf = (
|
|
48
59
|
endpoint: McpExposureEndpoint,
|
|
49
|
-
{ refName, key, readOnly, view }: McpExposureOption,
|
|
60
|
+
{ refName, key, readOnly, view, agent }: McpExposureOption,
|
|
50
61
|
): string | null => {
|
|
51
62
|
if (endpoint.mcp === false && !view)
|
|
52
63
|
return "it declares `mcp: false`, so it is deliberately off the agent shelf. HTTP still serves it.";
|
|
64
|
+
if (endpoint.mcp === "agent" && !agent && !view)
|
|
65
|
+
return 'it declares `mcp: "agent"`, so only the in-process agent lists it, never `/mcp`. HTTP still serves it.';
|
|
53
66
|
|
|
54
67
|
if (endpoint.agents === false)
|
|
55
68
|
return `its guards (${(endpoint.guards ?? []).join(", ")}) admit no agent — an act reserved for a person, so it is off the agent shelf. HTTP still serves it.`;
|
package/common/pipelinePlan.ts
CHANGED
|
@@ -29,7 +29,7 @@ export const pipelineActions = {
|
|
|
29
29
|
ota: { version: 1, milestone: "deploy", name: "OTA" },
|
|
30
30
|
} as const satisfies Record<string, { version: number; milestone: PipelineMilestone; name: string }>;
|
|
31
31
|
export type PipelineActionName = keyof typeof pipelineActions;
|
|
32
|
-
export const pipelineActionNames = Object.keys(pipelineActions) as readonly PipelineActionName[];
|
|
32
|
+
export const pipelineActionNames = /* @__PURE__ */ Object.keys(pipelineActions) as readonly PipelineActionName[];
|
|
33
33
|
|
|
34
34
|
/** The phones an `ota` action packs for; a desktop app updates itself whole, outside a pipeline. */
|
|
35
35
|
export const pipelineOtaPlatforms = ["ios", "android"] as const;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Backoff, type BackoffPolicy } from "./backoff";
|
|
2
|
+
|
|
3
|
+
export interface RestartPolicy extends BackoffPolicy {
|
|
4
|
+
maxAttempts?: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export class RestartSchedule {
|
|
8
|
+
readonly #policy: RestartPolicy;
|
|
9
|
+
#attempts = 0;
|
|
10
|
+
#timer: ReturnType<typeof setTimeout> | null = null;
|
|
11
|
+
|
|
12
|
+
constructor({ jitter = 0, ...policy }: RestartPolicy = {}) {
|
|
13
|
+
this.#policy = { ...policy, jitter };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get attempts() {
|
|
17
|
+
return this.#attempts;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get pending() {
|
|
21
|
+
return this.#timer !== null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get exhausted() {
|
|
25
|
+
return this.#policy.maxAttempts !== undefined && this.#attempts >= this.#policy.maxAttempts;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
next() {
|
|
29
|
+
this.#attempts += 1;
|
|
30
|
+
return Backoff.delay(this.#attempts, this.#policy);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
arm(delay: number, run: () => void) {
|
|
34
|
+
this.cancel();
|
|
35
|
+
this.#timer = setTimeout(() => {
|
|
36
|
+
this.#timer = null;
|
|
37
|
+
run();
|
|
38
|
+
}, delay);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
schedule(run: () => void) {
|
|
42
|
+
const delay = this.next();
|
|
43
|
+
this.arm(delay, run);
|
|
44
|
+
return delay;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
cancel() {
|
|
48
|
+
if (this.#timer) clearTimeout(this.#timer);
|
|
49
|
+
this.#timer = null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
reset() {
|
|
53
|
+
this.#attempts = 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -19,6 +19,8 @@ export const PAGE_ROUTE_EXPORTS: ReadonlySet<string> = new Set([
|
|
|
19
19
|
"guard",
|
|
20
20
|
]);
|
|
21
21
|
export const LAYOUT_ROUTE_EXPORTS: ReadonlySet<string> = new Set([...PAGE_ROUTE_EXPORTS, "NotFound", "Error"]);
|
|
22
|
+
/** Root-layout exports the generated root layout defines itself: it reads none of them from an app's root layout. */
|
|
23
|
+
export const GENERATED_ROOT_LAYOUT_EXPORTS: ReadonlySet<string> = new Set(["McpAppRoot", "LevelBoundary"]);
|
|
22
24
|
export const ROOT_LAYOUT_ROUTE_EXPORTS: ReadonlySet<string> = new Set([
|
|
23
25
|
...LAYOUT_ROUTE_EXPORTS,
|
|
24
26
|
"fonts",
|
|
@@ -28,7 +30,7 @@ export const ROOT_LAYOUT_ROUTE_EXPORTS: ReadonlySet<string> = new Set([
|
|
|
28
30
|
"wsConnect",
|
|
29
31
|
"layoutStyle",
|
|
30
32
|
"viewport",
|
|
31
|
-
|
|
33
|
+
...GENERATED_ROOT_LAYOUT_EXPORTS,
|
|
32
34
|
]);
|
|
33
35
|
/** Root-layout exports that are plain config rather than components, so a PascalCase check cannot allow them. */
|
|
34
36
|
export const RESERVED_ROUTE_CONFIG_EXPORTS: ReadonlySet<string> = new Set(
|
package/common/types.ts
CHANGED
|
@@ -23,7 +23,10 @@ export interface FetchPolicy<_Returns = unknown> {
|
|
|
23
23
|
* A mutation ignores it, since one already sent may have run.
|
|
24
24
|
*/
|
|
25
25
|
signal?: AbortSignal;
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* `pubsub` only: called when the room may have missed events — after a resubscribe, at a frame the server dropped
|
|
28
|
+
* for this socket, or once the server's link to the app's other servers returns — so refetch what the room shows.
|
|
29
|
+
*/
|
|
27
30
|
onResync?: () => void;
|
|
28
31
|
/**
|
|
29
32
|
* Tries again when the server is unreachable, restarting (502/503), too slow (504) or limiting (429, after its
|
|
@@ -38,6 +41,20 @@ export interface FetchPolicy<_Returns = unknown> {
|
|
|
38
41
|
* it, so only a write that is harmless to repeat and safe for anyone to trigger may pass it.
|
|
39
42
|
*/
|
|
40
43
|
duringRender?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Marks a write that changes nothing a query reads back, such as a typing notice: queries already in flight and the
|
|
46
|
+
* pages a link prefetched survive it, where any other write sends them again.
|
|
47
|
+
*/
|
|
48
|
+
keepsReads?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* `false` sends a call made while the server renders a page without the visitor's session or address, so it answers
|
|
51
|
+
* as to a stranger and the render can stay in the route result cache. An explicit `token` and the client's own `jwt`
|
|
52
|
+
* and `clientIp` still go, and a browser's call is unchanged. Only for an endpoint that answers every caller alike:
|
|
53
|
+
* every visitor's render then shares one budget under the server's own address, so give that endpoint
|
|
54
|
+
* `rateLimit: false` (or exempt it) rather than an address budget, or one client forcing renders spends it for
|
|
55
|
+
* everyone.
|
|
56
|
+
*/
|
|
57
|
+
forwardVisitor?: boolean;
|
|
41
58
|
}
|
|
42
59
|
|
|
43
60
|
export type SnakeCase<S extends string> = S extends `${infer T}_${infer U}` ? `${Lowercase<T>}_${SnakeCase<U>}` : S;
|
|
@@ -8,16 +8,12 @@ import {
|
|
|
8
8
|
type PrimitiveValue,
|
|
9
9
|
} from "akanjs/base";
|
|
10
10
|
import { capitalize, lowerlize } from "akanjs/common";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
type ConstantModelRef,
|
|
14
|
-
deserialize,
|
|
15
|
-
type FieldObject,
|
|
16
|
-
type PurifiedModel,
|
|
17
|
-
serialize,
|
|
18
|
-
} from ".";
|
|
11
|
+
import type { FieldObject } from "./fieldInfo";
|
|
12
|
+
import type { PurifiedModel } from "./purify";
|
|
19
13
|
import { RefNameClaims, type RefNameOwner } from "./refNameClaims";
|
|
14
|
+
import { deserialize, serialize } from "./serialize";
|
|
20
15
|
import type { ConstantType, DefaultOf, DocumentModel, QueryOf } from "./types";
|
|
16
|
+
import type { ConstantCls, ConstantModelRef } from "./via";
|
|
21
17
|
|
|
22
18
|
export class ConstantRegistry {
|
|
23
19
|
static database = new Map<string, ConstantModel>();
|
package/constant/crystalize.ts
CHANGED
|
@@ -6,9 +6,8 @@ import {
|
|
|
6
6
|
PrimitiveRegistry,
|
|
7
7
|
type PrimitiveScalar,
|
|
8
8
|
} from "akanjs/base";
|
|
9
|
-
|
|
10
|
-
import type { FieldProps } from ".";
|
|
11
9
|
import { ConstantRegistry } from "./constantRegistry";
|
|
10
|
+
import type { FieldProps } from "./fieldInfo";
|
|
12
11
|
|
|
13
12
|
export type CrystalizeFunc<Model> = (self: GetStateObject<Model>, isChild?: boolean) => Model;
|
|
14
13
|
export type Converter = (value: unknown) => unknown;
|
package/constant/getDefault.ts
CHANGED
package/constant/immerify.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FIELD_META } from "akanjs/base";
|
|
2
2
|
import { plainFieldsOf } from "akanjs/common";
|
|
3
3
|
import { immerable } from "immer";
|
|
4
|
-
import type { ConstantModelRef } from "
|
|
4
|
+
import type { ConstantModelRef } from "./via";
|
|
5
5
|
|
|
6
6
|
export const immerify = <T extends object>(modelRef: ConstantModelRef, objOrArr: T): T => {
|
|
7
7
|
if (Array.isArray(objOrArr)) return objOrArr.map((val) => immerify(modelRef, val as object)) as T;
|
package/constant/index.ts
CHANGED
|
@@ -1,21 +1,78 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
export { type CascadeAction, CascadePaths, type CascadeWithPath, cascadeActions } from "./cascadePaths";
|
|
2
|
+
export {
|
|
3
|
+
type ConstantModel,
|
|
4
|
+
type ConstantOriginKind,
|
|
5
|
+
ConstantRegistry,
|
|
6
|
+
type ScalarConstantModel,
|
|
7
|
+
} from "./constantRegistry";
|
|
8
|
+
export { type Converter, type CrystalizeFunc, converterOf, crystalize, withSharedInstances } from "./crystalize";
|
|
9
|
+
export { dateAccessorOf, dateSlotOf, isDateSlotField, toDateValue } from "./dateSlot";
|
|
10
|
+
export {
|
|
11
|
+
ConstantField,
|
|
12
|
+
type ConstantFieldKind,
|
|
13
|
+
type ConstantFieldProps,
|
|
14
|
+
type ConstantFieldType,
|
|
15
|
+
type ConstantFieldTypeInput,
|
|
16
|
+
type ExtractFieldInfoObject,
|
|
17
|
+
type FieldBuilder,
|
|
18
|
+
type FieldInfoObject,
|
|
19
|
+
type FieldInfoObjectToFieldObject,
|
|
20
|
+
type FieldObject,
|
|
21
|
+
type FieldPreset,
|
|
22
|
+
type FieldProps,
|
|
23
|
+
type FieldResolver,
|
|
24
|
+
type FieldToValue,
|
|
25
|
+
field,
|
|
26
|
+
fieldPresets,
|
|
27
|
+
type ParamFieldType,
|
|
28
|
+
type PlainTypeToFieldType,
|
|
29
|
+
resolve,
|
|
30
|
+
} from "./fieldInfo";
|
|
31
|
+
export { FieldPlan, type FieldPlanEntry, type FieldPlanKind } from "./fieldPlan";
|
|
32
|
+
export { type FieldQueryMeta, fieldQueryMetaOf } from "./fieldQueryMeta";
|
|
33
|
+
export { type DefaultPlan, defaultPlanOf, freshPrimitiveValue, getDefault } from "./getDefault";
|
|
34
|
+
export { HydrationPlan } from "./hydrationPlan";
|
|
35
|
+
export { immerify } from "./immerify";
|
|
36
|
+
export { InputParser } from "./inputParser";
|
|
37
|
+
export { InvalidInputError } from "./invalidInputError";
|
|
38
|
+
export { labelOf } from "./labelOf";
|
|
39
|
+
export { agentRead, leakingFieldsOf, type MaskModel, mask, maskFieldsOf, stripSecrets } from "./mask";
|
|
40
|
+
export { makePurify, type PurifiedModel, type PurifyFunc, type PurifyFuncV2, type UploadableClientArg } from "./purify";
|
|
41
|
+
export { RequestValue } from "./requestValue";
|
|
42
|
+
export { deserialize, type Serialized, serialize } from "./serialize";
|
|
43
|
+
export { TextFieldPathSet } from "./textFieldPathSet";
|
|
44
|
+
export { TextFieldPaths, type TextFieldRole, textFieldRoles } from "./textFieldPaths";
|
|
45
|
+
export {
|
|
46
|
+
BaseInsight,
|
|
47
|
+
BaseObject,
|
|
48
|
+
type ConstantType,
|
|
49
|
+
DEFAULT_PAGE_SIZE,
|
|
50
|
+
type DefaultOf,
|
|
51
|
+
type DefaultOfSchema,
|
|
52
|
+
type DocumentModel,
|
|
53
|
+
type FieldState,
|
|
54
|
+
type GetPlainObject,
|
|
55
|
+
MAX_INT,
|
|
56
|
+
MAX_PAGE_SIZE,
|
|
57
|
+
type NonFunctionalKeys,
|
|
58
|
+
type ProtoAppInfo,
|
|
59
|
+
type ProtoFile,
|
|
60
|
+
type ProtoLightFile,
|
|
61
|
+
type ProtoPatch,
|
|
62
|
+
type QueryOf,
|
|
63
|
+
Responsive,
|
|
64
|
+
resolvePageLimit,
|
|
65
|
+
resolvePageSkip,
|
|
66
|
+
responsiveWidths,
|
|
67
|
+
type ServerArgModel,
|
|
68
|
+
unsetDate,
|
|
69
|
+
} from "./types";
|
|
70
|
+
export {
|
|
71
|
+
type ConstantCls,
|
|
72
|
+
type ConstantMethods,
|
|
73
|
+
type ConstantModelRef,
|
|
74
|
+
type ConstantStatics,
|
|
75
|
+
type DatabaseConstantStatics,
|
|
76
|
+
type DocumentConstantModelRef,
|
|
77
|
+
via,
|
|
78
|
+
} from "./via";
|
package/constant/purify.ts
CHANGED
|
@@ -12,15 +12,10 @@ import {
|
|
|
12
12
|
type PrimitiveScalar,
|
|
13
13
|
} from "akanjs/base";
|
|
14
14
|
import { Logger } from "akanjs/common";
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
ConstantRegistry,
|
|
20
|
-
type DefaultOf,
|
|
21
|
-
type DefaultOfSchema,
|
|
22
|
-
type FieldProps,
|
|
23
|
-
} from ".";
|
|
15
|
+
import { ConstantRegistry } from "./constantRegistry";
|
|
16
|
+
import type { FieldProps } from "./fieldInfo";
|
|
17
|
+
import type { BaseObject, DefaultOf, DefaultOfSchema } from "./types";
|
|
18
|
+
import type { ConstantModelRef } from "./via";
|
|
24
19
|
|
|
25
20
|
type Purified<O> = O extends BaseObject
|
|
26
21
|
? string
|
package/constant/serialize.ts
CHANGED
|
@@ -10,9 +10,11 @@ import {
|
|
|
10
10
|
PrimitiveRegistry,
|
|
11
11
|
type PrimitiveScalar,
|
|
12
12
|
} from "akanjs/base";
|
|
13
|
-
|
|
14
|
-
import {
|
|
13
|
+
import { ConstantRegistry } from "./constantRegistry";
|
|
14
|
+
import { withSharedInstances } from "./crystalize";
|
|
15
|
+
import type { FieldProps } from "./fieldInfo";
|
|
15
16
|
import { FieldPlan } from "./fieldPlan";
|
|
17
|
+
import type { ConstantCls, ConstantModelRef } from "./via";
|
|
16
18
|
|
|
17
19
|
export type Serialized<O> = O extends (infer V)[]
|
|
18
20
|
? Serialized<V>[]
|
package/constant/types.ts
CHANGED
|
@@ -139,6 +139,7 @@ export type NonFunctionalKeys<T> = {
|
|
|
139
139
|
}[keyof T];
|
|
140
140
|
|
|
141
141
|
export const unsetDate = dayjs(new Date("0000"));
|
|
142
|
+
/** @deprecated Unused by akanjs; write the int32 bound `2 ** 31 - 1` where it is meant. */
|
|
142
143
|
export const MAX_INT = 2147483647;
|
|
143
144
|
|
|
144
145
|
export class Responsive extends enumOf("responsive", ["xl", "lg", "md", "sm", "xs"] as const) {}
|
package/constant/via.ts
CHANGED
|
@@ -13,8 +13,6 @@ import {
|
|
|
13
13
|
} from "akanjs/base";
|
|
14
14
|
import { applyMixins, plainFieldsOf } from "akanjs/common";
|
|
15
15
|
import { immerable } from "immer";
|
|
16
|
-
|
|
17
|
-
import { getDefault } from ".";
|
|
18
16
|
import { CascadePaths } from "./cascadePaths";
|
|
19
17
|
import { ConstantRegistry } from "./constantRegistry";
|
|
20
18
|
import { dateAccessorOf, isDateSlotField } from "./dateSlot";
|
|
@@ -30,6 +28,7 @@ import {
|
|
|
30
28
|
resolve,
|
|
31
29
|
} from "./fieldInfo";
|
|
32
30
|
import { FieldPlan } from "./fieldPlan";
|
|
31
|
+
import { getDefault } from "./getDefault";
|
|
33
32
|
import { HydrationPlan } from "./hydrationPlan";
|
|
34
33
|
import { makePurify, type PurifiedModel, type PurifyFunc } from "./purify";
|
|
35
34
|
import { TextFieldPaths } from "./textFieldPaths";
|
|
@@ -39,6 +39,10 @@ export const agentDictionary = serviceDictionary(["en", "ko"])
|
|
|
39
39
|
"이 계정의 에이전트 사용 한도에 도달했습니다.",
|
|
40
40
|
],
|
|
41
41
|
requestRefused: ["This app's agent does not take this request", "이 앱의 에이전트는 이 요청을 받지 않습니다."],
|
|
42
|
+
accountResolverMissing: [
|
|
43
|
+
"An agent loop named a principal, and this server has no account resolver to resolve it with",
|
|
44
|
+
"에이전트 루프에 principal이 주어졌지만 이 서버에는 이를 해석할 계정 resolver가 없습니다.",
|
|
45
|
+
],
|
|
42
46
|
});
|
|
43
47
|
|
|
44
48
|
export const agentTurnDictionary = scalarDictionary(["en", "ko"])
|
|
@@ -109,6 +109,7 @@ export const baseDictionary = serviceDictionary(["en", "ko"])
|
|
|
109
109
|
retry: ["Try again", "다시 시도"],
|
|
110
110
|
copy: ["Copy", "복사"],
|
|
111
111
|
pageLoadFailed: ["This page could not be loaded.", "이 화면을 불러오지 못했습니다."],
|
|
112
|
+
loadFailed: ["This could not be loaded.", "불러오지 못했습니다."],
|
|
112
113
|
pageNotFound: ["This page does not exist.", "없는 화면입니다."],
|
|
113
114
|
goBack: ["Go back", "돌아가기"],
|
|
114
115
|
unauthorized: ["Unauthorized", "권한 없음"],
|
package/dictionary/locale.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GetStateObject, MergedValues } from "akanjs/base";
|
|
2
2
|
import type { BaseInsight, BaseObject } from "akanjs/constant";
|
|
3
3
|
import type { SliceInfo, SliceInfoArgNames, SliceInfoRefName } from "akanjs/signal";
|
|
4
|
-
import type { ModelDictInfo, ScalarDictInfo, ServiceDictInfo } from "
|
|
4
|
+
import type { ModelDictInfo, ScalarDictInfo, ServiceDictInfo } from "./dictInfo";
|
|
5
5
|
import type { DictArgNames, DictEndpointShape, DictFilterQuery, DictFilterSort, DictSliceShape } from "./dictShape";
|
|
6
6
|
|
|
7
7
|
interface Trans {
|
package/dictionary/trans.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import type { GetStateObject, ObjectAssign, Prettify } from "akanjs/base";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Err,
|
|
4
|
+
type ErrConstructor,
|
|
5
|
+
type ErrPayload,
|
|
6
|
+
interpolateTranslation,
|
|
7
|
+
parseAkanI18nEnv,
|
|
8
|
+
pathGetLoose,
|
|
9
|
+
} from "akanjs/common";
|
|
3
10
|
|
|
4
11
|
import { DictionaryRegistry } from "./dictionaryRegistry";
|
|
5
12
|
import type { DictModule } from "./locale";
|
|
6
13
|
|
|
14
|
+
export type { ErrConstructor, ErrPayload, ErrRestoreOption } from "akanjs/common";
|
|
15
|
+
|
|
7
16
|
type TranslationSingle = readonly [string, string] | readonly [string, string, string, string];
|
|
8
17
|
type TranslationWithParam = readonly [string, string, { [key: string]: string | number }];
|
|
9
18
|
export type Translation = TranslationSingle | TranslationWithParam;
|
|
@@ -36,20 +45,7 @@ export interface TransMessageOption {
|
|
|
36
45
|
data?: TranslationData;
|
|
37
46
|
}
|
|
38
47
|
|
|
39
|
-
|
|
40
|
-
statusCode?: number;
|
|
41
|
-
/** A generalized failure's `AkanError` code, which a restored copy keeps so its caller can branch on it. */
|
|
42
|
-
code?: string;
|
|
43
|
-
details?: unknown;
|
|
44
|
-
path?: string;
|
|
45
|
-
timestamp?: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ErrPayload extends ErrRestoreOption {
|
|
49
|
-
error: string;
|
|
50
|
-
data?: TranslationData;
|
|
51
|
-
}
|
|
52
|
-
|
|
48
|
+
/** @deprecated `Err` from `akanjs/common`, the class every dictionary's `Err` is. */
|
|
53
49
|
export type ErrInstance = Error & {
|
|
54
50
|
readonly error: string;
|
|
55
51
|
readonly statusCode: number;
|
|
@@ -60,22 +56,11 @@ export type ErrInstance = Error & {
|
|
|
60
56
|
readonly timestamp?: string;
|
|
61
57
|
toJSON(): ErrPayload & { statusCode: number };
|
|
62
58
|
};
|
|
59
|
+
|
|
63
60
|
type MsgApi<Key> = {
|
|
64
61
|
[Level in "info" | "success" | "error" | "warning" | "loading"]: (key: Key, option?: TransMessageOption) => void;
|
|
65
62
|
};
|
|
66
63
|
|
|
67
|
-
export type ErrConstructor<ErrorKey extends string> = {
|
|
68
|
-
new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption): ErrInstance;
|
|
69
|
-
prototype: ErrInstance;
|
|
70
|
-
fromJSON(payload: ErrPayload): ErrInstance;
|
|
71
|
-
is<Key extends ErrorKey>(error: unknown, ...keys: Key[]): error is ErrInstance & { readonly error: Key };
|
|
72
|
-
BadRequest: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
|
|
73
|
-
Unauthorized: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
|
|
74
|
-
Forbidden: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
|
|
75
|
-
NotFound: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
|
|
76
|
-
Conflict: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
64
|
const unclaimed = (level: string) => () => {
|
|
80
65
|
if (unclaimed.warned) return null;
|
|
81
66
|
unclaimed.warned = true;
|
|
@@ -113,75 +98,7 @@ export const makeTrans = <
|
|
|
113
98
|
const rootDictionary = {} as RootDictionary;
|
|
114
99
|
for (const [refName, trans] of Object.entries(transMap)) trans.dict._registerToRoot(refName, rootDictionary);
|
|
115
100
|
DictionaryRegistry.register(rootDictionary, transMap);
|
|
116
|
-
|
|
117
|
-
declare static status?: number;
|
|
118
|
-
readonly error: string;
|
|
119
|
-
readonly statusCode: number;
|
|
120
|
-
readonly code?: string;
|
|
121
|
-
readonly details?: unknown;
|
|
122
|
-
readonly data?: TranslationData;
|
|
123
|
-
readonly path?: string;
|
|
124
|
-
readonly timestamp?: string;
|
|
125
|
-
|
|
126
|
-
constructor(key: _ErrorKey, data?: TranslationData, option: ErrRestoreOption = {}) {
|
|
127
|
-
super(key as string);
|
|
128
|
-
this.name = this.constructor.name;
|
|
129
|
-
this.error = key as string;
|
|
130
|
-
this.statusCode = new.target.status ?? option.statusCode ?? 400;
|
|
131
|
-
this.code = option.code;
|
|
132
|
-
this.details = option.details;
|
|
133
|
-
this.data = data;
|
|
134
|
-
this.path = option.path;
|
|
135
|
-
this.timestamp = option.timestamp;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
override toString() {
|
|
139
|
-
return this.data === undefined
|
|
140
|
-
? `${this.name}: ${this.message}`
|
|
141
|
-
: `${this.name}: ${this.message} ${Logger.inlineData(this.data)}`;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
toJSON() {
|
|
145
|
-
return {
|
|
146
|
-
error: this.message,
|
|
147
|
-
statusCode: this.statusCode,
|
|
148
|
-
...(this.code !== undefined ? { code: this.code } : {}),
|
|
149
|
-
...(this.details !== undefined ? { details: this.details } : {}),
|
|
150
|
-
...(this.data !== undefined ? { data: this.data } : {}),
|
|
151
|
-
...(this.path !== undefined ? { path: this.path } : {}),
|
|
152
|
-
...(this.timestamp !== undefined ? { timestamp: this.timestamp } : {}),
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
static fromJSON(payload: ErrPayload) {
|
|
157
|
-
return new Err(payload.error as _ErrorKey, payload.data, payload);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/** An Akan error, and one of `keys` when any are named; read off `error`, so a restored remote one passes too. */
|
|
161
|
-
static is<Key extends _ErrorKey>(error: unknown, ...keys: Key[]): error is ErrInstance & { readonly error: Key } {
|
|
162
|
-
return hasErrKey(error, keys);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
static BadRequest = class BadRequestErr extends Err {
|
|
166
|
-
static override status = 400;
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
static Unauthorized = class UnauthorizedErr extends Err {
|
|
170
|
-
static override status = 401;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
static Forbidden = class ForbiddenErr extends Err {
|
|
174
|
-
static override status = 403;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
static NotFound = class NotFoundErr extends Err {
|
|
178
|
-
static override status = 404;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
static Conflict = class ConflictErr extends Err {
|
|
182
|
-
static override status = 409;
|
|
183
|
-
};
|
|
184
|
-
}
|
|
101
|
+
const DictionaryErr: ErrConstructor<_ErrorKey> = Err;
|
|
185
102
|
const lookup = (lang: string, modelName: string, msgKey: string) => {
|
|
186
103
|
const model = rootDictionary[lang]?.[modelName];
|
|
187
104
|
if (!model) return undefined;
|
|
@@ -200,7 +117,7 @@ export const makeTrans = <
|
|
|
200
117
|
return interpolateTranslation(message, data);
|
|
201
118
|
};
|
|
202
119
|
return {
|
|
203
|
-
Err,
|
|
120
|
+
Err: DictionaryErr,
|
|
204
121
|
translate,
|
|
205
122
|
msg,
|
|
206
123
|
getDictionary: (lang: Language) => rootDictionary[lang],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ConstantCls } from "akanjs/constant";
|
|
2
|
-
import type { DatabaseCls
|
|
2
|
+
import type { DatabaseCls } from "./by";
|
|
3
|
+
import type { ExtractQuery, ExtractSort, FilterCls, FilterInstance } from "./filterMeta";
|
|
3
4
|
import type { ModelCls } from "./loaderInfo";
|
|
4
5
|
|
|
5
6
|
export interface DatabaseModel<
|
|
@@ -105,4 +105,5 @@ export class DocumentSchema<Doc = unknown> {
|
|
|
105
105
|
|
|
106
106
|
export type SchemaOf<Mdl = unknown, Doc = unknown> = DocumentSchema<Doc> & { readonly __model?: Mdl };
|
|
107
107
|
|
|
108
|
+
/** @deprecated Construct `new DocumentSchema()`. */
|
|
108
109
|
export const getDefaultSchemaOptions = <_TSchema, TDocument>() => new DocumentSchema<TDocument>();
|
package/document/filterMeta.ts
CHANGED
|
@@ -26,6 +26,7 @@ import type { ConstantFilterMeta } from "./types";
|
|
|
26
26
|
const isObjectRecord = (value: unknown): value is Record<string, unknown> =>
|
|
27
27
|
typeof value === "object" && value !== null;
|
|
28
28
|
|
|
29
|
+
/** @deprecated Unused by akanjs; `getFilterMeta(ref, { allowEmpty: true }) !== undefined` answers the same. */
|
|
29
30
|
export const isFilterModel = (filterRef: Cls<unknown, { [FILTER_META]?: ConstantFilterMeta }>): boolean =>
|
|
30
31
|
filterRef[FILTER_META] !== undefined;
|
|
31
32
|
export const getFilterMeta = <AllowEmpty extends boolean = false>(
|
|
@@ -36,6 +37,7 @@ export const getFilterMeta = <AllowEmpty extends boolean = false>(
|
|
|
36
37
|
if (!filterMeta && !allowEmpty) throw new Error("filterMeta is not defined");
|
|
37
38
|
return filterMeta as AllowEmpty extends true ? ConstantFilterMeta | undefined : ConstantFilterMeta;
|
|
38
39
|
};
|
|
40
|
+
/** @internal */
|
|
39
41
|
export const setFilterMeta = (
|
|
40
42
|
filterRef: Cls<unknown, { [FILTER_META]?: ConstantFilterMeta; sortField: Set<string> }>,
|
|
41
43
|
filterMeta: ConstantFilterMeta,
|
|
@@ -79,6 +81,7 @@ export const getFilterInfoByKey = <ArgNames extends string[] = [], Args extends
|
|
|
79
81
|
if (!queryMeta) throw new Error(`queryMeta is not defined for key: ${key}`);
|
|
80
82
|
return queryMeta;
|
|
81
83
|
};
|
|
84
|
+
/** @deprecated Unused by akanjs; declare the query in the filter class built with `from(model, (filter) => …)`. */
|
|
82
85
|
export const setFilterInfoByKey = <ArgNames extends string[] = [], Args extends any[] = any[], Model = any>(
|
|
83
86
|
modelRef: Cls<Model>,
|
|
84
87
|
key: string,
|
|
@@ -126,7 +129,7 @@ export interface FilterArgInfo {
|
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
export const DEFAULT_FILTER_ARG_MAX_ITEMS = 1000;
|
|
129
|
-
/** Unwraps a filter arg's declaration the way `EndpointInfo.getArgInfo` unwraps an endpoint's. */
|
|
132
|
+
/** @internal Unwraps a filter arg's declaration the way `EndpointInfo.getArgInfo` unwraps an endpoint's. */
|
|
130
133
|
export const getFilterArgInfo = (arg: FilterInfo["args"][number]): FilterArgInfo => {
|
|
131
134
|
const [singleArg, arrDepth] = getNonArrayModel(arg.argRef as Cls);
|
|
132
135
|
const argIsEnum = isEnum(singleArg);
|
package/document/into.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Cls, LOADER_META, type PromiseOrObject } from "akanjs/base";
|
|
2
2
|
import { applyMixins } from "akanjs/common";
|
|
3
3
|
import type { DocumentModel, QueryOf } from "akanjs/constant";
|
|
4
|
-
import type { FilterCls, FilterQueryOf, FilterSortOf, SchemaOf } from ".";
|
|
5
4
|
import type { CacheDatabase, QueryMethodPart } from "./database";
|
|
6
5
|
import type { DataLoader } from "./dataLoader";
|
|
7
6
|
import type {
|
|
@@ -11,6 +10,8 @@ import type {
|
|
|
11
10
|
DocumentUpdateInput,
|
|
12
11
|
DocumentUpdateOptions,
|
|
13
12
|
} from "./documentQuery";
|
|
13
|
+
import type { SchemaOf } from "./documentSchema";
|
|
14
|
+
import type { FilterCls, FilterQueryOf, FilterSortOf } from "./filterMeta";
|
|
14
15
|
import { type LoaderBuilder, type ModelCls, makeLoaderBuilder } from "./loaderInfo";
|
|
15
16
|
import type { DocumentProjection } from "./types";
|
|
16
17
|
|