Fix wrong type

import, make auth and chat work
This commit is contained in:
Wuesteon 2025-12-04 23:25:25 +01:00
parent b8f9bc107c
commit 9c47119535
261 changed files with 24453 additions and 443 deletions

File diff suppressed because it is too large Load diff

View file

@ -282,14 +282,14 @@ done
**Root Cause:**
Using **type-only imports** (`import { type X }`) for classes that need to be injected. TypeScript erases type-only imports at compile time, so the actual class is not available at runtime for dependency injection.
Using **type-only imports** (`import {X }`) for classes that need to be injected. TypeScript erases type-only imports at compile time, so the actual class is not available at runtime for dependency injection.
### ❌ WRONG - Type-Only Import
```typescript
// services/mana-core-auth/src/ai/ai.service.ts - DON'T DO THIS!
import { Injectable } from '@nestjs/common';
import { type ConfigService } from '@nestjs/config'; // ❌ Type-only import
import { ConfigService } from '@nestjs/config'; // ❌ Type-only import
@Injectable()
export class AiService {
@ -324,12 +324,12 @@ export class AiService {
### The Rule
> **For NestJS dependency injection, NEVER use type-only imports (`import { type X }`) for classes you need to inject.**
> **For NestJS dependency injection, NEVER use type-only imports (`import {X }`) for classes you need to inject.**
- ✅ `import { ConfigService }` - Regular import (works)
- ❌ `import { type ConfigService }` - Type-only import (breaks DI)
- ❌ `import {ConfigService }` - Type-only import (breaks DI)
- ✅ `import type { MyInterface }` - Type-only for interfaces (fine, not injected)
- ✅ `import { type MyType, MyClass }` - Mixed (MyType erased, MyClass available)
- ✅ `import {MyType, MyClass }` - Mixed (MyType erased, MyClass available)
### How to Fix
@ -339,7 +339,7 @@ export class AiService {
```diff
import { Injectable } from '@nestjs/common';
- import { type ConfigService } from '@nestjs/config';
- import {ConfigService } from '@nestjs/config';
+ import { ConfigService } from '@nestjs/config';
@Injectable()
@ -400,7 +400,7 @@ docker run --rm --entrypoint cat test /app/dist/ai/ai.service.js
### Related Issues
- [Commit d69cc607](https://github.com/Memo-2023/manacore-monorepo/commit/d69cc607) - Fixed type-only ConfigService import in AiService
- TypeScript `import type` vs `import { type }` - both erase at compile time
- TypeScript `import type` vs `import {}` - both erase at compile time
- Docker layer caching can hide fixes if source wasn't properly copied
---

View file

@ -1,5 +1,5 @@
import { Injectable } from '@nestjs/common';
import { type AsyncResult, ok, err, NotFoundError, DatabaseError } from '@manacore/shared-errors';
import {AsyncResult, ok, err, NotFoundError, DatabaseError } from '@manacore/shared-errors';
// Define interfaces for our character data
export interface CharacterCreateDto {

View file

@ -10,7 +10,7 @@ import { ImageSupabaseService } from '../../core/services/image-supabase.service
import { CoreService } from '../../core/services/core.service';
import { StoryCharacter, StoryResponse } from '../../core/models/story';
import { StoryError } from '../../core/consts/errors.const';
import { type Result, isOk } from '@manacore/shared-errors';
import {Result, isOk } from '@manacore/shared-errors';
import { StoryLogbookService } from '../../core/services/story-logbook.service';
export interface StoryCreationParams {

View file

@ -16,7 +16,7 @@ import CommonHeader from '../components/molecules/CommonHeader';
import SearchBar from '../components/molecules/SearchBar';
import Avatar from '../components/atoms/Avatar';
import { usePublicCharacters } from '../hooks/usePublicCharacters';
import BottomFilterTabs, { type FilterTab } from '../components/molecules/BottomFilterTabs';
import BottomFilterTabs, {FilterTab } from '../components/molecules/BottomFilterTabs';
export default function DiscoverCharactersScreen() {
const router = useRouter();

View file

@ -17,7 +17,7 @@ import CommonHeader from '../components/molecules/CommonHeader';
import SearchBar from '../components/molecules/SearchBar';
import { usePublicStories } from '../hooks/usePublicStories';
import StoryCardSkeleton from '../components/molecules/StoryCardSkeleton';
import BottomFilterTabs, { type FilterTab } from '../components/molecules/BottomFilterTabs';
import BottomFilterTabs, {FilterTab } from '../components/molecules/BottomFilterTabs';
export default function DiscoverScreen() {
const router = useRouter();

View file

@ -21,7 +21,8 @@ import {
saveCharacterSystemPrompt,
} from '../src/services/promptSettings';
import { generateStory } from '../src/services/genAI';
import { generateCharacter, type GeneratedCharacter } from '../src/services/characterGenAI';
import { generateCharacter } from '../src/services/characterGenAI';
import type { GeneratedCharacter } from '../src/services/characterGenAI';
import { fetchWithAuth } from '../src/utils/api';
type Tab = 'story' | 'character';

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { AppSlider, type AppItem } from '@manacore/shared-ui';
import { AppSlider } from '@manacore/shared-ui';
import type { AppItem } from '@manacore/shared-ui';
import { APP_ICONS } from '@manacore/shared-branding';
import { t } from 'svelte-i18n';

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { toastStore, type Toast, type ToastType } from '$lib/stores/toast.svelte';
import { toastStore } from '$lib/stores/toast.svelte';
import type { Toast, ToastType } from '$lib/stores/toast.svelte';
// Icon paths for each toast type
const icons: Record<ToastType, string> = {

View file

@ -1,5 +1,6 @@
import type { StorytellerUser } from '$lib/types/auth';
import { authService, type UserData } from '$lib/auth';
import { authService } from '$lib/auth';
import type { UserData } from '$lib/auth';
// Svelte 5 runes-based auth store
let user = $state<StorytellerUser | null>(null);

View file

@ -1,4 +1,5 @@
import { createClient, type SupabaseClient } from '@supabase/supabase-js';
import { createClient } from '@supabase/supabase-js';
import type { SupabaseClient } from '@supabase/supabase-js';
import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public';
/**

View file

@ -1,4 +1,4 @@
import React, { type FC, type ReactNode } from 'react';
import React, {FC, type ReactNode } from 'react';
// TODO: Migrate to @expo/ui ContextMenu
import { MenuView } from '~/components/ui/MenuViewPlaceholder';
import type { MenuActionConfig } from '~/config/menuActions';

View file

@ -1,5 +1,6 @@
import { useToast } from '../contexts/ToastContext';
import { useOnboardingStore, type PageName } from '~/features/onboarding';
import { useOnboardingStore } from '~/features/onboarding';
import type { PageName } from '~/features/onboarding';
import { useToastStore } from '../store/toastStore';
import { useTranslation } from 'react-i18next';
import { useEffect, useRef, useCallback, useState } from 'react';

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { AppSlider, type AppItem } from '@manacore/shared-ui';
import { AppSlider } from '@manacore/shared-ui';
import type { AppItem } from '@manacore/shared-ui';
import { APP_ICONS } from '@manacore/shared-branding';
import { theme } from '$lib/stores/theme';
import { t } from 'svelte-i18n';

View file

@ -1,5 +1,6 @@
<script lang="ts" generics="T">
import { onMount, type Snippet } from 'svelte';
import { onMount } from 'svelte';
import type { Snippet } from 'svelte';
interface Props {
items: T[];

View file

@ -4,7 +4,8 @@
* Adapted from memoro_app patterns for SvelteKit
*/
import { authService, type UserData } from './authService';
import { authService } from './authService';
import type { UserData } from './authService';
import { browser } from '$app/environment';
// Token state management

View file

@ -5,7 +5,8 @@
import { writable, derived } from 'svelte/store';
import { browser } from '$app/environment';
import { authService, type UserData } from '$lib/services/authService';
import { authService } from '$lib/services/authService';
import type { UserData } from '$lib/services/authService';
import { tokenManager, TokenState } from '$lib/services/tokenManager';
import { clearAuthClient } from '$lib/supabaseClient';

View file

@ -4,7 +4,8 @@
* Matches memoro_app pattern with dual client approach
*/
import { createClient, type SupabaseClient } from '@supabase/supabase-js';
import { createClient } from '@supabase/supabase-js';
import type { SupabaseClient } from '@supabase/supabase-js';
import { env } from '$lib/config/env';
import { browser } from '$app/environment';
import { tokenManager } from './services/tokenManager';

View file

@ -1236,7 +1236,7 @@ export const useArticleStore = create<ArticleState>((set, get) => ({
loadArticles: async (type) => {
set({ isLoading: true });
try {
const articles = await api.getArticles({ type });
const articles = await api.getArticles({});
set({ articles, isLoading: false });
} catch (error) {
console.error('Failed to load articles:', error);

View file

@ -1,6 +1,7 @@
import { Module, Global, OnModuleDestroy } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { createClient, closeDb, type Database } from '@manacore/nutriphi-database';
import { createClient, closeDb } from '@manacore/nutriphi-database';
import type { Database } from '@manacore/nutriphi-database';
export const DATABASE_TOKEN = 'DATABASE';

View file

@ -1,5 +1,6 @@
import { create } from 'zustand';
import { authService, type UserData, type AuthResult } from '../services/auth/authService';
import { authService } from '../services/auth/authService';
import type { UserData, AuthResult } from '../services/auth/authService';
import { tokenManager } from '../services/auth/tokenManager';
interface AuthState {

View file

@ -1,4 +1,4 @@
import { type Handle } from '@sveltejs/kit';
import {Handle } from '@sveltejs/kit';
/**
* Server hooks for Nutriphi Web

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { AppSlider, type AppItem } from '@manacore/shared-ui';
import { AppSlider } from '@manacore/shared-ui';
import type { AppItem } from '@manacore/shared-ui';
import { MANA_APPS, APP_STATUS_LABELS, APP_SLIDER_LABELS } from '@manacore/shared-branding';
// Convert MANA_APPS to AppItem format (German)

View file

@ -3,7 +3,8 @@
* Handles JWT token lifecycle, refresh logic, and request queueing
*/
import { authService, type UserData } from './authService';
import { authService } from './authService';
import type { UserData } from './authService';
import { browser } from '$app/environment';
export enum TokenState {

View file

@ -5,7 +5,8 @@
import { writable, derived } from 'svelte/store';
import { browser } from '$app/environment';
import { authService, type UserData } from '$lib/services/authService';
import { authService } from '$lib/services/authService';
import type { UserData } from '$lib/services/authService';
import { tokenManager } from '$lib/services/tokenManager';
const STORAGE_KEYS = {

View file

@ -11,7 +11,8 @@ import {
NotFoundException,
} from '@nestjs/common';
import { AuthGuard, CurrentUser } from '@mana-core/nestjs-integration';
import { LinksService, type CreateLinkDto, type UpdateLinkDto } from '../services/links.service';
import { LinksService } from '../services/links.service';
import type { CreateLinkDto, UpdateLinkDto } from '../services/links.service';
@Controller('api/links')
@UseGuards(AuthGuard)

View file

@ -1,5 +1,6 @@
import { Module, Global, OnModuleDestroy, Logger } from '@nestjs/common';
import { getDb, closeDb, type Database } from '@manacore/uload-database';
import { getDb, closeDb } from '@manacore/uload-database';
import type { Database } from '@manacore/uload-database';
export const DATABASE_TOKEN = 'DATABASE';

View file

@ -1,16 +1,8 @@
import { Injectable, Inject, Logger } from '@nestjs/common';
import { DATABASE_TOKEN, type Database } from '../database.module';
import {
clicks,
type Click,
type NewClick,
eq,
desc,
sql,
and,
gte,
lte,
} from '@manacore/uload-database';
import { DATABASE_TOKEN } from '../database.module';
import type { Database } from '../database.module';
import { clicks, eq, desc, sql, and, gte, lte } from '@manacore/uload-database';
import type { Click, NewClick } from '@manacore/uload-database';
export interface ClickStats {
totalClicks: number;

View file

@ -1,16 +1,8 @@
import { Injectable, Inject, Logger } from '@nestjs/common';
import { DATABASE_TOKEN, type Database } from '../database.module';
import {
links,
type Link,
type NewLink,
eq,
and,
desc,
sql,
or,
ilike,
} from '@manacore/uload-database';
import { DATABASE_TOKEN } from '../database.module';
import type { Database } from '../database.module';
import { links, eq, and, desc, sql, or, ilike } from '@manacore/uload-database';
import type { Link, NewLink } from '@manacore/uload-database';
export interface ListLinksOptions {
page?: number;

View file

@ -1,6 +1,7 @@
import { Injectable, Logger } from '@nestjs/common';
import * as UAParser from 'ua-parser-js';
import { ClickRepository, type ClickStats } from '../database/repositories';
import { ClickRepository } from '../database/repositories';
import type { ClickStats } from '../database/repositories';
import { RedirectService } from './redirect.service';
import type { NewClick } from '@manacore/uload-database';

View file

@ -1,7 +1,8 @@
import { Injectable, Logger, BadRequestException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { nanoid } from 'nanoid';
import { LinkRepository, type ListLinksOptions } from '../database/repositories';
import { LinkRepository } from '../database/repositories';
import type { ListLinksOptions } from '../database/repositories';
import type { Link, NewLink } from '@manacore/uload-database';
export interface CreateLinkDto {

View file

@ -1,6 +1,7 @@
---
import BaseLayout from '../../layouts/BaseLayout.astro';
import { getCollection, type CollectionEntry } from 'astro:content';
import { getCollection } from 'astro:content';
import type { CollectionEntry } from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('blog');

View file

@ -1,5 +1,6 @@
import { browser } from '$app/environment';
import { themes, defaultTheme, type ThemePreset } from './presets';
import { themes, defaultTheme } from './presets';
import type { ThemePreset } from './presets';
import { writable, derived, get } from 'svelte/store';
export type ThemeMode = 'light' | 'dark' | 'system';

View file

@ -1,5 +1,6 @@
import { fail } from '@sveltejs/kit';
import { pb, generateTagSlug, DEFAULT_TAG_COLORS, type Tag } from '$lib/pocketbase';
import { pb, generateTagSlug, DEFAULT_TAG_COLORS } from '$lib/pocketbase';
import type { Tag } from '$lib/pocketbase';
import type { Actions, PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ locals }) => {

View file

@ -1,5 +1,6 @@
import { fail } from '@sveltejs/kit';
import { pb, generateShortCode, type Link, type Click, type User } from '$lib/pocketbase';
import { pb, generateShortCode } from '$lib/pocketbase';
import type { Link, Click, User } from '$lib/pocketbase';
import { getCollection } from '$lib/content';
import type { BlogPostWithMeta } from '../content/config';
import type { Actions, PageServerLoad } from './$types';

View file

@ -1,5 +1,6 @@
import { redirect, error, fail } from '@sveltejs/kit';
import { parseUserAgent, type Link } from '$lib/pocketbase';
import { parseUserAgent } from '$lib/pocketbase';
import type { Link } from '$lib/pocketbase';
import { linkCache } from '$lib/server/linkCache';
import type { PageServerLoad, Actions } from './$types';

View file

@ -1,5 +1,6 @@
import { error } from '@sveltejs/kit';
import { pb, type User, type Link } from '$lib/pocketbase';
import { pb } from '$lib/pocketbase';
import type { User, Link } from '$lib/pocketbase';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ params }) => {

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { AppSlider, type AppItem } from '@manacore/shared-ui';
import { AppSlider } from '@manacore/shared-ui';
import type { AppItem } from '@manacore/shared-ui';
import { MANA_APPS, APP_STATUS_LABELS, APP_SLIDER_LABELS } from '@manacore/shared-branding';
// Convert MANA_APPS to AppItem format (German)

View file

@ -4,7 +4,8 @@
*/
import { browser } from '$app/environment';
import { initializeWebAuth, type UserData } from '@manacore/shared-auth';
import { initializeWebAuth } from '@manacore/shared-auth';
import type { UserData } from '@manacore/shared-auth';
// Initialize Mana Core Auth only on the client side
const MANA_AUTH_URL = 'http://localhost:3001';

View file

@ -1,4 +1,5 @@
import { writable, derived, type Writable } from 'svelte/store';
import { writable, derived } from 'svelte/store';
import type { Writable } from 'svelte/store';
import { browser } from '$app/environment';
import type { TranscriptionJob } from '$lib/api/client';

View file

@ -1,6 +1,7 @@
<script lang="ts">
import { onMount } from 'svelte';
import { api, type Stats } from '$lib/api/client';
import { api } from '$lib/api/client';
import type { Stats } from '$lib/api/client';
import { activeJobs, jobList } from '$lib/stores/jobs';
let stats: Stats | null = $state(null);

View file

@ -1,6 +1,7 @@
<script lang="ts">
import { onMount } from 'svelte';
import { api, type Playlist } from '$lib/api/client';
import { api } from '$lib/api/client';
import type { Playlist } from '$lib/api/client';
let playlists = $state<Playlist[]>([]);
let loading = $state(true);

View file

@ -1,8 +1,9 @@
import { Injectable, Inject, NotFoundException } from '@nestjs/common';
import { eq, and } from 'drizzle-orm';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { calendars, type Calendar, type NewCalendar } from '../db/schema/calendars.schema';
import { Database } from '../db/connection';
import { calendars } from '../db/schema/calendars.schema';
import type { Calendar, NewCalendar } from '../db/schema/calendars.schema';
import { CreateCalendarDto, UpdateCalendarDto } from './dto';
@Injectable()

View file

@ -1,6 +1,7 @@
import { Module, Global, OnModuleDestroy } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { getDb, closeConnection, type Database } from './connection';
import { getDb, closeConnection } from './connection';
import type { Database } from './connection';
export const DATABASE_CONNECTION = 'DATABASE_CONNECTION';

View file

@ -1,8 +1,8 @@
import { Injectable, Inject, NotFoundException, ForbiddenException } from '@nestjs/common';
import { eq, and, gte, lte, inArray, or, ilike } from 'drizzle-orm';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { events, type Event, type NewEvent } from '../db/schema/events.schema';
import { Database } from '../db/connection';
import { events, Event, NewEvent } from '../db/schema/events.schema';
import { calendars } from '../db/schema/calendars.schema';
import { CalendarService } from '../calendar/calendar.service';
import { CreateEventDto, UpdateEventDto, QueryEventsDto } from './dto';

View file

@ -2,8 +2,9 @@ import { Injectable, Inject, NotFoundException } from '@nestjs/common';
import { Cron, CronExpression } from '@nestjs/schedule';
import { eq, and, lte } from 'drizzle-orm';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { reminders, type Reminder, type NewReminder } from '../db/schema/reminders.schema';
import { Database } from '../db/connection';
import { reminders } from '../db/schema/reminders.schema';
import type { Reminder, NewReminder } from '../db/schema/reminders.schema';
import { events } from '../db/schema/events.schema';
import { EventService } from '../event/event.service';
import { CreateReminderDto } from './dto';

View file

@ -2,7 +2,7 @@ import { Injectable, Inject, NotFoundException, ForbiddenException } from '@nest
import { eq, and, or } from 'drizzle-orm';
import { randomBytes } from 'crypto';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { Database } from '../db/connection';
import {
calendarShares,
type CalendarShare,

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { AppSlider, type AppItem } from '@manacore/shared-ui';
import { AppSlider } from '@manacore/shared-ui';
import type { AppItem } from '@manacore/shared-ui';
import { MANA_APPS, APP_STATUS_LABELS, APP_SLIDER_LABELS } from '@manacore/shared-branding';
// Convert MANA_APPS to AppItem format (German)

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { toast, type Toast } from '$lib/stores/toast';
import { toast } from '$lib/stores/toast';
import type { Toast } from '$lib/stores/toast';
import { fly } from 'svelte/transition';
let toasts = $state<Toast[]>([]);

View file

@ -4,7 +4,8 @@
*/
import { browser } from '$app/environment';
import { initializeWebAuth, type UserData } from '@manacore/shared-auth';
import { initializeWebAuth } from '@manacore/shared-auth';
import type { UserData } from '@manacore/shared-auth';
// Initialize Mana Core Auth only on the client side
const MANA_AUTH_URL = 'http://localhost:3001';

View file

@ -5,15 +5,12 @@
import { authStore } from '$lib/stores/auth.svelte';
import { theme } from '$lib/stores/theme';
import { userSettings } from '$lib/stores/user-settings.svelte';
import {
settingsStore,
type WeekStartDay,
type TimeFormat,
type AllDayDisplayMode,
} from '$lib/stores/settings.svelte';
import { settingsStore } from '$lib/stores/settings.svelte';
import type { WeekStartDay, TimeFormat, AllDayDisplayMode } from '$lib/stores/settings.svelte';
import { calendarsStore } from '$lib/stores/calendars.svelte';
import { toast } from '$lib/stores/toast';
import { setLocale, supportedLocales, type SupportedLocale } from '$lib/i18n';
import { setLocale, supportedLocales } from '$lib/i18n';
import type { SupportedLocale } from '$lib/i18n';
import { THEME_DEFINITIONS } from '@manacore/shared-theme';
import { GlobalSettingsSection } from '@manacore/shared-ui';
import type { CalendarViewType, Calendar } from '@calendar/shared';

View file

@ -1,8 +1,10 @@
import { Body, Controller, Get, Post, UseGuards } from '@nestjs/common';
import { isOk } from '@manacore/shared-errors';
import { type ChatService } from './chat.service';
import { type ChatCompletionDto, type ChatCompletionResponseDto } from './dto/chat-completion.dto';
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
import { ChatService } from './chat.service';
import { ChatCompletionDto } from './dto/chat-completion.dto';
import type { ChatCompletionResponseDto } from './dto/chat-completion.dto';
import { JwtAuthGuard, CurrentUser } from '@manacore/shared-nestjs-auth';
import type { CurrentUserData } from '@manacore/shared-nestjs-auth';
@Controller('chat')
@UseGuards(JwtAuthGuard)

View file

@ -1,12 +1,14 @@
import { Injectable, Inject, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { eq } from 'drizzle-orm';
import { type AsyncResult, ok, err, ValidationError, ServiceError } from '@manacore/shared-errors';
import { AsyncResult, ok, err, ValidationError, ServiceError } from '@manacore/shared-errors';
import { GoogleGenerativeAI } from '@google/generative-ai';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { models, type Model } from '../db/schema/models.schema';
import { type ChatCompletionDto, type ChatCompletionResponseDto } from './dto/chat-completion.dto';
import { Database } from '../db/connection';
import { models } from '../db/schema/models.schema';
import type { Model } from '../db/schema/models.schema';
import { ChatCompletionDto } from './dto/chat-completion.dto';
import type { ChatCompletionResponseDto } from './dto/chat-completion.dto';
@Injectable()
export class ChatService {

View file

@ -10,10 +10,11 @@ import {
UseGuards,
} from '@nestjs/common';
import { isOk } from '@manacore/shared-errors';
import { type ConversationService } from './conversation.service';
import { type Conversation } from '../db/schema/conversations.schema';
import { type Message } from '../db/schema/messages.schema';
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
import { ConversationService } from './conversation.service';
import { Conversation } from '../db/schema/conversations.schema';
import { Message } from '../db/schema/messages.schema';
import { JwtAuthGuard, CurrentUser } from '@manacore/shared-nestjs-auth';
import type { CurrentUserData } from '@manacore/shared-nestjs-auth';
@Controller('conversations')
@UseGuards(JwtAuthGuard)

View file

@ -1,14 +1,12 @@
import { Injectable, Inject, Logger } from '@nestjs/common';
import { eq, and, desc, asc, sql } from 'drizzle-orm';
import { type AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
import { AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import {
conversations,
type Conversation,
type NewConversation,
} from '../db/schema/conversations.schema';
import { messages, type Message, type NewMessage } from '../db/schema/messages.schema';
import { Database } from '../db/connection';
import { conversations } from '../db/schema/conversations.schema';
import type { Conversation, NewConversation } from '../db/schema/conversations.schema';
import { messages } from '../db/schema/messages.schema';
import type { Message, NewMessage } from '../db/schema/messages.schema';
@Injectable()
export class ConversationService {

View file

@ -1,6 +1,8 @@
import { Module, Global, type OnModuleDestroy } from '@nestjs/common';
import { Module, Global } from '@nestjs/common';
import type { OnModuleDestroy } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { getDb, closeConnection, type Database } from './connection';
import { getDb, closeConnection } from './connection';
import type { Database } from './connection';
export const DATABASE_CONNECTION = 'DATABASE_CONNECTION';

View file

@ -1,8 +1,9 @@
import { Body, Controller, Delete, Get, Param, Post, UseGuards } from '@nestjs/common';
import { isOk } from '@manacore/shared-errors';
import { type DocumentService } from './document.service';
import { type Document } from '../db/schema/documents.schema';
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
import { DocumentService } from './document.service';
import { Document } from '../db/schema/documents.schema';
import { JwtAuthGuard, CurrentUser } from '@manacore/shared-nestjs-auth';
import type { CurrentUserData } from '@manacore/shared-nestjs-auth';
@Controller('documents')
@UseGuards(JwtAuthGuard)

View file

@ -1,9 +1,9 @@
import { Injectable, Inject, Logger } from '@nestjs/common';
import { eq, and, desc, sql } from 'drizzle-orm';
import { type AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
import { AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { documents, type Document, type NewDocument } from '../db/schema/documents.schema';
import { Database } from '../db/connection';
import { documents, Document, NewDocument } from '../db/schema/documents.schema';
import { conversations } from '../db/schema/conversations.schema';
@Injectable()

View file

@ -1,7 +1,7 @@
import { Controller, Get, Param } from '@nestjs/common';
import { isOk } from '@manacore/shared-errors';
import { type ModelService } from './model.service';
import { type Model } from '../db/schema/models.schema';
import { ModelService } from './model.service';
import { Model } from '../db/schema/models.schema';
// Models are publicly accessible - no auth required to list available models
@Controller('models')

View file

@ -1,9 +1,10 @@
import { Injectable, Inject, Logger } from '@nestjs/common';
import { eq, asc } from 'drizzle-orm';
import { type AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
import { AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { models, type Model } from '../db/schema/models.schema';
import { Database } from '../db/connection';
import { models } from '../db/schema/models.schema';
import type { Model } from '../db/schema/models.schema';
@Injectable()
export class ModelService {

View file

@ -1,8 +1,10 @@
import { Body, Controller, Delete, Get, Param, Patch, Post, UseGuards } from '@nestjs/common';
import { isOk } from '@manacore/shared-errors';
import { type SpaceService } from './space.service';
import { type Space, type SpaceMember } from '../db/schema/spaces.schema';
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
import { SpaceService } from './space.service';
import { Space } from '../db/schema/spaces.schema';
import type { SpaceMember } from '../db/schema/spaces.schema';
import { JwtAuthGuard, CurrentUser } from '@manacore/shared-nestjs-auth';
import type { CurrentUserData } from '@manacore/shared-nestjs-auth';
@Controller('spaces')
@UseGuards(JwtAuthGuard)

View file

@ -1,8 +1,8 @@
import { Injectable, Inject, Logger } from '@nestjs/common';
import { eq, and, desc, inArray } from 'drizzle-orm';
import { type AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
import { AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { Database } from '../db/connection';
import {
spaces,
spaceMembers,

View file

@ -1,8 +1,9 @@
import { Body, Controller, Delete, Get, Param, Patch, Post, UseGuards } from '@nestjs/common';
import { isOk } from '@manacore/shared-errors';
import { type TemplateService } from './template.service';
import { type Template } from '../db/schema/templates.schema';
import { JwtAuthGuard, CurrentUser, type CurrentUserData } from '@manacore/shared-nestjs-auth';
import { TemplateService } from './template.service';
import { Template } from '../db/schema/templates.schema';
import { JwtAuthGuard, CurrentUser } from '@manacore/shared-nestjs-auth';
import type { CurrentUserData } from '@manacore/shared-nestjs-auth';
@Controller('templates')
@UseGuards(JwtAuthGuard)

View file

@ -1,9 +1,10 @@
import { Injectable, Inject, Logger } from '@nestjs/common';
import { eq, and, asc } from 'drizzle-orm';
import { type AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
import { AsyncResult, ok, err, DatabaseError, NotFoundError } from '@manacore/shared-errors';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { templates, type Template, type NewTemplate } from '../db/schema/templates.schema';
import { Database } from '../db/connection';
import { templates } from '../db/schema/templates.schema';
import type { Template, NewTemplate } from '../db/schema/templates.schema';
@Injectable()
export class TemplateService {

View file

@ -1,7 +1,8 @@
/**
* Document Service - CRUD operations via Backend API
*/
import { documentApi, type Document as ApiDocument } from './api';
import { documentApi } from './api';
import type { Document as ApiDocument } from './api';
// Re-export type with backwards-compatible naming (snake_case for mobile)
export interface Document {

View file

@ -3,7 +3,8 @@
* This service wraps the backend API for AI completions
*/
import { availableModels } from '../config/azure';
import { chatApi, modelApi, usageApi, type ChatMessage, type TokenUsage } from './api';
import { chatApi, modelApi, usageApi } from './api';
import type { ChatMessage, TokenUsage } from './api';
// Re-export types for backward compatibility
export type { ChatMessage };

View file

@ -1,7 +1,8 @@
/**
* Space Service - CRUD operations via Backend API
*/
import { spaceApi, type Space as ApiSpace, type SpaceMember as ApiSpaceMember } from './api';
import { spaceApi } from './api';
import type { Space as ApiSpace, SpaceMember as ApiSpaceMember } from './api';
// Re-export types with backwards-compatible naming (snake_case for mobile)
export type Space = {

View file

@ -1,7 +1,8 @@
/**
* Template Service - CRUD operations via Backend API
*/
import { templateApi, type Template as ApiTemplate } from './api';
import { templateApi } from './api';
import type { Template as ApiTemplate } from './api';
// Re-export type with backwards-compatible naming (snake_case for mobile)
export interface Template {

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { AppSlider, type AppItem } from '@manacore/shared-ui';
import { AppSlider } from '@manacore/shared-ui';
import type { AppItem } from '@manacore/shared-ui';
import { MANA_APPS, APP_STATUS_LABELS, APP_SLIDER_LABELS } from '@manacore/shared-branding';
// Convert MANA_APPS to AppItem format (German)

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { toastStore, type Toast } from '$lib/stores/toast.svelte';
import { toastStore } from '$lib/stores/toast.svelte';
import type { Toast } from '$lib/stores/toast.svelte';
import { X, CheckCircle, XCircle, Warning, Info } from '@manacore/shared-icons';
let toasts = $derived(toastStore.toasts);

View file

@ -5,7 +5,8 @@
* so we don't need to pass it from the frontend.
*/
import { conversationApi, chatApi, type Conversation, type Message, type ChatMessage } from './api';
import { conversationApi, chatApi } from './api';
import type { Conversation, Message, ChatMessage } from './api';
export type { Conversation, Message };

View file

@ -2,7 +2,8 @@
* Document Service - CRUD operations via Backend API
*/
import { documentApi, conversationApi, type Document } from './api';
import { documentApi, conversationApi } from './api';
import type { Document } from './api';
export type { Document };

View file

@ -2,7 +2,8 @@
* Space Service - CRUD operations via Backend API
*/
import { spaceApi, type Space, type SpaceMember } from './api';
import { spaceApi } from './api';
import type { Space, SpaceMember } from './api';
export type { Space, SpaceMember };

View file

@ -2,7 +2,8 @@
* Template Service - CRUD operations via Backend API
*/
import { templateApi, type Template } from './api';
import { templateApi } from './api';
import type { Template } from './api';
export type { Template };

View file

@ -4,7 +4,8 @@
*/
import { browser } from '$app/environment';
import { initializeWebAuth, type UserData } from '@manacore/shared-auth';
import { initializeWebAuth } from '@manacore/shared-auth';
import type { UserData } from '@manacore/shared-auth';
import { PUBLIC_MANA_CORE_AUTH_URL } from '$env/static/public';
// Initialize Mana Core Auth only on the client side

View file

@ -2,7 +2,8 @@
* Chat Store - Manages current chat state using Svelte 5 runes
*/
import { chatService, type ChatCompletionRequest } from '$lib/services/chat';
import { chatService } from '$lib/services/chat';
import type { ChatCompletionRequest } from '$lib/services/chat';
import type { Message, AIModel, ChatMessage } from '@chat/types';
// State

View file

@ -2,7 +2,8 @@
import { onMount } from 'svelte';
import { theme } from '$lib/stores/theme';
import { userSettings } from '$lib/stores/user-settings.svelte';
import { THEME_DEFINITIONS, type ThemeVariant } from '@manacore/shared-theme';
import { THEME_DEFINITIONS } from '@manacore/shared-theme';
import type { ThemeVariant } from '@manacore/shared-theme';
import {
SettingsPage,
SettingsSection,

View file

@ -1,8 +1,9 @@
import { Injectable, Inject } from '@nestjs/common';
import { eq, and, desc } from 'drizzle-orm';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { contactActivities, type ContactActivity, type NewContactActivity } from '../db/schema';
import { Database } from '../db/connection';
import { contactActivities } from '../db/schema';
import type { ContactActivity, NewContactActivity } from '../db/schema';
export type ActivityType = 'created' | 'updated' | 'called' | 'emailed' | 'met' | 'note_added';

View file

@ -1,8 +1,9 @@
import { Injectable, Inject, NotFoundException } from '@nestjs/common';
import { eq, and, or, ilike, desc, sql } from 'drizzle-orm';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { contacts, type Contact, type NewContact } from '../db/schema';
import { Database } from '../db/connection';
import { contacts } from '../db/schema';
import type { Contact, NewContact } from '../db/schema';
export interface ContactFilters {
search?: string;

View file

@ -1,6 +1,7 @@
import { Module, Global, OnModuleDestroy } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { getDb, closeConnection, type Database } from './connection';
import { getDb, closeConnection } from './connection';
import type { Database } from './connection';
export const DATABASE_CONNECTION = 'DATABASE_CONNECTION';

View file

@ -1,7 +1,7 @@
import { Injectable, Inject, NotFoundException } from '@nestjs/common';
import { eq, and } from 'drizzle-orm';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { Database } from '../db/connection';
import {
contactGroups,
contactToGroups,

View file

@ -1,8 +1,9 @@
import { Injectable, Inject, NotFoundException } from '@nestjs/common';
import { eq, and, desc } from 'drizzle-orm';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { contactNotes, type ContactNote, type NewContactNote } from '../db/schema';
import { Database } from '../db/connection';
import { contactNotes } from '../db/schema';
import type { ContactNote, NewContactNote } from '../db/schema';
@Injectable()
export class NoteService {

View file

@ -1,8 +1,9 @@
import { Injectable, Inject, NotFoundException } from '@nestjs/common';
import { eq, and } from 'drizzle-orm';
import { DATABASE_CONNECTION } from '../db/database.module';
import { type Database } from '../db/connection';
import { contactTags, contactToTags, type ContactTag, type NewContactTag } from '../db/schema';
import { Database } from '../db/connection';
import { contactTags, contactToTags } from '../db/schema';
import type { ContactTag, NewContactTag } from '../db/schema';
@Injectable()
export class TagService {

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { AppSlider, type AppItem } from '@manacore/shared-ui';
import { AppSlider } from '@manacore/shared-ui';
import type { AppItem } from '@manacore/shared-ui';
import { MANA_APPS, APP_STATUS_LABELS, APP_SLIDER_LABELS } from '@manacore/shared-branding';
// Convert MANA_APPS to AppItem format (German)

View file

@ -1,6 +1,7 @@
<script lang="ts">
import { locale } from 'svelte-i18n';
import { setLocale, supportedLocales, type SupportedLocale } from '$lib/i18n';
import { setLocale, supportedLocales } from '$lib/i18n';
import type { SupportedLocale } from '$lib/i18n';
const languageLabels: Record<SupportedLocale, string> = {
de: 'Deutsch',

View file

@ -1,5 +1,6 @@
<script lang="ts">
import { toasts, type Toast } from '$lib/stores/toast';
import { toasts } from '$lib/stores/toast';
import type { Toast } from '$lib/stores/toast';
function getIcon(type: Toast['type']) {
switch (type) {

View file

@ -4,7 +4,8 @@
*/
import { browser } from '$app/environment';
import { initializeWebAuth, type UserData } from '@manacore/shared-auth';
import { initializeWebAuth } from '@manacore/shared-auth';
import type { UserData } from '@manacore/shared-auth';
// Initialize Mana Core Auth only on the client side
// TODO: Use PUBLIC_MANA_CORE_AUTH_URL from env when available

View file

@ -2,7 +2,8 @@
* Contacts Store - Manages contacts state using Svelte 5 runes
*/
import { contactsApi, type Contact, type ContactFilters } from '$lib/api/contacts';
import { contactsApi } from '$lib/api/contacts';
import type { Contact, ContactFilters } from '$lib/api/contacts';
// State
let contacts = $state<Contact[]>([]);

View file

@ -1,7 +1,8 @@
<script lang="ts">
import { onMount } from 'svelte';
import { goto } from '$app/navigation';
import { contactsApi, type Contact } from '$lib/api/contacts';
import { contactsApi } from '$lib/api/contacts';
import type { Contact } from '$lib/api/contacts';
import '$lib/i18n';
let loading = $state(true);

View file

@ -2,7 +2,8 @@
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
import { contactsApi, type Contact } from '$lib/api/contacts';
import { contactsApi } from '$lib/api/contacts';
import type { Contact } from '$lib/api/contacts';
import '$lib/i18n';
let contact = $state<Contact | null>(null);

View file

@ -1,7 +1,8 @@
<script lang="ts">
import { onMount } from 'svelte';
import { goto } from '$app/navigation';
import { contactsApi, type Contact } from '$lib/api/contacts';
import { contactsApi } from '$lib/api/contacts';
import type { Contact } from '$lib/api/contacts';
import '$lib/i18n';
let loading = $state(true);

View file

@ -1,7 +1,8 @@
<script lang="ts">
import { onMount } from 'svelte';
import { goto } from '$app/navigation';
import { groupsApi, type ContactGroup } from '$lib/api/contacts';
import { groupsApi } from '$lib/api/contacts';
import type { ContactGroup } from '$lib/api/contacts';
import '$lib/i18n';
let loading = $state(true);

View file

@ -2,7 +2,8 @@
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { groupsApi, contactsApi, type ContactGroup, type Contact } from '$lib/api/contacts';
import { groupsApi, contactsApi } from '$lib/api/contacts';
import type { ContactGroup, Contact } from '$lib/api/contacts';
import '$lib/i18n';
let loading = $state(true);

View file

@ -1,6 +1,7 @@
---
import { Icon } from 'astro-icon/components';
import { languages, type Language } from '../../lib/i18n/config';
import { languages } from '../../lib/i18n/config';
import type { Language } from '../../lib/i18n/config';
import { getRouteFromUrl, getLocalizedRoute } from '../../lib/i18n/utils';
export interface Props {

View file

@ -11,9 +11,10 @@ import {
import { Stack } from 'expo-router';
import { FontAwesome5 } from '@expo/vector-icons';
import { Container } from '~/components/Container';
import { useTheme, type ThemeMode } from '~/utils/themeContext';
import { useTheme } from '~/utils/themeContext';
import type { ThemeMode } from '~/utils/themeContext';
import { supabase } from '../../utils/supabase';
import { type Session } from '@supabase/supabase-js';
import { Session } from '@supabase/supabase-js';
interface Profile {
id: string;

View file

@ -5,7 +5,7 @@ import { Stack, useRouter, useSegments } from 'expo-router';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { ThemeProvider } from '~/utils/themeContext';
import { supabase } from '../utils/supabase';
import { type Session } from '@supabase/supabase-js';
import { Session } from '@supabase/supabase-js';
export const unstable_settings = {
// Ensure that reloading on `/modal` keeps a back button present.

View file

@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import { View, Text, TextInput, TouchableOpacity, StyleSheet, Alert } from 'react-native';
import { supabase } from '../utils/supabase';
import { type Session } from '@supabase/supabase-js';
import { Session } from '@supabase/supabase-js';
interface Profile {
id: string;

View file

@ -1,5 +1,6 @@
import { forwardRef } from 'react';
import { Text, TouchableOpacity, type TouchableOpacityProps, type View } from 'react-native';
import { Text, TouchableOpacity } from 'react-native';
import type { TouchableOpacityProps, View } from 'react-native';
type ButtonProps = {
title: string;

View file

@ -9,7 +9,7 @@ import {
ScrollView,
} from 'react-native';
import { supabase } from '../utils/supabase';
import { type Session } from '@supabase/supabase-js';
import { Session } from '@supabase/supabase-js';
import { useTheme } from '../utils/themeContext';
interface UserRole {

View file

@ -9,7 +9,7 @@ import {
ScrollView,
} from 'react-native';
import { supabase } from '../utils/supabase';
import { type Session } from '@supabase/supabase-js';
import { Session } from '@supabase/supabase-js';
import { useTheme } from '../utils/themeContext';
import { useRouter } from 'expo-router';

Some files were not shown because too many files have changed in this diff Show more