@xfcfam/xf-fs 0.1.0

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 (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -0
  3. package/dist/index.d.ts +48 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +43 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/src/api/A.d.ts +17 -0
  8. package/dist/src/api/A.d.ts.map +1 -0
  9. package/dist/src/api/A.js +17 -0
  10. package/dist/src/api/A.js.map +1 -0
  11. package/dist/src/business/B.d.ts +17 -0
  12. package/dist/src/business/B.d.ts.map +1 -0
  13. package/dist/src/business/B.js +17 -0
  14. package/dist/src/business/B.js.map +1 -0
  15. package/dist/src/repository/R.d.ts +17 -0
  16. package/dist/src/repository/R.d.ts.map +1 -0
  17. package/dist/src/repository/R.js +17 -0
  18. package/dist/src/repository/R.js.map +1 -0
  19. package/dist/src/repository/base/AuditedFileRepository.d.ts +86 -0
  20. package/dist/src/repository/base/AuditedFileRepository.d.ts.map +1 -0
  21. package/dist/src/repository/base/AuditedFileRepository.js +202 -0
  22. package/dist/src/repository/base/AuditedFileRepository.js.map +1 -0
  23. package/dist/src/repository/base/CachedFileRepository.d.ts +53 -0
  24. package/dist/src/repository/base/CachedFileRepository.d.ts.map +1 -0
  25. package/dist/src/repository/base/CachedFileRepository.js +107 -0
  26. package/dist/src/repository/base/CachedFileRepository.js.map +1 -0
  27. package/dist/src/repository/base/FileRepository.d.ts +170 -0
  28. package/dist/src/repository/base/FileRepository.d.ts.map +1 -0
  29. package/dist/src/repository/base/FileRepository.js +382 -0
  30. package/dist/src/repository/base/FileRepository.js.map +1 -0
  31. package/dist/src/repository/general/AuditedFileRepository.d.ts +86 -0
  32. package/dist/src/repository/general/AuditedFileRepository.d.ts.map +1 -0
  33. package/dist/src/repository/general/AuditedFileRepository.js +238 -0
  34. package/dist/src/repository/general/AuditedFileRepository.js.map +1 -0
  35. package/dist/src/repository/general/CachedFileRepository.d.ts +53 -0
  36. package/dist/src/repository/general/CachedFileRepository.d.ts.map +1 -0
  37. package/dist/src/repository/general/CachedFileRepository.js +107 -0
  38. package/dist/src/repository/general/CachedFileRepository.js.map +1 -0
  39. package/dist/src/repository/general/FileRepository.d.ts +180 -0
  40. package/dist/src/repository/general/FileRepository.d.ts.map +1 -0
  41. package/dist/src/repository/general/FileRepository.js +401 -0
  42. package/dist/src/repository/general/FileRepository.js.map +1 -0
  43. package/dist/src/repository/structs/DirectoryNotEmptyException.d.ts +13 -0
  44. package/dist/src/repository/structs/DirectoryNotEmptyException.d.ts.map +1 -0
  45. package/dist/src/repository/structs/DirectoryNotEmptyException.js +17 -0
  46. package/dist/src/repository/structs/DirectoryNotEmptyException.js.map +1 -0
  47. package/dist/src/repository/structs/FileAccessDeniedException.d.ts +14 -0
  48. package/dist/src/repository/structs/FileAccessDeniedException.d.ts.map +1 -0
  49. package/dist/src/repository/structs/FileAccessDeniedException.js +18 -0
  50. package/dist/src/repository/structs/FileAccessDeniedException.js.map +1 -0
  51. package/dist/src/repository/structs/FileEntry.d.ts +21 -0
  52. package/dist/src/repository/structs/FileEntry.d.ts.map +1 -0
  53. package/dist/src/repository/structs/FileEntry.js +2 -0
  54. package/dist/src/repository/structs/FileEntry.js.map +1 -0
  55. package/dist/src/repository/structs/FileNotFoundException.d.ts +13 -0
  56. package/dist/src/repository/structs/FileNotFoundException.d.ts.map +1 -0
  57. package/dist/src/repository/structs/FileNotFoundException.js +17 -0
  58. package/dist/src/repository/structs/FileNotFoundException.js.map +1 -0
  59. package/dist/src/repository/structs/FileStat.d.ts +24 -0
  60. package/dist/src/repository/structs/FileStat.d.ts.map +1 -0
  61. package/dist/src/repository/structs/FileStat.js +2 -0
  62. package/dist/src/repository/structs/FileStat.js.map +1 -0
  63. package/dist/src/repository/structs/TempFile.d.ts +19 -0
  64. package/dist/src/repository/structs/TempFile.d.ts.map +1 -0
  65. package/dist/src/repository/structs/TempFile.js +2 -0
  66. package/dist/src/repository/structs/TempFile.js.map +1 -0
  67. package/dist/src/repository/structs/WatchEvent.d.ts +18 -0
  68. package/dist/src/repository/structs/WatchEvent.d.ts.map +1 -0
  69. package/dist/src/repository/structs/WatchEvent.js +2 -0
  70. package/dist/src/repository/structs/WatchEvent.js.map +1 -0
  71. package/dist/src/repository/structs/Watcher.d.ts +18 -0
  72. package/dist/src/repository/structs/Watcher.d.ts.map +1 -0
  73. package/dist/src/repository/structs/Watcher.js +2 -0
  74. package/dist/src/repository/structs/Watcher.js.map +1 -0
  75. package/dist/src/repository/transfers/DirectoryNotEmptyException.d.ts +13 -0
  76. package/dist/src/repository/transfers/DirectoryNotEmptyException.d.ts.map +1 -0
  77. package/dist/src/repository/transfers/DirectoryNotEmptyException.js +17 -0
  78. package/dist/src/repository/transfers/DirectoryNotEmptyException.js.map +1 -0
  79. package/dist/src/repository/transfers/FileAccessDeniedException.d.ts +14 -0
  80. package/dist/src/repository/transfers/FileAccessDeniedException.d.ts.map +1 -0
  81. package/dist/src/repository/transfers/FileAccessDeniedException.js +18 -0
  82. package/dist/src/repository/transfers/FileAccessDeniedException.js.map +1 -0
  83. package/dist/src/repository/transfers/FileEntry.d.ts +21 -0
  84. package/dist/src/repository/transfers/FileEntry.d.ts.map +1 -0
  85. package/dist/src/repository/transfers/FileEntry.js +2 -0
  86. package/dist/src/repository/transfers/FileEntry.js.map +1 -0
  87. package/dist/src/repository/transfers/FileNotFoundException.d.ts +13 -0
  88. package/dist/src/repository/transfers/FileNotFoundException.d.ts.map +1 -0
  89. package/dist/src/repository/transfers/FileNotFoundException.js +17 -0
  90. package/dist/src/repository/transfers/FileNotFoundException.js.map +1 -0
  91. package/dist/src/repository/transfers/FileStat.d.ts +24 -0
  92. package/dist/src/repository/transfers/FileStat.d.ts.map +1 -0
  93. package/dist/src/repository/transfers/FileStat.js +2 -0
  94. package/dist/src/repository/transfers/FileStat.js.map +1 -0
  95. package/dist/src/repository/transfers/TempFile.d.ts +19 -0
  96. package/dist/src/repository/transfers/TempFile.d.ts.map +1 -0
  97. package/dist/src/repository/transfers/TempFile.js +2 -0
  98. package/dist/src/repository/transfers/TempFile.js.map +1 -0
  99. package/dist/src/repository/transfers/WatchEvent.d.ts +25 -0
  100. package/dist/src/repository/transfers/WatchEvent.d.ts.map +1 -0
  101. package/dist/src/repository/transfers/WatchEvent.js +2 -0
  102. package/dist/src/repository/transfers/WatchEvent.js.map +1 -0
  103. package/dist/src/repository/transfers/Watcher.d.ts +18 -0
  104. package/dist/src/repository/transfers/Watcher.d.ts.map +1 -0
  105. package/dist/src/repository/transfers/Watcher.js +2 -0
  106. package/dist/src/repository/transfers/Watcher.js.map +1 -0
  107. package/dist/src/repository/utils/EncodingUtils.d.ts +29 -0
  108. package/dist/src/repository/utils/EncodingUtils.d.ts.map +1 -0
  109. package/dist/src/repository/utils/EncodingUtils.js +36 -0
  110. package/dist/src/repository/utils/EncodingUtils.js.map +1 -0
  111. package/dist/src/repository/utils/PathUtils.d.ts +23 -0
  112. package/dist/src/repository/utils/PathUtils.d.ts.map +1 -0
  113. package/dist/src/repository/utils/PathUtils.js +53 -0
  114. package/dist/src/repository/utils/PathUtils.js.map +1 -0
  115. package/package.json +51 -0
@@ -0,0 +1,18 @@
1
+ /** Kind of filesystem change observed by a `Watcher`. */
2
+ export type WatchEventKind = 'created' | 'modified' | 'deleted' | 'renamed';
3
+ /**
4
+ * Access-layer Transfer — a single filesystem-change event delivered
5
+ * by a `Watcher` callback.
6
+ *
7
+ * The `path` is absolute; `oldPath` is populated on `renamed` events
8
+ * to carry the previous path of the entry.
9
+ */
10
+ export interface WatchEvent {
11
+ /** Absolute path of the affected entry (the new path on rename). */
12
+ path: string;
13
+ /** Previous absolute path on rename events; otherwise undefined. */
14
+ oldPath?: string;
15
+ /** Kind of change observed. */
16
+ kind: WatchEventKind;
17
+ }
18
+ //# sourceMappingURL=WatchEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchEvent.d.ts","sourceRoot":"","sources":["../../../../src/repository/structs/WatchEvent.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAA;AAE3E;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAA;IACZ,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+BAA+B;IAC/B,IAAI,EAAE,cAAc,CAAA;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=WatchEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchEvent.js","sourceRoot":"","sources":["../../../../src/repository/structs/WatchEvent.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Access-layer Transfer — an active filesystem watcher returned by
3
+ * `FileRepository.watch()`. Carries the live handle plus a `close()`
4
+ * to release the OS resource.
5
+ *
6
+ * The XF model treats a stateful resource handle as a Transfer (just
7
+ * like a database cursor or an HTTP response stream): the Logical
8
+ * (Repository) hands it back to the caller, who owns its lifecycle.
9
+ */
10
+ export interface Watcher {
11
+ /** Absolute path being watched (root of the watch — may be a file or directory). */
12
+ readonly path: string;
13
+ /** Whether the watcher is still active. */
14
+ readonly isActive: boolean;
15
+ /** Stop receiving events and release the underlying OS handle. */
16
+ close(): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=Watcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Watcher.d.ts","sourceRoot":"","sources":["../../../../src/repository/structs/Watcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO;IACtB,oFAAoF;IACpF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,kEAAkE;IAClE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Watcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Watcher.js","sourceRoot":"","sources":["../../../../src/repository/structs/Watcher.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Access-layer Exception — `rmdir` was called on a directory that
3
+ * still contains entries.
4
+ *
5
+ * `FileRepository` translates `node:fs`'s `ENOTEMPTY` into this typed
6
+ * Exception. Callers that want recursive deletion call `rmdir(path,
7
+ * { recursive: true })` instead of catching this one.
8
+ */
9
+ export declare class DirectoryNotEmptyException extends Error {
10
+ readonly path: string;
11
+ constructor(path: string);
12
+ }
13
+ //# sourceMappingURL=DirectoryNotEmptyException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DirectoryNotEmptyException.d.ts","sourceRoot":"","sources":["../../../../src/repository/transfers/DirectoryNotEmptyException.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBAET,IAAI,EAAE,MAAM;CAKzB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Access-layer Exception — `rmdir` was called on a directory that
3
+ * still contains entries.
4
+ *
5
+ * `FileRepository` translates `node:fs`'s `ENOTEMPTY` into this typed
6
+ * Exception. Callers that want recursive deletion call `rmdir(path,
7
+ * { recursive: true })` instead of catching this one.
8
+ */
9
+ export class DirectoryNotEmptyException extends Error {
10
+ path;
11
+ constructor(path) {
12
+ super(`Directory not empty: ${path}`);
13
+ this.name = 'DirectoryNotEmptyException';
14
+ this.path = path;
15
+ }
16
+ }
17
+ //# sourceMappingURL=DirectoryNotEmptyException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DirectoryNotEmptyException.js","sourceRoot":"","sources":["../../../../src/repository/transfers/DirectoryNotEmptyException.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,CAAQ;IAErB,YAAY,IAAY;QACtB,KAAK,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAA;QACrC,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAA;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Access-layer Exception — the operating system denied permission
3
+ * to perform the requested operation on the path.
4
+ *
5
+ * Thrown by `FileRepository` when `node:fs` raises `EACCES` or
6
+ * `EPERM`. The Repository translates the platform error into this
7
+ * typed Exception so consumers can branch on permission failure
8
+ * without inspecting `errno` codes.
9
+ */
10
+ export declare class FileAccessDeniedException extends Error {
11
+ readonly path: string;
12
+ constructor(path: string);
13
+ }
14
+ //# sourceMappingURL=FileAccessDeniedException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileAccessDeniedException.d.ts","sourceRoot":"","sources":["../../../../src/repository/transfers/FileAccessDeniedException.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBAET,IAAI,EAAE,MAAM;CAKzB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Access-layer Exception — the operating system denied permission
3
+ * to perform the requested operation on the path.
4
+ *
5
+ * Thrown by `FileRepository` when `node:fs` raises `EACCES` or
6
+ * `EPERM`. The Repository translates the platform error into this
7
+ * typed Exception so consumers can branch on permission failure
8
+ * without inspecting `errno` codes.
9
+ */
10
+ export class FileAccessDeniedException extends Error {
11
+ path;
12
+ constructor(path) {
13
+ super(`Access denied: ${path}`);
14
+ this.name = 'FileAccessDeniedException';
15
+ this.path = path;
16
+ }
17
+ }
18
+ //# sourceMappingURL=FileAccessDeniedException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileAccessDeniedException.js","sourceRoot":"","sources":["../../../../src/repository/transfers/FileAccessDeniedException.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACzC,IAAI,CAAQ;IAErB,YAAY,IAAY;QACtB,KAAK,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAA;QAC/B,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Access-layer Transfer — a single entry yielded by directory
3
+ * traversal (`list` / `walk`). Captures path information and the
4
+ * cheap stat fields available from the directory iteration; richer
5
+ * metadata is fetched separately via {@link FileStat}.
6
+ */
7
+ export interface FileEntry {
8
+ /** Absolute path of the entry on disk. */
9
+ path: string;
10
+ /** Path relative to the walk's root, with `/` separators. */
11
+ relativePath: string;
12
+ /** Final segment of `path` (the filename or directory name). */
13
+ name: string;
14
+ /** Whether the entry is a regular file. */
15
+ isFile: boolean;
16
+ /** Whether the entry is a directory. */
17
+ isDirectory: boolean;
18
+ /** Whether the entry is a symbolic link. */
19
+ isSymlink: boolean;
20
+ }
21
+ //# sourceMappingURL=FileEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileEntry.d.ts","sourceRoot":"","sources":["../../../../src/repository/transfers/FileEntry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAA;IACpB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,MAAM,EAAE,OAAO,CAAA;IACf,wCAAwC;IACxC,WAAW,EAAE,OAAO,CAAA;IACpB,4CAA4C;IAC5C,SAAS,EAAE,OAAO,CAAA;CACnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FileEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileEntry.js","sourceRoot":"","sources":["../../../../src/repository/transfers/FileEntry.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Access-layer Exception — the requested path does not exist on disk.
3
+ *
4
+ * Thrown by `FileRepository` operations that require the path to
5
+ * exist (`read`, `stat`, `delete`, `list`, …). The Repository
6
+ * translates the `node:fs` `ENOENT` error into this typed Exception
7
+ * before propagating it upward.
8
+ */
9
+ export declare class FileNotFoundException extends Error {
10
+ readonly path: string;
11
+ constructor(path: string);
12
+ }
13
+ //# sourceMappingURL=FileNotFoundException.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileNotFoundException.d.ts","sourceRoot":"","sources":["../../../../src/repository/transfers/FileNotFoundException.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;gBAET,IAAI,EAAE,MAAM;CAKzB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Access-layer Exception — the requested path does not exist on disk.
3
+ *
4
+ * Thrown by `FileRepository` operations that require the path to
5
+ * exist (`read`, `stat`, `delete`, `list`, …). The Repository
6
+ * translates the `node:fs` `ENOENT` error into this typed Exception
7
+ * before propagating it upward.
8
+ */
9
+ export class FileNotFoundException extends Error {
10
+ path;
11
+ constructor(path) {
12
+ super(`File not found: ${path}`);
13
+ this.name = 'FileNotFoundException';
14
+ this.path = path;
15
+ }
16
+ }
17
+ //# sourceMappingURL=FileNotFoundException.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileNotFoundException.js","sourceRoot":"","sources":["../../../../src/repository/transfers/FileNotFoundException.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,IAAI,CAAQ;IAErB,YAAY,IAAY;QACtB,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Access-layer Transfer — metadata of a single file or directory.
3
+ * Mirrors `node:fs` `Stats` but reduced to the surface XF artefacts
4
+ * actually consume.
5
+ */
6
+ export interface FileStat {
7
+ /** Absolute path the stat was taken from. */
8
+ path: string;
9
+ /** Size in bytes (0 for directories). */
10
+ size: number;
11
+ /** Last modification time. */
12
+ modifiedAt: Date;
13
+ /** Creation time. May equal `modifiedAt` on filesystems without birth time. */
14
+ createdAt: Date;
15
+ /** Whether the entry is a regular file. */
16
+ isFile: boolean;
17
+ /** Whether the entry is a directory. */
18
+ isDirectory: boolean;
19
+ /** Whether the entry is a symbolic link. */
20
+ isSymlink: boolean;
21
+ /** POSIX-style permission bits (e.g. `0o644`). */
22
+ mode: number;
23
+ }
24
+ //# sourceMappingURL=FileStat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileStat.d.ts","sourceRoot":"","sources":["../../../../src/repository/transfers/FileStat.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAA;IACZ,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,8BAA8B;IAC9B,UAAU,EAAE,IAAI,CAAA;IAChB,+EAA+E;IAC/E,SAAS,EAAE,IAAI,CAAA;IACf,2CAA2C;IAC3C,MAAM,EAAE,OAAO,CAAA;IACf,wCAAwC;IACxC,WAAW,EAAE,OAAO,CAAA;IACpB,4CAA4C;IAC5C,SAAS,EAAE,OAAO,CAAA;IAClB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAA;CACb"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FileStat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileStat.js","sourceRoot":"","sources":["../../../../src/repository/transfers/FileStat.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Access-layer Transfer — a temporary file allocated by
3
+ * `FileRepository.tempFile()`. Carries its absolute path plus a
4
+ * `close()` that deletes the file on the disk.
5
+ *
6
+ * Same shape as {@link Watcher}: a resource handle that the caller
7
+ * is responsible for releasing. The owning `FileRepository` also
8
+ * cleans up every tempfile it ever issued on `terminate()`, so even
9
+ * a careless caller won't leak.
10
+ */
11
+ export interface TempFile {
12
+ /** Absolute path of the temporary file on disk. */
13
+ readonly path: string;
14
+ /** Whether the temp file is still present (false after `close()`). */
15
+ readonly isOpen: boolean;
16
+ /** Delete the file from disk and mark this handle closed. */
17
+ close(): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=TempFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TempFile.d.ts","sourceRoot":"","sources":["../../../../src/repository/transfers/TempFile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,QAAQ;IACvB,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,6DAA6D;IAC7D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TempFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TempFile.js","sourceRoot":"","sources":["../../../../src/repository/transfers/TempFile.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Kind of filesystem change observed by a `Watcher`.
3
+ *
4
+ * Note: the built-in `node:fs` watcher only ever emits `'modified'` and
5
+ * `'renamed'`. `'created'` and `'deleted'` are part of the general contract
6
+ * for custom `Watcher` implementations and are never produced by the
7
+ * filesystem watcher shipped with this package.
8
+ */
9
+ export type WatchEventKind = 'created' | 'modified' | 'deleted' | 'renamed';
10
+ /**
11
+ * Access-layer Transfer — a single filesystem-change event delivered
12
+ * by a `Watcher` callback.
13
+ *
14
+ * The `path` is absolute; `oldPath` is populated on `renamed` events
15
+ * to carry the previous path of the entry.
16
+ */
17
+ export interface WatchEvent {
18
+ /** Absolute path of the affected entry (the new path on rename). */
19
+ path: string;
20
+ /** Previous absolute path on rename events; otherwise undefined. */
21
+ oldPath?: string;
22
+ /** Kind of change observed. */
23
+ kind: WatchEventKind;
24
+ }
25
+ //# sourceMappingURL=WatchEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchEvent.d.ts","sourceRoot":"","sources":["../../../../src/repository/transfers/WatchEvent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAA;AAE3E;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAA;IACZ,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+BAA+B;IAC/B,IAAI,EAAE,cAAc,CAAA;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=WatchEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WatchEvent.js","sourceRoot":"","sources":["../../../../src/repository/transfers/WatchEvent.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Access-layer Transfer — an active filesystem watcher returned by
3
+ * `FileRepository.watch()`. Carries the live handle plus a `close()`
4
+ * to release the OS resource.
5
+ *
6
+ * The XF model treats a stateful resource handle as a Transfer (just
7
+ * like a database cursor or an HTTP response stream): the Logical
8
+ * (Repository) hands it back to the caller, who owns its lifecycle.
9
+ */
10
+ export interface Watcher {
11
+ /** Absolute path being watched (root of the watch — may be a file or directory). */
12
+ readonly path: string;
13
+ /** Whether the watcher is still active. */
14
+ readonly isActive: boolean;
15
+ /** Stop receiving events and release the underlying OS handle. */
16
+ close(): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=Watcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Watcher.d.ts","sourceRoot":"","sources":["../../../../src/repository/transfers/Watcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,OAAO;IACtB,oFAAoF;IACpF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,kEAAkE;IAClE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Watcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Watcher.js","sourceRoot":"","sources":["../../../../src/repository/transfers/Watcher.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Static utility — text encoding helpers operating only on in-memory
3
+ * buffers. No I/O.
4
+ *
5
+ * Currently scoped to BOM detection / stripping and the canonical
6
+ * UTF-8 / UTF-16 byte order marks. Detection beyond these (chardet-
7
+ * style heuristics for Latin-1, Windows-1252, etc.) is out of scope
8
+ * for v0 and lives behind a dedicated library if it's ever needed.
9
+ */
10
+ export type Encoding = 'utf-8' | 'utf-16le' | 'utf-16be' | 'utf-8-bom';
11
+ export declare class EncodingUtils {
12
+ private constructor();
13
+ /**
14
+ * Inspect the first few bytes of `bytes` and return the detected
15
+ * BOM-bearing encoding, or `'utf-8'` when no BOM is present (the
16
+ * default modern encoding).
17
+ */
18
+ static detect(bytes: Uint8Array): Encoding;
19
+ /**
20
+ * Remove the BOM at the start of `text` if present. Safe to call
21
+ * unconditionally — returns `text` unchanged when there's no BOM.
22
+ */
23
+ static stripBom(text: string): string;
24
+ /** Encode a string as UTF-8 bytes. */
25
+ static toBytes(text: string): Uint8Array;
26
+ /** Decode UTF-8 bytes into a string, stripping any leading BOM. */
27
+ static fromBytes(bytes: Uint8Array): string;
28
+ }
29
+ //# sourceMappingURL=EncodingUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EncodingUtils.d.ts","sourceRoot":"","sources":["../../../../src/repository/utils/EncodingUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAA;AAEtE,qBAAa,aAAa;IACxB,OAAO;IAEP;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ;IAS1C;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAKrC,sCAAsC;IACtC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAIxC,mEAAmE;IACnE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM;CAG5C"}
@@ -0,0 +1,36 @@
1
+ export class EncodingUtils {
2
+ constructor() { }
3
+ /**
4
+ * Inspect the first few bytes of `bytes` and return the detected
5
+ * BOM-bearing encoding, or `'utf-8'` when no BOM is present (the
6
+ * default modern encoding).
7
+ */
8
+ static detect(bytes) {
9
+ if (bytes.length >= 3 && bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf) {
10
+ return 'utf-8-bom';
11
+ }
12
+ if (bytes.length >= 2 && bytes[0] === 0xff && bytes[1] === 0xfe)
13
+ return 'utf-16le';
14
+ if (bytes.length >= 2 && bytes[0] === 0xfe && bytes[1] === 0xff)
15
+ return 'utf-16be';
16
+ return 'utf-8';
17
+ }
18
+ /**
19
+ * Remove the BOM at the start of `text` if present. Safe to call
20
+ * unconditionally — returns `text` unchanged when there's no BOM.
21
+ */
22
+ static stripBom(text) {
23
+ if (text.length > 0 && text.charCodeAt(0) === 0xfeff)
24
+ return text.slice(1);
25
+ return text;
26
+ }
27
+ /** Encode a string as UTF-8 bytes. */
28
+ static toBytes(text) {
29
+ return new TextEncoder().encode(text);
30
+ }
31
+ /** Decode UTF-8 bytes into a string, stripping any leading BOM. */
32
+ static fromBytes(bytes) {
33
+ return EncodingUtils.stripBom(new TextDecoder('utf-8').decode(bytes));
34
+ }
35
+ }
36
+ //# sourceMappingURL=EncodingUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EncodingUtils.js","sourceRoot":"","sources":["../../../../src/repository/utils/EncodingUtils.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,aAAa;IACxB,gBAAuB,CAAC;IAExB;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,KAAiB;QAC7B,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACrF,OAAO,WAAW,CAAA;QACpB,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,OAAO,UAAU,CAAA;QAClF,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,OAAO,UAAU,CAAA;QAClF,OAAO,OAAO,CAAA;IAChB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAY;QAC1B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAC1E,OAAO,IAAI,CAAA;IACb,CAAC;IAED,sCAAsC;IACtC,MAAM,CAAC,OAAO,CAAC,IAAY;QACzB,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACvC,CAAC;IAED,mEAAmE;IACnE,MAAM,CAAC,SAAS,CAAC,KAAiB;QAChC,OAAO,aAAa,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IACvE,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ export declare class PathUtils {
2
+ private constructor();
3
+ /** Concatenate path segments with `/`, collapsing duplicate separators. */
4
+ static join(...segments: string[]): string;
5
+ /** Collapse `..`/`.`, duplicate `/`, and unify separators to `/`. */
6
+ static normalize(p: string): string;
7
+ /** Last segment (filename including extension). */
8
+ static basename(p: string): string;
9
+ /**
10
+ * Filename extension including the leading dot (`.txt`), or `''` if
11
+ * the basename has no extension or is a dotfile.
12
+ */
13
+ static extname(p: string): string;
14
+ /** Parent directory of `p` (or `'.'` for bare basenames). */
15
+ static dirname(p: string): string;
16
+ /** Compute the relative path from `from` to `to`. */
17
+ static relative(from: string, to: string): string;
18
+ /** Whether `p` is an absolute path. */
19
+ static isAbsolute(p: string): boolean;
20
+ /** Strip the filename extension (`'foo.txt'` → `'foo'`). */
21
+ static stripExtension(p: string): string;
22
+ }
23
+ //# sourceMappingURL=PathUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PathUtils.d.ts","sourceRoot":"","sources":["../../../../src/repository/utils/PathUtils.ts"],"names":[],"mappings":"AAWA,qBAAa,SAAS;IACpB,OAAO;IAEP,2EAA2E;IAC3E,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM;IAI1C,qEAAqE;IACrE,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAInC,mDAAmD;IACnD,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIjC,6DAA6D;IAC7D,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAIjC,qDAAqD;IACrD,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM;IAIjD,uCAAuC;IACvC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAIrC,4DAA4D;IAC5D,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;CAMzC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Static utility — pure path manipulation. Operates only on string
3
+ * tokens; no syscalls. Adopts forward-slash normalisation across
4
+ * platforms so XF artefacts can keep paths comparable.
5
+ *
6
+ * Built on top of `node:path/posix` so the behaviour is deterministic
7
+ * regardless of the host OS (Windows backslashes are normalised to
8
+ * forward slashes on input).
9
+ */
10
+ import { posix } from 'node:path';
11
+ export class PathUtils {
12
+ constructor() { }
13
+ /** Concatenate path segments with `/`, collapsing duplicate separators. */
14
+ static join(...segments) {
15
+ return posix.join(...segments.map(PathUtils.normalize));
16
+ }
17
+ /** Collapse `..`/`.`, duplicate `/`, and unify separators to `/`. */
18
+ static normalize(p) {
19
+ return posix.normalize(p.replace(/\\/g, '/'));
20
+ }
21
+ /** Last segment (filename including extension). */
22
+ static basename(p) {
23
+ return posix.basename(PathUtils.normalize(p));
24
+ }
25
+ /**
26
+ * Filename extension including the leading dot (`.txt`), or `''` if
27
+ * the basename has no extension or is a dotfile.
28
+ */
29
+ static extname(p) {
30
+ return posix.extname(PathUtils.normalize(p));
31
+ }
32
+ /** Parent directory of `p` (or `'.'` for bare basenames). */
33
+ static dirname(p) {
34
+ return posix.dirname(PathUtils.normalize(p));
35
+ }
36
+ /** Compute the relative path from `from` to `to`. */
37
+ static relative(from, to) {
38
+ return posix.relative(PathUtils.normalize(from), PathUtils.normalize(to));
39
+ }
40
+ /** Whether `p` is an absolute path. */
41
+ static isAbsolute(p) {
42
+ return posix.isAbsolute(PathUtils.normalize(p));
43
+ }
44
+ /** Strip the filename extension (`'foo.txt'` → `'foo'`). */
45
+ static stripExtension(p) {
46
+ const base = PathUtils.basename(p);
47
+ const ext = PathUtils.extname(base);
48
+ if (ext === '')
49
+ return base;
50
+ return base.slice(0, -ext.length);
51
+ }
52
+ }
53
+ //# sourceMappingURL=PathUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PathUtils.js","sourceRoot":"","sources":["../../../../src/repository/utils/PathUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAEjC,MAAM,OAAO,SAAS;IACpB,gBAAuB,CAAC;IAExB,2EAA2E;IAC3E,MAAM,CAAC,IAAI,CAAC,GAAG,QAAkB;QAC/B,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAA;IACzD,CAAC;IAED,qEAAqE;IACrE,MAAM,CAAC,SAAS,CAAC,CAAS;QACxB,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;IAC/C,CAAC;IAED,mDAAmD;IACnD,MAAM,CAAC,QAAQ,CAAC,CAAS;QACvB,OAAO,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/C,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,OAAO,CAAC,CAAS;QACtB,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9C,CAAC;IAED,6DAA6D;IAC7D,MAAM,CAAC,OAAO,CAAC,CAAS;QACtB,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9C,CAAC;IAED,qDAAqD;IACrD,MAAM,CAAC,QAAQ,CAAC,IAAY,EAAE,EAAU;QACtC,OAAO,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAA;IAC3E,CAAC;IAED,uCAAuC;IACvC,MAAM,CAAC,UAAU,CAAC,CAAS;QACzB,OAAO,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IACjD,CAAC;IAED,4DAA4D;IAC5D,MAAM,CAAC,cAAc,CAAC,CAAS;QAC7B,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QAClC,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACnC,IAAI,GAAG,KAAK,EAAE;YAAE,OAAO,IAAI,CAAA;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@xfcfam/xf-fs",
3
+ "version": "0.1.0",
4
+ "description": "Filesystem Access Layer Generalization for the XF Architecture Model — encapsulates local-disk file operations (node:fs).",
5
+ "author": "XF Contributors",
6
+ "license": "MIT",
7
+ "homepage": "https://xfcfam.org",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/xfcfam/lib-npm",
11
+ "directory": "packages/xf-fs"
12
+ },
13
+ "keywords": [
14
+ "xf",
15
+ "cfam",
16
+ "filesystem",
17
+ "fs",
18
+ "files",
19
+ "io"
20
+ ],
21
+ "type": "module",
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "import": "./dist/index.js",
27
+ "types": "./dist/index.d.ts"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "peerDependencies": {
37
+ "@xfcfam/xf": "^0.2.0"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^20.0.0",
41
+ "typescript": "^5.4.0",
42
+ "vitest": "^2.0.0"
43
+ },
44
+ "scripts": {
45
+ "build": "tsc",
46
+ "typecheck": "tsc --noEmit",
47
+ "clean": "rm -rf dist",
48
+ "test": "vitest run --passWithNoTests",
49
+ "test:watch": "vitest"
50
+ }
51
+ }