akanjs 3.1.0-rc.2 → 3.1.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/base/baseEnv.ts +5 -2
- package/client/device.ts +1 -1
- package/client/frameConfig.ts +2 -2
- package/client/href.ts +35 -0
- package/client/index.ts +1 -0
- package/client/makePageProto.tsx +3 -2
- package/client/router.ts +6 -4
- package/client/rscNavigation.ts +1 -1
- package/client/transitionTypes.ts +0 -4
- package/client/translator.ts +16 -0
- package/client/types.ts +3 -2
- package/client/viewportMeta.ts +23 -8
- package/client/webManifest.ts +5 -3
- package/common/TrustedProxy.ts +14 -0
- package/common/codeAgentWire.ts +8 -1
- package/common/index.ts +1 -0
- package/common/interpolateTranslation.ts +17 -3
- package/common/isEmail.ts +1 -1
- package/common/localeConfig.ts +10 -4
- package/common/markdownSpans.ts +1 -1
- package/common/restClient.ts +3 -1
- package/common/routeConvention.ts +4 -4
- package/common/trimSlashes.ts +11 -0
- package/common/types.ts +1 -1
- package/constant/fieldInfo.ts +2 -2
- package/constant/fieldPlan.ts +80 -0
- package/constant/index.ts +3 -0
- package/constant/inputParser.ts +148 -0
- package/constant/invalidInputError.ts +13 -0
- package/constant/serialize.ts +36 -20
- package/constant/types.ts +1 -1
- package/constant/via.ts +2 -0
- package/dictionary/base.dictionary.ts +4 -0
- package/dictionary/trans.ts +8 -0
- package/document/database.ts +3 -6
- package/document/documentSchema.ts +1 -1
- package/document/noDocumentError.ts +6 -1
- package/fetch/client/fetchClient.ts +2 -1
- package/fetch/client/sliceInitHandle.ts +2 -3
- package/fetch/fetchType/appliedReturn.type.ts +3 -1
- package/fetch/types.ts +4 -2
- package/index.ts +2 -0
- package/package.json +31 -21
- package/server/akanApp.ts +15 -3
- package/server/akanServer.ts +34 -14
- package/server/artifact/routeClientCache.ts +4 -5
- package/server/artifact/routeSeedIndexStore.ts +3 -20
- package/server/artifact/routeSeedMatcher.ts +70 -0
- package/server/console.ts +1 -1
- package/server/di/diLifecycle.ts +16 -7
- package/server/imageOptimizer.ts +1 -1
- package/server/index.ts +1 -0
- package/server/machine/machineAccount.ts +28 -3
- package/server/machine/machineToken.ts +27 -3
- package/server/mcp/McpDispatcher.ts +2 -3
- package/server/mcp/McpExecutionContext.ts +9 -3
- package/server/migration/docPath.ts +121 -0
- package/server/migration/index.ts +15 -0
- package/server/migration/migrationChangeLog.ts +86 -0
- package/server/migration/migrationChanges.ts +70 -0
- package/server/migration/migrationCommand.ts +179 -0
- package/server/migration/migrationContext.ts +53 -0
- package/server/migration/migrationDefinition.ts +87 -0
- package/server/migration/migrationError.ts +45 -0
- package/server/migration/migrationLedger.ts +172 -0
- package/server/migration/migrationLock.ts +103 -0
- package/server/migration/migrationParams.ts +122 -0
- package/server/migration/migrationPulse.ts +39 -0
- package/server/migration/migrationRunner.ts +525 -0
- package/server/migration/migrationScope.ts +93 -0
- package/server/migration/migrationTable.ts +258 -0
- package/server/migration/migrations.ts +57 -0
- package/server/ops/opsCommand.ts +30 -1
- package/server/resolver/CascadeRunner.ts +15 -2
- package/server/resolver/signal.resolver.ts +35 -55
- package/server/routeState.ts +0 -6
- package/server/rscClient.tsx +22 -37
- package/server/rscNavigationState.ts +3 -5
- package/server/rscScrollRestoration.ts +116 -0
- package/server/rscWorker.tsx +12 -19
- package/server/sitemap.ts +4 -4
- package/server/tunnel/TunnelAgent.ts +9 -1
- package/server/webRouter.ts +17 -2
- package/service/agent.service.ts +21 -1
- package/service/endpointCacheKeys.ts +35 -0
- package/service/index.ts +1 -0
- package/service/injectInfo.ts +2 -2
- package/service/predefinedAdaptor/anthropicLlm.ts +37 -17
- package/service/predefinedAdaptor/database.adaptor.ts +15 -0
- package/service/predefinedAdaptor/documentTransfer.ts +50 -0
- package/service/predefinedAdaptor/endpointCacheControl.adaptor.ts +19 -0
- package/service/predefinedAdaptor/index.ts +1 -0
- package/service/predefinedAdaptor/llm.adaptor.ts +7 -0
- package/service/predefinedAdaptor/openaiDialect.ts +53 -17
- package/service/predefinedAdaptor/openaiLlm.ts +1 -1
- package/service/predefinedAdaptor/sql/MigrationTables.ts +90 -0
- package/service/predefinedAdaptor/sql/RawDocumentTable.ts +200 -0
- package/service/predefinedAdaptor/sql/SqlDocumentStore.ts +6 -2
- package/service/predefinedAdaptor/sql/SqliteInsightSession.ts +4 -1
- package/service/predefinedAdaptor/sql/dialect/postgres.ts +0 -1
- package/service/predefinedAdaptor/sql/dialect/sqlite.ts +0 -1
- package/service/predefinedAdaptor/sql/types.ts +3 -1
- package/service/predefinedAdaptor/storage.adaptor.ts +19 -0
- package/signal/endpointCache.ts +23 -7
- package/signal/endpointErrorContract.ts +37 -0
- package/signal/endpointIdempotency.ts +5 -3
- package/signal/endpointInfo.ts +4 -1
- package/signal/endpointRateLimit.ts +6 -2
- package/signal/exception.ts +4 -1
- package/signal/index.ts +1 -0
- package/signal/mcp/McpDocument.ts +16 -1
- package/signal/mcp/McpUriTemplate.ts +1 -1
- package/signal/middlewareChain.ts +105 -0
- package/signal/openapi/openapi.ts +46 -2
- package/signal/serializer/fetch.serializer.ts +1 -0
- package/signal/signalContext.ts +110 -82
- package/signal/slice.ts +2 -2
- package/signal/trace.ts +8 -2
- package/signal/types.ts +13 -0
- package/store/action.ts +102 -42
- package/store/agent/ScreenImage.ts +166 -0
- package/store/agent/ScreenReader.ts +2 -1
- package/store/agent/StoreSurfaceSource.ts +41 -2
- package/store/agent/index.ts +2 -1
- package/store/databaseStateNames.ts +1 -0
- package/store/formUploadOf.ts +41 -0
- package/store/index.ts +1 -0
- package/store/liveInsert.ts +2 -2
- package/store/state.ts +9 -1
- package/store/stateBuilder.ts +8 -2
- package/store/storeInstance.ts +12 -3
- package/store/withSelector.ts +2 -2
- package/types/client/href.d.ts +11 -0
- package/types/client/index.d.ts +1 -0
- package/types/client/rscNavigation.d.ts +1 -1
- package/types/client/transitionTypes.d.ts +0 -2
- package/types/client/translator.d.ts +2 -0
- package/types/common/codeAgentWire.d.ts +7 -0
- package/types/common/index.d.ts +1 -0
- package/types/common/trimSlashes.d.ts +2 -0
- package/types/common/types.d.ts +1 -1
- package/types/constant/fieldInfo.d.ts +2 -2
- package/types/constant/fieldPlan.d.ts +33 -0
- package/types/constant/index.d.ts +3 -0
- package/types/constant/inputParser.d.ts +11 -0
- package/types/constant/invalidInputError.d.ts +8 -0
- package/types/constant/types.d.ts +1 -1
- package/types/dictionary/base.dictionary.d.ts +1 -1
- package/types/dictionary/dictionary.d.ts +3 -3
- package/types/dictionary/trans.d.ts +3 -0
- package/types/document/database.d.ts +2 -3
- package/types/document/documentSchema.d.ts +1 -1
- package/types/document/noDocumentError.d.ts +6 -1
- package/types/fetch/fetchType/appliedReturn.type.d.ts +3 -1
- package/types/fetch/types.d.ts +2 -2
- package/types/index.d.ts +5 -0
- package/types/server/akanServer.d.ts +1 -1
- package/types/server/artifact/routeSeedMatcher.d.ts +8 -0
- package/types/server/di/diLifecycle.d.ts +1 -0
- package/types/server/index.d.ts +1 -0
- package/types/server/machine/machineAccount.d.ts +1 -0
- package/types/server/machine/machineToken.d.ts +9 -0
- package/types/server/migration/docPath.d.ts +20 -0
- package/types/server/migration/index.d.ts +15 -0
- package/types/server/migration/migrationChangeLog.d.ts +27 -0
- package/types/server/migration/migrationChanges.d.ts +27 -0
- package/types/server/migration/migrationCommand.d.ts +33 -0
- package/types/server/migration/migrationContext.d.ts +28 -0
- package/types/server/migration/migrationDefinition.d.ts +42 -0
- package/types/server/migration/migrationError.d.ts +15 -0
- package/types/server/migration/migrationLedger.d.ts +51 -0
- package/types/server/migration/migrationLock.d.ts +34 -0
- package/types/server/migration/migrationParams.d.ts +41 -0
- package/types/server/migration/migrationPulse.d.ts +15 -0
- package/types/server/migration/migrationRunner.d.ts +93 -0
- package/types/server/migration/migrationScope.d.ts +42 -0
- package/types/server/migration/migrationTable.d.ts +52 -0
- package/types/server/migration/migrations.d.ts +12 -0
- package/types/server/migration.d.ts +1 -0
- package/types/server/ops/opsCommand.d.ts +10 -1
- package/types/server/routeState.d.ts +1 -4
- package/types/server/rscNavigationState.d.ts +2 -3
- package/types/server/rscScrollRestoration.d.ts +14 -0
- package/types/server/sitemap.d.ts +1 -1
- package/types/service/agent.service.d.ts +2 -0
- package/types/service/endpointCacheKeys.d.ts +8 -0
- package/types/service/index.d.ts +1 -0
- package/types/service/injectInfo.d.ts +2 -2
- package/types/service/predefinedAdaptor/anthropicLlm.d.ts +9 -4
- package/types/service/predefinedAdaptor/database.adaptor.d.ts +8 -1
- package/types/service/predefinedAdaptor/documentTransfer.d.ts +1 -0
- package/types/service/predefinedAdaptor/endpointCacheControl.adaptor.d.ts +9 -0
- package/types/service/predefinedAdaptor/index.d.ts +1 -0
- package/types/service/predefinedAdaptor/llm.adaptor.d.ts +7 -0
- package/types/service/predefinedAdaptor/openaiDialect.d.ts +20 -5
- package/types/service/predefinedAdaptor/sql/MigrationTables.d.ts +17 -0
- package/types/service/predefinedAdaptor/sql/RawDocumentTable.d.ts +38 -0
- package/types/service/predefinedAdaptor/sql/types.d.ts +1 -0
- package/types/service/predefinedAdaptor/storage.adaptor.d.ts +8 -0
- package/types/signal/endpointCache.d.ts +2 -0
- package/types/signal/endpointErrorContract.d.ts +10 -0
- package/types/signal/endpointIdempotency.d.ts +1 -0
- package/types/signal/endpointRateLimit.d.ts +1 -1
- package/types/signal/exception.d.ts +4 -1
- package/types/signal/index.d.ts +1 -0
- package/types/signal/middlewareChain.d.ts +11 -0
- package/types/signal/signalContext.d.ts +2 -6
- package/types/signal/slice.d.ts +1 -1
- package/types/signal/trace.d.ts +1 -1
- package/types/signal/types.d.ts +12 -0
- package/types/store/action.d.ts +2 -0
- package/types/store/agent/ScreenImage.d.ts +27 -0
- package/types/store/agent/StoreSurfaceSource.d.ts +1 -1
- package/types/store/agent/index.d.ts +2 -1
- package/types/store/databaseStateNames.d.ts +1 -0
- package/types/store/formUploadOf.d.ts +9 -0
- package/types/store/index.d.ts +1 -0
- package/types/store/state.d.ts +7 -1
- package/types/store/stateBuilder.d.ts +2 -1
- package/types/store/storeInstance.d.ts +2 -2
- package/types/store/withSelector.d.ts +1 -1
- package/types/ui/Agent/Composer.d.ts +2 -0
- package/types/ui/Agent/Menu.d.ts +2 -0
- package/types/ui/CsrImage.d.ts +2 -0
- package/types/ui/Data/CardList.d.ts +1 -1
- package/types/ui/Data/Dashboard.d.ts +1 -1
- package/types/ui/Data/Insight.d.ts +1 -1
- package/types/ui/Data/Item.d.ts +2 -2
- package/types/ui/Data/ListContainer.d.ts +1 -1
- package/types/ui/Data/Pagination.d.ts +1 -1
- package/types/ui/Data/TableList.d.ts +1 -1
- package/types/ui/Field/Relation.d.ts +13 -10
- package/types/ui/Field/index.d.ts +4 -4
- package/types/ui/Field/useRelationOptions.d.ts +3 -1
- package/types/ui/Field/useRelationWindow.d.ts +14 -0
- package/types/ui/Image.d.ts +3 -1
- package/types/ui/Load/View.d.ts +1 -1
- package/types/ui/Pagination.d.ts +1 -1
- package/types/ui/Signal/Arg.d.ts +1 -1
- package/types/ui/System/CSR.d.ts +1 -1
- package/types/ui/System/Client.d.ts +1 -1
- package/types/ui/System/SSR.d.ts +1 -1
- package/types/vendor/@akanjs/native/packages/core/src/plugin.d.ts +3 -3
- package/types/vendor/@akanjs/native/packages/desktop/src/page-veto.d.ts +1 -1
- package/types/vendor/@akanjs/native/packages/desktop/src/plugin.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/auth-session/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/auth-session/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/autostart/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/autostart/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/badge/src/desktop.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/badge/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/badge/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/biometric/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/camera/src/desktop.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/camera/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/camera/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/clipboard/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/clipboard/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/clipboard/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/contacts/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/device/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/device/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/device/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/dialog/src/desktop.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/dialog/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/dialog/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/dock/src/desktop.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/dock/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/file-picker/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/file-picker/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/filesystem/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/filesystem/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/haptics/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/haptics/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/http/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/http/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/keep-awake/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/keep-awake/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/keep-awake/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/opener/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/opener/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/opener/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/preferences/src/desktop.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/preferences/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/preferences/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/secure-storage/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/secure-storage/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/share/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/share/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/single-instance/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/splash-screen/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/splash-screen/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/sqlite/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/toast/src/index.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/toast/src/web.d.ts +1 -1
- package/types/vendor/@akanjs/native/plugins/window/src/index.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/window-state/src/desktop.d.ts +2 -2
- package/types/vendor/@akanjs/native/plugins/window-state/src/index.d.ts +1 -1
- package/types/vendor/use-agentic/Compaction.d.ts +3 -1
- package/types/vendor/use-agentic/Reference.d.ts +9 -1
- package/types/vendor/use-agentic/ToolOutput.d.ts +6 -1
- package/types/vendor/use-agentic/ToolReturn.d.ts +18 -0
- package/types/vendor/use-agentic/Transcript.d.ts +7 -0
- package/types/vendor/use-agentic/index.d.ts +1 -0
- package/types/vendor/use-agentic/types.d.ts +6 -0
- package/types/webkit/useDebounce.d.ts +1 -1
- package/ui/Agent/Chat.tsx +1 -0
- package/ui/Agent/Composer.tsx +2 -0
- package/ui/Agent/Menu.tsx +5 -1
- package/ui/Agent/agentSessionOf.ts +15 -8
- package/ui/Agent/mentionDraft.ts +2 -3
- package/ui/Agent/useReferenceMenu.ts +1 -0
- package/ui/Agent/useSlashMenu.ts +1 -0
- package/ui/Clipboard.tsx +1 -0
- package/ui/CsrImage.tsx +3 -1
- package/ui/Data/CardList.tsx +1 -1
- package/ui/Data/Dashboard.tsx +1 -1
- package/ui/Data/Insight.tsx +1 -1
- package/ui/Data/Item.tsx +5 -2
- package/ui/Data/ListContainer.tsx +2 -2
- package/ui/Data/Pagination.tsx +1 -1
- package/ui/Data/TableList.tsx +1 -1
- package/ui/DraggableList.tsx +1 -0
- package/ui/Field/Collection.tsx +4 -0
- package/ui/Field/Relation.tsx +33 -14
- package/ui/Field/useRelationOptions.ts +33 -5
- package/ui/Field/useRelationWindow.ts +50 -0
- package/ui/Image.tsx +4 -4
- package/ui/Input.tsx +1 -0
- package/ui/Layout/Sider.tsx +1 -1
- package/ui/Link/Anchor.tsx +7 -5
- package/ui/Load/Units.tsx +17 -7
- package/ui/Load/View.tsx +2 -2
- package/ui/Model/Edit.tsx +1 -1
- package/ui/Model/EditModal.tsx +11 -5
- package/ui/Model/New.tsx +1 -1
- package/ui/Model/SureToRemove.tsx +1 -0
- package/ui/Model/ViewEditModal.tsx +17 -5
- package/ui/Model/ViewModal.tsx +2 -2
- package/ui/ObjectId.tsx +5 -1
- package/ui/Pagination.tsx +1 -1
- package/ui/Signal/Arg.tsx +1 -3
- package/ui/Signal/Doc.tsx +5 -1
- package/ui/System/CSR.tsx +1 -1
- package/ui/System/Client.tsx +1 -1
- package/ui/System/Reconnect.tsx +1 -1
- package/ui/System/SSR.tsx +3 -36
- package/ui/ToggleSelect.tsx +2 -0
- package/ui/styles.css +10 -103
- package/vendor/@akanjs/native/native/ios/Sources/AkanNativeBridge.swift +3 -2
- package/vendor/@akanjs/native/packages/cli/src/lib/addons.ts +4 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/apk.ts +2 -2
- package/vendor/@akanjs/native/packages/cli/src/lib/codegen.ts +1 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/csp.ts +4 -3
- package/vendor/@akanjs/native/packages/cli/src/lib/googleservices.ts +7 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/hmr.ts +8 -5
- package/vendor/@akanjs/native/packages/cli/src/lib/html.ts +18 -3
- package/vendor/@akanjs/native/packages/cli/src/lib/manifestmerge.ts +1 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/plist.ts +2 -4
- package/vendor/@akanjs/native/packages/cli/src/lib/toolchains.ts +1 -1
- package/vendor/@akanjs/native/packages/cli/src/lib/updates.ts +10 -4
- package/vendor/@akanjs/native/packages/cli/src/lib/xml.ts +4 -3
- package/vendor/@akanjs/native/packages/cli/src/platforms/android.ts +3 -3
- package/vendor/@akanjs/native/packages/core/src/kernel.ts +3 -3
- package/vendor/@akanjs/native/packages/core/src/live.ts +1 -0
- package/vendor/@akanjs/native/packages/core/src/plugin.ts +5 -3
- package/vendor/@akanjs/native/packages/desktop/src/host.ts +13 -5
- package/vendor/@akanjs/native/packages/desktop/src/lifecycle.ts +1 -0
- package/vendor/@akanjs/native/packages/desktop/src/page-veto.ts +1 -1
- package/vendor/@akanjs/native/packages/desktop/src/plugin.ts +4 -1
- package/vendor/@akanjs/native/plugins/camera/src/web.ts +3 -3
- package/vendor/@akanjs/native/plugins/file-picker/src/index.ts +4 -1
- package/vendor/@akanjs/native/plugins/local-notifications/src/web.ts +1 -1
- package/vendor/@akanjs/native/plugins/secure-storage/src/desktop.ts +1 -1
- package/vendor/@akanjs/native/plugins/share/src/options.ts +1 -1
- package/vendor/@akanjs/native/plugins/single-instance/src/desktop.ts +3 -2
- package/vendor/@akanjs/native/plugins/updates/src/desktop.ts +4 -1
- package/vendor/@akanjs/native/plugins/window/src/index.ts +2 -2
- package/vendor/use-agentic/Compaction.ts +38 -7
- package/vendor/use-agentic/Reference.ts +16 -9
- package/vendor/use-agentic/ToolOutput.ts +25 -3
- package/vendor/use-agentic/ToolReturn.ts +32 -0
- package/vendor/use-agentic/ToolRunner.ts +15 -13
- package/vendor/use-agentic/Transcript.ts +38 -2
- package/vendor/use-agentic/WIRE.md +20 -0
- package/vendor/use-agentic/index.ts +1 -0
- package/vendor/use-agentic/types.ts +6 -0
- package/webkit/McpAppAgent.ts +12 -2
- package/webkit/RenderLayer.tsx +23 -4
- package/webkit/useDebounce.ts +23 -14
- package/client/viewTransition.ts +0 -10
- package/types/client/viewTransition.d.ts +0 -3
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Any,
|
|
3
|
+
type Cls,
|
|
4
|
+
dayjs,
|
|
5
|
+
type EnumInstance,
|
|
6
|
+
FIELD_META,
|
|
7
|
+
Float,
|
|
8
|
+
getNonArrayModel,
|
|
9
|
+
ID,
|
|
10
|
+
Int,
|
|
11
|
+
PrimitiveRegistry,
|
|
12
|
+
type PrimitiveScalar,
|
|
13
|
+
} from "akanjs/base";
|
|
14
|
+
|
|
15
|
+
import { ConstantRegistry } from "./constantRegistry";
|
|
16
|
+
import type { ConstantField, FieldObject } from "./fieldInfo";
|
|
17
|
+
import { FieldPlan, type FieldPlanEntry } from "./fieldPlan";
|
|
18
|
+
import { defaultPlanOf } from "./getDefault";
|
|
19
|
+
import { InvalidInputError } from "./invalidInputError";
|
|
20
|
+
import { deserialize } from "./serialize";
|
|
21
|
+
|
|
22
|
+
type ModelCls = Cls & { [FIELD_META]: FieldObject };
|
|
23
|
+
type Parse = (value: unknown, path: string) => unknown;
|
|
24
|
+
|
|
25
|
+
interface ParseOption {
|
|
26
|
+
key: string;
|
|
27
|
+
nullable?: boolean;
|
|
28
|
+
enum?: EnumInstance;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const isString = (value: unknown) => typeof value === "string";
|
|
32
|
+
const isNumber = (value: unknown) => typeof value === "number";
|
|
33
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
34
|
+
typeof value === "object" && value !== null && !Array.isArray(value);
|
|
35
|
+
|
|
36
|
+
export class InputParser {
|
|
37
|
+
|
|
38
|
+
static readonly #wireTypes = new Map<unknown, (value: unknown) => boolean>([
|
|
39
|
+
[String, isString],
|
|
40
|
+
[ID, isString],
|
|
41
|
+
[Int, isNumber],
|
|
42
|
+
[Float, isNumber],
|
|
43
|
+
[Boolean, (value) => typeof value === "boolean"],
|
|
44
|
+
[Date, (value) => isString(value) || isNumber(value) || value instanceof Date || dayjs.isDayjs(value)],
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
static parse(argRef: Cls, arrDepth: number, value: unknown, option: ParseOption) {
|
|
48
|
+
if (PrimitiveRegistry.has(argRef)) return deserialize(argRef, arrDepth, value, option);
|
|
49
|
+
const { key, nullable = false } = option;
|
|
50
|
+
if (value === null || value === undefined) {
|
|
51
|
+
if (nullable) return null;
|
|
52
|
+
throw new InvalidInputError(key, null);
|
|
53
|
+
}
|
|
54
|
+
return InputParser.#walk(value, arrDepth, key, (item, path) => InputParser.#value(argRef, item, path));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static #walk(value: unknown, arrDepth: number, path: string, parse: Parse): unknown {
|
|
58
|
+
if (!arrDepth) return parse(value, path);
|
|
59
|
+
if (!Array.isArray(value)) throw new InvalidInputError(path, "array");
|
|
60
|
+
return value.map((item, idx) => InputParser.#walk(item, arrDepth - 1, `${path}.${idx}`, parse));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static #value(ref: Cls, value: unknown, path: string, enumRef?: EnumInstance): unknown {
|
|
64
|
+
if (value === null || value === undefined) {
|
|
65
|
+
if (ref === Any) return value ?? null;
|
|
66
|
+
throw new InvalidInputError(path, null);
|
|
67
|
+
}
|
|
68
|
+
if (PrimitiveRegistry.has(ref)) return InputParser.#primitive(ref as typeof PrimitiveScalar, value, path, enumRef);
|
|
69
|
+
if (ConstantRegistry.isScalar(ref)) return InputParser.#scalar(ref as ModelCls, value, path);
|
|
70
|
+
return InputParser.#model(ref as ModelCls, value, path);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static #primitive(primitive: typeof PrimitiveScalar, value: unknown, path: string, enumRef?: EnumInstance) {
|
|
74
|
+
const hasWireType = InputParser.#wireTypes.get(primitive);
|
|
75
|
+
if (hasWireType && !hasWireType(value)) throw new InvalidInputError(path, primitive.refName);
|
|
76
|
+
let parsed: unknown;
|
|
77
|
+
try {
|
|
78
|
+
parsed = primitive._parse(value as never);
|
|
79
|
+
} catch {
|
|
80
|
+
throw new InvalidInputError(path, primitive.refName);
|
|
81
|
+
}
|
|
82
|
+
if (enumRef && !enumRef.has(parsed as never))
|
|
83
|
+
throw new InvalidInputError(path, `one of ${enumRef.values.join(", ")}`);
|
|
84
|
+
return parsed;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static #scalar(ref: ModelCls, value: unknown, path: string) {
|
|
88
|
+
if (!isRecord(value)) throw new InvalidInputError(path, "object");
|
|
89
|
+
const defaults = defaultPlanOf(ref[FIELD_META]);
|
|
90
|
+
const parsed: Record<string, unknown> = {};
|
|
91
|
+
for (const entry of FieldPlan.of(ref).entries) {
|
|
92
|
+
if (entry.kind === "computed") continue;
|
|
93
|
+
const fieldPath = `${path}.${entry.key}`;
|
|
94
|
+
const raw = value[entry.key];
|
|
95
|
+
if (raw !== undefined) parsed[entry.key] = InputParser.#field(entry, raw, fieldPath);
|
|
96
|
+
else if (InputParser.#isRequired(entry.field)) throw new InvalidInputError(fieldPath, null);
|
|
97
|
+
else {
|
|
98
|
+
const make = defaults.perCall.get(entry.key);
|
|
99
|
+
parsed[entry.key] = make ? make() : defaults.shared[entry.key];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return parsed;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static #model(ref: ModelCls, value: unknown, path: string) {
|
|
106
|
+
if (!isRecord(value)) throw new InvalidInputError(path, "object");
|
|
107
|
+
const parsed: Record<string, unknown> = {};
|
|
108
|
+
for (const entry of FieldPlan.of(ref).entries) {
|
|
109
|
+
if (entry.kind === "computed") continue;
|
|
110
|
+
const fieldPath = `${path}.${entry.key}`;
|
|
111
|
+
const raw = value[entry.key];
|
|
112
|
+
if (raw !== undefined) parsed[entry.key] = InputParser.#field(entry, raw, fieldPath);
|
|
113
|
+
else if (InputParser.#isRequired(entry.field)) throw new InvalidInputError(fieldPath, null);
|
|
114
|
+
}
|
|
115
|
+
return parsed;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
static #field({ field, isRelationRef }: FieldPlanEntry, value: unknown, path: string): unknown {
|
|
119
|
+
if (value === null) {
|
|
120
|
+
if (field.nullable || (field.modelRef as Cls) === Any) return null;
|
|
121
|
+
throw new InvalidInputError(path, null);
|
|
122
|
+
}
|
|
123
|
+
return InputParser.#walk(value, field.arrDepth, path, (item, itemPath) => {
|
|
124
|
+
if (field.isMap) return InputParser.#map(field.of as Cls | Cls[], item, itemPath);
|
|
125
|
+
if (isRelationRef) return InputParser.#value(ID, item, itemPath);
|
|
126
|
+
return InputParser.#value(field.modelRef, item, itemPath, field.enum);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
static #map(of: Cls | Cls[], value: unknown, path: string) {
|
|
131
|
+
if (!isRecord(value)) throw new InvalidInputError(path, "object");
|
|
132
|
+
const [valueRef, valueArrDepth] = getNonArrayModel(of);
|
|
133
|
+
return Object.fromEntries(
|
|
134
|
+
Object.entries(value).map(([key, item]) => [
|
|
135
|
+
key,
|
|
136
|
+
InputParser.#walk(item, valueArrDepth, `${path}.${key}`, (entry, entryPath) =>
|
|
137
|
+
InputParser.#value(valueRef as Cls, entry, entryPath),
|
|
138
|
+
),
|
|
139
|
+
]),
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
static #isRequired(field: ConstantField) {
|
|
144
|
+
if (field.nullable || (field.modelRef as Cls) === Any) return false;
|
|
145
|
+
if (field.default !== null && field.default !== undefined) return false;
|
|
146
|
+
return !(field.isClass && field.isScalar);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** A body value the request schema refuses: `path` names it from the argument down (`data.items.2.price`). */
|
|
2
|
+
export class InvalidInputError extends Error {
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly reason: "missing" | "invalid";
|
|
5
|
+
/** What the field takes — a type name, `object`, `array`, or the enum's values; `null` when it is missing. */
|
|
6
|
+
readonly expected: string | null;
|
|
7
|
+
constructor(path: string, expected: string | null) {
|
|
8
|
+
super(expected ? `Invalid input at ${path}: expected ${expected}` : `Missing input at ${path}`);
|
|
9
|
+
this.path = path;
|
|
10
|
+
this.reason = expected ? "invalid" : "missing";
|
|
11
|
+
this.expected = expected;
|
|
12
|
+
}
|
|
13
|
+
}
|
package/constant/serialize.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "akanjs/base";
|
|
13
13
|
|
|
14
14
|
import { type ConstantCls, type ConstantModelRef, ConstantRegistry, type FieldProps, withSharedInstances } from ".";
|
|
15
|
+
import { FieldPlan } from "./fieldPlan";
|
|
15
16
|
|
|
16
17
|
export type Serialized<O> = O extends (infer V)[]
|
|
17
18
|
? Serialized<V>[]
|
|
@@ -27,12 +28,14 @@ const getSerializeFn = (inputRef: Cls, { optional = false }: { optional?: boolea
|
|
|
27
28
|
PrimitiveRegistry.has(inputRef)
|
|
28
29
|
? (value: unknown) => (inputRef as typeof PrimitiveScalar)._serialize(value as never, { optional })
|
|
29
30
|
: (value: unknown) => value as object;
|
|
31
|
+
const optionalSerialize = { optional: true } as const;
|
|
32
|
+
const requiredSerialize = { optional: false } as const;
|
|
30
33
|
const serializeInput = <Input = unknown>(
|
|
31
34
|
value: Input | Input[],
|
|
32
35
|
inputRef: ConstantModelRef<Input> | PrimitiveScalar,
|
|
33
36
|
arrDepth: number,
|
|
34
37
|
serializeType: "input" | "object" = "object",
|
|
35
|
-
|
|
38
|
+
optional = false,
|
|
36
39
|
): Input | Input[] => {
|
|
37
40
|
if (arrDepth && Array.isArray(value))
|
|
38
41
|
return value.map((v) => serializeInput(v, inputRef, arrDepth - 1, serializeType) as Input) as unknown as Input[];
|
|
@@ -46,24 +49,23 @@ const serializeInput = <Input = unknown>(
|
|
|
46
49
|
]),
|
|
47
50
|
) as unknown as Input;
|
|
48
51
|
} else if (PrimitiveRegistry.has(inputRef as Cls)) {
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
return (inputRef as typeof PrimitiveScalar)._serialize(
|
|
53
|
+
value as never,
|
|
54
|
+
optional ? optionalSerialize : requiredSerialize,
|
|
55
|
+
) as Input;
|
|
51
56
|
} else {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}),
|
|
65
|
-
]),
|
|
66
|
-
) as unknown as Input;
|
|
57
|
+
const serialized: Record<string, unknown> = {};
|
|
58
|
+
for (const { key, field, isRelationRef, primitive, serializeOption } of FieldPlan.of(inputRef as ConstantCls)
|
|
59
|
+
.entries) {
|
|
60
|
+
const fieldValue = (value as Record<string, unknown> | null | undefined)?.[key];
|
|
61
|
+
serialized[key] =
|
|
62
|
+
primitive && !field.arrDepth
|
|
63
|
+
? serializePrimitive(primitive, fieldValue, serializeOption)
|
|
64
|
+
: serializeType === "input" && isRelationRef
|
|
65
|
+
? serialize(ID, field.arrDepth, getRelationId(fieldValue), serializeType, serializeOption)
|
|
66
|
+
: serialize(field.modelRef, field.arrDepth, fieldValue, serializeType, serializeOption);
|
|
67
|
+
}
|
|
68
|
+
return serialized as unknown as Input;
|
|
67
69
|
}
|
|
68
70
|
};
|
|
69
71
|
|
|
@@ -82,9 +84,23 @@ export const serialize = (
|
|
|
82
84
|
) => {
|
|
83
85
|
if (nullable && (value === null || value === undefined)) return null;
|
|
84
86
|
else if (!nullable && (value === null || value === undefined) && argRef !== Any)
|
|
85
|
-
throw
|
|
86
|
-
return serializeInput(value, argRef, arrDepth, serializeType,
|
|
87
|
+
throw missingValueError(argRef, value, key);
|
|
88
|
+
return serializeInput(value, argRef, arrDepth, serializeType, nullable) as object[];
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const serializePrimitive = (
|
|
92
|
+
primitive: typeof PrimitiveScalar,
|
|
93
|
+
value: unknown,
|
|
94
|
+
{ nullable, key }: { nullable: boolean; key: string },
|
|
95
|
+
) => {
|
|
96
|
+
if (value === null || value === undefined) {
|
|
97
|
+
if (nullable) return null;
|
|
98
|
+
if ((primitive as unknown) !== Any) throw missingValueError(primitive, value, key);
|
|
99
|
+
}
|
|
100
|
+
return primitive._serialize(value as never, nullable ? optionalSerialize : requiredSerialize);
|
|
87
101
|
};
|
|
102
|
+
const missingValueError = (argRef: unknown, value: unknown, key?: string) =>
|
|
103
|
+
new Error(`Invalid Value (Nullable) in ${argRef} for value ${value}${key ? ` in ${key}` : ""}`);
|
|
88
104
|
|
|
89
105
|
const getDeserializeFn = (inputRef: ConstantModelRef | PrimitiveScalar) =>
|
|
90
106
|
PrimitiveRegistry.has(inputRef as Cls)
|
package/constant/types.ts
CHANGED
package/constant/via.ts
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
field,
|
|
30
30
|
resolve,
|
|
31
31
|
} from "./fieldInfo";
|
|
32
|
+
import { FieldPlan } from "./fieldPlan";
|
|
32
33
|
import { HydrationPlan } from "./hydrationPlan";
|
|
33
34
|
import { makePurify, type PurifiedModel, type PurifyFunc } from "./purify";
|
|
34
35
|
import { TextFieldPaths } from "./textFieldPaths";
|
|
@@ -422,6 +423,7 @@ const applyConstantStatics = <Model>(model: ConstantCls<Model>, fieldMap: FieldO
|
|
|
422
423
|
for (const [key, field] of Object.entries(model[FIELD_META]))
|
|
423
424
|
if (isDateSlotField(field.getProps())) Object.defineProperty(model.prototype, key, dateAccessorOf(key));
|
|
424
425
|
HydrationPlan.reset(model);
|
|
426
|
+
FieldPlan.reset(model);
|
|
425
427
|
return model as unknown as ConstantCls<Model>;
|
|
426
428
|
};
|
|
427
429
|
|
|
@@ -49,6 +49,10 @@ export const baseDictionary = serviceDictionary(["en", "ko"])
|
|
|
49
49
|
"서버가 예상하지 못한 응답을 보냈습니다. ({status})",
|
|
50
50
|
],
|
|
51
51
|
immutableField: ["{field} cannot be changed after creation.", "{field}은(는) 생성 후에는 바꿀 수 없습니다."],
|
|
52
|
+
invalidArgument: ["{name} has an invalid value.", "{name} 값이 올바르지 않습니다."],
|
|
53
|
+
requiredArgument: ["{name} is required.", "{name}은(는) 필수 값입니다."],
|
|
54
|
+
invalidField: ["{field} has an invalid value.", "{field} 값이 올바르지 않습니다."],
|
|
55
|
+
documentNotFound: ["The requested item does not exist.", "요청한 항목을 찾을 수 없습니다."],
|
|
52
56
|
relationNotFound: [
|
|
53
57
|
"The {model} that {field} refers to no longer exists.",
|
|
54
58
|
"{field}이(가) 가리키는 {model}을(를) 찾을 수 없습니다.",
|
package/dictionary/trans.ts
CHANGED
|
@@ -65,6 +65,7 @@ export type ErrConstructor<ErrorKey extends string> = {
|
|
|
65
65
|
new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption): ErrInstance;
|
|
66
66
|
prototype: ErrInstance;
|
|
67
67
|
fromJSON(payload: ErrPayload): ErrInstance;
|
|
68
|
+
is<Key extends ErrorKey>(error: unknown, ...keys: Key[]): error is ErrInstance & { readonly error: Key };
|
|
68
69
|
BadRequest: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
|
|
69
70
|
Unauthorized: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
|
|
70
71
|
Forbidden: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
|
|
@@ -150,6 +151,13 @@ export const makeTrans = <
|
|
|
150
151
|
return new Err(payload.error as _ErrorKey, payload.data, payload);
|
|
151
152
|
}
|
|
152
153
|
|
|
154
|
+
/** An Akan error, and one of `keys` when any are named; read off `error`, so a restored remote one passes too. */
|
|
155
|
+
static is<Key extends _ErrorKey>(error: unknown, ...keys: Key[]): error is ErrInstance & { readonly error: Key } {
|
|
156
|
+
if (typeof error !== "object" || error === null) return false;
|
|
157
|
+
const key = (error as { error?: unknown }).error;
|
|
158
|
+
return typeof key === "string" && (!keys.length || (keys as string[]).includes(key));
|
|
159
|
+
}
|
|
160
|
+
|
|
153
161
|
static BadRequest = class BadRequestErr extends Err {
|
|
154
162
|
static override status = 400;
|
|
155
163
|
};
|
package/document/database.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MergedValues } from "akanjs/base";
|
|
2
|
-
import { Logger } from "akanjs/common";
|
|
2
|
+
import type { Logger } from "akanjs/common";
|
|
3
3
|
import type { DocumentModel, QueryOf } from "akanjs/constant";
|
|
4
4
|
import type { CacheAdaptor, CacheSetOptions, CacheValue } from "akanjs/service";
|
|
5
5
|
import type { DataLoader } from "./dataLoader";
|
|
@@ -8,14 +8,11 @@ import type { ExtractQuery, ExtractSort, FilterInstance } from "./filterMeta";
|
|
|
8
8
|
import type { Mdl, SaveEventListener, SaveEventType, UpdateResult } from "./into";
|
|
9
9
|
import type { DataInputOf, FindQueryOption, ListQueryOption } from "./types";
|
|
10
10
|
|
|
11
|
-
export class CacheDatabase<
|
|
12
|
-
private logger: Logger;
|
|
11
|
+
export class CacheDatabase<_T = unknown> {
|
|
13
12
|
constructor(
|
|
14
13
|
private readonly refName: string,
|
|
15
14
|
private readonly cache: CacheAdaptor,
|
|
16
|
-
) {
|
|
17
|
-
this.logger = new Logger(`${refName}Cache`);
|
|
18
|
-
}
|
|
15
|
+
) {}
|
|
19
16
|
async set(topic: string, key: string, value: CacheValue, option: CacheSetOptions = {}) {
|
|
20
17
|
await this.cache.set(this.refName, `${topic}:${key}`, value, option);
|
|
21
18
|
}
|
|
@@ -105,4 +105,4 @@ export class DocumentSchema<Doc = unknown> {
|
|
|
105
105
|
|
|
106
106
|
export type SchemaOf<Mdl = unknown, Doc = unknown> = DocumentSchema<Doc> & { readonly __model?: Mdl };
|
|
107
107
|
|
|
108
|
-
export const getDefaultSchemaOptions = <
|
|
108
|
+
export const getDefaultSchemaOptions = <_TSchema, TDocument>() => new DocumentSchema<TDocument>();
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A `pick` or `get` that matched nothing, so a caller can tell a missing document from a failure. Callers match on
|
|
3
|
-
* the message
|
|
3
|
+
* the message, which names the table and the id or query; the wire carries only the dictionary key, as a 404.
|
|
4
4
|
*/
|
|
5
5
|
export class NoDocumentError extends Error {
|
|
6
6
|
readonly statusCode = 404;
|
|
7
|
+
readonly error = "base.error.documentNotFound";
|
|
8
|
+
|
|
9
|
+
toJSON() {
|
|
10
|
+
return { error: this.error, statusCode: this.statusCode };
|
|
11
|
+
}
|
|
7
12
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type RetryPolicy,
|
|
8
8
|
readAuthToken,
|
|
9
9
|
resolveFileUploadCapability,
|
|
10
|
+
trimTrailingSlashes,
|
|
10
11
|
} from "akanjs/common";
|
|
11
12
|
import { type BaseInsight, type BaseObject, ConstantRegistry, deserialize, serialize } from "akanjs/constant";
|
|
12
13
|
import type {
|
|
@@ -377,7 +378,7 @@ export class FetchClient {
|
|
|
377
378
|
}
|
|
378
379
|
}
|
|
379
380
|
static #normalizeOrigin(origin: string) {
|
|
380
|
-
return origin
|
|
381
|
+
return trimTrailingSlashes(origin);
|
|
381
382
|
}
|
|
382
383
|
static #sameOrigin(a: string, b: string) {
|
|
383
384
|
return FetchClient.#normalizeOrigin(a) === FetchClient.#normalizeOrigin(b);
|
|
@@ -63,9 +63,8 @@ export class SliceInitHandle {
|
|
|
63
63
|
|
|
64
64
|
#serverInitOf(modelObjList: BaseObject[], modelObjInsight: BaseInsight | null) {
|
|
65
65
|
const { refName, capRefName, sliceName, argLength, queryArgs, page, limit, sort } = this.#input;
|
|
66
|
-
const lastPage =
|
|
67
|
-
? Math.max(Math.floor((modelObjInsight.count - 1) /
|
|
68
|
-
: 1;
|
|
66
|
+
const lastPage =
|
|
67
|
+
modelObjInsight?.count && limit > 0 ? Math.max(Math.floor((modelObjInsight.count - 1) / limit) + 1, 1) : 1;
|
|
69
68
|
this.#serverInit ??= {
|
|
70
69
|
refName,
|
|
71
70
|
sliceName,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { DataList, GetStateObject, PromiseOrObject } from "akanjs/base";
|
|
2
2
|
import type { ExtractSort, FilterInstance } from "akanjs/document";
|
|
3
3
|
|
|
4
|
-
export type SliceMeta = {
|
|
4
|
+
export type SliceMeta<Sort = unknown> = {
|
|
5
5
|
refName: string;
|
|
6
6
|
sliceName: string;
|
|
7
7
|
argLength: number;
|
|
8
|
+
/** Type-only, never set: the slice filter's sort keys, which a `sort` passed beside this meta narrows to. */
|
|
9
|
+
_Sort?: Sort;
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
/** What the root slice takes: one of the model's declared filter queries, and the args that filter asks for. */
|
package/fetch/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Environment, getEnv, type SLICE_META } from "akanjs/base";
|
|
2
|
-
import type { DatabaseSignal } from "akanjs/signal";
|
|
2
|
+
import type { DatabaseSignal, SlceDbSort } from "akanjs/signal";
|
|
3
3
|
import type { SliceMeta } from "./fetchType/appliedReturn.type";
|
|
4
4
|
|
|
5
5
|
export type Account<AddData = unknown> = {
|
|
@@ -17,7 +17,9 @@ type GetSliceMetaObjFromSignal<Signal> = Signal extends {
|
|
|
17
17
|
? SliceMetaObj
|
|
18
18
|
: Signal extends DatabaseSignal
|
|
19
19
|
? {
|
|
20
|
-
[K in `${Signal["slice"]["baseName"]}${Capitalize<keyof Signal["slice"][typeof SLICE_META] & string>}`]: SliceMeta
|
|
20
|
+
[K in `${Signal["slice"]["baseName"]}${Capitalize<keyof Signal["slice"][typeof SLICE_META] & string>}`]: SliceMeta<
|
|
21
|
+
SlceDbSort<Signal["slice"]>
|
|
22
|
+
>;
|
|
21
23
|
}
|
|
22
24
|
: Record<never, never>;
|
|
23
25
|
export type GetSliceMetaObjFromDatabaseSignals<
|
package/index.ts
CHANGED
|
@@ -601,6 +601,8 @@ export interface AppInfo {
|
|
|
601
601
|
readonly service: Map<string, Set<string>>;
|
|
602
602
|
readonly scalar: Map<string, Set<string>>;
|
|
603
603
|
readonly file: FileConventionScanSets;
|
|
604
|
+
/** `script/migration/*.ts` by id, each with its source's sha256. */
|
|
605
|
+
readonly migrations: readonly { id: string; checksum: string }[];
|
|
604
606
|
getLibs(): string[];
|
|
605
607
|
getLibInfos(): Map<string, LibInfo>;
|
|
606
608
|
getDatabaseModules(): string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akanjs",
|
|
3
|
-
"version": "3.1.0-rc.
|
|
3
|
+
"version": "3.1.0-rc.21",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -225,34 +225,44 @@
|
|
|
225
225
|
"types": "./types/server/hmr/runtimeMetadataFile.d.ts",
|
|
226
226
|
"import": "./server/hmr/runtimeMetadataFile.ts",
|
|
227
227
|
"default": "./server/hmr/runtimeMetadataFile.ts"
|
|
228
|
+
},
|
|
229
|
+
"./server/migration/migrationCommand": {
|
|
230
|
+
"types": "./types/server/migration/migrationCommand.d.ts",
|
|
231
|
+
"import": "./server/migration/migrationCommand.ts",
|
|
232
|
+
"default": "./server/migration/migrationCommand.ts"
|
|
233
|
+
},
|
|
234
|
+
"./server/migration/migrationError": {
|
|
235
|
+
"types": "./types/server/migration/migrationError.d.ts",
|
|
236
|
+
"import": "./server/migration/migrationError.ts",
|
|
237
|
+
"default": "./server/migration/migrationError.ts"
|
|
228
238
|
}
|
|
229
239
|
},
|
|
230
240
|
"dependencies": {
|
|
231
|
-
"@lexical/plain-text": "^0.
|
|
241
|
+
"@lexical/plain-text": "^0.52.0",
|
|
232
242
|
"@noble/ciphers": "^2.4.0",
|
|
233
|
-
"dayjs": "^1.11.
|
|
234
|
-
"immer": "^11.1.
|
|
235
|
-
"lexical": "^0.
|
|
236
|
-
"tailwind-merge": "^3.
|
|
237
|
-
"tailwind-variants": "^3.3.
|
|
243
|
+
"dayjs": "^1.11.23",
|
|
244
|
+
"immer": "^11.1.21",
|
|
245
|
+
"lexical": "^0.52.0",
|
|
246
|
+
"tailwind-merge": "^3.7.0",
|
|
247
|
+
"tailwind-variants": "^3.3.1"
|
|
238
248
|
},
|
|
239
249
|
"peerDependencies": {
|
|
240
|
-
"@happy-dom/global-registrator": "^
|
|
241
|
-
"@playwright/test": "^1.
|
|
242
|
-
"@react-spring/web": "^10.1.
|
|
250
|
+
"@happy-dom/global-registrator": "^21.0.3",
|
|
251
|
+
"@playwright/test": "^1.64.1",
|
|
252
|
+
"@react-spring/web": "^10.1.2",
|
|
243
253
|
"@use-gesture/react": "^10.3.1",
|
|
244
|
-
"bullmq": "^5.
|
|
254
|
+
"bullmq": "^5.81.5",
|
|
245
255
|
"chance": "^1.1.13",
|
|
246
|
-
"firebase": "^
|
|
247
|
-
"happy-dom": "^
|
|
248
|
-
"ioredis": "^5.
|
|
256
|
+
"firebase": "^13.0.0",
|
|
257
|
+
"happy-dom": "^21.0.3",
|
|
258
|
+
"ioredis": "^5.11.1",
|
|
249
259
|
"postgres": "^3.4.9",
|
|
250
|
-
"protobufjs": "^8.
|
|
251
|
-
"react": "19.3.
|
|
252
|
-
"react-dom": "19.3.
|
|
253
|
-
"react-icons": "^5.
|
|
260
|
+
"protobufjs": "^8.8.1",
|
|
261
|
+
"react": "19.3.1",
|
|
262
|
+
"react-dom": "19.3.1",
|
|
263
|
+
"react-icons": "^5.7.0",
|
|
254
264
|
"react-refresh": "^0.19.0",
|
|
255
|
-
"react-server-dom-webpack": "^19.3.
|
|
265
|
+
"react-server-dom-webpack": "^19.3.1",
|
|
256
266
|
"react-spring": "^10.0.4",
|
|
257
267
|
"scheduler": "^0.28.0",
|
|
258
268
|
"tailwind-scrollbar": "^4.0.2",
|
|
@@ -321,8 +331,8 @@
|
|
|
321
331
|
}
|
|
322
332
|
},
|
|
323
333
|
"devDependencies": {
|
|
324
|
-
"@biomejs/biome": "2.5.
|
|
325
|
-
"@types/bun": "^1.4.
|
|
334
|
+
"@biomejs/biome": "2.5.14",
|
|
335
|
+
"@types/bun": "^1.4.3"
|
|
326
336
|
},
|
|
327
337
|
"bun": {
|
|
328
338
|
"platform": "bun"
|
package/server/akanApp.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { LogHub } from "./logging/logHub";
|
|
|
19
19
|
import { LogStreamRoute } from "./logging/logStreamRoute";
|
|
20
20
|
import { RotatingLogWriter } from "./logging/rotatingLogWriter";
|
|
21
21
|
import { AppInfo } from "./ops/appInfo";
|
|
22
|
+
import type { OpsHost } from "./ops/opsCommand";
|
|
22
23
|
import type { OpsRoute } from "./ops/opsRoute";
|
|
23
24
|
import { ProcessMetricsCollector } from "./processMetricsCollector";
|
|
24
25
|
import { HostAllowlist } from "./routing/hostAllowlist";
|
|
@@ -238,7 +239,9 @@ export class AkanApp {
|
|
|
238
239
|
async start() {
|
|
239
240
|
if (process.argv[2] === "ops") {
|
|
240
241
|
const { OpsCommand } = await import("./ops/opsCommand");
|
|
241
|
-
process.exit(
|
|
242
|
+
process.exit(
|
|
243
|
+
await OpsCommand.run(process.argv.slice(3), { importServer: async () => await this.#importServer() }),
|
|
244
|
+
);
|
|
242
245
|
}
|
|
243
246
|
if (this.#solo) return await this.#startSolo();
|
|
244
247
|
if (SelfExec.carried)
|
|
@@ -274,6 +277,12 @@ export class AkanApp {
|
|
|
274
277
|
});
|
|
275
278
|
}
|
|
276
279
|
|
|
280
|
+
async #importServer() {
|
|
281
|
+
Object.assign(process.env, this.#childEnv(0, this.#getRole(0)), { AKAN_COMMAND_TYPE: "script" });
|
|
282
|
+
resetEnvCache();
|
|
283
|
+
return (await import(this.#serverPath)) as Awaited<ReturnType<OpsHost["importServer"]>>;
|
|
284
|
+
}
|
|
285
|
+
|
|
277
286
|
async #startSolo() {
|
|
278
287
|
const role = this.#getRole(0);
|
|
279
288
|
|
|
@@ -760,7 +769,7 @@ export class AkanApp {
|
|
|
760
769
|
|
|
761
770
|
async #proxyHttp(req: Request, server: Bun.Server<GatewayWsData>): Promise<Response> {
|
|
762
771
|
const child = await this.#pickReadyFederationChild(req);
|
|
763
|
-
if (
|
|
772
|
+
if (child?.upstream?.type !== "unix") return this.#respondWithUnavailable(req);
|
|
764
773
|
|
|
765
774
|
const { socketPath } = child.upstream;
|
|
766
775
|
const url = new URL(req.url);
|
|
@@ -800,10 +809,13 @@ export class AkanApp {
|
|
|
800
809
|
}
|
|
801
810
|
}
|
|
802
811
|
|
|
812
|
+
static readonly #upstreamOpenFailureCodes = new Set(["FailedToOpenSocket", "ENOENT", "ECONNREFUSED", "ENOTSOCK"]);
|
|
813
|
+
|
|
803
814
|
static #isUpstreamOpenFailure(error: unknown): boolean {
|
|
804
815
|
if (!error || typeof error !== "object") return false;
|
|
805
816
|
const candidate = error as { code?: unknown; message?: unknown };
|
|
806
|
-
|
|
817
|
+
if (typeof candidate.code === "string" && AkanApp.#upstreamOpenFailureCodes.has(candidate.code)) return true;
|
|
818
|
+
return String(candidate.message ?? "").includes("FailedToOpenSocket");
|
|
807
819
|
}
|
|
808
820
|
|
|
809
821
|
static #isUpstreamMidFlightClose(error: unknown): boolean {
|