Major Changes
-
55c010d: After 7 months of development, I'm happy to announce the release of the first major version of SafeQL!
Breaking changes!
Until now, the way to configure where SafeQL will look for the queries and how to transform them was in the connectio level. For instance:
{ "connection": { "databaseUrl": "postgres://postgres:postgres@localhost:5432/my_database", "tagName": "sql", "transform": "{type}[]", "fieldTransform": "camel" } }
While that was a good start, it was not flexible enough. For instance, if you wanted to use the same connection for multiple tags, you would have to duplicate the connection configuration over and over again.
{ "connection": { // ... "name": "dataSource", "operators": ["query", "queryOne"] }, "connection": { // ... the same connection as before "name": "conn", "operators": ["query", "queryOne"] } }
To tackle this, a new property called
targets
will now hold all of the targets that should be checked. This way, you can have multiple targets for the same connection, with the ability to transform them differently.{ "connection": { // ... "targets": [ { "tag": "sqlX", "transform": "{type}[]", "fieldTransform": "camel" }, { // glob pattern is supported as well "wrapper": "dataSource.+(query|queryOne)", "transform": "{type}[]", "fieldTransform": "camel" } ] } }
Migration guide:
If you were using
name
andoperators
to define a target, you can now use thewrapper
property instead:{ "connection": { // ... - "name": "dataSource", - "operators": ["query", "queryOne"], - "transform": "{type}[]", - "fieldTransform": "camel" + "targets": [ + { + "wrapper": "dataSource.+(query|queryOne)", + "transform": "{type}[]", + "fieldTransform": "camel" + } + ] } }
If you were using
tagName
to define a target, you can now use thetag
property instead:{ "connection": { // ... - "tagName": "sql", - "transform": "{type}[]", - "fieldTransform": "camel" + "targets": [ + { + "tag": "sql", + "transform": "{type}[]", + "fieldTransform": "camel" + } + ] } }
Patch Changes
- Updated dependencies [55c010d]
- @ts-safeql/test-utils@0.0.8
- @ts-safeql/generate@0.0.14
- @ts-safeql/shared@0.0.8