keri-ts 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 (55) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +70 -0
  3. package/esm/_dnt.polyfills.js +127 -0
  4. package/esm/_dnt.shims.js +61 -0
  5. package/esm/app/cli/agent.js +37 -0
  6. package/esm/app/cli/cli-node.js +9 -0
  7. package/esm/app/cli/cli.js +195 -0
  8. package/esm/app/cli/db-dump.js +68 -0
  9. package/esm/app/cli/init.js +75 -0
  10. package/esm/app/server.js +77 -0
  11. package/esm/core/bytes.js +39 -0
  12. package/esm/core/errors.js +26 -0
  13. package/esm/core/index.js +7 -0
  14. package/esm/db/basing.js +168 -0
  15. package/esm/db/core/db.js +19 -0
  16. package/esm/db/core/lmdber.js +474 -0
  17. package/esm/db/core/path-manager.js +450 -0
  18. package/esm/db/index.js +4 -0
  19. package/esm/npm/index.js +4 -0
  20. package/esm/package.json +3 -0
  21. package/package.json +57 -0
  22. package/types/_dnt.polyfills.d.ts +101 -0
  23. package/types/_dnt.polyfills.d.ts.map +1 -0
  24. package/types/_dnt.shims.d.ts +6 -0
  25. package/types/_dnt.shims.d.ts.map +1 -0
  26. package/types/app/cli/agent.d.ts +9 -0
  27. package/types/app/cli/agent.d.ts.map +1 -0
  28. package/types/app/cli/cli-node.d.ts +2 -0
  29. package/types/app/cli/cli-node.d.ts.map +1 -0
  30. package/types/app/cli/cli.d.ts +7 -0
  31. package/types/app/cli/cli.d.ts.map +1 -0
  32. package/types/app/cli/db-dump.d.ts +11 -0
  33. package/types/app/cli/db-dump.d.ts.map +1 -0
  34. package/types/app/cli/init.d.ts +3 -0
  35. package/types/app/cli/init.d.ts.map +1 -0
  36. package/types/app/server.d.ts +8 -0
  37. package/types/app/server.d.ts.map +1 -0
  38. package/types/core/bytes.d.ts +17 -0
  39. package/types/core/bytes.d.ts.map +1 -0
  40. package/types/core/errors.d.ts +19 -0
  41. package/types/core/errors.d.ts.map +1 -0
  42. package/types/core/index.d.ts +8 -0
  43. package/types/core/index.d.ts.map +1 -0
  44. package/types/db/basing.d.ts +80 -0
  45. package/types/db/basing.d.ts.map +1 -0
  46. package/types/db/core/db.d.ts +5 -0
  47. package/types/db/core/db.d.ts.map +1 -0
  48. package/types/db/core/lmdber.d.ts +135 -0
  49. package/types/db/core/lmdber.d.ts.map +1 -0
  50. package/types/db/core/path-manager.d.ts +92 -0
  51. package/types/db/core/path-manager.d.ts.map +1 -0
  52. package/types/db/index.d.ts +5 -0
  53. package/types/db/index.d.ts.map +1 -0
  54. package/types/npm/index.d.ts +5 -0
  55. package/types/npm/index.d.ts.map +1 -0
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Database dump command for CLI
3
+ *
4
+ * Dumps the contents of Baser.evts sub-database to console in prettified table format
5
+ */
6
+ import { type Operation } from "effection";
7
+ /**
8
+ * Dump the evts sub-database to console
9
+ */
10
+ export declare function dumpEvts(args: Record<string, unknown>): Operation<void>;
11
+ //# sourceMappingURL=db-dump.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-dump.d.ts","sourceRoot":"","sources":["../../../src/app/cli/db-dump.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAI3C;;GAEG;AACH,wBAAiB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAiExE"}
@@ -0,0 +1,3 @@
1
+ import { type Operation } from "effection";
2
+ export declare function initCommand(args: Record<string, unknown>): Operation<void>;
3
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/app/cli/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAuC3C,wBAAiB,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAqE3E"}
@@ -0,0 +1,8 @@
1
+ import { type Operation } from "effection";
2
+ /**
3
+ * Start HTTP server with Effection as the outermost runtime.
4
+ * Each request is spawned as a separate Effection task, ensuring
5
+ * proper structured concurrency and cleanup.
6
+ */
7
+ export declare function startServer(port?: number): Operation<void>;
8
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/app/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAInD;;;;GAIG;AACH,wBAAiB,WAAW,CAAC,IAAI,GAAE,MAAa,GAAG,SAAS,CAAC,IAAI,CAAC,CA8EjE"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Check if keyBytes starts with prefixBytes
3
+ */
4
+ export declare function startsWith(keyBytes: Uint8Array, prefixBytes: Uint8Array): boolean;
5
+ /**
6
+ * Convert bytes to a displayable string for terminal output.
7
+ *
8
+ * Decodes bytes as UTF-8 and replaces non-printable control characters
9
+ * with '.' for readable terminal display. UTF-8 can represent control
10
+ * characters (like \x00, \x09, \x0A) which are valid but not printable.
11
+ *
12
+ * @param bytes - Bytes to convert to display string
13
+ * @param maxLength - Optional maximum length; if exceeded, truncates and adds "..."
14
+ * @returns Displayable string with control characters replaced
15
+ */
16
+ export declare function displayStr(bytes: Uint8Array, maxLength?: number): string;
17
+ //# sourceMappingURL=bytes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/core/bytes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,UAAU,GACtB,OAAO,CAQT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAcxE"}
@@ -0,0 +1,19 @@
1
+ export declare class AppError extends Error {
2
+ readonly context?: Record<string, unknown> | undefined;
3
+ constructor(message: string, context?: Record<string, unknown> | undefined);
4
+ }
5
+ export declare class ValidationError extends AppError {
6
+ }
7
+ export declare class PathError extends AppError {
8
+ }
9
+ export declare class InvalidPathNameError extends ValidationError {
10
+ }
11
+ export declare class DatabaseError extends AppError {
12
+ }
13
+ export declare class DatabaseNotOpenError extends DatabaseError {
14
+ }
15
+ export declare class DatabaseKeyError extends DatabaseError {
16
+ }
17
+ export declare class DatabaseOperationError extends DatabaseError {
18
+ }
19
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;aAGf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBADjD,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;CAKpD;AAED,qBAAa,eAAgB,SAAQ,QAAQ;CAAG;AAEhD,qBAAa,SAAU,SAAQ,QAAQ;CAAG;AAE1C,qBAAa,oBAAqB,SAAQ,eAAe;CAAG;AAE5D,qBAAa,aAAc,SAAQ,QAAQ;CAAG;AAE9C,qBAAa,oBAAqB,SAAQ,aAAa;CAAG;AAE1D,qBAAa,gBAAiB,SAAQ,aAAa;CAAG;AAEtD,qBAAa,sBAAuB,SAAQ,aAAa;CAAG"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Core module - public API
3
+ *
4
+ * This module will contain core KERI types (future).
5
+ */
6
+ export * from "./bytes.js";
7
+ export * from "./errors.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Baser - KERI Event Log Database
3
+ *
4
+ * Manages KEL events and related data using composition with LMDBer.
5
+ * Sets up named sub-databases for key event logs.
6
+ */
7
+ import { type Operation } from "effection";
8
+ import { Database } from "lmdb";
9
+ import { BinKey, BinVal, LMDBerOptions } from "./core/lmdber.js";
10
+ export interface BaserOptions extends LMDBerOptions {
11
+ }
12
+ /**
13
+ * Baser manages KERI event logs
14
+ * Uses composition with LMDBer instead of inheritance
15
+ */
16
+ export declare class Baser {
17
+ private lmdber;
18
+ evts: Database<BinVal, BinKey>;
19
+ static readonly TailDirPath = "keri/db";
20
+ static readonly AltTailDirPath = ".keri/db";
21
+ static readonly TempPrefix = "keri_db_";
22
+ static readonly MaxNamedDBs = 96;
23
+ constructor(options?: BaserOptions);
24
+ get name(): string;
25
+ get base(): string;
26
+ get opened(): boolean;
27
+ get temp(): boolean;
28
+ get path(): string | null;
29
+ get env(): import("lmdb").RootDatabase<any, import("lmdb").Key> | null;
30
+ /**
31
+ * Reopen the database and initialize sub-databases
32
+ */
33
+ reopen(options?: Partial<BaserOptions>): Operation<boolean>;
34
+ /**
35
+ * Close the database
36
+ */
37
+ close(clear?: boolean): Operation<boolean>;
38
+ /**
39
+ * Get version
40
+ */
41
+ getVer(): string | null;
42
+ /**
43
+ * Set version
44
+ */
45
+ setVer(val: string): void;
46
+ /**
47
+ * Count entries in evts sub-database
48
+ */
49
+ cntEvts(): number;
50
+ /**
51
+ * Put value in evts sub-database
52
+ */
53
+ putEvt(key: Uint8Array, val: Uint8Array): boolean;
54
+ /**
55
+ * Set value in evts sub-database
56
+ */
57
+ setEvt(key: Uint8Array, val: Uint8Array): boolean;
58
+ /**
59
+ * Get value from evts sub-database
60
+ */
61
+ getEvt(key: Uint8Array): Uint8Array | null;
62
+ /**
63
+ * Delete value from evts sub-database
64
+ */
65
+ delEvt(key: Uint8Array): boolean;
66
+ /**
67
+ * Get iterator over items in evts sub-database
68
+ *
69
+ * @param top - Key prefix to filter by (empty to get all items)
70
+ * @returns Generator yielding (key, val) tuples
71
+ */
72
+ getAllEvtsIter(top?: Uint8Array): Generator<[Uint8Array, Uint8Array]>;
73
+ }
74
+ /**
75
+ * Create and open a Baser instance.
76
+ *
77
+ * Constructors cannot be async, so call this factory where an opened Baser is required.
78
+ */
79
+ export declare function createBaser(options?: BaserOptions): Operation<Baser>;
80
+ //# sourceMappingURL=basing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basing.d.ts","sourceRoot":"","sources":["../../src/db/basing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAKhC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAU,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzE,MAAM,WAAW,YAAa,SAAQ,aAAa;CAElD;AAED;;;GAGG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,CAAS;IAGhB,IAAI,EAAG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGvC,MAAM,CAAC,QAAQ,CAAC,WAAW,aAAa;IACxC,MAAM,CAAC,QAAQ,CAAC,cAAc,cAAc;IAC5C,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAc;IACxC,MAAM,CAAC,QAAQ,CAAC,WAAW,MAAM;gBAErB,OAAO,GAAE,YAAiB;IAUtC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,IAAI,IAAI,IAAI,MAAM,GAAG,IAAI,CAExB;IAED,IAAI,GAAG,gEAEN;IAED;;OAEG;IACF,MAAM,CAAC,OAAO,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,SAAS,CAAC,OAAO,CAAC;IAsBhE;;OAEG;IACF,KAAK,CAAC,KAAK,UAAQ,GAAG,SAAS,CAAC,OAAO,CAAC;IAIzC;;OAEG;IACH,MAAM,IAAI,MAAM,GAAG,IAAI;IAIvB;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO;IAIjD;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO;IAIjD;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI;IAI1C;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO;IAIhC;;;;;OAKG;IACF,cAAc,CACb,GAAG,GAAE,UAA8B,GAClC,SAAS,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;CAGvC;AAED;;;;GAIG;AACH,wBAAiB,WAAW,CAAC,OAAO,GAAE,YAAiB,GAAG,SAAS,CAAC,KAAK,CAAC,CAOzE"}
@@ -0,0 +1,5 @@
1
+ import { Key, RootDatabase } from "lmdb";
2
+ export declare function openDB(path?: string): RootDatabase<any, Key>;
3
+ export declare function readValue(db: RootDatabase, key: string): string | null;
4
+ export declare function writeValue(db: RootDatabase, key: string, value: string): void;
5
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../src/db/core/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAQ,YAAY,EAAE,MAAM,MAAM,CAAC;AAK/C,wBAAgB,MAAM,CAAC,IAAI,GAAE,MAAqB,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAK1E;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGtE;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAKtE"}
@@ -0,0 +1,135 @@
1
+ import { type Operation } from "effection";
2
+ import { Database, Key, RootDatabase } from "lmdb";
3
+ import { PathManagerDefaults, PathManagerOptions } from "./path-manager.js";
4
+ export type BinVal = Uint8Array;
5
+ export type BinKey = Uint8Array;
6
+ export declare const b: (t: string) => Uint8Array;
7
+ export declare const t: (b: Uint8Array) => string;
8
+ export interface LMDBerOptions extends PathManagerOptions {
9
+ readonly?: boolean;
10
+ dupsort?: boolean;
11
+ }
12
+ export interface LMDBerDefaults extends PathManagerDefaults {
13
+ maxNamedDBs: number;
14
+ mapSize: number;
15
+ }
16
+ export declare const LMDBER_DEFAULTS: LMDBerDefaults;
17
+ /**
18
+ * LMDBer manages LMDB database environments
19
+ * Uses composition with PathManager for path management
20
+ */
21
+ export declare class LMDBer {
22
+ private pathManager;
23
+ env: RootDatabase<any, Key> | null;
24
+ readonly: boolean;
25
+ private defaults;
26
+ static readonly HeadDirPath = "/usr/local/var";
27
+ static readonly TailDirPath = "keri/db";
28
+ static readonly CleanTailDirPath = "keri/clean/db";
29
+ static readonly AltHeadDirPath = "~";
30
+ static readonly AltTailDirPath = ".keri/db";
31
+ static readonly AltCleanTailDirPath = ".keri/clean/db";
32
+ static readonly TempHeadDir = "/tmp";
33
+ static readonly TempPrefix = "keri_lmdb_";
34
+ static readonly TempSuffix = "_test";
35
+ static readonly Perm = 960;
36
+ static readonly MaxNamedDBs = 96;
37
+ constructor(options?: LMDBerOptions, defaults?: Partial<LMDBerDefaults>);
38
+ get name(): string;
39
+ get base(): string;
40
+ get opened(): boolean;
41
+ get temp(): boolean;
42
+ get path(): string | null;
43
+ private formatDbKeyError;
44
+ /**
45
+ * Reopen the LMDB database
46
+ * Closes existing database if open before opening a new one to prevent double-free errors
47
+ */
48
+ reopen(options?: Partial<LMDBerOptions>): Operation<boolean>;
49
+ /**
50
+ * Check if database already exists by checking for database files
51
+ */
52
+ private checkDatabaseExists;
53
+ /**
54
+ * Close the LMDB database
55
+ */
56
+ close(clear?: boolean): Operation<boolean>;
57
+ /**
58
+ * Get database version
59
+ */
60
+ getVer(): string | null;
61
+ /**
62
+ * Set database version
63
+ */
64
+ setVer(val: string): void;
65
+ /**
66
+ * Open a named sub-database
67
+ */
68
+ openDB(name: string, dupsort?: boolean): Database<BinVal, BinKey>;
69
+ /**
70
+ * Put value (no overwrite)
71
+ *
72
+ * @param db - Named sub-database
73
+ * @param key - Key bytes
74
+ * @param val - Value bytes
75
+ * @returns True if successfully written, False if key already exists
76
+ */
77
+ putVal(db: Database<BinVal, BinKey>, key: Uint8Array, val: Uint8Array): boolean;
78
+ /**
79
+ * Set value (overwrite allowed)
80
+ *
81
+ * @param db - Named sub-database
82
+ * @param key - Key bytes
83
+ * @param val - Value bytes
84
+ * @returns True if successfully written
85
+ */
86
+ setVal(db: Database<BinVal, BinKey>, key: Uint8Array, val: Uint8Array): boolean;
87
+ /**
88
+ * Get value
89
+ *
90
+ * @param db - Named sub-database
91
+ * @param key - Key bytes
92
+ * @returns Value bytes or null if not found
93
+ */
94
+ getVal(db: Database<BinVal, BinKey>, key: Uint8Array): Uint8Array | null;
95
+ /**
96
+ * Delete value
97
+ *
98
+ * @param db - Named sub-database
99
+ * @param key - Key bytes
100
+ * @returns True if key existed, False otherwise
101
+ */
102
+ delVal(db: Database<BinVal, BinKey>, key: Uint8Array): boolean;
103
+ /**
104
+ * Count all values in database
105
+ *
106
+ * @param db - Named sub-database
107
+ * @returns Count of entries
108
+ */
109
+ cnt(db: Database<BinVal, BinKey>): number;
110
+ /**
111
+ * Iterates over branch of db given by top key
112
+ *
113
+ * Returns iterator of (full key, val) tuples over a branch of the db given by top key
114
+ * where: full key is full database key for val not truncated top key.
115
+ *
116
+ * Works for both dupsort==False and dupsort==True
117
+ * Because cursor.iternext() advances cursor after returning item its safe
118
+ * to delete the item within the iteration loop.
119
+ *
120
+ * @param db - Named sub-database
121
+ * @param top - Truncated top key, a key space prefix to get all the items
122
+ * from multiple branches of the key space. If top key is
123
+ * empty then gets all items in database.
124
+ * Empty Uint8Array matches all keys (like str.startswith('') always returns True)
125
+ * @returns Generator yielding (key, val) tuples
126
+ */
127
+ getTopItemIter(db: Database<BinVal, BinKey>, top?: Uint8Array): Generator<[Uint8Array, Uint8Array]>;
128
+ }
129
+ /**
130
+ * Create and open an LMDBer instance.
131
+ *
132
+ * Constructors cannot be async, so call this factory where an opened LMDBer is required.
133
+ */
134
+ export declare function createLMDBer(options?: LMDBerOptions, defaults?: Partial<LMDBerDefaults>): Operation<LMDBer>;
135
+ //# sourceMappingURL=lmdber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lmdber.d.ts","sourceRoot":"","sources":["../../../src/db/core/lmdber.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAQ,YAAY,EAAE,MAAM,MAAM,CAAC;AAOzD,OAAO,EAEL,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAChC,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAQhC,eAAO,MAAM,CAAC,GAAI,GAAG,MAAM,KAAG,UAA+B,CAAC;AAE9D,eAAO,MAAM,CAAC,GAAI,GAAG,UAAU,KAAG,MAA2B,CAAC;AAE9D,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAe,SAAQ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AAO,CAAC,cAAc,CAAC,GACjC,SAAS,CAAC,MAAM,CAAC,CAOnB"}
@@ -0,0 +1,92 @@
1
+ import { type Operation } from "effection";
2
+ export interface PathManagerOptions {
3
+ name?: string;
4
+ base?: string;
5
+ temp?: boolean;
6
+ headDirPath?: string;
7
+ perm?: number;
8
+ reopen?: boolean;
9
+ clear?: boolean;
10
+ reuse?: boolean;
11
+ clean?: boolean;
12
+ filed?: boolean;
13
+ extensioned?: boolean;
14
+ mode?: string;
15
+ fext?: string;
16
+ }
17
+ export interface PathManagerDefaults {
18
+ headDirPath: string;
19
+ tailDirPath: string;
20
+ cleanTailDirPath: string;
21
+ altHeadDirPath: string;
22
+ altTailDirPath: string;
23
+ altCleanTailDirPath: string;
24
+ tempHeadDir: string;
25
+ tempPrefix: string;
26
+ tempSuffix: string;
27
+ perm: number;
28
+ mode: string;
29
+ fext: string;
30
+ }
31
+ export declare const PATH_DEFAULTS: PathManagerDefaults;
32
+ /**
33
+ * PathManager manages file and directory paths
34
+ */
35
+ export declare class PathManager {
36
+ private _name;
37
+ base: string;
38
+ temp: boolean;
39
+ headDirPath: string;
40
+ path: string | null;
41
+ perm: number;
42
+ filed: boolean;
43
+ extensioned: boolean;
44
+ mode: string;
45
+ fext: string;
46
+ opened: boolean;
47
+ private defaults;
48
+ constructor(options?: PathManagerOptions, defaults?: Partial<PathManagerDefaults>);
49
+ get name(): string;
50
+ set name(value: string);
51
+ _getTempPath(): string;
52
+ _pathExpandTilde(path: string): string;
53
+ _getPrimaryPath(headDirPath: string, clean: boolean): string;
54
+ _getAltPath(clean: boolean): string;
55
+ _getPersistentPaths(options?: Partial<PathManagerOptions>): [string, string];
56
+ _getPaths(options?: Partial<PathManagerOptions>): [string, string, string];
57
+ /**
58
+ * Helper: Convert Promise-based file system operations to Effection operations
59
+ * This ensures proper structured concurrency and cancellation support
60
+ */
61
+ private _statOp;
62
+ private _accessOp;
63
+ private _mkdirOp;
64
+ private _rmOp;
65
+ private _statFileOp;
66
+ /**
67
+ * Reopen/create the directory or file path
68
+ * Replicates KERIpy/HIO Filer.remake logic:
69
+ * - Tries primary path (/usr/local/var/keri/*) first
70
+ * - Falls back to alt path (~/.keri/*) on OS errors or access issues
71
+ *
72
+ * Uses Effection for structured concurrency:
73
+ * - All file system operations are cancellable
74
+ * - No dangling promises - operations tracked in Effection task tree
75
+ * - Automatic cleanup if parent operation is halted
76
+ */
77
+ reopen(options?: Partial<PathManagerOptions>): Operation<boolean>;
78
+ /**
79
+ * Close the path manager
80
+ * If clear is true, removes the directory/file
81
+ * Uses Effection for structured concurrency
82
+ */
83
+ close(clear?: boolean): Operation<boolean>;
84
+ /**
85
+ * Check if database files exist in the path directory
86
+ * LMDB creates data.mdb and lock.mdb files
87
+ * Returns true if data.mdb exists (lock.mdb might not exist if no active transactions)
88
+ * Uses Effection for structured concurrency
89
+ */
90
+ databaseFilesExist(): Operation<boolean>;
91
+ }
92
+ //# sourceMappingURL=path-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-manager.d.ts","sourceRoot":"","sources":["../../../src/db/core/path-manager.ts"],"names":[],"mappings":"AASA,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAGnD,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM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AmB,CACjB,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAM,GACxC,CAAC,MAAM,EAAE,MAAM,CAAC;IASnB,SAAS,CACP,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAM,GACxC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAM3B;;;OAGG;IACH,OAAO,CAAE,OAAO;IAehB,OAAO,CAAE,SAAS;IAWlB,OAAO,CAAE,QAAQ;IAejB,OAAO,CAAE,KAAK;IAed,OAAO,CAAE,WAAW;IAyBpB;;;;;;;;;;OAUG;IACF,MAAM,CAAC,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAAG,SAAS,CAAC,OAAO,CAAC;IA2JtE;;;;OAIG;IACF,KAAK,CAAC,KAAK,UAAQ,GAAG,SAAS,CAAC,OAAO,CAAC;IASzC;;;;;OAKG;IACF,kBAAkB,IAAI,SAAS,CAAC,OAAO,CAAC;CAS1C"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Database module exports
3
+ */
4
+ export * from "./basing.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ import "../_dnt.polyfills.js";
2
+ export * from "../core/index.js";
3
+ export * from "../db/index.js";
4
+ export { kli } from "../app/cli/cli.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/npm/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC"}