keri-ts 0.2.3 → 0.3.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.
- package/README.md +57 -8
- package/esm/app/cli/agent.js +0 -19
- package/esm/app/cli/annotate.js +7 -2
- package/esm/app/cli/benchmark.js +210 -0
- package/esm/app/cli/cli.js +50 -52
- package/esm/app/cli/command-definitions.js +258 -6
- package/esm/app/cli/common/existing.js +40 -0
- package/esm/app/cli/common/parsing.js +20 -0
- package/esm/app/cli/export.js +51 -0
- package/esm/app/cli/incept.js +106 -0
- package/esm/app/cli/index.js +2 -0
- package/esm/app/cli/init.js +72 -41
- package/esm/app/configing.js +261 -0
- package/esm/app/habbing.js +386 -0
- package/esm/app/index.js +3 -0
- package/esm/app/keeping.js +321 -0
- package/esm/app/version.js +2 -2
- package/esm/db/basing.js +66 -1
- package/esm/db/core/lmdber.js +13 -7
- package/esm/db/core/path-manager.js +193 -169
- package/esm/db/index.js +1 -0
- package/esm/db/keeping.js +214 -0
- package/esm/deps/jsr.io/@std/internal/1.0.12/_os.js +12 -0
- package/esm/deps/jsr.io/@std/internal/1.0.12/os.js +5 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/assert_path.js +7 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/basename.js +40 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/common.js +23 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/constants.js +46 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/dirname.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/format.js +19 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.js +9 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.js +235 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.js +77 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/relative.js +9 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.js +19 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.js +15 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/basename.js +35 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/common.js +33 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/constants.js +17 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/dirname.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/extname.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/format.js +27 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/from_file_url.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.js +83 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/is_absolute.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/is_glob.js +42 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/join.js +29 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/join_globs.js +34 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/mod.js +216 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/normalize.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/normalize_glob.js +35 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/parse.js +39 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/_util.js +8 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/basename.js +52 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/constants.js +14 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/dirname.js +64 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/extname.js +93 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/format.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.js +21 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.js +23 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/join.js +45 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/join_globs.js +40 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize.js +58 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/parse.js +115 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/relative.js +106 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/resolve.js +59 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.js +27 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.js +20 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/relative.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/resolve.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/to_file_url.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.js +29 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/types.js +3 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/_util.js +15 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/basename.js +47 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/constants.js +14 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/dirname.js +113 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/extname.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/format.js +28 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.js +30 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.js +82 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.js +38 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/join.js +77 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/join_globs.js +41 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize.js +135 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.js +32 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/parse.js +176 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/relative.js +131 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/resolve.js +154 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.js +34 -0
- package/esm/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.js +49 -0
- package/package.json +4 -2
- package/types/app/cli/agent.d.ts.map +1 -1
- package/types/app/cli/annotate.d.ts.map +1 -1
- package/types/app/cli/benchmark.d.ts +11 -0
- package/types/app/cli/benchmark.d.ts.map +1 -0
- package/types/app/cli/cli.d.ts.map +1 -1
- package/types/app/cli/command-definitions.d.ts +5 -2
- package/types/app/cli/command-definitions.d.ts.map +1 -1
- package/types/app/cli/command-types.d.ts +12 -0
- package/types/app/cli/command-types.d.ts.map +1 -1
- package/types/app/cli/common/existing.d.ts +4 -0
- package/types/app/cli/common/existing.d.ts.map +1 -0
- package/types/app/cli/common/parsing.d.ts +15 -0
- package/types/app/cli/common/parsing.d.ts.map +1 -0
- package/types/app/cli/export.d.ts +8 -0
- package/types/app/cli/export.d.ts.map +1 -0
- package/types/app/cli/incept.d.ts +8 -0
- package/types/app/cli/incept.d.ts.map +1 -0
- package/types/app/cli/index.d.ts +2 -0
- package/types/app/cli/index.d.ts.map +1 -1
- package/types/app/cli/init.d.ts +5 -0
- package/types/app/cli/init.d.ts.map +1 -1
- package/types/app/configing.d.ts +57 -0
- package/types/app/configing.d.ts.map +1 -0
- package/types/app/habbing.d.ts +107 -0
- package/types/app/habbing.d.ts.map +1 -0
- package/types/app/index.d.ts +3 -0
- package/types/app/index.d.ts.map +1 -1
- package/types/app/keeping.d.ts +72 -0
- package/types/app/keeping.d.ts.map +1 -0
- package/types/app/version.d.ts +2 -2
- package/types/db/basing.d.ts +16 -1
- package/types/db/basing.d.ts.map +1 -1
- package/types/db/core/lmdber.d.ts +8 -4
- package/types/db/core/lmdber.d.ts.map +1 -1
- package/types/db/core/path-manager.d.ts +88 -24
- package/types/db/core/path-manager.d.ts.map +1 -1
- package/types/db/index.d.ts +1 -0
- package/types/db/index.d.ts.map +1 -1
- package/types/db/keeping.d.ts +73 -0
- package/types/db/keeping.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts +2 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/_os.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts +3 -0
- package/types/deps/jsr.io/@std/internal/1.0.12/os.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/assert_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/common.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts +40 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts +35 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts +27 -0
- package/types/deps/jsr.io/@std/path/1.1.4/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts +28 -0
- package/types/deps/jsr.io/@std/path/1.1.4/common.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts +15 -0
- package/types/deps/jsr.io/@std/path/1.1.4/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts +77 -0
- package/types/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/is_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts +23 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts +28 -0
- package/types/deps/jsr.io/@std/path/1.1.4/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts +213 -0
- package/types/deps/jsr.io/@std/path/1.1.4/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts +26 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts +29 -0
- package/types/deps/jsr.io/@std/path/1.1.4/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts +35 -0
- package/types/deps/jsr.io/@std/path/1.1.4/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts +2 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/_util.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts +39 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts +13 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts +30 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts +37 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts +16 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts +72 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts +31 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts +37 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts +25 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts +16 -0
- package/types/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts +21 -0
- package/types/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts +38 -0
- package/types/deps/jsr.io/@std/path/1.1.4/types.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts +4 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/_util.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts +22 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts +13 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/constants.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/dirname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts +24 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/format.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts +18 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts +71 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts +18 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts +21 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/join_globs.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts +19 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts +20 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts +25 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/parse.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts +23 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/relative.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/resolve.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts +17 -0
- package/types/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.d.ts.map +1 -0
- package/esm/app/cli/stub-commands.js +0 -61
- package/types/app/cli/stub-commands.d.ts +0 -6
- package/types/app/cli/stub-commands.d.ts.map +0 -1
|
@@ -6,15 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as dntShim from "../../_dnt.shims.js";
|
|
8
8
|
import { action } from "effection";
|
|
9
|
+
import { isAbsolute, join } from "../../deps/jsr.io/@std/path/1.1.4/mod.js";
|
|
9
10
|
import { InvalidPathNameError, PathError } from "../../core/errors.js";
|
|
10
11
|
import { consoleLogger } from "../../core/logger.js";
|
|
12
|
+
/** Defaults for the path manager */
|
|
11
13
|
export const PATH_DEFAULTS = {
|
|
12
14
|
headDirPath: "/usr/local/var",
|
|
13
15
|
tailDirPath: "keri/db",
|
|
14
16
|
cleanTailDirPath: "keri/clean/db",
|
|
15
17
|
altHeadDirPath: "~",
|
|
16
|
-
altTailDirPath: ".
|
|
17
|
-
altCleanTailDirPath: ".
|
|
18
|
+
altTailDirPath: ".tufa/db",
|
|
19
|
+
altCleanTailDirPath: ".tufa/clean/db",
|
|
18
20
|
tempHeadDir: "/tmp",
|
|
19
21
|
tempPrefix: "keri_lmdb_",
|
|
20
22
|
tempSuffix: "_test",
|
|
@@ -24,11 +26,31 @@ export const PATH_DEFAULTS = {
|
|
|
24
26
|
};
|
|
25
27
|
/**
|
|
26
28
|
* PathManager manages file and directory paths
|
|
29
|
+
*
|
|
30
|
+
* Main file paths:
|
|
31
|
+
* - persistent path: /{head}/{tail} /{base}/{name}
|
|
32
|
+
* - clean path: /{head}/{tail}/clean/{base}/{name}
|
|
33
|
+
* - alt path: /{altHead}/{altTail}/{base}/{name}
|
|
34
|
+
* - HOME (alt) path: ~/{altTail}/{base}/{name}
|
|
35
|
+
*
|
|
36
|
+
* Temp files:
|
|
37
|
+
* - temp path: /{tempPrefix}/{tempSuffix}{tempHead}
|
|
38
|
+
*
|
|
39
|
+
* The path manager will use the persistent path by default.
|
|
40
|
+
* If the persistent path does not exist, the path manager will use the alt path.
|
|
41
|
+
* If the alt path does not exist, the path manager will use the temp path.
|
|
42
|
+
*
|
|
43
|
+
* Temp files:
|
|
44
|
+
* If the temp path does not exist, the path manager will create it.
|
|
45
|
+
* If the temp path exists, the path manager will use it.
|
|
46
|
+
* If the temp path exists and is not a directory, the path manager will throw an error.
|
|
47
|
+
* If the temp path exists and is a directory, the path manager will use it.
|
|
48
|
+
* If the temp path exists and is a directory, the path manager will use it.
|
|
27
49
|
*/
|
|
28
50
|
export class PathManager {
|
|
29
51
|
constructor(options = {}, defaults) {
|
|
30
|
-
//
|
|
31
|
-
Object.defineProperty(this, "
|
|
52
|
+
// head directory path
|
|
53
|
+
Object.defineProperty(this, "headDirPath", {
|
|
32
54
|
enumerable: true,
|
|
33
55
|
configurable: true,
|
|
34
56
|
writable: true,
|
|
@@ -41,15 +63,15 @@ export class PathManager {
|
|
|
41
63
|
writable: true,
|
|
42
64
|
value: void 0
|
|
43
65
|
});
|
|
44
|
-
//
|
|
45
|
-
Object.defineProperty(this, "
|
|
66
|
+
// name of the path, dir or file name
|
|
67
|
+
Object.defineProperty(this, "_name", {
|
|
46
68
|
enumerable: true,
|
|
47
69
|
configurable: true,
|
|
48
70
|
writable: true,
|
|
49
71
|
value: void 0
|
|
50
72
|
});
|
|
51
|
-
//
|
|
52
|
-
Object.defineProperty(this, "
|
|
73
|
+
// temporary directory flag
|
|
74
|
+
Object.defineProperty(this, "temp", {
|
|
53
75
|
enumerable: true,
|
|
54
76
|
configurable: true,
|
|
55
77
|
writable: true,
|
|
@@ -62,48 +84,56 @@ export class PathManager {
|
|
|
62
84
|
writable: true,
|
|
63
85
|
value: void 0
|
|
64
86
|
});
|
|
87
|
+
// numeric os dir permissions for database directory and database files
|
|
65
88
|
Object.defineProperty(this, "perm", {
|
|
66
89
|
enumerable: true,
|
|
67
90
|
configurable: true,
|
|
68
91
|
writable: true,
|
|
69
92
|
value: void 0
|
|
70
93
|
});
|
|
94
|
+
// true means path ends in file, false means path ends in directory
|
|
71
95
|
Object.defineProperty(this, "filed", {
|
|
72
96
|
enumerable: true,
|
|
73
97
|
configurable: true,
|
|
74
98
|
writable: true,
|
|
75
99
|
value: void 0
|
|
76
100
|
});
|
|
101
|
+
// true means ensure path ends with extension, false means do not ensure path ends with extension
|
|
77
102
|
Object.defineProperty(this, "extensioned", {
|
|
78
103
|
enumerable: true,
|
|
79
104
|
configurable: true,
|
|
80
105
|
writable: true,
|
|
81
106
|
value: void 0
|
|
82
107
|
});
|
|
108
|
+
// file open mode if filed
|
|
83
109
|
Object.defineProperty(this, "mode", {
|
|
84
110
|
enumerable: true,
|
|
85
111
|
configurable: true,
|
|
86
112
|
writable: true,
|
|
87
113
|
value: void 0
|
|
88
114
|
});
|
|
115
|
+
// file extension if filed
|
|
89
116
|
Object.defineProperty(this, "fext", {
|
|
90
117
|
enumerable: true,
|
|
91
118
|
configurable: true,
|
|
92
119
|
writable: true,
|
|
93
120
|
value: void 0
|
|
94
121
|
});
|
|
122
|
+
// true means directory created and if filed then file is opened
|
|
95
123
|
Object.defineProperty(this, "opened", {
|
|
96
124
|
enumerable: true,
|
|
97
125
|
configurable: true,
|
|
98
126
|
writable: true,
|
|
99
127
|
value: void 0
|
|
100
128
|
});
|
|
129
|
+
// defaults for the path manager
|
|
101
130
|
Object.defineProperty(this, "defaults", {
|
|
102
131
|
enumerable: true,
|
|
103
132
|
configurable: true,
|
|
104
133
|
writable: true,
|
|
105
134
|
value: void 0
|
|
106
135
|
});
|
|
136
|
+
// logger instance for logging
|
|
107
137
|
Object.defineProperty(this, "logger", {
|
|
108
138
|
enumerable: true,
|
|
109
139
|
configurable: true,
|
|
@@ -131,8 +161,10 @@ export class PathManager {
|
|
|
131
161
|
}
|
|
132
162
|
set name(value) {
|
|
133
163
|
// Check if path is absolute
|
|
134
|
-
if (value
|
|
135
|
-
throw new InvalidPathNameError(`Not relative name=${value} path.`, {
|
|
164
|
+
if (isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value)) {
|
|
165
|
+
throw new InvalidPathNameError(`Not relative name=${value} path.`, {
|
|
166
|
+
name: value,
|
|
167
|
+
});
|
|
136
168
|
}
|
|
137
169
|
this._name = value;
|
|
138
170
|
}
|
|
@@ -140,11 +172,29 @@ export class PathManager {
|
|
|
140
172
|
const tempDir = dntShim.Deno.env.get("TMPDIR") || dntShim.Deno.env.get("TMP") ||
|
|
141
173
|
dntShim.Deno.env.get("TEMP") || "/tmp";
|
|
142
174
|
const tempName = `${this.defaults.tempPrefix}${this.name}${this.defaults.tempSuffix}`;
|
|
143
|
-
return
|
|
175
|
+
return join(tempDir, tempName);
|
|
176
|
+
}
|
|
177
|
+
/** Resolve user home directory with a Windows-aware fallback chain. */
|
|
178
|
+
_resolveHomeDir() {
|
|
179
|
+
const home = dntShim.Deno.env.get("HOME");
|
|
180
|
+
if (home) {
|
|
181
|
+
return home;
|
|
182
|
+
}
|
|
183
|
+
// Windows common environment variables
|
|
184
|
+
const userProfile = dntShim.Deno.env.get("USERPROFILE");
|
|
185
|
+
if (userProfile) {
|
|
186
|
+
return userProfile;
|
|
187
|
+
}
|
|
188
|
+
const homeDrive = dntShim.Deno.env.get("HOMEDRIVE");
|
|
189
|
+
const homePath = dntShim.Deno.env.get("HOMEPATH");
|
|
190
|
+
if (homeDrive && homePath) {
|
|
191
|
+
return `${homeDrive}${homePath}`;
|
|
192
|
+
}
|
|
193
|
+
return "~";
|
|
144
194
|
}
|
|
145
195
|
_pathExpandTilde(path) {
|
|
146
|
-
if (path === "~" || path
|
|
147
|
-
const home =
|
|
196
|
+
if (path === "~" || /^~[\\/]/.test(path)) {
|
|
197
|
+
const home = this._resolveHomeDir();
|
|
148
198
|
return path === "~" ? home : path.replace("~", home);
|
|
149
199
|
}
|
|
150
200
|
return path;
|
|
@@ -161,12 +211,9 @@ export class PathManager {
|
|
|
161
211
|
else {
|
|
162
212
|
tail = this.defaults.tailDirPath;
|
|
163
213
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
parts.push(this.name);
|
|
168
|
-
const path = parts.join("/");
|
|
169
|
-
return path;
|
|
214
|
+
return this.base
|
|
215
|
+
? join(head, tail, this.base, this.name)
|
|
216
|
+
: join(head, tail, this.name);
|
|
170
217
|
}
|
|
171
218
|
_getAltPath(clean) {
|
|
172
219
|
// HOME or ~ / tail / base / name
|
|
@@ -179,12 +226,9 @@ export class PathManager {
|
|
|
179
226
|
else {
|
|
180
227
|
tail = this.defaults.altTailDirPath;
|
|
181
228
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
altParts.push(this.name);
|
|
186
|
-
const path = altParts.join("/");
|
|
187
|
-
return path;
|
|
229
|
+
return this.base
|
|
230
|
+
? join(head, tail, this.base, this.name)
|
|
231
|
+
: join(head, tail, this.name);
|
|
188
232
|
}
|
|
189
233
|
/*
|
|
190
234
|
* Creates a file path based on head, tail, base, and name. Ensure path is created and optionally reuse it.
|
|
@@ -207,7 +251,7 @@ export class PathManager {
|
|
|
207
251
|
* Helper: Convert Promise-based file system operations to Effection operations
|
|
208
252
|
* This ensures proper structured concurrency and cancellation support
|
|
209
253
|
*/
|
|
210
|
-
*
|
|
254
|
+
*statOp(path) {
|
|
211
255
|
return yield* action((resolve, reject) => {
|
|
212
256
|
dntShim.Deno.stat(path)
|
|
213
257
|
.then(() => resolve(true))
|
|
@@ -222,7 +266,7 @@ export class PathManager {
|
|
|
222
266
|
return () => { };
|
|
223
267
|
});
|
|
224
268
|
}
|
|
225
|
-
*
|
|
269
|
+
*accessOp(path) {
|
|
226
270
|
return yield* action((resolve, reject) => {
|
|
227
271
|
// In Deno, we check access by stating or trying to read/write.
|
|
228
272
|
// Simplified to checking existence and relying on OS permissions for now
|
|
@@ -232,7 +276,7 @@ export class PathManager {
|
|
|
232
276
|
return () => { };
|
|
233
277
|
});
|
|
234
278
|
}
|
|
235
|
-
*
|
|
279
|
+
*mkdirOp(path, perm) {
|
|
236
280
|
return yield* action((resolve, reject) => {
|
|
237
281
|
dntShim.Deno.mkdir(path, { recursive: true, mode: perm })
|
|
238
282
|
.then(() => resolve(true))
|
|
@@ -247,7 +291,7 @@ export class PathManager {
|
|
|
247
291
|
return () => { };
|
|
248
292
|
});
|
|
249
293
|
}
|
|
250
|
-
*
|
|
294
|
+
*rmOp(path) {
|
|
251
295
|
return yield* action((resolve, reject) => {
|
|
252
296
|
dntShim.Deno.remove(path, { recursive: true })
|
|
253
297
|
.then(() => resolve(undefined))
|
|
@@ -262,7 +306,7 @@ export class PathManager {
|
|
|
262
306
|
return () => { };
|
|
263
307
|
});
|
|
264
308
|
}
|
|
265
|
-
*
|
|
309
|
+
*statFileOp(path) {
|
|
266
310
|
return yield* action((resolve, reject) => {
|
|
267
311
|
dntShim.Deno.stat(path)
|
|
268
312
|
.then((stats) => {
|
|
@@ -286,148 +330,142 @@ export class PathManager {
|
|
|
286
330
|
});
|
|
287
331
|
}
|
|
288
332
|
/**
|
|
289
|
-
* Reopen/create the directory or file path
|
|
333
|
+
* Reopen/create the directory or file path.
|
|
290
334
|
* Replicates KERIpy/HIO Filer.remake logic:
|
|
291
335
|
* - Tries primary path (/usr/local/var/keri/*) first
|
|
292
|
-
* - Falls back to alt path (~/.
|
|
336
|
+
* - Falls back to alt path (~/.tufa/*) on OS errors or access issues
|
|
293
337
|
*
|
|
294
|
-
*
|
|
295
|
-
* - All file system operations are cancellable
|
|
296
|
-
* - No dangling promises - operations tracked in Effection task tree
|
|
297
|
-
* - Automatic cleanup if parent operation is halted
|
|
338
|
+
* Returns Effection Operation with true if path is created and accessible, false otherwise.
|
|
298
339
|
*/
|
|
299
340
|
*reopen(options = {}) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
const perm = options.perm ?? this.perm;
|
|
303
|
-
const clear = options.clear || false;
|
|
304
|
-
const reuse = options.reuse || false;
|
|
341
|
+
this._applyOptions(options);
|
|
342
|
+
const headDirPath = options.headDirPath ?? this.headDirPath;
|
|
305
343
|
const clean = options.clean || false;
|
|
306
|
-
const
|
|
307
|
-
const
|
|
308
|
-
this.temp = temp;
|
|
309
|
-
this.perm = perm;
|
|
310
|
-
this.mode = mode;
|
|
311
|
-
this.fext = fext;
|
|
312
|
-
let path;
|
|
344
|
+
const reuse = options.reuse || false;
|
|
345
|
+
const clear = options.clear || false;
|
|
313
346
|
const [primary, alt, tempPath] = this._getPaths({
|
|
314
347
|
...options,
|
|
315
348
|
headDirPath,
|
|
316
349
|
clean,
|
|
317
350
|
});
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
// Only attempt fallback if using default headDirPath (not a custom one)
|
|
327
|
-
const usingDefaultHeadDir = headDirPath === this.defaults.headDirPath;
|
|
328
|
-
if (!reuse && usingDefaultHeadDir) {
|
|
329
|
-
// Check if path exists using Effection operation
|
|
330
|
-
const pathExists = yield* this._statOp(path);
|
|
331
|
-
if (!pathExists) {
|
|
332
|
-
// Path doesn't exist, try to create it
|
|
333
|
-
this.logger.info(`Creating directory at ${path}`);
|
|
334
|
-
const created = yield* this._mkdirOp(path, perm);
|
|
335
|
-
if (!created) {
|
|
336
|
-
// Creation failed (e.g., EACCES) - fall back to alt path
|
|
337
|
-
this.logger.warn(`Failed to create primary path, falling back to alt path`);
|
|
338
|
-
useAltPath = true;
|
|
339
|
-
path = alt;
|
|
340
|
-
headDirPath = this.defaults.altHeadDirPath;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
// If we're using alt path, ensure it exists
|
|
344
|
-
if (useAltPath) {
|
|
345
|
-
const altPathExists = yield* this._statOp(path);
|
|
346
|
-
if (!altPathExists) {
|
|
347
|
-
// Alt path doesn't exist, create it
|
|
348
|
-
this.logger.info(`Creating alt directory at ${path}`);
|
|
349
|
-
const created = yield* this._mkdirOp(path, perm);
|
|
350
|
-
if (!created) {
|
|
351
|
-
// Even alt path creation failed - this is unexpected, but we'll continue
|
|
352
|
-
this.logger.error(`Failed to create alt directory at ${path}`);
|
|
353
|
-
throw new PathError(`Failed to create alt directory at ${path}`, { path });
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
// Path exists, verify access
|
|
358
|
-
const altHasAccess = yield* this._accessOp(path);
|
|
359
|
-
if (!altHasAccess) {
|
|
360
|
-
// Path exists but no access - this shouldn't happen for alt path, but log it
|
|
361
|
-
this.logger.error(`Alt path exists but is not accessible: ${path}`);
|
|
362
|
-
throw new PathError(`Alt path exists but is not accessible: ${path}`, { path });
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
else if (reuse) {
|
|
368
|
-
// Reuse mode - just verify the path exists and is accessible
|
|
369
|
-
const pathExists = yield* this._statOp(path);
|
|
370
|
-
const hasAccess = pathExists ? yield* this._accessOp(path) : false;
|
|
371
|
-
if (!pathExists || !hasAccess) {
|
|
372
|
-
// If reuse path doesn't work and we're using default, try alt
|
|
373
|
-
if (usingDefaultHeadDir) {
|
|
374
|
-
this.logger.info(`Reuse path not accessible, trying alt path`);
|
|
375
|
-
path = alt;
|
|
376
|
-
headDirPath = this.defaults.altHeadDirPath;
|
|
377
|
-
const altPathExists = yield* this._statOp(path);
|
|
378
|
-
const altHasAccess = altPathExists
|
|
379
|
-
? yield* this._accessOp(path)
|
|
380
|
-
: false;
|
|
381
|
-
if (!altPathExists) {
|
|
382
|
-
// Alt path doesn't exist, create it
|
|
383
|
-
this.logger.info(`Creating alt directory at ${path}`);
|
|
384
|
-
const created = yield* this._mkdirOp(path, perm);
|
|
385
|
-
if (!created) {
|
|
386
|
-
this.logger.warn(`Warning: Failed to create alt directory at ${path}`);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
else if (!altHasAccess) {
|
|
390
|
-
// Alt path exists but not accessible - unexpected but continue
|
|
391
|
-
this.logger.warn(`Warning: Alt path exists but is not accessible: ${path}`);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
// Update headDirPath if we fell back to alt
|
|
398
|
-
this.headDirPath = headDirPath;
|
|
399
|
-
// Clear if requested
|
|
351
|
+
const resolved = yield* this._resolvePath({
|
|
352
|
+
primary,
|
|
353
|
+
alt,
|
|
354
|
+
tempPath,
|
|
355
|
+
headDirPath,
|
|
356
|
+
reuse,
|
|
357
|
+
});
|
|
358
|
+
this.headDirPath = resolved.headDirPath;
|
|
400
359
|
if (clear) {
|
|
401
|
-
|
|
402
|
-
if (pathStat && (pathStat.isDirectory || pathStat.isFile)) {
|
|
403
|
-
yield* this._rmOp(path);
|
|
404
|
-
}
|
|
360
|
+
yield* this._clearPath(resolved.path);
|
|
405
361
|
}
|
|
406
|
-
// Create directory if it doesn't exist (final check)
|
|
407
362
|
if (!this.filed) {
|
|
408
|
-
|
|
409
|
-
if (!pathExists) {
|
|
410
|
-
// Path doesn't exist, create it
|
|
411
|
-
this.logger.info(`Creating directory at ${path}`);
|
|
412
|
-
const created = yield* this._mkdirOp(path, perm);
|
|
413
|
-
if (!created) {
|
|
414
|
-
// Creation failed - this is unexpected at this point, but log it
|
|
415
|
-
this.logger.warn(`Warning: Failed to create directory at ${path}`);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
else {
|
|
419
|
-
// Path exists, verify we can access it
|
|
420
|
-
const hasAccess = yield* this._accessOp(path);
|
|
421
|
-
if (!hasAccess) {
|
|
422
|
-
// Path exists but not accessible - unexpected but continue
|
|
423
|
-
this.logger.warn(`Warning: Path exists but is not accessible: ${path}`);
|
|
424
|
-
}
|
|
425
|
-
}
|
|
363
|
+
yield* this._ensureDirectoryExists(resolved.path);
|
|
426
364
|
}
|
|
427
|
-
this.path = path;
|
|
365
|
+
this.path = resolved.path;
|
|
428
366
|
this.opened = true;
|
|
429
367
|
return this.opened;
|
|
430
368
|
}
|
|
369
|
+
/** Update instance fields from caller-provided options. */
|
|
370
|
+
_applyOptions(options) {
|
|
371
|
+
this.temp = options.temp ?? this.temp;
|
|
372
|
+
this.perm = options.perm ?? this.perm;
|
|
373
|
+
this.mode = options.mode ?? this.mode;
|
|
374
|
+
this.fext = options.fext ?? this.fext;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Select which concrete path to use: temp, primary with alt fallback,
|
|
378
|
+
* reuse with alt fallback, or primary directly (custom headDirPath).
|
|
379
|
+
*/
|
|
380
|
+
*_resolvePath(params) {
|
|
381
|
+
if (this.temp) {
|
|
382
|
+
return { path: params.tempPath, headDirPath: params.headDirPath };
|
|
383
|
+
}
|
|
384
|
+
if (params.reuse) {
|
|
385
|
+
return yield* this._reuseOrFallback(params.primary, params.alt, params.headDirPath);
|
|
386
|
+
}
|
|
387
|
+
return yield* this._createOrFallback(params.primary, params.alt, params.headDirPath);
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Try to use or create the primary path. If creation fails (e.g. EACCES),
|
|
391
|
+
* fall back to the alt path. Throws if alt path also fails.
|
|
392
|
+
*/
|
|
393
|
+
*_createOrFallback(primary, alt, headDirPath) {
|
|
394
|
+
const exists = yield* this.statOp(primary);
|
|
395
|
+
if (exists) {
|
|
396
|
+
return { path: primary, headDirPath };
|
|
397
|
+
}
|
|
398
|
+
this.logger.info(`Creating directory at ${primary}`);
|
|
399
|
+
const created = yield* this.mkdirOp(primary, this.perm);
|
|
400
|
+
if (created) {
|
|
401
|
+
return { path: primary, headDirPath };
|
|
402
|
+
}
|
|
403
|
+
this.logger.warn(`Failed to create primary path, falling back to alt path`);
|
|
404
|
+
const altReady = yield* this._ensurePathAccessible(alt);
|
|
405
|
+
if (!altReady) {
|
|
406
|
+
this.logger.error(`Alt path not available at ${alt}`);
|
|
407
|
+
throw new PathError(`Alt path not available at ${alt}`, { path: alt });
|
|
408
|
+
}
|
|
409
|
+
return { path: alt, headDirPath: this.defaults.altHeadDirPath };
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Verify the primary path exists and is accessible for reuse.
|
|
413
|
+
* If not accessible and using the default head dir, fall back to alt.
|
|
414
|
+
*/
|
|
415
|
+
*_reuseOrFallback(primary, alt, headDirPath) {
|
|
416
|
+
const exists = yield* this.statOp(primary);
|
|
417
|
+
const accessible = exists ? yield* this.accessOp(primary) : false;
|
|
418
|
+
if (exists && accessible) {
|
|
419
|
+
return { path: primary, headDirPath };
|
|
420
|
+
}
|
|
421
|
+
this.logger.info(`Reuse path unavailable, attempting to (re)create primary path`);
|
|
422
|
+
const primaryReady = yield* this._ensurePathAccessible(primary);
|
|
423
|
+
if (primaryReady) {
|
|
424
|
+
return { path: primary, headDirPath };
|
|
425
|
+
}
|
|
426
|
+
this.logger.info(`Primary path unavailable, trying alt path`);
|
|
427
|
+
const altReady = yield* this._ensurePathAccessible(alt);
|
|
428
|
+
if (!altReady) {
|
|
429
|
+
this.logger.warn(`Alt path not available: ${alt}`);
|
|
430
|
+
}
|
|
431
|
+
return { path: alt, headDirPath: this.defaults.altHeadDirPath };
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Ensure a path exists and is accessible, creating it if necessary.
|
|
435
|
+
* Returns true if the path is ready for use.
|
|
436
|
+
*/
|
|
437
|
+
*_ensurePathAccessible(path) {
|
|
438
|
+
const exists = yield* this.statOp(path);
|
|
439
|
+
if (!exists) {
|
|
440
|
+
this.logger.info(`Creating directory at ${path}`);
|
|
441
|
+
return yield* this.mkdirOp(path, this.perm);
|
|
442
|
+
}
|
|
443
|
+
return yield* this.accessOp(path);
|
|
444
|
+
}
|
|
445
|
+
/** Remove existing file or directory at path. */
|
|
446
|
+
*_clearPath(path) {
|
|
447
|
+
const stat = yield* this.statFileOp(path);
|
|
448
|
+
if (stat.isDirectory || stat.isFile) {
|
|
449
|
+
yield* this.rmOp(path);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
/** Ensure the directory at path exists and is accessible, creating it if needed. */
|
|
453
|
+
*_ensureDirectoryExists(path) {
|
|
454
|
+
const exists = yield* this.statOp(path);
|
|
455
|
+
if (!exists) {
|
|
456
|
+
this.logger.info(`Creating directory at ${path}`);
|
|
457
|
+
const created = yield* this.mkdirOp(path, this.perm);
|
|
458
|
+
if (!created) {
|
|
459
|
+
this.logger.warn(`Failed to create directory at ${path}`);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
const accessible = yield* this.accessOp(path);
|
|
464
|
+
if (!accessible) {
|
|
465
|
+
this.logger.warn(`Path exists but is not accessible: ${path}`);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
431
469
|
/**
|
|
432
470
|
* Close the path manager
|
|
433
471
|
* If clear is true, removes the directory/file
|
|
@@ -435,24 +473,10 @@ export class PathManager {
|
|
|
435
473
|
*/
|
|
436
474
|
*close(clear = false) {
|
|
437
475
|
if (clear && this.path) {
|
|
438
|
-
yield* this.
|
|
476
|
+
yield* this.rmOp(this.path);
|
|
439
477
|
}
|
|
440
478
|
this.path = null;
|
|
441
479
|
this.opened = false;
|
|
442
480
|
return true;
|
|
443
481
|
}
|
|
444
|
-
/**
|
|
445
|
-
* Check if database files exist in the path directory
|
|
446
|
-
* LMDB creates data.mdb and lock.mdb files
|
|
447
|
-
* Returns true if data.mdb exists (lock.mdb might not exist if no active transactions)
|
|
448
|
-
* Uses Effection for structured concurrency
|
|
449
|
-
*/
|
|
450
|
-
*databaseFilesExist() {
|
|
451
|
-
if (!this.path) {
|
|
452
|
-
return false;
|
|
453
|
-
}
|
|
454
|
-
const dataMdbPath = `${this.path}/data.mdb`;
|
|
455
|
-
const pathStat = yield* this._statFileOp(dataMdbPath);
|
|
456
|
-
return pathStat.isFile ?? false;
|
|
457
|
-
}
|
|
458
482
|
}
|
package/esm/db/index.js
CHANGED