yamlctl 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -7,7 +7,7 @@ Edit YAML files from the command line.
7
7
 
8
8
  ## Key
9
9
 
10
- - **Kubectl-like**: the verbs are kubectl's and behave like them, `create`, `apply`, `patch`, `replace`, `delete`, with the resource first, `yamlctl project create checkout_api name="Checkout API"`.
10
+ - **Kubectl-like**: the verbs are kubectl's and behave like them, `create`, `apply`, `patch`, `replace`, `delete`, with the resource first, `yamlctl projects create checkout_api name="Checkout API"`.
11
11
  - **Checked**: a field that does not exist, a value outside its allowed list, or a reference to a missing entry is refused, and the file is left as it was.
12
12
  - **Typed by the schema**: a string stays a file even if it looks like a number.
13
13
  - **Careful with the file**: comments, order and every entry not named stay exactly as they were, and a command changing nothing writes nothing.
@@ -45,18 +45,18 @@ projects:
45
45
 
46
46
  ```text
47
47
  $ yamlctl resources
48
- RESOURCE FILE MAP ENTRIES SCHEMA
49
- project project.yaml projects 2 schemas/project.schema.json
48
+ RESOURCE FILE ENTRIES SCHEMA
49
+ projects project.yaml 2 schemas/project.schema.json
50
50
 
51
- $ yamlctl project list
51
+ $ yamlctl projects list
52
52
  KEY NAME
53
53
  applications Applications
54
54
  checkout_api Checkout API
55
55
 
56
- $ yamlctl project create billing_api name="Billing API" parent_project=applications account=005217217997 risk_profile.business_impact=MBI
56
+ $ yamlctl projects create billing_api name="Billing API" parent_project=applications account=005217217997 risk_profile.business_impact=MBI
57
57
  projects/billing_api created
58
58
 
59
- $ yamlctl project get billing_api
59
+ $ yamlctl projects get billing_api
60
60
  billing_api:
61
61
  name: Billing API
62
62
  parent_project: applications
@@ -64,14 +64,14 @@ billing_api:
64
64
  risk_profile:
65
65
  business_impact: MBI
66
66
 
67
- $ yamlctl project apply billing_api name="Billing API"
67
+ $ yamlctl projects apply billing_api name="Billing API"
68
68
  projects/billing_api unchanged
69
69
  ```
70
70
 
71
71
  What the entries hold is read from the schema, the way `kubectl explain` reads an API:
72
72
 
73
73
  ```text
74
- $ yamlctl project explain
74
+ $ yamlctl projects explain
75
75
  RESOURCE: projects <object>
76
76
 
77
77
  FIELDS:
@@ -85,7 +85,7 @@ FIELDS:
85
85
  account_links <[]object> Cloud accounts whose resources belong to the project.
86
86
  tags <object> Free-form labels.
87
87
 
88
- $ yamlctl project explain risk_profile.business_impact
88
+ $ yamlctl projects explain risk_profile.business_impact
89
89
  FIELD: risk_profile.business_impact <enum>
90
90
 
91
91
  DESCRIPTION:
@@ -98,19 +98,19 @@ VALUES:
98
98
  And what does not fit is refused, with the file untouched and a non-zero exit status, so a pipeline stops on it:
99
99
 
100
100
  ```text
101
- $ yamlctl project patch billing_api risk_profle.business_impact=HBI
102
- error: risk_profle.business_impact: no such field in projects, run yamlctl project explain to list them
101
+ $ yamlctl projects patch billing_api risk_profle.business_impact=HBI
102
+ error: risk_profle.business_impact: no such field in projects, run yamlctl projects explain to list them
103
103
 
104
- $ yamlctl project patch billing_api risk_profile.business_impact=HIGH
104
+ $ yamlctl projects patch billing_api risk_profile.business_impact=HIGH
105
105
  projects/billing_api.risk_profile.business_impact: must be one of "LBI", "MBI", "HBI"
106
106
  error: projects/billing_api not written
107
107
 
108
- $ yamlctl project patch billing_api parent_project=checkout_api
108
+ $ yamlctl projects patch billing_api parent_project=checkout_api
109
109
  projects/billing_api: parent_project: checkout_api must have is_folder: true, it has null
110
110
  projects/billing_api: parent_project: changing "applications" to "checkout_api" needs --force, moving a project recreates it
111
111
  error: projects/billing_api not written
112
112
 
113
- $ yamlctl project delete applications
113
+ $ yamlctl projects delete applications
114
114
  error: projects/applications is still named by projects/checkout_api, projects/billing_api: delete or change them first
115
115
  ```
116
116
 
@@ -149,7 +149,7 @@ A command writing several entries checks them all against the file as it will be
149
149
  Option | Action
150
150
  ------------------------|-------------------------------------------------------------------------------------------------
151
151
  `-C, --dir <dir>` | the directory holding the data files, the current one by default
152
- `--data-file <file>` | the data file, for a resource the directory does not name on its own
152
+ `--data-file <file>` | the data file, for a map two files hold or a file whose name the directory does not use
153
153
  `-o, --output <format>` | `yaml`, `json` or `name`: the entries, or their resource paths, instead of a table or a sentence
154
154
  `-f, --filename <file>` | the entries to create, apply, replace or delete, `-` for standard input
155
155
  `--force` | accept a change the schema marks immutable
@@ -160,8 +160,10 @@ Option | Action
160
160
  `--offline` | read remote schemas from the cache only, never from the network, also `YAMLCTL_OFFLINE=1`
161
161
  `--refresh` | fetch remote schemas again even when the cache holds a recent copy
162
162
 
163
- A **resource** is a file, `project` for `project.yaml` or `project.yml`, or a map of entries inside one, `ignore_rules` for the `ignore_rules:` map of whichever file holds it.
164
- A file holding several maps is listed whole by its own name and reached one map at a time by the map's name.
163
+ A **resource** is a map of entries, `projects` for the `projects:` map, found in whichever file holds it.
164
+ It is never a file: `project.yaml` holding `projects:` is reached as `projects`, and `policy.yaml` holding `ignore_rules:` and `cicd_scan_policies:` as each of the two.
165
+ A resource is therefore named the same way whatever else its file holds, and keeps its name when a second map joins the file.
166
+ A map whose schema declares a `singular` is reached by that name too, `yamlctl project list`, as kubectl reaches `pods` as `pod`, while what is printed keeps the map's own name.
165
167
 
166
168
  A **field** inside an object is a path, `risk_profile.business_impact`.
167
169
  A list or an object is written as JSON, `account_links='[{"account": "123", "environment": "PRODUCTION"}]'`, and an empty value, `description=`, removes the field.
@@ -169,9 +171,9 @@ A list or an object is written as JSON, `account_links='[{"account": "123", "env
169
171
  A file given with **`-f`** holds entries under their keys, as YAML or JSON, the shape `get` and `list -o yaml` print, so the file itself can be edited and applied back:
170
172
 
171
173
  ```bash
172
- yamlctl project list -o yaml > projects.yaml
174
+ yamlctl projects list -o yaml > projects.yaml
173
175
  # edit projects.yaml
174
- yamlctl project apply -f projects.yaml
176
+ yamlctl projects apply -f projects.yaml
175
177
  ```
176
178
 
177
179
  `apply -f` merges each entry into the one already there, the way `kubectl apply` does: an object merges into the object it meets, a list replaces the list it meets, a field the file leaves out is kept, and a field set to `null` is removed.
@@ -225,11 +227,11 @@ Data goes to standard output, warnings and errors to standard error, and any ref
225
227
  `-o` turns what a command prints into data rather than a table or a sentence:
226
228
 
227
229
  ```text
228
- $ yamlctl project apply -f entries.yaml -o name
230
+ $ yamlctl projects apply -f entries.yaml -o name
229
231
  projects/app_1042
230
232
  projects/app_7
231
233
 
232
- $ yamlctl project patch app_7 name=Seven -o json
234
+ $ yamlctl projects patch app_7 name=Seven -o json
233
235
  {
234
236
  "app_7": {
235
237
  "name": "Seven",
@@ -259,7 +261,7 @@ A pipeline keeping a data file in step with another system runs four steps, typi
259
261
  ```bash
260
262
  # apps.json: [{"id": "1042", "name": "Checkout API", "account": "123456789012"}, ...]
261
263
  jq 'map({key: "app_\(.id)", value: {name, parent_project: "applications", account_links: [{account, environment: "PRODUCTION"}]}}) | from_entries' apps.json > entries.json
262
- yamlctl project apply -f entries.json --prune --prefix app_
264
+ yamlctl projects apply -f entries.json --prune --prefix app_
263
265
  yamlctl check
264
266
  ```
265
267
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yamlctl",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Read and edit YAML data files from the command line, entry by entry, every change checked against the file's JSON Schema",
5
5
  "keywords": [
6
6
  "yaml",
package/src/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // yamlctl <resource> <verb> [key] [field=value...] or -f <file>, and the few verbs that take no resource.
2
2
  //
3
- // The grammar is noun then verb, `yamlctl project list`, so every verb a resource has sits beside the others in the help and a new one lands in the same place.
3
+ // The grammar is noun then verb, `yamlctl projects list`, so every verb a resource has sits beside the others in the help and a new one lands in the same place.
4
4
  import { existsSync, readFileSync } from 'node:fs';
5
5
  import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
6
6
  import { pathToFileURL } from 'node:url';
@@ -32,7 +32,8 @@ Usage:
32
32
  yamlctl resources every resource in the directory
33
33
  yamlctl check every file in the directory against its schema
34
34
 
35
- A resource is a file, project for project.yaml or project.yml, or a map of entries inside one, found in whichever file holds it.
35
+ A resource is a map of entries, projects for the projects: map, found in whichever file holds it,
36
+ and also reached by the singular its schema declares, project, when it declares one.
36
37
  A field inside an object is a path, risk_profile.business_impact, and a list or an object is written as JSON.
37
38
  An empty value, description=, removes the field.
38
39
 
@@ -46,7 +47,7 @@ A remote schema, and every remote $ref, is fetched and cached for a day in ${cac
46
47
 
47
48
  Options:
48
49
  -C, --dir <dir> the directory holding the data files (default: the current directory)
49
- --data-file <file> the data file, for a resource the directory does not name on its own
50
+ --data-file <file> the data file, for a map two files hold or a file whose name the directory does not use
50
51
  -o, --output <fmt> yaml, json or name, for a pipeline: the entries, or their resource paths, instead of a table or a sentence
51
52
  -f, --filename <file> the entries to create, apply, replace or delete, - for standard input
52
53
  --force accept a change the schema marks immutable
@@ -60,11 +61,11 @@ Options:
60
61
  -v, --version the version
61
62
 
62
63
  Examples:
63
- yamlctl project create checkout_api name="Checkout API" risk_profile.business_impact=HBI
64
- yamlctl project patch checkout_api risk_profile.business_impact=MBI
65
- yamlctl project get checkout_api -o json
66
- yamlctl project list -o yaml > projects.yaml && yamlctl project apply -f projects.yaml
67
- yamlctl project explain risk_profile
64
+ yamlctl projects create checkout_api name="Checkout API" risk_profile.business_impact=HBI
65
+ yamlctl projects patch checkout_api risk_profile.business_impact=MBI
66
+ yamlctl projects get checkout_api -o json
67
+ yamlctl projects list -o yaml > projects.yaml && yamlctl projects apply -f projects.yaml
68
+ yamlctl projects explain risk_profile
68
69
  `;
69
70
 
70
71
  class UsageError extends Error {}
@@ -79,7 +80,7 @@ const WRITES = {
79
80
  };
80
81
  const VERBS = 'list, get, create, apply, patch, replace, delete, explain or check';
81
82
 
82
- // Options may come anywhere, before or after the resource, so `yamlctl -C data project list` and `yamlctl project list -C data` read the same.
83
+ // Options may come anywhere, before or after the resource, so `yamlctl -C data projects list` and `yamlctl projects list -C data` read the same.
83
84
  export function parseArgs(argv) {
84
85
  const options = { dir: '.', dataFile: null, output: null, filename: null, force: false, ignoreNotFound: false, prune: false, all: false, prefix: null, offline: false, refresh: false, help: false, version: false };
85
86
  const words = [];
@@ -231,13 +232,6 @@ const display = (path, cwd) => {
231
232
  return rel.startsWith('..') ? path : rel || basename(path);
232
233
  };
233
234
 
234
- // The one map a verb acting on an entry needs, refused with the names to use when the resource is a file holding several.
235
- function needMap(target, name) {
236
- if (target.map) return target.map;
237
- if (!target.maps.length) throw new Error(`${basename(target.file)} holds no map of entries`);
238
- throw new Error(`${basename(target.file)} holds several maps, use one as the resource: ${target.maps.map((map) => `yamlctl ${map} ...`).join(', ')}`);
239
- }
240
-
241
235
  function needKey(args, verb, orFile = false) {
242
236
  if (!args[0]) throw new UsageError(`${verb} needs the key of an entry${orFile ? ', or -f <file>' : ''}`);
243
237
  return args[0];
@@ -250,44 +244,39 @@ function printData(value, format, out) {
250
244
  function resources({ dir, options, out, cwd }) {
251
245
  const found = listResources(dir);
252
246
  if (options.output === 'name') {
253
- for (const r of found) out(`${r.name}\n`);
247
+ for (const r of found) if (r.name) out(`${r.name}\n`);
254
248
  return 0;
255
249
  }
256
250
  if (options.output) {
257
251
  printData(found.map((r) => ({ ...r, file: display(r.file, cwd), schema: r.schema ? display(r.schema, cwd) : null })), options.output, out);
258
252
  return 0;
259
253
  }
260
- const rows = found.map((r) => [r.name, display(r.file, cwd), r.map ?? '-', r.entries ?? '-', r.error ? `error: ${r.error}` : r.schema ? display(r.schema, cwd) : '-']);
261
- out(table(['RESOURCE', 'FILE', 'MAP', 'ENTRIES', 'SCHEMA'], rows));
254
+ const rows = found.map((r) => [r.name ?? '-', display(r.file, cwd), r.entries ?? '-', r.error ? `error: ${r.error}` : r.schema ? display(r.schema, cwd) : '-']);
255
+ out(table(['RESOURCE', 'FILE', 'ENTRIES', 'SCHEMA'], rows));
262
256
  return 0;
263
257
  }
264
258
 
265
259
  function list({ target, options, out }) {
266
- const maps = target.map ? [target.map] : target.maps;
267
- const data = target.document.data;
260
+ const { map } = target;
261
+ const entries = target.document.data[map] ?? {};
268
262
  if (options.output === 'json' || options.output === 'yaml') {
269
- const value = target.map ? (data[target.map] ?? {}) : Object.fromEntries(maps.map((map) => [map, data[map] ?? {}]));
270
- printData(value, options.output, out);
263
+ printData(entries, options.output, out);
271
264
  return 0;
272
265
  }
273
- for (const map of maps) {
274
- const entries = Object.entries(data[map] ?? {});
275
- if (options.output === 'name') {
276
- for (const [key] of entries) out(`${map}/${key}\n`);
277
- continue;
278
- }
279
- if (maps.length > 1) out(`${map}:\n`);
280
- const titleField = target.schema?.mapOptions(map).title ?? 'name';
281
- const titled = entries.some(([, entry]) => entry && typeof entry[titleField] === 'string');
282
- const header = titled ? ['KEY', titleField.toUpperCase()] : ['KEY'];
283
- const rows = entries.map(([key, entry]) => (titled ? [key, entry?.[titleField] ?? ''] : [key]));
284
- out(rows.length ? table(header, rows, maps.length > 1 ? ' ' : '') : `${maps.length > 1 ? ' ' : ''}no entries\n`);
266
+ if (options.output === 'name') {
267
+ for (const key of Object.keys(entries)) out(`${map}/${key}\n`);
268
+ return 0;
285
269
  }
270
+ const titleField = target.schema?.mapOptions(map).title ?? 'name';
271
+ const titled = Object.values(entries).some((entry) => entry && typeof entry[titleField] === 'string');
272
+ const header = titled ? ['KEY', titleField.toUpperCase()] : ['KEY'];
273
+ const rows = Object.entries(entries).map(([key, entry]) => (titled ? [key, entry?.[titleField] ?? ''] : [key]));
274
+ out(rows.length ? table(header, rows) : 'no entries\n');
286
275
  return 0;
287
276
  }
288
277
 
289
- function get({ target, name, args, options, out }) {
290
- const map = needMap(target, name);
278
+ function get({ target, args, options, out }) {
279
+ const { map } = target;
291
280
  needKey(args, 'get');
292
281
  const entries = target.document.data[map] ?? {};
293
282
  const found = {};
@@ -307,7 +296,7 @@ const REPLACE_USAGE = 'replace takes -f <file> only, patch takes <key> <field>=<
307
296
  function write(verb, context) {
308
297
  const { target, name, args, options, out, err, cwd } = context;
309
298
  const rules = WRITES[verb];
310
- const map = needMap(target, name);
299
+ const { map } = target;
311
300
  const { document, schema } = target;
312
301
  const entries = document.data[map] ?? {};
313
302
  let changes;
@@ -468,7 +457,7 @@ function parseLoose(text) {
468
457
  function remove(context) {
469
458
  const { target, name, args, options, out } = context;
470
459
  if (options.output && options.output !== 'name') throw new UsageError('delete takes -o name only');
471
- const map = needMap(target, name);
460
+ const { map } = target;
472
461
  let keys;
473
462
  if (options.filename) {
474
463
  if (args.length) throw new UsageError('delete takes -f <file> without a key');
@@ -496,8 +485,8 @@ function remove(context) {
496
485
  return 0;
497
486
  }
498
487
 
499
- function explainCommand({ target, name, args, out }) {
500
- const map = needMap(target, name);
488
+ function explainCommand({ target, args, out }) {
489
+ const { map } = target;
501
490
  if (!target.schema) throw new Error(`${basename(target.file)} has no schema to explain`);
502
491
  out(explain(target.schema, map, args[0] ? args[0].split('.') : []));
503
492
  return 0;
package/src/resources.js CHANGED
@@ -1,6 +1,8 @@
1
- // What a resource name on the command line points at: a file and the map of entries inside it.
1
+ // What a resource name on the command line points at: a map of entries, and the file holding it.
2
2
  //
3
- // `yamlctl project list` reads project.yaml, or project.yml, and `yamlctl ignore_rules list` reads whichever file holds a map of that name, so a file holding one map and a file holding several are both reached without naming anything twice.
3
+ // A resource is always a map and never a file, so `yamlctl projects list` reads the `projects:` map of whichever file holds it.
4
+ // Naming a file holding one map after its file instead made the same kind of thing singular in one place and plural in the next, and renamed it the day a second map joined the file.
5
+ // The singular is accepted as well, `yamlctl project list`, only where the schema declares it, the way kubectl reads `names.singular` off a resource rather than guessing at English.
4
6
  import { existsSync, readdirSync, statSync } from 'node:fs';
5
7
  import { basename, join } from 'node:path';
6
8
  import { readDocument } from './document.js';
@@ -28,7 +30,14 @@ export function openFile(file) {
28
30
  schemaError = `names ${displayUri(found.uri)}, which does not exist`;
29
31
  }
30
32
  const maps = schema ? schema.entryMaps() : mapsWithoutSchema(document.data);
31
- return { file, document, schema, schemaPath: schema ? schema.path : found.uri ? displayUri(found.uri) : null, schemaError, maps };
33
+ const singulars = Object.fromEntries(maps.map((map) => [map, schema?.mapOptions(map).singular]).filter(([, singular]) => typeof singular === 'string' && singular));
34
+ return { file, document, schema, schemaPath: schema ? schema.path : found.uri ? displayUri(found.uri) : null, schemaError, maps, singulars };
35
+ }
36
+
37
+ // The map a name on the command line means in one opened file: the map of that name, else the one declaring it as its singular.
38
+ function mapNamed(opened, name) {
39
+ if (opened.maps.includes(name)) return name;
40
+ return opened.maps.find((map) => opened.singulars[map] === name) ?? null;
32
41
  }
33
42
 
34
43
  // Without a schema, a map of entries is a mapping whose every value is itself a mapping, or empty: `servers: {web: {...}, db: {...}}`.
@@ -53,36 +62,35 @@ export function dataFiles(dir) {
53
62
  const stem = (file) => basename(file).replace(YAML, '');
54
63
 
55
64
  // The file and map a resource name points at.
56
- // `map` is null when the name is a file holding several maps, which `list` and `check` accept and the commands acting on one entry refuse, naming the maps to use instead.
57
65
  export function resolveResource({ dir, name, file = null }) {
58
66
  if (file) {
59
67
  const opened = openFile(file);
60
- if (name === stem(file) || name === basename(file)) return single(opened);
61
- if (opened.maps.includes(name)) return { ...opened, map: name };
68
+ const map = mapNamed(opened, name);
69
+ if (map) return { ...opened, map };
62
70
  throw new Error(`${file} holds no map ${name}, only ${opened.maps.join(', ') || 'none'}`);
63
71
  }
64
72
 
65
73
  const files = dataFiles(dir);
66
- const byStem = files.filter((path) => stem(path) === name);
67
- if (byStem.length > 1) throw new Error(`${byStem.map((path) => basename(path)).join(' and ')} both exist, name one with --data-file`);
68
- if (byStem.length === 1) return single(openFile(byStem[0]));
69
-
70
74
  const holding = [];
71
75
  for (const path of files) {
72
76
  const opened = openFile(path);
73
- if (opened.maps.includes(name)) holding.push({ ...opened, map: name });
77
+ const map = mapNamed(opened, name);
78
+ if (map) holding.push({ ...opened, map });
74
79
  }
75
80
  if (holding.length === 1) return holding[0];
76
81
  if (holding.length > 1) throw new Error(`${holding.map((h) => basename(h.file)).join(' and ')} both hold a map ${name}, name one with --data-file`);
77
- const known = listResources(dir).map((resource) => resource.name);
78
- throw new Error(`no resource ${name} in ${dir}${known.length ? `, the resources are ${known.join(', ')}` : ', which holds no YAML data file'}`);
79
- }
80
-
81
- function single(opened) {
82
- return { ...opened, map: opened.maps.length === 1 ? opened.maps[0] : null };
82
+ // A file name is the likeliest wrong guess, so it is answered with the maps it holds rather than with every resource of the directory.
83
+ const named = files.filter((path) => stem(path) === name || basename(path) === name);
84
+ if (named.length) {
85
+ const maps = [...new Set(named.flatMap((path) => openFile(path).maps))];
86
+ throw new Error(`${named.map((path) => basename(path)).join(' and ')} ${named.length > 1 ? 'are files' : 'is a file'} rather than a resource, ${maps.length ? `use ${maps.map((map) => `yamlctl ${map} ...`).join(', ')}` : 'and holds no map of entries'}`);
87
+ }
88
+ const known = listResources(dir).filter((resource) => resource.name).map((resource) => resource.name);
89
+ throw new Error(`no resource ${name} in ${dir}${known.length ? `, the resources are ${known.join(', ')}` : files.length ? ', which holds no map of entries' : ', which holds no YAML data file'}`);
83
90
  }
84
91
 
85
92
  // Every name the command line accepts, the way `kubectl api-resources` lists them.
93
+ // A file that cannot be read is listed with its error and no name, since hiding it would hide the resources it holds.
86
94
  export function listResources(dir) {
87
95
  const out = [];
88
96
  for (const path of dataFiles(dir)) {
@@ -90,16 +98,11 @@ export function listResources(dir) {
90
98
  try {
91
99
  opened = openFile(path);
92
100
  } catch (e) {
93
- out.push({ name: stem(path), file: path, map: null, entries: null, schema: null, error: e instanceof Error ? e.message : String(e) });
101
+ out.push({ name: null, singular: null, file: path, entries: null, schema: null, error: e instanceof Error ? e.message : String(e) });
94
102
  continue;
95
103
  }
96
104
  const schema = opened.schema ? opened.schemaPath : null;
97
- if (opened.maps.length === 1) {
98
- out.push({ name: stem(path), file: path, map: opened.maps[0], entries: count(opened, opened.maps[0]), schema });
99
- continue;
100
- }
101
- for (const map of opened.maps) out.push({ name: map, file: path, map, entries: count(opened, map), schema });
102
- if (!opened.maps.length) out.push({ name: stem(path), file: path, map: null, entries: 0, schema });
105
+ for (const map of opened.maps) out.push({ name: map, singular: opened.singulars[map] ?? null, file: path, entries: count(opened, map), schema });
103
106
  }
104
107
  return out;
105
108
  }