@zipbul/gildash 0.34.0 → 0.34.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1 @@
1
1
  export declare function hashString(input: string): string;
2
- export declare function hashFile(filePath: string): Promise<string>;
@@ -1,3 +1,13 @@
1
+ declare const RelBrand: unique symbol;
2
+ declare const AbsBrand: unique symbol;
3
+ /** A project-relative, forward-slash-normalized path (store/query domain). */
4
+ export type RelPath = string & {
5
+ readonly [RelBrand]: never;
6
+ };
7
+ /** An absolute, forward-slash-normalized path (fs / tsc domain). */
8
+ export type AbsPath = string & {
9
+ readonly [AbsBrand]: never;
10
+ };
1
11
  /**
2
12
  * Normalize a file path to always use forward slashes.
3
13
  *
@@ -6,5 +16,21 @@
6
16
  * so every path that enters the system must pass through this function.
7
17
  */
8
18
  export declare function normalizePath(p: string): string;
9
- export declare function toRelativePath(projectRoot: string, absolutePath: string): string;
10
- export declare function toAbsolutePath(projectRoot: string, relativePath: string): string;
19
+ /** Project-relative, normalized path from an absolute one. */
20
+ export declare function toRelativePath(projectRoot: string, absolutePath: string): RelPath;
21
+ /** Absolute, normalized path from a project-relative one. */
22
+ export declare function toAbsolutePath(projectRoot: string, relativePath: string): AbsPath;
23
+ /**
24
+ * Brand a string that is already a project-relative path (e.g. a value read
25
+ * back from the store, or a relative input from a caller) as {@link RelPath},
26
+ * normalizing separators. Use {@link toRelativePath} when the input may be
27
+ * absolute.
28
+ */
29
+ export declare function relPath(p: string): RelPath;
30
+ /**
31
+ * Normalize an inbound caller path (which may be absolute or relative) to the
32
+ * store's {@link RelPath} domain. This is the single entry-point every public
33
+ * facade method routes a `filePath` argument through.
34
+ */
35
+ export declare function inboundRelPath(projectRoot: string, filePath: string): RelPath;
36
+ export {};
@@ -132,6 +132,15 @@ export interface ExpressionTemplate {
132
132
  export interface ExpressionUnresolvable {
133
133
  kind: 'unresolvable';
134
134
  sourceText: string;
135
+ /**
136
+ * Why the node could not be structurally represented.
137
+ *
138
+ * - `'depth-cap'` — the node was truncated at the extractor's recursion depth
139
+ * limit for stack safety, *not* because its form is unsupported. The real
140
+ * value is recoverable by re-parsing `sourceText`.
141
+ * - `undefined` — the node's syntactic form is genuinely not representable.
142
+ */
143
+ reason?: 'depth-cap';
135
144
  }
136
145
  /**
137
146
  * The kind of a symbol extracted from TypeScript source.
@@ -146,7 +155,8 @@ export interface ExpressionUnresolvable {
146
155
  * - `'namespace'` — `namespace`, `declare namespace`, and `declare module` declarations
147
156
  * - `'property'` — class properties and interface/type members
148
157
  */
149
- export type SymbolKind = 'function' | 'method' | 'class' | 'variable' | 'type' | 'interface' | 'enum' | 'namespace' | 'property';
158
+ export declare const SYMBOL_KINDS: readonly ["function", "method", "class", "variable", "type", "interface", "enum", "namespace", "property"];
159
+ export type SymbolKind = (typeof SYMBOL_KINDS)[number];
150
160
  /**
151
161
  * TypeScript declaration modifiers attached to a symbol.
152
162
  */
@@ -304,9 +314,11 @@ export interface ImportReference {
304
314
  * - `'extends'` — class/interface in file A extends one in file B
305
315
  * - `'implements'` — class in file A implements an interface in file B
306
316
  */
317
+ export declare const RELATION_TYPES: readonly ["imports", "type-references", "re-exports", "calls", "extends", "implements"];
318
+ export type RelationType = (typeof RELATION_TYPES)[number];
307
319
  export interface CodeRelation {
308
320
  /** The kind of relationship. */
309
- type: 'imports' | 'type-references' | 're-exports' | 'calls' | 'extends' | 'implements';
321
+ type: RelationType;
310
322
  /** File path where the relationship originates. */
311
323
  srcFilePath: string;
312
324
  /** Source symbol name, or `null` for module-level relationships. */
@@ -341,7 +353,8 @@ export interface CodeRelation {
341
353
  */
342
354
  specifier?: string;
343
355
  }
344
- export type AnnotationSource = 'jsdoc' | 'line' | 'block';
356
+ export declare const ANNOTATION_SOURCES: readonly ["jsdoc", "line", "block"];
357
+ export type AnnotationSource = (typeof ANNOTATION_SOURCES)[number];
345
358
  export interface ExtractedAnnotation {
346
359
  tag: string;
347
360
  value: string;
@@ -14,12 +14,13 @@ import type { WatcherOwnerStore } from '../watcher/ownership';
14
14
  import type { WatcherRole } from '../watcher/types';
15
15
  import type { ProjectBoundary } from '../common/project-discovery';
16
16
  import type { TsconfigPaths } from '../common/tsconfig-resolver';
17
- import type { SymbolSearchQuery, SymbolSearchResult, ISymbolRepo } from '../search/symbol-search';
18
- import type { RelationSearchQuery, IRelationRepo } from '../search/relation-search';
17
+ import type { SymbolSearchQuery, SymbolSearchResult, SymbolRepositoryReader } from '../search/symbol-search';
18
+ import type { RelationSearchQuery, RelationRepositoryReader } from '../search/relation-search';
19
19
  import type { PatternMatch } from '../search/pattern-search';
20
- import type { AnnotationSearchQuery, AnnotationSearchResult, IAnnotationRepo } from '../search/annotation-search';
20
+ import type { AnnotationSearchQuery, AnnotationSearchResult, AnnotationRepositoryReader } from '../search/annotation-search';
21
21
  import type { DependencyGraph } from '../search/dependency-graph';
22
22
  import type { ChangelogRepository } from '../store/repositories/changelog.repository';
23
+ import type { AnnotationRepository } from '../store/repositories/annotation.repository';
23
24
  import type { SemanticLayer } from '../semantic/index';
24
25
  import type { ParseCache } from '../parser/parse-cache';
25
26
  import type { GildashError } from '../errors';
@@ -28,12 +29,14 @@ export type ParseSourceFn = (filePath: string, sourceText: string, options?: Par
28
29
  export type ExtractSymbolsFn = (parsed: ParsedFile) => ExtractedSymbol[];
29
30
  export type ExtractRelationsFn = (ast: Program, filePath: string, tsconfigPaths?: TsconfigPaths) => CodeRelation[];
30
31
  export type SymbolSearchFn = (options: {
31
- symbolRepo: ISymbolRepo;
32
+ symbolRepo: SymbolRepositoryReader;
33
+ projectRoot: string;
32
34
  project?: string;
33
35
  query: SymbolSearchQuery;
34
36
  }) => SymbolSearchResult[];
35
37
  export type RelationSearchFn = (options: {
36
- relationRepo: IRelationRepo;
38
+ relationRepo: RelationRepositoryReader;
39
+ projectRoot: string;
37
40
  project?: string;
38
41
  query: RelationSearchQuery;
39
42
  }) => StoredCodeRelation[];
@@ -42,7 +45,7 @@ export type PatternSearchFn = (opts: {
42
45
  filePaths: string[];
43
46
  }) => Promise<PatternMatch[]>;
44
47
  export type AnnotationSearchFn = (options: {
45
- annotationRepo: IAnnotationRepo;
48
+ annotationRepo: AnnotationRepositoryReader;
46
49
  project?: string;
47
50
  query: AnnotationSearchQuery;
48
51
  }) => AnnotationSearchResult[];
@@ -71,7 +74,7 @@ export interface GildashContext {
71
74
  readonly relationRepo: RelationRepository;
72
75
  readonly fileRepo: FileRepoLike;
73
76
  readonly parseCache: ParseCacheLike;
74
- readonly annotationRepo: IAnnotationRepo | null;
77
+ readonly annotationRepo: AnnotationRepository | null;
75
78
  readonly changelogRepo: ChangelogRepository | null;
76
79
  readonly annotationSearchFn: AnnotationSearchFn | null;
77
80
  readonly releaseWatcherRoleFn: ReleaseWatcherRoleFn;
@@ -93,7 +96,7 @@ export interface GildashContext {
93
96
  coordinator: CoordinatorLike | null;
94
97
  watcher: WatcherLike | null;
95
98
  timer: ReturnType<typeof setInterval> | null;
96
- signalHandlers: Array<[string, () => void]>;
99
+ signalHandlers: Array<[NodeJS.Signals | 'beforeExit', () => void]>;
97
100
  tsconfigPaths: TsconfigPaths | null;
98
101
  boundaries: ProjectBoundary[];
99
102
  onIndexedCallbacks: Set<(result: IndexResult) => void>;
@@ -0,0 +1,23 @@
1
+ import { type GildashErrorType } from '../errors';
2
+ import type { GildashContext } from './context';
3
+ /**
4
+ * Shared open-state precondition for every facade operation.
5
+ * Throws `GildashError('closed')` if the instance has been closed.
6
+ *
7
+ * Use this directly for operations that have no failure mode to wrap
8
+ * (e.g. callback subscriptions); use {@link guard} / {@link guardAsync}
9
+ * when the operation can throw and its errors must be normalized.
10
+ */
11
+ export declare function assertOpen(ctx: GildashContext): void;
12
+ /**
13
+ * Run a synchronous facade operation under the uniform guard:
14
+ * reject use after close, pass any {@link GildashError} through untouched,
15
+ * and wrap every other thrown error as a `GildashError` of `errorType`
16
+ * with the message `Gildash: <op> failed`.
17
+ *
18
+ * This is the single definition of the facade's closed-check + error-wrap
19
+ * contract — individual API functions must not re-implement it by hand.
20
+ */
21
+ export declare function guard<T>(ctx: GildashContext, errorType: GildashErrorType, op: string, fn: () => T): T;
22
+ /** Async counterpart of {@link guard}. Awaits `fn` so rejections are normalized too. */
23
+ export declare function guardAsync<T>(ctx: GildashContext, errorType: GildashErrorType, op: string, fn: () => Promise<T>): Promise<T>;
@@ -1,3 +1,4 @@
1
+ import { DbConnection } from '../store/connection';
1
2
  import { FileRepository } from '../store/repositories/file.repository';
2
3
  import { SymbolRepository } from '../store/repositories/symbol.repository';
3
4
  import { RelationRepository } from '../store/repositories/relation.repository';
@@ -13,7 +14,7 @@ import { symbolSearch as defaultSymbolSearch } from '../search/symbol-search';
13
14
  import { relationSearch as defaultRelationSearch } from '../search/relation-search';
14
15
  import type { PatternMatch } from '../search/pattern-search';
15
16
  import { SemanticLayer } from '../semantic/index';
16
- import type { GildashContext, CoordinatorLike, WatcherLike, DbStore } from './context';
17
+ import type { GildashContext, CoordinatorLike, WatcherLike } from './context';
17
18
  import type { GildashOptions } from './types';
18
19
  export declare const HEARTBEAT_INTERVAL_MS = 30000;
19
20
  export declare const HEALTHCHECK_INTERVAL_MS = 15000;
@@ -22,7 +23,7 @@ export declare const MAX_HEALTHCHECK_RETRIES = 10;
22
23
  export declare function applyBoundariesChange(ctx: GildashContext, boundaries: ProjectBoundary[]): void;
23
24
  export interface GildashInternalOptions {
24
25
  existsSyncFn?: (p: string) => boolean;
25
- dbConnectionFactory?: () => DbStore;
26
+ dbConnectionFactory?: () => DbConnection;
26
27
  watcherFactory?: () => WatcherLike;
27
28
  coordinatorFactory?: () => CoordinatorLike;
28
29
  repositoryFactory?: () => {
@@ -1,4 +1,5 @@
1
1
  import type { ParsedFile } from '../parser/types';
2
+ import type { AnnotationSource } from '../extractor/types';
2
3
  interface AnnotationRepoPart {
3
4
  deleteFileAnnotations(project: string, filePath: string): void;
4
5
  insertBatch(project: string, filePath: string, rows: ReadonlyArray<{
@@ -6,7 +7,7 @@ interface AnnotationRepoPart {
6
7
  filePath: string;
7
8
  tag: string;
8
9
  value: string;
9
- source: string;
10
+ source: AnnotationSource;
10
11
  symbolName: string | null;
11
12
  startLine: number;
12
13
  startColumn: number;
@@ -1,9 +1,10 @@
1
1
  import type { Program } from 'oxc-parser';
2
+ import type { RelationType } from '../extractor/types';
2
3
  import type { ProjectBoundary } from '../common/project-discovery';
3
4
  import type { TsconfigPaths } from '../common/tsconfig-resolver';
4
5
  export interface RelationDbRow {
5
6
  project: string;
6
- type: string;
7
+ type: RelationType;
7
8
  srcFilePath: string;
8
9
  srcSymbolName: string | null;
9
10
  dstProject: string | null;
@@ -1,9 +1,9 @@
1
1
  import type { ParsedFile } from '../parser/types';
2
- import type { ExtractedSymbol } from '../extractor/types';
2
+ import type { ExtractedSymbol, SymbolKind } from '../extractor/types';
3
3
  export interface SymbolDbRow {
4
4
  project: string;
5
5
  filePath: string;
6
- kind: string;
6
+ kind: SymbolKind;
7
7
  name: string;
8
8
  startLine: number;
9
9
  startColumn: number;
@@ -1,6 +1,5 @@
1
- import type { Node } from 'oxc-parser';
1
+ import type { Node, Expression } from 'oxc-parser';
2
2
  import type { QualifiedName } from '../extractor/types';
3
- export declare function getNodeHeader(node: Record<string, unknown>, parent?: Record<string, unknown> | null): string;
4
3
  /**
5
4
  * Type predicate for the union of FunctionDeclaration / FunctionExpression /
6
5
  * ArrowFunctionExpression discriminators.
@@ -135,6 +134,4 @@ export type IsNamespace = {
135
134
  * `undefined` returns `false`.
136
135
  */
137
136
  export declare const is: IsNamespace;
138
- export declare function getNodeName(node: unknown): string | null;
139
- export declare function getStringLiteralValue(node: unknown): string | null;
140
- export declare function getQualifiedName(expr: unknown): QualifiedName | null;
137
+ export declare function getQualifiedName(expr: Expression | null | undefined): QualifiedName | null;
@@ -1,7 +1,7 @@
1
1
  export { parseSource } from './parse-source';
2
2
  export { ParseCache } from './parse-cache';
3
3
  export { buildLineOffsets, getLineColumn, } from './source-position';
4
- export { getNodeHeader, isArrowFunctionExpression, isAssignmentExpression, isCallExpression, isFunctionDeclaration, isFunctionExpression, isFunctionNode, isIdentifier, isMemberExpression, isTSQualifiedName, isVariableDeclaration, getNodeName, getStringLiteralValue, getQualifiedName, is, } from './ast-utils';
4
+ export { isArrowFunctionExpression, isAssignmentExpression, isCallExpression, isFunctionDeclaration, isFunctionExpression, isFunctionNode, isIdentifier, isMemberExpression, isTSQualifiedName, isVariableDeclaration, getQualifiedName, is, } from './ast-utils';
5
5
  export type { IsNamespace, NodeTypePredicate } from './ast-utils';
6
6
  export { parseJsDoc } from './jsdoc-parser';
7
7
  export type { ParsedFile, SourcePosition, SourceSpan } from './types';
@@ -26,19 +26,19 @@ export interface AnnotationSearchResult {
26
26
  };
27
27
  };
28
28
  }
29
- export interface IAnnotationRepo {
29
+ export interface AnnotationRepositoryReader {
30
30
  search(opts: {
31
31
  project?: string;
32
32
  tag?: string;
33
33
  filePath?: string;
34
34
  symbolName?: string;
35
- source?: string;
35
+ source?: AnnotationSource;
36
36
  ftsQuery?: string;
37
37
  limit?: number;
38
38
  }): AnnotationRecord[];
39
39
  }
40
40
  export declare function annotationSearch(options: {
41
- annotationRepo: IAnnotationRepo;
41
+ annotationRepo: AnnotationRepositoryReader;
42
42
  project?: string;
43
43
  query: AnnotationSearchQuery;
44
44
  }): AnnotationSearchResult[];
@@ -1,5 +1,6 @@
1
1
  import type { RelationRecord } from '../store/repositories/relation.repository';
2
- export interface IDependencyGraphRepo {
2
+ import type { RelPath } from '../common/path-utils';
3
+ export interface DependencyGraphRelationReader {
3
4
  getByType(project: string, type: string): RelationRecord[];
4
5
  }
5
6
  /**
@@ -22,7 +23,7 @@ export declare class DependencyGraph {
22
23
  private adjacencyList;
23
24
  private reverseAdjacencyList;
24
25
  constructor(options: {
25
- relationRepo: IDependencyGraphRepo;
26
+ relationRepo: DependencyGraphRelationReader;
26
27
  project: string;
27
28
  additionalProjects?: string[];
28
29
  });
@@ -48,22 +49,23 @@ export declare class DependencyGraph {
48
49
  /**
49
50
  * Return the files that `filePath` directly imports.
50
51
  *
51
- * @param filePath - Absolute file path.
52
+ * @param filePath - Project-relative file path (the graph keys on the
53
+ * store's relative-path domain; callers normalize via `inboundRelPath`).
52
54
  */
53
- getDependencies(filePath: string): string[];
55
+ getDependencies(filePath: RelPath): string[];
54
56
  /**
55
57
  * Return the files that directly import `filePath`.
56
58
  *
57
- * @param filePath - Absolute file path.
59
+ * @param filePath - Project-relative file path.
58
60
  */
59
- getDependents(filePath: string): string[];
61
+ getDependents(filePath: RelPath): string[];
60
62
  /**
61
63
  * Return all files that transitively depend on `filePath`
62
64
  * (breadth-first reverse walk).
63
65
  *
64
- * @param filePath - Absolute file path.
66
+ * @param filePath - Project-relative file path.
65
67
  */
66
- getTransitiveDependents(filePath: string): string[];
68
+ getTransitiveDependents(filePath: RelPath): string[];
67
69
  /**
68
70
  * Detect whether the import graph contains at least one cycle.
69
71
  *
@@ -78,10 +80,10 @@ export declare class DependencyGraph {
78
80
  * Combines {@link getTransitiveDependents} for every changed file
79
81
  * and de-duplicates the result.
80
82
  *
81
- * @param changedFiles - Absolute paths of files that changed.
83
+ * @param changedFiles - Project-relative paths of files that changed.
82
84
  * @returns Paths of all transitively-dependent files.
83
85
  */
84
- getAffectedByChange(changedFiles: string[]): string[];
86
+ getAffectedByChange(changedFiles: RelPath[]): string[];
85
87
  /**
86
88
  * Return the full import graph as an adjacency list.
87
89
  *
@@ -99,7 +101,7 @@ export declare class DependencyGraph {
99
101
  * @returns Paths of all transitively-imported files. Does not include `filePath` itself
100
102
  * unless a cycle exists.
101
103
  */
102
- getTransitiveDependencies(filePath: string): string[];
104
+ getTransitiveDependencies(filePath: RelPath): string[];
103
105
  /**
104
106
  * Return the distinct cycle paths in the import graph.
105
107
  *
@@ -1,10 +1,10 @@
1
1
  export { symbolSearch } from './symbol-search';
2
- export type { SymbolSearchQuery, SymbolSearchResult, ISymbolRepo } from './symbol-search';
2
+ export type { SymbolSearchQuery, SymbolSearchResult, SymbolRepositoryReader } from './symbol-search';
3
3
  export { relationSearch } from './relation-search';
4
- export type { RelationSearchQuery, IRelationRepo } from './relation-search';
4
+ export type { RelationSearchQuery, RelationRepositoryReader } from './relation-search';
5
5
  export { DependencyGraph } from './dependency-graph';
6
- export type { IDependencyGraphRepo } from './dependency-graph';
6
+ export type { DependencyGraphRelationReader } from './dependency-graph';
7
7
  export { patternSearch } from './pattern-search';
8
8
  export type { PatternMatch, PatternCapture, PatternSearchOptions } from './pattern-search';
9
9
  export { annotationSearch } from './annotation-search';
10
- export type { AnnotationSearchQuery, AnnotationSearchResult, IAnnotationRepo } from './annotation-search';
10
+ export type { AnnotationSearchQuery, AnnotationSearchResult, AnnotationRepositoryReader } from './annotation-search';
@@ -1,5 +1,7 @@
1
1
  import type { CodeRelation } from '../extractor/types';
2
2
  import type { RelationRecord } from '../store/repositories/relation.repository';
3
+ import { type RelPath } from '../common/path-utils';
4
+ import type { RelationType } from '../extractor/types';
3
5
  /**
4
6
  * A {@link CodeRelation} enriched with the destination project identifier
5
7
  * as stored in the relation index.
@@ -49,14 +51,14 @@ export interface RelationSearchQuery {
49
51
  /** Filter by external package flag. */
50
52
  isExternal?: boolean;
51
53
  }
52
- export interface IRelationRepo {
54
+ export interface RelationRepositoryReader {
53
55
  searchRelations(opts: {
54
- srcFilePath?: string;
56
+ srcFilePath?: RelPath;
55
57
  srcSymbolName?: string;
56
- dstFilePath?: string;
58
+ dstFilePath?: RelPath;
57
59
  dstSymbolName?: string;
58
60
  dstProject?: string;
59
- type?: string;
61
+ type?: RelationType;
60
62
  project?: string;
61
63
  specifier?: string;
62
64
  isExternal?: boolean;
@@ -70,7 +72,8 @@ export interface IRelationRepo {
70
72
  * @returns An array of {@link CodeRelation} entries matching the query.
71
73
  */
72
74
  export declare function relationSearch(options: {
73
- relationRepo: IRelationRepo;
75
+ relationRepo: RelationRepositoryReader;
76
+ projectRoot: string;
74
77
  project?: string;
75
78
  query: RelationSearchQuery;
76
79
  }): StoredCodeRelation[];
@@ -1,5 +1,6 @@
1
1
  import type { SymbolKind, Modifier, Decorator, JsDocBlock, ExpressionValue } from '../extractor/types';
2
2
  import type { SymbolRecord } from '../store/repositories/symbol.repository';
3
+ import { type RelPath } from '../common/path-utils';
3
4
  /**
4
5
  * Filters for {@link symbolSearch}.
5
6
  *
@@ -118,12 +119,12 @@ export interface SymbolSearchResult {
118
119
  /** Typed detail fields parsed from the stored JSON. */
119
120
  detail: SymbolDetail;
120
121
  }
121
- export interface ISymbolRepo {
122
+ export interface SymbolRepositoryReader {
122
123
  searchByQuery(opts: {
123
124
  ftsQuery?: string;
124
125
  exactName?: string;
125
- kind?: string;
126
- filePath?: string;
126
+ kind?: SymbolKind;
127
+ filePath?: RelPath;
127
128
  isExported?: boolean;
128
129
  project?: string;
129
130
  limit?: number;
@@ -141,7 +142,8 @@ export interface ISymbolRepo {
141
142
  * @returns An array of {@link SymbolSearchResult} entries matching the query.
142
143
  */
143
144
  export declare function symbolSearch(options: {
144
- symbolRepo: ISymbolRepo;
145
+ symbolRepo: SymbolRepositoryReader;
146
+ projectRoot: string;
145
147
  project?: string;
146
148
  query: SymbolSearchQuery;
147
149
  }): SymbolSearchResult[];
@@ -42,7 +42,6 @@ export declare class TscProgram {
42
42
  static create(tsconfigPath: string, options?: TscProgramOptions): Result<TscProgram, GildashError>;
43
43
  get isDisposed(): boolean;
44
44
  getProgram(): ts.Program;
45
- getChecker(): ts.TypeChecker;
46
45
  /**
47
46
  * The project's compiler options, read from the host without forcing a
48
47
  * Program sync (so callers that don't need the Program stay cheap).
@@ -3,7 +3,7 @@ export type { DbConnectionOptions } from './connection';
3
3
  export { FileRepository } from './repositories/file.repository';
4
4
  export type { FileRecord } from './repositories/file.repository';
5
5
  export { SymbolRepository } from './repositories/symbol.repository';
6
- export type { SymbolRecord, SearchOptions, SymbolStats } from './repositories/symbol.repository';
6
+ export type { SymbolRecord, SymbolStats } from './repositories/symbol.repository';
7
7
  export { RelationRepository } from './repositories/relation.repository';
8
8
  export type { RelationRecord } from './repositories/relation.repository';
9
9
  export { AnnotationRepository } from './repositories/annotation.repository';
@@ -1,11 +1,12 @@
1
1
  import type { DbConnection } from '../connection';
2
+ import type { AnnotationSource } from '../../extractor/types';
2
3
  export interface AnnotationRecord {
3
4
  id: number;
4
5
  project: string;
5
6
  filePath: string;
6
7
  tag: string;
7
8
  value: string;
8
- source: string;
9
+ source: AnnotationSource;
9
10
  symbolName: string | null;
10
11
  startLine: number;
11
12
  startColumn: number;
@@ -23,7 +24,7 @@ export declare class AnnotationRepository {
23
24
  tag?: string;
24
25
  filePath?: string;
25
26
  symbolName?: string;
26
- source?: string;
27
+ source?: AnnotationSource;
27
28
  ftsQuery?: string;
28
29
  limit?: number;
29
30
  }): AnnotationRecord[];
@@ -1,4 +1,5 @@
1
1
  import type { DbConnection } from '../connection';
2
+ import type { RelPath } from '../../common/path-utils';
2
3
  /**
3
4
  * Metadata record for an indexed source file.
4
5
  *
@@ -24,9 +25,9 @@ export interface FileRecord {
24
25
  export declare class FileRepository {
25
26
  private readonly db;
26
27
  constructor(db: DbConnection);
27
- getFile(project: string, filePath: string): FileRecord | null;
28
+ getFile(project: string, filePath: RelPath): FileRecord | null;
28
29
  upsertFile(record: FileRecord): void;
29
30
  getAllFiles(project: string): FileRecord[];
30
31
  getFilesMap(project: string): Map<string, FileRecord>;
31
- deleteFile(project: string, filePath: string): void;
32
+ deleteFile(project: string, filePath: RelPath): void;
32
33
  }
@@ -1,7 +1,9 @@
1
1
  import type { DbConnection } from '../connection';
2
+ import type { RelPath } from '../../common/path-utils';
3
+ import type { RelationType } from '../../extractor/types';
2
4
  export interface RelationRecord {
3
5
  project: string;
4
- type: string;
6
+ type: RelationType;
5
7
  srcFilePath: string;
6
8
  srcSymbolName: string | null;
7
9
  dstProject: string | null;
@@ -14,22 +16,24 @@ export interface RelationRecord {
14
16
  export declare class RelationRepository {
15
17
  private readonly db;
16
18
  constructor(db: DbConnection);
17
- replaceFileRelations(project: string, srcFilePath: string, rels: ReadonlyArray<Partial<RelationRecord>>): void;
18
- getOutgoing(project: string, srcFilePath: string, srcSymbolName?: string): RelationRecord[];
19
+ replaceFileRelations(project: string, srcFilePath: string, rels: ReadonlyArray<Partial<RelationRecord> & {
20
+ type: RelationType;
21
+ }>): void;
22
+ getOutgoing(project: string, srcFilePath: RelPath, srcSymbolName?: string): RelationRecord[];
19
23
  getIncoming(opts: {
20
24
  dstProject: string;
21
- dstFilePath: string;
25
+ dstFilePath: RelPath;
22
26
  }): RelationRecord[];
23
- getByType(project: string, type: string): RelationRecord[];
24
- deleteFileRelations(project: string, srcFilePath: string): void;
25
- deleteIncomingRelations(dstProject: string, dstFilePath: string): void;
27
+ getByType(project: string, type: RelationType): RelationRecord[];
28
+ deleteFileRelations(project: string, srcFilePath: RelPath): void;
29
+ deleteIncomingRelations(dstProject: string, dstFilePath: RelPath): void;
26
30
  searchRelations(opts: {
27
- srcFilePath?: string;
31
+ srcFilePath?: RelPath;
28
32
  srcSymbolName?: string;
29
33
  dstProject?: string;
30
- dstFilePath?: string;
34
+ dstFilePath?: RelPath;
31
35
  dstSymbolName?: string;
32
- type?: string;
36
+ type?: RelationType;
33
37
  project?: string;
34
38
  specifier?: string;
35
39
  isExternal?: boolean;
@@ -1,8 +1,10 @@
1
1
  import type { DbConnection } from '../connection';
2
+ import type { RelPath } from '../../common/path-utils';
3
+ import type { SymbolKind } from '../../extractor/types';
2
4
  export interface SymbolRecord {
3
5
  project: string;
4
6
  filePath: string;
5
- kind: string;
7
+ kind: SymbolKind;
6
8
  name: string;
7
9
  startLine: number;
8
10
  startColumn: number;
@@ -17,10 +19,6 @@ export interface SymbolRecord {
17
19
  resolvedType?: string | null;
18
20
  structuralFingerprint?: string | null;
19
21
  }
20
- export interface SearchOptions {
21
- kind?: string;
22
- limit?: number;
23
- }
24
22
  /**
25
23
  * Aggregate symbol statistics for a project.
26
24
  *
@@ -35,18 +33,18 @@ export interface SymbolStats {
35
33
  export declare class SymbolRepository {
36
34
  private readonly db;
37
35
  constructor(db: DbConnection);
38
- replaceFileSymbols(project: string, filePath: string, contentHash: string, syms: ReadonlyArray<Partial<SymbolRecord>>): void;
39
- getFileSymbols(project: string, filePath: string): SymbolRecord[];
40
- searchByName(project: string, query: string, opts?: SearchOptions): SymbolRecord[];
41
- searchByKind(project: string, kind: string): SymbolRecord[];
36
+ replaceFileSymbols(project: string, filePath: string, contentHash: string, syms: ReadonlyArray<Partial<SymbolRecord> & {
37
+ kind: SymbolKind;
38
+ }>): void;
39
+ getFileSymbols(project: string, filePath: RelPath): SymbolRecord[];
42
40
  getStats(project: string): SymbolStats;
43
41
  getByFingerprint(project: string, fingerprint: string): SymbolRecord[];
44
- deleteFileSymbols(project: string, filePath: string): void;
42
+ deleteFileSymbols(project: string, filePath: RelPath): void;
45
43
  searchByQuery(opts: {
46
44
  ftsQuery?: string;
47
45
  exactName?: string;
48
- kind?: string;
49
- filePath?: string;
46
+ kind?: SymbolKind;
47
+ filePath?: RelPath;
50
48
  isExported?: boolean;
51
49
  project?: string;
52
50
  limit?: number;