@flowblade/sql-tag-format 0.0.15 → 0.0.16
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/index.cjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -15
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sql-formatter.ts"],"names":["SqlFormatter","dialect","formatterOptions","sql","params","options","sqlString","sqlFormat"],"mappings":"uDAqBO,IAAMA,CAAN,
|
|
1
|
+
{"version":3,"sources":["../src/sql-formatter.ts"],"names":["SqlFormatter","dialect","formatterOptions","sql","params","options","sqlString","sqlFormat"],"mappings":"uDAqBO,IAAMA,CAAAA,CAAN,KAAmB,CAmCxB,WAAA,CACUC,CAAAA,CACAC,CAAAA,CACR,CAFQ,IAAA,CAAA,OAAA,CAAAD,EACA,IAAA,CAAA,gBAAA,CAAAC,EACP,CAgBH,YAAA,CAAe,CACbC,CAAAA,CACAC,CAAAA,GACkB,CAClB,GAAI,CACF,OAAO,IAAA,CAAK,aAAA,CAAcD,CAAAA,CAAKC,CAAM,CACvC,CAAA,KAAQ,CACN,OAAO,IACT,CACF,CAAA,CAqBA,aAAA,CAAgB,CACdD,CAAAA,CACAC,CAAAA,GACW,CACX,IAAMC,CAAAA,CAAUD,CAAAA,EAAQ,OAAA,EAAW,IAAA,CAAK,gBAAA,CAClCE,CAAAA,CAAY,OAAOH,CAAAA,EAAQ,QAAA,CAAWA,CAAAA,CAAMA,CAAAA,CAAI,GAAA,CACtD,OAAOI,mBAAAA,CAAUD,CAAAA,CAAW,CAC1B,QAAA,CAAUF,CAAAA,EAAQ,OAAA,EAAW,IAAA,CAAK,OAAA,CAClC,GAAGC,CACL,CAAC,CACH,CACF","file":"index.cjs","sourcesContent":["import type { SqlTag } from '@flowblade/sql-tag';\nimport {\n format as sqlFormat,\n type FormatOptions,\n type SqlLanguage,\n} from 'sql-formatter';\n\nexport type SqlFormatterOptions = Omit<FormatOptions, 'indentStyle'>;\nexport type SqlFormatterDialect = SqlLanguage;\n\ntype FormatParams = {\n /**\n * If not provided will default to the dialect provided in the constructor\n */\n dialect?: SqlFormatterDialect;\n /**\n * If not provided will default to the formatter options provided in the constructor\n */\n options?: Partial<SqlFormatterOptions>;\n};\n\nexport class SqlFormatter {\n /**\n * SqlFormatter constructor\n *\n * @example\n * ```typescript\n * const sqlFormatter = new SqlFormatter('postgresql');\n *\n * // Alternatively, you can pass in options\n * // @see https://github.com/sql-formatter-org/sql-formatter/tree/master?tab=readme-ov-file#configuration-options\n *\n * const pgsqlFormatter = new SqlFormatter('postgresql', {\n * keywordCase: 'preserve',\n * identifierCase: 'preserve',\n * dataTypeCase: 'preserve',\n * functionCase: 'preserve',\n * logicalOperatorNewline: 'before',\n * expressionWidth: 50,\n * linesBetweenQueries: 1,\n * denseOperators: false,\n * newlineBeforeSemicolon: false,\n * useTabs: false,\n * tabWidth: 2,\n * });\n *\n * try {\n * const formatted = pgsqlFormatter.formatOrThrow(\n * 'SELECT * FROM table WHERE id = 1'\n * );\n * } catch (e) {\n * // Might throw something similar to: Parse error: Unexpected \"[col] from\" at line 1 column 8\n * console.log('Error:', e);\n * }\n * ```\n */\n constructor(\n private dialect: SqlFormatterDialect,\n private formatterOptions?: SqlFormatterOptions\n ) {}\n\n /**\n * Format sql to string or return null if sql cannot be parsed\n *\n * @example\n * ```typescript\n * const sqlFormatter = new SqlFormatter('postgresql');\n *\n * const formatted = sqlFormatter.formatOrNull(\n * 'SELECT * FROM table WHERE id = 1'\n * );\n * ```\n *\n * @return string if sql can be parsed, null otherwise\n */\n formatOrNull = (\n sql: SqlTag<unknown> | string,\n params?: FormatParams\n ): string | null => {\n try {\n return this.formatOrThrow(sql, params);\n } catch {\n return null;\n }\n };\n\n /**\n * Format sql to string or throw an error if sql cannot be parsed\n *\n * @example\n * ```typescript\n * const sqlFormatter = new SqlFormatter('postgresql');\n *\n * try {\n * const formatted = sqlFormatter.formatOrThrow(\n * 'SELECT * FROM table WHERE id = 1'\n * );\n * } catch (e) {\n * // Might throw something similat to: Parse error: Unexpected \"[col] from\" at line 1 column 8\n * console.log('Error:', e);\n * }\n * ```\n *\n * @throws Error is sql cannot be parsed\n */\n formatOrThrow = (\n sql: SqlTag<unknown> | string,\n params?: FormatParams\n ): string => {\n const options = params?.options ?? this.formatterOptions;\n const sqlString = typeof sql === 'string' ? sql : sql.sql;\n return sqlFormat(sqlString, {\n language: params?.dialect ?? this.dialect,\n ...options,\n });\n };\n}\n"]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sql-formatter.ts"],"names":["SqlFormatter","dialect","formatterOptions","sql","params","options","sqlString","sqlFormat"],"mappings":"mCAqBO,IAAMA,CAAN,
|
|
1
|
+
{"version":3,"sources":["../src/sql-formatter.ts"],"names":["SqlFormatter","dialect","formatterOptions","sql","params","options","sqlString","sqlFormat"],"mappings":"mCAqBO,IAAMA,CAAAA,CAAN,KAAmB,CAmCxB,WAAA,CACUC,CAAAA,CACAC,CAAAA,CACR,CAFQ,IAAA,CAAA,OAAA,CAAAD,EACA,IAAA,CAAA,gBAAA,CAAAC,EACP,CAgBH,YAAA,CAAe,CACbC,CAAAA,CACAC,CAAAA,GACkB,CAClB,GAAI,CACF,OAAO,IAAA,CAAK,aAAA,CAAcD,CAAAA,CAAKC,CAAM,CACvC,CAAA,KAAQ,CACN,OAAO,IACT,CACF,CAAA,CAqBA,aAAA,CAAgB,CACdD,CAAAA,CACAC,CAAAA,GACW,CACX,IAAMC,CAAAA,CAAUD,CAAAA,EAAQ,OAAA,EAAW,IAAA,CAAK,gBAAA,CAClCE,CAAAA,CAAY,OAAOH,CAAAA,EAAQ,QAAA,CAAWA,CAAAA,CAAMA,CAAAA,CAAI,GAAA,CACtD,OAAOI,MAAAA,CAAUD,CAAAA,CAAW,CAC1B,QAAA,CAAUF,CAAAA,EAAQ,OAAA,EAAW,IAAA,CAAK,OAAA,CAClC,GAAGC,CACL,CAAC,CACH,CACF","file":"index.mjs","sourcesContent":["import type { SqlTag } from '@flowblade/sql-tag';\nimport {\n format as sqlFormat,\n type FormatOptions,\n type SqlLanguage,\n} from 'sql-formatter';\n\nexport type SqlFormatterOptions = Omit<FormatOptions, 'indentStyle'>;\nexport type SqlFormatterDialect = SqlLanguage;\n\ntype FormatParams = {\n /**\n * If not provided will default to the dialect provided in the constructor\n */\n dialect?: SqlFormatterDialect;\n /**\n * If not provided will default to the formatter options provided in the constructor\n */\n options?: Partial<SqlFormatterOptions>;\n};\n\nexport class SqlFormatter {\n /**\n * SqlFormatter constructor\n *\n * @example\n * ```typescript\n * const sqlFormatter = new SqlFormatter('postgresql');\n *\n * // Alternatively, you can pass in options\n * // @see https://github.com/sql-formatter-org/sql-formatter/tree/master?tab=readme-ov-file#configuration-options\n *\n * const pgsqlFormatter = new SqlFormatter('postgresql', {\n * keywordCase: 'preserve',\n * identifierCase: 'preserve',\n * dataTypeCase: 'preserve',\n * functionCase: 'preserve',\n * logicalOperatorNewline: 'before',\n * expressionWidth: 50,\n * linesBetweenQueries: 1,\n * denseOperators: false,\n * newlineBeforeSemicolon: false,\n * useTabs: false,\n * tabWidth: 2,\n * });\n *\n * try {\n * const formatted = pgsqlFormatter.formatOrThrow(\n * 'SELECT * FROM table WHERE id = 1'\n * );\n * } catch (e) {\n * // Might throw something similar to: Parse error: Unexpected \"[col] from\" at line 1 column 8\n * console.log('Error:', e);\n * }\n * ```\n */\n constructor(\n private dialect: SqlFormatterDialect,\n private formatterOptions?: SqlFormatterOptions\n ) {}\n\n /**\n * Format sql to string or return null if sql cannot be parsed\n *\n * @example\n * ```typescript\n * const sqlFormatter = new SqlFormatter('postgresql');\n *\n * const formatted = sqlFormatter.formatOrNull(\n * 'SELECT * FROM table WHERE id = 1'\n * );\n * ```\n *\n * @return string if sql can be parsed, null otherwise\n */\n formatOrNull = (\n sql: SqlTag<unknown> | string,\n params?: FormatParams\n ): string | null => {\n try {\n return this.formatOrThrow(sql, params);\n } catch {\n return null;\n }\n };\n\n /**\n * Format sql to string or throw an error if sql cannot be parsed\n *\n * @example\n * ```typescript\n * const sqlFormatter = new SqlFormatter('postgresql');\n *\n * try {\n * const formatted = sqlFormatter.formatOrThrow(\n * 'SELECT * FROM table WHERE id = 1'\n * );\n * } catch (e) {\n * // Might throw something similat to: Parse error: Unexpected \"[col] from\" at line 1 column 8\n * console.log('Error:', e);\n * }\n * ```\n *\n * @throws Error is sql cannot be parsed\n */\n formatOrThrow = (\n sql: SqlTag<unknown> | string,\n params?: FormatParams\n ): string => {\n const options = params?.options ?? this.formatterOptions;\n const sqlString = typeof sql === 'string' ? sql : sql.sql;\n return sqlFormat(sqlString, {\n language: params?.dialect ?? this.dialect,\n ...options,\n });\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowblade/sql-tag-format",
|
|
3
3
|
"description": "Formatter utilities for @flowblade/sql-tag",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.16",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Vanvelthem Sébastien",
|
|
@@ -67,43 +67,42 @@
|
|
|
67
67
|
"ci-coverage-upload": "../../.github/scripts/download/codecov -F flowblade-sql-tag-format --dir ./coverage"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"sql-formatter": "^15.6.
|
|
70
|
+
"sql-formatter": "^15.6.5"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@flowblade/sql-tag": "^0.1.
|
|
73
|
+
"@flowblade/sql-tag": "^0.1.15"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@arethetypeswrong/cli": "0.18.
|
|
77
|
-
"@belgattitude/eslint-config-bases": "7.
|
|
76
|
+
"@arethetypeswrong/cli": "0.18.2",
|
|
77
|
+
"@belgattitude/eslint-config-bases": "7.3.0",
|
|
78
78
|
"@codspeed/vitest-plugin": "4.0.1",
|
|
79
79
|
"@edge-runtime/vm": "5.0.0",
|
|
80
80
|
"@size-limit/file": "11.2.0",
|
|
81
81
|
"@size-limit/webpack": "11.2.0",
|
|
82
|
-
"@vitest/coverage-istanbul": "3.
|
|
83
|
-
"@vitest/ui": "3.
|
|
84
|
-
"browserslist": "4.
|
|
82
|
+
"@vitest/coverage-istanbul": "3.2.4",
|
|
83
|
+
"@vitest/ui": "3.2.4",
|
|
84
|
+
"browserslist": "4.25.1",
|
|
85
85
|
"browserslist-to-esbuild": "2.1.1",
|
|
86
86
|
"cross-env": "7.0.3",
|
|
87
|
-
"es-check": "9.1.
|
|
87
|
+
"es-check": "9.1.4",
|
|
88
88
|
"esbuild": "0.25.5",
|
|
89
89
|
"eslint": "8.57.1",
|
|
90
90
|
"execa": "9.6.0",
|
|
91
91
|
"npm-run-all2": "8.0.4",
|
|
92
|
-
"prettier": "3.
|
|
92
|
+
"prettier": "3.6.1",
|
|
93
93
|
"publint": "0.3.12",
|
|
94
94
|
"rimraf": "6.0.1",
|
|
95
|
-
"rollup": "4.41.1",
|
|
96
95
|
"size-limit": "11.2.0",
|
|
97
96
|
"tsup": "8.5.0",
|
|
98
|
-
"tsx": "4.
|
|
97
|
+
"tsx": "4.20.3",
|
|
99
98
|
"typedoc": "0.28.5",
|
|
100
|
-
"typedoc-plugin-markdown": "4.
|
|
99
|
+
"typedoc-plugin-markdown": "4.7.0",
|
|
101
100
|
"typescript": "5.8.3",
|
|
102
101
|
"vite-tsconfig-paths": "5.1.4",
|
|
103
|
-
"vitest": "3.
|
|
102
|
+
"vitest": "3.2.4",
|
|
104
103
|
"webpack": "5.99.9"
|
|
105
104
|
},
|
|
106
105
|
"engines": {
|
|
107
|
-
"node": ">=
|
|
106
|
+
"node": ">=20.9.0"
|
|
108
107
|
}
|
|
109
108
|
}
|