@kronor/dtv 9.3.0 → 9.4.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.
Files changed (38) hide show
  1. package/README.md +8 -2
  2. package/dist/cli/commands/definitions.js +76 -0
  3. package/dist/cli/config/loadConfig.js +69 -5
  4. package/dist/cli/definitions/discover.js +130 -0
  5. package/dist/cli/definitions/generate.js +258 -0
  6. package/dist/cli/definitions/loadProject.js +107 -0
  7. package/dist/cli/definitions/project.js +122 -0
  8. package/dist/cli/definitions/resolve.js +53 -0
  9. package/dist/cli/definitions/run.js +223 -0
  10. package/dist/cli/definitions/types.js +8 -0
  11. package/dist/cli/definitions/wire.js +111 -0
  12. package/dist/cli/dtv.js +2 -0
  13. package/dist/cli/typegen/runTypegen.js +4 -3
  14. package/dist/index.es.js +14103 -13451
  15. package/dist/types/components/UserPreferencesPanel.d.ts +2 -1
  16. package/dist/types/dsl/index.d.ts +1 -0
  17. package/dist/types/dsl/migrations.d.ts +114 -0
  18. package/dist/types/framework/decoder.d.ts +61 -0
  19. package/dist/types/framework/filter-form-state.d.ts +18 -2
  20. package/dist/types/framework/filter-sharing.d.ts +21 -9
  21. package/dist/types/framework/runtime.d.ts +2 -0
  22. package/dist/types/framework/saved-filters.d.ts +10 -14
  23. package/dist/types/framework/state/app-state.d.ts +8 -0
  24. package/dist/types/framework/useUserDataManager.d.ts +3 -0
  25. package/dist/types/framework/user-data-errors.d.ts +8 -0
  26. package/dist/types/framework/user-data-manager.d.ts +6 -1
  27. package/dist/types/framework/user-data-undecoded.d.ts +86 -0
  28. package/dist/types/framework/user-data.d.ts +120 -33
  29. package/dist/types/framework/user-data.migrations.d.ts +9 -8
  30. package/dist/types/framework/view-migrations.d.ts +112 -0
  31. package/dist/types/framework/view-parser.d.ts +2 -1
  32. package/dist/types/framework/view-projection.d.ts +52 -0
  33. package/dist/types/framework/view.d.ts +7 -0
  34. package/dist/types/lib/index.d.ts +4 -0
  35. package/dist/types/typegen/index.d.ts +26 -4
  36. package/docs/typegen.md +12 -0
  37. package/docs/view-migrations.md +182 -0
  38. package/package.json +1 -1
@@ -2,7 +2,7 @@ import * as path from 'node:path';
2
2
  import * as fs from 'node:fs/promises';
3
3
  import fg from 'fast-glob';
4
4
  import ts from 'typescript';
5
- import { loadConfig } from '../config/loadConfig.js';
5
+ import { loadConfig, resolveSchema } from '../config/loadConfig.js';
6
6
  import { collectReachableTypes, fetchSchema, renderTsFromSchema, singleQuoteStringLiteral, toIdentifier, toPascalCase, unwrapCollectionElementType, } from '@kronor/hasura-graphql/typegen';
7
7
  async function writeFileEnsuringDir(filePath, content) {
8
8
  await fs.mkdir(path.dirname(filePath), { recursive: true });
@@ -216,7 +216,7 @@ function findForeignRowTypes(viewArgObject, sourceFile, rowTypeConstName) {
216
216
  visit(viewArgObject);
217
217
  return found;
218
218
  }
219
- function findViewsInFile(sourceText, fileName, dtvImport, debug,
219
+ export function findViewsInFile(sourceText, fileName, dtvImport, debug,
220
220
  /** Called for a `DSL.view({ ... })` whose id or source is not a string literal. */
221
221
  onUnidentified) {
222
222
  const sourceFile = ts.createSourceFile(fileName, sourceText, ts.ScriptTarget.Latest, true);
@@ -487,7 +487,8 @@ export async function runTypegen(args) {
487
487
  throw new Error(`No view found with id ${JSON.stringify(args.onlyViewId)}. `
488
488
  + `Sample discovered view ids: ${sample.join(', ')}${sample.length === 25 ? ', ...' : ''}`);
489
489
  }
490
- const schema = await fetchSchema({ endpoint: config.schema.endpoint, headers: config.schema.headers ?? {} });
490
+ const schemaConfig = await resolveSchema(config);
491
+ const schema = await fetchSchema({ endpoint: schemaConfig.endpoint, headers: schemaConfig.headers ?? {} });
491
492
  const queryType = schema.getQueryType();
492
493
  if (!queryType)
493
494
  throw new Error('Schema has no Query type');