@hiai-gg/docsmint 0.3.1 → 0.3.3

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.
Files changed (75) hide show
  1. package/README.md +26 -23
  2. package/backend/src/lib/lifecycle-service.ts +574 -0
  3. package/{packages/sdk/dist → dist}/client.d.ts +16 -1
  4. package/{packages/sdk/dist → dist}/client.js +25 -1
  5. package/dist/frontend/DatePicker-BcMD49PV.js +275 -0
  6. package/dist/frontend/SettingsDialog-DiAyhzw0.js +4852 -0
  7. package/dist/frontend/ShareDialog-DaZf1raY.js +1317 -0
  8. package/dist/frontend/api/categories.d.ts +14 -0
  9. package/dist/frontend/api/categories.js +2 -0
  10. package/dist/frontend/api/documents.d.ts +16 -0
  11. package/dist/frontend/api/documents.js +2 -0
  12. package/dist/frontend/api/folders.d.ts +14 -0
  13. package/dist/frontend/api/folders.js +2 -0
  14. package/dist/frontend/api/settings.d.ts +10 -0
  15. package/dist/frontend/api/settings.js +2 -0
  16. package/dist/frontend/api/tags.d.ts +15 -0
  17. package/dist/frontend/api/tags.js +2 -0
  18. package/dist/frontend/categories-BE6ZpZl8.js +61 -0
  19. package/dist/frontend/client-B9hzI0W8.js +76 -0
  20. package/dist/frontend/client-C6QQGb0e.js +2766 -0
  21. package/dist/frontend/components/settings.d.ts +2 -0
  22. package/dist/frontend/components/settings.js +2 -0
  23. package/dist/frontend/components/sidebar.d.ts +2 -0
  24. package/dist/frontend/components/sidebar.js +4569 -0
  25. package/dist/frontend/context-DbnW5yib.js +31 -0
  26. package/dist/frontend/dashboard.d.ts +2 -0
  27. package/dist/frontend/dashboard.js +2152 -0
  28. package/dist/frontend/documents-DFVS9SsL.js +83 -0
  29. package/dist/frontend/extension.d.ts +35 -0
  30. package/dist/frontend/extension.js +10 -0
  31. package/dist/frontend/folders-CGe9diAG.js +91 -0
  32. package/dist/frontend/frontend.css +2 -0
  33. package/dist/frontend/i18n.d.ts +5 -0
  34. package/dist/frontend/i18n.js +8 -0
  35. package/dist/frontend/input-ieWIt8I7.js +257 -0
  36. package/dist/frontend/messages-CTGAsqFu.js +1106 -0
  37. package/dist/frontend/resolve-Bl6xmJl_.js +2068 -0
  38. package/dist/frontend/schemas-DwtKylCJ.js +3002 -0
  39. package/dist/frontend/search.d.ts +2 -0
  40. package/dist/frontend/search.js +1001 -0
  41. package/dist/frontend/settings-PCrOtied.js +1313 -0
  42. package/dist/frontend/shared-document.d.ts +16 -0
  43. package/dist/frontend/shared-document.js +193 -0
  44. package/dist/frontend/tag-C5xrg-bb.js +53 -0
  45. package/dist/frontend/tag-store.svelte-B3839FYq.js +6152 -0
  46. package/dist/frontend/tags-DVXTut0p.js +48 -0
  47. package/dist/frontend/theme.d.ts +4 -0
  48. package/dist/frontend/theme.js +8 -0
  49. package/dist/frontend/theme.svelte-ei0QxXa8.js +49 -0
  50. package/dist/index.d.ts +7 -0
  51. package/dist/index.js +3 -0
  52. package/dist/lifecycle.d.ts +90 -0
  53. package/dist/lifecycle.js +99 -0
  54. package/{packages/sdk/dist → dist}/types.d.ts +5 -0
  55. package/dist/workspace.d.ts +21 -0
  56. package/dist/workspace.js +66 -0
  57. package/package.json +75 -35
  58. package/packages/cli/src/index.ts +1 -1
  59. package/packages/db/src/schema.ts +41 -0
  60. package/packages/mcp-server/src/index.ts +1 -1
  61. package/frontend/src/lib/components/editor/shared-document.ts +0 -237
  62. package/frontend/src/lib/extensions/context.ts +0 -60
  63. package/frontend/src/lib/extensions/doc-tabs.ts +0 -18
  64. package/frontend/src/lib/extensions/resolve.ts +0 -48
  65. package/frontend/src/lib/extensions/types.ts +0 -202
  66. package/frontend/src/lib/hosts/DocsmintSharedDocumentHost.svelte +0 -65
  67. package/frontend/src/lib/hosts/HiaiDocsDashboardHost.svelte +0 -1007
  68. package/frontend/src/lib/hosts/HiaiDocsExtensionProvider.svelte +0 -20
  69. package/frontend/src/lib/hosts/HiaiDocsSearchHost.svelte +0 -996
  70. package/frontend/src/lib/hosts/index.ts +0 -25
  71. package/frontend/src/lib/index.ts +0 -65
  72. package/frontend/src/lib/stores/doc-tab-registry.svelte.ts +0 -68
  73. package/packages/sdk/dist/index.d.ts +0 -3
  74. package/packages/sdk/dist/index.js +0 -1
  75. /package/{packages/sdk/dist → dist}/types.js +0 -0
@@ -0,0 +1,14 @@
1
+
2
+ import type { z } from "zod";
3
+ export interface CategoryDto { id: string; name: string; order: number; apiMode?: "unavailable" | "global" | "general" | "category" | null; apiPermissionRead?: boolean | null; apiPermissionEdit?: boolean | null; apiPermissionWrite?: boolean | null; createdAt: string; updatedAt: string; documentCount?: number; folderCount?: number; }
4
+ export type Category = CategoryDto;
5
+ export interface CreateCategoryInput { name: string; apiMode?: "unavailable" | "global" | "general" | "category"; apiPermissionRead?: boolean; apiPermissionEdit?: boolean; apiPermissionWrite?: boolean; }
6
+ export interface UpdateCategoryInput { name?: string; order?: number; apiMode?: "unavailable" | "global" | "general" | "category"; apiPermissionRead?: boolean; apiPermissionEdit?: boolean; apiPermissionWrite?: boolean; }
7
+ export declare const createCategoryInputSchema: z.ZodType<CreateCategoryInput>;
8
+ export declare const updateCategoryInputSchema: z.ZodType<UpdateCategoryInput>;
9
+ export declare function listCategories(fetcher?: typeof fetch): Promise<CategoryDto[]>;
10
+ export declare function createCategory(inputOrName: string | CreateCategoryInput): Promise<CategoryDto>;
11
+ export declare function updateCategory(id: string, data: UpdateCategoryInput): Promise<CategoryDto>;
12
+ export declare function deleteCategory(id: string): Promise<void>;
13
+ export declare function setDocumentCategory(documentId: string, categoryId: string | null): Promise<void>;
14
+ export declare function setFolderCategory(folderId: string, categoryId: string | null): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../categories-BE6ZpZl8.js";
2
+ export { s as createCategory, r as createCategoryInputSchema, a as deleteCategory, n as listCategories, e as setDocumentCategory, i as setFolderCategory, o as updateCategory, t as updateCategoryInputSchema };
@@ -0,0 +1,16 @@
1
+
2
+ export interface DocumentTagDto { id: string; name: string; color: string; }
3
+ export interface DocumentDto { id: string; title: string; content: string; contentJson?: unknown; folderId?: string | null; folderName?: string; categoryId?: string | null; tags?: DocumentTagDto[]; excerpt?: string; createdAt: string; updatedAt: string; }
4
+ export type Document = DocumentDto;
5
+ export interface DocumentListResponse { items: DocumentDto[]; total: number; page: number; limit: number; }
6
+ export interface UpdateDocumentInput { title?: string; content?: string; folderId?: string | null; categoryId?: string | null; contentJson?: unknown; expectedUpdatedAt?: string; }
7
+ export interface ImportResult { filename: string; status: "ok" | "error"; document?: DocumentDto; error?: string; }
8
+ export interface ImportResponse { items: ImportResult[]; imported: number; failed: number; }
9
+ export declare function listDocuments(params?: { folderId?: string; tag?: string; page?: number; limit?: number }, fetcher?: typeof fetch): Promise<DocumentListResponse>;
10
+ export declare function getDocument(id: string, fetcher?: typeof fetch): Promise<DocumentDto>;
11
+ export declare function createDocument(data: { title: string; content?: string; folderId?: string; categoryId?: string }, fetcher?: typeof fetch): Promise<DocumentDto>;
12
+ export declare function updateDocument(id: string, data: UpdateDocumentInput): Promise<DocumentDto>;
13
+ export declare function deleteDocument(id: string): Promise<void>;
14
+ export declare function importDocument(file: File, folderId?: string): Promise<DocumentDto>;
15
+ export declare function importDocuments(files: File[], folderId?: string): Promise<ImportResponse>;
16
+ export declare function clearDocumentsCache(...args: readonly unknown[]): void;
@@ -0,0 +1,2 @@
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../documents-DFVS9SsL.js";
2
+ export { s as clearDocumentsCache, r as createDocument, a as deleteDocument, n as getDocument, e as importDocument, i as importDocuments, o as listDocuments, t as updateDocument };
@@ -0,0 +1,14 @@
1
+
2
+ export interface FolderDocumentDto { id: string; title: string; content?: string; folderId: string | null; folderName: string; categoryId?: string | null; tags: string[]; createdAt: string; updatedAt: string; excerpt: string; }
3
+ export interface FolderDto { id: string; name: string; parentId: string | null; categoryId?: string | null; order: number; documentCount: number; subfolderCount: number; children: FolderDto[]; documents: FolderDocumentDto[]; createdAt: string; updatedAt: string; }
4
+ export type Folder = FolderDto;
5
+ export interface CreateFolderData { name: string; parentId?: string | null; categoryId?: string | null; }
6
+ export interface UpdateFolderData { name?: string; parentId?: string | null; categoryId?: string | null; order?: number; }
7
+ export declare function listFolders(parentId?: string | null, all?: boolean, fetcher?: typeof fetch): Promise<FolderDto[]>;
8
+ export declare function getFolder(id: string, fetcher?: typeof fetch): Promise<FolderDto>;
9
+ export declare function getFolderPath(folderId: string, fetcher?: typeof fetch): Promise<Array<{ id: string; name: string }>>;
10
+ export declare function createFolder(data: CreateFolderData): Promise<FolderDto>;
11
+ export declare function updateFolder(id: string, data: UpdateFolderData): Promise<FolderDto>;
12
+ export declare function deleteFolder(id: string): Promise<void>;
13
+ export declare function duplicateDocument(documentId: string): Promise<FolderDocumentDto>;
14
+ export declare function deleteDocument(documentId: string): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../folders-CGe9diAG.js";
2
+ export { s as createFolder, r as deleteDocument, a as deleteFolder, n as duplicateDocument, e as getFolder, i as getFolderPath, o as listFolders, t as updateFolder };
@@ -0,0 +1,10 @@
1
+
2
+ export interface ProfileDto { id: string; name: string; email: string; avatar: string | null; }
3
+ export type UserProfile = ProfileDto;
4
+ export interface EmbeddingConfigDto { baseUrl: string; apiKey: string; model: string; fallbackBaseUrl: string | null; fallbackApiKey: string | null; fallbackModel: string | null; }
5
+ export type EmbeddingConfig = EmbeddingConfigDto;
6
+ export declare function getProfile(): Promise<ProfileDto>;
7
+ export declare function updateProfile(data: { name?: string }): Promise<ProfileDto>;
8
+ export declare function getEmbeddingConfig(): EmbeddingConfigDto;
9
+ export declare function updateEmbeddingConfig(data: Partial<EmbeddingConfigDto>): EmbeddingConfigDto;
10
+ export declare function deleteAccount(): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { a as e, i as t, n, r, t as i } from "../settings-PCrOtied.js";
2
+ export { i as deleteAccount, n as getEmbeddingConfig, r as getProfile, t as updateEmbeddingConfig, e as updateProfile };
@@ -0,0 +1,15 @@
1
+
2
+ import type { z } from "zod";
3
+ export interface TagDto { id: string; name: string; color: string | null; createdAt: string; documentCount?: number; }
4
+ export type Tag = TagDto;
5
+ export interface CreateTagInput { name: string; color?: string; }
6
+ export interface UpdateTagInput { name?: string; color?: string; }
7
+ export declare const createTagInputSchema: z.ZodType<CreateTagInput>;
8
+ export declare const updateTagInputSchema: z.ZodType<UpdateTagInput>;
9
+ export declare function listTags(fetcher?: typeof fetch): Promise<TagDto[]>;
10
+ export declare function getTag(id: string): Promise<TagDto>;
11
+ export declare function createTag(name: string, color?: string): Promise<TagDto>;
12
+ export declare function updateTag(id: string, data: UpdateTagInput): Promise<TagDto>;
13
+ export declare function deleteTag(id: string): Promise<void>;
14
+ export declare function addTagToDocument(documentId: string, tagId: string): Promise<void>;
15
+ export declare function removeTagFromDocument(documentId: string, tagId: string): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../tags-DVXTut0p.js";
2
+ export { c as addTagToDocument, i as createTag, o as createTagInputSchema, n as deleteTag, e as getTag, a as listTags, s as removeTagFromDocument, t as updateTag, r as updateTagInputSchema };
@@ -0,0 +1,61 @@
1
+ import { t as e } from "./client-B9hzI0W8.js";
2
+ import { a as t, i as n, n as r, r as i, t as a } from "./schemas-DwtKylCJ.js";
3
+ //#region src/lib/api/categories.ts
4
+ var o = n({
5
+ name: t().trim().min(1, "Name is required").max(255, "Name must be 255 characters or less"),
6
+ apiMode: a([
7
+ "unavailable",
8
+ "global",
9
+ "general",
10
+ "category"
11
+ ]).optional(),
12
+ apiPermissionRead: r().optional(),
13
+ apiPermissionEdit: r().optional(),
14
+ apiPermissionWrite: r().optional()
15
+ }), s = n({
16
+ name: t().trim().min(1, "Name is required").max(255, "Name must be 255 characters or less").optional(),
17
+ order: i().int().nonnegative().optional(),
18
+ apiMode: a([
19
+ "unavailable",
20
+ "global",
21
+ "general",
22
+ "category"
23
+ ]).optional(),
24
+ apiPermissionRead: r().optional(),
25
+ apiPermissionEdit: r().optional(),
26
+ apiPermissionWrite: r().optional()
27
+ });
28
+ function c(t) {
29
+ return e("/api/categories", {}, t);
30
+ }
31
+ function l(t) {
32
+ let n = o.parse(typeof t == "string" ? { name: t } : t);
33
+ return e("/api/categories", {
34
+ method: "POST",
35
+ body: JSON.stringify(n)
36
+ });
37
+ }
38
+ function u(t, n) {
39
+ let r = s.parse(n);
40
+ return e(`/api/categories/${encodeURIComponent(t)}`, {
41
+ method: "PATCH",
42
+ body: JSON.stringify(r)
43
+ });
44
+ }
45
+ function d(t) {
46
+ return e(`/api/categories/${encodeURIComponent(t)}`, { method: "DELETE" });
47
+ }
48
+ function f(t, n) {
49
+ return e(`/api/documents/${encodeURIComponent(t)}`, {
50
+ method: "PATCH",
51
+ body: JSON.stringify({ categoryId: n })
52
+ });
53
+ }
54
+ function p(t, n) {
55
+ return e(`/api/folders/${encodeURIComponent(t)}`, {
56
+ method: "PATCH",
57
+ body: JSON.stringify({ categoryId: n })
58
+ });
59
+ }
60
+ //#endregion
61
+ export { f as a, s as c, c as i, o as n, p as o, d as r, u as s, l as t };
@@ -0,0 +1,76 @@
1
+ //#region src/lib/api/client.ts
2
+ var e = class extends Error {
3
+ status;
4
+ constructor(e, t) {
5
+ super(e), this.name = "ApiError", this.status = t;
6
+ }
7
+ }, t = class extends Error {
8
+ timeoutMs;
9
+ constructor(e) {
10
+ super(`Request timed out after ${e}ms`), this.timeoutMs = e, this.name = "ApiTimeoutError";
11
+ }
12
+ }, n = class extends Error {
13
+ constructor(e) {
14
+ super(typeof e == "string" ? e : "Request aborted"), this.name = "ApiAbortError";
15
+ }
16
+ }, r = 0, i = [500, 1e3];
17
+ function a(e, t) {
18
+ return new Promise((n, r) => {
19
+ let i = setTimeout(n, e);
20
+ t.signal.addEventListener("abort", () => {
21
+ clearTimeout(i), r(new DOMException("Aborted during retry backoff", "AbortError"));
22
+ }, { once: !0 });
23
+ });
24
+ }
25
+ function o(e) {
26
+ if (!e) return null;
27
+ let t = e.trim();
28
+ if (t.length === 0) return null;
29
+ let n = Number(t);
30
+ return !Number.isFinite(n) || n < 0 ? null : n * 1e3;
31
+ }
32
+ async function s(s, l = {}, u = fetch) {
33
+ let { timeout: d = 1e4, body: f, maxRetries: p = r, ...m } = l, h = new AbortController(), g = !1, _ = setTimeout(() => {
34
+ g = !0, h.abort();
35
+ }, d), v = m.signal ?? null, y = () => h.abort();
36
+ v && (v.aborted ? h.abort() : v.addEventListener("abort", y, { once: !0 }));
37
+ let b = {}, x = typeof f == "object" && !!f && !(f instanceof FormData) && !(f instanceof Blob) && !(f instanceof ArrayBuffer) && !(f instanceof ReadableStream) && !(f instanceof URLSearchParams) && !ArrayBuffer.isView(f), S = f == null ? f : x ? JSON.stringify(f) : f;
38
+ f && !(f instanceof FormData) && (b["Content-Type"] = "application/json");
39
+ try {
40
+ let t = async () => {
41
+ let t = await u(s, {
42
+ ...m,
43
+ body: S,
44
+ signal: h.signal,
45
+ headers: {
46
+ ...b,
47
+ ...m.headers
48
+ },
49
+ credentials: "include"
50
+ });
51
+ if (t.status === 429) throw new c(t.headers.get("Retry-After"));
52
+ if (!t.ok) throw new e((await t.json().catch(() => ({ error: t.statusText }))).error ?? `HTTP ${t.status}`, t.status);
53
+ return t.json();
54
+ };
55
+ for (let e = 0; e <= p; e++) try {
56
+ return await t();
57
+ } catch (t) {
58
+ if (!(t instanceof c) || e === p) throw t;
59
+ let n = o(t.retryAfter), r = i[e] ?? i[i.length - 1];
60
+ await a(Math.min(n ?? r, 1e4), h);
61
+ }
62
+ throw Error("apiFetch: exhausted retries without resolving");
63
+ } catch (r) {
64
+ throw r instanceof DOMException && r.name === "AbortError" ? g ? new t(d) : new n(r.message) : r instanceof c ? new e("Too Many Requests", 429) : r;
65
+ } finally {
66
+ clearTimeout(_), v && v.removeEventListener("abort", y);
67
+ }
68
+ }
69
+ var c = class extends Error {
70
+ retryAfter;
71
+ constructor(e) {
72
+ super("Retry after 429"), this.retryAfter = e, this.name = "Retry429Error";
73
+ }
74
+ };
75
+ //#endregion
76
+ export { s as t };