Skip to content

Releases: typelevel/grackle

v0.23.0

30 Nov 16:22
993fe70
Compare
Choose a tag to compare

What's Changed

  • Modularised and added Oracle and SQL Server backends by @milessabin in #675

    • Split sql module into sql-core and sql-pg, the latter containing Postgres specfics shared by doobie-pg and skunk.
    • Split off doobie-core from doobie-pg removing all Postgres specfics from the former.
    • Factored out all Postgres specifics from SqlMapping.
    • Added Oracle backend.
    • Added SQL Server backend.
    • Reduced the use of lateral subqueries to a minimum.
    • Simplified SqlSelect nesting logic.
    • Avoid nested conditions being captured by predicate subqueries.
    • Replaced whale-tail with call outs to docker-compose allowing container to be shared by all suites across multiple test runs.

    Running tests (eg. rootJVM/test) will automatically spin up the relevant containers, which will stay up and can be reused across multiple tests runs, significantly speeding up the test cycle. I recommend running allUp initially, to pull images and initialise databases, before running tests the first time. Note that Oracle in particular takes quite a long time to initialise, so expect allUp to take several minutes to complete the first time around.

    There have been some changes in compilation of queries for Postgres, primarily a reduction in the usage of lateral subqueries (partly to simplify the implementation for SQL Server, which has a subtly different mechanism for achieving similar effects). These changes should preserve expected results, and reports of any changes in behaviour, including performance regressions, would be very much appreciated.

Updates

  • Added checks for exit code 0 by @phdoerfler in #679
  • Update sbt-typelevel, sbt-typelevel-site to 0.7.4 by @typelevel-steward in #664
  • Update sbt-scoverage to 2.2.2 by @typelevel-steward in #668
  • Update http4s-circe, http4s-dsl, ... to 0.23.29 by @typelevel-steward in #670
  • Update logback-classic to 1.5.12 by @typelevel-steward in #671
  • Update sbt-buildinfo to 0.13.1 by @typelevel-steward in #677
  • Update cats-effect to 3.5.7 by @typelevel-steward in #682
  • Update sbt, scripted-plugin to 1.10.6 by @typelevel-steward in #683

Full Changelog: v0.22.0...v0.23.0

v0.22.0

14 Sep 16:16
5df3486
Compare
Choose a tag to compare

What's Changed

Updates

  • Update sbt-scoverage to 2.2.0 by @typelevel-steward in #653
  • Update http4s-circe, http4s-dsl, ... to 0.23.28 by @typelevel-steward in #654

Full Changelog: v0.21.0...v0.22.0

v0.21.0

07 Sep 14:51
8d96e8e
Compare
Choose a tag to compare

What's Changed

Updates

  • Update scala-java-time to 2.6.0 by @typelevel-steward in #632
  • Update flyway-database-postgresql to 10.15.0 by @typelevel-steward in #633
  • Update circe-core, circe-generic, ... to 0.14.8 by @typelevel-steward in #635
  • Update sbt-scoverage to 2.1.0 by @typelevel-steward in #639
  • Update sbt to 1.10.1 by @typelevel-steward in #640
  • Update whale-tail-manager to 0.0.12 by @typelevel-steward in #643
  • Update sbt-typelevel, sbt-typelevel-site to 0.7.2 by @typelevel-steward in #641
  • Update logback-classic to 1.5.7 by @typelevel-steward in #645
  • Update sbt-scoverage to 2.1.1 by @typelevel-steward in #648
  • Update fs2-core, fs2-io to 3.11.0 by @typelevel-steward in #649
  • Update sbt-typelevel, sbt-typelevel-site to 0.7.3 by @typelevel-steward in #651
  • Update logback-classic to 1.5.8 by @typelevel-steward in #652

Full Changelog: v0.20.0...v0.21.0

v0.20.0

07 Jun 12:23
379bb72
Compare
Choose a tag to compare

What's Changed

  • Reworked interfaces and implementations by @milessabin in #631
    • Object type fields mapped at the interface level and interface type fields which are implemented or overridden at the object type level are now explicitly represented internally. This allows both more efficient lookup of inherited field mappings and correct lookup of overriden field mappings.
    • Field mapping lookup is now more effectively indexed in TypeMappings. This might give a noticeable performance improvement for ValueMapping. Now that this indexing in centralised in TypeMappings, the per-ObjectMapping field indices have been removed. If this proves problematic for applications it could be reinstated.
    • Schema validation now enforces the uniqueness of interfaces in implements clauses.
    • Schema validation now enforces that object and interface types must directly implement all transitively implemented interfaces. The allInterfaces method on InterfaceType has been deprecated because with the preceding validation change it is equivalent to interfaces.
    • Mapping validation now ensures that discriminator attributes for SqlInterfaceMapping are not polymorphic.
    • The Mapping-specific logic of mkCursorForField has been extracted to mkCursorForMappedField allowing simpler mapping-specific implementations.
    • Previously introspection did not report interfaces implemented by interfaces.
    • Added Schema#implementations which returns the implementing object types of an interface.
    • The unsafe TypeMappings constructor has been deprecated and renamed to unchecked.
    • TypeMappings#unsafe has been renamed to unchecked and hidden.
    • The implementations of hasField, nullableHasField, hasPath and hasListPath in Cursor had incorrect semantics and appear to be unused, so rather than fix them, they have been removed.
    • Various tests have been updated to conform to the newly implemented validation rules and changes to field mapping lookup.

Updates

  • Update munit-cats-effect to 2.0.0 by @typelevel-steward in #626
  • Update cats-core, cats-laws to 2.11.0 by @typelevel-steward in #627
  • Update flyway-database-postgresql to 10.14.0 by @typelevel-steward in #629

Full Changelog: v0.19.1...v0.20.0

v0.19.1

19 May 16:59
d4d8508
Compare
Choose a tag to compare

What's Changed

  • Fix handling of introspection types in inline fragments by @milessabin in #623
  • Bring docs into line with Typelevel organisation Code of Conduct by @milessabin in #620

Updates

  • Update skunk-circe, skunk-core to 0.6.4 by @typelevel-steward in #618
  • Update flyway-database-postgresql to 10.13.0 by @typelevel-steward in #619
  • Update shapeless to 2.3.11 by @typelevel-steward in #621

Full Changelog: v0.19.0...v0.19.1

v0.19.0

10 May 15:57
ee0fa2b
Compare
Choose a tag to compare

Main Changes

Reworked mapping management and validation by @milessabin in #608

  • The collection of type mappings has moved to a new first class TypeMappings container type. There is an implicit conversion from List[TypeMapping] to TypeMappings, so this is a source compatible change (this will probably be deprecated in a later release). Most mapping validation logic has been moved to TypeMappings, apart from mapping-specific rules (eg. for SqlMapping) which are delegated to the relevant Mapping subtype at the granularity of validity for individual type and field mappings.

    Switching to the new API involves changing initialisations of the form,

    object SomeMapping extends ... {
      val schema = ...
      val typeMappings =
        List(
          ObjectMapping(
            tpe = SomeType,
            fieldMappings =
              List(
                SomeFieldMapping(...),
                ...
              )
          ),
          ...
        )
    }

    to,

    object SomeMapping extends ... {
      val schema = ...
      val typeMappings =
        TypeMappings(
          ObjectMapping(SomeType)(
            SomeFieldMapping(...),
            ...
          ),
          ...
        )
    }

    While the current form is still supported, switching to the new form is encouraged to enable use of the new MappingPredicates.

  • Added MappingPredicate as an extensible mechanism for matching mappings to paths. TypeMatch replaces the existing Type linked association, PrefixedTypeMatch replaces the PrefixedMapping wrapper, and PathMatch corresponds to the the SwitchTypeMapping used by Gemini/Aura.

    PrefixedMapping is still available in source compatible form, however the new form is encouraged. PrefixedMappings of the form,

    PrefixedMapping(
      tpe = SomeType
      mappings =
        List(
          List("some", "path") ->
            ObjectMapping(
              tpe = SomeType,
              fieldMappings =
                List(...)
              ),
        )
    )

    should be changed to,

    ObjectMapping(PrefixedTypeMatch(List("some", "path"), SomeType))(
      SomeFieldMapping(...),
      ...
    )

    Alternatively, using the new PathMatch predicate, which matches contexts with a path leading from some enclosing type,

    ObjectMapping(PathMatch(SomeParentType / "some" / "path"))(
      SomeFieldMapping(...),
      ...
    )

    or more concisely,

    ObjectMapping(SomeParentType / "some" / "path")(
      SomeFieldMapping(...),
      ...
    )
  • Mapping validation is now performed by default unless explicitly disabled. Validation is deferred until the mappings compiler is first referenced (to avoid init-order issues, object initialization errors and poor interactions of the latter with munit-cats-effect) and is performed exactly once. Applications which have at least one query unit test will trigger validation failures automatically at test time.

    While upgrading applications to this version, it might be desirable to temporarily suppress automatic validation. To do this, an existing list of type mappings can be wrapped in the TypeMappings.unsafe constructor,

    object SomeMapping extends ... {
      val schema = ...
      val typeMappings =
        TypeMappings.unsafe(
          List(
            ObjectMapping(
              tpe = SomeType,
              fieldMappings =
                List(
                  SomeFieldMapping(...),
                  ...
                )
            ),
            ...
          )
        )
    }
  • The validation algorithm has been reworked to start from the GraphQL schema and generate an exhaustive set of paths which are used to determine the relevant mappings to check against GraphQL and DB schema types. This supports both traversal through mappings which are partly implicit (eg. the Circe and Generic mappings) and also accommodate mappings which are guarded by MappingPredicates.

  • The base mapping validator now also reports unused (ie. not reachable via any valid path in the GraphQL schema) type and field mappings, and ambiguities where multiple mappings of the same specificity match the same path.

  • The SQL mapping validator checks that,

    • Nullability and Scala type are consistent between GraphQL and SQL.
    • Choice of Leaf or ObjectMapping is consistent with GraphQL leaf or non-leaf types.
    • GraphQL object types, interfaces, implementation and union members are nested within single a single DB table.
    • Associative fields are also keys.
    • Union field mappings must be hidden and leaf.
    • Embedded subobjects must be nested in their parent object DB table.
    • Joins must have at least one join condition.
    • Parallel joins must relate the same DB tables.
    • Serial joins must chain correctly.
  • Type mappings with non-trivial predicates are now indexed.

  • LeafMapping now supports MappingPredicates and are indexed along with ObjectMappings.

  • Built-in Scalar types now have explicit LeafMappings and can now be specialized for particular contexts via MappingPredicates.

  • Added a subtree Boolean attribute to FieldMapping to signal that a field value can represent structured result subtrees which are not explicitly mapped at all levels. This allows mapping validation to include the Circe and Generic mappings which implicitly map subtrees.

  • ValueObjectMapping has a new on constructor and the withParent initializer method, which was present on all field mappings has been removed and replaced by the ValueFieldMapping specific unwrap.

    The existing API is still supported, however moving to the new API is encouraged because it supports the use of MappingPredicates. To switch, mappings of the following form,

    ValueObjectMapping[Foo](
      tpe = FooType,
      fieldMappings =
        List(
          ValueField(...),
          ...
        )
    )

    should be changed to,

    ValueObjectMapping(FooType).on[Foo](
      ValueField(...),
      ...
    )
  • The Path type now supports narrowing GraphQL interface and union types along path. This allows the PathMatch mapping predicate to match mapping which are reachable from a base type along a path which passes through fields which have interface or union type fields. Narrowing is specified using the new % element as follows,

    SomeType / "interfaceField" % ImplementingType / "implementorSpecificField"

Other changes

New Contributors

Full Changelog: v0.18.1...v0.19.0

v0.18.1

29 Jan 17:43
641fc50
Compare
Choose a tag to compare

Main Changes

Other Changes

  • Update flyway-database-postgresql to 10.4.0 by @typelevel-steward in #537
  • Update flyway-database-postgresql to 10.4.1 by @typelevel-steward in #538
  • Update http4s-circe, http4s-dsl, ... to 0.23.25 by @typelevel-steward in #539
  • Update sbt-typelevel, sbt-typelevel-site to 0.6.5 by @typelevel-steward in #540
  • Update shapeless3-deriving to 3.4.0 by @typelevel-steward in #541
  • Update flyway-database-postgresql to 10.5.0 by @typelevel-steward in #542
  • Update sbt-scalajs, scalajs-compiler, ... to 1.15.0 by @typelevel-steward in #543
  • Update shapeless3-deriving to 3.4.1 by @typelevel-steward in #544
  • Update cats-effect to 3.5.3 by @typelevel-steward in #545
  • Update flyway-database-postgresql to 10.6.0 by @typelevel-steward in #546
  • Update nscplugin, sbt-scala-native, ... to 0.4.17 by @typelevel-steward in #547
  • Update fs2-core, fs2-io to 3.9.4 by @typelevel-steward in #548
  • Update skunk-circe, skunk-core to 0.6.3 by @typelevel-steward in #549

New Contributors

Full Changelog: v0.18.0...v0.18.1

v0.18.0

18 Dec 22:00
Compare
Choose a tag to compare

This security release addresses GHSA-g56x-7j6w-g8r8.

Full Changelog: v0.17.2...v0.18.0

v0.17.2

15 Dec 10:02
Compare
Choose a tag to compare

What's Changed

  • fixing "TIMESTAMP WITH TIMEZONE" typo by @michludw in #534
  • Update sbt to 1.9.8 by @typelevel-steward in #532
  • Update sbt-typelevel, sbt-typelevel-site to 0.6.4 by @typelevel-steward in #533
  • Update flyway-database-postgresql to 10.3.0 by @typelevel-steward in #535

Full Changelog: v0.17.1...v0.17.2

v0.17.1

13 Dec 11:08
0b12675
Compare
Choose a tag to compare

What's Changed

  • Elaborate introspection in out of line fragments by @milessabin in #521
  • Tweak to some collections usage by @danicheg in #525
  • support for scalar argument without apostrophes by @michludw in #529
  • Ensure select columns are distinct in all cases by @milessabin in #530
  • Fix for fragments with supertype refinements by @milessabin in #531
  • Update logback-classic to 1.4.12 by @typelevel-steward in #522
  • Update logback-classic to 1.4.13 by @typelevel-steward in #523
  • Update logback-classic to 1.4.14 by @typelevel-steward in #524
  • Update sbt-typelevel, sbt-typelevel-site to 0.6.3 by @typelevel-steward in #526
  • Update flyway-database-postgresql to 10.2.0 by @typelevel-steward in #527
  • Update sbt-jmh to 0.4.7 by @typelevel-steward in #528

New Contributors

Full Changelog: v0.17.0...v0.17.1