refactor: move lib-root files to lib/shared/ and finalize domain structure

- Move api.server.ts, errors.ts, types.ts, utils.ts, relativeTime.ts to lib/shared/
- Move person relationship components to lib/person/relationship/
- Move Stammbaum components to lib/person/genealogy/
- Move HelpPopover to lib/shared/primitives/
- Update all import paths across routes, specs, and lib files
- Update vi.mock() paths in server-project test files
- Remove now-empty legacy directories (components/, hooks/, server/, etc.)
- Update vite.config.ts coverage include paths for new structure
- Update frontend/CLAUDE.md to reflect domain-based lib/ layout

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-05 14:53:31 +02:00
parent efcc347c00
commit 567612761d
119 changed files with 186 additions and 167 deletions

View File

@@ -35,24 +35,40 @@ src/
│ ├── api/ # Internal API proxies (server-side only)
│ ├── login/ logout/ # Auth pages
│ └── ...
├── lib/
│ ├── components/ # Reusable Svelte components
│ │ ├── document/ # Document-specific components
│ │ ├── chronik/ # Activity feed components
│ │ └── user/ # User-related components
├── lib/ # Domain-based package structure (mirrors backend)
│ ├── document/ # Document domain: components, stores, services, utils
│ │ ├── annotation/ # Annotation overlay components
│ │ ├── comment/ # Comment thread components
│ │ └── transcription/ # Transcription editor + block logic
│ ├── person/ # Person domain: chips, typeahead, avatar, format
│ │ ├── relationship/ # Relationship form + chip components
│ │ └── genealogy/ # Stammbaum (family tree) components
│ ├── tag/ # Tag domain: TagInput, TagChipList, TagParentPicker
│ ├── geschichte/ # Geschichte (story) domain: editor + card
│ ├── notification/ # Notification bell + dropdown + store
│ ├── activity/ # Activity feed (Chronik) components
│ ├── conversation/ # Bilateral conversation (Briefwechsel) components
│ ├── ocr/ # OCR progress, training cards, trigger
│ ├── user/ # User profile/password/groups section components
│ ├── shared/ # Cross-domain utilities and primitives
│ │ ├── actions/ # Svelte actions (clickOutside, etc.)
│ │ ├── hooks/ # Reusable Svelte state hooks (useTypeahead, etc.)
│ │ ├── server/ # Server-only utilities (locale, session)
│ │ ├── services/ # Client-side service helpers
│ │ ├── utils/ # Pure utility functions (date, search, etc.)
│ │ ├── primitives/ # Generic UI primitives (BackButton, ProgressRing, etc.)
│ │ ├── dashboard/ # Dashboard stat components
│ │ ├── discussion/ # CommentThread + shared discussion UI
│ │ ├── help/ # Help/FAQ page components
│ │ ├── api.server.ts # Typed API client factory
│ │ ├── errors.ts # Error code mapping (mirrors backend ErrorCode)
│ │ ├── types.ts # Shared TypeScript types
│ │ ├── relativeTime.ts # Relative time formatting
│ │ └── utils.ts # Top-level shared utilities
│ ├── generated/ # Auto-generated API types (openapi-typescript)
│ ├── server/ # Server-only utilities (db, auth helpers)
│ ├── services/ # Client-side service logic
│ ├── stores/ # Svelte stores (global state)
│ ├── types.ts # Shared TypeScript types
│ ├── errors.ts # Error code mapping (mirrors backend ErrorCode)
│ ├── api.server.ts # Typed API client factory
│ ├── utils.ts # Shared utilities
│ ├── relativeTime.ts # Time formatting
│ ├── search.ts # Search utilities
│ └── paraglide/ # Generated i18n code
├── hooks/ # SvelteKit hooks (handle, handleFetch)
└── actions/ # Custom Svelte actions (click outside, etc.)
└── ... # Other SvelteKit config files
```
## API Client Pattern
@@ -130,14 +146,15 @@ Card pattern for content sections:
## Key UI Components
| Component | Props | Description |
| -------------------- | ---------------------------------------------------- | ------------------------------------- |
| `PersonTypeahead` | `name`, `label`, `value`, `initialName`, `on:change` | Single-person selector with typeahead |
| `PersonMultiSelect` | `selectedPersons` (bind) | Chip-based multi-person selector |
| `TagInput` | `tags` (bind), `allowCreation?`, `on:change` | Tag chip input with typeahead |
| `PdfViewer` | `url`, `annotations`, `on:annotation` | PDF rendering with annotation overlay |
| `TranscriptionBlock` | `block`, `mode` | Read/edit transcription block |
| `DocumentTopBar` | `document` | Responsive document metadata header |
| Component | Location | Props | Description |
| -------------------- | ------------------------------ | --------------------------------------- | ------------------------------------------ |
| `PersonTypeahead` | `$lib/person/` | `name`, `label`, `value`, `initialName` | Single-person selector with typeahead |
| `PersonMultiSelect` | `$lib/person/` | `selectedPersons` (bind) | Chip-based multi-person selector |
| `TagInput` | `$lib/tag/` | `tags` (bind), `allowCreation?` | Tag chip input with typeahead |
| `PdfViewer` | `$lib/document/` | `url`, `annotations` | PDF rendering with annotation overlay |
| `TranscriptionBlock` | `$lib/document/transcription/` | `block`, `mode` | Read/edit transcription block |
| `DocumentTopBar` | `$lib/document/` | `document` | Responsive document metadata header |
| `BackButton` | `$lib/shared/primitives/` | — | Calls `history.back()`; 44 px touch target |
## How to Run

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import * as m from '$lib/paraglide/messages.js';
import { relativeTimeDe } from '$lib/relativeTime';
import { relativeTimeDe } from '$lib/shared/relativeTime';
type IncompleteDoc = {
id: string;

View File

@@ -3,7 +3,7 @@ import { m } from '$lib/paraglide/messages.js';
import { formatDate } from '$lib/shared/utils/date';
import { formatDocumentStatus } from '$lib/document/documentStatusLabel';
import { getInitials, personAvatarColor } from '$lib/person/personFormat';
import RelationshipPill from '$lib/person/RelationshipPill.svelte';
import RelationshipPill from '$lib/person/relationship/RelationshipPill.svelte';
type Person = { id: string; firstName?: string | null; lastName: string; displayName: string };
type Tag = { id: string; name: string };

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import { getContext } from 'svelte';
import type { Annotation } from '$lib/types';
import type { Annotation } from '$lib/shared/types';
import { m } from '$lib/paraglide/messages.js';
type UpdateAnnotationFn = (

View File

@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { render } from 'vitest-browser-svelte';
import AnnotationEditOverlay from './AnnotationEditOverlay.svelte';
import type { Annotation } from '$lib/types';
import type { Annotation } from '$lib/shared/types';
const annotation: Annotation = {
id: 'ann-1',

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import type { Annotation } from '$lib/types';
import type { Annotation } from '$lib/shared/types';
import AnnotationShape from './AnnotationShape.svelte';
type DrawRect = {

View File

@@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest';
import { render } from 'vitest-browser-svelte';
import { page } from 'vitest/browser';
import AnnotationLayer from './AnnotationLayer.svelte';
import type { Annotation } from '$lib/types';
import type { Annotation } from '$lib/shared/types';
const annotation: Annotation = {
id: 'ann-1',

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import type { Annotation } from '$lib/types';
import type { Annotation } from '$lib/shared/types';
import AnnotationEditOverlay from './AnnotationEditOverlay.svelte';
let {

View File

@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { render } from 'vitest-browser-svelte';
import AnnotationShape from './AnnotationShape.svelte';
import type { Annotation } from '$lib/types';
import type { Annotation } from '$lib/shared/types';
const annotation: Annotation = {
id: 'ann-1',

View File

@@ -3,7 +3,7 @@ import { m } from '$lib/paraglide/messages.js';
import { getConfirmService } from '$lib/shared/services/confirm.svelte.js';
import CommentThread from '$lib/shared/discussion/CommentThread.svelte';
import PersonMentionEditor from '$lib/shared/discussion/PersonMentionEditor.svelte';
import type { PersonMention } from '$lib/types';
import type { PersonMention } from '$lib/shared/types';
const { confirm } = getConfirmService();

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { provideConfirmService, type ConfirmService } from '$lib/shared/services/confirm.svelte.js';
import TranscriptionBlock from './TranscriptionBlock.svelte';
import type { PersonMention } from '$lib/types';
import type { PersonMention } from '$lib/shared/types';
type BlockProps = {
blockId: string;

View File

@@ -3,7 +3,7 @@ import { m } from '$lib/paraglide/messages.js';
import TranscriptionBlock from './TranscriptionBlock.svelte';
import OcrTrigger from '$lib/ocr/OcrTrigger.svelte';
import TranscribeCoachEmptyState from '$lib/shared/help/TranscribeCoachEmptyState.svelte';
import type { PersonMention, TranscriptionBlockData } from '$lib/types';
import type { PersonMention, TranscriptionBlockData } from '$lib/shared/types';
import { createBlockAutoSave } from '$lib/document/transcription/useBlockAutoSave.svelte';
import { createBlockDragDrop } from '$lib/document/transcription/useBlockDragDrop.svelte';

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { m } from '$lib/paraglide/messages.js';
import { getLocale } from '$lib/paraglide/runtime.js';
import HelpPopover from '$lib/shared/help/HelpPopover.svelte';
import HelpPopover from '$lib/shared/primitives/HelpPopover.svelte';
type Props = {
mode: 'read' | 'edit';

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import type { TranscriptionBlockData } from '$lib/types';
import type { TranscriptionBlockData } from '$lib/shared/types';
import type { components } from '$lib/generated/api';
import { splitByMarkers } from '$lib/document/transcription/transcriptionMarkers';
import {

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, vi, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import TranscriptionReadView from './TranscriptionReadView.svelte';
import type { TranscriptionBlockData } from '$lib/types';
import type { TranscriptionBlockData } from '$lib/shared/types';
const PERSON_ID = '11111111-0000-0000-0000-000000000001';

View File

@@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import { page } from 'vitest/browser';
import TranscriptionReadView from './TranscriptionReadView.svelte';
import type { TranscriptionBlockData } from '$lib/types';
import type { TranscriptionBlockData } from '$lib/shared/types';
const blocks: TranscriptionBlockData[] = [
{

View File

@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { BlockConflictResolvedError, mergeBlockOnConflict } from './blockConflictMerge';
import type { PersonMention, TranscriptionBlockData } from '$lib/types';
import type { PersonMention, TranscriptionBlockData } from '$lib/shared/types';
const baseBlock: TranscriptionBlockData = {
id: 'b1',

View File

@@ -1,4 +1,4 @@
import type { PersonMention, TranscriptionBlockData } from '$lib/types';
import type { PersonMention, TranscriptionBlockData } from '$lib/shared/types';
/**
* Sentinel thrown by saveBlockWithConflictRetry after a 409 rename-mid-edit

View File

@@ -1,7 +1,7 @@
import { describe, it, expect, vi } from 'vitest';
import { saveBlockWithConflictRetry } from './saveBlockWithConflictRetry';
import { BlockConflictResolvedError } from './blockConflictMerge';
import type { PersonMention } from '$lib/types';
import type { PersonMention } from '$lib/shared/types';
const DOC = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa';
const BLK = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb';

View File

@@ -1,4 +1,4 @@
import type { PersonMention, TranscriptionBlockData } from '$lib/types';
import type { PersonMention, TranscriptionBlockData } from '$lib/shared/types';
import {
BlockConflictResolvedError,
mergeBlockOnConflict

View File

@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach, afterEach, type Mock } from 'vitest';
import type { PersonMention } from '$lib/types';
import type { PersonMention } from '$lib/shared/types';
const mockSaveFn =
vi.fn<(blockId: string, text: string, mentionedPersons: PersonMention[]) => Promise<void>>();

View File

@@ -1,5 +1,5 @@
import { SvelteMap } from 'svelte/reactivity';
import type { PersonMention } from '$lib/types';
import type { PersonMention } from '$lib/shared/types';
export type SaveState = 'idle' | 'saving' | 'saved' | 'fading' | 'error';

View File

@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import { createBlockDragDrop } from './useBlockDragDrop.svelte';
import type { TranscriptionBlockData } from '$lib/types';
import type { TranscriptionBlockData } from '$lib/shared/types';
function makeBlock(id: string, sortOrder: number): TranscriptionBlockData {
return {

View File

@@ -1,4 +1,4 @@
import type { TranscriptionBlockData } from '$lib/types';
import type { TranscriptionBlockData } from '$lib/shared/types';
type Options = {
getSortedBlocks: () => TranscriptionBlockData[];

View File

@@ -3,9 +3,9 @@ import { onMount, setContext } from 'svelte';
import { createPdfRenderer } from '$lib/document/viewer/usePdfRenderer.svelte';
import PdfControls from './PdfControls.svelte';
import AnnotationLayer from '$lib/document/annotation/AnnotationLayer.svelte';
import type { Annotation } from '$lib/types';
import type { Annotation } from '$lib/shared/types';
import { m } from '$lib/paraglide/messages.js';
import { parseBackendError, getErrorMessage } from '$lib/errors';
import { parseBackendError, getErrorMessage } from '$lib/shared/errors';
type DrawRect = { x: number; y: number; width: number; height: number; pageNumber: number };

View File

@@ -1,8 +1,8 @@
<script lang="ts">
import { enhance } from '$app/forms';
import { m } from '$lib/paraglide/messages.js';
import RelationshipChip from '$lib/person/RelationshipChip.svelte';
import AddRelationshipForm from '$lib/person/AddRelationshipForm.svelte';
import RelationshipChip from '$lib/person/relationship/RelationshipChip.svelte';
import AddRelationshipForm from '$lib/person/relationship/AddRelationshipForm.svelte';
import { chipLabel, otherName, inferredRelationshipLabel } from '$lib/person/relationshipLabels';
import type { components } from '$lib/generated/api';

View File

@@ -4,8 +4,8 @@ import { page } from 'vitest/browser';
import StammbaumCard from './StammbaumCard.svelte';
vi.mock('$app/forms', () => ({ enhance: () => () => {} }));
vi.mock('$lib/person/RelationshipChip.svelte', () => ({ default: () => null }));
vi.mock('$lib/person/AddRelationshipForm.svelte', () => ({ default: () => null }));
vi.mock('$lib/person/relationship/RelationshipChip.svelte', () => ({ default: () => null }));
vi.mock('$lib/person/relationship/AddRelationshipForm.svelte', () => ({ default: () => null }));
afterEach(cleanup);

View File

@@ -3,8 +3,8 @@ import { onMount } from 'svelte';
import { invalidateAll } from '$app/navigation';
import { m } from '$lib/paraglide/messages.js';
import { chipLabel, otherName, inferredRelationshipLabel } from '$lib/person/relationshipLabels';
import AddRelationshipForm from '$lib/person/AddRelationshipForm.svelte';
import type { RelFormData } from '$lib/person/AddRelationshipForm.svelte';
import AddRelationshipForm from '$lib/person/relationship/AddRelationshipForm.svelte';
import type { RelFormData } from '$lib/person/relationship/AddRelationshipForm.svelte';
import type { components } from '$lib/generated/api';
type PersonNodeDTO = components['schemas']['PersonNodeDTO'];

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import { m } from '$lib/paraglide/messages.js';
import type { FlatMessage } from '$lib/types';
import type { FlatMessage } from '$lib/shared/types';
import { extractQuote } from '$lib/shared/discussion/comment';
import { getInitials } from '$lib/person/personFormat';
import { relativeTime } from '$lib/shared/utils/time';

View File

@@ -2,7 +2,7 @@ import { describe, it, expect, vi, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import { page, userEvent } from 'vitest/browser';
import CommentMessage from './CommentMessage.svelte';
import type { FlatMessage } from '$lib/types';
import type { FlatMessage } from '$lib/shared/types';
afterEach(cleanup);

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount, untrack } from 'svelte';
import { m } from '$lib/paraglide/messages.js';
import type { Comment, FlatMessage, MentionDTO } from '$lib/types';
import type { Comment, FlatMessage, MentionDTO } from '$lib/shared/types';
import MentionEditor from '$lib/shared/discussion/MentionEditor.svelte';
import CommentMessage from '$lib/shared/discussion/CommentMessage.svelte';
import { extractContent } from '$lib/shared/discussion/mention';

View File

@@ -2,7 +2,7 @@ import { describe, it, expect, vi, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import { page } from 'vitest/browser';
import CommentThread from './CommentThread.svelte';
import type { Comment } from '$lib/types';
import type { Comment } from '$lib/shared/types';
afterEach(() => {
cleanup();

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { onDestroy, tick } from 'svelte';
import { detectMention } from '$lib/shared/discussion/mention';
import type { MentionDTO } from '$lib/types';
import type { MentionDTO } from '$lib/shared/types';
import { m } from '$lib/paraglide/messages.js';
type Props = {

View File

@@ -5,7 +5,7 @@ import StarterKit from '@tiptap/starter-kit';
import { Mention } from '@tiptap/extension-mention';
import { m } from '$lib/paraglide/messages.js';
import type { components } from '$lib/generated/api';
import type { PersonMention } from '$lib/types';
import type { PersonMention } from '$lib/shared/types';
import { deserialize, serialize } from '$lib/shared/discussion/mentionSerializer';
import MentionDropdown from './MentionDropdown.svelte';

View File

@@ -6,7 +6,7 @@ import {
renderBody,
renderTranscriptionBody
} from './mention';
import type { MentionDTO, PersonMention } from '$lib/types';
import type { MentionDTO, PersonMention } from '$lib/shared/types';
// ─── escapeHtml ───────────────────────────────────────────────────────────────

View File

@@ -1,4 +1,4 @@
import type { MentionDTO, PersonMention } from '$lib/types';
import type { MentionDTO, PersonMention } from '$lib/shared/types';
/**
* Single-source CSS selector for rendered person-mention anchors. Used by:

View File

@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { deserialize, serialize } from './mentionSerializer';
import type { PersonMention } from '$lib/types';
import type { PersonMention } from '$lib/shared/types';
// ─── deserialize ─────────────────────────────────────────────────────────────

View File

@@ -1,5 +1,5 @@
import type { JSONContent } from '@tiptap/core';
import type { PersonMention } from '$lib/types';
import type { PersonMention } from '$lib/shared/types';
/**
* Converts stored block text + sidecar into a Tiptap ProseMirror document.

View File

@@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit';
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
import type { components } from '$lib/generated/api';
type StatsDTO = components['schemas']['StatsDTO'];

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { invalidateAll } from '$app/navigation';
import { m } from '$lib/paraglide/messages.js';
import { getErrorMessage } from '$lib/errors';
import { getErrorMessage } from '$lib/shared/errors';
const ACCEPTED_TYPES = ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff'];

View File

@@ -1,7 +1,7 @@
import { error } from '@sveltejs/kit';
import { env } from '$env/dynamic/private';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
import type { components } from '$lib/generated/api';
type UserGroup = components['schemas']['UserGroup'];

View File

@@ -1,4 +1,4 @@
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
import type { LayoutServerLoad } from './$types';
export const load: LayoutServerLoad = async ({ fetch }) => {

View File

@@ -1,7 +1,7 @@
import { error, fail, redirect } from '@sveltejs/kit';
import type { PageServerLoad, Actions } from './$types';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
export const load: PageServerLoad = async ({ params, parent }) => {
const { groups } = await parent();

View File

@@ -6,7 +6,7 @@ const mockApi = {
DELETE: vi.fn()
};
vi.mock('$lib/api.server', () => ({
vi.mock('$lib/shared/api.server', () => ({
createApiClient: () => mockApi
}));

View File

@@ -1,9 +1,9 @@
import { describe, expect, it, vi, beforeEach } from 'vitest';
import { load } from './+layout.server';
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
function mockApi(groups: unknown[]) {
vi.mocked(createApiClient).mockReturnValue({

View File

@@ -1,7 +1,7 @@
import { fail, redirect } from '@sveltejs/kit';
import type { Actions } from './$types';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
export const actions: Actions = {
default: async ({ request, fetch }) => {

View File

@@ -1,6 +1,6 @@
import { fail } from '@sveltejs/kit';
import { env } from '$env/dynamic/private';
import { parseBackendError } from '$lib/errors';
import { parseBackendError } from '$lib/shared/errors';
import type { Actions, PageServerLoad } from './$types';
export interface InviteListItem {

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { enhance } from '$app/forms';
import { m } from '$lib/paraglide/messages.js';
import { getErrorMessage } from '$lib/errors';
import { getErrorMessage } from '$lib/shared/errors';
import type { InviteListItem } from './+page.server.ts';
let {

View File

@@ -1,9 +1,9 @@
import { describe, expect, it, vi, beforeEach } from 'vitest';
import { load } from './+layout.server';
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
function mockApi(users: unknown[], groups: unknown[], tags: unknown[]) {
vi.mocked(createApiClient).mockReturnValue({

View File

@@ -1,7 +1,7 @@
import { error } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
export const load: PageServerLoad = async ({ fetch }) => {
const api = createApiClient(fetch);

View File

@@ -1,7 +1,7 @@
import { error } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
export const load: PageServerLoad = async ({ params, fetch }) => {
const api = createApiClient(fetch);

View File

@@ -3,7 +3,7 @@ import { load } from './+page.server';
const mockApi = { GET: vi.fn() };
vi.mock('$lib/api.server', () => ({ createApiClient: () => mockApi }));
vi.mock('$lib/shared/api.server', () => ({ createApiClient: () => mockApi }));
beforeEach(() => vi.clearAllMocks());

View File

@@ -1,7 +1,7 @@
import { error } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
export const load: PageServerLoad = async ({ fetch }) => {
const api = createApiClient(fetch);

View File

@@ -3,7 +3,7 @@ import { load } from './+page.server';
const mockApi = { GET: vi.fn() };
vi.mock('$lib/api.server', () => ({ createApiClient: () => mockApi }));
vi.mock('$lib/shared/api.server', () => ({ createApiClient: () => mockApi }));
beforeEach(() => vi.clearAllMocks());

View File

@@ -3,7 +3,7 @@ import { load } from './+page.server';
const mockApi = { GET: vi.fn() };
vi.mock('$lib/api.server', () => ({ createApiClient: () => mockApi }));
vi.mock('$lib/shared/api.server', () => ({ createApiClient: () => mockApi }));
beforeEach(() => vi.clearAllMocks());

View File

@@ -1,4 +1,4 @@
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
import type { components } from '$lib/generated/api';
import type { LayoutServerLoad } from './$types';

View File

@@ -1,7 +1,7 @@
import { error, fail, redirect } from '@sveltejs/kit';
import type { PageServerLoad, Actions } from './$types';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
export const load: PageServerLoad = async ({ params, parent, url }) => {
const { tags } = await parent();

View File

@@ -7,7 +7,7 @@ const mockApi = {
DELETE: vi.fn()
};
vi.mock('$lib/api.server', () => ({
vi.mock('$lib/shared/api.server', () => ({
createApiClient: () => mockApi
}));

View File

@@ -1,9 +1,9 @@
import { describe, expect, it, vi, beforeEach } from 'vitest';
import { load } from './+layout.server';
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
function mockTreeApi(tree: unknown[]) {
vi.mocked(createApiClient).mockReturnValue({

View File

@@ -1,4 +1,4 @@
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
import type { LayoutServerLoad } from './$types';
export const load: LayoutServerLoad = async ({ fetch }) => {

View File

@@ -1,7 +1,7 @@
import { error, fail, redirect } from '@sveltejs/kit';
import type { PageServerLoad, Actions } from './$types';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
export const load: PageServerLoad = async ({ params, fetch, locals }) => {
const user = locals.user;

View File

@@ -1,9 +1,9 @@
import { describe, expect, it, vi, beforeEach } from 'vitest';
import { load } from './+layout.server';
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
function mockApi(users: unknown[]) {
vi.mocked(createApiClient).mockReturnValue({

View File

@@ -1,7 +1,7 @@
import { error, fail, redirect } from '@sveltejs/kit';
import type { PageServerLoad, Actions } from './$types';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
export const load: PageServerLoad = async ({ fetch, locals }) => {
const user = locals.user;

View File

@@ -1,4 +1,4 @@
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
import type { components, operations } from '$lib/generated/api';
type ActivityFeedItemDTO = components['schemas']['ActivityFeedItemDTO'];

View File

@@ -5,7 +5,7 @@ const mockApi = {
GET: vi.fn()
};
vi.mock('$lib/api.server', () => ({
vi.mock('$lib/shared/api.server', () => ({
createApiClient: () => mockApi
}));

View File

@@ -1,7 +1,7 @@
import { error } from '@sveltejs/kit';
import type { components } from '$lib/generated/api';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
export async function load({ url, fetch, locals }) {
const senderId = url.searchParams.get('senderId') || '';

View File

@@ -1,10 +1,12 @@
import { describe, expect, it, vi, beforeEach } from 'vitest';
import { load } from './+page.server';
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
vi.mock('$lib/errors', () => ({ getErrorMessage: (code: string) => code ?? 'Unknown error' }));
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
vi.mock('$lib/shared/errors', () => ({
getErrorMessage: (code: string) => code ?? 'Unknown error'
}));
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
const writeUser = { groups: [{ permissions: ['WRITE_ALL'] }] };
const readUser = { groups: [{ permissions: ['READ_ALL'] }] };

View File

@@ -1,6 +1,6 @@
import { redirect } from '@sveltejs/kit';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
import type { components } from '$lib/generated/api';
type DocumentSearchItem = components['schemas']['DocumentSearchItem'];

View File

@@ -8,7 +8,7 @@ import DocumentList from '../DocumentList.svelte';
import Pagination from '$lib/shared/primitives/Pagination.svelte';
import BulkSelectionBar from '$lib/document/BulkSelectionBar.svelte';
import { bulkSelectionStore } from '$lib/document/bulkSelection.svelte';
import { getErrorMessage, parseBackendError } from '$lib/errors';
import { getErrorMessage, parseBackendError } from '$lib/shared/errors';
import * as m from '$lib/paraglide/messages.js';
let { data } = $props();

View File

@@ -1,6 +1,6 @@
import { error, redirect } from '@sveltejs/kit';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
import { inferredRelationshipLabel } from '$lib/person/relationshipLabels';
export async function load({ params, fetch }) {

View File

@@ -8,8 +8,8 @@ import DocumentViewer from '$lib/document/DocumentViewer.svelte';
import TranscriptionEditView from '$lib/document/transcription/TranscriptionEditView.svelte';
import TranscriptionReadView from '$lib/document/transcription/TranscriptionReadView.svelte';
import TranscriptionPanelHeader from '$lib/document/transcription/TranscriptionPanelHeader.svelte';
import type { TranscriptionBlockData } from '$lib/types';
import { getErrorMessage } from '$lib/errors';
import type { TranscriptionBlockData } from '$lib/shared/types';
import { getErrorMessage } from '$lib/shared/errors';
import { translateOcrProgress } from '$lib/ocr/translateOcrProgress';
import { createFileLoader } from '$lib/document/viewer/useFileLoader.svelte';
import { scrollToCommentFromQuery } from '$lib/shared/utils/deepLinkScroll';
@@ -91,7 +91,7 @@ async function loadTranscriptionBlocks() {
async function saveBlock(
blockId: string,
text: string,
mentionedPersons: import('$lib/types').PersonMention[]
mentionedPersons: import('$lib/shared/types').PersonMention[]
) {
const { saveBlockWithConflictRetry } =
await import('$lib/document/transcription/saveBlockWithConflictRetry');

View File

@@ -1,7 +1,7 @@
import { error, fail, redirect } from '@sveltejs/kit';
import { env } from '$env/dynamic/private';
import { createApiClient } from '$lib/api.server';
import { parseBackendError, getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { parseBackendError, getErrorMessage } from '$lib/shared/errors';
export async function load({
params,

View File

@@ -1,10 +1,10 @@
import { describe, expect, it, vi, beforeEach } from 'vitest';
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
vi.mock('$env/dynamic/private', () => ({ env: { API_INTERNAL_URL: 'http://test-backend:8080' } }));
import { load } from './+page.server';
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
beforeEach(() => vi.clearAllMocks());

View File

@@ -5,7 +5,7 @@ import { bulkSelectionStore } from '$lib/document/bulkSelection.svelte';
import BulkDocumentEditLayout, {
type BulkEditEntry
} from '$lib/document/BulkDocumentEditLayout.svelte';
import { getErrorMessage, parseBackendError } from '$lib/errors';
import { getErrorMessage, parseBackendError } from '$lib/shared/errors';
import { m } from '$lib/paraglide/messages.js';
let entries = $state<BulkEditEntry[]>([]);

View File

@@ -1,7 +1,7 @@
import { fail, redirect } from '@sveltejs/kit';
import { env } from '$env/dynamic/private';
import { createApiClient } from '$lib/api.server';
import { parseBackendError, getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { parseBackendError, getErrorMessage } from '$lib/shared/errors';
export async function load({
fetch,

View File

@@ -1,9 +1,9 @@
import { describe, expect, it, vi, beforeEach } from 'vitest';
vi.mock('$lib/api.server', () => ({ createApiClient: vi.fn() }));
vi.mock('$lib/shared/api.server', () => ({ createApiClient: vi.fn() }));
import { load } from './+page.server';
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
beforeEach(() => vi.clearAllMocks());

View File

@@ -1,5 +1,5 @@
import { redirect } from '@sveltejs/kit';
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
export async function load({
fetch,

View File

@@ -1,7 +1,7 @@
import { error, redirect } from '@sveltejs/kit';
import { env } from '$env/dynamic/private';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage, parseBackendError } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage, parseBackendError } from '$lib/shared/errors';
export async function load({
params,

View File

@@ -1,6 +1,6 @@
import { fail } from '@sveltejs/kit';
import type { Actions } from './$types';
import { createApiClient } from '$lib/api.server';
import { createApiClient } from '$lib/shared/api.server';
export const actions = {
default: async ({ request, fetch }) => {

View File

@@ -1,6 +1,6 @@
import { error } from '@sveltejs/kit';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
import type { components } from '$lib/generated/api';
import type { PageServerLoad } from './$types';

View File

@@ -1,6 +1,6 @@
import { error } from '@sveltejs/kit';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ params, fetch }) => {

View File

@@ -1,6 +1,6 @@
import { error, redirect } from '@sveltejs/kit';
import { createApiClient } from '$lib/api.server';
import { getErrorMessage } from '$lib/errors';
import { createApiClient } from '$lib/shared/api.server';
import { getErrorMessage } from '$lib/shared/errors';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ params, fetch, parent }) => {

View File

@@ -3,7 +3,7 @@ import { goto } from '$app/navigation';
import { m } from '$lib/paraglide/messages.js';
import GeschichteEditor from '$lib/geschichte/GeschichteEditor.svelte';
import BackButton from '$lib/shared/primitives/BackButton.svelte';
import { getErrorMessage } from '$lib/errors';
import { getErrorMessage } from '$lib/shared/errors';
import type { PageData } from './$types';
let { data }: { data: PageData } = $props();

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