Releases: Zendro-dev/single-page-app-codegen
Version 0.5.0
Version 0.5.0
PRs
gql-codegen#157
gql-codegen#158
gql-server#49
gql-spa#18
gql-spa-codgen#64
graphiql-auth#7
starterPack#11
Changelog
graphql-server-model-codegen
- use
zendro-env
to manage the integration-tests environment - added
-m
flag to codegen for optional generation of the migrations
refactor readMany API to not use counts and have mandatory pagination
-
pagination is mandatory!.
- limit-offset:
paginationInput
andlimit
are required by the schema. - cbp:
paginationCursorInput
required by schema. Eitherfirst
orlast
has to be given. This is checked in the resolver. Error if invalid.
- limit-offset:
-
resolver checks record limit, model-layer does not care
checkAndAdjustRecordLimit
resolver function removed, pagination arguments used instead. If exceeded error is thrown. This is now also the case in DDMs
-
views/includes/record-limit-helpers.ejs
removed as deprecated -
in case of
to_one
end of an association pagination withLIMIT 1
(eitherlimit
orfirst
) is given to the root-resolver call. -
in case of
one_to_one
end of assoc without the foreignKey pagination withLIMIT 2
is used in the root resolver, to check if a record is associated to more than 1 record. AppropriatebenignError
is added. -
readAll
andreadAllCursor
refactored:- neither does need to count.
- neither will use a limit, if no limit is given. (e.g. when requiring a model manually inside
node
) readAllCursor
validity check of pagination args moved to resolver.- To avoid calculating the
OFFSET
needed for backward-pagination, instead the resulting records will be reversed post-fetching to get the desired order. - To calculate the pageInfo (
hasNextPage | hasPreviousPage
) the query limit (if needed) will be increased by 1 (Extra check needed for the special case someone usespagination:{first: -1}
), to get information about possible succeeding records. - Additionally a second query with reversed Operators (<,<=,>,>=) with no
ORDER
andLIMIT 1
will be run to get possible preceding records. - Functionalities outsourced to helper functions.
-
changed error message for invalid response from remote zendro-server.
-
Tests
- Integration Test "
21. Limit check
" refactored - added Tests for DDM and Zendro-webservice
- added integration test for generic
readAllCursor
- Integration Test "
graphql skeleton
-
clean up server.js
-
add Helpers for
readAll
&readAllCursor
:
// SQL
searchConditionsToSequelize(search)
orderConditionsToSequelize(order, idAttribute)
orderConditionsToSequelizeBefore(order, idAttribute)
cursorPaginationArgumentsToSequelize(pagination, sequelizeOptions, idAttribute)
buildLimitOffsetSequelizeOptions(search, order, pagination, idAttribute)
buildCursorBasedSequelizeOption(search, order, pagination, idAttribute)
buildOppositeSearchSequelize(search, order, pagination, idAttribute)
buildPageInfo(edges, oppRecords, pagination)
buildEdgeObject(records)
reverseOrderConditions(order)
// Generic
cursorPaginationArgumentsToGeneric(search, pagination, orderOptions, idAttribute)
buildCursorBasedGenericOptions(search, order, pagination, idAttribute)
buildOppositeSearchGeneric(search, order, pagination, idAttribute)
- rename
checkCountAndReduceRecordLimitHelper
tocheckCountAndReduceRecordsLimit
single-page-app-codegen
- added non-blocking counter for table view and association lists
- refactor non-associated lists for mandatory pagination
- refactor plotly request module.
- refactor to-one display of the currently associated records
- refactor: simplify request module
single-page-app skeleton
- add global environment variable config file
- add
logRequest
helper for displaying of the request - add
checkResponse
helper to check request response for Errors - refactor
getSearchArgument
to be generic helper function
documentation
- added documentation on cursor-based-pagination argument
- added mandatory pagination argument to all places in the docu where needed
Version 0.4.0
graphql-server-model-codegen
-
Fix unit tests to use the internal
sequelize
model instance introduced in release 0.3.0. -
Refactor search input
value
from a composite object to two separate fields withing the search arguments:value
andvalueType
.input search<Model>Input { field: AccessionField value: String valueType: InputType operator: Operator search: [search<Model>Input] }
-
Refactor
valueType
to a newenum InputType
that accepts all GraphQL primitives supported at Zendro, and a newArray
type used only by thesearch
resolver.enum InputType{ Array String Int Float Boolean Date Time DateTime }
graphql-server
- Refactor the search input value spec in static files to match the changes in `graphql-server-model-codegen.
single-page-application-codegen
- Refactor model requests to use the new value spec in
graphql-server
andgraphql-server-model-codegen
. - Fix integration tests to use the new configuration changes introduced in release 0.3.0
0.3.0
graphql-server:
-
Added support for arbitrary local database connections in the data-model definitions (only
sql
support at the moment).- A new optional
database
property in the data-model definition specifies the connection it should use. - If this property is not defined, the mandatory
storageType
property value will be used to get the default configuration. - Each connection creates a shared
sequelize
instance. Separate database migrations and seeding will be performed on each connection. - The
seeders
folder must now have a sub-folder structure that matches the database name that needs to be seeded (e.g.seeders/default-sql/<seeders-file.js>
).
- A new optional
-
The default
sequelize
configuration fileconfig.json
has been removed in this release. A newdata_models_storage_config.json
file is included.- This file should include all connections required by the
graphql-server
. - The default connection for any data-model is specified as
default-<storageType>
. This<storageType>
suffix should match thestorageType
property in the data-model (e.g.default-sql
). - A new property
storageType
is also required in each connection (e.g.{ storageType: "sql" }
). - See the included data_models_storage_config.json for an example of the default connection.
- This file should include all connections required by the
graphql-server-model-codegen
-
Code-generator changes to support the new arbitrary database configurations.
- Migrations create a sub-folder structure matching the keys in
data_models_storage_config.json
. - Adapted generated models to use the new shared connection pool.
- Each generated model now uses its internal
sequelize
instance to perform operations.
- Migrations create a sub-folder structure matching the keys in
-
Minor changes to the integration tests command-line interface.
- Added
-b <branch>
flag to dynamically checkout and fetch remote branches in the testgraphql-server
instances. This flag can be used during adefault run
, or in combination with-k
,-s
, and-T
flags. - Added
-C
flag to only remove containers and generated code. - Added a
-s
flag to only setup or reset the testing environment server instances. - These changes allow running multiple branch tests without having to rebuild the
Dockerfile.graphql_server
image, and provide a more fine-grained control over the testing step process (e.g. for debugging).
- Added
-
Extensive refactoring of the integration tests API:
- Adapted tests to work with the new configuration changes.
- Refactored functions to be more modular and provide a more composable API.
- Detached docker image builds from
graphql-server
installation. This allows manipulation of the server instances without having to rebuild images. - Deferred
jq
binary compilation to the server image build, which is used bynode-jq
. - Standardized debug logs and made optimizations where possible.