@lakeql/file-generator 0.1.0 → 0.1.2
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 +17 -0
- package/dist/config-registry.d.mts +12 -4
- package/dist/config.d.mts +20 -8
- package/dist/index.d.mts +14 -5
- package/dist/query-schema.d.mts +22 -9
- package/package.json +12 -4
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @lakeql/file-generator
|
|
2
|
+
|
|
3
|
+
Generates TypeScript source files (configs, interfaces, query schemas) from parsed table models using the TypeScript Compiler API.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @lakeql/file-generator
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
See the [LakeQL Documentation](https://lakeql.dev/docs) for detailed usage instructions.
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
[Apache-2.0](../../LICENSE)
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
|
|
3
3
|
//#region src/config-registry.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for generateConfigReqistry.
|
|
6
|
+
*/
|
|
7
|
+
interface GenerateConfigReqistryProps {
|
|
8
|
+
/** Relative paths to individual table config modules. */
|
|
9
|
+
configPaths: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Generates the config registry aggregating all table configs.
|
|
13
|
+
*/
|
|
4
14
|
declare function generateConfigReqistry({
|
|
5
15
|
configPaths
|
|
6
|
-
}:
|
|
7
|
-
configPaths: string[];
|
|
8
|
-
}): (ts.ImportDeclaration | ts.VariableStatement | ts.TypeAliasDeclaration)[];
|
|
16
|
+
}: GenerateConfigReqistryProps): (ts.VariableStatement | ts.ImportDeclaration | ts.TypeAliasDeclaration)[];
|
|
9
17
|
//#endregion
|
|
10
|
-
export { generateConfigReqistry };
|
|
18
|
+
export { GenerateConfigReqistryProps, generateConfigReqistry };
|
package/dist/config.d.mts
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
|
|
3
3
|
//#region src/config.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for generateConfig.
|
|
6
|
+
*/
|
|
7
|
+
interface GenerateConfigProps {
|
|
8
|
+
/** The Hive catalog name. */
|
|
9
|
+
catalog: string;
|
|
10
|
+
/** The Hive schema name. */
|
|
11
|
+
schema: string;
|
|
12
|
+
/** The Hive table name. */
|
|
13
|
+
tableName: string;
|
|
14
|
+
/** The GraphQL query name for this table. */
|
|
15
|
+
queryName: string;
|
|
16
|
+
/** Optional mutation names for this table endpoint. */
|
|
17
|
+
mutationName?: string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generates config.ts AST nodes for a table endpoint.
|
|
21
|
+
*/
|
|
4
22
|
declare function generateConfig({
|
|
5
23
|
catalog,
|
|
6
24
|
schema,
|
|
7
25
|
tableName,
|
|
8
26
|
queryName,
|
|
9
27
|
mutationName
|
|
10
|
-
}:
|
|
11
|
-
catalog: string;
|
|
12
|
-
schema: string;
|
|
13
|
-
tableName: string;
|
|
14
|
-
queryName: string;
|
|
15
|
-
mutationName?: string[];
|
|
16
|
-
}): ts.VariableStatement[];
|
|
28
|
+
}: GenerateConfigProps): ts.VariableStatement[];
|
|
17
29
|
//#endregion
|
|
18
|
-
export { generateConfig };
|
|
30
|
+
export { GenerateConfigProps, generateConfig };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
|
|
3
3
|
//#region src/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for generateCode.
|
|
6
|
+
*/
|
|
7
|
+
interface GenerateCodeProps {
|
|
8
|
+
/** The output file name for the generated source. */
|
|
9
|
+
fileName: string;
|
|
10
|
+
/** The TypeScript AST nodes to print and format. */
|
|
11
|
+
nodes: ts.Node[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generates formatted TypeScript source from AST nodes.
|
|
15
|
+
*/
|
|
4
16
|
declare function generateCode({
|
|
5
17
|
fileName,
|
|
6
18
|
nodes
|
|
7
|
-
}:
|
|
8
|
-
fileName: string;
|
|
9
|
-
nodes: ts.Node[];
|
|
10
|
-
}): Promise<ts.SourceFile>;
|
|
19
|
+
}: GenerateCodeProps): Promise<ts.SourceFile>;
|
|
11
20
|
//#endregion
|
|
12
|
-
export { generateCode };
|
|
21
|
+
export { GenerateCodeProps, generateCode };
|
package/dist/query-schema.d.mts
CHANGED
|
@@ -2,6 +2,26 @@ import ts from "typescript";
|
|
|
2
2
|
import { FilterFieldInput, ModelResponse } from "@lakeql/schema-generator/graphql-schema";
|
|
3
3
|
|
|
4
4
|
//#region src/query-schema.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for generateQuerySchema.
|
|
7
|
+
*/
|
|
8
|
+
interface GenerateQuerySchemaProps {
|
|
9
|
+
/** The model definitions keyed by model name. */
|
|
10
|
+
models: Record<string, ModelResponse>;
|
|
11
|
+
/** The GraphQL query name for this table. */
|
|
12
|
+
queryName: string;
|
|
13
|
+
/** Field name mappings for transformed fields (original to renamed). */
|
|
14
|
+
transformFields: string[][];
|
|
15
|
+
/** Filter field definitions for the query input. */
|
|
16
|
+
filterFields: FilterFieldInput[];
|
|
17
|
+
/** The GraphQL scalar types used in filters. */
|
|
18
|
+
filterTypes: string[];
|
|
19
|
+
/** Field names that contain date-time values. */
|
|
20
|
+
dateTimeFields: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Generates the Pothos query schema AST for a table.
|
|
24
|
+
*/
|
|
5
25
|
declare function generateQuerySchema({
|
|
6
26
|
models,
|
|
7
27
|
queryName,
|
|
@@ -9,13 +29,6 @@ declare function generateQuerySchema({
|
|
|
9
29
|
filterFields,
|
|
10
30
|
filterTypes,
|
|
11
31
|
dateTimeFields
|
|
12
|
-
}:
|
|
13
|
-
models: Record<string, ModelResponse>;
|
|
14
|
-
queryName: string;
|
|
15
|
-
transformFields: string[][];
|
|
16
|
-
filterFields: FilterFieldInput[];
|
|
17
|
-
filterTypes: string[];
|
|
18
|
-
dateTimeFields: string[];
|
|
19
|
-
}): ts.Node[];
|
|
32
|
+
}: GenerateQuerySchemaProps): ts.Node[];
|
|
20
33
|
//#endregion
|
|
21
|
-
export { generateQuerySchema };
|
|
34
|
+
export { GenerateQuerySchemaProps, generateQuerySchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lakeql/file-generator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Generates TypeScript source files from Trino table metadata",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ast",
|
|
7
|
+
"codegen",
|
|
8
|
+
"lakeql",
|
|
9
|
+
"trino",
|
|
10
|
+
"typescript"
|
|
11
|
+
],
|
|
4
12
|
"homepage": "https://lakeql.dev",
|
|
5
13
|
"license": "Apache-2.0",
|
|
6
14
|
"author": {
|
|
@@ -52,15 +60,15 @@
|
|
|
52
60
|
},
|
|
53
61
|
"dependencies": {
|
|
54
62
|
"typescript": "6.0.3",
|
|
55
|
-
"@lakeql/helpers": "0.1.
|
|
56
|
-
"@lakeql/schema-generator": "0.1.
|
|
63
|
+
"@lakeql/helpers": "0.1.2",
|
|
64
|
+
"@lakeql/schema-generator": "0.1.2"
|
|
57
65
|
},
|
|
58
66
|
"devDependencies": {
|
|
59
67
|
"@types/node": "24.13.2",
|
|
60
68
|
"lodash-es": "4.18.1",
|
|
61
69
|
"tsdown": "0.22.2",
|
|
62
70
|
"vitest": "4.1.8",
|
|
63
|
-
"@lakeql/column-parser": "0.1.
|
|
71
|
+
"@lakeql/column-parser": "0.1.2",
|
|
64
72
|
"@lakeql/tsconfig": "0.1.0"
|
|
65
73
|
},
|
|
66
74
|
"scripts": {
|