@alneas/appkit-react 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/README.md +85 -15
- package/consumer-ai/SKILL.md +12 -0
- package/consumer-ai/api-index.json +103754 -0
- package/consumer-ai/package-context.json +409 -0
- package/dist/ai/action/ExecutionHistory.cjs.map +1 -1
- package/dist/ai/action/ExecutionHistory.d.cts +32 -2
- package/dist/ai/action/ExecutionHistory.d.ts +32 -2
- package/dist/ai/action/ExecutionHistory.js.map +1 -1
- package/dist/ai/action/ScreenActionContext.cjs.map +1 -1
- package/dist/ai/action/ScreenActionContext.d.cts +15 -2
- package/dist/ai/action/ScreenActionContext.d.ts +15 -2
- package/dist/ai/action/ScreenActionContext.js.map +1 -1
- package/dist/ai/action/context.cjs.map +1 -1
- package/dist/ai/action/context.d.cts +19 -3
- package/dist/ai/action/context.d.ts +19 -3
- package/dist/ai/action/context.js.map +1 -1
- package/dist/ai/action/types.d.cts +35 -3
- package/dist/ai/action/types.d.ts +35 -3
- package/dist/ai/action/use-execution-session.cjs.map +1 -1
- package/dist/ai/action/use-execution-session.d.cts +17 -1
- package/dist/ai/action/use-execution-session.d.ts +17 -1
- package/dist/ai/action/use-execution-session.js.map +1 -1
- package/dist/ai/action/use-screen-action-registry.cjs.map +1 -1
- package/dist/ai/action/use-screen-action-registry.d.cts +77 -8
- package/dist/ai/action/use-screen-action-registry.d.ts +77 -8
- package/dist/ai/action/use-screen-action-registry.js.map +1 -1
- package/dist/ai/action/use-screen-action.cjs.map +1 -1
- package/dist/ai/action/use-screen-action.d.cts +23 -6
- package/dist/ai/action/use-screen-action.d.ts +23 -6
- package/dist/ai/action/use-screen-action.js.map +1 -1
- package/dist/ai/action/use-screen-context.cjs.map +1 -1
- package/dist/ai/action/use-screen-context.d.cts +42 -5
- package/dist/ai/action/use-screen-context.d.ts +42 -5
- package/dist/ai/action/use-screen-context.js.map +1 -1
- package/dist/ai/ai-chat/transport.cjs.map +1 -1
- package/dist/ai/ai-chat/transport.d.cts +35 -8
- package/dist/ai/ai-chat/transport.d.ts +35 -8
- package/dist/ai/ai-chat/transport.js.map +1 -1
- package/dist/ai/generative-ui/GenerativeUIRenderer.cjs.map +1 -1
- package/dist/ai/generative-ui/GenerativeUIRenderer.d.cts +21 -3
- package/dist/ai/generative-ui/GenerativeUIRenderer.d.ts +21 -3
- package/dist/ai/generative-ui/GenerativeUIRenderer.js.map +1 -1
- package/dist/ai/generative-ui/error-boundary.cjs.map +1 -1
- package/dist/ai/generative-ui/error-boundary.d.cts +98 -2
- package/dist/ai/generative-ui/error-boundary.d.ts +98 -2
- package/dist/ai/generative-ui/error-boundary.js.map +1 -1
- package/dist/ai/generative-ui/registry.cjs.map +1 -1
- package/dist/ai/generative-ui/registry.d.cts +96 -7
- package/dist/ai/generative-ui/registry.d.ts +96 -7
- package/dist/ai/generative-ui/registry.js.map +1 -1
- package/dist/ai/proposal/ProposalFieldReview.cjs.map +1 -1
- package/dist/ai/proposal/ProposalFieldReview.d.cts +170 -8
- package/dist/ai/proposal/ProposalFieldReview.d.ts +170 -8
- package/dist/ai/proposal/ProposalFieldReview.js.map +1 -1
- package/dist/ai/proposal/types.d.cts +97 -26
- package/dist/ai/proposal/types.d.ts +97 -26
- package/dist/ai/proposal/use-proposal-batch-review.cjs.map +1 -1
- package/dist/ai/proposal/use-proposal-batch-review.d.cts +133 -7
- package/dist/ai/proposal/use-proposal-batch-review.d.ts +133 -7
- package/dist/ai/proposal/use-proposal-batch-review.js.map +1 -1
- package/dist/ai/proposal/use-proposal-review.cjs.map +1 -1
- package/dist/ai/proposal/use-proposal-review.d.cts +47 -5
- package/dist/ai/proposal/use-proposal-review.d.ts +47 -5
- package/dist/ai/proposal/use-proposal-review.js.map +1 -1
- package/dist/avatar.svg +1 -0
- package/dist/consumer-ai/SKILL.md +6 -0
- package/dist/consumer-ai/api-index.json +103754 -0
- package/dist/consumer-ai/package-context.json +5 -3
- package/dist/mockServiceWorker.js +361 -0
- package/dist/styles.css +1 -1
- package/dist/tools/components/auth/AuthForms.cjs.map +1 -1
- package/dist/tools/components/auth/AuthForms.d.cts +131 -81
- package/dist/tools/components/auth/AuthForms.d.ts +131 -81
- package/dist/tools/components/auth/AuthForms.js.map +1 -1
- package/dist/tools/components/auth/AuthGuard.cjs.map +1 -1
- package/dist/tools/components/auth/AuthGuard.d.cts +31 -4
- package/dist/tools/components/auth/AuthGuard.d.ts +31 -4
- package/dist/tools/components/auth/AuthGuard.js.map +1 -1
- package/dist/tools/components/auth/AuthProvider.cjs.map +1 -1
- package/dist/tools/components/auth/AuthProvider.d.cts +39 -42
- package/dist/tools/components/auth/AuthProvider.d.ts +39 -42
- package/dist/tools/components/auth/AuthProvider.js.map +1 -1
- package/dist/tools/components/auth/ProtectedRoute.cjs.map +1 -1
- package/dist/tools/components/auth/ProtectedRoute.d.cts +75 -60
- package/dist/tools/components/auth/ProtectedRoute.d.ts +75 -60
- package/dist/tools/components/auth/ProtectedRoute.js.map +1 -1
- package/dist/tools/components/auth/SignInButton.cjs.map +1 -1
- package/dist/tools/components/auth/SignInButton.d.cts +26 -18
- package/dist/tools/components/auth/SignInButton.d.ts +26 -18
- package/dist/tools/components/auth/SignInButton.js.map +1 -1
- package/dist/tools/components/auth/UserProfileProvider.cjs.map +1 -1
- package/dist/tools/components/auth/UserProfileProvider.d.cts +48 -20
- package/dist/tools/components/auth/UserProfileProvider.d.ts +48 -20
- package/dist/tools/components/auth/UserProfileProvider.js.map +1 -1
- package/dist/tools/components/auth/adapters/better-auth-adapter.cjs.map +1 -1
- package/dist/tools/components/auth/adapters/better-auth-adapter.d.cts +371 -51
- package/dist/tools/components/auth/adapters/better-auth-adapter.d.ts +371 -51
- package/dist/tools/components/auth/adapters/better-auth-adapter.js.map +1 -1
- package/dist/tools/components/auth/adapters/mock-adapter.cjs.map +1 -1
- package/dist/tools/components/auth/adapters/mock-adapter.d.cts +149 -28
- package/dist/tools/components/auth/adapters/mock-adapter.d.ts +149 -28
- package/dist/tools/components/auth/adapters/mock-adapter.js.map +1 -1
- package/dist/tools/components/auth/auth-session.cjs.map +1 -1
- package/dist/tools/components/auth/auth-session.d.cts +147 -1
- package/dist/tools/components/auth/auth-session.d.ts +147 -1
- package/dist/tools/components/auth/auth-session.js.map +1 -1
- package/dist/tools/components/auth/session-cache.cjs.map +1 -1
- package/dist/tools/components/auth/session-cache.d.cts +88 -24
- package/dist/tools/components/auth/session-cache.d.ts +88 -24
- package/dist/tools/components/auth/session-cache.js.map +1 -1
- package/dist/tools/components/auth/types.cjs.map +1 -1
- package/dist/tools/components/auth/types.d.cts +329 -106
- package/dist/tools/components/auth/types.d.ts +329 -106
- package/dist/tools/components/auth/types.js.map +1 -1
- package/dist/tools/components/auth/useAuth.cjs.map +1 -1
- package/dist/tools/components/auth/useAuth.d.cts +110 -17
- package/dist/tools/components/auth/useAuth.d.ts +110 -17
- package/dist/tools/components/auth/useAuth.js.map +1 -1
- package/dist/tools/components/auth/useAuthGuard.cjs.map +1 -1
- package/dist/tools/components/auth/useAuthGuard.d.cts +49 -38
- package/dist/tools/components/auth/useAuthGuard.d.ts +49 -38
- package/dist/tools/components/auth/useAuthGuard.js.map +1 -1
- package/dist/tools/components/auth/useRoleCheck.cjs.map +1 -1
- package/dist/tools/components/auth/useRoleCheck.d.cts +48 -1
- package/dist/tools/components/auth/useRoleCheck.d.ts +48 -1
- package/dist/tools/components/auth/useRoleCheck.js.map +1 -1
- package/dist/tools/components/auth/useUserProfile.cjs.map +1 -1
- package/dist/tools/components/auth/useUserProfile.d.cts +66 -1
- package/dist/tools/components/auth/useUserProfile.d.ts +66 -1
- package/dist/tools/components/auth/useUserProfile.js.map +1 -1
- package/dist/tools/components/barcode/BarcodeGenerator.cjs.map +1 -1
- package/dist/tools/components/barcode/BarcodeGenerator.d.cts +32 -18
- package/dist/tools/components/barcode/BarcodeGenerator.d.ts +32 -18
- package/dist/tools/components/barcode/BarcodeGenerator.js.map +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.cjs +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.cjs.map +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.d.cts +20 -13
- package/dist/tools/components/barcode/QRCodeGenerator.d.ts +20 -13
- package/dist/tools/components/barcode/QRCodeGenerator.js +1 -1
- package/dist/tools/components/barcode/QRCodeGenerator.js.map +1 -1
- package/dist/tools/components/barcode/QRCodeScanner.cjs.map +1 -1
- package/dist/tools/components/barcode/QRCodeScanner.d.cts +32 -1
- package/dist/tools/components/barcode/QRCodeScanner.d.ts +32 -1
- package/dist/tools/components/barcode/QRCodeScanner.js.map +1 -1
- package/dist/tools/components/calendar/ResourceCalendar.cjs.map +1 -1
- package/dist/tools/components/calendar/ResourceCalendar.d.cts +17 -42
- package/dist/tools/components/calendar/ResourceCalendar.d.ts +17 -42
- package/dist/tools/components/calendar/ResourceCalendar.js.map +1 -1
- package/dist/tools/components/calendar/views/ResourceView.cjs +1 -1
- package/dist/tools/components/calendar/views/ResourceView.cjs.map +1 -1
- package/dist/tools/components/calendar/views/ResourceView.js +2 -2
- package/dist/tools/components/calendar/views/ResourceView.js.map +1 -1
- package/dist/tools/components/chart/ComposedChart.cjs.map +1 -1
- package/dist/tools/components/chart/ComposedChart.d.cts +54 -1
- package/dist/tools/components/chart/ComposedChart.d.ts +54 -1
- package/dist/tools/components/chart/ComposedChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleAreaChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleAreaChart.d.cts +41 -1
- package/dist/tools/components/chart/SimpleAreaChart.d.ts +41 -1
- package/dist/tools/components/chart/SimpleAreaChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleBarChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleBarChart.d.cts +34 -24
- package/dist/tools/components/chart/SimpleBarChart.d.ts +34 -24
- package/dist/tools/components/chart/SimpleBarChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleLineChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleLineChart.d.cts +31 -28
- package/dist/tools/components/chart/SimpleLineChart.d.ts +31 -28
- package/dist/tools/components/chart/SimpleLineChart.js.map +1 -1
- package/dist/tools/components/chart/SimplePieChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimplePieChart.d.cts +28 -22
- package/dist/tools/components/chart/SimplePieChart.d.ts +28 -22
- package/dist/tools/components/chart/SimplePieChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleRadarChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleRadarChart.d.cts +38 -1
- package/dist/tools/components/chart/SimpleRadarChart.d.ts +38 -1
- package/dist/tools/components/chart/SimpleRadarChart.js.map +1 -1
- package/dist/tools/components/chart/SimpleScatterChart.cjs.map +1 -1
- package/dist/tools/components/chart/SimpleScatterChart.d.cts +44 -1
- package/dist/tools/components/chart/SimpleScatterChart.d.ts +44 -1
- package/dist/tools/components/chart/SimpleScatterChart.js.map +1 -1
- package/dist/tools/components/chart/StackedBarChart.cjs.map +1 -1
- package/dist/tools/components/chart/StackedBarChart.d.cts +38 -1
- package/dist/tools/components/chart/StackedBarChart.d.ts +38 -1
- package/dist/tools/components/chart/StackedBarChart.js.map +1 -1
- package/dist/tools/components/data-table/data-table.cjs +1 -1
- package/dist/tools/components/data-table/data-table.cjs.map +1 -1
- package/dist/tools/components/data-table/data-table.js +286 -263
- package/dist/tools/components/data-table/data-table.js.map +1 -1
- package/dist/tools/components/data-table/table-utils.cjs.map +1 -1
- package/dist/tools/components/data-table/table-utils.d.cts +45 -35
- package/dist/tools/components/data-table/table-utils.d.ts +45 -35
- package/dist/tools/components/data-table/table-utils.js.map +1 -1
- package/dist/tools/components/editable-table/editable-table.cjs +1 -1
- package/dist/tools/components/editable-table/editable-table.cjs.map +1 -1
- package/dist/tools/components/editable-table/editable-table.js +15 -2
- package/dist/tools/components/editable-table/editable-table.js.map +1 -1
- package/dist/tools/components/error/ErrorDialog.cjs +1 -1
- package/dist/tools/components/error/ErrorDialog.cjs.map +1 -1
- package/dist/tools/components/error/ErrorDialog.js +1 -1
- package/dist/tools/components/error/ErrorDialog.js.map +1 -1
- package/dist/tools/components/error/ErrorInline.cjs +1 -1
- package/dist/tools/components/error/ErrorInline.cjs.map +1 -1
- package/dist/tools/components/error/ErrorInline.js +1 -1
- package/dist/tools/components/error/ErrorInline.js.map +1 -1
- package/dist/tools/components/error/ErrorNotification.cjs +1 -1
- package/dist/tools/components/error/ErrorNotification.cjs.map +1 -1
- package/dist/tools/components/error/ErrorNotification.js +10 -10
- package/dist/tools/components/error/ErrorNotification.js.map +1 -1
- package/dist/tools/components/file-browser/FilePreview.cjs +1 -1
- package/dist/tools/components/file-browser/FilePreview.cjs.map +1 -1
- package/dist/tools/components/file-browser/FilePreview.js +28 -26
- package/dist/tools/components/file-browser/FilePreview.js.map +1 -1
- package/dist/tools/components/filter/filter.cjs.map +1 -1
- package/dist/tools/components/filter/filter.d.cts +23 -34
- package/dist/tools/components/filter/filter.d.ts +23 -34
- package/dist/tools/components/filter/filter.js.map +1 -1
- package/dist/tools/components/form/EnhancedDetailPage.cjs.map +1 -1
- package/dist/tools/components/form/EnhancedDetailPage.d.cts +47 -42
- package/dist/tools/components/form/EnhancedDetailPage.d.ts +47 -42
- package/dist/tools/components/form/EnhancedDetailPage.js.map +1 -1
- package/dist/tools/components/form/form-grid.cjs.map +1 -1
- package/dist/tools/components/form/form-grid.d.cts +44 -22
- package/dist/tools/components/form/form-grid.d.ts +44 -22
- package/dist/tools/components/form/form-grid.js.map +1 -1
- package/dist/tools/components/gantt/GanttChart.cjs +1 -1
- package/dist/tools/components/gantt/GanttChart.cjs.map +1 -1
- package/dist/tools/components/gantt/GanttChart.d.cts +20 -1
- package/dist/tools/components/gantt/GanttChart.d.ts +20 -1
- package/dist/tools/components/gantt/GanttChart.js +3 -0
- package/dist/tools/components/gantt/GanttChart.js.map +1 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.cjs +1 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.cjs.map +1 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.js +2 -1
- package/dist/tools/components/gantt/components/GanttTaskBar.js.map +1 -1
- package/dist/tools/components/header/header.cjs +1 -1
- package/dist/tools/components/header/header.cjs.map +1 -1
- package/dist/tools/components/header/header.d.cts +103 -40
- package/dist/tools/components/header/header.d.ts +103 -40
- package/dist/tools/components/header/header.js +1 -1
- package/dist/tools/components/header/header.js.map +1 -1
- package/dist/tools/components/i18n/LanguageSwitcher.cjs.map +1 -1
- package/dist/tools/components/i18n/LanguageSwitcher.d.cts +18 -14
- package/dist/tools/components/i18n/LanguageSwitcher.d.ts +18 -14
- package/dist/tools/components/i18n/LanguageSwitcher.js.map +1 -1
- package/dist/tools/components/kanban/KanbanBoard.cjs +1 -1
- package/dist/tools/components/kanban/KanbanBoard.cjs.map +1 -1
- package/dist/tools/components/kanban/KanbanBoard.d.cts +16 -34
- package/dist/tools/components/kanban/KanbanBoard.d.ts +16 -34
- package/dist/tools/components/kanban/KanbanBoard.js +3 -0
- package/dist/tools/components/kanban/KanbanBoard.js.map +1 -1
- package/dist/tools/components/kanban/KanbanColumn.cjs +1 -1
- package/dist/tools/components/kanban/KanbanColumn.cjs.map +1 -1
- package/dist/tools/components/kanban/KanbanColumn.js +1 -1
- package/dist/tools/components/kanban/KanbanColumn.js.map +1 -1
- package/dist/tools/components/kanban/kanban-compound.cjs +1 -1
- package/dist/tools/components/kanban/kanban-compound.cjs.map +1 -1
- package/dist/tools/components/kanban/kanban-compound.js +4 -1
- package/dist/tools/components/kanban/kanban-compound.js.map +1 -1
- package/dist/tools/components/kanban/kanban-primitives.cjs +1 -1
- package/dist/tools/components/kanban/kanban-primitives.cjs.map +1 -1
- package/dist/tools/components/kanban/kanban-primitives.js +0 -1
- package/dist/tools/components/kanban/kanban-primitives.js.map +1 -1
- package/dist/tools/components/priority-queue/PriorityCard.cjs +1 -1
- package/dist/tools/components/priority-queue/PriorityCard.cjs.map +1 -1
- package/dist/tools/components/priority-queue/PriorityCard.js +3 -1
- package/dist/tools/components/priority-queue/PriorityCard.js.map +1 -1
- package/dist/tools/components/sidebar/SmartSidebar.cjs.map +1 -1
- package/dist/tools/components/sidebar/SmartSidebar.d.cts +41 -43
- package/dist/tools/components/sidebar/SmartSidebar.d.ts +41 -43
- package/dist/tools/components/sidebar/SmartSidebar.js.map +1 -1
- package/dist/tools/components/splash/SplashScreen.cjs.map +1 -1
- package/dist/tools/components/splash/SplashScreen.d.cts +43 -68
- package/dist/tools/components/splash/SplashScreen.d.ts +43 -68
- package/dist/tools/components/splash/SplashScreen.js.map +1 -1
- package/dist/tools/components/workflow/WorkflowStatusPanel.cjs +1 -1
- package/dist/tools/components/workflow/WorkflowStatusPanel.cjs.map +1 -1
- package/dist/tools/components/workflow/WorkflowStatusPanel.js +2 -2
- package/dist/tools/components/workflow/WorkflowStatusPanel.js.map +1 -1
- package/dist/tools/lib/data-access/data-access-context.cjs.map +1 -1
- package/dist/tools/lib/data-access/data-access-context.d.cts +15 -6
- package/dist/tools/lib/data-access/data-access-context.d.ts +15 -6
- package/dist/tools/lib/data-access/data-access-context.js.map +1 -1
- package/dist/tools/lib/data-access/react-query-provider.cjs.map +1 -1
- package/dist/tools/lib/data-access/react-query-provider.d.cts +19 -2
- package/dist/tools/lib/data-access/react-query-provider.d.ts +19 -2
- package/dist/tools/lib/data-access/react-query-provider.js.map +1 -1
- package/dist/tools/lib/data-access/react-query.cjs.map +1 -1
- package/dist/tools/lib/data-access/react-query.d.cts +365 -90
- package/dist/tools/lib/data-access/react-query.d.ts +365 -90
- package/dist/tools/lib/data-access/react-query.js.map +1 -1
- package/dist/tools/lib/error/AppError.cjs.map +1 -1
- package/dist/tools/lib/error/AppError.d.cts +157 -63
- package/dist/tools/lib/error/AppError.d.ts +157 -63
- package/dist/tools/lib/error/AppError.js.map +1 -1
- package/dist/tools/lib/hooks/useAsyncWithTimeout.cjs.map +1 -1
- package/dist/tools/lib/hooks/useAsyncWithTimeout.d.cts +79 -26
- package/dist/tools/lib/hooks/useAsyncWithTimeout.d.ts +79 -26
- package/dist/tools/lib/hooks/useAsyncWithTimeout.js.map +1 -1
- package/dist/tools/lib/hooks/useError.cjs.map +1 -1
- package/dist/tools/lib/hooks/useError.d.cts +51 -16
- package/dist/tools/lib/hooks/useError.d.ts +51 -16
- package/dist/tools/lib/hooks/useError.js.map +1 -1
- package/dist/tools/lib/schema/ajv.cjs +1 -1
- package/dist/tools/lib/schema/ajv.cjs.map +1 -1
- package/dist/tools/lib/schema/ajv.d.cts +19 -8
- package/dist/tools/lib/schema/ajv.d.ts +19 -8
- package/dist/tools/lib/schema/ajv.js +2 -1
- package/dist/tools/lib/schema/ajv.js.map +1 -1
- package/dist/tools/lib/state/error-store.cjs.map +1 -1
- package/dist/tools/lib/state/error-store.d.cts +61 -10
- package/dist/tools/lib/state/error-store.d.ts +61 -10
- package/dist/tools/lib/state/error-store.js.map +1 -1
- package/dist/tools/lib/state/store-factory.cjs.map +1 -1
- package/dist/tools/lib/state/store-factory.d.cts +25 -4
- package/dist/tools/lib/state/store-factory.d.ts +25 -4
- package/dist/tools/lib/state/store-factory.js.map +1 -1
- package/dist/tools/lib/state/ui-store.cjs.map +1 -1
- package/dist/tools/lib/state/ui-store.d.cts +39 -0
- package/dist/tools/lib/state/ui-store.d.ts +39 -0
- package/dist/tools/lib/state/ui-store.js.map +1 -1
- package/dist/ui/components/theme/theme-context.cjs.map +1 -1
- package/dist/ui/components/theme/theme-context.d.cts +171 -1
- package/dist/ui/components/theme/theme-context.d.ts +171 -1
- package/dist/ui/components/theme/theme-context.js.map +1 -1
- package/dist/ui/components/theme/theme-provider.cjs.map +1 -1
- package/dist/ui/components/theme/theme-provider.d.cts +31 -19
- package/dist/ui/components/theme/theme-provider.d.ts +31 -19
- package/dist/ui/components/theme/theme-provider.js.map +1 -1
- package/dist/ui/components/theme/theme-script.cjs.map +1 -1
- package/dist/ui/components/theme/theme-script.d.cts +16 -1
- package/dist/ui/components/theme/theme-script.d.ts +16 -1
- package/dist/ui/components/theme/theme-script.js.map +1 -1
- package/dist/ui/components/theme/theme-switcher.cjs +1 -1
- package/dist/ui/components/theme/theme-switcher.cjs.map +1 -1
- package/dist/ui/components/theme/theme-switcher.d.cts +82 -13
- package/dist/ui/components/theme/theme-switcher.d.ts +82 -13
- package/dist/ui/components/theme/theme-switcher.js +8 -0
- package/dist/ui/components/theme/theme-switcher.js.map +1 -1
- package/dist/ui/components/ui/accordion.cjs.map +1 -1
- package/dist/ui/components/ui/accordion.d.cts +60 -0
- package/dist/ui/components/ui/accordion.d.ts +60 -0
- package/dist/ui/components/ui/accordion.js.map +1 -1
- package/dist/ui/components/ui/adjustable-pane.cjs.map +1 -1
- package/dist/ui/components/ui/adjustable-pane.d.cts +44 -26
- package/dist/ui/components/ui/adjustable-pane.d.ts +44 -26
- package/dist/ui/components/ui/adjustable-pane.js.map +1 -1
- package/dist/ui/components/ui/alert-dialog.cjs.map +1 -1
- package/dist/ui/components/ui/alert-dialog.d.cts +179 -2
- package/dist/ui/components/ui/alert-dialog.d.ts +179 -2
- package/dist/ui/components/ui/alert-dialog.js.map +1 -1
- package/dist/ui/components/ui/alert.cjs.map +1 -1
- package/dist/ui/components/ui/alert.d.cts +52 -4
- package/dist/ui/components/ui/alert.d.ts +52 -4
- package/dist/ui/components/ui/alert.js.map +1 -1
- package/dist/ui/components/ui/aspect-ratio.cjs.map +1 -1
- package/dist/ui/components/ui/aspect-ratio.d.cts +16 -1
- package/dist/ui/components/ui/aspect-ratio.d.ts +16 -1
- package/dist/ui/components/ui/aspect-ratio.js.map +1 -1
- package/dist/ui/components/ui/avatar.cjs.map +1 -1
- package/dist/ui/components/ui/avatar.d.cts +87 -3
- package/dist/ui/components/ui/avatar.d.ts +87 -3
- package/dist/ui/components/ui/avatar.js.map +1 -1
- package/dist/ui/components/ui/badge-components.cjs.map +1 -1
- package/dist/ui/components/ui/badge-components.d.cts +13 -1
- package/dist/ui/components/ui/badge-components.d.ts +13 -1
- package/dist/ui/components/ui/badge-components.js.map +1 -1
- package/dist/ui/components/ui/badge-variants.cjs.map +1 -1
- package/dist/ui/components/ui/badge-variants.d.cts +15 -0
- package/dist/ui/components/ui/badge-variants.d.ts +15 -0
- package/dist/ui/components/ui/badge-variants.js.map +1 -1
- package/dist/ui/components/ui/breadcrumb.cjs.map +1 -1
- package/dist/ui/components/ui/breadcrumb.d.cts +91 -7
- package/dist/ui/components/ui/breadcrumb.d.ts +91 -7
- package/dist/ui/components/ui/breadcrumb.js.map +1 -1
- package/dist/ui/components/ui/button-components.cjs.map +1 -1
- package/dist/ui/components/ui/button-components.d.cts +18 -6
- package/dist/ui/components/ui/button-components.d.ts +18 -6
- package/dist/ui/components/ui/button-components.js.map +1 -1
- package/dist/ui/components/ui/button-group-components.cjs.map +1 -1
- package/dist/ui/components/ui/button-group-components.d.cts +39 -3
- package/dist/ui/components/ui/button-group-components.d.ts +39 -3
- package/dist/ui/components/ui/button-group-components.js.map +1 -1
- package/dist/ui/components/ui/button-group-variants.cjs.map +1 -1
- package/dist/ui/components/ui/button-group-variants.d.cts +15 -0
- package/dist/ui/components/ui/button-group-variants.d.ts +15 -0
- package/dist/ui/components/ui/button-group-variants.js.map +1 -1
- package/dist/ui/components/ui/button-variants.cjs.map +1 -1
- package/dist/ui/components/ui/button-variants.d.cts +13 -2
- package/dist/ui/components/ui/button-variants.d.ts +13 -2
- package/dist/ui/components/ui/button-variants.js.map +1 -1
- package/dist/ui/components/ui/card.cjs.map +1 -1
- package/dist/ui/components/ui/card.d.cts +106 -2
- package/dist/ui/components/ui/card.d.ts +106 -2
- package/dist/ui/components/ui/card.js.map +1 -1
- package/dist/ui/components/ui/checkbox-group.cjs.map +1 -1
- package/dist/ui/components/ui/checkbox-group.d.cts +13 -1
- package/dist/ui/components/ui/checkbox-group.d.ts +13 -1
- package/dist/ui/components/ui/checkbox-group.js.map +1 -1
- package/dist/ui/components/ui/checkbox.cjs.map +1 -1
- package/dist/ui/components/ui/checkbox.d.cts +17 -6
- package/dist/ui/components/ui/checkbox.d.ts +17 -6
- package/dist/ui/components/ui/checkbox.js.map +1 -1
- package/dist/ui/components/ui/collapsible.cjs.map +1 -1
- package/dist/ui/components/ui/collapsible.d.cts +39 -3
- package/dist/ui/components/ui/collapsible.d.ts +39 -3
- package/dist/ui/components/ui/collapsible.js.map +1 -1
- package/dist/ui/components/ui/combobox-components.cjs.map +1 -1
- package/dist/ui/components/ui/combobox-components.d.cts +209 -14
- package/dist/ui/components/ui/combobox-components.d.ts +209 -14
- package/dist/ui/components/ui/combobox-components.js.map +1 -1
- package/dist/ui/components/ui/combobox-hooks.cjs.map +1 -1
- package/dist/ui/components/ui/combobox-hooks.d.cts +13 -1
- package/dist/ui/components/ui/combobox-hooks.d.ts +13 -1
- package/dist/ui/components/ui/combobox-hooks.js.map +1 -1
- package/dist/ui/components/ui/command.cjs.map +1 -1
- package/dist/ui/components/ui/command.d.cts +132 -9
- package/dist/ui/components/ui/command.d.ts +132 -9
- package/dist/ui/components/ui/command.js.map +1 -1
- package/dist/ui/components/ui/context-menu.cjs.map +1 -1
- package/dist/ui/components/ui/context-menu.d.cts +233 -2
- package/dist/ui/components/ui/context-menu.d.ts +233 -2
- package/dist/ui/components/ui/context-menu.js.map +1 -1
- package/dist/ui/components/ui/dialog.cjs.map +1 -1
- package/dist/ui/components/ui/dialog.d.cts +157 -5
- package/dist/ui/components/ui/dialog.d.ts +157 -5
- package/dist/ui/components/ui/dialog.js.map +1 -1
- package/dist/ui/components/ui/drawer.cjs.map +1 -1
- package/dist/ui/components/ui/drawer.d.cts +130 -10
- package/dist/ui/components/ui/drawer.d.ts +130 -10
- package/dist/ui/components/ui/drawer.js.map +1 -1
- package/dist/ui/components/ui/dropdown-menu.cjs.map +1 -1
- package/dist/ui/components/ui/dropdown-menu.d.cts +225 -6
- package/dist/ui/components/ui/dropdown-menu.d.ts +225 -6
- package/dist/ui/components/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/components/ui/empty.cjs.map +1 -1
- package/dist/ui/components/ui/empty.d.cts +78 -6
- package/dist/ui/components/ui/empty.d.ts +78 -6
- package/dist/ui/components/ui/empty.js.map +1 -1
- package/dist/ui/components/ui/field.cjs.map +1 -1
- package/dist/ui/components/ui/field.d.cts +180 -6
- package/dist/ui/components/ui/field.d.ts +180 -6
- package/dist/ui/components/ui/field.js.map +1 -1
- package/dist/ui/components/ui/file-icon.cjs.map +1 -1
- package/dist/ui/components/ui/file-icon.d.cts +32 -4
- package/dist/ui/components/ui/file-icon.d.ts +32 -4
- package/dist/ui/components/ui/file-icon.js.map +1 -1
- package/dist/ui/components/ui/hover-card.cjs.map +1 -1
- package/dist/ui/components/ui/hover-card.d.cts +39 -3
- package/dist/ui/components/ui/hover-card.d.ts +39 -3
- package/dist/ui/components/ui/hover-card.js.map +1 -1
- package/dist/ui/components/ui/input-group.cjs.map +1 -1
- package/dist/ui/components/ui/input-group.d.cts +84 -6
- package/dist/ui/components/ui/input-group.d.ts +84 -6
- package/dist/ui/components/ui/input-group.js.map +1 -1
- package/dist/ui/components/ui/input-otp.cjs.map +1 -1
- package/dist/ui/components/ui/input-otp.d.cts +58 -4
- package/dist/ui/components/ui/input-otp.d.ts +58 -4
- package/dist/ui/components/ui/input-otp.js.map +1 -1
- package/dist/ui/components/ui/input.cjs.map +1 -1
- package/dist/ui/components/ui/input.d.cts +18 -10
- package/dist/ui/components/ui/input.d.ts +18 -10
- package/dist/ui/components/ui/input.js.map +1 -1
- package/dist/ui/components/ui/item.cjs.map +1 -1
- package/dist/ui/components/ui/item.d.cts +130 -10
- package/dist/ui/components/ui/item.d.ts +130 -10
- package/dist/ui/components/ui/item.js.map +1 -1
- package/dist/ui/components/ui/kbd.cjs.map +1 -1
- package/dist/ui/components/ui/kbd.d.cts +26 -2
- package/dist/ui/components/ui/kbd.d.ts +26 -2
- package/dist/ui/components/ui/kbd.js.map +1 -1
- package/dist/ui/components/ui/label.cjs.map +1 -1
- package/dist/ui/components/ui/label.d.cts +15 -0
- package/dist/ui/components/ui/label.d.ts +15 -0
- package/dist/ui/components/ui/label.js.map +1 -1
- package/dist/ui/components/ui/layout.cjs +1 -1
- package/dist/ui/components/ui/layout.cjs.map +1 -1
- package/dist/ui/components/ui/layout.d.cts +45 -11
- package/dist/ui/components/ui/layout.d.ts +45 -11
- package/dist/ui/components/ui/layout.js +22 -20
- package/dist/ui/components/ui/layout.js.map +1 -1
- package/dist/ui/components/ui/menubar.cjs.map +1 -1
- package/dist/ui/components/ui/menubar.d.cts +220 -16
- package/dist/ui/components/ui/menubar.d.ts +220 -16
- package/dist/ui/components/ui/menubar.js.map +1 -1
- package/dist/ui/components/ui/meter.cjs.map +1 -1
- package/dist/ui/components/ui/meter.d.cts +52 -4
- package/dist/ui/components/ui/meter.d.ts +52 -4
- package/dist/ui/components/ui/meter.js.map +1 -1
- package/dist/ui/components/ui/mobile-form-variants.cjs.map +1 -1
- package/dist/ui/components/ui/mobile-form-variants.d.cts +30 -0
- package/dist/ui/components/ui/mobile-form-variants.d.ts +30 -0
- package/dist/ui/components/ui/mobile-form-variants.js.map +1 -1
- package/dist/ui/components/ui/mobile-form.cjs.map +1 -1
- package/dist/ui/components/ui/mobile-form.d.cts +186 -9
- package/dist/ui/components/ui/mobile-form.d.ts +186 -9
- package/dist/ui/components/ui/mobile-form.js.map +1 -1
- package/dist/ui/components/ui/navigation-menu-components.cjs.map +1 -1
- package/dist/ui/components/ui/navigation-menu-components.d.cts +104 -8
- package/dist/ui/components/ui/navigation-menu-components.d.ts +104 -8
- package/dist/ui/components/ui/navigation-menu-components.js.map +1 -1
- package/dist/ui/components/ui/navigation-menu-variants.cjs.map +1 -1
- package/dist/ui/components/ui/navigation-menu-variants.d.cts +15 -0
- package/dist/ui/components/ui/navigation-menu-variants.d.ts +15 -0
- package/dist/ui/components/ui/navigation-menu-variants.js.map +1 -1
- package/dist/ui/components/ui/number-field.cjs.map +1 -1
- package/dist/ui/components/ui/number-field.d.cts +78 -6
- package/dist/ui/components/ui/number-field.d.ts +78 -6
- package/dist/ui/components/ui/number-field.js.map +1 -1
- package/dist/ui/components/ui/pagination.cjs.map +1 -1
- package/dist/ui/components/ui/pagination.d.cts +99 -7
- package/dist/ui/components/ui/pagination.d.ts +99 -7
- package/dist/ui/components/ui/pagination.js.map +1 -1
- package/dist/ui/components/ui/password-input.cjs.map +1 -1
- package/dist/ui/components/ui/password-input.d.cts +10 -7
- package/dist/ui/components/ui/password-input.d.ts +10 -7
- package/dist/ui/components/ui/password-input.js.map +1 -1
- package/dist/ui/components/ui/popover.cjs.map +1 -1
- package/dist/ui/components/ui/popover.d.cts +86 -2
- package/dist/ui/components/ui/popover.d.ts +86 -2
- package/dist/ui/components/ui/popover.js.map +1 -1
- package/dist/ui/components/ui/progress.cjs.map +1 -1
- package/dist/ui/components/ui/progress.d.cts +72 -2
- package/dist/ui/components/ui/progress.d.ts +72 -2
- package/dist/ui/components/ui/progress.js.map +1 -1
- package/dist/ui/components/ui/radio-card.cjs.map +1 -1
- package/dist/ui/components/ui/radio-card.d.cts +32 -4
- package/dist/ui/components/ui/radio-card.d.ts +32 -4
- package/dist/ui/components/ui/radio-card.js.map +1 -1
- package/dist/ui/components/ui/radio-group.cjs.map +1 -1
- package/dist/ui/components/ui/radio-group.d.cts +28 -2
- package/dist/ui/components/ui/radio-group.d.ts +28 -2
- package/dist/ui/components/ui/radio-group.js.map +1 -1
- package/dist/ui/components/ui/resizable.cjs.map +1 -1
- package/dist/ui/components/ui/resizable.d.cts +42 -3
- package/dist/ui/components/ui/resizable.d.ts +42 -3
- package/dist/ui/components/ui/resizable.js.map +1 -1
- package/dist/ui/components/ui/responsive-list.cjs.map +1 -1
- package/dist/ui/components/ui/responsive-list.d.cts +176 -13
- package/dist/ui/components/ui/responsive-list.d.ts +176 -13
- package/dist/ui/components/ui/responsive-list.js.map +1 -1
- package/dist/ui/components/ui/scroll-area.cjs.map +1 -1
- package/dist/ui/components/ui/scroll-area.d.cts +28 -1
- package/dist/ui/components/ui/scroll-area.d.ts +28 -1
- package/dist/ui/components/ui/scroll-area.js.map +1 -1
- package/dist/ui/components/ui/searchable-select-input.cjs.map +1 -1
- package/dist/ui/components/ui/searchable-select-input.d.cts +199 -49
- package/dist/ui/components/ui/searchable-select-input.d.ts +199 -49
- package/dist/ui/components/ui/searchable-select-input.js.map +1 -1
- package/dist/ui/components/ui/select.cjs.map +1 -1
- package/dist/ui/components/ui/select.d.cts +205 -40
- package/dist/ui/components/ui/select.d.ts +205 -40
- package/dist/ui/components/ui/select.js.map +1 -1
- package/dist/ui/components/ui/separator.cjs.map +1 -1
- package/dist/ui/components/ui/separator.d.cts +13 -2
- package/dist/ui/components/ui/separator.d.ts +13 -2
- package/dist/ui/components/ui/separator.js.map +1 -1
- package/dist/ui/components/ui/sheet.cjs.map +1 -1
- package/dist/ui/components/ui/sheet.d.cts +128 -3
- package/dist/ui/components/ui/sheet.d.ts +128 -3
- package/dist/ui/components/ui/sheet.js.map +1 -1
- package/dist/ui/components/ui/skeleton.cjs.map +1 -1
- package/dist/ui/components/ui/skeleton.d.cts +13 -1
- package/dist/ui/components/ui/skeleton.d.ts +13 -1
- package/dist/ui/components/ui/skeleton.js.map +1 -1
- package/dist/ui/components/ui/slider.cjs.map +1 -1
- package/dist/ui/components/ui/slider.d.cts +13 -7
- package/dist/ui/components/ui/slider.d.ts +13 -7
- package/dist/ui/components/ui/slider.js.map +1 -1
- package/dist/ui/components/ui/spinner.cjs.map +1 -1
- package/dist/ui/components/ui/spinner.d.cts +13 -1
- package/dist/ui/components/ui/spinner.d.ts +13 -1
- package/dist/ui/components/ui/spinner.js.map +1 -1
- package/dist/ui/components/ui/switch.cjs.map +1 -1
- package/dist/ui/components/ui/switch.d.cts +26 -0
- package/dist/ui/components/ui/switch.d.ts +26 -0
- package/dist/ui/components/ui/switch.js.map +1 -1
- package/dist/ui/components/ui/table.cjs.map +1 -1
- package/dist/ui/components/ui/table.d.cts +118 -2
- package/dist/ui/components/ui/table.d.ts +118 -2
- package/dist/ui/components/ui/table.js.map +1 -1
- package/dist/ui/components/ui/tabs-components.cjs.map +1 -1
- package/dist/ui/components/ui/tabs-components.d.cts +52 -5
- package/dist/ui/components/ui/tabs-components.d.ts +52 -5
- package/dist/ui/components/ui/tabs-components.js.map +1 -1
- package/dist/ui/components/ui/tabs-variants.cjs.map +1 -1
- package/dist/ui/components/ui/tabs-variants.d.cts +15 -0
- package/dist/ui/components/ui/tabs-variants.d.ts +15 -0
- package/dist/ui/components/ui/tabs-variants.js.map +1 -1
- package/dist/ui/components/ui/textarea.cjs.map +1 -1
- package/dist/ui/components/ui/textarea.d.cts +23 -0
- package/dist/ui/components/ui/textarea.d.ts +23 -0
- package/dist/ui/components/ui/textarea.js.map +1 -1
- package/dist/ui/components/ui/toast.cjs.map +1 -1
- package/dist/ui/components/ui/toast.d.cts +136 -0
- package/dist/ui/components/ui/toast.d.ts +136 -0
- package/dist/ui/components/ui/toast.js.map +1 -1
- package/dist/ui/components/ui/toaster.cjs.map +1 -1
- package/dist/ui/components/ui/toaster.d.cts +12 -3
- package/dist/ui/components/ui/toaster.d.ts +12 -3
- package/dist/ui/components/ui/toaster.js.map +1 -1
- package/dist/ui/components/ui/toggle-components.cjs.map +1 -1
- package/dist/ui/components/ui/toggle-components.d.cts +15 -0
- package/dist/ui/components/ui/toggle-components.d.ts +15 -0
- package/dist/ui/components/ui/toggle-components.js.map +1 -1
- package/dist/ui/components/ui/toggle-group.cjs.map +1 -1
- package/dist/ui/components/ui/toggle-group.d.cts +33 -0
- package/dist/ui/components/ui/toggle-group.d.ts +33 -0
- package/dist/ui/components/ui/toggle-group.js.map +1 -1
- package/dist/ui/components/ui/toggle-variants.cjs.map +1 -1
- package/dist/ui/components/ui/toggle-variants.d.cts +15 -0
- package/dist/ui/components/ui/toggle-variants.d.ts +15 -0
- package/dist/ui/components/ui/toggle-variants.js.map +1 -1
- package/dist/ui/components/ui/toolbar.cjs.map +1 -1
- package/dist/ui/components/ui/toolbar.d.cts +94 -7
- package/dist/ui/components/ui/toolbar.d.ts +94 -7
- package/dist/ui/components/ui/toolbar.js.map +1 -1
- package/dist/ui/components/ui/tooltip.cjs.map +1 -1
- package/dist/ui/components/ui/tooltip.d.cts +54 -3
- package/dist/ui/components/ui/tooltip.d.ts +54 -3
- package/dist/ui/components/ui/tooltip.js.map +1 -1
- package/dist/ui/lib/hooks/use-gps.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-gps.d.cts +29 -4
- package/dist/ui/lib/hooks/use-gps.d.ts +29 -4
- package/dist/ui/lib/hooks/use-gps.js.map +1 -1
- package/dist/ui/lib/hooks/use-is-client.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-is-client.d.cts +11 -2
- package/dist/ui/lib/hooks/use-is-client.d.ts +11 -2
- package/dist/ui/lib/hooks/use-is-client.js.map +1 -1
- package/dist/ui/lib/hooks/use-keyboard-shortcut.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-keyboard-shortcut.d.cts +48 -18
- package/dist/ui/lib/hooks/use-keyboard-shortcut.d.ts +48 -18
- package/dist/ui/lib/hooks/use-keyboard-shortcut.js.map +1 -1
- package/dist/ui/lib/hooks/use-mobile.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-mobile.d.cts +11 -3
- package/dist/ui/lib/hooks/use-mobile.d.ts +11 -3
- package/dist/ui/lib/hooks/use-mobile.js.map +1 -1
- package/dist/ui/lib/hooks/use-toast.cjs.map +1 -1
- package/dist/ui/lib/hooks/use-toast.d.cts +184 -15
- package/dist/ui/lib/hooks/use-toast.d.ts +184 -15
- package/dist/ui/lib/hooks/use-toast.js.map +1 -1
- package/dist/ui/lib/ime-utils.cjs.map +1 -1
- package/dist/ui/lib/ime-utils.d.cts +40 -13
- package/dist/ui/lib/ime-utils.d.ts +40 -13
- package/dist/ui/lib/ime-utils.js.map +1 -1
- package/dist/ui/lib/utils.cjs.map +1 -1
- package/dist/ui/lib/utils.d.cts +9 -6
- package/dist/ui/lib/utils.d.ts +9 -6
- package/dist/ui/lib/utils.js.map +1 -1
- package/docs/ai.md +34 -1
- package/docs/exports.md +5 -1
- package/docs/index.md +89 -16
- package/docs/migration.md +268 -0
- package/docs/request-form.md +4 -1
- package/docs/tools.md +4 -1
- package/docs/ui.md +4 -1
- package/llms-full.txt +499 -36
- package/llms.txt +4 -0
- package/package.json +35 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-query.js","names":["tanstackQueryOptions","createQueryClient","QueryClient","useInvalidate","queryClient","useQueryClient","key","useMutationWithInvalidation","useMutation","options","keys","data","variables","context","findQueryOptions","queryOptions","collection","filter","adapterOptions","getAdapterCacheScope","adapter","findOneQueryOptions","id","aggregateQueryOptions","pipeline","useFind","useDataAccess","useQuery","useFindOne","useCreate","vars","useUpdate","useDelete","useCreateMany","useUpdateMany","useDeleteMany","useAggregate","aggOptions"],"sources":["../../../../src/tools/lib/data-access/react-query.tsx"],"sourcesContent":["import {\n useQuery,\n UseQueryOptions,\n QueryClient,\n useQueryClient,\n useMutation,\n UseMutationOptions,\n MutationFunction,\n queryOptions as tanstackQueryOptions,\n type QueryKey,\n} from '@tanstack/react-query';\nimport { DataAccessAdapter, Filter, QueryOptions } from './types';\nimport { useDataAccess } from './data-access-context';\nimport { getAdapterCacheScope } from './cache-scope';\n\nexport { useDataAccess } from './data-access-context';\n\n// --- Query Helpers (Merged from query.ts) ---\n\n/**\n * アプリケーション全体で使用する QueryClient を作成します。\n * デフォルト設定として、staleTime: 5分, retry: 1, refetchOnWindowFocus: false が設定されています。\n */\nexport function createQueryClient() {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 1000 * 60 * 5, // 5 minutes\n retry: 1,\n refetchOnWindowFocus: false,\n },\n },\n });\n}\n\n/**\n * 指定したキーのクエリキャッシュを手動で無効化(再取得要求)するためのフックです。\n * @returns クエリキーを受け取り、無効化を実行する関数\n */\nexport function useInvalidate() {\n const queryClient = useQueryClient();\n\n return (key: QueryKey) => {\n return queryClient.invalidateQueries({ queryKey: key });\n };\n}\n\n/**\n * useMutation のラッパーフックです。\n * Mutation 成功時に、指定したキーまたは自動生成されたキーに基づいてクエリの無効化を行います。\n *\n * @param mutationFn - 実行する非同期関数\n * @param options.invalidateKeys - 無効化したいクエリキーの配列、または結果からキーを生成する関数\n */\nexport function useMutationWithInvalidation<\n TData = unknown,\n TError = unknown,\n TVariables = void,\n TContext = unknown,\n>(\n mutationFn: MutationFunction<TData, TVariables>,\n options?: UseMutationOptions<TData, TError, TVariables, TContext> & {\n invalidateKeys?: QueryKey[] | ((data: TData, variables: TVariables) => QueryKey[]);\n },\n) {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn,\n ...options,\n onSuccess: async (data, variables, context) => {\n if (options?.invalidateKeys) {\n const keys =\n typeof options.invalidateKeys === 'function'\n ? options.invalidateKeys(data, variables)\n : options.invalidateKeys;\n\n await Promise.all(keys.map((key) => queryClient.invalidateQueries({ queryKey: key })));\n }\n // @ts-expect-error - Argument count mismatch between supported TanStack Query type versions\n options?.onSuccess?.(data, variables, context);\n },\n });\n}\n\n// --- Query Options Factories ---\n\n/**\n * useFind および ensureQueryData 用の QueryOptions を生成します。\n *\n * @param adapter - DataAccessAdapter インスタンス\n * @param collection - コレクション名\n * @param filter - フィルタ条件\n * @param adapterOptions - クエリオプション\n * @returns TanStack Query 用のオプションオブジェクト\n */\nexport function findQueryOptions<T = unknown>(\n adapter: DataAccessAdapter,\n collection: string,\n filter?: Filter,\n adapterOptions?: QueryOptions,\n) {\n return tanstackQueryOptions({\n queryKey: [collection, 'list', filter, adapterOptions, getAdapterCacheScope(adapter)],\n queryFn: ({ signal }) => adapter.find<T>(collection, filter, { ...adapterOptions, signal }),\n });\n}\n\n/**\n * useFindOne および ensureQueryData 用の QueryOptions を生成します。\n *\n * @param adapter - DataAccessAdapter インスタンス\n * @param collection - コレクション名\n * @param id - ドキュメントID\n * @param adapterOptions - クエリオプション\n * @returns TanStack Query 用のオプションオブジェクト\n */\nexport function findOneQueryOptions<T = unknown>(\n adapter: DataAccessAdapter,\n collection: string,\n id: string,\n adapterOptions?: QueryOptions,\n) {\n return tanstackQueryOptions({\n queryKey: [collection, 'detail', id, adapterOptions, getAdapterCacheScope(adapter)],\n queryFn: ({ signal }) => adapter.findOne<T>(collection, id, { ...adapterOptions, signal }),\n enabled: !!id,\n });\n}\n\n/**\n * useAggregate および ensureQueryData 用の QueryOptions を生成します。\n *\n * @param adapter - DataAccessAdapter インスタンス\n * @param collection - コレクション名\n * @param pipeline - Aggregation Pipeline\n * @param options - クエリオプション\n * @returns TanStack Query 用のオプションオブジェクト\n */\nexport function aggregateQueryOptions<T = unknown>(\n adapter: DataAccessAdapter,\n collection: string,\n pipeline: unknown[],\n options?: QueryOptions,\n) {\n return tanstackQueryOptions({\n queryKey: [collection, 'aggregate', pipeline, options, getAdapterCacheScope(adapter)],\n queryFn: ({ signal }) => {\n if (adapter.aggregate) {\n return adapter.aggregate<T>(collection, pipeline, { ...options, signal });\n }\n throw new Error('Adapter does not support aggregate');\n },\n });\n}\n\n// --- Hooks ---\n\n/**\n * コレクションから複数のレコードを取得し、React Query による自動キャッシュを行います。\n *\n * @param collection - コレクション/テーブル名\n * @param filter - フィルタ条件 ($eq, $in, $gte など)\n * @param adapterOptions - ソート、取得制限、Populate などのオプション\n * @param queryOptions - React Query (useQuery) のオプション (enabled, staleTime など)\n * @returns useQuery の結果オブジェクト (data, isLoading, error等)\n *\n * @example\n * ```tsx\n * const { data: users, isLoading } = useFind<User>('users', { role: 'admin' }, { sort: { name: 1 }, limit: 50 });\n * ```\n */\nexport function useFind<T = unknown>(\n collection: string,\n filter?: Filter,\n adapterOptions?: QueryOptions,\n queryOptions?: Omit<UseQueryOptions<T[], Error>, 'queryKey' | 'queryFn'>,\n) {\n const adapter = useDataAccess();\n const options = findQueryOptions<T>(adapter, collection, filter, adapterOptions);\n return useQuery({\n ...options,\n ...queryOptions,\n } as UseQueryOptions<T[], Error>);\n}\n\n/**\n * ID指定で単一のデータを取得します。\n *\n * @param collection - 取得対象のコレクション/テーブル名\n * @param id - ドキュメント/レコードのID\n * @param adapterOptions - Populate などのクエリオプション\n * @param queryOptions - React Query (useQuery) のオプション\n * @returns useQuery の結果オブジェクト (data, isLoading, error等)\n */\nexport function useFindOne<T = unknown>(\n collection: string,\n id: string,\n adapterOptions?: QueryOptions,\n queryOptions?: Omit<UseQueryOptions<T | null, Error>, 'queryKey' | 'queryFn'>,\n) {\n const adapter = useDataAccess();\n const options = findOneQueryOptions<T>(adapter, collection, id, adapterOptions);\n return useQuery({\n ...options,\n ...queryOptions,\n } as UseQueryOptions<T | null, Error>);\n}\n\n/**\n * 新規データを作成するためのフックです。\n * 成功時にキャッシュの無効化(Invalidation)を自動的に行います。\n *\n * @param collection - 対象のコレクション/テーブル名\n * @param options.onSuccess - 成功時のコールバック\n * @param options.invalidateKeys - 無効化するクエリキー(デフォルトは `[[collection]]`)\n * @returns useMutation の結果オブジェクト (mutate, isLoading等)\n */\nexport function useCreate<\n T = unknown,\n TVariables = { data: Record<string, unknown>; options?: QueryOptions },\n>(\n collection: string,\n options?: {\n onSuccess?: (data: T, variables: TVariables) => void;\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T, Error, TVariables>(\n (variables) => {\n const vars = variables as { data: Record<string, unknown>; options?: QueryOptions };\n return adapter.create<T>(collection, vars.data, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n invalidateKeys: options?.invalidateKeys || [[collection]],\n },\n );\n}\n\n/**\n * データを更新するためのフックです。\n * 成功時にリストと詳細のキャッシュを自動的に無効化します。\n *\n * @param collection - 対象のコレクション/テーブル名\n * @param options.onSuccess - 成功時のコールバック\n * @param options.invalidateKeys - 無効化キー(デフォルトはリストと対象IDの詳細)\n * @returns useMutation の結果オブジェクト (mutate, isLoading等)\n */\nexport function useUpdate<\n T = unknown,\n TVariables = { id: string; data: Record<string, unknown>; options?: QueryOptions },\n>(\n collection: string,\n options?: {\n onSuccess?: (data: T, variables: TVariables) => void;\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T, Error, TVariables>(\n (variables) => {\n const vars = variables as {\n id: string;\n data: Record<string, unknown>;\n options?: QueryOptions;\n };\n return adapter.update<T>(collection, vars.id, vars.data, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n // リストと、特定の詳細アイテムの両方のキャッシュを無効化する\n invalidateKeys: (_data, variables) => {\n const vars = variables as { id: string };\n return (\n options?.invalidateKeys || [\n [collection, 'list'],\n [collection, 'detail', vars.id],\n ]\n );\n },\n },\n );\n}\n\n/**\n * データを削除するためのフックです。\n *\n * @param collection - 対象のコレクション/テーブル名\n * @param options.onSuccess - 成功時のコールバック\n * @param options.invalidateKeys - 無効化キー\n * @returns useMutation の結果オブジェクト (mutate, isLoading等)\n */\nexport function useDelete<T = unknown, TVariables = { id: string; options?: QueryOptions }>(\n collection: string,\n options?: {\n onSuccess?: (data: T, variables: TVariables) => void;\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T, Error, TVariables>(\n (variables) => {\n const vars = (typeof variables === 'string' ? { id: variables } : variables) as {\n id: string;\n options?: QueryOptions;\n };\n return adapter.delete<T>(collection, vars.id, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n invalidateKeys: options?.invalidateKeys || [[collection]],\n },\n );\n}\n\n/**\n * 複数のデータを一括作成するためのフックです。\n *\n * @param collection - 対象のコレクション/テーブル名\n * @param options.onSuccess - 成功時のコールバック\n * @param options.invalidateKeys - 無効化キー(デフォルトは `[[collection]]`)\n * @returns useMutation の結果オブジェクト (mutate, isLoading等)\n */\nexport function useCreateMany<\n T = unknown,\n TVariables = { data: Record<string, unknown>[]; options?: QueryOptions },\n>(\n collection: string,\n options?: {\n onSuccess?: (data: T[], variables: TVariables) => void;\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T[], Error, TVariables>(\n (variables) => {\n const vars = variables as { data: Record<string, unknown>[]; options?: QueryOptions };\n if (!adapter.createMany) throw new Error('Adapter does not support createMany');\n return adapter.createMany<T>(collection, vars.data, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n invalidateKeys: options?.invalidateKeys || [[collection]],\n },\n );\n}\n\n/**\n * 条件に一致する複数のデータを一括更新するためのフックです。\n *\n * @param collection - 対象のコレクション/テーブル名\n * @param options.onSuccess - 成功時のコールバック\n * @param options.invalidateKeys - 無効化キー(デフォルトは `[[collection]]`)\n * @returns useMutation の結果オブジェクト (mutate, isLoading等)\n */\nexport function useUpdateMany<\n T = unknown,\n TVariables = { filter: Filter; data: Record<string, unknown>; options?: QueryOptions },\n>(\n collection: string,\n options?: {\n onSuccess?: (data: T[], variables: TVariables) => void;\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T[], Error, TVariables>(\n (variables) => {\n const vars = variables as {\n filter: Filter;\n data: Record<string, unknown>;\n options?: QueryOptions;\n };\n if (!adapter.updateMany) throw new Error('Adapter does not support updateMany');\n return adapter.updateMany<T>(collection, vars.filter, vars.data, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n invalidateKeys: options?.invalidateKeys || [[collection], [collection, 'list']],\n },\n );\n}\n\n/**\n * 条件に一致する複数のデータを一括削除するためのフックです。\n *\n * @param collection - 対象のコレクション/テーブル名\n * @param options.onSuccess - 成功時のコールバック\n * @param options.invalidateKeys - 無効化キー(デフォルトは `[[collection]]`)\n * @returns useMutation の結果オブジェクト (mutate, isLoading等)\n */\nexport function useDeleteMany<T = unknown, TVariables = { filter: Filter; options?: QueryOptions }>(\n collection: string,\n options?: {\n onSuccess?: (data: T[], variables: TVariables) => void;\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T[], Error, TVariables>(\n (variables) => {\n const vars = variables as { filter: Filter; options?: QueryOptions };\n if (!adapter.deleteMany) throw new Error('Adapter does not support deleteMany');\n return adapter.deleteMany<T>(collection, vars.filter, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n invalidateKeys: options?.invalidateKeys || [[collection]],\n },\n );\n}\n\n/**\n * Aggregation Pipelineを実行するためのフックです。\n *\n * @param collection - 対象のコレクション/テーブル名\n * @param pipeline - Aggregation Pipeline\n * @param options - クエリオプション\n * @param queryOptions - React Query (useQuery) のオプション\n * @returns useQuery の結果オブジェクト (data, isLoading, error等)\n */\nexport function useAggregate<T = unknown>(\n collection: string,\n pipeline: unknown[],\n options?: QueryOptions,\n queryOptions?: Omit<UseQueryOptions<T[], Error>, 'queryKey' | 'queryFn'>,\n) {\n const adapter = useDataAccess();\n const aggOptions = aggregateQueryOptions<T>(adapter, collection, pipeline, options);\n return useQuery({\n ...aggOptions,\n ...queryOptions,\n } as UseQueryOptions<T[], Error>);\n}\n"],"mappings":";;;;;AAuBA,SAAgBC,IAAoB;CAClC,OAAO,IAAIC,EAAY,EACrB,gBAAgB,EACd,SAAS;EACP,WAAW;EACX,OAAO;EACP,sBAAsB;CACxB,EACF,EACF,CAAC;AACH;AAMA,SAAgBC,IAAgB;CAC9B,IAAMC,IAAcC,EAAe;CAEnC,QAAQ,MACCD,EAAY,kBAAkB,EAAE,UAAUE,EAAI,CAAC;AAE1D;AASA,SAAgBC,EAMd,GACA,GAGA;CACA,IAAMH,IAAcC,EAAe;CAEnC,OAAOG,EAAY;EACjB;EACA,GAAGC;EACH,WAAW,OAAO,GAAM,GAAW,MAAY;GAC7C,IAAIA,GAAS,gBAAgB;IAC3B,IAAMC,IACJ,OAAOD,EAAQ,kBAAmB,aAC9BA,EAAQ,eAAeE,GAAMC,CAAS,IACtCH,EAAQ;IAEd,MAAM,QAAQ,IAAIC,EAAK,KAAK,MAAQN,EAAY,kBAAkB,EAAE,UAAUE,EAAI,CAAC,CAAC,CAAC;GACvF;GAEA,GAAS,YAAYK,GAAMC,GAAWC,CAAO;EAC/C;CACF,CAAC;AACH;AAaA,SAAgBC,EACd,GACA,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,IAAMuB,IAAOlB;EAKb,IAAI,CAACQ,EAAQ,YAAY,MAAU,MAAM,qCAAqC;EAC9E,OAAOA,EAAQ,WAAcJ,GAAYc,EAAK,QAAQA,EAAK,MAAMA,EAAK,OAAO;CAC/E,GACA;EACE,WAAWrB,GAAS;EACpB,gBAAgBA,GAAS,kBAAkB,CAAC,CAACO,CAAU,GAAG,CAACA,GAAY,MAAM,CAAC;CAChF,CACF;AACF;AAUA,SAAgBmB,EACd,GACA,GAIA;CACA,IAAMf,IAAUM,EAAc;CAC9B,OAAOnB,GACJ,MAAc;EACb,IAAMuB,IAAOlB;EACb,IAAI,CAACQ,EAAQ,YAAY,MAAU,MAAM,qCAAqC;EAC9E,OAAOA,EAAQ,WAAcJ,GAAYc,EAAK,QAAQA,EAAK,OAAO;CACpE,GACA;EACE,WAAWrB,GAAS;EACpB,gBAAgBA,GAAS,kBAAkB,CAAC,CAACO,CAAU,CAAC;CAC1D,CACF;AACF;AAWA,SAAgBoB,EACd,GACA,GACA,GACA,GACA;CAEA,IAAMC,IAAad,EADHG,EAC4B,GAASV,GAAYQ,GAAUf,CAAO;CAClF,OAAOkB,EAAS;EACd,GAAGU;EACH,GAAGtB;CACL,CAAgC;AAClC"}
|
|
1
|
+
{"version":3,"file":"react-query.js","names":["tanstackQueryOptions","createQueryClient","QueryClient","useInvalidate","queryClient","useQueryClient","key","useMutationWithInvalidation","useMutation","options","keys","data","variables","context","findQueryOptions","queryOptions","collection","filter","adapterOptions","getAdapterCacheScope","adapter","findOneQueryOptions","id","aggregateQueryOptions","pipeline","useFind","useDataAccess","useQuery","useFindOne","useCreate","vars","useUpdate","useDelete","useCreateMany","useUpdateMany","useDeleteMany","useAggregate","aggOptions"],"sources":["../../../../src/tools/lib/data-access/react-query.tsx"],"sourcesContent":["import {\n useQuery,\n UseQueryOptions,\n QueryClient,\n useQueryClient,\n useMutation,\n UseMutationOptions,\n MutationFunction,\n queryOptions as tanstackQueryOptions,\n type QueryKey,\n} from '@tanstack/react-query';\nimport { DataAccessAdapter, Filter, QueryOptions } from './types';\nimport { useDataAccess } from './data-access-context';\nimport { getAdapterCacheScope } from './cache-scope';\n\nexport { useDataAccess } from './data-access-context';\n\n// --- Query Helpers (Merged from query.ts) ---\n\n/**\n * Creates a TanStack QueryClient with five-minute stale time, one retry and no focus refetch.\n * @returns New caller-owned client; share one stable client for one application/auth domain.\n * @remarks No requests begin on construction. Supply it to QueryClientProvider; callers\n * own clearing/disposal and SSR request isolation. No CSS is required.\n * @example\n * ```ts\n * import { createQueryClient } from '@alneas/appkit-react/tools/data-access/react';\n * const queryClient = createQueryClient();\n * queryClient.clear();\n * ```\n */\nexport function createQueryClient() {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 1000 * 60 * 5, // 5 minutes\n retry: 1,\n refetchOnWindowFocus: false,\n },\n },\n });\n}\n\n/**\n * Binds query invalidation to the nearest QueryClient.\n * @returns Function accepting a query key and resolving after TanStack prefix-matched invalidation/refetch work.\n * @throws Error outside QueryClientProvider.\n * @remarks The returned callback forwards invalidateQueries with queryKey only; it does\n * not establish authorization or choose a collection automatically. No CSS is required.\n * @example\n * ```tsx\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { createQueryClient, useInvalidate } from '@alneas/appkit-react/tools/data-access/react';\n * const client = createQueryClient();\n * function Refresh() { const invalidate = useInvalidate(); return <button onClick={() => { void invalidate(['tasks']); }}>Refresh</button>; }\n * export function Screen() { return <QueryClientProvider client={client}><Refresh /></QueryClientProvider>; }\n * ```\n */\nexport function useInvalidate() {\n const queryClient = useQueryClient();\n\n return (key: QueryKey) => {\n return queryClient.invalidateQueries({ queryKey: key });\n };\n}\n\n/**\n * Runs a TanStack mutation and invalidates only the explicitly configured query keys on success.\n * @typeParam TData - Resolved mutation result; defaults to unknown and may include undefined.\n * @typeParam TError - Mutation error exposed by TanStack Query; defaults to unknown.\n * @typeParam TVariables - Mutation input supplied to mutate/mutateAsync; defaults to void.\n * @typeParam TContext - Value returned by onMutate for later callbacks; defaults to unknown.\n * @param mutationFn - Host mutation function receiving variables and resolving TData; the host owns authorization and persistence.\n * @param options - TanStack mutation options plus invalidateKeys: a key array or synchronous factory\n * receiving the successful result and variables. Omitted invalidateKeys (or an empty array) invalidates nothing.\n * @returns The TanStack mutation result with status, data/error and mutate/mutateAsync controls.\n * @throws When rendered without a QueryClientProvider.\n * @remarks Requires an outer QueryClientProvider. Query keys use TanStack prefix matching.\n * On success, invalidations run concurrently and are awaited before options.onSuccess is called;\n * that callback's returned promise is not awaited by this wrapper. A key factory or invalidation\n * failure prevents that callback and propagates into mutation error handling. Mutation failures\n * are exposed through the mutation result and reject mutateAsync. This wrapper adds no retry,\n * rollback or default invalidation keys; useCreate/useUpdate supply their own defaults.\n * The normal TanStack options spread also permits options.mutationFn to override the first argument.\n * @example\n * ```tsx\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { createQueryClient, useMutationWithInvalidation } from '@alneas/appkit-react/tools/data-access/react';\n *\n * const queryClient = createQueryClient();\n * type SaveInput = { id: string; title: string };\n * type SaveResult = SaveInput | undefined;\n * function SaveButton({ save }: { save: (input: SaveInput) => Promise<SaveResult> }) {\n * const mutation = useMutationWithInvalidation(save, {\n * invalidateKeys: (_result, input) => [['tasks', 'detail', input.id]],\n * });\n * return <button onClick={() => mutation.mutate({ id: 'task-1', title: 'Review' })}>\n * {mutation.data?.title ?? 'Save task'}\n * </button>;\n * }\n * // Supply an authorized host implementation; this example does not fabricate persistence.\n * export function TaskEditor({ save }: { save: (input: SaveInput) => Promise<SaveResult> }) {\n * return <QueryClientProvider client={queryClient}><SaveButton save={save} /></QueryClientProvider>;\n * }\n * ```\n */\nexport function useMutationWithInvalidation<\n TData = unknown,\n TError = unknown,\n TVariables = void,\n TContext = unknown,\n>(\n mutationFn: MutationFunction<TData, TVariables>,\n options?: UseMutationOptions<TData, TError, TVariables, TContext> & {\n /** Optional explicit keys or result/variables key factory; omission invalidates nothing. */\n invalidateKeys?: QueryKey[] | ((data: TData, variables: TVariables) => QueryKey[]);\n },\n) {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn,\n ...options,\n onSuccess: async (data, variables, context) => {\n if (options?.invalidateKeys) {\n const keys =\n typeof options.invalidateKeys === 'function'\n ? options.invalidateKeys(data, variables)\n : options.invalidateKeys;\n\n await Promise.all(keys.map((key) => queryClient.invalidateQueries({ queryKey: key })));\n }\n // @ts-expect-error - Argument count mismatch between supported TanStack Query type versions\n options?.onSuccess?.(data, variables, context);\n },\n });\n}\n\n// --- Query Options Factories ---\n\n/**\n * Creates adapter-scoped TanStack options for listing records.\n * @typeParam T - Expected record/result shape; defaults to unknown and is not runtime validation.\n * @param adapter - Host adapter performing reads.\n * @param collection - Host collection/table name.\n * @param filter - Optional adapter-specific selection criteria.\n * @param adapterOptions - Optional sort/limit/populate/etc. forwarded with TanStack abort signal.\n * @returns Query key and queryFn options accepted by useQuery or QueryClient methods.\n * @remarks Key includes collection, operation, input options and adapter cache scope. No\n * request is made until queryFn executes. Query errors reject through TanStack; aggregate\n * queryFn rejects if the adapter lacks aggregate. Abort signal support is adapter-owned.\n * @example\n * ```ts\n * import type { ComponentProps } from 'react';\n * import { DataAccessProvider, findQueryOptions } from '@alneas/appkit-react/tools/data-access/react';\n * type DataAccessAdapter = ComponentProps<typeof DataAccessProvider>['adapter'];\n * export function optionsFor(adapter: DataAccessAdapter) { return findQueryOptions<{ id: string }>(adapter, 'tasks', {}, { limit: 20 }); }\n * ```\n */\nexport function findQueryOptions<T = unknown>(\n adapter: DataAccessAdapter,\n collection: string,\n filter?: Filter,\n adapterOptions?: QueryOptions,\n) {\n return tanstackQueryOptions({\n queryKey: [collection, 'list', filter, adapterOptions, getAdapterCacheScope(adapter)],\n queryFn: ({ signal }) => adapter.find<T>(collection, filter, { ...adapterOptions, signal }),\n });\n}\n\n/**\n * Creates adapter-scoped TanStack options for reading one record by ID.\n * @typeParam T - Expected record/result shape; defaults to unknown and is not runtime validation.\n * @param adapter - Host adapter performing reads.\n * @param collection - Host collection/table name.\n * @param id - Record identifier; a falsy ID disables the ordinary useQuery execution.\n * @param adapterOptions - Optional adapter query settings forwarded with TanStack abort signal.\n * @returns Query key and queryFn options accepted by useQuery or QueryClient methods.\n * @remarks Key includes collection, operation, input options and adapter cache scope. No\n * request is made until queryFn executes. Query errors reject through TanStack; aggregate\n * queryFn rejects if the adapter lacks aggregate. Abort signal support is adapter-owned.\n * @example\n * ```ts\n * import type { ComponentProps } from 'react';\n * import { DataAccessProvider, findOneQueryOptions } from '@alneas/appkit-react/tools/data-access/react';\n * type DataAccessAdapter = ComponentProps<typeof DataAccessProvider>['adapter'];\n * export function optionsFor(adapter: DataAccessAdapter) { return findOneQueryOptions<{ id: string }>(adapter, 'tasks', 'task-1'); }\n * ```\n */\nexport function findOneQueryOptions<T = unknown>(\n adapter: DataAccessAdapter,\n collection: string,\n id: string,\n adapterOptions?: QueryOptions,\n) {\n return tanstackQueryOptions({\n queryKey: [collection, 'detail', id, adapterOptions, getAdapterCacheScope(adapter)],\n queryFn: ({ signal }) => adapter.findOne<T>(collection, id, { ...adapterOptions, signal }),\n enabled: !!id,\n });\n}\n\n/**\n * Creates adapter-scoped TanStack options for an aggregation pipeline.\n * @typeParam T - Expected record/result shape; defaults to unknown and is not runtime validation.\n * @param adapter - Host adapter performing reads.\n * @param collection - Host collection/table name.\n * @param pipeline - Adapter-specific aggregation stages.\n * @param options - Optional adapter settings forwarded with TanStack abort signal.\n * @returns Query key and queryFn options accepted by useQuery or QueryClient methods.\n * @remarks Key includes collection, operation, input options and adapter cache scope. No\n * request is made until queryFn executes. Query errors reject through TanStack; aggregate\n * queryFn rejects if the adapter lacks aggregate. Abort signal support is adapter-owned.\n * @example\n * ```ts\n * import type { ComponentProps } from 'react';\n * import { DataAccessProvider, aggregateQueryOptions } from '@alneas/appkit-react/tools/data-access/react';\n * type DataAccessAdapter = ComponentProps<typeof DataAccessProvider>['adapter'];\n * export function optionsFor(adapter: DataAccessAdapter) { return aggregateQueryOptions<{ count: number }>(adapter, 'tasks', []); }\n * ```\n */\nexport function aggregateQueryOptions<T = unknown>(\n adapter: DataAccessAdapter,\n collection: string,\n pipeline: unknown[],\n options?: QueryOptions,\n) {\n return tanstackQueryOptions({\n queryKey: [collection, 'aggregate', pipeline, options, getAdapterCacheScope(adapter)],\n queryFn: ({ signal }) => {\n if (adapter.aggregate) {\n return adapter.aggregate<T>(collection, pipeline, { ...options, signal });\n }\n throw new Error('Adapter does not support aggregate');\n },\n });\n}\n\n// --- Hooks ---\n\n/**\n * Queries a collection list through the current adapter.\n * @typeParam T - Expected result record shape, default unknown; not runtime validation.\n * @param collection - Host collection/table name.\n * @param filter - Optional adapter filter.\n * @param adapterOptions - Optional sorting/limit/populate settings.\n * @param queryOptions - TanStack query overrides; omitted values use the generated options.\n * @returns TanStack query result with data/status/error and refetch controls.\n * @throws Error without DataAccessProvider or QueryClientProvider.\n * @remarks No CSS required. Adapter failures appear in query state; keys include adapter\n * scope and input options. Query signals are forwarded, but cancellation depends on the\n * adapter. The host owns backend authorization.\n * @example\n * ```tsx\n * import type { ComponentProps } from 'react';\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { DataAccessProvider, createQueryClient, useFind } from '@alneas/appkit-react/tools/data-access/react';\n * type DataAccessAdapter = ComponentProps<typeof DataAccessProvider>['adapter'];\n * const client = createQueryClient();\n * function Content() { const query = useFind<{ id: string }>('tasks', {}, { limit: 20 }); return <output>{query.isPending ? 'Loading' : query.error ? 'Failed' : 'Ready'}</output>; }\n * export function DataScreen({ adapter }: { adapter: DataAccessAdapter }) { return <QueryClientProvider client={client}><DataAccessProvider adapter={adapter}><Content /></DataAccessProvider></QueryClientProvider>; }\n * ```\n */\nexport function useFind<T = unknown>(\n collection: string,\n filter?: Filter,\n adapterOptions?: QueryOptions,\n queryOptions?: Omit<UseQueryOptions<T[], Error>, 'queryKey' | 'queryFn'>,\n) {\n const adapter = useDataAccess();\n const options = findQueryOptions<T>(adapter, collection, filter, adapterOptions);\n return useQuery({\n ...options,\n ...queryOptions,\n } as UseQueryOptions<T[], Error>);\n}\n\n/**\n * Queries one record through the current adapter.\n * @typeParam T - Expected result record shape, default unknown; not runtime validation.\n * @param collection - Host collection/table name.\n * @param id - Record ID; empty ID disables the default query.\n * @param adapterOptions - Optional adapter read settings.\n * @param queryOptions - TanStack query overrides; omitted values use the generated options.\n * @returns TanStack query result with data/status/error and refetch controls. Data resolves to a record or null when absent.\n * @throws Error without DataAccessProvider or QueryClientProvider.\n * @remarks No CSS required. Adapter failures appear in query state; keys include adapter\n * scope and input options. Query signals are forwarded, but cancellation depends on the\n * adapter. The host owns backend authorization.\n * @example\n * ```tsx\n * import type { ComponentProps } from 'react';\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { DataAccessProvider, createQueryClient, useFindOne } from '@alneas/appkit-react/tools/data-access/react';\n * type DataAccessAdapter = ComponentProps<typeof DataAccessProvider>['adapter'];\n * const client = createQueryClient();\n * function Content() { const query = useFindOne<{ id: string }>('tasks', 'task-1'); return <output>{query.isPending ? 'Loading' : query.error ? 'Failed' : 'Ready'}</output>; }\n * export function DataScreen({ adapter }: { adapter: DataAccessAdapter }) { return <QueryClientProvider client={client}><DataAccessProvider adapter={adapter}><Content /></DataAccessProvider></QueryClientProvider>; }\n * ```\n */\nexport function useFindOne<T = unknown>(\n collection: string,\n id: string,\n adapterOptions?: QueryOptions,\n queryOptions?: Omit<UseQueryOptions<T | null, Error>, 'queryKey' | 'queryFn'>,\n) {\n const adapter = useDataAccess();\n const options = findOneQueryOptions<T>(adapter, collection, id, adapterOptions);\n return useQuery({\n ...options,\n ...queryOptions,\n } as UseQueryOptions<T | null, Error>);\n}\n\n/**\n * Creates one record through the current data-access adapter and invalidates collection queries.\n * @typeParam T - Created record result returned by the adapter; defaults to unknown.\n * @typeParam TVariables - Mutation variables; must contain data and optional adapter options at runtime.\n * @param collection - Adapter collection/table name.\n * @param options - Optional onSuccess callback receiving the created result and variables, plus replacement\n * invalidation keys. Omitted invalidateKeys defaults to [[collection]]; [] disables invalidation.\n * @returns A mutation result whose mutate/mutateAsync accepts { data, options? } by default.\n * @throws When rendered without the required query or data-access provider.\n * @remarks Requires QueryClientProvider and DataAccessProvider with a real host adapter.\n * The adapter owns persistence, authorization and error semantics. Defaults are supplied by this\n * helper, not useMutationWithInvalidation. Callback promises are not awaited by that wrapper.\n * @example\n * ```tsx\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { DataAccessProvider, createQueryClient, useCreate } from '@alneas/appkit-react/tools/data-access/react';\n * import type { ComponentProps } from 'react';\n * const client = createQueryClient();\n * function CreateTask() {\n * const create = useCreate<{ id: string; title: string }>('tasks');\n * return <button onClick={() => create.mutate({ data: { title: 'Review' } })}>Create</button>;\n * }\n * export function TaskCreator({ adapter }: Pick<ComponentProps<typeof DataAccessProvider>, 'adapter'>) {\n * return <QueryClientProvider client={client}><DataAccessProvider adapter={adapter}>\n * <CreateTask />\n * </DataAccessProvider></QueryClientProvider>;\n * }\n * ```\n */\nexport function useCreate<\n T = unknown,\n TVariables = { data: Record<string, unknown>; options?: QueryOptions },\n>(\n collection: string,\n options?: {\n /**\n * Callback after successful mutation and awaited invalidations.\n * @param data - Adapter result.\n * @param variables - Original mutation variables.\n * @returns No value; callback promise results are not awaited by the wrapper.\n */\n onSuccess?: (data: T, variables: TVariables) => void;\n /**\n * Optional replacement query keys using prefix matching; [] disables invalidation, omission uses this hook default.\n */\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T, Error, TVariables>(\n (variables) => {\n const vars = variables as { data: Record<string, unknown>; options?: QueryOptions };\n return adapter.create<T>(collection, vars.data, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n invalidateKeys: options?.invalidateKeys || [[collection]],\n },\n );\n}\n\n/**\n * Updates one record through the current adapter and invalidates list and matching detail queries.\n * @typeParam T - Updated record result returned by the adapter; defaults to unknown.\n * @typeParam TVariables - Mutation variables; must contain id, data and optional adapter options at runtime.\n * @param collection - Adapter collection/table name.\n * @param options - Optional onSuccess callback receiving the updated result and variables, plus replacement\n * invalidation keys. Omitted keys default to [[collection, 'list'], [collection, 'detail', variables.id]];\n * [] disables invalidation.\n * @returns A mutation result whose mutate/mutateAsync accepts { id, data, options? } by default.\n * @throws When rendered without the required query or data-access provider.\n * @remarks Requires QueryClientProvider and DataAccessProvider with a real host adapter.\n * The adapter determines update semantics, authorization, persistence and errors. Invalidation\n * defaults are supplied by this helper; the underlying wrapper has no automatic defaults.\n * @example\n * ```tsx\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { DataAccessProvider, createQueryClient, useUpdate } from '@alneas/appkit-react/tools/data-access/react';\n * import type { ComponentProps } from 'react';\n * const client = createQueryClient();\n * function UpdateTask() {\n * const update = useUpdate<{ id: string; title: string }>('tasks');\n * return <button onClick={() => update.mutate({ id: 'task-1', data: { title: 'Reviewed' } })}>Update</button>;\n * }\n * export function TaskUpdater({ adapter }: Pick<ComponentProps<typeof DataAccessProvider>, 'adapter'>) {\n * return <QueryClientProvider client={client}><DataAccessProvider adapter={adapter}>\n * <UpdateTask />\n * </DataAccessProvider></QueryClientProvider>;\n * }\n * ```\n */\nexport function useUpdate<\n T = unknown,\n TVariables = { id: string; data: Record<string, unknown>; options?: QueryOptions },\n>(\n collection: string,\n options?: {\n /**\n * Callback after successful mutation and awaited invalidations.\n * @param data - Adapter result.\n * @param variables - Original mutation variables.\n * @returns No value; callback promise results are not awaited by the wrapper.\n */\n onSuccess?: (data: T, variables: TVariables) => void;\n /**\n * Optional replacement query keys using prefix matching; [] disables invalidation, omission uses this hook default.\n */\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T, Error, TVariables>(\n (variables) => {\n const vars = variables as {\n id: string;\n data: Record<string, unknown>;\n options?: QueryOptions;\n };\n return adapter.update<T>(collection, vars.id, vars.data, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n // リストと、特定の詳細アイテムの両方のキャッシュを無効化する\n invalidateKeys: (_data, variables) => {\n const vars = variables as { id: string };\n return (\n options?.invalidateKeys || [\n [collection, 'list'],\n [collection, 'detail', vars.id],\n ]\n );\n },\n },\n );\n}\n\n/**\n * Deletes one record through the current adapter.\n * @typeParam T - Adapter result record shape, defaults to unknown.\n * @typeParam TVariables - Mutation variables; must provide id and optional adapter options.\n * @param collection - Host collection/table name.\n * @param options - Optional successful-result callback and replacement invalidation keys.\n * @returns TanStack mutation result with explicit mutate/mutateAsync controls.\n * @throws Error without required providers; adapter failures reject mutateAsync and populate mutation error state.\n * @remarks Requires DataAccessProvider inside QueryClientProvider; no CSS. Omitted\n * invalidation keys default to [[collection]]; [] disables invalidation. Callback promise\n * results are not awaited by the underlying wrapper. Persistence, atomicity and\n * authorization are host-owned; no rollback is supplied.\n * @example\n * ```tsx\n * import type { ComponentProps } from 'react';\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { DataAccessProvider, createQueryClient, useDelete } from '@alneas/appkit-react/tools/data-access/react';\n * type DataAccessAdapter = ComponentProps<typeof DataAccessProvider>['adapter'];\n * const client = createQueryClient();\n * function Action() { const mutation = useDelete('tasks'); return <button onClick={() => mutation.mutate({ id: 'task-1' })}>Run host mutation</button>; }\n * export function DataScreen({ adapter }: { adapter: DataAccessAdapter }) { return <QueryClientProvider client={client}><DataAccessProvider adapter={adapter}><Action /></DataAccessProvider></QueryClientProvider>; }\n * ```\n */\nexport function useDelete<T = unknown, TVariables = { id: string; options?: QueryOptions }>(\n collection: string,\n options?: {\n /**\n * Callback after successful mutation and awaited invalidations.\n * @param data - Adapter result.\n * @param variables - Original mutation variables.\n * @returns No value; callback promise results are not awaited by the wrapper.\n */\n onSuccess?: (data: T, variables: TVariables) => void;\n /**\n * Optional replacement query keys using prefix matching; [] disables invalidation, omission uses this hook default.\n */\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T, Error, TVariables>(\n (variables) => {\n const vars = (typeof variables === 'string' ? { id: variables } : variables) as {\n id: string;\n options?: QueryOptions;\n };\n return adapter.delete<T>(collection, vars.id, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n invalidateKeys: options?.invalidateKeys || [[collection]],\n },\n );\n}\n\n/**\n * Creates multiple records through the current adapter.\n * @typeParam T - Adapter result record shape, defaults to unknown.\n * @typeParam TVariables - Mutation variables; must provide data array and optional adapter options.\n * @param collection - Host collection/table name.\n * @param options - Optional successful-result callback and replacement invalidation keys.\n * @returns TanStack mutation result with explicit mutate/mutateAsync controls.\n * @throws Error without required providers; mutation rejects if adapter lacks createMany or fails.\n * @remarks Requires DataAccessProvider inside QueryClientProvider; no CSS. Omitted\n * invalidation keys default to [[collection]]; [] disables invalidation. Callback promise\n * results are not awaited by the underlying wrapper. Persistence, atomicity and\n * authorization are host-owned; no rollback is supplied.\n * @example\n * ```tsx\n * import type { ComponentProps } from 'react';\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { DataAccessProvider, createQueryClient, useCreateMany } from '@alneas/appkit-react/tools/data-access/react';\n * type DataAccessAdapter = ComponentProps<typeof DataAccessProvider>['adapter'];\n * const client = createQueryClient();\n * function Action() { const mutation = useCreateMany('tasks'); return <button onClick={() => mutation.mutate({ data: [{ title: 'Review' }] })}>Run host mutation</button>; }\n * export function DataScreen({ adapter }: { adapter: DataAccessAdapter }) { return <QueryClientProvider client={client}><DataAccessProvider adapter={adapter}><Action /></DataAccessProvider></QueryClientProvider>; }\n * ```\n */\nexport function useCreateMany<\n T = unknown,\n TVariables = { data: Record<string, unknown>[]; options?: QueryOptions },\n>(\n collection: string,\n options?: {\n /**\n * Callback after successful mutation and awaited invalidations.\n * @param data - Adapter result.\n * @param variables - Original mutation variables.\n * @returns No value; callback promise results are not awaited by the wrapper.\n */\n onSuccess?: (data: T[], variables: TVariables) => void;\n /**\n * Optional replacement query keys using prefix matching; [] disables invalidation, omission uses this hook default.\n */\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T[], Error, TVariables>(\n (variables) => {\n const vars = variables as { data: Record<string, unknown>[]; options?: QueryOptions };\n if (!adapter.createMany) throw new Error('Adapter does not support createMany');\n return adapter.createMany<T>(collection, vars.data, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n invalidateKeys: options?.invalidateKeys || [[collection]],\n },\n );\n}\n\n/**\n * Updates records matching an adapter filter.\n * @typeParam T - Adapter result record shape, defaults to unknown.\n * @typeParam TVariables - Mutation variables; must provide filter, data and optional adapter options.\n * @param collection - Host collection/table name.\n * @param options - Optional successful-result callback and replacement invalidation keys.\n * @returns TanStack mutation result with explicit mutate/mutateAsync controls.\n * @throws Error without required providers; mutation rejects if adapter lacks updateMany or fails.\n * @remarks Requires DataAccessProvider inside QueryClientProvider; no CSS. Omitted\n * invalidation keys default to [[collection], [collection, 'list']]; [] disables invalidation. Callback promise\n * results are not awaited by the underlying wrapper. Persistence, atomicity and\n * authorization are host-owned; no rollback is supplied.\n * @example\n * ```tsx\n * import type { ComponentProps } from 'react';\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { DataAccessProvider, createQueryClient, useUpdateMany } from '@alneas/appkit-react/tools/data-access/react';\n * type DataAccessAdapter = ComponentProps<typeof DataAccessProvider>['adapter'];\n * const client = createQueryClient();\n * function Action() { const mutation = useUpdateMany('tasks'); return <button onClick={() => mutation.mutate({ filter: { state: 'draft' }, data: { state: 'reviewed' } })}>Run host mutation</button>; }\n * export function DataScreen({ adapter }: { adapter: DataAccessAdapter }) { return <QueryClientProvider client={client}><DataAccessProvider adapter={adapter}><Action /></DataAccessProvider></QueryClientProvider>; }\n * ```\n */\nexport function useUpdateMany<\n T = unknown,\n TVariables = { filter: Filter; data: Record<string, unknown>; options?: QueryOptions },\n>(\n collection: string,\n options?: {\n /**\n * Callback after successful mutation and awaited invalidations.\n * @param data - Adapter result.\n * @param variables - Original mutation variables.\n * @returns No value; callback promise results are not awaited by the wrapper.\n */\n onSuccess?: (data: T[], variables: TVariables) => void;\n /**\n * Optional replacement query keys using prefix matching; [] disables invalidation, omission uses this hook default.\n */\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T[], Error, TVariables>(\n (variables) => {\n const vars = variables as {\n filter: Filter;\n data: Record<string, unknown>;\n options?: QueryOptions;\n };\n if (!adapter.updateMany) throw new Error('Adapter does not support updateMany');\n return adapter.updateMany<T>(collection, vars.filter, vars.data, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n invalidateKeys: options?.invalidateKeys || [[collection], [collection, 'list']],\n },\n );\n}\n\n/**\n * Deletes records matching an adapter filter.\n * @typeParam T - Adapter result record shape, defaults to unknown.\n * @typeParam TVariables - Mutation variables; must provide filter and optional adapter options.\n * @param collection - Host collection/table name.\n * @param options - Optional successful-result callback and replacement invalidation keys.\n * @returns TanStack mutation result with explicit mutate/mutateAsync controls.\n * @throws Error without required providers; mutation rejects if adapter lacks deleteMany or fails.\n * @remarks Requires DataAccessProvider inside QueryClientProvider; no CSS. Omitted\n * invalidation keys default to [[collection]]; [] disables invalidation. Callback promise\n * results are not awaited by the underlying wrapper. Persistence, atomicity and\n * authorization are host-owned; no rollback is supplied.\n * @example\n * ```tsx\n * import type { ComponentProps } from 'react';\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { DataAccessProvider, createQueryClient, useDeleteMany } from '@alneas/appkit-react/tools/data-access/react';\n * type DataAccessAdapter = ComponentProps<typeof DataAccessProvider>['adapter'];\n * const client = createQueryClient();\n * function Action() { const mutation = useDeleteMany('tasks'); return <button onClick={() => mutation.mutate({ filter: { state: 'obsolete' } })}>Run host mutation</button>; }\n * export function DataScreen({ adapter }: { adapter: DataAccessAdapter }) { return <QueryClientProvider client={client}><DataAccessProvider adapter={adapter}><Action /></DataAccessProvider></QueryClientProvider>; }\n * ```\n */\nexport function useDeleteMany<T = unknown, TVariables = { filter: Filter; options?: QueryOptions }>(\n collection: string,\n options?: {\n /**\n * Callback after successful mutation and awaited invalidations.\n * @param data - Adapter result.\n * @param variables - Original mutation variables.\n * @returns No value; callback promise results are not awaited by the wrapper.\n */\n onSuccess?: (data: T[], variables: TVariables) => void;\n /**\n * Optional replacement query keys using prefix matching; [] disables invalidation, omission uses this hook default.\n */\n invalidateKeys?: unknown[][];\n },\n) {\n const adapter = useDataAccess();\n return useMutationWithInvalidation<T[], Error, TVariables>(\n (variables) => {\n const vars = variables as { filter: Filter; options?: QueryOptions };\n if (!adapter.deleteMany) throw new Error('Adapter does not support deleteMany');\n return adapter.deleteMany<T>(collection, vars.filter, vars.options);\n },\n {\n onSuccess: options?.onSuccess,\n invalidateKeys: options?.invalidateKeys || [[collection]],\n },\n );\n}\n\n/**\n * Queries an aggregation pipeline through the current adapter.\n * @typeParam T - Expected result record shape, default unknown; not runtime validation.\n * @param collection - Host collection/table name.\n * @param pipeline - Adapter-specific aggregation stages.\n * @param options - Optional adapter query settings.\n * @param queryOptions - TanStack query overrides; omitted values use the generated options.\n * @returns TanStack query result with data/status/error and refetch controls. Missing aggregate capability becomes a query error.\n * @throws Error without DataAccessProvider or QueryClientProvider.\n * @remarks No CSS required. Adapter failures appear in query state; keys include adapter\n * scope and input options. Query signals are forwarded, but cancellation depends on the\n * adapter. The host owns backend authorization.\n * @example\n * ```tsx\n * import type { ComponentProps } from 'react';\n * import { QueryClientProvider } from '@tanstack/react-query';\n * import { DataAccessProvider, createQueryClient, useAggregate } from '@alneas/appkit-react/tools/data-access/react';\n * type DataAccessAdapter = ComponentProps<typeof DataAccessProvider>['adapter'];\n * const client = createQueryClient();\n * function Content() { const query = useAggregate<{ count: number }>('tasks', []); return <output>{query.isPending ? 'Loading' : query.error ? 'Failed' : 'Ready'}</output>; }\n * export function DataScreen({ adapter }: { adapter: DataAccessAdapter }) { return <QueryClientProvider client={client}><DataAccessProvider adapter={adapter}><Content /></DataAccessProvider></QueryClientProvider>; }\n * ```\n */\nexport function useAggregate<T = unknown>(\n collection: string,\n pipeline: unknown[],\n options?: QueryOptions,\n queryOptions?: Omit<UseQueryOptions<T[], Error>, 'queryKey' | 'queryFn'>,\n) {\n const adapter = useDataAccess();\n const aggOptions = aggregateQueryOptions<T>(adapter, collection, pipeline, options);\n return useQuery({\n ...aggOptions,\n ...queryOptions,\n } as UseQueryOptions<T[], Error>);\n}\n"],"mappings":";;;;;AA+BA,SAAgBC,IAAoB;CAClC,OAAO,IAAIC,EAAY,EACrB,gBAAgB,EACd,SAAS;EACP,WAAW;EACX,OAAO;EACP,sBAAsB;CACxB,EACF,EACF,CAAC;AACH;AAiBA,SAAgBC,IAAgB;CAC9B,IAAMC,IAAcC,EAAe;CAEnC,QAAQ,MACCD,EAAY,kBAAkB,EAAE,UAAUE,EAAI,CAAC;AAE1D;AA0CA,SAAgBC,EAMd,GACA,GAIA;CACA,IAAMH,IAAcC,EAAe;CAEnC,OAAOG,EAAY;EACjB;EACA,GAAGC;EACH,WAAW,OAAO,GAAM,GAAW,MAAY;GAC7C,IAAIA,GAAS,gBAAgB;IAC3B,IAAMC,IACJ,OAAOD,EAAQ,kBAAmB,aAC9BA,EAAQ,eAAeE,GAAMC,CAAS,IACtCH,EAAQ;IAEd,MAAM,QAAQ,IAAIC,EAAK,KAAK,MAAQN,EAAY,kBAAkB,EAAE,UAAUE,EAAI,CAAC,CAAC,CAAC;GACvF;GAEA,GAAS,YAAYK,GAAMC,GAAWC,CAAO;EAC/C;CACF,CAAC;AACH;AAuBA,SAAgBC,EACd,GACA,GACA,GACA,GACA;CACA,OAAOd,EAAqB;EAC1B,UAAU;GAACgB;GAAY;GAAQC;GAAQC;GAAgBC,EAAqBC,CAAO;EAAC;EACpF,UAAU,EAAE,gBAAaA,EAAQ,KAAQJ,GAAYC,GAAQ;GAAE,GAAGC;GAAgB;EAAO,CAAC;CAC5F,CAAC;AACH;AAqBA,SAAgBG,EACd,GACA,GACA,GACA,GACA;CACA,OAAOrB,EAAqB;EAC1B,UAAU;GAACgB;GAAY;GAAUM;GAAIJ;GAAgBC,EAAqBC,CAAO;EAAC;EAClF,UAAU,EAA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J,MAAc;EACb,IAAMuB,IAAOlB;EACb,IAAI,CAACQ,EAAQ,YAAY,MAAU,MAAM,qCAAqC;EAC9E,OAAOA,EAAQ,WAAcJ,GAAYc,EAAK,QAAQA,EAAK,OAAO;CACpE,GACA;EACE,WAAWrB,GAAS;EACpB,gBAAgBA,GAAS,kBAAkB,CAAC,CAACO,CAAU,CAAC;CAC1D,CACF;AACF;AAyBA,SAAgBoB,EACd,GACA,GACA,GACA,GACA;CAEA,IAAMC,IAAad,EADHG,EAC4B,GAASV,GAAYQ,GAAUf,CAAO;CAClF,OAAOkB,EAAS;EACd,GAAGU;EACH,GAAGtB;CACL,CAAgC;AAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppError.cjs","names":["require_errors_auth_account_exists_with_different_credential","require_errors_auth_email_already_in_use","require_errors_auth_invalid_email","require_errors_auth_network_request_failed","require_errors_auth_operation_not_allowed","require_errors_auth_requires_recent_login","require_errors_auth_too_many_requests","require_errors_auth_user_disabled","require_errors_auth_user_not_found","require_errors_auth_weak_password","require_errors_auth_wrong_password","require_errors_supabase_email_not_confirmed","require_errors_supabase_invalid_credentials","AppError","message","code","options","error","defaultDisplayMode","errorRecord","msg","TimeoutError","NetworkError","UnauthorizedError","NotFoundError","ValidationError"],"sources":["../../../../src/tools/lib/error/AppError.ts"],"sourcesContent":["import * as m from '../../paraglide/messages';\n\n/**\n * エラー表示モード\n * - inline: フォーム内のフィールド近くに表示\n * - notification: 画面上部のバナー通知\n * - dialog: モーダルダイアログ\n * - page: 全画面エラーページ\n */\nexport type ErrorDisplayMode = 'inline' | 'notification' | 'dialog' | 'page';\n\n/**\n * エラーの重要度\n */\nexport type ErrorSeverity = 'info' | 'warning' | 'error' | 'critical';\n\n/**\n * AppError: アプリケーション全体で使用するエラークラス\n *\n * @example\n * ```typescript\n * // 基本的な使用法\n * throw new AppError('auth/user-not-found', 'User not found');\n *\n * // 表示モード指定\n * throw new AppError('network/timeout', 'Request timed out', {\n * displayMode: 'notification',\n * severity: 'warning'\n * });\n *\n * // メタデータ付き\n * throw new AppError('validation/invalid-field', 'Invalid input', {\n * displayMode: 'inline',\n * metadata: { field: 'email' }\n * });\n * ```\n */\nexport class AppError extends Error {\n /** エラーコード。i18n のキーとしても使用 (例: 'auth/user-not-found') */\n readonly code: string;\n\n /** 推奨される表示モード */\n readonly displayMode: ErrorDisplayMode;\n\n /** エラーの重要度 */\n readonly severity: ErrorSeverity;\n\n /** 追加のメタデータ (フィールド名、HTTP ステータスなど) */\n readonly metadata?: Record<string, unknown>;\n\n /** 元のエラー (ラップする場合) */\n readonly originalError?: Error;\n\n /**\n * AppError の新しいインスタンスを生成します。\n * @param code エラーコード\n * @param message エラーメッセージ\n * @param options 追加オプション\n */\n constructor(\n code: string,\n message: string,\n options?: {\n displayMode?: ErrorDisplayMode;\n severity?: ErrorSeverity;\n metadata?: Record<string, unknown>;\n originalError?: Error;\n },\n ) {\n super(message);\n this.name = 'AppError';\n this.code = code;\n this.displayMode = options?.displayMode ?? 'notification';\n this.severity = options?.severity ?? 'error';\n this.metadata = options?.metadata;\n this.originalError = options?.originalError;\n\n // Error の prototype chain を正しく設定\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n /**\n * 任意のエラーを AppError に変換します。\n * Firebase, Supabase 等のエラーを自動的にコードマッピングします。\n */\n static from(error: unknown, defaultDisplayMode: ErrorDisplayMode = 'notification'): AppError {\n if (error instanceof AppError) {\n return error;\n }\n\n if (error instanceof Error) {\n // Firebase Auth Error\n if ('code' in error && typeof (error as { code: unknown }).code === 'string') {\n const code = (error as { code: string }).code;\n let message = error.message;\n\n switch (code) {\n case 'auth/invalid-email':\n message = m.errors_auth_invalid_email();\n break;\n case 'auth/wrong-password':\n message = m.errors_auth_wrong_password();\n break;\n case 'auth/user-not-found':\n message = m.errors_auth_user_not_found();\n break;\n case 'auth/user-disabled':\n message = m.errors_auth_user_disabled();\n break;\n case 'auth/too-many-requests':\n message = m.errors_auth_too_many_requests();\n break;\n case 'auth/operation-not-allowed':\n message = m.errors_auth_operation_not_allowed();\n break;\n case 'auth/email-already-in-use':\n message = m.errors_auth_email_already_in_use();\n break;\n case 'auth/requires-recent-login':\n message = m.errors_auth_requires_recent_login();\n break;\n case 'auth/credential-already-in-use':\n message = m.errors_auth_account_exists_with_different_credential();\n break;\n case 'auth/weak-password':\n message = m.errors_auth_weak_password();\n break;\n case 'auth/network-request-failed':\n message = m.errors_auth_network_request_failed();\n break;\n }\n\n return new AppError(code, message, {\n displayMode: defaultDisplayMode,\n originalError: error,\n });\n }\n\n // Supabase/PostgreSQL Error\n // Supabase errors often have 'code' and 'message'.\n // We can also look for specific strings in the message if the code is generic.\n if ('code' in error || 'message' in error) {\n const errorRecord = error as { code?: unknown; message?: unknown };\n const msg = typeof errorRecord.message === 'string' ? errorRecord.message : '';\n\n // Supabase generic error message mapping\n if (msg.includes('Invalid login credentials')) {\n return new AppError(\n 'bg-auth/invalid-credentials',\n m.errors_supabase_invalid_credentials(),\n { displayMode: defaultDisplayMode, originalError: error },\n );\n }\n if (msg.includes('Email not confirmed')) {\n return new AppError(\n 'bg-auth/email-not-confirmed',\n m.errors_supabase_email_not_confirmed(),\n { displayMode: defaultDisplayMode, originalError: error },\n );\n }\n }\n\n // Generic Error\n return new AppError('error/unknown', error.message, {\n displayMode: defaultDisplayMode,\n originalError: error,\n });\n }\n\n // Unknown type\n return new AppError('error/unknown', String(error), {\n displayMode: defaultDisplayMode,\n });\n }\n\n /**\n * 文字列表現\n */\n toString(): string {\n return `[${this.code}] ${this.message}`;\n }\n\n /**\n * JSON シリアライズ用\n */\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n displayMode: this.displayMode,\n severity: this.severity,\n metadata: this.metadata,\n };\n }\n}\n\n/**\n * ネットワークタイムアウトエラー\n */\nexport class TimeoutError extends AppError {\n /**\n * TimeoutError の新しいインスタンスを生成します。\n * @param message エラーメッセージ\n * @param duration タイムアウトした時間(ミリ秒)\n */\n constructor(message = 'The operation timed out', duration?: number) {\n super('error/timeout', message, {\n displayMode: 'notification',\n severity: 'warning',\n metadata: { duration },\n });\n this.name = 'TimeoutError';\n }\n}\n\n/**\n * ネットワークエラー\n */\nexport class NetworkError extends AppError {\n /**\n * NetworkError の新しいインスタンスを生成します。\n * @param message エラーメッセージ\n */\n constructor(message = 'Network error occurred') {\n super('error/network', message, {\n displayMode: 'notification',\n severity: 'error',\n });\n this.name = 'NetworkError';\n }\n}\n\n/**\n * 認証不足エラー\n */\nexport class UnauthorizedError extends AppError {\n /**\n * UnauthorizedError の新しいインスタンスを生成します。\n * @param message エラーメッセージ\n */\n constructor(message = 'You are not authorized to perform this action') {\n super('error/unauthorized', message, {\n displayMode: 'dialog',\n severity: 'error',\n });\n this.name = 'UnauthorizedError';\n }\n}\n\n/**\n * リソースが見つからないエラー\n */\nexport class NotFoundError extends AppError {\n /**\n * NotFoundError の新しいインスタンスを生成します。\n * @param message エラーメッセージ\n * @param resource 見つからなかったリソース名\n */\n constructor(message = 'The requested resource was not found', resource?: string) {\n super('error/not-found', message, {\n displayMode: 'page',\n severity: 'error',\n metadata: { resource },\n });\n this.name = 'NotFoundError';\n }\n}\n\n/**\n * バリデーションエラー\n */\nexport class ValidationError extends AppError {\n /**\n * ValidationError の新しいインスタンスを生成します。\n * @param message エラーメッセージ\n * @param fields フィールドごとのエラーマッピング\n */\n constructor(message: string, fields?: Record<string, string>) {\n super('error/validation', message, {\n displayMode: 'inline',\n severity: 'warning',\n metadata: { fields },\n });\n this.name = 'ValidationError';\n }\n}\n"],"mappings":"A,+hCAqCA,IAAaa,EAAb,MAAaA,UAAiB,KAAM,CAElC,KAGA,YAGA,SAGA,SAGA,cAQA,YACE,EACA,EACA,EAMA,CACA,MAAMC,CAAO,EACb,KAAK,KAAO,WACZ,KAAK,KAAOC,EACZ,KAAK,YAAcC,GAAS,aAAe,eAC3C,KAAK,SAAWA,GAAS,UAAY,QACrC,KAAK,SAAWA,GAAS,SACzB,KA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js","names":["require_errors_auth_account_exists_with_different_credential","require_errors_auth_email_already_in_use","require_errors_auth_invalid_email","require_errors_auth_network_request_failed","require_errors_auth_operation_not_allowed","require_errors_auth_requires_recent_login","require_errors_auth_too_many_requests","require_errors_auth_user_disabled","require_errors_auth_user_not_found","require_errors_auth_weak_password","require_errors_auth_wrong_password","require_errors_supabase_email_not_confirmed","require_errors_supabase_invalid_credentials","AppError","message","code","options","error","defaultDisplayMode","errorRecord","msg","TimeoutError","NetworkError","UnauthorizedError","NotFoundError","ValidationError"],"sources":["../../../../src/tools/lib/error/AppError.ts"],"sourcesContent":["import * as m from '../../paraglide/messages';\n\n/**\n * Requested error presentation: inline field feedback, notification banner, modal dialog or full page.\n * @remarks This is metadata; a host renderer must display the error.\n * @see AppError for creation.\n */\nexport type ErrorDisplayMode = 'inline' | 'notification' | 'dialog' | 'page';\n\n/**\n * Presentation severity from informational through critical; does not change Error behavior.\n * @see AppError for creation.\n */\nexport type ErrorSeverity = 'info' | 'warning' | 'error' | 'critical';\n\n/**\n * Application Error carrying a code, display hint, severity and optional metadata/original error.\n * @remarks Presentation hints do not render UI or enforce authorization. Metadata is retained\n * by reference and included in toJSON; exclude secrets before displaying or serializing.\n * @example\n * ```ts\n * import { AppError } from '@alneas/appkit-react/tools/core';\n * const error = new AppError('validation/input', 'Review the input', { displayMode: 'inline', severity: 'warning' });\n * ```\n */\nexport class AppError extends Error {\n /**\n * Stable host error code, also usable for localized message lookup.\n */\n readonly code: string;\n\n /**\n * Recommended host display mode; defaults to notification.\n */\n readonly displayMode: ErrorDisplayMode;\n\n /**\n * Presentation severity; defaults to error.\n */\n readonly severity: ErrorSeverity;\n\n /**\n * Optional host metadata retained by reference and included in JSON serialization.\n */\n readonly metadata?: Record<string, unknown>;\n\n /**\n * Optional wrapped Error retained by reference; excluded from toJSON.\n */\n readonly originalError?: Error;\n\n /**\n * Creates an Error with explicit application code and presentation metadata.\n * @param code - Host error identifier; no format validation is applied.\n * @param message - Error message stored by the Error base class.\n * @param options - Optional displayMode/severity (defaults notification/error), metadata and wrapped Error.\n * @example\n * ```ts\n * import { AppError } from '@alneas/appkit-react/tools/core';\n * const error = new AppError('error/example', 'Operation failed');\n * ```\n */\n constructor(\n code: string,\n message: string,\n options?: {\n /**\n * Presentation hint, default notification.\n */\n displayMode?: ErrorDisplayMode;\n /**\n * Presentation severity, default error.\n */\n severity?: ErrorSeverity;\n /**\n * Optional host metadata included by toJSON.\n */\n metadata?: Record<string, unknown>;\n /**\n * Optional wrapped Error, excluded from toJSON.\n */\n originalError?: Error;\n },\n ) {\n super(message);\n this.name = 'AppError';\n this.code = code;\n this.displayMode = options?.displayMode ?? 'notification';\n this.severity = options?.severity ?? 'error';\n this.metadata = options?.metadata;\n this.originalError = options?.originalError;\n\n // Error の prototype chain を正しく設定\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n /**\n * Converts an unknown value to AppError, preserving an existing AppError unchanged.\n * @param error - Error or arbitrary thrown value to normalize.\n * @param defaultDisplayMode - Hint for newly created wrappers; defaults to notification.\n * @returns Existing AppError identity, or a new wrapper. Error instances with a string code\n * retain that code and map selected known auth messages; other Errors use message matching\n * or error/unknown. Non-Error values are stringified as error/unknown.\n * @remarks Plain objects with code/message are not interpreted as Error instances. The\n * default display hint does not override an existing AppError. No UI is rendered.\n * @example\n * ```ts\n * import { AppError } from '@alneas/appkit-react/tools/core';\n * const error = AppError.from(new Error('Unavailable'), 'dialog');\n * ```\n */\n static from(error: unknown, defaultDisplayMode: ErrorDisplayMode = 'notification'): AppError {\n if (error instanceof AppError) {\n return error;\n }\n\n if (error instanceof Error) {\n // Firebase Auth Error\n if ('code' in error && typeof (error as { code: unknown }).code === 'string') {\n const code = (error as { code: string }).code;\n let message = error.message;\n\n switch (code) {\n case 'auth/invalid-email':\n message = m.errors_auth_invalid_email();\n break;\n case 'auth/wrong-password':\n message = m.errors_auth_wrong_password();\n break;\n case 'auth/user-not-found':\n message = m.errors_auth_user_not_found();\n break;\n case 'auth/user-disabled':\n message = m.errors_auth_user_disabled();\n break;\n case 'auth/too-many-requests':\n message = m.errors_auth_too_many_requests();\n break;\n case 'auth/operation-not-allowed':\n message = m.errors_auth_operation_not_allowed();\n break;\n case 'auth/email-already-in-use':\n message = m.errors_auth_email_already_in_use();\n break;\n case 'auth/requires-recent-login':\n message = m.errors_auth_requires_recent_login();\n break;\n case 'auth/credential-already-in-use':\n message = m.errors_auth_account_exists_with_different_credential();\n break;\n case 'auth/weak-password':\n message = m.errors_auth_weak_password();\n break;\n case 'auth/network-request-failed':\n message = m.errors_auth_network_request_failed();\n break;\n }\n\n return new AppError(code, message, {\n displayMode: defaultDisplayMode,\n originalError: error,\n });\n }\n\n // Supabase/PostgreSQL Error\n // Supabase errors often have 'code' and 'message'.\n // We can also look for specific strings in the message if the code is generic.\n if ('code' in error || 'message' in error) {\n const errorRecord = error as { code?: unknown; message?: unknown };\n const msg = typeof errorRecord.message === 'string' ? errorRecord.message : '';\n\n // Supabase generic error message mapping\n if (msg.includes('Invalid login credentials')) {\n return new AppError(\n 'bg-auth/invalid-credentials',\n m.errors_supabase_invalid_credentials(),\n { displayMode: defaultDisplayMode, originalError: error },\n );\n }\n if (msg.includes('Email not confirmed')) {\n return new AppError(\n 'bg-auth/email-not-confirmed',\n m.errors_supabase_email_not_confirmed(),\n { displayMode: defaultDisplayMode, originalError: error },\n );\n }\n }\n\n // Generic Error\n return new AppError('error/unknown', error.message, {\n displayMode: defaultDisplayMode,\n originalError: error,\n });\n }\n\n // Unknown type\n return new AppError('error/unknown', String(error), {\n displayMode: defaultDisplayMode,\n });\n }\n\n /**\n * Formats the application code and message for display/logging.\n * @returns String in [code] message form; does not include metadata or stack.\n * @example\n * ```ts\n * import { AppError } from '@alneas/appkit-react/tools/core';\n * const error = new AppError('error/example', 'Unavailable').toString();\n * ```\n */\n toString(): string {\n return `[${this.code}] ${this.message}`;\n }\n\n /**\n * Selects enumerable presentation fields for JSON serialization.\n * @returns New object with name/code/message/displayMode/severity/metadata; stack and originalError are omitted.\n * @remarks Metadata remains referenced and may itself be non-serializable or sensitive.\n * @example\n * ```ts\n * import { AppError } from '@alneas/appkit-react/tools/core';\n * const error = new AppError('error/example', 'Unavailable').toJSON();\n * ```\n */\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n displayMode: this.displayMode,\n severity: this.severity,\n metadata: this.metadata,\n };\n }\n}\n\n/**\n * Represents an operation timeout with notification/warning presentation.\n * @remarks Construction does not start timers, perform a request or render error UI.\n * @example\n * ```ts\n * import { TimeoutError } from '@alneas/appkit-react/tools/core';\n * const error = new TimeoutError();\n * ```\n */\nexport class TimeoutError extends AppError {\n /**\n * Creates an application error with code error/timeout.\n * @param message - Message, default The operation timed out.\n * @param duration - Optional timeout duration in milliseconds; retained in metadata.\n * @example\n * ```ts\n * import { TimeoutError } from '@alneas/appkit-react/tools/core';\n * const error = new TimeoutError();\n * ```\n */\n constructor(message = 'The operation timed out', duration?: number) {\n super('error/timeout', message, {\n displayMode: 'notification',\n severity: 'warning',\n metadata: { duration },\n });\n this.name = 'TimeoutError';\n }\n}\n\n/**\n * Represents a network failure with notification/error presentation.\n * @remarks Construction does not start timers, perform a request or render error UI.\n * @example\n * ```ts\n * import { NetworkError } from '@alneas/appkit-react/tools/core';\n * const error = new NetworkError();\n * ```\n */\nexport class NetworkError extends AppError {\n /**\n * Creates an application error with code error/network.\n * @param message - Message, default Network error occurred.\n * @example\n * ```ts\n * import { NetworkError } from '@alneas/appkit-react/tools/core';\n * const error = new NetworkError();\n * ```\n */\n constructor(message = 'Network error occurred') {\n super('error/network', message, {\n displayMode: 'notification',\n severity: 'error',\n });\n this.name = 'NetworkError';\n }\n}\n\n/**\n * Represents denied access with dialog/error presentation.\n * @remarks Construction does not start timers, perform a request or render error UI.\n * @example\n * ```ts\n * import { UnauthorizedError } from '@alneas/appkit-react/tools/core';\n * const error = new UnauthorizedError();\n * ```\n */\nexport class UnauthorizedError extends AppError {\n /**\n * Creates an application error with code error/unauthorized.\n * @param message - Message, default You are not authorized to perform this action.\n * @example\n * ```ts\n * import { UnauthorizedError } from '@alneas/appkit-react/tools/core';\n * const error = new UnauthorizedError();\n * ```\n */\n constructor(message = 'You are not authorized to perform this action') {\n super('error/unauthorized', message, {\n displayMode: 'dialog',\n severity: 'error',\n });\n this.name = 'UnauthorizedError';\n }\n}\n\n/**\n * Represents a missing resource with page/error presentation.\n * @remarks Construction does not start timers, perform a request or render error UI.\n * @example\n * ```ts\n * import { NotFoundError } from '@alneas/appkit-react/tools/core';\n * const error = new NotFoundError();\n * ```\n */\nexport class NotFoundError extends AppError {\n /**\n * Creates an application error with code error/not-found.\n * @param message - Message, default The requested resource was not found.\n * @param resource - Optional missing resource name retained in metadata.\n * @example\n * ```ts\n * import { NotFoundError } from '@alneas/appkit-react/tools/core';\n * const error = new NotFoundError();\n * ```\n */\n constructor(message = 'The requested resource was not found', resource?: string) {\n super('error/not-found', message, {\n displayMode: 'page',\n severity: 'error',\n metadata: { resource },\n });\n this.name = 'NotFoundError';\n }\n}\n\n/**\n * Represents invalid input with inline/warning presentation.\n * @remarks Construction does not start timers, perform a request or render error UI.\n * @example\n * ```ts\n * import { ValidationError } from '@alneas/appkit-react/tools/core';\n * const error = new ValidationError('Invalid input');\n * ```\n */\nexport class ValidationError extends AppError {\n /**\n * Creates an application error with code error/validation.\n * @param message - Required validation message.\n * @param fields - Optional per-field error messages retained in metadata.\n * @example\n * ```ts\n * import { ValidationError } from '@alneas/appkit-react/tools/core';\n * const error = new ValidationError('Invalid input');\n * ```\n */\n constructor(message: string, fields?: Record<string, string>) {\n super('error/validation', message, {\n displayMode: 'inline',\n severity: 'warning',\n metadata: { fields },\n });\n this.name = 'ValidationError';\n }\n}\n"],"mappings":"A,+hCAyBA,IAAaa,EAAb,MAAaA,UAAiB,KAAM,CAIlC,KAKA,YAKA,SAKA,SAKA,cAaA,YACE,EACA,EACA,EAkBA,CACA,MAAMC,CAAO,EACb,KAAK,KAAO,WACZ,KAAK,KA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SAAU,UACV,SAAU,CAAE,QAAO,CACrB,CAAC,EACD,KAAK,KAAO,iBACd,CACF,E"}
|
|
@@ -1,123 +1,217 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* - dialog: モーダルダイアログ
|
|
6
|
-
* - page: 全画面エラーページ
|
|
2
|
+
* Requested error presentation: inline field feedback, notification banner, modal dialog or full page.
|
|
3
|
+
* @remarks This is metadata; a host renderer must display the error.
|
|
4
|
+
* @see AppError for creation.
|
|
7
5
|
*/
|
|
8
6
|
export type ErrorDisplayMode = 'inline' | 'notification' | 'dialog' | 'page';
|
|
9
7
|
/**
|
|
10
|
-
*
|
|
8
|
+
* Presentation severity from informational through critical; does not change Error behavior.
|
|
9
|
+
* @see AppError for creation.
|
|
11
10
|
*/
|
|
12
11
|
export type ErrorSeverity = 'info' | 'warning' | 'error' | 'critical';
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Application Error carrying a code, display hint, severity and optional metadata/original error.
|
|
14
|
+
* @remarks Presentation hints do not render UI or enforce authorization. Metadata is retained
|
|
15
|
+
* by reference and included in toJSON; exclude secrets before displaying or serializing.
|
|
16
16
|
* @example
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* // 表示モード指定
|
|
22
|
-
* throw new AppError('network/timeout', 'Request timed out', {
|
|
23
|
-
* displayMode: 'notification',
|
|
24
|
-
* severity: 'warning'
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* // メタデータ付き
|
|
28
|
-
* throw new AppError('validation/invalid-field', 'Invalid input', {
|
|
29
|
-
* displayMode: 'inline',
|
|
30
|
-
* metadata: { field: 'email' }
|
|
31
|
-
* });
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { AppError } from '@alneas/appkit-react/tools/core';
|
|
19
|
+
* const error = new AppError('validation/input', 'Review the input', { displayMode: 'inline', severity: 'warning' });
|
|
32
20
|
* ```
|
|
33
21
|
*/
|
|
34
22
|
export declare class AppError extends Error {
|
|
35
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Stable host error code, also usable for localized message lookup.
|
|
25
|
+
*/
|
|
36
26
|
readonly code: string;
|
|
37
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Recommended host display mode; defaults to notification.
|
|
29
|
+
*/
|
|
38
30
|
readonly displayMode: ErrorDisplayMode;
|
|
39
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Presentation severity; defaults to error.
|
|
33
|
+
*/
|
|
40
34
|
readonly severity: ErrorSeverity;
|
|
41
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Optional host metadata retained by reference and included in JSON serialization.
|
|
37
|
+
*/
|
|
42
38
|
readonly metadata?: Record<string, unknown>;
|
|
43
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Optional wrapped Error retained by reference; excluded from toJSON.
|
|
41
|
+
*/
|
|
44
42
|
readonly originalError?: Error;
|
|
45
43
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
* Creates an Error with explicit application code and presentation metadata.
|
|
45
|
+
* @param code - Host error identifier; no format validation is applied.
|
|
46
|
+
* @param message - Error message stored by the Error base class.
|
|
47
|
+
* @param options - Optional displayMode/severity (defaults notification/error), metadata and wrapped Error.
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { AppError } from '@alneas/appkit-react/tools/core';
|
|
51
|
+
* const error = new AppError('error/example', 'Operation failed');
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
51
54
|
constructor(code: string, message: string, options?: {
|
|
55
|
+
/**
|
|
56
|
+
* Presentation hint, default notification.
|
|
57
|
+
*/
|
|
52
58
|
displayMode?: ErrorDisplayMode;
|
|
59
|
+
/**
|
|
60
|
+
* Presentation severity, default error.
|
|
61
|
+
*/
|
|
53
62
|
severity?: ErrorSeverity;
|
|
63
|
+
/**
|
|
64
|
+
* Optional host metadata included by toJSON.
|
|
65
|
+
*/
|
|
54
66
|
metadata?: Record<string, unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* Optional wrapped Error, excluded from toJSON.
|
|
69
|
+
*/
|
|
55
70
|
originalError?: Error;
|
|
56
71
|
});
|
|
57
72
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
* Converts an unknown value to AppError, preserving an existing AppError unchanged.
|
|
74
|
+
* @param error - Error or arbitrary thrown value to normalize.
|
|
75
|
+
* @param defaultDisplayMode - Hint for newly created wrappers; defaults to notification.
|
|
76
|
+
* @returns Existing AppError identity, or a new wrapper. Error instances with a string code
|
|
77
|
+
* retain that code and map selected known auth messages; other Errors use message matching
|
|
78
|
+
* or error/unknown. Non-Error values are stringified as error/unknown.
|
|
79
|
+
* @remarks Plain objects with code/message are not interpreted as Error instances. The
|
|
80
|
+
* default display hint does not override an existing AppError. No UI is rendered.
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { AppError } from '@alneas/appkit-react/tools/core';
|
|
84
|
+
* const error = AppError.from(new Error('Unavailable'), 'dialog');
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
61
87
|
static from(error: unknown, defaultDisplayMode?: ErrorDisplayMode): AppError;
|
|
62
88
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
89
|
+
* Formats the application code and message for display/logging.
|
|
90
|
+
* @returns String in [code] message form; does not include metadata or stack.
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* import { AppError } from '@alneas/appkit-react/tools/core';
|
|
94
|
+
* const error = new AppError('error/example', 'Unavailable').toString();
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
65
97
|
toString(): string;
|
|
66
98
|
/**
|
|
67
|
-
|
|
68
|
-
|
|
99
|
+
* Selects enumerable presentation fields for JSON serialization.
|
|
100
|
+
* @returns New object with name/code/message/displayMode/severity/metadata; stack and originalError are omitted.
|
|
101
|
+
* @remarks Metadata remains referenced and may itself be non-serializable or sensitive.
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* import { AppError } from '@alneas/appkit-react/tools/core';
|
|
105
|
+
* const error = new AppError('error/example', 'Unavailable').toJSON();
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
69
108
|
toJSON(): Record<string, unknown>;
|
|
70
109
|
}
|
|
71
110
|
/**
|
|
72
|
-
*
|
|
111
|
+
* Represents an operation timeout with notification/warning presentation.
|
|
112
|
+
* @remarks Construction does not start timers, perform a request or render error UI.
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* import { TimeoutError } from '@alneas/appkit-react/tools/core';
|
|
116
|
+
* const error = new TimeoutError();
|
|
117
|
+
* ```
|
|
73
118
|
*/
|
|
74
119
|
export declare class TimeoutError extends AppError {
|
|
75
120
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
121
|
+
* Creates an application error with code error/timeout.
|
|
122
|
+
* @param message - Message, default The operation timed out.
|
|
123
|
+
* @param duration - Optional timeout duration in milliseconds; retained in metadata.
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* import { TimeoutError } from '@alneas/appkit-react/tools/core';
|
|
127
|
+
* const error = new TimeoutError();
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
80
130
|
constructor(message?: string, duration?: number);
|
|
81
131
|
}
|
|
82
132
|
/**
|
|
83
|
-
*
|
|
133
|
+
* Represents a network failure with notification/error presentation.
|
|
134
|
+
* @remarks Construction does not start timers, perform a request or render error UI.
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* import { NetworkError } from '@alneas/appkit-react/tools/core';
|
|
138
|
+
* const error = new NetworkError();
|
|
139
|
+
* ```
|
|
84
140
|
*/
|
|
85
141
|
export declare class NetworkError extends AppError {
|
|
86
142
|
/**
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
143
|
+
* Creates an application error with code error/network.
|
|
144
|
+
* @param message - Message, default Network error occurred.
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* import { NetworkError } from '@alneas/appkit-react/tools/core';
|
|
148
|
+
* const error = new NetworkError();
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
90
151
|
constructor(message?: string);
|
|
91
152
|
}
|
|
92
153
|
/**
|
|
93
|
-
*
|
|
154
|
+
* Represents denied access with dialog/error presentation.
|
|
155
|
+
* @remarks Construction does not start timers, perform a request or render error UI.
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* import { UnauthorizedError } from '@alneas/appkit-react/tools/core';
|
|
159
|
+
* const error = new UnauthorizedError();
|
|
160
|
+
* ```
|
|
94
161
|
*/
|
|
95
162
|
export declare class UnauthorizedError extends AppError {
|
|
96
163
|
/**
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
164
|
+
* Creates an application error with code error/unauthorized.
|
|
165
|
+
* @param message - Message, default You are not authorized to perform this action.
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* import { UnauthorizedError } from '@alneas/appkit-react/tools/core';
|
|
169
|
+
* const error = new UnauthorizedError();
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
100
172
|
constructor(message?: string);
|
|
101
173
|
}
|
|
102
174
|
/**
|
|
103
|
-
*
|
|
175
|
+
* Represents a missing resource with page/error presentation.
|
|
176
|
+
* @remarks Construction does not start timers, perform a request or render error UI.
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* import { NotFoundError } from '@alneas/appkit-react/tools/core';
|
|
180
|
+
* const error = new NotFoundError();
|
|
181
|
+
* ```
|
|
104
182
|
*/
|
|
105
183
|
export declare class NotFoundError extends AppError {
|
|
106
184
|
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
185
|
+
* Creates an application error with code error/not-found.
|
|
186
|
+
* @param message - Message, default The requested resource was not found.
|
|
187
|
+
* @param resource - Optional missing resource name retained in metadata.
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* import { NotFoundError } from '@alneas/appkit-react/tools/core';
|
|
191
|
+
* const error = new NotFoundError();
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
111
194
|
constructor(message?: string, resource?: string);
|
|
112
195
|
}
|
|
113
196
|
/**
|
|
114
|
-
*
|
|
197
|
+
* Represents invalid input with inline/warning presentation.
|
|
198
|
+
* @remarks Construction does not start timers, perform a request or render error UI.
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* import { ValidationError } from '@alneas/appkit-react/tools/core';
|
|
202
|
+
* const error = new ValidationError('Invalid input');
|
|
203
|
+
* ```
|
|
115
204
|
*/
|
|
116
205
|
export declare class ValidationError extends AppError {
|
|
117
206
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
207
|
+
* Creates an application error with code error/validation.
|
|
208
|
+
* @param message - Required validation message.
|
|
209
|
+
* @param fields - Optional per-field error messages retained in metadata.
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts
|
|
212
|
+
* import { ValidationError } from '@alneas/appkit-react/tools/core';
|
|
213
|
+
* const error = new ValidationError('Invalid input');
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
122
216
|
constructor(message: string, fields?: Record<string, string>);
|
|
123
217
|
}
|