graphql-engine/server/src-lib/Hasura/Function
Samir Talwar a8d1002175 server: Factor out authentication-related code into a new namespace, Hasura.Authentication.
In preparation for tightening up the various ways in which we construct and work with session variables, I am trying to move the behavior into the same module(s) as the data types, so that we can avoid exposing the internals of data structures in favor of smart constructors and conversions.

The session variable code was split between `Hasura.RQL.Types.Roles`, `Hasura.RQL.Types.Session`, and `Hasura.Session`, with the first two containing most of the data structures (and some logic) and the latter containing the rest of the logic. These files do not interact with the rest of `Hasura.RQL`, though they are depended upon by that namespace.

I have refactored these files into a new namespace, `Hasura.Authentication`. It now looks like this:

1. Role types are now in `Hasura.Authentication.Role`.
2. Header constants were moved from `Hasura.Server.Utils` to `Hasura.Authentication.Headers` (plural) to avoid cycles.
3. Header logic was moved from various places into `Hasura.Authentication.Header` (singular) for the same reason.
4. Session variable types and logic live together in `Hasura.Authentication.Session`.
5. User info types and logic live together in `Hasura.Authentication.User`.

This new structure is cycle-free and generally avoids importing the rest of the code, which means we should be able to start pruning the list of exports and locking down session variable construction.

No behavior was changed in this changeset.

The majority of changes are to the imports in a number of files; everything depends on these things. By splitting into multiple files, we also reduce the surface area of an individual import, which was a pleasant side-effect of this work.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10960
GitOrigin-RevId: 7cb962c06483cd9b92b80432aed5cabecb465cda
2024-07-29 06:02:56 +00:00
..
API.hs server: Factor out authentication-related code into a new namespace, Hasura.Authentication. 2024-07-29 06:02:56 +00:00
Cache.hs server: Factor out authentication-related code into a new namespace, Hasura.Authentication. 2024-07-29 06:02:56 +00:00
Common.hs Adding UDF (user-defined-functions) support to Data Connectors - GDC-820 2023-05-19 04:48:46 +00:00
Lenses.hs chore(server): remove Template Haskell from Hasura.Function 2023-04-28 14:14:26 +00:00
Metadata.hs Upgrade Ormolu to 0.7.0.0 2023-05-24 13:53:53 +00:00