@hasna/files 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,16 +1,114 @@
1
- export { getDb, DB_PATH } from "./db/database.js";
2
- export { PG_MIGRATIONS } from "./db/pg-migrations.js";
3
- export { getCurrentMachine, listMachines, getMachine, upsertMachine } from "./db/machines.js";
4
- export { createSource, getSource, listSources, updateSource, deleteSource, markSourceIndexed } from "./db/sources.js";
5
- export { upsertFile, getFile, listFiles, searchFiles as searchFilesDb, markFileDeleted, deleteFile, getFileByPath, refreshAllFts } from "./db/files.js";
6
- export { listTags, getOrCreateTag, deleteTag, tagFile, untagFile, getFileTags } from "./db/tags.js";
7
- export { createCollection, listCollections, getCollection, deleteCollection, addToCollection, removeFromCollection } from "./db/collections.js";
8
- export { createProject, listProjects, getProject, deleteProject, addToProject, removeFromProject } from "./db/projects.js";
9
- export { searchFiles } from "./db/search.js";
10
- export { indexLocalSource } from "./lib/indexer.js";
11
- export { indexS3Source, downloadFromS3, uploadToS3, deleteFromS3, headS3Object } from "./lib/s3.js";
12
- export { watchSource, unwatchSource, stopAllWatchers } from "./lib/watcher.js";
13
- export { hashFile, hashBuffer } from "./lib/hasher.js";
14
- export { syncWithPeer, syncWithPeers } from "./lib/sync.js";
15
- export type { Machine, Source, FileRecord, FileWithTags, Tag, Collection, Project, SearchResult, ListFilesOptions, IndexStats, SourceType, FileStatus, S3Config, } from "./types/index.js";
16
- //# sourceMappingURL=index.d.ts.map
1
+ export type SourceType = "local" | "s3";
2
+ export type FileStatus = "active" | "deleted" | "moved";
3
+
4
+ export interface Machine {
5
+ id: string;
6
+ name: string;
7
+ hostname: string;
8
+ platform: string;
9
+ arch: string;
10
+ is_current: boolean;
11
+ last_seen: string;
12
+ created_at: string;
13
+ }
14
+
15
+ export interface S3Config {
16
+ accessKeyId?: string;
17
+ secretAccessKey?: string;
18
+ sessionToken?: string;
19
+ endpoint?: string;
20
+ }
21
+
22
+ export interface Source {
23
+ id: string;
24
+ name: string;
25
+ type: SourceType;
26
+ path?: string;
27
+ bucket?: string;
28
+ prefix?: string;
29
+ region?: string;
30
+ config: S3Config;
31
+ machine_id: string;
32
+ enabled: boolean;
33
+ last_indexed_at?: string;
34
+ file_count: number;
35
+ created_at: string;
36
+ updated_at: string;
37
+ }
38
+
39
+ export interface FileRecord {
40
+ id: string;
41
+ source_id: string;
42
+ machine_id: string;
43
+ path: string;
44
+ name: string;
45
+ ext: string;
46
+ size: number;
47
+ mime: string;
48
+ hash?: string;
49
+ status: FileStatus;
50
+ indexed_at: string;
51
+ modified_at?: string;
52
+ created_at: string;
53
+ }
54
+
55
+ export interface FileWithTags extends FileRecord {
56
+ tags: string[];
57
+ }
58
+
59
+ export interface Tag {
60
+ id: string;
61
+ name: string;
62
+ color: string;
63
+ created_at: string;
64
+ }
65
+
66
+ export interface Collection {
67
+ id: string;
68
+ name: string;
69
+ description: string;
70
+ created_at: string;
71
+ updated_at: string;
72
+ }
73
+
74
+ export interface Project {
75
+ id: string;
76
+ name: string;
77
+ description: string;
78
+ created_at: string;
79
+ updated_at: string;
80
+ }
81
+
82
+ export interface SearchResult extends FileWithTags {
83
+ source_name?: string;
84
+ machine_name?: string;
85
+ rank?: number;
86
+ }
87
+
88
+ export interface ListFilesOptions {
89
+ source_id?: string;
90
+ machine_id?: string;
91
+ tag?: string;
92
+ collection_id?: string;
93
+ project_id?: string;
94
+ ext?: string;
95
+ status?: FileStatus;
96
+ limit?: number;
97
+ offset?: number;
98
+ query?: string;
99
+ after?: string; // ISO date string, filters on modified_at or indexed_at
100
+ before?: string; // ISO date string
101
+ min_size?: number; // bytes
102
+ max_size?: number; // bytes
103
+ sort?: "name" | "size" | "date";
104
+ sort_dir?: "asc" | "desc";
105
+ }
106
+
107
+ export interface IndexStats {
108
+ source_id: string;
109
+ added: number;
110
+ updated: number;
111
+ deleted: number;
112
+ errors: number;
113
+ duration_ms: number;
114
+ }