@rljson/fs-agent 0.2.1 → 0.2.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.
- package/README.api.md +12 -4
- package/README.architecture.md +56 -1
- package/README.md +2 -2
- package/README.public.md +34 -6
- package/README.tests.md +30 -8
- package/dist/README.api.md +12 -4
- package/dist/README.architecture.md +56 -1
- package/dist/README.md +2 -2
- package/dist/README.public.md +34 -6
- package/dist/README.tests.md +30 -8
- package/dist/fs-agent.d.ts +111 -5
- package/dist/fs-agent.js +632 -179
- package/dist/fs-carry.d.ts +40 -0
- package/dist/fs-ignore.d.ts +9 -0
- package/dist/fs-scanner.d.ts +12 -1
- package/dist/fs-send.d.ts +14 -1
- package/dist/fs_agent_version.d.ts +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Tree } from '@rljson/rljson';
|
|
2
|
+
import { FsTree } from './fs-scanner.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The nodes of a tree a scan with this ignore rule leaves out.
|
|
5
|
+
*
|
|
6
|
+
* Walked from the root, as the scanner walks the folder: an ignored directory
|
|
7
|
+
* is taken whole, with everything below it, and nothing below it is asked.
|
|
8
|
+
* @param tree - The tree, typically a head's.
|
|
9
|
+
* @param ignores - The scanner's rule: a path, and whether it is a directory.
|
|
10
|
+
* @returns The left-out nodes, files and directories, by path.
|
|
11
|
+
*/
|
|
12
|
+
export declare const carriedNodes: (tree: FsTree, ignores: (path: string, isDirectory: boolean) => boolean) => Map<string, Tree>;
|
|
13
|
+
/**
|
|
14
|
+
* A file node holding a version of another file under a new path — a merge
|
|
15
|
+
* keeping both versions of one file.
|
|
16
|
+
* @param path - Where the version is kept.
|
|
17
|
+
* @param blobId - The version.
|
|
18
|
+
* @param size - Its size in bytes.
|
|
19
|
+
* @returns The node, hashed, in the scanner's own format.
|
|
20
|
+
*/
|
|
21
|
+
export declare const fileNode: (path: string, blobId: string, size: number) => Tree;
|
|
22
|
+
/**
|
|
23
|
+
* A tree holding what `tree` holds and the carried nodes besides — built as
|
|
24
|
+
* the scanner builds one, so a folder that holds its carried paths after all
|
|
25
|
+
* gives the same ref either way.
|
|
26
|
+
*
|
|
27
|
+
* The folder's own entries come first: a carried path the scan holds itself
|
|
28
|
+
* is not carried, and neither is one below a path the scan holds as a file.
|
|
29
|
+
* A directory a carried path needs and the scan lacks — the folder lost it
|
|
30
|
+
* around a file it does not see — is put back, holding just that.
|
|
31
|
+
* @param tree - The folder, as scanned.
|
|
32
|
+
* @param carried - What to carry, by path — see {@link carriedNodes}. A file
|
|
33
|
+
* node is used as it is; every directory is rebuilt from its children.
|
|
34
|
+
* @returns The tree, and the carried paths it holds; `tree` itself when it
|
|
35
|
+
* holds none of them.
|
|
36
|
+
*/
|
|
37
|
+
export declare const graftTree: (tree: FsTree, carried: ReadonlyMap<string, Tree>) => {
|
|
38
|
+
tree: FsTree;
|
|
39
|
+
carried: Map<string, Tree>;
|
|
40
|
+
};
|
package/dist/fs-ignore.d.ts
CHANGED
|
@@ -17,6 +17,15 @@ export interface IgnoreMatcher {
|
|
|
17
17
|
* @returns True when the sync must not see this path.
|
|
18
18
|
*/
|
|
19
19
|
ignores(relativePath: string, isDirectory?: boolean): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether a scan leaves the path out: the path itself, or a directory above
|
|
22
|
+
* it. A scan does not descend into an ignored directory, so nothing below
|
|
23
|
+
* one is ever seen, whatever a later `!` line says about it.
|
|
24
|
+
* @param relativePath - Path relative to the sync root, either separator.
|
|
25
|
+
* @param isDirectory - Whether the path is a directory.
|
|
26
|
+
* @returns True when no scan of the folder holds this path.
|
|
27
|
+
*/
|
|
28
|
+
excludes(relativePath: string, isDirectory: boolean): boolean;
|
|
20
29
|
}
|
|
21
30
|
/**
|
|
22
31
|
* Compiles an ignore list into a matcher.
|
package/dist/fs-scanner.d.ts
CHANGED
|
@@ -193,6 +193,8 @@ export declare class FsScanner {
|
|
|
193
193
|
/** The single follow-up pass everyone who arrived mid-scan is waiting on. */
|
|
194
194
|
private _pendingScan;
|
|
195
195
|
constructor(rootPath: string, options?: FsScanOptions);
|
|
196
|
+
/** The ignore list this scanner applies, in order, as it was given. */
|
|
197
|
+
get ignore(): readonly string[];
|
|
196
198
|
get tree(): FsTree | null;
|
|
197
199
|
/**
|
|
198
200
|
* The files the last pass left out because they were not finished yet —
|
|
@@ -283,9 +285,18 @@ export declare class FsScanner {
|
|
|
283
285
|
* Whether the sync never sees a path: the ignore list, as the scan applies
|
|
284
286
|
* it.
|
|
285
287
|
* @param relativePath - Relative to the root, either separator.
|
|
288
|
+
* @param isDirectory - Whether the path is a directory, when known.
|
|
286
289
|
* @returns `true` when no tree of this folder can hold the path.
|
|
287
290
|
*/
|
|
288
|
-
ignores(relativePath: string): boolean;
|
|
291
|
+
ignores(relativePath: string, isDirectory?: boolean): boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Whether a scan leaves a path out: the path, or a directory above it — see
|
|
294
|
+
* {@link IgnoreMatcher.excludes}.
|
|
295
|
+
* @param relativePath - Relative to the root, either separator.
|
|
296
|
+
* @param isDirectory - Whether the path is a directory.
|
|
297
|
+
* @returns `true` when no scan of this folder holds the path.
|
|
298
|
+
*/
|
|
299
|
+
excludes(relativePath: string, isDirectory: boolean): boolean;
|
|
289
300
|
watch(): Promise<void>;
|
|
290
301
|
/**
|
|
291
302
|
* One safety-rescan pass: rescans the tree and, if its content differs from
|
package/dist/fs-send.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export interface AuthoringQuestion {
|
|
|
15
15
|
maxRatio: number;
|
|
16
16
|
/** A folder holding more than this may not end up with this many or fewer. */
|
|
17
17
|
allGoneMinFiles: number;
|
|
18
|
+
/**
|
|
19
|
+
* Paths an earlier refusal held back. While any of them is still gone, the
|
|
20
|
+
* disappearance is still refused, however few of its files are left.
|
|
21
|
+
*/
|
|
22
|
+
heldBack?: ReadonlySet<string>;
|
|
18
23
|
}
|
|
19
24
|
/** What {@link planAuthoring} decided. */
|
|
20
25
|
export type AuthoringPlan = {
|
|
@@ -42,10 +47,18 @@ export type AuthoringPlan = {
|
|
|
42
47
|
* - the watcher did not see them go, so a person deleting files while the
|
|
43
48
|
* agent runs is an ordinary edit;
|
|
44
49
|
* - it is large: more than `minFiles` and more than `maxRatio` of the folder,
|
|
45
|
-
* or a folder of more than `allGoneMinFiles` left with that many or fewer
|
|
50
|
+
* or a folder of more than `allGoneMinFiles` left with that many or fewer —
|
|
51
|
+
* or it is still part of a disappearance an earlier refusal held back.
|
|
46
52
|
*
|
|
47
53
|
* A few files deleted while the agent was down stay below the floors and are
|
|
48
54
|
* authored like any other edit.
|
|
55
|
+
*
|
|
56
|
+
* **A refusal holds its files until they are back.** A refused folder that
|
|
57
|
+
* fills up again one file at a time — a backup copied in, a drive coming back
|
|
58
|
+
* — shrinks below the floors part-way, and without the hold the files still
|
|
59
|
+
* to come would be authored as deleted, on every node, while they are being
|
|
60
|
+
* copied. A held file is let go when it is back, when the head no longer has
|
|
61
|
+
* it, or when the watcher sees it deleted after it came back.
|
|
49
62
|
* @param q - The folder, the head, and the floors.
|
|
50
63
|
* @returns `unchanged`, `author` with the delta against the head, or
|
|
51
64
|
* `refused` with the files that disappeared.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The version of the `@rljson/fs-agent` package. */
|
|
2
|
-
export declare const fsAgentVersion = "0.2.
|
|
2
|
+
export declare const fsAgentVersion = "0.2.3";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rljson/fs-agent",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Rljson fs-agent description",
|
|
5
5
|
"homepage": "https://github.com/rljson/fs-agent",
|
|
6
6
|
"bugs": "https://github.com/rljson/fs-agent/issues",
|
|
@@ -22,21 +22,21 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@rljson/dna-rljson": "0.2.0",
|
|
24
24
|
"@rljson/server": "0.0.77",
|
|
25
|
-
"@tssuite/helix-js": "0.
|
|
25
|
+
"@tssuite/helix-js": "0.5.0",
|
|
26
26
|
"@types/node": "^26.6.5",
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
28
|
-
"@typescript-eslint/parser": "^8.
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^8.72.0",
|
|
28
|
+
"@typescript-eslint/parser": "^8.72.0",
|
|
29
29
|
"@vitest/coverage-v8": "^5.0.5",
|
|
30
30
|
"cross-env": "^10.1.0",
|
|
31
31
|
"eslint": "~10.13.0",
|
|
32
|
-
"eslint-plugin-jsdoc": "^65.
|
|
32
|
+
"eslint-plugin-jsdoc": "^65.4.0",
|
|
33
33
|
"eslint-plugin-tsdoc": "^0.5.4",
|
|
34
34
|
"globals": "^17.13.0",
|
|
35
35
|
"jsdoc": "^4.0.5",
|
|
36
36
|
"read-pkg": "^10.1.0",
|
|
37
37
|
"typescript": "~6.0.3",
|
|
38
|
-
"typescript-eslint": "^8.
|
|
39
|
-
"vite": "^8.3.
|
|
38
|
+
"typescript-eslint": "^8.72.0",
|
|
39
|
+
"vite": "^8.3.5",
|
|
40
40
|
"vite-node": "^6.0.0",
|
|
41
41
|
"vite-plugin-dts": "^5.1.2",
|
|
42
42
|
"vite-tsconfig-paths": "^6.1.1",
|