@g3nomaly/analyze 0.1.0 → 0.1.1

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 (97) hide show
  1. package/README.md +10 -5
  2. package/dist/api/bundle-builder.d.ts +29 -10
  3. package/dist/api/bundle-cache.d.ts +7 -4
  4. package/dist/api/bundle-loader.d.ts +10 -3
  5. package/dist/api/create-docs.d.ts +33 -14
  6. package/dist/api/embedding.d.ts +16 -7
  7. package/dist/api/errors.d.ts +13 -6
  8. package/dist/api/list.d.ts +20 -20
  9. package/dist/api/options.d.ts +18 -22
  10. package/dist/api/refs.d.ts +24 -21
  11. package/dist/api/scan.d.ts +24 -12
  12. package/dist/api/search.d.ts +27 -21
  13. package/dist/api/services.d.ts +9 -1
  14. package/dist/api/show.d.ts +15 -19
  15. package/dist/api/site-reader.d.ts +11 -3
  16. package/dist/api/site-writer.d.ts +30 -7
  17. package/dist/api/source.d.ts +23 -12
  18. package/dist/api/target.d.ts +2 -0
  19. package/dist/cli.js +670 -238
  20. package/dist/embeddings/index-builder.d.ts +3 -1
  21. package/dist/embeddings/model.d.ts +26 -13
  22. package/dist/embeddings/searcher.d.ts +24 -7
  23. package/dist/embeddings/vectors.d.ts +3 -1
  24. package/dist/embeddings/words.d.ts +7 -3
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +647 -229
  27. package/dist/model/index.d.ts +416 -188
  28. package/dist/model/registry.d.ts +204 -11
  29. package/dist/query/graph.d.ts +83 -26
  30. package/dist/query/name-search.d.ts +39 -21
  31. package/dist/query/semantic.d.ts +11 -3
  32. package/dist/retrieval/describe.d.ts +11 -4
  33. package/dist/retrieval/filter.d.ts +27 -8
  34. package/dist/retrieval/index.d.ts +1 -1
  35. package/dist/retrieval/markdown.d.ts +3 -2
  36. package/dist/retrieval/report.d.ts +147 -70
  37. package/dist/retrieval/resolve.d.ts +11 -7
  38. package/dist/retrieval/retriever.d.ts +34 -23
  39. package/dist/retrieval/summary.d.ts +6 -3
  40. package/dist/scanner/code/doc/clean.d.ts +31 -5
  41. package/dist/scanner/code/doc/index.d.ts +7 -1
  42. package/dist/scanner/code/doc/markdown.d.ts +6 -1
  43. package/dist/scanner/code/doc/python.d.ts +6 -1
  44. package/dist/scanner/code/doc/tagged.d.ts +13 -4
  45. package/dist/scanner/code/doc/types.d.ts +16 -5
  46. package/dist/scanner/code/doc/xml.d.ts +6 -1
  47. package/dist/scanner/code/example.d.ts +31 -10
  48. package/dist/scanner/code/extract.d.ts +56 -21
  49. package/dist/scanner/code/grammar.d.ts +20 -5
  50. package/dist/scanner/code/language.d.ts +100 -66
  51. package/dist/scanner/code/languages/index.d.ts +21 -7
  52. package/dist/scanner/code/languages/shared.d.ts +23 -4
  53. package/dist/scanner/code/planner.d.ts +50 -14
  54. package/dist/scanner/code/symbols.d.ts +86 -20
  55. package/dist/scanner/code/types.d.ts +48 -15
  56. package/dist/scanner/config.d.ts +42 -0
  57. package/dist/scanner/content.d.ts +49 -14
  58. package/dist/scanner/decisions/parse.d.ts +20 -11
  59. package/dist/scanner/decisions/planner.d.ts +20 -8
  60. package/dist/scanner/docs.d.ts +36 -19
  61. package/dist/scanner/files.d.ts +44 -19
  62. package/dist/scanner/glossary/parse.d.ts +17 -7
  63. package/dist/scanner/glossary/planner.d.ts +15 -8
  64. package/dist/scanner/glossary/terms.d.ts +57 -27
  65. package/dist/scanner/graph/builder.d.ts +80 -21
  66. package/dist/scanner/highlight.d.ts +32 -9
  67. package/dist/scanner/ignore.d.ts +25 -0
  68. package/dist/scanner/index.d.ts +5 -2
  69. package/dist/scanner/markdown/frontmatter.d.ts +18 -3
  70. package/dist/scanner/markdown/links.d.ts +19 -9
  71. package/dist/scanner/markdown/outline.d.ts +13 -5
  72. package/dist/scanner/markdown/renderer.d.ts +32 -13
  73. package/dist/scanner/openapi/planner.d.ts +20 -8
  74. package/dist/scanner/packages.d.ts +28 -0
  75. package/dist/scanner/reporter.d.ts +5 -2
  76. package/dist/scanner/scanner.d.ts +21 -7
  77. package/dist/scanner/schema/definitions.d.ts +18 -8
  78. package/dist/scanner/schema/describe.d.ts +44 -18
  79. package/dist/scanner/schema/planner.d.ts +6 -3
  80. package/dist/scanner/schema/registry.d.ts +23 -16
  81. package/dist/scanner/skills/classify.d.ts +2 -1
  82. package/dist/scanner/skills/layout.d.ts +27 -9
  83. package/dist/scanner/skills/planner.d.ts +19 -4
  84. package/dist/scanner/specs.d.ts +8 -2
  85. package/dist/scanner/sql/catalog.d.ts +21 -7
  86. package/dist/scanner/sql/cursor.d.ts +9 -4
  87. package/dist/scanner/sql/database.d.ts +6 -3
  88. package/dist/scanner/sql/parse.d.ts +62 -27
  89. package/dist/scanner/sql/planner.d.ts +6 -2
  90. package/dist/scanner/sql/query.d.ts +34 -21
  91. package/dist/scanner/sql/registry.d.ts +24 -10
  92. package/dist/scanner/sql/source.d.ts +1 -0
  93. package/dist/scanner/sql/statements.d.ts +9 -3
  94. package/dist/scanner/sql/tokens.d.ts +25 -12
  95. package/dist/scanner/tasks/layout.d.ts +22 -10
  96. package/dist/scanner/tasks/planner.d.ts +64 -9
  97. package/package.json +2 -2
@@ -1,47 +1,65 @@
1
- import { type NodeKind, type NodeRef } from '../model';
1
+ import { type NodeRef, type NodeType } from '../model';
2
2
  import type { Graph } from './graph';
3
- /** What search by words knows about one page or entry. */
3
+ /**
4
+ * What search by words knows about one page or entry. Built by `buildSearchIndex`
5
+ * and matched by `search`.
6
+ *
7
+ * @property node - Node the entry is for.
8
+ * @property kind - Kind of that node.
9
+ * @property group - Name of the section the node is in. Results are grouped by it.
10
+ * @property title - Name shown in the results.
11
+ * @property detail - Text shown beside the title, such as a file path.
12
+ * @property haystack - Lowercase text that names the node: its title, the words of its name, the words it replaces.
13
+ * @property place - Lowercase words of `detail`, each with a space in front of it.
14
+ * @property text - Lowercase words that describe the node: its description, its definition, the page.
15
+ * Every word has a space in front of it, so a search can tell the start of a word from its middle.
16
+ * @property member - True for a parameter, field, operation or definition. Such an entry lets a query that keeps
17
+ * to its kind match it; the search box of the site skips it, because the entry of its owner holds its words too.
18
+ */
4
19
  export interface SearchEntry {
5
20
  readonly node: NodeRef;
6
- readonly kind: NodeKind;
7
- /** Name of the section the node is in. Results are grouped by it. */
21
+ readonly member: boolean;
22
+ readonly kind: NodeType;
8
23
  readonly group: string;
9
24
  readonly title: string;
10
25
  readonly detail: string;
11
- /** Lowercase text that names the node: its title, the words of its name, the words it replaces. */
12
26
  readonly haystack: string;
13
- /** Lowercase words of `detail`, each with a space in front of it. */
14
27
  readonly place: string;
15
- /**
16
- * Lowercase words that describe the node: its description, its definition,
17
- * the page. Every word has a space in front of it, so a search can tell the
18
- * start of a word from its middle.
19
- */
20
28
  readonly text: string;
21
29
  }
22
- /** One result of a search by words. */
30
+ /**
31
+ * One result of a search by words.
32
+ *
33
+ * @property entry - The entry that matched.
34
+ * @property found - `name` when every word of the query is in what names the node. `text` when at least one word is only in what describes it.
35
+ */
23
36
  export interface SearchMatch {
24
37
  readonly entry: SearchEntry;
25
- /** `name`: every word of the query is in what names the node. `text`: at least one is only in what describes it. */
26
38
  readonly found: 'name' | 'text';
27
39
  }
28
40
  /**
29
- * Builds the index for search by words: one entry per file, symbol, glossary
30
- * term, decision, API operation, schema definition, table and query. Folders,
31
- * parameters and fields are not searched.
41
+ * @brief Builds the index for search by words: one entry per file, symbol, glossary term, decision, table,
42
+ * query and task.
32
43
  *
44
+ * Folders are not searched. The name and the text of a parameter, field, operation or definition are added to
45
+ * the entry of the nearest ancestor that is none of these, such as its function or its file, so a search for
46
+ * it finds that node. It also gets an entry of its own, marked `member`, for a query that keeps to its kind.
47
+ *
48
+ * @param graph - Graph to index.
33
49
  * @returns The entries in display order.
34
50
  */
35
51
  export declare function buildSearchIndex(graph: Graph): SearchEntry[];
36
52
  /**
37
- * Finds the entries that contain every word of a query. Entries that are
38
- * named by the words come first: an exact title, then a title that starts
39
- * with the query, then other names. Entries in a file whose path holds a
40
- * word follow, then entries that mention a word in their description. A word
41
- * of the query may be the start of a word of the description.
53
+ * @brief Finds the entries that contain every word of a query.
54
+ *
55
+ * Entries that are named by the words come first: an exact title, then a title
56
+ * that starts with the query, then other names. Entries in a file whose path
57
+ * holds a word follow, then entries that mention a word in their description.
58
+ * A word of the query may be the start of a word of the description.
42
59
  *
43
60
  * @param index - The index from `buildSearchIndex`.
44
61
  * @param query - What the reader typed.
62
+ * @param limit - Most matches to return.
45
63
  * @returns The matches, best first.
46
64
  */
47
65
  export declare function search(index: readonly SearchEntry[], query: string, limit: number): SearchMatch[];
@@ -1,30 +1,38 @@
1
1
  import { type SemanticHit } from '../embeddings';
2
2
  import { type NodeRef } from '../model';
3
3
  import type { Graph } from './graph';
4
- /** Narrows a search by meaning. */
4
+ /**
5
+ * Narrows a search by meaning.
6
+ *
7
+ * @property limit - Most hits to return. Default: the number the search dialog shows.
8
+ * @property accepts - Says which nodes count. Default: every node.
9
+ */
5
10
  export interface MeaningOptions {
6
- /** Most hits to return. Default: the number the search dialog shows. */
7
11
  readonly limit?: number;
8
- /** Says which nodes count. Default: every node. */
9
12
  readonly accepts?: (node: NodeRef) => boolean;
10
13
  }
11
14
  /**
12
15
  * Finds nodes by the meaning of a query, such as the term `Sailing` for the query `ship`.
13
16
  *
17
+ * @param graph - Graph to search.
14
18
  * @param query - What the reader typed.
15
19
  * @param exclude - Nodes that are listed already.
20
+ * @param options - Limit and filter of the search.
16
21
  * @returns The closest nodes, best first. Empty for a graph without embeddings.
17
22
  */
18
23
  export declare function searchByMeaning(graph: Graph, query: string, exclude: ReadonlySet<NodeRef>, options?: MeaningOptions): SemanticHit[];
19
24
  /**
20
25
  * Finds the nodes whose meaning is closest to that of a node.
21
26
  *
27
+ * @param graph - Graph the node is in.
28
+ * @param node - Node to compare with.
22
29
  * @returns The closest nodes, best first. Empty for a graph without embeddings.
23
30
  */
24
31
  export declare function similarNodes(graph: Graph, node: NodeRef): SemanticHit[];
25
32
  /**
26
33
  * Names the embedding model of a graph.
27
34
  *
35
+ * @param graph - Graph to read the model from.
28
36
  * @returns The name, or `null` for a graph without embeddings.
29
37
  */
30
38
  export declare function embeddingModelName(graph: Graph): string | null;
@@ -1,25 +1,32 @@
1
1
  import { type EdgeKind, type NodeRef } from '../model';
2
2
  import { type Graph } from '../query';
3
3
  import type { NodeReport, References } from './report';
4
- /** Which edges of a node to report. */
4
+ /**
5
+ * @brief Which edges of a node to report.
6
+ *
7
+ * @property direction - `in` for links into the node, `out` for links from it, `both` for either.
8
+ * @property kinds - Edge kinds to keep, such as `references`. Empty keeps every kind.
9
+ */
5
10
  export interface ReferenceOptions {
6
11
  readonly direction: 'in' | 'out' | 'both';
7
- /** Edge kinds to keep. Empty keeps every kind. */
8
12
  readonly kinds: readonly EdgeKind[];
9
13
  }
10
14
  /** The options that keep every edge in both directions. */
11
15
  export declare const ALL_REFERENCES: ReferenceOptions;
12
16
  /**
13
- * Lists the edges of a node in both directions. The edges of its parameters
17
+ * @brief Lists the edges of a node in both directions. The edges of its parameters
14
18
  * and fields count as its own, as on its page.
15
19
  *
20
+ * @param graph - Graph the node belongs to.
16
21
  * @param node - A page or an entry.
22
+ * @param options - Which edges to keep, by direction and kind.
17
23
  * @returns What the node links to and what links to it.
18
24
  */
19
25
  export declare function referencesOf(graph: Graph, node: NodeRef, options: ReferenceOptions): References;
20
26
  /**
21
- * Builds the full report of a node: everything its page shows, as data.
27
+ * @brief Builds the full report of a node: everything its page shows, as data.
22
28
  *
29
+ * @param graph - Graph the node belongs to.
23
30
  * @param node - A page or an entry.
24
31
  * @returns The report. Texts are markdown.
25
32
  */
@@ -1,17 +1,36 @@
1
- import type { NodeKind, NodeRef, Section } from '../model';
2
- import { type Graph } from '../query';
3
- /** Which nodes a query looks at. An empty filter accepts every page and entry. */
1
+ import { type NodeKind, type NodeRef, type Section } from '../model';
2
+ import type { Graph } from '../query';
3
+ /**
4
+ * @brief Which nodes a query looks at. An empty filter accepts every node but the sections.
5
+ *
6
+ * @property kinds - Kinds to match, such as `function` or `field`. Empty matches every kind. A member kind matches its nodes, and the query returns the node each belongs to.
7
+ * @property section - Section the results are in. `null` looks in every section.
8
+ */
4
9
  export interface NodeFilter {
5
- /** Kinds to keep. Empty keeps every kind. */
6
10
  readonly kinds: readonly NodeKind[];
7
- /** Section to stay in. `null` looks in every section. */
8
11
  readonly section: Section | null;
9
12
  }
10
- /** The filter that keeps every page and entry. */
13
+ /** The filter that keeps every node. */
11
14
  export declare const NO_FILTER: NodeFilter;
12
15
  /**
13
- * Turns a filter into a test for one node.
16
+ * @brief Finds the node a query returns for a matched node: the node itself, or for a parameter, field,
17
+ * operation or definition the nearest ancestor that is none of these, such as the function of a parameter
18
+ * or the file of an operation.
14
19
  *
15
- * @returns A function that says whether a node passes. Parameters and fields never pass: they have no id.
20
+ * @param node - Node that matched, such as a field of a definition.
21
+ * @returns The node to return, such as the OpenAPI file the definition is in.
22
+ */
23
+ export declare function resultOf(graph: Graph, node: NodeRef): NodeRef;
24
+ /**
25
+ * @brief Turns a filter into a test for one node that a query matches against.
26
+ *
27
+ * @returns A function that says whether a node matches. A section never matches. A member node matches by its own kind and by the section of its result.
16
28
  */
17
29
  export declare function nodeTest(graph: Graph, filter: NodeFilter): (node: NodeRef) => boolean;
30
+ /**
31
+ * @brief Maps matched nodes to the nodes a query returns, each once, in the order first met.
32
+ *
33
+ * @param nodes - Matched nodes, such as the hits of a search.
34
+ * @returns Their results, see `resultOf`.
35
+ */
36
+ export declare function resultsOf(graph: Graph, nodes: readonly NodeRef[]): NodeRef[];
@@ -1,5 +1,5 @@
1
1
  export { ALL_REFERENCES, describeNode, type ReferenceOptions, referencesOf } from './describe';
2
- export { NO_FILTER, type NodeFilter, nodeTest } from './filter';
2
+ export { NO_FILTER, type NodeFilter, nodeTest, resultOf, resultsOf } from './filter';
3
3
  export { codeBlock, htmlToMarkdown } from './markdown';
4
4
  export type { ContentReport, DatabaseObjectReport, DeclarationReport, ForeignKeyReport, NodeReport, NodeSummary, OperationReport, QueryReport, Reference, References, TableReport, TagReport, TaskReport, } from './report';
5
5
  export { type Resolution, resolveNode } from './resolve';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Turns scanner HTML back into markdown, for output that is read in a
2
+ * @brief Turns scanner HTML back into markdown, for output that is read in a
3
3
  * terminal or by a program. Headings, lists, tables and code blocks keep
4
4
  * their structure. Links into the site and images are reduced to text.
5
5
  *
@@ -8,8 +8,9 @@
8
8
  */
9
9
  export declare function htmlToMarkdown(html: string): string;
10
10
  /**
11
- * Wraps code in a markdown code block that the code itself cannot close.
11
+ * @brief Wraps code in a markdown code block that the code itself cannot close.
12
12
  *
13
+ * @param code - Source text to wrap.
13
14
  * @param language - Display name of its language, such as `TypeScript`, or `null`.
14
15
  * @returns The block, or `''` for empty code. The fence is longer than any run of backticks in the code.
15
16
  */
@@ -1,85 +1,117 @@
1
- import type { ApiServer, DocTagKind, EdgeKind, NodeKind, QueryEffect, Section, TableIndex, TaskPriority, TaskStatus } from '../model';
2
- /** What every listing shows of a node. */
1
+ import type { ApiServer, DocTagKind, EdgeKind, NodeKind, NodeType, PackageRole, QueryEffect, Section, TableIndex, TaskPriority, TaskStatus } from '../model';
2
+ /**
3
+ * @brief What every listing shows of a node.
4
+ *
5
+ * @property id - Route of the node, as in the address of its page: `code/src/app.ts#symbol:App.run`. Every retrieval command takes it where it takes a node.
6
+ * @property kind - Kind of the node, such as `function` or `file`.
7
+ * @property type - Type of the node, such as `method` or `api`, which says what sort of file or symbol it is.
8
+ * @property title - Name as other places refer to it: `App.run`, the title of a page, `3. Use hash routes`.
9
+ * @property note - A short fact that belongs beside the title: the status of a decision, a plan, a phase or a task, the language of a source file, the version of an API, the verb of a query. `''` for other nodes.
10
+ * @property path - Path on disk of the file the node is or is in. For a catalog, the path of its directory. `null` for a section or a folder.
11
+ * @property line - Line of a symbol, a table or a query in its file. `null` for every other node.
12
+ * @property summary - First paragraph of its description, as plain text. A table or a query without a description gets what its SQL states instead: the number of columns and the tables it is connected to, or the tables it reads and writes. `''` for any other node without a description.
13
+ */
3
14
  export interface NodeSummary {
4
- /**
5
- * Route of the node, as in the address of its page: `code/src/app.ts#symbol:App.run`.
6
- * Every retrieval command takes it where it takes a node.
7
- */
8
15
  readonly id: string;
9
16
  readonly kind: NodeKind;
10
- /** Name as other places refer to it: `App.run`, the title of a page, `3. Use hash routes`. */
17
+ readonly type: NodeType;
11
18
  readonly title: string;
12
- /** A short fact that belongs beside the title: the status of a decision, a plan, a phase or a task, the language of a source file, the version of an API, the verb of a query. `''` for other nodes. */
13
19
  readonly note: string;
14
- /** Path on disk of the file the node is or is in. For a catalog, the path of its directory. `null` for a section or a folder. */
15
20
  readonly path: string | null;
16
- /** Line of a symbol, a table or a query in its file. `null` for every other node. */
17
21
  readonly line: number | null;
18
- /**
19
- * First paragraph of its description, as plain text. A table or a query
20
- * without a description gets what its SQL states instead: the number of
21
- * columns and the tables it is connected to, or the tables it reads and
22
- * writes. `''` for any other node without a description.
23
- */
24
22
  readonly summary: string;
25
23
  }
26
- /** A parameter or a field of a symbol, a parameter of an operation, a property of a definition, a column of a table, or a placeholder or a result column of a query. */
24
+ /**
25
+ * @brief A parameter or a field of a symbol, a parameter of an operation, a property of a definition, a column of a table, or a placeholder or a result column of a query.
26
+ *
27
+ * @property name - Name of the declaration.
28
+ * @property type - Type as text, or `null` when none is written.
29
+ * @property defaultValue - Default value as written, or `null`.
30
+ * @property optional - Whether the declaration may be left out.
31
+ * @property location - Where an operation takes a parameter from: `path`, `query`, `header` or `cookie`. `null` for every other declaration.
32
+ * @property annotations - Further facts about a field, verbatim: annotations in code, constraints of a property or a column, the expression behind a result column.
33
+ * @property column - The table column a placeholder or a result column of a query stands for, as `table.column`. `null` for every other declaration, and when the scan does not have the column.
34
+ * @property description - Markdown.
35
+ */
27
36
  export interface DeclarationReport {
28
37
  readonly name: string;
29
38
  readonly type: string | null;
30
39
  readonly defaultValue: string | null;
31
40
  readonly optional: boolean;
32
- /** Where an operation takes a parameter from: `path`, `query`, `header` or `cookie`. `null` for every other declaration. */
33
41
  readonly location: string | null;
34
- /** Further facts about a field, verbatim: annotations in code, constraints of a property or a column, the expression behind a result column. */
35
42
  readonly annotations: readonly string[];
36
- /** The table column a placeholder or a result column of a query stands for, as `table.column`. `null` for every other declaration, and when the scan does not have the column. */
37
43
  readonly column: string | null;
38
- /** Markdown. */
39
44
  readonly description: string;
40
45
  }
41
- /** One media type of a request body or a response. */
46
+ /**
47
+ * @brief One media type of a request body or a response.
48
+ *
49
+ * @property mediaType - Media type, such as `application/json`.
50
+ * @property schema - The schema as a type expression, or `null`.
51
+ */
42
52
  export interface ContentReport {
43
53
  readonly mediaType: string;
44
- /** The schema as a type expression, or `null`. */
45
54
  readonly schema: string | null;
46
55
  }
47
- /** What an operation of an API states beside its parameters. */
56
+ /**
57
+ * @brief What an operation of an API states beside its parameters.
58
+ *
59
+ * @property method - HTTP method of the operation.
60
+ * @property path - Path template, or the name of a webhook.
61
+ * @property operationId - Id of the operation, as the API document names it.
62
+ * @property tags - Tags of the operation.
63
+ * @property deprecated - Whether the operation is deprecated.
64
+ * @property security - The ways a caller can authenticate.
65
+ * @property requestBody - The request body, or `null`. Holds `required`, the markdown `description` and the `content` media types.
66
+ * @property responses - One entry per response, with its status, markdown `description` and `content` media types.
67
+ */
48
68
  export interface OperationReport {
49
69
  readonly method: string;
50
- /** Path template, or the name of a webhook. */
51
70
  readonly path: string;
52
71
  readonly operationId: string;
53
72
  readonly tags: readonly string[];
54
73
  readonly deprecated: boolean;
55
- /** The ways a caller can authenticate. */
56
74
  readonly security: readonly string[];
57
75
  readonly requestBody: {
58
76
  readonly required: boolean;
59
- /** Markdown. */
60
77
  readonly description: string;
61
78
  readonly content: readonly ContentReport[];
62
79
  } | null;
63
80
  readonly responses: readonly {
64
81
  readonly status: string;
65
- /** Markdown. */
66
82
  readonly description: string;
67
83
  readonly content: readonly ContentReport[];
68
84
  }[];
69
85
  }
70
- /** A foreign key of a table. */
86
+ /**
87
+ * @brief A foreign key of a table.
88
+ *
89
+ * @property name - Name of the key.
90
+ * @property columns - Columns of this table in the key.
91
+ * @property table - Name of the referenced table.
92
+ * @property tableId - Id of the referenced table, or `null` when the scan does not have it.
93
+ * @property referencedColumns - Columns of the referenced table.
94
+ * @property onDelete - Action on delete, as the file writes it.
95
+ * @property onUpdate - Action on update, as the file writes it.
96
+ */
71
97
  export interface ForeignKeyReport {
72
98
  readonly name: string;
73
99
  readonly columns: readonly string[];
74
- /** Name of the referenced table. */
75
100
  readonly table: string;
76
- /** Id of the referenced table, or `null` when the scan does not have it. */
77
101
  readonly tableId: string | null;
78
102
  readonly referencedColumns: readonly string[];
79
103
  readonly onDelete: string;
80
104
  readonly onUpdate: string;
81
105
  }
82
- /** What a table states beside its columns. */
106
+ /**
107
+ * @brief What a table states beside its columns.
108
+ *
109
+ * @property primaryKey - Columns of the primary key.
110
+ * @property foreignKeys - Foreign keys of the table.
111
+ * @property indexes - Indexes of the table.
112
+ * @property constraints - Constraints, as the file writes them.
113
+ * @property options - Table options, as the file writes them.
114
+ */
83
115
  export interface TableReport {
84
116
  readonly primaryKey: readonly string[];
85
117
  readonly foreignKeys: readonly ForeignKeyReport[];
@@ -87,67 +119,112 @@ export interface TableReport {
87
119
  readonly constraints: readonly string[];
88
120
  readonly options: readonly string[];
89
121
  }
90
- /** A view or a trigger of a database. */
122
+ /**
123
+ * @brief A view or a trigger of a database.
124
+ *
125
+ * @property kind - Whether the object is a `view` or a `trigger`.
126
+ * @property name - Name of the object.
127
+ * @property table - The table a trigger fires on. `''` for a view.
128
+ * @property line - Line of the object in its file.
129
+ * @property description - Markdown.
130
+ * @property sql - The SQL of the object, as the file writes it.
131
+ */
91
132
  export interface DatabaseObjectReport {
92
133
  readonly kind: 'view' | 'trigger';
93
134
  readonly name: string;
94
- /** The table a trigger fires on. `''` for a view. */
95
135
  readonly table: string;
96
136
  readonly line: number;
97
- /** Markdown. */
98
137
  readonly description: string;
99
138
  readonly sql: string;
100
139
  }
101
- /** What an entry of a query catalog states beside its placeholders and result columns. */
140
+ /**
141
+ * @brief What an entry of a query catalog states beside its placeholders and result columns.
142
+ *
143
+ * @property effect - Whether the query reads or changes data.
144
+ * @property verb - The keywords that open the statement, in capitals.
145
+ * @property sql - The SQL as the file writes it.
146
+ * @property tables - The tables the SQL names. Each has its `name`, its `access` (`read` or `write`) and the `tableId` of the table, or `null` when the scan does not have it.
147
+ */
102
148
  export interface QueryReport {
103
149
  readonly effect: QueryEffect;
104
- /** The keywords that open the statement, in capitals. */
105
150
  readonly verb: string;
106
- /** The SQL as the file writes it. */
107
151
  readonly sql: string;
108
- /** The tables the SQL names. */
109
152
  readonly tables: readonly {
110
153
  readonly name: string;
111
154
  readonly access: 'read' | 'write';
112
- /** Id of the table, or `null` when the scan does not have it. */
113
155
  readonly tableId: string | null;
114
156
  }[];
115
157
  }
116
- /** A doc comment tag that is not a parameter or a return value, such as `throws`. */
158
+ /**
159
+ * @brief A doc comment tag that is not a parameter or a return value, such as `throws`.
160
+ *
161
+ * @property kind - Kind of the tag.
162
+ * @property label - Label to print: the kind, or the original label of an `other` tag.
163
+ * @property subject - What the tag is about, such as the exception type of a `throws` tag, or `null`.
164
+ * @property text - Markdown.
165
+ */
117
166
  export interface TagReport {
118
167
  readonly kind: DocTagKind;
119
- /** Label to print: the kind, or the original label of an `other` tag. */
120
168
  readonly label: string;
121
- /** What the tag is about, such as the exception type of a `throws` tag. */
122
169
  readonly subject: string | null;
123
- /** Markdown. */
124
170
  readonly text: string;
125
171
  }
126
- /** One edge of the graph, seen from the node a report is about. */
172
+ /**
173
+ * @brief One edge of the graph, seen from the node a report is about.
174
+ *
175
+ * @property relation - Kind of the edge.
176
+ * @property node - The node at the other end. For a parameter or a field, the symbol that declares it.
177
+ * @property via - Name of the parameter or field the edge starts at, when it does not start at a page or an entry.
178
+ */
127
179
  export interface Reference {
128
180
  readonly relation: EdgeKind;
129
- /** The node at the other end. For a parameter or a field, the symbol that declares it. */
130
181
  readonly node: NodeSummary;
131
- /** Name of the parameter or field the edge starts at, when it does not start at a page or an entry. */
132
182
  readonly via: string | null;
133
183
  }
134
- /** Both directions of the edges of a node. */
184
+ /**
185
+ * @brief Both directions of the edges of a node.
186
+ *
187
+ * @property linksTo - Edges that start at the node.
188
+ * @property linkedFrom - Edges that end at the node.
189
+ */
135
190
  export interface References {
136
191
  readonly linksTo: readonly Reference[];
137
192
  readonly linkedFrom: readonly Reference[];
138
193
  }
139
- /** Everything the site shows about one node, as data. Texts are markdown. */
194
+ /**
195
+ * @brief Everything the site shows about one node, as data. Texts are markdown.
196
+ *
197
+ * @property section - Section the node is in, or `null`.
198
+ * @property signature - Declaration head of a symbol, or `null`.
199
+ * @property language - Language of a source file or of the file a symbol is in.
200
+ * @property modifiers - Modifiers of a symbol, as the file writes them.
201
+ * @property annotations - Annotations of a symbol, as the file writes them.
202
+ * @property description - Description of a symbol, an operation, a definition or a table, note of a query, definition of a term, text of a decision, frontmatter description of a file.
203
+ * @property body - Content of a file: its markdown, or its text in a code block. The description of an API, the opening comment of a database. `''` for every other node.
204
+ * @property parameters - Parameters of the node, in source order.
205
+ * @property fields - Fields of the node, in source order.
206
+ * @property returns - Return value of a symbol, or `null`. Holds its `type` and its markdown `description`.
207
+ * @property tags - Doc comment tags that are not parameters or return values.
208
+ * @property example - Example of a symbol, or `null`. Holds its `code` and whether it is `documented` or `generated`.
209
+ * @property term - Set for a glossary term: its `group` and the words it `avoid`s.
210
+ * @property decision - Set for a decision: its `number`, `status` and `date`.
211
+ * @property task - Set for a plan, a phase and a task.
212
+ * @property api - Set for an API document: its `version`, `specVersion` and `servers`.
213
+ * @property package - Set for a package: its `name` and `role`, the path of its `manifest`, and its `version` or `null`.
214
+ * @property operation - Set for an operation of an API.
215
+ * @property definition - Set for a schema definition: its `type`, `constraints` and enum `values`, as JSON.
216
+ * @property table - Set for a table.
217
+ * @property objects - Views and triggers of a database. Empty for every other node.
218
+ * @property query - Set for an entry of a query catalog.
219
+ * @property contains - The pages and entries inside the node: files of a folder or a skill, symbols of a file, members of a class, tables of a database, queries of a catalog.
220
+ */
140
221
  export interface NodeReport extends NodeSummary, References {
141
222
  readonly section: Section | null;
142
- /** Declaration head of a symbol. */
143
223
  readonly signature: string | null;
144
- /** Language of a source file or of the file a symbol is in. */
145
224
  readonly language: string | null;
146
225
  readonly modifiers: readonly string[];
147
226
  readonly annotations: readonly string[];
148
- /** Description of a symbol, an operation, a definition or a table, note of a query, definition of a term, text of a decision, frontmatter description of a file. */
149
227
  readonly description: string;
150
- /** Content of a file: its markdown, or its text in a code block. The description of an API, the opening comment of a database. `''` for every other node. */
151
228
  readonly body: string;
152
229
  readonly parameters: readonly DeclarationReport[];
153
230
  readonly fields: readonly DeclarationReport[];
@@ -160,55 +237,55 @@ export interface NodeReport extends NodeSummary, References {
160
237
  readonly code: string;
161
238
  readonly origin: 'documented' | 'generated';
162
239
  } | null;
163
- /** Set for a glossary term. */
164
240
  readonly term: {
165
241
  readonly group: string;
166
242
  readonly avoid: readonly string[];
167
243
  } | null;
168
- /** Set for a decision. */
169
244
  readonly decision: {
170
245
  readonly number: string;
171
246
  readonly status: string;
172
247
  readonly date: string;
173
248
  } | null;
174
- /** Set for a plan, a phase and a task. */
175
249
  readonly task: TaskReport | null;
176
- /** Set for an API document. */
177
250
  readonly api: {
178
251
  readonly version: string;
179
252
  readonly specVersion: string;
180
253
  readonly servers: readonly ApiServer[];
181
254
  } | null;
182
- /** Set for an operation of an API. */
255
+ readonly package: {
256
+ readonly name: string;
257
+ readonly role: PackageRole;
258
+ readonly manifest: string;
259
+ readonly version: string | null;
260
+ } | null;
183
261
  readonly operation: OperationReport | null;
184
- /** Set for a schema definition. */
185
262
  readonly definition: {
186
263
  readonly type: string | null;
187
264
  readonly constraints: readonly string[];
188
- /** Values of an `enum`, as JSON. */
189
265
  readonly values: readonly string[];
190
266
  } | null;
191
- /** Set for a table. */
192
267
  readonly table: TableReport | null;
193
- /** Views and triggers. Set for a database. */
194
268
  readonly objects: readonly DatabaseObjectReport[];
195
- /** Set for an entry of a query catalog. */
196
269
  readonly query: QueryReport | null;
197
- /** The pages and entries inside the node: files of a folder or a skill, symbols of a file, members of a class, tables of a database, queries of a catalog. */
198
270
  readonly contains: readonly NodeSummary[];
199
271
  }
200
- /** Where a plan, a phase or a task of the task tree stands, as `show` reports it. */
272
+ /**
273
+ * @brief Where a plan, a phase or a task of the task tree stands, as `show` reports it.
274
+ *
275
+ * @property id - The id of a task, such as `TASK-006`. `null` for a plan or a phase.
276
+ * @property status - Status of the plan, phase or task.
277
+ * @property priority - Priority of the plan, phase or task.
278
+ * @property dependsOn - Names or ids of what it waits for, as the file writes them.
279
+ * @property package - The package a task changes. `null` for a plan or a phase.
280
+ * @property complexity - From 1 to 5. `null` when a task states none, and for a plan or a phase.
281
+ * @property parallel - Whether the tasks of a phase run side by side. `null` for a plan or a task.
282
+ */
201
283
  export interface TaskReport {
202
- /** The id of a task, such as `TASK-006`. `null` for a plan or a phase. */
203
284
  readonly id: string | null;
204
285
  readonly status: TaskStatus;
205
286
  readonly priority: TaskPriority;
206
- /** Names or ids of what it waits for, as the file writes them. */
207
287
  readonly dependsOn: readonly string[];
208
- /** The package a task changes. `null` for a plan or a phase. */
209
288
  readonly package: string | null;
210
- /** From 1 to 5. `null` when a task states none, and for a plan or a phase. */
211
289
  readonly complexity: number | null;
212
- /** Whether the tasks of a phase run side by side. `null` for a plan or a task. */
213
290
  readonly parallel: boolean | null;
214
291
  }
@@ -1,27 +1,31 @@
1
1
  import { type NodeRef } from '../model';
2
- import { type Graph } from '../query';
3
- /** What a reference to a node turned out to name. */
2
+ import type { Graph } from '../query';
3
+ /**
4
+ * @brief What a reference to a node turned out to name.
5
+ *
6
+ * @property node - The node, when `kind` is `found`.
7
+ * @property candidates - Nodes that fit equally well, when `kind` is `ambiguous`. The caller has to pick one by id.
8
+ */
4
9
  export type Resolution = {
5
10
  readonly kind: 'found';
6
11
  readonly node: NodeRef;
7
- }
8
- /** Several nodes fit equally well. The caller has to pick one by id. */
9
- | {
12
+ } | {
10
13
  readonly kind: 'ambiguous';
11
14
  readonly candidates: readonly NodeRef[];
12
15
  } | {
13
16
  readonly kind: 'missing';
14
17
  };
15
18
  /**
16
- * Finds the node a caller means. The first of these rules that fits any node decides:
19
+ * @brief Finds the node a caller means. The first of these rules that fits any node decides:
17
20
  *
18
21
  * 1. The text is the id of a node, with or without `#/` in front. An id with the anchor of a heading names its page.
19
22
  * 2. The text is the path of a file on disk. The path of a query file names its query.
20
23
  * 3. The text is the name of a node, with the same capitals.
21
24
  * 4. The text is the name of a node, capitals ignored.
22
25
  *
26
+ * @param graph - Graph to search.
23
27
  * @param text - An id, a path or a name.
24
28
  * @param accepts - Narrows the nodes that count, such as to one kind.
25
- * @returns The node, the candidates when several fit the deciding rule, or `missing`.
29
+ * @returns The node, the candidates when several fit the deciding rule, or `missing`. A match by name on a parameter, field, operation or definition returns the node it belongs to, see `resultOf`; its id returns the node itself.
26
30
  */
27
31
  export declare function resolveNode(graph: Graph, text: string, accepts: (node: NodeRef) => boolean): Resolution;