rawsql-ts 0.20.0 → 0.21.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.
- package/README.md +12 -13
- package/dist/esm/index.d.ts +1 -11
- package/dist/esm/index.js +1 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +3 -39
- package/dist/esm/index.min.js.map +3 -3
- package/dist/esm/transformers/DynamicQueryBuilder.d.ts +4 -27
- package/dist/esm/transformers/DynamicQueryBuilder.js +10 -27
- package/dist/esm/transformers/DynamicQueryBuilder.js.map +1 -1
- package/dist/esm/transformers/SSSQLFilterBuilder.js +2 -1
- package/dist/esm/transformers/SSSQLFilterBuilder.js.map +1 -1
- package/dist/esm/utils/SchemaManager.d.ts +3 -19
- package/dist/esm/utils/SchemaManager.js +2 -62
- package/dist/esm/utils/SchemaManager.js.map +1 -1
- package/dist/index.js +2 -18
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +3 -39
- package/dist/index.min.js.map +3 -3
- package/dist/src/index.d.ts +1 -11
- package/dist/src/transformers/DynamicQueryBuilder.d.ts +4 -27
- package/dist/src/utils/SchemaManager.d.ts +3 -19
- package/dist/transformers/DynamicQueryBuilder.js +10 -27
- package/dist/transformers/DynamicQueryBuilder.js.map +1 -1
- package/dist/transformers/SSSQLFilterBuilder.js +2 -1
- package/dist/transformers/SSSQLFilterBuilder.js.map +1 -1
- package/dist/tsconfig.browser.tsbuildinfo +1 -1
- package/dist/utils/SchemaManager.js +2 -63
- package/dist/utils/SchemaManager.js.map +1 -1
- package/package.json +10 -2
- package/dist/esm/transformers/EnhancedJsonMapping.d.ts +0 -194
- package/dist/esm/transformers/EnhancedJsonMapping.js +0 -217
- package/dist/esm/transformers/EnhancedJsonMapping.js.map +0 -1
- package/dist/esm/transformers/JsonMappingConverter.d.ts +0 -200
- package/dist/esm/transformers/JsonMappingConverter.js +0 -388
- package/dist/esm/transformers/JsonMappingConverter.js.map +0 -1
- package/dist/esm/transformers/JsonMappingUnifier.d.ts +0 -100
- package/dist/esm/transformers/JsonMappingUnifier.js +0 -207
- package/dist/esm/transformers/JsonMappingUnifier.js.map +0 -1
- package/dist/esm/transformers/ModelDrivenJsonMapping.d.ts +0 -62
- package/dist/esm/transformers/ModelDrivenJsonMapping.js +0 -115
- package/dist/esm/transformers/ModelDrivenJsonMapping.js.map +0 -1
- package/dist/esm/transformers/PostgresArrayEntityCteBuilder.d.ts +0 -138
- package/dist/esm/transformers/PostgresArrayEntityCteBuilder.js +0 -454
- package/dist/esm/transformers/PostgresArrayEntityCteBuilder.js.map +0 -1
- package/dist/esm/transformers/PostgresJsonQueryBuilder.d.ts +0 -88
- package/dist/esm/transformers/PostgresJsonQueryBuilder.js +0 -241
- package/dist/esm/transformers/PostgresJsonQueryBuilder.js.map +0 -1
- package/dist/esm/transformers/PostgresObjectEntityCteBuilder.d.ts +0 -165
- package/dist/esm/transformers/PostgresObjectEntityCteBuilder.js +0 -343
- package/dist/esm/transformers/PostgresObjectEntityCteBuilder.js.map +0 -1
- package/dist/esm/transformers/TypeTransformationPostProcessor.d.ts +0 -108
- package/dist/esm/transformers/TypeTransformationPostProcessor.js +0 -354
- package/dist/esm/transformers/TypeTransformationPostProcessor.js.map +0 -1
- package/dist/esm/utils/JsonSchemaValidator.d.ts +0 -81
- package/dist/esm/utils/JsonSchemaValidator.js +0 -211
- package/dist/esm/utils/JsonSchemaValidator.js.map +0 -1
- package/dist/src/transformers/EnhancedJsonMapping.d.ts +0 -194
- package/dist/src/transformers/JsonMappingConverter.d.ts +0 -200
- package/dist/src/transformers/JsonMappingUnifier.d.ts +0 -100
- package/dist/src/transformers/ModelDrivenJsonMapping.d.ts +0 -62
- package/dist/src/transformers/PostgresArrayEntityCteBuilder.d.ts +0 -138
- package/dist/src/transformers/PostgresJsonQueryBuilder.d.ts +0 -88
- package/dist/src/transformers/PostgresObjectEntityCteBuilder.d.ts +0 -165
- package/dist/src/transformers/TypeTransformationPostProcessor.d.ts +0 -108
- package/dist/src/utils/JsonSchemaValidator.d.ts +0 -81
- package/dist/transformers/EnhancedJsonMapping.js +0 -223
- package/dist/transformers/EnhancedJsonMapping.js.map +0 -1
- package/dist/transformers/JsonMappingConverter.js +0 -392
- package/dist/transformers/JsonMappingConverter.js.map +0 -1
- package/dist/transformers/JsonMappingUnifier.js +0 -216
- package/dist/transformers/JsonMappingUnifier.js.map +0 -1
- package/dist/transformers/ModelDrivenJsonMapping.js +0 -122
- package/dist/transformers/ModelDrivenJsonMapping.js.map +0 -1
- package/dist/transformers/PostgresArrayEntityCteBuilder.js +0 -458
- package/dist/transformers/PostgresArrayEntityCteBuilder.js.map +0 -1
- package/dist/transformers/PostgresJsonQueryBuilder.js +0 -245
- package/dist/transformers/PostgresJsonQueryBuilder.js.map +0 -1
- package/dist/transformers/PostgresObjectEntityCteBuilder.js +0 -347
- package/dist/transformers/PostgresObjectEntityCteBuilder.js.map +0 -1
- package/dist/transformers/TypeTransformationPostProcessor.js +0 -363
- package/dist/transformers/TypeTransformationPostProcessor.js.map +0 -1
- package/dist/utils/JsonSchemaValidator.js +0 -215
- package/dist/utils/JsonSchemaValidator.js.map +0 -1
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { SimpleSelectQuery } from '../models/SimpleSelectQuery';
|
|
2
|
-
import { SelectQuery } from '../models/SelectQuery';
|
|
3
|
-
import { QueryBuildOptions } from './DynamicQueryBuilder';
|
|
4
|
-
/**
|
|
5
|
-
* Universal JSON mapping definition for creating any level of JSON structures.
|
|
6
|
-
* Supports flat arrays, nested objects, and unlimited hierarchical structures.
|
|
7
|
-
*/
|
|
8
|
-
export interface JsonMapping {
|
|
9
|
-
rootName: string;
|
|
10
|
-
rootEntity: {
|
|
11
|
-
id: string;
|
|
12
|
-
name: string;
|
|
13
|
-
columns: {
|
|
14
|
-
[jsonKey: string]: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
nestedEntities: Array<{
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
parentId: string;
|
|
21
|
-
propertyName: string;
|
|
22
|
-
relationshipType?: "object" | "array";
|
|
23
|
-
columns: {
|
|
24
|
-
[jsonKey: string]: string;
|
|
25
|
-
};
|
|
26
|
-
}>;
|
|
27
|
-
resultFormat?: "array" | "single";
|
|
28
|
-
emptyResult?: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* PostgreSQL JSON query builder that transforms SimpleSelectQuery into queries
|
|
32
|
-
* that return JSON arrays or single JSON objects using PostgreSQL JSON functions.
|
|
33
|
-
*/
|
|
34
|
-
export declare class PostgresJsonQueryBuilder {
|
|
35
|
-
private selectValueCollector;
|
|
36
|
-
private objectEntityCteBuilder;
|
|
37
|
-
private arrayEntityCteBuilder;
|
|
38
|
-
constructor();
|
|
39
|
-
/**
|
|
40
|
-
* Validates the JSON mapping and the original query.
|
|
41
|
-
* @param query Original query to transform
|
|
42
|
-
* @param mapping JSON mapping configuration
|
|
43
|
-
*/
|
|
44
|
-
private validateMapping;
|
|
45
|
-
/**
|
|
46
|
-
* Build JSON query from original query and mapping configuration.
|
|
47
|
-
* @param originalQuery Original query to transform (can be any SelectQuery type)
|
|
48
|
-
* @param mapping JSON mapping configuration
|
|
49
|
-
* @returns Transformed query with JSON aggregation
|
|
50
|
-
*/
|
|
51
|
-
buildJsonQuery(originalQuery: SelectQuery, mapping: JsonMapping, options?: QueryBuildOptions): SimpleSelectQuery;
|
|
52
|
-
buildJsonQuery(originalQuery: SimpleSelectQuery, mapping: JsonMapping, options?: QueryBuildOptions): SimpleSelectQuery;
|
|
53
|
-
/**
|
|
54
|
-
* Build JSON query from original query and mapping configuration.
|
|
55
|
-
* @deprecated Use buildJsonQuery instead. This method will be removed in a future version.
|
|
56
|
-
* @param originalQuery Original query to transform
|
|
57
|
-
* @param mapping JSON mapping configuration
|
|
58
|
-
* @returns Transformed query with JSON aggregation
|
|
59
|
-
*/
|
|
60
|
-
buildJson(originalQuery: SimpleSelectQuery, mapping: JsonMapping): SimpleSelectQuery;
|
|
61
|
-
/**
|
|
62
|
-
* Builds the JSON structure using a unified CTE-based strategy.
|
|
63
|
-
* @param originalQuery Original query
|
|
64
|
-
* @param mapping JSON mapping configuration
|
|
65
|
-
* @returns Query with CTE-based JSON aggregation
|
|
66
|
-
*/
|
|
67
|
-
private buildJsonWithCteStrategy;
|
|
68
|
-
/**
|
|
69
|
-
* Creates the initial Common Table Expression (CTE) from the original query.
|
|
70
|
-
* @param originalQuery The base SimpleSelectQuery.
|
|
71
|
-
* @returns An object containing the initial CTE and its alias.
|
|
72
|
-
*/
|
|
73
|
-
private createInitialCte;
|
|
74
|
-
/**
|
|
75
|
-
* Builds the final SELECT query that constructs the root JSON object (or array of objects).
|
|
76
|
-
* This query uses all previously generated CTEs.
|
|
77
|
-
* @param finalCtesList The complete list of all CTEs (initial and array CTEs).
|
|
78
|
-
* @param lastCteAliasForFromClause Alias of the final CTE from which the root object will be built.
|
|
79
|
-
* @param allEntities Map of all processable entities.
|
|
80
|
-
* @param mapping JSON mapping configuration.
|
|
81
|
-
* @returns The final SimpleSelectQuery.
|
|
82
|
-
*/
|
|
83
|
-
private buildFinalSelectQuery;
|
|
84
|
-
/**
|
|
85
|
-
* Build JSON object for entity, using parent JSON columns when available
|
|
86
|
-
*/
|
|
87
|
-
private buildEntityJsonObject;
|
|
88
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { CommonTable } from '../models/Clause';
|
|
2
|
-
import { JsonMapping } from './PostgresJsonQueryBuilder';
|
|
3
|
-
/**
|
|
4
|
-
* Entity with processing metadata
|
|
5
|
-
*/
|
|
6
|
-
export interface ProcessableEntity {
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
columns: {
|
|
10
|
-
[jsonKey: string]: string;
|
|
11
|
-
};
|
|
12
|
-
isRoot: boolean;
|
|
13
|
-
propertyName: string;
|
|
14
|
-
parentId?: string;
|
|
15
|
-
relationshipType?: "object" | "array";
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* JSON column mapping information
|
|
19
|
-
*/
|
|
20
|
-
export interface JsonColumnMapping {
|
|
21
|
-
entityId: string;
|
|
22
|
-
entityName: string;
|
|
23
|
-
generatedColumnName: string;
|
|
24
|
-
depth: number;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Result from CTE builder including column mappings
|
|
28
|
-
*/
|
|
29
|
-
export interface CteBuilderResult {
|
|
30
|
-
ctes: CommonTable[];
|
|
31
|
-
lastCteAlias: string;
|
|
32
|
-
columnMappings: JsonColumnMapping[];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* PostgreSQL-specific builder for creating CTEs for object entities (object relationships).
|
|
36
|
-
* This class handles the creation of CTEs that build JSON/JSONB objects for object entities,
|
|
37
|
-
* processing them from the deepest level up to ensure proper dependency ordering.
|
|
38
|
-
*
|
|
39
|
-
* Features:
|
|
40
|
-
* - Depth-based CTE naming (cte_object_depth_N)
|
|
41
|
-
* - NULL handling for entity columns
|
|
42
|
-
* - JSONB/JSON object construction
|
|
43
|
-
* - Hierarchical processing of nested objects
|
|
44
|
-
*
|
|
45
|
-
* Why depth calculation is critical:
|
|
46
|
-
* 1. Object entities can be nested at multiple levels. We must process the deepest
|
|
47
|
-
* (most distant) objects first to ensure their JSON representations are available
|
|
48
|
-
* when building their parent entities.
|
|
49
|
-
* 2. Object entity processing is essentially a column compression operation. Entities
|
|
50
|
-
* at the same depth level can be processed simultaneously since they don't depend
|
|
51
|
-
* on each other.
|
|
52
|
-
*
|
|
53
|
-
* Example hierarchy:
|
|
54
|
-
* Order (root, depth 0)
|
|
55
|
-
* └─ Customer (depth 1)
|
|
56
|
-
* └─ Address (depth 2)
|
|
57
|
-
* └─ Shipping (depth 1)
|
|
58
|
-
* └─ Carrier (depth 2)
|
|
59
|
-
*
|
|
60
|
-
* Processing order: depth 2 → depth 1 → depth 0
|
|
61
|
-
*/
|
|
62
|
-
export declare class PostgresObjectEntityCteBuilder {
|
|
63
|
-
private static readonly CTE_OBJECT_PREFIX;
|
|
64
|
-
private static readonly WILDCARD_COLUMN;
|
|
65
|
-
private jsonColumnCounter;
|
|
66
|
-
private entityToJsonColumnMap;
|
|
67
|
-
private columnMappings;
|
|
68
|
-
/**
|
|
69
|
-
* Build CTEs for all object entities in the correct dependency order
|
|
70
|
-
* @param initialCte The starting CTE containing all raw data
|
|
71
|
-
* @param allEntities Map of all entities in the mapping
|
|
72
|
-
* @param mapping The JSON mapping configuration
|
|
73
|
-
* @returns Array of CTEs and the alias of the last CTE created
|
|
74
|
-
*/
|
|
75
|
-
buildObjectEntityCtes(initialCte: CommonTable, allEntities: Map<string, ProcessableEntity>, mapping: JsonMapping): CteBuilderResult;
|
|
76
|
-
/**
|
|
77
|
-
* Generate unique JSON column name with entity name and counter
|
|
78
|
-
*/
|
|
79
|
-
private generateUniqueJsonColumnName; /**
|
|
80
|
-
* Collect all object entities and calculate their depth from root.
|
|
81
|
-
*
|
|
82
|
-
* Depth calculation is crucial because:
|
|
83
|
-
* - It determines the processing order (deepest first)
|
|
84
|
-
* - It ensures dependencies are resolved before an entity is processed
|
|
85
|
-
* - It allows parallel processing of entities at the same depth level
|
|
86
|
-
*
|
|
87
|
-
* @param mapping The JSON mapping configuration
|
|
88
|
-
* @param allEntities Map of all entities in the mapping
|
|
89
|
-
* @returns Array of object entity information with calculated depths
|
|
90
|
-
*/
|
|
91
|
-
private collectAndSortObjectEntities;
|
|
92
|
-
/**
|
|
93
|
-
* Group entities by their depth level.
|
|
94
|
-
*
|
|
95
|
-
* Grouping by depth allows us to:
|
|
96
|
-
* - Process all entities at the same level in a single CTE
|
|
97
|
-
* - Optimize query performance by reducing the number of CTEs
|
|
98
|
-
* - Maintain clear dependency ordering
|
|
99
|
-
*
|
|
100
|
-
* @param parentInfos Array of parent entity information with depths
|
|
101
|
-
* @returns Map of depth level to entities at that depth
|
|
102
|
-
*/ private groupEntitiesByDepth;
|
|
103
|
-
/**
|
|
104
|
-
* Build a CTE that processes all entities at a specific depth level
|
|
105
|
-
*/
|
|
106
|
-
private buildDepthCte;
|
|
107
|
-
/**
|
|
108
|
-
* Build JSON column for a single entity with NULL handling
|
|
109
|
-
*/
|
|
110
|
-
private buildEntityJsonColumn;
|
|
111
|
-
/**
|
|
112
|
-
* Calculate approximate depth for an entity (for mapping purposes)
|
|
113
|
-
*/
|
|
114
|
-
private calculateApproximateDepth;
|
|
115
|
-
/**
|
|
116
|
-
* Prepare entity columns and NULL checks.
|
|
117
|
-
*
|
|
118
|
-
* This method extracts column data and creates NULL checks for each column.
|
|
119
|
-
* The NULL checking is essential for handling outer joins correctly.
|
|
120
|
-
*
|
|
121
|
-
* In outer join scenarios, when there's no matching row in the joined table,
|
|
122
|
-
* all columns from that table will be NULL. Instead of creating an empty object
|
|
123
|
-
* with all NULL properties (e.g., {id: null, name: null, email: null}),
|
|
124
|
-
* we want to represent the absence of the entity as NULL itself.
|
|
125
|
-
*
|
|
126
|
-
* This ensures cleaner JSON output where missing relationships are represented
|
|
127
|
-
* as NULL rather than objects with all NULL fields.
|
|
128
|
-
*
|
|
129
|
-
* @param entity The entity whose columns are being processed
|
|
130
|
-
* @returns Object containing arrays of JSON object arguments and NULL check conditions
|
|
131
|
-
*/
|
|
132
|
-
private prepareEntityColumns;
|
|
133
|
-
/**
|
|
134
|
-
* Add child object relationships to JSON object arguments.
|
|
135
|
-
*
|
|
136
|
-
* This method processes nested object-type entities that are direct children of the current entity.
|
|
137
|
-
* For each child entity, it adds the property name and corresponding JSON column reference
|
|
138
|
-
* to the arguments array that will be used to build the parent's JSON object.
|
|
139
|
-
*
|
|
140
|
-
* The child JSON columns are expected to already exist in the data source (created by deeper
|
|
141
|
-
* level CTEs), as we process from the deepest level up to the root.
|
|
142
|
-
*
|
|
143
|
-
* Note: In this context, "child" refers to entities that have an object relationship (0..1)
|
|
144
|
-
* with their parent. From a data perspective, these are typically entities referenced via
|
|
145
|
-
* foreign keys, representing "parent" entities in traditional database terminology.
|
|
146
|
-
*
|
|
147
|
-
* @param entity The current entity being processed
|
|
148
|
-
* @param jsonObjectArgs Array to which JSON object arguments will be added
|
|
149
|
-
* @param mapping The JSON mapping configuration
|
|
150
|
-
* @param allEntities Map of all entities in the mapping
|
|
151
|
-
*/
|
|
152
|
-
private addChildObjectRelationships;
|
|
153
|
-
/**
|
|
154
|
-
* Create JSON object function call
|
|
155
|
-
*/
|
|
156
|
-
private createJsonObject;
|
|
157
|
-
/**
|
|
158
|
-
* Build NULL condition from NULL checks
|
|
159
|
-
*/
|
|
160
|
-
private buildNullCondition;
|
|
161
|
-
/**
|
|
162
|
-
* Create CASE expression with NULL handling
|
|
163
|
-
*/
|
|
164
|
-
private createCaseExpression;
|
|
165
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Post-processor for transforming database values to appropriate TypeScript types
|
|
3
|
-
* after JSON serialization from PostgreSQL
|
|
4
|
-
*/
|
|
5
|
-
export interface TypeTransformationConfig {
|
|
6
|
-
/** Column transformations mapping - takes precedence over value-based detection */
|
|
7
|
-
columnTransformations?: {
|
|
8
|
-
[columnName: string]: TypeTransformation;
|
|
9
|
-
};
|
|
10
|
-
/** Global transformation rules by SQL data type */
|
|
11
|
-
globalTransformations?: {
|
|
12
|
-
[sqlType: string]: TypeTransformation;
|
|
13
|
-
};
|
|
14
|
-
/** Custom transformation functions */
|
|
15
|
-
customTransformers?: {
|
|
16
|
-
[transformerName: string]: (value: unknown) => unknown;
|
|
17
|
-
};
|
|
18
|
-
/** Enable value-based type detection when column mapping is not provided (default: true) */
|
|
19
|
-
enableValueBasedDetection?: boolean;
|
|
20
|
-
/** Strict date detection - only convert ISO 8601 with 'T' separator (default: false) */
|
|
21
|
-
strictDateDetection?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export interface TypeTransformation {
|
|
24
|
-
/** Source SQL data type */
|
|
25
|
-
sourceType: 'DATE' | 'TIMESTAMP' | 'BIGINT' | 'NUMERIC' | 'JSONB' | 'custom';
|
|
26
|
-
/** Target TypeScript type representation */
|
|
27
|
-
targetType: 'Date' | 'bigint' | 'string' | 'number' | 'object' | 'custom';
|
|
28
|
-
/** Custom transformer function name (for custom type) */
|
|
29
|
-
customTransformer?: string;
|
|
30
|
-
/** Whether to handle null values (default: true) */
|
|
31
|
-
handleNull?: boolean;
|
|
32
|
-
/** Validation function for the value */
|
|
33
|
-
validator?: (value: unknown) => boolean;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Applies type transformations to JSON results from PostgreSQL
|
|
37
|
-
*/
|
|
38
|
-
export declare class TypeTransformationPostProcessor {
|
|
39
|
-
private config;
|
|
40
|
-
constructor(config?: TypeTransformationConfig);
|
|
41
|
-
/**
|
|
42
|
-
* Transform a single result object
|
|
43
|
-
* @param result The result object from PostgreSQL JSON query
|
|
44
|
-
* @returns Transformed result with proper TypeScript types
|
|
45
|
-
*/
|
|
46
|
-
transformResult<T = unknown>(result: unknown): T;
|
|
47
|
-
/**
|
|
48
|
-
* Transform a single object recursively
|
|
49
|
-
*/
|
|
50
|
-
private transformSingleObject;
|
|
51
|
-
/**
|
|
52
|
-
* Detect value type and create appropriate transformation based on value characteristics
|
|
53
|
-
* This is the core value-based detection logic
|
|
54
|
-
*/
|
|
55
|
-
private detectValueBasedTransformation;
|
|
56
|
-
/**
|
|
57
|
-
* Get global transformation for a specific value (if any match)
|
|
58
|
-
* This is separate from value-based detection and relies on configured global rules
|
|
59
|
-
*/
|
|
60
|
-
private getGlobalTransformationForValue;
|
|
61
|
-
/**
|
|
62
|
-
* @deprecated Use detectValueBasedTransformation instead
|
|
63
|
-
* Detect value type and get appropriate global transformation
|
|
64
|
-
*/
|
|
65
|
-
private detectAndGetGlobalTransformation;
|
|
66
|
-
/**
|
|
67
|
-
* Check if string is a valid date string
|
|
68
|
-
* Supports both strict (ISO 8601 with T separator) and loose detection
|
|
69
|
-
*/
|
|
70
|
-
private isDateString;
|
|
71
|
-
/**
|
|
72
|
-
* Apply a specific transformation to a value
|
|
73
|
-
*/
|
|
74
|
-
private applyTransformation;
|
|
75
|
-
/**
|
|
76
|
-
* Create a default configuration for common PostgreSQL types
|
|
77
|
-
* Enables value-based detection with loose date detection by default
|
|
78
|
-
*/
|
|
79
|
-
static createDefaultConfig(): TypeTransformationConfig;
|
|
80
|
-
/**
|
|
81
|
-
* Create a safe configuration for handling user input
|
|
82
|
-
* Disables value-based detection and uses strict date detection
|
|
83
|
-
*/
|
|
84
|
-
static createSafeConfig(columnMappings?: {
|
|
85
|
-
[columnName: string]: TypeTransformation;
|
|
86
|
-
}): TypeTransformationConfig;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Convenience function to create and apply transformations
|
|
90
|
-
*/
|
|
91
|
-
export declare function transformDatabaseResult<T = unknown>(result: unknown, config?: TypeTransformationConfig): T;
|
|
92
|
-
/**
|
|
93
|
-
* Type-safe transformation helpers
|
|
94
|
-
*/
|
|
95
|
-
export declare const TypeTransformers: {
|
|
96
|
-
/**
|
|
97
|
-
* Transform date string to Date object
|
|
98
|
-
*/
|
|
99
|
-
toDate: (value: string | null) => Date | null;
|
|
100
|
-
/**
|
|
101
|
-
* Transform numeric string to BigInt
|
|
102
|
-
*/
|
|
103
|
-
toBigInt: (value: string | number | null) => bigint | null;
|
|
104
|
-
/**
|
|
105
|
-
* Transform JSON string to object
|
|
106
|
-
*/
|
|
107
|
-
toObject: <T = unknown>(value: string | null) => T | null;
|
|
108
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { JsonMapping } from '../transformers/PostgresJsonQueryBuilder';
|
|
2
|
-
/**
|
|
3
|
-
* Represents the structure extracted from JsonMapping analysis
|
|
4
|
-
*/
|
|
5
|
-
export type ExtractedStructure = 'primitive' | {
|
|
6
|
-
[key: string]: ExtractedStructure;
|
|
7
|
-
} | ExtractedStructure[];
|
|
8
|
-
/**
|
|
9
|
-
* Represents the expected type structure for validation
|
|
10
|
-
*/
|
|
11
|
-
export type ExpectedTypeStructure = 'primitive' | {
|
|
12
|
-
[key: string]: ExpectedTypeStructure;
|
|
13
|
-
} | ExpectedTypeStructure[];
|
|
14
|
-
/**
|
|
15
|
-
* Result of JsonMapping validation
|
|
16
|
-
*/
|
|
17
|
-
export interface ValidationResult {
|
|
18
|
-
isValid: boolean;
|
|
19
|
-
errors: string[];
|
|
20
|
-
missingProperties: string[];
|
|
21
|
-
extraProperties: string[];
|
|
22
|
-
}
|
|
23
|
-
export declare class JsonSchemaValidator {
|
|
24
|
-
/**
|
|
25
|
-
* Validates JsonMapping structure against an expected type structure.
|
|
26
|
-
* Checks if the JsonMapping covers all required properties and relationships.
|
|
27
|
-
*
|
|
28
|
-
* @param jsonMapping The JsonMapping configuration to validate
|
|
29
|
-
* @param expectedStructure The expected type structure to validate against
|
|
30
|
-
* @returns ValidationResult containing validation status and detailed errors
|
|
31
|
-
*/
|
|
32
|
-
static validate(jsonMapping: JsonMapping, expectedStructure: ExpectedTypeStructure): ValidationResult;
|
|
33
|
-
/**
|
|
34
|
-
* Validates JsonMapping structure and throws an error if validation fails.
|
|
35
|
-
* Convenience method for strict validation scenarios.
|
|
36
|
-
*
|
|
37
|
-
* @param jsonMapping The JsonMapping configuration to validate
|
|
38
|
-
* @param expectedStructure The expected type structure to validate against
|
|
39
|
-
* @throws Error if validation fails with detailed error messages
|
|
40
|
-
*/
|
|
41
|
-
static validateStrict(jsonMapping: JsonMapping, expectedStructure: ExpectedTypeStructure): void;
|
|
42
|
-
/**
|
|
43
|
-
* Extracts structure information from JsonMapping configuration.
|
|
44
|
-
* Analyzes rootEntity and nestedEntities to build complete structure map.
|
|
45
|
-
*
|
|
46
|
-
* @param jsonMapping The JsonMapping to analyze
|
|
47
|
-
* @returns ExtractedStructure representing the mapping structure
|
|
48
|
-
*/
|
|
49
|
-
private static extractStructureFromJsonMapping; /**
|
|
50
|
-
* Extracts structure from a nested entity, including its children.
|
|
51
|
-
*/
|
|
52
|
-
private static extractNestedEntityStructure; /**
|
|
53
|
-
* Compares extracted structure with expected structure with proper type guards.
|
|
54
|
-
*/
|
|
55
|
-
private static compareStructures;
|
|
56
|
-
/**
|
|
57
|
-
* Validates JsonMapping structure against a sample object that implements the expected type.
|
|
58
|
-
* This method extracts structure from the sample object and compares it with JsonMapping.
|
|
59
|
-
*
|
|
60
|
-
* @param jsonMapping The JsonMapping configuration to validate
|
|
61
|
-
* @param sampleObject A sample object that implements the expected interface/type
|
|
62
|
-
* @returns ValidationResult containing validation status and detailed errors
|
|
63
|
-
*/
|
|
64
|
-
static validateAgainstSample<T>(jsonMapping: JsonMapping, sampleObject: T): ValidationResult;
|
|
65
|
-
/**
|
|
66
|
-
* Validates JsonMapping structure against a sample object and throws an error if validation fails.
|
|
67
|
-
* Convenience method for strict validation scenarios with sample objects.
|
|
68
|
-
*
|
|
69
|
-
* @param jsonMapping The JsonMapping configuration to validate
|
|
70
|
-
* @param sampleObject A sample object that implements the expected interface/type
|
|
71
|
-
* @throws Error if validation fails with detailed error messages
|
|
72
|
-
*/
|
|
73
|
-
static validateAgainstSampleStrict<T>(jsonMapping: JsonMapping, sampleObject: T): void; /**
|
|
74
|
-
* Extracts structure information from a sample object.
|
|
75
|
-
* Recursively analyzes the object properties to build a structure map.
|
|
76
|
-
*
|
|
77
|
-
* @param sampleObject The sample object to analyze
|
|
78
|
-
* @returns ExpectedTypeStructure representing the object structure
|
|
79
|
-
*/
|
|
80
|
-
private static extractStructureFromSample;
|
|
81
|
-
}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Enhanced JSON mapping structure that extends the base JsonMapping interface
|
|
4
|
-
* with additional metadata and type safety features.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.convertColumnsToLegacy = convertColumnsToLegacy;
|
|
8
|
-
exports.convertToLegacyJsonMapping = convertToLegacyJsonMapping;
|
|
9
|
-
exports.toLegacyMapping = toLegacyMapping;
|
|
10
|
-
exports.extractTypeProtection = extractTypeProtection;
|
|
11
|
-
/**
|
|
12
|
-
* Converts enhanced column configurations to simple string mappings for legacy compatibility.
|
|
13
|
-
*
|
|
14
|
-
* This function transforms complex column configurations (with type info, nullable flags, etc.)
|
|
15
|
-
* into simple string mappings that can be used with PostgresJsonQueryBuilder.
|
|
16
|
-
*
|
|
17
|
-
* **Supported Input Formats:**
|
|
18
|
-
* - Simple strings: `"user_name"` → `"user_name"`
|
|
19
|
-
* - Column config: `{ column: "u.name", type: "string" }` → `"u.name"`
|
|
20
|
-
* - From config: `{ from: "user_name", nullable: true }` → `"user_name"`
|
|
21
|
-
*
|
|
22
|
-
* @param columns - Record of field names to column configurations
|
|
23
|
-
* @returns Record of field names to column source strings
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```typescript
|
|
27
|
-
* const enhanced = {
|
|
28
|
-
* id: { column: "u.user_id", type: "number" },
|
|
29
|
-
* name: { from: "user_name", type: "string" },
|
|
30
|
-
* email: "email_address"
|
|
31
|
-
* };
|
|
32
|
-
*
|
|
33
|
-
* const legacy = convertColumnsToLegacy(enhanced);
|
|
34
|
-
* // Result: { id: "u.user_id", name: "user_name", email: "email_address" }
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
function convertColumnsToLegacy(columns) {
|
|
38
|
-
const result = {};
|
|
39
|
-
for (const [key, config] of Object.entries(columns)) {
|
|
40
|
-
if (typeof config === 'string') {
|
|
41
|
-
result[key] = config;
|
|
42
|
-
}
|
|
43
|
-
else if (config && typeof config === 'object') {
|
|
44
|
-
if ('column' in config) {
|
|
45
|
-
result[key] = config.column;
|
|
46
|
-
}
|
|
47
|
-
else if ('from' in config) {
|
|
48
|
-
result[key] = config.from;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
result[key] = key; // fallback
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
result[key] = key; // fallback
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Converts any unified JSON mapping format to legacy JsonMapping format.
|
|
62
|
-
*
|
|
63
|
-
* This universal converter handles Enhanced, Unified, and Legacy formats, providing
|
|
64
|
-
* a single interface for converting complex mapping configurations to the simple
|
|
65
|
-
* format expected by PostgresJsonQueryBuilder.
|
|
66
|
-
*
|
|
67
|
-
* **Supported Input Formats:**
|
|
68
|
-
* - **Enhanced**: With metadata, type protection, and advanced column configs
|
|
69
|
-
* - **Unified**: Standard format with rootName and rootEntity
|
|
70
|
-
* - **Legacy**: Already compatible format (returned as-is)
|
|
71
|
-
*
|
|
72
|
-
* **Features:**
|
|
73
|
-
* - Automatic format detection
|
|
74
|
-
* - Column configuration simplification
|
|
75
|
-
* - Nested entity handling
|
|
76
|
-
* - Type protection extraction
|
|
77
|
-
*
|
|
78
|
-
* @param input - JSON mapping in any supported format
|
|
79
|
-
* @returns Legacy JsonMapping compatible with PostgresJsonQueryBuilder
|
|
80
|
-
*
|
|
81
|
-
* @throws {Error} When input is null, undefined, or malformed
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```typescript
|
|
85
|
-
* // Enhanced format input
|
|
86
|
-
* const enhanced = {
|
|
87
|
-
* rootName: "User",
|
|
88
|
-
* rootEntity: {
|
|
89
|
-
* columns: {
|
|
90
|
-
* id: { column: "u.user_id", type: "number" },
|
|
91
|
-
* name: { column: "u.user_name", type: "string" }
|
|
92
|
-
* }
|
|
93
|
-
* },
|
|
94
|
-
* metadata: { version: "2.0" }
|
|
95
|
-
* };
|
|
96
|
-
*
|
|
97
|
-
* const legacy = convertToLegacyJsonMapping(enhanced);
|
|
98
|
-
* // Result: Compatible with PostgresJsonQueryBuilder
|
|
99
|
-
* ```
|
|
100
|
-
*
|
|
101
|
-
* @see {@link convertColumnsToLegacy} For column-specific conversion
|
|
102
|
-
* @see {@link extractTypeProtection} For type safety features
|
|
103
|
-
*/
|
|
104
|
-
function convertToLegacyJsonMapping(input) {
|
|
105
|
-
if (!input) {
|
|
106
|
-
throw new Error('Input mapping is required');
|
|
107
|
-
}
|
|
108
|
-
// If it's already in legacy format, return as-is
|
|
109
|
-
if (input.rootName && input.rootEntity &&
|
|
110
|
-
typeof input.rootEntity.columns === 'object' &&
|
|
111
|
-
!input.typeInfo && !input.typeProtection && !input.metadata) {
|
|
112
|
-
// Check if columns are already in string format
|
|
113
|
-
const allColumnsAreStrings = Object.values(input.rootEntity.columns).every(col => typeof col === 'string');
|
|
114
|
-
if (allColumnsAreStrings) {
|
|
115
|
-
return input;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
// Enhanced format conversion
|
|
119
|
-
if (input.rootName && input.rootEntity) {
|
|
120
|
-
return {
|
|
121
|
-
rootName: input.rootName,
|
|
122
|
-
rootEntity: {
|
|
123
|
-
id: input.rootEntity.id || 'root',
|
|
124
|
-
name: input.rootEntity.name || input.rootName,
|
|
125
|
-
columns: convertColumnsToLegacy(input.rootEntity.columns || {})
|
|
126
|
-
},
|
|
127
|
-
nestedEntities: (input.nestedEntities || []).map((entity) => ({
|
|
128
|
-
id: entity.id,
|
|
129
|
-
name: entity.name,
|
|
130
|
-
parentId: entity.parentId,
|
|
131
|
-
propertyName: entity.propertyName,
|
|
132
|
-
relationshipType: entity.relationshipType,
|
|
133
|
-
columns: convertColumnsToLegacy(entity.columns || {})
|
|
134
|
-
})),
|
|
135
|
-
resultFormat: input.resultFormat,
|
|
136
|
-
emptyResult: input.emptyResult
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
throw new Error('Unsupported mapping format');
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Converts enhanced mapping to legacy format for backward compatibility.
|
|
143
|
-
*/
|
|
144
|
-
function toLegacyMapping(enhanced) {
|
|
145
|
-
return {
|
|
146
|
-
rootName: enhanced.rootName,
|
|
147
|
-
rootEntity: {
|
|
148
|
-
id: enhanced.rootEntity.id,
|
|
149
|
-
name: enhanced.rootEntity.name,
|
|
150
|
-
columns: convertColumnsToLegacy(enhanced.rootEntity.columns)
|
|
151
|
-
},
|
|
152
|
-
nestedEntities: enhanced.nestedEntities.map(entity => ({
|
|
153
|
-
id: entity.id,
|
|
154
|
-
name: entity.name,
|
|
155
|
-
parentId: entity.parentId,
|
|
156
|
-
propertyName: entity.propertyName,
|
|
157
|
-
relationshipType: entity.relationshipType,
|
|
158
|
-
columns: convertColumnsToLegacy(entity.columns)
|
|
159
|
-
})),
|
|
160
|
-
resultFormat: enhanced.resultFormat,
|
|
161
|
-
emptyResult: enhanced.emptyResult
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Extracts type protection configuration from enhanced mapping.
|
|
166
|
-
*/
|
|
167
|
-
function extractTypeProtection(enhanced) {
|
|
168
|
-
const protectedStringFields = [];
|
|
169
|
-
const dateFields = [];
|
|
170
|
-
const numberFields = [];
|
|
171
|
-
// Use existing type protection if available
|
|
172
|
-
if (enhanced.typeProtection) {
|
|
173
|
-
return {
|
|
174
|
-
protectedStringFields: enhanced.typeProtection.protectedStringFields || [],
|
|
175
|
-
dateFields: enhanced.typeProtection.dateFields,
|
|
176
|
-
numberFields: enhanced.typeProtection.numberFields,
|
|
177
|
-
customTransforms: enhanced.typeProtection.customTransforms
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
// Process root entity
|
|
181
|
-
for (const [key, config] of Object.entries(enhanced.rootEntity.columns)) {
|
|
182
|
-
if (typeof config === 'object' && config.type) {
|
|
183
|
-
const columnName = config.column;
|
|
184
|
-
switch (config.type) {
|
|
185
|
-
case 'string':
|
|
186
|
-
protectedStringFields.push(columnName);
|
|
187
|
-
break;
|
|
188
|
-
case 'date':
|
|
189
|
-
dateFields.push(columnName);
|
|
190
|
-
break;
|
|
191
|
-
case 'number':
|
|
192
|
-
numberFields.push(columnName);
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
// Process nested entities
|
|
198
|
-
for (const entity of enhanced.nestedEntities) {
|
|
199
|
-
for (const [key, config] of Object.entries(entity.columns)) {
|
|
200
|
-
if (typeof config === 'object' && config.type) {
|
|
201
|
-
const columnName = config.column;
|
|
202
|
-
switch (config.type) {
|
|
203
|
-
case 'string':
|
|
204
|
-
protectedStringFields.push(columnName);
|
|
205
|
-
break;
|
|
206
|
-
case 'date':
|
|
207
|
-
dateFields.push(columnName);
|
|
208
|
-
break;
|
|
209
|
-
case 'number':
|
|
210
|
-
numberFields.push(columnName);
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return {
|
|
217
|
-
protectedStringFields,
|
|
218
|
-
dateFields: dateFields.length > 0 ? dateFields : undefined,
|
|
219
|
-
numberFields: numberFields.length > 0 ? numberFields : undefined,
|
|
220
|
-
customTransforms: undefined
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
//# sourceMappingURL=EnhancedJsonMapping.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedJsonMapping.js","sourceRoot":"","sources":["../../src/transformers/EnhancedJsonMapping.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA8IH,wDAkBC;AA8CD,gEA2CC;AAKD,0CAoBC;AAKD,sDA2DC;AA9ND;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,sBAAsB,CAAC,OAA4B;IAC/D,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAClD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;QACzB,CAAC;aAAM,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CA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