mnfst-types 0.1.11 → 0.1.13

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
@@ -20,27 +20,32 @@ This writes `manifest.d.ts` in the current directory. Re-run it whenever you add
20
20
  --init Also write a baseline jsconfig.json (only if missing)
21
21
  --ci Also write .github/workflows/types.yml (only if missing)
22
22
  --check Exit 1 if the output is out of date; write nothing
23
+ --tsc Type-check the scripts the page loads (paths from the import map)
23
24
  -h, --help Show usage
24
25
  ```
25
26
 
26
27
  ## Type checks without a build
27
28
 
28
- `--init` writes a `jsconfig.json` whose `paths` mirror the page's import map,
29
- so JSDoc-annotated app modules type-check with no build step:
30
-
31
29
  ```bash
32
- npx mnfst-types --init
33
- npx -p typescript@7 tsc -p jsconfig.json
30
+ npx mnfst-types --tsc
34
31
  ```
35
32
 
36
- `--ci` adds a GitHub Actions workflow running `mnfst-types --check` and `tsc`
37
- on every push. See https://manifestx.dev/docs/framework/getting-started/type-checks.
33
+ Type-checks the scripts `index.html` and the manifest's component files load
34
+ (and everything they import), plus the project's `.d.ts` files. The config is
35
+ built on every run: paths come from the page's import map, so adding an alias
36
+ never needs a config change. No folder layout is assumed. A project `jsconfig.json` or `tsconfig.json` is
37
+ extended — its own options and paths win.
38
+
39
+ `--init` writes a `jsconfig.json` so editors show the same errors as you type;
40
+ run it again after changing the import map to add new aliases to it. `--ci`
41
+ adds a GitHub Actions workflow running `--check` and `--tsc` on every push. See
42
+ https://manifestx.dev/docs/framework/getting-started/type-checks.
38
43
 
39
44
  ## How it works
40
45
 
41
46
  1. Reads `manifest.json` and walks each entry under `data`.
42
47
  2. For local CSV / JSON / YAML sources, samples the first ~50 rows to infer field types.
43
- 3. For Appwrite-table sources, types rows from the column names in the project's shared contract (manifest.json `contract`); `ManifestRows` overrides them with precise types.
48
+ 3. For Appwrite-table sources, rows accept any field until the project declares their type in `ManifestRows`.
44
49
  4. For Appwrite-bucket sources, types the source as `ManifestBucketSource`.
45
50
  5. Combines the inferred row types with the static ambient declarations and writes a single `manifest.d.ts`.
46
51
 
@@ -8,9 +8,11 @@
8
8
  // Re-running the CLI overwrites the augmentation block (between the
9
9
  // AUGMENTATION:start / AUGMENTATION:end markers in the template).
10
10
 
11
- import { readFileSync, writeFileSync, existsSync, statSync, mkdirSync } from 'node:fs';
11
+ import { readFileSync, writeFileSync, existsSync, statSync, mkdirSync, mkdtempSync, rmSync, realpathSync, readdirSync } from 'node:fs';
12
+ import { tmpdir } from 'node:os';
13
+ import { spawnSync } from 'node:child_process';
12
14
  import { dirname, join, resolve, isAbsolute, relative } from 'node:path';
13
- import { fileURLToPath, pathToFileURL } from 'node:url';
15
+ import { fileURLToPath } from 'node:url';
14
16
  import { createRequire } from 'node:module';
15
17
 
16
18
  const require = createRequire(import.meta.url);
@@ -45,26 +47,33 @@ export async function main(argv) {
45
47
  const output = applyAugmentation(template, augmentation);
46
48
 
47
49
  const outPath = resolve(cwd, opts.out);
50
+ const typesPath = relative(projectRoot, outPath).split('\\').join('/');
48
51
  if (opts.check) {
49
52
  const current = existsSync(outPath) ? readFileSync(outPath, 'utf8') : '';
50
53
  if (current !== output) {
51
54
  console.error(`mnfst-types: ${opts.out} is out of date with manifest.json — run \`npx mnfst-types\` and commit it`);
52
55
  process.exitCode = 1;
53
- return;
56
+ } else {
57
+ console.log(`mnfst-types: ${opts.out} is up to date`);
54
58
  }
55
- console.log(`mnfst-types: ${opts.out} is up to date`);
56
- return;
59
+ } else if (!opts.tsc) {
60
+ mkdirSync(dirname(outPath), { recursive: true });
61
+ writeFileSync(outPath, output);
62
+ console.log(`mnfst-types: wrote ${outPath}`);
57
63
  }
58
- writeFileSync(outPath, output);
59
- console.log(`mnfst-types: wrote ${outPath}`);
60
64
 
61
- const typesPath = relative(projectRoot, outPath).split('\\').join('/');
62
65
  if (opts.init) {
63
- writeOnce(join(projectRoot, 'jsconfig.json'), defaultJsconfig(typesPath, importMapPaths(projectRoot)));
66
+ const jsconfig = join(projectRoot, 'jsconfig.json');
67
+ if (existsSync(jsconfig)) syncJsconfigPaths(jsconfig, typesPath, importMapPaths(projectRoot));
68
+ else writeOnce(jsconfig, defaultJsconfig(typesPath, importMapPaths(projectRoot)));
64
69
  }
65
70
  if (opts.ci) {
66
71
  writeOnce(join(projectRoot, '.github', 'workflows', 'types.yml'), defaultWorkflow(typesPath));
67
72
  }
73
+ if (opts.tsc) {
74
+ const status = runTsc(projectRoot, typesPath, manifest);
75
+ if (status) process.exitCode = process.exitCode || status;
76
+ }
68
77
  }
69
78
 
70
79
  function writeOnce(path, content) {
@@ -87,6 +96,7 @@ function parseArgs(argv) {
87
96
  init: false,
88
97
  ci: false,
89
98
  check: false,
99
+ tsc: false,
90
100
  help: false
91
101
  };
92
102
  for (let i = 0; i < argv.length; i++) {
@@ -95,6 +105,7 @@ function parseArgs(argv) {
95
105
  else if (a === '--init') opts.init = true;
96
106
  else if (a === '--ci') opts.ci = true;
97
107
  else if (a === '--check') opts.check = true;
108
+ else if (a === '--tsc') opts.tsc = true;
98
109
  else if (a === '--manifest') opts.manifest = argv[++i];
99
110
  else if (a === '--out') opts.out = argv[++i];
100
111
  else if (a.startsWith('--manifest=')) opts.manifest = a.slice('--manifest='.length);
@@ -115,11 +126,14 @@ Options:
115
126
  --init Also write a baseline jsconfig.json (only if missing)
116
127
  --ci Also write .github/workflows/types.yml (only if missing)
117
128
  --check Exit 1 if the output file is out of date; write nothing
129
+ --tsc Type-check the scripts the page loads (and what they import)
130
+ plus the project's .d.ts files; import-map paths are read on
131
+ every run; extends your jsconfig/tsconfig if any
118
132
  -h, --help Show this message
119
133
  `);
120
134
  }
121
135
 
122
- // index.html's import map as jsconfig paths: "@app/": "/app/" → "@app/*": ["./app/*"]
136
+ // index.html's import map as jsconfig paths: "@x/": "/x/" → "@x/*": ["./x/*"]
123
137
  function importMapPaths(projectRoot) {
124
138
  const paths = {};
125
139
  let html = '';
@@ -137,21 +151,226 @@ function importMapPaths(projectRoot) {
137
151
  return paths;
138
152
  }
139
153
 
154
+ const COMPILER_DEFAULTS = {
155
+ target: 'es2022',
156
+ module: 'esnext',
157
+ moduleResolution: 'bundler',
158
+ checkJs: true,
159
+ allowJs: true,
160
+ noEmit: true,
161
+ strict: false,
162
+ skipLibCheck: true,
163
+ lib: ['es2022', 'dom', 'dom.iterable']
164
+ };
165
+ const SCRIPT_TAG = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
166
+ const SRC_ATTR = /(?:^|\s)src\s*=\s*["']([^"']+)["']/i;
167
+ const MODULE_TYPE = /(?:^|\s)type\s*=\s*["']?module["']?/i;
168
+
169
+ const inside = (root, file) => { const r = relative(root, file); return !!r && !r.startsWith('..') && !isAbsolute(r); };
170
+
171
+ // The page and manifest.json's component files (their markup lands in the page)
172
+ function pageSources(projectRoot, manifest) {
173
+ const pages = ['index.html', ...stringList(manifest.preloadedComponents), ...stringList(manifest.components)];
174
+ const out = [];
175
+ for (const page of pages) {
176
+ try { out.push({ page, html: readFileSync(resolve(projectRoot, page.replace(/^\/+/, '')), 'utf8').replace(/<!--[\s\S]*?-->/g, '') }); } catch { /* missing */ }
177
+ }
178
+ return out;
179
+ }
180
+
181
+ // A src as the browser resolves it: against the page document at the project root
182
+ function localScript(projectRoot, src) {
183
+ const clean = src.split(/[?#]/)[0];
184
+ if (!clean || /^[a-z][a-z0-9+.-]*:|^\/\//i.test(clean) || !/\.m?js$/i.test(clean) || /\.min\.m?js$/i.test(clean)) return null;
185
+ let pathname;
186
+ try { pathname = decodeURIComponent(new URL(clean, 'http://page/').pathname); } catch { return null; }
187
+ const file = resolve(projectRoot, pathname.replace(/^\/+/, ''));
188
+ return inside(projectRoot, file) && existsSync(file) ? file : null;
189
+ }
190
+
191
+ // Local scripts the page loads (tsc follows their imports), and inline module bodies
192
+ function scriptEntries(projectRoot, manifest) {
193
+ const files = new Set();
194
+ const inline = [];
195
+ for (const { page, html } of pageSources(projectRoot, manifest)) {
196
+ for (const [, attrs, body] of html.matchAll(SCRIPT_TAG)) {
197
+ const src = attrs.match(SRC_ATTR);
198
+ if (src) {
199
+ const file = localScript(projectRoot, src[1]);
200
+ if (file) files.add(file);
201
+ } else if (MODULE_TYPE.test(attrs) && body.trim()) {
202
+ inline.push({ page, body });
203
+ }
204
+ }
205
+ }
206
+ return { files: [...files], inline };
207
+ }
208
+
209
+ // Inline module copies for tsc: relative and root specifiers point at the files the page would load
210
+ function writeInlineModules(dir, projectRoot, inline) {
211
+ return inline.map(({ page, body }, i) => {
212
+ const fixed = body.replace(/(\bfrom\s*|\bimport\s*\(?\s*)(["'])(\.{1,2}\/|\/)([^"']*)\2/g,
213
+ (m, lead, q, start, rest) => lead + q + resolve(projectRoot, (start === '/' ? '' : start) + rest).split('\\').join('/') + q);
214
+ const file = join(dir, `inline-${i + 1}-${page.replace(/[^a-z0-9]+/gi, '-')}.mjs`);
215
+ writeFileSync(file, fixed);
216
+ return file;
217
+ });
218
+ }
219
+
220
+ // Every .d.ts in the project except dependencies, dot-folders and render output
221
+ function declarationFiles(projectRoot, manifest) {
222
+ const pre = manifest.render || manifest.prerender || {};
223
+ const output = resolve(projectRoot, typeof pre.output === 'string' ? pre.output : 'website');
224
+ const out = [];
225
+ const walk = (dir, depth) => {
226
+ if (depth > 8) return;
227
+ let entries;
228
+ try { entries = readdirSync(dir, { withFileTypes: true }); } catch { return; }
229
+ for (const e of entries) {
230
+ if (e.name.startsWith('.') || e.name === 'node_modules') continue;
231
+ const full = join(dir, e.name);
232
+ if (e.isDirectory()) { if (full !== output) walk(full, depth + 1); }
233
+ else if (e.name.endsWith('.d.ts')) out.push(full);
234
+ }
235
+ };
236
+ walk(projectRoot, 0);
237
+ return out;
238
+ }
239
+
240
+ function stringList(v) {
241
+ return Array.isArray(v) ? v.filter((x) => typeof x === 'string') : [];
242
+ }
243
+
244
+ // JSON with comments and trailing commas, as tsconfig allows; null when unreadable
245
+ function readJsonc(path) {
246
+ try {
247
+ const text = readFileSync(path, 'utf8')
248
+ .replace(/("(?:[^"\\]|\\.)*")|\/\/[^\n]*|\/\*[\s\S]*?\*\//g, (m, str) => str || '')
249
+ .replace(/,(\s*[}\]])/g, '$1');
250
+ return JSON.parse(text);
251
+ } catch { return null; }
252
+ }
253
+
254
+ // A config and its relative `extends` chain, nearest first: [{ file, config }]
255
+ function configChain(file) {
256
+ const chain = [];
257
+ const seen = new Set();
258
+ let current = file;
259
+ while (current && !seen.has(current) && existsSync(current)) {
260
+ seen.add(current);
261
+ const config = readJsonc(current);
262
+ chain.push({ file: current, config });
263
+ const ext = config && config.extends;
264
+ const next = Array.isArray(ext) ? ext[ext.length - 1] : ext;
265
+ if (typeof next !== 'string' || !/^\.{1,2}[\\/]/.test(next)) break;
266
+ current = resolve(dirname(current), next.endsWith('.json') ? next : next + '.json');
267
+ }
268
+ return chain;
269
+ }
270
+
271
+ // Effective paths: a config's `paths` replaces any inherited one, so the nearest wins outright
272
+ function chainPaths(chain) {
273
+ const hit = chain.find(({ config }) => config && config.compilerOptions && config.compilerOptions.paths);
274
+ if (!hit) return {};
275
+ const opts = hit.config.compilerOptions;
276
+ const base = opts.baseUrl ? resolve(dirname(hit.file), opts.baseUrl) : dirname(hit.file);
277
+ const out = {};
278
+ for (const [k, v] of Object.entries(opts.paths)) out[k] = (Array.isArray(v) ? v : [v]).map((x) => resolve(base, x));
279
+ return out;
280
+ }
281
+
282
+ // --init on an existing jsconfig: add import-map paths it lacks (plain JSON only)
283
+ function syncJsconfigPaths(path, types, aliases) {
284
+ const text = readFileSync(path, 'utf8');
285
+ let config;
286
+ try { config = JSON.parse(text); } catch {
287
+ console.log(`mnfst-types: ${path} isn't plain JSON (comments or trailing commas); add any new import-map aliases to its paths by hand (npx mnfst-types --tsc merges them anyway)`);
288
+ return;
289
+ }
290
+ const dir = dirname(path);
291
+ const inherited = chainPaths(configChain(path).slice(1));
292
+ const own = (config.compilerOptions ||= {}).paths;
293
+ const known = new Set(Object.keys(own || inherited));
294
+ const wanted = { mnfst: [`./${types}`], ...aliases };
295
+ const added = Object.keys(wanted).filter((k) => !known.has(k));
296
+ if (!added.length) {
297
+ console.log(`mnfst-types: ${path} already maps every import-map alias`);
298
+ return;
299
+ }
300
+ // A child `paths` replaces the base's, so carry inherited entries over
301
+ const paths = own || Object.fromEntries(Object.entries(inherited).map(([k, v]) => [k, v.map((t) => './' + relative(dir, t).split('\\').join('/'))]));
302
+ for (const k of added) paths[k] = wanted[k];
303
+ config.compilerOptions.paths = paths;
304
+ const indent = (text.match(/\n([ \t]+)"/) || [, ' '])[1];
305
+ writeFileSync(path, JSON.stringify(config, null, indent) + '\n');
306
+ console.log(`mnfst-types: added ${added.join(', ')} to ${path}`);
307
+ }
308
+
309
+ // tsc from the project, then next to mnfst-types, else npx
310
+ function findTsc(projectRoot) {
311
+ for (const from of [join(projectRoot, 'package.json'), fileURLToPath(import.meta.url)]) {
312
+ try {
313
+ const req = createRequire(from);
314
+ const pkgPath = req.resolve('typescript/package.json');
315
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
316
+ const bin = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin && pkg.bin.tsc;
317
+ if (bin) return { cmd: process.execPath, args: [join(dirname(pkgPath), bin)] };
318
+ } catch { /* next */ }
319
+ }
320
+ return { cmd: 'npx', args: ['-y', '-p', 'typescript@7', 'tsc'], shell: process.platform === 'win32' };
321
+ }
322
+
323
+ // Type-check with a config built now: import-map paths can't drift. A project
324
+ // jsconfig/tsconfig is extended, and its own paths win over the import map.
325
+ function runTsc(projectRoot, types, manifest = {}) {
326
+ const abs = (p) => resolve(projectRoot, p);
327
+ const own = ['tsconfig.json', 'jsconfig.json'].map((f) => join(projectRoot, f)).find((f) => existsSync(f));
328
+ const config = { compilerOptions: {} };
329
+ const entries = scriptEntries(projectRoot, manifest);
330
+ const typesFile = abs(types);
331
+ const dir = mkdtempSync(join(tmpdir(), 'mnfst-tsc-'));
332
+ const inputs = [...new Set([
333
+ ...entries.files,
334
+ ...writeInlineModules(dir, projectRoot, entries.inline),
335
+ ...declarationFiles(projectRoot, manifest),
336
+ ...(existsSync(typesFile) ? [typesFile] : [])
337
+ ])];
338
+ let paths = { mnfst: [abs(types)] };
339
+ for (const [k, v] of Object.entries(importMapPaths(projectRoot))) paths[k] = v.map(abs);
340
+ if (own) {
341
+ config.extends = own;
342
+ const chain = configChain(own);
343
+ if (!chain[0].config) console.warn(`mnfst-types: couldn't read ${own}; extending it with import-map paths only`);
344
+ paths = { ...paths, ...chainPaths(chain) };
345
+ if (!chain.some(({ config: c }) => c && (c.include || c.files))) config.files = inputs;
346
+ } else {
347
+ Object.assign(config.compilerOptions, COMPILER_DEFAULTS);
348
+ config.files = inputs;
349
+ }
350
+ if (config.files && !config.files.length) {
351
+ rmSync(dir, { recursive: true, force: true });
352
+ console.log('mnfst-types: no local scripts or .d.ts files to check');
353
+ return 0;
354
+ }
355
+ config.compilerOptions.paths = paths;
356
+ config.compilerOptions.noEmit = true;
357
+ const file = join(dir, 'tsconfig.json');
358
+ try {
359
+ writeFileSync(file, JSON.stringify(config, null, 2));
360
+ const { cmd, args, shell } = findTsc(projectRoot);
361
+ const r = spawnSync(cmd, [...args, '-p', shell ? `"${file}"` : file, '--pretty', 'false'], { cwd: realpathSync(projectRoot), stdio: 'inherit', shell: !!shell });
362
+ if (r.error) { console.error(`mnfst-types: couldn't run tsc (${r.error.message})`); return 2; }
363
+ if (r.status === 0) console.log('mnfst-types: no type errors');
364
+ return r.status ?? 1;
365
+ } finally {
366
+ rmSync(dir, { recursive: true, force: true });
367
+ }
368
+ }
369
+
370
+ // No include: editors check whatever is open; --tsc supplies its own inputs
140
371
  function defaultJsconfig(types, aliases = {}) {
141
372
  return JSON.stringify({
142
- compilerOptions: {
143
- target: 'es2022',
144
- module: 'esnext',
145
- moduleResolution: 'bundler',
146
- checkJs: true,
147
- allowJs: true,
148
- noEmit: true,
149
- strict: false,
150
- skipLibCheck: true,
151
- lib: ['es2022', 'dom', 'dom.iterable'],
152
- paths: { mnfst: [`./${types}`], ...aliases }
153
- },
154
- include: ['app/**/*', 'shared/**/*', types, '*.d.ts'],
373
+ compilerOptions: { ...COMPILER_DEFAULTS, paths: { mnfst: [`./${types}`], ...aliases } },
155
374
  exclude: ['node_modules', 'website']
156
375
  }, null, 4) + '\n';
157
376
  }
@@ -171,7 +390,7 @@ function defaultWorkflow(out) {
171
390
  ' with:',
172
391
  ' node-version: 22',
173
392
  ` - run: npx -y mnfst-types@latest --check --out ${out}`,
174
- ' - run: npx -y -p typescript@7 tsc -p jsconfig.json',
393
+ ` - run: npx -y -p typescript@7 -p mnfst-types@latest mnfst-types --tsc --out ${out}`,
175
394
  ''
176
395
  ].join('\n');
177
396
  }
@@ -215,12 +434,11 @@ async function buildAugmentation(manifest, projectRoot) {
215
434
  return '// No data sources declared in manifest.json.\nexport interface ManifestSources { [sourceName: string]: any }';
216
435
  }
217
436
 
218
- const contract = await loadContract(manifest, projectRoot);
219
437
  const sourceTypes = [];
220
438
  const augmentations = [];
221
439
 
222
440
  for (const [name, config] of Object.entries(data)) {
223
- const inferred = await inferSourceType(name, config, projectRoot, manifest, contract);
441
+ const inferred = await inferSourceType(name, config, projectRoot);
224
442
  if (!inferred) continue;
225
443
  sourceTypes.push(inferred.typeBlock);
226
444
  augmentations.push(` ${jsonKey(name)}: ${inferred.augmentationType};`);
@@ -243,38 +461,7 @@ async function buildAugmentation(manifest, projectRoot) {
243
461
  return lines.join('\n');
244
462
  }
245
463
 
246
- // The project's shared contract (manifest.json `contract`), for Appwrite column names
247
- async function loadContract(manifest, projectRoot) {
248
- const c = manifest.contract;
249
- const ref = c && typeof c === 'object' ? c.module : c;
250
- if (typeof ref !== 'string' || !ref) return null;
251
- const file = resolve(projectRoot, ref.replace(/^\/+/, ''));
252
- if (!existsSync(file)) {
253
- console.warn(`mnfst-types: contract ${ref} not found; Appwrite rows stay loose`);
254
- return null;
255
- }
256
- try {
257
- const mod = await import(`${pathToFileURL(file).href}?mtime=${statSync(file).mtimeMs}`);
258
- return mod && mod.tables && typeof mod.tables === 'object' ? mod.tables : null;
259
- } catch (e) {
260
- console.warn(`mnfst-types: contract ${ref} failed to load (${e.message}); Appwrite rows stay loose`);
261
- return null;
262
- }
263
- }
264
-
265
- function contractColumns(tables, manifest, config) {
266
- if (!tables) return null;
267
- const defaultDb = manifest.appwrite && (manifest.appwrite.databaseId || manifest.appwrite.database);
268
- const db = config.appwriteDatabaseId || defaultDb;
269
- const hit = Object.entries(tables).find(([key, t]) => t && (t.id || key) === config.appwriteTableId && (!t.database || !db || t.database === db));
270
- return hit && Array.isArray(hit[1].columns) ? { key: hit[0], columns: hit[1].columns.filter((c) => typeof c === 'string') } : null;
271
- }
272
-
273
- // ---------------------------------------------------------------------------
274
- // Source-shape inference
275
- // ---------------------------------------------------------------------------
276
-
277
- async function inferSourceType(name, config, projectRoot, manifest = {}, contract = null) {
464
+ async function inferSourceType(name, config, projectRoot) {
278
465
  const safeName = toTypeName(name);
279
466
 
280
467
  // Appwrite bucket (storage).
@@ -285,21 +472,13 @@ async function inferSourceType(name, config, projectRoot, manifest = {}, contrac
285
472
  };
286
473
  }
287
474
 
288
- // Appwrite table: column names from the contract when it declares the table.
475
+ // Appwrite table: any field until the project declares ManifestRows.<name>
289
476
  if (config && typeof config === 'object' && config.appwriteTableId) {
290
477
  const rowType = `Row_${safeName}`;
291
- const declared = contractColumns(contract, manifest, config);
292
- const typeBlock = declared
293
- ? [
294
- `/** Row shape for $x.${name}: columns of "${declared.key}" in the contract (declare ManifestRows.${name} for precise types). */`,
295
- `export type ${rowType} = ManifestRowSystem & {`,
296
- ...declared.columns.map((c) => ` ${jsonKey(c)}: any;`),
297
- `};`
298
- ].join('\n')
299
- : [
300
- `/** Row shape for $x.${name} (Appwrite table; add it to the contract, or declare ManifestRows.${name}, for checked columns). */`,
301
- `export type ${rowType} = ManifestRowSystem & { [field: string]: any };`
302
- ].join('\n');
478
+ const typeBlock = [
479
+ `/** Row shape for $x.${name} (Appwrite table; declare ManifestRows.${name} for checked fields). */`,
480
+ `export type ${rowType} = ManifestRowSystem & { [field: string]: any };`
481
+ ].join('\n');
303
482
  return {
304
483
  typeBlock,
305
484
  augmentationType: `ManifestTableSource<ManifestRowFor<${JSON.stringify(name)}, ${rowType}>>`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst-types",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Generate TypeScript types for a Manifest project from manifest.json and sample data",
5
5
  "type": "module",
6
6
  "bin": {
@@ -226,8 +226,8 @@ export type ManifestObjectSource<T> = T & ManifestSourceState;
226
226
  export type ManifestBucketSource = ReadonlyArray<ManifestFile> & ManifestSourceState & ManifestAppwriteBucketOps;
227
227
 
228
228
  /**
229
- * Precise row types, keyed by data source name. Declare them to override the
230
- * column names `npx mnfst-types` reads from the contract:
229
+ * Precise row types, keyed by data source name. Appwrite rows accept any
230
+ * field until declared here:
231
231
  *
232
232
  * declare module 'mnfst' { interface ManifestRows { tasks: Task } }
233
233
  */