-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: convert token types to symbols
- Loading branch information
Showing
6 changed files
with
82 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"slonik-sql-tag-raw": major | ||
"@slonik/sql-tag": major | ||
"slonik": major | ||
--- | ||
|
||
Convert token types to symbols to ensures that SQL tokens cannot be injected from outside of the codebase, e.g. through JSON. | ||
|
||
Thanks to @alxndrsn for reporting the issue. | ||
|
||
Thanks to @danielrearden for suggesting a viable patch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
export const ArrayToken = 'SLONIK_TOKEN_ARRAY' as const; | ||
export const BinaryToken = 'SLONIK_TOKEN_BINARY' as const; | ||
export const ComparisonPredicateToken = | ||
'SLONIK_TOKEN_COMPARISON_PREDICATE' as const; | ||
export const DateToken = 'SLONIK_TOKEN_DATE' as const; | ||
export const FragmentToken = 'SLONIK_TOKEN_FRAGMENT' as const; | ||
export const IdentifierToken = 'SLONIK_TOKEN_IDENTIFIER' as const; | ||
export const IntervalToken = 'SLONIK_TOKEN_INTERVAL' as const; | ||
export const JsonBinaryToken = 'SLONIK_TOKEN_JSON_BINARY' as const; | ||
export const JsonToken = 'SLONIK_TOKEN_JSON' as const; | ||
export const ListToken = 'SLONIK_TOKEN_LIST' as const; | ||
export const QueryToken = 'SLONIK_TOKEN_QUERY' as const; | ||
export const TimestampToken = 'SLONIK_TOKEN_TIMESTAMP' as const; | ||
export const UnnestToken = 'SLONIK_TOKEN_UNNEST' as const; | ||
export const ArrayToken = Symbol.for('SLONIK_TOKEN_ARRAY'); | ||
export const BinaryToken = Symbol.for('SLONIK_TOKEN_BINARY'); | ||
export const ComparisonPredicateToken = Symbol.for( | ||
'SLONIK_TOKEN_COMPARISON_PREDICATE', | ||
); | ||
export const DateToken = Symbol.for('SLONIK_TOKEN_DATE'); | ||
export const FragmentToken = Symbol.for('SLONIK_TOKEN_FRAGMENT'); | ||
export const IdentifierToken = Symbol.for('SLONIK_TOKEN_IDENTIFIER'); | ||
export const IntervalToken = Symbol.for('SLONIK_TOKEN_INTERVAL'); | ||
export const JsonBinaryToken = Symbol.for('SLONIK_TOKEN_JSON_BINARY'); | ||
export const JsonToken = Symbol.for('SLONIK_TOKEN_JSON'); | ||
export const ListToken = Symbol.for('SLONIK_TOKEN_LIST'); | ||
export const QueryToken = Symbol.for('SLONIK_TOKEN_QUERY'); | ||
export const TimestampToken = Symbol.for('SLONIK_TOKEN_TIMESTAMP'); | ||
export const UnnestToken = Symbol.for('SLONIK_TOKEN_UNNEST'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters