@kronor/dtv 9.3.0 → 9.4.1
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 +8 -2
- package/dist/cli/commands/definitions.js +76 -0
- package/dist/cli/config/loadConfig.js +69 -5
- package/dist/cli/definitions/discover.js +130 -0
- package/dist/cli/definitions/generate.js +261 -0
- package/dist/cli/definitions/loadProject.js +107 -0
- package/dist/cli/definitions/project.js +122 -0
- package/dist/cli/definitions/resolve.js +53 -0
- package/dist/cli/definitions/run.js +223 -0
- package/dist/cli/definitions/types.js +8 -0
- package/dist/cli/definitions/wire.js +111 -0
- package/dist/cli/dtv.js +2 -0
- package/dist/cli/typegen/runTypegen.js +4 -3
- package/dist/index.es.js +14103 -13451
- package/dist/types/components/UserPreferencesPanel.d.ts +2 -1
- package/dist/types/dsl/index.d.ts +1 -0
- package/dist/types/dsl/migrations.d.ts +114 -0
- package/dist/types/framework/decoder.d.ts +61 -0
- package/dist/types/framework/filter-form-state.d.ts +18 -2
- package/dist/types/framework/filter-sharing.d.ts +21 -9
- package/dist/types/framework/runtime.d.ts +2 -0
- package/dist/types/framework/saved-filters.d.ts +10 -14
- package/dist/types/framework/state/app-state.d.ts +8 -0
- package/dist/types/framework/useUserDataManager.d.ts +3 -0
- package/dist/types/framework/user-data-errors.d.ts +8 -0
- package/dist/types/framework/user-data-manager.d.ts +6 -1
- package/dist/types/framework/user-data-undecoded.d.ts +86 -0
- package/dist/types/framework/user-data.d.ts +120 -33
- package/dist/types/framework/user-data.migrations.d.ts +9 -8
- package/dist/types/framework/view-migrations.d.ts +112 -0
- package/dist/types/framework/view-parser.d.ts +2 -1
- package/dist/types/framework/view-projection.d.ts +52 -0
- package/dist/types/framework/view.d.ts +7 -0
- package/dist/types/lib/index.d.ts +4 -0
- package/dist/types/typegen/index.d.ts +26 -4
- package/docs/typegen.md +12 -0
- package/docs/view-migrations.md +183 -0
- 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
|
|
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');
|