rawsql-ts 0.11.3-beta → 0.11.5-beta

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 (98) hide show
  1. package/dist/esm/index.js.map +1 -1
  2. package/dist/esm/index.min.js +12 -12
  3. package/dist/esm/index.min.js.map +4 -4
  4. package/dist/esm/src/index.js.map +1 -1
  5. package/dist/esm/src/models/Clause.js +2 -1
  6. package/dist/esm/src/models/Clause.js.map +1 -1
  7. package/dist/esm/src/models/HintClause.js +37 -0
  8. package/dist/esm/src/models/HintClause.js.map +1 -0
  9. package/dist/esm/src/models/ValueComponent.js +2 -1
  10. package/dist/esm/src/models/ValueComponent.js.map +1 -1
  11. package/dist/esm/src/parsers/FromClauseParser.js +7 -0
  12. package/dist/esm/src/parsers/FromClauseParser.js.map +1 -1
  13. package/dist/esm/src/parsers/FunctionExpressionParser.js +47 -4
  14. package/dist/esm/src/parsers/FunctionExpressionParser.js.map +1 -1
  15. package/dist/esm/src/parsers/SelectClauseParser.js +13 -1
  16. package/dist/esm/src/parsers/SelectClauseParser.js.map +1 -1
  17. package/dist/esm/src/parsers/SelectQueryParser.js +10 -0
  18. package/dist/esm/src/parsers/SelectQueryParser.js.map +1 -1
  19. package/dist/esm/src/parsers/SqlPrintTokenParser.js +39 -4
  20. package/dist/esm/src/parsers/SqlPrintTokenParser.js.map +1 -1
  21. package/dist/esm/src/parsers/WhereClauseParser.js +5 -0
  22. package/dist/esm/src/parsers/WhereClauseParser.js.map +1 -1
  23. package/dist/esm/src/tokenReaders/CommandTokenReader.js +2 -0
  24. package/dist/esm/src/tokenReaders/CommandTokenReader.js.map +1 -1
  25. package/dist/esm/src/transformers/DynamicQueryBuilder.js +16 -5
  26. package/dist/esm/src/transformers/DynamicQueryBuilder.js.map +1 -1
  27. package/dist/esm/src/transformers/SqlFormatter.js.map +1 -1
  28. package/dist/esm/src/transformers/SqlParameterBinder.js +63 -0
  29. package/dist/esm/src/transformers/SqlParameterBinder.js.map +1 -0
  30. package/dist/esm/src/transformers/SqlPrinter.js +12 -2
  31. package/dist/esm/src/transformers/SqlPrinter.js.map +1 -1
  32. package/dist/esm/src/utils/CommentUtils.js +65 -0
  33. package/dist/esm/src/utils/CommentUtils.js.map +1 -0
  34. package/dist/esm/src/utils/ParameterDetector.js +49 -0
  35. package/dist/esm/src/utils/ParameterDetector.js.map +1 -0
  36. package/dist/esm/tsconfig.browser.tsbuildinfo +1 -1
  37. package/dist/esm/types/src/models/Clause.d.ts +3 -1
  38. package/dist/esm/types/src/models/HintClause.d.ts +24 -0
  39. package/dist/esm/types/src/models/ValueComponent.d.ts +2 -1
  40. package/dist/esm/types/src/parsers/FunctionExpressionParser.d.ts +7 -0
  41. package/dist/esm/types/src/parsers/SqlPrintTokenParser.d.ts +5 -0
  42. package/dist/esm/types/src/transformers/SqlFormatter.d.ts +2 -0
  43. package/dist/esm/types/src/transformers/SqlParameterBinder.d.ts +36 -0
  44. package/dist/esm/types/src/transformers/SqlPrinter.d.ts +6 -0
  45. package/dist/esm/types/src/utils/CommentUtils.d.ts +21 -0
  46. package/dist/esm/types/src/utils/ParameterDetector.d.ts +32 -0
  47. package/dist/index.min.js +12 -12
  48. package/dist/index.min.js.map +4 -4
  49. package/dist/src/index.js.map +1 -1
  50. package/dist/src/models/Clause.d.ts +3 -1
  51. package/dist/src/models/Clause.js +2 -1
  52. package/dist/src/models/Clause.js.map +1 -1
  53. package/dist/src/models/HintClause.d.ts +24 -0
  54. package/dist/src/models/HintClause.js +41 -0
  55. package/dist/src/models/HintClause.js.map +1 -0
  56. package/dist/src/models/ValueComponent.d.ts +2 -1
  57. package/dist/src/models/ValueComponent.js +2 -1
  58. package/dist/src/models/ValueComponent.js.map +1 -1
  59. package/dist/src/parsers/FromClauseParser.js +7 -0
  60. package/dist/src/parsers/FromClauseParser.js.map +1 -1
  61. package/dist/src/parsers/FunctionExpressionParser.d.ts +7 -0
  62. package/dist/src/parsers/FunctionExpressionParser.js +47 -4
  63. package/dist/src/parsers/FunctionExpressionParser.js.map +1 -1
  64. package/dist/src/parsers/SelectClauseParser.js +13 -1
  65. package/dist/src/parsers/SelectClauseParser.js.map +1 -1
  66. package/dist/src/parsers/SelectQueryParser.js +10 -0
  67. package/dist/src/parsers/SelectQueryParser.js.map +1 -1
  68. package/dist/src/parsers/SqlPrintTokenParser.d.ts +5 -0
  69. package/dist/src/parsers/SqlPrintTokenParser.js +39 -4
  70. package/dist/src/parsers/SqlPrintTokenParser.js.map +1 -1
  71. package/dist/src/parsers/WhereClauseParser.js +5 -0
  72. package/dist/src/parsers/WhereClauseParser.js.map +1 -1
  73. package/dist/src/tokenReaders/CommandTokenReader.js +2 -0
  74. package/dist/src/tokenReaders/CommandTokenReader.js.map +1 -1
  75. package/dist/src/transformers/DynamicQueryBuilder.js +16 -5
  76. package/dist/src/transformers/DynamicQueryBuilder.js.map +1 -1
  77. package/dist/src/transformers/SqlFormatter.d.ts +2 -0
  78. package/dist/src/transformers/SqlFormatter.js.map +1 -1
  79. package/dist/src/transformers/SqlParameterBinder.d.ts +36 -0
  80. package/dist/src/transformers/SqlParameterBinder.js +70 -0
  81. package/dist/src/transformers/SqlParameterBinder.js.map +1 -0
  82. package/dist/src/transformers/SqlPrinter.d.ts +6 -0
  83. package/dist/src/transformers/SqlPrinter.js +12 -2
  84. package/dist/src/transformers/SqlPrinter.js.map +1 -1
  85. package/dist/src/utils/CommentUtils.d.ts +21 -0
  86. package/dist/src/utils/CommentUtils.js +69 -0
  87. package/dist/src/utils/CommentUtils.js.map +1 -0
  88. package/dist/src/utils/ParameterDetector.d.ts +32 -0
  89. package/dist/src/utils/ParameterDetector.js +53 -0
  90. package/dist/src/utils/ParameterDetector.js.map +1 -0
  91. package/dist/tsconfig.tsbuildinfo +1 -1
  92. package/package.json +1 -1
  93. package/dist/esm/src/transformers/UnifiedJsonMapping.js +0 -57
  94. package/dist/esm/src/transformers/UnifiedJsonMapping.js.map +0 -1
  95. package/dist/esm/types/src/transformers/UnifiedJsonMapping.d.ts +0 -53
  96. package/dist/src/transformers/UnifiedJsonMapping.d.ts +0 -53
  97. package/dist/src/transformers/UnifiedJsonMapping.js +0 -60
  98. package/dist/src/transformers/UnifiedJsonMapping.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rawsql-ts",
3
- "version": "0.11.3-beta",
3
+ "version": "0.11.5-beta",
4
4
  "description": "[beta]High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,57 +0,0 @@
1
- /**
2
- * Enhanced JSON mapping structure that integrates column mapping and type protection configuration.
3
- * This unified approach eliminates the need for separate .types.json files.
4
- */
5
- /**
6
- * Convert a unified JSON mapping to separate JsonMapping and TypeProtectionConfig.
7
- * This enables backward compatibility with existing code while supporting the new unified structure.
8
- */
9
- export function convertUnifiedMapping(unified) {
10
- const protectedStringFields = [];
11
- // Helper function to process columns and extract string protection settings
12
- const processColumns = (columns) => {
13
- const result = {};
14
- for (const [key, config] of Object.entries(columns)) {
15
- if (typeof config === 'string') {
16
- result[key] = config;
17
- }
18
- else {
19
- result[key] = config.column;
20
- if (config.type === 'string') {
21
- protectedStringFields.push(config.column);
22
- }
23
- }
24
- }
25
- return result;
26
- };
27
- // Convert the unified mapping to traditional JsonMapping
28
- const jsonMapping = {
29
- rootName: unified.rootName,
30
- rootEntity: {
31
- id: unified.rootEntity.id,
32
- name: unified.rootEntity.name, columns: processColumns(unified.rootEntity.columns)
33
- },
34
- nestedEntities: [] // Initialize as empty array
35
- };
36
- // Add typeInfo if it exists
37
- if (unified.typeInfo) {
38
- // Note: JsonMapping doesn't have typeInfo in core, but we preserve it for backward compatibility
39
- jsonMapping.typeInfo = unified.typeInfo;
40
- }
41
- // Process nested entities if they exist
42
- if (unified.nestedEntities) {
43
- jsonMapping.nestedEntities = unified.nestedEntities.map(entity => ({
44
- id: entity.id,
45
- name: entity.name,
46
- parentId: entity.parentId,
47
- propertyName: entity.propertyName,
48
- relationshipType: entity.relationshipType,
49
- columns: processColumns(entity.columns)
50
- }));
51
- }
52
- return {
53
- jsonMapping,
54
- typeProtection: { protectedStringFields }
55
- };
56
- }
57
- //# sourceMappingURL=UnifiedJsonMapping.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnifiedJsonMapping.js","sourceRoot":"","sources":["../../../../src/transformers/UnifiedJsonMapping.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+CH;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA2B;IAI7D,MAAM,qBAAqB,GAAa,EAAE,CAAC;IAE3C,4EAA4E;IAC5E,MAAM,cAAc,GAAG,CAAC,OAA4C,EAA0B,EAAE;QAC5F,MAAM,MAAM,GAA2B,EAAE,CAAC;QAE1C,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAClD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACJ,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;gBAC5B,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC3B,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC9C,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;IAEF,yDAAyD;IACzD,MAAM,WAAW,GAAgB;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE;YACR,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE;YACzB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;SACrF;QACD,cAAc,EAAE,EAAE,CAAE,4BAA4B;KACnD,CAAC;IAEF,4BAA4B;IAC5B,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACnB,iGAAiG;QAChG,WAAmB,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACrD,CAAC;IAED,wCAAwC;IACxC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QACzB,WAAW,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC/D,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC;SAC1C,CAAC,CAAC,CAAC;IACR,CAAC;IAED,OAAO;QACH,WAAW;QACX,cAAc,EAAE,EAAE,qBAAqB,EAAE;KAC5C,CAAC;AACN,CAAC"}
@@ -1,53 +0,0 @@
1
- /**
2
- * Enhanced JSON mapping structure that integrates column mapping and type protection configuration.
3
- * This unified approach eliminates the need for separate .types.json files.
4
- */
5
- import { JsonMapping } from './PostgresJsonQueryBuilder';
6
- /**
7
- * Supported column type enforcement options.
8
- */
9
- export type ColumnType = 'string' | 'auto';
10
- /**
11
- * Column configuration that can either be a simple string mapping or an enhanced mapping with type control.
12
- */
13
- export type ColumnMappingConfig = string | {
14
- column: string;
15
- type?: ColumnType;
16
- };
17
- /**
18
- * Enhanced JSON mapping configuration with integrated type protection.
19
- */
20
- export interface UnifiedJsonMapping {
21
- rootName: string;
22
- typeInfo?: {
23
- interface: string;
24
- importPath: string;
25
- };
26
- rootEntity: {
27
- id: string;
28
- name: string;
29
- columns: Record<string, ColumnMappingConfig>;
30
- };
31
- nestedEntities?: Array<{
32
- id: string;
33
- name: string;
34
- parentId: string;
35
- propertyName: string;
36
- relationshipType: 'object' | 'array';
37
- columns: Record<string, ColumnMappingConfig>;
38
- }>;
39
- }
40
- /**
41
- * Type protection configuration extracted from the unified mapping.
42
- */
43
- export interface TypeProtectionConfig {
44
- protectedStringFields: string[];
45
- }
46
- /**
47
- * Convert a unified JSON mapping to separate JsonMapping and TypeProtectionConfig.
48
- * This enables backward compatibility with existing code while supporting the new unified structure.
49
- */
50
- export declare function convertUnifiedMapping(unified: UnifiedJsonMapping): {
51
- jsonMapping: JsonMapping;
52
- typeProtection: TypeProtectionConfig;
53
- };
@@ -1,53 +0,0 @@
1
- /**
2
- * Enhanced JSON mapping structure that integrates column mapping and type protection configuration.
3
- * This unified approach eliminates the need for separate .types.json files.
4
- */
5
- import { JsonMapping } from './PostgresJsonQueryBuilder';
6
- /**
7
- * Supported column type enforcement options.
8
- */
9
- export type ColumnType = 'string' | 'auto';
10
- /**
11
- * Column configuration that can either be a simple string mapping or an enhanced mapping with type control.
12
- */
13
- export type ColumnMappingConfig = string | {
14
- column: string;
15
- type?: ColumnType;
16
- };
17
- /**
18
- * Enhanced JSON mapping configuration with integrated type protection.
19
- */
20
- export interface UnifiedJsonMapping {
21
- rootName: string;
22
- typeInfo?: {
23
- interface: string;
24
- importPath: string;
25
- };
26
- rootEntity: {
27
- id: string;
28
- name: string;
29
- columns: Record<string, ColumnMappingConfig>;
30
- };
31
- nestedEntities?: Array<{
32
- id: string;
33
- name: string;
34
- parentId: string;
35
- propertyName: string;
36
- relationshipType: 'object' | 'array';
37
- columns: Record<string, ColumnMappingConfig>;
38
- }>;
39
- }
40
- /**
41
- * Type protection configuration extracted from the unified mapping.
42
- */
43
- export interface TypeProtectionConfig {
44
- protectedStringFields: string[];
45
- }
46
- /**
47
- * Convert a unified JSON mapping to separate JsonMapping and TypeProtectionConfig.
48
- * This enables backward compatibility with existing code while supporting the new unified structure.
49
- */
50
- export declare function convertUnifiedMapping(unified: UnifiedJsonMapping): {
51
- jsonMapping: JsonMapping;
52
- typeProtection: TypeProtectionConfig;
53
- };
@@ -1,60 +0,0 @@
1
- "use strict";
2
- /**
3
- * Enhanced JSON mapping structure that integrates column mapping and type protection configuration.
4
- * This unified approach eliminates the need for separate .types.json files.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.convertUnifiedMapping = convertUnifiedMapping;
8
- /**
9
- * Convert a unified JSON mapping to separate JsonMapping and TypeProtectionConfig.
10
- * This enables backward compatibility with existing code while supporting the new unified structure.
11
- */
12
- function convertUnifiedMapping(unified) {
13
- const protectedStringFields = [];
14
- // Helper function to process columns and extract string protection settings
15
- const processColumns = (columns) => {
16
- const result = {};
17
- for (const [key, config] of Object.entries(columns)) {
18
- if (typeof config === 'string') {
19
- result[key] = config;
20
- }
21
- else {
22
- result[key] = config.column;
23
- if (config.type === 'string') {
24
- protectedStringFields.push(config.column);
25
- }
26
- }
27
- }
28
- return result;
29
- };
30
- // Convert the unified mapping to traditional JsonMapping
31
- const jsonMapping = {
32
- rootName: unified.rootName,
33
- rootEntity: {
34
- id: unified.rootEntity.id,
35
- name: unified.rootEntity.name, columns: processColumns(unified.rootEntity.columns)
36
- },
37
- nestedEntities: [] // Initialize as empty array
38
- };
39
- // Add typeInfo if it exists
40
- if (unified.typeInfo) {
41
- // Note: JsonMapping doesn't have typeInfo in core, but we preserve it for backward compatibility
42
- jsonMapping.typeInfo = unified.typeInfo;
43
- }
44
- // Process nested entities if they exist
45
- if (unified.nestedEntities) {
46
- jsonMapping.nestedEntities = unified.nestedEntities.map(entity => ({
47
- id: entity.id,
48
- name: entity.name,
49
- parentId: entity.parentId,
50
- propertyName: entity.propertyName,
51
- relationshipType: entity.relationshipType,
52
- columns: processColumns(entity.columns)
53
- }));
54
- }
55
- return {
56
- jsonMapping,
57
- typeProtection: { protectedStringFields }
58
- };
59
- }
60
- //# sourceMappingURL=UnifiedJsonMapping.js.map
@@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