@lakeql/schema-generator 0.4.5 → 0.4.6
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/dist/endpoint-schema.d.mts +0 -1
- package/dist/graphql-schema.d.mts +3 -15
- package/dist/hive-table.d.mts +4 -15
- package/dist/json-schema.d.mts +1 -2
- package/package.json +7 -7
- package/dist/index-CGZiTFRE.d.mts +0 -140
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { JSONSchema7 } from "json-schema";
|
|
3
2
|
//#region src/graphql-schema.d.ts
|
|
4
3
|
interface CurrentModelResponse {
|
|
5
4
|
name: string;
|
|
@@ -64,13 +63,7 @@ declare function sanitizeFieldName(rawFieldName: string): string;
|
|
|
64
63
|
/**
|
|
65
64
|
* Generates a GraphQL model definition from JSON Schema.
|
|
66
65
|
*/
|
|
67
|
-
declare const generateModel: ({
|
|
68
|
-
source,
|
|
69
|
-
name,
|
|
70
|
-
parent,
|
|
71
|
-
models,
|
|
72
|
-
isRoot
|
|
73
|
-
}: GenerateModelProps) => Record<string, ModelResponse>;
|
|
66
|
+
declare const generateModel: ({ source, name, parent, models, isRoot }: GenerateModelProps) => Record<string, ModelResponse>;
|
|
74
67
|
/**
|
|
75
68
|
* Parameters for generateFieldDefinition.
|
|
76
69
|
*/
|
|
@@ -87,11 +80,6 @@ interface GenerateFieldDefinitionProps {
|
|
|
87
80
|
/**
|
|
88
81
|
* Generates field definitions for a single model property.
|
|
89
82
|
*/
|
|
90
|
-
declare const generateFieldDefinition: ({
|
|
91
|
-
fieldName,
|
|
92
|
-
rawFieldName,
|
|
93
|
-
fieldDefinition,
|
|
94
|
-
parent
|
|
95
|
-
}: GenerateFieldDefinitionProps) => FieldDefinitionResponse;
|
|
83
|
+
declare const generateFieldDefinition: ({ fieldName, rawFieldName, fieldDefinition, parent }: GenerateFieldDefinitionProps) => FieldDefinitionResponse;
|
|
96
84
|
//#endregion
|
|
97
85
|
export { CurrentModelResponse, FieldDefinitionResponse, FilterFieldInput, GenerateFieldDefinitionProps, GenerateModelProps, ModelResponse, generateFieldDefinition, generateModel, sanitizeFieldName };
|
package/dist/hive-table.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { JSONSchema7 } from "json-schema";
|
|
3
2
|
//#region src/hive-table.d.ts
|
|
4
3
|
type SqlFieldDefinition = [string, string];
|
|
5
4
|
interface SchemaDefinition {
|
|
@@ -23,9 +22,7 @@ interface GenerateSqlSchemaProps {
|
|
|
23
22
|
/**
|
|
24
23
|
* Generates SQL column definitions from parsed columns.
|
|
25
24
|
*/
|
|
26
|
-
declare function generateSqlSchema({
|
|
27
|
-
definition
|
|
28
|
-
}: GenerateSqlSchemaProps): SqlFieldDefinition[];
|
|
25
|
+
declare function generateSqlSchema({ definition }: GenerateSqlSchemaProps): SqlFieldDefinition[];
|
|
29
26
|
/**
|
|
30
27
|
* Parameters for parquetTransformer.
|
|
31
28
|
*/
|
|
@@ -36,9 +33,7 @@ interface ParquetTransformerProps {
|
|
|
36
33
|
/**
|
|
37
34
|
* Transforms column definitions for Parquet format.
|
|
38
35
|
*/
|
|
39
|
-
declare function parquetTransformer({
|
|
40
|
-
definition
|
|
41
|
-
}: ParquetTransformerProps): ParquetField;
|
|
36
|
+
declare function parquetTransformer({ definition }: ParquetTransformerProps): ParquetField;
|
|
42
37
|
/**
|
|
43
38
|
* Parameters for generateCreateTableStatement.
|
|
44
39
|
*/
|
|
@@ -57,12 +52,6 @@ interface GenerateCreateTableStatementProps {
|
|
|
57
52
|
/**
|
|
58
53
|
* Generates a full CREATE TABLE DDL statement.
|
|
59
54
|
*/
|
|
60
|
-
declare function generateCreateTableStatement({
|
|
61
|
-
schema,
|
|
62
|
-
tableName,
|
|
63
|
-
bucketName,
|
|
64
|
-
bucketPath,
|
|
65
|
-
definition
|
|
66
|
-
}: GenerateCreateTableStatementProps): string;
|
|
55
|
+
declare function generateCreateTableStatement({ schema, tableName, bucketName, bucketPath, definition }: GenerateCreateTableStatementProps): string;
|
|
67
56
|
//#endregion
|
|
68
57
|
export { GenerateCreateTableStatementProps, GenerateSqlSchemaProps, ParquetTransformerProps, generateCreateTableStatement, generateSqlSchema, parquetTransformer };
|
package/dist/json-schema.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FieldDefinition } from "./endpoint-schema.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { JSONSchema7 } from "json-schema";
|
|
3
3
|
import { JSONType } from "json-column-parser/lib/common/types/type.common";
|
|
4
|
-
|
|
5
4
|
//#region src/json-schema.d.ts
|
|
6
5
|
declare function generateJsonSchema(parsedColumns: Record<string, JSONType>): JSONSchema7;
|
|
7
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lakeql/schema-generator",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Generates GraphQL schemas, Hive table definitions, and JSON schemas from Trino metadata",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codegen",
|
|
@@ -51,21 +51,21 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"kysely": "0.29.
|
|
54
|
+
"kysely": "0.29.4",
|
|
55
55
|
"lodash-es": "4.18.1",
|
|
56
56
|
"magic-regexp": "0.11.0",
|
|
57
57
|
"zod": "4.4.3",
|
|
58
|
-
"@lakeql/helpers": "0.1.
|
|
58
|
+
"@lakeql/helpers": "0.1.7"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/json-schema": "7.0.15",
|
|
62
62
|
"@types/lodash-es": "4.17.12",
|
|
63
|
-
"@types/node": "24.13.
|
|
64
|
-
"fast-check": "^4.
|
|
63
|
+
"@types/node": "24.13.3",
|
|
64
|
+
"fast-check": "^4.9.0",
|
|
65
65
|
"json-column-parser": "2.0.0",
|
|
66
|
-
"tsdown": "0.22.
|
|
66
|
+
"tsdown": "0.22.13",
|
|
67
67
|
"typescript": "6.0.3",
|
|
68
|
-
"vitest": "4.1.
|
|
68
|
+
"vitest": "4.1.10",
|
|
69
69
|
"@lakeql/tsconfig": "0.1.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
|
|
2
|
-
// ==================================================================================================
|
|
3
|
-
// JSON Schema Draft 07
|
|
4
|
-
// ==================================================================================================
|
|
5
|
-
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
6
|
-
// --------------------------------------------------------------------------------------------------
|
|
7
|
-
/**
|
|
8
|
-
* Primitive type
|
|
9
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
10
|
-
*/
|
|
11
|
-
type JSONSchema7TypeName = "string" //
|
|
12
|
-
| "number" | "integer" | "boolean" | "object" | "array" | "null";
|
|
13
|
-
/**
|
|
14
|
-
* Primitive type
|
|
15
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
16
|
-
*/
|
|
17
|
-
type JSONSchema7Type = string //
|
|
18
|
-
| number | boolean | JSONSchema7Object | JSONSchema7Array | null;
|
|
19
|
-
// Workaround for infinite type recursion
|
|
20
|
-
interface JSONSchema7Object {
|
|
21
|
-
[key: string]: JSONSchema7Type;
|
|
22
|
-
}
|
|
23
|
-
// Workaround for infinite type recursion
|
|
24
|
-
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
25
|
-
interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
|
26
|
-
/**
|
|
27
|
-
* Meta schema
|
|
28
|
-
*
|
|
29
|
-
* Recommended values:
|
|
30
|
-
* - 'http://json-schema.org/schema#'
|
|
31
|
-
* - 'http://json-schema.org/hyper-schema#'
|
|
32
|
-
* - 'http://json-schema.org/draft-07/schema#'
|
|
33
|
-
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
34
|
-
*
|
|
35
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
36
|
-
*/
|
|
37
|
-
type JSONSchema7Version = string;
|
|
38
|
-
/**
|
|
39
|
-
* JSON Schema v7
|
|
40
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
41
|
-
*/
|
|
42
|
-
type JSONSchema7Definition = JSONSchema7 | boolean;
|
|
43
|
-
interface JSONSchema7 {
|
|
44
|
-
$id?: string | undefined;
|
|
45
|
-
$ref?: string | undefined;
|
|
46
|
-
$schema?: JSONSchema7Version | undefined;
|
|
47
|
-
$comment?: string | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
50
|
-
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
51
|
-
*/
|
|
52
|
-
$defs?: {
|
|
53
|
-
[key: string]: JSONSchema7Definition;
|
|
54
|
-
} | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
57
|
-
*/
|
|
58
|
-
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
59
|
-
enum?: JSONSchema7Type[] | undefined;
|
|
60
|
-
const?: JSONSchema7Type | undefined;
|
|
61
|
-
/**
|
|
62
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
63
|
-
*/
|
|
64
|
-
multipleOf?: number | undefined;
|
|
65
|
-
maximum?: number | undefined;
|
|
66
|
-
exclusiveMaximum?: number | undefined;
|
|
67
|
-
minimum?: number | undefined;
|
|
68
|
-
exclusiveMinimum?: number | undefined;
|
|
69
|
-
/**
|
|
70
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
71
|
-
*/
|
|
72
|
-
maxLength?: number | undefined;
|
|
73
|
-
minLength?: number | undefined;
|
|
74
|
-
pattern?: string | undefined;
|
|
75
|
-
/**
|
|
76
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
77
|
-
*/
|
|
78
|
-
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
79
|
-
additionalItems?: JSONSchema7Definition | undefined;
|
|
80
|
-
maxItems?: number | undefined;
|
|
81
|
-
minItems?: number | undefined;
|
|
82
|
-
uniqueItems?: boolean | undefined;
|
|
83
|
-
contains?: JSONSchema7Definition | undefined;
|
|
84
|
-
/**
|
|
85
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
86
|
-
*/
|
|
87
|
-
maxProperties?: number | undefined;
|
|
88
|
-
minProperties?: number | undefined;
|
|
89
|
-
required?: string[] | undefined;
|
|
90
|
-
properties?: {
|
|
91
|
-
[key: string]: JSONSchema7Definition;
|
|
92
|
-
} | undefined;
|
|
93
|
-
patternProperties?: {
|
|
94
|
-
[key: string]: JSONSchema7Definition;
|
|
95
|
-
} | undefined;
|
|
96
|
-
additionalProperties?: JSONSchema7Definition | undefined;
|
|
97
|
-
dependencies?: {
|
|
98
|
-
[key: string]: JSONSchema7Definition | string[];
|
|
99
|
-
} | undefined;
|
|
100
|
-
propertyNames?: JSONSchema7Definition | undefined;
|
|
101
|
-
/**
|
|
102
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
103
|
-
*/
|
|
104
|
-
if?: JSONSchema7Definition | undefined;
|
|
105
|
-
then?: JSONSchema7Definition | undefined;
|
|
106
|
-
else?: JSONSchema7Definition | undefined;
|
|
107
|
-
/**
|
|
108
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
109
|
-
*/
|
|
110
|
-
allOf?: JSONSchema7Definition[] | undefined;
|
|
111
|
-
anyOf?: JSONSchema7Definition[] | undefined;
|
|
112
|
-
oneOf?: JSONSchema7Definition[] | undefined;
|
|
113
|
-
not?: JSONSchema7Definition | undefined;
|
|
114
|
-
/**
|
|
115
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
116
|
-
*/
|
|
117
|
-
format?: string | undefined;
|
|
118
|
-
/**
|
|
119
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
120
|
-
*/
|
|
121
|
-
contentMediaType?: string | undefined;
|
|
122
|
-
contentEncoding?: string | undefined;
|
|
123
|
-
/**
|
|
124
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
125
|
-
*/
|
|
126
|
-
definitions?: {
|
|
127
|
-
[key: string]: JSONSchema7Definition;
|
|
128
|
-
} | undefined;
|
|
129
|
-
/**
|
|
130
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
131
|
-
*/
|
|
132
|
-
title?: string | undefined;
|
|
133
|
-
description?: string | undefined;
|
|
134
|
-
default?: JSONSchema7Type | undefined;
|
|
135
|
-
readOnly?: boolean | undefined;
|
|
136
|
-
writeOnly?: boolean | undefined;
|
|
137
|
-
examples?: JSONSchema7Type | undefined;
|
|
138
|
-
}
|
|
139
|
-
//#endregion
|
|
140
|
-
export { JSONSchema7 as t };
|