@tomradex/files 0.17.0 → 0.17.2

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.
@@ -0,0 +1,41 @@
1
+ import { type FileContent, type FileEntry, type FileSearchInput, type FileSearchResult, type FileStore, type FilesStatus, type WriteEntry } from "./types.js";
2
+ /**
3
+ * The files folder as it is, for a machine without git: every read and write
4
+ * works on the folder itself; versions, undo and sharing wait until git is
5
+ * there, and the next open then keeps the same folder under git.
6
+ */
7
+ export declare class FolderFileStore implements FileStore {
8
+ readonly dir: string;
9
+ private readonly opts;
10
+ constructor(dir: string, opts: {
11
+ detail: string;
12
+ onChange(): void;
13
+ });
14
+ private abs;
15
+ private readDir;
16
+ list(dir?: string): Promise<FileEntry[]>;
17
+ tree(): Promise<FileEntry[]>;
18
+ read(p: string): Promise<FileContent | null>;
19
+ readVersion(): Promise<FileContent | null>;
20
+ resolveVersion(): Promise<null>;
21
+ locate(): Promise<string | null>;
22
+ history(): Promise<[]>;
23
+ write(p: string, body: Buffer, opts?: {
24
+ expect?: string | null;
25
+ }): Promise<FileContent>;
26
+ writeMany(entries: WriteEntry[]): Promise<void>;
27
+ mkdir(p: string): Promise<void>;
28
+ private pair;
29
+ move(from: string, to: string): Promise<void>;
30
+ copy(from: string, to: string): Promise<void>;
31
+ remove(p: string): Promise<void>;
32
+ settle(): Promise<boolean>;
33
+ /** A plain scan; literal unless asked, and a file too large to read whole is skipped. */
34
+ search(input: FileSearchInput): Promise<FileSearchResult>;
35
+ status(): Promise<FilesStatus>;
36
+ sync(): Promise<FilesStatus>;
37
+ conflicts(): Promise<[]>;
38
+ resolve(): Promise<void>;
39
+ close(): void;
40
+ }
41
+ //# sourceMappingURL=folder-store.d.ts.map
@@ -5,6 +5,8 @@ export declare const IDS_DIR = ".tomrade-files";
5
5
  export declare const IDS_FILE = ".tomrade-files/ids.jsonl";
6
6
  /** The most of a binary file a read hands back; anything a ticket body links must fit. */
7
7
  export declare const BINARY_LIMIT: number;
8
+ export declare const TREE_LIMIT = 20000;
9
+ export declare const sha256: (bytes: Buffer) => string;
8
10
  export interface GitRemoteTarget {
9
11
  url: string;
10
12
  branch: string;
@@ -45,6 +47,7 @@ export interface Ledger {
45
47
  * last claimed it.
46
48
  */
47
49
  export declare function parseLedger(text: string): Ledger;
50
+ export declare function contentOf(rel: string, bytes: Buffer, fileId: string | null, versionId: string | null): FileContent;
48
51
  /**
49
52
  * A folder of files kept as a git repository: every save is a version, ids
50
53
  * follow files across renames, and a remote — when the backend supplies one —
@@ -132,7 +135,6 @@ export declare class GitFileStore implements FileStore {
132
135
  /** The version a path last changed in; asked of git once for files from before this was kept. */
133
136
  private versionOf;
134
137
  private showBuffer;
135
- private contentOf;
136
138
  private entryOf;
137
139
  private readDir;
138
140
  list(dir?: string): Promise<FileEntry[]>;
package/dist/service.d.ts CHANGED
@@ -191,6 +191,8 @@ export declare class Files extends Service implements FilesReader {
191
191
  folderFor(projectId: string, itemId: string): string;
192
192
  /** Agents name tickets by key as often as by id, like every other item tool accepts. */
193
193
  private ticketOf;
194
+ /** A ticket links a file by id and version; a folder without git has neither, and pretending would break the link once git arrives. */
195
+ private needVersions;
194
196
  /** `path` inside the ticket's workstream folder. */
195
197
  pathFor(projectId: string, itemId: string, p: string): string;
196
198
  /** Bring files from this machine into the ticket's workstream folder and pin them in one go. */
package/dist/types.d.ts CHANGED
@@ -14,6 +14,8 @@ export interface FilesStatus {
14
14
  behind: number;
15
15
  /** The latest version, null until something has been saved. */
16
16
  head: string | null;
17
+ /** True for a store that keeps no versions — no git on this machine: no history, undo, ticket pins or sharing. */
18
+ versionless?: boolean;
17
19
  }
18
20
  export type FileChange = "added" | "modified" | "deleted" | "renamed" | "conflicted";
19
21
  /** Sharing intent, independent of whether a remote is connected or reachable. */
package/dist/words.d.ts CHANGED
@@ -13,6 +13,9 @@ export declare const FILES_WORDS: import("@tomradex/domain").WordBook<{
13
13
  readonly stateConflicted: "conflicted";
14
14
  readonly stateOffline: "offline";
15
15
  readonly stateError: "error";
16
+ readonly noGit: "Versions, undo and attaching files to tickets need git, which is not installed on this computer";
17
+ readonly noGitShared: "Sharing these files, versions, undo and attaching files to tickets need git, which is not installed on this computer; the files stay in this folder until then";
18
+ readonly needsGit: "This needs git, which is not installed on this computer: install git to keep versions of files and attach them to tickets";
16
19
  }>;
17
20
  /** The states with a word of their own; any other is shown as it is. */
18
21
  export declare const FILES_STATE_WORD: Partial<Record<FilesSyncState, "stateSynced" | "stateConflicted" | "stateOffline" | "stateError">>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomradex/files",
3
- "version": "0.17.0",
3
+ "version": "0.17.2",
4
4
  "type": "module",
5
5
  "author": "Haoyuan Tang",
6
6
  "engines": {
@@ -27,21 +27,21 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@tomradex/agent": "0.17.0",
31
- "@tomradex/boards": "0.17.0",
32
- "@tomradex/contracts": "0.17.0",
33
- "@tomradex/contributions": "0.17.0",
34
- "@tomradex/db": "0.17.0",
35
- "@tomradex/domain": "0.2.24",
36
- "@tomradex/git": "0.17.0",
37
- "@tomradex/hub": "0.17.0",
38
- "@tomradex/ipc": "0.17.0",
39
- "@tomradex/items": "0.17.0",
40
- "@tomradex/oplog": "0.17.0",
41
- "@tomradex/settings": "0.17.0",
42
- "@tomradex/storage": "0.17.0",
43
- "@tomradex/tools": "0.17.0",
44
- "@tomradex/write": "0.17.0",
30
+ "@tomradex/agent": "0.17.2",
31
+ "@tomradex/boards": "0.17.2",
32
+ "@tomradex/contracts": "0.17.2",
33
+ "@tomradex/contributions": "0.17.2",
34
+ "@tomradex/db": "0.17.2",
35
+ "@tomradex/domain": "0.2.26",
36
+ "@tomradex/git": "0.17.2",
37
+ "@tomradex/hub": "0.17.2",
38
+ "@tomradex/ipc": "0.17.2",
39
+ "@tomradex/items": "0.17.2",
40
+ "@tomradex/oplog": "0.17.2",
41
+ "@tomradex/settings": "0.17.2",
42
+ "@tomradex/storage": "0.17.2",
43
+ "@tomradex/tools": "0.17.2",
44
+ "@tomradex/write": "0.17.2",
45
45
  "cordis": "4.0.0-rc.8",
46
46
  "zod": "^4.4.3"
47
47
  }