@happyvertical/smrt-template-sveltekit 0.74.7 → 0.75.1
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/AGENTS.md +22 -5
- package/README.md +49 -0
- package/agents/cookbook-host.md +10 -3
- package/cookbook-template/src/hooks.server.ts +4 -2
- package/cookbook-template/src/lib/server/cookbook.ts +1 -1
- package/cookbook-template/src/routes/+layout.server.ts +4 -2
- package/cookbook-template/src/routes/+layout.svelte +6 -0
- package/cookbook-template/src/routes/+page.server.ts +1 -1
- package/cookbook-template/src/routes/api/_runtime/owner-link/+server.ts +1 -1
- package/cookbook-template/src/routes/api/assistant/[...path]/+server.ts +1 -1
- package/cookbook-template/src/routes/api/connect-ai/+server.ts +1 -1
- package/cookbook-template/src/routes/api/cookbook/prebuilt/+server.ts +1 -1
- package/cookbook-template/src/routes/api/cookbook/preferences/+server.ts +1 -1
- package/cookbook-template/src/routes/api/onboarding/+server.ts +1 -1
- package/cookbook-template/src/routes/mcp/+server.ts +1 -1
- package/cookbook-template/src/routes/settings/+page.server.ts +1 -1
- package/cookbook-template/src/routes/settings/inference/+page.server.ts +1 -1
- package/cookbook-template/vite.config.ts +3 -1
- package/dist/host/server.d.ts +2 -1
- package/dist/host/server.js +18 -2
- package/dist/host/settings.d.ts +11 -0
- package/dist/host/settings.js +15 -0
- package/examples/notes/src/routes/notes/+page.server.ts +2 -2
- package/examples/notes/src/routes/notes/+page.svelte +1 -2
- package/host/InferenceSettingsPage.svelte +13 -2
- package/index.js +3 -3
- package/mcp-apps-template/package.dependencies.json +2 -2
- package/mcp-apps-template/src/routes/.well-known/oauth-protected-resource/api/mcp/+server.ts +1 -1
- package/mcp-apps-template/src/routes/api/mcp/+server.ts +2 -2
- package/package.json +50 -49
- package/template/README.md +38 -1
- package/template/gitignore.template +3 -0
- package/template/package.json +25 -19
- package/template/smrt.config.ts +1 -0
- package/template/src/app.d.ts +7 -1
- package/template/src/app.html +1 -1
- package/template/src/hooks.server.ts +6 -7
- package/template/src/lib/components/MaterializedReportDrilldown.svelte +1 -1
- package/template/src/lib/i18n/LanguageLayout.svelte +19 -0
- package/template/src/lib/i18n/LanguageSwitcher.svelte +17 -0
- package/template/src/lib/i18n/catalog.ts +27 -0
- package/template/src/lib/i18n/locale-tool.ts +19 -0
- package/template/src/lib/i18n/locales.ts +62 -0
- package/template/src/lib/i18n/messages.catalog.ts +39 -0
- package/template/src/lib/i18n/messages.ts +3 -0
- package/template/src/lib/i18n/shell-spanish.ts +173 -0
- package/template/src/lib/server/i18n.ts +48 -0
- package/template/src/lib/server/language-preference.ts +30 -0
- package/template/src/lib/server/languages.ts +67 -0
- package/template/src/lib/server/settings-registry.ts +2 -0
- package/template/src/params.ts +8 -0
- package/template/src/routes/+layout.server.ts +9 -5
- package/template/src/routes/+layout.svelte +10 -4
- package/template/src/routes/+page.svelte +7 -4
- package/template/src/routes/api/_reports/runtime/confirm/+server.ts +1 -1
- package/template/src/routes/api/_runtime/diagnostics/+server.ts +1 -1
- package/template/src/routes/api/_runtime/health/+server.ts +1 -1
- package/template/src/routes/api/languages/mcp/+server.ts +59 -0
- package/template/src/routes/api/settings/languages/+server.ts +32 -0
- package/template/src/routes/language/+server.ts +20 -0
- package/template/src/routes/reports/materialized/[id]/+page.server.ts +1 -1
- package/template/src/routes/reports/materialized/[id]/+page.svelte +2 -3
- package/template/src/routes/reports/materialized/[id]/drilldown/+server.ts +1 -1
- package/template/src/routes/settings/+page.svelte +11 -7
- package/template/src/routes/settings/[section=settingsSection]/+page.svelte +1 -1
- package/template/src/routes/settings/inference/+page.server.ts +1 -1
- package/template/src/routes/settings/languages/+page.server.ts +15 -0
- package/template/src/routes/settings/languages/+page.svelte +59 -0
- package/template/src/routes/settings/languages/+server.ts +20 -0
- package/template/src/routes/settings/prompts/+page.server.ts +1 -1
- package/template/src/routes/setup/+page.server.ts +2 -2
- package/template/src/routes/sign-out/+server.ts +1 -1
- package/template/tsconfig.json +3 -1
- package/template/vite.config.ts +3 -1
- package/template.config.js +21 -19
- package/template/src/params/settingsSection.ts +0 -4
- package/template/svelte.config.js +0 -16
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/** Reviewed Spanish for the starter's shared shell and built-in settings. */
|
|
2
|
+
export const shellSpanish: Record<string, string> = {
|
|
3
|
+
'ui.admin_shell.no_focus_tools': 'No hay herramientas de enfoque',
|
|
4
|
+
'ui.admin_shell.focus_tools': 'Herramientas de enfoque',
|
|
5
|
+
'ui.admin_shell.no_app_panel': 'No hay panel de aplicación',
|
|
6
|
+
'ui.admin_shell.no_system_panel': 'No hay panel del sistema',
|
|
7
|
+
'ui.admin_shell.shell_shortcuts': 'Atajos de la interfaz',
|
|
8
|
+
'ui.admin_shell.close_shortcuts': 'Cerrar atajos',
|
|
9
|
+
'ui.admin_shell.shortcuts': 'Atajos',
|
|
10
|
+
'ui.admin_shell.close': 'Cerrar',
|
|
11
|
+
'ui.admin_shell.home': 'Inicio',
|
|
12
|
+
'ui.admin_shell.menu': 'Menú',
|
|
13
|
+
'ui.admin_shell.close_menu': 'Cerrar menú',
|
|
14
|
+
'ui.admin_shell.tools': 'Herramientas',
|
|
15
|
+
'ui.admin_shell.close_tools': 'Cerrar herramientas',
|
|
16
|
+
'ui.admin_shell.expand_sidebar': 'Expandir barra lateral',
|
|
17
|
+
'ui.admin_shell.collapse_sidebar': 'Contraer barra lateral',
|
|
18
|
+
'ui.admin_shell.close_sidebar': 'Cerrar barra lateral',
|
|
19
|
+
'ui.admin_shell.expand_panel': 'Expandir {panel}',
|
|
20
|
+
'ui.admin_shell.collapse_panel': 'Contraer {panel}',
|
|
21
|
+
'ui.admin_shell.close_panel': 'Cerrar {label}',
|
|
22
|
+
'ui.admin_shell.open_panel': 'Abrir {label}',
|
|
23
|
+
'ui.admin_shell.resize_panel': 'Cambiar el tamaño de {label}',
|
|
24
|
+
'ui.admin_shell.panel': 'Panel',
|
|
25
|
+
'ui.shell_nav_toggle.collapse': 'Contraer {label}',
|
|
26
|
+
'ui.shell_nav_toggle.expand': 'Expandir {label}',
|
|
27
|
+
'ui.shell_nav_toggle.navigation': 'navegación',
|
|
28
|
+
'ui.phone_top_bar.back': 'Volver a {label}',
|
|
29
|
+
'ui.phone_bottom_bar.label': 'Principal',
|
|
30
|
+
'ui.phone_bottom_bar.unread': '{count} sin leer',
|
|
31
|
+
'ui.phone_bottom_bar.new': 'nuevo',
|
|
32
|
+
'ui.app_scope_panel.app_scope': 'Ámbito de la aplicación',
|
|
33
|
+
'ui.app_shell.settings_link': 'Configuración de la interfaz',
|
|
34
|
+
'ui.app_shell.navigation': 'Navegación de la aplicación',
|
|
35
|
+
'ui.app_shell.slot_content': 'Contenido de {slot}',
|
|
36
|
+
'ui.app_shell.account_item': 'Menú de cuenta',
|
|
37
|
+
'ui.app_shell.color_scheme_item': 'Esquema de colores',
|
|
38
|
+
'ui.app_shell.color_scheme_dark': 'Modo oscuro',
|
|
39
|
+
'ui.app_shell.color_scheme_to_dark': 'Cambiar al modo oscuro',
|
|
40
|
+
'ui.app_shell.color_scheme_to_light': 'Cambiar al modo claro',
|
|
41
|
+
'ui.app_shell.command_palette_item': 'Buscar',
|
|
42
|
+
'ui.app_shell.account_settings': 'Configuración',
|
|
43
|
+
'ui.app_shell.theme_item': 'Tema: {mode}',
|
|
44
|
+
'ui.app_shell.theme_light': 'Claro',
|
|
45
|
+
'ui.app_shell.theme_dark': 'Oscuro',
|
|
46
|
+
'ui.app_shell.panel_toggle': 'Panel',
|
|
47
|
+
'ui.phone_tab_bar.label': 'Principal',
|
|
48
|
+
'ui.phone_tab_bar.more': 'Más',
|
|
49
|
+
'ui.dock_toggles.set_up': 'Configurar {label}',
|
|
50
|
+
'ui.app_shell.brand_item': 'Título de la aplicación',
|
|
51
|
+
'ui.shell_slot.header_start': 'Encabezado, izquierda',
|
|
52
|
+
'ui.shell_slot.header_center': 'Encabezado, centro',
|
|
53
|
+
'ui.shell_slot.header_end': 'Encabezado, derecha',
|
|
54
|
+
'ui.shell_slot.footer_start': 'Pie de página, izquierda',
|
|
55
|
+
'ui.shell_slot.footer_center': 'Pie de página, centro',
|
|
56
|
+
'ui.shell_slot.footer_end': 'Pie de página, derecha',
|
|
57
|
+
'ui.shell_slot.left_sidebar_header': 'Barra lateral izquierda, encabezado',
|
|
58
|
+
'ui.shell_slot.left_sidebar_footer': 'Barra lateral izquierda, pie',
|
|
59
|
+
'ui.shell_slot.right_sidebar_header': 'Barra lateral derecha, encabezado',
|
|
60
|
+
'ui.shell_slot.right_sidebar_footer': 'Barra lateral derecha, pie',
|
|
61
|
+
'ui.shell_slot.short_header_start': 'Izquierda',
|
|
62
|
+
'ui.shell_slot.short_header_center': 'Centro',
|
|
63
|
+
'ui.shell_slot.short_header_end': 'Derecha',
|
|
64
|
+
'ui.shell_slot.short_footer_start': 'Izquierda',
|
|
65
|
+
'ui.shell_slot.short_footer_center': 'Centro',
|
|
66
|
+
'ui.shell_slot.short_footer_end': 'Derecha',
|
|
67
|
+
'ui.shell_slot.short_sidebar_header': 'Encabezado',
|
|
68
|
+
'ui.shell_slot.short_sidebar_footer': 'Pie de página',
|
|
69
|
+
'ui.owner_setup.heading': 'Configura tu aplicación local',
|
|
70
|
+
'ui.owner_setup.unavailable': 'La configuración del propietario local no está disponible o ya se ha completado.',
|
|
71
|
+
'ui.owner_setup.intro': 'Crea la cuenta del propietario local. Esta invitación se puede usar una sola vez y permanece en este dispositivo.',
|
|
72
|
+
'ui.owner_setup.name': 'Nombre',
|
|
73
|
+
'ui.owner_setup.email': 'Correo electrónico',
|
|
74
|
+
'ui.owner_setup.tenant_name': 'Nombre del espacio de trabajo (opcional)',
|
|
75
|
+
'ui.owner_setup.submit': 'Crear propietario',
|
|
76
|
+
'ui.owner_setup.link_missing_heading': 'Este enlace de configuración no existe o ha caducado',
|
|
77
|
+
'ui.owner_setup.link_missing_body': 'Los enlaces de configuración se pueden usar una sola vez y durante un tiempo limitado. Ejecuta estos comandos desde la carpeta de la aplicación. Para recuperarla, primero debes detener la aplicación.',
|
|
78
|
+
'ui.owner_setup.desktop_reopen': 'Vuelve a abrir la aplicación de escritorio para iniciar sesión con un enlace nuevo.',
|
|
79
|
+
'ui.owner_setup.recovery_open': 'Abrir un enlace de configuración nuevo',
|
|
80
|
+
'ui.owner_setup.recovery_recover': 'Recuperar la invitación de configuración',
|
|
81
|
+
'ui.shell_settings_page.heading': 'Configuración',
|
|
82
|
+
'ui.shell_settings_page.description': 'Ajusta la apariencia, tu cuenta y el diseño del espacio de trabajo.',
|
|
83
|
+
'ui.shell_settings_page.back': 'Toda la configuración',
|
|
84
|
+
'ui.shell_settings_page.menu_label': 'Secciones de configuración',
|
|
85
|
+
'ui.shell_settings_page.appearance_description': 'Tema y esquema de colores claro u oscuro.',
|
|
86
|
+
'ui.shell_settings_page.account_description': 'Consulta tu cuenta y cierra la sesión.',
|
|
87
|
+
'ui.shell_settings_page.layout_description': 'Muestra u oculta áreas del espacio de trabajo y restablece el diseño.',
|
|
88
|
+
'ui.shell_settings_page.shortcuts_description': 'Atajos de teclado para las áreas del espacio de trabajo.',
|
|
89
|
+
'ui.hotkey_input.capture_title': 'Pulsa una tecla para asignarla',
|
|
90
|
+
'ui.hotkey_input.conflicts_with': 'En conflicto con',
|
|
91
|
+
'ui.shell_settings_panel.shell_settings': 'Configuración de la interfaz',
|
|
92
|
+
'ui.shell_settings_panel.description': 'Muestra u oculta las áreas del espacio de trabajo y restablece el diseño.',
|
|
93
|
+
'ui.shell_settings_panel.disable_hotkeys': 'Desactivar atajos',
|
|
94
|
+
'ui.shell_settings_panel.enable_hotkeys': 'Activar atajos',
|
|
95
|
+
'ui.shell_settings_panel.collapse': 'Contraer',
|
|
96
|
+
'ui.shell_settings_panel.expand': 'Expandir',
|
|
97
|
+
'ui.shell_settings.appearance': 'Apariencia',
|
|
98
|
+
'ui.shell_settings.theme': 'Tema',
|
|
99
|
+
'ui.shell_settings.color_scheme': 'Esquema de colores',
|
|
100
|
+
'ui.shell_settings.account': 'Cuenta',
|
|
101
|
+
'ui.shell_settings.account_name': 'Nombre',
|
|
102
|
+
'ui.shell_settings.account_email': 'Correo electrónico',
|
|
103
|
+
'ui.shell_settings.account_signed_out': 'No has iniciado sesión.',
|
|
104
|
+
'ui.shell_settings.sign_out': 'Cerrar sesión',
|
|
105
|
+
'ui.shell_settings.sign_out_failed': 'No se ha podido cerrar la sesión. Inténtalo de nuevo.',
|
|
106
|
+
'ui.shell_settings.layout': 'Diseño',
|
|
107
|
+
'ui.shell_settings.hide': 'Ocultar',
|
|
108
|
+
'ui.shell_settings.show': 'Mostrar',
|
|
109
|
+
'ui.shell_settings.edit_layout_on': 'Editando el diseño',
|
|
110
|
+
'ui.shell_settings.edit_layout_off': 'Editar diseño',
|
|
111
|
+
'ui.shell_settings.reset_layout': 'Restablecer diseño',
|
|
112
|
+
'ui.shell_settings.panels': 'Áreas visibles',
|
|
113
|
+
'ui.shell_settings.show_region': 'Mostrar {region}',
|
|
114
|
+
'ui.shell_settings.hide_region': 'Ocultar {region}',
|
|
115
|
+
'ui.shell_settings.region_shown': 'Visible',
|
|
116
|
+
'ui.shell_settings.region_hidden': 'Oculta',
|
|
117
|
+
'ui.shell_settings.shortcuts': 'Atajos de teclado',
|
|
118
|
+
'ui.shell_layout_editor.heading': 'Diseño de la interfaz',
|
|
119
|
+
'ui.shell_layout_editor.description': 'Elige los paneles visibles y organiza la navegación. Arrastra un control o selecciónalo, pulsa Espacio y usa las flechas.',
|
|
120
|
+
'ui.shell_layout_editor.reset': 'Restablecer valores predeterminados',
|
|
121
|
+
'ui.shell_layout_editor.panels': 'Paneles',
|
|
122
|
+
'ui.shell_layout_editor.show_panel': 'Mostrar el panel {panel}',
|
|
123
|
+
'ui.shell_layout_editor.start_expanded': 'Iniciar con el panel {panel} expandido',
|
|
124
|
+
'ui.shell_layout_editor.panel_unavailable': 'El panel {panel} no está disponible en esta aplicación.',
|
|
125
|
+
'ui.shell_layout_editor.navigation': 'Navegación',
|
|
126
|
+
'ui.shell_layout_editor.top_level': 'Nivel superior',
|
|
127
|
+
'ui.shell_layout_editor.show_entry': 'Mostrar {label} en la navegación',
|
|
128
|
+
'ui.shell_layout_editor.new_section': 'Nueva sección',
|
|
129
|
+
'ui.shell_layout_editor.new_section_label': 'Nueva sección',
|
|
130
|
+
'ui.shell_layout_editor.section_name': 'Nombre de la sección {label}',
|
|
131
|
+
'ui.shell_layout_editor.rename_item': 'Cambiar el nombre de {label}',
|
|
132
|
+
'ui.shell_layout_editor.item_name': 'Nombre del elemento {label}',
|
|
133
|
+
'ui.shell_layout_editor.reset_item': 'Restablecer {label} a {original}',
|
|
134
|
+
'ui.shell_layout_editor.section_icon': 'Icono de {label}',
|
|
135
|
+
'ui.shell_layout_editor.icon_option': 'Usar el icono {icon}',
|
|
136
|
+
'ui.section_menu.label': 'Elementos de {label}',
|
|
137
|
+
'ui.section_menu.empty': 'No hay elementos en esta sección.',
|
|
138
|
+
'ui.shell_layout_editor.show_title_for': 'Mostrar el título de {label}',
|
|
139
|
+
'ui.shell_layout_editor.delete': 'Eliminar',
|
|
140
|
+
'ui.shell_layout_editor.delete_section': 'Eliminar la sección {label}',
|
|
141
|
+
'ui.shell_layout_editor.delete_confirm': '¿Eliminar {label}? Sus elementos volverán a sus secciones predeterminadas.',
|
|
142
|
+
'ui.shell_layout_editor.preview': 'Vista previa',
|
|
143
|
+
'ui.shell_layout_editor.preview_label': 'Vista previa de la navegación',
|
|
144
|
+
'ui.shell_layout_editor.sortable_label': 'Secciones y elementos de navegación',
|
|
145
|
+
'ui.layout_edit.toggle': 'Editar diseño',
|
|
146
|
+
'ui.layout_edit.announce_on': 'Edición del diseño activada. Arrastra los elementos entre las zonas o selecciona un control, pulsa Espacio y usa las flechas.',
|
|
147
|
+
'ui.layout_edit.announce_off': 'Edición del diseño desactivada.',
|
|
148
|
+
'ui.layout_edit.zone': '{region} · {slot}',
|
|
149
|
+
'ui.layout_edit.region_hidden': '{region} · oculta',
|
|
150
|
+
'ui.layout_edit.show_region': 'Mostrar {region}',
|
|
151
|
+
'ui.layout_edit.hide_region': 'Ocultar {region}',
|
|
152
|
+
'ui.layout_edit.hide_last_region': 'No se puede ocultar {region}: al menos una región debe permanecer visible',
|
|
153
|
+
'ui.layout_edit.section_options': 'Opciones de la sección {label}',
|
|
154
|
+
'ui.layout_edit.edit_section': 'Editar la sección {label}',
|
|
155
|
+
'ui.shell_region.header': 'Encabezado',
|
|
156
|
+
'ui.shell_region.left_sidebar': 'Barra lateral izquierda',
|
|
157
|
+
'ui.shell_region.right_sidebar': 'Barra lateral derecha',
|
|
158
|
+
'ui.shell_region.footer': 'Pie de página',
|
|
159
|
+
'ui.shortcuts_overlay.open_shortcuts': 'Abrir atajos',
|
|
160
|
+
'ui.shortcuts_overlay.close_drawer': 'Cerrar panel',
|
|
161
|
+
'ui.shortcuts_overlay.close': 'Cerrar',
|
|
162
|
+
'ui.shortcuts_overlay.escape': 'Esc',
|
|
163
|
+
'ui.system_scope_panel.system_scope': 'Ámbito del sistema',
|
|
164
|
+
'ui.system_scope_panel.activities': 'Actividades',
|
|
165
|
+
'ui.system_scope_panel.no_running_work': 'No hay tareas en ejecución',
|
|
166
|
+
'ui.system_status_chips.system_status': 'Estado del sistema',
|
|
167
|
+
'ui.tenant_nav.tenant_navigation': 'Navegación del espacio de trabajo',
|
|
168
|
+
'ui.tenant_nav.needs_attention': 'Requiere atención',
|
|
169
|
+
'ui.workspace_account_menu.open': 'Abrir menú de cuenta',
|
|
170
|
+
'ui.workspace_account_menu.current_tenant': '{tenant} — actual',
|
|
171
|
+
'ui.workspace_account_menu.sign_out': 'Cerrar sesión',
|
|
172
|
+
'ui.workspace_account_menu.pending': '{count} pendientes',
|
|
173
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { buildI18nSnapshot } from '@happyvertical/smrt-svelte/i18n/server';
|
|
2
|
+
import type { ServerLoadEvent } from '@sveltejs/kit';
|
|
3
|
+
import type { Handle } from '@sveltejs/kit/hooks';
|
|
4
|
+
import { applicationCatalog } from '#lib/i18n/catalog.js';
|
|
5
|
+
import { languageCookie, localeDirection, resolveRequestLocale } from '#lib/i18n/locales.js';
|
|
6
|
+
import { languagePreferences } from '#lib/server/languages.js';
|
|
7
|
+
import { runtime } from '#lib/server/smrt.js';
|
|
8
|
+
|
|
9
|
+
/** Shared page-load contract for ordinary and cookbook hosts; authority stays in locals. */
|
|
10
|
+
export async function loadLanguageState(event: Pick<ServerLoadEvent, 'locals' | 'url' | 'request' | 'cookies' | 'depends'>) {
|
|
11
|
+
const explicit = event.url.searchParams.get('lang');
|
|
12
|
+
event.depends('smrt:i18n');
|
|
13
|
+
const tenantId = event.locals.tenantId ?? null;
|
|
14
|
+
const preferences = await languagePreferences(tenantId);
|
|
15
|
+
const languageConfiguration = await preferences.getPreferences();
|
|
16
|
+
const locale = resolveRequestLocale({
|
|
17
|
+
explicit,
|
|
18
|
+
cookie: event.cookies.get(languageCookie),
|
|
19
|
+
acceptLanguage: event.request.headers.get('accept-language'),
|
|
20
|
+
}, languageConfiguration);
|
|
21
|
+
const i18n = await buildI18nSnapshot({
|
|
22
|
+
locale, tenantId, defaultLocale: languageConfiguration.defaultLocale,
|
|
23
|
+
db: runtime.classOptions('LanguageOverride').db, catalog: applicationCatalog,
|
|
24
|
+
});
|
|
25
|
+
const direction = localeDirection(locale);
|
|
26
|
+
event.locals.i18n = i18n;
|
|
27
|
+
event.locals.direction = direction;
|
|
28
|
+
event.locals.languageConfiguration = languageConfiguration;
|
|
29
|
+
return { i18n, direction, languageConfiguration };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Keep the host's authentication and resolve options, then fill document attributes. */
|
|
33
|
+
export function withLanguageDocument(handle: Handle): Handle {
|
|
34
|
+
return ({ event, resolve }) => handle({
|
|
35
|
+
event,
|
|
36
|
+
resolve: async (authorizedEvent, options) => resolve(authorizedEvent, {
|
|
37
|
+
...options,
|
|
38
|
+
transformPageChunk: async (chunk) => {
|
|
39
|
+
const html = options?.transformPageChunk
|
|
40
|
+
? (await options.transformPageChunk(chunk)) ?? chunk.html
|
|
41
|
+
: chunk.html;
|
|
42
|
+
return html
|
|
43
|
+
.replaceAll('%smrt.locale%', authorizedEvent.locals.i18n?.locale ?? 'en')
|
|
44
|
+
.replaceAll('%smrt.direction%', authorizedEvent.locals.direction ?? 'ltr');
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RequestEvent } from '@sveltejs/kit';
|
|
2
|
+
import { enabledLocale, languageCookie } from '#lib/i18n/locales.js';
|
|
3
|
+
import { languagePreferences } from './languages.js';
|
|
4
|
+
|
|
5
|
+
/** The preference belongs to this HTTP client; scope/policy always comes from verified locals. */
|
|
6
|
+
export async function setLanguagePreference(input: unknown, event: Pick<RequestEvent, 'request' | 'url' | 'cookies' | 'locals'>) {
|
|
7
|
+
if (!input || typeof input !== 'object' || Array.isArray(input) || Object.keys(input).some((key) => key !== 'locale') || typeof (input as { locale?: unknown }).locale !== 'string') throw new TypeError('Invalid language');
|
|
8
|
+
const value = (input as { locale: string }).locale;
|
|
9
|
+
if (value.length > 100) throw new TypeError('Invalid language');
|
|
10
|
+
const preferences = await languagePreferences(event.locals.tenantId ?? null);
|
|
11
|
+
const locale = enabledLocale(value, await preferences.getPreferences());
|
|
12
|
+
if (!locale) throw new TypeError('Unsupported language');
|
|
13
|
+
event.cookies.set(languageCookie, locale, {
|
|
14
|
+
path: '/', httpOnly: true, sameSite: 'lax', secure: event.url.protocol === 'https:',
|
|
15
|
+
maxAge: 60 * 60 * 24 * 365,
|
|
16
|
+
});
|
|
17
|
+
// Only same-origin paths; a URL override must not mask the newly persisted cookie.
|
|
18
|
+
const referer = event.request.headers.get('referer');
|
|
19
|
+
let location = '/';
|
|
20
|
+
if (referer) {
|
|
21
|
+
try {
|
|
22
|
+
const destination = new URL(referer);
|
|
23
|
+
if (destination.origin === event.url.origin && !destination.pathname.startsWith('//')) {
|
|
24
|
+
destination.searchParams.delete('lang');
|
|
25
|
+
location = destination.pathname + destination.search + destination.hash;
|
|
26
|
+
}
|
|
27
|
+
} catch { /* Invalid referers fall back to home. */ }
|
|
28
|
+
}
|
|
29
|
+
return { locale, location, preferenceTarget: 'request-client' as const };
|
|
30
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { error } from '@sveltejs/kit';
|
|
2
|
+
import { LanguageSettingsService } from '@happyvertical/smrt-languages';
|
|
3
|
+
import { applicationCatalogs } from '#lib/i18n/catalog.js';
|
|
4
|
+
import { defaultLanguageConfiguration } from '#lib/i18n/locales.js';
|
|
5
|
+
import { runtime } from './smrt.js';
|
|
6
|
+
|
|
7
|
+
/** Preferences are public UI policy; overrides remain scoped to the verified tenant. */
|
|
8
|
+
export function languagePreferences(tenantId: string | null) {
|
|
9
|
+
return LanguageSettingsService.create(runtime.classOptions('LanguageOverride'), {
|
|
10
|
+
scope: tenantId ? { type: 'tenant', tenantId } : { type: 'app' },
|
|
11
|
+
catalogs: applicationCatalogs,
|
|
12
|
+
defaults: defaultLanguageConfiguration,
|
|
13
|
+
authorize: ({ operation }) => operation === 'read',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
import { requireSettingsSession } from './settings.js';
|
|
18
|
+
|
|
19
|
+
/** The app context is explicit; tenant identity always comes from the verified session. */
|
|
20
|
+
export async function applicationLanguagePermission(locals: App.Locals): Promise<boolean> {
|
|
21
|
+
return typeof locals.sessionId === 'string' &&
|
|
22
|
+
await runtime.hasApplicationPermission(locals.sessionId, 'languages.customize_app');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function languageSettings(locals: App.Locals, appScope: boolean) {
|
|
26
|
+
const session = requireSettingsSession(locals);
|
|
27
|
+
if (appScope && !await applicationLanguagePermission(locals)) error(403, 'Application language settings access denied');
|
|
28
|
+
return LanguageSettingsService.create(runtime.classOptions('LanguageOverride'), {
|
|
29
|
+
scope: appScope ? { type: 'app' } : { type: 'tenant', tenantId: session.tenantId },
|
|
30
|
+
catalogs: applicationCatalogs,
|
|
31
|
+
defaults: defaultLanguageConfiguration,
|
|
32
|
+
authorize: async ({ operation, scope }) => appScope
|
|
33
|
+
? scope.type === 'app' && await applicationLanguagePermission(locals)
|
|
34
|
+
: scope.type === 'tenant' && scope.tenantId === session.tenantId &&
|
|
35
|
+
(operation === 'read' || session.can('languages.customize')),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
import { createLanguageOperationExecutor } from '@happyvertical/smrt-languages';
|
|
40
|
+
import { LanguageFillCoordinator } from '@happyvertical/smrt-languages/jobs';
|
|
41
|
+
import { applicationCatalog } from '#lib/i18n/catalog.js';
|
|
42
|
+
|
|
43
|
+
/** One request, one verified actor and current runtime transaction. Never cache this executor. */
|
|
44
|
+
export function languageOperations(locals: App.Locals) {
|
|
45
|
+
if (typeof locals.sessionId !== 'string' || !locals.sessionId) error(401, 'Sign in required');
|
|
46
|
+
const session = requireSettingsSession(locals);
|
|
47
|
+
return createLanguageOperationExecutor({
|
|
48
|
+
reviewerId: session.userId,
|
|
49
|
+
authorize: async (operation, scope) => {
|
|
50
|
+
if (scope === 'app') {
|
|
51
|
+
if (!await applicationLanguagePermission(locals)) error(403, 'Language settings access denied');
|
|
52
|
+
} else if (operation !== 'inventory' && !session.can('languages.customize')) {
|
|
53
|
+
error(403, 'Language settings access denied');
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
settings: (scope) => languageSettings(locals, scope === 'app'),
|
|
57
|
+
fill: (service) => new LanguageFillCoordinator(service, service.getDbOptions(), service.getScope(),
|
|
58
|
+
applicationCatalog.messages.filter((message) => message.locale === 'en')),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Safe transport error: internal storage/provider diagnostics never leave the server. */
|
|
63
|
+
export function languageOperationFailure(cause: unknown) {
|
|
64
|
+
const status = (cause as { status?: number } | null)?.status;
|
|
65
|
+
return { status: status === 401 ? 401 : status === 403 ? 403 : 400,
|
|
66
|
+
error: status === 401 ? 'Sign in required' : status === 403 ? 'Language settings access denied' : 'Invalid language settings request' };
|
|
67
|
+
}
|
|
@@ -20,6 +20,8 @@ export const PROMPTS_CUSTOMIZE_PERMISSION = 'prompts.customize';
|
|
|
20
20
|
registerPreferenceKind(inferencePreferenceKind, { replace: true });
|
|
21
21
|
registerPermissionDefinitions([
|
|
22
22
|
...INFERENCE_PERMISSION_DEFINITIONS,
|
|
23
|
+
{ slug: 'languages.customize_app', category: 'languages', name: 'Customize App Languages', description: 'Manage interface languages and wording for all workspaces' },
|
|
24
|
+
{ slug: 'languages.customize', category: 'languages', name: 'Customize Languages', description: 'Manage application and workspace interface languages' },
|
|
23
25
|
{
|
|
24
26
|
slug: PROMPTS_CUSTOMIZE_PERMISSION,
|
|
25
27
|
category: 'prompts',
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { isShellSettingsSection } from '@happyvertical/smrt-svelte/app/settings-sections';
|
|
2
|
+
import { defineParams } from '@sveltejs/kit/params';
|
|
3
|
+
|
|
4
|
+
/** The built-in settings sections served by `/settings/[section]`. */
|
|
5
|
+
export const params = defineParams({
|
|
6
|
+
settingsSection: (section: string) =>
|
|
7
|
+
isShellSettingsSection(section) ? section : undefined,
|
|
8
|
+
});
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { createSessionLayoutLoad } from '@happyvertical/smrt-app-runtime/sveltekit';
|
|
2
|
+
import type { ServerLoadEvent } from '@sveltejs/kit';
|
|
3
|
+
import { loadLanguageState } from '#lib/server/i18n.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const sessionLoad = createSessionLayoutLoad();
|
|
6
|
+
|
|
7
|
+
/** Page/data loads own locale state; API requests never build snapshots. */
|
|
8
|
+
export const load = async (event: Pick<ServerLoadEvent, 'locals' | 'url' | 'request' | 'cookies' | 'depends'>) => ({
|
|
9
|
+
...sessionLoad(event),
|
|
10
|
+
...await loadLanguageState(event),
|
|
11
|
+
});
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import LanguageLayout from '#lib/i18n/LanguageLayout.svelte';
|
|
2
3
|
import { page } from '$app/state';
|
|
3
4
|
import { webMcpToolDefinitions } from '@happyvertical/smrt-virt-web';
|
|
4
5
|
import { AppShell } from '@happyvertical/smrt-svelte/app';
|
|
5
6
|
import type { ShellNavItem } from '@happyvertical/smrt-svelte/workspace';
|
|
6
|
-
import
|
|
7
|
+
import LanguageSwitcher from '#lib/i18n/LanguageSwitcher.svelte';
|
|
8
|
+
import { signOut } from '#lib/sign-out.js';
|
|
7
9
|
import type { LayoutProps } from './$types';
|
|
8
10
|
|
|
9
11
|
let { data, children }: LayoutProps = $props();
|
|
10
12
|
|
|
11
13
|
// Add application routes here. Generated REST routes live under /api and do
|
|
12
14
|
// not automatically imply a human-facing page.
|
|
13
|
-
const nav: ShellNavItem[] = [
|
|
14
|
-
{ href: '/settings', label: '
|
|
15
|
-
];
|
|
15
|
+
const nav: ShellNavItem[] = $derived([
|
|
16
|
+
{ href: '/settings', label: data.i18n.messages['app.nav.settings'], icon: 'settings', description: data.i18n.messages['app.nav.settingsDescription'] },
|
|
17
|
+
]);
|
|
16
18
|
|
|
17
19
|
// Generated read-only WebMCP tools, only in browsers that expose WebMCP.
|
|
18
20
|
const webmcp = $derived(
|
|
@@ -22,8 +24,10 @@
|
|
|
22
24
|
);
|
|
23
25
|
</script>
|
|
24
26
|
|
|
27
|
+
<LanguageLayout snapshot={data.i18n} direction={data.direction}>
|
|
25
28
|
<AppShell
|
|
26
29
|
title="s-m-r-t app"
|
|
30
|
+
i18n={data.i18n}
|
|
27
31
|
{webmcp}
|
|
28
32
|
{nav}
|
|
29
33
|
currentHref={page.url.pathname}
|
|
@@ -36,5 +40,7 @@
|
|
|
36
40
|
phoneTabBar
|
|
37
41
|
chrome={!page.route.id?.startsWith('/setup')}
|
|
38
42
|
>
|
|
43
|
+
<LanguageSwitcher snapshot={data.i18n} enabledLocales={data.languageConfiguration.enabledLocales} />
|
|
39
44
|
{@render children()}
|
|
40
45
|
</AppShell>
|
|
46
|
+
</LanguageLayout>
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { useI18n } from '@happyvertical/smrt-ui/i18n';
|
|
3
|
+
import { M } from '#lib/i18n/messages.js';
|
|
4
|
+
const { t } = useI18n();
|
|
2
5
|
import { EmptyState } from '@happyvertical/smrt-ui/layout';
|
|
3
6
|
</script>
|
|
4
7
|
|
|
5
8
|
<svelte:head>
|
|
6
|
-
<title>
|
|
9
|
+
<title>{t(M['app.home.title'])}</title>
|
|
7
10
|
</svelte:head>
|
|
8
11
|
|
|
9
12
|
<main class="smrt-template-home__root">
|
|
10
|
-
<h1>
|
|
13
|
+
<h1>{t(M['app.home.title'])}</h1>
|
|
11
14
|
<EmptyState
|
|
12
|
-
title=
|
|
13
|
-
description=
|
|
15
|
+
title={t(M['app.home.empty'])}
|
|
16
|
+
description={t(M['app.home.description'])}
|
|
14
17
|
/>
|
|
15
18
|
</main>
|
|
16
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SmrtRuntimeLocals } from '@happyvertical/smrt-app-runtime/sveltekit';
|
|
2
2
|
import { createRuntimeReportConfirmHandler } from '@happyvertical/smrt-reports';
|
|
3
|
-
import { runtime } from '
|
|
3
|
+
import { runtime } from '#lib/server/smrt.js';
|
|
4
4
|
|
|
5
5
|
const confirm = createRuntimeReportConfirmHandler();
|
|
6
6
|
|
|
@@ -2,7 +2,7 @@ import { createRuntimeDiagnosticsHandler } from '@happyvertical/smrt-app-runtime
|
|
|
2
2
|
import { RUNTIME_DIAGNOSTICS_WEBMCP_TOOL_NAME } from '@happyvertical/smrt-svelte/app/runtime-diagnostics';
|
|
3
3
|
import { webMcpToolDefinitions } from '@happyvertical/smrt-virt-web';
|
|
4
4
|
|
|
5
|
-
import { runtime } from '
|
|
5
|
+
import { runtime } from '#lib/server/smrt.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Authenticated, authorized (owner role or `runtime_diagnostics.read`) and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRuntimeHealthHandler } from '@happyvertical/smrt-app-runtime/sveltekit';
|
|
2
2
|
|
|
3
|
-
import { runtime } from '
|
|
3
|
+
import { runtime } from '#lib/server/smrt.js';
|
|
4
4
|
|
|
5
5
|
/** Liveness; local responses add the identity `smrt app start` verifies. */
|
|
6
6
|
export const GET = createRuntimeHealthHandler(runtime);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { languageOperationDefinitions, languageOperationSchema } from '@happyvertical/smrt-languages';
|
|
2
|
+
import { mountMcpAppRoute, principalFromSessionLocals } from '@happyvertical/smrt-app-mcp/sveltekit';
|
|
3
|
+
import type { McpWorkflowToolDefinition } from '@happyvertical/smrt-app-mcp';
|
|
4
|
+
import { languageOperationFailure, languageOperations } from '#lib/server/languages.js';
|
|
5
|
+
import { setLanguagePreference } from '#lib/server/language-preference.js';
|
|
6
|
+
import { runtime } from '#lib/server/smrt.js';
|
|
7
|
+
import type { RequestHandler } from './$types';
|
|
8
|
+
|
|
9
|
+
/** Session-only management endpoint. A bearer must NEVER inherit an accompanying cookie. */
|
|
10
|
+
export const POST: RequestHandler = async (event) => {
|
|
11
|
+
if (event.request.headers.has('authorization')) return new Response(null, { status: 401 });
|
|
12
|
+
// Adapt SvelteKit's typed Locals interface to the public minimal event shape.
|
|
13
|
+
const mcpEvent = { request: event.request, url: event.url, locals: { ...event.locals } };
|
|
14
|
+
if (!event.locals.sessionId || !principalFromSessionLocals(mcpEvent)) return new Response(null, { status: 401 });
|
|
15
|
+
try {
|
|
16
|
+
const execute = languageOperations(event.locals);
|
|
17
|
+
const workflowTools: McpWorkflowToolDefinition[] = languageOperationDefinitions.map((definition) => ({
|
|
18
|
+
name: definition.name,
|
|
19
|
+
description: `Language settings: ${definition.operation}. Scope selects the verified workspace or authorized application.`,
|
|
20
|
+
inputSchema: languageOperationSchema(definition.operation),
|
|
21
|
+
outputSchema: { type: 'object', properties: { result: {} }, required: ['result'], additionalProperties: false },
|
|
22
|
+
effect: definition.effect,
|
|
23
|
+
idempotent: !['fillEnqueue', 'fillRetry'].includes(definition.operation),
|
|
24
|
+
openWorld: ['fillEnqueue', 'fillRetry'].includes(definition.operation),
|
|
25
|
+
requiresConfirm: ['reset', 'fillEnqueue', 'fillRetry'].includes(definition.operation),
|
|
26
|
+
execute: async ({ arguments: input }) => {
|
|
27
|
+
// The mount owns `confirm`; it is transport metadata, never a domain option.
|
|
28
|
+
if (Object.hasOwn(input, 'operation') || (Object.hasOwn(input, 'confirm') && !['reset', 'fillEnqueue', 'fillRetry'].includes(definition.operation))) throw new TypeError('Unknown language tool argument');
|
|
29
|
+
const { confirm: _confirm, ...args } = input;
|
|
30
|
+
const result = await execute({ ...args, operation: definition.operation });
|
|
31
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }], structuredContent: { result } };
|
|
32
|
+
},
|
|
33
|
+
mapError: (cause) => {
|
|
34
|
+
const failure = languageOperationFailure(cause);
|
|
35
|
+
return { code: failure.status === 403 ? 'access_denied' : 'invalid_input', message: failure.error };
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
workflowTools.push({
|
|
39
|
+
name: 'languages_locale_set',
|
|
40
|
+
description: 'Persist an enabled interface locale in the requesting HTTP client cookie. This does not change another browser.',
|
|
41
|
+
inputSchema: { type: 'object', properties: { locale: { type: 'string', minLength: 1, maxLength: 100 } }, required: ['locale'], additionalProperties: false },
|
|
42
|
+
outputSchema: { type: 'object', properties: { locale: { type: 'string' }, preferenceTarget: { type: 'string', enum: ['request-client'] } }, required: ['locale', 'preferenceTarget'], additionalProperties: false },
|
|
43
|
+
effect: 'write', idempotent: true, openWorld: false,
|
|
44
|
+
execute: async ({ arguments: input }) => {
|
|
45
|
+
// Public enabled-locale policy, without language management permission.
|
|
46
|
+
const { locale, preferenceTarget } = await setLanguagePreference(input, event);
|
|
47
|
+
const result = { locale, preferenceTarget };
|
|
48
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }], structuredContent: result };
|
|
49
|
+
},
|
|
50
|
+
mapError: () => ({ code: 'invalid_input', message: 'Invalid language preference' }),
|
|
51
|
+
});
|
|
52
|
+
// No generated model tools. [] permits authenticated discovery; domain authorization
|
|
53
|
+
// still checks every call against the verified session and live application gate.
|
|
54
|
+
return await mountMcpAppRoute({ runtime, auth: null, models: [], requiredScopes: [], workflowTools, legacy: 'stateless', awaitResponseCompletion: true })(mcpEvent);
|
|
55
|
+
} catch (cause) {
|
|
56
|
+
const { status, error } = languageOperationFailure(cause);
|
|
57
|
+
return Response.json({ error }, { status });
|
|
58
|
+
}
|
|
59
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { languageOperationFailure, languageOperations } from '#lib/server/languages.js';
|
|
2
|
+
import type { RequestHandler } from './$types';
|
|
3
|
+
|
|
4
|
+
export const GET: RequestHandler = async ({ locals, url }) => {
|
|
5
|
+
try {
|
|
6
|
+
const execute = languageOperations(locals);
|
|
7
|
+
const values: Record<string, string> = Object.create(null);
|
|
8
|
+
for (const [key, value] of url.searchParams) {
|
|
9
|
+
if (Object.hasOwn(values, key)) return Response.json({ error: 'Duplicate language option' }, { status: 400 });
|
|
10
|
+
values[key] = value;
|
|
11
|
+
}
|
|
12
|
+
if ('operation' in values) throw new TypeError('Unexpected operation');
|
|
13
|
+
return Response.json(await execute({ operation: 'inventory', scope: 'tenant', ...values }), { headers: { 'cache-control': 'no-store' } });
|
|
14
|
+
} catch (cause) {
|
|
15
|
+
const { status, error } = languageOperationFailure(cause);
|
|
16
|
+
return Response.json({ error }, { status });
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const POST: RequestHandler = async ({ request, locals, url }) => {
|
|
21
|
+
if (request.headers.get('origin') !== url.origin) return new Response(null, { status: 403 });
|
|
22
|
+
try {
|
|
23
|
+
const execute = languageOperations(locals);
|
|
24
|
+
// API input is closed, including URL parameters; scope belongs in the JSON selection.
|
|
25
|
+
if (url.search) return Response.json({ error: 'Unexpected query parameters' }, { status: 400 });
|
|
26
|
+
const result = await execute(await request.json());
|
|
27
|
+
return Response.json(result, { headers: { 'cache-control': 'no-store' } });
|
|
28
|
+
} catch (cause) {
|
|
29
|
+
const { status, error } = languageOperationFailure(cause);
|
|
30
|
+
return Response.json({ error }, { status });
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RequestHandler } from './$types';
|
|
2
|
+
import { setLanguagePreference } from '#lib/server/language-preference.js';
|
|
3
|
+
|
|
4
|
+
/** Native POST works before hydration; JSON and remote MCP share the same preference operation. */
|
|
5
|
+
export const POST: RequestHandler = async (event) => {
|
|
6
|
+
const { request, url } = event;
|
|
7
|
+
if (request.headers.get('origin') !== url.origin) return new Response('Forbidden', { status: 403 });
|
|
8
|
+
const json = request.headers.get('content-type')?.split(';')[0].trim() === 'application/json';
|
|
9
|
+
try {
|
|
10
|
+
let input: unknown;
|
|
11
|
+
if (json) input = await request.json();
|
|
12
|
+
else {
|
|
13
|
+
const form = await request.formData();
|
|
14
|
+
if (form.getAll('locale').length !== 1 || [...form.keys()].some((key) => key !== 'locale')) throw new TypeError('Invalid locale');
|
|
15
|
+
input = Object.fromEntries(form);
|
|
16
|
+
}
|
|
17
|
+
const { locale, location } = await setLanguagePreference(input, event);
|
|
18
|
+
return json ? Response.json({ locale, location }, { headers: { 'cache-control': 'no-store' } }) : new Response(null, { status: 303, headers: { location } });
|
|
19
|
+
} catch { return new Response('Invalid language preference', { status: 400 }); }
|
|
20
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { error } from '@sveltejs/kit';
|
|
2
2
|
import { assertMaterializedReportRead, findMaterializedReportHost } from '@happyvertical/smrt-reports';
|
|
3
|
-
import { materializedReportHosts } from '
|
|
3
|
+
import { materializedReportHosts } from '#lib/server/materialized-reports.js';
|
|
4
4
|
import type { PageServerLoad } from './$types';
|
|
5
5
|
|
|
6
6
|
function pageValue(value: string | null, fallback: number, maximum: number): number {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
3
|
import { onMount } from 'svelte';
|
|
4
4
|
import { MaterializedReportTable } from '@happyvertical/smrt-reports/svelte';
|
|
5
|
-
import MaterializedReportDrilldown from '
|
|
5
|
+
import MaterializedReportDrilldown from '#lib/components/MaterializedReportDrilldown.svelte';
|
|
6
6
|
import { Alert } from '@happyvertical/smrt-ui/feedback';
|
|
7
7
|
import type { PageProps } from './$types';
|
|
8
8
|
|
|
@@ -52,8 +52,7 @@
|
|
|
52
52
|
url.searchParams.set('offset', String(offset));
|
|
53
53
|
url.searchParams.set('limit', String(data.page.limit));
|
|
54
54
|
await goto(`${url.pathname}?${url.searchParams.toString()}`, {
|
|
55
|
-
|
|
56
|
-
noScroll: true,
|
|
55
|
+
reset: false,
|
|
57
56
|
});
|
|
58
57
|
}
|
|
59
58
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { json } from '@sveltejs/kit';
|
|
2
2
|
import { assertMaterializedReportRead, findMaterializedReportHost } from '@happyvertical/smrt-reports';
|
|
3
|
-
import { materializedReportHosts } from '
|
|
3
|
+
import { materializedReportHosts } from '#lib/server/materialized-reports.js';
|
|
4
4
|
import type { RequestHandler } from './$types';
|
|
5
5
|
|
|
6
6
|
export const POST: RequestHandler = async ({ request, locals, params }) => {
|