Skip to content

BaseQL API Update

TheLD requested to merge theld/baseql-context-refactor into master

Main change is the refactored context management. Now the BaseQLServer controls the context by itself instead of having a context for the request handler and another for the actual user context inside the contextManager. This eliminates the need for a contextHandler and ensures that we dont mix user and handler contexts.

Another big feature is standalone Operations, which can be defined without decorators and static functions on classes. This removes access to the this scope, but thats not neccessary for static values anyway.

This update is fully backwards comaptible until all packages are ported to only use the new standalone operations.

List of new deprecated stuffs:

  • @Arg decorator
  • @Query decorator
  • @Mutation decorator
  • @Subscription decorator
  • export constructValue from @adornis/baseql/entites/adornisEntity -> use export from @adornis/baseql/entities/construct
  • export EntityData from @adornis/baseql/entites/adornisEntity -> use export from @adornis/baseql/entities/types
  • export PartialEntityData from @adornis/baseql/entites/adornisEntity -> use export from @adornis/baseql/entities/types
  • AdornisEntity.metaTreeNode -> use baseqlMetaData.entities.resolveNode directly: EntityClass.metaTreeNode === baseqlMetaData.entities.resolveNode(EntityClass)
  • AdornisEntity.validSubclasses -> use baseqlMetaData.entities.validSubclasses
  • basically all static functions of MongoEntity apart from the lifecycle hooks as they have standalone equivalents exported from @adornis/baseql/operations/mongo or @adornis/baseql/server/resolver/mongo
  • BQLReflect, as its no longer needed after we ditch @Arg
  • export ContextManager from @adornis/baseql/server/context -> use export from @adornis/baseql/server/contextManager
  • contextManager.runInContext -> use runInContext exported from @adornis/baseql/server/server
  • contextManager.runInServerContext -> use runInServerContext exported from @adornis/baseql/server/server

Everything regarding the deprecated dataloader functions stays the same.

Edited by TheLD

Merge request reports