Clear up index

This commit is contained in:
Andras Schmelczer 2026-04-26 18:25:05 +01:00
parent 439de6a264
commit 0ab6984cdf
11 changed files with 44 additions and 66 deletions

View file

@ -1,5 +1,5 @@
<script lang="ts">
import type { VersionEvent } from "../lib/types";
import type { VersionEvent } from "../lib/view-types";
import {
absoluteTime,
formatBytes

View file

@ -9,12 +9,9 @@
formatBytes,
type View
} from "../lib/stores.svelte";
import type {
DocumentVersionWithoutContent,
VaultHistoryResponse,
VersionEvent,
TreeNode
} from "../lib/types";
import type { DocumentVersionWithoutContent } from "../lib/types/DocumentVersionWithoutContent";
import type { VaultHistoryResponse } from "../lib/types/VaultHistoryResponse";
import type { VersionEvent, TreeNode } from "../lib/view-types";
import FileTree from "./FileTree.svelte";
import ActivityFeed from "./ActivityFeed.svelte";
import DocumentDetail from "./DocumentDetail.svelte";

View file

@ -10,11 +10,9 @@
isImageFile,
fileExtension
} from "../lib/stores.svelte";
import type {
DocumentVersionWithoutContent,
DocumentVersion,
ActionType
} from "../lib/types";
import type { DocumentVersionWithoutContent } from "../lib/types/DocumentVersionWithoutContent";
import type { DocumentVersion } from "../lib/types/DocumentVersion";
import type { ActionType } from "../lib/view-types";
import DiffView from "./DiffView.svelte";
import ConfirmDialog from "./ConfirmDialog.svelte";

View file

@ -1,5 +1,5 @@
<script lang="ts">
import type { TreeNode } from "../lib/types";
import type { TreeNode } from "../lib/view-types";
import FileTree from "./FileTree.svelte";
interface Props {

View file

@ -1,5 +1,5 @@
<script lang="ts">
import type { DocumentVersionWithoutContent } from "../lib/types";
import type { DocumentVersionWithoutContent } from "../lib/types/DocumentVersionWithoutContent";
import { relativeTime, absoluteTime } from "../lib/stores.svelte";
interface Props {

View file

@ -1,7 +1,7 @@
<script lang="ts">
import { auth } from "../lib/stores.svelte";
import { relativeTime } from "../lib/stores.svelte";
import type { VaultInfo } from "../lib/types";
import type { VaultInfo } from "../lib/types/VaultInfo";
function select(vault: VaultInfo) {
auth.selectVault(vault.name);

View file

@ -1,12 +1,10 @@
import type {
DocumentUpdateResponse,
DocumentVersion,
DocumentVersionWithoutContent,
FetchLatestDocumentsResponse,
ListVaultsResponse,
PingResponse,
VaultHistoryResponse
} from "./types";
import type { DocumentUpdateResponse } from "./types/DocumentUpdateResponse";
import type { DocumentVersion } from "./types/DocumentVersion";
import type { DocumentVersionWithoutContent } from "./types/DocumentVersionWithoutContent";
import type { FetchLatestDocumentsResponse } from "./types/FetchLatestDocumentsResponse";
import type { ListVaultsResponse } from "./types/ListVaultsResponse";
import type { PingResponse } from "./types/PingResponse";
import type { VaultHistoryResponse } from "./types/VaultHistoryResponse";
async function fetchJsonWithToken<T>(
path: string,

View file

@ -1,11 +1,7 @@
import { ApiClient } from "./api";
import type {
DocumentVersionWithoutContent,
VaultInfo,
VersionEvent,
ActionType,
TreeNode
} from "./types";
import type { DocumentVersionWithoutContent } from "./types/DocumentVersionWithoutContent";
import type { VaultInfo } from "./types/VaultInfo";
import type { VersionEvent, ActionType, TreeNode } from "./view-types";
class AuthStore {
token = $state("");

View file

@ -1,31 +0,0 @@
import type { DocumentVersionWithoutContent } from "./DocumentVersionWithoutContent";
export type { DocumentUpdateResponse } from "./DocumentUpdateResponse";
export type { DocumentVersion } from "./DocumentVersion";
export type { DocumentVersionWithoutContent } from "./DocumentVersionWithoutContent";
export type { FetchLatestDocumentsResponse } from "./FetchLatestDocumentsResponse";
export type { ListVaultsResponse } from "./ListVaultsResponse";
export type { PingResponse } from "./PingResponse";
export type { VaultInfo } from "./VaultInfo";
export type { VaultHistoryResponse } from "./VaultHistoryResponse";
export type ActionType =
| "created"
| "updated"
| "renamed"
| "deleted"
| "restored";
export interface VersionEvent extends DocumentVersionWithoutContent {
action: ActionType;
previousPath?: string;
}
export interface TreeNode {
name: string;
path: string;
isFolder: boolean;
children: TreeNode[];
document?: DocumentVersionWithoutContent;
isDeleted?: boolean;
}

View file

@ -0,0 +1,22 @@
import type { DocumentVersionWithoutContent } from "./types/DocumentVersionWithoutContent";
export type ActionType =
| "created"
| "updated"
| "renamed"
| "deleted"
| "restored";
export interface VersionEvent extends DocumentVersionWithoutContent {
action: ActionType;
previousPath?: string;
}
export interface TreeNode {
name: string;
path: string;
isFolder: boolean;
children: TreeNode[];
document?: DocumentVersionWithoutContent;
isDeleted?: boolean;
}

View file

@ -8,12 +8,10 @@ cd sync-server
cargo test export_bindings
cd -
# sync-client/src/services/types contains only generated bindings — wipe and copy
# Both target directories contain only generated bindings — wipe and copy
rm -f frontend/sync-client/src/services/types/*.ts
rm -f frontend/history-ui/src/lib/types/*.ts
cp -r sync-server/bindings/* frontend/sync-client/src/services/types/
# history-ui/src/lib/types contains generated bindings plus a hand-written index.ts
find frontend/history-ui/src/lib/types -maxdepth 1 -name "*.ts" ! -name "index.ts" -delete
cp -r sync-server/bindings/* frontend/history-ui/src/lib/types/
cd frontend