patram 0.8.0 → 0.9.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/bin/patram.js +2 -2
- package/lib/{parse-cli-color-options.js → cli/color-options.js} +2 -2
- package/lib/cli/command-helpers.js +35 -0
- package/lib/cli/commands/check.js +73 -0
- package/lib/cli/commands/fields.js +57 -0
- package/lib/cli/commands/queries.js +41 -0
- package/lib/cli/commands/query.js +239 -0
- package/lib/cli/commands/refs.js +72 -0
- package/lib/cli/commands/show.js +58 -0
- package/lib/{cli-help-metadata.js → cli/help-metadata.js} +6 -6
- package/lib/cli/main.js +76 -0
- package/lib/{parse-cli-arguments-helpers.js → cli/parse-arguments-helpers.js} +7 -7
- package/lib/{parse-cli-arguments.js → cli/parse-arguments.js} +12 -12
- package/lib/{parse-cli-query-pagination.js → cli/query-pagination.js} +2 -2
- package/lib/{render-cli-help.js → cli/render-help.js} +3 -3
- package/lib/{resolve-output-mode.js → cli/resolve-output-mode.js} +2 -2
- package/lib/cli/test-helpers.js +30 -0
- package/lib/config/defaults.d.ts +10 -0
- package/lib/config/defaults.js +80 -0
- package/lib/config/load-patram-config.d.ts +76 -0
- package/lib/config/load-patram-config.js +315 -0
- package/lib/config/load-patram-config.types.d.ts +45 -0
- package/lib/{patram-config.d.ts → config/patram-config.d.ts} +31 -31
- package/lib/{patram-config.js → config/patram-config.js} +3 -3
- package/lib/{patram-config.types.d.ts → config/patram-config.types.d.ts} +1 -1
- package/lib/{resolve-patram-graph-config.d.ts → config/resolve-patram-graph-config.d.ts} +2 -2
- package/lib/{resolve-patram-graph-config.js → config/resolve-patram-graph-config.js} +3 -3
- package/lib/{load-patram-config.d.ts → config/schema.d.ts} +147 -191
- package/lib/config/schema.js +324 -0
- package/lib/{source-file-defaults.d.ts → config/source-file-defaults.d.ts} +0 -1
- package/lib/{source-file-defaults.js → config/source-file-defaults.js} +1 -1
- package/lib/config/validation.d.ts +27 -0
- package/lib/config/validation.js +615 -0
- package/lib/directive-validation-test-helpers.js +1 -1
- package/lib/{build-graph-identity.d.ts → graph/build-graph-identity.d.ts} +2 -2
- package/lib/{build-graph-identity.js → graph/build-graph-identity.js} +1 -1
- package/lib/{build-graph.d.ts → graph/build-graph.d.ts} +3 -3
- package/lib/{build-graph.js → graph/build-graph.js} +17 -13
- package/lib/{build-graph.types.d.ts → graph/build-graph.types.d.ts} +1 -1
- package/lib/graph/check-directive-metadata.d.ts +23 -0
- package/lib/{check-directive-metadata.js → graph/check-directive-metadata.js} +7 -7
- package/lib/graph/check-directive-path-target.d.ts +32 -0
- package/lib/{check-directive-path-target.js → graph/check-directive-path-target.js} +4 -4
- package/lib/graph/check-directive-value.d.ts +19 -0
- package/lib/{check-directive-value.js → graph/check-directive-value.js} +3 -3
- package/lib/graph/check-graph.d.ts +29 -0
- package/lib/{check-graph.js → graph/check-graph.js} +6 -6
- package/lib/graph/directive-diagnostics.d.ts +20 -0
- package/lib/{directive-diagnostics.js → graph/directive-diagnostics.js} +2 -2
- package/lib/graph/directive-type-rules.d.ts +18 -0
- package/lib/{directive-type-rules.js → graph/directive-type-rules.js} +3 -3
- package/lib/{document-node-identity.d.ts → graph/document-node-identity.d.ts} +2 -2
- package/lib/{document-node-identity.js → graph/document-node-identity.js} +2 -2
- package/lib/graph/inspect-reverse-references.d.ts +22 -0
- package/lib/{inspect-reverse-references.js → graph/inspect-reverse-references.js} +2 -2
- package/lib/{load-project-graph.d.ts → graph/load-project-graph.d.ts} +10 -10
- package/lib/{load-project-graph.js → graph/load-project-graph.js} +12 -12
- package/lib/{parse-where-clause.types.d.ts → graph/parse-where-clause.types.d.ts} +1 -1
- package/lib/{query-graph.d.ts → graph/query/execute.d.ts} +11 -11
- package/lib/{query-graph.js → graph/query/execute.js} +12 -12
- package/lib/{query-inspection.d.ts → graph/query/inspect.d.ts} +10 -8
- package/lib/{query-inspection.js → graph/query/inspect.js} +16 -17
- package/lib/{parse-where-clause.d.ts → graph/query/parse.d.ts} +6 -6
- package/lib/{parse-where-clause.js → graph/query/parse.js} +2 -2
- package/lib/graph/query/resolve.d.ts +30 -0
- package/lib/{resolve-where-clause.js → graph/query/resolve.js} +1 -1
- package/lib/graph/reverse-reference-test-helpers.d.ts +55 -0
- package/lib/{command-output.js → output/command-output.js} +5 -5
- package/lib/{derived-summary.js → output/derived-summary.js} +7 -7
- package/lib/{layout-incoming-references.js → output/layout-incoming-references.js} +4 -4
- package/lib/{layout-incoming-summary-lines.js → output/layout-incoming-summary-lines.js} +0 -5
- package/lib/{layout-stored-queries.js → output/layout-stored-queries.js} +9 -9
- package/lib/{list-queries.js → output/list-queries.js} +1 -1
- package/lib/{render-check-output.js → output/render-check-output.js} +1 -1
- package/lib/{render-field-discovery.js → output/render-field-discovery.js} +3 -3
- package/lib/output/render-output-view.js +56 -0
- package/lib/{render-json-output.js → output/renderers/json.js} +1 -1
- package/lib/{render-plain-output.js → output/renderers/plain.js} +19 -7
- package/lib/{render-rich-output.js → output/renderers/rich.js} +29 -13
- package/lib/{resolve-check-target.js → output/resolve-check-target.js} +1 -1
- package/lib/{render-rich-source.js → output/rich-source/render.js} +6 -6
- package/lib/{show-document.js → output/show-document.js} +12 -12
- package/lib/{render-output-view.js → output/view-model/index.js} +6 -52
- package/lib/{write-paged-output.js → output/write-paged-output.js} +9 -5
- package/lib/{claim-helpers.d.ts → parse/claim-helpers.d.ts} +2 -2
- package/lib/{parse-jsdoc-claims.d.ts → parse/jsdoc/parse-jsdoc-claims.d.ts} +2 -2
- package/lib/{parse-jsdoc-claims.js → parse/jsdoc/parse-jsdoc-claims.js} +9 -9
- package/lib/{parse-jsdoc-prose.d.ts → parse/jsdoc/parse-jsdoc-prose.d.ts} +1 -1
- package/lib/{parse-jsdoc-prose.js → parse/jsdoc/parse-jsdoc-prose.js} +1 -1
- package/lib/{parse-markdown-claims.d.ts → parse/markdown/parse-markdown-claims.d.ts} +3 -3
- package/lib/{parse-markdown-claims.js → parse/markdown/parse-markdown-claims.js} +8 -8
- package/lib/{parse-markdown-directives.d.ts → parse/markdown/parse-markdown-directives.d.ts} +2 -2
- package/lib/{parse-markdown-directives.js → parse/markdown/parse-markdown-directives.js} +3 -3
- package/lib/{parse-claims.d.ts → parse/parse-claims.d.ts} +4 -13
- package/lib/{parse-claims.js → parse/parse-claims.js} +18 -26
- package/lib/{parse-claims.types.d.ts → parse/parse-claims.types.d.ts} +1 -1
- package/lib/{tagged-fenced-block-error.d.ts → parse/tagged-fenced/tagged-fenced-block-error.d.ts} +2 -2
- package/lib/{tagged-fenced-block-parser.d.ts → parse/tagged-fenced/tagged-fenced-block-parser.d.ts} +3 -3
- package/lib/{tagged-fenced-blocks.d.ts → parse/tagged-fenced/tagged-fenced-blocks.d.ts} +7 -7
- package/lib/{tagged-fenced-blocks.js → parse/tagged-fenced/tagged-fenced-blocks.js} +3 -3
- package/lib/{parse-yaml-claims.d.ts → parse/yaml/parse-yaml-claims.d.ts} +4 -4
- package/lib/{parse-yaml-claims.js → parse/yaml/parse-yaml-claims.js} +22 -13
- package/lib/patram.d.ts +29 -28
- package/lib/patram.js +5 -6
- package/lib/{discover-fields.js → scan/discover-fields.js} +9 -8
- package/lib/scan/list-repo-files.d.ts +16 -0
- package/lib/{list-source-files.js → scan/list-repo-files.js} +2 -35
- package/lib/{list-source-files.d.ts → scan/list-source-files.d.ts} +4 -11
- package/lib/scan/list-source-files.js +45 -0
- package/package.json +8 -7
- package/lib/build-graph.types.ts +0 -27
- package/lib/discover-fields.types.ts +0 -52
- package/lib/load-patram-config.js +0 -1215
- package/lib/load-patram-config.types.d.ts +0 -45
- package/lib/load-patram-config.types.ts +0 -56
- package/lib/output-view.types.d.ts +0 -88
- package/lib/output-view.types.ts +0 -113
- package/lib/overlay-graph.d.ts +0 -43
- package/lib/overlay-graph.js +0 -191
- package/lib/parse-claims.types.ts +0 -41
- package/lib/parse-cli-arguments.types.ts +0 -75
- package/lib/parse-where-clause.types.ts +0 -87
- package/lib/patram-cli.js +0 -593
- package/lib/patram-config.types.ts +0 -22
- package/lib/tagged-fenced-blocks.types.ts +0 -38
- /package/lib/{reverse-reference-test-helpers.js → graph/reverse-reference-test-helpers.js} +0 -0
- /package/lib/{format-derived-summary-row.js → output/format-derived-summary-row.js} +0 -0
- /package/lib/{format-node-header.js → output/format-node-header.js} +0 -0
- /package/lib/{format-output-item-block.js → output/format-output-item-block.js} +0 -0
- /package/lib/{format-output-metadata.js → output/format-output-metadata.js} +0 -0
- /package/lib/{claim-helpers.js → parse/claim-helpers.js} +0 -0
- /package/lib/{parse-jsdoc-blocks.d.ts → parse/jsdoc/parse-jsdoc-blocks.d.ts} +0 -0
- /package/lib/{parse-jsdoc-blocks.js → parse/jsdoc/parse-jsdoc-blocks.js} +0 -0
- /package/lib/{tagged-fenced-block-error.js → parse/tagged-fenced/tagged-fenced-block-error.js} +0 -0
- /package/lib/{tagged-fenced-block-markdown.d.ts → parse/tagged-fenced/tagged-fenced-block-markdown.d.ts} +0 -0
- /package/lib/{tagged-fenced-block-markdown.js → parse/tagged-fenced/tagged-fenced-block-markdown.js} +0 -0
- /package/lib/{tagged-fenced-block-metadata.d.ts → parse/tagged-fenced/tagged-fenced-block-metadata.d.ts} +0 -0
- /package/lib/{tagged-fenced-block-metadata.js → parse/tagged-fenced/tagged-fenced-block-metadata.js} +0 -0
- /package/lib/{tagged-fenced-block-parser.js → parse/tagged-fenced/tagged-fenced-block-parser.js} +0 -0
- /package/lib/{tagged-fenced-blocks.types.d.ts → parse/tagged-fenced/tagged-fenced-blocks.types.d.ts} +0 -0
|
@@ -1,29 +1,154 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
3
|
-
* @
|
|
4
|
-
* @property {string} config_path
|
|
5
|
-
* @property {PatramDiagnostic[]} diagnostics
|
|
2
|
+
* @param {string} field_name
|
|
3
|
+
* @returns {boolean}
|
|
6
4
|
*/
|
|
5
|
+
export function isReservedStructuralFieldName(field_name: string): boolean;
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @param {string} [project_directory]
|
|
11
|
-
* @returns {Promise<LoadPatramConfigResult>}
|
|
7
|
+
* @param {string} markdown_style
|
|
8
|
+
* @returns {boolean}
|
|
12
9
|
*/
|
|
13
|
-
export function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
export function isKnownMarkdownStyle(markdown_style: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} mixed_styles
|
|
13
|
+
* @returns {boolean}
|
|
14
|
+
*/
|
|
15
|
+
export function isMixedStyleValue(mixed_styles: string): boolean;
|
|
16
|
+
export const CONFIG_FILE_NAME: ".patram.json";
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {z.output<typeof patram_repo_config_schema>} PatramRepoConfig
|
|
19
|
+
*/
|
|
20
|
+
export const patram_repo_config_schema: z.ZodObject<{
|
|
21
|
+
classes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
22
|
+
builtin: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
label: z.ZodOptional<z.ZodString>;
|
|
24
|
+
schema: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
document_path_class: z.ZodOptional<z.ZodString>;
|
|
26
|
+
fields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
27
|
+
markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
|
+
presence: z.ZodEnum<{
|
|
29
|
+
optional: "optional";
|
|
30
|
+
required: "required";
|
|
31
|
+
forbidden: "forbidden";
|
|
32
|
+
}>;
|
|
33
|
+
}, z.core.$strict>>>;
|
|
34
|
+
markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
mixed_styles: z.ZodOptional<z.ZodString>;
|
|
36
|
+
unknown_fields: z.ZodOptional<z.ZodEnum<{
|
|
37
|
+
error: "error";
|
|
38
|
+
ignore: "ignore";
|
|
39
|
+
}>>;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
}, z.core.$strict>>>;
|
|
42
|
+
derived_summaries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
43
|
+
classes: z.ZodArray<z.ZodString>;
|
|
44
|
+
fields: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
45
|
+
count: z.ZodObject<{
|
|
46
|
+
traversal: z.ZodString;
|
|
47
|
+
where: z.ZodString;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
51
|
+
default: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
select: z.ZodArray<z.ZodObject<{
|
|
54
|
+
value: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
|
|
55
|
+
when: z.ZodString;
|
|
56
|
+
}, z.core.$strict>>;
|
|
57
|
+
}, z.core.$strict>]>>;
|
|
58
|
+
}, z.core.$strict>>>;
|
|
59
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
60
|
+
query: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
contains: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
prefix: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
type: z.ZodLiteral<"string">;
|
|
65
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
}, z.core.$strict>>;
|
|
69
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
70
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
72
|
+
type: z.ZodLiteral<"integer">;
|
|
73
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
}, z.core.$strict>>;
|
|
77
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
80
|
+
type: z.ZodLiteral<"enum">;
|
|
81
|
+
values: z.ZodArray<z.ZodString>;
|
|
82
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
}, z.core.$strict>>;
|
|
86
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"path">;
|
|
90
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
}, z.core.$strict>>;
|
|
94
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
97
|
+
type: z.ZodLiteral<"glob">;
|
|
98
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
}, z.core.$strict>>;
|
|
102
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
105
|
+
type: z.ZodLiteral<"date">;
|
|
106
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
107
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
}, z.core.$strict>>;
|
|
110
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
111
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
112
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
113
|
+
type: z.ZodLiteral<"date_time">;
|
|
114
|
+
display: z.ZodOptional<z.ZodObject<{
|
|
115
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
}, z.core.$strict>>;
|
|
118
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
path_class: z.ZodOptional<z.ZodString>;
|
|
120
|
+
}, z.core.$strict>], "type">>>;
|
|
121
|
+
include: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
122
|
+
mappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
123
|
+
emit: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
relation: z.ZodString;
|
|
125
|
+
target: z.ZodEnum<{
|
|
126
|
+
path: "path";
|
|
127
|
+
value: "value";
|
|
128
|
+
}>;
|
|
129
|
+
target_class: z.ZodString;
|
|
130
|
+
}, z.core.$strict>>;
|
|
131
|
+
node: z.ZodOptional<z.ZodObject<{
|
|
132
|
+
class: z.ZodString;
|
|
133
|
+
field: z.ZodString;
|
|
134
|
+
key: z.ZodOptional<z.ZodEnum<{
|
|
135
|
+
path: "path";
|
|
136
|
+
value: "value";
|
|
137
|
+
}>>;
|
|
138
|
+
}, z.core.$strict>>;
|
|
139
|
+
}, z.core.$strict>>>;
|
|
140
|
+
path_classes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
141
|
+
prefixes: z.ZodArray<z.ZodString>;
|
|
142
|
+
}, z.core.$strict>>>;
|
|
143
|
+
queries: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
144
|
+
where: z.ZodString;
|
|
145
|
+
}, z.core.$strict>>>;
|
|
146
|
+
relations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
147
|
+
builtin: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
+
from: z.ZodArray<z.ZodString>;
|
|
149
|
+
to: z.ZodArray<z.ZodString>;
|
|
150
|
+
}, z.core.$strict>>>;
|
|
151
|
+
}, z.core.$strict>;
|
|
27
152
|
export type StoredQueryConfig = z.output<typeof stored_query_schema>;
|
|
28
153
|
export type DerivedSummaryScalar = z.output<typeof derived_summary_scalar_schema>;
|
|
29
154
|
export type DerivedSummaryCountConfig = z.output<typeof derived_summary_count_schema>;
|
|
@@ -35,19 +160,9 @@ export type FieldQueryConfig = z.output<typeof field_query_schema>;
|
|
|
35
160
|
export type MetadataFieldConfig = z.output<typeof metadata_field_schema>;
|
|
36
161
|
export type ClassFieldRuleConfig = z.output<typeof class_field_rule_schema>;
|
|
37
162
|
export type ClassSchemaConfig = z.output<typeof class_schema_schema>;
|
|
38
|
-
export type RepoClassConfig = z.output<typeof repo_class_definition_schema>;
|
|
39
163
|
export type PathClassConfig = z.output<typeof path_class_schema>;
|
|
40
164
|
export type PatramRepoConfig = z.output<typeof patram_repo_config_schema>;
|
|
41
165
|
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
166
|
/**
|
|
52
167
|
* @typedef {z.output<typeof stored_query_schema>} StoredQueryConfig
|
|
53
168
|
*/
|
|
@@ -216,169 +331,10 @@ declare const class_schema_schema: z.ZodObject<{
|
|
|
216
331
|
ignore: "ignore";
|
|
217
332
|
}>>;
|
|
218
333
|
}, 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
334
|
/**
|
|
244
335
|
* @typedef {z.output<typeof path_class_schema>} PathClassConfig
|
|
245
336
|
*/
|
|
246
337
|
declare const path_class_schema: z.ZodObject<{
|
|
247
338
|
prefixes: z.ZodArray<z.ZodString>;
|
|
248
339
|
}, 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
340
|
export {};
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/** @import * as $k$$l$patram$j$config$k$js from './patram-config.js'; */
|
|
2
|
+
/* eslint-disable max-lines */
|
|
3
|
+
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
class_definition_schema,
|
|
8
|
+
mapping_definition_schema,
|
|
9
|
+
relation_definition_schema,
|
|
10
|
+
} from './patram-config.js';
|
|
11
|
+
import { DEFAULT_INCLUDE_PATTERNS } from './source-file-defaults.js';
|
|
12
|
+
|
|
13
|
+
export const CONFIG_FILE_NAME = '.patram.json';
|
|
14
|
+
|
|
15
|
+
const RESERVED_STRUCTURAL_FIELD_NAMES = new Set(['$class', '$id', '$path']);
|
|
16
|
+
const MARKDOWN_STYLE_NAMES = [
|
|
17
|
+
'front_matter',
|
|
18
|
+
'visible_line',
|
|
19
|
+
'list_item',
|
|
20
|
+
'hidden_tag',
|
|
21
|
+
];
|
|
22
|
+
const MARKDOWN_STYLE_NAME_SET = new Set(MARKDOWN_STYLE_NAMES);
|
|
23
|
+
const MIXED_STYLE_VALUES = new Set(['ignore', 'error']);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {z.output<typeof stored_query_schema>} StoredQueryConfig
|
|
27
|
+
*/
|
|
28
|
+
const stored_query_schema = z
|
|
29
|
+
.object({
|
|
30
|
+
where: z.string().min(1, 'Stored query "where" must not be empty.'),
|
|
31
|
+
})
|
|
32
|
+
.strict();
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @typedef {z.output<typeof derived_summary_scalar_schema>} DerivedSummaryScalar
|
|
36
|
+
*/
|
|
37
|
+
const derived_summary_scalar_schema = z.union([
|
|
38
|
+
z.boolean(),
|
|
39
|
+
z.number(),
|
|
40
|
+
z.string(),
|
|
41
|
+
z.null(),
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @typedef {z.output<typeof derived_summary_count_schema>} DerivedSummaryCountConfig
|
|
46
|
+
*/
|
|
47
|
+
const derived_summary_count_schema = z
|
|
48
|
+
.object({
|
|
49
|
+
traversal: z
|
|
50
|
+
.string()
|
|
51
|
+
.min(1, 'Derived summary count "traversal" must not be empty.'),
|
|
52
|
+
where: z
|
|
53
|
+
.string()
|
|
54
|
+
.min(1, 'Derived summary count "where" must not be empty.'),
|
|
55
|
+
})
|
|
56
|
+
.strict();
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {z.output<typeof derived_summary_select_case_schema>} DerivedSummarySelectCaseConfig
|
|
60
|
+
*/
|
|
61
|
+
const derived_summary_select_case_schema = z
|
|
62
|
+
.object({
|
|
63
|
+
value: derived_summary_scalar_schema,
|
|
64
|
+
when: z.string().min(1, 'Derived summary select "when" must not be empty.'),
|
|
65
|
+
})
|
|
66
|
+
.strict();
|
|
67
|
+
|
|
68
|
+
const derived_summary_field_name_schema = z
|
|
69
|
+
.string()
|
|
70
|
+
.regex(
|
|
71
|
+
/^[a-z][a-z0-9_]*$/du,
|
|
72
|
+
'Derived summary field names must use lower_snake_case.',
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @typedef {z.output<typeof derived_summary_field_schema>} DerivedSummaryFieldConfig
|
|
77
|
+
*/
|
|
78
|
+
const derived_summary_count_field_schema = z
|
|
79
|
+
.object({
|
|
80
|
+
count: derived_summary_count_schema,
|
|
81
|
+
name: derived_summary_field_name_schema,
|
|
82
|
+
})
|
|
83
|
+
.strict();
|
|
84
|
+
|
|
85
|
+
const derived_summary_select_field_schema = z
|
|
86
|
+
.object({
|
|
87
|
+
default: derived_summary_scalar_schema,
|
|
88
|
+
name: derived_summary_field_name_schema,
|
|
89
|
+
select: z
|
|
90
|
+
.array(derived_summary_select_case_schema)
|
|
91
|
+
.min(1, 'Derived summary "select" must contain at least one case.'),
|
|
92
|
+
})
|
|
93
|
+
.strict();
|
|
94
|
+
|
|
95
|
+
const derived_summary_field_schema = z.union([
|
|
96
|
+
derived_summary_count_field_schema,
|
|
97
|
+
derived_summary_select_field_schema,
|
|
98
|
+
]);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @typedef {z.output<typeof derived_summary_schema>} DerivedSummaryConfig
|
|
102
|
+
*/
|
|
103
|
+
const derived_summary_schema = z
|
|
104
|
+
.object({
|
|
105
|
+
classes: z
|
|
106
|
+
.array(z.string().min(1))
|
|
107
|
+
.min(1, 'Derived summary "classes" must contain at least one class.'),
|
|
108
|
+
fields: z
|
|
109
|
+
.array(derived_summary_field_schema)
|
|
110
|
+
.min(1, 'Derived summary "fields" must contain at least one field.'),
|
|
111
|
+
})
|
|
112
|
+
.strict()
|
|
113
|
+
.superRefine(validateDerivedSummaryDefinition);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @typedef {z.output<typeof field_display_schema>} FieldDisplayConfig
|
|
117
|
+
*/
|
|
118
|
+
const field_display_schema = z
|
|
119
|
+
.object({
|
|
120
|
+
hidden: z.boolean().optional(),
|
|
121
|
+
order: z.number().optional(),
|
|
122
|
+
})
|
|
123
|
+
.strict();
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @typedef {z.output<typeof field_query_schema>} FieldQueryConfig
|
|
127
|
+
*/
|
|
128
|
+
const field_query_schema = z
|
|
129
|
+
.object({
|
|
130
|
+
contains: z.boolean().optional(),
|
|
131
|
+
prefix: z.boolean().optional(),
|
|
132
|
+
})
|
|
133
|
+
.strict();
|
|
134
|
+
|
|
135
|
+
const field_base_shape = {
|
|
136
|
+
display: field_display_schema.optional(),
|
|
137
|
+
multiple: z.boolean().optional(),
|
|
138
|
+
path_class: z.string().min(1).optional(),
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @typedef {z.output<typeof metadata_field_schema>} MetadataFieldConfig
|
|
143
|
+
*/
|
|
144
|
+
const metadata_field_schema = z.discriminatedUnion('type', [
|
|
145
|
+
z
|
|
146
|
+
.object({
|
|
147
|
+
...field_base_shape,
|
|
148
|
+
query: field_query_schema.optional(),
|
|
149
|
+
type: z.literal('string'),
|
|
150
|
+
})
|
|
151
|
+
.strict(),
|
|
152
|
+
z
|
|
153
|
+
.object({
|
|
154
|
+
...field_base_shape,
|
|
155
|
+
type: z.literal('integer'),
|
|
156
|
+
})
|
|
157
|
+
.strict(),
|
|
158
|
+
z
|
|
159
|
+
.object({
|
|
160
|
+
...field_base_shape,
|
|
161
|
+
type: z.literal('enum'),
|
|
162
|
+
values: z
|
|
163
|
+
.array(z.string().min(1, 'Field enum values must not be empty.'))
|
|
164
|
+
.min(1, 'Field enum values must contain at least one value.'),
|
|
165
|
+
})
|
|
166
|
+
.strict(),
|
|
167
|
+
z
|
|
168
|
+
.object({
|
|
169
|
+
...field_base_shape,
|
|
170
|
+
type: z.literal('path'),
|
|
171
|
+
})
|
|
172
|
+
.strict(),
|
|
173
|
+
z
|
|
174
|
+
.object({
|
|
175
|
+
...field_base_shape,
|
|
176
|
+
type: z.literal('glob'),
|
|
177
|
+
})
|
|
178
|
+
.strict(),
|
|
179
|
+
z
|
|
180
|
+
.object({
|
|
181
|
+
...field_base_shape,
|
|
182
|
+
type: z.literal('date'),
|
|
183
|
+
})
|
|
184
|
+
.strict(),
|
|
185
|
+
z
|
|
186
|
+
.object({
|
|
187
|
+
...field_base_shape,
|
|
188
|
+
type: z.literal('date_time'),
|
|
189
|
+
})
|
|
190
|
+
.strict(),
|
|
191
|
+
]);
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @typedef {z.output<typeof class_field_rule_schema>} ClassFieldRuleConfig
|
|
195
|
+
*/
|
|
196
|
+
const class_field_rule_schema = z
|
|
197
|
+
.object({
|
|
198
|
+
markdown_styles: z.array(z.string().min(1)).optional(),
|
|
199
|
+
presence: z.enum(['required', 'optional', 'forbidden']),
|
|
200
|
+
})
|
|
201
|
+
.strict();
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @typedef {z.output<typeof class_schema_schema>} ClassSchemaConfig
|
|
205
|
+
*/
|
|
206
|
+
const class_schema_schema = z
|
|
207
|
+
.object({
|
|
208
|
+
document_path_class: z.string().min(1).optional(),
|
|
209
|
+
fields: z.record(z.string().min(1), class_field_rule_schema).default({}),
|
|
210
|
+
markdown_styles: z.array(z.string().min(1)).optional(),
|
|
211
|
+
mixed_styles: z.string().min(1).optional(),
|
|
212
|
+
unknown_fields: z.enum(['ignore', 'error']).optional(),
|
|
213
|
+
})
|
|
214
|
+
.strict();
|
|
215
|
+
|
|
216
|
+
const repo_class_definition_schema = class_definition_schema.extend({
|
|
217
|
+
schema: class_schema_schema.optional(),
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @typedef {z.output<typeof path_class_schema>} PathClassConfig
|
|
222
|
+
*/
|
|
223
|
+
const path_class_schema = z
|
|
224
|
+
.object({
|
|
225
|
+
prefixes: z
|
|
226
|
+
.array(z.string().min(1, 'Path class prefixes must not be empty.'))
|
|
227
|
+
.min(1, 'Path classes must contain at least one prefix.'),
|
|
228
|
+
})
|
|
229
|
+
.strict();
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @typedef {z.output<typeof patram_repo_config_schema>} PatramRepoConfig
|
|
233
|
+
*/
|
|
234
|
+
export const patram_repo_config_schema = z
|
|
235
|
+
.object({
|
|
236
|
+
classes: z
|
|
237
|
+
.record(z.string().min(1), repo_class_definition_schema)
|
|
238
|
+
.optional(),
|
|
239
|
+
derived_summaries: z
|
|
240
|
+
.record(z.string().min(1), derived_summary_schema)
|
|
241
|
+
.optional(),
|
|
242
|
+
fields: z.record(z.string().min(1), metadata_field_schema).optional(),
|
|
243
|
+
include: z
|
|
244
|
+
.array(z.string().min(1, 'Include globs must not be empty.'))
|
|
245
|
+
.min(1, 'Include must contain at least one glob.')
|
|
246
|
+
.default(DEFAULT_INCLUDE_PATTERNS),
|
|
247
|
+
mappings: z.record(z.string().min(1), mapping_definition_schema).optional(),
|
|
248
|
+
path_classes: z.record(z.string().min(1), path_class_schema).optional(),
|
|
249
|
+
queries: z.record(z.string().min(1), stored_query_schema).default({}),
|
|
250
|
+
relations: z
|
|
251
|
+
.record(z.string().min(1), relation_definition_schema)
|
|
252
|
+
.optional(),
|
|
253
|
+
})
|
|
254
|
+
.strict()
|
|
255
|
+
.superRefine(validateFieldDefinitionKeys);
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* @param {{ fields?: Record<string, MetadataFieldConfig> }} repo_config
|
|
259
|
+
* @param {import('zod').RefinementCtx} refinement_context
|
|
260
|
+
*/
|
|
261
|
+
function validateFieldDefinitionKeys(repo_config, refinement_context) {
|
|
262
|
+
for (const field_name of Object.keys(repo_config.fields ?? {})) {
|
|
263
|
+
if (!field_name.startsWith('$')) {
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
refinement_context.addIssue({
|
|
268
|
+
code: 'custom',
|
|
269
|
+
message: 'Metadata field names must not start with "$".',
|
|
270
|
+
path: ['fields', field_name],
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @param {{ fields: Array<{ name: string }> }} summary_definition
|
|
277
|
+
* @param {import('zod').RefinementCtx} refinement_context
|
|
278
|
+
*/
|
|
279
|
+
function validateDerivedSummaryDefinition(
|
|
280
|
+
summary_definition,
|
|
281
|
+
refinement_context,
|
|
282
|
+
) {
|
|
283
|
+
const seen_field_names = new Set();
|
|
284
|
+
|
|
285
|
+
for (const [
|
|
286
|
+
field_index,
|
|
287
|
+
field_definition,
|
|
288
|
+
] of summary_definition.fields.entries()) {
|
|
289
|
+
if (!seen_field_names.has(field_definition.name)) {
|
|
290
|
+
seen_field_names.add(field_definition.name);
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
refinement_context.addIssue({
|
|
295
|
+
code: 'custom',
|
|
296
|
+
message: `Duplicate derived summary field "${field_definition.name}".`,
|
|
297
|
+
path: ['fields', field_index, 'name'],
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @param {string} field_name
|
|
304
|
+
* @returns {boolean}
|
|
305
|
+
*/
|
|
306
|
+
export function isReservedStructuralFieldName(field_name) {
|
|
307
|
+
return RESERVED_STRUCTURAL_FIELD_NAMES.has(field_name);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @param {string} markdown_style
|
|
312
|
+
* @returns {boolean}
|
|
313
|
+
*/
|
|
314
|
+
export function isKnownMarkdownStyle(markdown_style) {
|
|
315
|
+
return MARKDOWN_STYLE_NAME_SET.has(markdown_style);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* @param {string} mixed_styles
|
|
320
|
+
* @returns {boolean}
|
|
321
|
+
*/
|
|
322
|
+
export function isMixedStyleValue(mixed_styles) {
|
|
323
|
+
return MIXED_STYLE_VALUES.has(mixed_styles);
|
|
324
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const MARKDOWN_SOURCE_FILE_EXTENSIONS: string[];
|
|
2
2
|
export const YAML_SOURCE_FILE_EXTENSIONS: string[];
|
|
3
3
|
export const JSDOC_SOURCE_FILE_EXTENSIONS: string[];
|
|
4
|
-
export const SUPPORTED_SOURCE_FILE_EXTENSIONS: string[];
|
|
5
4
|
export const DEFAULT_INCLUDE_PATTERNS: string[];
|