patram 0.6.0 → 0.7.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/lib/build-graph-identity.d.ts +40 -0
- package/lib/build-graph.d.ts +11 -0
- package/lib/build-graph.types.d.ts +24 -0
- package/lib/claim-helpers.d.ts +20 -0
- package/lib/document-node-identity.d.ts +47 -0
- package/lib/list-source-files.d.ts +29 -0
- package/lib/load-patram-config.d.ts +384 -0
- package/lib/load-patram-config.types.d.ts +45 -0
- package/lib/load-project-graph.d.ts +35 -0
- package/lib/output-view.types.d.ts +80 -0
- package/lib/overlay-graph.d.ts +43 -0
- package/lib/overlay-graph.js +191 -0
- package/lib/parse-claims.d.ts +40 -0
- package/lib/parse-claims.types.d.ts +31 -0
- package/lib/parse-jsdoc-blocks.d.ts +15 -0
- package/lib/parse-jsdoc-claims.d.ts +9 -0
- package/lib/parse-jsdoc-prose.d.ts +28 -0
- package/lib/parse-markdown-claims.d.ts +14 -0
- package/lib/parse-markdown-directives.d.ts +34 -0
- package/lib/parse-where-clause.d.ts +75 -0
- package/lib/parse-where-clause.js +157 -37
- package/lib/parse-where-clause.types.d.ts +63 -0
- package/lib/parse-yaml-claims.d.ts +38 -0
- package/lib/patram-config.d.ts +106 -0
- package/lib/patram-config.types.d.ts +14 -0
- package/lib/patram.d.ts +73 -0
- package/lib/patram.js +6 -0
- package/lib/query-graph.d.ts +68 -0
- package/lib/query-graph.js +27 -24
- package/lib/query-inspection.d.ts +86 -0
- package/lib/resolve-patram-graph-config.d.ts +9 -0
- package/lib/source-file-defaults.d.ts +5 -0
- package/lib/tagged-fenced-block-error.d.ts +10 -0
- package/lib/tagged-fenced-block-markdown.d.ts +47 -0
- package/lib/tagged-fenced-block-metadata.d.ts +26 -0
- package/lib/tagged-fenced-block-parser.d.ts +61 -0
- package/lib/tagged-fenced-blocks.d.ts +39 -0
- package/lib/tagged-fenced-blocks.types.d.ts +32 -0
- package/package.json +13 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the node key for one mapped claim.
|
|
3
|
+
*
|
|
4
|
+
* @param {{ field: string, key?: 'path' | 'value', class: string }} node_mapping
|
|
5
|
+
* @param {PatramClaim} claim
|
|
6
|
+
* @param {Map<string, string>} document_entity_keys
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
export function resolveNodeKey(node_mapping: {
|
|
10
|
+
field: string;
|
|
11
|
+
key?: "path" | "value";
|
|
12
|
+
class: string;
|
|
13
|
+
}, claim: PatramClaim, document_entity_keys: Map<string, string>): string;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve one edge target key and canonical path.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} target_class
|
|
18
|
+
* @param {'path' | 'value'} target_type
|
|
19
|
+
* @param {PatramClaim} claim
|
|
20
|
+
* @param {Map<string, string>} document_entity_keys
|
|
21
|
+
* @param {Map<string, DocumentNodeReference>} document_node_references
|
|
22
|
+
* @param {Set<string>} document_paths
|
|
23
|
+
* @returns {{ class_name: string, key: string, path?: string }}
|
|
24
|
+
*/
|
|
25
|
+
export function resolveTargetReference(target_class: string, target_type: "path" | "value", claim: PatramClaim, document_entity_keys: Map<string, string>, document_node_references: Map<string, DocumentNodeReference>, document_paths: Set<string>): {
|
|
26
|
+
class_name: string;
|
|
27
|
+
key: string;
|
|
28
|
+
path?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Attach one canonical path to a graph node.
|
|
32
|
+
*
|
|
33
|
+
* @param {GraphNode} graph_node
|
|
34
|
+
* @param {string | undefined} source_path
|
|
35
|
+
*/
|
|
36
|
+
export function setCanonicalPath(graph_node: GraphNode, source_path: string | undefined): void;
|
|
37
|
+
import type { PatramClaim } from './parse-claims.types.ts';
|
|
38
|
+
import type { DocumentNodeReference } from './document-node-identity.js';
|
|
39
|
+
import type { GraphNode } from './build-graph.types.ts';
|
|
40
|
+
export { collectDocumentEntityKeys, collectDocumentNodeReferences, normalizeRepoRelativePath, resolveDocumentNodeId } from "./document-node-identity.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a Patram graph from semantic config and parsed claims.
|
|
3
|
+
*
|
|
4
|
+
* @param {PatramConfig} patram_config
|
|
5
|
+
* @param {PatramClaim[]} claims
|
|
6
|
+
* @returns {BuildGraphResult}
|
|
7
|
+
*/
|
|
8
|
+
export function buildGraph(patram_config: PatramConfig, claims: PatramClaim[]): BuildGraphResult;
|
|
9
|
+
import type { PatramConfig } from './patram-config.types.ts';
|
|
10
|
+
import type { PatramClaim } from './parse-claims.types.ts';
|
|
11
|
+
import type { BuildGraphResult } from './build-graph.types.ts';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ClaimOrigin } from './parse-claims.types.ts';
|
|
2
|
+
export interface GraphNode {
|
|
3
|
+
$class?: string;
|
|
4
|
+
$id?: string;
|
|
5
|
+
$path?: string;
|
|
6
|
+
id: string;
|
|
7
|
+
kind?: string;
|
|
8
|
+
key?: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
[field: string]: string | string[] | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface GraphEdge {
|
|
14
|
+
from: string;
|
|
15
|
+
id: string;
|
|
16
|
+
origin: ClaimOrigin;
|
|
17
|
+
relation: string;
|
|
18
|
+
to: string;
|
|
19
|
+
}
|
|
20
|
+
export interface BuildGraphResult {
|
|
21
|
+
document_node_ids?: Record<string, string>;
|
|
22
|
+
edges: GraphEdge[];
|
|
23
|
+
nodes: Record<string, GraphNode>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} target_value
|
|
3
|
+
* @returns {boolean}
|
|
4
|
+
*/
|
|
5
|
+
export function isPathLikeTarget(target_value: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} file_path
|
|
8
|
+
* @param {number} claim_number
|
|
9
|
+
* @param {string} claim_type
|
|
10
|
+
* @param {PatramClaimFields} claim_fields
|
|
11
|
+
* @returns {PatramClaim}
|
|
12
|
+
*/
|
|
13
|
+
export function createClaim(file_path: string, claim_number: number, claim_type: string, claim_fields: PatramClaimFields): PatramClaim;
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} file_path
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
export function getFileExtension(file_path: string): string;
|
|
19
|
+
import type { PatramClaimFields } from './parse-claims.types.ts';
|
|
20
|
+
import type { PatramClaim } from './parse-claims.types.ts';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{
|
|
3
|
+
* class_name: string,
|
|
4
|
+
* id: string,
|
|
5
|
+
* key: string,
|
|
6
|
+
* path: string,
|
|
7
|
+
* }} DocumentNodeReference
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Collect semantic entity keys defined by canonical documents.
|
|
11
|
+
*
|
|
12
|
+
* @param {Record<string, MappingDefinition>} mappings
|
|
13
|
+
* @param {PatramClaim[]} claims
|
|
14
|
+
* @returns {Map<string, string>}
|
|
15
|
+
*/
|
|
16
|
+
export function collectDocumentEntityKeys(mappings: Record<string, MappingDefinition>, claims: PatramClaim[]): Map<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Collect canonical graph identities for document-backed source paths.
|
|
19
|
+
*
|
|
20
|
+
* @param {Record<string, MappingDefinition>} mappings
|
|
21
|
+
* @param {PatramClaim[]} claims
|
|
22
|
+
* @returns {Map<string, DocumentNodeReference>}
|
|
23
|
+
*/
|
|
24
|
+
export function collectDocumentNodeReferences(mappings: Record<string, MappingDefinition>, claims: PatramClaim[]): Map<string, DocumentNodeReference>;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the canonical node id for a source document path.
|
|
27
|
+
*
|
|
28
|
+
* @param {Record<string, string> | undefined} document_node_ids
|
|
29
|
+
* @param {string} document_path
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
32
|
+
export function resolveDocumentNodeId(document_node_ids: Record<string, string> | undefined, document_path: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Normalize one repo-relative source path.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} source_path
|
|
37
|
+
* @returns {string}
|
|
38
|
+
*/
|
|
39
|
+
export function normalizeRepoRelativePath(source_path: string): string;
|
|
40
|
+
export type DocumentNodeReference = {
|
|
41
|
+
class_name: string;
|
|
42
|
+
id: string;
|
|
43
|
+
key: string;
|
|
44
|
+
path: string;
|
|
45
|
+
};
|
|
46
|
+
import type { MappingDefinition } from './patram-config.types.ts';
|
|
47
|
+
import type { PatramClaim } from './parse-claims.types.ts';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source file scanning.
|
|
3
|
+
*
|
|
4
|
+
* Expands include globs into stable repo-relative file lists for indexing and
|
|
5
|
+
* broken-link validation.
|
|
6
|
+
*
|
|
7
|
+
* Kind: scan
|
|
8
|
+
* Status: active
|
|
9
|
+
* Tracked in: ../docs/plans/v0/source-anchor-dogfooding.md
|
|
10
|
+
* Decided by: ../docs/decisions/source-scan.md
|
|
11
|
+
* @patram
|
|
12
|
+
* @see {@link ./load-project-graph.js}
|
|
13
|
+
* @see {@link ../docs/decisions/source-scan.md}
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* List source files matched by Patram include globs.
|
|
17
|
+
*
|
|
18
|
+
* @param {string[]} include_patterns
|
|
19
|
+
* @param {string} [project_directory]
|
|
20
|
+
* @returns {Promise<string[]>}
|
|
21
|
+
*/
|
|
22
|
+
export function listSourceFiles(include_patterns: string[], project_directory?: string): Promise<string[]>;
|
|
23
|
+
/**
|
|
24
|
+
* List repo files available for broken-link validation.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} [project_directory]
|
|
27
|
+
* @returns {Promise<string[]>}
|
|
28
|
+
*/
|
|
29
|
+
export function listRepoFiles(project_directory?: string): Promise<string[]>;
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} LoadPatramConfigResult
|
|
3
|
+
* @property {PatramRepoConfig | null} config
|
|
4
|
+
* @property {string} config_path
|
|
5
|
+
* @property {PatramDiagnostic[]} diagnostics
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Load and validate the repo Patram config.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} [project_directory]
|
|
11
|
+
* @returns {Promise<LoadPatramConfigResult>}
|
|
12
|
+
*/
|
|
13
|
+
export function loadPatramConfig(project_directory?: string): Promise<LoadPatramConfigResult>;
|
|
14
|
+
export type LoadPatramConfigResult = {
|
|
15
|
+
config: PatramRepoConfig | null;
|
|
16
|
+
config_path: string;
|
|
17
|
+
diagnostics: PatramDiagnostic[];
|
|
18
|
+
};
|
|
19
|
+
export type PatramDiagnostic = {
|
|
20
|
+
code: string;
|
|
21
|
+
column: number;
|
|
22
|
+
level: "error";
|
|
23
|
+
line: number;
|
|
24
|
+
message: string;
|
|
25
|
+
path: string;
|
|
26
|
+
};
|
|
27
|
+
export type StoredQueryConfig = z.output<typeof stored_query_schema>;
|
|
28
|
+
export type DerivedSummaryScalar = z.output<typeof derived_summary_scalar_schema>;
|
|
29
|
+
export type DerivedSummaryCountConfig = z.output<typeof derived_summary_count_schema>;
|
|
30
|
+
export type DerivedSummarySelectCaseConfig = z.output<typeof derived_summary_select_case_schema>;
|
|
31
|
+
export type DerivedSummaryFieldConfig = z.output<typeof derived_summary_field_schema>;
|
|
32
|
+
export type DerivedSummaryConfig = z.output<typeof derived_summary_schema>;
|
|
33
|
+
export type FieldDisplayConfig = z.output<typeof field_display_schema>;
|
|
34
|
+
export type FieldQueryConfig = z.output<typeof field_query_schema>;
|
|
35
|
+
export type MetadataFieldConfig = z.output<typeof metadata_field_schema>;
|
|
36
|
+
export type ClassFieldRuleConfig = z.output<typeof class_field_rule_schema>;
|
|
37
|
+
export type ClassSchemaConfig = z.output<typeof class_schema_schema>;
|
|
38
|
+
export type RepoClassConfig = z.output<typeof repo_class_definition_schema>;
|
|
39
|
+
export type PathClassConfig = z.output<typeof path_class_schema>;
|
|
40
|
+
export type PatramRepoConfig = z.output<typeof patram_repo_config_schema>;
|
|
41
|
+
import { z } from 'zod';
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {object} PatramDiagnostic
|
|
44
|
+
* @property {string} code
|
|
45
|
+
* @property {number} column
|
|
46
|
+
* @property {'error'} level
|
|
47
|
+
* @property {number} line
|
|
48
|
+
* @property {string} message
|
|
49
|
+
* @property {string} path
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* @typedef {z.output<typeof stored_query_schema>} StoredQueryConfig
|
|
53
|
+
*/
|
|
54
|
+
declare const stored_query_schema: z.ZodObject<{
|
|
55
|
+
where: z.ZodString;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
/**
|
|
58
|
+
* @typedef {z.output<typeof derived_summary_scalar_schema>} DerivedSummaryScalar
|
|
59
|
+
*/
|
|
60
|
+
declare const derived_summary_scalar_schema: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
61
|
+
/**
|
|
62
|
+
* @typedef {z.output<typeof derived_summary_count_schema>} DerivedSummaryCountConfig
|
|
63
|
+
*/
|
|
64
|
+
declare const derived_summary_count_schema: z.ZodObject<{
|
|
65
|
+
traversal: z.ZodString;
|
|
66
|
+
where: z.ZodString;
|
|
67
|
+
}, z.core.$strict>;
|
|
68
|
+
/**
|
|
69
|
+
* @typedef {z.output<typeof derived_summary_select_case_schema>} DerivedSummarySelectCaseConfig
|
|
70
|
+
*/
|
|
71
|
+
declare const derived_summary_select_case_schema: z.ZodObject<{
|
|
72
|
+
value: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
73
|
+
when: z.ZodString;
|
|
74
|
+
}, z.core.$strict>;
|
|
75
|
+
declare const derived_summary_field_schema: z.ZodUnion<readonly [z.ZodObject<{
|
|
76
|
+
count: z.ZodObject<{
|
|
77
|
+
traversal: z.ZodString;
|
|
78
|
+
where: z.ZodString;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
82
|
+
default: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
83
|
+
name: z.ZodString;
|
|
84
|
+
select: z.ZodArray<z.ZodObject<{
|
|
85
|
+
value: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
86
|
+
when: z.ZodString;
|
|
87
|
+
}, z.core.$strict>>;
|
|
88
|
+
}, z.core.$strict>]>;
|
|
89
|
+
/**
|
|
90
|
+
* @typedef {z.output<typeof derived_summary_schema>} DerivedSummaryConfig
|
|
91
|
+
*/
|
|
92
|
+
declare const derived_summary_schema: z.ZodObject<{
|
|
93
|
+
classes: z.ZodArray<z.ZodString>;
|
|
94
|
+
fields: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
95
|
+
count: z.ZodObject<{
|
|
96
|
+
traversal: z.ZodString;
|
|
97
|
+
where: z.ZodString;
|
|
98
|
+
}, z.core.$strict>;
|
|
99
|
+
name: z.ZodString;
|
|
100
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
101
|
+
default: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
102
|
+
name: z.ZodString;
|
|
103
|
+
select: z.ZodArray<z.ZodObject<{
|
|
104
|
+
value: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
105
|
+
when: z.ZodString;
|
|
106
|
+
}, z.core.$strict>>;
|
|
107
|
+
}, z.core.$strict>]>>;
|
|
108
|
+
}, z.core.$strict>;
|
|
109
|
+
/**
|
|
110
|
+
* @typedef {z.output<typeof field_display_schema>} FieldDisplayConfig
|
|
111
|
+
*/
|
|
112
|
+
declare const field_display_schema: z.ZodObject<{
|
|
113
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
114
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
/**
|
|
117
|
+
* @typedef {z.output<typeof field_query_schema>} FieldQueryConfig
|
|
118
|
+
*/
|
|
119
|
+
declare const field_query_schema: z.ZodObject<{
|
|
120
|
+
contains: z.ZodOptional<z.ZodBoolean>;
|
|
121
|
+
prefix: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
+
}, z.core.$strict>;
|
|
123
|
+
/**
|
|
124
|
+
* @typedef {z.output<typeof metadata_field_schema>} MetadataFieldConfig
|
|
125
|
+
*/
|
|
126
|
+
declare const metadata_field_schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
127
|
+
query: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
contains: z.ZodOptional<z.ZodBoolean>;
|
|
129
|
+
prefix: z.ZodOptional<z.ZodBoolean>;
|
|
130
|
+
}, z.core.$strict>>;
|
|
131
|
+
type: z.ZodLiteral<"string">;
|
|
132
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
133
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
134
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
137
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
138
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
139
|
+
type: z.ZodLiteral<"integer">;
|
|
140
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
141
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
}, z.core.$strict>>;
|
|
144
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
145
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
147
|
+
type: z.ZodLiteral<"enum">;
|
|
148
|
+
values: z.ZodArray<z.ZodString>;
|
|
149
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
150
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
}, z.core.$strict>>;
|
|
153
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"path">;
|
|
157
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
158
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
160
|
+
}, z.core.$strict>>;
|
|
161
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
162
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
164
|
+
type: z.ZodLiteral<"glob">;
|
|
165
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
166
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
167
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
168
|
+
}, z.core.$strict>>;
|
|
169
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
170
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
171
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
172
|
+
type: z.ZodLiteral<"date">;
|
|
173
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
174
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
176
|
+
}, z.core.$strict>>;
|
|
177
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
179
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
180
|
+
type: z.ZodLiteral<"date_time">;
|
|
181
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
182
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
183
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
}, z.core.$strict>>;
|
|
185
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
187
|
+
}, z.core.$strict>], "type">;
|
|
188
|
+
/**
|
|
189
|
+
* @typedef {z.output<typeof class_field_rule_schema>} ClassFieldRuleConfig
|
|
190
|
+
*/
|
|
191
|
+
declare const class_field_rule_schema: z.ZodObject<{
|
|
192
|
+
markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
193
|
+
presence: z.ZodEnum<{
|
|
194
|
+
optional: "optional";
|
|
195
|
+
required: "required";
|
|
196
|
+
forbidden: "forbidden";
|
|
197
|
+
}>;
|
|
198
|
+
}, z.core.$strict>;
|
|
199
|
+
/**
|
|
200
|
+
* @typedef {z.output<typeof class_schema_schema>} ClassSchemaConfig
|
|
201
|
+
*/
|
|
202
|
+
declare const class_schema_schema: z.ZodObject<{
|
|
203
|
+
document_path_class: z.ZodOptional<z.ZodString>;
|
|
204
|
+
fields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
205
|
+
markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
206
|
+
presence: z.ZodEnum<{
|
|
207
|
+
optional: "optional";
|
|
208
|
+
required: "required";
|
|
209
|
+
forbidden: "forbidden";
|
|
210
|
+
}>;
|
|
211
|
+
}, z.core.$strict>>>;
|
|
212
|
+
markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
213
|
+
mixed_styles: z.ZodOptional<z.ZodString>;
|
|
214
|
+
unknown_fields: z.ZodOptional<z.ZodEnum<{
|
|
215
|
+
error: "error";
|
|
216
|
+
ignore: "ignore";
|
|
217
|
+
}>>;
|
|
218
|
+
}, z.core.$strict>;
|
|
219
|
+
/**
|
|
220
|
+
* @typedef {z.output<typeof repo_class_definition_schema>} RepoClassConfig
|
|
221
|
+
*/
|
|
222
|
+
declare const repo_class_definition_schema: z.ZodObject<{
|
|
223
|
+
builtin: z.ZodOptional<z.ZodBoolean>;
|
|
224
|
+
label: z.ZodOptional<z.ZodString>;
|
|
225
|
+
schema: z.ZodOptional<z.ZodObject<{
|
|
226
|
+
document_path_class: z.ZodOptional<z.ZodString>;
|
|
227
|
+
fields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
228
|
+
markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
229
|
+
presence: z.ZodEnum<{
|
|
230
|
+
optional: "optional";
|
|
231
|
+
required: "required";
|
|
232
|
+
forbidden: "forbidden";
|
|
233
|
+
}>;
|
|
234
|
+
}, z.core.$strict>>>;
|
|
235
|
+
markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
236
|
+
mixed_styles: z.ZodOptional<z.ZodString>;
|
|
237
|
+
unknown_fields: z.ZodOptional<z.ZodEnum<{
|
|
238
|
+
error: "error";
|
|
239
|
+
ignore: "ignore";
|
|
240
|
+
}>>;
|
|
241
|
+
}, z.core.$strict>>;
|
|
242
|
+
}, z.core.$strict>;
|
|
243
|
+
/**
|
|
244
|
+
* @typedef {z.output<typeof path_class_schema>} PathClassConfig
|
|
245
|
+
*/
|
|
246
|
+
declare const path_class_schema: z.ZodObject<{
|
|
247
|
+
prefixes: z.ZodArray<z.ZodString>;
|
|
248
|
+
}, z.core.$strict>;
|
|
249
|
+
/**
|
|
250
|
+
* @typedef {z.output<typeof patram_repo_config_schema>} PatramRepoConfig
|
|
251
|
+
*/
|
|
252
|
+
declare const patram_repo_config_schema: z.ZodObject<{
|
|
253
|
+
classes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
254
|
+
builtin: z.ZodOptional<z.ZodBoolean>;
|
|
255
|
+
label: z.ZodOptional<z.ZodString>;
|
|
256
|
+
schema: z.ZodOptional<z.ZodObject<{
|
|
257
|
+
document_path_class: z.ZodOptional<z.ZodString>;
|
|
258
|
+
fields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
259
|
+
markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
260
|
+
presence: z.ZodEnum<{
|
|
261
|
+
optional: "optional";
|
|
262
|
+
required: "required";
|
|
263
|
+
forbidden: "forbidden";
|
|
264
|
+
}>;
|
|
265
|
+
}, z.core.$strict>>>;
|
|
266
|
+
markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
267
|
+
mixed_styles: z.ZodOptional<z.ZodString>;
|
|
268
|
+
unknown_fields: z.ZodOptional<z.ZodEnum<{
|
|
269
|
+
error: "error";
|
|
270
|
+
ignore: "ignore";
|
|
271
|
+
}>>;
|
|
272
|
+
}, z.core.$strict>>;
|
|
273
|
+
}, z.core.$strict>>>;
|
|
274
|
+
derived_summaries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
275
|
+
classes: z.ZodArray<z.ZodString>;
|
|
276
|
+
fields: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
277
|
+
count: z.ZodObject<{
|
|
278
|
+
traversal: z.ZodString;
|
|
279
|
+
where: z.ZodString;
|
|
280
|
+
}, z.core.$strict>;
|
|
281
|
+
name: z.ZodString;
|
|
282
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
283
|
+
default: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
284
|
+
name: z.ZodString;
|
|
285
|
+
select: z.ZodArray<z.ZodObject<{
|
|
286
|
+
value: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
287
|
+
when: z.ZodString;
|
|
288
|
+
}, z.core.$strict>>;
|
|
289
|
+
}, z.core.$strict>]>>;
|
|
290
|
+
}, z.core.$strict>>>;
|
|
291
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
292
|
+
query: z.ZodOptional<z.ZodObject<{
|
|
293
|
+
contains: z.ZodOptional<z.ZodBoolean>;
|
|
294
|
+
prefix: z.ZodOptional<z.ZodBoolean>;
|
|
295
|
+
}, z.core.$strict>>;
|
|
296
|
+
type: z.ZodLiteral<"string">;
|
|
297
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
298
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
299
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
300
|
+
}, z.core.$strict>>;
|
|
301
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
302
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
303
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
304
|
+
type: z.ZodLiteral<"integer">;
|
|
305
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
306
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
307
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
308
|
+
}, z.core.$strict>>;
|
|
309
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
310
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
311
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
312
|
+
type: z.ZodLiteral<"enum">;
|
|
313
|
+
values: z.ZodArray<z.ZodString>;
|
|
314
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
315
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
316
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
317
|
+
}, z.core.$strict>>;
|
|
318
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
319
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
320
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
321
|
+
type: z.ZodLiteral<"path">;
|
|
322
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
323
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
324
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
325
|
+
}, z.core.$strict>>;
|
|
326
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
327
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
328
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
329
|
+
type: z.ZodLiteral<"glob">;
|
|
330
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
331
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
332
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
333
|
+
}, z.core.$strict>>;
|
|
334
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
335
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
336
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
337
|
+
type: z.ZodLiteral<"date">;
|
|
338
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
339
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
340
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
341
|
+
}, z.core.$strict>>;
|
|
342
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
343
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
344
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
345
|
+
type: z.ZodLiteral<"date_time">;
|
|
346
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
347
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
348
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
349
|
+
}, z.core.$strict>>;
|
|
350
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
351
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
352
|
+
}, z.core.$strict>], "type">>>;
|
|
353
|
+
include: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
354
|
+
mappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
355
|
+
emit: z.ZodOptional<z.ZodObject<{
|
|
356
|
+
relation: z.ZodString;
|
|
357
|
+
target: z.ZodEnum<{
|
|
358
|
+
path: "path";
|
|
359
|
+
value: "value";
|
|
360
|
+
}>;
|
|
361
|
+
target_class: z.ZodString;
|
|
362
|
+
}, z.core.$strict>>;
|
|
363
|
+
node: z.ZodOptional<z.ZodObject<{
|
|
364
|
+
class: z.ZodString;
|
|
365
|
+
field: z.ZodString;
|
|
366
|
+
key: z.ZodOptional<z.ZodEnum<{
|
|
367
|
+
path: "path";
|
|
368
|
+
value: "value";
|
|
369
|
+
}>>;
|
|
370
|
+
}, z.core.$strict>>;
|
|
371
|
+
}, z.core.$strict>>>;
|
|
372
|
+
path_classes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
373
|
+
prefixes: z.ZodArray<z.ZodString>;
|
|
374
|
+
}, z.core.$strict>>>;
|
|
375
|
+
queries: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
376
|
+
where: z.ZodString;
|
|
377
|
+
}, z.core.$strict>>>;
|
|
378
|
+
relations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
379
|
+
builtin: z.ZodOptional<z.ZodBoolean>;
|
|
380
|
+
from: z.ZodArray<z.ZodString>;
|
|
381
|
+
to: z.ZodArray<z.ZodString>;
|
|
382
|
+
}, z.core.$strict>>>;
|
|
383
|
+
}, z.core.$strict>;
|
|
384
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type StoredQueryConfig = import('./load-patram-config.js').StoredQueryConfig;
|
|
2
|
+
export type FieldDisplayConfig = import('./load-patram-config.js').FieldDisplayConfig;
|
|
3
|
+
export type FieldQueryConfig = import('./load-patram-config.js').FieldQueryConfig;
|
|
4
|
+
export type FieldValueTypeName = import('./load-patram-config.js').MetadataFieldConfig['type'];
|
|
5
|
+
export type MetadataFieldConfig = import('./load-patram-config.js').MetadataFieldConfig;
|
|
6
|
+
export type StringFieldConfig = Extract<MetadataFieldConfig, {
|
|
7
|
+
type: 'string';
|
|
8
|
+
}>;
|
|
9
|
+
export type IntegerFieldConfig = Extract<MetadataFieldConfig, {
|
|
10
|
+
type: 'integer';
|
|
11
|
+
}>;
|
|
12
|
+
export type EnumFieldConfig = Extract<MetadataFieldConfig, {
|
|
13
|
+
type: 'enum';
|
|
14
|
+
}>;
|
|
15
|
+
export type PathFieldConfig = Extract<MetadataFieldConfig, {
|
|
16
|
+
type: 'path';
|
|
17
|
+
}>;
|
|
18
|
+
export type GlobFieldConfig = Extract<MetadataFieldConfig, {
|
|
19
|
+
type: 'glob';
|
|
20
|
+
}>;
|
|
21
|
+
export type DateFieldConfig = Extract<MetadataFieldConfig, {
|
|
22
|
+
type: 'date';
|
|
23
|
+
}>;
|
|
24
|
+
export type DateTimeFieldConfig = Extract<MetadataFieldConfig, {
|
|
25
|
+
type: 'date_time';
|
|
26
|
+
}>;
|
|
27
|
+
export type ClassFieldRuleConfig = import('./load-patram-config.js').ClassFieldRuleConfig;
|
|
28
|
+
export type DirectiveTypeConfig = MetadataFieldConfig;
|
|
29
|
+
export type MetadataDirectiveRuleConfig = ClassFieldRuleConfig;
|
|
30
|
+
export type ClassSchemaConfig = import('./load-patram-config.js').ClassSchemaConfig;
|
|
31
|
+
export type MetadataSchemaConfig = ClassSchemaConfig;
|
|
32
|
+
export type PathClassConfig = import('./load-patram-config.js').PathClassConfig;
|
|
33
|
+
export type DerivedSummaryScalar = import('./load-patram-config.js').DerivedSummaryScalar;
|
|
34
|
+
export type DerivedSummarySelectCaseConfig = import('./load-patram-config.js').DerivedSummarySelectCaseConfig;
|
|
35
|
+
export type DerivedSummaryFieldConfig = import('./load-patram-config.js').DerivedSummaryFieldConfig;
|
|
36
|
+
export type DerivedSummaryCountFieldConfig = Extract<DerivedSummaryFieldConfig, {
|
|
37
|
+
count: unknown;
|
|
38
|
+
}>;
|
|
39
|
+
export type DerivedSummarySelectFieldConfig = Extract<DerivedSummaryFieldConfig, {
|
|
40
|
+
select: unknown;
|
|
41
|
+
}>;
|
|
42
|
+
export type DerivedSummaryConfig = import('./load-patram-config.js').DerivedSummaryConfig;
|
|
43
|
+
export type PatramRepoConfig = import('./load-patram-config.js').PatramRepoConfig;
|
|
44
|
+
export type PatramDiagnostic = import('./load-patram-config.js').PatramDiagnostic;
|
|
45
|
+
export type LoadPatramConfigResult = import('./load-patram-config.js').LoadPatramConfigResult;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project graph loading pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Loads config, scans source files, parses claims, and materializes the graph
|
|
5
|
+
* used by CLI commands.
|
|
6
|
+
*
|
|
7
|
+
* Kind: graph
|
|
8
|
+
* Status: active
|
|
9
|
+
* Uses Term: ../docs/reference/terms/claim.md
|
|
10
|
+
* Uses Term: ../docs/reference/terms/graph.md
|
|
11
|
+
* Uses Term: ../docs/reference/terms/mapping.md
|
|
12
|
+
* Tracked in: ../docs/plans/v0/source-anchor-dogfooding.md
|
|
13
|
+
* Decided by: ../docs/decisions/dogfood-query-graph-v0.md
|
|
14
|
+
* @patram
|
|
15
|
+
* @see {@link ./parse-claims.js}
|
|
16
|
+
* @see {@link ./build-graph.js}
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Load config, source files, claims, and the materialized graph for one
|
|
20
|
+
* project directory.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} project_directory
|
|
23
|
+
* @returns {Promise<{ claims: PatramClaim[], config: PatramRepoConfig, diagnostics: PatramDiagnostic[], graph: BuildGraphResult, source_file_paths: string[] }>}
|
|
24
|
+
*/
|
|
25
|
+
export function loadProjectGraph(project_directory: string): Promise<{
|
|
26
|
+
claims: PatramClaim[];
|
|
27
|
+
config: PatramRepoConfig;
|
|
28
|
+
diagnostics: PatramDiagnostic[];
|
|
29
|
+
graph: BuildGraphResult;
|
|
30
|
+
source_file_paths: string[];
|
|
31
|
+
}>;
|
|
32
|
+
import type { PatramClaim } from './parse-claims.types.ts';
|
|
33
|
+
import type { PatramRepoConfig } from './load-patram-config.types.ts';
|
|
34
|
+
import type { PatramDiagnostic } from './load-patram-config.types.ts';
|
|
35
|
+
import type { BuildGraphResult } from './build-graph.types.ts';
|